Go to the documentation of this file.
   20 #ifndef LIBMESH_EQUATION_SYSTEMS_H 
   21 #define LIBMESH_EQUATION_SYSTEMS_H 
   24 #include "libmesh/libmesh_common.h" 
   25 #include "libmesh/parameters.h" 
   26 #include "libmesh/system.h" 
   27 #include "libmesh/parallel_object.h" 
   29 #ifdef LIBMESH_FORWARD_DECLARE_ENUMS 
   35 #include "libmesh/enum_xdr_mode.h" 
   40 # include "libmesh/frequency_system.h" 
   41 # include "libmesh/transient_system.h" 
   42 # include "libmesh/newmark_system.h" 
   43 # include "libmesh/steady_system.h" 
  112   virtual void clear ();
 
  117   virtual void init ();
 
  161   template <
typename T_sys>
 
  170   template <
typename T_sys>
 
  179   template <
typename T_sys>
 
  180   const T_sys & 
get_system (
const unsigned int num) 
const;
 
  188   template <
typename T_sys>
 
  216                                const std::string & 
name);
 
  221   template <
typename T_sys>
 
  232 #ifdef LIBMESH_ENABLE_DEPRECATED 
  240   unsigned int n_vars () 
const;
 
  246   std::size_t 
n_dofs () 
const;
 
  262   virtual void solve ();
 
  292                              const FEType * type=
nullptr,
 
  293                              const std::set<std::string> * system_names=
nullptr) 
const;
 
  304                               const std::string & system_name,
 
  305                               const std::string & variable_name = 
"all_vars") 
const;
 
  315                               const std::set<std::string> * system_names=
nullptr) 
const;
 
  325   std::unique_ptr<NumericVector<Number>>
 
  333                                   std::vector<std::set<subdomain_id_type>> & vars_active_subdomains) 
const;
 
  344                      std::vector<std::string> & names) 
const;
 
  355                                         std::vector<std::string> & names) 
const;
 
  361   std::vector<std::pair<unsigned int, unsigned int>>
 
  363                          const FEType * type=
nullptr) 
const;
 
  381   std::unique_ptr<NumericVector<Number>>
 
  396   (std::vector<Number> & soln,
 
  397    const std::set<std::string> * system_names = 
nullptr,
 
  398    const std::vector<std::string> * var_names = 
nullptr,
 
  399    bool vertices_only = 
false) 
const;
 
  426   template <
typename InValType>
 
  427   void read (
const std::string & 
name,
 
  430              bool partition_agnostic = 
true);
 
  435              bool partition_agnostic = 
true)
 
  436   { read<Number>(
name, mode, read_flags, partition_agnostic); }
 
  438   template <
typename InValType>
 
  439   void read (
const std::string & 
name,
 
  441              bool partition_agnostic = 
true);
 
  445              bool partition_agnostic = 
true)
 
  446   { read<Number>(
name, read_flags, partition_agnostic); }
 
  476               bool partition_agnostic = 
true) 
const;
 
  480               bool partition_agnostic = 
true) 
const;
 
  489                         const Real threshold,
 
  490                         const bool verbose) 
const;
 
  496   virtual std::string 
get_info() 
const;
 
  507   friend std::ostream & 
operator << (std::ostream & os,
 
  611   template <
typename InValType>
 
  614                    const unsigned int read_flags,
 
  615                    bool partition_agnostic = 
true);
 
  654   return cast_int<unsigned int>(
_systems.size());
 
  660 template <
typename T_sys>
 
  664   T_sys * ptr = 
nullptr;
 
  668       const unsigned int sys_num = this->
n_systems();
 
  669       ptr = 
new T_sys(*
this, 
name, sys_num);
 
  684       ptr = &(this->get_system<T_sys>(
name));
 
  704 template <
typename T_sys>
 
  708   libmesh_assert_less (num, this->
n_systems());
 
  714   for (; pos != 
end; ++pos)
 
  715     if (pos->second->number() == num)
 
  720     libmesh_error_msg(
"ERROR: no system number " << num << 
" found!");
 
  723   return *cast_ptr<T_sys *>(pos->second);
 
  729 template <
typename T_sys>
 
  733   libmesh_assert_less (num, this->
n_systems());
 
  738   for (; pos != 
end; ++pos)
 
  739     if (pos->second->number() == num)
 
  744     libmesh_error_msg(
"ERROR: no system number " << num << 
" found!");
 
  747   return *cast_ptr<T_sys *>(pos->second);
 
  755 template <
typename T_sys>
 
  763     libmesh_error_msg(
"ERROR: no system named \"" << 
name << 
"\" found!");
 
  766   return *cast_ptr<T_sys *>(pos->second);
 
  774 template <
typename T_sys>
 
  782     libmesh_error_msg(
"ERROR: no system named " << 
name << 
" found!");
 
  785   return *cast_ptr<T_sys *>(pos->second);
 
  797   return this->get_system<System>(
name);
 
  805   return this->get_system<System>(
name);
 
  813   return this->get_system<System>(num);
 
  821   return this->get_system<System>(num);
 
  828 #endif // LIBMESH_EQUATION_SYSTEMS_H 
  
Manages consistently variables, degrees of freedom, and coefficient vectors.
 
virtual void solve()
Call solve on all the individual equation systems.
 
void build_elemental_solution_vector(std::vector< Number > &soln, std::vector< std::string > &names) const
Retrieve the solution data for CONSTANT MONOMIALs.
 
virtual System & add_system(const std::string &system_type, const std::string &name)
Add the system of type system_type named name to the systems array.
 
const MeshBase & get_mesh() const
 
void allgather()
Serializes a distributed mesh and its associated degree of freedom numbering for all systems.
 
This class implements reference counting.
 
The libMesh namespace provides an interface to certain functionality in the library.
 
const T_sys & get_system(const std::string &name) const
 
void read(const std::string &name, const unsigned int read_flags=(READ_HEADER|READ_DATA), bool partition_agnostic=true)
 
void build_solution_vector(std::vector< Number > &soln, const std::string &system_name, const std::string &variable_name="all_vars") const
Fill the input vector soln with the solution values for the system named name.
 
IterBase * end
Also have a polymorphic pointer to the end object, this prevents iterating past the end.
 
void _read_impl(const std::string &name, const XdrMODE, const unsigned int read_flags, bool partition_agnostic=true)
Actual read implementation.
 
virtual void sensitivity_solve(const ParameterVector ¶meters)
Call sensitivity_solve on all the individual equation systems.
 
friend std::ostream & operator<<(std::ostream &os, const EquationSystems &es)
Same as above, but allows you to also use stream syntax.
 
EquationSystems(MeshBase &mesh)
Constructor.
 
bool has_system(const std::string &name) const
 
void _remove_default_ghosting(unsigned int sys_num)
This just calls DofMap::remove_default_ghosting() but using a shim lets us forward-declare DofMap.
 
bool refine_in_reinit_flag()
 
std::vector< std::pair< unsigned int, unsigned int > > find_variable_numbers(std::vector< std::string > &names, const FEType *type=nullptr) const
Finds system and variable numbers for any variables of type corresponding to the entries in the input...
 
This is the MeshBase class.
 
std::size_t n_active_dofs() const
 
XdrMODE
Defines an enum for read/write mode in Xdr format.
 
Data structure for specifying which Quantities of Interest should be calculated in an adjoint or a pa...
 
virtual void reinit_systems()
Reinitialize all systems on the current mesh.
 
void build_variable_names(std::vector< std::string > &var_names, const FEType *type=nullptr, const std::set< std::string > *system_names=nullptr) const
Fill the input vector var_names with the names of the variables for each system.
 
bool reinit_solutions()
Handle any mesh changes and project any solutions onto the updated mesh.
 
std::map< std::string, System * >::const_iterator const_system_iterator
Typedef for constant system iterators.
 
void update()
Updates local values for all the systems.
 
virtual void init()
Initialize all the systems.
 
unsigned int n_vars() const
 
Data structure for specifying which Parameters should be independent variables in a parameter sensiti...
 
bool _enable_default_ghosting
Flag for whether to enable default ghosting on newly added Systems.
 
std::map< std::string, System * >::iterator system_iterator
Typedef for system iterators.
 
virtual void enable_default_ghosting(bool enable)
Enable or disable default ghosting functors on the Mesh and on all Systems.
 
unsigned int n_systems() const
 
ReadFlags
Define enumeration to set properties in EquationSystems::read()
 
MeshBase & _mesh
The mesh data structure.
 
std::size_t n_dofs() const
 
void read(const std::string &name, const XdrMODE, const unsigned int read_flags=(READ_HEADER|READ_DATA), bool partition_agnostic=true)
Read & initialize the systems from disk using the XDR data format.
 
void print_info(std::ostream &os=libMesh::out) const
Prints information about the equation systems, by default to libMesh::out.
 
This is the EquationSystems class.
 
void disable_refine_in_reinit()
Calls to reinit() will not try to coarsen or refine the mesh.
 
virtual void reinit()
Handle any mesh changes and reinitialize all the systems on the updated mesh.
 
virtual bool compare(const EquationSystems &other_es, const Real threshold, const bool verbose) const
 
std::map< std::string, System * > _systems
Data structure holding the systems.
 
class FEType hides (possibly multiple) FEFamily and approximation orders, thereby enabling specialize...
 
virtual std::string get_info() const
 
void build_discontinuous_solution_vector(std::vector< Number > &soln, const std::set< std::string > *system_names=nullptr, const std::vector< std::string > *var_names=nullptr, bool vertices_only=false) const
Fill the input vector soln with solution values.
 
virtual void clear()
Restores the data structure to a pristine state.
 
void read(const std::string &name, const XdrMODE mode, const unsigned int read_flags=(READ_HEADER|READ_DATA), bool partition_agnostic=true)
 
bool _refine_in_reinit
Flag for whether to call coarsen/refine in reinit().
 
void write(const std::string &name, const XdrMODE, const unsigned int write_flags=(WRITE_DATA), bool partition_agnostic=true) const
Write the systems to disk using the XDR data format.
 
virtual void adjoint_solve(const QoISet &qoi_indices=QoISet())
Call adjoint_solve on all the individual equation systems.
 
virtual ~EquationSystems()
Destructor.
 
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
 
An object whose state is distributed along a set of processors.
 
std::unique_ptr< NumericVector< Number > > build_parallel_elemental_solution_vector(std::vector< std::string > &names) const
Builds a parallel vector of CONSTANT MONOMIAL solution values corresponding to the entries in the inp...
 
std::unique_ptr< NumericVector< Number > > build_parallel_solution_vector(const std::set< std::string > *system_names=nullptr) const
A version of build_solution_vector which is appropriate for "parallel" output formats like Nemesis.
 
void delete_system(const std::string &name)
Remove the system named name from the systems array.
 
void get_solution(std::vector< Number > &soln, std::vector< std::string > &names) const
Retrieve the solution data for CONSTANT MONOMIALs.
 
void _add_system_to_nodes_and_elems()
This function is used in the implementation of add_system, it loops over the nodes and elements of th...
 
void ErrorVector unsigned int
 
This class provides the ability to map between arbitrary, user-defined strings and several data types...
 
std::string name(const ElemQuality q)
This function returns a string containing some name for q.
 
WriteFlags
Define enumeration to set properties in EquationSystems::write()
 
void get_vars_active_subdomains(const std::vector< std::string > &names, std::vector< std::set< subdomain_id_type >> &vars_active_subdomains) const
Retrieve vars_active_subdomains, which indicates the active subdomains for each variable in names.
 
void enable_refine_in_reinit()
Calls to reinit() will also do two-step coarsen-then-refine.
 
Parameters parameters
Data structure holding arbitrary parameters.