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
614de846
Commit
614de846
authored
Jun 20, 2014
by
Sylvain Thery
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
testing compact
parent
4d2d5cd6
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
133 additions
and
5 deletions
+133
-5
Apps/Tests/CMakeLists.txt
Apps/Tests/CMakeLists.txt
+4
-0
Apps/Tests/compact.cpp
Apps/Tests/compact.cpp
+124
-0
include/Algo/Geometry/area.hpp
include/Algo/Geometry/area.hpp
+1
-1
src/Topology/generic/genericmap.cpp
src/Topology/generic/genericmap.cpp
+4
-4
No files found.
Apps/Tests/CMakeLists.txt
View file @
614de846
...
...
@@ -46,3 +46,7 @@ target_link_libraries( copyfrom
add_executable
(
movefrom ./movefrom.cpp
)
target_link_libraries
(
movefrom
${
CGoGN_LIBS_D
}
${
CGoGN_EXT_LIBS
}
)
add_executable
(
compact ./compact.cpp
)
target_link_libraries
(
compact
${
CGoGN_LIBS_D
}
${
CGoGN_EXT_LIBS
}
)
Apps/Tests/compact.cpp
0 → 100644
View file @
614de846
/*******************************************************************************
* 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 "Topology/generic/parameters.h"
#include "Topology/map/embeddedMap2.h"
#include "Algo/Tiling/Surface/square.h"
#include "Algo/Geometry/area.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
PFP2
:
public
PFP_STANDARD
{
// definition of the type of the map
typedef
EmbeddedMap2
MAP
;
};
typedef
PFP2
::
MAP
MAP
;
typedef
PFP2
::
VEC3
VEC3
;
int
main
()
{
// declare a map to handle the mesh
MAP
myMap
;
// add position attribute on vertices and get handler on it
VertexAttribute
<
VEC3
,
MAP
>
position
=
myMap
.
addAttribute
<
VEC3
,
VERTEX
,
MAP
>
(
"position"
);
Algo
::
Surface
::
Tilings
::
Square
::
Cube
<
PFP2
>
cube
(
myMap
,
2
,
2
,
2
);
cube
.
embedIntoCube
(
position
,
10.0
f
,
10.0
f
,
10.0
f
);
FaceAttribute
<
VEC3
,
MAP
>
color
=
myMap
.
addAttribute
<
VEC3
,
FACE
,
MAP
>
(
"colorFace"
);
foreach_cell
<
FACE
>
(
myMap
,
[
&
](
Face
f
)
{
color
[
f
]
=
(
Algo
::
Surface
::
Geometry
::
faceCentroid
<
PFP2
>
(
myMap
,
f
,
position
)
+
VEC3
(
5
,
5
,
5
))
/
10.0
f
;
});
CGoGNout
.
toStd
(
false
);
CGoGNout
.
toFile
(
"compact_init.csv"
);
myMap
.
dumpCSV
();
std
::
cout
<<
"MAP dumped in compact_init.csv"
<<
std
::
endl
;
// mark central vertex of each face of the cube
CellMarker
<
MAP
,
VERTEX
>
cm
(
myMap
);
foreach_cell
<
VERTEX
>
(
myMap
,
[
&
](
Vertex
v
)
{
int
nb
=
0
;
if
(
position
[
v
][
0
]
==
0.0
f
)
nb
++
;
if
(
position
[
v
][
1
]
==
0.0
f
)
nb
++
;
if
(
position
[
v
][
2
]
==
0.0
f
)
nb
++
;
if
(
nb
==
2
)
cm
.
mark
(
v
);
});
// remove central vertex of each face of the cube
foreach_cell
<
VERTEX
>
(
myMap
,
[
&
](
Vertex
v
)
{
if
(
cm
.
isMarked
(
v
))
{
std
::
cout
<<
"delete vertex"
<<
std
::
endl
;
myMap
.
deleteVertex
(
v
);
}
});
// remove middle points of each edge of the cube
foreach_cell
<
EDGE
>
(
myMap
,
[
&
](
Edge
e
)
{
Vertex
v
(
e
.
dart
);
if
(
myMap
.
vertexDegree
(
v
)
==
2
)
myMap
.
uncutEdge
(
myMap
.
phi_1
(
v
));
});
CGoGNout
.
toFile
(
"compact_before.csv"
);
myMap
.
dumpCSV
();
std
::
cout
<<
"MAP with holes dumped in compact_before.csv"
<<
std
::
endl
;
std
::
cout
<<
"Total area "
<<
Algo
::
Surface
::
Geometry
::
totalArea
<
PFP2
>
(
myMap
,
position
)
<<
std
::
endl
;
myMap
.
compact
();
CGoGNout
.
toFile
(
"compact_after.csv"
);
myMap
.
dumpCSV
();
std
::
cout
<<
"Compacted MAP dumped in compact_after.csv"
<<
std
::
endl
;
std
::
cout
<<
"Total area "
<<
Algo
::
Surface
::
Geometry
::
totalArea
<
PFP2
>
(
myMap
,
position
)
<<
std
::
endl
;
myMap
.
saveMapBin
(
"compacted_map2.map"
);
return
0
;
}
include/Algo/Geometry/area.hpp
View file @
614de846
...
...
@@ -80,7 +80,7 @@ typename PFP::REAL totalArea(typename PFP::MAP& map, const VertexAttribute<typen
{
area
+=
convexFaceArea
<
PFP
>
(
map
,
f
,
position
);
}
,
false
,
thread
);
,
AUTO
,
thread
);
return
area
;
}
...
...
src/Topology/generic/genericmap.cpp
View file @
614de846
...
...
@@ -427,8 +427,8 @@ void GenericMap::dumpAttributesAndMarkers()
void
GenericMap
::
compact
()
{
// compact embedding attribs
std
::
vector
<
std
::
vector
<
unsigned
int
>*
>
oldnews
;
oldnews
.
resize
(
NB_ORBITS
);
std
::
vector
<
std
::
vector
<
unsigned
int
>*
>
oldnews
(
NB_ORBITS
,
NULL
)
;
for
(
unsigned
int
orbit
=
0
;
orbit
<
NB_ORBITS
;
++
orbit
)
{
if
((
orbit
!=
DART
)
&&
(
isOrbitEmbedded
(
orbit
)))
...
...
@@ -455,8 +455,8 @@ void GenericMap::compact()
// delete allocated vectors
for
(
unsigned
int
orbit
=
0
;
orbit
<
NB_ORBITS
;
++
orbit
)
if
(
(
orbit
!=
DART
)
&&
(
isOrbitEmbedded
(
orbit
))
)
delete
[]
oldnews
[
orbit
];
if
(
oldnews
[
orbit
]
!=
NULL
)
delete
oldnews
[
orbit
];
// compact topo (depends on map implementation)
compactTopo
();
...
...
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