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

The CheckpointIO class can be used to write simplified restart files that can be used to restart simulations that have crashed. More...

#include <checkpoint_io.h>

Inheritance diagram for libMesh::CheckpointIO:
[legend]

Public Types

typedef largest_id_type xdr_id_type
 
typedef uint64_t header_id_type
 

Public Member Functions

 CheckpointIO (MeshBase &, const bool=false)
 Constructor. More...
 
 CheckpointIO (const MeshBase &, const bool=false)
 Constructor. More...
 
virtual ~CheckpointIO ()
 Destructor. More...
 
virtual void read (const std::string &input_name) override
 This method implements reading a mesh from a specified file. More...
 
virtual void write (const std::string &name) override
 This method implements writing a mesh to a specified file. More...
 
bool binary () const
 Get/Set the flag indicating if we should read/write binary. More...
 
bool & binary ()
 
bool parallel () const
 Get/Set the flag indicating if we should read/write binary. More...
 
bool & parallel ()
 
const std::string & version () const
 Get/Set the version string. More...
 
std::string & version ()
 
bool version_at_least_1_5 () const
 
const std::vector< processor_id_type > & current_processor_ids () const
 Get/Set the processor id or processor ids to use. More...
 
std::vector< processor_id_type > & current_processor_ids ()
 
const processor_id_typecurrent_n_processors () const
 Get/Set the n_processors to use. More...
 
processor_id_typecurrent_n_processors ()
 
virtual void write_equation_systems (const std::string &, const EquationSystems &, const std::set< std::string > *system_names=nullptr)
 This method implements writing a mesh with data to a specified file where the data is taken from the EquationSystems object. More...
 
virtual void write_discontinuous_equation_systems (const std::string &, const EquationSystems &, const std::set< std::string > *system_names=nullptr)
 This method implements writing a mesh with discontinuous data to a specified file where the data is taken from the EquationSystems object. More...
 
virtual void write_nodal_data (const std::string &, const std::vector< Number > &, const std::vector< std::string > &)
 This method implements writing a mesh with nodal data to a specified file where the nodal data and variable names are provided. More...
 
virtual void write_nodal_data (const std::string &, const NumericVector< Number > &, const std::vector< std::string > &)
 This method may be overridden by "parallel" output formats for writing nodal data. More...
 
virtual void write_nodal_data (const std::string &, const EquationSystems &, const std::set< std::string > *)
 This method should be overridden by "parallel" output formats for writing nodal data. More...
 
virtual void write_nodal_data_discontinuous (const std::string &, const std::vector< Number > &, const std::vector< std::string > &)
 This method implements writing a mesh with discontinuous data to a specified file where the nodal data and variables names are provided. More...
 
unsigned intascii_precision ()
 Return/set the precision to use when writing ASCII files. More...
 
const Parallel::Communicator & comm () const
 
processor_id_type n_processors () const
 
processor_id_type processor_id () const
 

Static Public Member Functions

static void cleanup (const std::string &input_name, processor_id_type n_procs)
 Used to remove a checkpoint directory and its corresponding files. More...
 

Protected Member Functions

MeshBasemesh ()
 
void set_n_partitions (unsigned int n_parts)
 Sets the number of partitions in the mesh. More...
 
void skip_comment_lines (std::istream &in, const char comment_start)
 Reads input from in, skipping all the lines that start with the character comment_start. More...
 
const MeshBasemesh () const
 

Protected Attributes

std::vector< bool > elems_of_dimension
 A vector of bools describing what dimension elements have been encountered when reading a mesh. More...
 
const bool _is_parallel_format
 Flag specifying whether this format is parallel-capable. More...
 
const bool _serial_only_needed_on_proc_0
 Flag specifying whether this format can be written by only serializing the mesh to processor zero. More...
 
const Parallel::Communicator & _communicator
 

Private Member Functions

void write_subdomain_names (Xdr &io) const
 Write subdomain name information. More...
 
void write_connectivity (Xdr &io, const std::set< const Elem *, CompareElemIdsByLevel > &elements) const
 Write the connectivity for part of a mesh. More...
 
void write_remote_elem (Xdr &io, const std::set< const Elem *, CompareElemIdsByLevel > &elements) const
 Write the remote_elem neighbor and child links for part of a mesh. More...
 
void write_nodes (Xdr &io, const std::set< const Node * > &nodeset) const
 Write the nodal locations for part of a mesh. More...
 
void write_bcs (Xdr &io, const std::set< const Elem *, CompareElemIdsByLevel > &elements, const std::vector< std::tuple< dof_id_type, unsigned short int, boundary_id_type >> &bc_triples) const
 Write the side boundary conditions for part of a mesh. More...
 
void write_nodesets (Xdr &io, const std::set< const Node * > &nodeset, const std::vector< std::tuple< dof_id_type, boundary_id_type >> &bc_tuples) const
 Write the nodal boundary conditions for part of a mesh. More...
 
void write_bc_names (Xdr &io, const BoundaryInfo &info, bool is_sideset) const
 Write boundary names information (sideset and nodeset) More...
 
template<typename file_id_type >
file_id_type read_header (const std::string &name)
 Read header data on processor 0, then broadcast. More...
 
template<typename file_id_type >
void read_subfile (Xdr &io, bool expect_all_remote)
 Read a non-header file. More...
 
template<typename file_id_type >
void read_subdomain_names (Xdr &io)
 Read subdomain name information. More...
 
template<typename file_id_type >
void read_connectivity (Xdr &io)
 Read the connectivity for a parallel, distributed mesh. More...
 
template<typename file_id_type >
void read_remote_elem (Xdr &io, bool expect_all_remote)
 Read the remote_elem neighbor and child links for a parallel, distributed mesh. More...
 
template<typename file_id_type >
void read_nodes (Xdr &io)
 Read the nodal locations for a parallel, distributed mesh. More...
 
template<typename file_id_type >
void read_bcs (Xdr &io)
 Read the boundary conditions for a parallel, distributed mesh. More...
 
template<typename file_id_type >
void read_nodesets (Xdr &io)
 Read the nodeset conditions for a parallel, distributed mesh. More...
 
template<typename file_id_type >
void read_bc_names (Xdr &io, BoundaryInfo &info, bool is_sideset)
 Read boundary names information (sideset and nodeset) More...
 
template<typename file_id_type >
void read_integers_names (Xdr &io, std::vector< std::string > &node_integer_names, std::vector< std::string > &elem_integer_names)
 Read extra integers names information. More...
 
unsigned int n_active_levels_in (MeshBase::const_element_iterator begin, MeshBase::const_element_iterator end) const
 
processor_id_type select_split_config (const std::string &input_name, header_id_type &data_size)
 
template<typename file_id_type >
void read_remote_elem (Xdr &io, bool libmesh_dbg_var(expect_all_remote))
 

Private Attributes

bool _binary
 
bool _parallel
 
std::string _version
 
std::vector< processor_id_type_my_processor_ids
 
processor_id_type _my_n_processors
 
MeshBase_obj
 A pointer to a non-const object object. More...
 
const bool _is_parallel_format
 Flag specifying whether this format is parallel-capable. More...
 
unsigned int _ascii_precision
 Precision to use when writing ASCII files. More...
 

Detailed Description

The CheckpointIO class can be used to write simplified restart files that can be used to restart simulations that have crashed.

Author
Benjamin Kirk
John Peterson
Derek Gaston
Roy Stogner
Date
2017

Definition at line 60 of file checkpoint_io.h.

Member Typedef Documentation

◆ header_id_type

Definition at line 69 of file checkpoint_io.h.

◆ xdr_id_type

Definition at line 66 of file checkpoint_io.h.

Constructor & Destructor Documentation

◆ CheckpointIO() [1/2]

libMesh::CheckpointIO::CheckpointIO ( MeshBase mesh,
const bool  binary_in = false 
)
explicit

Constructor.

Takes a writable reference to a mesh object. This is the constructor required to read a mesh. The optional parameter binary can be used to switch between ASCII (false, the default) or binary (true) files.

Definition at line 160 of file checkpoint_io.C.

160  :
161  MeshInput<MeshBase> (mesh,/* is_parallel_format = */ true),
162  MeshOutput<MeshBase>(mesh,/* is_parallel_format = */ true),
164  _binary (binary_in),
165  _parallel (false),
166  _version ("checkpoint-1.5"),
169 {
170 }

◆ CheckpointIO() [2/2]

libMesh::CheckpointIO::CheckpointIO ( const MeshBase mesh,
const bool  binary_in = false 
)
explicit

Constructor.

Takes a reference to a constant mesh object. This constructor will only allow us to write the mesh. The optional parameter binary can be used to switch between ASCII (false, the default) or binary (true) files.

Definition at line 172 of file checkpoint_io.C.

172  :
173  MeshOutput<MeshBase>(mesh,/* is_parallel_format = */ true),
175  _binary (binary_in),
176  _parallel (false),
179 {
180 }

◆ ~CheckpointIO()

libMesh::CheckpointIO::~CheckpointIO ( )
virtual

Destructor.

Definition at line 182 of file checkpoint_io.C.

183 {
184 }

Member Function Documentation

◆ ascii_precision()

unsigned int & libMesh::MeshOutput< MeshBase >::ascii_precision ( )
inlineinherited

Return/set the precision to use when writing ASCII files.

By default we use numeric_limits<Real>::max_digits10, which should be enough to write out to ASCII and get the exact same Real back when reading in.

Definition at line 257 of file mesh_output.h.

258 {
259  return _ascii_precision;
260 }

◆ binary() [1/2]

bool& libMesh::CheckpointIO::binary ( )
inline

Definition at line 146 of file checkpoint_io.h.

146 { return _binary; }

References _binary.

◆ binary() [2/2]

bool libMesh::CheckpointIO::binary ( ) const
inline

Get/Set the flag indicating if we should read/write binary.

Definition at line 145 of file checkpoint_io.h.

145 { return _binary; }

References _binary.

Referenced by read(), read_header(), select_split_config(), CheckpointIOTest::testSplitter(), and write().

◆ cleanup()

void libMesh::CheckpointIO::cleanup ( const std::string &  input_name,
processor_id_type  n_procs 
)
static

Used to remove a checkpoint directory and its corresponding files.

This effectively undoes all the work done be calls to write(...). For example, if a checkpoint configuration was written via:

unsigned int n_splits = 42;
std::unique_ptr<CheckpointIO> cp = split_mesh(my_mesh, n_splits);
// ...
cp->write("foo.cpr");

then you could remove all the corresponding created files/dirs by:

CheckpointIO::cleanup(my_mesh, n_splits);

Or for cases where the split configuration was determined automatically (e.g. via number of running procs with distributed/parallel mesh), then you could:

CheckpointIO::cleanup(your_mesh, your_mesh.comm().size());

Other remaining checkpoint split configurations for the mesh are left unmodified.

Definition at line 251 of file checkpoint_io.C.

252 {
253  auto header = header_file(input_name, n_procs);
254  auto ret = std::remove(header.c_str());
255  if (ret != 0)
256  libmesh_warning("Failed to clean up checkpoint header '" << header << "': " << std::strerror(ret));
257 
258  for (processor_id_type i = 0; i < n_procs; i++)
259  {
260  auto split = split_file(input_name, n_procs, i);
261  ret = std::remove(split.c_str());
262  if (ret != 0)
263  libmesh_warning("Failed to clean up checkpoint split file '" << split << "': " << std::strerror(ret));
264  }
265 
266  auto dir = split_dir(input_name, n_procs);
267  ret = rmdir(dir.c_str());
268  if (ret != 0)
269  libmesh_warning("Failed to clean up checkpoint split dir '" << dir << "': " << std::strerror(ret));
270 
271  // We expect that this may fail if there are other split configurations still present in this
272  // directory - so don't bother to check/warn for failure.
273  rmdir(input_name.c_str());
274 }

◆ comm()

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

Definition at line 94 of file parallel_object.h.

95  { return _communicator; }

References libMesh::ParallelObject::_communicator.

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

◆ current_n_processors() [1/2]

processor_id_type& libMesh::CheckpointIO::current_n_processors ( )
inline

Definition at line 193 of file checkpoint_io.h.

193 { return _my_n_processors; }

References _my_n_processors.

◆ current_n_processors() [2/2]

const processor_id_type& libMesh::CheckpointIO::current_n_processors ( ) const
inline

Get/Set the n_processors to use.

The default n_processors to use is the n_processors() of the mesh.

This is used for m->n parallel checkpoint file writing: You can force CheckpointIO to view the world as if it contains this number of processors by setting it here

Definition at line 192 of file checkpoint_io.h.

192 { return _my_n_processors; }

References _my_n_processors.

Referenced by CheckpointIOTest::testSplitter().

◆ current_processor_ids() [1/2]

std::vector<processor_id_type>& libMesh::CheckpointIO::current_processor_ids ( )
inline

Definition at line 180 of file checkpoint_io.h.

180 { return _my_processor_ids; }

References _my_processor_ids.

◆ current_processor_ids() [2/2]

const std::vector<processor_id_type>& libMesh::CheckpointIO::current_processor_ids ( ) const
inline

Get/Set the processor id or processor ids to use.

The default processor_id to use is the processor_id() of the mesh.

This is used for m->n parallel checkpoint file writing: You can force CheckpointIO to write out different partitions of a mesh by setting which partitions to write from each processor here.

Definition at line 179 of file checkpoint_io.h.

179 { return _my_processor_ids; }

References _my_processor_ids.

Referenced by CheckpointIOTest::testSplitter().

◆ mesh() [1/2]

MeshBase & libMesh::MeshInput< MeshBase >::mesh ( )
inlineprotectedinherited
Returns
The object as a writable reference.

Definition at line 169 of file mesh_input.h.

170 {
171  if (_obj == nullptr)
172  libmesh_error_msg("ERROR: _obj should not be nullptr!");
173  return *_obj;
174 }

◆ mesh() [2/2]

const MeshBase & libMesh::MeshOutput< MeshBase >::mesh ( ) const
inlineprotectedinherited
Returns
The object as a read-only reference.

Definition at line 247 of file mesh_output.h.

248 {
250  return *_obj;
251 }

◆ n_active_levels_in()

unsigned int libMesh::CheckpointIO::n_active_levels_in ( MeshBase::const_element_iterator  begin,
MeshBase::const_element_iterator  end 
) const
private
Returns
The number of levels of refinement in the active mesh on this processor.
Note
This includes all elements on this processor even those not owned by this processor! Implemented by looping over all the active elements and finding the maximum level.

Definition at line 1441 of file checkpoint_io.C.

1443 {
1444  unsigned int max_level = 0;
1445 
1446  for (const auto & elem : as_range(begin, end))
1447  max_level = std::max(elem->level(), max_level);
1448 
1449  return max_level + 1;
1450 }

References libMesh::as_range(), end, and libMesh::MeshTools::max_level().

◆ n_processors()

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

Definition at line 100 of file parallel_object.h.

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

References libMesh::ParallelObject::_communicator.

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

◆ parallel() [1/2]

bool& libMesh::CheckpointIO::parallel ( )
inline

Definition at line 152 of file checkpoint_io.h.

152 { return _parallel; }

References _parallel.

◆ parallel() [2/2]

bool libMesh::CheckpointIO::parallel ( ) const
inline

Get/Set the flag indicating if we should read/write binary.

Definition at line 151 of file checkpoint_io.h.

151 { return _parallel; }

References _parallel.

Referenced by CheckpointIOTest::testSplitter(), and write().

◆ processor_id()

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

Definition at line 106 of file parallel_object.h.

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

References libMesh::ParallelObject::_communicator.

Referenced by libMesh::BoundaryInfo::_find_id_maps(), libMesh::EquationSystems::_read_impl(), libMesh::PetscDMWrapper::add_dofs_to_section(), libMesh::DistributedMesh::add_elem(), libMesh::BoundaryInfo::add_elements(), libMesh::DofMap::add_neighbors_to_send_list(), libMesh::DistributedMesh::add_node(), libMesh::UnstructuredMesh::all_second_order(), libMesh::MeshTools::Modification::all_tri(), libMesh::DofMap::allgather_recursive_constraints(), libMesh::FEMSystem::assembly(), libMesh::Nemesis_IO_Helper::build_element_and_node_maps(), libMesh::InfElemBuilder::build_inf_elem(), libMesh::BoundaryInfo::build_node_list_from_side_list(), libMesh::EquationSystems::build_parallel_elemental_solution_vector(), libMesh::DistributedMesh::clear(), libMesh::ExodusII_IO_Helper::close(), libMesh::Nemesis_IO_Helper::compute_border_node_ids(), libMesh::Nemesis_IO_Helper::compute_communication_map_parameters(), libMesh::Nemesis_IO_Helper::compute_internal_and_border_elems_and_internal_nodes(), libMesh::RBConstruction::compute_max_error_bound(), libMesh::Nemesis_IO_Helper::compute_node_communication_maps(), libMesh::Nemesis_IO_Helper::compute_num_global_elem_blocks(), libMesh::Nemesis_IO_Helper::compute_num_global_nodesets(), libMesh::Nemesis_IO_Helper::compute_num_global_sidesets(), libMesh::Nemesis_IO_Helper::construct_nemesis_filename(), libMesh::ExodusII_IO::copy_scalar_solution(), libMesh::MeshTools::correct_node_proc_ids(), libMesh::ExodusII_IO_Helper::create(), libMesh::DistributedMesh::delete_elem(), libMesh::DistributedMesh::delete_node(), libMesh::MeshCommunication::delete_remote_elements(), libMesh::DofMap::distribute_dofs(), libMesh::DofMap::distribute_local_dofs_node_major(), libMesh::DofMap::distribute_local_dofs_var_major(), libMesh::DistributedMesh::DistributedMesh(), libMesh::DofMap::end_dof(), libMesh::DofMap::end_old_dof(), libMesh::EnsightIO::EnsightIO(), libMesh::RBEIMConstruction::evaluate_mesh_function(), libMesh::MeshFunction::find_element(), libMesh::MeshFunction::find_elements(), libMesh::UnstructuredMesh::find_neighbors(), libMesh::DofMap::first_dof(), libMesh::DofMap::first_old_dof(), libMesh::Nemesis_IO_Helper::get_cmap_params(), libMesh::Nemesis_IO_Helper::get_eb_info_global(), libMesh::Nemesis_IO_Helper::get_elem_cmap(), libMesh::Nemesis_IO_Helper::get_elem_map(), libMesh::DofMap::get_info(), libMesh::Nemesis_IO_Helper::get_init_global(), libMesh::Nemesis_IO_Helper::get_init_info(), libMesh::Nemesis_IO_Helper::get_loadbal_param(), libMesh::DofMap::get_local_constraints(), libMesh::Nemesis_IO_Helper::get_node_cmap(), libMesh::Nemesis_IO_Helper::get_node_map(), libMesh::Nemesis_IO_Helper::get_ns_param_global(), libMesh::Nemesis_IO_Helper::get_ss_param_global(), libMesh::SparsityPattern::Build::handle_vi_vj(), libMesh::SystemSubsetBySubdomain::init(), libMesh::PetscDMWrapper::init_and_attach_petscdm(), HeatSystem::init_data(), libMesh::ExodusII_IO_Helper::initialize(), libMesh::ExodusII_IO_Helper::initialize_element_variables(), libMesh::ExodusII_IO_Helper::initialize_global_variables(), libMesh::ExodusII_IO_Helper::initialize_nodal_variables(), libMesh::DistributedMesh::insert_elem(), libMesh::DofMap::is_evaluable(), libMesh::SparsityPattern::Build::join(), libMesh::DofMap::last_dof(), libMesh::TransientRBEvaluation::legacy_write_offline_data_to_files(), libMesh::RBEIMEvaluation::legacy_write_offline_data_to_files(), libMesh::RBEvaluation::legacy_write_offline_data_to_files(), libMesh::RBSCMEvaluation::legacy_write_offline_data_to_files(), libMesh::RBEIMEvaluation::legacy_write_out_interpolation_points_elem(), libMesh::MeshTools::libmesh_assert_consistent_distributed(), libMesh::MeshTools::libmesh_assert_consistent_distributed_nodes(), libMesh::MeshTools::libmesh_assert_contiguous_dof_ids(), libMesh::MeshTools::libmesh_assert_parallel_consistent_procids< Elem >(), libMesh::MeshTools::libmesh_assert_valid_neighbors(), libMesh::DistributedMesh::libmesh_assert_valid_parallel_object_ids(), libMesh::DofMap::local_variable_indices(), main(), libMesh::MeshRefinement::make_coarsening_compatible(), AugmentSparsityOnInterface::mesh_reinit(), libMesh::MeshBase::n_active_local_elem(), libMesh::BoundaryInfo::n_boundary_conds(), libMesh::BoundaryInfo::n_edge_conds(), libMesh::DofMap::n_local_dofs(), libMesh::System::n_local_dofs(), libMesh::MeshBase::n_local_elem(), libMesh::MeshBase::n_local_nodes(), libMesh::BoundaryInfo::n_nodeset_conds(), libMesh::BoundaryInfo::n_shellface_conds(), libMesh::SparsityPattern::Build::operator()(), libMesh::DistributedMesh::own_node(), libMesh::System::point_gradient(), libMesh::System::point_hessian(), libMesh::System::point_value(), libMesh::DofMap::print_dof_constraints(), libMesh::Nemesis_IO_Helper::put_cmap_params(), libMesh::Nemesis_IO_Helper::put_elem_cmap(), libMesh::Nemesis_IO_Helper::put_elem_map(), libMesh::Nemesis_IO_Helper::put_loadbal_param(), libMesh::Nemesis_IO_Helper::put_node_cmap(), libMesh::Nemesis_IO_Helper::put_node_map(), libMesh::NameBasedIO::read(), libMesh::Nemesis_IO::read(), libMesh::XdrIO::read(), read(), libMesh::ExodusII_IO_Helper::read_elem_num_map(), libMesh::ExodusII_IO_Helper::read_global_values(), read_header(), libMesh::XdrIO::read_header(), libMesh::System::read_header(), libMesh::RBEvaluation::read_in_vectors_from_multiple_files(), libMesh::System::read_legacy_data(), libMesh::ExodusII_IO_Helper::read_node_num_map(), libMesh::System::read_parallel_data(), libMesh::TransientRBConstruction::read_riesz_representors_from_files(), libMesh::RBConstruction::read_riesz_representors_from_files(), libMesh::System::read_SCALAR_dofs(), libMesh::XdrIO::read_serialized_bc_names(), libMesh::XdrIO::read_serialized_bcs_helper(), libMesh::System::read_serialized_blocked_dof_objects(), libMesh::XdrIO::read_serialized_connectivity(), libMesh::System::read_serialized_data(), libMesh::XdrIO::read_serialized_nodes(), libMesh::XdrIO::read_serialized_nodesets(), libMesh::XdrIO::read_serialized_subdomain_names(), libMesh::System::read_serialized_vector(), libMesh::System::read_serialized_vectors(), libMesh::DistributedMesh::renumber_dof_objects(), libMesh::DofMap::scatter_constraints(), select_split_config(), libMesh::DofMap::set_nonlocal_dof_objects(), libMesh::PetscDMWrapper::set_point_range_in_section(), libMesh::LaplaceMeshSmoother::smooth(), DefaultCouplingTest::testCoupling(), PointNeighborCouplingTest::testCoupling(), MeshInputTest::testDynaReadElem(), MeshInputTest::testDynaReadPatch(), MeshInputTest::testExodusCopyElementSolution(), MeshInputTest::testExodusWriteElementDataFromDiscontinuousNodalData(), SystemsTest::testProjectMatrix1D(), SystemsTest::testProjectMatrix2D(), SystemsTest::testProjectMatrix3D(), BoundaryInfoTest::testShellFaceConstraints(), CheckpointIOTest::testSplitter(), WriteVecAndScalar::testWrite(), libMesh::MeshTools::total_weight(), libMesh::MeshRefinement::uniformly_coarsen(), libMesh::Parallel::Packing< Node * >::unpack(), libMesh::Parallel::Packing< Elem * >::unpack(), libMesh::DistributedMesh::update_parallel_id_counts(), libMesh::DTKAdapter::update_variable_values(), libMesh::NameBasedIO::write(), libMesh::XdrIO::write(), write(), libMesh::EquationSystems::write(), libMesh::GMVIO::write_discontinuous_gmv(), libMesh::ExodusII_IO::write_element_data(), libMesh::ExodusII_IO_Helper::write_element_values(), libMesh::ExodusII_IO_Helper::write_element_values_element_major(), libMesh::ExodusII_IO_Helper::write_elements(), libMesh::ExodusII_IO::write_global_data(), libMesh::ExodusII_IO_Helper::write_global_values(), libMesh::System::write_header(), libMesh::ExodusII_IO::write_information_records(), libMesh::ExodusII_IO_Helper::write_information_records(), libMesh::ExodusII_IO_Helper::write_nodal_coordinates(), libMesh::VTKIO::write_nodal_data(), libMesh::UCDIO::write_nodal_data(), libMesh::ExodusII_IO::write_nodal_data(), libMesh::ExodusII_IO::write_nodal_data_discontinuous(), libMesh::ExodusII_IO_Helper::write_nodal_values(), libMesh::Nemesis_IO_Helper::write_nodesets(), libMesh::ExodusII_IO_Helper::write_nodesets(), libMesh::RBEvaluation::write_out_vectors(), write_output_solvedata(), libMesh::System::write_parallel_data(), libMesh::RBConstruction::write_riesz_representors_to_files(), libMesh::System::write_SCALAR_dofs(), libMesh::XdrIO::write_serialized_bc_names(), libMesh::XdrIO::write_serialized_bcs_helper(), libMesh::System::write_serialized_blocked_dof_objects(), libMesh::XdrIO::write_serialized_connectivity(), libMesh::System::write_serialized_data(), libMesh::XdrIO::write_serialized_nodes(), libMesh::XdrIO::write_serialized_nodesets(), libMesh::XdrIO::write_serialized_subdomain_names(), libMesh::System::write_serialized_vector(), libMesh::System::write_serialized_vectors(), libMesh::ExodusII_IO_Helper::write_sideset_data(), libMesh::Nemesis_IO_Helper::write_sidesets(), libMesh::ExodusII_IO_Helper::write_sidesets(), libMesh::ExodusII_IO::write_timestep(), libMesh::ExodusII_IO_Helper::write_timestep(), and libMesh::ExodusII_IO::write_timestep_discontinuous().

◆ read()

void libMesh::CheckpointIO::read ( const std::string &  input_name)
overridevirtual

This method implements reading a mesh from a specified file.

If the mesh has been split for running on several processors, input_name should simply be the name of the mesh split directory without the "-split[n]" suffix. The number of splits will be determined automatically by the number of processes being used for the mesh at the time of reading.

Implements libMesh::MeshInput< MeshBase >.

Definition at line 804 of file checkpoint_io.C.

805 {
806  LOG_SCOPE("read()","CheckpointIO");
807 
808  MeshBase & mesh = MeshInput<MeshBase>::mesh();
809 
811 
812  header_id_type data_size;
813  processor_id_type input_n_procs = select_split_config(input_name, data_size);
814  auto header_name = header_file(input_name, input_n_procs);
815  bool input_parallel = input_n_procs > 0;
816 
817  // If this is a serial read then we're going to only read the mesh
818  // on processor 0, then broadcast it
819  if ((input_parallel && !mesh.is_replicated()) || mesh.processor_id() == 0)
820  {
821  // If we're trying to read a parallel checkpoint file on a
822  // replicated mesh, we'll read every file on processor 0 so we
823  // can broadcast it later. If we're on a distributed mesh then
824  // we'll read every id to it's own processor and we'll "wrap
825  // around" with any ids that exceed our processor count.
826  const processor_id_type begin_proc_id =
827  (input_parallel && !mesh.is_replicated()) ?
828  mesh.processor_id() : 0;
829  const processor_id_type stride =
830  (input_parallel && !mesh.is_replicated()) ?
831  mesh.n_processors() : 1;
832 
833  for (processor_id_type proc_id = begin_proc_id; proc_id < input_n_procs;
834  proc_id = cast_int<processor_id_type>(proc_id + stride))
835  {
836  auto file_name = split_file(input_name, input_n_procs, proc_id);
837 
838  {
839  std::ifstream in (file_name.c_str());
840 
841  if (!in.good())
842  libmesh_error_msg("ERROR: cannot locate specified file:\n\t" << file_name);
843  }
844 
845  // Do we expect all our files' remote_elem entries to really
846  // be remote? Only if we're not reading multiple input
847  // files on the same processor.
848  const bool expect_all_remote =
849  (input_n_procs <= mesh.n_processors() &&
850  !mesh.is_replicated());
851 
852  Xdr io (file_name, this->binary() ? DECODE : READ);
853 
854  switch (data_size) {
855  case 2:
856  this->read_subfile<uint16_t>(io, expect_all_remote);
857  break;
858  case 4:
859  this->read_subfile<uint32_t>(io, expect_all_remote);
860  break;
861  case 8:
862  this->read_subfile<uint64_t>(io, expect_all_remote);
863  break;
864  default:
865  libmesh_error();
866  }
867 
868  io.close();
869  }
870  }
871 
872  // If the mesh was only read on processor 0 then we need to broadcast it
873  if (mesh.is_replicated())
874  MeshCommunication().broadcast(mesh);
875  // If the mesh is really distributed then we need to make sure it
876  // knows that
877  else if (mesh.n_processors() > 1)
879 }

References binary(), libMesh::MeshCommunication::broadcast(), libMesh::Xdr::close(), libMesh::DECODE, libMesh::MeshBase::is_replicated(), libMesh::libmesh_assert(), libMesh::MeshInput< MT >::mesh(), libMesh::MeshInput< MeshBase >::mesh(), libMesh::MeshBase::n_elem(), libMesh::ParallelObject::n_processors(), libMesh::ParallelObject::processor_id(), libMesh::READ, select_split_config(), and libMesh::MeshBase::set_distributed().

Referenced by libMesh::NameBasedIO::read(), and CheckpointIOTest::testSplitter().

◆ read_bc_names()

template<typename file_id_type >
void libMesh::CheckpointIO::read_bc_names ( Xdr io,
BoundaryInfo info,
bool  is_sideset 
)
private

Read boundary names information (sideset and nodeset)

Definition at line 1398 of file checkpoint_io.C.

1399 {
1400  std::map<boundary_id_type, std::string> & boundary_map = is_sideset ?
1401  info.set_sideset_name_map() : info.set_nodeset_name_map();
1402 
1403  std::vector<file_id_type> boundary_ids;
1404  std::vector<std::string> boundary_names;
1405 
1406  file_id_type n_boundary_names = 0;
1407 
1408  if (is_sideset)
1409  io.data(n_boundary_names, "# sideset id to name map");
1410  else
1411  io.data(n_boundary_names, "# nodeset id to name map");
1412 
1413  if (n_boundary_names)
1414  {
1415  io.data(boundary_ids);
1416  io.data(boundary_names);
1417  }
1418 
1419  // Add them back into the map
1420  for (auto i : index_range(boundary_ids))
1421  boundary_map[cast_int<boundary_id_type>(boundary_ids[i])] =
1422  boundary_names[i];
1423 }

References libMesh::Xdr::data(), libMesh::index_range(), libMesh::BoundaryInfo::set_nodeset_name_map(), and libMesh::BoundaryInfo::set_sideset_name_map().

◆ read_bcs()

template<typename file_id_type >
void libMesh::CheckpointIO::read_bcs ( Xdr io)
private

Read the boundary conditions for a parallel, distributed mesh.

Definition at line 1350 of file checkpoint_io.C.

1351 {
1352  // convenient reference to our mesh
1353  MeshBase & mesh = MeshInput<MeshBase>::mesh();
1354 
1355  // and our boundary info object
1356  BoundaryInfo & boundary_info = mesh.get_boundary_info();
1357 
1358  std::vector<file_id_type> element_id_list;
1359  std::vector<uint16_t> side_list;
1360  std::vector<file_id_type> bc_id_list;
1361 
1362  io.data(element_id_list, "# element ids for bcs");
1363  io.data(side_list, "# sides of elements for bcs");
1364  io.data(bc_id_list, "# bc ids");
1365 
1366  for (auto i : index_range(element_id_list))
1367  boundary_info.add_side
1368  (cast_int<dof_id_type>(element_id_list[i]), side_list[i],
1369  cast_int<boundary_id_type>(bc_id_list[i]));
1370 }

References libMesh::BoundaryInfo::add_side(), libMesh::Xdr::data(), libMesh::MeshBase::get_boundary_info(), libMesh::index_range(), libMesh::MeshInput< MeshBase >::mesh(), and libMesh::MeshInput< MT >::mesh().

◆ read_connectivity()

template<typename file_id_type >
void libMesh::CheckpointIO::read_connectivity ( Xdr io)
private

Read the connectivity for a parallel, distributed mesh.

Definition at line 1118 of file checkpoint_io.C.

1119 {
1120  // convenient reference to our mesh
1121  MeshBase & mesh = MeshInput<MeshBase>::mesh();
1122 
1123  const bool read_extra_integers = this->version_at_least_1_5();
1124 
1125  const unsigned int n_extra_integers =
1126  read_extra_integers ? mesh.n_elem_integers() : 0;
1127 
1128  file_id_type n_elems_here;
1129  io.data(n_elems_here);
1130 
1131  // Keep track of the highest dimensional element we've added to the mesh
1132  unsigned int highest_elem_dim = 1;
1133 
1134  // RHS: Originally we used invalid_processor_id as a "no parent" tag
1135  // number, because I'm an idiot. Let's try to support broken files
1136  // as much as possible.
1137  bool file_is_broken = false;
1138 
1139  for (unsigned int i=0; i<n_elems_here; i++)
1140  {
1141  // id type pid subdomain_id parent_id
1142  std::vector<file_id_type> elem_data(6 + n_extra_integers);
1143  io.data_stream
1144  (elem_data.data(), cast_int<unsigned int>(elem_data.size()),
1145  cast_int<unsigned int>(elem_data.size()));
1146 
1147 #ifdef LIBMESH_ENABLE_UNIQUE_ID
1148  file_id_type unique_id = 0;
1149  io.data(unique_id, "# unique id");
1150 #endif
1151 
1152 #ifdef LIBMESH_ENABLE_AMR
1153  uint16_t p_level = 0;
1154  io.data(p_level, "# p_level");
1155 
1156  uint16_t rflag, pflag;
1157  io.data(rflag, "# rflag");
1158  io.data(pflag, "# pflag");
1159 #endif
1160 
1161  unsigned int n_nodes = Elem::type_to_n_nodes_map[elem_data[1]];
1162 
1163  // Snag the node ids this element was connected to
1164  std::vector<file_id_type> conn_data(n_nodes);
1165  io.data_stream
1166  (conn_data.data(), cast_int<unsigned int>(conn_data.size()),
1167  cast_int<unsigned int>(conn_data.size()));
1168 
1169  const dof_id_type id =
1170  cast_int<dof_id_type> (elem_data[0]);
1171  const ElemType elem_type =
1172  static_cast<ElemType> (elem_data[1]);
1173  const processor_id_type proc_id =
1174  cast_int<processor_id_type>
1175  (elem_data[2] % mesh.n_processors());
1176  const subdomain_id_type subdomain_id =
1177  cast_int<subdomain_id_type>(elem_data[3]);
1178 
1179  // Old broken files used processsor_id_type(-1)...
1180  // But we *know* our first element will be level 0
1181  if (i == 0 && elem_data[4] == 65535)
1182  file_is_broken = true;
1183 
1184  // On a broken file we can't tell whether a parent of 65535 is a
1185  // null parent or an actual parent of 65535. Assuming the
1186  // former will cause less breakage.
1187  Elem * parent =
1188  (elem_data[4] == static_cast<largest_id_type>(-1) ||
1189  (file_is_broken && elem_data[4] == 65535)) ?
1190  nullptr : mesh.elem_ptr(cast_int<dof_id_type>(elem_data[4]));
1191 
1192  const unsigned short int child_num =
1193  (elem_data[5] == static_cast<largest_id_type>(-1) ||
1194  (file_is_broken && elem_data[5] == 65535)) ?
1195  static_cast<unsigned short>(-1) :
1196  cast_int<unsigned short>(elem_data[5]);
1197 
1198  if (!parent)
1199  libmesh_assert_equal_to
1200  (child_num, static_cast<unsigned short>(-1));
1201 
1202  Elem * old_elem = mesh.query_elem_ptr(id);
1203 
1204  // If we already have this element (e.g. from another file,
1205  // when reading multiple distributed CheckpointIO files into
1206  // a ReplicatedMesh) then we don't want to add it again
1207  // (because ReplicatedMesh can't handle that) but we do want
1208  // to assert consistency between what we're reading and what
1209  // we have.
1210  if (old_elem)
1211  {
1212  libmesh_assert_equal_to(elem_type, old_elem->type());
1213  libmesh_assert_equal_to(proc_id, old_elem->processor_id());
1214  libmesh_assert_equal_to(subdomain_id, old_elem->subdomain_id());
1215  if (parent)
1216  libmesh_assert_equal_to(parent, old_elem->parent());
1217  else
1218  libmesh_assert(!old_elem->parent());
1219 
1220  libmesh_assert_equal_to(n_extra_integers, old_elem->n_extra_integers());
1221 #ifndef NDEBUG
1222  for (unsigned int ei=0; ei != n_extra_integers; ++ei)
1223  {
1224  const dof_id_type extra_int = cast_int<dof_id_type>(elem_data[6+ei]);
1225  libmesh_assert_equal_to(extra_int, old_elem->get_extra_integer(ei));
1226  }
1227 #endif
1228 
1229  libmesh_assert_equal_to(old_elem->n_nodes(), conn_data.size());
1230 
1231  for (unsigned int n=0,
1232  n_conn = cast_int<unsigned int>(conn_data.size());
1233  n != n_conn; n++)
1234  libmesh_assert_equal_to
1235  (old_elem->node_id(n),
1236  cast_int<dof_id_type>(conn_data[n]));
1237  }
1238  else
1239  {
1240  // Create the element
1241  Elem * elem = Elem::build(elem_type, parent).release();
1242 
1243 #ifdef LIBMESH_ENABLE_UNIQUE_ID
1244  elem->set_unique_id() = unique_id;
1245 #endif
1246 
1247  if (elem->dim() > highest_elem_dim)
1248  highest_elem_dim = elem->dim();
1249 
1250  elem->set_id() = id;
1251  elem->processor_id() = proc_id;
1252  elem->subdomain_id() = subdomain_id;
1253 
1254 #ifdef LIBMESH_ENABLE_AMR
1255  elem->hack_p_level(p_level);
1256 
1257  elem->set_refinement_flag (cast_int<Elem::RefinementState>(rflag));
1258  elem->set_p_refinement_flag(cast_int<Elem::RefinementState>(pflag));
1259 
1260  // Set parent connections
1261  if (parent)
1262  {
1263  // We must specify a child_num, because we will have
1264  // skipped adding any preceding remote_elem children
1265  parent->add_child(elem, child_num);
1266  }
1267 #else
1268  libmesh_ignore(child_num);
1269 #endif
1270 
1271  libmesh_assert(elem->n_nodes() == conn_data.size());
1272 
1273  // Connect all the nodes to this element
1274  for (unsigned int n=0,
1275  n_conn = cast_int<unsigned int>(conn_data.size());
1276  n != n_conn; n++)
1277  elem->set_node(n) =
1278  mesh.node_ptr(cast_int<dof_id_type>(conn_data[n]));
1279 
1280  mesh.add_elem(elem);
1281 
1282  libmesh_assert_equal_to(n_extra_integers, elem->n_extra_integers());
1283  for (unsigned int ei=0; ei != n_extra_integers; ++ei)
1284  {
1285  const dof_id_type extra_int = cast_int<dof_id_type>(elem_data[6+ei]);
1286  elem->set_extra_integer(ei, extra_int);
1287  }
1288  }
1289  }
1290 
1291  mesh.set_mesh_dimension(cast_int<unsigned char>(highest_elem_dim));
1292 }

References libMesh::Elem::add_child(), libMesh::MeshBase::add_elem(), libMesh::Elem::build(), libMesh::Xdr::data(), libMesh::Xdr::data_stream(), libMesh::Elem::dim(), libMesh::MeshBase::elem_ptr(), libMesh::DofObject::get_extra_integer(), libMesh::Elem::hack_p_level(), libMesh::libmesh_assert(), libMesh::libmesh_ignore(), libMesh::MeshInput< MeshBase >::mesh(), libMesh::MeshInput< MT >::mesh(), libMesh::MeshBase::n_elem_integers(), libMesh::DofObject::n_extra_integers(), n_nodes, libMesh::Elem::n_nodes(), libMesh::ParallelObject::n_processors(), libMesh::Elem::node_id(), libMesh::MeshBase::node_ptr(), libMesh::Elem::parent(), libMesh::DofObject::processor_id(), libMesh::MeshBase::query_elem_ptr(), libMesh::DofObject::set_extra_integer(), libMesh::DofObject::set_id(), libMesh::MeshBase::set_mesh_dimension(), libMesh::Elem::set_node(), libMesh::Elem::set_p_refinement_flag(), libMesh::Elem::set_refinement_flag(), libMesh::DofObject::set_unique_id(), libMesh::Elem::subdomain_id(), libMesh::Elem::type(), libMesh::Elem::type_to_n_nodes_map, and version_at_least_1_5().

◆ read_header()

template<typename file_id_type >
file_id_type libMesh::CheckpointIO::read_header ( const std::string &  name)
private

Read header data on processor 0, then broadcast.

Returns the number of processors for which parallel non-header files have been written, or 0 if files were written in serial.

Definition at line 884 of file checkpoint_io.C.

885 {
886  MeshBase & mesh = MeshInput<MeshBase>::mesh();
887 
888  // Hack for codes which don't look at all elem dimensions
889  uint16_t mesh_dimension;
890 
891  // Will this be a parallel input file? With how many processors? Stay tuned!
892  uint16_t input_parallel;
893  file_id_type input_n_procs;
894 
895  std::vector<std::string> node_integer_names, elem_integer_names;
896 
897  // We'll write a header file from processor 0 and broadcast.
898  if (this->processor_id() == 0)
899  {
900  Xdr io (name, this->binary() ? DECODE : READ);
901 
902  // read the version, but don't care about it
903  std::string input_version;
904  io.data(input_version);
905 
906  // read the data type, don't care about it this time
907  header_id_type data_size;
908  io.data (data_size);
909 
910  // read the dimension
911  io.data (mesh_dimension);
912 
913  // Read whether or not this is a parallel file
914  io.data(input_parallel);
915 
916  // With how many processors?
917  if (input_parallel)
918  io.data(input_n_procs);
919 
920  // read subdomain names
921  this->read_subdomain_names<file_id_type>(io);
922 
923  // read boundary names
924  BoundaryInfo & boundary_info = mesh.get_boundary_info();
925 
926  this->read_bc_names<file_id_type>(io, boundary_info, true); // sideset names
927  this->read_bc_names<file_id_type>(io, boundary_info, false); // nodeset names
928 
929  // read extra integer names?
930  std::swap(input_version, this->version());
931  const bool read_extra_integers = this->version_at_least_1_5();
932  std::swap(input_version, this->version());
933 
934  if (read_extra_integers)
935  this->read_integers_names<file_id_type>
936  (io, node_integer_names, elem_integer_names);
937  }
938 
939  // broadcast data from processor 0, set values everywhere
940  this->comm().broadcast(mesh_dimension);
941  mesh.set_mesh_dimension(cast_int<unsigned char>(mesh_dimension));
942 
943  this->comm().broadcast(input_parallel);
944 
945  if (input_parallel)
946  this->comm().broadcast(input_n_procs);
947  else
948  input_n_procs = 1;
949 
950  std::map<subdomain_id_type, std::string> & subdomain_map =
952  this->comm().broadcast(subdomain_map);
953 
954  BoundaryInfo & boundary_info = mesh.get_boundary_info();
955  this->comm().broadcast(boundary_info.set_sideset_name_map());
956  this->comm().broadcast(boundary_info.set_nodeset_name_map());
957 
958  this->comm().broadcast(node_integer_names);
959  this->comm().broadcast(elem_integer_names);
960 
961  for (auto & int_name : node_integer_names)
962  mesh.add_node_integer(int_name);
963 
964  for (auto & int_name : elem_integer_names)
965  mesh.add_elem_integer(int_name);
966 
967  return input_parallel ? input_n_procs : 0;
968 }

References libMesh::MeshBase::add_elem_integer(), libMesh::MeshBase::add_node_integer(), binary(), libMesh::ParallelObject::comm(), libMesh::Xdr::data(), libMesh::DECODE, libMesh::MeshBase::get_boundary_info(), libMesh::MeshInput< MeshBase >::mesh(), libMesh::MeshInput< MT >::mesh(), libMesh::Quality::name(), libMesh::ParallelObject::processor_id(), libMesh::READ, libMesh::MeshBase::set_mesh_dimension(), libMesh::BoundaryInfo::set_nodeset_name_map(), libMesh::BoundaryInfo::set_sideset_name_map(), libMesh::MeshBase::set_subdomain_name_map(), swap(), version(), and version_at_least_1_5().

◆ read_integers_names()

template<typename file_id_type >
void libMesh::CheckpointIO::read_integers_names ( Xdr io,
std::vector< std::string > &  node_integer_names,
std::vector< std::string > &  elem_integer_names 
)
private

Read extra integers names information.

Definition at line 1428 of file checkpoint_io.C.

1431 {
1432  file_id_type n_node_integers, n_elem_integers;
1433 
1434  io.data(n_node_integers, "# n_extra_integers per node");
1435  io.data(node_integer_names);
1436  io.data(n_elem_integers, "# n_extra_integers per elem");
1437  io.data(elem_integer_names);
1438 }

References libMesh::Xdr::data().

◆ read_nodes()

template<typename file_id_type >
void libMesh::CheckpointIO::read_nodes ( Xdr io)
private

Read the nodal locations for a parallel, distributed mesh.

Definition at line 1024 of file checkpoint_io.C.

1025 {
1026  // convenient reference to our mesh
1027  MeshBase & mesh = MeshInput<MeshBase>::mesh();
1028 
1029  file_id_type n_nodes_here;
1030  io.data(n_nodes_here, "# n_nodes on proc");
1031 
1032  const bool read_extra_integers = this->version_at_least_1_5();
1033 
1034  const unsigned int n_extra_integers =
1035  read_extra_integers ? mesh.n_node_integers() : 0;
1036 
1037  // Will hold the node id and pid and extra integers
1038  std::vector<file_id_type> id_pid(2 + n_extra_integers);
1039 
1040  // For the coordinates
1041  std::vector<Real> coords(LIBMESH_DIM);
1042 
1043  for (unsigned int i=0; i<n_nodes_here; i++)
1044  {
1045  io.data_stream(id_pid.data(), 2 + n_extra_integers, 2 + n_extra_integers);
1046 
1047 #ifdef LIBMESH_ENABLE_UNIQUE_ID
1048  file_id_type unique_id = 0;
1049  io.data(unique_id, "# unique id");
1050 #endif
1051 
1052  io.data_stream(coords.data(), LIBMESH_DIM, LIBMESH_DIM);
1053 
1054  Point p;
1055  p(0) = coords[0];
1056 
1057 #if LIBMESH_DIM > 1
1058  p(1) = coords[1];
1059 #endif
1060 
1061 #if LIBMESH_DIM > 2
1062  p(2) = coords[2];
1063 #endif
1064 
1065  const dof_id_type id = cast_int<dof_id_type>(id_pid[0]);
1066 
1067  // "Wrap around" if we see more processors than we're using.
1068  processor_id_type pid =
1069  cast_int<processor_id_type>(id_pid[1] % mesh.n_processors());
1070 
1071  // If we already have this node (e.g. from another file, when
1072  // reading multiple distributed CheckpointIO files into a
1073  // ReplicatedMesh) then we don't want to add it again (because
1074  // ReplicatedMesh can't handle that) but we do want to assert
1075  // consistency between what we're reading and what we have.
1076  const Node * old_node = mesh.query_node_ptr(id);
1077 
1078  if (old_node)
1079  {
1080  libmesh_assert_equal_to(pid, old_node->processor_id());
1081 
1082  libmesh_assert_equal_to(n_extra_integers, old_node->n_extra_integers());
1083 #ifndef NDEBUG
1084  for (unsigned int ei=0; ei != n_extra_integers; ++ei)
1085  {
1086  const dof_id_type extra_int = cast_int<dof_id_type>(id_pid[2+ei]);
1087  libmesh_assert_equal_to(extra_int, old_node->get_extra_integer(ei));
1088  }
1089 #endif
1090 
1091 #ifdef LIBMESH_ENABLE_UNIQUE_ID
1092  libmesh_assert_equal_to(unique_id, old_node->unique_id());
1093 #endif
1094  }
1095  else
1096  {
1097  Node * node =
1098  mesh.add_point(p, id, pid);
1099 
1100 #ifdef LIBMESH_ENABLE_UNIQUE_ID
1101  node->set_unique_id() = unique_id;
1102 #endif
1103 
1104  libmesh_assert_equal_to(n_extra_integers, node->n_extra_integers());
1105 
1106  for (unsigned int ei=0; ei != n_extra_integers; ++ei)
1107  {
1108  const dof_id_type extra_int = cast_int<dof_id_type>(id_pid[2+ei]);
1109  node->set_extra_integer(ei, extra_int);
1110  }
1111  }
1112  }
1113 }

References libMesh::MeshBase::add_point(), libMesh::Xdr::data(), libMesh::Xdr::data_stream(), libMesh::MeshInput< MT >::mesh(), libMesh::MeshInput< MeshBase >::mesh(), libMesh::DofObject::n_extra_integers(), libMesh::MeshBase::n_node_integers(), libMesh::ParallelObject::n_processors(), libMesh::MeshBase::query_node_ptr(), libMesh::DofObject::set_extra_integer(), libMesh::DofObject::set_unique_id(), and version_at_least_1_5().

◆ read_nodesets()

template<typename file_id_type >
void libMesh::CheckpointIO::read_nodesets ( Xdr io)
private

Read the nodeset conditions for a parallel, distributed mesh.

Definition at line 1375 of file checkpoint_io.C.

1376 {
1377  // convenient reference to our mesh
1378  MeshBase & mesh = MeshInput<MeshBase>::mesh();
1379 
1380  // and our boundary info object
1381  BoundaryInfo & boundary_info = mesh.get_boundary_info();
1382 
1383  std::vector<file_id_type> node_id_list;
1384  std::vector<file_id_type> bc_id_list;
1385 
1386  io.data(node_id_list, "# node id list");
1387  io.data(bc_id_list, "# nodeset bc id list");
1388 
1389  for (auto i : index_range(node_id_list))
1390  boundary_info.add_node
1391  (cast_int<dof_id_type>(node_id_list[i]),
1392  cast_int<boundary_id_type>(bc_id_list[i]));
1393 }

References libMesh::BoundaryInfo::add_node(), libMesh::Xdr::data(), libMesh::MeshBase::get_boundary_info(), libMesh::index_range(), libMesh::MeshInput< MeshBase >::mesh(), and libMesh::MeshInput< MT >::mesh().

◆ read_remote_elem() [1/2]

template<typename file_id_type >
void libMesh::CheckpointIO::read_remote_elem ( Xdr io,
bool  expect_all_remote 
)
private

Read the remote_elem neighbor and child links for a parallel, distributed mesh.

If we expect all these remote_elem links to truly be remote, because we aren't doing an N -> M restart with M < N, then we set expect_all_remote to true and test more assertions.

◆ read_remote_elem() [2/2]

template<typename file_id_type >
void libMesh::CheckpointIO::read_remote_elem ( Xdr io,
bool   libmesh_dbg_varexpect_all_remote 
)
private

Definition at line 1296 of file checkpoint_io.C.

1297 {
1298  // convenient reference to our mesh
1299  MeshBase & mesh = MeshInput<MeshBase>::mesh();
1300 
1301  // Find the remote_elem neighbor links
1302  std::vector<file_id_type> elem_ids;
1303  std::vector<uint16_t> elem_sides;
1304 
1305  io.data(elem_ids, "# remote neighbor elem_ids");
1306  io.data(elem_sides, "# remote neighbor elem_sides");
1307 
1308  libmesh_assert_equal_to(elem_ids.size(), elem_sides.size());
1309 
1310  for (auto i : index_range(elem_ids))
1311  {
1312  Elem & elem = mesh.elem_ref(cast_int<dof_id_type>(elem_ids[i]));
1313  if (!elem.neighbor_ptr(elem_sides[i]))
1314  elem.set_neighbor(elem_sides[i],
1315  const_cast<RemoteElem *>(remote_elem));
1316  else
1317  libmesh_assert(!expect_all_remote);
1318  }
1319 
1320  // Find the remote_elem children links
1321  std::vector<file_id_type> parent_ids;
1322  std::vector<uint16_t> child_numbers;
1323 
1324  io.data(parent_ids, "# remote child parent_ids");
1325  io.data(child_numbers, "# remote child_numbers");
1326 
1327 #ifdef LIBMESH_ENABLE_AMR
1328  for (auto i : index_range(parent_ids))
1329  {
1330  Elem & elem = mesh.elem_ref(cast_int<dof_id_type>(parent_ids[i]));
1331 
1332  // We'd like to assert that no child pointer already exists to
1333  // be overwritten by remote_elem, but Elem doesn't actually have
1334  // an API that will return a child pointer without asserting
1335  // that it isn't nullptr.
1336  const Elem * child = elem.raw_child_ptr(child_numbers[i]);
1337 
1338  if (!child)
1339  elem.add_child(const_cast<RemoteElem *>(remote_elem),
1340  child_numbers[i]);
1341  else
1342  libmesh_assert(!expect_all_remote);
1343  }
1344 #endif
1345 }

References libMesh::Elem::add_child(), libMesh::Xdr::data(), libMesh::MeshBase::elem_ref(), libMesh::index_range(), libMesh::libmesh_assert(), libMesh::MeshInput< MT >::mesh(), libMesh::MeshInput< MeshBase >::mesh(), libMesh::Elem::neighbor_ptr(), libMesh::Elem::raw_child_ptr(), libMesh::remote_elem, and libMesh::Elem::set_neighbor().

◆ read_subdomain_names()

template<typename file_id_type >
void libMesh::CheckpointIO::read_subdomain_names ( Xdr io)
private

Read subdomain name information.

Definition at line 994 of file checkpoint_io.C.

995 {
996  MeshBase & mesh = MeshInput<MeshBase>::mesh();
997 
998  std::map<subdomain_id_type, std::string> & subdomain_map =
1000 
1001  std::vector<file_id_type> subdomain_ids;
1002  subdomain_ids.reserve(subdomain_map.size());
1003 
1004  std::vector<std::string> subdomain_names;
1005  subdomain_names.reserve(subdomain_map.size());
1006 
1007  file_id_type n_subdomain_names = 0;
1008  io.data(n_subdomain_names, "# subdomain id to name map");
1009 
1010  if (n_subdomain_names)
1011  {
1012  io.data(subdomain_ids);
1013  io.data(subdomain_names);
1014 
1015  for (auto i : index_range(subdomain_ids))
1016  subdomain_map[cast_int<subdomain_id_type>(subdomain_ids[i])] =
1017  subdomain_names[i];
1018  }
1019 }

References libMesh::Xdr::data(), libMesh::index_range(), libMesh::MeshInput< MT >::mesh(), libMesh::MeshInput< MeshBase >::mesh(), and libMesh::MeshBase::set_subdomain_name_map().

◆ read_subfile()

template<typename file_id_type >
void libMesh::CheckpointIO::read_subfile ( Xdr io,
bool  expect_all_remote 
)
private

Read a non-header file.

Definition at line 973 of file checkpoint_io.C.

974 {
975  // read the nodal locations
976  this->read_nodes<file_id_type> (io);
977 
978  // read connectivity
979  this->read_connectivity<file_id_type> (io);
980 
981  // read remote_elem connectivity
982  this->read_remote_elem<file_id_type> (io, expect_all_remote);
983 
984  // read the boundary conditions
985  this->read_bcs<file_id_type> (io);
986 
987  // read the nodesets
988  this->read_nodesets<file_id_type> (io);
989 }

◆ select_split_config()

processor_id_type libMesh::CheckpointIO::select_split_config ( const std::string &  input_name,
header_id_type data_size 
)
private

Definition at line 186 of file checkpoint_io.C.

187 {
188  std::string header_name;
189 
190  // We'll read a header file from processor 0 and broadcast.
191  if (this->processor_id() == 0)
192  {
193  header_name = header_file(input_name, _my_n_processors);
194 
195  {
196  // look for header+splits with nprocs equal to _my_n_processors
197  std::ifstream in (header_name.c_str());
198  if (!in.good())
199  {
200  // otherwise fall back to a serial/single-split mesh
201  auto orig_header_name = header_name;
202  header_name = header_file(input_name, 1);
203  std::ifstream in2 (header_name.c_str());
204  if (!in2.good())
205  {
206  libmesh_error_msg("ERROR: Neither one of the following files can be located:\n\t'"
207  << orig_header_name << "' nor\n\t'" << input_name << "'\n"
208  << "If you are running a parallel job, double check that you've "
209  << "created a split for " << _my_n_processors << " ranks.\n"
210  << "Note: One of paths above may refer to a valid directory on your "
211  << "system, however we are attempting to read a valid header file.");
212  }
213  }
214  }
215 
216  Xdr io (header_name, this->binary() ? DECODE : READ);
217 
218  // read the version, but don't care about it
219  std::string input_version;
220  io.data(input_version);
221 
222  // read the data type
223  io.data (data_size);
224  }
225 
226  this->comm().broadcast(data_size);
227  this->comm().broadcast(header_name);
228 
229  // How many per-processor files are here?
230  largest_id_type input_n_procs;
231 
232  switch (data_size) {
233  case 2:
234  input_n_procs = this->read_header<uint16_t>(header_name);
235  break;
236  case 4:
237  input_n_procs = this->read_header<uint32_t>(header_name);
238  break;
239  case 8:
240  input_n_procs = this->read_header<uint64_t>(header_name);
241  break;
242  default:
243  libmesh_error();
244  }
245 
246  if (!input_n_procs)
247  input_n_procs = 1;
248  return cast_int<processor_id_type>(input_n_procs);
249 }

References _my_n_processors, binary(), libMesh::ParallelObject::comm(), libMesh::Xdr::data(), libMesh::DECODE, libMesh::ParallelObject::processor_id(), and libMesh::READ.

Referenced by read().

◆ set_n_partitions()

void libMesh::MeshInput< MeshBase >::set_n_partitions ( unsigned int  n_parts)
inlineprotectedinherited

Sets the number of partitions in the mesh.

Typically this gets done by the partitioner, but some parallel file formats begin "pre-partitioned".

Definition at line 91 of file mesh_input.h.

91 { this->mesh().set_n_partitions() = n_parts; }

◆ skip_comment_lines()

void libMesh::MeshInput< MeshBase >::skip_comment_lines ( std::istream &  in,
const char  comment_start 
)
protectedinherited

Reads input from in, skipping all the lines that start with the character comment_start.

Definition at line 179 of file mesh_input.h.

181 {
182  char c, line[256];
183 
184  while (in.get(c), c==comment_start)
185  in.getline (line, 255);
186 
187  // put back first character of
188  // first non-comment line
189  in.putback (c);
190 }

◆ version() [1/2]

std::string& libMesh::CheckpointIO::version ( )
inline

Definition at line 158 of file checkpoint_io.h.

158 { return _version; }

References _version.

◆ version() [2/2]

const std::string& libMesh::CheckpointIO::version ( ) const
inline

Get/Set the version string.

Definition at line 157 of file checkpoint_io.h.

157 { return _version; }

References _version.

Referenced by read_header(), and version_at_least_1_5().

◆ version_at_least_1_5()

bool libMesh::CheckpointIO::version_at_least_1_5 ( ) const
Returns
true if the current file has an XDR/XDA version that matches or exceeds 1.5

As of this version we encode any extra integer data that has been attached to a mesh.

Definition at line 277 of file checkpoint_io.C.

278 {
279  return (this->version().find("1.5") != std::string::npos);
280 }

References version().

Referenced by read_connectivity(), read_header(), read_nodes(), write(), write_connectivity(), and write_nodes().

◆ write()

void libMesh::CheckpointIO::write ( const std::string &  name)
overridevirtual

This method implements writing a mesh to a specified file.

If the mesh has been split for running on several processors, this will create a subdirectory named "[name]-split[n]" where name is the given name argument and n is the number of processors the mesh is split for running on. For example:

unsigned int n_splits = 42;
std::unique_ptr<CheckpointIO> cp = split_mesh(my_mesh, n_splits);
// ...
cp->write("foo.cpr");

would create a directory named "foo.cpr-split42".

Implements libMesh::MeshOutput< MeshBase >.

Definition at line 283 of file checkpoint_io.C.

284 {
285  LOG_SCOPE("write()", "CheckpointIO");
286 
287  // convenient reference to our mesh
288  const MeshBase & mesh = MeshOutput<MeshBase>::mesh();
289 
290  // FIXME: For backwards compatibility, we'll assume for now that we
291  // only want to write distributed meshes in parallel. Later we can
292  // do a gather_to_zero() and support that case too.
294 
295  processor_id_type use_n_procs = 1;
296  if (_parallel)
297  use_n_procs = _my_n_processors;
298 
299  std::string header_file_name = header_file(name, use_n_procs);
300  make_dir(name, use_n_procs);
301 
302  // We'll write a header file from processor 0 to make it easier to do unambiguous
303  // restarts later:
304  if (this->processor_id() == 0)
305  {
306  Xdr io (header_file_name, this->binary() ? ENCODE : WRITE);
307 
308  // write the version
309  io.data(_version, "# version");
310 
311  // write what kind of data type we're using
312  header_id_type data_size = sizeof(largest_id_type);
313  io.data(data_size, "# integer size");
314 
315  // Write out the max mesh dimension for backwards compatibility
316  // with code that sets it independently of element dimensions
317  {
318  uint16_t mesh_dimension = cast_int<uint16_t>(mesh.mesh_dimension());
319  io.data(mesh_dimension, "# dimensions");
320  }
321 
322  // Write out whether or not this is serial output
323  {
324  uint16_t parallel = _parallel;
325  io.data(parallel, "# parallel");
326  }
327 
328  // If we're writing out a parallel mesh then we need to write the number of processors
329  // so we can check it upon reading the file
330  if (_parallel)
331  {
333  io.data(n_procs, "# n_procs");
334  }
335 
336  // write subdomain names
337  this->write_subdomain_names(io);
338 
339  // write boundary id names
340  const BoundaryInfo & boundary_info = mesh.get_boundary_info();
341  write_bc_names(io, boundary_info, true); // sideset names
342  write_bc_names(io, boundary_info, false); // nodeset names
343 
344  // write extra integer names
345  const bool write_extra_integers = this->version_at_least_1_5();
346 
347  if (write_extra_integers)
348  {
349  largest_id_type n_node_integers = mesh.n_node_integers();
350  io.data(n_node_integers, "# n_extra_integers per node");
351 
352  std::vector<std::string> node_integer_names;
353  for (unsigned int i=0; i != n_node_integers; ++i)
354  node_integer_names.push_back(mesh.get_node_integer_name(i));
355 
356  io.data(node_integer_names);
357 
358  largest_id_type n_elem_integers = mesh.n_elem_integers();
359  io.data(n_elem_integers, "# n_extra_integers per elem");
360 
361  std::vector<std::string> elem_integer_names;
362  for (unsigned int i=0; i != n_elem_integers; ++i)
363  elem_integer_names.push_back(mesh.get_elem_integer_name(i));
364 
365  io.data(elem_integer_names);
366  }
367 
368 
369  }
370 
371  // If this is a serial mesh written to a serial file then we're only
372  // going to write local data from processor 0. If this is a mesh being
373  // written in parallel then we're going to write from every
374  // processor.
375  std::vector<processor_id_type> ids_to_write;
376 
377  // We're going to sort elements by pid in one pass, to avoid sending
378  // predicated iterators through the whole mesh N_p times
379  std::unordered_map<processor_id_type, std::vector<Elem *>> elements_on_pid;
380 
381  if (_parallel)
382  {
383  ids_to_write = _my_processor_ids;
384  for (processor_id_type p : ids_to_write)
385  elements_on_pid[p].clear();
386  auto eop_end = elements_on_pid.end();
387  for (auto & elem : mesh.element_ptr_range())
388  {
389  const processor_id_type p = elem->processor_id();
390  auto eop_it = elements_on_pid.find(p);
391  if (eop_it != eop_end)
392  eop_it->second.push_back(elem);
393  }
394  }
395  else if (mesh.is_serial())
396  {
397  if (mesh.processor_id() == 0)
398  {
399  // placeholder
400  ids_to_write.push_back(0);
401  }
402  }
403  else
404  {
405  libmesh_error_msg("Cannot write serial checkpoint from distributed mesh");
406  }
407 
408  // Call build_side_list() and build_node_list() just *once* to avoid
409  // redundant expensive sorts during mesh splitting.
410  const BoundaryInfo & boundary_info = mesh.get_boundary_info();
411  std::vector<std::tuple<dof_id_type, unsigned short int, boundary_id_type>>
412  bc_triples = boundary_info.build_side_list();
413  std::vector<std::tuple<dof_id_type, boundary_id_type>>
414  bc_tuples = boundary_info.build_node_list();
415 
416  for (const auto & my_pid : ids_to_write)
417  {
418  auto file_name = split_file(name, use_n_procs, my_pid);
419  Xdr io (file_name, this->binary() ? ENCODE : WRITE);
420 
421  std::set<const Elem *, CompareElemIdsByLevel> elements;
422 
423  // For serial files or for already-distributed meshs, we write
424  // everything we can see.
425  if (!_parallel || !mesh.is_serial())
426  elements.insert(mesh.elements_begin(), mesh.elements_end());
427  // For parallel files written from serial meshes we write what
428  // we'd be required to keep if we were to be deleting remote
429  // elements. This allows us to write proper parallel files even
430  // from a ReplicateMesh.
431  //
432  // WARNING: If we have a DistributedMesh which used
433  // "add_extra_ghost_elem" rather than ghosting functors to
434  // preserve elements and which is *also* currently serialized
435  // then we're not preserving those elements here. As a quick
436  // workaround user code should delete_remote_elements() before
437  // writing the checkpoint; as a long term workaround user code
438  // should use ghosting functors instead of extra_ghost_elem
439  // lists.
440  else
441  {
443  {
444  const auto elements_vec_it = elements_on_pid.find(p);
445  if (elements_vec_it != elements_on_pid.end())
446  {
447  const auto & p_elements = elements_vec_it->second;
448  Elem * const * elempp = p_elements.data();
449  Elem * const * elemend = elempp + p_elements.size();
450 
451  const MeshBase::const_element_iterator
452  pid_elements_begin = MeshBase::const_element_iterator
453  (elempp, elemend, Predicates::NotNull<Elem * const *>()),
454  pid_elements_end = MeshBase::const_element_iterator
455  (elemend, elemend, Predicates::NotNull<Elem * const *>()),
456  active_pid_elements_begin = MeshBase::const_element_iterator
457  (elempp, elemend, Predicates::Active<Elem * const *>()),
458  active_pid_elements_end = MeshBase::const_element_iterator
459  (elemend, elemend, Predicates::Active<Elem * const *>());
460 
462  (mesh, p, active_pid_elements_begin,
463  active_pid_elements_end, elements);
464  connect_children(mesh, pid_elements_begin,
465  pid_elements_end, elements);
466  }
467  connect_families(elements);
468  }
469  }
470 
471  std::set<const Node *> connected_nodes;
472  reconnect_nodes(elements, connected_nodes);
473 
474  // write the nodal locations
475  this->write_nodes (io, connected_nodes);
476 
477  // write connectivity
478  this->write_connectivity (io, elements);
479 
480  // write remote_elem connectivity
481  this->write_remote_elem (io, elements);
482 
483  // write the boundary condition information
484  this->write_bcs (io, elements, bc_triples);
485 
486  // write the nodeset information
487  this->write_nodesets (io, connected_nodes, bc_tuples);
488 
489  // close it up
490  io.close();
491  }
492 
493  // this->comm().barrier();
494 }

References _my_n_processors, _my_processor_ids, _parallel, _version, binary(), libMesh::BoundaryInfo::build_node_list(), libMesh::BoundaryInfo::build_side_list(), libMesh::Xdr::close(), libMesh::connect_children(), libMesh::connect_families(), libMesh::Xdr::data(), libMesh::MeshBase::element_ptr_range(), libMesh::MeshBase::elements_begin(), libMesh::MeshBase::elements_end(), libMesh::ENCODE, libMesh::MeshBase::get_boundary_info(), libMesh::MeshBase::get_elem_integer_name(), libMesh::MeshBase::get_node_integer_name(), libMesh::DofObject::invalid_processor_id, libMesh::MeshBase::is_serial(), libMesh::MeshInput< MeshBase >::mesh(), libMesh::MeshOutput< MT >::mesh(), libMesh::MeshBase::mesh_dimension(), libMesh::MeshBase::n_elem_integers(), libMesh::MeshBase::n_node_integers(), libMesh::Quality::name(), parallel(), libMesh::ParallelObject::processor_id(), libMesh::query_ghosting_functors(), libMesh::reconnect_nodes(), version_at_least_1_5(), libMesh::WRITE, write_bc_names(), write_bcs(), write_connectivity(), write_nodes(), write_nodesets(), write_remote_elem(), and write_subdomain_names().

Referenced by CheckpointIOTest::testSplitter(), and libMesh::NameBasedIO::write().

◆ write_bc_names()

void libMesh::CheckpointIO::write_bc_names ( Xdr io,
const BoundaryInfo info,
bool  is_sideset 
) const
private

Write boundary names information (sideset and nodeset)

Definition at line 772 of file checkpoint_io.C.

773 {
774  const std::map<boundary_id_type, std::string> & boundary_map = is_sideset ?
775  info.get_sideset_name_map() : info.get_nodeset_name_map();
776 
777  std::vector<largest_id_type> boundary_ids; boundary_ids.reserve(boundary_map.size());
778  std::vector<std::string> boundary_names; boundary_names.reserve(boundary_map.size());
779 
780  // We need to loop over the map and make sure that there aren't any invalid entries. Since we
781  // return writable references in boundary_info, it's possible for the user to leave some entity names
782  // blank. We can't write those to the XDA file.
783  largest_id_type n_boundary_names = 0;
784  for (const auto & pr : boundary_map)
785  if (!pr.second.empty())
786  {
787  n_boundary_names++;
788  boundary_ids.push_back(pr.first);
789  boundary_names.push_back(pr.second);
790  }
791 
792  if (is_sideset)
793  io.data(n_boundary_names, "# sideset id to name map");
794  else
795  io.data(n_boundary_names, "# nodeset id to name map");
796  // Write out the ids and names in two vectors
797  if (n_boundary_names)
798  {
799  io.data(boundary_ids);
800  io.data(boundary_names);
801  }
802 }

References libMesh::Xdr::data(), libMesh::BoundaryInfo::get_nodeset_name_map(), and libMesh::BoundaryInfo::get_sideset_name_map().

Referenced by write().

◆ write_bcs()

void libMesh::CheckpointIO::write_bcs ( Xdr io,
const std::set< const Elem *, CompareElemIdsByLevel > &  elements,
const std::vector< std::tuple< dof_id_type, unsigned short int, boundary_id_type >> &  bc_triples 
) const
private

Write the side boundary conditions for part of a mesh.

Definition at line 704 of file checkpoint_io.C.

707 {
708  libmesh_assert (io.writing());
709 
710  // Build a list of (elem, side, bc) tuples.
711  std::size_t bc_size = bc_triples.size();
712 
713  std::vector<largest_id_type> element_id_list;
714  std::vector<uint16_t> side_list;
715  std::vector<largest_id_type> bc_id_list;
716 
717  element_id_list.reserve(bc_size);
718  side_list.reserve(bc_size);
719  bc_id_list.reserve(bc_size);
720 
721  std::unordered_set<dof_id_type> elems;
722  for (auto & e : elements)
723  elems.insert(e->id());
724 
725  for (const auto & t : bc_triples)
726  if (elems.count(std::get<0>(t)))
727  {
728  element_id_list.push_back(std::get<0>(t));
729  side_list.push_back(std::get<1>(t));
730  bc_id_list.push_back(std::get<2>(t));
731  }
732 
733 
734  io.data(element_id_list, "# element ids for bcs");
735  io.data(side_list, "# sides of elements for bcs");
736  io.data(bc_id_list, "# bc ids");
737 }

References libMesh::Xdr::data(), libMesh::libmesh_assert(), and libMesh::Xdr::writing().

Referenced by write().

◆ write_connectivity()

void libMesh::CheckpointIO::write_connectivity ( Xdr io,
const std::set< const Elem *, CompareElemIdsByLevel > &  elements 
) const
private

Write the connectivity for part of a mesh.

Definition at line 580 of file checkpoint_io.C.

582 {
583  libmesh_assert (io.writing());
584 
585  const bool write_extra_integers = this->version_at_least_1_5();
586  const unsigned int n_extra_integers =
587  write_extra_integers ? MeshOutput<MeshBase>::mesh().n_elem_integers() : 0;
588 
589  // Put these out here to reduce memory churn
590  // id type pid subdomain_id parent_id extra_integer_0 ...
591  std::vector<largest_id_type> elem_data(6 + n_extra_integers);
592  std::vector<largest_id_type> conn_data;
593 
594  largest_id_type n_elems_here = elements.size();
595 
596  io.data(n_elems_here, "# number of elements");
597 
598  for (const auto & elem : elements)
599  {
600  unsigned int n_nodes = elem->n_nodes();
601 
602  elem_data[0] = elem->id();
603  elem_data[1] = elem->type();
604  elem_data[2] = elem->processor_id();
605  elem_data[3] = elem->subdomain_id();
606 
607 #ifdef LIBMESH_ENABLE_AMR
608  if (elem->parent() != nullptr)
609  {
610  elem_data[4] = elem->parent()->id();
611  elem_data[5] = elem->parent()->which_child_am_i(elem);
612  }
613  else
614 #endif
615  {
616  elem_data[4] = static_cast<largest_id_type>(-1);
617  elem_data[5] = static_cast<largest_id_type>(-1);
618  }
619 
620  for (unsigned int i=0; i != n_extra_integers; ++i)
621  elem_data[6+i] = elem->get_extra_integer(i);
622 
623  conn_data.resize(n_nodes);
624 
625  for (unsigned int i=0; i<n_nodes; i++)
626  conn_data[i] = elem->node_id(i);
627 
628  io.data_stream(elem_data.data(),
629  cast_int<unsigned int>(elem_data.size()),
630  cast_int<unsigned int>(elem_data.size()));
631 
632 #ifdef LIBMESH_ENABLE_UNIQUE_ID
633  largest_id_type unique_id = elem->unique_id();
634 
635  io.data(unique_id, "# unique id");
636 #endif
637 
638 #ifdef LIBMESH_ENABLE_AMR
639  uint16_t p_level = cast_int<uint16_t>(elem->p_level());
640  io.data(p_level, "# p_level");
641 
642  uint16_t rflag = elem->refinement_flag();
643  io.data(rflag, "# rflag");
644 
645  uint16_t pflag = elem->p_refinement_flag();
646  io.data(pflag, "# pflag");
647 #endif
648  io.data_stream(conn_data.data(),
649  cast_int<unsigned int>(conn_data.size()),
650  cast_int<unsigned int>(conn_data.size()));
651  }
652 }

References libMesh::Xdr::data(), libMesh::Xdr::data_stream(), libMesh::libmesh_assert(), libMesh::MeshOutput< MT >::mesh(), n_nodes, version_at_least_1_5(), and libMesh::Xdr::writing().

Referenced by write().

◆ write_discontinuous_equation_systems()

void libMesh::MeshOutput< MeshBase >::write_discontinuous_equation_systems ( const std::string &  fname,
const EquationSystems es,
const std::set< std::string > *  system_names = nullptr 
)
virtualinherited

This method implements writing a mesh with discontinuous data to a specified file where the data is taken from the EquationSystems object.

Definition at line 87 of file mesh_output.C.

90 {
91  LOG_SCOPE("write_discontinuous_equation_systems()", "MeshOutput");
92 
93  // We may need to gather and/or renumber a DistributedMesh to output
94  // it, making that const qualifier in our constructor a dirty lie
95  MT & my_mesh = const_cast<MT &>(*_obj);
96 
97  // If we're asked to write data that's associated with a different
98  // mesh, output files full of garbage are the result.
99  libmesh_assert_equal_to(&es.get_mesh(), _obj);
100 
101  // A non-renumbered mesh may not have a contiguous numbering, and
102  // that needs to be fixed before we can build a solution vector.
103  if (my_mesh.max_elem_id() != my_mesh.n_elem() ||
104  my_mesh.max_node_id() != my_mesh.n_nodes())
105  {
106  // If we were allowed to renumber then we should have already
107  // been properly renumbered...
108  libmesh_assert(!my_mesh.allow_renumbering());
109 
110  libmesh_do_once(libMesh::out <<
111  "Warning: This MeshOutput subclass only supports meshes which are contiguously renumbered!"
112  << std::endl;);
113 
114  my_mesh.allow_renumbering(true);
115 
116  my_mesh.renumber_nodes_and_elements();
117 
118  // Not sure what good going back to false will do here, the
119  // renumbering horses have already left the barn...
120  my_mesh.allow_renumbering(false);
121  }
122 
123  MeshSerializer serialize(const_cast<MT &>(*_obj), !_is_parallel_format, _serial_only_needed_on_proc_0);
124 
125  // Build the list of variable names that will be written.
126  std::vector<std::string> names;
127  es.build_variable_names (names, nullptr, system_names);
128 
129  if (!_is_parallel_format)
130  {
131  // Build the nodal solution values & get the variable
132  // names from the EquationSystems object
133  std::vector<Number> soln;
134  es.build_discontinuous_solution_vector (soln, system_names);
135 
136  this->write_nodal_data_discontinuous (fname, soln, names);
137  }
138  else // _is_parallel_format
139  {
140  libmesh_not_implemented();
141  }
142 }

◆ write_equation_systems()

void libMesh::MeshOutput< MeshBase >::write_equation_systems ( const std::string &  fname,
const EquationSystems es,
const std::set< std::string > *  system_names = nullptr 
)
virtualinherited

This method implements writing a mesh with data to a specified file where the data is taken from the EquationSystems object.

Reimplemented in libMesh::NameBasedIO.

Definition at line 31 of file mesh_output.C.

34 {
35  LOG_SCOPE("write_equation_systems()", "MeshOutput");
36 
37  // We may need to gather and/or renumber a DistributedMesh to output
38  // it, making that const qualifier in our constructor a dirty lie
39  MT & my_mesh = const_cast<MT &>(*_obj);
40 
41  // If we're asked to write data that's associated with a different
42  // mesh, output files full of garbage are the result.
43  libmesh_assert_equal_to(&es.get_mesh(), _obj);
44 
45  // A non-renumbered mesh may not have a contiguous numbering, and
46  // that needs to be fixed before we can build a solution vector.
47  if (my_mesh.max_elem_id() != my_mesh.n_elem() ||
48  my_mesh.max_node_id() != my_mesh.n_nodes())
49  {
50  // If we were allowed to renumber then we should have already
51  // been properly renumbered...
52  libmesh_assert(!my_mesh.allow_renumbering());
53 
54  libmesh_do_once(libMesh::out <<
55  "Warning: This MeshOutput subclass only supports meshes which are contiguously renumbered!"
56  << std::endl;);
57 
58  my_mesh.allow_renumbering(true);
59 
60  my_mesh.renumber_nodes_and_elements();
61 
62  // Not sure what good going back to false will do here, the
63  // renumbering horses have already left the barn...
64  my_mesh.allow_renumbering(false);
65  }
66 
68  {
69  MeshSerializer serialize(const_cast<MT &>(*_obj), !_is_parallel_format, _serial_only_needed_on_proc_0);
70 
71  // Build the list of variable names that will be written.
72  std::vector<std::string> names;
73  es.build_variable_names (names, nullptr, system_names);
74 
75  // Build the nodal solution values & get the variable
76  // names from the EquationSystems object
77  std::vector<Number> soln;
78  es.build_solution_vector (soln, system_names);
79 
80  this->write_nodal_data (fname, soln, names);
81  }
82  else // _is_parallel_format
83  this->write_nodal_data (fname, es, system_names);
84 }

◆ write_nodal_data() [1/3]

void libMesh::MeshOutput< MeshBase >::write_nodal_data ( const std::string &  fname,
const EquationSystems es,
const std::set< std::string > *  system_names 
)
virtualinherited

This method should be overridden by "parallel" output formats for writing nodal data.

Instead of getting a localized copy of the nodal solution vector, it directly uses EquationSystems current_local_solution vectors to look up nodal values.

If not implemented, reorders the solutions into a nodal-only NumericVector and calls the above version of this function.

Reimplemented in libMesh::Nemesis_IO.

Definition at line 158 of file mesh_output.C.

161 {
162  std::vector<std::string> names;
163  es.build_variable_names (names, nullptr, system_names);
164 
165  std::unique_ptr<NumericVector<Number>> parallel_soln =
166  es.build_parallel_solution_vector(system_names);
167 
168  this->write_nodal_data (fname, *parallel_soln, names);
169 }

◆ write_nodal_data() [2/3]

void libMesh::MeshOutput< MeshBase >::write_nodal_data ( const std::string &  fname,
const NumericVector< Number > &  parallel_soln,
const std::vector< std::string > &  names 
)
virtualinherited

This method may be overridden by "parallel" output formats for writing nodal data.

Instead of getting a localized copy of the nodal solution vector, it is passed a NumericVector of type=PARALLEL which is in node-major order i.e. (u0,v0,w0, u1,v1,w1, u2,v2,w2, u3,v3,w3, ...) and contains n_nodes*n_vars total entries. Then, it is up to the individual I/O class to extract the required solution values from this vector and write them in parallel.

If not implemented, localizes the parallel vector into a std::vector and calls the other version of this function.

Reimplemented in libMesh::Nemesis_IO.

Definition at line 145 of file mesh_output.C.

148 {
149  // This is the fallback implementation for parallel I/O formats that
150  // do not yet implement proper writing in parallel, and instead rely
151  // on the full solution vector being available on all processors.
152  std::vector<Number> soln;
153  parallel_soln.localize(soln);
154  this->write_nodal_data(fname, soln, names);
155 }

◆ write_nodal_data() [3/3]

virtual void libMesh::MeshOutput< MeshBase >::write_nodal_data ( const std::string &  ,
const std::vector< Number > &  ,
const std::vector< std::string > &   
)
inlinevirtualinherited

This method implements writing a mesh with nodal data to a specified file where the nodal data and variable names are provided.

Reimplemented in libMesh::Nemesis_IO, libMesh::UCDIO, libMesh::ExodusII_IO, libMesh::GmshIO, libMesh::NameBasedIO, libMesh::GMVIO, libMesh::VTKIO, libMesh::MEDITIO, libMesh::GnuPlotIO, and libMesh::TecplotIO.

Definition at line 105 of file mesh_output.h.

108  { libmesh_not_implemented(); }

◆ write_nodal_data_discontinuous()

virtual void libMesh::MeshOutput< MeshBase >::write_nodal_data_discontinuous ( const std::string &  ,
const std::vector< Number > &  ,
const std::vector< std::string > &   
)
inlinevirtualinherited

This method implements writing a mesh with discontinuous data to a specified file where the nodal data and variables names are provided.

Reimplemented in libMesh::ExodusII_IO.

Definition at line 114 of file mesh_output.h.

117  { libmesh_not_implemented(); }

◆ write_nodes()

void libMesh::CheckpointIO::write_nodes ( Xdr io,
const std::set< const Node * > &  nodeset 
) const
private

Write the nodal locations for part of a mesh.

Definition at line 530 of file checkpoint_io.C.

532 {
533  largest_id_type n_nodes_here = nodeset.size();
534 
535  io.data(n_nodes_here, "# n_nodes on proc");
536 
537  const bool write_extra_integers = this->version_at_least_1_5();
538  const unsigned int n_extra_integers =
539  write_extra_integers ? MeshOutput<MeshBase>::mesh().n_node_integers() : 0;
540 
541  // Will hold the node id and pid and extra integers
542  std::vector<largest_id_type> id_pid(2 + n_extra_integers);
543 
544  // For the coordinates
545  std::vector<Real> coords(LIBMESH_DIM);
546 
547  for (const auto & node : nodeset)
548  {
549  id_pid[0] = node->id();
550  id_pid[1] = node->processor_id();
551 
552  libmesh_assert_equal_to(n_extra_integers, node->n_extra_integers());
553  for (unsigned int i=0; i != n_extra_integers; ++i)
554  id_pid[2+i] = node->get_extra_integer(i);
555 
556  io.data_stream(id_pid.data(), 2 + n_extra_integers, 2 + n_extra_integers);
557 
558 #ifdef LIBMESH_ENABLE_UNIQUE_ID
559  largest_id_type unique_id = node->unique_id();
560 
561  io.data(unique_id, "# unique id");
562 #endif
563 
564  coords[0] = (*node)(0);
565 
566 #if LIBMESH_DIM > 1
567  coords[1] = (*node)(1);
568 #endif
569 
570 #if LIBMESH_DIM > 2
571  coords[2] = (*node)(2);
572 #endif
573 
574  io.data_stream(coords.data(), LIBMESH_DIM, 3);
575  }
576 }

References libMesh::Xdr::data(), libMesh::Xdr::data_stream(), libMesh::MeshOutput< MT >::mesh(), and version_at_least_1_5().

Referenced by write().

◆ write_nodesets()

void libMesh::CheckpointIO::write_nodesets ( Xdr io,
const std::set< const Node * > &  nodeset,
const std::vector< std::tuple< dof_id_type, boundary_id_type >> &  bc_tuples 
) const
private

Write the nodal boundary conditions for part of a mesh.

Definition at line 741 of file checkpoint_io.C.

744 {
745  libmesh_assert (io.writing());
746 
747  // convenient reference to our mesh
748  const MeshBase & mesh = MeshOutput<MeshBase>::mesh();
749 
750  // Build a list of (node, bc) tuples
751  std::size_t nodeset_size = bc_tuples.size();
752 
753  std::vector<largest_id_type> node_id_list;
754  std::vector<largest_id_type> bc_id_list;
755 
756  node_id_list.reserve(nodeset_size);
757  bc_id_list.reserve(nodeset_size);
758 
759  for (const auto & t : bc_tuples)
760  if (nodeset.count(mesh.node_ptr(std::get<0>(t))))
761  {
762  node_id_list.push_back(std::get<0>(t));
763  bc_id_list.push_back(std::get<1>(t));
764  }
765 
766  io.data(node_id_list, "# node id list");
767  io.data(bc_id_list, "# nodeset bc id list");
768 }

References libMesh::Xdr::data(), libMesh::libmesh_assert(), libMesh::MeshInput< MeshBase >::mesh(), libMesh::MeshOutput< MT >::mesh(), libMesh::MeshBase::node_ptr(), and libMesh::Xdr::writing().

Referenced by write().

◆ write_remote_elem()

void libMesh::CheckpointIO::write_remote_elem ( Xdr io,
const std::set< const Elem *, CompareElemIdsByLevel > &  elements 
) const
private

Write the remote_elem neighbor and child links for part of a mesh.

Definition at line 655 of file checkpoint_io.C.

657 {
658  libmesh_assert (io.writing());
659 
660  // Find the remote_elem neighbor and child links
661  std::vector<largest_id_type> elem_ids, parent_ids;
662  std::vector<uint16_t> elem_sides, child_numbers;
663 
664  for (const auto & elem : elements)
665  {
666  for (auto n : elem->side_index_range())
667  {
668  const Elem * neigh = elem->neighbor_ptr(n);
669  if (neigh == remote_elem ||
670  (neigh && !elements.count(neigh)))
671  {
672  elem_ids.push_back(elem->id());
673  elem_sides.push_back(n);
674  }
675  }
676 
677 #ifdef LIBMESH_ENABLE_AMR
678  if (elem->has_children())
679  {
680  for (unsigned short c = 0,
681  nc = cast_int<unsigned short>(elem->n_children());
682  c != nc; ++c)
683  {
684  const Elem * child = elem->child_ptr(c);
685  if (child == remote_elem ||
686  (child && !elements.count(child)))
687  {
688  parent_ids.push_back(elem->id());
689  child_numbers.push_back(c);
690  }
691  }
692  }
693 #endif
694  }
695 
696  io.data(elem_ids, "# remote neighbor elem_ids");
697  io.data(elem_sides, "# remote neighbor elem_sides");
698  io.data(parent_ids, "# remote child parent_ids");
699  io.data(child_numbers, "# remote child_numbers");
700 }

References libMesh::Elem::child_ptr(), libMesh::Xdr::data(), libMesh::libmesh_assert(), libMesh::Elem::neighbor_ptr(), libMesh::remote_elem, and libMesh::Xdr::writing().

Referenced by write().

◆ write_subdomain_names()

void libMesh::CheckpointIO::write_subdomain_names ( Xdr io) const
private

Write subdomain name information.

Definition at line 496 of file checkpoint_io.C.

497 {
498  {
499  const MeshBase & mesh = MeshOutput<MeshBase>::mesh();
500 
501  const std::map<subdomain_id_type, std::string> & subdomain_map = mesh.get_subdomain_name_map();
502 
503  std::vector<largest_id_type> subdomain_ids; subdomain_ids.reserve(subdomain_map.size());
504  std::vector<std::string> subdomain_names; subdomain_names.reserve(subdomain_map.size());
505 
506  // We need to loop over the map and make sure that there aren't any invalid entries. Since we
507  // return writable references in mesh_base, it's possible for the user to leave some entity names
508  // blank. We can't write those to the XDA file.
509  largest_id_type n_subdomain_names = 0;
510  for (const auto & pr : subdomain_map)
511  if (!pr.second.empty())
512  {
513  n_subdomain_names++;
514  subdomain_ids.push_back(pr.first);
515  subdomain_names.push_back(pr.second);
516  }
517 
518  io.data(n_subdomain_names, "# subdomain id to name map");
519  // Write out the ids and names in two vectors
520  if (n_subdomain_names)
521  {
522  io.data(subdomain_ids);
523  io.data(subdomain_names);
524  }
525  }
526 }

References libMesh::Xdr::data(), libMesh::MeshBase::get_subdomain_name_map(), libMesh::MeshInput< MeshBase >::mesh(), and libMesh::MeshOutput< MT >::mesh().

Referenced by write().

Member Data Documentation

◆ _ascii_precision

unsigned int libMesh::MeshOutput< MeshBase >::_ascii_precision
privateinherited

Precision to use when writing ASCII files.

Definition at line 195 of file mesh_output.h.

◆ _binary

bool libMesh::CheckpointIO::_binary
private

Definition at line 327 of file checkpoint_io.h.

Referenced by binary().

◆ _communicator

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

◆ _is_parallel_format [1/2]

const bool libMesh::MeshInput< MeshBase >::_is_parallel_format
privateinherited

Flag specifying whether this format is parallel-capable.

If this is false (default) I/O is only permitted when the mesh has been serialized.

Definition at line 121 of file mesh_input.h.

◆ _is_parallel_format [2/2]

const bool libMesh::MeshOutput< MeshBase >::_is_parallel_format
protectedinherited

Flag specifying whether this format is parallel-capable.

If this is false (default) I/O is only permitted when the mesh has been serialized.

Definition at line 172 of file mesh_output.h.

◆ _my_n_processors

processor_id_type libMesh::CheckpointIO::_my_n_processors
private

Definition at line 335 of file checkpoint_io.h.

Referenced by current_n_processors(), select_split_config(), and write().

◆ _my_processor_ids

std::vector<processor_id_type> libMesh::CheckpointIO::_my_processor_ids
private

Definition at line 332 of file checkpoint_io.h.

Referenced by current_processor_ids(), and write().

◆ _obj

MeshBase * libMesh::MeshInput< MeshBase >::_obj
privateinherited

A pointer to a non-const object object.

This allows us to read the object from file.

Definition at line 114 of file mesh_input.h.

◆ _parallel

bool libMesh::CheckpointIO::_parallel
private

Definition at line 328 of file checkpoint_io.h.

Referenced by parallel(), and write().

◆ _serial_only_needed_on_proc_0

const bool libMesh::MeshOutput< MeshBase >::_serial_only_needed_on_proc_0
protectedinherited

Flag specifying whether this format can be written by only serializing the mesh to processor zero.

If this is false (default) the mesh will be serialized to all processors

Definition at line 181 of file mesh_output.h.

◆ _version

std::string libMesh::CheckpointIO::_version
private

Definition at line 329 of file checkpoint_io.h.

Referenced by version(), and write().

◆ elems_of_dimension

std::vector<bool> libMesh::MeshInput< MeshBase >::elems_of_dimension
protectedinherited

A vector of bools describing what dimension elements have been encountered when reading a mesh.

Definition at line 97 of file mesh_input.h.


The documentation for this class was generated from the following files:
libMesh::connect_children
void connect_children(const MeshBase &mesh, MeshBase::const_element_iterator elem_it, MeshBase::const_element_iterator elem_end, std::set< const Elem *, CompareElemIdsByLevel > &connected_elements)
Definition: mesh_communication.C:169
libMesh::CheckpointIO::select_split_config
processor_id_type select_split_config(const std::string &input_name, header_id_type &data_size)
Definition: checkpoint_io.C:186
libMesh::dof_id_type
uint8_t dof_id_type
Definition: id_types.h:67
libMesh::subdomain_id_type
TestClass subdomain_id_type
Based on the 4-byte comment warning above, this probably doesn't work with exodusII at all....
Definition: id_types.h:43
libMesh::MeshOutput< MeshBase >::_serial_only_needed_on_proc_0
const bool _serial_only_needed_on_proc_0
Flag specifying whether this format can be written by only serializing the mesh to processor zero.
Definition: mesh_output.h:181
libMesh::CheckpointIO::write_nodesets
void write_nodesets(Xdr &io, const std::set< const Node * > &nodeset, const std::vector< std::tuple< dof_id_type, boundary_id_type >> &bc_tuples) const
Write the nodal boundary conditions for part of a mesh.
Definition: checkpoint_io.C:741
libMesh::MeshBase::set_n_partitions
unsigned int & set_n_partitions()
Definition: mesh_base.h:1667
libMesh::CheckpointIO::parallel
bool parallel() const
Get/Set the flag indicating if we should read/write binary.
Definition: checkpoint_io.h:151
libMesh::MeshBase::get_boundary_info
const BoundaryInfo & get_boundary_info() const
The information about boundary ids on the mesh.
Definition: mesh_base.h:132
libMesh::MeshBase::is_serial
virtual bool is_serial() const
Definition: mesh_base.h:159
libMesh::BoundaryInfo::add_node
void add_node(const Node *node, const boundary_id_type id)
Add Node node with boundary id id to the boundary information data structures.
Definition: boundary_info.C:636
libMesh::CheckpointIO::_my_processor_ids
std::vector< processor_id_type > _my_processor_ids
Definition: checkpoint_io.h:332
libMesh::MeshBase::n_elem
virtual dof_id_type n_elem() const =0
libMesh::MeshBase::elem_ref
virtual const Elem & elem_ref(const dof_id_type i) const
Definition: mesh_base.h:521
libMesh::index_range
IntRange< std::size_t > index_range(const std::vector< T > &vec)
Helper function that returns an IntRange<std::size_t> representing all the indices of the passed-in v...
Definition: int_range.h:106
libMesh::Elem::add_child
void add_child(Elem *elem)
Adds a child pointer to the array of children of this element.
Definition: elem.C:1384
libMesh::CheckpointIO::version
const std::string & version() const
Get/Set the version string.
Definition: checkpoint_io.h:157
libMesh::reconnect_nodes
void reconnect_nodes(const std::set< const Elem *, CompareElemIdsByLevel > &connected_elements, std::set< const Node * > &connected_nodes)
Definition: mesh_communication.C:259
end
IterBase * end
Also have a polymorphic pointer to the end object, this prevents iterating past the end.
Definition: variant_filter_iterator.h:343
libMesh::CheckpointIO::write_bc_names
void write_bc_names(Xdr &io, const BoundaryInfo &info, bool is_sideset) const
Write boundary names information (sideset and nodeset)
Definition: checkpoint_io.C:772
libMesh::ParallelObject::comm
const Parallel::Communicator & comm() const
Definition: parallel_object.h:94
libMesh::Elem::set_neighbor
void set_neighbor(const unsigned int i, Elem *n)
Assigns n as the neighbor.
Definition: elem.h:2105
libMesh::MeshBase::set_subdomain_name_map
std::map< subdomain_id_type, std::string > & set_subdomain_name_map()
Definition: mesh_base.h:1631
libMesh::MeshTools::max_level
unsigned int max_level(const MeshBase &mesh)
Find the maximum h-refinement level in a mesh.
libMesh::MeshBase::set_distributed
virtual void set_distributed()
Asserts that not all elements and nodes of the mesh necessarily exist on the current processor.
Definition: mesh_base.h:174
libMesh::WRITE
Definition: enum_xdr_mode.h:40
libMesh::MeshBase::node_ptr
virtual const Node * node_ptr(const dof_id_type i) const =0
libMesh::MeshBase::mesh_dimension
unsigned int mesh_dimension() const
Definition: mesh_base.C:135
libMesh::DofObject::set_unique_id
unique_id_type & set_unique_id()
Definition: dof_object.h:797
libMesh::largest_id_type
uint64_t largest_id_type
Definition: id_types.h:148
libMesh::CheckpointIO::header_id_type
uint64_t header_id_type
Definition: checkpoint_io.h:69
libMesh::MeshBase::elem_ptr
virtual const Elem * elem_ptr(const dof_id_type i) const =0
libMesh::MeshBase::elements_begin
virtual element_iterator elements_begin()=0
Iterate over all the elements in the Mesh.
libMesh::MeshBase::query_elem_ptr
virtual const Elem * query_elem_ptr(const dof_id_type i) const =0
libMesh::MeshInput< MeshBase >::_obj
MeshBase * _obj
A pointer to a non-const object object.
Definition: mesh_input.h:114
libMesh::BoundaryInfo::build_side_list
void build_side_list(std::vector< dof_id_type > &element_id_list, std::vector< unsigned short int > &side_list, std::vector< boundary_id_type > &bc_id_list) const
Creates a list of element numbers, sides, and ids for those sides.
Definition: boundary_info.C:1976
libMesh::MeshBase::element_ptr_range
virtual SimpleRange< element_iterator > element_ptr_range()=0
libMesh::libmesh_assert
libmesh_assert(ctx)
libMesh::ParallelObject::ParallelObject
ParallelObject(const Parallel::Communicator &comm_in)
Constructor.
Definition: parallel_object.h:63
libMesh::NumericVector::localize
virtual void localize(std::vector< T > &v_local) const =0
Creates a copy of the global vector in the local vector v_local.
libMesh::ParallelObject::n_processors
processor_id_type n_processors() const
Definition: parallel_object.h:100
libMesh::DECODE
Definition: enum_xdr_mode.h:39
libMesh::CheckpointIO::write_nodes
void write_nodes(Xdr &io, const std::set< const Node * > &nodeset) const
Write the nodal locations for part of a mesh.
Definition: checkpoint_io.C:530
libMesh::MeshOutput< MeshBase >::_is_parallel_format
const bool _is_parallel_format
Flag specifying whether this format is parallel-capable.
Definition: mesh_output.h:172
libMesh::ParallelObject::processor_id
processor_id_type processor_id() const
Definition: parallel_object.h:106
libMesh::libmesh_ignore
void libmesh_ignore(const Args &...)
Definition: libmesh_common.h:526
libMesh::ParallelObject::_communicator
const Parallel::Communicator & _communicator
Definition: parallel_object.h:112
libMesh::processor_id_type
uint8_t processor_id_type
Definition: id_types.h:104
libMesh::CheckpointIO::binary
bool binary() const
Get/Set the flag indicating if we should read/write binary.
Definition: checkpoint_io.h:145
libMesh::MeshBase::add_elem_integer
unsigned int add_elem_integer(const std::string &name, bool allocate_data=true)
Register an integer datum (of type dof_id_type) to be added to each element in the mesh.
Definition: mesh_base.C:176
libMesh::cast_int
Tnew cast_int(Told oldvar)
Definition: libmesh_common.h:610
libMesh::CheckpointIO::version_at_least_1_5
bool version_at_least_1_5() const
Definition: checkpoint_io.C:277
libMesh::Elem::raw_child_ptr
const Elem * raw_child_ptr(unsigned int i) const
Definition: elem.h:2558
libMesh::as_range
SimpleRange< IndexType > as_range(const std::pair< IndexType, IndexType > &p)
Helper function that allows us to treat a homogenous pair as a range.
Definition: simple_range.h:57
libMesh::MeshBase::add_node_integer
unsigned int add_node_integer(const std::string &name, bool allocate_data=true)
Register an integer datum (of type dof_id_type) to be added to each node in the mesh.
Definition: mesh_base.C:247
libMesh::MeshBase::get_node_integer_name
const std::string & get_node_integer_name(unsigned int i) const
Definition: mesh_base.h:915
n_nodes
const dof_id_type n_nodes
Definition: tecplot_io.C:68
libMesh::READ
Definition: enum_xdr_mode.h:41
libMesh::MeshBase::get_subdomain_name_map
const std::map< subdomain_id_type, std::string > & get_subdomain_name_map() const
Definition: mesh_base.h:1633
libMesh::MeshBase::n_elem_integers
unsigned int n_elem_integers() const
Definition: mesh_base.h:829
libMesh::query_ghosting_functors
void query_ghosting_functors(const MeshBase &mesh, processor_id_type pid, MeshBase::const_element_iterator elem_it, MeshBase::const_element_iterator elem_end, std::set< const Elem *, CompareElemIdsByLevel > &connected_elements)
Definition: mesh_communication.C:138
libMesh::CheckpointIO::_version
std::string _version
Definition: checkpoint_io.h:329
libMesh::MeshBase::n_node_integers
unsigned int n_node_integers() const
Definition: mesh_base.h:926
libMesh::CheckpointIO::write_remote_elem
void write_remote_elem(Xdr &io, const std::set< const Elem *, CompareElemIdsByLevel > &elements) const
Write the remote_elem neighbor and child links for part of a mesh.
Definition: checkpoint_io.C:655
libMesh::connect_families
void connect_families(std::set< const Elem *, CompareElemIdsByLevel > &connected_elements)
Definition: mesh_communication.C:192
libMesh::ENCODE
Definition: enum_xdr_mode.h:38
swap
void swap(Iterator &lhs, Iterator &rhs)
swap, used to implement op=
Definition: variant_filter_iterator.h:478
libMesh::MeshOutput< MeshBase >::write_nodal_data
virtual void write_nodal_data(const std::string &, const std::vector< Number > &, const std::vector< std::string > &)
This method implements writing a mesh with nodal data to a specified file where the nodal data and va...
Definition: mesh_output.h:105
libMesh::MeshOutput::mesh
const MT & mesh() const
Definition: mesh_output.h:247
libMesh::Elem::type_to_n_nodes_map
static const unsigned int type_to_n_nodes_map[INVALID_ELEM]
This array maps the integer representation of the ElemType enum to the number of nodes in the element...
Definition: elem.h:576
libMesh::CheckpointIO::write_subdomain_names
void write_subdomain_names(Xdr &io) const
Write subdomain name information.
Definition: checkpoint_io.C:496
libMesh::MeshBase::add_elem
virtual Elem * add_elem(Elem *e)=0
Add elem e to the end of the element array.
libMesh::CheckpointIO::_my_n_processors
processor_id_type _my_n_processors
Definition: checkpoint_io.h:335
libMesh::MeshBase::elements_end
virtual element_iterator elements_end()=0
libMesh::DofObject::invalid_processor_id
static const processor_id_type invalid_processor_id
An invalid processor_id to distinguish DoFs that have not been assigned to a processor.
Definition: dof_object.h:432
libMesh::MeshOutput< MeshBase >::write_nodal_data_discontinuous
virtual void write_nodal_data_discontinuous(const std::string &, const std::vector< Number > &, const std::vector< std::string > &)
This method implements writing a mesh with discontinuous data to a specified file where the nodal dat...
Definition: mesh_output.h:114
libMesh::CheckpointIO::_parallel
bool _parallel
Definition: checkpoint_io.h:328
libMesh::Threads::split
tbb::split split
Dummy "splitting object" used to distinguish splitting constructors from copy constructors.
Definition: threads_tbb.h:79
libMesh::CheckpointIO::_binary
bool _binary
Definition: checkpoint_io.h:327
libMesh::MeshInput< MeshBase >::mesh
MeshBase & mesh()
Definition: mesh_input.h:169
libMesh::MeshOutput< MeshBase >::_obj
const MeshBase *const _obj
A pointer to a constant object.
Definition: mesh_output.h:190
libMesh::MeshBase::add_point
virtual Node * add_point(const Point &p, const dof_id_type id=DofObject::invalid_id, const processor_id_type proc_id=DofObject::invalid_processor_id)=0
Add a new Node at Point p to the end of the vertex array, with processor_id procid.
libMesh::CheckpointIO::write_bcs
void write_bcs(Xdr &io, const std::set< const Elem *, CompareElemIdsByLevel > &elements, const std::vector< std::tuple< dof_id_type, unsigned short int, boundary_id_type >> &bc_triples) const
Write the side boundary conditions for part of a mesh.
Definition: checkpoint_io.C:704
libMesh::CheckpointIO::write_connectivity
void write_connectivity(Xdr &io, const std::set< const Elem *, CompareElemIdsByLevel > &elements) const
Write the connectivity for part of a mesh.
Definition: checkpoint_io.C:580
libMesh::MeshBase::set_mesh_dimension
void set_mesh_dimension(unsigned char d)
Resets the logical dimension of the mesh.
Definition: mesh_base.h:218
libMesh::Elem::build
static std::unique_ptr< Elem > build(const ElemType type, Elem *p=nullptr)
Definition: elem.C:246
libMesh::MeshBase::query_node_ptr
virtual const Node * query_node_ptr(const dof_id_type i) const =0
libMesh::out
OStreamProxy out
libMesh::BoundaryInfo::add_side
void add_side(const dof_id_type elem, const unsigned short int side, const boundary_id_type id)
Add side side of element number elem with boundary id id to the boundary information data structure.
Definition: boundary_info.C:886
libMesh::remote_elem
const RemoteElem * remote_elem
Definition: remote_elem.C:57
libMesh::MeshOutput< MeshBase >::_ascii_precision
unsigned int _ascii_precision
Precision to use when writing ASCII files.
Definition: mesh_output.h:195
libMesh::Quality::name
std::string name(const ElemQuality q)
This function returns a string containing some name for q.
Definition: elem_quality.C:42
libMesh::MeshBase::is_replicated
virtual bool is_replicated() const
Definition: mesh_base.h:181
libMesh::MeshBase::get_elem_integer_name
const std::string & get_elem_integer_name(unsigned int i) const
Definition: mesh_base.h:818
libMesh::ElemType
ElemType
Defines an enum for geometric element types.
Definition: enum_elem_type.h:33