FrontISTR  5.7.1
Large-scale structural analysis program with finit element method
CHECDB_Section.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_Section Ver.1.0
7 */
8 
9 #include "CHECDB.h"
10 #include "CHECData.h"
11 
12 using namespace std;
13 using namespace hecd_util;
14 
17  type(TYPE_UNKNOWN),
18  n_comp(0),
19  secopt(0),
20  thickness(1.0),
21  integpoints(0),
22  gapcon(0),
23  gaprad1(0),
24  gaprad2(0) {
25  egrp[0] = 0;
26  material[0] = 0;
27 }
28 
30 
33  n_comp = 0;
34  secopt = 0;
35  thickness = 1.0;
36  integpoints = 0;
37  gapcon = 0;
38  gaprad1 = 0;
39  gaprad2 = 0;
40  egrp[0] = 0;
41  material[0] = 0;
42 }
43 
45  switch (type) {
46  case TYPE_SOLID:
47  hecd->WriteHeader("!SECTION", "SSS", "TYPE", "SOLID", "EGRP", egrp,
48  "MATERIAL", material);
49  hecd->WriteData("F", thickness);
50  break;
51 
52  case TYPE_SHELL:
53  hecd->WriteHeader("!SECTION", "SSS", "TYPE", "SHELL", "EGRP", egrp,
54  "MATERIAL", material);
55  hecd->WriteData("FI", thickness, integpoints);
56  break;
57 
58  case TYPE_INTERFACE:
59  hecd->WriteHeader("!SECTION", "SSS", "INTERFACE", "SOLID", "EGRP", egrp,
60  "MATERIAL", material);
61  hecd->WriteData("FFFF", thickness, gapcon, gaprad1, gaprad2);
62 
63  default:
64  assert(0);
65  }
66 }
67 
68 bool CHECDB_Section::Read(class CHECData *hecd, char *header_line) {
69  int rcode[10];
70  char s[256], type_s[256];
71 
72  if (!hecd->ParseHeader(header_line, rcode, "SSS", "TYPE", s, "EGRP", egrp,
73  "MATERIAL", material))
74  return false;
75 
76  cleanup_token(s, type_s);
77  toupper(type_s);
78 
79  if (strcmp(type_s, "SOLID") == 0) {
80  type = TYPE_SOLID;
81 
82  if (!hecd->ReadData(rcode, "F", &thickness)) return false;
83 
84  } else if (strcmp(type_s, "SHELL") == 0) {
85  type = TYPE_SHELL;
86 
87  if (!hecd->ReadData(rcode, "FI", &thickness, &integpoints)) return false;
88 
89  } else if (strcmp(type_s, "INTERFACE") == 0) {
91 
92  if (!hecd->ReadData(rcode, "FFFF", &thickness, &gapcon, &gaprad1, &gaprad2))
93  return false;
94 
95  } else {
96  return false;
97  }
98 
99  return true;
100 }
@ HECDB_SECTION
Definition: CHECDB.h:22
virtual bool Read(class CHECData *hecd, char *header_line)
char egrp[hec_name_size]
Definition: CHECDB.h:181
char material[hec_name_size]
Definition: CHECDB.h:182
@ TYPE_INTERFACE
Definition: CHECDB.h:178
double gapcon
Definition: CHECDB.h:193
virtual void Clear()
double thickness
Definition: CHECDB.h:187
virtual void Write(class CHECData *hecd)
int integpoints
Definition: CHECDB.h:190
virtual ~CHECDB_Section()
double gaprad1
Definition: CHECDB.h:194
double gaprad2
Definition: CHECDB.h:195
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