https://mooseframework.inl.gov
Classes | Namespaces | Functions
DataIO.h File Reference

Go to the source code of this file.

Classes

class  libMesh::DenseMatrix< T >
 
class  libMesh::DenseVector< T >
 
class  libMesh::VectorValue< T >
 
class  libMesh::TensorValue< T >
 
class  libMesh::Parallel::Packing< std::basic_string< T > >
 

Namespaces

 libMesh
 The following methods are specializations for using the libMesh::Parallel::packed_range_* routines for std::strings.
 
 libMesh::Parallel
 

Functions

template<typename P >
void storeHelper (std::ostream &stream, P &data, void *context)
 Scalar helper routine. More...
 
template<typename P >
void storeHelper (std::ostream &stream, std::vector< P > &data, void *context)
 Vector helper routine. More...
 
template<typename P >
void storeHelper (std::ostream &stream, std::shared_ptr< P > &data, void *context)
 Shared pointer helper routine. More...
 
template<typename P >
void storeHelper (std::ostream &stream, std::unique_ptr< P > &data, void *context)
 Unique pointer helper routine. More...
 
template<typename P >
void storeHelper (std::ostream &stream, std::set< P > &data, void *context)
 Set helper routine. More...
 
template<typename P , typename Q >
void storeHelper (std::ostream &stream, std::map< P, Q > &data, void *context)
 Map helper routine. More...
 
template<typename P , typename Q >
void storeHelper (std::ostream &stream, std::unordered_map< P, Q > &data, void *context)
 Unordered_map helper routine. More...
 
template<typename P >
void storeHelper (std::ostream &stream, std::optional< P > &data, void *context)
 Optional helper routine. More...
 
template<typename P , typename Q >
void storeHelper (std::ostream &stream, HashMap< P, Q > &data, void *context)
 HashMap helper routine. More...
 
template<typename T >
void storeHelper (std::ostream &stream, UniqueStorage< T > &data, void *context)
 UniqueStorage helper routine. More...
 
template<typename P >
void loadHelper (std::istream &stream, P &data, void *context)
 Scalar helper routine. More...
 
template<typename P >
void loadHelper (std::istream &stream, std::vector< P > &data, void *context)
 Vector helper routine. More...
 
template<typename P >
void loadHelper (std::istream &stream, std::shared_ptr< P > &data, void *context)
 Shared Pointer helper routine. More...
 
template<typename P >
void loadHelper (std::istream &stream, std::unique_ptr< P > &data, void *context)
 Unique Pointer helper routine. More...
 
template<typename P >
void loadHelper (std::istream &stream, std::set< P > &data, void *context)
 Set helper routine. More...
 
template<typename P , typename Q >
void loadHelper (std::istream &stream, std::map< P, Q > &data, void *context)
 Map helper routine. More...
 
template<typename P , typename Q >
void loadHelper (std::istream &stream, std::unordered_map< P, Q > &data, void *context)
 Unordered_map helper routine. More...
 
template<typename P >
void loadHelper (std::istream &stream, std::optional< P > &data, void *context)
 Optional helper routine. More...
 
template<typename P , typename Q >
void loadHelper (std::istream &stream, HashMap< P, Q > &data, void *context)
 Hashmap helper routine. More...
 
template<typename T >
void loadHelper (std::istream &stream, UniqueStorage< T > &data, void *context)
 UniqueStorage helper routine. More...
 
template<typename T >
void dataStore (std::ostream &stream, T &v, void *)
 
template<typename T >
void dataStore (std::ostream &, T *&, void *)
 
void dataStore (std::ostream &stream, Point &p, void *context)
 
template<typename T , typename U >
void dataStore (std::ostream &stream, std::pair< T, U > &p, 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::shared_ptr< T > &v, void *context)
 
template<typename T >
void dataStore (std::ostream &stream, std::unique_ptr< 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 >
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 , int Rows, int Cols>
void dataStore (std::ostream &stream, Eigen::Matrix< T, Rows, Cols > &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, std::vector< bool > &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<>
void dataStore (std::ostream &stream, std::unique_ptr< libMesh::NumericVector< libMesh::Number >> &v, void *context)
 Stores an owned numeric vector. More...
 
template<std::size_t N>
void dataStore (std::ostream &stream, std::array< ADReal, N > &dn, void *context)
 
template<std::size_t N>
void dataStore (std::ostream &stream, ADReal(&dn)[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, 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::VectorValue< 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 dataLoad (std::istream &stream, T &v, void *)
 
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)
 
template<typename T >
void dataLoad (std::istream &stream, std::vector< T > &v, 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<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 >
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 , int Rows, int Cols>
void dataLoad (std::istream &stream, Eigen::Matrix< T, Rows, Cols > &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, std::vector< bool > &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, std::unique_ptr< libMesh::NumericVector< libMesh::Number >> &v, void *context)
 Loads an owned numeric vector. More...
 
template<std::size_t N>
void dataLoad (std::istream &stream, std::array< ADReal, N > &dn, void *context)
 
template<std::size_t N>
void dataLoad (std::istream &stream, ADReal(&dn)[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, 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::VectorValue< 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)
 
void dataLoad (std::istream &stream, Point &p, void *context)
 

Function Documentation

◆ dataLoad() [1/44]

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

Definition at line 551 of file DataIO.h.

Referenced by dataLoad(), and loadHelper().

552 {
553  stream.read((char *)&v, sizeof(v));
554  mooseAssert(!stream.bad(), "Failed to load");
555 }

◆ dataLoad() [2/44]

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

Definition at line 559 of file DataIO.h.

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

◆ dataLoad() [3/44]

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

Definition at line 568 of file DataIO.h.

569 {
570  loadHelper(stream, p.first, context);
571  loadHelper(stream, p.second, context);
572 }
void loadHelper(std::istream &stream, P &data, void *context)
Scalar helper routine.
Definition: DataIO.h:1010

◆ dataLoad() [4/44]

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

Definition at line 576 of file DataIO.h.

577 {
578  // First read the size of the vector
579  unsigned int size = 0;
580  dataLoad(stream, size, nullptr);
581 
582  v.resize(size);
583 
584  for (unsigned int i = 0; i < size; i++)
585  loadHelper(stream, v[i], context);
586 }
void dataLoad(std::istream &stream, T &v, void *)
Definition: DataIO.h:551
void loadHelper(std::istream &stream, P &data, void *context)
Scalar helper routine.
Definition: DataIO.h:1010

◆ dataLoad() [5/44]

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

Definition at line 590 of file DataIO.h.

591 {
592  T * tmp = v.get();
593 
594  loadHelper(stream, tmp, context);
595 }
void loadHelper(std::istream &stream, P &data, void *context)
Scalar helper routine.
Definition: DataIO.h:1010

◆ dataLoad() [6/44]

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

Definition at line 599 of file DataIO.h.

600 {
601  T * tmp = v.get();
602 
603  loadHelper(stream, tmp, context);
604 }
void loadHelper(std::istream &stream, P &data, void *context)
Scalar helper routine.
Definition: DataIO.h:1010

◆ dataLoad() [7/44]

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

Definition at line 608 of file DataIO.h.

609 {
610  // First read the size of the set
611  unsigned int size = 0;
612  dataLoad(stream, size, nullptr);
613 
614  for (unsigned int i = 0; i < size; i++)
615  {
616  T data;
617  loadHelper(stream, data, context);
618  s.insert(std::move(data));
619  }
620 }
void dataLoad(std::istream &stream, T &v, void *)
Definition: DataIO.h:551
void loadHelper(std::istream &stream, P &data, void *context)
Scalar helper routine.
Definition: DataIO.h:1010

◆ dataLoad() [8/44]

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

Definition at line 624 of file DataIO.h.

625 {
626  // First read the size of the set
627  unsigned int size = 0;
628  dataLoad(stream, size, nullptr);
629 
630  for (unsigned int i = 0; i < size; i++)
631  {
632  T data;
633  loadHelper(stream, data, context);
634  l.push_back(std::move(data));
635  }
636 }
void dataLoad(std::istream &stream, T &v, void *)
Definition: DataIO.h:551
void loadHelper(std::istream &stream, P &data, void *context)
Scalar helper routine.
Definition: DataIO.h:1010

◆ dataLoad() [9/44]

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

Definition at line 640 of file DataIO.h.

641 {
642  // First read the size of the container
643  unsigned int size = 0;
644  dataLoad(stream, size, nullptr);
645 
646  for (unsigned int i = 0; i < size; i++)
647  {
648  T data;
649  loadHelper(stream, data, context);
650  l.push_back(std::move(data));
651  }
652 }
void dataLoad(std::istream &stream, T &v, void *)
Definition: DataIO.h:551
void loadHelper(std::istream &stream, P &data, void *context)
Scalar helper routine.
Definition: DataIO.h:1010

◆ dataLoad() [10/44]

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

Definition at line 656 of file DataIO.h.

657 {
658  m.clear();
659 
660  // First read the size of the map
661  unsigned int size = 0;
662  dataLoad(stream, size, nullptr);
663 
664  for (unsigned int i = 0; i < size; i++)
665  {
666  T key;
667  loadHelper(stream, key, context);
668 
669  U & value = m[key];
670  loadHelper(stream, value, context);
671  }
672 }
Real value(unsigned n, unsigned alpha, unsigned beta, Real x)
void dataLoad(std::istream &stream, T &v, void *)
Definition: DataIO.h:551
void loadHelper(std::istream &stream, P &data, void *context)
Scalar helper routine.
Definition: DataIO.h:1010

◆ dataLoad() [11/44]

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

Definition at line 676 of file DataIO.h.

677 {
678  m.clear();
679 
680  // First read the size of the map
681  unsigned int size = 0;
682  dataLoad(stream, size, nullptr);
683 
684  for (unsigned int i = 0; i < size; i++)
685  {
686  T key;
687  loadHelper(stream, key, context);
688 
689  U & value = m[key];
690  loadHelper(stream, value, context);
691  }
692 }
Real value(unsigned n, unsigned alpha, unsigned beta, Real x)
void dataLoad(std::istream &stream, T &v, void *)
Definition: DataIO.h:551
void loadHelper(std::istream &stream, P &data, void *context)
Scalar helper routine.
Definition: DataIO.h:1010

◆ dataLoad() [12/44]

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

Definition at line 696 of file DataIO.h.

697 {
698  s.clear();
699 
700  // First read the size of the set
701  std::size_t size = 0;
702  dataLoad(stream, size, nullptr);
703  s.reserve(size);
704 
705  for (std::size_t i = 0; i < size; i++)
706  {
707  T element;
708  dataLoad(stream, element, context);
709  s.insert(element);
710  }
711 }
void dataLoad(std::istream &stream, T &v, void *)
Definition: DataIO.h:551

◆ dataLoad() [13/44]

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

Definition at line 715 of file DataIO.h.

716 {
717  bool has_value;
718  dataLoad(stream, has_value, nullptr);
719 
720  if (has_value)
721  {
722  m = T{};
723  loadHelper(stream, *m, context);
724  }
725  else
726  m.reset();
727 }
void dataLoad(std::istream &stream, T &v, void *)
Definition: DataIO.h:551
void loadHelper(std::istream &stream, P &data, void *context)
Scalar helper routine.
Definition: DataIO.h:1010

◆ dataLoad() [14/44]

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

Definition at line 731 of file DataIO.h.

732 {
733  // First read the size of the map
734  unsigned int size = 0;
735  dataLoad(stream, size, nullptr);
736 
737  for (unsigned int i = 0; i < size; i++)
738  {
739  T key;
740  loadHelper(stream, key, context);
741 
742  U & value = m[key];
743  loadHelper(stream, value, context);
744  }
745 }
Real value(unsigned n, unsigned alpha, unsigned beta, Real x)
void dataLoad(std::istream &stream, T &v, void *)
Definition: DataIO.h:551
void loadHelper(std::istream &stream, P &data, void *context)
Scalar helper routine.
Definition: DataIO.h:1010

◆ dataLoad() [15/44]

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

Definition at line 749 of file DataIO.h.

750 {
751  unsigned int m = 0;
752  dataLoad(stream, m, context);
753  unsigned int n = 0;
754  dataLoad(stream, n, context);
755  v.resize(m, n);
756  for (const auto i : make_range(m))
757  for (const auto j : make_range(n))
758  {
759  T r{};
760  dataLoad(stream, r, context);
761  v(i, j) = r;
762  }
763 }
IntRange< T > make_range(T beg, T end)
void dataLoad(std::istream &stream, T &v, void *)
Definition: DataIO.h:551

◆ dataLoad() [16/44]

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

Definition at line 343 of file DataIO.C.

Referenced by dataLoad().

344 {
345  stream.read((char *)&v, sizeof(v));
346 }

◆ dataLoad() [17/44]

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

Definition at line 350 of file DataIO.C.

351 {
352  // Read the size of the string
353  unsigned int size = 0;
354  stream.read((char *)&size, sizeof(size));
355 
356  // Resize the string data
357  v.resize(size);
358 
359  // Read the string
360  stream.read(&v[0], sizeof(char) * size);
361 }

◆ dataLoad() [18/44]

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

Definition at line 365 of file DataIO.C.

366 {
367  auto & name = static_cast<std::string &>(v);
368  dataLoad(stream, name, context);
369 }
std::string name(const ElemQuality q)
void dataLoad(std::istream &stream, Real &v, void *)
Definition: DataIO.C:343

◆ dataLoad() [19/44]

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

Definition at line 373 of file DataIO.C.

374 {
375  auto & name = static_cast<std::string &>(v);
376  dataLoad(stream, name, context);
377 }
std::string name(const ElemQuality q)
void dataLoad(std::istream &stream, Real &v, void *)
Definition: DataIO.C:343

◆ dataLoad() [20/44]

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

Definition at line 381 of file DataIO.C.

382 {
383  stream.read((char *)&v, sizeof(v));
384 }

◆ dataLoad() [21/44]

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

Definition at line 388 of file DataIO.C.

389 {
390  for (bool b : v)
391  dataLoad(stream, b, context);
392 }
void dataLoad(std::istream &stream, Real &v, void *)
Definition: DataIO.C:343

◆ dataLoad() [22/44]

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

◆ dataLoad() [23/44]

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

◆ dataLoad() [24/44]

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

◆ dataLoad() [25/44]

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

◆ dataLoad() [26/44]

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

Definition at line 497 of file DataIO.C.

498 {
499  size_t s_size = 0;
500  stream.read((char *)&s_size, sizeof(s_size));
501 
502  std::unique_ptr<char[]> s_s = std::make_unique<char[]>(s_size);
503  stream.read(s_s.get(), s_size);
504 
505  // Clear the stringstream before loading new data into it.
506  s.str(std::string());
507  s.write(s_s.get(), s_size);
508 }

◆ dataLoad() [27/44]

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

Definition at line 396 of file DataIO.C.

397 {
398  dataLoad(stream, dn.value(), context);
399 
400  if (ADReal::do_derivatives)
401  {
402  auto & derivatives = dn.derivatives();
403  std::size_t size = 0;
404  stream.read((char *)&size, sizeof(size));
405  derivatives.resize(size);
406 
407  for (MooseIndex(derivatives) i = 0; i < derivatives.size(); ++i)
408  {
409  dataLoad(stream, derivatives.raw_index(i), context);
410  dataLoad(stream, derivatives.raw_at(i), context);
411  }
412  }
413 }
void dataLoad(std::istream &stream, Real &v, void *)
Definition: DataIO.C:343

◆ dataLoad() [28/44]

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

Definition at line 578 of file DataIO.C.

579 {
580  p.clear();
581 
582  // First read the size of the map
583  unsigned int size = 0;
584  stream.read((char *)&size, sizeof(size));
585 
586  for (unsigned int i = 0; i < size; i++)
587  {
588  std::string key, type;
589  loadHelper(stream, key, context);
590  loadHelper(stream, type, context);
591 
592 #define loadscalar(ptype) \
593  else if (type == demangle(typeid(ptype).name())) do \
594  { \
595  ptype & value = p.set<ptype>(key); \
596  loadHelper(stream, value, context); \
597  } \
598  while (0)
599 
600  if (false)
601  ;
602  loadscalar(Real);
603  loadscalar(short);
604  loadscalar(int);
605  loadscalar(long);
606  loadscalar(unsigned short);
607  loadscalar(unsigned int);
608  loadscalar(unsigned long);
609 
610 #undef loadscalar
611  }
612 }
virtual void clear()
void loadHelper(std::istream &stream, P &data, void *context)
Scalar helper routine.
Definition: DataIO.h:1010

◆ dataLoad() [29/44]

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() [30/44]

template<std::size_t N>
void dataLoad ( std::istream &  stream,
std::array< ADReal, N > &  dn,
void context 
)
inline

Definition at line 818 of file DataIO.h.

819 {
820  for (std::size_t i = 0; i < N; ++i)
821  dataLoad(stream, dn[i], context);
822 }
void dataLoad(std::istream &stream, T &v, void *)
Definition: DataIO.h:551

◆ dataLoad() [31/44]

template<std::size_t N>
void dataLoad ( std::istream &  stream,
ADReal(&)  dn[N],
void context 
)
inline

Definition at line 826 of file DataIO.h.

827 {
828  for (std::size_t i = 0; i < N; ++i)
829  dataLoad(stream, dn[i], context);
830 }
void dataLoad(std::istream &stream, T &v, void *)
Definition: DataIO.h:551

◆ dataLoad() [32/44]

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

Definition at line 834 of file DataIO.h.

835 {
836  numeric_index_type size = v.local_size();
837  for (numeric_index_type i = v.first_local_index(); i < v.first_local_index() + size; i++)
838  {
839  T r = 0;
840  dataLoad(stream, r, context);
841  v.set(i, r);
842  }
843  v.close();
844 }
dof_id_type numeric_index_type
virtual void close()=0
virtual numeric_index_type first_local_index() const=0
virtual numeric_index_type local_size() const=0
virtual void set(const numeric_index_type i, const T value)=0
void dataLoad(std::istream &stream, T &v, void *)
Definition: DataIO.h:551

◆ dataLoad() [33/44]

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

Definition at line 665 of file DataIO.C.

666 {
667  PetscInt local_size;
668  LibmeshPetscCallA(PETSC_COMM_WORLD, VecGetLocalSize(v, &local_size));
669  PetscScalar * array;
670  LibmeshPetscCallA(PETSC_COMM_WORLD, VecGetArray(v, &array));
671  for (PetscInt i = 0; i < local_size; i++)
672  dataLoad(stream, array[i], context);
673 
674  LibmeshPetscCallA(PETSC_COMM_WORLD, VecRestoreArray(v, &array));
675 }
void dataLoad(std::istream &stream, Real &v, void *)
Definition: DataIO.C:343

◆ dataLoad() [34/44]

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

Definition at line 851 of file DataIO.h.

852 {
853  unsigned int n = 0;
854  dataLoad(stream, n, nullptr);
855  v.resize(n);
856  for (unsigned int i = 0; i < n; i++)
857  {
858  T r = 0;
859  dataLoad(stream, r, context);
860  v(i) = r;
861  }
862 }
void dataLoad(std::istream &stream, T &v, void *)
Definition: DataIO.h:551

◆ dataLoad() [35/44]

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

Definition at line 512 of file DataIO.C.

513 {
514  // Obviously if someone loads data with different LIBMESH_DIM than was used for saving them, it
515  // won't work.
516  for (const auto i : make_range(Moose::dim))
517  for (const auto j : make_range(Moose::dim))
518  {
519  T r = 0;
520  dataLoad(stream, r, context);
521  v(i, j) = r;
522  }
523 }
static constexpr std::size_t dim
This is the dimension of all vector and tensor datastructures used in MOOSE.
Definition: Moose.h:162
void dataLoad(std::istream &stream, Real &v, void *)
Definition: DataIO.C:343
IntRange< T > make_range(T beg, T end)

◆ dataLoad() [36/44]

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

Definition at line 530 of file DataIO.C.

531 {
532  unsigned int m = 0, n = 0;
533  stream.read((char *)&m, sizeof(m));
534  stream.read((char *)&n, sizeof(n));
535  v.resize(m, n);
536  for (unsigned int i = 0; i < m; i++)
537  for (unsigned int j = 0; j < n; j++)
538  {
539  T r = 0;
540  dataLoad(stream, r, context);
541  v(i, j) = r;
542  }
543 }
void dataLoad(std::istream &stream, Real &v, void *)
Definition: DataIO.C:343
void resize(const unsigned int new_m, const unsigned int new_n)

◆ dataLoad() [37/44]

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

Definition at line 550 of file DataIO.C.

551 {
552  // Obviously if someone loads data with different LIBMESH_DIM than was used for saving them, it
553  // won't work.
554  for (const auto i : make_range(Moose::dim))
555  {
556  T r = 0;
557  dataLoad(stream, r, context);
558  v(i) = r;
559  }
560 }
static constexpr std::size_t dim
This is the dimension of all vector and tensor datastructures used in MOOSE.
Definition: Moose.h:162
void dataLoad(std::istream &stream, Real &v, void *)
Definition: DataIO.C:343
IntRange< T > make_range(T beg, T end)

◆ dataLoad() [38/44]

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

Definition at line 875 of file DataIO.h.

876 {
877  dataLoad(stream, rtt._coords, context);
878 }
T _coords[LIBMESH_DIM *LIBMESH_DIM]
void dataLoad(std::istream &stream, T &v, void *)
Definition: DataIO.h:551

◆ dataLoad() [39/44]

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

Definition at line 882 of file DataIO.h.

883 {
884  dataLoad(stream, rtt._vals, context);
885 }
T _vals[N3]
The values of the rank-three tensor stored by index=((i * LIBMESH_DIM + j) * LIBMESH_DIM + k) ...
void dataLoad(std::istream &stream, T &v, void *)
Definition: DataIO.h:551

◆ dataLoad() [40/44]

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

Definition at line 889 of file DataIO.h.

890 {
891  dataLoad(stream, rft._vals, context);
892 }
T _vals[N4]
The values of the rank-four tensor stored by index=(((i * LIBMESH_DIM + j) * LIBMESH_DIM + k) * LIBME...
void dataLoad(std::istream &stream, T &v, void *)
Definition: DataIO.h:551

◆ dataLoad() [41/44]

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

Definition at line 896 of file DataIO.h.

897 {
898  dataLoad(stream, rtt._vals, context);
899 }
void dataLoad(std::istream &stream, T &v, void *)
Definition: DataIO.h:551

◆ dataLoad() [42/44]

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

Definition at line 903 of file DataIO.h.

904 {
905  dataLoad(stream, rft._vals, context);
906 }
std::array< T, N2 > _vals
The values of the rank-four tensor.
void dataLoad(std::istream &stream, T &v, void *)
Definition: DataIO.h:551

◆ dataLoad() [43/44]

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

Definition at line 910 of file DataIO.h.

911 {
912  dataLoad(stream, cmm._values, context);
913 }
std::vector< T > _values
void dataLoad(std::istream &stream, T &v, void *)
Definition: DataIO.h:551

◆ dataLoad() [44/44]

void dataLoad ( std::istream &  stream,
Point &  p,
void context 
)

◆ dataStore() [1/44]

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

Definition at line 183 of file DataIO.h.

Referenced by dataStore(), and storeHelper().

184 {
185 #ifdef LIBMESH_HAVE_CXX11_TYPE_TRAITS
186  static_assert(std::is_polymorphic<T>::value == false,
187  "Cannot serialize a class that has virtual "
188  "members!\nWrite a custom dataStore() "
189  "template specialization!\n\n");
190  static_assert(std::is_trivially_copyable<T>::value,
191  "Cannot serialize a class that is not trivially copyable!\nWrite a custom "
192  "dataStore() template specialization!\n\n");
193 #endif
194 
195  stream.write((char *)&v, sizeof(v));
196  mooseAssert(!stream.bad(), "Failed to store");
197 }

◆ dataStore() [2/44]

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

Definition at line 201 of file DataIO.h.

202 {
203  mooseError("Attempting to store a raw pointer type: \"",
204  libMesh::demangle(typeid(T).name()),
205  " *\" as restartable data!\nWrite a custom dataStore() template specialization!\n\n");
206 }
std::string name(const ElemQuality q)
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:323
std::string demangle(const char *name)

◆ dataStore() [3/44]

void dataStore ( std::ostream &  stream,
Point &  p,
void context 
)

◆ dataStore() [4/44]

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

Definition at line 212 of file DataIO.h.

213 {
214  storeHelper(stream, p.first, context);
215  storeHelper(stream, p.second, context);
216 }
void storeHelper(std::ostream &stream, P &data, void *context)
Scalar helper routine.
Definition: DataIO.h:918

◆ dataStore() [5/44]

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

Definition at line 220 of file DataIO.h.

221 {
222  // First store the size of the vector
223  unsigned int size = v.size();
224  dataStore(stream, size, nullptr);
225 
226  for (unsigned int i = 0; i < size; i++)
227  storeHelper(stream, v[i], context);
228 }
void storeHelper(std::ostream &stream, P &data, void *context)
Scalar helper routine.
Definition: DataIO.h:918
void dataStore(std::ostream &stream, T &v, void *)
Definition: DataIO.h:183

◆ dataStore() [6/44]

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

Definition at line 232 of file DataIO.h.

233 {
234  T * tmp = v.get();
235 
236  storeHelper(stream, tmp, context);
237 }
void storeHelper(std::ostream &stream, P &data, void *context)
Scalar helper routine.
Definition: DataIO.h:918

◆ dataStore() [7/44]

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

Definition at line 241 of file DataIO.h.

242 {
243  T * tmp = v.get();
244 
245  storeHelper(stream, tmp, context);
246 }
void storeHelper(std::ostream &stream, P &data, void *context)
Scalar helper routine.
Definition: DataIO.h:918

◆ dataStore() [8/44]

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

Definition at line 250 of file DataIO.h.

251 {
252  // First store the size of the set
253  unsigned int size = s.size();
254  dataStore(stream, size, nullptr);
255 
256  typename std::set<T>::iterator it = s.begin();
257  typename std::set<T>::iterator end = s.end();
258 
259  for (; it != end; ++it)
260  {
261  T & x = const_cast<T &>(*it);
262  storeHelper(stream, x, context);
263  }
264 }
void storeHelper(std::ostream &stream, P &data, void *context)
Scalar helper routine.
Definition: DataIO.h:918
void dataStore(std::ostream &stream, T &v, void *)
Definition: DataIO.h:183

◆ dataStore() [9/44]

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

Definition at line 268 of file DataIO.h.

269 {
270  // First store the size of the set
271  unsigned int size = l.size();
272  dataStore(stream, size, nullptr);
273 
274  typename std::list<T>::iterator it = l.begin();
275  typename std::list<T>::iterator end = l.end();
276 
277  for (; it != end; ++it)
278  {
279  T & x = const_cast<T &>(*it);
280  storeHelper(stream, x, context);
281  }
282 }
void storeHelper(std::ostream &stream, P &data, void *context)
Scalar helper routine.
Definition: DataIO.h:918
void dataStore(std::ostream &stream, T &v, void *)
Definition: DataIO.h:183

◆ dataStore() [10/44]

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

Definition at line 286 of file DataIO.h.

287 {
288  // First store the size of the container
289  unsigned int size = l.size();
290  dataStore(stream, size, nullptr);
291 
292  typename std::deque<T>::iterator it = l.begin();
293  typename std::deque<T>::iterator end = l.end();
294 
295  for (; it != end; ++it)
296  {
297  T & x = const_cast<T &>(*it);
298  storeHelper(stream, x, context);
299  }
300 }
void storeHelper(std::ostream &stream, P &data, void *context)
Scalar helper routine.
Definition: DataIO.h:918
void dataStore(std::ostream &stream, T &v, void *)
Definition: DataIO.h:183

◆ dataStore() [11/44]

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

Definition at line 304 of file DataIO.h.

305 {
306  // First store the size of the map
307  unsigned int size = m.size();
308  dataStore(stream, size, nullptr);
309 
310  typename std::map<T, U>::iterator it = m.begin();
311  typename std::map<T, U>::iterator end = m.end();
312 
313  for (; it != end; ++it)
314  {
315  T & key = const_cast<T &>(it->first);
316 
317  storeHelper(stream, key, context);
318 
319  storeHelper(stream, it->second, context);
320  }
321 }
void storeHelper(std::ostream &stream, P &data, void *context)
Scalar helper routine.
Definition: DataIO.h:918
void dataStore(std::ostream &stream, T &v, void *)
Definition: DataIO.h:183

◆ dataStore() [12/44]

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

Definition at line 325 of file DataIO.h.

326 {
327  // First store the size of the map
328  unsigned int size = m.size();
329  dataStore(stream, size, nullptr);
330 
331  typename std::unordered_map<T, U>::iterator it = m.begin();
332  typename std::unordered_map<T, U>::iterator end = m.end();
333 
334  for (; it != end; ++it)
335  {
336  T & key = const_cast<T &>(it->first);
337 
338  storeHelper(stream, key, context);
339 
340  storeHelper(stream, it->second, context);
341  }
342 }
void storeHelper(std::ostream &stream, P &data, void *context)
Scalar helper routine.
Definition: DataIO.h:918
void dataStore(std::ostream &stream, T &v, void *)
Definition: DataIO.h:183

◆ dataStore() [13/44]

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

Definition at line 346 of file DataIO.h.

347 {
348  // First store the size of the set
349  std::size_t size = s.size();
350  dataStore(stream, size, nullptr);
351 
352  for (auto & element : s)
353  dataStore(stream, element, context);
354 }
void dataStore(std::ostream &stream, T &v, void *)
Definition: DataIO.h:183

◆ dataStore() [14/44]

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

Definition at line 358 of file DataIO.h.

359 {
360  bool has_value = m.has_value();
361  dataStore(stream, has_value, nullptr);
362 
363  if (has_value)
364  storeHelper(stream, *m, context);
365 }
void storeHelper(std::ostream &stream, P &data, void *context)
Scalar helper routine.
Definition: DataIO.h:918
void dataStore(std::ostream &stream, T &v, void *)
Definition: DataIO.h:183

◆ dataStore() [15/44]

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

Definition at line 369 of file DataIO.h.

370 {
371  // First store the size of the map
372  unsigned int size = m.size();
373  dataStore(stream, size, nullptr);
374 
375  typename HashMap<T, U>::iterator it = m.begin();
376  typename HashMap<T, U>::iterator end = m.end();
377 
378  for (; it != end; ++it)
379  {
380  T & key = const_cast<T &>(it->first);
381 
382  storeHelper(stream, key, context);
383 
384  storeHelper(stream, it->second, context);
385  }
386 }
HashMap is an abstraction for dictionary data type, we make it thread-safe by locking inserts...
Definition: HashMap.h:18
void storeHelper(std::ostream &stream, P &data, void *context)
Scalar helper routine.
Definition: DataIO.h:918
void dataStore(std::ostream &stream, T &v, void *)
Definition: DataIO.h:183

◆ dataStore() [16/44]

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

Definition at line 390 of file DataIO.h.

391 {
392  auto m = cast_int<unsigned int>(v.rows());
393  dataStore(stream, m, context);
394  auto n = cast_int<unsigned int>(v.cols());
395  dataStore(stream, n, context);
396  for (const auto i : make_range(m))
397  for (const auto j : make_range(n))
398  {
399  auto & r = v(i, j);
400  dataStore(stream, r, context);
401  }
402 }
void dataStore(std::ostream &stream, T &v, void *)
Definition: DataIO.h:183
IntRange< T > make_range(T beg, T end)

◆ dataStore() [17/44]

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

Definition at line 28 of file DataIO.C.

Referenced by dataStore().

29 {
30  stream.write((char *)&v, sizeof(v));
31 }

◆ dataStore() [18/44]

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

Definition at line 35 of file DataIO.C.

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

◆ dataStore() [19/44]

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

Definition at line 47 of file DataIO.C.

48 {
49  auto & name = static_cast<std::string &>(v);
50  dataStore(stream, name, context);
51 }
std::string name(const ElemQuality q)
void dataStore(std::ostream &stream, Real &v, void *)
Definition: DataIO.C:28

◆ dataStore() [20/44]

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

Definition at line 55 of file DataIO.C.

56 {
57  auto & name = static_cast<std::string &>(v);
58  dataStore(stream, name, context);
59 }
std::string name(const ElemQuality q)
void dataStore(std::ostream &stream, Real &v, void *)
Definition: DataIO.C:28

◆ dataStore() [21/44]

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

Definition at line 63 of file DataIO.C.

64 {
65  stream.write((char *)&v, sizeof(v));
66 }

◆ dataStore() [22/44]

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

Definition at line 70 of file DataIO.C.

71 {
72  for (bool b : v)
73  dataStore(stream, b, context);
74 }
void dataStore(std::ostream &stream, Real &v, void *)
Definition: DataIO.C:28

◆ dataStore() [23/44]

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

◆ dataStore() [24/44]

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

◆ dataStore() [25/44]

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

◆ dataStore() [26/44]

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

◆ dataStore() [27/44]

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

Definition at line 186 of file DataIO.C.

187 {
188  const std::string & s_str = s.str();
189 
190  size_t s_size = s_str.size();
191  stream.write((char *)&s_size, sizeof(s_size));
192 
193  stream.write(s_str.c_str(), sizeof(char) * (s_str.size()));
194 }

◆ dataStore() [28/44]

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

Definition at line 99 of file DataIO.C.

100 {
101  dataStore(stream, dn.value(), context);
102 
103  if (ADReal::do_derivatives)
104  {
105  auto & derivatives = dn.derivatives();
106  std::size_t size = derivatives.size();
107  dataStore(stream, size, context);
108  for (MooseIndex(size) i = 0; i < size; ++i)
109  {
110  dataStore(stream, derivatives.raw_index(i), context);
111  dataStore(stream, derivatives.raw_at(i), context);
112  }
113  }
114 }
void dataStore(std::ostream &stream, Real &v, void *)
Definition: DataIO.C:28

◆ dataStore() [29/44]

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

Definition at line 258 of file DataIO.C.

259 {
260  // First store the size of the map
261  unsigned int size = p.n_parameters();
262  stream.write((char *)&size, sizeof(size));
263 
264  auto it = p.begin();
265  auto end = p.end();
266 
267  for (; it != end; ++it)
268  {
269  auto & key = const_cast<std::string &>(it->first);
270  auto type = it->second->type();
271 
272  storeHelper(stream, key, context);
273  storeHelper(stream, type, context);
274 
275 #define storescalar(ptype) \
276  else if (it->second->type() == demangle(typeid(ptype).name())) storeHelper( \
277  stream, \
278  (dynamic_cast<libMesh::Parameters::Parameter<ptype> *>(MooseUtils::get(it->second)))->get(), \
279  context)
280 
281  if (false)
282  ;
283  storescalar(Real);
284  storescalar(short);
285  storescalar(int);
286  storescalar(long);
287  storescalar(unsigned short);
288  storescalar(unsigned int);
289  storescalar(unsigned long);
290 
291 #undef storescalar
292  }
293 }
void storeHelper(std::ostream &stream, P &data, void *context)
Scalar helper routine.
Definition: DataIO.h:918
std::size_t n_parameters() const

◆ dataStore() [30/44]

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() [31/44]

template<std::size_t N>
void dataStore ( std::ostream &  stream,
std::array< ADReal, N > &  dn,
void context 
)
inline

Definition at line 451 of file DataIO.h.

452 {
453  for (std::size_t i = 0; i < N; ++i)
454  dataStore(stream, dn[i], context);
455 }
void dataStore(std::ostream &stream, T &v, void *)
Definition: DataIO.h:183

◆ dataStore() [32/44]

template<std::size_t N>
void dataStore ( std::ostream &  stream,
ADReal(&)  dn[N],
void context 
)
inline

Definition at line 459 of file DataIO.h.

460 {
461  for (std::size_t i = 0; i < N; ++i)
462  dataStore(stream, dn[i], context);
463 }
void dataStore(std::ostream &stream, T &v, void *)
Definition: DataIO.h:183

◆ dataStore() [33/44]

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

Definition at line 467 of file DataIO.h.

468 {
469  v.close();
470 
471  numeric_index_type size = v.local_size();
472 
473  for (numeric_index_type i = v.first_local_index(); i < v.first_local_index() + size; i++)
474  {
475  T r = v(i);
476  dataStore(stream, r, context);
477  }
478 }
dof_id_type numeric_index_type
virtual void close()=0
void dataStore(std::ostream &stream, T &v, void *)
Definition: DataIO.h:183
virtual numeric_index_type first_local_index() const=0
virtual numeric_index_type local_size() const=0

◆ dataStore() [34/44]

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

Definition at line 679 of file DataIO.C.

680 {
681  PetscInt local_size;
682  LibmeshPetscCallA(PETSC_COMM_WORLD, VecGetLocalSize(v, &local_size));
683  PetscScalar * array;
684  LibmeshPetscCallA(PETSC_COMM_WORLD, VecGetArray(v, &array));
685  for (PetscInt i = 0; i < local_size; i++)
686  dataStore(stream, array[i], context);
687 
688  LibmeshPetscCallA(PETSC_COMM_WORLD, VecRestoreArray(v, &array));
689 }
void dataStore(std::ostream &stream, Real &v, void *)
Definition: DataIO.C:28

◆ dataStore() [35/44]

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

Definition at line 485 of file DataIO.h.

486 {
487  unsigned int m = v.size();
488  dataStore(stream, m, nullptr);
489  for (unsigned int i = 0; i < v.size(); i++)
490  {
491  T r = v(i);
492  dataStore(stream, r, context);
493  }
494 }
void dataStore(std::ostream &stream, T &v, void *)
Definition: DataIO.h:183

◆ dataStore() [36/44]

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

Definition at line 198 of file DataIO.C.

199 {
200  for (const auto i : make_range(Moose::dim))
201  for (const auto j : make_range(Moose::dim))
202  {
203  T r = v(i, j);
204  dataStore(stream, r, context);
205  }
206 }
static constexpr std::size_t dim
This is the dimension of all vector and tensor datastructures used in MOOSE.
Definition: Moose.h:162
IntRange< T > make_range(T beg, T end)
void dataStore(std::ostream &stream, Real &v, void *)
Definition: DataIO.C:28

◆ dataStore() [37/44]

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

Definition at line 213 of file DataIO.C.

214 {
215  unsigned int m = v.m();
216  unsigned int n = v.n();
217  stream.write((char *)&m, sizeof(m));
218  stream.write((char *)&n, sizeof(n));
219  for (unsigned int i = 0; i < m; i++)
220  for (unsigned int j = 0; j < n; j++)
221  {
222  T r = v(i, j);
223  dataStore(stream, r, context);
224  }
225 }
unsigned int m() const
unsigned int n() const
void dataStore(std::ostream &stream, Real &v, void *)
Definition: DataIO.C:28

◆ dataStore() [38/44]

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

Definition at line 232 of file DataIO.C.

233 {
234  // Obviously if someone loads data with different LIBMESH_DIM than was used for saving them, it
235  // won't work.
236  for (const auto i : make_range(Moose::dim))
237  {
238  T r = v(i);
239  dataStore(stream, r, context);
240  }
241 }
static constexpr std::size_t dim
This is the dimension of all vector and tensor datastructures used in MOOSE.
Definition: Moose.h:162
IntRange< T > make_range(T beg, T end)
void dataStore(std::ostream &stream, Real &v, void *)
Definition: DataIO.C:28

◆ dataStore() [39/44]

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

Definition at line 507 of file DataIO.h.

508 {
509  dataStore(stream, rtt._coords, context);
510 }
T _coords[LIBMESH_DIM *LIBMESH_DIM]
void dataStore(std::ostream &stream, T &v, void *)
Definition: DataIO.h:183

◆ dataStore() [40/44]

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

Definition at line 514 of file DataIO.h.

515 {
516  dataStore(stream, rtt._vals, context);
517 }
T _vals[N3]
The values of the rank-three tensor stored by index=((i * LIBMESH_DIM + j) * LIBMESH_DIM + k) ...
void dataStore(std::ostream &stream, T &v, void *)
Definition: DataIO.h:183

◆ dataStore() [41/44]

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

Definition at line 521 of file DataIO.h.

522 {
523  dataStore(stream, rft._vals, context);
524 }
T _vals[N4]
The values of the rank-four tensor stored by index=(((i * LIBMESH_DIM + j) * LIBMESH_DIM + k) * LIBME...
void dataStore(std::ostream &stream, T &v, void *)
Definition: DataIO.h:183

◆ dataStore() [42/44]

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

Definition at line 528 of file DataIO.h.

529 {
530  dataStore(stream, srtt._vals, context);
531 }
void dataStore(std::ostream &stream, T &v, void *)
Definition: DataIO.h:183

◆ dataStore() [43/44]

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

Definition at line 535 of file DataIO.h.

536 {
537  dataStore(stream, srft._vals, context);
538 }
std::array< T, N2 > _vals
The values of the rank-four tensor.
void dataStore(std::ostream &stream, T &v, void *)
Definition: DataIO.h:183

◆ dataStore() [44/44]

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

Definition at line 542 of file DataIO.h.

543 {
544  dataStore(stream, cmm._values, context);
545 }
void dataStore(std::ostream &stream, T &v, void *)
Definition: DataIO.h:183
std::vector< T > _values

◆ loadHelper() [1/10]

template<typename P >
void loadHelper ( std::istream &  stream,
P &  data,
void context 
)
inline

Scalar helper routine.

Definition at line 1010 of file DataIO.h.

Referenced by dataLoad(), MaterialPropertyBase< T, false >::load(), loadHelper(), ReporterState< std::vector< T > >::loadInternal(), and RestartableData< std::list< T > >::loadInternal().

1011 {
1012  dataLoad(stream, data, context);
1013 }
void dataLoad(std::istream &stream, T &v, void *)
Definition: DataIO.h:551

◆ loadHelper() [2/10]

template<typename P >
void loadHelper ( std::istream &  stream,
std::vector< P > &  data,
void context 
)
inline

Vector helper routine.

Definition at line 1018 of file DataIO.h.

1019 {
1020  dataLoad(stream, data, context);
1021 }
void dataLoad(std::istream &stream, T &v, void *)
Definition: DataIO.h:551

◆ loadHelper() [3/10]

template<typename P >
void loadHelper ( std::istream &  stream,
std::shared_ptr< P > &  data,
void context 
)
inline

Shared Pointer helper routine.

Definition at line 1026 of file DataIO.h.

1027 {
1028  dataLoad(stream, data, context);
1029 }
void dataLoad(std::istream &stream, T &v, void *)
Definition: DataIO.h:551

◆ loadHelper() [4/10]

template<typename P >
void loadHelper ( std::istream &  stream,
std::unique_ptr< P > &  data,
void context 
)
inline

Unique Pointer helper routine.

Definition at line 1034 of file DataIO.h.

1035 {
1036  dataLoad(stream, data, context);
1037 }
void dataLoad(std::istream &stream, T &v, void *)
Definition: DataIO.h:551

◆ loadHelper() [5/10]

template<typename P >
void loadHelper ( std::istream &  stream,
std::set< P > &  data,
void context 
)
inline

Set helper routine.

Definition at line 1042 of file DataIO.h.

1043 {
1044  dataLoad(stream, data, context);
1045 }
void dataLoad(std::istream &stream, T &v, void *)
Definition: DataIO.h:551

◆ loadHelper() [6/10]

template<typename P , typename Q >
void loadHelper ( std::istream &  stream,
std::map< P, Q > &  data,
void context 
)
inline

Map helper routine.

Definition at line 1050 of file DataIO.h.

1051 {
1052  dataLoad(stream, data, context);
1053 }
void dataLoad(std::istream &stream, T &v, void *)
Definition: DataIO.h:551

◆ loadHelper() [7/10]

template<typename P , typename Q >
void loadHelper ( std::istream &  stream,
std::unordered_map< P, Q > &  data,
void context 
)
inline

Unordered_map helper routine.

Definition at line 1058 of file DataIO.h.

1059 {
1060  dataLoad(stream, data, context);
1061 }
void dataLoad(std::istream &stream, T &v, void *)
Definition: DataIO.h:551

◆ loadHelper() [8/10]

template<typename P >
void loadHelper ( std::istream &  stream,
std::optional< P > &  data,
void context 
)
inline

Optional helper routine.

Definition at line 1066 of file DataIO.h.

1067 {
1068  dataLoad(stream, data, context);
1069 }
void dataLoad(std::istream &stream, T &v, void *)
Definition: DataIO.h:551

◆ loadHelper() [9/10]

template<typename P , typename Q >
void loadHelper ( std::istream &  stream,
HashMap< P, Q > &  data,
void context 
)
inline

Hashmap helper routine.

Definition at line 1074 of file DataIO.h.

1075 {
1076  dataLoad(stream, data, context);
1077 }
void dataLoad(std::istream &stream, T &v, void *)
Definition: DataIO.h:551

◆ loadHelper() [10/10]

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

UniqueStorage helper routine.

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 1088 of file DataIO.h.

1089 {
1090  std::size_t size;
1091  dataLoad(stream, size, nullptr);
1092  data.resize(size);
1093 
1094  for (const auto i : index_range(data))
1095  loadHelper(stream, data.pointerValue(i), context);
1096 }
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.
void resize(const std::size_t size)
Resizes the underlying vector.
void dataLoad(std::istream &stream, T &v, void *)
Definition: DataIO.h:551
void loadHelper(std::istream &stream, P &data, void *context)
Scalar helper routine.
Definition: DataIO.h:1010
auto index_range(const T &sizable)

◆ storeHelper() [1/10]

template<typename P >
void storeHelper ( std::ostream &  stream,
P &  data,
void context 
)
inline

Scalar helper routine.

Definition at line 918 of file DataIO.h.

Referenced by dataStore(), MaterialPropertyBase< T, false >::store(), storeHelper(), ReporterState< std::vector< T > >::storeInternal(), and RestartableData< std::list< T > >::storeInternal().

919 {
920  dataStore(stream, data, context);
921 }
void dataStore(std::ostream &stream, T &v, void *)
Definition: DataIO.h:183

◆ storeHelper() [2/10]

template<typename P >
void storeHelper ( std::ostream &  stream,
std::vector< P > &  data,
void context 
)
inline

Vector helper routine.

Definition at line 926 of file DataIO.h.

927 {
928  dataStore(stream, data, context);
929 }
void dataStore(std::ostream &stream, T &v, void *)
Definition: DataIO.h:183

◆ storeHelper() [3/10]

template<typename P >
void storeHelper ( std::ostream &  stream,
std::shared_ptr< P > &  data,
void context 
)
inline

Shared pointer helper routine.

Definition at line 934 of file DataIO.h.

935 {
936  dataStore(stream, data, context);
937 }
void dataStore(std::ostream &stream, T &v, void *)
Definition: DataIO.h:183

◆ storeHelper() [4/10]

template<typename P >
void storeHelper ( std::ostream &  stream,
std::unique_ptr< P > &  data,
void context 
)
inline

Unique pointer helper routine.

Definition at line 942 of file DataIO.h.

943 {
944  dataStore(stream, data, context);
945 }
void dataStore(std::ostream &stream, T &v, void *)
Definition: DataIO.h:183

◆ storeHelper() [5/10]

template<typename P >
void storeHelper ( std::ostream &  stream,
std::set< P > &  data,
void context 
)
inline

Set helper routine.

Definition at line 950 of file DataIO.h.

951 {
952  dataStore(stream, data, context);
953 }
void dataStore(std::ostream &stream, T &v, void *)
Definition: DataIO.h:183

◆ storeHelper() [6/10]

template<typename P , typename Q >
void storeHelper ( std::ostream &  stream,
std::map< P, Q > &  data,
void context 
)
inline

Map helper routine.

Definition at line 958 of file DataIO.h.

959 {
960  dataStore(stream, data, context);
961 }
void dataStore(std::ostream &stream, T &v, void *)
Definition: DataIO.h:183

◆ storeHelper() [7/10]

template<typename P , typename Q >
void storeHelper ( std::ostream &  stream,
std::unordered_map< P, Q > &  data,
void context 
)
inline

Unordered_map helper routine.

Definition at line 966 of file DataIO.h.

967 {
968  dataStore(stream, data, context);
969 }
void dataStore(std::ostream &stream, T &v, void *)
Definition: DataIO.h:183

◆ storeHelper() [8/10]

template<typename P >
void storeHelper ( std::ostream &  stream,
std::optional< P > &  data,
void context 
)
inline

Optional helper routine.

Definition at line 974 of file DataIO.h.

975 {
976  dataStore(stream, data, context);
977 }
void dataStore(std::ostream &stream, T &v, void *)
Definition: DataIO.h:183

◆ storeHelper() [9/10]

template<typename P , typename Q >
void storeHelper ( std::ostream &  stream,
HashMap< P, Q > &  data,
void context 
)
inline

HashMap helper routine.

Definition at line 982 of file DataIO.h.

983 {
984  dataStore(stream, data, context);
985 }
void dataStore(std::ostream &stream, T &v, void *)
Definition: DataIO.h:183

◆ storeHelper() [10/10]

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

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 995 of file DataIO.h.

996 {
997  std::size_t size = data.size();
998  dataStore(stream, size, nullptr);
999 
1000  for (const auto i : index_range(data))
1001  {
1002  mooseAssert(data.hasValue(i), "Data doesn't have a value");
1003  storeHelper(stream, data.pointerValue(i), context);
1004  }
1005 }
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.
std::size_t size() const
void storeHelper(std::ostream &stream, P &data, void *context)
Scalar helper routine.
Definition: DataIO.h:918
void dataStore(std::ostream &stream, T &v, void *)
Definition: DataIO.h:183
bool hasValue(const std::size_t i) const
auto index_range(const T &sizable)