FrontISTR 5.2.0
Large-scale structural analysis program with finit element method
Loading...
Searching...
No Matches
CHECDB_Amplitude.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 CHECDB_Amplitude Ver.1.0
7*/
8
9#include "CHECDB.h"
10#include "CHECData.h"
11
12using namespace std;
13
15 : CHECDataBlock(HECDB_AMPLITUDE), ItemList() {
16 name[0] = 0;
17 strcpy(definition, "TABULAR");
18 strcpy(time, "STEP TIME");
19 strcpy(value, "RLATIVE");
20}
21
23
25
27 if (ItemList.size() == 0) return;
28
29 hecd->WriteHeader("!AMPLITUDE", "SSSS", "NAME", name, "DEFINITION",
30 definition, "TIME", time, "VALUE", value);
31 vector<CItem>::iterator iter;
32
33 for (iter = ItemList.begin(); iter != ItemList.end(); iter++) {
34 hecd->WriteData("FF", iter->val, iter->t);
35 }
36}
37
38bool CHECDB_Amplitude::Read(CHECData *hecd, char *header_line) {
39 int rcode[10];
40
41 if (!hecd->ParseHeader(header_line, rcode, "SSSS", "NAME", name, "DEFINITION",
42 definition, "TIME", time, "VALUE", value))
43 return false;
44
45 double val, t;
46
47 while (hecd->ReadData(rcode, "FF", &val, &t)) {
48 ItemList.push_back(CItem(val, t));
49 }
50
51 return true;
52}
@ HECDB_AMPLITUDE
Definition: CHECDB.h:26
virtual void Clear()
virtual bool Read(class CHECData *hecd, char *header_line)
virtual ~CHECDB_Amplitude()
char name[hec_name_size]
Definition: CHECDB.h:248
virtual void Write(class CHECData *hecd)
char definition[hec_name_size]
Definition: CHECDB.h:249
char value[hec_name_size]
Definition: CHECDB.h:251
std::vector< CItem > ItemList
Definition: CHECDB.h:258
char time[hec_name_size]
Definition: CHECDB.h:250
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