Debian Codegraph @

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

raw
1 // Copyright(C) 1999-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_Beam4.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 *Beam4::name = "bar4";
20 class St_Beam4 : public ElementVariableType
21 {
22 public:
23 static void factory() { static St_Beam4 registerThis; }
24
25 protected:
26 St_Beam4() : ElementVariableType(Ioss::Beam4::name, 4) {}
27 };
28 } // namespace Ioss
29 // ========================================================================
30 namespace {
31 struct Constants
32 {
33 static const int nnode = 4;
34 static const int nedge = 2;
35 static const int nedgenode = 4;
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::Beam4::factory()
43 {
44 static Ioss::Beam4 registerThis;
45 Ioss::St_Beam4::factory();
46 }
47
48 Ioss::Beam4::Beam4() : Ioss::ElementTopology(Ioss::Beam4::name, "Beam_4")
49 {
50 Ioss::ElementTopology::alias(Ioss::Beam4::name, "Rod_4_3D");
51 Ioss::ElementTopology::alias(Ioss::Beam4::name, "rod4");
52 Ioss::ElementTopology::alias(Ioss::Beam4::name, "rod3d4");
53 Ioss::ElementTopology::alias(Ioss::Beam4::name, "truss4");
54 Ioss::ElementTopology::alias(Ioss::Beam4::name, "beam4");
55 Ioss::ElementTopology::alias(Ioss::Beam4::name, "Rod_4_2D");
56 Ioss::ElementTopology::alias(Ioss::Beam4::name, "rod2d4");
57 }
58
59 int Ioss::Beam4::parametric_dimension() const { return 1; }
60 int Ioss::Beam4::spatial_dimension() const { return 3; }
61 int Ioss::Beam4::order() const { return 3; }
62
63 int Ioss::Beam4::number_corner_nodes() const { return 2; }
64 int Ioss::Beam4::number_nodes() const { return Constants::nnode; }
65 int Ioss::Beam4::number_edges() const { return Constants::nedge; }
66 int Ioss::Beam4::number_faces() const { return Constants::nface; }
67
68 int Ioss::Beam4::number_nodes_edge(int /* edge */) const { return Constants::nedgenode; }
69
70 int Ioss::Beam4::number_nodes_face(int face) const
71 {
72 // face is 1-based. 0 passed in for all faces.
73 assert(face >= 0 && face <= number_faces());
74 IOSS_ASSERT_USED(face);
75 return Constants::nfacenode;
76 }
77
78 int Ioss::Beam4::number_edges_face(int face) const
79 {
80 // face is 1-based. 0 passed in for all faces.
81 assert(face >= 0 && face <= number_faces());
82 IOSS_ASSERT_USED(face);
83 return Constants::nfaceedge;
84 }
85
86 Ioss::IntVector Ioss::Beam4::edge_connectivity(int edge_number) const
87 {
88 Ioss::IntVector connectivity(Constants::nedgenode);
89 if (edge_number == 1) {
90 connectivity[0] = 0;
91 connectivity[1] = 1;
92 connectivity[2] = 2;
93 connectivity[3] = 3;
94 }
95 else {
96 connectivity[0] = 1;
97 connectivity[1] = 0;
98 connectivity[2] = 3;
99 connectivity[3] = 2;
100 }
101 return connectivity;
102 }
103
104 Ioss::IntVector Ioss::Beam4::face_connectivity(int /* face_number */) const
105 {
106 Ioss::IntVector connectivity;
107 return connectivity;
108 }
109
110 Ioss::IntVector Ioss::Beam4::element_connectivity() const
111 {
112 Ioss::IntVector connectivity(number_nodes());
113 for (int i = 0; i < number_nodes(); i++) {
114 connectivity[i] = i;
115 }
116 return connectivity;
117 }
118
119 Ioss::ElementTopology *Ioss::Beam4::face_type(int /* face_number */) const
120 {
121 return (Ioss::ElementTopology *)nullptr;
122 }
123
124 Ioss::ElementTopology *Ioss::Beam4::edge_type(int /* edge_number */) const
125 {
126 return Ioss::ElementTopology::factory("edge4");
127 }