void writeSurfaceToVTK ( const word& name, const triSurf& surf, const List<DynList<scalar, 1> >& data ) { OFstream file(name+".vtk"); writeSurfaceToVTK(file, surf); //- write curvature fields const pointField& points = surf.points(); file << "\n"; file << "\nPOINT_DATA " << points.size() << "\n"; file << "SCALARS Values double\n"; file << "LOOKUP_TABLE default\n"; forAll(points, pI) { file << data[pI][0] << " "; if( pI && pI % 5 == 0 ) file << endl; }
label checkAngles ( triSurf& surf, const word subsetName, const scalar angleTol ) { labelLongList badTriangles; if( checkAngles(surf, badTriangles, angleTol) ) { label setId = surf.facetSubsetIndex(subsetName); if( setId >= 0 ) surf.removeFacetSubset(setId); setId = surf.addFacetSubset(subsetName); forAll(badTriangles, i) surf.addFacetToSubset(setId, badTriangles[i]); } return badTriangles.size(); }
triSurfacePartitioner::triSurfacePartitioner ( const triSurf& surface ) : surface_(surface), corners_(), cornerPatches_(), patchPatches_(surface.patches().size()), edgeGroups_(), edgeGroupEdgeGroups_(), patchesEdgeGroups_(), edgeGroupsCorners_() { calculatePatchAddressing(); }
void writeSurfaceToVTK ( OFstream& file, const triSurf& surf, const DynList<label>& triangles, const labelHashSet& labels ) { //- write the header file << "# vtk DataFile Version 3.0\n"; file << "vtk output\n"; file << "ASCII\n"; file << "DATASET POLYDATA\n"; //- write points std::map<label, label> newPointLabel; forAll(triangles, tI) { const labelledTri& tri = surf[triangles[tI]]; for(label pI=0;pI<3;++pI) { newPointLabel[tri[pI]]; } } forAllConstIter(labelHashSet, labels, it) newPointLabel[it.key()]; const pointField& points = surf.points(); file << "POINTS " << label(newPointLabel.size()) << " float\n"; label counter(0); for ( std::map<label, label>::iterator it=newPointLabel.begin(); it!=newPointLabel.end(); ++it ) { it->second = counter++; const point& p = points[it->first]; file << p.x() << ' ' << p.y() << ' ' << p.z() << ' '; file << nl; } //- write triangles file << "\n"; file << "\nPOLYGONS " << triangles.size() << " " << 4*triangles.size() << endl; forAll(triangles, tI) { const labelledTri& tri = surf[triangles[tI]]; file << 3 << " " << newPointLabel[tri[0]] << " " << newPointLabel[tri[1]] << " " << newPointLabel[tri[2]] << endl; } }