| 1 |
// Copyright(C) 1999-2021 National Technology & Engineering Solutions |
| 2 |
// of Sandia, LLC (NTESS). Under the terms of Contract DE-NA0003525 with |
| 3 |
// NTESS, the U.S. Government retains certain rights in this software. |
| 4 |
// |
| 5 |
// See packages/seacas/LICENSE for details |
| 6 |
|
| 7 |
#include "Ioss_ElementVariableType.h" // for ElementVariableType |
| 8 |
#include "Ioss_Pyramid18.h" |
| 9 |
#include <cassert> // for assert |
| 10 |
#include <string> |
| 11 |
|
| 12 |
//------------------------------------------------------------------------ |
| 13 |
// Define a variable type for storage of this elements connectivity |
| 14 |
#include "Ioss_CodeTypes.h" // for IntVector |
| 15 |
#include "Ioss_ElementTopology.h" // for ElementTopology |
| 16 |
#include "Ioss_Utils.h" |
| 17 |
|
| 18 |
namespace Ioss { |
| 19 |
const char *Pyramid18::name = "pyramid18"; |
| 20 |
class St_Pyramid18 : public ElementVariableType |
| 21 |
{ |
| 22 |
public: |
| 23 |
static void factory(); |
| 24 |
|
| 25 |
protected: |
| 26 |
St_Pyramid18() : ElementVariableType(Ioss::Pyramid18::name, 18) {} |
| 27 |
}; |
| 28 |
} // namespace Ioss |
| 29 |
|
| 30 |
void Ioss::St_Pyramid18::factory() { static Ioss::St_Pyramid18 registerThis; } |
| 31 |
|
| 32 |
// ======================================================================== |
| 33 |
namespace { |
| 34 |
struct Constants |
| 35 |
{ |
| 36 |
static const int nnode = 18; |
| 37 |
static const int nedge = 8; |
| 38 |
static const int nedgenode = 3; |
| 39 |
static const int nface = 5; |
| 40 |
static const int nfacenode = 9; |
| 41 |
static const int nfaceedge = 4; |
| 42 |
static int edge_node_order[nedge][nedgenode]; |
| 43 |
static int face_node_order[nface][nfacenode]; |
| 44 |
static int face_edge_order[nface][nfaceedge]; |
| 45 |
static int nodes_per_face[nface + 1]; |
| 46 |
static int nodes_per_edge[nedge + 1]; |
| 47 |
static int edges_per_face[nface + 1]; |
| 48 |
}; |
| 49 |
|
| 50 |
// Edge numbers are zero-based [0..number_edges) |
| 51 |
int Constants::edge_node_order[nedge][nedgenode] = // [edge][edge_node] |
| 52 |
{ |
| 53 |
{0, 1, 5}, {1, 2, 6}, {2, 3, 7}, {3, 0, 8}, {0, 4, 9}, {1, 4, 10}, {2, 4, 11}, {3, 4, 12}, |
| 54 |
}; |
| 55 |
|
| 56 |
// Face numbers are zero-based [0..number_faces) |
| 57 |
int Constants::face_node_order[nface][nfacenode] = // [face][face_node] |
| 58 |
{{0, 1, 4, 5, 10, 9, 14, -1, -1}, |
| 59 |
{1, 2, 4, 6, 11, 10, 15, -1, -1}, |
| 60 |
{2, 3, 4, 7, 12, 11, 16, -1, -1}, |
| 61 |
{3, 0, 4, 8, 9, 12, 17, -1, -1}, |
| 62 |
{0, 3, 2, 1, 8, 7, 6, 5, 13}}; |
| 63 |
|
| 64 |
int Constants::face_edge_order[nface][nfaceedge] = // [face][face_edge] |
| 65 |
{{0, 5, 4, -1}, {1, 6, 5, -1}, {2, 7, 6, -1}, {3, 4, 7, -1}, {3, 2, 1, 0}}; |
| 66 |
|
| 67 |
int Constants::nodes_per_face[nface + 1] = {-1, 7, 7, 7, 7, 9}; |
| 68 |
|
| 69 |
int Constants::nodes_per_edge[nedge + 1] = {3, 3, 3, 3, 3, 3, 3, 3, 3}; |
| 70 |
|
| 71 |
int Constants::edges_per_face[nface + 1] = {-1, 3, 3, 3, 3, 4}; |
| 72 |
} // namespace |
| 73 |
|
| 74 |
void Ioss::Pyramid18::factory() |
| 75 |
{ |
| 76 |
static Ioss::Pyramid18 registerThis; |
| 77 |
Ioss::St_Pyramid18::factory(); |
| 78 |
} |
| 79 |
|
| 80 |
Ioss::Pyramid18::Pyramid18() : Ioss::ElementTopology(Ioss::Pyramid18::name, "Pyramid_18") |
| 81 |
{ |
| 82 |
Ioss::ElementTopology::alias(Ioss::Pyramid18::name, "Solid_Pyramid_18_3D"); |
| 83 |
Ioss::ElementTopology::alias(Ioss::Pyramid18::name, "pyra18"); |
| 84 |
} |
| 85 |
|
| 86 |
int Ioss::Pyramid18::parametric_dimension() const { return 3; } |
| 87 |
int Ioss::Pyramid18::spatial_dimension() const { return 3; } |
| 88 |
int Ioss::Pyramid18::order() const { return 2; } |
| 89 |
|
| 90 |
int Ioss::Pyramid18::number_corner_nodes() const { return 5; } |
| 91 |
int Ioss::Pyramid18::number_nodes() const { return Constants::nnode; } |
| 92 |
int Ioss::Pyramid18::number_edges() const { return Constants::nedge; } |
| 93 |
int Ioss::Pyramid18::number_faces() const { return Constants::nface; } |
| 94 |
|
| 95 |
bool Ioss::Pyramid18::faces_similar() const { return false; } |
| 96 |
|
| 97 |
int Ioss::Pyramid18::number_nodes_edge(int /* edge */) const { return Constants::nedgenode; } |
| 98 |
|
| 99 |
int Ioss::Pyramid18::number_nodes_face(int face) const |
| 100 |
{ |
| 101 |
// face is 1-based. 0 passed in for all faces. |
| 102 |
assert(face >= 0 && face <= number_faces()); |
| 103 |
return Constants::nodes_per_face[face]; |
| 104 |
} |
| 105 |
|
| 106 |
int Ioss::Pyramid18::number_edges_face(int face) const |
| 107 |
{ |
| 108 |
// face is 1-based. 0 passed in for all faces. |
| 109 |
assert(face >= 0 && face <= number_faces()); |
| 110 |
return Constants::edges_per_face[face]; |
| 111 |
} |
| 112 |
|
| 113 |
Ioss::IntVector Ioss::Pyramid18::edge_connectivity(int edge_number) const |
| 114 |
{ |
| 115 |
Ioss::IntVector connectivity(Constants::nodes_per_edge[edge_number]); |
| 116 |
|
| 117 |
for (int i = 0; i < Constants::nodes_per_edge[edge_number]; i++) { |
| 118 |
connectivity[i] = Constants::edge_node_order[edge_number - 1][i]; |
| 119 |
} |
| 120 |
|
| 121 |
return connectivity; |
| 122 |
} |
| 123 |
|
| 124 |
Ioss::IntVector Ioss::Pyramid18::face_connectivity(int face_number) const |
| 125 |
{ |
| 126 |
assert(face_number > 0 && face_number <= number_faces()); |
| 127 |
Ioss::IntVector connectivity(Constants::nodes_per_face[face_number]); |
| 128 |
|
| 129 |
for (int i = 0; i < Constants::nodes_per_face[face_number]; i++) { |
| 130 |
connectivity[i] = Constants::face_node_order[face_number - 1][i]; |
| 131 |
} |
| 132 |
|
| 133 |
return connectivity; |
| 134 |
} |
| 135 |
|
| 136 |
Ioss::IntVector Ioss::Pyramid18::element_connectivity() const |
| 137 |
{ |
| 138 |
Ioss::IntVector connectivity(number_nodes()); |
| 139 |
for (int i = 0; i < number_nodes(); i++) { |
| 140 |
connectivity[i] = i; |
| 141 |
} |
| 142 |
return connectivity; |
| 143 |
} |
| 144 |
|
| 145 |
Ioss::ElementTopology *Ioss::Pyramid18::face_type(int face_number) const |
| 146 |
{ |
| 147 |
assert(face_number >= 0 && face_number <= number_faces()); |
| 148 |
if (face_number == 0) { |
| 149 |
return (Ioss::ElementTopology *)nullptr; |
| 150 |
} |
| 151 |
if (face_number <= 4) { |
| 152 |
// return Ioss::ElementTopology::factory("triface6"); |
| 153 |
return Ioss::ElementTopology::factory("tri7"); |
| 154 |
} |
| 155 |
|
| 156 |
// return Ioss::ElementTopology::factory("quadface9"); |
| 157 |
return Ioss::ElementTopology::factory("quad9"); |
| 158 |
} |
| 159 |
|
| 160 |
Ioss::ElementTopology *Ioss::Pyramid18::edge_type(int edge_number) const |
| 161 |
{ |
| 162 |
assert(edge_number >= 0 && edge_number <= number_edges()); |
| 163 |
IOSS_ASSERT_USED(edge_number); |
| 164 |
return Ioss::ElementTopology::factory("edge3"); |
| 165 |
} |
| 166 |
|
| 167 |
Ioss::IntVector Ioss::Pyramid18::face_edge_connectivity(int face_number) const |
| 168 |
{ |
| 169 |
assert(face_number > 0 && face_number <= Constants::nface); |
| 170 |
|
| 171 |
int nface_edge = number_edges_face(face_number); |
| 172 |
Ioss::IntVector fcon(nface_edge); |
| 173 |
|
| 174 |
for (int i = 0; i < nface_edge; i++) { |
| 175 |
fcon[i] = Constants::face_edge_order[face_number - 1][i]; |
| 176 |
} |
| 177 |
|
| 178 |
return fcon; |
| 179 |
} |