FrontISTR  5.2.0
Large-scale structural analysis program with finit element method
CFSTRDB_CFlux.cpp
Go to the documentation of this file.
1 /*****************************************************************************
2  * Copyright (c) 2019 FrontISTR Commons
3  * This software is released under the MIT License, see LICENSE.txt
4  *****************************************************************************/
5 /*
6  CFSTRDB_CFlux Ver.1.0
7 */
8 
9 #include "CFSTRDB.h"
10 #include "CHECData.h"
11 
12 using namespace std;
13 
15  amp[0] = 0;
16 }
17 
19 
21  ItemList.clear();
22  amp[0] = 0;
23 }
24 
26  if (ItemList.size() == 0) return;
27 
28  if (amp[0] == 0) {
29  hecd->WriteHeader("!CFLUX");
30 
31  } else {
32  hecd->WriteHeader("!CFLUX", "S", "AMP", amp);
33  }
34 
35  vector<CItem>::iterator iter;
36 
37  for (iter = ItemList.begin(); iter != ItemList.end(); iter++) {
38  hecd->WriteData("SF", iter->ngrp, iter->value);
39  }
40 }
41 
42 bool CFSTRDB_CFlux::Read(CHECData *hecd, char *header_line) {
43  int rcode[10];
44  amp[0] = 0;
45 
46  if (!hecd->ParseHeader(header_line, rcode, "S", "AMP", amp)) return false;
47 
48  while (1) {
49  CItem item;
50 
51  if (!hecd->ReadData(rcode, "SF", item.ngrp, &item.value)) break;
52 
53  ItemList.push_back(item);
54  }
55 
56  return true;
57 }
@ FSTRDB_CFLUX
Definition: CFSTRDB.h:46
char ngrp[hec_name_size]
Definition: CFSTRDB.h:386
virtual ~CFSTRDB_CFlux()
char amp[hec_name_size]
Definition: CFSTRDB.h:395
std::vector< CItem > ItemList
Definition: CFSTRDB.h:399
virtual void Write(class CHECData *hecd)
virtual bool Read(class CHECData *hecd, char *header_line)
virtual void Clear()
virtual bool ReadData(int *rcode, const char *fmt,...)
Definition: CHECData.cpp:548
virtual bool ParseHeader(char *header_line, int *rcode, const char *fmt,...)
Definition: CHECData.cpp:506
virtual void WriteData(const char *fmt,...)
Definition: CHECData.cpp:162
virtual void WriteHeader(const char *name, const char *fmt="",...)
Definition: CHECData.cpp:68