FrontISTR  5.7.1
Large-scale structural analysis program with finit element method
CFSTRDB_Solution.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_Solution Ver.1.0
7 */
8 
9 #include "CFSTRDB.h"
10 #include "CHECData.h"
11 
12 using namespace std;
13 using namespace hecd_util;
14 
16  : CFSTRDataBlock(FSTRDB_SOLUTION), type(TYPE_STATIC) {}
17 
19 
21 
23  if (type == TYPE_UNKNOWN) return;
24 
25  switch (type) {
26  case TYPE_STATIC:
27  hecd->WriteHeader("!SOLUTION", "S", "TYPE", "STATIC");
28  break;
29 
30  case TYPE_HEAT:
31  hecd->WriteHeader("!SOLUTION", "S", "TYPE", "HEAT");
32  break;
33 
34  case TYPE_EIGEN:
35  hecd->WriteHeader("!SOLUTION", "S", "TYPE", "EIGEN");
36  break;
37 
38  default:
39  assert(0);
40  }
41 }
42 
43 bool CFSTRDB_Solution::Read(CHECData *hecd, char *header_line) {
44  int rcode[5];
45  char s[256];
46  char type_s[256];
47 
48  if (!hecd->ParseHeader(header_line, rcode, "S", "TYPE", s)) return false;
49 
50  cleanup_token(s, type_s);
51  toupper(type_s);
52 
53  if (strcmp(type_s, "STATIC") == 0) {
54  type = TYPE_STATIC;
55 
56  } else if (strcmp(type_s, "HEAT") == 0) {
57  type = TYPE_HEAT;
58 
59  } else if (strcmp(type_s, "EIGEN") == 0) {
60  type = TYPE_EIGEN;
61 
62  } else
63  return false;
64 
65  return true;
66 }
@ FSTRDB_SOLUTION
Definition: CFSTRDB.h:29
virtual void Write(class CHECData *hecd)
virtual void Clear()
virtual ~CFSTRDB_Solution()
virtual bool Read(class CHECData *hecd, char *header_line)
virtual bool ParseHeader(char *header_line, int *rcode, const char *fmt,...)
Definition: CHECData.cpp:506
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