$extrastylesheet
#include <xdr_io.h>

Public Types | |
| typedef largest_id_type | xdr_id_type |
| typedef uint32_t | header_id_type |
Public Member Functions | |
| XdrIO (MeshBase &, const bool=false) | |
| XdrIO (const MeshBase &, const bool=false) | |
| virtual | ~XdrIO () |
| virtual void | read (const std::string &) |
| virtual void | write (const std::string &) |
| bool | binary () const |
| bool & | binary () |
| bool | legacy () const |
| bool & | legacy () |
| bool | write_parallel () const |
| void | set_write_parallel (bool do_parallel=true) |
| void | set_auto_parallel () |
| const std::string & | version () const |
| std::string & | version () |
| const std::string & | boundary_condition_file_name () const |
| std::string & | boundary_condition_file_name () |
| const std::string & | partition_map_file_name () const |
| std::string & | partition_map_file_name () |
| const std::string & | subdomain_map_file_name () const |
| std::string & | subdomain_map_file_name () |
| const std::string & | polynomial_level_file_name () const |
| std::string & | polynomial_level_file_name () |
| virtual void | write_equation_systems (const std::string &, const EquationSystems &, const std::set< std::string > *system_names=NULL) |
| virtual void | write_nodal_data (const std::string &, const std::vector< Number > &, const std::vector< std::string > &) |
| unsigned int & | ascii_precision () |
| const Parallel::Communicator & | comm () const |
| processor_id_type | n_processors () const |
| processor_id_type | processor_id () const |
Protected Member Functions | |
| MeshBase & | mesh () |
| void | set_n_partitions (unsigned int n_parts) |
| void | skip_comment_lines (std::istream &in, const char comment_start) |
| const MeshBase & | mesh () const |
Protected Attributes | |
| std::vector< bool > | elems_of_dimension |
| const bool | _is_parallel_format |
| const Parallel::Communicator & | _communicator |
Private Member Functions | |
| void | write_serialized_subdomain_names (Xdr &io) const |
| void | write_serialized_connectivity (Xdr &io, const dof_id_type n_elem) const |
| void | write_serialized_nodes (Xdr &io, const dof_id_type n_nodes) const |
| void | write_serialized_bcs (Xdr &io, const header_id_type n_bcs) const |
| void | write_serialized_nodesets (Xdr &io, const header_id_type n_nodesets) const |
| void | write_serialized_bc_names (Xdr &io, const BoundaryInfo &info, bool is_sideset) const |
| void | read_serialized_subdomain_names (Xdr &io) |
| template<typename T > | |
| void | read_serialized_connectivity (Xdr &io, const dof_id_type n_elem, std::vector< header_id_type > &sizes, T) |
| void | read_serialized_nodes (Xdr &io, const dof_id_type n_nodes) |
| template<typename T > | |
| void | read_serialized_bcs (Xdr &io, T) |
| template<typename T > | |
| void | read_serialized_nodesets (Xdr &io, T) |
| void | read_serialized_bc_names (Xdr &io, BoundaryInfo &info, bool is_sideset) |
| void | pack_element (std::vector< xdr_id_type > &conn, const Elem *elem, const dof_id_type parent_id=DofObject::invalid_id, const dof_id_type parent_pid=DofObject::invalid_id) const |
Private Attributes | |
| bool | _binary |
| bool | _legacy |
| bool | _write_serial |
| bool | _write_parallel |
| bool | _write_unique_id |
| header_id_type | _field_width |
| std::string | _version |
| std::string | _bc_file_name |
| std::string | _partition_map_file |
| std::string | _subdomain_map_file |
| std::string | _p_level_file |
Static Private Attributes | |
| static const std::size_t | io_blksize = 128000 |
| typedef uint32_t libMesh::XdrIO::header_id_type |
| libMesh::XdrIO::XdrIO | ( | MeshBase & | mesh, |
| const bool | binary_in = false |
||
| ) | [explicit] |
Constructor. Takes a writeable 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 118 of file xdr_io.C.
: MeshInput<MeshBase> (mesh,/* is_parallel_format = */ true), MeshOutput<MeshBase>(mesh,/* is_parallel_format = */ true), ParallelObject (mesh), _binary (binary_in), _legacy (false), _write_serial (false), _write_parallel (false), #ifdef LIBMESH_ENABLE_UNIQUE_ID _write_unique_id (true), #else _write_unique_id (false), #endif _field_width (4), // In 0.7.0, all fields are 4 bytes, in 0.9.2 they can vary _version ("libMesh-0.9.2+"), _bc_file_name ("n/a"), _partition_map_file ("n/a"), _subdomain_map_file ("n/a"), _p_level_file ("n/a") { }
| libMesh::XdrIO::XdrIO | ( | 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 142 of file xdr_io.C.
: MeshOutput<MeshBase>(mesh,/* is_parallel_format = */ true), ParallelObject (mesh), _binary (binary_in) { }
| libMesh::XdrIO::~XdrIO | ( | ) | [virtual] |
| unsigned int& libMesh::MeshOutput< MeshBase >::ascii_precision | ( | ) | [inherited] |
Return/set the precision to use when writing ASCII files.
By default we use numeric_limits<Real>::digits10 + 2, which should be enough to write out to ASCII and get the exact same Real back when reading in.
Referenced by libMesh::TecplotIO::write_ascii(), libMesh::GMVIO::write_ascii_new_impl(), and libMesh::GMVIO::write_ascii_old_impl().
| bool libMesh::XdrIO::binary | ( | ) | const [inline] |
| bool& libMesh::XdrIO::binary | ( | ) | [inline] |
| const std::string& libMesh::XdrIO::boundary_condition_file_name | ( | ) | const [inline] |
Get/Set the boundary condition file name.
Definition at line 143 of file xdr_io.h.
References _bc_file_name.
Referenced by read(), read_serialized_bcs(), read_serialized_nodesets(), and write().
{ return _bc_file_name; }
| std::string& libMesh::XdrIO::boundary_condition_file_name | ( | ) | [inline] |
| const Parallel::Communicator& libMesh::ParallelObject::comm | ( | ) | const [inline, inherited] |
Parallel::Communicator object used by this mesh. Definition at line 86 of file parallel_object.h.
References libMesh::ParallelObject::_communicator.
Referenced by libMesh::__libmesh_petsc_diff_solver_monitor(), libMesh::__libmesh_petsc_diff_solver_residual(), libMesh::__libmesh_petsc_snes_residual(), libMesh::MeshRefinement::_coarsen_elements(), libMesh::ExactSolution::_compute_error(), libMesh::MetisPartitioner::_do_partition(), libMesh::ParmetisPartitioner::_do_repartition(), libMesh::UniformRefinementEstimator::_estimate_error(), libMesh::SlepcEigenSolver< T >::_petsc_shell_matrix_get_diagonal(), libMesh::PetscLinearSolver< T >::_petsc_shell_matrix_get_diagonal(), libMesh::SlepcEigenSolver< T >::_petsc_shell_matrix_mult(), libMesh::PetscLinearSolver< T >::_petsc_shell_matrix_mult(), libMesh::PetscLinearSolver< T >::_petsc_shell_matrix_mult_add(), libMesh::EquationSystems::_read_impl(), libMesh::MeshRefinement::_refine_elements(), libMesh::ImplicitSystem::add_matrix(), libMesh::System::add_vector(), libMesh::UnstructuredMesh::all_second_order(), libMesh::LaplaceMeshSmoother::allgather_graph(), libMesh::FEMSystem::assemble_qoi(), libMesh::MeshCommunication::assign_global_indices(), libMesh::ParmetisPartitioner::assign_partitioning(), libMesh::DofMap::attach_matrix(), libMesh::MeshTools::bounding_box(), libMesh::MeshBase::cache_elem_dims(), libMesh::System::calculate_norm(), libMesh::MeshRefinement::coarsen_elements(), libMesh::Nemesis_IO_Helper::compute_num_global_elem_blocks(), libMesh::Nemesis_IO_Helper::compute_num_global_nodesets(), libMesh::Nemesis_IO_Helper::compute_num_global_sidesets(), libMesh::Problem_Interface::computeF(), libMesh::Problem_Interface::computeJacobian(), libMesh::Problem_Interface::computePreconditioner(), libMesh::MeshTools::correct_node_proc_ids(), libMesh::MeshCommunication::delete_remote_elements(), libMesh::DofMap::distribute_dofs(), DMlibMeshFunction(), DMlibMeshSetSystem_libMesh(), libMesh::MeshRefinement::eliminate_unrefined_patches(), libMesh::WeightedPatchRecoveryErrorEstimator::estimate_error(), libMesh::PatchRecoveryErrorEstimator::estimate_error(), libMesh::JumpErrorEstimator::estimate_error(), libMesh::AdjointRefinementEstimator::estimate_error(), libMesh::ExactErrorEstimator::estimate_error(), libMesh::MeshRefinement::flag_elements_by_elem_fraction(), libMesh::MeshRefinement::flag_elements_by_error_fraction(), libMesh::MeshRefinement::flag_elements_by_nelem_target(), libMesh::CondensedEigenSystem::get_eigenpair(), libMesh::ImplicitSystem::get_linear_solver(), libMesh::LocationMap< T >::init(), libMesh::TimeSolver::init(), libMesh::SystemSubsetBySubdomain::init(), libMesh::EigenSystem::init_data(), libMesh::EigenSystem::init_matrices(), libMesh::ParmetisPartitioner::initialize(), libMesh::MeshTools::libmesh_assert_valid_dof_ids(), libMesh::ParallelMesh::libmesh_assert_valid_parallel_flags(), libMesh::MeshTools::libmesh_assert_valid_procids< Elem >(), libMesh::MeshTools::libmesh_assert_valid_procids< Node >(), libMesh::MeshTools::libmesh_assert_valid_refinement_flags(), libMesh::MeshRefinement::limit_level_mismatch_at_edge(), libMesh::MeshRefinement::limit_level_mismatch_at_node(), libMesh::MeshRefinement::make_coarsening_compatible(), libMesh::MeshCommunication::make_elems_parallel_consistent(), libMesh::MeshRefinement::make_flags_parallel_consistent(), libMesh::MeshCommunication::make_node_ids_parallel_consistent(), libMesh::MeshCommunication::make_node_proc_ids_parallel_consistent(), libMesh::MeshCommunication::make_nodes_parallel_consistent(), libMesh::MeshRefinement::make_refinement_compatible(), libMesh::FEMSystem::mesh_position_set(), libMesh::MeshSerializer::MeshSerializer(), libMesh::ParallelMesh::n_active_elem(), libMesh::MeshTools::n_active_levels(), libMesh::BoundaryInfo::n_boundary_conds(), libMesh::BoundaryInfo::n_edge_conds(), libMesh::CondensedEigenSystem::n_global_non_condensed_dofs(), libMesh::MeshTools::n_levels(), libMesh::BoundaryInfo::n_nodeset_conds(), libMesh::MeshTools::n_p_levels(), libMesh::ParallelMesh::parallel_max_elem_id(), libMesh::ParallelMesh::parallel_max_node_id(), libMesh::ParallelMesh::parallel_n_elem(), libMesh::ParallelMesh::parallel_n_nodes(), libMesh::Partitioner::partition(), libMesh::Partitioner::partition_unpartitioned_elements(), libMesh::petsc_auto_fieldsplit(), libMesh::System::point_gradient(), libMesh::System::point_hessian(), libMesh::System::point_value(), libMesh::MeshBase::prepare_for_use(), libMesh::System::project_vector(), libMesh::Nemesis_IO::read(), read(), libMesh::System::read_header(), libMesh::System::read_legacy_data(), libMesh::System::read_SCALAR_dofs(), read_serialized_bc_names(), read_serialized_bcs(), libMesh::System::read_serialized_blocked_dof_objects(), read_serialized_connectivity(), read_serialized_nodes(), read_serialized_nodesets(), read_serialized_subdomain_names(), libMesh::System::read_serialized_vector(), libMesh::MeshBase::recalculate_n_partitions(), libMesh::MeshRefinement::refine_and_coarsen_elements(), libMesh::MeshRefinement::refine_elements(), libMesh::Partitioner::set_node_processor_ids(), libMesh::DofMap::set_nonlocal_dof_objects(), libMesh::LaplaceMeshSmoother::smooth(), libMesh::MeshBase::subdomain_ids(), libMesh::BoundaryInfo::sync(), libMesh::Parallel::sync_element_data_by_parent_id(), libMesh::Parallel::sync_node_data_by_element_id(), libMesh::MeshRefinement::test_level_one(), libMesh::MeshRefinement::test_unflagged(), libMesh::MeshTools::total_weight(), libMesh::NameBasedIO::write(), libMesh::CheckpointIO::write(), write(), libMesh::LegacyXdrIO::write_mesh(), libMesh::System::write_SCALAR_dofs(), write_serialized_bcs(), libMesh::System::write_serialized_blocked_dof_objects(), write_serialized_connectivity(), write_serialized_nodes(), write_serialized_nodesets(), and libMesh::DivaIO::write_stream().
{ return _communicator; }
| bool libMesh::XdrIO::legacy | ( | ) | const [inline] |
| bool& libMesh::XdrIO::legacy | ( | ) | [inline] |
| MeshBase & libMesh::MeshInput< MeshBase >::mesh | ( | ) | [protected, inherited] |
Returns the object as a writeable reference.
Referenced by libMesh::GMVIO::_read_materials(), libMesh::GMVIO::_read_nodes(), libMesh::GMVIO::_read_one_cell(), libMesh::AbaqusIO::assign_boundary_node_ids(), libMesh::AbaqusIO::assign_sideset_ids(), libMesh::AbaqusIO::assign_subdomain_ids(), libMesh::VTKIO::cells_to_vtk(), libMesh::ExodusII_IO::copy_elemental_solution(), libMesh::ExodusII_IO::copy_nodal_solution(), libMesh::GMVIO::copy_nodal_solution(), libMesh::TetGenIO::element_in(), libMesh::UNVIO::elements_in(), libMesh::UNVIO::elements_out(), libMesh::UNVIO::groups_in(), libMesh::TetGenIO::node_in(), libMesh::UNVIO::nodes_in(), libMesh::UNVIO::nodes_out(), libMesh::VTKIO::nodes_to_vtk(), libMesh::AbaqusIO::read(), libMesh::NameBasedIO::read(), libMesh::TetGenIO::read(), libMesh::Nemesis_IO::read(), libMesh::ExodusII_IO::read(), libMesh::GMVIO::read(), libMesh::CheckpointIO::read(), read(), libMesh::VTKIO::read(), libMesh::LegacyXdrIO::read_ascii(), libMesh::CheckpointIO::read_bcs(), libMesh::CheckpointIO::read_connectivity(), libMesh::AbaqusIO::read_elements(), libMesh::UCDIO::read_implementation(), libMesh::UNVIO::read_implementation(), libMesh::GmshIO::read_mesh(), libMesh::LegacyXdrIO::read_mesh(), libMesh::AbaqusIO::read_nodes(), libMesh::CheckpointIO::read_nodes(), libMesh::CheckpointIO::read_nodesets(), read_serialized_bcs(), read_serialized_connectivity(), read_serialized_nodes(), read_serialized_nodesets(), read_serialized_subdomain_names(), libMesh::OFFIO::read_stream(), libMesh::MatlabIO::read_stream(), libMesh::CheckpointIO::read_subdomain_names(), libMesh::NameBasedIO::write(), libMesh::TetGenIO::write(), libMesh::Nemesis_IO::write(), libMesh::ExodusII_IO::write(), libMesh::CheckpointIO::write(), write(), libMesh::GMVIO::write_ascii_new_impl(), libMesh::GMVIO::write_ascii_old_impl(), libMesh::CheckpointIO::write_bcs(), libMesh::GMVIO::write_binary(), libMesh::CheckpointIO::write_connectivity(), libMesh::GMVIO::write_discontinuous_gmv(), libMesh::ExodusII_IO::write_element_data(), libMesh::UCDIO::write_implementation(), libMesh::GmshIO::write_mesh(), libMesh::LegacyXdrIO::write_mesh(), libMesh::UCDIO::write_nodal_data(), libMesh::VTKIO::write_nodal_data(), libMesh::Nemesis_IO::write_nodal_data(), libMesh::NameBasedIO::write_nodal_data(), libMesh::ExodusII_IO::write_nodal_data(), libMesh::ExodusII_IO::write_nodal_data_common(), libMesh::ExodusII_IO::write_nodal_data_discontinuous(), libMesh::CheckpointIO::write_nodes(), libMesh::CheckpointIO::write_nodesets(), write_parallel(), libMesh::GmshIO::write_post(), write_serialized_bcs(), write_serialized_connectivity(), write_serialized_nodes(), write_serialized_nodesets(), write_serialized_subdomain_names(), libMesh::LegacyXdrIO::write_soln(), and libMesh::CheckpointIO::write_subdomain_names().
| const MeshBase & libMesh::MeshOutput< MeshBase >::mesh | ( | ) | const [protected, inherited] |
Returns the object as a read-only reference.
Referenced by libMesh::TecplotIO::elem_dimension(), libMesh::FroIO::write(), libMesh::DivaIO::write(), libMesh::TecplotIO::write(), libMesh::PostscriptIO::write(), libMesh::MEDITIO::write(), libMesh::EnsightIO::write(), libMesh::MEDITIO::write_ascii(), libMesh::TecplotIO::write_ascii(), libMesh::TecplotIO::write_binary(), libMesh::EnsightIO::write_geometry_ascii(), libMesh::TecplotIO::write_nodal_data(), libMesh::MEDITIO::write_nodal_data(), libMesh::EnsightIO::write_scalar_ascii(), libMesh::GnuPlotIO::write_solution(), libMesh::DivaIO::write_stream(), and libMesh::EnsightIO::write_vector_ascii().
| processor_id_type libMesh::ParallelObject::n_processors | ( | ) | const [inline, inherited] |
Definition at line 92 of file parallel_object.h.
References libMesh::ParallelObject::_communicator, and libMesh::Parallel::Communicator::size().
Referenced by libMesh::ParmetisPartitioner::_do_repartition(), libMesh::ParallelMesh::add_elem(), libMesh::ParallelMesh::add_node(), libMesh::LaplaceMeshSmoother::allgather_graph(), libMesh::FEMSystem::assembly(), libMesh::ParmetisPartitioner::assign_partitioning(), libMesh::ParallelMesh::assign_unique_ids(), libMesh::AztecLinearSolver< T >::AztecLinearSolver(), libMesh::ParallelMesh::clear(), libMesh::Nemesis_IO_Helper::compute_border_node_ids(), libMesh::Nemesis_IO_Helper::construct_nemesis_filename(), libMesh::UnstructuredMesh::create_pid_mesh(), libMesh::DofMap::distribute_dofs(), libMesh::DofMap::distribute_local_dofs_node_major(), libMesh::DofMap::distribute_local_dofs_var_major(), libMesh::EnsightIO::EnsightIO(), libMesh::MeshBase::get_info(), libMesh::EquationSystems::init(), libMesh::SystemSubsetBySubdomain::init(), libMesh::ParmetisPartitioner::initialize(), libMesh::Nemesis_IO_Helper::initialize(), libMesh::MeshTools::libmesh_assert_valid_dof_ids(), libMesh::MeshTools::libmesh_assert_valid_procids< Elem >(), libMesh::MeshTools::libmesh_assert_valid_procids< Node >(), libMesh::MeshTools::libmesh_assert_valid_refinement_flags(), libMesh::DofMap::local_variable_indices(), libMesh::MeshBase::n_active_elem_on_proc(), libMesh::MeshBase::n_elem_on_proc(), libMesh::MeshBase::n_nodes_on_proc(), libMesh::Partitioner::partition(), libMesh::MeshBase::partition(), libMesh::Partitioner::partition_unpartitioned_elements(), libMesh::PetscLinearSolver< T >::PetscLinearSolver(), libMesh::System::point_gradient(), libMesh::System::point_hessian(), libMesh::System::point_value(), libMesh::MeshTools::processor_bounding_box(), libMesh::System::project_vector(), libMesh::NameBasedIO::read(), libMesh::Nemesis_IO::read(), libMesh::CheckpointIO::read(), read(), libMesh::System::read_parallel_data(), libMesh::System::read_SCALAR_dofs(), libMesh::System::read_serialized_blocked_dof_objects(), libMesh::System::read_serialized_vector(), libMesh::Partitioner::repartition(), libMesh::Partitioner::set_node_processor_ids(), libMesh::DofMap::set_nonlocal_dof_objects(), libMesh::BoundaryInfo::sync(), libMesh::ParallelMesh::update_parallel_id_counts(), libMesh::CheckpointIO::write(), libMesh::GMVIO::write_binary(), libMesh::GMVIO::write_discontinuous_gmv(), libMesh::System::write_parallel_data(), libMesh::System::write_SCALAR_dofs(), write_serialized_bcs(), libMesh::System::write_serialized_blocked_dof_objects(), write_serialized_connectivity(), write_serialized_nodes(), and write_serialized_nodesets().
{ return cast_int<processor_id_type>(_communicator.size()); }
| void libMesh::XdrIO::pack_element | ( | std::vector< xdr_id_type > & | conn, |
| const Elem * | elem, | ||
| const dof_id_type | parent_id = DofObject::invalid_id, |
||
| const dof_id_type | parent_pid = DofObject::invalid_id |
||
| ) | const [private] |
Pack an element into a transfer buffer for parallel communication.
Definition at line 1679 of file xdr_io.C.
References libMesh::DofObject::invalid_id, libMesh::libmesh_assert(), libMesh::Elem::n_nodes(), libMesh::Elem::node(), libMesh::Elem::p_level(), libMesh::DofObject::processor_id(), libMesh::Elem::subdomain_id(), libMesh::Elem::type(), libMesh::Elem::type_to_n_nodes_map, and libMesh::DofObject::unique_id().
Referenced by write_serialized_connectivity().
{
libmesh_assert(elem);
libmesh_assert_equal_to (elem->n_nodes(), Elem::type_to_n_nodes_map[elem->type()]);
conn.push_back(elem->n_nodes());
conn.push_back (elem->type());
// In version 0.7.0+ "id" is stored but it not used. In version 0.9.2+
// we will store unique_id instead, therefore there is no need to
// check for the older version when writing the unique_id.
conn.push_back (elem->unique_id());
if (parent_id != DofObject::invalid_id)
{
conn.push_back (parent_id);
libmesh_assert_not_equal_to (parent_pid, DofObject::invalid_id);
conn.push_back (parent_pid);
}
conn.push_back (elem->processor_id());
conn.push_back (elem->subdomain_id());
#ifdef LIBMESH_ENABLE_AMR
conn.push_back (elem->p_level());
#endif
for (unsigned int n=0; n<elem->n_nodes(); n++)
conn.push_back (elem->node(n));
}
| const std::string& libMesh::XdrIO::partition_map_file_name | ( | ) | const [inline] |
Get/Set the partitioning file name.
Definition at line 149 of file xdr_io.h.
References _partition_map_file.
Referenced by read(), read_serialized_connectivity(), write(), and write_serialized_connectivity().
{ return _partition_map_file; }
| std::string& libMesh::XdrIO::partition_map_file_name | ( | ) | [inline] |
Definition at line 150 of file xdr_io.h.
References _partition_map_file.
{ return _partition_map_file; }
| const std::string& libMesh::XdrIO::polynomial_level_file_name | ( | ) | const [inline] |
Get/Set the polynomial degree file name.
Definition at line 161 of file xdr_io.h.
References _p_level_file.
Referenced by read(), read_serialized_connectivity(), write(), and write_serialized_connectivity().
{ return _p_level_file; }
| std::string& libMesh::XdrIO::polynomial_level_file_name | ( | ) | [inline] |
| processor_id_type libMesh::ParallelObject::processor_id | ( | ) | const [inline, inherited] |
Definition at line 98 of file parallel_object.h.
References libMesh::ParallelObject::_communicator, and libMesh::Parallel::Communicator::rank().
Referenced by libMesh::MetisPartitioner::_do_partition(), libMesh::EquationSystems::_read_impl(), libMesh::SerialMesh::active_local_elements_begin(), libMesh::ParallelMesh::active_local_elements_begin(), libMesh::SerialMesh::active_local_elements_end(), libMesh::ParallelMesh::active_local_elements_end(), libMesh::SerialMesh::active_local_subdomain_elements_begin(), libMesh::ParallelMesh::active_local_subdomain_elements_begin(), libMesh::SerialMesh::active_local_subdomain_elements_end(), libMesh::ParallelMesh::active_local_subdomain_elements_end(), libMesh::SerialMesh::active_not_local_elements_begin(), libMesh::ParallelMesh::active_not_local_elements_begin(), libMesh::SerialMesh::active_not_local_elements_end(), libMesh::ParallelMesh::active_not_local_elements_end(), libMesh::ParallelMesh::add_elem(), libMesh::DofMap::add_neighbors_to_send_list(), libMesh::ParallelMesh::add_node(), libMesh::UnstructuredMesh::all_second_order(), libMesh::FEMSystem::assembly(), libMesh::ParmetisPartitioner::assign_partitioning(), libMesh::ParallelMesh::assign_unique_ids(), libMesh::EquationSystems::build_discontinuous_solution_vector(), libMesh::Nemesis_IO_Helper::build_element_and_node_maps(), libMesh::ParmetisPartitioner::build_graph(), libMesh::InfElemBuilder::build_inf_elem(), libMesh::DofMap::build_sparsity(), libMesh::ParallelMesh::clear(), libMesh::ExodusII_IO_Helper::close(), libMesh::Nemesis_IO_Helper::compute_border_node_ids(), libMesh::Nemesis_IO_Helper::compute_communication_map_parameters(), libMesh::Nemesis_IO_Helper::compute_internal_and_border_elems_and_internal_nodes(), libMesh::Nemesis_IO_Helper::compute_node_communication_maps(), libMesh::Nemesis_IO_Helper::compute_num_global_elem_blocks(), libMesh::Nemesis_IO_Helper::compute_num_global_nodesets(), libMesh::Nemesis_IO_Helper::compute_num_global_sidesets(), libMesh::Nemesis_IO_Helper::construct_nemesis_filename(), libMesh::ExodusII_IO_Helper::create(), libMesh::ParallelMesh::delete_elem(), libMesh::ParallelMesh::delete_node(), libMesh::DofMap::distribute_dofs(), libMesh::DofMap::distribute_local_dofs_node_major(), libMesh::DofMap::distribute_local_dofs_var_major(), libMesh::DofMap::end_dof(), libMesh::DofMap::end_old_dof(), libMesh::EnsightIO::EnsightIO(), libMesh::SerialMesh::facelocal_elements_begin(), libMesh::ParallelMesh::facelocal_elements_begin(), libMesh::SerialMesh::facelocal_elements_end(), libMesh::ParallelMesh::facelocal_elements_end(), libMesh::MeshFunction::find_element(), libMesh::UnstructuredMesh::find_neighbors(), libMesh::DofMap::first_dof(), libMesh::DofMap::first_old_dof(), libMesh::Nemesis_IO_Helper::get_cmap_params(), libMesh::Nemesis_IO_Helper::get_eb_info_global(), libMesh::Nemesis_IO_Helper::get_elem_cmap(), libMesh::Nemesis_IO_Helper::get_elem_map(), libMesh::MeshBase::get_info(), libMesh::Nemesis_IO_Helper::get_init_global(), libMesh::Nemesis_IO_Helper::get_init_info(), libMesh::Nemesis_IO_Helper::get_loadbal_param(), libMesh::Nemesis_IO_Helper::get_node_cmap(), libMesh::Nemesis_IO_Helper::get_node_map(), libMesh::Nemesis_IO_Helper::get_ns_param_global(), libMesh::Nemesis_IO_Helper::get_ss_param_global(), libMesh::SystemSubsetBySubdomain::init(), libMesh::ParmetisPartitioner::initialize(), libMesh::ExodusII_IO_Helper::initialize(), libMesh::ExodusII_IO_Helper::initialize_element_variables(), libMesh::ExodusII_IO_Helper::initialize_global_variables(), libMesh::ExodusII_IO_Helper::initialize_nodal_variables(), libMesh::ParallelMesh::insert_elem(), libMesh::SparsityPattern::Build::join(), libMesh::DofMap::last_dof(), libMesh::MeshTools::libmesh_assert_valid_procids< Elem >(), libMesh::MeshTools::libmesh_assert_valid_procids< Node >(), libMesh::SerialMesh::local_elements_begin(), libMesh::ParallelMesh::local_elements_begin(), libMesh::SerialMesh::local_elements_end(), libMesh::ParallelMesh::local_elements_end(), libMesh::SerialMesh::local_level_elements_begin(), libMesh::ParallelMesh::local_level_elements_begin(), libMesh::SerialMesh::local_level_elements_end(), libMesh::ParallelMesh::local_level_elements_end(), libMesh::SerialMesh::local_nodes_begin(), libMesh::ParallelMesh::local_nodes_begin(), libMesh::SerialMesh::local_nodes_end(), libMesh::ParallelMesh::local_nodes_end(), libMesh::SerialMesh::local_not_level_elements_begin(), libMesh::ParallelMesh::local_not_level_elements_begin(), libMesh::SerialMesh::local_not_level_elements_end(), libMesh::ParallelMesh::local_not_level_elements_end(), libMesh::DofMap::local_variable_indices(), libMesh::MeshRefinement::make_coarsening_compatible(), libMesh::MeshBase::n_active_local_elem(), libMesh::BoundaryInfo::n_boundary_conds(), libMesh::BoundaryInfo::n_edge_conds(), libMesh::DofMap::n_local_dofs(), libMesh::System::n_local_dofs(), libMesh::MeshBase::n_local_elem(), libMesh::MeshBase::n_local_nodes(), libMesh::BoundaryInfo::n_nodeset_conds(), libMesh::SerialMesh::not_local_elements_begin(), libMesh::ParallelMesh::not_local_elements_begin(), libMesh::SerialMesh::not_local_elements_end(), libMesh::ParallelMesh::not_local_elements_end(), libMesh::WeightedPatchRecoveryErrorEstimator::EstimateError::operator()(), libMesh::SparsityPattern::Build::operator()(), libMesh::PatchRecoveryErrorEstimator::EstimateError::operator()(), libMesh::ParallelMesh::ParallelMesh(), libMesh::System::point_gradient(), libMesh::System::point_hessian(), libMesh::System::point_value(), libMesh::System::project_vector(), libMesh::Nemesis_IO_Helper::put_cmap_params(), libMesh::Nemesis_IO_Helper::put_elem_cmap(), libMesh::Nemesis_IO_Helper::put_elem_map(), libMesh::Nemesis_IO_Helper::put_loadbal_param(), libMesh::Nemesis_IO_Helper::put_node_cmap(), libMesh::Nemesis_IO_Helper::put_node_map(), libMesh::NameBasedIO::read(), libMesh::Nemesis_IO::read(), libMesh::CheckpointIO::read(), read(), libMesh::ExodusII_IO_Helper::read_elem_num_map(), libMesh::System::read_header(), libMesh::System::read_legacy_data(), libMesh::ExodusII_IO_Helper::read_node_num_map(), libMesh::System::read_parallel_data(), libMesh::System::read_SCALAR_dofs(), read_serialized_bc_names(), read_serialized_bcs(), libMesh::System::read_serialized_blocked_dof_objects(), read_serialized_connectivity(), libMesh::System::read_serialized_data(), read_serialized_nodes(), read_serialized_nodesets(), read_serialized_subdomain_names(), libMesh::System::read_serialized_vector(), libMesh::System::read_serialized_vectors(), libMesh::MeshData::read_xdr(), libMesh::SerialMesh::semilocal_elements_begin(), libMesh::ParallelMesh::semilocal_elements_begin(), libMesh::SerialMesh::semilocal_elements_end(), libMesh::ParallelMesh::semilocal_elements_end(), libMesh::Partitioner::set_node_processor_ids(), libMesh::DofMap::set_nonlocal_dof_objects(), libMesh::LaplaceMeshSmoother::smooth(), libMesh::BoundaryInfo::sync(), libMesh::MeshTools::total_weight(), libMesh::ParallelMesh::update_parallel_id_counts(), libMesh::MeshTools::weight(), libMesh::NameBasedIO::write(), libMesh::ExodusII_IO::write(), libMesh::CheckpointIO::write(), 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_elements(), libMesh::ExodusII_IO::write_global_data(), libMesh::ExodusII_IO_Helper::write_global_values(), libMesh::System::write_header(), libMesh::ExodusII_IO::write_information_records(), libMesh::ExodusII_IO_Helper::write_information_records(), libMesh::ExodusII_IO_Helper::write_nodal_coordinates(), libMesh::UCDIO::write_nodal_data(), libMesh::ExodusII_IO::write_nodal_data(), libMesh::ExodusII_IO::write_nodal_data_discontinuous(), libMesh::ExodusII_IO_Helper::write_nodal_values(), libMesh::ExodusII_IO_Helper::write_nodesets(), libMesh::Nemesis_IO_Helper::write_nodesets(), libMesh::System::write_parallel_data(), libMesh::System::write_SCALAR_dofs(), write_serialized_bc_names(), write_serialized_bcs(), libMesh::System::write_serialized_blocked_dof_objects(), write_serialized_connectivity(), libMesh::System::write_serialized_data(), write_serialized_nodes(), write_serialized_nodesets(), write_serialized_subdomain_names(), libMesh::System::write_serialized_vector(), libMesh::System::write_serialized_vectors(), libMesh::ExodusII_IO_Helper::write_sidesets(), libMesh::Nemesis_IO_Helper::write_sidesets(), libMesh::ExodusII_IO::write_timestep(), and libMesh::ExodusII_IO_Helper::write_timestep().
{ return cast_int<processor_id_type>(_communicator.rank()); }
| void libMesh::XdrIO::read | ( | const std::string & | name | ) | [virtual] |
This method implements reading a mesh from a specified file.
We are future proofing the layout of this file by adding in size information for all stored types. TODO: All types are stored as the same size. Use the size information to pack things efficiently. For now we will assume that "type size" is how the entire file will be encoded.
Implements libMesh::MeshInput< MeshBase >.
Definition at line 1043 of file xdr_io.C.
References _field_width, binary(), boundary_condition_file_name(), libMesh::Parallel::Communicator::broadcast(), libMesh::Xdr::close(), libMesh::ParallelObject::comm(), libMesh::Xdr::data(), libMesh::DECODE, legacy(), libMesh::MeshInput< MeshBase >::mesh(), libMesh::MeshTools::n_elem(), n_nodes, libMesh::ParallelObject::n_processors(), partition_map_file_name(), polynomial_level_file_name(), libMesh::ParallelObject::processor_id(), libMesh::READ, libMesh::LegacyXdrIO::read(), read_serialized_bcs(), read_serialized_connectivity(), read_serialized_nodes(), read_serialized_nodesets(), read_serialized_subdomain_names(), libMesh::MeshBase::reserve_elem(), libMesh::MeshBase::reserve_nodes(), libMesh::MeshInput< MeshBase >::set_n_partitions(), libMesh::Partitioner::set_node_processor_ids(), libMesh::START_LOG(), subdomain_map_file_name(), and version().
Referenced by libMesh::NameBasedIO::read().
{
// Only open the file on processor 0 -- this is especially important because
// there may be an underlying bzip/bunzip going on, and multiple simultaneous
// calls will produce a race condition.
Xdr io (this->processor_id() == 0 ? name : "", this->binary() ? DECODE : READ);
// convenient reference to our mesh
MeshBase &mesh = MeshInput<MeshBase>::mesh();
// get the version string.
if (this->processor_id() == 0)
io.data (this->version());
this->comm().broadcast (this->version());
// note that for "legacy" files the first entry is an
// integer -- not a string at all.
this->legacy() = !(this->version().find("libMesh") < this->version().size());
// Check for a legacy version format.
if (this->legacy())
{
io.close();
LegacyXdrIO(mesh, this->binary()).read(name);
return;
}
START_LOG("read()","XdrIO");
std::vector<header_id_type> meta_data(10, sizeof(xdr_id_type));
// type_size, uid_size, pid_size, sid_size, p_level_size, eid_size, side_size, bid_size;
header_id_type pos=0;
const bool is_version_0_9_2 = this->version().find("0.9.2") != std::string::npos ? true : false;
if (this->processor_id() == 0)
{
io.data (meta_data[pos++]);
io.data (meta_data[pos++]);
io.data (this->boundary_condition_file_name()); // libMesh::out << "bc_file=" << this->boundary_condition_file_name() << std::endl;
io.data (this->subdomain_map_file_name()); // libMesh::out << "sid_file=" << this->subdomain_map_file_name() << std::endl;
io.data (this->partition_map_file_name()); // libMesh::out << "pid_file=" << this->partition_map_file_name() << std::endl;
io.data (this->polynomial_level_file_name()); // libMesh::out << "pl_file=" << this->polynomial_level_file_name() << std::endl;
if (is_version_0_9_2)
{
io.data (meta_data[pos++], "# type size");
io.data (meta_data[pos++], "# uid size");
io.data (meta_data[pos++], "# pid size");
io.data (meta_data[pos++], "# sid size");
io.data (meta_data[pos++], "# p-level size");
// Boundary Condition sizes
io.data (meta_data[pos++], "# eid size"); // elem id
io.data (meta_data[pos++], "# side size "); // side number
io.data (meta_data[pos++], "# bid size"); // boundary id
}
}
// broadcast the n_elems, n_nodes, and size information
this->comm().broadcast (meta_data);
this->comm().broadcast (this->boundary_condition_file_name());
this->comm().broadcast (this->subdomain_map_file_name());
this->comm().broadcast (this->partition_map_file_name());
this->comm().broadcast (this->polynomial_level_file_name());
// Tell the mesh how many nodes/elements to expect. Depending on the mesh type,
// this may allow for efficient adding of nodes/elements.
header_id_type n_elem = meta_data[0];
header_id_type n_nodes = meta_data[1];
mesh.reserve_elem(n_elem);
mesh.reserve_nodes(n_nodes);
// Our mesh is pre-partitioned as it's created
this->set_n_partitions(this->n_processors());
if (is_version_0_9_2)
_field_width = meta_data[2];
if (_field_width == 4)
{
uint32_t type_size = 0;
// read subdomain names
this->read_serialized_subdomain_names(io);
// read connectivity
this->read_serialized_connectivity (io, n_elem, meta_data, type_size);
// read the nodal locations
this->read_serialized_nodes (io, n_nodes);
// read the boundary conditions
this->read_serialized_bcs (io, type_size);
if (is_version_0_9_2)
// read the nodesets
this->read_serialized_nodesets (io, type_size);
}
else if (_field_width == 8)
{
uint64_t type_size = 0;
// read subdomain names
this->read_serialized_subdomain_names(io);
// read connectivity
this->read_serialized_connectivity (io, n_elem, meta_data, type_size);
// read the nodal locations
this->read_serialized_nodes (io, n_nodes);
// read the boundary conditions
this->read_serialized_bcs (io, type_size);
if (is_version_0_9_2)
// read the nodesets
this->read_serialized_nodesets (io, type_size);
}
STOP_LOG("read()","XdrIO");
// set the node processor ids
Partitioner::set_node_processor_ids(mesh);
}
| void libMesh::XdrIO::read_serialized_bc_names | ( | Xdr & | io, |
| BoundaryInfo & | info, | ||
| bool | is_sideset | ||
| ) | [private] |
Read boundary names information (sideset and nodeset) - NEW in 0.9.2 format
Definition at line 1634 of file xdr_io.C.
References libMesh::Parallel::Communicator::broadcast(), libMesh::ParallelObject::comm(), libMesh::Xdr::data(), libMesh::ParallelObject::processor_id(), libMesh::BoundaryInfo::set_nodeset_name_map(), libMesh::BoundaryInfo::set_sideset_name_map(), and version().
Referenced by read_serialized_bcs(), and read_serialized_nodesets().
{
const bool read_entity_info = this->version().find("0.9.2") != std::string::npos ? true : false;
if (read_entity_info)
{
header_id_type n_boundary_names = 0;
std::vector<header_id_type> boundary_ids;
std::vector<std::string> boundary_names;
// Read the sideset names
if (this->processor_id() == 0)
{
io.data(n_boundary_names);
boundary_ids.resize(n_boundary_names);
boundary_names.resize(n_boundary_names);
if (n_boundary_names)
{
io.data(boundary_ids);
io.data(boundary_names);
}
}
// Broadcast the boundary names to all processors
this->comm().broadcast(n_boundary_names);
if (n_boundary_names == 0)
return;
boundary_ids.resize(n_boundary_names);
boundary_names.resize(n_boundary_names);
this->comm().broadcast(boundary_ids);
this->comm().broadcast(boundary_names);
// Reassemble the named boundary information
std::map<boundary_id_type, std::string> & boundary_map = is_sideset ?
info.set_sideset_name_map() : info.set_nodeset_name_map();
for (unsigned int i=0; i<n_boundary_names; ++i)
boundary_map.insert(std::make_pair(boundary_ids[i], boundary_names[i]));
}
}
| void libMesh::XdrIO::read_serialized_bcs | ( | Xdr & | io, |
| T | |||
| ) | [private] |
Read the boundary conditions for a parallel, distributed mesh
Definition at line 1480 of file xdr_io.C.
References libMesh::BoundaryInfo::add_side(), boundary_condition_file_name(), libMesh::Parallel::Communicator::broadcast(), libMesh::ParallelObject::comm(), libMesh::Xdr::data(), libMesh::Xdr::data_stream(), end, libMesh::MeshTools::Generation::Private::idx(), io_blksize, libMesh::libmesh_assert(), libMesh::MeshInput< MeshBase >::mesh(), std::min(), libMesh::ParallelObject::processor_id(), read_serialized_bc_names(), and libMesh::Xdr::reading().
Referenced by read().
{
if (this->boundary_condition_file_name() == "n/a") return;
libmesh_assert (io.reading());
// convenient reference to our mesh
MeshBase &mesh = MeshInput<MeshBase>::mesh();
// and our boundary info object
BoundaryInfo &boundary_info = mesh.get_boundary_info();
// Version 0.9.2+ introduces unique ids
read_serialized_bc_names(io, boundary_info, true); // sideset names
std::vector<DofBCData> dof_bc_data;
std::vector<T> input_buffer;
header_id_type n_bcs=0;
if (this->processor_id() == 0)
io.data (n_bcs);
this->comm().broadcast (n_bcs);
for (std::size_t blk=0, first_bc=0, last_bc=0; last_bc<n_bcs; blk++)
{
first_bc = blk*io_blksize;
last_bc = std::min((blk+1)*io_blksize, std::size_t(n_bcs));
input_buffer.resize (3*(last_bc - first_bc));
if (this->processor_id() == 0)
io.data_stream (input_buffer.empty() ? NULL : &input_buffer[0],
cast_int<unsigned int>(input_buffer.size()));
this->comm().broadcast (input_buffer);
dof_bc_data.clear(); dof_bc_data.reserve (input_buffer.size()/3);
// convert the input_buffer to DofBCData to facilitate searching
for (std::size_t idx=0; idx<input_buffer.size(); idx+=3)
dof_bc_data.push_back
(DofBCData(cast_int<dof_id_type>(input_buffer[idx+0]),
cast_int<unsigned short>(input_buffer[idx+1]),
cast_int<boundary_id_type>(input_buffer[idx+2])));
input_buffer.clear();
// note that while the files *we* write should already be sorted by
// element id this is not necessarily guaranteed.
std::sort (dof_bc_data.begin(), dof_bc_data.end());
MeshBase::const_element_iterator
it = mesh.level_elements_begin(0),
end = mesh.level_elements_end(0);
// Look for BCs in this block for all the level-0 elements we have
// (not just local ones). Do this by finding all the entries
// in dof_bc_data whose elem_id match the ID of the current element.
// We cannot rely on NULL neighbors at this point since the neighbor
// data structure has not been initialized.
for (std::pair<std::vector<DofBCData>::iterator,
std::vector<DofBCData>::iterator> pos; it!=end; ++it)
#if defined(__SUNPRO_CC) || defined(__PGI)
for (pos = std::equal_range (dof_bc_data.begin(), dof_bc_data.end(), (*it)->id(), CompareIntDofBCData());
pos.first != pos.second; ++pos.first)
#else
for (pos = std::equal_range (dof_bc_data.begin(), dof_bc_data.end(), (*it)->id());
pos.first != pos.second; ++pos.first)
#endif
{
libmesh_assert_equal_to (pos.first->dof_id, (*it)->id());
libmesh_assert_less (pos.first->side, (*it)->n_sides());
boundary_info.add_side (*it, pos.first->side, pos.first->bc_id);
}
}
}
| void libMesh::XdrIO::read_serialized_connectivity | ( | Xdr & | io, |
| const dof_id_type | n_elem, | ||
| std::vector< header_id_type > & | sizes, | ||
| T | |||
| ) | [private] |
Read the connectivity for a parallel, distributed mesh
Definition at line 1224 of file xdr_io.C.
References libMesh::Elem::add_child(), libMesh::MeshBase::add_elem(), libMesh::MeshBase::add_point(), libMesh::Parallel::Communicator::broadcast(), libMesh::Elem::build(), libMesh::ParallelObject::comm(), libMesh::Xdr::data(), libMesh::Xdr::data_stream(), libMesh::Elem::dim(), libMesh::MeshBase::elem(), libMesh::MeshInput< MeshBase >::elems_of_dimension, libMesh::Elem::hack_p_level(), libMesh::Elem::INACTIVE, libMesh::DofObject::invalid_id, io_blksize, libMesh::Elem::JUST_REFINED, libMesh::libmesh_assert(), libMesh::MeshInput< MeshBase >::mesh(), libMesh::MeshBase::mesh_dimension(), std::min(), libMesh::MeshTools::n_elem(), libMesh::Elem::n_nodes(), partition_map_file_name(), polynomial_level_file_name(), libMesh::ParallelObject::processor_id(), libMesh::DofObject::processor_id(), libMesh::Xdr::reading(), libMesh::DofObject::set_id(), libMesh::MeshBase::set_mesh_dimension(), libMesh::Elem::set_node(), libMesh::Elem::set_refinement_flag(), libMesh::DofObject::set_unique_id(), libMesh::Elem::subdomain_id(), subdomain_map_file_name(), libMesh::Elem::type_to_n_nodes_map, and version().
Referenced by read().
{
libmesh_assert (io.reading());
if (!n_elem) return;
const bool
read_p_level = ("." == this->polynomial_level_file_name()),
read_partitioning = ("." == this->partition_map_file_name()),
read_subdomain_id = ("." == this->subdomain_map_file_name());
// convenient reference to our mesh
MeshBase &mesh = MeshInput<MeshBase>::mesh();
// Keep track of what kinds of elements this file contains
elems_of_dimension.clear();
elems_of_dimension.resize(4, false);
std::vector<T> conn, input_buffer(100 /* oversized ! */);
int level=-1;
// Version 0.9.2+ introduces unique ids
const size_t unique_id_size_index = 3;
const bool read_unique_id = this->version().find("0.9.2") != std::string::npos &&
sizes[unique_id_size_index] ? true : false;
T n_elem_at_level=0, n_processed_at_level=0;
for (dof_id_type blk=0, first_elem=0, last_elem=0;
last_elem<n_elem; blk++)
{
first_elem = cast_int<dof_id_type>(blk*io_blksize);
last_elem = cast_int<dof_id_type>(std::min(cast_int<std::size_t>((blk+1)*io_blksize),
cast_int<std::size_t>(n_elem)));
conn.clear();
if (this->processor_id() == 0)
for (dof_id_type e=first_elem; e<last_elem; e++, n_processed_at_level++)
{
if (n_processed_at_level == n_elem_at_level)
{
// get the number of elements to read at this level
io.data (n_elem_at_level);
n_processed_at_level = 0;
level++;
}
unsigned int pos = 0;
// get the element type,
io.data_stream (&input_buffer[pos++], 1);
if (read_unique_id)
io.data_stream (&input_buffer[pos++], 1);
// Older versions won't have this field at all (no increment on pos)
// maybe the parent
if (level)
io.data_stream (&input_buffer[pos++], 1);
else
// We can't always fit DofObject::invalid_id in an
// xdr_id_type
input_buffer[pos++] = static_cast<T>(-1);
// maybe the processor id
if (read_partitioning)
io.data_stream (&input_buffer[pos++], 1);
else
input_buffer[pos++] = 0;
// maybe the subdomain id
if (read_subdomain_id)
io.data_stream (&input_buffer[pos++], 1);
else
input_buffer[pos++] = 0;
// maybe the p level
if (read_p_level)
io.data_stream (&input_buffer[pos++], 1);
else
input_buffer[pos++] = 0;
// and all the nodes
libmesh_assert_less (pos+Elem::type_to_n_nodes_map[input_buffer[0]], input_buffer.size());
io.data_stream (&input_buffer[pos], Elem::type_to_n_nodes_map[input_buffer[0]]);
conn.insert (conn.end(),
input_buffer.begin(),
input_buffer.begin() + pos + Elem::type_to_n_nodes_map[input_buffer[0]]);
}
std::size_t conn_size = conn.size();
this->comm().broadcast(conn_size);
conn.resize (conn_size);
this->comm().broadcast (conn);
// All processors now have the connectivity for this block.
typename std::vector<T>::const_iterator it = conn.begin();
for (dof_id_type e=first_elem; e<last_elem; e++)
{
const ElemType elem_type = static_cast<ElemType>(*it); ++it;
#ifdef LIBMESH_ENABLE_UNIQUE_ID
unique_id_type unique_id = 0;
#endif
if (read_unique_id)
{
#ifdef LIBMESH_ENABLE_UNIQUE_ID
unique_id = cast_int<unique_id_type>(*it);
#endif
++it;
}
const dof_id_type parent_id =
(*it == static_cast<T>(-1)) ?
DofObject::invalid_id :
cast_int<dof_id_type>(*it);
++it;
const processor_id_type proc_id =
cast_int<processor_id_type>(*it);
++it;
const subdomain_id_type subdomain_id =
cast_int<subdomain_id_type>(*it);
++it;
#ifdef LIBMESH_ENABLE_AMR
const unsigned int p_level =
cast_int<unsigned int>(*it);
#endif
++it;
Elem *parent =
(parent_id == DofObject::invalid_id) ? NULL : mesh.elem(parent_id);
Elem *elem = Elem::build (elem_type, parent).release();
elem->set_id() = e;
#ifdef LIBMESH_ENABLE_UNIQUE_ID
elem->set_unique_id() = unique_id;
#endif
elem->processor_id() = proc_id;
elem->subdomain_id() = subdomain_id;
#ifdef LIBMESH_ENABLE_AMR
elem->hack_p_level(p_level);
if (parent)
{
parent->add_child(elem);
parent->set_refinement_flag (Elem::INACTIVE);
elem->set_refinement_flag (Elem::JUST_REFINED);
}
#endif
for (unsigned int n=0; n<elem->n_nodes(); n++, ++it)
{
const dof_id_type global_node_number =
cast_int<dof_id_type>(*it);
elem->set_node(n) =
mesh.add_point (Point(), global_node_number);
}
elems_of_dimension[elem->dim()] = true;
mesh.add_elem(elem);
}
}
// Set the mesh dimension to the largest encountered for an element
for (unsigned char i=0; i!=4; ++i)
if (elems_of_dimension[i])
mesh.set_mesh_dimension(i);
#if LIBMESH_DIM < 3
if (mesh.mesh_dimension() > LIBMESH_DIM)
libmesh_error_msg("Cannot open dimension " \
<< mesh.mesh_dimension() \
<< " mesh file when configured without " \
<< mesh.mesh_dimension() \
<< "D support.");
#endif
}
| void libMesh::XdrIO::read_serialized_nodes | ( | Xdr & | io, |
| const dof_id_type | n_nodes | ||
| ) | [private] |
Read the nodal locations for a parallel, distributed mesh
Definition at line 1404 of file xdr_io.C.
References libMesh::Parallel::Communicator::broadcast(), libMesh::ParallelObject::comm(), libMesh::Xdr::data_stream(), end, libMesh::MeshTools::Generation::Private::idx(), io_blksize, libMesh::libmesh_assert(), libMesh::MeshInput< MeshBase >::mesh(), std::min(), n_nodes, libMesh::ParallelObject::processor_id(), and libMesh::Xdr::reading().
Referenced by read().
{
libmesh_assert (io.reading());
// convenient reference to our mesh
MeshBase &mesh = MeshInput<MeshBase>::mesh();
if (!mesh.n_nodes()) return;
// At this point the elements have been read from file and placeholder nodes
// have been assigned. These nodes, however, do not have the proper (x,y,z)
// locations. This method will read all the nodes from disk, and each processor
// can then grab the individual values it needs.
// build up a list of the nodes contained in our local mesh. These are the nodes
// stored on the local processor whose (x,y,z) values need to be corrected.
std::vector<dof_id_type> needed_nodes; needed_nodes.reserve (mesh.n_nodes());
{
MeshBase::node_iterator
it = mesh.nodes_begin(),
end = mesh.nodes_end();
for (; it!=end; ++it)
needed_nodes.push_back((*it)->id());
std::sort (needed_nodes.begin(), needed_nodes.end());
// We should not have any duplicate node->id()s
libmesh_assert (std::unique(needed_nodes.begin(), needed_nodes.end()) == needed_nodes.end());
}
// Get the nodes in blocks.
std::vector<Real> coords;
std::pair<std::vector<dof_id_type>::iterator,
std::vector<dof_id_type>::iterator> pos;
pos.first = needed_nodes.begin();
for (std::size_t blk=0, first_node=0, last_node=0; last_node<n_nodes; blk++)
{
first_node = blk*io_blksize;
last_node = std::min((blk+1)*io_blksize, std::size_t(n_nodes));
coords.resize(3*(last_node - first_node));
if (this->processor_id() == 0)
io.data_stream (coords.empty() ? NULL : &coords[0],
cast_int<unsigned int>(coords.size()));
// For large numbers of processors the majority of processors at any given
// block may not actually need these data. It may be worth profiling this,
// although it is expected that disk IO will be the bottleneck
this->comm().broadcast (coords);
for (std::size_t n=first_node, idx=0; n<last_node; n++, idx+=3)
{
// first see if we need this node. use pos.first as a smart lower
// bound, this will ensure that the size of the searched range
// decreases as we match nodes.
pos = std::equal_range (pos.first, needed_nodes.end(), n);
if (pos.first != pos.second) // we need this node.
{
libmesh_assert_equal_to (*pos.first, n);
mesh.node(cast_int<dof_id_type>(n)) =
Point (coords[idx+0],
coords[idx+1],
coords[idx+2]);
}
}
}
}
| void libMesh::XdrIO::read_serialized_nodesets | ( | Xdr & | io, |
| T | |||
| ) | [private] |
Read the nodeset conditions for a parallel, distributed mesh
Definition at line 1558 of file xdr_io.C.
References libMesh::BoundaryInfo::add_node(), boundary_condition_file_name(), libMesh::Parallel::Communicator::broadcast(), libMesh::ParallelObject::comm(), libMesh::Xdr::data(), libMesh::Xdr::data_stream(), end, libMesh::MeshTools::Generation::Private::idx(), io_blksize, libMesh::libmesh_assert(), libMesh::MeshInput< MeshBase >::mesh(), std::min(), libMesh::ParallelObject::processor_id(), read_serialized_bc_names(), and libMesh::Xdr::reading().
Referenced by read().
{
if (this->boundary_condition_file_name() == "n/a") return;
libmesh_assert (io.reading());
// convenient reference to our mesh
MeshBase &mesh = MeshInput<MeshBase>::mesh();
// and our boundary info object
BoundaryInfo &boundary_info = mesh.get_boundary_info();
// Version 0.9.2+ introduces unique ids
read_serialized_bc_names(io, boundary_info, false); // nodeset names
// TODO: Make a data object that works with both the element and nodal bcs
std::vector<DofBCData> node_bc_data;
std::vector<T> input_buffer;
header_id_type n_nodesets=0;
if (this->processor_id() == 0)
io.data (n_nodesets);
this->comm().broadcast (n_nodesets);
for (std::size_t blk=0, first_bc=0, last_bc=0; last_bc<n_nodesets; blk++)
{
first_bc = blk*io_blksize;
last_bc = std::min((blk+1)*io_blksize, std::size_t(n_nodesets));
input_buffer.resize (2*(last_bc - first_bc));
if (this->processor_id() == 0)
io.data_stream (input_buffer.empty() ? NULL : &input_buffer[0],
cast_int<unsigned int>(input_buffer.size()));
this->comm().broadcast (input_buffer);
node_bc_data.clear(); node_bc_data.reserve (input_buffer.size()/2);
// convert the input_buffer to DofBCData to facilitate searching
for (std::size_t idx=0; idx<input_buffer.size(); idx+=2)
node_bc_data.push_back
(DofBCData(cast_int<dof_id_type>(input_buffer[idx+0]),
0,
cast_int<boundary_id_type>(input_buffer[idx+1])));
input_buffer.clear();
// note that while the files *we* write should already be sorted by
// node id this is not necessarily guaranteed.
std::sort (node_bc_data.begin(), node_bc_data.end());
MeshBase::const_node_iterator
it = mesh.nodes_begin(),
end = mesh.nodes_end();
// Look for BCs in this block for all nodes we have
// (not just local ones). Do this by finding all the entries
// in node_bc_data whose dof_id(node_id) match the ID of the current node.
for (std::pair<std::vector<DofBCData>::iterator,
std::vector<DofBCData>::iterator> pos; it!=end; ++it)
#if defined(__SUNPRO_CC) || defined(__PGI)
for (pos = std::equal_range (node_bc_data.begin(), node_bc_data.end(), (*it)->id(), CompareIntDofBCData());
pos.first != pos.second; ++pos.first)
#else
for (pos = std::equal_range (node_bc_data.begin(), node_bc_data.end(), (*it)->id());
pos.first != pos.second; ++pos.first)
#endif
{
// Note: dof_id from ElmeBCData is being used to hold node_id here
libmesh_assert_equal_to (pos.first->dof_id, (*it)->id());
boundary_info.add_node (*it, pos.first->bc_id);
}
}
}
| void libMesh::XdrIO::read_serialized_subdomain_names | ( | Xdr & | io | ) | [private] |
Read subdomain name information - NEW in 0.9.2 format
Definition at line 1178 of file xdr_io.C.
References libMesh::Parallel::Communicator::broadcast(), libMesh::ParallelObject::comm(), libMesh::Xdr::data(), libMesh::MeshInput< MeshBase >::mesh(), libMesh::ParallelObject::processor_id(), libMesh::MeshBase::set_subdomain_name_map(), and version().
Referenced by read().
{
const bool read_entity_info = this->version().find("0.9.2") != std::string::npos ? true : false;
if (read_entity_info)
{
MeshBase &mesh = MeshInput<MeshBase>::mesh();
unsigned int n_subdomain_names = 0;
std::vector<header_id_type> subdomain_ids;
std::vector<std::string> subdomain_names;
// Read the sideset names
if (this->processor_id() == 0)
{
io.data(n_subdomain_names);
subdomain_ids.resize(n_subdomain_names);
subdomain_names.resize(n_subdomain_names);
if (n_subdomain_names)
{
io.data(subdomain_ids);
io.data(subdomain_names);
}
}
// Broadcast the subdomain names to all processors
this->comm().broadcast(n_subdomain_names);
if (n_subdomain_names == 0)
return;
subdomain_ids.resize(n_subdomain_names);
subdomain_names.resize(n_subdomain_names);
this->comm().broadcast(subdomain_ids);
this->comm().broadcast(subdomain_names);
// Reassemble the named subdomain information
std::map<subdomain_id_type, std::string> & subdomain_map = mesh.set_subdomain_name_map();
for (unsigned int i=0; i<n_subdomain_names; ++i)
subdomain_map.insert(std::make_pair(subdomain_ids[i], subdomain_names[i]));
}
}
| void libMesh::XdrIO::set_auto_parallel | ( | ) | [inline] |
Insist that we should write parallel files if and only if the mesh is an already distributed ParallelMesh.
Definition at line 301 of file xdr_io.h.
References _write_parallel, and _write_serial.
{
this->_write_serial = false;
this->_write_parallel = false;
}
| void libMesh::MeshInput< MeshBase >::set_n_partitions | ( | unsigned int | n_parts | ) | [inline, protected, inherited] |
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 94 of file mesh_input.h.
References libMesh::MeshInput< MT >::mesh().
Referenced by libMesh::Nemesis_IO::read(), and read().
{ this->mesh().set_n_partitions() = n_parts; }
| void libMesh::XdrIO::set_write_parallel | ( | bool | do_parallel = true | ) | [inline] |
Insist that we should/shouldn't write parallel files.
Definition at line 291 of file xdr_io.h.
References _write_parallel, and _write_serial.
{
this->_write_parallel = do_parallel;
this->_write_serial = !do_parallel;
}
| void libMesh::MeshInput< MeshBase >::skip_comment_lines | ( | std::istream & | in, |
| const char | comment_start | ||
| ) | [protected, inherited] |
Reads input from in, skipping all the lines that start with the character comment_start.
Referenced by libMesh::TetGenIO::read(), and libMesh::UCDIO::read_implementation().
| const std::string& libMesh::XdrIO::subdomain_map_file_name | ( | ) | const [inline] |
Get/Set the subdomain file name.
Definition at line 155 of file xdr_io.h.
References _subdomain_map_file.
Referenced by read(), read_serialized_connectivity(), write(), and write_serialized_connectivity().
{ return _subdomain_map_file; }
| std::string& libMesh::XdrIO::subdomain_map_file_name | ( | ) | [inline] |
Definition at line 156 of file xdr_io.h.
References _subdomain_map_file.
{ return _subdomain_map_file; }
| const std::string& libMesh::XdrIO::version | ( | ) | const [inline] |
Get/Set the version string. Valid version strings:
* "libMesh-0.7.0+" * "libMesh-0.7.0+ parallel" *
If "libMesh" is not detected in the version string the LegacyXdrIO class will be used to read older (pre version 0.7.0) mesh files.
Definition at line 137 of file xdr_io.h.
References _version.
Referenced by read(), read_serialized_bc_names(), read_serialized_connectivity(), read_serialized_subdomain_names(), and write().
{ return _version; }
| std::string& libMesh::XdrIO::version | ( | ) | [inline] |
| void libMesh::XdrIO::write | ( | const std::string & | name | ) | [virtual] |
This method implements writing a mesh to a specified file.
Implements libMesh::MeshOutput< MeshBase >.
Definition at line 157 of file xdr_io.C.
References _write_parallel, _write_unique_id, libMesh::Parallel::Communicator::barrier(), binary(), boundary_condition_file_name(), libMesh::Xdr::close(), libMesh::ParallelObject::comm(), libMesh::Xdr::data(), libMesh::ENCODE, libMesh::MeshBase::get_boundary_info(), legacy(), libMesh::libmesh_assert(), libMesh::MeshInput< MeshBase >::mesh(), libMesh::BoundaryInfo::n_boundary_conds(), libMesh::BoundaryInfo::n_edge_conds(), libMesh::MeshBase::n_elem(), libMesh::MeshTools::n_elem(), n_nodes, libMesh::MeshBase::n_nodes(), libMesh::BoundaryInfo::n_nodeset_conds(), libMesh::MeshTools::n_p_levels(), libMesh::MeshBase::n_subdomains(), libMesh::out, partition_map_file_name(), polynomial_level_file_name(), libMesh::ParallelObject::processor_id(), libMesh::START_LOG(), subdomain_map_file_name(), version(), libMesh::WRITE, libMesh::LegacyXdrIO::write(), write_parallel(), write_serialized_bcs(), write_serialized_connectivity(), write_serialized_nodes(), write_serialized_nodesets(), and write_serialized_subdomain_names().
Referenced by libMesh::NameBasedIO::write().
{
if (this->legacy())
{
libmesh_deprecated();
// We don't support writing parallel files in the legacy format
libmesh_assert(!this->_write_parallel);
LegacyXdrIO(MeshOutput<MeshBase>::mesh(), this->binary()).write(name);
return;
}
Xdr io ((this->processor_id() == 0) ? name : "", this->binary() ? ENCODE : WRITE);
START_LOG("write()","XdrIO");
// convenient reference to our mesh
const MeshBase &mesh = MeshOutput<MeshBase>::mesh();
header_id_type
n_elem = mesh.n_elem(),
n_nodes = mesh.n_nodes();
libmesh_assert(n_elem == mesh.n_elem());
libmesh_assert(n_nodes == mesh.n_nodes());
header_id_type n_bcs =
cast_int<header_id_type>(mesh.get_boundary_info().n_boundary_conds());
header_id_type n_nodesets =
cast_int<header_id_type>(mesh.get_boundary_info().n_nodeset_conds());
unsigned int
n_p_levels = MeshTools::n_p_levels (mesh);
bool write_parallel_files = this->write_parallel();
//-------------------------------------------------------------
// For all the optional files -- the default file name is "n/a".
// However, the user may specify an optional external file.
// If there are BCs and the user has not already provided a
// file name then write to "."
if ((n_bcs || n_nodesets) &&
this->boundary_condition_file_name() == "n/a")
this->boundary_condition_file_name() = ".";
// If there are more than one subdomains and the user has not specified an
// external file then write the subdomain mapping to the default file "."
if ((mesh.n_subdomains() > 0) &&
(this->subdomain_map_file_name() == "n/a"))
this->subdomain_map_file_name() = ".";
// In general we don't write the partition information.
// If we have p levels and the user has not already provided
// a file name then write to "."
if ((n_p_levels > 1) &&
(this->polynomial_level_file_name() == "n/a"))
this->polynomial_level_file_name() = ".";
// write the header
if (this->processor_id() == 0)
{
std::string full_ver = this->version() + (write_parallel_files ? " parallel" : "");
io.data (full_ver);
io.data (n_elem, "# number of elements");
io.data (n_nodes, "# number of nodes");
io.data (this->boundary_condition_file_name(), "# boundary condition specification file");
io.data (this->subdomain_map_file_name(), "# subdomain id specification file");
io.data (this->partition_map_file_name(), "# processor id specification file");
io.data (this->polynomial_level_file_name(), "# p-level specification file");
// Version 0.9.2+ introduces sizes for each type
header_id_type write_size = sizeof(xdr_id_type), zero_size = 0;
const bool
write_p_level = ("." == this->polynomial_level_file_name()),
write_partitioning = ("." == this->partition_map_file_name()),
write_subdomain_id = ("." == this->subdomain_map_file_name()),
write_bcs = ("." == this->boundary_condition_file_name());
io.data (write_size, "# type size");
io.data (_write_unique_id ? write_size : zero_size, "# uid size");
io.data (write_partitioning ? write_size : zero_size, "# pid size");
io.data (write_subdomain_id ? write_size : zero_size, "# sid size");
io.data (write_p_level ? write_size : zero_size, "# p-level size");
// Boundary Condition sizes
io.data (write_bcs ? write_size : zero_size, "# eid size"); // elem id
io.data (write_bcs ? write_size : zero_size, "# side size "); // side number
io.data (write_bcs ? write_size : zero_size, "# bid size"); // boundary id
}
if (write_parallel_files)
{
// Parallel xdr mesh files aren't implemented yet; until they
// are we'll just warn the user and write a serial file.
libMesh::out << "Warning! Parallel xda/xdr is not yet implemented.\n";
libMesh::out << "Writing a serialized file instead." << std::endl;
// write subdomain names
this->write_serialized_subdomain_names(io);
// write connectivity
this->write_serialized_connectivity (io, n_elem);
// write the nodal locations
this->write_serialized_nodes (io, n_nodes);
// write the boundary condition information
this->write_serialized_bcs (io, n_bcs);
// write the nodeset information
this->write_serialized_nodesets (io, n_nodesets);
}
else
{
// write subdomain names
this->write_serialized_subdomain_names(io);
// write connectivity
this->write_serialized_connectivity (io, n_elem);
// write the nodal locations
this->write_serialized_nodes (io, n_nodes);
// write the boundary condition information
this->write_serialized_bcs (io, n_bcs);
// write the nodeset information
this->write_serialized_nodesets (io, n_nodesets);
}
if(mesh.get_boundary_info().n_edge_conds() > 0)
{
libMesh::out << "Warning: Mesh contains edge boundary IDs, but these "
<< "are not supported by the XDR format."
<< std::endl;
}
STOP_LOG("write()","XdrIO");
// pause all processes until the writing ends -- this will
// protect for the pathological case where a write is
// followed immediately by a read. The write must be
// guaranteed to complete first.
io.close();
this->comm().barrier();
}
| virtual void libMesh::MeshOutput< MeshBase >::write_equation_systems | ( | const std::string & | , |
| const EquationSystems & | , | ||
| const std::set< std::string > * | system_names = NULL |
||
| ) | [virtual, inherited] |
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.
Referenced by libMesh::Nemesis_IO::write_timestep(), and libMesh::ExodusII_IO::write_timestep().
| virtual void libMesh::MeshOutput< MeshBase >::write_nodal_data | ( | const std::string & | , |
| const std::vector< Number > & | , | ||
| const std::vector< std::string > & | |||
| ) | [inline, virtual, inherited] |
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::ExodusII_IO, libMesh::GMVIO, libMesh::NameBasedIO, libMesh::GmshIO, libMesh::Nemesis_IO, libMesh::VTKIO, libMesh::UCDIO, libMesh::MEDITIO, libMesh::GnuPlotIO, and libMesh::TecplotIO.
Definition at line 98 of file mesh_output.h.
{ libmesh_not_implemented(); }
| bool libMesh::XdrIO::write_parallel | ( | ) | const [inline] |
Report whether we should write parallel files.
Definition at line 270 of file xdr_io.h.
References _write_parallel, _write_serial, libMesh::MeshBase::is_serial(), libMesh::libmesh_assert(), and libMesh::MeshInput< MeshBase >::mesh().
Referenced by write().
{
// We can't insist on both serial and parallel
libmesh_assert (!this->_write_serial || !this->_write_parallel);
// If we insisted on serial, do that
if (this->_write_serial)
return false;
// If we insisted on parallel, do that
if (this->_write_parallel)
return true;
// If we're doing things automatically, check the mesh
const MeshBase &mesh = MeshOutput<MeshBase>::mesh();
return !mesh.is_serial();
}
| void libMesh::XdrIO::write_serialized_bc_names | ( | Xdr & | io, |
| const BoundaryInfo & | info, | ||
| bool | is_sideset | ||
| ) | const [private] |
Write boundary names information (sideset and nodeset) - NEW in 0.9.2 format
Definition at line 1003 of file xdr_io.C.
References libMesh::Xdr::data(), libMesh::BoundaryInfo::get_nodeset_name_map(), libMesh::BoundaryInfo::get_sideset_name_map(), and libMesh::ParallelObject::processor_id().
Referenced by write_serialized_bcs(), and write_serialized_nodesets().
{
if (this->processor_id() == 0)
{
const std::map<boundary_id_type, std::string> & boundary_map = is_sideset ?
info.get_sideset_name_map() : info.get_nodeset_name_map();
std::vector<header_id_type> boundary_ids; boundary_ids.reserve(boundary_map.size());
std::vector<std::string> boundary_names; boundary_names.reserve(boundary_map.size());
// We need to loop over the map and make sure that there aren't any invalid entries. Since we
// return writable references in boundary_info, it's possible for the user to leave some entity names
// blank. We can't write those to the XDA file.
header_id_type n_boundary_names = 0;
std::map<boundary_id_type, std::string>::const_iterator it_end = boundary_map.end();
for (std::map<boundary_id_type, std::string>::const_iterator it = boundary_map.begin(); it != it_end; ++it)
{
if (!it->second.empty())
{
n_boundary_names++;
boundary_ids.push_back(it->first);
boundary_names.push_back(it->second);
}
}
if (is_sideset)
io.data(n_boundary_names, "# sideset id to name map");
else
io.data(n_boundary_names, "# nodeset id to name map");
// Write out the ids and names in two vectors
if (n_boundary_names)
{
io.data(boundary_ids);
io.data(boundary_names);
}
}
}
| void libMesh::XdrIO::write_serialized_bcs | ( | Xdr & | io, |
| const header_id_type | n_bcs | ||
| ) | const [private] |
Write the boundary conditions for a parallel, distributed mesh
Definition at line 835 of file xdr_io.C.
References bc_id, libMesh::BoundaryInfo::boundary_ids(), libMesh::ParallelObject::comm(), libMesh::Xdr::data(), libMesh::Xdr::data_stream(), end, libMesh::Parallel::Communicator::gather(), libMesh::MeshTools::Generation::Private::idx(), libMesh::BoundaryInfo::invalid_id, libMesh::libmesh_assert(), libMesh::MeshInput< MeshBase >::mesh(), libMesh::ParallelObject::n_processors(), libMesh::Elem::n_sides(), libMesh::ParallelObject::processor_id(), libMesh::Parallel::Communicator::receive(), libMesh::Parallel::Communicator::send(), write_serialized_bc_names(), and libMesh::Xdr::writing().
Referenced by write().
{
libmesh_assert (io.writing());
// convenient reference to our mesh
const MeshBase &mesh = MeshOutput<MeshBase>::mesh();
// and our boundary info object
const BoundaryInfo &boundary_info = mesh.get_boundary_info();
// Version 0.9.2+ introduces entity names
write_serialized_bc_names(io, boundary_info, true); // sideset names
header_id_type n_bcs_out = n_bcs;
if (this->processor_id() == 0)
io.data (n_bcs_out, "# number of boundary conditions");
n_bcs_out = 0;
if (!n_bcs) return;
std::vector<xdr_id_type> xfer_bcs, recv_bcs;
std::vector<std::size_t> bc_sizes(this->n_processors());
// Boundary conditions are only specified for level-0 elements
MeshBase::const_element_iterator
it = mesh.local_level_elements_begin(0),
end = mesh.local_level_elements_end(0);
dof_id_type n_local_level_0_elem=0;
for (; it!=end; ++it, n_local_level_0_elem++)
{
const Elem *elem = *it;
for (unsigned short s=0; s<elem->n_sides(); s++)
// We're supporting boundary ids on internal sides now
//if (elem->neighbor(s) == NULL)
{
const std::vector<boundary_id_type>& bc_ids =
boundary_info.boundary_ids (elem, s);
for (std::vector<boundary_id_type>::const_iterator id_it=bc_ids.begin(); id_it!=bc_ids.end(); ++id_it)
{
const boundary_id_type bc_id = *id_it;
if (bc_id != BoundaryInfo::invalid_id)
{
xfer_bcs.push_back (n_local_level_0_elem);
xfer_bcs.push_back (s) ;
xfer_bcs.push_back (bc_id);
}
}
}
}
xfer_bcs.push_back(n_local_level_0_elem);
std::size_t my_size = xfer_bcs.size();
this->comm().gather (0, my_size, bc_sizes);
// All processors send their xfer buffers to processor 0
// Processor 0 will receive all buffers and write out the bcs
if (this->processor_id() == 0)
{
dof_id_type elem_offset = 0;
for (unsigned int pid=0; pid<this->n_processors(); pid++)
{
recv_bcs.resize(bc_sizes[pid]);
if (pid == 0)
recv_bcs = xfer_bcs;
else
this->comm().receive (pid, recv_bcs);
const dof_id_type my_n_local_level_0_elem
= cast_int<dof_id_type>(recv_bcs.back());
recv_bcs.pop_back();
for (std::size_t idx=0; idx<recv_bcs.size(); idx += 3, n_bcs_out++)
recv_bcs[idx+0] += elem_offset;
io.data_stream (recv_bcs.empty() ? NULL : &recv_bcs[0],
cast_int<unsigned int>(recv_bcs.size()), 3);
elem_offset += my_n_local_level_0_elem;
}
libmesh_assert_equal_to (n_bcs, n_bcs_out);
}
else
this->comm().send (0, xfer_bcs);
}
| void libMesh::XdrIO::write_serialized_connectivity | ( | Xdr & | io, |
| const dof_id_type | n_elem | ||
| ) | const [private] |
Write the connectivity for a parallel, distributed mesh
Definition at line 348 of file xdr_io.C.
References _write_unique_id, libMesh::Elem::child(), libMesh::ParallelObject::comm(), libMesh::Xdr::data(), libMesh::Xdr::data_stream(), end, libMesh::Parallel::Communicator::gather(), libMesh::DofObject::id(), libMesh::libmesh_assert(), libMesh::MeshBase::local_elements_end(), libMesh::MeshBase::local_level_elements_begin(), libMesh::MeshBase::local_level_elements_end(), libMesh::MeshInput< MeshBase >::mesh(), libMesh::MeshTools::n_active_levels(), libMesh::Elem::n_children(), libMesh::MeshBase::n_elem(), libMesh::MeshTools::n_elem(), n_nodes, libMesh::ParallelObject::n_processors(), pack_element(), partition_map_file_name(), polynomial_level_file_name(), libMesh::ParallelObject::processor_id(), libMesh::DofObject::processor_id(), libMesh::Parallel::Communicator::receive(), libMesh::Parallel::Communicator::send(), libMesh::Parallel::Communicator::send_receive(), subdomain_map_file_name(), libMesh::Parallel::Communicator::sum(), and libMesh::Xdr::writing().
Referenced by write().
{
libmesh_assert (io.writing());
const bool
write_p_level = ("." == this->polynomial_level_file_name()),
write_partitioning = ("." == this->partition_map_file_name()),
write_subdomain_id = ("." == this->subdomain_map_file_name());
// convenient reference to our mesh
const MeshBase &mesh = MeshOutput<MeshBase>::mesh();
libmesh_assert_equal_to (n_elem, mesh.n_elem());
// We will only write active elements and their parents.
const unsigned int n_active_levels = MeshTools::n_active_levels (mesh);
std::vector<xdr_id_type> n_global_elem_at_level(n_active_levels);
MeshBase::const_element_iterator it = mesh.local_elements_end(), end=it;
// Find the number of local and global elements at each level
#ifndef NDEBUG
xdr_id_type tot_n_elem = 0;
#endif
for (unsigned int level=0; level<n_active_levels; level++)
{
it = mesh.local_level_elements_begin(level);
end = mesh.local_level_elements_end(level);
n_global_elem_at_level[level] = MeshTools::n_elem(it, end);
this->comm().sum(n_global_elem_at_level[level]);
#ifndef NDEBUG
tot_n_elem += n_global_elem_at_level[level];
#endif
libmesh_assert_less_equal (n_global_elem_at_level[level], n_elem);
libmesh_assert_less_equal (tot_n_elem, n_elem);
}
std::vector<xdr_id_type>
xfer_conn, recv_conn;
std::vector<dof_id_type>
n_elem_on_proc(this->n_processors()), processor_offsets(this->n_processors());
std::vector<xdr_id_type> output_buffer;
std::vector<std::size_t>
xfer_buf_sizes(this->n_processors());
#ifdef LIBMESH_ENABLE_AMR
typedef std::map<dof_id_type, std::pair<processor_id_type, dof_id_type> > id_map_type;
id_map_type parent_id_map, child_id_map;
#endif
dof_id_type my_next_elem=0, next_global_elem=0;
//-------------------------------------------
// First write the level-0 elements directly.
it = mesh.local_level_elements_begin(0);
end = mesh.local_level_elements_end(0);
for (; it != end; ++it, ++my_next_elem)
{
pack_element (xfer_conn, *it);
#ifdef LIBMESH_ENABLE_AMR
parent_id_map[(*it)->id()] = std::make_pair(this->processor_id(),
my_next_elem);
#endif
}
xfer_conn.push_back(my_next_elem); // toss in the number of elements transferred.
std::size_t my_size = xfer_conn.size();
this->comm().gather (0, my_next_elem, n_elem_on_proc);
this->comm().gather (0, my_size, xfer_buf_sizes);
processor_offsets[0] = 0;
for (unsigned int pid=1; pid<this->n_processors(); pid++)
processor_offsets[pid] = processor_offsets[pid-1] + n_elem_on_proc[pid-1];
// All processors send their xfer buffers to processor 0.
// Processor 0 will receive the data and write out the elements.
if (this->processor_id() == 0)
{
// Write the number of elements at this level.
{
std::string comment = "# n_elem at level 0", legend = ", [ type ";
if (_write_unique_id)
legend += "uid ";
if (write_partitioning)
legend += "pid ";
if (write_subdomain_id)
legend += "sid ";
if (write_p_level)
legend += "p_level ";
legend += "(n0 ... nN-1) ]";
comment += legend;
io.data (n_global_elem_at_level[0], comment.c_str());
}
for (unsigned int pid=0; pid<this->n_processors(); pid++)
{
recv_conn.resize(xfer_buf_sizes[pid]);
if (pid == 0)
recv_conn = xfer_conn;
else
this->comm().receive (pid, recv_conn);
// at a minimum, the buffer should contain the number of elements,
// which could be 0.
libmesh_assert (!recv_conn.empty());
{
const xdr_id_type n_elem_received = recv_conn.back();
std::vector<xdr_id_type>::const_iterator recv_conn_iter = recv_conn.begin();
for (xdr_id_type elem=0; elem<n_elem_received; elem++, next_global_elem++)
{
output_buffer.clear();
const xdr_id_type n_nodes = *recv_conn_iter; ++recv_conn_iter;
output_buffer.push_back(*recv_conn_iter); /* type */ ++recv_conn_iter;
if (_write_unique_id)
output_buffer.push_back(*recv_conn_iter); /* unique_id */ ++recv_conn_iter;
if (write_partitioning)
output_buffer.push_back(*recv_conn_iter); /* processor id */ ++recv_conn_iter;
if (write_subdomain_id)
output_buffer.push_back(*recv_conn_iter); /* subdomain id */ ++recv_conn_iter;
#ifdef LIBMESH_ENABLE_AMR
if (write_p_level)
output_buffer.push_back(*recv_conn_iter); /* p level */ ++recv_conn_iter;
#endif
for (dof_id_type node=0; node<n_nodes; node++, ++recv_conn_iter)
output_buffer.push_back(*recv_conn_iter);
io.data_stream
(&output_buffer[0],
cast_int<unsigned int>(output_buffer.size()),
cast_int<unsigned int>(output_buffer.size()));
}
}
}
}
else
this->comm().send (0, xfer_conn);
#ifdef LIBMESH_ENABLE_AMR
//--------------------------------------------------------------------
// Next write the remaining elements indirectly through their parents.
// This will insure that the children are written in the proper order
// so they can be reconstructed properly.
for (unsigned int level=1; level<n_active_levels; level++)
{
xfer_conn.clear();
it = mesh.local_level_elements_begin(level-1);
end = mesh.local_level_elements_end (level-1);
dof_id_type my_n_elem_written_at_level = 0;
for (; it != end; ++it)
if (!(*it)->active()) // we only want the parents elements at this level, and
{ // there is no direct iterator for this obscure use
const Elem *parent = *it;
id_map_type::iterator pos = parent_id_map.find(parent->id());
libmesh_assert (pos != parent_id_map.end());
const processor_id_type parent_pid = pos->second.first;
const dof_id_type parent_id = pos->second.second;
parent_id_map.erase(pos);
for (unsigned int c=0; c<parent->n_children(); c++, my_next_elem++)
{
const Elem *child = parent->child(c);
pack_element (xfer_conn, child, parent_id, parent_pid);
// this aproach introduces the possibility that we write
// non-local elements. These elements may well be parents
// at the next step
child_id_map[child->id()] = std::make_pair (child->processor_id(),
my_n_elem_written_at_level++);
}
}
xfer_conn.push_back(my_n_elem_written_at_level);
my_size = xfer_conn.size();
this->comm().gather (0, my_size, xfer_buf_sizes);
// Processor 0 will receive the data and write the elements.
if (this->processor_id() == 0)
{
// Write the number of elements at this level.
{
char buf[80];
std::sprintf(buf, "# n_elem at level %u", level);
std::string comment(buf), legend = ", [ type ";
if (_write_unique_id)
legend += "uid ";
legend += "parent ";
if (write_partitioning)
legend += "pid ";
if (write_subdomain_id)
legend += "sid ";
if (write_p_level)
legend += "p_level ";
legend += "(n0 ... nN-1) ]";
comment += legend;
io.data (n_global_elem_at_level[level], comment.c_str());
}
for (unsigned int pid=0; pid<this->n_processors(); pid++)
{
recv_conn.resize(xfer_buf_sizes[pid]);
if (pid == 0)
recv_conn = xfer_conn;
else
this->comm().receive (pid, recv_conn);
// at a minimum, the buffer should contain the number of elements,
// which could be 0.
libmesh_assert (!recv_conn.empty());
{
const xdr_id_type n_elem_received = recv_conn.back();
std::vector<xdr_id_type>::const_iterator recv_conn_iter = recv_conn.begin();
for (xdr_id_type elem=0; elem<n_elem_received; elem++, next_global_elem++)
{
output_buffer.clear();
const xdr_id_type n_nodes = *recv_conn_iter; ++recv_conn_iter;
output_buffer.push_back(*recv_conn_iter); /* type */ ++recv_conn_iter;
if (_write_unique_id)
output_buffer.push_back(*recv_conn_iter); /* unique_id */ ++recv_conn_iter;
const xdr_id_type parent_local_id = *recv_conn_iter; ++recv_conn_iter;
const xdr_id_type parent_pid = *recv_conn_iter; ++recv_conn_iter;
output_buffer.push_back (parent_local_id+processor_offsets[parent_pid]);
if (write_partitioning)
output_buffer.push_back(*recv_conn_iter); /* processor id */ ++recv_conn_iter;
if (write_subdomain_id)
output_buffer.push_back(*recv_conn_iter); /* subdomain id */ ++recv_conn_iter;
if (write_p_level)
output_buffer.push_back(*recv_conn_iter); /* p level */ ++recv_conn_iter;
for (xdr_id_type node=0; node<n_nodes; node++, ++recv_conn_iter)
output_buffer.push_back(*recv_conn_iter);
io.data_stream
(&output_buffer[0],
cast_int<unsigned int>(output_buffer.size()),
cast_int<unsigned int>(output_buffer.size()));
}
}
}
}
else
this->comm().send (0, xfer_conn);
// update the processor_offsets
processor_offsets[0] = processor_offsets.back() + n_elem_on_proc.back();
this->comm().gather (0, my_n_elem_written_at_level, n_elem_on_proc);
for (unsigned int pid=1; pid<this->n_processors(); pid++)
processor_offsets[pid] = processor_offsets[pid-1] + n_elem_on_proc[pid-1];
// Now, at the next level we will again iterate over local parents. However,
// those parents may have been written by other processors (at this step),
// so we need to gather them into our *_id_maps.
{
std::vector<std::vector<dof_id_type> > requested_ids(this->n_processors());
std::vector<dof_id_type> request_to_fill;
it = mesh.local_level_elements_begin(level);
end = mesh.local_level_elements_end(level);
for (; it!=end; ++it)
if (!child_id_map.count((*it)->id()))
{
libmesh_assert_not_equal_to ((*it)->parent()->processor_id(), this->processor_id());
requested_ids[(*it)->parent()->processor_id()].push_back((*it)->id());
}
// Next set the child_ids
for (unsigned int p=1; p != this->n_processors(); ++p)
{
// Trade my requests with processor procup and procdown
unsigned int procup = (this->processor_id() + p) %
this->n_processors();
unsigned int procdown = (this->n_processors() +
this->processor_id() - p) %
this->n_processors();
this->comm().send_receive(procup, requested_ids[procup],
procdown, request_to_fill);
// Fill those requests by overwriting the requested ids
for (std::size_t i=0; i<request_to_fill.size(); i++)
{
libmesh_assert (child_id_map.count(request_to_fill[i]));
libmesh_assert_equal_to (child_id_map[request_to_fill[i]].first, procdown);
request_to_fill[i] = child_id_map[request_to_fill[i]].second;
}
// Trade back the results
std::vector<dof_id_type> filled_request;
this->comm().send_receive(procdown, request_to_fill,
procup, filled_request);
libmesh_assert_equal_to (filled_request.size(), requested_ids[procup].size());
for (std::size_t i=0; i<filled_request.size(); i++)
child_id_map[requested_ids[procup][i]] =
std::make_pair (procup,
filled_request[i]);
}
// overwrite the parent_id_map with the child_id_map, but
// use std::map::swap() for efficiency.
parent_id_map.swap(child_id_map); child_id_map.clear();
}
}
#endif // LIBMESH_ENABLE_AMR
if (this->processor_id() == 0)
libmesh_assert_equal_to (next_global_elem, n_elem);
}
| void libMesh::XdrIO::write_serialized_nodes | ( | Xdr & | io, |
| const dof_id_type | n_nodes | ||
| ) | const [private] |
Write the nodal locations for a parallel, distributed mesh
Definition at line 676 of file xdr_io.C.
References libMesh::ParallelObject::comm(), libMesh::Xdr::data_stream(), end, libMesh::Parallel::Communicator::gather(), libMesh::Parallel::Communicator::get_unique_tag(), libMesh::MeshTools::Generation::Private::idx(), io_blksize, libMesh::MeshBase::local_nodes_begin(), libMesh::MeshBase::local_nodes_end(), libMesh::MeshInput< MeshBase >::mesh(), std::min(), n_nodes, libMesh::MeshBase::n_nodes(), libMesh::ParallelObject::n_processors(), libMesh::ParallelObject::processor_id(), libMesh::Parallel::Communicator::receive(), libMesh::Parallel::Communicator::send(), and libMesh::Parallel::wait().
Referenced by write().
{
// convenient reference to our mesh
const MeshBase &mesh = MeshOutput<MeshBase>::mesh();
libmesh_assert_equal_to (n_nodes, mesh.n_nodes());
std::vector<dof_id_type> xfer_ids;
std::vector<Real> xfer_coords, &coords=xfer_coords;
std::vector<std::vector<dof_id_type> > recv_ids (this->n_processors());;
std::vector<std::vector<Real> > recv_coords(this->n_processors());
std::size_t n_written=0;
for (std::size_t blk=0, last_node=0; last_node<n_nodes; blk++)
{
const std::size_t first_node = blk*io_blksize;
last_node = std::min((blk+1)*io_blksize, std::size_t(n_nodes));
// Build up the xfer buffers on each processor
MeshBase::const_node_iterator
it = mesh.local_nodes_begin(),
end = mesh.local_nodes_end();
xfer_ids.clear(); xfer_coords.clear();
for (; it!=end; ++it)
if (((*it)->id() >= first_node) && // node in [first_node, last_node)
((*it)->id() < last_node))
{
xfer_ids.push_back((*it)->id());
const Point &p = **it;
xfer_coords.push_back(p(0));
#if LIBMESH_DIM > 1
xfer_coords.push_back(p(1));
#endif
#if LIBMESH_DIM > 2
xfer_coords.push_back(p(2));
#endif
}
//-------------------------------------
// Send the xfer buffers to processor 0
std::vector<std::size_t> ids_size, coords_size;
const std::size_t my_ids_size = xfer_ids.size();
// explicitly gather ids_size
this->comm().gather (0, my_ids_size, ids_size);
// infer coords_size on processor 0
if (this->processor_id() == 0)
{
coords_size.reserve(this->n_processors());
for (std::size_t p=0; p<ids_size.size(); p++)
coords_size.push_back(LIBMESH_DIM*ids_size[p]);
}
// We will have lots of simultaneous receives if we are
// processor 0, so let's use nonblocking receives.
std::vector<Parallel::Request>
id_request_handles(this->n_processors()-1),
coord_request_handles(this->n_processors()-1);
Parallel::MessageTag
id_tag = mesh.comm().get_unique_tag(1234),
coord_tag = mesh.comm().get_unique_tag(1235);
// Post the receives -- do this on processor 0 only.
if (this->processor_id() == 0)
{
for (unsigned int pid=0; pid<this->n_processors(); pid++)
{
recv_ids[pid].resize(ids_size[pid]);
recv_coords[pid].resize(coords_size[pid]);
if (pid == 0)
{
recv_ids[0] = xfer_ids;
recv_coords[0] = xfer_coords;
}
else
{
this->comm().receive (pid, recv_ids[pid],
id_request_handles[pid-1],
id_tag);
this->comm().receive (pid, recv_coords[pid],
coord_request_handles[pid-1],
coord_tag);
}
}
}
else
{
// Send -- do this on all other processors.
this->comm().send(0, xfer_ids, id_tag);
this->comm().send(0, xfer_coords, coord_tag);
}
// -------------------------------------------------------
// Receive the messages and write the output on processor 0.
if (this->processor_id() == 0)
{
// Wait for all the receives to complete. We have no
// need for the statuses since we already know the
// buffer sizes.
Parallel::wait (id_request_handles);
Parallel::wait (coord_request_handles);
// Write the coordinates in this block.
std::size_t tot_id_size=0;
#ifndef NDEBUG
std::size_t tot_coord_size=0;
#endif
for (unsigned int pid=0; pid<this->n_processors(); pid++)
{
tot_id_size += recv_ids[pid].size();
#ifndef NDEBUG
tot_coord_size += recv_coords[pid].size();
#endif
}
libmesh_assert_less_equal
(tot_id_size, std::min(io_blksize, std::size_t(n_nodes)));
libmesh_assert_equal_to (tot_coord_size, LIBMESH_DIM*tot_id_size);
coords.resize (3*tot_id_size);
for (unsigned int pid=0; pid<this->n_processors(); pid++)
for (std::size_t idx=0; idx<recv_ids[pid].size(); idx++)
{
const std::size_t local_idx = recv_ids[pid][idx] - first_node;
libmesh_assert_less ((3*local_idx+2), coords.size());
libmesh_assert_less ((LIBMESH_DIM*idx+LIBMESH_DIM-1), recv_coords[pid].size());
coords[3*local_idx+0] = recv_coords[pid][LIBMESH_DIM*idx+0];
#if LIBMESH_DIM > 1
coords[3*local_idx+1] = recv_coords[pid][LIBMESH_DIM*idx+1];
#else
coords[3*local_idx+1] = 0.;
#endif
#if LIBMESH_DIM > 2
coords[3*local_idx+2] = recv_coords[pid][LIBMESH_DIM*idx+2];
#else
coords[3*local_idx+2] = 0.;
#endif
n_written++;
}
io.data_stream (coords.empty() ? NULL : &coords[0],
cast_int<unsigned int>(coords.size()), 3);
}
}
if (this->processor_id() == 0)
libmesh_assert_equal_to (n_written, n_nodes);
}
| void libMesh::XdrIO::write_serialized_nodesets | ( | Xdr & | io, |
| const header_id_type | n_nodesets | ||
| ) | const [private] |
Write the boundary conditions for a parallel, distributed mesh
Definition at line 923 of file xdr_io.C.
References bc_id, libMesh::BoundaryInfo::boundary_ids(), libMesh::ParallelObject::comm(), libMesh::Xdr::data(), libMesh::Xdr::data_stream(), end, libMesh::Parallel::Communicator::gather(), libMesh::MeshTools::Generation::Private::idx(), libMesh::BoundaryInfo::invalid_id, libMesh::libmesh_assert(), libMesh::MeshInput< MeshBase >::mesh(), libMesh::ParallelObject::n_processors(), libMesh::ParallelObject::processor_id(), libMesh::Parallel::Communicator::receive(), libMesh::Parallel::Communicator::send(), write_serialized_bc_names(), and libMesh::Xdr::writing().
Referenced by write().
{
libmesh_assert (io.writing());
// convenient reference to our mesh
const MeshBase &mesh = MeshOutput<MeshBase>::mesh();
// and our boundary info object
const BoundaryInfo &boundary_info = mesh.get_boundary_info();
// Version 0.9.2+ introduces entity names
write_serialized_bc_names(io, boundary_info, false); // nodeset names
header_id_type n_nodesets_out = n_nodesets;
if (this->processor_id() == 0)
io.data (n_nodesets_out, "# number of nodesets");
n_nodesets_out = 0;
if (!n_nodesets) return;
std::vector<xdr_id_type> xfer_bcs, recv_bcs;
std::vector<std::size_t> bc_sizes(this->n_processors());
MeshBase::const_node_iterator
it = mesh.local_nodes_begin(),
end = mesh.local_nodes_end();
dof_id_type n_node=0;
for (; it!=end; ++it)
{
const Node *node = *it;
const std::vector<boundary_id_type>& nodeset_ids =
boundary_info.boundary_ids (node);
for (std::vector<boundary_id_type>::const_iterator id_it=nodeset_ids.begin(); id_it!=nodeset_ids.end(); ++id_it)
{
const boundary_id_type bc_id = *id_it;
if (bc_id != BoundaryInfo::invalid_id)
{
xfer_bcs.push_back ((*it)->id());
xfer_bcs.push_back (bc_id);
}
}
}
xfer_bcs.push_back(n_node);
std::size_t my_size = xfer_bcs.size();
this->comm().gather (0, my_size, bc_sizes);
// All processors send their xfer buffers to processor 0
// Processor 0 will receive all buffers and write out the bcs
if (this->processor_id() == 0)
{
dof_id_type node_offset = 0;
for (unsigned int pid=0; pid<this->n_processors(); pid++)
{
recv_bcs.resize(bc_sizes[pid]);
if (pid == 0)
recv_bcs = xfer_bcs;
else
this->comm().receive (pid, recv_bcs);
const dof_id_type my_n_node =
cast_int<dof_id_type>(recv_bcs.back());
recv_bcs.pop_back();
for (std::size_t idx=0; idx<recv_bcs.size(); idx += 2, n_nodesets_out++)
recv_bcs[idx+0] += node_offset;
io.data_stream (recv_bcs.empty() ? NULL : &recv_bcs[0],
cast_int<unsigned int>(recv_bcs.size()), 2);
node_offset += my_n_node;
}
libmesh_assert_equal_to (n_nodesets, n_nodesets_out);
}
else
this->comm().send (0, xfer_bcs);
}
| void libMesh::XdrIO::write_serialized_subdomain_names | ( | Xdr & | io | ) | const [private] |
Write subdomain name information - NEW in 0.9.2 format
Definition at line 310 of file xdr_io.C.
References libMesh::Xdr::data(), libMesh::MeshBase::get_subdomain_name_map(), libMesh::MeshInput< MeshBase >::mesh(), and libMesh::ParallelObject::processor_id().
Referenced by write().
{
if (this->processor_id() == 0)
{
const MeshBase &mesh = MeshOutput<MeshBase>::mesh();
const std::map<subdomain_id_type, std::string> & subdomain_map = mesh.get_subdomain_name_map();
std::vector<header_id_type> subdomain_ids; subdomain_ids.reserve(subdomain_map.size());
std::vector<std::string> subdomain_names; subdomain_names.reserve(subdomain_map.size());
// We need to loop over the map and make sure that there aren't any invalid entries. Since we
// return writable references in mesh_base, it's possible for the user to leave some entity names
// blank. We can't write those to the XDA file.
header_id_type n_subdomain_names = 0;
std::map<subdomain_id_type, std::string>::const_iterator it_end = subdomain_map.end();
for (std::map<subdomain_id_type, std::string>::const_iterator it = subdomain_map.begin(); it != it_end; ++it)
{
if (!it->second.empty())
{
n_subdomain_names++;
subdomain_ids.push_back(it->first);
subdomain_names.push_back(it->second);
}
}
io.data(n_subdomain_names, "# subdomain id to name map");
// Write out the ids and names in two vectors
if (n_subdomain_names)
{
io.data(subdomain_ids);
io.data(subdomain_names);
}
}
}
std::string libMesh::XdrIO::_bc_file_name [private] |
Definition at line 254 of file xdr_io.h.
Referenced by boundary_condition_file_name().
bool libMesh::XdrIO::_binary [private] |
const Parallel::Communicator& libMesh::ParallelObject::_communicator [protected, inherited] |
Definition at line 104 of file parallel_object.h.
Referenced by libMesh::EquationSystems::build_solution_vector(), libMesh::ParallelObject::comm(), libMesh::EquationSystems::get_solution(), libMesh::ParallelObject::n_processors(), libMesh::ParallelObject::operator=(), and libMesh::ParallelObject::processor_id().
header_id_type libMesh::XdrIO::_field_width [private] |
const bool libMesh::MeshOutput< MeshBase >::_is_parallel_format [protected, inherited] |
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 126 of file mesh_output.h.
Referenced by libMesh::FroIO::write(), libMesh::DivaIO::write(), libMesh::PostscriptIO::write(), and libMesh::EnsightIO::write().
bool libMesh::XdrIO::_legacy [private] |
std::string libMesh::XdrIO::_p_level_file [private] |
Definition at line 257 of file xdr_io.h.
Referenced by polynomial_level_file_name().
std::string libMesh::XdrIO::_partition_map_file [private] |
Definition at line 255 of file xdr_io.h.
Referenced by partition_map_file_name().
std::string libMesh::XdrIO::_subdomain_map_file [private] |
Definition at line 256 of file xdr_io.h.
Referenced by subdomain_map_file_name().
std::string libMesh::XdrIO::_version [private] |
bool libMesh::XdrIO::_write_parallel [private] |
Definition at line 250 of file xdr_io.h.
Referenced by set_auto_parallel(), set_write_parallel(), write(), and write_parallel().
bool libMesh::XdrIO::_write_serial [private] |
Definition at line 249 of file xdr_io.h.
Referenced by set_auto_parallel(), set_write_parallel(), and write_parallel().
bool libMesh::XdrIO::_write_unique_id [private] |
Definition at line 251 of file xdr_io.h.
Referenced by write(), and write_serialized_connectivity().
std::vector<bool> libMesh::MeshInput< MeshBase >::elems_of_dimension [protected, inherited] |
A vector of bools describing what dimension elements have been encountered when reading a mesh.
Definition at line 100 of file mesh_input.h.
Referenced by libMesh::GMVIO::_read_one_cell(), libMesh::UNVIO::elements_in(), libMesh::UNVIO::max_elem_dimension_seen(), libMesh::AbaqusIO::max_elem_dimension_seen(), libMesh::AbaqusIO::read(), libMesh::Nemesis_IO::read(), libMesh::ExodusII_IO::read(), libMesh::GMVIO::read(), libMesh::VTKIO::read(), libMesh::AbaqusIO::read_elements(), libMesh::UCDIO::read_implementation(), libMesh::UNVIO::read_implementation(), libMesh::LegacyXdrIO::read_mesh(), and read_serialized_connectivity().
const std::size_t libMesh::XdrIO::io_blksize = 128000 [static, private] |
Define the block size to use for chunked IO.
Definition at line 262 of file xdr_io.h.
Referenced by read_serialized_bcs(), read_serialized_connectivity(), read_serialized_nodes(), read_serialized_nodesets(), and write_serialized_nodes().