libMesh
Classes | Public Types | Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | Private Member Functions | Private Attributes | List of all members
libMesh::FEMContext Class Reference

This class provides all data required for a physics package (e.g. More...

#include <fem_context.h>

Inheritance diagram for libMesh::FEMContext:
[legend]

Classes

struct  FENeeded
 Helper nested class for C++03-compatible "template typedef". More...
 

Public Types

enum  AlgebraicType {
  NONE = 0, DOFS_ONLY, CURRENT, OLD,
  OLD_DOFS_ONLY
}
 Enum describing what data to use when initializing algebraic structures on each element. More...
 
typedef 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. More...
 

Public Member Functions

 FEMContext (const System &sys)
 Constructor. More...
 
 FEMContext (const System &sys, int extra_quadrature_order)
 Constructor. More...
 
virtual ~FEMContext ()
 Destructor. More...
 
void use_default_quadrature_rules (int extra_quadrature_order=0)
 Use quadrature rules designed to over-integrate a mass matrix, plus extra_quadrature_order. More...
 
void use_unweighted_quadrature_rules (int extra_quadrature_order=0)
 Use quadrature rules designed to exactly integrate unweighted undistorted basis functions, plus extra_quadrature_order. More...
 
bool has_side_boundary_id (boundary_id_type id) const
 Reports if the boundary id is found on the current side. More...
 
std::vector< boundary_id_typeside_boundary_ids () const
 Lists the boundary ids found on the current side. More...
 
void side_boundary_ids (std::vector< boundary_id_type > &vec_to_fill) const
 As above, but fills in the std::set provided by the user. More...
 
Number interior_value (unsigned int var, unsigned int qp) const
 
Number side_value (unsigned int var, unsigned int qp) const
 
Number point_value (unsigned int var, const Point &p) const
 
Gradient interior_gradient (unsigned int var, unsigned int qp) const
 
Gradient side_gradient (unsigned int var, unsigned int qp) const
 
Gradient point_gradient (unsigned int var, const Point &p) const
 
Tensor interior_hessian (unsigned int var, unsigned int qp) const
 
Tensor side_hessian (unsigned int var, unsigned int qp) const
 
Tensor point_hessian (unsigned int var, const Point &p) const
 
Number fixed_interior_value (unsigned int var, unsigned int qp) const
 
Number fixed_side_value (unsigned int var, unsigned int qp) const
 
Number fixed_point_value (unsigned int var, const Point &p) const
 
Gradient fixed_interior_gradient (unsigned int var, unsigned int qp) const
 
Gradient fixed_side_gradient (unsigned int var, unsigned int qp) const
 
Gradient fixed_point_gradient (unsigned int var, const Point &p) const
 
Tensor fixed_interior_hessian (unsigned int var, unsigned int qp) const
 
Tensor fixed_side_hessian (unsigned int var, unsigned int qp) const
 
Tensor fixed_point_hessian (unsigned int var, const Point &p) const
 
template<typename OutputShape >
void get_element_fe (unsigned int var, FEGenericBase< OutputShape > *&fe) const
 Accessor for interior finite element object for variable var for the largest dimension in the mesh. More...
 
FEBaseget_element_fe (unsigned int var) const
 Accessor for interior finite element object for scalar-valued variable var for the largest dimension in the mesh. More...
 
template<typename OutputShape >
void get_element_fe (unsigned int var, FEGenericBase< OutputShape > *&fe, unsigned short dim) const
 Accessor for interior finite element object for variable var for dimension dim. More...
 
FEBaseget_element_fe (unsigned int var, unsigned short dim) const
 Accessor for interior finite element object for scalar-valued variable var for dimension dim. More...
 
template<typename OutputShape >
void get_side_fe (unsigned int var, FEGenericBase< OutputShape > *&fe) const
 Accessor for edge/face (2D/3D) finite element object for variable var for the largest dimension in the mesh. More...
 
FEBaseget_side_fe (unsigned int var) const
 Accessor for side finite element object for scalar-valued variable var for the largest dimension in the mesh. More...
 
template<typename OutputShape >
void get_side_fe (unsigned int var, FEGenericBase< OutputShape > *&fe, unsigned short dim) const
 Accessor for edge/face (2D/3D) finite element object for variable var for dimension dim. More...
 
FEBaseget_side_fe (unsigned int var, unsigned short dim) const
 Accessor for side finite element object for scalar-valued variable var for dimension dim. More...
 
template<typename OutputShape >
void get_edge_fe (unsigned int var, FEGenericBase< OutputShape > *&fe) const
 Accessor for edge (3D only!) finite element object for variable var. More...
 
FEBaseget_edge_fe (unsigned int var) const
 Accessor for edge (3D only!) finite element object for scalar-valued variable var. More...
 
template<typename OutputType >
void interior_value (unsigned int var, unsigned int qp, OutputType &u) const
 
template<typename OutputType >
void interior_values (unsigned int var, const NumericVector< Number > &_system_vector, std::vector< OutputType > &interior_values_vector) const
 Fills a vector of values of the _system_vector at the all the quadrature points in the current element interior. More...
 
template<typename OutputType >
void side_value (unsigned int var, unsigned int qp, OutputType &u) const
 
template<typename OutputType >
void side_values (unsigned int var, const NumericVector< Number > &_system_vector, std::vector< OutputType > &side_values_vector) const
 Fills a vector of values of the _system_vector at the all the quadrature points on the current element side. More...
 
template<typename OutputType >
void point_value (unsigned int var, const Point &p, OutputType &u, const Real tolerance=TOLERANCE) const
 
template<typename OutputType >
void interior_gradient (unsigned int var, unsigned int qp, OutputType &du) const
 
template<typename OutputType >
void interior_gradients (unsigned int var, const NumericVector< Number > &_system_vector, std::vector< OutputType > &interior_gradients_vector) const
 Fills a vector with the gradient of the solution variable var at all the quadrature points in the current element interior. More...
 
template<typename OutputType >
void side_gradient (unsigned int var, unsigned int qp, OutputType &du) const
 
template<typename OutputType >
void side_gradients (unsigned int var, const NumericVector< Number > &_system_vector, std::vector< OutputType > &side_gradients_vector) const
 Fills a vector with the gradient of the solution variable var at all the quadrature points on the current element side. More...
 
template<typename OutputType >
void point_gradient (unsigned int var, const Point &p, OutputType &grad_u, const Real tolerance=TOLERANCE) const
 
template<typename OutputType >
void interior_hessian (unsigned int var, unsigned int qp, OutputType &d2u) const
 
template<typename OutputType >
void interior_hessians (unsigned int var, const NumericVector< Number > &_system_vector, std::vector< OutputType > &d2u_vals) const
 Fills a vector of hessians of the _system_vector at the all the quadrature points in the current element interior. More...
 
template<typename OutputType >
void side_hessian (unsigned int var, unsigned int qp, OutputType &d2u) const
 
template<typename OutputType >
void side_hessians (unsigned int var, const NumericVector< Number > &_system_vector, std::vector< OutputType > &d2u_vals) const
 Fills a vector of hessians of the _system_vector at the all the quadrature points on the current element side. More...
 
template<typename OutputType >
void point_hessian (unsigned int var, const Point &p, OutputType &hess_u, const Real tolerance=TOLERANCE) const
 
template<typename OutputType >
void interior_rate (unsigned int var, unsigned int qp, OutputType &u) const
 
template<typename OutputType >
void interior_rate_gradient (unsigned int var, unsigned int qp, OutputType &u) const
 
template<typename OutputType >
void side_rate (unsigned int var, unsigned int qp, OutputType &u) const
 
template<typename OutputType >
void point_rate (unsigned int var, const Point &p, OutputType &u) const
 
template<typename OutputType >
void interior_accel (unsigned int var, unsigned int qp, OutputType &u) const
 
template<typename OutputType >
void side_accel (unsigned int var, unsigned int qp, OutputType &u) const
 
template<typename OutputType >
void point_accel (unsigned int var, const Point &p, OutputType &u) const
 
template<typename OutputType >
void fixed_interior_value (unsigned int var, unsigned int qp, OutputType &u) const
 
template<typename OutputType >
void fixed_side_value (unsigned int var, unsigned int qp, OutputType &u) const
 
template<typename OutputType >
void fixed_point_value (unsigned int var, const Point &p, OutputType &u, const Real tolerance=TOLERANCE) const
 
template<typename OutputType >
void fixed_interior_gradient (unsigned int var, unsigned int qp, OutputType &grad_u) const
 
template<typename OutputType >
void fixed_side_gradient (unsigned int var, unsigned int qp, OutputType &grad_u) const
 
template<typename OutputType >
void fixed_point_gradient (unsigned int var, const Point &p, OutputType &grad_u, const Real tolerance=TOLERANCE) const
 
template<typename OutputType >
void fixed_interior_hessian (unsigned int var, unsigned int qp, OutputType &hess_u) const
 
template<typename OutputType >
void fixed_side_hessian (unsigned int var, unsigned int qp, OutputType &hess_u) const
 
template<typename OutputType >
void fixed_point_hessian (unsigned int var, const Point &p, OutputType &hess_u, const Real tolerance=TOLERANCE) const
 
template<typename OutputType >
void interior_curl (unsigned int var, unsigned int qp, OutputType &curl_u) const
 
template<typename OutputType >
void point_curl (unsigned int var, const Point &p, OutputType &curl_u, const Real tolerance=TOLERANCE) const
 
template<typename OutputType >
void interior_div (unsigned int var, unsigned int qp, OutputType &div_u) const
 
virtual void elem_reinit (Real theta) override
 Resets the current time in the context. More...
 
virtual void elem_side_reinit (Real theta) override
 Resets the current time in the context. More...
 
virtual void elem_edge_reinit (Real theta) override
 Resets the current time in the context. More...
 
virtual void nonlocal_reinit (Real theta) override
 Gives derived classes the opportunity to reinitialize data needed for nonlocal calculations at a new point within a timestep. More...
 
virtual void pre_fe_reinit (const System &, const Elem *e)
 Reinitializes local data vectors/matrices on the current geometric element. More...
 
virtual void elem_fe_reinit (const std::vector< Point > *const pts=nullptr)
 Reinitializes interior FE objects on the current geometric element. More...
 
virtual void side_fe_reinit ()
 Reinitializes side FE objects on the current geometric element. More...
 
virtual void edge_fe_reinit ()
 Reinitializes edge FE objects on the current geometric element. More...
 
const QBaseget_element_qrule () const
 Accessor for element interior quadrature rule for the dimension of the current _elem. More...
 
const QBaseget_side_qrule () const
 Accessor for element side quadrature rule for the dimension of the current _elem. More...
 
const QBaseget_element_qrule (unsigned short dim) const
 Accessor for element interior quadrature rule. More...
 
const QBaseget_side_qrule (unsigned short dim) const
 Accessor for element side quadrature rule. More...
 
const QBaseget_edge_qrule () const
 Accessor for element edge quadrature rule. More...
 
virtual void set_mesh_system (System *sys)
 Tells the FEMContext that system sys contains the isoparametric Lagrangian variables which correspond to the coordinates of mesh nodes, in problems where the mesh itself is expected to move in time. More...
 
const Systemget_mesh_system () const
 Accessor for moving mesh System. More...
 
Systemget_mesh_system ()
 Accessor for moving mesh System. More...
 
unsigned int get_mesh_x_var () const
 Accessor for x-variable of moving mesh System. More...
 
void set_mesh_x_var (unsigned int x_var)
 Accessor for x-variable of moving mesh System. More...
 
unsigned int get_mesh_y_var () const
 Accessor for y-variable of moving mesh System. More...
 
void set_mesh_y_var (unsigned int y_var)
 Accessor for y-variable of moving mesh System. More...
 
unsigned int get_mesh_z_var () const
 Accessor for z-variable of moving mesh System. More...
 
void set_mesh_z_var (unsigned int z_var)
 Accessor for z-variable of moving mesh System. More...
 
bool has_elem () const
 Test for current Elem object. More...
 
const Elemget_elem () const
 Accessor for current Elem object. More...
 
Elemget_elem ()
 Accessor for current Elem object. More...
 
unsigned char get_side () const
 Accessor for current side of Elem object. More...
 
unsigned char get_edge () const
 Accessor for current edge of Elem object. More...
 
unsigned char get_dim () const
 Accessor for cached mesh dimension. More...
 
unsigned char get_elem_dim () const
 
const std::set< unsigned char > & elem_dimensions () const
 
void elem_position_set (Real theta)
 Uses the coordinate data specified by mesh_*_position configuration to set the geometry of elem to the value it would take after a fraction theta of a timestep. More...
 
void elem_position_get ()
 Uses the geometry of elem to set the coordinate data specified by mesh_*_position configuration. More...
 
void set_algebraic_type (const AlgebraicType atype)
 Setting which determines whether to initialize algebraic structures (elem_*) on each element and set their values from current_local_solution. More...
 
AlgebraicType algebraic_type () const
 
void set_custom_solution (const NumericVector< Number > *custom_sol)
 Set a NumericVector to be used in place of current_local_solution for calculating elem_solution. More...
 
void set_jacobian_tolerance (Real tol)
 Calls set_jacobian_tolerance() on all the FE objects controlled by this class. More...
 
FEType find_hardest_fe_type ()
 Helper function for creating quadrature rules. More...
 
void attach_quadrature_rules ()
 Helper function for attaching quadrature rules. More...
 
template<typename OutputShape >
FEGenericBase< OutputShape > * build_new_fe (const FEGenericBase< OutputShape > *fe, const Point &p, const Real tolerance=TOLERANCE) const
 Helper function to reduce some code duplication in the *_point_* methods. More...
 
unsigned int n_vars () const
 Number of variables in solution. More...
 
const Systemget_system () const
 Accessor for associated system. More...
 
const DenseVector< Number > & get_elem_solution () const
 Accessor for element solution. More...
 
DenseVector< Number > & get_elem_solution ()
 Non-const accessor for element solution. More...
 
const DenseSubVector< Number > & get_elem_solution (unsigned int var) const
 Accessor for element solution of a particular variable corresponding to the variable index argument. More...
 
DenseSubVector< Number > & get_elem_solution (unsigned int var)
 Accessor for element solution of a particular variable corresponding to the variable index argument. More...
 
const DenseVector< Number > & get_elem_solution_rate () const
 Accessor for element solution rate of change w.r.t. More...
 
DenseVector< Number > & get_elem_solution_rate ()
 Non-const accessor for element solution rate of change w.r.t. More...
 
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 argument. More...
 
DenseSubVector< Number > & get_elem_solution_rate (unsigned int var)
 Accessor for element solution rate for a particular variable corresponding to the variable index argument. More...
 
const DenseVector< Number > & get_elem_solution_accel () const
 Accessor for element solution accel of change w.r.t. More...
 
DenseVector< Number > & get_elem_solution_accel ()
 Non-const accessor for element solution accel of change w.r.t. More...
 
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 argument. More...
 
DenseSubVector< Number > & get_elem_solution_accel (unsigned int var)
 Accessor for element solution accel for a particular variable corresponding to the variable index argument. More...
 
const DenseVector< Number > & get_elem_fixed_solution () const
 Accessor for element fixed solution. More...
 
DenseVector< Number > & get_elem_fixed_solution ()
 Non-const accessor for element fixed solution. More...
 
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 argument. More...
 
DenseSubVector< Number > & get_elem_fixed_solution (unsigned int var)
 Accessor for element fixed solution of a particular variable corresponding to the variable index argument. More...
 
const DenseVector< Number > & get_elem_residual () const
 Const accessor for element residual. More...
 
DenseVector< Number > & get_elem_residual ()
 Non-const accessor for element residual. More...
 
const DenseSubVector< Number > & get_elem_residual (unsigned int var) const
 Const accessor for element residual of a particular variable corresponding to the variable index argument. More...
 
DenseSubVector< Number > & get_elem_residual (unsigned int var)
 Non-const accessor for element residual of a particular variable corresponding to the variable index argument. More...
 
const DenseMatrix< Number > & get_elem_jacobian () const
 Const accessor for element Jacobian. More...
 
DenseMatrix< Number > & get_elem_jacobian ()
 Non-const accessor for element Jacobian. More...
 
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 arguments. More...
 
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 arguments. More...
 
const std::vector< Number > & get_qois () const
 Const accessor for QoI vector. More...
 
std::vector< Number > & get_qois ()
 Non-const accessor for QoI vector. More...
 
const std::vector< DenseVector< Number > > & get_qoi_derivatives () const
 Const accessor for QoI derivatives. More...
 
std::vector< DenseVector< Number > > & get_qoi_derivatives ()
 Non-const accessor for QoI derivatives. More...
 
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 arguments. More...
 
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 arguments. More...
 
const std::vector< dof_id_type > & get_dof_indices () const
 Accessor for element dof indices. More...
 
std::vector< dof_id_type > & get_dof_indices ()
 Non-const accessor for element dof indices. More...
 
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. More...
 
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. More...
 
unsigned int n_dof_indices () const
 Total number of dof indices on the element. More...
 
unsigned int n_dof_indices (unsigned int var) const
 Total number of dof indices of the particular variable corresponding to the index argument. More...
 
Real get_system_time () const
 Accessor for the time variable stored in the system class. More...
 
Real get_time () const
 Accessor for the time for which the current nonlinear_solution is defined. More...
 
void set_time (Real time_in)
 Set the time for which the current nonlinear_solution is defined. More...
 
Real get_elem_solution_derivative () const
 The derivative of the current elem_solution w.r.t. More...
 
Real get_elem_solution_rate_derivative () const
 The derivative of the current elem_solution_rate w.r.t. More...
 
Real get_elem_solution_accel_derivative () const
 The derivative of the current elem_solution_accel w.r.t. More...
 
Real get_fixed_solution_derivative () const
 The derivative of the current fixed_elem_solution w.r.t. More...
 
bool is_adjoint () const
 Accessor for querying whether we need to do a primal or adjoint solve. More...
 
bool & is_adjoint ()
 Accessor for setting whether we need to do a primal or adjoint solve. More...
 
void set_deltat_pointer (Real *dt)
 Points the _deltat member of this class at a timestep value stored in the creating System, for example DiffSystem::deltat. More...
 
Real get_deltat_value ()
 
void add_localized_vector (NumericVector< Number > &localized_vector, const System &sys)
 Adds a vector to the map of localized vectors. More...
 
DenseVector< Number > & get_localized_vector (const NumericVector< Number > &localized_vector)
 Return a reference to DenseVector localization of localized_vector contained in the _localized_vectors map. More...
 
const DenseVector< Number > & get_localized_vector (const NumericVector< Number > &localized_vector) const
 const accessible version of get_localized_vector function More...
 
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 the _localized_vectors map. More...
 
const DenseSubVector< Number > & get_localized_subvector (const NumericVector< Number > &localized_vector, unsigned int var) const
 const accessible version of get_localized_subvector function More...
 

Public Attributes

const typedef DenseSubVector< Number > &(DiffContext::* diff_subsolution_getter )(unsigned int) const
 Helper typedef to simplify refactoring. More...
 
System_mesh_sys
 System from which to acquire moving mesh information. More...
 
unsigned int _mesh_x_var
 Variables from which to acquire moving mesh information. More...
 
unsigned int _mesh_y_var
 
unsigned int _mesh_z_var
 
unsigned char side
 Current side for side_* to examine. More...
 
unsigned char edge
 Current edge for edge_* to examine. More...
 
Real time
 For time-dependent problems, this is the time t for which the current nonlinear_solution is defined. More...
 
const Real system_time
 This is the time stored in the System class at the time this context was created, i.e. More...
 
Real elem_solution_derivative
 The derivative of elem_solution with respect to the current nonlinear solution. More...
 
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. More...
 
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. More...
 
Real fixed_solution_derivative
 The derivative of elem_fixed_solution with respect to the nonlinear solution, for use by systems constructing jacobians with elem_fixed_solution based methods. More...
 

Protected Member Functions

template<typename OutputShape >
FEGenericBase< OutputShape > * cached_fe (const unsigned int elem_dim, const FEType fe_type) const
 
void set_elem (const Elem *e)
 Helper function to promote accessor usage. More...
 
template<typename OutputType , typename FENeeded< OutputType >::value_getter fe_getter, diff_subsolution_getter subsolution_getter>
void some_value (unsigned int var, unsigned int qp, OutputType &u) const
 Helper function to reduce some code duplication in the *interior_value methods. More...
 
template<typename OutputType , typename FENeeded< OutputType >::grad_getter fe_getter, diff_subsolution_getter subsolution_getter>
void some_gradient (unsigned int var, unsigned int qp, OutputType &u) const
 Helper function to reduce some code duplication in the *interior_gradient methods. More...
 
template<typename OutputType , typename FENeeded< OutputType >::hess_getter fe_getter, diff_subsolution_getter subsolution_getter>
void some_hessian (unsigned int var, unsigned int qp, OutputType &u) const
 Helper function to reduce some code duplication in the *interior_hessian methods. More...
 
template<>
FEGenericBase< Real > * cached_fe (const unsigned int elem_dim, const FEType fe_type) const
 
template<>
FEGenericBase< RealGradient > * cached_fe (const unsigned int elem_dim, const FEType fe_type) const
 

Protected Attributes

AlgebraicType _atype
 Keep track of what type of algebra reinitialization is to be done. More...
 
const NumericVector< Number > * _custom_solution
 Data with which to do algebra reinitialization. More...
 
std::unique_ptr< FEGenericBase< Real > > _real_fe
 
std::unique_ptr< FEGenericBase< RealGradient > > _real_grad_fe
 
bool _real_fe_is_inf
 
bool _real_grad_fe_is_inf
 
std::vector< std::map< FEType, std::unique_ptr< FEAbstract > > > _element_fe
 Finite element objects for each variable's interior, sides and edges. More...
 
std::vector< std::map< FEType, std::unique_ptr< FEAbstract > > > _side_fe
 
std::map< FEType, std::unique_ptr< FEAbstract > > _edge_fe
 
std::vector< std::vector< FEAbstract * > > _element_fe_var
 Pointers to the same finite element objects, but indexed by variable number. More...
 
std::vector< std::vector< FEAbstract * > > _side_fe_var
 
std::vector< FEAbstract * > _edge_fe_var
 
const BoundaryInfo_boundary_info
 Saved reference to BoundaryInfo on the mesh for this System. More...
 
const Elem_elem
 Current element for element_* to examine. More...
 
unsigned char _dim
 Cached dimension of largest dimension element in this mesh. More...
 
unsigned char _elem_dim
 Cached dimension of this->_elem. More...
 
std::set< unsigned char > _elem_dims
 Cached dimensions of elements in the mesh, plus dimension 0 if SCALAR variables are in use. More...
 
std::vector< std::unique_ptr< QBase > > _element_qrule
 Quadrature rule for element interior. More...
 
std::vector< std::unique_ptr< QBase > > _side_qrule
 Quadrature rules for element sides The FEM context will try to find a quadrature rule that correctly integrates all variables. More...
 
std::unique_ptr< QBase_edge_qrule
 Quadrature rules for element edges. More...
 
int _extra_quadrature_order
 The extra quadrature order for this context. More...
 
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 localized versions of that vector and per variable views. More...
 
DenseVector< Number_elem_solution
 Element by element components of nonlinear_solution as adjusted by a time_solver. More...
 
std::vector< std::unique_ptr< DenseSubVector< Number > > > _elem_subsolutions
 
DenseVector< Number_elem_solution_rate
 Element by element components of du/dt as adjusted by a time_solver. More...
 
std::vector< std::unique_ptr< DenseSubVector< Number > > > _elem_subsolution_rates
 
DenseVector< Number_elem_solution_accel
 Element by element components of du/dt as adjusted by a time_solver. More...
 
std::vector< std::unique_ptr< DenseSubVector< Number > > > _elem_subsolution_accels
 
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. More...
 
std::vector< std::unique_ptr< DenseSubVector< Number > > > _elem_fixed_subsolutions
 
DenseVector< Number_elem_residual
 Element residual vector. More...
 
DenseMatrix< Number_elem_jacobian
 Element jacobian: derivatives of elem_residual with respect to elem_solution. More...
 
std::vector< Number_elem_qoi
 Element quantity of interest contributions. More...
 
std::vector< DenseVector< Number > > _elem_qoi_derivative
 Element quantity of interest derivative contributions. More...
 
std::vector< std::vector< std::unique_ptr< DenseSubVector< Number > > > > _elem_qoi_subderivatives
 
std::vector< std::unique_ptr< DenseSubVector< Number > > > _elem_subresiduals
 Element residual subvectors and Jacobian submatrices. More...
 
std::vector< std::vector< std::unique_ptr< DenseSubMatrix< Number > > > > _elem_subjacobians
 
std::vector< dof_id_type_dof_indices
 Global Degree of freedom index lists. More...
 
std::vector< std::vector< dof_id_type > > _dof_indices_var
 

Private Member Functions

void init_internal_data (const System &sys)
 Helper function used in constructors to set up internal data. More...
 
void _do_elem_position_set (Real theta)
 Uses the coordinate data specified by mesh_*_position configuration to set the geometry of elem to the value it would take after a fraction theta of a timestep. More...
 
void _update_time_from_system (Real theta)
 Update the time in the context object for the given value of theta, based on the values of "time" and "deltat" stored in the system which created this context. More...
 

Private Attributes

Real_deltat
 Defaults to nullptr, can optionally be used to point to a timestep value in the System-derived class responsible for creating this DiffContext. More...
 
const System_system
 A reference to the system this context is constructed with. More...
 
bool _is_adjoint
 Is this context to be used for a primal or adjoint solve? More...
 

Detailed Description

This class provides all data required for a physics package (e.g.

an FEMSystem subclass) to perform local element residual and jacobian integrations.

This class is part of the new DifferentiableSystem framework, which is still experimental. Users of this framework should beware of bugs and future API changes.

Author
Roy H. Stogner
Date
2009

Definition at line 62 of file fem_context.h.

Member Typedef Documentation

◆ localized_vectors_iterator

typedef std::map<const NumericVector<Number> *, std::pair<DenseVector<Number>, std::vector<std::unique_ptr<DenseSubVector<Number> > > > >::iterator libMesh::DiffContext::localized_vectors_iterator
inherited

Typedef for the localized_vectors iterator.

Definition at line 544 of file diff_context.h.

Member Enumeration Documentation

◆ AlgebraicType

Enum describing what data to use when initializing algebraic structures on each element.

Enumerator
NONE 
DOFS_ONLY 
CURRENT 
OLD 
OLD_DOFS_ONLY 

Definition at line 958 of file fem_context.h.

958  { NONE = 0, // Do not reinitialize dof_indices
959  DOFS_ONLY, // Reinitialize dof_indices, not
960  // algebraic structures
961  CURRENT, // Use dof_indices, current solution
962  OLD, // Use old_dof_indices, custom solution
963  OLD_DOFS_ONLY}; // Reinitialize old_dof_indices, not

Constructor & Destructor Documentation

◆ FEMContext() [1/2]

libMesh::FEMContext::FEMContext ( const System sys)
explicit

Constructor.

Allocates some but fills no data structures.

Definition at line 37 of file fem_context.C.

38  : DiffContext(sys),
39  _mesh_sys(nullptr),
40  _mesh_x_var(0),
41  _mesh_y_var(0),
42  _mesh_z_var(0),
43  side(0), edge(0),
44  _atype(CURRENT),
45  _custom_solution(nullptr),
46  _boundary_info(sys.get_mesh().get_boundary_info()),
47  _elem(nullptr),
48  _dim(cast_int<unsigned char>(sys.get_mesh().mesh_dimension())),
49  _elem_dim(0), /* This will be reset in set_elem(). */
50  _elem_dims(sys.get_mesh().elem_dimensions()),
51  _element_qrule(4),
52  _side_qrule(4),
53  _extra_quadrature_order(sys.extra_quadrature_order)
54 {
55  init_internal_data(sys);
56 }

References init_internal_data().

◆ FEMContext() [2/2]

libMesh::FEMContext::FEMContext ( const System sys,
int  extra_quadrature_order 
)
explicit

Constructor.

Specify the extra quadrature order instead of getting it from sys.

Definition at line 58 of file fem_context.C.

59  : DiffContext(sys),
60  _mesh_sys(nullptr),
61  _mesh_x_var(0),
62  _mesh_y_var(0),
63  _mesh_z_var(0),
64  side(0), edge(0),
65  _atype(CURRENT),
66  _custom_solution(nullptr),
67  _boundary_info(sys.get_mesh().get_boundary_info()),
68  _elem(nullptr),
69  _dim(cast_int<unsigned char>(sys.get_mesh().mesh_dimension())),
70  _elem_dim(0), /* This will be reset in set_elem(). */
71  _elem_dims(sys.get_mesh().elem_dimensions()),
72  _element_qrule(4),
73  _side_qrule(4),
74  _extra_quadrature_order(extra_quadrature_order)
75 {
76  init_internal_data(sys);
77 }

References init_internal_data().

◆ ~FEMContext()

libMesh::FEMContext::~FEMContext ( )
virtual

Destructor.

Definition at line 248 of file fem_context.C.

249 {
250 }

Member Function Documentation

◆ _do_elem_position_set()

void libMesh::FEMContext::_do_elem_position_set ( Real  theta)
private

Uses the coordinate data specified by mesh_*_position configuration to set the geometry of elem to the value it would take after a fraction theta of a timestep.

This does the work of elem_position_set, but isn't safe to call without _mesh_sys/etc. defined first.

Definition at line 1566 of file fem_context.C.

1567 {
1568  // This is too expensive to call unless we've been asked to move the mesh
1570 
1571  // This will probably break with threading when two contexts are
1572  // operating on elements which share a node
1573  libmesh_assert_equal_to (libMesh::n_threads(), 1);
1574 
1575  // If the coordinate data is in our own system, it's already
1576  // been set up for us, and we can ignore our input parameter theta
1577  // if (_mesh_sys == this->number())
1578  // {
1579  unsigned int n_nodes = this->get_elem().n_nodes();
1580 
1581 #ifndef NDEBUG
1582  const unsigned char dim = this->get_elem_dim();
1583 
1584  // For simplicity we demand that mesh coordinates be stored
1585  // in a format that allows a direct copy
1587  (this->get_element_fe(this->get_mesh_x_var(), dim)->get_fe_type().family
1588  == FEMap::map_fe_type(this->get_elem()) &&
1589  this->get_elem_solution(this->get_mesh_x_var()).size() == n_nodes));
1591  (this->get_element_fe(this->get_mesh_y_var(), dim)->get_fe_type().family
1592  == FEMap::map_fe_type(this->get_elem()) &&
1593  this->get_elem_solution(this->get_mesh_y_var()).size() == n_nodes));
1595  (this->get_element_fe(this->get_mesh_z_var(), dim)->get_fe_type().family
1596  == FEMap::map_fe_type(this->get_elem()) &&
1597  this->get_elem_solution(this->get_mesh_z_var()).size() == n_nodes));
1598 #endif
1599 
1600  // Set the new point coordinates
1601  if (this->get_mesh_x_var() != libMesh::invalid_uint)
1602  for (unsigned int i=0; i != n_nodes; ++i)
1603  const_cast<Elem &>(this->get_elem()).point(i)(0) =
1604  libmesh_real(this->get_elem_solution(this->get_mesh_x_var())(i));
1605 
1606  if (this->get_mesh_y_var() != libMesh::invalid_uint)
1607  for (unsigned int i=0; i != n_nodes; ++i)
1608  const_cast<Elem &>(this->get_elem()).point(i)(1) =
1609  libmesh_real(this->get_elem_solution(this->get_mesh_y_var())(i));
1610 
1611  if (this->get_mesh_z_var() != libMesh::invalid_uint)
1612  for (unsigned int i=0; i != n_nodes; ++i)
1613  const_cast<Elem &>(this->get_elem()).point(i)(2) =
1614  libmesh_real(this->get_elem_solution(this->get_mesh_z_var())(i));
1615  // }
1616  // FIXME - If the coordinate data is not in our own system, someone
1617  // had better get around to implementing that... - RHS
1618  // else
1619  // {
1620  // libmesh_not_implemented();
1621  // }
1622 }

References _mesh_sys, dim, get_elem(), get_elem_dim(), libMesh::DiffContext::get_elem_solution(), get_element_fe(), get_mesh_x_var(), get_mesh_y_var(), get_mesh_z_var(), libMesh::invalid_uint, libMesh::libmesh_assert(), libMesh::libmesh_real(), libMesh::FEMap::map_fe_type(), n_nodes, libMesh::Elem::n_nodes(), and libMesh::n_threads().

Referenced by elem_position_set().

◆ _update_time_from_system()

void libMesh::FEMContext::_update_time_from_system ( Real  theta)
private

Update the time in the context object for the given value of theta, based on the values of "time" and "deltat" stored in the system which created this context.

Definition at line 1864 of file fem_context.C.

1865 {
1866  // Update the "time" variable based on the value of theta. For this
1867  // to work, we need to know the value of deltat, a pointer to which is now
1868  // stored by our parent DiffContext class. Note: get_deltat_value() will
1869  // assert in debug mode if the requested pointer is nullptr.
1870  const Real deltat = this->get_deltat_value();
1871 
1872  this->set_time(theta*(this->get_system_time() + deltat) + (1.-theta)*this->get_system_time());
1873 }

References libMesh::DiffContext::get_deltat_value(), libMesh::DiffContext::get_system_time(), libMesh::Real, and libMesh::DiffContext::set_time().

Referenced by elem_edge_reinit(), elem_reinit(), elem_side_reinit(), and nonlocal_reinit().

◆ add_localized_vector()

void libMesh::DiffContext::add_localized_vector ( NumericVector< Number > &  localized_vector,
const System sys 
)
inherited

Adds a vector to the map of localized vectors.

We can later evaluate interior_values, interior_gradients and side_values for these fields these vectors represent.

Definition at line 119 of file diff_context.C.

120 {
121  // Make an empty pair keyed with a reference to this _localized_vector
122  _localized_vectors[&localized_vector] = std::make_pair(DenseVector<Number>(), std::vector<std::unique_ptr<DenseSubVector<Number>>>());
123 
124  unsigned int nv = sys.n_vars();
125 
126  _localized_vectors[&localized_vector].second.reserve(nv);
127 
128  // Fill the DenseSubVector with nv copies of DenseVector
129  for (unsigned int i=0; i != nv; ++i)
130  _localized_vectors[&localized_vector].second.emplace_back(libmesh_make_unique<DenseSubVector<Number>>(_localized_vectors[&localized_vector].first));
131 }

References libMesh::DiffContext::_localized_vectors, and libMesh::System::n_vars().

◆ algebraic_type()

AlgebraicType libMesh::FEMContext::algebraic_type ( ) const
inline

Definition at line 979 of file fem_context.h.

979 { return _atype; }

References _atype.

Referenced by build_new_fe(), and pre_fe_reinit().

◆ attach_quadrature_rules()

void libMesh::FEMContext::attach_quadrature_rules ( )

Helper function for attaching quadrature rules.

Definition at line 112 of file fem_context.C.

113 {
114  const System & sys = this->get_system();
115  const unsigned int nv = sys.n_vars();
116 
117  for (const auto & dim : _elem_dims)
118  {
119  for (unsigned int i=0; i != nv; ++i)
120  {
121  FEType fe_type = sys.variable_type(i);
122 
123  _element_fe[dim][fe_type]->attach_quadrature_rule(_element_qrule[dim].get());
124  _side_fe[dim][fe_type]->attach_quadrature_rule(_side_qrule[dim].get());
125 
126  if (dim == 3)
127  _edge_fe[fe_type]->attach_quadrature_rule(_edge_qrule.get());
128  }
129  }
130 }

References _edge_fe, _edge_qrule, _elem_dims, _element_fe, _element_qrule, _side_fe, _side_qrule, dim, libMesh::ReferenceElem::get(), libMesh::DiffContext::get_system(), libMesh::System::n_vars(), and libMesh::System::variable_type().

Referenced by use_default_quadrature_rules(), and use_unweighted_quadrature_rules().

◆ build_new_fe()

template<typename OutputShape >
template FEGenericBase< RealGradient > * libMesh::FEMContext::build_new_fe ( const FEGenericBase< OutputShape > *  fe,
const Point p,
const Real  tolerance = TOLERANCE 
) const

Helper function to reduce some code duplication in the *_point_* methods.

Definition at line 1952 of file fem_context.C.

1955 {
1956  FEType fe_type = fe->get_fe_type();
1957 
1958  // If we don't have an Elem to evaluate on, then the only functions
1959  // we can sensibly evaluate are the scalar dofs which are the same
1960  // everywhere.
1961  libmesh_assert(this->has_elem() || fe_type.family == SCALAR);
1962 
1963 #ifdef LIBMESH_ENABLE_AMR
1964  if ((algebraic_type() == OLD) &&
1965  this->has_elem())
1966  {
1967  if (this->get_elem().p_refinement_flag() == Elem::JUST_REFINED)
1968  fe_type.order = static_cast<Order>(fe_type.order - 1);
1969  else if (this->get_elem().p_refinement_flag() == Elem::JUST_COARSENED)
1970  fe_type.order = static_cast<Order>(fe_type.order + 1);
1971  }
1972 #endif // LIBMESH_ENABLE_AMR
1973 
1974  const unsigned int elem_dim = this->has_elem() ? this->get_elem().dim() : 0;
1975 
1976  FEGenericBase<OutputShape>* fe_new = cached_fe<OutputShape>(elem_dim, fe_type);
1977 
1978  // Map the physical co-ordinates to the master co-ordinates using the inverse_map from fe_interface.h
1979  // Build a vector of point co-ordinates to send to reinit
1980  Point master_point = this->has_elem() ?
1981  FEMap::inverse_map (elem_dim, &this->get_elem(), p, tolerance) :
1982  Point(0);
1983 
1984  std::vector<Point> coor(1, master_point);
1985 
1986  // Reinitialize the element and compute the shape function values at coor
1987  if (this->has_elem())
1988  fe_new->reinit (&this->get_elem(), &coor);
1989  else
1990  // If !this->has_elem(), then we assume we are dealing with a SCALAR variable
1991  fe_new->reinit (nullptr, &coor);
1992 
1993  return fe_new;
1994 }

References algebraic_type(), libMesh::Elem::dim(), libMesh::FEType::family, get_elem(), libMesh::FEAbstract::get_fe_type(), has_elem(), libMesh::FEMap::inverse_map(), libMesh::Elem::JUST_COARSENED, libMesh::Elem::JUST_REFINED, libMesh::libmesh_assert(), OLD, libMesh::FEType::order, libMesh::FEAbstract::reinit(), and libMesh::SCALAR.

Referenced by fixed_point_gradient(), fixed_point_hessian(), fixed_point_value(), point_curl(), point_gradient(), point_hessian(), and point_value().

◆ cached_fe() [1/3]

template<typename OutputShape >
FEGenericBase<OutputShape>* libMesh::FEMContext::cached_fe ( const unsigned int  elem_dim,
const FEType  fe_type 
) const
protected

◆ cached_fe() [2/3]

template<>
FEGenericBase<Real>* libMesh::FEMContext::cached_fe ( const unsigned int  elem_dim,
const FEType  fe_type 
) const
protected

Definition at line 1879 of file fem_context.C.

1881 {
1882 #ifdef LIBMESH_ENABLE_INFINITE_ELEMENTS
1883  const bool fe_needs_inf =
1884  this->has_elem() && this->get_elem().infinite();
1885 #endif
1886 
1887  if (!_real_fe ||
1888  elem_dim != _real_fe->get_dim() ||
1889  fe_type != _real_fe->get_fe_type())
1890  _real_fe =
1891 #ifdef LIBMESH_ENABLE_INFINITE_ELEMENTS
1892  fe_needs_inf ?
1893  FEGenericBase<Real>::build_InfFE(elem_dim, fe_type) :
1894 #endif
1895  FEGenericBase<Real>::build(elem_dim, fe_type);
1896 
1897 #ifdef LIBMESH_ENABLE_INFINITE_ELEMENTS
1898  else if (fe_needs_inf && !_real_fe_is_inf)
1899  _real_fe =
1900  FEGenericBase<Real>::build_InfFE(elem_dim, fe_type);
1901  else if (!fe_needs_inf && _real_fe_is_inf)
1902  _real_fe =
1903  FEGenericBase<Real>::build(elem_dim, fe_type);
1904 
1905  _real_fe_is_inf =
1906  (this->has_elem() && this->get_elem().infinite());
1907 #endif
1908 
1909  return _real_fe.get();
1910 }

References _real_fe, _real_fe_is_inf, libMesh::FEGenericBase< OutputType >::build(), libMesh::FEGenericBase< OutputType >::build_InfFE(), get_elem(), has_elem(), and libMesh::Elem::infinite().

◆ cached_fe() [3/3]

template<>
FEGenericBase<RealGradient>* libMesh::FEMContext::cached_fe ( const unsigned int  elem_dim,
const FEType  fe_type 
) const
protected

Definition at line 1915 of file fem_context.C.

1917 {
1918 #ifdef LIBMESH_ENABLE_INFINITE_ELEMENTS
1919  const bool fe_needs_inf =
1920  this->has_elem() && this->get_elem().infinite();
1921 #endif
1922 
1923  if (!_real_grad_fe ||
1924  elem_dim != _real_grad_fe->get_dim() ||
1925  fe_type != _real_grad_fe->get_fe_type())
1926  _real_grad_fe =
1927 #ifdef LIBMESH_ENABLE_INFINITE_ELEMENTS
1928  fe_needs_inf ?
1929  FEGenericBase<RealGradient>::build_InfFE(elem_dim, fe_type) :
1930 #endif
1931  FEGenericBase<RealGradient>::build(elem_dim, fe_type);
1932 
1933 #ifdef LIBMESH_ENABLE_INFINITE_ELEMENTS
1934  else if (fe_needs_inf && !_real_grad_fe_is_inf)
1935  _real_grad_fe =
1936  FEGenericBase<RealGradient>::build_InfFE(elem_dim, fe_type);
1937  else if (!fe_needs_inf && _real_grad_fe_is_inf)
1938  _real_grad_fe =
1939  FEGenericBase<RealGradient>::build(elem_dim, fe_type);
1940 
1942  (this->has_elem() && this->get_elem().infinite());
1943 #endif
1944 
1945  return _real_grad_fe.get();
1946 }

References _real_grad_fe, _real_grad_fe_is_inf, libMesh::FEGenericBase< OutputType >::build(), libMesh::FEGenericBase< OutputType >::build_InfFE(), get_elem(), has_elem(), and libMesh::Elem::infinite().

◆ edge_fe_reinit()

void libMesh::FEMContext::edge_fe_reinit ( )
virtual

Reinitializes edge FE objects on the current geometric element.

Definition at line 1473 of file fem_context.C.

1474 {
1475  libmesh_assert_equal_to (this->get_elem_dim(), 3);
1476 
1477  // Initialize all the interior FE objects on elem/edge.
1478  // Logging of FE::reinit is done in the FE functions
1479  for (auto & pr : _edge_fe)
1480  pr.second->edge_reinit(&(this->get_elem()), this->get_edge());
1481 }

References _edge_fe, get_edge(), get_elem(), and get_elem_dim().

Referenced by elem_edge_reinit().

◆ elem_dimensions()

const std::set<unsigned char>& libMesh::FEMContext::elem_dimensions ( ) const
inline
Returns
Set of dimensions of elements present in the mesh at context initialization.

Definition at line 938 of file fem_context.h.

939  { return _elem_dims; }

References _elem_dims.

Referenced by libMesh::LaplacianErrorEstimator::init_context(), libMesh::DiscontinuityMeasure::init_context(), and libMesh::KellyErrorEstimator::init_context().

◆ elem_edge_reinit()

void libMesh::FEMContext::elem_edge_reinit ( Real  theta)
overridevirtual

Resets the current time in the context.

Additionally, reinitialize Elem and FE objects if there's a moving mesh present in the system such that the mesh is deformed to its position at \( t_{\theta} \).

Reimplemented from libMesh::DiffContext.

Definition at line 1411 of file fem_context.C.

1412 {
1413  // Update the "time" variable of this context object
1414  this->_update_time_from_system(theta);
1415 
1416  // Handle a moving element if necessary
1417  if (_mesh_sys)
1418  {
1419  // FIXME - not threadsafe yet!
1420  elem_position_set(theta);
1421  edge_fe_reinit();
1422  }
1423 }

References _mesh_sys, _update_time_from_system(), edge_fe_reinit(), and elem_position_set().

◆ elem_fe_reinit()

void libMesh::FEMContext::elem_fe_reinit ( const std::vector< Point > *const  pts = nullptr)
virtual

Reinitializes interior FE objects on the current geometric element.

Definition at line 1436 of file fem_context.C.

1437 {
1438  // Initialize all the interior FE objects on elem.
1439  // Logging of FE::reinit is done in the FE functions
1440  // We only reinit the FE objects for the current element
1441  // dimension
1442  const unsigned char dim = this->get_elem_dim();
1443 
1444  libmesh_assert( !_element_fe[dim].empty() );
1445 
1446  for (const auto & pr : _element_fe[dim])
1447  {
1448  if (this->has_elem())
1449  pr.second->reinit(&(this->get_elem()), pts);
1450  else
1451  // If !this->has_elem(), then we assume we are dealing with a SCALAR variable
1452  pr.second->reinit(nullptr);
1453  }
1454 }

References _element_fe, dim, get_elem(), get_elem_dim(), has_elem(), and libMesh::libmesh_assert().

Referenced by libMesh::RBConstruction::add_scaled_matrix_and_vector(), assembly_with_dg_fem_context(), elem_reinit(), libMesh::RBEIMConstruction::enrich_RB_space(), libMesh::FEMSystem::mesh_position_set(), nonlocal_reinit(), OverlappingAlgebraicGhostingTest::run_ghosting_test(), OverlappingCouplingGhostingTest::run_sparsity_pattern_test(), and libMesh::RBEIMConstruction::truth_solve().

◆ elem_position_get()

void libMesh::FEMContext::elem_position_get ( )

Uses the geometry of elem to set the coordinate data specified by mesh_*_position configuration.

Definition at line 1485 of file fem_context.C.

1486 {
1487  // This is too expensive to call unless we've been asked to move the mesh
1489 
1490  // This will probably break with threading when two contexts are
1491  // operating on elements which share a node
1492  libmesh_assert_equal_to (libMesh::n_threads(), 1);
1493 
1494  // If the coordinate data is in our own system, it's already
1495  // been set up for us
1496  // if (_mesh_sys == this->number())
1497  // {
1498  unsigned int n_nodes = this->get_elem().n_nodes();
1499 
1500 #ifndef NDEBUG
1501  const unsigned char dim = this->get_elem_dim();
1502 
1503  // For simplicity we demand that mesh coordinates be stored
1504  // in a format that allows a direct copy
1506  (this->get_element_fe(this->get_mesh_x_var(), dim)->get_fe_type().family
1507  == FEMap::map_fe_type(this->get_elem()) &&
1508  this->get_element_fe(this->get_mesh_x_var(), dim)->get_fe_type().order.get_order()
1509  == this->get_elem().default_order()));
1511  (this->get_element_fe(this->get_mesh_y_var(), dim)->get_fe_type().family
1512  == FEMap::map_fe_type(this->get_elem()) &&
1513  this->get_element_fe(this->get_mesh_y_var(), dim)->get_fe_type().order.get_order()
1514  == this->get_elem().default_order()));
1516  (this->get_element_fe(this->get_mesh_z_var(), dim)->get_fe_type().family
1517  == FEMap::map_fe_type(this->get_elem()) &&
1518  this->get_element_fe(this->get_mesh_z_var(), dim)->get_fe_type().order.get_order()
1519  == this->get_elem().default_order()));
1520 #endif
1521 
1522  // Get degree of freedom coefficients from point coordinates
1523  if (this->get_mesh_x_var() != libMesh::invalid_uint)
1524  for (unsigned int i=0; i != n_nodes; ++i)
1525  (this->get_elem_solution(this->get_mesh_x_var()))(i) = this->get_elem().point(i)(0);
1526 
1527  if (this->get_mesh_y_var() != libMesh::invalid_uint)
1528  for (unsigned int i=0; i != n_nodes; ++i)
1529  (this->get_elem_solution(this->get_mesh_y_var()))(i) = this->get_elem().point(i)(1);
1530 
1531  if (this->get_mesh_z_var() != libMesh::invalid_uint)
1532  for (unsigned int i=0; i != n_nodes; ++i)
1533  (this->get_elem_solution(this->get_mesh_z_var()))(i) = this->get_elem().point(i)(2);
1534  // }
1535  // FIXME - If the coordinate data is not in our own system, someone
1536  // had better get around to implementing that... - RHS
1537  // else
1538  // {
1539  // libmesh_not_implemented();
1540  // }
1541 }

References _mesh_sys, libMesh::Elem::default_order(), dim, get_elem(), get_elem_dim(), libMesh::DiffContext::get_elem_solution(), get_element_fe(), get_mesh_x_var(), get_mesh_y_var(), get_mesh_z_var(), libMesh::invalid_uint, libMesh::libmesh_assert(), libMesh::FEMap::map_fe_type(), n_nodes, libMesh::Elem::n_nodes(), libMesh::n_threads(), and libMesh::Elem::point().

Referenced by libMesh::FEMSystem::mesh_position_get().

◆ elem_position_set()

void libMesh::FEMContext::elem_position_set ( Real  theta)
inline

Uses the coordinate data specified by mesh_*_position configuration to set the geometry of elem to the value it would take after a fraction theta of a timestep.

Definition at line 1238 of file fem_context.h.

1239 {
1240  if (_mesh_sys)
1241  this->_do_elem_position_set(theta);
1242 }

References _do_elem_position_set(), and _mesh_sys.

Referenced by elem_edge_reinit(), elem_reinit(), elem_side_reinit(), and libMesh::FEMSystem::mesh_position_set().

◆ elem_reinit()

void libMesh::FEMContext::elem_reinit ( Real  theta)
overridevirtual

Resets the current time in the context.

Additionally, reinitialize Elem and FE objects if there's a moving mesh present in the system such that the mesh is deformed to its position at \( t_{\theta} \).

Reimplemented from libMesh::DiffContext.

Definition at line 1372 of file fem_context.C.

1373 {
1374  // Update the "time" variable of this context object
1375  this->_update_time_from_system(theta);
1376 
1377  // Handle a moving element if necessary.
1378  if (_mesh_sys)
1379  {
1380  // We assume that the ``default'' state
1381  // of the mesh is its final, theta=1.0
1382  // position, so we don't bother with
1383  // mesh motion in that case.
1384  if (theta != 1.0)
1385  {
1386  // FIXME - ALE is not threadsafe yet!
1387  libmesh_assert_equal_to (libMesh::n_threads(), 1);
1388 
1389  elem_position_set(theta);
1390  }
1391  elem_fe_reinit();
1392  }
1393 }

References _mesh_sys, _update_time_from_system(), elem_fe_reinit(), elem_position_set(), and libMesh::n_threads().

◆ elem_side_reinit()

void libMesh::FEMContext::elem_side_reinit ( Real  theta)
overridevirtual

Resets the current time in the context.

Additionally, reinitialize Elem and FE objects if there's a moving mesh present in the system such that the mesh is deformed to its position at \( t_{\theta} \).

Reimplemented from libMesh::DiffContext.

Definition at line 1396 of file fem_context.C.

1397 {
1398  // Update the "time" variable of this context object
1399  this->_update_time_from_system(theta);
1400 
1401  // Handle a moving element if necessary
1402  if (_mesh_sys)
1403  {
1404  // FIXME - not threadsafe yet!
1405  elem_position_set(theta);
1406  side_fe_reinit();
1407  }
1408 }

References _mesh_sys, _update_time_from_system(), elem_position_set(), and side_fe_reinit().

◆ find_hardest_fe_type()

FEType libMesh::FEMContext::find_hardest_fe_type ( )

Helper function for creating quadrature rules.

Definition at line 80 of file fem_context.C.

81 {
82  const System & sys = this->get_system();
83  FEType hardest_fe_type = sys.variable_type(0);
84 
85  for (auto i : IntRange<unsigned int>(0, sys.n_vars()))
86  {
87  FEType fe_type = sys.variable_type(i);
88 
89  // Make sure we find a non-SCALAR FE family, even in the case
90  // where the first variable(s) weren't
91  if (hardest_fe_type.family == SCALAR)
92  {
93  hardest_fe_type.family = fe_type.family;
94  hardest_fe_type.order = fe_type.order;
95  }
96 
97  // FIXME - we don't yet handle mixed finite elements from
98  // different families which require different quadrature rules
99  // libmesh_assert_equal_to (fe_type.family, hardest_fe_type.family);
100 
101  // We need to detect SCALAR's so we can prepare FE objects for
102  // them, and so we don't mistake high order scalars as a reason
103  // to crank up the quadrature order on other types.
104  if (fe_type.family != SCALAR && fe_type.order > hardest_fe_type.order)
105  hardest_fe_type = fe_type;
106  }
107 
108  return hardest_fe_type;
109 }

References libMesh::FEType::family, libMesh::DiffContext::get_system(), libMesh::System::n_vars(), libMesh::FEType::order, libMesh::SCALAR, and libMesh::System::variable_type().

Referenced by use_default_quadrature_rules(), and use_unweighted_quadrature_rules().

◆ fixed_interior_gradient() [1/2]

Gradient libMesh::FEMContext::fixed_interior_gradient ( unsigned int  var,
unsigned int  qp 
) const
Returns
The gradient of the fixed_solution variable var at the quadrature point qp on the current element interior.
Note
This API is currently present for backward compatibility.

Definition at line 1041 of file fem_context.C.

1042 {
1043  Gradient du;
1044 
1045  this->fixed_interior_gradient( var, qp, du );
1046 
1047  return du;
1048 }

◆ fixed_interior_gradient() [2/2]

template<typename OutputType >
void libMesh::FEMContext::fixed_interior_gradient ( unsigned int  var,
unsigned int  qp,
OutputType &  grad_u 
) const
Returns
The gradient of the fixed_solution variable var at the quadrature point qp on the current element interior.
Note
This is the preferred API.

Definition at line 1052 of file fem_context.C.

1054 {
1055  this->some_gradient
1056  <OutputType,
1058  <typename TensorTools::MakeReal
1059  <typename TensorTools::DecrementRank
1060  <OutputType>::type>::type>,
1062  (var, qp, du);
1063 }

References libMesh::DiffContext::get_elem_fixed_solution(), get_element_fe(), and some_gradient().

◆ fixed_interior_hessian() [1/2]

Tensor libMesh::FEMContext::fixed_interior_hessian ( unsigned int  var,
unsigned int  qp 
) const
Returns
The hessian of the fixed_solution variable var at the quadrature point qp on the current element interior.
Note
This API is currently present for backward compatibility.

Definition at line 1068 of file fem_context.C.

1069 {
1070  Tensor d2u;
1071 
1072  this->fixed_interior_hessian( var, qp, d2u );
1073 
1074  return d2u;
1075 }

◆ fixed_interior_hessian() [2/2]

template<typename OutputType >
void libMesh::FEMContext::fixed_interior_hessian ( unsigned int  var,
unsigned int  qp,
OutputType &  hess_u 
) const
Returns
The hessian of the fixed_solution variable var at the quadrature point qp on the current element interior.
Note
This is the preferred API.

Definition at line 1079 of file fem_context.C.

1081 {
1082  this->some_hessian<OutputType,
1084  <typename TensorTools::MakeReal
1085  <typename TensorTools::DecrementRank
1086  <typename TensorTools::DecrementRank
1087  <OutputType>::type>::type>::type>,
1088  &DiffContext::get_elem_fixed_solution>(var, qp, d2u);
1089 }

References libMesh::DiffContext::get_elem_fixed_solution(), get_element_fe(), and some_hessian().

◆ fixed_interior_value() [1/2]

Number libMesh::FEMContext::fixed_interior_value ( unsigned int  var,
unsigned int  qp 
) const
Returns
The value of the fixed_solution variable var at the quadrature point qp on the current element interior.
Note
This API is currently present for backward compatibility.

Definition at line 1018 of file fem_context.C.

1019 {
1020  Number u = 0.;
1021 
1022  this->fixed_interior_value( var, qp, u );
1023 
1024  return u;
1025 }

◆ fixed_interior_value() [2/2]

template<typename OutputType >
void libMesh::FEMContext::fixed_interior_value ( unsigned int  var,
unsigned int  qp,
OutputType &  u 
) const
Returns
The value of the fixed_solution variable var at the quadrature point qp on the current element interior.
Note
This is the preferred API.

Definition at line 1030 of file fem_context.C.

1032 {
1033  this->some_value<OutputType,
1037 }

References libMesh::DiffContext::get_elem_fixed_solution(), get_element_fe(), and some_value().

◆ fixed_point_gradient() [1/2]

Gradient libMesh::FEMContext::fixed_point_gradient ( unsigned int  var,
const Point p 
) const
Returns
The gradient of the fixed_solution variable var at the physical point p on the current element.
Note
This API is currently present for backward compatibility.

Definition at line 1214 of file fem_context.C.

1215 {
1216  Gradient grad_u;
1217 
1218  this->fixed_point_gradient( var, p, grad_u );
1219 
1220  return grad_u;
1221 }

◆ fixed_point_gradient() [2/2]

template<typename OutputType >
void libMesh::FEMContext::fixed_point_gradient ( unsigned int  var,
const Point p,
OutputType &  grad_u,
const Real  tolerance = TOLERANCE 
) const
Returns
The gradient of the fixed_solution variable var at the physical point p on the current element.
Note
This is the preferred API.

Allows evaluation of points within a relative tolerance outside the element.

Definition at line 1226 of file fem_context.C.

1230 {
1231  typedef typename TensorTools::MakeReal
1233  OutputShape;
1234 
1235  // Get local-to-global dof index lookup
1236  const unsigned int n_dofs = cast_int<unsigned int>
1237  (this->get_dof_indices(var).size());
1238 
1239  // Get current local coefficients
1240  libmesh_assert_greater (_elem_fixed_subsolutions.size(), var);
1241  const DenseSubVector<Number> & coef = this->get_elem_fixed_solution(var);
1242 
1243  // Get finite element object
1244  FEGenericBase<OutputShape> * fe = nullptr;
1245  this->get_element_fe<OutputShape>( var, fe, this->get_elem_dim() );
1246 
1247  // Build a FE for calculating u(p)
1248  FEGenericBase<OutputShape> * fe_new =
1249  this->build_new_fe( fe, p, tolerance );
1250 
1251  // Get the values of the shape function derivatives
1252  const std::vector<std::vector<typename FEGenericBase<OutputShape>::OutputGradient>> & dphi = fe_new->get_dphi();
1253 
1254  grad_u = 0.0;
1255 
1256  for (unsigned int l=0; l != n_dofs; l++)
1257  grad_u.add_scaled(dphi[l][0], coef(l));
1258 
1259  return;
1260 }

References libMesh::DiffContext::_elem_fixed_subsolutions, build_new_fe(), libMesh::DiffContext::get_dof_indices(), libMesh::FEGenericBase< OutputType >::get_dphi(), get_elem_dim(), and libMesh::DiffContext::get_elem_fixed_solution().

◆ fixed_point_hessian() [1/2]

Tensor libMesh::FEMContext::fixed_point_hessian ( unsigned int  var,
const Point p 
) const
Returns
The hessian of the fixed_solution variable var at the physical point p on the current element.
Note
This API is currently present for backward compatibility.

Definition at line 1265 of file fem_context.C.

1266 {
1267  Tensor hess_u;
1268 
1269  this->fixed_point_hessian( var, p, hess_u );
1270 
1271  return hess_u;
1272 }

◆ fixed_point_hessian() [2/2]

template<typename OutputType >
void libMesh::FEMContext::fixed_point_hessian ( unsigned int  var,
const Point p,
OutputType &  hess_u,
const Real  tolerance = TOLERANCE 
) const
Returns
The hessian of the fixed_solution variable var at the physical point p on the current element.
Note
This is the preferred API.

Allows evaluation of points within a relative tolerance outside the element.

Definition at line 1277 of file fem_context.C.

1281 {
1282  typedef typename TensorTools::DecrementRank<OutputType>::type Rank1Decrement;
1283  typedef typename TensorTools::DecrementRank<Rank1Decrement>::type Rank2Decrement;
1284  typedef typename TensorTools::MakeReal<Rank2Decrement>::type OutputShape;
1285 
1286  // Get local-to-global dof index lookup
1287  const unsigned int n_dofs = cast_int<unsigned int>
1288  (this->get_dof_indices(var).size());
1289 
1290  // Get current local coefficients
1291  libmesh_assert_greater (_elem_fixed_subsolutions.size(), var);
1292  const DenseSubVector<Number> & coef = this->get_elem_fixed_solution(var);
1293 
1294  // Get finite element object
1295  FEGenericBase<OutputShape> * fe = nullptr;
1296  this->get_element_fe<OutputShape>( var, fe, this->get_elem_dim() );
1297 
1298  // Build a FE for calculating u(p)
1299  FEGenericBase<OutputShape> * fe_new =
1300  this->build_new_fe( fe, p, tolerance );
1301 
1302  // Get the values of the shape function derivatives
1303  const std::vector<std::vector<typename FEGenericBase<OutputShape>::OutputTensor>> & d2phi = fe_new->get_d2phi();
1304 
1305  hess_u = 0.0;
1306 
1307  for (unsigned int l=0; l != n_dofs; l++)
1308  hess_u.add_scaled(d2phi[l][0], coef(l));
1309 
1310  return;
1311 }

References libMesh::DiffContext::_elem_fixed_subsolutions, build_new_fe(), libMesh::FEGenericBase< OutputType >::get_d2phi(), libMesh::DiffContext::get_dof_indices(), get_elem_dim(), and libMesh::DiffContext::get_elem_fixed_solution().

◆ fixed_point_value() [1/2]

Number libMesh::FEMContext::fixed_point_value ( unsigned int  var,
const Point p 
) const
Returns
The value of the fixed_solution variable var at the physical point p on the current element.
Note
This API is currently present for backward compatibility.

Definition at line 1168 of file fem_context.C.

1169 {
1170  Number u = 0.;
1171 
1172  this->fixed_point_value( var, p, u );
1173 
1174  return u;
1175 }

◆ fixed_point_value() [2/2]

template<typename OutputType >
void libMesh::FEMContext::fixed_point_value ( unsigned int  var,
const Point p,
OutputType &  u,
const Real  tolerance = TOLERANCE 
) const
Returns
The value of the fixed_solution variable var at the physical point p on the current element.
Note
This is the preferred API.

Allows evaluation of points within a relative tolerance outside the element.

Definition at line 1178 of file fem_context.C.

1182 {
1183  typedef typename TensorTools::MakeReal<OutputType>::type OutputShape;
1184 
1185  // Get local-to-global dof index lookup
1186  const unsigned int n_dofs = cast_int<unsigned int>
1187  (this->get_dof_indices(var).size());
1188 
1189  // Get current local coefficients
1190  libmesh_assert_greater (_elem_fixed_subsolutions.size(), var);
1191  const DenseSubVector<Number> & coef = this->get_elem_fixed_solution(var);
1192 
1193  // Get finite element object
1194  FEGenericBase<OutputShape> * fe = nullptr;
1195  this->get_element_fe<OutputShape>( var, fe, this->get_elem_dim() );
1196 
1197  // Build a FE for calculating u(p)
1198  FEGenericBase<OutputShape> * fe_new =
1199  this->build_new_fe( fe, p, tolerance );
1200 
1201  // Get the values of the shape function derivatives
1202  const std::vector<std::vector<OutputShape>> & phi = fe_new->get_phi();
1203 
1204  u = 0.;
1205 
1206  for (unsigned int l=0; l != n_dofs; l++)
1207  u += phi[l][0] * coef(l);
1208 
1209  return;
1210 }

References libMesh::DiffContext::_elem_fixed_subsolutions, build_new_fe(), libMesh::DiffContext::get_dof_indices(), get_elem_dim(), libMesh::DiffContext::get_elem_fixed_solution(), and libMesh::FEGenericBase< OutputType >::get_phi().

◆ fixed_side_gradient() [1/2]

Gradient libMesh::FEMContext::fixed_side_gradient ( unsigned int  var,
unsigned int  qp 
) const
Returns
The gradient of the fixed_solution variable var at the quadrature point qp on the current element side.
Note
This API is currently present for backward compatibility.

Definition at line 1118 of file fem_context.C.

1119 {
1120  Gradient du;
1121 
1122  this->fixed_side_gradient( var, qp, du );
1123 
1124  return du;
1125 }

◆ fixed_side_gradient() [2/2]

template<typename OutputType >
void libMesh::FEMContext::fixed_side_gradient ( unsigned int  var,
unsigned int  qp,
OutputType &  grad_u 
) const
Returns
The gradient of the fixed_solution variable var at the quadrature point qp on the current element side.
Note
This is the preferred API.

Definition at line 1129 of file fem_context.C.

1131 {
1132  this->some_gradient<OutputType,
1134  <typename TensorTools::MakeReal
1135  <typename TensorTools::DecrementRank
1136  <OutputType>::type>::type>,
1137  &DiffContext::get_elem_fixed_solution>(var, qp, du);
1138 }

References libMesh::DiffContext::get_elem_fixed_solution(), get_side_fe(), and some_gradient().

◆ fixed_side_hessian() [1/2]

Tensor libMesh::FEMContext::fixed_side_hessian ( unsigned int  var,
unsigned int  qp 
) const
Returns
The hessian of the fixed_solution variable var at the quadrature point qp on the current element side.
Note
This API is currently present for backward compatibility.

Definition at line 1143 of file fem_context.C.

1144 {
1145  Tensor d2u;
1146 
1147  this->fixed_side_hessian( var, qp, d2u );
1148 
1149  return d2u;
1150 }

◆ fixed_side_hessian() [2/2]

template<typename OutputType >
void libMesh::FEMContext::fixed_side_hessian ( unsigned int  var,
unsigned int  qp,
OutputType &  hess_u 
) const
Returns
The hessian of the fixed_solution variable var at the quadrature point qp on the current element side.
Note
This is the preferred API.

Definition at line 1153 of file fem_context.C.

1155 {
1156  this->some_hessian<OutputType,
1158  <typename TensorTools::MakeReal
1159  <typename TensorTools::DecrementRank
1160  <typename TensorTools::DecrementRank
1161  <OutputType>::type>::type>::type>,
1162  &DiffContext::get_elem_fixed_solution>(var, qp, d2u);
1163 }

References libMesh::DiffContext::get_elem_fixed_solution(), get_side_fe(), and some_hessian().

◆ fixed_side_value() [1/2]

Number libMesh::FEMContext::fixed_side_value ( unsigned int  var,
unsigned int  qp 
) const
Returns
The value of the fixed_solution variable var at the quadrature point qp on the current element side.
Note
This API is currently present for backward compatibility.

Definition at line 1094 of file fem_context.C.

1095 {
1096  Number u = 0.;
1097 
1098  this->fixed_side_value( var, qp, u );
1099 
1100  return u;
1101 }

◆ fixed_side_value() [2/2]

template<typename OutputType >
void libMesh::FEMContext::fixed_side_value ( unsigned int  var,
unsigned int  qp,
OutputType &  u 
) const
Returns
The value of the fixed_solution variable var at the quadrature point qp on the current element side.
Note
This is the preferred API.

Definition at line 1105 of file fem_context.C.

1107 {
1108  this->some_value
1109  <OutputType,
1113  (var, qp, u);
1114 }

References libMesh::DiffContext::get_elem_fixed_solution(), get_side_fe(), and some_value().

◆ get_deltat_value()

Real libMesh::DiffContext::get_deltat_value ( )
inherited
Returns
The value currently pointed to by this class's _deltat member

Definition at line 111 of file diff_context.C.

112 {
114 
115  return *_deltat;
116 }

References libMesh::DiffContext::_deltat, and libMesh::libmesh_assert().

Referenced by _update_time_from_system().

◆ get_dim()

unsigned char libMesh::FEMContext::get_dim ( ) const
inline

Accessor for cached mesh dimension.

This is the largest dimension of the elements in the mesh. For the dimension of this->_elem, use get_elem_dim();

Definition at line 924 of file fem_context.h.

925  { return this->_dim; }

References _dim.

Referenced by get_element_fe(), get_side_fe(), libMesh::DGFEMContext::neighbor_side_fe_reinit(), and SolidSystem::side_time_derivative().

◆ get_dof_indices() [1/4]

std::vector<dof_id_type>& libMesh::DiffContext::get_dof_indices ( )
inlineinherited

Non-const accessor for element dof indices.

Definition at line 373 of file diff_context.h.

374  { return _dof_indices; }

References libMesh::DiffContext::_dof_indices.

◆ get_dof_indices() [2/4]

const std::vector<dof_id_type>& libMesh::DiffContext::get_dof_indices ( ) const
inlineinherited

Accessor for element dof indices.

Definition at line 367 of file diff_context.h.

368  { return _dof_indices; }

References libMesh::DiffContext::_dof_indices.

Referenced by libMesh::EulerSolver::_general_residual(), libMesh::Euler2Solver::_general_residual(), libMesh::NewmarkSolver::_general_residual(), libMesh::RBConstruction::add_scaled_matrix_and_vector(), assembly_with_dg_fem_context(), AssemblyA0::boundary_assembly(), AssemblyF0::boundary_assembly(), AssemblyA1::boundary_assembly(), AssemblyF1::boundary_assembly(), AssemblyF2::boundary_assembly(), A2::boundary_assembly(), AssemblyA2::boundary_assembly(), A3::boundary_assembly(), F0::boundary_assembly(), Output0::boundary_assembly(), libMesh::FirstOrderUnsteadySolver::compute_second_order_eqns(), SecondOrderScalarSystemSecondOrderTimeSolverBase::damping_residual(), SecondOrderScalarSystemFirstOrderTimeSolverBase::damping_residual(), FirstOrderScalarSystemBase::element_time_derivative(), SecondOrderScalarSystemFirstOrderTimeSolverBase::element_time_derivative(), fixed_point_gradient(), fixed_point_hessian(), fixed_point_value(), A0::interior_assembly(), B::interior_assembly(), M0::interior_assembly(), A1::interior_assembly(), AssemblyA0::interior_assembly(), EIM_IP_assembly::interior_assembly(), AcousticsInnerProduct::interior_assembly(), AssemblyA1::interior_assembly(), A2::interior_assembly(), AssemblyA2::interior_assembly(), EIM_F::interior_assembly(), F0::interior_assembly(), OutputAssembly::interior_assembly(), InnerProductAssembly::interior_assembly(), AssemblyEIM::interior_assembly(), AssemblyF0::interior_assembly(), AssemblyF1::interior_assembly(), Ex6InnerProduct::interior_assembly(), Ex6EIMInnerProduct::interior_assembly(), interior_curl(), interior_div(), interior_gradients(), interior_hessians(), interior_values(), libMesh::FEMPhysics::mass_residual(), FirstOrderScalarSystemBase::mass_residual(), SecondOrderScalarSystemSecondOrderTimeSolverBase::mass_residual(), SecondOrderScalarSystemFirstOrderTimeSolverBase::mass_residual(), libMesh::FEMSystem::mesh_position_get(), libMesh::DGFEMContext::neighbor_side_fe_reinit(), libMesh::DifferentiablePhysics::nonlocal_mass_residual(), libMesh::FEMSystem::numerical_jacobian(), point_curl(), point_gradient(), point_hessian(), point_value(), pre_fe_reinit(), OverlappingCouplingGhostingTest::run_sparsity_pattern_test(), side_gradient(), side_gradients(), side_hessians(), side_values(), some_gradient(), some_hessian(), some_value(), and libMesh::RBEIMConstruction::truth_solve().

◆ get_dof_indices() [3/4]

std::vector<dof_id_type>& libMesh::DiffContext::get_dof_indices ( unsigned int  var)
inlineinherited

Accessor for element dof indices of a particular variable corresponding to the index argument.

Definition at line 390 of file diff_context.h.

391  {
392  libmesh_assert_greater(_dof_indices_var.size(), var);
393  return _dof_indices_var[var];
394  }

References libMesh::DiffContext::_dof_indices_var.

◆ get_dof_indices() [4/4]

const std::vector<dof_id_type>& libMesh::DiffContext::get_dof_indices ( unsigned int  var) const
inlineinherited

Accessor for element dof indices of a particular variable corresponding to the index argument.

Definition at line 380 of file diff_context.h.

381  {
382  libmesh_assert_greater(_dof_indices_var.size(), var);
383  return _dof_indices_var[var];
384  }

References libMesh::DiffContext::_dof_indices_var.

◆ get_edge()

unsigned char libMesh::FEMContext::get_edge ( ) const
inline

Accessor for current edge of Elem object.

Definition at line 916 of file fem_context.h.

917  { return edge; }

References edge.

Referenced by edge_fe_reinit().

◆ get_edge_fe() [1/2]

FEBase * libMesh::FEMContext::get_edge_fe ( unsigned int  var) const
inline

Accessor for edge (3D only!) finite element object for scalar-valued variable var.

Definition at line 1289 of file fem_context.h.

1290 {
1291  libmesh_assert_less ( var, _edge_fe_var.size() );
1292  return cast_ptr<FEBase *>( _edge_fe_var[var] );
1293 }

References _edge_fe_var.

◆ get_edge_fe() [2/2]

template<typename OutputShape >
void libMesh::FEMContext::get_edge_fe ( unsigned int  var,
FEGenericBase< OutputShape > *&  fe 
) const
inline

Accessor for edge (3D only!) finite element object for variable var.

Definition at line 1282 of file fem_context.h.

1283 {
1284  libmesh_assert_less ( var, _edge_fe_var.size() );
1285  fe = cast_ptr<FEGenericBase<OutputShape> *>( _edge_fe_var[var] );
1286 }

References _edge_fe_var.

◆ get_edge_qrule()

const QBase& libMesh::FEMContext::get_edge_qrule ( ) const
inline

Accessor for element edge quadrature rule.

Definition at line 819 of file fem_context.h.

820  { return *(this->_edge_qrule); }

References _edge_qrule.

◆ get_elem() [1/2]

Elem& libMesh::FEMContext::get_elem ( )
inline

Accessor for current Elem object.

Definition at line 903 of file fem_context.h.

904  { libmesh_assert(this->_elem);
905  return *(const_cast<Elem *>(this->_elem)); }

References _elem, and libMesh::libmesh_assert().

◆ get_elem() [2/2]

const Elem& libMesh::FEMContext::get_elem ( ) const
inline

◆ get_elem_dim()

unsigned char libMesh::FEMContext::get_elem_dim ( ) const
inline

◆ get_elem_fixed_solution() [1/4]

DenseVector<Number>& libMesh::DiffContext::get_elem_fixed_solution ( )
inlineinherited

Non-const accessor for element fixed solution.

Definition at line 221 of file diff_context.h.

222  { return _elem_fixed_solution; }

References libMesh::DiffContext::_elem_fixed_solution.

◆ get_elem_fixed_solution() [2/4]

const DenseVector<Number>& libMesh::DiffContext::get_elem_fixed_solution ( ) const
inlineinherited

◆ get_elem_fixed_solution() [3/4]

DenseSubVector<Number>& libMesh::DiffContext::get_elem_fixed_solution ( unsigned int  var)
inlineinherited

Accessor for element fixed solution of a particular variable corresponding to the variable index argument.

Definition at line 239 of file diff_context.h.

240  {
241  libmesh_assert_greater(_elem_fixed_subsolutions.size(), var);
243  return *(_elem_fixed_subsolutions[var]);
244  }

References libMesh::DiffContext::_elem_fixed_subsolutions, and libMesh::libmesh_assert().

◆ get_elem_fixed_solution() [4/4]

const DenseSubVector<Number>& libMesh::DiffContext::get_elem_fixed_solution ( unsigned int  var) const
inlineinherited

Accessor for element fixed solution of a particular variable corresponding to the variable index argument.

Definition at line 228 of file diff_context.h.

229  {
230  libmesh_assert_greater(_elem_fixed_subsolutions.size(), var);
232  return *(_elem_fixed_subsolutions[var]);
233  }

References libMesh::DiffContext::_elem_fixed_subsolutions, and libMesh::libmesh_assert().

◆ get_elem_jacobian() [1/4]

DenseMatrix<Number>& libMesh::DiffContext::get_elem_jacobian ( )
inlineinherited

Non-const accessor for element Jacobian.

Definition at line 289 of file diff_context.h.

290  { return _elem_jacobian; }

References libMesh::DiffContext::_elem_jacobian.

◆ get_elem_jacobian() [2/4]

const DenseMatrix<Number>& libMesh::DiffContext::get_elem_jacobian ( ) const
inlineinherited

Const accessor for element Jacobian.

Definition at line 283 of file diff_context.h.

284  { return _elem_jacobian; }

References libMesh::DiffContext::_elem_jacobian.

Referenced by libMesh::EulerSolver::_general_residual(), libMesh::Euler2Solver::_general_residual(), libMesh::NewmarkSolver::_general_residual(), libMesh::RBConstruction::add_scaled_matrix_and_vector(), libMesh::FEMSystem::assembly(), assembly_with_dg_fem_context(), AssemblyA0::boundary_assembly(), AssemblyA1::boundary_assembly(), A2::boundary_assembly(), AssemblyA2::boundary_assembly(), A3::boundary_assembly(), libMesh::FirstOrderUnsteadySolver::compute_second_order_eqns(), SecondOrderScalarSystemSecondOrderTimeSolverBase::damping_residual(), SecondOrderScalarSystemFirstOrderTimeSolverBase::damping_residual(), NavierSystem::element_constraint(), CoupledSystem::element_constraint(), libMesh::EigenTimeSolver::element_residual(), NavierSystem::element_time_derivative(), SolidSystem::element_time_derivative(), PoissonSystem::element_time_derivative(), LaplaceSystem::element_time_derivative(), CurlCurlSystem::element_time_derivative(), ElasticitySystem::element_time_derivative(), L2System::element_time_derivative(), CoupledSystem::element_time_derivative(), B::interior_assembly(), A0::interior_assembly(), M0::interior_assembly(), A1::interior_assembly(), AssemblyA0::interior_assembly(), EIM_IP_assembly::interior_assembly(), AcousticsInnerProduct::interior_assembly(), AssemblyA1::interior_assembly(), A2::interior_assembly(), AssemblyA2::interior_assembly(), InnerProductAssembly::interior_assembly(), AssemblyEIM::interior_assembly(), Ex6InnerProduct::interior_assembly(), Ex6EIMInnerProduct::interior_assembly(), NavierSystem::mass_residual(), ElasticitySystem::mass_residual(), libMesh::FEMPhysics::mass_residual(), FirstOrderScalarSystemBase::mass_residual(), SecondOrderScalarSystemSecondOrderTimeSolverBase::mass_residual(), SecondOrderScalarSystemFirstOrderTimeSolverBase::mass_residual(), libMesh::DifferentiablePhysics::nonlocal_mass_residual(), libMesh::EigenTimeSolver::nonlocal_residual(), libMesh::FEMSystem::numerical_jacobian(), pre_fe_reinit(), OverlappingCouplingGhostingTest::run_sparsity_pattern_test(), NavierSystem::side_constraint(), LaplaceSystem::side_constraint(), libMesh::EigenTimeSolver::side_residual(), SolidSystem::side_time_derivative(), and CurlCurlSystem::side_time_derivative().

◆ get_elem_jacobian() [3/4]

DenseSubMatrix<Number>& libMesh::DiffContext::get_elem_jacobian ( unsigned int  var1,
unsigned int  var2 
)
inlineinherited

Non-const accessor for element Jacobian of particular variables corresponding to the variable index arguments.

Definition at line 308 of file diff_context.h.

309  {
310  libmesh_assert_greater(_elem_subjacobians.size(), var1);
311  libmesh_assert_greater(_elem_subjacobians[var1].size(), var2);
312  libmesh_assert(_elem_subjacobians[var1][var2]);
313  return *(_elem_subjacobians[var1][var2]);
314  }

References libMesh::DiffContext::_elem_subjacobians, and libMesh::libmesh_assert().

◆ get_elem_jacobian() [4/4]

const DenseSubMatrix<Number>& libMesh::DiffContext::get_elem_jacobian ( unsigned int  var1,
unsigned int  var2 
) const
inlineinherited

Const accessor for element Jacobian of particular variables corresponding to the variable index arguments.

Definition at line 296 of file diff_context.h.

297  {
298  libmesh_assert_greater(_elem_subjacobians.size(), var1);
299  libmesh_assert_greater(_elem_subjacobians[var1].size(), var2);
300  libmesh_assert(_elem_subjacobians[var1][var2]);
301  return *(_elem_subjacobians[var1][var2]);
302  }

References libMesh::DiffContext::_elem_subjacobians, and libMesh::libmesh_assert().

◆ get_elem_residual() [1/4]

DenseVector<Number>& libMesh::DiffContext::get_elem_residual ( )
inlineinherited

Non-const accessor for element residual.

Definition at line 255 of file diff_context.h.

256  { return _elem_residual; }

References libMesh::DiffContext::_elem_residual.

◆ get_elem_residual() [2/4]

const DenseVector<Number>& libMesh::DiffContext::get_elem_residual ( ) const
inlineinherited

Const accessor for element residual.

Definition at line 249 of file diff_context.h.

250  { return _elem_residual; }

References libMesh::DiffContext::_elem_residual.

Referenced by libMesh::Euler2Solver::_general_residual(), libMesh::RBConstruction::add_scaled_matrix_and_vector(), libMesh::FEMSystem::assembly(), assembly_with_dg_fem_context(), AssemblyF0::boundary_assembly(), AssemblyF1::boundary_assembly(), AssemblyF2::boundary_assembly(), F0::boundary_assembly(), Output0::boundary_assembly(), libMesh::FirstOrderUnsteadySolver::compute_second_order_eqns(), SecondOrderScalarSystemSecondOrderTimeSolverBase::damping_residual(), SecondOrderScalarSystemFirstOrderTimeSolverBase::damping_residual(), NavierSystem::element_constraint(), CoupledSystem::element_constraint(), NavierSystem::element_time_derivative(), SolidSystem::element_time_derivative(), LaplaceSystem::element_time_derivative(), PoissonSystem::element_time_derivative(), CurlCurlSystem::element_time_derivative(), ElasticitySystem::element_time_derivative(), L2System::element_time_derivative(), CoupledSystem::element_time_derivative(), FirstOrderScalarSystemBase::element_time_derivative(), SecondOrderScalarSystemFirstOrderTimeSolverBase::element_time_derivative(), EIM_F::interior_assembly(), F0::interior_assembly(), OutputAssembly::interior_assembly(), AssemblyF0::interior_assembly(), AssemblyF1::interior_assembly(), NavierSystem::mass_residual(), ElasticitySystem::mass_residual(), libMesh::FEMPhysics::mass_residual(), FirstOrderScalarSystemBase::mass_residual(), SecondOrderScalarSystemSecondOrderTimeSolverBase::mass_residual(), SecondOrderScalarSystemFirstOrderTimeSolverBase::mass_residual(), libMesh::DifferentiablePhysics::nonlocal_mass_residual(), libMesh::FEMSystem::numerical_jacobian(), pre_fe_reinit(), NavierSystem::side_constraint(), LaplaceSystem::side_constraint(), SolidSystem::side_time_derivative(), CurlCurlSystem::side_time_derivative(), ElasticitySystem::side_time_derivative(), and libMesh::RBEIMConstruction::truth_solve().

◆ get_elem_residual() [3/4]

DenseSubVector<Number>& libMesh::DiffContext::get_elem_residual ( unsigned int  var)
inlineinherited

Non-const accessor for element residual of a particular variable corresponding to the variable index argument.

Definition at line 273 of file diff_context.h.

274  {
275  libmesh_assert_greater(_elem_subresiduals.size(), var);
277  return *(_elem_subresiduals[var]);
278  }

References libMesh::DiffContext::_elem_subresiduals, and libMesh::libmesh_assert().

◆ get_elem_residual() [4/4]

const DenseSubVector<Number>& libMesh::DiffContext::get_elem_residual ( unsigned int  var) const
inlineinherited

Const accessor for element residual of a particular variable corresponding to the variable index argument.

Definition at line 262 of file diff_context.h.

263  {
264  libmesh_assert_greater(_elem_subresiduals.size(), var);
266  return *(_elem_subresiduals[var]);
267  }

References libMesh::DiffContext::_elem_subresiduals, and libMesh::libmesh_assert().

◆ get_elem_solution() [1/4]

DenseVector<Number>& libMesh::DiffContext::get_elem_solution ( )
inlineinherited

Non-const accessor for element solution.

Definition at line 117 of file diff_context.h.

118  { return _elem_solution; }

References libMesh::DiffContext::_elem_solution.

◆ get_elem_solution() [2/4]

const DenseVector<Number>& libMesh::DiffContext::get_elem_solution ( ) const
inlineinherited

◆ get_elem_solution() [3/4]

DenseSubVector<Number>& libMesh::DiffContext::get_elem_solution ( unsigned int  var)
inlineinherited

Accessor for element solution of a particular variable corresponding to the variable index argument.

Definition at line 135 of file diff_context.h.

136  {
137  libmesh_assert_greater(_elem_subsolutions.size(), var);
139  return *(_elem_subsolutions[var]);
140  }

References libMesh::DiffContext::_elem_subsolutions, and libMesh::libmesh_assert().

◆ get_elem_solution() [4/4]

const DenseSubVector<Number>& libMesh::DiffContext::get_elem_solution ( unsigned int  var) const
inlineinherited

Accessor for element solution of a particular variable corresponding to the variable index argument.

Definition at line 124 of file diff_context.h.

125  {
126  libmesh_assert_greater(_elem_subsolutions.size(), var);
128  return *(_elem_subsolutions[var]);
129  }

References libMesh::DiffContext::_elem_subsolutions, and libMesh::libmesh_assert().

◆ get_elem_solution_accel() [1/4]

DenseVector<Number>& libMesh::DiffContext::get_elem_solution_accel ( )
inlineinherited

Non-const accessor for element solution accel of change w.r.t.

time.

Definition at line 187 of file diff_context.h.

188  { return _elem_solution_accel; }

References libMesh::DiffContext::_elem_solution_accel.

◆ get_elem_solution_accel() [2/4]

const DenseVector<Number>& libMesh::DiffContext::get_elem_solution_accel ( ) const
inlineinherited

Accessor for element solution accel of change w.r.t.

time.

Definition at line 180 of file diff_context.h.

181  { return _elem_solution_accel; }

References libMesh::DiffContext::_elem_solution_accel.

Referenced by libMesh::NewmarkSolver::_general_residual(), interior_accel(), pre_fe_reinit(), libMesh::FirstOrderUnsteadySolver::prepare_accel(), and side_accel().

◆ get_elem_solution_accel() [3/4]

DenseSubVector<Number>& libMesh::DiffContext::get_elem_solution_accel ( unsigned int  var)
inlineinherited

Accessor for element solution accel for a particular variable corresponding to the variable index argument.

Definition at line 205 of file diff_context.h.

206  {
207  libmesh_assert_greater(_elem_subsolution_accels.size(), var);
209  return *(_elem_subsolution_accels[var]);
210  }

References libMesh::DiffContext::_elem_subsolution_accels, and libMesh::libmesh_assert().

◆ get_elem_solution_accel() [4/4]

const DenseSubVector<Number>& libMesh::DiffContext::get_elem_solution_accel ( unsigned int  var) const
inlineinherited

Accessor for element solution accel for a particular variable corresponding to the variable index argument.

Definition at line 194 of file diff_context.h.

195  {
196  libmesh_assert_greater(_elem_subsolution_accels.size(), var);
198  return *(_elem_subsolution_accels[var]);
199  }

References libMesh::DiffContext::_elem_subsolution_accels, and libMesh::libmesh_assert().

◆ get_elem_solution_accel_derivative()

Real libMesh::DiffContext::get_elem_solution_accel_derivative ( ) const
inlineinherited

The derivative of the current elem_solution_accel w.r.t.

the unknown solution. Corresponding Jacobian contributions should be multiplied by this amount, or may be skipped if get_elem_solution_accel_derivative() is 0.

Definition at line 454 of file diff_context.h.

References libMesh::DiffContext::elem_solution_accel_derivative.

Referenced by ElasticitySystem::mass_residual(), SecondOrderScalarSystemSecondOrderTimeSolverBase::mass_residual(), and SecondOrderScalarSystemFirstOrderTimeSolverBase::mass_residual().

◆ get_elem_solution_derivative()

Real libMesh::DiffContext::get_elem_solution_derivative ( ) const
inlineinherited

The derivative of the current elem_solution w.r.t.

the unknown solution. Corresponding Jacobian contributions should be multiplied by this amount, or may be skipped if get_elem_solution_derivative() is 0.

Definition at line 436 of file diff_context.h.

437  { return elem_solution_derivative; }

References libMesh::DiffContext::elem_solution_derivative.

Referenced by libMesh::FirstOrderUnsteadySolver::compute_second_order_eqns(), NavierSystem::element_constraint(), ElasticitySystem::element_time_derivative(), L2System::element_time_derivative(), NavierSystem::mass_residual(), and NavierSystem::side_constraint().

◆ get_elem_solution_rate() [1/4]

DenseVector<Number>& libMesh::DiffContext::get_elem_solution_rate ( )
inlineinherited

Non-const accessor for element solution rate of change w.r.t.

time.

Definition at line 152 of file diff_context.h.

153  { return _elem_solution_rate; }

References libMesh::DiffContext::_elem_solution_rate.

◆ get_elem_solution_rate() [2/4]

const DenseVector<Number>& libMesh::DiffContext::get_elem_solution_rate ( ) const
inlineinherited

◆ get_elem_solution_rate() [3/4]

DenseSubVector<Number>& libMesh::DiffContext::get_elem_solution_rate ( unsigned int  var)
inlineinherited

Accessor for element solution rate for a particular variable corresponding to the variable index argument.

Definition at line 170 of file diff_context.h.

171  {
172  libmesh_assert_greater(_elem_subsolution_rates.size(), var);
174  return *(_elem_subsolution_rates[var]);
175  }

References libMesh::DiffContext::_elem_subsolution_rates, and libMesh::libmesh_assert().

◆ get_elem_solution_rate() [4/4]

const DenseSubVector<Number>& libMesh::DiffContext::get_elem_solution_rate ( unsigned int  var) const
inlineinherited

Accessor for element solution rate for a particular variable corresponding to the variable index argument.

Definition at line 159 of file diff_context.h.

160  {
161  libmesh_assert_greater(_elem_subsolution_rates.size(), var);
163  return *(_elem_subsolution_rates[var]);
164  }

References libMesh::DiffContext::_elem_subsolution_rates, and libMesh::libmesh_assert().

◆ get_elem_solution_rate_derivative()

Real libMesh::DiffContext::get_elem_solution_rate_derivative ( ) const
inlineinherited

◆ get_element_fe() [1/4]

FEBase* libMesh::FEMContext::get_element_fe ( unsigned int  var) const
inline

Accessor for interior finite element object for scalar-valued variable var for the largest dimension in the mesh.

We default to the largest mesh dim because this method may be called before the Elem * is set in the FEMContext, e.g. in FEMSystem::init_context (or a subclass). If you have lower dimensional elements in the mesh and need to query for those FE objects, use the alternative get_element_fe method.

Definition at line 286 of file fem_context.h.

287  { return this->get_element_fe(var,this->get_dim()); }

References get_dim(), and get_element_fe().

◆ get_element_fe() [2/4]

template<typename OutputShape >
void libMesh::FEMContext::get_element_fe ( unsigned int  var,
FEGenericBase< OutputShape > *&  fe 
) const
inline

Accessor for interior finite element object for variable var for the largest dimension in the mesh.

We default to the largest mesh dim because this method may be called before the Elem * is set in the FEMContext, e.g. in FEMSystem::init_context (or a subclass). If you have lower dimensional elements in the mesh and need to query for those FE objects, use the alternative get_element_fe method.

Definition at line 275 of file fem_context.h.

276  { this->get_element_fe<OutputShape>(var,fe,this->get_dim()); }

References get_dim().

Referenced by _do_elem_position_set(), libMesh::RBConstruction::add_scaled_matrix_and_vector(), assembly_with_dg_fem_context(), libMesh::FirstOrderUnsteadySolver::compute_second_order_eqns(), elem_position_get(), NavierSystem::element_constraint(), CoupledSystem::element_constraint(), PoissonSystem::element_postprocess(), LaplaceSystem::element_postprocess(), LaplaceQoI::element_qoi(), LaplaceQoI::element_qoi_derivative(), LaplaceSystem::element_qoi_derivative(), HeatSystem::element_qoi_derivative(), NavierSystem::element_time_derivative(), SolidSystem::element_time_derivative(), LaplaceSystem::element_time_derivative(), PoissonSystem::element_time_derivative(), CurlCurlSystem::element_time_derivative(), ElasticitySystem::element_time_derivative(), L2System::element_time_derivative(), CoupledSystem::element_time_derivative(), libMesh::RBEIMConstruction::enrich_RB_space(), fixed_interior_gradient(), fixed_interior_hessian(), fixed_interior_value(), get_element_fe(), LaplaceQoI::init_context(), NavierSystem::init_context(), SolidSystem::init_context(), LaplaceSystem::init_context(), PoissonSystem::init_context(), CurlCurlSystem::init_context(), ElasticitySystem::init_context(), L2System::init_context(), CoupledSystem::init_context(), libMesh::ParsedFEMFunction< T >::init_context(), ElasticityRBConstruction::init_context(), SimpleRBConstruction::init_context(), libMesh::FEMSystem::init_context(), libMesh::RBEIMConstruction::init_context_with_sys(), interior_accel(), B::interior_assembly(), A0::interior_assembly(), M0::interior_assembly(), A1::interior_assembly(), AssemblyA0::interior_assembly(), EIM_IP_assembly::interior_assembly(), AcousticsInnerProduct::interior_assembly(), AssemblyA1::interior_assembly(), A2::interior_assembly(), AssemblyA2::interior_assembly(), EIM_F::interior_assembly(), F0::interior_assembly(), OutputAssembly::interior_assembly(), InnerProductAssembly::interior_assembly(), AssemblyEIM::interior_assembly(), AssemblyF0::interior_assembly(), AssemblyF1::interior_assembly(), Ex6InnerProduct::interior_assembly(), Ex6EIMInnerProduct::interior_assembly(), interior_gradient(), interior_hessian(), interior_rate(), interior_rate_gradient(), NavierSystem::mass_residual(), ElasticitySystem::mass_residual(), libMesh::FEMPhysics::mass_residual(), OverlappingAlgebraicGhostingTest::run_ghosting_test(), OverlappingCouplingGhostingTest::run_sparsity_pattern_test(), NavierSystem::side_constraint(), and libMesh::RBEIMConstruction::truth_solve().

◆ get_element_fe() [3/4]

template<typename OutputShape >
void libMesh::FEMContext::get_element_fe ( unsigned int  var,
FEGenericBase< OutputShape > *&  fe,
unsigned short  dim 
) const
inline

Accessor for interior finite element object for variable var for dimension dim.

Definition at line 1246 of file fem_context.h.

1248 {
1249  libmesh_assert( !_element_fe_var[dim].empty() );
1250  libmesh_assert_less ( var, (_element_fe_var[dim].size() ) );
1251  fe = cast_ptr<FEGenericBase<OutputShape> *>( (_element_fe_var[dim][var] ) );
1252 }

References _element_fe_var, dim, and libMesh::libmesh_assert().

◆ get_element_fe() [4/4]

FEBase * libMesh::FEMContext::get_element_fe ( unsigned int  var,
unsigned short  dim 
) const
inline

Accessor for interior finite element object for scalar-valued variable var for dimension dim.

Definition at line 1255 of file fem_context.h.

1256 {
1257  libmesh_assert( !_element_fe_var[dim].empty() );
1258  libmesh_assert_less ( var, (_element_fe_var[dim].size() ) );
1259  return cast_ptr<FEBase *>( (_element_fe_var[dim][var] ) );
1260 }

References _element_fe_var, dim, and libMesh::libmesh_assert().

◆ get_element_qrule() [1/2]

const QBase& libMesh::FEMContext::get_element_qrule ( ) const
inline

Accessor for element interior quadrature rule for the dimension of the current _elem.

Definition at line 790 of file fem_context.h.

791  { return this->get_element_qrule(this->get_elem_dim()); }

References get_elem_dim().

Referenced by assembly_with_dg_fem_context(), libMesh::FirstOrderUnsteadySolver::compute_second_order_eqns(), SecondOrderScalarSystemSecondOrderTimeSolverBase::damping_residual(), SecondOrderScalarSystemFirstOrderTimeSolverBase::damping_residual(), NavierSystem::element_constraint(), CoupledSystem::element_constraint(), PoissonSystem::element_postprocess(), LaplaceSystem::element_postprocess(), LaplaceQoI::element_qoi(), LaplaceQoI::element_qoi_derivative(), LaplaceSystem::element_qoi_derivative(), HeatSystem::element_qoi_derivative(), NavierSystem::element_time_derivative(), SolidSystem::element_time_derivative(), LaplaceSystem::element_time_derivative(), PoissonSystem::element_time_derivative(), CurlCurlSystem::element_time_derivative(), ElasticitySystem::element_time_derivative(), L2System::element_time_derivative(), CoupledSystem::element_time_derivative(), FirstOrderScalarSystemBase::element_time_derivative(), SecondOrderScalarSystemFirstOrderTimeSolverBase::element_time_derivative(), libMesh::RBEIMConstruction::enrich_RB_space(), libMesh::FEMPhysics::eulerian_residual(), A0::interior_assembly(), B::interior_assembly(), M0::interior_assembly(), A1::interior_assembly(), AssemblyA0::interior_assembly(), EIM_IP_assembly::interior_assembly(), AcousticsInnerProduct::interior_assembly(), AssemblyA1::interior_assembly(), A2::interior_assembly(), AssemblyA2::interior_assembly(), EIM_F::interior_assembly(), F0::interior_assembly(), OutputAssembly::interior_assembly(), InnerProductAssembly::interior_assembly(), AssemblyEIM::interior_assembly(), AssemblyF0::interior_assembly(), AssemblyF1::interior_assembly(), Ex6InnerProduct::interior_assembly(), Ex6EIMInnerProduct::interior_assembly(), NavierSystem::mass_residual(), ElasticitySystem::mass_residual(), libMesh::FEMPhysics::mass_residual(), FirstOrderScalarSystemBase::mass_residual(), SecondOrderScalarSystemSecondOrderTimeSolverBase::mass_residual(), SecondOrderScalarSystemFirstOrderTimeSolverBase::mass_residual(), and libMesh::RBEIMConstruction::truth_solve().

◆ get_element_qrule() [2/2]

const QBase& libMesh::FEMContext::get_element_qrule ( unsigned short  dim) const
inline

Accessor for element interior quadrature rule.

Definition at line 803 of file fem_context.h.

805  return *(this->_element_qrule[dim]); }

References _element_qrule, dim, and libMesh::libmesh_assert().

◆ get_fixed_solution_derivative()

Real libMesh::DiffContext::get_fixed_solution_derivative ( ) const
inlineinherited

The derivative of the current fixed_elem_solution w.r.t.

the unknown solution. Corresponding Jacobian contributions should be multiplied by this amount, or may be skipped if get_fixed_elem_solution_derivative() is 0.

Definition at line 463 of file diff_context.h.

464  { return fixed_solution_derivative; }

References libMesh::DiffContext::fixed_solution_derivative.

◆ get_localized_subvector() [1/2]

DenseSubVector< Number > & libMesh::DiffContext::get_localized_subvector ( const NumericVector< Number > &  localized_vector,
unsigned int  var 
)
inherited

Return a reference to DenseSubVector localization of localized_vector at variable var contained in the _localized_vectors map.

Definition at line 148 of file diff_context.C.

149 {
150  return *_localized_vectors[&localized_vector].second[var];
151 }

References libMesh::DiffContext::_localized_vectors.

Referenced by interior_gradients(), interior_hessians(), interior_values(), side_gradients(), side_hessians(), and side_values().

◆ get_localized_subvector() [2/2]

const DenseSubVector< Number > & libMesh::DiffContext::get_localized_subvector ( const NumericVector< Number > &  localized_vector,
unsigned int  var 
) const
inherited

const accessible version of get_localized_subvector function

Definition at line 154 of file diff_context.C.

155 {
156  auto localized_vectors_it = _localized_vectors.find(&localized_vector);
157  libmesh_assert(localized_vectors_it != _localized_vectors.end());
158  return *localized_vectors_it->second.second[var];
159 }

References libMesh::DiffContext::_localized_vectors, and libMesh::libmesh_assert().

◆ get_localized_vector() [1/2]

DenseVector< Number > & libMesh::DiffContext::get_localized_vector ( const NumericVector< Number > &  localized_vector)
inherited

Return a reference to DenseVector localization of localized_vector contained in the _localized_vectors map.

Definition at line 134 of file diff_context.C.

135 {
136  return _localized_vectors[&localized_vector].first;
137 }

References libMesh::DiffContext::_localized_vectors.

◆ get_localized_vector() [2/2]

const DenseVector< Number > & libMesh::DiffContext::get_localized_vector ( const NumericVector< Number > &  localized_vector) const
inherited

const accessible version of get_localized_vector function

Definition at line 140 of file diff_context.C.

141 {
142  auto localized_vectors_it = _localized_vectors.find(&localized_vector);
143  libmesh_assert(localized_vectors_it != _localized_vectors.end());
144  return localized_vectors_it->second.first;
145 }

References libMesh::DiffContext::_localized_vectors, and libMesh::libmesh_assert().

◆ get_mesh_system() [1/2]

System* libMesh::FEMContext::get_mesh_system ( )
inline

Accessor for moving mesh System.

Definition at line 842 of file fem_context.h.

843  { return this->_mesh_sys; }

References _mesh_sys.

◆ get_mesh_system() [2/2]

const System* libMesh::FEMContext::get_mesh_system ( ) const
inline

Accessor for moving mesh System.

Definition at line 836 of file fem_context.h.

837  { return this->_mesh_sys; }

References _mesh_sys.

◆ get_mesh_x_var()

unsigned int libMesh::FEMContext::get_mesh_x_var ( ) const
inline

Accessor for x-variable of moving mesh System.

Definition at line 848 of file fem_context.h.

849  { return _mesh_x_var; }

References _mesh_x_var.

Referenced by _do_elem_position_set(), and elem_position_get().

◆ get_mesh_y_var()

unsigned int libMesh::FEMContext::get_mesh_y_var ( ) const
inline

Accessor for y-variable of moving mesh System.

Definition at line 862 of file fem_context.h.

863  { return _mesh_y_var; }

References _mesh_y_var.

Referenced by _do_elem_position_set(), and elem_position_get().

◆ get_mesh_z_var()

unsigned int libMesh::FEMContext::get_mesh_z_var ( ) const
inline

Accessor for z-variable of moving mesh System.

Definition at line 876 of file fem_context.h.

877  { return _mesh_z_var; }

References _mesh_z_var.

Referenced by _do_elem_position_set(), and elem_position_get().

◆ get_qoi_derivatives() [1/4]

std::vector<DenseVector<Number> >& libMesh::DiffContext::get_qoi_derivatives ( )
inlineinherited

Non-const accessor for QoI derivatives.

Definition at line 337 of file diff_context.h.

338  { return _elem_qoi_derivative; }

References libMesh::DiffContext::_elem_qoi_derivative.

◆ get_qoi_derivatives() [2/4]

const std::vector<DenseVector<Number> >& libMesh::DiffContext::get_qoi_derivatives ( ) const
inlineinherited

◆ get_qoi_derivatives() [3/4]

DenseSubVector<Number>& libMesh::DiffContext::get_qoi_derivatives ( std::size_t  qoi,
unsigned int  var 
)
inlineinherited

Non-const accessor for QoI derivative of a particular qoi and variable corresponding to the index arguments.

Definition at line 356 of file diff_context.h.

357  {
358  libmesh_assert_greater(_elem_qoi_subderivatives.size(), qoi);
359  libmesh_assert_greater(_elem_qoi_subderivatives[qoi].size(), var);
361  return *(_elem_qoi_subderivatives[qoi][var]);
362  }

References libMesh::DiffContext::_elem_qoi_subderivatives, and libMesh::libmesh_assert().

◆ get_qoi_derivatives() [4/4]

const DenseSubVector<Number>& libMesh::DiffContext::get_qoi_derivatives ( std::size_t  qoi,
unsigned int  var 
) const
inlineinherited

Const accessor for QoI derivative of a particular qoi and variable corresponding to the index arguments.

Definition at line 344 of file diff_context.h.

345  {
346  libmesh_assert_greater(_elem_qoi_subderivatives.size(), qoi);
347  libmesh_assert_greater(_elem_qoi_subderivatives[qoi].size(), var);
349  return *(_elem_qoi_subderivatives[qoi][var]);
350  }

References libMesh::DiffContext::_elem_qoi_subderivatives, and libMesh::libmesh_assert().

◆ get_qois() [1/2]

std::vector<Number>& libMesh::DiffContext::get_qois ( )
inlineinherited

Non-const accessor for QoI vector.

Definition at line 325 of file diff_context.h.

326  { return _elem_qoi; }

References libMesh::DiffContext::_elem_qoi.

◆ get_qois() [2/2]

const std::vector<Number>& libMesh::DiffContext::get_qois ( ) const
inlineinherited

Const accessor for QoI vector.

Definition at line 319 of file diff_context.h.

320  { return _elem_qoi; }

References libMesh::DiffContext::_elem_qoi.

Referenced by LaplaceQoI::element_qoi(), and CoupledSystemQoI::side_qoi().

◆ get_side()

unsigned char libMesh::FEMContext::get_side ( ) const
inline

Accessor for current side of Elem object.

Definition at line 910 of file fem_context.h.

911  { return side; }

References side.

Referenced by libMesh::RBConstruction::add_scaled_matrix_and_vector(), assembly_with_dg_fem_context(), side_fe_reinit(), and SolidSystem::side_time_derivative().

◆ get_side_fe() [1/4]

FEBase* libMesh::FEMContext::get_side_fe ( unsigned int  var) const
inline

Accessor for side finite element object for scalar-valued variable var for the largest dimension in the mesh.

We default to the largest mesh dim because this method may be called before the Elem * is set in the FEMContext, e.g. in FEMSystem::init_context (or a subclass). If you have lower dimensional elements in the mesh and need to query for those FE objects, use the alternative get_side_fe method.

Definition at line 323 of file fem_context.h.

324  { return this->get_side_fe(var,this->get_dim()); }

References get_dim(), and get_side_fe().

◆ get_side_fe() [2/4]

template<typename OutputShape >
void libMesh::FEMContext::get_side_fe ( unsigned int  var,
FEGenericBase< OutputShape > *&  fe 
) const
inline

Accessor for edge/face (2D/3D) finite element object for variable var for the largest dimension in the mesh.

We default to the largest mesh dim because this method may be called before the Elem * is set in the FEMContext, e.g. in FEMSystem::init_context (or a subclass). If you have lower dimensional elements in the mesh and need to query for those FE objects, use the alternative get_side_fe method.

Definition at line 312 of file fem_context.h.

313  { this->get_side_fe<OutputShape>(var,fe,this->get_dim()); }

References get_dim().

Referenced by assembly_with_dg_fem_context(), AssemblyA0::boundary_assembly(), AssemblyF0::boundary_assembly(), AssemblyA1::boundary_assembly(), AssemblyF1::boundary_assembly(), AssemblyF2::boundary_assembly(), A2::boundary_assembly(), AssemblyA2::boundary_assembly(), A3::boundary_assembly(), F0::boundary_assembly(), Output0::boundary_assembly(), libMesh::ParsedFEMFunction< T >::eval_args(), fixed_side_gradient(), fixed_side_hessian(), fixed_side_value(), get_side_fe(), NavierSystem::init_context(), SolidSystem::init_context(), PoissonSystem::init_context(), LaplaceSystem::init_context(), CurlCurlSystem::init_context(), ElasticitySystem::init_context(), CoupledSystem::init_context(), libMesh::ParsedFEMFunction< T >::init_context(), SimpleRBConstruction::init_context(), side_accel(), LaplaceSystem::side_constraint(), side_hessian(), LaplaceSystem::side_postprocess(), CoupledSystemQoI::side_qoi(), CoupledSystemQoI::side_qoi_derivative(), LaplaceSystem::side_qoi_derivative(), side_rate(), SolidSystem::side_time_derivative(), CurlCurlSystem::side_time_derivative(), and ElasticitySystem::side_time_derivative().

◆ get_side_fe() [3/4]

template<typename OutputShape >
void libMesh::FEMContext::get_side_fe ( unsigned int  var,
FEGenericBase< OutputShape > *&  fe,
unsigned short  dim 
) const
inline

Accessor for edge/face (2D/3D) finite element object for variable var for dimension dim.

Definition at line 1264 of file fem_context.h.

1266 {
1267  libmesh_assert( !_side_fe_var[dim].empty() );
1268  libmesh_assert_less ( var, (_side_fe_var[dim].size() ) );
1269  fe = cast_ptr<FEGenericBase<OutputShape> *>( (_side_fe_var[dim][var] ) );
1270 }

References _side_fe_var, dim, and libMesh::libmesh_assert().

◆ get_side_fe() [4/4]

FEBase * libMesh::FEMContext::get_side_fe ( unsigned int  var,
unsigned short  dim 
) const
inline

Accessor for side finite element object for scalar-valued variable var for dimension dim.

Definition at line 1273 of file fem_context.h.

1274 {
1275  libmesh_assert( !_side_fe_var[dim].empty() );
1276  libmesh_assert_less ( var, (_side_fe_var[dim].size() ) );
1277  return cast_ptr<FEBase *>( (_side_fe_var[dim][var] ) );
1278 }

References _side_fe_var, dim, and libMesh::libmesh_assert().

◆ get_side_qrule() [1/2]

const QBase& libMesh::FEMContext::get_side_qrule ( ) const
inline

◆ get_side_qrule() [2/2]

const QBase& libMesh::FEMContext::get_side_qrule ( unsigned short  dim) const
inline

Accessor for element side quadrature rule.

Definition at line 810 of file fem_context.h.

811  {
813  return *(this->_side_qrule[dim]);
814  }

References _side_qrule, dim, and libMesh::libmesh_assert().

◆ get_system()

const System& libMesh::DiffContext::get_system ( ) const
inlineinherited

◆ get_system_time()

Real libMesh::DiffContext::get_system_time ( ) const
inlineinherited

Accessor for the time variable stored in the system class.

Definition at line 415 of file diff_context.h.

416  { return system_time; }

References libMesh::DiffContext::system_time.

Referenced by _update_time_from_system().

◆ get_time()

Real libMesh::DiffContext::get_time ( ) const
inlineinherited

Accessor for the time for which the current nonlinear_solution is defined.

Definition at line 421 of file diff_context.h.

422  { return time; }

References libMesh::DiffContext::time.

◆ has_elem()

bool libMesh::FEMContext::has_elem ( ) const
inline

Test for current Elem object.

Definition at line 890 of file fem_context.h.

891  { return (this->_elem != nullptr); }

References _elem.

Referenced by build_new_fe(), cached_fe(), elem_fe_reinit(), and pre_fe_reinit().

◆ has_side_boundary_id()

bool libMesh::FEMContext::has_side_boundary_id ( boundary_id_type  id) const

◆ init_internal_data()

void libMesh::FEMContext::init_internal_data ( const System sys)
private

Helper function used in constructors to set up internal data.

Definition at line 176 of file fem_context.C.

177 {
178  // Reserve space for the FEAbstract and QBase objects for each
179  // element dimension possibility (0,1,2,3)
180 
181  // Below is a workaround for the ICC 19. The original code was:
182  //
183  // _element_fe.resize(4);
184  // _side_fe.resize(4);
185 
186  _element_fe.clear();
187  for (int i=0; i<4; ++i)
188  _element_fe.push_back(std::map<FEType, std::unique_ptr<FEAbstract>>());
189 
190  _side_fe.clear();
191  for (int i=0; i<4; ++i)
192  _side_fe.push_back(std::map<FEType, std::unique_ptr<FEAbstract>>());
193 
194  _element_fe_var.resize(4);
195  _side_fe_var.resize(4);
196 
197  // We need to know which of our variables has the hardest
198  // shape functions to numerically integrate.
199 
200  unsigned int nv = sys.n_vars();
201  libmesh_assert (nv);
202 
203  bool have_scalar = false;
204 
205  for (unsigned int i=0; i != nv; ++i)
206  if (sys.variable_type(i).family == SCALAR)
207  {
208  have_scalar = true;
209  break;
210  }
211 
212  if (have_scalar)
213  // SCALAR FEs have dimension 0 by assumption
214  _elem_dims.insert(0);
215 
216  for (const auto & dim : _elem_dims)
217  {
218  // Create finite element objects
219  _element_fe_var[dim].resize(nv);
220  _side_fe_var[dim].resize(nv);
221  if (dim == 3)
222  _edge_fe_var.resize(nv);
223 
224 
225  for (unsigned int i=0; i != nv; ++i)
226  {
227  FEType fe_type = sys.variable_type(i);
228 
229  if (_element_fe[dim][fe_type] == nullptr)
230  {
231  _element_fe[dim][fe_type] = FEAbstract::build(dim, fe_type);
232  _side_fe[dim][fe_type] = FEAbstract::build(dim, fe_type);
233 
234  if (dim == 3)
235  _edge_fe[fe_type] = FEAbstract::build(dim, fe_type);
236  }
237 
238  _element_fe_var[dim][i] = _element_fe[dim][fe_type].get();
239  _side_fe_var[dim][i] = _side_fe[dim][fe_type].get();
240  if ((dim) == 3)
241  _edge_fe_var[i] = _edge_fe[fe_type].get();
242  }
243  }
244 
246 }

References _edge_fe, _edge_fe_var, _elem_dims, _element_fe, _element_fe_var, _extra_quadrature_order, _side_fe, _side_fe_var, libMesh::FEAbstract::build(), dim, libMesh::FEType::family, libMesh::libmesh_assert(), libMesh::System::n_vars(), libMesh::SCALAR, use_default_quadrature_rules(), and libMesh::System::variable_type().

Referenced by FEMContext().

◆ interior_accel()

template<typename OutputType >
template void libMesh::FEMContext::interior_accel< Gradient > ( unsigned int  var,
unsigned int  qp,
OutputType &  u 
) const
Returns
The second time derivative (acceleration) of the solution variable var at the quadrature point qp on the current element interior.

Definition at line 1349 of file fem_context.C.

1351 {
1352  this->some_value<OutputType,
1356 }

References libMesh::DiffContext::get_elem_solution_accel(), get_element_fe(), and some_value().

Referenced by ElasticitySystem::mass_residual(), SecondOrderScalarSystemSecondOrderTimeSolverBase::mass_residual(), and SecondOrderScalarSystemFirstOrderTimeSolverBase::mass_residual().

◆ interior_curl()

template<typename OutputType >
template void libMesh::FEMContext::interior_curl< Gradient > ( unsigned int  var,
unsigned int  qp,
OutputType &  curl_u 
) const
Returns
The curl of the solution variable var at the physical point p on the current element.

Definition at line 557 of file fem_context.C.

559 {
560  typedef typename TensorTools::MakeReal<OutputType>::type OutputShape;
561 
562  // Get local-to-global dof index lookup
563  const unsigned int n_dofs = cast_int<unsigned int>
564  (this->get_dof_indices(var).size());
565 
566  // Get current local coefficients
567  libmesh_assert_greater (this->_elem_subsolutions.size(), var);
568  const DenseSubVector<Number> & coef = this->get_elem_solution(var);
569 
570  // Get finite element object
571  FEGenericBase<OutputShape> * fe = nullptr;
572  this->get_element_fe<OutputShape>( var, fe, this->get_elem_dim() );
573 
574  // Get shape function values at quadrature point
575  const std::vector<std::vector<typename FEGenericBase<OutputShape>::OutputShape>> & curl_phi = fe->get_curl_phi();
576 
577  // Accumulate solution curl
578  curl_u = 0.;
579 
580  for (unsigned int l=0; l != n_dofs; l++)
581  curl_u.add_scaled(curl_phi[l][qp], coef(l));
582 
583  return;
584 }

References libMesh::DiffContext::_elem_subsolutions, libMesh::FEGenericBase< OutputType >::get_curl_phi(), libMesh::DiffContext::get_dof_indices(), get_elem_dim(), and libMesh::DiffContext::get_elem_solution().

Referenced by CurlCurlSystem::element_time_derivative().

◆ interior_div()

template<typename OutputType >
template void libMesh::FEMContext::interior_div< Number > ( unsigned int  var,
unsigned int  qp,
OutputType &  div_u 
) const
Returns
The divergence of the solution variable var at the physical point p on the current element.

Definition at line 588 of file fem_context.C.

590 {
591  typedef typename
592  TensorTools::IncrementRank
593  <typename TensorTools::MakeReal<OutputType>::type>::type OutputShape;
594 
595  // Get local-to-global dof index lookup
596  const unsigned int n_dofs = cast_int<unsigned int>
597  (this->get_dof_indices(var).size());
598 
599  // Get current local coefficients
600  libmesh_assert_greater (this->_elem_subsolutions.size(), var);
601  const DenseSubVector<Number> & coef = this->get_elem_solution(var);
602 
603  // Get finite element object
604  FEGenericBase<OutputShape> * fe = nullptr;
605  this->get_element_fe<OutputShape>( var, fe, this->get_elem_dim() );
606 
607  // Get shape function values at quadrature point
608  const std::vector<std::vector<typename FEGenericBase<OutputShape>::OutputDivergence>> & div_phi = fe->get_div_phi();
609 
610  // Accumulate solution curl
611  div_u = 0.;
612 
613  for (unsigned int l=0; l != n_dofs; l++)
614  div_u += div_phi[l][qp] * coef(l);
615 
616  return;
617 }

References libMesh::DiffContext::_elem_subsolutions, libMesh::FEGenericBase< OutputType >::get_div_phi(), libMesh::DiffContext::get_dof_indices(), get_elem_dim(), and libMesh::DiffContext::get_elem_solution().

◆ interior_gradient() [1/2]

Gradient libMesh::FEMContext::interior_gradient ( unsigned int  var,
unsigned int  qp 
) const
Returns
The gradient of the solution variable var at the quadrature point qp on the current element interior.
Note
This API is currently present for backward compatibility.

Definition at line 426 of file fem_context.C.

428 {
429  Gradient du;
430 
431  this->interior_gradient( var, qp, du );
432 
433  return du;
434 }

Referenced by NavierSystem::element_constraint(), CoupledSystem::element_constraint(), PoissonSystem::element_postprocess(), NavierSystem::element_time_derivative(), LaplaceSystem::element_time_derivative(), PoissonSystem::element_time_derivative(), ElasticitySystem::element_time_derivative(), CoupledSystem::element_time_derivative(), and libMesh::FEMPhysics::eulerian_residual().

◆ interior_gradient() [2/2]

template<typename OutputType >
void libMesh::FEMContext::interior_gradient ( unsigned int  var,
unsigned int  qp,
OutputType &  du 
) const
Returns
The gradient of the solution variable var at the quadrature point qp on the current element interior.
Note
This is the preferred API.

Definition at line 439 of file fem_context.C.

442 {
443  this->some_gradient<OutputType,
444  &FEMContext::get_element_fe<typename TensorTools::MakeReal
445  <typename TensorTools::DecrementRank
446  <OutputType>::type>::type>,
447  &DiffContext::get_elem_solution>(var, qp, du);
448 }

References libMesh::DiffContext::get_elem_solution(), get_element_fe(), and some_gradient().

◆ interior_gradients()

template<typename OutputType >
template void libMesh::FEMContext::interior_gradients< Tensor > ( unsigned int  var,
const NumericVector< Number > &  _system_vector,
std::vector< OutputType > &  interior_gradients_vector 
) const

Fills a vector with the gradient of the solution variable var at all the quadrature points in the current element interior.

Note
This is the preferred API.

Definition at line 453 of file fem_context.C.

456 {
457  typedef typename TensorTools::MakeReal
459  OutputShape;
460 
461  // Get local-to-global dof index lookup
462  const unsigned int n_dofs = cast_int<unsigned int>
463  (this->get_dof_indices(var).size());
464 
465  // Get current local coefficients
466  const DenseSubVector<Number> & coef = get_localized_subvector(_system_vector, var);
467 
468  // Get finite element object
469  FEGenericBase<OutputShape> * fe = nullptr;
470  this->get_element_fe<OutputShape>( var, fe, this->get_elem_dim() );
471 
472  // Get shape function values at quadrature point
473  const std::vector<std::vector<typename FEGenericBase<OutputShape>::OutputGradient>> & dphi = fe->get_dphi();
474 
475  // Loop over all the q_points in this finite element
476  for (auto qp : index_range(du_vals))
477  {
478  OutputType & du = du_vals[qp];
479 
480  // Compute the gradient at this q_point
481  du = 0;
482 
483  for (unsigned int l=0; l != n_dofs; l++)
484  du.add_scaled(dphi[l][qp], coef(l));
485  }
486 
487  return;
488 }

References libMesh::DiffContext::get_dof_indices(), libMesh::FEGenericBase< OutputType >::get_dphi(), get_elem_dim(), libMesh::DiffContext::get_localized_subvector(), and libMesh::index_range().

◆ interior_hessian() [1/2]

Tensor libMesh::FEMContext::interior_hessian ( unsigned int  var,
unsigned int  qp 
) const
Returns
The hessian of the solution variable var at the quadrature point qp on the current element interior.
Note
This API is currently present for backward compatibility.

Definition at line 491 of file fem_context.C.

492 {
493  Tensor d2u;
494 
495  this->interior_hessian( var, qp, d2u );
496 
497  return d2u;
498 }

◆ interior_hessian() [2/2]

template<typename OutputType >
void libMesh::FEMContext::interior_hessian ( unsigned int  var,
unsigned int  qp,
OutputType &  d2u 
) const
Returns
The hessian of the solution variable var at the quadrature point qp on the current element interior.
Note
This is the preferred API.

Definition at line 501 of file fem_context.C.

503 {
504  this->some_hessian<OutputType,
506  <typename TensorTools::MakeReal
507  <typename TensorTools::DecrementRank
508  <typename TensorTools::DecrementRank
509  <OutputType>::type>::type>::type>,
510  &DiffContext::get_elem_solution>(var, qp, d2u);
511 }

References libMesh::DiffContext::get_elem_solution(), get_element_fe(), and some_hessian().

◆ interior_hessians()

template<typename OutputType >
template void libMesh::FEMContext::interior_hessians< Tensor > ( unsigned int  var,
const NumericVector< Number > &  _system_vector,
std::vector< OutputType > &  d2u_vals 
) const

Fills a vector of hessians of the _system_vector at the all the quadrature points in the current element interior.

This is the preferred API.

Definition at line 515 of file fem_context.C.

518 {
519  typedef typename TensorTools::DecrementRank<OutputType>::type Rank1Decrement;
520  typedef typename TensorTools::DecrementRank<Rank1Decrement>::type Rank2Decrement;
521  typedef typename TensorTools::MakeReal<Rank2Decrement>::type OutputShape;
522 
523  // Get local-to-global dof index lookup
524  const unsigned int n_dofs = cast_int<unsigned int>
525  (this->get_dof_indices(var).size());
526 
527  // Get current local coefficients
528  const DenseSubVector<Number> & coef = get_localized_subvector(_system_vector, var);
529 
530  // Get finite element object
531  FEGenericBase<OutputShape> * fe = nullptr;
532  this->get_element_fe<OutputShape>( var, fe, this->get_elem_dim() );
533 
534  // Get shape function values at quadrature point
535  const std::vector<std::vector<typename FEGenericBase<OutputShape>::OutputTensor>> & d2phi = fe->get_d2phi();
536 
537  // Loop over all the q_points in this finite element
538  for (auto qp : index_range(d2u_vals))
539  {
540  OutputType & d2u = d2u_vals[qp];
541 
542  // Compute the gradient at this q_point
543  d2u = 0;
544 
545  for (unsigned int l=0; l != n_dofs; l++)
546  d2u.add_scaled(d2phi[l][qp], coef(l));
547  }
548 
549  return;
550 }

References libMesh::FEGenericBase< OutputType >::get_d2phi(), libMesh::DiffContext::get_dof_indices(), get_elem_dim(), libMesh::DiffContext::get_localized_subvector(), and libMesh::index_range().

◆ interior_rate()

template<typename OutputType >
template void libMesh::FEMContext::interior_rate< Gradient > ( unsigned int  var,
unsigned int  qp,
OutputType &  u 
) const

◆ interior_rate_gradient()

template<typename OutputType >
template void libMesh::FEMContext::interior_rate_gradient< Tensor > ( unsigned int  var,
unsigned int  qp,
OutputType &  u 
) const
Returns
The time derivative (rate) of the solution gradient of variable var at the quadrature point qp on the current element interior.

Definition at line 1328 of file fem_context.C.

1330 {
1331  this->some_gradient<OutputType,
1332  &FEMContext::get_element_fe<typename TensorTools::MakeReal
1333  <typename TensorTools::DecrementRank
1334  <OutputType>::type>::type>,
1335  &DiffContext::get_elem_solution_rate>(var, qp, dudot);
1336 }

References libMesh::DiffContext::get_elem_solution_rate(), get_element_fe(), and some_gradient().

◆ interior_value() [1/2]

Number libMesh::FEMContext::interior_value ( unsigned int  var,
unsigned int  qp 
) const
Returns
The value of the solution variable var at the quadrature point qp on the current element interior.
Note
This API is currently present for backward compatibility.

Definition at line 371 of file fem_context.C.

372 {
373  Number u;
374 
375  this->interior_value( var, qp, u );
376 
377  return u;
378 }

Referenced by libMesh::FirstOrderUnsteadySolver::compute_second_order_eqns(), LaplaceSystem::element_postprocess(), LaplaceQoI::element_qoi(), NavierSystem::element_time_derivative(), CurlCurlSystem::element_time_derivative(), L2System::element_time_derivative(), CoupledSystem::element_time_derivative(), and libMesh::RBEIMConstruction::enrich_RB_space().

◆ interior_value() [2/2]

template<typename OutputType >
void libMesh::FEMContext::interior_value ( unsigned int  var,
unsigned int  qp,
OutputType &  u 
) const
Returns
The value of the solution variable var at the quadrature point qp on the current element interior.
Note
This is the preferred API.

Definition at line 381 of file fem_context.C.

383 {
384  this->some_value<OutputType,
385  &FEMContext::get_element_fe<typename TensorTools::MakeReal<OutputType>::type>,
386  &DiffContext::get_elem_solution>(var, qp, u);
387 }

References libMesh::DiffContext::get_elem_solution(), and some_value().

◆ interior_values()

template<typename OutputType >
template void libMesh::FEMContext::interior_values< Gradient > ( unsigned int  var,
const NumericVector< Number > &  _system_vector,
std::vector< OutputType > &  interior_values_vector 
) const

Fills a vector of values of the _system_vector at the all the quadrature points in the current element interior.

Definition at line 391 of file fem_context.C.

394 {
395  typedef typename TensorTools::MakeReal<OutputType>::type OutputShape;
396 
397  // Get local-to-global dof index lookup
398  const unsigned int n_dofs = cast_int<unsigned int>
399  (this->get_dof_indices(var).size());
400 
401  // Get current local coefficients
402  const DenseSubVector<Number> & coef = get_localized_subvector(_system_vector, var);
403 
404  // Get the finite element object
405  FEGenericBase<OutputShape> * fe = nullptr;
406  this->get_element_fe<OutputShape>( var, fe, this->get_elem_dim() );
407 
408  // Get shape function values at quadrature point
409  const std::vector<std::vector<OutputShape>> & phi = fe->get_phi();
410 
411  // Loop over all the q_points on this element
412  for (auto qp : index_range(u_vals))
413  {
414  OutputType & u = u_vals[qp];
415 
416  // Compute the value at this q_point
417  u = 0.;
418 
419  for (unsigned int l=0; l != n_dofs; l++)
420  u += phi[l][qp] * coef(l);
421  }
422 
423  return;
424 }

References libMesh::DiffContext::get_dof_indices(), get_elem_dim(), libMesh::DiffContext::get_localized_subvector(), libMesh::FEGenericBase< OutputType >::get_phi(), and libMesh::index_range().

Referenced by HeatSystem::element_qoi_derivative().

◆ is_adjoint() [1/2]

bool& libMesh::DiffContext::is_adjoint ( )
inlineinherited

Accessor for setting whether we need to do a primal or adjoint solve.

Definition at line 477 of file diff_context.h.

478  { return _is_adjoint; }

References libMesh::DiffContext::_is_adjoint.

◆ is_adjoint() [2/2]

bool libMesh::DiffContext::is_adjoint ( ) const
inlineinherited

Accessor for querying whether we need to do a primal or adjoint solve.

Definition at line 470 of file diff_context.h.

471  { return _is_adjoint; }

References libMesh::DiffContext::_is_adjoint.

Referenced by libMesh::FEMSystem::build_context().

◆ n_dof_indices() [1/2]

unsigned int libMesh::DiffContext::n_dof_indices ( ) const
inlineinherited

◆ n_dof_indices() [2/2]

unsigned int libMesh::DiffContext::n_dof_indices ( unsigned int  var) const
inlineinherited

Total number of dof indices of the particular variable corresponding to the index argument.

Definition at line 406 of file diff_context.h.

407  {
408  libmesh_assert_greater(_dof_indices_var.size(), var);
409  return cast_int<unsigned int>(_dof_indices_var[var].size());
410  }

References libMesh::DiffContext::_dof_indices_var.

◆ n_vars()

unsigned int libMesh::DiffContext::n_vars ( ) const
inlineinherited

◆ nonlocal_reinit()

void libMesh::FEMContext::nonlocal_reinit ( Real  theta)
overridevirtual

Gives derived classes the opportunity to reinitialize data needed for nonlocal calculations at a new point within a timestep.

Reimplemented from libMesh::DiffContext.

Definition at line 1426 of file fem_context.C.

1427 {
1428  // Update the "time" variable of this context object
1429  this->_update_time_from_system(theta);
1430 
1431  // We can reuse the Elem FE safely here.
1432  elem_fe_reinit();
1433 }

References _update_time_from_system(), and elem_fe_reinit().

◆ point_accel()

template<typename OutputType >
void libMesh::FEMContext::point_accel ( unsigned int  var,
const Point p,
OutputType &  u 
) const
Returns
The second time derivative (acceleration) of the solution variable var at the physical point p on the current element.

◆ point_curl()

template<typename OutputType >
template void libMesh::FEMContext::point_curl< Gradient > ( unsigned int  var,
const Point p,
OutputType &  curl_u,
const Real  tolerance = TOLERANCE 
) const
Returns
The curl of the solution variable var at the physical point p on the current element.

Allows evaluation of points within a relative tolerance outside the element.

Definition at line 982 of file fem_context.C.

986 {
987  typedef typename TensorTools::MakeReal<OutputType>::type OutputShape;
988 
989  // Get local-to-global dof index lookup
990  const unsigned int n_dofs = cast_int<unsigned int>
991  (this->get_dof_indices(var).size());
992 
993  // Get current local coefficients
994  libmesh_assert_greater (this->_elem_subsolutions.size(), var);
995  const DenseSubVector<Number> & coef = this->get_elem_solution(var);
996 
997  // Get finite element object
998  FEGenericBase<OutputShape> * fe = nullptr;
999  this->get_element_fe<OutputShape>( var, fe, this->get_elem_dim() );
1000 
1001  // Build a FE for calculating u(p)
1002  FEGenericBase<OutputShape> * fe_new =
1003  this->build_new_fe( fe, p, tolerance );
1004 
1005  // Get the values of the shape function derivatives
1006  const std::vector<std::vector<typename FEGenericBase<OutputShape>::OutputShape>> & curl_phi = fe_new->get_curl_phi();
1007 
1008  curl_u = 0.0;
1009 
1010  for (unsigned int l=0; l != n_dofs; l++)
1011  curl_u.add_scaled(curl_phi[l][0], coef(l));
1012 
1013  return;
1014 }

References libMesh::DiffContext::_elem_subsolutions, build_new_fe(), libMesh::FEGenericBase< OutputType >::get_curl_phi(), libMesh::DiffContext::get_dof_indices(), get_elem_dim(), and libMesh::DiffContext::get_elem_solution().

◆ point_gradient() [1/2]

Gradient libMesh::FEMContext::point_gradient ( unsigned int  var,
const Point p 
) const
Returns
The gradient of the solution variable var at the physical point p on the current element.
Note
This API is currently present for backward compatibility.

Definition at line 879 of file fem_context.C.

880 {
881  Gradient grad_u;
882 
883  this->point_gradient( var, p, grad_u );
884 
885  return grad_u;
886 }

Referenced by libMesh::ParsedFEMFunction< T >::eval_args(), CoupledFEMFunctionsx::operator()(), and CoupledFEMFunctionsy::operator()().

◆ point_gradient() [2/2]

template<typename OutputType >
void libMesh::FEMContext::point_gradient ( unsigned int  var,
const Point p,
OutputType &  grad_u,
const Real  tolerance = TOLERANCE 
) const
Returns
The gradient of the solution variable var at the physical point p on the current element.
Note
This is the preferred API.

Allows evaluation of points within a relative tolerance outside the element.

Definition at line 891 of file fem_context.C.

895 {
896  typedef typename TensorTools::MakeReal
898  OutputShape;
899 
900  // Get local-to-global dof index lookup
901  const unsigned int n_dofs = cast_int<unsigned int>
902  (this->get_dof_indices(var).size());
903 
904  // Get current local coefficients
905  libmesh_assert_greater (this->_elem_subsolutions.size(), var);
906  const DenseSubVector<Number> & coef = this->get_elem_solution(var);
907 
908  // Get finite element object
909  FEGenericBase<OutputShape> * fe = nullptr;
910  this->get_element_fe<OutputShape>( var, fe, this->get_elem_dim() );
911 
912  // Build a FE for calculating u(p)
913  FEGenericBase<OutputShape> * fe_new =
914  this->build_new_fe( fe, p, tolerance );
915 
916  // Get the values of the shape function derivatives
917  const std::vector<std::vector<typename FEGenericBase<OutputShape>::OutputGradient>> & dphi = fe_new->get_dphi();
918 
919  grad_u = 0.0;
920 
921  for (unsigned int l=0; l != n_dofs; l++)
922  grad_u.add_scaled(dphi[l][0], coef(l));
923 
924  return;
925 }

References libMesh::DiffContext::_elem_subsolutions, build_new_fe(), libMesh::DiffContext::get_dof_indices(), libMesh::FEGenericBase< OutputType >::get_dphi(), get_elem_dim(), and libMesh::DiffContext::get_elem_solution().

◆ point_hessian() [1/2]

Tensor libMesh::FEMContext::point_hessian ( unsigned int  var,
const Point p 
) const
Returns
The hessian of the solution variable var at the physical point p on the current element.
Note
This API currently present for backward compatibility.

Definition at line 931 of file fem_context.C.

932 {
933  Tensor hess_u;
934 
935  this->point_hessian( var, p, hess_u );
936 
937  return hess_u;
938 }

Referenced by libMesh::ParsedFEMFunction< T >::eval_args().

◆ point_hessian() [2/2]

template<typename OutputType >
void libMesh::FEMContext::point_hessian ( unsigned int  var,
const Point p,
OutputType &  hess_u,
const Real  tolerance = TOLERANCE 
) const
Returns
The hessian of the solution variable var at the physical point p on the current element.
Note
This is the preferred API.

Allows evaluation of points within a relative tolerance outside the element.

Definition at line 942 of file fem_context.C.

946 {
947  typedef typename TensorTools::DecrementRank<OutputType>::type Rank1Decrement;
948  typedef typename TensorTools::DecrementRank<Rank1Decrement>::type Rank2Decrement;
949  typedef typename TensorTools::MakeReal<Rank2Decrement>::type OutputShape;
950 
951  // Get local-to-global dof index lookup
952  const unsigned int n_dofs = cast_int<unsigned int>
953  (this->get_dof_indices(var).size());
954 
955  // Get current local coefficients
956  libmesh_assert_greater (this->_elem_subsolutions.size(), var);
957  const DenseSubVector<Number> & coef = this->get_elem_solution(var);
958 
959  // Get finite element object
960  FEGenericBase<OutputShape> * fe = nullptr;
961  this->get_element_fe<OutputShape>( var, fe, this->get_elem_dim() );
962 
963  // Build a FE for calculating u(p)
964  FEGenericBase<OutputShape> * fe_new =
965  this->build_new_fe( fe, p, tolerance );
966 
967  // Get the values of the shape function derivatives
968  const std::vector<std::vector<typename FEGenericBase<OutputShape>::OutputTensor>> & d2phi = fe_new->get_d2phi();
969 
970  hess_u = 0.0;
971 
972  for (unsigned int l=0; l != n_dofs; l++)
973  hess_u.add_scaled(d2phi[l][0], coef(l));
974 
975  return;
976 }

References libMesh::DiffContext::_elem_subsolutions, build_new_fe(), libMesh::FEGenericBase< OutputType >::get_d2phi(), libMesh::DiffContext::get_dof_indices(), get_elem_dim(), and libMesh::DiffContext::get_elem_solution().

◆ point_rate()

template<typename OutputType >
void libMesh::FEMContext::point_rate ( unsigned int  var,
const Point p,
OutputType &  u 
) const
Returns
The time derivative (rate) of the solution variable var at the physical point p on the current element.

◆ point_value() [1/2]

Number libMesh::FEMContext::point_value ( unsigned int  var,
const Point p 
) const
Returns
The value of the solution variable var at the physical point p on the current element.
Note
This API is currently present for backward compatibility.

Definition at line 833 of file fem_context.C.

834 {
835  Number u = 0.;
836 
837  this->point_value( var, p, u );
838 
839  return u;
840 }

Referenced by libMesh::ParsedFEMFunction< T >::eval_args(), CoupledFEMFunctionsx::operator()(), CoupledFEMFunctionsy::operator()(), and NavierSystem::side_constraint().

◆ point_value() [2/2]

template<typename OutputType >
void libMesh::FEMContext::point_value ( unsigned int  var,
const Point p,
OutputType &  u,
const Real  tolerance = TOLERANCE 
) const
Returns
The value of the solution variable var at the physical point p on the current element.
Note
This is the preferred API.

Allows evaluation of points within a relative tolerance outside the element.

Definition at line 843 of file fem_context.C.

847 {
848  typedef typename TensorTools::MakeReal<OutputType>::type OutputShape;
849 
850  // Get local-to-global dof index lookup
851  const unsigned int n_dofs = cast_int<unsigned int>
852  (this->get_dof_indices(var).size());
853 
854  // Get current local coefficients
855  libmesh_assert_greater (this->_elem_subsolutions.size(), var);
856  const DenseSubVector<Number> & coef = this->get_elem_solution(var);
857 
858  // Get finite element object
859  FEGenericBase<OutputShape> * fe = nullptr;
860  this->get_element_fe<OutputShape>( var, fe, this->get_elem_dim() );
861 
862  // Build a FE for calculating u(p)
863  FEGenericBase<OutputShape> * fe_new =
864  this->build_new_fe( fe, p, tolerance );
865 
866  // Get the values of the shape function derivatives
867  const std::vector<std::vector<OutputShape>> & phi = fe_new->get_phi();
868 
869  u = 0.;
870 
871  for (unsigned int l=0; l != n_dofs; l++)
872  u += phi[l][0] * coef(l);
873 
874  return;
875 }

References libMesh::DiffContext::_elem_subsolutions, build_new_fe(), libMesh::DiffContext::get_dof_indices(), get_elem_dim(), libMesh::DiffContext::get_elem_solution(), and libMesh::FEGenericBase< OutputType >::get_phi().

◆ pre_fe_reinit()

void libMesh::FEMContext::pre_fe_reinit ( const System sys,
const Elem e 
)
virtual

Reinitializes local data vectors/matrices on the current geometric element.

Definition at line 1642 of file fem_context.C.

1643 {
1644  this->set_elem(e);
1645 
1646  if (algebraic_type() == CURRENT ||
1648  {
1649  // Initialize the per-element data for elem.
1650  if (this->has_elem())
1651  sys.get_dof_map().dof_indices (&(this->get_elem()), this->get_dof_indices());
1652  else
1653  // If !this->has_elem(), then we assume we are dealing with a SCALAR variable
1654  sys.get_dof_map().dof_indices
1655  (static_cast<Elem*>(nullptr), this->get_dof_indices());
1656  }
1657 #ifdef LIBMESH_ENABLE_AMR
1658  else if (algebraic_type() == OLD ||
1660  {
1661  // Initialize the per-element data for elem.
1662  if (this->has_elem())
1663  sys.get_dof_map().old_dof_indices (&(this->get_elem()), this->get_dof_indices());
1664  else
1665  // If !this->has_elem(), then we assume we are dealing with a SCALAR variable
1666  sys.get_dof_map().old_dof_indices
1667  (static_cast<Elem*>(nullptr), this->get_dof_indices());
1668  }
1669 #endif // LIBMESH_ENABLE_AMR
1670 
1671  const unsigned int n_dofs = cast_int<unsigned int>
1672  (this->get_dof_indices().size());
1673  const unsigned int n_qoi = sys.n_qois();
1674 
1675  if (this->algebraic_type() != NONE &&
1676  this->algebraic_type() != DOFS_ONLY &&
1677  this->algebraic_type() != OLD_DOFS_ONLY)
1678  {
1679  // This also resizes elem_solution
1680  if (_custom_solution == nullptr)
1681  sys.current_local_solution->get(this->get_dof_indices(), this->get_elem_solution().get_values());
1682  else
1683  _custom_solution->get(this->get_dof_indices(), this->get_elem_solution().get_values());
1684 
1685  if (sys.use_fixed_solution)
1686  this->get_elem_fixed_solution().resize(n_dofs);
1687 
1688  // Only make space for these if we're using DiffSystem
1689  // This is assuming *only* DiffSystem is using elem_solution_rate/accel
1690  const DifferentiableSystem * diff_system = dynamic_cast<const DifferentiableSystem *>(&sys);
1691  if (diff_system)
1692  {
1693  // Now, we only need these if the solver is unsteady
1694  if (!diff_system->get_time_solver().is_steady())
1695  {
1696  this->get_elem_solution_rate().resize(n_dofs);
1697 
1698  // We only need accel space if the TimeSolver is second order
1699  const UnsteadySolver & time_solver = cast_ref<const UnsteadySolver &>(diff_system->get_time_solver());
1700 
1701  if (time_solver.time_order() >= 2 || !diff_system->get_second_order_vars().empty())
1702  this->get_elem_solution_accel().resize(n_dofs);
1703  }
1704  }
1705 
1706  if (algebraic_type() != OLD)
1707  {
1708  // These resize calls also zero out the residual and jacobian
1709  this->get_elem_residual().resize(n_dofs);
1710  this->get_elem_jacobian().resize(n_dofs, n_dofs);
1711 
1712  this->get_qoi_derivatives().resize(n_qoi);
1713  this->_elem_qoi_subderivatives.resize(n_qoi);
1714  for (std::size_t q=0; q != n_qoi; ++q)
1715  (this->get_qoi_derivatives())[q].resize(n_dofs);
1716  }
1717  }
1718 
1719  // Initialize the per-variable data for elem.
1720  {
1721  unsigned int sub_dofs = 0;
1722  for (auto i : IntRange<unsigned int>(0, sys.n_vars()))
1723  {
1724  if (algebraic_type() == CURRENT ||
1726  {
1727  if (this->has_elem())
1728  sys.get_dof_map().dof_indices (&(this->get_elem()), this->get_dof_indices(i), i);
1729  else
1730  // If !this->has_elem(), then we assume we are dealing with a SCALAR variable
1731  sys.get_dof_map().dof_indices
1732  (static_cast<Elem*>(nullptr), this->get_dof_indices(i), i);
1733  }
1734 #ifdef LIBMESH_ENABLE_AMR
1735  else if (algebraic_type() == OLD ||
1737  {
1738  if (this->has_elem())
1739  sys.get_dof_map().old_dof_indices (&(this->get_elem()), this->get_dof_indices(i), i);
1740  else
1741  // If !this->has_elem(), then we assume we are dealing with a SCALAR variable
1742  sys.get_dof_map().old_dof_indices
1743  (static_cast<Elem*>(nullptr), this->get_dof_indices(i), i);
1744  }
1745 #endif // LIBMESH_ENABLE_AMR
1746 
1747  if (this->algebraic_type() != NONE &&
1748  this->algebraic_type() != DOFS_ONLY &&
1749  this->algebraic_type() != OLD_DOFS_ONLY)
1750  {
1751  const unsigned int n_dofs_var = cast_int<unsigned int>
1752  (this->get_dof_indices(i).size());
1753 
1754  this->get_elem_solution(i).reposition
1755  (sub_dofs, n_dofs_var);
1756 
1757  // Only make space for these if we're using DiffSystem
1758  // This is assuming *only* DiffSystem is using elem_solution_rate/accel
1759  const DifferentiableSystem * diff_system = dynamic_cast<const DifferentiableSystem *>(&sys);
1760  if (diff_system)
1761  {
1762  // Now, we only need these if the solver is unsteady
1763  if (!diff_system->get_time_solver().is_steady())
1764  {
1765  this->get_elem_solution_rate(i).reposition
1766  (sub_dofs, n_dofs_var);
1767 
1768  // We only need accel space if the TimeSolver is second order
1769  const UnsteadySolver & time_solver = cast_ref<const UnsteadySolver &>(diff_system->get_time_solver());
1770 
1771  if (time_solver.time_order() >= 2 || !diff_system->get_second_order_vars().empty())
1772  this->get_elem_solution_accel(i).reposition
1773  (sub_dofs, n_dofs_var);
1774  }
1775  }
1776 
1777  if (sys.use_fixed_solution)
1778  this->get_elem_fixed_solution(i).reposition
1779  (sub_dofs, n_dofs_var);
1780 
1781  if (algebraic_type() != OLD)
1782  {
1783  this->get_elem_residual(i).reposition
1784  (sub_dofs, n_dofs_var);
1785 
1786  for (std::size_t q=0; q != n_qoi; ++q)
1787  this->get_qoi_derivatives(q,i).reposition
1788  (sub_dofs, n_dofs_var);
1789 
1790  for (unsigned int j=0; j != i; ++j)
1791  {
1792  const unsigned int n_dofs_var_j =
1793  cast_int<unsigned int>
1794  (this->get_dof_indices(j).size());
1795 
1796  this->get_elem_jacobian(i,j).reposition
1797  (sub_dofs, this->get_elem_residual(j).i_off(),
1798  n_dofs_var, n_dofs_var_j);
1799  this->get_elem_jacobian(j,i).reposition
1800  (this->get_elem_residual(j).i_off(), sub_dofs,
1801  n_dofs_var_j, n_dofs_var);
1802  }
1803  this->get_elem_jacobian(i,i).reposition
1804  (sub_dofs, sub_dofs,
1805  n_dofs_var,
1806  n_dofs_var);
1807  }
1808 
1809  sub_dofs += n_dofs_var;
1810  }
1811  }
1812 
1813  if (this->algebraic_type() != NONE &&
1814  this->algebraic_type() != DOFS_ONLY &&
1815  this->algebraic_type() != OLD &&
1816  this->algebraic_type() != OLD_DOFS_ONLY)
1817  libmesh_assert_equal_to (sub_dofs, n_dofs);
1818  }
1819 
1820  // Now do the localization for the user requested vectors
1821  if (this->algebraic_type() != NONE &&
1822  this->algebraic_type() != DOFS_ONLY &&
1823  this->algebraic_type() != OLD_DOFS_ONLY)
1824  {
1825  DiffContext::localized_vectors_iterator localized_vec_it = this->_localized_vectors.begin();
1826  const DiffContext::localized_vectors_iterator localized_vec_end = this->_localized_vectors.end();
1827 
1828  for (; localized_vec_it != localized_vec_end; ++localized_vec_it)
1829  {
1830  const NumericVector<Number> & current_localized_vector = *localized_vec_it->first;
1831  DenseVector<Number> & target_vector = localized_vec_it->second.first;
1832 
1833  current_localized_vector.get(this->get_dof_indices(), target_vector.get_values());
1834 
1835  // Initialize the per-variable data for elem.
1836  unsigned int sub_dofs = 0;
1837  for (auto i : IntRange<unsigned int>(0, sys.n_vars()))
1838  {
1839  const unsigned int n_dofs_var = cast_int<unsigned int>
1840  (this->get_dof_indices(i).size());
1841 
1842  // This is redundant with earlier initialization, isn't it? - RHS
1843  // sys.get_dof_map().dof_indices (&(this->get_elem()), this->get_dof_indices(i), i);
1844 
1845  localized_vec_it->second.second[i]->reposition
1846  (sub_dofs, n_dofs_var);
1847 
1848  sub_dofs += n_dofs_var;
1849  }
1850  libmesh_assert_equal_to (sub_dofs, n_dofs);
1851  }
1852  }
1853 }

References _custom_solution, libMesh::DiffContext::_elem_qoi_subderivatives, libMesh::DiffContext::_localized_vectors, algebraic_type(), CURRENT, libMesh::System::current_local_solution, libMesh::DofMap::dof_indices(), DOFS_ONLY, libMesh::NumericVector< T >::get(), libMesh::DiffContext::get_dof_indices(), libMesh::System::get_dof_map(), get_elem(), libMesh::DiffContext::get_elem_fixed_solution(), libMesh::DiffContext::get_elem_jacobian(), libMesh::DiffContext::get_elem_residual(), libMesh::DiffContext::get_elem_solution(), libMesh::DiffContext::get_elem_solution_accel(), libMesh::DiffContext::get_elem_solution_rate(), libMesh::DiffContext::get_qoi_derivatives(), libMesh::DifferentiablePhysics::get_second_order_vars(), libMesh::DifferentiableSystem::get_time_solver(), libMesh::DenseVector< T >::get_values(), has_elem(), libMesh::TimeSolver::is_steady(), libMesh::System::n_qois(), libMesh::System::n_vars(), NONE, OLD, libMesh::DofMap::old_dof_indices(), OLD_DOFS_ONLY, libMesh::DenseVector< T >::resize(), libMesh::DenseMatrix< T >::resize(), set_elem(), libMesh::UnsteadySolver::time_order(), and libMesh::System::use_fixed_solution.

Referenced by libMesh::RBConstruction::add_scaled_matrix_and_vector(), libMesh::FEMSystem::assembly(), assembly_with_dg_fem_context(), L2System::element_time_derivative(), libMesh::RBEIMConstruction::enrich_RB_space(), libMesh::FEMSystem::mesh_position_get(), libMesh::FEMSystem::mesh_position_set(), libMesh::WeightedPatchRecoveryErrorEstimator::EstimateError::operator()(), libMesh::System::project_vector(), OverlappingAlgebraicGhostingTest::run_ghosting_test(), OverlappingCouplingGhostingTest::run_sparsity_pattern_test(), and libMesh::RBEIMConstruction::truth_solve().

◆ set_algebraic_type()

void libMesh::FEMContext::set_algebraic_type ( const AlgebraicType  atype)
inline

Setting which determines whether to initialize algebraic structures (elem_*) on each element and set their values from current_local_solution.

Algebraic initialization may be disabled for efficiency in cases where FEMContext is only used as a convenient container of FE objects.

Definition at line 973 of file fem_context.h.

974  { _atype = atype; }

References _atype.

Referenced by libMesh::OldSolutionBase< Output, point_output >::init_context().

◆ set_custom_solution()

void libMesh::FEMContext::set_custom_solution ( const NumericVector< Number > *  custom_sol)
inline

Set a NumericVector to be used in place of current_local_solution for calculating elem_solution.

Set to nullptr to restore the current_local_solution behavior. Advanced DifferentiableSystem specific capabilities will only be enabled in the current_local_solution case.

Definition at line 988 of file fem_context.h.

989  { _custom_solution = custom_sol; }

References _custom_solution.

◆ set_deltat_pointer()

void libMesh::DiffContext::set_deltat_pointer ( Real dt)
inherited

Points the _deltat member of this class at a timestep value stored in the creating System, for example DiffSystem::deltat.

Definition at line 103 of file diff_context.C.

104 {
105  // We may actually want to be able to set this pointer to nullptr, so
106  // don't report an error for that.
107  _deltat = dt;
108 }

References libMesh::DiffContext::_deltat.

Referenced by libMesh::FEMSystem::build_context(), libMesh::DifferentiableSystem::build_context(), and libMesh::FEMSystem::init_context().

◆ set_elem()

void libMesh::FEMContext::set_elem ( const Elem e)
protected

Helper function to promote accessor usage.

Definition at line 1855 of file fem_context.C.

1856 {
1857  this->_elem = e;
1858 
1859  // If e is nullptr, we assume it's SCALAR and set _elem_dim to 0.
1860  this->_elem_dim =
1861  cast_int<unsigned char>(this->_elem ? this->_elem->dim() : 0);
1862 }

References _elem, _elem_dim, and libMesh::Elem::dim().

Referenced by pre_fe_reinit().

◆ set_jacobian_tolerance()

void libMesh::FEMContext::set_jacobian_tolerance ( Real  tol)

Calls set_jacobian_tolerance() on all the FE objects controlled by this class.

(Actually, it calls this on the underlying)

Definition at line 1545 of file fem_context.C.

1546 {
1547  for (auto & m : _element_fe)
1548  for (auto & pr : m)
1549  pr.second->get_fe_map().set_jacobian_tolerance(tol);
1550 
1551  for (auto & m : _side_fe)
1552  for (auto & pr : m)
1553  pr.second->get_fe_map().set_jacobian_tolerance(tol);
1554 
1555  for (auto & pr : _edge_fe)
1556  pr.second->get_fe_map().set_jacobian_tolerance(tol);
1557 }

References _edge_fe, _element_fe, and _side_fe.

◆ set_mesh_system()

virtual void libMesh::FEMContext::set_mesh_system ( System sys)
inlinevirtual

Tells the FEMContext that system sys contains the isoparametric Lagrangian variables which correspond to the coordinates of mesh nodes, in problems where the mesh itself is expected to move in time.

This should be set automatically if the FEMPhysics requires it.

Definition at line 830 of file fem_context.h.

831  { this->_mesh_sys = sys; }

References _mesh_sys.

Referenced by libMesh::FEMSystem::build_context().

◆ set_mesh_x_var()

void libMesh::FEMContext::set_mesh_x_var ( unsigned int  x_var)
inline

Accessor for x-variable of moving mesh System.

This should be set automatically if the FEMPhysics requires it.

Definition at line 856 of file fem_context.h.

857  { _mesh_x_var = x_var; }

References _mesh_x_var.

Referenced by libMesh::FEMSystem::build_context().

◆ set_mesh_y_var()

void libMesh::FEMContext::set_mesh_y_var ( unsigned int  y_var)
inline

Accessor for y-variable of moving mesh System.

This should be set automatically if the FEMPhysics requires it.

Definition at line 870 of file fem_context.h.

871  { _mesh_y_var = y_var; }

References _mesh_y_var.

Referenced by libMesh::FEMSystem::build_context().

◆ set_mesh_z_var()

void libMesh::FEMContext::set_mesh_z_var ( unsigned int  z_var)
inline

Accessor for z-variable of moving mesh System.

This should be set automatically if the FEMPhysics requires it.

Definition at line 884 of file fem_context.h.

885  { _mesh_z_var = z_var; }

References _mesh_z_var.

Referenced by libMesh::FEMSystem::build_context().

◆ set_time()

void libMesh::DiffContext::set_time ( Real  time_in)
inlineinherited

Set the time for which the current nonlinear_solution is defined.

Definition at line 427 of file diff_context.h.

428  { time = time_in; }

References libMesh::DiffContext::time.

Referenced by _update_time_from_system().

◆ side_accel()

template<typename OutputType >
template void libMesh::FEMContext::side_accel< Gradient > ( unsigned int  var,
unsigned int  qp,
OutputType &  u 
) const
Returns
The second time derivative (acceleration) of the solution variable var at the quadrature point qp on the current element side.

Definition at line 1361 of file fem_context.C.

1363 {
1364  this->some_value<OutputType,
1368 }

References libMesh::DiffContext::get_elem_solution_accel(), get_side_fe(), and some_value().

◆ side_boundary_ids() [1/2]

std::vector< boundary_id_type > libMesh::FEMContext::side_boundary_ids ( ) const

Lists the boundary ids found on the current side.

Definition at line 261 of file fem_context.C.

262 {
263  libmesh_deprecated();
264  return _boundary_info.boundary_ids(&(this->get_elem()), side);
265 }

References _boundary_info, libMesh::BoundaryInfo::boundary_ids(), get_elem(), and side.

◆ side_boundary_ids() [2/2]

void libMesh::FEMContext::side_boundary_ids ( std::vector< boundary_id_type > &  vec_to_fill) const

As above, but fills in the std::set provided by the user.

Definition at line 269 of file fem_context.C.

270 {
271  _boundary_info.boundary_ids(&(this->get_elem()), side, vec_to_fill);
272 }

References _boundary_info, libMesh::BoundaryInfo::boundary_ids(), get_elem(), and side.

◆ side_fe_reinit()

void libMesh::FEMContext::side_fe_reinit ( )
virtual

Reinitializes side FE objects on the current geometric element.

Reimplemented in libMesh::DGFEMContext.

Definition at line 1457 of file fem_context.C.

1458 {
1459  // Initialize all the side FE objects on elem/side.
1460  // Logging of FE::reinit is done in the FE functions
1461  // We only reinit the FE objects for the current element
1462  // dimension
1463  const unsigned char dim = this->get_elem_dim();
1464 
1465  libmesh_assert( !_side_fe[dim].empty() );
1466 
1467  for (auto & pr : _side_fe[dim])
1468  pr.second->reinit(&(this->get_elem()), this->get_side());
1469 }

References _side_fe, dim, get_elem(), get_elem_dim(), get_side(), and libMesh::libmesh_assert().

Referenced by elem_side_reinit(), and libMesh::DGFEMContext::side_fe_reinit().

◆ side_gradient() [1/2]

Gradient libMesh::FEMContext::side_gradient ( unsigned int  var,
unsigned int  qp 
) const
Returns
The gradient of the solution variable var at the quadrature point qp on the current element side.
Note
This API is currently present for backward compatibility.

Definition at line 678 of file fem_context.C.

679 {
680  Gradient du;
681 
682  this->side_gradient( var, qp, du );
683 
684  return du;
685 }

Referenced by LaplaceSystem::side_postprocess().

◆ side_gradient() [2/2]

template<typename OutputType >
void libMesh::FEMContext::side_gradient ( unsigned int  var,
unsigned int  qp,
OutputType &  du 
) const
Returns
The gradient of the solution variable var at the quadrature point qp on the current element side.
Note
This is the preferred API.

Definition at line 689 of file fem_context.C.

691 {
692  typedef typename TensorTools::MakeReal
694  OutputShape;
695 
696  // Get local-to-global dof index lookup
697  const unsigned int n_dofs = cast_int<unsigned int>
698  (this->get_dof_indices(var).size());
699 
700  // Get current local coefficients
701  libmesh_assert_greater (this->_elem_subsolutions.size(), var);
702  const DenseSubVector<Number> & coef = this->get_elem_solution(var);
703 
704  // Get finite element object
705  FEGenericBase<OutputShape> * the_side_fe = nullptr;
706  this->get_side_fe<OutputShape>( var, the_side_fe, this->get_elem_dim() );
707 
708  // Get shape function values at quadrature point
709  const std::vector<std::vector<typename FEGenericBase<OutputShape>::OutputGradient>> & dphi = the_side_fe->get_dphi();
710 
711  // Accumulate solution derivatives
712  du = 0.;
713 
714  for (unsigned int l=0; l != n_dofs; l++)
715  du.add_scaled(dphi[l][qp], coef(l));
716 
717  return;
718 }

References libMesh::DiffContext::_elem_subsolutions, libMesh::DiffContext::get_dof_indices(), libMesh::FEGenericBase< OutputType >::get_dphi(), get_elem_dim(), and libMesh::DiffContext::get_elem_solution().

◆ side_gradients()

template<typename OutputType >
template void libMesh::FEMContext::side_gradients< Tensor > ( unsigned int  var,
const NumericVector< Number > &  _system_vector,
std::vector< OutputType > &  side_gradients_vector 
) const

Fills a vector with the gradient of the solution variable var at all the quadrature points on the current element side.

Note
This is the preferred API.

Definition at line 723 of file fem_context.C.

726 {
727  typedef typename TensorTools::MakeReal
729  OutputShape;
730 
731  // Get local-to-global dof index lookup
732  const unsigned int n_dofs = cast_int<unsigned int>
733  (this->get_dof_indices(var).size());
734 
735  // Get current local coefficients
736  const DenseSubVector<Number> & coef = get_localized_subvector(_system_vector, var);
737 
738  // Get finite element object
739  FEGenericBase<OutputShape> * the_side_fe = nullptr;
740  this->get_side_fe<OutputShape>( var, the_side_fe, this->get_elem_dim() );
741 
742  // Get shape function values at quadrature point
743  const std::vector<std::vector<typename FEGenericBase<OutputShape>::OutputGradient>> & dphi = the_side_fe->get_dphi();
744 
745  // Loop over all the q_points in this finite element
746  for (auto qp : index_range(du_vals))
747  {
748  OutputType & du = du_vals[qp];
749 
750  du = 0;
751 
752  // Compute the gradient at this q_point
753  for (unsigned int l=0; l != n_dofs; l++)
754  du.add_scaled(dphi[l][qp], coef(l));
755  }
756 
757  return;
758 }

References libMesh::DiffContext::get_dof_indices(), libMesh::FEGenericBase< OutputType >::get_dphi(), get_elem_dim(), libMesh::DiffContext::get_localized_subvector(), and libMesh::index_range().

◆ side_hessian() [1/2]

Tensor libMesh::FEMContext::side_hessian ( unsigned int  var,
unsigned int  qp 
) const
Returns
The hessian of the solution variable var at the quadrature point qp on the current element side.
Note
This API is currently present for backward compatibility.

Definition at line 761 of file fem_context.C.

763 {
764  Tensor d2u;
765 
766  this->side_hessian( var, qp, d2u );
767 
768  return d2u;
769 }

◆ side_hessian() [2/2]

template<typename OutputType >
void libMesh::FEMContext::side_hessian ( unsigned int  var,
unsigned int  qp,
OutputType &  d2u 
) const
Returns
The hessian of the solution variable var at the quadrature point qp on the current element side.
Note
This is the preferred API.

Definition at line 774 of file fem_context.C.

777 {
778  this->some_hessian<OutputType,
780  <typename TensorTools::MakeReal
781  <typename TensorTools::DecrementRank
782  <typename TensorTools::DecrementRank
783  <OutputType>::type>::type>::type>,
784  &DiffContext::get_elem_solution>(var, qp, d2u);
785 }

References libMesh::DiffContext::get_elem_solution(), get_side_fe(), and some_hessian().

◆ side_hessians()

template<typename OutputType >
template void libMesh::FEMContext::side_hessians< Tensor > ( unsigned int  var,
const NumericVector< Number > &  _system_vector,
std::vector< OutputType > &  d2u_vals 
) const

Fills a vector of hessians of the _system_vector at the all the quadrature points on the current element side.

This is the preferred API.

Definition at line 790 of file fem_context.C.

793 {
794  typedef typename TensorTools::DecrementRank<OutputType>::type Rank1Decrement;
795  typedef typename TensorTools::DecrementRank<Rank1Decrement>::type Rank2Decrement;
796  typedef typename TensorTools::MakeReal<Rank2Decrement>::type OutputShape;
797 
798  // Get local-to-global dof index lookup
799  const unsigned int n_dofs = cast_int<unsigned int>
800  (this->get_dof_indices(var).size());
801 
802  // Get current local coefficients
803  const DenseSubVector<Number> & coef = get_localized_subvector(_system_vector, var);
804 
805  // Get finite element object
806  FEGenericBase<OutputShape> * the_side_fe = nullptr;
807  this->get_side_fe<OutputShape>( var, the_side_fe, this->get_elem_dim() );
808 
809  // Get shape function values at quadrature point
810  const std::vector<std::vector<typename FEGenericBase<OutputShape>::OutputTensor>> & d2phi = the_side_fe->get_d2phi();
811 
812  // Loop over all the q_points in this finite element
813  for (auto qp : index_range(d2u_vals))
814  {
815  OutputType & d2u = d2u_vals[qp];
816 
817  // Compute the gradient at this q_point
818  d2u = 0;
819 
820  for (unsigned int l=0; l != n_dofs; l++)
821  d2u.add_scaled(d2phi[l][qp], coef(l));
822  }
823 
824  return;
825 }

References libMesh::FEGenericBase< OutputType >::get_d2phi(), libMesh::DiffContext::get_dof_indices(), get_elem_dim(), libMesh::DiffContext::get_localized_subvector(), and libMesh::index_range().

◆ side_rate()

template<typename OutputType >
template void libMesh::FEMContext::side_rate< Gradient > ( unsigned int  var,
unsigned int  qp,
OutputType &  u 
) const
Returns
The time derivative (rate) of the solution variable var at the quadrature point qp on the current element side.

Definition at line 1339 of file fem_context.C.

1341 {
1342  this->some_value<OutputType,
1346 }

References libMesh::DiffContext::get_elem_solution_rate(), get_side_fe(), and some_value().

◆ side_value() [1/2]

Number libMesh::FEMContext::side_value ( unsigned int  var,
unsigned int  qp 
) const
Returns
The value of the solution variable var at the quadrature point qp on the current element side.
Note
This API currently is present for backward compatibility.

Definition at line 620 of file fem_context.C.

622 {
623  Number u = 0.;
624 
625  this->side_value( var, qp, u );
626 
627  return u;
628 }

Referenced by LaplaceSystem::side_constraint(), CoupledSystemQoI::side_qoi(), CoupledSystemQoI::side_qoi_derivative(), and CurlCurlSystem::side_time_derivative().

◆ side_value() [2/2]

template<typename OutputType >
void libMesh::FEMContext::side_value ( unsigned int  var,
unsigned int  qp,
OutputType &  u 
) const
Returns
The value of the solution variable var at the quadrature point qp on the current element side.
Note
This is the preferred API.

Definition at line 632 of file fem_context.C.

635 {
636  this->some_value<OutputType,
637  &FEMContext::get_side_fe<typename TensorTools::MakeReal<OutputType>::type>,
638  &DiffContext::get_elem_solution>(var, qp, u);
639 }

References libMesh::DiffContext::get_elem_solution(), and some_value().

◆ side_values()

template<typename OutputType >
template void libMesh::FEMContext::side_values< Gradient > ( unsigned int  var,
const NumericVector< Number > &  _system_vector,
std::vector< OutputType > &  side_values_vector 
) const

Fills a vector of values of the _system_vector at the all the quadrature points on the current element side.

Definition at line 643 of file fem_context.C.

646 {
647  typedef typename TensorTools::MakeReal<OutputType>::type OutputShape;
648 
649  // Get local-to-global dof index lookup
650  const unsigned int n_dofs = cast_int<unsigned int>
651  (this->get_dof_indices(var).size());
652 
653  // Get current local coefficients
654  const DenseSubVector<Number> & coef = get_localized_subvector(_system_vector, var);
655 
656  // Get the finite element object
657  FEGenericBase<OutputShape> * the_side_fe = nullptr;
658  this->get_side_fe<OutputShape>( var, the_side_fe, this->get_elem_dim() );
659 
660  // Get shape function values at quadrature point
661  const std::vector<std::vector<OutputShape>> & phi = the_side_fe->get_phi();
662 
663  // Loop over all the q_points on this element
664  for (auto qp : index_range(u_vals))
665  {
666  OutputType & u = u_vals[qp];
667 
668  // Compute the value at this q_point
669  u = 0.;
670 
671  for (unsigned int l=0; l != n_dofs; l++)
672  u += phi[l][qp] * coef(l);
673  }
674 
675  return;
676 }

References libMesh::DiffContext::get_dof_indices(), get_elem_dim(), libMesh::DiffContext::get_localized_subvector(), libMesh::FEGenericBase< OutputType >::get_phi(), and libMesh::index_range().

◆ some_gradient()

template<typename OutputType , typename FEMContext::FENeeded< OutputType >::grad_getter fe_getter, FEMContext::diff_subsolution_getter subsolution_getter>
void libMesh::FEMContext::some_gradient ( unsigned int  var,
unsigned int  qp,
OutputType &  u 
) const
protected

Helper function to reduce some code duplication in the *interior_gradient methods.

Definition at line 308 of file fem_context.C.

309 {
310  // Get local-to-global dof index lookup
311  const unsigned int n_dofs = cast_int<unsigned int>
312  (this->get_dof_indices(var).size());
313 
314  // Get current local coefficients
315  const DenseSubVector<Number> & coef = (this->*subsolution_getter)(var);
316 
317  // Get finite element object
318  typename FENeeded<OutputType>::grad_base * fe = nullptr;
319  (this->*fe_getter)( var, fe, this->get_elem_dim() );
320 
321  // Get shape function values at quadrature point
322  const std::vector<std::vector
324  & dphi = fe->get_dphi();
325 
326  // Accumulate solution derivatives
327  du = 0;
328 
329  for (unsigned int l=0; l != n_dofs; l++)
330  du.add_scaled(dphi[l][qp], coef(l));
331 
332  return;
333 }

References libMesh::DiffContext::get_dof_indices(), libMesh::FEGenericBase< OutputType >::get_dphi(), and get_elem_dim().

Referenced by fixed_interior_gradient(), fixed_side_gradient(), interior_gradient(), and interior_rate_gradient().

◆ some_hessian()

template<typename OutputType , typename FEMContext::FENeeded< OutputType >::hess_getter fe_getter, FEMContext::diff_subsolution_getter subsolution_getter>
void libMesh::FEMContext::some_hessian ( unsigned int  var,
unsigned int  qp,
OutputType &  u 
) const
protected

Helper function to reduce some code duplication in the *interior_hessian methods.

Definition at line 341 of file fem_context.C.

342 {
343  // Get local-to-global dof index lookup
344  const unsigned int n_dofs = cast_int<unsigned int>
345  (this->get_dof_indices(var).size());
346 
347  // Get current local coefficients
348  const DenseSubVector<Number> & coef = (this->*subsolution_getter)(var);
349 
350  // Get finite element object
351  typename FENeeded<OutputType>::hess_base * fe = nullptr;
352  (this->*fe_getter)( var, fe, this->get_elem_dim() );
353 
354  // Get shape function values at quadrature point
355  const std::vector<std::vector
357  & d2phi = fe->get_d2phi();
358 
359  // Accumulate solution second derivatives
360  d2u = 0.0;
361 
362  for (unsigned int l=0; l != n_dofs; l++)
363  d2u.add_scaled(d2phi[l][qp], coef(l));
364 
365  return;
366 }

References libMesh::FEGenericBase< OutputType >::get_d2phi(), libMesh::DiffContext::get_dof_indices(), and get_elem_dim().

Referenced by fixed_interior_hessian(), fixed_side_hessian(), interior_hessian(), and side_hessian().

◆ some_value()

template<typename OutputType , typename FEMContext::FENeeded< OutputType >::value_getter fe_getter, FEMContext::diff_subsolution_getter subsolution_getter>
void libMesh::FEMContext::some_value ( unsigned int  var,
unsigned int  qp,
OutputType &  u 
) const
protected

Helper function to reduce some code duplication in the *interior_value methods.

Definition at line 279 of file fem_context.C.

280 {
281  // Get local-to-global dof index lookup
282  const unsigned int n_dofs = cast_int<unsigned int>
283  (this->get_dof_indices(var).size());
284 
285  // Get current local coefficients
286  const DenseSubVector<Number> & coef = (this->*subsolution_getter)(var);
287 
288  // Get finite element object
289  typename FENeeded<OutputType>::value_base * fe = nullptr;
290  (this->*fe_getter)( var, fe, this->get_elem_dim() );
291 
292  // Get shape function values at quadrature point
293  const std::vector<std::vector
294  <typename FENeeded<OutputType>::value_shape>> & phi = fe->get_phi();
295 
296  // Accumulate solution value
297  u = 0.;
298 
299  for (unsigned int l=0; l != n_dofs; l++)
300  u += phi[l][qp] * coef(l);
301 }

References libMesh::DiffContext::get_dof_indices(), get_elem_dim(), and libMesh::FEGenericBase< OutputType >::get_phi().

Referenced by fixed_interior_value(), fixed_side_value(), interior_accel(), interior_rate(), interior_value(), side_accel(), side_rate(), and side_value().

◆ use_default_quadrature_rules()

void libMesh::FEMContext::use_default_quadrature_rules ( int  extra_quadrature_order = 0)

Use quadrature rules designed to over-integrate a mass matrix, plus extra_quadrature_order.

Definition at line 134 of file fem_context.C.

135 {
136  _extra_quadrature_order = extra_quadrature_order;
137 
138  FEType hardest_fe_type = this->find_hardest_fe_type();
139 
140  for (const auto & dim : _elem_dims)
141  {
142  // Create an adequate quadrature rule
144  hardest_fe_type.default_quadrature_rule(dim, _extra_quadrature_order);
145  _side_qrule[dim] =
146  hardest_fe_type.default_quadrature_rule(dim-1, _extra_quadrature_order);
147  if (dim == 3)
148  _edge_qrule = hardest_fe_type.default_quadrature_rule(1, _extra_quadrature_order);
149  }
150 
151  this->attach_quadrature_rules();
152 }

References _edge_qrule, _elem_dims, _element_qrule, _extra_quadrature_order, _side_qrule, attach_quadrature_rules(), libMesh::FEType::default_quadrature_rule(), dim, and find_hardest_fe_type().

Referenced by init_internal_data().

◆ use_unweighted_quadrature_rules()

void libMesh::FEMContext::use_unweighted_quadrature_rules ( int  extra_quadrature_order = 0)

Use quadrature rules designed to exactly integrate unweighted undistorted basis functions, plus extra_quadrature_order.

Definition at line 155 of file fem_context.C.

156 {
157  _extra_quadrature_order = extra_quadrature_order;
158 
159  FEType hardest_fe_type = this->find_hardest_fe_type();
160 
161  for (const auto & dim : _elem_dims)
162  {
163  // Create an adequate quadrature rule
165  hardest_fe_type.unweighted_quadrature_rule(dim, _extra_quadrature_order);
166  _side_qrule[dim] =
167  hardest_fe_type.unweighted_quadrature_rule(dim-1, _extra_quadrature_order);
168  if (dim == 3)
169  _edge_qrule = hardest_fe_type.unweighted_quadrature_rule(1, _extra_quadrature_order);
170  }
171 
172  this->attach_quadrature_rules();
173 }

References _edge_qrule, _elem_dims, _element_qrule, _extra_quadrature_order, _side_qrule, attach_quadrature_rules(), dim, find_hardest_fe_type(), and libMesh::FEType::unweighted_quadrature_rule().

Member Data Documentation

◆ _atype

AlgebraicType libMesh::FEMContext::_atype
protected

Keep track of what type of algebra reinitialization is to be done.

Definition at line 1040 of file fem_context.h.

Referenced by algebraic_type(), and set_algebraic_type().

◆ _boundary_info

const BoundaryInfo& libMesh::FEMContext::_boundary_info
protected

Saved reference to BoundaryInfo on the mesh for this System.

Used to answer boundary id requests.

Definition at line 1155 of file fem_context.h.

Referenced by has_side_boundary_id(), and side_boundary_ids().

◆ _custom_solution

const NumericVector<Number>* libMesh::FEMContext::_custom_solution
protected

Data with which to do algebra reinitialization.

Definition at line 1045 of file fem_context.h.

Referenced by pre_fe_reinit(), and set_custom_solution().

◆ _deltat

Real* libMesh::DiffContext::_deltat
privateinherited

Defaults to nullptr, can optionally be used to point to a timestep value in the System-derived class responsible for creating this DiffContext.

In DiffSystem's build_context() function, is assigned to point to the deltat member of that class.

Accessible via public get_deltat()/set_deltat() methods of this class.

Always test for nullptr before using!

Definition at line 653 of file diff_context.h.

Referenced by libMesh::DiffContext::get_deltat_value(), and libMesh::DiffContext::set_deltat_pointer().

◆ _dim

unsigned char libMesh::FEMContext::_dim
protected

Cached dimension of largest dimension element in this mesh.

Definition at line 1165 of file fem_context.h.

Referenced by libMesh::DGFEMContext::DGFEMContext(), and get_dim().

◆ _dof_indices

std::vector<dof_id_type> libMesh::DiffContext::_dof_indices
protectedinherited

Global Degree of freedom index lists.

Definition at line 637 of file diff_context.h.

Referenced by libMesh::DiffContext::get_dof_indices(), and libMesh::DiffContext::n_dof_indices().

◆ _dof_indices_var

std::vector<std::vector<dof_id_type> > libMesh::DiffContext::_dof_indices_var
protectedinherited

◆ _edge_fe

std::map<FEType, std::unique_ptr<FEAbstract> > libMesh::FEMContext::_edge_fe
protected

◆ _edge_fe_var

std::vector<FEAbstract *> libMesh::FEMContext::_edge_fe_var
protected

Definition at line 1149 of file fem_context.h.

Referenced by get_edge_fe(), and init_internal_data().

◆ _edge_qrule

std::unique_ptr<QBase> libMesh::FEMContext::_edge_qrule
protected

Quadrature rules for element edges.

If the FEM context is told to prepare for edge integration on 3D elements, it will try to find a quadrature rule that correctly integrates all variables. Because edge rules only apply to 3D elements, we don't need to worry about multiple dimensions

Definition at line 1201 of file fem_context.h.

Referenced by attach_quadrature_rules(), get_edge_qrule(), use_default_quadrature_rules(), and use_unweighted_quadrature_rules().

◆ _elem

const Elem* libMesh::FEMContext::_elem
protected

Current element for element_* to examine.

Definition at line 1160 of file fem_context.h.

Referenced by get_elem(), has_elem(), and set_elem().

◆ _elem_dim

unsigned char libMesh::FEMContext::_elem_dim
protected

Cached dimension of this->_elem.

Definition at line 1170 of file fem_context.h.

Referenced by get_elem_dim(), and set_elem().

◆ _elem_dims

std::set<unsigned char> libMesh::FEMContext::_elem_dims
protected

Cached dimensions of elements in the mesh, plus dimension 0 if SCALAR variables are in use.

Definition at line 1176 of file fem_context.h.

Referenced by attach_quadrature_rules(), elem_dimensions(), init_internal_data(), use_default_quadrature_rules(), and use_unweighted_quadrature_rules().

◆ _elem_fixed_solution

DenseVector<Number> libMesh::DiffContext::_elem_fixed_solution
protectedinherited

Element by element components of nonlinear_solution at a fixed point in a timestep, for optional use by e.g.

stabilized methods

Definition at line 603 of file diff_context.h.

Referenced by libMesh::DiffContext::DiffContext(), and libMesh::DiffContext::get_elem_fixed_solution().

◆ _elem_fixed_subsolutions

std::vector<std::unique_ptr<DenseSubVector<Number> > > libMesh::DiffContext::_elem_fixed_subsolutions
protectedinherited

◆ _elem_jacobian

DenseMatrix<Number> libMesh::DiffContext::_elem_jacobian
protectedinherited

Element jacobian: derivatives of elem_residual with respect to elem_solution.

Definition at line 615 of file diff_context.h.

Referenced by libMesh::DiffContext::DiffContext(), and libMesh::DiffContext::get_elem_jacobian().

◆ _elem_qoi

std::vector<Number> libMesh::DiffContext::_elem_qoi
protectedinherited

Element quantity of interest contributions.

Definition at line 620 of file diff_context.h.

Referenced by libMesh::DiffContext::DiffContext(), and libMesh::DiffContext::get_qois().

◆ _elem_qoi_derivative

std::vector<DenseVector<Number> > libMesh::DiffContext::_elem_qoi_derivative
protectedinherited

Element quantity of interest derivative contributions.

Definition at line 625 of file diff_context.h.

Referenced by libMesh::DiffContext::DiffContext(), and libMesh::DiffContext::get_qoi_derivatives().

◆ _elem_qoi_subderivatives

std::vector<std::vector<std::unique_ptr<DenseSubVector<Number> > > > libMesh::DiffContext::_elem_qoi_subderivatives
protectedinherited

◆ _elem_residual

DenseVector<Number> libMesh::DiffContext::_elem_residual
protectedinherited

Element residual vector.

Definition at line 609 of file diff_context.h.

Referenced by libMesh::DiffContext::DiffContext(), and libMesh::DiffContext::get_elem_residual().

◆ _elem_solution

DenseVector<Number> libMesh::DiffContext::_elem_solution
protectedinherited

Element by element components of nonlinear_solution as adjusted by a time_solver.

Definition at line 581 of file diff_context.h.

Referenced by libMesh::DiffContext::DiffContext(), and libMesh::DiffContext::get_elem_solution().

◆ _elem_solution_accel

DenseVector<Number> libMesh::DiffContext::_elem_solution_accel
protectedinherited

Element by element components of du/dt as adjusted by a time_solver.

Definition at line 595 of file diff_context.h.

Referenced by libMesh::DiffContext::DiffContext(), and libMesh::DiffContext::get_elem_solution_accel().

◆ _elem_solution_rate

DenseVector<Number> libMesh::DiffContext::_elem_solution_rate
protectedinherited

Element by element components of du/dt as adjusted by a time_solver.

Definition at line 588 of file diff_context.h.

Referenced by libMesh::DiffContext::DiffContext(), and libMesh::DiffContext::get_elem_solution_rate().

◆ _elem_subjacobians

std::vector<std::vector<std::unique_ptr<DenseSubMatrix<Number> > > > libMesh::DiffContext::_elem_subjacobians
protectedinherited

◆ _elem_subresiduals

std::vector<std::unique_ptr<DenseSubVector<Number> > > libMesh::DiffContext::_elem_subresiduals
protectedinherited

Element residual subvectors and Jacobian submatrices.

Definition at line 631 of file diff_context.h.

Referenced by libMesh::DiffContext::DiffContext(), and libMesh::DiffContext::get_elem_residual().

◆ _elem_subsolution_accels

std::vector<std::unique_ptr<DenseSubVector<Number> > > libMesh::DiffContext::_elem_subsolution_accels
protectedinherited

◆ _elem_subsolution_rates

std::vector<std::unique_ptr<DenseSubVector<Number> > > libMesh::DiffContext::_elem_subsolution_rates
protectedinherited

◆ _elem_subsolutions

std::vector<std::unique_ptr<DenseSubVector<Number> > > libMesh::DiffContext::_elem_subsolutions
protectedinherited

◆ _element_fe

std::vector<std::map<FEType, std::unique_ptr<FEAbstract> > > libMesh::FEMContext::_element_fe
protected

Finite element objects for each variable's interior, sides and edges.

We store FE objects for each element dimension present in the mesh, except for edge_fe which only applies to 3D elements.

Definition at line 1136 of file fem_context.h.

Referenced by attach_quadrature_rules(), elem_fe_reinit(), init_internal_data(), and set_jacobian_tolerance().

◆ _element_fe_var

std::vector<std::vector<FEAbstract *> > libMesh::FEMContext::_element_fe_var
protected

Pointers to the same finite element objects, but indexed by variable number.

We store FE objects for each element dimension present in the mesh, except for edge_fe_var which only applies for 3D elements.

Definition at line 1147 of file fem_context.h.

Referenced by get_element_fe(), and init_internal_data().

◆ _element_qrule

std::vector<std::unique_ptr<QBase> > libMesh::FEMContext::_element_qrule
protected

Quadrature rule for element interior.

The FEM context will try to find a quadrature rule that correctly integrates all variables. We prepare quadrature rules for each element dimension in the mesh.

Definition at line 1184 of file fem_context.h.

Referenced by attach_quadrature_rules(), get_element_qrule(), use_default_quadrature_rules(), and use_unweighted_quadrature_rules().

◆ _extra_quadrature_order

int libMesh::FEMContext::_extra_quadrature_order
protected

The extra quadrature order for this context.

Definition at line 1206 of file fem_context.h.

Referenced by init_internal_data(), use_default_quadrature_rules(), and use_unweighted_quadrature_rules().

◆ _is_adjoint

bool libMesh::DiffContext::_is_adjoint
privateinherited

Is this context to be used for a primal or adjoint solve?

Definition at line 663 of file diff_context.h.

Referenced by libMesh::DiffContext::is_adjoint().

◆ _localized_vectors

std::map<const NumericVector<Number> *, std::pair<DenseVector<Number>, std::vector<std::unique_ptr<DenseSubVector<Number> > > > > libMesh::DiffContext::_localized_vectors
protectedinherited

Contains pointers to vectors the user has asked to be localized, keyed with pairs of element localized versions of that vector and per variable views.

Definition at line 575 of file diff_context.h.

Referenced by libMesh::DiffContext::add_localized_vector(), libMesh::DiffContext::get_localized_subvector(), libMesh::DiffContext::get_localized_vector(), and pre_fe_reinit().

◆ _mesh_sys

System* libMesh::FEMContext::_mesh_sys

System from which to acquire moving mesh information.

Definition at line 1000 of file fem_context.h.

Referenced by _do_elem_position_set(), elem_edge_reinit(), elem_position_get(), elem_position_set(), elem_reinit(), elem_side_reinit(), get_mesh_system(), and set_mesh_system().

◆ _mesh_x_var

unsigned int libMesh::FEMContext::_mesh_x_var

Variables from which to acquire moving mesh information.

Definition at line 1005 of file fem_context.h.

Referenced by get_mesh_x_var(), and set_mesh_x_var().

◆ _mesh_y_var

unsigned int libMesh::FEMContext::_mesh_y_var

Definition at line 1005 of file fem_context.h.

Referenced by get_mesh_y_var(), and set_mesh_y_var().

◆ _mesh_z_var

unsigned int libMesh::FEMContext::_mesh_z_var

Definition at line 1005 of file fem_context.h.

Referenced by get_mesh_z_var(), and set_mesh_z_var().

◆ _real_fe

std::unique_ptr<FEGenericBase<Real> > libMesh::FEMContext::_real_fe
mutableprotected

Definition at line 1047 of file fem_context.h.

Referenced by cached_fe().

◆ _real_fe_is_inf

bool libMesh::FEMContext::_real_fe_is_inf
mutableprotected

Definition at line 1051 of file fem_context.h.

Referenced by cached_fe().

◆ _real_grad_fe

std::unique_ptr<FEGenericBase<RealGradient> > libMesh::FEMContext::_real_grad_fe
mutableprotected

Definition at line 1048 of file fem_context.h.

Referenced by cached_fe().

◆ _real_grad_fe_is_inf

bool libMesh::FEMContext::_real_grad_fe_is_inf
mutableprotected

Definition at line 1052 of file fem_context.h.

Referenced by cached_fe().

◆ _side_fe

std::vector<std::map<FEType, std::unique_ptr<FEAbstract> > > libMesh::FEMContext::_side_fe
protected

◆ _side_fe_var

std::vector<std::vector<FEAbstract *> > libMesh::FEMContext::_side_fe_var
protected

Definition at line 1148 of file fem_context.h.

Referenced by get_side_fe(), and init_internal_data().

◆ _side_qrule

std::vector<std::unique_ptr<QBase> > libMesh::FEMContext::_side_qrule
protected

Quadrature rules for element sides The FEM context will try to find a quadrature rule that correctly integrates all variables.

We prepare quadrature rules for each element dimension in the mesh.

Definition at line 1192 of file fem_context.h.

Referenced by attach_quadrature_rules(), get_side_qrule(), use_default_quadrature_rules(), and use_unweighted_quadrature_rules().

◆ _system

const System& libMesh::DiffContext::_system
privateinherited

A reference to the system this context is constructed with.

Definition at line 658 of file diff_context.h.

Referenced by libMesh::DiffContext::get_system().

◆ diff_subsolution_getter

const typedef DenseSubVector<Number>&(DiffContext::* libMesh::FEMContext::diff_subsolution_getter) (unsigned int) const

Helper typedef to simplify refactoring.

Definition at line 1071 of file fem_context.h.

◆ edge

unsigned char libMesh::FEMContext::edge

Current edge for edge_* to examine.

Definition at line 1015 of file fem_context.h.

Referenced by get_edge().

◆ elem_solution_accel_derivative

Real libMesh::DiffContext::elem_solution_accel_derivative
inherited

The derivative of elem_solution_accel with respect to the current nonlinear solution, for use by systems with non default mass_residual terms.

Definition at line 514 of file diff_context.h.

Referenced by libMesh::NewmarkSolver::_general_residual(), libMesh::DiffContext::get_elem_solution_accel_derivative(), and libMesh::FirstOrderUnsteadySolver::prepare_accel().

◆ elem_solution_derivative

Real libMesh::DiffContext::elem_solution_derivative
inherited

◆ elem_solution_rate_derivative

Real libMesh::DiffContext::elem_solution_rate_derivative
inherited

◆ fixed_solution_derivative

Real libMesh::DiffContext::fixed_solution_derivative
inherited

The derivative of elem_fixed_solution with respect to the nonlinear solution, for use by systems constructing jacobians with elem_fixed_solution based methods.

Definition at line 521 of file diff_context.h.

Referenced by libMesh::EulerSolver::_general_residual(), libMesh::Euler2Solver::_general_residual(), libMesh::SteadySolver::_general_residual(), and libMesh::DiffContext::get_fixed_solution_derivative().

◆ side

unsigned char libMesh::FEMContext::side

◆ system_time

const Real libMesh::DiffContext::system_time
inherited

This is the time stored in the System class at the time this context was created, i.e.

the time at the beginning of the current timestep. This value gets set in the constructor and unlike DiffContext::time, is not tweaked mid-timestep by transient solvers: it remains equal to the value it was assigned at construction.

Definition at line 494 of file diff_context.h.

Referenced by libMesh::DiffContext::get_system_time().

◆ time

Real libMesh::DiffContext::time
inherited

For time-dependent problems, this is the time t for which the current nonlinear_solution is defined.

FIXME - this needs to be tweaked mid-timestep by all transient solvers!

Definition at line 485 of file diff_context.h.

Referenced by libMesh::DiffContext::get_time(), and libMesh::DiffContext::set_time().


The documentation for this class was generated from the following files:
libMesh::DiffContext::_system
const System & _system
A reference to the system this context is constructed with.
Definition: diff_context.h:658
libMesh::DiffContext::system_time
const Real system_time
This is the time stored in the System class at the time this context was created, i....
Definition: diff_context.h:494
libMesh::DiffContext::_elem_qoi_subderivatives
std::vector< std::vector< std::unique_ptr< DenseSubVector< Number > > > > _elem_qoi_subderivatives
Definition: diff_context.h:626
libMesh::Number
Real Number
Definition: libmesh_common.h:195
libMesh::DiffContext::get_elem_residual
const DenseVector< Number > & get_elem_residual() const
Const accessor for element residual.
Definition: diff_context.h:249
libMesh::FEMContext::init_internal_data
void init_internal_data(const System &sys)
Helper function used in constructors to set up internal data.
Definition: fem_context.C:176
libMesh::FEMContext::get_element_qrule
const QBase & get_element_qrule() const
Accessor for element interior quadrature rule for the dimension of the current _elem.
Definition: fem_context.h:790
libMesh::BoundaryInfo::boundary_ids
std::vector< boundary_id_type > boundary_ids(const Node *node) const
Definition: boundary_info.C:985
libMesh::DiffContext::get_localized_subvector
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...
Definition: diff_context.C:148
libMesh::FEMContext::fixed_point_gradient
Gradient fixed_point_gradient(unsigned int var, const Point &p) const
Definition: fem_context.C:1214
libMesh::DiffContext::DiffContext
DiffContext(const System &)
Constructor.
Definition: diff_context.C:30
libMesh::FEMContext::side_gradient
Gradient side_gradient(unsigned int var, unsigned int qp) const
Definition: fem_context.C:678
libMesh::FEMContext::side
unsigned char side
Current side for side_* to examine.
Definition: fem_context.h:1010
libMesh::FEMContext::FENeeded::grad_base
FEGenericBase< grad_shape > grad_base
Definition: fem_context.h:1091
libMesh::invalid_uint
const unsigned int invalid_uint
A number which is used quite often to represent an invalid or uninitialized value.
Definition: libmesh.h:249
libMesh::FEMContext::_real_grad_fe
std::unique_ptr< FEGenericBase< RealGradient > > _real_grad_fe
Definition: fem_context.h:1048
libMesh::Elem::JUST_REFINED
Definition: elem.h:1172
libMesh::FEMContext::_element_qrule
std::vector< std::unique_ptr< QBase > > _element_qrule
Quadrature rule for element interior.
Definition: fem_context.h:1184
libMesh::FEMContext::get_mesh_y_var
unsigned int get_mesh_y_var() const
Accessor for y-variable of moving mesh System.
Definition: fem_context.h:862
libMesh::DiffContext::_deltat
Real * _deltat
Defaults to nullptr, can optionally be used to point to a timestep value in the System-derived class ...
Definition: diff_context.h:653
libMesh::DiffContext::_elem_solution_accel
DenseVector< Number > _elem_solution_accel
Element by element components of du/dt as adjusted by a time_solver.
Definition: diff_context.h:595
libMesh::DiffContext::get_dof_indices
const std::vector< dof_id_type > & get_dof_indices() const
Accessor for element dof indices.
Definition: diff_context.h:367
libMesh::FEMContext::_edge_qrule
std::unique_ptr< QBase > _edge_qrule
Quadrature rules for element edges.
Definition: fem_context.h:1201
libMesh::DiffContext::set_time
void set_time(Real time_in)
Set the time for which the current nonlinear_solution is defined.
Definition: diff_context.h:427
libMesh::Elem::n_nodes
virtual unsigned int n_nodes() const =0
libMesh::FEMContext::fixed_side_gradient
Gradient fixed_side_gradient(unsigned int var, unsigned int qp) const
Definition: fem_context.C:1118
libMesh::n_threads
unsigned int n_threads()
Definition: libmesh_base.h:96
libMesh::DiffContext::time
Real time
For time-dependent problems, this is the time t for which the current nonlinear_solution is defined.
Definition: diff_context.h:485
libMesh::FEMContext::side_fe_reinit
virtual void side_fe_reinit()
Reinitializes side FE objects on the current geometric element.
Definition: fem_context.C:1457
libMesh::libmesh_real
T libmesh_real(T a)
Definition: libmesh_common.h:166
libMesh::FEMContext::build_new_fe
FEGenericBase< OutputShape > * build_new_fe(const FEGenericBase< OutputShape > *fe, const Point &p, const Real tolerance=TOLERANCE) const
Helper function to reduce some code duplication in the *_point_* methods.
Definition: fem_context.C:1952
libMesh::FEMContext::set_elem
void set_elem(const Elem *e)
Helper function to promote accessor usage.
Definition: fem_context.C:1855
libMesh::index_range
IntRange< std::size_t > index_range(const std::vector< T > &vec)
Helper function that returns an IntRange<std::size_t> representing all the indices of the passed-in v...
Definition: int_range.h:106
libMesh::Elem::dim
virtual unsigned short dim() const =0
libMesh::FEMContext::get_side
unsigned char get_side() const
Accessor for current side of Elem object.
Definition: fem_context.h:910
libMesh::FEMContext::_side_fe
std::vector< std::map< FEType, std::unique_ptr< FEAbstract > > > _side_fe
Definition: fem_context.h:1137
libMesh::DiffContext::get_system
const System & get_system() const
Accessor for associated system.
Definition: diff_context.h:105
libMesh::Elem::infinite
virtual bool infinite() const =0
libMesh::FEMContext::get_elem_dim
unsigned char get_elem_dim() const
Definition: fem_context.h:931
libMesh::FEMContext::get_elem
const Elem & get_elem() const
Accessor for current Elem object.
Definition: fem_context.h:896
libMesh::DiffContext::_elem_residual
DenseVector< Number > _elem_residual
Element residual vector.
Definition: diff_context.h:609
libMesh::FEMContext::OLD_DOFS_ONLY
Definition: fem_context.h:963
libMesh::DiffContext::_elem_subsolutions
std::vector< std::unique_ptr< DenseSubVector< Number > > > _elem_subsolutions
Definition: diff_context.h:582
libMesh::DiffContext::_dof_indices_var
std::vector< std::vector< dof_id_type > > _dof_indices_var
Definition: diff_context.h:638
libMesh::DiffContext::_localized_vectors
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...
Definition: diff_context.h:575
libMesh::FEMContext::_boundary_info
const BoundaryInfo & _boundary_info
Saved reference to BoundaryInfo on the mesh for this System.
Definition: fem_context.h:1155
libMesh::TensorTools::MakeReal::type
T type
Definition: tensor_tools.h:250
libMesh::TensorTools::DecrementRank::type
T type
Definition: tensor_tools.h:158
libMesh::FEMContext::point_value
Number point_value(unsigned int var, const Point &p) const
Definition: fem_context.C:833
libMesh::FEGenericBase::build_InfFE
static std::unique_ptr< FEGenericBase > build_InfFE(const unsigned int dim, const FEType &type)
Builds a specific infinite element type.
dim
unsigned int dim
Definition: adaptivity_ex3.C:113
libMesh::Elem::point
const Point & point(const unsigned int i) const
Definition: elem.h:1955
libMesh::DiffContext::_elem_solution
DenseVector< Number > _elem_solution
Element by element components of nonlinear_solution as adjusted by a time_solver.
Definition: diff_context.h:581
libMesh::DiffContext::_elem_subsolution_rates
std::vector< std::unique_ptr< DenseSubVector< Number > > > _elem_subsolution_rates
Definition: diff_context.h:589
libMesh::DenseMatrix::resize
void resize(const unsigned int new_m, const unsigned int new_n)
Resize the matrix.
Definition: dense_matrix.h:822
libMesh::FEMContext::_extra_quadrature_order
int _extra_quadrature_order
The extra quadrature order for this context.
Definition: fem_context.h:1206
libMesh::FEMContext::fixed_point_value
Number fixed_point_value(unsigned int var, const Point &p) const
Definition: fem_context.C:1168
libMesh::FEMContext::_elem_dim
unsigned char _elem_dim
Cached dimension of this->_elem.
Definition: fem_context.h:1170
libMesh::FEMContext::some_gradient
void some_gradient(unsigned int var, unsigned int qp, OutputType &u) const
Helper function to reduce some code duplication in the *interior_gradient methods.
Definition: fem_context.C:308
libMesh::DiffContext::elem_solution_accel_derivative
Real elem_solution_accel_derivative
The derivative of elem_solution_accel with respect to the current nonlinear solution,...
Definition: diff_context.h:514
libMesh::FEMContext::_side_fe_var
std::vector< std::vector< FEAbstract * > > _side_fe_var
Definition: fem_context.h:1148
libMesh::FEMContext::fixed_side_value
Number fixed_side_value(unsigned int var, unsigned int qp) const
Definition: fem_context.C:1094
libMesh::libmesh_assert
libmesh_assert(ctx)
libMesh::FEMContext::_real_fe_is_inf
bool _real_fe_is_inf
Definition: fem_context.h:1051
libMesh::FEMContext::_elem_dims
std::set< unsigned char > _elem_dims
Cached dimensions of elements in the mesh, plus dimension 0 if SCALAR variables are in use.
Definition: fem_context.h:1176
libMesh::FEMContext::some_hessian
void some_hessian(unsigned int var, unsigned int qp, OutputType &u) const
Helper function to reduce some code duplication in the *interior_hessian methods.
Definition: fem_context.C:341
libMesh::DiffContext::localized_vectors_iterator
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.
Definition: diff_context.h:544
libMesh::DiffContext::get_qoi_derivatives
const std::vector< DenseVector< Number > > & get_qoi_derivatives() const
Const accessor for QoI derivatives.
Definition: diff_context.h:331
libMesh::FEMap::inverse_map
static Point inverse_map(const unsigned int dim, const Elem *elem, const Point &p, const Real tolerance=TOLERANCE, const bool secure=true)
Definition: fe_map.C:1622
libMesh::FEMContext::_elem
const Elem * _elem
Current element for element_* to examine.
Definition: fem_context.h:1160
libMesh::FEMContext::_mesh_sys
System * _mesh_sys
System from which to acquire moving mesh information.
Definition: fem_context.h:1000
libMesh::FEMContext::has_elem
bool has_elem() const
Test for current Elem object.
Definition: fem_context.h:890
libMesh::FEMContext::interior_hessian
Tensor interior_hessian(unsigned int var, unsigned int qp) const
Definition: fem_context.C:491
libMesh::DiffContext::get_system_time
Real get_system_time() const
Accessor for the time variable stored in the system class.
Definition: diff_context.h:415
libMesh::DiffContext::_is_adjoint
bool _is_adjoint
Is this context to be used for a primal or adjoint solve?
Definition: diff_context.h:663
libMesh::DiffContext::_elem_fixed_subsolutions
std::vector< std::unique_ptr< DenseSubVector< Number > > > _elem_fixed_subsolutions
Definition: diff_context.h:604
libMesh::FEAbstract::build
static std::unique_ptr< FEAbstract > build(const unsigned int dim, const FEType &type)
Builds a specific finite element type.
Definition: fe_abstract.C:72
libMesh::FEMContext::_real_fe
std::unique_ptr< FEGenericBase< Real > > _real_fe
Definition: fem_context.h:1047
libMesh::FEGenericBase::build
static std::unique_ptr< FEGenericBase > build(const unsigned int dim, const FEType &type)
Builds a specific finite element type.
libMesh::FEMContext::_element_fe
std::vector< std::map< FEType, std::unique_ptr< FEAbstract > > > _element_fe
Finite element objects for each variable's interior, sides and edges.
Definition: fem_context.h:1136
libMesh::FEMContext::_mesh_y_var
unsigned int _mesh_y_var
Definition: fem_context.h:1005
libMesh::FEMContext::point_gradient
Gradient point_gradient(unsigned int var, const Point &p) const
Definition: fem_context.C:879
libMesh::FEMContext::_do_elem_position_set
void _do_elem_position_set(Real theta)
Uses the coordinate data specified by mesh_*_position configuration to set the geometry of elem to th...
Definition: fem_context.C:1566
libMesh::FEMContext::_atype
AlgebraicType _atype
Keep track of what type of algebra reinitialization is to be done.
Definition: fem_context.h:1040
libMesh::FEMContext::edge
unsigned char edge
Current edge for edge_* to examine.
Definition: fem_context.h:1015
libMesh::FEMContext::_edge_fe
std::map< FEType, std::unique_ptr< FEAbstract > > _edge_fe
Definition: fem_context.h:1138
libMesh::Elem::default_order
virtual Order default_order() const =0
libMesh::FEMContext::side_hessian
Tensor side_hessian(unsigned int var, unsigned int qp) const
Definition: fem_context.C:761
libMesh::FEMContext::get_mesh_x_var
unsigned int get_mesh_x_var() const
Accessor for x-variable of moving mesh System.
Definition: fem_context.h:848
libMesh::FEMap::map_fe_type
static FEFamily map_fe_type(const Elem &elem)
Definition: fe_map.C:47
libMesh::FEMContext::fixed_side_hessian
Tensor fixed_side_hessian(unsigned int var, unsigned int qp) const
Definition: fem_context.C:1143
libMesh::FEMContext::elem_position_set
void elem_position_set(Real theta)
Uses the coordinate data specified by mesh_*_position configuration to set the geometry of elem to th...
Definition: fem_context.h:1238
n_nodes
const dof_id_type n_nodes
Definition: tecplot_io.C:68
libMesh::Elem::JUST_COARSENED
Definition: elem.h:1173
libMesh::DiffContext::fixed_solution_derivative
Real fixed_solution_derivative
The derivative of elem_fixed_solution with respect to the nonlinear solution, for use by systems cons...
Definition: diff_context.h:521
libMesh::FEMContext::_custom_solution
const NumericVector< Number > * _custom_solution
Data with which to do algebra reinitialization.
Definition: fem_context.h:1045
libMesh::FEMContext::_mesh_x_var
unsigned int _mesh_x_var
Variables from which to acquire moving mesh information.
Definition: fem_context.h:1005
libMesh::FEMContext::attach_quadrature_rules
void attach_quadrature_rules()
Helper function for attaching quadrature rules.
Definition: fem_context.C:112
libMesh::DiffContext::_elem_fixed_solution
DenseVector< Number > _elem_fixed_solution
Element by element components of nonlinear_solution at a fixed point in a timestep,...
Definition: diff_context.h:603
libMesh::FEMContext::use_default_quadrature_rules
void use_default_quadrature_rules(int extra_quadrature_order=0)
Use quadrature rules designed to over-integrate a mass matrix, plus extra_quadrature_order.
Definition: fem_context.C:134
libMesh::FEMContext::_update_time_from_system
void _update_time_from_system(Real theta)
Update the time in the context object for the given value of theta, based on the values of "time" and...
Definition: fem_context.C:1864
libMesh::DiffContext::_elem_qoi_derivative
std::vector< DenseVector< Number > > _elem_qoi_derivative
Element quantity of interest derivative contributions.
Definition: diff_context.h:625
libMesh::DiffContext::elem_solution_derivative
Real elem_solution_derivative
The derivative of elem_solution with respect to the current nonlinear solution.
Definition: diff_context.h:500
libMesh::FEMContext::FENeeded::value_base
FEGenericBase< value_shape > value_base
Definition: fem_context.h:1086
libMesh::FEMContext::NONE
Definition: fem_context.h:958
libMesh::DenseVector::resize
void resize(const unsigned int n)
Resize the vector.
Definition: dense_vector.h:355
libMesh::FEMContext::point_hessian
Tensor point_hessian(unsigned int var, const Point &p) const
Definition: fem_context.C:931
libMesh::DiffContext::_dof_indices
std::vector< dof_id_type > _dof_indices
Global Degree of freedom index lists.
Definition: diff_context.h:637
libMesh::DiffContext::_elem_qoi
std::vector< Number > _elem_qoi
Element quantity of interest contributions.
Definition: diff_context.h:620
libMesh::FEMContext::elem_fe_reinit
virtual void elem_fe_reinit(const std::vector< Point > *const pts=nullptr)
Reinitializes interior FE objects on the current geometric element.
Definition: fem_context.C:1436
libMesh::DiffContext::_elem_solution_rate
DenseVector< Number > _elem_solution_rate
Element by element components of du/dt as adjusted by a time_solver.
Definition: diff_context.h:588
libMesh::Gradient
NumberVectorValue Gradient
Definition: exact_solution.h:58
libMesh::FEMContext::edge_fe_reinit
virtual void edge_fe_reinit()
Reinitializes edge FE objects on the current geometric element.
Definition: fem_context.C:1473
libMesh::FEMContext::get_element_fe
void get_element_fe(unsigned int var, FEGenericBase< OutputShape > *&fe) const
Accessor for interior finite element object for variable var for the largest dimension in the mesh.
Definition: fem_context.h:275
libMesh::FEMContext::_side_qrule
std::vector< std::unique_ptr< QBase > > _side_qrule
Quadrature rules for element sides The FEM context will try to find a quadrature rule that correctly ...
Definition: fem_context.h:1192
libMesh::FEMContext::interior_gradient
Gradient interior_gradient(unsigned int var, unsigned int qp) const
Definition: fem_context.C:426
libMesh::ReferenceElem::get
const Elem & get(const ElemType type_in)
Definition: reference_elem.C:237
libMesh::DiffContext::_elem_subresiduals
std::vector< std::unique_ptr< DenseSubVector< Number > > > _elem_subresiduals
Element residual subvectors and Jacobian submatrices.
Definition: diff_context.h:631
libMesh::FEGenericBase::OutputGradient
TensorTools::IncrementRank< OutputShape >::type OutputGradient
Definition: fe_base.h:119
libMesh::FEMContext::DOFS_ONLY
Definition: fem_context.h:959
libMesh::FEMContext::FENeeded::value_shape
TensorTools::MakeReal< OutputType >::type value_shape
Definition: fem_context.h:1085
libMesh::DiffContext::elem_solution_rate_derivative
Real elem_solution_rate_derivative
The derivative of elem_solution_rate with respect to the current nonlinear solution,...
Definition: diff_context.h:507
libMesh::DiffContext::get_elem_jacobian
const DenseMatrix< Number > & get_elem_jacobian() const
Const accessor for element Jacobian.
Definition: diff_context.h:283
libMesh::FEMContext::FENeeded::hess_base
FEGenericBase< hess_shape > hess_base
Definition: fem_context.h:1096
libMesh::DiffContext::get_elem_solution
const DenseVector< Number > & get_elem_solution() const
Accessor for element solution.
Definition: diff_context.h:111
libMesh::FEMContext::side_value
Number side_value(unsigned int var, unsigned int qp) const
Definition: fem_context.C:620
libMesh::FEMContext::algebraic_type
AlgebraicType algebraic_type() const
Definition: fem_context.h:979
libMesh::FEMContext::get_side_qrule
const QBase & get_side_qrule() const
Accessor for element side quadrature rule for the dimension of the current _elem.
Definition: fem_context.h:797
libMesh::DiffContext::get_elem_fixed_solution
const DenseVector< Number > & get_elem_fixed_solution() const
Accessor for element fixed solution.
Definition: diff_context.h:215
libMesh::FEMContext::get_dim
unsigned char get_dim() const
Accessor for cached mesh dimension.
Definition: fem_context.h:924
libMesh::FEMContext::_mesh_z_var
unsigned int _mesh_z_var
Definition: fem_context.h:1005
libMesh::FEMContext::fixed_interior_value
Number fixed_interior_value(unsigned int var, unsigned int qp) const
Definition: fem_context.C:1018
libMesh::FEMContext::find_hardest_fe_type
FEType find_hardest_fe_type()
Helper function for creating quadrature rules.
Definition: fem_context.C:80
libMesh::FEMContext::get_side_fe
void get_side_fe(unsigned int var, FEGenericBase< OutputShape > *&fe) const
Accessor for edge/face (2D/3D) finite element object for variable var for the largest dimension in th...
Definition: fem_context.h:312
libMesh::FEMContext::some_value
void some_value(unsigned int var, unsigned int qp, OutputType &u) const
Helper function to reduce some code duplication in the *interior_value methods.
Definition: fem_context.C:279
libMesh::NumericVector::get
virtual void get(const std::vector< numeric_index_type > &index, T *values) const
Access multiple components at once.
Definition: numeric_vector.h:821
libMesh::DiffContext::get_elem_solution_rate
const DenseVector< Number > & get_elem_solution_rate() const
Accessor for element solution rate of change w.r.t.
Definition: diff_context.h:145
libMesh::SCALAR
Definition: enum_fe_family.h:58
libMesh::Real
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
Definition: libmesh_common.h:121
libMesh::DiffContext::_elem_subjacobians
std::vector< std::vector< std::unique_ptr< DenseSubMatrix< Number > > > > _elem_subjacobians
Definition: diff_context.h:632
libMesh::FEMContext::OLD
Definition: fem_context.h:962
libMesh::Tensor
NumberTensorValue Tensor
Definition: exact_solution.h:56
libMesh::FEMContext::get_mesh_z_var
unsigned int get_mesh_z_var() const
Accessor for z-variable of moving mesh System.
Definition: fem_context.h:876
libMesh::DiffContext::get_deltat_value
Real get_deltat_value()
Definition: diff_context.C:111
libMesh::BoundaryInfo::has_boundary_id
bool has_boundary_id(const Node *const node, const boundary_id_type id) const
Definition: boundary_info.C:972
libMesh::FEMContext::_real_grad_fe_is_inf
bool _real_grad_fe_is_inf
Definition: fem_context.h:1052
libMesh::DiffContext::_elem_jacobian
DenseMatrix< Number > _elem_jacobian
Element jacobian: derivatives of elem_residual with respect to elem_solution.
Definition: diff_context.h:615
libMesh::FEMContext::get_edge
unsigned char get_edge() const
Accessor for current edge of Elem object.
Definition: fem_context.h:916
libMesh::DiffContext::get_elem_solution_accel
const DenseVector< Number > & get_elem_solution_accel() const
Accessor for element solution accel of change w.r.t.
Definition: diff_context.h:180
libMesh::FEMContext::fixed_interior_hessian
Tensor fixed_interior_hessian(unsigned int var, unsigned int qp) const
Definition: fem_context.C:1068
libMesh::DiffContext::_elem_subsolution_accels
std::vector< std::unique_ptr< DenseSubVector< Number > > > _elem_subsolution_accels
Definition: diff_context.h:596
libMesh::FEMContext::_element_fe_var
std::vector< std::vector< FEAbstract * > > _element_fe_var
Pointers to the same finite element objects, but indexed by variable number.
Definition: fem_context.h:1147
libMesh::FEMContext::CURRENT
Definition: fem_context.h:961
libMesh::FEMContext::interior_value
Number interior_value(unsigned int var, unsigned int qp) const
Definition: fem_context.C:371
libMesh::FEMContext::fixed_point_hessian
Tensor fixed_point_hessian(unsigned int var, const Point &p) const
Definition: fem_context.C:1265
libMesh::FEGenericBase::OutputTensor
TensorTools::IncrementRank< OutputGradient >::type OutputTensor
Definition: fe_base.h:120
libMesh::FEMContext::_dim
unsigned char _dim
Cached dimension of largest dimension element in this mesh.
Definition: fem_context.h:1165
libMesh::FEMContext::_edge_fe_var
std::vector< FEAbstract * > _edge_fe_var
Definition: fem_context.h:1149
libMesh::FEMContext::fixed_interior_gradient
Gradient fixed_interior_gradient(unsigned int var, unsigned int qp) const
Definition: fem_context.C:1041