This repository has been archived by the owner on Aug 1, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMesh.hpp
319 lines (240 loc) · 7.51 KB
/
Mesh.hpp
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
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
//-------------------------------------------------------------------------
// Filename : Mesh.hpp
//
// Purpose : This class contains the global mesh information and
// controls the MeshBlocks for the mesh.
//
// Special Notes :
//
// Creator : Ray Meyers
//
// Date : 10/14/98
//
// Owner : Ray Meyers
//-------------------------------------------------------------------------
#ifndef MESH_HPP
#define MESH_HPP
#include <deque>
#include "VerdeDefines.hpp"
class ElementBlock;
class MeshContainer;
class VerdeVector;
class ElemRef;
class NodeBC;
class ElementBC;
//! mesh object
class Mesh
{
public:
//static Mesh* instance();
//- singleton access to the object
//! Constructor
Mesh();
//! Destructor
~Mesh ();
//! opens exodus file and reads ini variables and coordinates
//! also reads the mesh into memory
VerdeStatus open_exodus_file(const char *file_name,
std::deque<int> *active_block_id_list);
//! read exodus header information
VerdeStatus read_exodus_header(const char *file_name,
std::deque<int> *active_block_id_list);
//! read active blocks
void load_active_element_blocks();
//! read block by id
VerdeStatus load_element_block(int block_id);
//! read block by pointer
VerdeStatus load_element_block(ElementBlock *block);
//! reads a single block from the exodus file
VerdeStatus read_exodus_block(int block_index);
//! creates and processes each mesh block in turn.
VerdeStatus verify_mesh(VerdeBoolean do_metrics,
VerdeBoolean do_topology,
VerdeBoolean do_interface,
VerdeBoolean do_verbose,
VerdeBoolean do_individual,
VerdeBoolean &metric_success,
VerdeBoolean &topology_success,
VerdeBoolean &interface_success);
//! access to the exodus file id
int exodus_file();
//! access to numberDimensions
int number_dimensions();
//! access to numberNodes
int number_nodes();
//! access to numberPreviousNodes
int number_previous_nodes();
//! number of elements in mesh
int number_elements();
//! number of hexes in mesh
int number_hexes();
//! number of tets in mesh
int number_tets();
//! number of pyramids in mesh
int number_pyramids();
//! number of wedges in mesh
int number_wedges();
//! number of knives in mesh
int number_knives();
//! access to numberElementBlocks
int number_element_blocks();
//! gets a pointer to a block of the mesh by its id
ElementBlock *get_element_block(int id);
//! returns total volume of the mesh
double volume();
//! returns total area of quad/tri blocks of the mesh
double area();
//! returns a copy of the element block list
void element_blocks(std::deque<ElementBlock*> &element_blocks);
//! returns a copy of the node boundary condition list
void get_node_bc_list(std::deque<NodeBC*> &node_bc_list);
//! returns a copy of the element boundary condition list
void get_element_bc_list(std::deque<ElementBC*> &element_bc_list);
//int node_id_of_element(int element_index, int node_index);
// returns the id of a node in an element
//! returns the original id number of an element
int original_id(int index);
// int block_id(ElemRef* element);
// returns which block an element is in
//! returns the mesh container that contains the element
MeshContainer* mesh_container(ElemRef* element);
//! returns a pointer to the node container
MeshContainer *node_container();
//! returns the coordinates of a node
VerdeVector coordinates(int node_index);
//! finds the current exterior boundary of the mesh based on the active blocks
VerdeStatus find_current_boundary();
//! given the id, returns a pointer to the NodeBC, or NULL if not found
NodeBC *get_node_bc(int id);
//! given the id, returns a pointer to the ElementBC, or NULL if not found
ElementBC *get_element_bc(int id);
//! finds the element block associated with the given element id
ElementBlock *find_block_for_element(int element_id);
//! returns list of NodeBCs
std::deque<NodeBC*> get_node_bc_list();
//! returns list of ElementBCs
std::deque<ElementBC*> get_element_bc_list();
//! returns block id offset
int blockIdOffset();
//! returns list of qa records
std::deque<char*> *get_qa_record_list();
//! returns number of qa strings defined
int number_qa_strings();
private:
//static Mesh *instance_;
int exodusFile; // integer id of the exodus input file
int numberDimensions; // dimension of this exodus file (2 or 3)
int numberNodes; // number of nodes in this dbase
int numberPreviousNodes; // number of nodes in previous model
int numberElements; // number of elements in this dbase
int numberHexes;
int numberTets;
int numberPyramids;
int numberWedges;
int numberKnives;
int numberQuads;
int numberTris;
int numberEdges;
int numberElementBlocks; // number of element blocks in this dbase
int block_id_offset;
int nodeset_id_offset;
int sideset_id_offset;
MeshContainer *nodeContainer;
//! This container contains all nodes of the input model
std::deque<ElementBlock*> elementBlocks;
//! contains the element blocks associated with this mesh
//! List of NodeBCs defined for this Mesh
std::deque<NodeBC*> nodeBCs;
//! List of ElementBCs defined for this Mesh
std::deque<ElementBC*> elementBCs;
//! List of qa_record inforamtion for this mesh
std::deque<char*> qaRecords;
//Mesh();
//! Constructor
double meshVolume;
//! total volume calculated for the mesh
double meshArea;
//! total area calculated for the mesh
//! gets offset for blocks, sidesets and nodesets
int get_offset( int flag );
//! Resets the Mesh, deleting old objects and memory
void reset();
//! reads a single qa string from an exodus format file
VerdeStatus read_qa_string(int genesis_file_id,
char *string,
int record_number,
int record_position);
//! read qa records from a genesis file into a list of strings
VerdeStatus read_qa_information(int genesis_file_id,
std::deque<char*> &qa_record_list);
};
// inline functions
inline MeshContainer* Mesh::node_container()
{
return nodeContainer;
}
inline int Mesh::exodus_file()
{
return exodusFile;
}
inline int Mesh::number_dimensions()
{
return numberDimensions;
}
inline int Mesh::number_nodes()
{
return numberNodes;
}
inline int Mesh::number_previous_nodes()
{
return numberPreviousNodes;
}
inline int Mesh::number_elements()
{
return numberElements;
}
inline int Mesh::number_hexes()
{
return numberHexes;
}
inline int Mesh::number_tets()
{
return numberTets;
}
inline int Mesh::number_pyramids()
{
return numberPyramids;
}
inline int Mesh::number_wedges()
{
return numberWedges;
}
inline int Mesh::number_knives()
{
return numberKnives;
}
inline int Mesh::number_element_blocks()
{
return elementBlocks.size();
}
inline double Mesh::volume()
{
return meshVolume;
}
inline double Mesh::area()
{
return meshArea;
}
inline int Mesh::blockIdOffset()
{
return block_id_offset;
}
inline int Mesh::number_qa_strings()
{
return qaRecords.size();
}
inline std::deque<char*> *Mesh::get_qa_record_list()
{
return &qaRecords;
}
#endif