Commit 448152a5 authored by untereiner's avatar untereiner

end merging hexa import into MeshTableVolume : TODO -> optimize

parent db1e08e4
...@@ -161,19 +161,8 @@ void MyQT::cb_Open() ...@@ -161,19 +161,8 @@ void MyQT::cb_Open()
// myMap.closeMap(); // myMap.closeMap();
// } // }
// } // }
/* // else
if(extension == std::string(".msh")) // {
{
if(!Algo::Volume::Import::importMSH<PFP>(myMap,filename, attrNames))
{
std::cerr << "could not import " << filename << std::endl ;
return;
}
else
position = myMap.getAttribute<PFP::VEC3,VERTEX>(attrNames[0]);
}
else
{*/
if(!Algo::Volume::Import::importMesh<PFP>(myMap, filename, attrNames)) if(!Algo::Volume::Import::importMesh<PFP>(myMap, filename, attrNames))
{ {
std::cerr << "could not import " << filename << std::endl ; std::cerr << "could not import " << filename << std::endl ;
...@@ -416,28 +405,15 @@ int main(int argc, char **argv) ...@@ -416,28 +405,15 @@ int main(int argc, char **argv)
} }
else else
{ {
*/
if(extension == std::string(".nas")) if(!Algo::Volume::Import::importMesh<PFP>(myMap, filename, attrNames))
{
if(!Algo::Volume::Import::importNAS<PFP>(myMap,filename, attrNames))
{
std::cerr << "could not import " << filename << std::endl ;
return 1;
}
else
position = myMap.getAttribute<PFP::VEC3,VERTEX>(attrNames[0]);
}
else
{
*/
if(!Algo::Volume::Import::importMesh<PFP>(myMap, filename, attrNames))
{ {
std::cerr << "could not import " << filename << std::endl ; std::cerr << "could not import " << filename << std::endl ;
return 1; return 1;
} }
else else
position = myMap.getAttribute<PFP::VEC3,VERTEX>(attrNames[0]) ; position = myMap.getAttribute<PFP::VEC3,VERTEX>(attrNames[0]) ;
//} // }
color = myMap.addAttribute<PFP::VEC3, VOLUME>("color"); color = myMap.addAttribute<PFP::VEC3, VOLUME>("color");
......
...@@ -81,6 +81,7 @@ bool importChoupi(const std::string& filename, const std::vector<typename PFP::V ...@@ -81,6 +81,7 @@ bool importChoupi(const std::string& filename, const std::vector<typename PFP::V
namespace Volume namespace Volume
{ {
namespace Import namespace Import
{ {
...@@ -112,25 +113,6 @@ bool importMeshToExtrude(typename PFP::MAP& map, const std::string& filename, st ...@@ -112,25 +113,6 @@ bool importMeshToExtrude(typename PFP::MAP& map, const std::string& filename, st
template <typename PFP> template <typename PFP>
bool importMeshSAsV(typename PFP::MAP& map, const std::string& filename, std::vector<std::string>& attrNames); bool importMeshSAsV(typename PFP::MAP& map, const std::string& filename, std::vector<std::string>& attrNames);
/**
* TODO ADD TO MeshTablesVolume
*/
//template <typename PFP>
//bool importMSH(typename PFP::MAP& the_map, const std::string& filename, std::vector<std::string>& attrNames, float scaleFactor = 1.0f);
template <typename PFP>
bool importVTU(typename PFP::MAP& the_map, const std::string& filename, std::vector<std::string>& attrNames, float scaleFactor = 1.0f);
template <typename PFP>
bool importNAS(typename PFP::MAP& the_map, const std::string& filename, std::vector<std::string>& attrNames, float scaleFactor = 1.0f);
template <typename PFP>
bool importVBGZ(typename PFP::MAP& the_map, const std::string& filename, std::vector<std::string>& attrNames, float scaleFactor = 1.0f);
} // Import } // Import
} // Volume } // Volume
...@@ -144,13 +126,7 @@ bool importVBGZ(typename PFP::MAP& the_map, const std::string& filename, std::ve ...@@ -144,13 +126,7 @@ bool importVBGZ(typename PFP::MAP& the_map, const std::string& filename, std::ve
#include "Algo/Import/importChoupi.hpp" #include "Algo/Import/importChoupi.hpp"
//#include "Algo/Import/importMSH.hpp"
#include "Algo/Import/importVTU.hpp"
#include "Algo/Import/importNAS.hpp"
#include "Algo/Import/importVBGZ.hpp"
//#include "Algo/Import/importMoka.hpp" //#include "Algo/Import/importMoka.hpp"
//#include "Algo/Import/importObjTex.hpp" //#include "Algo/Import/importObjTex.hpp"
#endif #endif
...@@ -546,7 +546,7 @@ bool importMesh(typename PFP::MAP& map, MeshTablesVolume<PFP>& mtv) ...@@ -546,7 +546,7 @@ bool importMesh(typename PFP::MAP& map, MeshTablesVolume<PFP>& mtv)
//for each volume of table //for each volume of table
for(unsigned int i = 0 ; i < nbv ; ++i) for(unsigned int i = 0 ; i < nbv ; ++i)
{ {
// store volume in buffer, removing degenated faces // store volume in buffer, removing degenated faces
unsigned int nbf = mtv.getNbFacesVolume(i); unsigned int nbf = mtv.getNbFacesVolume(i);
...@@ -563,7 +563,7 @@ bool importMesh(typename PFP::MAP& map, MeshTablesVolume<PFP>& mtv) ...@@ -563,7 +563,7 @@ bool importMesh(typename PFP::MAP& map, MeshTablesVolume<PFP>& mtv)
} }
if(nbf == 4) //tetrahedral case if(nbf == 4) //tetrahedral case
{ {
Dart d = Surface::Modelisation::createTetrahedron<PFP>(map,false); Dart d = Surface::Modelisation::createTetrahedron<PFP>(map,false);
// Embed three "base" vertices // Embed three "base" vertices
...@@ -603,7 +603,7 @@ bool importMesh(typename PFP::MAP& map, MeshTablesVolume<PFP>& mtv) ...@@ -603,7 +603,7 @@ bool importMesh(typename PFP::MAP& map, MeshTablesVolume<PFP>& mtv)
} }
else if(nbf == 5) //pyramidal case else if(nbf == 5) //pyramidal case
{ {
Dart d = Surface::Modelisation::createQuadrangularPyramid<PFP>(map,false); Dart d = Surface::Modelisation::createQuadrangularPyramid<PFP>(map,false);
// 1. // 1.
...@@ -657,7 +657,7 @@ bool importMesh(typename PFP::MAP& map, MeshTablesVolume<PFP>& mtv) ...@@ -657,7 +657,7 @@ bool importMesh(typename PFP::MAP& map, MeshTablesVolume<PFP>& mtv)
vecDartsPerVertex[em].push_back(dd); m.mark(dd); vecDartsPerVertex[em].push_back(dd); m.mark(dd);
} }
else if(nbf == 6) //prism case else if(nbf == 6) //prism case
{ {
Dart d = Surface::Modelisation::createTriangularPrism<PFP>(map,false); Dart d = Surface::Modelisation::createTriangularPrism<PFP>(map,false);
// 1. // 1.
...@@ -721,7 +721,7 @@ bool importMesh(typename PFP::MAP& map, MeshTablesVolume<PFP>& mtv) ...@@ -721,7 +721,7 @@ bool importMesh(typename PFP::MAP& map, MeshTablesVolume<PFP>& mtv)
} }
else if(nbf == 8) //hexahedral case else if(nbf == 8) //hexahedral case
{ {
Dart d = Surface::Modelisation::createHexahedron<PFP>(map,false); Dart d = Surface::Modelisation::createHexahedron<PFP>(map,false);
// 1. // 1.
...@@ -806,7 +806,8 @@ bool importMesh(typename PFP::MAP& map, MeshTablesVolume<PFP>& mtv) ...@@ -806,7 +806,8 @@ bool importMesh(typename PFP::MAP& map, MeshTablesVolume<PFP>& mtv)
} //end of hexa } //end of hexa
} }
std::cout << " elements created " << std::endl; std::cout << " elements created " << std::endl;
//reconstruct neighbourhood //reconstruct neighbourhood
unsigned int nbBoundaryFaces = 0 ; unsigned int nbBoundaryFaces = 0 ;
for (Dart d = map.begin(); d != map.end(); map.next(d)) for (Dart d = map.begin(); d != map.end(); map.next(d))
......
...@@ -199,13 +199,13 @@ private: ...@@ -199,13 +199,13 @@ private:
bool importVBGZ(const std::string& filename, std::vector<std::string>& attrNames); bool importVBGZ(const std::string& filename, std::vector<std::string>& attrNames);
//TODO Moka / OVM not working
//bool importMoka(const std::string& filename, std::vector<std::string>& attrNames); //bool importMoka(const std::string& filename, std::vector<std::string>& attrNames);
//bool importOVM(const std::string& filename, std::vector<std::string>& attrNames); //bool importOVM(const std::string& filename, std::vector<std::string>& attrNames);
public: public:
//static ImportType getFileType(const std::string& filename);
inline unsigned getNbVertices() const { return m_nbVertices; } inline unsigned getNbVertices() const { return m_nbVertices; }
inline unsigned getNbVolumes() const { return m_nbVolumes; } inline unsigned getNbVolumes() const { return m_nbVolumes; }
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -56,8 +56,11 @@ public: ...@@ -56,8 +56,11 @@ public:
bool operator() (Dart d) bool operator() (Dart d)
{ {
std::cout << "dartIndex(d) = " << m_map.dartIndex(d) << std::endl;
m_map.decCurrentLevel() ; m_map.decCurrentLevel() ;
std::cout << "dartIndex(d) = " << m_map.dartIndex(d) << std::endl;
typename PFP::VEC3 p = m_position[d] ; typename PFP::VEC3 p = m_position[d] ;
std::cout << "p = " << p << std::endl;
m_map.incCurrentLevel() ; m_map.incCurrentLevel() ;
m_position[d] = p ; m_position[d] = p ;
......
...@@ -69,7 +69,6 @@ protected: ...@@ -69,7 +69,6 @@ protected:
public: public:
Map2MR(MAP& map) ; Map2MR(MAP& map) ;
/*************************************************** /***************************************************
* CELLS INFORMATION * * CELLS INFORMATION *
***************************************************/ ***************************************************/
...@@ -123,7 +122,7 @@ public: ...@@ -123,7 +122,7 @@ public:
bool faceIsSubdividedOnce(Dart d) ; bool faceIsSubdividedOnce(Dart d) ;
//protected: protected:
/** /**
* *
*/ */
...@@ -159,8 +158,6 @@ public: ...@@ -159,8 +158,6 @@ public:
*/ */
unsigned int subdivideFace(Dart d, bool triQuad = true, bool OneLevelDifference = true); unsigned int subdivideFace(Dart d, bool triQuad = true, bool OneLevelDifference = true);
unsigned int subdivideFace2(Dart d, bool triQuad = true, bool OneLevelDifference = true);
/** /**
* *
*/ */
......
...@@ -381,7 +381,8 @@ void Map2MR<PFP>::subdivideEdge(Dart d) ...@@ -381,7 +381,8 @@ void Map2MR<PFP>::subdivideEdge(Dart d)
m_map.incCurrentLevel() ; m_map.incCurrentLevel() ;
Dart nd = cutEdge(d) ; //Dart nd = cutEdge(d) ;
Dart nd = m_map.cutEdge(d);
(*edgeVertexFunctor)(nd) ; (*edgeVertexFunctor)(nd) ;
...@@ -403,6 +404,91 @@ void Map2MR<PFP>::coarsenEdge(Dart d) ...@@ -403,6 +404,91 @@ void Map2MR<PFP>::coarsenEdge(Dart d)
m_map.removeLevelBack() ; m_map.removeLevelBack() ;
} }
//template <typename PFP>
//unsigned int Map2MR<PFP>::subdivideFace(Dart d, bool triQuad, bool OneLevelDifference)
//{
// assert(m_map.getDartLevel(d) <= m_map.getCurrentLevel() || !"subdivideFace : called with a dart inserted after current level") ;
// assert(!faceIsSubdivided(d) || !"Trying to subdivide an already subdivided face") ;
// unsigned int fLevel = faceLevel(d) ;
// Dart old = faceOldestDart(d) ;
// m_map.pushLevel() ;
// m_map.setCurrentLevel(fLevel) ; // go to the level of the face to subdivide its edges
// if(m_map.getCurrentLevel() == m_map.getMaxLevel())
// m_map.addLevelBack();
// unsigned int degree = 0 ;
// Dart it = old ;
// do
// {
// ++degree ; // compute the degree of the face
// if(OneLevelDifference)
// {
// Dart nf = m_map.phi2(it) ;
// if(faceLevel(nf) == fLevel - 1) // check if neighboring faces have to be subdivided first
// subdivideFace(nf,triQuad) ;
// }
// if(!edgeIsSubdivided(it))
// subdivideEdge(it) ; // and cut the edges (if they are not already)
// it = m_map.phi1(it) ;
// } while(it != old) ;
// m_map.setCurrentLevel(fLevel + 1) ; // go to the next level to perform face subdivision
// if(triQuad && degree == 3) // if subdividing a triangle
// {
// Dart dd = m_map.phi1(old) ;
// Dart e = m_map.phi1(dd) ;
// (*vertexVertexFunctor)(e) ;
// e = m_map.phi1(e) ;
// splitFace(dd, e) ;
// dd = e ;
// e = m_map.phi1(dd) ;
// (*vertexVertexFunctor)(e) ;
// e = m_map.phi1(e) ;
// splitFace(dd, e) ;
// dd = e ;
// e = m_map.phi1(dd) ;
// (*vertexVertexFunctor)(e) ;
// e = m_map.phi1(e) ;
// splitFace(dd, e) ;
// }
// else // if subdividing a polygonal face
// {
// Dart dd = m_map.phi1(old) ;
// Dart next = m_map.phi1(dd) ;
// (*vertexVertexFunctor)(next) ;
// next = m_map.phi1(next) ;
// splitFace(dd, next) ; // insert a first edge
// Dart ne = m_map.phi2(m_map.phi_1(dd)) ;
// cutEdge(ne) ; // cut the new edge to insert the central vertex
// dd = m_map.phi1(next) ;
// (*vertexVertexFunctor)(dd) ;
// dd = m_map.phi1(dd) ;
// while(dd != ne) // turn around the face and insert new edges
// { // linked to the central vertex
// splitFace(m_map.phi1(ne), dd) ;
// dd = m_map.phi1(dd) ;
// (*vertexVertexFunctor)(dd) ;
// dd = m_map.phi1(dd) ;
// }
// (*faceVertexFunctor)(m_map.phi1(ne)) ;
// }
// m_map.popLevel() ;
// return fLevel ;
//}
template <typename PFP> template <typename PFP>
unsigned int Map2MR<PFP>::subdivideFace(Dart d, bool triQuad, bool OneLevelDifference) unsigned int Map2MR<PFP>::subdivideFace(Dart d, bool triQuad, bool OneLevelDifference)
{ {
...@@ -415,9 +501,6 @@ unsigned int Map2MR<PFP>::subdivideFace(Dart d, bool triQuad, bool OneLevelDiffe ...@@ -415,9 +501,6 @@ unsigned int Map2MR<PFP>::subdivideFace(Dart d, bool triQuad, bool OneLevelDiffe
m_map.pushLevel() ; m_map.pushLevel() ;
m_map.setCurrentLevel(fLevel) ; // go to the level of the face to subdivide its edges m_map.setCurrentLevel(fLevel) ; // go to the level of the face to subdivide its edges
if(m_map.getCurrentLevel() == m_map.getMaxLevel())
m_map.addLevelBack();
unsigned int degree = 0 ; unsigned int degree = 0 ;
Dart it = old ; Dart it = old ;
do do
...@@ -444,22 +527,26 @@ unsigned int Map2MR<PFP>::subdivideFace(Dart d, bool triQuad, bool OneLevelDiffe ...@@ -444,22 +527,26 @@ unsigned int Map2MR<PFP>::subdivideFace(Dart d, bool triQuad, bool OneLevelDiffe
Dart e = m_map.phi1(dd) ; Dart e = m_map.phi1(dd) ;
(*vertexVertexFunctor)(e) ; (*vertexVertexFunctor)(e) ;
e = m_map.phi1(e) ; e = m_map.phi1(e) ;
splitFace(dd, e) ; //splitFace(dd, e) ;
m_map.splitFace(dd, e) ;
dd = e ; dd = e ;
e = m_map.phi1(dd) ; e = m_map.phi1(dd) ;
(*vertexVertexFunctor)(e) ; (*vertexVertexFunctor)(e) ;
e = m_map.phi1(e) ; e = m_map.phi1(e) ;
splitFace(dd, e) ; //splitFace(dd, e) ;
m_map.splitFace(dd, e) ;
dd = e ; dd = e ;
e = m_map.phi1(dd) ; e = m_map.phi1(dd) ;
(*vertexVertexFunctor)(e) ; (*vertexVertexFunctor)(e) ;
e = m_map.phi1(e) ; e = m_map.phi1(e) ;
splitFace(dd, e) ; //splitFace(dd, e) ;
m_map.splitFace(dd, e) ;
} }
else // if subdividing a polygonal face else // if subdividing a polygonal face
{ {
std::cout << "wrong" << std::endl;
Dart dd = m_map.phi1(old) ; Dart dd = m_map.phi1(old) ;
Dart next = m_map.phi1(dd) ; Dart next = m_map.phi1(dd) ;
(*vertexVertexFunctor)(next) ; (*vertexVertexFunctor)(next) ;
...@@ -488,61 +575,6 @@ unsigned int Map2MR<PFP>::subdivideFace(Dart d, bool triQuad, bool OneLevelDiffe ...@@ -488,61 +575,6 @@ unsigned int Map2MR<PFP>::subdivideFace(Dart d, bool triQuad, bool OneLevelDiffe
return fLevel ; return fLevel ;
} }
template <typename PFP>
unsigned int Map2MR<PFP>::subdivideFace2(Dart d, bool triQuad, bool OneLevelDifference)
{
assert(m_map.getDartLevel(d) <= m_map.getCurrentLevel() || !"subdivideFace : called with a dart inserted after current level") ;
assert(!faceIsSubdivided(d) || !"Trying to subdivide an already subdivided face") ;
unsigned int fLevel = faceLevel(d) ;
Dart old = faceOldestDart(d) ;
m_map.pushLevel() ;
m_map.setCurrentLevel(fLevel) ; // go to the level of the face to subdivide its edges
if(m_map.getCurrentLevel() == m_map.getMaxLevel())
m_map.addLevelBack();
unsigned int degree = 0 ;
Dart it = old ;
do
{
++degree ; // compute the degree of the face
if(!edgeIsSubdivided(it))
subdivideEdge(it) ; // and cut the edges (if they are not already)
it = m_map.phi1(it) ;
} while(it != old) ;
m_map.setCurrentLevel(fLevel + 1) ; // go to the next level to perform face subdivision
// Dart dd = m_map.phi1(old) ;
// Dart next = m_map.phi1(dd) ;
// (*vertexVertexFunctor)(next) ;
// next = m_map.phi1(next) ;
// splitFace(dd, next) ; // insert a first edge
// Dart ne = m_map.phi2(m_map.phi_1(dd)) ;
// cutEdge(ne) ; // cut the new edge to insert the central vertex
// dd = m_map.phi1(next) ;
// (*vertexVertexFunctor)(dd) ;
// dd = m_map.phi1(dd) ;
// while(dd != ne) // turn around the face and insert new edges
// { // linked to the central vertex
// splitFace(m_map.phi1(ne), dd) ;
// dd = m_map.phi1(dd) ;
// (*vertexVertexFunctor)(dd) ;
// dd = m_map.phi1(dd) ;
// }
// (*faceVertexFunctor)(m_map.phi1(ne)) ;
m_map.popLevel() ;
return fLevel ;
}
template <typename PFP> template <typename PFP>
void Map2MR<PFP>::coarsenFace(Dart d) void Map2MR<PFP>::coarsenFace(Dart d)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment