Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Thomas Pitiot
CGoGN
Commits
9e2ce59c
Commit
9e2ce59c
authored
Dec 15, 2011
by
untereiner
Browse files
change subdiv algo for no_boundary
parent
7f08b177
Changes
10
Hide whitespace changes
Inline
Side-by-side
include/Algo/ImplicitHierarchicalMesh/ihm3.h
View file @
9e2ce59c
...
...
@@ -36,11 +36,11 @@ namespace Algo
namespace
IHM
{
//
template<typename T> class AttributeHandler_IHM ;
template
<
typename
T
>
class
AttributeHandler_IHM
;
class
ImplicitHierarchicalMap3
:
public
EmbeddedMap3
{
//
template<typename T> friend class AttributeHandler_IHM ;
template
<
typename
T
>
friend
class
AttributeHandler_IHM
;
public:
unsigned
int
m_curLevel
;
...
...
@@ -59,23 +59,37 @@ public:
~
ImplicitHierarchicalMap3
()
;
//!
/*!
*
*/
void
init
()
;
/***************************************************
* ATTRIBUTES MANAGEMENT *
***************************************************/
//template <typename T>
//AttributeHandler_IHM<T> addAttribute(unsigned int orbit, const std::string& nameAttr) ;
/*! @name Attributes Management
* To handles Attributes for each level of an implicit 3-map
*************************************************************************/
//template <typename T>
//AttributeHandler_IHM<T> getAttribute(unsigned int orbit, const std::string& nameAttr) ;
//@{
//!
/*!
*
*/
template
<
typename
T
>
AttributeHandler_IHM
<
T
>
addAttribute
(
unsigned
int
orbit
,
const
std
::
string
&
nameAttr
)
;
//!
/*!
*
*/
template
<
typename
T
>
AttributeHandler_IHM
<
T
>
getAttribute
(
unsigned
int
orbit
,
const
std
::
string
&
nameAttr
)
;
//@}
/*
**************************************************
*
MAP TRAVERSAL *
***************************************************/
/*
! @name Basic Topological Operators
*
Redefinition of the basic topological operators
***************************************************
**********************
/
//@{
virtual
Dart
newDart
()
;
Dart
phi1
(
Dart
d
)
;
...
...
@@ -97,214 +111,278 @@ public:
Dart
alpha2
(
Dart
d
);
Dart
alpha_2
(
Dart
d
);
//@}
virtual
Dart
begin
()
;
virtual
Dart
end
()
;
virtual
void
next
(
Dart
&
d
)
;
virtual
bool
foreach_dart_of_vertex
(
Dart
d
,
FunctorType
&
f
,
unsigned
int
thread
=
0
)
;
virtual
bool
foreach_dart_of_edge
(
Dart
d
,
FunctorType
&
f
,
unsigned
int
thread
=
0
)
;
bool
foreach_dart_of_oriented_face
(
Dart
d
,
FunctorType
&
f
,
unsigned
int
thread
=
0
);
virtual
bool
foreach_dart_of_face
(
Dart
d
,
FunctorType
&
f
,
unsigned
int
thread
=
0
)
;
bool
foreach_dart_of_oriented_volume
(
Dart
d
,
FunctorType
&
f
,
unsigned
int
thread
=
0
);
virtual
bool
foreach_dart_of_volume
(
Dart
d
,
FunctorType
&
f
,
unsigned
int
thread
=
0
)
;
virtual
bool
foreach_dart_of_cc
(
Dart
d
,
FunctorType
&
f
,
unsigned
int
thread
=
0
)
;
/***************************************************
* LEVELS MANAGEMENT *
***************************************************/
// /*! @name Topological Operators with Cells id management
// * Topological operations on Hierarchical Implicit 3-maps
// *************************************************************************/
//
// //@{
// //!
// /*!
// *
// */
// virtual Dart cutEdge(Dart d);
//
// //!
// /*!
// *
// */
// virtual bool uncutEdge(Dart d);
//
// //!
// /*!
// *
// */
// virtual void splitFace(Dart d, Dart e);
//
// //!
// /*!
// *
// */
// virtual void sewVolumes(Dart d, Dart e, bool withBoundary = true);
//
// //!
// /*!
// *
// */
// virtual void splitVolume(std::vector<Dart>& vd);
// //@}
/*! @name Levels Management
* Operations to manage the levels of an Implicit Hierarchical 3-map
*************************************************************************/
//@{
//!
/*!
*
*/
unsigned
int
getCurrentLevel
()
;
//!
/*!
*
*/
void
setCurrentLevel
(
unsigned
int
l
)
;
//!
/*!
*
*/
unsigned
int
getMaxLevel
()
;
//!
/*!
*
*/
unsigned
int
getDartLevel
(
Dart
d
)
;
//!
/*!
*
*/
void
setDartLevel
(
Dart
d
,
unsigned
int
i
)
;
//@}
/*
**************************************************
*
EDGE ID MANAGEMENT *
***************************************************/
/*
! @name Id Management
*
Operations to manage the ids of edges and faces
***************************************************
**********************
/
/**
* Give a new unique id to all the edges of the map
//@{
//! Give a new unique id to all the edges of the map
/*!
*/
void
initEdgeId
()
;
/
**
* Return the next available edge id
/
/! Return the next available edge id
/*!
*/
unsigned
int
getNewEdgeId
()
;
/
**
* Return the id of the edge of d
/
/! Return the id of the edge of d
/*!
*/
unsigned
int
getEdgeId
(
Dart
d
)
;
/
**
* Set an edge id to all darts from an orbit of d
/
/! Set an edge id to all darts from an orbit of d
/*!
*/
//TODO changer l'ordre des parametres
void
setEdgeId
(
Dart
d
,
unsigned
int
i
,
unsigned
int
orbit
);
void
setEdgeId
(
Dart
d
,
unsigned
int
i
,
unsigned
int
orbit
);
//TODO a virer
void
setEdgeId
(
Dart
d
,
unsigned
int
i
);
/***************************************************
* FACE ID MANAGEMENT *
***************************************************/
/**
* Give a new unique id to all the faces of the map
//! Give a new unique id to all the faces of the map
/*!
*/
void
initFaceId
()
;
/
**
* Return the next available face id
/
/! Return the next available face id
/*!
*/
unsigned
int
getNewFaceId
()
;
/
**
* Return the id of the face of d
/
/! Return the id of the face of d
/*!
*/
unsigned
int
getFaceId
(
Dart
d
)
;
/
**
* Set a face id to all darts from an orbit of d
/
/! Set a face id to all darts from an orbit of d
/*!
*/
//TODO changer l'ordre des parametres
void
setFaceId
(
Dart
d
,
unsigned
int
i
,
unsigned
int
orbit
);
void
setFaceId
(
Dart
d
,
unsigned
int
i
,
unsigned
int
orbit
);
//TODO a virer
void
setFaceId
(
unsigned
int
orbit
,
Dart
d
);
//@}
/*
**************************************************
*
CELLS INFORMATION *
***************************************************/
/*
! @name Cells Information
*
Operations to manage the cells informations :
***************************************************
**********************
/
/**
* Return the level of insertion of the vertex of d
//@{
//! Return the level of insertion of the vertex of d
/*!
*/
unsigned
int
vertexInsertionLevel
(
Dart
d
)
;
/
**
* Return the level of the edge of d in the current level map
/
/! Return the level of the edge of d in the current level map
/*!
*/
unsigned
int
edgeLevel
(
Dart
d
)
;
/
**
* Return the level of the face of d in the current level map
/
/! Return the level of the face of d in the current level map
/*!
*/
unsigned
int
faceLevel
(
Dart
d
);
/
**
* Return the level of the volume of d in the current level map
/
/! Return the level of the volume of d in the current level map
/*!
*/
unsigned
int
volumeLevel
(
Dart
d
);
/
**
* Return the oldest dart of the face of d in the current level map
/
/! Return the oldest dart of the face of d in the current level map
/*!
*/
Dart
faceOldestDart
(
Dart
d
);
/
**
* Return the oldest dart of the volume of d in the current level map
/
/! Return the oldest dart of the volume of d in the current level map
/*!
*/
Dart
volumeOldestDart
(
Dart
d
);
/
**
* Return true if the edge of d in the curren
t level
map
* has already been subdivided to the next level
/
/! Return true if the edge of d in the current level map
//! has already been subdivided to the nex
t level
/*!
*/
bool
edgeIsSubdivided
(
Dart
d
)
;
/
**
* Return true if the face of d in the curren
t level
map
* has already been subdivided to the next level
/
/! Return true if the face of d in the current level map
//! has already been subdivided to the nex
t level
/*!
*/
bool
faceIsSubdivided
(
Dart
d
)
;
/
**
* Return true if the volume of d in the curren
t level
map
* has already been subdivided to the next level
/
/! Return true if the volume of d in the current level map
//! has already been subdivided to the nex
t level
/*!
*/
bool
volumeIsSubdivided
(
Dart
d
);
/
**
* Return true if the edge of d in the curren
t level
map
*
is subdivided to the next level
,
* none of its resulting edges is in turn subdivided to the next level
* and the middle vertex is of degree 2
/
/! Return true if the edge of d in the current level map
//! is subdivided to the nex
t level
,
//! none of
i
t
s
resulting edges is in turn
subdivided to the next level
//! and the middle vertex is of degree 2
/*!
*/
bool
edgeCanBeCoarsened
(
Dart
d
);
/
**
*
/
/!
/*!
*/
bool
faceCanBeCoarsened
(
Dart
d
);
/
**
*
/
/!
/*!
*/
bool
faceIsSubdividedOnce
(
Dart
d
);
/
**
*
/
/!
/*!
*/
bool
volumeIsSubdividedOnce
(
Dart
d
);
/
**
*
/
/!
/*!
*/
bool
neighborhoodLevelDiffersByOne
(
Dart
d
);
/
**
* wired !!
!
/
/! wired !!!
/*
!
*/
bool
coarsenNeighborhoodLevelDiffersByOne
(
Dart
d
);
//@}
/*! @name Cell Functors
* Redefition of the 3-maps map traversor
*************************************************************************/
//@{
virtual
Dart
begin
()
;
virtual
Dart
end
()
;
virtual
void
next
(
Dart
&
d
)
;
virtual
bool
foreach_dart_of_vertex
(
Dart
d
,
FunctorType
&
f
,
unsigned
int
thread
=
0
)
;
virtual
bool
foreach_dart_of_edge
(
Dart
d
,
FunctorType
&
f
,
unsigned
int
thread
=
0
)
;
bool
foreach_dart_of_oriented_face
(
Dart
d
,
FunctorType
&
f
,
unsigned
int
thread
=
0
);
virtual
bool
foreach_dart_of_face
(
Dart
d
,
FunctorType
&
f
,
unsigned
int
thread
=
0
)
;
bool
foreach_dart_of_oriented_volume
(
Dart
d
,
FunctorType
&
f
,
unsigned
int
thread
=
0
);
virtual
bool
foreach_dart_of_volume
(
Dart
d
,
FunctorType
&
f
,
unsigned
int
thread
=
0
)
;
virtual
bool
foreach_dart_of_cc
(
Dart
d
,
FunctorType
&
f
,
unsigned
int
thread
=
0
)
;
//@}
}
;
//
template <typename T>
//
class AttributeHandler_IHM : public AttributeHandler<T>
//
{
//
public:
//
typedef T DATA_TYPE ;
//
//
AttributeHandler_IHM() : AttributeHandler<T>()
//
{}
//
//
AttributeHandler_IHM(GenericMap* m, AttributeMultiVector<T>* amv) : AttributeHandler<T>(m, amv)
//
{}
//
//
AttributeMultiVector<T>* getDataVector() const
//
{
//
return AttributeHandler<T>::getDataVector() ;
//
}
//
//
bool isValid() const
//
{
//
return AttributeHandler<T>::isValid() ;
//
}
//
//
T& operator[](Dart d) ;
//
//
const T& operator[](Dart d) const ;
//
//
T& operator[](unsigned int a)
//
{
//
return AttributeHandler<T>::operator[](a) ;
//
}
//
//
const T& operator[](unsigned int a) const
//
{
//
return AttributeHandler<T>::operator[](a) ;
//
}
//
} ;
template
<
typename
T
>
class
AttributeHandler_IHM
:
public
AttributeHandler
<
T
>
{
public:
typedef
T
DATA_TYPE
;
AttributeHandler_IHM
()
:
AttributeHandler
<
T
>
()
{}
AttributeHandler_IHM
(
GenericMap
*
m
,
AttributeMultiVector
<
T
>*
amv
)
:
AttributeHandler
<
T
>
(
m
,
amv
)
{}
AttributeMultiVector
<
T
>*
getDataVector
()
const
{
return
AttributeHandler
<
T
>::
getDataVector
()
;
}
bool
isValid
()
const
{
return
AttributeHandler
<
T
>::
isValid
()
;
}
T
&
operator
[](
Dart
d
)
;
const
T
&
operator
[](
Dart
d
)
const
;
T
&
operator
[](
unsigned
int
a
)
{
return
AttributeHandler
<
T
>::
operator
[](
a
)
;
}
const
T
&
operator
[](
unsigned
int
a
)
const
{
return
AttributeHandler
<
T
>::
operator
[](
a
)
;
}
}
;
}
//namespace IHM
...
...
include/Algo/ImplicitHierarchicalMesh/ihm3.hpp
View file @
9e2ce59c
...
...
@@ -31,37 +31,37 @@ namespace Algo
namespace
IHM
{
//
/***************************************************
//
* ATTRIBUTES MANAGEMENT *
//
***************************************************/
//
//
template <typename T>
//
AttributeHandler_IHM<T> ImplicitHierarchicalMap3::addAttribute(unsigned int orbit, const std::string& nameAttr)
//
{
//
bool addNextLevelCell = false ;
//
if(!isOrbitEmbedded(orbit))
//
addNextLevelCell = true ;
//
//
AttributeHandler<T> h = Map3::addAttribute<T>(orbit, nameAttr) ;
//
//
if(addNextLevelCell)
//
{
//
AttributeContainer& cellCont = m_attribs[orbit] ;
//
AttributeMultiVector<unsigned int>* amv = cellCont.addAttribute<unsigned int>("nextLevelCell") ;
//
m_nextLevelCell[orbit] = amv ;
//
for(unsigned int i = cellCont.begin(); i < cellCont.end(); cellCont.next(i))
//
amv->operator[](i) = EMBNULL ;
//
}
//
//
return AttributeHandler_IHM<T>(this, h.getDataVector()) ;
//
}
//
//
template <typename T>
//
AttributeHandler_IHM<T> ImplicitHierarchicalMap3::getAttribute(unsigned int orbit, const std::string& nameAttr)
//
{
//
AttributeHandler<T> h = Map
2
::getAttribute<T>(orbit, nameAttr) ;
//
return AttributeHandler_IHM<T>(this, h.getDataVector()) ;
//
}
/***************************************************
* ATTRIBUTES MANAGEMENT *
***************************************************/
template
<
typename
T
>
AttributeHandler_IHM
<
T
>
ImplicitHierarchicalMap3
::
addAttribute
(
unsigned
int
orbit
,
const
std
::
string
&
nameAttr
)
{
bool
addNextLevelCell
=
false
;
if
(
!
isOrbitEmbedded
(
orbit
))
addNextLevelCell
=
true
;
AttributeHandler
<
T
>
h
=
Map3
::
addAttribute
<
T
>
(
orbit
,
nameAttr
)
;
if
(
addNextLevelCell
)
{
AttributeContainer
&
cellCont
=
m_attribs
[
orbit
]
;
AttributeMultiVector
<
unsigned
int
>*
amv
=
cellCont
.
addAttribute
<
unsigned
int
>
(
"nextLevelCell"
)
;
m_nextLevelCell
[
orbit
]
=
amv
;
for
(
unsigned
int
i
=
cellCont
.
begin
();
i
<
cellCont
.
end
();
cellCont
.
next
(
i
))
amv
->
operator
[](
i
)
=
EMBNULL
;
}
return
AttributeHandler_IHM
<
T
>
(
this
,
h
.
getDataVector
())
;
}
template
<
typename
T
>
AttributeHandler_IHM
<
T
>
ImplicitHierarchicalMap3
::
getAttribute
(
unsigned
int
orbit
,
const
std
::
string
&
nameAttr
)
{
AttributeHandler
<
T
>
h
=
Map
3
::
getAttribute
<
T
>
(
orbit
,
nameAttr
)
;
return
AttributeHandler_IHM
<
T
>
(
this
,
h
.
getDataVector
())
;
}
/***************************************************
* MAP TRAVERSAL *
...
...
@@ -171,50 +171,21 @@ inline Dart ImplicitHierarchicalMap3::alpha1(Dart d)
{
//assert(m_dartLevel[d] <= m_curLevel || !"Access to a dart introduced after current level") ;
return
Map3
::
alpha
1
(
d
)
;
return
phi3
(
phi_
1
(
d
)
)
;
}
inline
Dart
ImplicitHierarchicalMap3
::
alpha2
(
Dart
d
)
{
assert
(
m_dartLevel
[
d
]
<=
m_curLevel
||
!
"Access to a dart introduced after current level"
)
;
Dart
e
=
phi2
(
d
);
Dart
f
=
phi3
(
e
);
if
(
f
!=
e
)
return
f
;
f
=
d
;
e
=
phi3
(
f
);
while
(
e
!=
f
)
{
f
=
phi2
(
e
);
e
=
phi3
(
f
);
}
return
f
;
//return Map3::alpha2(d);
return
phi3
(
phi2
(
d
));
}
inline
Dart
ImplicitHierarchicalMap3
::
alpha_2
(
Dart
d
)
{
assert
(
m_dartLevel
[
d
]
<=
m_curLevel
||
!
"Access to a dart introduced after current level"
)
;
Dart
e
=
phi3
(
d
);
if
(
e
!=
d
)
return
phi2
(
e
);
e
=
d
;
Dart
f
=
phi2
(
d
);
while
(
phi3
(
f
)
!=
f
)
{
e
=
phi3
(
f
);
f
=
phi2
(
e
);
}
return
e
;
//return Map3::alpha_2(d);
return
phi2
(
phi3
(
d
));
}
inline
Dart
ImplicitHierarchicalMap3
::
begin
()
...
...
@@ -521,67 +492,67 @@ inline unsigned int ImplicitHierarchicalMap3::edgeLevel(Dart d)
return
r
;
}
//
/***************************************************
//
* ATTRIBUTE HANDLER *
//
***************************************************/
//
//
template <typename T>
//
T& AttributeHandler_IHM<T>::operator[](Dart d)
//
{
//
ImplicitHierarchicalMap3* m = reinterpret_cast<ImplicitHierarchicalMap3*>(this->m_map) ;
//
assert(m->m_dartLevel[d] <= m->m_curLevel || !"Access to a dart introduced after current level") ;
//
assert(m->vertexInsertionLevel(d) <= m->m_curLevel || !"Access to the embedding of a vertex inserted after current level") ;
//
//
unsigned int orbit = this->getOrbit() ;
//
unsigned int nbSteps = m->m_curLevel - m->vertexInsertionLevel(d) ;
//
unsigned int index = m->getEmbedding(orbit, d) ;
//
//
if(index == EMBNULL)
//
{
//
index = m->embedNewCell(orbit, d) ;
//
m->m_nextLevelCell[orbit]->operator[](index) = EMBNULL ;