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

The ExplicitSystem provides only "right hand side" storage, which should be sufficient for solving most types of explicit problems. More...

#include <explicit_system.h>

Inheritance diagram for libMesh::ExplicitSystem:
[legend]

Public Types

typedef ExplicitSystem sys_type
 The type of system. More...
 
typedef System Parent
 The type of the parent. More...
 
typedef std::map< std::string, NumericVector< Number > * >::iterator vectors_iterator
 Vector iterator typedefs. More...
 
typedef std::map< std::string, NumericVector< Number > * >::const_iterator const_vectors_iterator
 

Public Member Functions

 ExplicitSystem (EquationSystems &es, const std::string &name, const unsigned int number)
 Constructor. More...
 
sys_typesystem ()
 
virtual void clear () libmesh_override
 Clear all the data structures associated with the system. More...
 
virtual void reinit () libmesh_override
 Reinitializes the member data fields associated with the system, so that, e.g., assemble() may be used. More...
 
virtual void assemble_qoi (const QoISet &qoi_indices=QoISet()) libmesh_override
 Prepares qoi for quantity of interest assembly, then calls user qoi function. More...
 
virtual void assemble_qoi_derivative (const QoISet &qoi_indices=QoISet(), bool include_liftfunc=true, bool apply_constraints=true) libmesh_override
 Prepares adjoint_rhs for quantity of interest derivative assembly, then calls user qoi derivative function. More...
 
virtual void solve () libmesh_override
 Assembles & solves the linear system Ax=b. More...
 
virtual std::string system_type () const libmesh_override
 
void init ()
 Initializes degrees of freedom on the current mesh. More...
 
virtual void reinit_constraints ()
 Reinitializes the constraints for this system. More...
 
bool is_initialized ()
 
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_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 NULL. 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=libmesh_nullptr) const
 Projects arbitrary functions onto the current solution. More...
 
void project_solution (FEMFunctionBase< Number > *f, FEMFunctionBase< Gradient > *g=libmesh_nullptr) const
 Projects arbitrary functions onto the current solution. More...
 
void project_solution (Number fptr(const Point &p, const Parameters &parameters, const std::string &sys_name, const std::string &unknown_name), Gradient gptr(const Point &p, const Parameters &parameters, const std::string &sys_name, const std::string &unknown_name), const Parameters &parameters) const
 Projects arbitrary functions onto the current solution. More...
 
void project_vector (NumericVector< Number > &new_vector, FunctionBase< Number > *f, FunctionBase< Gradient > *g=libmesh_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=libmesh_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 (Number fptr(const Point &p, const Parameters &parameters, const std::string &sys_name, const std::string &unknown_name), Gradient gptr(const Point &p, const Parameters &parameters, const std::string &sys_name, const std::string &unknown_name), 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=libmesh_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, Number fptr(const Point &p, const Parameters &parameters, const std::string &sys_name, const std::string &unknown_name), Gradient gptr(const Point &p, const Parameters &parameters, const std::string &sys_name, const std::string &unknown_name), 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=libmesh_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, Number fptr(const Point &p, const Parameters &parameters, const std::string &sys_name, const std::string &unknown_name), Gradient gptr(const Point &p, const Parameters &parameters, const std::string &sys_name, const std::string &unknown_name), 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...
 
NumericVector< Number > & add_vector (const std::string &vec_name, const bool projections=true, const ParallelType type=PARALLEL)
 Adds the additional vector vec_name to this system. More...
 
void remove_vector (const std::string &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 (const std::string &vec_name) const
 
const NumericVector< Number > * request_vector (const std::string &vec_name) const
 
NumericVector< Number > * request_vector (const std::string &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 (const std::string &vec_name) const
 
NumericVector< Number > & get_vector (const std::string &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 (const std::string &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 (const std::string &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
 
virtual 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 (const std::string &var, const FEType &type, const std::set< subdomain_id_type > *const active_subdomains=libmesh_nullptr)
 Adds the variable var to the list of variables for this system. More...
 
unsigned int add_variable (const std::string &var, const Order order=FIRST, const FEFamily=LAGRANGE, const std::set< subdomain_id_type > *const active_subdomains=libmesh_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=libmesh_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 Order order=FIRST, const FEFamily=LAGRANGE, const std::set< subdomain_id_type > *const active_subdomains=libmesh_nullptr)
 Adds the variable var 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 (const std::string &var) const
 
const std::string & variable_name (const unsigned int i) const
 
unsigned short int variable_number (const std::string &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 (const std::string &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 (const std::string &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=libmesh_nullptr) const
 
Real calculate_norm (const NumericVector< Number > &v, const SystemNorm &norm, std::set< unsigned int > *skip_dimensions=libmesh_nullptr) const
 
void read_header (Xdr &io, const std::string &version, const bool read_header=true, const bool read_additional_data=true, const bool read_legacy_format=false)
 Reads the basic data header for this System. 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, const std::string &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...
 
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
 
Number point_value (unsigned int var, const Point &p, const bool insist_on_success=true) const
 
Number point_value (unsigned int var, const Point &p, const Elem &e) 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...
 
Gradient point_gradient (unsigned int var, const Point &p, const bool insist_on_success=true) const
 
Gradient point_gradient (unsigned int var, const Point &p, const Elem &e) 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...
 
Tensor point_hessian (unsigned int var, const Point &p, const bool insist_on_success=true) const
 
Tensor point_hessian (unsigned int var, const Point &p, const Elem &e) 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...
 
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 & hide_output ()
 
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=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

NumericVector< Number > * rhs
 The system matrix. 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...
 
UniquePtr< NumericVector< Number > > solution
 Data structure to hold solution values. More...
 
UniquePtr< 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...
 
std::vector< Numberqoi
 Values of the quantities of interest. 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

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...
 
void increment_constructor_count (const std::string &name)
 Increments the construction counter. More...
 
void increment_destructor_count (const std::string &name)
 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 Member Functions

void add_system_rhs ()
 Add the system right-hand-side vector to the _vectors data structure. More...
 

Detailed Description

The ExplicitSystem provides only "right hand side" storage, which should be sufficient for solving most types of explicit problems.

Note
Additional vectors/matrices can be added via parent class interfaces.
Author
Benjamin S. Kirk
Date
2004 Used for solving explicit systems of equations.

Definition at line 40 of file explicit_system.h.

Member Typedef Documentation

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

Definition at line 749 of file system.h.

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.

The type of the parent.

Definition at line 60 of file explicit_system.h.

The type of system.

Definition at line 55 of file explicit_system.h.

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

Vector iterator typedefs.

Definition at line 748 of file system.h.

Constructor & Destructor Documentation

libMesh::ExplicitSystem::ExplicitSystem ( EquationSystems es,
const std::string &  name,
const unsigned int  number 
)

Constructor.

Optionally initializes required data structures.

Definition at line 32 of file explicit_system.C.

References add_system_rhs().

34  :
35  Parent (es, name_in, number_in),
37 
38 {
39  // Add the system RHS.
40  this->add_system_rhs ();
41 }
System Parent
The type of the parent.
const class libmesh_nullptr_t libmesh_nullptr
NumericVector< Number > * rhs
The system matrix.
void add_system_rhs()
Add the system right-hand-side vector to the _vectors data structure.

Member Function Documentation

void libMesh::System::activate ( )
inherited

Activates the system.

Only active systems are solved.

Definition at line 2054 of file system.h.

References libMesh::System::_active.

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

2055 {
2056  _active = true;
2057 }
bool _active
Flag stating if the system is active or not.
Definition: system.h:1908
bool libMesh::System::active ( ) const
inherited
Returns
true if the system is active, false otherwise. An active system will be solved.

Definition at line 2046 of file system.h.

References libMesh::System::_active.

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

2047 {
2048  return _active;
2049 }
bool _active
Flag stating if the system is active or not.
Definition: system.h:1908
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 1041 of file system.C.

References libMesh::System::add_vector().

Referenced by assemble_qoi_derivative(), libMesh::FEMSystem::assemble_qoi_derivative(), and libMesh::System::project_solution_on_reinit().

1042 {
1043  std::ostringstream adjoint_rhs_name;
1044  adjoint_rhs_name << "adjoint_rhs" << i;
1045 
1046  return this->add_vector(adjoint_rhs_name.str(), false);
1047 }
NumericVector< Number > & add_vector(const std::string &vec_name, const bool projections=true, const ParallelType type=PARALLEL)
Adds the additional vector vec_name to this system.
Definition: system.C:681
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 977 of file system.C.

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

Referenced by libMesh::ImplicitSystem::adjoint_solve(), and libMesh::System::project_solution_on_reinit().

978 {
979  std::ostringstream adjoint_name;
980  adjoint_name << "adjoint_solution" << i;
981 
982  NumericVector<Number> & returnval = this->add_vector(adjoint_name.str());
983  this->set_vector_as_adjoint(adjoint_name.str(), i);
984  return returnval;
985 }
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:905
NumericVector< Number > & add_vector(const std::string &vec_name, const bool projections=true, const ParallelType type=PARALLEL)
Adds the additional vector vec_name to this system.
Definition: system.C:681
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 1071 of file system.C.

References libMesh::System::add_vector().

Referenced by libMesh::ImplicitSystem::assemble_residual_derivatives(), and libMesh::System::project_solution_on_reinit().

1072 {
1073  std::ostringstream sensitivity_rhs_name;
1074  sensitivity_rhs_name << "sensitivity_rhs" << i;
1075 
1076  return this->add_vector(sensitivity_rhs_name.str(), false);
1077 }
NumericVector< Number > & add_vector(const std::string &vec_name, const bool projections=true, const ParallelType type=PARALLEL)
Adds the additional vector vec_name to this system.
Definition: system.C:681
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 926 of file system.C.

References libMesh::System::add_vector().

Referenced by libMesh::System::project_solution_on_reinit(), and libMesh::ImplicitSystem::sensitivity_solve().

927 {
928  std::ostringstream sensitivity_name;
929  sensitivity_name << "sensitivity_solution" << i;
930 
931  return this->add_vector(sensitivity_name.str());
932 }
NumericVector< Number > & add_vector(const std::string &vec_name, const bool projections=true, const ParallelType type=PARALLEL)
Adds the additional vector vec_name to this system.
Definition: system.C:681
void libMesh::ExplicitSystem::add_system_rhs ( )
private

Add the system right-hand-side vector to the _vectors data structure.

Useful in initialization.

Definition at line 108 of file explicit_system.C.

References libMesh::System::add_vector(), libMesh::libmesh_assert(), libmesh_nullptr, libMesh::System::n_vectors(), and rhs.

Referenced by clear(), and ExplicitSystem().

109 {
110  // Possible that we cleared the _vectors but
111  // forgot to NULL-out the rhs?
112  if (this->n_vectors() == 0)
114 
115 
116  // Only need to add the rhs if it isn't there
117  // already!
118  if (rhs == libmesh_nullptr)
119  rhs = &(this->add_vector ("RHS Vector", false));
120 
122 }
const class libmesh_nullptr_t libmesh_nullptr
NumericVector< Number > * rhs
The system matrix.
libmesh_assert(j)
NumericVector< Number > & add_vector(const std::string &vec_name, const bool projections=true, const ParallelType type=PARALLEL)
Adds the additional vector vec_name to this system.
Definition: system.C:681
unsigned int n_vectors() const
Definition: system.h:2214
unsigned int libMesh::System::add_variable ( const std::string &  var,
const FEType type,
const std::set< subdomain_id_type > *const  active_subdomains = libmesh_nullptr 
)
inherited

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

Returns
The index number for the new variable.

Definition at line 1101 of file system.C.

References libMesh::System::_variable_groups, libMesh::System::_variable_numbers, libMesh::System::_variables, libMesh::System::add_variables(), libMesh::VariableGroup::append(), libMesh::System::identify_variable_groups(), libMesh::System::is_initialized(), libMesh::libmesh_assert(), libmesh_nullptr, libMesh::System::n_variable_groups(), libMesh::System::n_vars(), libMesh::System::number(), libMesh::System::variable_name(), and libMesh::System::variable_type().

Referenced by libMesh::DifferentiableSystem::add_second_order_dot_vars(), libMesh::System::add_variable(), assemble_and_solve(), SolidSystem::init_data(), CurlCurlSystem::init_data(), HeatSystem::init_data(), main(), libMesh::ErrorVector::plot_error(), libMesh::System::project_solution_on_reinit(), ParsedFEMFunctionTest::setUp(), FETest< order, family, elem_type >::setUp(), SlitMeshRefinedSystemTest::setUp(), MeshfunctionDFEM::test_mesh_function_dfem(), MeshfunctionDFEM::test_mesh_function_dfem_grad(), DefaultCouplingTest::testCoupling(), PointNeighborCouplingTest::testCoupling(), DofMapTest::testDofOwner(), EquationSystemsTest::testPostInitAddElem(), EquationSystemsTest::testPostInitAddRealSystem(), SystemsTest::testProjectCube(), SystemsTest::testProjectCubeWithMeshFunction(), SystemsTest::testProjectLine(), SystemsTest::testProjectSquare(), EquationSystemsTest::testRefineThenReinitPreserveFlags(), BoundaryInfoTest::testShellFaceConstraints(), and WriteVecAndScalar::testWrite().

1104 {
1105  libmesh_assert(!this->is_initialized());
1106 
1107  // Make sure the variable isn't there already
1108  // or if it is, that it's the type we want
1109  for (unsigned int v=0; v<this->n_vars(); v++)
1110  if (this->variable_name(v) == var)
1111  {
1112  if (this->variable_type(v) == type)
1113  return _variables[v].number();
1114 
1115  libmesh_error_msg("ERROR: incompatible variable " << var << " has already been added for this system!");
1116  }
1117 
1118  // Optimize for VariableGroups here - if the user is adding multiple
1119  // variables of the same FEType and subdomain restriction, catch
1120  // that here and add them as members of the same VariableGroup.
1121  //
1122  // start by setting this flag to whatever the user has requested
1123  // and then consider the conditions which should negate it.
1124  bool should_be_in_vg = this->identify_variable_groups();
1125 
1126  // No variable groups, nothing to add to
1127  if (!this->n_variable_groups())
1128  should_be_in_vg = false;
1129 
1130  else
1131  {
1132  VariableGroup & vg(_variable_groups.back());
1133 
1134  // get a pointer to their subdomain restriction, if any.
1135  const std::set<subdomain_id_type> * const
1136  their_active_subdomains (vg.implicitly_active() ?
1137  libmesh_nullptr : &vg.active_subdomains());
1138 
1139  // Different types?
1140  if (vg.type() != type)
1141  should_be_in_vg = false;
1142 
1143  // they are restricted, we aren't?
1144  if (their_active_subdomains && !active_subdomains)
1145  should_be_in_vg = false;
1146 
1147  // they aren't restricted, we are?
1148  if (!their_active_subdomains && active_subdomains)
1149  should_be_in_vg = false;
1150 
1151  if (their_active_subdomains && active_subdomains)
1152  // restricted to different sets?
1153  if (*their_active_subdomains != *active_subdomains)
1154  should_be_in_vg = false;
1155 
1156  // OK, after all that, append the variable to the vg if none of the conditions
1157  // were violated
1158  if (should_be_in_vg)
1159  {
1160  const unsigned short curr_n_vars = cast_int<unsigned short>
1161  (this->n_vars());
1162 
1163  vg.append (var);
1164 
1165  _variables.push_back(vg(vg.n_variables()-1));
1166  _variable_numbers[var] = curr_n_vars;
1167  return curr_n_vars;
1168  }
1169  }
1170 
1171  // otherwise, fall back to adding a single variable group
1172  return this->add_variables (std::vector<std::string>(1, var),
1173  type,
1174  active_subdomains);
1175 }
std::map< std::string, unsigned short int > _variable_numbers
The variable numbers corresponding to user-specified names, useful for name-based lookups...
Definition: system.h:1903
const std::string & variable_name(const unsigned int i) const
Definition: system.h:2134
const class libmesh_nullptr_t libmesh_nullptr
std::vector< Variable > _variables
The Variable in this System.
Definition: system.h:1892
const FEType & variable_type(const unsigned int i) const
Definition: system.h:2164
libmesh_assert(j)
unsigned int n_variable_groups() const
Definition: system.h:2094
std::vector< VariableGroup > _variable_groups
The VariableGroup in this System.
Definition: system.h:1897
bool is_initialized()
Definition: system.h:2070
bool identify_variable_groups() const
Definition: system.h:2182
unsigned int number() const
Definition: system.h:2006
unsigned int add_variables(const std::vector< std::string > &vars, const FEType &type, const std::set< subdomain_id_type > *const active_subdomains=libmesh_nullptr)
Adds the variable var to the list of variables for this system.
Definition: system.C:1191
unsigned int n_vars() const
Definition: system.h:2086
unsigned int libMesh::System::add_variable ( const std::string &  var,
const Order  order = FIRST,
const FEFamily  family = LAGRANGE,
const std::set< subdomain_id_type > *const  active_subdomains = libmesh_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.

Definition at line 1179 of file system.C.

References libMesh::System::add_variable().

1183 {
1184  return this->add_variable(var,
1185  FEType(order, family),
1186  active_subdomains);
1187 }
unsigned int add_variable(const std::string &var, const FEType &type, const std::set< subdomain_id_type > *const active_subdomains=libmesh_nullptr)
Adds the variable var to the list of variables for this system.
Definition: system.C:1101
unsigned int libMesh::System::add_variables ( const std::vector< std::string > &  vars,
const FEType type,
const std::set< subdomain_id_type > *const  active_subdomains = libmesh_nullptr 
)
inherited

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

Returns
The index number for the new variable.

Definition at line 1191 of file system.C.

References libMesh::System::_variable_groups, libMesh::System::_variable_numbers, libMesh::System::_variables, libMesh::System::is_initialized(), libMesh::libmesh_assert(), libmesh_nullptr, libMesh::System::n_components(), libMesh::System::n_vars(), libMesh::System::number(), libMesh::System::variable_name(), and libMesh::System::variable_type().

Referenced by libMesh::System::add_variable(), libMesh::System::add_variables(), and libMesh::System::project_solution_on_reinit().

1194 {
1195  libmesh_assert(!this->is_initialized());
1196 
1197  // Make sure the variable isn't there already
1198  // or if it is, that it's the type we want
1199  for (std::size_t ov=0; ov<vars.size(); ov++)
1200  for (unsigned int v=0; v<this->n_vars(); v++)
1201  if (this->variable_name(v) == vars[ov])
1202  {
1203  if (this->variable_type(v) == type)
1204  return _variables[v].number();
1205 
1206  libmesh_error_msg("ERROR: incompatible variable " << vars[ov] << " has already been added for this system!");
1207  }
1208 
1209  const unsigned short curr_n_vars = cast_int<unsigned short>
1210  (this->n_vars());
1211 
1212  const unsigned int next_first_component = this->n_components();
1213 
1214  // Add the variable group to the list
1215  _variable_groups.push_back((active_subdomains == libmesh_nullptr) ?
1216  VariableGroup(this, vars, curr_n_vars,
1217  next_first_component, type) :
1218  VariableGroup(this, vars, curr_n_vars,
1219  next_first_component, type, *active_subdomains));
1220 
1221  const VariableGroup & vg (_variable_groups.back());
1222 
1223  // Add each component of the group individually
1224  for (std::size_t v=0; v<vars.size(); v++)
1225  {
1226  _variables.push_back (vg(v));
1227  _variable_numbers[vars[v]] = cast_int<unsigned short>
1228  (curr_n_vars+v);
1229  }
1230 
1231  libmesh_assert_equal_to ((curr_n_vars+vars.size()), this->n_vars());
1232 
1233  // BSK - Defer this now to System::init_data() so we can detect
1234  // VariableGroups 12/28/2012
1235  // // Add the variable group to the _dof_map
1236  // _dof_map->add_variable_group (vg);
1237 
1238  // Return the number of the new variable
1239  return cast_int<unsigned int>(curr_n_vars+vars.size()-1);
1240 }
std::map< std::string, unsigned short int > _variable_numbers
The variable numbers corresponding to user-specified names, useful for name-based lookups...
Definition: system.h:1903
const std::string & variable_name(const unsigned int i) const
Definition: system.h:2134
const class libmesh_nullptr_t libmesh_nullptr
std::vector< Variable > _variables
The Variable in this System.
Definition: system.h:1892
const FEType & variable_type(const unsigned int i) const
Definition: system.h:2164
libmesh_assert(j)
unsigned int n_components() const
Definition: system.h:2102
std::vector< VariableGroup > _variable_groups
The VariableGroup in this System.
Definition: system.h:1897
bool is_initialized()
Definition: system.h:2070
unsigned int number() const
Definition: system.h:2006
unsigned int n_vars() const
Definition: system.h:2086
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 = libmesh_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.

Definition at line 1244 of file system.C.

References libMesh::System::add_variables().

1248 {
1249  return this->add_variables(vars,
1250  FEType(order, family),
1251  active_subdomains);
1252 }
unsigned int add_variables(const std::vector< std::string > &vars, const FEType &type, const std::set< subdomain_id_type > *const active_subdomains=libmesh_nullptr)
Adds the variable var to the list of variables for this system.
Definition: system.C:1191
NumericVector< Number > & libMesh::System::add_vector ( const std::string &  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

Definition at line 681 of file system.C.

References libMesh::System::_dof_map, libMesh::System::_is_initialized, libMesh::System::_vector_is_adjoint, libMesh::System::_vector_projections, libMesh::System::_vector_types, libMesh::System::_vectors, libMesh::NumericVector< T >::build(), libMesh::ParallelObject::comm(), libMesh::GHOSTED, libMesh::System::have_vector(), libMesh::NumericVector< T >::init(), libMesh::System::n_dofs(), and libMesh::System::n_local_dofs().

Referenced by libMesh::System::add_adjoint_rhs(), libMesh::System::add_adjoint_solution(), libMesh::System::add_sensitivity_rhs(), libMesh::System::add_sensitivity_solution(), add_system_rhs(), libMesh::System::add_weighted_sensitivity_adjoint_solution(), libMesh::System::add_weighted_sensitivity_solution(), libMesh::AdjointRefinementEstimator::estimate_error(), libMesh::SecondOrderUnsteadySolver::init(), libMesh::UnsteadySolver::init(), libMesh::OptimizationSystem::init_data(), libMesh::ContinuationSystem::init_data(), main(), libMesh::NewmarkSystem::NewmarkSystem(), libMesh::FrequencySystem::set_frequencies(), libMesh::FrequencySystem::set_frequencies_by_range(), and libMesh::FrequencySystem::set_frequencies_by_steps().

684 {
685  // Return the vector if it is already there.
686  if (this->have_vector(vec_name))
687  return *(_vectors[vec_name]);
688 
689  // Otherwise build the vector
690  NumericVector<Number> * buf = NumericVector<Number>::build(this->comm()).release();
691  _vectors.insert (std::make_pair (vec_name, buf));
692  _vector_projections.insert (std::make_pair (vec_name, projections));
693 
694  _vector_types.insert (std::make_pair (vec_name, type));
695 
696  // Vectors are primal by default
697  _vector_is_adjoint.insert (std::make_pair (vec_name, -1));
698 
699  // Initialize it if necessary
700  if (_is_initialized)
701  {
702  if (type == GHOSTED)
703  {
704 #ifdef LIBMESH_ENABLE_GHOSTED
705  buf->init (this->n_dofs(), this->n_local_dofs(),
706  _dof_map->get_send_list(), false,
707  GHOSTED);
708 #else
709  libmesh_error_msg("Cannot initialize ghosted vectors when they are not enabled.");
710 #endif
711  }
712  else
713  buf->init (this->n_dofs(), this->n_local_dofs(), false, type);
714  }
715 
716  return *buf;
717 }
std::map< std::string, ParallelType > _vector_types
Holds the type of a vector.
Definition: system.h:1933
bool _is_initialized
true when additional vectors and variables do not require immediate initialization, false otherwise.
Definition: system.h:1952
UniquePtr< DofMap > _dof_map
Data structure describing the relationship between nodes, variables, etc...
Definition: system.h:1865
static UniquePtr< NumericVector< T > > build(const Parallel::Communicator &comm, const SolverPackage solver_package=libMesh::default_solver_package())
Builds a NumericVector on the processors in communicator comm using the linear solver package specifi...
bool have_vector(const std::string &vec_name) const
Definition: system.h:2206
std::map< std::string, int > _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:1928
dof_id_type n_local_dofs() const
Definition: system.C:185
std::map< std::string, NumericVector< Number > * > _vectors
Some systems need an arbitrary number of vectors.
Definition: system.h:1916
const Parallel::Communicator & comm() const
std::map< std::string, bool > _vector_projections
Holds true if a vector by that name should be projected onto a changed grid, false if it should be ze...
Definition: system.h:1922
dof_id_type n_dofs() const
Definition: system.C:148
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 1009 of file system.C.

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

Referenced by libMesh::System::project_solution_on_reinit(), and libMesh::ImplicitSystem::weighted_sensitivity_adjoint_solve().

1010 {
1011  std::ostringstream adjoint_name;
1012  adjoint_name << "weighted_sensitivity_adjoint_solution" << i;
1013 
1014  NumericVector<Number> & returnval = this->add_vector(adjoint_name.str());
1015  this->set_vector_as_adjoint(adjoint_name.str(), i);
1016  return returnval;
1017 }
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:905
NumericVector< Number > & add_vector(const std::string &vec_name, const bool projections=true, const ParallelType type=PARALLEL)
Adds the additional vector vec_name to this system.
Definition: system.C:681
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 956 of file system.C.

References libMesh::System::add_vector().

Referenced by libMesh::System::project_solution_on_reinit(), and libMesh::ImplicitSystem::weighted_sensitivity_solve().

957 {
958  return this->add_vector("weighted_sensitivity_solution");
959 }
NumericVector< Number > & add_vector(const std::string &vec_name, const bool projections=true, const ParallelType type=PARALLEL)
Adds the additional vector vec_name to this system.
Definition: system.C:681
void libMesh::System::adjoint_qoi_parameter_sensitivity ( const QoISet qoi_indices,
const ParameterVector parameters,
SensitivityData sensitivities 
)
virtualinherited

Solves for parameter sensitivities using the adjoint method.

This method is only implemented in some derived classes.

Reimplemented in libMesh::ImplicitSystem.

Definition at line 2291 of file system.h.

Referenced by libMesh::System::qoi_parameter_sensitivity(), and libMesh::System::set_adjoint_already_solved().

2294 {
2295  libmesh_not_implemented();
2296 }
std::pair< unsigned int, Real > libMesh::System::adjoint_solve ( const QoISet qoi_indices = QoISet())
virtualinherited

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

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 2275 of file system.h.

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

2276 {
2277  libmesh_not_implemented();
2278 }
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::EigenSystem, libMesh::DifferentiableSystem, libMesh::FrequencySystem, libMesh::ImplicitSystem, and libMesh::NewmarkSystem.

Definition at line 479 of file system.C.

References libMesh::System::user_assembly().

Referenced by libMesh::ImplicitSystem::assemble(), libMesh::EigenSystem::assemble(), solve(), libMesh::System::system(), and libMesh::System::Assembly::~Assembly().

480 {
481  // Log how long the user's assembly code takes
482  LOG_SCOPE("assemble()", "System");
483 
484  // Call the user-specified assembly function
485  this->user_assembly();
486 }
virtual void user_assembly()
Calls user&#39;s attached assembly function, or is overridden by the user in derived classes.
Definition: system.C:1950
void libMesh::ExplicitSystem::assemble_qoi ( const QoISet qoi_indices = QoISet())
virtual

Prepares qoi for quantity of interest assembly, then calls user qoi function.

Can be overridden in derived classes.

Reimplemented from libMesh::System.

Reimplemented in libMesh::FEMSystem.

Definition at line 68 of file explicit_system.C.

References libMesh::System::assemble_qoi(), libMesh::QoISet::has_index(), and libMesh::System::qoi.

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

69 {
70  // The user quantity of interest assembly gets to expect to
71  // accumulate on initially zero values
72  for (std::size_t i=0; i != qoi.size(); ++i)
73  if (qoi_indices.has_index(i))
74  qoi[i] = 0;
75 
76  Parent::assemble_qoi (qoi_indices);
77 }
std::vector< Number > qoi
Values of the quantities of interest.
Definition: system.h:1553
virtual void assemble_qoi(const QoISet &qoi_indices=QoISet())
Calls user qoi function.
Definition: system.C:490
void libMesh::ExplicitSystem::assemble_qoi_derivative ( const QoISet qoi_indices = QoISet(),
bool  include_liftfunc = true,
bool  apply_constraints = true 
)
virtual

Prepares adjoint_rhs for quantity of interest derivative assembly, then calls user qoi derivative function.

Can be overridden in derived classes.

Reimplemented from libMesh::System.

Reimplemented in libMesh::FEMSystem.

Definition at line 81 of file explicit_system.C.

References libMesh::System::add_adjoint_rhs(), libMesh::System::assemble_qoi_derivative(), libMesh::QoISet::has_index(), libMesh::System::qoi, and libMesh::NumericVector< T >::zero().

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

84 {
85  // The user quantity of interest derivative assembly gets to expect
86  // to accumulate on initially zero vectors
87  for (std::size_t i=0; i != qoi.size(); ++i)
88  if (qoi_indices.has_index(i))
89  this->add_adjoint_rhs(i).zero();
90 
91  Parent::assemble_qoi_derivative (qoi_indices, include_liftfunc,
92  apply_constraints);
93 }
virtual void assemble_qoi_derivative(const QoISet &qoi_indices=QoISet(), bool include_liftfunc=true, bool apply_constraints=true)
Calls user qoi derivative function.
Definition: system.C:501
virtual void zero()=0
Set all entries to zero.
std::vector< Number > qoi
Values of the quantities of interest.
Definition: system.h:1553
NumericVector< Number > & add_adjoint_rhs(unsigned int i=0)
Definition: system.C:1041
void libMesh::System::assemble_residual_derivatives ( const ParameterVector parameters)
virtualinherited

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 2250 of file system.h.

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

2251 {
2252  libmesh_not_implemented();
2253 }
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 1795 of file system.C.

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

Referenced by assemble_and_solve(), main(), and libMesh::System::read_parallel_data().

1797 {
1799 
1801  {
1802  libmesh_here();
1803  libMesh::out << "WARNING: Cannot specify both assembly function and object!"
1804  << std::endl;
1805 
1807  }
1808 
1810 }
Assembly * _assemble_system_object
Object that assembles the system.
Definition: system.h:1822
const class libmesh_nullptr_t libmesh_nullptr
Number fptr(const Point &p, const Parameters &, const std::string &libmesh_dbg_var(sys_name), const std::string &unknown_name)
Definition: projection.C:78
libmesh_assert(j)
OStreamProxy out
void(* _assemble_system_function)(EquationSystems &es, const std::string &name)
Function that assembles the system.
Definition: system.h:1816
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 1814 of file system.C.

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

Referenced by main(), and libMesh::System::read_parallel_data().

1815 {
1817  {
1818  libmesh_here();
1819  libMesh::out << "WARNING: Cannot specify both assembly object and function!"
1820  << std::endl;
1821 
1823  }
1824 
1825  _assemble_system_object = &assemble_in;
1826 }
Assembly * _assemble_system_object
Object that assembles the system.
Definition: system.h:1822
const class libmesh_nullptr_t libmesh_nullptr
OStreamProxy out
void(* _assemble_system_function)(EquationSystems &es, const std::string &name)
Function that assembles the system.
Definition: system.h:1816
void libMesh::System::attach_constraint_function ( void   fptrEquationSystems &es, const std::string &name)
inherited

Register a user function for imposing constraints.

Definition at line 1830 of file system.C.

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

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

1832 {
1834 
1836  {
1837  libmesh_here();
1838  libMesh::out << "WARNING: Cannot specify both constraint function and object!"
1839  << std::endl;
1840 
1842  }
1843 
1845 }
void(* _constrain_system_function)(EquationSystems &es, const std::string &name)
Function to impose constraints.
Definition: system.h:1827
Constraint * _constrain_system_object
Object that constrains the system.
Definition: system.h:1833
const class libmesh_nullptr_t libmesh_nullptr
Number fptr(const Point &p, const Parameters &, const std::string &libmesh_dbg_var(sys_name), const std::string &unknown_name)
Definition: projection.C:78
libmesh_assert(j)
OStreamProxy out
void libMesh::System::attach_constraint_object ( System::Constraint constrain)
inherited

Register a user object for imposing constraints.

Definition at line 1849 of file system.C.

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

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

1850 {
1852  {
1853  libmesh_here();
1854  libMesh::out << "WARNING: Cannot specify both constraint object and function!"
1855  << std::endl;
1856 
1858  }
1859 
1860  _constrain_system_object = &constrain;
1861 }
void(* _constrain_system_function)(EquationSystems &es, const std::string &name)
Function to impose constraints.
Definition: system.h:1827
Constraint * _constrain_system_object
Object that constrains the system.
Definition: system.h:1833
const class libmesh_nullptr_t libmesh_nullptr
OStreamProxy out
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 1760 of file system.C.

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

Referenced by main(), and libMesh::System::read_parallel_data().

1762 {
1764 
1766  {
1767  libmesh_here();
1768  libMesh::out << "WARNING: Cannot specify both initialization function and object!"
1769  << std::endl;
1770 
1772  }
1773 
1775 }
const class libmesh_nullptr_t libmesh_nullptr
Number fptr(const Point &p, const Parameters &, const std::string &libmesh_dbg_var(sys_name), const std::string &unknown_name)
Definition: projection.C:78
libmesh_assert(j)
Initialization * _init_system_object
Object that initializes the system.
Definition: system.h:1811
void(* _init_system_function)(EquationSystems &es, const std::string &name)
Function that initializes the system.
Definition: system.h:1805
OStreamProxy out
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 1779 of file system.C.

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

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

1780 {
1782  {
1783  libmesh_here();
1784  libMesh::out << "WARNING: Cannot specify both initialization object and function!"
1785  << std::endl;
1786 
1788  }
1789 
1790  _init_system_object = &init_in;
1791 }
const class libmesh_nullptr_t libmesh_nullptr
Initialization * _init_system_object
Object that initializes the system.
Definition: system.h:1811
void(* _init_system_function)(EquationSystems &es, const std::string &name)
Function that initializes the system.
Definition: system.h:1805
OStreamProxy out
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 1901 of file system.C.

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

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

1903 {
1905 
1907  {
1908  libmesh_here();
1909  libMesh::out << "WARNING: Cannot specify both QOI derivative function and object!"
1910  << std::endl;
1911 
1913  }
1914 
1916 }
const class libmesh_nullptr_t libmesh_nullptr
Number fptr(const Point &p, const Parameters &, const std::string &libmesh_dbg_var(sys_name), const std::string &unknown_name)
Definition: projection.C:78
libmesh_assert(j)
QOIDerivative * _qoi_evaluate_derivative_object
Object to compute derivatives of quantities of interest.
Definition: system.h:1859
OStreamProxy out
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:1850
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 1920 of file system.C.

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

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

1921 {
1923  {
1924  libmesh_here();
1925  libMesh::out << "WARNING: Cannot specify both QOI derivative object and function!"
1926  << std::endl;
1927 
1929  }
1930 
1931  _qoi_evaluate_derivative_object = &qoi_derivative;
1932 }
const class libmesh_nullptr_t libmesh_nullptr
QOIDerivative * _qoi_evaluate_derivative_object
Object to compute derivatives of quantities of interest.
Definition: system.h:1859
OStreamProxy out
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:1850
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 1865 of file system.C.

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

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

1868 {
1870 
1872  {
1873  libmesh_here();
1874  libMesh::out << "WARNING: Cannot specify both QOI function and object!"
1875  << std::endl;
1876 
1878  }
1879 
1881 }
const class libmesh_nullptr_t libmesh_nullptr
void(* _qoi_evaluate_function)(EquationSystems &es, const std::string &name, const QoISet &qoi_indices)
Function to evaluate quantity of interest.
Definition: system.h:1838
Number fptr(const Point &p, const Parameters &, const std::string &libmesh_dbg_var(sys_name), const std::string &unknown_name)
Definition: projection.C:78
libmesh_assert(j)
QOI * _qoi_evaluate_object
Object to compute quantities of interest.
Definition: system.h:1845
OStreamProxy out
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 1885 of file system.C.

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

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

1886 {
1888  {
1889  libmesh_here();
1890  libMesh::out << "WARNING: Cannot specify both QOI object and function!"
1891  << std::endl;
1892 
1894  }
1895 
1896  _qoi_evaluate_object = &qoi_in;
1897 }
const class libmesh_nullptr_t libmesh_nullptr
void(* _qoi_evaluate_function)(EquationSystems &es, const std::string &name, const QoISet &qoi_indices)
Function to evaluate quantity of interest.
Definition: system.h:1838
QOI * _qoi_evaluate_object
Object to compute quantities of interest.
Definition: system.h:1845
OStreamProxy out
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 = libmesh_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. If non-default Parameters are to be used, they can be provided in the parameters argument.

Definition at line 999 of file system_projection.C.

References libMesh::System::boundary_project_vector(), fptr(), and gptr().

Referenced by libMesh::System::project_vector(), and libMesh::System::system_type().

1003 {
1004  this->boundary_project_vector(b, variables, *solution, f, g);
1005 
1006  solution->localize(*current_local_solution);
1007 }
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=libmesh_nullptr, int is_adjoint=-1) const
Projects arbitrary boundary functions onto a vector of degree of freedom values for the current syste...
UniquePtr< NumericVector< Number > > current_local_solution
All the values I need to compute my contribution to the simulation at hand.
Definition: system.h:1535
UniquePtr< NumericVector< Number > > solution
Data structure to hold solution values.
Definition: system.h:1523
void libMesh::System::boundary_project_solution ( const std::set< boundary_id_type > &  b,
const std::vector< unsigned int > &  variables,
Number   fptrconst Point &p, const Parameters &parameters, const std::string &sys_name, const std::string &unknown_name,
Gradient   gptrconst Point &p, const Parameters &parameters, const std::string &sys_name, const std::string &unknown_name,
const Parameters parameters 
)
inherited

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

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.

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 = libmesh_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. If non-default Parameters are to be used, they can be provided in the parameters argument.

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

Definition at line 1041 of file system_projection.C.

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

Referenced by libMesh::System::boundary_project_solution(), and libMesh::System::system_type().

1047 {
1048  LOG_SCOPE ("boundary_project_vector()", "System");
1049 
1051  (ConstElemRange (this->get_mesh().active_local_elements_begin(),
1052  this->get_mesh().active_local_elements_end() ),
1053  BoundaryProjectSolution(b, variables, *this, f, g,
1054  this->get_equation_systems().parameters,
1055  new_vector)
1056  );
1057 
1058  // We don't do SCALAR dofs when just projecting the boundary, so
1059  // we're done here.
1060 
1061  new_vector.close();
1062 
1063 #ifdef LIBMESH_ENABLE_CONSTRAINTS
1064  if (is_adjoint == -1)
1065  this->get_dof_map().enforce_constraints_exactly(*this, &new_vector);
1066  else if (is_adjoint >= 0)
1068  is_adjoint);
1069 #endif
1070 }
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
StoredRange< MeshBase::const_element_iterator, const Elem * > ConstElemRange
Definition: elem_range.h:34
const MeshBase & get_mesh() const
Definition: system.h:2014
const DofMap & get_dof_map() const
Definition: system.h:2030
void enforce_constraints_exactly(const System &system, NumericVector< Number > *v=libmesh_nullptr, bool homogeneous=false) const
Constrains the numeric vector v, which represents a solution defined on the mesh. ...
Definition: dof_map.h:1816
virtual void close()=0
Calls the NumericVector&#39;s internal assembly routines, ensuring that the values are consistent across ...
const EquationSystems & get_equation_systems() const
Definition: system.h:712
void enforce_adjoint_constraints_exactly(NumericVector< Number > &v, unsigned int q) const
Heterogenously constrains the numeric vector v, which represents an adjoint solution defined on the m...
Definition: dof_map.h:1820
void libMesh::System::boundary_project_vector ( const std::set< boundary_id_type > &  b,
const std::vector< unsigned int > &  variables,
Number   fptrconst Point &p, const Parameters &parameters, const std::string &sys_name, const std::string &unknown_name,
Gradient   gptrconst Point &p, const Parameters &parameters, const std::string &sys_name, const std::string &unknown_name,
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.

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.

Real libMesh::System::calculate_norm ( const NumericVector< Number > &  v,
unsigned int  var,
FEMNormType  norm_type,
std::set< unsigned int > *  skip_dimensions = libmesh_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 1383 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::AdaptiveTimeSolver::calculate_norm(), libMesh::UnsteadySolver::du(), main(), output_norms(), and libMesh::System::project_solution_on_reinit().

1387 {
1388  //short circuit to save time
1389  if (norm_type == DISCRETE_L1 ||
1390  norm_type == DISCRETE_L2 ||
1391  norm_type == DISCRETE_L_INF)
1392  return discrete_var_norm(v,var,norm_type);
1393 
1394  // Not a discrete norm
1395  std::vector<FEMNormType> norms(this->n_vars(), L2);
1396  std::vector<Real> weights(this->n_vars(), 0.0);
1397  norms[var] = norm_type;
1398  weights[var] = 1.0;
1399  Real val = this->calculate_norm(v, SystemNorm(norms, weights), skip_dimensions);
1400  return val;
1401 }
Real calculate_norm(const NumericVector< Number > &v, unsigned int var, FEMNormType norm_type, std::set< unsigned int > *skip_dimensions=libmesh_nullptr) const
Definition: system.C:1383
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
unsigned int n_vars() const
Definition: system.h:2086
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:1364
Real libMesh::System::calculate_norm ( const NumericVector< Number > &  v,
const SystemNorm norm,
std::set< unsigned int > *  skip_dimensions = libmesh_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 1405 of file system.C.

References libMesh::System::_dof_map, libMesh::System::_mesh, std::abs(), libMesh::TypeVector< T >::add_scaled(), libMesh::TypeTensor< T >::add_scaled(), 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::FEGenericBase< OutputType >::get_d2phi(), libMesh::System::get_dof_map(), libMesh::FEGenericBase< OutputType >::get_dphi(), libMesh::FEAbstract::get_JxW(), libMesh::System::get_mesh(), libMesh::FEGenericBase< OutputType >::get_phi(), libMesh::H1, libMesh::H1_SEMINORM, libMesh::H2, libMesh::H2_SEMINORM, libMesh::SystemNorm::is_discrete(), libMesh::L1, libMesh::NumericVector< T >::l1_norm(), libMesh::L2, libMesh::NumericVector< T >::l2_norm(), libMesh::L_INF, libMesh::libmesh_assert(), libmesh_nullptr, libMesh::NumericVector< T >::linfty_norm(), libMesh::NumericVector< T >::localize(), std::max(), libMesh::Parallel::Communicator::max(), libMesh::QBase::n_points(), libMesh::System::n_vars(), libMesh::TypeVector< T >::norm(), libMesh::TypeTensor< T >::norm(), libMesh::TensorTools::norm_sq(), libMesh::TypeVector< T >::norm_sq(), libMesh::TypeTensor< T >::norm_sq(), libMesh::Real, libMesh::FEAbstract::reinit(), libMesh::SERIAL, libMesh::NumericVector< T >::size(), libMesh::Parallel::Communicator::sum(), libMesh::SystemNorm::type(), libMesh::DofMap::variable_type(), libMesh::W1_INF_SEMINORM, libMesh::W2_INF_SEMINORM, libMesh::SystemNorm::weight(), and libMesh::SystemNorm::weight_sq().

1408 {
1409  // This function must be run on all processors at once
1410  parallel_object_only();
1411 
1412  LOG_SCOPE ("calculate_norm()", "System");
1413 
1414  // Zero the norm before summation
1415  Real v_norm = 0.;
1416 
1417  if (norm.is_discrete())
1418  {
1419  //Check to see if all weights are 1.0 and all types are equal
1420  FEMNormType norm_type0 = norm.type(0);
1421  unsigned int check_var = 0;
1422  for (; check_var != this->n_vars(); ++check_var)
1423  if ((norm.weight(check_var) != 1.0) || (norm.type(check_var) != norm_type0))
1424  break;
1425 
1426  //All weights were 1.0 so just do the full vector discrete norm
1427  if (check_var == this->n_vars())
1428  {
1429  if (norm_type0 == DISCRETE_L1)
1430  return v.l1_norm();
1431  if (norm_type0 == DISCRETE_L2)
1432  return v.l2_norm();
1433  if (norm_type0 == DISCRETE_L_INF)
1434  return v.linfty_norm();
1435  else
1436  libmesh_error_msg("Invalid norm_type0 = " << norm_type0);
1437  }
1438 
1439  for (unsigned int var=0; var != this->n_vars(); ++var)
1440  {
1441  // Skip any variables we don't need to integrate
1442  if (norm.weight(var) == 0.0)
1443  continue;
1444 
1445  v_norm += norm.weight(var) * discrete_var_norm(v, var, norm.type(var));
1446  }
1447 
1448  return v_norm;
1449  }
1450 
1451  // Localize the potentially parallel vector
1452  UniquePtr<NumericVector<Number>> local_v = NumericVector<Number>::build(this->comm());
1453  local_v->init(v.size(), true, SERIAL);
1454  v.localize (*local_v, _dof_map->get_send_list());
1455 
1456  // I'm not sure how best to mix Hilbert norms on some variables (for
1457  // which we'll want to square then sum then square root) with norms
1458  // like L_inf (for which we'll just want to take an absolute value
1459  // and then sum).
1460  bool using_hilbert_norm = true,
1461  using_nonhilbert_norm = true;
1462 
1463  // Loop over all variables
1464  for (unsigned int var=0; var != this->n_vars(); ++var)
1465  {
1466  // Skip any variables we don't need to integrate
1467  Real norm_weight_sq = norm.weight_sq(var);
1468  if (norm_weight_sq == 0.0)
1469  continue;
1470  Real norm_weight = norm.weight(var);
1471 
1472  // Check for unimplemented norms (rather than just returning 0).
1473  FEMNormType norm_type = norm.type(var);
1474  if ((norm_type==H1) ||
1475  (norm_type==H2) ||
1476  (norm_type==L2) ||
1477  (norm_type==H1_SEMINORM) ||
1478  (norm_type==H2_SEMINORM))
1479  {
1480  if (!using_hilbert_norm)
1481  libmesh_not_implemented();
1482  using_nonhilbert_norm = false;
1483  }
1484  else if ((norm_type==L1) ||
1485  (norm_type==L_INF) ||
1486  (norm_type==W1_INF_SEMINORM) ||
1487  (norm_type==W2_INF_SEMINORM))
1488  {
1489  if (!using_nonhilbert_norm)
1490  libmesh_not_implemented();
1491  using_hilbert_norm = false;
1492  }
1493  else
1494  libmesh_not_implemented();
1495 
1496  const FEType & fe_type = this->get_dof_map().variable_type(var);
1497 
1498  // Allow space for dims 0-3, even if we don't use them all
1499  std::vector<FEBase *> fe_ptrs(4,libmesh_nullptr);
1500  std::vector<QBase *> q_rules(4,libmesh_nullptr);
1501 
1502  const std::set<unsigned char> & elem_dims = _mesh.elem_dimensions();
1503 
1504  // Prepare finite elements for each dimension present in the mesh
1505  for (std::set<unsigned char>::const_iterator d_it = elem_dims.begin();
1506  d_it != elem_dims.end(); ++d_it)
1507  {
1508  if (skip_dimensions && skip_dimensions->find(*d_it) != skip_dimensions->end())
1509  continue;
1510 
1511  q_rules[*d_it] =
1512  fe_type.default_quadrature_rule (*d_it).release();
1513 
1514  // Construct finite element object
1515 
1516  fe_ptrs[*d_it] = FEBase::build(*d_it, fe_type).release();
1517 
1518  // Attach quadrature rule to FE object
1519  fe_ptrs[*d_it]->attach_quadrature_rule (q_rules[*d_it]);
1520  }
1521 
1522  std::vector<dof_id_type> dof_indices;
1523 
1524  // Begin the loop over the elements
1525  for (const auto & elem : this->get_mesh().active_local_element_ptr_range())
1526  {
1527  const unsigned int dim = elem->dim();
1528 
1529 #ifdef LIBMESH_ENABLE_INFINITE_ELEMENTS
1530 
1531  // One way for implementing this would be to exchange the fe with the FEInterface- class.
1532  // However, it needs to be discussed whether integral-norms make sense for infinite elements.
1533  // or in which sense they could make sense.
1534  if (elem->infinite() )
1535  libmesh_not_implemented();
1536 
1537 #endif
1538 
1539  if (skip_dimensions && skip_dimensions->find(dim) != skip_dimensions->end())
1540  continue;
1541 
1542  FEBase * fe = fe_ptrs[dim];
1543  QBase * qrule = q_rules[dim];
1544  libmesh_assert(fe);
1545  libmesh_assert(qrule);
1546 
1547  const std::vector<Real> & JxW = fe->get_JxW();
1548  const std::vector<std::vector<Real>> * phi = libmesh_nullptr;
1549  if (norm_type == H1 ||
1550  norm_type == H2 ||
1551  norm_type == L2 ||
1552  norm_type == L1 ||
1553  norm_type == L_INF)
1554  phi = &(fe->get_phi());
1555 
1556  const std::vector<std::vector<RealGradient>> * dphi = libmesh_nullptr;
1557  if (norm_type == H1 ||
1558  norm_type == H2 ||
1559  norm_type == H1_SEMINORM ||
1560  norm_type == W1_INF_SEMINORM)
1561  dphi = &(fe->get_dphi());
1562 #ifdef LIBMESH_ENABLE_SECOND_DERIVATIVES
1563  const std::vector<std::vector<RealTensor>> * d2phi = libmesh_nullptr;
1564  if (norm_type == H2 ||
1565  norm_type == H2_SEMINORM ||
1566  norm_type == W2_INF_SEMINORM)
1567  d2phi = &(fe->get_d2phi());
1568 #endif
1569 
1570  fe->reinit (elem);
1571 
1572  this->get_dof_map().dof_indices (elem, dof_indices, var);
1573 
1574  const unsigned int n_qp = qrule->n_points();
1575 
1576  const unsigned int n_sf = cast_int<unsigned int>
1577  (dof_indices.size());
1578 
1579  // Begin the loop over the Quadrature points.
1580  for (unsigned int qp=0; qp<n_qp; qp++)
1581  {
1582  if (norm_type == L1)
1583  {
1584  Number u_h = 0.;
1585  for (unsigned int i=0; i != n_sf; ++i)
1586  u_h += (*phi)[i][qp] * (*local_v)(dof_indices[i]);
1587  v_norm += norm_weight *
1588  JxW[qp] * std::abs(u_h);
1589  }
1590 
1591  if (norm_type == L_INF)
1592  {
1593  Number u_h = 0.;
1594  for (unsigned int i=0; i != n_sf; ++i)
1595  u_h += (*phi)[i][qp] * (*local_v)(dof_indices[i]);
1596  v_norm = std::max(v_norm, norm_weight * std::abs(u_h));
1597  }
1598 
1599  if (norm_type == H1 ||
1600  norm_type == H2 ||
1601  norm_type == L2)
1602  {
1603  Number u_h = 0.;
1604  for (unsigned int i=0; i != n_sf; ++i)
1605  u_h += (*phi)[i][qp] * (*local_v)(dof_indices[i]);
1606  v_norm += norm_weight_sq *
1607  JxW[qp] * TensorTools::norm_sq(u_h);
1608  }
1609 
1610  if (norm_type == H1 ||
1611  norm_type == H2 ||
1612  norm_type == H1_SEMINORM)
1613  {
1614  Gradient grad_u_h;
1615  for (unsigned int i=0; i != n_sf; ++i)
1616  grad_u_h.add_scaled((*dphi)[i][qp], (*local_v)(dof_indices[i]));
1617  v_norm += norm_weight_sq *
1618  JxW[qp] * grad_u_h.norm_sq();
1619  }
1620 
1621  if (norm_type == W1_INF_SEMINORM)
1622  {
1623  Gradient grad_u_h;
1624  for (unsigned int i=0; i != n_sf; ++i)
1625  grad_u_h.add_scaled((*dphi)[i][qp], (*local_v)(dof_indices[i]));
1626  v_norm = std::max(v_norm, norm_weight * grad_u_h.norm());
1627  }
1628 
1629 #ifdef LIBMESH_ENABLE_SECOND_DERIVATIVES
1630  if (norm_type == H2 ||
1631  norm_type == H2_SEMINORM)
1632  {
1633  Tensor hess_u_h;
1634  for (unsigned int i=0; i != n_sf; ++i)
1635  hess_u_h.add_scaled((*d2phi)[i][qp], (*local_v)(dof_indices[i]));
1636  v_norm += norm_weight_sq *
1637  JxW[qp] * hess_u_h.norm_sq();
1638  }
1639 
1640  if (norm_type == W2_INF_SEMINORM)
1641  {
1642  Tensor hess_u_h;
1643  for (unsigned int i=0; i != n_sf; ++i)
1644  hess_u_h.add_scaled((*d2phi)[i][qp], (*local_v)(dof_indices[i]));
1645  v_norm = std::max(v_norm, norm_weight * hess_u_h.norm());
1646  }
1647 #endif
1648  }
1649  }
1650 
1651  // Need to delete the FE and quadrature objects to prevent a memory leak
1652  for (std::size_t i=0; i<fe_ptrs.size(); i++)
1653  if (fe_ptrs[i])
1654  delete fe_ptrs[i];
1655 
1656  for (std::size_t i=0; i<q_rules.size(); i++)
1657  if (q_rules[i])
1658  delete q_rules[i];
1659  }
1660 
1661  if (using_hilbert_norm)
1662  {
1663  this->comm().sum(v_norm);
1664  v_norm = std::sqrt(v_norm);
1665  }
1666  else
1667  {
1668  this->comm().max(v_norm);
1669  }
1670 
1671  return v_norm;
1672 }
double abs(double a)
virtual numeric_index_type size() const =0
const FEType & variable_type(const unsigned int c) const
Definition: dof_map.h:1697
void max(T &r) const
Take a local variable and replace it with the maximum of it&#39;s values on all processors.
void add_scaled(const TypeTensor< T2 > &, const T)
Add a scaled tensor to this tensor without creating a temporary.
Definition: type_tensor.h:777
void add_scaled(const TypeVector< T2 > &, const T)
Add a scaled value to this vector without creating a temporary.
Definition: type_vector.h:624
virtual Real l2_norm() const =0
unsigned int dim
const class libmesh_nullptr_t libmesh_nullptr
virtual Real l1_norm() const =0
long double max(long double a, double b)
UniquePtr< DofMap > _dof_map
Data structure describing the relationship between nodes, variables, etc...
Definition: system.h:1865
libmesh_assert(j)
static UniquePtr< NumericVector< T > > build(const Parallel::Communicator &comm, const SolverPackage solver_package=libMesh::default_solver_package())
Builds a NumericVector on the processors in communicator comm using the linear solver package specifi...
const MeshBase & get_mesh() const
Definition: system.h:2014
const DofMap & get_dof_map() const
Definition: system.h:2030
NumberVectorValue Gradient
const std::set< unsigned char > & elem_dimensions() const
Definition: mesh_base.h:206
FEGenericBase< Real > FEBase
virtual Real linfty_norm() const =0
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
NumberTensorValue Tensor
const Parallel::Communicator & comm() const
ParallelType type() const
unsigned int n_vars() const
Definition: system.h:2086
void sum(T &r) const
Take a local variable and replace it with the sum of it&#39;s values on all processors.
MeshBase & _mesh
Constant reference to the mesh data structure used for the simulation.
Definition: system.h:1877
virtual void localize(std::vector< T > &v_local) const =0
Creates a copy of the global vector in the local vector v_local.
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:1364
FEMNormType
defines an enum for norms defined on vectors of finite element coefficients
void dof_indices(const Elem *const elem, std::vector< dof_id_type > &di) const
Fills the vector di with the global degree of freedom indices for the element.
Definition: dof_map.C:1917
static UniquePtr< FEGenericBase > build(const unsigned int dim, const FEType &type)
Builds a specific finite element type.
void libMesh::ExplicitSystem::clear ( )
virtual

Clear all the data structures associated with the system.

Reimplemented from libMesh::System.

Reimplemented in libMesh::OptimizationSystem, libMesh::NonlinearImplicitSystem, libMesh::RBConstruction, libMesh::DifferentiableSystem, libMesh::ContinuationSystem, libMesh::FrequencySystem, libMesh::LinearImplicitSystem, libMesh::RBConstructionBase< LinearImplicitSystem >, libMesh::ImplicitSystem, libMesh::TransientSystem< RBConstruction >, libMesh::RBEIMConstruction, libMesh::TransientRBConstruction, and libMesh::NewmarkSystem.

Definition at line 45 of file explicit_system.C.

References add_system_rhs(), and libMesh::System::clear().

Referenced by libMesh::ImplicitSystem::clear(), and system().

46 {
47  // Clear the parent data
48  Parent::clear();
49 
50  // Restore us to a "basic" state
51  this->add_system_rhs ();
52 }
virtual void clear()
Clear all the data structures associated with the system.
Definition: system.C:203
void add_system_rhs()
Add the system right-hand-side vector to the _vectors data structure.
const Parallel::Communicator& libMesh::ParallelObject::comm ( ) const
inherited
Returns
A reference to the Parallel::Communicator object used by this mesh.

Definition at line 87 of file parallel_object.h.

References libMesh::ParallelObject::_communicator.

Referenced by libMesh::__libmesh_petsc_diff_solver_monitor(), libMesh::__libmesh_petsc_diff_solver_residual(), libMesh::__libmesh_petsc_preconditioner_apply(), libMesh::__libmesh_petsc_snes_jacobian(), libMesh::__libmesh_petsc_snes_postcheck(), libMesh::__libmesh_petsc_snes_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::ParmetisPartitioner::_do_repartition(), libMesh::UniformRefinementEstimator::_estimate_error(), libMesh::BoundaryInfo::_find_id_maps(), libMesh::PetscLinearSolver< T >::_petsc_shell_matrix_get_diagonal(), libMesh::SlepcEigenSolver< T >::_petsc_shell_matrix_get_diagonal(), libMesh::PetscLinearSolver< T >::_petsc_shell_matrix_mult(), libMesh::SlepcEigenSolver< T >::_petsc_shell_matrix_mult(), libMesh::PetscLinearSolver< T >::_petsc_shell_matrix_mult_add(), libMesh::EquationSystems::_read_impl(), libMesh::MeshRefinement::_refine_elements(), libMesh::MeshRefinement::_smooth_flags(), add_cube_convex_hull_to_mesh(), libMesh::TransientRBConstruction::add_IC_to_RB_space(), libMesh::ImplicitSystem::add_matrix(), libMesh::RBConstruction::add_scaled_matrix_and_vector(), libMesh::System::add_vector(), libMesh::EigenSparseLinearSolver< T >::adjoint_solve(), libMesh::UnstructuredMesh::all_second_order(), libMesh::MeshTools::Modification::all_tri(), libMesh::LaplaceMeshSmoother::allgather_graph(), libMesh::TransientRBConstruction::allocate_data_structures(), libMesh::RBConstruction::allocate_data_structures(), libMesh::TransientRBConstruction::assemble_affine_expansion(), libMesh::FEMSystem::assemble_qoi(), libMesh::MeshCommunication::assign_global_indices(), libMesh::ParmetisPartitioner::assign_partitioning(), libMesh::DofMap::attach_matrix(), libMesh::Parallel::BinSorter< KeyType, IdxType >::binsort(), libMesh::Parallel::Sort< KeyType, IdxType >::binsort(), libMesh::MeshCommunication::broadcast(), libMesh::SparseMatrix< T >::build(), libMesh::MeshTools::Generation::build_extrusion(), libMesh::Parallel::Histogram< KeyType, IdxType >::build_histogram(), libMesh::PetscNonlinearSolver< T >::build_mat_null_space(), libMesh::BoundaryInfo::build_node_list_from_side_list(), libMesh::EquationSystems::build_parallel_solution_vector(), libMesh::MeshBase::cache_elem_dims(), libMesh::System::calculate_norm(), libMesh::DofMap::check_dirichlet_bcid_consistency(), libMesh::Parallel::Sort< KeyType, IdxType >::communicate_bins(), 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::RBSCMConstruction::compute_SCM_bounds_on_training_set(), libMesh::Problem_Interface::computeF(), libMesh::Problem_Interface::computeJacobian(), libMesh::Problem_Interface::computePreconditioner(), libMesh::ExodusII_IO::copy_elemental_solution(), libMesh::MeshTools::correct_node_proc_ids(), libMesh::MeshTools::create_bounding_box(), 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::MeshCommunication::delete_remote_elements(), libMesh::DofMap::distribute_dofs(), DMlibMeshFunction(), DMlibMeshJacobian(), DMlibMeshSetSystem_libMesh(), DMVariableBounds_libMesh(), libMesh::MeshRefinement::eliminate_unrefined_patches(), libMesh::RBEIMConstruction::enrich_RB_space(), libMesh::TransientRBConstruction::enrich_RB_space(), libMesh::RBConstruction::enrich_RB_space(), AssembleOptimization::equality_constraints(), libMesh::WeightedPatchRecoveryErrorEstimator::estimate_error(), libMesh::JumpErrorEstimator::estimate_error(), libMesh::PatchRecoveryErrorEstimator::estimate_error(), libMesh::AdjointRefinementEstimator::estimate_error(), libMesh::ExactErrorEstimator::estimate_error(), libMesh::RBEIMConstruction::evaluate_mesh_function(), libMesh::MeshRefinement::flag_elements_by_elem_fraction(), libMesh::MeshRefinement::flag_elements_by_error_fraction(), libMesh::MeshRefinement::flag_elements_by_nelem_target(), libMesh::MeshCommunication::gather(), libMesh::MeshCommunication::gather_neighboring_elements(), libMesh::MeshfreeInterpolation::gather_remote_data(), libMesh::CondensedEigenSystem::get_eigenpair(), libMesh::DofMap::get_info(), libMesh::ImplicitSystem::get_linear_solver(), libMesh::EquationSystems::get_solution(), AssembleOptimization::inequality_constraints(), AssembleOptimization::inequality_constraints_jacobian(), libMesh::LocationMap< T >::init(), libMesh::TopologyMap::init(), libMesh::PetscDiffSolver::init(), libMesh::TimeSolver::init(), libMesh::TaoOptimizationSolver< T >::init(), libMesh::PetscNonlinearSolver< T >::init(), libMesh::SystemSubsetBySubdomain::init(), libMesh::EigenSystem::init_data(), libMesh::EigenSystem::init_matrices(), libMesh::ParmetisPartitioner::initialize(), libMesh::OptimizationSystem::initialize_equality_constraints_storage(), libMesh::OptimizationSystem::initialize_inequality_constraints_storage(), libMesh::RBEIMConstruction::initialize_rb_construction(), integrate_function(), 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::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::MeshRefinement::limit_level_mismatch_at_edge(), libMesh::MeshRefinement::limit_level_mismatch_at_node(), libMesh::MeshRefinement::limit_overrefined_boundary(), libMesh::MeshRefinement::limit_underrefined_boundary(), 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_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::MeshSerializer::MeshSerializer(), LinearElasticityWithContact::move_mesh(), libMesh::DistributedMesh::n_active_elem(), libMesh::MeshTools::n_active_levels(), libMesh::BoundaryInfo::n_boundary_conds(), libMesh::BoundaryInfo::n_edge_conds(), libMesh::CondensedEigenSystem::n_global_non_condensed_dofs(), libMesh::MeshTools::n_levels(), libMesh::BoundaryInfo::n_nodeset_conds(), libMesh::MeshTools::n_p_levels(), libMesh::BoundaryInfo::n_shellface_conds(), new_function_base(), 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::MeshTools::paranoid_n_levels(), libMesh::Partitioner::partition(), libMesh::MetisPartitioner::partition_range(), 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::SparseMatrix< T >::print(), FEMParameters::read(), libMesh::Nemesis_IO::read(), libMesh::CheckpointIO::read(), libMesh::XdrIO::read(), libMesh::CheckpointIO::read_header(), libMesh::XdrIO::read_header(), libMesh::RBEvaluation::read_in_vectors_from_multiple_files(), libMesh::TransientRBConstruction::read_riesz_representors_from_files(), libMesh::RBConstruction::read_riesz_representors_from_files(), libMesh::XdrIO::read_serialized_bc_names(), libMesh::XdrIO::read_serialized_bcs_helper(), libMesh::XdrIO::read_serialized_connectivity(), libMesh::XdrIO::read_serialized_nodes(), libMesh::XdrIO::read_serialized_nodesets(), libMesh::XdrIO::read_serialized_subdomain_names(), libMesh::MeshBase::recalculate_n_partitions(), libMesh::MeshCommunication::redistribute(), libMesh::MeshRefinement::refine_and_coarsen_elements(), libMesh::DistributedMesh::renumber_dof_objects(), LinearElasticityWithContact::residual_and_jacobian(), libMesh::MeshCommunication::send_coarse_ghosts(), libMesh::TransientRBConstruction::set_error_temporal_data(), libMesh::RBEIMConstruction::set_explicit_sys_subvector(), libMesh::Partitioner::set_node_processor_ids(), libMesh::DofMap::set_nonlocal_dof_objects(), libMesh::Partitioner::set_parent_processor_ids(), libMesh::LaplaceMeshSmoother::smooth(), libMesh::Parallel::Sort< KeyType, IdxType >::sort(), libMesh::MeshBase::subdomain_ids(), libMesh::BoundaryInfo::sync(), libMesh::Parallel::sync_element_data_by_parent_id(), libMesh::Parallel::sync_node_data_by_element_id(), libMesh::MeshRefinement::test_level_one(), MeshfunctionDFEM::test_mesh_function_dfem(), MeshfunctionDFEM::test_mesh_function_dfem_grad(), libMesh::MeshRefinement::test_unflagged(), PointLocatorTest::testLocator(), BoundaryInfoTest::testMesh(), SystemsTest::testProjectCubeWithMeshFunction(), libMesh::MeshTools::total_weight(), libMesh::MeshFunctionSolutionTransfer::transfer(), libMesh::MeshfreeSolutionTransfer::transfer(), libMesh::TransientRBConstruction::truth_assembly(), libMesh::RBConstruction::truth_assembly(), libMesh::MeshRefinement::uniformly_coarsen(), libMesh::TransientRBConstruction::update_RB_initial_condition_all_N(), libMesh::RBEIMConstruction::update_RB_system_matrices(), libMesh::TransientRBConstruction::update_RB_system_matrices(), libMesh::RBConstruction::update_RB_system_matrices(), libMesh::TransientRBConstruction::update_residual_terms(), libMesh::RBConstruction::update_residual_terms(), libMesh::NameBasedIO::write(), libMesh::XdrIO::write(), libMesh::RBEvaluation::write_out_vectors(), libMesh::TransientRBConstruction::write_riesz_representors_to_files(), libMesh::RBConstruction::write_riesz_representors_to_files(), libMesh::XdrIO::write_serialized_bcs_helper(), 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().

88  { return _communicator; }
const Parallel::Communicator & _communicator
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 531 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.

Referenced by libMesh::EquationSystems::compare(), and libMesh::System::set_adjoint_already_solved().

534 {
535  // we do not care for matrices, but for vectors
537  libmesh_assert (other_system._is_initialized);
538 
539  if (verbose)
540  {
541  libMesh::out << " Systems \"" << _sys_name << "\"" << std::endl;
542  libMesh::out << " comparing matrices not supported." << std::endl;
543  libMesh::out << " comparing names...";
544  }
545 
546  // compare the name: 0 means identical
547  const int name_result = _sys_name.compare(other_system.name());
548  if (verbose)
549  {
550  if (name_result == 0)
551  libMesh::out << " identical." << std::endl;
552  else
553  libMesh::out << " names not identical." << std::endl;
554  libMesh::out << " comparing solution vector...";
555  }
556 
557 
558  // compare the solution: -1 means identical
559  const int solu_result = solution->compare (*other_system.solution.get(),
560  threshold);
561 
562  if (verbose)
563  {
564  if (solu_result == -1)
565  libMesh::out << " identical up to threshold." << std::endl;
566  else
567  libMesh::out << " first difference occurred at index = "
568  << solu_result << "." << std::endl;
569  }
570 
571 
572  // safety check, whether we handle at least the same number
573  // of vectors
574  std::vector<int> ov_result;
575 
576  if (this->n_vectors() != other_system.n_vectors())
577  {
578  if (verbose)
579  {
580  libMesh::out << " Fatal difference. This system handles "
581  << this->n_vectors() << " add'l vectors," << std::endl
582  << " while the other system handles "
583  << other_system.n_vectors()
584  << " add'l vectors." << std::endl
585  << " Aborting comparison." << std::endl;
586  }
587  return false;
588  }
589  else if (this->n_vectors() == 0)
590  {
591  // there are no additional vectors...
592  ov_result.clear ();
593  }
594  else
595  {
596  // compare other vectors
597  for (const_vectors_iterator pos = _vectors.begin();
598  pos != _vectors.end(); ++pos)
599  {
600  if (verbose)
601  libMesh::out << " comparing vector \""
602  << pos->first << "\" ...";
603 
604  // assume they have the same name
605  const NumericVector<Number> & other_system_vector =
606  other_system.get_vector(pos->first);
607 
608  ov_result.push_back(pos->second->compare (other_system_vector,
609  threshold));
610 
611  if (verbose)
612  {
613  if (ov_result[ov_result.size()-1] == -1)
614  libMesh::out << " identical up to threshold." << std::endl;
615  else
616  libMesh::out << " first difference occurred at" << std::endl
617  << " index = " << ov_result[ov_result.size()-1] << "." << std::endl;
618  }
619 
620  }
621 
622  } // finished comparing additional vectors
623 
624 
625  bool overall_result;
626 
627  // sum up the results
628  if ((name_result==0) && (solu_result==-1))
629  {
630  if (ov_result.size()==0)
631  overall_result = true;
632  else
633  {
634  bool ov_identical;
635  unsigned int n = 0;
636  do
637  {
638  ov_identical = (ov_result[n]==-1);
639  n++;
640  }
641  while (ov_identical && n<ov_result.size());
642  overall_result = ov_identical;
643  }
644  }
645  else
646  overall_result = false;
647 
648  if (verbose)
649  {
650  libMesh::out << " finished comparisons, ";
651  if (overall_result)
652  libMesh::out << "found no differences." << std::endl << std::endl;
653  else
654  libMesh::out << "found differences." << std::endl << std::endl;
655  }
656 
657  return overall_result;
658 }
bool _is_initialized
true when additional vectors and variables do not require immediate initialization, false otherwise.
Definition: system.h:1952
std::map< std::string, NumericVector< Number > * >::const_iterator const_vectors_iterator
Definition: system.h:749
libmesh_assert(j)
UniquePtr< NumericVector< Number > > solution
Data structure to hold solution values.
Definition: system.h:1523
std::map< std::string, NumericVector< Number > * > _vectors
Some systems need an arbitrary number of vectors.
Definition: system.h:1916
OStreamProxy out
const std::string _sys_name
A name associated with this system.
Definition: system.h:1882
unsigned int n_vectors() const
Definition: system.h:2214
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 192 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::System::point_gradient(), libMesh::System::point_hessian(), libMesh::System::point_value(), libMesh::HPCoarsenTest::select_refinement(), SolidSystem::side_time_derivative(), libMesh::EnsightIO::write_scalar_ascii(), and libMesh::EnsightIO::write_vector_ascii().

193 {
194  // Check the sizes
195  libmesh_assert_less (global_dof_number, _dof_map->n_dofs());
196  libmesh_assert_less (global_dof_number, current_local_solution->size());
197 
198  return (*current_local_solution)(global_dof_number);
199 }
UniquePtr< NumericVector< Number > > current_local_solution
All the values I need to compute my contribution to the simulation at hand.
Definition: system.h:1535
UniquePtr< DofMap > _dof_map
Data structure describing the relationship between nodes, variables, etc...
Definition: system.h:1865
void libMesh::System::deactivate ( )
inherited

Deactivates the system.

Only active systems are solved.

Definition at line 2062 of file system.h.

References libMesh::System::_active.

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

2063 {
2064  _active = false;
2065 }
bool _active
Flag stating if the system is active or not.
Definition: system.h:1908
void libMesh::System::disable_cache ( )
virtualinherited

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 2256 of file system.h.

References libMesh::System::assemble_before_solve.

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

2256 { 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:1477
void libMesh::ReferenceCounter::disable_print_counter_info ( )
staticinherited

Definition at line 107 of file reference_counter.C.

References libMesh::ReferenceCounter::_enable_print_counter.

Referenced by libMesh::LibMeshInit::LibMeshInit(), and libMesh::ReferenceCounter::n_objects().

108 {
109  _enable_print_counter = false;
110  return;
111 }
static bool _enable_print_counter
Flag to control whether reference count information is printed when print_info is called...
void libMesh::ReferenceCounter::enable_print_counter_info ( )
staticinherited

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

Definition at line 101 of file reference_counter.C.

References libMesh::ReferenceCounter::_enable_print_counter.

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

102 {
103  _enable_print_counter = true;
104  return;
105 }
static bool _enable_print_counter
Flag to control whether reference count information is printed when print_info is called...
void libMesh::System::forward_qoi_parameter_sensitivity ( const QoISet qoi_indices,
const ParameterVector parameters,
SensitivityData sensitivities 
)
virtualinherited

Solves for parameter sensitivities using the forward method.

This method is only implemented in some derived classes.

Reimplemented in libMesh::ImplicitSystem.

Definition at line 2300 of file system.h.

Referenced by libMesh::System::qoi_parameter_sensitivity(), and libMesh::System::set_adjoint_already_solved().

2303 {
2304  libmesh_not_implemented();
2305 }
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 1051 of file system.C.

References libMesh::System::get_vector().

Referenced by libMesh::ImplicitSystem::adjoint_solve(), libMesh::ImplicitSystem::forward_qoi_parameter_sensitivity(), libMesh::System::project_solution_on_reinit(), libMesh::ImplicitSystem::qoi_parameter_hessian(), libMesh::ImplicitSystem::qoi_parameter_hessian_vector_product(), and libMesh::ImplicitSystem::weighted_sensitivity_adjoint_solve().

1052 {
1053  std::ostringstream adjoint_rhs_name;
1054  adjoint_rhs_name << "adjoint_rhs" << i;
1055 
1056  return this->get_vector(adjoint_rhs_name.str());
1057 }
const NumericVector< Number > & get_vector(const std::string &vec_name) const
Definition: system.C:794
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 1061 of file system.C.

References libMesh::System::get_vector().

1062 {
1063  std::ostringstream adjoint_rhs_name;
1064  adjoint_rhs_name << "adjoint_rhs" << i;
1065 
1066  return this->get_vector(adjoint_rhs_name.str());
1067 }
const NumericVector< Number > & get_vector(const std::string &vec_name) const
Definition: system.C:794
NumericVector< Number > & libMesh::System::get_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.

Definition at line 989 of file system.C.

References libMesh::System::get_vector().

Referenced by libMesh::UniformRefinementEstimator::_estimate_error(), libMesh::ImplicitSystem::adjoint_solve(), libMesh::AdjointRefinementEstimator::estimate_error(), libMesh::AdjointResidualErrorEstimator::estimate_error(), HeatSystem::init_context(), main(), HeatSystem::perturb_accumulate_residuals(), libMesh::System::project_solution_on_reinit(), libMesh::ImplicitSystem::qoi_parameter_hessian(), libMesh::ImplicitSystem::qoi_parameter_hessian_vector_product(), and libMesh::ImplicitSystem::weighted_sensitivity_adjoint_solve().

990 {
991  std::ostringstream adjoint_name;
992  adjoint_name << "adjoint_solution" << i;
993 
994  return this->get_vector(adjoint_name.str());
995 }
const NumericVector< Number > & get_vector(const std::string &vec_name) const
Definition: system.C:794
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 999 of file system.C.

References libMesh::System::get_vector().

1000 {
1001  std::ostringstream adjoint_name;
1002  adjoint_name << "adjoint_solution" << i;
1003 
1004  return this->get_vector(adjoint_name.str());
1005 }
const NumericVector< Number > & get_vector(const std::string &vec_name) const
Definition: system.C:794
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 1278 of file system.C.

References libMesh::System::_variable_numbers, and libMesh::System::n_vars().

Referenced by libMesh::RBEIMConstruction::initialize_rb_construction(), libMesh::System::project_solution_on_reinit(), MeshfunctionDFEM::test_mesh_function_dfem(), MeshfunctionDFEM::test_mesh_function_dfem_grad(), and SystemsTest::testProjectCubeWithMeshFunction().

1279 {
1280  all_variable_numbers.resize(n_vars());
1281 
1282  // Make sure the variable exists
1283  std::map<std::string, unsigned short int>::const_iterator
1284  it = _variable_numbers.begin();
1285  std::map<std::string, unsigned short int>::const_iterator
1286  it_end = _variable_numbers.end();
1287 
1288  unsigned int count = 0;
1289  for ( ; it != it_end; ++it)
1290  {
1291  all_variable_numbers[count] = it->second;
1292  count++;
1293  }
1294 }
std::map< std::string, unsigned short int > _variable_numbers
The variable numbers corresponding to user-specified names, useful for name-based lookups...
Definition: system.h:1903
unsigned int n_vars() const
Definition: system.h:2086
const DofMap & libMesh::System::get_dof_map ( ) const
inherited
Returns
A constant reference to this system's _dof_map.

Definition at line 2030 of file system.h.

References libMesh::System::_dof_map.

Referenced by libMesh::__libmesh_petsc_diff_solver_residual(), libMesh::__libmesh_petsc_snes_postcheck(), libMesh::ExactSolution::_compute_error(), libMesh::UniformRefinementEstimator::_estimate_error(), libMesh::DifferentiableSystem::add_dot_var_dirichlet_bcs(), libMesh::HPCoarsenTest::add_projection(), libMesh::RBConstruction::add_scaled_matrix_and_vector(), libMesh::UnsteadySolver::adjoint_advance_timestep(), libMesh::ImplicitSystem::adjoint_solve(), libMesh::NewmarkSolver::advance_timestep(), libMesh::UnsteadySolver::advance_timestep(), libMesh::EquationSystems::allgather(), libMesh::TransientRBConstruction::allocate_data_structures(), libMesh::RBConstruction::allocate_data_structures(), assemble(), LinearElasticity::assemble(), assemble_1D(), AssembleOptimization::assemble_A_and_F(), assemble_and_solve(), assemble_biharmonic(), assemble_elasticity(), assemble_ellipticdg(), assemble_helmholtz(), assemble_laplace(), assemble_mass(), assemble_matrices(), assemble_poisson(), assemble_shell(), assemble_stokes(), assemble_wave(), libMesh::EquationSystems::build_discontinuous_solution_vector(), libMesh::EquationSystems::build_parallel_solution_vector(), libMesh::System::calculate_norm(), compute_stresses(), LinearElasticityWithContact::compute_stresses(), LinearElasticity::compute_stresses(), LargeDeformationElasticity::compute_stresses(), libMesh::Problem_Interface::computeF(), libMesh::Problem_Interface::computeJacobian(), libMesh::Problem_Interface::computePreconditioner(), libMesh::DofMap::constrain_nothing(), DMCreateDomainDecomposition_libMesh(), DMCreateFieldDecomposition_libMesh(), DMlibMeshFunction(), DMlibMeshJacobian(), DMlibMeshSetSystem_libMesh(), libMesh::RBEIMConstruction::enrich_RB_space(), libMesh::JumpErrorEstimator::estimate_error(), libMesh::AdjointRefinementEstimator::estimate_error(), libMesh::ExactErrorEstimator::estimate_error(), libMesh::RBEIMAssembly::evaluate_basis_function(), libMesh::System::get_info(), libMesh::EquationSystems::get_solution(), libMesh::SystemSubsetBySubdomain::init(), libMesh::SecondOrderUnsteadySolver::init_data(), libMesh::UnsteadySolver::init_data(), HeatSystem::init_data(), libMesh::RBEIMConstruction::init_dof_map_between_systems(), libMesh::EigenSystem::init_matrices(), libMesh::ImplicitSystem::init_matrices(), libMesh::CondensedEigenSystem::initialize_condensed_dofs(), libMesh::OptimizationSystem::initialize_equality_constraints_storage(), libMesh::RBEIMAssembly::initialize_fe(), libMesh::OptimizationSystem::initialize_inequality_constraints_storage(), libMesh::RBEIMConstruction::initialize_rb_construction(), LaplaceYoung::jacobian(), LargeDeformationElasticity::jacobian(), libMesh::System::local_dof_indices(), AssembleOptimization::lower_and_upper_bounds(), main(), libMesh::DofMap::max_constraint_error(), LinearElasticityWithContact::move_mesh(), libMesh::DGFEMContext::neighbor_side_fe_reinit(), libMesh::UnsteadySolver::old_nonlinear_solution(), libMesh::SecondOrderUnsteadySolver::old_solution_accel(), libMesh::SecondOrderUnsteadySolver::old_solution_rate(), libMesh::GenericProjector< FFunctor, GFunctor, FValue, ProjectionAction >::operator()(), libMesh::BuildProjectionList::operator()(), libMesh::BoundaryProjectSolution::operator()(), libMesh::RBSCMConstruction::perform_SCM_greedy(), 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::RBEIMAssembly::RBEIMAssembly(), libMesh::RBEIMConstruction::RBEIMConstruction(), libMesh::System::re_update(), libMesh::SecondOrderUnsteadySolver::reinit(), libMesh::UnsteadySolver::reinit(), libMesh::ImplicitSystem::reinit(), libMesh::EigenSystem::reinit(), libMesh::EquationSystems::reinit(), libMesh::System::reinit_constraints(), LaplaceYoung::residual(), LargeDeformationElasticity::residual(), LinearElasticityWithContact::residual_and_jacobian(), libMesh::UnsteadySolver::retrieve_timestep(), libMesh::HPCoarsenTest::select_refinement(), libMesh::ImplicitSystem::sensitivity_solve(), libMesh::RBConstruction::set_context_solution_vec(), set_system_parameters(), FETest< order, family, elem_type >::setUp(), SolidSystem::side_time_derivative(), libMesh::NewtonSolver::solve(), libMesh::PetscDiffSolver::solve(), libMesh::PetscNonlinearSolver< T >::solve(), libMesh::System::system_type(), MeshfunctionDFEM::test_mesh_function_dfem(), MeshfunctionDFEM::test_mesh_function_dfem_grad(), DefaultCouplingTest::testCoupling(), PointNeighborCouplingTest::testCoupling(), DofMapTest::testDofOwner(), SystemsTest::testProjectCubeWithMeshFunction(), BoundaryInfoTest::testShellFaceConstraints(), libMesh::MeshFunctionSolutionTransfer::transfer(), libMesh::BoundaryVolumeSolutionTransfer::transfer_boundary_volume(), libMesh::RBEIMConstruction::truth_solve(), libMesh::RBEIMConstruction::update_RB_system_matrices(), libMesh::ImplicitSystem::weighted_sensitivity_adjoint_solve(), libMesh::ImplicitSystem::weighted_sensitivity_solve(), libMesh::EnsightIO::write_scalar_ascii(), libMesh::EnsightIO::write_vector_ascii(), and libMesh::RBConstruction::zero_constrained_dofs_on_vector().

2031 {
2032  return *_dof_map;
2033 }
UniquePtr< DofMap > _dof_map
Data structure describing the relationship between nodes, variables, etc...
Definition: system.h:1865
DofMap & libMesh::System::get_dof_map ( )
inherited
Returns
A writable reference to this system's _dof_map.

Definition at line 2038 of file system.h.

References libMesh::System::_dof_map.

2039 {
2040  return *_dof_map;
2041 }
UniquePtr< DofMap > _dof_map
Data structure describing the relationship between nodes, variables, etc...
Definition: system.h:1865
const EquationSystems& libMesh::System::get_equation_systems ( ) const
inherited
Returns
A constant reference to this system's parent EquationSystems object.

Definition at line 712 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(), LinearElasticityWithContact::compute_stresses(), SolidSystem::element_time_derivative(), libMesh::AdjointRefinementEstimator::estimate_error(), libMesh::AdjointResidualErrorEstimator::estimate_error(), libMesh::ExactErrorEstimator::find_squared_element_error(), libMesh::RBEIMConstruction::get_explicit_system(), libMesh::ImplicitSystem::get_linear_solve_parameters(), SolidSystem::init_data(), HeatSystem::init_data(), libMesh::FrequencySystem::init_data(), libMesh::RBEIMConstruction::init_data(), libMesh::RBEIMConstruction::initialize_rb_construction(), LaplaceYoung::jacobian(), libMesh::RBSCMConstruction::load_matrix_B(), LinearElasticityWithContact::move_mesh(), libMesh::FrequencySystem::n_frequencies(), libMesh::RBSCMConstruction::perform_SCM_greedy(), libMesh::RBEIMConstruction::plot_parametrized_functions_in_training_set(), libMesh::System::point_value(), LaplaceYoung::residual(), LinearElasticityWithContact::residual_and_jacobian(), 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(), libMesh::EigenSystem::solve(), libMesh::CondensedEigenSystem::solve(), libMesh::FrequencySystem::solve(), libMesh::LinearImplicitSystem::solve(), libMesh::RBConstruction::solve_for_matrix_and_rhs(), libMesh::MeshFunctionSolutionTransfer::transfer(), libMesh::DirectSolutionTransfer::transfer(), libMesh::MeshfreeSolutionTransfer::transfer(), libMesh::DTKSolutionTransfer::transfer(), libMesh::TransientRBConstruction::truth_solve(), libMesh::RBEIMConstruction::truth_solve(), libMesh::RBConstruction::truth_solve(), and libMesh::WrappedFunction< Output >::WrappedFunction().

712 { return _equation_systems; }
EquationSystems & _equation_systems
Constant reference to the EquationSystems object used for the simulation.
Definition: system.h:1871
EquationSystems& libMesh::System::get_equation_systems ( )
inherited
Returns
A reference to this system's parent EquationSystems object.

Definition at line 717 of file system.h.

References libMesh::System::_equation_systems, libMesh::System::activate(), libMesh::System::active(), libMesh::System::deactivate(), and libMesh::System::set_basic_system_only().

717 { return _equation_systems; }
EquationSystems & _equation_systems
Constant reference to the EquationSystems object used for the simulation.
Definition: system.h:1871
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 (Counts::iterator it = _counts.begin();
59  it != _counts.end(); ++it)
60  {
61  const std::string name(it->first);
62  const unsigned int creations = it->second.first;
63  const unsigned int destructions = it->second.second;
64 
65  oss << "| " << name << " reference count information:\n"
66  << "| Creations: " << creations << '\n'
67  << "| Destructions: " << destructions << '\n';
68  }
69 
70  oss << " ---------------------------------------------------------------------------- \n";
71 
72  return oss.str();
73 
74 #else
75 
76  return "";
77 
78 #endif
79 }
std::string name(const ElemQuality q)
This function returns a string containing some name for q.
Definition: elem_quality.C:39
static Counts _counts
Actually holds the data.
std::string libMesh::System::get_info ( ) const
inherited
Returns
A string containing information about the system.

Definition at line 1676 of file system.C.

References libMesh::FEType::family, libMesh::System::get_dof_map(), libMesh::DofMap::get_info(), libMesh::FEType::inf_map, 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().

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

1677 {
1678  std::ostringstream oss;
1679 
1680 
1681  const std::string & sys_name = this->name();
1682 
1683  oss << " System #" << this->number() << ", \"" << sys_name << "\"\n"
1684  << " Type \"" << this->system_type() << "\"\n"
1685  << " Variables=";
1686 
1687  for (unsigned int vg=0; vg<this->n_variable_groups(); vg++)
1688  {
1689  const VariableGroup & vg_description (this->variable_group(vg));
1690 
1691  if (vg_description.n_variables() > 1) oss << "{ ";
1692  for (unsigned int vn=0; vn<vg_description.n_variables(); vn++)
1693  oss << "\"" << vg_description.name(vn) << "\" ";
1694  if (vg_description.n_variables() > 1) oss << "} ";
1695  }
1696 
1697  oss << '\n';
1698 
1699  oss << " Finite Element Types=";
1700 #ifndef LIBMESH_ENABLE_INFINITE_ELEMENTS
1701  for (unsigned int vg=0; vg<this->n_variable_groups(); vg++)
1702  oss << "\""
1703  << Utility::enum_to_string<FEFamily>(this->get_dof_map().variable_group(vg).type().family)
1704  << "\" ";
1705 #else
1706  for (unsigned int vg=0; vg<this->n_variable_groups(); vg++)
1707  {
1708  oss << "\""
1709  << Utility::enum_to_string<FEFamily>(this->get_dof_map().variable_group(vg).type().family)
1710  << "\", \""
1711  << Utility::enum_to_string<FEFamily>(this->get_dof_map().variable_group(vg).type().radial_family)
1712  << "\" ";
1713  }
1714 
1715  oss << '\n' << " Infinite Element Mapping=";
1716  for (unsigned int vg=0; vg<this->n_variable_groups(); vg++)
1717  oss << "\""
1718  << Utility::enum_to_string<InfMapType>(this->get_dof_map().variable_group(vg).type().inf_map)
1719  << "\" ";
1720 #endif
1721 
1722  oss << '\n';
1723 
1724  oss << " Approximation Orders=";
1725  for (unsigned int vg=0; vg<this->n_variable_groups(); vg++)
1726  {
1727 #ifndef LIBMESH_ENABLE_INFINITE_ELEMENTS
1728  oss << "\""
1729  << Utility::enum_to_string<Order>(this->get_dof_map().variable_group(vg).type().order)
1730  << "\" ";
1731 #else
1732  oss << "\""
1733  << Utility::enum_to_string<Order>(this->get_dof_map().variable_group(vg).type().order)
1734  << "\", \""
1735  << Utility::enum_to_string<Order>(this->get_dof_map().variable_group(vg).type().radial_order)
1736  << "\" ";
1737 #endif
1738  }
1739 
1740  oss << '\n';
1741 
1742  oss << " n_dofs()=" << this->n_dofs() << '\n';
1743  oss << " n_local_dofs()=" << this->n_local_dofs() << '\n';
1744 #ifdef LIBMESH_ENABLE_CONSTRAINTS
1745  oss << " n_constrained_dofs()=" << this->n_constrained_dofs() << '\n';
1746  oss << " n_local_constrained_dofs()=" << this->n_local_constrained_dofs() << '\n';
1747 #endif
1748 
1749  oss << " " << "n_vectors()=" << this->n_vectors() << '\n';
1750  oss << " " << "n_matrices()=" << this->n_matrices() << '\n';
1751  // oss << " " << "n_additional_matrices()=" << this->n_additional_matrices() << '\n';
1752 
1753  oss << this->get_dof_map().get_info();
1754 
1755  return oss.str();
1756 }
FEFamily family
The type of finite element.
Definition: fe_type.h:203
dof_id_type n_constrained_dofs() const
Definition: system.C:155
const FEType & type() const
Definition: variable.h:119
std::string get_info() const
Gets summary info about the sparsity bandwidth and constraints.
Definition: dof_map.C:2635
OrderWrapper radial_order
The approximation order in the base of the infinite element.
Definition: fe_type.h:236
OrderWrapper order
The approximation order of the element.
Definition: fe_type.h:197
const VariableGroup & variable_group(unsigned int vg) const
Return a constant reference to VariableGroup vg.
Definition: system.h:2124
const VariableGroup & variable_group(const unsigned int c) const
Definition: dof_map.h:1657
const std::string & name() const
Definition: system.h:1998
unsigned int n_variable_groups() const
Definition: system.h:2094
const DofMap & get_dof_map() const
Definition: system.h:2030
InfMapType inf_map
The coordinate mapping type of the infinite element.
Definition: fe_type.h:257
virtual unsigned int n_matrices() const
Definition: system.h:2220
FEFamily radial_family
For InfFE, family contains the radial shape family, while base_family contains the approximation type...
Definition: fe_type.h:249
dof_id_type n_local_dofs() const
Definition: system.C:185
virtual std::string system_type() const
Definition: system.h:471
dof_id_type n_local_constrained_dofs() const
Definition: system.C:170
unsigned int number() const
Definition: system.h:2006
dof_id_type n_dofs() const
Definition: system.C:148
unsigned int n_vectors() const
Definition: system.h:2214
const MeshBase & libMesh::System::get_mesh ( ) const
inherited
Returns
A constant reference to this systems's _mesh.

Definition at line 2014 of file system.h.

References libMesh::System::_mesh.

Referenced by libMesh::ExactSolution::_compute_error(), LinearElasticityWithContact::add_contact_edge_elements(), libMesh::HPCoarsenTest::add_projection(), libMesh::RBConstruction::add_scaled_matrix_and_vector(), AssembleOptimization::assemble_A_and_F(), libMesh::FEMSystem::assemble_qoi(), libMesh::FEMSystem::assemble_qoi_derivative(), libMesh::FEMSystem::assembly(), AssemblyA0::boundary_assembly(), AssemblyF0::boundary_assembly(), AssemblyA1::boundary_assembly(), AssemblyF1::boundary_assembly(), AssemblyF2::boundary_assembly(), AssemblyA2::boundary_assembly(), libMesh::System::calculate_norm(), LinearElasticityWithContact::compute_stresses(), DMCreateDomainDecomposition_libMesh(), DMCreateFieldDecomposition_libMesh(), DMlibMeshSetSystem_libMesh(), SolidSystem::element_time_derivative(), libMesh::RBEIMConstruction::enrich_RB_space(), libMesh::WeightedPatchRecoveryErrorEstimator::estimate_error(), libMesh::JumpErrorEstimator::estimate_error(), libMesh::PatchRecoveryErrorEstimator::estimate_error(), libMesh::AdjointResidualErrorEstimator::estimate_error(), libMesh::ExactErrorEstimator::estimate_error(), LinearElasticityWithContact::get_least_and_max_gap_function(), libMesh::SystemSubsetBySubdomain::init(), SolidSystem::init_data(), libMesh::System::init_data(), libMesh::RBEIMConstruction::init_dof_map_between_systems(), libMesh::EigenSystem::init_matrices(), libMesh::ImplicitSystem::init_matrices(), LinearElasticityWithContact::initialize_contact_load_paths(), libMesh::RBEIMAssembly::initialize_fe(), libMesh::System::local_dof_indices(), libMesh::DofMap::max_constraint_error(), libMesh::FEMSystem::mesh_position_get(), libMesh::FEMSystem::mesh_position_set(), LinearElasticityWithContact::move_mesh(), libMesh::BoundaryProjectSolution::operator()(), libMesh::petsc_auto_fieldsplit(), libMesh::RBEIMConstruction::plot_parametrized_functions_in_training_set(), libMesh::System::point_gradient(), libMesh::System::point_hessian(), libMesh::System::point_value(), libMesh::FEMSystem::postprocess(), libMesh::RBEvaluation::read_in_vectors_from_multiple_files(), libMesh::ImplicitSystem::reinit(), libMesh::EigenSystem::reinit(), LinearElasticityWithContact::residual_and_jacobian(), SolidSystem::save_initial_mesh(), libMesh::HPSingularity::select_refinement(), libMesh::HPCoarsenTest::select_refinement(), SolidSystem::side_time_derivative(), libMesh::System::system_type(), libMesh::MeshFunctionSolutionTransfer::transfer(), libMesh::BoundaryVolumeSolutionTransfer::transfer(), libMesh::BoundaryVolumeSolutionTransfer::transfer_boundary_volume(), libMesh::BoundaryVolumeSolutionTransfer::transfer_volume_boundary(), libMesh::TransientRBConstruction::truth_solve(), libMesh::RBEIMConstruction::truth_solve(), libMesh::RBConstruction::truth_solve(), libMesh::RBEvaluation::write_out_vectors(), and libMesh::System::zero_variable().

2015 {
2016  return _mesh;
2017 }
MeshBase & _mesh
Constant reference to the mesh data structure used for the simulation.
Definition: system.h:1877
MeshBase & libMesh::System::get_mesh ( )
inherited
Returns
A reference to this systems's _mesh.

Definition at line 2022 of file system.h.

References libMesh::System::_mesh.

2023 {
2024  return _mesh;
2025 }
MeshBase & _mesh
Constant reference to the mesh data structure used for the simulation.
Definition: system.h:1877
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 1081 of file system.C.

References libMesh::System::get_vector().

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

1082 {
1083  std::ostringstream sensitivity_rhs_name;
1084  sensitivity_rhs_name << "sensitivity_rhs" << i;
1085 
1086  return this->get_vector(sensitivity_rhs_name.str());
1087 }
const NumericVector< Number > & get_vector(const std::string &vec_name) const
Definition: system.C:794
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 1091 of file system.C.

References libMesh::System::get_vector().

1092 {
1093  std::ostringstream sensitivity_rhs_name;
1094  sensitivity_rhs_name << "sensitivity_rhs" << i;
1095 
1096  return this->get_vector(sensitivity_rhs_name.str());
1097 }
const NumericVector< Number > & get_vector(const std::string &vec_name) const
Definition: system.C:794
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 936 of file system.C.

References libMesh::System::get_vector().

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

937 {
938  std::ostringstream sensitivity_name;
939  sensitivity_name << "sensitivity_solution" << i;
940 
941  return this->get_vector(sensitivity_name.str());
942 }
const NumericVector< Number > & get_vector(const std::string &vec_name) const
Definition: system.C:794
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 946 of file system.C.

References libMesh::System::get_vector().

947 {
948  std::ostringstream sensitivity_name;
949  sensitivity_name << "sensitivity_solution" << i;
950 
951  return this->get_vector(sensitivity_name.str());
952 }
const NumericVector< Number > & get_vector(const std::string &vec_name) const
Definition: system.C:794
const NumericVector< Number > & libMesh::System::get_vector ( const std::string &  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 794 of file system.C.

References libMesh::System::_vectors.

Referenced by libMesh::UniformRefinementEstimator::_estimate_error(), add_M_C_K_helmholtz(), 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::System::project_solution_on_reinit(), libMesh::SecondOrderUnsteadySolver::reinit(), libMesh::UnsteadySolver::reinit(), libMesh::MemorySolutionHistory::retrieve(), libMesh::UnsteadySolver::retrieve_timestep(), libMesh::TwostepTimeSolver::solve(), libMesh::TaoOptimizationSolver< T >::solve(), libMesh::NloptOptimizationSolver< T >::solve(), libMesh::FrequencySystem::solve(), libMesh::NewmarkSystem::update_rhs(), and libMesh::NewmarkSystem::update_u_v_a().

795 {
796  // Make sure the vector exists
797  const_vectors_iterator pos = _vectors.find(vec_name);
798 
799  if (pos == _vectors.end())
800  libmesh_error_msg("ERROR: vector " << vec_name << " does not exist in this system!");
801 
802  return *(pos->second);
803 }
std::map< std::string, NumericVector< Number > * >::const_iterator const_vectors_iterator
Definition: system.h:749
std::map< std::string, NumericVector< Number > * > _vectors
Some systems need an arbitrary number of vectors.
Definition: system.h:1916
NumericVector< Number > & libMesh::System::get_vector ( const std::string &  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 807 of file system.C.

References libMesh::System::_vectors.

808 {
809  // Make sure the vector exists
810  vectors_iterator pos = _vectors.find(vec_name);
811 
812  if (pos == _vectors.end())
813  libmesh_error_msg("ERROR: vector " << vec_name << " does not exist in this system!");
814 
815  return *(pos->second);
816 }
std::map< std::string, NumericVector< Number > * >::iterator vectors_iterator
Vector iterator typedefs.
Definition: system.h:748
std::map< std::string, NumericVector< Number > * > _vectors
Some systems need an arbitrary number of vectors.
Definition: system.h:1916
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 820 of file system.C.

References libMesh::libmesh_assert(), libMesh::System::vectors_begin(), and libMesh::System::vectors_end().

821 {
824  unsigned int num = 0;
825  while ((num<vec_num) && (v!=v_end))
826  {
827  num++;
828  ++v;
829  }
830  libmesh_assert (v != v_end);
831  return *(v->second);
832 }
vectors_iterator vectors_end()
End of vectors container.
Definition: system.h:2238
std::map< std::string, NumericVector< Number > * >::const_iterator const_vectors_iterator
Definition: system.h:749
vectors_iterator vectors_begin()
Beginning of vectors container.
Definition: system.h:2226
libmesh_assert(j)
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 836 of file system.C.

References libMesh::libmesh_assert(), libMesh::System::vectors_begin(), and libMesh::System::vectors_end().

837 {
839  vectors_iterator v_end = vectors_end();
840  unsigned int num = 0;
841  while ((num<vec_num) && (v!=v_end))
842  {
843  num++;
844  ++v;
845  }
846  libmesh_assert (v != v_end);
847  return *(v->second);
848 }
vectors_iterator vectors_end()
End of vectors container.
Definition: system.h:2238
vectors_iterator vectors_begin()
Beginning of vectors container.
Definition: system.h:2226
libmesh_assert(j)
std::map< std::string, NumericVector< Number > * >::iterator vectors_iterator
Vector iterator typedefs.
Definition: system.h:748
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 1021 of file system.C.

References libMesh::System::get_vector().

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

1022 {
1023  std::ostringstream adjoint_name;
1024  adjoint_name << "weighted_sensitivity_adjoint_solution" << i;
1025 
1026  return this->get_vector(adjoint_name.str());
1027 }
const NumericVector< Number > & get_vector(const std::string &vec_name) const
Definition: system.C:794
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 1031 of file system.C.

References libMesh::System::get_vector().

1032 {
1033  std::ostringstream adjoint_name;
1034  adjoint_name << "weighted_sensitivity_adjoint_solution" << i;
1035 
1036  return this->get_vector(adjoint_name.str());
1037 }
const NumericVector< Number > & get_vector(const std::string &vec_name) const
Definition: system.C:794
NumericVector< Number > & libMesh::System::get_weighted_sensitivity_solution ( )
inherited
Returns
A reference to the solution of the last weighted sensitivity solve

Definition at line 963 of file system.C.

References libMesh::System::get_vector().

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

964 {
965  return this->get_vector("weighted_sensitivity_solution");
966 }
const NumericVector< Number > & get_vector(const std::string &vec_name) const
Definition: system.C:794
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 970 of file system.C.

References libMesh::System::get_vector().

971 {
972  return this->get_vector("weighted_sensitivity_solution");
973 }
const NumericVector< Number > & get_vector(const std::string &vec_name) const
Definition: system.C:794
bool libMesh::System::has_variable ( const std::string &  var) const
inherited
Returns
true if a variable named var exists in this System

Definition at line 1256 of file system.C.

References libMesh::System::_variable_numbers.

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

1257 {
1258  return _variable_numbers.count(var);
1259 }
std::map< std::string, unsigned short int > _variable_numbers
The variable numbers corresponding to user-specified names, useful for name-based lookups...
Definition: system.h:1903
bool libMesh::System::have_vector ( const std::string &  vec_name) const
inherited
Returns
true if this System has a vector associated with the given name, false otherwise.

Definition at line 2206 of file system.h.

References libMesh::System::_vectors.

Referenced by libMesh::System::add_vector(), and libMesh::System::project_solution_on_reinit().

2207 {
2208  return (_vectors.count(vec_name));
2209 }
std::map< std::string, NumericVector< Number > * > _vectors
Some systems need an arbitrary number of vectors.
Definition: system.h:1916
bool& libMesh::System::hide_output ( )
inherited
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 1657 of file system.h.

References libMesh::System::_hide_output, libMesh::System::discrete_var_norm(), end, libMesh::System::init_data(), libMesh::invalid_uint, libMesh::ReferenceCounter::n_objects(), libMesh::System::operator=(), libMesh::System::project_vector(), libMesh::System::read_SCALAR_dofs(), libMesh::System::read_serialized_blocked_dof_objects(), libMesh::System::read_serialized_vector(), libMesh::Real, and libMesh::System::System().

1657 { 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:1990
bool libMesh::System::identify_variable_groups ( ) const
inherited
Returns
true when VariableGroup structures should be automatically identified, false otherwise.

Definition at line 2182 of file system.h.

References libMesh::System::_identify_variable_groups.

Referenced by libMesh::System::add_variable(), and libMesh::System::project_solution_on_reinit().

2183 {
2185 }
bool _identify_variable_groups
true when VariableGroup structures should be automatically identified, false otherwise.
Definition: system.h:1958
void libMesh::System::identify_variable_groups ( const bool  ivg)
inherited

Toggle automatic VariableGroup identification.

Definition at line 2190 of file system.h.

References libMesh::System::_identify_variable_groups.

2191 {
2193 }
bool _identify_variable_groups
true when VariableGroup structures should be automatically identified, false otherwise.
Definition: system.h:1958
void libMesh::ReferenceCounter::increment_constructor_count ( const std::string &  name)
protectedinherited

Increments the construction counter.

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

Definition at line 185 of file reference_counter.h.

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

Referenced by libMesh::ReferenceCounter::n_objects(), and libMesh::ReferenceCountedObject< RBParametrized >::ReferenceCountedObject().

186 {
187  Threads::spin_mutex::scoped_lock lock(Threads::spin_mtx);
188  std::pair<unsigned int, unsigned int> & p = _counts[name];
189 
190  p.first++;
191 }
std::string name(const ElemQuality q)
This function returns a string containing some name for q.
Definition: elem_quality.C:39
spin_mutex spin_mtx
A convenient spin mutex object which can be used for obtaining locks.
Definition: threads.C:29
static Counts _counts
Actually holds the data.
void libMesh::ReferenceCounter::increment_destructor_count ( const std::string &  name)
protectedinherited

Increments the destruction counter.

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

Definition at line 198 of file reference_counter.h.

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

Referenced by libMesh::ReferenceCounter::n_objects(), and libMesh::ReferenceCountedObject< RBParametrized >::~ReferenceCountedObject().

199 {
200  Threads::spin_mutex::scoped_lock lock(Threads::spin_mtx);
201  std::pair<unsigned int, unsigned int> & p = _counts[name];
202 
203  p.second++;
204 }
std::string name(const ElemQuality q)
This function returns a string containing some name for q.
Definition: elem_quality.C:39
spin_mutex spin_mtx
A convenient spin mutex object which can be used for obtaining locks.
Definition: threads.C:29
static Counts _counts
Actually holds the data.
void libMesh::System::init ( )
inherited

Initializes degrees of freedom on the current mesh.

Sets the

Definition at line 235 of file system.C.

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

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

236 {
237  // Calling init() twice on the same system currently works evil
238  // magic, whether done directly or via EquationSystems::read()
239  libmesh_assert(!this->is_initialized());
240 
241  // First initialize any required data:
242  // either only the basic System data
243  if (_basic_system_only)
245  // or all the derived class' data too
246  else
247  this->init_data();
248 
249  // If no variables have been added to this system
250  // don't do anything
251  if (!this->n_vars())
252  return;
253 
254  // Then call the user-provided initialization function
255  this->user_initialization();
256 }
bool _basic_system_only
Holds true if the components of more advanced system types (e.g.
Definition: system.h:1946
virtual void init_data()
Initializes the data for the system.
Definition: system.C:260
virtual void user_initialization()
Calls user&#39;s attached initialization function, or is overridden by the user in derived classes...
Definition: system.C:1936
libmesh_assert(j)
bool is_initialized()
Definition: system.h:2070
unsigned int n_vars() const
Definition: system.h:2086
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::ImplicitSystem, libMesh::ContinuationSystem, libMesh::RBEIMConstruction, libMesh::FEMSystem, libMesh::OptimizationSystem, libMesh::FrequencySystem, libMesh::EigenSystem, SecondOrderScalarSystemSecondOrderTimeSolverBase, libMesh::RBConstructionBase< LinearImplicitSystem >, libMesh::RBConstructionBase< CondensedEigenSystem >, SimpleRBConstruction, SimpleRBConstruction, SimpleRBConstruction, SimpleRBConstruction, SimpleRBConstruction, FirstOrderScalarSystemBase, libMesh::LinearImplicitSystem, HeatSystem, SimpleRBConstruction, ElasticityRBConstruction, CoupledSystem, ElasticitySystem, LaplaceSystem, CurlCurlSystem, LaplaceSystem, PoissonSystem, LaplaceSystem, LaplaceSystem, CurlCurlSystem, L2System, SolidSystem, NavierSystem, and HeatSystem.

Definition at line 260 of file system.C.

References libMesh::System::_dof_map, libMesh::System::_is_initialized, libMesh::System::_vector_types, libMesh::System::_vectors, libMesh::System::current_local_solution, libMesh::System::get_mesh(), libMesh::GHOSTED, mesh, libMesh::System::n_dofs(), libMesh::System::n_local_dofs(), libMesh::System::n_variable_groups(), libMesh::PARALLEL, libMesh::System::reinit_constraints(), libMesh::SERIAL, and libMesh::System::solution.

Referenced by libMesh::System::hide_output(), libMesh::System::init(), libMesh::EigenSystem::init_data(), and libMesh::ImplicitSystem::init_data().

261 {
262  MeshBase & mesh = this->get_mesh();
263 
264  // Add all variable groups to our underlying DofMap
265  for (unsigned int vg=0; vg<this->n_variable_groups(); vg++)
266  _dof_map->add_variable_group(this->variable_group(vg));
267 
268  // Distribute the degrees of freedom on the mesh
269  _dof_map->distribute_dofs (mesh);
270 
271  // Recreate any user or internal constraints
272  this->reinit_constraints();
273 
274  // And clean up the send_list before we first use it
275  _dof_map->prepare_send_list();
276 
277  // Resize the solution conformal to the current mesh
278  solution->init (this->n_dofs(), this->n_local_dofs(), false, PARALLEL);
279 
280  // Resize the current_local_solution for the current mesh
281 #ifdef LIBMESH_ENABLE_GHOSTED
282  current_local_solution->init (this->n_dofs(), this->n_local_dofs(),
283  _dof_map->get_send_list(), false,
284  GHOSTED);
285 #else
286  current_local_solution->init (this->n_dofs(), false, SERIAL);
287 #endif
288 
289  // from now on, adding additional vectors or variables can't be done
290  // without immediately initializing them
291  _is_initialized = true;
292 
293  // initialize & zero other vectors, if necessary
294  for (vectors_iterator pos = _vectors.begin(); pos != _vectors.end(); ++pos)
295  {
296  ParallelType type = _vector_types[pos->first];
297 
298  if (type == GHOSTED)
299  {
300 #ifdef LIBMESH_ENABLE_GHOSTED
301  pos->second->init (this->n_dofs(), this->n_local_dofs(),
302  _dof_map->get_send_list(), false,
303  GHOSTED);
304 #else
305  libmesh_error_msg("Cannot initialize ghosted vectors when they are not enabled.");
306 #endif
307  }
308  else if (type == SERIAL)
309  {
310  pos->second->init (this->n_dofs(), false, type);
311  }
312  else
313  {
314  libmesh_assert_equal_to(type, PARALLEL);
315  pos->second->init (this->n_dofs(), this->n_local_dofs(), false, type);
316  }
317  }
318 }
std::map< std::string, ParallelType > _vector_types
Holds the type of a vector.
Definition: system.h:1933
bool _is_initialized
true when additional vectors and variables do not require immediate initialization, false otherwise.
Definition: system.h:1952
MeshBase & mesh
UniquePtr< NumericVector< Number > > current_local_solution
All the values I need to compute my contribution to the simulation at hand.
Definition: system.h:1535
UniquePtr< DofMap > _dof_map
Data structure describing the relationship between nodes, variables, etc...
Definition: system.h:1865
unsigned int n_variable_groups() const
Definition: system.h:2094
const MeshBase & get_mesh() const
Definition: system.h:2014
ParallelType
Defines an enum for parallel data structure types.
UniquePtr< NumericVector< Number > > solution
Data structure to hold solution values.
Definition: system.h:1523
virtual void reinit_constraints()
Reinitializes the constraints for this system.
Definition: system.C:414
std::map< std::string, NumericVector< Number > * >::iterator vectors_iterator
Vector iterator typedefs.
Definition: system.h:748
dof_id_type n_local_dofs() const
Definition: system.C:185
std::map< std::string, NumericVector< Number > * > _vectors
Some systems need an arbitrary number of vectors.
Definition: system.h:1916
dof_id_type n_dofs() const
Definition: system.C:148
bool libMesh::System::is_adjoint_already_solved ( ) const
inherited

Accessor for the adjoint_already_solved boolean.

Definition at line 372 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().

373  { 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:1984
bool libMesh::System::is_initialized ( )
inherited
Returns
true iff this system has been initialized.

Definition at line 2070 of file system.h.

References libMesh::System::_is_initialized.

Referenced by libMesh::System::add_variable(), libMesh::System::add_variables(), libMesh::System::init(), and libMesh::System::system().

2071 {
2072  return _is_initialized;
2073 }
bool _is_initialized
true when additional vectors and variables do not require immediate initialization, false otherwise.
Definition: system.h:1952
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 1297 of file system.C.

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

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

1299 {
1300  // Make sure the set is clear
1301  var_indices.clear();
1302 
1303  std::vector<dof_id_type> dof_indices;
1304 
1305  const dof_id_type
1306  first_local = this->get_dof_map().first_dof(),
1307  end_local = this->get_dof_map().end_dof();
1308 
1309  // Begin the loop over the elements
1310  for (const auto & elem : this->get_mesh().active_local_element_ptr_range())
1311  {
1312  this->get_dof_map().dof_indices (elem, dof_indices, var);
1313 
1314  for (std::size_t i=0; i<dof_indices.size(); i++)
1315  {
1316  dof_id_type dof = dof_indices[i];
1317 
1318  //If the dof is owned by the local processor
1319  if (first_local <= dof && dof < end_local)
1320  var_indices.insert(dof_indices[i]);
1321  }
1322  }
1323 }
dof_id_type first_dof(const processor_id_type proc) const
Definition: dof_map.h:535
dof_id_type end_dof(const processor_id_type proc) const
Definition: dof_map.h:577
const MeshBase & get_mesh() const
Definition: system.h:2014
const DofMap & get_dof_map() const
Definition: system.h:2030
uint8_t dof_id_type
Definition: id_types.h:64
void dof_indices(const Elem *const elem, std::vector< dof_id_type > &di) const
Fills the vector di with the global degree of freedom indices for the element.
Definition: dof_map.C:1917
dof_id_type libMesh::System::n_active_dofs ( ) const
inherited
Returns
The number of active degrees of freedom for this System.

Definition at line 2198 of file system.h.

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

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

2199 {
2200  return this->n_dofs() - this->n_constrained_dofs();
2201 }
dof_id_type n_constrained_dofs() const
Definition: system.C:155
dof_id_type n_dofs() const
Definition: system.C:148
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 2102 of file system.h.

References libMesh::System::_variables, libMesh::Variable::first_scalar_number(), and libMesh::Variable::n_components().

Referenced by libMesh::System::add_variables(), libMesh::WrappedFunction< Output >::operator()(), and libMesh::System::project_solution_on_reinit().

2103 {
2104  if (_variables.empty())
2105  return 0;
2106 
2107  const Variable & last = _variables.back();
2108  return last.first_scalar_number() + last.n_components();
2109 }
std::vector< Variable > _variables
The Variable in this System.
Definition: system.h:1892
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 155 of file system.C.

References libMesh::System::_dof_map.

Referenced by libMesh::System::get_info(), libMesh::System::n_active_dofs(), libMesh::System::project_solution_on_reinit(), and BoundaryInfoTest::testShellFaceConstraints().

156 {
157 #ifdef LIBMESH_ENABLE_CONSTRAINTS
158 
159  return _dof_map->n_constrained_dofs();
160 
161 #else
162 
163  return 0;
164 
165 #endif
166 }
UniquePtr< DofMap > _dof_map
Data structure describing the relationship between nodes, variables, etc...
Definition: system.h:1865
dof_id_type libMesh::System::n_dofs ( ) const
inherited
Returns
The number of degrees of freedom in the system

Definition at line 148 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::RBConstruction::compute_Fq_representor_innerprods(), libMesh::RBConstruction::compute_output_dual_innerprods(), libMesh::RBEIMConstruction::enrich_RB_space(), libMesh::TransientRBConstruction::enrich_RB_space(), libMesh::RBConstruction::enrich_RB_space(), libMesh::AdjointRefinementEstimator::estimate_error(), libMesh::System::get_info(), libMesh::SecondOrderUnsteadySolver::init_data(), libMesh::UnsteadySolver::init_data(), libMesh::System::init_data(), libMesh::RBEIMConstruction::init_dof_map_between_systems(), libMesh::OptimizationSystem::initialize_equality_constraints_storage(), libMesh::OptimizationSystem::initialize_inequality_constraints_storage(), libMesh::RBEIMConstruction::initialize_rb_construction(), main(), libMesh::TransientRBConstruction::mass_matrix_scaled_matvec(), libMesh::System::n_active_dofs(), libMesh::CondensedEigenSystem::n_global_non_condensed_dofs(), libMesh::RBSCMConstruction::perform_SCM_greedy(), libMesh::System::project_solution_on_reinit(), libMesh::RBEIMAssembly::RBEIMAssembly(), 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::reinit(), libMesh::System::restrict_vectors(), libMesh::TransientRBConstruction::set_error_temporal_data(), libMesh::RBEIMConstruction::set_explicit_sys_subvector(), MeshfunctionDFEM::test_mesh_function_dfem(), MeshfunctionDFEM::test_mesh_function_dfem_grad(), SystemsTest::testProjectCubeWithMeshFunction(), libMesh::MeshFunctionSolutionTransfer::transfer(), libMesh::TransientRBConstruction::truth_assembly(), libMesh::RBConstruction::truth_assembly(), libMesh::TransientRBConstruction::update_RB_initial_condition_all_N(), libMesh::RBEIMConstruction::update_RB_system_matrices(), libMesh::TransientRBConstruction::update_RB_system_matrices(), libMesh::RBConstruction::update_RB_system_matrices(), libMesh::TransientRBConstruction::update_residual_terms(), and libMesh::RBConstruction::update_residual_terms().

149 {
150  return _dof_map->n_dofs();
151 }
UniquePtr< DofMap > _dof_map
Data structure describing the relationship between nodes, variables, etc...
Definition: system.h:1865
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 170 of file system.C.

References libMesh::System::_dof_map.

Referenced by libMesh::System::get_info(), and libMesh::System::project_solution_on_reinit().

171 {
172 #ifdef LIBMESH_ENABLE_CONSTRAINTS
173 
174  return _dof_map->n_local_constrained_dofs();
175 
176 #else
177 
178  return 0;
179 
180 #endif
181 }
UniquePtr< DofMap > _dof_map
Data structure describing the relationship between nodes, variables, etc...
Definition: system.h:1865
dof_id_type libMesh::System::n_local_dofs ( ) const
inherited
Returns
The number of degrees of freedom local to this processor

Definition at line 185 of file system.C.

References libMesh::System::_dof_map, and libMesh::ParallelObject::processor_id().

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::RBConstruction::compute_Fq_representor_innerprods(), libMesh::RBConstruction::compute_output_dual_innerprods(), libMesh::RBEIMConstruction::enrich_RB_space(), libMesh::TransientRBConstruction::enrich_RB_space(), libMesh::RBConstruction::enrich_RB_space(), libMesh::AdjointRefinementEstimator::estimate_error(), libMesh::System::get_info(), libMesh::SecondOrderUnsteadySolver::init_data(), libMesh::UnsteadySolver::init_data(), libMesh::System::init_data(), libMesh::OptimizationSystem::initialize_equality_constraints_storage(), libMesh::OptimizationSystem::initialize_inequality_constraints_storage(), libMesh::RBEIMConstruction::initialize_rb_construction(), main(), libMesh::TransientRBConstruction::mass_matrix_scaled_matvec(), libMesh::System::project_solution_on_reinit(), libMesh::RBEIMAssembly::RBEIMAssembly(), 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::reinit(), libMesh::System::restrict_vectors(), libMesh::TransientRBConstruction::set_error_temporal_data(), 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().

186 {
187  return _dof_map->n_dofs_on_processor (this->processor_id());
188 }
UniquePtr< DofMap > _dof_map
Data structure describing the relationship between nodes, variables, etc...
Definition: system.h:1865
processor_id_type processor_id() const
unsigned int libMesh::System::n_matrices ( ) const
virtualinherited
Returns
The number of matrices handled by this system.

This will return 0 by default but can be overridden.

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

Definition at line 2220 of file system.h.

Referenced by libMesh::System::get_info(), and libMesh::System::project_solution_on_reinit().

2221 {
2222  return 0;
2223 }
static unsigned int libMesh::ReferenceCounter::n_objects ( )
staticinherited
processor_id_type libMesh::ParallelObject::n_processors ( ) const
inherited
Returns
The number of processors in the group.

Definition at line 93 of file parallel_object.h.

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

Referenced by libMesh::ParmetisPartitioner::_do_repartition(), libMesh::BoundaryInfo::_find_id_maps(), libMesh::DistributedMesh::add_elem(), libMesh::DistributedMesh::add_node(), libMesh::LaplaceMeshSmoother::allgather_graph(), libMesh::FEMSystem::assembly(), libMesh::ParmetisPartitioner::assign_partitioning(), libMesh::AztecLinearSolver< T >::AztecLinearSolver(), libMesh::MeshCommunication::broadcast(), libMesh::BoundaryInfo::build_node_list_from_side_list(), libMesh::DistributedMesh::clear(), libMesh::Nemesis_IO_Helper::compute_border_node_ids(), libMesh::Nemesis_IO_Helper::construct_nemesis_filename(), libMesh::MeshTools::correct_node_proc_ids(), libMesh::UnstructuredMesh::create_pid_mesh(), libMesh::MeshTools::create_processor_bounding_box(), libMesh::DofMap::distribute_dofs(), libMesh::DofMap::distribute_local_dofs_node_major(), libMesh::DofMap::distribute_local_dofs_var_major(), libMesh::DistributedMesh::DistributedMesh(), libMesh::EnsightIO::EnsightIO(), libMesh::MeshCommunication::gather(), libMesh::MeshCommunication::gather_neighboring_elements(), libMesh::MeshBase::get_info(), libMesh::EquationSystems::get_solution(), libMesh::SystemSubsetBySubdomain::init(), libMesh::ParmetisPartitioner::initialize(), libMesh::Nemesis_IO_Helper::initialize(), libMesh::DistributedMesh::insert_elem(), 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::MeshBase::n_elem_on_proc(), libMesh::MeshBase::n_nodes_on_proc(), libMesh::SparsityPattern::Build::parallel_sync(), libMesh::Partitioner::partition(), libMesh::MeshBase::partition(), libMesh::Partitioner::partition_unpartitioned_elements(), libMesh::PetscLinearSolver< T >::PetscLinearSolver(), libMesh::System::point_gradient(), libMesh::System::point_hessian(), libMesh::System::point_value(), libMesh::SparseMatrix< T >::print(), libMesh::NameBasedIO::read(), libMesh::Nemesis_IO::read(), libMesh::CheckpointIO::read(), libMesh::CheckpointIO::read_connectivity(), libMesh::XdrIO::read_header(), libMesh::CheckpointIO::read_nodes(), libMesh::MeshCommunication::redistribute(), libMesh::DistributedMesh::renumber_dof_objects(), libMesh::Partitioner::repartition(), libMesh::MeshCommunication::send_coarse_ghosts(), libMesh::Partitioner::set_node_processor_ids(), libMesh::DofMap::set_nonlocal_dof_objects(), libMesh::Parallel::Sort< KeyType, IdxType >::sort(), WriteVecAndScalar::testWrite(), libMesh::MeshRefinement::uniformly_coarsen(), libMesh::DistributedMesh::update_parallel_id_counts(), libMesh::GMVIO::write_binary(), libMesh::GMVIO::write_discontinuous_gmv(), libMesh::XdrIO::write_serialized_bcs_helper(), libMesh::XdrIO::write_serialized_connectivity(), libMesh::XdrIO::write_serialized_nodes(), and libMesh::XdrIO::write_serialized_nodesets().

94  { return cast_int<processor_id_type>(_communicator.size()); }
unsigned int size() const
Definition: parallel.h:726
const Parallel::Communicator & _communicator
unsigned int libMesh::System::n_variable_groups ( ) const
inherited
Returns
The number of VariableGroup variable groups in the system

Definition at line 2094 of file system.h.

References libMesh::System::_variable_groups.

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

2095 {
2096  return cast_int<unsigned int>(_variable_groups.size());
2097 }
std::vector< VariableGroup > _variable_groups
The VariableGroup in this System.
Definition: system.h:1897
unsigned int libMesh::System::n_vars ( ) const
inherited
Returns
The number of variables in the system

Definition at line 2086 of file system.h.

References libMesh::System::_variables.

Referenced by libMesh::UniformRefinementEstimator::_estimate_error(), libMesh::DiffContext::add_localized_vector(), libMesh::RBConstruction::add_scaled_matrix_and_vector(), libMesh::System::add_variable(), libMesh::System::add_variables(), libMesh::EquationSystems::build_discontinuous_solution_vector(), libMesh::EquationSystems::build_parallel_solution_vector(), libMesh::System::calculate_norm(), libMesh::WrappedFunction< Output >::component(), compute_stresses(), LinearElasticityWithContact::compute_stresses(), LinearElasticity::compute_stresses(), LargeDeformationElasticity::compute_stresses(), libMesh::DGFEMContext::DGFEMContext(), libMesh::DiffContext::DiffContext(), libMesh::RBEIMConstruction::enrich_RB_space(), libMesh::JumpErrorEstimator::estimate_error(), libMesh::AdjointResidualErrorEstimator::estimate_error(), libMesh::ExactErrorEstimator::estimate_error(), libMesh::ErrorEstimator::estimate_errors(), libMesh::ExactSolution::ExactSolution(), libMesh::System::get_all_variable_numbers(), libMesh::EquationSystems::get_solution(), libMesh::System::init(), libMesh::FEMSystem::init_context(), libMesh::OldSolutionValue< Output, point_output >::init_context(), libMesh::RBEIMConstruction::init_context_with_sys(), libMesh::RBEIMConstruction::init_dof_map_between_systems(), libMesh::FEMContext::init_internal_data(), libMesh::DifferentiablePhysics::init_physics(), AssemblyA0::interior_assembly(), AssemblyA1::interior_assembly(), AssemblyA2::interior_assembly(), main(), libMesh::DGFEMContext::neighbor_side_fe_reinit(), libMesh::WrappedFunction< Output >::operator()(), output_norms(), libMesh::petsc_auto_fieldsplit(), libMesh::FEMContext::pre_fe_reinit(), libMesh::System::project_solution_on_reinit(), libMesh::System::re_update(), libMesh::System::reinit(), libMesh::HPCoarsenTest::select_refinement(), libMesh::SystemSubsetBySubdomain::set_var_nums(), SlitMeshRefinedSystemTest::testRestart(), SlitMeshRefinedSystemTest::testSystem(), libMesh::RBEIMConstruction::truth_solve(), libMesh::RBEIMConstruction::update_RB_system_matrices(), and libMesh::System::zero_variable().

2087 {
2088  return cast_int<unsigned int>(_variables.size());
2089 }
std::vector< Variable > _variables
The Variable in this System.
Definition: system.h:1892
unsigned int libMesh::System::n_vectors ( ) const
inherited
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 2214 of file system.h.

References libMesh::System::_vectors.

Referenced by add_system_rhs(), libMesh::System::compare(), libMesh::System::get_info(), main(), and libMesh::System::project_solution_on_reinit().

2215 {
2216  return cast_int<unsigned int>(_vectors.size());
2217 }
std::map< std::string, NumericVector< Number > * > _vectors
Some systems need an arbitrary number of vectors.
Definition: system.h:1916
const std::string & libMesh::System::name ( ) const
inherited
unsigned int libMesh::System::number ( ) const
inherited
Gradient libMesh::System::point_gradient ( unsigned int  var,
const Point p,
const bool  insist_on_success = true 
) 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 2118 of file system.C.

References libMesh::Parallel::Communicator::broadcast(), libMesh::ParallelObject::comm(), libMesh::PointLocatorBase::enable_out_of_mesh_mode(), libMesh::System::get_dof_map(), libMesh::System::get_mesh(), libMesh::MeshBase::is_serial(), libMesh::libmesh_assert(), mesh, libMesh::Parallel::Communicator::min(), libMesh::ParallelObject::n_processors(), libMesh::ParallelObject::processor_id(), libMesh::DofObject::processor_id(), libMesh::MeshBase::sub_point_locator(), and libMesh::Parallel::verify().

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

2119 {
2120  // This function must be called on every processor; there's no
2121  // telling where in the partition p falls.
2122  parallel_object_only();
2123 
2124  // And every processor had better agree about which point we're
2125  // looking for
2126 #ifndef NDEBUG
2127  libmesh_assert(this->comm().verify(p(0)));
2128 #if LIBMESH_DIM > 1
2129  libmesh_assert(this->comm().verify(p(1)));
2130 #endif
2131 #if LIBMESH_DIM > 2
2132  libmesh_assert(this->comm().verify(p(2)));
2133 #endif
2134 #endif // NDEBUG
2135 
2136  // Get a reference to the mesh object associated with the system object that calls this function
2137  const MeshBase & mesh = this->get_mesh();
2138 
2139  // Use an existing PointLocator or create a new one
2140  UniquePtr<PointLocatorBase> locator_ptr = mesh.sub_point_locator();
2141  PointLocatorBase & locator = *locator_ptr;
2142 
2143  if (!insist_on_success || !mesh.is_serial())
2144  locator.enable_out_of_mesh_mode();
2145 
2146  // Get a pointer to the element that contains P
2147  const Elem * e = locator(p);
2148 
2149  Gradient grad_u;
2150 
2151  if (e && this->get_dof_map().is_evaluable(*e, var))
2152  grad_u = point_gradient(var, p, *e);
2153 
2154  // If I have an element containing p, then let's let everyone know
2155  processor_id_type lowest_owner =
2156  (e && (e->processor_id() == this->processor_id())) ?
2157  this->processor_id() : this->n_processors();
2158  this->comm().min(lowest_owner);
2159 
2160  // Everybody should get their value from a processor that was able
2161  // to compute it.
2162  // If nobody admits owning the point, we may have a problem.
2163  if (lowest_owner != this->n_processors())
2164  this->comm().broadcast(grad_u, lowest_owner);
2165  else
2166  libmesh_assert(!insist_on_success);
2167 
2168  return grad_u;
2169 }
void min(T &r) const
Take a local variable and replace it with the minimum of it&#39;s values on all processors.
processor_id_type n_processors() const
MeshBase & mesh
uint8_t processor_id_type
Definition: id_types.h:99
libmesh_assert(j)
const MeshBase & get_mesh() const
Definition: system.h:2014
const DofMap & get_dof_map() const
Definition: system.h:2030
NumberVectorValue Gradient
void broadcast(T &data, const unsigned int root_id=0) const
Take a local value and broadcast it to all processors.
Gradient point_gradient(unsigned int var, const Point &p, const bool insist_on_success=true) const
Definition: system.C:2118
bool verify(const T &r, const Communicator &comm=Communicator_World)
const Parallel::Communicator & comm() const
processor_id_type processor_id() const
Gradient libMesh::System::point_gradient ( unsigned int  var,
const Point p,
const Elem e 
) 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 2172 of file system.C.

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

2173 {
2174  // Ensuring that the given point is really in the element is an
2175  // expensive assert, but as long as debugging is turned on we might
2176  // as well try to catch a particularly nasty potential error
2177  libmesh_assert (e.contains_point(p));
2178 
2179 #ifdef LIBMESH_ENABLE_INFINITE_ELEMENTS
2180  if (e.infinite())
2181  libmesh_not_implemented();
2182 #endif
2183 
2184  // Get the dof map to get the proper indices for our computation
2185  const DofMap & dof_map = this->get_dof_map();
2186 
2187  // Make sure we can evaluate on this element.
2188  libmesh_assert (dof_map.is_evaluable(e, var));
2189 
2190  // Need dof_indices for phi[i][j]
2191  std::vector<dof_id_type> dof_indices;
2192 
2193  // Fill in the dof_indices for our element
2194  dof_map.dof_indices (&e, dof_indices, var);
2195 
2196  // Get the no of dofs associated with this point
2197  const unsigned int num_dofs = cast_int<unsigned int>
2198  (dof_indices.size());
2199 
2200  FEType fe_type = dof_map.variable_type(var);
2201 
2202  // Build a FE again so we can calculate u(p)
2203  UniquePtr<FEBase> fe (FEBase::build(e.dim(), fe_type));
2204 
2205  // Map the physical co-ordinates to the master co-ordinates using the inverse_map from fe_interface.h
2206  // Build a vector of point co-ordinates to send to reinit
2207  std::vector<Point> coor(1, FEInterface::inverse_map(e.dim(), fe_type, &e, p));
2208 
2209  // Get the values of the shape function derivatives
2210  const std::vector<std::vector<RealGradient>> & dphi = fe->get_dphi();
2211 
2212  // Reinitialize the element and compute the shape function values at coor
2213  fe->reinit (&e, &coor);
2214 
2215  // Get ready to accumulate a gradient
2216  Gradient grad_u;
2217 
2218  for (unsigned int l=0; l<num_dofs; l++)
2219  {
2220  grad_u.add_scaled (dphi[l][0], this->current_solution (dof_indices[l]));
2221  }
2222 
2223  return grad_u;
2224 }
void add_scaled(const TypeVector< T2 > &, const T)
Add a scaled value to this vector without creating a temporary.
Definition: type_vector.h:624
libmesh_assert(j)
const DofMap & get_dof_map() const
Definition: system.h:2030
NumberVectorValue Gradient
static Point inverse_map(const unsigned int dim, const FEType &fe_t, const Elem *elem, const Point &p, const Real tolerance=TOLERANCE, const bool secure=true)
Definition: fe_interface.C:569
Number current_solution(const dof_id_type global_dof_number) const
Definition: system.C:192
static UniquePtr< FEGenericBase > build(const unsigned int dim, const FEType &type)
Builds a specific finite element type.
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 2228 of file system.C.

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

2229 {
2230  libmesh_assert(e);
2231  return this->point_gradient(var, p, *e);
2232 }
libmesh_assert(j)
Gradient point_gradient(unsigned int var, const Point &p, const bool insist_on_success=true) const
Definition: system.C:2118
Tensor libMesh::System::point_hessian ( unsigned int  var,
const Point p,
const bool  insist_on_success = true 
) 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 2238 of file system.C.

References libMesh::Parallel::Communicator::broadcast(), libMesh::ParallelObject::comm(), libMesh::PointLocatorBase::enable_out_of_mesh_mode(), libMesh::System::get_dof_map(), libMesh::System::get_mesh(), libMesh::MeshBase::is_serial(), libMesh::libmesh_assert(), mesh, libMesh::Parallel::Communicator::min(), libMesh::ParallelObject::n_processors(), libMesh::ParallelObject::processor_id(), libMesh::DofObject::processor_id(), libMesh::MeshBase::sub_point_locator(), and libMesh::Parallel::verify().

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

2239 {
2240  // This function must be called on every processor; there's no
2241  // telling where in the partition p falls.
2242  parallel_object_only();
2243 
2244  // And every processor had better agree about which point we're
2245  // looking for
2246 #ifndef NDEBUG
2247  libmesh_assert(this->comm().verify(p(0)));
2248 #if LIBMESH_DIM > 1
2249  libmesh_assert(this->comm().verify(p(1)));
2250 #endif
2251 #if LIBMESH_DIM > 2
2252  libmesh_assert(this->comm().verify(p(2)));
2253 #endif
2254 #endif // NDEBUG
2255 
2256  // Get a reference to the mesh object associated with the system object that calls this function
2257  const MeshBase & mesh = this->get_mesh();
2258 
2259  // Use an existing PointLocator or create a new one
2260  UniquePtr<PointLocatorBase> locator_ptr = mesh.sub_point_locator();
2261  PointLocatorBase & locator = *locator_ptr;
2262 
2263  if (!insist_on_success || !mesh.is_serial())
2264  locator.enable_out_of_mesh_mode();
2265 
2266  // Get a pointer to the element that contains P
2267  const Elem * e = locator(p);
2268 
2269  Tensor hess_u;
2270 
2271  if (e && this->get_dof_map().is_evaluable(*e, var))
2272  hess_u = point_hessian(var, p, *e);
2273 
2274  // If I have an element containing p, then let's let everyone know
2275  processor_id_type lowest_owner =
2276  (e && (e->processor_id() == this->processor_id())) ?
2277  this->processor_id() : this->n_processors();
2278  this->comm().min(lowest_owner);
2279 
2280  // Everybody should get their value from a processor that was able
2281  // to compute it.
2282  // If nobody admits owning the point, we may have a problem.
2283  if (lowest_owner != this->n_processors())
2284  this->comm().broadcast(hess_u, lowest_owner);
2285  else
2286  libmesh_assert(!insist_on_success);
2287 
2288  return hess_u;
2289 }
void min(T &r) const
Take a local variable and replace it with the minimum of it&#39;s values on all processors.
processor_id_type n_processors() const
MeshBase & mesh
uint8_t processor_id_type
Definition: id_types.h:99
libmesh_assert(j)
const MeshBase & get_mesh() const
Definition: system.h:2014
const DofMap & get_dof_map() const
Definition: system.h:2030
Tensor point_hessian(unsigned int var, const Point &p, const bool insist_on_success=true) const
Definition: system.C:2238
void broadcast(T &data, const unsigned int root_id=0) const
Take a local value and broadcast it to all processors.
bool verify(const T &r, const Communicator &comm=Communicator_World)
NumberTensorValue Tensor
const Parallel::Communicator & comm() const
processor_id_type processor_id() const
Tensor libMesh::System::point_hessian ( unsigned int  var,
const Point p,
const Elem e 
) 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 2291 of file system.C.

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

2292 {
2293  // Ensuring that the given point is really in the element is an
2294  // expensive assert, but as long as debugging is turned on we might
2295  // as well try to catch a particularly nasty potential error
2296  libmesh_assert (e.contains_point(p));
2297 
2298 #ifdef LIBMESH_ENABLE_INFINITE_ELEMENTS
2299  if (e.infinite())
2300  libmesh_not_implemented();
2301 #endif
2302 
2303  // Get the dof map to get the proper indices for our computation
2304  const DofMap & dof_map = this->get_dof_map();
2305 
2306  // Make sure we can evaluate on this element.
2307  libmesh_assert (dof_map.is_evaluable(e, var));
2308 
2309  // Need dof_indices for phi[i][j]
2310  std::vector<dof_id_type> dof_indices;
2311 
2312  // Fill in the dof_indices for our element
2313  dof_map.dof_indices (&e, dof_indices, var);
2314 
2315  // Get the no of dofs associated with this point
2316  const unsigned int num_dofs = cast_int<unsigned int>
2317  (dof_indices.size());
2318 
2319  FEType fe_type = dof_map.variable_type(var);
2320 
2321  // Build a FE again so we can calculate u(p)
2322  UniquePtr<FEBase> fe (FEBase::build(e.dim(), fe_type));
2323 
2324  // Map the physical co-ordinates to the master co-ordinates using the inverse_map from fe_interface.h
2325  // Build a vector of point co-ordinates to send to reinit
2326  std::vector<Point> coor(1, FEInterface::inverse_map(e.dim(), fe_type, &e, p));
2327 
2328  // Get the values of the shape function derivatives
2329  const std::vector<std::vector<RealTensor>> & d2phi = fe->get_d2phi();
2330 
2331  // Reinitialize the element and compute the shape function values at coor
2332  fe->reinit (&e, &coor);
2333 
2334  // Get ready to accumulate a hessian
2335  Tensor hess_u;
2336 
2337  for (unsigned int l=0; l<num_dofs; l++)
2338  {
2339  hess_u.add_scaled (d2phi[l][0], this->current_solution (dof_indices[l]));
2340  }
2341 
2342  return hess_u;
2343 }
void add_scaled(const TypeTensor< T2 > &, const T)
Add a scaled tensor to this tensor without creating a temporary.
Definition: type_tensor.h:777
libmesh_assert(j)
const DofMap & get_dof_map() const
Definition: system.h:2030
static Point inverse_map(const unsigned int dim, const FEType &fe_t, const Elem *elem, const Point &p, const Real tolerance=TOLERANCE, const bool secure=true)
Definition: fe_interface.C:569
Number current_solution(const dof_id_type global_dof_number) const
Definition: system.C:192
NumberTensorValue Tensor
static UniquePtr< FEGenericBase > build(const unsigned int dim, const FEType &type)
Builds a specific finite element type.
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 2347 of file system.C.

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

2348 {
2349  libmesh_assert(e);
2350  return this->point_hessian(var, p, *e);
2351 }
libmesh_assert(j)
Tensor point_hessian(unsigned int var, const Point &p, const bool insist_on_success=true) const
Definition: system.C:2238
Number libMesh::System::point_value ( unsigned int  var,
const Point p,
const bool  insist_on_success = true 
) 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.
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 2011 of file system.C.

References libMesh::Parallel::Communicator::broadcast(), libMesh::ParallelObject::comm(), libMesh::PointLocatorBase::enable_out_of_mesh_mode(), libMesh::System::get_dof_map(), libMesh::System::get_mesh(), libMesh::MeshBase::is_serial(), libMesh::libmesh_assert(), mesh, libMesh::Parallel::Communicator::min(), libMesh::ParallelObject::n_processors(), libMesh::ParallelObject::processor_id(), libMesh::DofObject::processor_id(), libMesh::MeshBase::sub_point_locator(), and libMesh::Parallel::verify().

Referenced by main(), libMesh::System::point_value(), DefaultCouplingTest::testCoupling(), PointNeighborCouplingTest::testCoupling(), SystemsTest::testProjectCube(), SystemsTest::testProjectCubeWithMeshFunction(), SystemsTest::testProjectLine(), and SystemsTest::testProjectSquare().

2012 {
2013  // This function must be called on every processor; there's no
2014  // telling where in the partition p falls.
2015  parallel_object_only();
2016 
2017  // And every processor had better agree about which point we're
2018  // looking for
2019 #ifndef NDEBUG
2020  libmesh_assert(this->comm().verify(p(0)));
2021 #if LIBMESH_DIM > 1
2022  libmesh_assert(this->comm().verify(p(1)));
2023 #endif
2024 #if LIBMESH_DIM > 2
2025  libmesh_assert(this->comm().verify(p(2)));
2026 #endif
2027 #endif // NDEBUG
2028 
2029  // Get a reference to the mesh object associated with the system object that calls this function
2030  const MeshBase & mesh = this->get_mesh();
2031 
2032  // Use an existing PointLocator or create a new one
2033  UniquePtr<PointLocatorBase> locator_ptr = mesh.sub_point_locator();
2034  PointLocatorBase & locator = *locator_ptr;
2035 
2036  if (!insist_on_success || !mesh.is_serial())
2037  locator.enable_out_of_mesh_mode();
2038 
2039  // Get a pointer to the element that contains P
2040  const Elem * e = locator(p);
2041 
2042  Number u = 0;
2043 
2044  if (e && this->get_dof_map().is_evaluable(*e, var))
2045  u = point_value(var, p, *e);
2046 
2047  // If I have an element containing p, then let's let everyone know
2048  processor_id_type lowest_owner =
2049  (e && (e->processor_id() == this->processor_id())) ?
2050  this->processor_id() : this->n_processors();
2051  this->comm().min(lowest_owner);
2052 
2053  // Everybody should get their value from a processor that was able
2054  // to compute it.
2055  // If nobody admits owning the point, we have a problem.
2056  if (lowest_owner != this->n_processors())
2057  this->comm().broadcast(u, lowest_owner);
2058  else
2059  libmesh_assert(!insist_on_success);
2060 
2061  return u;
2062 }
Number point_value(unsigned int var, const Point &p, const bool insist_on_success=true) const
Definition: system.C:2011
void min(T &r) const
Take a local variable and replace it with the minimum of it&#39;s values on all processors.
processor_id_type n_processors() const
MeshBase & mesh
uint8_t processor_id_type
Definition: id_types.h:99
libmesh_assert(j)
const MeshBase & get_mesh() const
Definition: system.h:2014
const DofMap & get_dof_map() const
Definition: system.h:2030
void broadcast(T &data, const unsigned int root_id=0) const
Take a local value and broadcast it to all processors.
bool verify(const T &r, const Communicator &comm=Communicator_World)
const Parallel::Communicator & comm() const
processor_id_type processor_id() const
Number libMesh::System::point_value ( unsigned int  var,
const Point p,
const Elem e 
) const
inherited
Returns
The value of the solution variable var at the physical point p contained in local Elem e

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 2064 of file system.C.

References libMesh::FEInterface::compute_data(), libMesh::Elem::contains_point(), libMesh::System::current_solution(), libMesh::Elem::dim(), libMesh::System::get_dof_map(), libMesh::System::get_equation_systems(), libMesh::FEInterface::inverse_map(), and libMesh::libmesh_assert().

2065 {
2066  // Ensuring that the given point is really in the element is an
2067  // expensive assert, but as long as debugging is turned on we might
2068  // as well try to catch a particularly nasty potential error
2069  libmesh_assert (e.contains_point(p));
2070 
2071  // Get the dof map to get the proper indices for our computation
2072  const DofMap & dof_map = this->get_dof_map();
2073 
2074  // Make sure we can evaluate on this element.
2075  libmesh_assert (dof_map.is_evaluable(e, var));
2076 
2077  // Need dof_indices for phi[i][j]
2078  std::vector<dof_id_type> dof_indices;
2079 
2080  // Fill in the dof_indices for our element
2081  dof_map.dof_indices (&e, dof_indices, var);
2082 
2083  // Get the no of dofs associated with this point
2084  const unsigned int num_dofs = cast_int<unsigned int>
2085  (dof_indices.size());
2086 
2087  FEType fe_type = dof_map.variable_type(var);
2088 
2089  // Map the physical co-ordinates to the master co-ordinates using the inverse_map from fe_interface.h.
2090  Point coor = FEInterface::inverse_map(e.dim(), fe_type, &e, p);
2091 
2092  // get the shape function value via the FEInterface to also handle the case
2093  // of infinite elements correcly, the shape function is not fe->phi().
2094  FEComputeData fe_data(this->get_equation_systems(), coor);
2095  FEInterface::compute_data(e.dim(), fe_type, &e, fe_data);
2096 
2097  // Get ready to accumulate a value
2098  Number u = 0;
2099 
2100  for (unsigned int l=0; l<num_dofs; l++)
2101  {
2102  u += fe_data.shape[l]*this->current_solution (dof_indices[l]);
2103  }
2104 
2105  return u;
2106 }
libmesh_assert(j)
const DofMap & get_dof_map() const
Definition: system.h:2030
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...
Definition: fe_interface.C:827
static Point inverse_map(const unsigned int dim, const FEType &fe_t, const Elem *elem, const Point &p, const Real tolerance=TOLERANCE, const bool secure=true)
Definition: fe_interface.C:569
Number current_solution(const dof_id_type global_dof_number) const
Definition: system.C:192
const EquationSystems & get_equation_systems() const
Definition: system.h:712
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 2110 of file system.C.

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

2111 {
2112  libmesh_assert(e);
2113  return this->point_value(var, p, *e);
2114 }
Number point_value(unsigned int var, const Point &p, const bool insist_on_success=true) const
Definition: system.C:2011
libmesh_assert(j)
void libMesh::ReferenceCounter::print_info ( std::ostream &  out = libMesh::out)
staticinherited

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

Definition at line 88 of file reference_counter.C.

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

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

89 {
91  out_stream << ReferenceCounter::get_info();
92 }
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_type libMesh::ParallelObject::processor_id ( ) const
inherited
Returns
The rank of this processor in the group.

Definition at line 99 of file parallel_object.h.

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

Referenced by libMesh::BoundaryInfo::_find_id_maps(), libMesh::EquationSystems::_read_impl(), libMesh::DistributedMesh::add_elem(), libMesh::BoundaryInfo::add_elements(), libMesh::DofMap::add_neighbors_to_send_list(), libMesh::DistributedMesh::add_node(), libMesh::MeshRefinement::add_node(), libMesh::MeshTools::Modification::all_tri(), libMesh::FEMSystem::assembly(), libMesh::ParmetisPartitioner::assign_partitioning(), libMesh::MeshCommunication::broadcast(), libMesh::EquationSystems::build_discontinuous_solution_vector(), libMesh::Nemesis_IO_Helper::build_element_and_node_maps(), libMesh::ParmetisPartitioner::build_graph(), libMesh::InfElemBuilder::build_inf_elem(), libMesh::BoundaryInfo::build_node_list_from_side_list(), libMesh::DofMap::build_sparsity(), libMesh::DistributedMesh::clear(), 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::MeshTools::correct_node_proc_ids(), libMesh::ExodusII_IO_Helper::create(), libMesh::DistributedMesh::delete_elem(), libMesh::DistributedMesh::delete_node(), libMesh::MeshCommunication::delete_remote_elements(), libMesh::DofMap::distribute_dofs(), libMesh::DofMap::distribute_local_dofs_node_major(), libMesh::DofMap::distribute_local_dofs_var_major(), libMesh::DistributedMesh::DistributedMesh(), libMesh::EnsightIO::EnsightIO(), libMesh::RBEIMConstruction::evaluate_mesh_function(), libMesh::MeshFunction::find_element(), libMesh::MeshFunction::find_elements(), libMesh::UnstructuredMesh::find_neighbors(), libMesh::MeshCommunication::gather(), libMesh::MeshCommunication::gather_neighboring_elements(), 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::Nemesis_IO_Helper::get_loadbal_param(), libMesh::Nemesis_IO_Helper::get_node_cmap(), libMesh::Nemesis_IO_Helper::get_node_map(), libMesh::Nemesis_IO_Helper::get_ns_param_global(), libMesh::EquationSystems::get_solution(), libMesh::Nemesis_IO_Helper::get_ss_param_global(), libMesh::SparsityPattern::Build::handle_vi_vj(), libMesh::SystemSubsetBySubdomain::init(), HeatSystem::init_data(), libMesh::ParmetisPartitioner::initialize(), 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::RBEIMEvaluation::legacy_write_offline_data_to_files(), libMesh::RBEvaluation::legacy_write_offline_data_to_files(), libMesh::RBSCMEvaluation::legacy_write_offline_data_to_files(), libMesh::RBEIMEvaluation::legacy_write_out_interpolation_points_elem(), libMesh::MeshTools::libmesh_assert_parallel_consistent_procids< Elem >(), libMesh::MeshTools::libmesh_assert_parallel_consistent_procids< Node >(), 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::MeshBase::n_active_local_elem(), libMesh::BoundaryInfo::n_boundary_conds(), libMesh::BoundaryInfo::n_edge_conds(), libMesh::System::n_local_dofs(), libMesh::MeshBase::n_local_elem(), libMesh::MeshBase::n_local_nodes(), libMesh::BoundaryInfo::n_nodeset_conds(), libMesh::BoundaryInfo::n_shellface_conds(), libMesh::WeightedPatchRecoveryErrorEstimator::EstimateError::operator()(), libMesh::SparsityPattern::Build::operator()(), libMesh::PatchRecoveryErrorEstimator::EstimateError::operator()(), libMesh::SparsityPattern::Build::parallel_sync(), libMesh::MetisPartitioner::partition_range(), libMesh::System::point_gradient(), libMesh::System::point_hessian(), libMesh::System::point_value(), libMesh::SparseMatrix< T >::print(), libMesh::NumericVector< T >::print_global(), 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::CheckpointIO::read(), libMesh::XdrIO::read(), libMesh::ExodusII_IO_Helper::read_elem_num_map(), libMesh::CheckpointIO::read_header(), libMesh::XdrIO::read_header(), libMesh::RBEvaluation::read_in_vectors_from_multiple_files(), libMesh::ExodusII_IO_Helper::read_node_num_map(), libMesh::TransientRBConstruction::read_riesz_representors_from_files(), libMesh::RBConstruction::read_riesz_representors_from_files(), libMesh::XdrIO::read_serialized_bc_names(), libMesh::XdrIO::read_serialized_bcs_helper(), libMesh::XdrIO::read_serialized_connectivity(), libMesh::XdrIO::read_serialized_nodes(), libMesh::XdrIO::read_serialized_nodesets(), libMesh::XdrIO::read_serialized_subdomain_names(), libMesh::MeshCommunication::redistribute(), libMesh::DistributedMesh::renumber_dof_objects(), libMesh::MeshCommunication::send_coarse_ghosts(), libMesh::Partitioner::set_node_processor_ids(), libMesh::DofMap::set_nonlocal_dof_objects(), libMesh::LaplaceMeshSmoother::smooth(), DefaultCouplingTest::testCoupling(), PointNeighborCouplingTest::testCoupling(), BoundaryInfoTest::testShellFaceConstraints(), WriteVecAndScalar::testWrite(), libMesh::MeshTools::total_weight(), libMesh::MeshRefinement::uniformly_coarsen(), libMesh::Parallel::Packing< Node * >::unpack(), libMesh::Parallel::Packing< Elem * >::unpack(), libMesh::DistributedMesh::update_parallel_id_counts(), libMesh::DTKAdapter::update_variable_values(), libMesh::MeshTools::weight(), libMesh::NameBasedIO::write(), libMesh::CheckpointIO::write(), libMesh::XdrIO::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_elements(), libMesh::ExodusII_IO::write_global_data(), libMesh::ExodusII_IO_Helper::write_global_values(), 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::ExodusII_IO::write_nodal_data(), libMesh::ExodusII_IO::write_nodal_data_discontinuous(), libMesh::ExodusII_IO_Helper::write_nodal_values(), libMesh::Nemesis_IO_Helper::write_nodesets(), libMesh::ExodusII_IO_Helper::write_nodesets(), libMesh::RBEvaluation::write_out_vectors(), write_output_solvedata(), libMesh::RBConstruction::write_riesz_representors_to_files(), libMesh::XdrIO::write_serialized_bc_names(), libMesh::XdrIO::write_serialized_bcs_helper(), libMesh::XdrIO::write_serialized_connectivity(), libMesh::XdrIO::write_serialized_nodes(), libMesh::XdrIO::write_serialized_nodesets(), libMesh::XdrIO::write_serialized_subdomain_names(), libMesh::Nemesis_IO_Helper::write_sidesets(), libMesh::ExodusII_IO_Helper::write_sidesets(), libMesh::ExodusII_IO::write_timestep(), and libMesh::ExodusII_IO_Helper::write_timestep().

100  { return cast_int<processor_id_type>(_communicator.rank()); }
const Parallel::Communicator & _communicator
unsigned int rank() const
Definition: parallel.h:724
void libMesh::System::project_solution ( FunctionBase< Number > *  f,
FunctionBase< Gradient > *  g = libmesh_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. If non-default Parameters are to be used, they can be provided in the parameters argument.

Definition at line 811 of file system_projection.C.

Referenced by init_sys(), initialize(), main(), libMesh::System::project_vector(), FETest< order, family, elem_type >::setUp(), SlitMeshRefinedSystemTest::setUp(), libMesh::System::system_type(), MeshfunctionDFEM::test_mesh_function_dfem(), MeshfunctionDFEM::test_mesh_function_dfem_grad(), DefaultCouplingTest::testCoupling(), PointNeighborCouplingTest::testCoupling(), SystemsTest::testProjectCube(), SystemsTest::testProjectCubeWithMeshFunction(), SystemsTest::testProjectLine(), SystemsTest::testProjectSquare(), and libMesh::MeshfreeSolutionTransfer::transfer().

813 {
814  this->project_vector(*solution, f, g);
815 
816  solution->localize(*current_local_solution, _dof_map->get_send_list());
817 }
UniquePtr< NumericVector< Number > > current_local_solution
All the values I need to compute my contribution to the simulation at hand.
Definition: system.h:1535
UniquePtr< DofMap > _dof_map
Data structure describing the relationship between nodes, variables, etc...
Definition: system.h:1865
UniquePtr< NumericVector< Number > > solution
Data structure to hold solution values.
Definition: system.h:1523
void project_vector(NumericVector< Number > &new_vector, FunctionBase< Number > *f, FunctionBase< Gradient > *g=libmesh_nullptr, int is_adjoint=-1) const
Projects arbitrary functions onto a vector of degree of freedom values for the current system...
void libMesh::System::project_solution ( FEMFunctionBase< Number > *  f,
FEMFunctionBase< Gradient > *  g = libmesh_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. If non-default Parameters are to be used, they can be provided in the parameters argument.

Definition at line 824 of file system_projection.C.

References fptr(), gptr(), and libMesh::System::project_vector().

826 {
827  this->project_vector(*solution, f, g);
828 
829  solution->localize(*current_local_solution, _dof_map->get_send_list());
830 }
UniquePtr< NumericVector< Number > > current_local_solution
All the values I need to compute my contribution to the simulation at hand.
Definition: system.h:1535
UniquePtr< DofMap > _dof_map
Data structure describing the relationship between nodes, variables, etc...
Definition: system.h:1865
UniquePtr< NumericVector< Number > > solution
Data structure to hold solution values.
Definition: system.h:1523
void project_vector(NumericVector< Number > &new_vector, FunctionBase< Number > *f, FunctionBase< Gradient > *g=libmesh_nullptr, int is_adjoint=-1) const
Projects arbitrary functions onto a vector of degree of freedom values for the current system...
void libMesh::System::project_solution ( Number   fptrconst Point &p, const Parameters &parameters, const std::string &sys_name, const std::string &unknown_name,
Gradient   gptrconst Point &p, const Parameters &parameters, const std::string &sys_name, const std::string &unknown_name,
const Parameters parameters 
) const
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.

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

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 794 of file system.h.

References libMesh::System::_solution_projection, libMesh::System::add_adjoint_rhs(), libMesh::System::add_adjoint_solution(), libMesh::System::add_sensitivity_rhs(), libMesh::System::add_sensitivity_solution(), libMesh::System::add_variable(), libMesh::System::add_variables(), libMesh::System::add_weighted_sensitivity_adjoint_solution(), libMesh::System::add_weighted_sensitivity_solution(), libMesh::System::calculate_norm(), libMesh::FIRST, libMesh::System::get_adjoint_rhs(), libMesh::System::get_adjoint_solution(), libMesh::System::get_all_variable_numbers(), libMesh::System::get_sensitivity_rhs(), libMesh::System::get_sensitivity_solution(), libMesh::System::get_vector(), libMesh::System::get_weighted_sensitivity_adjoint_solution(), libMesh::System::get_weighted_sensitivity_solution(), libMesh::System::has_variable(), libMesh::System::have_vector(), libMesh::System::identify_variable_groups(), libMesh::LAGRANGE, libmesh_nullptr, libMesh::System::n_active_dofs(), libMesh::System::n_components(), 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::System::n_vars(), libMesh::System::n_vectors(), libMesh::System::read_header(), libMesh::System::read_legacy_data(), libMesh::System::read_serialized_data(), libMesh::Real, libMesh::System::request_vector(), libMesh::System::set_vector_as_adjoint(), libMesh::System::set_vector_preservation(), libMesh::System::variable(), libMesh::System::variable_group(), libMesh::System::variable_name(), libMesh::System::variable_number(), libMesh::System::variable_scalar_number(), libMesh::System::variable_type(), libMesh::System::vector_is_adjoint(), libMesh::System::vector_name(), and libMesh::System::vector_preservation().

Referenced by libMesh::UniformRefinementEstimator::_estimate_error(), libMesh::AdjointRefinementEstimator::estimate_error(), and libMesh::MemorySolutionHistory::store().

795  { 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:1940
void libMesh::System::project_vector ( NumericVector< Number > &  new_vector,
FunctionBase< Number > *  f,
FunctionBase< Gradient > *  g = libmesh_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. If non-default Parameters are to be used, they can be provided in the parameters argument.

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

Definition at line 858 of file system_projection.C.

References libMesh::libmesh_assert(), and libmesh_nullptr.

Referenced by libMesh::System::hide_output(), main(), libMesh::NewmarkSolver::project_initial_accel(), libMesh::SecondOrderUnsteadySolver::project_initial_rate(), libMesh::System::project_solution(), libMesh::System::project_vector(), libMesh::System::restrict_vectors(), and libMesh::System::system_type().

862 {
863  LOG_SCOPE ("project_vector(FunctionBase)", "System");
864 
865  libmesh_assert(f);
866 
867  WrappedFunctor<Number> f_fem(*f);
868 
869  if (g)
870  {
871  WrappedFunctor<Gradient> g_fem(*g);
872 
873  this->project_vector(new_vector, &f_fem, &g_fem, is_adjoint);
874  }
875  else
876  this->project_vector(new_vector, &f_fem, libmesh_nullptr, is_adjoint);
877 }
const class libmesh_nullptr_t libmesh_nullptr
libmesh_assert(j)
void project_vector(NumericVector< Number > &new_vector, FunctionBase< Number > *f, FunctionBase< Gradient > *g=libmesh_nullptr, int is_adjoint=-1) const
Projects arbitrary functions onto a vector of degree of freedom values for the current system...
void libMesh::System::project_vector ( NumericVector< Number > &  new_vector,
FEMFunctionBase< Number > *  f,
FEMFunctionBase< Gradient > *  g = libmesh_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. If non-default Parameters are to be used, they can be provided in the parameters argument.

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

Definition at line 884 of file system_projection.C.

References libMesh::System::boundary_project_solution(), libMesh::NumericVector< T >::close(), libMesh::FEMFunctionBase< Output >::component(), fptr(), libMesh::get_dof_map(), gptr(), libMesh::libmesh_assert(), libmesh_nullptr, libMesh::n_processors(), n_vars, libMesh::Threads::parallel_for(), libMesh::FEMContext::pre_fe_reinit(), libMesh::processor_id(), libMesh::SCALAR, libMesh::DofMap::SCALAR_dof_indices(), libMesh::NumericVector< T >::set(), and libMesh::GenericProjector< FFunctor, GFunctor, FValue, ProjectionAction >::variables.

888 {
889  LOG_SCOPE ("project_fem_vector()", "System");
890 
891  libmesh_assert (f);
892 
893  ConstElemRange active_local_range
894  (this->get_mesh().active_local_elements_begin(),
895  this->get_mesh().active_local_elements_end() );
896 
897  VectorSetAction<Number> setter(new_vector);
898 
899  const unsigned int n_variables = this->n_vars();
900 
901  std::vector<unsigned int> vars(n_variables);
902  for (unsigned int i=0; i != n_variables; ++i)
903  vars[i] = i;
904 
905  // Use a typedef to make the calling sequence for parallel_for() a bit more readable
906  typedef
907  GenericProjector<FEMFunctionWrapper<Number>, FEMFunctionWrapper<Gradient>,
908  Number, VectorSetAction<Number>> FEMProjector;
909 
910  FEMFunctionWrapper<Number> fw(*f);
911 
912  if (g)
913  {
914  FEMFunctionWrapper<Gradient> gw(*g);
915 
917  (active_local_range,
918  FEMProjector(*this, fw, &gw, setter, vars));
919  }
920  else
922  (active_local_range,
923  FEMProjector(*this, fw, libmesh_nullptr, setter, vars));
924 
925  // Also, load values into the SCALAR dofs
926  // Note: We assume that all SCALAR dofs are on the
927  // processor with highest ID
928  if (this->processor_id() == (this->n_processors()-1))
929  {
930  // FIXME: Do we want to first check for SCALAR vars before building this? [PB]
931  FEMContext context( *this );
932 
933  const DofMap & dof_map = this->get_dof_map();
934  for (unsigned int var=0; var<this->n_vars(); var++)
935  if (this->variable(var).type().family == SCALAR)
936  {
937  // FIXME: We reinit with an arbitrary element in case the user
938  // doesn't override FEMFunctionBase::component. Is there
939  // any use case we're missing? [PB]
940  Elem * el = const_cast<Elem *>(*(this->get_mesh().active_local_elements_begin()));
941  context.pre_fe_reinit(*this, el);
942 
943  std::vector<dof_id_type> SCALAR_indices;
944  dof_map.SCALAR_dof_indices (SCALAR_indices, var);
945  const unsigned int n_SCALAR_dofs =
946  cast_int<unsigned int>(SCALAR_indices.size());
947 
948  for (unsigned int i=0; i<n_SCALAR_dofs; i++)
949  {
950  const dof_id_type global_index = SCALAR_indices[i];
951  const unsigned int component_index =
952  this->variable_scalar_number(var,i);
953 
954  new_vector.set(global_index, f->component(context, component_index, Point(), this->time));
955  }
956  }
957  }
958 
959  new_vector.close();
960 
961 #ifdef LIBMESH_ENABLE_CONSTRAINTS
962  if (is_adjoint == -1)
963  this->get_dof_map().enforce_constraints_exactly(*this, &new_vector);
964  else if (is_adjoint >= 0)
966  is_adjoint);
967 #endif
968 }
FEFamily family
The type of finite element.
Definition: fe_type.h:203
Real time
For time-dependent problems, this is the time t at the beginning of the current timestep.
Definition: system.h:1545
const FEType & type() const
Definition: variable.h:119
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
processor_id_type n_processors() const
const class libmesh_nullptr_t libmesh_nullptr
StoredRange< MeshBase::const_element_iterator, const Elem * > ConstElemRange
Definition: elem_range.h:34
libmesh_assert(j)
const MeshBase & get_mesh() const
Definition: system.h:2014
const DofMap & get_dof_map() const
Definition: system.h:2030
const Variable & variable(unsigned int var) const
Return a constant reference to Variable var.
Definition: system.h:2114
virtual element_iterator active_local_elements_begin()=0
void enforce_constraints_exactly(const System &system, NumericVector< Number > *v=libmesh_nullptr, bool homogeneous=false) const
Constrains the numeric vector v, which represents a solution defined on the mesh. ...
Definition: dof_map.h:1816
virtual void close()=0
Calls the NumericVector&#39;s internal assembly routines, ensuring that the values are consistent across ...
virtual Output component(const FEMContext &, unsigned int i, const Point &p, Real time=0.)
unsigned int variable_scalar_number(const std::string &var, unsigned int component) const
Definition: system.h:2145
unsigned int n_vars() const
Definition: system.h:2086
virtual void set(const numeric_index_type i, const T value)=0
Sets v(i) = value.
void enforce_adjoint_constraints_exactly(NumericVector< Number > &v, unsigned int q) const
Heterogenously constrains the numeric vector v, which represents an adjoint solution defined on the m...
Definition: dof_map.h:1820
uint8_t dof_id_type
Definition: id_types.h:64
processor_id_type processor_id() const
void libMesh::System::project_vector ( Number   fptrconst Point &p, const Parameters &parameters, const std::string &sys_name, const std::string &unknown_name,
Gradient   gptrconst Point &p, const Parameters &parameters, const std::string &sys_name, const std::string &unknown_name,
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.

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.

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 576 of file system_projection.C.

References libMesh::NumericVector< T >::build(), libMesh::NumericVector< T >::clear(), libMesh::NumericVector< T >::clone(), libMesh::NumericVector< T >::close(), fptr(), libMesh::NumericVector< T >::get(), libMesh::get_dof_map(), libMesh::GHOSTED, gptr(), libMesh::NumericVector< T >::init(), libMesh::libmesh_assert(), libmesh_nullptr, libMesh::NumericVector< T >::local_size(), libMesh::NumericVector< T >::localize(), libMesh::n_processors(), n_vars, libMesh::PARALLEL, libMesh::Threads::parallel_for(), libMesh::Threads::parallel_reduce(), libMesh::processor_id(), libMesh::System::project_solution(), libMesh::System::project_vector(), 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(), and libMesh::BuildProjectionList::unique().

578 {
579  // Create a copy of the vector, which currently
580  // contains the old data.
581  UniquePtr<NumericVector<Number>>
582  old_vector (vector.clone());
583 
584  // Project the old vector to the new vector
585  this->project_vector (*old_vector, vector, is_adjoint);
586 }
void project_vector(NumericVector< Number > &new_vector, FunctionBase< Number > *f, FunctionBase< Gradient > *g=libmesh_nullptr, int is_adjoint=-1) const
Projects arbitrary functions onto a vector of degree of freedom values for the current system...
virtual UniquePtr< NumericVector< T > > clone() const =0
void libMesh::System::project_vector ( const NumericVector< Number > &  ,
NumericVector< Number > &  ,
int  is_adjoint = -1 
) const
protectedinherited

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

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.

void libMesh::System::prolong_vectors ( )
virtualinherited

Prolong vectors after the mesh has refined.

Definition at line 375 of file system.C.

References libMesh::System::restrict_vectors().

Referenced by libMesh::System::read_parallel_data(), and libMesh::EquationSystems::reinit().

376 {
377 #ifdef LIBMESH_ENABLE_AMR
378  // Currently project_vector handles both restriction and prolongation
379  this->restrict_vectors();
380 #endif
381 }
virtual void restrict_vectors()
Restrict vectors after the mesh has coarsened.
Definition: system.C:322
void libMesh::System::qoi_parameter_hessian ( const QoISet qoi_indices,
const ParameterVector parameters,
SensitivityData hessian 
)
virtualinherited

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 2309 of file system.h.

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

2312 {
2313  libmesh_not_implemented();
2314 }
void libMesh::System::qoi_parameter_hessian_vector_product ( const QoISet qoi_indices,
const ParameterVector parameters,
const ParameterVector vector,
SensitivityData product 
)
virtualinherited

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 2318 of file system.h.

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

2322 {
2323  libmesh_not_implemented();
2324 }
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 515 of file system.C.

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

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

518 {
519  // Forward sensitivities are more efficient for Nq > Np
520  if (qoi_indices.size(*this) > parameters.size())
521  forward_qoi_parameter_sensitivity(qoi_indices, parameters, sensitivities);
522  // Adjoint sensitivities are more efficient for Np > Nq,
523  // and an adjoint may be more reusable than a forward
524  // solution sensitivity in the Np == Nq case.
525  else
526  adjoint_qoi_parameter_sensitivity(qoi_indices, parameters, sensitivities);
527 }
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:2300
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:2291
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 446 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.

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

447 {
448  parallel_object_only();
449 
450  // If this system is empty... don't do anything!
451  if (!this->n_vars())
452  return;
453 
454  const std::vector<dof_id_type> & send_list = this->get_dof_map().get_send_list ();
455 
456  // Check sizes
457  libmesh_assert_equal_to (current_local_solution->size(), solution->size());
458  // Not true with ghosted vectors
459  // libmesh_assert_equal_to (current_local_solution->local_size(), solution->size());
460  // libmesh_assert (!send_list.empty());
461  libmesh_assert_less_equal (send_list.size(), solution->size());
462 
463  // Create current_local_solution from solution. This will
464  // put a local copy of solution into current_local_solution.
465  solution->localize (*current_local_solution, send_list);
466 }
UniquePtr< NumericVector< Number > > current_local_solution
All the values I need to compute my contribution to the simulation at hand.
Definition: system.h:1535
const DofMap & get_dof_map() const
Definition: system.h:2030
UniquePtr< NumericVector< Number > > solution
Data structure to hold solution values.
Definition: system.h:1523
unsigned int n_vars() const
Definition: system.h:2086
const std::vector< dof_id_type > & get_send_list() const
Definition: dof_map.h:394
void libMesh::System::read_header ( Xdr io,
const std::string &  version,
const bool  read_header = true,
const bool  read_additional_data = true,
const bool  read_legacy_format = false 
)
inherited

Reads the basic data header for this System.

Definition at line 115 of file system_io.C.

References libMesh::Xdr::data(), libMesh::FEType::family, libMesh::OrderWrapper::get_order(), libMesh::FEType::inf_map, libMesh::libmesh_assert(), libMesh::MONOMIAL, libMesh::on_command_line(), libMesh::FEType::order, libMesh::out, libMesh::processor_id(), libMesh::FEType::radial_family, libMesh::FEType::radial_order, libMesh::Xdr::reading(), libMesh::Xdr::version(), and libMesh::XYZ.

Referenced by libMesh::EquationSystems::_read_impl(), libMesh::System::project_solution_on_reinit(), and libMesh::RBEvaluation::read_in_vectors_from_multiple_files().

120 {
121  // This method implements the input of a
122  // System object, embedded in the output of
123  // an EquationSystems<T_sys>. This warrants some
124  // documentation. The output file essentially
125  // consists of 5 sections:
126  //
127  // for this system
128  //
129  // 5.) The number of variables in the system (unsigned int)
130  //
131  // for each variable in the system
132  //
133  // 6.) The name of the variable (string)
134  //
135  // 6.1.) Variable subdomains
136  //
137  // 7.) Combined in an FEType:
138  // - The approximation order(s) of the variable
139  // (Order Enum, cast to int/s)
140  // - The finite element family/ies of the variable
141  // (FEFamily Enum, cast to int/s)
142  //
143  // end variable loop
144  //
145  // 8.) The number of additional vectors (unsigned int),
146  //
147  // for each additional vector in the system object
148  //
149  // 9.) the name of the additional vector (string)
150  //
151  // end system
152  libmesh_assert (io.reading());
153 
154  // Possibly clear data structures and start from scratch.
155  if (read_header_in)
156  this->clear ();
157 
158  // Figure out if we need to read infinite element information.
159  // This will be true if the version string contains " with infinite elements"
160  const bool read_ifem_info =
161  (version.rfind(" with infinite elements") < version.size()) ||
162  libMesh::on_command_line ("--read_ifem_systems");
163 
164 
165  {
166  // 5.)
167  // Read the number of variables in the system
168  unsigned int nv=0;
169  if (this->processor_id() == 0)
170  io.data (nv);
171  this->comm().broadcast(nv);
172 
173  _written_var_indices.clear();
174  _written_var_indices.resize(nv, 0);
175 
176  for (unsigned int var=0; var<nv; var++)
177  {
178  // 6.)
179  // Read the name of the var-th variable
180  std::string var_name;
181  if (this->processor_id() == 0)
182  io.data (var_name);
183  this->comm().broadcast(var_name);
184 
185  // 6.1.)
186  std::set<subdomain_id_type> domains;
187  if (io.version() >= LIBMESH_VERSION_ID(0,7,2))
188  {
189  std::vector<subdomain_id_type> domain_array;
190  if (this->processor_id() == 0)
191  io.data (domain_array);
192  for (std::vector<subdomain_id_type>::iterator it = domain_array.begin(); it != domain_array.end(); ++it)
193  domains.insert(*it);
194  }
195  this->comm().broadcast(domains);
196 
197  // 7.)
198  // Read the approximation order(s) of the var-th variable
199  int order=0;
200  if (this->processor_id() == 0)
201  io.data (order);
202  this->comm().broadcast(order);
203 
204 
205  // do the same for infinite element radial_order
206  int rad_order=0;
207  if (read_ifem_info)
208  {
209  if (this->processor_id() == 0)
210  io.data(rad_order);
211  this->comm().broadcast(rad_order);
212  }
213 
214  // Read the finite element type of the var-th variable
215  int fam=0;
216  if (this->processor_id() == 0)
217  io.data (fam);
218  this->comm().broadcast(fam);
219  FEType type;
220  type.order = static_cast<Order>(order);
221  type.family = static_cast<FEFamily>(fam);
222 
223  // Check for incompatibilities. The shape function indexing was
224  // changed for the monomial and xyz finite element families to
225  // simplify extension to arbitrary p. The consequence is that
226  // old restart files will not be read correctly. This is expected
227  // to be an unlikely occurence, but catch it anyway.
228  if (read_legacy_format)
229  if ((type.family == MONOMIAL || type.family == XYZ) &&
230  ((type.order.get_order() > 2 && this->get_mesh().mesh_dimension() == 2) ||
231  (type.order.get_order() > 1 && this->get_mesh().mesh_dimension() == 3)))
232  {
233  libmesh_here();
234  libMesh::out << "*****************************************************************\n"
235  << "* WARNING: reading a potentially incompatible restart file!!! *\n"
236  << "* contact libmesh-users@lists.sourceforge.net for more details *\n"
237  << "*****************************************************************"
238  << std::endl;
239  }
240 
241  // Read additional information for infinite elements
242  int radial_fam=0;
243  int i_map=0;
244  if (read_ifem_info)
245  {
246  if (this->processor_id() == 0)
247  io.data (radial_fam);
248  this->comm().broadcast(radial_fam);
249  if (this->processor_id() == 0)
250  io.data (i_map);
251  this->comm().broadcast(i_map);
252  }
253 
254 #ifdef LIBMESH_ENABLE_INFINITE_ELEMENTS
255 
256  type.radial_order = static_cast<Order>(rad_order);
257  type.radial_family = static_cast<FEFamily>(radial_fam);
258  type.inf_map = static_cast<InfMapType>(i_map);
259 
260 #endif
261 
262  if (read_header_in)
263  {
264  if (domains.empty())
265  _written_var_indices[var] = this->add_variable (var_name, type);
266  else
267  _written_var_indices[var] = this->add_variable (var_name, type, &domains);
268  }
269  else
270  _written_var_indices[var] = this->variable_number(var_name);
271  }
272  }