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
9f9fa982
Commit
9f9fa982
authored
4 years ago
by
Tom Fischer
Browse files
Options
Downloads
Patches
Plain Diff
[MeL/ME/AddLayer] Switch to copy MaterialIDs.
parent
354b5b3c
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
MeshLib/MeshEditing/AddLayerToMesh.cpp
+24
-8
24 additions, 8 deletions
MeshLib/MeshEditing/AddLayerToMesh.cpp
MeshLib/MeshEditing/AddLayerToMesh.h
+6
-6
6 additions, 6 deletions
MeshLib/MeshEditing/AddLayerToMesh.h
with
30 additions
and
14 deletions
MeshLib/MeshEditing/AddLayerToMesh.cpp
+
24
−
8
View file @
9f9fa982
...
@@ -84,14 +84,16 @@ MeshLib::Element* extrudeElement(std::vector<MeshLib::Node*> const& subsfc_nodes
...
@@ -84,14 +84,16 @@ MeshLib::Element* extrudeElement(std::vector<MeshLib::Node*> const& subsfc_nodes
}
}
MeshLib
::
Mesh
*
addTopLayerToMesh
(
MeshLib
::
Mesh
const
&
mesh
,
MeshLib
::
Mesh
*
addTopLayerToMesh
(
MeshLib
::
Mesh
const
&
mesh
,
double
thickness
,
double
thickness
,
std
::
string
const
&
name
)
std
::
string
const
&
name
,
bool
copy_material_ids
)
{
{
return
addLayerToMesh
(
mesh
,
thickness
,
name
,
true
);
return
addLayerToMesh
(
mesh
,
thickness
,
name
,
true
,
copy_material_ids
);
}
}
MeshLib
::
Mesh
*
addLayerToMesh
(
MeshLib
::
Mesh
const
&
mesh
,
double
thickness
,
MeshLib
::
Mesh
*
addLayerToMesh
(
MeshLib
::
Mesh
const
&
mesh
,
double
thickness
,
std
::
string
const
&
name
,
bool
on_top
)
std
::
string
const
&
name
,
bool
on_top
,
bool
copy_material_ids
)
{
{
INFO
(
"Extracting top surface of mesh '{:s}' ... "
,
mesh
.
getName
());
INFO
(
"Extracting top surface of mesh '{:s}' ... "
,
mesh
.
getName
());
int
const
flag
=
(
on_top
)
?
-
1
:
1
;
int
const
flag
=
(
on_top
)
?
-
1
:
1
;
...
@@ -192,12 +194,26 @@ MeshLib::Mesh* addLayerToMesh(MeshLib::Mesh const& mesh, double thickness,
...
@@ -192,12 +194,26 @@ MeshLib::Mesh* addLayerToMesh(MeshLib::Mesh const& mesh, double thickness,
}
}
new_materials
->
reserve
(
subsfc_elements
.
size
());
new_materials
->
reserve
(
subsfc_elements
.
size
());
int
new_layer_id
(
*
(
std
::
max_element
(
materials
->
cbegin
(),
materials
->
cend
()))
+
1
);
std
::
copy
(
materials
->
cbegin
(),
materials
->
cend
(),
std
::
copy
(
materials
->
cbegin
(),
materials
->
cend
(),
std
::
back_inserter
(
*
new_materials
));
std
::
back_inserter
(
*
new_materials
));
auto
const
n_new_props
(
subsfc_elements
.
size
()
-
mesh
.
getNumberOfElements
());
std
::
fill_n
(
std
::
back_inserter
(
*
new_materials
),
n_new_props
,
new_layer_id
);
if
(
copy_material_ids
&&
sfc_mesh
->
getProperties
().
existsPropertyVector
<
int
>
(
"MaterialIDs"
))
{
auto
const
&
sfc_material_ids
=
*
sfc_mesh
->
getProperties
().
getPropertyVector
<
int
>
(
"MaterialIDs"
);
std
::
copy
(
sfc_material_ids
.
cbegin
(),
sfc_material_ids
.
cend
(),
std
::
back_inserter
(
*
new_materials
));
}
else
{
int
const
new_layer_id
(
*
(
std
::
max_element
(
materials
->
cbegin
(),
materials
->
cend
()))
+
1
);
auto
const
n_new_props
(
subsfc_elements
.
size
()
-
mesh
.
getNumberOfElements
());
std
::
fill_n
(
std
::
back_inserter
(
*
new_materials
),
n_new_props
,
new_layer_id
);
}
return
new_mesh
;
return
new_mesh
;
}
}
...
...
This diff is collapsed.
Click to expand it.
MeshLib/MeshEditing/AddLayerToMesh.h
+
6
−
6
View file @
9f9fa982
...
@@ -26,14 +26,14 @@ class Element;
...
@@ -26,14 +26,14 @@ class Element;
/// Adds a layer on top of the mesh
/// Adds a layer on top of the mesh
MeshLib
::
Mesh
*
addTopLayerToMesh
(
MeshLib
::
Mesh
const
&
mesh
,
MeshLib
::
Mesh
*
addTopLayerToMesh
(
MeshLib
::
Mesh
const
&
mesh
,
double
thickness
,
double
thickness
,
std
::
string
const
&
name
);
std
::
string
const
&
name
,
bool
copy_material_ids
);
/// Adds a layer to the mesh. If on_top is true, the layer is added on top,
/// Adds a layer to the mesh. If on_top is true, the layer is added on top,
/// if it is false, the layer is added at the bottom.
/// if it is false, the layer is added at the bottom.
MeshLib
::
Mesh
*
addLayerToMesh
(
MeshLib
::
Mesh
const
&
mesh
,
MeshLib
::
Mesh
*
addLayerToMesh
(
MeshLib
::
Mesh
const
&
mesh
,
double
thickness
,
double
thickness
,
std
::
string
const
&
name
,
bool
on_top
,
std
::
string
const
&
name
,
bool
copy_material_ids
);
bool
on_top
);
}
// end namespace MeshLib
}
// end namespace MeshLib
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