Go to the documentation of this file.
20 #ifndef LIBMESH_DIFF_CONTEXT_H
21 #define LIBMESH_DIFF_CONTEXT_H
24 #include "libmesh/dense_matrix.h"
25 #include "libmesh/dense_submatrix.h"
26 #include "libmesh/dense_subvector.h"
27 #include "libmesh/dense_vector.h"
28 #include "libmesh/id_types.h"
40 template <
typename T>
class NumericVector;
544 typedef std::map<const NumericVector<Number> *, std::pair<DenseVector<Number>, std::vector<std::unique_ptr<DenseSubVector<Number>>>>>::iterator
localized_vectors_iterator;
575 std::map<const NumericVector<Number> *, std::pair<DenseVector<Number>, std::vector<std::unique_ptr<DenseSubVector<Number>>>>>
_localized_vectors;
670 #endif // LIBMESH_DIFF_CONTEXT_H
const System & _system
A reference to the system this context is constructed with.
const Real system_time
This is the time stored in the System class at the time this context was created, i....
Manages consistently variables, degrees of freedom, and coefficient vectors.
std::vector< std::vector< std::unique_ptr< DenseSubVector< Number > > > > _elem_qoi_subderivatives
const DenseVector< Number > & get_elem_residual() const
Const accessor for element residual.
DenseSubVector< Number > & get_localized_subvector(const NumericVector< Number > &localized_vector, unsigned int var)
Return a reference to DenseSubVector localization of localized_vector at variable var contained in th...
DiffContext(const System &)
Constructor.
Real * _deltat
Defaults to nullptr, can optionally be used to point to a timestep value in the System-derived class ...
DenseVector< Number > _elem_solution_accel
Element by element components of du/dt as adjusted by a time_solver.
const std::vector< dof_id_type > & get_dof_indices(unsigned int var) const
Accessor for element dof indices of a particular variable corresponding to the index argument.
const std::vector< dof_id_type > & get_dof_indices() const
Accessor for element dof indices.
std::vector< DenseVector< Number > > & get_qoi_derivatives()
Non-const accessor for QoI derivatives.
void set_time(Real time_in)
Set the time for which the current nonlinear_solution is defined.
virtual void elem_reinit(Real)
Gives derived classes the opportunity to reinitialize data (FE objects in FEMSystem,...
Real time
For time-dependent problems, this is the time t for which the current nonlinear_solution is defined.
Defines a dense submatrix for use in Finite Element-type computations.
DenseMatrix< Number > & get_elem_jacobian()
Non-const accessor for element Jacobian.
const DenseSubVector< Number > & get_elem_residual(unsigned int var) const
Const accessor for element residual of a particular variable corresponding to the variable index argu...
The libMesh namespace provides an interface to certain functionality in the library.
unsigned int n_vars() const
Number of variables in solution.
Real get_elem_solution_derivative() const
The derivative of the current elem_solution w.r.t.
bool is_adjoint() const
Accessor for querying whether we need to do a primal or adjoint solve.
const System & get_system() const
Accessor for associated system.
DenseSubVector< Number > & get_elem_residual(unsigned int var)
Non-const accessor for element residual of a particular variable corresponding to the variable index ...
DenseVector< Number > & get_elem_fixed_solution()
Non-const accessor for element fixed solution.
DenseVector< Number > _elem_residual
Element residual vector.
DenseVector< Number > & get_localized_vector(const NumericVector< Number > &localized_vector)
Return a reference to DenseVector localization of localized_vector contained in the _localized_vector...
std::vector< std::unique_ptr< DenseSubVector< Number > > > _elem_subsolutions
DenseVector< Number > & get_elem_residual()
Non-const accessor for element residual.
virtual void nonlocal_reinit(Real)
Gives derived classes the opportunity to reinitialize data needed for nonlocal calculations at a new ...
std::vector< std::vector< dof_id_type > > _dof_indices_var
std::map< const NumericVector< Number > *, std::pair< DenseVector< Number >, std::vector< std::unique_ptr< DenseSubVector< Number > > > > > _localized_vectors
Contains pointers to vectors the user has asked to be localized, keyed with pairs of element localize...
unsigned int n_dof_indices(unsigned int var) const
Total number of dof indices of the particular variable corresponding to the index argument.
const std::vector< Number > & get_qois() const
Const accessor for QoI vector.
DenseVector< Number > _elem_solution
Element by element components of nonlinear_solution as adjusted by a time_solver.
std::vector< std::unique_ptr< DenseSubVector< Number > > > _elem_subsolution_rates
DenseVector< Number > & get_elem_solution_rate()
Non-const accessor for element solution rate of change w.r.t.
Real elem_solution_accel_derivative
The derivative of elem_solution_accel with respect to the current nonlinear solution,...
const DenseSubVector< Number > & get_elem_solution(unsigned int var) const
Accessor for element solution of a particular variable corresponding to the variable index argument.
DenseSubVector< Number > & get_qoi_derivatives(std::size_t qoi, unsigned int var)
Non-const accessor for QoI derivative of a particular qoi and variable corresponding to the index arg...
std::map< const NumericVector< Number > *, std::pair< DenseVector< Number >, std::vector< std::unique_ptr< DenseSubVector< Number > > > > >::iterator localized_vectors_iterator
Typedef for the localized_vectors iterator.
const std::vector< DenseVector< Number > > & get_qoi_derivatives() const
Const accessor for QoI derivatives.
DenseVector< Number > & get_elem_solution_accel()
Non-const accessor for element solution accel of change w.r.t.
const DenseSubVector< Number > & get_elem_solution_accel(unsigned int var) const
Accessor for element solution accel for a particular variable corresponding to the variable index arg...
Real get_system_time() const
Accessor for the time variable stored in the system class.
bool _is_adjoint
Is this context to be used for a primal or adjoint solve?
void set_deltat_pointer(Real *dt)
Points the _deltat member of this class at a timestep value stored in the creating System,...
std::vector< std::unique_ptr< DenseSubVector< Number > > > _elem_fixed_subsolutions
DenseSubMatrix< Number > & get_elem_jacobian(unsigned int var1, unsigned int var2)
Non-const accessor for element Jacobian of particular variables corresponding to the variable index a...
const DenseSubVector< Number > & get_elem_solution_rate(unsigned int var) const
Accessor for element solution rate for a particular variable corresponding to the variable index argu...
unsigned int n_dof_indices() const
Total number of dof indices on the element.
std::vector< dof_id_type > & get_dof_indices()
Non-const accessor for element dof indices.
const DenseSubMatrix< Number > & get_elem_jacobian(unsigned int var1, unsigned int var2) const
Const accessor for element Jacobian of particular variables corresponding to the variable index argum...
bool & is_adjoint()
Accessor for setting whether we need to do a primal or adjoint solve.
DenseSubVector< Number > & get_elem_solution_accel(unsigned int var)
Accessor for element solution accel for a particular variable corresponding to the variable index arg...
Real fixed_solution_derivative
The derivative of elem_fixed_solution with respect to the nonlinear solution, for use by systems cons...
Real get_elem_solution_rate_derivative() const
The derivative of the current elem_solution_rate w.r.t.
This class provides all data required for a physics package (e.g.
const DenseSubVector< Number > & get_qoi_derivatives(std::size_t qoi, unsigned int var) const
Const accessor for QoI derivative of a particular qoi and variable corresponding to the index argumen...
const DenseSubVector< Number > & get_elem_fixed_solution(unsigned int var) const
Accessor for element fixed solution of a particular variable corresponding to the variable index argu...
DenseVector< Number > _elem_fixed_solution
Element by element components of nonlinear_solution at a fixed point in a timestep,...
std::vector< DenseVector< Number > > _elem_qoi_derivative
Element quantity of interest derivative contributions.
Real elem_solution_derivative
The derivative of elem_solution with respect to the current nonlinear solution.
std::vector< dof_id_type > _dof_indices
Global Degree of freedom index lists.
std::vector< Number > _elem_qoi
Element quantity of interest contributions.
DenseVector< Number > _elem_solution_rate
Element by element components of du/dt as adjusted by a time_solver.
Real get_fixed_solution_derivative() const
The derivative of the current fixed_elem_solution w.r.t.
std::vector< std::unique_ptr< DenseSubVector< Number > > > _elem_subresiduals
Element residual subvectors and Jacobian submatrices.
Real elem_solution_rate_derivative
The derivative of elem_solution_rate with respect to the current nonlinear solution,...
const DenseMatrix< Number > & get_elem_jacobian() const
Const accessor for element Jacobian.
const DenseVector< Number > & get_elem_solution() const
Accessor for element solution.
DenseSubVector< Number > & get_elem_solution(unsigned int var)
Accessor for element solution of a particular variable corresponding to the variable index argument.
DenseVector< Number > & get_elem_solution()
Non-const accessor for element solution.
const DenseVector< Number > & get_elem_fixed_solution() const
Accessor for element fixed solution.
std::vector< dof_id_type > & get_dof_indices(unsigned int var)
Accessor for element dof indices of a particular variable corresponding to the index argument.
virtual void elem_edge_reinit(Real)
Gives derived classes the opportunity to reinitialize data needed for an edge integration at a new po...
const DenseVector< Number > & get_elem_solution_rate() const
Accessor for element solution rate of change w.r.t.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
std::vector< std::vector< std::unique_ptr< DenseSubMatrix< Number > > > > _elem_subjacobians
virtual ~DiffContext()
Destructor.
Real get_time() const
Accessor for the time for which the current nonlinear_solution is defined.
Real get_elem_solution_accel_derivative() const
The derivative of the current elem_solution_accel w.r.t.
DenseMatrix< Number > _elem_jacobian
Element jacobian: derivatives of elem_residual with respect to elem_solution.
void add_localized_vector(NumericVector< Number > &localized_vector, const System &sys)
Adds a vector to the map of localized vectors.
std::vector< Number > & get_qois()
Non-const accessor for QoI vector.
const DenseVector< Number > & get_elem_solution_accel() const
Accessor for element solution accel of change w.r.t.
std::vector< std::unique_ptr< DenseSubVector< Number > > > _elem_subsolution_accels
virtual void elem_side_reinit(Real)
Gives derived classes the opportunity to reinitialize data needed for a side integration at a new poi...
DenseSubVector< Number > & get_elem_fixed_solution(unsigned int var)
Accessor for element fixed solution of a particular variable corresponding to the variable index argu...
DenseSubVector< Number > & get_elem_solution_rate(unsigned int var)
Accessor for element solution rate for a particular variable corresponding to the variable index argu...