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
Özgür Ozan Sen
ogs
Commits
e03fab1d
Commit
e03fab1d
authored
5 years ago
by
Karsten Rink
Browse files
Options
Downloads
Patches
Plain Diff
cmd line utility to remove ghost information
parent
75a70533
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
+5
-5
5 additions, 5 deletions
Applications/Utils/MeshEdit/CMakeLists.txt
Applications/Utils/MeshEdit/RemoveGhostData.cpp
+69
-0
69 additions, 0 deletions
Applications/Utils/MeshEdit/RemoveGhostData.cpp
with
74 additions
and
5 deletions
Applications/Utils/MeshEdit/CMakeLists.txt
+
5
−
5
View file @
e03fab1d
...
...
@@ -21,12 +21,12 @@ set(TOOLS
UnityPreprocessing
Vtu2Grid
)
if
(
OGS_BUILD_GUI
)
add_executable
(
RemoveGhost
Nodes
RemoveGhost
Nodes
.cpp
add_executable
(
RemoveGhost
Data
RemoveGhost
Data
.cpp
vtkCleanUnstructuredGrid.cpp
)
target_link_libraries
(
RemoveGhost
Nodes
GitInfoLib MeshLib
)
set_target_properties
(
RemoveGhost
Nodes
PROPERTIES FOLDER Utilities
)
install
(
TARGETS RemoveGhost
Nodes
RUNTIME DESTINATION bin COMPONENT Utilities
)
target_link_libraries
(
RemoveGhost
Data
GitInfoLib MeshLib
)
set_target_properties
(
RemoveGhost
Data
PROPERTIES FOLDER Utilities
)
install
(
TARGETS RemoveGhost
Data
RUNTIME DESTINATION bin COMPONENT Utilities
)
endif
()
foreach
(
TOOL
${
TOOLS
}
)
add_executable
(
${
TOOL
}
${
TOOL
}
.cpp
)
...
...
This diff is collapsed.
Click to expand it.
Applications/Utils/MeshEdit/RemoveGhost
Nodes
.cpp
→
Applications/Utils/MeshEdit/RemoveGhost
Data
.cpp
+
69
−
0
View file @
e03fab1d
...
...
@@ -16,84 +16,54 @@
#include
"MeshLib/IO/writeMeshToFile.h"
#include
"vtkCleanUnstructuredGrid.h"
#include
<vtkRemoveGhosts.h>
#include
<vtkSmartPointer.h>
#include
<vtkUnstructuredGrid.h>
#include
<vtkXMLPUnstructuredGridReader.h>
#include
<vtk
RemoveGhosts
.h>
#include
<vtk
XMLUnstructuredGridWriter
.h>
int
main
(
int
argc
,
char
*
argv
[])
{
ApplicationsLib
::
LogogSetup
logog_setup
;
/*
TCLAP
::
CmdLine
cmd
(
"Reads a 3D unstructured mesh and samples it onto a structured grid of "
"the same extent. Cell properties are mapped onto the grid (sampled at "
"the centre-points of each cube), node properties are ignored. Note, "
"that a large cube size may result in an undersampling of the original "
"mesh structure.\nCube sizes are defines by x/y/z-parameters. For "
"equilateral cubes, only the x-parameter needs to be set.\n\n"
"OpenGeoSys-6 software, version " +
GitInfoLib::GitInfo::ogs_version +
".\n"
"Copyright (c) 2012-2020, OpenGeoSys Community "
"(http://www.opengeosys.org)",
"Reads a VTK partitioned unstructured grid (*.pvtu), cleans the ghost "
"information and saves the data as as a regular, connected mesh file."
"
\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<double> z_arg("z", "cellsize-z",
"edge length of cubes in z-direction (depth)",
false, 1000, "floating point number");
cmd.add(z_arg);
TCLAP::ValueArg<double> y_arg(
"y", "cellsize-y", "edge length of cubes in y-direction (latitude)",
false, 1000, "floating point number");
cmd.add(y_arg);
TCLAP::ValueArg<double> x_arg(
"x", "cellsize-x",
"edge length of cubes in x-direction (longitude) or all directions, if "
"y and z are not set",
true, 1000, "floating point number");
cmd.add(x_arg);
TCLAP
::
ValueArg
<
std
::
string
>
output_arg
(
"o", "output", "the output
grid
(*.vtu)", true, "", "output.vtu");
"o"
,
"output"
,
"the output
mesh
(*.vtu)"
,
true
,
""
,
"output.vtu"
);
cmd
.
add
(
output_arg
);
TCLAP
::
ValueArg
<
std
::
string
>
input_arg
(
"i"
,
"input"
,
"the
3D
input mesh (*.vtu
, *.msh
)",
true, "", "input.vtu");
"the
partitioned
input mesh (*.
p
vtu)"
,
true
,
""
,
"input.
p
vtu"
);
cmd
.
add
(
input_arg
);
cmd
.
parse
(
argc
,
argv
);
if ((y_arg.isSet() && !z_arg.isSet()) ||
((!y_arg.isSet() && z_arg.isSet())))
{
ERR("For equilateral cubes, only x needs to be set. For unequal "
"cuboids, all three edge lengths (x/y/z) need to be specified.")
return -1;
}
double const x_size = x_arg.getValue();
double const y_size = (y_arg.isSet()) ? y_arg.getValue() : x_arg.getValue();
double const z_size = (z_arg.isSet()) ? z_arg.getValue() : x_arg.getValue();
std::array<double, 3> const cellsize = { x_size, y_size, z_size };
*/
std
::
string
input_file
=
"c:/Projects/RemoveGhostNodes/Mesh3D.pvtu"
;
vtkSmartPointer
<
vtkXMLPUnstructuredGridReader
>
reader
=
vtkSmartPointer
<
vtkXMLPUnstructuredGridReader
>::
New
();
reader
->
SetFileName
(
input_file
.
c_str
());
//reader->SetFileName(input_arg.getValue().c_str());
reader
->
Update
();
reader
->
SetFileName
(
input_arg
.
getValue
().
c_str
());
vtkSmartPointer
<
vtkUnstructuredGrid
>
mesh
=
reader
->
GetOutput
();
vtkSmartPointer
<
vtkRemoveGhosts
>
ghosts
=
vtkSmartPointer
<
vtkRemoveGhosts
>::
New
();
ghosts
->
SetInputConnection
(
reader
->
GetOutputPort
());
vtkSmartPointer
<
vtkCleanUnstructuredGrid
>
clean
=
vtkSmartPointer
<
vtkCleanUnstructuredGrid
>::
New
();
clean
->
SetInputConnection
(
ghosts
->
GetOutputPort
());
//if (MeshLib::IO::writeMeshToFile(*grid, output_arg.getValue()) != 0)
// return EXIT_FAILURE;
vtkSmartPointer
<
vtkXMLUnstructuredGridWriter
>
writer
=
vtkSmartPointer
<
vtkXMLUnstructuredGridWriter
>::
New
();
writer
->
SetInputConnection
(
clean
->
GetOutputPort
());
writer
->
SetFileName
(
output_arg
.
getValue
().
c_str
());
writer
->
Write
();
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