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;
65 bool allocate_local_matrices =
true);
540 typedef std::map<const NumericVector<Number> *, std::pair<DenseVector<Number>, std::vector<DenseSubVector<Number>>>>::iterator
localized_vectors_iterator;
571 std::map<const NumericVector<Number> *, std::pair<DenseVector<Number>, std::vector<DenseSubVector<Number>>>>
_localized_vectors;
672 #endif // LIBMESH_DIFF_CONTEXT_H std::vector< std::vector< dof_id_type > > _dof_indices_var
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...
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 get_elem_solution_derivative() const
The derivative of the current elem_solution w.r.t.
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. ...
const DenseMatrix< Number > & get_elem_jacobian() const
Const accessor for element Jacobian.
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::vector< Number > _elem_qoi
Element quantity of interest contributions.
Real fixed_solution_derivative
The derivative of elem_fixed_solution with respect to the nonlinear solution, for use by systems cons...
std::vector< DenseSubVector< Number > > _elem_fixed_subsolutions
This class provides all data required for a physics package (e.g.
DenseVector< Number > & get_elem_residual()
Non-const accessor for element residual.
std::vector< DenseSubVector< Number > > _elem_subsolution_accels
const DenseVector< Number > & get_elem_fixed_solution() const
Accessor for element fixed solution.
DenseVector< Number > _elem_fixed_solution
Element by element components of nonlinear_solution at a fixed point in a timestep, for optional use by e.g.
const DenseVector< Number > & get_elem_solution_rate() const
Accessor for element solution rate of change w.r.t.
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...
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...
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...
const DenseSubVector< Number > & get_elem_solution(unsigned int var) const
Accessor for element solution of a particular variable corresponding to the variable index argument...
unsigned int n_dof_indices() const
Total number of dof indices on the element.
DenseSubVector< Number > & get_elem_solution_rate(unsigned int var)
Accessor for element solution rate for a particular variable corresponding to the variable index argu...
std::vector< DenseVector< Number > > _elem_qoi_derivative
Element quantity of interest derivative contributions.
DenseVector< Number > & get_elem_solution_accel()
Non-const accessor for element solution accel of change w.r.t.
DenseMatrix< Number > _elem_jacobian
Element jacobian: derivatives of elem_residual with respect to elem_solution.
Real * _deltat
Defaults to nullptr, can optionally be used to point to a timestep value in the System-derived class ...
std::vector< std::vector< DenseSubVector< Number > > > _elem_qoi_subderivatives
The libMesh namespace provides an interface to certain functionality in the library.
bool is_adjoint() const
Accessor for querying whether we need to do a primal or adjoint solve.
DenseMatrix< Number > & get_elem_jacobian()
Non-const accessor for element Jacobian.
virtual void elem_reinit(Real)
Gives derived classes the opportunity to reinitialize data (FE objects in FEMSystem, for example) needed for an interior integration at a new point within a timestep.
std::vector< dof_id_type > _dof_indices
Global Degree of freedom index lists.
const bool _have_local_matrices
Whether we have local matrices allocated/initialized.
Defines a dense subvector for use in finite element computations.
virtual ~DiffContext()
Destructor.
std::vector< DenseSubVector< Number > > _elem_subsolution_rates
std::vector< DenseVector< Number > > & get_qoi_derivatives()
Non-const accessor for QoI derivatives.
void add_localized_vector(NumericVector< Number > &localized_vector, const System &sys)
Adds a vector to the map of localized vectors.
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...
DenseVector< Number > & get_elem_fixed_solution()
Non-const accessor for element fixed solution.
Real get_fixed_solution_derivative() const
The derivative of the current fixed_elem_solution w.r.t.
Real elem_solution_rate_derivative
The derivative of elem_solution_rate with respect to the current nonlinear solution, for use by systems with non default mass_residual terms.
const DenseVector< Number > & get_elem_solution() const
Accessor for element solution.
DenseSubVector< Number > & get_elem_residual(unsigned int var)
Non-const accessor for element residual of a particular variable corresponding to the variable index ...
const System & get_system() const
Accessor for associated system.
std::vector< Number > & get_qois()
Non-const accessor for QoI vector.
Manages consistently variables, degrees of freedom, and coefficient vectors.
bool & is_adjoint()
Accessor for setting whether we need to do a primal or adjoint solve.
DenseSubVector< Number > & get_elem_fixed_solution(unsigned int var)
Accessor for element fixed solution of a particular variable corresponding to the variable index argu...
Defines a dense submatrix for use in Finite Element-type computations.
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...
Real elem_solution_derivative
The derivative of elem_solution with respect to the current nonlinear solution.
const System & _system
A reference to the system this context is constructed with.
DenseVector< Number > & get_elem_solution_rate()
Non-const accessor for element solution rate of change w.r.t.
const std::vector< dof_id_type > & get_dof_indices() const
Accessor for element dof indices.
void set_time(Real time_in)
Set the time for which the current nonlinear_solution is defined.
std::map< const NumericVector< Number > *, std::pair< DenseVector< Number >, std::vector< DenseSubVector< Number > > > >::iterator localized_vectors_iterator
Typedef for the localized_vectors iterator.
std::map< const NumericVector< Number > *, std::pair< DenseVector< Number >, std::vector< 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 Real system_time
This is the time stored in the System class at the time this context was created, i...
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...
Real get_system_time() const
Accessor for the time variable stored in the system class.
std::vector< DenseSubVector< Number > > _elem_subsolutions
Real get_elem_solution_accel_derivative() const
The derivative of the current elem_solution_accel w.r.t.
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 DenseVector< Number > & get_elem_residual() const
Const accessor for element residual.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
std::vector< dof_id_type > & get_dof_indices()
Non-const accessor for element dof indices.
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...
virtual void elem_side_reinit(Real)
Gives derived classes the opportunity to reinitialize data needed for a side integration at a new poi...
std::vector< std::vector< DenseSubMatrix< Number > > > _elem_subjacobians
const DenseVector< Number > & get_elem_solution_accel() const
Accessor for element solution accel of change w.r.t.
Real get_elem_solution_rate_derivative() const
The derivative of the current elem_solution_rate w.r.t.
DenseVector< Number > _elem_residual
Element residual vector.
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...
DenseVector< Number > & get_localized_vector(const NumericVector< Number > &localized_vector)
Return a reference to DenseVector localization of localized_vector contained in the _localized_vector...
void set_deltat_pointer(Real *dt)
Points the _deltat member of this class at a timestep value stored in the creating System...
DiffContext(const System &, bool allocate_local_matrices=true)
Constructor.
Real get_time() const
Accessor for the time for which the current nonlinear_solution is defined.
bool _is_adjoint
Is this context to be used for a primal or adjoint solve?
DenseSubVector< Number > & get_elem_solution(unsigned int var)
Accessor for element solution of a particular variable corresponding to the variable index argument...
DenseVector< Number > _elem_solution_accel
Element by element components of du/dt as adjusted by a time_solver.
unsigned int n_vars() const
Number of variables in solution.
const std::vector< DenseVector< Number > > & get_qoi_derivatives() const
Const accessor for QoI derivatives.
Real elem_solution_accel_derivative
The derivative of elem_solution_accel with respect to the current nonlinear solution, for use by systems with non default mass_residual terms.
DenseVector< Number > & get_elem_solution()
Non-const accessor for element solution.
std::vector< DenseSubVector< Number > > _elem_subresiduals
Element residual subvectors and (if _have_local_matrices) Jacobian submatrices.
Real time
For time-dependent problems, this is the time t for which the current nonlinear_solution is defined...
virtual void nonlocal_reinit(Real)
Gives derived classes the opportunity to reinitialize data needed for nonlocal calculations at a new ...
DenseVector< Number > _elem_solution_rate
Element by element components of du/dt as adjusted by a time_solver.