libMesh
Public Member Functions | Protected Attributes | Private Member Functions | Private Attributes | List of all members
libMesh::SparsityPattern::Build Class Reference

This helper class can be called on multiple threads to compute the sparsity pattern (or graph) of the sparse matrix resulting from the discretization. More...

#include <sparsity_pattern.h>

Inheritance diagram for libMesh::SparsityPattern::Build:
[legend]

Public Member Functions

 Build (const DofMap &dof_map_in, const CouplingMatrix *dof_coupling_in, const std::set< GhostingFunctor *> &coupling_functors_in, const bool implicit_neighbor_dofs_in, const bool need_full_sparsity_pattern_in, const bool calculate_constrained_in=false)
 
 Build (const Build &)=default
 Special functions. More...
 
Buildoperator= (const Build &)=delete
 
 Build (Build &&)=default
 
Buildoperator= (Build &&)=delete
 
 ~Build ()=default
 
 Build (Build &other, Threads::split)
 Splitting constructor, for use in multithreaded loops. More...
 
void operator() (const ConstElemRange &range)
 Add entries from a range of elements to this object's sparsity pattern. More...
 
void join (const Build &other)
 Combine the sparsity pattern in other with this object's sparsity pattern. More...
 
void parallel_sync ()
 Send sparsity pattern data relevant to other processors to those processors, and receive and incorporate data relevant to us. More...
 
const SparsityPattern::Graphget_sparsity_pattern () const
 Rows of sparse matrix indices, indexed by the offset from the first DoF on this processor. More...
 
const SparsityPattern::NonlocalGraphget_nonlocal_pattern () const
 Rows of sparse matrix indices, mapped from global DoF number, which belong on other processors. More...
 
std::size_t n_nonzeros () const
 The total number of nonzeros in the global matrix. More...
 
const std::vector< dof_id_type > & get_n_nz () const
 The number of on-processor nonzeros in my portion of the global matrix. More...
 
const std::vector< dof_id_type > & get_n_oz () const
 The number of off-processor nonzeros in my portion of the global matrix. More...
 
void apply_extra_sparsity_object (SparsityPattern::AugmentSparsityPattern &asp)
 Let a user-provided AugmentSparsityPattern subclass modify our sparsity structure. More...
 
void apply_extra_sparsity_function (void(*func)(SparsityPattern::Graph &sparsity, std::vector< dof_id_type > &n_nz, std::vector< dof_id_type > &n_oz, void *context), void *context)
 Let a user-provided function modify our sparsity structure. More...
 
void clear_full_sparsity ()
 Clear the "full" details of our sparsity structure, leaving only the counts of non-zero entries. More...
 
const Parallel::Communicatorcomm () const
 
processor_id_type n_processors () const
 
processor_id_type processor_id () const
 

Protected Attributes

const Parallel::Communicator_communicator
 

Private Member Functions

void handle_vi_vj (const std::vector< dof_id_type > &element_dofs_i, const std::vector< dof_id_type > &element_dofs_j)
 
void sorted_connected_dofs (const Elem *elem, std::vector< dof_id_type > &dofs_vi, unsigned int vi)
 

Private Attributes

const DofMapdof_map
 
const CouplingMatrixdof_coupling
 
const std::set< GhostingFunctor * > & coupling_functors
 
const bool implicit_neighbor_dofs
 
const bool need_full_sparsity_pattern
 
const bool calculate_constrained
 
std::unordered_set< dof_id_typehashed_dof_sets
 
SparsityPattern::Graph sparsity_pattern
 
SparsityPattern::NonlocalGraph nonlocal_pattern
 
std::vector< dof_id_typen_nz
 
std::vector< dof_id_typen_oz
 

Detailed Description

This helper class can be called on multiple threads to compute the sparsity pattern (or graph) of the sparse matrix resulting from the discretization.

This pattern may be used directly by a particular sparse matrix format (e.g. LaspackMatrix) or indirectly (e.g. PetscMatrix). In the latter case the number of nonzeros per row of the matrix is needed for efficient preallocation. In this case it suffices to provide estimate (but bounding) values, and in this case the threaded method can take some short-cuts for efficiency.

Definition at line 102 of file sparsity_pattern.h.

Constructor & Destructor Documentation

◆ Build() [1/4]

libMesh::SparsityPattern::Build::Build ( const DofMap dof_map_in,
const CouplingMatrix dof_coupling_in,
const std::set< GhostingFunctor *> &  coupling_functors_in,
const bool  implicit_neighbor_dofs_in,
const bool  need_full_sparsity_pattern_in,
const bool  calculate_constrained_in = false 
)

Definition at line 46 of file sparsity_pattern.C.

51  :
52  ParallelObject(dof_map_in),
53  dof_map(dof_map_in),
54  dof_coupling(dof_coupling_in),
55  coupling_functors(coupling_functors_in),
56  implicit_neighbor_dofs(implicit_neighbor_dofs_in),
57  need_full_sparsity_pattern(need_full_sparsity_pattern_in),
58  calculate_constrained(calculate_constrained_in),
61  n_nz(),
62  n_oz()
63 {}
ParallelObject(const Parallel::Communicator &comm_in)
Constructor.
SparsityPattern::Graph sparsity_pattern
const std::set< GhostingFunctor * > & coupling_functors
const CouplingMatrix * dof_coupling
std::vector< dof_id_type > n_nz
SparsityPattern::NonlocalGraph nonlocal_pattern
std::vector< dof_id_type > n_oz

◆ Build() [2/4]

libMesh::SparsityPattern::Build::Build ( const Build )
default

Special functions.

  • The Build object holds references to DofMap and coupling functors, therefore it can't be assigned.

◆ Build() [3/4]

libMesh::SparsityPattern::Build::Build ( Build &&  )
default

◆ ~Build()

libMesh::SparsityPattern::Build::~Build ( )
default

◆ Build() [4/4]

libMesh::SparsityPattern::Build::Build ( Build other,
Threads::split   
)

Splitting constructor, for use in multithreaded loops.

Definition at line 67 of file sparsity_pattern.C.

67  :
68  ParallelObject(other),
69  dof_map(other.dof_map),
70  dof_coupling(other.dof_coupling),
71  coupling_functors(other.coupling_functors),
72  implicit_neighbor_dofs(other.implicit_neighbor_dofs),
73  need_full_sparsity_pattern(other.need_full_sparsity_pattern),
74  calculate_constrained(other.calculate_constrained),
75  hashed_dof_sets(other.hashed_dof_sets),
78  n_nz(),
79  n_oz()
80 {}
ParallelObject(const Parallel::Communicator &comm_in)
Constructor.
SparsityPattern::Graph sparsity_pattern
const std::set< GhostingFunctor * > & coupling_functors
std::unordered_set< dof_id_type > hashed_dof_sets
const CouplingMatrix * dof_coupling
std::vector< dof_id_type > n_nz
SparsityPattern::NonlocalGraph nonlocal_pattern
std::vector< dof_id_type > n_oz

Member Function Documentation

◆ apply_extra_sparsity_function()

void libMesh::SparsityPattern::Build::apply_extra_sparsity_function ( void(*)(SparsityPattern::Graph &sparsity, std::vector< dof_id_type > &n_nz, std::vector< dof_id_type > &n_oz, void *context)  func,
void *  context 
)
inline

Let a user-provided function modify our sparsity structure.

Definition at line 189 of file sparsity_pattern.h.

References n_nz, n_oz, and sparsity_pattern.

194  { func(sparsity_pattern, n_nz, n_oz, context); }
SparsityPattern::Graph sparsity_pattern
std::vector< dof_id_type > n_nz
std::vector< dof_id_type > n_oz

◆ apply_extra_sparsity_object()

void libMesh::SparsityPattern::Build::apply_extra_sparsity_object ( SparsityPattern::AugmentSparsityPattern asp)

Let a user-provided AugmentSparsityPattern subclass modify our sparsity structure.

Definition at line 602 of file sparsity_pattern.C.

References libMesh::SparsityPattern::AugmentSparsityPattern::augment_sparsity_pattern(), n_nz, n_oz, and sparsity_pattern.

603 {
604  asp.augment_sparsity_pattern (sparsity_pattern, n_nz, n_oz);
605 }
SparsityPattern::Graph sparsity_pattern
std::vector< dof_id_type > n_nz
std::vector< dof_id_type > n_oz

◆ clear_full_sparsity()

void libMesh::SparsityPattern::Build::clear_full_sparsity ( )
inline

Clear the "full" details of our sparsity structure, leaving only the counts of non-zero entries.

Definition at line 200 of file sparsity_pattern.h.

References nonlocal_pattern, and sparsity_pattern.

201  {
202  sparsity_pattern.clear();
203  nonlocal_pattern.clear();
204  }
SparsityPattern::Graph sparsity_pattern
SparsityPattern::NonlocalGraph nonlocal_pattern

◆ comm()

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

Definition at line 97 of file parallel_object.h.

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::Partitioner::_find_global_index_by_pid_map(), libMesh::BoundaryInfo::_find_id_maps(), libMesh::SlepcEigenSolver< libMesh::Number >::_petsc_shell_matrix_get_diagonal(), libMesh::PetscLinearSolver< Number >::_petsc_shell_matrix_get_diagonal(), libMesh::SlepcEigenSolver< libMesh::Number >::_petsc_shell_matrix_mult(), libMesh::PetscLinearSolver< Number >::_petsc_shell_matrix_mult(), libMesh::PetscLinearSolver< Number >::_petsc_shell_matrix_mult_add(), 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::EigenSystem::add_matrices(), libMesh::System::add_matrix(), libMesh::RBConstruction::add_scaled_matrix_and_vector(), libMesh::System::add_variable(), libMesh::System::add_variables(), libMesh::System::add_vector(), 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::Nemesis_IO::assert_symmetric_cmaps(), libMesh::MeshCommunication::assign_global_indices(), libMesh::Partitioner::assign_partitioning(), 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::MeshBase::cache_elem_data(), 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::DofMap::computed_sparsity_already(), libMesh::Problem_Interface::computeF(), libMesh::Problem_Interface::computeJacobian(), libMesh::Problem_Interface::computePreconditioner(), libMesh::ContinuationSystem::ContinuationSystem(), libMesh::MeshBase::copy_constraint_rows(), libMesh::ExodusII_IO::copy_elemental_solution(), libMesh::ExodusII_IO::copy_nodal_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::PetscMatrix< libMesh::Number >::create_submatrix_nosort(), libMesh::MeshCommunication::delete_remote_elements(), libMesh::RBEIMEvaluation::distribute_bfs(), libMesh::DofMap::distribute_dofs(), DMlibMeshFunction(), DMlibMeshJacobian(), DMlibMeshSetSystem_libMesh(), DMVariableBounds_libMesh(), libMesh::DTKSolutionTransfer::DTKSolutionTransfer(), libMesh::MeshRefinement::eliminate_unrefined_patches(), libMesh::RBEIMConstruction::enrich_eim_approximation_on_interiors(), libMesh::RBEIMConstruction::enrich_eim_approximation_on_nodes(), libMesh::RBEIMConstruction::enrich_eim_approximation_on_sides(), libMesh::TransientRBConstruction::enrich_RB_space(), libMesh::EpetraVector< T >::EpetraVector(), AssembleOptimization::equality_constraints(), libMesh::PatchRecoveryErrorEstimator::estimate_error(), libMesh::WeightedPatchRecoveryErrorEstimator::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_error_tolerance(), libMesh::MeshRefinement::flag_elements_by_mean_stddev(), libMesh::MeshRefinement::flag_elements_by_nelem_target(), libMesh::RBEIMEvaluation::gather_bfs(), libMesh::DofMap::gather_constraints(), libMesh::MeshfreeInterpolation::gather_remote_data(), libMesh::CondensedEigenSystem::get_eigenpair(), libMesh::RBEIMEvaluation::get_eim_basis_function_node_value(), libMesh::RBEIMEvaluation::get_eim_basis_function_side_value(), libMesh::RBEIMEvaluation::get_eim_basis_function_value(), libMesh::MeshBase::get_info(), libMesh::System::get_info(), libMesh::DofMap::get_info(), libMesh::ImplicitSystem::get_linear_solver(), libMesh::RBEIMConstruction::get_max_abs_value(), libMesh::RBEIMConstruction::get_node_max_abs_value(), libMesh::RBEIMEvaluation::get_parametrized_function_node_value(), libMesh::RBEIMEvaluation::get_parametrized_function_side_value(), libMesh::RBEIMEvaluation::get_parametrized_function_value(), libMesh::RBEIMConstruction::get_random_point(), AssembleOptimization::inequality_constraints(), AssembleOptimization::inequality_constraints_jacobian(), libMesh::LocationMap< T >::init(), libMesh::TimeSolver::init(), libMesh::SystemSubsetBySubdomain::init(), libMesh::PetscDMWrapper::init_and_attach_petscdm(), libMesh::ExodusII_IO_Helper::initialize(), libMesh::OptimizationSystem::initialize_equality_constraints_storage(), libMesh::OptimizationSystem::initialize_inequality_constraints_storage(), libMesh::RBEIMConstruction::initialize_parametrized_functions_in_training_set(), libMesh::RBEIMConstruction::inner_product(), 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_equal_connectivity(), libMesh::MeshTools::libmesh_assert_equal_points(), 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_linesearch_shellfunc(), libMesh::libmesh_petsc_preconditioner_apply(), libMesh::libmesh_petsc_recalculate_monitor(), libMesh::libmesh_petsc_snes_fd_residual(), libMesh::libmesh_petsc_snes_jacobian(), libMesh::libmesh_petsc_snes_mffd_interface(), libMesh::libmesh_petsc_snes_mffd_residual(), libMesh::libmesh_petsc_snes_postcheck(), libMesh::libmesh_petsc_snes_precheck(), 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(), libMesh::LinearImplicitSystem::LinearImplicitSystem(), 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_bcids_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(), libMesh::TriangulatorInterface::MeshedHole::MeshedHole(), 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(), MixedOrderTest::n_neighbor_links(), libMesh::BoundaryInfo::n_nodeset_conds(), n_nonzeros(), libMesh::MeshTools::n_p_levels(), libMesh::BoundaryInfo::n_shellface_conds(), libMesh::RBEIMEvaluation::node_distribute_bfs(), libMesh::RBEIMEvaluation::node_gather_bfs(), libMesh::RBEIMConstruction::node_inner_product(), libMesh::MeshBase::operator==(), 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(), parallel_sync(), libMesh::BoundaryInfo::parallel_sync_node_ids(), libMesh::BoundaryInfo::parallel_sync_side_ids(), libMesh::MeshTools::paranoid_n_levels(), 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::DofMap::print_dof_constraints(), libMesh::DofMap::process_mesh_constraint_rows(), libMesh::Partitioner::processor_pairs_to_interface_nodes(), libMesh::InterMeshProjection::project_system_vectors(), FEMParameters::read(), libMesh::Nemesis_IO::read(), libMesh::XdrIO::read(), libMesh::EquationSystems::read(), libMesh::ExodusII_IO::read_header(), libMesh::CheckpointIO::read_header(), libMesh::XdrIO::read_header(), libMesh::System::read_header(), libMesh::RBEIMEvaluation::read_in_interior_basis_functions(), libMesh::RBEIMEvaluation::read_in_node_basis_functions(), libMesh::RBEIMEvaluation::read_in_side_basis_functions(), 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::Nemesis_IO_Helper::read_var_names_impl(), libMesh::MeshBase::recalculate_n_partitions(), libMesh::MeshRefinement::refine_and_coarsen_elements(), libMesh::DistributedMesh::renumber_dof_objects(), libMesh::DistributedMesh::renumber_nodes_and_elements(), LinearElasticityWithContact::residual_and_jacobian(), OverlappingAlgebraicGhostingTest::run_ghosting_test(), OverlappingCouplingGhostingTest::run_sparsity_pattern_test(), scale_mesh_and_plot(), libMesh::DofMap::scatter_constraints(), libMesh::CheckpointIO::select_split_config(), libMesh::GenericProjector< FFunctor, GFunctor, FValue, ProjectionAction >::send_and_insert_dof_values(), libMesh::TransientRBConstruction::set_error_temporal_data(), libMesh::Partitioner::set_interface_node_processor_ids_BFS(), libMesh::Partitioner::set_interface_node_processor_ids_linear(), libMesh::Partitioner::set_interface_node_processor_ids_petscpartitioner(), libMesh::Partitioner::set_node_processor_ids(), libMesh::DofMap::set_nonlocal_dof_objects(), libMesh::Partitioner::set_parent_processor_ids(), libMesh::PetscDMWrapper::set_point_range_in_section(), libMesh::PetscDiffSolver::setup_petsc_data(), libMesh::RBEIMEvaluation::side_distribute_bfs(), libMesh::RBEIMEvaluation::side_gather_bfs(), libMesh::RBEIMConstruction::side_inner_product(), libMesh::Partitioner::single_partition(), libMesh::LaplaceMeshSmoother::smooth(), libMesh::split_mesh(), libMesh::RBEIMConstruction::store_eim_solutions_for_training_set(), libMesh::MeshBase::subdomain_ids(), libMesh::BoundaryInfo::sync(), ConstraintOperatorTest::test1DCoarseningNewNodes(), ConstraintOperatorTest::test1DCoarseningOperator(), libMesh::MeshRefinement::test_level_one(), MeshfunctionDFEM::test_mesh_function_dfem(), MeshfunctionDFEM::test_mesh_function_dfem_grad(), MeshFunctionTest::test_p_level(), libMesh::MeshRefinement::test_unflagged(), DofMapTest::testBadElemFECombo(), SystemsTest::testBlockRestrictedVarNDofs(), BoundaryInfoTest::testBoundaryOnChildrenErrors(), ConstraintOperatorTest::testCoreform(), MeshInputTest::testExodusIGASidesets(), MeshTriangulationTest::testFoundCenters(), PointLocatorTest::testLocator(), BoundaryInfoTest::testMesh(), PointLocatorTest::testPlanar(), MeshTriangulationTest::testPoly2TriRefinementBase(), SystemsTest::testProjectCubeWithMeshFunction(), BoundaryInfoTest::testRenumber(), CheckpointIOTest::testSplitter(), MeshInputTest::testTetgenIO(), MeshTriangulationTest::testTriangulatorInterp(), MeshTriangulationTest::testTriangulatorMeshedHoles(), MeshTriangulationTest::testTriangulatorRoundHole(), libMesh::MeshTools::total_weight(), libMesh::RBConstruction::train_reduced_basis_with_POD(), libMesh::MeshFunctionSolutionTransfer::transfer(), libMesh::MeshfreeSolutionTransfer::transfer(), libMesh::Poly2TriTriangulator::triangulate(), libMesh::TransientRBConstruction::truth_assembly(), libMesh::RBConstruction::truth_assembly(), libMesh::MeshRefinement::uniformly_coarsen(), libMesh::TransientRBConstruction::update_RB_initial_condition_all_N(), 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::RBEIMEvaluation::write_out_interior_basis_functions(), libMesh::RBEIMEvaluation::write_out_node_basis_functions(), libMesh::RBEIMEvaluation::write_out_side_basis_functions(), 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().

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

◆ get_n_nz()

const std::vector<dof_id_type>& libMesh::SparsityPattern::Build::get_n_nz ( ) const
inline

The number of on-processor nonzeros in my portion of the global matrix.

Definition at line 170 of file sparsity_pattern.h.

References n_nz.

171  { return n_nz; }
std::vector< dof_id_type > n_nz

◆ get_n_oz()

const std::vector<dof_id_type>& libMesh::SparsityPattern::Build::get_n_oz ( ) const
inline

The number of off-processor nonzeros in my portion of the global matrix.

Definition at line 177 of file sparsity_pattern.h.

References n_oz.

178  { return n_oz; }
std::vector< dof_id_type > n_oz

◆ get_nonlocal_pattern()

const SparsityPattern::NonlocalGraph& libMesh::SparsityPattern::Build::get_nonlocal_pattern ( ) const
inline

Rows of sparse matrix indices, mapped from global DoF number, which belong on other processors.

Stored here only temporarily until a parallel_sync() sends them where they belong.

Definition at line 158 of file sparsity_pattern.h.

References nonlocal_pattern.

159  { return nonlocal_pattern; }
SparsityPattern::NonlocalGraph nonlocal_pattern

◆ get_sparsity_pattern()

const SparsityPattern::Graph& libMesh::SparsityPattern::Build::get_sparsity_pattern ( ) const
inline

Rows of sparse matrix indices, indexed by the offset from the first DoF on this processor.

Definition at line 150 of file sparsity_pattern.h.

References sparsity_pattern.

151  { return sparsity_pattern; }
SparsityPattern::Graph sparsity_pattern

◆ handle_vi_vj()

void libMesh::SparsityPattern::Build::handle_vi_vj ( const std::vector< dof_id_type > &  element_dofs_i,
const std::vector< dof_id_type > &  element_dofs_j 
)
private

Definition at line 111 of file sparsity_pattern.C.

References dof_map, libMesh::DofMap::end_dof(), libMesh::DofMap::first_dof(), hashed_dof_sets, libMesh::Utility::hashword(), libMesh::Utility::hashword2(), nonlocal_pattern, libMesh::ParallelObject::processor_id(), libMesh::SparsityPattern::sort_row(), and sparsity_pattern.

Referenced by operator()().

113 {
114  const unsigned int n_dofs_on_element_i =
115  cast_int<unsigned int>(element_dofs_i.size());
116 
117  const processor_id_type proc_id = dof_map.processor_id();
118  const dof_id_type first_dof_on_proc = dof_map.first_dof(proc_id);
119  const dof_id_type end_dof_on_proc = dof_map.end_dof(proc_id);
120 
121  std::vector<dof_id_type>
122  dofs_to_add;
123 
124  const unsigned int n_dofs_on_element_j =
125  cast_int<unsigned int>(element_dofs_j.size());
126 
127  // It only makes sense to compute hashes and see if we can skip
128  // doing work when there are a "large" amount of DOFs for a given
129  // element. The cutoff for "large" is somewhat arbitrarily chosen
130  // based on a test case with a spider node that resulted in O(10^3)
131  // entries in element_dofs_i for O(10^3) elements. Making this
132  // number larger will disable the hashing optimization in more
133  // cases.
134  bool dofs_seen = false;
135  if (n_dofs_on_element_j > 0 && n_dofs_on_element_i > 256)
136  {
137  auto hash_i = Utility::hashword(element_dofs_i);
138  auto hash_j = Utility::hashword(element_dofs_j);
139  auto final_hash = Utility::hashword2(hash_i, hash_j);
140  auto result = hashed_dof_sets.insert(final_hash);
141  // if insert failed, we have already seen these dofs
142  dofs_seen = !result.second;
143  }
144 
145  // there might be 0 dofs for the other variable on the same element
146  // (when subdomain variables do not overlap) and that's when we do
147  // not do anything
148  if (n_dofs_on_element_j > 0 && !dofs_seen)
149  {
150  for (unsigned int i=0; i<n_dofs_on_element_i; i++)
151  {
152  const dof_id_type ig = element_dofs_i[i];
153 
154  SparsityPattern::Row * row;
155 
156  // We save non-local row components for now so we can
157  // communicate them to other processors later.
158 
159  if ((ig >= first_dof_on_proc) &&
160  (ig < end_dof_on_proc))
161  {
162  // This is what I mean
163  // libmesh_assert_greater_equal ((ig - first_dof_on_proc), 0);
164  // but do the test like this because ig and
165  // first_dof_on_proc are unsigned ints
166  libmesh_assert_greater_equal (ig, first_dof_on_proc);
167  libmesh_assert_less (ig, (sparsity_pattern.size() +
168  first_dof_on_proc));
169 
170  row = &sparsity_pattern[ig - first_dof_on_proc];
171  }
172  else
173  {
174  row = &nonlocal_pattern[ig];
175  }
176 
177  // If the row is empty we will add *all*
178  // the element j DOFs, so just do that.
179  if (row->empty())
180  {
181  row->insert(row->end(),
182  element_dofs_j.begin(),
183  element_dofs_j.end());
184  }
185  else
186  {
187  // Build a list of the DOF indices not found in the
188  // sparsity pattern
189  dofs_to_add.clear();
190 
191  // Cache iterators. Low will move forward, subsequent
192  // searches will be on smaller ranges
193  SparsityPattern::Row::iterator
194  low = std::lower_bound
195  (row->begin(), row->end(), element_dofs_j.front()),
196  high = std::upper_bound
197  (low, row->end(), element_dofs_j.back());
198 
199  for (unsigned int j=0; j<n_dofs_on_element_j; j++)
200  {
201  const dof_id_type jg = element_dofs_j[j];
202 
203  // See if jg is in the sorted range
204  std::pair<SparsityPattern::Row::iterator,
205  SparsityPattern::Row::iterator>
206  pos = std::equal_range (low, high, jg);
207 
208  // Must add jg if it wasn't found
209  if (pos.first == pos.second)
210  dofs_to_add.push_back(jg);
211 
212  // pos.first is now a valid lower bound for any
213  // remaining element j DOFs. (That's why we sorted them.)
214  // Use it for the next search
215  low = pos.first;
216  }
217 
218  // Add to the sparsity pattern
219  if (!dofs_to_add.empty())
220  {
221  const std::size_t old_size = row->size();
222 
223  row->insert (row->end(),
224  dofs_to_add.begin(),
225  dofs_to_add.end());
226 
228  (row->begin(), row->begin()+old_size,
229  row->end());
230  }
231  }
232  } // End dofs-of-var-i loop
233  } // End if-dofs-of-var-j
234 }
SparsityPattern::Graph sparsity_pattern
std::unordered_set< dof_id_type > hashed_dof_sets
std::vector< dof_id_type, Threads::scalable_allocator< dof_id_type > > Row
uint32_t hashword(const uint32_t *k, size_t length, uint32_t initval=0)
The hashword function takes an array of uint32_t&#39;s of length &#39;length&#39; and computes a single key from ...
Definition: hashword.h:153
uint8_t processor_id_type
SparsityPattern::NonlocalGraph nonlocal_pattern
uint32_t hashword2(const uint32_t &first, const uint32_t &second, uint32_t initval=0)
This is a hard-coded version of hashword for hashing exactly 2 numbers.
Definition: hashword.h:210
dof_id_type first_dof(const processor_id_type proc) const
Definition: dof_map.h:684
dof_id_type end_dof(const processor_id_type proc) const
Definition: dof_map.h:708
processor_id_type processor_id() const
uint8_t dof_id_type
Definition: id_types.h:67
static void sort_row(const BidirectionalIterator begin, BidirectionalIterator middle, const BidirectionalIterator end)
Splices the two sorted ranges [begin,middle) and [middle,end) into one sorted range [begin...

◆ join()

void libMesh::SparsityPattern::Build::join ( const Build other)

Combine the sparsity pattern in other with this object's sparsity pattern.

Useful in multithreaded loops.

Definition at line 363 of file sparsity_pattern.C.

References dof_map, libMesh::DofMap::end_dof(), libMesh::DofMap::first_dof(), hashed_dof_sets, libMesh::libmesh_assert(), libMesh::DofMap::n_dofs(), libMesh::DofMap::n_dofs_on_processor(), n_nz, n_oz, need_full_sparsity_pattern, nonlocal_pattern, libMesh::ParallelObject::processor_id(), and sparsity_pattern.

364 {
365  const processor_id_type proc_id = dof_map.processor_id();
366  const dof_id_type n_global_dofs = dof_map.n_dofs();
367  const dof_id_type n_dofs_on_proc = dof_map.n_dofs_on_processor(proc_id);
368  const dof_id_type first_dof_on_proc = dof_map.first_dof(proc_id);
369  const dof_id_type end_dof_on_proc = dof_map.end_dof(proc_id);
370 
371  libmesh_assert_equal_to (sparsity_pattern.size(), other.sparsity_pattern.size());
372  libmesh_assert_equal_to (n_nz.size(), sparsity_pattern.size());
373  libmesh_assert_equal_to (n_oz.size(), sparsity_pattern.size());
374 
375  for (dof_id_type r=0; r<n_dofs_on_proc; r++)
376  {
377  // increment the number of on and off-processor nonzeros in this row
378  // (note this will be an upper bound unless we need the full sparsity pattern)
380  {
382  const SparsityPattern::Row & their_row = other.sparsity_pattern[r];
383 
384  // simple copy if I have no dofs
385  if (my_row.empty())
386  my_row = their_row;
387 
388  // otherwise add their DOFs to mine, resort, and re-unique the row
389  else if (!their_row.empty()) // do nothing for the trivial case where
390  { // their row is empty
391  my_row.insert (my_row.end(),
392  their_row.begin(),
393  their_row.end());
394 
395  // We cannot use SparsityPattern::sort_row() here because it expects
396  // the [begin,middle) [middle,end) to be non-overlapping. This is not
397  // necessarily the case here, so use std::sort()
398  std::sort (my_row.begin(), my_row.end());
399 
400  my_row.erase(std::unique (my_row.begin(), my_row.end()), my_row.end());
401  }
402 
403  // fix the number of on and off-processor nonzeros in this row
404  n_nz[r] = n_oz[r] = 0;
405 
406  for (const auto & df : my_row)
407  if ((df < first_dof_on_proc) || (df >= end_dof_on_proc))
408  n_oz[r]++;
409  else
410  n_nz[r]++;
411  }
412  else
413  {
414  n_nz[r] += other.n_nz[r];
415  n_nz[r] = std::min(n_nz[r], n_dofs_on_proc);
416  n_oz[r] += other.n_oz[r];
417  n_oz[r] =std::min(n_oz[r], static_cast<dof_id_type>(n_global_dofs-n_nz[r]));
418  }
419  }
420 
421  // Move nonlocal row information to ourselves; the other thread
422  // won't need it in the map after that.
423  for (const auto & p : other.nonlocal_pattern)
424  {
425 #ifndef NDEBUG
426  const dof_id_type dof_id = p.first;
427 
428  processor_id_type dbg_proc_id = 0;
429  while (dof_id >= dof_map.end_dof(dbg_proc_id))
430  dbg_proc_id++;
431  libmesh_assert (dbg_proc_id != this->processor_id());
432 #endif
433 
434  const SparsityPattern::Row & their_row = p.second;
435 
436  // We should have no empty values in a map
437  libmesh_assert (!their_row.empty());
438 
439  NonlocalGraph::iterator my_it = nonlocal_pattern.find(p.first);
440  if (my_it == nonlocal_pattern.end())
441  {
442  // nonlocal_pattern[it->first].swap(their_row);
443  nonlocal_pattern[p.first] = their_row;
444  }
445  else
446  {
447  SparsityPattern::Row & my_row = my_it->second;
448 
449  my_row.insert (my_row.end(),
450  their_row.begin(),
451  their_row.end());
452 
453  // We cannot use SparsityPattern::sort_row() here because it expects
454  // the [begin,middle) [middle,end) to be non-overlapping. This is not
455  // necessarily the case here, so use std::sort()
456  std::sort (my_row.begin(), my_row.end());
457 
458  my_row.erase(std::unique (my_row.begin(), my_row.end()), my_row.end());
459  }
460  }
461 
462  // Combine the other thread's hashed_dof_sets with ours.
463  hashed_dof_sets.insert(other.hashed_dof_sets.begin(),
464  other.hashed_dof_sets.end());
465 }
SparsityPattern::Graph sparsity_pattern
dof_id_type n_dofs_on_processor(const processor_id_type proc) const
Definition: dof_map.h:675
std::unordered_set< dof_id_type > hashed_dof_sets
std::vector< dof_id_type, Threads::scalable_allocator< dof_id_type > > Row
uint8_t processor_id_type
dof_id_type n_dofs() const
Definition: dof_map.h:659
libmesh_assert(ctx)
std::vector< dof_id_type > n_nz
SparsityPattern::NonlocalGraph nonlocal_pattern
dof_id_type first_dof(const processor_id_type proc) const
Definition: dof_map.h:684
dof_id_type end_dof(const processor_id_type proc) const
Definition: dof_map.h:708
processor_id_type processor_id() const
uint8_t dof_id_type
Definition: id_types.h:67
std::vector< dof_id_type > n_oz

◆ n_nonzeros()

std::size_t libMesh::SparsityPattern::Build::n_nonzeros ( ) const

The total number of nonzeros in the global matrix.

Definition at line 608 of file sparsity_pattern.C.

References libMesh::ParallelObject::comm(), n_nz, n_oz, and TIMPI::Communicator::sum().

609 {
610  // At some point I'll remember that "C++17" compilers don't always
611  // come with complete C++17 standard libraries.
612  // std::size_t total_nonzeros = std::reduce(n_nz.begin(), n_nz.end(), std::size_t(0));
613  // total_nonzeros += std::reduce(n_oz.begin(), n_oz.end(), std::size_t(0));
614 
615  std::size_t total_nonzeros = 0;
616  for (auto nnzi : n_nz)
617  total_nonzeros += nnzi;
618  for (auto nozi : n_oz)
619  total_nonzeros += nozi;
620 
621  this->comm().sum(total_nonzeros);
622  return total_nonzeros;
623 }
void sum(T &r) const
const Parallel::Communicator & comm() const
std::vector< dof_id_type > n_nz
std::vector< dof_id_type > n_oz

◆ n_processors()

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

Definition at line 103 of file parallel_object.h.

References libMesh::ParallelObject::_communicator, libMesh::libmesh_assert(), and TIMPI::Communicator::size().

Referenced by libMesh::Partitioner::_find_global_index_by_pid_map(), 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::System::add_vector(), libMesh::LaplaceMeshSmoother::allgather_graph(), libMesh::DofMap::allgather_recursive_constraints(), libMesh::FEMSystem::assembly(), libMesh::Nemesis_IO::assert_symmetric_cmaps(), libMesh::Partitioner::assign_partitioning(), libMesh::AztecLinearSolver< T >::AztecLinearSolver(), libMesh::EquationSystems::build_parallel_elemental_solution_vector(), libMesh::DistributedMesh::clear(), libMesh::DistributedMesh::clear_elems(), libMesh::Nemesis_IO_Helper::compute_border_node_ids(), libMesh::Nemesis_IO_Helper::construct_nemesis_filename(), libMesh::ExodusII_IO::copy_scalar_solution(), libMesh::Nemesis_IO::copy_scalar_solution(), libMesh::UnstructuredMesh::create_pid_mesh(), libMesh::MeshTools::create_processor_bounding_box(), libMesh::DofMap::distribute_dofs(), libMesh::DofMap::distribute_scalar_dofs(), libMesh::DistributedMesh::DistributedMesh(), libMesh::EnsightIO::EnsightIO(), libMesh::RBEIMEvaluation::gather_bfs(), libMesh::MeshBase::get_info(), libMesh::SystemSubsetBySubdomain::init(), libMesh::PetscDMWrapper::init_and_attach_petscdm(), libMesh::Nemesis_IO_Helper::initialize(), libMesh::ExodusII_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::n_active_elem_on_proc(), libMesh::MeshBase::n_elem_on_proc(), libMesh::MeshBase::n_nodes_on_proc(), libMesh::RBEIMEvaluation::node_gather_bfs(), libMesh::Partitioner::partition(), libMesh::MeshBase::partition(), libMesh::Partitioner::partition_unpartitioned_elements(), libMesh::System::point_gradient(), libMesh::System::point_hessian(), libMesh::System::point_value(), libMesh::DofMap::prepare_send_list(), libMesh::DofMap::print_dof_constraints(), libMesh::NameBasedIO::read(), libMesh::Nemesis_IO::read(), libMesh::CheckpointIO::read(), libMesh::CheckpointIO::read_connectivity(), libMesh::XdrIO::read_header(), libMesh::CheckpointIO::read_nodes(), libMesh::System::read_parallel_data(), libMesh::System::read_SCALAR_dofs(), libMesh::System::read_serialized_blocked_dof_objects(), libMesh::System::read_serialized_vector(), libMesh::DistributedMesh::renumber_dof_objects(), libMesh::Partitioner::repartition(), OverlappingFunctorTest::run_partitioner_test(), libMesh::DofMap::scatter_constraints(), libMesh::DistributedMesh::set_next_unique_id(), libMesh::DofMap::set_nonlocal_dof_objects(), libMesh::PetscDMWrapper::set_point_range_in_section(), WriteVecAndScalar::setupTests(), libMesh::RBEIMEvaluation::side_gather_bfs(), DistributedMeshTest::testRemoteElemError(), CheckpointIOTest::testSplitter(), libMesh::MeshRefinement::uniformly_coarsen(), libMesh::DistributedMesh::update_parallel_id_counts(), libMesh::GMVIO::write_binary(), libMesh::GMVIO::write_discontinuous_gmv(), libMesh::ExodusII_IO_Helper::write_nodal_coordinates(), libMesh::VTKIO::write_nodal_data(), libMesh::ExodusII_IO::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().

104  {
105  processor_id_type returnval =
106  cast_int<processor_id_type>(_communicator.size());
107  libmesh_assert(returnval); // We never have an empty comm
108  return returnval;
109  }
const Parallel::Communicator & _communicator
processor_id_type size() const
uint8_t processor_id_type
libmesh_assert(ctx)

◆ operator()()

void libMesh::SparsityPattern::Build::operator() ( const ConstElemRange range)

Add entries from a range of elements to this object's sparsity pattern.

Definition at line 238 of file sparsity_pattern.C.

References libMesh::DofMap::coupling_functors_begin(), libMesh::DofMap::coupling_functors_end(), dof_map, libMesh::DofMap::end_dof(), libMesh::DofMap::first_dof(), handle_vi_vj(), libMesh::MeshTools::Generation::Private::idx(), libMesh::DofObject::invalid_processor_id, libMesh::DofMap::merge_ghost_functor_outputs(), libMesh::DofMap::n_dofs_on_processor(), n_nz, n_oz, libMesh::DofMap::n_variables(), need_full_sparsity_pattern, libMesh::ParallelObject::processor_id(), sorted_connected_dofs(), and sparsity_pattern.

239 {
240  // Compute the sparsity structure of the global matrix. This can be
241  // fed into a PetscMatrix to allocate exactly the number of nonzeros
242  // necessary to store the matrix. This algorithm should be linear
243  // in the (# of elements)*(# nodes per element)
244  const processor_id_type proc_id = dof_map.processor_id();
245  const dof_id_type n_dofs_on_proc = dof_map.n_dofs_on_processor(proc_id);
246  const dof_id_type first_dof_on_proc = dof_map.first_dof(proc_id);
247  const dof_id_type end_dof_on_proc = dof_map.end_dof(proc_id);
248 
249  sparsity_pattern.resize(n_dofs_on_proc);
250 
251  // Handle dof coupling specified by library and user coupling functors
252  {
253  const unsigned int n_var = dof_map.n_variables();
254 
255  std::vector<std::vector<dof_id_type> > element_dofs_i(n_var);
256 
257  std::vector<const Elem *> coupled_neighbors;
258  for (const auto & elem : range)
259  {
260  // Make some fake element iterators defining a range
261  // pointing to only this element.
262  Elem * const * elempp = const_cast<Elem * const *>(&elem);
263  Elem * const * elemend = elempp+1;
264 
265  const MeshBase::const_element_iterator fake_elem_it =
266  MeshBase::const_element_iterator(elempp,
267  elemend,
268  Predicates::NotNull<Elem * const *>());
269 
270  const MeshBase::const_element_iterator fake_elem_end =
271  MeshBase::const_element_iterator(elemend,
272  elemend,
273  Predicates::NotNull<Elem * const *>());
274 
275  GhostingFunctor::map_type elements_to_couple;
276  DofMap::CouplingMatricesSet temporary_coupling_matrices;
277 
278  dof_map.merge_ghost_functor_outputs(elements_to_couple,
279  temporary_coupling_matrices,
282  fake_elem_it,
283  fake_elem_end,
285  for (unsigned int vi=0; vi<n_var; vi++)
286  this->sorted_connected_dofs(elem, element_dofs_i[vi], vi);
287 
288  for (unsigned int vi=0; vi<n_var; vi++)
289  for (const auto & [partner, ghost_coupling] : elements_to_couple)
290  {
291  // Loop over coupling matrix row variables if we have a
292  // coupling matrix, or all variables if not.
293  if (ghost_coupling)
294  {
295  libmesh_assert_equal_to (ghost_coupling->size(), n_var);
296  ConstCouplingRow ccr(vi, *ghost_coupling);
297 
298  for (const auto & idx : ccr)
299  {
300  if (partner == elem)
301  this->handle_vi_vj(element_dofs_i[vi], element_dofs_i[idx]);
302  else
303  {
304  std::vector<dof_id_type> partner_dofs;
305  this->sorted_connected_dofs(partner, partner_dofs, idx);
306  this->handle_vi_vj(element_dofs_i[vi], partner_dofs);
307  }
308  }
309  }
310  else
311  {
312  for (unsigned int vj = 0; vj != n_var; ++vj)
313  {
314  if (partner == elem)
315  this->handle_vi_vj(element_dofs_i[vi], element_dofs_i[vj]);
316  else
317  {
318  std::vector<dof_id_type> partner_dofs;
319  this->sorted_connected_dofs(partner, partner_dofs, vj);
320  this->handle_vi_vj(element_dofs_i[vi], partner_dofs);
321  }
322  }
323  }
324  } // End ghosted element loop
325  } // End range element loop
326  } // End ghosting functor section
327 
328  // Now a new chunk of sparsity structure is built for all of the
329  // DOFs connected to our rows of the matrix.
330 
331  // If we're building a full sparsity pattern, then we've got
332  // complete rows to work with, so we can just count them from
333  // scratch.
335  {
336  n_nz.clear();
337  n_oz.clear();
338  }
339 
340  n_nz.resize (n_dofs_on_proc, 0);
341  n_oz.resize (n_dofs_on_proc, 0);
342 
343  for (dof_id_type i=0; i<n_dofs_on_proc; i++)
344  {
345  // Get the row of the sparsity pattern
347 
348  for (const auto & df : row)
349  if ((df < first_dof_on_proc) || (df >= end_dof_on_proc))
350  n_oz[i]++;
351  else
352  n_nz[i]++;
353 
354  // If we're not building a full sparsity pattern, then we want
355  // to avoid overcounting these entries as much as possible.
357  row.clear();
358  }
359 }
SparsityPattern::Graph sparsity_pattern
std::set< GhostingFunctor * >::const_iterator coupling_functors_begin() const
Beginning of range of coupling functors.
Definition: dof_map.h:344
dof_id_type n_dofs_on_processor(const processor_id_type proc) const
Definition: dof_map.h:675
unsigned int n_variables() const
Definition: dof_map.h:621
std::map< const Elem *, const CouplingMatrix *, CompareDofObjectsByPIDAndThenID > map_type
What elements do we care about and what variables do we care about on each element?
std::vector< dof_id_type, Threads::scalable_allocator< dof_id_type > > Row
uint8_t processor_id_type
static void merge_ghost_functor_outputs(GhostingFunctor::map_type &elements_to_ghost, CouplingMatricesSet &temporary_coupling_matrices, const std::set< GhostingFunctor *>::iterator &gf_begin, const std::set< GhostingFunctor *>::iterator &gf_end, const MeshBase::const_element_iterator &elems_begin, const MeshBase::const_element_iterator &elems_end, processor_id_type p)
Definition: dof_map.C:1440
std::set< std::unique_ptr< CouplingMatrix >, Utility::CompareUnderlying > CouplingMatricesSet
Definition: dof_map.h:1745
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:488
void sorted_connected_dofs(const Elem *elem, std::vector< dof_id_type > &dofs_vi, unsigned int vi)
std::vector< dof_id_type > n_nz
std::set< GhostingFunctor * >::const_iterator coupling_functors_end() const
End of range of coupling functors.
Definition: dof_map.h:350
void handle_vi_vj(const std::vector< dof_id_type > &element_dofs_i, const std::vector< dof_id_type > &element_dofs_j)
dof_id_type first_dof(const processor_id_type proc) const
Definition: dof_map.h:684
dof_id_type end_dof(const processor_id_type proc) const
Definition: dof_map.h:708
processor_id_type processor_id() const
unsigned int idx(const ElemType type, const unsigned int nx, const unsigned int i, const unsigned int j)
A useful inline function which replaces the macros used previously.
uint8_t dof_id_type
Definition: id_types.h:67
std::vector< dof_id_type > n_oz

◆ operator=() [1/2]

Build& libMesh::SparsityPattern::Build::operator= ( const Build )
delete

◆ operator=() [2/2]

Build& libMesh::SparsityPattern::Build::operator= ( Build &&  )
delete

◆ parallel_sync()

void libMesh::SparsityPattern::Build::parallel_sync ( )

Send sparsity pattern data relevant to other processors to those processors, and receive and incorporate data relevant to us.

Definition at line 469 of file sparsity_pattern.C.

References libMesh::ParallelObject::comm(), dof_map, libMesh::DofMap::end_dof(), libMesh::DofMap::first_dof(), libMesh::libmesh_assert(), libMesh::DofMap::local_index(), libMesh::DofMap::n_dofs(), libMesh::DofMap::n_dofs_on_processor(), n_nz, n_oz, need_full_sparsity_pattern, nonlocal_pattern, TIMPI::Communicator::rank(), and sparsity_pattern.

470 {
471  parallel_object_only();
473 
474  auto & comm = this->comm();
475  auto my_pid = comm.rank();
476 
477  const auto n_global_dofs = dof_map.n_dofs();
478  const auto n_dofs_on_proc = dof_map.n_dofs_on_processor(my_pid);
479  const auto local_first_dof = dof_map.first_dof();
480  const auto local_end_dof = dof_map.end_dof();
481 
482  // The data to send
483  std::map<processor_id_type, std::vector<dof_id_type>> ids_to_send;
484  std::map<processor_id_type, std::vector<Row>> rows_to_send;
485 
486  // Loop over the nonlocal rows and transform them into the new datastructure
487  NonlocalGraph::iterator it = nonlocal_pattern.begin();
488  while (it != nonlocal_pattern.end())
489  {
490  const auto dof_id = it->first;
491  auto & row = it->second;
492 
493  processor_id_type proc_id = 0;
494  while (dof_id >= dof_map.end_dof(proc_id))
495  proc_id++;
496 
497  ids_to_send[proc_id].push_back(dof_id);
498 
499  // Note this invalidates the data in nonlocal_pattern
500  rows_to_send[proc_id].push_back(std::move(row));
501 
502  // Might as well remove it since it's invalidated anyway
503  it = nonlocal_pattern.erase(it);
504  }
505 
506  std::map<processor_id_type, std::vector<dof_id_type>> received_ids_map;
507 
508  auto ids_action_functor =
509  [& received_ids_map]
510  (processor_id_type pid,
511  const std::vector<dof_id_type> & received_ids)
512  {
513  received_ids_map.emplace(pid, received_ids);
514  };
515 
516  Parallel::push_parallel_vector_data(this->comm(), ids_to_send,
517  ids_action_functor);
518 
519  auto rows_action_functor =
520  [this,
521  & received_ids_map,
522  n_global_dofs,
523  n_dofs_on_proc,
524  local_first_dof,
525  local_end_dof]
526  (processor_id_type pid,
527  const std::vector<Row> & received_rows)
528  {
529  const std::vector<dof_id_type> & received_ids = libmesh_map_find(received_ids_map, pid);
530 
531  std::size_t n_rows = received_rows.size();
532  libmesh_assert_equal_to(n_rows, received_ids.size());
533 
534  for (auto i : IntRange<std::size_t>(0, n_rows))
535  {
536  const auto r = received_ids[i];
538 
539  const auto my_r = r - local_first_dof;
540 
541  auto & their_row = received_rows[i];
542 
544  {
545  auto & my_row = sparsity_pattern[my_r];
546 
547  // They wouldn't have sent an empty row
548  libmesh_assert(!their_row.empty());
549 
550  // We can end up with an empty row on a dof that touches our
551  // inactive elements but not our active ones
552  if (my_row.empty())
553  {
554  my_row.assign (their_row.begin(), their_row.end());
555  }
556  else
557  {
558  my_row.insert (my_row.end(),
559  their_row.begin(),
560  their_row.end());
561 
562  // We cannot use SparsityPattern::sort_row() here because it expects
563  // the [begin,middle) [middle,end) to be non-overlapping. This is not
564  // necessarily the case here, so use std::sort()
565  std::sort (my_row.begin(), my_row.end());
566 
567  my_row.erase(std::unique (my_row.begin(), my_row.end()), my_row.end());
568  }
569 
570  // fix the number of on and off-processor nonzeros in this row
571  n_nz[my_r] = n_oz[my_r] = 0;
572 
573  for (const auto & df : my_row)
574  if ((df < local_first_dof) || (df >= local_end_dof))
575  n_oz[my_r]++;
576  else
577  n_nz[my_r]++;
578  }
579  else
580  {
581  for (const auto & df : their_row)
582  if ((df < local_first_dof) || (df >= local_end_dof))
583  n_oz[my_r]++;
584  else
585  n_nz[my_r]++;
586 
587  n_nz[my_r] = std::min(n_nz[my_r], n_dofs_on_proc);
588  n_oz[my_r] = std::min(n_oz[my_r],
589  static_cast<dof_id_type>(n_global_dofs-n_nz[my_r]));
590  }
591  }
592  };
593 
594  Parallel::push_parallel_vector_data(this->comm(), rows_to_send,
595  rows_action_functor);
596 
597  // We should have sent everything at this point.
599 }
SparsityPattern::Graph sparsity_pattern
dof_id_type n_dofs_on_processor(const processor_id_type proc) const
Definition: dof_map.h:675
processor_id_type rank() const
const Parallel::Communicator & comm() const
uint8_t processor_id_type
dof_id_type n_dofs() const
Definition: dof_map.h:659
libmesh_assert(ctx)
std::vector< dof_id_type > n_nz
SparsityPattern::NonlocalGraph nonlocal_pattern
dof_id_type first_dof(const processor_id_type proc) const
Definition: dof_map.h:684
dof_id_type end_dof(const processor_id_type proc) const
Definition: dof_map.h:708
bool local_index(dof_id_type dof_index) const
Definition: dof_map.h:831
std::vector< dof_id_type > n_oz

◆ processor_id()

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

Definition at line 114 of file parallel_object.h.

References libMesh::ParallelObject::_communicator, and TIMPI::Communicator::rank().

Referenced by libMesh::BoundaryInfo::_find_id_maps(), 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::MeshTools::Modification::all_tri(), libMesh::DofMap::allgather_recursive_constraints(), libMesh::FEMSystem::assembly(), libMesh::Nemesis_IO::assert_symmetric_cmaps(), libMesh::Partitioner::assign_partitioning(), libMesh::Nemesis_IO_Helper::build_element_and_node_maps(), libMesh::Partitioner::build_graph(), libMesh::InfElemBuilder::build_inf_elem(), libMesh::BoundaryInfo::build_node_list_from_side_list(), libMesh::EquationSystems::build_parallel_elemental_solution_vector(), libMesh::EquationSystems::build_parallel_solution_vector(), libMesh::DistributedMesh::clear(), libMesh::DistributedMesh::clear_elems(), 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_elemental_solution(), libMesh::ExodusII_IO::copy_nodal_solution(), libMesh::ExodusII_IO::copy_scalar_solution(), libMesh::Nemesis_IO::copy_scalar_solution(), libMesh::MeshTools::correct_node_proc_ids(), libMesh::ExodusII_IO_Helper::create(), libMesh::DistributedMesh::delete_elem(), libMesh::MeshCommunication::delete_remote_elements(), libMesh::DofMap::distribute_dofs(), libMesh::DofMap::distribute_local_dofs_node_major(), libMesh::DofMap::distribute_local_dofs_var_major(), libMesh::DofMap::distribute_scalar_dofs(), libMesh::DistributedMesh::DistributedMesh(), libMesh::DofMap::end_dof(), libMesh::DofMap::end_old_dof(), libMesh::EnsightIO::EnsightIO(), libMesh::GenericProjector< FFunctor, GFunctor, FValue, ProjectionAction >::SubFunctor::find_dofs_to_send(), libMesh::MeshFunction::find_element(), libMesh::MeshFunction::find_elements(), libMesh::UnstructuredMesh::find_neighbors(), libMesh::DofMap::first_dof(), libMesh::DofMap::first_old_dof(), libMesh::RBEIMEvaluation::gather_bfs(), 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::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(), handle_vi_vj(), libMesh::LaplaceMeshSmoother::init(), 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(), join(), libMesh::TransientRBEvaluation::legacy_write_offline_data_to_files(), libMesh::RBSCMEvaluation::legacy_write_offline_data_to_files(), libMesh::RBEvaluation::legacy_write_offline_data_to_files(), 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::TriangulatorInterface::MeshedHole::MeshedHole(), 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::RBEIMEvaluation::node_gather_bfs(), operator()(), libMesh::DistributedMesh::own_node(), libMesh::BoundaryInfo::parallel_sync_node_ids(), libMesh::BoundaryInfo::parallel_sync_side_ids(), libMesh::System::point_gradient(), libMesh::System::point_hessian(), libMesh::System::point_value(), libMesh::DofMap::print_dof_constraints(), libMesh::DofMap::process_mesh_constraint_rows(), libMesh::Nemesis_IO_Helper::put_cmap_params(), libMesh::Nemesis_IO_Helper::put_elem_cmap(), libMesh::Nemesis_IO_Helper::put_elem_map(), libMesh::Nemesis_IO_Helper::put_loadbal_param(), libMesh::Nemesis_IO_Helper::put_node_cmap(), libMesh::Nemesis_IO_Helper::put_node_map(), libMesh::NameBasedIO::read(), libMesh::Nemesis_IO::read(), libMesh::XdrIO::read(), libMesh::CheckpointIO::read(), libMesh::EquationSystems::read(), libMesh::ExodusII_IO_Helper::read_elem_num_map(), libMesh::ExodusII_IO_Helper::read_global_values(), libMesh::ExodusII_IO::read_header(), libMesh::CheckpointIO::read_header(), libMesh::XdrIO::read_header(), libMesh::System::read_header(), libMesh::System::read_legacy_data(), libMesh::DynaIO::read_mesh(), 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::Nemesis_IO_Helper::read_var_names_impl(), libMesh::DistributedMesh::renumber_dof_objects(), libMesh::DistributedMesh::renumber_nodes_and_elements(), libMesh::DofMap::scatter_constraints(), libMesh::CheckpointIO::select_split_config(), libMesh::DistributedMesh::set_next_unique_id(), libMesh::DofMap::set_nonlocal_dof_objects(), libMesh::PetscDMWrapper::set_point_range_in_section(), libMesh::RBEIMEvaluation::side_gather_bfs(), ExodusTest< elem_type >::test_read_gold(), ExodusTest< elem_type >::test_write(), MeshInputTest::testAbaqusRead(), MeshInputTest::testCopyElementSolutionImpl(), MeshInputTest::testCopyElementVectorImpl(), MeshInputTest::testCopyNodalSolutionImpl(), DefaultCouplingTest::testCoupling(), PointNeighborCouplingTest::testCoupling(), MeshInputTest::testDynaFileMappings(), MeshInputTest::testDynaNoSplines(), MeshInputTest::testDynaReadElem(), MeshInputTest::testDynaReadPatch(), MeshInputTest::testExodusFileMappings(), MeshInputTest::testExodusIGASidesets(), MeshInputTest::testExodusWriteElementDataFromDiscontinuousNodalData(), MeshInputTest::testLowOrderEdgeBlocks(), SystemsTest::testProjectMatrix1D(), SystemsTest::testProjectMatrix2D(), SystemsTest::testProjectMatrix3D(), BoundaryInfoTest::testShellFaceConstraints(), MeshInputTest::testSingleElementImpl(), WriteVecAndScalar::testSolution(), CheckpointIOTest::testSplitter(), MeshInputTest::testTetgenIO(), libMesh::MeshTools::total_weight(), libMesh::MeshRefinement::uniformly_coarsen(), libMesh::DistributedMesh::update_parallel_id_counts(), libMesh::DTKAdapter::update_variable_values(), libMesh::NameBasedIO::write(), libMesh::XdrIO::write(), libMesh::CheckpointIO::write(), libMesh::EquationSystems::write(), libMesh::GMVIO::write_discontinuous_gmv(), libMesh::ExodusII_IO::write_element_data(), libMesh::ExodusII_IO_Helper::write_element_values(), libMesh::ExodusII_IO_Helper::write_element_values_element_major(), libMesh::ExodusII_IO_Helper::write_elements(), libMesh::ExodusII_IO_Helper::write_elemset_data(), libMesh::ExodusII_IO_Helper::write_elemsets(), 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::VTKIO::write_nodal_data(), libMesh::ExodusII_IO::write_nodal_data(), libMesh::ExodusII_IO::write_nodal_data_common(), libMesh::ExodusII_IO::write_nodal_data_discontinuous(), libMesh::ExodusII_IO_Helper::write_nodal_values(), libMesh::ExodusII_IO_Helper::write_nodeset_data(), libMesh::Nemesis_IO_Helper::write_nodesets(), libMesh::ExodusII_IO_Helper::write_nodesets(), libMesh::RBEIMEvaluation::write_out_interior_basis_functions(), libMesh::RBEIMEvaluation::write_out_node_basis_functions(), libMesh::RBEIMEvaluation::write_out_side_basis_functions(), 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().

115  { return cast_int<processor_id_type>(_communicator.rank()); }
processor_id_type rank() const
const Parallel::Communicator & _communicator

◆ sorted_connected_dofs()

void libMesh::SparsityPattern::Build::sorted_connected_dofs ( const Elem elem,
std::vector< dof_id_type > &  dofs_vi,
unsigned int  vi 
)
private

Definition at line 92 of file sparsity_pattern.C.

References libMesh::DofMap::dof_indices(), dof_map, and libMesh::DofMap::find_connected_dofs().

Referenced by operator()().

95 {
96  dof_map.dof_indices (elem, dofs_vi, vi);
97 #ifdef LIBMESH_ENABLE_CONSTRAINTS
98  dof_map.find_connected_dofs (dofs_vi);
99 #endif
100  // We can be more efficient if we sort the element DOFs into
101  // increasing order
102  std::sort(dofs_vi.begin(), dofs_vi.end());
103 
104  // Handle cases where duplicate nodes are intentionally assigned to
105  // a single element.
106  dofs_vi.erase(std::unique(dofs_vi.begin(), dofs_vi.end()), dofs_vi.end());
107 }
void find_connected_dofs(std::vector< dof_id_type > &elem_dofs) const
Finds all the DOFS associated with the element DOFs elem_dofs.
Definition: dof_map.C:2852
void dof_indices(const Elem *const elem, std::vector< dof_id_type > &di) const
Fills the vector di with the global degree of freedom indices for the element.
Definition: dof_map.C:1992

Member Data Documentation

◆ _communicator

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

◆ calculate_constrained

const bool libMesh::SparsityPattern::Build::calculate_constrained
private

Definition at line 212 of file sparsity_pattern.h.

◆ coupling_functors

const std::set<GhostingFunctor *>& libMesh::SparsityPattern::Build::coupling_functors
private

Definition at line 209 of file sparsity_pattern.h.

◆ dof_coupling

const CouplingMatrix* libMesh::SparsityPattern::Build::dof_coupling
private

Definition at line 208 of file sparsity_pattern.h.

◆ dof_map

const DofMap& libMesh::SparsityPattern::Build::dof_map
private

◆ hashed_dof_sets

std::unordered_set<dof_id_type> libMesh::SparsityPattern::Build::hashed_dof_sets
private

Definition at line 223 of file sparsity_pattern.h.

Referenced by handle_vi_vj(), and join().

◆ implicit_neighbor_dofs

const bool libMesh::SparsityPattern::Build::implicit_neighbor_dofs
private

Definition at line 210 of file sparsity_pattern.h.

◆ n_nz

std::vector<dof_id_type> libMesh::SparsityPattern::Build::n_nz
private

◆ n_oz

std::vector<dof_id_type> libMesh::SparsityPattern::Build::n_oz
private

◆ need_full_sparsity_pattern

const bool libMesh::SparsityPattern::Build::need_full_sparsity_pattern
private

Definition at line 211 of file sparsity_pattern.h.

Referenced by join(), operator()(), and parallel_sync().

◆ nonlocal_pattern

SparsityPattern::NonlocalGraph libMesh::SparsityPattern::Build::nonlocal_pattern
private

◆ sparsity_pattern

SparsityPattern::Graph libMesh::SparsityPattern::Build::sparsity_pattern
private

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