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
Chaofan Chen
ogs
Commits
46c8d651
Commit
46c8d651
authored
4 years ago
by
Tobias Meisel
Browse files
Options
Downloads
Patches
Plain Diff
XdmfDiff now works with xdmf file containing time steps
parent
eab69f67
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Tests/xdmfdiff/xdmfdiff.cpp
+24
-7
24 additions, 7 deletions
Tests/xdmfdiff/xdmfdiff.cpp
with
24 additions
and
7 deletions
Tests/xdmfdiff/xdmfdiff.cpp
+
24
−
7
View file @
46c8d651
...
@@ -11,6 +11,7 @@
...
@@ -11,6 +11,7 @@
#include
<Xdmf.hpp>
#include
<Xdmf.hpp>
#include
<XdmfDomain.hpp>
#include
<XdmfDomain.hpp>
#include
<XdmfGridCollection.hpp>
#include
<XdmfReader.hpp>
#include
<XdmfReader.hpp>
#include
<XdmfUnstructuredGrid.hpp>
#include
<XdmfUnstructuredGrid.hpp>
#include
<boost/iterator/zip_iterator.hpp>
#include
<boost/iterator/zip_iterator.hpp>
...
@@ -46,6 +47,8 @@ struct Args
...
@@ -46,6 +47,8 @@ struct Args
std
::
string
const
xdmf_input_b
;
std
::
string
const
xdmf_input_b
;
std
::
string
const
data_array_a
;
std
::
string
const
data_array_a
;
std
::
string
const
data_array_b
;
std
::
string
const
data_array_b
;
unsigned
int
timestep_a
;
unsigned
int
timestep_b
;
};
};
auto
parseCommandLine
(
int
argc
,
char
*
argv
[])
->
Args
auto
parseCommandLine
(
int
argc
,
char
*
argv
[])
->
Args
...
@@ -85,6 +88,16 @@ auto parseCommandLine(int argc, char* argv[]) -> Args
...
@@ -85,6 +88,16 @@ auto parseCommandLine(int argc, char* argv[]) -> Args
"NAME"
);
"NAME"
);
cmd
.
add
(
data_array_b_arg
);
cmd
.
add
(
data_array_b_arg
);
TCLAP
::
ValueArg
<
unsigned
int
>
time_a_arg
(
""
,
"timestep-a"
,
"First data time step index (positive integer)"
,
false
,
0
,
"TIMESTEP"
);
cmd
.
add
(
time_a_arg
);
TCLAP
::
ValueArg
<
unsigned
int
>
time_b_arg
(
""
,
"timestep-b"
,
"Second data time step index (positive integer)"
,
false
,
0
,
"TIMESTEP"
);
cmd
.
add
(
time_b_arg
);
TCLAP
::
SwitchArg
meshcheck_arg
(
TCLAP
::
SwitchArg
meshcheck_arg
(
"m"
,
"mesh_check"
,
"Compare mesh geometries using absolute tolerance."
);
"m"
,
"mesh_check"
,
"Compare mesh geometries using absolute tolerance."
);
cmd
.
xorAdd
(
data_array_a_arg
,
meshcheck_arg
);
cmd
.
xorAdd
(
data_array_a_arg
,
meshcheck_arg
);
...
@@ -125,7 +138,8 @@ auto parseCommandLine(int argc, char* argv[]) -> Args
...
@@ -125,7 +138,8 @@ auto parseCommandLine(int argc, char* argv[]) -> Args
meshcheck_arg
.
getValue
(),
abs_err_thr_arg
.
getValue
(),
meshcheck_arg
.
getValue
(),
abs_err_thr_arg
.
getValue
(),
rel_err_thr_arg
.
getValue
(),
xdmf_input_a_arg
.
getValue
(),
rel_err_thr_arg
.
getValue
(),
xdmf_input_a_arg
.
getValue
(),
xdmf_input_b_arg
.
getValue
(),
data_array_a_arg
.
getValue
(),
xdmf_input_b_arg
.
getValue
(),
data_array_a_arg
.
getValue
(),
data_array_b_arg
.
getValue
()};
data_array_b_arg
.
getValue
(),
time_a_arg
.
getValue
(),
time_b_arg
.
getValue
()};
}
}
struct
Grid
struct
Grid
...
@@ -136,6 +150,7 @@ struct Grid
...
@@ -136,6 +150,7 @@ struct Grid
};
};
std
::
unique_ptr
<
Grid
>
readMesh
(
std
::
string
const
&
filename
,
std
::
unique_ptr
<
Grid
>
readMesh
(
std
::
string
const
&
filename
,
unsigned
int
timestep
,
std
::
string
const
&
attribute_name
)
std
::
string
const
&
attribute_name
)
{
{
if
(
filename
.
empty
())
if
(
filename
.
empty
())
...
@@ -152,8 +167,8 @@ std::unique_ptr<Grid> readMesh(std::string const& filename,
...
@@ -152,8 +167,8 @@ std::unique_ptr<Grid> readMesh(std::string const& filename,
auto
const
xreader
=
XdmfReader
::
New
();
auto
const
xreader
=
XdmfReader
::
New
();
auto
const
domain
=
auto
const
domain
=
shared_dynamic_cast
<
XdmfDomain
>
(
xreader
->
read
(
filename
));
shared_dynamic_cast
<
XdmfDomain
>
(
xreader
->
read
(
filename
));
auto
const
un
grid
=
domain
->
get
UnstructuredGrid
(
0
);
auto
const
grid
collection
=
domain
->
get
GridCollection
(
"Collection"
);
auto
const
ungrid
=
gridcollection
->
getUnstructuredGrid
(
timestep
);
auto
const
geometry
=
ungrid
->
getGeometry
();
auto
const
geometry
=
ungrid
->
getGeometry
();
int
const
size_points
=
geometry
->
getSize
();
int
const
size_points
=
geometry
->
getSize
();
std
::
vector
<
double
>
points
(
size_points
);
std
::
vector
<
double
>
points
(
size_points
);
...
@@ -176,11 +191,13 @@ std::unique_ptr<Grid> readMesh(std::string const& filename,
...
@@ -176,11 +191,13 @@ std::unique_ptr<Grid> readMesh(std::string const& filename,
std
::
tuple
<
std
::
unique_ptr
<
Grid
>
,
std
::
unique_ptr
<
Grid
>>
readMeshes
(
std
::
tuple
<
std
::
unique_ptr
<
Grid
>
,
std
::
unique_ptr
<
Grid
>>
readMeshes
(
std
::
string
const
&
file_a_name
,
std
::
string
const
&
file_a_name
,
std
::
string
const
&
file_b_name
,
std
::
string
const
&
file_b_name
,
unsigned
int
const
&
timestep_a
,
unsigned
int
const
&
timestep_b
,
std
::
string
const
&
attribute_a_name
,
std
::
string
const
&
attribute_a_name
,
std
::
string
const
&
attribute_b_name
)
std
::
string
const
&
attribute_b_name
)
{
{
return
{
readMesh
(
file_a_name
,
attribute_a_name
),
return
{
readMesh
(
file_a_name
,
timestep_a
,
attribute_a_name
),
readMesh
(
file_b_name
,
attribute_b_name
)};
readMesh
(
file_b_name
,
timestep_b
,
attribute_b_name
)};
}
}
bool
compareCellTopology
(
std
::
vector
<
int
>
const
&
cells_a
,
bool
compareCellTopology
(
std
::
vector
<
int
>
const
&
cells_a
,
...
@@ -247,8 +264,8 @@ int main(int argc, char* argv[])
...
@@ -247,8 +264,8 @@ int main(int argc, char* argv[])
std
::
cerr
<<
std
::
scientific
<<
std
::
setprecision
(
digits10
);
std
::
cerr
<<
std
::
scientific
<<
std
::
setprecision
(
digits10
);
auto
const
[
mesh_a
,
mesh_b
]
=
auto
const
[
mesh_a
,
mesh_b
]
=
readMeshes
(
args
.
xdmf_input_a
,
args
.
xdmf_input_b
,
args
.
data_array
_a
,
readMeshes
(
args
.
xdmf_input_a
,
args
.
xdmf_input_b
,
args
.
timestep
_a
,
args
.
data_array_b
);
args
.
timestep_b
,
args
.
data_array_a
,
args
.
data_array_b
);
if
(
args
.
xdmf_input_a
==
args
.
xdmf_input_b
)
if
(
args
.
xdmf_input_a
==
args
.
xdmf_input_b
)
{
{
...
...
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