flux_coupling,
Utilities::MPI::this_mpi_process(
MPI_COMM_WORLD));
- SparsityTools::distribute_sparsity_pattern(
- sp,
- dh.compute_n_locally_owned_dofs_per_processor(),
- MPI_COMM_WORLD,
- relevant_partitioning);
+ SparsityTools::distribute_sparsity_pattern(sp,
+ dh.locally_owned_dofs(),
+ MPI_COMM_WORLD,
+ relevant_partitioning);
// Output
MPI_Barrier(MPI_COMM_WORLD);
dynamic_sparsity_pattern.print(deallog.get_file_stream());
SparsityTools::distribute_sparsity_pattern(
dynamic_sparsity_pattern,
- dof_handler_0.compute_n_locally_owned_dofs_per_processor(),
+ dof_handler_0.locally_owned_dofs(),
MPI_COMM_WORLD,
dof_handler_0.locally_owned_dofs());
dynamic_sparsity_pattern.print(deallog.get_file_stream());
dynamic_sparsity_pattern.print(deallog.get_file_stream());
SparsityTools::distribute_sparsity_pattern(
dynamic_sparsity_pattern,
- dof_handler_0.compute_n_locally_owned_dofs_per_processor(),
+ dof_handler_0.locally_owned_dofs(),
MPI_COMM_WORLD,
dof_handler_0.locally_owned_dofs());
dynamic_sparsity_pattern.print(deallog.get_file_stream());
DynamicSparsityPattern dsp(locally_relevant_dofs);
DoFTools::make_sparsity_pattern(dof_handler, dsp, constraints, false);
- SparsityTools::distribute_sparsity_pattern(
- dsp,
- dof_handler.compute_n_locally_owned_dofs_per_processor(),
- mpi_communicator,
- locally_relevant_dofs);
+ SparsityTools::distribute_sparsity_pattern(dsp,
+ locally_owned_dofs,
+ mpi_communicator,
+ locally_relevant_dofs);
system_matrix.reinit(locally_owned_dofs,
locally_owned_dofs,
DynamicSparsityPattern dsp(locally_relevant_dofs);
DoFTools::make_sparsity_pattern(dof_handler, dsp, constraints, false);
- SparsityTools::distribute_sparsity_pattern(
- dsp,
- dof_handler.compute_n_locally_owned_dofs_per_processor(),
- mpi_communicator,
- locally_relevant_dofs);
+ SparsityTools::distribute_sparsity_pattern(dsp,
+ locally_owned_dofs,
+ mpi_communicator,
+ locally_relevant_dofs);
system_matrix.reinit(locally_owned_dofs,
locally_owned_dofs,
SparsityTools::distribute_sparsity_pattern(
sp,
- stokes_dof_handler.compute_locally_owned_dofs_per_processor(),
+ stokes_dof_handler.locally_owned_dofs(),
MPI_COMM_WORLD,
stokes_relevant_set);
BlockDynamicSparsityPattern bcsp(locally_relevant_partitioning);
DoFTools::make_sparsity_pattern(dof_handler, bcsp, constraints, false);
- SparsityTools::distribute_sparsity_pattern(
- bcsp,
- dof_handler.compute_locally_owned_dofs_per_processor(),
- MPI_COMM_WORLD,
- locally_relevant_dofs);
+ SparsityTools::distribute_sparsity_pattern(bcsp,
+ locally_owned_dofs,
+ MPI_COMM_WORLD,
+ locally_relevant_dofs);
typename LA::MPI::BlockSparseMatrix A;
A.reinit(locally_owned_partitioning, bcsp, MPI_COMM_WORLD);
false,
Utilities::MPI::this_mpi_process(
MPI_COMM_WORLD));
- SparsityTools::distribute_sparsity_pattern(
- sp,
- dof_handler.compute_n_locally_owned_dofs_per_processor(),
- MPI_COMM_WORLD,
- relevant);
+ SparsityTools::distribute_sparsity_pattern(sp,
+ owned,
+ MPI_COMM_WORLD,
+ relevant);
sp.compress();
matrix.reinit(owned, owned, sp, MPI_COMM_WORLD);
DoFTools::extract_locally_relevant_dofs(dof_handler, locally_relevant_dofs);
-
DynamicSparsityPattern dsp(dof_handler.n_dofs());
DoFTools::make_sparsity_pattern(dof_handler, dsp, constraints, false);
- SparsityTools::distribute_sparsity_pattern(
- dsp,
- dof_handler.compute_n_locally_owned_dofs_per_processor(),
- MPI_COMM_WORLD,
- locally_relevant_dofs);
+ SparsityTools::distribute_sparsity_pattern(dsp,
+ locally_owned_dofs,
+ MPI_COMM_WORLD,
+ locally_relevant_dofs);
system_matrix.reinit(locally_owned_dofs,
locally_owned_dofs,
DoFTools::extract_locally_relevant_dofs(dof_handler, locally_relevant_dofs);
-
DynamicSparsityPattern dsp(dof_handler.n_dofs());
DoFTools::make_sparsity_pattern(dof_handler, dsp, constraints, false);
- SparsityTools::distribute_sparsity_pattern(
- dsp,
- dof_handler.compute_n_locally_owned_dofs_per_processor(),
- MPI_COMM_WORLD,
- locally_relevant_dofs);
+ SparsityTools::distribute_sparsity_pattern(dsp,
+ locally_owned_dofs,
+ MPI_COMM_WORLD,
+ locally_relevant_dofs);
system_matrix.reinit(locally_owned_dofs,
locally_owned_dofs,
dynamic_sparsity_pattern,
cell_integral_mask,
flux_integral_mask);
- SparsityTools::distribute_sparsity_pattern(
- dynamic_sparsity_pattern,
- dof_handler.compute_n_locally_owned_dofs_per_processor(),
- MPI_COMM_WORLD,
- locally_relevant_dofs);
+ SparsityTools::distribute_sparsity_pattern(dynamic_sparsity_pattern,
+ locally_owned_dofs,
+ MPI_COMM_WORLD,
+ locally_relevant_dofs);
system_matrix.reinit(locally_owned_dofs,
locally_owned_dofs,
-// check SparsityTools::distribute_sparsity_pattern
+// check SparsityTools::distribute_sparsity_pattern with the slow part of
+// supplying the number of rows on all processes
#include <deal.II/base/index_set.h>
#include <deal.II/base/utilities.h>
if (myid == 0)
deallog << "Running on " << numprocs << " CPU(s)." << std::endl;
- unsigned int num_local = 10;
- unsigned int n = numprocs * num_local;
- std::vector<IndexSet> locally_owned_dofs_per_cpu(numprocs, IndexSet(n));
- for (unsigned int i = 0; i < numprocs; ++i)
- locally_owned_dofs_per_cpu[i].add_range((i)*num_local, (i + 1) * num_local);
-
- IndexSet locally_rel(n);
- locally_rel.add_range(myid * num_local, (myid + 1) * num_local);
+ unsigned int num_local = 10;
+ unsigned int n = numprocs * num_local;
+ IndexSet locally_owned_dofs(n);
+ locally_owned_dofs.add_range(myid * num_local, (myid + 1) * num_local);
+
+ IndexSet locally_rel(locally_owned_dofs);
if (myid > 0)
locally_rel.add_range((myid - 1) * num_local, (myid + 0) * num_local);
if (myid < numprocs - 1)
}
SparsityTools::distribute_sparsity_pattern(csp,
- locally_owned_dofs_per_cpu,
+ locally_owned_dofs,
MPI_COMM_WORLD,
locally_rel);
/* {
for (unsigned int i = 0; i < n; ++i)
csp.add(i, myid);
- std::vector<IndexSet> locally_owned_dofs_per_cpu2(numprocs, IndexSet(n));
- for (unsigned int i = 0; i < numprocs; ++i)
- locally_owned_dofs_per_cpu2[i].add_range((i)*num_local,
- (i + 1) * num_local);
-
-
SparsityTools::distribute_sparsity_pattern(csp,
- locally_owned_dofs_per_cpu2,
+ locally_owned_dofs,
MPI_COMM_WORLD,
locally_rel);
DoFTools::make_sparsity_pattern(dof_handler, dsp, constraints, false);
- SparsityTools::distribute_sparsity_pattern(
- dsp,
- dof_handler.compute_n_locally_owned_dofs_per_processor(),
- communicator,
- locally_relevant_dofs);
+ SparsityTools::distribute_sparsity_pattern(dsp,
+ locally_owned_dofs,
+ communicator,
+ locally_relevant_dofs);
system_matrix.reinit(locally_owned_dofs,
locally_owned_dofs,
dof_handler.n_dofs(),
locally_relevant_dofs);
DoFTools::make_sparsity_pattern(dof_handler, csp, constraints, false);
- SparsityTools::distribute_sparsity_pattern(
- csp,
- dof_handler.compute_n_locally_owned_dofs_per_processor(),
- mpi_communicator,
- locally_relevant_dofs);
+ SparsityTools::distribute_sparsity_pattern(csp,
+ locally_owned_dofs,
+ mpi_communicator,
+ locally_relevant_dofs);
system_matrix.reinit(
mpi_communicator,
csp,
dof_handler.n_dofs(),
locally_relevant_dofs);
DoFTools::make_sparsity_pattern(dof_handler, csp, constraints, false);
- SparsityTools::distribute_sparsity_pattern(
- csp,
- dof_handler.compute_n_locally_owned_dofs_per_processor(),
- mpi_communicator,
- locally_relevant_dofs);
+ SparsityTools::distribute_sparsity_pattern(csp,
+ locally_owned_dofs,
+ mpi_communicator,
+ locally_relevant_dofs);
system_matrix.reinit(
mpi_communicator,
csp,
constraints.close();
DynamicSparsityPattern csp(locally_relevant_dofs);
DoFTools::make_sparsity_pattern(dof_handler, csp, constraints, false);
- SparsityTools::distribute_sparsity_pattern(
- csp,
- dof_handler.compute_n_locally_owned_dofs_per_processor(),
- mpi_communicator,
- locally_relevant_dofs);
+ SparsityTools::distribute_sparsity_pattern(csp,
+ locally_owned_dofs,
+ mpi_communicator,
+ locally_relevant_dofs);
system_matrix.reinit(locally_owned_dofs,
locally_owned_dofs,
csp,
dof_handler.n_dofs(),
locally_relevant_dofs);
DoFTools::make_sparsity_pattern(dof_handler, csp, constraints, false);
- SparsityTools::distribute_sparsity_pattern(
- csp,
- dof_handler.compute_n_locally_owned_dofs_per_processor(),
- mpi_communicator,
- locally_relevant_dofs);
+ SparsityTools::distribute_sparsity_pattern(csp,
+ dof_handler.locally_owned_dofs(),
+ mpi_communicator,
+ locally_relevant_dofs);
system_matrix.reinit(
mpi_communicator,
csp,
DynamicSparsityPattern dsp(locally_relevant_dofs);
DoFTools::make_sparsity_pattern(dof_handler, dsp, constraints, false);
- SparsityTools::distribute_sparsity_pattern(
- dsp,
- dof_handler.compute_n_locally_owned_dofs_per_processor(),
- mpi_communicator,
- locally_relevant_dofs);
+ SparsityTools::distribute_sparsity_pattern(dsp,
+ locally_owned_dofs,
+ mpi_communicator,
+ locally_relevant_dofs);
system_matrix.reinit(locally_owned_dofs,
locally_owned_dofs,
dof_handler.n_dofs(),
locally_relevant_dofs);
DoFTools::make_sparsity_pattern(dof_handler, csp, constraints, false);
- SparsityTools::distribute_sparsity_pattern(
- csp,
- dof_handler.compute_n_locally_owned_dofs_per_processor(),
- mpi_communicator,
- locally_relevant_dofs);
+ SparsityTools::distribute_sparsity_pattern(csp,
+ locally_owned_dofs,
+ mpi_communicator,
+ locally_relevant_dofs);
system_matrix.reinit(
mpi_communicator,
csp,
dof_handler.n_dofs(),
locally_relevant_dofs);
DoFTools::make_sparsity_pattern(dof_handler, csp, constraints, false);
- SparsityTools::distribute_sparsity_pattern(
- csp,
- dof_handler.compute_n_locally_owned_dofs_per_processor(),
- mpi_communicator,
- locally_relevant_dofs);
+ SparsityTools::distribute_sparsity_pattern(csp,
+ locally_owned_dofs,
+ mpi_communicator,
+ locally_relevant_dofs);
system_matrix.reinit(
mpi_communicator,
csp,
dof_handler.n_dofs(),
locally_relevant_dofs);
DoFTools::make_sparsity_pattern(dof_handler, csp, constraints, false);
- SparsityTools::distribute_sparsity_pattern(
- csp,
- dof_handler.compute_n_locally_owned_dofs_per_processor(),
- mpi_communicator,
- locally_relevant_dofs);
+ SparsityTools::distribute_sparsity_pattern(csp,
+ locally_owned_dofs,
+ mpi_communicator,
+ locally_relevant_dofs);
system_matrix.reinit(
mpi_communicator,
csp,
dof_handler.n_dofs(),
locally_relevant_dofs);
DoFTools::make_sparsity_pattern(dof_handler, csp, constraints, false);
- SparsityTools::distribute_sparsity_pattern(
- csp,
- dof_handler.compute_n_locally_owned_dofs_per_processor(),
- mpi_communicator,
- locally_relevant_dofs);
+ SparsityTools::distribute_sparsity_pattern(csp,
+ locally_owned_dofs,
+ mpi_communicator,
+ locally_relevant_dofs);
system_matrix.reinit(
mpi_communicator,
csp,
DynamicSparsityPattern dsp(locally_relevant_dofs);
DoFTools::make_sparsity_pattern(dof_handler, dsp, constraints, false);
- SparsityTools::distribute_sparsity_pattern(
- dsp,
- dof_handler.compute_n_locally_owned_dofs_per_processor(),
- mpi_communicator,
- locally_relevant_dofs);
+ SparsityTools::distribute_sparsity_pattern(dsp,
+ locally_owned_dofs,
+ mpi_communicator,
+ locally_relevant_dofs);
system_matrix.reinit(locally_owned_dofs,
locally_owned_dofs,
DynamicSparsityPattern dsp(locally_relevant_dofs);
DoFTools::make_sparsity_pattern(dof_handler, dsp, constraints, false);
- SparsityTools::distribute_sparsity_pattern(
- dsp,
- dof_handler.compute_n_locally_owned_dofs_per_processor(),
- mpi_communicator,
- locally_relevant_dofs);
+ SparsityTools::distribute_sparsity_pattern(dsp,
+ locally_owned_dofs,
+ mpi_communicator,
+ locally_relevant_dofs);
mass_matrix.reinit(locally_owned_dofs,
locally_owned_dofs,
const unsigned int n_mpi_processes;
const unsigned int this_mpi_process;
ConditionalOStream pcout;
- std::vector<types::global_dof_index> local_dofs_per_process;
IndexSet locally_owned_dofs;
IndexSet locally_relevant_dofs;
- unsigned int n_local_cells;
static const SymmetricTensor<4, dim> stress_strain_tensor;
int monitored_vertex_first_dof;
};
dof_handler.distribute_dofs(fe);
locally_owned_dofs = dof_handler.locally_owned_dofs();
DoFTools::extract_locally_relevant_dofs(dof_handler, locally_relevant_dofs);
- n_local_cells = GridTools::count_cells_with_subdomain_association(
- triangulation, triangulation.locally_owned_subdomain());
- local_dofs_per_process =
- dof_handler.compute_n_locally_owned_dofs_per_processor();
hanging_node_constraints.clear();
DoFTools::make_hanging_node_constraints(dof_handler,
hanging_node_constraints);
hanging_node_constraints,
/*keep constrained dofs*/ false);
SparsityTools::distribute_sparsity_pattern(sparsity_pattern,
- local_dofs_per_process,
+ locally_owned_dofs,
mpi_communicator,
locally_relevant_dofs);
system_matrix.reinit(locally_owned_dofs,
const unsigned int n_mpi_processes;
const unsigned int this_mpi_process;
ConditionalOStream pcout;
- std::vector<types::global_dof_index> local_dofs_per_process;
IndexSet locally_owned_dofs;
IndexSet locally_relevant_dofs;
- unsigned int n_local_cells;
static const SymmetricTensor<4, dim> stress_strain_tensor;
int monitored_vertex_first_dof;
};
dof_handler.distribute_dofs(fe);
locally_owned_dofs = dof_handler.locally_owned_dofs();
DoFTools::extract_locally_relevant_dofs(dof_handler, locally_relevant_dofs);
- n_local_cells = GridTools::count_cells_with_subdomain_association(
- triangulation, triangulation.locally_owned_subdomain());
- local_dofs_per_process =
- dof_handler.compute_n_locally_owned_dofs_per_processor();
hanging_node_constraints.clear();
DoFTools::make_hanging_node_constraints(dof_handler,
hanging_node_constraints);
hanging_node_constraints,
/*keep constrained dofs*/ false);
SparsityTools::distribute_sparsity_pattern(sparsity_pattern,
- local_dofs_per_process,
+ locally_owned_dofs,
mpi_communicator,
locally_relevant_dofs);
system_matrix.reinit(locally_owned_dofs,
else
owned.add_range(7, 10);
- const auto rows_per_cpu = Utilities::MPI::all_gather(comm, owned);
-
IndexSet ghost_range(owned);
if (myid == 0)
{
deallog << "Before gather_sparsity_pattern:" << std::endl;
dsp.print(deallog.get_file_stream());
- SparsityTools::gather_sparsity_pattern(dsp, rows_per_cpu, comm, ghost_range);
+ SparsityTools::gather_sparsity_pattern(dsp, owned, comm, ghost_range);
deallog << "After gather_sparsity_pattern:" << std::endl;
dsp.print(deallog.get_file_stream());
DynamicSparsityPattern dsp(dof_handler.n_dofs());
DoFTools::make_sparsity_pattern(dof_handler, dsp, constraints, false);
- SparsityTools::distribute_sparsity_pattern(
- dsp,
- dof_handler.compute_n_locally_owned_dofs_per_processor(),
- MPI_COMM_WORLD,
- locally_relevant_dofs);
+ SparsityTools::distribute_sparsity_pattern(dsp,
+ locally_owned_dofs,
+ MPI_COMM_WORLD,
+ locally_relevant_dofs);
system_matrix.reinit(locally_owned_dofs,
locally_owned_dofs,
DynamicSparsityPattern dsp(dof_handler.n_dofs());
DoFTools::make_sparsity_pattern(dof_handler, dsp, constraints, false);
- SparsityTools::distribute_sparsity_pattern(
- dsp,
- dof_handler.compute_n_locally_owned_dofs_per_processor(),
- MPI_COMM_WORLD,
- locally_relevant_dofs);
+ SparsityTools::distribute_sparsity_pattern(dsp,
+ locally_owned_dofs,
+ MPI_COMM_WORLD,
+ locally_relevant_dofs);
system_matrix.reinit(locally_owned_dofs,
locally_owned_dofs,
cell_integral_mask,
flux_integral_mask);
- SparsityTools::distribute_sparsity_pattern(
- dynamic_sparsity_pattern,
- dof_handler.compute_n_locally_owned_dofs_per_processor(),
- MPI_COMM_WORLD,
- locally_relevant_dofs);
+ SparsityTools::distribute_sparsity_pattern(dynamic_sparsity_pattern,
+ locally_owned_dofs,
+ MPI_COMM_WORLD,
+ locally_relevant_dofs);
system_matrix.reinit(locally_owned_dofs,
locally_owned_dofs,
sparsity_pattern,
constraints,
/*keep constrained dofs*/ false);
- SparsityTools::distribute_sparsity_pattern(
- sparsity_pattern,
- dof_handler.compute_n_locally_owned_dofs_per_processor(),
- MPI_COMM_WORLD,
- locally_relevant_dofs);
+ SparsityTools::distribute_sparsity_pattern(sparsity_pattern,
+ locally_owned_dofs,
+ MPI_COMM_WORLD,
+ locally_relevant_dofs);
system_matrix.reinit(locally_owned_dofs,
locally_owned_dofs,
DoFTools::make_sparsity_pattern(dof_handler, dsp, constraints, false);
- SparsityTools::distribute_sparsity_pattern(
- dsp,
- dof_handler.compute_n_locally_owned_dofs_per_processor(),
- mpi_comm,
- locally_relevant_dofs);
+ SparsityTools::distribute_sparsity_pattern(dsp,
+ locally_owned_dofs,
+ mpi_comm,
+ locally_relevant_dofs);
system_matrix.reinit(locally_owned_dofs, locally_owned_dofs, dsp, mpi_comm);
}