| 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_Tri7.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 *Tri7::name = "tri7"; |
| 20 |
class St_Tri7 : public ElementVariableType |
| 21 |
{ |
| 22 |
public: |
| 23 |
static void factory() { static St_Tri7 registerThis; } |
| 24 |
|
| 25 |
protected: |
| 26 |
St_Tri7() : ElementVariableType(Ioss::Tri7::name, 7) {} |
| 27 |
}; |
| 28 |
} // namespace Ioss |
| 29 |
//------------------------------------------------------------------------ |
| 30 |
namespace { |
| 31 |
struct Constants |
| 32 |
{ |
| 33 |
static const int nnode = 7; |
| 34 |
static const int nedge = 3; |
| 35 |
static const int nedgenode = 3; |
| 36 |
static const int nface = 0; |
| 37 |
static const int nfacenode = 0; |
| 38 |
static const int nfaceedge = 0; |
| 39 |
static int edge_node_order[nedge][nedgenode]; |
| 40 |
}; |
| 41 |
|
| 42 |
// Edge numbers are zero-based [0..number_edges) |
| 43 |
int Constants::edge_node_order[nedge][nedgenode] = // [edge][edge_node] |
| 44 |
{{0, 1, 3}, {1, 2, 4}, {2, 0, 5}}; |
| 45 |
} // namespace |
| 46 |
|
| 47 |
void Ioss::Tri7::factory() |
| 48 |
{ |
| 49 |
static Ioss::Tri7 registerThis; |
| 50 |
Ioss::St_Tri7::factory(); |
| 51 |
} |
| 52 |
|
| 53 |
Ioss::Tri7::Tri7() : Ioss::ElementTopology(Ioss::Tri7::name, "Triangle_7") |
| 54 |
{ |
| 55 |
Ioss::ElementTopology::alias(Ioss::Tri7::name, "triangle7"); |
| 56 |
Ioss::ElementTopology::alias(Ioss::Tri7::name, "Solid_Tri_7_2D"); |
| 57 |
Ioss::ElementTopology::alias(Ioss::Tri7::name, "Face_Tri_7_3D"); |
| 58 |
Ioss::ElementTopology::alias(Ioss::Tri7::name, "TRIANGLE_7_2D"); |
| 59 |
Ioss::ElementTopology::alias(Ioss::Tri7::name, "triface7"); |
| 60 |
} |
| 61 |
|
| 62 |
int Ioss::Tri7::parametric_dimension() const { return 2; } |
| 63 |
int Ioss::Tri7::spatial_dimension() const { return 2; } |
| 64 |
int Ioss::Tri7::order() const { return 2; } |
| 65 |
|
| 66 |
int Ioss::Tri7::number_corner_nodes() const { return 3; } |
| 67 |
int Ioss::Tri7::number_nodes() const { return Constants::nnode; } |
| 68 |
int Ioss::Tri7::number_edges() const { return Constants::nedge; } |
| 69 |
int Ioss::Tri7::number_faces() const { return Constants::nface; } |
| 70 |
|
| 71 |
int Ioss::Tri7::number_nodes_edge(int /* edge */) const { return Constants::nedgenode; } |
| 72 |
int Ioss::Tri7::number_nodes_face(int /* face */) const { return Constants::nfacenode; } |
| 73 |
int Ioss::Tri7::number_edges_face(int /* face */) const { return Constants::nfaceedge; } |
| 74 |
|
| 75 |
Ioss::IntVector Ioss::Tri7::edge_connectivity(int edge_number) const |
| 76 |
{ |
| 77 |
assert(edge_number > 0 && edge_number <= number_edges()); |
| 78 |
Ioss::IntVector connectivity(Constants::nedgenode); |
| 79 |
|
| 80 |
for (int i = 0; i < Constants::nedgenode; i++) { |
| 81 |
connectivity[i] = Constants::edge_node_order[edge_number - 1][i]; |
| 82 |
} |
| 83 |
|
| 84 |
return connectivity; |
| 85 |
} |
| 86 |
|
| 87 |
Ioss::IntVector Ioss::Tri7::face_connectivity(int /* face_number */) const |
| 88 |
{ |
| 89 |
Ioss::IntVector connectivity; |
| 90 |
return connectivity; |
| 91 |
} |
| 92 |
|
| 93 |
Ioss::IntVector Ioss::Tri7::element_connectivity() const |
| 94 |
{ |
| 95 |
Ioss::IntVector connectivity(number_nodes()); |
| 96 |
|
| 97 |
for (int i = 0; i < number_nodes(); i++) { |
| 98 |
connectivity[i] = i; |
| 99 |
} |
| 100 |
|
| 101 |
return connectivity; |
| 102 |
} |
| 103 |
|
| 104 |
Ioss::ElementTopology *Ioss::Tri7::face_type(int /* face_number */) const |
| 105 |
{ |
| 106 |
return (Ioss::ElementTopology *)nullptr; |
| 107 |
} |
| 108 |
|
| 109 |
Ioss::ElementTopology *Ioss::Tri7::edge_type(int edge_number) const |
| 110 |
{ |
| 111 |
assert(edge_number >= 0 && edge_number <= number_edges()); |
| 112 |
IOSS_ASSERT_USED(edge_number); |
| 113 |
return Ioss::ElementTopology::factory("edge3"); |
| 114 |
} |