Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
CGoGN
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Etienne Schmitt
CGoGN
Commits
310ff12b
Commit
310ff12b
authored
Jan 10, 2013
by
untereiner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
map2 and map3 dual computation
parent
b810b4d6
Changes
15
Hide whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
740 additions
and
73 deletions
+740
-73
Apps/Tuto/CMakeLists.txt
Apps/Tuto/CMakeLists.txt
+8
-0
Apps/Tuto/tuto_dual2.cpp
Apps/Tuto/tuto_dual2.cpp
+91
-0
Apps/Tuto/tuto_dual3.cpp
Apps/Tuto/tuto_dual3.cpp
+103
-0
include/Algo/Modelisation/subdivision.h
include/Algo/Modelisation/subdivision.h
+10
-7
include/Algo/Modelisation/subdivision.hpp
include/Algo/Modelisation/subdivision.hpp
+85
-19
include/Algo/Modelisation/subdivision3.h
include/Algo/Modelisation/subdivision3.h
+6
-0
include/Algo/Modelisation/subdivision3.hpp
include/Algo/Modelisation/subdivision3.hpp
+82
-0
include/Topology/generic/attributeHandler.h
include/Topology/generic/attributeHandler.h
+31
-13
include/Topology/generic/attributeHandler.hpp
include/Topology/generic/attributeHandler.hpp
+32
-0
include/Topology/generic/genericmap.h
include/Topology/generic/genericmap.h
+4
-4
include/Topology/map/map2.h
include/Topology/map/map2.h
+28
-0
include/Topology/map/map3.h
include/Topology/map/map3.h
+16
-0
src/Topology/generic/genericmap.cpp
src/Topology/generic/genericmap.cpp
+33
-30
src/Topology/map/map2.cpp
src/Topology/map/map2.cpp
+132
-0
src/Topology/map/map3.cpp
src/Topology/map/map3.cpp
+79
-0
No files found.
Apps/Tuto/CMakeLists.txt
View file @
310ff12b
...
...
@@ -80,6 +80,14 @@ target_link_libraries( show_traversors
add_executable
(
tuto_subdivision tuto_subdivision.cpp
)
target_link_libraries
(
tuto_subdivision
${
CGoGN_LIBS_D
}
${
CGoGN_EXT_LIBS
}
)
add_executable
(
tuto_dual2 tuto_dual2.cpp
)
target_link_libraries
(
tuto_dual2
${
CGoGN_LIBS_D
}
${
CGoGN_EXT_LIBS
}
)
add_executable
(
tuto_dual3 tuto_dual3.cpp
)
target_link_libraries
(
tuto_dual3
${
CGoGN_LIBS_D
}
${
CGoGN_EXT_LIBS
}
)
#QT4_WRAP_CPP(tp_master_moc tp_master.h)
#add_executable( tp_master tp_master.cpp ${tp_master_moc})
...
...
Apps/Tuto/tuto_dual2.cpp
0 → 100644
View file @
310ff12b
/*******************************************************************************
* CGoGN: Combinatorial and Geometric modeling with Generic N-dimensional Maps *
* version 0.1 *
* Copyright (C) 2009-2012, IGG Team, LSIIT, University of Strasbourg *
* *
* This library is free software; you can redistribute it and/or modify it *
* under the terms of the GNU Lesser General Public License as published by the *
* Free Software Foundation; either version 2.1 of the License, or (at your *
* option) any later version. *
* *
* This library is distributed in the hope that it will be useful, but WITHOUT *
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or *
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License *
* for more details. *
* *
* You should have received a copy of the GNU Lesser General Public License *
* along with this library; if not, write to the Free Software Foundation, *
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. *
* *
* Web site: http://cgogn.unistra.fr/ *
* Contact information: cgogn@unistra.fr *
* *
*******************************************************************************/
#include <iostream>
#include "Topology/generic/parameters.h"
#include "Topology/map/embeddedMap2.h"
#include "Geometry/vector_gen.h"
#include "Algo/Import/import.h"
#include "Algo/Export/export.h"
#include <typeinfo>
#include "Algo/Modelisation/subdivision.h"
using
namespace
CGoGN
;
/**
* Struct that contains some informations about the types of the manipulated objects
* Mainly here to be used by the algorithms that are parameterized by it
*/
struct
PFP
:
public
PFP_STANDARD
{
// definition of the map
typedef
EmbeddedMap2
MAP
;
};
int
main
(
int
argc
,
char
**
argv
)
{
if
(
argc
!=
2
)
{
CGoGNout
<<
"Usage : "
<<
argv
[
0
]
<<
" filename"
<<
CGoGNendl
;
return
0
;
}
std
::
string
filename
(
argv
[
1
]);
// declaration of the map
PFP
::
MAP
myMap
;
std
::
vector
<
std
::
string
>
attrNames
;
Algo
::
Import
::
importMesh
<
PFP
>
(
myMap
,
argv
[
1
],
attrNames
);
// get a handler to the 3D vector attribute created by the import
VertexAttribute
<
PFP
::
VEC3
>
position
=
myMap
.
getAttribute
<
PFP
::
VEC3
,
VERTEX
>
(
attrNames
[
0
]);
FaceAttribute
<
PFP
::
VEC3
>
positionF
=
myMap
.
getAttribute
<
PFP
::
VEC3
,
FACE
>
(
"position"
)
;
if
(
!
positionF
.
isValid
())
positionF
=
myMap
.
addAttribute
<
PFP
::
VEC3
,
FACE
>
(
"position"
)
;
Algo
::
Geometry
::
computeCentroidFaces
<
PFP
>
(
myMap
,
position
,
positionF
)
;
myMap
.
computeDual
();
position
=
positionF
;
myMap
.
check
();
//turn_to<VertexAttribute<PFP::VEC3>, FaceAttribute<PFP::VEC3> >(&positionF);
//turn_to<FaceAttribute<PFP::VEC3>, VertexAttribute<PFP::VEC3> >(position);
//const std::type_info &t1 = typeid(&positionF);
//std::cout << "type name : " << t1.name() << std::endl;
Algo
::
Export
::
exportOFF
<
PFP
>
(
myMap
,
position
,
"result.off"
);
std
::
cout
<<
"Exported"
<<
std
::
endl
;
return
0
;
}
Apps/Tuto/tuto_dual3.cpp
0 → 100644
View file @
310ff12b
/*******************************************************************************
* CGoGN: Combinatorial and Geometric modeling with Generic N-dimensional Maps *
* version 0.1 *
* Copyright (C) 2009-2012, IGG Team, LSIIT, University of Strasbourg *
* *
* This library is free software; you can redistribute it and/or modify it *
* under the terms of the GNU Lesser General Public License as published by the *
* Free Software Foundation; either version 2.1 of the License, or (at your *
* option) any later version. *
* *
* This library is distributed in the hope that it will be useful, but WITHOUT *
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or *
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License *
* for more details. *
* *
* You should have received a copy of the GNU Lesser General Public License *
* along with this library; if not, write to the Free Software Foundation, *
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. *
* *
* Web site: http://cgogn.unistra.fr/ *
* Contact information: cgogn@unistra.fr *
* *
*******************************************************************************/
#include <iostream>
#include "Topology/generic/parameters.h"
#include "Topology/map/embeddedMap3.h"
#include "Geometry/vector_gen.h"
#include "Algo/Import/import.h"
#include "Algo/Export/export.h"
#include <typeinfo>
#include "Algo/Modelisation/subdivision3.h"
using
namespace
CGoGN
;
/**
* Struct that contains some informations about the types of the manipulated objects
* Mainly here to be used by the algorithms that are parameterized by it
*/
struct
PFP
:
public
PFP_STANDARD
{
// definition of the map
typedef
EmbeddedMap3
MAP
;
};
int
main
(
int
argc
,
char
**
argv
)
{
if
(
argc
!=
2
)
{
CGoGNout
<<
"Usage : "
<<
argv
[
0
]
<<
" filename"
<<
CGoGNendl
;
return
0
;
}
std
::
string
filename
(
argv
[
1
]);
// declaration of the map
PFP
::
MAP
myMap
;
std
::
vector
<
std
::
string
>
attrNames
;
Algo
::
Import
::
importMeshV
<
PFP
>
(
myMap
,
argv
[
1
],
attrNames
,
Algo
::
Import
::
ImportVolumique
::
NODE
);
// get a handler to the 3D vector attribute created by the import
VertexAttribute
<
PFP
::
VEC3
>
position
=
myMap
.
getAttribute
<
PFP
::
VEC3
,
VERTEX
>
(
attrNames
[
0
]);
VolumeAttribute
<
PFP
::
VEC3
>
positionV
=
myMap
.
getAttribute
<
PFP
::
VEC3
,
VOLUME
>
(
"position"
)
;
if
(
!
positionV
.
isValid
())
positionV
=
myMap
.
addAttribute
<
PFP
::
VEC3
,
VOLUME
>
(
"position"
)
;
Algo
::
Geometry
::
computeCentroidVolumes
<
PFP
>
(
myMap
,
position
,
positionV
)
;
Dart
dsave
=
NIL
;
for
(
Dart
d
=
myMap
.
begin
()
;
d
!=
myMap
.
end
()
;
myMap
.
next
(
d
))
{
if
(
myMap
.
isBoundaryMarked
(
d
))
{
dsave
=
d
;
break
;
}
}
if
(
dsave
!=
NIL
)
positionV
[
dsave
]
=
PFP
::
VEC3
(
0.0
);
//Algo::Modelisation::computeDual3<PFP>(myMap,allDarts) ;
myMap
.
computeDual
();
position
=
positionV
;
//turn_to<VertexAttribute<PFP::VEC3>, FaceAttribute<PFP::VEC3> >(&positionF);
//turn_to<FaceAttribute<PFP::VEC3>, VertexAttribute<PFP::VEC3> >(position);
//const std::type_info &t1 = typeid(&positionF);
//std::cout << "type name : " << t1.name() << std::endl;
//Algo::Export::exportOFF<PFP>(myMap, position, "result.off");
myMap
.
saveMapBin
(
"result.map"
);
std
::
cout
<<
"Exported"
<<
std
::
endl
;
return
0
;
}
include/Algo/Modelisation/subdivision.h
View file @
310ff12b
...
...
@@ -105,18 +105,21 @@ void LoopSubdivision(typename PFP::MAP& map, VertexAttribute<typename PFP::VEC3>
template
<
typename
PFP
,
typename
EMBV
,
typename
EMB
>
void
TwoNPlusOneSubdivision
(
typename
PFP
::
MAP
&
map
,
EMBV
&
attributs
,
const
FunctorSelect
&
selected
=
allDarts
)
;
/**
* Reverse the orientation of the map
*/
template
<
typename
PFP
>
void
reverseOrientation
(
typename
PFP
::
MAP
&
map
)
;
/
//
**
//
* Reverse the orientation of the map
//
*/
//
template <typename PFP>
//
void reverseOrientation(typename PFP::MAP& map) ;
//
///**
// * Dual mesh computation
// */
//template <typename PFP>
//void computeDual(typename PFP::MAP& map, const FunctorSelect& selected = allDarts) ;
//
//template <typename PFP>
//void computeDualV2(typename PFP::MAP& map, const FunctorSelect& selected = allDarts) ;
//
///**
// * Sqrt(3) subdivision scheme
// */
...
...
include/Algo/Modelisation/subdivision.hpp
View file @
310ff12b
...
...
@@ -515,24 +515,24 @@ void TwoNPlusOneSubdivision(typename PFP::MAP& map, EMBV& attributs, const Funct
}
}
template
<
typename
PFP
>
void
reverseOrientation
(
typename
PFP
::
MAP
&
map
)
{
DartAttribute
<
unsigned
int
>
emb0
(
&
map
,
map
.
template
getEmbeddingAttributeVector
<
VERTEX
>())
;
if
(
emb0
.
isValid
())
{
DartAttribute
<
unsigned
int
>
new_emb0
=
map
.
template
addAttribute
<
unsigned
int
,
DART
>(
"new_EMB_0"
)
;
for
(
Dart
d
=
map
.
begin
();
d
!=
map
.
end
();
map
.
next
(
d
))
new_emb0
[
d
]
=
emb0
[
map
.
phi1
(
d
)]
;
map
.
template
swapAttributes
<
unsigned
int
>(
emb0
,
new_emb0
)
;
map
.
removeAttribute
(
new_emb0
)
;
}
DartAttribute
<
Dart
>
phi1
=
map
.
template
getAttribute
<
Dart
,
DART
>(
"phi1"
)
;
DartAttribute
<
Dart
>
phi_1
=
map
.
template
getAttribute
<
Dart
,
DART
>(
"phi_1"
)
;
map
.
template
swapAttributes
<
Dart
>(
phi1
,
phi_1
)
;
}
//
template <typename PFP>
//
void reverseOrientation(typename PFP::MAP& map)
//
{
//
DartAttribute<unsigned int> emb0(&map, map.template getEmbeddingAttributeVector<VERTEX>()) ;
//
if(emb0.isValid())
//
{
//
DartAttribute<unsigned int> new_emb0 = map.template addAttribute<unsigned int, DART>("new_EMB_0") ;
//
for(Dart d = map.begin(); d != map.end(); map.next(d))
//
new_emb0[d] = emb0[map.phi1(d)] ;
//
map.template swapAttributes<unsigned int>(emb0, new_emb0) ;
//
map.removeAttribute(new_emb0) ;
//
}
//
//
DartAttribute<Dart> phi1 = map.template getAttribute<Dart, DART>("phi1") ;
//
DartAttribute<Dart> phi_1 = map.template getAttribute<Dart, DART>("phi_1") ;
//
map.template swapAttributes<Dart>(phi1, phi_1) ;
//
}
//
//template <typename PFP>
//void computeDual(typename PFP::MAP& map, const FunctorSelect& selected)
//{
...
...
@@ -543,7 +543,44 @@ void reverseOrientation(typename PFP::MAP& map)
//
// for(Dart d = map.begin(); d != map.end(); map.next(d))
// {
// Dart dd = map.phi12(d) ;
// Dart dd = map.phi1(map.phi2(d));
//
// new_phi1[d] = dd ;
// new_phi_1[dd] = d ;
// }
//
// map.template swapAttributes<Dart>(phi1, new_phi1) ;
// map.template swapAttributes<Dart>(phi_1, new_phi_1) ;
//
// map.removeAttribute(new_phi1) ;
// map.removeAttribute(new_phi_1) ;
//
// map.swapEmbeddingContainers(VERTEX, FACE) ;
//
// reverseOrientation<PFP>(map) ;
//
//// //boundary management
//// for(Dart d = map.begin(); d != map.end(); map.next(d))
//// {
//// if(map.isBoundaryMarked(d))
//// {
//// map.template boundaryMarkOrbit<FACE>(map.deleteVertex(map.phi2(d))); //map.deleteCycle();
//// }
//// }
//}
//
//template <typename PFP>
//void computeDualV2(typename PFP::MAP& map, const FunctorSelect& selected)
//{
// DartAttribute<Dart> phi1 = map.template getAttribute<Dart, DART>("phi1") ;
// DartAttribute<Dart> phi_1 = map.template getAttribute<Dart, DART>("phi_1") ;
// DartAttribute<Dart> new_phi1 = map.template addAttribute<Dart, DART>("new_phi1") ;
// DartAttribute<Dart> new_phi_1 = map.template addAttribute<Dart, DART>("new_phi_1") ;
//
// for(Dart d = map.begin(); d != map.end(); map.next(d))
// {
// Dart dd = map.phi1(map.phi2(d));
//
// new_phi1[d] = dd ;
// new_phi_1[dd] = d ;
// }
...
...
@@ -554,11 +591,40 @@ void reverseOrientation(typename PFP::MAP& map)
// map.removeAttribute(new_phi1) ;
// map.removeAttribute(new_phi_1) ;
//
// //boundary management
// for(Dart d = map.begin(); d != map.end(); map.next(d))
// {
// if(map.isBoundaryMarked(d))
// {
// Dart d1 = map.phi1(d);
// Dart dd = map.phi_1(map.phi2(d));
//
// //marquer le brin d1 et le bin dd
//
// phi1[dd] = d1 ;
// phi_1[d1] = dd ;
//
// phi1[d] = map.phi2(d);
// phi_1[map.phi2(d)] = d;
// }
// }
//
// map.swapEmbeddingContainers(VERTEX, FACE) ;
//
// reverseOrientation<PFP>(map) ;
//
// for(Dart d = map.begin(); d != map.end(); map.next(d))
// {
// if(map.isBoundaryMarked(d))
// {
// map.deleteCycle(map.phi2(d));
// }
// }
//
// //transformer le marker des brins d1 et dd en boundaryMarker
//}
inline
double
sqrt3_K
(
unsigned
int
n
)
{
switch
(
n
)
...
...
include/Algo/Modelisation/subdivision3.h
View file @
310ff12b
...
...
@@ -99,6 +99,12 @@ void catmullClarkVol(typename PFP::MAP& map, VertexAttribute<typename PFP::VEC3>
template
<
typename
PFP
>
void
sqrt3Vol
(
typename
PFP
::
MAP
&
map
,
VertexAttribute
<
typename
PFP
::
VEC3
>&
position
,
const
FunctorSelect
&
selected
=
allDarts
);
///**
// * Dual mesh computation
// */
//template <typename PFP>
//void computeDual3(typename PFP::MAP& map, const FunctorSelect& selected = allDarts) ;
}
// namespace Modelisation
}
// namespace Algo
...
...
include/Algo/Modelisation/subdivision3.hpp
View file @
310ff12b
...
...
@@ -713,6 +713,88 @@ void sqrt3Vol(typename PFP::MAP& map, VertexAttribute<typename PFP::VEC3>& posit
}
}
//template <typename PFP>
//void reverseOrientation3(typename PFP::MAP& map)
//{
// DartAttribute<unsigned int> emb0(&map, map.template getEmbeddingAttributeVector<VERTEX>()) ;
// if(emb0.isValid())
// {
// DartAttribute<unsigned int> new_emb0 = map.template addAttribute<unsigned int, DART>("new_EMB_0") ;
// for(Dart d = map.begin(); d != map.end(); map.next(d))
// new_emb0[d] = emb0[map.phi1(d)] ;
// map.template swapAttributes<unsigned int>(emb0, new_emb0) ;
// map.removeAttribute(new_emb0) ;
// }
//
// DartAttribute<Dart> phi2 = map.template getAttribute<Dart, DART>("phi2") ;
// DartAttribute<Dart> phi3 = map.template getAttribute<Dart, DART>("phi3") ;
// map.template swapAttributes<Dart>(phi2, phi3) ;
//}
//
//template <typename PFP>
//void computeDual3(typename PFP::MAP& map, const FunctorSelect& selected)
//{
// DartAttribute<Dart> phi1 = map.template getAttribute<Dart, DART>("phi1") ;
// DartAttribute<Dart> phi_1 = map.template getAttribute<Dart, DART>("phi_1") ;
// DartAttribute<Dart> new_phi1 = map.template addAttribute<Dart, DART>("new_phi1") ;
// DartAttribute<Dart> new_phi_1 = map.template addAttribute<Dart, DART>("new_phi_1") ;
//
// DartAttribute<Dart> phi2 = map.template getAttribute<Dart, DART>("phi2") ;
// DartAttribute<Dart> new_phi2 = map.template addAttribute<Dart, DART>("new_phi2") ;
//
// for(Dart d = map.begin(); d != map.end(); map.next(d))
// {
// Dart dd = map.phi2(map.phi3(d)) ;
// new_phi1[d] = dd ;
// new_phi_1[dd] = d ;
//
// Dart ddd = map.phi1(map.phi3(d));
// new_phi2[d] = ddd;
// new_phi2[ddd] = d;
// }
//
// map.template swapAttributes<Dart>(phi1, new_phi1) ;
// map.template swapAttributes<Dart>(phi_1, new_phi_1) ;
// map.template swapAttributes<Dart>(phi2, new_phi2) ;
//
// map.removeAttribute(new_phi1) ;
// map.removeAttribute(new_phi_1) ;
// map.removeAttribute(new_phi2) ;
//
// map.swapEmbeddingContainers(VERTEX, VOLUME) ;
//
// for(Dart d = map.begin(); d != map.end(); map.next(d))
// {
// if(map.isBoundaryMarked(d))
// {
// map.deleteVolume(d);
//// Traversor3VW<typename PFP::MAP> tWV(map, d);
//// std::vector<Dart> v;
//// for(Dart ditW = tWV.begin() ; ditW != tWV.end() ; ditW = tWV.next())
//// {
//// v.push_back(ditW);
//// }
////
//// for(std::vector<Dart>::iterator it = v.begin() ; it != v.end() ; ++it)
//// {
//// map.deleteVolume(*it);
//// }
//
// }
// }
//
//// reverseOrientation3<PFP>(map) ;
//
// //boundary management
//// for(Dart d = map.begin(); d != map.end(); map.next(d))
//// {
//// if(map.isBoundaryMarked(d))
//// {
//// map.deleteVolume(d); //map.template boundaryMarkOrbit<VOLUME>(
//// }
//// }
//}
}
//namespace Modelisation
...
...
include/Topology/generic/attributeHandler.h
View file @
310ff12b
...
...
@@ -93,19 +93,6 @@ public:
*/
AttributeHandler
()
;
template
<
unsigned
int
ORBIT2
>
AttributeHandler
(
const
AttributeHandler
<
T
,
ORBIT2
>&
h
)
:
AttributeHandlerGen
(
h
.
m_map
,
h
.
valid
)
{
m_attrib
=
h
.
m_attrib
;
if
(
m_attrib
->
getOrbit
()
==
ORBIT2
)
{
if
(
valid
)
registerInMap
()
;
}
else
valid
=
false
;
}
/**
* Constructor
* @param m the map which belong attribute
...
...
@@ -119,12 +106,27 @@ public:
*/
AttributeHandler
(
const
AttributeHandler
<
T
,
ORBIT
>&
ta
)
;
/**
* Transmute Constructor
* Construct an attribute of Orbit from Orbit2
* @param h the table attribute
*/
template
<
unsigned
int
ORBIT2
>
AttributeHandler
(
const
AttributeHandler
<
T
,
ORBIT2
>&
h
)
;
/**
* affectation operator
* @param ta the table attribute to affect to this
*/
AttributeHandler
<
T
,
ORBIT
>&
operator
=
(
const
AttributeHandler
<
T
,
ORBIT
>&
ta
)
;
/**
* transmuted affectation operator
* @param ta the table attribute to affect to this
*/
template
<
unsigned
int
ORBIT2
>
AttributeHandler
<
T
,
ORBIT
>&
operator
=
(
const
AttributeHandler
<
T
,
ORBIT2
>&
ta
)
;
/**
* Destructor (empty & virtual)
*/
...
...
@@ -233,6 +235,9 @@ public:
VertexAttribute
(
const
AttributeHandler
<
T
,
VERTEX
>&
ah
)
:
AttributeHandler
<
T
,
VERTEX
>
(
ah
)
{}
VertexAttribute
(
GenericMap
*
m
,
AttributeMultiVector
<
T
>*
amv
)
:
AttributeHandler
<
T
,
VERTEX
>
(
m
,
amv
)
{}
VertexAttribute
<
T
>&
operator
=
(
const
AttributeHandler
<
T
,
VERTEX
>&
ah
)
{
this
->
AttributeHandler
<
T
,
VERTEX
>::
operator
=
(
ah
);
return
*
this
;
}
VertexAttribute
<
T
>&
operator
=
(
const
AttributeHandler
<
T
,
EDGE
>&
ah
)
{
this
->
AttributeHandler
<
T
,
VERTEX
>::
operator
=
(
ah
);
return
*
this
;
}
VertexAttribute
<
T
>&
operator
=
(
const
AttributeHandler
<
T
,
FACE
>&
ah
)
{
this
->
AttributeHandler
<
T
,
VERTEX
>::
operator
=
(
ah
);
return
*
this
;
}
VertexAttribute
<
T
>&
operator
=
(
const
AttributeHandler
<
T
,
VOLUME
>&
ah
)
{
this
->
AttributeHandler
<
T
,
VERTEX
>::
operator
=
(
ah
);
return
*
this
;
}
};
/**
...
...
@@ -259,6 +264,7 @@ public:
FaceAttribute
(
const
AttributeHandler
<
T
,
FACE
>&
ah
)
:
AttributeHandler
<
T
,
FACE
>
(
ah
)
{}
FaceAttribute
(
GenericMap
*
m
,
AttributeMultiVector
<
T
>*
amv
)
:
AttributeHandler
<
T
,
FACE
>
(
m
,
amv
)
{}
FaceAttribute
<
T
>&
operator
=
(
const
AttributeHandler
<
T
,
FACE
>&
ah
)
{
this
->
AttributeHandler
<
T
,
FACE
>::
operator
=
(
ah
);
return
*
this
;
}
FaceAttribute
<
T
>&
operator
=
(
const
AttributeHandler
<
T
,
VERTEX
>&
ah
)
{
this
->
AttributeHandler
<
T
,
FACE
>::
operator
=
(
ah
);
return
*
this
;
}
};
/**
...
...
@@ -272,8 +278,20 @@ public:
VolumeAttribute
(
const
AttributeHandler
<
T
,
VOLUME
>&
ah
)
:
AttributeHandler
<
T
,
VOLUME
>
(
ah
)
{}
VolumeAttribute
(
GenericMap
*
m
,
AttributeMultiVector
<
T
>*
amv
)
:
AttributeHandler
<
T
,
VOLUME
>
(
m
,
amv
)
{}
VolumeAttribute
<
T
>&
operator
=
(
const
AttributeHandler
<
T
,
VOLUME
>&
ah
)
{
this
->
AttributeHandler
<
T
,
VOLUME
>::
operator
=
(
ah
);
return
*
this
;
}
VolumeAttribute
<
T
>&
operator
=
(
const
AttributeHandler
<
T
,
VERTEX
>&
ah
)
{
this
->
AttributeHandler
<
T
,
VOLUME
>::
operator
=
(
ah
);
return
*
this
;
}
};
// turn_to<b>(A*</b> obj) changes class of the object
// that means it just replaces VTBL of the object by VTBL of another class.
// NOTE: these two classes has to be ABI compatible!
template
<
typename
TO_T
,
typename
FROM_T
>
inline
void
turn_to
(
FROM_T
*
p
)
{
assert
(
sizeof
(
FROM_T
)
==
sizeof
(
TO_T
));
::
new
(
p
)
TO_T
();
// use of placement new
}
}
// namespace CGoGN
#include "Topology/generic/attributeHandler.hpp"
...
...
include/Topology/generic/attributeHandler.hpp
View file @
310ff12b
...
...
@@ -80,6 +80,23 @@ AttributeHandler<T, ORBIT>::AttributeHandler(const AttributeHandler<T, ORBIT>& t
registerInMap
()
;
}
//template <typename T, unsigned int ORBIT>
//template <unsigned int ORBIT2>
template
<
typename
T
,
unsigned
int
ORBIT
>
template
<
unsigned
int
ORBIT2
>
AttributeHandler
<
T
,
ORBIT
>::
AttributeHandler
(
const
AttributeHandler
<
T
,
ORBIT2
>&
h
)
:
AttributeHandlerGen
(
h
.
m_map
,
h
.
valid
)
{
m_attrib
=
h
.
m_attrib
;
if
(
m_attrib
->
getOrbit
()
==
ORBIT2
)
{
if
(
valid
)
registerInMap
()
;
}
else
valid
=
false
;
}
template
<
typename
T
,
unsigned
int
ORBIT
>
inline
AttributeHandler
<
T
,
ORBIT
>&
AttributeHandler
<
T
,
ORBIT
>::
operator
=
(
const
AttributeHandler
<
T
,
ORBIT
>&
ta
)
{
...
...
@@ -93,6 +110,21 @@ inline AttributeHandler<T, ORBIT>& AttributeHandler<T, ORBIT>::operator=(const A
return
*
this
;
}
template
<
typename
T
,
unsigned
int
ORBIT
>
template
<
unsigned
int
ORBIT2
>
inline
AttributeHandler
<
T
,
ORBIT
>&
AttributeHandler
<
T
,
ORBIT
>::
operator
=
(
const
AttributeHandler
<
T
,
ORBIT2
>&
ta
)
{
if
(
valid
)
unregisterFromMap
()
;
m_map
=
ta
.
map
()
;
m_attrib
=
ta
.
getDataVector
()
;
valid
=
ta
.
isValid
()
;
if
(
valid
)
registerInMap
()
;
return
*
this
;
}
template
<
typename
T
,
unsigned
int
ORBIT
>
AttributeHandler
<
T
,
ORBIT
>::~
AttributeHandler
()
{
...
...
include/Topology/generic/genericmap.h
View file @
310ff12b
...
...
@@ -506,10 +506,10 @@ public:
AttributeMultiVector
<
unsigned
int
>*
getMRLevelAttributeVector
();
//
/**
//
* swap two attribute containers
//
*/