Go to the documentation of this file.
20 #ifndef LIBMESH_SYSTEM_H
21 #define LIBMESH_SYSTEM_H
24 #include "libmesh/elem_range.h"
25 #include "libmesh/enum_subset_solve_mode.h"
26 #include "libmesh/enum_parallel_type.h"
27 #include "libmesh/fem_function_base.h"
28 #include "libmesh/libmesh_common.h"
29 #include "libmesh/parallel_object.h"
30 #include "libmesh/qoi_set.h"
31 #include "libmesh/reference_counted_object.h"
32 #include "libmesh/tensor_value.h"
33 #include "libmesh/variable.h"
35 #ifdef LIBMESH_FORWARD_DECLARE_ENUMS
41 #include "libmesh/enum_norm_type.h"
52 #if defined(LIBMESH_HAVE_PETSC) || \
53 defined(LIBMESH_HAVE_EIGEN) || \
54 defined(LIBMESH_HAVE_LASPACK) || \
55 defined(LIBMESH_TRILINOS_HAVE_AZTECOO)
56 #define LIBMESH_HAVE_SOLVER 1
64 class EquationSystems;
68 template <
typename Output>
class FunctionBase;
70 class ParameterVector;
72 class SensitivityData;
73 template <
typename T>
class NumericVector;
74 template <
typename T>
class SparseMatrix;
75 template <
typename T>
class VectorValue;
110 const std::string &
name,
111 const unsigned int number);
204 virtual void qoi (
const QoISet & qoi_indices) = 0;
229 bool include_liftfunc,
230 bool apply_constraints) = 0;
254 virtual void clear ();
307 bool include_liftfunc =
true,
308 bool apply_constraints =
true);
345 virtual std::pair<unsigned int, Real>
358 virtual std::pair<unsigned int, Real>
372 virtual std::pair<unsigned int, Real>
389 virtual std::pair<unsigned int, Real>
482 const Real threshold,
483 const bool verbose)
const;
488 const std::string &
name ()
const;
530 const std::string & sys_name,
531 const std::string & unknown_name);
534 const std::string & sys_name,
535 const std::string & unknown_name);
556 int is_adjoint = -1)
const;
574 int is_adjoint = -1)
const;
591 int is_adjoint = -1)
const;
608 const std::vector<unsigned int> & variables,
625 const std::vector<unsigned int> & variables,
648 const std::vector<unsigned int> & variables,
652 int is_adjoint = -1)
const;
670 const std::vector<unsigned int> & variables,
675 int is_adjoint = -1)
const;
680 unsigned int number ()
const;
789 const bool projections=
true,
809 bool have_vector (
const std::string & vec_name)
const;
869 const std::string &
vector_name (
const unsigned int vec_num)
const;
1051 unsigned int n_vars()
const;
1104 const std::set<subdomain_id_type> *
const active_subdomains =
nullptr);
1116 const std::set<subdomain_id_type> *
const active_subdomains =
nullptr);
1126 unsigned int add_variables (
const std::vector<std::string> & vars,
1128 const std::set<subdomain_id_type> *
const active_subdomains =
nullptr);
1137 unsigned int add_variables (
const std::vector<std::string> & vars,
1140 const std::set<subdomain_id_type> *
const active_subdomains =
nullptr);
1160 const std::string &
variable_name(
const unsigned int i)
const;
1185 unsigned int component)
const;
1198 unsigned int component)
const;
1229 std::set<unsigned int> * skip_dimensions=
nullptr)
const;
1237 std::set<unsigned int> * skip_dimensions=
nullptr)
const;
1243 const std::string & version,
1245 const bool read_additional_data=
true,
1246 const bool read_legacy_format=
false);
1255 #ifdef LIBMESH_ENABLE_DEPRECATED
1257 const bool read_additional_data=
true);
1264 template <
typename ValType>
1266 const bool read_additional_data=
true);
1274 const bool read_additional_data=
true)
1275 { read_serialized_data<Number>(io, read_additional_data); }
1282 template <
typename InValType>
1295 {
return read_serialized_vectors<Number>(io, vectors); }
1303 template <
typename InValType>
1305 const bool read_additional_data);
1316 const bool read_additional_data)
1317 { read_parallel_data<Number>(io, read_additional_data); }
1323 const std::string & version,
1324 const bool write_additional_data)
const;
1331 const bool write_additional_data =
true)
const;
1348 const bool write_additional_data)
const;
1360 const std::string &
name));
1374 const std::string &
name));
1386 const std::string &
name));
1398 const std::string &
name,
1399 const QoISet & qoi_indices));
1413 const std::string &
name,
1414 const QoISet & qoi_indices,
1415 bool include_liftfunc,
1416 bool apply_constraints));
1454 bool include_liftfunc =
true,
1455 bool apply_constraints =
true);
1566 unsigned int n_qois()
const;
1598 const bool insist_on_success =
true,
1634 const bool insist_on_success =
true,
1665 const bool insist_on_success =
true,
1698 std::set<dof_id_type> & var_indices)
const;
1714 #ifdef LIBMESH_HAVE_METAPHYSICL
1726 #endif // LIBMESH_HAVE_METAPHYSICL
1746 int is_adjoint = -1)
const;
1758 int is_adjoint = -1)
const;
1794 template <
typename iterator_type,
typename InValType>
1796 const iterator_type begin,
1797 const iterator_type
end,
1798 const InValType dummy,
1823 template <
typename InValType>
1837 {
return read_serialized_vector<Number>(io, &vec); }
1845 template <
typename iterator_type>
1848 const iterator_type begin,
1849 const iterator_type
end,
1859 const unsigned int var,
1875 const std::string &
name);
1886 const std::string &
name);
1897 const std::string &
name);
1908 const std::string &
name,
1909 const QoISet & qoi_indices);
1920 const std::string &
name,
1921 const QoISet & qoi_indices,
1922 bool include_liftfunc,
1923 bool apply_constraints);
1985 std::map<std::string, NumericVector<Number> * >
_vectors;
2157 return cast_int<unsigned int>(
_variables.size());
2215 unsigned int component)
const
2225 unsigned int component)
const
2227 return _variables[var_num].first_scalar_number() + component;
2285 return cast_int<unsigned int>(
_vectors.size());
2321 libmesh_not_implemented();
2330 return cast_int<unsigned int>(this->
qoi.size());
2334 std::pair<unsigned int, Real>
2337 libmesh_not_implemented();
2341 std::pair<unsigned int, Real>
2345 libmesh_not_implemented();
2349 std::pair<unsigned int, Real>
2352 libmesh_not_implemented();
2356 std::pair<unsigned int, Real>
2361 libmesh_not_implemented();
2370 libmesh_not_implemented();
2379 libmesh_not_implemented();
2388 libmesh_not_implemented();
2398 libmesh_not_implemented();
2404 #endif // LIBMESH_SYSTEM_H
void set_vector_preservation(const std::string &vec_name, bool preserve)
Allows one to set the boolean controlling whether the vector identified by vec_name should be "preser...
Manages consistently variables, degrees of freedom, and coefficient vectors.
dof_id_type write_serialized_vector(Xdr &io, const NumericVector< Number > &vec) const
Writes a vector for this System.
void activate()
Activates the system.
std::map< std::string, bool > _vector_projections
Holds true if a vector by that name should be projected onto a changed grid, false if it should be ze...
numeric_index_type read_serialized_vector(Xdr &io, NumericVector< Number > *vec)
Reads a vector for this System.
System sys_type
The type of system.
void boundary_project_solution(const std::set< boundary_id_type > &b, const std::vector< unsigned int > &variables, FunctionBase< Number > *f, FunctionBase< Gradient > *g=nullptr)
Projects arbitrary boundary functions onto a vector of degree of freedom values for the current syste...
unsigned int n_vars() const
bool have_vector(const std::string &vec_name) const
const EquationSystems & get_equation_systems() const
const unsigned int invalid_uint
A number which is used quite often to represent an invalid or uninitialized value.
void project_vector(NumericVector< Number > &new_vector, FunctionBase< Number > *f, FunctionBase< Gradient > *g=nullptr, int is_adjoint=-1) const
Projects arbitrary functions onto a vector of degree of freedom values for the current system.
virtual void reinit()
Reinitializes degrees of freedom and other required data on the current mesh.
NumericVector< Number > & get_sensitivity_rhs(unsigned int i=0)
void write_parallel_data(Xdr &io, const bool write_additional_data) const
Writes additional data, namely vectors, for this System.
bool _is_initialized
true when additional vectors and variables do not require immediate initialization,...
std::vector< VariableGroup > _variable_groups
The VariableGroup in this System.
void(* _constrain_system_function)(EquationSystems &es, const std::string &name)
Function to impose constraints.
std::map< std::string, NumericVector< Number > * >::iterator vectors_iterator
Vector iterator typedefs.
void attach_QOI_function(void fptr(EquationSystems &es, const std::string &name, const QoISet &qoi_indices))
Register a user function for evaluating the quantities of interest, whose values should be placed in ...
void boundary_project_vector(const std::set< boundary_id_type > &b, const std::vector< unsigned int > &variables, NumericVector< Number > &new_vector, FunctionBase< Number > *f, FunctionBase< Gradient > *g=nullptr, int is_adjoint=-1) const
Projects arbitrary boundary functions onto a vector of degree of freedom values for the current syste...
NumericVector< Number > & add_adjoint_solution(unsigned int i=0)
virtual bool compare(const System &other_system, const Real threshold, const bool verbose) const
virtual ~Assembly()
Destructor.
std::unique_ptr< DofMap > _dof_map
Data structure describing the relationship between nodes, variables, etc...
unsigned int add_variables(const std::vector< std::string > &vars, const FEType &type, const std::set< subdomain_id_type > *const active_subdomains=nullptr)
Adds the variable var to the list of variables for this system.
void init()
Initializes degrees of freedom on the current mesh.
void(* _assemble_system_function)(EquationSystems &es, const std::string &name)
Function that assembles the system.
bool _hide_output
Are we allowed to write this system to file? If _hide_output is true, then EquationSystems::write wil...
virtual void user_assembly()
Calls user's attached assembly function, or is overridden by the user in derived classes.
NumericVector< Number > & get_adjoint_solution(unsigned int i=0)
virtual std::string system_type() const
std::map< std::string, NumericVector< Number > * > _vectors
Some systems need an arbitrary number of vectors.
NumericVector< Number > & get_weighted_sensitivity_adjoint_solution(unsigned int i=0)
std::map< std::string, ParallelType > _vector_types
Holds the type of a vector.
This class implements reference counting.
const std::string & variable_name(const unsigned int i) const
std::size_t read_serialized_blocked_dof_objects(const dof_id_type n_objects, const iterator_type begin, const iterator_type end, const InValType dummy, Xdr &io, const std::vector< NumericVector< Number > * > &vecs, const unsigned int var_to_read=libMesh::invalid_uint) const
Reads an input vector from the stream io and assigns the values to a set of DofObjects.
The libMesh namespace provides an interface to certain functionality in the library.
This class implements a C++ interface to the XDR (eXternal Data Representation) format.
unsigned int n_vectors() const
NumericVector< Number > & add_sensitivity_solution(unsigned int i=0)
virtual void restrict_vectors()
Restrict vectors after the mesh has coarsened.
virtual void qoi_parameter_hessian_vector_product(const QoISet &qoi_indices, const ParameterVector ¶meters, const ParameterVector &vector, SensitivityData &product)
For each of the system's quantities of interest q in qoi[qoi_indices], and for a vector of parameters...
bool identify_variable_groups() const
bool _identify_variable_groups
true when VariableGroup structures should be automatically identified, false otherwise.
unsigned int n_components() const
int extra_quadrature_order
A member int that can be employed to indicate increased or reduced quadrature order.
IterBase * end
Also have a polymorphic pointer to the end object, this prevents iterating past the end.
bool _active
Flag stating if the system is active or not.
void write_header(Xdr &io, const std::string &version, const bool write_additional_data) const
Writes the basic data header for this System.
void set_basic_system_only()
Sets the system to be "basic only": i.e.
NumericVector< Number > & get_adjoint_rhs(unsigned int i=0)
virtual std::pair< unsigned int, Real > weighted_sensitivity_solve(const ParameterVector ¶meters, const ParameterVector &weights)
Assembles & solves the linear system(s) (dR/du)*u_w = sum(w_p*-dR/dp), for those parameters p contain...
Data structure for holding completed parameter sensitivity calculations.
unsigned int number() const
virtual void qoi_parameter_hessian(const QoISet &qoi_indices, const ParameterVector ¶meters, SensitivityData &hessian)
For each of the system's quantities of interest q in qoi[qoi_indices], and for a vector of parameters...
virtual void restrict_solve_to(const SystemSubset *subset, const SubsetSolveMode subset_solve_mode=SUBSET_ZERO)
After calling this method, any solve will be restricted to the given subdomain.
virtual void re_update()
Re-update the local values when the mesh has changed.
unsigned int read_SCALAR_dofs(const unsigned int var, Xdr &io, NumericVector< Number > *vec) const
Reads the SCALAR dofs from the stream io and assigns the values to the appropriate entries of vec.
const Variable & variable(unsigned int var) const
Return a constant reference to Variable var.
bool use_fixed_solution
A boolean to be set to true by systems using elem_fixed_solution, for optional use by e....
Abstract base class to be used for system initialization.
System & operator=(const System &)
This isn't a copyable object, so let's make sure nobody tries.
virtual ~System()
Destructor.
void local_dof_indices(const unsigned int var, std::set< dof_id_type > &var_indices) const
Fills the std::set with the degrees of freedom on the local processor corresponding the the variable ...
virtual unsigned int n_matrices() const
bool is_adjoint_already_solved() const
Accessor for the adjoint_already_solved boolean.
virtual void qoi(const QoISet &qoi_indices)=0
Quantity of interest function.
void(* _init_system_function)(EquationSystems &es, const std::string &name)
Function that initializes the system.
void attach_constraint_object(Constraint &constrain)
Register a user object for imposing constraints.
void(* _qoi_evaluate_function)(EquationSystems &es, const std::string &name, const QoISet &qoi_indices)
Function to evaluate quantity of interest.
NumericVector< Number > & get_weighted_sensitivity_solution()
const std::string & vector_name(const unsigned int vec_num) const
virtual void assemble()
Prepares matrix and _dof_map for matrix assembly.
int vector_is_adjoint(const std::string &vec_name) const
virtual void qoi_derivative(const QoISet &qoi_indices, bool include_liftfunc, bool apply_constraints)=0
Quantity of interest derivative function.
Number current_solution(const dof_id_type global_dof_number) const
unsigned int n_qois() const
Number of currently active quantities of interest.
unsigned int n_components() const
bool _basic_system_only
Holds true if the components of more advanced system types (e.g.
void attach_QOI_derivative(void fptr(EquationSystems &es, const std::string &name, const QoISet &qoi_indices, bool include_liftfunc, bool apply_constraints))
Register a user function for evaluating derivatives of a quantity of interest with respect to test fu...
void zero_variable(NumericVector< Number > &v, unsigned int var_num) const
Zeroes all dofs in v that correspond to variable number var_num.
bool assemble_before_solve
Flag which tells the system to whether or not to call the user assembly function during each call to ...
bool & project_solution_on_reinit(void)
Tells the System whether or not to project the solution vector onto new grids when the system is rein...
NumericVector< Number > & add_adjoint_rhs(unsigned int i=0)
Initialization * _init_system_object
Object that initializes the system.
void attach_assemble_function(void fptr(EquationSystems &es, const std::string &name))
Register a user function to use in assembling the system matrix and RHS.
bool has_variable(const std::string &var) const
unsigned int n_variable_groups() const
This is the MeshBase class.
Abstract base class to be used for derivatives of quantities of interest.
void read_header(Xdr &io, const std::string &version, const bool read_header=true, const bool read_additional_data=true, const bool read_legacy_format=false)
Reads the basic data header for this System.
void attach_init_object(Initialization &init)
Register a user class to use to initialize the system.
virtual void reinit_constraints()
Reinitializes the constraints for this system.
vectors_iterator vectors_end()
End of vectors container.
std::vector< Number > qoi
Values of the quantities of interest.
vectors_iterator vectors_begin()
Beginning of vectors container.
MeshBase & _mesh
Constant reference to the mesh data structure used for the simulation.
virtual void user_QOI(const QoISet &qoi_indices)
Calls user's attached quantity of interest function, or is overridden by the user in derived classes.
std::vector< Variable > _variables
The Variable in this System.
dof_id_type n_local_dofs() const
unsigned int variable_scalar_number(const std::string &var, unsigned int component) const
void(* _qoi_evaluate_derivative_function)(EquationSystems &es, const std::string &name, const QoISet &qoi_indices, bool include_liftfunc, bool apply_constraints)
Function to evaluate quantity of interest derivative.
const VariableGroup & variable_group(unsigned int vg) const
Return a constant reference to VariableGroup vg.
numeric_index_type read_serialized_vector(Xdr &io, NumericVector< Number > &vec)
Non-templated version for backward compatibility.
Data structure for specifying which Quantities of Interest should be calculated in an adjoint or a pa...
void attach_QOI_object(QOI &qoi)
Register a user object for evaluating the quantities of interest, whose values should be placed in Sy...
static unsigned int n_objects()
Prints the number of outstanding (created, but not yet destroyed) objects.
std::string get_info() const
virtual void prolong_vectors()
Prolong vectors after the mesh has refined.
Gradient(* GradientFunctionPointer)(const Point &p, const Parameters ¶meters, const std::string &sys_name, const std::string &unknown_name)
void set_vector_as_adjoint(const std::string &vec_name, int qoi_num)
Allows one to set the QoI index controlling whether the vector identified by vec_name represents a so...
const MeshBase & get_mesh() const
dof_id_type n_local_constrained_dofs() const
void update_global_solution(std::vector< Number > &global_soln) const
Fill the input vector global_soln so that it contains the global solution on all processors.
unsigned int add_variable(const std::string &var, const FEType &type, const std::set< subdomain_id_type > *const active_subdomains=nullptr)
Adds the variable var to the list of variables for this system.
std::unique_ptr< NumericVector< Number > > current_local_solution
All the values I need to compute my contribution to the simulation at hand.
virtual void constrain()=0
Constraint function.
This class defines a tensor in LIBMESH_DIM dimensional Real or Complex space.
NumericVector< Number > & get_sensitivity_solution(unsigned int i=0)
Abstract base class to be used for quantities of interest.
A Point defines a location in LIBMESH_DIM dimensional Real space.
virtual ~Constraint()
Destructor.
System(EquationSystems &es, const std::string &name, const unsigned int number)
Constructor.
This class defines the notion of a variable in the system.
uint8_t processor_id_type
std::size_t read_serialized_vectors(Xdr &io, const std::vector< NumericVector< Number > * > &vectors) const
Non-templated version for backward compatibility.
void read_serialized_data(Xdr &io, const bool read_additional_data=true)
Reads additional data, namely vectors, for this System.
virtual ~QOIDerivative()
Destructor.
Data structure for specifying which Parameters should be independent variables in a parameter sensiti...
std::size_t read_serialized_vectors(Xdr &io, const std::vector< NumericVector< Number > * > &vectors) const
Read a number of identically distributed vectors.
void read_serialized_data(Xdr &io, const bool read_additional_data=true)
Non-templated version for backward compatibility.
unsigned int write_SCALAR_dofs(const NumericVector< Number > &vec, const unsigned int var, Xdr &io) const
Writes the SCALAR dofs associated with var to the stream io.
const unsigned int _sys_number
The number associated with this system.
std::vector< unsigned int > _written_var_indices
This vector is used only when reading in a system from file.
void read_legacy_data(Xdr &io, const bool read_additional_data=true)
Reads additional data, namely vectors, for this System.
virtual void assemble_qoi(const QoISet &qoi_indices=QoISet())
Calls user qoi function.
Gradient gptr(const Point &p, const Parameters &, const std::string &libmesh_dbg_var(sys_name), const std::string &unknown_name)
This is a base class for classes which represent subsets of the dofs of a System.
void attach_QOI_derivative_object(QOIDerivative &qoi_derivative)
Register a user object for evaluating derivatives of a quantity of interest with respect to test func...
virtual void qoi_parameter_sensitivity(const QoISet &qoi_indices, const ParameterVector ¶meters, SensitivityData &sensitivities)
Solves for the derivative of each of the system's quantities of interest q in qoi[qoi_indices] with r...
unsigned int _additional_data_written
This flag is used only when reading in a system from file.
void read_parallel_data(Xdr &io, const bool read_additional_data)
Reads additional data, namely vectors, for this System.
virtual void assemble_residual_derivatives(const ParameterVector ¶meters)
Calls residual parameter derivative function.
Abstract base class to be used for system assembly.
virtual void assemble()=0
Assembly function.
dof_id_type numeric_index_type
This is the EquationSystems class.
Assembly * _assemble_system_object
Object that assembles the system.
Real time
For time-dependent problems, this is the time t at the beginning of the current timestep.
Abstract base class to be used for system constraints.
virtual ~Initialization()
Destructor.
const FEType & variable_type(const unsigned int i) const
void write_serialized_data(Xdr &io, const bool write_additional_data=true) const
Writes additional data, namely vectors, for this System.
bool adjoint_already_solved
Has the adjoint problem already been solved? If the user sets adjoint_already_solved to true,...
unsigned int first_scalar_number() const
dof_id_type n_active_dofs() const
Real discrete_var_norm(const NumericVector< Number > &v, unsigned int var, FEMNormType norm_type) const
Finds the discrete norm for the entries in the vector corresponding to Dofs associated with var.
void deactivate()
Deactivates the system.
Constraint * _constrain_system_object
Object that constrains the system.
NumberVectorValue Gradient
std::unique_ptr< NumericVector< Number > > solution
Data structure to hold solution values.
class FEType hides (possibly multiple) FEFamily and approximation orders, thereby enabling specialize...
virtual std::pair< unsigned int, Real > sensitivity_solve(const ParameterVector ¶meters)
Solves the sensitivity system, for the provided parameters.
virtual std::pair< unsigned int, Real > weighted_sensitivity_adjoint_solve(const ParameterVector ¶meters, const ParameterVector &weights, const QoISet &qoi_indices=QoISet())
Assembles & solves the linear system(s) (dR/du)^T*z_w = sum(w_p*(d^2q/dudp - d^2R/dudp*z)),...
Number point_value(unsigned int var, const Point &p, const bool insist_on_success=true, const NumericVector< Number > *sol=nullptr) const
QOIDerivative * _qoi_evaluate_derivative_object
Object to compute derivatives of quantities of interest.
VectorValue< Number > NumberVectorValue
This class handles the numbering of degrees of freedom on a mesh.
const std::string & name() const
virtual void init_data()
Initializes the data for the system.
void attach_constraint_function(void fptr(EquationSystems &es, const std::string &name))
Register a user function for imposing constraints.
const NumericVector< Number > * request_vector(const std::string &vec_name) const
dof_id_type n_constrained_dofs() const
void attach_init_function(void fptr(EquationSystems &es, const std::string &name))
Register a user function to use in initializing the system.
void projection_matrix(SparseMatrix< Number > &proj_mat) const
This method creates a projection matrix which corresponds to the operation of project_vector between ...
std::size_t write_serialized_vectors(Xdr &io, const std::vector< const NumericVector< Number > * > &vectors) const
Serialize & write a number of identically distributed vectors.
This is the base class from which all geometric element types are derived.
unsigned short int variable_number(const std::string &var) const
std::size_t write_serialized_blocked_dof_objects(const std::vector< const NumericVector< Number > * > &vecs, const dof_id_type n_objects, const iterator_type begin, const iterator_type end, Xdr &io, const unsigned int var_to_write=libMesh::invalid_uint) const
Writes an output vector to the stream io for a set of DofObjects.
MetaPhysicL::DualNumber< T, D > norm(const MetaPhysicL::DualNumber< T, D > &in)
virtual void assemble_qoi_derivative(const QoISet &qoi_indices=QoISet(), bool include_liftfunc=true, bool apply_constraints=true)
Calls user qoi derivative function.
EquationSystems & _equation_systems
Constant reference to the EquationSystems object used for the simulation.
Real calculate_norm(const NumericVector< Number > &v, unsigned int var, FEMNormType norm_type, std::set< unsigned int > *skip_dimensions=nullptr) const
virtual void clear()
Clear all the data structures associated with the system.
virtual void forward_qoi_parameter_sensitivity(const QoISet &qoi_indices, const ParameterVector ¶meters, SensitivityData &sensitivities)
Solves for parameter sensitivities using the forward method.
NumericVector< Number > & add_vector(const std::string &vec_name, const bool projections=true, const ParallelType type=PARALLEL)
Adds the additional vector vec_name to this system.
This class defines a norm/seminorm to be applied to a NumericVector which contains coefficients in a ...
ParallelType
Defines an enum for parallel data structure types.
const DofMap & get_dof_map() const
dof_id_type n_dofs() const
virtual void user_initialization()
Calls user's attached initialization function, or is overridden by the user in derived classes.
void attach_assemble_object(Assembly &assemble)
Register a user object to use in assembling the system matrix and RHS.
QOI * _qoi_evaluate_object
Object to compute quantities of interest.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
virtual ~QOI()
Destructor.
An object whose state is distributed along a set of processors.
Number(* ValueFunctionPointer)(const Point &p, const Parameters &Parameters, const std::string &sys_name, const std::string &unknown_name)
Projects arbitrary functions onto the current solution.
virtual void user_constrain()
Calls user's attached constraint function, or is overridden by the user in derived classes.
virtual std::pair< unsigned int, Real > adjoint_solve(const QoISet &qoi_indices=QoISet())
Solves the adjoint system, for the specified qoi indices, or for every qoi if qoi_indices is nullptr.
NumericVector< Number > & add_weighted_sensitivity_solution()
virtual void disable_cache()
Avoids use of any cached data that might affect any solve result.
void get_all_variable_numbers(std::vector< unsigned int > &all_variable_numbers) const
Fills all_variable_numbers with all the variable numbers for the variables that have been added to th...
void project_solution(FunctionBase< Number > *f, FunctionBase< Gradient > *g=nullptr) const
Projects arbitrary functions onto the current solution.
bool vector_preservation(const std::string &vec_name) const
Number fptr(const Point &p, const Parameters &, const std::string &libmesh_dbg_var(sys_name), const std::string &unknown_name)
virtual void initialize()=0
Initialization function.
NumericVector< Number > & add_weighted_sensitivity_adjoint_solution(unsigned int i=0)
void remove_vector(const std::string &vec_name)
Removes the additional vector vec_name from this system.
This class defines a logically grouped set of variables in the system.
virtual void user_QOI_derivative(const QoISet &qoi_indices=QoISet(), bool include_liftfunc=true, bool apply_constraints=true)
Calls user's attached quantity of interest derivative function, or is overridden by the user in deriv...
const NumericVector< Number > & get_vector(const std::string &vec_name) const
EquationSystems & get_equation_systems()
virtual void solve()
Solves the system.
std::map< std::string, unsigned short int > _variable_numbers
The variable numbers corresponding to user-specified names, useful for name-based lookups.
void read_parallel_data(Xdr &io, const bool read_additional_data)
Non-templated version for backward compatibility.
virtual void update()
Update the local values to reflect the solution on neighboring processors.
NumericVector< Number > & add_sensitivity_rhs(unsigned int i=0)
bool _solution_projection
Holds true if the solution vector should be projected onto a changed grid, false if it should be zero...
Gradient point_gradient(unsigned int var, const Point &p, const bool insist_on_success=true, const NumericVector< Number > *sol=nullptr) const
void ErrorVector unsigned int
This class provides the ability to map between arbitrary, user-defined strings and several data types...
Tensor point_hessian(unsigned int var, const Point &p, const bool insist_on_success=true, const NumericVector< Number > *sol=nullptr) const
const std::string _sys_name
A name associated with this system.
std::map< std::string, NumericVector< Number > * >::const_iterator const_vectors_iterator
virtual void adjoint_qoi_parameter_sensitivity(const QoISet &qoi_indices, const ParameterVector ¶meters, SensitivityData &sensitivities)
Solves for parameter sensitivities using the adjoint method.
std::map< std::string, int > _vector_is_adjoint
Holds non-negative if a vector by that name should be projected using adjoint constraints/BCs,...
void set_adjoint_already_solved(bool setting)
Setter for the adjoint_already_solved boolean.