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);
105 if (word ==
"element")
108 if (word ==
"vertex")
112 else if (word ==
"face")
118 else if (word ==
"property")
121 propMap[word] = nProperties++;
123 else if (word ==
"end_header")
126 vector<double> data(nProperties);
127 for (
int i = 0; i < nVertices; ++i)
129 getline(mshFile, line);
130 stringstream st(line);
132 for (
int j = 0; j < nProperties; ++j)
137 double x = data[propMap[
"x"]];
138 double y = data[propMap[
"y"]];
139 double z = data[propMap[
"z"]];
141 if ((y * y) > 0.000001 &&
m_mesh->m_spaceDim != 3)
145 if ((z * z) > 0.000001)
156 boost::shared_ptr<Node>(
new Node(i, x, y, z)));
159 if (propMap.count(
"nx") > 0)
161 double nx = data[propMap[
"nx"]];
162 double ny = data[propMap[
"ny"]];
163 double nz = data[propMap[
"nz"]];
164 m_mesh->m_vertexNormals[i] =
Node(0, nx, ny, nz);
169 for (
int i = 0; i < nEntities; ++i)
171 getline(mshFile, line);
172 stringstream st(line);
181 vector<NodeSharedPtr> nodeList;
182 for (
int k = 0; k < 3; ++k)
186 nodeList.push_back(
m_mesh->m_node[node]);
192 CreateInstance(elType,conf,nodeList,tags);
195 if (E->GetDim() >
m_mesh->m_expDim)
197 m_mesh->m_expDim = E->GetDim();
199 m_mesh->m_element[E->GetDim()].push_back(E);