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
1
Issues
1
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
Operations
Operations
Incidents
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
CGoGN
CGoGN
Commits
6073f38c
Commit
6073f38c
authored
Aug 23, 2012
by
Sylvain Thery
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
remove bug in clear of attribute container
parent
13b182ec
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
109 additions
and
8 deletions
+109
-8
Apps/Examples/volumeExplorer.cpp
Apps/Examples/volumeExplorer.cpp
+96
-0
Apps/Examples/volumeExplorer.h
Apps/Examples/volumeExplorer.h
+4
-3
src/Container/attributeContainer.cpp
src/Container/attributeContainer.cpp
+9
-5
No files found.
Apps/Examples/volumeExplorer.cpp
View file @
6073f38c
...
...
@@ -31,6 +31,8 @@
#include "Algo/Import/import.h"
#include "Algo/Geometry/volume.h"
#include "Utils/chrono.h"
PFP
::
MAP
myMap
;
VertexAttribute
<
PFP
::
VEC3
>
position
;
...
...
@@ -128,6 +130,82 @@ void MyQT::slider_released()
}
void
MyQT
::
cb_Open
()
{
std
::
string
filters
(
"all (*.*);; trian (*.trian);; ctm (*.ctm);; off (*.off);; ply (*.ply)"
)
;
std
::
string
filename
=
selectFile
(
"Open Mesh"
,
""
,
filters
)
;
if
(
filename
.
empty
())
return
;
myMap
.
clear
(
true
);
std
::
vector
<
std
::
string
>
attrNames
;
size_t
pos
=
filename
.
rfind
(
"."
);
// position of "." in filename
std
::
string
extension
=
filename
.
substr
(
pos
);
if
(
extension
==
std
::
string
(
".tet"
))
{
if
(
!
Algo
::
Import
::
importTet
<
PFP
>
(
myMap
,
filename
,
attrNames
))
{
CGoGNerr
<<
"could not import "
<<
filename
<<
CGoGNendl
;
return
;
}
else
position
=
myMap
.
getAttribute
<
PFP
::
VEC3
,
VERTEX
>
(
attrNames
[
0
])
;
}
if
(
extension
==
std
::
string
(
".node"
))
{
if
(
!
Algo
::
Import
::
importMeshV
<
PFP
>
(
myMap
,
filename
,
attrNames
,
Algo
::
Import
::
ImportVolumique
::
NODE
))
{
std
::
cerr
<<
"could not import "
<<
filename
<<
std
::
endl
;
return
;
}
else
position
=
myMap
.
getAttribute
<
PFP
::
VEC3
,
VERTEX
>
(
attrNames
[
0
])
;
}
if
(
extension
==
std
::
string
(
".off"
))
{
if
(
!
Algo
::
Import
::
importMeshToExtrude
<
PFP
>
(
myMap
,
filename
,
attrNames
))
{
std
::
cerr
<<
"could not import "
<<
filename
<<
std
::
endl
;
return
;
}
else
{
position
=
myMap
.
getAttribute
<
PFP
::
VEC3
,
VERTEX
>
(
attrNames
[
0
])
;
myMap
.
closeMap
();
}
}
color
=
myMap
.
addAttribute
<
PFP
::
VEC3
,
VOLUME
>
(
"color"
);
TraversorCell
<
PFP
::
MAP
,
VOLUME
>
tra
(
myMap
);
float
maxV
=
0.0
f
;
for
(
Dart
d
=
tra
.
begin
();
d
!=
tra
.
end
();
d
=
tra
.
next
())
{
float
v
=
Algo
::
Geometry
::
tetrahedronVolume
<
PFP
>
(
myMap
,
d
,
position
);
color
[
d
]
=
PFP
::
VEC3
(
v
,
0
,
0
);
if
(
v
>
maxV
)
maxV
=
v
;
}
for
(
unsigned
int
i
=
color
.
begin
();
i
!=
color
.
end
();
color
.
next
(
i
))
{
color
[
i
][
0
]
/=
maxV
;
color
[
i
][
2
]
=
1.0
f
-
color
[
i
][
0
];
}
SelectorDartNoBoundary
<
PFP
::
MAP
>
nb
(
myMap
);
m_topo_render
->
updateData
<
PFP
>
(
myMap
,
position
,
0.8
f
,
0.8
f
,
0.8
f
,
nb
);
m_explode_render
->
updateData
<
PFP
>
(
myMap
,
position
,
color
);
updateGL
()
;
}
void
MyQT
::
cb_initGL
()
{
// choose to use GL version 2
...
...
@@ -415,6 +493,24 @@ int main(int argc, char **argv)
dock
.
slider_explode_face
->
setValue
(
80
);
sqt
.
clipping_onoff
(
true
);
Utils
::
Chrono
ch
;
std
::
cout
<<
"Compute Volume ->"
<<
std
::
endl
;
ch
.
start
();
float
vol
=
Algo
::
Geometry
::
totalVolume
<
PFP
>
(
myMap
,
position
);
vol
+=
Algo
::
Geometry
::
totalVolume
<
PFP
>
(
myMap
,
position
);
vol
+=
Algo
::
Geometry
::
totalVolume
<
PFP
>
(
myMap
,
position
);
vol
+=
Algo
::
Geometry
::
totalVolume
<
PFP
>
(
myMap
,
position
);
std
::
cout
<<
ch
.
elapsed
()
<<
" ms val="
<<
vol
<<
std
::
endl
;
ch
.
start
();
vol
=
Algo
::
Geometry
::
Parallel
::
totalVolume
<
PFP
>
(
myMap
,
position
);
vol
+=
Algo
::
Geometry
::
Parallel
::
totalVolume
<
PFP
>
(
myMap
,
position
);
vol
+=
Algo
::
Geometry
::
Parallel
::
totalVolume
<
PFP
>
(
myMap
,
position
);
vol
+=
Algo
::
Geometry
::
Parallel
::
totalVolume
<
PFP
>
(
myMap
,
position
);
std
::
cout
<<
ch
.
elapsed
()
<<
" ms // val="
<<
vol
<<
std
::
endl
;
// et on attend la fin.
return
app
.
exec
();
}
Apps/Examples/volumeExplorer.h
View file @
6073f38c
...
...
@@ -118,9 +118,10 @@ public:
protected:
void
cb_redraw
();
void
cb_initGL
();
void
cb_mouseMove
(
int
buttons
,
int
x
,
int
y
);
void
cb_mousePress
(
int
button
,
int
x
,
int
y
);
void
cb_mouseRelease
(
int
button
,
int
x
,
int
y
);
void
cb_mouseMove
(
int
buttons
,
int
x
,
int
y
);
void
cb_mousePress
(
int
button
,
int
x
,
int
y
);
void
cb_mouseRelease
(
int
button
,
int
x
,
int
y
);
void
cb_Open
();
// slots locaux
...
...
src/Container/attributeContainer.cpp
View file @
6073f38c
...
...
@@ -169,14 +169,14 @@ void AttributeContainer::clear(bool removeAttrib)
m_size
=
0
;
m_maxSize
=
0
;
std
::
vector
<
HoleBlockRef
*>
bf
;
std
::
vector
<
unsigned
int
>
bwf
;
// raz des cases libres
// raz des cases libres
for
(
std
::
vector
<
HoleBlockRef
*>::
iterator
it
=
m_holesBlocks
.
begin
();
it
!=
m_holesBlocks
.
end
();
++
it
)
delete
(
*
it
);
std
::
vector
<
HoleBlockRef
*>
bf
;
m_holesBlocks
.
swap
(
bf
);
std
::
vector
<
unsigned
int
>
bwf
;
m_tableBlocksWithFree
.
swap
(
bwf
);
// detruit les données
...
...
@@ -193,13 +193,17 @@ void AttributeContainer::clear(bool removeAttrib)
m_nbAttributes
=
0
;
// detruit tous les attributs
std
::
vector
<
AttributeMultiVectorGen
*>
amg
;
for
(
std
::
vector
<
AttributeMultiVectorGen
*>::
iterator
it
=
m_tableAttribs
.
begin
();
it
!=
m_tableAttribs
.
end
();
++
it
)
{
if
((
*
it
)
!=
NULL
)
delete
(
*
it
);
}
std
::
vector
<
AttributeMultiVectorGen
*>
amg
;
m_tableAttribs
.
swap
(
amg
);
std
::
vector
<
unsigned
int
>
fi
;
m_freeIndices
.
swap
(
fi
);
}
}
...
...
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