9#include "iotm_export.h"
18#include <unordered_map>
38 static constexpr Ordinal InvalidOrdinal = 65535;
44 : id(
Ioss::ElementTopology::get_unique_id(std::string(
Ioss::Unknown::name))),
45 topology(
Ioss::ElementTopology::factory(std::string(
Ioss::Unknown::name))),
48 set_valid_spatial_dimensions({
false,
false,
false,
false});
52 : id(
Ioss::ElementTopology::get_unique_id(name)),
53 topology(
Ioss::ElementTopology::factory(name)), initialized(false)
55 set_valid_spatial_dimensions({
false,
false,
false,
false});
68 return validSpatialDimensions[spatialDim];
71 const std::string
name()
const {
return topology->name(); }
73 int num_nodes()
const {
return topology->number_nodes(); }
77 return id == rhs.
id && topology == rhs.
topology &&
85 if (topology->is_shell()) {
87 if (topology->parametric_dimension() == 2) {
88 return topology->number_faces();
92 return topology->number_boundaries();
95 int num_sides()
const {
return sideTopologies.size(); }
100 unsigned numSides = num_sides();
101 if (side > 0 && side <= numSides)
108 if (!valid_side(side))
112 return sideTopology->
name();
117 if (!valid_side(side))
118 return *(invalid_topology_factory());
119 return *sideTopologies[side - 1];
124 if (!valid_side(side))
133 if (!valid_side(side))
134 return std::vector<Ordinal>();
137 std::vector<Ordinal> elementNodeOrdinalVector(sideTopology->
number_nodes());
141 for (
int i = 0; i < sideTopology->
number_nodes(); i++) {
142 elementNodeOrdinalVector[i] = connectivity[i];
145 return elementNodeOrdinalVector;
148 bool is_shell()
const {
return topology->is_shell(); }
154 return topology->permutation()->num_positive_permutations();
159 return topology->permutation()->is_positive_polarity(permutation);
164 return topology->permutation()->valid_permutation(permutation);
168 std::vector<Ordinal> &nodeOrdinalVector)
const
170 return topology->permutation()->fill_permutation_indices(permutation, nodeOrdinalVector);
175 return topology->permutation()->permutation_indices(permutation);
541 {line_2_factory(), line_2_factory(), line_2_factory(), line_2_factory()});
555 {line_3_factory(), line_3_factory(), line_3_factory(), line_3_factory()});
569 {line_3_factory(), line_3_factory(), line_3_factory(), line_3_factory()});
589 line_2_factory(), line_2_factory()});
603 line_2_factory(), line_2_factory()});
617 line_3_factory(), line_3_factory()});
636 line_2_factory(), line_2_factory(), line_2_factory()});
650 line_3_factory(), line_3_factory(), line_3_factory()});
664 line_3_factory(), line_3_factory(), line_3_factory()});
683 {tri_3_factory(), tri_3_factory(), tri_3_factory(), tri_3_factory()});
697 {tri_4_factory(), tri_4_factory(), tri_4_factory(), tri_4_factory()});
711 {tri_6_factory(), tri_6_factory(), tri_6_factory(), tri_6_factory()});
725 {tri_6_factory(), tri_6_factory(), tri_6_factory(), tri_6_factory()});
744 {tri_3_factory(), tri_3_factory(), tri_3_factory(), tri_3_factory(), quad_4_factory()});
758 {tri_6_factory(), tri_6_factory(), tri_6_factory(), tri_6_factory(), quad_8_factory()});
772 {tri_6_factory(), tri_6_factory(), tri_6_factory(), tri_6_factory(), quad_9_factory()});
791 tri_3_factory(), tri_3_factory()});
805 tri_6_factory(), tri_6_factory()});
819 tri_6_factory(), tri_6_factory()});
833 tri_6_factory(), tri_6_factory()});
852 quad_4_factory(), quad_4_factory(), quad_4_factory()});
866 quad_8_factory(), quad_8_factory(), quad_8_factory()});
880 quad_9_factory(), quad_9_factory(), quad_9_factory()});
890 return validSpatialDimensions[0] == validSpatialDimensions_[0] &&
891 validSpatialDimensions[1] == validSpatialDimensions_[1] &&
892 validSpatialDimensions[2] == validSpatialDimensions_[2] &&
893 validSpatialDimensions[3] == validSpatialDimensions_[3];
898 validSpatialDimensions[0] = validSpatialDimensions_[0];
899 validSpatialDimensions[1] = validSpatialDimensions_[1];
900 validSpatialDimensions[2] = validSpatialDimensions_[2];
901 validSpatialDimensions[3] = validSpatialDimensions_[3];
909 int numSides = sideTopologies_.size();
911 for (
int side = 1; side <= numSides; side++) {
912 if (topology->boundary_type(side) != sideTopologies_[side - 1]->topology) {
913 std::ostringstream errmsg;
916 errmsg <<
"ERROR: For element topology: " << topology->name() <<
" on side: " << side
917 <<
", expected topology: " << topology->boundary_type(side)->name()
918 <<
" does not match topology: " << sideTopologies_[side - 1]->topology->name();
922 sideTopologies = sideTopologies_;
927 return topology->permutation()->num_permutation_nodes();
933 std::vector<TopologyMapEntry *> sideTopologies{};
938 bool initialized{
false};
943 return out << t.
name();
955 {
"NODE", *TopologyMapEntry::node_factory()},
956 {
"LINE_2", *TopologyMapEntry::line_2_factory()},
957 {
"LINE_3", *TopologyMapEntry::line_3_factory()},
958 {
"TRI_3", *TopologyMapEntry::tri_3_factory()},
959 {
"TRI_4", *TopologyMapEntry::tri_4_factory()},
960 {
"TRI_6", *TopologyMapEntry::tri_6_factory()},
961 {
"QUAD_4", *TopologyMapEntry::quad_4_factory()},
962 {
"QUAD_6", *TopologyMapEntry::quad_6_factory()},
963 {
"QUAD_8", *TopologyMapEntry::quad_8_factory()},
964 {
"QUAD_9", *TopologyMapEntry::quad_9_factory()},
965 {
"PARTICLE", *TopologyMapEntry::particle_factory()},
966 {
"LINE_2_1D", *TopologyMapEntry::line_2_1d_factory()},
967 {
"LINE_3_1D", *TopologyMapEntry::line_3_1d_factory()},
968 {
"BEAM_2", *TopologyMapEntry::beam_2_factory()},
969 {
"BEAM_3", *TopologyMapEntry::beam_3_factory()},
970 {
"SHELL_LINE_2", *TopologyMapEntry::shell_line_2_factory()},
971 {
"SHELL_LINE_3", *TopologyMapEntry::shell_line_3_factory()},
972 {
"SPRING_2", *TopologyMapEntry::spring_2_factory()},
973 {
"SPRING_3", *TopologyMapEntry::spring_3_factory()},
974 {
"TRI_3_2D", *TopologyMapEntry::tri_3_2d_factory()},
975 {
"TRI_4_2D", *TopologyMapEntry::tri_4_2d_factory()},
976 {
"TRI_6_2D", *TopologyMapEntry::tri_6_2d_factory()},
977 {
"QUAD_4_2D", *TopologyMapEntry::quad_4_2d_factory()},
978 {
"QUAD_8_2D", *TopologyMapEntry::quad_8_2d_factory()},
979 {
"QUAD_9_2D", *TopologyMapEntry::quad_9_2d_factory()},
980 {
"SHELL_TRI_3", *TopologyMapEntry::shell_tri_3_factory()},
981 {
"SHELL_TRI_4", *TopologyMapEntry::shell_tri_4_factory()},
982 {
"SHELL_TRI_6", *TopologyMapEntry::shell_tri_6_factory()},
983 {
"SHELL_QUAD_4", *TopologyMapEntry::shell_quad_4_factory()},
984 {
"SHELL_QUAD_8", *TopologyMapEntry::shell_quad_8_factory()},
985 {
"SHELL_QUAD_9", *TopologyMapEntry::shell_quad_9_factory()},
986 {
"TET_4", *TopologyMapEntry::tet_4_factory()},
987 {
"TET_8", *TopologyMapEntry::tet_8_factory()},
988 {
"TET_10", *TopologyMapEntry::tet_10_factory()},
989 {
"TET_11", *TopologyMapEntry::tet_11_factory()},
990 {
"PYRAMID_5", *TopologyMapEntry::pyramid_5_factory()},
991 {
"PYRAMID_13", *TopologyMapEntry::pyramid_13_factory()},
992 {
"PYRAMID_14", *TopologyMapEntry::pyramid_14_factory()},
993 {
"WEDGE_6", *TopologyMapEntry::wedge_6_factory()},
994 {
"WEDGE_12", *TopologyMapEntry::wedge_12_factory()},
995 {
"WEDGE_15", *TopologyMapEntry::wedge_15_factory()},
996 {
"WEDGE_18", *TopologyMapEntry::wedge_18_factory()},
997 {
"HEX_8", *TopologyMapEntry::hex_8_factory()},
998 {
"HEX_20", *TopologyMapEntry::hex_20_factory()},
999 {
"HEX_27", *TopologyMapEntry::hex_27_factory()}
void IOSS_ERROR(const std::ostringstream &errmsg)
Definition Ioss_Utils.h:38
static const char * name
Definition Ioss_Beam2.h:19
static const char * name
Definition Ioss_Beam3.h:19
static const char * name
Definition Ioss_Edge2.h:19
static const char * name
Definition Ioss_Edge3.h:19
Represents an element topology.
Definition Ioss_ElementTopology.h:68
IOSS_NODISCARD const std::string & name() const
Definition Ioss_ElementTopology.h:78
IOSS_NODISCARD ElementTopology * boundary_type(int face_number=0) const
Definition Ioss_ElementTopology.C:302
virtual IOSS_NODISCARD int number_nodes() const =0
static const char * name
Definition Ioss_Hex20.h:19
static const char * name
Definition Ioss_Hex27.h:19
static const char * name
Definition Ioss_Hex8.h:19
static const char * name
Definition Ioss_Node.h:19
static const char * name
Definition Ioss_Pyramid13.h:19
static const char * name
Definition Ioss_Pyramid14.h:19
static const char * name
Definition Ioss_Pyramid5.h:20
static const char * name
Definition Ioss_Quad4.h:19
static const char * name
Definition Ioss_Quad6.h:19
static const char * name
Definition Ioss_Quad8.h:19
static const char * name
Definition Ioss_Quad9.h:19
static const char * name
Definition Ioss_Shell4.h:19
static const char * name
Definition Ioss_Shell8.h:19
static const char * name
Definition Ioss_Shell9.h:19
static const char * name
Definition Ioss_ShellLine2D2.h:19
static const char * name
Definition Ioss_ShellLine2D3.h:19
static const char * name
Definition Ioss_Sphere.h:20
static const char * name
Definition Ioss_Spring2.h:19
static const char * name
Definition Ioss_Spring3.h:19
static const char * name
Definition Ioss_Tet10.h:19
static const char * name
Definition Ioss_Tet11.h:19
static const char * name
Definition Ioss_Tet4.h:20
static const char * name
Definition Ioss_Tet8.h:19
static const char * name
Definition Ioss_Tri3.h:19
static const char * name
Definition Ioss_Tri4.h:20
static const char * name
Definition Ioss_Tri6.h:20
static const char * name
Definition Ioss_TriShell3.h:20
static const char * name
Definition Ioss_TriShell4.h:20
static const char * name
Definition Ioss_TriShell6.h:20
static const char * name
Definition Ioss_Wedge12.h:20
static const char * name
Definition Ioss_Wedge15.h:20
static const char * name
Definition Ioss_Wedge18.h:20
static const char * name
Definition Ioss_Wedge6.h:20
Definition Iotm_TextMeshTopologyMapping.h:947
TopologyMapEntry invalid_topology() const override
Definition Iotm_TextMeshTopologyMapping.h:949
void initialize_topology_map() override
Definition Iotm_TextMeshTopologyMapping.h:952
Definition Iotm_TextMeshTopologyMapping.h:33
static TopologyMapEntry * shell_quad_8_factory()
Definition Iotm_TextMeshTopologyMapping.h:643
static TopologyMapEntry * shell_tri_6_factory()
Definition Iotm_TextMeshTopologyMapping.h:610
static TopologyMapEntry * wedge_18_factory()
Definition Iotm_TextMeshTopologyMapping.h:826
static TopologyMapEntry * spring_2_factory()
Definition Iotm_TextMeshTopologyMapping.h:458
bool operator==(const TopologyMapEntry &rhs) const
Definition Iotm_TextMeshTopologyMapping.h:75
static TopologyMapEntry * tri_4_factory()
Definition Iotm_TextMeshTopologyMapping.h:287
static TopologyMapEntry * pyramid_14_factory()
Definition Iotm_TextMeshTopologyMapping.h:765
static TopologyMapEntry * line_3_1d_factory()
Definition Iotm_TextMeshTopologyMapping.h:256
static TopologyMapEntry * line_3_factory()
Definition Iotm_TextMeshTopologyMapping.h:239
static TopologyMapEntry * quad_8_factory()
Definition Iotm_TextMeshTopologyMapping.h:344
static TopologyMapEntry * tri_3_2d_factory()
Definition Iotm_TextMeshTopologyMapping.h:489
std::vector< Ordinal > side_topology_node_indices(unsigned side) const
Definition Iotm_TextMeshTopologyMapping.h:131
static TopologyMapEntry * shell_line_3_factory()
Definition Iotm_TextMeshTopologyMapping.h:440
static TopologyMapEntry * pyramid_5_factory()
Definition Iotm_TextMeshTopologyMapping.h:737
uint8_t Permutation
Definition Iotm_TextMeshTopologyMapping.h:36
static TopologyMapEntry * wedge_6_factory()
Definition Iotm_TextMeshTopologyMapping.h:784
static TopologyMapEntry * shell_tri_4_factory()
Definition Iotm_TextMeshTopologyMapping.h:596
bool equivalent_valid_spatial_dimensions(const DimensionArray &validSpatialDimensions_) const
Definition Iotm_TextMeshTopologyMapping.h:888
static TopologyMapEntry * tet_4_factory()
Definition Iotm_TextMeshTopologyMapping.h:676
unsigned num_positive_permutations() const
Definition Iotm_TextMeshTopologyMapping.h:152
static TopologyMapEntry * beam_2_factory()
Definition Iotm_TextMeshTopologyMapping.h:391
bool defined_on_spatial_dimension(const unsigned spatialDim) const
Definition Iotm_TextMeshTopologyMapping.h:63
bool valid_permutation(Permutation permutation) const
Definition Iotm_TextMeshTopologyMapping.h:162
static TopologyMapEntry * tri_6_factory()
Definition Iotm_TextMeshTopologyMapping.h:300
void set_valid_spatial_dimensions(const DimensionArray &validSpatialDimensions_)
Definition Iotm_TextMeshTopologyMapping.h:896
static TopologyMapEntry * quad_9_factory()
Definition Iotm_TextMeshTopologyMapping.h:357
TopologyMapEntry & operator=(const TopologyMapEntry &topo)=default
static TopologyMapEntry * tet_11_factory()
Definition Iotm_TextMeshTopologyMapping.h:718
bool operator==(const Ioss::ElementTopology *topo) const
Definition Iotm_TextMeshTopologyMapping.h:61
static TopologyMapEntry * hex_27_factory()
Definition Iotm_TextMeshTopologyMapping.h:873
static TopologyMapEntry * quad_4_2d_factory()
Definition Iotm_TextMeshTopologyMapping.h:534
bool is_shell() const
Definition Iotm_TextMeshTopologyMapping.h:148
void set_side_topologies(const std::vector< TopologyMapEntry * > &sideTopologies_)
Definition Iotm_TextMeshTopologyMapping.h:907
unsigned num_permutation_nodes() const
Definition Iotm_TextMeshTopologyMapping.h:925
TopologyMapEntry()
Definition Iotm_TextMeshTopologyMapping.h:43
bool fill_permutation_indices(Permutation permutation, std::vector< Ordinal > &nodeOrdinalVector) const
Definition Iotm_TextMeshTopologyMapping.h:167
static TopologyMapEntry * shell_line_2_factory()
Definition Iotm_TextMeshTopologyMapping.h:427
TopologyMapEntry(const TopologyMapEntry &topo)=default
static TopologyMapEntry * shell_quad_4_factory()
Definition Iotm_TextMeshTopologyMapping.h:629
unsigned side_topology_num_nodes(unsigned side) const
Definition Iotm_TextMeshTopologyMapping.h:122
static TopologyMapEntry * line_2_factory()
Definition Iotm_TextMeshTopologyMapping.h:205
int num_sides() const
Definition Iotm_TextMeshTopologyMapping.h:95
TopologyMapEntry(const std::string &name)
Definition Iotm_TextMeshTopologyMapping.h:51
bool valid_side(unsigned side) const
Definition Iotm_TextMeshTopologyMapping.h:98
int num_face_sides() const
Definition Iotm_TextMeshTopologyMapping.h:83
static TopologyMapEntry * wedge_15_factory()
Definition Iotm_TextMeshTopologyMapping.h:812
const std::string name() const
Definition Iotm_TextMeshTopologyMapping.h:71
static TopologyMapEntry * shell_quad_9_factory()
Definition Iotm_TextMeshTopologyMapping.h:657
static TopologyMapEntry * tri_6_2d_factory()
Definition Iotm_TextMeshTopologyMapping.h:515
static TopologyMapEntry * pyramid_13_factory()
Definition Iotm_TextMeshTopologyMapping.h:751
static TopologyMapEntry * tet_10_factory()
Definition Iotm_TextMeshTopologyMapping.h:704
static TopologyMapEntry * quad_4_factory()
Definition Iotm_TextMeshTopologyMapping.h:318
int num_nodes() const
Definition Iotm_TextMeshTopologyMapping.h:73
uint16_t Ordinal
Definition Iotm_TextMeshTopologyMapping.h:35
Ioss::ElementTopology * topology
Definition Iotm_TextMeshTopologyMapping.h:931
static TopologyMapEntry * shell_tri_3_factory()
Definition Iotm_TextMeshTopologyMapping.h:582
static TopologyMapEntry * particle_factory()
Definition Iotm_TextMeshTopologyMapping.h:374
static TopologyMapEntry * tri_4_2d_factory()
Definition Iotm_TextMeshTopologyMapping.h:502
unsigned int id
Definition Iotm_TextMeshTopologyMapping.h:930
bool is_positive_polarity(Permutation permutation) const
Definition Iotm_TextMeshTopologyMapping.h:157
unsigned num_permutations() const
Definition Iotm_TextMeshTopologyMapping.h:150
static TopologyMapEntry * quad_9_2d_factory()
Definition Iotm_TextMeshTopologyMapping.h:562
bool initialized
Definition Iotm_TextMeshTopologyMapping.h:938
static TopologyMapEntry * tet_8_factory()
Definition Iotm_TextMeshTopologyMapping.h:690
static TopologyMapEntry * quad_8_2d_factory()
Definition Iotm_TextMeshTopologyMapping.h:548
bool[4] DimensionArray
Definition Iotm_TextMeshTopologyMapping.h:41
std::string side_topology_name(unsigned side) const
Definition Iotm_TextMeshTopologyMapping.h:106
std::vector< Ordinal > permutation_indices(Permutation permutation) const
Definition Iotm_TextMeshTopologyMapping.h:173
static TopologyMapEntry * invalid_topology_factory()
Definition Iotm_TextMeshTopologyMapping.h:178
static TopologyMapEntry * quad_6_factory()
Definition Iotm_TextMeshTopologyMapping.h:331
const TopologyMapEntry & side_topology(unsigned side) const
Definition Iotm_TextMeshTopologyMapping.h:115
static TopologyMapEntry * tri_3_factory()
Definition Iotm_TextMeshTopologyMapping.h:274
static TopologyMapEntry * node_factory()
Definition Iotm_TextMeshTopologyMapping.h:188
static TopologyMapEntry * hex_20_factory()
Definition Iotm_TextMeshTopologyMapping.h:859
static TopologyMapEntry * beam_3_factory()
Definition Iotm_TextMeshTopologyMapping.h:408
bool operator!=(const TopologyMapEntry &rhs) const
Definition Iotm_TextMeshTopologyMapping.h:81
DimensionArray validSpatialDimensions
Definition Iotm_TextMeshTopologyMapping.h:936
static TopologyMapEntry * hex_8_factory()
Definition Iotm_TextMeshTopologyMapping.h:845
static TopologyMapEntry * spring_3_factory()
Definition Iotm_TextMeshTopologyMapping.h:471
static TopologyMapEntry * line_2_1d_factory()
Definition Iotm_TextMeshTopologyMapping.h:222
static TopologyMapEntry * wedge_12_factory()
Definition Iotm_TextMeshTopologyMapping.h:798
Definition Iotm_TextMeshDataTypes.h:39
The main namespace for the Ioss library.
Definition Ioad_DatabaseIO.C:40
std::vector< int > IntVector
Definition Ioss_CodeTypes.h:21
A namespace for the textmesh database format.
Definition Iotm_DatabaseIO.C:95
std::ostream & operator<<(std::ostream &out, const TopologyMapEntry &t)
Definition Iotm_TextMeshTopologyMapping.h:941