Debian Codegraph @

packages/seacas/libraries/ioss/src/elements/Ioss_Beam2.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_Beam2.h"
8 #include "Ioss_ElementVariableType.h" // for ElementVariableType
9 #include <cassert> // for assert
10 #include <string>
11
12 #include "Ioss_CodeTypes.h" // for IntVector
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 *Beam2::name = "bar2";
20 class St_Beam2 : public ElementVariableType
21 {
22 public:
23 static void factory() { static St_Beam2 registerThis; }
24
25 protected:
26 St_Beam2() : ElementVariableType(Ioss::Beam2::name, 2) {}
27 };
28 } // namespace Ioss
29 // ========================================================================
30 namespace {
31 struct Constants
32 {
33 static const int nnode = 2;
34 static const int nedge = 2;
35 static const int nedgenode = 2;
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::Beam2::factory()
43 {
44 static Ioss::Beam2 registerThis;
45 Ioss::St_Beam2::factory();
46 }
47
48 Ioss::Beam2::Beam2() : Ioss::ElementTopology(Ioss::Beam2::name, "Beam_2")
49 {
50 Ioss::ElementTopology::alias(Ioss::Beam2::name, "Rod_2_3D");
51 Ioss::ElementTopology::alias(Ioss::Beam2::name, "rod2");
52 Ioss::ElementTopology::alias(Ioss::Beam2::name, "rod");
53 Ioss::ElementTopology::alias(Ioss::Beam2::name, "beam2");
54 Ioss::ElementTopology::alias(Ioss::Beam2::name, "bar");
55 Ioss::ElementTopology::alias(Ioss::Beam2::name, "bar2");
56 Ioss::ElementTopology::alias(Ioss::Beam2::name, "truss");
57 Ioss::ElementTopology::alias(Ioss::Beam2::name, "truss2");
58 Ioss::ElementTopology::alias(Ioss::Beam2::name, "beam");
59 Ioss::ElementTopology::alias(Ioss::Beam2::name, "rod3d2");
60 Ioss::ElementTopology::alias(Ioss::Beam2::name, "Rod_2_2D");
61 Ioss::ElementTopology::alias(Ioss::Beam2::name, "rod2d2");
62 Ioss::ElementTopology::alias(Ioss::Beam2::name, "beam-r");
63 Ioss::ElementTopology::alias(Ioss::Beam2::name, "beam-r2");
64 Ioss::ElementTopology::alias(Ioss::Beam2::name, "line");
65 Ioss::ElementTopology::alias(Ioss::Beam2::name, "line2");
66 Ioss::ElementTopology::alias(Ioss::Beam2::name, "BEAM_2");
67 }
68
69 int Ioss::Beam2::parametric_dimension() const { return 1; }
70 int Ioss::Beam2::spatial_dimension() const { return 3; }
71 int Ioss::Beam2::order() const { return 1; }
72
73 int Ioss::Beam2::number_corner_nodes() const { return 2; }
74 int Ioss::Beam2::number_nodes() const { return Constants::nnode; }
75 int Ioss::Beam2::number_edges() const { return Constants::nedge; }
76 int Ioss::Beam2::number_faces() const { return Constants::nface; }
77
78 int Ioss::Beam2::number_nodes_edge(int /* edge */) const { return Constants::nedgenode; }
79
80 int Ioss::Beam2::number_nodes_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::nfacenode;
86 }
87
88 int Ioss::Beam2::number_edges_face(int face) const
89 {
90 // face is 1-based. 0 passed in for all faces.
91 assert(face >= 0 && face <= number_faces());
92 IOSS_ASSERT_USED(face);
93 return Constants::nfaceedge;
94 }
95
96 Ioss::IntVector Ioss::Beam2::edge_connectivity(int edge_number) const
97 {
98 Ioss::IntVector connectivity(Constants::nedgenode);
99 if (edge_number == 1) {
100 connectivity[0] = 0;
101 connectivity[1] = 1;
102 }
103 else {
104 connectivity[0] = 1;
105 connectivity[1] = 0;
106 }
107 return connectivity;
108 }
109
110 Ioss::IntVector Ioss::Beam2::face_connectivity(int /* face_number */) const
111 {
112 Ioss::IntVector connectivity;
113 return connectivity;
114 }
115
116 Ioss::IntVector Ioss::Beam2::element_connectivity() const
117 {
118 Ioss::IntVector connectivity(number_nodes());
119 for (int i = 0; i < number_nodes(); i++) {
120 connectivity[i] = i;
121 }
122 return connectivity;
123 }
124
125 Ioss::ElementTopology *Ioss::Beam2::face_type(int /* face_number */) const
126 {
127 return (Ioss::ElementTopology *)nullptr;
128 }
129
130 Ioss::ElementTopology *Ioss::Beam2::edge_type(int /* edge_number */) const
131 {
132 return Ioss::ElementTopology::factory("edge2");
133 }