Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
O
ogs
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Dmitri Naumov
ogs
Commits
765b79a4
Commit
765b79a4
authored
9 years ago
by
Tom Fischer
Committed by
Dmitri Naumov
9 years ago
Browse files
Options
Downloads
Patches
Plain Diff
[FileIO] GMSInterface: Using PropertyVector instead of Element::_value for material ids.
parent
dd6c404a
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
FileIO/GMSInterface.cpp
+16
-4
16 additions, 4 deletions
FileIO/GMSInterface.cpp
with
16 additions
and
4 deletions
FileIO/GMSInterface.cpp
+
16
−
4
View file @
765b79a4
...
@@ -240,6 +240,7 @@ MeshLib::Mesh* GMSInterface::readGMS3DMMesh(const std::string &filename)
...
@@ -240,6 +240,7 @@ MeshLib::Mesh* GMSInterface::readGMS3DMMesh(const std::string &filename)
INFO
(
"GMSInterface::readGMS3DMMesh(): Read GMS-3DM mesh."
);
INFO
(
"GMSInterface::readGMS3DMMesh(): Read GMS-3DM mesh."
);
std
::
vector
<
MeshLib
::
Node
*>
nodes
;
std
::
vector
<
MeshLib
::
Node
*>
nodes
;
std
::
vector
<
MeshLib
::
Element
*>
elements
;
std
::
vector
<
MeshLib
::
Element
*>
elements
;
std
::
vector
<
int
>
mat_ids
;
std
::
map
<
unsigned
,
unsigned
>
id_map
;
std
::
map
<
unsigned
,
unsigned
>
id_map
;
// elements are listed before nodes in 3dm-format, therefore
// elements are listed before nodes in 3dm-format, therefore
...
@@ -280,7 +281,8 @@ MeshLib::Mesh* GMSInterface::readGMS3DMMesh(const std::string &filename)
...
@@ -280,7 +281,8 @@ MeshLib::Mesh* GMSInterface::readGMS3DMMesh(const std::string &filename)
for
(
unsigned
k
(
0
);
k
<
6
;
k
++
)
{
for
(
unsigned
k
(
0
);
k
<
6
;
k
++
)
{
prism_nodes
[
k
]
=
nodes
[
id_map
.
find
(
node_idx
[
k
])
->
second
];
prism_nodes
[
k
]
=
nodes
[
id_map
.
find
(
node_idx
[
k
])
->
second
];
}
}
elements
.
push_back
(
new
MeshLib
::
Prism
(
prism_nodes
,
mat_id
));
elements
.
push_back
(
new
MeshLib
::
Prism
(
prism_nodes
));
mat_ids
.
push_back
(
mat_id
);
}
}
else
if
(
element_id
.
compare
(
"E4T"
)
==
0
)
// Tet
else
if
(
element_id
.
compare
(
"E4T"
)
==
0
)
// Tet
{
{
...
@@ -290,7 +292,8 @@ MeshLib::Mesh* GMSInterface::readGMS3DMMesh(const std::string &filename)
...
@@ -290,7 +292,8 @@ MeshLib::Mesh* GMSInterface::readGMS3DMMesh(const std::string &filename)
for
(
unsigned
k
(
0
);
k
<
4
;
k
++
)
{
for
(
unsigned
k
(
0
);
k
<
4
;
k
++
)
{
tet_nodes
[
k
]
=
nodes
[
id_map
.
find
(
node_idx
[
k
])
->
second
];
tet_nodes
[
k
]
=
nodes
[
id_map
.
find
(
node_idx
[
k
])
->
second
];
}
}
elements
.
push_back
(
new
MeshLib
::
Tet
(
tet_nodes
,
mat_id
));
elements
.
push_back
(
new
MeshLib
::
Tet
(
tet_nodes
));
mat_ids
.
push_back
(
mat_id
);
}
}
else
if
((
element_id
.
compare
(
"E4P"
)
==
0
)
||
(
element_id
.
compare
(
"E5P"
)
==
0
))
// Pyramid (both do exist for some reason)
else
if
((
element_id
.
compare
(
"E4P"
)
==
0
)
||
(
element_id
.
compare
(
"E5P"
)
==
0
))
// Pyramid (both do exist for some reason)
{
{
...
@@ -300,7 +303,8 @@ MeshLib::Mesh* GMSInterface::readGMS3DMMesh(const std::string &filename)
...
@@ -300,7 +303,8 @@ MeshLib::Mesh* GMSInterface::readGMS3DMMesh(const std::string &filename)
for
(
unsigned
k
(
0
);
k
<
5
;
k
++
)
{
for
(
unsigned
k
(
0
);
k
<
5
;
k
++
)
{
pyramid_nodes
[
k
]
=
nodes
[
id_map
.
find
(
node_idx
[
k
])
->
second
];
pyramid_nodes
[
k
]
=
nodes
[
id_map
.
find
(
node_idx
[
k
])
->
second
];
}
}
elements
.
push_back
(
new
MeshLib
::
Pyramid
(
pyramid_nodes
,
mat_id
));
elements
.
push_back
(
new
MeshLib
::
Pyramid
(
pyramid_nodes
));
mat_ids
.
push_back
(
mat_id
);
}
}
else
if
(
element_id
.
compare
(
"ND "
)
==
0
)
// Node
else
if
(
element_id
.
compare
(
"ND "
)
==
0
)
// Node
...
@@ -317,7 +321,15 @@ MeshLib::Mesh* GMSInterface::readGMS3DMMesh(const std::string &filename)
...
@@ -317,7 +321,15 @@ MeshLib::Mesh* GMSInterface::readGMS3DMMesh(const std::string &filename)
INFO
(
"GMSInterface::readGMS3DMMesh():
\t
finished."
);
INFO
(
"GMSInterface::readGMS3DMMesh():
\t
finished."
);
const
std
::
string
mesh_name
=
BaseLib
::
extractBaseNameWithoutExtension
(
filename
);
const
std
::
string
mesh_name
=
BaseLib
::
extractBaseNameWithoutExtension
(
filename
);
return
new
MeshLib
::
Mesh
(
mesh_name
,
nodes
,
elements
);
MeshLib
::
Mesh
*
mesh
(
new
MeshLib
::
Mesh
(
mesh_name
,
nodes
,
elements
));
auto
opt_pv
=
mesh
->
getProperties
().
createNewPropertyVector
<
int
>
(
"MaterialIDs"
,
MeshLib
::
MeshItemType
::
Cell
);
if
(
opt_pv
)
{
auto
pv
=
*
opt_pv
;
pv
.
resize
(
mat_ids
.
size
());
std
::
copy
(
mat_ids
.
cbegin
(),
mat_ids
.
cend
(),
pv
.
begin
());
}
return
mesh
;
}
}
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment