Debian Codegraph @

packages/seacas/libraries/ioss/src/elements/Ioss_Super.C

raw
1 // Copyright(C) 1999-2020, 2022 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_Super.h"
9 #include <string> // for string
10
11 #include "Ioss_CodeTypes.h" // for IntVector
12 #include "Ioss_ElementTopology.h" // for ElementTopology
13 #include "Ioss_Utils.h"
14
15 //------------------------------------------------------------------------
16 // Define a variable type for storage of this elements connectivity
17 namespace Ioss {
18 const char *Super::name = "super";
19 class St_Super : public ElementVariableType
20 {
21 public:
22 St_Super(const std::string &my_name, int node_count) : ElementVariableType(my_name, node_count)
23 {
24 }
25 };
26 } // namespace Ioss
27
28 void Ioss::Super::factory() {}
29
30 // ========================================================================
31 // Note that since a superelement is created for each node_count, it isn't
32 // possible to precreate these element types statically, so they are created
33 // as needed and therefore, they must be deleted at end of run hence the 'true'
34 // argument to the ElementTopology constructor
35 Ioss::Super::Super(const std::string &my_name, int node_count)
36 : Ioss::ElementTopology(my_name, "Unknown", true), nodeCount(node_count),
37 storageType(new St_Super(my_name, node_count)),
38 baseTopologyName(Ioss::Utils::lowercase(my_name))
39 {
40 }
41
42 Ioss::Super::~Super() { delete storageType; }
43
44 void Ioss::Super::make_super(const std::string &type)
45 {
46 // Decode name to determine number of nodes...
47 // Assume that digits at end specify number of nodes.
48 std::string node_count_str = Ioss::Utils::get_trailing_digits(type);
49 if (!node_count_str.empty()) {
50 int node_count = std::stoi(node_count_str);
51 new Ioss::Super(type, node_count);
52 }
53 }
54
55 int Ioss::Super::parametric_dimension() const { return 3; }
56 int Ioss::Super::spatial_dimension() const { return 3; }
57 int Ioss::Super::order() const { return 1; }
58
59 int Ioss::Super::number_corner_nodes() const { return nodeCount; }
60 int Ioss::Super::number_nodes() const { return nodeCount; }
61 int Ioss::Super::number_edges() const { return 0; }
62 int Ioss::Super::number_faces() const { return 0; }
63
64 int Ioss::Super::number_nodes_edge(int /* edge */) const { return 0; }
65
66 int Ioss::Super::number_nodes_face(int /*face*/) const { return 0; }
67 int Ioss::Super::number_edges_face(int /*face*/) const { return 0; }
68
69 Ioss::IntVector Ioss::Super::edge_connectivity(int /*edge_number*/) const
70 {
71 Ioss::IntVector connectivity(0);
72 return connectivity;
73 }
74
75 Ioss::IntVector Ioss::Super::face_connectivity(int /*face_number*/) const
76 {
77 Ioss::IntVector connectivity(0);
78 return connectivity;
79 }
80
81 Ioss::IntVector Ioss::Super::element_connectivity() const
82 {
83 Ioss::IntVector connectivity(number_nodes());
84 for (int i = 0; i < number_nodes(); i++) {
85 connectivity[i] = i;
86 }
87 return connectivity;
88 }
89
90 Ioss::ElementTopology *Ioss::Super::face_type(int /*face_number*/) const
91 {
92 return Ioss::ElementTopology::factory("unknown");
93 }
94
95 Ioss::ElementTopology *Ioss::Super::edge_type(int /*edge_number*/) const
96 {
97 return Ioss::ElementTopology::factory("unknown");
98 }
99
100 Ioss::IntVector Ioss::Super::face_edge_connectivity(int /*face_number*/) const
101 {
102 Ioss::IntVector fcon(0);
103 return fcon;
104 }