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
aa7ce7e7
Commit
aa7ce7e7
authored
5 years ago
by
Tom Fischer
Browse files
Options
Downloads
Patches
Plain Diff
[A/U] Add ExtractBoundary tool.
parent
5aefda9e
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
Applications/Utils/MeshEdit/CMakeLists.txt
+1
-0
1 addition, 0 deletions
Applications/Utils/MeshEdit/CMakeLists.txt
Applications/Utils/MeshEdit/ExtractBoundary.cpp
+115
-0
115 additions, 0 deletions
Applications/Utils/MeshEdit/ExtractBoundary.cpp
with
116 additions
and
0 deletions
Applications/Utils/MeshEdit/CMakeLists.txt
+
1
−
0
View file @
aa7ce7e7
...
@@ -7,6 +7,7 @@ set(TOOLS
...
@@ -7,6 +7,7 @@ set(TOOLS
createLayeredMeshFromRasters
createLayeredMeshFromRasters
createQuadraticMesh
createQuadraticMesh
editMaterialID
editMaterialID
ExtractBoundary
ExtractSurface
ExtractSurface
MapGeometryToMeshSurface
MapGeometryToMeshSurface
MoveMesh
MoveMesh
...
...
This diff is collapsed.
Click to expand it.
Applications/Utils/MeshEdit/ExtractBoundary.cpp
0 → 100644
+
115
−
0
View file @
aa7ce7e7
/**
* \file
* @brief Extracts the entire boundary from the given mesh.
*
* @copyright
* Copyright (c) 2012-2020, OpenGeoSys Community (http://www.opengeosys.org)
* Distributed under a Modified BSD License.
* See accompanying file LICENSE.txt or
* http://www.opengeosys.org/LICENSE.txt
*/
#include
<tclap/CmdLine.h>
#include
<algorithm>
#include
<memory>
#include
<string>
#include
<vector>
#include
"Applications/ApplicationsLib/LogogSetup.h"
#include
"BaseLib/FileTools.h"
#include
"BaseLib/StringTools.h"
#include
"InfoLib/GitInfo.h"
#include
"MathLib/Vector3.h"
#include
"MeshLib/Elements/Element.h"
#include
"MeshLib/IO/VtkIO/VtuInterface.h"
#include
"MeshLib/IO/readMeshFromFile.h"
#include
"MeshLib/IO/writeMeshToFile.h"
#include
"MeshLib/Mesh.h"
#include
"MeshLib/MeshSurfaceExtraction.h"
#include
"MeshLib/Node.h"
int
main
(
int
argc
,
char
*
argv
[])
{
ApplicationsLib
::
LogogSetup
logog_setup
;
TCLAP
::
CmdLine
cmd
(
"Tool extracts the boundary of the given mesh. The documentation is "
"available at "
"https://docs.opengeosys.org/docs/tools/meshing-submeshes/"
"extract-boundary.
\n\n
"
"OpenGeoSys-6 software, version "
+
GitInfoLib
::
GitInfo
::
ogs_version
+
".
\n
"
"Copyright (c) 2012-2020, OpenGeoSys Community "
"(http://www.opengeosys.org)"
,
' '
,
GitInfoLib
::
GitInfo
::
ogs_version
);
TCLAP
::
ValueArg
<
std
::
string
>
mesh_in
(
"i"
,
"mesh-input-file"
,
"the name of the file containing the input mesh"
,
true
,
""
,
"file name of input mesh"
);
cmd
.
add
(
mesh_in
);
TCLAP
::
ValueArg
<
std
::
string
>
mesh_out
(
"o"
,
"mesh-output-file"
,
"the name of the file the surface mesh should be written to"
,
false
,
""
,
"file name of output mesh"
);
cmd
.
add
(
mesh_out
);
TCLAP
::
ValueArg
<
std
::
string
>
node_prop_name
(
"n"
,
"node-property-name"
,
"the name of the data array the subsurface/bulk node id will be stored "
"to"
,
false
,
"bulk_node_ids"
,
"string"
);
cmd
.
add
(
node_prop_name
);
TCLAP
::
ValueArg
<
std
::
string
>
element_prop_name
(
"e"
,
"element-property-name"
,
"the name of the data array the subsurface/bulk element id will be "
"stored to"
,
false
,
"bulk_element_ids"
,
"string"
);
cmd
.
add
(
element_prop_name
);
TCLAP
::
ValueArg
<
std
::
string
>
face_prop_name
(
"f"
,
"face-property-name"
,
"the name of the data array the surface face id of the subsurface/bulk "
"element will be stored to"
,
false
,
"bulk_face_ids"
,
"string"
);
cmd
.
add
(
face_prop_name
);
TCLAP
::
ValueArg
<
bool
>
use_ascii_arg
(
""
,
"ascii_output"
,
"use ascii format for data in the vtu output "
,
false
,
false
,
"boolean value"
);
cmd
.
add
(
use_ascii_arg
);
cmd
.
parse
(
argc
,
argv
);
std
::
unique_ptr
<
MeshLib
::
Mesh
const
>
mesh
(
MeshLib
::
IO
::
readMeshFromFile
(
mesh_in
.
getValue
()));
if
(
!
mesh
)
{
return
EXIT_FAILURE
;
}
INFO
(
"Mesh read: %u nodes, %u elements."
,
mesh
->
getNumberOfNodes
(),
mesh
->
getNumberOfElements
());
// extract surface
std
::
unique_ptr
<
MeshLib
::
Mesh
>
surface_mesh
(
MeshLib
::
BoundaryExtraction
::
getBoundaryElementsAsMesh
(
*
mesh
,
node_prop_name
.
getValue
(),
element_prop_name
.
getValue
(),
face_prop_name
.
getValue
()));
INFO
(
"Created surface mesh: %u nodes, %u elements."
,
surface_mesh
->
getNumberOfNodes
(),
surface_mesh
->
getNumberOfElements
());
std
::
string
out_fname
(
mesh_out
.
getValue
());
if
(
out_fname
.
empty
())
{
out_fname
=
BaseLib
::
dropFileExtension
(
mesh_in
.
getValue
())
+
"_sfc.vtu"
;
}
auto
const
data_mode
=
use_ascii_arg
.
getValue
()
?
vtkXMLWriter
::
Ascii
:
vtkXMLWriter
::
Binary
;
MeshLib
::
IO
::
writeVtu
(
*
surface_mesh
,
out_fname
,
data_mode
);
return
EXIT_SUCCESS
;
}
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