Debian Codegraph @

packages/seacas/libraries/ioss/src/elements/Ioss_Edge2.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_Edge2.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 // Define a variable type for storage of this elements connectivity
17
18 namespace Ioss {
19 const char *Edge2::name = "edge2";
20 class St_Edge2 : public ElementVariableType
21 {
22 public:
23 static void factory() { static St_Edge2 registerThis; }
24
25 protected:
26 St_Edge2() : ElementVariableType(Ioss::Edge2::name, 2) {}
27 };
28 } // namespace Ioss
29 // ========================================================================
30 namespace {
31 struct Constants
32 {
33 static const int nnode = 2;
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::Edge2::factory()
43 {
44 static Ioss::Edge2 registerThis;
45 Ioss::St_Edge2::factory();
46 }
47
48 Ioss::Edge2::Edge2() : Ioss::ElementTopology(Ioss::Edge2::name, "Line_2")
49 {
50 Ioss::ElementTopology::alias(Ioss::Edge2::name, "edge");
51 Ioss::ElementTopology::alias(Ioss::Edge2::name, "edge3d2");
52 Ioss::ElementTopology::alias(Ioss::Edge2::name, "LINE_2_1D");
53 }
54
55 int Ioss::Edge2::parametric_dimension() const { return 1; }
56 int Ioss::Edge2::spatial_dimension() const { return 3; }
57 int Ioss::Edge2::order() const { return 1; }
58
59 int Ioss::Edge2::number_corner_nodes() const { return Constants::nnode; }
60 int Ioss::Edge2::number_nodes() const { return Constants::nnode; }
61 int Ioss::Edge2::number_edges() const { return Constants::nedge; }
62 int Ioss::Edge2::number_faces() const { return Constants::nface; }
63
64 int Ioss::Edge2::number_nodes_edge(int /* edge */) const { return Constants::nedgenode; }
65
66 int Ioss::Edge2::number_nodes_face(int face) const
67 {
68 // face is 1-based. 0 passed in for all faces.
69 assert(face >= 0 && face <= number_faces());
70 IOSS_ASSERT_USED(face);
71 return Constants::nfacenode;
72 }
73
74 int Ioss::Edge2::number_edges_face(int face) const
75 {
76 // face is 1-based. 0 passed in for all faces.
77 assert(face >= 0 && face <= number_faces());
78 IOSS_ASSERT_USED(face);
79 return Constants::nfaceedge;
80 }
81
82 Ioss::IntVector Ioss::Edge2::edge_connectivity(int /* edge_number */) const
83 {
84 Ioss::IntVector connectivity;
85 return connectivity;
86 }
87
88 Ioss::IntVector Ioss::Edge2::face_connectivity(int /* face_number */) const
89 {
90 Ioss::IntVector connectivity;
91 return connectivity;
92 }
93
94 Ioss::IntVector Ioss::Edge2::element_connectivity() const
95 {
96 Ioss::IntVector connectivity(number_nodes());
97 for (int i = 0; i < number_nodes(); i++) {
98 connectivity[i] = i;
99 }
100 return connectivity;
101 }
102
103 Ioss::ElementTopology *Ioss::Edge2::face_type(int /* face_number */) const
104 {
105 return (Ioss::ElementTopology *)nullptr;
106 }
107
108 Ioss::ElementTopology *Ioss::Edge2::edge_type(int /* edge_number */) const
109 {
110 return Ioss::ElementTopology::factory("node1");
111 }