https://mooseframework.inl.gov
Loading...
Searching...
No Matches
Classes | Namespaces | Functions
DataIO.h File Reference

Go to the source code of this file.

Classes

struct  Moose::MFEM::SolutionState
 
class  libMesh::Parallel::Packing< std::basic_string< T > >
 

Namespaces

namespace  libMesh
 The following methods are specializations for using the libMesh::Parallel::packed_range_* routines for std::strings.
 
namespace  Moose
 MOOSE now contains C++17 code, so give a reasonable error message stating what the user can do to address this in their environment if C++17 compatibility isn't found.
 
namespace  Moose::MFEM
 Utilities for converting between vector(s) of libMesh Points and MFEM Vector(s).
 
namespace  moose
 
namespace  moose::internal
 
namespace  libMesh::Parallel
 

Functions

template<typename T >
void dataStore (std::ostream &stream, T &v, void *)
 
template<typename T >
void moose::internal::dataStoreSizeof (std::ostream &stream, T &v)
 
template<>
dataStoreSizeofSpecialization(bool) dataStoreSizeofSpecialization(char) dataStoreSizeofSpecialization(signed char) dataStoreSizeofSpecialization(short int) dataStoreSizeofSpecialization(int) dataStoreSizeofSpecialization(long int) dataStoreSizeofSpecialization(long long int) dataStoreSizeofSpecialization(unsigned char) dataStoreSizeofSpecialization(short unsigned int) dataStoreSizeofSpecialization(unsigned int) dataStoreSizeofSpecialization(long unsigned int) dataStoreSizeofSpecialization(long long unsigned int) dataStoreSizeofSpecialization(float) dataStoreSizeofSpecialization(double) dataStoreSizeofSpecialization(long double) dataStoreEnum(libMesh void dataStore (std::ostream &stream, libMesh::Point &p, void *context)
 
template<>
void dataStore (std::ostream &stream, const libMesh::Point &p, void *context)
 
template<>
void dataStore (std::ostream &stream, std::string &v, void *context)
 
template<>
void dataStore (std::ostream &stream, VariableName &v, void *context)
 
template<>
void dataStore (std::ostream &stream, UserObjectName &v, void *context)
 
template<>
void dataStore (std::ostream &stream, libMesh::FEType &v, void *context)
 
template<>
void dataStore (std::ostream &stream, const Elem *&e, void *context)
 
template<>
void dataStore (std::ostream &stream, const Node *&n, void *context)
 
template<>
void dataStore (std::ostream &stream, Elem *&e, void *context)
 
template<>
void dataStore (std::ostream &stream, Node *&n, void *context)
 
template<>
void dataStore (std::ostream &stream, std::stringstream &s, void *context)
 
template<>
void dataStore (std::ostream &stream, ADReal &dn, void *context)
 
template<>
void dataStore (std::ostream &stream, libMesh::Parameters &p, void *context)
 
template<typename T >
void dataStore (std::ostream &stream, std::shared_ptr< T > &v, void *context)
 
template<typename T >
void dataStore (std::ostream &stream, std::unique_ptr< T > &v, void *context)
 
template<>
void dataStore (std::ostream &stream, std::unique_ptr< libMesh::NumericVector< libMesh::Number > > &v, void *context)
 Stores an owned numeric vector.
 
template<typename T >
void dataStore (std::ostream &stream, libMesh::TensorValue< T > &v, void *context)
 
template<typename T >
void dataStore (std::ostream &stream, libMesh::DenseMatrix< T > &v, void *context)
 
template<typename T >
void dataStore (std::ostream &stream, libMesh::DenseVector< T > &v, void *context)
 
template<typename T >
void dataStore (std::ostream &stream, libMesh::VectorValue< T > &v, void *context)
 
template<typename T >
void dataStore (std::ostream &stream, std::vector< T > &v, void *context)
 
template<typename T >
void dataStore (std::ostream &stream, std::set< T > &s, void *context)
 
template<typename T >
void dataStore (std::ostream &stream, std::list< T > &l, void *context)
 
template<typename T >
void dataStore (std::ostream &stream, std::deque< T > &l, void *context)
 
template<typename T , typename U >
void dataStore (std::ostream &stream, std::map< T, U > &m, void *context)
 
template<typename T , typename U >
void dataStore (std::ostream &stream, std::unordered_map< T, U > &m, void *context)
 
template<typename T >
void dataStore (std::ostream &stream, std::unordered_set< T > &s, void *context)
 
template<typename T , std::size_t N>
void dataStore (std::ostream &stream, std::array< T, N > &arr, void *context)
 
template<typename T , int Rows, int Cols>
void dataStore (std::ostream &stream, Eigen::Matrix< T, Rows, Cols > &v, void *context)
 
template<typename T >
void dataStore (std::ostream &, T *&, void *)
 
void dataStore (std::ostream &stream, libMesh::BoundingBox &p, void *context)
 
template<typename T , typename U >
void dataStore (std::ostream &stream, std::pair< T, U > &p, void *context)
 
void dataStore (std::ostream &ostream, std::vector< bool > &v, void *ctx)
 
template<typename T >
void dataStore (std::ostream &stream, std::optional< T > &m, void *context)
 
template<typename T , typename U >
void dataStore (std::ostream &stream, HashMap< T, U > &m, void *context)
 
template<typename T >
void dataStore (std::ostream &stream, GenericTwoVector< T > &v, void *context)
 
template<>
void dataStore (std::ostream &stream, Real &v, void *context)
 
template<>
void dataStore (std::ostream &stream, std::string &v, void *context)
 
template<>
void dataStore (std::ostream &stream, VariableName &v, void *context)
 
template<>
void dataStore (std::ostream &stream, UserObjectName &v, void *context)
 
template<>
void dataStore (std::ostream &stream, bool &v, void *context)
 
template<>
void dataStore (std::ostream &stream, libMesh::FEType &v, void *context)
 
template<>
void dataStore (std::ostream &stream, const Elem *&e, void *context)
 
template<>
void dataStore (std::ostream &stream, const Node *&n, void *context)
 
template<>
void dataStore (std::ostream &stream, Elem *&e, void *context)
 
template<>
void dataStore (std::ostream &stream, Node *&n, void *context)
 
template<>
void dataStore (std::ostream &stream, std::stringstream &s, void *context)
 
template<>
void dataStore (std::ostream &stream, ADReal &dn, void *context)
 
template<>
void dataStore (std::ostream &stream, torch::Tensor &t, void *context)
 
template<>
void dataStore (std::ostream &stream, libMesh::Parameters &p, void *context)
 
template<>
void dataStore (std::ostream &stream, Moose::MFEM::SolutionState &state, void *context)
 
template<>
void dataStore (std::ostream &stream, std::unique_ptr< libMesh::NumericVector< libMesh::Number > > &v, void *context)
 Stores an owned numeric vector.
 
template<typename T , std::size_t N>
void dataStore (std::ostream &stream, T(&arr)[N], void *context)
 
template<typename T >
void dataStore (std::ostream &stream, libMesh::NumericVector< T > &v, void *context)
 
template<>
void dataStore (std::ostream &stream, Vec &v, void *context)
 
template<typename T >
void dataStore (std::ostream &stream, DenseVector< T > &v, void *context)
 
template<typename T >
void dataStore (std::ostream &stream, RankTwoTensorTempl< T > &rtt, void *context)
 
template<typename T >
void dataStore (std::ostream &stream, RankThreeTensorTempl< T > &rtt, void *context)
 
template<typename T >
void dataStore (std::ostream &stream, RankFourTensorTempl< T > &rft, void *context)
 
template<typename T >
void dataStore (std::ostream &stream, SymmetricRankTwoTensorTempl< T > &srtt, void *context)
 
template<typename T >
void dataStore (std::ostream &stream, SymmetricRankFourTensorTempl< T > &srft, void *context)
 
template<typename T >
void dataStore (std::ostream &stream, ColumnMajorMatrixTempl< T > &cmm, void *context)
 
template<typename T >
void dataStore (std::ostream &stream, UniqueStorage< T > &data, void *context)
 UniqueStorage helper routine.
 
template<typename T >
void dataLoad (std::istream &, T &, void *)
 
template<typename T >
void moose::internal::dataLoadSizeof (std::istream &stream, T &v)
 
template<>
dataLoadSizeofSpecialization(bool) dataLoadSizeofSpecialization(char) dataLoadSizeofSpecialization(signed char) dataLoadSizeofSpecialization(short int) dataLoadSizeofSpecialization(int) dataLoadSizeofSpecialization(long int) dataLoadSizeofSpecialization(long long int) dataLoadSizeofSpecialization(unsigned char) dataLoadSizeofSpecialization(short unsigned int) dataLoadSizeofSpecialization(unsigned int) dataLoadSizeofSpecialization(long unsigned int) dataLoadSizeofSpecialization(long long unsigned int) dataLoadSizeofSpecialization(float) dataLoadSizeofSpecialization(double) dataLoadSizeofSpecialization(long double) dataLoadEnum(libMesh void dataLoad (std::istream &stream, std::string &v, void *)
 
template<>
void dataLoad (std::istream &stream, VariableName &v, void *)
 
template<>
void dataLoad (std::istream &stream, UserObjectName &v, void *)
 
template<>
void dataLoad (std::istream &stream, libMesh::FEType &v, void *)
 
template<>
void dataLoad (std::istream &stream, const Elem *&e, void *context)
 
template<>
void dataLoad (std::istream &stream, const Node *&e, void *context)
 
template<>
void dataLoad (std::istream &stream, Elem *&e, void *context)
 
template<>
void dataLoad (std::istream &stream, Node *&e, void *context)
 
template<>
void dataLoad (std::istream &stream, std::stringstream &s, void *context)
 
template<>
void dataLoad (std::istream &stream, ADReal &dn, void *context)
 
template<>
void dataLoad (std::istream &stream, libMesh::Parameters &p, void *context)
 
template<>
void dataLoad (std::istream &stream, libMesh::Point &p, void *context)
 
template<typename T >
void dataLoad (std::istream &stream, std::shared_ptr< T > &v, void *context)
 
template<typename T >
void dataLoad (std::istream &stream, std::unique_ptr< T > &v, void *context)
 
template<>
void dataLoad (std::istream &stream, std::unique_ptr< libMesh::NumericVector< libMesh::Number > > &v, void *context)
 Loads an owned numeric vector.
 
template<typename T >
void dataLoad (std::istream &stream, libMesh::TensorValue< T > &v, void *context)
 
template<typename T >
void dataLoad (std::istream &stream, libMesh::DenseMatrix< T > &v, void *context)
 
template<typename T >
void dataLoad (std::istream &stream, libMesh::DenseVector< T > &v, void *context)
 
template<typename T >
void dataLoad (std::istream &stream, libMesh::VectorValue< T > &v, void *context)
 
template<typename T >
void dataLoad (std::istream &stream, std::vector< T > &v, void *context)
 
template<typename T >
void dataLoad (std::istream &stream, std::set< T > &s, void *context)
 
template<typename T >
void dataLoad (std::istream &stream, std::list< T > &l, void *context)
 
template<typename T >
void dataLoad (std::istream &stream, std::deque< T > &l, void *context)
 
template<typename T , typename U >
void dataLoad (std::istream &stream, std::map< T, U > &m, void *context)
 
template<typename T , typename U >
void dataLoad (std::istream &stream, std::unordered_map< T, U > &m, void *context)
 
template<typename T >
void dataLoad (std::istream &stream, std::unordered_set< T > &s, void *context)
 
template<typename T , std::size_t N>
void dataLoad (std::istream &stream, std::array< T, N > &arr, void *context)
 
template<typename T , int Rows, int Cols>
void dataLoad (std::istream &stream, Eigen::Matrix< T, Rows, Cols > &v, void *context)
 
template<typename T >
void dataLoad (std::istream &, T *&, void *)
 
template<typename T , typename U >
void dataLoad (std::istream &stream, std::pair< T, U > &p, void *context)
 
void dataLoad (std::istream &stream, std::vector< bool > &v, void *context)
 
template<typename T >
void dataLoad (std::istream &stream, std::optional< T > &m, void *context)
 
template<typename T , typename U >
void dataLoad (std::istream &stream, HashMap< T, U > &m, void *context)
 
template<typename T >
void dataLoad (std::istream &stream, GenericTwoVector< T > &v, void *context)
 
template<>
void dataLoad (std::istream &stream, Real &v, void *)
 
template<>
void dataLoad (std::istream &stream, std::string &v, void *)
 
template<>
void dataLoad (std::istream &stream, VariableName &v, void *)
 
template<>
void dataLoad (std::istream &stream, UserObjectName &v, void *)
 
template<>
void dataLoad (std::istream &stream, bool &v, void *)
 
template<>
void dataLoad (std::istream &stream, libMesh::FEType &v, void *)
 
template<>
void dataLoad (std::istream &stream, const Elem *&e, void *context)
 
template<>
void dataLoad (std::istream &stream, const Node *&e, void *context)
 
template<>
void dataLoad (std::istream &stream, Elem *&e, void *context)
 
template<>
void dataLoad (std::istream &stream, Node *&e, void *context)
 
template<>
void dataLoad (std::istream &stream, std::stringstream &s, void *context)
 
template<>
void dataLoad (std::istream &stream, ADReal &dn, void *context)
 
template<>
void dataLoad (std::istream &stream, torch::Tensor &t, void *context)
 
template<>
void dataLoad (std::istream &stream, libMesh::Parameters &p, void *context)
 
template<>
void dataLoad (std::istream &stream, Moose::MFEM::SolutionState &state, void *context)
 
template<>
void dataLoad (std::istream &stream, std::unique_ptr< libMesh::NumericVector< libMesh::Number > > &v, void *context)
 Loads an owned numeric vector.
 
template<typename T , std::size_t N>
void dataLoad (std::istream &stream, T(&arr)[N], void *context)
 
template<typename T >
void dataLoad (std::istream &stream, libMesh::NumericVector< T > &v, void *context)
 
template<>
void dataLoad (std::istream &stream, Vec &v, void *context)
 
template<typename T >
void dataLoad (std::istream &stream, DenseVector< T > &v, void *context)
 
template<typename T >
void dataLoad (std::istream &stream, RankTwoTensorTempl< T > &rtt, void *context)
 
template<typename T >
void dataLoad (std::istream &stream, RankThreeTensorTempl< T > &rtt, void *context)
 
template<typename T >
void dataLoad (std::istream &stream, RankFourTensorTempl< T > &rft, void *context)
 
template<typename T >
void dataLoad (std::istream &stream, SymmetricRankTwoTensorTempl< T > &rtt, void *context)
 
template<typename T >
void dataLoad (std::istream &stream, SymmetricRankFourTensorTempl< T > &rft, void *context)
 
template<typename T >
void dataLoad (std::istream &stream, ColumnMajorMatrixTempl< T > &cmm, void *context)
 
template<typename T >
void dataLoad (std::istream &stream, UniqueStorage< T > &data, void *context)
 UniqueStorage Helper Function.
 
void dataLoad (std::istream &stream, libMesh::BoundingBox &p, void *context)
 

Function Documentation

◆ dataLoad() [1/63]

template<typename T >
void dataLoad ( std::istream &  ,
T &  ,
void *   
)
inline

Definition at line 627 of file DataIO.h.

628{
629 static_assert(sizeof(T) == 0, "Must write dataLoad specialization");
630}

Referenced by dataLoad(), dataLoad(), dataLoad(), dataLoad(), dataLoad(), dataLoad(), dataLoad(), dataLoad(), dataLoad(), dataLoad(), dataLoad(), dataLoad(), dataLoad(), dataLoad(), dataLoad(), dataLoad(), dataLoad(), dataLoad(), dataLoad(), dataLoad(), dataLoad(), dataLoad(), dataLoad(), dataLoad(), and dataLoad().

◆ dataLoad() [2/63]

template<typename T >
void dataLoad ( std::istream &  ,
T *&  ,
void *   
)

Definition at line 793 of file DataIO.h.

794{
795 mooseError("Attempting to load a raw pointer type: \"",
796 libMesh::demangle(typeid(T).name()),
797 " *\" as restartable data!\nWrite a custom dataLoad() template specialization!\n\n");
798}
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application.
Definition MooseError.h:311
std::string name(const ElemQuality q)
std::string demangle(const char *name)

◆ dataLoad() [3/63]

template<>
void dataLoad ( std::istream &  stream,
ADReal &  dn,
void *  context 
)

Definition at line 488 of file DataIO.C.

489{
490 dataLoad(stream, dn.value(), context);
491
492 if (ADReal::do_derivatives)
493 {
494 auto & derivatives = dn.derivatives();
495 std::size_t size = 0;
496 stream.read((char *)&size, sizeof(size));
497 derivatives.resize(size);
498
499 for (MooseIndex(derivatives) i = 0; i < derivatives.size(); ++i)
500 {
501 dataLoad(stream, derivatives.raw_index(i), context);
502 dataLoad(stream, derivatives.raw_at(i), context);
503 }
504 }
505}
void dataLoad(std::istream &stream, std::string &v, void *)
Definition DataIO.C:420

◆ dataLoad() [4/63]

template<>
void dataLoad ( std::istream &  stream,
ADReal &  dn,
void *  context 
)

Definition at line 488 of file DataIO.C.

489{
490 dataLoad(stream, dn.value(), context);
491
492 if (ADReal::do_derivatives)
493 {
494 auto & derivatives = dn.derivatives();
495 std::size_t size = 0;
496 stream.read((char *)&size, sizeof(size));
497 derivatives.resize(size);
498
499 for (MooseIndex(derivatives) i = 0; i < derivatives.size(); ++i)
500 {
501 dataLoad(stream, derivatives.raw_index(i), context);
502 dataLoad(stream, derivatives.raw_at(i), context);
503 }
504 }
505}

◆ dataLoad() [5/63]

template<>
void dataLoad ( std::istream &  stream,
bool &  v,
void *   
)

◆ dataLoad() [6/63]

template<typename T >
void dataLoad ( std::istream &  stream,
ColumnMajorMatrixTempl< T > &  cmm,
void *  context 
)

Definition at line 1168 of file DataIO.h.

1169{
1170 dataLoad(stream, cmm._values, context);
1171}
void dataLoad(std::istream &, T &, void *)
Definition DataIO.h:627

◆ dataLoad() [7/63]

template<>
void dataLoad ( std::istream &  stream,
const Elem *&  e,
void *  context 
)

Definition at line 509 of file DataIO.C.

510{
511 if (!context)
512 mooseError("Can only load Elem objects using a MooseMesh context!");
513
514 MooseMesh * mesh = static_cast<MooseMesh *>(context);
515
516 // TODO: Write out the unique ID of this element
518
519 dataLoad(stream, id, context);
520
522 e = mesh->elemPtr(id);
523 else
524 e = NULL;
525}
MooseMesh wraps a libMesh::Mesh object and enhances its capabilities by caching additional data and s...
Definition MooseMesh.h:95
static constexpr dof_id_type invalid_id
MeshBase & mesh
uint8_t dof_id_type

◆ dataLoad() [8/63]

template<>
void dataLoad ( std::istream &  stream,
const Elem *&  e,
void *  context 
)

Definition at line 509 of file DataIO.C.

510{
511 if (!context)
512 mooseError("Can only load Elem objects using a MooseMesh context!");
513
514 MooseMesh * mesh = static_cast<MooseMesh *>(context);
515
516 // TODO: Write out the unique ID of this element
518
519 dataLoad(stream, id, context);
520
522 e = mesh->elemPtr(id);
523 else
524 e = NULL;
525}

◆ dataLoad() [9/63]

template<>
void dataLoad ( std::istream &  stream,
const Node *&  e,
void *  context 
)

Definition at line 529 of file DataIO.C.

530{
531 if (!context)
532 mooseError("Can only load Node objects using a MooseMesh context!");
533
534 MooseMesh * mesh = static_cast<MooseMesh *>(context);
535
536 // TODO: Write out the unique ID of this nodeent
538
539 dataLoad(stream, id, context);
540
542 n = mesh->nodePtr(id);
543 else
544 n = NULL;
545}

◆ dataLoad() [10/63]

template<>
void dataLoad ( std::istream &  stream,
const Node *&  e,
void *  context 
)

Definition at line 529 of file DataIO.C.

530{
531 if (!context)
532 mooseError("Can only load Node objects using a MooseMesh context!");
533
534 MooseMesh * mesh = static_cast<MooseMesh *>(context);
535
536 // TODO: Write out the unique ID of this nodeent
538
539 dataLoad(stream, id, context);
540
542 n = mesh->nodePtr(id);
543 else
544 n = NULL;
545}

◆ dataLoad() [11/63]

template<typename T >
void dataLoad ( std::istream &  stream,
DenseVector< T > &  v,
void *  context 
)

Definition at line 1118 of file DataIO.h.

1119{
1120 unsigned int n = 0;
1121 dataLoad(stream, n, nullptr);
1122 v.resize(n);
1123 for (unsigned int i = 0; i < n; i++)
1124 {
1125 T r = 0;
1126 dataLoad(stream, r, context);
1127 v(i) = r;
1128 }
1129}
void resize(const unsigned int n)

◆ dataLoad() [12/63]

template<typename T , int Rows, int Cols>
void dataLoad ( std::istream &  stream,
Eigen::Matrix< T, Rows, Cols > &  v,
void *  context 
)

Definition at line 1003 of file DataIO.h.

1004{
1005 unsigned int m = 0;
1006 dataLoad(stream, m, context);
1007 unsigned int n = 0;
1008 dataLoad(stream, n, context);
1009 v.resize(m, n);
1010 for (const auto i : make_range(m))
1011 for (const auto j : make_range(n))
1012 {
1013 T r{};
1014 dataLoad(stream, r, context);
1015 v(i, j) = r;
1016 }
1017}
for(PetscInt i=0;i< nvars;++i)
IntRange< T > make_range(T beg, T end)

◆ dataLoad() [13/63]

template<>
void dataLoad ( std::istream &  stream,
Elem *&  e,
void *  context 
)

Definition at line 549 of file DataIO.C.

550{
551 if (!context)
552 mooseError("Can only load Elem objects using a MooseMesh context!");
553
554 MooseMesh * mesh = static_cast<MooseMesh *>(context);
555
556 // TODO: Write out the unique ID of this element
558
559 dataLoad(stream, id, context);
560
562 e = mesh->elemPtr(id);
563 else
564 e = NULL;
565}

◆ dataLoad() [14/63]

template<>
void dataLoad ( std::istream &  stream,
Elem *&  e,
void *  context 
)

Definition at line 549 of file DataIO.C.

550{
551 if (!context)
552 mooseError("Can only load Elem objects using a MooseMesh context!");
553
554 MooseMesh * mesh = static_cast<MooseMesh *>(context);
555
556 // TODO: Write out the unique ID of this element
558
559 dataLoad(stream, id, context);
560
562 e = mesh->elemPtr(id);
563 else
564 e = NULL;
565}

◆ dataLoad() [15/63]

template<typename T >
void dataLoad ( std::istream &  stream,
GenericTwoVector< T > &  v,
void *  context 
)

Definition at line 1021 of file DataIO.h.

1022{
1023 dataLoad(stream, libMesh::cast_ref<Eigen::Matrix<T, 2, 1> &>(v), context);
1024}
Tnew cast_ref(Told &oldvar)

◆ dataLoad() [16/63]

template<typename T , typename U >
void dataLoad ( std::istream &  stream,
HashMap< T, U > &  m,
void *  context 
)
inline

Definition at line 985 of file DataIO.h.

986{
987 // First read the size of the map
988 unsigned int size = 0;
989 dataLoad(stream, size, nullptr);
990
991 for (unsigned int i = 0; i < size; i++)
992 {
993 T key;
994 dataLoad(stream, key, context);
995
996 U & value = m[key];
997 dataLoad(stream, value, context);
998 }
999}
Real value(unsigned n, unsigned alpha, unsigned beta, Real x)

◆ dataLoad() [17/63]

void dataLoad ( std::istream &  stream,
libMesh::BoundingBox &  p,
void *  context 
)

Definition at line 702 of file DataIO.C.

703{
704 dataLoad(stream, cast_ref<std::pair<Point, Point> &>(bbox), context);
705}

◆ dataLoad() [18/63]

template<typename T >
void dataLoad ( std::istream &  stream,
libMesh::DenseMatrix< T > &  v,
void *  context 
)

Definition at line 658 of file DataIO.C.

659{
660 unsigned int m = 0, n = 0;
661 stream.read((char *)&m, sizeof(m));
662 stream.read((char *)&n, sizeof(n));
663 v.resize(m, n);
664 for (unsigned int i = 0; i < m; i++)
665 for (unsigned int j = 0; j < n; j++)
666 {
667 T r = 0;
668 dataLoad(stream, r, context);
669 v(i, j) = r;
670 }
671}
void resize(const unsigned int new_m, const unsigned int new_n)

◆ dataLoad() [19/63]

template<typename T >
void dataLoad ( std::istream &  stream,
libMesh::DenseVector< T > &  v,
void *  context 
)

Definition at line 1118 of file DataIO.h.

1119{
1120 unsigned int n = 0;
1121 dataLoad(stream, n, nullptr);
1122 v.resize(n);
1123 for (unsigned int i = 0; i < n; i++)
1124 {
1125 T r = 0;
1126 dataLoad(stream, r, context);
1127 v(i) = r;
1128 }
1129}

◆ dataLoad() [20/63]

template<>
void dataLoad ( std::istream &  stream,
libMesh::FEType &  v,
void *   
)

◆ dataLoad() [21/63]

template<>
void dataLoad ( std::istream &  stream,
libMesh::FEType &  v,
void *   
)

◆ dataLoad() [22/63]

template<typename T >
void dataLoad ( std::istream &  stream,
libMesh::NumericVector< T > &  v,
void *  context 
)

Definition at line 1101 of file DataIO.h.

1102{
1103 numeric_index_type size = v.local_size();
1104 for (numeric_index_type i = v.first_local_index(); i < v.first_local_index() + size; i++)
1105 {
1106 T r = 0;
1107 dataLoad(stream, r, context);
1108 v.set(i, r);
1109 }
1110 v.close();
1111}
virtual void set(const numeric_index_type i, const T value)=0
virtual void close()=0
virtual numeric_index_type local_size() const=0
virtual numeric_index_type first_local_index() const=0
dof_id_type numeric_index_type

◆ dataLoad() [23/63]

template<>
void dataLoad ( std::istream &  stream,
libMesh::Parameters &  p,
void *  context 
)

Definition at line 709 of file DataIO.C.

710{
711 p.clear();
712
713 // First read the size of the map
714 unsigned int size = 0;
715 stream.read((char *)&size, sizeof(size));
716
717 for (unsigned int i = 0; i < size; i++)
718 {
719 std::string key, type;
720 dataLoad(stream, key, context);
721 dataLoad(stream, type, context);
722
723#define loadscalar(ptype) \
724 else if (type == demangle(typeid(ptype).name())) do \
725 { \
726 ptype & value = p.set<ptype>(key); \
727 dataLoad(stream, value, context); \
728 } \
729 while (0)
730
731 if (false)
732 ;
733 loadscalar(Real);
734 loadscalar(short);
735 loadscalar(int);
736 loadscalar(long);
737 loadscalar(unsigned short);
738 loadscalar(unsigned int);
739 loadscalar(unsigned long);
740
741#undef loadscalar
742 }
743}
virtual void clear()

◆ dataLoad() [24/63]

template<>
void dataLoad ( std::istream &  stream,
libMesh::Parameters &  p,
void *  context 
)

Definition at line 709 of file DataIO.C.

710{
711 p.clear();
712
713 // First read the size of the map
714 unsigned int size = 0;
715 stream.read((char *)&size, sizeof(size));
716
717 for (unsigned int i = 0; i < size; i++)
718 {
719 std::string key, type;
720 dataLoad(stream, key, context);
721 dataLoad(stream, type, context);
722
723#define loadscalar(ptype) \
724 else if (type == demangle(typeid(ptype).name())) do \
725 { \
726 ptype & value = p.set<ptype>(key); \
727 dataLoad(stream, value, context); \
728 } \
729 while (0)
730
731 if (false)
732 ;
733 loadscalar(Real);
734 loadscalar(short);
735 loadscalar(int);
736 loadscalar(long);
737 loadscalar(unsigned short);
738 loadscalar(unsigned int);
739 loadscalar(unsigned long);
740
741#undef loadscalar
742 }
743}

◆ dataLoad() [25/63]

template<>
void dataLoad ( std::istream &  stream,
libMesh::Point &  p,
void *  context 
)

◆ dataLoad() [26/63]

template<typename T >
void dataLoad ( std::istream &  stream,
libMesh::TensorValue< T > &  v,
void *  context 
)

Definition at line 640 of file DataIO.C.

641{
642 // Obviously if someone loads data with different LIBMESH_DIM than was used for saving them, it
643 // won't work.
644 for (const auto i : make_range(Moose::dim))
645 for (const auto j : make_range(Moose::dim))
646 {
647 T r = 0;
648 dataLoad(stream, r, context);
649 v(i, j) = r;
650 }
651}
unsigned int dim
MOOSE now contains C++17 code, so give a reasonable error message stating what the user can do to add...

◆ dataLoad() [27/63]

template<typename T >
void dataLoad ( std::istream &  stream,
libMesh::VectorValue< T > &  v,
void *  context 
)

◆ dataLoad() [28/63]

template<>
void dataLoad ( std::istream &  stream,
Moose::MFEM::SolutionState &  state,
void *  context 
)

Definition at line 73 of file SolutionStateData.C.

74{
75 auto * const data = static_cast<MFEMProblemData *>(context);
76
77 int num_gridfunctions = 0;
78 dataLoad(stream, num_gridfunctions, context);
79 for ([[maybe_unused]] const auto i : make_range(num_gridfunctions))
80 {
81 std::string name;
82 dataLoad(stream, name, context);
83 auto & gf = data->gridfunctions.GetRef(name);
84 loadGridFunction(stream, gf, context);
85 }
86
87 int num_complex_gridfunctions = 0;
88 dataLoad(stream, num_complex_gridfunctions, context);
89 for ([[maybe_unused]] const auto i : make_range(num_complex_gridfunctions))
90 {
91 std::string name;
92 dataLoad(stream, name, context);
93 auto & gf = data->cmplx_gridfunctions.GetRef(name);
94 loadGridFunction(stream, gf.real(), context);
95 loadGridFunction(stream, gf.imag(), context);
96 }
97}
void dataLoad(std::istream &stream, Moose::MFEM::SolutionState &, void *context)
Base problem data struct.

Referenced by dataLoad().

◆ dataLoad() [29/63]

template<>
void dataLoad ( std::istream &  stream,
Node *&  e,
void *  context 
)

Definition at line 569 of file DataIO.C.

570{
571 if (!context)
572 mooseError("Can only load Node objects using a MooseMesh context!");
573
574 MooseMesh * mesh = static_cast<MooseMesh *>(context);
575
576 // TODO: Write out the unique ID of this nodeent
578
579 dataLoad(stream, id, context);
580
582 n = mesh->nodePtr(id);
583 else
584 n = NULL;
585}

◆ dataLoad() [30/63]

template<>
void dataLoad ( std::istream &  stream,
Node *&  e,
void *  context 
)

Definition at line 569 of file DataIO.C.

570{
571 if (!context)
572 mooseError("Can only load Node objects using a MooseMesh context!");
573
574 MooseMesh * mesh = static_cast<MooseMesh *>(context);
575
576 // TODO: Write out the unique ID of this nodeent
578
579 dataLoad(stream, id, context);
580
582 n = mesh->nodePtr(id);
583 else
584 n = NULL;
585}

◆ dataLoad() [31/63]

template<typename T >
void dataLoad ( std::istream &  stream,
RankFourTensorTempl< T > &  rft,
void *  context 
)

Definition at line 1147 of file DataIO.h.

1148{
1149 dataLoad(stream, rft._vals, context);
1150}
T _vals[N4]
The values of the rank-four tensor stored by index=(((i * LIBMESH_DIM + j) * LIBMESH_DIM + k) * LIBME...

◆ dataLoad() [32/63]

template<typename T >
void dataLoad ( std::istream &  stream,
RankThreeTensorTempl< T > &  rtt,
void *  context 
)

Definition at line 1140 of file DataIO.h.

1141{
1142 dataLoad(stream, rtt._vals, context);
1143}
T _vals[N3]
The values of the rank-three tensor stored by index=((i * LIBMESH_DIM + j) * LIBMESH_DIM + k)

◆ dataLoad() [33/63]

template<typename T >
void dataLoad ( std::istream &  stream,
RankTwoTensorTempl< T > &  rtt,
void *  context 
)

Definition at line 1133 of file DataIO.h.

1134{
1135 dataLoad(stream, rtt._coords, context);
1136}
T _coords[LIBMESH_DIM *LIBMESH_DIM]

◆ dataLoad() [34/63]

template<>
void dataLoad ( std::istream &  stream,
Real &  v,
void *   
)

◆ dataLoad() [35/63]

template<typename T , std::size_t N>
void dataLoad ( std::istream &  stream,
std::array< T, N > &  arr,
void *  context 
)

Definition at line 1085 of file DataIO.h.

1086{
1087 for (std::size_t i = 0; i < N; ++i)
1088 dataLoad(stream, arr[i], context);
1089}

◆ dataLoad() [36/63]

template<typename T >
void dataLoad ( std::istream &  stream,
std::deque< T > &  l,
void *  context 
)
inline

Definition at line 894 of file DataIO.h.

895{
896 // First read the size of the container
897 unsigned int size = 0;
898 dataLoad(stream, size, nullptr);
899
900 for (unsigned int i = 0; i < size; i++)
901 {
902 T data;
903 dataLoad(stream, data, context);
904 l.push_back(std::move(data));
905 }
906}

◆ dataLoad() [37/63]

template<typename T >
void dataLoad ( std::istream &  stream,
std::list< T > &  l,
void *  context 
)
inline

Definition at line 878 of file DataIO.h.

879{
880 // First read the size of the set
881 unsigned int size = 0;
882 dataLoad(stream, size, nullptr);
883
884 for (unsigned int i = 0; i < size; i++)
885 {
886 T data{};
887 dataLoad(stream, data, context);
888 l.push_back(std::move(data));
889 }
890}

◆ dataLoad() [38/63]

template<typename T , typename U >
void dataLoad ( std::istream &  stream,
std::map< T, U > &  m,
void *  context 
)
inline

Definition at line 910 of file DataIO.h.

911{
912 m.clear();
913
914 // First read the size of the map
915 unsigned int size = 0;
916 dataLoad(stream, size, nullptr);
917
918 for (unsigned int i = 0; i < size; i++)
919 {
920 T key;
921 dataLoad(stream, key, context);
922
923 U & value = m[key];
924 dataLoad(stream, value, context);
925 }
926}

◆ dataLoad() [39/63]

template<typename T >
void dataLoad ( std::istream &  stream,
std::optional< T > &  m,
void *  context 
)
inline

Definition at line 969 of file DataIO.h.

970{
971 bool has_value;
972 dataLoad(stream, has_value, nullptr);
973
974 if (has_value)
975 {
976 m = T{};
977 dataLoad(stream, *m, context);
978 }
979 else
980 m.reset();
981}

◆ dataLoad() [40/63]

template<typename T , typename U >
void dataLoad ( std::istream &  stream,
std::pair< T, U > &  p,
void *  context 
)
inline

Definition at line 803 of file DataIO.h.

804{
805 dataLoad(stream, p.first, context);
806 dataLoad(stream, p.second, context);
807}

◆ dataLoad() [41/63]

template<typename T >
void dataLoad ( std::istream &  stream,
std::set< T > &  s,
void *  context 
)
inline

Definition at line 862 of file DataIO.h.

863{
864 // First read the size of the set
865 unsigned int size = 0;
866 dataLoad(stream, size, nullptr);
867
868 for (unsigned int i = 0; i < size; i++)
869 {
870 T data;
871 dataLoad(stream, data, context);
872 s.insert(std::move(data));
873 }
874}

◆ dataLoad() [42/63]

template<typename T >
void dataLoad ( std::istream &  stream,
std::shared_ptr< T > &  v,
void *  context 
)
inline

Definition at line 844 of file DataIO.h.

845{
846 T * tmp = v.get();
847
848 dataLoad(stream, tmp, context);
849}

◆ dataLoad() [43/63]

template<>
dataLoadSizeofSpecialization(bool) dataLoadSizeofSpecialization(char) dataLoadSizeofSpecialization(signed char) dataLoadSizeofSpecialization(short int) dataLoadSizeofSpecialization(int) dataLoadSizeofSpecialization(long int) dataLoadSizeofSpecialization(long long int) dataLoadSizeofSpecialization(unsigned char) dataLoadSizeofSpecialization(short unsigned int) dataLoadSizeofSpecialization(unsigned int) dataLoadSizeofSpecialization(long unsigned int) dataLoadSizeofSpecialization(long long unsigned int) dataLoadSizeofSpecialization(float) dataLoadSizeofSpecialization(double) dataLoadSizeofSpecialization(long double) dataLoadEnum(libMesh void dataLoad ( std::istream &  stream,
std::string &  v,
void *   
)

Definition at line 420 of file DataIO.C.

421{
422 // Read the size of the string
423 unsigned int size = 0;
424 stream.read((char *)&size, sizeof(size));
425
426 // Resize the string data
427 v.resize(size);
428
429 // Read the string
430 stream.read(&v[0], sizeof(char) * size);
431}

◆ dataLoad() [44/63]

template<>
void dataLoad ( std::istream &  stream,
std::string &  v,
void *   
)

Definition at line 420 of file DataIO.C.

421{
422 // Read the size of the string
423 unsigned int size = 0;
424 stream.read((char *)&size, sizeof(size));
425
426 // Resize the string data
427 v.resize(size);
428
429 // Read the string
430 stream.read(&v[0], sizeof(char) * size);
431}

Referenced by dataLoad(), dataLoad(), dataLoad(), dataLoad(), dataLoad(), dataLoad(), dataLoad(), dataLoad(), dataLoad(), dataLoad(), dataLoad(), dataLoad(), dataLoad(), dataLoad(), dataLoad(), dataLoad(), dataLoad(), dataLoad(), and dataLoad< mt_state >().

◆ dataLoad() [45/63]

template<>
void dataLoad ( std::istream &  stream,
std::stringstream &  s,
void *  context 
)

Definition at line 589 of file DataIO.C.

590{
591 size_t s_size = 0;
592 stream.read((char *)&s_size, sizeof(s_size));
593
594 std::unique_ptr<char[]> s_s = std::make_unique<char[]>(s_size);
595 stream.read(s_s.get(), s_size);
596
597 // Clear the stringstream before loading new data into it.
598 s.str(std::string());
599 s.write(s_s.get(), s_size);
600}

◆ dataLoad() [46/63]

template<>
void dataLoad ( std::istream &  stream,
std::stringstream &  s,
void *  context 
)

Definition at line 589 of file DataIO.C.

590{
591 size_t s_size = 0;
592 stream.read((char *)&s_size, sizeof(s_size));
593
594 std::unique_ptr<char[]> s_s = std::make_unique<char[]>(s_size);
595 stream.read(s_s.get(), s_size);
596
597 // Clear the stringstream before loading new data into it.
598 s.str(std::string());
599 s.write(s_s.get(), s_size);
600}

◆ dataLoad() [47/63]

template<>
void dataLoad ( std::istream &  stream,
std::unique_ptr< libMesh::NumericVector< libMesh::Number > > &  v,
void *  context 
)

Loads an owned numeric vector.

This is used in lieu of the NumericVector<double> & implementation when the vector may not necessarily be initialized yet on the loading of the data.

If is not null, it must have the same global and local sizes that it was stored with. In this case, the data is simply filled into the vector.

If is null, it will be constructed with the type (currently just a PetscVector) stored and initialized with the global and local sizes stored. The data will then be filled after initialization.

Requirements: the vector cannot be ghosted, the provided context must be the Communicator, and if v is initialized, it must have the same global and local sizes that the vector was stored with.

◆ dataLoad() [48/63]

template<>
void dataLoad ( std::istream &  stream,
std::unique_ptr< libMesh::NumericVector< libMesh::Number > > &  v,
void *  context 
)

Loads an owned numeric vector.

This is used in lieu of the NumericVector<double> & implementation when the vector may not necessarily be initialized yet on the loading of the data.

If is not null, it must have the same global and local sizes that it was stored with. In this case, the data is simply filled into the vector.

If is null, it will be constructed with the type (currently just a PetscVector) stored and initialized with the global and local sizes stored. The data will then be filled after initialization.

Requirements: the vector cannot be ghosted, the provided context must be the Communicator, and if v is initialized, it must have the same global and local sizes that the vector was stored with.

◆ dataLoad() [49/63]

template<typename T >
void dataLoad ( std::istream &  stream,
std::unique_ptr< T > &  v,
void *  context 
)
inline

Definition at line 853 of file DataIO.h.

854{
855 T * tmp = v.get();
856
857 dataLoad(stream, tmp, context);
858}

◆ dataLoad() [50/63]

template<typename T , typename U >
void dataLoad ( std::istream &  stream,
std::unordered_map< T, U > &  m,
void *  context 
)
inline

Definition at line 930 of file DataIO.h.

931{
932 m.clear();
933
934 // First read the size of the map
935 unsigned int size = 0;
936 dataLoad(stream, size, nullptr);
937
938 for (unsigned int i = 0; i < size; i++)
939 {
940 T key;
941 dataLoad(stream, key, context);
942
943 U & value = m[key];
944 dataLoad(stream, value, context);
945 }
946}

◆ dataLoad() [51/63]

template<typename T >
void dataLoad ( std::istream &  stream,
std::unordered_set< T > &  s,
void *  context 
)
inline

Definition at line 950 of file DataIO.h.

951{
952 s.clear();
953
954 // First read the size of the set
955 std::size_t size = 0;
956 dataLoad(stream, size, nullptr);
957 s.reserve(size);
958
959 for (std::size_t i = 0; i < size; i++)
960 {
961 T element;
962 dataLoad(stream, element, context);
963 s.insert(element);
964 }
965}

◆ dataLoad() [52/63]

void dataLoad ( std::istream &  stream,
std::vector< bool > &  v,
void *  context 
)
inline

Definition at line 812 of file DataIO.h.

813{
814 // First read the size of the vector
815 unsigned int size = 0;
816 dataLoad(stream, size, nullptr);
817
818 v.resize(size);
819
820 bool tmp{};
821 for (unsigned int i = 0; i < size; i++)
822 {
823 dataLoad(stream, tmp, context);
824 v[i] = tmp;
825 }
826}

◆ dataLoad() [53/63]

template<typename T >
void dataLoad ( std::istream &  stream,
std::vector< T > &  v,
void *  context 
)
inline

Definition at line 830 of file DataIO.h.

831{
832 // First read the size of the vector
833 unsigned int size = 0;
834 dataLoad(stream, size, nullptr);
835
836 v.resize(size);
837
838 for (unsigned int i = 0; i < size; i++)
839 dataLoad(stream, v[i], context);
840}

◆ dataLoad() [54/63]

template<typename T >
void dataLoad ( std::istream &  stream,
SymmetricRankFourTensorTempl< T > &  rft,
void *  context 
)

Definition at line 1161 of file DataIO.h.

1162{
1163 dataLoad(stream, rft._vals, context);
1164}
std::array< T, N2 > _vals
The values of the rank-four tensor.

◆ dataLoad() [55/63]

template<typename T >
void dataLoad ( std::istream &  stream,
SymmetricRankTwoTensorTempl< T > &  rtt,
void *  context 
)

Definition at line 1154 of file DataIO.h.

1155{
1156 dataLoad(stream, rtt._vals, context);
1157}

◆ dataLoad() [56/63]

template<typename T , std::size_t N>
void dataLoad ( std::istream &  stream,
T(&)  arr[N],
void *  context 
)

Definition at line 1093 of file DataIO.h.

1094{
1095 for (std::size_t i = 0; i < N; ++i)
1096 dataLoad(stream, arr[i], context);
1097}

◆ dataLoad() [57/63]

template<>
void dataLoad ( std::istream &  stream,
torch::Tensor &  t,
void *  context 
)

Definition at line 605 of file DataIO.C.

606{
607 bool defined = false;
608 dataLoad(stream, defined, nullptr);
609 if (!defined)
610 {
611 t = torch::Tensor(); // undefined tensor
612 return;
613 }
614
615 unsigned int rank = 0;
616 dataLoad(stream, rank, nullptr);
617
618 std::vector<int64_t> sizes(rank);
619 for (unsigned int dim = 0; dim < rank; ++dim)
620 {
621 unsigned int size = 0;
622 dataLoad(stream, size, nullptr);
623 sizes[dim] = size;
624 }
625
626 t = torch::empty(sizes, at::kDouble);
627 auto flattened = t.reshape({t.numel()});
628 auto t_accessor = flattened.accessor<Real, 1>();
629 for (int64_t i = 0; i < flattened.numel(); ++i)
630 {
631 Real r = 0;
632 dataLoad(stream, r, context);
633 t_accessor[i] = r;
634 }
635}
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real

◆ dataLoad() [58/63]

template<typename T >
void dataLoad ( std::istream &  stream,
UniqueStorage< T > &  data,
void *  context 
)
inline

UniqueStorage Helper Function.

The unique_ptr<T> loader is called to load the data. That is, you will likely need a specialization of unique_ptr<T> that will appropriately construct and then fill the piece of data.

Definition at line 1182 of file DataIO.h.

1183{
1184 std::size_t size;
1185 dataLoad(stream, size, nullptr);
1186 data.resize(size);
1187
1188 for (const auto i : index_range(data))
1189 dataLoad(stream, data.pointerValue(i), context);
1190}
void resize(const std::size_t size)
Resizes the underlying vector.
auto index_range(const T &sizable)

◆ dataLoad() [59/63]

template<>
void dataLoad ( std::istream &  stream,
UserObjectName &  v,
void *  context 
)

Definition at line 443 of file DataIO.C.

444{
445 auto & name = cast_ref<std::string &>(v);
446 dataLoad(stream, name, context);
447}

◆ dataLoad() [60/63]

template<>
void dataLoad ( std::istream &  stream,
UserObjectName &  v,
void *  context 
)

Definition at line 443 of file DataIO.C.

444{
445 auto & name = cast_ref<std::string &>(v);
446 dataLoad(stream, name, context);
447}

◆ dataLoad() [61/63]

template<>
void dataLoad ( std::istream &  stream,
VariableName &  v,
void *  context 
)

Definition at line 435 of file DataIO.C.

436{
437 auto & name = cast_ref<std::string &>(v);
438 dataLoad(stream, name, context);
439}

◆ dataLoad() [62/63]

template<>
void dataLoad ( std::istream &  stream,
VariableName &  v,
void *  context 
)

Definition at line 435 of file DataIO.C.

436{
437 auto & name = cast_ref<std::string &>(v);
438 dataLoad(stream, name, context);
439}

◆ dataLoad() [63/63]

template<>
void dataLoad ( std::istream &  stream,
Vec &  v,
void *  context 
)

Definition at line 796 of file DataIO.C.

797{
798 PetscInt local_size;
799 LibmeshPetscCallA(PETSC_COMM_WORLD, VecGetLocalSize(v, &local_size));
800 PetscScalar * array;
801 LibmeshPetscCallA(PETSC_COMM_WORLD, VecGetArray(v, &array));
802 for (PetscInt i = 0; i < local_size; i++)
803 dataLoad(stream, array[i], context);
804
805 LibmeshPetscCallA(PETSC_COMM_WORLD, VecRestoreArray(v, &array));
806}

◆ dataStore() [1/64]

template<typename T >
void dataStore ( std::ostream &  ,
T *&  ,
void *   
)
inline

Definition at line 240 of file DataIO.h.

241{
242 mooseError("Attempting to store a raw pointer type: \"",
243 libMesh::demangle(typeid(T).name()),
244 " *\" as restartable data!\nWrite a custom dataStore() template specialization!\n\n");
245}

◆ dataStore() [2/64]

void dataStore ( std::ostream &  ostream,
std::vector< bool > &  v,
void *  ctx 
)
inline

Definition at line 261 of file DataIO.h.

262{
263 unsigned int size = v.size();
264 dataStore(ostream, size, nullptr);
265
266 for (const bool val : v)
267 dataStore(ostream, val, ctx);
268}
void dataStore(std::ostream &stream, T &v, void *)
Definition DataIO.h:81
void * ctx

◆ dataStore() [3/64]

template<>
void dataStore ( std::ostream &  stream,
ADReal &  dn,
void *  context 
)

Definition at line 123 of file DataIO.C.

124{
125 dataStore(stream, dn.value(), context);
126
127 if (ADReal::do_derivatives)
128 {
129 auto & derivatives = dn.derivatives();
130 std::size_t size = derivatives.size();
131 dataStore(stream, size, context);
132 for (MooseIndex(size) i = 0; i < size; ++i)
133 {
134 dataStore(stream, derivatives.raw_index(i), context);
135 dataStore(stream, derivatives.raw_at(i), context);
136 }
137 }
138}
void dataStore(std::ostream &stream, std::string &v, void *)
Definition DataIO.C:39

◆ dataStore() [4/64]

template<>
void dataStore ( std::ostream &  stream,
ADReal &  dn,
void *  context 
)

Definition at line 123 of file DataIO.C.

124{
125 dataStore(stream, dn.value(), context);
126
127 if (ADReal::do_derivatives)
128 {
129 auto & derivatives = dn.derivatives();
130 std::size_t size = derivatives.size();
131 dataStore(stream, size, context);
132 for (MooseIndex(size) i = 0; i < size; ++i)
133 {
134 dataStore(stream, derivatives.raw_index(i), context);
135 dataStore(stream, derivatives.raw_at(i), context);
136 }
137 }
138}

◆ dataStore() [5/64]

template<>
void dataStore ( std::ostream &  stream,
bool &  v,
void *  context 
)

◆ dataStore() [6/64]

template<typename T >
void dataStore ( std::ostream &  stream,
ColumnMajorMatrixTempl< T > &  cmm,
void *  context 
)

Definition at line 598 of file DataIO.h.

599{
600 dataStore(stream, cmm._values, context);
601}

◆ dataStore() [7/64]

template<>
void dataStore ( std::ostream &  stream,
const Elem *&  e,
void *  context 
)

Definition at line 142 of file DataIO.C.

143{
144 // TODO: Write out the unique ID of this elem
146
147 if (e)
148 {
149 id = e->id();
151 mooseError("Can't output Elems with invalid ids!");
152 }
153
154 dataStore(stream, id, context);
155}

◆ dataStore() [8/64]

template<>
void dataStore ( std::ostream &  stream,
const Elem *&  e,
void *  context 
)

Definition at line 142 of file DataIO.C.

143{
144 // TODO: Write out the unique ID of this elem
146
147 if (e)
148 {
149 id = e->id();
151 mooseError("Can't output Elems with invalid ids!");
152 }
153
154 dataStore(stream, id, context);
155}

◆ dataStore() [9/64]

template<>
void dataStore ( std::ostream &  stream,
const libMesh::Point &  p,
void *  context 
)

◆ dataStore() [10/64]

template<>
void dataStore ( std::ostream &  stream,
const Node *&  n,
void *  context 
)

Definition at line 159 of file DataIO.C.

160{
161 // TODO: Write out the unique ID of this node
163
164 if (n)
165 {
166 id = n->id();
168 mooseError("Can't output Nodes with invalid ids!");
169 }
170
171 dataStore(stream, id, context);
172}

◆ dataStore() [11/64]

template<>
void dataStore ( std::ostream &  stream,
const Node *&  n,
void *  context 
)

Definition at line 159 of file DataIO.C.

160{
161 // TODO: Write out the unique ID of this node
163
164 if (n)
165 {
166 id = n->id();
168 mooseError("Can't output Nodes with invalid ids!");
169 }
170
171 dataStore(stream, id, context);
172}

◆ dataStore() [12/64]

template<typename T >
void dataStore ( std::ostream &  stream,
DenseVector< T > &  v,
void *  context 
)

Definition at line 550 of file DataIO.h.

551{
552 unsigned int m = v.size();
553 dataStore(stream, m, nullptr);
554 for (unsigned int i = 0; i < v.size(); i++)
555 {
556 T r = v(i);
557 dataStore(stream, r, context);
558 }
559}
virtual unsigned int size() const override final

◆ dataStore() [13/64]

template<typename T , int Rows, int Cols>
void dataStore ( std::ostream &  stream,
Eigen::Matrix< T, Rows, Cols > &  v,
void *  context 
)

Definition at line 442 of file DataIO.h.

443{
444 auto m = cast_int<unsigned int>(v.rows());
445 dataStore(stream, m, context);
446 auto n = cast_int<unsigned int>(v.cols());
447 dataStore(stream, n, context);
448 for (const auto i : make_range(m))
449 for (const auto j : make_range(n))
450 {
451 auto & r = v(i, j);
452 dataStore(stream, r, context);
453 }
454}

◆ dataStore() [14/64]

template<>
void dataStore ( std::ostream &  stream,
Elem *&  e,
void *  context 
)

Definition at line 176 of file DataIO.C.

177{
178 // TODO: Write out the unique ID of this elem
180
181 if (e)
182 {
183 id = e->id();
185 mooseError("Can't output Elems with invalid ids!");
186 }
187
188 dataStore(stream, id, context);
189}

◆ dataStore() [15/64]

template<>
void dataStore ( std::ostream &  stream,
Elem *&  e,
void *  context 
)

Definition at line 176 of file DataIO.C.

177{
178 // TODO: Write out the unique ID of this elem
180
181 if (e)
182 {
183 id = e->id();
185 mooseError("Can't output Elems with invalid ids!");
186 }
187
188 dataStore(stream, id, context);
189}

◆ dataStore() [16/64]

template<typename T >
void dataStore ( std::ostream &  stream,
GenericTwoVector< T > &  v,
void *  context 
)

Definition at line 458 of file DataIO.h.

459{
460 dataStore(stream, libMesh::cast_ref<Eigen::Matrix<T, 2, 1> &>(v), context);
461}

◆ dataStore() [17/64]

template<typename T , typename U >
void dataStore ( std::ostream &  stream,
HashMap< T, U > &  m,
void *  context 
)
inline

Definition at line 421 of file DataIO.h.

422{
423 // First store the size of the map
424 unsigned int size = m.size();
425 dataStore(stream, size, nullptr);
426
427 typename HashMap<T, U>::iterator it = m.begin();
428 typename HashMap<T, U>::iterator end = m.end();
429
430 for (; it != end; ++it)
431 {
432 T & key = const_cast<T &>(it->first);
433
434 dataStore(stream, key, context);
435
436 dataStore(stream, it->second, context);
437 }
438}
HashMap is an abstraction for dictionary data type, we make it thread-safe by locking inserts.
Definition HashMap.h:19

◆ dataStore() [18/64]

void dataStore ( std::ostream &  stream,
libMesh::BoundingBox &  p,
void *  context 
)

Definition at line 312 of file DataIO.C.

313{
314 dataStore(stream, cast_ref<std::pair<Point, Point> &>(bbox), context);
315}

◆ dataStore() [19/64]

template<typename T >
void dataStore ( std::ostream &  stream,
libMesh::DenseMatrix< T > &  v,
void *  context 
)

Definition at line 270 of file DataIO.C.

271{
272 unsigned int m = v.m();
273 unsigned int n = v.n();
274 stream.write((char *)&m, sizeof(m));
275 stream.write((char *)&n, sizeof(n));
276 for (unsigned int i = 0; i < m; i++)
277 for (unsigned int j = 0; j < n; j++)
278 {
279 T r = v(i, j);
280 dataStore(stream, r, context);
281 }
282}
unsigned int n() const
unsigned int m() const

◆ dataStore() [20/64]

template<typename T >
void dataStore ( std::ostream &  stream,
libMesh::DenseVector< T > &  v,
void *  context 
)

Definition at line 550 of file DataIO.h.

551{
552 unsigned int m = v.size();
553 dataStore(stream, m, nullptr);
554 for (unsigned int i = 0; i < v.size(); i++)
555 {
556 T r = v(i);
557 dataStore(stream, r, context);
558 }
559}

◆ dataStore() [21/64]

template<>
void dataStore ( std::ostream &  stream,
libMesh::FEType &  v,
void *  context 
)

◆ dataStore() [22/64]

template<>
void dataStore ( std::ostream &  stream,
libMesh::FEType &  v,
void *  context 
)

◆ dataStore() [23/64]

template<typename T >
void dataStore ( std::ostream &  stream,
libMesh::NumericVector< T > &  v,
void *  context 
)

Definition at line 532 of file DataIO.h.

533{
534 v.close();
535
537
538 for (numeric_index_type i = v.first_local_index(); i < v.first_local_index() + size; i++)
539 {
540 T r = v(i);
541 dataStore(stream, r, context);
542 }
543}

◆ dataStore() [24/64]

template<>
void dataStore ( std::ostream &  stream,
libMesh::Parameters &  p,
void *  context 
)

Definition at line 326 of file DataIO.C.

327{
328 // First store the size of the map
329 unsigned int size = p.n_parameters();
330 stream.write((char *)&size, sizeof(size));
331
332 auto it = p.begin();
333 auto end = p.end();
334
335 for (; it != end; ++it)
336 {
337 auto & key = const_cast<std::string &>(it->first);
338 auto type = it->second->type();
339
340 dataStore(stream, key, context);
341 dataStore(stream, type, context);
342
343#define storescalar(ptype) \
344 else if (it->second->type() == demangle(typeid(ptype).name())) dataStore( \
345 stream, \
346 (dynamic_cast<libMesh::Parameters::Parameter<ptype> *>(MooseUtils::get(it->second)))->get(), \
347 context)
348
349 if (false)
350 ;
351 storescalar(Real);
352 storescalar(short);
353 storescalar(int);
354 storescalar(long);
355 storescalar(unsigned short);
356 storescalar(unsigned int);
357 storescalar(unsigned long);
358
359#undef storescalar
360 }
361}
std::size_t n_parameters() const

◆ dataStore() [25/64]

template<>
void dataStore ( std::ostream &  stream,
libMesh::Parameters &  p,
void *  context 
)

Definition at line 326 of file DataIO.C.

327{
328 // First store the size of the map
329 unsigned int size = p.n_parameters();
330 stream.write((char *)&size, sizeof(size));
331
332 auto it = p.begin();
333 auto end = p.end();
334
335 for (; it != end; ++it)
336 {
337 auto & key = const_cast<std::string &>(it->first);
338 auto type = it->second->type();
339
340 dataStore(stream, key, context);
341 dataStore(stream, type, context);
342
343#define storescalar(ptype) \
344 else if (it->second->type() == demangle(typeid(ptype).name())) dataStore( \
345 stream, \
346 (dynamic_cast<libMesh::Parameters::Parameter<ptype> *>(MooseUtils::get(it->second)))->get(), \
347 context)
348
349 if (false)
350 ;
351 storescalar(Real);
352 storescalar(short);
353 storescalar(int);
354 storescalar(long);
355 storescalar(unsigned short);
356 storescalar(unsigned int);
357 storescalar(unsigned long);
358
359#undef storescalar
360 }
361}

◆ dataStore() [26/64]

template<>
dataStoreSizeofSpecialization(bool) dataStoreSizeofSpecialization(char) dataStoreSizeofSpecialization(signed char) dataStoreSizeofSpecialization(short int) dataStoreSizeofSpecialization(int) dataStoreSizeofSpecialization(long int) dataStoreSizeofSpecialization(long long int) dataStoreSizeofSpecialization(unsigned char) dataStoreSizeofSpecialization(short unsigned int) dataStoreSizeofSpecialization(unsigned int) dataStoreSizeofSpecialization(long unsigned int) dataStoreSizeofSpecialization(long long unsigned int) dataStoreSizeofSpecialization(float) dataStoreSizeofSpecialization(double) dataStoreSizeofSpecialization(long double) dataStoreEnum(libMesh void dataStore ( std::ostream &  stream,
libMesh::Point &  p,
void *  context 
)

◆ dataStore() [27/64]

template<typename T >
void dataStore ( std::ostream &  stream,
libMesh::TensorValue< T > &  v,
void *  context 
)

Definition at line 255 of file DataIO.C.

256{
257 for (const auto i : make_range(Moose::dim))
258 for (const auto j : make_range(Moose::dim))
259 {
260 T r = v(i, j);
261 dataStore(stream, r, context);
262 }
263}

◆ dataStore() [28/64]

template<typename T >
void dataStore ( std::ostream &  stream,
libMesh::VectorValue< T > &  v,
void *  context 
)

◆ dataStore() [29/64]

template<>
void dataStore ( std::ostream &  stream,
Moose::MFEM::SolutionState &  state,
void *  context 
)

Definition at line 47 of file SolutionStateData.C.

48{
49 auto * const data = static_cast<MFEMProblemData *>(context);
50
51 auto num_gridfunctions = data->gridfunctions.size();
52 dataStore(stream, num_gridfunctions, context);
53 for (const auto & [name, gridfunction] : data->gridfunctions)
54 {
55 auto stored_name = name;
56 dataStore(stream, stored_name, context);
57 storeGridFunction(stream, *gridfunction, context);
58 }
59
60 auto num_complex_gridfunctions = data->cmplx_gridfunctions.size();
61 dataStore(stream, num_complex_gridfunctions, context);
62 for (const auto & [name, gridfunction] : data->cmplx_gridfunctions)
63 {
64 auto stored_name = name;
65 dataStore(stream, stored_name, context);
66 storeGridFunction(stream, gridfunction->real(), context);
67 storeGridFunction(stream, gridfunction->imag(), context);
68 }
69}
void dataStore(std::ostream &stream, Moose::MFEM::SolutionState &, void *context)
int size()
Returns the number of elements in the map.
Moose::MFEM::GridFunctions gridfunctions

Referenced by dataStore().

◆ dataStore() [30/64]

template<>
void dataStore ( std::ostream &  stream,
Node *&  n,
void *  context 
)

Definition at line 193 of file DataIO.C.

194{
195 // TODO: Write out the unique ID of this node
197
198 if (n)
199 {
200 id = n->id();
202 mooseError("Can't output Nodes with invalid ids!");
203 }
204
205 dataStore(stream, id, context);
206}

◆ dataStore() [31/64]

template<>
void dataStore ( std::ostream &  stream,
Node *&  n,
void *  context 
)

Definition at line 193 of file DataIO.C.

194{
195 // TODO: Write out the unique ID of this node
197
198 if (n)
199 {
200 id = n->id();
202 mooseError("Can't output Nodes with invalid ids!");
203 }
204
205 dataStore(stream, id, context);
206}

◆ dataStore() [32/64]

template<typename T >
void dataStore ( std::ostream &  stream,
RankFourTensorTempl< T > &  rft,
void *  context 
)

Definition at line 577 of file DataIO.h.

578{
579 dataStore(stream, rft._vals, context);
580}

◆ dataStore() [33/64]

template<typename T >
void dataStore ( std::ostream &  stream,
RankThreeTensorTempl< T > &  rtt,
void *  context 
)

Definition at line 570 of file DataIO.h.

571{
572 dataStore(stream, rtt._vals, context);
573}

◆ dataStore() [34/64]

template<typename T >
void dataStore ( std::ostream &  stream,
RankTwoTensorTempl< T > &  rtt,
void *  context 
)

Definition at line 563 of file DataIO.h.

564{
565 dataStore(stream, rtt._coords, context);
566}

◆ dataStore() [35/64]

template<>
void dataStore ( std::ostream &  stream,
Real &  v,
void *  context 
)

◆ dataStore() [36/64]

template<typename T , std::size_t N>
void dataStore ( std::ostream &  stream,
std::array< T, N > &  arr,
void *  context 
)

Definition at line 524 of file DataIO.h.

525{
526 for (std::size_t i = 0; i < N; ++i)
527 dataStore(stream, arr[i], context);
528}

◆ dataStore() [37/64]

template<typename T >
void dataStore ( std::ostream &  stream,
std::deque< T > &  l,
void *  context 
)
inline

Definition at line 338 of file DataIO.h.

339{
340 // First store the size of the container
341 unsigned int size = l.size();
342 dataStore(stream, size, nullptr);
343
344 typename std::deque<T>::iterator it = l.begin();
345 typename std::deque<T>::iterator end = l.end();
346
347 for (; it != end; ++it)
348 {
349 T & x = const_cast<T &>(*it);
350 dataStore(stream, x, context);
351 }
352}

◆ dataStore() [38/64]

template<typename T >
void dataStore ( std::ostream &  stream,
std::list< T > &  l,
void *  context 
)
inline

Definition at line 320 of file DataIO.h.

321{
322 // First store the size of the set
323 unsigned int size = l.size();
324 dataStore(stream, size, nullptr);
325
326 typename std::list<T>::iterator it = l.begin();
327 typename std::list<T>::iterator end = l.end();
328
329 for (; it != end; ++it)
330 {
331 T & x = const_cast<T &>(*it);
332 dataStore(stream, x, context);
333 }
334}

◆ dataStore() [39/64]

template<typename T , typename U >
void dataStore ( std::ostream &  stream,
std::map< T, U > &  m,
void *  context 
)
inline

Definition at line 356 of file DataIO.h.

357{
358 // First store the size of the map
359 unsigned int size = m.size();
360 dataStore(stream, size, nullptr);
361
362 typename std::map<T, U>::iterator it = m.begin();
363 typename std::map<T, U>::iterator end = m.end();
364
365 for (; it != end; ++it)
366 {
367 T & key = const_cast<T &>(it->first);
368
369 dataStore(stream, key, context);
370
371 dataStore(stream, it->second, context);
372 }
373}

◆ dataStore() [40/64]

template<typename T >
void dataStore ( std::ostream &  stream,
std::optional< T > &  m,
void *  context 
)
inline

Definition at line 410 of file DataIO.h.

411{
412 bool has_value = m.has_value();
413 dataStore(stream, has_value, nullptr);
414
415 if (has_value)
416 dataStore(stream, *m, context);
417}

◆ dataStore() [41/64]

template<typename T , typename U >
void dataStore ( std::ostream &  stream,
std::pair< T, U > &  p,
void *  context 
)
inline

Definition at line 252 of file DataIO.h.

253{
254 dataStore(stream, p.first, context);
255 dataStore(stream, p.second, context);
256}

◆ dataStore() [42/64]

template<typename T >
void dataStore ( std::ostream &  stream,
std::set< T > &  s,
void *  context 
)
inline

Definition at line 302 of file DataIO.h.

303{
304 // First store the size of the set
305 unsigned int size = s.size();
306 dataStore(stream, size, nullptr);
307
308 typename std::set<T>::iterator it = s.begin();
309 typename std::set<T>::iterator end = s.end();
310
311 for (; it != end; ++it)
312 {
313 T & x = const_cast<T &>(*it);
314 dataStore(stream, x, context);
315 }
316}

◆ dataStore() [43/64]

template<typename T >
void dataStore ( std::ostream &  stream,
std::shared_ptr< T > &  v,
void *  context 
)
inline

Definition at line 284 of file DataIO.h.

285{
286 T * tmp = v.get();
287
288 dataStore(stream, tmp, context);
289}

◆ dataStore() [44/64]

template<>
void dataStore ( std::ostream &  stream,
std::string &  v,
void *  context 
)

Definition at line 39 of file DataIO.C.

40{
41 // Write the size of the string
42 unsigned int size = v.size();
43 stream.write((char *)&size, sizeof(size));
44
45 // Write the string (Do not store the null byte)
46 stream.write(v.c_str(), sizeof(char) * size);
47}

◆ dataStore() [45/64]

template<>
void dataStore ( std::ostream &  stream,
std::string &  v,
void *  context 
)

Definition at line 39 of file DataIO.C.

40{
41 // Write the size of the string
42 unsigned int size = v.size();
43 stream.write((char *)&size, sizeof(size));
44
45 // Write the string (Do not store the null byte)
46 stream.write(v.c_str(), sizeof(char) * size);
47}

Referenced by dataStore(), dataStore(), dataStore(), dataStore(), dataStore(), dataStore(), dataStore(), dataStore(), dataStore(), dataStore(), dataStore(), dataStore(), dataStore(), dataStore(), dataStore(), dataStore(), dataStore(), dataStore(), dataStore(), dataStore(), dataStore(), dataStore(), and dataStore< mt_state >().

◆ dataStore() [46/64]

template<>
void dataStore ( std::ostream &  stream,
std::stringstream &  s,
void *  context 
)

Definition at line 210 of file DataIO.C.

211{
212 const std::string & s_str = s.str();
213
214 size_t s_size = s_str.size();
215 stream.write((char *)&s_size, sizeof(s_size));
216
217 stream.write(s_str.c_str(), sizeof(char) * (s_str.size()));
218}

◆ dataStore() [47/64]

template<>
void dataStore ( std::ostream &  stream,
std::stringstream &  s,
void *  context 
)

Definition at line 210 of file DataIO.C.

211{
212 const std::string & s_str = s.str();
213
214 size_t s_size = s_str.size();
215 stream.write((char *)&s_size, sizeof(s_size));
216
217 stream.write(s_str.c_str(), sizeof(char) * (s_str.size()));
218}

◆ dataStore() [48/64]

template<>
void dataStore ( std::ostream &  stream,
std::unique_ptr< libMesh::NumericVector< libMesh::Number > > &  v,
void *  context 
)

Stores an owned numeric vector.

This should be used in lieu of the NumericVector<Number> & implementation when the vector may not necessarily be initialized yet on the loading of the data. It stores the partitioning (total and local number of entries).

Requirements: the unique_ptr must exist (cannot be null), the vector cannot be ghosted, and the provided context must be the Communicator.

◆ dataStore() [49/64]

template<>
void dataStore ( std::ostream &  stream,
std::unique_ptr< libMesh::NumericVector< libMesh::Number > > &  v,
void *  context 
)

Stores an owned numeric vector.

This should be used in lieu of the NumericVector<Number> & implementation when the vector may not necessarily be initialized yet on the loading of the data. It stores the partitioning (total and local number of entries).

Requirements: the unique_ptr must exist (cannot be null), the vector cannot be ghosted, and the provided context must be the Communicator.

◆ dataStore() [50/64]

template<typename T >
void dataStore ( std::ostream &  stream,
std::unique_ptr< T > &  v,
void *  context 
)
inline

Definition at line 293 of file DataIO.h.

294{
295 T * tmp = v.get();
296
297 dataStore(stream, tmp, context);
298}

◆ dataStore() [51/64]

template<typename T , typename U >
void dataStore ( std::ostream &  stream,
std::unordered_map< T, U > &  m,
void *  context 
)
inline

Definition at line 377 of file DataIO.h.

378{
379 // First store the size of the map
380 unsigned int size = m.size();
381 dataStore(stream, size, nullptr);
382
383 typename std::unordered_map<T, U>::iterator it = m.begin();
384 typename std::unordered_map<T, U>::iterator end = m.end();
385
386 for (; it != end; ++it)
387 {
388 T & key = const_cast<T &>(it->first);
389
390 dataStore(stream, key, context);
391
392 dataStore(stream, it->second, context);
393 }
394}

◆ dataStore() [52/64]

template<typename T >
void dataStore ( std::ostream &  stream,
std::unordered_set< T > &  s,
void *  context 
)
inline

Definition at line 398 of file DataIO.h.

399{
400 // First store the size of the set
401 std::size_t size = s.size();
402 dataStore(stream, size, nullptr);
403
404 for (auto & element : s)
405 dataStore(stream, element, context);
406}

◆ dataStore() [53/64]

template<typename T >
void dataStore ( std::ostream &  stream,
std::vector< T > &  v,
void *  context 
)
inline

Definition at line 272 of file DataIO.h.

273{
274 // First store the size of the vector
275 unsigned int size = v.size();
276 dataStore(stream, size, nullptr);
277
278 for (unsigned int i = 0; i < size; i++)
279 dataStore(stream, v[i], context);
280}

◆ dataStore() [54/64]

template<typename T >
void dataStore ( std::ostream &  stream,
SymmetricRankFourTensorTempl< T > &  srft,
void *  context 
)

Definition at line 591 of file DataIO.h.

592{
593 dataStore(stream, srft._vals, context);
594}

◆ dataStore() [55/64]

template<typename T >
void dataStore ( std::ostream &  stream,
SymmetricRankTwoTensorTempl< T > &  srtt,
void *  context 
)

Definition at line 584 of file DataIO.h.

585{
586 dataStore(stream, srtt._vals, context);
587}

◆ dataStore() [56/64]

template<typename T >
void dataStore ( std::ostream &  stream,
T &  v,
void *   
)
inline

Definition at line 81 of file DataIO.h.

82{
83 static_assert(sizeof(T) == 0, "You must write a dataStore specialization for your type");
84}

Referenced by dataStore(), dataStore(), dataStore(), dataStore(), dataStore(), dataStore(), dataStore(), dataStore(), dataStore(), dataStore(), dataStore(), dataStore(), dataStore(), dataStore(), dataStore(), dataStore(), dataStore(), dataStore(), dataStore(), dataStore(), dataStore(), dataStore(), dataStore(), dataStore(), and dataStore().

◆ dataStore() [57/64]

template<typename T , std::size_t N>
void dataStore ( std::ostream &  stream,
T(&)  arr[N],
void *  context 
)

Definition at line 516 of file DataIO.h.

517{
518 for (std::size_t i = 0; i < N; ++i)
519 dataStore(stream, arr[i], context);
520}

◆ dataStore() [58/64]

template<>
void dataStore ( std::ostream &  stream,
torch::Tensor &  t,
void *  context 
)

Definition at line 223 of file DataIO.C.

224{
225 const bool defined = t.defined();
226 dataStore(stream, defined, nullptr);
227
228 if (!defined)
229 return;
230
231 const auto tensor = LibtorchUtils::toCPUContiguous(t);
232 mooseAssert(tensor.scalar_type() == at::kDouble,
233 "Restart storage currently supports only double tensors.");
234
235 auto rank = cast_int<unsigned int>(tensor.dim());
236 dataStore(stream, rank, nullptr);
237 for (unsigned int dim = 0; dim < rank; ++dim)
238 {
239 auto size = cast_int<unsigned int>(tensor.sizes()[dim]);
240 dataStore(stream, size, nullptr);
241 }
242
243 const auto flattened = tensor.reshape({tensor.numel()});
244 const auto t_accessor = flattened.accessor<Real, 1>();
245 for (int64_t i = 0; i < flattened.numel(); ++i)
246 {
247 Real r = t_accessor[i];
248 dataStore(stream, r, context);
249 }
250}
torch::Tensor toCPUContiguous(const torch::Tensor &tensor)
Return a detached contiguous CPU copy of a tensor.

◆ dataStore() [59/64]

template<typename T >
void dataStore ( std::ostream &  stream,
UniqueStorage< T > &  data,
void *  context 
)

UniqueStorage helper routine.

The data within the UniqueStorage object cannot be null. The helper for unique_ptr<T> is called to store the data.

Definition at line 611 of file DataIO.h.

612{
613 std::size_t size = data.size();
614 dataStore(stream, size, nullptr);
615
616 for (const auto i : index_range(data))
617 {
618 mooseAssert(data.hasValue(i), "Data doesn't have a value");
619 dataStore(stream, data.pointerValue(i), context);
620 }
621}
std::size_t size() const
bool hasValue(const std::size_t i) const
const std::unique_ptr< T > & pointerValue(const std::size_t i) const
Returns a read-only reference to the underlying unique pointer at index i.

◆ dataStore() [60/64]

template<>
void dataStore ( std::ostream &  stream,
UserObjectName &  v,
void *  context 
)

Definition at line 59 of file DataIO.C.

60{
61 auto & name = cast_ref<std::string &>(v);
62 dataStore(stream, name, context);
63}

◆ dataStore() [61/64]

template<>
void dataStore ( std::ostream &  stream,
UserObjectName &  v,
void *  context 
)

Definition at line 59 of file DataIO.C.

60{
61 auto & name = cast_ref<std::string &>(v);
62 dataStore(stream, name, context);
63}

◆ dataStore() [62/64]

template<>
void dataStore ( std::ostream &  stream,
VariableName &  v,
void *  context 
)

Definition at line 51 of file DataIO.C.

52{
53 auto & name = cast_ref<std::string &>(v);
54 dataStore(stream, name, context);
55}

◆ dataStore() [63/64]

template<>
void dataStore ( std::ostream &  stream,
VariableName &  v,
void *  context 
)

Definition at line 51 of file DataIO.C.

52{
53 auto & name = cast_ref<std::string &>(v);
54 dataStore(stream, name, context);
55}

◆ dataStore() [64/64]

template<>
void dataStore ( std::ostream &  stream,
Vec &  v,
void *  context 
)

Definition at line 810 of file DataIO.C.

811{
812 PetscInt local_size;
813 LibmeshPetscCallA(PETSC_COMM_WORLD, VecGetLocalSize(v, &local_size));
814 PetscScalar * array;
815 LibmeshPetscCallA(PETSC_COMM_WORLD, VecGetArray(v, &array));
816 for (PetscInt i = 0; i < local_size; i++)
817 dataStore(stream, array[i], context);
818
819 LibmeshPetscCallA(PETSC_COMM_WORLD, VecRestoreArray(v, &array));
820}