NEMoSys  0.63.0
A modular, extensible resource with robust automated mesh generation, mesh quality analysis, adaptive mesh refinement, and data transfer between arbitrary meshes.
NEM::MSH::EXOMesh Namespace Reference

Classes

struct  elmBlkType
 Stores element block information. More...
 
class  exoMesh
 A complete I/O class for EXODUS II file format. More...
 
struct  ndeSetType
 Stores node set information. More...
 
struct  sdeSetType
 Stores side set information. More...
 

Typedefs

using ndeSets = std::vector< ndeSetType >
 
using elmBlks = std::vector< elmBlkType >
 
using sdeSets = std::vector< sdeSetType >
 

Functions

VTKCellType e2vEMap (elementType et)
 Convert EXODUS element type to VTK cell type. More...
 
elementType v2eEMap (VTKCellType vt)
 Convert VTK cell type to EXODUS element type. More...
 
surfaceBCTag bcTagNum (std::string &tag)
 
std::string bcTagStr (surfaceBCTag tag)
 
elementType elmTypeNum (std::string tag)
 Convert string to EXODUS element type. More...
 
std::string elmTypeStr (elementType et)
 Convert EXODUS element type to string tab. More...
 
int elmNumNde (elementType et, int order)
 Get number of nodes given EXODUS element type and order. More...
 
int elmNumSrf (elementType et)
 Get number of surfaces given EXODUS element type. More...
 
void wrnErrMsg (int errCode, const std::string &errMsg="None")
 Logging method. More...
 

Typedef Documentation

◆ elmBlks

using NEM::MSH::EXOMesh::elmBlks = typedef std::vector<elmBlkType>

Definition at line 107 of file exoMesh.H.

◆ ndeSets

using NEM::MSH::EXOMesh::ndeSets = typedef std::vector<ndeSetType>

Definition at line 106 of file exoMesh.H.

◆ sdeSets

using NEM::MSH::EXOMesh::sdeSets = typedef std::vector<sdeSetType>

Definition at line 108 of file exoMesh.H.

Function Documentation

◆ bcTagNum()

surfaceBCTag NEMOSYS_EXPORT NEM::MSH::EXOMesh::bcTagNum ( std::string &  tag)
Parameters
tag
Returns

Definition at line 76 of file exoMesh.C.

References FIXED, SYMMX, SYMMY, and nemAux::toLower().

76  {
77  nemAux::toLower(tag);
78  if (tag == "fixed") return surfaceBCTag::FIXED;
79  if (tag == "symmx") return surfaceBCTag::SYMMX;
80  if (tag == "symmy") return surfaceBCTag::SYMMY;
81  if (tag == "symmz") return surfaceBCTag::SYMMZ;
82  std::cerr << "Unknown surface tag " << tag << std::endl;
83  throw;
84 }
SYMMY
Definition: exoMesh.H:66
void toLower(std::string &str)
SYMMX
Definition: exoMesh.H:66
FIXED
Definition: exoMesh.H:66

◆ bcTagStr()

std::string NEMOSYS_EXPORT NEM::MSH::EXOMesh::bcTagStr ( surfaceBCTag  tag)
Parameters
tag
Returns

Definition at line 86 of file exoMesh.C.

References FIXED, SYMMX, and SYMMY.

86  {
87  switch (tag) {
88  case surfaceBCTag::FIXED: return "FIXED";
89  case surfaceBCTag::SYMMX: return "SYMMX";
90  case surfaceBCTag::SYMMY: return "SYMMY";
91  case surfaceBCTag::SYMMZ: return "SYMMZ";
92  }
93  std::cerr << "Unknown surface tag." << std::endl;
94  throw;
95 }
SYMMY
Definition: exoMesh.H:66
SYMMX
Definition: exoMesh.H:66
FIXED
Definition: exoMesh.H:66

◆ e2vEMap()

VTKCellType NEMOSYS_EXPORT NEM::MSH::EXOMesh::e2vEMap ( elementType  et)
Parameters
etEXODUS element type
Returns
VTK cell type

Definition at line 50 of file exoMesh.C.

References HEX, QUAD, TETRA, TRIANGLE, and WEDGE.

Referenced by meshBase::exportExoToVtk().

50  {
51  std::map<elementType, VTKCellType> eMap = {
52  {elementType::TRIANGLE, VTK_TRIANGLE},
53  {elementType::QUAD, VTK_QUAD},
54  {elementType::TETRA, VTK_TETRA},
55  {elementType::HEX, VTK_HEXAHEDRON},
56  {elementType::WEDGE, VTK_WEDGE},
57  {elementType::OTHER, VTK_EMPTY_CELL}};
58  return eMap[et];
59 }
WEDGE
Definition: exoMesh.H:55
QUAD
Definition: exoMesh.H:55
HEX
Definition: exoMesh.H:55
TETRA
Definition: exoMesh.H:55
TRIANGLE
Definition: exoMesh.H:55

◆ elmNumNde()

int NEMOSYS_EXPORT NEM::MSH::EXOMesh::elmNumNde ( elementType  et,
int  order 
)
Parameters
etEXODUS element type
orderelement order
Returns
number of nodes

Definition at line 138 of file exoMesh.C.

References elmTypeStr(), HEX, QUAD, TETRA, TRIANGLE, and WEDGE.

138  {
139  if (tag == elementType::TRIANGLE && order == 1) return 3;
140  if (tag == elementType::TRIANGLE && order == 2) return 6;
141  if (tag == elementType::QUAD && order == 1) return 4;
142  if (tag == elementType::QUAD && order == 2) return 9;
143  if (tag == elementType::TETRA && order == 1) return 4;
144  if (tag == elementType::TETRA && order == 2) return 10;
145  if (tag == elementType::HEX && order == 1) return 8;
146  if (tag == elementType::HEX && order == 2) return 21;
147  if (tag == elementType::WEDGE && order == 1) return 6;
148  if (tag == elementType::WEDGE && order == 2) return 16;
149  std::cerr << "Unknown element/order combination " << elmTypeStr(tag) << " " << order
150  << "\n";
151  throw;
152 }
std::string elmTypeStr(elementType et)
Convert EXODUS element type to string tab.
Definition: exoMesh.C:128
WEDGE
Definition: exoMesh.H:55
QUAD
Definition: exoMesh.H:55
HEX
Definition: exoMesh.H:55
TETRA
Definition: exoMesh.H:55
TRIANGLE
Definition: exoMesh.H:55

◆ elmNumSrf()

int NEMOSYS_EXPORT NEM::MSH::EXOMesh::elmNumSrf ( elementType  et)
Parameters
etEXODUS element type
Returns
number of surfaces

Definition at line 154 of file exoMesh.C.

References elmTypeStr(), HEX, QUAD, TETRA, TRIANGLE, and WEDGE.

154  {
155  switch (tag) {
156  case elementType::TRIANGLE: return 3;
157  case elementType::QUAD: return 4;
158  case elementType::TETRA: return 4;
159  case elementType::HEX: return 8;
160  case elementType::WEDGE: return 5;
161  case elementType::OTHER: break;
162  }
163  std::cerr << "Unknown element type " << elmTypeStr(tag) << "\n";
164  throw;
165 }
std::string elmTypeStr(elementType et)
Convert EXODUS element type to string tab.
Definition: exoMesh.C:128
WEDGE
Definition: exoMesh.H:55
QUAD
Definition: exoMesh.H:55
HEX
Definition: exoMesh.H:55
TETRA
Definition: exoMesh.H:55
TRIANGLE
Definition: exoMesh.H:55

◆ elmTypeNum()

elementType NEMOSYS_EXPORT NEM::MSH::EXOMesh::elmTypeNum ( std::string  tag)
Parameters
tagstring tag of an element type
Returns
EXODUS element type

Definition at line 97 of file exoMesh.C.

References HEX, QUAD, TETRA, nemAux::toLower(), TRIANGLE, and WEDGE.

Referenced by meshBase::exportExoToVtk(), and NEM::MSH::EXOMesh::exoMesh::read().

97  {
98  nemAux::toLower(tag);
99  if (tag == "triangle") return elementType::TRIANGLE;
100  if (tag == "tri") return elementType::TRIANGLE;
101  if (tag == "tri3") return elementType::TRIANGLE;
102  if (tag == "trishell3") return elementType::TRIANGLE;
103 
104  if (tag == "quadrilateral") return elementType::QUAD;
105  if (tag == "quad") return elementType::QUAD;
106  if (tag == "quad4") return elementType::QUAD;
107  if (tag == "shell4") return elementType::QUAD;
108 
109  if (tag == "tetrahedron") return elementType::TETRA;
110  if (tag == "tetrahedral") return elementType::TETRA;
111  if (tag == "tetra") return elementType::TETRA;
112  if (tag == "tetra4") return elementType::TETRA;
113 
114  if (tag == "hexahedron") return elementType::HEX;
115  if (tag == "hexahedral") return elementType::HEX;
116  if (tag == "brick") return elementType::HEX;
117  if (tag == "hex") return elementType::HEX;
118  if (tag == "hex8") return elementType::HEX;
119 
120  if (tag == "wedge") return elementType::WEDGE;
121  if (tag == "prismatic") return elementType::WEDGE;
122  if (tag == "prism") return elementType::WEDGE;
123 
124  std::cout << "Warning : Element type " << tag << " may be unsupported.\n";
125  return elementType::OTHER;
126 }
WEDGE
Definition: exoMesh.H:55
QUAD
Definition: exoMesh.H:55
HEX
Definition: exoMesh.H:55
TETRA
Definition: exoMesh.H:55
void toLower(std::string &str)
TRIANGLE
Definition: exoMesh.H:55

◆ elmTypeStr()

std::string NEMOSYS_EXPORT NEM::MSH::EXOMesh::elmTypeStr ( elementType  et)
Parameters
etEXODUS element type
Returns
string tag of an element type

Definition at line 128 of file exoMesh.C.

References HEX, QUAD, TETRA, TRIANGLE, and WEDGE.

Referenced by elmNumNde(), elmNumSrf(), NEM::MSH::EXOMesh::exoMesh::report(), and NEM::MSH::EXOMesh::exoMesh::write().

128  {
129  if (et == elementType::QUAD) return "QUAD";
130  if (et == elementType::TRIANGLE) return "TRIANGLE";
131  if (et == elementType::QUAD) return "QUAD";
132  if (et == elementType::TETRA) return "TETRA";
133  if (et == elementType::HEX) return "HEX";
134  if (et == elementType::WEDGE) return "WEDGE";
135  return "OTHER";
136 }
WEDGE
Definition: exoMesh.H:55
QUAD
Definition: exoMesh.H:55
HEX
Definition: exoMesh.H:55
TETRA
Definition: exoMesh.H:55
TRIANGLE
Definition: exoMesh.H:55

◆ v2eEMap()

elementType NEMOSYS_EXPORT NEM::MSH::EXOMesh::v2eEMap ( VTKCellType  vt)
Parameters
vtVTK cell type
Returns
EXODUS element type

Definition at line 61 of file exoMesh.C.

References HEX, QUAD, TETRA, TRIANGLE, and WEDGE.

Referenced by NEM::DRV::ConversionDriver::genExo().

61  {
62  std::map<VTKCellType, elementType> eMap = {
63  {VTK_TRIANGLE, elementType::TRIANGLE},
64  {VTK_QUAD, elementType::QUAD},
65  {VTK_TETRA, elementType::TETRA},
66  {VTK_HEXAHEDRON, elementType::HEX},
67  {VTK_WEDGE, elementType::WEDGE},
68  {VTK_QUADRATIC_TRIANGLE, elementType::TRIANGLE},
69  {VTK_QUADRATIC_QUAD, elementType::QUAD},
70  {VTK_QUADRATIC_TETRA, elementType::TETRA},
71  {VTK_QUADRATIC_HEXAHEDRON, elementType::HEX},
72  {VTK_EMPTY_CELL, elementType::OTHER}};
73  return eMap[vt];
74 }
WEDGE
Definition: exoMesh.H:55
QUAD
Definition: exoMesh.H:55
HEX
Definition: exoMesh.H:55
TETRA
Definition: exoMesh.H:55
TRIANGLE
Definition: exoMesh.H:55

◆ wrnErrMsg()

void NEMOSYS_EXPORT NEM::MSH::EXOMesh::wrnErrMsg ( int  errCode,
const std::string &  errMsg = "None" 
)
Parameters
errCodeIf <0, then error and throw. If =0, continue. If >0, warning.
errMsgMessage to output explaining error.

Definition at line 202 of file exoMesh.C.

Referenced by NEM::MSH::EXOMesh::exoMesh::addElmBlkByElmIdLst(), meshBase::exportExoToVtk(), NEM::MSH::EXOMesh::exoMesh::read(), NEM::MSH::EXOMesh::exoMesh::removeByElmIdLst(), and NEM::MSH::EXOMesh::exoMesh::write().

202  {
203  if (errCode < 0) {
204  std::cerr << "Error: " << msg << " with error code " << errCode
205  << std::endl;
206  throw;
207  } else if (errCode > 0) {
208  std::cerr << "Warning: " << msg << " with warning code " << errCode
209  << std::endl;
210  }
211 }