Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
pugs
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
code
pugs
Commits
5d8e66cf
Commit
5d8e66cf
authored
May 12, 2024
by
Stéphane Del Pino
Browse files
Options
Downloads
Patches
Plain Diff
Add checkpoint/resume for INamedDiscreteData
parent
96543d03
No related branches found
No related tags found
1 merge request
!199
Integrate checkpointing
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/utils/checkpointing/CheckpointUtils.cpp
+16
-4
16 additions, 4 deletions
src/utils/checkpointing/CheckpointUtils.cpp
src/utils/checkpointing/ResumeUtils.cpp
+28
-22
28 additions, 22 deletions
src/utils/checkpointing/ResumeUtils.cpp
with
44 additions
and
26 deletions
src/utils/checkpointing/CheckpointUtils.cpp
+
16
−
4
View file @
5d8e66cf
...
@@ -434,6 +434,16 @@ writeIInterfaceDescriptor(const std::string& symbol_name,
...
@@ -434,6 +434,16 @@ writeIInterfaceDescriptor(const std::string& symbol_name,
}
}
}
}
void
writeItemArrayVariant
(
HighFive
::
Group
&
variable_group
,
std
::
shared_ptr
<
const
ItemArrayVariant
>
item_array_variant_v
,
HighFive
::
File
&
file
,
HighFive
::
Group
&
checkpoint_group
);
void
writeItemValueVariant
(
HighFive
::
Group
&
variable_group
,
std
::
shared_ptr
<
const
ItemValueVariant
>
item_value_variant_v
,
HighFive
::
File
&
file
,
HighFive
::
Group
&
checkpoint_group
);
void
void
writeINamedDiscreteData
(
const
std
::
string
&
symbol_name
,
writeINamedDiscreteData
(
const
std
::
string
&
symbol_name
,
const
EmbeddedData
&
embedded_data
,
const
EmbeddedData
&
embedded_data
,
...
@@ -465,15 +475,17 @@ writeINamedDiscreteData(const std::string& symbol_name,
...
@@ -465,15 +475,17 @@ writeINamedDiscreteData(const std::string& symbol_name,
case
INamedDiscreteData
::
Type
::
item_array
:
{
case
INamedDiscreteData
::
Type
::
item_array
:
{
const
NamedItemArrayVariant
&
named_item_array_v
=
dynamic_cast
<
const
NamedItemArrayVariant
&>
(
inamed_discrete_data
);
const
NamedItemArrayVariant
&
named_item_array_v
=
dynamic_cast
<
const
NamedItemArrayVariant
&>
(
inamed_discrete_data
);
throw
NotImplementedError
(
"INamedDiscreteData::Type::item_array"
);
HighFive
::
Group
item_array_group
=
variable_group
.
createGroup
(
"item_array_variant"
);
#warning NOT IMPLEMENTED
writeItemArrayVariant
(
item_array_group
,
named_item_array_v
.
itemArrayVariant
(),
file
,
checkpoint_group
);
break
;
break
;
}
}
case
INamedDiscreteData
::
Type
::
item_value
:
{
case
INamedDiscreteData
::
Type
::
item_value
:
{
const
NamedItemValueVariant
&
named_item_value_v
=
dynamic_cast
<
const
NamedItemValueVariant
&>
(
inamed_discrete_data
);
const
NamedItemValueVariant
&
named_item_value_v
=
dynamic_cast
<
const
NamedItemValueVariant
&>
(
inamed_discrete_data
);
throw
NotImplementedError
(
"INamedDiscreteData::Type::item_value"
);
HighFive
::
Group
item_value_group
=
variable_group
.
createGroup
(
"item_value_variant"
);
#warning NOT IMPLEMENTED
writeItemValueVariant
(
item_value_group
,
named_item_value_v
.
itemValueVariant
(),
file
,
checkpoint_group
);
break
;
break
;
}
}
}
}
...
...
This diff is collapsed.
Click to expand it.
src/utils/checkpointing/ResumeUtils.cpp
+
28
−
22
View file @
5d8e66cf
...
@@ -15,6 +15,8 @@
...
@@ -15,6 +15,8 @@
#include
<mesh/NumberedInterfaceDescriptor.hpp>
#include
<mesh/NumberedInterfaceDescriptor.hpp>
#include
<mesh/NumberedZoneDescriptor.hpp>
#include
<mesh/NumberedZoneDescriptor.hpp>
#include
<output/NamedDiscreteFunction.hpp>
#include
<output/NamedDiscreteFunction.hpp>
#include
<output/NamedItemArrayVariant.hpp>
#include
<output/NamedItemValueVariant.hpp>
#include
<scheme/AxisBoundaryConditionDescriptor.hpp>
#include
<scheme/AxisBoundaryConditionDescriptor.hpp>
#include
<scheme/DirichletBoundaryConditionDescriptor.hpp>
#include
<scheme/DirichletBoundaryConditionDescriptor.hpp>
#include
<scheme/DiscreteFunctionDescriptorP0.hpp>
#include
<scheme/DiscreteFunctionDescriptorP0.hpp>
...
@@ -41,6 +43,8 @@
...
@@ -41,6 +43,8 @@
#include
<utils/checkpointing/QuadratureTypeHFType.hpp>
#include
<utils/checkpointing/QuadratureTypeHFType.hpp>
#include
<utils/checkpointing/ResumingData.hpp>
#include
<utils/checkpointing/ResumingData.hpp>
std
::
shared_ptr
<
ItemArrayVariant
>
readItemArrayVariant
(
const
HighFive
::
Group
&
item_array_variant_group
);
std
::
shared_ptr
<
ItemValueVariant
>
readItemValueVariant
(
const
HighFive
::
Group
&
item_value_variant_group
);
std
::
shared_ptr
<
DiscreteFunctionVariant
>
readDiscreteFunctionVariant
(
const
HighFive
::
Group
&
discrete_function_group
);
std
::
shared_ptr
<
DiscreteFunctionVariant
>
readDiscreteFunctionVariant
(
const
HighFive
::
Group
&
discrete_function_group
);
template
<
typename
T
,
ItemType
item_type
>
template
<
typename
T
,
ItemType
item_type
>
...
@@ -238,11 +242,13 @@ readINamedDiscreteData(const std::string& symbol_name, const HighFive::Group& sy
...
@@ -238,11 +242,13 @@ readINamedDiscreteData(const std::string& symbol_name, const HighFive::Group& sy
break
;
break
;
}
}
case
INamedDiscreteData
::
Type
::
item_array
:
{
case
INamedDiscreteData
::
Type
::
item_array
:
{
throw
NotImplementedError
(
"readINamedDiscreteData"
);
HighFive
::
Group
item_array_group
=
inamed_discrete_data_group
.
getGroup
(
"item_array_variant"
);
inamed_discrete_data
=
std
::
make_shared
<
const
NamedItemArrayVariant
>
(
readItemArrayVariant
(
item_array_group
),
name
);
break
;
break
;
}
}
case
INamedDiscreteData
::
Type
::
item_value
:
{
case
INamedDiscreteData
::
Type
::
item_value
:
{
throw
NotImplementedError
(
"readINamedDiscreteData"
);
HighFive
::
Group
item_value_group
=
inamed_discrete_data_group
.
getGroup
(
"item_value_variant"
);
inamed_discrete_data
=
std
::
make_shared
<
const
NamedItemValueVariant
>
(
readItemValueVariant
(
item_value_group
),
name
);
break
;
break
;
}
}
}
}
...
@@ -279,7 +285,7 @@ readIQuadratureDescriptor(const std::string& symbol_name, const HighFive::Group&
...
@@ -279,7 +285,7 @@ readIQuadratureDescriptor(const std::string& symbol_name, const HighFive::Group&
}
}
template
<
ItemType
item_type
>
template
<
ItemType
item_type
>
EmbeddedData
std
::
shared_ptr
<
ItemArrayVariant
>
readItemArrayVariant
(
const
HighFive
::
Group
&
item_array_variant_group
)
readItemArrayVariant
(
const
HighFive
::
Group
&
item_array_variant_group
)
{
{
const
std
::
string
data_type
=
item_array_variant_group
.
getAttribute
(
"data_type"
).
read
<
std
::
string
>
();
const
std
::
string
data_type
=
item_array_variant_group
.
getAttribute
(
"data_type"
).
read
<
std
::
string
>
();
...
@@ -322,43 +328,43 @@ readItemArrayVariant(const HighFive::Group& item_array_variant_group)
...
@@ -322,43 +328,43 @@ readItemArrayVariant(const HighFive::Group& item_array_variant_group)
}
else
{
}
else
{
throw
UnexpectedError
(
"unexpected discrete function data type: "
+
data_type
);
throw
UnexpectedError
(
"unexpected discrete function data type: "
+
data_type
);
}
}
return
{
std
::
make_shared
<
DataHandler
<
const
ItemArrayVariant
>>
(
p_item_array
)}
;
return
p_item_array
;
}
}
EmbeddedData
std
::
shared_ptr
<
ItemArrayVariant
>
readItemArrayVariant
(
const
HighFive
::
Group
&
item_array_variant_group
)
readItemArrayVariant
(
const
HighFive
::
Group
&
item_array_variant_group
)
{
{
const
ItemType
item_type
=
item_array_variant_group
.
getAttribute
(
"item_type"
).
read
<
ItemType
>
();
const
ItemType
item_type
=
item_array_variant_group
.
getAttribute
(
"item_type"
).
read
<
ItemType
>
();
EmbeddedData
embedded_data
;
std
::
shared_ptr
<
ItemArrayVariant
>
p_item_array
;
switch
(
item_type
)
{
switch
(
item_type
)
{
case
ItemType
::
cell
:
{
case
ItemType
::
cell
:
{
embedded_data
=
readItemArrayVariant
<
ItemType
::
cell
>
(
item_array_variant_group
);
p_item_array
=
readItemArrayVariant
<
ItemType
::
cell
>
(
item_array_variant_group
);
break
;
break
;
}
}
case
ItemType
::
face
:
{
case
ItemType
::
face
:
{
embedded_data
=
readItemArrayVariant
<
ItemType
::
face
>
(
item_array_variant_group
);
p_item_array
=
readItemArrayVariant
<
ItemType
::
face
>
(
item_array_variant_group
);
break
;
break
;
}
}
case
ItemType
::
edge
:
{
case
ItemType
::
edge
:
{
embedded_data
=
readItemArrayVariant
<
ItemType
::
edge
>
(
item_array_variant_group
);
p_item_array
=
readItemArrayVariant
<
ItemType
::
edge
>
(
item_array_variant_group
);
break
;
break
;
}
}
case
ItemType
::
node
:
{
case
ItemType
::
node
:
{
embedded_data
=
readItemArrayVariant
<
ItemType
::
node
>
(
item_array_variant_group
);
p_item_array
=
readItemArrayVariant
<
ItemType
::
node
>
(
item_array_variant_group
);
break
;
break
;
}
}
}
}
return
embedded_data
;
return
p_item_array
;
}
}
EmbeddedData
EmbeddedData
readItemArrayVariant
(
const
std
::
string
&
symbol_name
,
const
HighFive
::
Group
&
symbol_table_group
)
readItemArrayVariant
(
const
std
::
string
&
symbol_name
,
const
HighFive
::
Group
&
symbol_table_group
)
{
{
const
HighFive
::
Group
item_array_variant_group
=
symbol_table_group
.
getGroup
(
"embedded/"
+
symbol_name
);
const
HighFive
::
Group
item_array_variant_group
=
symbol_table_group
.
getGroup
(
"embedded/"
+
symbol_name
);
return
readItemArrayVariant
(
item_array_variant_group
);
return
{
std
::
make_shared
<
DataHandler
<
const
ItemArrayVariant
>>
(
readItemArrayVariant
(
item_array_variant_group
)
)}
;
}
}
EmbeddedData
EmbeddedData
...
@@ -371,7 +377,7 @@ readItemType(const std::string& symbol_name, const HighFive::Group& symbol_table
...
@@ -371,7 +377,7 @@ readItemType(const std::string& symbol_name, const HighFive::Group& symbol_table
}
}
template
<
ItemType
item_type
>
template
<
ItemType
item_type
>
EmbeddedData
std
::
shared_ptr
<
ItemValueVariant
>
readItemValueVariant
(
const
HighFive
::
Group
&
item_value_variant_group
)
readItemValueVariant
(
const
HighFive
::
Group
&
item_value_variant_group
)
{
{
const
std
::
string
data_type
=
item_value_variant_group
.
getAttribute
(
"data_type"
).
read
<
std
::
string
>
();
const
std
::
string
data_type
=
item_value_variant_group
.
getAttribute
(
"data_type"
).
read
<
std
::
string
>
();
...
@@ -414,43 +420,43 @@ readItemValueVariant(const HighFive::Group& item_value_variant_group)
...
@@ -414,43 +420,43 @@ readItemValueVariant(const HighFive::Group& item_value_variant_group)
}
else
{
}
else
{
throw
UnexpectedError
(
"unexpected discrete function data type: "
+
data_type
);
throw
UnexpectedError
(
"unexpected discrete function data type: "
+
data_type
);
}
}
return
{
std
::
make_shared
<
DataHandler
<
const
ItemValueVariant
>>
(
p_item_value
)}
;
return
p_item_value
;
}
}
EmbeddedData
std
::
shared_ptr
<
ItemValueVariant
>
readItemValueVariant
(
const
HighFive
::
Group
&
item_value_variant_group
)
readItemValueVariant
(
const
HighFive
::
Group
&
item_value_variant_group
)
{
{
const
ItemType
item_type
=
item_value_variant_group
.
getAttribute
(
"item_type"
).
read
<
ItemType
>
();
const
ItemType
item_type
=
item_value_variant_group
.
getAttribute
(
"item_type"
).
read
<
ItemType
>
();
EmbeddedData
embedded_data
;
std
::
shared_ptr
<
ItemValueVariant
>
p_item_value
;
switch
(
item_type
)
{
switch
(
item_type
)
{
case
ItemType
::
cell
:
{
case
ItemType
::
cell
:
{
embedded_data
=
readItemValueVariant
<
ItemType
::
cell
>
(
item_value_variant_group
);
p_item_value
=
readItemValueVariant
<
ItemType
::
cell
>
(
item_value_variant_group
);
break
;
break
;
}
}
case
ItemType
::
face
:
{
case
ItemType
::
face
:
{
embedded_data
=
readItemValueVariant
<
ItemType
::
face
>
(
item_value_variant_group
);
p_item_value
=
readItemValueVariant
<
ItemType
::
face
>
(
item_value_variant_group
);
break
;
break
;
}
}
case
ItemType
::
edge
:
{
case
ItemType
::
edge
:
{
embedded_data
=
readItemValueVariant
<
ItemType
::
edge
>
(
item_value_variant_group
);
p_item_value
=
readItemValueVariant
<
ItemType
::
edge
>
(
item_value_variant_group
);
break
;
break
;
}
}
case
ItemType
::
node
:
{
case
ItemType
::
node
:
{
embedded_data
=
readItemValueVariant
<
ItemType
::
node
>
(
item_value_variant_group
);
p_item_value
=
readItemValueVariant
<
ItemType
::
node
>
(
item_value_variant_group
);
break
;
break
;
}
}
}
}
return
embedded_data
;
return
p_item_value
;
}
}
EmbeddedData
EmbeddedData
readItemValueVariant
(
const
std
::
string
&
symbol_name
,
const
HighFive
::
Group
&
symbol_table_group
)
readItemValueVariant
(
const
std
::
string
&
symbol_name
,
const
HighFive
::
Group
&
symbol_table_group
)
{
{
const
HighFive
::
Group
item_value_variant_group
=
symbol_table_group
.
getGroup
(
"embedded/"
+
symbol_name
);
const
HighFive
::
Group
item_value_variant_group
=
symbol_table_group
.
getGroup
(
"embedded/"
+
symbol_name
);
return
readItemValueVariant
(
item_value_variant_group
);
return
{
std
::
make_shared
<
DataHandler
<
const
ItemValueVariant
>>
(
readItemValueVariant
(
item_value_variant_group
)
)}
;
}
}
EmbeddedData
EmbeddedData
...
...
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