| 1 |
// Copyright(C) 1999-2021, 2024 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_Sphere.h" |
| 9 |
#include <cassert> // for assert |
| 10 |
|
| 11 |
#include "Ioss_CodeTypes.h" // for IntVector |
| 12 |
#include "Ioss_ElementPermutation.h" // for ElementPermutation |
| 13 |
#include "Ioss_ElementTopology.h" // for ElementTopology |
| 14 |
#include "Ioss_Utils.h" |
| 15 |
|
| 16 |
//------------------------------------------------------------------------ |
| 17 |
// Define a variable type for storage of this elements connectivity |
| 18 |
namespace Ioss { |
| 19 |
const char *Sphere::name = "sphere"; |
| 20 |
class St_Sphere : public ElementVariableType |
| 21 |
{ |
| 22 |
public: |
| 23 |
static void factory() { static St_Sphere registerThis; } |
| 24 |
|
| 25 |
protected: |
| 26 |
St_Sphere() : ElementVariableType(Ioss::Sphere::name, 1) {} |
| 27 |
}; |
| 28 |
} // namespace Ioss |
| 29 |
// ======================================================================== |
| 30 |
namespace { |
| 31 |
struct Constants |
| 32 |
{ |
| 33 |
static const int nnode = 1; |
| 34 |
static const int nedge = 0; |
| 35 |
static const int nedgenode = 0; |
| 36 |
static const int nface = 0; |
| 37 |
static const int nfacenode = 0; |
| 38 |
static const int nfaceedge = 0; |
| 39 |
}; |
| 40 |
} // namespace |
| 41 |
void Ioss::Sphere::factory() |
| 42 |
{ |
| 43 |
static Ioss::Sphere registerThis; |
| 44 |
Ioss::St_Sphere::factory(); |
| 45 |
} |
| 46 |
|
| 47 |
Ioss::Sphere::Sphere() : Ioss::ElementTopology(Ioss::Sphere::name, "Particle") |
| 48 |
{ |
| 49 |
Ioss::ElementTopology::alias(Ioss::Sphere::name, "sphere1"); |
| 50 |
Ioss::ElementTopology::alias(Ioss::Sphere::name, "particle"); |
| 51 |
Ioss::ElementTopology::alias(Ioss::Sphere::name, "particles"); |
| 52 |
Ioss::ElementTopology::alias(Ioss::Sphere::name, "sphere-mass"); |
| 53 |
Ioss::ElementTopology::alias(Ioss::Sphere::name, "Particle_1_3D"); |
| 54 |
Ioss::ElementTopology::alias(Ioss::Sphere::name, "Particle_1_2D"); |
| 55 |
Ioss::ElementTopology::alias(Ioss::Sphere::name, "circle"); |
| 56 |
Ioss::ElementTopology::alias(Ioss::Sphere::name, "circle1"); |
| 57 |
Ioss::ElementTopology::alias(Ioss::Sphere::name, "point"); |
| 58 |
Ioss::ElementTopology::alias(Ioss::Sphere::name, "point1"); |
| 59 |
} |
| 60 |
|
| 61 |
int Ioss::Sphere::parametric_dimension() const { return 0; } |
| 62 |
int Ioss::Sphere::spatial_dimension() const { return 3; } |
| 63 |
int Ioss::Sphere::order() const { return 1; } |
| 64 |
|
| 65 |
int Ioss::Sphere::number_corner_nodes() const { return number_nodes(); } |
| 66 |
int Ioss::Sphere::number_nodes() const { return Constants::nnode; } |
| 67 |
int Ioss::Sphere::number_edges() const { return Constants::nedge; } |
| 68 |
int Ioss::Sphere::number_faces() const { return Constants::nface; } |
| 69 |
|
| 70 |
int Ioss::Sphere::number_nodes_edge(int /* edge */) const { return Constants::nedgenode; } |
| 71 |
|
| 72 |
int Ioss::Sphere::number_nodes_face(int face) const |
| 73 |
{ |
| 74 |
// face is 1-based. 0 passed in for all faces. |
| 75 |
assert(face >= 0 && face <= number_faces()); |
| 76 |
IOSS_ASSERT_USED(face); |
| 77 |
return Constants::nfacenode; |
| 78 |
} |
| 79 |
|
| 80 |
int Ioss::Sphere::number_edges_face(int face) const |
| 81 |
{ |
| 82 |
// face is 1-based. 0 passed in for all faces. |
| 83 |
assert(face >= 0 && face <= number_faces()); |
| 84 |
IOSS_ASSERT_USED(face); |
| 85 |
return Constants::nfaceedge; |
| 86 |
} |
| 87 |
|
| 88 |
Ioss::IntVector Ioss::Sphere::edge_connectivity(int /* edge_number */) const |
| 89 |
{ |
| 90 |
Ioss::IntVector connectivity; |
| 91 |
return connectivity; |
| 92 |
} |
| 93 |
|
| 94 |
Ioss::IntVector Ioss::Sphere::face_connectivity(int face_number) const |
| 95 |
{ |
| 96 |
assert(face_number > 0 && face_number <= number_faces()); |
| 97 |
IOSS_ASSERT_USED(face_number); |
| 98 |
Ioss::IntVector connectivity; |
| 99 |
return connectivity; |
| 100 |
} |
| 101 |
|
| 102 |
Ioss::IntVector Ioss::Sphere::element_connectivity() const |
| 103 |
{ |
| 104 |
Ioss::IntVector connectivity(number_nodes()); |
| 105 |
for (int i = 0; i < number_nodes(); i++) { |
| 106 |
connectivity[i] = i; |
| 107 |
} |
| 108 |
return connectivity; |
| 109 |
} |
| 110 |
|
| 111 |
Ioss::ElementTopology *Ioss::Sphere::face_type(int face_number) const |
| 112 |
{ |
| 113 |
// face_number == 0 returns topology for all faces if |
| 114 |
// all faces are the same topology; otherwise, returns nullptr |
| 115 |
// face_number is 1-based. |
| 116 |
|
| 117 |
assert(face_number >= 0 && face_number <= number_faces()); |
| 118 |
IOSS_ASSERT_USED(face_number); |
| 119 |
return (Ioss::ElementTopology *)nullptr; |
| 120 |
} |
| 121 |
|
| 122 |
Ioss::ElementTopology *Ioss::Sphere::edge_type(int edge_number) const |
| 123 |
{ |
| 124 |
// edge_number == 0 returns topology for all edges if |
| 125 |
// all edges are the same topology; otherwise, returns nullptr |
| 126 |
// edge_number is 1-based. |
| 127 |
|
| 128 |
assert(edge_number >= 0 && edge_number <= number_edges()); |
| 129 |
IOSS_ASSERT_USED(edge_number); |
| 130 |
return nullptr; |
| 131 |
} |