FrontISTR  5.7.0
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 }
CHECDB_Section::thickness
double thickness
Definition: CHECDB.h:187
CHECDataBlock
Definition: CHECDataBlock.h:17
CHECData::ParseHeader
virtual bool ParseHeader(char *header_line, int *rcode, const char *fmt,...)
Definition: CHECData.cpp:506
CHECData.h
CHECDB_Section::egrp
char egrp[hec_name_size]
Definition: CHECDB.h:181
hecd_util::toupper
void toupper(char *s)
Definition: hecd_util.cpp:40
CHECDB_Section::Write
virtual void Write(class CHECData *hecd)
Definition: CHECDB_Section.cpp:44
CHECDB_Section::n_comp
int n_comp
Definition: CHECDB.h:183
CHECDB_Section::CHECDB_Section
CHECDB_Section()
Definition: CHECDB_Section.cpp:15
CHECDB_Section::gaprad2
double gaprad2
Definition: CHECDB.h:195
hecd_util::cleanup_token
void cleanup_token(char *s)
Definition: hecd_util.cpp:16
CHECDB_Section::Clear
virtual void Clear()
Definition: CHECDB_Section.cpp:31
CHECDB_Section::Read
virtual bool Read(class CHECData *hecd, char *header_line)
Definition: CHECDB_Section.cpp:68
CHECDB_Section::gaprad1
double gaprad1
Definition: CHECDB.h:194
CHECData::WriteData
virtual void WriteData(const char *fmt,...)
Definition: CHECData.cpp:162
CHECDB.h
CHECData::ReadData
virtual bool ReadData(int *rcode, const char *fmt,...)
Definition: CHECData.cpp:548
CHECDB_Section::~CHECDB_Section
virtual ~CHECDB_Section()
Definition: CHECDB_Section.cpp:29
CHECDB_Section::material
char material[hec_name_size]
Definition: CHECDB.h:182
CHECData::WriteHeader
virtual void WriteHeader(const char *name, const char *fmt="",...)
Definition: CHECData.cpp:68
CHECData
Definition: CHECData.h:25
CHECDB_Section::type
int type
Definition: CHECDB.h:180
CHECDB_Section::TYPE_SHELL
@ TYPE_SHELL
Definition: CHECDB.h:178
CHECDB_Section::secopt
int secopt
Definition: CHECDB.h:184
CHECDB_Section::TYPE_SOLID
@ TYPE_SOLID
Definition: CHECDB.h:178
HECDB_SECTION
@ HECDB_SECTION
Definition: CHECDB.h:25
hecd_util
Definition: hecd_util.cpp:11
CHECDB_Section::TYPE_UNKNOWN
@ TYPE_UNKNOWN
Definition: CHECDB.h:178
CHECDB_Section::TYPE_INTERFACE
@ TYPE_INTERFACE
Definition: CHECDB.h:178
CHECDB_Section::integpoints
int integpoints
Definition: CHECDB.h:190
CHECDB_Section::gapcon
double gapcon
Definition: CHECDB.h:193