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
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
Yuhao Liu
ogs
Commits
e59dd58f
Commit
e59dd58f
authored
4 years ago
by
Tom Fischer
Browse files
Options
Downloads
Patches
Plain Diff
[A/U/MP/PartitionMesh] Use lambda for almost identical code.
parent
624b9884
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
Applications/Utils/ModelPreparation/PartitionMesh/NodeWiseMeshPartitioner.cpp
+24
-27
24 additions, 27 deletions
...odelPreparation/PartitionMesh/NodeWiseMeshPartitioner.cpp
with
24 additions
and
27 deletions
Applications/Utils/ModelPreparation/PartitionMesh/NodeWiseMeshPartitioner.cpp
+
24
−
27
View file @
e59dd58f
...
...
@@ -1025,36 +1025,33 @@ void writeElements(std::string const& file_name_base,
// partition
std
::
vector
<
long
>
ele_info
(
regular_element_offsets
[
i
]);
// Non-ghost elements.
long
counter
=
partition
.
regular_elements
.
size
();
auto
writeElementData
=
[
&
local_node_ids
](
std
::
vector
<
MeshLib
::
Element
const
*>
const
&
elements
,
long
const
element_offsets
,
std
::
ofstream
&
output_stream
)
{
long
counter
=
elements
.
size
();
std
::
vector
<
long
>
ele_info
(
element_offsets
);
for
(
std
::
size_t
j
=
0
;
j
<
partition
.
regular_elements
.
size
();
j
++
)
{
const
auto
*
elem
=
partition
.
regular_elements
[
j
];
ele_info
[
j
]
=
counter
;
getElementIntegerVariables
(
*
elem
,
local_node_ids
,
ele_info
,
counter
);
}
// Write vector data of non-ghost elements
element_info_os
.
write
(
reinterpret_cast
<
const
char
*>
(
ele_info
.
data
()),
ele_info
.
size
()
*
sizeof
(
long
));
for
(
std
::
size_t
j
=
0
;
j
<
elements
.
size
();
j
++
)
{
const
auto
*
elem
=
elements
[
j
];
ele_info
[
j
]
=
counter
;
getElementIntegerVariables
(
*
elem
,
local_node_ids
,
ele_info
,
counter
);
}
// Write vector data of regular elements
output_stream
.
write
(
reinterpret_cast
<
const
char
*>
(
ele_info
.
data
()),
ele_info
.
size
()
*
sizeof
(
long
));
};
// regular elements.
writeElementData
(
partition
.
regular_elements
,
regular_element_offsets
[
i
],
element_info_os
);
// Ghost elements
ele_info
.
resize
(
num_g_elem_integers
[
i
]);
counter
=
partition
.
ghost_elements
.
size
();
for
(
std
::
size_t
j
=
0
;
j
<
partition
.
ghost_elements
.
size
();
j
++
)
{
const
auto
*
elem
=
partition
.
ghost_elements
[
j
];
ele_info
[
j
]
=
counter
;
getElementIntegerVariables
(
*
elem
,
local_node_ids
,
ele_info
,
counter
);
}
// Write vector data of ghost elements
ghost_element_info_os
.
write
(
reinterpret_cast
<
const
char
*>
(
ele_info
.
data
()),
ele_info
.
size
()
*
sizeof
(
long
));
writeElementData
(
partition
.
ghost_elements
,
ghost_element_offsets
[
i
],
ghost_element_info_os
);
}
}
...
...
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