From 192d8ed6c6bdfc0717e55847e67030f9739bd781 Mon Sep 17 00:00:00 2001 From: Sylvain Thery Date: Thu, 2 May 2013 17:55:13 +0200 Subject: [PATCH] add volume generic exportMesh function --- include/Algo/Export/export.h | 3 + include/Algo/Export/exportVol.h | 21 +- include/Algo/Export/exportVol.hpp | 72 +++-- include/Algo/Import/import2tables.h | 13 +- include/Algo/Import/import2tablesVolume.hpp | 20 -- include/Algo/Import/importFileTypes.h | 132 +++++++++ include/Algo/Import/importMesh.hpp | 26 +- include/Algo/Import/importVBGZ.hpp | 294 ++++++++++++++++++++ 8 files changed, 481 insertions(+), 100 deletions(-) create mode 100644 include/Algo/Import/importFileTypes.h create mode 100644 include/Algo/Import/importVBGZ.hpp diff --git a/include/Algo/Export/export.h b/include/Algo/Export/export.h index b9b51bf01..3aeebfc87 100644 --- a/include/Algo/Export/export.h +++ b/include/Algo/Export/export.h @@ -26,6 +26,9 @@ #define __EXPORT_H__ #include "Topology/generic/attributeHandler.h" +#include "Algo/Import/importFileTypes.h" + + #include namespace CGoGN diff --git a/include/Algo/Export/exportVol.h b/include/Algo/Export/exportVol.h index 6d0a646d1..660cf3d10 100644 --- a/include/Algo/Export/exportVol.h +++ b/include/Algo/Export/exportVol.h @@ -39,12 +39,21 @@ namespace Volume namespace Export { +/** +* Export a mesh choosing the format according to filename extension +* @param the_map map to be exported +* @param position the position container +* @param filename filename of mesh file +* @return true + */ +template +bool exportMesh(typename PFP::MAP& map, const VertexAttribute& position, const std::string& filename) ; /** * export the map into a .nas (nastran file) * @param the_map map to be exported * @param position the position container -* @param filename filename of ply file +* @param filename filename of mesh file * @return true */ template @@ -55,7 +64,7 @@ bool exportNAS(typename PFP::MAP& map, const VertexAttribute * export the map into a vtu file (vtk unstructured grid) * @param the_map map to be exported * @param position the position container -* @param binary write in binary mode +* @param filename filename of mesh file * @return true */ template @@ -66,7 +75,7 @@ bool exportVTU(typename PFP::MAP& map, const VertexAttribute * export the map into a .msh (gmesh file) * @param the_map map to be exported * @param position the position container -* @param filename filename of ply file +* @param filename filename of mesh file * @return true */ template @@ -77,7 +86,7 @@ bool exportMSH(typename PFP::MAP& map, const VertexAttribute * export the map into a .tet file * @param the_map map to be exported * @param position the position container -* @param filename filename of ply file +* @param filename filename of mesh file * @return true */ template @@ -88,7 +97,7 @@ bool exportTet(typename PFP::MAP& map, const VertexAttribute * export the map into a .node/.ele file pair * @param the_map map to be exported * @param position the position container -* @param filename filename of ply file +* @param filename filename of mesh file * @return true */ template @@ -99,7 +108,7 @@ bool exportNodeEle(typename PFP::MAP& map, const VertexAttribute bool exportVolBinGz(typename PFP::MAP& map, const VertexAttribute& position, const char* filename); diff --git a/include/Algo/Export/exportVol.hpp b/include/Algo/Export/exportVol.hpp index c18ab68a6..313515675 100644 --- a/include/Algo/Export/exportVol.hpp +++ b/include/Algo/Export/exportVol.hpp @@ -27,6 +27,7 @@ #include "Topology/generic/traversorCell.h" #include "Topology/generic/traversor2.h" #include "Topology/generic/cellmarker.h" +#include "Algo/Import/importFileTypes.h" namespace CGoGN { @@ -535,6 +536,8 @@ bool exportNodeEle(typename PFP::MAP& map, const VertexAttribute(d); -// hexa.push_back(indices[f]); -// e = map.phi_1(f); -// hexa.push_back(indices[f]); -// e = map.phi_1(f); -// hexa.push_back(indices[f]); -// e = map.phi_1(f); -// hexa.push_back(indices[f]); -// hexa.push_back(indices[e]); -// e = map.phi1(e); -// hexa.push_back(indices[e]); -// e = map.phi1(e); -// hexa.push_back(indices[e]); -// e = map.phi1(e); -// hexa.push_back(indices[e]); -// } - if (degree == 4) { //CAS TETRAEDRIQUE @@ -718,23 +700,6 @@ bool exportVolBinGz(typename PFP::MAP& map, const VertexAttribute(d); -// hexa.push_back(indices[f]); -// f = map.phi_1(f); -// hexa.push_back(indices[f]); -// f = map.phi_1(f); -// hexa.push_back(indices[f]); -// f = map.phi_1(f); -// hexa.push_back(indices[f]); - } if (degree == 4) @@ -792,6 +757,37 @@ bool exportVolBinGz(typename PFP::MAP& map, const VertexAttribute +bool exportMesh(typename PFP::MAP& map, const VertexAttribute& position, const std::string& filename) +{ + Import::ImportType kind = Import::getFileType(filename); + +// manque TS, OFF ? + switch (kind) + { + case Import::TET: + return exportTet(map, position, filename.c_str()); + break; + case Import::NODE: + return exportNodeEle(map, position, filename.c_str()); + break; + case Import::MSH: + return exportMSH(map, position, filename.c_str()); + break; + case Import::VTU: + return exportVTU(map, position, filename.c_str()); + break; + case Import::NAS: + return exportNAS(map, position, filename.c_str()); + break; + case Import::VBGZ: + return exportVolBinGz(map, position, filename.c_str()); + break; + default: + CGoGNerr << "unknown file format for " << filename << CGoGNendl; + break; + } +} diff --git a/include/Algo/Import/import2tables.h b/include/Algo/Import/import2tables.h index b7de172db..331963864 100644 --- a/include/Algo/Import/import2tables.h +++ b/include/Algo/Import/import2tables.h @@ -35,6 +35,8 @@ #include "Utils/gzstream.h" +#include "Algo/Import/importFileTypes.h" + #ifdef WITH_ASSIMP #include "Assimp/assimp.h" #include "Assimp/aiPostProcess.h" @@ -53,15 +55,6 @@ namespace Surface namespace Import { - enum ImportType { UNKNOWNSURFACE, TRIAN, TRIANBGZ, MESHBIN, PLY, /*PLYPTM, */PLYSLFgeneric, PLYSLFgenericBin, OFF, OBJ, VRML, AHEM, STL, STLB }; - -// namespace ImportSurfacique -// { -// -// } - - - template class MeshTablesSurface { @@ -151,8 +144,6 @@ namespace Volume namespace Import { -enum ImportType { UNKNOWNVOLUME , TET, OFF, TS, MOKA, NODE, MSH, VTU, NAS, VBGZ}; - template class MeshTablesVolume { diff --git a/include/Algo/Import/import2tablesVolume.hpp b/include/Algo/Import/import2tablesVolume.hpp index 479e1585e..b8c93054c 100644 --- a/include/Algo/Import/import2tablesVolume.hpp +++ b/include/Algo/Import/import2tablesVolume.hpp @@ -34,26 +34,6 @@ namespace Volume namespace Import { -template -ImportType MeshTablesVolume::getFileType(const std::string& filename) -{ - if ((filename.rfind(".tet")!=std::string::npos) || (filename.rfind(".TET")!=std::string::npos)) - return TET; - - if ((filename.rfind(".node")!=std::string::npos) || (filename.rfind(".NODE")!=std::string::npos)) - return NODE; - - if ((filename.rfind(".off")!=std::string::npos) || (filename.rfind(".OFF")!=std::string::npos)) - return OFF; - - if ((filename.rfind(".ts")!=std::string::npos) || (filename.rfind(".TS")!=std::string::npos)) - return TS; - - if ((filename.rfind(".moka")!=std::string::npos) || (filename.rfind(".MOKA")!=std::string::npos)) - return MOKA; - - return UNKNOWNVOLUME; -} template bool MeshTablesVolume::importMesh(const std::string& filename, std::vector& attrNames, float scaleFactor) diff --git a/include/Algo/Import/importFileTypes.h b/include/Algo/Import/importFileTypes.h new file mode 100644 index 000000000..92507cab4 --- /dev/null +++ b/include/Algo/Import/importFileTypes.h @@ -0,0 +1,132 @@ +/******************************************************************************* +* CGoGN: Combinatorial and Geometric modeling with Generic N-dimensional Maps * +* version 0.1 * +* Copyright (C) 2009-2012, IGG Team, LSIIT, University of Strasbourg * +* * +* This library is free software; you can redistribute it and/or modify it * +* under the terms of the GNU Lesser General Public License as published by the * +* Free Software Foundation; either version 2.1 of the License, or (at your * +* option) any later version. * +* * +* This library is distributed in the hope that it will be useful, but WITHOUT * +* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * +* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License * +* for more details. * +* * +* You should have received a copy of the GNU Lesser General Public License * +* along with this library; if not, write to the Free Software Foundation, * +* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * +* * +* Web site: http://cgogn.unistra.fr/ * +* Contact information: cgogn@unistra.fr * +* * +*******************************************************************************/ + +#ifndef _IMPORT_FILE_TYPES_H +#define _IMPORT_FILE_TYPES_H + +namespace CGoGN +{ + +namespace Algo +{ + +namespace Surface +{ +namespace Import +{ + enum ImportType { UNKNOWNSURFACE, TRIAN, TRIANBGZ, MESHBIN, PLY, /*PLYPTM, */PLYSLFgeneric, PLYSLFgenericBin, OFF, OBJ, VRML, AHEM, STL, STLB }; + + inline ImportType getFileType(const std::string& filename) + { + if ((filename.rfind(".trianbgz")!=std::string::npos) || (filename.rfind(".TRIANBGZ")!=std::string::npos)) + return TRIANBGZ; + + if ((filename.rfind(".trian")!=std::string::npos) || (filename.rfind(".TRIAN")!=std::string::npos)) + return TRIAN; + + if ((filename.rfind(".meshbin")!=std::string::npos) || (filename.rfind(".MESHBIN")!=std::string::npos)) + return MESHBIN; + + /* if ((filename.rfind(".plyptm")!=std::string::npos) || (filename.rfind(".PLYGEN")!=std::string::npos)) + return PLYPTM; + */ + if ((filename.rfind(".plyPTMextBin")!=std::string::npos) || (filename.rfind(".plySHrealBin")!=std::string::npos)) + return PLYSLFgenericBin; + + if ((filename.rfind(".plyPTMext")!=std::string::npos) || (filename.rfind(".plySHreal")!=std::string::npos)) + return PLYSLFgeneric; + + if ((filename.rfind(".ply")!=std::string::npos) || (filename.rfind(".PLY")!=std::string::npos)) + return PLY; + + if ((filename.rfind(".off")!=std::string::npos) || (filename.rfind(".OFF")!=std::string::npos)) + return OFF; + + if ((filename.rfind(".obj")!=std::string::npos) || (filename.rfind(".OBJ")!=std::string::npos)) + return OBJ; + + if ((filename.rfind(".ahem")!=std::string::npos) || (filename.rfind(".AHEM")!=std::string::npos)) + return AHEM; + + if ((filename.rfind(".stlb")!=std::string::npos) || (filename.rfind(".STLB")!=std::string::npos)) + return STLB; + + if ((filename.rfind(".stl")!=std::string::npos) || (filename.rfind(".STL")!=std::string::npos)) + return STL; + + return UNKNOWNSURFACE; + } +} +} + + +namespace Volume +{ +namespace Import +{ + enum ImportType { UNKNOWNVOLUME , TET, OFF, TS, MOKA, NODE, MSH, VTU, NAS, VBGZ}; + + inline ImportType getFileType(const std::string& filename) + { + if ((filename.rfind(".tet")!=std::string::npos) || (filename.rfind(".TET")!=std::string::npos)) + return TET; + + if ((filename.rfind(".node")!=std::string::npos) || (filename.rfind(".NODE")!=std::string::npos)) + return NODE; + + if ((filename.rfind(".off")!=std::string::npos) || (filename.rfind(".OFF")!=std::string::npos)) + return OFF; + + if ((filename.rfind(".ts")!=std::string::npos) || (filename.rfind(".TS")!=std::string::npos)) + return TS; + + if ((filename.rfind(".moka")!=std::string::npos) || (filename.rfind(".MOKA")!=std::string::npos)) + return MOKA; + + if ((filename.rfind(".node")!=std::string::npos) || (filename.rfind(".NODE")!=std::string::npos)) + return NODE; + + if ((filename.rfind(".msh")!=std::string::npos) || (filename.rfind(".MSH")!=std::string::npos)) + return MSH; + + if ((filename.rfind(".vtu")!=std::string::npos) || (filename.rfind(".VTU")!=std::string::npos)) + return VTU; + + if ((filename.rfind(".nas")!=std::string::npos) || (filename.rfind(".NAS")!=std::string::npos)) + return NAS; + + if ((filename.rfind(".vbgz")!=std::string::npos) || (filename.rfind(".vbgz")!=std::string::npos)) + return VBGZ; + + return UNKNOWNVOLUME; + } + +} +} + + +} +} + +#endif diff --git a/include/Algo/Import/importMesh.hpp b/include/Algo/Import/importMesh.hpp index a8836bd5f..e5b334575 100644 --- a/include/Algo/Import/importMesh.hpp +++ b/include/Algo/Import/importMesh.hpp @@ -516,32 +516,8 @@ bool importMesh(typename PFP::MAP& map, MeshTablesVolume& mtv) template bool importMesh(typename PFP::MAP& map, const std::string& filename, std::vector& attrNames, bool /*mergeCloseVertices*/) { - ImportType kind = Volume::Import::UNKNOWNVOLUME; - - if ((filename.rfind(".tet") != std::string::npos) || (filename.rfind(".TET") != std::string::npos)) - kind = TET; - - if ((filename.rfind(".off") != std::string::npos) || (filename.rfind(".OFF") != std::string::npos)) - kind = OFF; - - if ((filename.rfind(".node") != std::string::npos) || (filename.rfind(".NODE") != std::string::npos)) - kind = NODE; - - if ((filename.rfind(".ts") != std::string::npos) || (filename.rfind(".TS") != std::string::npos)) - kind = TS; - - if ((filename.rfind(".msh") != std::string::npos) || (filename.rfind(".MSH") != std::string::npos)) - kind = MSH; - - if ((filename.rfind(".vtu") != std::string::npos) || (filename.rfind(".VTU") != std::string::npos)) - kind = VTU; - - if ((filename.rfind(".nas") != std::string::npos) || (filename.rfind(".NAS") != std::string::npos)) - kind = NAS; - - if ((filename.rfind(".volbgz") != std::string::npos) || (filename.rfind(".VOLBGZ") != std::string::npos)) - kind = VBGZ; + ImportType kind = getFileType(filename); switch (kind) { diff --git a/include/Algo/Import/importVBGZ.hpp b/include/Algo/Import/importVBGZ.hpp new file mode 100644 index 000000000..624ca7aa5 --- /dev/null +++ b/include/Algo/Import/importVBGZ.hpp @@ -0,0 +1,294 @@ +/******************************************************************************* +* CGoGN: Combinatorial and Geometric modeling with Generic N-dimensional Maps * +* version 0.1 * +* Copyright (C) 2009-2012, IGG Team, LSIIT, University of Strasbourg * +* * +* This library is free software; you can redistribute it and/or modify it * +* under the terms of the GNU Lesser General Public License as published by the * +* Free Software Foundation; either version 2.1 of the License, or (at your * +* option) any later version. * +* * +* This library is distributed in the hope that it will be useful, but WITHOUT * +* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * +* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License * +* for more details. * +* * +* You should have received a copy of the GNU Lesser General Public License * +* along with this library; if not, write to the Free Software Foundation, * +* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * +* * +* Web site: http://cgogn.unistra.fr/ * +* Contact information: cgogn@unistra.fr * +* * +*******************************************************************************/ + +#include "Algo/Modelisation/polyhedron.h" +#include "Geometry/orientation.h" +#include + +namespace CGoGN +{ + +namespace Algo +{ + +namespace Volume +{ + +namespace Import +{ + +template +bool importVBGZ(typename PFP::MAP& map, const std::string& filename, std::vector& attrNames, float scaleFactor) +{ + typedef typename PFP::VEC3 VEC3; + + VertexAttribute position = map.template addAttribute("position") ; + attrNames.push_back(position.name()) ; + + AttributeContainer& container = map.template getAttributeContainer() ; + + VertexAutoAttribute< NoMathIONameAttribute< std::vector > > vecDartsPerVertex(map, "incidents"); + + //open file + igzstream fs(filename.c_str(), std::ios::in|std::ios::binary); + if (!fs.good()) + { + CGoGNerr << "Unable to open file " << filename << CGoGNendl; + return false; + } + + + unsigned int numbers[3]; + + // read nb of points + fs.read(reinterpret_cast(numbers), 3*sizeof(unsigned int)); + + VEC3* bufposi; + bufposi = new VEC3[ numbers[0] ]; + fs.read(reinterpret_cast(bufposi), numbers[0]*sizeof(VEC3)); + + std::vector verticesID; + verticesID.reserve(numbers[0]); + + for(unsigned int i = 0; i < numbers[0];++i) + { + unsigned int id = container.insertLine(); + position[id] = bufposi[i]*scaleFactor; + verticesID.push_back(id); + } + delete bufposi; + + unsigned int* bufTetra=NULL; + if (numbers[1] != 0) + { + bufTetra = new unsigned int[ 4*numbers[1] ]; + fs.read(reinterpret_cast(bufTetra), 4*numbers[1]*sizeof(unsigned int)); + } + + unsigned int* bufHexa=NULL; + if (numbers[2] != 0) + { + bufHexa = new unsigned int[ 8*numbers[2] ]; + fs.read(reinterpret_cast(bufHexa), 8*numbers[2]*sizeof(unsigned int)); + } + CGoGNout << "nb vertices = " << numbers[0]; + + + DartMarkerNoUnmark m(map) ; + + if (numbers[1] > 0) + { + //Read and embed all tetrahedrons + for(unsigned int i = 0; i < numbers[1] ; ++i) + { + Geom::Vec4ui pt; + + pt[0] = bufTetra[4*i]; + pt[1] = bufTetra[4*i+1]; + pt[2] = bufTetra[4*i+2]; + pt[3] = bufTetra[4*i+3]; + + Dart d = Surface::Modelisation::createTetrahedron(map,false); + + // Embed three "base" vertices + for(unsigned int j = 0 ; j < 3 ; ++j) + { + FunctorSetEmb fsetemb(map, verticesID[pt[j]]); + map.template foreach_dart_of_orbit(d, fsetemb); + + //store darts per vertices to optimize reconstruction + Dart dd = d; + do + { + m.mark(dd) ; + vecDartsPerVertex[verticesID[pt[j]]].push_back(dd); + dd = map.phi1(map.phi2(dd)); + } while(dd != d); + + d = map.phi1(d); + } + + //Embed the last "top" vertex + d = map.template phi<211>(d); + //d = map.phi_1(map.phi2(d)); + + FunctorSetEmb fsetemb(map, verticesID[pt[3]]); + map.template foreach_dart_of_orbit(d, fsetemb); + + //store darts per vertex to optimize reconstruction + Dart dd = d; + do + { + m.mark(dd) ; + vecDartsPerVertex[verticesID[pt[3]]].push_back(dd); + dd = map.phi1(map.phi2(dd)); + } while(dd != d); + + //end of tetra + } + CGoGNout << " / nb tetra = " << numbers[1]; + delete[] bufTetra; + } + + if (numbers[2] > 0) + { + + //Read and embed all tetrahedrons + for(unsigned int i = 0; i < numbers[2] ; ++i) + { + // one hexa + Geom::Vec4ui pt; + pt[0] = bufHexa[8*i]; + pt[1] = bufHexa[8*i+1]; + pt[2] = bufHexa[8*i+2]; + pt[3] = bufHexa[8*i+3]; + pt[4] = bufHexa[8*i+4]; + pt[5] = bufHexa[8*i+5]; + pt[6] = bufHexa[8*i+6]; + pt[7] = bufHexa[8*i+7]; + + Dart d = Surface::Modelisation::createHexahedron(map,false); + + FunctorSetEmb fsetemb(map, verticesID[pt[0]]); + + map.template foreach_dart_of_orbit(d, fsetemb); + Dart dd = d; + vecDartsPerVertex[verticesID[pt[0]]].push_back(dd); m.mark(dd); dd = map.phi1(map.phi2(dd)); + vecDartsPerVertex[verticesID[pt[0]]].push_back(dd); m.mark(dd); dd = map.phi1(map.phi2(dd)); + vecDartsPerVertex[verticesID[pt[0]]].push_back(dd); m.mark(dd); + + d = map.phi1(d); + fsetemb.changeEmb(verticesID[pt[1]]); + map.template foreach_dart_of_orbit(d, fsetemb); + dd = d; + vecDartsPerVertex[verticesID[pt[1]]].push_back(dd); m.mark(dd); dd = map.phi1(map.phi2(dd)); + vecDartsPerVertex[verticesID[pt[1]]].push_back(dd); m.mark(dd); dd = map.phi1(map.phi2(dd)); + vecDartsPerVertex[verticesID[pt[1]]].push_back(dd); m.mark(dd); + + + d = map.phi1(d); + fsetemb.changeEmb(verticesID[pt[2]]); + map.template foreach_dart_of_orbit(d, fsetemb); + dd = d; + vecDartsPerVertex[verticesID[pt[2]]].push_back(dd); m.mark(dd); dd = map.phi1(map.phi2(dd)); + vecDartsPerVertex[verticesID[pt[2]]].push_back(dd); m.mark(dd); dd = map.phi1(map.phi2(dd)); + vecDartsPerVertex[verticesID[pt[2]]].push_back(dd); m.mark(dd); + + + d = map.phi1(d); + fsetemb.changeEmb(verticesID[pt[3]]); + map.template foreach_dart_of_orbit(d, fsetemb); + dd = d; + vecDartsPerVertex[verticesID[pt[3]]].push_back(dd); m.mark(dd); dd = map.phi1(map.phi2(dd)); + vecDartsPerVertex[verticesID[pt[3]]].push_back(dd); m.mark(dd); dd = map.phi1(map.phi2(dd)); + vecDartsPerVertex[verticesID[pt[3]]].push_back(dd); m.mark(dd); + + d = map.template phi<2112>(d); + fsetemb.changeEmb(verticesID[pt[4]]); + + map.template foreach_dart_of_orbit(d, fsetemb); + dd = d; + vecDartsPerVertex[verticesID[pt[4]]].push_back(dd); m.mark(dd); dd = map.phi1(map.phi2(dd)); + vecDartsPerVertex[verticesID[pt[4]]].push_back(dd); m.mark(dd); dd = map.phi1(map.phi2(dd)); + vecDartsPerVertex[verticesID[pt[4]]].push_back(dd); m.mark(dd); + + d = map.phi1(d); + fsetemb.changeEmb(verticesID[pt[5]]); + map.template foreach_dart_of_orbit(d, fsetemb); + dd = d; + vecDartsPerVertex[verticesID[pt[5]]].push_back(dd); m.mark(dd); dd = map.phi1(map.phi2(dd)); + vecDartsPerVertex[verticesID[pt[5]]].push_back(dd); m.mark(dd); dd = map.phi1(map.phi2(dd)); + vecDartsPerVertex[verticesID[pt[5]]].push_back(dd); m.mark(dd); + + d = map.phi1(d); + fsetemb.changeEmb(verticesID[pt[6]]); + map.template foreach_dart_of_orbit(d, fsetemb); + dd = d; + vecDartsPerVertex[verticesID[pt[6]]].push_back(dd); m.mark(dd); dd = map.phi1(map.phi2(dd)); + vecDartsPerVertex[verticesID[pt[6]]].push_back(dd); m.mark(dd); dd = map.phi1(map.phi2(dd)); + vecDartsPerVertex[verticesID[pt[6]]].push_back(dd); m.mark(dd); + + d = map.phi1(d); + fsetemb.changeEmb(verticesID[pt[7]]); + map.template foreach_dart_of_orbit(d, fsetemb); + dd = d; + vecDartsPerVertex[verticesID[pt[7]]].push_back(dd); m.mark(dd); dd = map.phi1(map.phi2(dd)); + vecDartsPerVertex[verticesID[pt[7]]].push_back(dd); m.mark(dd); dd = map.phi1(map.phi2(dd)); + vecDartsPerVertex[verticesID[pt[7]]].push_back(dd); m.mark(dd); + //end of hexa + } + CGoGNout << " / nb hexa = " << numbers[2]; + delete[] bufHexa; + } + + CGoGNout << CGoGNendl; + + //Association des phi3 + unsigned int nbBoundaryFaces = 0 ; + for (Dart d = map.begin(); d != map.end(); map.next(d)) + { + if (m.isMarked(d)) + { + std::vector& vec = vecDartsPerVertex[map.phi1(d)]; + + Dart good_dart = NIL; + for(typename std::vector::iterator it = vec.begin(); it != vec.end() && good_dart == NIL; ++it) + { + if(map.template getEmbedding(map.phi1(*it)) == map.template getEmbedding(d) && + map.template getEmbedding(map.phi_1(*it)) == map.template getEmbedding(map.template phi<11>(d))) + { + good_dart = *it ; + } + } + + if (good_dart != NIL) + { + map.sewVolumes(d, good_dart, false); + m.template unmarkOrbit(d); + } + else + { + m.unmarkOrbit(d); + ++nbBoundaryFaces; + } + } + } + + if (nbBoundaryFaces > 0) + { + map.closeMap(); + CGoGNout << "Map closed (" << nbBoundaryFaces << " boundary faces)" << CGoGNendl; + } + + fs.close(); + return true; +} + +} // namespace Import + +} + +} // namespace Algo + +} // namespace CGoGN -- GitLab