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
Karsten Rink
ogs
Commits
982cceff
Commit
982cceff
authored
5 years ago
by
Tom Fischer
Browse files
Options
Downloads
Patches
Plain Diff
[MeL/ME/DuplicateMeshComponents] copyElement: Opt. mapping.
parent
7bdccd46
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
MeshLib/MeshEditing/DuplicateMeshComponents.cpp
+27
-13
27 additions, 13 deletions
MeshLib/MeshEditing/DuplicateMeshComponents.cpp
MeshLib/MeshEditing/DuplicateMeshComponents.h
+4
-2
4 additions, 2 deletions
MeshLib/MeshEditing/DuplicateMeshComponents.h
with
31 additions
and
15 deletions
MeshLib/MeshEditing/DuplicateMeshComponents.cpp
+
27
−
13
View file @
982cceff
...
...
@@ -51,35 +51,49 @@ std::vector<MeshLib::Element*> copyElementVector(
/// mesh.
template
<
typename
E
>
MeshLib
::
Element
*
copyElement
(
MeshLib
::
Element
const
*
const
element
,
const
std
::
vector
<
MeshLib
::
Node
*>&
nodes
)
const
std
::
vector
<
MeshLib
::
Node
*>&
nodes
,
std
::
vector
<
std
::
size_t
>
const
*
const
id_map
)
{
auto
**
new_nodes
=
new
MeshLib
::
Node
*
[
element
->
getNumberOfNodes
()];
for
(
unsigned
i
=
0
;
i
<
element
->
getNumberOfNodes
();
++
i
)
unsigned
const
number_of_element_nodes
(
element
->
getNumberOfNodes
());
auto
**
new_nodes
=
new
MeshLib
::
Node
*
[
number_of_element_nodes
];
if
(
id_map
)
{
new_nodes
[
i
]
=
nodes
[
element
->
getNode
(
i
)
->
getID
()];
for
(
unsigned
i
=
0
;
i
<
number_of_element_nodes
;
++
i
)
{
new_nodes
[
i
]
=
nodes
[(
*
id_map
)[
element
->
getNode
(
i
)
->
getID
()]];
}
}
else
{
for
(
unsigned
i
=
0
;
i
<
number_of_element_nodes
;
++
i
)
{
new_nodes
[
i
]
=
nodes
[
element
->
getNode
(
i
)
->
getID
()];
}
}
return
new
E
(
new_nodes
);
}
MeshLib
::
Element
*
copyElement
(
MeshLib
::
Element
const
*
const
element
,
const
std
::
vector
<
MeshLib
::
Node
*>&
nodes
)
MeshLib
::
Element
*
copyElement
(
MeshLib
::
Element
const
*
const
element
,
const
std
::
vector
<
MeshLib
::
Node
*>&
nodes
,
std
::
vector
<
std
::
size_t
>
const
*
const
id_map
)
{
switch
(
element
->
getGeomType
())
{
case
MeshElemType
::
LINE
:
return
copyElement
<
MeshLib
::
Line
>
(
element
,
nodes
);
return
copyElement
<
MeshLib
::
Line
>
(
element
,
nodes
,
id_map
);
case
MeshElemType
::
TRIANGLE
:
return
copyElement
<
MeshLib
::
Tri
>
(
element
,
nodes
);
return
copyElement
<
MeshLib
::
Tri
>
(
element
,
nodes
,
id_map
);
case
MeshElemType
::
QUAD
:
return
copyElement
<
MeshLib
::
Quad
>
(
element
,
nodes
);
return
copyElement
<
MeshLib
::
Quad
>
(
element
,
nodes
,
id_map
);
case
MeshElemType
::
TETRAHEDRON
:
return
copyElement
<
MeshLib
::
Tet
>
(
element
,
nodes
);
return
copyElement
<
MeshLib
::
Tet
>
(
element
,
nodes
,
id_map
);
case
MeshElemType
::
HEXAHEDRON
:
return
copyElement
<
MeshLib
::
Hex
>
(
element
,
nodes
);
return
copyElement
<
MeshLib
::
Hex
>
(
element
,
nodes
,
id_map
);
case
MeshElemType
::
PYRAMID
:
return
copyElement
<
MeshLib
::
Pyramid
>
(
element
,
nodes
);
return
copyElement
<
MeshLib
::
Pyramid
>
(
element
,
nodes
,
id_map
);
case
MeshElemType
::
PRISM
:
return
copyElement
<
MeshLib
::
Prism
>
(
element
,
nodes
);
return
copyElement
<
MeshLib
::
Prism
>
(
element
,
nodes
,
id_map
);
default:
{
ERR
(
"Error: Unknown element type."
);
...
...
This diff is collapsed.
Click to expand it.
MeshLib/MeshEditing/DuplicateMeshComponents.h
+
4
−
2
View file @
982cceff
...
...
@@ -38,8 +38,10 @@ std::vector<MeshLib::Element*> copyElementVector(
/// Copies an element without change, using the nodes vector from the result
/// mesh.
MeshLib
::
Element
*
copyElement
(
MeshLib
::
Element
const
*
const
element
,
const
std
::
vector
<
MeshLib
::
Node
*>&
nodes
);
MeshLib
::
Element
*
copyElement
(
MeshLib
::
Element
const
*
const
element
,
const
std
::
vector
<
MeshLib
::
Node
*>&
nodes
,
std
::
vector
<
std
::
size_t
>
const
*
const
id_map
=
nullptr
);
/// Clones a vector of elements using the Element::clone() function.
std
::
vector
<
MeshLib
::
Element
*>
cloneElements
(
...
...
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