45 #pragma GCC diagnostic ignored "-Woverlength-strings" 46 #include "reference_elem.data" 47 #pragma GCC diagnostic warning "-Woverlength-strings" 56 typedef std::map<ElemType, const char *> FileMapType;
57 FileMapType ref_elem_file;
67 for (
auto & elem : elem_list)
75 for (
auto & node : node_list)
84 std::vector<Node *> node_list;
85 std::vector<Elem *> elem_list;
90 SingletonCache * singleton_cache =
nullptr;
94 void read_ref_elem (
const ElemType type_in,
97 libmesh_assert (singleton_cache !=
nullptr);
104 in >>
n_elem; std::getline (in, dummy); libmesh_assert_equal_to (
n_elem, 1);
105 in >>
n_nodes; std::getline (in, dummy);
106 in >> dummy; std::getline (in, dummy);
107 in >> dummy; std::getline (in, dummy);
108 in >> dummy; std::getline (in, dummy);
109 in >> dummy; std::getline (in, dummy);
110 in >>
n_elem; std::getline (in, dummy); libmesh_assert_equal_to (
n_elem, 1);
112 in >> elem_type_read;
115 libmesh_assert_equal_to (elem_type_read, static_cast<unsigned int>(type_in));
119 std::unique_ptr<Elem> uelem =
Elem::build(type_in);
122 for (
unsigned int n=0; n<
n_nodes; n++)
125 libmesh_assert_equal_to (n,nn);
128 for (
unsigned int n=0; n<
n_nodes; n++)
133 singleton_cache->node_list.push_back(node);
135 uelem->set_node(n) = node;
141 libmesh_error_msg(
"ERROR while creating element singleton!");
145 singleton_cache->elem_list.push_back (uelem.release());
148 ref_elem_map[type_in] = singleton_cache->elem_list.back();
153 void init_ref_elem_table()
156 if (singleton_cache !=
nullptr)
161 InitMutex::scoped_lock lock(init_mtx);
165 if (singleton_cache !=
nullptr)
170 singleton_cache =
new SingletonCache;
174 ref_elem_file.clear();
177 ref_elem_file[
EDGE2] = ElemDataStrings::one_edge;
178 ref_elem_file[
EDGE3] = ElemDataStrings::one_edge3;
179 ref_elem_file[
EDGE4] = ElemDataStrings::one_edge4;
182 ref_elem_file[
TRI3] = ElemDataStrings::one_tri;
183 ref_elem_file[
TRI6] = ElemDataStrings::one_tri6;
185 ref_elem_file[
QUAD4] = ElemDataStrings::one_quad;
186 ref_elem_file[
QUAD8] = ElemDataStrings::one_quad8;
187 ref_elem_file[
QUAD9] = ElemDataStrings::one_quad9;
190 ref_elem_file[
HEX8] = ElemDataStrings::one_hex;
191 ref_elem_file[
HEX20] = ElemDataStrings::one_hex20;
192 ref_elem_file[
HEX27] = ElemDataStrings::one_hex27;
194 ref_elem_file[
TET4] = ElemDataStrings::one_tet;
195 ref_elem_file[
TET10] = ElemDataStrings::one_tet10;
197 ref_elem_file[
PRISM6] = ElemDataStrings::one_prism;
198 ref_elem_file[
PRISM15] = ElemDataStrings::one_prism15;
199 ref_elem_file[
PRISM18] = ElemDataStrings::one_prism18;
201 ref_elem_file[
PYRAMID5] = ElemDataStrings::one_pyramid;
202 ref_elem_file[
PYRAMID13] = ElemDataStrings::one_pyramid13;
203 ref_elem_file[
PYRAMID14] = ElemDataStrings::one_pyramid14;
207 for (
const auto & pr : ref_elem_file)
209 std::istringstream stream(pr.second);
210 read_ref_elem(pr.first, stream);
235 namespace ReferenceElem
251 init_ref_elem_table();
255 if (ref_elem_map[base_type] ==
nullptr || type_in ==
INVALID_ELEM)
256 libmesh_error_msg(
"No reference elem data available for ElemType " << type_in <<
" = " <<
Utility::enum_to_string(type_in) <<
".");
258 return *ref_elem_map[base_type];
Base class for all library singleton objects.
A geometric point in (x,y,z) space associated with a DOF.
The base class for all geometric element types.
static const unsigned int type_to_n_nodes_map[INVALID_ELEM]
const dof_id_type n_nodes
static std::unique_ptr< Elem > build(const ElemType type, Elem *p=nullptr)
std::string enum_to_string(const T e)