Création d'un compte pour un collaborateur extérieur au laboratoire depuis l'intranet ICube : https://intranet.icube.unistra.fr/fr/labs/member/profile

Commit 742d8e66 authored by Pierre Kraemer's avatar Pierre Kraemer
Browse files

operator const dans les Dart + micro optim oldest dart IHM

parent ce36e5a4
...@@ -54,19 +54,19 @@ struct Dart ...@@ -54,19 +54,19 @@ struct Dart
* equality operator * equality operator
* @param d the dart to compare with * @param d the dart to compare with
*/ */
bool operator==(Dart d) { return d.index == index; } bool operator==(Dart d) const { return d.index == index; }
/** /**
* different operator * different operator
* @param d the dart to compare with * @param d the dart to compare with
*/ */
bool operator!=(Dart d) { return d.index != index; } bool operator!=(Dart d) const { return d.index != index; }
/** /**
* less operator, can be used for sorting * less operator, can be used for sorting
* @param d the dart to compare with * @param d the dart to compare with
*/ */
bool operator<(Dart d) { return d.index < index; } bool operator<(Dart d) const { return index < d.index; }
friend std::ostream& operator<<( std::ostream &out, const Dart& fa ) { return out << fa.index; } friend std::ostream& operator<<( std::ostream &out, const Dart& fa ) { return out << fa.index; }
friend std::istream& operator>>( std::istream &in, Dart& fa ) { in >> fa.index; return in; } friend std::istream& operator>>( std::istream &in, Dart& fa ) { in >> fa.index; return in; }
......
...@@ -81,6 +81,7 @@ void ImplicitHierarchicalMap::initEdgeId() ...@@ -81,6 +81,7 @@ void ImplicitHierarchicalMap::initEdgeId()
unsigned int ImplicitHierarchicalMap::faceLevel(Dart d) unsigned int ImplicitHierarchicalMap::faceLevel(Dart d)
{ {
assert(m_dartLevel[d] <= m_curLevel || !"Access to a dart introduced after current level") ; assert(m_dartLevel[d] <= m_curLevel || !"Access to a dart introduced after current level") ;
if(m_curLevel == 0) if(m_curLevel == 0)
return 0 ; return 0 ;
...@@ -126,14 +127,19 @@ unsigned int ImplicitHierarchicalMap::faceLevel(Dart d) ...@@ -126,14 +127,19 @@ unsigned int ImplicitHierarchicalMap::faceLevel(Dart d)
Dart it = d ; Dart it = d ;
Dart old = it ; Dart old = it ;
unsigned int l_old = m_dartLevel[old] ;
unsigned int fLevel = edgeLevel(it) ; unsigned int fLevel = edgeLevel(it) ;
do do
{ {
it = phi1(it) ; it = phi1(it) ;
if(m_dartLevel[it] < m_dartLevel[old]) // in a first time, the level of a face unsigned int dl = m_dartLevel[it] ;
old = it ; // is the minimum of the levels if(dl < l_old) // compute the oldest dart of the face
unsigned int l = edgeLevel(it) ; // of its edges { // in the same time
fLevel = l < fLevel ? l : fLevel ; old = it ;
l_old = dl ;
} // in a first time, the level of a face
unsigned int l = edgeLevel(it) ; // is the minimum of the levels
fLevel = l < fLevel ? l : fLevel ; // of its edges
} while(it != d) ; } while(it != d) ;
unsigned int cur = m_curLevel ; unsigned int cur = m_curLevel ;
...@@ -180,11 +186,16 @@ Dart ImplicitHierarchicalMap::faceOldestDart(Dart d) ...@@ -180,11 +186,16 @@ Dart ImplicitHierarchicalMap::faceOldestDart(Dart d)
assert(m_dartLevel[d] <= m_curLevel || !"Access to a dart introduced after current level") ; assert(m_dartLevel[d] <= m_curLevel || !"Access to a dart introduced after current level") ;
Dart it = d ; Dart it = d ;
Dart oldest = it ; Dart oldest = it ;
unsigned int l_old = m_dartLevel[oldest] ;
do do
{ {
it = phi1(it) ; unsigned int l = m_dartLevel[it] ;
if(m_dartLevel[it] < m_dartLevel[oldest]) if(l < l_old || (l == l_old && it < oldest))
{
oldest = it ; oldest = it ;
l_old = l ;
}
it = phi1(it) ;
} while(it != d) ; } while(it != d) ;
return oldest ; return oldest ;
} }
......
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