FrontISTR
5.7.0
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
15
CFSTRDB_Solution::CFSTRDB_Solution
()
16
:
CFSTRDataBlock
(
FSTRDB_SOLUTION
), type(TYPE_STATIC) {}
17
18
CFSTRDB_Solution::~CFSTRDB_Solution
() {
Clear
(); }
19
20
void
CFSTRDB_Solution::Clear
() {
type
=
TYPE_STATIC
; }
21
22
void
CFSTRDB_Solution::Write
(
CHECData
*hecd) {
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
}
CHECData::ParseHeader
virtual bool ParseHeader(char *header_line, int *rcode, const char *fmt,...)
Definition:
CHECData.cpp:506
CHECData.h
hecd_util::toupper
void toupper(char *s)
Definition:
hecd_util.cpp:40
CFSTRDB_Solution::type
int type
Definition:
CFSTRDB.h:70
CFSTRDB.h
CFSTRDB_Solution::TYPE_HEAT
@ TYPE_HEAT
Definition:
CFSTRDB.h:71
hecd_util::cleanup_token
void cleanup_token(char *s)
Definition:
hecd_util.cpp:16
CFSTRDB_Solution::CFSTRDB_Solution
CFSTRDB_Solution()
Definition:
CFSTRDB_Solution.cpp:15
CFSTRDB_Solution::TYPE_STATIC
@ TYPE_STATIC
Definition:
CFSTRDB.h:71
CFSTRDB_Solution::Write
virtual void Write(class CHECData *hecd)
Definition:
CFSTRDB_Solution.cpp:22
FSTRDB_SOLUTION
@ FSTRDB_SOLUTION
Definition:
CFSTRDB.h:29
CHECData::WriteHeader
virtual void WriteHeader(const char *name, const char *fmt="",...)
Definition:
CHECData.cpp:68
CFSTRDB_Solution::Clear
virtual void Clear()
Definition:
CFSTRDB_Solution.cpp:20
CHECData
Definition:
CHECData.h:25
CFSTRDB_Solution::Read
virtual bool Read(class CHECData *hecd, char *header_line)
Definition:
CFSTRDB_Solution.cpp:43
CFSTRDB_Solution::TYPE_UNKNOWN
@ TYPE_UNKNOWN
Definition:
CFSTRDB.h:71
hecd_util
Definition:
hecd_util.cpp:11
CFSTRDB_Solution::TYPE_EIGEN
@ TYPE_EIGEN
Definition:
CFSTRDB.h:71
CFSTRDataBlock
Definition:
CFSTRDB.h:58
CFSTRDB_Solution::~CFSTRDB_Solution
virtual ~CFSTRDB_Solution()
Definition:
CFSTRDB_Solution.cpp:18
fistr1
tools
neu2fstr
HECD
CFSTRDB_Solution.cpp
Generated by
1.8.17