FrontISTR  5.7.1
Large-scale structural analysis program with finit element method
CFSTRDB_Fixtemp.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_Fixtemp Ver.1.0
7 */
8 
9 #include "CFSTRDB.h"
10 #include "CHECData.h"
11 
12 using namespace std;
13 
15  : CFSTRDataBlock(FSTRDB_FIXTEMP), ItemList() {
16  amp[0] = 0;
17 }
18 
20 
22  ItemList.clear();
23  amp[0] = 0;
24 }
25 
27  if (ItemList.size() == 0) return;
28 
29  if (amp[0] == 0) {
30  hecd->WriteHeader("!FIXTEMP");
31 
32  } else {
33  hecd->WriteHeader("!FIXTEMP", "S", "AMP", amp);
34  }
35 
36  vector<CItem>::iterator iter;
37 
38  for (iter = ItemList.begin(); iter != ItemList.end(); iter++) {
39  hecd->WriteData("SF", iter->ngrp, iter->value);
40  }
41 }
42 
43 bool CFSTRDB_Fixtemp::Read(CHECData *hecd, char *header_line) {
44  int rcode[10];
45  amp[0] = 0;
46 
47  if (!hecd->ParseHeader(header_line, rcode, "S", "AMP", amp)) return false;
48 
49  while (1) {
50  CItem item;
51 
52  if (!hecd->ReadData(rcode, "SF", item.ngrp, &item.value)) break;
53 
54  ItemList.push_back(item);
55  }
56 
57  return true;
58 }
@ FSTRDB_FIXTEMP
Definition: CFSTRDB.h:45
char ngrp[hec_name_size]
Definition: CFSTRDB.h:360
virtual ~CFSTRDB_Fixtemp()
std::vector< CItem > ItemList
Definition: CFSTRDB.h:373
virtual void Clear()
virtual bool Read(class CHECData *hecd, char *header_line)
char amp[hec_name_size]
Definition: CFSTRDB.h:369
virtual void Write(class CHECData *hecd)
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