Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
O
ogs-feliks
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
Feliks Kiszkurno
ogs-feliks
Commits
f53c6d3e
Commit
f53c6d3e
authored
12 years ago
by
Tom Fischer
Browse files
Options
Downloads
Patches
Plain Diff
Added simple program to convert OGS meshes into vtk format.
parent
923006ab
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
FileIO/RapidXmlIO/BoostVtuInterface.cpp
+2
-3
2 additions, 3 deletions
FileIO/RapidXmlIO/BoostVtuInterface.cpp
Utils/FileConverter/CMakeLists.txt
+8
-0
8 additions, 0 deletions
Utils/FileConverter/CMakeLists.txt
Utils/FileConverter/OGS2VTK.cpp
+63
-0
63 additions, 0 deletions
Utils/FileConverter/OGS2VTK.cpp
with
73 additions
and
3 deletions
FileIO/RapidXmlIO/BoostVtuInterface.cpp
+
2
−
3
View file @
f53c6d3e
...
@@ -90,7 +90,6 @@ MeshLib::Mesh* BoostVtuInterface::readVTUFile(const std::string &file_name)
...
@@ -90,7 +90,6 @@ MeshLib::Mesh* BoostVtuInterface::readVTUFile(const std::string &file_name)
"UnstructuredGrid.Piece"
);
"UnstructuredGrid.Piece"
);
if
(
piece_node
)
if
(
piece_node
)
{
{
const
unsigned
nNodes
=
const
unsigned
nNodes
=
static_cast
<
unsigned
>
(
piece_node
->
get
(
"<xmlattr>.NumberOfPoints"
,
0
));
static_cast
<
unsigned
>
(
piece_node
->
get
(
"<xmlattr>.NumberOfPoints"
,
0
));
const
unsigned
nElems
=
const
unsigned
nElems
=
...
@@ -180,7 +179,7 @@ MeshLib::Mesh* BoostVtuInterface::readVTUFile(const std::string &file_name)
...
@@ -180,7 +179,7 @@ MeshLib::Mesh* BoostVtuInterface::readVTUFile(const std::string &file_name)
optional
<
std
::
string
>
const
&
format
=
getXmlAttribute
(
"format"
,
*
types
);
optional
<
std
::
string
>
const
&
format
=
getXmlAttribute
(
"format"
,
*
types
);
if
(
*
format
==
"ascii"
)
if
(
*
format
==
"ascii"
)
{
{
for
(
unsigned
i
=
0
;
i
<
nElems
;
i
++
)
for
(
unsigned
i
=
0
;
i
<
nElems
;
i
++
)
iss
>>
cell_types
[
i
];
iss
>>
cell_types
[
i
];
}
}
else
if
(
*
format
==
"appended"
)
else
if
(
*
format
==
"appended"
)
...
@@ -216,7 +215,7 @@ MeshLib::Mesh* BoostVtuInterface::readVTUFile(const std::string &file_name)
...
@@ -216,7 +215,7 @@ MeshLib::Mesh* BoostVtuInterface::readVTUFile(const std::string &file_name)
INFO
(
"BoostVtuInterface::readVTUFile():
\t
finished."
);
INFO
(
"BoostVtuInterface::readVTUFile():
\t
finished."
);
INFO
(
"BoostVtuInterface::readVTUFile(): Nr. Nodes: %d"
,
nodes
.
size
());
INFO
(
"BoostVtuInterface::readVTUFile(): Nr. Nodes: %d"
,
nodes
.
size
());
INFO
(
"BoostVtuInterface::readVTUFile(): Nr. Elements: "
,
elements
.
size
());
INFO
(
"BoostVtuInterface::readVTUFile(): Nr. Elements:
%d
"
,
elements
.
size
());
return
new
MeshLib
::
Mesh
(
BaseLib
::
extractBaseNameWithoutExtension
(
file_name
),
nodes
,
return
new
MeshLib
::
Mesh
(
BaseLib
::
extractBaseNameWithoutExtension
(
file_name
),
nodes
,
elements
);
elements
);
...
...
This diff is collapsed.
Click to expand it.
Utils/FileConverter/CMakeLists.txt
+
8
−
0
View file @
f53c6d3e
...
@@ -83,3 +83,11 @@ TARGET_LINK_LIBRARIES (GMSH2OGS
...
@@ -83,3 +83,11 @@ TARGET_LINK_LIBRARIES (GMSH2OGS
FileIO
FileIO
)
)
ADD_EXECUTABLE
(
OGS2VTK OGS2VTK.cpp
)
SET_TARGET_PROPERTIES
(
OGS2VTK PROPERTIES FOLDER Utilities
)
TARGET_LINK_LIBRARIES
(
OGS2VTK
MeshLib
FileIO
zlib
)
This diff is collapsed.
Click to expand it.
Utils/FileConverter/OGS2VTK.cpp
0 → 100644
+
63
−
0
View file @
f53c6d3e
/**
* @file OGS2VTK.cpp
* @author Thomas Fischer
* @date Jan 24, 2013
* @brief Converts OGS mesh into VTK mesh.
*
* @copyright
* Copyright (c) 2013, OpenGeoSys Community (http://www.opengeosys.org)
* Distributed under a Modified BSD License.
* See accompanying file LICENSE.txt or
* http://www.opengeosys.org/LICENSE.txt
*/
// STL
#include
<string>
// TCLAP
#include
"tclap/CmdLine.h"
// ThirdParty/logog
#include
"logog/include/logog.hpp"
// BaseLib
#include
"LogogSimpleFormatter.h"
// FileIO
#include
"RapidXmlIO/BoostVtuInterface.h"
#include
"readMeshFromFile.h"
// MeshLib
#include
"Mesh.h"
int
main
(
int
argc
,
char
*
argv
[])
{
LOGOG_INITIALIZE
();
logog
::
Cout
*
logog_cout
(
new
logog
::
Cout
);
BaseLib
::
LogogSimpleFormatter
*
custom_format
(
new
BaseLib
::
LogogSimpleFormatter
);
logog_cout
->
SetFormatter
(
*
custom_format
);
TCLAP
::
CmdLine
cmd
(
"Converts OGS mesh into VTK mesh."
,
' '
,
"0.1"
);
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 mesh will be written to"
,
true
,
""
,
"file name of output mesh"
);
cmd
.
add
(
mesh_out
);
cmd
.
parse
(
argc
,
argv
);
MeshLib
::
Mesh
*
mesh
(
FileIO
::
readMeshFromFile
(
mesh_in
.
getValue
()));
INFO
(
"Mesh read: %d nodes, %d elements."
,
mesh
->
getNNodes
(),
mesh
->
getNElements
());
FileIO
::
BoostVtuInterface
vtu
;
vtu
.
setMesh
(
mesh
);
vtu
.
writeToFile
(
mesh_out
.
getValue
());
delete
custom_format
;
delete
logog_cout
;
LOGOG_SHUTDOWN
();
return
0
;
}
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