51 "Reads ply triangulation format.");
90 map<string, int> propMap;
94 cout <<
"InputPly: Start reading file..." << endl;
97 while (!mshFile.eof())
99 getline(mshFile, line);
100 stringstream s(line);
103 if (word ==
"format")
108 ASSERTL0(
false,
"InputPly file currently only set up to read "
109 "ascii formatted ply files");
112 else if (word ==
"element")
115 if (word ==
"vertex")
119 else if (word ==
"face")
125 else if (word ==
"property")
128 propMap[word] = nProperties++;
130 else if (word ==
"end_header")
133 vector<double> data(nProperties);
134 for (
int i = 0; i < nVertices; ++i)
136 getline(mshFile, line);
137 stringstream st(line);
139 for (
int j = 0; j < nProperties; ++j)
144 double x = data[propMap[
"x"]];
145 double y = data[propMap[
"y"]];
146 double z = data[propMap[
"z"]];
148 if ((y * y) > 0.000001 &&
m_mesh->m_spaceDim != 3)
152 if ((z * z) > 0.000001)
162 boost::shared_ptr<Node>(
new Node(i, x, y, z)));
165 if (propMap.count(
"nx") > 0)
167 double nx = data[propMap[
"nx"]];
168 double ny = data[propMap[
"ny"]];
169 double nz = data[propMap[
"nz"]];
170 m_mesh->m_vertexNormals[i] =
Node(0, nx, ny, nz);
175 for (
int i = 0; i < nEntities; ++i)
177 getline(mshFile, line);
178 stringstream st(line);
187 vector<NodeSharedPtr> nodeList;
188 for (
int k = 0; k < 3; ++k)
192 nodeList.push_back(
m_mesh->m_node[node]);
198 elType, conf, nodeList, tags);
201 if (E->GetDim() >
m_mesh->m_expDim)
203 m_mesh->m_expDim = E->GetDim();
205 m_mesh->m_element[E->GetDim()].push_back(E);
#define ASSERTL0(condition, msg)
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.