Commit cef35811 authored by untereiner's avatar untereiner

polyhedron are working with new embeddings management

parent 4f172449
......@@ -61,12 +61,48 @@ Dart createPyramid(typename PFP::MAP& map, unsigned int n)
map.sewFaces(map.phi1(m_tableVertDarts[0]), map.phi_1(m_tableVertDarts[n-1]), false);
//sewing the bottom face
Dart d1 = map.newFace(n, false);
dres = d1;
Dart base = map.newFace(n, false);
dres = base;
for(unsigned int i = 0; i < n ; ++i)
{
map.sewFaces(m_tableVertDarts[i], d1, false);
d1 = map.phi1(d1);
map.sewFaces(m_tableVertDarts[i], base, false);
base = map.phi1(base);
}
if(map.dimension() == 3)
map.closeMap();
if(map.template isOrbitEmbedded<VERTEX>())
{
for(unsigned int i = 0; i < n; ++i)
{
map.template initOrbitEmbeddingNewCell<VERTEX>(m_tableVertDarts[i]);
}
map.template initOrbitEmbeddingNewCell<VERTEX>(map.phi_1(m_tableVertDarts[0]));
}
if(map.template isOrbitEmbedded<EDGE>())
{
for(unsigned int i = 0; i < n; ++i)
{
map.template initOrbitEmbeddingNewCell<EDGE>(m_tableVertDarts[i]);
map.template initOrbitEmbeddingNewCell<EDGE>(map.phi1(m_tableVertDarts[i]));
}
}
if(map.template isOrbitEmbedded<FACE>())
{
for(unsigned int i = 0; i < n; ++i)
{
map.template initOrbitEmbeddingNewCell<FACE>(m_tableVertDarts[i]);
}
map.template initOrbitEmbeddingNewCell<FACE>(dres);
}
if(map.template isOrbitEmbedded<VOLUME>())
{
map.template initOrbitEmbeddingNewCell<VOLUME>(dres);
}
//return a dart from the base
......@@ -110,17 +146,55 @@ Dart createPrism(typename PFP::MAP& map, unsigned int n)
map.sewFaces(map.phi1(m_tableVertDarts[0]), map.phi_1(m_tableVertDarts[n-1]), false);
//sewing the top & bottom faces
Dart d1 = map.newFace(n, false);
Dart d2 = map.newFace(n, false);
dres = d1;
Dart top = map.newFace(n, false);
Dart bottom = map.newFace(n, false);
dres = top;
for(unsigned int i = 0; i < n ; ++i)
{
map.sewFaces(m_tableVertDarts[i], d1, false);
map.sewFaces(m_tableVertDarts[n+i], d2, false);
d1 = map.phi1(d1);
d2 = map.phi_1(d2);
map.sewFaces(m_tableVertDarts[i], top, false);
map.sewFaces(m_tableVertDarts[n+i], bottom, false);
top = map.phi1(top);
bottom = map.phi_1(bottom);
}
if(map.dimension() == 3)
map.closeMap();
if(map.template isOrbitEmbedded<VERTEX>())
{
for(unsigned int i = 0; i < nb; ++i)
{
map.template initOrbitEmbeddingNewCell<VERTEX>(m_tableVertDarts[i]);
}
}
if(map.template isOrbitEmbedded<EDGE>())
{
for(unsigned int i = 0; i < n; ++i)
{
map.template initOrbitEmbeddingNewCell<FACE>(m_tableVertDarts[i]);
map.template initOrbitEmbeddingNewCell<FACE>(map.phi1(m_tableVertDarts[i]));
map.template initOrbitEmbeddingNewCell<FACE>(map.phi1(map.phi1(m_tableVertDarts[i])));
}
}
if(map.template isOrbitEmbedded<FACE>())
{
for(unsigned int i = 0; i < n; ++i)
{
map.template initOrbitEmbeddingNewCell<FACE>(m_tableVertDarts[i]);
}
map.template initOrbitEmbeddingNewCell<FACE>(top);
map.template initOrbitEmbeddingNewCell<FACE>(bottom);
}
if(map.template isOrbitEmbedded<VOLUME>())
{
map.template initOrbitEmbeddingNewCell<VOLUME>(dres);
}
//return a dart from the base
return dres;
}
......
......@@ -193,6 +193,7 @@ public:
}while(dit != db);
//TODO Replace do--while with a Traversor2 on Boundary
// Traversor2VF<typename PFP::MAP> travVF(m_map,db);
// for(Dart dit = travVF.begin(); dit != travVF.end() ; dit = travVF.next())
// {
......@@ -273,9 +274,6 @@ public:
if(m_map.isBoundaryEdge(d))
{
Dart db = m_map.findBoundaryFaceOfEdge(d);
unsigned int count = 0;
typename PFP::VEC3 fe(0.0);
m_map.incCurrentLevel() ;
......@@ -285,6 +283,8 @@ public:
fe += m_position[midV];
m_map.decCurrentLevel() ;
//TODO Replace do--while with a Traversor2 on Boundary
// unsigned int count = 0;
// Traversor2EF<typename PFP::MAP> travEF(m_map, db);
// for(Dart dit = travEF.begin() ; dit != travEF.end() ; dit = travEF.next())
// {
......@@ -568,9 +568,6 @@ public:
if(m_map.isBoundaryEdge(d))
{
Dart db = m_map.findBoundaryFaceOfEdge(d);
unsigned int count = 0;
typename PFP::VEC3 fe(0.0);
m_map.incCurrentLevel() ;
......@@ -580,6 +577,8 @@ public:
fe += m_position[midV];
m_map.decCurrentLevel() ;
//TODO Replace do--while with a Traversor2 on Boundary
// unsigned int count = 0;
// Traversor2EF<typename PFP::MAP> travEF(m_map, db);
// for(Dart dit = travEF.begin() ; dit != travEF.end() ; dit = travEF.next())
// {
......
......@@ -87,21 +87,15 @@ public:
*
*************************************************************************/
//@{
//!
/*
*
*/
void addNewLevelSqrt3(bool embedNewVertices);
//!
/*
*/
void addNewLevelTetraOcta(bool embedNewVertices);
void addNewLevelTetraOcta();
//!
/*
*/
void addNewLevelHexa(bool embedNewVertices);
void addNewLevelHexa();
//!
/*
......
......@@ -125,7 +125,7 @@ void Map3MR<PFP>::splitSurfaceInVolume(std::vector<Dart>& vd, bool firstSideClos
* Level creation *
************************************************************************/
template <typename PFP>
void Map3MR<PFP>::addNewLevelSqrt3(bool embedNewVertices)
void Map3MR<PFP>::addNewLevelTetraOcta()
{
m_map.pushLevel();
......@@ -133,96 +133,6 @@ void Map3MR<PFP>::addNewLevelSqrt3(bool embedNewVertices)
m_map.duplicateDarts(m_map.getMaxLevel());
m_map.setCurrentLevel(m_map.getMaxLevel());
DartMarkerStore m(m_map);
//
// 1-4 flip of all tetrahedra
//
TraversorW<typename PFP::MAP> tW(m_map);
for(Dart dit = tW.begin() ; dit != tW.end() ; dit = tW.next())
{
Traversor3WF<typename PFP::MAP> tWF(m_map, dit);
for(Dart ditWF = tWF.begin() ; ditWF != tWF.end() ; ditWF = tWF.next())
{
if(!m_map.isBoundaryFace(ditWF))
m.markOrbit<FACE>(ditWF);
}
Algo::Modelisation::Tetrahedralization::flip1To4<PFP>(m_map, dit);
}
/*
//
// 2-3 swap of all old interior faces
//
TraversorF<typename PFP::MAP> tF(m_map);
for(Dart dit = tF.begin() ; dit != tF.end() ; dit = tF.next())
{
if(m.isMarked(dit))
{
m.unmarkOrbit<FACE>(dit);
Algo::Modelisation::Tetrahedralization::swap2To3<PFP>(m_map, dit);
}
}
//
// 1-3 flip of all boundary tetrahedra
//
TraversorW<typename PFP::MAP> tWb(m_map);
for(Dart dit = tWb.begin() ; dit != tWb.end() ; dit = tWb.next())
{
if(m_map.isBoundaryVolume(dit))
{
Traversor3WE<typename PFP::MAP> tWE(m_map, dit);
for(Dart ditWE = tWE.begin() ; ditWE != tWE.end() ; ditWE = tWE.next())
{
if(m_map.isBoundaryEdge(ditWE))
m.markOrbit<EDGE>(ditWE);
}
Algo::Modelisation::Tetrahedralization::flip1To3<PFP>(m_map, dit);
}
}
//
// edge-removal on all old boundary edges
//
TraversorE<typename PFP::MAP> tE(m_map);
for(Dart dit = tE.begin() ; dit != tE.end() ; dit = tE.next())
{
if(m.isMarked(dit))
{
m.unmarkOrbit<EDGE>(dit);
Dart d = m_map.phi2(m_map.phi3(m_map.findBoundaryFaceOfEdge(dit)));
Algo::Modelisation::Tetrahedralization::swapGen3To2<PFP>(m_map, d);
}
}
*/
m_map.setCurrentLevel(m_map.getMaxLevel());
m_map.popLevel() ;
}
template <typename PFP>
void Map3MR<PFP>::addNewLevelTetraOcta(bool embedNewVertices)
{
m_map.pushLevel();
m_map.addLevelBack();
m_map.duplicateDarts(m_map.getMaxLevel());
m_map.setCurrentLevel(m_map.getMaxLevel());
// if(!shareVertexEmbeddings)
// {
// //create the new level with the old one
// for(unsigned int i = m_mrattribs.begin(); i != m_mrattribs.end(); m_mrattribs.next(i))
// {
// unsigned int index = (*m_mrDarts[m_mrCurrentLevel])[i] ;
// (*m_embeddings[VERTEX])[index] = EMBNULL ; // set vertex embedding to EMBNULL if no sharing
// }
// }
//subdivision
//1. cut edges
TraversorE<typename PFP::MAP> travE(m_map);
......@@ -239,10 +149,6 @@ void Map3MR<PFP>::addNewLevelTetraOcta(bool embedNewVertices)
m_map.cutEdge(d) ;
travE.skip(d) ;
travE.skip(m_map.phi1(d)) ;
// When importing MR files
// if(embedNewVertices)
// m_map.template setOrbitEmbeddingOnNewCell<VERTEX>(m_map.phi1(d)) ;
}
//2. split faces - triangular faces
......@@ -357,10 +263,6 @@ void Map3MR<PFP>::addNewLevelTetraOcta(bool embedNewVertices)
f = m_map.phi2(m_map.phi_1(f));
}while(f != x);
// When importing MR files
//if(embedNewVertices)
// m_map.template setOrbitEmbeddingOnNewCell<VERTEX>(x) ;
}
m_map.setCurrentLevel(m_map.getMaxLevel() - 1) ;
}
......@@ -370,7 +272,7 @@ void Map3MR<PFP>::addNewLevelTetraOcta(bool embedNewVertices)
}
template <typename PFP>
void Map3MR<PFP>::addNewLevelHexa(bool embedNewVertices)
void Map3MR<PFP>::addNewLevelHexa()
{
m_map.pushLevel();
......@@ -382,23 +284,18 @@ void Map3MR<PFP>::addNewLevelHexa(bool embedNewVertices)
TraversorE<typename PFP::MAP> travE(m_map);
for (Dart d = travE.begin(); d != travE.end(); d = travE.next())
{
if(!shareVertexEmbeddings && embedNewVertices)
{
if(m_map.template getEmbedding<VERTEX>(d) == EMBNULL)
m_map.template embedNewCell<VERTEX>(d) ;
if(m_map.template getEmbedding<VERTEX>(m_map.phi1(d)) == EMBNULL)
m_map.template embedNewCell<VERTEX>(d) ;
}
// if(!shareVertexEmbeddings && embedNewVertices)
// {
// if(m_map.template getEmbedding<VERTEX>(d) == EMBNULL)
// m_map.template embedNewCell<VERTEX>(d) ;
// if(m_map.template getEmbedding<VERTEX>(m_map.phi1(d)) == EMBNULL)
// m_map.template embedNewCell<VERTEX>(d) ;
// }
m_map.cutEdge(d) ;
travE.skip(d) ;
travE.skip(m_map.phi1(d)) ;
if(embedNewVertices)
m_map.template embedNewCell<VERTEX>(m_map.phi1(d)) ;
}
std::cout << "current Level = " << m_map.getCurrentLevel() << std::endl;
//2. split faces - quadrangule faces
TraversorF<typename PFP::MAP> travF(m_map) ;
......@@ -416,9 +313,6 @@ void Map3MR<PFP>::addNewLevelHexa(bool embedNewVertices)
m_map.cutEdge(ne) ; // cut the new edge to insert the central vertex
travF.skip(dd) ;
if(embedNewVertices)
m_map.template embedNewCell<VERTEX>(m_map.phi1(ne)) ;
dd = m_map.phi1(m_map.phi1(next)) ;
while(dd != ne) // turn around the face and insert new edges
{ // linked to the central vertex
......
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