Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
D
dynamic
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
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
MostafaMollaali
dynamic
Commits
4c68b26b
Commit
4c68b26b
authored
5 years ago
by
Dmitri Naumov
Browse files
Options
Downloads
Patches
Plain Diff
[MeL] Move addElementToSurface out.
parent
cb0186d2
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
MeshLib/convertMeshToGeo.cpp
+26
-24
26 additions, 24 deletions
MeshLib/convertMeshToGeo.cpp
with
26 additions
and
24 deletions
MeshLib/convertMeshToGeo.cpp
+
26
−
24
View file @
4c68b26b
...
@@ -48,6 +48,31 @@ std::string convertMeshNodesToGeoPoints(MeshLib::Mesh const& mesh,
...
@@ -48,6 +48,31 @@ std::string convertMeshNodesToGeoPoints(MeshLib::Mesh const& mesh,
geo_objects
.
addPointVec
(
std
::
move
(
points
),
geoobject_name
,
nullptr
,
eps
);
geo_objects
.
addPointVec
(
std
::
move
(
points
),
geoobject_name
,
nullptr
,
eps
);
return
geoobject_name
;
return
geoobject_name
;
}
}
void
addElementToSurface
(
MeshLib
::
Element
const
&
e
,
std
::
vector
<
std
::
size_t
>
const
&
id_map
,
GeoLib
::
Surface
&
surface
)
{
if
(
e
.
getGeomType
()
==
MeshLib
::
MeshElemType
::
TRIANGLE
)
{
surface
.
addTriangle
(
id_map
[
e
.
getNodeIndex
(
0
)],
id_map
[
e
.
getNodeIndex
(
1
)],
id_map
[
e
.
getNodeIndex
(
2
)]);
return
;
}
if
(
e
.
getGeomType
()
==
MeshLib
::
MeshElemType
::
QUAD
)
{
surface
.
addTriangle
(
id_map
[
e
.
getNodeIndex
(
0
)],
id_map
[
e
.
getNodeIndex
(
1
)],
id_map
[
e
.
getNodeIndex
(
2
)]);
surface
.
addTriangle
(
id_map
[
e
.
getNodeIndex
(
0
)],
id_map
[
e
.
getNodeIndex
(
2
)],
id_map
[
e
.
getNodeIndex
(
3
)]);
return
;
}
// all other element types are ignored (i.e. lines)
};
}
// namespace
}
// namespace
namespace
MeshLib
namespace
MeshLib
...
@@ -99,36 +124,13 @@ bool convertMeshToGeo(const MeshLib::Mesh& mesh,
...
@@ -99,36 +124,13 @@ bool convertMeshToGeo(const MeshLib::Mesh& mesh,
const
std
::
vector
<
std
::
size_t
>&
id_map
(
const
std
::
vector
<
std
::
size_t
>&
id_map
(
geo_objects
.
getPointVecObj
(
geoobject_name
)
->
getIDMap
());
geo_objects
.
getPointVecObj
(
geoobject_name
)
->
getIDMap
());
geo_objects
.
getPointVecObj
(
mesh_name
)
->
getIDMap
());
auto
add_element_to_surface
=
[
&
id_map
](
MeshLib
::
Element
const
&
e
,
GeoLib
::
Surface
&
surface
)
{
if
(
e
.
getGeomType
()
==
MeshElemType
::
TRIANGLE
)
{
surface
.
addTriangle
(
id_map
[
e
.
getNodeIndex
(
0
)],
id_map
[
e
.
getNodeIndex
(
1
)],
id_map
[
e
.
getNodeIndex
(
2
)]);
return
;
}
if
(
e
.
getGeomType
()
==
MeshElemType
::
QUAD
)
{
surface
.
addTriangle
(
id_map
[
e
.
getNodeIndex
(
0
)],
id_map
[
e
.
getNodeIndex
(
1
)],
id_map
[
e
.
getNodeIndex
(
2
)]);
surface
.
addTriangle
(
id_map
[
e
.
getNodeIndex
(
0
)],
id_map
[
e
.
getNodeIndex
(
2
)],
id_map
[
e
.
getNodeIndex
(
3
)]);
return
;
}
// all other element types are ignored (i.e. lines)
};
const
std
::
vector
<
MeshLib
::
Element
*>&
elements
=
mesh
.
getElements
();
const
std
::
vector
<
MeshLib
::
Element
*>&
elements
=
mesh
.
getElements
();
const
std
::
size_t
nElems
(
mesh
.
getNumberOfElements
());
const
std
::
size_t
nElems
(
mesh
.
getNumberOfElements
());
for
(
unsigned
i
=
0
;
i
<
nElems
;
++
i
)
for
(
unsigned
i
=
0
;
i
<
nElems
;
++
i
)
{
{
auto
surfaceId
=
!
materialIds
?
0
:
((
*
materialIds
)[
i
]
-
bounds
.
first
);
auto
surfaceId
=
!
materialIds
?
0
:
((
*
materialIds
)[
i
]
-
bounds
.
first
);
add
_e
lement
_to_s
urface
(
*
elements
[
i
],
*
(
*
sfcs
)[
surfaceId
]);
add
E
lement
ToS
urface
(
*
elements
[
i
],
id_map
,
*
(
*
sfcs
)[
surfaceId
]);
}
}
std
::
for_each
(
sfcs
->
begin
(),
sfcs
->
end
(),
[](
GeoLib
::
Surface
*
sfc
)
{
std
::
for_each
(
sfcs
->
begin
(),
sfcs
->
end
(),
[](
GeoLib
::
Surface
*
sfc
)
{
...
...
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