50 "Reads Swansea plt format for third-order tetrahedra.");
65 vector<vector<NodeSharedPtr> > elementList;
66 vector<int> tmp, tets;
71 cout <<
"InputSwan: Start reading file..." << endl;
81 m_mshFile.read(reinterpret_cast<char *>(&tmp[0]),
82 static_cast<int>(6 *
sizeof(
int)));
84 if (tmp[0] != tmp[5] || tmp[0] != 4 *
sizeof(
int))
86 cout <<
"Header data broken" << endl;
92 int NB_Points = tmp[2];
93 int GridOrder = tmp[4];
94 int ND = (GridOrder + 1) * (GridOrder + 2) * (GridOrder + 3) / 6;
96 cout <<
"NB_Tet = " << NB_Tet << endl;
97 cout <<
"NB_Points = " << NB_Points << endl;
98 cout <<
"GridOrder = " << GridOrder << endl;
99 cout <<
"ND = " << ND << endl;
104 tets.resize(ND * NB_Tet + 2);
105 m_mshFile.read(reinterpret_cast<char *>(&tets[0]),
106 static_cast<int>((ND * NB_Tet + 2) *
sizeof(
int)));
108 if (tets[0] != tets[ND * NB_Tet + 1] ||
109 tets[0] != ND * NB_Tet *
sizeof(
int))
111 cout <<
"ERROR [InputSwan]: Tetrahedron data broken." << endl;
118 pts.resize(3 * NB_Points);
119 m_mshFile.read(reinterpret_cast<char *>(&tmp[0]),
120 static_cast<int>(
sizeof(
int)));
121 m_mshFile.read(reinterpret_cast<char *>(&pts[0]),
122 static_cast<int>(3 * NB_Points *
sizeof(
double)));
123 m_mshFile.read(reinterpret_cast<char *>(&tmp[1]),
124 static_cast<int>(
sizeof(
int)));
126 if (tmp[0] != tmp[1] || tmp[0] != 3 * NB_Points *
sizeof(
double))
128 cout <<
"ERROR [InputSwan]: Point data broken." << endl;
137 for (i = 0; i < NB_Points; ++i)
140 double y = pts[1 * NB_Points + i];
141 double z = pts[2 * NB_Points + i];
143 boost::shared_ptr<Node>(
new Node(vid, x, y, z)));
149 for (i = 0; i < NB_Tet; ++i)
151 vector<NodeSharedPtr> nodeList;
152 for (j = 0; j < 20; ++j)
154 int vid = tets[j * NB_Tet + i + 1];
155 nodeList.push_back(
m_mesh->m_node[vid - 1]);
160 tags.push_back(elType);
165 m_mesh->m_element[3].push_back(E);
171 m_mshFile.read(reinterpret_cast<char *>(&tmp[0]),
172 static_cast<int>(
sizeof(
int)));
173 int n_tri = tmp[0] /
sizeof(int) / 5;
174 tets.resize(n_tri * 5);
175 m_mshFile.read(reinterpret_cast<char *>(&tets[0]),
176 static_cast<int>(tmp[0]));
177 m_mshFile.read(reinterpret_cast<char *>(&tmp[1]),
178 static_cast<int>(
sizeof(
int)));
180 if (tmp[0] != tmp[1])
182 cout <<
"ERROR [InputSwan]: Surface data broken." << endl;
190 for (i = 0; i < n_tri; ++i)
192 vector<NodeSharedPtr> nodeList;
194 for (j = 0; j < 3; ++j)
196 nodeList.push_back(
m_mesh->m_node[tets[i + j * n_tri] - 1]);
201 tags.push_back(elType);
206 m_mesh->m_element[2].push_back(E);
Basic information about an element.
tBaseSharedPtr CreateInstance(tKey idKey BOOST_PP_COMMA_IF(MAX_PARAM) BOOST_PP_ENUM_BINARY_PARAMS(MAX_PARAM, tParam, x))
Create an instance of the class referred to by idKey.
pair< ModuleType, string > ModuleKey
MeshSharedPtr m_mesh
Mesh object.
ElementFactory & GetElementFactory()
virtual NEKMESHUTILS_EXPORT void ProcessFaces(bool ReprocessFaces=true)
Extract element faces.
virtual NEKMESHUTILS_EXPORT void ProcessElements()
Generate element IDs.
boost::shared_ptr< Mesh > MeshSharedPtr
Shared pointer to a mesh.
virtual NEKMESHUTILS_EXPORT void ProcessVertices()
Extract element vertices.
virtual NEKMESHUTILS_EXPORT void ProcessEdges(bool ReprocessEdges=true)
Extract element edges.
boost::shared_ptr< Element > ElementSharedPtr
std::pair< ModuleType, std::string > ModuleKey
virtual NEKMESHUTILS_EXPORT void ProcessComposites()
Generate composites.
ModuleFactory & GetModuleFactory()
tKey RegisterCreatorFunction(tKey idKey, CreatorFunction classCreator, tDescription pDesc="")
Register a class with the factory.