libMesh
Classes | Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | Protected Types | Protected Member Functions | Protected Attributes | Static Protected Attributes | Private Attributes | Friends | List of all members
Biharmonic Class Reference

The Biharmonic class encapsulates most of the data structures necessary to calculate the biharmonic residual and Jacobian, auxiliary quantities, to take a timestep, and to output the state – biharmonic solution and vectors of auxiliary quantities. More...

#include <biharmonic.h>

Inheritance diagram for Biharmonic:
[legend]

Classes

class  JR
 Biharmonic's friend class definition. More...
 

Public Types

enum  InitialStateEnum { STRIP = 0, ROD = 1, BALL = 2 }
 
enum  FreeEnergyEnum { DOUBLE_WELL = 1, DOUBLE_OBSTACLE = 2, LOG_DOUBLE_WELL = 3, LOG_DOUBLE_OBSTACLE = 4 }
 
enum  ReadFlags {
  READ_HEADER = 1, READ_DATA = 2, READ_ADDITIONAL_DATA = 4, READ_LEGACY_FORMAT = 8,
  TRY_READ_IFEMS = 16, READ_BASIC_ONLY = 32
}
 Define enumeration to set properties in EquationSystems::read() More...
 
enum  WriteFlags { WRITE_DATA = 1, WRITE_ADDITIONAL_DATA = 2, WRITE_PARALLEL_FILES = 4, WRITE_SERIAL_FILES = 8 }
 Define enumeration to set properties in EquationSystems::write() More...
 

Public Member Functions

 Biharmonic (ReplicatedMesh &mesh)
 Constructor retrieves command-line options, setting defaults, if necessary. More...
 
 ~Biharmonic ()
 Destructor. More...
 
bool verbose ()
 
Real dt0 ()
 
Real dt ()
 
void viewParameters ()
 
void init ()
 Initialize all the systems. More...
 
void step (const Real &dt=-1.0)
 
void output (int timestep, const Real &t, Real &o_t, bool force=false)
 
void run ()
 
virtual void clear ()
 Restores the data structure to a pristine state. More...
 
virtual void reinit ()
 Handle any mesh changes and reinitialize all the systems on the updated mesh. More...
 
virtual void enable_default_ghosting (bool enable)
 Enable or disable default ghosting functors on the Mesh and on all Systems. More...
 
void update ()
 Updates local values for all the systems. More...
 
unsigned int n_systems () const
 
bool has_system (const std::string &name) const
 
template<typename T_sys >
const T_sys & get_system (const std::string &name) const
 
template<typename T_sys >
T_sys & get_system (const std::string &name)
 
template<typename T_sys >
const T_sys & get_system (const unsigned int num) const
 
template<typename T_sys >
T_sys & get_system (const unsigned int num)
 
const System & get_system (const std::string &name) const
 
System & get_system (const std::string &name)
 
const System & get_system (const unsigned int num) const
 
System & get_system (const unsigned int num)
 
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. More...
 
template<typename T_sys >
T_sys & add_system (const std::string &name)
 Add the system named name to the systems array. More...
 
void delete_system (const std::string &name)
 Remove the system named name from the systems array. More...
 
unsigned int n_vars () const
 
std::size_t n_dofs () const
 
std::size_t n_active_dofs () const
 
virtual void solve ()
 Call solve on all the individual equation systems. More...
 
virtual void adjoint_solve (const QoISet &qoi_indices=QoISet())
 Call adjoint_solve on all the individual equation systems. More...
 
virtual void sensitivity_solve (const ParameterVector &parameters)
 Call sensitivity_solve on all the individual equation systems. More...
 
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. More...
 
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. More...
 
void build_solution_vector (std::vector< Number > &soln, const std::set< std::string > *system_names=nullptr) const
 Fill the input vector soln with solution values. More...
 
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. More...
 
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. More...
 
void get_solution (std::vector< Number > &soln, std::vector< std::string > &names) const
 Retrieve the solution data for CONSTANT MONOMIALs. More...
 
void build_elemental_solution_vector (std::vector< Number > &soln, std::vector< std::string > &names) const
 Retrieve the solution data for CONSTANT MONOMIALs. More...
 
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 input 'names' vector. More...
 
void build_discontinuous_solution_vector (std::vector< Number > &soln, const std::set< std::string > *system_names=nullptr) const
 Fill the input vector soln with solution values. More...
 
template<typename InValType >
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. More...
 
void read (const std::string &name, const XdrMODE mode, const unsigned int read_flags=(READ_HEADER|READ_DATA), bool partition_agnostic=true)
 
template<typename InValType >
void read (const std::string &name, const unsigned int read_flags=(READ_HEADER|READ_DATA), bool partition_agnostic=true)
 
void read (const std::string &name, const unsigned int read_flags=(READ_HEADER|READ_DATA), bool partition_agnostic=true)
 
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. More...
 
void write (const std::string &name, const unsigned int write_flags=(WRITE_DATA), bool partition_agnostic=true) const
 
virtual bool compare (const EquationSystems &other_es, const Real threshold, const bool verbose) const
 
virtual std::string get_info () const
 
void print_info (std::ostream &os=libMesh::out) const
 Prints information about the equation systems, by default to libMesh::out. More...
 
const MeshBase & get_mesh () const
 
MeshBase & get_mesh ()
 
void allgather ()
 Serializes a distributed mesh and its associated degree of freedom numbering for all systems. More...
 
void enable_refine_in_reinit ()
 Calls to reinit() will also do two-step coarsen-then-refine. More...
 
void disable_refine_in_reinit ()
 Calls to reinit() will not try to coarsen or refine the mesh. More...
 
bool refine_in_reinit_flag ()
 
bool reinit_solutions ()
 Handle any mesh changes and project any solutions onto the updated mesh. More...
 
virtual void reinit_systems ()
 Reinitialize all systems on the current mesh. More...
 
const Parallel::Communicator & comm () 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

Parameters parameters
 Data structure holding arbitrary parameters. More...
 

Protected Types

typedef std::map< std::string, System * >::iterator system_iterator
 Typedef for system iterators. More...
 
typedef std::map< std::string, System * >::const_iterator const_system_iterator
 Typedef for constant system iterators. More...
 
typedef std::map< std::string, std::pair< unsigned int, unsigned int > > Counts
 Data structure to log the information. More...
 

Protected Member Functions

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

std::map< std::string, System * > _systems
 Data structure holding the systems. More...
 
bool _refine_in_reinit
 Flag for whether to call coarsen/refine in reinit(). More...
 
bool _enable_default_ghosting
 Flag for whether to enable default ghosting on newly added Systems. More...
 
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
 Flag to control whether reference count information is printed when print_info is called. More...
 

Private Attributes

unsigned int _dim
 
unsigned int _N
 
Real _kappa
 
Real _theta
 
Real _theta_c
 
Real _tol
 
bool _growth
 
bool _degenerate
 
bool _cahn_hillard
 
bool _netforce
 
FreeEnergyEnum _energy
 
int _log_truncation
 
bool _verbose
 
InitialStateEnum _initialState
 
Point _initialCenter
 
Real _initialWidth
 
Real _dt0
 
Real _dt
 
Real _t0
 
Real _T
 
Real _t1
 
Real _cnWeight
 
std::string _ofile_base
 
std::string _ofile
 
std::unique_ptr< ExodusII_IO_exio
 
Real _o_dt
 
int _o_count
 
ReplicatedMesh_mesh
 
JR_jr
 

Friends

class JR
 

Detailed Description

The Biharmonic class encapsulates most of the data structures necessary to calculate the biharmonic residual and Jacobian, auxiliary quantities, to take a timestep, and to output the state – biharmonic solution and vectors of auxiliary quantities.

The main reason for this design is to have a data structure that has all of the necessary data in one place, where all of the calculation subroutines can access these data. Currently these data are split up among several interdependent objects with no clear hierarchy between them: mesh, equation system, equation system bundle, residual/Jacobian calculator.

Since no object contains all others and the data are distributed among many objects, the natural control and data flow resides outside of these objects and is typically implemented in main(). We, however, would like to split the calculation into natural chunks – subroutines – while retaining these subroutines access to the common necessary data – biharmonic parameters, mesh and time interval sizes, etc. Thus, class Biharmonic. Finally, making Biharmonic inherit from EquationSystems makes it possible to include it in the most common callbacks that do not pass back a user context, but only an EquationSystems object.

Definition at line 45 of file biharmonic.h.

Member Typedef Documentation

◆ const_system_iterator

typedef std::map<std::string, System *>::const_iterator libMesh::EquationSystems::const_system_iterator
protectedinherited

Typedef for constant system iterators.

Definition at line 566 of file equation_systems.h.

◆ Counts

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

Data structure to log the information.

The log is identified by the class name.

Definition at line 117 of file reference_counter.h.

◆ system_iterator

typedef std::map<std::string, System *>::iterator libMesh::EquationSystems::system_iterator
protectedinherited

Typedef for system iterators.

Definition at line 561 of file equation_systems.h.

Member Enumeration Documentation

◆ FreeEnergyEnum

Enumerator
DOUBLE_WELL 
DOUBLE_OBSTACLE 
LOG_DOUBLE_WELL 
LOG_DOUBLE_OBSTACLE 

Definition at line 54 of file biharmonic.h.

◆ InitialStateEnum

Enumerator
STRIP 
ROD 
BALL 

Definition at line 49 of file biharmonic.h.

49  {STRIP = 0,
50  ROD = 1,
51  BALL = 2};

◆ ReadFlags

Define enumeration to set properties in EquationSystems::read()

Enumerator
READ_HEADER 
READ_DATA 
READ_ADDITIONAL_DATA 
READ_LEGACY_FORMAT 
TRY_READ_IFEMS 
READ_BASIC_ONLY 

Definition at line 83 of file equation_systems.h.

◆ WriteFlags

Define enumeration to set properties in EquationSystems::write()

Enumerator
WRITE_DATA 
WRITE_ADDITIONAL_DATA 
WRITE_PARALLEL_FILES 
WRITE_SERIAL_FILES 

Definition at line 93 of file equation_systems.h.

Constructor & Destructor Documentation

◆ Biharmonic()

Biharmonic::Biharmonic ( ReplicatedMesh mesh)

Constructor retrieves command-line options, setting defaults, if necessary.

It then builds the mesh using these options, then the equations systems around it, and, finally, sets up the output. We recommend that this be used through the factory Create function, which allocates the mesh. In that case don't forget to call Destroy at the end, to free the mesh up.

◆ ~Biharmonic()

Biharmonic::~Biharmonic ( )

Destructor.

Definition at line 72 of file biharmonic.h.

73  {
74  // delete _meshRefinement;
75  }

Member Function Documentation

◆ add_system() [1/2]

virtual System& libMesh::EquationSystems::add_system ( const std::string &  system_type,
const std::string &  name 
)
virtualinherited

Add the system of type system_type named name to the systems array.

Referenced by build_system(), TimeSolverTestImplementation< TimeSolverType >::run_test_with_exact_soln(), and FETest< order, family, elem_type >::setUp().

◆ add_system() [2/2]

template<typename T_sys >
T_sys & libMesh::EquationSystems::add_system ( const std::string &  name)
inherited

Add the system named name to the systems array.

Definition at line 647 of file equation_systems.h.

References libMesh::EquationSystems::_add_system_to_nodes_and_elems(), libMesh::EquationSystems::_enable_default_ghosting, libMesh::EquationSystems::_remove_default_ghosting(), libMesh::EquationSystems::_systems, libMesh::EquationSystems::n_systems(), and libMesh::Quality::name().

648 {
649  T_sys * ptr = nullptr;
650 
651  if (!_systems.count(name))
652  {
653  const unsigned int sys_num = this->n_systems();
654  ptr = new T_sys(*this, name, sys_num);
655 
656  _systems.insert (std::make_pair(name, ptr));
657 
659  this->_remove_default_ghosting(sys_num);
660 
661  // Tell all the \p DofObject entities to add a system.
663  }
664  else
665  {
666  // We now allow redundant add_system calls, to make it
667  // easier to load data from files for user-derived system
668  // subclasses
669  ptr = &(this->get_system<T_sys>(name));
670  }
671 
672  // Return a dynamically casted reference to the newly added System.
673  return *ptr;
674 }
std::string name(const ElemQuality q)
unsigned int n_systems() const
bool _enable_default_ghosting
Flag for whether to enable default ghosting on newly added Systems.
void _remove_default_ghosting(unsigned int sys_num)
This just calls DofMap::remove_default_ghosting() but using a shim lets us forward-declare DofMap...
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...
std::map< std::string, System * > _systems
Data structure holding the systems.

◆ adjoint_solve()

virtual void libMesh::EquationSystems::adjoint_solve ( const QoISet qoi_indices = QoISet())
virtualinherited

Call adjoint_solve on all the individual equation systems.

By default this function solves each system's adjoint once, in the reverse order from that in which they were added. For more sophisticated decoupled problems the user may with to override this behavior in a derived class.

◆ allgather()

void libMesh::EquationSystems::allgather ( )
inherited

Serializes a distributed mesh and its associated degree of freedom numbering for all systems.

◆ build_discontinuous_solution_vector()

void libMesh::EquationSystems::build_discontinuous_solution_vector ( std::vector< Number > &  soln,
const std::set< std::string > *  system_names = nullptr 
) const
inherited

Fill the input vector soln with solution values.

The entries will be in variable-major format (corresponding to the names from build_variable_names()). If systems_names!=nullptr, only include data from the specified systems.

◆ build_elemental_solution_vector()

void libMesh::EquationSystems::build_elemental_solution_vector ( std::vector< Number > &  soln,
std::vector< std::string > &  names 
) const
inherited

Retrieve the solution data for CONSTANT MONOMIALs.

If names is populated, only the variables corresponding to those names will be retrieved. This can be used to filter which variables are retrieved.

This is the more appropriately-named replacement for the get_solution() function defined above.

◆ build_parallel_elemental_solution_vector()

std::unique_ptr<NumericVector<Number> > libMesh::EquationSystems::build_parallel_elemental_solution_vector ( std::vector< std::string > &  names) const
inherited

Builds a parallel vector of CONSTANT MONOMIAL solution values corresponding to the entries in the input 'names' vector.

This vector is approximately uniformly distributed across all of the available processors.

The related function build_elemental_solution_vector() is implemented by calling this function and then calling localize_to_one() on the resulting vector.

Returns
A nullptr (if no CONSTANT, MONOMIAL variables exist on the system) or a std::unique_ptr to a var-major numeric vector of total length n_elem * n_vars ordered according to: [u0, u1, ... uN, v0, v1, ... vN, w0, w1, ... wN] for constant monomial variables (u, v, w) on a mesh with N elements.

◆ build_parallel_solution_vector()

std::unique_ptr<NumericVector<Number> > libMesh::EquationSystems::build_parallel_solution_vector ( const std::set< std::string > *  system_names = nullptr) const
inherited

A version of build_solution_vector which is appropriate for "parallel" output formats like Nemesis.

Returns
A std::unique_ptr to a node-major NumericVector of total length n_nodes*n_vars that various I/O classes can then use to get the local values they need to write on each processor.

◆ build_solution_vector() [1/2]

void libMesh::EquationSystems::build_solution_vector ( std::vector< Number > &  soln,
const std::string &  system_name,
const std::string &  variable_name = "all_vars" 
) const
inherited

Fill the input vector soln with the solution values for the system named name.

Note
The input vector soln will only be assembled on processor 0, so this method is only applicable to outputting plot files from processor 0.

◆ build_solution_vector() [2/2]

void libMesh::EquationSystems::build_solution_vector ( std::vector< Number > &  soln,
const std::set< std::string > *  system_names = nullptr 
) const
inherited

Fill the input vector soln with solution values.

The entries will be in variable-major format (corresponding to the names from build_variable_names()). If systems_names!=nullptr, only include data from the specified systems.

◆ build_variable_names()

void libMesh::EquationSystems::build_variable_names ( std::vector< std::string > &  var_names,
const FEType type = nullptr,
const std::set< std::string > *  system_names = nullptr 
) const
inherited

Fill the input vector var_names with the names of the variables for each system.

If type is passed, only variables of the specified type will be populated. If systems_names!=nullptr, only include names from the specified systems.

◆ clear()

virtual void libMesh::EquationSystems::clear ( )
virtualinherited

Restores the data structure to a pristine state.

◆ comm()

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::EpetraVector< T >::EpetraVector(), libMesh::Parallel::sync_element_data_by_parent_id(), libMesh::Parallel::sync_node_data_by_element_id(), and libMesh::Parallel::sync_node_data_by_element_id_once().

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

◆ compare()

virtual bool libMesh::EquationSystems::compare ( const EquationSystems other_es,
const Real  threshold,
const bool  verbose 
) const
virtualinherited
Returns
true when this equation system contains identical data, up to the given threshold. Delegates most of the comparisons to perform to the responsible systems

◆ delete_system()

void libMesh::EquationSystems::delete_system ( const std::string &  name)
inherited

Remove the system named name from the systems array.

Deprecated:
This function may not work as intended and has not been actively tested over the years. If you need the ability to delete a System from an EquationSystems object, it could probably be added.

◆ disable_print_counter_info()

static void libMesh::ReferenceCounter::disable_print_counter_info ( )
staticinherited

◆ disable_refine_in_reinit()

void libMesh::EquationSystems::disable_refine_in_reinit ( )
inherited

Calls to reinit() will not try to coarsen or refine the mesh.

Definition at line 519 of file equation_systems.h.

References libMesh::EquationSystems::_refine_in_reinit.

519 { this->_refine_in_reinit = false; }
bool _refine_in_reinit
Flag for whether to call coarsen/refine in reinit().

◆ dt()

Real Biharmonic::dt ( )

Definition at line 81 of file biharmonic.h.

References _dt.

81 { return _dt; }

◆ dt0()

Real Biharmonic::dt0 ( )

Definition at line 80 of file biharmonic.h.

References _dt0.

80 { return _dt0; }

◆ enable_default_ghosting()

virtual void libMesh::EquationSystems::enable_default_ghosting ( bool  enable)
virtualinherited

Enable or disable default ghosting functors on the Mesh and on all Systems.

Standard ghosting is enabled by default. If disabled, default ghosting will also be disabled on any later added systems.

Unless other equivalent ghosting functors have been added, removing the default coupling functor is only safe for explicit solves, and removing the default algebraic ghosting functor is only safe for codes where no evaluations on neighbor cells (e.g. no jump error estimators) are done.

◆ enable_print_counter_info()

static void libMesh::ReferenceCounter::enable_print_counter_info ( )
staticinherited

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

◆ enable_refine_in_reinit()

void libMesh::EquationSystems::enable_refine_in_reinit ( )
inherited

Calls to reinit() will also do two-step coarsen-then-refine.

Definition at line 514 of file equation_systems.h.

References libMesh::EquationSystems::_refine_in_reinit.

514 { this->_refine_in_reinit = true; }
bool _refine_in_reinit
Flag for whether to call coarsen/refine in reinit().

◆ get_info() [1/2]

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

Gets a string containing the reference information.

◆ get_info() [2/2]

virtual std::string libMesh::EquationSystems::get_info ( ) const
virtualinherited
Returns
A string containing information about the systems, flags, and parameters.

◆ get_mesh() [1/2]

const MeshBase & libMesh::EquationSystems::get_mesh ( ) const
inherited
Returns
A constant reference to the mesh

Definition at line 622 of file equation_systems.h.

References libMesh::EquationSystems::_mesh.

623 {
624  return _mesh;
625 }
MeshBase & _mesh
The mesh data structure.

◆ get_mesh() [2/2]

MeshBase & libMesh::EquationSystems::get_mesh ( )
inherited
Returns
A reference to the mesh

Definition at line 630 of file equation_systems.h.

References libMesh::EquationSystems::_mesh.

631 {
632  return _mesh;
633 }
MeshBase & _mesh
The mesh data structure.

◆ get_solution()

void libMesh::EquationSystems::get_solution ( std::vector< Number > &  soln,
std::vector< std::string > &  names 
) const
inherited

Retrieve the solution data for CONSTANT MONOMIALs.

If names is populated, only the variables corresponding to those names will be retrieved. This can be used to filter which variables are retrieved.

Deprecated:
Call the more appropriately-named build_elemental_solution_vector() instead.

◆ get_system() [1/8]

template<typename T_sys >
const T_sys & libMesh::EquationSystems::get_system ( const std::string &  name) const
inherited
Returns
A constant reference to the system named name. The template argument defines the return type. For example, const SteadySystem & sys = eq.get_system<SteadySystem> ("sys"); is an example of how the method might be used

Definition at line 742 of file equation_systems.h.

References libMesh::EquationSystems::_systems, and libMesh::Quality::name().

743 {
744  const_system_iterator pos = _systems.find(name);
745 
746  // Check for errors
747  if (pos == _systems.end())
748  libmesh_error_msg("ERROR: no system named \"" << name << "\" found!");
749 
750  // Attempt dynamic cast
751  return *cast_ptr<T_sys *>(pos->second);
752 }
std::string name(const ElemQuality q)
std::map< std::string, System * >::const_iterator const_system_iterator
Typedef for constant system iterators.
std::map< std::string, System * > _systems
Data structure holding the systems.

◆ get_system() [2/8]

template<typename T_sys >
T_sys & libMesh::EquationSystems::get_system ( const std::string &  name)
inherited
Returns
A writable reference to the system named name. The template argument defines the return type. For example, const SteadySystem & sys = eq.get_system<SteadySystem> ("sys"); is an example of how the method might be used

Definition at line 761 of file equation_systems.h.

References libMesh::EquationSystems::_systems, and libMesh::Quality::name().

762 {
763  system_iterator pos = _systems.find(name);
764 
765  // Check for errors
766  if (pos == _systems.end())
767  libmesh_error_msg("ERROR: no system named " << name << " found!");
768 
769  // Attempt dynamic cast
770  return *cast_ptr<T_sys *>(pos->second);
771 }
std::string name(const ElemQuality q)
std::map< std::string, System * >::iterator system_iterator
Typedef for system iterators.
std::map< std::string, System * > _systems
Data structure holding the systems.

◆ get_system() [3/8]

template<typename T_sys >
const T_sys & libMesh::EquationSystems::get_system ( const unsigned int  num) const
inherited
Returns
A constant reference to system number num. The template argument defines the return type. For example, const SteadySystem & sys = eq.get_system<SteadySystem> (0); is an example of how the method might be used

Definition at line 691 of file equation_systems.h.

References libMesh::EquationSystems::_systems, end, and libMesh::EquationSystems::n_systems().

692 {
693  libmesh_assert_less (num, this->n_systems());
694 
695 
696  const_system_iterator pos = _systems.begin();
697  const const_system_iterator end = _systems.end();
698 
699  for (; pos != end; ++pos)
700  if (pos->second->number() == num)
701  break;
702 
703  // Check for errors
704  if (pos == end)
705  libmesh_error_msg("ERROR: no system number " << num << " found!");
706 
707  // Attempt dynamic cast
708  return *cast_ptr<T_sys *>(pos->second);
709 }
unsigned int n_systems() const
IterBase * end
Also have a polymorphic pointer to the end object, this prevents iterating past the end...
std::map< std::string, System * >::const_iterator const_system_iterator
Typedef for constant system iterators.
std::map< std::string, System * > _systems
Data structure holding the systems.

◆ get_system() [4/8]

template<typename T_sys >
T_sys & libMesh::EquationSystems::get_system ( const unsigned int  num)
inherited
Returns
A writable reference to the system number num. The template argument defines the return type. For example, const SteadySystem & sys = eq.get_system<SteadySystem> (0); is an example of how the method might be used

Definition at line 716 of file equation_systems.h.

References libMesh::EquationSystems::_systems, end, and libMesh::EquationSystems::n_systems().

717 {
718  libmesh_assert_less (num, this->n_systems());
719 
720  const_system_iterator pos = _systems.begin();
721  const const_system_iterator end = _systems.end();
722 
723  for (; pos != end; ++pos)
724  if (pos->second->number() == num)
725  break;
726 
727  // Check for errors
728  if (pos == end)
729  libmesh_error_msg("ERROR: no system number " << num << " found!");
730 
731  // Attempt dynamic cast
732  return *cast_ptr<T_sys *>(pos->second);
733 }
unsigned int n_systems() const
IterBase * end
Also have a polymorphic pointer to the end object, this prevents iterating past the end...
std::map< std::string, System * >::const_iterator const_system_iterator
Typedef for constant system iterators.
std::map< std::string, System * > _systems
Data structure holding the systems.

◆ get_system() [5/8]

const System & libMesh::EquationSystems::get_system ( const std::string &  name) const
inherited
Returns
A constant reference to the system named name.

Definition at line 780 of file equation_systems.h.

References libMesh::Quality::name().

781 {
782  return this->get_system<System>(name);
783 }
std::string name(const ElemQuality q)

◆ get_system() [6/8]

System & libMesh::EquationSystems::get_system ( const std::string &  name)
inherited
Returns
A writable reference to the system named name.

Definition at line 788 of file equation_systems.h.

References libMesh::Quality::name().

789 {
790  return this->get_system<System>(name);
791 }
std::string name(const ElemQuality q)

◆ get_system() [7/8]

const System & libMesh::EquationSystems::get_system ( const unsigned int  num) const
inherited
Returns
A constant reference to system number num.

Definition at line 796 of file equation_systems.h.

797 {
798  return this->get_system<System>(num);
799 }

◆ get_system() [8/8]

System & libMesh::EquationSystems::get_system ( const unsigned int  num)
inherited
Returns
A writable reference to the system number num.

Definition at line 804 of file equation_systems.h.

805 {
806  return this->get_system<System>(num);
807 }

◆ get_vars_active_subdomains()

void libMesh::EquationSystems::get_vars_active_subdomains ( const std::vector< std::string > &  names,
std::vector< std::set< subdomain_id_type >> &  vars_active_subdomains 
) const
inherited

Retrieve vars_active_subdomains, which indicates the active subdomains for each variable in names.

◆ has_system()

bool libMesh::EquationSystems::has_system ( const std::string &  name) const
inherited
Returns
true if the system named name exists within this EquationSystems object.

Definition at line 679 of file equation_systems.h.

References libMesh::EquationSystems::_systems, and libMesh::Quality::name().

680 {
681  if (_systems.find(name) == _systems.end())
682  return false;
683  return true;
684 }
std::string name(const ElemQuality q)
std::map< std::string, System * > _systems
Data structure holding the systems.

◆ increment_constructor_count()

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 181 of file reference_counter.h.

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

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

182 {
183  Threads::spin_mutex::scoped_lock lock(Threads::spin_mtx);
184  std::pair<unsigned int, unsigned int> & p = _counts[name];
185 
186  p.first++;
187 }
std::string name(const ElemQuality q)
static Counts _counts
Actually holds the data.
spin_mutex spin_mtx
A convenient spin mutex object which can be used for obtaining locks.

◆ increment_destructor_count()

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 194 of file reference_counter.h.

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

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

195 {
196  Threads::spin_mutex::scoped_lock lock(Threads::spin_mtx);
197  std::pair<unsigned int, unsigned int> & p = _counts[name];
198 
199  p.second++;
200 }
std::string name(const ElemQuality q)
static Counts _counts
Actually holds the data.
spin_mutex spin_mtx
A convenient spin mutex object which can be used for obtaining locks.

◆ init()

void Biharmonic::init ( )
virtual

Initialize all the systems.

Reimplemented from libMesh::EquationSystems.

◆ n_active_dofs()

std::size_t libMesh::EquationSystems::n_active_dofs ( ) const
inherited
Returns
The number of active degrees of freedom for the EquationSystems object.

◆ n_dofs()

std::size_t libMesh::EquationSystems::n_dofs ( ) const
inherited
Returns
The total number of degrees of freedom in all systems.

◆ n_objects()

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

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

Definition at line 83 of file reference_counter.h.

References libMesh::ReferenceCounter::_n_objects.

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

◆ n_processors()

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::MeshBase::partition().

94  { return cast_int<processor_id_type>(_communicator.size()); }
processor_id_type size() const
Definition: communicator.h:175
const Parallel::Communicator & _communicator

◆ n_systems()

unsigned int libMesh::EquationSystems::n_systems ( ) const
inherited
Returns
The number of equation systems.

Definition at line 637 of file equation_systems.h.

References libMesh::EquationSystems::_systems.

Referenced by libMesh::EquationSystems::add_system(), and libMesh::EquationSystems::get_system().

638 {
639  return cast_int<unsigned int>(_systems.size());
640 }
std::map< std::string, System * > _systems
Data structure holding the systems.

◆ n_vars()

unsigned int libMesh::EquationSystems::n_vars ( ) const
inherited
Returns
The total number of variables in all systems.

◆ output()

void Biharmonic::output ( int  timestep,
const Real &  t,
Real &  o_t,
bool  force = false 
)

◆ print_info() [1/2]

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

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

◆ print_info() [2/2]

void libMesh::EquationSystems::print_info ( std::ostream &  os = libMesh::out) const
inherited

Prints information about the equation systems, by default to libMesh::out.

◆ processor_id()

processor_id_type libMesh::ParallelObject::processor_id ( ) const
inherited

◆ read() [1/4]

template<typename InValType >
void libMesh::EquationSystems::read ( const std::string &  name,
const XdrMODE  ,
const unsigned int  read_flags = (READ_HEADER|READ_DATA),
bool  partition_agnostic = true 
)
inherited

Read & initialize the systems from disk using the XDR data format.

This format allows for machine-independent binary output.

Set which sections of the file to read by bitwise OR'ing the EquationSystems::ReadFlags enumeration together. For example, to read all sections of the file, set read_flags to: (READ_HEADER | READ_DATA | READ_ADDITIONAL_DATA)

Note
The equation system can be defined without initializing the data vectors to any solution values. This can be done by omitting READ_DATA in the read_flags parameter.

If XdrMODE is omitted, it will be inferred as READ for filenames containing .xda or as DECODE for filenames containing .xdr

Parameters
nameName of the file to be read.
read_flagsSingle flag created by bitwise-OR'ing several flags together.
modeControls whether reading is done in binary or ascii mode.
partition_agnosticIf true then the mesh and degrees of freedom will be temporarily renumbered in a partition agnostic way so that files written using "n" mpi processes can be re-read on "m" mpi processes. This renumbering is not compatible with meshes that have two nodes in exactly the same position!

◆ read() [2/4]

void libMesh::EquationSystems::read ( const std::string &  name,
const XdrMODE  mode,
const unsigned int  read_flags = (READ_HEADER | READ_DATA),
bool  partition_agnostic = true 
)
inherited

Definition at line 417 of file equation_systems.h.

References libMesh::Quality::name().

421  { read<Number>(name, mode, read_flags, partition_agnostic); }
std::string name(const ElemQuality q)

◆ read() [3/4]

template<typename InValType >
void libMesh::EquationSystems::read ( const std::string &  name,
const unsigned int  read_flags = (READ_HEADER|READ_DATA),
bool  partition_agnostic = true 
)
inherited

◆ read() [4/4]

void libMesh::EquationSystems::read ( const std::string &  name,
const unsigned int  read_flags = (READ_HEADER | READ_DATA),
bool  partition_agnostic = true 
)
inherited

Definition at line 428 of file equation_systems.h.

References libMesh::Quality::name().

431  { read<Number>(name, read_flags, partition_agnostic); }
std::string name(const ElemQuality q)

◆ refine_in_reinit_flag()

bool libMesh::EquationSystems::refine_in_reinit_flag ( )
inherited
Returns
Whether or not calls to reinit() will try to coarsen/refine the mesh

Definition at line 524 of file equation_systems.h.

References libMesh::EquationSystems::_refine_in_reinit.

524 { return this->_refine_in_reinit; }
bool _refine_in_reinit
Flag for whether to call coarsen/refine in reinit().

◆ reinit()

virtual void libMesh::EquationSystems::reinit ( )
virtualinherited

Handle any mesh changes and reinitialize all the systems on the updated mesh.

◆ reinit_solutions()

bool libMesh::EquationSystems::reinit_solutions ( )
inherited

Handle any mesh changes and project any solutions onto the updated mesh.

Returns
Whether or not the mesh may have changed.

◆ reinit_systems()

virtual void libMesh::EquationSystems::reinit_systems ( )
virtualinherited

Reinitialize all systems on the current mesh.

◆ run()

void Biharmonic::run ( )

◆ sensitivity_solve()

virtual void libMesh::EquationSystems::sensitivity_solve ( const ParameterVector parameters)
virtualinherited

Call sensitivity_solve on all the individual equation systems.

By default this function solves each sensitivity system once, in the order in which in which they were added. For more sophisticated decoupled problems the user may with to override this behavior in a derived class.

◆ solve()

virtual void libMesh::EquationSystems::solve ( )
virtualinherited

Call solve on all the individual equation systems.

By default this function solves each equation system once, in the order they were added. For more sophisticated decoupled problems the user may with to override this behavior in a derived class.

◆ step()

void Biharmonic::step ( const Real &  dt = -1.0)

◆ update()

void libMesh::EquationSystems::update ( )
inherited

Updates local values for all the systems.

◆ verbose()

bool Biharmonic::verbose ( )

Definition at line 79 of file biharmonic.h.

References _verbose.

79 { return _verbose; }
bool _verbose
Definition: biharmonic.h:98

◆ viewParameters()

void Biharmonic::viewParameters ( )

◆ write() [1/2]

void libMesh::EquationSystems::write ( const std::string &  name,
const XdrMODE  ,
const unsigned int  write_flags = (WRITE_DATA),
bool  partition_agnostic = true 
) const
inherited

Write the systems to disk using the XDR data format.

This format allows for machine-independent binary output.

Set the writing properties using the EquationSystems::WriteFlags enumeration. Set which sections to write out by bitwise OR'ing the enumeration values. Write everything by setting write_flags to: (WRITE_DATA | WRITE_ADDITIONAL_DATA)

Note
The solution data can be omitted by calling this routine with WRITE_DATA omitted in the write_flags argument.

If XdrMODE is omitted, it will be inferred as WRITE for filenames containing .xda or as ENCODE for filenames containing .xdr

Parameters
nameName of the file to be read.
write_flagsSingle flag created by bitwise-OR'ing several flags together.
modeControls whether reading is done in binary or ascii mode.
partition_agnosticIf true then the mesh and degrees of freedom will be temporarily renumbered in a partition agnostic way so that files written using "n" mpi processes can be re-read on "m" mpi processes. This renumbering is not compatible with meshes that have two nodes in exactly the same position!

◆ write() [2/2]

void libMesh::EquationSystems::write ( const std::string &  name,
const unsigned int  write_flags = (WRITE_DATA),
bool  partition_agnostic = true 
) const
inherited

Friends And Related Function Documentation

◆ JR

friend class JR
friend

Definition at line 110 of file biharmonic.h.

Member Data Documentation

◆ _cahn_hillard

bool Biharmonic::_cahn_hillard
private

Definition at line 95 of file biharmonic.h.

◆ _cnWeight

Real Biharmonic::_cnWeight
private

Definition at line 103 of file biharmonic.h.

◆ _communicator

const Parallel::Communicator& libMesh::ParallelObject::_communicator
protectedinherited

◆ _counts

Counts libMesh::ReferenceCounter::_counts
staticprotectedinherited

◆ _degenerate

bool Biharmonic::_degenerate
private

Definition at line 95 of file biharmonic.h.

◆ _dim

unsigned int Biharmonic::_dim
private

Definition at line 92 of file biharmonic.h.

◆ _dt

Real Biharmonic::_dt
private

Definition at line 102 of file biharmonic.h.

Referenced by dt().

◆ _dt0

Real Biharmonic::_dt0
private

Definition at line 102 of file biharmonic.h.

Referenced by dt0().

◆ _enable_default_ghosting

bool libMesh::EquationSystems::_enable_default_ghosting
protectedinherited

Flag for whether to enable default ghosting on newly added Systems.

Default value: true

Definition at line 578 of file equation_systems.h.

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

◆ _enable_print_counter

bool libMesh::ReferenceCounter::_enable_print_counter
staticprotectedinherited

Flag to control whether reference count information is printed when print_info is called.

Definition at line 141 of file reference_counter.h.

◆ _energy

FreeEnergyEnum Biharmonic::_energy
private

Definition at line 96 of file biharmonic.h.

◆ _exio

std::unique_ptr<ExodusII_IO> Biharmonic::_exio
private

Definition at line 106 of file biharmonic.h.

◆ _growth

bool Biharmonic::_growth
private

Definition at line 95 of file biharmonic.h.

◆ _initialCenter

Point Biharmonic::_initialCenter
private

Definition at line 100 of file biharmonic.h.

◆ _initialState

InitialStateEnum Biharmonic::_initialState
private

Definition at line 99 of file biharmonic.h.

◆ _initialWidth

Real Biharmonic::_initialWidth
private

Definition at line 101 of file biharmonic.h.

◆ _jr

JR* Biharmonic::_jr
private

Definition at line 113 of file biharmonic.h.

◆ _kappa

Real Biharmonic::_kappa
private

Definition at line 93 of file biharmonic.h.

◆ _log_truncation

int Biharmonic::_log_truncation
private

Definition at line 97 of file biharmonic.h.

◆ _mesh

ReplicatedMesh& Biharmonic::_mesh
private

Definition at line 111 of file biharmonic.h.

◆ _mutex

Threads::spin_mutex libMesh::ReferenceCounter::_mutex
staticprotectedinherited

Mutual exclusion object to enable thread-safe reference counting.

Definition at line 135 of file reference_counter.h.

◆ _N

unsigned int Biharmonic::_N
private

Definition at line 92 of file biharmonic.h.

◆ _n_objects

Threads::atomic<unsigned int> libMesh::ReferenceCounter::_n_objects
staticprotectedinherited

The number of objects.

Print the reference count information when the number returns to 0.

Definition at line 130 of file reference_counter.h.

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

◆ _netforce

bool Biharmonic::_netforce
private

Definition at line 95 of file biharmonic.h.

◆ _o_count

int Biharmonic::_o_count
private

Definition at line 108 of file biharmonic.h.

◆ _o_dt

Real Biharmonic::_o_dt
private

Definition at line 107 of file biharmonic.h.

◆ _ofile

std::string Biharmonic::_ofile
private

Definition at line 105 of file biharmonic.h.

◆ _ofile_base

std::string Biharmonic::_ofile_base
private

Definition at line 105 of file biharmonic.h.

◆ _refine_in_reinit

bool libMesh::EquationSystems::_refine_in_reinit
protectedinherited

◆ _systems

std::map<std::string, System *> libMesh::EquationSystems::_systems
protectedinherited

◆ _T

Real Biharmonic::_T
private

Definition at line 102 of file biharmonic.h.

◆ _t0

Real Biharmonic::_t0
private

Definition at line 102 of file biharmonic.h.

◆ _t1

Real Biharmonic::_t1
private

Definition at line 102 of file biharmonic.h.

◆ _theta

Real Biharmonic::_theta
private

Definition at line 93 of file biharmonic.h.

◆ _theta_c

Real Biharmonic::_theta_c
private

Definition at line 93 of file biharmonic.h.

◆ _tol

Real Biharmonic::_tol
private

Definition at line 94 of file biharmonic.h.

◆ _verbose

bool Biharmonic::_verbose
private

Definition at line 98 of file biharmonic.h.

Referenced by verbose().

◆ parameters

Parameters libMesh::EquationSystems::parameters
inherited

Data structure holding arbitrary parameters.

Definition at line 542 of file equation_systems.h.

Referenced by FETest< order, family, elem_type >::setUp(), and libMesh::WrappedFunction< Output >::WrappedFunction().


The documentation for this class was generated from the following file: