-
Notifications
You must be signed in to change notification settings - Fork 0
/
TableStorage.h
149 lines (127 loc) · 3.25 KB
/
TableStorage.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
#pragma once
#include <string>
#include <vector>
class ErrorManager;
struct Element
{
enum etype {
conrod, // axial and torsonial stress only
rod,
tube,
I,
chan,
T,
box,
bar,
cross,
H
};
double C; // torsonial stress constant (for conrod -- no property entry
double J; // torsonial constant for conrod
double diam; // diameter for conrod
double mass; // total mass depends on length
double length; // calculated
int grida;
int gridb;
int intgrida;
int intgridb;
int pid; // must be positive for input, generated properties are negative
int intpid;
int pinFlagsa;
int pinFlagsb;
int id;
etype type;
};
struct Grid
{
double x;
double y;
double z;
double addmass;
int id;
bool constraints[6];
bool operator<(Grid a) { if (a.id < id) return true; else return false; }
Grid()
{
id = -1;
constraints[0] = false; // false = free
constraints[1] = false;
constraints[2] = false;
constraints[3] = false;
constraints[4] = false;
constraints[5] = false;
addmass = 0.0;
x = y = z = 0.0;
}
};
struct MAT1
{
double e; // youngs modulus
double g; // shear modulus
double nu; // Poisson's ratio
double rho; // Mass density
int id;
};
struct PBAR
{
double area;
double I1, I2, I3; // moments of intertia
double j; // torsonial constant
double nsm; // nonstructural mass
double k1; // area for shear
double k2;
int id;
int mid; // MAT1 ID
int intmid;
};
struct Force
{
double fm[6];
int loadset;
int intgid;
int gid;
};
class TableStorage
{
public:
TableStorage();
~TableStorage();
// This class stores the element table and the grid table
public:
static TableStorage& getInstance()
{
static TableStorage instance;
return instance;
}
int NumGrid(){return (int)GridTable.size(); }
int AddGridPoint(int id, double x, double y, double z, char* spc);
Grid getGrid(int i) { return GridTable[i]; }
int NumElement() { return static_cast<int>(ElementTable.size()); }
int AddCbarElement(int id, int pid, int iga, int igb, double x, double y, double z, int PA, int PB);
Element getElement(int i) { return ElementTable[i]; }
int NumProperties() { return static_cast<int>(PropertyTable.size()); }
//PBAR, pid, mid, A, i1, i2, j, nsm,
int AddPbar(int id, int mid, double A, double i1, double i2, double j, double nsm);
int AddPbarLame(int id);
PBAR getProperty(int i) { return PropertyTable[i]; }
int AddMaterial(int id, double e, double g, double nu, double ro);
int NumMaterials() { return static_cast<int>(MaterialTable.size()); }
MAT1 getMaterial(int i) { return MaterialTable[i]; }
void AddConstraint(int ig, char* alpha);
int AddForce(int gid, int loadset, double fx, double fy, double fz);
int NumForces() { return static_cast<int>(ForceTable.size()); }
Force getForce(int i) { return ForceTable[i]; }
int CleanUpData();
void FillElementTable();
private:
ErrorManager& EM;
int CheckForDupEID(int id);
int inline FindGridIndex(int id);
std::vector<Grid> GridTable;
std::vector<Element> ElementTable;
std::vector<MAT1> MaterialTable;
std::vector<PBAR> PropertyTable;
std::vector<Force> ForceTable;
//std::vector<MAT1> PRodTable;
};
//