20 #ifndef LIBMESH_SYSTEM_H 21 #define LIBMESH_SYSTEM_H 36 #ifdef LIBMESH_FORWARD_DECLARE_ENUMS 56 class EquationSystems;
60 template <
typename Output>
class FunctionBase;
62 class ParameterVector;
64 class SensitivityData;
65 template <
typename T>
class NumericVector;
66 template <
typename T>
class SparseMatrix;
67 template <
typename T>
class VectorValue;
102 const std::string &
name,
103 const unsigned int number);
196 virtual void qoi (
const QoISet & qoi_indices) = 0;
221 bool include_liftfunc,
222 bool apply_constraints) = 0;
246 virtual void clear ();
299 bool include_liftfunc =
true,
300 bool apply_constraints =
true);
337 virtual std::pair<unsigned int, Real>
350 virtual std::pair<unsigned int, Real>
364 virtual std::pair<unsigned int, Real>
381 virtual std::pair<unsigned int, Real>
474 const Real threshold,
475 const bool verbose)
const;
480 const std::string &
name ()
const;
522 const std::string & sys_name,
523 const std::string & unknown_name);
526 const std::string & sys_name,
527 const std::string & unknown_name);
548 int is_adjoint = -1)
const;
566 int is_adjoint = -1)
const;
583 int is_adjoint = -1)
const;
600 const std::vector<unsigned int> & variables,
617 const std::vector<unsigned int> & variables,
640 const std::vector<unsigned int> & variables,
644 int is_adjoint = -1)
const;
662 const std::vector<unsigned int> & variables,
667 int is_adjoint = -1)
const;
672 unsigned int number ()
const;
781 const bool projections=
true,
801 bool have_vector (
const std::string & vec_name)
const;
861 const std::string &
vector_name (
const unsigned int vec_num)
const;
1043 unsigned int n_vars()
const;
1094 const std::set<subdomain_id_type> *
const active_subdomains =
nullptr);
1104 const std::set<subdomain_id_type> *
const active_subdomains =
nullptr);
1112 unsigned int add_variables (
const std::vector<std::string> & vars,
1114 const std::set<subdomain_id_type> *
const active_subdomains =
nullptr);
1121 unsigned int add_variables (
const std::vector<std::string> & vars,
1124 const std::set<subdomain_id_type> *
const active_subdomains =
nullptr);
1144 const std::string &
variable_name(
const unsigned int i)
const;
1169 unsigned int component)
const;
1182 unsigned int component)
const;
1213 std::set<unsigned int> * skip_dimensions=
nullptr)
const;
1221 std::set<unsigned int> * skip_dimensions=
nullptr)
const;
1227 const std::string & version,
1229 const bool read_additional_data=
true,
1230 const bool read_legacy_format=
false);
1239 #ifdef LIBMESH_ENABLE_DEPRECATED 1241 const bool read_additional_data=
true);
1248 template <
typename ValType>
1250 const bool read_additional_data=
true);
1258 const bool read_additional_data=
true)
1259 { read_serialized_data<Number>(io, read_additional_data); }
1266 template <
typename InValType>
1279 {
return read_serialized_vectors<Number>(io, vectors); }
1287 template <
typename InValType>
1289 const bool read_additional_data);
1300 const bool read_additional_data)
1301 { read_parallel_data<Number>(io, read_additional_data); }
1307 const std::string & version,
1308 const bool write_additional_data)
const;
1315 const bool write_additional_data =
true)
const;
1332 const bool write_additional_data)
const;
1344 const std::string &
name));
1358 const std::string &
name));
1370 const std::string &
name));
1382 const std::string &
name,
1383 const QoISet & qoi_indices));
1397 const std::string &
name,
1398 const QoISet & qoi_indices,
1399 bool include_liftfunc,
1400 bool apply_constraints));
1438 bool include_liftfunc =
true,
1439 bool apply_constraints =
true);
1550 unsigned int n_qois()
const;
1581 const bool insist_on_success =
true)
const;
1605 const bool insist_on_success =
true)
const;
1626 const bool insist_on_success =
true)
const;
1648 std::set<dof_id_type> & var_indices)
const;
1664 #ifdef LIBMESH_HAVE_METAPHYSICL 1676 #endif // LIBMESH_HAVE_METAPHYSICL 1696 int is_adjoint = -1)
const;
1708 int is_adjoint = -1)
const;
1744 template <
typename iterator_type,
typename InValType>
1746 const iterator_type begin,
1747 const iterator_type
end,
1748 const InValType dummy,
1773 template <
typename InValType>
1787 {
return read_serialized_vector<Number>(io, &vec); }
1795 template <
typename iterator_type>
1798 const iterator_type begin,
1799 const iterator_type
end,
1809 const unsigned int var,
1825 const std::string &
name);
1836 const std::string &
name);
1847 const std::string &
name);
1858 const std::string &
name,
1859 const QoISet & qoi_indices);
1870 const std::string &
name,
1871 const QoISet & qoi_indices,
1872 bool include_liftfunc,
1873 bool apply_constraints);
1935 std::map<std::string, NumericVector<Number> * >
_vectors;
2107 return cast_int<unsigned int>(
_variables.size());
2165 unsigned int component)
const 2175 unsigned int component)
const 2177 return _variables[var_num].first_scalar_number() + component;
2235 return cast_int<unsigned int>(
_vectors.size());
2271 libmesh_not_implemented();
2280 return cast_int<unsigned int>(this->
qoi.size());
2284 std::pair<unsigned int, Real>
2287 libmesh_not_implemented();
2291 std::pair<unsigned int, Real>
2295 libmesh_not_implemented();
2299 std::pair<unsigned int, Real>
2302 libmesh_not_implemented();
2306 std::pair<unsigned int, Real>
2311 libmesh_not_implemented();
2320 libmesh_not_implemented();
2329 libmesh_not_implemented();
2338 libmesh_not_implemented();
2348 libmesh_not_implemented();
2354 #endif // LIBMESH_SYSTEM_H void set_vector_as_adjoint(const std::string &vec_name, int qoi_num)
Manages the family, order, etc. parameters for a given FE.
unsigned int add_variables(const std::vector< std::string > &vars, const FEType &type, const std::set< subdomain_id_type > *const active_subdomains=nullptr)
vectors_iterator vectors_end()
void local_dof_indices(const unsigned int var, std::set< dof_id_type > &var_indices) const
std::map< std::string, unsigned short int > _variable_numbers
void write_serialized_data(Xdr &io, const bool write_additional_data=true) const
Manages multiples systems of equations.
unsigned int variable_scalar_number(const std::string &var, unsigned int component) const
static unsigned int n_objects()
void update_global_solution(std::vector< Number > &global_soln) const
void write_parallel_data(Xdr &io, const bool write_additional_data) const
const Variable & variable(unsigned int var) const
Assembly * _assemble_system_object
const unsigned int invalid_uint
std::map< std::string, ParallelType > _vector_types
void(* _constrain_system_function)(EquationSystems &es, const std::string &name)
void set_adjoint_already_solved(bool setting)
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
NumericVector< Number > & add_adjoint_solution(unsigned int i=0)
virtual void forward_qoi_parameter_sensitivity(const QoISet &qoi_indices, const ParameterVector ¶meters, SensitivityData &sensitivities)
Specifies parameters for parameter sensitivity calculations.
virtual void assemble_residual_derivatives(const ParameterVector ¶meters)
Used to specify quantities of interest in a simulation.
void read_parallel_data(Xdr &io, const bool read_additional_data)
unsigned int n_qois() const
unsigned int n_components() const
virtual void disable_cache()
int vector_is_adjoint(const std::string &vec_name) const
int extra_quadrature_order
virtual void initialize()=0
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
NumericVector< Number > & get_sensitivity_solution(unsigned int i=0)
unsigned int write_SCALAR_dofs(const NumericVector< Number > &vec, const unsigned int var, Xdr &io) const
const unsigned int _sys_number
virtual void assemble_qoi_derivative(const QoISet &qoi_indices=QoISet(), bool include_liftfunc=true, bool apply_constraints=true)
NumericVector< Number > & get_sensitivity_rhs(unsigned int i=0)
virtual void assemble()=0
Constraint * _constrain_system_object
const EquationSystems & get_equation_systems() const
unsigned int n_variable_groups() const
Gradient point_gradient(unsigned int var, const Point &p, const bool insist_on_success=true) const
void projection_matrix(SparseMatrix< Number > &proj_mat) const
The base class for all geometric element types.
uint8_t processor_id_type
std::unique_ptr< DofMap > _dof_map
std::map< std::string, NumericVector< Number > * >::const_iterator const_vectors_iterator
virtual void user_initialization()
std::vector< Variable > _variables
void get_all_variable_numbers(std::vector< unsigned int > &all_variable_numbers) const
NumericVector< Number > & add_sensitivity_rhs(unsigned int i=0)
void read_legacy_data(Xdr &io, const bool read_additional_data=true)
std::size_t read_serialized_vectors(Xdr &io, const std::vector< NumericVector< Number > *> &vectors) const
vectors_iterator vectors_begin()
void attach_QOI_derivative_object(QOIDerivative &qoi_derivative)
virtual void adjoint_qoi_parameter_sensitivity(const QoISet &qoi_indices, const ParameterVector ¶meters, SensitivityData &sensitivities)
dof_id_type n_local_dofs() const
NumericVector< Number > & add_weighted_sensitivity_solution()
void(* _qoi_evaluate_function)(EquationSystems &es, const std::string &name, const QoISet &qoi_indices)
const MeshBase & get_mesh() const
bool has_variable(const std::string &var) const
NumericVector< Number > & get_weighted_sensitivity_solution()
bool adjoint_already_solved
dof_id_type n_dofs() const
virtual void prolong_vectors()
Tensor point_hessian(unsigned int var, const Point &p, const bool insist_on_success=true) const
Number current_solution(const dof_id_type global_dof_number) const
virtual void user_QOI(const QoISet &qoi_indices)
QOIDerivative * _qoi_evaluate_derivative_object
void remove_vector(const std::string &vec_name)
NumericVector< Number > & add_weighted_sensitivity_adjoint_solution(unsigned int i=0)
virtual void qoi_derivative(const QoISet &qoi_indices, bool include_liftfunc, bool apply_constraints)=0
virtual void qoi_parameter_sensitivity(const QoISet &qoi_indices, const ParameterVector ¶meters, SensitivityData &sensitivities)
virtual void qoi_parameter_hessian(const QoISet &qoi_indices, const ParameterVector ¶meters, SensitivityData &hessian)
void attach_constraint_object(Constraint &constrain)
Manages the degrees of freedom (DOFs) in a simulation.
void project_solution(FunctionBase< Number > *f, FunctionBase< Gradient > *g=nullptr) const
void attach_init_object(Initialization &init)
void set_basic_system_only()
unsigned int first_scalar_number() const
unsigned int number() const
NumericVector< Number > & add_vector(const std::string &vec_name, const bool projections=true, const ParallelType type=PARALLEL)
A variable which is solved for in a System of equations.
virtual void qoi_parameter_hessian_vector_product(const QoISet &qoi_indices, const ParameterVector ¶meters, const ParameterVector &vector, SensitivityData &product)
Holds completed parameter sensitivity calculations.
dof_id_type numeric_index_type
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)
std::vector< Number > qoi
unsigned int n_components() const
void read_serialized_data(Xdr &io, const bool read_additional_data=true)
std::vector< VariableGroup > _variable_groups
bool vector_preservation(const std::string &vec_name) const
unsigned int n_vectors() const
Manages consistently variables, degrees of freedom, and coefficient vectors.
void zero_variable(NumericVector< Number > &v, unsigned int var_num) const
unsigned short int variable_number(const std::string &var) const
const NumericVector< Number > & get_vector(const std::string &vec_name) const
std::string get_info() const
numeric_index_type read_serialized_vector(Xdr &io, NumericVector< Number > *vec)
NumberVectorValue Gradient
virtual void qoi(const QoISet &qoi_indices)=0
std::unique_ptr< NumericVector< Number > > solution
void attach_QOI_derivative(void fptr(EquationSystems &es, const std::string &name, const QoISet &qoi_indices, bool include_liftfunc, bool apply_constraints))
Real calculate_norm(const NumericVector< Number > &v, unsigned int var, FEMNormType norm_type, std::set< unsigned int > *skip_dimensions=nullptr) const
QOI * _qoi_evaluate_object
virtual std::pair< unsigned int, Real > sensitivity_solve(const ParameterVector ¶meters)
Initialization * _init_system_object
virtual std::pair< unsigned int, Real > adjoint_solve(const QoISet &qoi_indices=QoISet())
System & operator=(const System &)
void attach_QOI_function(void fptr(EquationSystems &es, const std::string &name, const QoISet &qoi_indices))
unsigned int _additional_data_written
const std::string & variable_name(const unsigned int i) const
void(* _init_system_function)(EquationSystems &es, const std::string &name)
dof_id_type n_active_dofs() const
virtual void restrict_vectors()
void attach_assemble_function(void fptr(EquationSystems &es, const std::string &name))
std::map< std::string, int > _vector_is_adjoint
virtual ~Initialization()
std::size_t read_serialized_vectors(Xdr &io, const std::vector< NumericVector< Number > *> &vectors) const
virtual unsigned int n_matrices() const
An object whose state is distributed along a set of processors.
NumericVector< Number > & add_adjoint_rhs(unsigned int i=0)
virtual void restrict_solve_to(const SystemSubset *subset, const SubsetSolveMode subset_solve_mode=SUBSET_ZERO)
bool have_vector(const std::string &vec_name) const
virtual void user_QOI_derivative(const QoISet &qoi_indices=QoISet(), bool include_liftfunc=true, bool apply_constraints=true)
virtual void reinit_constraints()
bool identify_variable_groups() const
bool is_adjoint_already_solved() const
C++ interface for the XDR (eXternal Data Representation) format.
EquationSystems & get_equation_systems()
void attach_assemble_object(Assembly &assemble)
std::map< std::string, NumericVector< Number > * >::iterator vectors_iterator
bool _solution_projection
EquationSystems & _equation_systems
std::size_t write_serialized_vectors(Xdr &io, const std::vector< const NumericVector< Number > *> &vectors) const
virtual std::string system_type() const
virtual void constrain()=0
void read_parallel_data(Xdr &io, const bool read_additional_data)
const std::string & vector_name(const unsigned int vec_num) const
void attach_QOI_object(QOI &qoi)
virtual void user_assembly()
const FEType & variable_type(const unsigned int i) const
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
void set_vector_preservation(const std::string &vec_name, bool preserve)
Number(* ValueFunctionPointer)(const Point &p, const Parameters &Parameters, const std::string &sys_name, const std::string &unknown_name)
bool _identify_variable_groups
std::map< std::string, NumericVector< Number > *> _vectors
virtual std::pair< unsigned int, Real > weighted_sensitivity_solve(const ParameterVector ¶meters, const ParameterVector &weights)
const std::string _sys_name
const NumericVector< Number > * request_vector(const std::string &vec_name) const
bool & project_solution_on_reinit(void)
NumericVector< Number > & get_adjoint_solution(unsigned int i=0)
std::map< std::string, bool > _vector_projections
std::unique_ptr< NumericVector< Number > > current_local_solution
virtual std::pair< unsigned int, Real > weighted_sensitivity_adjoint_solve(const ParameterVector ¶meters, const ParameterVector &weights, const QoISet &qoi_indices=QoISet())
void project_vector(NumericVector< Number > &new_vector, FunctionBase< Number > *f, FunctionBase< Gradient > *g=nullptr, int is_adjoint=-1) const
virtual bool compare(const System &other_system, const Real threshold, const bool verbose) const
dof_id_type n_local_constrained_dofs() const
void boundary_project_solution(const std::set< boundary_id_type > &b, const std::vector< unsigned int > &variables, FunctionBase< Number > *f, FunctionBase< Gradient > *g=nullptr)
unsigned int read_SCALAR_dofs(const unsigned int var, Xdr &io, NumericVector< Number > *vec) const
Number point_value(unsigned int var, const Point &p, const bool insist_on_success=true) const
const std::string & name() const
void attach_constraint_function(void fptr(EquationSystems &es, const std::string &name))
Gradient(* GradientFunctionPointer)(const Point &p, const Parameters ¶meters, const std::string &sys_name, const std::string &unknown_name)
virtual void user_constrain()
Real discrete_var_norm(const NumericVector< Number > &v, unsigned int var, FEMNormType norm_type) const
virtual void assemble_qoi(const QoISet &qoi_indices=QoISet())
NumericVector< Number > & add_sensitivity_solution(unsigned int i=0)
unsigned int n_vars() const
unsigned int add_variable(const std::string &var, const FEType &type, const std::set< subdomain_id_type > *const active_subdomains=nullptr)
VectorValue< Number > NumberVectorValue
void(* _assemble_system_function)(EquationSystems &es, const std::string &name)
numeric_index_type read_serialized_vector(Xdr &io, NumericVector< Number > &vec)
bool assemble_before_solve
System(EquationSystems &es, const std::string &name, const unsigned int number)
const DofMap & get_dof_map() const
A geometric point in (x,y,z) space.
void read_serialized_data(Xdr &io, const bool read_additional_data=true)
const VariableGroup & variable_group(unsigned int vg) const
void attach_init_function(void fptr(EquationSystems &es, const std::string &name))
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
NumericVector< Number > & get_weighted_sensitivity_adjoint_solution(unsigned int i=0)
dof_id_type n_constrained_dofs() const
std::vector< unsigned int > _written_var_indices
void write_header(Xdr &io, const std::string &version, const bool write_additional_data) const
void(* _qoi_evaluate_derivative_function)(EquationSystems &es, const std::string &name, const QoISet &qoi_indices, bool include_liftfunc, bool apply_constraints)
NumericVector< Number > & get_adjoint_rhs(unsigned int i=0)
dof_id_type write_serialized_vector(Xdr &io, const NumericVector< Number > &vec) const