16 #include "gretl/data_store.hpp"
26 class DifferentiableSolver;
28 class TimestepEstimator;
37 const FieldState& shape_disp,
const std::vector<FieldState>& states,
38 const std::vector<FieldState>& params, std::shared_ptr<StateAdvancer> advancer,
39 std::string physics_name,
const std::vector<std::string>& reaction_names = {});
53 std::vector<std::string>
stateNames()
const override;
59 std::vector<std::string>
dualNames()
const override;
89 void setAdjointLoad(std::unordered_map<std::string, const smith::FiniteElementDual&> string_to_dual)
override;
92 void setDualAdjointBcs(std::unordered_map<std::string, const smith::FiniteElementState&> string_to_bc)
override;
135 std::shared_ptr<gretl::DataStore> checkpointer_;
136 std::shared_ptr<StateAdvancer> advancer_;
138 std::vector<FieldState> initial_field_states_;
140 std::vector<FieldState> field_states_;
141 std::vector<FieldState> field_params_;
142 std::unique_ptr<FieldState>
143 field_shape_displacement_;
145 std::map<std::string, size_t> state_name_to_field_index_;
146 std::map<std::string, size_t> param_name_to_field_index_;
147 std::vector<std::string> state_names_;
148 std::vector<std::string> param_names_;
150 mutable std::vector<ReactionState> reaction_states_;
151 std::map<std::string, size_t> reaction_name_to_reaction_index_;
152 std::vector<std::string> reaction_names_;
154 std::vector<gretl::Int> milestones_;
The base interface class for a generic PDE solver.
This is the abstract base class for a generic forward solver.
virtual double time() const
Get the current forward-solution time.
const smith::Mesh & mesh() const
Returns a reference to the mesh object.
virtual int cycle() const
Get the current forward-solution cycle iteration number.
Implementation of BasePhysics which uses FieldStates and gretl to track the computational graph,...
void resetStates(int cycle=0, double time=0.0) override
overload
void reverseAdjointTimestep() override
This is an overloaded member function, provided for convenience. It differs from the above function o...
void completeSetup() override
This is an overloaded member function, provided for convenience. It differs from the above function o...
std::vector< FieldState > getFieldStates() const
Get all the current FieldStates.
void setShapeDisplacement(const FiniteElementState &s) override
This is an overloaded member function, provided for convenience. It differs from the above function o...
std::vector< std::string > parameterNames() const override
This is an overloaded member function, provided for convenience. It differs from the above function o...
std::vector< FieldState > getInitialFieldStates() const
Get all the initial FieldStates.
std::vector< FieldState > getFieldParams() const
Get all the parameter FieldStates.
FieldState getShapeDispFieldState() const
Get the shape displacement FieldState.
const FiniteElementState & adjoint(const std::string &adjoint_name) const override
This is an overloaded member function, provided for convenience. It differs from the above function o...
void setDualAdjointBcs(std::unordered_map< std::string, const smith::FiniteElementState & > string_to_bc) override
This is an overloaded member function, provided for convenience. It differs from the above function o...
std::vector< std::string > dualNames() const override
This is an overloaded member function, provided for convenience. It differs from the above function o...
FiniteElementDual computeTimestepSensitivity(size_t parameter_index) override
This is an overloaded member function, provided for convenience. It differs from the above function o...
virtual void resetAdjointStates() override
overload
void setAdjointLoad(std::unordered_map< std::string, const smith::FiniteElementDual & > string_to_dual) override
This is an overloaded member function, provided for convenience. It differs from the above function o...
const FiniteElementDual & computeTimestepShapeSensitivity() override
This is an overloaded member function, provided for convenience. It differs from the above function o...
const FiniteElementState & parameter(std::size_t parameter_index) const override
This is an overloaded member function, provided for convenience. It differs from the above function o...
DifferentiablePhysics(std::shared_ptr< Mesh > mesh, std::shared_ptr< gretl::DataStore > graph, const FieldState &shape_disp, const std::vector< FieldState > &states, const std::vector< FieldState > ¶ms, std::shared_ptr< StateAdvancer > advancer, std::string physics_name, const std::vector< std::string > &reaction_names={})
constructor
void setState(const std::string &state_name, const FiniteElementState &s) override
This is an overloaded member function, provided for convenience. It differs from the above function o...
const FiniteElementState & shapeDisplacement() const override
This is an overloaded member function, provided for convenience. It differs from the above function o...
~DifferentiablePhysics()
destructor
FiniteElementState loadCheckpointedState(const std::string &state_name, int cycle) override
This is an overloaded member function, provided for convenience. It differs from the above function o...
std::vector< FieldState > getFieldStatesAndParamStates() const
Get all the FieldStates... states first, parameters next.
virtual void advanceTimestep(double dt) override
This is an overloaded member function, provided for convenience. It differs from the above function o...
const FiniteElementState & state(const std::string &state_name) const override
This is an overloaded member function, provided for convenience. It differs from the above function o...
std::shared_ptr< StateAdvancer > getStateAdvancer() const
Get state advancer.
std::vector< ReactionState > getReactionStates() const
Get the current reactionStates.
std::vector< std::string > stateNames() const override
This is an overloaded member function, provided for convenience. It differs from the above function o...
const FiniteElementDual & dual(const std::string &dual_name) const override
This is an overloaded member function, provided for convenience. It differs from the above function o...
const std::unordered_map< std::string, const smith::FiniteElementDual & > computeInitialConditionSensitivity() const override
This is an overloaded member function, provided for convenience. It differs from the above function o...
void setParameter(const size_t parameter_index, const FiniteElementState ¶meter_state) override
This is an overloaded member function, provided for convenience. It differs from the above function o...
Class for encapsulating the dual vector space of a finite element space (i.e. the space of linear for...
Class for encapsulating the critical MFEM components of a primal finite element field.
Accelerator functionality.
gretl::State< FEFieldPtr, FEDualPtr > FieldState
typedef