FrontISTR 5.2.0
Large-scale structural analysis program with finit element method
Loading...
Searching...
No Matches
CHECDB_EGroup.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_EGroup Ver.1.0
7*/
8
9#include "CHECDB.h"
10#include "CHECData.h"
11
12using namespace std;
13using namespace hecd_util;
14
16 name[0] = 0;
17}
18
20
21void CHECDB_EGroup::Clear() { ElemList.clear(); }
22
24 if (ElemList.size() == 0) return;
25
26 hecd->WriteHeader("!EGROUP", "S", "EGRP", name);
27 set<int>::iterator iter;
28
29 for (iter = ElemList.begin(); iter != ElemList.end(); iter++) {
30 hecd->WriteData("I", *iter);
31 }
32}
33
34bool CHECDB_EGroup::Read(CHECData *hecd, char *header_line) {
35 int rcode[5];
36
37 if (!hecd->ParseHeader(header_line, rcode, "S", "EGRP", name)) return false;
38
39 char line[256];
40 const int max_id_n = 100;
41 int id[max_id_n];
42 int i, n;
43
44 while (1) {
45 if (!hecd->ReadLine(line)) break;
46
47 if (line[0] == '!') {
48 hecd->PushReadLine(line);
49 break;
50 }
51
52 n = hecd->ParseIntDataArray(line, id);
53
54 if (n < 0) return false;
55
56 for (i = 0; i < n; i++) {
57 ElemList.insert(id[i]);
58 }
59 }
60
61 return true;
62}
@ HECDB_EGROUP
Definition: CHECDB.h:24
char name[hec_name_size]
Definition: CHECDB.h:218
virtual void Clear()
virtual bool Read(class CHECData *hecd, char *header_line)
std::set< int > ElemList
Definition: CHECDB.h:219
virtual void Write(class CHECData *hecd)
virtual ~CHECDB_EGroup()
virtual int ParseIntDataArray(char *line, int *data)
Definition: CHECData.cpp:617
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 bool ReadLine(char *s, int size=256)
Definition: CHECData.cpp:307
virtual void WriteHeader(const char *name, const char *fmt="",...)
Definition: CHECData.cpp:68
virtual void PushReadLine(const char *s)
Definition: CHECData.cpp:328