FrontISTR 5.2.0
Large-scale structural analysis program with finit element method
Loading...
Searching...
No Matches
CFSTRDB_DFlux.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_DFlux Ver.1.0
7*/
8
9#include "CFSTRDB.h"
10#include "CHECData.h"
11
12using namespace std;
13using namespace hecd_util;
14
15// static method
16
17const char *CFSTRDB_DFlux::LoadTypeName(int type) {
18 const char *pn[] = {
19 "S0", "S1", "S2", "S3", "S4", "S5", "S6", "BF", "unknown",
20 };
21
22 if (type < 0 || type >= TypeNumber()) return "";
23
24 return pn[type];
25}
26
28 amp[0] = 0;
29}
30
32
34 ItemList.clear();
35 amp[0] = 0;
36}
37
39 if (ItemList.size() == 0) return;
40
41 if (amp[0] == 0) {
42 hecd->WriteHeader("!DFLUX");
43
44 } else {
45 hecd->WriteHeader("!DFLUX", "S", "AMP", amp);
46 }
47
48 vector<CItem>::iterator iter;
49
50 for (iter = ItemList.begin(); iter != ItemList.end(); iter++) {
51 hecd->WriteData("SSF", iter->egrp, LoadTypeName(iter->type), iter->value);
52 }
53}
54
55bool CFSTRDB_DFlux::Read(CHECData *hecd, char *header_line) {
56 int rcode[10];
57 char s[256];
58 int type;
59 amp[0] = 0;
60
61 if (!hecd->ParseHeader(header_line, rcode, "S", "AMP", amp)) return false;
62
63 while (1) {
64 CItem item;
65 bool fg = hecd->ReadData(rcode, "SSF", item.egrp, s, &item.value);
66
67 if (!fg) break;
68
70 toupper(s);
71
72 for (type = 0; type < TypeNumber(); type++) {
73 if (strcmp(LoadTypeName(type), s) == 0) break;
74 }
75
76 if (type == TypeNumber()) return false;
77
78 item.type = type;
79 ItemList.push_back(item);
80 }
81
82 return true;
83}
@ FSTRDB_DFLUX
Definition: CFSTRDB.h:47
char egrp[hec_name_size]
Definition: CFSTRDB.h:427
static const char * LoadTypeName(int type)
virtual bool Read(class CHECData *hecd, char *header_line)
virtual ~CFSTRDB_DFlux()
virtual void Clear()
std::vector< CItem > ItemList
Definition: CFSTRDB.h:445
static int TypeNumber()
Definition: CFSTRDB.h:422
char amp[hec_name_size]
Definition: CFSTRDB.h:441
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
void toupper(char *s)
Definition: hecd_util.cpp:37
void cleanup_token(char *s)
Definition: hecd_util.cpp:13