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
192d8ed6
Commit
192d8ed6
authored
May 02, 2013
by
Sylvain Thery
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add volume generic exportMesh function
parent
802b0310
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
481 additions
and
100 deletions
+481
-100
include/Algo/Export/export.h
include/Algo/Export/export.h
+3
-0
include/Algo/Export/exportVol.h
include/Algo/Export/exportVol.h
+15
-6
include/Algo/Export/exportVol.hpp
include/Algo/Export/exportVol.hpp
+34
-38
include/Algo/Import/import2tables.h
include/Algo/Import/import2tables.h
+2
-11
include/Algo/Import/import2tablesVolume.hpp
include/Algo/Import/import2tablesVolume.hpp
+0
-20
include/Algo/Import/importFileTypes.h
include/Algo/Import/importFileTypes.h
+132
-0
include/Algo/Import/importMesh.hpp
include/Algo/Import/importMesh.hpp
+1
-25
include/Algo/Import/importVBGZ.hpp
include/Algo/Import/importVBGZ.hpp
+294
-0
No files found.
include/Algo/Export/export.h
View file @
192d8ed6
...
...
@@ -26,6 +26,9 @@
#define __EXPORT_H__
#include "Topology/generic/attributeHandler.h"
#include "Algo/Import/importFileTypes.h"
#include <stdint.h>
namespace
CGoGN
...
...
include/Algo/Export/exportVol.h
View file @
192d8ed6
...
...
@@ -39,12 +39,21 @@ namespace Volume
namespace
Export
{
/**
* Export a mesh choosing the format according to filename extension
* @param the_map map to be exported
* @param position the position container
* @param filename filename of mesh file
* @return true
*/
template
<
typename
PFP
>
bool
exportMesh
(
typename
PFP
::
MAP
&
map
,
const
VertexAttribute
<
typename
PFP
::
VEC3
>&
position
,
const
std
::
string
&
filename
)
;
/**
* export the map into a .nas (nastran file)
* @param the_map map to be exported
* @param position the position container
* @param filename filename of
ply
file
* @param filename filename of
mesh
file
* @return true
*/
template
<
typename
PFP
>
...
...
@@ -55,7 +64,7 @@ bool exportNAS(typename PFP::MAP& map, const VertexAttribute<typename PFP::VEC3>
* export the map into a vtu file (vtk unstructured grid)
* @param the_map map to be exported
* @param position the position container
* @param
binary write in binary mod
e
* @param
filename filename of mesh fil
e
* @return true
*/
template
<
typename
PFP
>
...
...
@@ -66,7 +75,7 @@ bool exportVTU(typename PFP::MAP& map, const VertexAttribute<typename PFP::VEC3>
* export the map into a .msh (gmesh file)
* @param the_map map to be exported
* @param position the position container
* @param filename filename of
ply
file
* @param filename filename of
mesh
file
* @return true
*/
template
<
typename
PFP
>
...
...
@@ -77,7 +86,7 @@ bool exportMSH(typename PFP::MAP& map, const VertexAttribute<typename PFP::VEC3>
* export the map into a .tet file
* @param the_map map to be exported
* @param position the position container
* @param filename filename of
ply
file
* @param filename filename of
mesh
file
* @return true
*/
template
<
typename
PFP
>
...
...
@@ -88,7 +97,7 @@ bool exportTet(typename PFP::MAP& map, const VertexAttribute<typename PFP::VEC3>
* export the map into a .node/.ele file pair
* @param the_map map to be exported
* @param position the position container
* @param filename filename of
ply
file
* @param filename filename of
mesh
file
* @return true
*/
template
<
typename
PFP
>
...
...
@@ -99,7 +108,7 @@ bool exportNodeEle(typename PFP::MAP& map, const VertexAttribute<typename PFP::V
* export in binary volume file (nb_vert,nb_tetra,nb_hexa, vertices, tetra, hexa)
* @param the_map map to be exported
* @param position the position container
* @param filename filename of
ply
file
* @param filename filename of
mesh
file
*/
template
<
typename
PFP
>
bool
exportVolBinGz
(
typename
PFP
::
MAP
&
map
,
const
VertexAttribute
<
typename
PFP
::
VEC3
>&
position
,
const
char
*
filename
);
...
...
include/Algo/Export/exportVol.hpp
View file @
192d8ed6
...
...
@@ -27,6 +27,7 @@
#include "Topology/generic/traversorCell.h"
#include "Topology/generic/traversor2.h"
#include "Topology/generic/cellmarker.h"
#include "Algo/Import/importFileTypes.h"
namespace
CGoGN
{
...
...
@@ -535,6 +536,8 @@ bool exportNodeEle(typename PFP::MAP& map, const VertexAttribute<typename PFP::V
typedef
typename
PFP
::
VEC3
VEC3
;
std
::
string
base
(
filename
);
size_t
pos
=
base
.
rfind
(
"."
);
base
.
erase
(
pos
);
std
::
string
fnNode
=
base
+
".node"
;
std
::
string
fnEle
=
base
+
".ele"
;
...
...
@@ -588,27 +591,6 @@ bool exportNodeEle(typename PFP::MAP& map, const VertexAttribute<typename PFP::V
degree
++
;
}
// if (degree == 8)
// {
// //CAS HEXAEDRIQUE (ordre 2 quad superposes, le premier en CW)
// Dart e = d;
// Dart f = map.template phi<21121>(d);
// hexa.push_back(indices[f]);
// e = map.phi_1(f);
// hexa.push_back(indices[f]);
// e = map.phi_1(f);
// hexa.push_back(indices[f]);
// e = map.phi_1(f);
// hexa.push_back(indices[f]);
// hexa.push_back(indices[e]);
// e = map.phi1(e);
// hexa.push_back(indices[e]);
// e = map.phi1(e);
// hexa.push_back(indices[e]);
// e = map.phi1(e);
// hexa.push_back(indices[e]);
// }
if
(
degree
==
4
)
{
//CAS TETRAEDRIQUE
...
...
@@ -718,23 +700,6 @@ bool exportVolBinGz(typename PFP::MAP& map, const VertexAttribute<typename PFP::
e
=
map
.
phi1
(
e
);
hexa
.
push_back
(
indices
[
e
]);
// hexa.push_back(indices[e]);
// e = map.phi1(e);
// hexa.push_back(indices[e]);
// e = map.phi1(e);
// hexa.push_back(indices[e]);
// e = map.phi1(e);
// hexa.push_back(indices[e]);
// Dart f = map.template phi<21121>(d);
// hexa.push_back(indices[f]);
// f = map.phi_1(f);
// hexa.push_back(indices[f]);
// f = map.phi_1(f);
// hexa.push_back(indices[f]);
// f = map.phi_1(f);
// hexa.push_back(indices[f]);
}
if
(
degree
==
4
)
...
...
@@ -792,6 +757,37 @@ bool exportVolBinGz(typename PFP::MAP& map, const VertexAttribute<typename PFP::
}
template
<
typename
PFP
>
bool
exportMesh
(
typename
PFP
::
MAP
&
map
,
const
VertexAttribute
<
typename
PFP
::
VEC3
>&
position
,
const
std
::
string
&
filename
)
{
Import
::
ImportType
kind
=
Import
::
getFileType
(
filename
);
// manque TS, OFF ?
switch
(
kind
)
{
case
Import
::
TET
:
return
exportTet
<
PFP
>
(
map
,
position
,
filename
.
c_str
());
break
;
case
Import
::
NODE
:
return
exportNodeEle
<
PFP
>
(
map
,
position
,
filename
.
c_str
());
break
;
case
Import
::
MSH
:
return
exportMSH
<
PFP
>
(
map
,
position
,
filename
.
c_str
());
break
;
case
Import
::
VTU
:
return
exportVTU
<
PFP
>
(
map
,
position
,
filename
.
c_str
());
break
;
case
Import
::
NAS
:
return
exportNAS
<
PFP
>
(
map
,
position
,
filename
.
c_str
());
break
;
case
Import
::
VBGZ
:
return
exportVolBinGz
<
PFP
>
(
map
,
position
,
filename
.
c_str
());
break
;
default:
CGoGNerr
<<
"unknown file format for "
<<
filename
<<
CGoGNendl
;
break
;
}
}
...
...
include/Algo/Import/import2tables.h
View file @
192d8ed6
...
...
@@ -35,6 +35,8 @@
#include "Utils/gzstream.h"
#include "Algo/Import/importFileTypes.h"
#ifdef WITH_ASSIMP
#include "Assimp/assimp.h"
#include "Assimp/aiPostProcess.h"
...
...
@@ -53,15 +55,6 @@ namespace Surface
namespace
Import
{
enum
ImportType
{
UNKNOWNSURFACE
,
TRIAN
,
TRIANBGZ
,
MESHBIN
,
PLY
,
/*PLYPTM, */
PLYSLFgeneric
,
PLYSLFgenericBin
,
OFF
,
OBJ
,
VRML
,
AHEM
,
STL
,
STLB
};
// namespace ImportSurfacique
// {
//
// }
template
<
typename
PFP
>
class
MeshTablesSurface
{
...
...
@@ -151,8 +144,6 @@ namespace Volume
namespace
Import
{
enum
ImportType
{
UNKNOWNVOLUME
,
TET
,
OFF
,
TS
,
MOKA
,
NODE
,
MSH
,
VTU
,
NAS
,
VBGZ
};
template
<
typename
PFP
>
class
MeshTablesVolume
{
...
...
include/Algo/Import/import2tablesVolume.hpp
View file @
192d8ed6
...
...
@@ -34,26 +34,6 @@ namespace Volume
namespace
Import
{
template
<
typename
PFP
>
ImportType
MeshTablesVolume
<
PFP
>::
getFileType
(
const
std
::
string
&
filename
)
{
if
((
filename
.
rfind
(
".tet"
)
!=
std
::
string
::
npos
)
||
(
filename
.
rfind
(
".TET"
)
!=
std
::
string
::
npos
))
return
TET
;
if
((
filename
.
rfind
(
".node"
)
!=
std
::
string
::
npos
)
||
(
filename
.
rfind
(
".NODE"
)
!=
std
::
string
::
npos
))
return
NODE
;
if
((
filename
.
rfind
(
".off"
)
!=
std
::
string
::
npos
)
||
(
filename
.
rfind
(
".OFF"
)
!=
std
::
string
::
npos
))
return
OFF
;
if
((
filename
.
rfind
(
".ts"
)
!=
std
::
string
::
npos
)
||
(
filename
.
rfind
(
".TS"
)
!=
std
::
string
::
npos
))
return
TS
;
if
((
filename
.
rfind
(
".moka"
)
!=
std
::
string
::
npos
)
||
(
filename
.
rfind
(
".MOKA"
)
!=
std
::
string
::
npos
))
return
MOKA
;
return
UNKNOWNVOLUME
;
}
template
<
typename
PFP
>
bool
MeshTablesVolume
<
PFP
>::
importMesh
(
const
std
::
string
&
filename
,
std
::
vector
<
std
::
string
>&
attrNames
,
float
scaleFactor
)
...
...
include/Algo/Import/importFileTypes.h
0 → 100644
View file @
192d8ed6
/*******************************************************************************
* 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 *
* *
*******************************************************************************/
#ifndef _IMPORT_FILE_TYPES_H
#define _IMPORT_FILE_TYPES_H
namespace
CGoGN
{
namespace
Algo
{
namespace
Surface
{
namespace
Import
{
enum
ImportType
{
UNKNOWNSURFACE
,
TRIAN
,
TRIANBGZ
,
MESHBIN
,
PLY
,
/*PLYPTM, */
PLYSLFgeneric
,
PLYSLFgenericBin
,
OFF
,
OBJ
,
VRML
,
AHEM
,
STL
,
STLB
};
inline
ImportType
getFileType
(
const
std
::
string
&
filename
)
{
if
((
filename
.
rfind
(
".trianbgz"
)
!=
std
::
string
::
npos
)
||
(
filename
.
rfind
(
".TRIANBGZ"
)
!=
std
::
string
::
npos
))
return
TRIANBGZ
;
if
((
filename
.
rfind
(
".trian"
)
!=
std
::
string
::
npos
)
||
(
filename
.
rfind
(
".TRIAN"
)
!=
std
::
string
::
npos
))
return
TRIAN
;
if
((
filename
.
rfind
(
".meshbin"
)
!=
std
::
string
::
npos
)
||
(
filename
.
rfind
(
".MESHBIN"
)
!=
std
::
string
::
npos
))
return
MESHBIN
;
/* if ((filename.rfind(".plyptm")!=std::string::npos) || (filename.rfind(".PLYGEN")!=std::string::npos))
return PLYPTM;
*/
if
((
filename
.
rfind
(
".plyPTMextBin"
)
!=
std
::
string
::
npos
)
||
(
filename
.
rfind
(
".plySHrealBin"
)
!=
std
::
string
::
npos
))
return
PLYSLFgenericBin
;
if
((
filename
.
rfind
(
".plyPTMext"
)
!=
std
::
string
::
npos
)
||
(
filename
.
rfind
(
".plySHreal"
)
!=
std
::
string
::
npos
))
return
PLYSLFgeneric
;
if
((
filename
.
rfind
(
".ply"
)
!=
std
::
string
::
npos
)
||
(
filename
.
rfind
(
".PLY"
)
!=
std
::
string
::
npos
))
return
PLY
;
if
((
filename
.
rfind
(
".off"
)
!=
std
::
string
::
npos
)
||
(
filename
.
rfind
(
".OFF"
)
!=
std
::
string
::
npos
))
return
OFF
;
if
((
filename
.
rfind
(
".obj"
)
!=
std
::
string
::
npos
)
||
(
filename
.
rfind
(
".OBJ"
)
!=
std
::
string
::
npos
))
return
OBJ
;
if
((
filename
.
rfind
(
".ahem"
)
!=
std
::
string
::
npos
)
||
(
filename
.
rfind
(
".AHEM"
)
!=
std
::
string
::
npos
))
return
AHEM
;
if
((
filename
.
rfind
(
".stlb"
)
!=
std
::
string
::
npos
)
||
(
filename
.
rfind
(
".STLB"
)
!=
std
::
string
::
npos
))
return
STLB
;
if
((
filename
.
rfind
(
".stl"
)
!=
std
::
string
::
npos
)
||
(
filename
.
rfind
(
".STL"
)
!=
std
::
string
::
npos
))
return
STL
;
return
UNKNOWNSURFACE
;
}
}
}
namespace
Volume
{
namespace
Import
{
enum
ImportType
{
UNKNOWNVOLUME
,
TET
,
OFF
,
TS
,
MOKA
,
NODE
,
MSH
,
VTU
,
NAS
,
VBGZ
};
inline
ImportType
getFileType
(
const
std
::
string
&
filename
)
{
if
((
filename
.
rfind
(
".tet"
)
!=
std
::
string
::
npos
)
||
(
filename
.
rfind
(
".TET"
)
!=
std
::
string
::
npos
))
return
TET
;
if
((
filename
.
rfind
(
".node"
)
!=
std
::
string
::
npos
)
||
(
filename
.
rfind
(
".NODE"
)
!=
std
::
string
::
npos
))
return
NODE
;
if
((
filename
.
rfind
(
".off"
)
!=
std
::
string
::
npos
)
||
(
filename
.
rfind
(
".OFF"
)
!=
std
::
string
::
npos
))
return
OFF
;
if
((
filename
.
rfind
(
".ts"
)
!=
std
::
string
::
npos
)
||
(
filename
.
rfind
(
".TS"
)
!=
std
::
string
::
npos
))
return
TS
;
if
((
filename
.
rfind
(
".moka"
)
!=
std
::
string
::
npos
)
||
(
filename
.
rfind
(
".MOKA"
)
!=
std
::
string
::
npos
))
return
MOKA
;
if
((
filename
.
rfind
(
".node"
)
!=
std
::
string
::
npos
)
||
(
filename
.
rfind
(
".NODE"
)
!=
std
::
string
::
npos
))
return
NODE
;
if
((
filename
.
rfind
(
".msh"
)
!=
std
::
string
::
npos
)
||
(
filename
.
rfind
(
".MSH"
)
!=
std
::
string
::
npos
))
return
MSH
;
if
((
filename
.
rfind
(
".vtu"
)
!=
std
::
string
::
npos
)
||
(
filename
.
rfind
(
".VTU"
)
!=
std
::
string
::
npos
))
return
VTU
;
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
))
return
VBGZ
;
return
UNKNOWNVOLUME
;
}
}
}
}
}
#endif
include/Algo/Import/importMesh.hpp
View file @
192d8ed6
...
...
@@ -516,32 +516,8 @@ bool importMesh(typename PFP::MAP& map, MeshTablesVolume<PFP>& mtv)
template
<
typename
PFP
>
bool
importMesh
(
typename
PFP
::
MAP
&
map
,
const
std
::
string
&
filename
,
std
::
vector
<
std
::
string
>&
attrNames
,
bool
/*mergeCloseVertices*/
)
{
ImportType
kind
=
Volume
::
Import
::
UNKNOWNVOLUME
;
if
((
filename
.
rfind
(
".tet"
)
!=
std
::
string
::
npos
)
||
(
filename
.
rfind
(
".TET"
)
!=
std
::
string
::
npos
))
kind
=
TET
;
if
((
filename
.
rfind
(
".off"
)
!=
std
::
string
::
npos
)
||
(
filename
.
rfind
(
".OFF"
)
!=
std
::
string
::
npos
))
kind
=
OFF
;
if
((
filename
.
rfind
(
".node"
)
!=
std
::
string
::
npos
)
||
(
filename
.
rfind
(
".NODE"
)
!=
std
::
string
::
npos
))
kind
=
NODE
;
if
((
filename
.
rfind
(
".ts"
)
!=
std
::
string
::
npos
)
||
(
filename
.
rfind
(
".TS"
)
!=
std
::
string
::
npos
))
kind
=
TS
;
if
((
filename
.
rfind
(
".msh"
)
!=
std
::
string
::
npos
)
||
(
filename
.
rfind
(
".MSH"
)
!=
std
::
string
::
npos
))
kind
=
MSH
;
if
((
filename
.
rfind
(
".vtu"
)
!=
std
::
string
::
npos
)
||
(
filename
.
rfind
(
".VTU"
)
!=
std
::
string
::
npos
))
kind
=
VTU
;
if
((
filename
.
rfind
(
".nas"
)
!=
std
::
string
::
npos
)
||
(
filename
.
rfind
(
".NAS"
)
!=
std
::
string
::
npos
))
kind
=
NAS
;
if
((
filename
.
rfind
(
".volbgz"
)
!=
std
::
string
::
npos
)
||
(
filename
.
rfind
(
".VOLBGZ"
)
!=
std
::
string
::
npos
))
kind
=
VBGZ
;
ImportType
kind
=
getFileType
(
filename
);
switch
(
kind
)
{
...
...
include/Algo/Import/importVBGZ.hpp
0 → 100644
View file @
192d8ed6
/*******************************************************************************
* 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
importVBGZ
(
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
>()
;
VertexAutoAttribute
<
NoMathIONameAttribute
<
std
::
vector
<
Dart
>
>
>
vecDartsPerVertex
(
map
,
"incidents"
);
//open file
igzstream
fs
(
filename
.
c_str
(),
std
::
ios
::
in
|
std
::
ios
::
binary
);
if
(
!
fs
.
good
())
{
CGoGNerr
<<
"Unable to open file "
<<
filename
<<
CGoGNendl
;
return
false
;
}
unsigned
int
numbers
[
3
];
// read nb of points
fs
.
read
(
reinterpret_cast
<
char
*>
(
numbers
),
3
*
sizeof
(
unsigned
int
));
VEC3
*
bufposi
;
bufposi
=
new
VEC3
[
numbers
[
0
]
];
fs
.
read
(
reinterpret_cast
<
char
*>
(
bufposi
),
numbers
[
0
]
*
sizeof
(
VEC3
));
std
::
vector
<
unsigned
int
>
verticesID
;
verticesID
.
reserve
(
numbers
[
0
]);
for
(
unsigned
int
i
=
0
;
i
<
numbers
[
0
];
++
i
)
{
unsigned
int
id
=
container
.
insertLine
();
position
[
id
]
=
bufposi
[
i
]
*
scaleFactor
;
verticesID
.
push_back
(
id
);
}
delete
bufposi
;
unsigned
int
*
bufTetra
=
NULL
;
if
(
numbers
[
1
]
!=
0
)
{
bufTetra
=
new
unsigned
int
[
4
*
numbers
[
1
]
];
fs
.
read
(
reinterpret_cast
<
char
*>
(
bufTetra
),
4
*
numbers
[
1
]
*
sizeof
(
unsigned
int
));
}
unsigned
int
*
bufHexa
=
NULL
;
if
(
numbers
[
2
]
!=
0
)
{
bufHexa
=
new
unsigned
int
[
8
*
numbers
[
2
]
];
fs
.
read
(
reinterpret_cast
<
char
*>
(
bufHexa
),
8
*
numbers
[
2
]
*
sizeof
(
unsigned
int
));
}
CGoGNout
<<
"nb vertices = "
<<
numbers
[
0
];
DartMarkerNoUnmark
m
(
map
)
;
if
(
numbers
[
1
]
>
0
)
{
//Read and embed all tetrahedrons
for
(
unsigned
int
i
=
0
;
i
<
numbers
[
1
]
;
++
i
)
{
Geom
::
Vec4ui
pt
;
pt
[
0
]
=
bufTetra
[
4
*
i
];
pt
[
1
]
=
bufTetra
[
4
*
i
+
1
];
pt
[
2
]
=
bufTetra
[
4
*
i
+
2
];
pt
[
3
]
=
bufTetra
[
4
*
i
+
3
];
Dart
d
=
Surface
::
Modelisation
::
createTetrahedron
<
PFP
>
(
map
,
false
);
// Embed three "base" vertices
for
(
unsigned
int
j
=
0
;
j
<
3
;
++
j
)
{
FunctorSetEmb
<
typename
PFP
::
MAP
,
VERTEX
>
fsetemb
(
map
,
verticesID
[
pt
[
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
[
j
]]].
push_back
(
dd
);
dd
=
map
.
phi1
(
map
.
phi2
(
dd
));
}
while
(
dd
!=
d
);
d
=
map
.
phi1
(
d
);
}
//Embed the last "top" vertex
d
=
map
.
template
phi
<
211
>(
d
);
//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 vertex 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
}
CGoGNout
<<
" / nb tetra = "
<<
numbers
[
1
];
delete
[]
bufTetra
;
}
if
(
numbers
[
2
]
>
0
)
{
//Read and embed all tetrahedrons
for
(
unsigned
int
i
=
0
;
i
<
numbers
[
2
]
;
++
i
)
{
// one hexa
Geom
::
Vec4ui
pt
;
pt
[
0
]
=
bufHexa
[
8
*
i
];
pt
[
1
]
=
bufHexa
[
8
*
i
+
1
];
pt
[
2
]
=
bufHexa
[
8
*
i
+
2
];
pt
[
3
]
=
bufHexa
[
8
*
i
+
3
];
pt
[
4
]
=
bufHexa
[
8
*
i
+
4
];
pt
[
5
]
=
bufHexa
[
8
*
i
+
5
];
pt
[
6
]
=
bufHexa
[
8
*
i
+
6
];
pt
[
7
]
=
bufHexa
[
8
*
i
+
7
];
Dart
d
=
Surface
::
Modelisation
::
createHexahedron
<
PFP
>
(
map
,
false
);
FunctorSetEmb
<
typename
PFP
::
MAP
,
VERTEX
>
fsetemb
(
map
,
verticesID
[
pt
[
0
]]);
map
.
template
foreach_dart_of_orbit
<
PFP
::
MAP
::
VERTEX_OF_PARENT
>(
d
,
fsetemb
);
Dart
dd
=
d
;
vecDartsPerVertex
[
verticesID
[
pt
[
0
]]].
push_back
(
dd
);
m
.
mark
(
dd
);
dd
=
map
.
phi1
(
map
.
phi2
(
dd
));
vecDartsPerVertex
[
verticesID
[
pt
[
0
]]].
push_back
(
dd
);
m
.
mark
(
dd
);
dd
=
map
.
phi1
(
map
.
phi2
(
dd
));
vecDartsPerVertex
[
verticesID
[
pt
[
0
]]].
push_back
(
dd
);
m
.
mark
(
dd
);
d
=
map
.
phi1
(
d
);
fsetemb
.
changeEmb
(
verticesID
[
pt
[
1
]]);
map
.
template
foreach_dart_of_orbit
<
PFP
::
MAP
::
VERTEX_OF_PARENT
>(
d
,
fsetemb
);
dd
=
d
;
vecDartsPerVertex
[
verticesID
[
pt
[
1
]]].
push_back
(
dd
);
m
.
mark
(
dd
);
dd
=
map
.
phi1
(
map
.
phi2
(
dd
));
vecDartsPerVertex
[
verticesID
[
pt
[
1
]]].
push_back
(
dd
);
m
.
mark
(
dd
);
dd
=
map
.
phi1
(
map
.
phi2
(
dd
));
vecDartsPerVertex
[
verticesID
[
pt
[
1
]]].
push_back
(
dd
);
m
.
mark
(
dd
);
d
=
map
.
phi1
(
d
);
fsetemb
.
changeEmb
(
verticesID
[
pt
[
2
]]);
map
.
template
foreach_dart_of_orbit
<
PFP
::
MAP
::
VERTEX_OF_PARENT
>(
d
,
fsetemb
);
dd
=
d
;