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
KennethVanhoey
CGoGN
Commits
0bd11b96
Commit
0bd11b96
authored
Jan 07, 2014
by
Lionel Untereiner
Browse files
Options
Browse Files
Download
Plain Diff
Merge cgogn.unistra.fr:~/CGoGN
parents
a177c353
7e142b2b
Changes
2
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
656 additions
and
442 deletions
+656
-442
include/Algo/Import/import.hpp
include/Algo/Import/import.hpp
+511
-432
include/Algo/Import/import2tablesVolume.hpp
include/Algo/Import/import2tablesVolume.hpp
+145
-10
No files found.
include/Algo/Import/import.hpp
View file @
0bd11b96
This diff is collapsed.
Click to expand it.
include/Algo/Import/import2tablesVolume.hpp
View file @
0bd11b96
...
...
@@ -48,24 +48,27 @@ bool MeshTablesVolume<PFP>::importMesh(const std::string& filename, std::vector<
case
TET
:
return
importTet
(
filename
,
attrNames
);
break
;
case
NODE
:
case
OFF
:
{
size_t
pos
=
filename
.
rfind
(
"."
);
std
::
string
fileEle
=
filename
;
fileEle
.
erase
(
pos
);
fileEle
.
append
(
".ele"
);
return
import
Node
WithELERegions
(
filename
,
fileEle
,
attrNames
);
break
;
return
import
OFF
WithELERegions
(
filename
,
fileEle
,
attrNames
);
break
;
}
case
OFF
:
case
NODE
:
{
size_t
pos
=
filename
.
rfind
(
"."
);
std
::
string
fileEle
=
filename
;
fileEle
.
erase
(
pos
);
fileEle
.
append
(
".ele"
);
return
import
OFF
WithELERegions
(
filename
,
fileEle
,
attrNames
);
break
;
return
import
Node
WithELERegions
(
filename
,
fileEle
,
attrNames
);
break
;
}
case
TETMESH
:
return
importTetmesh
(
filename
,
attrNames
);
break
;
case
TS
:
return
importTs
(
filename
,
attrNames
);
break
;
...
...
@@ -81,9 +84,6 @@ bool MeshTablesVolume<PFP>::importMesh(const std::string& filename, std::vector<
case
VBGZ
:
//return importVBGZ>(filename, attrNames);
break
;
case
TETMESH
:
return
importTetmesh
(
filename
,
attrNames
);
break
;
// case ImportVolumique::MOKA:
// return importMoka(filename,attrNames);
// break;
...
...
@@ -701,11 +701,146 @@ bool MeshTablesVolume<PFP>::importTs(const std::string& filename, std::vector<st
return
true
;
}
template
<
typename
PFP
>
bool
MeshTablesVolume
<
PFP
>::
importMSH
(
const
std
::
string
&
filename
,
std
::
vector
<
std
::
string
>&
attrNames
)
{
//
VertexAttribute
<
VEC3
>
position
=
m_map
.
template
getAttribute
<
VEC3
,
VERTEX
>(
"position"
)
;
}
// namespace Import
if
(
!
position
.
isValid
())
position
=
m_map
.
template
addAttribute
<
VEC3
,
VERTEX
>(
"position"
)
;
attrNames
.
push_back
(
position
.
name
())
;
//
AttributeContainer
&
container
=
m_map
.
template
getAttributeContainer
<
VERTEX
>()
;
// 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
;
unsigned
int
nbv
=
0
;
//read $NODE
std
::
getline
(
fp
,
ligne
);
// reading number of vertices
std
::
getline
(
fp
,
ligne
);
std
::
stringstream
oss
(
ligne
);
oss
>>
m_nbVertices
;
std
::
map
<
unsigned
int
,
unsigned
int
>
verticesMapID
;
for
(
unsigned
int
i
=
0
;
i
<
m_nbVertices
;
++
i
)
{
do
{
std
::
getline
(
fp
,
ligne
);
}
while
(
ligne
.
size
()
==
0
);
std
::
stringstream
oss
(
ligne
);
unsigned
int
pipo
;
float
x
,
y
,
z
;
oss
>>
pipo
;
oss
>>
x
;
oss
>>
y
;
oss
>>
z
;
VEC3
pos
(
x
,
y
,
z
);
unsigned
int
id
=
container
.
insertLine
();
position
[
id
]
=
pos
;
verticesMapID
.
insert
(
std
::
pair
<
unsigned
int
,
unsigned
int
>
(
pipo
,
id
));
}
// ENNODE
std
::
getline
(
fp
,
ligne
);
// ELM
std
::
getline
(
fp
,
ligne
);
// reading number of elements
std
::
getline
(
fp
,
ligne
);
std
::
stringstream
oss2
(
ligne
);
oss2
>>
m_nbVolumes
;
//Read and embed all tetrahedrons
for
(
unsigned
int
i
=
0
;
i
<
m_nbVolumes
;
++
i
)
{
do
{
std
::
getline
(
fp
,
ligne
);
}
while
(
ligne
.
size
()
==
0
);
std
::
stringstream
oss
(
ligne
);
unsigned
int
pipo
,
type_elm
,
nb
;
oss
>>
pipo
;
oss
>>
type_elm
;
oss
>>
pipo
;
oss
>>
pipo
;
oss
>>
nb
;
if
((
type_elm
==
4
)
&&
(
nb
==
4
))
{
m_nbFaces
.
push_back
(
4
);
int
s0
,
s1
,
s2
,
s3
;
oss
>>
s0
;
oss
>>
s1
;
oss
>>
s2
;
oss
>>
s3
;
typename
PFP
::
VEC3
P
=
position
[
verticesID
[
s0
]];
typename
PFP
::
VEC3
A
=
position
[
verticesID
[
s1
]];
typename
PFP
::
VEC3
B
=
position
[
verticesID
[
s2
]];
typename
PFP
::
VEC3
C
=
position
[
verticesID
[
s3
]];
if
(
Geom
::
testOrientation3D
<
typename
PFP
::
VEC3
>
(
P
,
A
,
B
,
C
)
==
Geom
::
UNDER
)
{
unsigned
int
ui
=
s0
;
s0
=
s3
;
s3
=
s2
;
s2
=
s1
;
s1
=
ui
;
}
//if regions are defined use this number
oss
>>
nbe
;
//ignored here
m_emb
.
push_back
(
verticesID
[
s0
]);
m_emb
.
push_back
(
verticesID
[
s1
]);
m_emb
.
push_back
(
verticesID
[
s2
]);
m_emb
.
push_back
(
verticesID
[
s3
]);
}
else
if
((
type_elm
==
5
)
&&
(
nb
==
8
))
{
m_nbFaces
.
push_back
(
8
);
}
else
{
for
(
unsigned
int
j
=
0
;
j
<
nb
;
++
j
)
{
unsigned
int
v
;
fp
>>
v
;
}
}
}
}
}
// namespace Import
}
// namespace Volume
}
// 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