WARPXM v1.10.0
Loading...
Searching...
No Matches
wmunstructuredgeometry.h
Go to the documentation of this file.
1
2#ifndef WMUNSTRUCTUREDGEOMETRY_H_
3#define WMUNSTRUCTUREDGEOMETRY_H_
4
5// STD includes
6#include <iostream>
7#include <map>
8#include <vector>
9#include <typeinfo>
10
11#include <cmath> // a lot of stuff inherited needs this?
12
13// Wm includes
15#include "warpxm/warpxm_config.h"
16
22enum
23{
24 WMPRIMITIVE_LINE = 9, // this line goes from (-1,1) in isoparametric space => should
25 // not be used anymore
26 WMPRIMITIVE_01_LINE = 0, // this line goes from (0,1) in isoparametric space
32 // Mixed structured/unstructured types
37};
38
45{
46public:
47 typedef std::pair<std::string, std::vector<int>> nodeGroupPair_t;
48 typedef std::map<std::string, std::vector<int>> nodeGroupMap_t;
49
55
61
74 void generateGeometry(real* coordinates,
75 int* connectivity,
76 int* neighborhood,
77 int* orientations);
78
90 void addNodeGroup(const std::string name, const std::vector<int>& nodeIndexes);
91
98 const real* getCoordinates() const
99 {
100 return _coordinates;
101 }
102
109 const int* getConnectivity() const
110 {
111 return _connectivity;
112 }
113
120 const int* getNeighborhood() const
121 {
122 return _neighborhood;
123 }
124
131 const int* getOrientations() const
132 {
133 return _orientations;
134 }
135
147 std::string getNodeGroupOfNodes(const std::vector<int>& nodes) const;
148
158 int getFaceOrientation(const int elementIndex, const int faceIndex) const
159 {
160 return _orientations[elementIndex * _numFacesPerElement + faceIndex];
161 }
162
171 real getVolume(const int elementIndex) const
172 {
173 return _volumes[elementIndex];
174 }
175
185 real getArea(const int elementIndex, const int faceIndex) const
186 {
187 return _areas[elementIndex * _numFacesPerElement + faceIndex];
188 }
189
198 real getElementWidth(const int elementIndex) const;
199
210 const int* getLocalNeighborhood(const int elementIndex) const
211 {
212 return _neighborhood + elementIndex * _numFacesPerElement;
213 }
214
221 const std::type_info& getType() const
222 {
223 return typeid(real);
224 }
225
236 int getPrimitiveID() const
237 {
238 return _primitiveID;
239 }
240
252
263 const real* getCentroid(const int elementIndex) const
264 {
265 return _centroids + 3 * elementIndex;
266 }
267
284 const real*
285 getNorm(const int elementIndex, const int faceIndex, const int normType) const
286 {
287 return _norms +
288 ((elementIndex * _numFacesPerElement + faceIndex) * 3 + normType) * 3;
289 }
290
297 int getNumElements() const
298 {
299 return _numElements;
300 }
301
308 int getNumNodes() const
309 {
310 return _numNodes;
311 }
312
320 {
321 return _numDimsPerNode;
322 }
323
335 {
337 }
338
346 {
347 return _numNodesPerFace;
348 }
349
357 {
358 return _numNodesPerElement;
359 }
360
368 {
369 return _numFacesPerElement;
370 }
371
380 void getFaceNodes(const int elementIndex, const int faceIndex, int* faceNodes) const;
381
389 void getNodePositions(const int elementIndex, real* nodePositions) const;
390
401 {
403 }
404
412 void getTransformCoordinates(const int elementIndex, real tC[][3]) const;
413
427 static int getNumTransformCoordinates(const int primitiveID);
428
443 static void getTransformCoordinates(const int primitiveID,
444 const real* nodePositions,
445 real tC[]);
446
456 void getPositionInElement(const int elementIndex,
457 const real normalizedPosition[3],
458 real position[3]) const;
459
478 int getJumpedElementIndex(const int elementIndex,
479 const int neighborElementIndex,
480 const int numJumps) const;
481
499 int getOppositeFace(const int faceIndex) const;
500
510 int getFaceIndex(const int elementIndex, const int neighborElementIndex) const;
511
522 real generateVolumeJacobian(const int elementIndex,
523 const real normalizedPosition[3]) const;
524
533 void generateInverseJacobian(const int elementIndex,
534 const real* normalizedPosition,
535 real* inverseJacobian) const;
536
545 void getCentralPositionInElement(const int elementIndex,
546 const real normalizedPosition[3],
547 real position[3]) const;
548
564 void getFaceDistanceBetweenNeighborCentroids(const int fromElementIndex,
565 const int toElementIndex,
566 real dx[3]) const;
567
576 void
577 get_face_centroid(const int element_index, const int face_index, real x[3]) const;
578
587 bool isEnclosedByElement(const int elementIndex, const real* x) const;
588
605 int getEnclosingElementIndex(const real* x) const;
606
613 void printElement(const int elementIndex) const;
614
622 {
623 return _num_boundary_faces;
624 }
625
626 void reflect_centroid(const int element_index,
627 const int face_index,
628 real reflected_centroid[3]) const;
629
630protected:
636
641 std::string _primitive;
642
651
657
663
669
675
681
687
693
699
705
711
717
723
729
735
741
747
753
759
765
766private:
767};
768
769#endif /* WMUNSTRUCTUREDGEOMETRY_H_ */
Class used for generating mesh geometry concerns.
Definition: wmunstructuredgeometry.h:45
~WmUnstructuredGeometry()
Destroy geometry.
const WmUnstructuredPatch & _patch
Patch associated with geometry.
Definition: wmunstructuredgeometry.h:635
const real * getCoordinates() const
Access coordinates.
Definition: wmunstructuredgeometry.h:98
static void getTransformCoordinates(const int primitiveID, const real *nodePositions, real tC[])
Convert node/vertex positions into coordinate transform coordinates.
int _numNodesPerFace
Number of element nodes/vertexes that make up each face.
Definition: wmunstructuredgeometry.h:764
int _num_boundary_faces
Number of boundary faces between patch and unknown where neighbor = -1.
Definition: wmunstructuredgeometry.h:728
const int * getOrientations() const
Access orientations.
Definition: wmunstructuredgeometry.h:131
void get_face_centroid(const int element_index, const int face_index, real x[3]) const
Get the centroid of element's face.
WmUnstructuredGeometry(const WmUnstructuredPatch &patch)
Create unstructured geometry for a given patch.
int _primitiveID
PrimitiveID.
Definition: wmunstructuredgeometry.h:650
void getCentralPositionInElement(const int elementIndex, const real normalizedPosition[3], real position[3]) const
Get the real/mesh position within an element w.r.t the element centroid.
void getFaceNodes(const int elementIndex, const int faceIndex, int *faceNodes) const
Get the nodes for a given element's face.
const int * getLocalNeighborhood(const int elementIndex) const
Get list of element neighbors.
Definition: wmunstructuredgeometry.h:210
int * _neighborhood
Neighborhood of elements [_numElements X _numFacesPerElement].
Definition: wmunstructuredgeometry.h:674
real * _volumes
Volumes of elements [_numElements].
Definition: wmunstructuredgeometry.h:710
real * _norms
Face normals for elements [_numElements X 3 X 3].
Definition: wmunstructuredgeometry.h:704
std::string _primitive
Name of element primitive.
Definition: wmunstructuredgeometry.h:641
int getNumNodesPerFace() const
Number of nodes/vertexes on an element's face.
Definition: wmunstructuredgeometry.h:345
real * _centroids
Centroids of elements [_numElements X 3].
Definition: wmunstructuredgeometry.h:698
int _numDimsPerPrimitive
Number of dimensions for a given primitive.
Definition: wmunstructuredgeometry.h:740
int num_boundary_faces() const
Returns the number of boundary faces associated with the edge of a domain (i.e.
Definition: wmunstructuredgeometry.h:621
void printElement(const int elementIndex) const
Print element info to std::cout - used for DEBUG.
int * _connectivity
Connectivity of elements [_numElements X _numNodesPerElement].
Definition: wmunstructuredgeometry.h:668
int getNumElements() const
Number of total elements in geometry.
Definition: wmunstructuredgeometry.h:297
real * _coordinates
Node/vertex positions [_numNodes X _numDimsPerNode].
Definition: wmunstructuredgeometry.h:686
const int * getNeighborhood() const
Access neighborhood.
Definition: wmunstructuredgeometry.h:120
real getVolume(const int elementIndex) const
Get the volume of an element.
Definition: wmunstructuredgeometry.h:171
int getNumDimsPerNode() const
Number of dimensions used to store coordinates.
Definition: wmunstructuredgeometry.h:319
int getNumNodesPerElement() const
Number of nodes/vertexes on an element.
Definition: wmunstructuredgeometry.h:356
void getNodePositions(const int elementIndex, real *nodePositions) const
Get the node/vertex positions for an element.
void generateGeometry(real *coordinates, int *connectivity, int *neighborhood, int *orientations)
Generates geometry concerns.
int getOppositeFace(const int faceIndex) const
Get face index opposite of a given face index.
void generateInverseJacobian(const int elementIndex, const real *normalizedPosition, real *inverseJacobian) const
Generate the inverse Jacobian matrix for a given point within an element.
int getJumpedElementIndex(const int elementIndex, const int neighborElementIndex, const int numJumps) const
Get element index on other side of neighbor.
void getTransformCoordinates(const int elementIndex, real tC[][3]) const
Get the transform coordinates for an element.
nodeGroupMap_t _nodeGroups
Node groups associated with geometry/patch.
Definition: wmunstructuredgeometry.h:722
int _numDimsPerNode
Number of dimensions used to store nodes/vertexes.
Definition: wmunstructuredgeometry.h:734
void getPositionInElement(const int elementIndex, const real normalizedPosition[3], real position[3]) const
Generate real/mesh space position from normalized position for given element.
int _numFacesPerElement
Number of faces on an element.
Definition: wmunstructuredgeometry.h:758
int getNumTransformCoordinates() const
Get number of coordinate transform coordinates for this primitive.
Definition: wmunstructuredgeometry.h:400
std::map< std::string, std::vector< int > > nodeGroupMap_t
Definition: wmunstructuredgeometry.h:48
const std::type_info & getType() const
Get typeid of floats used to store coordinates/geometry stuff.
Definition: wmunstructuredgeometry.h:221
int getEnclosingElementIndex(const real *x) const
Find the element enclosing the given location.
int getNumFacesPerElement() const
Number of faces on an element.
Definition: wmunstructuredgeometry.h:367
int getFaceOrientation(const int elementIndex, const int faceIndex) const
Get the orientation of a specific face with respect to neighbor.
Definition: wmunstructuredgeometry.h:158
int getNumNodes() const
Number of total nodes in geometry.
Definition: wmunstructuredgeometry.h:308
real * _transformCoordinates
Coordinate transform coordinates [_numElements X _numTransformCoordinates X 3].
Definition: wmunstructuredgeometry.h:692
void reflect_centroid(const int element_index, const int face_index, real reflected_centroid[3]) const
int * _orientations
Orientations of faces [_numElements X _numFacesPerElement].
Definition: wmunstructuredgeometry.h:680
int getFacePrimitiveID() const
Get primitive's face primitive ID.
bool isEnclosedByElement(const int elementIndex, const real *x) const
Check if the element encloses the given location.
real getArea(const int elementIndex, const int faceIndex) const
Get area of element face.
Definition: wmunstructuredgeometry.h:185
real * _areas
Areas of element faces [_numElements X _numFacesPerElement].
Definition: wmunstructuredgeometry.h:716
int _numNodesPerElement
Number of nodes/vertexes for a given primitive.
Definition: wmunstructuredgeometry.h:752
std::string getNodeGroupOfNodes(const std::vector< int > &nodes) const
Identify which node group a set of nodes belong to.
const real * getNorm(const int elementIndex, const int faceIndex, const int normType) const
Get norm of element.
Definition: wmunstructuredgeometry.h:285
int _numElements
Number of total elements in patch.
Definition: wmunstructuredgeometry.h:656
int _numTransformCoordinates
Number of coordinate transform coordinates, usually the same as _numNodesPerElement.
Definition: wmunstructuredgeometry.h:746
const real * getCentroid(const int elementIndex) const
Get centroid of element.
Definition: wmunstructuredgeometry.h:263
const int * getConnectivity() const
Access connectivity.
Definition: wmunstructuredgeometry.h:109
real getElementWidth(const int elementIndex) const
Get rough estimate of element's characteristic width.
real generateVolumeJacobian(const int elementIndex, const real normalizedPosition[3]) const
Generate the volume Jacobian (ie Jacobian or determinant of the Jacobian matrix given appropriate dim...
std::pair< std::string, std::vector< int > > nodeGroupPair_t
Definition: wmunstructuredgeometry.h:47
int getNumDimsPerPrimitive() const
Number of dimensions used to express primtive.
Definition: wmunstructuredgeometry.h:334
int getFaceIndex(const int elementIndex, const int neighborElementIndex) const
Get the face index through which an neighbor element is found.
void addNodeGroup(const std::string name, const std::vector< int > &nodeIndexes)
Add node group to geometry.
int _numNodes
Number of total nodes in patch.
Definition: wmunstructuredgeometry.h:662
int getPrimitiveID() const
Get primitive ID for geometry.
Definition: wmunstructuredgeometry.h:236
static int getNumTransformCoordinates(const int primitiveID)
Number of coordinate transform coordinates.
void getFaceDistanceBetweenNeighborCentroids(const int fromElementIndex, const int toElementIndex, real dx[3]) const
Get the distance between two elements through a face.
Definition: wmunstructuredpatch.h:22
#define real
Definition: wmoclunstructuredreconstruction.h:11
@ WMPRIMITIVE_01_LINE
Definition: wmunstructuredgeometry.h:26
@ WMPRIMITIVE_4DPRISM
Definition: wmunstructuredgeometry.h:35
@ WMPRIMITIVE_3DPRISM
Definition: wmunstructuredgeometry.h:34
@ WMPRIMITIVE_POINT
Definition: wmunstructuredgeometry.h:31
@ WMPRIMITIVE_KINETIC_SQUARE
Definition: wmunstructuredgeometry.h:33
@ WMPRIMITIVE_TETRAHEDRON
Definition: wmunstructuredgeometry.h:29
@ WMPRIMITIVE_HEXAHEDRON
Definition: wmunstructuredgeometry.h:30
@ WMPRIMITIVE_QUADRILATERAL
Definition: wmunstructuredgeometry.h:28
@ WMPRIMITIVE_LINE
Definition: wmunstructuredgeometry.h:24
@ WMPRIMITIVE_NONE
Definition: wmunstructuredgeometry.h:36
@ WMPRIMITIVE_TRIANGLE
Definition: wmunstructuredgeometry.h:27