libMesh
Classes | Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | Protected Types | Protected Member Functions | Protected Attributes | Static Protected Attributes | Private Member Functions | 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::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 'names' vector. 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 std::vector< std::string > *var_names=nullptr, bool vertices_only=false) 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 = true
 Flag to control whether reference count information is printed when print_info is called. More...
 

Private Member Functions

template<typename InValType >
void _read_impl (const std::string &name, const XdrMODE, const unsigned int read_flags, bool partition_agnostic=true)
 Actual read implementation. More...
 
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 the Mesh, adding the system to each one. More...
 
void _remove_default_ghosting (unsigned int sys_num)
 This just calls DofMap::remove_default_ghosting() but using a shim lets us forward-declare DofMap. 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 581 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 576 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.

54  {DOUBLE_WELL = 1,
55  DOUBLE_OBSTACLE = 2,
56  LOG_DOUBLE_WELL = 3,

◆ 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.

83  { READ_HEADER = 1,
84  READ_DATA = 2,
87  TRY_READ_IFEMS = 16,
88  READ_BASIC_ONLY = 32 };

◆ 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.

93  { WRITE_DATA = 1,
96  WRITE_SERIAL_FILES = 8 };

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.

Definition at line 14 of file biharmonic.C.

14  :
15  EquationSystems(mesh),
16  _mesh(mesh)
17 {
18  // Retrieve parameters and set defaults
19  _verbose = false;
20  _growth = false;
21  _degenerate = false;
22  _cahn_hillard = false;
23  _netforce = false;
24 
25  if (on_command_line("--verbose"))
26  _verbose = true;
27  if (on_command_line("--growth"))
28  _growth = true;
29  if (on_command_line("--degenerate"))
30  _degenerate = true;
31  if (on_command_line("--cahn_hillard"))
32  _cahn_hillard = true;
33  if (on_command_line("--netforce"))
34  _netforce = true;
35 
36  _kappa = command_line_value("kappa", 1.0);
37 
38  // "type of energy (double well, double obstacle, logarithmic+double well, logarithmic+double obstacle)"
39  std::string energy = command_line_value("energy", std::string("double_well"));
40 
41  if (energy == "double_well")
43  else if (energy == "double_obstacle")
45  else if (energy == "log_double_well")
47  else if (energy == "log_double_obstacle")
49  else
50  libmesh_error_msg("Unknown energy type: " << energy);
51 
52  _tol = command_line_value("tol", 1.0e-8);
53  _theta = command_line_value("theta", .001);
54  _theta_c = command_line_value("theta_c", 1.0);
55 
56  // "order of log truncation (0=none, 2=quadratic, 3=cubic)"
57  _log_truncation = command_line_value("log_truncation", 2);
58 
59  if (!_log_truncation)
60  libMesh::out << "WARNING: no truncation is being used for the logarithmic free energy term.\nWARNING: division by zero possible!\n";
61 
62 
63  // Dimension
64  _dim = command_line_value("dim", 1);
65 
66  libmesh_assert_msg((_dim <= 3) && (_dim > 0), "Invalid mesh dimension");
67 
68  // Build the mesh
69  // Yes, it's better to make a coarse mesh and then refine it. We'll get to it later.
70  _N = command_line_value("N", 8);
71  libmesh_assert_msg(_N > 0, "Invalid mesh size");
72 
73  switch (_dim)
74  {
75  case 1:
77  break;
78  case 2:
79  MeshTools::Generation::build_square(_mesh, _N, _N, 0.0, 1.0, 0.0, 1.0, QUAD4);
80  break;
81  case 3:
82  MeshTools::Generation::build_cube(_mesh, _N, _N, _N, 0.0, 1.0, 0.0, 1.0, 0.0, 1.0, HEX8);
83  break;
84  default:
85  libmesh_assert_msg((_dim <= 3) && (_dim > 0), "Invalid mesh dimension");
86  break;
87  }
88 
89  // Determine the initial timestep size
90  _dt0 = command_line_value("dt", 1.0/(10*_kappa*_N*_N*_N*_N));
91  libmesh_assert_msg(_dt0>=0, "Negative initial timestep");
92 
93  _t0 = command_line_value("min_time", 0.0);
94  _t1 = command_line_value("max_time", _t0 + 50.0*_dt0);
95  libmesh_assert_msg(_t1 >= _t0, "Final time less than initial time");
96  _T = _t1 - _t0;
97 
98  _cnWeight = command_line_value("crank_nicholson_weight", 1.0);
99  libmesh_assert_msg(_cnWeight <= 1 && _cnWeight >= 0, "Crank-Nicholson weight must be between 0 and 1");
100 
101  // Initial state
103  std::string initialState = command_line_value("initial_state", std::string("strip"));
104 
105  if (initialState == std::string("ball"))
107  else if (initialState == std::string("strip"))
109  else if (initialState == std::string("rod"))
110  _initialState = ROD;
111  else
112  libmesh_error_msg("Unknown initial state: neither ball nor rod nor strip");
113 
114  std::vector<Real> icenter;
115  command_line_vector("initial_center", icenter);
116 
117  // Check that the point defining the center was in the right spatial dimension
118  if (icenter.size() > _dim)
119  libmesh_assert_msg(icenter.size() > _dim, "Invalid dimension for the initial state center of mass");
120 
121  // Pad
122  icenter.resize(3);
123  for (std::size_t i = icenter.size(); i < _dim; ++i)
124  icenter[i] = 0.5;
125 
126  for (unsigned int i = _dim; i < 3; ++i)
127  icenter[i] = 0.0;
128 
129  _initialCenter = Point(icenter[0], icenter[1], icenter[2]);
130  _initialWidth = command_line_value("initial_width", 0.125);
131 
132  // Build the main equation encapsulated in the JR (Jacobian-Residual or J(R) "jet of R") object
133  _jr = &(add_system<Biharmonic::JR>(std::string("Biharmonic::JR")));
134 
135  // Output options
136 #ifdef LIBMESH_HAVE_EXODUS_API
137  if (on_command_line("output_base"))
138  _ofile_base = command_line_value("output_base", std::string("bih"));
139 
140  else
141  {
142  switch(_dim)
143  {
144  case 1:
145  _ofile_base = std::string("bih.1");
146  break;
147  case 2:
148  _ofile_base = std::string("bih.2");
149  break;
150  case 3:
151  _ofile_base = std::string("bih.3");
152  break;
153  default:
154  _ofile_base = std::string("bih");
155  break;
156  }
157  }
158  _ofile = _ofile_base + ".e";
159  _exio = libmesh_make_unique<ExodusII_IO>(_mesh);
160  _o_dt = command_line_value("output_dt", 0.0);
161 #endif // #ifdef LIBMESH_HAVE_EXODUS_API
162 } // constructor

References _cahn_hillard, _cnWeight, _degenerate, _dim, _dt0, _energy, _exio, _growth, _initialCenter, _initialState, _initialWidth, _jr, _kappa, _log_truncation, _mesh, _N, _netforce, _o_dt, _ofile, _ofile_base, _T, _t0, _t1, _theta, _theta_c, _tol, _verbose, BALL, libMesh::MeshTools::Generation::build_cube(), libMesh::MeshTools::Generation::build_line(), libMesh::MeshTools::Generation::build_square(), libMesh::command_line_value(), libMesh::command_line_vector(), DOUBLE_OBSTACLE, DOUBLE_WELL, libMesh::EDGE2, libMesh::HEX8, LOG_DOUBLE_OBSTACLE, LOG_DOUBLE_WELL, libMesh::on_command_line(), libMesh::out, libMesh::QUAD4, ROD, and STRIP.

◆ ~Biharmonic()

Biharmonic::~Biharmonic ( )
inline

Destructor.

Definition at line 72 of file biharmonic.h.

73  {
74  // delete _meshRefinement;
75  }

Member Function Documentation

◆ _add_system_to_nodes_and_elems()

void libMesh::EquationSystems::_add_system_to_nodes_and_elems ( )
privateinherited

This function is used in the implementation of add_system, it loops over the nodes and elements of the Mesh, adding the system to each one.

The main reason to separate this part is to avoid coupling this header file to mesh.h, and elem.h.

Definition at line 1376 of file equation_systems.C.

1377 {
1378  // All the nodes
1379  for (auto & node : _mesh.node_ptr_range())
1380  node->add_system();
1381 
1382  // All the elements
1383  for (auto & elem : _mesh.element_ptr_range())
1384  elem->add_system();
1385 }

References libMesh::EquationSystems::_mesh, libMesh::MeshBase::element_ptr_range(), and libMesh::MeshBase::node_ptr_range().

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

◆ _read_impl()

template<typename InValType >
template void libMesh::EquationSystems::_read_impl< Real > ( const std::string &  name,
const  XdrMODE,
const unsigned int  read_flags,
bool  partition_agnostic = true 
)
privateinherited

Actual read implementation.

This can be called repeatedly inside a try-catch block in an attempt to read broken files.

Parameters
nameName of the file to be read.
read_flagsSingle flag created by bitwise-OR'ing several flags together.
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.
Note
This renumbering is not compatible with meshes that have two nodes in exactly the same position!

This program implements the output of an EquationSystems object. This warrants some documentation. The output file essentially consists of 11 sections:

1.) A version header (for non-'legacy' formats, libMesh-0.7.0 and greater).
2.) The number of individual equation systems (unsigned int)

for each system

3.)  The name of the system (string)
4.)  The type of the system (string)

handled through System::read():

+-------------------------------------------------------------+
|  5.) The number of variables in the system (unsigned int)   |
|                                                             |
|   for each variable in the system                           |
|                                                             |
|    6.) The name of the variable (string)                    |
|                                                             |
|    7.) Combined in an FEType:                               |
|         - The approximation order(s) of the variable (Order |
|           Enum, cast to int/s)                              |
|         - The finite element family/ies of the variable     |
|           (FEFamily Enum, cast to int/s)                    |
|                                                             |
|   end variable loop                                         |
|                                                             |
| 8.) The number of additional vectors (unsigned int),        |
|                                                             |
|    for each additional vector in the equation system object |
|                                                             |
|    9.) the name of the additional vector  (string)          |
+-------------------------------------------------------------+

end system loop


for each system, handled through System::read_{serialized,parallel}_data():

+--------------------------------------------------------------+
| 10.) The global solution vector, re-ordered to be node-major |
|     (More on this later.)                                    |
|                                                              |
|    for each additional vector in the equation system object  |
|                                                              |
|    11.) The global additional vector, re-ordered to be       |
|         node-major (More on this later.)                     |
+--------------------------------------------------------------+

end system loop

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

Definition at line 143 of file equation_systems_io.C.

147 {
211  // Set booleans from the read_flags argument
212  const bool read_header = read_flags & EquationSystems::READ_HEADER;
213  const bool read_data = read_flags & EquationSystems::READ_DATA;
214  const bool read_additional_data = read_flags & EquationSystems::READ_ADDITIONAL_DATA;
215  const bool read_legacy_format = read_flags & EquationSystems::READ_LEGACY_FORMAT;
216  const bool try_read_ifems = read_flags & EquationSystems::TRY_READ_IFEMS;
217  const bool read_basic_only = read_flags & EquationSystems::READ_BASIC_ONLY;
218  bool read_parallel_files = false;
219 
220  std::vector<std::pair<std::string, System *>> xda_systems;
221 
222  // This will unzip a file with .bz2 as the extension, otherwise it
223  // simply returns the name if the file need not be unzipped.
224  Xdr io ((this->processor_id() == 0) ? name : "", mode);
225  libmesh_assert (io.reading());
226 
227  {
228  // 1.)
229  // Read the version header.
230  std::string version = "legacy";
231  if (!read_legacy_format)
232  {
233  if (this->processor_id() == 0) io.data(version);
234  this->comm().broadcast(version);
235 
236  // All processors have the version header, if it does not contain
237  // the libMesh_label string then it is a legacy file.
238  const std::string libMesh_label = "libMesh-";
239  std::string::size_type lm_pos = version.find(libMesh_label);
240  if (lm_pos==std::string::npos)
241  {
242  io.close();
243 
244  // Recursively call this read() function but with the
245  // EquationSystems::READ_LEGACY_FORMAT bit set.
246  this->read (name, mode, (read_flags | EquationSystems::READ_LEGACY_FORMAT), partition_agnostic);
247  return;
248  }
249 
250  // Figure out the libMesh version that created this file
251  std::istringstream iss(version.substr(lm_pos + libMesh_label.size()));
252  int ver_major = 0, ver_minor = 0, ver_patch = 0;
253  char dot;
254  iss >> ver_major >> dot >> ver_minor >> dot >> ver_patch;
255  io.set_version(LIBMESH_VERSION_ID(ver_major, ver_minor, ver_patch));
256 
257 
258  read_parallel_files = (version.rfind(" parallel") < version.size());
259 
260  // If requested that we try to read infinite element information,
261  // and the string " with infinite elements" is not in the version,
262  // then tack it on. This is for compatibility reading ifem
263  // files written prior to 11/10/2008 - BSK
264  if (try_read_ifems)
265  if (!(version.rfind(" with infinite elements") < version.size()))
266  version += " with infinite elements";
267 
268  }
269  else
270  libmesh_deprecated();
271 
272  START_LOG("read()","EquationSystems");
273 
274  // 2.)
275  // Read the number of equation systems
276  unsigned int n_sys=0;
277  if (this->processor_id() == 0) io.data (n_sys);
278  this->comm().broadcast(n_sys);
279 
280  for (unsigned int sys=0; sys<n_sys; sys++)
281  {
282  // 3.)
283  // Read the name of the sys-th equation system
284  std::string sys_name;
285  if (this->processor_id() == 0) io.data (sys_name);
286  this->comm().broadcast(sys_name);
287 
288  // 4.)
289  // Read the type of the sys-th equation system
290  std::string sys_type;
291  if (this->processor_id() == 0) io.data (sys_type);
292  this->comm().broadcast(sys_type);
293 
294  if (read_header)
295  this->add_system (sys_type, sys_name);
296 
297  // 5.) - 9.)
298  // Let System::read_header() do the job
299  System & new_system = this->get_system(sys_name);
300  new_system.read_header (io,
301  version,
302  read_header,
303  read_additional_data,
304  read_legacy_format);
305 
306  xda_systems.push_back(std::make_pair(sys_name, &new_system));
307 
308  // If we're only creating "basic" systems, we need to tell
309  // each system that before we call init() later.
310  if (read_basic_only)
311  new_system.set_basic_system_only();
312  }
313  }
314 
315 
316 
317  // Now we are ready to initialize the underlying data
318  // structures. This will initialize the vectors for
319  // storage, the dof_map, etc...
320  if (read_header)
321  this->init();
322 
323  // 10.) & 11.)
324  // Read and set the numeric vector values
325  if (read_data)
326  {
327  // the EquationSystems::read() method should look constant from the mesh
328  // perspective, but we need to assign a temporary numbering to the nodes
329  // and elements in the mesh, which requires that we abuse const_cast
330  if (!read_legacy_format && partition_agnostic)
331  {
332  MeshBase & mesh = const_cast<MeshBase &>(this->get_mesh());
334  }
335 
336  Xdr local_io (read_parallel_files ? local_file_name(this->processor_id(),name) : "", mode);
337 
338  for (auto & pr : xda_systems)
339  if (read_legacy_format)
340  {
341  libmesh_deprecated();
342 #ifdef LIBMESH_ENABLE_DEPRECATED
343  pr.second->read_legacy_data (io, read_additional_data);
344 #endif
345  }
346  else
347  if (read_parallel_files)
348  pr.second->read_parallel_data<InValType> (local_io, read_additional_data);
349  else
350  pr.second->read_serialized_data<InValType> (io, read_additional_data);
351 
352 
353  // Undo the temporary numbering.
354  if (!read_legacy_format && partition_agnostic)
356  }
357 
358  STOP_LOG("read()","EquationSystems");
359 
360  // Localize each system's data
361  this->update();
362 }

References libMesh::EquationSystems::_mesh, libMesh::EquationSystems::add_system(), libMesh::Xdr::close(), libMesh::ParallelObject::comm(), libMesh::Xdr::data(), libMesh::MeshBase::fix_broken_node_and_element_numbering(), libMesh::EquationSystems::get_mesh(), libMesh::EquationSystems::get_system(), libMesh::MeshTools::Private::globally_renumber_nodes_and_elements(), libMesh::EquationSystems::init(), libMesh::libmesh_assert(), mesh, libMesh::ParallelObject::processor_id(), libMesh::EquationSystems::read(), libMesh::EquationSystems::READ_ADDITIONAL_DATA, libMesh::EquationSystems::READ_BASIC_ONLY, libMesh::EquationSystems::READ_DATA, libMesh::EquationSystems::READ_HEADER, libMesh::System::read_header(), libMesh::EquationSystems::READ_LEGACY_FORMAT, libMesh::Xdr::reading(), libMesh::System::set_basic_system_only(), libMesh::Xdr::set_version(), libMesh::EquationSystems::TRY_READ_IFEMS, and libMesh::EquationSystems::update().

◆ _remove_default_ghosting()

void libMesh::EquationSystems::_remove_default_ghosting ( unsigned int  sys_num)
privateinherited

This just calls DofMap::remove_default_ghosting() but using a shim lets us forward-declare DofMap.

Definition at line 1387 of file equation_systems.C.

1388 {
1389  this->get_system(sys_num).get_dof_map().remove_default_ghosting();
1390 }

References libMesh::EquationSystems::get_system().

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

◆ add_system() [1/2]

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

Add the system named name to the systems array.

Definition at line 662 of file equation_systems.h.

663 {
664  T_sys * ptr = nullptr;
665 
666  if (!_systems.count(name))
667  {
668  const unsigned int sys_num = this->n_systems();
669  ptr = new T_sys(*this, name, sys_num);
670 
671  _systems.insert (std::make_pair(name, ptr));
672 
674  this->_remove_default_ghosting(sys_num);
675 
676  // Tell all the \p DofObject entities to add a system.
678  }
679  else
680  {
681  // We now allow redundant add_system calls, to make it
682  // easier to load data from files for user-derived system
683  // subclasses
684  ptr = &(this->get_system<T_sys>(name));
685  }
686 
687  // Return a dynamically casted reference to the newly added System.
688  return *ptr;
689 }

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().

◆ add_system() [2/2]

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.

Definition at line 345 of file equation_systems.C.

347 {
348  // If the user already built a system with this name, we'll
349  // trust them and we'll use it. That way they can pre-add
350  // non-standard derived system classes, and if their restart file
351  // has some non-standard sys_type we won't throw an error.
352  if (_systems.count(name))
353  {
354  return this->get_system(name);
355  }
356  // Build a basic System
357  else if (sys_type == "Basic")
358  this->add_system<System> (name);
359 
360  // Build a Newmark system
361  else if (sys_type == "Newmark")
362  this->add_system<NewmarkSystem> (name);
363 
364  // Build an Explicit system
365  else if ((sys_type == "Explicit"))
366  this->add_system<ExplicitSystem> (name);
367 
368  // Build an Implicit system
369  else if ((sys_type == "Implicit") ||
370  (sys_type == "Steady" ))
371  this->add_system<ImplicitSystem> (name);
372 
373  // build a transient implicit linear system
374  else if ((sys_type == "Transient") ||
375  (sys_type == "TransientImplicit") ||
376  (sys_type == "TransientLinearImplicit"))
377  this->add_system<TransientLinearImplicitSystem> (name);
378 
379  // build a transient implicit nonlinear system
380  else if (sys_type == "TransientNonlinearImplicit")
381  this->add_system<TransientNonlinearImplicitSystem> (name);
382 
383  // build a transient explicit system
384  else if (sys_type == "TransientExplicit")
385  this->add_system<TransientExplicitSystem> (name);
386 
387  // build a linear implicit system
388  else if (sys_type == "LinearImplicit")
389  this->add_system<LinearImplicitSystem> (name);
390 
391  // build a nonlinear implicit system
392  else if (sys_type == "NonlinearImplicit")
393  this->add_system<NonlinearImplicitSystem> (name);
394 
395  // build a Reduced Basis Construction system
396  else if (sys_type == "RBConstruction")
397  this->add_system<RBConstruction> (name);
398 
399  // build a transient Reduced Basis Construction system
400  else if (sys_type == "TransientRBConstruction")
401  this->add_system<TransientRBConstruction> (name);
402 
403 #ifdef LIBMESH_HAVE_SLEPC
404  // build an eigen system
405  else if (sys_type == "Eigen")
406  this->add_system<EigenSystem> (name);
407  else if (sys_type == "TransientEigenSystem")
408  this->add_system<TransientEigenSystem> (name);
409 #endif
410 
411 #if defined(LIBMESH_USE_COMPLEX_NUMBERS)
412  // build a frequency system
413  else if (sys_type == "Frequency")
414  this->add_system<FrequencySystem> (name);
415 #endif
416 
417  else
418  libmesh_error_msg("ERROR: Unknown system type: " << sys_type);
419 
420  // Return a reference to the new system
421  //return (*this)(name);
422  return this->get_system(name);
423 }

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

Referenced by libMesh::EquationSystems::_read_impl(), assemble_and_solve(), build_system(), libMesh::RBEIMConstruction::init_data(), main(), libMesh::ErrorVector::plot_error(), TimeSolverTestImplementation< NewmarkSolver >::run_test_with_exact_soln(), RationalMapTest< elem_type >::setUp(), setup(), FETest< order, family, elem_type >::setUp(), SlitMeshRefinedSystemTest::setUp(), MeshfunctionDFEM::test_mesh_function_dfem(), MeshfunctionDFEM::test_mesh_function_dfem_grad(), MeshFunctionTest::test_p_level(), EquationSystemsTest::testAddSystem(), SystemsTest::testAssemblyWithDgFemContext(), SystemsTest::testBlockRestrictedVarNDofs(), SystemsTest::testBoundaryProjectCube(), DofMapTest::testConstraintLoopDetection(), DefaultCouplingTest::testCoupling(), PointNeighborCouplingTest::testCoupling(), EquationSystemsTest::testDisableDefaultGhosting(), SystemsTest::testDofCouplingWithVarGroups(), MixedDimensionMeshTest::testDofOrdering(), MixedDimensionRefinedMeshTest::testDofOrdering(), MixedDimensionNonUniformRefinement::testDofOrdering(), MixedDimensionNonUniformRefinementTriangle::testDofOrdering(), MixedDimensionNonUniformRefinement3D::testDofOrdering(), DofMapTest::testDofOwner(), MeshInputTest::testDynaReadPatch(), MeshInputTest::testExodusCopyElementSolution(), MeshInputTest::testExodusWriteElementDataFromDiscontinuousNodalData(), EquationSystemsTest::testInit(), EquationSystemsTest::testPostInitAddElem(), EquationSystemsTest::testPostInitAddRealSystem(), EquationSystemsTest::testPostInitAddSystem(), SystemsTest::testProjectCube(), SystemsTest::testProjectCubeWithMeshFunction(), SystemsTest::testProjectLine(), SystemsTest::testProjectMatrix1D(), SystemsTest::testProjectMatrix2D(), SystemsTest::testProjectMatrix3D(), SystemsTest::testProjectSquare(), EquationSystemsTest::testRefineThenReinitPreserveFlags(), EquationSystemsTest::testReinitWithNodeElem(), EquationSystemsTest::testRepartitionThenReinit(), and WriteVecAndScalar::testWrite().

◆ adjoint_solve()

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.

Definition at line 466 of file equation_systems.C.

467 {
468  libmesh_assert (this->n_systems());
469 
470  for (unsigned int i=this->n_systems(); i != 0; --i)
471  this->get_system(i-1).adjoint_solve(qoi_indices);
472 }

References libMesh::EquationSystems::get_system(), libMesh::libmesh_assert(), and libMesh::EquationSystems::n_systems().

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

◆ allgather()

void libMesh::EquationSystems::allgather ( )
inherited

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

Definition at line 274 of file equation_systems.C.

275 {
276  // A serial mesh means nothing needs to be done
277  if (_mesh.is_serial())
278  return;
279 
280  const unsigned int n_sys = this->n_systems();
281 
282  libmesh_assert_not_equal_to (n_sys, 0);
283 
284  // Gather the mesh
285  _mesh.allgather();
286 
287  // Tell all the \p DofObject entities how many systems
288  // there are.
289  for (auto & node : _mesh.node_ptr_range())
290  node->set_n_systems(n_sys);
291 
292  for (auto & elem : _mesh.element_ptr_range())
293  elem->set_n_systems(n_sys);
294 
295  // And distribute each system's dofs
296  for (unsigned int i=0; i != this->n_systems(); ++i)
297  {
298  System & sys = this->get_system(i);
299  DofMap & dof_map = sys.get_dof_map();
300  dof_map.distribute_dofs(_mesh);
301 
302  // The user probably won't need constraint equations or the
303  // send_list after an allgather, but let's keep it in consistent
304  // shape just in case.
305  sys.reinit_constraints();
306  dof_map.prepare_send_list();
307  }
308 }

References libMesh::EquationSystems::_mesh, libMesh::MeshBase::allgather(), libMesh::DofMap::distribute_dofs(), libMesh::MeshBase::element_ptr_range(), libMesh::System::get_dof_map(), libMesh::EquationSystems::get_system(), libMesh::MeshBase::is_serial(), libMesh::EquationSystems::n_systems(), libMesh::MeshBase::node_ptr_range(), libMesh::DofMap::prepare_send_list(), and libMesh::System::reinit_constraints().

◆ build_discontinuous_solution_vector()

void libMesh::EquationSystems::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
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. If vertices_only == true, then for higher-order elements only the solution at the vertices is computed. This can be useful when plotting discontinous solutions on higher-order elements and only a lower-order representation is required.

Definition at line 1049 of file equation_systems.C.

1053 {
1054  LOG_SCOPE("build_discontinuous_solution_vector()", "EquationSystems");
1055 
1056  libmesh_assert (this->n_systems());
1057 
1058  const unsigned int dim = _mesh.mesh_dimension();
1059 
1060  // Get the number of variables (nv) by counting the number of variables
1061  // in each system listed in system_names
1062  unsigned int nv = 0;
1063 
1064  for (const auto & pr : _systems)
1065  {
1066  // Check current system is listed in system_names, and skip pos if not
1067  bool use_current_system = (system_names == nullptr);
1068  if (!use_current_system)
1069  use_current_system = system_names->count(pr.first);
1070  if (!use_current_system || pr.second->hide_output())
1071  continue;
1072 
1073  const System * system = pr.second;
1074 
1075  // Loop over all variables in this System and check whether we
1076  // are supposed to use each one.
1077  for (auto var_id : IntRange<unsigned int>(0, system->n_vars()))
1078  {
1079  bool use_current_var = (var_names == nullptr);
1080  if (!use_current_var)
1081  use_current_var = std::count(var_names->begin(),
1082  var_names->end(),
1083  system->variable_name(var_id));
1084 
1085  // Only increment the total number of vars if we are
1086  // supposed to use this one.
1087  if (use_current_var)
1088  nv++;
1089  }
1090  }
1091 
1092  // get the total weight
1093  unsigned int tw=0;
1094  for (const auto & elem : _mesh.active_element_ptr_range())
1095  tw += vertices_only ? elem->n_vertices() : elem->n_nodes();
1096 
1097  // Only if we are on processor zero, allocate the storage
1098  // to hold (number_of_nodes)*(number_of_variables) entries.
1099  if (_mesh.processor_id() == 0)
1100  soln.resize(tw*nv);
1101 
1102  std::vector<Number> sys_soln;
1103 
1104  // Keep track of the variable "offset". This is used for indexing
1105  // into the global solution vector.
1106  unsigned int var_offset = 0;
1107 
1108  // For each system in this EquationSystems object,
1109  // update the global solution and if we are on processor 0,
1110  // loop over the elements and build the nodal solution
1111  // from the element solution. Then insert this nodal solution
1112  // into the vector passed to build_solution_vector.
1113  for (const auto & pr : _systems)
1114  {
1115  // Check current system is listed in system_names, and skip pos if not
1116  bool use_current_system = (system_names == nullptr);
1117  if (!use_current_system)
1118  use_current_system = system_names->count(pr.first);
1119  if (!use_current_system || pr.second->hide_output())
1120  continue;
1121 
1122  const System * system = pr.second;
1123  const unsigned int nv_sys = system->n_vars();
1124 
1125  system->update_global_solution (sys_soln, 0);
1126 
1127  // Keep track of the number of vars actually written.
1128  unsigned int n_vars_written_current_system = 0;
1129 
1130  if (_mesh.processor_id() == 0)
1131  {
1132  std::vector<Number> soln_coeffs; // The finite element solution coeffs
1133  std::vector<Number> nodal_soln; // The FE solution interpolated to the nodes
1134  std::vector<dof_id_type> dof_indices; // The DOF indices for the finite element
1135 
1136  // For each variable, determine if we are supposed to
1137  // write it, then loop over the active elements, compute
1138  // the nodal_soln and store it to the "soln" vector. We
1139  // store zeros for subdomain-restricted variables on
1140  // elements where they are not active.
1141  for (unsigned int var=0; var<nv_sys; var++)
1142  {
1143  bool use_current_var = (var_names == nullptr);
1144  if (!use_current_var)
1145  use_current_var = std::count(var_names->begin(),
1146  var_names->end(),
1147  system->variable_name(var));
1148 
1149  // If we aren't supposed to write this var, go to the
1150  // next loop iteration.
1151  if (!use_current_var)
1152  continue;
1153 
1154  const FEType & fe_type = system->variable_type(var);
1155  const Variable & var_description = system->variable(var);
1156 
1157  unsigned int nn=0;
1158 
1159  for (auto & elem : _mesh.active_element_ptr_range())
1160  {
1161  if (var_description.active_on_subdomain(elem->subdomain_id()))
1162  {
1163  system->get_dof_map().dof_indices (elem, dof_indices, var);
1164 
1165  soln_coeffs.resize(dof_indices.size());
1166 
1167  for (auto i : index_range(dof_indices))
1168  soln_coeffs[i] = sys_soln[dof_indices[i]];
1169 
1170  // Compute the FE solution at all the nodes, but
1171  // only use the first n_vertices() entries if
1172  // vertices_only == true.
1174  fe_type,
1175  elem,
1176  soln_coeffs,
1177  nodal_soln);
1178 
1179 #ifdef LIBMESH_ENABLE_INFINITE_ELEMENTS
1180  // infinite elements should be skipped...
1181  if (!elem->infinite())
1182 #endif
1183  {
1184  libmesh_assert_equal_to (nodal_soln.size(), elem->n_nodes());
1185 
1186  const unsigned int n_vals =
1187  vertices_only ? elem->n_vertices() : elem->n_nodes();
1188 
1189  for (unsigned int n=0; n<n_vals; n++)
1190  {
1191  // Compute index into global solution vector.
1192  std::size_t index =
1193  nv * (nn++) + (n_vars_written_current_system + var_offset);
1194 
1195  soln[index] += nodal_soln[n];
1196  }
1197  }
1198  }
1199  else
1200  nn += vertices_only ? elem->n_vertices() : elem->n_nodes();
1201  } // end loop over active elements
1202 
1203  // If we made it here, we actually wrote a variable, so increment
1204  // the number of variables actually written for the current system.
1205  n_vars_written_current_system++;
1206 
1207  } // end loop over vars
1208  } // end if proc 0
1209 
1210  // Update offset for next loop iteration.
1211  var_offset += n_vars_written_current_system;
1212  } // end loop over systems
1213 }

References libMesh::Variable::active_on_subdomain(), dim, libMesh::DofMap::dof_indices(), libMesh::System::get_dof_map(), libMesh::index_range(), libMesh::libmesh_assert(), libMesh::System::n_vars(), libMesh::FEInterface::nodal_soln(), libMesh::System::update_global_solution(), libMesh::System::variable(), libMesh::System::variable_name(), and libMesh::System::variable_type().

Referenced by libMesh::MeshOutput< MeshBase >::write_discontinuous_equation_systems(), libMesh::ExodusII_IO::write_discontinuous_exodusII(), libMesh::GMVIO::write_discontinuous_gmv(), and libMesh::ExodusII_IO::write_element_data_from_discontinuous_nodal_data().

◆ 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.

Definition at line 883 of file equation_systems.C.

885 {
886  // Call the parallel version of this function
887  std::unique_ptr<NumericVector<Number>> parallel_soln =
889 
890  // Localize into 'soln', provided that parallel_soln is not empty.
891  // Note: parallel_soln will be empty in the event that none of the
892  // input names were CONSTANT, MONOMIAL variables or there were
893  // simply no CONSTANT, MONOMIAL variables in the EquationSystems
894  // object.
895  soln.clear();
896  if (parallel_soln)
897  parallel_soln->localize_to_one(soln);
898 }

References libMesh::EquationSystems::build_parallel_elemental_solution_vector().

Referenced by libMesh::EquationSystems::get_solution(), and libMesh::ExodusII_IO::write_element_data().

◆ 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.

Definition at line 957 of file equation_systems.C.

958 {
959  FEType type(CONSTANT, MONOMIAL);
960  std::vector<std::pair<unsigned int, unsigned int>> var_nums =
961  this->find_variable_numbers(names, &type);
962 
963  const std::size_t nv = var_nums.size();
964  const dof_id_type ne = _mesh.n_elem();
965  libmesh_assert_equal_to (ne, _mesh.max_elem_id());
966 
967  // If there are no variables to write out don't do anything...
968  if (!nv)
969  return std::unique_ptr<NumericVector<Number>>(nullptr);
970 
971  // We can handle the case where there are nullptrs in the Elem vector
972  // by just having extra zeros in the solution vector.
973  numeric_index_type parallel_soln_global_size = ne*nv;
974 
975  numeric_index_type div = parallel_soln_global_size / this->n_processors();
976  numeric_index_type mod = parallel_soln_global_size % this->n_processors();
977 
978  // Initialize all processors to the average size.
979  numeric_index_type parallel_soln_local_size = div;
980 
981  // The first "mod" processors get an extra entry.
982  if (this->processor_id() < mod)
983  parallel_soln_local_size = div+1;
984 
985  // Create a NumericVector to hold the parallel solution
986  std::unique_ptr<NumericVector<Number>> parallel_soln_ptr = NumericVector<Number>::build(_communicator);
987  NumericVector<Number> & parallel_soln = *parallel_soln_ptr;
988  parallel_soln.init(parallel_soln_global_size,
989  parallel_soln_local_size,
990  /*fast=*/false,
991  /*ParallelType=*/PARALLEL);
992 
993  unsigned int sys_ctr = 0;
994 
995  // For each system in this EquationSystems object,
996  // update the global solution and collect the
997  // CONSTANT MONOMIALs. The entries are in variable-major
998  // format.
999  for (auto i : index_range(var_nums))
1000  {
1001  std::pair<unsigned int, unsigned int> var_num = var_nums[i];
1002  const System & system = this->get_system(var_num.first);
1003 
1004  // Update the current_local_solution if necessary
1005  if (sys_ctr != var_num.first)
1006  {
1007  System & non_const_sys = const_cast<System &>(system);
1008  // We used to simply call non_const_sys.solution->close()
1009  // here, but that is not allowed when the solution vector is
1010  // locked read-only, for example when printing the solution
1011  // during during the middle of a solve... So try to be a bit
1012  // more careful about calling close() unnecessarily.
1013  libmesh_assert(this->comm().verify(non_const_sys.solution->closed()));
1014  if (!non_const_sys.solution->closed())
1015  non_const_sys.solution->close();
1016  non_const_sys.update();
1017  sys_ctr = var_num.first;
1018  }
1019 
1020  NumericVector<Number> & sys_soln(*system.current_local_solution);
1021 
1022  // The DOF indices for the finite element
1023  std::vector<dof_id_type> dof_indices;
1024 
1025  const unsigned int var = var_num.second;
1026 
1027  const Variable & variable = system.variable(var);
1028  const DofMap & dof_map = system.get_dof_map();
1029 
1030  for (const auto & elem : _mesh.active_local_element_ptr_range())
1031  if (variable.active_on_subdomain(elem->subdomain_id()))
1032  {
1033  dof_map.dof_indices (elem, dof_indices, var);
1034 
1035  libmesh_assert_equal_to (1, dof_indices.size());
1036 
1037  parallel_soln.set((ne*i)+elem->id(), sys_soln(dof_indices[0]));
1038  }
1039  } // end loop over var_nums
1040 
1041  parallel_soln.close();
1042  return std::unique_ptr<NumericVector<Number>>(parallel_soln_ptr.release());
1043 }

References libMesh::ParallelObject::_communicator, libMesh::EquationSystems::_mesh, libMesh::MeshBase::active_local_element_ptr_range(), libMesh::Variable::active_on_subdomain(), libMesh::NumericVector< T >::build(), libMesh::NumericVector< T >::close(), libMesh::ParallelObject::comm(), libMesh::CONSTANT, libMesh::System::current_local_solution, libMesh::DofMap::dof_indices(), libMesh::EquationSystems::find_variable_numbers(), libMesh::System::get_dof_map(), libMesh::EquationSystems::get_system(), libMesh::index_range(), libMesh::NumericVector< T >::init(), libMesh::libmesh_assert(), libMesh::MeshBase::max_elem_id(), libMesh::MONOMIAL, libMesh::MeshBase::n_elem(), libMesh::ParallelObject::n_processors(), libMesh::PARALLEL, libMesh::ParallelObject::processor_id(), libMesh::NumericVector< T >::set(), libMesh::System::solution, libMesh::System::update(), and libMesh::System::variable().

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

◆ 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.

Definition at line 590 of file equation_systems.C.

591 {
592  LOG_SCOPE("build_parallel_solution_vector()", "EquationSystems");
593 
594  // This function must be run on all processors at once
595  parallel_object_only();
596 
597  const unsigned int dim = _mesh.mesh_dimension();
598  const dof_id_type max_nn = _mesh.max_node_id();
599 
600  // allocate vector storage to hold
601  // (max_node_id)*(number_of_variables) entries.
602  //
603  // If node renumbering is disabled and adaptive coarsening has
604  // created gaps between node numbers, then this vector will be
605  // sparse.
606  //
607  // We have to differentiate between between scalar and vector
608  // variables. We intercept vector variables and treat each
609  // component as a scalar variable (consistently with build_solution_names).
610 
611  unsigned int nv = 0;
612 
613  //Could this be replaced by a/some convenience methods?[PB]
614  {
615  unsigned int n_scalar_vars = 0;
616  unsigned int n_vector_vars = 0;
617  const_system_iterator pos = _systems.begin();
618  const const_system_iterator end = _systems.end();
619 
620  for (; pos != end; ++pos)
621  {
622  // Check current system is listed in system_names, and skip pos if not
623  bool use_current_system = (system_names == nullptr);
624  if (!use_current_system)
625  use_current_system = system_names->count(pos->first);
626  if (!use_current_system || pos->second->hide_output())
627  continue;
628 
629  for (auto vn : IntRange<unsigned int>(0, pos->second->n_vars()))
630  {
631  if (FEInterface::field_type(pos->second->variable_type(vn)) == TYPE_VECTOR)
632  n_vector_vars++;
633  else
634  n_scalar_vars++;
635  }
636  }
637  // Here, we're assuming the number of vector components is the same
638  // as the mesh dimension. Will break for mixed dimension meshes.
639  nv = n_scalar_vars + dim*n_vector_vars;
640  }
641 
642  // Get the number of nodes to store locally.
643  dof_id_type n_local_nodes = cast_int<dof_id_type>
646 
647  // If node renumbering has been disabled, nodes may not be numbered
648  // contiguously, and the number of nodes might not match the
649  // max_node_id. In this case we just do our best.
650  dof_id_type n_total_nodes = n_local_nodes;
651  _mesh.comm().sum(n_total_nodes);
652 
653  const dof_id_type n_gaps = max_nn - n_total_nodes;
654  const dof_id_type gaps_per_processor = n_gaps / _mesh.comm().size();
655  const dof_id_type remainder_gaps = n_gaps % _mesh.comm().size();
656 
657  n_local_nodes = n_local_nodes + // Actual nodes
658  gaps_per_processor + // Our even share of gaps
659  (_mesh.comm().rank() < remainder_gaps); // Leftovers
660 
661  // Create a NumericVector to hold the parallel solution
662  std::unique_ptr<NumericVector<Number>> parallel_soln_ptr = NumericVector<Number>::build(_communicator);
663  NumericVector<Number> & parallel_soln = *parallel_soln_ptr;
664  parallel_soln.init(max_nn*nv, n_local_nodes*nv, false, PARALLEL);
665 
666  // Create a NumericVector to hold the "repeat_count" for each node - this is essentially
667  // the number of elements contributing to that node's value
668  std::unique_ptr<NumericVector<Number>> repeat_count_ptr = NumericVector<Number>::build(_communicator);
669  NumericVector<Number> & repeat_count = *repeat_count_ptr;
670  repeat_count.init(max_nn*nv, n_local_nodes*nv, false, PARALLEL);
671 
672  repeat_count.close();
673 
674  unsigned int var_num=0;
675 
676  // For each system in this EquationSystems object,
677  // update the global solution and if we are on processor 0,
678  // loop over the elements and build the nodal solution
679  // from the element solution. Then insert this nodal solution
680  // into the vector passed to build_solution_vector.
681  const_system_iterator pos = _systems.begin();
682  const const_system_iterator end = _systems.end();
683 
684  for (; pos != end; ++pos)
685  {
686  // Check current system is listed in system_names, and skip pos if not
687  bool use_current_system = (system_names == nullptr);
688  if (!use_current_system)
689  use_current_system = system_names->count(pos->first);
690  if (!use_current_system || pos->second->hide_output())
691  continue;
692 
693  const System & system = *(pos->second);
694  const unsigned int nv_sys = system.n_vars();
695  const unsigned int sys_num = system.number();
696 
697  //Could this be replaced by a/some convenience methods?[PB]
698  unsigned int n_scalar_vars = 0;
699  unsigned int n_vector_vars = 0;
700  for (auto vn : IntRange<unsigned int>(0, pos->second->n_vars()))
701  {
702  if (FEInterface::field_type(pos->second->variable_type(vn)) == TYPE_VECTOR)
703  n_vector_vars++;
704  else
705  n_scalar_vars++;
706  }
707 
708  // Here, we're assuming the number of vector components is the same
709  // as the mesh dimension. Will break for mixed dimension meshes.
710  unsigned int nv_sys_split = n_scalar_vars + dim*n_vector_vars;
711 
712  // Update the current_local_solution
713  {
714  System & non_const_sys = const_cast<System &>(system);
715  // We used to simply call non_const_sys.solution->close()
716  // here, but that is not allowed when the solution vector is
717  // locked read-only, for example when printing the solution
718  // during the middle of a solve... So try to be a bit
719  // more careful about calling close() unnecessarily.
720  libmesh_assert(this->comm().verify(non_const_sys.solution->closed()));
721  if (!non_const_sys.solution->closed())
722  non_const_sys.solution->close();
723  non_const_sys.update();
724  }
725 
726  NumericVector<Number> & sys_soln(*system.current_local_solution);
727 
728  std::vector<Number> elem_soln; // The finite element solution
729  std::vector<Number> nodal_soln; // The FE solution interpolated to the nodes
730  std::vector<dof_id_type> dof_indices; // The DOF indices for the finite element
731 
732  unsigned var_inc = 0;
733  for (unsigned int var=0; var<nv_sys; var++)
734  {
735  const FEType & fe_type = system.variable_type(var);
736  const Variable & var_description = system.variable(var);
737  const DofMap & dof_map = system.get_dof_map();
738 
739  unsigned int n_vec_dim = FEInterface::n_vec_dim( pos->second->get_mesh(), fe_type );
740 
741  for (const auto & elem : _mesh.active_local_element_ptr_range())
742  {
743  if (var_description.active_on_subdomain(elem->subdomain_id()))
744  {
745  dof_map.dof_indices (elem, dof_indices, var);
746 
747  elem_soln.resize(dof_indices.size());
748 
749  for (auto i : index_range(dof_indices))
750  elem_soln[i] = sys_soln(dof_indices[i]);
751 
753  fe_type,
754  elem,
755  elem_soln,
756  nodal_soln);
757 
758 #ifdef LIBMESH_ENABLE_INFINITE_ELEMENTS
759  // infinite elements should be skipped...
760  if (!elem->infinite())
761 #endif
762  {
763  libmesh_assert_equal_to (nodal_soln.size(), n_vec_dim*elem->n_nodes());
764 
765  for (auto n : elem->node_index_range())
766  {
767  for (unsigned int d=0; d < n_vec_dim; d++)
768  {
769  // For vector-valued elements, all components are in nodal_soln. For each
770  // node, the components are stored in order, i.e. node_0 -> s0_x, s0_y, s0_z
771  parallel_soln.add(nv*(elem->node_id(n)) + (var_inc+d + var_num), nodal_soln[n_vec_dim*n+d]);
772 
773  // Increment the repeat count for this position
774  repeat_count.add(nv*(elem->node_id(n)) + (var_inc+d + var_num), 1);
775  }
776  }
777  }
778  }
779  else // If this variable doesn't exist on this subdomain we have to still increment repeat_count so that we won't divide by 0 later:
780  for (const Node & node : elem->node_ref_range())
781  // Only do this if this variable has NO DoFs at this node... it might have some from an adjoining element...
782  if (!node.n_dofs(sys_num, var))
783  for (unsigned int d=0; d < n_vec_dim; d++)
784  repeat_count.add(nv*node.id() + (var_inc+d + var_num), 1);
785 
786  } // end loop over elements
787  var_inc += n_vec_dim;
788  } // end loop on variables in this system
789 
790  var_num += nv_sys_split;
791  } // end loop over systems
792 
793  // Sum the nodal solution values and repeat counts.
794  parallel_soln.close();
795  repeat_count.close();
796 
797  // If there were gaps in the node numbering, there will be
798  // corresponding zeros in the parallel_soln and repeat_count
799  // vectors. We need to set those repeat_count entries to 1
800  // in order to avoid dividing by zero.
801  if (n_gaps)
802  {
803  for (numeric_index_type i=repeat_count.first_local_index();
804  i<repeat_count.last_local_index(); ++i)
805  {
806  // repeat_count entries are integral values but let's avoid a
807  // direct floating point comparison with 0 just in case some
808  // roundoff noise crept in during vector assembly?
809  if (std::abs(repeat_count(i)) < TOLERANCE)
810  repeat_count.set(i, 1.);
811  }
812 
813  // Make sure the repeat_count vector is up-to-date on all
814  // processors.
815  repeat_count.close();
816  }
817 
818  // Divide to get the average value at the nodes
819  parallel_soln /= repeat_count;
820 
821  return std::unique_ptr<NumericVector<Number>>(parallel_soln_ptr.release());
822 }

References libMesh::ParallelObject::_communicator, libMesh::EquationSystems::_mesh, libMesh::EquationSystems::_systems, std::abs(), libMesh::MeshBase::active_local_element_ptr_range(), libMesh::Variable::active_on_subdomain(), libMesh::NumericVector< T >::add(), libMesh::NumericVector< T >::build(), libMesh::NumericVector< T >::close(), libMesh::ParallelObject::comm(), libMesh::System::current_local_solution, dim, distance(), libMesh::DofMap::dof_indices(), end, libMesh::FEInterface::field_type(), libMesh::NumericVector< T >::first_local_index(), libMesh::System::get_dof_map(), libMesh::index_range(), libMesh::NumericVector< T >::init(), libMesh::NumericVector< T >::last_local_index(), libMesh::libmesh_assert(), libMesh::MeshBase::local_nodes_begin(), libMesh::MeshBase::local_nodes_end(), libMesh::MeshBase::max_node_id(), libMesh::MeshBase::mesh_dimension(), libMesh::System::n_vars(), libMesh::FEInterface::n_vec_dim(), libMesh::FEInterface::nodal_soln(), libMesh::System::number(), libMesh::PARALLEL, libMesh::NumericVector< T >::set(), libMesh::System::solution, libMesh::TOLERANCE, libMesh::TYPE_VECTOR, libMesh::System::update(), libMesh::System::variable(), and libMesh::System::variable_type().

Referenced by libMesh::EquationSystems::build_solution_vector(), and libMesh::MeshOutput< MeshBase >::write_nodal_data().

◆ build_solution_vector() [1/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.

Definition at line 826 of file equation_systems.C.

828 {
829  LOG_SCOPE("build_solution_vector()", "EquationSystems");
830 
831  // Call the parallel implementation
832  std::unique_ptr<NumericVector<Number>> parallel_soln =
833  this->build_parallel_solution_vector(system_names);
834 
835  // Localize the NumericVector into the provided std::vector.
836  parallel_soln->localize_to_one(soln);
837 }

References libMesh::EquationSystems::build_parallel_solution_vector().

◆ build_solution_vector() [2/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.

Definition at line 578 of file equation_systems.C.

581 {
582  // TODO:[BSK] re-implement this from the method below
583  libmesh_not_implemented();
584 }

Referenced by libMesh::MeshOutput< MeshBase >::write_equation_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.

Definition at line 476 of file equation_systems.C.

479 {
480  unsigned int var_num=0;
481 
482  const_system_iterator pos = _systems.begin();
483  const const_system_iterator end = _systems.end();
484 
485  // Need to size var_names by scalar variables plus all the
486  // vector components for all the vector variables
487  //Could this be replaced by a/some convenience methods?[PB]
488  {
489  unsigned int n_scalar_vars = 0;
490  unsigned int n_vector_vars = 0;
491 
492  for (; pos != end; ++pos)
493  {
494  // Check current system is listed in system_names, and skip pos if not
495  bool use_current_system = (system_names == nullptr);
496  if (!use_current_system)
497  use_current_system = system_names->count(pos->first);
498  if (!use_current_system || pos->second->hide_output())
499  continue;
500 
501  for (auto vn : IntRange<unsigned int>(0, pos->second->n_vars()))
502  {
503  if (FEInterface::field_type(pos->second->variable_type(vn)) == TYPE_VECTOR)
504  n_vector_vars++;
505  else
506  n_scalar_vars++;
507  }
508  }
509 
510  // Here, we're assuming the number of vector components is the same
511  // as the mesh dimension. Will break for mixed dimension meshes.
512  unsigned int dim = this->get_mesh().mesh_dimension();
513  unsigned int nv = n_scalar_vars + dim*n_vector_vars;
514 
515  // We'd better not have more than dim*his->n_vars() (all vector variables)
516  libmesh_assert_less_equal ( nv, dim*this->n_vars() );
517 
518  // Here, we're assuming the number of vector components is the same
519  // as the mesh dimension. Will break for mixed dimension meshes.
520 
521  var_names.resize( nv );
522  }
523 
524  // reset
525  pos = _systems.begin();
526 
527  for (; pos != end; ++pos)
528  {
529  // Check current system is listed in system_names, and skip pos if not
530  bool use_current_system = (system_names == nullptr);
531  if (!use_current_system)
532  use_current_system = system_names->count(pos->first);
533  if (!use_current_system || pos->second->hide_output())
534  continue;
535 
536  for (auto vn : IntRange<unsigned int>(0, pos->second->n_vars()))
537  {
538  const std::string & var_name = pos->second->variable_name(vn);
539  const FEType & fe_type = pos->second->variable_type(vn);
540 
541  unsigned int n_vec_dim = FEInterface::n_vec_dim( pos->second->get_mesh(), fe_type);
542 
543  // Filter on the type if requested
544  if (type == nullptr || (type && *type == fe_type))
545  {
546  if (FEInterface::field_type(fe_type) == TYPE_VECTOR)
547  {
548  switch(n_vec_dim)
549  {
550  case 0:
551  case 1:
552  var_names[var_num++] = var_name;
553  break;
554  case 2:
555  var_names[var_num++] = var_name+"_x";
556  var_names[var_num++] = var_name+"_y";
557  break;
558  case 3:
559  var_names[var_num++] = var_name+"_x";
560  var_names[var_num++] = var_name+"_y";
561  var_names[var_num++] = var_name+"_z";
562  break;
563  default:
564  libmesh_error_msg("Invalid dim in build_variable_names");
565  }
566  }
567  else
568  var_names[var_num++] = var_name;
569  }
570  }
571  }
572  // Now resize again in case we filtered any names
573  var_names.resize(var_num);
574 }

References libMesh::EquationSystems::_systems, dim, end, libMesh::FEInterface::field_type(), libMesh::EquationSystems::get_mesh(), libMesh::MeshBase::mesh_dimension(), libMesh::EquationSystems::n_vars(), libMesh::FEInterface::n_vec_dim(), and libMesh::TYPE_VECTOR.

Referenced by libMesh::MeshOutput< MeshBase >::write_discontinuous_equation_systems(), libMesh::ExodusII_IO::write_discontinuous_exodusII(), libMesh::GMVIO::write_discontinuous_gmv(), libMesh::Nemesis_IO::write_element_data(), libMesh::ExodusII_IO::write_element_data(), libMesh::ExodusII_IO::write_element_data_from_discontinuous_nodal_data(), libMesh::MeshOutput< MeshBase >::write_equation_systems(), libMesh::Nemesis_IO::write_nodal_data(), and libMesh::MeshOutput< MeshBase >::write_nodal_data().

◆ clear()

void libMesh::EquationSystems::clear ( )
virtualinherited

Restores the data structure to a pristine state.

Definition at line 75 of file equation_systems.C.

76 {
77  // Clear any additional parameters
78  parameters.clear ();
79 
80  // clear the systems. We must delete them
81  // since we newed them!
82  while (!_systems.empty())
83  {
84  system_iterator pos = _systems.begin();
85 
86  System * sys = pos->second;
87  delete sys;
88  sys = nullptr;
89 
90  _systems.erase (pos);
91  }
92 }

References libMesh::EquationSystems::_systems, libMesh::Parameters::clear(), and libMesh::EquationSystems::parameters.

Referenced by main(), and libMesh::EquationSystems::~EquationSystems().

◆ comm()

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

Definition at line 94 of file parallel_object.h.

95  { return _communicator; }

References libMesh::ParallelObject::_communicator.

Referenced by libMesh::__libmesh_petsc_diff_solver_jacobian(), libMesh::__libmesh_petsc_diff_solver_monitor(), libMesh::__libmesh_petsc_diff_solver_residual(), libMesh::__libmesh_tao_equality_constraints(), libMesh::__libmesh_tao_equality_constraints_jacobian(), libMesh::__libmesh_tao_gradient(), libMesh::__libmesh_tao_hessian(), libMesh::__libmesh_tao_inequality_constraints(), libMesh::__libmesh_tao_inequality_constraints_jacobian(), libMesh::__libmesh_tao_objective(), libMesh::MeshRefinement::_coarsen_elements(), libMesh::ExactSolution::_compute_error(), libMesh::UniformRefinementEstimator::_estimate_error(), libMesh::BoundaryInfo::_find_id_maps(), libMesh::PetscLinearSolver< Number >::_petsc_shell_matrix_get_diagonal(), libMesh::SlepcEigenSolver< libMesh::Number >::_petsc_shell_matrix_get_diagonal(), libMesh::PetscLinearSolver< Number >::_petsc_shell_matrix_mult(), libMesh::SlepcEigenSolver< libMesh::Number >::_petsc_shell_matrix_mult(), libMesh::PetscLinearSolver< Number >::_petsc_shell_matrix_mult_add(), libMesh::EquationSystems::_read_impl(), libMesh::MeshRefinement::_refine_elements(), libMesh::MeshRefinement::_smooth_flags(), libMesh::DofMap::add_constraints_to_send_list(), add_cube_convex_hull_to_mesh(), libMesh::PetscDMWrapper::add_dofs_helper(), libMesh::PetscDMWrapper::add_dofs_to_section(), libMesh::TransientRBConstruction::add_IC_to_RB_space(), libMesh::ImplicitSystem::add_matrix(), libMesh::RBConstruction::add_scaled_matrix_and_vector(), libMesh::DynaIO::add_spline_constraints(), libMesh::System::add_vector(), libMesh::UnstructuredMesh::all_second_order(), libMesh::MeshTools::Modification::all_tri(), libMesh::LaplaceMeshSmoother::allgather_graph(), libMesh::DofMap::allgather_recursive_constraints(), libMesh::TransientRBConstruction::allocate_data_structures(), libMesh::RBConstruction::allocate_data_structures(), libMesh::TransientRBConstruction::assemble_affine_expansion(), libMesh::FEMSystem::assemble_qoi(), libMesh::MeshCommunication::assign_global_indices(), libMesh::DofMap::attach_matrix(), libMesh::MeshTools::Generation::build_extrusion(), libMesh::BoundaryInfo::build_node_list_from_side_list(), libMesh::EquationSystems::build_parallel_elemental_solution_vector(), libMesh::EquationSystems::build_parallel_solution_vector(), libMesh::PetscDMWrapper::build_section(), libMesh::PetscDMWrapper::build_sf(), libMesh::System::calculate_norm(), libMesh::DofMap::check_dirichlet_bcid_consistency(), libMesh::RBConstruction::compute_Fq_representor_innerprods(), libMesh::RBConstruction::compute_max_error_bound(), libMesh::Nemesis_IO_Helper::compute_num_global_elem_blocks(), libMesh::Nemesis_IO_Helper::compute_num_global_nodesets(), libMesh::Nemesis_IO_Helper::compute_num_global_sidesets(), libMesh::RBConstruction::compute_output_dual_innerprods(), libMesh::RBConstruction::compute_residual_dual_norm_slow(), libMesh::RBSCMConstruction::compute_SCM_bounds_on_training_set(), libMesh::Problem_Interface::computeF(), libMesh::Problem_Interface::computeJacobian(), libMesh::Problem_Interface::computePreconditioner(), libMesh::ExodusII_IO::copy_elemental_solution(), libMesh::ExodusII_IO::copy_scalar_solution(), libMesh::MeshTools::correct_node_proc_ids(), libMesh::MeshTools::create_bounding_box(), libMesh::DofMap::create_dof_constraints(), libMesh::MeshTools::create_nodal_bounding_box(), libMesh::MeshRefinement::create_parent_error_vector(), libMesh::MeshTools::create_processor_bounding_box(), libMesh::MeshTools::create_subdomain_bounding_box(), libMesh::MeshCommunication::delete_remote_elements(), libMesh::DofMap::distribute_dofs(), DMlibMeshFunction(), DMlibMeshJacobian(), DMlibMeshSetSystem_libMesh(), DMVariableBounds_libMesh(), libMesh::DTKSolutionTransfer::DTKSolutionTransfer(), libMesh::MeshRefinement::eliminate_unrefined_patches(), libMesh::RBEIMConstruction::enrich_RB_space(), libMesh::TransientRBConstruction::enrich_RB_space(), libMesh::RBConstruction::enrich_RB_space(), libMesh::EpetraVector< T >::EpetraVector(), AssembleOptimization::equality_constraints(), libMesh::WeightedPatchRecoveryErrorEstimator::estimate_error(), libMesh::PatchRecoveryErrorEstimator::estimate_error(), libMesh::JumpErrorEstimator::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_error_tolerance(), libMesh::MeshRefinement::flag_elements_by_mean_stddev(), libMesh::MeshRefinement::flag_elements_by_nelem_target(), libMesh::DofMap::gather_constraints(), libMesh::MeshfreeInterpolation::gather_remote_data(), libMesh::CondensedEigenSystem::get_eigenpair(), libMesh::DofMap::get_info(), libMesh::ImplicitSystem::get_linear_solver(), AssembleOptimization::inequality_constraints(), AssembleOptimization::inequality_constraints_jacobian(), libMesh::LocationMap< T >::init(), libMesh::TimeSolver::init(), libMesh::SystemSubsetBySubdomain::init(), libMesh::PetscDMWrapper::init_and_attach_petscdm(), libMesh::EigenSystem::init_matrices(), libMesh::OptimizationSystem::initialize_equality_constraints_storage(), libMesh::OptimizationSystem::initialize_inequality_constraints_storage(), libMesh::RBEIMConstruction::initialize_rb_construction(), integrate_function(), libMesh::MeshTools::libmesh_assert_consistent_distributed(), libMesh::MeshTools::libmesh_assert_consistent_distributed_nodes(), libMesh::MeshTools::libmesh_assert_contiguous_dof_ids(), libMesh::MeshTools::libmesh_assert_parallel_consistent_new_node_procids(), libMesh::MeshTools::libmesh_assert_parallel_consistent_procids< Elem >(), libMesh::MeshTools::libmesh_assert_parallel_consistent_procids< Node >(), libMesh::MeshTools::libmesh_assert_topology_consistent_procids< Node >(), libMesh::MeshTools::libmesh_assert_valid_boundary_ids(), libMesh::MeshTools::libmesh_assert_valid_dof_ids(), libMesh::MeshTools::libmesh_assert_valid_neighbors(), libMesh::DistributedMesh::libmesh_assert_valid_parallel_flags(), libMesh::DistributedMesh::libmesh_assert_valid_parallel_object_ids(), libMesh::DistributedMesh::libmesh_assert_valid_parallel_p_levels(), libMesh::MeshTools::libmesh_assert_valid_refinement_flags(), libMesh::MeshTools::libmesh_assert_valid_unique_ids(), libMesh::libmesh_petsc_preconditioner_apply(), libMesh::libmesh_petsc_snes_fd_residual(), libMesh::libmesh_petsc_snes_jacobian(), libMesh::libmesh_petsc_snes_mffd_residual(), libMesh::libmesh_petsc_snes_postcheck(), libMesh::libmesh_petsc_snes_residual(), libMesh::libmesh_petsc_snes_residual_helper(), libMesh::MeshRefinement::limit_level_mismatch_at_edge(), libMesh::MeshRefinement::limit_level_mismatch_at_node(), libMesh::MeshRefinement::limit_overrefined_boundary(), libMesh::MeshRefinement::limit_underrefined_boundary(), 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(), LinearElasticityWithContact::move_mesh(), libMesh::DistributedMesh::n_active_elem(), libMesh::MeshTools::n_active_levels(), libMesh::BoundaryInfo::n_boundary_conds(), libMesh::DofMap::n_constrained_dofs(), 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(), 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::petsc_auto_fieldsplit(), libMesh::System::point_gradient(), libMesh::System::point_hessian(), libMesh::System::point_value(), libMesh::DofMap::print_dof_constraints(), FEMParameters::read(), libMesh::Nemesis_IO::read(), libMesh::XdrIO::read(), libMesh::CheckpointIO::read_header(), libMesh::XdrIO::read_header(), libMesh::System::read_header(), libMesh::RBEvaluation::read_in_vectors_from_multiple_files(), libMesh::System::read_legacy_data(), libMesh::TransientRBConstruction::read_riesz_representors_from_files(), libMesh::RBConstruction::read_riesz_representors_from_files(), libMesh::System::read_SCALAR_dofs(), libMesh::XdrIO::read_serialized_bc_names(), libMesh::XdrIO::read_serialized_bcs_helper(), libMesh::System::read_serialized_blocked_dof_objects(), libMesh::XdrIO::read_serialized_connectivity(), libMesh::XdrIO::read_serialized_nodes(), libMesh::XdrIO::read_serialized_nodesets(), libMesh::XdrIO::read_serialized_subdomain_names(), libMesh::System::read_serialized_vector(), libMesh::MeshRefinement::refine_and_coarsen_elements(), libMesh::DistributedMesh::renumber_dof_objects(), LinearElasticityWithContact::residual_and_jacobian(), OverlappingAlgebraicGhostingTest::run_ghosting_test(), OverlappingCouplingGhostingTest::run_sparsity_pattern_test(), libMesh::DofMap::scatter_constraints(), libMesh::CheckpointIO::select_split_config(), libMesh::TransientRBConstruction::set_error_temporal_data(), libMesh::RBEIMConstruction::set_explicit_sys_subvector(), libMesh::DofMap::set_nonlocal_dof_objects(), libMesh::PetscDMWrapper::set_point_range_in_section(), libMesh::PetscDiffSolver::setup_petsc_data(), libMesh::LaplaceMeshSmoother::smooth(), libMesh::split_mesh(), libMesh::BoundaryInfo::sync(), libMesh::MeshRefinement::test_level_one(), MeshfunctionDFEM::test_mesh_function_dfem(), MeshfunctionDFEM::test_mesh_function_dfem_grad(), MeshFunctionTest::test_p_level(), libMesh::MeshRefinement::test_unflagged(), SystemsTest::testBlockRestrictedVarNDofs(), PointLocatorTest::testLocator(), BoundaryInfoTest::testMesh(), SystemsTest::testProjectCubeWithMeshFunction(), CheckpointIOTest::testSplitter(), 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::VTKIO::write_nodal_data(), libMesh::RBEvaluation::write_out_vectors(), libMesh::TransientRBConstruction::write_riesz_representors_to_files(), libMesh::RBConstruction::write_riesz_representors_to_files(), libMesh::System::write_SCALAR_dofs(), libMesh::XdrIO::write_serialized_bcs_helper(), libMesh::System::write_serialized_blocked_dof_objects(), libMesh::XdrIO::write_serialized_connectivity(), libMesh::XdrIO::write_serialized_nodes(), libMesh::XdrIO::write_serialized_nodesets(), libMesh::RBDataSerialization::RBEvaluationSerialization::write_to_file(), libMesh::RBDataSerialization::TransientRBEvaluationSerialization::write_to_file(), libMesh::RBDataSerialization::RBEIMEvaluationSerialization::write_to_file(), and libMesh::RBDataSerialization::RBSCMEvaluationSerialization::write_to_file().

◆ compare()

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

Definition at line 1217 of file equation_systems.C.

1220 {
1221  // safety check, whether we handle at least the same number
1222  // of systems
1223  std::vector<bool> os_result;
1224 
1225  if (this->n_systems() != other_es.n_systems())
1226  {
1227  if (verbose)
1228  {
1229  libMesh::out << " Fatal difference. This system handles "
1230  << this->n_systems() << " systems," << std::endl
1231  << " while the other system handles "
1232  << other_es.n_systems()
1233  << " systems." << std::endl
1234  << " Aborting comparison." << std::endl;
1235  }
1236  return false;
1237  }
1238  else
1239  {
1240  // start comparing each system
1241  const_system_iterator pos = _systems.begin();
1242  const const_system_iterator end = _systems.end();
1243 
1244  for (; pos != end; ++pos)
1245  {
1246  const std::string & sys_name = pos->first;
1247  const System & system = *(pos->second);
1248 
1249  // get the other system
1250  const System & other_system = other_es.get_system (sys_name);
1251 
1252  os_result.push_back (system.compare (other_system, threshold, verbose));
1253 
1254  }
1255 
1256  }
1257 
1258 
1259  // sum up the results
1260  if (os_result.size()==0)
1261  return true;
1262  else
1263  {
1264  bool os_identical;
1265  unsigned int n = 0;
1266  do
1267  {
1268  os_identical = os_result[n];
1269  n++;
1270  }
1271  while (os_identical && n<os_result.size());
1272  return os_identical;
1273  }
1274 }

References libMesh::EquationSystems::_systems, libMesh::System::compare(), end, libMesh::EquationSystems::get_system(), libMesh::EquationSystems::n_systems(), and libMesh::out.

Referenced by do_compare().

◆ delete_system()

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

Remove the system named name from the systems array.

Definition at line 431 of file equation_systems.C.

432 {
433  libmesh_deprecated();
434 
435  if (!_systems.count(name))
436  libmesh_error_msg("ERROR: no system named " << name);
437 
438  delete _systems[name];
439 
440  _systems.erase (name);
441 }

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

◆ disable_print_counter_info()

void libMesh::ReferenceCounter::disable_print_counter_info ( )
staticinherited

Definition at line 106 of file reference_counter.C.

107 {
108  _enable_print_counter = false;
109  return;
110 }

References libMesh::ReferenceCounter::_enable_print_counter.

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

◆ disable_refine_in_reinit()

void libMesh::EquationSystems::disable_refine_in_reinit ( )
inlineinherited

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

Definition at line 534 of file equation_systems.h.

534 { this->_refine_in_reinit = false; }

References libMesh::EquationSystems::_refine_in_reinit.

Referenced by EquationSystemsTest::testRefineThenReinitPreserveFlags().

◆ dt()

Real Biharmonic::dt ( )
inline

Definition at line 81 of file biharmonic.h.

81 { return _dt; }

References _dt.

◆ dt0()

Real Biharmonic::dt0 ( )
inline

Definition at line 80 of file biharmonic.h.

80 { return _dt0; }

References _dt0.

◆ enable_default_ghosting()

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.

Definition at line 312 of file equation_systems.C.

313 {
314  _enable_default_ghosting = enable;
315  MeshBase &mesh = this->get_mesh();
316 
317  if (enable)
318  mesh.add_ghosting_functor(mesh.default_ghosting());
319  else
320  mesh.remove_ghosting_functor(mesh.default_ghosting());
321 
322  for (unsigned int i=0; i != this->n_systems(); ++i)
323  {
324  DofMap & dof_map = this->get_system(i).get_dof_map();
325  if (enable)
326  dof_map.add_default_ghosting();
327  else
328  dof_map.remove_default_ghosting();
329  }
330 }

References libMesh::EquationSystems::_enable_default_ghosting, libMesh::DofMap::add_default_ghosting(), libMesh::EquationSystems::get_mesh(), libMesh::EquationSystems::get_system(), mesh, libMesh::EquationSystems::n_systems(), and libMesh::DofMap::remove_default_ghosting().

Referenced by EquationSystemsTest::testDisableDefaultGhosting().

◆ enable_print_counter_info()

void libMesh::ReferenceCounter::enable_print_counter_info ( )
staticinherited

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

Definition at line 100 of file reference_counter.C.

101 {
102  _enable_print_counter = true;
103  return;
104 }

References libMesh::ReferenceCounter::_enable_print_counter.

◆ enable_refine_in_reinit()

void libMesh::EquationSystems::enable_refine_in_reinit ( )
inlineinherited

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

Definition at line 529 of file equation_systems.h.

529 { this->_refine_in_reinit = true; }

References libMesh::EquationSystems::_refine_in_reinit.

◆ find_variable_numbers()

std::vector< std::pair< unsigned int, unsigned int > > libMesh::EquationSystems::find_variable_numbers ( std::vector< std::string > &  names,
const FEType type = nullptr 
) const
inherited

Finds system and variable numbers for any variables of type corresponding to the entries in the input 'names' vector.

Definition at line 904 of file equation_systems.C.

905 {
906  // This function must be run on all processors at once
907  parallel_object_only();
908 
909  libmesh_assert (this->n_systems());
910 
911  // If the names vector has entries, we will only populate the soln vector
912  // with names included in that list. Note: The names vector may be
913  // reordered upon exiting this function
914  std::vector<std::pair<unsigned int, unsigned int>> var_nums;
915  std::vector<std::string> filter_names = names;
916  bool is_filter_names = !filter_names.empty();
917 
918  names.clear();
919 
920  const_system_iterator pos = _systems.begin();
921  const const_system_iterator end = _systems.end();
922  unsigned sys_ctr = 0;
923 
924  for (; pos != end; ++pos, ++sys_ctr)
925  {
926  const System & system = *(pos->second);
927  const unsigned int nv_sys = system.n_vars();
928 
929  for (unsigned int var=0; var < nv_sys; ++var)
930  {
931  const std::string & name = system.variable_name(var);
932  if ((type && system.variable_type(var) != *type) ||
933  (is_filter_names && std::find(filter_names.begin(), filter_names.end(), name) == filter_names.end()))
934  continue;
935 
936  // Otherwise, this variable should be output
937  var_nums.push_back
938  (std::make_pair(system.number(), var));
939  }
940  }
941 
942  std::sort(var_nums.begin(), var_nums.end());
943 
944  for (const auto & var_num : var_nums)
945  {
946  const std::string & name =
947  this->get_system(var_num.first).variable_name(var_num.second);
948  if (names.empty() || names.back() != name)
949  names.push_back(name);
950  }
951 
952  return var_nums;
953 }

References end, libMesh::libmesh_assert(), libMesh::System::n_vars(), libMesh::Quality::name(), libMesh::System::number(), libMesh::System::variable_name(), and libMesh::System::variable_type().

Referenced by libMesh::EquationSystems::build_parallel_elemental_solution_vector(), libMesh::Nemesis_IO::write_element_data(), and libMesh::Nemesis_IO::write_nodal_data().

◆ get_info() [1/2]

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

Gets a string containing the reference information.

Definition at line 47 of file reference_counter.C.

48 {
49 #if defined(LIBMESH_ENABLE_REFERENCE_COUNTING) && defined(DEBUG)
50 
51  std::ostringstream oss;
52 
53  oss << '\n'
54  << " ---------------------------------------------------------------------------- \n"
55  << "| Reference count information |\n"
56  << " ---------------------------------------------------------------------------- \n";
57 
58  for (const auto & pr : _counts)
59  {
60  const std::string name(pr.first);
61  const unsigned int creations = pr.second.first;
62  const unsigned int destructions = pr.second.second;
63 
64  oss << "| " << name << " reference count information:\n"
65  << "| Creations: " << creations << '\n'
66  << "| Destructions: " << destructions << '\n';
67  }
68 
69  oss << " ---------------------------------------------------------------------------- \n";
70 
71  return oss.str();
72 
73 #else
74 
75  return "";
76 
77 #endif
78 }

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

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

◆ get_info() [2/2]

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

Definition at line 1278 of file equation_systems.C.

1279 {
1280  std::ostringstream oss;
1281 
1282  oss << " EquationSystems\n"
1283  << " n_systems()=" << this->n_systems() << '\n';
1284 
1285  // Print the info for the individual systems
1286  const_system_iterator pos = _systems.begin();
1287  const const_system_iterator end = _systems.end();
1288 
1289  for (; pos != end; ++pos)
1290  oss << pos->second->get_info();
1291 
1292 
1293  // // Possibly print the parameters
1294  // if (!this->parameters.empty())
1295  // {
1296  // oss << " n_parameters()=" << this->n_parameters() << '\n';
1297  // oss << " Parameters:\n";
1298 
1299  // for (const auto & pr : _parameters)
1300  // oss << " "
1301  // << "\""
1302  // << pr.first
1303  // << "\""
1304  // << "="
1305  // << pr.second
1306  // << '\n';
1307  // }
1308 
1309  return oss.str();
1310 }

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

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

◆ get_mesh() [1/2]

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

Definition at line 645 of file equation_systems.h.

646 {
647  return _mesh;
648 }

References libMesh::EquationSystems::_mesh.

◆ get_mesh() [2/2]

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

Definition at line 637 of file equation_systems.h.

638 {
639  return _mesh;
640 }

References libMesh::EquationSystems::_mesh.

Referenced by libMesh::UniformRefinementEstimator::_estimate_error(), libMesh::EquationSystems::_read_impl(), assemble(), LinearElasticity::assemble(), assemble_1D(), assemble_biharmonic(), assemble_cd(), assemble_elasticity(), assemble_ellipticdg(), assemble_helmholtz(), assemble_laplace(), assemble_mass(), assemble_matrices(), assemble_matrix_and_rhs(), assemble_poisson(), assemble_SchroedingerEquation(), assemble_shell(), assemble_stokes(), assemble_wave(), assembly_with_dg_fem_context(), libMesh::EquationSystems::build_variable_names(), LinearElasticity::compute_stresses(), compute_stresses(), LargeDeformationElasticity::compute_stresses(), libMesh::EquationSystems::enable_default_ghosting(), libMesh::AdjointRefinementEstimator::estimate_error(), fill_dirichlet_bc(), libMesh::MeshFunction::init(), LaplaceYoung::jacobian(), LargeDeformationElasticity::jacobian(), libMesh::EquationSystems::reinit_solutions(), LaplaceYoung::residual(), LargeDeformationElasticity::residual(), run_timestepping(), scale_mesh_and_plot(), libMesh::MeshfreeSolutionTransfer::transfer(), libMesh::DirectSolutionTransfer::transfer(), libMesh::DTKSolutionTransfer::transfer(), transform_mesh_and_plot(), libMesh::EquationSystems::write(), libMesh::MeshOutput< MeshBase >::write_discontinuous_equation_systems(), libMesh::MeshOutput< MeshBase >::write_equation_systems(), libMesh::Nemesis_IO_Helper::write_nodal_solution(), write_output(), and write_output_solvedata().

◆ 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.

Definition at line 873 of file equation_systems.C.

875 {
876  libmesh_deprecated();
877  this->build_elemental_solution_vector(soln, names);
878 }

References libMesh::EquationSystems::build_elemental_solution_vector().

◆ get_system() [1/8]

template<typename T_sys >
T_sys & libMesh::EquationSystems::get_system ( const std::string &  name)
inlineinherited
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 776 of file equation_systems.h.

777 {
778  system_iterator pos = _systems.find(name);
779 
780  // Check for errors
781  if (pos == _systems.end())
782  libmesh_error_msg("ERROR: no system named " << name << " found!");
783 
784  // Attempt dynamic cast
785  return *cast_ptr<T_sys *>(pos->second);
786 }

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

◆ get_system() [2/8]

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

Definition at line 803 of file equation_systems.h.

804 {
805  return this->get_system<System>(name);
806 }

References libMesh::Quality::name().

◆ get_system() [3/8]

template<typename T_sys >
const T_sys & libMesh::EquationSystems::get_system ( const std::string &  name) const
inlineinherited
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 757 of file equation_systems.h.

758 {
759  const_system_iterator pos = _systems.find(name);
760 
761  // Check for errors
762  if (pos == _systems.end())
763  libmesh_error_msg("ERROR: no system named \"" << name << "\" found!");
764 
765  // Attempt dynamic cast
766  return *cast_ptr<T_sys *>(pos->second);
767 }

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

Referenced by libMesh::ExactSolution::_compute_error(), libMesh::UniformRefinementEstimator::_estimate_error(), libMesh::EquationSystems::_read_impl(), libMesh::EquationSystems::_remove_default_ghosting(), add_M_C_K_helmholtz(), libMesh::EnsightIO::add_scalar(), libMesh::RBSCMConstruction::add_scaled_symm_Aq(), libMesh::EquationSystems::add_system(), libMesh::EnsightIO::add_vector(), libMesh::EquationSystems::adjoint_solve(), libMesh::EquationSystems::allgather(), apply_initial(), assemble(), LinearElasticity::assemble(), assemble_1D(), assemble_biharmonic(), assemble_cd(), assemble_elasticity(), assemble_ellipticdg(), assemble_helmholtz(), assemble_laplace(), assemble_mass(), assemble_matrices(), assemble_matrix_and_rhs(), assemble_poisson(), assemble_SchroedingerEquation(), assemble_shell(), assemble_stokes(), assemble_wave(), assembly_with_dg_fem_context(), libMesh::ExactSolution::attach_exact_deriv(), libMesh::ExactSolution::attach_exact_hessian(), libMesh::ExactSolution::attach_exact_value(), libMesh::EquationSystems::build_parallel_elemental_solution_vector(), libMesh::EquationSystems::compare(), libMesh::ExactSolution::compute_error(), LinearElasticityWithContact::compute_stresses(), LinearElasticity::compute_stresses(), compute_stresses(), LargeDeformationElasticity::compute_stresses(), libMesh::GMVIO::copy_nodal_solution(), SolidSystem::element_time_derivative(), libMesh::EquationSystems::enable_default_ghosting(), libMesh::ExactSolution::error_norm(), libMesh::ExactErrorEstimator::estimate_error(), libMesh::ErrorEstimator::estimate_errors(), libMesh::ExactSolution::ExactSolution(), fill_dirichlet_bc(), libMesh::DTKAdapter::find_sys(), libMesh::RBEIMConstruction::get_explicit_system(), libMesh::EquationSystems::init(), init_cd(), SolidSystem::init_data(), init_sys(), initialize(), LaplaceYoung::jacobian(), LargeDeformationElasticity::jacobian(), line_print(), libMesh::RBSCMConstruction::load_matrix_B(), main(), libMesh::RBSCMConstruction::perform_SCM_greedy(), libMesh::EquationSystems::reinit_solutions(), libMesh::EquationSystems::reinit_systems(), LaplaceYoung::residual(), LargeDeformationElasticity::residual(), run_timestepping(), SolidSystem::save_initial_mesh(), libMesh::EquationSystems::sensitivity_solve(), SolidSystem::side_time_derivative(), libMesh::EquationSystems::solve(), MixedDimensionMeshTest::testDofOrdering(), MixedDimensionRefinedMeshTest::testDofOrdering(), MixedDimensionNonUniformRefinement::testDofOrdering(), MixedDimensionNonUniformRefinementTriangle::testDofOrdering(), MixedDimensionNonUniformRefinement3D::testDofOrdering(), SlitMeshRefinedSystemTest::testRestart(), libMesh::EquationSystems::update(), libMesh::Nemesis_IO_Helper::write_element_values(), libMesh::Nemesis_IO_Helper::write_nodal_solution(), libMesh::EnsightIO::write_scalar_ascii(), and libMesh::EnsightIO::write_vector_ascii().

◆ get_system() [4/8]

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

Definition at line 795 of file equation_systems.h.

796 {
797  return this->get_system<System>(name);
798 }

References libMesh::Quality::name().

◆ get_system() [5/8]

template<typename T_sys >
T_sys & libMesh::EquationSystems::get_system ( const unsigned int  num)
inlineinherited
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 731 of file equation_systems.h.

732 {
733  libmesh_assert_less (num, this->n_systems());
734 
735  const_system_iterator pos = _systems.begin();
736  const const_system_iterator end = _systems.end();
737 
738  for (; pos != end; ++pos)
739  if (pos->second->number() == num)
740  break;
741 
742  // Check for errors
743  if (pos == end)
744  libmesh_error_msg("ERROR: no system number " << num << " found!");
745 
746  // Attempt dynamic cast
747  return *cast_ptr<T_sys *>(pos->second);
748 }

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

◆ get_system() [6/8]

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

Definition at line 819 of file equation_systems.h.

820 {
821  return this->get_system<System>(num);
822 }

◆ get_system() [7/8]

template<typename T_sys >
const T_sys & libMesh::EquationSystems::get_system ( const unsigned int  num) const
inlineinherited
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 706 of file equation_systems.h.

707 {
708  libmesh_assert_less (num, this->n_systems());
709 
710 
711  const_system_iterator pos = _systems.begin();
712  const const_system_iterator end = _systems.end();
713 
714  for (; pos != end; ++pos)
715  if (pos->second->number() == num)
716  break;
717 
718  // Check for errors
719  if (pos == end)
720  libmesh_error_msg("ERROR: no system number " << num << " found!");
721 
722  // Attempt dynamic cast
723  return *cast_ptr<T_sys *>(pos->second);
724 }

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

◆ get_system() [8/8]

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

Definition at line 811 of file equation_systems.h.

812 {
813  return this->get_system<System>(num);
814 }

◆ 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.

Definition at line 841 of file equation_systems.C.

843 {
844  unsigned int var_num=0;
845 
846  vars_active_subdomains.clear();
847  vars_active_subdomains.resize(names.size());
848 
849  const_system_iterator pos = _systems.begin();
850  const const_system_iterator end = _systems.end();
851 
852  for (; pos != end; ++pos)
853  {
854  for (auto vn : IntRange<unsigned int>(0, pos->second->n_vars()))
855  {
856  const std::string & var_name = pos->second->variable_name(vn);
857 
858  auto names_it = std::find(names.begin(), names.end(), var_name);
859  if(names_it != names.end())
860  {
861  const Variable & variable = pos->second->variable(vn);
862  const std::set<subdomain_id_type> & active_subdomains = variable.active_subdomains();
863  vars_active_subdomains[var_num++] = active_subdomains;
864  }
865  }
866  }
867 
868  libmesh_assert_equal_to(var_num, names.size());
869 }

References libMesh::EquationSystems::_systems, libMesh::Variable::active_subdomains(), and end.

Referenced by libMesh::Nemesis_IO::write_element_data(), libMesh::ExodusII_IO::write_element_data(), and libMesh::ExodusII_IO::write_element_data_from_discontinuous_nodal_data().

◆ has_system()

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

Definition at line 694 of file equation_systems.h.

695 {
696  if (_systems.find(name) == _systems.end())
697  return false;
698  return true;
699 }

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

Referenced by libMesh::EnsightIO::add_scalar(), libMesh::EnsightIO::add_vector(), libMesh::ExactSolution::compute_error(), libMesh::ExactSolution::error_norm(), and main().

◆ increment_constructor_count()

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

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.

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 }

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

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

◆ increment_destructor_count()

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

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.

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 }

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

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

◆ init()

void Biharmonic::init ( )
virtual

Initialize all the systems.

Reimplemented from libMesh::EquationSystems.

Definition at line 213 of file biharmonic.C.

214 {
215  if (_verbose)
216  libMesh::out << ">>> Initializing Biharmonic\n";
217 
218  _dt = 0;
219  _o_count = 0;
221 
222  if (_verbose)
223  libMesh::out << "<<< Initializing Biharmonic\n";
224 }

References _dt, _o_count, _verbose, libMesh::TriangleWrapper::init(), and libMesh::out.

◆ 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.

Definition at line 1362 of file equation_systems.C.

1363 {
1364  std::size_t tot=0;
1365 
1366  const_system_iterator pos = _systems.begin();
1367  const const_system_iterator end = _systems.end();
1368 
1369  for (; pos != end; ++pos)
1370  tot += pos->second->n_active_dofs();
1371 
1372  return tot;
1373 }

References libMesh::EquationSystems::_systems, and end.

Referenced by main(), and write_output_solvedata().

◆ n_dofs()

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

Definition at line 1346 of file equation_systems.C.

1347 {
1348  std::size_t tot=0;
1349 
1350  const_system_iterator pos = _systems.begin();
1351  const const_system_iterator end = _systems.end();
1352 
1353  for (; pos != end; ++pos)
1354  tot += pos->second->n_dofs();
1355 
1356  return tot;
1357 }

References libMesh::EquationSystems::_systems, and end.

Referenced by Biharmonic::JR::bounds(), and Biharmonic::JR::residual_and_jacobian().

◆ n_objects()

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

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

Definition at line 83 of file reference_counter.h.

84  { return _n_objects; }

References libMesh::ReferenceCounter::_n_objects.

◆ n_processors()

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

Definition at line 100 of file parallel_object.h.

101  { return cast_int<processor_id_type>(_communicator.size()); }

References libMesh::ParallelObject::_communicator.

Referenced by libMesh::BoundaryInfo::_find_id_maps(), libMesh::DofMap::add_constraints_to_send_list(), libMesh::PetscDMWrapper::add_dofs_to_section(), libMesh::DistributedMesh::add_elem(), libMesh::DofMap::add_neighbors_to_send_list(), libMesh::DistributedMesh::add_node(), libMesh::LaplaceMeshSmoother::allgather_graph(), libMesh::DofMap::allgather_recursive_constraints(), libMesh::FEMSystem::assembly(), libMesh::AztecLinearSolver< T >::AztecLinearSolver(), libMesh::BoundaryInfo::build_node_list_from_side_list(), libMesh::EquationSystems::build_parallel_elemental_solution_vector(), libMesh::DistributedMesh::clear(), libMesh::Nemesis_IO_Helper::compute_border_node_ids(), libMesh::Nemesis_IO_Helper::construct_nemesis_filename(), libMesh::ExodusII_IO::copy_scalar_solution(), 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::EnsightIO::EnsightIO(), libMesh::SystemSubsetBySubdomain::init(), libMesh::PetscDMWrapper::init_and_attach_petscdm(), libMesh::Nemesis_IO_Helper::initialize(), libMesh::DistributedMesh::insert_elem(), libMesh::MeshTools::libmesh_assert_contiguous_dof_ids(), libMesh::MeshTools::libmesh_assert_parallel_consistent_new_node_procids(), libMesh::MeshTools::libmesh_assert_parallel_consistent_procids< Elem >(), libMesh::MeshTools::libmesh_assert_parallel_consistent_procids< Node >(), libMesh::MeshTools::libmesh_assert_topology_consistent_procids< Node >(), libMesh::MeshTools::libmesh_assert_valid_boundary_ids(), libMesh::MeshTools::libmesh_assert_valid_dof_ids(), libMesh::MeshTools::libmesh_assert_valid_neighbors(), libMesh::MeshTools::libmesh_assert_valid_refinement_flags(), libMesh::DofMap::local_variable_indices(), libMesh::MeshRefinement::make_coarsening_compatible(), libMesh::MeshBase::partition(), libMesh::System::point_gradient(), libMesh::System::point_hessian(), libMesh::System::point_value(), libMesh::DofMap::prepare_send_list(), libMesh::DofMap::print_dof_constraints(), libMesh::NameBasedIO::read(), libMesh::Nemesis_IO::read(), libMesh::CheckpointIO::read(), libMesh::CheckpointIO::read_connectivity(), libMesh::XdrIO::read_header(), libMesh::CheckpointIO::read_nodes(), libMesh::System::read_parallel_data(), libMesh::System::read_SCALAR_dofs(), libMesh::System::read_serialized_blocked_dof_objects(), libMesh::System::read_serialized_vector(), libMesh::DistributedMesh::renumber_dof_objects(), OverlappingFunctorTest::run_partitioner_test(), libMesh::DofMap::scatter_constraints(), libMesh::DofMap::set_nonlocal_dof_objects(), libMesh::PetscDMWrapper::set_point_range_in_section(), CheckpointIOTest::testSplitter(), WriteVecAndScalar::testWrite(), libMesh::MeshRefinement::uniformly_coarsen(), libMesh::DistributedMesh::update_parallel_id_counts(), libMesh::GMVIO::write_binary(), libMesh::GMVIO::write_discontinuous_gmv(), libMesh::VTKIO::write_nodal_data(), libMesh::System::write_parallel_data(), libMesh::System::write_SCALAR_dofs(), libMesh::XdrIO::write_serialized_bcs_helper(), libMesh::System::write_serialized_blocked_dof_objects(), libMesh::XdrIO::write_serialized_connectivity(), libMesh::XdrIO::write_serialized_nodes(), and libMesh::XdrIO::write_serialized_nodesets().

◆ n_systems()

unsigned int libMesh::EquationSystems::n_systems ( ) const
inlineinherited

◆ n_vars()

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

Definition at line 1331 of file equation_systems.C.

1332 {
1333  unsigned int tot=0;
1334 
1335  const_system_iterator pos = _systems.begin();
1336  const const_system_iterator end = _systems.end();
1337 
1338  for (; pos != end; ++pos)
1339  tot += pos->second->n_vars();
1340 
1341  return tot;
1342 }

References libMesh::EquationSystems::_systems, and end.

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

◆ output()

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

Definition at line 251 of file biharmonic.C.

255 {
256  if (!force && t - o_t < _o_dt)
257  return;
258 
259  ++_o_count;
260 
261  if (_verbose)
262  libMesh::out << "Writing state "
263  << timestep
264  << " at time "
265  << t
266  << " to file "
267  << _ofile
268  << "; output a total of "
269  << _o_count
270  << " states so far\n";
271 
272  _exio->write_timestep(_ofile, *this, timestep, t);
273 
274  if (!force)
275  o_t = t;
276 }

References _exio, _o_count, _o_dt, _ofile, _verbose, and libMesh::out.

Referenced by run().

◆ print_info() [1/2]

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

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

Definition at line 1314 of file equation_systems.C.

1315 {
1316  os << this->get_info()
1317  << std::endl;
1318 }

References libMesh::EquationSystems::get_info().

Referenced by assemble_and_solve(), do_compare(), main(), and libMesh::operator<<().

◆ print_info() [2/2]

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

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

Definition at line 87 of file reference_counter.C.

88 {
90  out_stream << ReferenceCounter::get_info();
91 }

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

◆ processor_id()

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

Definition at line 106 of file parallel_object.h.

107  { return cast_int<processor_id_type>(_communicator.rank()); }

References libMesh::ParallelObject::_communicator.

Referenced by libMesh::BoundaryInfo::_find_id_maps(), libMesh::EquationSystems::_read_impl(), libMesh::PetscDMWrapper::add_dofs_to_section(), libMesh::DistributedMesh::add_elem(), libMesh::BoundaryInfo::add_elements(), libMesh::DofMap::add_neighbors_to_send_list(), libMesh::DistributedMesh::add_node(), libMesh::UnstructuredMesh::all_second_order(), libMesh::MeshTools::Modification::all_tri(), libMesh::DofMap::allgather_recursive_constraints(), libMesh::FEMSystem::assembly(), libMesh::Nemesis_IO_Helper::build_element_and_node_maps(), libMesh::InfElemBuilder::build_inf_elem(), libMesh::BoundaryInfo::build_node_list_from_side_list(), libMesh::EquationSystems::build_parallel_elemental_solution_vector(), 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::ExodusII_IO::copy_scalar_solution(), 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::DofMap::end_dof(), libMesh::DofMap::end_old_dof(), libMesh::EnsightIO::EnsightIO(), libMesh::RBEIMConstruction::evaluate_mesh_function(), libMesh::MeshFunction::find_element(), libMesh::MeshFunction::find_elements(), libMesh::UnstructuredMesh::find_neighbors(), libMesh::DofMap::first_dof(), libMesh::DofMap::first_old_dof(), 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::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::DofMap::get_local_constraints(), libMesh::Nemesis_IO_Helper::get_node_cmap(), libMesh::Nemesis_IO_Helper::get_node_map(), libMesh::Nemesis_IO_Helper::get_ns_param_global(), libMesh::Nemesis_IO_Helper::get_ss_param_global(), libMesh::SparsityPattern::Build::handle_vi_vj(), libMesh::SystemSubsetBySubdomain::init(), libMesh::PetscDMWrapper::init_and_attach_petscdm(), HeatSystem::init_data(), libMesh::ExodusII_IO_Helper::initialize(), libMesh::ExodusII_IO_Helper::initialize_element_variables(), libMesh::ExodusII_IO_Helper::initialize_global_variables(), libMesh::ExodusII_IO_Helper::initialize_nodal_variables(), libMesh::DistributedMesh::insert_elem(), libMesh::DofMap::is_evaluable(), libMesh::SparsityPattern::Build::join(), libMesh::DofMap::last_dof(), 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_consistent_distributed(), libMesh::MeshTools::libmesh_assert_consistent_distributed_nodes(), libMesh::MeshTools::libmesh_assert_contiguous_dof_ids(), libMesh::MeshTools::libmesh_assert_parallel_consistent_procids< Elem >(), libMesh::MeshTools::libmesh_assert_valid_neighbors(), libMesh::DistributedMesh::libmesh_assert_valid_parallel_object_ids(), libMesh::DofMap::local_variable_indices(), main(), libMesh::MeshRefinement::make_coarsening_compatible(), AugmentSparsityOnInterface::mesh_reinit(), libMesh::MeshBase::n_active_local_elem(), libMesh::BoundaryInfo::n_boundary_conds(), libMesh::BoundaryInfo::n_edge_conds(), libMesh::DofMap::n_local_dofs(), 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::SparsityPattern::Build::operator()(), libMesh::DistributedMesh::own_node(), libMesh::System::point_gradient(), libMesh::System::point_hessian(), libMesh::System::point_value(), libMesh::DofMap::print_dof_constraints(), libMesh::Nemesis_IO_Helper::put_cmap_params(), libMesh::Nemesis_IO_Helper::put_elem_cmap(), libMesh::Nemesis_IO_Helper::put_elem_map(), libMesh::Nemesis_IO_Helper::put_loadbal_param(), libMesh::Nemesis_IO_Helper::put_node_cmap(), libMesh::Nemesis_IO_Helper::put_node_map(), libMesh::NameBasedIO::read(), libMesh::Nemesis_IO::read(), libMesh::XdrIO::read(), libMesh::CheckpointIO::read(), libMesh::ExodusII_IO_Helper::read_elem_num_map(), libMesh::ExodusII_IO_Helper::read_global_values(), libMesh::CheckpointIO::read_header(), libMesh::XdrIO::read_header(), libMesh::System::read_header(), libMesh::RBEvaluation::read_in_vectors_from_multiple_files(), libMesh::System::read_legacy_data(), libMesh::ExodusII_IO_Helper::read_node_num_map(), libMesh::System::read_parallel_data(), libMesh::TransientRBConstruction::read_riesz_representors_from_files(), libMesh::RBConstruction::read_riesz_representors_from_files(), libMesh::System::read_SCALAR_dofs(), libMesh::XdrIO::read_serialized_bc_names(), libMesh::XdrIO::read_serialized_bcs_helper(), libMesh::System::read_serialized_blocked_dof_objects(), libMesh::XdrIO::read_serialized_connectivity(), libMesh::System::read_serialized_data(), libMesh::XdrIO::read_serialized_nodes(), libMesh::XdrIO::read_serialized_nodesets(), libMesh::XdrIO::read_serialized_subdomain_names(), libMesh::System::read_serialized_vector(), libMesh::System::read_serialized_vectors(), libMesh::DistributedMesh::renumber_dof_objects(), libMesh::DofMap::scatter_constraints(), libMesh::CheckpointIO::select_split_config(), libMesh::DofMap::set_nonlocal_dof_objects(), libMesh::PetscDMWrapper::set_point_range_in_section(), libMesh::LaplaceMeshSmoother::smooth(), DefaultCouplingTest::testCoupling(), PointNeighborCouplingTest::testCoupling(), MeshInputTest::testDynaReadElem(), MeshInputTest::testDynaReadPatch(), MeshInputTest::testExodusCopyElementSolution(), MeshInputTest::testExodusWriteElementDataFromDiscontinuousNodalData(), SystemsTest::testProjectMatrix1D(), SystemsTest::testProjectMatrix2D(), SystemsTest::testProjectMatrix3D(), BoundaryInfoTest::testShellFaceConstraints(), CheckpointIOTest::testSplitter(), 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::NameBasedIO::write(), libMesh::XdrIO::write(), libMesh::CheckpointIO::write(), libMesh::EquationSystems::write(), libMesh::GMVIO::write_discontinuous_gmv(), libMesh::ExodusII_IO::write_element_data(), libMesh::ExodusII_IO_Helper::write_element_values(), libMesh::ExodusII_IO_Helper::write_element_values_element_major(), libMesh::ExodusII_IO_Helper::write_elements(), libMesh::ExodusII_IO::write_global_data(), libMesh::ExodusII_IO_Helper::write_global_values(), libMesh::System::write_header(), libMesh::ExodusII_IO::write_information_records(), libMesh::ExodusII_IO_Helper::write_information_records(), libMesh::ExodusII_IO_Helper::write_nodal_coordinates(), libMesh::VTKIO::write_nodal_data(), 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::System::write_parallel_data(), libMesh::RBConstruction::write_riesz_representors_to_files(), libMesh::System::write_SCALAR_dofs(), libMesh::XdrIO::write_serialized_bc_names(), libMesh::XdrIO::write_serialized_bcs_helper(), libMesh::System::write_serialized_blocked_dof_objects(), libMesh::XdrIO::write_serialized_connectivity(), libMesh::System::write_serialized_data(), libMesh::XdrIO::write_serialized_nodes(), libMesh::XdrIO::write_serialized_nodesets(), libMesh::XdrIO::write_serialized_subdomain_names(), libMesh::System::write_serialized_vector(), libMesh::System::write_serialized_vectors(), libMesh::ExodusII_IO_Helper::write_sideset_data(), libMesh::Nemesis_IO_Helper::write_sidesets(), libMesh::ExodusII_IO_Helper::write_sidesets(), libMesh::ExodusII_IO::write_timestep(), libMesh::ExodusII_IO_Helper::write_timestep(), and libMesh::ExodusII_IO::write_timestep_discontinuous().

◆ read() [1/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

Definition at line 72 of file equation_systems_io.C.

75 {
76  XdrMODE mode = READ;
77  if (name.find(".xdr") != std::string::npos)
78  mode = DECODE;
79  this->read(name, mode, read_flags, partition_agnostic);
80 
81 #ifdef LIBMESH_ENABLE_AMR
82  MeshRefinement mesh_refine(_mesh);
83  mesh_refine.clean_refinement_flags();
84 #endif
85 }

References libMesh::EquationSystems::_mesh, libMesh::MeshRefinement::clean_refinement_flags(), libMesh::DECODE, libMesh::Quality::name(), libMesh::READ, and libMesh::EquationSystems::read().

◆ read() [2/4]

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

Definition at line 443 of file equation_systems.h.

446  { read<Number>(name, read_flags, partition_agnostic); }

References libMesh::Quality::name().

◆ read() [3/4]

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

Definition at line 432 of file equation_systems.h.

436  { read<Number>(name, mode, read_flags, partition_agnostic); }

References libMesh::Quality::name().

◆ read() [4/4]

template<typename InValType >
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

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!

Definition at line 90 of file equation_systems_io.C.

94 {
95  // If we have exceptions enabled we can be considerate and try
96  // to read old restart files which contain infinite element
97  // information but do not have the " with infinite elements"
98  // string in the version information.
99 
100  // First try the read the user requested
101  libmesh_try
102  {
103  this->_read_impl<InValType> (name, mode, read_flags, partition_agnostic);
104  }
105 
106  // If that fails, try it again but explicitly request we look for infinite element info
107  libmesh_catch (...)
108  {
109  libMesh::out << "\n*********************************************************************\n"
110  << "READING THE FILE \"" << name << "\" FAILED.\n"
111  << "It is possible this file contains infinite element information,\n"
112  << "but the version string does not contain \" with infinite elements\"\n"
113  << "Let's try this again, but looking for infinite element information...\n"
114  << "*********************************************************************\n"
115  << std::endl;
116 
117  libmesh_try
118  {
119  this->_read_impl<InValType> (name, mode, read_flags | EquationSystems::TRY_READ_IFEMS, partition_agnostic);
120  }
121 
122  // If all that failed, we are out of ideas here...
123  libmesh_catch (...)
124  {
125  libMesh::out << "\n*********************************************************************\n"
126  << "Well, at least we tried!\n"
127  << "Good Luck!!\n"
128  << "*********************************************************************\n"
129  << std::endl;
130  LIBMESH_THROW();
131  }
132  }
133 
134 #ifdef LIBMESH_ENABLE_AMR
135  MeshRefinement mesh_refine(_mesh);
136  mesh_refine.clean_refinement_flags();
137 #endif
138 }

References libMesh::EquationSystems::_mesh, libMesh::MeshRefinement::clean_refinement_flags(), libMesh::Quality::name(), libMesh::out, and libMesh::EquationSystems::TRY_READ_IFEMS.

Referenced by libMesh::EquationSystems::_read_impl(), main(), libMesh::EquationSystems::read(), and SlitMeshRefinedSystemTest::testRestart().

◆ refine_in_reinit_flag()

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

Definition at line 539 of file equation_systems.h.

539 { return this->_refine_in_reinit; }

References libMesh::EquationSystems::_refine_in_reinit.

◆ reinit()

void libMesh::EquationSystems::reinit ( )
virtualinherited

◆ 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.

Definition at line 133 of file equation_systems.C.

134 {
135  parallel_object_only();
136 
137  const unsigned int n_sys = this->n_systems();
138  libmesh_assert_not_equal_to (n_sys, 0);
139 
140  // We may have added new systems since our last
141  // EquationSystems::(re)init call
142  bool _added_new_systems = false;
143  for (unsigned int i=0; i != n_sys; ++i)
144  if (!this->get_system(i).is_initialized())
145  _added_new_systems = true;
146 
147  if (_added_new_systems)
148  {
149  // Our DofObjects will need space for the additional systems
150  for (auto & node : _mesh.node_ptr_range())
151  node->set_n_systems(n_sys);
152 
153  for (auto & elem : _mesh.element_ptr_range())
154  elem->set_n_systems(n_sys);
155 
156  // And any new systems will need initialization
157  for (unsigned int i=0; i != n_sys; ++i)
158  if (!this->get_system(i).is_initialized())
159  this->get_system(i).init();
160  }
161 
162 
163  // We used to assert that all nodes and elements *already* had
164  // n_systems() properly set; however this is false in the case where
165  // user code has manually added nodes and/or elements to an
166  // already-initialized system.
167 
168  // Make sure all the \p DofObject entities know how many systems
169  // there are.
170  {
171  // All the nodes
172  for (auto & node : _mesh.node_ptr_range())
173  node->set_n_systems(this->n_systems());
174 
175  // All the elements
176  for (auto & elem : _mesh.element_ptr_range())
177  elem->set_n_systems(this->n_systems());
178  }
179 
180  // Localize each system's vectors
181  for (unsigned int i=0; i != this->n_systems(); ++i)
182  this->get_system(i).re_update();
183 
184 #ifdef LIBMESH_ENABLE_AMR
185 
186  bool mesh_changed = false;
187 
188  // FIXME: For backwards compatibility, assume
189  // refine_and_coarsen_elements or refine_uniformly have already
190  // been called
191  {
192  for (unsigned int i=0; i != this->n_systems(); ++i)
193  {
194  System & sys = this->get_system(i);
195 
196  // Even if the system doesn't have any variables in it we want
197  // consistent behavior; e.g. distribute_dofs should have the
198  // opportunity to count up zero dofs on each processor.
199  //
200  // Who's been adding zero-var systems anyway, outside of my
201  // unit tests? - RHS
202  // if (!sys.n_vars())
203  // continue;
204 
205  sys.get_dof_map().distribute_dofs(_mesh);
206 
207  // Recreate any user or internal constraints
208  sys.reinit_constraints();
209 
210  sys.prolong_vectors();
211  }
212  mesh_changed = true;
213  }
214 
215  if (this->_refine_in_reinit)
216  {
217  // Don't override any user refinement settings
218  MeshRefinement mesh_refine(_mesh);
219  mesh_refine.face_level_mismatch_limit() = 0; // unlimited
220  mesh_refine.overrefined_boundary_limit() = -1; // unlimited
221  mesh_refine.underrefined_boundary_limit() = -1; // unlimited
222 
223  // Try to coarsen the mesh, then restrict each system's vectors
224  // if necessary
225  if (mesh_refine.coarsen_elements())
226  {
227  for (unsigned int i=0; i != this->n_systems(); ++i)
228  {
229  System & sys = this->get_system(i);
230  sys.get_dof_map().distribute_dofs(_mesh);
231  sys.reinit_constraints();
232  sys.restrict_vectors();
233  }
234  mesh_changed = true;
235  }
236 
237  // Once vectors are all restricted, we can delete
238  // children of coarsened elements
239  if (mesh_changed)
240  this->get_mesh().contract();
241 
242  // Try to refine the mesh, then prolong each system's vectors
243  // if necessary
244  if (mesh_refine.refine_elements())
245  {
246  for (unsigned int i=0; i != this->n_systems(); ++i)
247  {
248  System & sys = this->get_system(i);
249  sys.get_dof_map().distribute_dofs(_mesh);
250  sys.reinit_constraints();
251  sys.prolong_vectors();
252  }
253  mesh_changed = true;
254  }
255  }
256 
257  return mesh_changed;
258 
259 #endif // #ifdef LIBMESH_ENABLE_AMR
260 
261  return false;
262 }

References libMesh::EquationSystems::_mesh, libMesh::EquationSystems::_refine_in_reinit, libMesh::MeshRefinement::coarsen_elements(), libMesh::MeshBase::contract(), libMesh::DofMap::distribute_dofs(), libMesh::MeshBase::element_ptr_range(), libMesh::MeshRefinement::face_level_mismatch_limit(), libMesh::System::get_dof_map(), libMesh::EquationSystems::get_mesh(), libMesh::EquationSystems::get_system(), libMesh::EquationSystems::n_systems(), libMesh::MeshBase::node_ptr_range(), libMesh::MeshRefinement::overrefined_boundary_limit(), libMesh::System::prolong_vectors(), libMesh::MeshRefinement::refine_elements(), libMesh::System::reinit_constraints(), libMesh::System::restrict_vectors(), and libMesh::MeshRefinement::underrefined_boundary_limit().

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

◆ reinit_systems()

void libMesh::EquationSystems::reinit_systems ( )
virtualinherited

Reinitialize all systems on the current mesh.

Definition at line 266 of file equation_systems.C.

267 {
268  for (unsigned int i=0; i != this->n_systems(); ++i)
269  this->get_system(i).reinit();
270 }

References libMesh::EquationSystems::get_system(), and libMesh::EquationSystems::n_systems().

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

◆ run()

void Biharmonic::run ( )

Definition at line 287 of file biharmonic.C.

288 {
289  Real t = _t0, o_t = 0.0;
290  int timestep = 1;
291 
292  // Force-write the initial timestep
293  output(timestep, t, o_t, true);
294 
295  while (t < _t1)
296  {
297  ++timestep;
298 
299  // A pretty update message
300  if (_verbose)
301  libMesh::out << "Solving for state " << timestep << ", time " << t << "\n";
302 
303  // Move biharmonic one timestep forward
304  step();
305 
306  // Keep track of time and timestep
307  t += _dt;
308 
309  // Output
310  output(timestep, t, o_t);
311  } // while(t < _t1)
312 
313  // Force-write the final timestep
314  output(timestep, t, o_t, true);
315 }

References _dt, _t0, _t1, _verbose, libMesh::out, output(), libMesh::Real, and step().

◆ sensitivity_solve()

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.

Definition at line 456 of file equation_systems.C.

457 {
458  libmesh_assert (this->n_systems());
459 
460  for (unsigned int i=0; i != this->n_systems(); ++i)
461  this->get_system(i).sensitivity_solve(parameters_in);
462 }

References libMesh::EquationSystems::get_system(), libMesh::libmesh_assert(), and libMesh::EquationSystems::n_systems().

◆ solve()

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.

Definition at line 446 of file equation_systems.C.

447 {
448  libmesh_assert (this->n_systems());
449 
450  for (unsigned int i=0; i != this->n_systems(); ++i)
451  this->get_system(i).solve();
452 }

References libMesh::EquationSystems::get_system(), libMesh::libmesh_assert(), and libMesh::EquationSystems::n_systems().

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

◆ step()

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

Definition at line 230 of file biharmonic.C.

231 {
232  // We need to update the old solution vector.
233  // The old solution vector will be the current solution vector from the
234  // previous time step. We use vector assignment. Only TransientSystems
235  // (and systems derived from them) contain old solutions.
236  if (dt_in < 0)
237  _dt = _dt0;
238  else
239  _dt = dt_in;
240 
241  *(_jr->old_local_solution) = *(_jr->current_local_solution);
242 
243  // this will localize the current solution, resulting in a
244  // current_local_solution with correct ghost values
245  _jr->solve();
246 }

References _dt, _dt0, and _jr.

Referenced by run().

◆ update()

void libMesh::EquationSystems::update ( )
inherited

Updates local values for all the systems.

Definition at line 334 of file equation_systems.C.

335 {
336  LOG_SCOPE("update()", "EquationSystems");
337 
338  // Localize each system's vectors
339  for (unsigned int i=0; i != this->n_systems(); ++i)
340  this->get_system(i).update();
341 }

References libMesh::EquationSystems::get_system(), and libMesh::EquationSystems::n_systems().

Referenced by libMesh::EquationSystems::_read_impl(), and main().

◆ verbose()

bool Biharmonic::verbose ( )
inline

Definition at line 79 of file biharmonic.h.

79 { return _verbose; }

References _verbose.

◆ viewParameters()

void Biharmonic::viewParameters ( )

Definition at line 166 of file biharmonic.C.

167 {
168  libMesh::out << "Biharmonic parameters:\n";
169 
170  // Print verbosity status
171  if (_verbose)
172  libMesh::out << "verbose mode is on\n";
173  else
174  libMesh::out << "verbose mode is off\n";
175 
176  // Print parameters
177  libMesh::out << "mesh dimension = " << _dim << "\n";
178  libMesh::out << "initial linear mesh size = " << _N << "\n";
179  libMesh::out << "kappa = " << _kappa << "\n";
180  libMesh::out << "growth = " << (int)_growth << "\n";
181  libMesh::out << "degenerate = " << (int)_degenerate << "\n";
182  libMesh::out << "Cahn-Hillard = " << (int)_cahn_hillard << "\n";
183  libMesh::out << "netforce = " << (int)_netforce << "\n";
184  libMesh::out << "energy = " << _energy << "\n";
185  libMesh::out << "tol = " << _tol << "\n";
186  libMesh::out << "theta = " << _theta << "\n";
187  libMesh::out << "theta_c = " << _theta_c << "\n";
188  libMesh::out << "log truncation = " << _log_truncation << "\n";
189  libMesh::out << "initial timestep size = " << _dt0 << "\n";
190 
191  if (_initialState == STRIP)
192  libMesh::out << "initial state: strip\n";
193 
194  if (_initialState == ROD)
195  libMesh::out << "initial state: rod\n";
196 
197  if (_initialState == BALL)
198  libMesh::out << "initial state: ball\n";
199 
200  libMesh::out << "initial state center = " << _initialCenter(0) << "\n";
201  libMesh::out << "initial state width = " << _initialWidth << "\n";
202  libMesh::out << "initial time (min_time) = " << _t0 << "\n";
203  libMesh::out << "integration time = " << _T << "\n";
204  libMesh::out << "final time (max_time) = " << _t1 << "\n";
205  libMesh::out << "Crank-Nicholson weight = " << _cnWeight << "\n";
206  libMesh::out << "Output timestep = " << _o_dt << "\n";
207  libMesh::out << "Output filename base: " << _ofile_base << "\n";
208 }

References _cahn_hillard, _cnWeight, _degenerate, _dim, _dt0, _energy, _growth, _initialCenter, _initialState, _initialWidth, _kappa, _log_truncation, _N, _netforce, _o_dt, _ofile_base, _T, _t0, _t1, _theta, _theta_c, _tol, _verbose, BALL, int, libMesh::out, ROD, and STRIP.

◆ write() [1/2]

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

Definition at line 366 of file equation_systems_io.C.

369 {
370  XdrMODE mode = WRITE;
371  if (name.find(".xdr") != std::string::npos)
372  mode = ENCODE;
373  this->write(name, mode, write_flags, partition_agnostic);
374 }

References libMesh::ENCODE, libMesh::Quality::name(), libMesh::WRITE, and libMesh::EquationSystems::write().

◆ write() [2/2]

void libMesh::EquationSystems::write ( const std::string &  name,
const XdrMODE  mode,
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!

This program implements the output of an EquationSystems object. This warrants some documentation. The output file essentially consists of 11 sections:

1.) The version header.
2.) The number of individual equation systems (unsigned int)

for each system

3.)  The name of the system (string)
4.)  The type of the system (string)

handled through System::read():

+-------------------------------------------------------------+
|  5.) The number of variables in the system (unsigned int)   |
|                                                             |
|   for each variable in the system                           |
|                                                             |
|    6.) The name of the variable (string)                    |
|                                                             |
|    7.) Combined in an FEType:                               |
|         - The approximation order(s) of the variable (Order |
|           Enum, cast to int/s)                              |
|         - The finite element family/ies of the variable     |
|           (FEFamily Enum, cast to int/s)                    |
|                                                             |
|   end variable loop                                         |
|                                                             |
| 8.) The number of additional vectors (unsigned int),        |
|                                                             |
|    for each additional vector in the equation system object |
|                                                             |
|    9.) the name of the additional vector  (string)          |
+-------------------------------------------------------------+

end system loop


for each system, handled through System::write_{serialized,parallel}_data():

+--------------------------------------------------------------+
| 10.) The global solution vector, re-ordered to be node-major |
|     (More on this later.)                                    |
|                                                              |
|    for each additional vector in the equation system object  |
|                                                              |
|    11.) The global additional vector, re-ordered to be       |
|         node-major (More on this later.)                     |
+--------------------------------------------------------------+

end system loop

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

Definition at line 378 of file equation_systems_io.C.

382 {
446  // the EquationSystems::write() method should look constant,
447  // but we need to assign a temporary numbering to the nodes
448  // and elements in the mesh, which requires that we abuse const_cast
449  if (partition_agnostic)
450  {
451  MeshBase & mesh = const_cast<MeshBase &>(this->get_mesh());
453  }
454 
455  // set booleans from write_flags argument
456  const bool write_data = write_flags & EquationSystems::WRITE_DATA;
457  const bool write_additional_data = write_flags & EquationSystems::WRITE_ADDITIONAL_DATA;
458 
459  // always write parallel files if we're instructed to write in
460  // parallel
461  const bool write_parallel_files =
463  // Even if we're on a distributed mesh, we may or may not have a
464  // consistent way of reconstructing the same mesh partitioning
465  // later, but we need the same mesh partitioning if we want to
466  // reread the parallel solution safely, so let's write a serial file
467  // unless specifically requested not to.
468  // ||
469  // // but also write parallel files if we haven't been instructed to
470  // // write in serial and we're on a distributed mesh
471  // (!(write_flags & EquationSystems::WRITE_SERIAL_FILES) &&
472  // !this->get_mesh().is_serial())
473  ;
474 
475  // New scope so that io will close before we try to zip the file
476  {
477  Xdr io((this->processor_id()==0) ? name : "", mode);
478  libmesh_assert (io.writing());
479 
480  LOG_SCOPE("write()", "EquationSystems");
481 
482  const unsigned int proc_id = this->processor_id();
483 
484  unsigned int n_sys = 0;
485  for (auto & pr : _systems)
486  if (!pr.second->hide_output())
487  n_sys++;
488 
489  // set the version number in the Xdr object
490  io.set_version(LIBMESH_VERSION_ID(LIBMESH_MAJOR_VERSION,
491  LIBMESH_MINOR_VERSION,
492  LIBMESH_MICRO_VERSION));
493 
494  // Only write the header information
495  // if we are processor 0.
496  if (proc_id == 0)
497  {
498  std::string comment;
499  char buf[256];
500 
501  // 1.)
502  // Write the version header
503  std::string version("libMesh-" + libMesh::get_io_compatibility_version());
504  if (write_parallel_files) version += " parallel";
505 
506 #ifdef LIBMESH_ENABLE_INFINITE_ELEMENTS
507  version += " with infinite elements";
508 #endif
509  io.data (version, "# File Format Identifier");
510 
511  // 2.)
512  // Write the number of equation systems
513  io.data (n_sys, "# No. of Equation Systems");
514 
515  for (auto & pr : _systems)
516  {
517  // Ignore this system if it has been marked as hidden
518  if (pr.second->hide_output()) continue;
519 
520  // 3.)
521  // Write the name of the sys_num-th system
522  {
523  const unsigned int sys_num = pr.second->number();
524  std::string sys_name = pr.first;
525 
526  comment = "# Name, System No. ";
527  std::sprintf(buf, "%u", sys_num);
528  comment += buf;
529 
530  io.data (sys_name, comment.c_str());
531  }
532 
533  // 4.)
534  // Write the type of system handled
535  {
536  const unsigned int sys_num = pr.second->number();
537  std::string sys_type = pr.second->system_type();
538 
539  comment = "# Type, System No. ";
540  std::sprintf(buf, "%u", sys_num);
541  comment += buf;
542 
543  io.data (sys_type, comment.c_str());
544  }
545 
546  // 5.) - 9.)
547  // Let System::write_header() do the job
548  pr.second->write_header (io, version, write_additional_data);
549  }
550  }
551 
552  // Start from the first system, again,
553  // to write vectors to disk, if wanted
554  if (write_data)
555  {
556  // open a parallel buffer if warranted.
557  Xdr local_io (write_parallel_files ? local_file_name(this->processor_id(),name) : "", mode);
558 
559  for (auto & pr : _systems)
560  {
561  // Ignore this system if it has been marked as hidden
562  if (pr.second->hide_output()) continue;
563 
564  // 10.) + 11.)
565  if (write_parallel_files)
566  pr.second->write_parallel_data (local_io,write_additional_data);
567  else
568  pr.second->write_serialized_data (io,write_additional_data);
569  }
570  }
571  }
572 
573  // the EquationSystems::write() method should look constant,
574  // but we need to undo the temporary numbering of the nodes
575  // and elements in the mesh, which requires that we abuse const_cast
576  if (partition_agnostic)
577  const_cast<MeshBase &>(_mesh).fix_broken_node_and_element_numbering();
578 }

References libMesh::EquationSystems::_mesh, libMesh::EquationSystems::_systems, libMesh::Xdr::data(), libMesh::get_io_compatibility_version(), libMesh::EquationSystems::get_mesh(), libMesh::MeshTools::Private::globally_renumber_nodes_and_elements(), libMesh::libmesh_assert(), mesh, libMesh::ParallelObject::processor_id(), libMesh::Xdr::set_version(), libMesh::EquationSystems::WRITE_ADDITIONAL_DATA, libMesh::EquationSystems::WRITE_DATA, libMesh::EquationSystems::WRITE_PARALLEL_FILES, and libMesh::Xdr::writing().

Referenced by main(), libMesh::ErrorVector::plot_error(), SlitMeshRefinedSystemTest::testRestart(), libMesh::EquationSystems::write(), libMesh::NameBasedIO::write_equation_systems(), and write_output().

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.

Referenced by Biharmonic(), and viewParameters().

◆ _cnWeight

Real Biharmonic::_cnWeight
private

Definition at line 103 of file biharmonic.h.

Referenced by Biharmonic(), and viewParameters().

◆ _communicator

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

◆ _counts

ReferenceCounter::Counts libMesh::ReferenceCounter::_counts
staticprotectedinherited

◆ _degenerate

bool Biharmonic::_degenerate
private

Definition at line 95 of file biharmonic.h.

Referenced by Biharmonic(), and viewParameters().

◆ _dim

unsigned int Biharmonic::_dim
private

Definition at line 92 of file biharmonic.h.

Referenced by Biharmonic(), Biharmonic::JR::JR(), and viewParameters().

◆ _dt

Real Biharmonic::_dt
private

Definition at line 102 of file biharmonic.h.

Referenced by dt(), init(), run(), and step().

◆ _dt0

Real Biharmonic::_dt0
private

Definition at line 102 of file biharmonic.h.

Referenced by Biharmonic(), dt0(), step(), and viewParameters().

◆ _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 593 of file equation_systems.h.

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

◆ _enable_print_counter

bool libMesh::ReferenceCounter::_enable_print_counter = true
staticprotectedinherited

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

Definition at line 141 of file reference_counter.h.

Referenced by libMesh::ReferenceCounter::disable_print_counter_info(), libMesh::ReferenceCounter::enable_print_counter_info(), and libMesh::ReferenceCounter::print_info().

◆ _energy

FreeEnergyEnum Biharmonic::_energy
private

Definition at line 96 of file biharmonic.h.

Referenced by Biharmonic(), and viewParameters().

◆ _exio

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

Definition at line 106 of file biharmonic.h.

Referenced by Biharmonic(), and output().

◆ _growth

bool Biharmonic::_growth
private

Definition at line 95 of file biharmonic.h.

Referenced by Biharmonic(), and viewParameters().

◆ _initialCenter

Point Biharmonic::_initialCenter
private

Definition at line 100 of file biharmonic.h.

Referenced by Biharmonic(), and viewParameters().

◆ _initialState

InitialStateEnum Biharmonic::_initialState
private

Definition at line 99 of file biharmonic.h.

Referenced by Biharmonic(), and viewParameters().

◆ _initialWidth

Real Biharmonic::_initialWidth
private

Definition at line 101 of file biharmonic.h.

Referenced by Biharmonic(), and viewParameters().

◆ _jr

JR* Biharmonic::_jr
private

Definition at line 113 of file biharmonic.h.

Referenced by Biharmonic(), and step().

◆ _kappa

Real Biharmonic::_kappa
private

Definition at line 93 of file biharmonic.h.

Referenced by Biharmonic(), and viewParameters().

◆ _log_truncation

int Biharmonic::_log_truncation
private

Definition at line 97 of file biharmonic.h.

Referenced by Biharmonic(), and viewParameters().

◆ _mesh

ReplicatedMesh& Biharmonic::_mesh
private

Definition at line 111 of file biharmonic.h.

Referenced by Biharmonic().

◆ _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.

Referenced by Biharmonic(), and viewParameters().

◆ _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.

Referenced by Biharmonic(), and viewParameters().

◆ _o_count

int Biharmonic::_o_count
private

Definition at line 108 of file biharmonic.h.

Referenced by init(), and output().

◆ _o_dt

Real Biharmonic::_o_dt
private

Definition at line 107 of file biharmonic.h.

Referenced by Biharmonic(), output(), and viewParameters().

◆ _ofile

std::string Biharmonic::_ofile
private

Definition at line 105 of file biharmonic.h.

Referenced by Biharmonic(), and output().

◆ _ofile_base

std::string Biharmonic::_ofile_base
private

Definition at line 105 of file biharmonic.h.

Referenced by Biharmonic(), and viewParameters().

◆ _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.

Referenced by Biharmonic(), and viewParameters().

◆ _t0

Real Biharmonic::_t0
private

Definition at line 102 of file biharmonic.h.

Referenced by Biharmonic(), run(), and viewParameters().

◆ _t1

Real Biharmonic::_t1
private

Definition at line 102 of file biharmonic.h.

Referenced by Biharmonic(), run(), and viewParameters().

◆ _theta

Real Biharmonic::_theta
private

Definition at line 93 of file biharmonic.h.

Referenced by Biharmonic(), and viewParameters().

◆ _theta_c

Real Biharmonic::_theta_c
private

Definition at line 93 of file biharmonic.h.

Referenced by Biharmonic(), and viewParameters().

◆ _tol

Real Biharmonic::_tol
private

Definition at line 94 of file biharmonic.h.

Referenced by Biharmonic(), and viewParameters().

◆ _verbose

bool Biharmonic::_verbose
private

Definition at line 98 of file biharmonic.h.

Referenced by Biharmonic(), init(), output(), run(), verbose(), and viewParameters().

◆ parameters

Parameters libMesh::EquationSystems::parameters
inherited

Data structure holding arbitrary parameters.

Definition at line 557 of file equation_systems.h.

Referenced by add_M_C_K_helmholtz(), assemble_biharmonic(), assemble_cd(), assemble_ellipticdg(), assemble_helmholtz(), assemble_poisson(), assemble_SchroedingerEquation(), assemble_shell(), assemble_stokes(), assemble_wave(), libMesh::ExactSolution::attach_exact_deriv(), libMesh::ExactSolution::attach_exact_hessian(), libMesh::ExactSolution::attach_exact_value(), libMesh::NewmarkSystem::clear(), libMesh::EquationSystems::clear(), libMesh::FrequencySystem::clear_all(), compute_jacobian(), compute_residual(), LinearElasticityWithContact::compute_stresses(), LargeDeformationElasticity::compute_stresses(), libMesh::EquationSystems::EquationSystems(), fill_dirichlet_bc(), libMesh::ExactErrorEstimator::find_squared_element_error(), libMesh::ImplicitSystem::get_linear_solve_parameters(), libMesh::FEComputeData::init(), init_cd(), HeatSystem::init_data(), libMesh::FrequencySystem::init_data(), init_sys(), Biharmonic::JR::InitialDensityBall(), Biharmonic::JR::InitialDensityRod(), Biharmonic::JR::InitialDensityStrip(), Biharmonic::JR::initialize(), initialize(), LargeDeformationElasticity::jacobian(), line_print(), main(), libMesh::FrequencySystem::n_frequencies(), libMesh::NewmarkSystem::NewmarkSystem(), libMesh::NonlinearImplicitSystem::NonlinearImplicitSystem(), LargeDeformationElasticity::residual(), LinearElasticityWithContact::residual_and_jacobian(), run_timestepping(), 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(), setup(), FETest< order, family, elem_type >::setUp(), SolidSystem::side_time_derivative(), libMesh::CondensedEigenSystem::solve(), libMesh::EigenSystem::solve(), libMesh::FrequencySystem::solve(), libMesh::LinearImplicitSystem::solve(), libMesh::RBConstruction::solve_for_matrix_and_rhs(), MeshfunctionDFEM::test_mesh_function_dfem(), MeshfunctionDFEM::test_mesh_function_dfem_grad(), MeshFunctionTest::test_p_level(), DefaultCouplingTest::testCoupling(), PointNeighborCouplingTest::testCoupling(), MeshInputTest::testExodusCopyElementSolution(), SystemsTest::testProjectCube(), SystemsTest::testProjectCubeWithMeshFunction(), SystemsTest::testProjectLine(), SystemsTest::testProjectSquare(), EquationSystemsTest::testRepartitionThenReinit(), and libMesh::WrappedFunction< Output >::WrappedFunction().


The documentation for this class was generated from the following files:
libMesh::dof_id_type
uint8_t dof_id_type
Definition: id_types.h:67
libMesh::EquationSystems::build_elemental_solution_vector
void build_elemental_solution_vector(std::vector< Number > &soln, std::vector< std::string > &names) const
Retrieve the solution data for CONSTANT MONOMIALs.
Definition: equation_systems.C:883
Biharmonic::_growth
bool _growth
Definition: biharmonic.h:95
Biharmonic::STRIP
Definition: biharmonic.h:49
libMesh::EquationSystems::WRITE_PARALLEL_FILES
Definition: equation_systems.h:95
libMesh::EquationSystems::add_system
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.
Definition: equation_systems.C:345
libMesh::EquationSystems::get_mesh
const MeshBase & get_mesh() const
Definition: equation_systems.h:637
libMesh::Parameters::clear
virtual void clear()
Clears internal data structures & frees any allocated memory.
Definition: parameters.h:313
libMesh::EquationSystems::WRITE_DATA
Definition: equation_systems.h:93
libMesh::FEInterface::n_vec_dim
static unsigned int n_vec_dim(const MeshBase &mesh, const FEType &fe_type)
Definition: fe_interface.C:1701
libMesh::EquationSystems::READ_ADDITIONAL_DATA
Definition: equation_systems.h:85
libMesh::MeshBase::is_serial
virtual bool is_serial() const
Definition: mesh_base.h:159
libMesh::PARALLEL
Definition: enum_parallel_type.h:36
libMesh::HEX8
Definition: enum_elem_type.h:47
Biharmonic::_o_dt
Real _o_dt
Definition: biharmonic.h:107
Biharmonic::_netforce
bool _netforce
Definition: biharmonic.h:95
libMesh::MeshBase::active_local_element_ptr_range
virtual SimpleRange< element_iterator > active_local_element_ptr_range()=0
Biharmonic::_dt
Real _dt
Definition: biharmonic.h:102
Biharmonic::DOUBLE_WELL
Definition: biharmonic.h:54
libMesh::MeshBase::local_nodes_begin
virtual node_iterator local_nodes_begin()=0
Iterate over local nodes (nodes whose processor_id() matches the current processor).
libMesh::MeshBase::active_element_ptr_range
virtual SimpleRange< element_iterator > active_element_ptr_range()=0
libMesh::MeshBase::n_elem
virtual dof_id_type n_elem() const =0
Biharmonic::BALL
Definition: biharmonic.h:51
libMesh::index_range
IntRange< std::size_t > index_range(const std::vector< T > &vec)
Helper function that returns an IntRange<std::size_t> representing all the indices of the passed-in v...
Definition: int_range.h:106
libMesh::MeshBase::max_elem_id
virtual dof_id_type max_elem_id() const =0
Biharmonic::_ofile_base
std::string _ofile_base
Definition: biharmonic.h:105
libMesh::EquationSystems::get_system
const T_sys & get_system(const std::string &name) const
Definition: equation_systems.h:757
Biharmonic::_degenerate
bool _degenerate
Definition: biharmonic.h:95
libMesh::MeshTools::Generation::build_cube
void build_cube(UnstructuredMesh &mesh, const unsigned int nx=0, const unsigned int ny=0, const unsigned int nz=0, const Real xmin=0., const Real xmax=1., const Real ymin=0., const Real ymax=1., const Real zmin=0., const Real zmax=1., const ElemType type=INVALID_ELEM, const bool gauss_lobatto_grid=false)
Builds a (elements) cube.
Definition: mesh_generation.C:298
end
IterBase * end
Also have a polymorphic pointer to the end object, this prevents iterating past the end.
Definition: variant_filter_iterator.h:343
libMesh::ReferenceCounter::_counts
static Counts _counts
Actually holds the data.
Definition: reference_counter.h:122
libMesh::TOLERANCE
static const Real TOLERANCE
Definition: libmesh_common.h:128
libMesh::ParallelObject::comm
const Parallel::Communicator & comm() const
Definition: parallel_object.h:94
Biharmonic::_mesh
ReplicatedMesh & _mesh
Definition: biharmonic.h:111
Biharmonic::ROD
Definition: biharmonic.h:50
libMesh::ReferenceCounter::_n_objects
static Threads::atomic< unsigned int > _n_objects
The number of objects.
Definition: reference_counter.h:130
libMesh::WRITE
Definition: enum_xdr_mode.h:40
mesh
MeshBase & mesh
Definition: mesh_communication.C:1257
libMesh::MeshBase::mesh_dimension
unsigned int mesh_dimension() const
Definition: mesh_base.C:135
Biharmonic::_T
Real _T
Definition: biharmonic.h:102
libMesh::MeshBase::max_node_id
virtual dof_id_type max_node_id() const =0
Biharmonic::_t1
Real _t1
Definition: biharmonic.h:102
libMesh::ReferenceCounter::get_info
static std::string get_info()
Gets a string containing the reference information.
Definition: reference_counter.C:47
libMesh::EquationSystems::EquationSystems
EquationSystems(MeshBase &mesh)
Constructor.
Definition: equation_systems.C:55
libMesh::EquationSystems::_remove_default_ghosting
void _remove_default_ghosting(unsigned int sys_num)
This just calls DofMap::remove_default_ghosting() but using a shim lets us forward-declare DofMap.
Definition: equation_systems.C:1387
dim
unsigned int dim
Definition: adaptivity_ex3.C:113
libMesh::NumericVector::build
static std::unique_ptr< 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...
Definition: numeric_vector.C:49
libMesh::FEInterface::nodal_soln
static void nodal_soln(const unsigned int dim, const FEType &fe_t, const Elem *elem, const std::vector< Number > &elem_soln, std::vector< Number > &nodal_soln)
Build the nodal soln from the element soln.
Definition: fe_interface.C:580
libMesh::TriangleWrapper::init
void init(triangulateio &t)
Initializes the fields of t to nullptr/0 as necessary.
libMesh::MeshBase::element_ptr_range
virtual SimpleRange< element_iterator > element_ptr_range()=0
libMesh::EquationSystems::find_variable_numbers
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...
Definition: equation_systems.C:904
libMesh::libmesh_assert
libmesh_assert(ctx)
libMesh::MeshTools::Generation::build_square
void build_square(UnstructuredMesh &mesh, const unsigned int nx, const unsigned int ny, const Real xmin=0., const Real xmax=1., const Real ymin=0., const Real ymax=1., const ElemType type=INVALID_ELEM, const bool gauss_lobatto_grid=false)
A specialized build_cube() for 2D meshes.
Definition: mesh_generation.C:1501
std::abs
MetaPhysicL::DualNumber< T, D > abs(const MetaPhysicL::DualNumber< T, D > &in)
Biharmonic::_jr
JR * _jr
Definition: biharmonic.h:113
libMesh::XdrMODE
XdrMODE
Defines an enum for read/write mode in Xdr format.
Definition: enum_xdr_mode.h:35
libMesh::ParallelObject::n_processors
processor_id_type n_processors() const
Definition: parallel_object.h:100
Biharmonic::_initialWidth
Real _initialWidth
Definition: biharmonic.h:101
libMesh::DECODE
Definition: enum_xdr_mode.h:39
Biharmonic::_t0
Real _t0
Definition: biharmonic.h:102
libMesh::MeshBase::node_ptr_range
virtual SimpleRange< node_iterator > node_ptr_range()=0
libMesh::EquationSystems::reinit_systems
virtual void reinit_systems()
Reinitialize all systems on the current mesh.
Definition: equation_systems.C:266
Biharmonic::_cnWeight
Real _cnWeight
Definition: biharmonic.h:103
libMesh::Threads::spin_mtx
spin_mutex spin_mtx
A convenient spin mutex object which can be used for obtaining locks.
Definition: threads.C:29
libMesh::EquationSystems::reinit_solutions
bool reinit_solutions()
Handle any mesh changes and project any solutions onto the updated mesh.
Definition: equation_systems.C:133
libMesh::ParallelObject::processor_id
processor_id_type processor_id() const
Definition: parallel_object.h:106
libMesh::EquationSystems::const_system_iterator
std::map< std::string, System * >::const_iterator const_system_iterator
Typedef for constant system iterators.
Definition: equation_systems.h:581
libMesh::EquationSystems::update
void update()
Updates local values for all the systems.
Definition: equation_systems.C:334
libMesh::MeshTools::Generation::build_line
void build_line(UnstructuredMesh &mesh, const unsigned int nx, const Real xmin=0., const Real xmax=1., const ElemType type=INVALID_ELEM, const bool gauss_lobatto_grid=false)
A specialized build_cube() for 1D meshes.
Definition: mesh_generation.C:1480
libMesh::EquationSystems::READ_DATA
Definition: equation_systems.h:84
libMesh::QUAD4
Definition: enum_elem_type.h:41
libMesh::ParallelObject::_communicator
const Parallel::Communicator & _communicator
Definition: parallel_object.h:112
libMesh::EquationSystems::init
virtual void init()
Initialize all the systems.
Definition: equation_systems.C:96
libMesh::Point
A Point defines a location in LIBMESH_DIM dimensional Real space.
Definition: point.h:38
Biharmonic::output
void output(int timestep, const Real &t, Real &o_t, bool force=false)
Definition: biharmonic.C:251
libMesh::command_line_value
T command_line_value(const std::string &, T)
Definition: libmesh.C:931
libMesh::get_io_compatibility_version
std::string get_io_compatibility_version()
Specifier for I/O file compatibility features.
Definition: libmesh_version.C:80
libMesh::EquationSystems::n_vars
unsigned int n_vars() const
Definition: equation_systems.C:1331
Biharmonic::_N
unsigned int _N
Definition: biharmonic.h:92
libMesh::EquationSystems::_enable_default_ghosting
bool _enable_default_ghosting
Flag for whether to enable default ghosting on newly added Systems.
Definition: equation_systems.h:593
libMesh::EquationSystems::system_iterator
std::map< std::string, System * >::iterator system_iterator
Typedef for system iterators.
Definition: equation_systems.h:576
Biharmonic::_verbose
bool _verbose
Definition: biharmonic.h:98
libMesh::CONSTANT
Definition: enum_order.h:41
Biharmonic::_dt0
Real _dt0
Definition: biharmonic.h:102
libMesh::EquationSystems::n_systems
unsigned int n_systems() const
Definition: equation_systems.h:652
libMesh::READ
Definition: enum_xdr_mode.h:41
Biharmonic::_theta
Real _theta
Definition: biharmonic.h:93
libMesh::EquationSystems::_mesh
MeshBase & _mesh
The mesh data structure.
Definition: equation_systems.h:566
Biharmonic::_theta_c
Real _theta_c
Definition: biharmonic.h:93
Biharmonic::_tol
Real _tol
Definition: biharmonic.h:94
Biharmonic::_initialCenter
Point _initialCenter
Definition: biharmonic.h:100
Biharmonic::_kappa
Real _kappa
Definition: biharmonic.h:93
libMesh::EquationSystems::read
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.
Definition: equation_systems_io.C:90
libMesh::numeric_index_type
dof_id_type numeric_index_type
Definition: id_types.h:99
libMesh::MONOMIAL
Definition: enum_fe_family.h:39
libMesh::MeshBase::allgather
virtual void allgather()
Gathers all elements and nodes of the mesh onto every processor.
Definition: mesh_base.h:188
libMesh::EquationSystems::WRITE_SERIAL_FILES
Definition: equation_systems.h:96
libMesh::ENCODE
Definition: enum_xdr_mode.h:38
distance
Real distance(const Point &p)
Definition: subdomains_ex3.C:50
Biharmonic::_o_count
int _o_count
Definition: biharmonic.h:108
Biharmonic::_initialState
InitialStateEnum _initialState
Definition: biharmonic.h:99
libMesh::EquationSystems::_systems
std::map< std::string, System * > _systems
Data structure holding the systems.
Definition: equation_systems.h:571
libMesh::command_line_vector
void command_line_vector(const std::string &, std::vector< T > &)
Definition: libmesh.C:976
libMesh::MeshTools::Private::globally_renumber_nodes_and_elements
void globally_renumber_nodes_and_elements(MeshBase &)
There is no reason for a user to ever call this function.
Definition: mesh_tools.C:2411
Biharmonic::_ofile
std::string _ofile
Definition: biharmonic.h:105
libMesh::MeshBase::fix_broken_node_and_element_numbering
virtual void fix_broken_node_and_element_numbering()=0
There is no reason for a user to ever call this function.
libMesh::EquationSystems::get_info
virtual std::string get_info() const
Definition: equation_systems.C:1278
libMesh::FEInterface::field_type
static FEFieldType field_type(const FEType &fe_type)
Definition: fe_interface.C:1683
libMesh::TYPE_VECTOR
Definition: enum_fe_family.h:94
Biharmonic::_cahn_hillard
bool _cahn_hillard
Definition: biharmonic.h:95
libMesh::EquationSystems::_refine_in_reinit
bool _refine_in_reinit
Flag for whether to call coarsen/refine in reinit().
Definition: equation_systems.h:587
libMesh::EquationSystems::write
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.
Definition: equation_systems_io.C:378
libMesh::EquationSystems::TRY_READ_IFEMS
Definition: equation_systems.h:87
libMesh::on_command_line
bool on_command_line(std::string arg)
Definition: libmesh.C:898
Biharmonic::LOG_DOUBLE_WELL
Definition: biharmonic.h:56
Biharmonic::_energy
FreeEnergyEnum _energy
Definition: biharmonic.h:96
libMesh::EquationSystems::WRITE_ADDITIONAL_DATA
Definition: equation_systems.h:94
libMesh::Real
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
Definition: libmesh_common.h:121
libMesh::ReferenceCounter::_enable_print_counter
static bool _enable_print_counter
Flag to control whether reference count information is printed when print_info is called.
Definition: reference_counter.h:141
Biharmonic::step
void step(const Real &dt=-1.0)
Definition: biharmonic.C:230
libMesh::EquationSystems::build_parallel_elemental_solution_vector
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...
Definition: equation_systems.C:957
libMesh::EquationSystems::build_parallel_solution_vector
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.
Definition: equation_systems.C:590
libMesh::out
OStreamProxy out
libMesh::MeshBase::local_nodes_end
virtual node_iterator local_nodes_end()=0
Biharmonic::_exio
std::unique_ptr< ExodusII_IO > _exio
Definition: biharmonic.h:106
libMesh::EquationSystems::_add_system_to_nodes_and_elems
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...
Definition: equation_systems.C:1376
int
void ErrorVector unsigned int
Definition: adjoints_ex3.C:360
libMesh::MeshBase::contract
virtual bool contract()=0
Delete subactive (i.e.
libMesh::EquationSystems::READ_HEADER
Definition: equation_systems.h:83
Biharmonic::DOUBLE_OBSTACLE
Definition: biharmonic.h:55
libMesh::Quality::name
std::string name(const ElemQuality q)
This function returns a string containing some name for q.
Definition: elem_quality.C:42
Biharmonic::_log_truncation
int _log_truncation
Definition: biharmonic.h:97
Biharmonic::LOG_DOUBLE_OBSTACLE
Definition: biharmonic.h:57
libMesh::EDGE2
Definition: enum_elem_type.h:35
libMesh::EquationSystems::READ_LEGACY_FORMAT
Definition: equation_systems.h:86
libMesh::EquationSystems::READ_BASIC_ONLY
Definition: equation_systems.h:88
Biharmonic::_dim
unsigned int _dim
Definition: biharmonic.h:92
libMesh::EquationSystems::parameters
Parameters parameters
Data structure holding arbitrary parameters.
Definition: equation_systems.h:557