MCPcopy Create free account
hub / github.com/FEniCS/dolfinx / IndexMap

Method IndexMap

cpp/dolfinx/common/IndexMap.cpp:856–879  ·  view source on GitHub ↗

----------------------------------------------------------------------------- -----------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

854//-----------------------------------------------------------------------------
855//-----------------------------------------------------------------------------
856IndexMap::IndexMap(MPI_Comm comm, std::int32_t local_size) : _comm(comm, true)
857{
858 // Get global offset (index), using partial exclusive reduction
859 std::int64_t offset = 0;
860 const std::int64_t local_size_tmp = local_size;
861 MPI_Request request_scan;
862 int ierr = MPI_Iexscan(&local_size_tmp, &offset, 1, MPI_INT64_T, MPI_SUM,
863 _comm.comm(), &request_scan);
864 dolfinx::MPI::check_error(_comm.comm(), ierr);
865
866 // Send local size to sum reduction to get global size
867 MPI_Request request;
868 ierr = MPI_Iallreduce(&local_size_tmp, &_size_global, 1, MPI_INT64_T, MPI_SUM,
869 comm, &request);
870 dolfinx::MPI::check_error(_comm.comm(), ierr);
871
872 ierr = MPI_Wait(&request_scan, MPI_STATUS_IGNORE);
873 dolfinx::MPI::check_error(_comm.comm(), ierr);
874 _local_range = {offset, offset + local_size};
875
876 // Wait for the MPI_Iallreduce to complete
877 ierr = MPI_Wait(&request, MPI_STATUS_IGNORE);
878 dolfinx::MPI::check_error(_comm.comm(), ierr);
879}
880//-----------------------------------------------------------------------------
881IndexMap::IndexMap(MPI_Comm comm, std::int32_t local_size,
882 std::span<const std::int64_t> ghosts,

Callers 7

test_scatter_forwardFunction · 0.45
test_scatter_reverseFunction · 0.45
test_sub_index_mapFunction · 0.45
create_point_meshFunction · 0.45

Calls 4

build_src_destFunction · 0.85
check_errorFunction · 0.50
commMethod · 0.45
sizeMethod · 0.45