FrontISTR  5.2.0
Large-scale structural analysis program with finit element method
CFSTRDB_SRadiate.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_SRadiate Ver.1.0
7 */
8 
9 #include "CFSTRDB.h"
10 #include "CHECData.h"
11 
12 using namespace std;
13 
15  : CFSTRDataBlock(FSTRDB_SRADIATE), ItemList() {
16  amp1[0] = 0;
17  amp2[0] = 0;
18 }
19 
21 
23  ItemList.clear();
24  amp1[0] = 0;
25  amp2[0] = 0;
26 }
27 
29  char buff[256];
30 
31  if (ItemList.size() == 0) return;
32 
33  strcpy(buff, "!SRADIATE");
34 
35  if (amp1[0] != 0) {
36  strcat(buff, ",AMP1=");
37  strcat(buff, amp1);
38  }
39 
40  if (amp2[0] != 0) {
41  strcat(buff, ",AMP2=");
42  strcat(buff, amp2);
43  }
44 
45  hecd->WriteHeader(buff);
46  vector<CItem>::iterator iter;
47 
48  for (iter = ItemList.begin(); iter != ItemList.end(); iter++) {
49  hecd->WriteData("SFF", iter->sgrp, iter->value, iter->sink);
50  }
51 }
52 
53 bool CFSTRDB_SRadiate::Read(CHECData *hecd, char *header_line) {
54  int rcode[10];
55  amp1[0] = 0;
56  amp2[0] = 0;
57 
58  if (!hecd->ParseHeader(header_line, rcode, "SS", "AMP1", amp1, "AMP2", amp2))
59  return false;
60 
61  while (1) {
62  CItem item;
63  bool fg = hecd->ReadData(rcode, "SFF", item.sgrp, &item.value, &item.sink);
64 
65  if (!fg) break;
66 
67  ItemList.push_back(item);
68  }
69 
70  return true;
71 }
@ FSTRDB_SRADIATE
Definition: CFSTRDB.h:52
char sgrp[hec_name_size]
Definition: CFSTRDB.h:614
virtual void Write(class CHECData *hecd)
virtual void Clear()
virtual ~CFSTRDB_SRadiate()
char amp1[hec_name_size]
Definition: CFSTRDB.h:628
virtual bool Read(class CHECData *hecd, char *header_line)
char amp2[hec_name_size]
Definition: CFSTRDB.h:629
std::vector< CItem > ItemList
Definition: CFSTRDB.h:633
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