40 #include "../MeshElements.h"
50 "Reads ply triangulation format.");
92 map<string, int> propMap;
96 cout <<
"InputPly: Start reading file..." << endl;
99 while (!mshFile.eof())
101 getline(mshFile, line);
102 stringstream s(line);
110 ASSERTL0(
false,
"InputPly file currently only set up to read ascii formatted ply files");
113 else if (word ==
"element")
116 if (word ==
"vertex")
120 else if (word ==
"face")
126 else if (word ==
"property")
129 propMap[word] = nProperties++;
131 else if (word ==
"end_header")
134 vector<double> data(nProperties);
135 for (
int i = 0; i < nVertices; ++i)
137 getline(mshFile, line);
138 stringstream st(line);
140 for (
int j = 0; j < nProperties; ++j)
145 double x = data[propMap[
"x"]];
146 double y = data[propMap[
"y"]];
147 double z = data[propMap[
"z"]];
149 if ((y * y) > 0.000001 &&
m_mesh->m_spaceDim != 3)
153 if ((z * z) > 0.000001)
164 boost::shared_ptr<Node>(
new Node(i, x, y, z)));
167 if (propMap.count(
"nx") > 0)
169 double nx = data[propMap[
"nx"]];
170 double ny = data[propMap[
"ny"]];
171 double nz = data[propMap[
"nz"]];
172 m_mesh->m_vertexNormals[i] =
Node(0, nx, ny, nz);
177 for (
int i = 0; i < nEntities; ++i)
179 getline(mshFile, line);
180 stringstream st(line);
189 vector<NodeSharedPtr> nodeList;
190 for (
int k = 0; k < 3; ++k)
194 nodeList.push_back(
m_mesh->m_node[node]);
200 CreateInstance(elType,conf,nodeList,tags);
203 if (E->GetDim() >
m_mesh->m_expDim)
205 m_mesh->m_expDim = E->GetDim();
207 m_mesh->m_element[E->GetDim()].push_back(E);
#define ASSERTL0(condition, msg)
pair< ModuleType, string > ModuleKey
MeshSharedPtr m_mesh
Mesh object.
virtual void ProcessEdges(bool ReprocessEdges=true)
Extract element edges.
boost::shared_ptr< Element > ElementSharedPtr
Shared pointer to an element.
virtual void ProcessVertices()
Extract element vertices.
virtual void ProcessElements()
Generate element IDs.
boost::shared_ptr< Mesh > MeshSharedPtr
Shared pointer to a mesh.
Basic information about an element.
virtual void ProcessComposites()
Generate composites.
Represents a point in the domain.
virtual void ProcessFaces(bool ReprocessFaces=true)
Extract element faces.
ElementFactory & GetElementFactory()
ModuleFactory & GetModuleFactory()
tKey RegisterCreatorFunction(tKey idKey, CreatorFunction classCreator, tDescription pDesc="")
Register a class with the factory.