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<>
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, RealEigenVector &v, void *context)
 
template<>
void dataStore (std::ostream &stream, RealEigenMatrix &v, 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<>
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, RealEigenVector &v, void *context)
 
template<>
void dataLoad (std::istream &stream, RealEigenMatrix &v, 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/45]

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

Definition at line 540 of file DataIO.h.

Referenced by dataLoad(), and loadHelper().

541 {
542  stream.read((char *)&v, sizeof(v));
543  mooseAssert(!stream.bad(), "Failed to load");
544 }

◆ dataLoad() [2/45]

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

Definition at line 548 of file DataIO.h.

549 {
550  mooseError("Attempting to load a raw pointer type: \"",
551  libMesh::demangle(typeid(T).name()),
552  " *\" as restartable data!\nWrite a custom dataLoad() template specialization!\n\n");
553 }
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:302
std::string demangle(const char *name)

◆ dataLoad() [3/45]

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

Definition at line 557 of file DataIO.h.

558 {
559  loadHelper(stream, p.first, context);
560  loadHelper(stream, p.second, context);
561 }
void loadHelper(std::istream &stream, P &data, void *context)
Scalar helper routine.
Definition: DataIO.h:985

◆ dataLoad() [4/45]

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

Definition at line 565 of file DataIO.h.

566 {
567  // First read the size of the vector
568  unsigned int size = 0;
569  dataLoad(stream, size, nullptr);
570 
571  v.resize(size);
572 
573  for (unsigned int i = 0; i < size; i++)
574  loadHelper(stream, v[i], context);
575 }
void dataLoad(std::istream &stream, T &v, void *)
Definition: DataIO.h:540
void loadHelper(std::istream &stream, P &data, void *context)
Scalar helper routine.
Definition: DataIO.h:985

◆ dataLoad() [5/45]

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

Definition at line 579 of file DataIO.h.

580 {
581  T * tmp = v.get();
582 
583  loadHelper(stream, tmp, context);
584 }
void loadHelper(std::istream &stream, P &data, void *context)
Scalar helper routine.
Definition: DataIO.h:985

◆ dataLoad() [6/45]

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

Definition at line 588 of file DataIO.h.

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

◆ dataLoad() [7/45]

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

Definition at line 597 of file DataIO.h.

598 {
599  // First read the size of the set
600  unsigned int size = 0;
601  dataLoad(stream, size, nullptr);
602 
603  for (unsigned int i = 0; i < size; i++)
604  {
605  T data;
606  loadHelper(stream, data, context);
607  s.insert(std::move(data));
608  }
609 }
void dataLoad(std::istream &stream, T &v, void *)
Definition: DataIO.h:540
void loadHelper(std::istream &stream, P &data, void *context)
Scalar helper routine.
Definition: DataIO.h:985

◆ dataLoad() [8/45]

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

Definition at line 613 of file DataIO.h.

614 {
615  // First read the size of the set
616  unsigned int size = 0;
617  dataLoad(stream, size, nullptr);
618 
619  for (unsigned int i = 0; i < size; i++)
620  {
621  T data;
622  loadHelper(stream, data, context);
623  l.push_back(std::move(data));
624  }
625 }
void dataLoad(std::istream &stream, T &v, void *)
Definition: DataIO.h:540
void loadHelper(std::istream &stream, P &data, void *context)
Scalar helper routine.
Definition: DataIO.h:985

◆ dataLoad() [9/45]

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

Definition at line 629 of file DataIO.h.

630 {
631  // First read the size of the container
632  unsigned int size = 0;
633  dataLoad(stream, size, nullptr);
634 
635  for (unsigned int i = 0; i < size; i++)
636  {
637  T data;
638  loadHelper(stream, data, context);
639  l.push_back(std::move(data));
640  }
641 }
void dataLoad(std::istream &stream, T &v, void *)
Definition: DataIO.h:540
void loadHelper(std::istream &stream, P &data, void *context)
Scalar helper routine.
Definition: DataIO.h:985

◆ dataLoad() [10/45]

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

Definition at line 645 of file DataIO.h.

646 {
647  m.clear();
648 
649  // First read the size of the map
650  unsigned int size = 0;
651  dataLoad(stream, size, nullptr);
652 
653  for (unsigned int i = 0; i < size; i++)
654  {
655  T key;
656  loadHelper(stream, key, context);
657 
658  U & value = m[key];
659  loadHelper(stream, value, context);
660  }
661 }
Real value(unsigned n, unsigned alpha, unsigned beta, Real x)
void dataLoad(std::istream &stream, T &v, void *)
Definition: DataIO.h:540
void loadHelper(std::istream &stream, P &data, void *context)
Scalar helper routine.
Definition: DataIO.h:985

◆ dataLoad() [11/45]

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

Definition at line 665 of file DataIO.h.

666 {
667  m.clear();
668 
669  // First read the size of the map
670  unsigned int size = 0;
671  dataLoad(stream, size, nullptr);
672 
673  for (unsigned int i = 0; i < size; i++)
674  {
675  T key;
676  loadHelper(stream, key, context);
677 
678  U & value = m[key];
679  loadHelper(stream, value, context);
680  }
681 }
Real value(unsigned n, unsigned alpha, unsigned beta, Real x)
void dataLoad(std::istream &stream, T &v, void *)
Definition: DataIO.h:540
void loadHelper(std::istream &stream, P &data, void *context)
Scalar helper routine.
Definition: DataIO.h:985

◆ dataLoad() [12/45]

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

Definition at line 685 of file DataIO.h.

686 {
687  s.clear();
688 
689  // First read the size of the set
690  std::size_t size = 0;
691  dataLoad(stream, size, nullptr);
692  s.reserve(size);
693 
694  for (std::size_t i = 0; i < size; i++)
695  {
696  T element;
697  dataLoad(stream, element, context);
698  s.insert(element);
699  }
700 }
void dataLoad(std::istream &stream, T &v, void *)
Definition: DataIO.h:540

◆ dataLoad() [13/45]

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

Definition at line 704 of file DataIO.h.

705 {
706  bool has_value;
707  dataLoad(stream, has_value, nullptr);
708 
709  if (has_value)
710  {
711  m = T{};
712  loadHelper(stream, *m, context);
713  }
714  else
715  m.reset();
716 }
void dataLoad(std::istream &stream, T &v, void *)
Definition: DataIO.h:540
void loadHelper(std::istream &stream, P &data, void *context)
Scalar helper routine.
Definition: DataIO.h:985

◆ dataLoad() [14/45]

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

Definition at line 720 of file DataIO.h.

721 {
722  // First read the size of the map
723  unsigned int size = 0;
724  dataLoad(stream, size, nullptr);
725 
726  for (unsigned int i = 0; i < size; i++)
727  {
728  T key;
729  loadHelper(stream, key, context);
730 
731  U & value = m[key];
732  loadHelper(stream, value, context);
733  }
734 }
Real value(unsigned n, unsigned alpha, unsigned beta, Real x)
void dataLoad(std::istream &stream, T &v, void *)
Definition: DataIO.h:540
void loadHelper(std::istream &stream, P &data, void *context)
Scalar helper routine.
Definition: DataIO.h:985

◆ dataLoad() [15/45]

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

Definition at line 372 of file DataIO.C.

Referenced by dataLoad().

373 {
374  stream.read((char *)&v, sizeof(v));
375 }

◆ dataLoad() [16/45]

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

Definition at line 379 of file DataIO.C.

380 {
381  // Read the size of the string
382  unsigned int size = 0;
383  stream.read((char *)&size, sizeof(size));
384 
385  // Resize the string data
386  v.resize(size);
387 
388  // Read the string
389  stream.read(&v[0], sizeof(char) * size);
390 }

◆ dataLoad() [17/45]

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

Definition at line 394 of file DataIO.C.

395 {
396  auto & name = static_cast<std::string &>(v);
397  dataLoad(stream, name, context);
398 }
std::string name(const ElemQuality q)
void dataLoad(std::istream &stream, Real &v, void *)
Definition: DataIO.C:372

◆ dataLoad() [18/45]

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

Definition at line 402 of file DataIO.C.

403 {
404  auto & name = static_cast<std::string &>(v);
405  dataLoad(stream, name, context);
406 }
std::string name(const ElemQuality q)
void dataLoad(std::istream &stream, Real &v, void *)
Definition: DataIO.C:372

◆ dataLoad() [19/45]

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

Definition at line 410 of file DataIO.C.

411 {
412  stream.read((char *)&v, sizeof(v));
413 }

◆ dataLoad() [20/45]

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

Definition at line 417 of file DataIO.C.

418 {
419  for (bool b : v)
420  dataLoad(stream, b, context);
421 }
void dataLoad(std::istream &stream, Real &v, void *)
Definition: DataIO.C:372

◆ dataLoad() [21/45]

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

◆ dataLoad() [22/45]

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

◆ dataLoad() [23/45]

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

◆ dataLoad() [24/45]

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

◆ dataLoad() [25/45]

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

Definition at line 526 of file DataIO.C.

527 {
528  size_t s_size = 0;
529  stream.read((char *)&s_size, sizeof(s_size));
530 
531  std::unique_ptr<char[]> s_s = std::make_unique<char[]>(s_size);
532  stream.read(s_s.get(), s_size);
533 
534  // Clear the stringstream before loading new data into it.
535  s.str(std::string());
536  s.write(s_s.get(), s_size);
537 }

◆ dataLoad() [26/45]

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

Definition at line 425 of file DataIO.C.

426 {
427  dataLoad(stream, dn.value(), context);
428 
429  if (ADReal::do_derivatives)
430  {
431  auto & derivatives = dn.derivatives();
432  std::size_t size = 0;
433  stream.read((char *)&size, sizeof(size));
434  derivatives.resize(size);
435 
436  for (MooseIndex(derivatives) i = 0; i < derivatives.size(); ++i)
437  {
438  dataLoad(stream, derivatives.raw_index(i), context);
439  dataLoad(stream, derivatives.raw_at(i), context);
440  }
441  }
442 }
void dataLoad(std::istream &stream, Real &v, void *)
Definition: DataIO.C:372

◆ dataLoad() [27/45]

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

◆ dataLoad() [28/45]

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

◆ dataLoad() [29/45]

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

Definition at line 640 of file DataIO.C.

641 {
642  p.clear();
643 
644  // First read the size of the map
645  unsigned int size = 0;
646  stream.read((char *)&size, sizeof(size));
647 
648  for (unsigned int i = 0; i < size; i++)
649  {
650  std::string key, type;
651  loadHelper(stream, key, context);
652  loadHelper(stream, type, context);
653 
654 #define loadscalar(ptype) \
655  else if (type == demangle(typeid(ptype).name())) do \
656  { \
657  ptype & value = p.set<ptype>(key); \
658  loadHelper(stream, value, context); \
659  } \
660  while (0)
661 
662  if (false)
663  ;
664  loadscalar(Real);
665  loadscalar(short);
666  loadscalar(int);
667  loadscalar(long);
668  loadscalar(unsigned short);
669  loadscalar(unsigned int);
670  loadscalar(unsigned long);
671 
672 #undef loadscalar
673  }
674 }
virtual void clear()
void loadHelper(std::istream &stream, P &data, void *context)
Scalar helper routine.
Definition: DataIO.h:985

◆ dataLoad() [30/45]

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

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

Definition at line 793 of file DataIO.h.

794 {
795  for (std::size_t i = 0; i < N; ++i)
796  dataLoad(stream, dn[i], context);
797 }
void dataLoad(std::istream &stream, T &v, void *)
Definition: DataIO.h:540

◆ dataLoad() [32/45]

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

Definition at line 801 of file DataIO.h.

802 {
803  for (std::size_t i = 0; i < N; ++i)
804  dataLoad(stream, dn[i], context);
805 }
void dataLoad(std::istream &stream, T &v, void *)
Definition: DataIO.h:540

◆ dataLoad() [33/45]

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

Definition at line 809 of file DataIO.h.

810 {
811  numeric_index_type size = v.local_size();
812  for (numeric_index_type i = v.first_local_index(); i < v.first_local_index() + size; i++)
813  {
814  T r = 0;
815  dataLoad(stream, r, context);
816  v.set(i, r);
817  }
818  v.close();
819 }
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:540

◆ dataLoad() [34/45]

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

Definition at line 727 of file DataIO.C.

728 {
729  PetscInt local_size;
730  LibmeshPetscCallA(PETSC_COMM_WORLD, VecGetLocalSize(v, &local_size));
731  PetscScalar * array;
732  LibmeshPetscCallA(PETSC_COMM_WORLD, VecGetArray(v, &array));
733  for (PetscInt i = 0; i < local_size; i++)
734  dataLoad(stream, array[i], context);
735 
736  LibmeshPetscCallA(PETSC_COMM_WORLD, VecRestoreArray(v, &array));
737 }
void dataLoad(std::istream &stream, Real &v, void *)
Definition: DataIO.C:372

◆ dataLoad() [35/45]

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

Definition at line 826 of file DataIO.h.

827 {
828  unsigned int n = 0;
829  dataLoad(stream, n, nullptr);
830  v.resize(n);
831  for (unsigned int i = 0; i < n; i++)
832  {
833  T r = 0;
834  dataLoad(stream, r, context);
835  v(i) = r;
836  }
837 }
void dataLoad(std::istream &stream, T &v, void *)
Definition: DataIO.h:540

◆ dataLoad() [36/45]

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

Definition at line 574 of file DataIO.C.

575 {
576  // Obviously if someone loads data with different LIBMESH_DIM than was used for saving them, it
577  // won't work.
578  for (const auto i : make_range(Moose::dim))
579  for (const auto j : make_range(Moose::dim))
580  {
581  T r = 0;
582  dataLoad(stream, r, context);
583  v(i, j) = r;
584  }
585 }
static constexpr std::size_t dim
This is the dimension of all vector and tensor datastructures used in MOOSE.
Definition: Moose.h:153
void dataLoad(std::istream &stream, Real &v, void *)
Definition: DataIO.C:372
IntRange< T > make_range(T beg, T end)

◆ dataLoad() [37/45]

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

Definition at line 592 of file DataIO.C.

593 {
594  unsigned int m = 0, n = 0;
595  stream.read((char *)&m, sizeof(m));
596  stream.read((char *)&n, sizeof(n));
597  v.resize(m, n);
598  for (unsigned int i = 0; i < m; i++)
599  for (unsigned int j = 0; j < n; j++)
600  {
601  T r = 0;
602  dataLoad(stream, r, context);
603  v(i, j) = r;
604  }
605 }
void dataLoad(std::istream &stream, Real &v, void *)
Definition: DataIO.C:372
void resize(const unsigned int new_m, const unsigned int new_n)

◆ dataLoad() [38/45]

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

Definition at line 612 of file DataIO.C.

613 {
614  // Obviously if someone loads data with different LIBMESH_DIM than was used for saving them, it
615  // won't work.
616  for (const auto i : make_range(Moose::dim))
617  {
618  T r = 0;
619  dataLoad(stream, r, context);
620  v(i) = r;
621  }
622 }
static constexpr std::size_t dim
This is the dimension of all vector and tensor datastructures used in MOOSE.
Definition: Moose.h:153
void dataLoad(std::istream &stream, Real &v, void *)
Definition: DataIO.C:372
IntRange< T > make_range(T beg, T end)

◆ dataLoad() [39/45]

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

Definition at line 850 of file DataIO.h.

851 {
852  dataLoad(stream, rtt._coords, context);
853 }
T _coords[LIBMESH_DIM *LIBMESH_DIM]
void dataLoad(std::istream &stream, T &v, void *)
Definition: DataIO.h:540

◆ dataLoad() [40/45]

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

Definition at line 857 of file DataIO.h.

858 {
859  dataLoad(stream, rtt._vals, context);
860 }
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:540

◆ dataLoad() [41/45]

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

Definition at line 864 of file DataIO.h.

865 {
866  dataLoad(stream, rft._vals, context);
867 }
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:540

◆ dataLoad() [42/45]

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

Definition at line 871 of file DataIO.h.

872 {
873  dataLoad(stream, rtt._vals, context);
874 }
void dataLoad(std::istream &stream, T &v, void *)
Definition: DataIO.h:540

◆ dataLoad() [43/45]

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

Definition at line 878 of file DataIO.h.

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

◆ dataLoad() [44/45]

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

Definition at line 885 of file DataIO.h.

886 {
887  dataLoad(stream, cmm._values, context);
888 }
std::vector< T > _values
void dataLoad(std::istream &stream, T &v, void *)
Definition: DataIO.h:540

◆ dataLoad() [45/45]

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

◆ dataStore() [1/45]

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  // Moose::out<<"Generic dataStore"<<std::endl;
196  stream.write((char *)&v, sizeof(v));
197  mooseAssert(!stream.bad(), "Failed to store");
198 }

◆ dataStore() [2/45]

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

Definition at line 202 of file DataIO.h.

203 {
204  mooseError("Attempting to store a raw pointer type: \"",
205  libMesh::demangle(typeid(T).name()),
206  " *\" as restartable data!\nWrite a custom dataStore() template specialization!\n\n");
207 }
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:302
std::string demangle(const char *name)

◆ dataStore() [3/45]

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

◆ dataStore() [4/45]

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

Definition at line 213 of file DataIO.h.

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

◆ dataStore() [5/45]

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

Definition at line 221 of file DataIO.h.

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

◆ dataStore() [6/45]

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

Definition at line 233 of file DataIO.h.

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

◆ dataStore() [7/45]

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

Definition at line 242 of file DataIO.h.

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

◆ dataStore() [8/45]

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

Definition at line 251 of file DataIO.h.

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

◆ dataStore() [9/45]

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

Definition at line 269 of file DataIO.h.

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

◆ dataStore() [10/45]

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

Definition at line 287 of file DataIO.h.

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

◆ dataStore() [11/45]

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

Definition at line 305 of file DataIO.h.

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

◆ dataStore() [12/45]

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

Definition at line 326 of file DataIO.h.

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

◆ dataStore() [13/45]

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

Definition at line 347 of file DataIO.h.

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

◆ dataStore() [14/45]

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

Definition at line 359 of file DataIO.h.

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

◆ dataStore() [15/45]

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

Definition at line 370 of file DataIO.h.

371 {
372  // First store the size of the map
373  unsigned int size = m.size();
374  dataStore(stream, size, nullptr);
375 
376  typename HashMap<T, U>::iterator it = m.begin();
377  typename HashMap<T, U>::iterator end = m.end();
378 
379  for (; it != end; ++it)
380  {
381  T & key = const_cast<T &>(it->first);
382 
383  storeHelper(stream, key, context);
384 
385  storeHelper(stream, it->second, context);
386  }
387 }
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:893
void dataStore(std::ostream &stream, T &v, void *)
Definition: DataIO.h:183

◆ dataStore() [16/45]

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() [17/45]

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() [18/45]

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() [19/45]

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() [20/45]

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() [21/45]

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() [22/45]

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

◆ dataStore() [23/45]

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

◆ dataStore() [24/45]

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

◆ dataStore() [25/45]

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

◆ dataStore() [26/45]

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() [27/45]

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() [28/45]

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

◆ dataStore() [29/45]

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

◆ dataStore() [30/45]

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

Definition at line 287 of file DataIO.C.

288 {
289  // First store the size of the map
290  unsigned int size = p.n_parameters();
291  stream.write((char *)&size, sizeof(size));
292 
293  auto it = p.begin();
294  auto end = p.end();
295 
296  for (; it != end; ++it)
297  {
298  auto & key = const_cast<std::string &>(it->first);
299  auto type = it->second->type();
300 
301  storeHelper(stream, key, context);
302  storeHelper(stream, type, context);
303 
304 #define storescalar(ptype) \
305  else if (it->second->type() == demangle(typeid(ptype).name())) storeHelper( \
306  stream, \
307  (dynamic_cast<libMesh::Parameters::Parameter<ptype> *>(MooseUtils::get(it->second)))->get(), \
308  context)
309 
310  if (false)
311  ;
312  storescalar(Real);
313  storescalar(short);
314  storescalar(int);
315  storescalar(long);
316  storescalar(unsigned short);
317  storescalar(unsigned int);
318  storescalar(unsigned long);
319 
320 #undef storescalar
321  }
322 }
void storeHelper(std::ostream &stream, P &data, void *context)
Scalar helper routine.
Definition: DataIO.h:893
std::size_t n_parameters() const

◆ dataStore() [31/45]

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() [32/45]

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

Definition at line 440 of file DataIO.h.

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

◆ dataStore() [33/45]

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

Definition at line 448 of file DataIO.h.

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

◆ dataStore() [34/45]

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

Definition at line 456 of file DataIO.h.

457 {
458  v.close();
459 
460  numeric_index_type size = v.local_size();
461 
462  for (numeric_index_type i = v.first_local_index(); i < v.first_local_index() + size; i++)
463  {
464  T r = v(i);
465  dataStore(stream, r, context);
466  }
467 }
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() [35/45]

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

Definition at line 741 of file DataIO.C.

742 {
743  PetscInt local_size;
744  LibmeshPetscCallA(PETSC_COMM_WORLD, VecGetLocalSize(v, &local_size));
745  PetscScalar * array;
746  LibmeshPetscCallA(PETSC_COMM_WORLD, VecGetArray(v, &array));
747  for (PetscInt i = 0; i < local_size; i++)
748  dataStore(stream, array[i], context);
749 
750  LibmeshPetscCallA(PETSC_COMM_WORLD, VecRestoreArray(v, &array));
751 }
void dataStore(std::ostream &stream, Real &v, void *)
Definition: DataIO.C:28

◆ dataStore() [36/45]

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

Definition at line 474 of file DataIO.h.

475 {
476  unsigned int m = v.size();
477  dataStore(stream, m, nullptr);
478  for (unsigned int i = 0; i < v.size(); i++)
479  {
480  T r = v(i);
481  dataStore(stream, r, context);
482  }
483 }
void dataStore(std::ostream &stream, T &v, void *)
Definition: DataIO.h:183

◆ dataStore() [37/45]

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

Definition at line 227 of file DataIO.C.

228 {
229  for (const auto i : make_range(Moose::dim))
230  for (const auto j : make_range(Moose::dim))
231  {
232  T r = v(i, j);
233  dataStore(stream, r, context);
234  }
235 }
static constexpr std::size_t dim
This is the dimension of all vector and tensor datastructures used in MOOSE.
Definition: Moose.h:153
IntRange< T > make_range(T beg, T end)
void dataStore(std::ostream &stream, Real &v, void *)
Definition: DataIO.C:28

◆ dataStore() [38/45]

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

Definition at line 242 of file DataIO.C.

243 {
244  unsigned int m = v.m();
245  unsigned int n = v.n();
246  stream.write((char *)&m, sizeof(m));
247  stream.write((char *)&n, sizeof(n));
248  for (unsigned int i = 0; i < m; i++)
249  for (unsigned int j = 0; j < n; j++)
250  {
251  T r = v(i, j);
252  dataStore(stream, r, context);
253  }
254 }
unsigned int m() const
unsigned int n() const
void dataStore(std::ostream &stream, Real &v, void *)
Definition: DataIO.C:28

◆ dataStore() [39/45]

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

Definition at line 261 of file DataIO.C.

262 {
263  // Obviously if someone loads data with different LIBMESH_DIM than was used for saving them, it
264  // won't work.
265  for (const auto i : make_range(Moose::dim))
266  {
267  T r = v(i);
268  dataStore(stream, r, context);
269  }
270 }
static constexpr std::size_t dim
This is the dimension of all vector and tensor datastructures used in MOOSE.
Definition: Moose.h:153
IntRange< T > make_range(T beg, T end)
void dataStore(std::ostream &stream, Real &v, void *)
Definition: DataIO.C:28

◆ dataStore() [40/45]

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

Definition at line 496 of file DataIO.h.

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

◆ dataStore() [41/45]

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

Definition at line 503 of file DataIO.h.

504 {
505  dataStore(stream, rtt._vals, context);
506 }
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() [42/45]

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

Definition at line 510 of file DataIO.h.

511 {
512  dataStore(stream, rft._vals, context);
513 }
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() [43/45]

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

Definition at line 517 of file DataIO.h.

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

◆ dataStore() [44/45]

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

Definition at line 524 of file DataIO.h.

525 {
526  dataStore(stream, srft._vals, context);
527 }
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() [45/45]

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

Definition at line 531 of file DataIO.h.

532 {
533  dataStore(stream, cmm._values, context);
534 }
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 985 of file DataIO.h.

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

986 {
987  dataLoad(stream, data, context);
988 }
void dataLoad(std::istream &stream, T &v, void *)
Definition: DataIO.h:540

◆ loadHelper() [2/10]

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

Vector helper routine.

Definition at line 993 of file DataIO.h.

994 {
995  dataLoad(stream, data, context);
996 }
void dataLoad(std::istream &stream, T &v, void *)
Definition: DataIO.h:540

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

1002 {
1003  dataLoad(stream, data, context);
1004 }
void dataLoad(std::istream &stream, T &v, void *)
Definition: DataIO.h:540

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

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

◆ loadHelper() [5/10]

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

Set helper routine.

Definition at line 1017 of file DataIO.h.

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

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

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

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

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

◆ loadHelper() [8/10]

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

Optional helper routine.

Definition at line 1041 of file DataIO.h.

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

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

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

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

1064 {
1065  std::size_t size;
1066  dataLoad(stream, size, nullptr);
1067  data.resize(size);
1068 
1069  for (const auto i : index_range(data))
1070  loadHelper(stream, data.pointerValue(i), context);
1071 }
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:540
void loadHelper(std::istream &stream, P &data, void *context)
Scalar helper routine.
Definition: DataIO.h:985
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 893 of file DataIO.h.

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

894 {
895  dataStore(stream, data, context);
896 }
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 901 of file DataIO.h.

902 {
903  dataStore(stream, data, context);
904 }
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 909 of file DataIO.h.

910 {
911  dataStore(stream, data, context);
912 }
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 917 of file DataIO.h.

918 {
919  dataStore(stream, data, context);
920 }
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 925 of file DataIO.h.

926 {
927  dataStore(stream, data, context);
928 }
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 933 of file DataIO.h.

934 {
935  dataStore(stream, data, context);
936 }
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 941 of file DataIO.h.

942 {
943  dataStore(stream, data, context);
944 }
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 949 of file DataIO.h.

950 {
951  dataStore(stream, data, context);
952 }
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 957 of file DataIO.h.

958 {
959  dataStore(stream, data, context);
960 }
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 970 of file DataIO.h.

971 {
972  std::size_t size = data.size();
973  dataStore(stream, size, nullptr);
974 
975  for (const auto i : index_range(data))
976  {
977  mooseAssert(data.hasValue(i), "Data doesn't have a value");
978  storeHelper(stream, data.pointerValue(i), context);
979  }
980 }
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:893
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)