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 pathMeshContainer.hpp
233 lines (167 loc) · 5.16 KB
/
MeshContainer.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
//-------------------------------------------------------------------------
// Filename : MeshContainer.hpp
//
// Purpose : Manages mesh entities for its parent entity
//
// Special Notes :
//
// Creator : Ray Meyers
//
// Date : 10/14/98
//
// Owner : Ray Meyers
//-------------------------------------------------------------------------
#ifndef MESH_CONTAINER_HPP
#define MESH_CONTAINER_HPP
#include "VerdeDefines.hpp"
#include "VerdeVector.hpp"
#include "VerdeString.hpp"
#include "VerdeApp.hpp"
#include "MDBInterface.hpp"
//#include "ElementBlock.hpp"
class HexRef;
class VerdeString;
class ElementBlock;
//! container for storing nodes and elements
class MeshContainer
{
public:
//! Constructor
MeshContainer();
//! Destructor
~MeshContainer();
//! puts the proper nodal data in the MeshData
VerdeStatus load_nodes();
//! puts the proper element data in the MeshData
int load_elements(int block_id, int *exodus_ids, int element_offset);
//! returns the connectivity array at element_index
int node_id(int element_index, int node_id);
//! returns vector of coordinates of the node at node_index
VerdeVector coordinates(int node_index);
//! return number of nodes defined in this container
int number_nodes();
//! return number of elements defined in this container
int number_elements();
//! return the element type string for this container
VerdeString element_type();
//! return the element type string for this container
void set_element_type(VerdeString new_type);
//! returns the exodus id assigned (if any) for the node at index
int exodus_id(int index);
//! returns original id of element (from exodus element number map)
int original_id(int index);
//! sets the exodus id for the node at index
void set_exodus_id(int index, int value);
//! returns the marked flag for node at index
VerdeBoolean is_marked(int index);
//! sets the marked flag for node at index
void mark(int index, VerdeBoolean value);
//! returns the number of nodes in this container with marked flag set
int count_marked_nodes();
//! clears marked flag from all nodes in this container
void clear_marked_nodes();
//! routine to modify connectivity of degenerate hexes to make correct
// wedges
void process_degenerate_wedges();
//! read the block header information
int read_block_header(int block_id);
//! returns the element block of this MeshContainer
//int element_block();
//! sets the owning block of this mesh container
void owner(ElementBlock *block);
//! returns the owning block of this mesh container
ElementBlock *owner();
//! returns the block id of the owner
int block_id();
//! returns the number of attributes defines
int number_attributes();
//! returns a pointer to the attribute data for output
double *attribute_data();
private:
//! Arrays to hold nodal information for this meshData
double *nodeX;
double *nodeY;
double *nodeZ;
//! array to hold the element information for this mesheshData
int *connectivity;
//! array which holds the exodus id for each node
int *exodusId;
//! array which holds original exodus id for each element
int *originalElementId;
//! array which holds the marked flag for each node
VerdeBoolean *markArray;
//! exodus element type
VerdeString elementType;
//! number of elements in this meshData
int numberElements;
//! number of nodes in this meshData
int numberNodes;
//! number of nodes per element in this meshData
int numberNodesPerElement;
//! number of exodus attributes associated with this meshData
int numberAttributes;
//! pointer to attribute data read in from exodus file
double *attributeData;
ElementBlock *meshOwner;
//- the owner of the MeshContainer
};
inline VerdeVector MeshContainer::coordinates(int node_index)
{
double coords[3];
verde_app->MDB()->GetCoords(node_index, coords);
return VerdeVector(coords[0],coords[1],coords[2]);
}
inline int MeshContainer::exodus_id(int index)
{
return exodusId[index-1];
}
inline int MeshContainer::original_id(int index)
{
return originalElementId[index-1];
}
inline void MeshContainer::set_exodus_id(int index, int value)
{
exodusId[index-1] = value;
}
inline VerdeBoolean MeshContainer::is_marked(int index)
{
if(numberElements)
assert(index <= numberElements);
return markArray[index-1];
}
inline void MeshContainer::mark(int index, VerdeBoolean value)
{
if(numberElements)
assert(index <= numberElements);
markArray[index-1] = value;
}
inline int MeshContainer::number_nodes()
{
return numberNodes;
}
inline int MeshContainer::number_elements()
{
return numberElements;
}
inline VerdeString MeshContainer::element_type()
{
return elementType;
}
inline void MeshContainer::set_element_type(VerdeString new_type)
{
elementType = new_type;
elementType.to_upper_case();
}
inline ElementBlock *MeshContainer::owner()
{
return meshOwner;
}
inline int MeshContainer::number_attributes()
{
return numberAttributes;
}
inline double *MeshContainer::attribute_data()
{
return attributeData;
}
#endif