https://mooseframework.inl.gov
Loading...
Searching...
No Matches
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{
25public:
28
35 class Snapshots : public UniqueStorage<NumericVector<Number>>
36 {
37 public:
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
58protected:
63 virtual std::unique_ptr<NumericVector<Number>> collectSnapshot() = 0;
64
69
71 const unsigned int _nonlinear_system_number;
72};
73
74void dataStore(std::ostream & stream, SnapshotContainerBase::Snapshots & v, void * context);
75void dataLoad(std::istream & stream, SnapshotContainerBase::Snapshots & v, void * context);
const double v
void dataLoad(std::istream &stream, SnapshotContainerBase::Snapshots &v, void *context)
void dataStore(std::ostream &stream, SnapshotContainerBase::Snapshots &v, void *context)
const InputParameters & parameters() const
Base class for storing and managing numerical data like solutions, residuals, and Jacobians.
virtual void execute() override
virtual void initialize() override
const Snapshots & getSnapshots() const
Return the whole snapshot container.
static InputParameters validParams()
virtual void finalize() override
Snapshots & _accumulated_data
Dynamic container for snapshot vectors.
const unsigned int _nonlinear_system_number
The nonlinear system's number whose solution shall be collected.
virtual std::unique_ptr< NumericVector< Number > > collectSnapshot()=0
Clone the current snapshot vector.
const NumericVector< Number > & getSnapshot(unsigned int local_i) const
Return one of the stored snapshot vectors.
virtual void initialSetup() override