Commit 244d50f3 authored by untereiner's avatar untereiner

relaxation + new id management IHM2 ok

parent 42e2ef2b
......@@ -72,6 +72,8 @@ void subdivideFace(typename PFP::MAP& map, Dart d, VertexAttribute<typename PFP:
unsigned int cur = map.getCurrentLevel() ;
map.setCurrentLevel(fLevel) ; // go to the level of the face to subdivide its edges
std::cout << "subdiv" << std::endl;
unsigned int degree = 0 ;
typename PFP::VEC3 p ;
Dart it = old ;
......@@ -111,7 +113,8 @@ void subdivideFace(typename PFP::MAP& map, Dart d, VertexAttribute<typename PFP:
//map.setEdgeId(map.phi_1(e), id) ;
Dart dit = map.phi2(map.phi_1(dd));
Dart stop = map.phi2(map.phi1(old));
Dart dit = stop;
do
{
unsigned int dId = map.getEdgeId(map.phi_1(map.phi2(dit)));
......@@ -119,21 +122,38 @@ void subdivideFace(typename PFP::MAP& map, Dart d, VertexAttribute<typename PFP:
unsigned int t = dId + eId;
if(t == 1)
if(t == 0)
{
map.setEdgeId(dit, 1);
map.setEdgeId(map.phi2(dit), 1);
}
else if(t == 1)
{
map.setEdgeId(dit, 2);
map.setEdgeId(map.phi2(dit), 2);
}
else if(t == 2)
{
if(dId == eId)
{
std::cout << "plop" << std::endl;
map.setEdgeId(dit, 0);
map.setEdgeId(map.phi2(dit), 0);
}
else
{
map.setEdgeId(dit, 1);
map.setEdgeId(map.phi2(dit), 1);
}
}
else if(t == 3)
{
map.setEdgeId(dit, 0);
map.setEdgeId(map.phi2(dit), 0);
}
dit = map.phi1(dit);
}while(dit != map.phi2(map.phi_1(dd)));
}while(dit != stop);
}
else // if subdividing a polygonal face
......@@ -170,10 +190,15 @@ void subdivideFace(typename PFP::MAP& map, Dart d, VertexAttribute<typename PFP:
{
unsigned int eId = map.getEdgeId(map.phi1(dit));
if(eId == 0)
{
map.setEdgeId(dit, 1);
map.setEdgeId(map.phi2(dit), 1);
}
else if(eId == 1)
{
map.setEdgeId(dit, 0);
map.setEdgeId(map.phi2(dit), 0);
}
dit = map.phi2(map.phi_1(dit));
}
while(dit != map.phi2(ne));
......
......@@ -873,7 +873,7 @@ void relaxation(typename PFP::MAP& map, VertexAttribute<typename PFP::VEC3>& pos
nlSolverParameteri(NL_LEAST_SQUARES, NL_TRUE);
nlSolverParameteri(NL_SOLVER, NL_CHOLMOD_EXT);
nlMakeCurrent(nlContext);
// nlMakeCurrent(nlContext);
if(nlGetCurrentState() == NL_STATE_INITIAL)
nlBegin(NL_SYSTEM) ;
......@@ -894,14 +894,14 @@ void relaxation(typename PFP::MAP& map, VertexAttribute<typename PFP::VEC3>& pos
nlBegin(NL_MATRIX) ;
nlEnable(NL_NORMALIZE_ROWS) ;
TraversorV<typename PFP::MAP> tv2(map);
for(Dart dit = tv2.begin() ; dit != tv2.end() ; dit = tv2.next())
{
if(!map.isBoundaryVertex(dit))
{
//nlEnable(NL_NORMALIZE_ROWS) ;
nlRowParameterd(NL_RIGHT_HAND_SIDE, indexV[dit]) ; //b[i]
nlRowParameterd(NL_RIGHT_HAND_SIDE, 0) ; //b[i]
//nlRowParameterd(NL_ROW_SCALING, weight) ;
nlBegin(NL_ROW) ;
......@@ -910,16 +910,17 @@ void relaxation(typename PFP::MAP& map, VertexAttribute<typename PFP::VEC3>& pos
Traversor3VVaE<typename PFP::MAP> tvvae(map, dit);
for(Dart ditvvae = tvvae.begin() ; ditvvae != tvvae.end() ; ditvvae = tvvae.next())
{
nlCoefficient(indexV[ditvvae],weight);
nlCoefficient(indexV[ditvvae], weight);
sum += weight;
}
nlCoefficient(indexV[dit], -sum) ;
nlEnd(NL_ROW) ;
//nlDisable(NL_NORMALIZE_ROWS) ;
}
}
nlDisable(NL_NORMALIZE_ROWS) ;
nlEnd(NL_MATRIX) ;
nlEnd(NL_SYSTEM) ;
......@@ -935,7 +936,7 @@ void relaxation(typename PFP::MAP& map, VertexAttribute<typename PFP::VEC3>& pos
position[dit][coord] = nlGetVariable(indexV[dit]);
}
nlReset(NL_FALSE) ;
nlReset(NL_TRUE) ;
std::cout << "... done" << std::endl;
}
......
......@@ -168,20 +168,21 @@ unsigned int ImplicitHierarchicalMap::faceLevel(Dart d)
unsigned int cur = m_curLevel ;
m_curLevel = fLevel ;
unsigned int nbSubd = 0 ;
it = old ;
unsigned int eId = m_edgeId[old] ; // the particular case of a face
do // with all neighboring faces regularly subdivided
{ // but not the face itself
++nbSubd ; // is treated here
it = phi1(it) ;
} while(m_edgeId[it] == eId) ;
while(nbSubd > 1)
{
nbSubd /= 2 ;
--fLevel ;
}
// unsigned int nbSubd = 0 ;
// it = old ;
// unsigned int eId = m_edgeId[old] ; // the particular case of a face
// do // with all neighboring faces regularly subdivided
// { // but not the face itself
// ++nbSubd ; // is treated here
// std::cout << "plop" << std::endl;
// it = phi1(it) ;
// } while(m_edgeId[it] == eId) ;
// while(nbSubd > 1)
// {
// nbSubd /= 2 ;
// --fLevel ;
// }
m_curLevel = cur ;
......
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