50 "Reads ply triangulation format.");
89 map<string, int> propMap;
93 cout <<
"InputPly: Start reading file..." << endl;
96 while (!mshFile.eof())
98 getline(mshFile, line);
102 if (word ==
"format")
107 ASSERTL0(
false,
"InputPly file currently only set up to read " 108 "ascii formatted ply files");
111 else if (word ==
"element")
114 if (word ==
"vertex")
118 else if (word ==
"face")
124 else if (word ==
"property")
127 propMap[word] = nProperties++;
129 else if (word ==
"end_header")
132 vector<double> data(nProperties);
133 for (
int i = 0; i < nVertices; ++i)
135 getline(mshFile, line);
136 stringstream st(line);
138 for (
int j = 0; j < nProperties; ++j)
143 double x = data[propMap[
"x"]];
144 double y = data[propMap[
"y"]];
145 double z = data[propMap[
"z"]];
147 if ((y * y) > 0.000001 &&
m_mesh->m_spaceDim != 3)
151 if ((z * z) > 0.000001)
161 std::shared_ptr<Node>(
new Node(i, x, y, z)));
164 if (propMap.count(
"nx") > 0)
166 double nx = data[propMap[
"nx"]];
167 double ny = data[propMap[
"ny"]];
168 double nz = data[propMap[
"nz"]];
169 m_mesh->m_vertexNormals[i] =
Node(0, nx, ny, nz);
174 for (
int i = 0; i < nEntities; ++i)
176 getline(mshFile, line);
177 stringstream st(line);
186 vector<NodeSharedPtr> nodeList;
187 for (
int k = 0; k < 3; ++k)
191 nodeList.push_back(
m_mesh->m_node[node]);
197 elType, conf, nodeList, tags);
200 if (E->GetDim() >
m_mesh->m_expDim)
202 m_mesh->m_expDim = E->GetDim();
204 m_mesh->m_element[E->GetDim()].push_back(E);
#define ASSERTL0(condition, msg)
Basic information about an element.
MeshSharedPtr m_mesh
Mesh object.
std::shared_ptr< Mesh > MeshSharedPtr
Shared pointer to a mesh.
ElementFactory & GetElementFactory()
tBaseSharedPtr CreateInstance(tKey idKey, tParam... args)
Create an instance of the class referred to by idKey.
std::pair< ModuleType, std::string > ModuleKey
virtual NEKMESHUTILS_EXPORT void ProcessFaces(bool ReprocessFaces=true)
Extract element faces.
std::shared_ptr< Element > ElementSharedPtr
virtual NEKMESHUTILS_EXPORT void ProcessElements()
Generate element IDs.
virtual NEKMESHUTILS_EXPORT void ProcessVertices()
Extract element vertices.
virtual NEKMESHUTILS_EXPORT void ProcessEdges(bool ReprocessEdges=true)
Extract element edges.
tKey RegisterCreatorFunction(tKey idKey, CreatorFunction classCreator, std::string pDesc="")
Register a class with the factory.
std::pair< ModuleType, std::string > ModuleKey
virtual NEKMESHUTILS_EXPORT void ProcessComposites()
Generate composites.
ModuleFactory & GetModuleFactory()