Debian Codegraph @

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

raw
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_Node.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 *Node::name = "node";
20 class St_Node : public ElementVariableType
21 {
22 public:
23 static void factory() { static St_Node registerThis; }
24
25 protected:
26 St_Node() : ElementVariableType(Ioss::Node::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
42 void Ioss::Node::factory()
43 {
44 static Ioss::Node registerThis;
45 Ioss::St_Node::factory();
46 }
47
48 Ioss::Node::Node() : Ioss::ElementTopology(Ioss::Node::name, "Node_0_3D")
49 {
50 Ioss::ElementTopology::alias(Ioss::Node::name, "Node_0_2D");
51 Ioss::ElementTopology::alias(Ioss::Node::name, "NODE");
52 }
53
54 int Ioss::Node::parametric_dimension() const { return 0; }
55 int Ioss::Node::spatial_dimension() const { return 3; }
56 int Ioss::Node::order() const { return 1; }
57
58 int Ioss::Node::number_corner_nodes() const { return Constants::nnode; }
59 int Ioss::Node::number_nodes() const { return Constants::nnode; }
60 int Ioss::Node::number_edges() const { return Constants::nedge; }
61 int Ioss::Node::number_faces() const { return Constants::nface; }
62
63 int Ioss::Node::number_nodes_edge(int /* edge */) const { return Constants::nedgenode; }
64
65 int Ioss::Node::number_nodes_face(int face) const
66 {
67 // face is 1-based. 0 passed in for all faces.
68 assert(face >= 0 && face <= number_faces());
69 IOSS_ASSERT_USED(face);
70 return Constants::nfacenode;
71 }
72
73 int Ioss::Node::number_edges_face(int face) const
74 {
75 // face is 1-based. 0 passed in for all faces.
76 assert(face >= 0 && face <= number_faces());
77 IOSS_ASSERT_USED(face);
78 return Constants::nfaceedge;
79 }
80
81 Ioss::IntVector Ioss::Node::edge_connectivity(int /* edge_number */) const
82 {
83 Ioss::IntVector connectivity;
84 return connectivity;
85 }
86
87 Ioss::IntVector Ioss::Node::face_connectivity(int face_number) const
88 {
89 assert(face_number > 0 && face_number <= number_faces());
90 IOSS_ASSERT_USED(face_number);
91 Ioss::IntVector connectivity;
92 return connectivity;
93 }
94
95 Ioss::IntVector Ioss::Node::element_connectivity() const
96 {
97 Ioss::IntVector connectivity(number_nodes());
98 for (int i = 0; i < number_nodes(); i++) {
99 connectivity[i] = i;
100 }
101 return connectivity;
102 }
103
104 Ioss::ElementTopology *Ioss::Node::face_type(int face_number) const
105 {
106 // face_number == 0 returns topology for all faces if
107 // all faces are the same topology; otherwise, returns nullptr
108 // face_number is 1-based.
109
110 assert(face_number >= 0 && face_number <= number_faces());
111 IOSS_ASSERT_USED(face_number);
112 return (Ioss::ElementTopology *)nullptr;
113 }
114
115 Ioss::ElementTopology *Ioss::Node::edge_type(int edge_number) const
116 {
117 // edge_number == 0 returns topology for all edges if
118 // all edges are the same topology; otherwise, returns nullptr
119 // edge_number is 1-based.
120
121 assert(edge_number >= 0 && edge_number <= number_edges());
122 IOSS_ASSERT_USED(edge_number);
123 return nullptr;
124 }