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
wenqing
ogs
Commits
299c7129
"FileIO/writeMeshToFile.h" did not exist on "f776316c146aa844ee3d2b1ae5f82421788ed4bd"
Commit
299c7129
authored
3 years ago
by
Tobias Meisel
Committed by
Dmitri Naumov
3 years ago
Browse files
Options
Downloads
Patches
Plain Diff
[MeL/IO] Xdmf: Use hyperslab selector for new hdf5 file structure
parent
53045661
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
MeshLib/IO/XDMF/Xdmf3Writer.cpp
+28
-13
28 additions, 13 deletions
MeshLib/IO/XDMF/Xdmf3Writer.cpp
MeshLib/IO/XDMF/XdmfData.cpp
+32
-6
32 additions, 6 deletions
MeshLib/IO/XDMF/XdmfData.cpp
MeshLib/IO/XDMF/XdmfHdfWriter.cpp
+1
-1
1 addition, 1 deletion
MeshLib/IO/XDMF/XdmfHdfWriter.cpp
with
61 additions
and
20 deletions
MeshLib/IO/XDMF/Xdmf3Writer.cpp
+
28
−
13
View file @
299c7129
...
@@ -44,19 +44,27 @@ boost::shared_ptr<const XdmfAttributeCenter> elemTypeOGS2XDMF(
...
@@ -44,19 +44,27 @@ boost::shared_ptr<const XdmfAttributeCenter> elemTypeOGS2XDMF(
return
mesh_item_type_ogs2xdmf
.
at
(
elem_type
);
return
mesh_item_type_ogs2xdmf
.
at
(
elem_type
);
}
}
static
std
::
string
get
Time
Section
(
int
const
step
,
std
::
string
const
&
name
)
static
std
::
string
get
Data
Section
(
std
::
string
const
&
name
)
{
{
return
"t_"
s
+
std
::
to_string
(
step
)
+
"/"
s
+
name
;
return
"data/"
s
+
name
;
}
static
std
::
vector
<
XdmfDimType
>
prependDimension
(
XdmfDimType
const
prepend_value
,
std
::
vector
<
XdmfDimType
>
const
&
dimensions
)
{
std
::
vector
<
XdmfDimType
>
dims
=
{
prepend_value
};
dims
.
insert
(
dims
.
end
(),
dimensions
.
begin
(),
dimensions
.
end
());
return
dims
;
}
}
static
boost
::
shared_ptr
<
XdmfGeometry
>
getLightGeometry
(
static
boost
::
shared_ptr
<
XdmfGeometry
>
getLightGeometry
(
std
::
string
const
&
hdf5filename
,
int
const
step
,
XdmfData
const
&
geometry
)
std
::
string
const
&
hdf5filename
,
XdmfData
const
&
geometry
)
{
{
auto
xdmf_geometry
=
XdmfGeometry
::
New
();
auto
xdmf_geometry
=
XdmfGeometry
::
New
();
xdmf_geometry
->
setType
(
XdmfGeometryType
::
XYZ
());
xdmf_geometry
->
setType
(
XdmfGeometryType
::
XYZ
());
boost
::
shared_ptr
<
XdmfHDF5Controller
>
geometry_controller
=
boost
::
shared_ptr
<
XdmfHDF5Controller
>
geometry_controller
=
XdmfHDF5Controller
::
New
(
hdf5filename
,
XdmfHDF5Controller
::
New
(
hdf5filename
,
get
Time
Section
(
step
,
"geometry"
),
get
Data
Section
(
"geometry"
),
XdmfArrayType
::
Float64
(),
XdmfArrayType
::
Float64
(),
geometry
.
starts
,
geometry
.
starts
,
geometry
.
strides
,
geometry
.
strides
,
...
@@ -67,13 +75,13 @@ static boost::shared_ptr<XdmfGeometry> getLightGeometry(
...
@@ -67,13 +75,13 @@ static boost::shared_ptr<XdmfGeometry> getLightGeometry(
}
}
static
boost
::
shared_ptr
<
XdmfTopology
>
getLightTopology
(
static
boost
::
shared_ptr
<
XdmfTopology
>
getLightTopology
(
std
::
string
const
&
hdf5filename
,
int
const
step
,
XdmfData
const
&
topology
)
std
::
string
const
&
hdf5filename
,
XdmfData
const
&
topology
)
{
{
auto
xdmf_topology
=
XdmfTopology
::
New
();
auto
xdmf_topology
=
XdmfTopology
::
New
();
xdmf_topology
->
setType
(
XdmfTopologyType
::
Mixed
());
xdmf_topology
->
setType
(
XdmfTopologyType
::
Mixed
());
auto
topology_controller
=
auto
topology_controller
=
XdmfHDF5Controller
::
New
(
hdf5filename
,
XdmfHDF5Controller
::
New
(
hdf5filename
,
get
Time
Section
(
step
,
"topology"
),
get
Data
Section
(
"topology"
),
XdmfArrayType
::
Int32
(),
XdmfArrayType
::
Int32
(),
topology
.
starts
,
topology
.
starts
,
topology
.
strides
,
topology
.
strides
,
...
@@ -86,14 +94,21 @@ static boost::shared_ptr<XdmfTopology> getLightTopology(
...
@@ -86,14 +94,21 @@ static boost::shared_ptr<XdmfTopology> getLightTopology(
static
boost
::
shared_ptr
<
XdmfAttribute
>
getLightAttribute
(
static
boost
::
shared_ptr
<
XdmfAttribute
>
getLightAttribute
(
std
::
string
const
&
hdf5filename
,
int
const
step
,
XdmfData
const
&
attribute
)
std
::
string
const
&
hdf5filename
,
int
const
step
,
XdmfData
const
&
attribute
)
{
{
std
::
vector
<
XdmfDimType
>
starts
=
prependDimension
(
step
,
attribute
.
starts
);
std
::
vector
<
XdmfDimType
>
strides
=
prependDimension
(
1
,
attribute
.
strides
);
std
::
vector
<
XdmfDimType
>
global_block_dims
=
prependDimension
(
1
,
attribute
.
global_block_dims
);
std
::
vector
<
XdmfDimType
>
all_global_block_dims
=
prependDimension
(
step
+
1
,
attribute
.
global_block_dims
);
auto
const
attribute_controller
=
auto
const
attribute_controller
=
XdmfHDF5Controller
::
New
(
hdf5filename
,
XdmfHDF5Controller
::
New
(
hdf5filename
,
get
Time
Section
(
step
,
attribute
.
name
),
get
Data
Section
(
attribute
.
name
),
attribute
.
data_type
,
attribute
.
data_type
,
attribute
.
starts
,
starts
,
attribute
.
strides
,
strides
,
attribute
.
global_block_dims
,
global_block_dims
,
a
ttribute
.
global_block_dims
);
a
ll_
global_block_dims
);
auto
const
xdmf_attribute
=
XdmfAttribute
::
New
();
auto
const
xdmf_attribute
=
XdmfAttribute
::
New
();
auto
const
center
=
elemTypeOGS2XDMF
(
*
(
attribute
.
attribute_center
));
auto
const
center
=
elemTypeOGS2XDMF
(
*
(
attribute
.
attribute_center
));
...
@@ -113,8 +128,8 @@ Xdmf3Writer::Xdmf3Writer(XdmfData const& geometry, XdmfData const& topology,
...
@@ -113,8 +128,8 @@ Xdmf3Writer::Xdmf3Writer(XdmfData const& geometry, XdmfData const& topology,
:
_variable_attributes
(
std
::
move
(
variable_attributes
)),
:
_variable_attributes
(
std
::
move
(
variable_attributes
)),
_hdf5filename
(
filepath
.
stem
().
string
()
+
".h5"
)
_hdf5filename
(
filepath
.
stem
().
string
()
+
".h5"
)
{
{
_initial_geometry
=
getLightGeometry
(
_hdf5filename
,
time_step
,
geometry
);
_initial_geometry
=
getLightGeometry
(
_hdf5filename
,
geometry
);
_initial_topology
=
getLightTopology
(
_hdf5filename
,
time_step
,
topology
);
_initial_topology
=
getLightTopology
(
_hdf5filename
,
topology
);
std
::
transform
(
std
::
transform
(
constant_attributes
.
begin
(),
constant_attributes
.
end
(),
constant_attributes
.
begin
(),
constant_attributes
.
end
(),
...
...
This diff is collapsed.
Click to expand it.
MeshLib/IO/XDMF/XdmfData.cpp
+
32
−
6
View file @
299c7129
...
@@ -47,13 +47,31 @@ static boost::shared_ptr<XdmfArrayType const> MeshPropertyDataType2XdmfType(
...
@@ -47,13 +47,31 @@ static boost::shared_ptr<XdmfArrayType const> MeshPropertyDataType2XdmfType(
}
}
}
}
XdmfData
::
XdmfData
(
std
::
size_t
size_partitioned_dim
,
XdmfData
::
XdmfData
(
std
::
size_t
const
size_partitioned_dim
,
std
::
size_t
const
size_tuple
,
std
::
size_t
const
size_tuple
,
MeshPropertyDataType
const
mesh_property_data_type
,
MeshPropertyDataType
const
mesh_property_data_type
,
std
::
string
const
&
name
,
std
::
string
const
&
name
,
std
::
optional
<
MeshLib
::
MeshItemType
>
const
attribute_center
)
std
::
optional
<
MeshLib
::
MeshItemType
>
const
attribute_center
)
:
starts
{
0
,
0
,
0
},
:
starts
([
&
size_tuple
]()
{
strides
{
1
,
1
,
1
},
if
(
size_tuple
>
1
)
{
return
std
::
vector
<
XdmfDimType
>
{
0
,
0
};
}
else
{
return
std
::
vector
<
XdmfDimType
>
{
0
};
}
}()),
strides
([
&
size_tuple
]()
{
if
(
size_tuple
>
1
)
{
return
std
::
vector
<
XdmfDimType
>
{
1
};
}
else
{
return
std
::
vector
<
XdmfDimType
>
{
1
,
1
};
}
}()),
name
(
name
),
name
(
name
),
attribute_center
(
attribute_center
)
attribute_center
(
attribute_center
)
{
{
...
@@ -64,12 +82,20 @@ XdmfData::XdmfData(std::size_t size_partitioned_dim,
...
@@ -64,12 +82,20 @@ XdmfData::XdmfData(std::size_t size_partitioned_dim,
auto
const
ui_global_components
=
auto
const
ui_global_components
=
static_cast
<
unsigned
int
>
(
partition_info
.
global_length
);
static_cast
<
unsigned
int
>
(
partition_info
.
global_length
);
auto
const
ui_tuple_size
=
static_cast
<
unsigned
int
>
(
size_tuple
);
auto
const
ui_tuple_size
=
static_cast
<
unsigned
int
>
(
size_tuple
);
global_block_dims
=
{
ui_global_components
,
ui_tuple_size
};
if
(
ui_tuple_size
==
1
)
{
global_block_dims
=
{
ui_global_components
};
}
else
{
global_block_dims
=
{
ui_global_components
,
ui_tuple_size
};
}
data_type
=
MeshPropertyDataType2XdmfType
(
mesh_property_data_type
);
data_type
=
MeshPropertyDataType2XdmfType
(
mesh_property_data_type
);
DBUG
(
DBUG
(
"XDMF: dataset name: {:s}, offset: {:d} "
"XDMF: dataset name: {:s}, offset: {:d} "
"global_blocks: {:d}, tuples: {:d}"
,
"global_blocks: {:d}, tuples: {:d}"
,
name
,
partition_info
.
local_offset
,
name
,
partition_info
.
local_offset
,
global_block_dims
[
0
],
ui_tuple_size
);
global_block_dims
[
0
],
ui_tuple_size
);
}
}
}
// namespace MeshLib::IO
}
// namespace MeshLib::IO
\ No newline at end of file
This diff is collapsed.
Click to expand it.
MeshLib/IO/XDMF/XdmfHdfWriter.cpp
+
1
−
1
View file @
299c7129
...
@@ -21,7 +21,7 @@ XdmfHdfWriter::XdmfHdfWriter(MeshLib::Mesh const& mesh,
...
@@ -21,7 +21,7 @@ XdmfHdfWriter::XdmfHdfWriter(MeshLib::Mesh const& mesh,
std
::
filesystem
::
path
const
&
filepath
,
std
::
filesystem
::
path
const
&
filepath
,
int
const
time_step
,
int
const
time_step
,
std
::
set
<
std
::
string
>
std
::
set
<
std
::
string
>
variable_output_names
,
variable_output_names
,
bool
const
use_compression
)
bool
const
use_compression
)
{
{
// transform Data into contiguous data and collect meta data
// transform Data into contiguous data and collect meta data
...
...
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