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
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Hurstel
CGoGN
Commits
e6466e4e
Commit
e6466e4e
authored
May 16, 2013
by
Sylvain Thery
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add import tetmesh file
parent
cfaebffc
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
288 additions
and
11 deletions
+288
-11
README.TXT
README.TXT
+2
-2
include/Algo/Import/import.h
include/Algo/Import/import.h
+7
-1
include/Algo/Import/importFileTypes.h
include/Algo/Import/importFileTypes.h
+8
-2
include/Algo/Import/importMesh.hpp
include/Algo/Import/importMesh.hpp
+8
-0
include/Algo/Import/importTet.hpp
include/Algo/Import/importTet.hpp
+3
-6
include/Algo/Import/importTetmesh.hpp
include/Algo/Import/importTetmesh.hpp
+260
-0
No files found.
README.TXT
View file @
e6466e4e
...
...
@@ -2,7 +2,7 @@
Dépendences Linux:
installer les paquets suivants:
cmake libXi-dev libXmu-dev libglew-dev libxml2-dev libboost-all-dev zlib1g-dev qt4-designer qt4-dev-tools uuid-dev libgsl0-dev libsuitesparse-dev
cmake
cmake-curses-gui
libXi-dev libXmu-dev libglew-dev libxml2-dev libboost-all-dev zlib1g-dev qt4-designer qt4-dev-tools uuid-dev libgsl0-dev libsuitesparse-dev
Pour compiler CGoGN:
...
...
@@ -46,7 +46,7 @@ https://iggservis.u-strasbg.fr/Data/data.zip
Linux dependencies:
install the following packages:
c
cmake
libXi-dev libXmu-dev libglew-dev libxml2-dev libboost-all-dev zlib1g-dev qt4-designer qt4-dev-tools uuid-dev libgsl0-dev libsuitesparse-dev
c
make cmake-curses-gui
libXi-dev libXmu-dev libglew-dev libxml2-dev libboost-all-dev zlib1g-dev qt4-designer qt4-dev-tools uuid-dev libgsl0-dev libsuitesparse-dev
To compile CGoGN:
- first compile third-party libraries:
...
...
include/Algo/Import/import.h
View file @
e6466e4e
...
...
@@ -130,6 +130,12 @@ bool importNAS(typename PFP::MAP& the_map, const std::string& filename, std::vec
template
<
typename
PFP
>
bool
importVBGZ
(
typename
PFP
::
MAP
&
the_map
,
const
std
::
string
&
filename
,
std
::
vector
<
std
::
string
>&
attrNames
,
float
scaleFactor
=
1.0
f
);
template
<
typename
PFP
>
bool
importTetmesh
(
typename
PFP
::
MAP
&
the_map
,
const
std
::
string
&
filename
,
std
::
vector
<
std
::
string
>&
attrNames
,
float
scaleFactor
=
1.0
f
);
template
<
typename
PFP
>
bool
importOVM
(
typename
PFP
::
MAP
&
the_map
,
const
std
::
string
&
filename
,
std
::
vector
<
std
::
string
>&
attrNames
,
float
scaleFactor
=
1.0
f
);
}
// Import
...
...
@@ -152,7 +158,7 @@ bool importVBGZ(typename PFP::MAP& the_map, const std::string& filename, std::ve
#include "Algo/Import/importVTU.hpp"
#include "Algo/Import/importNAS.hpp"
#include "Algo/Import/importVBGZ.hpp"
#include "Algo/Import/importTetmesh.hpp"
#include "Algo/Import/importChoupi.hpp"
...
...
include/Algo/Import/importFileTypes.h
View file @
e6466e4e
...
...
@@ -85,10 +85,13 @@ namespace Volume
{
namespace
Import
{
enum
ImportType
{
UNKNOWNVOLUME
,
TET
,
OFF
,
TS
,
MOKA
,
NODE
,
MSH
,
VTU
,
NAS
,
VBGZ
};
enum
ImportType
{
UNKNOWNVOLUME
,
TET
,
OFF
,
TS
,
MOKA
,
NODE
,
MSH
,
VTU
,
NAS
,
VBGZ
,
TETMESH
/*, OVM*/
};
inline
ImportType
getFileType
(
const
std
::
string
&
filename
)
{
if
((
filename
.
rfind
(
".tetmesh"
)
!=
std
::
string
::
npos
)
||
(
filename
.
rfind
(
".TETMESH"
)
!=
std
::
string
::
npos
))
return
TETMESH
;
if
((
filename
.
rfind
(
".tet"
)
!=
std
::
string
::
npos
)
||
(
filename
.
rfind
(
".TET"
)
!=
std
::
string
::
npos
))
return
TET
;
...
...
@@ -116,9 +119,12 @@ namespace Import
if
((
filename
.
rfind
(
".nas"
)
!=
std
::
string
::
npos
)
||
(
filename
.
rfind
(
".NAS"
)
!=
std
::
string
::
npos
))
return
NAS
;
if
((
filename
.
rfind
(
".vbgz"
)
!=
std
::
string
::
npos
)
||
(
filename
.
rfind
(
".
vbgz
"
)
!=
std
::
string
::
npos
))
if
((
filename
.
rfind
(
".vbgz"
)
!=
std
::
string
::
npos
)
||
(
filename
.
rfind
(
".
VBGZ
"
)
!=
std
::
string
::
npos
))
return
VBGZ
;
// if ((filename.rfind(".ovm")!=std::string::npos) || (filename.rfind(".OVM")!=std::string::npos))
// return OVM;
return
UNKNOWNVOLUME
;
}
...
...
include/Algo/Import/importMesh.hpp
View file @
e6466e4e
...
...
@@ -539,6 +539,14 @@ bool importMesh(typename PFP::MAP& map, const std::string& filename, std::vector
return
importVBGZ
<
PFP
>
(
map
,
filename
,
attrNames
,
1.0
f
);
break
;
case
TETMESH
:
return
importTetmesh
<
PFP
>
(
map
,
filename
,
attrNames
,
1.0
f
);
break
;
// case OVM:
// return importOVM<PFP>(map, filename, attrNames, 1.0f);
// break;
case
OFF
:
{
...
...
include/Algo/Import/importTet.hpp
View file @
e6466e4e
...
...
@@ -61,6 +61,7 @@ bool importTet(typename PFP::MAP& map, const std::string& filename, std::vector<
std
::
string
ligne
;
unsigned
int
nbv
,
nbt
;
// reading number of vertices
std
::
getline
(
fp
,
ligne
);
std
::
stringstream
oss
(
ligne
);
...
...
@@ -79,7 +80,7 @@ bool importTet(typename PFP::MAP& map, const std::string& filename, std::vector<
do
{
std
::
getline
(
fp
,
ligne
);
}
while
(
ligne
.
size
()
==
0
);
}
while
(
ligne
.
size
()
==
0
);
std
::
stringstream
oss
(
ligne
);
...
...
@@ -87,6 +88,7 @@ bool importTet(typename PFP::MAP& map, const std::string& filename, std::vector<
oss
>>
x
;
oss
>>
y
;
oss
>>
z
;
// TODO : if required read other vertices attributes here
VEC3
pos
(
x
*
scaleFactor
,
y
*
scaleFactor
,
z
*
scaleFactor
);
...
...
@@ -145,16 +147,11 @@ bool importTet(typename PFP::MAP& map, const std::string& filename, std::vector<
}
}
oss
>>
pt
[
0
];
oss
>>
pt
[
1
+
invertTetra
];
oss
>>
pt
[
2
-
invertTetra
];
oss
>>
pt
[
3
];
//if regions are defined use this number
oss
>>
nbe
;
//ignored here
// Embed three "base" vertices
for
(
unsigned
int
j
=
0
;
j
<
3
;
++
j
)
{
...
...
include/Algo/Import/importTetmesh.hpp
0 → 100644
View file @
e6466e4e
/*******************************************************************************
* 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 "Algo/Modelisation/polyhedron.h"
#include "Geometry/orientation.h"
#include <vector>
namespace
CGoGN
{
namespace
Algo
{
namespace
Volume
{
namespace
Import
{
template
<
typename
PFP
>
bool
importTetmesh
(
typename
PFP
::
MAP
&
map
,
const
std
::
string
&
filename
,
std
::
vector
<
std
::
string
>&
attrNames
,
float
scaleFactor
)
{
typedef
typename
PFP
::
VEC3
VEC3
;
VertexAttribute
<
VEC3
>
position
=
map
.
template
addAttribute
<
VEC3
,
VERTEX
>(
"position"
)
;
attrNames
.
push_back
(
position
.
name
())
;
AttributeContainer
&
container
=
map
.
template
getAttributeContainer
<
VERTEX
>()
;
unsigned
int
nbVertices
=
0
,
nbVolumes
=
0
;
VertexAutoAttribute
<
NoTypeNameAttribute
<
std
::
vector
<
Dart
>
>
>
vecDartsPerVertex
(
map
,
"incidents"
);
//open file
std
::
ifstream
fp
(
filename
.
c_str
(),
std
::
ios
::
in
);
if
(
!
fp
.
good
())
{
CGoGNerr
<<
"Unable to open file "
<<
filename
<<
CGoGNendl
;
return
false
;
}
std
::
string
ligne
;
fp
>>
ligne
;
std
::
cout
<<
"READ: "
<<
ligne
<<
std
::
endl
;
if
(
ligne
!=
"Vertices"
)
CGoGNerr
<<
"Warning tetmesh file problem"
<<
CGoGNendl
;
fp
>>
nbVertices
;
std
::
cout
<<
"READ: "
<<
nbVertices
<<
std
::
endl
;
std
::
getline
(
fp
,
ligne
);
std
::
cout
<<
"READ: "
<<
ligne
<<
std
::
endl
;
// // reading number of vertices
// std::getline (fp, ligne);
// std::stringstream oss(ligne);
// oss >> nbv;
// // reading number of tetrahedra
// std::getline (fp, ligne);
// std::stringstream oss2(ligne);
// oss2 >> nbt;
//reading vertices
std
::
vector
<
unsigned
int
>
verticesID
;
verticesID
.
reserve
(
nbVertices
+
1
);
verticesID
.
push_back
(
0xffffffff
);
for
(
unsigned
int
i
=
0
;
i
<
nbVertices
;
++
i
)
{
do
{
std
::
getline
(
fp
,
ligne
);
}
while
(
ligne
.
size
()
==
0
);
std
::
stringstream
oss
(
ligne
);
float
x
,
y
,
z
;
oss
>>
x
;
oss
>>
y
;
oss
>>
z
;
// TODO : if required read other vertices attributes here
VEC3
pos
(
x
*
scaleFactor
,
y
*
scaleFactor
,
z
*
scaleFactor
);
unsigned
int
id
=
container
.
insertLine
();
position
[
id
]
=
pos
;
verticesID
.
push_back
(
id
);
}
fp
>>
ligne
;
if
(
ligne
!=
"Tetrahedra"
)
CGoGNerr
<<
"Warning tetmesh file problem"
<<
CGoGNendl
;
std
::
cout
<<
"READ: "
<<
ligne
<<
std
::
endl
;
fp
>>
nbVolumes
;
std
::
cout
<<
"READ: "
<<
nbVolumes
<<
std
::
endl
;
std
::
getline
(
fp
,
ligne
);
std
::
cout
<<
"READ: "
<<
ligne
<<
std
::
endl
;
CGoGNout
<<
"nb points = "
<<
nbVertices
<<
" / nb tet = "
<<
nbVolumes
<<
CGoGNendl
;
DartMarkerNoUnmark
m
(
map
)
;
unsigned
int
invertTetra
=
0
;
//Read and embed all tetrahedrons
for
(
unsigned
int
i
=
0
;
i
<
nbVolumes
;
++
i
)
{
//start one tetra
do
{
std
::
getline
(
fp
,
ligne
);
}
while
(
ligne
.
size
()
==
0
);
std
::
stringstream
oss
(
ligne
);
Dart
d
=
Surface
::
Modelisation
::
createTetrahedron
<
PFP
>
(
map
,
false
);
Geom
::
Vec4ui
pt
;
if
(
i
==
0
)
{
oss
>>
pt
[
0
];
oss
>>
pt
[
1
];
oss
>>
pt
[
2
];
oss
>>
pt
[
3
];
typename
PFP
::
VEC3
P
=
position
[
verticesID
[
pt
[
0
]]];
typename
PFP
::
VEC3
A
=
position
[
verticesID
[
pt
[
1
]]];
typename
PFP
::
VEC3
B
=
position
[
verticesID
[
pt
[
2
]]];
typename
PFP
::
VEC3
C
=
position
[
verticesID
[
pt
[
3
]]];
if
(
Geom
::
testOrientation3D
<
typename
PFP
::
VEC3
>
(
P
,
A
,
B
,
C
)
==
Geom
::
OVER
)
{
invertTetra
=
1
;
unsigned
int
ui
=
pt
[
1
];
pt
[
1
]
=
pt
[
2
];
pt
[
2
]
=
ui
;
}
}
oss
>>
pt
[
0
];
oss
>>
pt
[
1
+
invertTetra
];
oss
>>
pt
[
2
-
invertTetra
];
oss
>>
pt
[
3
];
// Embed three "base" vertices
for
(
unsigned
int
j
=
0
;
j
<
3
;
++
j
)
{
FunctorSetEmb
<
typename
PFP
::
MAP
,
VERTEX
>
fsetemb
(
map
,
verticesID
[
pt
[
2
-
j
]]);
map
.
template
foreach_dart_of_orbit
<
PFP
::
MAP
::
VERTEX_OF_PARENT
>(
d
,
fsetemb
);
//store darts per vertices to optimize reconstruction
Dart
dd
=
d
;
do
{
m
.
mark
(
dd
)
;
vecDartsPerVertex
[
verticesID
[
pt
[
2
-
j
]]].
push_back
(
dd
);
dd
=
map
.
phi1
(
map
.
phi2
(
dd
));
}
while
(
dd
!=
d
);
d
=
map
.
phi1
(
d
);
}
//Embed the last "top" vertex
d
=
map
.
phi_1
(
map
.
phi2
(
d
));
FunctorSetEmb
<
typename
PFP
::
MAP
,
VERTEX
>
fsetemb
(
map
,
verticesID
[
pt
[
3
]]);
map
.
template
foreach_dart_of_orbit
<
PFP
::
MAP
::
VERTEX_OF_PARENT
>(
d
,
fsetemb
);
//store darts per vertices to optimize reconstruction
Dart
dd
=
d
;
do
{
m
.
mark
(
dd
)
;
vecDartsPerVertex
[
verticesID
[
pt
[
3
]]].
push_back
(
dd
);
dd
=
map
.
phi1
(
map
.
phi2
(
dd
));
}
while
(
dd
!=
d
);
//end of tetra
}
//Association des phi3
unsigned
int
nbBoundaryFaces
=
0
;
for
(
Dart
d
=
map
.
begin
();
d
!=
map
.
end
();
map
.
next
(
d
))
{
if
(
m
.
isMarked
(
d
))
{
std
::
vector
<
Dart
>&
vec
=
vecDartsPerVertex
[
map
.
phi1
(
d
)];
Dart
good_dart
=
NIL
;
for
(
typename
std
::
vector
<
Dart
>::
iterator
it
=
vec
.
begin
();
it
!=
vec
.
end
()
&&
good_dart
==
NIL
;
++
it
)
{
if
(
map
.
template
getEmbedding
<
VERTEX
>(
map
.
phi1
(
*
it
))
==
map
.
template
getEmbedding
<
VERTEX
>(
d
)
&&
map
.
template
getEmbedding
<
VERTEX
>(
map
.
phi_1
(
*
it
))
==
map
.
template
getEmbedding
<
VERTEX
>(
map
.
phi_1
(
d
))
/*&&
map.template getEmbedding<VERTEX>(*it) == map.template getEmbedding<VERTEX>(map.phi1(d)) */
)
{
good_dart
=
*
it
;
}
}
if
(
good_dart
!=
NIL
)
{
map
.
sewVolumes
(
d
,
good_dart
,
false
);
m
.
template
unmarkOrbit
<
FACE
>(
d
);
}
else
{
m
.
unmarkOrbit
<
PFP
::
MAP
::
FACE_OF_PARENT
>
(
d
);
++
nbBoundaryFaces
;
}
}
}
if
(
nbBoundaryFaces
>
0
)
{
std
::
cout
<<
"closing"
<<
std
::
endl
;
map
.
closeMap
();
CGoGNout
<<
"Map closed ("
<<
nbBoundaryFaces
<<
" boundary faces)"
<<
CGoGNendl
;
}
fp
.
close
();
return
true
;
}
}
// namespace Import
}
}
// namespace Algo
}
// namespace CGoGN
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