https://mooseframework.inl.gov
SnapshotContainerBase.h
Go to the documentation of this file.
1 //* This file is part of the MOOSE framework
2 //* https://mooseframework.inl.gov
3 //*
4 //* All rights reserved, see COPYRIGHT for full restrictions
5 //* https://github.com/idaholab/moose/blob/master/COPYRIGHT
6 //*
7 //* Licensed under LGPL 2.1, please see LICENSE for details
8 //* https://www.gnu.org/licenses/lgpl-2.1.html
9 
10 #pragma once
11 
12 #include "GeneralReporter.h"
13 #include "libmesh/petsc_vector.h"
14 #include "libmesh/petsc_matrix.h"
15 #include "NonlinearSystemBase.h"
16 
24 {
25 public:
28 
35  class Snapshots : public UniqueStorage<NumericVector<Number>>
36  {
37  public:
38  friend class SnapshotContainerBase;
39  };
40 
41  virtual void initialSetup() override;
42  virtual void initialize() override {}
43  virtual void execute() override;
44  virtual void finalize() override {}
45 
50  const Snapshots & getSnapshots() const { return _accumulated_data; }
51 
56  const NumericVector<Number> & getSnapshot(unsigned int local_i) const;
57 
58 protected:
63  virtual std::unique_ptr<NumericVector<Number>> collectSnapshot() = 0;
64 
69 
71  const unsigned int _nonlinear_system_number;
72 };
73 
74 void dataStore(std::ostream & stream, SnapshotContainerBase::Snapshots & v, void * context);
75 void dataLoad(std::istream & stream, SnapshotContainerBase::Snapshots & v, void * context);
const Snapshots & getSnapshots() const
Return the whole snapshot container.
void dataStore(std::ostream &stream, SnapshotContainerBase::Snapshots &v, void *context)
const NumericVector< Number > & getSnapshot(unsigned int local_i) const
Return one of the stored snapshot vectors.
void dataLoad(std::istream &stream, SnapshotContainerBase::Snapshots &v, void *context)
virtual void finalize() override
Snapshots & _accumulated_data
Dynamic container for snapshot vectors.
static InputParameters validParams()
Base class for storing and managing numerical data like solutions, residuals, and Jacobians...
Storage for the snapshots.
SnapshotContainerBase(const InputParameters &parameters)
virtual void initialize() override
static const std::string v
Definition: NS.h:84
virtual void initialSetup() override
virtual void execute() override
const InputParameters & parameters() const
const unsigned int _nonlinear_system_number
The nonlinear system&#39;s number whose solution shall be collected.
virtual std::unique_ptr< NumericVector< Number > > collectSnapshot()=0
Clone the current snapshot vector.