Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
David Cazier
CGoGN
Commits
34041d75
Commit
34041d75
authored
Jun 25, 2014
by
Sylvain Thery
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
resolving MR compilation problems
parent
439c9150
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
95 additions
and
33 deletions
+95
-33
include/Algo/Import/importMRDAT.h
include/Algo/Import/importMRDAT.h
+3
-2
include/Algo/Import/importMRDAT.hpp
include/Algo/Import/importMRDAT.hpp
+3
-4
include/Algo/Modelisation/subdivision.hpp
include/Algo/Modelisation/subdivision.hpp
+12
-10
include/Algo/Multiresolution/Map2MR/map2MR_DualRegular.hpp
include/Algo/Multiresolution/Map2MR/map2MR_DualRegular.hpp
+10
-4
include/Topology/generic/mapImpl/mapMulti.h
include/Topology/generic/mapImpl/mapMulti.h
+4
-0
include/Topology/map/map2.hpp
include/Topology/map/map2.hpp
+1
-1
src/Topology/generic/mapMono.cpp
src/Topology/generic/mapMono.cpp
+3
-0
src/Topology/generic/mapMulti.cpp
src/Topology/generic/mapMulti.cpp
+59
-12
No files found.
include/Algo/Import/importMRDAT.h
View file @
34041d75
...
...
@@ -104,7 +104,7 @@ public:
// if(oldEmb == EMBNULL)
// {
//std::cout << "oldEmb == NULL"<< std::endl;
map
.
template
setOrbitEmbedding
<
VERTEX
>(
dd
,
newEmb
)
;
Algo
::
Topo
::
setOrbitEmbedding
<
VERTEX
>
(
map
,
dd
,
newEmb
);
//needed because the darts are duplicated at each level
//and the vertex orbits are initialized at the creation of each level with wrong embedding indices
...
...
@@ -114,7 +114,8 @@ public:
for
(
unsigned
int
i
=
map
.
getCurrentLevel
()
+
1
;
i
<=
map
.
getMaxLevel
();
++
i
)
{
map
.
setCurrentLevel
(
i
)
;
map
.
template
setOrbitEmbedding
<
VERTEX
>(
dd
,
newEmb
)
;
Algo
::
Topo
::
setOrbitEmbedding
<
VERTEX
>
(
map
,
dd
,
newEmb
);
}
//map.popLevel() ;
map
.
setCurrentLevel
(
cur
);
...
...
include/Algo/Import/importMRDAT.hpp
View file @
34041d75
...
...
@@ -44,9 +44,9 @@ inline void nextNonEmptyLine(std::ifstream& fp, std::string& line)
template
<
typename
PFP
>
bool
importMRDAT
(
typename
PFP
::
MAP
&
map
,
const
std
::
string
&
filename
,
std
::
vector
<
std
::
string
>&
attrNames
,
QuadTree
&
qt
)
{
VertexAttribute
<
typename
PFP
::
VEC3
,
typename
PFP
::
MAP
>
position
=
map
.
template
getAttribute
<
typename
PFP
::
VEC3
,
VERTEX
>(
"position"
)
;
VertexAttribute
<
typename
PFP
::
VEC3
,
typename
PFP
::
MAP
>
position
=
map
.
template
getAttribute
<
typename
PFP
::
VEC3
,
VERTEX
,
typename
PFP
::
MAP
>(
"position"
)
;
if
(
!
position
.
isValid
())
position
=
map
.
template
addAttribute
<
typename
PFP
::
VEC3
,
VERTEX
>(
"position"
)
;
position
=
map
.
template
addAttribute
<
typename
PFP
::
VEC3
,
VERTEX
,
typename
PFP
::
MAP
>(
"position"
)
;
attrNames
.
push_back
(
position
.
name
())
;
...
...
@@ -197,7 +197,6 @@ bool importMRDAT(typename PFP::MAP& map, const std::string& filename, std::vecto
DartMarkerNoUnmark
<
typename
PFP
::
MAP
>
m
(
map
)
;
unsigned
int
vemb
=
EMBNULL
;
auto
fsetemb
=
[
&
]
(
Dart
d
)
{
map
.
template
setDartEmbedding
<
VERTEX
>(
d
,
vemb
);
};
unsigned
nbf
=
qt
.
roots
.
size
()
;
...
...
@@ -211,7 +210,7 @@ bool importMRDAT(typename PFP::MAP& map, const std::string& filename, std::vecto
unsigned
int
idx
=
qt
.
roots
[
i
]
->
indices
[
j
]
;
vemb
=
qt
.
verticesID
[
idx
]
;
map
.
template
foreach_dart_of_orbit
<
PFP
::
MAP
::
VERTEX_OF_PARENT
>(
d
,
fsetemb
)
;
map
.
template
foreach_dart_of_orbit
<
PFP
::
MAP
::
VERTEX_OF_PARENT
>(
d
,
[
&
]
(
Dart
dd
)
{
map
.
template
initDartEmbedding
<
VERTEX
>(
dd
,
vemb
);
})
;
m
.
mark
(
d
)
;
// mark on the fly to unmark on second loop
vecDartsPerVertex
[
vemb
].
push_back
(
d
)
;
// store incident darts for fast adjacency reconstruction
...
...
include/Algo/Modelisation/subdivision.hpp
View file @
34041d75
...
...
@@ -582,8 +582,8 @@ void DooSabin(typename PFP::MAP& map, EMBV& position)
// take care of edge embedding
if
(
map
.
template
isOrbitEmbedded
<
EDGE
>())
{
map
.
template
setOrbitEmbedding
<
EDGE
>(
nf
,
map
.
template
getEmbedding
<
EDGE
>(
e
));
map
.
template
setOrbitEmbedding
<
EDGE
>(
map
.
template
phi
<
11
>(
nf
),
map
.
template
getEmbedding
<
EDGE
>(
e2
));
Algo
::
Topo
::
setOrbitEmbedding
<
VERTEX
>
(
map
,
nf
,
map
.
template
getEmbedding
<
EDGE
>(
e
));
Algo
::
Topo
::
setOrbitEmbedding
<
VERTEX
>
(
map
,
map
.
template
phi
<
11
>(
nf
),
map
.
template
getEmbedding
<
EDGE
>(
e2
));
}
dm
.
markOrbit
<
FACE
>
(
nf
);
...
...
@@ -608,7 +608,8 @@ void DooSabin(typename PFP::MAP& map, EMBV& position)
Dart
d
=
df
;
do
{
map
.
template
setOrbitEmbedding
<
EDGE
>(
d
,
map
.
template
getEmbedding
<
EDGE
>(
map
.
phi2
(
d
)));
// map.template setOrbitEmbedding<EDGE>(d,map.template getEmbedding<EDGE>(map.phi2(d)));
Algo
::
Topo
::
setOrbitEmbedding
<
VERTEX
>
(
map
,
d
,
map
.
template
getEmbedding
<
EDGE
>(
map
.
phi2
(
d
)));
d
=
map
.
phi1
(
d
);
}
while
(
d
!=
df
);
}
...
...
@@ -646,7 +647,8 @@ void DooSabin(typename PFP::MAP& map, EMBV& position)
P
+=
c2
*
buffer
[
j
];
}
}
map
.
template
setOrbitEmbeddingOnNewCell
<
VERTEX
>(
e
);
// map.template setOrbitEmbeddingOnNewCell<VERTEX>(e);
Algo
::
Topo
::
setOrbitEmbeddingOnNewCell
<
VERTEX
>
(
map
,
e
);
position
[
e
]
=
P
;
e
=
map
.
phi1
(
e
);
}
...
...
@@ -730,9 +732,9 @@ void computeDual(typename PFP::MAP& map, VertexAttribute<typename PFP::VEC3, typ
typedef
typename
PFP
::
VEC3
VEC3
;
// Face Attribute -> after dual new Vertex Attribute
FaceAttribute
<
VEC3
,
MAP
>
positionF
=
map
.
template
getAttribute
<
VEC3
,
FACE
>(
"position"
)
;
FaceAttribute
<
VEC3
,
MAP
>
positionF
=
map
.
template
getAttribute
<
VEC3
,
FACE
,
MAP
>(
"position"
)
;
if
(
!
positionF
.
isValid
())
positionF
=
map
.
template
addAttribute
<
VEC3
,
FACE
>(
"position"
)
;
positionF
=
map
.
template
addAttribute
<
VEC3
,
FACE
,
MAP
>(
"position"
)
;
// Compute Centroid for the faces
Algo
::
Surface
::
Geometry
::
computeCentroidFaces
<
PFP
>
(
map
,
position
,
positionF
)
;
...
...
@@ -752,9 +754,9 @@ void computeBoundaryConstraintDual(typename PFP::MAP& map, VertexAttribute<typen
typedef
typename
PFP
::
REAL
REAL
;
// Face Attribute -> after dual new Vertex Attribute
FaceAttribute
<
VEC3
,
MAP
>
positionF
=
map
.
template
getAttribute
<
VEC3
,
FACE
>(
"position"
)
;
FaceAttribute
<
VEC3
,
MAP
>
positionF
=
map
.
template
getAttribute
<
VEC3
,
FACE
,
MAP
>(
"position"
)
;
if
(
!
positionF
.
isValid
())
positionF
=
map
.
template
addAttribute
<
VEC3
,
FACE
>(
"position"
)
;
positionF
=
map
.
template
addAttribute
<
VEC3
,
FACE
,
MAP
>(
"position"
)
;
//Triangule boundary faces & compute for each new face the centroid
std
::
vector
<
Dart
>
boundsDart
;
...
...
@@ -823,9 +825,9 @@ void computeBoundaryConstraintKeepingOldVerticesDual(typename PFP::MAP& map, Ver
typedef
typename
PFP
::
REAL
REAL
;
// Face Attribute -> after dual new Vertex Attribute
FaceAttribute
<
VEC3
,
MAP
>
positionF
=
map
.
template
getAttribute
<
VEC3
,
FACE
>(
"position"
)
;
FaceAttribute
<
VEC3
,
MAP
>
positionF
=
map
.
template
getAttribute
<
VEC3
,
FACE
,
MAP
>(
"position"
)
;
if
(
!
positionF
.
isValid
())
positionF
=
map
.
template
addAttribute
<
VEC3
,
FACE
>(
"position"
)
;
positionF
=
map
.
template
addAttribute
<
VEC3
,
FACE
,
MAP
>(
"position"
)
;
//Triangule boundary faces & compute for each new face the centroid
std
::
vector
<
Dart
>
boundsDart
;
...
...
include/Algo/Multiresolution/Map2MR/map2MR_DualRegular.hpp
View file @
34041d75
...
...
@@ -22,6 +22,8 @@
* *
*******************************************************************************/
#include "Algo/Topo/embedding.h"
namespace
CGoGN
{
...
...
@@ -87,8 +89,10 @@ void Map2MR<PFP>::addNewLevel(bool embedNewVertices)
// take care of edge embedding
if
(
m_map
.
template
isOrbitEmbedded
<
EDGE
>())
{
m_map
.
template
setOrbitEmbedding
<
EDGE
>(
nf
,
m_map
.
template
getEmbedding
<
EDGE
>(
d
));
m_map
.
template
setOrbitEmbedding
<
EDGE
>(
m_map
.
phi1
(
m_map
.
phi1
(
nf
)),
m_map
.
template
getEmbedding
<
EDGE
>(
d2
));
// m_map.template setOrbitEmbedding<EDGE>(nf, m_map.template getEmbedding<EDGE>(d));
// m_map.template setOrbitEmbedding<EDGE>(m_map.phi1(m_map.phi1(nf)), m_map.template getEmbedding<EDGE>(d2));
Algo
::
Topo
::
setOrbitEmbedding
<
EDGE
>
(
m_map
,
nf
,
m_map
.
template
getEmbedding
<
EDGE
>(
d
));
Algo
::
Topo
::
setOrbitEmbedding
<
EDGE
>
(
m_map
,
m_map
.
phi1
(
m_map
.
phi1
(
nf
)),
m_map
.
template
getEmbedding
<
EDGE
>(
d2
));
}
m_map
.
decCurrentLevel
();
...
...
@@ -109,13 +113,15 @@ void Map2MR<PFP>::addNewLevel(bool embedNewVertices)
{
if
(
m_map
.
template
isOrbitEmbedded
<
EDGE
>())
{
m_map
.
template
setOrbitEmbedding
<
EDGE
>(
temp
,
m_map
.
template
getEmbedding
<
EDGE
>(
m_map
.
phi2
(
temp
)));
// m_map.template setOrbitEmbedding<EDGE>(temp, m_map.template getEmbedding<EDGE>( m_map.phi2(temp)));
Algo
::
Topo
::
setOrbitEmbedding
<
EDGE
>
(
m_map
,
temp
,
m_map
.
template
getEmbedding
<
EDGE
>(
m_map
.
phi2
(
temp
)));
}
if
(
!
shareVertexEmbeddings
)
{
//if(m_map.template getEmbedding<VERTEX>(d) == EMBNULL)
m_map
.
template
setOrbitEmbeddingOnNewCell
<
VERTEX
>(
temp
)
;
Algo
::
Topo
::
setOrbitEmbeddingOnNewCell
<
VERTEX
>
(
m_map
,
temp
);
//m_map.template setOrbitEmbeddingOnNewCell<VERTEX>(d2) ;
}
...
...
include/Topology/generic/mapImpl/mapMulti.h
View file @
34041d75
...
...
@@ -30,6 +30,8 @@
namespace
CGoGN
{
class
MapMono
;
class
MapMulti
:
public
GenericMap
{
template
<
typename
MAP
>
friend
class
DartMarkerTmpl
;
...
...
@@ -301,6 +303,8 @@ public:
bool
copyFrom
(
const
GenericMap
&
map
);
bool
copyFromOtherType
(
const
MapMono
&
map
);
void
restore_topo_shortcuts
();
}
;
...
...
include/Topology/map/map2.hpp
View file @
34041d75
...
...
@@ -243,7 +243,7 @@ template <typename MAP_IMPL>
void
Map2
<
MAP_IMPL
>::
createHole
(
Dart
d
)
{
assert
(
!
isBoundaryEdge
(
d
))
;
this
->
template
boundaryMarkOrbit
<
2
,
FACE
>(
d
)
;
Algo
::
Topo
::
boundaryMarkOrbit
<
2
,
FACE
>
(
*
this
,
d
)
;
}
/*! @name Topological Operators
...
...
src/Topology/generic/mapMono.cpp
View file @
34041d75
...
...
@@ -193,6 +193,9 @@ void MapMono::restore_topo_shortcuts()
void
MapMono
::
compactTopo
()
{
if
(
fragmentation
(
DART
)
==
1.0
)
return
;
std
::
vector
<
unsigned
int
>
oldnew
;
m_attribs
[
DART
].
compact
(
oldnew
);
...
...
src/Topology/generic/mapMulti.cpp
View file @
34041d75
...
...
@@ -23,6 +23,7 @@
*******************************************************************************/
#include "Topology/generic/mapImpl/mapMulti.h"
#include "Topology/generic/mapImpl/mapMono.h"
namespace
CGoGN
{
...
...
@@ -313,31 +314,77 @@ bool MapMulti::loadMapBin(const std::string& filename)
return
true
;
}
bool
MapMulti
::
copyFromOtherType
(
const
MapMono
&
mapMR
)
{
// map.compactIfNeeded(1.0);
// clear the map but do not insert boundary markers dart attribute
GenericMap
::
init
(
false
);
// init MR data
initMR
();
// copy attrib containers from MapMono
for
(
unsigned
int
i
=
0
;
i
<
NB_ORBITS
;
++
i
)
m_attribs
[
i
].
copyFrom
(
mapMR
.
getAttributeContainer
(
i
));
// restore shortcuts
GenericMap
::
restore_shortcuts
();
restore_topo_shortcuts
();
AttributeContainer
darts
=
m_attribs
[
DART
];
for
(
unsigned
int
xd
=
darts
.
begin
();
xd
!=
darts
.
end
();
darts
.
next
(
xd
))
{
unsigned
int
mrdi
=
m_mrattribs
.
insertLine
()
;
assert
(
mrdi
==
xd
);
(
*
m_mrDarts
[
0
])[
mrdi
]
=
xd
;
}
return
true
;
}
bool
MapMulti
::
copyFrom
(
const
GenericMap
&
map
)
{
const
MapMulti
&
mapMR
=
reinterpret_cast
<
const
MapMulti
&>
(
map
);
const
MapMulti
*
mapMR
=
dynamic_cast
<
const
MapMulti
*>
(
&
map
);
if
(
map
TypeName
()
!=
map
.
mapTypeName
()
)
if
(
map
MR
==
NULL
)
{
CGoGNerr
<<
"try to copy from incompatible type map"
<<
CGoGNendl
;
return
false
;
const
MapMono
*
mapmono
=
dynamic_cast
<
const
MapMono
*>
(
mapMR
);
if
(
mapmono
==
NULL
)
{
CGoGNerr
<<
"try to copy from incompatible type map"
<<
CGoGNendl
;
return
false
;
}
copyFromOtherType
(
*
mapmono
);
}
// clear the map but do not insert boundary markers dart attribute
GenericMap
::
init
(
false
);
// init MR data without adding the attributes
m_mrattribs
.
clear
(
true
)
;
m_mrattribs
.
setRegistry
(
m_attributes_registry_map
)
;
m_mrDarts
.
clear
()
;
m_mrDarts
.
reserve
(
16
)
;
m_mrNbDarts
.
clear
();
m_mrNbDarts
.
reserve
(
16
);
m_mrLevelStack
.
clear
()
;
m_mrLevelStack
.
reserve
(
16
)
;
//
load
attrib container
//
copy
attrib container
s
for
(
unsigned
int
i
=
0
;
i
<
NB_ORBITS
;
++
i
)
m_attribs
[
i
].
copyFrom
(
mapMR
.
m_attribs
[
i
]);
m_attribs
[
i
].
copyFrom
(
mapMR
->
m_attribs
[
i
]);
m_mrattribs
.
copyFrom
(
mapMR
.
m_mrattribs
);
m_mrCurrentLevel
=
mapMR
.
m_mrCurrentLevel
;
m_mrattribs
.
copyFrom
(
mapMR
->
m_mrattribs
);
unsigned
int
nb
=
mapMR
.
m_mrNbDarts
.
size
();
m_mrNbDarts
.
resize
(
nb
);
for
(
unsigned
int
i
=
0
;
i
<
nb
;
++
i
)
m_mrNbDarts
[
i
]
=
mapMR
.
m_mrNbDarts
[
i
];
m_mrCurrentLevel
=
mapMR
->
m_mrCurrentLevel
;
m_mrNbDarts
.
assign
(
mapMR
->
m_mrNbDarts
.
begin
(),
mapMR
->
m_mrNbDarts
.
end
());
m_mrLevelStack
.
assign
(
mapMR
->
m_mrLevelStack
.
begin
(),
mapMR
->
m_mrLevelStack
.
end
());
// ??
// restore shortcuts
GenericMap
::
restore_shortcuts
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment