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

Manages consistently variables, degrees of freedom, and coefficient vectors for eigenvalue problems. More...

#include <eigen_system.h>

Inheritance diagram for libMesh::EigenSystem:
[legend]

Public Types

typedef EigenSystem sys_type
 The type of system. More...
 
typedef System Parent
 The type of the parent. More...
 
typedef 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. More...
 
typedef Gradient(* GradientFunctionPointer) (const Point &p, const Parameters &parameters, const std::string &sys_name, const std::string &unknown_name)
 
typedef std::map< std::string, std::unique_ptr< NumericVector< Number > >, std::less<> >::iterator vectors_iterator
 Vector iterator typedefs. More...
 
typedef std::map< std::string, std::unique_ptr< NumericVector< Number > >, std::less<> >::const_iterator const_vectors_iterator
 
typedef std::map< std::string, std::unique_ptr< SparseMatrix< Number > >, std::less<> >::iterator matrices_iterator
 Matrix iterator typedefs. More...
 
typedef std::map< std::string, std::unique_ptr< SparseMatrix< Number > >, std::less<> >::const_iterator const_matrices_iterator
 

Public Member Functions

 EigenSystem (EquationSystems &es, const std::string &name_in, const unsigned int number_in)
 Constructor. More...
 
 EigenSystem (const EigenSystem &)=delete
 Special functions. More...
 
EigenSystemoperator= (const EigenSystem &)=delete
 
 EigenSystem (EigenSystem &&)=default
 
EigenSystemoperator= (EigenSystem &&)=delete
 
virtual ~EigenSystem ()
 
sys_typesystem ()
 
virtual void clear () override
 Clear all the data structures associated with the system. More...
 
virtual void reinit () override
 Reinitializes the member data fields associated with the system, so that, e.g., assemble() may be used. More...
 
virtual void solve () override
 Assembles & solves the eigen system. More...
 
virtual std::pair< Real, Realget_eigenpair (dof_id_type i)
 
virtual std::pair< Real, Realget_eigenvalue (dof_id_type i)
 
virtual std::string system_type () const override
 
unsigned int get_n_converged () const
 
unsigned int get_n_iterations () const
 
void set_eigenproblem_type (EigenProblemType ept)
 Sets the type of the current eigen problem. More...
 
EigenProblemType get_eigenproblem_type () const
 
void set_initial_space (NumericVector< Number > &initial_space_in)
 Sets an initial eigen vector. More...
 
bool generalized () const
 
bool use_shell_matrices () const
 
void use_shell_matrices (bool use_shell_matrices)
 Set a flag to use shell matrices. More...
 
bool use_shell_precond_matrix () const
 
void use_shell_precond_matrix (bool use_shell_precond_matrix)
 Set a flag to use a shell preconditioning matrix. More...
 
const SparseMatrix< Number > & get_matrix_A () const
 
SparseMatrix< Number > & get_matrix_A ()
 
const SparseMatrix< Number > & get_matrix_B () const
 
SparseMatrix< Number > & get_matrix_B ()
 
const SparseMatrix< Number > & get_precond_matrix () const
 
SparseMatrix< Number > & get_precond_matrix ()
 
const ShellMatrix< Number > & get_shell_matrix_A () const
 
ShellMatrix< Number > & get_shell_matrix_A ()
 
const ShellMatrix< Number > & get_shell_matrix_B () const
 
ShellMatrix< Number > & get_shell_matrix_B ()
 
const ShellMatrix< Number > & get_shell_precond_matrix () const
 
ShellMatrix< Number > & get_shell_precond_matrix ()
 
const EigenSolver< Number > & get_eigen_solver () const
 
EigenSolver< Number > & get_eigen_solver ()
 
bool has_matrix_A () const
 
bool has_matrix_B () const
 
bool has_precond_matrix () const
 
bool has_shell_matrix_A () const
 
bool has_shell_matrix_B () const
 
bool has_shell_precond_matrix () const
 
void init ()
 Initializes degrees of freedom on the current mesh. More...
 
virtual void reinit_constraints ()
 Reinitializes the constraints for this system. More...
 
virtual void reinit_mesh ()
 Reinitializes the system with a new mesh. More...
 
bool is_initialized () const
 
virtual void update ()
 Update the local values to reflect the solution on neighboring processors. More...
 
virtual void assemble ()
 Prepares matrix and _dof_map for matrix assembly. More...
 
virtual void assemble_qoi (const QoISet &qoi_indices=QoISet())
 Calls user qoi function. More...
 
virtual void assemble_qoi_derivative (const QoISet &qoi_indices=QoISet(), bool include_liftfunc=true, bool apply_constraints=true)
 Calls user qoi derivative function. More...
 
virtual void assemble_residual_derivatives (const ParameterVector &parameters)
 Calls residual parameter derivative function. More...
 
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. More...
 
virtual std::pair< unsigned int, Realsensitivity_solve (const ParameterVector &parameters)
 Solves the sensitivity system, for the provided parameters. More...
 
virtual std::pair< unsigned int, Realweighted_sensitivity_solve (const ParameterVector &parameters, const ParameterVector &weights)
 Assembles & solves the linear system(s) (dR/du)*u_w = sum(w_p*-dR/dp), for those parameters p contained within parameters weighted by the values w_p found within weights. More...
 
virtual std::pair< unsigned int, Realadjoint_solve (const QoISet &qoi_indices=QoISet())
 Solves the adjoint system, for the specified qoi indices, or for every qoi if qoi_indices is nullptr. More...
 
virtual std::pair< unsigned int, Realweighted_sensitivity_adjoint_solve (const ParameterVector &parameters, 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)), for those parameters p contained within parameters, weighted by the values w_p found within weights. More...
 
bool is_adjoint_already_solved () const
 Accessor for the adjoint_already_solved boolean. More...
 
void set_adjoint_already_solved (bool setting)
 Setter for the adjoint_already_solved boolean. More...
 
virtual void qoi_parameter_sensitivity (const QoISet &qoi_indices, const ParameterVector &parameters, SensitivityData &sensitivities)
 Solves for the derivative of each of the system's quantities of interest q in qoi[qoi_indices] with respect to each parameter in parameters, placing the result for qoi i and parameter j into sensitivities[i][j]. More...
 
virtual void adjoint_qoi_parameter_sensitivity (const QoISet &qoi_indices, const ParameterVector &parameters, SensitivityData &sensitivities)
 Solves for parameter sensitivities using the adjoint method. More...
 
virtual void forward_qoi_parameter_sensitivity (const QoISet &qoi_indices, const ParameterVector &parameters, SensitivityData &sensitivities)
 Solves for parameter sensitivities using the forward method. More...
 
virtual void qoi_parameter_hessian (const QoISet &qoi_indices, const ParameterVector &parameters, SensitivityData &hessian)
 For each of the system's quantities of interest q in qoi[qoi_indices], and for a vector of parameters p, the parameter sensitivity Hessian H_ij is defined as H_ij = (d^2 q)/(d p_i d p_j) This Hessian is the output of this method, where for each q_i, H_jk is stored in hessian.second_derivative(i,j,k). More...
 
virtual void qoi_parameter_hessian_vector_product (const QoISet &qoi_indices, const ParameterVector &parameters, 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 p, the parameter sensitivity Hessian H_ij is defined as H_ij = (d^2 q)/(d p_i d p_j) The Hessian-vector product, for a vector v_k in parameter space, is S_j = H_jk v_k This product is the output of this method, where for each q_i, S_j is stored in sensitivities[i][j]. More...
 
virtual bool compare (const System &other_system, const Real threshold, const bool verbose) const
 
const std::string & name () const
 
void project_solution (FunctionBase< Number > *f, FunctionBase< Gradient > *g=nullptr) const
 Projects arbitrary functions onto the current solution. More...
 
void project_solution (FEMFunctionBase< Number > *f, FEMFunctionBase< Gradient > *g=nullptr) const
 Projects arbitrary functions onto the current solution. More...
 
void project_solution (ValueFunctionPointer fptr, GradientFunctionPointer gptr, const Parameters &parameters) const
 This method projects an arbitrary function onto the solution via L2 projections and nodal interpolations on each element. More...
 
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. More...
 
void project_vector (NumericVector< Number > &new_vector, FEMFunctionBase< Number > *f, FEMFunctionBase< Gradient > *g=nullptr, int is_adjoint=-1) const
 Projects arbitrary functions onto a vector of degree of freedom values for the current system. More...
 
void project_vector (ValueFunctionPointer fptr, GradientFunctionPointer gptr, const Parameters &parameters, NumericVector< Number > &new_vector, int is_adjoint=-1) const
 Projects arbitrary functions onto a vector of degree of freedom values for the current system. More...
 
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 system. More...
 
void boundary_project_solution (const std::set< boundary_id_type > &b, const std::vector< unsigned int > &variables, ValueFunctionPointer fptr, GradientFunctionPointer gptr, const Parameters &parameters)
 Projects arbitrary boundary functions onto a vector of degree of freedom values for the current system. More...
 
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 system. More...
 
void boundary_project_vector (const std::set< boundary_id_type > &b, const std::vector< unsigned int > &variables, ValueFunctionPointer fptr, GradientFunctionPointer gptr, const Parameters &parameters, NumericVector< Number > &new_vector, int is_adjoint=-1) const
 Projects arbitrary boundary functions onto a vector of degree of freedom values for the current system. More...
 
unsigned int number () 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. More...
 
void update_global_solution (std::vector< Number > &global_soln, const processor_id_type dest_proc) const
 Fill the input vector global_soln so that it contains the global solution on processor dest_proc. More...
 
const MeshBaseget_mesh () const
 
MeshBaseget_mesh ()
 
const DofMapget_dof_map () const
 
DofMapget_dof_map ()
 
const EquationSystemsget_equation_systems () const
 
EquationSystemsget_equation_systems ()
 
bool active () const
 
void activate ()
 Activates the system. More...
 
void deactivate ()
 Deactivates the system. More...
 
void set_basic_system_only ()
 Sets the system to be "basic only": i.e. More...
 
vectors_iterator vectors_begin ()
 Beginning of vectors container. More...
 
const_vectors_iterator vectors_begin () const
 Beginning of vectors container. More...
 
vectors_iterator vectors_end ()
 End of vectors container. More...
 
const_vectors_iterator vectors_end () const
 End of vectors container. More...
 
matrices_iterator matrices_begin ()
 Beginning of matrices container. More...
 
const_matrices_iterator matrices_begin () const
 Beginning of matrices container. More...
 
matrices_iterator matrices_end ()
 End of matrices container. More...
 
const_matrices_iterator matrices_end () const
 End of matrices container. More...
 
NumericVector< Number > & add_vector (std::string_view vec_name, const bool projections=true, const ParallelType type=PARALLEL)
 Adds the additional vector vec_name to this system. More...
 
void remove_vector (std::string_view vec_name)
 Removes the additional vector vec_name from this system. More...
 
bool & project_solution_on_reinit (void)
 Tells the System whether or not to project the solution vector onto new grids when the system is reinitialized. More...
 
bool have_vector (std::string_view vec_name) const
 
const NumericVector< Number > * request_vector (std::string_view vec_name) const
 
NumericVector< Number > * request_vector (std::string_view vec_name)
 
const NumericVector< Number > * request_vector (const unsigned int vec_num) const
 
NumericVector< Number > * request_vector (const unsigned int vec_num)
 
const NumericVector< Number > & get_vector (std::string_view vec_name) const
 
NumericVector< Number > & get_vector (std::string_view vec_name)
 
const NumericVector< Number > & get_vector (const unsigned int vec_num) const
 
NumericVector< Number > & get_vector (const unsigned int vec_num)
 
const std::string & vector_name (const unsigned int vec_num) const
 
const std::string & vector_name (const NumericVector< Number > &vec_reference) const
 
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 solution from the adjoint (qoi_num >= 0) or primal (qoi_num == -1) space. More...
 
int vector_is_adjoint (std::string_view vec_name) const
 
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 "preserved": projected to new meshes, saved, etc. More...
 
bool vector_preservation (std::string_view vec_name) const
 
NumericVector< Number > & add_adjoint_solution (unsigned int i=0)
 
NumericVector< Number > & get_adjoint_solution (unsigned int i=0)
 
const NumericVector< Number > & get_adjoint_solution (unsigned int i=0) const
 
NumericVector< Number > & add_sensitivity_solution (unsigned int i=0)
 
NumericVector< Number > & get_sensitivity_solution (unsigned int i=0)
 
const NumericVector< Number > & get_sensitivity_solution (unsigned int i=0) const
 
NumericVector< Number > & add_weighted_sensitivity_adjoint_solution (unsigned int i=0)
 
NumericVector< Number > & get_weighted_sensitivity_adjoint_solution (unsigned int i=0)
 
const NumericVector< Number > & get_weighted_sensitivity_adjoint_solution (unsigned int i=0) const
 
NumericVector< Number > & add_weighted_sensitivity_solution ()
 
NumericVector< Number > & get_weighted_sensitivity_solution ()
 
const NumericVector< Number > & get_weighted_sensitivity_solution () const
 
NumericVector< Number > & add_adjoint_rhs (unsigned int i=0)
 
NumericVector< Number > & get_adjoint_rhs (unsigned int i=0)
 
const NumericVector< Number > & get_adjoint_rhs (unsigned int i=0) const
 
NumericVector< Number > & add_sensitivity_rhs (unsigned int i=0)
 
NumericVector< Number > & get_sensitivity_rhs (unsigned int i=0)
 
const NumericVector< Number > & get_sensitivity_rhs (unsigned int i=0) const
 
unsigned int n_vectors () const
 
unsigned int n_matrices () const
 
unsigned int n_vars () const
 
unsigned int n_variable_groups () const
 
unsigned int n_components () const
 
dof_id_type n_dofs () const
 
dof_id_type n_active_dofs () const
 
dof_id_type n_constrained_dofs () const
 
dof_id_type n_local_constrained_dofs () const
 
dof_id_type n_local_dofs () const
 
unsigned int add_variable (std::string_view 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. More...
 
unsigned int add_variable (std::string_view var, const Order order=FIRST, const FEFamily=LAGRANGE, const std::set< subdomain_id_type > *const active_subdomains=nullptr)
 Adds the variable var to the list of variables for this system. More...
 
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 variables vars to the list of variables for this system. More...
 
unsigned int add_variables (const std::vector< std::string > &vars, const Order order=FIRST, const FEFamily=LAGRANGE, const std::set< subdomain_id_type > *const active_subdomains=nullptr)
 Adds the variable var to the list of variables for this system. More...
 
unsigned int add_variable_array (const std::vector< std::string > &vars, const FEType &type, const std::set< subdomain_id_type > *const active_subdomains=nullptr)
 Adds variables vars to the list of variables for this system. More...
 
const Variablevariable (unsigned int var) const
 Return a constant reference to Variable var. More...
 
const VariableGroupvariable_group (unsigned int vg) const
 Return a constant reference to VariableGroup vg. More...
 
bool has_variable (std::string_view var) const
 
const std::string & variable_name (const unsigned int i) const
 
unsigned int variable_number (std::string_view var) const
 
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 this system. More...
 
unsigned int variable_scalar_number (std::string_view var, unsigned int component) const
 
unsigned int variable_scalar_number (unsigned int var_num, unsigned int component) const
 
const FETypevariable_type (const unsigned int i) const
 
const FETypevariable_type (std::string_view var) const
 
bool identify_variable_groups () const
 
void identify_variable_groups (const bool)
 Toggle automatic VariableGroup identification. More...
 
Real calculate_norm (const NumericVector< Number > &v, unsigned int var, FEMNormType norm_type, std::set< unsigned int > *skip_dimensions=nullptr) const
 
Real calculate_norm (const NumericVector< Number > &v, const SystemNorm &norm, std::set< unsigned int > *skip_dimensions=nullptr) const
 
void read_header (Xdr &io, std::string_view 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. More...
 
void read_legacy_data (Xdr &io, const bool read_additional_data=true)
 Reads additional data, namely vectors, for this System. More...
 
template<typename ValType >
void read_serialized_data (Xdr &io, const bool read_additional_data=true)
 Reads additional data, namely vectors, for this System. More...
 
void read_serialized_data (Xdr &io, const bool read_additional_data=true)
 Non-templated version for backward compatibility. More...
 
template<typename InValType >
std::size_t read_serialized_vectors (Xdr &io, const std::vector< NumericVector< Number > *> &vectors) const
 Read a number of identically distributed vectors. More...
 
std::size_t read_serialized_vectors (Xdr &io, const std::vector< NumericVector< Number > *> &vectors) const
 Non-templated version for backward compatibility. More...
 
template<typename InValType >
void read_parallel_data (Xdr &io, const bool read_additional_data)
 Reads additional data, namely vectors, for this System. More...
 
void read_parallel_data (Xdr &io, const bool read_additional_data)
 Non-templated version for backward compatibility. More...
 
void write_header (Xdr &io, std::string_view version, const bool write_additional_data) const
 Writes the basic data header for this System. More...
 
void write_serialized_data (Xdr &io, const bool write_additional_data=true) const
 Writes additional data, namely vectors, for this System. More...
 
std::size_t write_serialized_vectors (Xdr &io, const std::vector< const NumericVector< Number > *> &vectors) const
 Serialize & write a number of identically distributed vectors. More...
 
void write_parallel_data (Xdr &io, const bool write_additional_data) const
 Writes additional data, namely vectors, for this System. More...
 
std::string get_info () const
 
void attach_init_function (void fptr(EquationSystems &es, const std::string &name))
 Register a user function to use in initializing the system. More...
 
void attach_init_object (Initialization &init)
 Register a user class to use to initialize the system. More...
 
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. More...
 
void attach_assemble_object (Assembly &assemble)
 Register a user object to use in assembling the system matrix and RHS. More...
 
void attach_constraint_function (void fptr(EquationSystems &es, const std::string &name))
 Register a user function for imposing constraints. More...
 
void attach_constraint_object (Constraint &constrain)
 Register a user object for imposing constraints. More...
 
bool has_constraint_object () const
 
Constraintget_constraint_object ()
 Return the user object for imposing constraints. More...
 
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 System::qoi. More...
 
void attach_QOI_object (QOI &qoi)
 Register a user object for evaluating the quantities of interest, whose values should be placed in System::qoi. More...
 
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 functions, whose values should be placed in System::rhs. More...
 
void attach_QOI_derivative_object (QOIDerivative &qoi_derivative)
 Register a user object for evaluating derivatives of a quantity of interest with respect to test functions, whose values should be placed in System::rhs. More...
 
virtual void user_initialization ()
 Calls user's attached initialization function, or is overridden by the user in derived classes. More...
 
virtual void user_assembly ()
 Calls user's attached assembly function, or is overridden by the user in derived classes. More...
 
virtual void user_constrain ()
 Calls user's attached constraint function, or is overridden by the user in derived classes. More...
 
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. More...
 
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 derived classes. More...
 
virtual void re_update ()
 Re-update the local values when the mesh has changed. More...
 
virtual void restrict_vectors ()
 Restrict vectors after the mesh has coarsened. More...
 
virtual void prolong_vectors ()
 Prolong vectors after the mesh has refined. More...
 
virtual void disable_cache ()
 Avoids use of any cached data that might affect any solve result. More...
 
Number current_solution (const dof_id_type global_dof_number) const
 
unsigned int n_qois () const
 Number of currently active quantities of interest. More...
 
void init_qois (unsigned int n_qois)
 Accessors for qoi and qoi_error_estimates vectors. More...
 
void set_qoi (unsigned int qoi_index, Number qoi_value)
 
void set_qoi (std::vector< Number > new_qoi)
 
Number get_qoi_value (unsigned int qoi_index) const
 
std::vector< Numberget_qoi_values () const
 Returns a copy of qoi, not a reference. More...
 
void set_qoi_error_estimate (unsigned int qoi_index, Number qoi_error_estimate)
 
Number get_qoi_error_estimate_value (unsigned int qoi_index) const
 
Number point_value (unsigned int var, const Point &p, const bool insist_on_success=true, const NumericVector< Number > *sol=nullptr) const
 
Number point_value (unsigned int var, const Point &p, const Elem &e, const NumericVector< Number > *sol=nullptr) const
 
Number point_value (unsigned int var, const Point &p, const Elem *e) const
 Calls the version of point_value() which takes a reference. More...
 
Number point_value (unsigned int var, const Point &p, const NumericVector< Number > *sol) const
 Calls the parallel version of point_value(). More...
 
Gradient point_gradient (unsigned int var, const Point &p, const bool insist_on_success=true, const NumericVector< Number > *sol=nullptr) const
 
Gradient point_gradient (unsigned int var, const Point &p, const Elem &e, const NumericVector< Number > *sol=nullptr) const
 
Gradient point_gradient (unsigned int var, const Point &p, const Elem *e) const
 Calls the version of point_gradient() which takes a reference. More...
 
Gradient point_gradient (unsigned int var, const Point &p, const NumericVector< Number > *sol) const
 Calls the parallel version of point_gradient(). More...
 
Tensor point_hessian (unsigned int var, const Point &p, const bool insist_on_success=true, const NumericVector< Number > *sol=nullptr) const
 
Tensor point_hessian (unsigned int var, const Point &p, const Elem &e, const NumericVector< Number > *sol=nullptr) const
 
Tensor point_hessian (unsigned int var, const Point &p, const Elem *e) const
 Calls the version of point_hessian() which takes a reference. More...
 
Tensor point_hessian (unsigned int var, const Point &p, const NumericVector< Number > *sol) const
 Calls the parallel version of point_hessian(). More...
 
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 number passed in. More...
 
void zero_variable (NumericVector< Number > &v, unsigned int var_num) const
 Zeroes all dofs in v that correspond to variable number var_num. More...
 
bool get_project_with_constraints ()
 Setter and getter functions for project_with_constraints boolean. More...
 
void set_project_with_constraints (bool _project_with_constraints)
 
bool & hide_output ()
 
void projection_matrix (SparseMatrix< Number > &proj_mat) const
 This method creates a projection matrix which corresponds to the operation of project_vector between old and new solution spaces. More...
 
SparseMatrix< Number > & add_matrix (std::string_view mat_name, ParallelType type=PARALLEL, MatrixBuildType mat_build_type=MatrixBuildType::AUTOMATIC)
 Adds the additional matrix mat_name to this system. More...
 
template<template< typename > class>
SparseMatrix< Number > & add_matrix (std::string_view mat_name, ParallelType=PARALLEL)
 Adds the additional matrix mat_name to this system. More...
 
SparseMatrix< Number > & add_matrix (std::string_view mat_name, std::unique_ptr< SparseMatrix< Number >> matrix, ParallelType type=PARALLEL)
 Adds the additional matrix mat_name to this system. More...
 
void remove_matrix (std::string_view mat_name)
 Removes the additional matrix mat_name from this system. More...
 
bool have_matrix (std::string_view mat_name) const
 
const SparseMatrix< Number > * request_matrix (std::string_view mat_name) const
 
SparseMatrix< Number > * request_matrix (std::string_view mat_name)
 
const SparseMatrix< Number > & get_matrix (std::string_view mat_name) const
 
SparseMatrix< Number > & get_matrix (std::string_view mat_name)
 
void prefer_hash_table_matrix_assembly (bool preference)
 Sets whether to use hash table matrix assembly if the matrix sub-classes support it. More...
 
void prefix_with_name (bool value)
 Instructs this system to prefix solve options with its name for solvers that leverage prefixes. More...
 
bool prefix_with_name () const
 
std::string prefix () const
 
virtual void create_static_condensation ()
 Request that static condensation be performed for this system. More...
 
bool has_static_condensation () const
 
const Parallel::Communicatorcomm () const
 
processor_id_type n_processors () const
 
processor_id_type processor_id () const
 

Static Public Member Functions

static std::string get_info ()
 Gets a string containing the reference information. More...
 
static void print_info (std::ostream &out_stream=libMesh::out)
 Prints the reference information, by default to libMesh::out. More...
 
static unsigned int n_objects ()
 Prints the number of outstanding (created, but not yet destroyed) objects. More...
 
static void enable_print_counter_info ()
 Methods to enable/disable the reference counter output from print_info() More...
 
static void disable_print_counter_info ()
 

Public Attributes

SparseMatrix< Number > * matrix_A
 The system matrix for standard eigenvalue problems. More...
 
SparseMatrix< Number > * matrix_B
 A second system matrix for generalized eigenvalue problems. More...
 
std::unique_ptr< ShellMatrix< Number > > shell_matrix_A
 The system shell matrix for standard eigenvalue problems. More...
 
std::unique_ptr< ShellMatrix< Number > > shell_matrix_B
 A second system shell matrix for generalized eigenvalue problems. More...
 
SparseMatrix< Number > * precond_matrix
 A preconditioning matrix. More...
 
std::unique_ptr< ShellMatrix< Number > > shell_precond_matrix
 A preconditioning shell matrix. More...
 
std::unique_ptr< EigenSolver< Number > > eigen_solver
 The EigenSolver, defining which interface, i.e solver package to use. More...
 
Parameters parameters
 Parameters for the system. If a parameter is not provided, it should be retrieved from the EquationSystems. More...
 
bool assemble_before_solve
 Flag which tells the system to whether or not to call the user assembly function during each call to solve(). More...
 
bool use_fixed_solution
 A boolean to be set to true by systems using elem_fixed_solution, for optional use by e.g. More...
 
int extra_quadrature_order
 A member int that can be employed to indicate increased or reduced quadrature order. More...
 
std::unique_ptr< NumericVector< Number > > solution
 Data structure to hold solution values. More...
 
std::unique_ptr< NumericVector< Number > > current_local_solution
 All the values I need to compute my contribution to the simulation at hand. More...
 
Real time
 For time-dependent problems, this is the time t at the beginning of the current timestep. More...
 

Protected Types

typedef std::map< std::string, std::pair< unsigned int, unsigned int > > Counts
 Data structure to log the information. More...
 

Protected Member Functions

virtual void add_matrices () override
 Adds the necessary matrices and shell matrices. More...
 
virtual void init_matrices () override
 Initializes the matrices associated with the system. More...
 
void set_n_converged (unsigned int nconv)
 Set the _n_converged_eigenpairs member, useful for subclasses of EigenSystem. More...
 
void set_n_iterations (unsigned int its)
 Set the _n_iterations member, useful for subclasses of EigenSystem. More...
 
void solve_helper (SparseMatrix< Number > *const A, SparseMatrix< Number > *const B, SparseMatrix< Number > *const P)
 
void project_vector (NumericVector< Number > &, int is_adjoint=-1) const
 Projects the vector defined on the old mesh onto the new mesh. More...
 
void project_vector (const NumericVector< Number > &, NumericVector< Number > &, int is_adjoint=-1) const
 Projects the vector defined on the old mesh onto the new mesh. More...
 
virtual void init_data ()
 Initializes the data for the system. More...
 
bool can_add_matrices () const
 
void solve_for_unconstrained_dofs (NumericVector< Number > &, int is_adjoint=-1) const
 
virtual bool condense_constrained_dofs () const
 Whether this object should condense out constrained degrees of freedom. More...
 
void increment_constructor_count (const std::string &name) noexcept
 Increments the construction counter. More...
 
void increment_destructor_count (const std::string &name) noexcept
 Increments the destruction counter. More...
 

Protected Attributes

const Parallel::Communicator_communicator
 

Static Protected Attributes

static Counts _counts
 Actually holds the data. More...
 
static Threads::atomic< unsigned int_n_objects
 The number of objects. More...
 
static Threads::spin_mutex _mutex
 Mutual exclusion object to enable thread-safe reference counting. More...
 
static bool _enable_print_counter = true
 Flag to control whether reference count information is printed when print_info is called. More...
 

Private Attributes

unsigned int _n_converged_eigenpairs
 The number of converged eigenpairs. More...
 
unsigned int _n_iterations
 The number of iterations of the eigen solver algorithm. More...
 
EigenProblemType _eigen_problem_type
 The type of the eigenvalue problem. More...
 
bool _use_shell_matrices
 A boolean flag to indicate whether or not to use shell matrices. More...
 
bool _use_shell_precond_matrix
 A boolean flag to indicate whether or not to use a shell preconditioning matrix. More...
 

Detailed Description

Manages consistently variables, degrees of freedom, and coefficient vectors for eigenvalue problems.

Currently, this class is able to handle standard eigenvalue problems A*x=lambda*x and generalized eigenvalue problems A*x=lambda*B*x.

The matrices EigenSystem::matrix_A and EigenSystem::matrix_B should be filled during assembly.

Author
Steffen Peterson
Date
2005 Base class for defining systems of equations for eigenproblems.

Definition at line 55 of file eigen_system.h.

Member Typedef Documentation

◆ const_matrices_iterator

typedef std::map<std::string, std::unique_ptr<SparseMatrix<Number> >, std::less<> >::const_iterator libMesh::System::const_matrices_iterator
inherited

Definition at line 785 of file system.h.

◆ const_vectors_iterator

typedef std::map<std::string, std::unique_ptr<NumericVector<Number> >, std::less<> >::const_iterator libMesh::System::const_vectors_iterator
inherited

Definition at line 759 of file system.h.

◆ Counts

typedef std::map<std::string, std::pair<unsigned int, unsigned int> > libMesh::ReferenceCounter::Counts
protectedinherited

Data structure to log the information.

The log is identified by the class name.

Definition at line 119 of file reference_counter.h.

◆ GradientFunctionPointer

typedef Gradient(* libMesh::System::GradientFunctionPointer) (const Point &p, const Parameters &parameters, const std::string &sys_name, const std::string &unknown_name)
inherited

Definition at line 542 of file system.h.

◆ matrices_iterator

typedef std::map<std::string, std::unique_ptr<SparseMatrix<Number> >, std::less<> >::iterator libMesh::System::matrices_iterator
inherited

Matrix iterator typedefs.

Definition at line 784 of file system.h.

◆ Parent

The type of the parent.

Definition at line 85 of file eigen_system.h.

◆ sys_type

The type of system.

Definition at line 80 of file eigen_system.h.

◆ ValueFunctionPointer

typedef Number(* libMesh::System::ValueFunctionPointer) (const Point &p, const Parameters &Parameters, const std::string &sys_name, const std::string &unknown_name)
inherited

Projects arbitrary functions onto the current solution.

The function value fptr and its gradient gptr are represented by function pointers. A gradient gptr is only required/used for projecting onto finite element spaces with continuous derivatives.

Definition at line 538 of file system.h.

◆ vectors_iterator

typedef std::map<std::string, std::unique_ptr<NumericVector<Number> >, std::less<> >::iterator libMesh::System::vectors_iterator
inherited

Vector iterator typedefs.

Definition at line 758 of file system.h.

Constructor & Destructor Documentation

◆ EigenSystem() [1/3]

libMesh::EigenSystem::EigenSystem ( EquationSystems es,
const std::string &  name_in,
const unsigned int  number_in 
)

Constructor.

Definition at line 39 of file eigen_system.C.

42  :
43  Parent (es, name_in, number_in),
44  matrix_A (nullptr),
45  matrix_B (nullptr),
46  precond_matrix (nullptr),
49  _n_iterations (0),
51  _use_shell_matrices (false),
53 {
54 }
SparseMatrix< Number > * matrix_B
A second system matrix for generalized eigenvalue problems.
Definition: eigen_system.h:321
unsigned int _n_converged_eigenpairs
The number of converged eigenpairs.
Definition: eigen_system.h:399
System Parent
The type of the parent.
Definition: eigen_system.h:85
unsigned int _n_iterations
The number of iterations of the eigen solver algorithm.
Definition: eigen_system.h:404
SparseMatrix< Number > * precond_matrix
A preconditioning matrix.
Definition: eigen_system.h:345
bool _use_shell_precond_matrix
A boolean flag to indicate whether or not to use a shell preconditioning matrix.
Definition: eigen_system.h:419
SparseMatrix< Number > * matrix_A
The system matrix for standard eigenvalue problems.
Definition: eigen_system.h:313
static std::unique_ptr< EigenSolver< T > > build(const Parallel::Communicator &comm_in, const SolverPackage solver_package=SLEPC_SOLVERS)
Builds an EigenSolver using the linear solver package specified by solver_package.
Definition: eigen_solver.C:58
bool _use_shell_matrices
A boolean flag to indicate whether or not to use shell matrices.
Definition: eigen_system.h:414
std::unique_ptr< EigenSolver< Number > > eigen_solver
The EigenSolver, defining which interface, i.e solver package to use.
Definition: eigen_system.h:362
EigenProblemType _eigen_problem_type
The type of the eigenvalue problem.
Definition: eigen_system.h:409

◆ EigenSystem() [2/3]

libMesh::EigenSystem::EigenSystem ( const EigenSystem )
delete

Special functions.

  • This class has the same restrictions/defaults as its base class.
  • Destructor is defaulted out-of-line

◆ EigenSystem() [3/3]

libMesh::EigenSystem::EigenSystem ( EigenSystem &&  )
default

◆ ~EigenSystem()

libMesh::EigenSystem::~EigenSystem ( )
virtualdefault

Member Function Documentation

◆ activate()

void libMesh::System::activate ( )
inlineinherited

Activates the system.

Only active systems are solved.

Definition at line 2399 of file system.h.

References libMesh::System::_active.

2400 {
2401  _active = true;
2402 }
bool _active
Flag stating if the system is active or not.
Definition: system.h:2229

◆ active()

bool libMesh::System::active ( ) const
inlineinherited
Returns
true if the system is active, false otherwise. An active system will be solved.

Definition at line 2391 of file system.h.

References libMesh::System::_active.

2392 {
2393  return _active;
2394 }
bool _active
Flag stating if the system is active or not.
Definition: system.h:2229

◆ add_adjoint_rhs()

NumericVector< Number > & libMesh::System::add_adjoint_rhs ( unsigned int  i = 0)
inherited
Returns
A reference to one of the system's adjoint rhs vectors, by default the one corresponding to the first qoi. Creates the vector if it doesn't already exist.

Definition at line 1282 of file system.C.

References libMesh::System::add_vector().

Referenced by libMesh::ExplicitSystem::assemble_qoi_derivative(), and libMesh::FEMSystem::assemble_qoi_derivative().

1283 {
1284  std::ostringstream adjoint_rhs_name;
1285  adjoint_rhs_name << "adjoint_rhs" << i;
1286 
1287  return this->add_vector(adjoint_rhs_name.str(), false);
1288 }
NumericVector< Number > & add_vector(std::string_view vec_name, const bool projections=true, const ParallelType type=PARALLEL)
Adds the additional vector vec_name to this system.
Definition: system.C:753

◆ add_adjoint_solution()

NumericVector< Number > & libMesh::System::add_adjoint_solution ( unsigned int  i = 0)
inherited
Returns
A reference to one of the system's adjoint solution vectors, by default the one corresponding to the first qoi. Creates the vector if it doesn't already exist.

Definition at line 1218 of file system.C.

References libMesh::System::add_vector(), and libMesh::System::set_vector_as_adjoint().

Referenced by libMesh::ImplicitSystem::adjoint_solve().

1219 {
1220  std::ostringstream adjoint_name;
1221  adjoint_name << "adjoint_solution" << i;
1222 
1223  NumericVector<Number> & returnval = this->add_vector(adjoint_name.str());
1224  this->set_vector_as_adjoint(adjoint_name.str(), i);
1225  return returnval;
1226 }
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...
Definition: system.C:1145
NumericVector< Number > & add_vector(std::string_view vec_name, const bool projections=true, const ParallelType type=PARALLEL)
Adds the additional vector vec_name to this system.
Definition: system.C:753
template class LIBMESH_EXPORT NumericVector< Number >

◆ add_matrices()

void libMesh::EigenSystem::add_matrices ( )
overrideprotectedvirtual

Adds the necessary matrices and shell matrices.

Reimplemented from libMesh::System.

Reimplemented in libMesh::CondensedEigenSystem.

Definition at line 126 of file eigen_system.C.

References _use_shell_matrices, _use_shell_precond_matrix, libMesh::System::add_matrices(), libMesh::System::add_matrix(), libMesh::ShellMatrix< T >::build(), libMesh::ParallelObject::comm(), generalized(), matrix_A, matrix_B, precond_matrix, shell_matrix_A, shell_matrix_B, and shell_precond_matrix.

Referenced by libMesh::CondensedEigenSystem::add_matrices().

127 {
129 
131  {
132  if (!shell_matrix_A)
134 
135  if (generalized() && !shell_matrix_B)
137 
139  {
142  }
143  else if (!precond_matrix)
144  precond_matrix = &(this->add_matrix("Eigen Preconditioner"));
145  }
146  else
147  {
148  if (!matrix_A)
149  matrix_A = &(this->add_matrix("Eigen Matrix A"));
150 
151  if (generalized() && !matrix_B)
152  matrix_B = &(this->add_matrix("Eigen Matrix B"));
153  }
154 }
bool generalized() const
Definition: eigen_system.C:325
SparseMatrix< Number > * matrix_B
A second system matrix for generalized eigenvalue problems.
Definition: eigen_system.h:321
std::unique_ptr< ShellMatrix< Number > > shell_precond_matrix
A preconditioning shell matrix.
Definition: eigen_system.h:353
static std::unique_ptr< ShellMatrix< T > > build(const Parallel::Communicator &comm, const SolverPackage solver_package=libMesh::default_solver_package())
Builds a ShellMatrix<T> using the linear solver package specified by solver_package.
Definition: shell_matrix.C:31
const Parallel::Communicator & comm() const
std::unique_ptr< ShellMatrix< Number > > shell_matrix_A
The system shell matrix for standard eigenvalue problems.
Definition: eigen_system.h:329
SparseMatrix< Number > * precond_matrix
A preconditioning matrix.
Definition: eigen_system.h:345
bool _use_shell_precond_matrix
A boolean flag to indicate whether or not to use a shell preconditioning matrix.
Definition: eigen_system.h:419
virtual void add_matrices()
Insertion point for adding matrices in derived classes before init_matrices() is called.
Definition: system.h:1987
std::unique_ptr< ShellMatrix< Number > > shell_matrix_B
A second system shell matrix for generalized eigenvalue problems.
Definition: eigen_system.h:337
SparseMatrix< Number > * matrix_A
The system matrix for standard eigenvalue problems.
Definition: eigen_system.h:313
bool _use_shell_matrices
A boolean flag to indicate whether or not to use shell matrices.
Definition: eigen_system.h:414
SparseMatrix< Number > & add_matrix(std::string_view mat_name, ParallelType type=PARALLEL, MatrixBuildType mat_build_type=MatrixBuildType::AUTOMATIC)
Adds the additional matrix mat_name to this system.
Definition: system.C:995

◆ add_matrix() [1/3]

SparseMatrix< Number > & libMesh::System::add_matrix ( std::string_view  mat_name,
ParallelType  type = PARALLEL,
MatrixBuildType  mat_build_type = MatrixBuildType::AUTOMATIC 
)
inherited

Adds the additional matrix mat_name to this system.

Only allowed prior to assemble(). All additional matrices have the same sparsity pattern as the matrix used during solution. When not System but the user wants to initialize the main/system matrix, then all the additional matrices, if existent, have to be initialized by the user, too.

This non-template method will add a derived matrix type corresponding to the solver package. If the user wishes to specify the matrix type to add, use the templated add_matrix method instead

Parameters
mat_nameA name for the matrix
typeThe serial/parallel/ghosted type of the matrix
mat_build_typeThe matrix type to build

Definition at line 995 of file system.C.

References libMesh::System::_matrices, libMesh::System::_matrix_types, libMesh::SparseMatrix< T >::build(), libMesh::ParallelObject::comm(), libMesh::default_solver_package(), libMesh::DIAGONAL, libMesh::System::get_dof_map(), libMesh::System::get_mesh(), libMesh::DofMap::get_static_condensation(), libMesh::System::has_static_condensation(), libMesh::if(), libMesh::System::late_matrix_init(), and libMesh::libmesh_assert().

Referenced by libMesh::ImplicitSystem::add_matrices(), add_matrices(), alternative_fe_assembly(), libMesh::ClawSystem::assemble_boundary_condition_matrices(), libMesh::ImplicitSystem::create_static_condensation_system_matrix(), form_matrixA(), libMesh::EigenTimeSolver::init(), main(), and libMesh::NewmarkSystem::NewmarkSystem().

998 {
999  parallel_object_only();
1000 
1001  libmesh_assert(this->comm().verify(std::string(mat_name)));
1002  libmesh_assert(this->comm().verify(int(type)));
1003  libmesh_assert(this->comm().verify(int(mat_build_type)));
1004 
1005  // Return the matrix if it is already there.
1006  if (auto it = this->_matrices.find(mat_name);
1007  it != this->_matrices.end())
1008  return *it->second;
1009 
1010  // Otherwise build the matrix to return.
1011  std::unique_ptr<SparseMatrix<Number>> matrix;
1012  if (this->has_static_condensation())
1013  {
1014  if (mat_build_type == MatrixBuildType::DIAGONAL)
1015  libmesh_error_msg(
1016  "We do not currently support static condensation of the diagonal matrix type");
1017  matrix = std::make_unique<StaticCondensation>(this->get_mesh(),
1018  *this,
1019  this->get_dof_map(),
1021  }
1022  else
1024  auto & mat = *matrix;
1025 
1026  _matrices.emplace(mat_name, std::move(matrix));
1027 
1028  _matrix_types.emplace(mat_name, type);
1029 
1030  // Initialize it first if we've already initialized the others.
1031  this->late_matrix_init(mat, type);
1032 
1033  return mat;
1034 }
const Parallel::Communicator & comm() const
bool has_static_condensation() const
Definition: system.C:2649
const MeshBase & get_mesh() const
Definition: system.h:2359
static std::unique_ptr< SparseMatrix< T > > build(const Parallel::Communicator &comm, const SolverPackage solver_package=libMesh::default_solver_package(), const MatrixBuildType matrix_build_type=MatrixBuildType::AUTOMATIC)
Builds a SparseMatrix<T> using the linear solver package specified by solver_package.
std::map< std::string, std::unique_ptr< SparseMatrix< Number > >, std::less<> > _matrices
Some systems need an arbitrary number of matrices.
Definition: system.h:2254
SolverPackage default_solver_package()
Definition: libmesh.C:1188
StaticCondensationDofMap & get_static_condensation()
Definition: dof_map.h:2855
libmesh_assert(ctx)
std::map< std::string, ParallelType, std::less<> > _matrix_types
Holds the types of the matrices.
Definition: system.h:2259
template class LIBMESH_EXPORT SparseMatrix< Number >
const DofMap & get_dof_map() const
Definition: system.h:2375
void late_matrix_init(SparseMatrix< Number > &mat, ParallelType type)
Helper function to keep DofMap forward declarable in system.h.
Definition: system.C:1061

◆ add_matrix() [2/3]

template<template< typename > class MatrixType>
SparseMatrix< Number > & libMesh::System::add_matrix ( std::string_view  mat_name,
ParallelType  type = PARALLEL 
)
inlineinherited

Adds the additional matrix mat_name to this system.

Only allowed prior to assemble(). All additional matrices have the same sparsity pattern as the matrix used during solution. When not System but the user wants to initialize the main/system matrix, then all the additional matrices, if existent, have to be initialized by the user, too.

This method will create add a derived matrix of type MatrixType<Number>. One can use the non-templated add_matrix method to add a matrix corresponding to the default solver package

Parameters
mat_nameA name for the matrix
typeThe serial/parallel/ghosted type of the matrix

Definition at line 2606 of file system.h.

References libMesh::System::_matrices, libMesh::System::_matrix_types, and libMesh::System::late_matrix_init().

2608 {
2609  // Return the matrix if it is already there.
2610  auto it = this->_matrices.find(mat_name);
2611  if (it != this->_matrices.end())
2612  return *it->second;
2613 
2614  // Otherwise build the matrix to return.
2615  auto pr = _matrices.emplace(mat_name, std::make_unique<MatrixType<Number>>(this->comm()));
2616  _matrix_types.emplace(mat_name, type);
2617 
2618  SparseMatrix<Number> & mat = *(pr.first->second);
2619 
2620  // Initialize it first if we've already initialized the others.
2621  this->late_matrix_init(mat, type);
2622 
2623  return mat;
2624 }
std::map< std::string, std::unique_ptr< SparseMatrix< Number > >, std::less<> > _matrices
Some systems need an arbitrary number of matrices.
Definition: system.h:2254
std::map< std::string, ParallelType, std::less<> > _matrix_types
Holds the types of the matrices.
Definition: system.h:2259
template class LIBMESH_EXPORT SparseMatrix< Number >
void late_matrix_init(SparseMatrix< Number > &mat, ParallelType type)
Helper function to keep DofMap forward declarable in system.h.
Definition: system.C:1061

◆ add_matrix() [3/3]

SparseMatrix< Number > & libMesh::System::add_matrix ( std::string_view  mat_name,
std::unique_ptr< SparseMatrix< Number >>  matrix,
ParallelType  type = PARALLEL 
)
inherited

Adds the additional matrix mat_name to this system.

Only allowed prior to assemble(). All additional matrices have the same sparsity pattern as the matrix used during solution. When not System but the user wants to initialize the main/system matrix, then all the additional matrices, if existent, have to be initialized by the user, too.

Parameters
mat_nameA name for the matrix
matrixThe matrix we are handing over the System for ownership
typeThe serial/parallel/ghosted type of the matrix

Definition at line 1038 of file system.C.

References libMesh::System::_matrices, libMesh::System::_matrix_types, libMesh::ParallelObject::comm(), libMesh::System::late_matrix_init(), and libMesh::libmesh_assert().

1041 {
1042  parallel_object_only();
1043 
1044  libmesh_assert(this->comm().verify(std::string(mat_name)));
1045  libmesh_assert(this->comm().verify(int(type)));
1046 
1047  auto [it, inserted] = _matrices.emplace(mat_name, std::move(matrix));
1048  libmesh_error_msg_if(!inserted,
1049  "Tried to add '" << mat_name << "' but the matrix already exists");
1050 
1051  _matrix_types.emplace(mat_name, type);
1052 
1053  SparseMatrix<Number> & mat = *(it->second);
1054 
1055  // Initialize it first if we've already initialized the others.
1056  this->late_matrix_init(mat, type);
1057 
1058  return mat;
1059 }
const Parallel::Communicator & comm() const
std::map< std::string, std::unique_ptr< SparseMatrix< Number > >, std::less<> > _matrices
Some systems need an arbitrary number of matrices.
Definition: system.h:2254
libmesh_assert(ctx)
std::map< std::string, ParallelType, std::less<> > _matrix_types
Holds the types of the matrices.
Definition: system.h:2259
template class LIBMESH_EXPORT SparseMatrix< Number >
void late_matrix_init(SparseMatrix< Number > &mat, ParallelType type)
Helper function to keep DofMap forward declarable in system.h.
Definition: system.C:1061

◆ add_sensitivity_rhs()

NumericVector< Number > & libMesh::System::add_sensitivity_rhs ( unsigned int  i = 0)
inherited
Returns
A reference to one of the system's sensitivity rhs vectors, by default the one corresponding to the first parameter. Creates the vector if it doesn't already exist.

Definition at line 1312 of file system.C.

References libMesh::System::add_vector().

Referenced by libMesh::ImplicitSystem::assemble_residual_derivatives().

1313 {
1314  std::ostringstream sensitivity_rhs_name;
1315  sensitivity_rhs_name << "sensitivity_rhs" << i;
1316 
1317  return this->add_vector(sensitivity_rhs_name.str(), false);
1318 }
NumericVector< Number > & add_vector(std::string_view vec_name, const bool projections=true, const ParallelType type=PARALLEL)
Adds the additional vector vec_name to this system.
Definition: system.C:753

◆ add_sensitivity_solution()

NumericVector< Number > & libMesh::System::add_sensitivity_solution ( unsigned int  i = 0)
inherited
Returns
A reference to one of the system's solution sensitivity vectors, by default the one corresponding to the first parameter. Creates the vector if it doesn't already exist.

Definition at line 1167 of file system.C.

References libMesh::System::add_vector().

Referenced by libMesh::ImplicitSystem::sensitivity_solve().

1168 {
1169  std::ostringstream sensitivity_name;
1170  sensitivity_name << "sensitivity_solution" << i;
1171 
1172  return this->add_vector(sensitivity_name.str());
1173 }
NumericVector< Number > & add_vector(std::string_view vec_name, const bool projections=true, const ParallelType type=PARALLEL)
Adds the additional vector vec_name to this system.
Definition: system.C:753

◆ add_variable() [1/2]

unsigned int libMesh::System::add_variable ( std::string_view  var,
const FEType type,
const std::set< subdomain_id_type > *const  active_subdomains = nullptr 
)
inherited

Adds the variable var to the list of variables for this system.

If active_subdomains is either nullptr (the default) or points to an empty set, then it will be assumed that var has no subdomain restrictions

Returns
The index number for the new variable.

Definition at line 1342 of file system.C.

References libMesh::DofMap::add_variable(), and libMesh::System::get_dof_map().

Referenced by libMesh::DifferentiableSystem::add_second_order_dot_vars(), libMesh::System::add_variable(), assemble_and_solve(), OverlappingTestBase::init(), SolidSystem::init_data(), CurlCurlSystem::init_data(), SimpleEIMConstruction::init_data(), libMesh::AdvectionSystem::init_data(), HeatSystem::init_data(), SimpleRBConstruction::init_data(), libMesh::VariationalSmootherSystem::init_data(), NonManifoldCouplingTestBase::init_es(), main(), libMesh::ErrorVector::plot_error(), libMesh::System::read_header(), RationalMapTest< elem_type >::setUp(), SlitMeshRefinedSystemTest::setUp(), FETestBase< order, family, elem_type, 1 >::setUp(), WriteVecAndScalar::setupTests(), SystemsTest::simpleSetup(), MultiEvaluablePredTest::test(), ConstraintOperatorTest::test1DCoarseningNewNodes(), ConstraintOperatorTest::test1DCoarseningOperator(), MeshfunctionDFEM::test_mesh_function_dfem(), MeshfunctionDFEM::test_mesh_function_dfem_grad(), MeshFunctionTest::test_p_level(), MeshFunctionTest::test_subdomain_id_sets(), SystemsTest::testAssemblyWithDgFemContext(), DofMapTest::testBadElemFECombo(), EquationSystemsTest::testBadVarNames(), SystemsTest::testBlockRestrictedVarNDofs(), SystemsTest::testBoundaryProjectCube(), DofMapTest::testConstraintLoopDetection(), MeshInputTest::testCopyElementSolutionImpl(), MeshInputTest::testCopyElementVectorImpl(), MeshInputTest::testCopyNodalSolutionImpl(), ConstraintOperatorTest::testCoreform(), DefaultCouplingTest::testCoupling(), PointNeighborCouplingTest::testCoupling(), SystemsTest::testDofCouplingWithVarGroups(), DofMapTest::testDofOwner(), MeshInputTest::testDynaReadPatch(), MeshInputTest::testExodusWriteElementDataFromDiscontinuousNodalData(), MeshAssignTest::testMeshMoveAssign(), PeriodicBCTest::testPeriodicBC(), EquationSystemsTest::testPostInitAddElem(), EquationSystemsTest::testPostInitAddRealSystem(), SystemsTest::testProjectCubeWithMeshFunction(), MeshInputTest::testProjectionRegression(), SystemsTest::testProjectMatrix1D(), SystemsTest::testProjectMatrix2D(), SystemsTest::testProjectMatrix3D(), InfFERadialTest::testRefinement(), EquationSystemsTest::testRefineThenReinitPreserveFlags(), EquationSystemsTest::testReinitWithNodeElem(), EquationSystemsTest::testRepartitionThenReinit(), EquationSystemsTest::testSelectivePRefine(), SystemsTest::testSetSystemParameterOverEquationSystem(), BoundaryInfoTest::testShellFaceConstraints(), MeshInputTest::testSingleElementImpl(), WriteVecAndScalar::testWriteExodus(), and WriteVecAndScalar::testWriteNemesis().

1345 {
1346  return this->get_dof_map().add_variable(*this, var, type, active_subdomains);
1347 }
unsigned int add_variable(System &sys, std::string_view 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.
Definition: dof_map.C:3142
const DofMap & get_dof_map() const
Definition: system.h:2375

◆ add_variable() [2/2]

unsigned int libMesh::System::add_variable ( std::string_view  var,
const Order  order = FIRST,
const FEFamily  family = LAGRANGE,
const std::set< subdomain_id_type > *const  active_subdomains = nullptr 
)
inherited

Adds the variable var to the list of variables for this system.

Same as before, but assumes LAGRANGE as default value for FEType.family. If active_subdomains is either nullptr (the default) or points to an empty set, then it will be assumed that var has no subdomain restrictions

Definition at line 1351 of file system.C.

References libMesh::System::add_variable().

1355 {
1356  return this->add_variable(var,
1357  FEType(order, family),
1358  active_subdomains);
1359 }
unsigned int add_variable(std::string_view 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.
Definition: system.C:1342

◆ add_variable_array()

unsigned int libMesh::System::add_variable_array ( const std::vector< std::string > &  vars,
const FEType type,
const std::set< subdomain_id_type > *const  active_subdomains = nullptr 
)
inherited

Adds variables vars to the list of variables for this system.

If active_subdomains is either nullptr (the default) or points to an empty set, then it will be assumed that the vars have no subdomain restrictions. This API will end up calling this->add_variables(). However, we will additionally store data that can be leveraged by the DofMap to build degrees of freedom containers corresponding to all the variables in this variable array

An 'array variable' is simply a sequence of contiguous variable numbers defined by pair where the first member of the pair is the first number in the variable sequence and the second member of the pair is the number of the last variable in the sequence plus one. Array variables may be used in tandem with variable grouping by downstream code to build optimized physics kernels since each variable in the array will have the same shape functions.

Returns
The index number for the last of the new variables.

Definition at line 1382 of file system.C.

References libMesh::DofMap::add_variable_array(), and libMesh::System::get_dof_map().

Referenced by DofMapTest::testArrayDofIndicesWithType().

1385 {
1386  return this->get_dof_map().add_variable_array(*this, vars, type, active_subdomains);
1387 }
unsigned int add_variable_array(System &sys, const std::vector< std::string > &vars, const FEType &type, const std::set< subdomain_id_type > *const active_subdomains=nullptr)
Adds variables vars to the list of variables for this system.
Definition: dof_map.C:3373
const DofMap & get_dof_map() const
Definition: system.h:2375

◆ add_variables() [1/2]

unsigned int libMesh::System::add_variables ( const std::vector< std::string > &  vars,
const FEType type,
const std::set< subdomain_id_type > *const  active_subdomains = nullptr 
)
inherited

Adds the variables vars to the list of variables for this system.

If active_subdomains is either nullptr (the default) or points to an empty set, then it will be assumed that the vars have no subdomain restrictions

Returns
The index number for the last of the new variables.

Definition at line 1363 of file system.C.

References libMesh::DofMap::add_variables(), and libMesh::System::get_dof_map().

Referenced by libMesh::System::add_variables(), and SystemsTest::test100KVariables().

1366 {
1367  return this->get_dof_map().add_variables(*this, vars, type, active_subdomains);
1368 }
unsigned int add_variables(System &sys, const std::vector< std::string > &vars, const FEType &type, const std::set< subdomain_id_type > *const active_subdomains=nullptr)
Adds the variables vars to the list of variables for this system.
Definition: dof_map.C:3249
const DofMap & get_dof_map() const
Definition: system.h:2375

◆ add_variables() [2/2]

unsigned int libMesh::System::add_variables ( const std::vector< std::string > &  vars,
const Order  order = FIRST,
const FEFamily  family = LAGRANGE,
const std::set< subdomain_id_type > *const  active_subdomains = nullptr 
)
inherited

Adds the variable var to the list of variables for this system.

Same as before, but assumes LAGRANGE as default value for FEType.family. If active_subdomains is either nullptr (the default) or points to an empty set, then it will be assumed that var has no subdomain restrictions

Definition at line 1372 of file system.C.

References libMesh::System::add_variables().

1376 {
1377  return this->add_variables(vars,
1378  FEType(order, family),
1379  active_subdomains);
1380 }
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 variables vars to the list of variables for this system.
Definition: system.C:1363

◆ add_vector()

NumericVector< Number > & libMesh::System::add_vector ( std::string_view  vec_name,
const bool  projections = true,
const ParallelType  type = PARALLEL 
)
inherited

Adds the additional vector vec_name to this system.

All the additional vectors are similarly distributed, like the solution, and initialized to zero.

By default vectors added by add_vector are projected to changed grids by reinit(). To zero them instead (more efficient), pass "false" as the second argument

If the vector already exists, the existing vector is returned. after any upgrade to the projections or type has been made. We only handle upgrades (projections false->true, or type PARALLEL->GHOSTED) in this fashion, not downgrades, on the theory that if two codes have differing needs we want to support the union of those needs, not the intersection. Downgrades can only be accomplished manually, via set_vector_preservation() or by setting a vector type() and re-initializing.

Definition at line 753 of file system.C.

References libMesh::System::_dof_map, libMesh::System::_is_initialized, libMesh::System::_vector_is_adjoint, libMesh::System::_vector_projections, libMesh::System::_vectors, libMesh::NumericVector< T >::build(), libMesh::NumericVector< T >::close(), libMesh::NumericVector< T >::closed(), libMesh::ParallelObject::comm(), libMesh::default_solver_package(), libMesh::GHOSTED, libMesh::NumericVector< T >::initialized(), libMesh::libmesh_assert(), libMesh::System::n_dofs(), libMesh::System::n_local_dofs(), libMesh::ParallelObject::n_processors(), libMesh::PARALLEL, libMesh::SERIAL, libMesh::NumericVector< T >::set_type(), libMesh::NumericVector< T >::swap(), and libMesh::NumericVector< T >::type().

Referenced by libMesh::System::add_adjoint_rhs(), libMesh::System::add_adjoint_solution(), libMesh::System::add_sensitivity_rhs(), libMesh::System::add_sensitivity_solution(), libMesh::ExplicitSystem::add_system_rhs(), libMesh::System::add_weighted_sensitivity_adjoint_solution(), libMesh::System::add_weighted_sensitivity_solution(), alternative_fe_assembly(), libMesh::AdjointRefinementEstimator::estimate_error(), fe_assembly(), form_functionA(), form_functionB(), libMesh::SecondOrderUnsteadySolver::init(), libMesh::UnsteadySolver::init(), libMesh::UnsteadySolver::init_adjoints(), libMesh::TimeSolver::init_adjoints(), libMesh::OptimizationSystem::init_data(), libMesh::ContinuationSystem::init_data(), main(), libMesh::NewmarkSystem::NewmarkSystem(), libMesh::System::read_header(), libMesh::FrequencySystem::set_frequencies(), libMesh::FrequencySystem::set_frequencies_by_range(), libMesh::FrequencySystem::set_frequencies_by_steps(), SystemsTest::testAddVectorProjChange(), SystemsTest::testAddVectorTypeChange(), SystemsTest::testPostInitAddVector(), and SystemsTest::testPostInitAddVectorTypeChange().

756 {
757  parallel_object_only();
758 
759  libmesh_assert(this->comm().verify(std::string(vec_name)));
760  libmesh_assert(this->comm().verify(int(type)));
761  libmesh_assert(this->comm().verify(projections));
762 
763  // Return the vector if it is already there.
764  if (auto it = this->_vectors.find(vec_name);
765  it != this->_vectors.end())
766  {
767  // If the projection setting has *upgraded*, change it.
768  if (projections) // only do expensive lookup if needed
769  libmesh_map_find(_vector_projections, vec_name) = projections;
770 
771  NumericVector<Number> & vec = *it->second;
772 
773  // If we're in serial, our vectors are effectively SERIAL, so
774  // we'll ignore any type setting. If we're in parallel, we
775  // might have a type change to deal with.
776 
777  if (this->n_processors() > 1)
778  {
779  // If the type setting has changed in a way we can't
780  // perceive as an upgrade or a downgrade, scream.
781  libmesh_assert_equal_to(type == SERIAL,
782  vec.type() == SERIAL);
783 
784  // If the type setting has *upgraded*, change it.
785  if (type == GHOSTED && vec.type() == PARALLEL)
786  {
787  // A *really* late upgrade is expensive, but better not
788  // to risk zeroing data.
789  if (vec.initialized())
790  {
791  if (!vec.closed())
792  vec.close();
793 
794  // Ideally we'd move parallel coefficients and then
795  // add ghosted coefficients, but copy and swap is
796  // simpler. If anyone actually ever uses this case
797  // for real we can look into optimizing it.
798  auto new_vec = NumericVector<Number>::build(this->comm());
799 #ifdef LIBMESH_ENABLE_GHOSTED
800  new_vec->init (this->n_dofs(), this->n_local_dofs(),
801  _dof_map->get_send_list(), /*fast=*/false,
802  GHOSTED);
803 #else
804  libmesh_error_msg("Cannot initialize ghosted vectors when they are not enabled.");
805 #endif
806 
807  *new_vec = vec;
808  vec.swap(*new_vec);
809  }
810  else
811  // The PARALLEL vec is not yet initialized, so we can
812  // just "upgrade" it to GHOSTED.
813  vec.set_type(type);
814  }
815  }
816 
817  // Any upgrades are done; we're happy here.
818  return vec;
819  }
820 
821  // Otherwise, build the vector. The following emplace() is
822  // guaranteed to succeed because, if we made it here, we don't
823  // already have a vector named "vec_name". We pass the user's
824  // requested ParallelType directly to NumericVector::build() so
825  // that, even if the vector is not initialized now, it will get the
826  // right type when it is initialized later.
827  auto pr =
828  _vectors.emplace(vec_name,
831  type));
832  auto buf = pr.first->second.get();
833  _vector_projections.emplace(vec_name, projections);
834 
835  // Vectors are primal by default
836  _vector_is_adjoint.emplace(vec_name, -1);
837 
838  // Initialize it if necessary
839  if (_is_initialized)
840  {
841  if (type == GHOSTED)
842  {
843 #ifdef LIBMESH_ENABLE_GHOSTED
844  buf->init (this->n_dofs(), this->n_local_dofs(),
845  _dof_map->get_send_list(), /*fast=*/false,
846  GHOSTED);
847 #else
848  libmesh_error_msg("Cannot initialize ghosted vectors when they are not enabled.");
849 #endif
850  }
851  else
852  buf->init (this->n_dofs(), this->n_local_dofs(), false, type);
853  }
854 
855  return *buf;
856 }
bool _is_initialized
true when additional vectors and variables do not require immediate initialization, false otherwise.
Definition: system.h:2283
std::unique_ptr< DofMap > _dof_map
Data structure describing the relationship between nodes, variables, etc...
Definition: system.h:2202
const Parallel::Communicator & comm() const
std::map< std::string, std::unique_ptr< NumericVector< Number > >, std::less<> > _vectors
Some systems need an arbitrary number of vectors.
Definition: system.h:2237
dof_id_type n_local_dofs() const
Definition: system.C:156
dof_id_type n_dofs() const
Definition: system.C:119
SolverPackage default_solver_package()
Definition: libmesh.C:1188
processor_id_type n_processors() const
std::map< std::string, int, std::less<> > _vector_is_adjoint
Holds non-negative if a vector by that name should be projected using adjoint constraints/BCs, -1 if primal.
Definition: system.h:2249
libmesh_assert(ctx)
static std::unique_ptr< NumericVector< T > > build(const Parallel::Communicator &comm, SolverPackage solver_package=libMesh::default_solver_package(), ParallelType parallel_type=AUTOMATIC)
Builds a NumericVector on the processors in communicator comm using the linear solver package specifi...
template class LIBMESH_EXPORT NumericVector< Number >
std::map< std::string, bool, std::less<> > _vector_projections
Holds true if a vector by that name should be projected onto a changed grid, false if it should be ze...
Definition: system.h:2243

◆ add_weighted_sensitivity_adjoint_solution()

NumericVector< Number > & libMesh::System::add_weighted_sensitivity_adjoint_solution ( unsigned int  i = 0)
inherited
Returns
A reference to one of the system's weighted sensitivity adjoint solution vectors, by default the one corresponding to the first qoi. Creates the vector if it doesn't already exist.

Definition at line 1250 of file system.C.

References libMesh::System::add_vector(), and libMesh::System::set_vector_as_adjoint().

Referenced by libMesh::ImplicitSystem::weighted_sensitivity_adjoint_solve().

1251 {
1252  std::ostringstream adjoint_name;
1253  adjoint_name << "weighted_sensitivity_adjoint_solution" << i;
1254 
1255  NumericVector<Number> & returnval = this->add_vector(adjoint_name.str());
1256  this->set_vector_as_adjoint(adjoint_name.str(), i);
1257  return returnval;
1258 }
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...
Definition: system.C:1145
NumericVector< Number > & add_vector(std::string_view vec_name, const bool projections=true, const ParallelType type=PARALLEL)
Adds the additional vector vec_name to this system.
Definition: system.C:753
template class LIBMESH_EXPORT NumericVector< Number >

◆ add_weighted_sensitivity_solution()

NumericVector< Number > & libMesh::System::add_weighted_sensitivity_solution ( )
inherited
Returns
A reference to the solution of the last weighted sensitivity solve Creates the vector if it doesn't already exist.

Definition at line 1197 of file system.C.

References libMesh::System::add_vector().

Referenced by libMesh::ImplicitSystem::weighted_sensitivity_solve().

1198 {
1199  return this->add_vector("weighted_sensitivity_solution");
1200 }
NumericVector< Number > & add_vector(std::string_view vec_name, const bool projections=true, const ParallelType type=PARALLEL)
Adds the additional vector vec_name to this system.
Definition: system.C:753

◆ adjoint_qoi_parameter_sensitivity()

void libMesh::System::adjoint_qoi_parameter_sensitivity ( const QoISet qoi_indices,
const ParameterVector parameters,
SensitivityData sensitivities 
)
inlinevirtualinherited

Solves for parameter sensitivities using the adjoint method.

This method is only implemented in some derived classes.

Reimplemented in libMesh::ImplicitSystem.

Definition at line 2562 of file system.h.

Referenced by libMesh::System::qoi_parameter_sensitivity().

2565 {
2566  libmesh_not_implemented();
2567 }

◆ adjoint_solve()

std::pair< unsigned int, Real > libMesh::System::adjoint_solve ( const QoISet qoi_indices = QoISet())
inlinevirtualinherited

Solves the adjoint system, for the specified qoi indices, or for every qoi if qoi_indices is nullptr.

Must be overridden in derived systems.

Returns
A pair with the total number of linear iterations performed and the (sum of the) final residual norms

This method is only implemented in some derived classes.

Reimplemented in libMesh::ImplicitSystem, and libMesh::DifferentiableSystem.

Definition at line 2546 of file system.h.

Referenced by libMesh::UniformRefinementEstimator::_estimate_error(), and libMesh::AdjointResidualErrorEstimator::estimate_error().

2547 {
2548  libmesh_not_implemented();
2549 }

◆ assemble()

void libMesh::System::assemble ( )
virtualinherited

Prepares matrix and _dof_map for matrix assembly.

Does not actually assemble anything. For matrix assembly, use the assemble() in derived classes. Should be overridden in derived classes.

Reimplemented in libMesh::LinearImplicitSystem, libMesh::DifferentiableSystem, libMesh::ImplicitSystem, libMesh::FrequencySystem, and libMesh::NewmarkSystem.

Definition at line 551 of file system.C.

References libMesh::System::user_assembly().

Referenced by libMesh::ImplicitSystem::assemble(), solve(), libMesh::CondensedEigenSystem::solve(), and libMesh::ExplicitSystem::solve().

552 {
553  // Log how long the user's assembly code takes
554  LOG_SCOPE("assemble()", "System");
555 
556  // Call the user-specified assembly function
557  this->user_assembly();
558 }
virtual void user_assembly()
Calls user&#39;s attached assembly function, or is overridden by the user in derived classes.
Definition: system.C:2089

◆ assemble_qoi()

void libMesh::System::assemble_qoi ( const QoISet qoi_indices = QoISet())
virtualinherited

Calls user qoi function.

Can be overridden in derived classes.

Reimplemented in libMesh::FEMSystem, and libMesh::ExplicitSystem.

Definition at line 562 of file system.C.

References libMesh::System::user_QOI().

Referenced by libMesh::ExplicitSystem::assemble_qoi().

563 {
564  // Log how long the user's assembly code takes
565  LOG_SCOPE("assemble_qoi()", "System");
566 
567  // Call the user-specified quantity of interest function
568  this->user_QOI(qoi_indices);
569 }
virtual void user_QOI(const QoISet &qoi_indices)
Calls user&#39;s attached quantity of interest function, or is overridden by the user in derived classes...
Definition: system.C:2117

◆ assemble_qoi_derivative()

void libMesh::System::assemble_qoi_derivative ( const QoISet qoi_indices = QoISet(),
bool  include_liftfunc = true,
bool  apply_constraints = true 
)
virtualinherited

Calls user qoi derivative function.

Can be overridden in derived classes.

Reimplemented in libMesh::FEMSystem, and libMesh::ExplicitSystem.

Definition at line 573 of file system.C.

References libMesh::System::user_QOI_derivative().

Referenced by libMesh::ExplicitSystem::assemble_qoi_derivative().

576 {
577  // Log how long the user's assembly code takes
578  LOG_SCOPE("assemble_qoi_derivative()", "System");
579 
580  // Call the user-specified quantity of interest function
581  this->user_QOI_derivative(qoi_indices, include_liftfunc,
582  apply_constraints);
583 }
virtual void user_QOI_derivative(const QoISet &qoi_indices=QoISet(), bool include_liftfunc=true, bool apply_constraints=true)
Calls user&#39;s attached quantity of interest derivative function, or is overridden by the user in deriv...
Definition: system.C:2131

◆ assemble_residual_derivatives()

void libMesh::System::assemble_residual_derivatives ( const ParameterVector parameters)
inlinevirtualinherited

Calls residual parameter derivative function.

Library subclasses use finite differences by default.

This should assemble the sensitivity rhs vectors to hold -(partial R / partial p_i), making them ready to solve the forward sensitivity equation.

This method is only implemented in some derived classes.

Reimplemented in libMesh::ImplicitSystem.

Definition at line 2511 of file system.h.

2512 {
2513  libmesh_not_implemented();
2514 }

◆ attach_assemble_function()

void libMesh::System::attach_assemble_function ( void   fptrEquationSystems &es, const std::string &name)
inherited

Register a user function to use in assembling the system matrix and RHS.

Definition at line 1939 of file system.C.

References libMesh::System::_assemble_system_function, libMesh::System::_assemble_system_object, fptr(), and libMesh::libmesh_assert().

Referenced by assemble_and_solve(), main(), ConstraintOperatorTest::test1DCoarseningNewNodes(), ConstraintOperatorTest::test1DCoarseningOperator(), SystemsTest::testAssemblyWithDgFemContext(), ConstraintOperatorTest::testCoreform(), SystemsTest::testDofCouplingWithVarGroups(), and PeriodicBCTest::testPeriodicBC().

1941 {
1943 
1944  if (_assemble_system_object != nullptr)
1945  {
1946  libmesh_warning("WARNING: Cannot specify both assembly function and object!");
1947 
1948  _assemble_system_object = nullptr;
1949  }
1950 
1952 }
Assembly * _assemble_system_object
Object that assembles the system.
Definition: system.h:2159
Number fptr(const Point &p, const Parameters &, const std::string &libmesh_dbg_var(sys_name), const std::string &unknown_name)
Definition: projection.C:81
libmesh_assert(ctx)
void(* _assemble_system_function)(EquationSystems &es, const std::string &name)
Function that assembles the system.
Definition: system.h:2153

◆ attach_assemble_object()

void libMesh::System::attach_assemble_object ( System::Assembly assemble_in)
inherited

Register a user object to use in assembling the system matrix and RHS.

Definition at line 1956 of file system.C.

References libMesh::System::_assemble_system_function, and libMesh::System::_assemble_system_object.

Referenced by main().

1957 {
1958  if (_assemble_system_function != nullptr)
1959  {
1960  libmesh_warning("WARNING: Cannot specify both assembly object and function!");
1961 
1962  _assemble_system_function = nullptr;
1963  }
1964 
1965  _assemble_system_object = &assemble_in;
1966 }
Assembly * _assemble_system_object
Object that assembles the system.
Definition: system.h:2159
void(* _assemble_system_function)(EquationSystems &es, const std::string &name)
Function that assembles the system.
Definition: system.h:2153

◆ attach_constraint_function()

void libMesh::System::attach_constraint_function ( void   fptrEquationSystems &es, const std::string &name)
inherited

Register a user function for imposing constraints.

Definition at line 1970 of file system.C.

References libMesh::System::_constrain_system_function, libMesh::System::_constrain_system_object, fptr(), and libMesh::libmesh_assert().

1972 {
1974 
1975  if (_constrain_system_object != nullptr)
1976  {
1977  libmesh_warning("WARNING: Cannot specify both constraint function and object!");
1978 
1979  _constrain_system_object = nullptr;
1980  }
1981 
1983 }
void(* _constrain_system_function)(EquationSystems &es, const std::string &name)
Function to impose constraints.
Definition: system.h:2164
Constraint * _constrain_system_object
Object that constrains the system.
Definition: system.h:2170
Number fptr(const Point &p, const Parameters &, const std::string &libmesh_dbg_var(sys_name), const std::string &unknown_name)
Definition: projection.C:81
libmesh_assert(ctx)

◆ attach_constraint_object()

void libMesh::System::attach_constraint_object ( System::Constraint constrain)
inherited

Register a user object for imposing constraints.

Definition at line 1987 of file system.C.

References libMesh::System::_constrain_system_function, and libMesh::System::_constrain_system_object.

Referenced by libMesh::VariationalMeshSmoother::setup(), and DofMapTest::testConstraintLoopDetection().

1988 {
1989  if (_constrain_system_function != nullptr)
1990  {
1991  libmesh_warning("WARNING: Cannot specify both constraint object and function!");
1992 
1993  _constrain_system_function = nullptr;
1994  }
1995 
1996  _constrain_system_object = &constrain;
1997 }
void(* _constrain_system_function)(EquationSystems &es, const std::string &name)
Function to impose constraints.
Definition: system.h:2164
Constraint * _constrain_system_object
Object that constrains the system.
Definition: system.h:2170

◆ attach_init_function()

void libMesh::System::attach_init_function ( void   fptrEquationSystems &es, const std::string &name)
inherited

Register a user function to use in initializing the system.

Definition at line 1908 of file system.C.

References libMesh::System::_init_system_function, libMesh::System::_init_system_object, fptr(), and libMesh::libmesh_assert().

Referenced by main().

1910 {
1912 
1913  if (_init_system_object != nullptr)
1914  {
1915  libmesh_warning("WARNING: Cannot specify both initialization function and object!");
1916 
1917  _init_system_object = nullptr;
1918  }
1919 
1921 }
Number fptr(const Point &p, const Parameters &, const std::string &libmesh_dbg_var(sys_name), const std::string &unknown_name)
Definition: projection.C:81
libmesh_assert(ctx)
Initialization * _init_system_object
Object that initializes the system.
Definition: system.h:2148
void(* _init_system_function)(EquationSystems &es, const std::string &name)
Function that initializes the system.
Definition: system.h:2142

◆ attach_init_object()

void libMesh::System::attach_init_object ( System::Initialization init_in)
inherited

Register a user class to use to initialize the system.

Note
This is exclusive with the attach_init_function.

Definition at line 1925 of file system.C.

References libMesh::System::_init_system_function, and libMesh::System::_init_system_object.

1926 {
1927  if (_init_system_function != nullptr)
1928  {
1929  libmesh_warning("WARNING: Cannot specify both initialization object and function!");
1930 
1931  _init_system_function = nullptr;
1932  }
1933 
1934  _init_system_object = &init_in;
1935 }
Initialization * _init_system_object
Object that initializes the system.
Definition: system.h:2148
void(* _init_system_function)(EquationSystems &es, const std::string &name)
Function that initializes the system.
Definition: system.h:2142

◆ attach_QOI_derivative()

void libMesh::System::attach_QOI_derivative ( void   fptrEquationSystems &es, const std::string &name, const QoISet &qoi_indices, bool include_liftfunc, bool apply_constraints)
inherited

Register a user function for evaluating derivatives of a quantity of interest with respect to test functions, whose values should be placed in System::rhs.

Definition at line 2044 of file system.C.

References libMesh::System::_qoi_evaluate_derivative_function, libMesh::System::_qoi_evaluate_derivative_object, fptr(), and libMesh::libmesh_assert().

2046 {
2048 
2049  if (_qoi_evaluate_derivative_object != nullptr)
2050  {
2051  libmesh_warning("WARNING: Cannot specify both QOI derivative function and object!");
2052 
2054  }
2055 
2057 }
Number fptr(const Point &p, const Parameters &, const std::string &libmesh_dbg_var(sys_name), const std::string &unknown_name)
Definition: projection.C:81
QOIDerivative * _qoi_evaluate_derivative_object
Object to compute derivatives of quantities of interest.
Definition: system.h:2196
libmesh_assert(ctx)
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.
Definition: system.h:2187

◆ attach_QOI_derivative_object()

void libMesh::System::attach_QOI_derivative_object ( QOIDerivative qoi_derivative)
inherited

Register a user object for evaluating derivatives of a quantity of interest with respect to test functions, whose values should be placed in System::rhs.

Definition at line 2061 of file system.C.

References libMesh::System::_qoi_evaluate_derivative_function, and libMesh::System::_qoi_evaluate_derivative_object.

2062 {
2063  if (_qoi_evaluate_derivative_function != nullptr)
2064  {
2065  libmesh_warning("WARNING: Cannot specify both QOI derivative object and function!");
2066 
2068  }
2069 
2070  _qoi_evaluate_derivative_object = &qoi_derivative;
2071 }
QOIDerivative * _qoi_evaluate_derivative_object
Object to compute derivatives of quantities of interest.
Definition: system.h:2196
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.
Definition: system.h:2187

◆ attach_QOI_function()

void libMesh::System::attach_QOI_function ( void   fptrEquationSystems &es, const std::string &name, const QoISet &qoi_indices)
inherited

Register a user function for evaluating the quantities of interest, whose values should be placed in System::qoi.

Definition at line 2012 of file system.C.

References libMesh::System::_qoi_evaluate_function, libMesh::System::_qoi_evaluate_object, fptr(), and libMesh::libmesh_assert().

2015 {
2017 
2018  if (_qoi_evaluate_object != nullptr)
2019  {
2020  libmesh_warning("WARNING: Cannot specify both QOI function and object!");
2021 
2022  _qoi_evaluate_object = nullptr;
2023  }
2024 
2026 }
void(* _qoi_evaluate_function)(EquationSystems &es, const std::string &name, const QoISet &qoi_indices)
Function to evaluate quantity of interest.
Definition: system.h:2175
Number fptr(const Point &p, const Parameters &, const std::string &libmesh_dbg_var(sys_name), const std::string &unknown_name)
Definition: projection.C:81
libmesh_assert(ctx)
QOI * _qoi_evaluate_object
Object to compute quantities of interest.
Definition: system.h:2182

◆ attach_QOI_object()

void libMesh::System::attach_QOI_object ( QOI qoi)
inherited

Register a user object for evaluating the quantities of interest, whose values should be placed in System::qoi.

Definition at line 2030 of file system.C.

References libMesh::System::_qoi_evaluate_function, and libMesh::System::_qoi_evaluate_object.

2031 {
2032  if (_qoi_evaluate_function != nullptr)
2033  {
2034  libmesh_warning("WARNING: Cannot specify both QOI object and function!");
2035 
2036  _qoi_evaluate_function = nullptr;
2037  }
2038 
2039  _qoi_evaluate_object = &qoi_in;
2040 }
void(* _qoi_evaluate_function)(EquationSystems &es, const std::string &name, const QoISet &qoi_indices)
Function to evaluate quantity of interest.
Definition: system.h:2175
QOI * _qoi_evaluate_object
Object to compute quantities of interest.
Definition: system.h:2182

◆ boundary_project_solution() [1/2]

void libMesh::System::boundary_project_solution ( const std::set< boundary_id_type > &  b,
const std::vector< unsigned int > &  variables,
FunctionBase< Number > *  f,
FunctionBase< Gradient > *  g = nullptr 
)
inherited

Projects arbitrary boundary functions onto a vector of degree of freedom values for the current system.

This method projects an arbitrary boundary function onto the solution via L2 projections and nodal interpolations on each element.

Only degrees of freedom which affect the function's trace on a boundary in the set b are affected. Only degrees of freedom associated with the variables listed in the vector variables are projected. The function value f and its gradient g are user-provided cloneable functors. A gradient g is only required/used for projecting onto finite element spaces with continuous derivatives.

Definition at line 1253 of file system_projection.C.

Referenced by SystemsTest::testBoundaryProjectCube().

1257 {
1258  this->boundary_project_vector(b, variables, *solution, f, g);
1259 
1260  solution->localize(*current_local_solution);
1261 }
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...
std::unique_ptr< NumericVector< Number > > solution
Data structure to hold solution values.
Definition: system.h:1616
std::unique_ptr< NumericVector< Number > > current_local_solution
All the values I need to compute my contribution to the simulation at hand.
Definition: system.h:1628

◆ boundary_project_solution() [2/2]

void libMesh::System::boundary_project_solution ( const std::set< boundary_id_type > &  b,
const std::vector< unsigned int > &  variables,
ValueFunctionPointer  fptr,
GradientFunctionPointer  gptr,
const Parameters parameters 
)
inherited

Projects arbitrary boundary functions onto a vector of degree of freedom values for the current system.

This method projects components of an arbitrary boundary function onto the solution via L2 projections and nodal interpolations on each element.

Only degrees of freedom which affect the function's trace on a boundary in the set b are affected. Only degrees of freedom associated with the variables listed in the vector variables are projected. The function value fptr and its gradient gptr are represented by function pointers. A gradient gptr is only required/used for projecting onto finite element spaces with continuous derivatives.

Definition at line 1236 of file system_projection.C.

References fptr(), and gptr().

1241 {
1242  WrappedFunction<Number> f(*this, fptr, &function_parameters);
1243  WrappedFunction<Gradient> g(*this, gptr, &function_parameters);
1244  this->boundary_project_solution(b, variables, &f, &g);
1245 }
Number fptr(const Point &p, const Parameters &, const std::string &libmesh_dbg_var(sys_name), const std::string &unknown_name)
Definition: projection.C:81
Gradient gptr(const Point &p, const Parameters &, const std::string &libmesh_dbg_var(sys_name), const std::string &unknown_name)
Definition: projection.C:96
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...

◆ boundary_project_vector() [1/2]

void libMesh::System::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
inherited

Projects arbitrary boundary functions onto a vector of degree of freedom values for the current system.

This method projects an arbitrary function via L2 projections and nodal interpolations on each element.

Only degrees of freedom which affect the function's trace on a boundary in the set b are affected. Only degrees of freedom associated with the variables listed in the vector variables are projected. The function value f and its gradient g are user-provided cloneable functors. A gradient g is only required/used for projecting onto finite element spaces with continuous derivatives.

Constrain the new vector using the requested adjoint rather than primal constraints if is_adjoint is non-negative.

Definition at line 1289 of file system_projection.C.

References libMesh::NumericVector< T >::close(), libMesh::libmesh_ignore(), and libMesh::Threads::parallel_for().

1295 {
1296  LOG_SCOPE ("boundary_project_vector()", "System");
1297 
1299  (ConstElemRange (this->get_mesh().active_local_elements_begin(),
1300  this->get_mesh().active_local_elements_end() ),
1301  BoundaryProjectSolution(b, variables, *this, f, g,
1303  new_vector)
1304  );
1305 
1306  // We don't do SCALAR dofs when just projecting the boundary, so
1307  // we're done here.
1308 
1309  new_vector.close();
1310 
1311 #ifdef LIBMESH_ENABLE_CONSTRAINTS
1312  if (is_adjoint == -1)
1313  this->get_dof_map().enforce_constraints_exactly(*this, &new_vector);
1314  else if (is_adjoint >= 0)
1316  is_adjoint);
1317 #else
1318  libmesh_ignore(is_adjoint);
1319 #endif
1320 }
void parallel_for(const Range &range, const Body &body)
Execute the provided function object in parallel on the specified range.
Definition: threads_none.h:73
const EquationSystems & get_equation_systems() const
Definition: system.h:722
Parameters parameters
Parameters for the system. If a parameter is not provided, it should be retrieved from the EquationSy...
Definition: system.h:1549
const MeshBase & get_mesh() const
Definition: system.h:2359
StoredRange< MeshBase::const_element_iterator, const Elem * > ConstElemRange
Definition: elem_range.h:34
void enforce_adjoint_constraints_exactly(NumericVector< Number > &v, unsigned int q) const
Heterogeneously constrains the numeric vector v, which represents an adjoint solution defined on the ...
Definition: dof_map.h:2520
void libmesh_ignore(const Args &...)
virtual void close()=0
Calls the NumericVector&#39;s internal assembly routines, ensuring that the values are consistent across ...
const DofMap & get_dof_map() const
Definition: system.h:2375
void enforce_constraints_exactly(const System &system, NumericVector< Number > *v=nullptr, bool homogeneous=false) const
Constrains the numeric vector v, which represents a solution defined on the mesh. ...
Definition: dof_map.h:2516

◆ boundary_project_vector() [2/2]

void libMesh::System::boundary_project_vector ( const std::set< boundary_id_type > &  b,
const std::vector< unsigned int > &  variables,
ValueFunctionPointer  fptr,
GradientFunctionPointer  gptr,
const Parameters parameters,
NumericVector< Number > &  new_vector,
int  is_adjoint = -1 
) const
inherited

Projects arbitrary boundary functions onto a vector of degree of freedom values for the current system.

This method projects an arbitrary boundary function via L2 projections and nodal interpolations on each element.

Only degrees of freedom which affect the function's trace on a boundary in the set b are affected. Only degrees of freedom associated with the variables listed in the vector variables are projected. The function value fptr and its gradient gptr are represented by function pointers. A gradient gptr is only required/used for projecting onto finite element spaces with continuous derivatives.

Constrain the new vector using the requested adjoint rather than primal constraints if is_adjoint is non-negative.

Definition at line 1271 of file system_projection.C.

References fptr(), and gptr().

1278 {
1279  WrappedFunction<Number> f(*this, fptr, &function_parameters);
1280  WrappedFunction<Gradient> g(*this, gptr, &function_parameters);
1281  this->boundary_project_vector(b, variables, new_vector, &f, &g,
1282  is_adjoint);
1283 }
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...
Number fptr(const Point &p, const Parameters &, const std::string &libmesh_dbg_var(sys_name), const std::string &unknown_name)
Definition: projection.C:81
Gradient gptr(const Point &p, const Parameters &, const std::string &libmesh_dbg_var(sys_name), const std::string &unknown_name)
Definition: projection.C:96

◆ calculate_norm() [1/2]

Real libMesh::System::calculate_norm ( const NumericVector< Number > &  v,
unsigned int  var,
FEMNormType  norm_type,
std::set< unsigned int > *  skip_dimensions = nullptr 
) const
inherited
Returns
A norm of variable var in the vector v, in the specified norm (e.g. L2, L_INF, H1)

Definition at line 1502 of file system.C.

References libMesh::DISCRETE_L1, libMesh::DISCRETE_L2, libMesh::DISCRETE_L_INF, libMesh::System::discrete_var_norm(), libMesh::L2, libMesh::System::n_vars(), and libMesh::Real.

Referenced by libMesh::TwostepTimeSolver::adjoint_solve(), libMesh::AdaptiveTimeSolver::calculate_norm(), libMesh::UnsteadySolver::du(), main(), output_norms(), ConstraintOperatorTest::testCoreform(), and MeshInputTest::testProjectionRegression().

1506 {
1507  //short circuit to save time
1508  if (norm_type == DISCRETE_L1 ||
1509  norm_type == DISCRETE_L2 ||
1510  norm_type == DISCRETE_L_INF)
1511  return discrete_var_norm(v,var,norm_type);
1512 
1513  // Not a discrete norm
1514  std::vector<FEMNormType> norms(this->n_vars(), L2);
1515  std::vector<Real> weights(this->n_vars(), 0.0);
1516  norms[var] = norm_type;
1517  weights[var] = 1.0;
1518  Real val = this->calculate_norm(v, SystemNorm(norms, weights), skip_dimensions);
1519  return val;
1520 }
Real calculate_norm(const NumericVector< Number > &v, unsigned int var, FEMNormType norm_type, std::set< unsigned int > *skip_dimensions=nullptr) const
Definition: system.C:1502
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
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...
Definition: system.C:1483
unsigned int n_vars() const
Definition: system.C:2654

◆ calculate_norm() [2/2]

Real libMesh::System::calculate_norm ( const NumericVector< Number > &  v,
const SystemNorm norm,
std::set< unsigned int > *  skip_dimensions = nullptr 
) const
inherited
Returns
A norm of the vector v, using component_norm and component_scale to choose and weight the norms of each variable.

Definition at line 1524 of file system.C.

References libMesh::System::_dof_map, libMesh::System::_mesh, libMesh::FEGenericBase< OutputType >::build(), libMesh::NumericVector< T >::build(), libMesh::ParallelObject::comm(), libMesh::FEType::default_quadrature_rule(), dim, libMesh::DISCRETE_L1, libMesh::DISCRETE_L2, libMesh::DISCRETE_L_INF, libMesh::System::discrete_var_norm(), libMesh::DofMap::dof_indices(), libMesh::MeshBase::elem_dimensions(), libMesh::Utility::enum_to_string(), libMesh::FEInterface::field_type(), libMesh::System::get_dof_map(), libMesh::System::get_mesh(), libMesh::GHOSTED, libMesh::H1, libMesh::H1_SEMINORM, libMesh::H2, libMesh::H2_SEMINORM, libMesh::L1, libMesh::NumericVector< T >::l1_norm(), libMesh::L2, libMesh::NumericVector< T >::l2_norm(), libMesh::L_INF, libMesh::libmesh_assert(), libMesh::NumericVector< T >::linfty_norm(), libMesh::NumericVector< T >::local_size(), libMesh::NumericVector< T >::localize(), libMesh::make_range(), TIMPI::Communicator::max(), libMesh::System::n_vars(), libMesh::TensorTools::norm(), libMesh::TensorTools::norm_sq(), libMesh::Real, libMesh::NumericVector< T >::size(), TIMPI::Communicator::sum(), libMesh::TYPE_SCALAR, libMesh::TYPE_VECTOR, libMesh::DofMap::variable_type(), libMesh::W1_INF_SEMINORM, libMesh::W2_INF_SEMINORM, and libMesh::SystemNorm::weight().

1527 {
1528  // This function must be run on all processors at once
1529  parallel_object_only();
1530 
1531  LOG_SCOPE ("calculate_norm()", "System");
1532 
1533  // Zero the norm before summation
1534  Real v_norm = 0.;
1535 
1536  if (norm.is_discrete())
1537  {
1538  //Check to see if all weights are 1.0 and all types are equal
1539  FEMNormType norm_type0 = norm.type(0);
1540  unsigned int check_var = 0, check_end = this->n_vars();
1541  for (; check_var != check_end; ++check_var)
1542  if ((norm.weight(check_var) != 1.0) || (norm.type(check_var) != norm_type0))
1543  break;
1544 
1545  //All weights were 1.0 so just do the full vector discrete norm
1546  if (check_var == this->n_vars())
1547  {
1548  if (norm_type0 == DISCRETE_L1)
1549  return v.l1_norm();
1550  if (norm_type0 == DISCRETE_L2)
1551  return v.l2_norm();
1552  if (norm_type0 == DISCRETE_L_INF)
1553  return v.linfty_norm();
1554  else
1555  libmesh_error_msg("Invalid norm_type0 = " << Utility::enum_to_string(norm_type0));
1556  }
1557 
1558  for (auto var : make_range(this->n_vars()))
1559  {
1560  // Skip any variables we don't need to integrate
1561  if (norm.weight(var) == 0.0)
1562  continue;
1563 
1564  v_norm += norm.weight(var) * discrete_var_norm(v, var, norm.type(var));
1565  }
1566 
1567  return v_norm;
1568  }
1569 
1570  // Localize the potentially parallel vector
1571  std::unique_ptr<NumericVector<Number>> local_v = NumericVector<Number>::build(this->comm());
1572  local_v->init(v.size(), v.local_size(), _dof_map->get_send_list(),
1573  true, GHOSTED);
1574  v.localize (*local_v, _dof_map->get_send_list());
1575 
1576  // I'm not sure how best to mix Hilbert norms on some variables (for
1577  // which we'll want to square then sum then square root) with norms
1578  // like L_inf (for which we'll just want to take an absolute value
1579  // and then sum).
1580  bool using_hilbert_norm = true,
1581  using_nonhilbert_norm = true;
1582 
1583  // Loop over all variables
1584  for (auto var : make_range(this->n_vars()))
1585  {
1586  // Skip any variables we don't need to integrate
1587  Real norm_weight_sq = norm.weight_sq(var);
1588  if (norm_weight_sq == 0.0)
1589  continue;
1590  Real norm_weight = norm.weight(var);
1591 
1592  // Check for unimplemented norms (rather than just returning 0).
1593  FEMNormType norm_type = norm.type(var);
1594  if ((norm_type==H1) ||
1595  (norm_type==H2) ||
1596  (norm_type==L2) ||
1597  (norm_type==H1_SEMINORM) ||
1598  (norm_type==H2_SEMINORM))
1599  {
1600  if (!using_hilbert_norm)
1601  libmesh_not_implemented();
1602  using_nonhilbert_norm = false;
1603  }
1604  else if ((norm_type==L1) ||
1605  (norm_type==L_INF) ||
1606  (norm_type==W1_INF_SEMINORM) ||
1607  (norm_type==W2_INF_SEMINORM))
1608  {
1609  if (!using_nonhilbert_norm)
1610  libmesh_not_implemented();
1611  using_hilbert_norm = false;
1612  }
1613  else
1614  libmesh_not_implemented();
1615 
1616  const FEType & fe_type = this->get_dof_map().variable_type(var);
1617 
1618  // Allow space for dims 0-3, and for both scalar and vector
1619  // elements, even if we don't use them all
1620  std::vector<std::unique_ptr<FEBase>> fe_ptrs(4);
1621  std::vector<std::unique_ptr<FEVectorBase>> vec_fe_ptrs(4);
1622  std::vector<std::unique_ptr<QBase>> q_rules(4);
1623 
1624  const std::set<unsigned char> & elem_dims = _mesh.elem_dimensions();
1625 
1626  // Prepare finite elements for each dimension present in the mesh
1627  for (const auto & dim : elem_dims)
1628  {
1629  if (skip_dimensions && skip_dimensions->find(dim) != skip_dimensions->end())
1630  continue;
1631 
1632  // Construct quadrature and finite element objects
1633  q_rules[dim] = fe_type.default_quadrature_rule (dim);
1634 
1635  const FEFieldType field_type = FEInterface::field_type(fe_type);
1636  if (field_type == TYPE_SCALAR)
1637  {
1638  fe_ptrs[dim] = FEBase::build(dim, fe_type);
1639  fe_ptrs[dim]->attach_quadrature_rule (q_rules[dim].get());
1640  }
1641  else
1642  {
1643  vec_fe_ptrs[dim] = FEVectorBase::build(dim, fe_type);
1644  vec_fe_ptrs[dim]->attach_quadrature_rule (q_rules[dim].get());
1645  libmesh_assert_equal_to(field_type, TYPE_VECTOR);
1646  }
1647 
1648  }
1649 
1650  std::vector<dof_id_type> dof_indices;
1651 
1652  // Begin the loop over the elements
1653  for (const auto & elem : this->get_mesh().active_local_element_ptr_range())
1654  {
1655  const unsigned int dim = elem->dim();
1656 
1657  // One way for implementing this would be to exchange the fe with the FEInterface- class.
1658  // However, it needs to be discussed whether integral-norms make sense for infinite elements.
1659  // or in which sense they could make sense.
1660  if (elem->infinite() )
1661  libmesh_not_implemented();
1662 
1663  if (skip_dimensions && skip_dimensions->find(dim) != skip_dimensions->end())
1664  continue;
1665 
1666  QBase * qrule = q_rules[dim].get();
1667  libmesh_assert(qrule);
1668 
1669  this->get_dof_map().dof_indices (elem, dof_indices, var);
1670 
1671  auto element_calculation = [&dof_indices, &elem,
1672  norm_type, norm_weight, norm_weight_sq, &qrule,
1673  &local_v, &v_norm](auto & fe) {
1674  typedef typename std::remove_reference<decltype(fe)>::type::OutputShape OutputShape;
1675  typedef typename TensorTools::MakeNumber<OutputShape>::type OutputNumberShape;
1676  typedef typename std::remove_reference<decltype(fe)>::type::OutputGradient OutputGradient;
1677  typedef typename TensorTools::MakeNumber<OutputGradient>::type OutputNumberGradient;
1678 
1679  const std::vector<Real> & JxW = fe.get_JxW();
1680  const std::vector<std::vector<OutputShape>> * phi = nullptr;
1681  if (norm_type == H1 ||
1682  norm_type == H2 ||
1683  norm_type == L2 ||
1684  norm_type == L1 ||
1685  norm_type == L_INF)
1686  phi = &(fe.get_phi());
1687 
1688  const std::vector<std::vector<OutputGradient>> * dphi = nullptr;
1689  if (norm_type == H1 ||
1690  norm_type == H2 ||
1691  norm_type == H1_SEMINORM ||
1692  norm_type == W1_INF_SEMINORM)
1693  dphi = &(fe.get_dphi());
1694 
1695 #ifdef LIBMESH_ENABLE_SECOND_DERIVATIVES
1696  typedef typename std::remove_reference<decltype(fe)>::type::OutputTensor OutputTensor;
1697 
1698  const std::vector<std::vector<OutputTensor>> * d2phi = nullptr;
1699  if (norm_type == H2 ||
1700  norm_type == H2_SEMINORM ||
1701  norm_type == W2_INF_SEMINORM)
1702  d2phi = &(fe.get_d2phi());
1703 #endif
1704 
1705  fe.reinit (elem);
1706 
1707  const unsigned int n_qp = qrule->n_points();
1708 
1709  const unsigned int n_sf = cast_int<unsigned int>
1710  (dof_indices.size());
1711 
1712  // Begin the loop over the Quadrature points.
1713  for (unsigned int qp=0; qp<n_qp; qp++)
1714  {
1715  if (norm_type == L1)
1716  {
1717  OutputNumberShape u_h = 0.;
1718  for (unsigned int i=0; i != n_sf; ++i)
1719  u_h += (*phi)[i][qp] * (*local_v)(dof_indices[i]);
1720  v_norm += norm_weight *
1721  JxW[qp] * TensorTools::norm(u_h);
1722  }
1723 
1724  if (norm_type == L_INF)
1725  {
1726  OutputNumberShape u_h = 0.;
1727  for (unsigned int i=0; i != n_sf; ++i)
1728  u_h += (*phi)[i][qp] * (*local_v)(dof_indices[i]);
1729  v_norm = std::max(v_norm, norm_weight * TensorTools::norm(u_h));
1730  }
1731 
1732  if (norm_type == H1 ||
1733  norm_type == H2 ||
1734  norm_type == L2)
1735  {
1736  OutputNumberShape u_h = 0.;
1737  for (unsigned int i=0; i != n_sf; ++i)
1738  u_h += (*phi)[i][qp] * (*local_v)(dof_indices[i]);
1739  v_norm += norm_weight_sq *
1740  JxW[qp] * TensorTools::norm_sq(u_h);
1741  }
1742 
1743  if (norm_type == H1 ||
1744  norm_type == H2 ||
1745  norm_type == H1_SEMINORM)
1746  {
1747  OutputNumberGradient grad_u_h;
1748  for (unsigned int i=0; i != n_sf; ++i)
1749  grad_u_h.add_scaled((*dphi)[i][qp], (*local_v)(dof_indices[i]));
1750  v_norm += norm_weight_sq *
1751  JxW[qp] * grad_u_h.norm_sq();
1752  }
1753 
1754  if (norm_type == W1_INF_SEMINORM)
1755  {
1756  OutputNumberGradient grad_u_h;
1757  for (unsigned int i=0; i != n_sf; ++i)
1758  grad_u_h.add_scaled((*dphi)[i][qp], (*local_v)(dof_indices[i]));
1759  v_norm = std::max(v_norm, norm_weight * grad_u_h.norm());
1760  }
1761 
1762 #ifdef LIBMESH_ENABLE_SECOND_DERIVATIVES
1763  typedef typename TensorTools::MakeNumber<OutputTensor>::type OutputNumberTensor;
1764 
1765  if (norm_type == H2 ||
1766  norm_type == H2_SEMINORM)
1767  {
1768  OutputNumberTensor hess_u_h;
1769  for (unsigned int i=0; i != n_sf; ++i)
1770  hess_u_h.add_scaled((*d2phi)[i][qp], (*local_v)(dof_indices[i]));
1771  v_norm += norm_weight_sq *
1772  JxW[qp] * hess_u_h.norm_sq();
1773  }
1774 
1775  if (norm_type == W2_INF_SEMINORM)
1776  {
1777  OutputNumberTensor hess_u_h;
1778  for (unsigned int i=0; i != n_sf; ++i)
1779  hess_u_h.add_scaled((*d2phi)[i][qp], (*local_v)(dof_indices[i]));
1780  v_norm = std::max(v_norm, norm_weight * hess_u_h.norm());
1781  }
1782 #endif
1783  }
1784  };
1785 
1786  FEBase * scalar_fe = fe_ptrs[dim].get();
1787  FEVectorBase * vec_fe = vec_fe_ptrs[dim].get();
1788 
1789  if (scalar_fe)
1790  {
1791  libmesh_assert(!vec_fe);
1792  element_calculation(*scalar_fe);
1793  }
1794 
1795  if (vec_fe)
1796  {
1797  libmesh_assert(!scalar_fe);
1798  element_calculation(*vec_fe);
1799  }
1800  }
1801  }
1802 
1803  if (using_hilbert_norm)
1804  {
1805  this->comm().sum(v_norm);
1806  v_norm = std::sqrt(v_norm);
1807  }
1808  else
1809  {
1810  this->comm().max(v_norm);
1811  }
1812 
1813  return v_norm;
1814 }
void dof_indices(const Elem *const elem, std::vector< dof_id_type > &di) const
Definition: dof_map.C:2197
unsigned int dim
virtual numeric_index_type size() const =0
void sum(T &r) const
static FEFieldType field_type(const FEType &fe_type)
FEMNormType
defines an enum for norms defined on vectors of finite element coefficients
std::unique_ptr< DofMap > _dof_map
Data structure describing the relationship between nodes, variables, etc...
Definition: system.h:2202
const Parallel::Communicator & comm() const
FEGenericBase< RealGradient > FEVectorBase
Definition: fe_base.h:818
const MeshBase & get_mesh() const
Definition: system.h:2359
virtual Real l2_norm() const =0
static std::unique_ptr< FEGenericBase > build(const unsigned int dim, const FEType &type)
Builds a specific finite element type.
libmesh_assert(ctx)
const FEType & variable_type(const unsigned int i) const
Definition: dof_map.h:2386
const std::set< unsigned char > & elem_dimensions() const
Definition: mesh_base.h:282
auto norm(const T &a) -> decltype(std::abs(a))
Definition: tensor_tools.h:74
FEGenericBase< Real > FEBase
virtual Real l1_norm() const =0
std::string enum_to_string(const T e)
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
void max(const T &r, T &o, Request &req) const
auto norm_sq(const T &a) -> decltype(std::norm(a))
Definition: tensor_tools.h:104
virtual numeric_index_type local_size() const =0
IntRange< T > make_range(T beg, T end)
The 2-parameter make_range() helper function returns an IntRange<T> when both input parameters are of...
Definition: int_range.h:140
static std::unique_ptr< NumericVector< T > > build(const Parallel::Communicator &comm, SolverPackage solver_package=libMesh::default_solver_package(), ParallelType parallel_type=AUTOMATIC)
Builds a NumericVector on the processors in communicator comm using the linear solver package specifi...
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...
Definition: system.C:1483
unsigned int n_vars() const
Definition: system.C:2654
const DofMap & get_dof_map() const
Definition: system.h:2375
MeshBase & _mesh
Constant reference to the mesh data structure used for the simulation.
Definition: system.h:2214
virtual Real linfty_norm() const =0
virtual void localize(std::vector< T > &v_local) const =0
Creates a copy of the global vector in the local vector v_local.
FEFieldType
defines an enum for finite element field types - i.e.

◆ can_add_matrices()

bool libMesh::System::can_add_matrices ( ) const
inlineprotectedinherited
Returns
Whether or not matrices can still be added without expensive per-matrix initialization.

Definition at line 1998 of file system.h.

References libMesh::System::_matrices_initialized.

Referenced by set_eigenproblem_type().

1998 { return !_matrices_initialized; }
bool _matrices_initialized
false when additional matrices being added require initialization, true otherwise.
Definition: system.h:2264

◆ clear()

void libMesh::EigenSystem::clear ( )
overridevirtual

Clear all the data structures associated with the system.

Reimplemented from libMesh::System.

Reimplemented in libMesh::CondensedEigenSystem, libMesh::RBConstructionBase< CondensedEigenSystem >, and libMesh::RBSCMConstruction.

Definition at line 62 of file eigen_system.C.

References libMesh::System::clear(), eigen_solver, matrix_A, matrix_B, precond_matrix, shell_matrix_A, shell_matrix_B, and shell_precond_matrix.

Referenced by libMesh::CondensedEigenSystem::clear().

63 {
64  // Clear the parent data
65  Parent::clear();
66 
67  // The SparseMatrices are contained in _matrices
68  // and are cleared with the above call
69  matrix_A = nullptr;
70  matrix_B = nullptr;
71  precond_matrix = nullptr;
72 
73  // Operators
74  shell_matrix_A.reset();
75  shell_matrix_B.reset();
76 
77  // Preconditioning matrices
78  shell_precond_matrix.reset();
79 
80  // clear the solver
81  eigen_solver->clear();
82 }
virtual void clear()
Clear all the data structures associated with the system.
Definition: system.C:174
SparseMatrix< Number > * matrix_B
A second system matrix for generalized eigenvalue problems.
Definition: eigen_system.h:321
std::unique_ptr< ShellMatrix< Number > > shell_precond_matrix
A preconditioning shell matrix.
Definition: eigen_system.h:353
std::unique_ptr< ShellMatrix< Number > > shell_matrix_A
The system shell matrix for standard eigenvalue problems.
Definition: eigen_system.h:329
SparseMatrix< Number > * precond_matrix
A preconditioning matrix.
Definition: eigen_system.h:345
std::unique_ptr< ShellMatrix< Number > > shell_matrix_B
A second system shell matrix for generalized eigenvalue problems.
Definition: eigen_system.h:337
SparseMatrix< Number > * matrix_A
The system matrix for standard eigenvalue problems.
Definition: eigen_system.h:313
std::unique_ptr< EigenSolver< Number > > eigen_solver
The EigenSolver, defining which interface, i.e solver package to use.
Definition: eigen_system.h:362

◆ comm()

const Parallel::Communicator& libMesh::ParallelObject::comm ( ) const
inlineinherited
Returns
A reference to the Parallel::Communicator object used by this mesh.

Definition at line 97 of file parallel_object.h.

References libMesh::ParallelObject::_communicator.

Referenced by libMesh::__libmesh_petsc_diff_solver_jacobian(), libMesh::__libmesh_petsc_diff_solver_monitor(), libMesh::__libmesh_petsc_diff_solver_residual(), libMesh::__libmesh_tao_equality_constraints(), libMesh::__libmesh_tao_equality_constraints_jacobian(), libMesh::__libmesh_tao_gradient(), libMesh::__libmesh_tao_hessian(), libMesh::__libmesh_tao_inequality_constraints(), libMesh::__libmesh_tao_inequality_constraints_jacobian(), libMesh::__libmesh_tao_objective(), libMesh::MeshRefinement::_coarsen_elements(), libMesh::ExactSolution::_compute_error(), libMesh::UniformRefinementEstimator::_estimate_error(), libMesh::Partitioner::_find_global_index_by_pid_map(), libMesh::BoundaryInfo::_find_id_maps(), libMesh::PetscLinearSolver< Number >::_petsc_shell_matrix_get_diagonal(), libMesh::SlepcEigenSolver< libMesh::Number >::_petsc_shell_matrix_get_diagonal(), libMesh::PetscLinearSolver< Number >::_petsc_shell_matrix_mult(), libMesh::SlepcEigenSolver< libMesh::Number >::_petsc_shell_matrix_mult(), libMesh::PetscLinearSolver< Number >::_petsc_shell_matrix_mult_add(), libMesh::MeshRefinement::_refine_elements(), libMesh::MeshRefinement::_smooth_flags(), libMesh::DofMap::add_constraints_to_send_list(), add_cube_convex_hull_to_mesh(), libMesh::PetscDMWrapper::add_dofs_helper(), libMesh::PetscDMWrapper::add_dofs_to_section(), libMesh::TransientRBConstruction::add_IC_to_RB_space(), libMesh::RBEIMEvaluation::add_interpolation_data(), libMesh::CondensedEigenSystem::add_matrices(), add_matrices(), libMesh::System::add_matrix(), libMesh::RBConstruction::add_scaled_matrix_and_vector(), libMesh::DofMap::add_variable(), libMesh::DofMap::add_variables(), libMesh::System::add_vector(), libMesh::MeshTools::Modification::all_tri(), libMesh::LaplaceMeshSmoother::allgather_graph(), libMesh::DofMap::allgather_recursive_constraints(), libMesh::TransientRBConstruction::allocate_data_structures(), libMesh::RBConstruction::allocate_data_structures(), libMesh::TransientRBConstruction::assemble_affine_expansion(), libMesh::AdvectionSystem::assemble_claw_rhs(), libMesh::FEMSystem::assemble_qoi(), libMesh::Nemesis_IO::assert_symmetric_cmaps(), libMesh::MeshCommunication::assign_global_indices(), libMesh::Partitioner::assign_partitioning(), libMesh::MeshTools::Generation::build_extrusion(), libMesh::Partitioner::build_graph(), libMesh::BoundaryInfo::build_node_list_from_side_list(), libMesh::EquationSystems::build_parallel_elemental_solution_vector(), libMesh::EquationSystems::build_parallel_solution_vector(), libMesh::PetscDMWrapper::build_section(), libMesh::PetscDMWrapper::build_sf(), libMesh::MeshBase::cache_elem_data(), libMesh::System::calculate_norm(), libMesh::DofMap::check_dirichlet_bcid_consistency(), libMesh::RBConstruction::compute_Fq_representor_innerprods(), libMesh::RBConstruction::compute_max_error_bound(), libMesh::Nemesis_IO_Helper::compute_num_global_elem_blocks(), libMesh::Nemesis_IO_Helper::compute_num_global_nodesets(), libMesh::Nemesis_IO_Helper::compute_num_global_sidesets(), libMesh::RBConstruction::compute_output_dual_innerprods(), libMesh::RBConstruction::compute_residual_dual_norm_slow(), libMesh::RBSCMConstruction::compute_SCM_bounds_on_training_set(), libMesh::DofMap::computed_sparsity_already(), libMesh::Problem_Interface::computeF(), libMesh::Problem_Interface::computeJacobian(), libMesh::Problem_Interface::computePreconditioner(), libMesh::ContinuationSystem::ContinuationSystem(), libMesh::MeshBase::copy_constraint_rows(), libMesh::ExodusII_IO::copy_elemental_solution(), libMesh::ExodusII_IO::copy_nodal_solution(), libMesh::ExodusII_IO::copy_scalar_solution(), libMesh::CondensedEigenSystem::copy_super_to_sub(), libMesh::MeshTools::correct_node_proc_ids(), libMesh::MeshTools::create_bounding_box(), libMesh::DofMap::create_dof_constraints(), libMesh::MeshTools::create_nodal_bounding_box(), libMesh::MeshRefinement::create_parent_error_vector(), libMesh::MeshTools::create_processor_bounding_box(), libMesh::MeshTools::create_subdomain_bounding_box(), libMesh::PetscMatrix< T >::create_submatrix_nosort(), create_wrapped_function(), libMesh::MeshCommunication::delete_remote_elements(), libMesh::RBEIMEvaluation::distribute_bfs(), DMlibMeshFunction(), DMlibMeshJacobian(), DMlibMeshSetSystem_libMesh(), DMVariableBounds_libMesh(), libMesh::DTKSolutionTransfer::DTKSolutionTransfer(), libMesh::MeshRefinement::eliminate_unrefined_patches(), libMesh::RBEIMConstruction::enrich_eim_approximation_on_interiors(), libMesh::RBEIMConstruction::enrich_eim_approximation_on_nodes(), libMesh::RBEIMConstruction::enrich_eim_approximation_on_sides(), libMesh::TransientRBConstruction::enrich_RB_space(), libMesh::EpetraVector< T >::EpetraVector(), AssembleOptimization::equality_constraints(), libMesh::PatchRecoveryErrorEstimator::estimate_error(), libMesh::WeightedPatchRecoveryErrorEstimator::estimate_error(), libMesh::AdjointRefinementEstimator::estimate_error(), libMesh::ExactErrorEstimator::estimate_error(), libMesh::SmoothnessEstimator::estimate_smoothness(), libMesh::MeshRefinement::flag_elements_by_elem_fraction(), libMesh::MeshRefinement::flag_elements_by_error_fraction(), libMesh::MeshRefinement::flag_elements_by_error_tolerance(), libMesh::MeshRefinement::flag_elements_by_mean_stddev(), libMesh::MeshRefinement::flag_elements_by_nelem_target(), libMesh::RBEIMEvaluation::gather_bfs(), libMesh::DofMap::gather_constraints(), libMesh::MeshfreeInterpolation::gather_remote_data(), libMesh::CondensedEigenSystem::get_eigenpair(), libMesh::RBEIMEvaluation::get_eim_basis_function_node_value(), libMesh::RBEIMEvaluation::get_eim_basis_function_side_value(), libMesh::RBEIMEvaluation::get_eim_basis_function_value(), libMesh::MeshBase::get_info(), libMesh::System::get_info(), libMesh::DofMap::get_info(), libMesh::RBEIMEvaluation::get_interior_basis_functions_as_vecs(), libMesh::ImplicitSystem::get_linear_solver(), libMesh::RBEIMConstruction::get_max_abs_value(), libMesh::RBEIMConstruction::get_node_max_abs_value(), libMesh::RBEIMEvaluation::get_parametrized_function_node_value(), libMesh::RBEIMEvaluation::get_parametrized_function_side_value(), libMesh::RBEIMEvaluation::get_parametrized_function_value(), libMesh::RBEIMConstruction::get_random_point(), AssembleOptimization::inequality_constraints(), AssembleOptimization::inequality_constraints_jacobian(), libMesh::LocationMap< T >::init(), libMesh::TimeSolver::init(), libMesh::StaticCondensation::init(), libMesh::SystemSubsetBySubdomain::init(), libMesh::PetscDMWrapper::init_and_attach_petscdm(), libMesh::AdvectionSystem::init_data(), libMesh::ClawSystem::init_data(), libMesh::PetscDMWrapper::init_petscdm(), libMesh::ExodusII_IO_Helper::initialize(), libMesh::OptimizationSystem::initialize_equality_constraints_storage(), libMesh::OptimizationSystem::initialize_inequality_constraints_storage(), libMesh::RBEIMConstruction::initialize_parametrized_functions_in_training_set(), libMesh::RBEIMConstruction::inner_product(), integrate_function(), libMesh::MeshTools::libmesh_assert_consistent_distributed(), libMesh::MeshTools::libmesh_assert_consistent_distributed_nodes(), libMesh::MeshTools::libmesh_assert_contiguous_dof_ids(), libMesh::MeshTools::libmesh_assert_equal_connectivity(), libMesh::MeshTools::libmesh_assert_equal_points(), libMesh::MeshTools::libmesh_assert_parallel_consistent_new_node_procids(), libMesh::MeshTools::libmesh_assert_parallel_consistent_procids< Elem >(), libMesh::MeshTools::libmesh_assert_parallel_consistent_procids< Node >(), libMesh::MeshTools::libmesh_assert_topology_consistent_procids< Node >(), libMesh::MeshTools::libmesh_assert_valid_boundary_ids(), libMesh::MeshTools::libmesh_assert_valid_constraint_rows(), libMesh::MeshTools::libmesh_assert_valid_dof_ids(), libMesh::MeshTools::libmesh_assert_valid_neighbors(), libMesh::DistributedMesh::libmesh_assert_valid_parallel_flags(), libMesh::DistributedMesh::libmesh_assert_valid_parallel_object_ids(), libMesh::DistributedMesh::libmesh_assert_valid_parallel_p_levels(), libMesh::MeshTools::libmesh_assert_valid_refinement_flags(), libMesh::MeshTools::libmesh_assert_valid_unique_ids(), libMesh::libmesh_petsc_linesearch_shellfunc(), libMesh::libmesh_petsc_preconditioner_apply(), libMesh::libmesh_petsc_recalculate_monitor(), libMesh::libmesh_petsc_snes_fd_residual(), libMesh::libmesh_petsc_snes_jacobian(), libMesh::libmesh_petsc_snes_mffd_interface(), libMesh::libmesh_petsc_snes_mffd_residual(), libMesh::libmesh_petsc_snes_postcheck(), libMesh::libmesh_petsc_snes_precheck(), libMesh::libmesh_petsc_snes_residual(), libMesh::libmesh_petsc_snes_residual_helper(), libMesh::MeshRefinement::limit_level_mismatch_at_edge(), libMesh::MeshRefinement::limit_level_mismatch_at_node(), libMesh::MeshRefinement::limit_overrefined_boundary(), libMesh::MeshRefinement::limit_underrefined_boundary(), libMesh::LinearImplicitSystem::LinearImplicitSystem(), main(), libMesh::MeshRefinement::make_coarsening_compatible(), libMesh::MeshCommunication::make_elems_parallel_consistent(), libMesh::MeshRefinement::make_flags_parallel_consistent(), libMesh::MeshCommunication::make_new_node_proc_ids_parallel_consistent(), libMesh::MeshCommunication::make_new_nodes_parallel_consistent(), libMesh::MeshCommunication::make_node_bcids_parallel_consistent(), libMesh::MeshCommunication::make_node_ids_parallel_consistent(), libMesh::MeshCommunication::make_node_proc_ids_parallel_consistent(), libMesh::MeshCommunication::make_node_unique_ids_parallel_consistent(), libMesh::MeshCommunication::make_nodes_parallel_consistent(), libMesh::MeshCommunication::make_p_levels_parallel_consistent(), libMesh::MeshRefinement::make_refinement_compatible(), libMesh::TransientRBConstruction::mass_matrix_scaled_matvec(), libMesh::FEMSystem::mesh_position_set(), libMesh::TriangulatorInterface::MeshedHole::MeshedHole(), LinearElasticityWithContact::move_mesh(), libMesh::DistributedMesh::n_active_elem(), libMesh::MeshTools::n_active_levels(), libMesh::BoundaryInfo::n_boundary_conds(), libMesh::MeshTools::n_connected_components(), libMesh::DofMap::n_constrained_dofs(), libMesh::MeshBase::n_constraint_rows(), libMesh::DofMap::n_dofs(), libMesh::DofMap::n_dofs_per_processor(), libMesh::BoundaryInfo::n_edge_conds(), libMesh::CondensedEigenSystem::n_global_non_condensed_dofs(), libMesh::MeshTools::n_levels(), MixedOrderTest::n_neighbor_links(), libMesh::BoundaryInfo::n_nodeset_conds(), libMesh::SparsityPattern::Build::n_nonzeros(), libMesh::MeshTools::n_p_levels(), libMesh::BoundaryInfo::n_shellface_conds(), libMesh::RBEIMEvaluation::node_distribute_bfs(), libMesh::RBEIMEvaluation::node_gather_bfs(), libMesh::RBEIMConstruction::node_inner_product(), libMesh::MeshBase::operator==(), libMesh::DistributedMesh::parallel_max_elem_id(), libMesh::DistributedMesh::parallel_max_node_id(), libMesh::ReplicatedMesh::parallel_max_unique_id(), libMesh::DistributedMesh::parallel_max_unique_id(), libMesh::DistributedMesh::parallel_n_elem(), libMesh::DistributedMesh::parallel_n_nodes(), libMesh::SparsityPattern::Build::parallel_sync(), libMesh::BoundaryInfo::parallel_sync_node_ids(), libMesh::BoundaryInfo::parallel_sync_side_ids(), libMesh::MeshTools::paranoid_n_levels(), libMesh::Partitioner::partition(), libMesh::Partitioner::partition_unpartitioned_elements(), libMesh::petsc_auto_fieldsplit(), libMesh::System::point_gradient(), libMesh::System::point_hessian(), libMesh::System::point_value(), libMesh::MeshBase::prepare_for_use(), libMesh::MeshBase::print_constraint_rows(), libMesh::DofMap::print_dof_constraints(), libMesh::DofMap::process_mesh_constraint_rows(), libMesh::Partitioner::processor_pairs_to_interface_nodes(), libMesh::InterMeshProjection::project_system_vectors(), FEMParameters::read(), libMesh::Nemesis_IO::read(), libMesh::XdrIO::read(), libMesh::EquationSystems::read(), libMesh::ExodusII_IO::read_header(), libMesh::CheckpointIO::read_header(), libMesh::XdrIO::read_header(), libMesh::System::read_header(), libMesh::RBEIMEvaluation::read_in_interior_basis_functions(), libMesh::RBEIMEvaluation::read_in_node_basis_functions(), libMesh::RBEIMEvaluation::read_in_side_basis_functions(), libMesh::RBEvaluation::read_in_vectors_from_multiple_files(), libMesh::System::read_legacy_data(), libMesh::TransientRBConstruction::read_riesz_representors_from_files(), libMesh::RBConstruction::read_riesz_representors_from_files(), libMesh::System::read_SCALAR_dofs(), libMesh::XdrIO::read_serialized_bc_names(), libMesh::XdrIO::read_serialized_bcs_helper(), libMesh::System::read_serialized_blocked_dof_objects(), libMesh::XdrIO::read_serialized_connectivity(), libMesh::XdrIO::read_serialized_nodes(), libMesh::XdrIO::read_serialized_nodesets(), libMesh::XdrIO::read_serialized_subdomain_names(), libMesh::System::read_serialized_vector(), libMesh::Nemesis_IO_Helper::read_var_names_impl(), MeshFunctionTest::read_variable_info_from_output_data(), libMesh::MeshBase::recalculate_n_partitions(), libMesh::MeshRefinement::refine_and_coarsen_elements(), libMesh::SimplexRefiner::refine_via_edges(), libMesh::StaticCondensationDofMap::reinit(), libMesh::BoundaryInfo::remove_edge_id(), libMesh::BoundaryInfo::remove_node_id(), libMesh::BoundaryInfo::remove_shellface_id(), libMesh::BoundaryInfo::remove_side_id(), libMesh::DistributedMesh::renumber_dof_objects(), libMesh::DistributedMesh::renumber_nodes_and_elements(), LinearElasticityWithContact::residual_and_jacobian(), OverlappingAlgebraicGhostingTest::run_ghosting_test(), OverlappingCouplingGhostingTest::run_sparsity_pattern_test(), scale_mesh_and_plot(), libMesh::DofMap::scatter_constraints(), libMesh::CheckpointIO::select_split_config(), libMesh::GenericProjector< FFunctor, GFunctor, FValue, ProjectionAction >::send_and_insert_dof_values(), libMesh::TransientRBConstruction::set_error_temporal_data(), libMesh::Partitioner::set_interface_node_processor_ids_BFS(), libMesh::Partitioner::set_interface_node_processor_ids_linear(), libMesh::Partitioner::set_interface_node_processor_ids_petscpartitioner(), libMesh::Partitioner::set_node_processor_ids(), libMesh::DofMap::set_nonlocal_dof_objects(), libMesh::Partitioner::set_parent_processor_ids(), libMesh::PetscDMWrapper::set_point_range_in_section(), libMesh::PetscDiffSolver::setup_petsc_data(), libMesh::RBEIMEvaluation::side_distribute_bfs(), libMesh::RBEIMEvaluation::side_gather_bfs(), libMesh::RBEIMConstruction::side_inner_product(), libMesh::Partitioner::single_partition(), libMesh::LaplaceMeshSmoother::smooth(), libMesh::VariationalMeshSmoother::smooth(), libMesh::ClawSystem::solve_conservation_law(), libMesh::split_mesh(), libMesh::RBEIMConstruction::store_eim_solutions_for_training_set(), libMesh::MeshBase::subdomain_ids(), libMesh::BoundaryInfo::sync(), ConstraintOperatorTest::test1DCoarseningNewNodes(), ConstraintOperatorTest::test1DCoarseningOperator(), libMesh::MeshRefinement::test_level_one(), MeshfunctionDFEM::test_mesh_function_dfem(), MeshfunctionDFEM::test_mesh_function_dfem_grad(), MeshFunctionTest::test_p_level(), libMesh::MeshRefinement::test_unflagged(), DofMapTest::testBadElemFECombo(), SystemsTest::testBlockRestrictedVarNDofs(), BoundaryInfoTest::testBoundaryOnChildrenErrors(), VolumeTest::testC0PolygonMethods(), VolumeTest::testC0PolyhedronMethods(), ConstraintOperatorTest::testCoreform(), ConnectedComponentsTest::testEdge(), MeshInputTest::testExodusIGASidesets(), MeshTriangulationTest::testFoundCenters(), PointLocatorTest::testLocator(), BoundaryInfoTest::testMesh(), PointLocatorTest::testPlanar(), MeshTriangulationTest::testPoly2TriRefinementBase(), SystemsTest::testProjectCubeWithMeshFunction(), BoundaryInfoTest::testRenumber(), BoundaryInfoTest::testSelectiveRenumber(), CheckpointIOTest::testSplitter(), MeshInputTest::testTetgenIO(), MeshTriangulationTest::testTriangulatorInterp(), MeshTriangulationTest::testTriangulatorMeshedHoles(), MeshTriangulationTest::testTriangulatorRoundHole(), MeshSmootherTest::testVariationalSmoother(), libMesh::MeshTools::total_weight(), libMesh::RBConstruction::train_reduced_basis_with_POD(), libMesh::MeshFunctionSolutionTransfer::transfer(), libMesh::MeshfreeSolutionTransfer::transfer(), libMesh::Poly2TriTriangulator::triangulate(), libMesh::TransientRBConstruction::truth_assembly(), libMesh::RBConstruction::truth_assembly(), libMesh::MeshRefinement::uniformly_coarsen(), update_current_local_solution(), libMesh::TransientRBConstruction::update_RB_initial_condition_all_N(), libMesh::TransientRBConstruction::update_RB_system_matrices(), libMesh::RBConstruction::update_RB_system_matrices(), libMesh::TransientRBConstruction::update_residual_terms(), libMesh::RBConstruction::update_residual_terms(), libMesh::MeshTools::volume(), libMesh::STLIO::write(), libMesh::NameBasedIO::write(), libMesh::XdrIO::write(), libMesh::VTKIO::write_nodal_data(), libMesh::RBEIMEvaluation::write_out_interior_basis_functions(), libMesh::RBEIMEvaluation::write_out_node_basis_functions(), libMesh::RBEIMEvaluation::write_out_side_basis_functions(), libMesh::RBEvaluation::write_out_vectors(), libMesh::TransientRBConstruction::write_riesz_representors_to_files(), libMesh::RBConstruction::write_riesz_representors_to_files(), libMesh::System::write_SCALAR_dofs(), libMesh::XdrIO::write_serialized_bcs_helper(), libMesh::System::write_serialized_blocked_dof_objects(), libMesh::XdrIO::write_serialized_connectivity(), libMesh::XdrIO::write_serialized_nodes(), libMesh::XdrIO::write_serialized_nodesets(), libMesh::RBDataSerialization::RBEvaluationSerialization::write_to_file(), libMesh::RBDataSerialization::TransientRBEvaluationSerialization::write_to_file(), libMesh::RBDataSerialization::RBEIMEvaluationSerialization::write_to_file(), and libMesh::RBDataSerialization::RBSCMEvaluationSerialization::write_to_file().

98  { return _communicator; }
const Parallel::Communicator & _communicator

◆ compare()

bool libMesh::System::compare ( const System other_system,
const Real  threshold,
const bool  verbose 
) const
virtualinherited
Returns
true when the other system contains identical data, up to the given threshold. Outputs some diagnostic info when verbose is set.

Definition at line 603 of file system.C.

References libMesh::System::_is_initialized, libMesh::System::_sys_name, libMesh::System::_vectors, libMesh::System::get_vector(), libMesh::libmesh_assert(), libMesh::System::n_vectors(), libMesh::System::name(), libMesh::out, and libMesh::System::solution.

606 {
607  // we do not care for matrices, but for vectors
609  libmesh_assert (other_system._is_initialized);
610 
611  if (verbose)
612  {
613  libMesh::out << " Systems \"" << _sys_name << "\"" << std::endl;
614  libMesh::out << " comparing matrices not supported." << std::endl;
615  libMesh::out << " comparing names...";
616  }
617 
618  // compare the name: 0 means identical
619  const int name_result = _sys_name.compare(other_system.name());
620  if (verbose)
621  {
622  if (name_result == 0)
623  libMesh::out << " identical." << std::endl;
624  else
625  libMesh::out << " names not identical." << std::endl;
626  libMesh::out << " comparing solution vector...";
627  }
628 
629 
630  // compare the solution: -1 means identical
631  const int solu_result = solution->compare (*other_system.solution.get(),
632  threshold);
633 
634  if (verbose)
635  {
636  if (solu_result == -1)
637  libMesh::out << " identical up to threshold." << std::endl;
638  else
639  libMesh::out << " first difference occurred at index = "
640  << solu_result << "." << std::endl;
641  }
642 
643 
644  // safety check, whether we handle at least the same number
645  // of vectors
646  std::vector<int> ov_result;
647 
648  if (this->n_vectors() != other_system.n_vectors())
649  {
650  if (verbose)
651  {
652  libMesh::out << " Fatal difference. This system handles "
653  << this->n_vectors() << " add'l vectors," << std::endl
654  << " while the other system handles "
655  << other_system.n_vectors()
656  << " add'l vectors." << std::endl
657  << " Aborting comparison." << std::endl;
658  }
659  return false;
660  }
661  else if (this->n_vectors() == 0)
662  {
663  // there are no additional vectors...
664  ov_result.clear ();
665  }
666  else
667  {
668  // compare other vectors
669  for (auto & [vec_name, vec] : _vectors)
670  {
671  if (verbose)
672  libMesh::out << " comparing vector \""
673  << vec_name << "\" ...";
674 
675  // assume they have the same name
676  const NumericVector<Number> & other_system_vector =
677  other_system.get_vector(vec_name);
678 
679  ov_result.push_back(vec->compare(other_system_vector, threshold));
680 
681  if (verbose)
682  {
683  if (ov_result[ov_result.size()-1] == -1)
684  libMesh::out << " identical up to threshold." << std::endl;
685  else
686  libMesh::out << " first difference occurred at" << std::endl
687  << " index = " << ov_result[ov_result.size()-1] << "." << std::endl;
688  }
689  }
690  } // finished comparing additional vectors
691 
692 
693  bool overall_result;
694 
695  // sum up the results
696  if ((name_result==0) && (solu_result==-1))
697  {
698  if (ov_result.size()==0)
699  overall_result = true;
700  else
701  {
702  bool ov_identical;
703  unsigned int n = 0;
704  do
705  {
706  ov_identical = (ov_result[n]==-1);
707  n++;
708  }
709  while (ov_identical && n<ov_result.size());
710  overall_result = ov_identical;
711  }
712  }
713  else
714  overall_result = false;
715 
716  if (verbose)
717  {
718  libMesh::out << " finished comparisons, ";
719  if (overall_result)
720  libMesh::out << "found no differences." << std::endl << std::endl;
721  else
722  libMesh::out << "found differences." << std::endl << std::endl;
723  }
724 
725  return overall_result;
726 }
bool _is_initialized
true when additional vectors and variables do not require immediate initialization, false otherwise.
Definition: system.h:2283
std::map< std::string, std::unique_ptr< NumericVector< Number > >, std::less<> > _vectors
Some systems need an arbitrary number of vectors.
Definition: system.h:2237
unsigned int n_vectors() const
Definition: system.h:2457
std::unique_ptr< NumericVector< Number > > solution
Data structure to hold solution values.
Definition: system.h:1616
libmesh_assert(ctx)
OStreamProxy out
const std::string _sys_name
A name associated with this system.
Definition: system.h:2219
template class LIBMESH_EXPORT NumericVector< Number >

◆ condense_constrained_dofs()

virtual bool libMesh::System::condense_constrained_dofs ( ) const
inlineprotectedvirtualinherited

Whether this object should condense out constrained degrees of freedom.

Reimplemented in libMesh::CondensedEigenSystem.

Definition at line 2036 of file system.h.

Referenced by init_matrices().

2036 { return false; }

◆ create_static_condensation()

void libMesh::System::create_static_condensation ( )
virtualinherited

Request that static condensation be performed for this system.

Reimplemented in libMesh::ImplicitSystem, libMesh::NonlinearImplicitSystem, and libMesh::LinearImplicitSystem.

Definition at line 2644 of file system.C.

References libMesh::DofMap::create_static_condensation(), libMesh::System::get_dof_map(), and libMesh::System::get_mesh().

Referenced by libMesh::ImplicitSystem::create_static_condensation(), and libMesh::System::System().

2645 {
2646  this->get_dof_map().create_static_condensation(this->get_mesh(), *this);
2647 }
const MeshBase & get_mesh() const
Definition: system.h:2359
void create_static_condensation(MeshBase &mesh, System &system)
Add a static condensation class.
Definition: dof_map.C:3131
const DofMap & get_dof_map() const
Definition: system.h:2375

◆ current_solution()

Number libMesh::System::current_solution ( const dof_id_type  global_dof_number) const
inherited
Returns
The current solution for the specified global DOF.

Definition at line 163 of file system.C.

References libMesh::System::_dof_map, and libMesh::System::current_local_solution.

Referenced by libMesh::ExactSolution::_compute_error(), libMesh::UniformRefinementEstimator::_estimate_error(), libMesh::HPCoarsenTest::add_projection(), compute_stresses(), LinearElasticityWithContact::compute_stresses(), LinearElasticity::compute_stresses(), LargeDeformationElasticity::compute_stresses(), libMesh::ExactErrorEstimator::estimate_error(), main(), libMesh::WeightedPatchRecoveryErrorEstimator::EstimateError::operator()(), libMesh::SmoothnessEstimator::EstimateSmoothness::operator()(), libMesh::PatchRecoveryErrorEstimator::EstimateError::operator()(), libMesh::HPCoarsenTest::select_refinement(), SolidSystem::side_time_derivative(), libMesh::EnsightIO::write_scalar_ascii(), and libMesh::EnsightIO::write_vector_ascii().

164 {
165  // Check the sizes
166  libmesh_assert_less (global_dof_number, _dof_map->n_dofs());
167  libmesh_assert_less (global_dof_number, current_local_solution->size());
168 
169  return (*current_local_solution)(global_dof_number);
170 }
std::unique_ptr< DofMap > _dof_map
Data structure describing the relationship between nodes, variables, etc...
Definition: system.h:2202
std::unique_ptr< NumericVector< Number > > current_local_solution
All the values I need to compute my contribution to the simulation at hand.
Definition: system.h:1628

◆ deactivate()

void libMesh::System::deactivate ( )
inlineinherited

Deactivates the system.

Only active systems are solved.

Definition at line 2407 of file system.h.

References libMesh::System::_active.

2408 {
2409  _active = false;
2410 }
bool _active
Flag stating if the system is active or not.
Definition: system.h:2229

◆ disable_cache()

void libMesh::System::disable_cache ( )
inlinevirtualinherited

Avoids use of any cached data that might affect any solve result.

Should be overridden in derived systems.

Reimplemented in libMesh::ImplicitSystem.

Definition at line 2517 of file system.h.

References libMesh::System::assemble_before_solve.

Referenced by libMesh::UniformRefinementEstimator::_estimate_error().

2517 { assemble_before_solve = true; }
bool assemble_before_solve
Flag which tells the system to whether or not to call the user assembly function during each call to ...
Definition: system.h:1570

◆ disable_print_counter_info()

void libMesh::ReferenceCounter::disable_print_counter_info ( )
staticinherited

Definition at line 100 of file reference_counter.C.

References libMesh::ReferenceCounter::_enable_print_counter.

101 {
102  _enable_print_counter = false;
103  return;
104 }
static bool _enable_print_counter
Flag to control whether reference count information is printed when print_info is called...

◆ enable_print_counter_info()

void libMesh::ReferenceCounter::enable_print_counter_info ( )
staticinherited

Methods to enable/disable the reference counter output from print_info()

Definition at line 94 of file reference_counter.C.

References libMesh::ReferenceCounter::_enable_print_counter.

95 {
96  _enable_print_counter = true;
97  return;
98 }
static bool _enable_print_counter
Flag to control whether reference count information is printed when print_info is called...

◆ forward_qoi_parameter_sensitivity()

void libMesh::System::forward_qoi_parameter_sensitivity ( const QoISet qoi_indices,
const ParameterVector parameters,
SensitivityData sensitivities 
)
inlinevirtualinherited

Solves for parameter sensitivities using the forward method.

This method is only implemented in some derived classes.

Reimplemented in libMesh::ImplicitSystem.

Definition at line 2571 of file system.h.

Referenced by libMesh::System::qoi_parameter_sensitivity().

2574 {
2575  libmesh_not_implemented();
2576 }

◆ generalized()

bool libMesh::EigenSystem::generalized ( ) const
Returns
true if the underlying problem is generalized , false otherwise.

Definition at line 325 of file eigen_system.C.

References _eigen_problem_type, libMesh::GHEP, libMesh::GHIEP, and libMesh::GNHEP.

Referenced by add_matrices(), get_matrix_B(), get_shell_matrix_B(), libMesh::CondensedEigenSystem::solve(), and solve_helper().

326 {
327  return _eigen_problem_type == GNHEP ||
330 }
EigenProblemType _eigen_problem_type
The type of the eigenvalue problem.
Definition: eigen_system.h:409

◆ get_adjoint_rhs() [1/2]

NumericVector< Number > & libMesh::System::get_adjoint_rhs ( unsigned int  i = 0)
inherited
Returns
A reference to one of the system's adjoint rhs vectors, by default the one corresponding to the first qoi. This what the user's QoI derivative code should assemble when setting up an adjoint problem

Definition at line 1292 of file system.C.

References libMesh::System::get_vector().

Referenced by libMesh::ImplicitSystem::adjoint_solve(), libMesh::FEMSystem::assemble_qoi_derivative(), libMesh::ImplicitSystem::forward_qoi_parameter_sensitivity(), libMesh::ImplicitSystem::qoi_parameter_hessian(), libMesh::ImplicitSystem::qoi_parameter_hessian_vector_product(), and libMesh::ImplicitSystem::weighted_sensitivity_adjoint_solve().

1293 {
1294  std::ostringstream adjoint_rhs_name;
1295  adjoint_rhs_name << "adjoint_rhs" << i;
1296 
1297  return this->get_vector(adjoint_rhs_name.str());
1298 }
const NumericVector< Number > & get_vector(std::string_view vec_name) const
Definition: system.C:928

◆ get_adjoint_rhs() [2/2]

const NumericVector< Number > & libMesh::System::get_adjoint_rhs ( unsigned int  i = 0) const
inherited
Returns
A reference to one of the system's adjoint rhs vectors, by default the one corresponding to the first qoi.

Definition at line 1302 of file system.C.

References libMesh::System::get_vector().

1303 {
1304  std::ostringstream adjoint_rhs_name;
1305  adjoint_rhs_name << "adjoint_rhs" << i;
1306 
1307  return this->get_vector(adjoint_rhs_name.str());
1308 }
const NumericVector< Number > & get_vector(std::string_view vec_name) const
Definition: system.C:928

◆ get_adjoint_solution() [1/2]

NumericVector< Number > & libMesh::System::get_adjoint_solution ( unsigned int  i = 0)
inherited

◆ get_adjoint_solution() [2/2]

const NumericVector< Number > & libMesh::System::get_adjoint_solution ( unsigned int  i = 0) const
inherited
Returns
A reference to one of the system's adjoint solution vectors, by default the one corresponding to the first qoi.

Definition at line 1240 of file system.C.

References libMesh::System::get_vector().

1241 {
1242  std::ostringstream adjoint_name;
1243  adjoint_name << "adjoint_solution" << i;
1244 
1245  return this->get_vector(adjoint_name.str());
1246 }
const NumericVector< Number > & get_vector(std::string_view vec_name) const
Definition: system.C:928

◆ get_all_variable_numbers()

void libMesh::System::get_all_variable_numbers ( std::vector< unsigned int > &  all_variable_numbers) const
inherited

Fills all_variable_numbers with all the variable numbers for the variables that have been added to this system.

Definition at line 1399 of file system.C.

References libMesh::DofMap::get_all_variable_numbers(), and libMesh::System::get_dof_map().

Referenced by MeshFunctionTest::read_variable_info_from_output_data(), MeshfunctionDFEM::test_mesh_function_dfem(), MeshfunctionDFEM::test_mesh_function_dfem_grad(), and SystemsTest::testProjectCubeWithMeshFunction().

1400 {
1401  this->get_dof_map().get_all_variable_numbers(all_variable_numbers);
1402 }
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...
Definition: dof_map.C:3385
const DofMap & get_dof_map() const
Definition: system.h:2375

◆ get_constraint_object()

System::Constraint & libMesh::System::get_constraint_object ( )
inherited

Return the user object for imposing constraints.

Definition at line 2004 of file system.C.

References libMesh::System::_constrain_system_object.

2005 {
2006  libmesh_assert_msg(_constrain_system_object,"No constraint object available.");
2007  return *_constrain_system_object;
2008 }
Constraint * _constrain_system_object
Object that constrains the system.
Definition: system.h:2170

◆ get_dof_map() [1/2]

const DofMap & libMesh::System::get_dof_map ( ) const
inlineinherited
Returns
A constant reference to this system's _dof_map.

Definition at line 2375 of file system.h.

References libMesh::System::_dof_map.

Referenced by libMesh::__libmesh_petsc_diff_solver_jacobian(), libMesh::__libmesh_petsc_diff_solver_residual(), libMesh::ExactSolution::_compute_error(), libMesh::UniformRefinementEstimator::_estimate_error(), libMesh::DifferentiableSystem::add_dot_var_dirichlet_bcs(), libMesh::System::add_matrix(), libMesh::HPCoarsenTest::add_projection(), libMesh::RBConstruction::add_scaled_matrix_and_vector(), libMesh::System::add_variable(), libMesh::System::add_variable_array(), libMesh::System::add_variables(), libMesh::AdaptiveTimeSolver::adjoint_advance_timestep(), libMesh::UnsteadySolver::adjoint_advance_timestep(), libMesh::ImplicitSystem::adjoint_solve(), libMesh::NewmarkSolver::advance_timestep(), libMesh::AdaptiveTimeSolver::advance_timestep(), libMesh::UnsteadySolver::advance_timestep(), libMesh::EquationSystems::allgather(), libMesh::TransientRBConstruction::allocate_data_structures(), libMesh::RBConstruction::allocate_data_structures(), alternative_fe_assembly(), assemble(), LinearElasticity::assemble(), assemble_1D(), AssembleOptimization::assemble_A_and_F(), libMesh::ClawSystem::assemble_advection_matrices(), assemble_and_solve(), libMesh::ClawSystem::assemble_avg_coupling_matrices(), assemble_biharmonic(), libMesh::ClawSystem::assemble_boundary_condition_matrices(), assemble_divgrad(), assemble_elasticity(), assemble_ellipticdg(), assemble_func(), assemble_graddiv(), assemble_helmholtz(), libMesh::ClawSystem::assemble_jump_coupling_matrix(), assemble_laplace(), assemble_mass(), libMesh::ClawSystem::assemble_mass_matrix(), assemble_matrices(), assemble_matrix_and_rhs(), assemble_poisson(), assemble_SchroedingerEquation(), assemble_shell(), assemble_stokes(), assemble_wave(), libMesh::EquationSystems::build_parallel_elemental_solution_vector(), libMesh::EquationSystems::build_parallel_solution_vector(), libMesh::PetscDMWrapper::build_sf(), libMesh::System::calculate_norm(), compute_jacobian(), compute_residual(), compute_stresses(), LinearElasticityWithContact::compute_stresses(), LinearElasticity::compute_stresses(), LargeDeformationElasticity::compute_stresses(), libMesh::Problem_Interface::computeF(), libMesh::Problem_Interface::computeJacobian(), libMesh::Problem_Interface::computePreconditioner(), MyConstraint::constrain(), libMesh::VariationalSmootherConstraint::constrain_node_to_line(), libMesh::VariationalSmootherConstraint::constrain_node_to_plane(), libMesh::ExodusII_IO::copy_elemental_solution(), libMesh::Nemesis_IO::copy_elemental_solution(), libMesh::Nemesis_IO::copy_nodal_solution(), libMesh::ExodusII_IO::copy_scalar_solution(), libMesh::Nemesis_IO::copy_scalar_solution(), libMesh::CondensedEigenSystem::copy_sub_to_super(), libMesh::CondensedEigenSystem::copy_super_to_sub(), libMesh::System::create_static_condensation(), libMesh::ImplicitSystem::create_static_condensation_system_matrix(), create_wrapped_function(), DMCreateDomainDecomposition_libMesh(), DMCreateFieldDecomposition_libMesh(), DMlibMeshFunction(), DMlibMeshJacobian(), DMlibMeshSetSystem_libMesh(), libMesh::JumpErrorEstimator::estimate_error(), libMesh::AdjointRefinementEstimator::estimate_error(), libMesh::ExactErrorEstimator::estimate_error(), fe_assembly(), libMesh::GenericProjector< FFunctor, GFunctor, FValue, ProjectionAction >::SubFunctor::find_dofs_to_send(), libMesh::VariationalSmootherConstraint::fix_node(), form_functionA(), form_functionB(), form_matrixA(), libMesh::System::get_all_variable_numbers(), libMesh::CondensedEigenSystem::get_eigenpair(), libMesh::System::get_info(), libMesh::System::has_static_condensation(), libMesh::System::has_variable(), libMesh::System::identify_variable_groups(), libMesh::SystemSubsetBySubdomain::init(), libMesh::SecondOrderUnsteadySolver::init_data(), libMesh::UnsteadySolver::init_data(), HeatSystem::init_data(), SimpleRBConstruction::init_data(), libMesh::ClawSystem::init_data(), LaplaceSystem::init_dirichlet_bcs(), NonManifoldCouplingTestBase::init_es(), libMesh::FEMContext::init_internal_data(), init_matrices(), libMesh::System::init_matrices(), libMesh::PetscDMWrapper::init_petscdm(), libMesh::CondensedEigenSystem::initialize_condensed_dofs(), libMesh::OptimizationSystem::initialize_equality_constraints_storage(), libMesh::OptimizationSystem::initialize_inequality_constraints_storage(), LaplaceYoung::jacobian(), LargeDeformationElasticity::jacobian(), libMesh::System::late_matrix_init(), libMesh::libmesh_petsc_snes_fd_residual(), libMesh::libmesh_petsc_snes_jacobian(), libMesh::libmesh_petsc_snes_mffd_residual(), libMesh::libmesh_petsc_snes_residual(), libMesh::libmesh_petsc_snes_residual_helper(), libMesh::System::local_dof_indices(), AssembleOptimization::lower_and_upper_bounds(), main(), libMesh::DofMap::max_constraint_error(), LinearElasticityWithContact::move_mesh(), libMesh::System::n_components(), libMesh::System::n_variable_groups(), libMesh::System::n_vars(), libMesh::DGFEMContext::neighbor_side_fe_reinit(), libMesh::UnsteadySolver::old_nonlinear_solution(), libMesh::SecondOrderUnsteadySolver::old_solution_accel(), libMesh::SecondOrderUnsteadySolver::old_solution_rate(), libMesh::WeightedPatchRecoveryErrorEstimator::EstimateError::operator()(), libMesh::SmoothnessEstimator::EstimateSmoothness::operator()(), libMesh::PatchRecoveryErrorEstimator::EstimateError::operator()(), libMesh::GenericProjector< FFunctor, GFunctor, FValue, ProjectionAction >::ProjectSides::operator()(), libMesh::GenericProjector< FFunctor, GFunctor, FValue, ProjectionAction >::ProjectInteriors::operator()(), libMesh::RBSCMConstruction::perform_SCM_greedy(), periodic_bc_test_poisson(), libMesh::petsc_auto_fieldsplit(), libMesh::ErrorVector::plot_error(), libMesh::System::point_gradient(), libMesh::System::point_hessian(), libMesh::System::point_value(), libMesh::FEMContext::pre_fe_reinit(), libMesh::InterMeshProjection::project_system_vectors(), libMesh::System::re_update(), libMesh::System::read_parallel_data(), libMesh::System::read_SCALAR_dofs(), MeshFunctionTest::read_variable_info_from_output_data(), libMesh::SecondOrderUnsteadySolver::reinit(), libMesh::UnsteadySolver::reinit(), libMesh::System::reinit(), libMesh::System::reinit_constraints(), libMesh::EquationSystems::reinit_solutions(), LaplaceYoung::residual(), LargeDeformationElasticity::residual(), LinearElasticityWithContact::residual_and_jacobian(), libMesh::UnsteadySolver::retrieve_timestep(), OverlappingAlgebraicGhostingTest::run_ghosting_test(), OverlappingCouplingGhostingTest::run_sparsity_pattern_test(), libMesh::HPCoarsenTest::select_refinement(), libMesh::ImplicitSystem::sensitivity_solve(), libMesh::RBConstruction::set_context_solution_vec(), libMesh::PetscDMWrapper::set_point_range_in_section(), set_system_parameters(), SlitMeshRefinedSystemTest::setUp(), FETestBase< order, family, elem_type, 1 >::setUp(), SolidSystem::side_time_derivative(), libMesh::NewtonSolver::solve(), libMesh::PetscDiffSolver::solve(), solve(), libMesh::RBConstruction::solve_for_matrix_and_rhs(), SystemsTest::test100KVariables(), ConstraintOperatorTest::test1DCoarseningNewNodes(), ConstraintOperatorTest::test1DCoarseningOperator(), MeshfunctionDFEM::test_mesh_function_dfem(), MeshfunctionDFEM::test_mesh_function_dfem_grad(), MeshFunctionTest::test_p_level(), MeshFunctionTest::test_subdomain_id_sets(), SystemsTest::testBlockRestrictedVarNDofs(), DofMapTest::testConstraintLoopDetection(), DefaultCouplingTest::testCoupling(), PointNeighborCouplingTest::testCoupling(), EquationSystemsTest::testDisableDefaultGhosting(), SystemsTest::testDofCouplingWithVarGroups(), DofMapTest::testDofOwner(), MeshInputTest::testDynaReadPatch(), MeshInputTest::testExodusWriteElementDataFromDiscontinuousNodalData(), MeshAssignTest::testMeshMoveAssign(), PeriodicBCTest::testPeriodicBC(), SystemsTest::testPostInitAddVectorTypeChange(), SystemsTest::testProjectCubeWithMeshFunction(), SystemsTest::testProjectMatrix1D(), SystemsTest::testProjectMatrix2D(), SystemsTest::testProjectMatrix3D(), InfFERadialTest::testRefinement(), EquationSystemsTest::testSelectivePRefine(), BoundaryInfoTest::testShellFaceConstraints(), libMesh::MeshFunctionSolutionTransfer::transfer(), libMesh::BoundaryVolumeSolutionTransfer::transfer_boundary_volume(), libMesh::UnsteadySolver::update(), update_current_local_solution(), libMesh::System::variable(), libMesh::System::variable_group(), libMesh::System::variable_name(), libMesh::System::variable_number(), libMesh::System::variable_scalar_number(), libMesh::System::variable_type(), NonManifoldGhostingFunctorTest::verify_send_list_entries_helper(), libMesh::ImplicitSystem::weighted_sensitivity_adjoint_solve(), libMesh::ImplicitSystem::weighted_sensitivity_solve(), libMesh::Nemesis_IO_Helper::write_nodal_solution(), libMesh::System::write_parallel_data(), libMesh::EnsightIO::write_scalar_ascii(), libMesh::System::write_SCALAR_dofs(), libMesh::EnsightIO::write_vector_ascii(), and libMesh::RBConstruction::zero_constrained_dofs_on_vector().

2376 {
2377  return *_dof_map;
2378 }
std::unique_ptr< DofMap > _dof_map
Data structure describing the relationship between nodes, variables, etc...
Definition: system.h:2202

◆ get_dof_map() [2/2]

DofMap & libMesh::System::get_dof_map ( )
inlineinherited
Returns
A writable reference to this system's _dof_map.

Definition at line 2383 of file system.h.

References libMesh::System::_dof_map.

2384 {
2385  return *_dof_map;
2386 }
std::unique_ptr< DofMap > _dof_map
Data structure describing the relationship between nodes, variables, etc...
Definition: system.h:2202

◆ get_eigen_solver() [1/2]

const EigenSolver< Number > & libMesh::EigenSystem::get_eigen_solver ( ) const
Returns
A const reference to the EigenSolver.

Definition at line 482 of file eigen_system.C.

References eigen_solver, and libMesh::libmesh_assert().

Referenced by main().

483 {
485  return *eigen_solver;
486 }
libmesh_assert(ctx)
std::unique_ptr< EigenSolver< Number > > eigen_solver
The EigenSolver, defining which interface, i.e solver package to use.
Definition: eigen_system.h:362

◆ get_eigen_solver() [2/2]

EigenSolver< Number > & libMesh::EigenSystem::get_eigen_solver ( )
Returns
A reference to the EigenSolver.

Definition at line 489 of file eigen_system.C.

References eigen_solver, and libMesh::libmesh_assert().

490 {
492  return *eigen_solver;
493 }
libmesh_assert(ctx)
std::unique_ptr< EigenSolver< Number > > eigen_solver
The EigenSolver, defining which interface, i.e solver package to use.
Definition: eigen_system.h:362

◆ get_eigenpair()

std::pair< Real, Real > libMesh::EigenSystem::get_eigenpair ( dof_id_type  i)
virtual
Returns
Real and imaginary part of the ith eigenvalue and copies the respective eigen vector to the solution vector.

Reimplemented in libMesh::CondensedEigenSystem.

Definition at line 308 of file eigen_system.C.

References eigen_solver, and libMesh::System::solution.

Referenced by libMesh::CondensedEigenSystem::get_eigenpair(), and main().

309 {
310  // call the eigen_solver get_eigenpair method
311  return eigen_solver->get_eigenpair (i, *solution);
312 }
std::unique_ptr< NumericVector< Number > > solution
Data structure to hold solution values.
Definition: system.h:1616
std::unique_ptr< EigenSolver< Number > > eigen_solver
The EigenSolver, defining which interface, i.e solver package to use.
Definition: eigen_system.h:362

◆ get_eigenproblem_type()

EigenProblemType libMesh::EigenSystem::get_eigenproblem_type ( ) const
inline
Returns
The eigen problem type.

Definition at line 145 of file eigen_system.h.

References _eigen_problem_type.

145 {return _eigen_problem_type;}
EigenProblemType _eigen_problem_type
The type of the eigenvalue problem.
Definition: eigen_system.h:409

◆ get_eigenvalue()

std::pair< Real, Real > libMesh::EigenSystem::get_eigenvalue ( dof_id_type  i)
virtual
Returns
Real and imaginary part of the ith eigenvalue but does not copy the respective eigen vector to the solution vector.

Definition at line 314 of file eigen_system.C.

References eigen_solver.

315 {
316  return eigen_solver->get_eigenvalue (i);
317 }
std::unique_ptr< EigenSolver< Number > > eigen_solver
The EigenSolver, defining which interface, i.e solver package to use.
Definition: eigen_system.h:362

◆ get_equation_systems() [1/2]

const EquationSystems& libMesh::System::get_equation_systems ( ) const
inlineinherited
Returns
A constant reference to this system's parent EquationSystems object.

Definition at line 722 of file system.h.

References libMesh::System::_equation_systems.

Referenced by libMesh::UniformRefinementEstimator::_estimate_error(), libMesh::RBSCMConstruction::add_scaled_symm_Aq(), libMesh::NewmarkSystem::clear(), libMesh::FrequencySystem::clear_all(), compute_jacobian(), compute_residual(), LinearElasticityWithContact::compute_stresses(), SolidSystem::element_time_derivative(), libMesh::RBConstruction::enrich_basis_from_rhs_terms(), libMesh::AdjointRefinementEstimator::estimate_error(), libMesh::AdjointResidualErrorEstimator::estimate_error(), libMesh::ExactErrorEstimator::find_squared_element_error(), libMesh::ImplicitSystem::get_linear_solve_parameters(), SolidSystem::init_data(), HeatSystem::init_data(), libMesh::FrequencySystem::init_data(), LaplaceYoung::jacobian(), libMesh::RBSCMConstruction::load_matrix_B(), LinearElasticityWithContact::move_mesh(), libMesh::FrequencySystem::n_frequencies(), libMesh::RBSCMConstruction::perform_SCM_greedy(), libMesh::System::point_gradient(), libMesh::System::point_value(), libMesh::InterMeshProjection::project_system_vectors(), libMesh::StaticCondensationDofMap::reinit(), LaplaceYoung::residual(), LinearElasticityWithContact::residual_and_jacobian(), libMesh::FileHistoryData::retrieve_adjoint_solution(), libMesh::FileHistoryData::retrieve_primal_solution(), libMesh::FileHistoryData::rewrite_stored_solution(), SolidSystem::save_initial_mesh(), libMesh::FrequencySystem::set_current_frequency(), libMesh::FrequencySystem::set_frequencies(), libMesh::FrequencySystem::set_frequencies_by_range(), libMesh::FrequencySystem::set_frequencies_by_steps(), libMesh::NewmarkSystem::set_newmark_parameters(), libMesh::NonlinearImplicitSystem::set_solver_parameters(), SolidSystem::side_time_derivative(), solve(), libMesh::CondensedEigenSystem::solve(), libMesh::FrequencySystem::solve(), libMesh::ClawSystem::solve_conservation_law(), libMesh::RBConstruction::solve_for_matrix_and_rhs(), solve_helper(), libMesh::FileHistoryData::store_adjoint_solution(), libMesh::FileHistoryData::store_initial_solution(), libMesh::FileHistoryData::store_primal_solution(), MeshFunctionTest::test_p_level(), MeshFunctionTest::test_subdomain_id_sets(), MeshAssignTest::testMeshMoveAssign(), libMesh::MeshFunctionSolutionTransfer::transfer(), libMesh::DirectSolutionTransfer::transfer(), libMesh::MeshfreeSolutionTransfer::transfer(), libMesh::DTKSolutionTransfer::transfer(), libMesh::TransientRBConstruction::truth_solve(), libMesh::RBConstruction::truth_solve(), and libMesh::WrappedFunction< Output >::WrappedFunction().

722 { return _equation_systems; }
EquationSystems & _equation_systems
Constant reference to the EquationSystems object used for the simulation.
Definition: system.h:2208

◆ get_equation_systems() [2/2]

EquationSystems& libMesh::System::get_equation_systems ( )
inlineinherited
Returns
A reference to this system's parent EquationSystems object.

Definition at line 727 of file system.h.

References libMesh::System::_equation_systems.

727 { return _equation_systems; }
EquationSystems & _equation_systems
Constant reference to the EquationSystems object used for the simulation.
Definition: system.h:2208

◆ get_info() [1/2]

std::string libMesh::ReferenceCounter::get_info ( )
staticinherited

Gets a string containing the reference information.

Definition at line 47 of file reference_counter.C.

References libMesh::ReferenceCounter::_counts, and libMesh::Quality::name().

Referenced by libMesh::ReferenceCounter::print_info().

48 {
49 #if defined(LIBMESH_ENABLE_REFERENCE_COUNTING) && defined(DEBUG)
50 
51  std::ostringstream oss;
52 
53  oss << '\n'
54  << " ---------------------------------------------------------------------------- \n"
55  << "| Reference count information |\n"
56  << " ---------------------------------------------------------------------------- \n";
57 
58  for (const auto & [name, cd] : _counts)
59  oss << "| " << name << " reference count information:\n"
60  << "| Creations: " << cd.first << '\n'
61  << "| Destructions: " << cd.second << '\n';
62 
63  oss << " ---------------------------------------------------------------------------- \n";
64 
65  return oss.str();
66 
67 #else
68 
69  return "";
70 
71 #endif
72 }
std::string name(const ElemQuality q)
This function returns a string containing some name for q.
Definition: elem_quality.C:42
static Counts _counts
Actually holds the data.

◆ get_info() [2/2]

std::string libMesh::System::get_info ( ) const
inherited
Returns
A string containing information about the system.

Definition at line 1818 of file system.C.

References libMesh::ParallelObject::comm(), libMesh::FEType::family, libMesh::System::get_dof_map(), libMesh::DofMap::get_info(), libMesh::FEType::inf_map, libMesh::make_range(), TIMPI::Communicator::max(), libMesh::System::n_constrained_dofs(), libMesh::System::n_dofs(), libMesh::System::n_local_constrained_dofs(), libMesh::System::n_local_dofs(), libMesh::System::n_matrices(), libMesh::System::n_variable_groups(), libMesh::VariableGroup::n_variables(), libMesh::System::n_vectors(), libMesh::VariableGroup::name(), libMesh::System::name(), libMesh::System::number(), libMesh::FEType::order, libMesh::FEType::radial_family, libMesh::FEType::radial_order, libMesh::System::system_type(), libMesh::Variable::type(), libMesh::DofMap::variable_group(), and libMesh::System::variable_group().

1819 {
1820  std::ostringstream oss;
1821 
1822 
1823  const std::string & sys_name = this->name();
1824 
1825  oss << " System #" << this->number() << ", \"" << sys_name << "\"\n"
1826  << " Type \"" << this->system_type() << "\"\n"
1827  << " Variables=";
1828 
1829  for (auto vg : make_range(this->n_variable_groups()))
1830  {
1831  const VariableGroup & vg_description (this->variable_group(vg));
1832 
1833  if (vg_description.n_variables() > 1) oss << "{ ";
1834  for (auto vn : make_range(vg_description.n_variables()))
1835  oss << "\"" << vg_description.name(vn) << "\" ";
1836  if (vg_description.n_variables() > 1) oss << "} ";
1837  }
1838 
1839  oss << '\n';
1840 
1841  oss << " Finite Element Types=";
1842 #ifndef LIBMESH_ENABLE_INFINITE_ELEMENTS
1843  for (auto vg : make_range(this->n_variable_groups()))
1844  oss << "\""
1845  << Utility::enum_to_string<FEFamily>(this->get_dof_map().variable_group(vg).type().family)
1846  << "\" ";
1847 #else
1848  for (auto vg : make_range(this->n_variable_groups()))
1849  {
1850  oss << "\""
1851  << Utility::enum_to_string<FEFamily>(this->get_dof_map().variable_group(vg).type().family)
1852  << "\", \""
1853  << Utility::enum_to_string<FEFamily>(this->get_dof_map().variable_group(vg).type().radial_family)
1854  << "\" ";
1855  }
1856 
1857  oss << '\n' << " Infinite Element Mapping=";
1858  for (auto vg : make_range(this->n_variable_groups()))
1859  oss << "\""
1860  << Utility::enum_to_string<InfMapType>(this->get_dof_map().variable_group(vg).type().inf_map)
1861  << "\" ";
1862 #endif
1863 
1864  oss << '\n';
1865 
1866  oss << " Approximation Orders=";
1867  for (auto vg : make_range(this->n_variable_groups()))
1868  {
1869 #ifndef LIBMESH_ENABLE_INFINITE_ELEMENTS
1870  oss << "\""
1871  << Utility::enum_to_string<Order>(this->get_dof_map().variable_group(vg).type().order)
1872  << "\" ";
1873 #else
1874  oss << "\""
1875  << Utility::enum_to_string<Order>(this->get_dof_map().variable_group(vg).type().order)
1876  << "\", \""
1877  << Utility::enum_to_string<Order>(this->get_dof_map().variable_group(vg).type().radial_order)
1878  << "\" ";
1879 #endif
1880  }
1881 
1882  oss << '\n';
1883 
1884  oss << " n_dofs()=" << this->n_dofs() << '\n';
1885  dof_id_type local_dofs = this->n_local_dofs();
1886  oss << " n_local_dofs()=" << local_dofs << '\n';
1887  this->comm().max(local_dofs);
1888  oss << " max(n_local_dofs())=" << local_dofs << '\n';
1889 #ifdef LIBMESH_ENABLE_CONSTRAINTS
1890  oss << " n_constrained_dofs()=" << this->n_constrained_dofs() << '\n';
1891  oss << " n_local_constrained_dofs()=" << this->n_local_constrained_dofs() << '\n';
1892  dof_id_type local_unconstrained_dofs = this->n_local_dofs() - this->n_local_constrained_dofs();
1893  this->comm().max(local_unconstrained_dofs);
1894  oss << " max(local unconstrained dofs)=" << local_unconstrained_dofs << '\n';
1895 #endif
1896 
1897  oss << " " << "n_vectors()=" << this->n_vectors() << '\n';
1898  oss << " " << "n_matrices()=" << this->n_matrices() << '\n';
1899  // oss << " " << "n_additional_matrices()=" << this->n_additional_matrices() << '\n';
1900 
1901  oss << this->get_dof_map().get_info();
1902 
1903  return oss.str();
1904 }
FEFamily family
The type of finite element.
Definition: fe_type.h:221
OrderWrapper radial_order
The approximation order in radial direction of the infinite element.
Definition: fe_type.h:254
unsigned int n_variable_groups() const
Definition: system.C:2679
const Parallel::Communicator & comm() const
OrderWrapper order
The approximation order of the element.
Definition: fe_type.h:215
dof_id_type n_local_dofs() const
Definition: system.C:156
std::string get_info() const
Gets summary info about the sparsity bandwidth and constraints.
Definition: dof_map.C:2981
dof_id_type n_dofs() const
Definition: system.C:119
unsigned int number() const
Definition: system.h:2351
unsigned int n_vectors() const
Definition: system.h:2457
const VariableGroup & variable_group(const unsigned int c) const
Definition: dof_map.h:2346
InfMapType inf_map
The coordinate mapping type of the infinite element.
Definition: fe_type.h:275
unsigned int n_matrices() const
Definition: system.h:2598
FEFamily radial_family
The type of approximation in radial direction.
Definition: fe_type.h:267
virtual std::string system_type() const
Definition: system.h:509
void max(const T &r, T &o, Request &req) const
IntRange< T > make_range(T beg, T end)
The 2-parameter make_range() helper function returns an IntRange<T> when both input parameters are of...
Definition: int_range.h:140
dof_id_type n_local_constrained_dofs() const
Definition: system.C:141
const std::string & name() const
Definition: system.h:2343
const DofMap & get_dof_map() const
Definition: system.h:2375
const VariableGroup & variable_group(unsigned int vg) const
Return a constant reference to VariableGroup vg.
Definition: system.C:2689
dof_id_type n_constrained_dofs() const
Definition: system.C:126
uint8_t dof_id_type
Definition: id_types.h:67
const FEType & type() const
Definition: variable.h:144

◆ get_matrix() [1/2]

const SparseMatrix< Number > & libMesh::System::get_matrix ( std::string_view  mat_name) const
inherited
Returns
A const reference to this system's matrix named mat_name.

Definition at line 1109 of file system.C.

References libMesh::System::_matrices.

Referenced by add_M_C_K_helmholtz(), assemble(), assemble_helmholtz(), assemble_poisson(), libMesh::NewmarkSystem::compute_matrix(), libMesh::ImplicitSystem::get_system_matrix(), main(), libMesh::EigenTimeSolver::solve(), and libMesh::NewmarkSystem::update_rhs().

1110 {
1111  return *libmesh_map_find(_matrices, mat_name);
1112 }
std::map< std::string, std::unique_ptr< SparseMatrix< Number > >, std::less<> > _matrices
Some systems need an arbitrary number of matrices.
Definition: system.h:2254

◆ get_matrix() [2/2]

SparseMatrix< Number > & libMesh::System::get_matrix ( std::string_view  mat_name)
inherited
Returns
A writable reference to this system's matrix named mat_name.

Definition at line 1116 of file system.C.

References libMesh::System::_matrices.

1117 {
1118  return *libmesh_map_find(_matrices, mat_name);
1119 }
std::map< std::string, std::unique_ptr< SparseMatrix< Number > >, std::less<> > _matrices
Some systems need an arbitrary number of matrices.
Definition: system.h:2254

◆ get_matrix_A() [1/2]

const SparseMatrix< Number > & libMesh::EigenSystem::get_matrix_A ( ) const
Returns
A const reference to the system matrix used for standard eigenvalue problems.

This matrix should only be available (and therefore this should only be called) if !_use_shell_matrices.

Definition at line 333 of file eigen_system.C.

References _use_shell_matrices, has_matrix_A(), libMesh::libmesh_assert(), and matrix_A.

Referenced by libMesh::RBSCMConstruction::add_scaled_symm_Aq(), assemble_mass(), assemble_matrices(), and assemble_SchroedingerEquation().

334 {
338  return *matrix_A;
339 }
bool has_matrix_A() const
Definition: eigen_system.C:443
libmesh_assert(ctx)
SparseMatrix< Number > * matrix_A
The system matrix for standard eigenvalue problems.
Definition: eigen_system.h:313
bool _use_shell_matrices
A boolean flag to indicate whether or not to use shell matrices.
Definition: eigen_system.h:414

◆ get_matrix_A() [2/2]

SparseMatrix< Number > & libMesh::EigenSystem::get_matrix_A ( )
Returns
A reference to the system matrix used for standard eigenvalue problems.

This matrix should only be available (and therefore this should only be called) if !_use_shell_matrices.

Definition at line 342 of file eigen_system.C.

References _use_shell_matrices, has_matrix_A(), libMesh::libmesh_assert(), and matrix_A.

343 {
347  return *matrix_A;
348 }
bool has_matrix_A() const
Definition: eigen_system.C:443
libmesh_assert(ctx)
SparseMatrix< Number > * matrix_A
The system matrix for standard eigenvalue problems.
Definition: eigen_system.h:313
bool _use_shell_matrices
A boolean flag to indicate whether or not to use shell matrices.
Definition: eigen_system.h:414

◆ get_matrix_B() [1/2]

const SparseMatrix< Number > & libMesh::EigenSystem::get_matrix_B ( ) const
Returns
A const reference to the system matrix used for generalized eigenvalue problems

This matrix should only be available (and therefore this should only be called) if !_use_shell_matrices and generalized().

Definition at line 351 of file eigen_system.C.

References _use_shell_matrices, generalized(), has_matrix_B(), libMesh::libmesh_assert(), and matrix_B.

Referenced by assemble_mass(), assemble_matrices(), and assemble_SchroedingerEquation().

352 {
357  return *matrix_B;
358 }
bool generalized() const
Definition: eigen_system.C:325
SparseMatrix< Number > * matrix_B
A second system matrix for generalized eigenvalue problems.
Definition: eigen_system.h:321
bool has_matrix_B() const
Definition: eigen_system.C:450
libmesh_assert(ctx)
bool _use_shell_matrices
A boolean flag to indicate whether or not to use shell matrices.
Definition: eigen_system.h:414

◆ get_matrix_B() [2/2]

SparseMatrix< Number > & libMesh::EigenSystem::get_matrix_B ( )
Returns
A const reference to the system matrix used for generalized eigenvalue problems

This matrix should only be available (and therefore this should only be called) if !_use_shell_matrices and generalized().

Definition at line 361 of file eigen_system.C.

References _use_shell_matrices, generalized(), has_matrix_B(), libMesh::libmesh_assert(), and matrix_B.

362 {
367  return *matrix_B;
368 }
bool generalized() const
Definition: eigen_system.C:325
SparseMatrix< Number > * matrix_B
A second system matrix for generalized eigenvalue problems.
Definition: eigen_system.h:321
bool has_matrix_B() const
Definition: eigen_system.C:450
libmesh_assert(ctx)
bool _use_shell_matrices
A boolean flag to indicate whether or not to use shell matrices.
Definition: eigen_system.h:414

◆ get_mesh() [1/2]

const MeshBase & libMesh::System::get_mesh ( ) const
inlineinherited
Returns
A constant reference to this systems's _mesh.

Definition at line 2359 of file system.h.

References libMesh::System::_mesh.

Referenced by libMesh::ExactSolution::_compute_error(), LinearElasticityWithContact::add_contact_edge_elements(), libMesh::PetscDMWrapper::add_dofs_to_section(), libMesh::System::add_matrix(), libMesh::HPCoarsenTest::add_projection(), libMesh::RBConstruction::add_scaled_matrix_and_vector(), libMesh::DofMap::add_variables(), AssembleOptimization::assemble_A_and_F(), libMesh::ClawSystem::assemble_advection_matrices(), libMesh::ClawSystem::assemble_avg_coupling_matrices(), libMesh::ClawSystem::assemble_boundary_condition_matrices(), libMesh::ClawSystem::assemble_jump_coupling_matrix(), libMesh::ClawSystem::assemble_mass_matrix(), libMesh::FEMSystem::assemble_qoi(), libMesh::FEMSystem::assemble_qoi_derivative(), libMesh::FEMSystem::assembly(), libMesh::VariationalSmootherSystem::assembly(), AssemblyA0::boundary_assembly(), AssemblyA1::boundary_assembly(), AssemblyF0::boundary_assembly(), AssemblyF1::boundary_assembly(), AssemblyA2::boundary_assembly(), AssemblyF2::boundary_assembly(), libMesh::System::calculate_norm(), compute_jacobian(), libMesh::VariationalSmootherSystem::compute_mesh_quality_info(), compute_residual(), LinearElasticityWithContact::compute_stresses(), libMesh::VariationalSmootherConstraint::constrain(), libMesh::VariationalSmootherConstraint::constrain_node_to_line(), libMesh::VariationalSmootherConstraint::constrain_node_to_plane(), libMesh::System::create_static_condensation(), libMesh::ImplicitSystem::create_static_condensation_system_matrix(), libMesh::RBEIMEvaluation::distribute_bfs(), DMCreateDomainDecomposition_libMesh(), DMCreateFieldDecomposition_libMesh(), DMlibMeshSetSystem_libMesh(), SolidSystem::element_time_derivative(), HeatSystem::element_time_derivative(), libMesh::RBConstruction::enrich_basis_from_rhs_terms(), libMesh::RBEIMConstruction::enrich_eim_approximation_on_interiors(), libMesh::RBEIMConstruction::enrich_eim_approximation_on_sides(), libMesh::PatchRecoveryErrorEstimator::estimate_error(), libMesh::WeightedPatchRecoveryErrorEstimator::estimate_error(), libMesh::JumpErrorEstimator::estimate_error(), libMesh::AdjointResidualErrorEstimator::estimate_error(), libMesh::ExactErrorEstimator::estimate_error(), libMesh::SmoothnessEstimator::estimate_smoothness(), libMesh::GenericProjector< FFunctor, GFunctor, FValue, ProjectionAction >::SubFunctor::find_dofs_to_send(), libMesh::VariationalSmootherConstraint::fix_node(), libMesh::GenericProjector< FFunctor, GFunctor, FValue, ProjectionAction >::GenericProjector(), LinearElasticityWithContact::get_least_and_max_gap_function(), libMesh::SystemSubsetBySubdomain::init(), libMesh::RBEIMConstruction::init_context(), SolidSystem::init_data(), libMesh::VariationalSmootherSystem::init_data(), libMesh::System::init_data(), libMesh::System::init_matrices(), libMesh::PetscDMWrapper::init_petscdm(), LinearElasticityWithContact::initialize_contact_load_paths(), libMesh::RBEIMConstruction::initialize_qp_data(), libMesh::System::local_dof_indices(), libMesh::DofMap::max_constraint_error(), libMesh::FEMSystem::mesh_position_get(), libMesh::FEMSystem::mesh_position_set(), LinearElasticityWithContact::move_mesh(), libMesh::System::n_components(), libMesh::RBEIMEvaluation::node_distribute_bfs(), libMesh::WeightedPatchRecoveryErrorEstimator::EstimateError::operator()(), libMesh::SmoothnessEstimator::EstimateSmoothness::operator()(), libMesh::PatchRecoveryErrorEstimator::EstimateError::operator()(), libMesh::GenericProjector< FFunctor, GFunctor, FValue, ProjectionAction >::ProjectVertices::operator()(), libMesh::petsc_auto_fieldsplit(), libMesh::System::point_gradient(), libMesh::System::point_hessian(), libMesh::System::point_value(), libMesh::FEMSystem::postprocess(), libMesh::RBParametrizedFunction::preevaluate_parametrized_function_on_mesh(), libMesh::RBParametrizedFunction::preevaluate_parametrized_function_on_mesh_sides(), libMesh::VariationalSmootherSystem::prepare_for_smoothing(), libMesh::System::read_header(), libMesh::RBEvaluation::read_in_vectors_from_multiple_files(), libMesh::System::read_legacy_data(), libMesh::System::read_parallel_data(), libMesh::System::read_serialized_vector(), libMesh::System::read_serialized_vectors(), libMesh::System::reinit(), LinearElasticityWithContact::residual_and_jacobian(), OverlappingAlgebraicGhostingTest::run_ghosting_test(), OverlappingCouplingGhostingTest::run_sparsity_pattern_test(), SolidSystem::save_initial_mesh(), libMesh::HPSingularity::select_refinement(), libMesh::HPCoarsenTest::select_refinement(), libMesh::PetscDMWrapper::set_point_range_in_section(), libMesh::RBEIMEvaluation::side_distribute_bfs(), SolidSystem::side_time_derivative(), libMesh::PetscDiffSolver::solve(), libMesh::ClawSystem::solve_conservation_law(), MeshAssignTest::testMeshMoveAssign(), libMesh::MeshFunctionSolutionTransfer::transfer(), libMesh::BoundaryVolumeSolutionTransfer::transfer(), libMesh::BoundaryVolumeSolutionTransfer::transfer_boundary_volume(), libMesh::BoundaryVolumeSolutionTransfer::transfer_volume_boundary(), libMesh::TransientRBConstruction::truth_solve(), libMesh::RBConstruction::truth_solve(), libMesh::System::write_header(), libMesh::RBEvaluation::write_out_vectors(), libMesh::System::write_parallel_data(), libMesh::System::write_serialized_vector(), libMesh::System::write_serialized_vectors(), and libMesh::System::zero_variable().

2360 {
2361  return _mesh;
2362 }
MeshBase & _mesh
Constant reference to the mesh data structure used for the simulation.
Definition: system.h:2214

◆ get_mesh() [2/2]

MeshBase & libMesh::System::get_mesh ( )
inlineinherited
Returns
A reference to this systems's _mesh.

Definition at line 2367 of file system.h.

References libMesh::System::_mesh.

2368 {
2369  return _mesh;
2370 }
MeshBase & _mesh
Constant reference to the mesh data structure used for the simulation.
Definition: system.h:2214

◆ get_n_converged()

unsigned int libMesh::EigenSystem::get_n_converged ( ) const
inline
Returns
The number of converged eigenpairs.

Definition at line 130 of file eigen_system.h.

References _n_converged_eigenpairs.

Referenced by libMesh::RBSCMConstruction::compute_SCM_bounding_box(), libMesh::RBSCMConstruction::evaluate_stability_constant(), and main().

130 {return _n_converged_eigenpairs;}
unsigned int _n_converged_eigenpairs
The number of converged eigenpairs.
Definition: eigen_system.h:399

◆ get_n_iterations()

unsigned int libMesh::EigenSystem::get_n_iterations ( ) const
inline
Returns
The number of eigen solver iterations.

Definition at line 135 of file eigen_system.h.

References _n_iterations.

135 {return _n_iterations;}
unsigned int _n_iterations
The number of iterations of the eigen solver algorithm.
Definition: eigen_system.h:404

◆ get_precond_matrix() [1/2]

const SparseMatrix< Number > & libMesh::EigenSystem::get_precond_matrix ( ) const
Returns
A const reference to the preconditioning matrix.

This matrix should only be available (and therefore this should only be called) if !_use_shell_matrices.

Definition at line 371 of file eigen_system.C.

References _use_shell_matrices, _use_shell_precond_matrix, has_precond_matrix(), libMesh::libmesh_assert(), and precond_matrix.

372 {
377  return *precond_matrix;
378 }
SparseMatrix< Number > * precond_matrix
A preconditioning matrix.
Definition: eigen_system.h:345
bool has_precond_matrix() const
Definition: eigen_system.C:457
bool _use_shell_precond_matrix
A boolean flag to indicate whether or not to use a shell preconditioning matrix.
Definition: eigen_system.h:419
libmesh_assert(ctx)
bool _use_shell_matrices
A boolean flag to indicate whether or not to use shell matrices.
Definition: eigen_system.h:414

◆ get_precond_matrix() [2/2]

SparseMatrix< Number > & libMesh::EigenSystem::get_precond_matrix ( )
Returns
A reference to the preconditioning matrix.

This matrix should only be available (and therefore this should only be called) if !_use_shell_matrices.

Definition at line 381 of file eigen_system.C.

References _use_shell_matrices, _use_shell_precond_matrix, has_precond_matrix(), libMesh::libmesh_assert(), and precond_matrix.

382 {
387  return *precond_matrix;
388 }
SparseMatrix< Number > * precond_matrix
A preconditioning matrix.
Definition: eigen_system.h:345
bool has_precond_matrix() const
Definition: eigen_system.C:457
bool _use_shell_precond_matrix
A boolean flag to indicate whether or not to use a shell preconditioning matrix.
Definition: eigen_system.h:419
libmesh_assert(ctx)
bool _use_shell_matrices
A boolean flag to indicate whether or not to use shell matrices.
Definition: eigen_system.h:414

◆ get_project_with_constraints()

bool libMesh::System::get_project_with_constraints ( )
inlineinherited

Setter and getter functions for project_with_constraints boolean.

Definition at line 1818 of file system.h.

References libMesh::System::project_with_constraints.

Referenced by libMesh::AdjointRefinementEstimator::estimate_error().

1819  {
1820  return project_with_constraints;
1821  }
bool project_with_constraints
Do we want to apply constraints while projecting vectors ?
Definition: system.h:2320

◆ get_qoi_error_estimate_value()

Number libMesh::System::get_qoi_error_estimate_value ( unsigned int  qoi_index) const
inherited

Definition at line 2191 of file system.C.

References libMesh::libmesh_assert(), and libMesh::System::qoi_error_estimates.

Referenced by libMesh::TwostepTimeSolver::integrate_adjoint_refinement_error_estimate(), and main().

2192 {
2193  libmesh_assert(qoi_index < qoi_error_estimates.size());
2194  return qoi_error_estimates[qoi_index];
2195 }
libmesh_assert(ctx)
std::vector< Number > qoi_error_estimates
Vector to hold error estimates for qois, either from a steady state calculation, or from a single uns...
Definition: system.h:1662

◆ get_qoi_value()

Number libMesh::System::get_qoi_value ( unsigned int  qoi_index) const
inherited

◆ get_qoi_values()

std::vector< Number > libMesh::System::get_qoi_values ( ) const
inherited

Returns a copy of qoi, not a reference.

Definition at line 2171 of file system.C.

References libMesh::System::qoi.

Referenced by libMesh::ImplicitSystem::adjoint_qoi_parameter_sensitivity(), libMesh::FEMSystem::assemble_qoi(), libMesh::ImplicitSystem::forward_qoi_parameter_sensitivity(), libMesh::ImplicitSystem::qoi_parameter_hessian(), and libMesh::ImplicitSystem::qoi_parameter_hessian_vector_product().

2172 {
2173  return this->qoi;
2174 }
std::vector< Number > qoi
Values of the quantities of interest.
Definition: system.h:1654

◆ get_sensitivity_rhs() [1/2]

NumericVector< Number > & libMesh::System::get_sensitivity_rhs ( unsigned int  i = 0)
inherited
Returns
A reference to one of the system's sensitivity rhs vectors, by default the one corresponding to the first parameter. By default these vectors are built by the library, using finite differences, when assemble_residual_derivatives() is called.

When assembled, this vector should hold -(partial R / partial p_i)

Definition at line 1322 of file system.C.

References libMesh::System::get_vector().

Referenced by libMesh::ImplicitSystem::adjoint_qoi_parameter_sensitivity(), and libMesh::ImplicitSystem::sensitivity_solve().

1323 {
1324  std::ostringstream sensitivity_rhs_name;
1325  sensitivity_rhs_name << "sensitivity_rhs" << i;
1326 
1327  return this->get_vector(sensitivity_rhs_name.str());
1328 }
const NumericVector< Number > & get_vector(std::string_view vec_name) const
Definition: system.C:928

◆ get_sensitivity_rhs() [2/2]

const NumericVector< Number > & libMesh::System::get_sensitivity_rhs ( unsigned int  i = 0) const
inherited
Returns
A reference to one of the system's sensitivity rhs vectors, by default the one corresponding to the first parameter.

Definition at line 1332 of file system.C.

References libMesh::System::get_vector().

1333 {
1334  std::ostringstream sensitivity_rhs_name;
1335  sensitivity_rhs_name << "sensitivity_rhs" << i;
1336 
1337  return this->get_vector(sensitivity_rhs_name.str());
1338 }
const NumericVector< Number > & get_vector(std::string_view vec_name) const
Definition: system.C:928

◆ get_sensitivity_solution() [1/2]

NumericVector< Number > & libMesh::System::get_sensitivity_solution ( unsigned int  i = 0)
inherited
Returns
A reference to one of the system's solution sensitivity vectors, by default the one corresponding to the first parameter.

Definition at line 1177 of file system.C.

References libMesh::System::get_vector().

Referenced by libMesh::ImplicitSystem::forward_qoi_parameter_sensitivity(), libMesh::ImplicitSystem::qoi_parameter_hessian(), and libMesh::ImplicitSystem::sensitivity_solve().

1178 {
1179  std::ostringstream sensitivity_name;
1180  sensitivity_name << "sensitivity_solution" << i;
1181 
1182  return this->get_vector(sensitivity_name.str());
1183 }
const NumericVector< Number > & get_vector(std::string_view vec_name) const
Definition: system.C:928

◆ get_sensitivity_solution() [2/2]

const NumericVector< Number > & libMesh::System::get_sensitivity_solution ( unsigned int  i = 0) const
inherited
Returns
A reference to one of the system's solution sensitivity vectors, by default the one corresponding to the first parameter.

Definition at line 1187 of file system.C.

References libMesh::System::get_vector().

1188 {
1189  std::ostringstream sensitivity_name;
1190  sensitivity_name << "sensitivity_solution" << i;
1191 
1192  return this->get_vector(sensitivity_name.str());
1193 }
const NumericVector< Number > & get_vector(std::string_view vec_name) const
Definition: system.C:928

◆ get_shell_matrix_A() [1/2]

const ShellMatrix< Number > & libMesh::EigenSystem::get_shell_matrix_A ( ) const
Returns
A const reference to the system shell matrix used for standard eigenvalue problems.

This matrix should only be available (and therefore this should only be called) if _use_shell_matrices.

Definition at line 391 of file eigen_system.C.

References _use_shell_matrices, has_shell_matrix_A(), libMesh::libmesh_assert(), and shell_matrix_A.

392 {
395  return *shell_matrix_A;
396 }
bool has_shell_matrix_A() const
Definition: eigen_system.C:464
std::unique_ptr< ShellMatrix< Number > > shell_matrix_A
The system shell matrix for standard eigenvalue problems.
Definition: eigen_system.h:329
libmesh_assert(ctx)
bool _use_shell_matrices
A boolean flag to indicate whether or not to use shell matrices.
Definition: eigen_system.h:414

◆ get_shell_matrix_A() [2/2]

ShellMatrix< Number > & libMesh::EigenSystem::get_shell_matrix_A ( )
Returns
A reference to the system shell matrix used for standard eigenvalue problems.

This matrix should only be available (and therefore this should only be called) if _use_shell_matrices.

Definition at line 399 of file eigen_system.C.

References _use_shell_matrices, has_shell_matrix_A(), libMesh::libmesh_assert(), and shell_matrix_A.

400 {
403  return *shell_matrix_A;
404 }
bool has_shell_matrix_A() const
Definition: eigen_system.C:464
std::unique_ptr< ShellMatrix< Number > > shell_matrix_A
The system shell matrix for standard eigenvalue problems.
Definition: eigen_system.h:329
libmesh_assert(ctx)
bool _use_shell_matrices
A boolean flag to indicate whether or not to use shell matrices.
Definition: eigen_system.h:414

◆ get_shell_matrix_B() [1/2]

const ShellMatrix< Number > & libMesh::EigenSystem::get_shell_matrix_B ( ) const
Returns
A const reference to the system shell matrix used for generalized eigenvalue problems.

This matrix should only be available (and therefore this should only be called) if _use_shell_matrices and generalized().

Definition at line 407 of file eigen_system.C.

References _use_shell_matrices, generalized(), has_shell_matrix_B(), libMesh::libmesh_assert(), and shell_matrix_B.

408 {
412  return *shell_matrix_B;
413 }
bool generalized() const
Definition: eigen_system.C:325
std::unique_ptr< ShellMatrix< Number > > shell_matrix_B
A second system shell matrix for generalized eigenvalue problems.
Definition: eigen_system.h:337
libmesh_assert(ctx)
bool has_shell_matrix_B() const
Definition: eigen_system.C:470
bool _use_shell_matrices
A boolean flag to indicate whether or not to use shell matrices.
Definition: eigen_system.h:414

◆ get_shell_matrix_B() [2/2]

ShellMatrix< Number > & libMesh::EigenSystem::get_shell_matrix_B ( )
Returns
A reference to the system shell matrix used for generalized eigenvalue problems.

This matrix should only be available (and therefore this should only be called) if _use_shell_matrices and generalized().

Definition at line 416 of file eigen_system.C.

References _use_shell_matrices, generalized(), has_shell_matrix_B(), libMesh::libmesh_assert(), and shell_matrix_B.

417 {
421  return *shell_matrix_B;
422 }
bool generalized() const
Definition: eigen_system.C:325
std::unique_ptr< ShellMatrix< Number > > shell_matrix_B
A second system shell matrix for generalized eigenvalue problems.
Definition: eigen_system.h:337
libmesh_assert(ctx)
bool has_shell_matrix_B() const
Definition: eigen_system.C:470
bool _use_shell_matrices
A boolean flag to indicate whether or not to use shell matrices.
Definition: eigen_system.h:414

◆ get_shell_precond_matrix() [1/2]

const ShellMatrix< Number > & libMesh::EigenSystem::get_shell_precond_matrix ( ) const
Returns
A const reference to the system shell matrix used for preconditioning.

Definition at line 425 of file eigen_system.C.

References _use_shell_matrices, _use_shell_precond_matrix, has_shell_precond_matrix(), libMesh::libmesh_assert(), and shell_precond_matrix.

426 {
430  return *shell_precond_matrix;
431 }
std::unique_ptr< ShellMatrix< Number > > shell_precond_matrix
A preconditioning shell matrix.
Definition: eigen_system.h:353
bool _use_shell_precond_matrix
A boolean flag to indicate whether or not to use a shell preconditioning matrix.
Definition: eigen_system.h:419
libmesh_assert(ctx)
bool has_shell_precond_matrix() const
Definition: eigen_system.C:476
bool _use_shell_matrices
A boolean flag to indicate whether or not to use shell matrices.
Definition: eigen_system.h:414

◆ get_shell_precond_matrix() [2/2]

ShellMatrix< Number > & libMesh::EigenSystem::get_shell_precond_matrix ( )
Returns
A reference to the system shell matrix used for preconditioning.

Definition at line 434 of file eigen_system.C.

References _use_shell_matrices, _use_shell_precond_matrix, has_shell_precond_matrix(), libMesh::libmesh_assert(), and shell_precond_matrix.

435 {
439  return *shell_precond_matrix;
440 }
std::unique_ptr< ShellMatrix< Number > > shell_precond_matrix
A preconditioning shell matrix.
Definition: eigen_system.h:353
bool _use_shell_precond_matrix
A boolean flag to indicate whether or not to use a shell preconditioning matrix.
Definition: eigen_system.h:419
libmesh_assert(ctx)
bool has_shell_precond_matrix() const
Definition: eigen_system.C:476
bool _use_shell_matrices
A boolean flag to indicate whether or not to use shell matrices.
Definition: eigen_system.h:414

◆ get_vector() [1/4]

const NumericVector< Number > & libMesh::System::get_vector ( std::string_view  vec_name) const
inherited
Returns
A const reference to this system's additional vector named vec_name. Access is only granted when the vector is already properly initialized.

Definition at line 928 of file system.C.

References libMesh::System::_vectors.

Referenced by libMesh::UniformRefinementEstimator::_estimate_error(), add_M_C_K_helmholtz(), libMesh::AdaptiveTimeSolver::adjoint_advance_timestep(), libMesh::UnsteadySolver::adjoint_advance_timestep(), libMesh::NewmarkSolver::advance_timestep(), libMesh::AdaptiveTimeSolver::advance_timestep(), libMesh::UnsteadySolver::advance_timestep(), apply_initial(), assemble(), libMesh::System::compare(), libMesh::NewmarkSolver::compute_initial_accel(), libMesh::UnsteadySolver::du(), libMesh::AdjointRefinementEstimator::estimate_error(), libMesh::System::get_adjoint_rhs(), libMesh::System::get_adjoint_solution(), libMesh::System::get_sensitivity_rhs(), libMesh::System::get_sensitivity_solution(), libMesh::System::get_weighted_sensitivity_adjoint_solution(), libMesh::System::get_weighted_sensitivity_solution(), libMesh::NewmarkSystem::initial_conditions(), AssembleOptimization::lower_and_upper_bounds(), main(), libMesh::NewmarkSolver::project_initial_accel(), libMesh::SecondOrderUnsteadySolver::project_initial_rate(), libMesh::InterMeshProjection::project_system_vectors(), libMesh::SecondOrderUnsteadySolver::reinit(), libMesh::UnsteadySolver::reinit(), libMesh::FileSolutionHistory::retrieve(), libMesh::UnsteadySolver::retrieve_timestep(), libMesh::MemoryHistoryData::retrieve_vectors(), libMesh::TwostepTimeSolver::solve(), libMesh::FrequencySystem::solve(), libMesh::UnsteadySolver::update(), libMesh::NewmarkSystem::update_rhs(), and libMesh::NewmarkSystem::update_u_v_a().

929 {
930  return *(libmesh_map_find(_vectors, vec_name));
931 }
std::map< std::string, std::unique_ptr< NumericVector< Number > >, std::less<> > _vectors
Some systems need an arbitrary number of vectors.
Definition: system.h:2237

◆ get_vector() [2/4]

NumericVector< Number > & libMesh::System::get_vector ( std::string_view  vec_name)
inherited
Returns
A writable reference to this system's additional vector named vec_name. Access is only granted when the vector is already properly initialized.

Definition at line 935 of file system.C.

References libMesh::System::_vectors.

936 {
937  return *(libmesh_map_find(_vectors, vec_name));
938 }
std::map< std::string, std::unique_ptr< NumericVector< Number > >, std::less<> > _vectors
Some systems need an arbitrary number of vectors.
Definition: system.h:2237

◆ get_vector() [3/4]

const NumericVector< Number > & libMesh::System::get_vector ( const unsigned int  vec_num) const
inherited
Returns
A const reference to this system's additional vector number vec_num (where the vectors are counted starting with 0).

Definition at line 942 of file system.C.

References libMesh::System::_vectors, and libMesh::System::vectors_begin().

943 {
944  // If we don't have that many vectors, throw an error
945  libmesh_assert_less(vec_num, _vectors.size());
946 
947  // Otherwise return a reference to the vec_num'th vector
948  auto it = vectors_begin();
949  std::advance(it, vec_num);
950  return *(it->second);
951 }
std::map< std::string, std::unique_ptr< NumericVector< Number > >, std::less<> > _vectors
Some systems need an arbitrary number of vectors.
Definition: system.h:2237
vectors_iterator vectors_begin()
Beginning of vectors container.
Definition: system.h:2463

◆ get_vector() [4/4]

NumericVector< Number > & libMesh::System::get_vector ( const unsigned int  vec_num)
inherited
Returns
A writable reference to this system's additional vector number vec_num (where the vectors are counted starting with 0).

Definition at line 955 of file system.C.

References libMesh::System::_vectors, and libMesh::System::vectors_begin().

956 {
957  // If we don't have that many vectors, throw an error
958  libmesh_assert_less(vec_num, _vectors.size());
959 
960  // Otherwise return a reference to the vec_num'th vector
961  auto it = vectors_begin();
962  std::advance(it, vec_num);
963  return *(it->second);
964 }
std::map< std::string, std::unique_ptr< NumericVector< Number > >, std::less<> > _vectors
Some systems need an arbitrary number of vectors.
Definition: system.h:2237
vectors_iterator vectors_begin()
Beginning of vectors container.
Definition: system.h:2463

◆ get_weighted_sensitivity_adjoint_solution() [1/2]

NumericVector< Number > & libMesh::System::get_weighted_sensitivity_adjoint_solution ( unsigned int  i = 0)
inherited
Returns
A reference to one of the system's weighted sensitivity adjoint solution vectors, by default the one corresponding to the first qoi.

Definition at line 1262 of file system.C.

References libMesh::System::get_vector().

Referenced by libMesh::ImplicitSystem::qoi_parameter_hessian_vector_product(), and libMesh::ImplicitSystem::weighted_sensitivity_adjoint_solve().

1263 {
1264  std::ostringstream adjoint_name;
1265  adjoint_name << "weighted_sensitivity_adjoint_solution" << i;
1266 
1267  return this->get_vector(adjoint_name.str());
1268 }
const NumericVector< Number > & get_vector(std::string_view vec_name) const
Definition: system.C:928

◆ get_weighted_sensitivity_adjoint_solution() [2/2]

const NumericVector< Number > & libMesh::System::get_weighted_sensitivity_adjoint_solution ( unsigned int  i = 0) const
inherited
Returns
A reference to one of the system's weighted sensitivity adjoint solution vectors, by default the one corresponding to the first qoi.

Definition at line 1272 of file system.C.

References libMesh::System::get_vector().

1273 {
1274  std::ostringstream adjoint_name;
1275  adjoint_name << "weighted_sensitivity_adjoint_solution" << i;
1276 
1277  return this->get_vector(adjoint_name.str());
1278 }
const NumericVector< Number > & get_vector(std::string_view vec_name) const
Definition: system.C:928

◆ get_weighted_sensitivity_solution() [1/2]

NumericVector< Number > & libMesh::System::get_weighted_sensitivity_solution ( )
inherited
Returns
A reference to the solution of the last weighted sensitivity solve

Definition at line 1204 of file system.C.

References libMesh::System::get_vector().

Referenced by libMesh::ImplicitSystem::qoi_parameter_hessian_vector_product(), and libMesh::ImplicitSystem::weighted_sensitivity_solve().

1205 {
1206  return this->get_vector("weighted_sensitivity_solution");
1207 }
const NumericVector< Number > & get_vector(std::string_view vec_name) const
Definition: system.C:928

◆ get_weighted_sensitivity_solution() [2/2]

const NumericVector< Number > & libMesh::System::get_weighted_sensitivity_solution ( ) const
inherited
Returns
A reference to the solution of the last weighted sensitivity solve

Definition at line 1211 of file system.C.

References libMesh::System::get_vector().

1212 {
1213  return this->get_vector("weighted_sensitivity_solution");
1214 }
const NumericVector< Number > & get_vector(std::string_view vec_name) const
Definition: system.C:928

◆ has_constraint_object()

bool libMesh::System::has_constraint_object ( ) const
inherited
Returns
true if there is a user-defined constraint object attached to this object, false otherwise. Calling System:: get_constraint_object() when there is no user-defined constraint object attached leads to either undefined behavior (dereferencing a nullptr) or an assert (in dbg mode) so you should call this function first unless you are sure there is a user-defined constraint object attached.

Definition at line 1999 of file system.C.

References libMesh::System::_constrain_system_object.

2000 {
2001  return _constrain_system_object != nullptr;
2002 }
Constraint * _constrain_system_object
Object that constrains the system.
Definition: system.h:2170

◆ has_matrix_A()

bool libMesh::EigenSystem::has_matrix_A ( ) const
Returns
Whether or not the system has matrix A

Definition at line 443 of file eigen_system.C.

References matrix_A, and libMesh::System::request_matrix().

Referenced by get_matrix_A().

444 {
445  libmesh_assert_equal_to(request_matrix("Eigen Matrix A"), matrix_A);
446  return matrix_A;
447 }
const SparseMatrix< Number > * request_matrix(std::string_view mat_name) const
Definition: system.C:1085
SparseMatrix< Number > * matrix_A
The system matrix for standard eigenvalue problems.
Definition: eigen_system.h:313

◆ has_matrix_B()

bool libMesh::EigenSystem::has_matrix_B ( ) const
Returns
Whether or not the system has matrix B

Definition at line 450 of file eigen_system.C.

References matrix_B, and libMesh::System::request_matrix().

Referenced by get_matrix_B().

451 {
452  libmesh_assert_equal_to(request_matrix("Eigen Matrix B"), matrix_B);
453  return matrix_B;
454 }
SparseMatrix< Number > * matrix_B
A second system matrix for generalized eigenvalue problems.
Definition: eigen_system.h:321
const SparseMatrix< Number > * request_matrix(std::string_view mat_name) const
Definition: system.C:1085

◆ has_precond_matrix()

bool libMesh::EigenSystem::has_precond_matrix ( ) const
Returns
Whether or not the system has the non-shell preconditioning matrix

Definition at line 457 of file eigen_system.C.

References precond_matrix, and libMesh::System::request_matrix().

Referenced by get_precond_matrix().

458 {
459  libmesh_assert_equal_to(request_matrix("Eigen Preconditioner"), precond_matrix);
460  return precond_matrix;
461 }
const SparseMatrix< Number > * request_matrix(std::string_view mat_name) const
Definition: system.C:1085
SparseMatrix< Number > * precond_matrix
A preconditioning matrix.
Definition: eigen_system.h:345

◆ has_shell_matrix_A()

bool libMesh::EigenSystem::has_shell_matrix_A ( ) const
Returns
Whether or not the system has the shell matrix A

Definition at line 464 of file eigen_system.C.

References shell_matrix_A.

Referenced by get_shell_matrix_A().

465 {
466  return shell_matrix_A.get();
467 }
std::unique_ptr< ShellMatrix< Number > > shell_matrix_A
The system shell matrix for standard eigenvalue problems.
Definition: eigen_system.h:329

◆ has_shell_matrix_B()

bool libMesh::EigenSystem::has_shell_matrix_B ( ) const
Returns
Whether or not the system has the shell matrix B

Definition at line 470 of file eigen_system.C.

References shell_matrix_B.

Referenced by get_shell_matrix_B().

471 {
472  return shell_matrix_B.get();
473 }
std::unique_ptr< ShellMatrix< Number > > shell_matrix_B
A second system shell matrix for generalized eigenvalue problems.
Definition: eigen_system.h:337

◆ has_shell_precond_matrix()

bool libMesh::EigenSystem::has_shell_precond_matrix ( ) const
Returns
Whether or not the system has the shell preconditioning matrix

Definition at line 476 of file eigen_system.C.

References shell_precond_matrix.

Referenced by get_shell_precond_matrix().

477 {
478  return shell_precond_matrix.get();
479 }
std::unique_ptr< ShellMatrix< Number > > shell_precond_matrix
A preconditioning shell matrix.
Definition: eigen_system.h:353

◆ has_static_condensation()

bool libMesh::System::has_static_condensation ( ) const
inherited
Returns
Whether this system will be statically condensed

Definition at line 2649 of file system.C.

References libMesh::System::get_dof_map(), and libMesh::DofMap::has_static_condensation().

Referenced by libMesh::System::add_matrix(), assemble_poisson(), libMesh::ImplicitSystem::ImplicitSystem(), libMesh::LinearImplicitSystem::LinearImplicitSystem(), and libMesh::NonlinearImplicitSystem::NonlinearImplicitSystem().

2650 {
2651  return this->get_dof_map().has_static_condensation();
2652 }
bool has_static_condensation() const
Checks whether we have static condensation.
Definition: dof_map.h:1796
const DofMap & get_dof_map() const
Definition: system.h:2375

◆ has_variable()

bool libMesh::System::has_variable ( std::string_view  var) const
inherited
Returns
true if a variable named var exists in this System

Definition at line 1389 of file system.C.

References libMesh::System::get_dof_map(), and libMesh::DofMap::has_variable().

Referenced by libMesh::GMVIO::copy_nodal_solution(), and main().

1390 {
1391  return this->get_dof_map().has_variable(var);
1392 }
bool has_variable(std::string_view var) const
Definition: dof_map.h:2975
const DofMap & get_dof_map() const
Definition: system.h:2375

◆ have_matrix()

bool libMesh::System::have_matrix ( std::string_view  mat_name) const
inlineinherited
Returns
true if this System has a matrix associated with the given name, false otherwise.

Definition at line 1914 of file system.h.

References libMesh::System::_matrices.

Referenced by libMesh::EigenTimeSolver::init().

1914 { return _matrices.count(mat_name); }
std::map< std::string, std::unique_ptr< SparseMatrix< Number > >, std::less<> > _matrices
Some systems need an arbitrary number of matrices.
Definition: system.h:2254

◆ have_vector()

bool libMesh::System::have_vector ( std::string_view  vec_name) const
inlineinherited
Returns
true if this System has a vector associated with the given name, false otherwise.

Definition at line 2449 of file system.h.

References libMesh::System::_vectors.

2450 {
2451  return (_vectors.count(vec_name));
2452 }
std::map< std::string, std::unique_ptr< NumericVector< Number > >, std::less<> > _vectors
Some systems need an arbitrary number of vectors.
Definition: system.h:2237

◆ hide_output()

bool& libMesh::System::hide_output ( )
inlineinherited
Returns
A writable reference to a boolean that determines if this system can be written to file or not. If set to true, then EquationSystems::write will ignore this system.

Definition at line 1833 of file system.h.

References libMesh::System::_hide_output.

1833 { return _hide_output; }
bool _hide_output
Are we allowed to write this system to file? If _hide_output is true, then EquationSystems::write wil...
Definition: system.h:2315

◆ identify_variable_groups() [1/2]

bool libMesh::System::identify_variable_groups ( ) const
inherited
Returns
true when VariableGroup structures should be automatically identified, false otherwise.

Definition at line 2664 of file system.C.

References libMesh::System::get_dof_map(), and libMesh::DofMap::identify_variable_groups().

2665 {
2666  return this->get_dof_map().identify_variable_groups();
2667 }
bool identify_variable_groups() const
Definition: dof_map.h:2940
const DofMap & get_dof_map() const
Definition: system.h:2375

◆ identify_variable_groups() [2/2]

void libMesh::System::identify_variable_groups ( const bool  ivg)
inherited

Toggle automatic VariableGroup identification.

Definition at line 2669 of file system.C.

References libMesh::System::get_dof_map(), and libMesh::DofMap::identify_variable_groups().

2670 {
2672 }
bool identify_variable_groups() const
Definition: dof_map.h:2940
const DofMap & get_dof_map() const
Definition: system.h:2375

◆ increment_constructor_count()

void libMesh::ReferenceCounter::increment_constructor_count ( const std::string &  name)
inlineprotectednoexceptinherited

Increments the construction counter.

Should be called in the constructor of any derived class that will be reference counted.

Definition at line 183 of file reference_counter.h.

References libMesh::err, libMesh::BasicOStreamProxy< charT, traits >::get(), libMesh::Quality::name(), and libMesh::Threads::spin_mtx.

Referenced by libMesh::ReferenceCountedObject< RBParametrized >::ReferenceCountedObject().

184 {
185  libmesh_try
186  {
187  Threads::spin_mutex::scoped_lock lock(Threads::spin_mtx);
188  std::pair<unsigned int, unsigned int> & p = _counts[name];
189  p.first++;
190  }
191  libmesh_catch (...)
192  {
193  auto stream = libMesh::err.get();
194  stream->exceptions(stream->goodbit); // stream must not throw
195  libMesh::err << "Encountered unrecoverable error while calling "
196  << "ReferenceCounter::increment_constructor_count() "
197  << "for a(n) " << name << " object." << std::endl;
198  std::terminate();
199  }
200 }
std::string name(const ElemQuality q)
This function returns a string containing some name for q.
Definition: elem_quality.C:42
OStreamProxy err
static Counts _counts
Actually holds the data.
streamT * get()
Rather than implement every ostream/ios/ios_base function, we&#39;ll be lazy and make esoteric uses go th...
spin_mutex spin_mtx
A convenient spin mutex object which can be used for obtaining locks.
Definition: threads.C:30

◆ increment_destructor_count()

void libMesh::ReferenceCounter::increment_destructor_count ( const std::string &  name)
inlineprotectednoexceptinherited

Increments the destruction counter.

Should be called in the destructor of any derived class that will be reference counted.

Definition at line 207 of file reference_counter.h.

References libMesh::err, libMesh::BasicOStreamProxy< charT, traits >::get(), libMesh::Quality::name(), and libMesh::Threads::spin_mtx.

Referenced by libMesh::ReferenceCountedObject< RBParametrized >::~ReferenceCountedObject().

208 {
209  libmesh_try
210  {
211  Threads::spin_mutex::scoped_lock lock(Threads::spin_mtx);
212  std::pair<unsigned int, unsigned int> & p = _counts[name];
213  p.second++;
214  }
215  libmesh_catch (...)
216  {
217  auto stream = libMesh::err.get();
218  stream->exceptions(stream->goodbit); // stream must not throw
219  libMesh::err << "Encountered unrecoverable error while calling "
220  << "ReferenceCounter::increment_destructor_count() "
221  << "for a(n) " << name << " object." << std::endl;
222  std::terminate();
223  }
224 }
std::string name(const ElemQuality q)
This function returns a string containing some name for q.
Definition: elem_quality.C:42
OStreamProxy err
static Counts _counts
Actually holds the data.
streamT * get()
Rather than implement every ostream/ios/ios_base function, we&#39;ll be lazy and make esoteric uses go th...
spin_mutex spin_mtx
A convenient spin mutex object which can be used for obtaining locks.
Definition: threads.C:30

◆ init()

void libMesh::System::init ( )
inherited

Initializes degrees of freedom on the current mesh.

Sets the

Definition at line 193 of file system.C.

References libMesh::System::is_initialized(), libMesh::libmesh_assert(), and libMesh::System::reinit_mesh().

Referenced by libMesh::StaticCondensationDofMap::reinit().

194 {
195  // Calling init() twice on the same system currently works evil
196  // magic, whether done directly or via EquationSystems::read()
197  libmesh_assert(!this->is_initialized());
198 
199  this->reinit_mesh();
200 }
bool is_initialized() const
Definition: system.h:2415
libmesh_assert(ctx)
virtual void reinit_mesh()
Reinitializes the system with a new mesh.
Definition: system.C:286

◆ init_data()

void libMesh::System::init_data ( )
protectedvirtualinherited

Initializes the data for the system.

Note
This is called before any user-supplied initialization function so that all required storage will be available.

Reimplemented in libMesh::DifferentiableSystem, libMesh::ContinuationSystem, libMesh::FEMSystem, libMesh::OptimizationSystem, libMesh::RBConstructionBase< LinearImplicitSystem >, libMesh::RBConstructionBase< System >, libMesh::RBConstructionBase< CondensedEigenSystem >, libMesh::FrequencySystem, SecondOrderScalarSystemSecondOrderTimeSolverBase, libMesh::ClawSystem, libMesh::VariationalSmootherSystem, SimpleRBConstruction, FirstOrderScalarSystemBase, SimpleRBConstruction, SimpleRBConstruction, SimpleRBConstruction, SimpleRBConstruction, libMesh::LinearImplicitSystem, HeatSystem, SimpleRBConstruction, libMesh::AdvectionSystem, HilbertSystem, ElasticityRBConstruction, CoupledSystem, SimpleEIMConstruction, SimpleEIMConstruction, ElasticitySystem, ElasticitySystem, HeatSystem, LaplaceSystem, CurlCurlSystem, LaplaceSystem, PoissonSystem, LaplaceSystem, LaplaceSystem, CurlCurlSystem, SolidSystem, NavierSystem, and HeatSystem.

Definition at line 204 of file system.C.

References libMesh::System::_basic_system_only, libMesh::System::_dof_map, libMesh::System::_is_initialized, libMesh::System::_matrices, libMesh::System::_vectors, libMesh::System::add_matrices(), libMesh::System::current_local_solution, libMesh::System::get_mesh(), libMesh::GHOSTED, libMesh::System::init_matrices(), libMesh::libmesh_ignore(), mesh, libMesh::System::n_dofs(), libMesh::System::n_local_dofs(), libMesh::PARALLEL, libMesh::System::reinit_constraints(), libMesh::SERIAL, and libMesh::System::solution.

Referenced by libMesh::LinearImplicitSystem::init_data(), libMesh::OptimizationSystem::init_data(), libMesh::DifferentiableSystem::init_data(), and libMesh::System::reinit_mesh().

205 {
206  parallel_object_only();
207 
208  MeshBase & mesh = this->get_mesh();
209 
210  // Distribute the degrees of freedom on the mesh
211  auto total_dofs = _dof_map->distribute_dofs (mesh);
212 
213  // Throw an error if the total number of DOFs is not capable of
214  // being indexed by our solution vector.
215  auto max_allowed_id = solution->max_allowed_id();
216  libmesh_error_msg_if(total_dofs > max_allowed_id,
217  "Cannot allocate a NumericVector with " << total_dofs << " degrees of freedom. "
218  "The vector can only index up to " << max_allowed_id << " entries.");
219 
220  // Recreate any user or internal constraints
221  this->reinit_constraints();
222 
223  // Even if there weren't any constraint changes,
224  // reinit_constraints() did prepare_send_list() for us.
225 
226  // Now finally after dof distribution and construction of any
227  // possible constraints, we may init any static condensation
228  // data
229  _dof_map->reinit_static_condensation();
230 
231  // Resize the solution conformal to the current mesh
232  solution->init (this->n_dofs(), this->n_local_dofs(), false, PARALLEL);
233 
234  // Resize the current_local_solution for the current mesh
235 #ifdef LIBMESH_ENABLE_GHOSTED
236  current_local_solution->init (this->n_dofs(), this->n_local_dofs(),
237  _dof_map->get_send_list(), /*fast=*/false,
238  GHOSTED);
239 #else
240  current_local_solution->init (this->n_dofs(), false, SERIAL);
241 #endif
242 
243  // from now on, adding additional vectors or variables can't be done
244  // without immediately initializing them
245  _is_initialized = true;
246 
247  // initialize & zero other vectors, if necessary
248  for (auto & [vec_name, vec] : _vectors)
249  {
250  libmesh_ignore(vec_name); // spurious warning from old gcc
251  const ParallelType type = vec->type();
252 
253  if (type == GHOSTED)
254  {
255 #ifdef LIBMESH_ENABLE_GHOSTED
256  vec->init (this->n_dofs(), this->n_local_dofs(),
257  _dof_map->get_send_list(), /*fast=*/false,
258  GHOSTED);
259 #else
260  libmesh_error_msg("Cannot initialize ghosted vectors when they are not enabled.");
261 #endif
262  }
263  else if (type == SERIAL)
264  {
265  vec->init (this->n_dofs(), false, type);
266  }
267  else
268  {
269  libmesh_assert_equal_to(type, PARALLEL);
270  vec->init (this->n_dofs(), this->n_local_dofs(), false, type);
271  }
272  }
273 
274  // Add matrices
275  this->add_matrices();
276 
277  // Clear any existing matrices
278  for (auto & pr : _matrices)
279  pr.second->clear();
280 
281  // Initialize the matrices for the system
282  if (!_basic_system_only)
283  this->init_matrices();
284 }
bool _basic_system_only
Holds true if the components of more advanced system types (e.g.
Definition: system.h:2277
virtual void init_matrices()
Initializes the matrices associated with this system.
Definition: system.C:308
bool _is_initialized
true when additional vectors and variables do not require immediate initialization, false otherwise.
Definition: system.h:2283
MeshBase & mesh
std::unique_ptr< DofMap > _dof_map
Data structure describing the relationship between nodes, variables, etc...
Definition: system.h:2202
std::map< std::string, std::unique_ptr< NumericVector< Number > >, std::less<> > _vectors
Some systems need an arbitrary number of vectors.
Definition: system.h:2237
dof_id_type n_local_dofs() const
Definition: system.C:156
const MeshBase & get_mesh() const
Definition: system.h:2359
dof_id_type n_dofs() const
Definition: system.C:119
std::map< std::string, std::unique_ptr< SparseMatrix< Number > >, std::less<> > _matrices
Some systems need an arbitrary number of matrices.
Definition: system.h:2254
void libmesh_ignore(const Args &...)
virtual void add_matrices()
Insertion point for adding matrices in derived classes before init_matrices() is called.
Definition: system.h:1987
std::unique_ptr< NumericVector< Number > > solution
Data structure to hold solution values.
Definition: system.h:1616
virtual void reinit_constraints()
Reinitializes the constraints for this system.
Definition: system.C:480
std::unique_ptr< NumericVector< Number > > current_local_solution
All the values I need to compute my contribution to the simulation at hand.
Definition: system.h:1628
ParallelType
Defines an enum for parallel data structure types.

◆ init_matrices()

void libMesh::EigenSystem::init_matrices ( )
overrideprotectedvirtual

Initializes the matrices associated with the system.

Reimplemented from libMesh::System.

Definition at line 158 of file eigen_system.C.

References libMesh::System::condense_constrained_dofs(), libMesh::System::get_dof_map(), libMesh::System::init_matrices(), shell_matrix_A, shell_matrix_B, and shell_precond_matrix.

159 {
161 
162  const bool condense_constraints = condense_constrained_dofs();
163  if (shell_matrix_A)
164  {
165  shell_matrix_A->attach_dof_map(this->get_dof_map());
166  if (condense_constraints)
167  shell_matrix_A->omit_constrained_dofs();
168  shell_matrix_A->init();
169  }
170 
171  if (shell_matrix_B)
172  {
173  shell_matrix_B->attach_dof_map(this->get_dof_map());
174  if (condense_constraints)
175  shell_matrix_B->omit_constrained_dofs();
176  shell_matrix_B->init();
177  }
178 
180  {
181  shell_precond_matrix->attach_dof_map(this->get_dof_map());
182  if (condense_constraints)
183  shell_precond_matrix->omit_constrained_dofs();
184  shell_precond_matrix->init();
185  }
186 }
virtual void init_matrices()
Initializes the matrices associated with this system.
Definition: system.C:308
virtual bool condense_constrained_dofs() const
Whether this object should condense out constrained degrees of freedom.
Definition: system.h:2036
std::unique_ptr< ShellMatrix< Number > > shell_precond_matrix
A preconditioning shell matrix.
Definition: eigen_system.h:353
std::unique_ptr< ShellMatrix< Number > > shell_matrix_A
The system shell matrix for standard eigenvalue problems.
Definition: eigen_system.h:329
std::unique_ptr< ShellMatrix< Number > > shell_matrix_B
A second system shell matrix for generalized eigenvalue problems.
Definition: eigen_system.h:337
const DofMap & get_dof_map() const
Definition: system.h:2375

◆ init_qois()

void libMesh::System::init_qois ( unsigned int  n_qois)
inherited

Accessors for qoi and qoi_error_estimates vectors.

Definition at line 2149 of file system.C.

References libMesh::System::n_qois(), libMesh::System::qoi, and libMesh::System::qoi_error_estimates.

Referenced by CoupledSystemQoI::init_qoi_count(), LaplaceQoI::init_qoi_count(), and main().

2150 {
2151  qoi.resize(n_qois);
2152  qoi_error_estimates.resize(n_qois);
2153 }
unsigned int n_qois() const
Number of currently active quantities of interest.
Definition: system.h:2520
std::vector< Number > qoi
Values of the quantities of interest.
Definition: system.h:1654
std::vector< Number > qoi_error_estimates
Vector to hold error estimates for qois, either from a steady state calculation, or from a single uns...
Definition: system.h:1662

◆ is_adjoint_already_solved()

bool libMesh::System::is_adjoint_already_solved ( ) const
inlineinherited

Accessor for the adjoint_already_solved boolean.

Definition at line 410 of file system.h.

References libMesh::System::adjoint_already_solved.

Referenced by libMesh::ImplicitSystem::adjoint_qoi_parameter_sensitivity(), libMesh::AdjointRefinementEstimator::estimate_error(), libMesh::AdjointResidualErrorEstimator::estimate_error(), libMesh::ImplicitSystem::qoi_parameter_hessian(), and libMesh::ImplicitSystem::qoi_parameter_hessian_vector_product().

411  { return adjoint_already_solved;}
bool adjoint_already_solved
Has the adjoint problem already been solved? If the user sets adjoint_already_solved to true...
Definition: system.h:2309

◆ is_initialized()

bool libMesh::System::is_initialized ( ) const
inlineinherited
Returns
true iff this system has been initialized.

Definition at line 2415 of file system.h.

References libMesh::System::_is_initialized.

Referenced by libMesh::DofMap::add_variable(), libMesh::DofMap::add_variables(), libMesh::System::init(), and libMesh::StaticCondensationDofMap::reinit().

2416 {
2417  return _is_initialized;
2418 }
bool _is_initialized
true when additional vectors and variables do not require immediate initialization, false otherwise.
Definition: system.h:2283

◆ local_dof_indices()

void libMesh::System::local_dof_indices ( const unsigned int  var,
std::set< dof_id_type > &  var_indices 
) const
inherited

Fills the std::set with the degrees of freedom on the local processor corresponding the the variable number passed in.

Definition at line 1405 of file system.C.

References libMesh::DofMap::dof_indices(), libMesh::DofMapBase::end_dof(), libMesh::DofMapBase::first_dof(), libMesh::System::get_dof_map(), libMesh::System::get_mesh(), and libMesh::libmesh_assert().

Referenced by libMesh::System::discrete_var_norm(), SystemsTest::testBlockRestrictedVarNDofs(), and libMesh::DirectSolutionTransfer::transfer().

1407 {
1408  // Make sure the set is clear
1409  var_indices.clear();
1410 
1411  std::vector<dof_id_type> dof_indices;
1412 
1413  const dof_id_type
1414  first_local = this->get_dof_map().first_dof(),
1415  end_local = this->get_dof_map().end_dof();
1416 
1417  // Begin the loop over the elements
1418  for (const auto & elem : this->get_mesh().active_local_element_ptr_range())
1419  {
1420  this->get_dof_map().dof_indices (elem, dof_indices, var);
1421 
1422  for (dof_id_type dof : dof_indices)
1423  //If the dof is owned by the local processor
1424  if (first_local <= dof && dof < end_local)
1425  var_indices.insert(dof);
1426  }
1427 
1428  // we may have missed assigning DOFs to nodes that we own
1429  // but to which we have no connected elements matching our
1430  // variable restriction criterion. this will happen, for example,
1431  // if variable V is restricted to subdomain S. We may not own
1432  // any elements which live in S, but we may own nodes which are
1433  // *connected* to elements which do.
1434  for (const auto & node : this->get_mesh().local_node_ptr_range())
1435  {
1436  libmesh_assert(node);
1437  this->get_dof_map().dof_indices (node, dof_indices, var);
1438  for (auto dof : dof_indices)
1439  if (first_local <= dof && dof < end_local)
1440  var_indices.insert(dof);
1441  }
1442 }
dof_id_type end_dof(const processor_id_type proc) const
Definition: dof_map_base.h:191
void dof_indices(const Elem *const elem, std::vector< dof_id_type > &di) const
Definition: dof_map.C:2197
const MeshBase & get_mesh() const
Definition: system.h:2359
libmesh_assert(ctx)
dof_id_type first_dof(const processor_id_type proc) const
Definition: dof_map_base.h:185
const DofMap & get_dof_map() const
Definition: system.h:2375
uint8_t dof_id_type
Definition: id_types.h:67

◆ matrices_begin() [1/2]

System::matrices_iterator libMesh::System::matrices_begin ( )
inlineinherited

Beginning of matrices container.

Definition at line 2487 of file system.h.

References libMesh::System::_matrices.

2488 {
2489  return _matrices.begin();
2490 }
std::map< std::string, std::unique_ptr< SparseMatrix< Number > >, std::less<> > _matrices
Some systems need an arbitrary number of matrices.
Definition: system.h:2254

◆ matrices_begin() [2/2]

System::const_matrices_iterator libMesh::System::matrices_begin ( ) const
inlineinherited

Beginning of matrices container.

Definition at line 2493 of file system.h.

References libMesh::System::_matrices.

2494 {
2495  return _matrices.begin();
2496 }
std::map< std::string, std::unique_ptr< SparseMatrix< Number > >, std::less<> > _matrices
Some systems need an arbitrary number of matrices.
Definition: system.h:2254

◆ matrices_end() [1/2]

System::matrices_iterator libMesh::System::matrices_end ( )
inlineinherited

End of matrices container.

Definition at line 2499 of file system.h.

References libMesh::System::_matrices.

2500 {
2501  return _matrices.end();
2502 }
std::map< std::string, std::unique_ptr< SparseMatrix< Number > >, std::less<> > _matrices
Some systems need an arbitrary number of matrices.
Definition: system.h:2254

◆ matrices_end() [2/2]

System::const_matrices_iterator libMesh::System::matrices_end ( ) const
inlineinherited

End of matrices container.

Definition at line 2505 of file system.h.

References libMesh::System::_matrices.

2506 {
2507  return _matrices.end();
2508 }
std::map< std::string, std::unique_ptr< SparseMatrix< Number > >, std::less<> > _matrices
Some systems need an arbitrary number of matrices.
Definition: system.h:2254

◆ n_active_dofs()

dof_id_type libMesh::System::n_active_dofs ( ) const
inlineinherited
Returns
The number of active degrees of freedom for this System.

Definition at line 2441 of file system.h.

References libMesh::System::n_constrained_dofs(), and libMesh::System::n_dofs().

2442 {
2443  return this->n_dofs() - this->n_constrained_dofs();
2444 }
dof_id_type n_dofs() const
Definition: system.C:119
dof_id_type n_constrained_dofs() const
Definition: system.C:126

◆ n_components()

unsigned int libMesh::System::n_components ( ) const
inherited
Returns
The total number of scalar components in the system's variables. This will equal n_vars() in the case of all scalar-valued variables.

Definition at line 2674 of file system.C.

References libMesh::System::get_dof_map(), libMesh::System::get_mesh(), and libMesh::DofMap::n_components().

2675 {
2676  return this->get_dof_map().n_components(this->get_mesh());
2677 }
unsigned int n_components(const MeshBase &mesh) const
Definition: dof_map.h:2952
const MeshBase & get_mesh() const
Definition: system.h:2359
const DofMap & get_dof_map() const
Definition: system.h:2375

◆ n_constrained_dofs()

dof_id_type libMesh::System::n_constrained_dofs ( ) const
inherited
Returns
The total number of constrained degrees of freedom in the system.

Definition at line 126 of file system.C.

References libMesh::System::_dof_map.

Referenced by form_functionA(), form_functionB(), form_matrixA(), libMesh::System::get_info(), libMesh::System::n_active_dofs(), solve(), and BoundaryInfoTest::testShellFaceConstraints().

127 {
128 #ifdef LIBMESH_ENABLE_CONSTRAINTS
129 
130  return _dof_map->n_constrained_dofs();
131 
132 #else
133 
134  return 0;
135 
136 #endif
137 }
std::unique_ptr< DofMap > _dof_map
Data structure describing the relationship between nodes, variables, etc...
Definition: system.h:2202

◆ n_dofs()

dof_id_type libMesh::System::n_dofs ( ) const
inherited
Returns
The number of degrees of freedom in the system

Definition at line 119 of file system.C.

References libMesh::System::_dof_map.

Referenced by libMesh::TransientRBConstruction::add_IC_to_RB_space(), libMesh::System::add_vector(), libMesh::TransientRBConstruction::allocate_data_structures(), libMesh::RBConstruction::allocate_data_structures(), libMesh::TransientRBConstruction::assemble_affine_expansion(), libMesh::ClawSystem::assemble_avg_coupling_matrices(), libMesh::ClawSystem::assemble_boundary_condition_matrices(), libMesh::AdvectionSystem::assemble_claw_rhs(), libMesh::ClawSystem::assemble_jump_coupling_matrix(), libMesh::RBConstruction::compute_Fq_representor_innerprods(), libMesh::RBConstruction::compute_output_dual_innerprods(), libMesh::RBConstruction::compute_residual_dual_norm_slow(), libMesh::TransientRBConstruction::enrich_RB_space(), libMesh::AdjointRefinementEstimator::estimate_error(), libMesh::System::get_info(), libMesh::SecondOrderUnsteadySolver::init_data(), libMesh::AdvectionSystem::init_data(), libMesh::UnsteadySolver::init_data(), libMesh::System::init_data(), libMesh::OptimizationSystem::initialize_equality_constraints_storage(), libMesh::OptimizationSystem::initialize_inequality_constraints_storage(), main(), libMesh::TransientRBConstruction::mass_matrix_scaled_matvec(), libMesh::System::n_active_dofs(), libMesh::CondensedEigenSystem::n_global_non_condensed_dofs(), libMesh::FEMSystem::numerical_jacobian(), libMesh::RBSCMConstruction::perform_SCM_greedy(), libMesh::RBEvaluation::read_in_vectors_from_multiple_files(), libMesh::System::read_legacy_data(), libMesh::TransientRBConstruction::read_riesz_representors_from_files(), libMesh::RBConstruction::read_riesz_representors_from_files(), MeshFunctionTest::read_variable_info_from_output_data(), libMesh::SecondOrderUnsteadySolver::reinit(), libMesh::UnsteadySolver::reinit(), libMesh::System::restrict_vectors(), OverlappingAlgebraicGhostingTest::run_ghosting_test(), OverlappingCouplingGhostingTest::run_sparsity_pattern_test(), libMesh::TransientRBConstruction::set_error_temporal_data(), libMesh::ClawSystem::solve_conservation_law(), SystemsTest::test100KVariables(), MeshfunctionDFEM::test_mesh_function_dfem(), MeshfunctionDFEM::test_mesh_function_dfem_grad(), MeshFunctionTest::test_p_level(), SystemsTest::testPostInitAddVector(), SystemsTest::testPostInitAddVectorTypeChange(), SystemsTest::testProjectCubeWithMeshFunction(), SystemsTest::testProjectMatrix1D(), SystemsTest::testProjectMatrix2D(), SystemsTest::testProjectMatrix3D(), libMesh::RBConstruction::train_reduced_basis_with_POD(), libMesh::MeshFunctionSolutionTransfer::transfer(), libMesh::TransientRBConstruction::truth_assembly(), libMesh::RBConstruction::truth_assembly(), libMesh::TransientRBConstruction::update_RB_initial_condition_all_N(), libMesh::TransientRBConstruction::update_RB_system_matrices(), libMesh::RBConstruction::update_RB_system_matrices(), libMesh::TransientRBConstruction::update_residual_terms(), and libMesh::RBConstruction::update_residual_terms().

120 {
121  return _dof_map->n_dofs();
122 }
std::unique_ptr< DofMap > _dof_map
Data structure describing the relationship between nodes, variables, etc...
Definition: system.h:2202

◆ n_local_constrained_dofs()

dof_id_type libMesh::System::n_local_constrained_dofs ( ) const
inherited
Returns
The number of constrained degrees of freedom on this processor.

Definition at line 141 of file system.C.

References libMesh::System::_dof_map.

Referenced by libMesh::System::get_info().

142 {
143 #ifdef LIBMESH_ENABLE_CONSTRAINTS
144 
145  return _dof_map->n_local_constrained_dofs();
146 
147 #else
148 
149  return 0;
150 
151 #endif
152 }
std::unique_ptr< DofMap > _dof_map
Data structure describing the relationship between nodes, variables, etc...
Definition: system.h:2202

◆ n_local_dofs()

dof_id_type libMesh::System::n_local_dofs ( ) const
inherited
Returns
The number of degrees of freedom local to this processor

Definition at line 156 of file system.C.

References libMesh::System::_dof_map.

Referenced by libMesh::TransientRBConstruction::add_IC_to_RB_space(), libMesh::System::add_vector(), libMesh::TransientRBConstruction::allocate_data_structures(), libMesh::RBConstruction::allocate_data_structures(), libMesh::TransientRBConstruction::assemble_affine_expansion(), libMesh::AdvectionSystem::assemble_claw_rhs(), libMesh::PetscDMWrapper::build_section(), libMesh::RBConstruction::compute_Fq_representor_innerprods(), libMesh::RBConstruction::compute_output_dual_innerprods(), libMesh::RBConstruction::compute_residual_dual_norm_slow(), libMesh::TransientRBConstruction::enrich_RB_space(), libMesh::AdjointRefinementEstimator::estimate_error(), libMesh::System::get_info(), libMesh::SecondOrderUnsteadySolver::init_data(), libMesh::AdvectionSystem::init_data(), libMesh::UnsteadySolver::init_data(), libMesh::System::init_data(), libMesh::OptimizationSystem::initialize_equality_constraints_storage(), libMesh::OptimizationSystem::initialize_inequality_constraints_storage(), main(), libMesh::TransientRBConstruction::mass_matrix_scaled_matvec(), libMesh::RBEvaluation::read_in_vectors_from_multiple_files(), libMesh::TransientRBConstruction::read_riesz_representors_from_files(), libMesh::RBConstruction::read_riesz_representors_from_files(), libMesh::SecondOrderUnsteadySolver::reinit(), libMesh::UnsteadySolver::reinit(), libMesh::System::restrict_vectors(), OverlappingAlgebraicGhostingTest::run_ghosting_test(), OverlappingCouplingGhostingTest::run_sparsity_pattern_test(), libMesh::TransientRBConstruction::set_error_temporal_data(), libMesh::ClawSystem::solve_conservation_law(), MeshFunctionTest::test_p_level(), libMesh::RBConstruction::train_reduced_basis_with_POD(), libMesh::TransientRBConstruction::truth_assembly(), libMesh::RBConstruction::truth_assembly(), libMesh::TransientRBConstruction::update_RB_initial_condition_all_N(), libMesh::TransientRBConstruction::update_RB_system_matrices(), libMesh::RBConstruction::update_RB_system_matrices(), libMesh::TransientRBConstruction::update_residual_terms(), and libMesh::RBConstruction::update_residual_terms().

157 {
158  return _dof_map->n_local_dofs();
159 }
std::unique_ptr< DofMap > _dof_map
Data structure describing the relationship between nodes, variables, etc...
Definition: system.h:2202

◆ n_matrices()

unsigned int libMesh::System::n_matrices ( ) const
inlineinherited
Returns
The number of matrices handled by this system. This is the size of the _matrices map

Definition at line 2598 of file system.h.

References libMesh::System::_matrices.

Referenced by libMesh::ImplicitSystem::add_matrices(), and libMesh::System::get_info().

2599 {
2600  return cast_int<unsigned int>(_matrices.size());
2601 }
std::map< std::string, std::unique_ptr< SparseMatrix< Number > >, std::less<> > _matrices
Some systems need an arbitrary number of matrices.
Definition: system.h:2254

◆ n_objects()

static unsigned int libMesh::ReferenceCounter::n_objects ( )
inlinestaticinherited

Prints the number of outstanding (created, but not yet destroyed) objects.

Definition at line 85 of file reference_counter.h.

References libMesh::ReferenceCounter::_n_objects.

Referenced by libMesh::LibMeshInit::~LibMeshInit().

86  { return _n_objects; }
static Threads::atomic< unsigned int > _n_objects
The number of objects.

◆ n_processors()

processor_id_type libMesh::ParallelObject::n_processors ( ) const
inlineinherited
Returns
The number of processors in the group.

Definition at line 103 of file parallel_object.h.

References libMesh::ParallelObject::_communicator, libMesh::libmesh_assert(), and TIMPI::Communicator::size().

Referenced by libMesh::Partitioner::_find_global_index_by_pid_map(), libMesh::BoundaryInfo::_find_id_maps(), libMesh::DofMap::add_constraints_to_send_list(), libMesh::PetscDMWrapper::add_dofs_to_section(), libMesh::DistributedMesh::add_elem(), libMesh::DofMap::add_neighbors_to_send_list(), libMesh::DistributedMesh::add_node(), libMesh::System::add_vector(), libMesh::LaplaceMeshSmoother::allgather_graph(), libMesh::DofMap::allgather_recursive_constraints(), libMesh::FEMSystem::assembly(), libMesh::Nemesis_IO::assert_symmetric_cmaps(), libMesh::Partitioner::assign_partitioning(), libMesh::AztecLinearSolver< T >::AztecLinearSolver(), libMesh::Partitioner::build_graph(), libMesh::EquationSystems::build_parallel_elemental_solution_vector(), libMesh::DistributedMesh::clear(), libMesh::DistributedMesh::clear_elems(), libMesh::Nemesis_IO_Helper::compute_border_node_ids(), libMesh::Nemesis_IO_Helper::construct_nemesis_filename(), libMesh::UnstructuredMesh::copy_nodes_and_elements(), libMesh::ExodusII_IO::copy_scalar_solution(), libMesh::Nemesis_IO::copy_scalar_solution(), libMesh::UnstructuredMesh::create_pid_mesh(), libMesh::MeshTools::create_processor_bounding_box(), libMesh::DofMap::distribute_dofs(), libMesh::DofMap::distribute_scalar_dofs(), libMesh::DistributedMesh::DistributedMesh(), libMesh::EnsightIO::EnsightIO(), libMesh::RBEIMEvaluation::gather_bfs(), libMesh::MeshBase::get_info(), libMesh::StaticCondensation::init(), libMesh::SystemSubsetBySubdomain::init(), libMesh::PetscDMWrapper::init_petscdm(), libMesh::Nemesis_IO_Helper::initialize(), libMesh::ExodusII_IO_Helper::initialize(), libMesh::DistributedMesh::insert_elem(), libMesh::MeshTools::libmesh_assert_contiguous_dof_ids(), libMesh::MeshTools::libmesh_assert_parallel_consistent_new_node_procids(), libMesh::MeshTools::libmesh_assert_parallel_consistent_procids< Elem >(), libMesh::MeshTools::libmesh_assert_parallel_consistent_procids< Node >(), libMesh::MeshTools::libmesh_assert_topology_consistent_procids< Node >(), libMesh::MeshTools::libmesh_assert_valid_boundary_ids(), libMesh::MeshTools::libmesh_assert_valid_dof_ids(), libMesh::MeshTools::libmesh_assert_valid_neighbors(), libMesh::MeshTools::libmesh_assert_valid_refinement_flags(), libMesh::DofMap::local_variable_indices(), libMesh::MeshRefinement::make_coarsening_compatible(), libMesh::MeshBase::n_active_elem_on_proc(), libMesh::DofMap::n_dofs_per_processor(), libMesh::MeshBase::n_elem_on_proc(), libMesh::MeshBase::n_nodes_on_proc(), libMesh::RBEIMEvaluation::node_gather_bfs(), libMesh::Partitioner::partition(), libMesh::MeshBase::partition(), libMesh::Partitioner::partition_unpartitioned_elements(), libMesh::System::point_gradient(), libMesh::System::point_hessian(), libMesh::System::point_value(), libMesh::DofMap::prepare_send_list(), libMesh::MeshBase::print_constraint_rows(), libMesh::DofMap::print_dof_constraints(), libMesh::NameBasedIO::read(), libMesh::Nemesis_IO::read(), libMesh::CheckpointIO::read(), libMesh::CheckpointIO::read_connectivity(), libMesh::XdrIO::read_header(), libMesh::CheckpointIO::read_nodes(), libMesh::System::read_parallel_data(), libMesh::System::read_SCALAR_dofs(), libMesh::System::read_serialized_blocked_dof_objects(), libMesh::System::read_serialized_vector(), libMesh::DistributedMesh::renumber_dof_objects(), libMesh::Partitioner::repartition(), OverlappingFunctorTest::run_partitioner_test(), libMesh::DofMap::scatter_constraints(), libMesh::DistributedMesh::set_next_unique_id(), libMesh::DofMap::set_nonlocal_dof_objects(), libMesh::PetscDMWrapper::set_point_range_in_section(), WriteVecAndScalar::setupTests(), libMesh::RBEIMEvaluation::side_gather_bfs(), DistributedMeshTest::testRemoteElemError(), CheckpointIOTest::testSplitter(), libMesh::MeshRefinement::uniformly_coarsen(), libMesh::DistributedMesh::update_parallel_id_counts(), libMesh::GMVIO::write_binary(), libMesh::GMVIO::write_discontinuous_gmv(), libMesh::ExodusII_IO_Helper::write_nodal_coordinates(), libMesh::VTKIO::write_nodal_data(), libMesh::ExodusII_IO::write_nodal_data(), libMesh::System::write_parallel_data(), libMesh::System::write_SCALAR_dofs(), libMesh::XdrIO::write_serialized_bcs_helper(), libMesh::System::write_serialized_blocked_dof_objects(), libMesh::XdrIO::write_serialized_connectivity(), libMesh::XdrIO::write_serialized_nodes(), and libMesh::XdrIO::write_serialized_nodesets().

104  {
105  processor_id_type returnval =
106  cast_int<processor_id_type>(_communicator.size());
107  libmesh_assert(returnval); // We never have an empty comm
108  return returnval;
109  }
const Parallel::Communicator & _communicator
processor_id_type size() const
uint8_t processor_id_type
libmesh_assert(ctx)

◆ n_qois()

unsigned int libMesh::System::n_qois ( ) const
inlineinherited

Number of currently active quantities of interest.

Definition at line 2520 of file system.h.

References libMesh::System::qoi, and libMesh::System::qoi_error_estimates.

Referenced by libMesh::UniformRefinementEstimator::_estimate_error(), libMesh::AdaptiveTimeSolver::adjoint_advance_timestep(), libMesh::UnsteadySolver::adjoint_advance_timestep(), libMesh::ImplicitSystem::adjoint_qoi_parameter_sensitivity(), libMesh::TwostepTimeSolver::adjoint_solve(), libMesh::ImplicitSystem::adjoint_solve(), libMesh::SensitivityData::allocate_data(), libMesh::SensitivityData::allocate_hessian_data(), libMesh::ExplicitSystem::assemble_qoi(), libMesh::FEMSystem::assemble_qoi(), libMesh::ExplicitSystem::assemble_qoi_derivative(), libMesh::FEMSystem::assemble_qoi_derivative(), libMesh::DiffContext::DiffContext(), libMesh::AdjointRefinementEstimator::estimate_error(), libMesh::AdjointResidualErrorEstimator::estimate_error(), libMesh::FileSolutionHistory::FileSolutionHistory(), libMesh::ImplicitSystem::forward_qoi_parameter_sensitivity(), libMesh::UnsteadySolver::init_adjoints(), libMesh::TimeSolver::init_adjoints(), libMesh::System::init_qois(), libMesh::Euler2Solver::integrate_adjoint_refinement_error_estimate(), libMesh::TwostepTimeSolver::integrate_adjoint_refinement_error_estimate(), libMesh::EulerSolver::integrate_adjoint_refinement_error_estimate(), libMesh::Euler2Solver::integrate_qoi_timestep(), libMesh::TwostepTimeSolver::integrate_qoi_timestep(), libMesh::EulerSolver::integrate_qoi_timestep(), main(), libMesh::FEMContext::pre_fe_reinit(), libMesh::ImplicitSystem::qoi_parameter_hessian(), libMesh::ImplicitSystem::qoi_parameter_hessian_vector_product(), libMesh::FileSolutionHistory::retrieve(), libMesh::QoISet::size(), libMesh::UnsteadySolver::UnsteadySolver(), and libMesh::ImplicitSystem::weighted_sensitivity_adjoint_solve().

2521 {
2522 #ifndef LIBMESH_ENABLE_DEPRECATED
2523  libmesh_assert_equal_to(this->qoi.size(), this->qoi_error_estimates.size());
2524 #endif
2525 
2526  return cast_int<unsigned int>(this->qoi.size());
2527 }
std::vector< Number > qoi
Values of the quantities of interest.
Definition: system.h:1654
std::vector< Number > qoi_error_estimates
Vector to hold error estimates for qois, either from a steady state calculation, or from a single uns...
Definition: system.h:1662

◆ n_variable_groups()

unsigned int libMesh::System::n_variable_groups ( ) const
inherited
Returns
The number of VariableGroup variable groups in the system

Definition at line 2679 of file system.C.

References libMesh::System::get_dof_map(), and libMesh::DofMap::n_variable_groups().

Referenced by libMesh::FEMSystem::assembly(), and libMesh::System::get_info().

2680 {
2681  return this->get_dof_map().n_variable_groups();
2682 }
unsigned int n_variable_groups() const
Definition: dof_map.h:733
const DofMap & get_dof_map() const
Definition: system.h:2375

◆ n_vars()

unsigned int libMesh::System::n_vars ( ) const
inherited
Returns
The number of variables in the system

Definition at line 2654 of file system.C.

References libMesh::System::get_dof_map(), and libMesh::DofMap::n_vars().

Referenced by libMesh::ExactSolution::_compute_error(), libMesh::UniformRefinementEstimator::_estimate_error(), libMesh::PetscDMWrapper::add_dofs_helper(), libMesh::DiffContext::add_localized_vector(), libMesh::RBConstruction::add_scaled_matrix_and_vector(), libMesh::TwostepTimeSolver::adjoint_solve(), libMesh::FEMContext::attach_quadrature_rules(), libMesh::EquationSystems::build_parallel_solution_vector(), libMesh::PetscDMWrapper::build_section(), libMesh::System::calculate_norm(), compute_stresses(), LinearElasticityWithContact::compute_stresses(), LinearElasticity::compute_stresses(), LargeDeformationElasticity::compute_stresses(), libMesh::DGFEMContext::DGFEMContext(), libMesh::DiffContext::DiffContext(), libMesh::JumpErrorEstimator::estimate_error(), libMesh::AdjointResidualErrorEstimator::estimate_error(), libMesh::ExactErrorEstimator::estimate_error(), libMesh::ErrorEstimator::estimate_errors(), libMesh::ExactSolution::ExactSolution(), libMesh::FEMContext::find_hardest_fe_type(), libMesh::EquationSystems::find_variable_numbers(), libMesh::FEMSystem::init_context(), libMesh::RBEIMConstruction::init_context(), libMesh::FEMContext::init_internal_data(), libMesh::PetscDMWrapper::init_petscdm(), libMesh::DifferentiablePhysics::init_physics(), AssemblyA0::interior_assembly(), AssemblyA1::interior_assembly(), AssemblyA2::interior_assembly(), InnerProductAssembly::interior_assembly(), main(), libMesh::WeightedPatchRecoveryErrorEstimator::EstimateError::operator()(), libMesh::SmoothnessEstimator::EstimateSmoothness::operator()(), libMesh::PatchRecoveryErrorEstimator::EstimateError::operator()(), output_norms(), libMesh::petsc_auto_fieldsplit(), libMesh::FEMContext::pre_fe_reinit(), libMesh::InterMeshProjection::project_system_vectors(), libMesh::System::re_update(), libMesh::System::read_legacy_data(), libMesh::System::read_parallel_data(), libMesh::System::read_serialized_blocked_dof_objects(), libMesh::System::read_serialized_vector(), libMesh::System::read_serialized_vectors(), libMesh::System::reinit_mesh(), libMesh::HPCoarsenTest::select_refinement(), libMesh::PetscDMWrapper::set_point_range_in_section(), libMesh::SystemSubsetBySubdomain::set_var_nums(), OverlappingTestBase::setup_coupling_matrix(), SystemsTest::testDofCouplingWithVarGroups(), SlitMeshRefinedSystemTest::testRestart(), SlitMeshRefinedSystemTest::testSystem(), libMesh::System::write_header(), libMesh::System::write_parallel_data(), libMesh::System::write_serialized_blocked_dof_objects(), libMesh::System::write_serialized_vector(), libMesh::System::write_serialized_vectors(), and libMesh::System::zero_variable().

2655 {
2656  return this->get_dof_map().n_vars();
2657 }
unsigned int n_vars() const
Definition: dof_map.h:2926
const DofMap & get_dof_map() const
Definition: system.h:2375

◆ n_vectors()

unsigned int libMesh::System::n_vectors ( ) const
inlineinherited
Returns
The number of vectors (in addition to the solution) handled by this system This is the size of the _vectors map

Definition at line 2457 of file system.h.

References libMesh::System::_vectors.

Referenced by libMesh::ExplicitSystem::add_system_rhs(), libMesh::System::compare(), libMesh::System::get_info(), main(), libMesh::InterMeshProjection::project_system_vectors(), and libMesh::System::write_header().

2458 {
2459  return cast_int<unsigned int>(_vectors.size());
2460 }
std::map< std::string, std::unique_ptr< NumericVector< Number > >, std::less<> > _vectors
Some systems need an arbitrary number of vectors.
Definition: system.h:2237

◆ name()

const std::string & libMesh::System::name ( ) const
inlineinherited

◆ number()

unsigned int libMesh::System::number ( ) const
inlineinherited
Returns
The system number.

Definition at line 2351 of file system.h.

References libMesh::System::_sys_number.

Referenced by libMesh::ExactSolution::_compute_error(), libMesh::PetscDMWrapper::add_dofs_helper(), assemble_matrix_and_rhs(), assemble_shell(), libMesh::VariationalSmootherSystem::assembly(), libMesh::EquationSystems::build_parallel_solution_vector(), libMesh::VariationalSmootherConstraint::constrain_node_to_line(), libMesh::VariationalSmootherConstraint::constrain_node_to_plane(), libMesh::ExodusII_IO::copy_elemental_solution(), libMesh::Nemesis_IO::copy_elemental_solution(), libMesh::ExodusII_IO::copy_nodal_solution(), libMesh::Nemesis_IO::copy_nodal_solution(), libMesh::AdjointRefinementEstimator::estimate_error(), libMesh::ExactErrorEstimator::find_squared_element_error(), libMesh::EquationSystems::find_variable_numbers(), libMesh::VariationalSmootherConstraint::fix_node(), libMesh::System::get_info(), libMesh::VariationalSmootherSystem::init_data(), main(), libMesh::GenericProjector< FFunctor, GFunctor, FValue, ProjectionAction >::SortAndCopy::operator()(), libMesh::GenericProjector< FFunctor, GFunctor, FValue, ProjectionAction >::ProjectVertices::operator()(), libMesh::GenericProjector< FFunctor, GFunctor, FValue, ProjectionAction >::ProjectEdges::operator()(), libMesh::GenericProjector< FFunctor, GFunctor, FValue, ProjectionAction >::ProjectSides::operator()(), libMesh::GenericProjector< FFunctor, GFunctor, FValue, ProjectionAction >::ProjectInteriors::operator()(), libMesh::System::read_legacy_data(), libMesh::System::read_parallel_data(), libMesh::System::read_serialized_blocked_dof_objects(), libMesh::StaticCondensationDofMap::reinit(), LinearElasticityWithContact::residual_and_jacobian(), SolidSystem::save_initial_mesh(), libMesh::HPCoarsenTest::select_refinement(), libMesh::PetscDMWrapper::set_point_range_in_section(), MeshInputTest::testCopyElementVectorImpl(), libMesh::MeshFunctionSolutionTransfer::transfer(), libMesh::MeshfreeSolutionTransfer::transfer(), libMesh::BoundaryVolumeSolutionTransfer::transfer_boundary_volume(), libMesh::BoundaryVolumeSolutionTransfer::transfer_volume_boundary(), libMesh::DTKAdapter::update_variable_values(), libMesh::System::write_parallel_data(), libMesh::System::write_serialized_blocked_dof_objects(), and libMesh::System::zero_variable().

2352 {
2353  return _sys_number;
2354 }
const unsigned int _sys_number
The number associated with this system.
Definition: system.h:2224

◆ operator=() [1/2]

EigenSystem& libMesh::EigenSystem::operator= ( const EigenSystem )
delete

◆ operator=() [2/2]

EigenSystem& libMesh::EigenSystem::operator= ( EigenSystem &&  )
delete

◆ point_gradient() [1/4]

Gradient libMesh::System::point_gradient ( unsigned int  var,
const Point p,
const bool  insist_on_success = true,
const NumericVector< Number > *  sol = nullptr 
) const
inherited
Returns
The gradient of the solution variable var at the physical point p in the mesh, similarly to point_value.

Definition at line 2328 of file system.C.

References libMesh::Variable::active_subdomains(), TIMPI::Communicator::broadcast(), libMesh::ParallelObject::comm(), libMesh::PointLocatorBase::enable_out_of_mesh_mode(), libMesh::System::get_dof_map(), libMesh::System::get_mesh(), libMesh::libmesh_assert(), mesh, TIMPI::Communicator::min(), libMesh::ParallelObject::n_processors(), libMesh::ParallelObject::processor_id(), libMesh::DofObject::processor_id(), and libMesh::System::variable().

Referenced by line_print(), and libMesh::System::point_gradient().

2332 {
2333  // This function must be called on every processor; there's no
2334  // telling where in the partition p falls.
2335  parallel_object_only();
2336 
2337  // And every processor had better agree about which point we're
2338  // looking for
2339 #ifndef NDEBUG
2340  libmesh_assert(this->comm().verify(p(0)));
2341 #if LIBMESH_DIM > 1
2342  libmesh_assert(this->comm().verify(p(1)));
2343 #endif
2344 #if LIBMESH_DIM > 2
2345  libmesh_assert(this->comm().verify(p(2)));
2346 #endif
2347 #endif // NDEBUG
2348 
2349  // Get a reference to the mesh object associated with the system object that calls this function
2350  const MeshBase & mesh = this->get_mesh();
2351 
2352  // Use an existing PointLocator or create a new one
2353  std::unique_ptr<PointLocatorBase> locator_ptr = mesh.sub_point_locator();
2354  PointLocatorBase & locator = *locator_ptr;
2355 
2356  if (!insist_on_success || !mesh.is_serial())
2357  locator.enable_out_of_mesh_mode();
2358 
2359  // Get a pointer to an element that contains p and allows us to
2360  // evaluate var
2361  const std::set<subdomain_id_type> & raw_subdomains =
2362  this->variable(var).active_subdomains();
2363  const std::set<subdomain_id_type> * implicit_subdomains =
2364  raw_subdomains.empty() ? nullptr : &raw_subdomains;
2365  const Elem * e = locator(p, implicit_subdomains);
2366 
2367  Gradient grad_u;
2368 
2369  if (e && this->get_dof_map().is_evaluable(*e, var))
2370  grad_u = point_gradient(var, p, *e, sol);
2371 
2372  // If I have an element containing p, then let's let everyone know
2373  processor_id_type lowest_owner =
2374  (e && (e->processor_id() == this->processor_id())) ?
2375  this->processor_id() : this->n_processors();
2376  this->comm().min(lowest_owner);
2377 
2378  // Everybody should get their value from a processor that was able
2379  // to compute it.
2380  // If nobody admits owning the point, we may have a problem.
2381  if (lowest_owner != this->n_processors())
2382  this->comm().broadcast(grad_u, lowest_owner);
2383  else
2384  libmesh_assert(!insist_on_success);
2385 
2386  return grad_u;
2387 }
const Variable & variable(unsigned int var) const
Return a constant reference to Variable var.
Definition: system.C:2684
Gradient point_gradient(unsigned int var, const Point &p, const bool insist_on_success=true, const NumericVector< Number > *sol=nullptr) const
Definition: system.C:2328
MeshBase & mesh
const Parallel::Communicator & comm() const
const MeshBase & get_mesh() const
Definition: system.h:2359
uint8_t processor_id_type
processor_id_type n_processors() const
const std::set< subdomain_id_type > & active_subdomains() const
Definition: variable.h:181
void min(const T &r, T &o, Request &req) const
NumberVectorValue Gradient
libmesh_assert(ctx)
void broadcast(T &data, const unsigned int root_id=0, const bool identical_sizes=false) const
processor_id_type processor_id() const
const DofMap & get_dof_map() const
Definition: system.h:2375

◆ point_gradient() [2/4]

Gradient libMesh::System::point_gradient ( unsigned int  var,
const Point p,
const Elem e,
const NumericVector< Number > *  sol = nullptr 
) const
inherited
Returns
The gradient of the solution variable var at the physical point p in local Elem e in the mesh, similarly to point_value.

Definition at line 2390 of file system.C.

References libMesh::FEInterface::compute_data(), libMesh::Elem::contains_point(), libMesh::System::current_local_solution, dim, libMesh::Elem::dim(), libMesh::DofMap::dof_indices(), libMesh::FEComputeData::dshape, libMesh::FEComputeData::enable_derivative(), libMesh::System::get_dof_map(), libMesh::System::get_equation_systems(), libMesh::FEMap::inverse_map(), libMesh::DofMap::is_evaluable(), libMesh::libmesh_assert(), libMesh::FEComputeData::local_transform, and libMesh::DofMap::variable_type().

2394 {
2395  // Ensuring that the given point is really in the element is an
2396  // expensive assert, but as long as debugging is turned on we might
2397  // as well try to catch a particularly nasty potential error
2398  libmesh_assert (e.contains_point(p));
2399 
2400  if (!sol)
2401  sol = this->current_local_solution.get();
2402 
2403  // Get the dof map to get the proper indices for our computation
2404  const DofMap & dof_map = this->get_dof_map();
2405 
2406  // write the element dimension into a separate variable.
2407  const unsigned int dim = e.dim();
2408 
2409  // Make sure we can evaluate on this element.
2410  libmesh_assert (dof_map.is_evaluable(e, var));
2411 
2412  // Need dof_indices for phi[i][j]
2413  std::vector<dof_id_type> dof_indices;
2414 
2415  // Fill in the dof_indices for our element
2416  dof_map.dof_indices (&e, dof_indices, var);
2417 
2418  // Get the no of dofs associated with this point
2419  const unsigned int num_dofs = cast_int<unsigned int>
2420  (dof_indices.size());
2421 
2422  FEType fe_type = dof_map.variable_type(var);
2423 
2424  // Map the physical co-ordinates to the master co-ordinates
2425  Point coor = FEMap::inverse_map(dim, &e, p);
2426 
2427  // get the shape function value via the FEInterface to also handle the case
2428  // of infinite elements correctly, the shape function is not fe->phi().
2429  FEComputeData fe_data(this->get_equation_systems(), coor);
2430  fe_data.enable_derivative();
2431  FEInterface::compute_data(dim, fe_type, &e, fe_data);
2432 
2433  // Get ready to accumulate a gradient
2434  Gradient grad_u;
2435 
2436  for (unsigned int l=0; l<num_dofs; l++)
2437  {
2438  // Chartesian coordinates have always LIBMESH_DIM entries,
2439  // local coordinates have as many coordinates as the element has.
2440  for (std::size_t v=0; v<dim; v++)
2441  for (std::size_t xyz=0; xyz<LIBMESH_DIM; xyz++)
2442  {
2443  // FIXME: this needs better syntax: It is matrix-vector multiplication.
2444  grad_u(xyz) += fe_data.local_transform[v][xyz]
2445  * fe_data.dshape[l](v)
2446  * (*sol)(dof_indices[l]);
2447  }
2448  }
2449 
2450  return grad_u;
2451 }
unsigned int dim
static Point inverse_map(const unsigned int dim, const Elem *elem, const Point &p, const Real tolerance=TOLERANCE, const bool secure=true, const bool extra_checks=true)
Definition: fe_map.C:1628
const EquationSystems & get_equation_systems() const
Definition: system.h:722
static void compute_data(const unsigned int dim, const FEType &fe_t, const Elem *elem, FEComputeData &data)
Lets the appropriate child of FEBase compute the requested data for the input specified in data...
NumberVectorValue Gradient
libmesh_assert(ctx)
std::unique_ptr< NumericVector< Number > > current_local_solution
All the values I need to compute my contribution to the simulation at hand.
Definition: system.h:1628
const DofMap & get_dof_map() const
Definition: system.h:2375

◆ point_gradient() [3/4]

Gradient libMesh::System::point_gradient ( unsigned int  var,
const Point p,
const Elem e 
) const
inherited

Calls the version of point_gradient() which takes a reference.

This function exists only to prevent people from calling the version of point_gradient() that has a boolean third argument, which would result in unnecessary PointLocator calls.

Definition at line 2455 of file system.C.

References libMesh::libmesh_assert(), and libMesh::System::point_gradient().

2456 {
2457  libmesh_assert(e);
2458  return this->point_gradient(var, p, *e);
2459 }
Gradient point_gradient(unsigned int var, const Point &p, const bool insist_on_success=true, const NumericVector< Number > *sol=nullptr) const
Definition: system.C:2328
libmesh_assert(ctx)

◆ point_gradient() [4/4]

Gradient libMesh::System::point_gradient ( unsigned int  var,
const Point p,
const NumericVector< Number > *  sol 
) const
inherited

Calls the parallel version of point_gradient().

This function exists only to prevent people from accidentally calling the version of point_gradient() that has a boolean third argument, which would result in incorrect output.

Definition at line 2463 of file system.C.

References libMesh::System::point_gradient().

2464 {
2465  return this->point_gradient(var, p, true, sol);
2466 }
Gradient point_gradient(unsigned int var, const Point &p, const bool insist_on_success=true, const NumericVector< Number > *sol=nullptr) const
Definition: system.C:2328

◆ point_hessian() [1/4]

Tensor libMesh::System::point_hessian ( unsigned int  var,
const Point p,
const bool  insist_on_success = true,
const NumericVector< Number > *  sol = nullptr 
) const
inherited
Returns
The second derivative tensor of the solution variable var at the physical point p in the mesh, similarly to point_value.

Definition at line 2472 of file system.C.

References libMesh::Variable::active_subdomains(), TIMPI::Communicator::broadcast(), libMesh::ParallelObject::comm(), libMesh::PointLocatorBase::enable_out_of_mesh_mode(), libMesh::System::get_dof_map(), libMesh::System::get_mesh(), libMesh::libmesh_assert(), mesh, TIMPI::Communicator::min(), libMesh::ParallelObject::n_processors(), libMesh::ParallelObject::processor_id(), libMesh::DofObject::processor_id(), and libMesh::System::variable().

Referenced by libMesh::System::point_hessian().

2476 {
2477  // This function must be called on every processor; there's no
2478  // telling where in the partition p falls.
2479  parallel_object_only();
2480 
2481  // And every processor had better agree about which point we're
2482  // looking for
2483 #ifndef NDEBUG
2484  libmesh_assert(this->comm().verify(p(0)));
2485 #if LIBMESH_DIM > 1
2486  libmesh_assert(this->comm().verify(p(1)));
2487 #endif
2488 #if LIBMESH_DIM > 2
2489  libmesh_assert(this->comm().verify(p(2)));
2490 #endif
2491 #endif // NDEBUG
2492 
2493  // Get a reference to the mesh object associated with the system object that calls this function
2494  const MeshBase & mesh = this->get_mesh();
2495 
2496  // Use an existing PointLocator or create a new one
2497  std::unique_ptr<PointLocatorBase> locator_ptr = mesh.sub_point_locator();
2498  PointLocatorBase & locator = *locator_ptr;
2499 
2500  if (!insist_on_success || !mesh.is_serial())
2501  locator.enable_out_of_mesh_mode();
2502 
2503  // Get a pointer to an element that contains p and allows us to
2504  // evaluate var
2505  const std::set<subdomain_id_type> & raw_subdomains =
2506  this->variable(var).active_subdomains();
2507  const std::set<subdomain_id_type> * implicit_subdomains =
2508  raw_subdomains.empty() ? nullptr : &raw_subdomains;
2509  const Elem * e = locator(p, implicit_subdomains);
2510 
2511  Tensor hess_u;
2512 
2513  if (e && this->get_dof_map().is_evaluable(*e, var))
2514  hess_u = point_hessian(var, p, *e, sol);
2515 
2516  // If I have an element containing p, then let's let everyone know
2517  processor_id_type lowest_owner =
2518  (e && (e->processor_id() == this->processor_id())) ?
2519  this->processor_id() : this->n_processors();
2520  this->comm().min(lowest_owner);
2521 
2522  // Everybody should get their value from a processor that was able
2523  // to compute it.
2524  // If nobody admits owning the point, we may have a problem.
2525  if (lowest_owner != this->n_processors())
2526  this->comm().broadcast(hess_u, lowest_owner);
2527  else
2528  libmesh_assert(!insist_on_success);
2529 
2530  return hess_u;
2531 }
const Variable & variable(unsigned int var) const
Return a constant reference to Variable var.
Definition: system.C:2684
MeshBase & mesh
const Parallel::Communicator & comm() const
const MeshBase & get_mesh() const
Definition: system.h:2359
uint8_t processor_id_type
processor_id_type n_processors() const
const std::set< subdomain_id_type > & active_subdomains() const
Definition: variable.h:181
void min(const T &r, T &o, Request &req) const
libmesh_assert(ctx)
void broadcast(T &data, const unsigned int root_id=0, const bool identical_sizes=false) const
NumberTensorValue Tensor
Tensor point_hessian(unsigned int var, const Point &p, const bool insist_on_success=true, const NumericVector< Number > *sol=nullptr) const
Definition: system.C:2472
processor_id_type processor_id() const
const DofMap & get_dof_map() const
Definition: system.h:2375

◆ point_hessian() [2/4]

Tensor libMesh::System::point_hessian ( unsigned int  var,
const Point p,
const Elem e,
const NumericVector< Number > *  sol = nullptr 
) const
inherited
Returns
The second derivative tensor of the solution variable var at the physical point p in local Elem e in the mesh, similarly to point_value.

Definition at line 2533 of file system.C.

References libMesh::TypeTensor< T >::add_scaled(), libMesh::FEGenericBase< OutputType >::build(), libMesh::Elem::contains_point(), libMesh::System::current_local_solution, libMesh::Elem::dim(), libMesh::DofMap::dof_indices(), libMesh::System::get_dof_map(), libMesh::Elem::infinite(), libMesh::FEMap::inverse_map(), libMesh::DofMap::is_evaluable(), libMesh::libmesh_assert(), and libMesh::DofMap::variable_type().

2537 {
2538  // Ensuring that the given point is really in the element is an
2539  // expensive assert, but as long as debugging is turned on we might
2540  // as well try to catch a particularly nasty potential error
2541  libmesh_assert (e.contains_point(p));
2542 
2543  if (!sol)
2544  sol = this->current_local_solution.get();
2545 
2546  if (e.infinite())
2547  libmesh_not_implemented();
2548 
2549  // Get the dof map to get the proper indices for our computation
2550  const DofMap & dof_map = this->get_dof_map();
2551 
2552  // Make sure we can evaluate on this element.
2553  libmesh_assert (dof_map.is_evaluable(e, var));
2554 
2555  // Need dof_indices for phi[i][j]
2556  std::vector<dof_id_type> dof_indices;
2557 
2558  // Fill in the dof_indices for our element
2559  dof_map.dof_indices (&e, dof_indices, var);
2560 
2561  // Get the no of dofs associated with this point
2562  const unsigned int num_dofs = cast_int<unsigned int>
2563  (dof_indices.size());
2564 
2565  FEType fe_type = dof_map.variable_type(var);
2566 
2567  // Build a FE again so we can calculate u(p)
2568  std::unique_ptr<FEBase> fe (FEBase::build(e.dim(), fe_type));
2569 
2570  // Map the physical co-ordinates to the master co-ordinates
2571  // Build a vector of point co-ordinates to send to reinit
2572  std::vector<Point> coor(1, FEMap::inverse_map(e.dim(), &e, p));
2573 
2574  // Get the values of the shape function derivatives
2575  const std::vector<std::vector<RealTensor>> & d2phi = fe->get_d2phi();
2576 
2577  // Reinitialize the element and compute the shape function values at coor
2578  fe->reinit (&e, &coor);
2579 
2580  // Get ready to accumulate a hessian
2581  Tensor hess_u;
2582 
2583  for (unsigned int l=0; l<num_dofs; l++)
2584  {
2585  hess_u.add_scaled (d2phi[l][0], (*sol)(dof_indices[l]));
2586  }
2587 
2588  return hess_u;
2589 }
static Point inverse_map(const unsigned int dim, const Elem *elem, const Point &p, const Real tolerance=TOLERANCE, const bool secure=true, const bool extra_checks=true)
Definition: fe_map.C:1628
static std::unique_ptr< FEGenericBase > build(const unsigned int dim, const FEType &type)
Builds a specific finite element type.
libmesh_assert(ctx)
void add_scaled(const TypeTensor< T2 > &, const T &)
Add a scaled tensor to this tensor without creating a temporary.
Definition: type_tensor.h:851
NumberTensorValue Tensor
std::unique_ptr< NumericVector< Number > > current_local_solution
All the values I need to compute my contribution to the simulation at hand.
Definition: system.h:1628
const DofMap & get_dof_map() const
Definition: system.h:2375

◆ point_hessian() [3/4]

Tensor libMesh::System::point_hessian ( unsigned int  var,
const Point p,
const Elem e 
) const
inherited

Calls the version of point_hessian() which takes a reference.

This function exists only to prevent people from calling the version of point_hessian() that has a boolean third argument, which would result in unnecessary PointLocator calls.

Definition at line 2593 of file system.C.

References libMesh::libmesh_assert(), and libMesh::System::point_hessian().

2594 {
2595  libmesh_assert(e);
2596  return this->point_hessian(var, p, *e);
2597 }
libmesh_assert(ctx)
Tensor point_hessian(unsigned int var, const Point &p, const bool insist_on_success=true, const NumericVector< Number > *sol=nullptr) const
Definition: system.C:2472

◆ point_hessian() [4/4]

Tensor libMesh::System::point_hessian ( unsigned int  var,
const Point p,
const NumericVector< Number > *  sol 
) const
inherited

Calls the parallel version of point_hessian().

This function exists only to prevent people from accidentally calling the version of point_hessian() that has a boolean third argument, which would result in incorrect output.

Definition at line 2601 of file system.C.

References libMesh::System::point_hessian().

2602 {
2603  return this->point_hessian(var, p, true, sol);
2604 }
Tensor point_hessian(unsigned int var, const Point &p, const bool insist_on_success=true, const NumericVector< Number > *sol=nullptr) const
Definition: system.C:2472

◆ point_value() [1/4]

Number libMesh::System::point_value ( unsigned int  var,
const Point p,
const bool  insist_on_success = true,
const NumericVector< Number > *  sol = nullptr 
) const
inherited
Returns
The value of the solution variable var at the physical point p in the mesh, without knowing a priori which element contains p, using the degree of freedom coefficients in sol (or in current_local_solution if sol is left null).
Note
This function uses MeshBase::sub_point_locator(); users may or may not want to call MeshBase::clear_point_locator() afterward. Also, point_locator() is expensive (N log N for initial construction, log N for evaluations). Avoid using this function in any context where you are already looping over elements.

Because the element containing p may lie on any processor, this function is parallel-only.

By default this method expects the point to reside inside the domain and will abort if no element can be found which contains p. The optional parameter insist_on_success can be set to false to allow the method to return 0 when the point is not located.

Definition at line 2199 of file system.C.

References libMesh::Variable::active_subdomains(), TIMPI::Communicator::broadcast(), libMesh::ParallelObject::comm(), libMesh::PointLocatorBase::enable_out_of_mesh_mode(), libMesh::System::get_dof_map(), libMesh::System::get_mesh(), libMesh::libmesh_assert(), mesh, TIMPI::Communicator::min(), libMesh::ParallelObject::n_processors(), libMesh::ParallelObject::processor_id(), libMesh::DofObject::processor_id(), and libMesh::System::variable().

Referenced by line_print(), main(), libMesh::System::point_value(), MeshInputTest::testCopyElementSolutionImpl(), MeshInputTest::testCopyElementVectorImpl(), MeshInputTest::testCopyNodalSolutionImpl(), DefaultCouplingTest::testCoupling(), PointNeighborCouplingTest::testCoupling(), MeshInputTest::testExodusWriteElementDataFromDiscontinuousNodalData(), PeriodicBCTest::testPeriodicBC(), SystemsTest::testProjectCubeWithMeshFunction(), and EquationSystemsTest::testRepartitionThenReinit().

2203 {
2204  // This function must be called on every processor; there's no
2205  // telling where in the partition p falls.
2206  parallel_object_only();
2207 
2208  // And every processor had better agree about which point we're
2209  // looking for
2210 #ifndef NDEBUG
2211  libmesh_assert(this->comm().verify(p(0)));
2212 #if LIBMESH_DIM > 1
2213  libmesh_assert(this->comm().verify(p(1)));
2214 #endif
2215 #if LIBMESH_DIM > 2
2216  libmesh_assert(this->comm().verify(p(2)));
2217 #endif
2218 #endif // NDEBUG
2219 
2220  // Get a reference to the mesh object associated with the system object that calls this function
2221  const MeshBase & mesh = this->get_mesh();
2222 
2223  // Use an existing PointLocator or create a new one
2224  std::unique_ptr<PointLocatorBase> locator_ptr = mesh.sub_point_locator();
2225  PointLocatorBase & locator = *locator_ptr;
2226 
2227  if (!insist_on_success || !mesh.is_serial())
2228  locator.enable_out_of_mesh_mode();
2229 
2230  // Get a pointer to an element that contains p and allows us to
2231  // evaluate var
2232  const std::set<subdomain_id_type> & raw_subdomains =
2233  this->variable(var).active_subdomains();
2234  const std::set<subdomain_id_type> * implicit_subdomains =
2235  raw_subdomains.empty() ? nullptr : &raw_subdomains;
2236  const Elem * e = locator(p, implicit_subdomains);
2237 
2238  Number u = 0;
2239 
2240  if (e && this->get_dof_map().is_evaluable(*e, var))
2241  u = point_value(var, p, *e, sol);
2242 
2243  // If I have an element containing p, then let's let everyone know
2244  processor_id_type lowest_owner =
2245  (e && (e->processor_id() == this->processor_id())) ?
2246  this->processor_id() : this->n_processors();
2247  this->comm().min(lowest_owner);
2248 
2249  // Everybody should get their value from a processor that was able
2250  // to compute it.
2251  // If nobody admits owning the point, we have a problem.
2252  if (lowest_owner != this->n_processors())
2253  this->comm().broadcast(u, lowest_owner);
2254  else
2255  libmesh_assert(!insist_on_success);
2256 
2257  return u;
2258 }
const Variable & variable(unsigned int var) const
Return a constant reference to Variable var.
Definition: system.C:2684
MeshBase & mesh
Number point_value(unsigned int var, const Point &p, const bool insist_on_success=true, const NumericVector< Number > *sol=nullptr) const
Definition: system.C:2199
const Parallel::Communicator & comm() const
const MeshBase & get_mesh() const
Definition: system.h:2359
uint8_t processor_id_type
processor_id_type n_processors() const
const std::set< subdomain_id_type > & active_subdomains() const
Definition: variable.h:181
void min(const T &r, T &o, Request &req) const
libmesh_assert(ctx)
void broadcast(T &data, const unsigned int root_id=0, const bool identical_sizes=false) const
processor_id_type processor_id() const
const DofMap & get_dof_map() const
Definition: system.h:2375

◆ point_value() [2/4]

Number libMesh::System::point_value ( unsigned int  var,
const Point p,
const Elem e,
const NumericVector< Number > *  sol = nullptr 
) const
inherited
Returns
The value of the solution variable var at the physical point p contained in local Elem e, using the degree of freedom coefficients in sol (or in current_local_solution if sol is left null).

This version of point_value can be run in serial, but assumes e is in the local mesh partition or is algebraically ghosted.

Definition at line 2260 of file system.C.

References libMesh::FEInterface::compute_data(), libMesh::Elem::contains_point(), libMesh::System::current_local_solution, libMesh::Elem::dim(), libMesh::DofMap::dof_indices(), libMesh::System::get_dof_map(), libMesh::System::get_equation_systems(), libMesh::FEMap::inverse_map(), libMesh::DofMap::is_evaluable(), libMesh::libmesh_assert(), and libMesh::DofMap::variable_type().

2264 {
2265  // Ensuring that the given point is really in the element is an
2266  // expensive assert, but as long as debugging is turned on we might
2267  // as well try to catch a particularly nasty potential error
2268  libmesh_assert (e.contains_point(p));
2269 
2270  if (!sol)
2271  sol = this->current_local_solution.get();
2272 
2273  // Get the dof map to get the proper indices for our computation
2274  const DofMap & dof_map = this->get_dof_map();
2275 
2276  // Make sure we can evaluate on this element.
2277  libmesh_assert (dof_map.is_evaluable(e, var));
2278 
2279  // Need dof_indices for phi[i][j]
2280  std::vector<dof_id_type> dof_indices;
2281 
2282  // Fill in the dof_indices for our element
2283  dof_map.dof_indices (&e, dof_indices, var);
2284 
2285  // Get the no of dofs associated with this point
2286  const unsigned int num_dofs = cast_int<unsigned int>
2287  (dof_indices.size());
2288 
2289  FEType fe_type = dof_map.variable_type(var);
2290 
2291  // Map the physical co-ordinates to the master co-ordinates
2292  Point coor = FEMap::inverse_map(e.dim(), &e, p);
2293 
2294  // get the shape function value via the FEInterface to also handle the case
2295  // of infinite elements correctly, the shape function is not fe->phi().
2296  FEComputeData fe_data(this->get_equation_systems(), coor);
2297  FEInterface::compute_data(e.dim(), fe_type, &e, fe_data);
2298 
2299  // Get ready to accumulate a value
2300  Number u = 0;
2301 
2302  for (unsigned int l=0; l<num_dofs; l++)
2303  {
2304  u += fe_data.shape[l] * (*sol)(dof_indices[l]);
2305  }
2306 
2307  return u;
2308 }
static Point inverse_map(const unsigned int dim, const Elem *elem, const Point &p, const Real tolerance=TOLERANCE, const bool secure=true, const bool extra_checks=true)
Definition: fe_map.C:1628
const EquationSystems & get_equation_systems() const
Definition: system.h:722
static void compute_data(const unsigned int dim, const FEType &fe_t, const Elem *elem, FEComputeData &data)
Lets the appropriate child of FEBase compute the requested data for the input specified in data...
libmesh_assert(ctx)
std::unique_ptr< NumericVector< Number > > current_local_solution
All the values I need to compute my contribution to the simulation at hand.
Definition: system.h:1628
const DofMap & get_dof_map() const
Definition: system.h:2375

◆ point_value() [3/4]

Number libMesh::System::point_value ( unsigned int  var,
const Point p,
const Elem e 
) const
inherited

Calls the version of point_value() which takes a reference.

This function exists only to prevent people from calling the version of point_value() that has a boolean third argument, which would result in unnecessary PointLocator calls.

Definition at line 2312 of file system.C.

References libMesh::libmesh_assert(), and libMesh::System::point_value().

2313 {
2314  libmesh_assert(e);
2315  return this->point_value(var, p, *e);
2316 }
Number point_value(unsigned int var, const Point &p, const bool insist_on_success=true, const NumericVector< Number > *sol=nullptr) const
Definition: system.C:2199
libmesh_assert(ctx)

◆ point_value() [4/4]

Number libMesh::System::point_value ( unsigned int  var,
const Point p,
const NumericVector< Number > *  sol 
) const
inherited

Calls the parallel version of point_value().

This function exists only to prevent people from accidentally calling the version of point_value() that has a boolean third argument, which would result in incorrect output.

Definition at line 2320 of file system.C.

References libMesh::System::point_value().

2321 {
2322  return this->point_value(var, p, true, sol);
2323 }
Number point_value(unsigned int var, const Point &p, const bool insist_on_success=true, const NumericVector< Number > *sol=nullptr) const
Definition: system.C:2199

◆ prefer_hash_table_matrix_assembly()

void libMesh::System::prefer_hash_table_matrix_assembly ( bool  preference)
inlineinherited

Sets whether to use hash table matrix assembly if the matrix sub-classes support it.

Definition at line 2627 of file system.h.

References libMesh::System::_matrices_initialized, and libMesh::System::_prefer_hash_table_matrix_assembly.

Referenced by main().

2628 {
2629  libmesh_error_msg_if(
2631  "System::prefer_hash_table_matrix_assembly() should be called before matrices are initialized");
2633 }
bool _prefer_hash_table_matrix_assembly
Whether to use hash table matrix assembly if the matrix sub-classes support it.
Definition: system.h:2325
bool _matrices_initialized
false when additional matrices being added require initialization, true otherwise.
Definition: system.h:2264

◆ prefix()

std::string libMesh::System::prefix ( ) const
inlineinherited
Returns
A prefix that may be applied to solver options. Note that this prefix is only used if prefix_with_name()

Definition at line 1961 of file system.h.

References libMesh::System::name().

Referenced by libMesh::ImplicitSystem::get_linear_solver(), libMesh::LinearImplicitSystem::solve(), and libMesh::NonlinearImplicitSystem::solve().

1961 { return this->name() + "_"; }
const std::string & name() const
Definition: system.h:2343

◆ prefix_with_name() [1/2]

void libMesh::System::prefix_with_name ( bool  value)
inlineinherited

Instructs this system to prefix solve options with its name for solvers that leverage prefixes.

Definition at line 1950 of file system.h.

References libMesh::System::_prefix_with_name, and value.

1950 { _prefix_with_name = value; }
static const bool value
Definition: xdr_io.C:55
bool _prefix_with_name
Whether we are name prefixing solver options.
Definition: system.h:2335

◆ prefix_with_name() [2/2]

bool libMesh::System::prefix_with_name ( ) const
inlineinherited
Returns
Whether we are name prefixing

Definition at line 1955 of file system.h.

References libMesh::System::_prefix_with_name.

Referenced by libMesh::ContinuationSystem::ContinuationSystem(), libMesh::ImplicitSystem::get_linear_solver(), libMesh::LinearImplicitSystem::solve(), libMesh::NonlinearImplicitSystem::solve(), and libMesh::System::System().

1955 { return _prefix_with_name; }
bool _prefix_with_name
Whether we are name prefixing solver options.
Definition: system.h:2335

◆ print_info()

void libMesh::ReferenceCounter::print_info ( std::ostream &  out_stream = libMesh::out)
staticinherited

Prints the reference information, by default to libMesh::out.

Definition at line 81 of file reference_counter.C.

References libMesh::ReferenceCounter::_enable_print_counter, and libMesh::ReferenceCounter::get_info().

Referenced by libMesh::LibMeshInit::~LibMeshInit().

82 {
84  out_stream << ReferenceCounter::get_info();
85 }
static std::string get_info()
Gets a string containing the reference information.
static bool _enable_print_counter
Flag to control whether reference count information is printed when print_info is called...

◆ processor_id()

processor_id_type libMesh::ParallelObject::processor_id ( ) const
inlineinherited
Returns
The rank of this processor in the group.

Definition at line 114 of file parallel_object.h.

References libMesh::ParallelObject::_communicator, and TIMPI::Communicator::rank().

Referenced by libMesh::BoundaryInfo::_find_id_maps(), libMesh::PetscDMWrapper::add_dofs_to_section(), libMesh::DistributedMesh::add_elem(), libMesh::BoundaryInfo::add_elements(), libMesh::DofMap::add_neighbors_to_send_list(), libMesh::DistributedMesh::add_node(), libMesh::MeshTools::Modification::all_tri(), libMesh::DofMap::allgather_recursive_constraints(), libMesh::FEMSystem::assembly(), libMesh::Nemesis_IO::assert_symmetric_cmaps(), libMesh::Partitioner::assign_partitioning(), libMesh::Nemesis_IO_Helper::build_element_and_node_maps(), libMesh::Partitioner::build_graph(), libMesh::InfElemBuilder::build_inf_elem(), libMesh::BoundaryInfo::build_node_list_from_side_list(), libMesh::EquationSystems::build_parallel_elemental_solution_vector(), libMesh::EquationSystems::build_parallel_solution_vector(), libMesh::MeshFunction::check_found_elem(), libMesh::DistributedMesh::clear(), libMesh::DistributedMesh::clear_elems(), libMesh::ExodusII_IO_Helper::close(), libMesh::Nemesis_IO_Helper::compute_border_node_ids(), libMesh::Nemesis_IO_Helper::compute_communication_map_parameters(), libMesh::Nemesis_IO_Helper::compute_internal_and_border_elems_and_internal_nodes(), libMesh::RBConstruction::compute_max_error_bound(), libMesh::Nemesis_IO_Helper::compute_node_communication_maps(), libMesh::Nemesis_IO_Helper::compute_num_global_elem_blocks(), libMesh::Nemesis_IO_Helper::compute_num_global_nodesets(), libMesh::Nemesis_IO_Helper::compute_num_global_sidesets(), libMesh::Nemesis_IO_Helper::construct_nemesis_filename(), libMesh::ExodusII_IO::copy_elemental_solution(), libMesh::ExodusII_IO::copy_nodal_solution(), libMesh::ExodusII_IO::copy_scalar_solution(), libMesh::Nemesis_IO::copy_scalar_solution(), libMesh::MeshTools::correct_node_proc_ids(), libMesh::ExodusII_IO_Helper::create(), libMesh::DistributedMesh::delete_elem(), libMesh::MeshCommunication::delete_remote_elements(), libMesh::DofMap::distribute_dofs(), libMesh::DofMap::distribute_scalar_dofs(), libMesh::DistributedMesh::DistributedMesh(), libMesh::DofMapBase::end_dof(), libMesh::DofMapBase::end_old_dof(), libMesh::EnsightIO::EnsightIO(), libMesh::GenericProjector< FFunctor, GFunctor, FValue, ProjectionAction >::SubFunctor::find_dofs_to_send(), libMesh::UnstructuredMesh::find_neighbors(), libMesh::DofMapBase::first_dof(), libMesh::DofMapBase::first_old_dof(), libMesh::RBEIMEvaluation::gather_bfs(), libMesh::Nemesis_IO_Helper::get_cmap_params(), libMesh::Nemesis_IO_Helper::get_eb_info_global(), libMesh::Nemesis_IO_Helper::get_elem_cmap(), libMesh::Nemesis_IO_Helper::get_elem_map(), libMesh::MeshBase::get_info(), libMesh::DofMap::get_info(), libMesh::Nemesis_IO_Helper::get_init_global(), libMesh::Nemesis_IO_Helper::get_init_info(), libMesh::RBEIMEvaluation::get_interior_basis_functions_as_vecs(), libMesh::Nemesis_IO_Helper::get_loadbal_param(), libMesh::DofMap::get_local_constraints(), libMesh::MeshBase::get_local_constraints(), libMesh::Nemesis_IO_Helper::get_node_cmap(), libMesh::Nemesis_IO_Helper::get_node_map(), libMesh::Nemesis_IO_Helper::get_ns_param_global(), libMesh::Nemesis_IO_Helper::get_ss_param_global(), libMesh::SparsityPattern::Build::handle_vi_vj(), libMesh::LaplaceMeshSmoother::init(), libMesh::SystemSubsetBySubdomain::init(), HeatSystem::init_data(), libMesh::ExodusII_IO_Helper::initialize(), libMesh::ExodusII_IO_Helper::initialize_element_variables(), libMesh::ExodusII_IO_Helper::initialize_global_variables(), libMesh::ExodusII_IO_Helper::initialize_nodal_variables(), libMesh::DistributedMesh::insert_elem(), libMesh::DofMap::is_evaluable(), libMesh::SparsityPattern::Build::join(), libMesh::TransientRBEvaluation::legacy_write_offline_data_to_files(), libMesh::RBSCMEvaluation::legacy_write_offline_data_to_files(), libMesh::RBEvaluation::legacy_write_offline_data_to_files(), libMesh::MeshTools::libmesh_assert_consistent_distributed(), libMesh::MeshTools::libmesh_assert_consistent_distributed_nodes(), libMesh::MeshTools::libmesh_assert_contiguous_dof_ids(), libMesh::MeshTools::libmesh_assert_parallel_consistent_procids< Elem >(), libMesh::MeshTools::libmesh_assert_valid_neighbors(), libMesh::DistributedMesh::libmesh_assert_valid_parallel_object_ids(), libMesh::DofMap::local_variable_indices(), main(), libMesh::MeshRefinement::make_coarsening_compatible(), AugmentSparsityOnInterface::mesh_reinit(), libMesh::TriangulatorInterface::MeshedHole::MeshedHole(), libMesh::MeshBase::n_active_local_elem(), libMesh::BoundaryInfo::n_boundary_conds(), libMesh::MeshTools::n_connected_components(), libMesh::MeshBase::n_constraint_rows(), libMesh::BoundaryInfo::n_edge_conds(), libMesh::DofMapBase::n_local_dofs(), libMesh::MeshBase::n_local_elem(), libMesh::MeshBase::n_local_nodes(), libMesh::BoundaryInfo::n_nodeset_conds(), libMesh::BoundaryInfo::n_shellface_conds(), libMesh::RBEIMEvaluation::node_gather_bfs(), libMesh::DistributedMesh::own_node(), libMesh::BoundaryInfo::parallel_sync_node_ids(), libMesh::BoundaryInfo::parallel_sync_side_ids(), libMesh::System::point_gradient(), libMesh::System::point_hessian(), libMesh::System::point_value(), libMesh::MeshBase::print_constraint_rows(), libMesh::DofMap::print_dof_constraints(), libMesh::DofMap::process_mesh_constraint_rows(), libMesh::Nemesis_IO_Helper::put_cmap_params(), libMesh::Nemesis_IO_Helper::put_elem_cmap(), libMesh::Nemesis_IO_Helper::put_elem_map(), libMesh::Nemesis_IO_Helper::put_loadbal_param(), libMesh::Nemesis_IO_Helper::put_node_cmap(), libMesh::Nemesis_IO_Helper::put_node_map(), libMesh::NameBasedIO::read(), libMesh::Nemesis_IO::read(), libMesh::XdrIO::read(), libMesh::CheckpointIO::read(), libMesh::EquationSystems::read(), libMesh::ExodusII_IO_Helper::read_elem_num_map(), libMesh::ExodusII_IO_Helper::read_global_values(), libMesh::ExodusII_IO::read_header(), libMesh::CheckpointIO::read_header(), libMesh::XdrIO::read_header(), libMesh::System::read_header(), libMesh::System::read_legacy_data(), libMesh::DynaIO::read_mesh(), libMesh::ExodusII_IO_Helper::read_node_num_map(), libMesh::System::read_parallel_data(), libMesh::TransientRBConstruction::read_riesz_representors_from_files(), libMesh::RBConstruction::read_riesz_representors_from_files(), libMesh::System::read_SCALAR_dofs(), libMesh::XdrIO::read_serialized_bc_names(), libMesh::XdrIO::read_serialized_bcs_helper(), libMesh::System::read_serialized_blocked_dof_objects(), libMesh::XdrIO::read_serialized_connectivity(), libMesh::System::read_serialized_data(), libMesh::XdrIO::read_serialized_nodes(), libMesh::XdrIO::read_serialized_nodesets(), libMesh::XdrIO::read_serialized_subdomain_names(), libMesh::System::read_serialized_vector(), libMesh::System::read_serialized_vectors(), libMesh::Nemesis_IO_Helper::read_var_names_impl(), libMesh::SimplexRefiner::refine_via_edges(), libMesh::StaticCondensationDofMap::reinit(), libMesh::DistributedMesh::renumber_dof_objects(), libMesh::DistributedMesh::renumber_nodes_and_elements(), libMesh::DofMap::scatter_constraints(), libMesh::CheckpointIO::select_split_config(), libMesh::DistributedMesh::set_next_unique_id(), libMesh::DofMap::set_nonlocal_dof_objects(), libMesh::PetscDMWrapper::set_point_range_in_section(), libMesh::RBEIMEvaluation::side_gather_bfs(), ExodusTest< elem_type >::test_read_gold(), ExodusTest< elem_type >::test_write(), MeshInputTest::testAbaqusRead(), MeshInputTest::testBadGmsh(), BoundaryInfoTest::testBoundaryIDs(), MeshInputTest::testCopyElementSolutionImpl(), MeshInputTest::testCopyElementVectorImpl(), MeshInputTest::testCopyNodalSolutionImpl(), DefaultCouplingTest::testCoupling(), PointNeighborCouplingTest::testCoupling(), MeshInputTest::testDynaFileMappings(), MeshInputTest::testDynaNoSplines(), MeshInputTest::testDynaReadElem(), MeshInputTest::testDynaReadPatch(), MeshInputTest::testExodusFileMappings(), MeshInputTest::testExodusIGASidesets(), MeshInputTest::testExodusWriteElementDataFromDiscontinuousNodalData(), MeshInputTest::testGmshBCIDOverlap(), MeshInputTest::testGoodGmsh(), MeshInputTest::testGoodSTL(), MeshInputTest::testGoodSTLBinary(), MeshInputTest::testLowOrderEdgeBlocks(), SystemsTest::testProjectMatrix3D(), BoundaryInfoTest::testShellFaceConstraints(), MeshInputTest::testSingleElementImpl(), WriteVecAndScalar::testSolution(), CheckpointIOTest::testSplitter(), MeshInputTest::testTetgenIO(), libMesh::MeshTools::total_weight(), libMesh::NetGenMeshInterface::triangulate(), libMesh::MeshRefinement::uniformly_coarsen(), libMesh::DistributedMesh::update_parallel_id_counts(), libMesh::DTKAdapter::update_variable_values(), libMesh::MeshTools::volume(), libMesh::STLIO::write(), libMesh::NameBasedIO::write(), libMesh::XdrIO::write(), libMesh::CheckpointIO::write(), libMesh::EquationSystems::write(), libMesh::GMVIO::write_discontinuous_gmv(), libMesh::ExodusII_IO::write_element_data(), libMesh::ExodusII_IO_Helper::write_element_values(), libMesh::ExodusII_IO_Helper::write_element_values_element_major(), libMesh::ExodusII_IO_Helper::write_elements(), libMesh::ExodusII_IO_Helper::write_elemset_data(), libMesh::ExodusII_IO_Helper::write_elemsets(), libMesh::ExodusII_IO::write_global_data(), libMesh::ExodusII_IO_Helper::write_global_values(), libMesh::System::write_header(), libMesh::ExodusII_IO::write_information_records(), libMesh::ExodusII_IO_Helper::write_information_records(), libMesh::ExodusII_IO_Helper::write_nodal_coordinates(), libMesh::UCDIO::write_nodal_data(), libMesh::VTKIO::write_nodal_data(), libMesh::ExodusII_IO::write_nodal_data(), libMesh::ExodusII_IO::write_nodal_data_common(), libMesh::ExodusII_IO::write_nodal_data_discontinuous(), libMesh::ExodusII_IO_Helper::write_nodal_values(), libMesh::ExodusII_IO_Helper::write_nodeset_data(), libMesh::Nemesis_IO_Helper::write_nodesets(), libMesh::ExodusII_IO_Helper::write_nodesets(), libMesh::RBEIMEvaluation::write_out_interior_basis_functions(), libMesh::RBEIMEvaluation::write_out_node_basis_functions(), libMesh::RBEIMEvaluation::write_out_side_basis_functions(), write_output_solvedata(), libMesh::System::write_parallel_data(), libMesh::RBConstruction::write_riesz_representors_to_files(), libMesh::System::write_SCALAR_dofs(), libMesh::XdrIO::write_serialized_bc_names(), libMesh::XdrIO::write_serialized_bcs_helper(), libMesh::System::write_serialized_blocked_dof_objects(), libMesh::XdrIO::write_serialized_connectivity(), libMesh::System::write_serialized_data(), libMesh::XdrIO::write_serialized_nodes(), libMesh::XdrIO::write_serialized_nodesets(), libMesh::XdrIO::write_serialized_subdomain_names(), libMesh::System::write_serialized_vector(), libMesh::System::write_serialized_vectors(), libMesh::ExodusII_IO_Helper::write_sideset_data(), libMesh::Nemesis_IO_Helper::write_sidesets(), libMesh::ExodusII_IO_Helper::write_sidesets(), libMesh::ExodusII_IO::write_timestep(), libMesh::ExodusII_IO_Helper::write_timestep(), and libMesh::ExodusII_IO::write_timestep_discontinuous().

115  { return cast_int<processor_id_type>(_communicator.rank()); }
processor_id_type rank() const
const Parallel::Communicator & _communicator

◆ project_solution() [1/3]

void libMesh::System::project_solution ( FunctionBase< Number > *  f,
FunctionBase< Gradient > *  g = nullptr 
) const
inherited

Projects arbitrary functions onto the current solution.

This method projects an arbitrary function onto the solution via L2 projections and nodal interpolations on each element.

The function value f and its gradient g are user-provided cloneable functors. A gradient g is only required/used for projecting onto finite element spaces with continuous derivatives.

Definition at line 1041 of file system_projection.C.

Referenced by init_sys(), initialize(), main(), set_initial_condition(), SlitMeshRefinedSystemTest::setUp(), FETestBase< order, family, elem_type, 1 >::setUp(), MeshfunctionDFEM::test_mesh_function_dfem(), MeshfunctionDFEM::test_mesh_function_dfem_grad(), MeshFunctionTest::test_p_level(), MeshFunctionTest::test_subdomain_id_sets(), MeshInputTest::testCopyElementSolutionImpl(), MeshInputTest::testCopyNodalSolutionImpl(), DefaultCouplingTest::testCoupling(), PointNeighborCouplingTest::testCoupling(), SystemsTest::testProjectCubeWithMeshFunction(), MeshInputTest::testProjectionRegression(), EquationSystemsTest::testRepartitionThenReinit(), and libMesh::MeshfreeSolutionTransfer::transfer().

1043 {
1044  this->project_vector(*solution, f, g);
1045 
1046  solution->localize(*current_local_solution, _dof_map->get_send_list());
1047 }
std::unique_ptr< DofMap > _dof_map
Data structure describing the relationship between nodes, variables, etc...
Definition: system.h:2202
std::unique_ptr< NumericVector< Number > > solution
Data structure to hold solution values.
Definition: system.h:1616
std::unique_ptr< NumericVector< Number > > current_local_solution
All the values I need to compute my contribution to the simulation at hand.
Definition: system.h:1628
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...

◆ project_solution() [2/3]

void libMesh::System::project_solution ( FEMFunctionBase< Number > *  f,
FEMFunctionBase< Gradient > *  g = nullptr 
) const
inherited

Projects arbitrary functions onto the current solution.

This method projects an arbitrary function onto the solution via L2 projections and nodal interpolations on each element.

The function value f and its gradient g are user-provided cloneable functors. A gradient g is only required/used for projecting onto finite element spaces with continuous derivatives.

Definition at line 1054 of file system_projection.C.

1056 {
1057  this->project_vector(*solution, f, g);
1058 
1059  solution->localize(*current_local_solution, _dof_map->get_send_list());
1060 }
std::unique_ptr< DofMap > _dof_map
Data structure describing the relationship between nodes, variables, etc...
Definition: system.h:2202
std::unique_ptr< NumericVector< Number > > solution
Data structure to hold solution values.
Definition: system.h:1616
std::unique_ptr< NumericVector< Number > > current_local_solution
All the values I need to compute my contribution to the simulation at hand.
Definition: system.h:1628
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...

◆ project_solution() [3/3]

void libMesh::System::project_solution ( ValueFunctionPointer  fptr,
GradientFunctionPointer  gptr,
const Parameters parameters 
) const
inherited

This method projects an arbitrary function onto the solution via L2 projections and nodal interpolations on each element.

Definition at line 1027 of file system_projection.C.

References fptr(), and gptr().

1030 {
1031  WrappedFunction<Number> f(*this, fptr, &function_parameters);
1032  WrappedFunction<Gradient> g(*this, gptr, &function_parameters);
1033  this->project_solution(&f, &g);
1034 }
Number fptr(const Point &p, const Parameters &, const std::string &libmesh_dbg_var(sys_name), const std::string &unknown_name)
Definition: projection.C:81
void project_solution(FunctionBase< Number > *f, FunctionBase< Gradient > *g=nullptr) const
Projects arbitrary functions onto the current solution.
Gradient gptr(const Point &p, const Parameters &, const std::string &libmesh_dbg_var(sys_name), const std::string &unknown_name)
Definition: projection.C:96

◆ project_solution_on_reinit()

bool& libMesh::System::project_solution_on_reinit ( void  )
inlineinherited

Tells the System whether or not to project the solution vector onto new grids when the system is reinitialized.

The solution will be projected unless project_solution_on_reinit() = false is called.

Definition at line 839 of file system.h.

References libMesh::System::_solution_projection.

Referenced by libMesh::UniformRefinementEstimator::_estimate_error(), libMesh::AdjointRefinementEstimator::estimate_error(), and libMesh::MemoryHistoryData::store_vectors().

840  { return _solution_projection; }
bool _solution_projection
Holds true if the solution vector should be projected onto a changed grid, false if it should be zero...
Definition: system.h:2271

◆ project_vector() [1/5]

void libMesh::System::project_vector ( NumericVector< Number > &  new_vector,
FunctionBase< Number > *  f,
FunctionBase< Gradient > *  g = nullptr,
int  is_adjoint = -1 
) const
inherited

Projects arbitrary functions onto a vector of degree of freedom values for the current system.

This method projects an arbitrary function via L2 projections and nodal interpolations on each element.

The function value f and its gradient g are user-provided cloneable functors. A gradient g is only required/used for projecting onto finite element spaces with continuous derivatives.

Constrain the new vector using the requested adjoint rather than primal constraints if is_adjoint is non-negative.

Definition at line 1082 of file system_projection.C.

References libMesh::libmesh_assert().

Referenced by main(), libMesh::NewmarkSolver::project_initial_accel(), libMesh::SecondOrderUnsteadySolver::project_initial_rate(), libMesh::InterMeshProjection::project_system_vectors(), and libMesh::System::restrict_vectors().

1086 {
1087  LOG_SCOPE ("project_vector(FunctionBase)", "System");
1088 
1089  libmesh_assert(f);
1090 
1091  WrappedFunctor<Number> f_fem(*f);
1092 
1093  if (g)
1094  {
1095  WrappedFunctor<Gradient> g_fem(*g);
1096 
1097  this->project_vector(new_vector, &f_fem, &g_fem, is_adjoint);
1098  }
1099  else
1100  this->project_vector(new_vector, &f_fem, nullptr, is_adjoint);
1101 }
libmesh_assert(ctx)
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...

◆ project_vector() [2/5]

void libMesh::System::project_vector ( NumericVector< Number > &  new_vector,
FEMFunctionBase< Number > *  f,
FEMFunctionBase< Gradient > *  g = nullptr,
int  is_adjoint = -1 
) const
inherited

Projects arbitrary functions onto a vector of degree of freedom values for the current system.

This method projects an arbitrary function via L2 projections and nodal interpolations on each element.

The function value f and its gradient g are user-provided cloneable functors. A gradient g is only required/used for projecting onto finite element spaces with continuous derivatives.

Constrain the new vector using the requested adjoint rather than primal constraints if is_adjoint is non-negative.

Definition at line 1108 of file system_projection.C.

References libMesh::NumericVector< T >::close(), libMesh::FEMFunctionBase< Output >::component(), libMesh::FEType::family, libMesh::Utility::iota(), libMesh::libmesh_assert(), libMesh::libmesh_ignore(), libMesh::make_range(), n_vars, libMesh::NODEELEM, libMesh::FEMContext::pre_fe_reinit(), libMesh::RATIONAL_BERNSTEIN, libMesh::SCALAR, libMesh::DofMap::SCALAR_dof_indices(), libMesh::NumericVector< T >::set(), and libMesh::Variable::type().

1112 {
1113  LOG_SCOPE ("project_fem_vector()", "System");
1114 
1115  libmesh_assert (f);
1116 
1117  ConstElemRange active_local_range
1118  (this->get_mesh().active_local_elements_begin(),
1119  this->get_mesh().active_local_elements_end() );
1120 
1121  VectorSetAction<Number> setter(new_vector);
1122 
1123  const unsigned int n_variables = this->n_vars();
1124 
1125  std::vector<unsigned int> vars(n_variables);
1126  std::iota(vars.begin(), vars.end(), 0);
1127 
1128  // Use a typedef to make the calling sequence for parallel_for() a bit more readable
1129  typedef
1130  GenericProjector<FEMFunctionWrapper<Number>, FEMFunctionWrapper<Gradient>,
1131  Number, VectorSetAction<Number>> FEMProjector;
1132 
1133  FEMFunctionWrapper<Number> fw(*f);
1134 
1135  if (g)
1136  {
1137  FEMFunctionWrapper<Gradient> gw(*g);
1138 
1139  FEMProjector projector(*this, fw, &gw, setter, vars);
1140  projector.project(active_local_range);
1141  }
1142  else
1143  {
1144  FEMProjector projector(*this, fw, nullptr, setter, vars);
1145  projector.project(active_local_range);
1146  }
1147 
1148  // Also, load values into the SCALAR dofs
1149  // Note: We assume that all SCALAR dofs are on the
1150  // processor with highest ID
1151  if (this->processor_id() == (this->n_processors()-1))
1152  {
1153  // FIXME: Do we want to first check for SCALAR vars before building this? [PB]
1154  FEMContext context( *this );
1155 
1156  const DofMap & dof_map = this->get_dof_map();
1157  for (auto var : make_range(this->n_vars()))
1158  if (this->variable(var).type().family == SCALAR)
1159  {
1160  // FIXME: We reinit with an arbitrary element in case the user
1161  // doesn't override FEMFunctionBase::component. Is there
1162  // any use case we're missing? [PB]
1163  context.pre_fe_reinit(*this, *(this->get_mesh().active_local_elements_begin()));
1164 
1165  std::vector<dof_id_type> SCALAR_indices;
1166  dof_map.SCALAR_dof_indices (SCALAR_indices, var);
1167  const unsigned int n_SCALAR_dofs =
1168  cast_int<unsigned int>(SCALAR_indices.size());
1169 
1170  for (unsigned int i=0; i<n_SCALAR_dofs; i++)
1171  {
1172  const dof_id_type global_index = SCALAR_indices[i];
1173  const unsigned int component_index =
1174  this->variable_scalar_number(var,i);
1175 
1176  new_vector.set(global_index, f->component(context, component_index, Point(), this->time));
1177  }
1178  }
1179  }
1180 
1181  new_vector.close();
1182 
1183  // Look for spline bases, in which case we need to backtrack
1184  // to calculate the spline DoF values.
1185  std::vector<const Variable *> rational_vars;
1186  for (auto varnum : vars)
1187  {
1188  const Variable & var = this->get_dof_map().variable(varnum);
1189  if (var.type().family == RATIONAL_BERNSTEIN)
1190  rational_vars.push_back(&var);
1191  }
1192 
1193  // Okay, but are we really using any *spline* bases, or just
1194  // unconstrained rational bases?
1195  bool using_spline_bases = false;
1196  if (!rational_vars.empty())
1197  {
1198  // Look for a spline node: a NodeElem with a rational variable
1199  // on it.
1200  for (auto & elem : active_local_range)
1201  if (elem->type() == NODEELEM)
1202  for (auto rational_var : rational_vars)
1203  if (rational_var->active_on_subdomain(elem->subdomain_id()))
1204  {
1205  using_spline_bases = true;
1206  goto checked_on_splines;
1207  }
1208  }
1209 
1210 checked_on_splines:
1211 
1212  // Not every processor may have a NodeElem, especially while
1213  // we're not partitioning them efficiently yet.
1214  this->comm().max(using_spline_bases);
1215 
1216  if (using_spline_bases)
1217  this->solve_for_unconstrained_dofs(new_vector, is_adjoint);
1218 
1219 #ifdef LIBMESH_ENABLE_CONSTRAINTS
1220  if (is_adjoint == -1)
1221  this->get_dof_map().enforce_constraints_exactly(*this, &new_vector);
1222  else if (is_adjoint >= 0)
1224  is_adjoint);
1225 #else
1226  libmesh_ignore(is_adjoint);
1227 #endif
1228 }
Real time
For time-dependent problems, this is the time t at the beginning of the current timestep.
Definition: system.h:1638
unsigned int variable_scalar_number(std::string_view var, unsigned int component) const
Definition: system.h:2432
const Variable & variable(unsigned int var) const
Return a constant reference to Variable var.
Definition: system.C:2684
const Parallel::Communicator & comm() const
const MeshBase & get_mesh() const
Definition: system.h:2359
void iota(ForwardIter first, ForwardIter last, T value)
Utility::iota was created back when std::iota was just an SGI STL extension.
Definition: utility.h:229
StoredRange< MeshBase::const_element_iterator, const Elem * > ConstElemRange
Definition: elem_range.h:34
const Variable & variable(const unsigned int c) const override
Definition: dof_map.h:2356
void enforce_adjoint_constraints_exactly(NumericVector< Number > &v, unsigned int q) const
Heterogeneously constrains the numeric vector v, which represents an adjoint solution defined on the ...
Definition: dof_map.h:2520
processor_id_type n_processors() const
void libmesh_ignore(const Args &...)
libmesh_assert(ctx)
virtual void close()=0
Calls the NumericVector&#39;s internal assembly routines, ensuring that the values are consistent across ...
void max(const T &r, T &o, Request &req) const
virtual Output component(const FEMContext &, unsigned int i, const Point &p, Real time=0.)
IntRange< T > make_range(T beg, T end)
The 2-parameter make_range() helper function returns an IntRange<T> when both input parameters are of...
Definition: int_range.h:140
virtual void set(const numeric_index_type i, const T value)=0
Sets v(i) = value.
unsigned int n_vars() const
Definition: system.C:2654
processor_id_type processor_id() const
const DofMap & get_dof_map() const
Definition: system.h:2375
void solve_for_unconstrained_dofs(NumericVector< Number > &, int is_adjoint=-1) const
uint8_t dof_id_type
Definition: id_types.h:67
void enforce_constraints_exactly(const System &system, NumericVector< Number > *v=nullptr, bool homogeneous=false) const
Constrains the numeric vector v, which represents a solution defined on the mesh. ...
Definition: dof_map.h:2516

◆ project_vector() [3/5]

void libMesh::System::project_vector ( ValueFunctionPointer  fptr,
GradientFunctionPointer  gptr,
const Parameters parameters,
NumericVector< Number > &  new_vector,
int  is_adjoint = -1 
) const
inherited

Projects arbitrary functions onto a vector of degree of freedom values for the current system.

This method projects an arbitrary function via L2 projections and nodal interpolations on each element.

The function value fptr and its gradient gptr are represented by function pointers. A gradient gptr is only required/used for projecting onto finite element spaces with continuous derivatives.

Constrain the new vector using the requested adjoint rather than primal constraints if is_adjoint is non-negative.

Definition at line 1067 of file system_projection.C.

References fptr(), and gptr().

1072 {
1073  WrappedFunction<Number> f(*this, fptr, &function_parameters);
1074  WrappedFunction<Gradient> g(*this, gptr, &function_parameters);
1075  this->project_vector(new_vector, &f, &g, is_adjoint);
1076 }
Number fptr(const Point &p, const Parameters &, const std::string &libmesh_dbg_var(sys_name), const std::string &unknown_name)
Definition: projection.C:81
Gradient gptr(const Point &p, const Parameters &, const std::string &libmesh_dbg_var(sys_name), const std::string &unknown_name)
Definition: projection.C:96
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...

◆ project_vector() [4/5]

void libMesh::System::project_vector ( NumericVector< Number > &  vector,
int  is_adjoint = -1 
) const
protectedinherited

Projects the vector defined on the old mesh onto the new mesh.

Constrain the new vector using the requested adjoint rather than primal constraints if is_adjoint is non-negative.

Definition at line 247 of file system_projection.C.

References libMesh::NumericVector< T >::clone().

249 {
250  // Create a copy of the vector, which currently
251  // contains the old data.
252  std::unique_ptr<NumericVector<Number>>
253  old_vector (vector.clone());
254 
255  // Project the old vector to the new vector
256  this->project_vector (*old_vector, vector, is_adjoint);
257 }
virtual std::unique_ptr< NumericVector< T > > clone() const =0
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...

◆ project_vector() [5/5]

void libMesh::System::project_vector ( const NumericVector< Number > &  old_v,
NumericVector< Number > &  new_v,
int  is_adjoint = -1 
) const
protectedinherited

Projects the vector defined on the old mesh onto the new mesh.

This method projects the vector via L2 projections or nodal interpolations on each element.

The original vector is unchanged and the new vector is passed through the second argument.

Constrain the new vector using the requested adjoint rather than primal constraints if is_adjoint is non-negative.

This method projects a solution from an old mesh to a current, refined mesh. The input vector old_v gives the solution on the old mesh, while the new_v gives the solution (to be computed) on the new mesh.

Definition at line 265 of file system_projection.C.

References libMesh::NumericVector< T >::clear(), libMesh::NumericVector< T >::close(), libMesh::NumericVector< T >::get(), libMesh::GHOSTED, libMesh::index_range(), libMesh::NumericVector< T >::init(), libMesh::Utility::iota(), libMesh::libmesh_assert(), libMesh::libmesh_ignore(), libMesh::NumericVector< T >::local_size(), libMesh::NumericVector< T >::localize(), libMesh::make_range(), n_vars, libMesh::PARALLEL, libMesh::Threads::parallel_reduce(), libMesh::SCALAR, libMesh::DofMap::SCALAR_dof_indices(), libMesh::BuildProjectionList::send_list, libMesh::SERIAL, libMesh::NumericVector< T >::set(), libMesh::NumericVector< T >::size(), libMesh::NumericVector< T >::type(), libMesh::TYPE_SCALAR, and libMesh::BuildProjectionList::unique().

268 {
269  LOG_SCOPE ("project_vector(old,new)", "System");
270 
277  new_v.clear();
278 
279 #ifdef LIBMESH_ENABLE_AMR
280 
281  // Resize the new vector and get a serial version.
282  NumericVector<Number> * new_vector_ptr = nullptr;
283  std::unique_ptr<NumericVector<Number>> new_vector_built;
284  NumericVector<Number> * local_old_vector;
285  std::unique_ptr<NumericVector<Number>> local_old_vector_built;
286  const NumericVector<Number> * old_vector_ptr = nullptr;
287 
288  ConstElemRange active_local_elem_range
289  (this->get_mesh().active_local_elements_begin(),
290  this->get_mesh().active_local_elements_end());
291 
292  // If the old vector was uniprocessor, make the new
293  // vector uniprocessor
294  if (old_v.type() == SERIAL)
295  {
296  new_v.init (this->n_dofs(), false, SERIAL);
297  new_vector_ptr = &new_v;
298  old_vector_ptr = &old_v;
299  }
300 
301  // Otherwise it is a parallel, distributed vector, which
302  // we need to localize.
303  else if (old_v.type() == PARALLEL)
304  {
305  // Build a send list for efficient localization
306  BuildProjectionList projection_list(*this);
307  Threads::parallel_reduce (active_local_elem_range,
308  projection_list);
309 
310  // Create a sorted, unique send_list
311  projection_list.unique();
312 
313  new_v.init (this->n_dofs(), this->n_local_dofs(), false, PARALLEL);
314  new_vector_built = NumericVector<Number>::build(this->comm());
315  local_old_vector_built = NumericVector<Number>::build(this->comm());
316  new_vector_ptr = new_vector_built.get();
317  local_old_vector = local_old_vector_built.get();
318  new_vector_ptr->init(this->n_dofs(), this->n_local_dofs(),
319  this->get_dof_map().get_send_list(), false,
320  GHOSTED);
321  local_old_vector->init(old_v.size(), old_v.local_size(),
322  projection_list.send_list, false, GHOSTED);
323  old_v.localize(*local_old_vector, projection_list.send_list);
324  local_old_vector->close();
325  old_vector_ptr = local_old_vector;
326  }
327  else if (old_v.type() == GHOSTED)
328  {
329  // Build a send list for efficient localization
330  BuildProjectionList projection_list(*this);
331  Threads::parallel_reduce (active_local_elem_range,
332  projection_list);
333 
334  // Create a sorted, unique send_list
335  projection_list.unique();
336 
337  new_v.init (this->n_dofs(), this->n_local_dofs(),
338  this->get_dof_map().get_send_list(), false, GHOSTED);
339 
340  local_old_vector_built = NumericVector<Number>::build(this->comm());
341  new_vector_ptr = &new_v;
342  local_old_vector = local_old_vector_built.get();
343  local_old_vector->init(old_v.size(), old_v.local_size(),
344  projection_list.send_list, false, GHOSTED);
345  old_v.localize(*local_old_vector, projection_list.send_list);
346  local_old_vector->close();
347  old_vector_ptr = local_old_vector;
348  }
349  else // unknown old_v.type()
350  libmesh_error_msg("ERROR: Unknown old_v.type() == " << old_v.type());
351 
352  // Note that the above will have zeroed the new_vector.
353  // Just to be sure, assert that new_vector_ptr and old_vector_ptr
354  // were successfully set before trying to deref them.
355  libmesh_assert(new_vector_ptr);
356  libmesh_assert(old_vector_ptr);
357 
358  NumericVector<Number> & new_vector = *new_vector_ptr;
359  const NumericVector<Number> & old_vector = *old_vector_ptr;
360 
361  const unsigned int n_variables = this->n_vars();
362 
363  if (n_variables)
364  {
365  std::vector<unsigned int> vars(n_variables);
366  std::iota(vars.begin(), vars.end(), 0);
367  std::vector<unsigned int> regular_vars, vector_vars;
368  for (auto var : vars)
369  {
371  regular_vars.push_back(var);
372  else
373  vector_vars.push_back(var);
374  }
375 
376  VectorSetAction<Number> setter(new_vector);
377 
378  if (!regular_vars.empty())
379  {
380  // Use a typedef to make the calling sequence for parallel_for() a bit more readable
381  typedef
382  GenericProjector<OldSolutionValue<Number, &FEMContext::point_value>,
383  OldSolutionValue<Gradient, &FEMContext::point_gradient>,
384  Number, VectorSetAction<Number>> FEMProjector;
385 
386  OldSolutionValue<Number, &FEMContext::point_value>
387  f(*this, old_vector, &regular_vars);
388  OldSolutionValue<Gradient, &FEMContext::point_gradient>
389  g(*this, old_vector, &regular_vars);
390 
391  FEMProjector projector(*this, f, &g, setter, regular_vars);
392  projector.project(active_local_elem_range);
393  }
394 
395  if (!vector_vars.empty())
396  {
397  typedef
398  GenericProjector<OldSolutionValue<Gradient, &FEMContext::point_value>,
399  OldSolutionValue<Tensor, &FEMContext::point_gradient>,
400  Gradient, VectorSetAction<Number>> FEMVectorProjector;
401 
402  OldSolutionValue<Gradient, &FEMContext::point_value> f_vector(*this, old_vector, &vector_vars);
403  OldSolutionValue<Tensor, &FEMContext::point_gradient> g_vector(*this, old_vector, &vector_vars);
404 
405  FEMVectorProjector vector_projector(*this, f_vector, &g_vector, setter, vector_vars);
406  vector_projector.project(active_local_elem_range);
407  }
408 
409  // Copy the SCALAR dofs from old_vector to new_vector
410  // Note: We assume that all SCALAR dofs are on the
411  // processor with highest ID
412  if (this->processor_id() == (this->n_processors()-1))
413  {
414  const DofMap & dof_map = this->get_dof_map();
415  for (auto var : make_range(this->n_vars()))
416  if (this->variable(var).type().family == SCALAR)
417  {
418  // We can just map SCALAR dofs directly across
419  std::vector<dof_id_type> new_SCALAR_indices, old_SCALAR_indices;
420  dof_map.SCALAR_dof_indices (new_SCALAR_indices, var, false);
421  dof_map.SCALAR_dof_indices (old_SCALAR_indices, var, true);
422  for (auto i : index_range(new_SCALAR_indices))
423  new_vector.set(new_SCALAR_indices[i], old_vector(old_SCALAR_indices[i]));
424  }
425  }
426  }
427 
428  new_vector.close();
429 
430  // If the old vector was serial, we probably need to send our values
431  // to other processors
432  //
433  // FIXME: I'm not sure how to make a NumericVector do that without
434  // creating a temporary parallel vector to use localize! - RHS
435  if (old_v.type() == SERIAL)
436  {
437  std::unique_ptr<NumericVector<Number>> dist_v = NumericVector<Number>::build(this->comm());
438  dist_v->init(this->n_dofs(), this->n_local_dofs(), false, PARALLEL);
439  dist_v->close();
440 
441  for (auto i : make_range(dist_v->size()))
442  if (new_vector(i) != 0.0)
443  dist_v->set(i, new_vector(i));
444 
445  dist_v->close();
446 
447  dist_v->localize (new_v, this->get_dof_map().get_send_list());
448  new_v.close();
449  }
450  // If the old vector was parallel, we need to update it
451  // and free the localized copies
452  else if (old_v.type() == PARALLEL)
453  {
454  // We may have to set dof values that this processor doesn't
455  // own in certain special cases, like LAGRANGE FIRST or
456  // HERMITE THIRD elements on second-order meshes?
457  new_v = new_vector;
458  new_v.close();
459  }
460 
461 
462  // Apply constraints only if we we are asked to
463  if(this->project_with_constraints)
464  {
465  if (is_adjoint == -1)
466  {
467  this->get_dof_map().enforce_constraints_exactly(*this, &new_v);
468  }
469  else if (is_adjoint >= 0)
470  {
472  is_adjoint);
473  }
474  }
475 #else
476 
477  // AMR is disabled: simply copy the vector
478  new_v = old_v;
479 
480  libmesh_ignore(is_adjoint);
481 
482 #endif // #ifdef LIBMESH_ENABLE_AMR
483 }
const Variable & variable(unsigned int var) const
Return a constant reference to Variable var.
Definition: system.C:2684
virtual void get(const std::vector< numeric_index_type > &index, T *values) const
Access multiple components at once.
virtual numeric_index_type size() const =0
static FEFieldType field_type(const FEType &fe_type)
const Parallel::Communicator & comm() const
dof_id_type n_local_dofs() const
Definition: system.C:156
const MeshBase & get_mesh() const
Definition: system.h:2359
virtual void init(const numeric_index_type n, const numeric_index_type n_local, const bool fast=false, const ParallelType ptype=AUTOMATIC)=0
Change the dimension of the vector to n.
void iota(ForwardIter first, ForwardIter last, T value)
Utility::iota was created back when std::iota was just an SGI STL extension.
Definition: utility.h:229
dof_id_type n_dofs() const
Definition: system.C:119
StoredRange< MeshBase::const_element_iterator, const Elem * > ConstElemRange
Definition: elem_range.h:34
void enforce_adjoint_constraints_exactly(NumericVector< Number > &v, unsigned int q) const
Heterogeneously constrains the numeric vector v, which represents an adjoint solution defined on the ...
Definition: dof_map.h:2520
processor_id_type n_processors() const
void libmesh_ignore(const Args &...)
NumberVectorValue Gradient
bool project_with_constraints
Do we want to apply constraints while projecting vectors ?
Definition: system.h:2320
libmesh_assert(ctx)
virtual void close()=0
Calls the NumericVector&#39;s internal assembly routines, ensuring that the values are consistent across ...
ParallelType type() const
const FEType & variable_type(const unsigned int i) const
Definition: system.C:2701
virtual numeric_index_type local_size() const =0
IntRange< T > make_range(T beg, T end)
The 2-parameter make_range() helper function returns an IntRange<T> when both input parameters are of...
Definition: int_range.h:140
static std::unique_ptr< NumericVector< T > > build(const Parallel::Communicator &comm, SolverPackage solver_package=libMesh::default_solver_package(), ParallelType parallel_type=AUTOMATIC)
Builds a NumericVector on the processors in communicator comm using the linear solver package specifi...
void parallel_reduce(const Range &range, Body &body)
Execute the provided reduction operation in parallel on the specified range.
Definition: threads_none.h:101
virtual void clear()
Restores the NumericVector<T> to a pristine state.
unsigned int n_vars() const
Definition: system.C:2654
processor_id_type processor_id() const
const DofMap & get_dof_map() const
Definition: system.h:2375
template class LIBMESH_EXPORT NumericVector< Number >
auto index_range(const T &sizable)
Helper function that returns an IntRange<std::size_t> representing all the indices of the passed-in v...
Definition: int_range.h:117
void enforce_constraints_exactly(const System &system, NumericVector< Number > *v=nullptr, bool homogeneous=false) const
Constrains the numeric vector v, which represents a solution defined on the mesh. ...
Definition: dof_map.h:2516
virtual void localize(std::vector< T > &v_local) const =0
Creates a copy of the global vector in the local vector v_local.

◆ projection_matrix()

void libMesh::System::projection_matrix ( SparseMatrix< Number > &  proj_mat) const
inherited

This method creates a projection matrix which corresponds to the operation of project_vector between old and new solution spaces.

Heterogeneous Dirichlet boundary conditions are not taken into account here; if this matrix is used for prolongation (mesh refinement) on a side with a heterogeneous BC, the newly created degrees of freedom on that side will still match the coarse grid approximation of the BC, not the fine grid approximation.

Definition at line 961 of file system_projection.C.

References libMesh::Utility::iota(), libMesh::make_range(), n_vars, libMesh::SCALAR, libMesh::DofMap::SCALAR_dof_indices(), and libMesh::SparseMatrix< T >::set().

Referenced by libMesh::PetscDMWrapper::init_petscdm(), SystemsTest::testProjectMatrix1D(), SystemsTest::testProjectMatrix2D(), and SystemsTest::testProjectMatrix3D().

962 {
963  LOG_SCOPE ("projection_matrix()", "System");
964 
965  const unsigned int n_variables = this->n_vars();
966 
967  if (n_variables)
968  {
969  ConstElemRange active_local_elem_range
970  (this->get_mesh().active_local_elements_begin(),
971  this->get_mesh().active_local_elements_end());
972 
973  std::vector<unsigned int> vars(n_variables);
974  std::iota(vars.begin(), vars.end(), 0);
975 
976  // Use a typedef to make the calling sequence for parallel_for() a bit more readable
977  typedef OldSolutionCoefs<Real, &FEMContext::point_value> OldSolutionValueCoefs;
978  typedef OldSolutionCoefs<RealGradient, &FEMContext::point_gradient> OldSolutionGradientCoefs;
979 
980  typedef
981  GenericProjector<OldSolutionValueCoefs,
982  OldSolutionGradientCoefs,
983  DynamicSparseNumberArray<Real,dof_id_type>,
984  MatrixFillAction<Real, Number> > ProjMatFiller;
985 
986  OldSolutionValueCoefs f(*this, &vars);
987  OldSolutionGradientCoefs g(*this, &vars);
988  MatrixFillAction<Real, Number> setter(proj_mat);
989 
990  ProjMatFiller mat_filler(*this, f, &g, setter, vars);
991  mat_filler.project(active_local_elem_range);
992 
993  // Set the SCALAR dof transfer entries too.
994  // Note: We assume that all SCALAR dofs are on the
995  // processor with highest ID
996  if (this->processor_id() == (this->n_processors()-1))
997  {
998  const DofMap & dof_map = this->get_dof_map();
999  for (auto var : make_range(this->n_vars()))
1000  if (this->variable(var).type().family == SCALAR)
1001  {
1002  // We can just map SCALAR dofs directly across
1003  std::vector<dof_id_type> new_SCALAR_indices, old_SCALAR_indices;
1004  dof_map.SCALAR_dof_indices (new_SCALAR_indices, var, false);
1005  dof_map.SCALAR_dof_indices (old_SCALAR_indices, var, true);
1006  const unsigned int new_n_dofs =
1007  cast_int<unsigned int>(new_SCALAR_indices.size());
1008 
1009  for (unsigned int i=0; i<new_n_dofs; i++)
1010  {
1011  proj_mat.set( new_SCALAR_indices[i],
1012  old_SCALAR_indices[i], 1);
1013  }
1014  }
1015  }
1016  }
1017 }
const Variable & variable(unsigned int var) const
Return a constant reference to Variable var.
Definition: system.C:2684
const MeshBase & get_mesh() const
Definition: system.h:2359
void iota(ForwardIter first, ForwardIter last, T value)
Utility::iota was created back when std::iota was just an SGI STL extension.
Definition: utility.h:229
StoredRange< MeshBase::const_element_iterator, const Elem * > ConstElemRange
Definition: elem_range.h:34
virtual void set(const numeric_index_type i, const numeric_index_type j, const T value)=0
Set the element (i,j) to value.
processor_id_type n_processors() const
IntRange< T > make_range(T beg, T end)
The 2-parameter make_range() helper function returns an IntRange<T> when both input parameters are of...
Definition: int_range.h:140
unsigned int n_vars() const
Definition: system.C:2654
processor_id_type processor_id() const
const DofMap & get_dof_map() const
Definition: system.h:2375

◆ prolong_vectors()

void libMesh::System::prolong_vectors ( )
virtualinherited

Prolong vectors after the mesh has refined.

Definition at line 429 of file system.C.

References libMesh::System::restrict_vectors().

Referenced by libMesh::EquationSystems::reinit_solutions().

430 {
431 #ifdef LIBMESH_ENABLE_AMR
432  // Currently project_vector handles both restriction and prolongation
433  this->restrict_vectors();
434 #endif
435 }
virtual void restrict_vectors()
Restrict vectors after the mesh has coarsened.
Definition: system.C:371

◆ qoi_parameter_hessian()

void libMesh::System::qoi_parameter_hessian ( const QoISet qoi_indices,
const ParameterVector parameters,
SensitivityData hessian 
)
inlinevirtualinherited

For each of the system's quantities of interest q in qoi[qoi_indices], and for a vector of parameters p, the parameter sensitivity Hessian H_ij is defined as H_ij = (d^2 q)/(d p_i d p_j) This Hessian is the output of this method, where for each q_i, H_jk is stored in hessian.second_derivative(i,j,k).

This method is only implemented in some derived classes.

Reimplemented in libMesh::ImplicitSystem.

Definition at line 2580 of file system.h.

2583 {
2584  libmesh_not_implemented();
2585 }

◆ qoi_parameter_hessian_vector_product()

void libMesh::System::qoi_parameter_hessian_vector_product ( const QoISet qoi_indices,
const ParameterVector parameters,
const ParameterVector vector,
SensitivityData product 
)
inlinevirtualinherited

For each of the system's quantities of interest q in qoi[qoi_indices], and for a vector of parameters p, the parameter sensitivity Hessian H_ij is defined as H_ij = (d^2 q)/(d p_i d p_j) The Hessian-vector product, for a vector v_k in parameter space, is S_j = H_jk v_k This product is the output of this method, where for each q_i, S_j is stored in sensitivities[i][j].

This method is only implemented in some derived classes.

Reimplemented in libMesh::ImplicitSystem.

Definition at line 2589 of file system.h.

2593 {
2594  libmesh_not_implemented();
2595 }

◆ qoi_parameter_sensitivity()

void libMesh::System::qoi_parameter_sensitivity ( const QoISet qoi_indices,
const ParameterVector parameters,
SensitivityData sensitivities 
)
virtualinherited

Solves for the derivative of each of the system's quantities of interest q in qoi[qoi_indices] with respect to each parameter in parameters, placing the result for qoi i and parameter j into sensitivities[i][j].

Note
parameters is a const vector, not a vector-of-const; parameter values in this vector need to be mutable for finite differencing to work.

Automatically chooses the forward method for problems with more quantities of interest than parameters, or the adjoint method otherwise.

This method is only usable in derived classes which override an implementation.

Definition at line 587 of file system.C.

References libMesh::System::adjoint_qoi_parameter_sensitivity(), libMesh::System::forward_qoi_parameter_sensitivity(), libMesh::ParameterVector::size(), and libMesh::QoISet::size().

590 {
591  // Forward sensitivities are more efficient for Nq > Np
592  if (qoi_indices.size(*this) > parameters_vec.size())
593  forward_qoi_parameter_sensitivity(qoi_indices, parameters_vec, sensitivities);
594  // Adjoint sensitivities are more efficient for Np > Nq,
595  // and an adjoint may be more reusable than a forward
596  // solution sensitivity in the Np == Nq case.
597  else
598  adjoint_qoi_parameter_sensitivity(qoi_indices, parameters_vec, sensitivities);
599 }
virtual void forward_qoi_parameter_sensitivity(const QoISet &qoi_indices, const ParameterVector &parameters, SensitivityData &sensitivities)
Solves for parameter sensitivities using the forward method.
Definition: system.h:2571
virtual void adjoint_qoi_parameter_sensitivity(const QoISet &qoi_indices, const ParameterVector &parameters, SensitivityData &sensitivities)
Solves for parameter sensitivities using the adjoint method.
Definition: system.h:2562

◆ re_update()

void libMesh::System::re_update ( )
virtualinherited

Re-update the local values when the mesh has changed.

This method takes the data updated by update() and makes it up-to-date on the current mesh.

Reimplemented in libMesh::TransientSystem< RBConstruction >.

Definition at line 518 of file system.C.

References libMesh::System::current_local_solution, libMesh::System::get_dof_map(), libMesh::DofMap::get_send_list(), libMesh::System::n_vars(), and libMesh::System::solution.

519 {
520  parallel_object_only();
521 
522  // If this system is empty... don't do anything!
523  if (!this->n_vars())
524  return;
525 
526  const std::vector<dof_id_type> & send_list = this->get_dof_map().get_send_list ();
527 
528  // Check sizes
529  libmesh_assert_equal_to (current_local_solution->size(), solution->size());
530  // Not true with ghosted vectors
531  // libmesh_assert_equal_to (current_local_solution->local_size(), solution->size());
532  // libmesh_assert (!send_list.empty());
533  libmesh_assert_less_equal (send_list.size(), solution->size());
534 
535  // Create current_local_solution from solution. This will
536  // put a local copy of solution into current_local_solution.
537  solution->localize (*current_local_solution, send_list);
538 }
std::unique_ptr< NumericVector< Number > > solution
Data structure to hold solution values.
Definition: system.h:1616
std::unique_ptr< NumericVector< Number > > current_local_solution
All the values I need to compute my contribution to the simulation at hand.
Definition: system.h:1628
unsigned int n_vars() const
Definition: system.C:2654
const DofMap & get_dof_map() const
Definition: system.h:2375
const std::vector< dof_id_type > & get_send_list() const
Definition: dof_map.h:533

◆ read_header()

void libMesh::System::read_header ( Xdr io,
std::string_view  version,
const bool  read_header = true,
const bool  read_additional_data = true,
const bool  read_legacy_format = false 
)
inherited

Reads the basic data header for this System.

Definition at line 97 of file system_io.C.

References libMesh::System::_additional_data_written, libMesh::System::_written_var_indices, libMesh::System::add_variable(), libMesh::System::add_vector(), TIMPI::Communicator::broadcast(), libMesh::System::clear(), libMesh::ParallelObject::comm(), libMesh::Utility::contains(), libMesh::Xdr::data(), libMesh::FEType::family, libMesh::System::get_mesh(), libMesh::OrderWrapper::get_order(), libMesh::FEType::inf_map, libMesh::libmesh_assert(), libMesh::MeshBase::mesh_dimension(), libMesh::MONOMIAL, libMesh::on_command_line(), libMesh::FEType::order, libMesh::out, libMesh::ParallelObject::processor_id(), libMesh::FEType::radial_family, libMesh::FEType::radial_order, libMesh::Xdr::reading(), libMesh::System::variable_number(), libMesh::Xdr::version(), and libMesh::XYZ.

Referenced by libMesh::EquationSystems::read(), and libMesh::RBEvaluation::read_in_vectors_from_multiple_files().

102 {
103  // This method implements the input of a
104  // System object, embedded in the output of
105  // an EquationSystems<T_sys>. This warrants some
106  // documentation. The output file essentially
107  // consists of 5 sections:
108  //
109  // for this system
110  //
111  // 5.) The number of variables in the system (unsigned int)
112  //
113  // for each variable in the system
114  //
115  // 6.) The name of the variable (string)
116  //
117  // 6.1.) Variable subdomains
118  //
119  // 7.) Combined in an FEType:
120  // - The approximation order(s) of the variable
121  // (Order Enum, cast to int/s)
122  // - The finite element family/ies of the variable
123  // (FEFamily Enum, cast to int/s)
124  //
125  // end variable loop
126  //
127  // 8.) The number of additional vectors (unsigned int),
128  //
129  // for each additional vector in the system object
130  //
131  // 9.) the name of the additional vector (string)
132  //
133  // end system
134  libmesh_assert (io.reading());
135 
136  // Possibly clear data structures and start from scratch.
137  if (read_header_in)
138  this->clear ();
139 
140  // Figure out if we need to read infinite element information.
141  // This will be true if the version string contains " with infinite elements"
142  const bool read_ifem_info =
143  Utility::contains(version, " with infinite elements") ||
144  libMesh::on_command_line ("--read-ifem-systems");
145 
146 
147  {
148  // 5.)
149  // Read the number of variables in the system
150  unsigned int nv=0;
151  if (this->processor_id() == 0)
152  io.data (nv);
153  this->comm().broadcast(nv);
154 
155  _written_var_indices.clear();
156  _written_var_indices.resize(nv, 0);
157 
158  for (unsigned int var=0; var<nv; var++)
159  {
160  // 6.)
161  // Read the name of the var-th variable
162  std::string var_name;
163  if (this->processor_id() == 0)
164  io.data (var_name);
165  this->comm().broadcast(var_name);
166 
167  // 6.1.)
168  std::set<subdomain_id_type> domains;
169  if (io.version() >= LIBMESH_VERSION_ID(0,7,2))
170  {
171  std::vector<subdomain_id_type> domain_array;
172  if (this->processor_id() == 0)
173  io.data (domain_array);
174  for (const auto & id : domain_array)
175  domains.insert(id);
176  }
177  this->comm().broadcast(domains);
178 
179  // 7.)
180  // Read the approximation order(s) of the var-th variable
181  int order=0;
182  if (this->processor_id() == 0)
183  io.data (order);
184  this->comm().broadcast(order);
185 
186 
187  // do the same for infinite element radial_order
188  int rad_order=0;
189  if (read_ifem_info)
190  {
191  if (this->processor_id() == 0)
192  io.data(rad_order);
193  this->comm().broadcast(rad_order);
194  }
195 
196  // Read the finite element type of the var-th variable
197  int fam=0;
198  if (this->processor_id() == 0)
199  io.data (fam);
200  this->comm().broadcast(fam);
201  FEType type;
202  type.order = static_cast<Order>(order);
203  type.family = static_cast<FEFamily>(fam);
204 
205  // Check for incompatibilities. The shape function indexing was
206  // changed for the monomial and xyz finite element families to
207  // simplify extension to arbitrary p. The consequence is that
208  // old restart files will not be read correctly. This is expected
209  // to be an unlikely occurrence, but catch it anyway.
210  if (read_legacy_format)
211  if ((type.family == MONOMIAL || type.family == XYZ) &&
212  ((type.order.get_order() > 2 && this->get_mesh().mesh_dimension() == 2) ||
213  (type.order.get_order() > 1 && this->get_mesh().mesh_dimension() == 3)))
214  {
215  libmesh_here();
216  libMesh::out << "*****************************************************************\n"
217  << "* WARNING: reading a potentially incompatible restart file!!! *\n"
218  << "* contact [email protected] for more details *\n"
219  << "*****************************************************************"
220  << std::endl;
221  }
222 
223  // Read additional information for infinite elements
224  int radial_fam=0;
225  int i_map=0;
226  if (read_ifem_info)
227  {
228  if (this->processor_id() == 0)
229  io.data (radial_fam);
230  this->comm().broadcast(radial_fam);
231  if (this->processor_id() == 0)
232  io.data (i_map);
233  this->comm().broadcast(i_map);
234  }
235 
236 #ifdef LIBMESH_ENABLE_INFINITE_ELEMENTS
237 
238  type.radial_order = static_cast<Order>(rad_order);
239  type.radial_family = static_cast<FEFamily>(radial_fam);
240  type.inf_map = static_cast<InfMapType>(i_map);
241 
242 #endif
243 
244  if (read_header_in)
245  {
246  if (domains.empty())
247  _written_var_indices[var] = this->add_variable (var_name, type);
248  else
249  _written_var_indices[var] = this->add_variable (var_name, type, &domains);
250  }
251  else
252  _written_var_indices[var] = this->variable_number(var_name);
253  }
254  }
255 
256  // 8.)
257  // Read the number of additional vectors.
258  unsigned int nvecs=0;
259  if (this->processor_id() == 0)
260  io.data (nvecs);
261  this->comm().broadcast(nvecs);
262 
263  // If nvecs > 0, this means that write_additional_data
264  // was true when this file was written. We will need to
265  // make use of this fact later.
266  this->_additional_data_written = nvecs;
267 
268  for (unsigned int vec=0; vec<nvecs; vec++)
269  {
270  // 9.)
271  // Read the name of the vec-th additional vector
272  std::string vec_name;
273  if (this->processor_id() == 0)
274  io.data (vec_name);
275  this->comm().broadcast(vec_name);
276  if (io.version() >= LIBMESH_VERSION_ID(1,7,0))
277  {
278  int vec_projection = 0;
279  if (this->processor_id() == 0)
280  io.data (vec_projection);
281  this->comm().broadcast(vec_projection);
282  int vec_type;
283  if (this->processor_id() == 0)
284  io.data (vec_type);
285  this->comm().broadcast(vec_type);
286 
287  if (read_additional_data)
288  this->add_vector(vec_name, bool(vec_projection), ParallelType(vec_type));
289  }
290  else if (read_additional_data)
291  // Systems now can handle adding post-initialization vectors
292  // libmesh_assert(this->_can_add_vectors);
293  // Some systems may have added their own vectors already
294  // libmesh_assert_equal_to (this->_vectors.count(vec_name), 0);
295  this->add_vector(vec_name);
296  }
297 }
virtual void clear()
Clear all the data structures associated with the system.
Definition: system.C:174
Order
defines an enum for polynomial orders.
Definition: enum_order.h:40
const Parallel::Communicator & comm() const
NumericVector< Number > & add_vector(std::string_view vec_name, const bool projections=true, const ParallelType type=PARALLEL)
Adds the additional vector vec_name to this system.
Definition: system.C:753
const MeshBase & get_mesh() const
Definition: system.h:2359
unsigned int variable_number(std::string_view var) const
Definition: system.C:1394
libmesh_assert(ctx)
unsigned int _additional_data_written
This flag is used only when reading in a system from file.
Definition: system.h:2290
unsigned int add_variable(std::string_view 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.
Definition: system.C:1342
bool contains(std::string_view superstring, std::string_view substring)
Look for a substring within a string.
Definition: utility.C:205
void broadcast(T &data, const unsigned int root_id=0, const bool identical_sizes=false) const
InfMapType
defines an enum for the types of coordinate mappings available in infinite elements.
OStreamProxy out
unsigned int mesh_dimension() const
Definition: mesh_base.C:372
bool on_command_line(std::string arg)
Definition: libmesh.C:1058
FEFamily
defines an enum for finite element families.
processor_id_type processor_id() const
std::vector< unsigned int > _written_var_indices
This vector is used only when reading in a system from file.
Definition: system.h:2302
ParallelType
Defines an enum for parallel data structure types.

◆ read_legacy_data()

void libMesh::System::read_legacy_data ( Xdr io,
const bool  read_additional_data = true 
)
inherited

Reads additional data, namely vectors, for this System.

Deprecated:
The ability to read XDR data files in the old (aka "legacy") XDR format has been deprecated for many years, this capability may soon disappear altogether.

Definition at line 302 of file system_io.C.

References libMesh::System::_additional_data_written, libMesh::System::_vectors, libMesh::System::_written_var_indices, TIMPI::Communicator::broadcast(), libMesh::ParallelObject::comm(), libMesh::Xdr::data(), libMesh::System::get_mesh(), libMesh::DofObject::invalid_id, libMesh::libmesh_assert(), libMesh::make_range(), libMesh::System::n_dofs(), libMesh::System::n_vars(), libMesh::System::number(), libMesh::ParallelObject::processor_id(), libMesh::Xdr::reading(), libMesh::System::solution, and libMesh::zero.

304 {
305  libmesh_deprecated();
306 
307  // This method implements the output of the vectors
308  // contained in this System object, embedded in the
309  // output of an EquationSystems<T_sys>.
310  //
311  // 10.) The global solution vector, re-ordered to be node-major
312  // (More on this later.)
313  //
314  // for each additional vector in the object
315  //
316  // 11.) The global additional vector, re-ordered to be
317  // node-major (More on this later.)
318  libmesh_assert (io.reading());
319 
320  // directly-read and reordered buffers, declared here for reuse
321  // without heap juggling.
322  std::vector<Number> global_vector;
323  std::vector<Number> reordered_vector;
324 
325  auto reorder_vector_into =
326  [this, &global_vector, &reordered_vector]
327  (NumericVector<Number> & vec)
328  {
329  this->comm().broadcast(global_vector);
330 
331  // If we have been reading multiple vectors, they should all be
332  // the same size.
333  libmesh_assert (reordered_vector.empty() ||
334  reordered_vector.size() == global_vector.size());
335 
336  // Remember that the stored vector is node-major.
337  // We need to put it into whatever application-specific
338  // ordering we may have using the dof_map.
339  reordered_vector.resize(global_vector.size());
340 
341  //libMesh::out << "global_vector.size()=" << global_vector.size() << std::endl;
342  //libMesh::out << "this->n_dofs()=" << this->n_dofs() << std::endl;
343 
344  libmesh_assert_equal_to (global_vector.size(), this->n_dofs());
345 
346  dof_id_type cnt=0;
347 
348  const unsigned int sys = this->number();
349  const unsigned int nv = cast_int<unsigned int>
350  (this->_written_var_indices.size());
351  libmesh_assert_less_equal (nv, this->n_vars());
352 
353  for (unsigned int data_var=0; data_var<nv; data_var++)
354  {
355  const unsigned int var = _written_var_indices[data_var];
356 
357  // First reorder the nodal DOF values
358  for (auto & node : this->get_mesh().node_ptr_range())
359  for (auto index : make_range(node->n_comp(sys,var)))
360  {
361  libmesh_assert_not_equal_to (node->dof_number(sys, var, index),
363 
364  libmesh_assert_less (cnt, global_vector.size());
365 
366  reordered_vector[node->dof_number(sys, var, index)] =
367  global_vector[cnt++];
368  }
369 
370  // Then reorder the element DOF values
371  for (auto & elem : this->get_mesh().active_element_ptr_range())
372  for (auto index : make_range(elem->n_comp(sys,var)))
373  {
374  libmesh_assert_not_equal_to (elem->dof_number(sys, var, index),
376 
377  libmesh_assert_less (cnt, global_vector.size());
378 
379  reordered_vector[elem->dof_number(sys, var, index)] =
380  global_vector[cnt++];
381  }
382  }
383 
384  // use the overloaded operator=(std::vector) to assign the values
385  vec = reordered_vector;
386  };
387 
388  // 10.)
389  // Read and set the solution vector
390  if (this->processor_id() == 0)
391  io.data (global_vector);
392  reorder_vector_into(*(this->solution));
393 
394  // For each additional vector, simply go through the list.
395  // ONLY attempt to do this IF additional data was actually
396  // written to the file for this system (controlled by the
397  // _additional_data_written flag).
398  if (this->_additional_data_written)
399  {
400  const std::size_t nvecs = this->_vectors.size();
401 
402  // If the number of additional vectors written is non-zero, and
403  // the number of additional vectors we have is non-zero, and
404  // they don't match, then something is wrong and we can't be
405  // sure we're reading data into the correct places.
406  if (read_additional_data && nvecs &&
407  nvecs != this->_additional_data_written)
408  libmesh_error_msg
409  ("Additional vectors in file do not match system");
410 
411  auto pos = this->_vectors.begin();
412 
413  for (std::size_t i = 0; i != this->_additional_data_written; ++i)
414  {
415  // 11.)
416  // Read the values of the vec-th additional vector.
417  // Prior do _not_ clear, but fill with zero, since the
418  // additional vectors _have_ to have the same size
419  // as the solution vector
420  std::fill (global_vector.begin(), global_vector.end(), libMesh::zero);
421 
422  if (this->processor_id() == 0)
423  io.data (global_vector);
424 
425  // If read_additional_data==true and we have additional vectors,
426  // then we will keep this vector data; otherwise we are going to
427  // throw it away.
428  if (read_additional_data && nvecs)
429  {
430  std::fill (reordered_vector.begin(),
431  reordered_vector.end(),
432  libMesh::zero);
433 
434  reorder_vector_into(*(pos->second));
435  }
436 
437  // If we've got vectors then we need to be iterating through
438  // those too
439  if (pos != this->_vectors.end())
440  ++pos;
441  }
442  } // end if (_additional_data_written)
443 }
const Parallel::Communicator & comm() const
std::map< std::string, std::unique_ptr< NumericVector< Number > >, std::less<> > _vectors
Some systems need an arbitrary number of vectors.
Definition: system.h:2237
const Number zero
.
Definition: libmesh.h:304
const MeshBase & get_mesh() const
Definition: system.h:2359
dof_id_type n_dofs() const
Definition: system.C:119
unsigned int number() const
Definition: system.h:2351
static constexpr dof_id_type invalid_id
An invalid id to distinguish an uninitialized DofObject.
Definition: dof_object.h:482
std::unique_ptr< NumericVector< Number > > solution
Data structure to hold solution values.
Definition: system.h:1616
libmesh_assert(ctx)
unsigned int _additional_data_written
This flag is used only when reading in a system from file.
Definition: system.h:2290
void broadcast(T &data, const unsigned int root_id=0, const bool identical_sizes=false) const
IntRange< T > make_range(T beg, T end)
The 2-parameter make_range() helper function returns an IntRange<T> when both input parameters are of...
Definition: int_range.h:140
unsigned int n_vars() const
Definition: system.C:2654
processor_id_type processor_id() const
template class LIBMESH_EXPORT NumericVector< Number >
std::vector< unsigned int > _written_var_indices
This vector is used only when reading in a system from file.
Definition: system.h:2302
uint8_t dof_id_type
Definition: id_types.h:67

◆ read_parallel_data() [1/2]

template<typename InValType >
void libMesh::System::read_parallel_data ( Xdr io,
const bool  read_additional_data 
)
inherited

Reads additional data, namely vectors, for this System.

This method may safely be called on a distributed-memory mesh. This method will read an individual file for each processor in the simulation where the local solution components for that processor are stored.

This method implements the output of the vectors contained in this System object, embedded in the output of an EquationSystems<T_sys>.

9.) The global solution vector, re-ordered to be node-major (More on this later.)

for each additional vector in the object

10.) The global additional vector, re-ordered to be node-major (More on this later.)

Note that the actual IO is handled through the Xdr class (to be renamed later?) which provides a uniform interface to both the XDR (eXternal Data Representation) interface and standard ASCII output. Thus this one section of code will read XDR or ASCII files with no changes.

Definition at line 449 of file system_io.C.

References libMesh::System::_additional_data_written, libMesh::System::_vectors, libMesh::System::_written_var_indices, libMesh::Xdr::data(), libMesh::FEType::family, libMesh::System::get_dof_map(), libMesh::System::get_mesh(), libMesh::DofObject::invalid_id, libMesh::Xdr::is_open(), libMesh::libmesh_assert(), libMesh::make_range(), libMesh::ParallelObject::n_processors(), libMesh::System::n_vars(), libMesh::System::number(), libMesh::ParallelObject::processor_id(), libMesh::Xdr::reading(), libMesh::SCALAR, libMesh::DofMap::SCALAR_dof_indices(), libMesh::System::solution, libMesh::Variable::type(), and libMesh::System::variable().

451 {
471  // PerfLog pl("IO Performance",false);
472  // pl.push("read_parallel_data");
473  dof_id_type total_read_size = 0;
474 
475  libmesh_assert (io.reading());
476  libmesh_assert (io.is_open());
477 
478  // build the ordered nodes and element maps.
479  // when writing/reading parallel files we need to iterate
480  // over our nodes/elements in order of increasing global id().
481  // however, this is not guaranteed to be ordering we obtain
482  // by using the node_iterators/element_iterators directly.
483  // so build a set, sorted by id(), that provides the ordering.
484  // further, for memory economy build the set but then transfer
485  // its contents to vectors, which will be sorted.
486  std::vector<const DofObject *> ordered_nodes, ordered_elements;
487  {
488  std::set<const DofObject *, CompareDofObjectsByID>
489  ordered_nodes_set (this->get_mesh().local_nodes_begin(),
490  this->get_mesh().local_nodes_end());
491 
492  ordered_nodes.insert(ordered_nodes.end(),
493  ordered_nodes_set.begin(),
494  ordered_nodes_set.end());
495  }
496  {
497  std::set<const DofObject *, CompareDofObjectsByID>
498  ordered_elements_set (this->get_mesh().local_elements_begin(),
499  this->get_mesh().local_elements_end());
500 
501  ordered_elements.insert(ordered_elements.end(),
502  ordered_elements_set.begin(),
503  ordered_elements_set.end());
504  }
505 
506  // std::vector<Number> io_buffer;
507  std::vector<InValType> io_buffer;
508 
509  // 9.)
510  //
511  // Actually read the solution components
512  // for the ith system to disk
513  io.data(io_buffer);
514 
515  total_read_size += cast_int<dof_id_type>(io_buffer.size());
516 
517  const unsigned int sys_num = this->number();
518  const unsigned int nv = cast_int<unsigned int>
519  (this->_written_var_indices.size());
520  libmesh_assert_less_equal (nv, this->n_vars());
521 
522  dof_id_type cnt=0;
523 
524  // Loop over each non-SCALAR variable and each node, and read out the value.
525  for (unsigned int data_var=0; data_var<nv; data_var++)
526  {
527  const unsigned int var = _written_var_indices[data_var];
528  if (this->variable(var).type().family != SCALAR)
529  {
530  // First read the node DOF values
531  for (const auto & node : ordered_nodes)
532  for (auto comp : make_range(node->n_comp(sys_num,var)))
533  {
534  libmesh_assert_not_equal_to (node->dof_number(sys_num, var, comp),
536  libmesh_assert_less (cnt, io_buffer.size());
537  this->solution->set(node->dof_number(sys_num, var, comp), io_buffer[cnt++]);
538  }
539 
540  // Then read the element DOF values
541  for (const auto & elem : ordered_elements)
542  for (auto comp : make_range(elem->n_comp(sys_num,var)))
543  {
544  libmesh_assert_not_equal_to (elem->dof_number(sys_num, var, comp),
546  libmesh_assert_less (cnt, io_buffer.size());
547  this->solution->set(elem->dof_number(sys_num, var, comp), io_buffer[cnt++]);
548  }
549  }
550  }
551 
552  // Finally, read the SCALAR variables on the last processor
553  for (unsigned int data_var=0; data_var<nv; data_var++)
554  {
555  const unsigned int var = _written_var_indices[data_var];
556  if (this->variable(var).type().family == SCALAR)
557  {
558  if (this->processor_id() == (this->n_processors()-1))
559  {
560  const DofMap & dof_map = this->get_dof_map();
561  std::vector<dof_id_type> SCALAR_dofs;
562  dof_map.SCALAR_dof_indices(SCALAR_dofs, var);
563 
564  for (auto dof : SCALAR_dofs)
565  this->solution->set(dof, io_buffer[cnt++]);
566  }
567  }
568  }
569 
570  // And we're done setting solution entries
571  this->solution->close();
572 
573  // For each additional vector, simply go through the list.
574  // ONLY attempt to do this IF additional data was actually
575  // written to the file for this system (controlled by the
576  // _additional_data_written flag).
577  if (this->_additional_data_written)
578  {
579  const std::size_t nvecs = this->_vectors.size();
580 
581  // If the number of additional vectors written is non-zero, and
582  // the number of additional vectors we have is non-zero, and
583  // they don't match, then something is wrong and we can't be
584  // sure we're reading data into the correct places.
585  if (read_additional_data && nvecs &&
586  nvecs != this->_additional_data_written)
587  libmesh_error_msg
588  ("Additional vectors in file do not match system");
589 
590  auto pos = _vectors.begin();
591 
592  for (std::size_t i = 0; i != this->_additional_data_written; ++i)
593  {
594  cnt=0;
595  io_buffer.clear();
596 
597  // 10.)
598  //
599  // Actually read the additional vector components
600  // for the ith system from disk
601  io.data(io_buffer);
602 
603  total_read_size += cast_int<dof_id_type>(io_buffer.size());
604 
605  // If read_additional_data==true and we have additional vectors,
606  // then we will keep this vector data; otherwise we are going to
607  // throw it away.
608  if (read_additional_data && nvecs)
609  {
610  // Loop over each non-SCALAR variable and each node, and read out the value.
611  for (unsigned int data_var=0; data_var<nv; data_var++)
612  {
613  const unsigned int var = _written_var_indices[data_var];
614  if (this->variable(var).type().family != SCALAR)
615  {
616  // First read the node DOF values
617  for (const auto & node : ordered_nodes)
618  for (auto comp : make_range(node->n_comp(sys_num,var)))
619  {
620  libmesh_assert_not_equal_to (node->dof_number(sys_num, var, comp),
622  libmesh_assert_less (cnt, io_buffer.size());
623  pos->second->set(node->dof_number(sys_num, var, comp), io_buffer[cnt++]);
624  }
625 
626  // Then read the element DOF values
627  for (const auto & elem : ordered_elements)
628  for (auto comp : make_range(elem->n_comp(sys_num,var)))
629  {
630  libmesh_assert_not_equal_to (elem->dof_number(sys_num, var, comp),
632  libmesh_assert_less (cnt, io_buffer.size());
633  pos->second->set(elem->dof_number(sys_num, var, comp), io_buffer[cnt++]);
634  }
635  }
636  }
637 
638  // Finally, read the SCALAR variables on the last processor
639  for (unsigned int data_var=0; data_var<nv; data_var++)
640  {
641  const unsigned int var = _written_var_indices[data_var];
642  if (this->variable(var).type().family == SCALAR)
643  {
644  if (this->processor_id() == (this->n_processors()-1))
645  {
646  const DofMap & dof_map = this->get_dof_map();
647  std::vector<dof_id_type> SCALAR_dofs;
648  dof_map.SCALAR_dof_indices(SCALAR_dofs, var);
649 
650  for (auto dof : SCALAR_dofs)
651  pos->second->set(dof, io_buffer[cnt++]);
652  }
653  }
654  }
655 
656  // And we're done setting entries for this variable
657  pos->second->close();
658  }
659 
660  // If we've got vectors then we need to be iterating through
661  // those too
662  if (pos != this->_vectors.end())
663  ++pos;
664  }
665  }
666 
667  // const Real
668  // dt = pl.get_elapsed_time(),
669  // rate = total_read_size*sizeof(Number)/dt;
670 
671  // libMesh::err << "Read " << total_read_size << " \"Number\" values\n"
672  // << " Elapsed time = " << dt << '\n'
673  // << " Rate = " << rate/1.e6 << "(MB/sec)\n\n";
674 
675  // pl.pop("read_parallel_data");
676 }
FEFamily family
The type of finite element.
Definition: fe_type.h:221
const Variable & variable(unsigned int var) const
Return a constant reference to Variable var.
Definition: system.C:2684
std::map< std::string, std::unique_ptr< NumericVector< Number > >, std::less<> > _vectors
Some systems need an arbitrary number of vectors.
Definition: system.h:2237
const MeshBase & get_mesh() const
Definition: system.h:2359
processor_id_type n_processors() const
unsigned int number() const
Definition: system.h:2351
static constexpr dof_id_type invalid_id
An invalid id to distinguish an uninitialized DofObject.
Definition: dof_object.h:482
std::unique_ptr< NumericVector< Number > > solution
Data structure to hold solution values.
Definition: system.h:1616
libmesh_assert(ctx)
unsigned int _additional_data_written
This flag is used only when reading in a system from file.
Definition: system.h:2290
IntRange< T > make_range(T beg, T end)
The 2-parameter make_range() helper function returns an IntRange<T> when both input parameters are of...
Definition: int_range.h:140
unsigned int n_vars() const
Definition: system.C:2654
processor_id_type processor_id() const
const DofMap & get_dof_map() const
Definition: system.h:2375
std::vector< unsigned int > _written_var_indices
This vector is used only when reading in a system from file.
Definition: system.h:2302
uint8_t dof_id_type
Definition: id_types.h:67
const FEType & type() const
Definition: variable.h:144

◆ read_parallel_data() [2/2]

template LIBMESH_EXPORT void libMesh::System::read_parallel_data< Real > ( Xdr io,
const bool  read_additional_data 
)
inlineinherited

Non-templated version for backward compatibility.

Reads additional data, namely vectors, for this System. This method may safely be called on a distributed-memory mesh. This method will read an individual file for each processor in the simulation where the local solution components for that processor are stored.

Definition at line 1373 of file system.h.

1375  { read_parallel_data<Number>(io, read_additional_data); }

◆ read_serialized_data() [1/2]

template<typename InValType >
void libMesh::System::read_serialized_data ( Xdr io,
const bool  read_additional_data = true 
)
inherited

Reads additional data, namely vectors, for this System.

This method may safely be called on a distributed-memory mesh.

Definition at line 680 of file system_io.C.

References libMesh::System::_additional_data_written, libMesh::System::_vectors, libMesh::ParallelObject::processor_id(), and libMesh::System::solution.

Referenced by libMesh::TransientRBConstruction::initialize_truth(), libMesh::TransientRBConstruction::read_riesz_representors_from_files(), and libMesh::RBConstruction::read_riesz_representors_from_files().

682 {
683  // This method implements the input of the vectors
684  // contained in this System object, embedded in the
685  // output of an EquationSystems<T_sys>.
686  //
687  // 10.) The global solution vector, re-ordered to be node-major
688  // (More on this later.)
689  //
690  // for each additional vector in the object
691  //
692  // 11.) The global additional vector, re-ordered to be
693  // node-major (More on this later.)
694  parallel_object_only();
695  std::string comment;
696 
697  // PerfLog pl("IO Performance",false);
698  // pl.push("read_serialized_data");
699  // std::size_t total_read_size = 0;
700 
701  // 10.)
702  // Read the global solution vector
703  {
704  // total_read_size +=
705  this->read_serialized_vector<InValType>(io, this->solution.get());
706 
707  // get the comment
708  if (this->processor_id() == 0)
709  io.comment (comment);
710  }
711 
712  // 11.)
713  // Only read additional vectors if data is available, and only use
714  // that data to fill our vectors if the user requested it.
715  if (this->_additional_data_written)
716  {
717  const std::size_t nvecs = this->_vectors.size();
718 
719  // If the number of additional vectors written is non-zero, and
720  // the number of additional vectors we have is non-zero, and
721  // they don't match, then we can't read additional vectors
722  // and be sure we're reading data into the correct places.
723  if (read_additional_data && nvecs &&
724  nvecs != this->_additional_data_written)
725  libmesh_error_msg
726  ("Additional vectors in file do not match system");
727 
728  auto pos = _vectors.begin();
729 
730  for (std::size_t i = 0; i != this->_additional_data_written; ++i)
731  {
732  // Read data, but only put it into a vector if we've been
733  // asked to and if we have a corresponding vector to read.
734 
735  // total_read_size +=
736  this->read_serialized_vector<InValType>
737  (io, (read_additional_data && nvecs) ? pos->second.get() : nullptr);
738 
739  // get the comment
740  if (this->processor_id() == 0)
741  io.comment (comment);
742 
743 
744  // If we've got vectors then we need to be iterating through
745  // those too
746  if (pos != this->_vectors.end())
747  ++pos;
748  }
749  }
750 
751  // const Real
752  // dt = pl.get_elapsed_time(),
753  // rate = total_read_size*sizeof(Number)/dt;
754 
755  // libMesh::out << "Read " << total_read_size << " \"Number\" values\n"
756  // << " Elapsed time = " << dt << '\n'
757  // << " Rate = " << rate/1.e6 << "(MB/sec)\n\n";
758 
759  // pl.pop("read_serialized_data");
760 }
std::map< std::string, std::unique_ptr< NumericVector< Number > >, std::less<> > _vectors
Some systems need an arbitrary number of vectors.
Definition: system.h:2237
std::unique_ptr< NumericVector< Number > > solution
Data structure to hold solution values.
Definition: system.h:1616
unsigned int _additional_data_written
This flag is used only when reading in a system from file.
Definition: system.h:2290
processor_id_type processor_id() const

◆ read_serialized_data() [2/2]

template LIBMESH_EXPORT void libMesh::System::read_serialized_data< Real > ( Xdr io,
const bool  read_additional_data = true 
)
inlineinherited

Non-templated version for backward compatibility.

Reads additional data, namely vectors, for this System. This method may safely be called on a distributed-memory mesh.

Definition at line 1331 of file system.h.

1333  { read_serialized_data<Number>(io, read_additional_data); }

◆ read_serialized_vectors() [1/2]

template<typename InValType >
std::size_t libMesh::System::read_serialized_vectors ( Xdr io,
const std::vector< NumericVector< Number > *> &  vectors 
) const
inherited

Read a number of identically distributed vectors.

This method allows for optimization for the multiple vector case by only communicating the metadata once.

Definition at line 2165 of file system_io.C.

References libMesh::Xdr::data(), libMesh::System::get_mesh(), libMesh::libmesh_assert(), libMesh::make_range(), libMesh::MeshTools::n_elem(), libMesh::MeshBase::n_elem(), n_nodes, libMesh::MeshBase::n_nodes(), libMesh::System::n_vars(), libMesh::ParallelObject::processor_id(), libMesh::System::read_SCALAR_dofs(), libMesh::System::read_serialized_blocked_dof_objects(), libMesh::Xdr::reading(), libMesh::SCALAR, and libMesh::System::variable().

Referenced by libMesh::RBEvaluation::read_in_vectors_from_multiple_files().

2167 {
2168  parallel_object_only();
2169 
2170  // Error checking
2171  // #ifndef NDEBUG
2172  // // In parallel we better be reading a parallel vector -- if not
2173  // // we will not set all of its components below!!
2174  // if (this->n_processors() > 1)
2175  // {
2176  // libmesh_assert (vec.type() == PARALLEL ||
2177  // vec.type() == GHOSTED);
2178  // }
2179  // #endif
2180 
2181  libmesh_assert (io.reading());
2182 
2183  if (this->processor_id() == 0)
2184  {
2185  // sizes
2186  unsigned int num_vecs=0;
2187  dof_id_type vector_length=0;
2188 
2189  // Get the number of vectors
2190  io.data(num_vecs);
2191  // Get the buffer size
2192  io.data(vector_length);
2193 
2194  libmesh_error_msg_if
2195  (num_vecs != vectors.size(),
2196  "Xdr file header declares " << num_vecs << " vectors, but we were asked to read " << vectors.size());
2197 
2198  if (num_vecs != 0)
2199  {
2200  libmesh_error_msg_if (vectors[0] == nullptr, "vectors[0] should not be null");
2201  libmesh_error_msg_if (vectors[0]->size() != vector_length, "Inconsistent vector sizes");
2202  }
2203  }
2204 
2205  // no need to actually communicate these.
2206  // this->comm().broadcast(num_vecs);
2207  // this->comm().broadcast(vector_length);
2208 
2209  // Cache these - they are not free!
2210  const dof_id_type
2211  n_nodes = this->get_mesh().n_nodes(),
2212  n_elem = this->get_mesh().n_elem();
2213 
2214  std::size_t read_length = 0;
2215 
2216  //---------------------------------
2217  // Collect the values for all nodes
2218  read_length +=
2219  this->read_serialized_blocked_dof_objects (n_nodes,
2220  this->get_mesh().local_nodes_begin(),
2221  this->get_mesh().local_nodes_end(),
2222  InValType(),
2223  io,
2224  vectors);
2225 
2226  //------------------------------------
2227  // Collect the values for all elements
2228  read_length +=
2230  this->get_mesh().local_elements_begin(),
2231  this->get_mesh().local_elements_end(),
2232  InValType(),
2233  io,
2234  vectors);
2235 
2236  //-------------------------------------------
2237  // Finally loop over all the SCALAR variables
2238  for (NumericVector<Number> * vec : vectors)
2239  for (auto var : make_range(this->n_vars()))
2240  if (this->variable(var).type().family == SCALAR)
2241  {
2242  libmesh_assert_not_equal_to (vec, 0);
2243 
2244  read_length +=
2245  this->read_SCALAR_dofs (var, io, vec);
2246  }
2247 
2248  //---------------------------------------
2249  // last step - must close all the vectors
2250  for (NumericVector<Number> * vec : vectors)
2251  {
2252  libmesh_assert_not_equal_to (vec, 0);
2253  vec->close();
2254  }
2255 
2256  return read_length;
2257 }
const Variable & variable(unsigned int var) const
Return a constant reference to Variable var.
Definition: system.C:2684
dof_id_type n_elem(const MeshBase::const_element_iterator &begin, const MeshBase::const_element_iterator &end)
Count up the number of elements of a specific type (as defined by an iterator range).
Definition: mesh_tools.C:976
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.
Definition: system_io.C:765
const MeshBase & get_mesh() const
Definition: system.h:2359
const dof_id_type n_nodes
Definition: tecplot_io.C:67
libmesh_assert(ctx)
IntRange< T > make_range(T beg, T end)
The 2-parameter make_range() helper function returns an IntRange<T> when both input parameters are of...
Definition: int_range.h:140
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...
Definition: system_io.C:1089
unsigned int n_vars() const
Definition: system.C:2654
virtual dof_id_type n_elem() const =0
processor_id_type processor_id() const
template class LIBMESH_EXPORT NumericVector< Number >
virtual dof_id_type n_nodes() const =0
uint8_t dof_id_type
Definition: id_types.h:67

◆ read_serialized_vectors() [2/2]

template LIBMESH_EXPORT std::size_t libMesh::System::read_serialized_vectors< Real > ( Xdr io,
const std::vector< NumericVector< Number > *> &  vectors 
) const
inlineinherited

Non-templated version for backward compatibility.

Read a number of identically distributed vectors. This method allows for optimization for the multiple vector case by only communicating the metadata once.

Definition at line 1351 of file system.h.

1353  { return read_serialized_vectors<Number>(io, vectors); }

◆ reinit()

void libMesh::EigenSystem::reinit ( )
overridevirtual

Reinitializes the member data fields associated with the system, so that, e.g., assemble() may be used.

Reimplemented from libMesh::System.

Reimplemented in libMesh::CondensedEigenSystem.

Definition at line 189 of file eigen_system.C.

References libMesh::System::reinit(), shell_matrix_A, shell_matrix_B, and shell_precond_matrix.

Referenced by libMesh::CondensedEigenSystem::reinit().

190 {
191  // initialize parent data
192  // this calls reinit on matrix_A, matrix_B, and precond_matrix (if any)
193  Parent::reinit();
194 
195  if (shell_matrix_A)
196  {
197  shell_matrix_A->clear();
198  shell_matrix_A->init();
199  }
200 
201  if (shell_matrix_B)
202  {
203  shell_matrix_B->clear();
204  shell_matrix_B->init();
205  }
206 
208  {
209  shell_precond_matrix->clear();
210  shell_precond_matrix->init();
211  }
212 }
virtual void reinit()
Reinitializes degrees of freedom and other required data on the current mesh.
Definition: system.C:439
std::unique_ptr< ShellMatrix< Number > > shell_precond_matrix
A preconditioning shell matrix.
Definition: eigen_system.h:353
std::unique_ptr< ShellMatrix< Number > > shell_matrix_A
The system shell matrix for standard eigenvalue problems.
Definition: eigen_system.h:329
std::unique_ptr< ShellMatrix< Number > > shell_matrix_B
A second system shell matrix for generalized eigenvalue problems.
Definition: eigen_system.h:337

◆ reinit_constraints()

void libMesh::System::reinit_constraints ( )
virtualinherited

Reinitializes the constraints for this system.

Also prepares the send_list, whether or not constraints have changed.

Definition at line 480 of file system.C.

References libMesh::System::_mesh, libMesh::DofMap::create_dof_constraints(), libMesh::System::get_dof_map(), libMesh::on_command_line(), libMesh::out, libMesh::DofMap::prepare_send_list(), libMesh::DofMap::print_dof_constraints(), libMesh::DofMap::process_constraints(), libMesh::System::time, and libMesh::System::user_constrain().

Referenced by libMesh::EquationSystems::allgather(), libMesh::System::init_data(), libMesh::PetscDMWrapper::init_petscdm(), and libMesh::EquationSystems::reinit_solutions().

481 {
482  parallel_object_only();
483 
484 #ifdef LIBMESH_ENABLE_CONSTRAINTS
486  user_constrain();
488  if (libMesh::on_command_line ("--print-constraints"))
490 #endif
492 }
Real time
For time-dependent problems, this is the time t at the beginning of the current timestep.
Definition: system.h:1638
void print_dof_constraints(std::ostream &os=libMesh::out, bool print_nonlocal=false) const
Prints (from processor 0) all DoF and Node constraints.
void process_constraints(MeshBase &)
Postprocesses any constrained degrees of freedom to be constrained only in terms of unconstrained dof...
OStreamProxy out
void create_dof_constraints(const MeshBase &, Real time=0)
Rebuilds the raw degree of freedom and DofObject constraints, based on attached DirichletBoundary obj...
void prepare_send_list()
Takes the _send_list vector (which may have duplicate entries) and sorts it.
Definition: dof_map.C:1831
bool on_command_line(std::string arg)
Definition: libmesh.C:1058
virtual void user_constrain()
Calls user&#39;s attached constraint function, or is overridden by the user in derived classes...
Definition: system.C:2103
const DofMap & get_dof_map() const
Definition: system.h:2375
MeshBase & _mesh
Constant reference to the mesh data structure used for the simulation.
Definition: system.h:2214

◆ reinit_mesh()

void libMesh::System::reinit_mesh ( )
virtualinherited

Reinitializes the system with a new mesh.

Definition at line 286 of file system.C.

References libMesh::System::_basic_system_only, libMesh::System::init_data(), libMesh::System::n_vars(), and libMesh::System::user_initialization().

Referenced by libMesh::System::init().

287 {
288  parallel_object_only();
289 
290  // First initialize any required data:
291  // either only the basic System data
292  if (_basic_system_only)
294  // or all the derived class' data too
295  else
296  this->init_data();
297 
298  // If no variables have been added to this system
299  // don't do anything
300  if (!this->n_vars())
301  return;
302 
303  // Then call the user-provided initialization function
304  this->user_initialization();
305 
306 }
bool _basic_system_only
Holds true if the components of more advanced system types (e.g.
Definition: system.h:2277
virtual void init_data()
Initializes the data for the system.
Definition: system.C:204
virtual void user_initialization()
Calls user&#39;s attached initialization function, or is overridden by the user in derived classes...
Definition: system.C:2075
unsigned int n_vars() const
Definition: system.C:2654

◆ remove_matrix()

void libMesh::System::remove_matrix ( std::string_view  mat_name)
inherited

Removes the additional matrix mat_name from this system.

Definition at line 1074 of file system.C.

References libMesh::System::_matrices.

1075 {
1076  parallel_object_only(); // Not strictly needed, but the only safe way to keep in sync
1077 
1078  if (const auto pos = _matrices.find(mat_name);
1079  pos != _matrices.end())
1080  _matrices.erase(pos); // erase()'d entries are destroyed
1081 }
std::map< std::string, std::unique_ptr< SparseMatrix< Number > >, std::less<> > _matrices
Some systems need an arbitrary number of matrices.
Definition: system.h:2254

◆ remove_vector()

void libMesh::System::remove_vector ( std::string_view  vec_name)
inherited

Removes the additional vector vec_name from this system.

Definition at line 858 of file system.C.

References libMesh::System::_vector_is_adjoint, libMesh::System::_vector_projections, libMesh::System::_vectors, and libMesh::libmesh_assert().

Referenced by libMesh::AdjointRefinementEstimator::estimate_error(), and libMesh::UnsteadySolver::integrate_adjoint_sensitivity().

859 {
860  parallel_object_only(); // Not strictly needed, but the only safe way to keep in sync
861 
862  if (const auto pos = _vectors.find(vec_name);
863  pos != _vectors.end())
864  {
865  _vectors.erase(pos);
866  auto proj_it = _vector_projections.find(vec_name);
867  libmesh_assert(proj_it != _vector_projections.end());
868  _vector_projections.erase(proj_it);
869 
870  auto adj_it = _vector_is_adjoint.find(vec_name);
871  libmesh_assert(adj_it != _vector_is_adjoint.end());
872  _vector_is_adjoint.erase(adj_it);
873  }
874 }
std::map< std::string, std::unique_ptr< NumericVector< Number > >, std::less<> > _vectors
Some systems need an arbitrary number of vectors.
Definition: system.h:2237
std::map< std::string, int, std::less<> > _vector_is_adjoint
Holds non-negative if a vector by that name should be projected using adjoint constraints/BCs, -1 if primal.
Definition: system.h:2249
libmesh_assert(ctx)
std::map< std::string, bool, std::less<> > _vector_projections
Holds true if a vector by that name should be projected onto a changed grid, false if it should be ze...
Definition: system.h:2243

◆ request_matrix() [1/2]

const SparseMatrix< Number > * libMesh::System::request_matrix ( std::string_view  mat_name) const
inherited
Returns
A const pointer to this system's additional matrix named mat_name, or nullptr if no matrix by that name exists.

Definition at line 1085 of file system.C.

References libMesh::System::_matrices.

Referenced by has_matrix_A(), has_matrix_B(), has_precond_matrix(), libMesh::ImplicitSystem::sensitivity_solve(), libMesh::NewtonSolver::solve(), and libMesh::LinearImplicitSystem::solve().

1086 {
1087  if (const auto pos = _matrices.find(mat_name);
1088  pos != _matrices.end())
1089  return pos->second.get();
1090 
1091  // Otherwise, mat_name does not exist
1092  return nullptr;
1093 }
std::map< std::string, std::unique_ptr< SparseMatrix< Number > >, std::less<> > _matrices
Some systems need an arbitrary number of matrices.
Definition: system.h:2254

◆ request_matrix() [2/2]

SparseMatrix< Number > * libMesh::System::request_matrix ( std::string_view  mat_name)
inherited
Returns
A writable pointer to this system's additional matrix named mat_name, or nullptr if no matrix by that name exists.

Definition at line 1097 of file system.C.

References libMesh::System::_matrices.

1098 {
1099  if (auto pos = _matrices.find(mat_name);
1100  pos != _matrices.end())
1101  return pos->second.get();
1102 
1103  // Otherwise, mat_name does not exist
1104  return nullptr;
1105 }
std::map< std::string, std::unique_ptr< SparseMatrix< Number > >, std::less<> > _matrices
Some systems need an arbitrary number of matrices.
Definition: system.h:2254

◆ request_vector() [1/4]

const NumericVector< Number > * libMesh::System::request_vector ( std::string_view  vec_name) const
inherited
Returns
A const pointer to the vector if this System has a vector associated with the given name, nullptr otherwise.

Definition at line 876 of file system.C.

References libMesh::System::_vectors, and libMesh::NumericVector< T >::get().

Referenced by libMesh::UniformRefinementEstimator::_estimate_error().

877 {
878  if (const auto pos = _vectors.find(vec_name);
879  pos != _vectors.end())
880  return pos->second.get();
881 
882  // Otherwise, vec_name was not found
883  return nullptr;
884 }
std::map< std::string, std::unique_ptr< NumericVector< Number > >, std::less<> > _vectors
Some systems need an arbitrary number of vectors.
Definition: system.h:2237

◆ request_vector() [2/4]

NumericVector< Number > * libMesh::System::request_vector ( std::string_view  vec_name)
inherited
Returns
A pointer to the vector if this System has a vector associated with the given name, nullptr otherwise.

Definition at line 888 of file system.C.

References libMesh::System::_vectors, and libMesh::NumericVector< T >::get().

889 {
890  if (auto pos = _vectors.find(vec_name);
891  pos != _vectors.end())
892  return pos->second.get();
893 
894  // Otherwise, vec_name was not found
895  return nullptr;
896 }
std::map< std::string, std::unique_ptr< NumericVector< Number > >, std::less<> > _vectors
Some systems need an arbitrary number of vectors.
Definition: system.h:2237

◆ request_vector() [3/4]

const NumericVector< Number > * libMesh::System::request_vector ( const unsigned int  vec_num) const
inherited
Returns
A const pointer to this system's additional vector number vec_num (where the vectors are counted starting with 0), or nullptr if the system has no such vector.

Definition at line 900 of file system.C.

References libMesh::System::_vectors, and libMesh::System::vectors_begin().

901 {
902  // If we don't have that many vectors, return nullptr
903  if (vec_num >= _vectors.size())
904  return nullptr;
905 
906  // Otherwise return a pointer to the vec_num'th vector
907  auto it = vectors_begin();
908  std::advance(it, vec_num);
909  return it->second.get();
910 }
std::map< std::string, std::unique_ptr< NumericVector< Number > >, std::less<> > _vectors
Some systems need an arbitrary number of vectors.
Definition: system.h:2237
vectors_iterator vectors_begin()
Beginning of vectors container.
Definition: system.h:2463

◆ request_vector() [4/4]

NumericVector< Number > * libMesh::System::request_vector ( const unsigned int  vec_num)
inherited
Returns
A writable pointer to this system's additional vector number vec_num (where the vectors are counted starting with 0), or nullptr if the system has no such vector.

Definition at line 914 of file system.C.

References libMesh::System::_vectors, and libMesh::System::vectors_begin().

915 {
916  // If we don't have that many vectors, return nullptr
917  if (vec_num >= _vectors.size())
918  return nullptr;
919 
920  // Otherwise return a pointer to the vec_num'th vector
921  auto it = vectors_begin();
922  std::advance(it, vec_num);
923  return it->second.get();
924 }
std::map< std::string, std::unique_ptr< NumericVector< Number > >, std::less<> > _vectors
Some systems need an arbitrary number of vectors.
Definition: system.h:2237
vectors_iterator vectors_begin()
Beginning of vectors container.
Definition: system.h:2463

◆ restrict_solve_to()

void libMesh::System::restrict_solve_to ( const SystemSubset subset,
const SubsetSolveMode  subset_solve_mode = SUBSET_ZERO 
)
virtualinherited

After calling this method, any solve will be restricted to the given subdomain.

To disable this mode, call this method with subset being a nullptr.

Reimplemented in libMesh::LinearImplicitSystem.

Definition at line 542 of file system.C.

544 {
545  if (subset != nullptr)
546  libmesh_not_implemented();
547 }

◆ restrict_vectors()

void libMesh::System::restrict_vectors ( )
virtualinherited

Restrict vectors after the mesh has coarsened.

Definition at line 371 of file system.C.

References libMesh::System::_dof_map, libMesh::System::_solution_projection, libMesh::System::_vector_projections, libMesh::System::_vectors, libMesh::System::current_local_solution, libMesh::NumericVector< T >::get(), libMesh::GHOSTED, libMesh::System::n_dofs(), libMesh::System::n_local_dofs(), libMesh::PARALLEL, libMesh::System::project_vector(), libMesh::System::solution, and libMesh::System::vector_is_adjoint().

Referenced by libMesh::System::prolong_vectors(), and libMesh::EquationSystems::reinit_solutions().

372 {
373  parallel_object_only();
374 
375 #ifdef LIBMESH_ENABLE_AMR
376  // Restrict the _vectors on the coarsened cells
377  for (auto & [vec_name, vec] : _vectors)
378  {
379  NumericVector<Number> * v = vec.get();
380 
381  if (_vector_projections[vec_name])
382  {
383  this->project_vector (*v, this->vector_is_adjoint(vec_name));
384  }
385  else
386  {
387  const ParallelType type = vec->type();
388 
389  if (type == GHOSTED)
390  {
391 #ifdef LIBMESH_ENABLE_GHOSTED
392  vec->init (this->n_dofs(), this->n_local_dofs(),
393  _dof_map->get_send_list(), /*fast=*/false,
394  GHOSTED);
395 #else
396  libmesh_error_msg("Cannot initialize ghosted vectors when they are not enabled.");
397 #endif
398  }
399  else
400  vec->init (this->n_dofs(), this->n_local_dofs(), false, type);
401  }
402  }
403 
404  const std::vector<dof_id_type> & send_list = _dof_map->get_send_list ();
405 
406  // Restrict the solution on the coarsened cells
408  this->project_vector (*solution);
409  // Or at least make sure the solution vector is the correct size
410  else
411  solution->init (this->n_dofs(), this->n_local_dofs(), true, PARALLEL);
412 
413 #ifdef LIBMESH_ENABLE_GHOSTED
414  current_local_solution->init(this->n_dofs(),
415  this->n_local_dofs(), send_list,
416  false, GHOSTED);
417 #else
418  current_local_solution->init(this->n_dofs());
419 #endif
420 
422  solution->localize (*current_local_solution, send_list);
423 
424 #endif // LIBMESH_ENABLE_AMR
425 }
int vector_is_adjoint(std::string_view vec_name) const
Definition: system.C:1158
std::unique_ptr< DofMap > _dof_map
Data structure describing the relationship between nodes, variables, etc...
Definition: system.h:2202
std::map< std::string, std::unique_ptr< NumericVector< Number > >, std::less<> > _vectors
Some systems need an arbitrary number of vectors.
Definition: system.h:2237
dof_id_type n_local_dofs() const
Definition: system.C:156
dof_id_type n_dofs() const
Definition: system.C:119
std::unique_ptr< NumericVector< Number > > solution
Data structure to hold solution values.
Definition: system.h:1616
bool _solution_projection
Holds true if the solution vector should be projected onto a changed grid, false if it should be zero...
Definition: system.h:2271
std::unique_ptr< NumericVector< Number > > current_local_solution
All the values I need to compute my contribution to the simulation at hand.
Definition: system.h:1628
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...
template class LIBMESH_EXPORT NumericVector< Number >
std::map< std::string, bool, std::less<> > _vector_projections
Holds true if a vector by that name should be projected onto a changed grid, false if it should be ze...
Definition: system.h:2243
ParallelType
Defines an enum for parallel data structure types.

◆ sensitivity_solve()

std::pair< unsigned int, Real > libMesh::System::sensitivity_solve ( const ParameterVector parameters)
inlinevirtualinherited

Solves the sensitivity system, for the provided parameters.

Must be overridden in derived systems.

Returns
A pair with the total number of linear iterations performed and the (sum of the) final residual norms

This method is only implemented in some derived classes.

Reimplemented in libMesh::ImplicitSystem.

Definition at line 2531 of file system.h.

2532 {
2533  libmesh_not_implemented();
2534 }

◆ set_adjoint_already_solved()

void libMesh::System::set_adjoint_already_solved ( bool  setting)
inlineinherited

Setter for the adjoint_already_solved boolean.

Definition at line 416 of file system.h.

References libMesh::System::adjoint_already_solved.

Referenced by main().

417  { adjoint_already_solved = setting;}
bool adjoint_already_solved
Has the adjoint problem already been solved? If the user sets adjoint_already_solved to true...
Definition: system.h:2309

◆ set_basic_system_only()

void libMesh::System::set_basic_system_only ( )
inlineinherited

Sets the system to be "basic only": i.e.

advanced system components such as ImplicitSystem matrices may not be initialized. This is useful for efficiency in certain utility programs that never use System::solve(). This method must be called after the System or derived class is created but before it is initialized; e.g. from within EquationSystems::read()

Definition at line 2423 of file system.h.

References libMesh::System::_basic_system_only.

Referenced by libMesh::EquationSystems::read().

2424 {
2425  _basic_system_only = true;
2426 }
bool _basic_system_only
Holds true if the components of more advanced system types (e.g.
Definition: system.h:2277

◆ set_eigenproblem_type()

void libMesh::EigenSystem::set_eigenproblem_type ( EigenProblemType  ept)

Sets the type of the current eigen problem.

Definition at line 85 of file eigen_system.C.

References _eigen_problem_type, libMesh::System::can_add_matrices(), eigen_solver, libMesh::GHEP, libMesh::GHIEP, libMesh::GNHEP, libMesh::HEP, and libMesh::NHEP.

Referenced by main(), and libMesh::RBSCMConstruction::RBSCMConstruction().

86 {
87  if (!can_add_matrices())
88  libmesh_error_msg("ERROR: Cannot change eigen problem type after system initialization");
89 
90  _eigen_problem_type = ept;
91 
92  eigen_solver->set_eigenproblem_type(ept);
93 
94  // libMesh::out << "The Problem type is set to be: " << std::endl;
95 
96  switch (_eigen_problem_type)
97  {
98  case HEP:
99  // libMesh::out << "Hermitian" << std::endl;
100  break;
101 
102  case NHEP:
103  // libMesh::out << "Non-Hermitian" << std::endl;
104  break;
105 
106  case GHEP:
107  // libMesh::out << "Generalized Hermitian" << std::endl;
108  break;
109 
110  case GNHEP:
111  // libMesh::out << "Generalized Non-Hermitian" << std::endl;
112  break;
113 
114  case GHIEP:
115  // libMesh::out << "Generalized indefinite Hermitian" << std::endl;
116  break;
117 
118  default:
119  // libMesh::out << "not properly specified" << std::endl;
120  libmesh_error_msg("Unrecognized _eigen_problem_type = " << _eigen_problem_type);
121  }
122 }
bool can_add_matrices() const
Definition: system.h:1998
std::unique_ptr< EigenSolver< Number > > eigen_solver
The EigenSolver, defining which interface, i.e solver package to use.
Definition: eigen_system.h:362
EigenProblemType _eigen_problem_type
The type of the eigenvalue problem.
Definition: eigen_system.h:409

◆ set_initial_space()

void libMesh::EigenSystem::set_initial_space ( NumericVector< Number > &  initial_space_in)

Sets an initial eigen vector.

Definition at line 319 of file eigen_system.C.

References eigen_solver.

320 {
321  eigen_solver->set_initial_space (initial_space_in);
322 }
std::unique_ptr< EigenSolver< Number > > eigen_solver
The EigenSolver, defining which interface, i.e solver package to use.
Definition: eigen_system.h:362

◆ set_n_converged()

void libMesh::EigenSystem::set_n_converged ( unsigned int  nconv)
inlineprotected

Set the _n_converged_eigenpairs member, useful for subclasses of EigenSystem.

Definition at line 381 of file eigen_system.h.

References _n_converged_eigenpairs.

382  { _n_converged_eigenpairs = nconv; }
unsigned int _n_converged_eigenpairs
The number of converged eigenpairs.
Definition: eigen_system.h:399

◆ set_n_iterations()

void libMesh::EigenSystem::set_n_iterations ( unsigned int  its)
inlineprotected

Set the _n_iterations member, useful for subclasses of EigenSystem.

Definition at line 388 of file eigen_system.h.

References _n_iterations.

389  { _n_iterations = its;}
unsigned int _n_iterations
The number of iterations of the eigen solver algorithm.
Definition: eigen_system.h:404

◆ set_project_with_constraints()

void libMesh::System::set_project_with_constraints ( bool  _project_with_constraints)
inlineinherited

Definition at line 1823 of file system.h.

References libMesh::System::project_with_constraints.

Referenced by libMesh::AdjointRefinementEstimator::estimate_error().

1824  {
1825  project_with_constraints = _project_with_constraints;
1826  }
bool project_with_constraints
Do we want to apply constraints while projecting vectors ?
Definition: system.h:2320

◆ set_qoi() [1/2]

void libMesh::System::set_qoi ( unsigned int  qoi_index,
Number  qoi_value 
)
inherited

Definition at line 2156 of file system.C.

References libMesh::libmesh_assert(), and libMesh::System::qoi.

Referenced by libMesh::ExplicitSystem::assemble_qoi(), libMesh::FEMSystem::assemble_qoi(), libMesh::Euler2Solver::integrate_qoi_timestep(), libMesh::TwostepTimeSolver::integrate_qoi_timestep(), and libMesh::EulerSolver::integrate_qoi_timestep().

2157 {
2158  libmesh_assert(qoi_index < qoi.size());
2159 
2160  qoi[qoi_index] = qoi_value;
2161 }
std::vector< Number > qoi
Values of the quantities of interest.
Definition: system.h:1654
libmesh_assert(ctx)

◆ set_qoi() [2/2]

void libMesh::System::set_qoi ( std::vector< Number new_qoi)
inherited

Definition at line 2177 of file system.C.

References libMesh::System::qoi.

2178 {
2179  libmesh_assert_equal_to(this->qoi.size(), new_qoi.size());
2180  this->qoi = std::move(new_qoi);
2181 }
std::vector< Number > qoi
Values of the quantities of interest.
Definition: system.h:1654

◆ set_qoi_error_estimate()

void libMesh::System::set_qoi_error_estimate ( unsigned int  qoi_index,
Number  qoi_error_estimate 
)
inherited

Definition at line 2184 of file system.C.

References libMesh::libmesh_assert(), and libMesh::System::qoi_error_estimates.

Referenced by libMesh::Euler2Solver::integrate_adjoint_refinement_error_estimate(), libMesh::TwostepTimeSolver::integrate_adjoint_refinement_error_estimate(), and libMesh::EulerSolver::integrate_adjoint_refinement_error_estimate().

2185 {
2186  libmesh_assert(qoi_index < qoi_error_estimates.size());
2187 
2188  qoi_error_estimates[qoi_index] = qoi_error_estimate;
2189 }
libmesh_assert(ctx)
std::vector< Number > qoi_error_estimates
Vector to hold error estimates for qois, either from a steady state calculation, or from a single uns...
Definition: system.h:1662

◆ set_vector_as_adjoint()

void libMesh::System::set_vector_as_adjoint ( const std::string &  vec_name,
int  qoi_num 
)
inherited

Allows one to set the QoI index controlling whether the vector identified by vec_name represents a solution from the adjoint (qoi_num >= 0) or primal (qoi_num == -1) space.

This becomes significant if those spaces have differing heterogeneous Dirichlet constraints.

qoi_num == -2 can be used to indicate a vector which should not be affected by constraints during projection operations.

Definition at line 1145 of file system.C.

References libMesh::System::_vector_is_adjoint.

Referenced by libMesh::System::add_adjoint_solution(), and libMesh::System::add_weighted_sensitivity_adjoint_solution().

1147 {
1148  parallel_object_only(); // Not strictly needed, but the only safe way to keep in sync
1149 
1150  // We reserve -1 for vectors which get primal constraints, -2 for
1151  // vectors which get no constraints
1152  libmesh_assert_greater_equal(qoi_num, -2);
1153  _vector_is_adjoint[vec_name] = qoi_num;
1154 }
std::map< std::string, int, std::less<> > _vector_is_adjoint
Holds non-negative if a vector by that name should be projected using adjoint constraints/BCs, -1 if primal.
Definition: system.h:2249

◆ set_vector_preservation()

void libMesh::System::set_vector_preservation ( const std::string &  vec_name,
bool  preserve 
)
inherited

Allows one to set the boolean controlling whether the vector identified by vec_name should be "preserved": projected to new meshes, saved, etc.

Definition at line 1123 of file system.C.

References libMesh::System::_vector_projections.

Referenced by libMesh::AdjointRefinementEstimator::estimate_error(), and main().

1125 {
1126  parallel_object_only(); // Not strictly needed, but the only safe way to keep in sync
1127 
1128  _vector_projections[vec_name] = preserve;
1129 }
std::map< std::string, bool, std::less<> > _vector_projections
Holds true if a vector by that name should be projected onto a changed grid, false if it should be ze...
Definition: system.h:2243

◆ solve()

void libMesh::EigenSystem::solve ( )
overridevirtual

Assembles & solves the eigen system.

Reimplemented from libMesh::System.

Reimplemented in libMesh::CondensedEigenSystem.

Definition at line 287 of file eigen_system.C.

References libMesh::System::assemble(), libMesh::System::assemble_before_solve, libMesh::System::get_dof_map(), libMesh::System::get_equation_systems(), libMesh::Parameters::have_parameter(), libMesh::libmesh_assert(), matrix_A, matrix_B, libMesh::System::n_constrained_dofs(), libMesh::System::parameters, precond_matrix, and solve_helper().

Referenced by main(), and libMesh::CondensedEigenSystem::solve().

288 {
290  libmesh_warning("EigenSystem does not have first-class support for constrained degrees of "
291  "freedom. You may see spurious effects of the constrained degrees of freedom "
292  "in a given eigenvector. If you wish to perform a reliable solve on a system "
293  "with constraints, please use the CondensedEigenSystem class instead");
294 
295  // check that necessary parameters have been set
297  this->get_equation_systems().parameters.have_parameter<unsigned int>("eigenpairs"));
299  this->get_equation_systems().parameters.have_parameter<unsigned int>("basis vectors"));
300 
301  if (this->assemble_before_solve)
302  // Assemble the linear system
303  this->assemble ();
304 
306 }
void solve_helper(SparseMatrix< Number > *const A, SparseMatrix< Number > *const B, SparseMatrix< Number > *const P)
Definition: eigen_system.C:215
bool have_parameter(std::string_view) const
Definition: parameters.h:420
SparseMatrix< Number > * matrix_B
A second system matrix for generalized eigenvalue problems.
Definition: eigen_system.h:321
const EquationSystems & get_equation_systems() const
Definition: system.h:722
virtual void assemble()
Prepares matrix and _dof_map for matrix assembly.
Definition: system.C:551
Parameters parameters
Parameters for the system. If a parameter is not provided, it should be retrieved from the EquationSy...
Definition: system.h:1549
SparseMatrix< Number > * precond_matrix
A preconditioning matrix.
Definition: eigen_system.h:345
libmesh_assert(ctx)
SparseMatrix< Number > * matrix_A
The system matrix for standard eigenvalue problems.
Definition: eigen_system.h:313
bool assemble_before_solve
Flag which tells the system to whether or not to call the user assembly function during each call to ...
Definition: system.h:1570
const DofMap & get_dof_map() const
Definition: system.h:2375
dof_id_type n_constrained_dofs() const
Definition: system.C:126

◆ solve_for_unconstrained_dofs()

void libMesh::System::solve_for_unconstrained_dofs ( NumericVector< Number > &  vec,
int  is_adjoint = -1 
) const
protectedinherited

Definition at line 2041 of file system_projection.C.

References libMesh::DofMap::build_sparsity(), libMesh::DofMap::computed_sparsity_already(), libMesh::DofMapBase::end_dof(), libMesh::DofMapBase::first_dof(), libMesh::NumericVector< T >::get(), libMesh::DofMap::heterogenously_constrain_element_matrix_and_vector(), libMesh::DofMap::is_constrained_dof(), libMesh::NumericVector< T >::local_size(), libMesh::DofMap::n_dofs(), libMesh::DofMap::n_local_dofs(), libMesh::PARALLEL, libMesh::Real, libMesh::NumericVector< T >::size(), and libMesh::DofMap::update_sparsity_pattern().

2043 {
2044  const DofMap & dof_map = this->get_dof_map();
2045 
2046  std::unique_ptr<SparseMatrix<Number>> mat =
2048 
2049  std::unique_ptr<SparsityPattern::Build> sp;
2050 
2051  if (dof_map.computed_sparsity_already())
2052  dof_map.update_sparsity_pattern(*mat);
2053  else
2054  {
2055  mat->attach_dof_map(dof_map);
2056  sp = dof_map.build_sparsity(this->get_mesh());
2057  mat->attach_sparsity_pattern(*sp);
2058  }
2059 
2060  mat->init();
2061 
2062  libmesh_assert_equal_to(vec.size(), dof_map.n_dofs());
2063  libmesh_assert_equal_to(vec.local_size(), dof_map.n_local_dofs());
2064 
2065  std::unique_ptr<NumericVector<Number>> rhs =
2067 
2068  rhs->init(dof_map.n_dofs(), dof_map.n_local_dofs(), false,
2069  PARALLEL);
2070 
2071  // Here we start with the unconstrained (and indeterminate) linear
2072  // system, K*u = f, where K is the identity matrix for constrained
2073  // DoFs and 0 elsewhere, and f is the current solution values for
2074  // constrained DoFs and 0 elsewhere.
2075  // We then apply the usual heterogeneous constraint matrix C and
2076  // offset h, where u = C*x + h,
2077  // to get C^T*K*C*x = C^T*f - C^T*K*h
2078  // - a constrained and no-longer-singular system that finds the
2079  // closest approximation for the unconstrained degrees of freedom.
2080  //
2081  // Here, though "closest" is in an algebraic sense; we're
2082  // effectively using a pseudoinverse that optimizes in a
2083  // discretization-dependent norm. That only seems to give ~0.1%
2084  // excess error even in coarse unit test cases, but at some point it
2085  // might be reasonable to weight K and f properly.
2086 
2087  for (dof_id_type d : IntRange<dof_id_type>(dof_map.first_dof(),
2088  dof_map.end_dof()))
2089  {
2090  if (dof_map.is_constrained_dof(d))
2091  {
2092  DenseMatrix<Number> K(1,1);
2093  DenseVector<Number> F(1);
2094  std::vector<dof_id_type> dof_indices(1, d);
2095  K(0,0) = 1;
2096  F(0) = (*this->solution)(d);
2097  dof_map.heterogenously_constrain_element_matrix_and_vector
2098  (K, F, dof_indices, false, is_adjoint);
2099  mat->add_matrix(K, dof_indices);
2100  rhs->add_vector(F, dof_indices);
2101  }
2102  }
2103 
2104  std::unique_ptr<LinearSolver<Number>> linear_solver =
2106 
2107  linear_solver->solve(*mat, vec, *rhs,
2108  double(this->get_equation_systems().parameters.get<Real>("linear solver tolerance")),
2109  this->get_equation_systems().parameters.get<unsigned int>("linear solver maximum iterations"));
2110 }
static std::unique_ptr< LinearSolver< T > > build(const libMesh::Parallel::Communicator &comm_in, const SolverPackage solver_package=libMesh::default_solver_package())
Builds a LinearSolver using the linear solver package specified by solver_package.
Definition: linear_solver.C:59
virtual numeric_index_type size() const =0
const EquationSystems & get_equation_systems() const
Definition: system.h:722
const Parallel::Communicator & comm() const
Parameters parameters
Parameters for the system. If a parameter is not provided, it should be retrieved from the EquationSy...
Definition: system.h:1549
const MeshBase & get_mesh() const
Definition: system.h:2359
static std::unique_ptr< SparseMatrix< T > > build(const Parallel::Communicator &comm, const SolverPackage solver_package=libMesh::default_solver_package(), const MatrixBuildType matrix_build_type=MatrixBuildType::AUTOMATIC)
Builds a SparseMatrix<T> using the linear solver package specified by solver_package.
const T & get(std::string_view) const
Definition: parameters.h:451
std::unique_ptr< NumericVector< Number > > solution
Data structure to hold solution values.
Definition: system.h:1616
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
virtual numeric_index_type local_size() const =0
static std::unique_ptr< NumericVector< T > > build(const Parallel::Communicator &comm, SolverPackage solver_package=libMesh::default_solver_package(), ParallelType parallel_type=AUTOMATIC)
Builds a NumericVector on the processors in communicator comm using the linear solver package specifi...
const DofMap & get_dof_map() const
Definition: system.h:2375
uint8_t dof_id_type
Definition: id_types.h:67

◆ solve_helper()

void libMesh::EigenSystem::solve_helper ( SparseMatrix< Number > *const  A,
SparseMatrix< Number > *const  B,
SparseMatrix< Number > *const  P 
)
protected

Definition at line 215 of file eigen_system.C.

References _n_converged_eigenpairs, _n_iterations, _use_shell_matrices, _use_shell_precond_matrix, eigen_solver, generalized(), libMesh::Parameters::get(), libMesh::System::get_equation_systems(), libMesh::Parameters::have_parameter(), libMesh::libmesh_assert(), matrix_B, libMesh::EquationSystems::parameters, libMesh::System::parameters, libMesh::Real, shell_matrix_A, shell_matrix_B, and shell_precond_matrix.

Referenced by solve(), and libMesh::CondensedEigenSystem::solve().

218 {
219  // A reference to the EquationSystems
220  EquationSystems & es = this->get_equation_systems();
221 
222  // Get the tolerance for the solver and the maximum
223  // number of iterations. Here, we simply adopt the linear solver
224  // specific parameters.
225  const double tol = parameters.have_parameter<Real>("linear solver tolerance") ?
226  double(parameters.get<Real>("linear solver tolerance")) :
227  double(es.parameters.get<Real>("linear solver tolerance"));
228 
229  const unsigned int maxits = parameters.have_parameter<unsigned int>("linear solver maximum iterations") ?
230  parameters.get<unsigned int>("linear solver maximum iterations") :
231  es.parameters.get<unsigned int>("linear solver maximum iterations");
232 
233  const unsigned int nev = parameters.have_parameter<unsigned int>("eigenpairs") ?
234  parameters.get<unsigned int>("eigenpairs") :
235  es.parameters.get<unsigned int>("eigenpairs");
236 
237  const unsigned int ncv = parameters.have_parameter<unsigned int>("basis vectors") ?
238  parameters.get<unsigned int>("basis vectors") :
239  es.parameters.get<unsigned int>("basis vectors");
240 
241  std::pair<unsigned int, unsigned int> solve_data;
242 
243  // call the solver depending on the type of eigenproblem
244 
246  {
247  // Generalized eigenproblem
248  if (generalized())
249  // Shell preconditioning matrix
251  solve_data = eigen_solver->solve_generalized(
252  *shell_matrix_A, *shell_matrix_B, *shell_precond_matrix, nev, ncv, tol, maxits);
253  else
254  solve_data = eigen_solver->solve_generalized(
255  *shell_matrix_A, *shell_matrix_B, *P, nev, ncv, tol, maxits);
256 
257  // Standard eigenproblem
258  else
259  {
261  // Shell preconditioning matrix
263  solve_data = eigen_solver->solve_standard(
264  *shell_matrix_A, *shell_precond_matrix, nev, ncv, tol, maxits);
265  else
266  solve_data = eigen_solver->solve_standard(*shell_matrix_A, *P, nev, ncv, tol, maxits);
267  }
268  }
269  else
270  {
271  // Generalized eigenproblem
272  if (generalized())
273  solve_data = eigen_solver->solve_generalized(*A, *B, nev, ncv, tol, maxits);
274 
275  // Standard eigenproblem
276  else
277  {
279  solve_data = eigen_solver->solve_standard(*A, nev, ncv, tol, maxits);
280  }
281  }
282 
283  this->_n_converged_eigenpairs = solve_data.first;
284  this->_n_iterations = solve_data.second;
285 }
bool generalized() const
Definition: eigen_system.C:325
bool have_parameter(std::string_view) const
Definition: parameters.h:420
SparseMatrix< Number > * matrix_B
A second system matrix for generalized eigenvalue problems.
Definition: eigen_system.h:321
unsigned int _n_converged_eigenpairs
The number of converged eigenpairs.
Definition: eigen_system.h:399
std::unique_ptr< ShellMatrix< Number > > shell_precond_matrix
A preconditioning shell matrix.
Definition: eigen_system.h:353
const EquationSystems & get_equation_systems() const
Definition: system.h:722
Parameters parameters
Parameters for the system. If a parameter is not provided, it should be retrieved from the EquationSy...
Definition: system.h:1549
unsigned int _n_iterations
The number of iterations of the eigen solver algorithm.
Definition: eigen_system.h:404
Definition: assembly.h:38
std::unique_ptr< ShellMatrix< Number > > shell_matrix_A
The system shell matrix for standard eigenvalue problems.
Definition: eigen_system.h:329
const T & get(std::string_view) const
Definition: parameters.h:451
bool _use_shell_precond_matrix
A boolean flag to indicate whether or not to use a shell preconditioning matrix.
Definition: eigen_system.h:419
std::unique_ptr< ShellMatrix< Number > > shell_matrix_B
A second system shell matrix for generalized eigenvalue problems.
Definition: eigen_system.h:337
libmesh_assert(ctx)
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
bool _use_shell_matrices
A boolean flag to indicate whether or not to use shell matrices.
Definition: eigen_system.h:414
std::unique_ptr< EigenSolver< Number > > eigen_solver
The EigenSolver, defining which interface, i.e solver package to use.
Definition: eigen_system.h:362

◆ system()

sys_type& libMesh::EigenSystem::system ( )
inline
Returns
A reference to *this.

Definition at line 90 of file eigen_system.h.

90 { return *this; }

◆ system_type()

virtual std::string libMesh::EigenSystem::system_type ( ) const
inlineoverridevirtual
Returns
"Eigen". Helps in identifying the system type in an equation system file.

Reimplemented from libMesh::System.

Definition at line 125 of file eigen_system.h.

125 { return "Eigen"; }

◆ update()

void libMesh::System::update ( )
virtualinherited

Update the local values to reflect the solution on neighboring processors.

Reimplemented in SolidSystem.

Definition at line 495 of file system.C.

References libMesh::System::_dof_map, libMesh::System::current_local_solution, libMesh::libmesh_assert(), and libMesh::System::solution.

Referenced by libMesh::__libmesh_petsc_diff_solver_jacobian(), libMesh::__libmesh_petsc_diff_solver_residual(), libMesh::UniformRefinementEstimator::_estimate_error(), libMesh::FEMSystem::assemble_qoi(), libMesh::FEMSystem::assemble_qoi_derivative(), libMesh::NonlinearImplicitSystem::assembly(), libMesh::EquationSystems::build_parallel_elemental_solution_vector(), libMesh::EquationSystems::build_parallel_solution_vector(), libMesh::NewmarkSolver::compute_initial_accel(), compute_stresses(), LinearElasticityWithContact::compute_stresses(), LinearElasticity::compute_stresses(), LargeDeformationElasticity::compute_stresses(), libMesh::Problem_Interface::computeF(), libMesh::Problem_Interface::computeJacobian(), libMesh::Problem_Interface::computePreconditioner(), libMesh::ExodusII_IO::copy_elemental_solution(), libMesh::Nemesis_IO::copy_elemental_solution(), libMesh::GMVIO::copy_nodal_solution(), libMesh::ExodusII_IO::copy_nodal_solution(), libMesh::Nemesis_IO::copy_nodal_solution(), libMesh::ExodusII_IO::copy_scalar_solution(), libMesh::Nemesis_IO::copy_scalar_solution(), DMlibMeshFunction(), DMlibMeshJacobian(), libMesh::AdjointRefinementEstimator::estimate_error(), libMesh::CondensedEigenSystem::get_eigenpair(), libMesh::TransientRBConstruction::initialize_truth(), libMesh::Euler2Solver::integrate_adjoint_refinement_error_estimate(), libMesh::EulerSolver::integrate_adjoint_refinement_error_estimate(), libMesh::libmesh_petsc_snes_fd_residual(), libMesh::libmesh_petsc_snes_jacobian(), libMesh::libmesh_petsc_snes_mffd_residual(), libMesh::libmesh_petsc_snes_residual(), libMesh::libmesh_petsc_snes_residual_helper(), libMesh::NewtonSolver::line_search(), libMesh::RBConstruction::load_basis_function(), libMesh::TransientRBConstruction::load_rb_solution(), libMesh::RBConstruction::load_rb_solution(), main(), libMesh::FEMSystem::mesh_position_get(), HeatSystem::perturb_accumulate_residuals(), libMesh::ErrorVector::plot_error(), libMesh::FEMSystem::postprocess(), libMesh::ImplicitSystem::qoi_parameter_hessian(), libMesh::MemorySolutionHistory::retrieve(), libMesh::FileSolutionHistory::retrieve(), libMesh::NewtonSolver::solve(), libMesh::ExplicitSystem::solve(), libMesh::LinearImplicitSystem::solve(), libMesh::OptimizationSystem::solve(), libMesh::NonlinearImplicitSystem::solve(), libMesh::ClawSystem::solve_conservation_law(), libMesh::RBConstruction::solve_for_matrix_and_rhs(), libMesh::MeshFunctionSolutionTransfer::transfer(), libMesh::DirectSolutionTransfer::transfer(), and update_current_local_solution().

496 {
497  parallel_object_only();
498 
499  libmesh_assert(solution->closed());
500 
501  const std::vector<dof_id_type> & send_list = _dof_map->get_send_list ();
502 
503  // Check sizes
504  libmesh_assert_equal_to (current_local_solution->size(), solution->size());
505  // More processors than elements => empty send_list
506  // libmesh_assert (!send_list.empty());
507  libmesh_assert_less_equal (send_list.size(), solution->size());
508 
509  // Create current_local_solution from solution. This will
510  // put a local copy of solution into current_local_solution.
511  // Only the necessary values (specified by the send_list)
512  // are copied to minimize communication
513  solution->localize (*current_local_solution, send_list);
514 }
std::unique_ptr< DofMap > _dof_map
Data structure describing the relationship between nodes, variables, etc...
Definition: system.h:2202
std::unique_ptr< NumericVector< Number > > solution
Data structure to hold solution values.
Definition: system.h:1616
libmesh_assert(ctx)
std::unique_ptr< NumericVector< Number > > current_local_solution
All the values I need to compute my contribution to the simulation at hand.
Definition: system.h:1628

◆ update_global_solution() [1/2]

void libMesh::System::update_global_solution ( std::vector< Number > &  global_soln) const
inherited

Fill the input vector global_soln so that it contains the global solution on all processors.

Requires communication with all other processors.

Definition at line 730 of file system.C.

References libMesh::System::solution.

Referenced by libMesh::ExactSolution::_compute_error(), libMesh::ExactErrorEstimator::estimate_error(), main(), and libMesh::InterMeshProjection::project_system_vectors().

731 {
732  parallel_object_only();
733 
734  global_soln.resize (solution->size());
735 
736  solution->localize (global_soln);
737 }
std::unique_ptr< NumericVector< Number > > solution
Data structure to hold solution values.
Definition: system.h:1616

◆ update_global_solution() [2/2]

void libMesh::System::update_global_solution ( std::vector< Number > &  global_soln,
const processor_id_type  dest_proc 
) const
inherited

Fill the input vector global_soln so that it contains the global solution on processor dest_proc.

Requires communication with all other processors.

Definition at line 741 of file system.C.

References libMesh::System::solution.

743 {
744  parallel_object_only();
745 
746  global_soln.resize (solution->size());
747 
748  solution->localize_to_one (global_soln, dest_proc);
749 }
std::unique_ptr< NumericVector< Number > > solution
Data structure to hold solution values.
Definition: system.h:1616

◆ use_shell_matrices() [1/2]

bool libMesh::EigenSystem::use_shell_matrices ( ) const
inline
Returns
true if the shell matrices are used

Definition at line 161 of file eigen_system.h.

References _use_shell_matrices.

Referenced by libMesh::CondensedEigenSystem::add_matrices().

161 { return _use_shell_matrices; }
bool _use_shell_matrices
A boolean flag to indicate whether or not to use shell matrices.
Definition: eigen_system.h:414

◆ use_shell_matrices() [2/2]

void libMesh::EigenSystem::use_shell_matrices ( bool  use_shell_matrices)
inline

Set a flag to use shell matrices.

Definition at line 166 of file eigen_system.h.

References _use_shell_matrices, and use_shell_matrices().

Referenced by use_shell_matrices().

bool use_shell_matrices() const
Definition: eigen_system.h:161
bool _use_shell_matrices
A boolean flag to indicate whether or not to use shell matrices.
Definition: eigen_system.h:414

◆ use_shell_precond_matrix() [1/2]

bool libMesh::EigenSystem::use_shell_precond_matrix ( ) const
inline
Returns
true if a shell preconditioning matrix is used

Definition at line 171 of file eigen_system.h.

References _use_shell_precond_matrix.

Referenced by libMesh::CondensedEigenSystem::add_matrices().

171 { return _use_shell_precond_matrix; }
bool _use_shell_precond_matrix
A boolean flag to indicate whether or not to use a shell preconditioning matrix.
Definition: eigen_system.h:419

◆ use_shell_precond_matrix() [2/2]

void libMesh::EigenSystem::use_shell_precond_matrix ( bool  use_shell_precond_matrix)
inline

Set a flag to use a shell preconditioning matrix.

Definition at line 176 of file eigen_system.h.

References _use_shell_precond_matrix, and use_shell_precond_matrix().

Referenced by use_shell_precond_matrix().

bool use_shell_precond_matrix() const
Definition: eigen_system.h:171
bool _use_shell_precond_matrix
A boolean flag to indicate whether or not to use a shell preconditioning matrix.
Definition: eigen_system.h:419

◆ user_assembly()

void libMesh::System::user_assembly ( )
virtualinherited

Calls user's attached assembly function, or is overridden by the user in derived classes.

Definition at line 2089 of file system.C.

References libMesh::System::_assemble_system_function, libMesh::System::_assemble_system_object, libMesh::System::_equation_systems, libMesh::System::Assembly::assemble(), and libMesh::System::name().

Referenced by libMesh::System::assemble().

2090 {
2091  // Call the user-provided assembly function,
2092  // if it was provided
2093  if (_assemble_system_function != nullptr)
2095 
2096  // ...or the user-provided assembly object.
2097  else if (_assemble_system_object != nullptr)
2099 }
Assembly * _assemble_system_object
Object that assembles the system.
Definition: system.h:2159
virtual void assemble()=0
Assembly function.
EquationSystems & _equation_systems
Constant reference to the EquationSystems object used for the simulation.
Definition: system.h:2208
const std::string & name() const
Definition: system.h:2343
void(* _assemble_system_function)(EquationSystems &es, const std::string &name)
Function that assembles the system.
Definition: system.h:2153

◆ user_constrain()

void libMesh::System::user_constrain ( )
virtualinherited

Calls user's attached constraint function, or is overridden by the user in derived classes.

Definition at line 2103 of file system.C.

References libMesh::System::_constrain_system_function, libMesh::System::_constrain_system_object, libMesh::System::_equation_systems, libMesh::System::Constraint::constrain(), and libMesh::System::name().

Referenced by libMesh::System::reinit_constraints().

2104 {
2105  // Call the user-provided constraint function,
2106  // if it was provided
2107  if (_constrain_system_function!= nullptr)
2109 
2110  // ...or the user-provided constraint object.
2111  else if (_constrain_system_object != nullptr)
2113 }
void(* _constrain_system_function)(EquationSystems &es, const std::string &name)
Function to impose constraints.
Definition: system.h:2164
Constraint * _constrain_system_object
Object that constrains the system.
Definition: system.h:2170
EquationSystems & _equation_systems
Constant reference to the EquationSystems object used for the simulation.
Definition: system.h:2208
virtual void constrain()=0
Constraint function.
const std::string & name() const
Definition: system.h:2343

◆ user_initialization()

void libMesh::System::user_initialization ( )
virtualinherited

Calls user's attached initialization function, or is overridden by the user in derived classes.

Definition at line 2075 of file system.C.

References libMesh::System::_equation_systems, libMesh::System::_init_system_function, libMesh::System::_init_system_object, libMesh::System::Initialization::initialize(), and libMesh::System::name().

Referenced by libMesh::NewmarkSystem::initial_conditions(), and libMesh::System::reinit_mesh().

2076 {
2077  // Call the user-provided initialization function,
2078  // if it was provided
2079  if (_init_system_function != nullptr)
2080  this->_init_system_function (_equation_systems, this->name());
2081 
2082  // ...or the user-provided initialization object.
2083  else if (_init_system_object != nullptr)
2085 }
virtual void initialize()=0
Initialization function.
Initialization * _init_system_object
Object that initializes the system.
Definition: system.h:2148
void(* _init_system_function)(EquationSystems &es, const std::string &name)
Function that initializes the system.
Definition: system.h:2142
EquationSystems & _equation_systems
Constant reference to the EquationSystems object used for the simulation.
Definition: system.h:2208
const std::string & name() const
Definition: system.h:2343

◆ user_QOI()

void libMesh::System::user_QOI ( const QoISet qoi_indices)
virtualinherited

Calls user's attached quantity of interest function, or is overridden by the user in derived classes.

Definition at line 2117 of file system.C.

References libMesh::System::_equation_systems, libMesh::System::_qoi_evaluate_function, libMesh::System::_qoi_evaluate_object, libMesh::System::name(), and libMesh::System::QOI::qoi().

Referenced by libMesh::System::assemble_qoi().

2118 {
2119  // Call the user-provided quantity of interest function,
2120  // if it was provided
2121  if (_qoi_evaluate_function != nullptr)
2122  this->_qoi_evaluate_function(_equation_systems, this->name(), qoi_indices);
2123 
2124  // ...or the user-provided QOI function object.
2125  else if (_qoi_evaluate_object != nullptr)
2126  this->_qoi_evaluate_object->qoi(qoi_indices);
2127 }
void(* _qoi_evaluate_function)(EquationSystems &es, const std::string &name, const QoISet &qoi_indices)
Function to evaluate quantity of interest.
Definition: system.h:2175
virtual void qoi(const QoISet &qoi_indices)=0
Quantity of interest function.
QOI * _qoi_evaluate_object
Object to compute quantities of interest.
Definition: system.h:2182
EquationSystems & _equation_systems
Constant reference to the EquationSystems object used for the simulation.
Definition: system.h:2208
const std::string & name() const
Definition: system.h:2343

◆ user_QOI_derivative()

void libMesh::System::user_QOI_derivative ( const QoISet qoi_indices = QoISet(),
bool  include_liftfunc = true,
bool  apply_constraints = true 
)
virtualinherited

Calls user's attached quantity of interest derivative function, or is overridden by the user in derived classes.

Definition at line 2131 of file system.C.

References libMesh::System::_equation_systems, libMesh::System::_qoi_evaluate_derivative_function, libMesh::System::_qoi_evaluate_derivative_object, libMesh::System::name(), and libMesh::System::QOIDerivative::qoi_derivative().

Referenced by libMesh::System::assemble_qoi_derivative().

2134 {
2135  // Call the user-provided quantity of interest derivative,
2136  // if it was provided
2137  if (_qoi_evaluate_derivative_function != nullptr)
2139  (_equation_systems, this->name(), qoi_indices, include_liftfunc,
2140  apply_constraints);
2141 
2142  // ...or the user-provided QOI derivative function object.
2143  else if (_qoi_evaluate_derivative_object != nullptr)
2145  (qoi_indices, include_liftfunc, apply_constraints);
2146 }
QOIDerivative * _qoi_evaluate_derivative_object
Object to compute derivatives of quantities of interest.
Definition: system.h:2196
virtual void qoi_derivative(const QoISet &qoi_indices, bool include_liftfunc, bool apply_constraints)=0
Quantity of interest derivative function.
EquationSystems & _equation_systems
Constant reference to the EquationSystems object used for the simulation.
Definition: system.h:2208
const std::string & name() const
Definition: system.h:2343
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.
Definition: system.h:2187

◆ variable()

const Variable & libMesh::System::variable ( unsigned int  var) const
inherited

Return a constant reference to Variable var.

Definition at line 2684 of file system.C.

References libMesh::System::get_dof_map(), and libMesh::DofMap::variable().

Referenced by libMesh::ExactSolution::_compute_error(), libMesh::PetscDMWrapper::add_dofs_to_section(), libMesh::DifferentiableSystem::add_second_order_dot_vars(), libMesh::EquationSystems::build_parallel_elemental_solution_vector(), libMesh::EquationSystems::build_parallel_solution_vector(), libMesh::FirstOrderUnsteadySolver::compute_second_order_eqns(), libMesh::GenericProjector< FFunctor, GFunctor, FValue, ProjectionAction >::SubFunctor::find_dofs_to_send(), libMesh::DifferentiableSystem::have_first_order_scalar_vars(), libMesh::DifferentiableSystem::have_second_order_scalar_vars(), main(), libMesh::DifferentiablePhysics::nonlocal_mass_residual(), libMesh::GenericProjector< FFunctor, GFunctor, FValue, ProjectionAction >::SortAndCopy::operator()(), libMesh::GenericProjector< FFunctor, GFunctor, FValue, ProjectionAction >::ProjectVertices::operator()(), libMesh::GenericProjector< FFunctor, GFunctor, FValue, ProjectionAction >::ProjectEdges::operator()(), libMesh::GenericProjector< FFunctor, GFunctor, FValue, ProjectionAction >::ProjectSides::operator()(), libMesh::GenericProjector< FFunctor, GFunctor, FValue, ProjectionAction >::ProjectInteriors::operator()(), libMesh::System::point_gradient(), libMesh::System::point_hessian(), libMesh::System::point_value(), libMesh::System::read_parallel_data(), libMesh::System::read_SCALAR_dofs(), libMesh::System::read_serialized_vector(), libMesh::System::read_serialized_vectors(), libMesh::PetscDMWrapper::set_point_range_in_section(), libMesh::System::write_header(), libMesh::Nemesis_IO_Helper::write_nodal_solution(), libMesh::System::write_parallel_data(), libMesh::System::write_serialized_vector(), and libMesh::System::write_serialized_vectors().

2685 {
2686  return this->get_dof_map().variable(i);
2687 }
const Variable & variable(const unsigned int c) const override
Definition: dof_map.h:2356
const DofMap & get_dof_map() const
Definition: system.h:2375

◆ variable_group()

const VariableGroup & libMesh::System::variable_group ( unsigned int  vg) const
inherited

Return a constant reference to VariableGroup vg.

Definition at line 2689 of file system.C.

References libMesh::System::get_dof_map(), and libMesh::DofMap::variable_group().

Referenced by libMesh::FEMSystem::assembly(), and libMesh::System::get_info().

2690 {
2691  return this->get_dof_map().variable_group(vg);
2692 }
const VariableGroup & variable_group(const unsigned int c) const
Definition: dof_map.h:2346
const DofMap & get_dof_map() const
Definition: system.h:2375

◆ variable_name()

const std::string & libMesh::System::variable_name ( const unsigned int  i) const
inherited

◆ variable_number()

unsigned int libMesh::System::variable_number ( std::string_view  var) const
inherited
Returns
The variable number associated with the user-specified variable named var.

Definition at line 1394 of file system.C.

References libMesh::System::get_dof_map(), and libMesh::DofMap::variable_number().

Referenced by libMesh::ExactSolution::_compute_error(), alternative_fe_assembly(), LinearElasticity::assemble(), AssembleOptimization::assemble_A_and_F(), assemble_divgrad(), assemble_elasticity(), assemble_graddiv(), assemble_matrix_and_rhs(), assemble_shell(), assemble_stokes(), compute_enriched_soln(), compute_stresses(), LinearElasticityWithContact::compute_stresses(), LinearElasticity::compute_stresses(), LargeDeformationElasticity::compute_stresses(), libMesh::ExodusII_IO::copy_elemental_solution(), libMesh::Nemesis_IO::copy_elemental_solution(), libMesh::GMVIO::copy_nodal_solution(), libMesh::ExodusII_IO::copy_nodal_solution(), libMesh::Nemesis_IO::copy_nodal_solution(), libMesh::ExactErrorEstimator::estimate_error(), fe_assembly(), libMesh::ExactErrorEstimator::find_squared_element_error(), CoupledSystemQoI::init_context(), libMesh::HDGProblem::jacobian(), LargeDeformationElasticity::jacobian(), line_print(), main(), LinearElasticityWithContact::move_mesh(), libMesh::System::read_header(), libMesh::HDGProblem::residual(), LargeDeformationElasticity::residual(), LinearElasticityWithContact::residual_and_jacobian(), OverlappingAlgebraicGhostingTest::run_ghosting_test(), OverlappingCouplingGhostingTest::run_sparsity_pattern_test(), OverlappingTestBase::setup_coupling_matrix(), libMesh::DTKAdapter::update_variable_values(), libMesh::System::variable_scalar_number(), libMesh::EnsightIO::write_scalar_ascii(), and libMesh::EnsightIO::write_vector_ascii().

1395 {
1396  return this->get_dof_map().variable_number(var);
1397 }
unsigned int variable_number(std::string_view var) const
Definition: dof_map.h:2980
const DofMap & get_dof_map() const
Definition: system.h:2375

◆ variable_scalar_number() [1/2]

unsigned int libMesh::System::variable_scalar_number ( std::string_view  var,
unsigned int  component 
) const
inlineinherited
Returns
An index, starting from 0 for the first component of the first variable, and incrementing for each component of each (potentially vector-valued) variable in the system in order. For systems with only scalar-valued variables, this will be the same as variable_number(var)

Irony: currently our only non-scalar-valued variable type is SCALAR.

Definition at line 2432 of file system.h.

References libMesh::System::variable_number().

Referenced by libMesh::ExodusII_IO::copy_scalar_solution(), libMesh::Nemesis_IO::copy_scalar_solution(), libMesh::ExactErrorEstimator::find_squared_element_error(), libMesh::GenericProjector< FFunctor, GFunctor, FValue, ProjectionAction >::ProjectVertices::operator()(), libMesh::GenericProjector< FFunctor, GFunctor, FValue, ProjectionAction >::ProjectEdges::operator()(), libMesh::GenericProjector< FFunctor, GFunctor, FValue, ProjectionAction >::ProjectSides::operator()(), and libMesh::GenericProjector< FFunctor, GFunctor, FValue, ProjectionAction >::ProjectInteriors::operator()().

2434 {
2435  return variable_scalar_number(this->variable_number(var), component);
2436 }
unsigned int variable_scalar_number(std::string_view var, unsigned int component) const
Definition: system.h:2432
unsigned int variable_number(std::string_view var) const
Definition: system.C:1394

◆ variable_scalar_number() [2/2]

unsigned int libMesh::System::variable_scalar_number ( unsigned int  var_num,
unsigned int  component 
) const
inherited
Returns
An index, starting from 0 for the first component of the first variable, and incrementing for each component of each (potentially vector-valued) variable in the system in order. For systems with only scalar-valued variables, this will be the same as var_num

Irony: currently our only non-scalar-valued variable type is SCALAR.

Definition at line 2695 of file system.C.

References libMesh::System::get_dof_map(), and libMesh::DofMap::variable_scalar_number().

2697 {
2698  return this->get_dof_map().variable_scalar_number(var_num, component);
2699 }
unsigned int variable_scalar_number(unsigned int var_num, unsigned int component) const
Definition: dof_map.h:2963
const DofMap & get_dof_map() const
Definition: system.h:2375

◆ variable_type() [1/2]

const FEType & libMesh::System::variable_type ( const unsigned int  i) const
inherited
Returns
The finite element type variable number i.

Definition at line 2701 of file system.C.

References libMesh::System::get_dof_map(), and libMesh::DofMap::variable_type().

Referenced by libMesh::ExactSolution::_compute_error(), alternative_fe_assembly(), assemble(), libMesh::ClawSystem::assemble_advection_matrices(), libMesh::ClawSystem::assemble_avg_coupling_matrices(), libMesh::ClawSystem::assemble_boundary_condition_matrices(), assemble_ellipticdg(), libMesh::ClawSystem::assemble_jump_coupling_matrix(), libMesh::ClawSystem::assemble_mass_matrix(), assemble_shell(), assemble_stokes(), libMesh::FEMContext::attach_quadrature_rules(), libMesh::EquationSystems::build_parallel_elemental_solution_vector(), libMesh::EquationSystems::build_parallel_solution_vector(), libMesh::ExodusII_IO::copy_elemental_solution(), libMesh::Nemesis_IO::copy_elemental_solution(), libMesh::GMVIO::copy_nodal_solution(), libMesh::DGFEMContext::DGFEMContext(), fe_assembly(), libMesh::FEMContext::find_hardest_fe_type(), libMesh::EquationSystems::find_variable_numbers(), form_functionA(), form_functionB(), form_matrixA(), libMesh::FEMSystem::init_context(), libMesh::FEMContext::init_internal_data(), RationalMapTest< elem_type >::setUp(), FETestBase< order, family, elem_type, 1 >::setUp(), EquationSystemsTest::testBadVarNames(), libMesh::Nemesis_IO_Helper::write_element_values(), libMesh::System::write_header(), libMesh::Nemesis_IO_Helper::write_nodal_solution(), libMesh::EnsightIO::write_scalar_ascii(), and libMesh::EnsightIO::write_vector_ascii().

2702 {
2703  return this->get_dof_map().variable_type(i);
2704 }
const FEType & variable_type(const unsigned int i) const
Definition: dof_map.h:2386
const DofMap & get_dof_map() const
Definition: system.h:2375

◆ variable_type() [2/2]

const FEType & libMesh::System::variable_type ( std::string_view  var) const
inherited
Returns
The finite element type for variable var.

Definition at line 2706 of file system.C.

References libMesh::System::get_dof_map(), and libMesh::DofMap::variable_type().

2707 {
2708  return this->get_dof_map().variable_type(var);
2709 }
const FEType & variable_type(const unsigned int i) const
Definition: dof_map.h:2386
const DofMap & get_dof_map() const
Definition: system.h:2375

◆ vector_is_adjoint()

int libMesh::System::vector_is_adjoint ( std::string_view  vec_name) const
inherited
Returns
The integer describing whether the vector identified by vec_name represents a solution from an adjoint (non-negative) or the primal (-1) space.

Definition at line 1158 of file system.C.

References libMesh::System::_vector_is_adjoint, and libMesh::libmesh_assert().

Referenced by libMesh::InterMeshProjection::project_system_vectors(), and libMesh::System::restrict_vectors().

1159 {
1160  const auto it = _vector_is_adjoint.find(vec_name);
1161  libmesh_assert(it != _vector_is_adjoint.end());
1162  return it->second;
1163 }
std::map< std::string, int, std::less<> > _vector_is_adjoint
Holds non-negative if a vector by that name should be projected using adjoint constraints/BCs, -1 if primal.
Definition: system.h:2249
libmesh_assert(ctx)

◆ vector_name() [1/2]

const std::string & libMesh::System::vector_name ( const unsigned int  vec_num) const
inherited
Returns
The name of this system's additional vector number vec_num (where the vectors are counted starting with 0).

Definition at line 968 of file system.C.

References libMesh::System::_vectors, and libMesh::System::vectors_begin().

Referenced by libMesh::AdjointRefinementEstimator::estimate_error(), and main().

969 {
970  // If we don't have that many vectors, throw an error
971  libmesh_assert_less(vec_num, _vectors.size());
972 
973  // Otherwise return a reference to the vec_num'th vector name
974  auto it = vectors_begin();
975  std::advance(it, vec_num);
976  return it->first;
977 }
std::map< std::string, std::unique_ptr< NumericVector< Number > >, std::less<> > _vectors
Some systems need an arbitrary number of vectors.
Definition: system.h:2237
vectors_iterator vectors_begin()
Beginning of vectors container.
Definition: system.h:2463

◆ vector_name() [2/2]

const std::string & libMesh::System::vector_name ( const NumericVector< Number > &  vec_reference) const
inherited
Returns
The name of a system vector, given a reference to that vector

Definition at line 979 of file system.C.

References libMesh::System::_vectors, libMesh::NumericVector< T >::get(), libMesh::libmesh_assert(), libMesh::System::vectors_begin(), and libMesh::System::vectors_end().

980 {
981  // Linear search for a vector whose pointer matches vec_reference
982  auto it = std::find_if(vectors_begin(), vectors_end(),
983  [&vec_reference](const decltype(_vectors)::value_type & pr)
984  { return &vec_reference == pr.second.get(); });
985 
986  // Before returning, make sure we didn't loop till the end and not find any match
987  libmesh_assert (it != vectors_end());
988 
989  // Return the string associated with the current vector
990  return it->first;
991 }
vectors_iterator vectors_end()
End of vectors container.
Definition: system.h:2475
virtual void get(const std::vector< numeric_index_type > &index, T *values) const
Access multiple components at once.
std::map< std::string, std::unique_ptr< NumericVector< Number > >, std::less<> > _vectors
Some systems need an arbitrary number of vectors.
Definition: system.h:2237
vectors_iterator vectors_begin()
Beginning of vectors container.
Definition: system.h:2463
libmesh_assert(ctx)

◆ vector_preservation()

bool libMesh::System::vector_preservation ( std::string_view  vec_name) const
inherited
Returns
The boolean describing whether the vector identified by vec_name should be "preserved": projected to new meshes, saved, etc.

Definition at line 1133 of file system.C.

References libMesh::System::_vector_projections.

Referenced by libMesh::AdjointRefinementEstimator::estimate_error(), libMesh::MemoryHistoryData::store_vectors(), SystemsTest::testAddVectorProjChange(), SystemsTest::testAddVectorTypeChange(), and SystemsTest::testPostInitAddVectorTypeChange().

1134 {
1135  if (auto it = _vector_projections.find(vec_name);
1136  it != _vector_projections.end())
1137  return it->second;
1138 
1139  // vec_name was not in the map, return false
1140  return false;
1141 }
std::map< std::string, bool, std::less<> > _vector_projections
Holds true if a vector by that name should be projected onto a changed grid, false if it should be ze...
Definition: system.h:2243

◆ vectors_begin() [1/2]

System::vectors_iterator libMesh::System::vectors_begin ( )
inlineinherited

Beginning of vectors container.

Definition at line 2463 of file system.h.

References libMesh::System::_vectors.

Referenced by libMesh::UniformRefinementEstimator::_estimate_error(), libMesh::AdjointRefinementEstimator::estimate_error(), libMesh::System::get_vector(), libMesh::InterMeshProjection::project_system_vectors(), libMesh::System::request_vector(), libMesh::MemoryHistoryData::store_vectors(), and libMesh::System::vector_name().

2464 {
2465  return _vectors.begin();
2466 }
std::map< std::string, std::unique_ptr< NumericVector< Number > >, std::less<> > _vectors
Some systems need an arbitrary number of vectors.
Definition: system.h:2237

◆ vectors_begin() [2/2]

System::const_vectors_iterator libMesh::System::vectors_begin ( ) const
inlineinherited

Beginning of vectors container.

Definition at line 2469 of file system.h.

References libMesh::System::_vectors.

2470 {
2471  return _vectors.begin();
2472 }
std::map< std::string, std::unique_ptr< NumericVector< Number > >, std::less<> > _vectors
Some systems need an arbitrary number of vectors.
Definition: system.h:2237

◆ vectors_end() [1/2]

System::vectors_iterator libMesh::System::vectors_end ( )
inlineinherited

End of vectors container.

Definition at line 2475 of file system.h.

References libMesh::System::_vectors.

Referenced by libMesh::UniformRefinementEstimator::_estimate_error(), libMesh::AdjointRefinementEstimator::estimate_error(), libMesh::InterMeshProjection::project_system_vectors(), libMesh::MemoryHistoryData::store_vectors(), and libMesh::System::vector_name().

2476 {
2477  return _vectors.end();
2478 }
std::map< std::string, std::unique_ptr< NumericVector< Number > >, std::less<> > _vectors
Some systems need an arbitrary number of vectors.
Definition: system.h:2237

◆ vectors_end() [2/2]

System::const_vectors_iterator libMesh::System::vectors_end ( ) const
inlineinherited

End of vectors container.

Definition at line 2481 of file system.h.

References libMesh::System::_vectors.

2482 {
2483  return _vectors.end();
2484 }
std::map< std::string, std::unique_ptr< NumericVector< Number > >, std::less<> > _vectors
Some systems need an arbitrary number of vectors.
Definition: system.h:2237

◆ weighted_sensitivity_adjoint_solve()

std::pair< unsigned int, Real > libMesh::System::weighted_sensitivity_adjoint_solve ( const ParameterVector parameters,
const ParameterVector weights,
const QoISet qoi_indices = QoISet() 
)
inlinevirtualinherited

Assembles & solves the linear system(s) (dR/du)^T*z_w = sum(w_p*(d^2q/dudp - d^2R/dudp*z)), for those parameters p contained within parameters, weighted by the values w_p found within weights.

Assumes that adjoint_solve has already calculated z for each qoi in qoi_indices.

Returns
A pair with the total number of linear iterations performed and the (sum of the) final residual norms

This method is only implemented in some derived classes.

Reimplemented in libMesh::ImplicitSystem.

Definition at line 2553 of file system.h.

2556 {
2557  libmesh_not_implemented();
2558 }

◆ weighted_sensitivity_solve()

std::pair< unsigned int, Real > libMesh::System::weighted_sensitivity_solve ( const ParameterVector parameters,
const ParameterVector weights 
)
inlinevirtualinherited

Assembles & solves the linear system(s) (dR/du)*u_w = sum(w_p*-dR/dp), for those parameters p contained within parameters weighted by the values w_p found within weights.

Returns
A pair with the total number of linear iterations performed and the (sum of the) final residual norms

This method is only implemented in some derived classes.

Reimplemented in libMesh::ImplicitSystem.

Definition at line 2538 of file system.h.

2540 {
2541  libmesh_not_implemented();
2542 }

◆ write_header()

void libMesh::System::write_header ( Xdr io,
std::string_view  version,
const bool  write_additional_data 
) const
inherited

Writes the basic data header for this System.

This method implements the output of a System object, embedded in the output of an EquationSystems<T_sys>. This warrants some documentation. The output of this part consists of 5 sections:

for this system

5.) The number of variables in the system (unsigned int)

for each variable in the system

6.) The name of the variable (string)

6.1.) subdomain where the variable lives

7.) Combined in an FEType:

  • The approximation order(s) of the variable (Order Enum, cast to int/s)
  • The finite element family/ies of the variable (FEFamily Enum, cast to int/s)

end variable loop

8.) The number of additional vectors (unsigned int),

for each additional vector in the system object

9.) the name of the additional vector (string)

end system

Definition at line 1267 of file system_io.C.

References libMesh::System::_vector_projections, libMesh::System::_vectors, libMesh::Variable::active_subdomains(), libMesh::Xdr::data(), libMesh::FEType::family, libMesh::System::get_mesh(), libMesh::FEType::inf_map, libMesh::libmesh_assert(), libMesh::make_range(), libMesh::System::n_vars(), libMesh::System::n_vectors(), libMesh::System::name(), libMesh::FEType::order, libMesh::ParallelObject::processor_id(), libMesh::FEType::radial_family, libMesh::FEType::radial_order, libMesh::System::variable(), libMesh::System::variable_name(), libMesh::System::variable_type(), and libMesh::Xdr::writing().

Referenced by libMesh::RBEvaluation::write_out_vectors().

1270 {
1304  libmesh_assert (io.writing());
1305 
1306 
1307  // Only write the header information
1308  // if we are processor 0.
1309  if (this->get_mesh().processor_id() != 0)
1310  return;
1311 
1312  std::string comment;
1313 
1314  // 5.)
1315  // Write the number of variables in the system
1316 
1317  {
1318  // set up the comment
1319  comment = "# No. of Variables in System \"";
1320  comment += this->name();
1321  comment += "\"";
1322 
1323  unsigned int nv = this->n_vars();
1324  io.data (nv, comment);
1325  }
1326 
1327 
1328  for (auto var : make_range(this->n_vars()))
1329  {
1330  // 6.)
1331  // Write the name of the var-th variable
1332  {
1333  // set up the comment
1334  comment = "# Name, Variable No. ";
1335  comment += std::to_string(var);
1336  comment += ", System \"";
1337  comment += this->name();
1338  comment += "\"";
1339 
1340  std::string var_name = this->variable_name(var);
1341  io.data (var_name, comment);
1342  }
1343 
1344  // 6.1.) Variable subdomains
1345  {
1346  // set up the comment
1347  comment = "# Subdomains, Variable \"";
1348  comment += this->variable_name(var);
1349  comment += "\", System \"";
1350  comment += this->name();
1351  comment += "\"";
1352 
1353  const std::set<subdomain_id_type> & domains = this->variable(var).active_subdomains();
1354  std::vector<subdomain_id_type> domain_array;
1355  domain_array.assign(domains.begin(), domains.end());
1356  io.data (domain_array, comment);
1357  }
1358 
1359  // 7.)
1360  // Write the approximation order of the var-th variable
1361  // in this system
1362  {
1363  // set up the comment
1364  comment = "# Approximation Order, Variable \"";
1365  comment += this->variable_name(var);
1366  comment += "\", System \"";
1367  comment += this->name();
1368  comment += "\"";
1369 
1370  int order = static_cast<int>(this->variable_type(var).order);
1371  io.data (order, comment);
1372  }
1373 
1374 
1375 #ifdef LIBMESH_ENABLE_INFINITE_ELEMENTS
1376 
1377  // do the same for radial_order
1378  {
1379  comment = "# Radial Approximation Order, Variable \"";
1380  comment += this->variable_name(var);
1381  comment += "\", System \"";
1382  comment += this->name();
1383  comment += "\"";
1384 
1385  int rad_order = static_cast<int>(this->variable_type(var).radial_order);
1386  io.data (rad_order, comment);
1387  }
1388 
1389 #endif
1390 
1391  // Write the Finite Element type of the var-th variable
1392  // in this System
1393  {
1394  // set up the comment
1395  comment = "# FE Family, Variable \"";
1396  comment += this->variable_name(var);
1397  comment += "\", System \"";
1398  comment += this->name();
1399  comment += "\"";
1400 
1401  const FEType & type = this->variable_type(var);
1402  int fam = static_cast<int>(type.family);
1403  io.data (fam, comment);
1404 
1405 #ifdef LIBMESH_ENABLE_INFINITE_ELEMENTS
1406 
1407  comment = "# Radial FE Family, Variable \"";
1408  comment += this->variable_name(var);
1409  comment += "\", System \"";
1410  comment += this->name();
1411  comment += "\"";
1412 
1413  int radial_fam = static_cast<int>(type.radial_family);
1414  io.data (radial_fam, comment);
1415 
1416  comment = "# Infinite Mapping Type, Variable \"";
1417  comment += this->variable_name(var);
1418  comment += "\", System \"";
1419  comment += this->name();
1420  comment += "\"";
1421 
1422  int i_map = static_cast<int>(type.inf_map);
1423  io.data (i_map, comment);
1424 #endif
1425  }
1426  } // end of the variable loop
1427 
1428  // 8.)
1429  // Write the number of additional vectors in the System.
1430  // If write_additional_data==false, then write zero for
1431  // the number of additional vectors.
1432  {
1433  {
1434  // set up the comment
1435  comment = "# No. of Additional Vectors, System \"";
1436  comment += this->name();
1437  comment += "\"";
1438 
1439  unsigned int nvecs = write_additional_data ? this->n_vectors () : 0;
1440  io.data (nvecs, comment);
1441  }
1442 
1443  if (write_additional_data)
1444  {
1445  unsigned int cnt=0;
1446  for (const auto & [vec_name, vec] : _vectors)
1447  {
1448  // 9.)
1449  // write the name of the cnt-th additional vector
1450  const std::string dth_vector = std::to_string(cnt++)+"th vector";
1451  comment = "# Name of " + dth_vector;
1452  std::string nonconst_vec_name = vec_name; // Stupid XDR API
1453 
1454  io.data (nonconst_vec_name, comment);
1455  int vec_projection = _vector_projections.at(vec_name);
1456  comment = "# Whether to do projections for " + dth_vector;
1457  io.data (vec_projection, comment);
1458  int vec_type = vec->type();
1459  comment = "# Parallel type of " + dth_vector;
1460  io.data (vec_type, comment);
1461  }
1462  }
1463  }
1464 }
const Variable & variable(unsigned int var) const
Return a constant reference to Variable var.
Definition: system.C:2684
OrderWrapper radial_order
The approximation order in radial direction of the infinite element.
Definition: fe_type.h:254
std::map< std::string, std::unique_ptr< NumericVector< Number > >, std::less<> > _vectors
Some systems need an arbitrary number of vectors.
Definition: system.h:2237
OrderWrapper order
The approximation order of the element.
Definition: fe_type.h:215
const MeshBase & get_mesh() const
Definition: system.h:2359
const std::set< subdomain_id_type > & active_subdomains() const
Definition: variable.h:181
unsigned int n_vectors() const
Definition: system.h:2457
libmesh_assert(ctx)
const std::string & variable_name(const unsigned int i) const
Definition: system.C:2659
const FEType & variable_type(const unsigned int i) const
Definition: system.C:2701
IntRange< T > make_range(T beg, T end)
The 2-parameter make_range() helper function returns an IntRange<T> when both input parameters are of...
Definition: int_range.h:140
const std::string & name() const
Definition: system.h:2343
unsigned int n_vars() const
Definition: system.C:2654
processor_id_type processor_id() const
std::map< std::string, bool, std::less<> > _vector_projections
Holds true if a vector by that name should be projected onto a changed grid, false if it should be ze...
Definition: system.h:2243

◆ write_parallel_data()

void libMesh::System::write_parallel_data ( Xdr io,
const bool  write_additional_data 
) const
inherited

Writes additional data, namely vectors, for this System.

This method may safely be called on a distributed-memory mesh. This method will create an individual file for each processor in the simulation where the local solution components for that processor will be stored.

This method implements the output of the vectors contained in this System object, embedded in the output of an EquationSystems<T_sys>.

9.) The global solution vector, re-ordered to be node-major (More on this later.)

for each additional vector in the object

10.) The global additional vector, re-ordered to be node-major (More on this later.)

Note that the actual IO is handled through the Xdr class (to be renamed later?) which provides a uniform interface to both the XDR (eXternal Data Representation) interface and standard ASCII output. Thus this one section of code will read XDR or ASCII files with no changes.

Definition at line 1468 of file system_io.C.

References libMesh::System::_vectors, libMesh::Xdr::data(), libMesh::FEType::family, libMesh::System::get_dof_map(), libMesh::System::get_mesh(), libMesh::DofObject::invalid_id, libMesh::libmesh_assert(), libMesh::make_range(), libMesh::ParallelObject::n_processors(), libMesh::System::n_vars(), libMesh::System::name(), libMesh::System::number(), libMesh::ParallelObject::processor_id(), libMesh::SCALAR, libMesh::DofMap::SCALAR_dof_indices(), libMesh::System::solution, libMesh::Variable::type(), libMesh::System::variable(), and libMesh::Xdr::writing().

1470 {
1490  // PerfLog pl("IO Performance",false);
1491  // pl.push("write_parallel_data");
1492  // std::size_t total_written_size = 0;
1493 
1494  std::string comment;
1495 
1496  libmesh_assert (io.writing());
1497 
1498  std::vector<Number> io_buffer; io_buffer.reserve(this->solution->local_size());
1499 
1500  // build the ordered nodes and element maps.
1501  // when writing/reading parallel files we need to iterate
1502  // over our nodes/elements in order of increasing global id().
1503  // however, this is not guaranteed to be ordering we obtain
1504  // by using the node_iterators/element_iterators directly.
1505  // so build a set, sorted by id(), that provides the ordering.
1506  // further, for memory economy build the set but then transfer
1507  // its contents to vectors, which will be sorted.
1508  std::vector<const DofObject *> ordered_nodes, ordered_elements;
1509  {
1510  std::set<const DofObject *, CompareDofObjectsByID>
1511  ordered_nodes_set (this->get_mesh().local_nodes_begin(),
1512  this->get_mesh().local_nodes_end());
1513 
1514  ordered_nodes.insert(ordered_nodes.end(),
1515  ordered_nodes_set.begin(),
1516  ordered_nodes_set.end());
1517  }
1518  {
1519  std::set<const DofObject *, CompareDofObjectsByID>
1520  ordered_elements_set (this->get_mesh().local_elements_begin(),
1521  this->get_mesh().local_elements_end());
1522 
1523  ordered_elements.insert(ordered_elements.end(),
1524  ordered_elements_set.begin(),
1525  ordered_elements_set.end());
1526  }
1527 
1528  const unsigned int sys_num = this->number();
1529  const unsigned int nv = this->n_vars();
1530 
1531  // Loop over each non-SCALAR variable and each node, and write out the value.
1532  for (unsigned int var=0; var<nv; var++)
1533  if (this->variable(var).type().family != SCALAR)
1534  {
1535  // First write the node DOF values
1536  for (const auto & node : ordered_nodes)
1537  for (auto comp : make_range(node->n_comp(sys_num,var)))
1538  {
1539  libmesh_assert_not_equal_to (node->dof_number(sys_num, var, comp),
1541 
1542  io_buffer.push_back((*this->solution)(node->dof_number(sys_num, var, comp)));
1543  }
1544 
1545  // Then write the element DOF values
1546  for (const auto & elem : ordered_elements)
1547  for (auto comp : make_range(elem->n_comp(sys_num,var)))
1548  {
1549  libmesh_assert_not_equal_to (elem->dof_number(sys_num, var, comp),
1551 
1552  io_buffer.push_back((*this->solution)(elem->dof_number(sys_num, var, comp)));
1553  }
1554  }
1555 
1556  // Finally, write the SCALAR data on the last processor
1557  for (auto var : make_range(this->n_vars()))
1558  if (this->variable(var).type().family == SCALAR)
1559  {
1560  if (this->processor_id() == (this->n_processors()-1))
1561  {
1562  const DofMap & dof_map = this->get_dof_map();
1563  std::vector<dof_id_type> SCALAR_dofs;
1564  dof_map.SCALAR_dof_indices(SCALAR_dofs, var);
1565 
1566  for (auto dof : SCALAR_dofs)
1567  io_buffer.push_back((*this->solution)(dof));
1568  }
1569  }
1570 
1571  // 9.)
1572  //
1573  // Actually write the reordered solution vector
1574  // for the ith system to disk
1575 
1576  // set up the comment
1577  {
1578  comment = "# System \"";
1579  comment += this->name();
1580  comment += "\" Solution Vector";
1581  }
1582 
1583  io.data (io_buffer, comment);
1584 
1585  // total_written_size += io_buffer.size();
1586 
1587  // Only write additional vectors if wanted
1588  if (write_additional_data)
1589  {
1590  for (auto & [vec_name, vec] : _vectors)
1591  {
1592  io_buffer.clear();
1593  io_buffer.reserve(vec->local_size());
1594 
1595  // Loop over each non-SCALAR variable and each node, and write out the value.
1596  for (unsigned int var=0; var<nv; var++)
1597  if (this->variable(var).type().family != SCALAR)
1598  {
1599  // First write the node DOF values
1600  for (const auto & node : ordered_nodes)
1601  for (auto comp : make_range(node->n_comp(sys_num,var)))
1602  {
1603  libmesh_assert_not_equal_to (node->dof_number(sys_num, var, comp),
1605 
1606  io_buffer.push_back((*vec)(node->dof_number(sys_num, var, comp)));
1607  }
1608 
1609  // Then write the element DOF values
1610  for (const auto & elem : ordered_elements)
1611  for (auto comp : make_range(elem->n_comp(sys_num,var)))
1612  {
1613  libmesh_assert_not_equal_to (elem->dof_number(sys_num, var, comp),
1615 
1616  io_buffer.push_back((*vec)(elem->dof_number(sys_num, var, comp)));
1617  }
1618  }
1619 
1620  // Finally, write the SCALAR data on the last processor
1621  for (auto var : make_range(this->n_vars()))
1622  if (this->variable(var).type().family == SCALAR)
1623  {
1624  if (this->processor_id() == (this->n_processors()-1))
1625  {
1626  const DofMap & dof_map = this->get_dof_map();
1627  std::vector<dof_id_type> SCALAR_dofs;
1628  dof_map.SCALAR_dof_indices(SCALAR_dofs, var);
1629 
1630  for (auto dof : SCALAR_dofs)
1631  io_buffer.push_back((*vec)(dof));
1632  }
1633  }
1634 
1635  // 10.)
1636  //
1637  // Actually write the reordered additional vector
1638  // for this system to disk
1639 
1640  // set up the comment
1641  {
1642  comment = "# System \"";
1643  comment += this->name();
1644  comment += "\" Additional Vector \"";
1645  comment += vec_name;
1646  comment += "\"";
1647  }
1648 
1649  io.data (io_buffer, comment);
1650 
1651  // total_written_size += io_buffer.size();
1652  }
1653  }
1654 
1655  // const Real
1656  // dt = pl.get_elapsed_time(),
1657  // rate = total_written_size*sizeof(Number)/dt;
1658 
1659  // libMesh::err << "Write " << total_written_size << " \"Number\" values\n"
1660  // << " Elapsed time = " << dt << '\n'
1661  // << " Rate = " << rate/1.e6 << "(MB/sec)\n\n";
1662 
1663  // pl.pop("write_parallel_data");
1664 }
FEFamily family
The type of finite element.
Definition: fe_type.h:221
const Variable & variable(unsigned int var) const
Return a constant reference to Variable var.
Definition: system.C:2684
std::map< std::string, std::unique_ptr< NumericVector< Number > >, std::less<> > _vectors
Some systems need an arbitrary number of vectors.
Definition: system.h:2237
const MeshBase & get_mesh() const
Definition: system.h:2359
processor_id_type n_processors() const
unsigned int number() const
Definition: system.h:2351
static constexpr dof_id_type invalid_id
An invalid id to distinguish an uninitialized DofObject.
Definition: dof_object.h:482
std::unique_ptr< NumericVector< Number > > solution
Data structure to hold solution values.
Definition: system.h:1616
libmesh_assert(ctx)
IntRange< T > make_range(T beg, T end)
The 2-parameter make_range() helper function returns an IntRange<T> when both input parameters are of...
Definition: int_range.h:140
const std::string & name() const
Definition: system.h:2343
unsigned int n_vars() const
Definition: system.C:2654
processor_id_type processor_id() const
const DofMap & get_dof_map() const
Definition: system.h:2375
const FEType & type() const
Definition: variable.h:144

◆ write_serialized_data()

void libMesh::System::write_serialized_data ( Xdr io,
const bool  write_additional_data = true 
) const
inherited

Writes additional data, namely vectors, for this System.

This method may safely be called on a distributed-memory mesh.

This method implements the output of the vectors contained in this System object, embedded in the output of an EquationSystems<T_sys>.

9.) The global solution vector, re-ordered to be node-major (More on this later.)

for each additional vector in the object

10.) The global additional vector, re-ordered to be node-major (More on this later.)

Definition at line 1668 of file system_io.C.

References libMesh::System::_vectors, libMesh::Xdr::comment(), libMesh::System::name(), libMesh::ParallelObject::processor_id(), libMesh::System::solution, and libMesh::System::write_serialized_vector().

Referenced by libMesh::TransientRBConstruction::write_riesz_representors_to_files(), and libMesh::RBConstruction::write_riesz_representors_to_files().

1670 {
1684  parallel_object_only();
1685  std::string comment;
1686 
1687  // PerfLog pl("IO Performance",false);
1688  // pl.push("write_serialized_data");
1689  // std::size_t total_written_size = 0;
1690 
1691  // total_written_size +=
1692  this->write_serialized_vector(io, *this->solution);
1693 
1694  // set up the comment
1695  if (this->processor_id() == 0)
1696  {
1697  comment = "# System \"";
1698  comment += this->name();
1699  comment += "\" Solution Vector";
1700 
1701  io.comment (comment);
1702  }
1703 
1704  // Only write additional vectors if wanted
1705  if (write_additional_data)
1706  {
1707  for (auto & pair : this->_vectors)
1708  {
1709  // total_written_size +=
1710  this->write_serialized_vector(io, *pair.second);
1711 
1712  // set up the comment
1713  if (this->processor_id() == 0)
1714  {
1715  comment = "# System \"";
1716  comment += this->name();
1717  comment += "\" Additional Vector \"";
1718  comment += pair.first;
1719  comment += "\"";
1720  io.comment (comment);
1721  }
1722  }
1723  }
1724 
1725  // const Real
1726  // dt = pl.get_elapsed_time(),
1727  // rate = total_written_size*sizeof(Number)/dt;
1728 
1729  // libMesh::out << "Write " << total_written_size << " \"Number\" values\n"
1730  // << " Elapsed time = " << dt << '\n'
1731  // << " Rate = " << rate/1.e6 << "(MB/sec)\n\n";
1732 
1733  // pl.pop("write_serialized_data");
1734 
1735 
1736 
1737 
1738  // // test the new method
1739  // {
1740  // std::vector<std::string> names;
1741  // std::vector<NumericVector<Number> *> vectors_to_write;
1742 
1743  // names.push_back("Solution Vector");
1744  // vectors_to_write.push_back(this->solution.get());
1745 
1746  // // Only write additional vectors if wanted
1747  // if (write_additional_data)
1748  // {
1749  // std::map<std::string, NumericVector<Number> *>::const_iterator
1750  // pos = _vectors.begin();
1751 
1752  // for (; pos != this->_vectors.end(); ++pos)
1753  // {
1754  // names.push_back("Additional Vector " + pos->first);
1755  // vectors_to_write.push_back(pos->second);
1756  // }
1757  // }
1758 
1759  // total_written_size =
1760  // this->write_serialized_vectors (io, names, vectors_to_write);
1761 
1762  // const Real
1763  // dt2 = pl.get_elapsed_time(),
1764  // rate2 = total_written_size*sizeof(Number)/(dt2-dt);
1765 
1766  // libMesh::out << "Write (new) " << total_written_size << " \"Number\" values\n"
1767  // << " Elapsed time = " << (dt2-dt) << '\n'
1768  // << " Rate = " << rate2/1.e6 << "(MB/sec)\n\n";
1769 
1770  // }
1771 }
std::map< std::string, std::unique_ptr< NumericVector< Number > >, std::less<> > _vectors
Some systems need an arbitrary number of vectors.
Definition: system.h:2237
std::unique_ptr< NumericVector< Number > > solution
Data structure to hold solution values.
Definition: system.h:1616
const std::string & name() const
Definition: system.h:2343
processor_id_type processor_id() const
dof_id_type write_serialized_vector(Xdr &io, const NumericVector< Number > &vec) const
Writes a vector for this System.
Definition: system_io.C:2118

◆ write_serialized_vectors()

std::size_t libMesh::System::write_serialized_vectors ( Xdr io,
const std::vector< const NumericVector< Number > *> &  vectors 
) const
inherited

Serialize & write a number of identically distributed vectors.

This method allows for optimization for the multiple vector case by only communicating the metadata once.

Definition at line 2261 of file system_io.C.

References libMesh::Xdr::data(), libMesh::System::get_mesh(), libMesh::libmesh_assert(), libMesh::make_range(), libMesh::MeshTools::n_elem(), libMesh::MeshBase::n_elem(), n_nodes, libMesh::MeshBase::n_nodes(), libMesh::System::n_vars(), libMesh::ParallelObject::processor_id(), libMesh::SCALAR, libMesh::System::variable(), libMesh::System::write_SCALAR_dofs(), libMesh::System::write_serialized_blocked_dof_objects(), and libMesh::Xdr::writing().

Referenced by libMesh::RBEvaluation::write_out_vectors().

2263 {
2264  parallel_object_only();
2265 
2266  libmesh_assert (io.writing());
2267 
2268  // Cache these - they are not free!
2269  const dof_id_type
2270  n_nodes = this->get_mesh().n_nodes(),
2271  n_elem = this->get_mesh().n_elem();
2272 
2273  std::size_t written_length = 0;
2274 
2275  if (this->processor_id() == 0)
2276  {
2277  unsigned int
2278  n_vec = cast_int<unsigned int>(vectors.size());
2279  dof_id_type
2280  vec_size = vectors.empty() ? 0 : vectors[0]->size();
2281  // Set the number of vectors
2282  io.data(n_vec, "# number of vectors");
2283  // Set the buffer size
2284  io.data(vec_size, "# vector length");
2285  }
2286 
2287  //---------------------------------
2288  // Collect the values for all nodes
2289  written_length +=
2290  this->write_serialized_blocked_dof_objects (vectors,
2291  n_nodes,
2292  this->get_mesh().local_nodes_begin(),
2293  this->get_mesh().local_nodes_end(),
2294  io);
2295 
2296  //------------------------------------
2297  // Collect the values for all elements
2298  written_length +=
2299  this->write_serialized_blocked_dof_objects (vectors,
2300  n_elem,
2301  this->get_mesh().local_elements_begin(),
2302  this->get_mesh().local_elements_end(),
2303  io);
2304 
2305  //-------------------------------------------
2306  // Finally loop over all the SCALAR variables
2307  for (const NumericVector<Number> * vec : vectors)
2308  for (auto var : make_range(this->n_vars()))
2309  if (this->variable(var).type().family == SCALAR)
2310  {
2311  libmesh_assert_not_equal_to (vec, 0);
2312 
2313  written_length +=
2314  this->write_SCALAR_dofs (*vec, var, io);
2315  }
2316 
2317  return written_length;
2318 }
const Variable & variable(unsigned int var) const
Return a constant reference to Variable var.
Definition: system.C:2684
dof_id_type n_elem(const MeshBase::const_element_iterator &begin, const MeshBase::const_element_iterator &end)
Count up the number of elements of a specific type (as defined by an iterator range).
Definition: mesh_tools.C:976
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.
Definition: system_io.C:2062
const MeshBase & get_mesh() const
Definition: system.h:2359
const dof_id_type n_nodes
Definition: tecplot_io.C:67
libmesh_assert(ctx)
IntRange< T > make_range(T beg, T end)
The 2-parameter make_range() helper function returns an IntRange<T> when both input parameters are of...
Definition: int_range.h:140
unsigned int n_vars() const
Definition: system.C:2654
virtual dof_id_type n_elem() const =0
processor_id_type processor_id() const
template class LIBMESH_EXPORT NumericVector< Number >
virtual dof_id_type n_nodes() const =0
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.
Definition: system_io.C:1776
uint8_t dof_id_type
Definition: id_types.h:67

◆ zero_variable()

void libMesh::System::zero_variable ( NumericVector< Number > &  v,
unsigned int  var_num 
) const
inherited

Zeroes all dofs in v that correspond to variable number var_num.

Definition at line 1446 of file system.C.

References libMesh::System::get_mesh(), mesh, libMesh::System::n_vars(), libMesh::System::number(), and libMesh::NumericVector< T >::set().

1448 {
1449  /* Make sure the call makes sense. */
1450  libmesh_assert_less (var_num, this->n_vars());
1451 
1452  /* Get a reference to the mesh. */
1453  const MeshBase & mesh = this->get_mesh();
1454 
1455  /* Check which system we are. */
1456  const unsigned int sys_num = this->number();
1457 
1458  // Loop over nodes.
1459  for (const auto & node : mesh.local_node_ptr_range())
1460  {
1461  unsigned int n_comp = node->n_comp(sys_num,var_num);
1462  for (unsigned int i=0; i<n_comp; i++)
1463  {
1464  const dof_id_type index = node->dof_number(sys_num,var_num,i);
1465  v.set(index,0.0);
1466  }
1467  }
1468 
1469  // Loop over elements.
1470  for (const auto & elem : mesh.active_local_element_ptr_range())
1471  {
1472  unsigned int n_comp = elem->n_comp(sys_num,var_num);
1473  for (unsigned int i=0; i<n_comp; i++)
1474  {
1475  const dof_id_type index = elem->dof_number(sys_num,var_num,i);
1476  v.set(index,0.0);
1477  }
1478  }
1479 }
MeshBase & mesh
const MeshBase & get_mesh() const
Definition: system.h:2359
unsigned int number() const
Definition: system.h:2351
virtual void set(const numeric_index_type i, const T value)=0
Sets v(i) = value.
unsigned int n_vars() const
Definition: system.C:2654
uint8_t dof_id_type
Definition: id_types.h:67

Member Data Documentation

◆ _communicator

const Parallel::Communicator& libMesh::ParallelObject::_communicator
protectedinherited

◆ _counts

ReferenceCounter::Counts libMesh::ReferenceCounter::_counts
staticprotectedinherited

Actually holds the data.

Definition at line 124 of file reference_counter.h.

Referenced by libMesh::ReferenceCounter::get_info().

◆ _eigen_problem_type

EigenProblemType libMesh::EigenSystem::_eigen_problem_type
private

The type of the eigenvalue problem.

Definition at line 409 of file eigen_system.h.

Referenced by generalized(), get_eigenproblem_type(), and set_eigenproblem_type().

◆ _enable_print_counter

bool libMesh::ReferenceCounter::_enable_print_counter = true
staticprotectedinherited

Flag to control whether reference count information is printed when print_info is called.

Definition at line 143 of file reference_counter.h.

Referenced by libMesh::ReferenceCounter::disable_print_counter_info(), libMesh::ReferenceCounter::enable_print_counter_info(), and libMesh::ReferenceCounter::print_info().

◆ _mutex

Threads::spin_mutex libMesh::ReferenceCounter::_mutex
staticprotectedinherited

Mutual exclusion object to enable thread-safe reference counting.

Definition at line 137 of file reference_counter.h.

◆ _n_converged_eigenpairs

unsigned int libMesh::EigenSystem::_n_converged_eigenpairs
private

The number of converged eigenpairs.

Definition at line 399 of file eigen_system.h.

Referenced by get_n_converged(), set_n_converged(), and solve_helper().

◆ _n_iterations

unsigned int libMesh::EigenSystem::_n_iterations
private

The number of iterations of the eigen solver algorithm.

Definition at line 404 of file eigen_system.h.

Referenced by get_n_iterations(), set_n_iterations(), and solve_helper().

◆ _n_objects

Threads::atomic< unsigned int > libMesh::ReferenceCounter::_n_objects
staticprotectedinherited

The number of objects.

Print the reference count information when the number returns to 0.

Definition at line 132 of file reference_counter.h.

Referenced by libMesh::ReferenceCounter::n_objects(), libMesh::ReferenceCounter::ReferenceCounter(), and libMesh::ReferenceCounter::~ReferenceCounter().

◆ _use_shell_matrices

bool libMesh::EigenSystem::_use_shell_matrices
private

A boolean flag to indicate whether or not to use shell matrices.

Definition at line 414 of file eigen_system.h.

Referenced by add_matrices(), get_matrix_A(), get_matrix_B(), get_precond_matrix(), get_shell_matrix_A(), get_shell_matrix_B(), get_shell_precond_matrix(), solve_helper(), and use_shell_matrices().

◆ _use_shell_precond_matrix

bool libMesh::EigenSystem::_use_shell_precond_matrix
private

A boolean flag to indicate whether or not to use a shell preconditioning matrix.

Definition at line 419 of file eigen_system.h.

Referenced by add_matrices(), get_precond_matrix(), get_shell_precond_matrix(), solve_helper(), and use_shell_precond_matrix().

◆ assemble_before_solve

bool libMesh::System::assemble_before_solve
inherited

Flag which tells the system to whether or not to call the user assembly function during each call to solve().

By default, every call to solve() begins with a call to the user assemble, so this flag is true. (For explicit systems, "solving" the system occurs during the assembly step, so this flag is always true for explicit systems.)

You will only want to set this to false if you need direct control over when the system is assembled, and are willing to track the state of its assembly yourself. An example of such a case is an implicit system with multiple right hand sides. In this instance, a single assembly would likely be followed with multiple calls to solve.

The frequency system and Newmark system have their own versions of this flag, called _finished_assemble, which might be able to be replaced with this more general concept.

Definition at line 1570 of file system.h.

Referenced by libMesh::ImplicitSystem::adjoint_solve(), libMesh::ClawSystem::ClawSystem(), libMesh::ImplicitSystem::disable_cache(), libMesh::System::disable_cache(), main(), libMesh::RBConstruction::RBConstruction(), libMesh::RBSCMConstruction::RBSCMConstruction(), libMesh::ImplicitSystem::sensitivity_solve(), solve(), libMesh::CondensedEigenSystem::solve(), and libMesh::LinearImplicitSystem::solve().

◆ current_local_solution

std::unique_ptr<NumericVector<Number> > libMesh::System::current_local_solution
inherited

All the values I need to compute my contribution to the simulation at hand.

Think of this as the current solution with any ghost values needed from other processors. This vector is necessarily larger than the solution vector in the case of a parallel simulation. The update() member is used to synchronize the contents of the solution and current_local_solution vectors.

Definition at line 1628 of file system.h.

Referenced by libMesh::__libmesh_petsc_diff_solver_jacobian(), libMesh::__libmesh_petsc_diff_solver_residual(), libMesh::UniformRefinementEstimator::_estimate_error(), alternative_fe_assembly(), libMesh::VariationalSmootherSystem::assembly(), libMesh::NonlinearImplicitSystem::assembly(), libMesh::EquationSystems::build_parallel_elemental_solution_vector(), libMesh::EquationSystems::build_parallel_solution_vector(), libMesh::System::clear(), libMesh::Problem_Interface::computeF(), libMesh::Problem_Interface::computeJacobian(), libMesh::Problem_Interface::computePreconditioner(), libMesh::System::current_solution(), DMlibMeshFunction(), DMlibMeshJacobian(), libMesh::AdjointRefinementEstimator::estimate_error(), libMesh::ExactErrorEstimator::estimate_error(), fe_assembly(), libMesh::StaticCondensation::init(), libMesh::System::init_data(), libMesh::libmesh_petsc_snes_fd_residual(), libMesh::libmesh_petsc_snes_jacobian(), libMesh::libmesh_petsc_snes_mffd_residual(), libMesh::libmesh_petsc_snes_residual(), libMesh::libmesh_petsc_snes_residual_helper(), libMesh::System::point_gradient(), libMesh::System::point_hessian(), libMesh::System::point_value(), libMesh::FEMContext::pre_fe_reinit(), libMesh::System::re_update(), libMesh::System::reinit(), libMesh::System::restrict_vectors(), OverlappingAlgebraicGhostingTest::run_ghosting_test(), OverlappingCouplingGhostingTest::run_sparsity_pattern_test(), SolidSystem::save_initial_mesh(), libMesh::RBConstruction::set_context_solution_vec(), setup(), MeshFunctionTest::test_subdomain_id_sets(), MeshInputTest::testCopyElementVectorImpl(), libMesh::BoundaryVolumeSolutionTransfer::transfer_boundary_volume(), libMesh::TransientRBConstruction::truth_assembly(), libMesh::TransientRBConstruction::truth_solve(), libMesh::System::update(), libMesh::Nemesis_IO_Helper::write_element_values(), and libMesh::Nemesis_IO_Helper::write_nodal_solution().

◆ eigen_solver

std::unique_ptr<EigenSolver<Number> > libMesh::EigenSystem::eigen_solver

The EigenSolver, defining which interface, i.e solver package to use.

Public access to this member variable will be deprecated in the future! Use get_eigen_solver instead.

Definition at line 362 of file eigen_system.h.

Referenced by clear(), libMesh::RBSCMConstruction::compute_SCM_bounding_box(), libMesh::RBSCMConstruction::evaluate_stability_constant(), get_eigen_solver(), get_eigenpair(), libMesh::CondensedEigenSystem::get_eigenpair(), get_eigenvalue(), set_eigenproblem_type(), set_initial_space(), and solve_helper().

◆ extra_quadrature_order

int libMesh::System::extra_quadrature_order
inherited

A member int that can be employed to indicate increased or reduced quadrature order.

Note
For FEMSystem users, by default, when calling the user-defined residual functions, the FEMSystem will first set up an appropriate FEType::default_quadrature_rule() object for performing the integration. This rule will integrate elements of order up to 2*p+1 exactly (where p is the sum of the base FEType and local p refinement levels), but if additional (or reduced) quadrature accuracy is desired then this extra_quadrature_order (default 0) will be added.

Definition at line 1601 of file system.h.

Referenced by CurlCurlSystem::init_data(), and set_system_parameters().

◆ matrix_A

SparseMatrix<Number>* libMesh::EigenSystem::matrix_A

The system matrix for standard eigenvalue problems.

Public access to this member variable will be deprecated in the future! Use get_matrix_A() instead.

Definition at line 313 of file eigen_system.h.

Referenced by add_matrices(), libMesh::RBSCMConstruction::Aq_inner_product(), clear(), libMesh::RBSCMConstruction::compute_SCM_bounding_box(), libMesh::RBSCMConstruction::evaluate_stability_constant(), get_matrix_A(), has_matrix_A(), solve(), and libMesh::CondensedEigenSystem::solve().

◆ matrix_B

SparseMatrix<Number>* libMesh::EigenSystem::matrix_B

A second system matrix for generalized eigenvalue problems.

Public access to this member variable will be deprecated in the future! Use get_matrix_B() instead.

Definition at line 321 of file eigen_system.h.

Referenced by add_matrices(), libMesh::RBSCMConstruction::B_inner_product(), clear(), get_matrix_B(), has_matrix_B(), libMesh::RBSCMConstruction::load_matrix_B(), solve(), libMesh::CondensedEigenSystem::solve(), and solve_helper().

◆ parameters

Parameters libMesh::System::parameters
inherited

◆ precond_matrix

SparseMatrix<Number>* libMesh::EigenSystem::precond_matrix

A preconditioning matrix.

Public access to this member variable will be deprecated in the future! Use get_precond_matrix() instead.

Definition at line 345 of file eigen_system.h.

Referenced by add_matrices(), clear(), get_precond_matrix(), has_precond_matrix(), solve(), and libMesh::CondensedEigenSystem::solve().

◆ shell_matrix_A

std::unique_ptr<ShellMatrix<Number> > libMesh::EigenSystem::shell_matrix_A

The system shell matrix for standard eigenvalue problems.

Public access to this member variable will be deprecated in the future! Use get_shell_matrix_A() instead.

Definition at line 329 of file eigen_system.h.

Referenced by add_matrices(), clear(), get_shell_matrix_A(), has_shell_matrix_A(), init_matrices(), reinit(), and solve_helper().

◆ shell_matrix_B

std::unique_ptr<ShellMatrix<Number> > libMesh::EigenSystem::shell_matrix_B

A second system shell matrix for generalized eigenvalue problems.

Public access to this member variable will be deprecated in the future! Use get_shell_matrix_B() instead.

Definition at line 337 of file eigen_system.h.

Referenced by add_matrices(), clear(), get_shell_matrix_B(), has_shell_matrix_B(), init_matrices(), reinit(), and solve_helper().

◆ shell_precond_matrix

std::unique_ptr<ShellMatrix<Number> > libMesh::EigenSystem::shell_precond_matrix

A preconditioning shell matrix.

Public access to this member variable will be deprecated in the future! Use get_shell_precond_matrix() instead.

Definition at line 353 of file eigen_system.h.

Referenced by add_matrices(), clear(), get_shell_precond_matrix(), has_shell_precond_matrix(), init_matrices(), reinit(), and solve_helper().

◆ solution

std::unique_ptr<NumericVector<Number> > libMesh::System::solution
inherited

Data structure to hold solution values.

Definition at line 1616 of file system.h.

Referenced by libMesh::__libmesh_petsc_diff_solver_jacobian(), libMesh::__libmesh_petsc_diff_solver_residual(), libMesh::ExactSolution::_compute_error(), libMesh::UniformRefinementEstimator::_estimate_error(), libMesh::TransientRBConstruction::add_IC_to_RB_space(), libMesh::NewmarkSolver::advance_timestep(), libMesh::AdaptiveTimeSolver::advance_timestep(), libMesh::UnsteadySolver::advance_timestep(), libMesh::ContinuationSystem::apply_predictor(), libMesh::TransientRBConstruction::assemble_affine_expansion(), libMesh::FEMSystem::assembly(), libMesh::VariationalSmootherSystem::assembly(), libMesh::LinearImplicitSystem::assembly(), libMesh::EquationSystems::build_parallel_elemental_solution_vector(), libMesh::EquationSystems::build_parallel_solution_vector(), libMesh::RBConstruction::check_if_zero_truth_solve(), libMesh::System::clear(), libMesh::System::compare(), compute_enriched_soln(), libMesh::RBConstruction::compute_Fq_representor_innerprods(), libMesh::NewmarkSolver::compute_initial_accel(), libMesh::RBConstruction::compute_output_dual_innerprods(), libMesh::RBConstruction::compute_residual_dual_norm_slow(), compute_stresses(), LinearElasticityWithContact::compute_stresses(), LinearElasticity::compute_stresses(), LargeDeformationElasticity::compute_stresses(), libMesh::Problem_Interface::computeF(), libMesh::Problem_Interface::computeJacobian(), libMesh::Problem_Interface::computePreconditioner(), libMesh::ContinuationSystem::continuation_solve(), libMesh::ExodusII_IO::copy_elemental_solution(), libMesh::Nemesis_IO::copy_elemental_solution(), libMesh::GMVIO::copy_nodal_solution(), libMesh::ExodusII_IO::copy_nodal_solution(), libMesh::Nemesis_IO::copy_nodal_solution(), libMesh::ExodusII_IO::copy_scalar_solution(), libMesh::Nemesis_IO::copy_scalar_solution(), create_wrapped_function(), DMCreateGlobalVector_libMesh(), DMlibMeshFunction(), DMlibMeshJacobian(), libMesh::UnsteadySolver::du(), libMesh::RBConstruction::enrich_RB_space(), libMesh::PatchRecoveryErrorEstimator::estimate_error(), libMesh::WeightedPatchRecoveryErrorEstimator::estimate_error(), libMesh::JumpErrorEstimator::estimate_error(), libMesh::AdjointRefinementEstimator::estimate_error(), libMesh::AdjointResidualErrorEstimator::estimate_error(), libMesh::ExactErrorEstimator::estimate_error(), libMesh::SmoothnessEstimator::estimate_smoothness(), libMesh::RBSCMConstruction::evaluate_stability_constant(), get_eigenpair(), libMesh::CondensedEigenSystem::get_eigenpair(), LinearElasticityWithContact::get_least_and_max_gap_function(), libMesh::VariationalSmootherSystem::init_data(), libMesh::System::init_data(), libMesh::ContinuationSystem::initialize_tangent(), libMesh::TransientRBConstruction::initialize_truth(), libMesh::libmesh_petsc_snes_fd_residual(), libMesh::libmesh_petsc_snes_jacobian(), libMesh::libmesh_petsc_snes_mffd_residual(), libMesh::libmesh_petsc_snes_residual(), libMesh::libmesh_petsc_snes_residual_helper(), libMesh::RBConstruction::load_basis_function(), libMesh::TransientRBConstruction::load_rb_solution(), libMesh::RBConstruction::load_rb_solution(), main(), libMesh::DofMap::max_constraint_error(), libMesh::FEMSystem::mesh_position_get(), libMesh::ErrorVector::plot_error(), libMesh::RBConstruction::print_basis_function_orthogonality(), libMesh::InterMeshProjection::project_system_vectors(), libMesh::ImplicitSystem::qoi_parameter_hessian(), libMesh::ImplicitSystem::qoi_parameter_hessian_vector_product(), libMesh::System::re_update(), libMesh::System::read_legacy_data(), libMesh::System::read_parallel_data(), libMesh::TransientRBConstruction::read_riesz_representors_from_files(), libMesh::RBConstruction::read_riesz_representors_from_files(), libMesh::System::read_serialized_data(), MeshFunctionTest::read_variable_info_from_output_data(), libMesh::System::reinit(), libMesh::System::restrict_vectors(), libMesh::MemoryHistoryData::retrieve_vectors(), OverlappingAlgebraicGhostingTest::run_ghosting_test(), OverlappingCouplingGhostingTest::run_sparsity_pattern_test(), libMesh::ContinuationSystem::save_current_solution(), libMesh::TransientRBConstruction::set_error_temporal_data(), setup(), WriteVecAndScalar::setupTests(), libMesh::TwostepTimeSolver::solve(), libMesh::NewtonSolver::solve(), libMesh::PetscDiffSolver::solve(), libMesh::FrequencySystem::solve(), libMesh::LinearImplicitSystem::solve(), libMesh::NonlinearImplicitSystem::solve(), libMesh::ClawSystem::solve_conservation_law(), libMesh::RBConstruction::solve_for_matrix_and_rhs(), libMesh::ContinuationSystem::solve_tangent(), libMesh::MemoryHistoryData::store_vectors(), ConstraintOperatorTest::test1DCoarseningOperator(), MeshfunctionDFEM::test_mesh_function_dfem(), MeshfunctionDFEM::test_mesh_function_dfem_grad(), MeshFunctionTest::test_p_level(), SystemsTest::testBoundaryProjectCube(), ConstraintOperatorTest::testCoreform(), SystemsTest::testDofCouplingWithVarGroups(), MeshInputTest::testExodusWriteElementDataFromDiscontinuousNodalData(), SystemsTest::testPostInitAddVector(), SystemsTest::testProjectCubeWithMeshFunction(), MeshInputTest::testProjectionRegression(), WriteVecAndScalar::testSolution(), libMesh::RBConstruction::train_reduced_basis_with_POD(), libMesh::MeshFunctionSolutionTransfer::transfer(), libMesh::DirectSolutionTransfer::transfer(), libMesh::MeshfreeSolutionTransfer::transfer(), libMesh::BoundaryVolumeSolutionTransfer::transfer_boundary_volume(), libMesh::BoundaryVolumeSolutionTransfer::transfer_volume_boundary(), libMesh::TransientRBConstruction::truth_solve(), libMesh::RBConstruction::truth_solve(), libMesh::System::update(), update_current_local_solution(), libMesh::System::update_global_solution(), libMesh::TransientRBConstruction::update_RB_initial_condition_all_N(), libMesh::TransientRBConstruction::update_residual_terms(), libMesh::RBConstruction::update_residual_terms(), libMesh::ContinuationSystem::update_solution(), libMesh::NewmarkSystem::update_u_v_a(), libMesh::DTKAdapter::update_variable_values(), libMesh::System::write_parallel_data(), libMesh::TransientRBConstruction::write_riesz_representors_to_files(), libMesh::RBConstruction::write_riesz_representors_to_files(), and libMesh::System::write_serialized_data().

◆ time

Real libMesh::System::time
inherited

For time-dependent problems, this is the time t at the beginning of the current timestep.

Note
For DifferentiableSystem users: do not access this time during an assembly! Use the DiffContext::time value instead to get correct results.

Definition at line 1638 of file system.h.

Referenced by libMesh::AdaptiveTimeSolver::adjoint_advance_timestep(), libMesh::UnsteadySolver::adjoint_advance_timestep(), libMesh::TwostepTimeSolver::adjoint_solve(), libMesh::AdaptiveTimeSolver::advance_timestep(), libMesh::UnsteadySolver::advance_timestep(), libMesh::GenericProjector< FFunctor, GFunctor, FValue, ProjectionAction >::SubProjector::construct_projection(), HeatSystem::element_qoi(), fill_dirichlet_bc(), libMesh::ExactErrorEstimator::find_squared_element_error(), initialize(), libMesh::Euler2Solver::integrate_adjoint_refinement_error_estimate(), libMesh::EulerSolver::integrate_adjoint_refinement_error_estimate(), libMesh::UnsteadySolver::integrate_adjoint_sensitivity(), libMesh::Euler2Solver::integrate_qoi_timestep(), libMesh::EulerSolver::integrate_qoi_timestep(), main(), libMesh::WeightedPatchRecoveryErrorEstimator::EstimateError::operator()(), libMesh::GenericProjector< FFunctor, GFunctor, FValue, ProjectionAction >::ProjectVertices::operator()(), libMesh::GenericProjector< FFunctor, GFunctor, FValue, ProjectionAction >::ProjectEdges::operator()(), libMesh::GenericProjector< FFunctor, GFunctor, FValue, ProjectionAction >::ProjectSides::operator()(), libMesh::GenericProjector< FFunctor, GFunctor, FValue, ProjectionAction >::ProjectInteriors::operator()(), libMesh::System::reinit_constraints(), libMesh::UnsteadySolver::retrieve_timestep(), and libMesh::TwostepTimeSolver::solve().

◆ use_fixed_solution

bool libMesh::System::use_fixed_solution
inherited

A boolean to be set to true by systems using elem_fixed_solution, for optional use by e.g.

stabilized methods. False by default.

Note
For FEMSystem users, if this variable is set to true, it must be before init_data() is called.

Definition at line 1586 of file system.h.

Referenced by libMesh::EulerSolver::_general_residual(), libMesh::Euler2Solver::_general_residual(), libMesh::SteadySolver::_general_residual(), libMesh::NewmarkSolver::_general_residual(), libMesh::DifferentiableSystem::clear(), libMesh::DiffContext::DiffContext(), and libMesh::FEMContext::pre_fe_reinit().


The documentation for this class was generated from the following files: