$extrastylesheet
#include <equation_systems.h>

Public Types | |
| enum | ReadFlags { READ_HEADER = 1, READ_DATA = 2, READ_ADDITIONAL_DATA = 4, READ_LEGACY_FORMAT = 8, TRY_READ_IFEMS = 16, READ_BASIC_ONLY = 32 } |
| enum | WriteFlags { WRITE_DATA = 1, WRITE_ADDITIONAL_DATA = 2, WRITE_PARALLEL_FILES = 4, WRITE_SERIAL_FILES = 8 } |
Public Member Functions | |
| EquationSystems (MeshBase &mesh, MeshData *mesh_data=NULL) | |
| virtual | ~EquationSystems () |
| virtual void | clear () |
| virtual void | init () |
| virtual void | reinit () |
| void | update () |
| 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) |
| template<typename T_sys > | |
| T_sys & | add_system (const std::string &name) |
| void | delete_system (const std::string &name) |
| unsigned int | n_vars () const |
| std::size_t | n_dofs () const |
| std::size_t | n_active_dofs () const |
| virtual void | solve () |
| virtual void | adjoint_solve (const QoISet &qoi_indices=QoISet()) |
| virtual void | sensitivity_solve (const ParameterVector ¶meters) |
| void | build_variable_names (std::vector< std::string > &var_names, const FEType *type=NULL, const std::set< std::string > *system_names=NULL) const |
| void | build_solution_vector (std::vector< Number > &soln, const std::string &system_name, const std::string &variable_name="all_vars") const |
| void | build_solution_vector (std::vector< Number > &soln, const std::set< std::string > *system_names=NULL) const |
| void | get_solution (std::vector< Number > &soln, std::vector< std::string > &names) const |
| void | build_discontinuous_solution_vector (std::vector< Number > &soln, const std::set< std::string > *system_names=NULL) const |
| template<typename InValType > | |
| void | read (const std::string &name, const XdrMODE, const unsigned int read_flags=(READ_HEADER|READ_DATA), bool partition_agnostic=true) |
| 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 |
| 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 |
| const MeshBase & | get_mesh () const |
| MeshBase & | get_mesh () |
| bool | has_mesh_data () const |
| const MeshData & | get_mesh_data () const |
| MeshData & | get_mesh_data () |
| void | allgather () |
| 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 () |
| static void | print_info (std::ostream &out=libMesh::out) |
| static unsigned int | n_objects () |
| static void | enable_print_counter_info () |
| static void | disable_print_counter_info () |
Public Attributes | |
| Parameters | parameters |
Protected Types | |
| typedef std::map< std::string, System * >::iterator | system_iterator |
| typedef std::map< std::string, System * >::const_iterator | const_system_iterator |
| typedef std::map< std::string, std::pair< unsigned int, unsigned int > > | Counts |
Protected Member Functions | |
| void | increment_constructor_count (const std::string &name) |
| void | increment_destructor_count (const std::string &name) |
Protected Attributes | |
| MeshBase & | _mesh |
| MeshData * | _mesh_data |
| std::map< std::string, System * > | _systems |
| const Parallel::Communicator & | _communicator |
Static Protected Attributes | |
| static Counts | _counts |
| static Threads::atomic < unsigned int > | _n_objects |
| static Threads::spin_mutex | _mutex |
| static bool | _enable_print_counter = true |
Private Member Functions | |
| template<typename InValType > | |
| void | _read_impl (const std::string &name, const XdrMODE, const unsigned int read_flags, bool partition_agnostic=true) |
| void | _add_system_to_nodes_and_elems () |
Friends | |
| std::ostream & | operator<< (std::ostream &os, const EquationSystems &es) |
This is the EquationSystems class. It is in charge of handling all the various equation systems defined for a MeshBase. It may have multiple systems, which may be active or inactive, so that at different solution stages only a sub-set may be solved for. Also, through the templated access, different types of systems may be handled. Also other features, like flags, parameters, I/O etc are provided.
Definition at line 68 of file equation_systems.h.
typedef std::map<std::string, System*>::const_iterator libMesh::EquationSystems::const_system_iterator [protected] |
Typedef for constatnt system iterators
Definition at line 475 of file equation_systems.h.
typedef std::map<std::string, std::pair<unsigned int, unsigned int> > libMesh::ReferenceCounter::Counts [protected, inherited] |
Data structure to log the information. The log is identified by the class name.
Definition at line 113 of file reference_counter.h.
typedef std::map<std::string, System*>::iterator libMesh::EquationSystems::system_iterator [protected] |
Typedef for system iterators
Definition at line 470 of file equation_systems.h.
Define enumeration to set properties in EquationSystems::read()
| READ_HEADER | |
| READ_DATA | |
| READ_ADDITIONAL_DATA | |
| READ_LEGACY_FORMAT | |
| TRY_READ_IFEMS | |
| READ_BASIC_ONLY |
Definition at line 77 of file equation_systems.h.
{ 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::write()
Definition at line 87 of file equation_systems.h.
{ WRITE_DATA = 1,
WRITE_ADDITIONAL_DATA = 2,
WRITE_PARALLEL_FILES = 4,
WRITE_SERIAL_FILES = 8 };
| libMesh::EquationSystems::EquationSystems | ( | MeshBase & | mesh, |
| MeshData * | mesh_data = NULL |
||
| ) |
Constructor.
Definition at line 54 of file equation_systems.C.
References parameters, libMesh::Real, libMesh::Parameters::set(), and libMesh::TOLERANCE.
: ParallelObject (m), _mesh (m), _mesh_data (mesh_data) { // Set default parameters this->parameters.set<Real> ("linear solver tolerance") = TOLERANCE * TOLERANCE; this->parameters.set<unsigned int>("linear solver maximum iterations") = 5000; }
| libMesh::EquationSystems::~EquationSystems | ( | ) | [virtual] |
Destructor. Should be virtual, since the user may want to derive subclasses of EquationSystems.
Definition at line 66 of file equation_systems.C.
References clear().
{
this->clear ();
}
| void libMesh::EquationSystems::_add_system_to_nodes_and_elems | ( | ) | [private] |
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 1312 of file equation_systems.C.
References _mesh, libMesh::MeshBase::elements_begin(), libMesh::MeshBase::elements_end(), libMesh::MeshBase::nodes_begin(), and libMesh::MeshBase::nodes_end().
Referenced by add_system().
{
// All the nodes
MeshBase::node_iterator node_it = _mesh.nodes_begin();
const MeshBase::node_iterator node_end = _mesh.nodes_end();
for ( ; node_it != node_end; ++node_it)
(*node_it)->add_system();
// All the elements
MeshBase::element_iterator elem_it = _mesh.elements_begin();
const MeshBase::element_iterator elem_end = _mesh.elements_end();
for ( ; elem_it != elem_end; ++elem_it)
(*elem_it)->add_system();
}
| template void libMesh::EquationSystems::_read_impl< Real > | ( | const std::string & | name, |
| const XdrMODE | , | ||
| const unsigned int | read_flags, | ||
| bool | partition_agnostic = true |
||
| ) | [private] |
Actual read implementation. This can be called repeatedly inside a try-catch block in an attempt to read broken files.
| partition_agnostic | If 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 that 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 154 of file equation_systems_io.C.
References _mesh, add_system(), libMesh::Parallel::Communicator::broadcast(), libMesh::Xdr::close(), libMesh::ParallelObject::comm(), libMesh::Xdr::data(), libMesh::MeshBase::fix_broken_node_and_element_numbering(), get_mesh(), get_system(), libMesh::MeshTools::Private::globally_renumber_nodes_and_elements(), init(), libMesh::libmesh_assert(), mesh, libMesh::ParallelObject::processor_id(), read(), READ_ADDITIONAL_DATA, READ_BASIC_ONLY, READ_DATA, READ_HEADER, libMesh::System::read_header(), READ_LEGACY_FORMAT, libMesh::Xdr::reading(), libMesh::System::set_basic_system_only(), libMesh::Xdr::set_version(), libMesh::START_LOG(), libMesh::sys, TRY_READ_IFEMS, and update().
{
// Set booleans from the read_flags argument
const bool read_header = read_flags & EquationSystems::READ_HEADER;
const bool read_data = read_flags & EquationSystems::READ_DATA;
const bool read_additional_data = read_flags & EquationSystems::READ_ADDITIONAL_DATA;
const bool read_legacy_format = read_flags & EquationSystems::READ_LEGACY_FORMAT;
const bool try_read_ifems = read_flags & EquationSystems::TRY_READ_IFEMS;
const bool read_basic_only = read_flags & EquationSystems::READ_BASIC_ONLY;
bool read_parallel_files = false;
std::map<std::string, System*> xda_systems;
// This will unzip a file with .bz2 as the extension, otherwise it
// simply returns the name if the file need not be unzipped.
Xdr io ((this->processor_id() == 0) ? name : "", mode);
libmesh_assert (io.reading());
{
// 1.)
// Read the version header.
std::string version = "legacy";
if (!read_legacy_format)
{
if (this->processor_id() == 0) io.data(version);
this->comm().broadcast(version);
// All processors have the version header, if it does not contain
// "libMesh" something then it is a legacy file.
std::string::size_type lm_pos = version.find("libMesh");
if (!(lm_pos < version.size()))
{
io.close();
// Recursively call this read() function but with the
// EquationSystems::READ_LEGACY_FORMAT bit set.
this->read (name, mode, (read_flags | EquationSystems::READ_LEGACY_FORMAT), partition_agnostic);
return;
}
// Figure out the libMesh version that created this file
std::istringstream iss(version.substr(lm_pos + 8));
int ver_major = 0, ver_minor = 0, ver_patch = 0;
char dot;
iss >> ver_major >> dot >> ver_minor >> dot >> ver_patch;
io.set_version(LIBMESH_VERSION_ID(ver_major, ver_minor, ver_patch));
read_parallel_files = (version.rfind(" parallel") < version.size());
// If requested that we try to read infinite element information,
// and the string " with infinite elements" is not in the version,
// then tack it on. This is for compatibility reading ifem
// files written prior to 11/10/2008 - BSK
if (try_read_ifems)
if (!(version.rfind(" with infinite elements") < version.size()))
version += " with infinite elements";
}
else
libmesh_deprecated();
START_LOG("read()","EquationSystems");
// 2.)
// Read the number of equation systems
unsigned int n_sys=0;
if (this->processor_id() == 0) io.data (n_sys);
this->comm().broadcast(n_sys);
for (unsigned int sys=0; sys<n_sys; sys++)
{
// 3.)
// Read the name of the sys-th equation system
std::string sys_name;
if (this->processor_id() == 0) io.data (sys_name);
this->comm().broadcast(sys_name);
// 4.)
// Read the type of the sys-th equation system
std::string sys_type;
if (this->processor_id() == 0) io.data (sys_type);
this->comm().broadcast(sys_type);
if (read_header)
this->add_system (sys_type, sys_name);
// 5.) - 9.)
// Let System::read_header() do the job
System& new_system = this->get_system(sys_name);
new_system.read_header (io,
version,
read_header,
read_additional_data,
read_legacy_format);
xda_systems.insert(std::make_pair(sys_name, &new_system));
// If we're only creating "basic" systems, we need to tell
// each system that before we call init() later.
if (read_basic_only)
new_system.set_basic_system_only();
}
}
// Now we are ready to initialize the underlying data
// structures. This will initialize the vectors for
// storage, the dof_map, etc...
if (read_header)
this->init();
// 10.) & 11.)
// Read and set the numeric vector values
if (read_data)
{
// the EquationSystems::read() method should look constant from the mesh
// perspective, but we need to assign a temporary numbering to the nodes
// and elements in the mesh, which requires that we abuse const_cast
if (!read_legacy_format && partition_agnostic)
{
MeshBase &mesh = const_cast<MeshBase&>(this->get_mesh());
MeshTools::Private::globally_renumber_nodes_and_elements(mesh);
}
Xdr local_io (read_parallel_files ? local_file_name(this->processor_id(),name) : "", mode);
std::map<std::string, System*>::iterator
pos = xda_systems.begin();
for (; pos != xda_systems.end(); ++pos)
if (read_legacy_format)
{
libmesh_deprecated();
pos->second->read_legacy_data (io, read_additional_data);
}
else
if (read_parallel_files)
pos->second->read_parallel_data<InValType> (local_io, read_additional_data);
else
pos->second->read_serialized_data<InValType> (io, read_additional_data);
// Undo the temporary numbering.
if (!read_legacy_format && partition_agnostic)
_mesh.fix_broken_node_and_element_numbering();
}
STOP_LOG("read()","EquationSystems");
// Localize each system's data
this->update();
}
| System & libMesh::EquationSystems::add_system | ( | const std::string & | system_type, |
| const std::string & | name | ||
| ) | [virtual] |
Add the system of type system_type named name to the systems array.
Definition at line 370 of file equation_systems.C.
References _systems, get_system(), and libMesh::Quality::name().
Referenced by _read_impl(), and libMesh::ErrorVector::plot_error().
{
// If the user already built a system with this name, we'll
// trust them and we'll use it. That way they can pre-add
// non-standard derived system classes, and if their restart file
// has some non-standard sys_type we won't throw an error.
if (_systems.count(name))
{
return this->get_system(name);
}
// Build a basic System
else if (sys_type == "Basic")
this->add_system<System> (name);
// Build a Newmark system
else if (sys_type == "Newmark")
this->add_system<NewmarkSystem> (name);
// Build an Explicit system
else if ((sys_type == "Explicit"))
this->add_system<ExplicitSystem> (name);
// Build an Implicit system
else if ((sys_type == "Implicit") ||
(sys_type == "Steady" ))
this->add_system<ImplicitSystem> (name);
// build a transient implicit linear system
else if ((sys_type == "Transient") ||
(sys_type == "TransientImplicit") ||
(sys_type == "TransientLinearImplicit"))
this->add_system<TransientLinearImplicitSystem> (name);
// build a transient implicit nonlinear system
else if (sys_type == "TransientNonlinearImplicit")
this->add_system<TransientNonlinearImplicitSystem> (name);
// build a transient explicit system
else if (sys_type == "TransientExplicit")
this->add_system<TransientExplicitSystem> (name);
// build a linear implicit system
else if (sys_type == "LinearImplicit")
this->add_system<LinearImplicitSystem> (name);
// build a nonlinear implicit system
else if (sys_type == "NonlinearImplicit")
this->add_system<NonlinearImplicitSystem> (name);
// build a Reduced Basis Construction system
else if (sys_type == "RBConstruction")
this->add_system<RBConstruction> (name);
// build a transient Reduced Basis Construction system
else if (sys_type == "TransientRBConstruction")
this->add_system<TransientRBConstruction> (name);
#ifdef LIBMESH_HAVE_SLEPC
// build an eigen system
else if (sys_type == "Eigen")
this->add_system<EigenSystem> (name);
#endif
#if defined(LIBMESH_USE_COMPLEX_NUMBERS)
// build a frequency system
else if (sys_type == "Frequency")
this->add_system<FrequencySystem> (name);
#endif
else
libmesh_error_msg("ERROR: Unknown system type: " << sys_type);
// Return a reference to the new system
//return (*this)(name);
return this->get_system(name);
}
| T_sys & libMesh::EquationSystems::add_system | ( | const std::string & | name | ) | [inline] |
Add the system named name to the systems array.
Definition at line 556 of file equation_systems.h.
References _add_system_to_nodes_and_elems(), _systems, n_systems(), and libMesh::Quality::name().
{
T_sys* ptr = NULL;
if (!_systems.count(name))
{
ptr = new T_sys(*this, name, this->n_systems());
_systems.insert (std::make_pair(name, ptr));
// Tell all the \p DofObject entities to add a system.
this->_add_system_to_nodes_and_elems();
}
else
{
// We now allow redundant add_system calls, to make it
// easier to load data from files for user-derived system
// subclasses
ptr = &(this->get_system<T_sys>(name));
}
// Return a dynamically casted reference to the newly added System.
return *ptr;
}
| void libMesh::EquationSystems::adjoint_solve | ( | const QoISet & | qoi_indices = QoISet() | ) | [virtual] |
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 487 of file equation_systems.C.
References get_system(), libMesh::libmesh_assert(), and n_systems().
Referenced by libMesh::UniformRefinementEstimator::_estimate_error().
{
libmesh_assert (this->n_systems());
for (unsigned int i=this->n_systems(); i != 0; --i)
this->get_system(i-1).adjoint_solve(qoi_indices);
}
| void libMesh::EquationSystems::allgather | ( | ) |
Serializes a distributed mesh and its associated degree of freedom numbering for all systems
Definition at line 306 of file equation_systems.C.
References _mesh, libMesh::MeshBase::allgather(), libMesh::DofMap::create_dof_constraints(), libMesh::DofMap::distribute_dofs(), libMesh::MeshBase::elements_begin(), libMesh::MeshBase::elements_end(), libMesh::System::get_dof_map(), get_system(), libMesh::MeshBase::is_serial(), n_systems(), libMesh::MeshBase::nodes_begin(), libMesh::MeshBase::nodes_end(), libMesh::DofMap::prepare_send_list(), libMesh::DofMap::process_constraints(), libMesh::sys, libMesh::System::time, and libMesh::System::user_constrain().
{
// A serial mesh means nothing needs to be done
if (_mesh.is_serial())
return;
const unsigned int n_sys = this->n_systems();
libmesh_assert_not_equal_to (n_sys, 0);
// Gather the mesh
_mesh.allgather();
// Tell all the \p DofObject entities how many systems
// there are.
{
MeshBase::node_iterator node_it = _mesh.nodes_begin();
const MeshBase::node_iterator node_end = _mesh.nodes_end();
for ( ; node_it != node_end; ++node_it)
(*node_it)->set_n_systems(n_sys);
MeshBase::element_iterator elem_it = _mesh.elements_begin();
const MeshBase::element_iterator elem_end = _mesh.elements_end();
for ( ; elem_it != elem_end; ++elem_it)
(*elem_it)->set_n_systems(n_sys);
}
// And distribute each system's dofs
for (unsigned int i=0; i != this->n_systems(); ++i)
{
System &sys = this->get_system(i);
DofMap &dof_map = sys.get_dof_map();
dof_map.distribute_dofs(_mesh);
#ifdef LIBMESH_ENABLE_CONSTRAINTS
// The user probably won't need constraint equations or the
// send_list after an allgather, but let's keep it in consistent
// shape just in case.
dof_map.create_dof_constraints(_mesh, sys.time);
sys.user_constrain();
dof_map.process_constraints(_mesh);
#endif
dof_map.prepare_send_list();
}
}
| void libMesh::EquationSystems::build_discontinuous_solution_vector | ( | std::vector< Number > & | soln, |
| const std::set< std::string > * | system_names = NULL |
||
| ) | const |
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!=NULL, only include data from the specified systems.
Definition at line 1019 of file equation_systems.C.
References _mesh, _systems, libMesh::MeshBase::active_elements_begin(), libMesh::MeshBase::active_elements_end(), libMesh::DofMap::dof_indices(), end, libMesh::System::get_dof_map(), libMesh::Elem::infinite(), libMesh::libmesh_assert(), libMesh::MeshBase::mesh_dimension(), libMesh::Elem::n_nodes(), n_systems(), libMesh::System::n_vars(), libMesh::FEInterface::nodal_soln(), libMesh::ParallelObject::processor_id(), libMesh::START_LOG(), libMesh::System::update_global_solution(), and libMesh::System::variable_type().
Referenced by libMesh::ExodusII_IO::write_discontinuous_exodusII(), and libMesh::GMVIO::write_discontinuous_gmv().
{
START_LOG("build_discontinuous_solution_vector()", "EquationSystems");
libmesh_assert (this->n_systems());
const unsigned int dim = _mesh.mesh_dimension();
// Get the number of variables (nv) by counting the number of variables
// in each system listed in system_names
unsigned int nv = 0;
{
const_system_iterator pos = _systems.begin();
const const_system_iterator end = _systems.end();
for (; pos != end; ++pos)
{
// Check current system is listed in system_names, and skip pos if not
bool use_current_system = (system_names == NULL);
if (!use_current_system)
use_current_system = system_names->count(pos->first);
if (!use_current_system)
continue;
const System& system = *(pos->second);
nv += system.n_vars();
}
}
unsigned int tw=0;
// get the total weight
{
MeshBase::element_iterator it = _mesh.active_elements_begin();
const MeshBase::element_iterator end = _mesh.active_elements_end();
for ( ; it != end; ++it)
tw += (*it)->n_nodes();
}
// Only if we are on processor zero, allocate the storage
// to hold (number_of_nodes)*(number_of_variables) entries.
if (_mesh.processor_id() == 0)
soln.resize(tw*nv);
std::vector<Number> sys_soln;
unsigned int var_num=0;
// For each system in this EquationSystems object,
// update the global solution and if we are on processor 0,
// loop over the elements and build the nodal solution
// from the element solution. Then insert this nodal solution
// into the vector passed to build_solution_vector.
{
const_system_iterator pos = _systems.begin();
const const_system_iterator end = _systems.end();
for (; pos != end; ++pos)
{
// Check current system is listed in system_names, and skip pos if not
bool use_current_system = (system_names == NULL);
if (!use_current_system)
use_current_system = system_names->count(pos->first);
if (!use_current_system)
continue;
const System& system = *(pos->second);
const unsigned int nv_sys = system.n_vars();
system.update_global_solution (sys_soln, 0);
if (_mesh.processor_id() == 0)
{
std::vector<Number> elem_soln; // The finite element solution
std::vector<Number> nodal_soln; // The FE solution interpolated to the nodes
std::vector<dof_id_type> dof_indices; // The DOF indices for the finite element
for (unsigned int var=0; var<nv_sys; var++)
{
const FEType& fe_type = system.variable_type(var);
MeshBase::element_iterator it = _mesh.active_elements_begin();
const MeshBase::element_iterator end_elem = _mesh.active_elements_end();
unsigned int nn=0;
for ( ; it != end_elem; ++it)
{
const Elem* elem = *it;
system.get_dof_map().dof_indices (elem, dof_indices, var);
elem_soln.resize(dof_indices.size());
for (unsigned int i=0; i<dof_indices.size(); i++)
elem_soln[i] = sys_soln[dof_indices[i]];
FEInterface::nodal_soln (dim,
fe_type,
elem,
elem_soln,
nodal_soln);
#ifdef LIBMESH_ENABLE_INFINITE_ELEMENTS
// infinite elements should be skipped...
if (!elem->infinite())
#endif
{
libmesh_assert_equal_to (nodal_soln.size(), elem->n_nodes());
for (unsigned int n=0; n<elem->n_nodes(); n++)
{
soln[nv*(nn++) + (var + var_num)] +=
nodal_soln[n];
}
}
}
}
}
var_num += nv_sys;
}
}
STOP_LOG("build_discontinuous_solution_vector()", "EquationSystems");
}
| void libMesh::EquationSystems::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. Note that 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 602 of file equation_systems.C.
Referenced by libMesh::MeshOutput< MT >::_build_variable_names_and_solution_vector().
{
//TODO:[BSK] re-implement this from the method below
libmesh_not_implemented();
// // Get a reference to the named system
// const System& system = this->get_system(system_name);
// // Get the number associated with the variable_name we are passed
// const unsigned short int variable_num = system.variable_number(variable_name);
// // Get the dimension of the current mesh
// const unsigned int dim = _mesh.mesh_dimension();
// // If we're on processor 0, allocate enough memory to hold the solution.
// // Since we're only looking at one variable, there will be one solution value
// // for each node in the mesh.
// if (_mesh.processor_id() == 0)
// soln.resize(_mesh.n_nodes());
// // Vector to hold the global solution from all processors
// std::vector<Number> sys_soln;
// // Update the global solution from all processors
// system.update_global_solution (sys_soln, 0);
// // Temporary vector to store the solution on an individual element.
// std::vector<Number> elem_soln;
// // The FE solution interpolated to the nodes
// std::vector<Number> nodal_soln;
// // The DOF indices for the element
// std::vector<dof_id_type> dof_indices;
// // Determine the finite/infinite element type used in this system
// const FEType& fe_type = system.variable_type(variable_num);
// // Define iterators to iterate over all the elements of the mesh
// const_active_elem_iterator it (_mesh.elements_begin());
// const const_active_elem_iterator end(_mesh.elements_end());
// // Loop over elements
// for ( ; it != end; ++it)
// {
// // Convenient shortcut to the element pointer
// const Elem* elem = *it;
// // Fill the dof_indices vector for this variable
// system.get_dof_map().dof_indices(elem,
// dof_indices,
// variable_num);
// // Resize the element solution vector to fit the
// // dof_indices for this element.
// elem_soln.resize(dof_indices.size());
// // Transfer the system solution to the element
// // solution by mapping it through the dof_indices vector.
// for (unsigned int i=0; i<dof_indices.size(); i++)
// elem_soln[i] = sys_soln[dof_indices[i]];
// // Using the FE interface, compute the nodal_soln
// // for the current elemnt type given the elem_soln
// FEInterface::nodal_soln (dim,
// fe_type,
// elem,
// elem_soln,
// nodal_soln);
// // Sanity check -- make sure that there are the same number
// // of entries in the nodal_soln as there are nodes in the
// // element!
// libmesh_assert_equal_to (nodal_soln.size(), elem->n_nodes());
// // Copy the nodal solution over into the correct place in
// // the global soln vector which will be returned to the user.
// for (unsigned int n=0; n<elem->n_nodes(); n++)
// soln[elem->node(n)] = nodal_soln[n];
// }
}
| void libMesh::EquationSystems::build_solution_vector | ( | std::vector< Number > & | soln, |
| const std::set< std::string > * | system_names = NULL |
||
| ) | const |
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!=NULL, only include data from the specified systems.
Definition at line 689 of file equation_systems.C.
References libMesh::ParallelObject::_communicator, _mesh, _systems, libMesh::MeshBase::active_local_elements_begin(), libMesh::MeshBase::active_local_elements_end(), libMesh::Variable::active_on_subdomain(), libMesh::NumericVector< T >::add(), libMesh::NumericVector< T >::close(), libMesh::System::current_local_solution, libMesh::DofMap::dof_indices(), end, libMesh::FEInterface::field_type(), libMesh::System::get_dof_map(), libMesh::Elem::get_node(), libMesh::Elem::infinite(), libMesh::NumericVector< T >::init(), libMesh::libmesh_assert(), libMesh::MeshBase::local_nodes_begin(), libMesh::MeshBase::local_nodes_end(), libMesh::NumericVector< T >::localize_to_one(), libMesh::MeshBase::max_node_id(), libMesh::MeshBase::mesh_dimension(), libMesh::DofObject::n_dofs(), libMesh::MeshBase::n_nodes(), libMesh::Elem::n_nodes(), n_systems(), libMesh::System::n_vars(), libMesh::FEInterface::n_vec_dim(), libMesh::FEInterface::nodal_soln(), libMesh::Elem::node(), libMesh::System::number(), libMesh::PARALLEL, libMesh::System::solution, libMesh::START_LOG(), libMesh::TYPE_VECTOR, libMesh::System::update(), libMesh::System::variable(), and libMesh::System::variable_type().
{
START_LOG("build_solution_vector()", "EquationSystems");
// This function must be run on all processors at once
parallel_object_only();
libmesh_assert (this->n_systems());
const unsigned int dim = _mesh.mesh_dimension();
const dof_id_type nn = _mesh.n_nodes();
// We'd better have a contiguous node numbering
libmesh_assert_equal_to (nn, _mesh.max_node_id());
// allocate storage to hold
// (number_of_nodes)*(number_of_variables) entries.
// We have to differentiate between between scalar and vector
// variables. We intercept vector variables and treat each
// component as a scalar variable (consistently with build_solution_names).
unsigned int nv = 0;
//Could this be replaced by a/some convenience methods?[PB]
{
unsigned int n_scalar_vars = 0;
unsigned int n_vector_vars = 0;
const_system_iterator pos = _systems.begin();
const const_system_iterator end = _systems.end();
for (; pos != end; ++pos)
{
// Check current system is listed in system_names, and skip pos if not
bool use_current_system = (system_names == NULL);
if (!use_current_system)
use_current_system = system_names->count(pos->first);
if (!use_current_system)
continue;
for (unsigned int vn=0; vn<pos->second->n_vars(); vn++)
{
if( FEInterface::field_type(pos->second->variable_type(vn)) ==
TYPE_VECTOR )
n_vector_vars++;
else
n_scalar_vars++;
}
}
// Here, we're assuming the number of vector components is the same
// as the mesh dimension. Will break for mixed dimension meshes.
nv = n_scalar_vars + dim*n_vector_vars;
}
// Get the number of elements that share each node. We will
// compute the average value at each node. This is particularly
// useful for plotting discontinuous data.
MeshBase::element_iterator e_it = _mesh.active_local_elements_begin();
const MeshBase::element_iterator e_end = _mesh.active_local_elements_end();
// Get the number of local nodes
dof_id_type n_local_nodes = cast_int<dof_id_type>
(std::distance(_mesh.local_nodes_begin(),
_mesh.local_nodes_end()));
// Create a NumericVector to hold the parallel solution
UniquePtr<NumericVector<Number> > parallel_soln_ptr = NumericVector<Number>::build(_communicator);
NumericVector<Number> ¶llel_soln = *parallel_soln_ptr;
parallel_soln.init(nn*nv, n_local_nodes*nv, false, PARALLEL);
// Create a NumericVector to hold the "repeat_count" for each node - this is essentially
// the number of elements contributing to that node's value
UniquePtr<NumericVector<Number> > repeat_count_ptr = NumericVector<Number>::build(_communicator);
NumericVector<Number> &repeat_count = *repeat_count_ptr;
repeat_count.init(nn*nv, n_local_nodes*nv, false, PARALLEL);
repeat_count.close();
unsigned int var_num=0;
// For each system in this EquationSystems object,
// update the global solution and if we are on processor 0,
// loop over the elements and build the nodal solution
// from the element solution. Then insert this nodal solution
// into the vector passed to build_solution_vector.
const_system_iterator pos = _systems.begin();
const const_system_iterator end = _systems.end();
for (; pos != end; ++pos)
{
// Check current system is listed in system_names, and skip pos if not
bool use_current_system = (system_names == NULL);
if (!use_current_system)
use_current_system = system_names->count(pos->first);
if (!use_current_system)
continue;
const System& system = *(pos->second);
const unsigned int nv_sys = system.n_vars();
const unsigned int sys_num = system.number();
//Could this be replaced by a/some convenience methods?[PB]
unsigned int n_scalar_vars = 0;
unsigned int n_vector_vars = 0;
for (unsigned int vn=0; vn<pos->second->n_vars(); vn++)
{
if( FEInterface::field_type(pos->second->variable_type(vn)) ==
TYPE_VECTOR )
n_vector_vars++;
else
n_scalar_vars++;
}
// Here, we're assuming the number of vector components is the same
// as the mesh dimension. Will break for mixed dimension meshes.
unsigned int nv_sys_split = n_scalar_vars + dim*n_vector_vars;
// Update the current_local_solution
{
System & non_const_sys = const_cast<System &>(system);
non_const_sys.solution->close();
non_const_sys.update();
}
NumericVector<Number> & sys_soln(*system.current_local_solution);
std::vector<Number> elem_soln; // The finite element solution
std::vector<Number> nodal_soln; // The FE solution interpolated to the nodes
std::vector<dof_id_type> dof_indices; // The DOF indices for the finite element
for (unsigned int var=0; var<nv_sys; var++)
{
const FEType& fe_type = system.variable_type(var);
const Variable &var_description = system.variable(var);
const DofMap &dof_map = system.get_dof_map();
unsigned int n_vec_dim = FEInterface::n_vec_dim( pos->second->get_mesh(), fe_type );
MeshBase::element_iterator it = _mesh.active_local_elements_begin();
const MeshBase::element_iterator end_elem = _mesh.active_local_elements_end();
for ( ; it != end_elem; ++it)
{
const Elem* elem = *it;
if (var_description.active_on_subdomain((*it)->subdomain_id()))
{
dof_map.dof_indices (elem, dof_indices, var);
elem_soln.resize(dof_indices.size());
for (unsigned int i=0; i<dof_indices.size(); i++)
elem_soln[i] = sys_soln(dof_indices[i]);
FEInterface::nodal_soln (dim,
fe_type,
elem,
elem_soln,
nodal_soln);
#ifdef LIBMESH_ENABLE_INFINITE_ELEMENTS
// infinite elements should be skipped...
if (!elem->infinite())
#endif
{
libmesh_assert_equal_to (nodal_soln.size(), n_vec_dim*elem->n_nodes());
for (unsigned int n=0; n<elem->n_nodes(); n++)
{
for( unsigned int d=0; d < n_vec_dim; d++ )
{
// For vector-valued elements, all components are in nodal_soln. For each
// node, the components are stored in order, i.e. node_0 -> s0_x, s0_y, s0_z
parallel_soln.add(nv*(elem->node(n)) + (var+d + var_num), nodal_soln[n_vec_dim*n+d]);
// Increment the repeat count for this position
repeat_count.add(nv*(elem->node(n)) + (var+d + var_num), 1);
}
}
}
}
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:
for (unsigned int n=0; n<elem->n_nodes(); n++)
// Only do this if this variable has NO DoFs at this node... it might have some from an ajoining element...
if(!elem->get_node(n)->n_dofs(sys_num, var))
for( unsigned int d=0; d < n_vec_dim; d++ )
repeat_count.add(nv*(elem->node(n)) + (var+d + var_num), 1);
} // end loop over elements
} // end loop on variables in this system
var_num += nv_sys_split;
} // end loop over systems
parallel_soln.close();
repeat_count.close();
// Divide to get the average value at the nodes
parallel_soln /= repeat_count;
parallel_soln.localize_to_one(soln);
STOP_LOG("build_solution_vector()", "EquationSystems");
}
| void libMesh::EquationSystems::build_variable_names | ( | std::vector< std::string > & | var_names, |
| const FEType * | type = NULL, |
||
| const std::set< std::string > * | system_names = NULL |
||
| ) | const |
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!=NULL, only include names from the specified systems.
Definition at line 497 of file equation_systems.C.
References _systems, end, libMesh::FEInterface::field_type(), get_mesh(), libMesh::libmesh_assert(), libMesh::MeshBase::mesh_dimension(), n_systems(), n_vars(), libMesh::FEInterface::n_vec_dim(), and libMesh::TYPE_VECTOR.
Referenced by libMesh::MeshOutput< MT >::_build_variable_names_and_solution_vector(), libMesh::ExodusII_IO::write_discontinuous_exodusII(), libMesh::GMVIO::write_discontinuous_gmv(), and libMesh::ExodusII_IO::write_element_data().
{
libmesh_assert (this->n_systems());
unsigned int var_num=0;
const_system_iterator pos = _systems.begin();
const const_system_iterator end = _systems.end();
// Need to size var_names by scalar variables plus all the
// vector components for all the vector variables
//Could this be replaced by a/some convenience methods?[PB]
{
unsigned int n_scalar_vars = 0;
unsigned int n_vector_vars = 0;
for (; pos != end; ++pos)
{
// Check current system is listed in system_names, and skip pos if not
bool use_current_system = (system_names == NULL);
if (!use_current_system)
use_current_system = system_names->count(pos->first);
if (!use_current_system)
continue;
for (unsigned int vn=0; vn<pos->second->n_vars(); vn++)
{
if( FEInterface::field_type(pos->second->variable_type(vn)) ==
TYPE_VECTOR )
n_vector_vars++;
else
n_scalar_vars++;
}
}
// Here, we're assuming the number of vector components is the same
// as the mesh dimension. Will break for mixed dimension meshes.
unsigned int dim = this->get_mesh().mesh_dimension();
unsigned int nv = n_scalar_vars + dim*n_vector_vars;
// We'd better not have more than dim*his->n_vars() (all vector variables)
libmesh_assert_less_equal ( nv, dim*this->n_vars() );
// Here, we're assuming the number of vector components is the same
// as the mesh dimension. Will break for mixed dimension meshes.
var_names.resize( nv );
}
// reset
pos = _systems.begin();
for (; pos != end; ++pos)
{
// Check current system is listed in system_names, and skip pos if not
bool use_current_system = (system_names == NULL);
if (!use_current_system)
use_current_system = system_names->count(pos->first);
if (!use_current_system)
continue;
for (unsigned int vn=0; vn<pos->second->n_vars(); vn++)
{
std::string var_name = pos->second->variable_name(vn);
FEType fe_type = pos->second->variable_type(vn);
unsigned int n_vec_dim = FEInterface::n_vec_dim( pos->second->get_mesh(), fe_type);
// Filter on the type if requested
if (type == NULL || (type && *type == fe_type))
{
if( FEInterface::field_type(fe_type) == TYPE_VECTOR )
{
switch(n_vec_dim)
{
case 0:
case 1:
var_names[var_num++] = var_name;
break;
case 2:
var_names[var_num++] = var_name+"_x";
var_names[var_num++] = var_name+"_y";
break;
case 3:
var_names[var_num++] = var_name+"_x";
var_names[var_num++] = var_name+"_y";
var_names[var_num++] = var_name+"_z";
break;
default:
libmesh_error_msg("Invalid dim in build_variable_names");
}
}
else
var_names[var_num++] = var_name;
}
}
}
// Now resize again in case we filtered any names
var_names.resize(var_num);
}
| void libMesh::EquationSystems::clear | ( | ) | [virtual] |
Returns tha data structure to a pristine state.
Definition at line 73 of file equation_systems.C.
References _systems, libMesh::Parameters::clear(), parameters, and libMesh::sys.
Referenced by ~EquationSystems().
{
// Clear any additional parameters
parameters.clear ();
// clear the systems. We must delete them
// since we newed them!
while (!_systems.empty())
{
system_iterator pos = _systems.begin();
System *sys = pos->second;
delete sys;
sys = NULL;
_systems.erase (pos);
}
}
| const Parallel::Communicator& libMesh::ParallelObject::comm | ( | ) | const [inline, inherited] |
Parallel::Communicator object used by this mesh. Definition at line 86 of file parallel_object.h.
References libMesh::ParallelObject::_communicator.
Referenced by libMesh::__libmesh_petsc_diff_solver_monitor(), libMesh::__libmesh_petsc_diff_solver_residual(), libMesh::__libmesh_petsc_snes_residual(), libMesh::MeshRefinement::_coarsen_elements(), libMesh::ExactSolution::_compute_error(), libMesh::MetisPartitioner::_do_partition(), libMesh::ParmetisPartitioner::_do_repartition(), libMesh::UniformRefinementEstimator::_estimate_error(), libMesh::SlepcEigenSolver< T >::_petsc_shell_matrix_get_diagonal(), libMesh::PetscLinearSolver< T >::_petsc_shell_matrix_get_diagonal(), libMesh::SlepcEigenSolver< T >::_petsc_shell_matrix_mult(), libMesh::PetscLinearSolver< T >::_petsc_shell_matrix_mult(), libMesh::PetscLinearSolver< T >::_petsc_shell_matrix_mult_add(), _read_impl(), libMesh::MeshRefinement::_refine_elements(), libMesh::ImplicitSystem::add_matrix(), libMesh::System::add_vector(), libMesh::UnstructuredMesh::all_second_order(), libMesh::LaplaceMeshSmoother::allgather_graph(), libMesh::FEMSystem::assemble_qoi(), libMesh::MeshCommunication::assign_global_indices(), libMesh::ParmetisPartitioner::assign_partitioning(), libMesh::DofMap::attach_matrix(), libMesh::MeshTools::bounding_box(), libMesh::MeshBase::cache_elem_dims(), libMesh::System::calculate_norm(), libMesh::MeshRefinement::coarsen_elements(), 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::Problem_Interface::computeF(), libMesh::Problem_Interface::computeJacobian(), libMesh::Problem_Interface::computePreconditioner(), libMesh::MeshTools::correct_node_proc_ids(), libMesh::MeshCommunication::delete_remote_elements(), libMesh::DofMap::distribute_dofs(), DMlibMeshFunction(), DMlibMeshSetSystem_libMesh(), libMesh::MeshRefinement::eliminate_unrefined_patches(), libMesh::WeightedPatchRecoveryErrorEstimator::estimate_error(), libMesh::PatchRecoveryErrorEstimator::estimate_error(), libMesh::JumpErrorEstimator::estimate_error(), libMesh::AdjointRefinementEstimator::estimate_error(), libMesh::ExactErrorEstimator::estimate_error(), libMesh::MeshRefinement::flag_elements_by_elem_fraction(), libMesh::MeshRefinement::flag_elements_by_error_fraction(), libMesh::MeshRefinement::flag_elements_by_nelem_target(), libMesh::CondensedEigenSystem::get_eigenpair(), libMesh::ImplicitSystem::get_linear_solver(), libMesh::LocationMap< T >::init(), libMesh::TimeSolver::init(), libMesh::SystemSubsetBySubdomain::init(), libMesh::EigenSystem::init_data(), libMesh::EigenSystem::init_matrices(), libMesh::ParmetisPartitioner::initialize(), libMesh::MeshTools::libmesh_assert_valid_dof_ids(), libMesh::ParallelMesh::libmesh_assert_valid_parallel_flags(), libMesh::MeshTools::libmesh_assert_valid_procids< Elem >(), libMesh::MeshTools::libmesh_assert_valid_procids< Node >(), libMesh::MeshTools::libmesh_assert_valid_refinement_flags(), libMesh::MeshRefinement::limit_level_mismatch_at_edge(), libMesh::MeshRefinement::limit_level_mismatch_at_node(), libMesh::MeshRefinement::make_coarsening_compatible(), libMesh::MeshCommunication::make_elems_parallel_consistent(), libMesh::MeshRefinement::make_flags_parallel_consistent(), libMesh::MeshCommunication::make_node_ids_parallel_consistent(), libMesh::MeshCommunication::make_node_proc_ids_parallel_consistent(), libMesh::MeshCommunication::make_nodes_parallel_consistent(), libMesh::MeshRefinement::make_refinement_compatible(), libMesh::FEMSystem::mesh_position_set(), libMesh::MeshSerializer::MeshSerializer(), libMesh::ParallelMesh::n_active_elem(), libMesh::MeshTools::n_active_levels(), libMesh::BoundaryInfo::n_boundary_conds(), libMesh::BoundaryInfo::n_edge_conds(), libMesh::CondensedEigenSystem::n_global_non_condensed_dofs(), libMesh::MeshTools::n_levels(), libMesh::BoundaryInfo::n_nodeset_conds(), libMesh::MeshTools::n_p_levels(), libMesh::ParallelMesh::parallel_max_elem_id(), libMesh::ParallelMesh::parallel_max_node_id(), libMesh::ParallelMesh::parallel_n_elem(), libMesh::ParallelMesh::parallel_n_nodes(), libMesh::Partitioner::partition(), libMesh::Partitioner::partition_unpartitioned_elements(), libMesh::petsc_auto_fieldsplit(), libMesh::System::point_gradient(), libMesh::System::point_hessian(), libMesh::System::point_value(), libMesh::MeshBase::prepare_for_use(), libMesh::System::project_vector(), libMesh::Nemesis_IO::read(), libMesh::XdrIO::read(), libMesh::System::read_header(), libMesh::System::read_legacy_data(), libMesh::System::read_SCALAR_dofs(), libMesh::XdrIO::read_serialized_bc_names(), libMesh::XdrIO::read_serialized_bcs(), 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::MeshBase::recalculate_n_partitions(), libMesh::MeshRefinement::refine_and_coarsen_elements(), libMesh::MeshRefinement::refine_elements(), libMesh::Partitioner::set_node_processor_ids(), libMesh::DofMap::set_nonlocal_dof_objects(), libMesh::LaplaceMeshSmoother::smooth(), libMesh::MeshBase::subdomain_ids(), libMesh::BoundaryInfo::sync(), libMesh::Parallel::sync_element_data_by_parent_id(), libMesh::Parallel::sync_node_data_by_element_id(), libMesh::MeshRefinement::test_level_one(), libMesh::MeshRefinement::test_unflagged(), libMesh::MeshTools::total_weight(), libMesh::NameBasedIO::write(), libMesh::CheckpointIO::write(), libMesh::XdrIO::write(), libMesh::LegacyXdrIO::write_mesh(), libMesh::System::write_SCALAR_dofs(), libMesh::XdrIO::write_serialized_bcs(), libMesh::System::write_serialized_blocked_dof_objects(), libMesh::XdrIO::write_serialized_connectivity(), libMesh::XdrIO::write_serialized_nodes(), libMesh::XdrIO::write_serialized_nodesets(), and libMesh::DivaIO::write_stream().
{ return _communicator; }
| bool libMesh::EquationSystems::compare | ( | const EquationSystems & | other_es, |
| const Real | threshold, | ||
| const bool | verbose | ||
| ) | const [virtual] |
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 1152 of file equation_systems.C.
References _systems, libMesh::System::compare(), end, get_system(), n_systems(), and libMesh::out.
{
// safety check, whether we handle at least the same number
// of systems
std::vector<bool> os_result;
if (this->n_systems() != other_es.n_systems())
{
if (verbose)
{
libMesh::out << " Fatal difference. This system handles "
<< this->n_systems() << " systems," << std::endl
<< " while the other system handles "
<< other_es.n_systems()
<< " systems." << std::endl
<< " Aborting comparison." << std::endl;
}
return false;
}
else
{
// start comparing each system
const_system_iterator pos = _systems.begin();
const const_system_iterator end = _systems.end();
for (; pos != end; ++pos)
{
const std::string& sys_name = pos->first;
const System& system = *(pos->second);
// get the other system
const System& other_system = other_es.get_system (sys_name);
os_result.push_back (system.compare (other_system, threshold, verbose));
}
}
// sum up the results
if (os_result.size()==0)
return true;
else
{
bool os_identical;
unsigned int n = 0;
do
{
os_identical = os_result[n];
n++;
}
while (os_identical && n<os_result.size());
return os_identical;
}
}
| void libMesh::EquationSystems::delete_system | ( | const std::string & | name | ) |
Remove the system named name from the systems array. This function is now deprecated - write the libmesh-devel mailing list if you need it reimplemented.
Definition at line 453 of file equation_systems.C.
References _systems, and libMesh::Quality::name().
| void libMesh::ReferenceCounter::disable_print_counter_info | ( | ) | [static, inherited] |
Definition at line 106 of file reference_counter.C.
References libMesh::ReferenceCounter::_enable_print_counter.
Referenced by libMesh::LibMeshInit::LibMeshInit().
{
_enable_print_counter = false;
return;
}
| void libMesh::ReferenceCounter::enable_print_counter_info | ( | ) | [static, inherited] |
Methods to enable/disable the reference counter output from print_info()
Definition at line 100 of file reference_counter.C.
References libMesh::ReferenceCounter::_enable_print_counter.
{
_enable_print_counter = true;
return;
}
| std::string libMesh::ReferenceCounter::get_info | ( | ) | [static, inherited] |
Gets a string containing the reference information.
Definition at line 47 of file reference_counter.C.
References libMesh::ReferenceCounter::_counts, and libMesh::Quality::name().
Referenced by libMesh::ReferenceCounter::print_info().
{
#if defined(LIBMESH_ENABLE_REFERENCE_COUNTING) && defined(DEBUG)
std::ostringstream oss;
oss << '\n'
<< " ---------------------------------------------------------------------------- \n"
<< "| Reference count information |\n"
<< " ---------------------------------------------------------------------------- \n";
for (Counts::iterator it = _counts.begin();
it != _counts.end(); ++it)
{
const std::string name(it->first);
const unsigned int creations = it->second.first;
const unsigned int destructions = it->second.second;
oss << "| " << name << " reference count information:\n"
<< "| Creations: " << creations << '\n'
<< "| Destructions: " << destructions << '\n';
}
oss << " ---------------------------------------------------------------------------- \n";
return oss.str();
#else
return "";
#endif
}
| std::string libMesh::EquationSystems::get_info | ( | ) | const [virtual] |
Definition at line 1213 of file equation_systems.C.
References _systems, end, and n_systems().
Referenced by print_info().
{
std::ostringstream oss;
oss << " EquationSystems\n"
<< " n_systems()=" << this->n_systems() << '\n';
// Print the info for the individual systems
const_system_iterator pos = _systems.begin();
const const_system_iterator end = _systems.end();
for (; pos != end; ++pos)
oss << pos->second->get_info();
// // Possibly print the parameters
// if (!this->parameters.empty())
// {
// oss << " n_parameters()=" << this->n_parameters() << '\n';
// oss << " Parameters:\n";
// for (std::map<std::string, Real>::const_iterator
// param = _parameters.begin(); param != _parameters.end();
// ++param)
// oss << " "
// << "\""
// << param->first
// << "\""
// << "="
// << param->second
// << '\n';
// }
return oss.str();
}
| const MeshBase & libMesh::EquationSystems::get_mesh | ( | ) | const [inline] |
Definition at line 509 of file equation_systems.h.
References _mesh.
Referenced by libMesh::UniformRefinementEstimator::_estimate_error(), _read_impl(), build_variable_names(), libMesh::AdjointRefinementEstimator::estimate_error(), libMesh::MeshFunction::init(), reinit(), libMesh::VTKIO::system_vectors_to_vtk(), write(), and libMesh::MeshOutput< MT >::write_equation_systems().
{
return _mesh;
}
| MeshBase & libMesh::EquationSystems::get_mesh | ( | ) | [inline] |
Definition at line 517 of file equation_systems.h.
References _mesh.
{
return _mesh;
}
| const MeshData & libMesh::EquationSystems::get_mesh_data | ( | ) | const [inline] |
Definition at line 524 of file equation_systems.h.
References _mesh_data, and libMesh::libmesh_assert().
{
libmesh_assert(_mesh_data);
return *_mesh_data;
}
| MeshData & libMesh::EquationSystems::get_mesh_data | ( | ) | [inline] |
Definition at line 532 of file equation_systems.h.
References _mesh_data, and libMesh::libmesh_assert().
{
libmesh_assert(_mesh_data);
return *_mesh_data;
}
| void libMesh::EquationSystems::get_solution | ( | std::vector< Number > & | soln, |
| std::vector< std::string > & | names | ||
| ) | const |
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 895 of file equation_systems.C.
References libMesh::ParallelObject::_communicator, _mesh, _systems, libMesh::MeshBase::active_local_elements_begin(), libMesh::MeshBase::active_local_elements_end(), libMesh::Variable::active_on_subdomain(), libMesh::NumericVector< T >::close(), libMesh::CONSTANT, libMesh::System::current_local_solution, libMesh::DofMap::dof_indices(), end, libMesh::System::get_dof_map(), libMesh::DofObject::id(), libMesh::NumericVector< T >::init(), libMesh::libmesh_assert(), libMesh::MeshBase::local_elements_begin(), libMesh::MeshBase::local_elements_end(), libMesh::NumericVector< T >::localize_to_one(), libMesh::MeshBase::max_elem_id(), libMesh::MONOMIAL, libMesh::MeshBase::n_elem(), n_systems(), libMesh::System::n_vars(), libMesh::PARALLEL, libMesh::NumericVector< T >::set(), libMesh::System::solution, libMesh::System::update(), libMesh::System::variable(), libMesh::System::variable_name(), and libMesh::System::variable_type().
Referenced by libMesh::ExodusII_IO::write_element_data().
{
// This function must be run on all processors at once
parallel_object_only();
libmesh_assert (this->n_systems());
const dof_id_type ne = _mesh.n_elem();
libmesh_assert_equal_to (ne, _mesh.max_elem_id());
// Get the number of local elements
dof_id_type n_local_elems = cast_int<dof_id_type>
(std::distance(_mesh.local_elements_begin(),
_mesh.local_elements_end()));
// If the names vector has entries, we will only populate the soln vector
// with names included in that list. Note: The names vector may be
// reordered upon exiting this function
std::vector<std::string> filter_names = names;
bool is_filter_names = ! filter_names.empty();
soln.clear();
names.clear();
const FEType type(CONSTANT, MONOMIAL);
dof_id_type nv = 0;
// Find the total number of variables to output
{
const_system_iterator pos = _systems.begin();
const const_system_iterator end = _systems.end();
for (; pos != end; ++pos)
{
const System& system = *(pos->second);
const unsigned int nv_sys = system.n_vars();
for (unsigned int var=0; var < nv_sys; ++var)
{
if ( system.variable_type( var ) != type ||
( is_filter_names && std::find(filter_names.begin(), filter_names.end(), system.variable_name( var )) == filter_names.end()) )
continue;
nv++;
}
}
}
if(!nv) // If there are no variables to write out don't do anything...
return;
// Create a NumericVector to hold the parallel solution
UniquePtr<NumericVector<Number> > parallel_soln_ptr = NumericVector<Number>::build(_communicator);
NumericVector<Number> ¶llel_soln = *parallel_soln_ptr;
parallel_soln.init(ne*nv, n_local_elems*nv, false, PARALLEL);
dof_id_type var_num = 0;
// For each system in this EquationSystems object,
// update the global solution and collect the
// CONSTANT MONOMIALs. The entries are in variable-major
// format.
const_system_iterator pos = _systems.begin();
const const_system_iterator end = _systems.end();
for (; pos != end; ++pos)
{
const System& system = *(pos->second);
const unsigned int nv_sys = system.n_vars();
// Update the current_local_solution
{
System & non_const_sys = const_cast<System &>(system);
non_const_sys.solution->close();
non_const_sys.update();
}
NumericVector<Number> & sys_soln(*system.current_local_solution);
std::vector<dof_id_type> dof_indices; // The DOF indices for the finite element
// Loop over the variable names and load them in order
for (unsigned int var=0; var < nv_sys; ++var)
{
if ( system.variable_type( var ) != type ||
( is_filter_names && std::find(filter_names.begin(), filter_names.end(), system.variable_name( var )) == filter_names.end()) )
continue;
names.push_back( system.variable_name( var ) );
const Variable & variable = system.variable(var);
const DofMap & dof_map = system.get_dof_map();
MeshBase::element_iterator it = _mesh.active_local_elements_begin();
const MeshBase::element_iterator end_elem = _mesh.active_local_elements_end();
for ( ; it != end_elem; ++it)
{
if (variable.active_on_subdomain((*it)->subdomain_id()))
{
const Elem* elem = *it;
dof_map.dof_indices (elem, dof_indices, var);
libmesh_assert_equal_to ( 1, dof_indices.size() );
parallel_soln.set((ne*var_num)+elem->id(), sys_soln(dof_indices[0]));
}
}
var_num++;
} // end loop on variables in this system
} // end loop over systems
parallel_soln.close();
parallel_soln.localize_to_one(soln);
}
| const System & libMesh::EquationSystems::get_system | ( | const std::string & | name | ) | const [inline] |
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 647 of file equation_systems.h.
References _systems.
Referenced by libMesh::ExactSolution::_compute_error(), libMesh::UniformRefinementEstimator::_estimate_error(), _read_impl(), libMesh::EnsightIO::add_scalar(), add_system(), libMesh::EnsightIO::add_vector(), adjoint_solve(), allgather(), libMesh::ExactSolution::attach_exact_deriv(), libMesh::ExactSolution::attach_exact_hessian(), compare(), libMesh::ExactSolution::compute_error(), libMesh::GMVIO::copy_nodal_solution(), libMesh::ExactSolution::error_norm(), libMesh::ErrorEstimator::estimate_errors(), libMesh::ExactSolution::ExactSolution(), init(), reinit(), sensitivity_solve(), solve(), libMesh::VTKIO::system_vectors_to_vtk(), update(), libMesh::EnsightIO::write_scalar_ascii(), and libMesh::EnsightIO::write_vector_ascii().
{
const_system_iterator pos = _systems.find(name);
// Check for errors
if (pos == _systems.end())
libmesh_error_msg("ERROR: no system named \"" << name << "\" found!");
// Attempt dynamic cast
return *cast_ptr<T_sys*>(pos->second);
}
| System & libMesh::EquationSystems::get_system | ( | const std::string & | name | ) | [inline] |
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 666 of file equation_systems.h.
References _systems.
{
system_iterator pos = _systems.find(name);
// Check for errors
if (pos == _systems.end())
libmesh_error_msg("ERROR: no system named " << name << " found!");
// Attempt dynamic cast
return *cast_ptr<T_sys*>(pos->second);
}
| const System & libMesh::EquationSystems::get_system | ( | const unsigned int | num | ) | const [inline] |
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 596 of file equation_systems.h.
References _systems, end, and n_systems().
{
libmesh_assert_less (num, this->n_systems());
const_system_iterator pos = _systems.begin();
const const_system_iterator end = _systems.end();
for (; pos != end; ++pos)
if (pos->second->number() == num)
break;
// Check for errors
if (pos == end)
libmesh_error_msg("ERROR: no system number " << num << " found!");
// Attempt dynamic cast
return *cast_ptr<T_sys*>(pos->second);
}
| System & libMesh::EquationSystems::get_system | ( | const unsigned int | num | ) | [inline] |
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 621 of file equation_systems.h.
References _systems, end, and n_systems().
{
libmesh_assert_less (num, this->n_systems());
const_system_iterator pos = _systems.begin();
const const_system_iterator end = _systems.end();
for (; pos != end; ++pos)
if (pos->second->number() == num)
break;
// Check for errors
if (pos == end)
libmesh_error_msg("ERROR: no system number " << num << " found!");
// Attempt dynamic cast
return *cast_ptr<T_sys*>(pos->second);
}
| const System& libMesh::EquationSystems::get_system | ( | const std::string & | name | ) | const |
name. | System& libMesh::EquationSystems::get_system | ( | const std::string & | name | ) |
name. | const System& libMesh::EquationSystems::get_system | ( | const unsigned int | num | ) | const |
num. | System& libMesh::EquationSystems::get_system | ( | const unsigned int | num | ) |
num. | bool libMesh::EquationSystems::has_mesh_data | ( | ) | const [inline] |
Definition at line 539 of file equation_systems.h.
References _mesh_data.
{
return (_mesh_data!=NULL);
}
| bool libMesh::EquationSystems::has_system | ( | const std::string & | name | ) | const [inline] |
name exists within this EquationSystems object. Definition at line 584 of file equation_systems.h.
References _systems.
Referenced by libMesh::EnsightIO::add_scalar(), libMesh::EnsightIO::add_vector(), libMesh::ExactSolution::compute_error(), and libMesh::ExactSolution::error_norm().
| void libMesh::ReferenceCounter::increment_constructor_count | ( | const std::string & | name | ) | [inline, protected, inherited] |
Increments the construction counter. Should be called in the constructor of any derived class that will be reference counted.
Definition at line 163 of file reference_counter.h.
References libMesh::ReferenceCounter::_counts, libMesh::Quality::name(), and libMesh::Threads::spin_mtx.
Referenced by libMesh::ReferenceCountedObject< RBParametrized >::ReferenceCountedObject().
{
Threads::spin_mutex::scoped_lock lock(Threads::spin_mtx);
std::pair<unsigned int, unsigned int>& p = _counts[name];
p.first++;
}
| void libMesh::ReferenceCounter::increment_destructor_count | ( | const std::string & | name | ) | [inline, protected, inherited] |
Increments the destruction counter. Should be called in the destructor of any derived class that will be reference counted.
Definition at line 176 of file reference_counter.h.
References libMesh::ReferenceCounter::_counts, libMesh::Quality::name(), and libMesh::Threads::spin_mtx.
Referenced by libMesh::ReferenceCountedObject< RBParametrized >::~ReferenceCountedObject().
{
Threads::spin_mutex::scoped_lock lock(Threads::spin_mtx);
std::pair<unsigned int, unsigned int>& p = _counts[name];
p.second++;
}
| void libMesh::EquationSystems::init | ( | ) | [virtual] |
Initialize all the systems
Definition at line 94 of file equation_systems.C.
References _mesh, libMesh::MeshRefinement::clean_refinement_flags(), libMesh::MeshBase::delete_remote_elements(), libMesh::MeshBase::elements_begin(), libMesh::MeshBase::elements_end(), get_system(), libMesh::ParallelObject::n_processors(), n_systems(), libMesh::MeshBase::nodes_begin(), and libMesh::MeshBase::nodes_end().
Referenced by _read_impl(), libMesh::Solver::init(), and libMesh::ErrorVector::plot_error().
{
const unsigned int n_sys = this->n_systems();
libmesh_assert_not_equal_to (n_sys, 0);
// Distribute the mesh if possible
if (this->n_processors() > 1)
_mesh.delete_remote_elements();
// Tell all the \p DofObject entities how many systems
// there are.
{
MeshBase::node_iterator node_it = _mesh.nodes_begin();
const MeshBase::node_iterator node_end = _mesh.nodes_end();
for ( ; node_it != node_end; ++node_it)
(*node_it)->set_n_systems(n_sys);
MeshBase::element_iterator elem_it = _mesh.elements_begin();
const MeshBase::element_iterator elem_end = _mesh.elements_end();
for ( ; elem_it != elem_end; ++elem_it)
(*elem_it)->set_n_systems(n_sys);
}
for (unsigned int i=0; i != this->n_systems(); ++i)
this->get_system(i).init();
#ifdef LIBMESH_ENABLE_AMR
MeshRefinement mesh_refine(_mesh);
mesh_refine.clean_refinement_flags();
#endif
}
| std::size_t libMesh::EquationSystems::n_active_dofs | ( | ) | const |
Returns the number of active degrees of freedom for the EquationSystems object.
Definition at line 1298 of file equation_systems.C.
{
std::size_t tot=0;
const_system_iterator pos = _systems.begin();
const const_system_iterator end = _systems.end();
for (; pos != end; ++pos)
tot += pos->second->n_active_dofs();
return tot;
}
| std::size_t libMesh::EquationSystems::n_dofs | ( | ) | const |
Definition at line 1282 of file equation_systems.C.
{
std::size_t tot=0;
const_system_iterator pos = _systems.begin();
const const_system_iterator end = _systems.end();
for (; pos != end; ++pos)
tot += pos->second->n_dofs();
return tot;
}
| static unsigned int libMesh::ReferenceCounter::n_objects | ( | ) | [inline, static, inherited] |
Prints the number of outstanding (created, but not yet destroyed) objects.
Definition at line 79 of file reference_counter.h.
References libMesh::ReferenceCounter::_n_objects.
Referenced by libMesh::LibMeshInit::~LibMeshInit().
{ return _n_objects; }
| processor_id_type libMesh::ParallelObject::n_processors | ( | ) | const [inline, inherited] |
Definition at line 92 of file parallel_object.h.
References libMesh::ParallelObject::_communicator, and libMesh::Parallel::Communicator::size().
Referenced by libMesh::ParmetisPartitioner::_do_repartition(), libMesh::ParallelMesh::add_elem(), libMesh::ParallelMesh::add_node(), libMesh::LaplaceMeshSmoother::allgather_graph(), libMesh::FEMSystem::assembly(), libMesh::ParmetisPartitioner::assign_partitioning(), libMesh::ParallelMesh::assign_unique_ids(), libMesh::AztecLinearSolver< T >::AztecLinearSolver(), libMesh::ParallelMesh::clear(), libMesh::Nemesis_IO_Helper::compute_border_node_ids(), libMesh::Nemesis_IO_Helper::construct_nemesis_filename(), libMesh::UnstructuredMesh::create_pid_mesh(), libMesh::DofMap::distribute_dofs(), libMesh::DofMap::distribute_local_dofs_node_major(), libMesh::DofMap::distribute_local_dofs_var_major(), libMesh::EnsightIO::EnsightIO(), libMesh::MeshBase::get_info(), init(), libMesh::SystemSubsetBySubdomain::init(), libMesh::ParmetisPartitioner::initialize(), libMesh::Nemesis_IO_Helper::initialize(), libMesh::MeshTools::libmesh_assert_valid_dof_ids(), libMesh::MeshTools::libmesh_assert_valid_procids< Elem >(), libMesh::MeshTools::libmesh_assert_valid_procids< Node >(), libMesh::MeshTools::libmesh_assert_valid_refinement_flags(), libMesh::DofMap::local_variable_indices(), libMesh::MeshBase::n_active_elem_on_proc(), libMesh::MeshBase::n_elem_on_proc(), libMesh::MeshBase::n_nodes_on_proc(), libMesh::Partitioner::partition(), libMesh::MeshBase::partition(), libMesh::Partitioner::partition_unpartitioned_elements(), libMesh::PetscLinearSolver< T >::PetscLinearSolver(), libMesh::System::point_gradient(), libMesh::System::point_hessian(), libMesh::System::point_value(), libMesh::MeshTools::processor_bounding_box(), libMesh::System::project_vector(), libMesh::NameBasedIO::read(), libMesh::Nemesis_IO::read(), libMesh::CheckpointIO::read(), libMesh::XdrIO::read(), libMesh::System::read_parallel_data(), libMesh::System::read_SCALAR_dofs(), libMesh::System::read_serialized_blocked_dof_objects(), libMesh::System::read_serialized_vector(), libMesh::Partitioner::repartition(), libMesh::Partitioner::set_node_processor_ids(), libMesh::DofMap::set_nonlocal_dof_objects(), libMesh::BoundaryInfo::sync(), libMesh::ParallelMesh::update_parallel_id_counts(), libMesh::CheckpointIO::write(), libMesh::GMVIO::write_binary(), libMesh::GMVIO::write_discontinuous_gmv(), libMesh::System::write_parallel_data(), libMesh::System::write_SCALAR_dofs(), libMesh::XdrIO::write_serialized_bcs(), libMesh::System::write_serialized_blocked_dof_objects(), libMesh::XdrIO::write_serialized_connectivity(), libMesh::XdrIO::write_serialized_nodes(), and libMesh::XdrIO::write_serialized_nodesets().
{ return cast_int<processor_id_type>(_communicator.size()); }
| unsigned int libMesh::EquationSystems::n_systems | ( | ) | const [inline] |
Definition at line 546 of file equation_systems.h.
References _systems.
Referenced by libMesh::UniformRefinementEstimator::_estimate_error(), add_system(), adjoint_solve(), allgather(), libMesh::ExactSolution::attach_exact_deriv(), libMesh::ExactSolution::attach_exact_hessian(), build_discontinuous_solution_vector(), build_solution_vector(), build_variable_names(), compare(), libMesh::GMVIO::copy_nodal_solution(), libMesh::ErrorEstimator::estimate_errors(), libMesh::ExactSolution::ExactSolution(), get_info(), get_solution(), get_system(), init(), reinit(), sensitivity_solve(), solve(), libMesh::VTKIO::system_vectors_to_vtk(), update(), and write().
{
return cast_int<unsigned int>(_systems.size());
}
| unsigned int libMesh::EquationSystems::n_vars | ( | ) | const |
Definition at line 1267 of file equation_systems.C.
Referenced by build_variable_names().
{
unsigned int tot=0;
const_system_iterator pos = _systems.begin();
const const_system_iterator end = _systems.end();
for (; pos != end; ++pos)
tot += pos->second->n_vars();
return tot;
}
| void libMesh::ReferenceCounter::print_info | ( | std::ostream & | out = libMesh::out | ) | [static, inherited] |
Prints the reference information, by default to libMesh::out.
Definition at line 88 of file reference_counter.C.
References libMesh::ReferenceCounter::_enable_print_counter, and libMesh::ReferenceCounter::get_info().
Referenced by libMesh::LibMeshInit::~LibMeshInit().
{
if( _enable_print_counter ) out_stream << ReferenceCounter::get_info();
}
| void libMesh::EquationSystems::print_info | ( | std::ostream & | os = libMesh::out | ) | const |
Prints information about the equation systems, by default to libMesh::out.
Definition at line 1251 of file equation_systems.C.
References get_info().
Referenced by libMesh::operator<<().
{
os << this->get_info()
<< std::endl;
}
| processor_id_type libMesh::ParallelObject::processor_id | ( | ) | const [inline, inherited] |
Definition at line 98 of file parallel_object.h.
References libMesh::ParallelObject::_communicator, and libMesh::Parallel::Communicator::rank().
Referenced by libMesh::MetisPartitioner::_do_partition(), _read_impl(), libMesh::SerialMesh::active_local_elements_begin(), libMesh::ParallelMesh::active_local_elements_begin(), libMesh::SerialMesh::active_local_elements_end(), libMesh::ParallelMesh::active_local_elements_end(), libMesh::SerialMesh::active_local_subdomain_elements_begin(), libMesh::ParallelMesh::active_local_subdomain_elements_begin(), libMesh::SerialMesh::active_local_subdomain_elements_end(), libMesh::ParallelMesh::active_local_subdomain_elements_end(), libMesh::SerialMesh::active_not_local_elements_begin(), libMesh::ParallelMesh::active_not_local_elements_begin(), libMesh::SerialMesh::active_not_local_elements_end(), libMesh::ParallelMesh::active_not_local_elements_end(), libMesh::ParallelMesh::add_elem(), libMesh::DofMap::add_neighbors_to_send_list(), libMesh::ParallelMesh::add_node(), libMesh::UnstructuredMesh::all_second_order(), libMesh::FEMSystem::assembly(), libMesh::ParmetisPartitioner::assign_partitioning(), libMesh::ParallelMesh::assign_unique_ids(), build_discontinuous_solution_vector(), libMesh::Nemesis_IO_Helper::build_element_and_node_maps(), libMesh::ParmetisPartitioner::build_graph(), libMesh::InfElemBuilder::build_inf_elem(), libMesh::DofMap::build_sparsity(), libMesh::ParallelMesh::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::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_Helper::create(), libMesh::ParallelMesh::delete_elem(), libMesh::ParallelMesh::delete_node(), libMesh::DofMap::distribute_dofs(), libMesh::DofMap::distribute_local_dofs_node_major(), libMesh::DofMap::distribute_local_dofs_var_major(), libMesh::DofMap::end_dof(), libMesh::DofMap::end_old_dof(), libMesh::EnsightIO::EnsightIO(), libMesh::SerialMesh::facelocal_elements_begin(), libMesh::ParallelMesh::facelocal_elements_begin(), libMesh::SerialMesh::facelocal_elements_end(), libMesh::ParallelMesh::facelocal_elements_end(), libMesh::MeshFunction::find_element(), 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::MeshBase::get_info(), libMesh::Nemesis_IO_Helper::get_init_global(), libMesh::Nemesis_IO_Helper::get_init_info(), libMesh::Nemesis_IO_Helper::get_loadbal_param(), libMesh::Nemesis_IO_Helper::get_node_cmap(), libMesh::Nemesis_IO_Helper::get_node_map(), libMesh::Nemesis_IO_Helper::get_ns_param_global(), libMesh::Nemesis_IO_Helper::get_ss_param_global(), libMesh::SystemSubsetBySubdomain::init(), libMesh::ParmetisPartitioner::initialize(), libMesh::ExodusII_IO_Helper::initialize(), libMesh::ExodusII_IO_Helper::initialize_element_variables(), libMesh::ExodusII_IO_Helper::initialize_global_variables(), libMesh::ExodusII_IO_Helper::initialize_nodal_variables(), libMesh::ParallelMesh::insert_elem(), libMesh::SparsityPattern::Build::join(), libMesh::DofMap::last_dof(), libMesh::MeshTools::libmesh_assert_valid_procids< Elem >(), libMesh::MeshTools::libmesh_assert_valid_procids< Node >(), libMesh::SerialMesh::local_elements_begin(), libMesh::ParallelMesh::local_elements_begin(), libMesh::SerialMesh::local_elements_end(), libMesh::ParallelMesh::local_elements_end(), libMesh::SerialMesh::local_level_elements_begin(), libMesh::ParallelMesh::local_level_elements_begin(), libMesh::SerialMesh::local_level_elements_end(), libMesh::ParallelMesh::local_level_elements_end(), libMesh::SerialMesh::local_nodes_begin(), libMesh::ParallelMesh::local_nodes_begin(), libMesh::SerialMesh::local_nodes_end(), libMesh::ParallelMesh::local_nodes_end(), libMesh::SerialMesh::local_not_level_elements_begin(), libMesh::ParallelMesh::local_not_level_elements_begin(), libMesh::SerialMesh::local_not_level_elements_end(), libMesh::ParallelMesh::local_not_level_elements_end(), libMesh::DofMap::local_variable_indices(), libMesh::MeshRefinement::make_coarsening_compatible(), 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::SerialMesh::not_local_elements_begin(), libMesh::ParallelMesh::not_local_elements_begin(), libMesh::SerialMesh::not_local_elements_end(), libMesh::ParallelMesh::not_local_elements_end(), libMesh::WeightedPatchRecoveryErrorEstimator::EstimateError::operator()(), libMesh::SparsityPattern::Build::operator()(), libMesh::PatchRecoveryErrorEstimator::EstimateError::operator()(), libMesh::ParallelMesh::ParallelMesh(), libMesh::System::point_gradient(), libMesh::System::point_hessian(), libMesh::System::point_value(), libMesh::System::project_vector(), libMesh::Nemesis_IO_Helper::put_cmap_params(), libMesh::Nemesis_IO_Helper::put_elem_cmap(), libMesh::Nemesis_IO_Helper::put_elem_map(), libMesh::Nemesis_IO_Helper::put_loadbal_param(), libMesh::Nemesis_IO_Helper::put_node_cmap(), libMesh::Nemesis_IO_Helper::put_node_map(), libMesh::NameBasedIO::read(), libMesh::Nemesis_IO::read(), libMesh::CheckpointIO::read(), libMesh::XdrIO::read(), libMesh::ExodusII_IO_Helper::read_elem_num_map(), libMesh::System::read_header(), libMesh::System::read_legacy_data(), libMesh::ExodusII_IO_Helper::read_node_num_map(), libMesh::System::read_parallel_data(), libMesh::System::read_SCALAR_dofs(), libMesh::XdrIO::read_serialized_bc_names(), libMesh::XdrIO::read_serialized_bcs(), 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::MeshData::read_xdr(), libMesh::SerialMesh::semilocal_elements_begin(), libMesh::ParallelMesh::semilocal_elements_begin(), libMesh::SerialMesh::semilocal_elements_end(), libMesh::ParallelMesh::semilocal_elements_end(), libMesh::Partitioner::set_node_processor_ids(), libMesh::DofMap::set_nonlocal_dof_objects(), libMesh::LaplaceMeshSmoother::smooth(), libMesh::BoundaryInfo::sync(), libMesh::MeshTools::total_weight(), libMesh::ParallelMesh::update_parallel_id_counts(), libMesh::MeshTools::weight(), libMesh::NameBasedIO::write(), libMesh::ExodusII_IO::write(), libMesh::CheckpointIO::write(), libMesh::XdrIO::write(), write(), libMesh::GMVIO::write_discontinuous_gmv(), libMesh::ExodusII_IO::write_element_data(), libMesh::ExodusII_IO_Helper::write_element_values(), libMesh::ExodusII_IO_Helper::write_elements(), libMesh::ExodusII_IO::write_global_data(), libMesh::ExodusII_IO_Helper::write_global_values(), libMesh::System::write_header(), libMesh::ExodusII_IO::write_information_records(), libMesh::ExodusII_IO_Helper::write_information_records(), libMesh::ExodusII_IO_Helper::write_nodal_coordinates(), libMesh::UCDIO::write_nodal_data(), libMesh::ExodusII_IO::write_nodal_data(), libMesh::ExodusII_IO::write_nodal_data_discontinuous(), libMesh::ExodusII_IO_Helper::write_nodal_values(), libMesh::ExodusII_IO_Helper::write_nodesets(), libMesh::Nemesis_IO_Helper::write_nodesets(), libMesh::System::write_parallel_data(), libMesh::System::write_SCALAR_dofs(), libMesh::XdrIO::write_serialized_bc_names(), libMesh::XdrIO::write_serialized_bcs(), 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_sidesets(), libMesh::Nemesis_IO_Helper::write_sidesets(), libMesh::ExodusII_IO::write_timestep(), and libMesh::ExodusII_IO_Helper::write_timestep().
{ return cast_int<processor_id_type>(_communicator.rank()); }
| template void libMesh::EquationSystems::read< Real > | ( | 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. 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 that 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
| partition_agnostic | If 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 that this renumbering is not compatible with meshes that have two nodes in exactly the same position! |
Definition at line 92 of file equation_systems_io.C.
References _mesh, libMesh::Quality::name(), libMesh::out, and TRY_READ_IFEMS.
Referenced by _read_impl(), and read().
{
#ifdef LIBMESH_ENABLE_EXCEPTIONS
// If we have exceptions enabled we can be considerate and try
// to read old restart files which contain infinite element
// information but do not have the " with infinite elements"
// string in the version information.
// First try the read the user requested
try
{
this->_read_impl<InValType> (name, mode, read_flags, partition_agnostic);
}
// If that fails, try it again but explicitly request we look for infinite element info
catch (...)
{
libMesh::out << "\n*********************************************************************\n"
<< "READING THE FILE \"" << name << "\" FAILED.\n"
<< "It is possible this file contains infinite element information,\n"
<< "but the version string does not contain \" with infinite elements\"\n"
<< "Let's try this again, but looking for infinite element information...\n"
<< "*********************************************************************\n"
<< std::endl;
try
{
this->_read_impl<InValType> (name, mode, read_flags | EquationSystems::TRY_READ_IFEMS, partition_agnostic);
}
// If all that failed, we are out of ideas here...
catch (...)
{
libMesh::out << "\n*********************************************************************\n"
<< "Well, at least we tried!\n"
<< "Good Luck!!\n"
<< "*********************************************************************\n"
<< std::endl;
throw;
}
}
#else
// no exceptions - cross your fingers...
this->_read_impl<InValType> (name, mode, read_flags, partition_agnostic);
#endif // #ifdef LIBMESH_ENABLE_EXCEPTIONS
#ifdef LIBMESH_ENABLE_AMR
MeshRefinement mesh_refine(_mesh);
mesh_refine.clean_refinement_flags();
#endif
}
| void libMesh::EquationSystems::read | ( | const std::string & | name, |
| const XdrMODE | mode, | ||
| const unsigned int | read_flags = (READ_HEADER | READ_DATA), |
||
| bool | partition_agnostic = true |
||
| ) | [inline] |
Definition at line 335 of file equation_systems.h.
References libMesh::Quality::name().
{ read<Number>(name, mode, read_flags, partition_agnostic); }
| template void libMesh::EquationSystems::read< Real > | ( | const std::string & | name, |
| const unsigned int | read_flags = (READ_HEADER|READ_DATA), |
||
| bool | partition_agnostic = true |
||
| ) |
Definition at line 74 of file equation_systems_io.C.
References _mesh, libMesh::MeshRefinement::clean_refinement_flags(), libMesh::DECODE, libMesh::READ, and read().
| void libMesh::EquationSystems::read | ( | const std::string & | name, |
| const unsigned int | read_flags = (READ_HEADER | READ_DATA), |
||
| bool | partition_agnostic = true |
||
| ) | [inline] |
Definition at line 346 of file equation_systems.h.
References libMesh::Quality::name().
{ read<Number>(name, read_flags, partition_agnostic); }
| void libMesh::EquationSystems::reinit | ( | ) | [virtual] |
Reinitialize all the systems
Definition at line 131 of file equation_systems.C.
References _mesh, libMesh::MeshRefinement::coarsen_elements(), libMesh::MeshBase::contract(), libMesh::DofMap::create_dof_constraints(), libMesh::DofMap::distribute_dofs(), libMesh::MeshBase::elements_begin(), libMesh::MeshBase::elements_end(), libMesh::MeshRefinement::face_level_mismatch_limit(), libMesh::System::get_dof_map(), get_mesh(), get_system(), n_systems(), libMesh::DofObject::n_systems(), libMesh::MeshBase::nodes_begin(), libMesh::MeshBase::nodes_end(), libMesh::DofMap::prepare_send_list(), libMesh::DofMap::process_constraints(), libMesh::System::prolong_vectors(), libMesh::MeshRefinement::refine_elements(), libMesh::System::restrict_vectors(), libMesh::sys, libMesh::System::time, and libMesh::System::user_constrain().
Referenced by libMesh::UniformRefinementEstimator::_estimate_error(), and libMesh::AdjointRefinementEstimator::estimate_error().
{
parallel_object_only();
const unsigned int n_sys = this->n_systems();
libmesh_assert_not_equal_to (n_sys, 0);
// We may have added new systems since our last
// EquationSystems::(re)init call
bool _added_new_systems = false;
for (unsigned int i=0; i != n_sys; ++i)
if (!this->get_system(i).is_initialized())
_added_new_systems = true;
if (_added_new_systems)
{
// Our DofObjects will need space for the additional systems
MeshBase::node_iterator node_it = _mesh.nodes_begin();
const MeshBase::node_iterator node_end = _mesh.nodes_end();
for ( ; node_it != node_end; ++node_it)
(*node_it)->set_n_systems(n_sys);
MeshBase::element_iterator elem_it = _mesh.elements_begin();
const MeshBase::element_iterator elem_end = _mesh.elements_end();
for ( ; elem_it != elem_end; ++elem_it)
(*elem_it)->set_n_systems(n_sys);
// And any new systems will need initialization
for (unsigned int i=0; i != n_sys; ++i)
if (!this->get_system(i).is_initialized())
this->get_system(i).init();
}
#ifdef DEBUG
// Make sure all the \p DofObject entities know how many systems
// there are.
{
// All the nodes
MeshBase::node_iterator node_it = _mesh.nodes_begin();
const MeshBase::node_iterator node_end = _mesh.nodes_end();
for ( ; node_it != node_end; ++node_it)
{
Node *node = *node_it;
libmesh_assert_equal_to (node->n_systems(), this->n_systems());
}
// All the elements
MeshBase::element_iterator elem_it = _mesh.elements_begin();
const MeshBase::element_iterator elem_end = _mesh.elements_end();
for ( ; elem_it != elem_end; ++elem_it)
{
Elem *elem = *elem_it;
libmesh_assert_equal_to (elem->n_systems(), this->n_systems());
}
}
#endif
// Localize each system's vectors
for (unsigned int i=0; i != this->n_systems(); ++i)
this->get_system(i).re_update();
#ifdef LIBMESH_ENABLE_AMR
bool dof_constraints_created = false;
bool mesh_changed = false;
// FIXME: For backwards compatibility, assume
// refine_and_coarsen_elements or refine_uniformly have already
// been called
{
for (unsigned int i=0; i != this->n_systems(); ++i)
{
System &sys = this->get_system(i);
// Even if the system doesn't have any variables in it we want
// consistent behavior; e.g. distribute_dofs should have the
// opportunity to count up zero dofs on each processor.
//
// Who's been adding zero-var systems anyway, outside of my
// unit tests? - RHS
// if(!sys.n_vars())
// continue;
sys.get_dof_map().distribute_dofs(_mesh);
// Recreate any hanging node constraints
sys.get_dof_map().create_dof_constraints(_mesh, sys.time);
// Apply any user-defined constraints
sys.user_constrain();
// Expand any recursive constraints
sys.get_dof_map().process_constraints(_mesh);
// And clean up the send_list before we use it again
sys.get_dof_map().prepare_send_list();
sys.prolong_vectors();
}
mesh_changed = true;
dof_constraints_created = true;
}
// FIXME: Where should the user set maintain_level_one now??
// Don't override previous settings, for now
MeshRefinement mesh_refine(_mesh);
mesh_refine.face_level_mismatch_limit() = false;
// Try to coarsen the mesh, then restrict each system's vectors
// if necessary
if (mesh_refine.coarsen_elements())
{
for (unsigned int i=0; i != this->n_systems(); ++i)
{
System &sys = this->get_system(i);
if (!dof_constraints_created)
{
sys.get_dof_map().distribute_dofs(_mesh);
sys.get_dof_map().create_dof_constraints(_mesh, sys.time);
sys.user_constrain();
sys.get_dof_map().process_constraints(_mesh);
sys.get_dof_map().prepare_send_list();
}
sys.restrict_vectors();
}
mesh_changed = true;
dof_constraints_created = true;
}
// Once vectors are all restricted, we can delete
// children of coarsened elements
if (mesh_changed)
this->get_mesh().contract();
// Try to refine the mesh, then prolong each system's vectors
// if necessary
if (mesh_refine.refine_elements())
{
for (unsigned int i=0; i != this->n_systems(); ++i)
{
System &sys = this->get_system(i);
if (!dof_constraints_created)
{
sys.get_dof_map().distribute_dofs(_mesh);
sys.get_dof_map().create_dof_constraints(_mesh, sys.time);
sys.user_constrain();
sys.get_dof_map().process_constraints(_mesh);
sys.get_dof_map().prepare_send_list();
}
sys.prolong_vectors();
}
mesh_changed = true;
// dof_constraints_created = true;
}
// If the mesh has changed, systems will need to create new dof
// constraints and update their global solution vectors
if (mesh_changed)
{
for (unsigned int i=0; i != this->n_systems(); ++i)
this->get_system(i).reinit();
}
#endif // #ifdef LIBMESH_ENABLE_AMR
}
| void libMesh::EquationSystems::sensitivity_solve | ( | const ParameterVector & | parameters | ) | [virtual] |
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 477 of file equation_systems.C.
References get_system(), libMesh::libmesh_assert(), and n_systems().
{
libmesh_assert (this->n_systems());
for (unsigned int i=0; i != this->n_systems(); ++i)
this->get_system(i).sensitivity_solve(parameters_in);
}
| void libMesh::EquationSystems::solve | ( | ) | [virtual] |
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 467 of file equation_systems.C.
References get_system(), libMesh::libmesh_assert(), and n_systems().
Referenced by libMesh::UniformRefinementEstimator::_estimate_error(), and libMesh::Solver::solve().
{
libmesh_assert (this->n_systems());
for (unsigned int i=0; i != this->n_systems(); ++i)
this->get_system(i).solve();
}
| void libMesh::EquationSystems::update | ( | ) |
Updates local values for all the systems
Definition at line 357 of file equation_systems.C.
References get_system(), n_systems(), and libMesh::START_LOG().
Referenced by _read_impl().
{
START_LOG("update()","EquationSystems");
// Localize each system's vectors
for (unsigned int i=0; i != this->n_systems(); ++i)
this->get_system(i).update();
STOP_LOG("update()","EquationSystems");
}
| void libMesh::EquationSystems::write | ( | const std::string & | name, |
| const XdrMODE | mode, | ||
| const unsigned int | write_flags = (WRITE_DATA), |
||
| bool | partition_agnostic = true |
||
| ) | const |
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 that 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
| partition_agnostic | If 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 that 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 389 of file equation_systems_io.C.
References _mesh, _systems, libMesh::Xdr::data(), libMesh::get_io_compatibility_version(), get_mesh(), libMesh::MeshTools::Private::globally_renumber_nodes_and_elements(), libMesh::MeshBase::is_serial(), libMesh::libmesh_assert(), mesh, n_systems(), libMesh::ParallelObject::processor_id(), libMesh::Xdr::set_version(), libMesh::START_LOG(), WRITE_ADDITIONAL_DATA, WRITE_DATA, WRITE_PARALLEL_FILES, WRITE_SERIAL_FILES, and libMesh::Xdr::writing().
Referenced by write(), and libMesh::NameBasedIO::write_equation_systems().
{
// the EquationSystems::write() method should look constant,
// but we need to assign a temporary numbering to the nodes
// and elements in the mesh, which requires that we abuse const_cast
if(partition_agnostic)
{
MeshBase &mesh = const_cast<MeshBase&>(this->get_mesh());
MeshTools::Private::globally_renumber_nodes_and_elements(mesh);
}
// set booleans from write_flags argument
const bool write_data = write_flags & EquationSystems::WRITE_DATA;
const bool write_additional_data = write_flags & EquationSystems::WRITE_ADDITIONAL_DATA;
// always write parallel files if we're instructed to write in
// parallel
const bool write_parallel_files =
(write_flags & EquationSystems::WRITE_PARALLEL_FILES) ||
// but also write parallel files if we haven't been instructed to
// write in serial and we're on a distributed mesh
(!(write_flags & EquationSystems::WRITE_SERIAL_FILES) &&
!this->get_mesh().is_serial());
// New scope so that io will close before we try to zip the file
{
Xdr io((this->processor_id()==0) ? name : "", mode);
libmesh_assert (io.writing());
START_LOG("write()","EquationSystems");
const unsigned int proc_id = this->processor_id();
unsigned int n_sys = this->n_systems();
std::map<std::string, System*>::const_iterator
pos = _systems.begin();
// set the version number in the Xdr object
io.set_version(LIBMESH_VERSION_ID(LIBMESH_MAJOR_VERSION,
LIBMESH_MINOR_VERSION,
LIBMESH_MICRO_VERSION));
// Only write the header information
// if we are processor 0.
if (proc_id == 0)
{
std::string comment;
char buf[256];
// 1.)
// Write the version header
std::string version("libMesh-" + libMesh::get_io_compatibility_version());
if (write_parallel_files) version += " parallel";
#ifdef LIBMESH_ENABLE_INFINITE_ELEMENTS
version += " with infinite elements";
#endif
io.data (version, "# File Format Identifier");
// 2.)
// Write the number of equation systems
io.data (n_sys, "# No. of Equation Systems");
while (pos != _systems.end())
{
// 3.)
// Write the name of the sys_num-th system
{
const unsigned int sys_num = pos->second->number();
std::string sys_name = pos->first;
comment = "# Name, System No. ";
std::sprintf(buf, "%u", sys_num);
comment += buf;
io.data (sys_name, comment.c_str());
}
// 4.)
// Write the type of system handled
{
const unsigned int sys_num = pos->second->number();
std::string sys_type = pos->second->system_type();
comment = "# Type, System No. ";
std::sprintf(buf, "%u", sys_num);
comment += buf;
io.data (sys_type, comment.c_str());
}
// 5.) - 9.)
// Let System::write_header() do the job
pos->second->write_header (io, version, write_additional_data);
++pos;
}
}
// Start from the first system, again,
// to write vectors to disk, if wanted
if (write_data)
{
// open a parallel buffer if warranted.
Xdr local_io (write_parallel_files ? local_file_name(this->processor_id(),name) : "", mode);
for (pos = _systems.begin(); pos != _systems.end(); ++pos)
{
// 10.) + 11.)
if (write_parallel_files)
pos->second->write_parallel_data (local_io,write_additional_data);
else
pos->second->write_serialized_data (io,write_additional_data);
}
}
STOP_LOG("write()","EquationSystems");
}
// the EquationSystems::write() method should look constant,
// but we need to undo the temporary numbering of the nodes
// and elements in the mesh, which requires that we abuse const_cast
if(partition_agnostic)
const_cast<MeshBase&>(_mesh).fix_broken_node_and_element_numbering();
}
| void libMesh::EquationSystems::write | ( | const std::string & | name, |
| const unsigned int | write_flags = (WRITE_DATA), |
||
| bool | partition_agnostic = true |
||
| ) | const |
Definition at line 377 of file equation_systems_io.C.
References libMesh::ENCODE, libMesh::WRITE, and write().
| std::ostream& operator<< | ( | std::ostream & | os, |
| const EquationSystems & | es | ||
| ) | [friend] |
Same as above, but allows you to also use stream syntax.
Definition at line 1259 of file equation_systems.C.
{
es.print_info(os);
return os;
}
const Parallel::Communicator& libMesh::ParallelObject::_communicator [protected, inherited] |
Definition at line 104 of file parallel_object.h.
Referenced by build_solution_vector(), libMesh::ParallelObject::comm(), get_solution(), libMesh::ParallelObject::n_processors(), libMesh::ParallelObject::operator=(), and libMesh::ParallelObject::processor_id().
ReferenceCounter::Counts libMesh::ReferenceCounter::_counts [static, protected, inherited] |
Actually holds the data.
Definition at line 118 of file reference_counter.h.
Referenced by libMesh::ReferenceCounter::get_info(), libMesh::ReferenceCounter::increment_constructor_count(), and libMesh::ReferenceCounter::increment_destructor_count().
bool libMesh::ReferenceCounter::_enable_print_counter = true [static, protected, inherited] |
Flag to control whether reference count information is printed when print_info is called.
Definition at line 137 of file reference_counter.h.
Referenced by libMesh::ReferenceCounter::disable_print_counter_info(), libMesh::ReferenceCounter::enable_print_counter_info(), and libMesh::ReferenceCounter::print_info().
MeshBase& libMesh::EquationSystems::_mesh [protected] |
The mesh data structure
Definition at line 454 of file equation_systems.h.
Referenced by _add_system_to_nodes_and_elems(), _read_impl(), allgather(), build_discontinuous_solution_vector(), build_solution_vector(), get_mesh(), get_solution(), init(), read(), reinit(), and write().
MeshData* libMesh::EquationSystems::_mesh_data [protected] |
A pointer to the MeshData object you would like to use. Can be NULL.
Definition at line 460 of file equation_systems.h.
Referenced by get_mesh_data(), and has_mesh_data().
Threads::spin_mutex libMesh::ReferenceCounter::_mutex [static, protected, inherited] |
Mutual exclusion object to enable thread-safe reference counting.
Definition at line 131 of file reference_counter.h.
Threads::atomic< unsigned int > libMesh::ReferenceCounter::_n_objects [static, protected, inherited] |
The number of objects. Print the reference count information when the number returns to 0.
Definition at line 126 of file reference_counter.h.
Referenced by libMesh::ReferenceCounter::n_objects(), libMesh::ReferenceCounter::ReferenceCounter(), and libMesh::ReferenceCounter::~ReferenceCounter().
std::map<std::string, System*> libMesh::EquationSystems::_systems [protected] |
Data structure holding the systems.
Definition at line 465 of file equation_systems.h.
Referenced by add_system(), build_discontinuous_solution_vector(), build_solution_vector(), build_variable_names(), clear(), compare(), delete_system(), get_info(), get_solution(), get_system(), has_system(), n_active_dofs(), n_dofs(), n_systems(), n_vars(), and write().
Data structure holding arbitrary parameters.
Definition at line 445 of file equation_systems.h.
Referenced by libMesh::ExactSolution::attach_exact_deriv(), libMesh::ExactSolution::attach_exact_hessian(), libMesh::NewmarkSystem::clear(), clear(), libMesh::FrequencySystem::clear_all(), EquationSystems(), libMesh::ExactErrorEstimator::find_squared_element_error(), libMesh::ImplicitSystem::get_linear_solve_parameters(), libMesh::FEComputeData::init(), libMesh::FrequencySystem::init_data(), libMesh::FrequencySystem::n_frequencies(), libMesh::NewmarkSystem::NewmarkSystem(), libMesh::NonlinearImplicitSystem::NonlinearImplicitSystem(), 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(), libMesh::CondensedEigenSystem::solve(), libMesh::EigenSystem::solve(), libMesh::LinearImplicitSystem::solve(), libMesh::FrequencySystem::solve(), and libMesh::WrappedFunction< Output >::WrappedFunction().