reinit(const IndexSet &is_locally_owned, const IndexSet &is_locally_ghost)
{
this->n_local_elements = is_locally_owned.n_elements();
+ this->n_ghost_elements = is_locally_ghost.n_elements();
+
+ this->n_mpi_processes_ = Utilities::MPI::n_mpi_processes(comm);
std::vector<unsigned int> sm_ranks(
Utilities::MPI::n_mpi_processes(comm_sm));
compress_finish(data_this, data_others, buffer);
}
+ std::size_t
+ local_size() const
+ {
+ return n_local_elements;
+ }
+
+ std::size_t
+ n_ghost_indices() const
+ {
+ return n_ghost_elements;
+ }
+
+ std::size_t
+ n_mpi_processes() const
+ {
+ return n_mpi_processes_;
+ }
+
private:
const MPI_Comm &comm;
const MPI_Comm &comm_sm;
+ unsigned int n_mpi_processes_;
+
unsigned int n_local_elements;
+ unsigned int n_ghost_elements;
std::vector<unsigned int> recv_remote_ranks;
std::vector<types::global_dof_index> recv_remote_ptr = {0};
- mutable std::vector<MPI_Request> recv_remote_req;
+ mutable std::vector<MPI_Request> recv_remote_req; // TODO: move
std::vector<unsigned int> recv_sm_ranks;
std::vector<unsigned int> recv_sm_ptr = {0};
- mutable std::vector<MPI_Request> recv_sm_req;
+ mutable std::vector<MPI_Request> recv_sm_req; // TODO: move
std::vector<unsigned int> recv_sm_indices;
std::vector<unsigned int> recv_sm_offset;
std::vector<unsigned int> send_remote_ranks;
std::vector<unsigned int> send_remote_ptr = {0};
std::vector<unsigned int> send_remote_indices;
- mutable std::vector<MPI_Request> send_remote_req;
+ mutable std::vector<MPI_Request> send_remote_req; // TODO: move
std::vector<unsigned int> send_sm_ranks;
std::vector<unsigned int> send_sm_ptr = {0};
std::vector<unsigned int> send_sm_indices;
- mutable std::vector<MPI_Request> send_sm_req;
+ mutable std::vector<MPI_Request> send_sm_req; // TODO: move
std::vector<unsigned int> send_sm_offset;
};
partitioner = v.partitioner;
partitioner_sm = v.partitioner_sm;
const size_type new_allocated_size =
- partitioner->local_size() + partitioner->n_ghost_indices();
+ partitioner_sm->local_size() + partitioner_sm->n_ghost_indices();
resize_val(new_allocated_size,
partitioner_sm->get_sm_mpi_communicator());
}
// set vector size and allocate memory
const size_type new_allocated_size =
- this->partitioner->local_size() + this->partitioner->n_ghost_indices();
+ this->partitioner_sm->local_size() +
+ this->partitioner_sm->n_ghost_indices();
resize_val(new_allocated_size, partitioner_sm->get_sm_mpi_communicator());
// initialize to zero
{
dealii::internal::VectorOperations::
functions<Number, Number, MemorySpaceType>::copy(
- thread_loop_partitioner, partitioner->local_size(), v.data, data);
+ thread_loop_partitioner,
+ partitioner_sm->local_size(),
+ v.data,
+ data);
}
}
thread_loop_partitioner = c.thread_loop_partitioner;
- const size_type this_size = partitioner->local_size();
+ const size_type this_size = partitioner_sm->local_size();
if (this_size > 0)
{
dealii::internal::VectorOperations::
Vector<Number, MemorySpaceType>::zero_out_ghosts() const
{
if (data.values != nullptr)
- std::fill_n(data.values.get() + partitioner->local_size(),
- partitioner->n_ghost_indices(),
+ std::fill_n(data.values.get() + partitioner_sm->local_size(),
+ partitioner_sm->n_ghost_indices(),
Number());
vector_is_ghosted = false;
dealii::internal::VectorOperations::
functions<Number, Number, MemorySpaceType>::subtract_vector(
- thread_loop_partitioner, partitioner->local_size(), v.data, data);
+ thread_loop_partitioner, partitioner_sm->local_size(), v.data, data);
if (vector_is_ghosted)
update_ghost_values();
dealii::internal::VectorOperations::
functions<Number, Number, MemorySpaceType>::add_av(
- thread_loop_partitioner, partitioner->local_size(), a, v.data, data);
+ thread_loop_partitioner,
+ partitioner_sm->local_size(),
+ a,
+ v.data,
+ data);
}
dealii::internal::VectorOperations::
functions<Number, Number, MemorySpaceType>::sadd_xav(
thread_loop_partitioner,
- partitioner->local_size(),
+ partitioner_sm->local_size(),
x,
a,
v.data,
dealii::internal::VectorOperations::
functions<Number, Number, MemorySpaceType>::equ_au(
- thread_loop_partitioner, partitioner->local_size(), a, v.data, data);
+ thread_loop_partitioner,
+ partitioner_sm->local_size(),
+ a,
+ v.data,
+ data);
if (vector_is_ghosted)
if (PointerComparison::equal(this, &v))
return norm_sqr_local();
- AssertDimension(partitioner->local_size(), v.partitioner->local_size());
+ AssertDimension(partitioner_sm->local_size(),
+ v.partitioner_sm->local_size());
return dealii::internal::VectorOperations::
functions<Number, Number2, MemorySpaceType>::dot(
- thread_loop_partitioner, partitioner->local_size(), v.data, data);
+ thread_loop_partitioner, partitioner_sm->local_size(), v.data, data);
}
const VectorType &v = dynamic_cast<const VectorType &>(vv);
Number local_result = inner_product_local(v);
- if (partitioner->n_mpi_processes() > 1)
+ if (partitioner_sm->n_mpi_processes() > 1)
return Utilities::MPI::sum(local_result,
- partitioner->get_mpi_communicator());
+ partitioner_sm->get_mpi_communicator());
else
return local_result;
}
dealii::internal::VectorOperations::
functions<Number, Number, MemorySpaceType>::norm_2(
- thread_loop_partitioner, partitioner->local_size(), sum, data);
+ thread_loop_partitioner, partitioner_sm->local_size(), sum, data);
AssertIsFinite(sum);
Vector<Number, MemorySpaceType>::norm_sqr() const
{
real_type local_result = norm_sqr_local();
- if (partitioner->n_mpi_processes() > 1)
+ if (partitioner_sm->n_mpi_processes() > 1)
return Utilities::MPI::sum(local_result,
- partitioner->get_mpi_communicator());
+ partitioner_sm->get_mpi_communicator());
else
return local_result;
}
{
real_type max = 0.;
- const size_type local_size = partitioner->local_size();
+ const size_type local_size = partitioner_sm->local_size();
internal::la_parallel_vector_templates_functions<
Number,
MemorySpaceType>::linfty_norm_local(data, local_size, max);
Vector<Number, MemorySpaceType>::linfty_norm() const
{
const real_type local_result = linfty_norm_local();
- if (partitioner->n_mpi_processes() > 1)
+ if (partitioner_sm->n_mpi_processes() > 1)
return Utilities::MPI::max(local_result,
- partitioner->get_mpi_communicator());
+ partitioner_sm->get_mpi_communicator());
else
return local_result;
}
const Vector<Number, MemorySpaceType> &v,
const Vector<Number, MemorySpaceType> &w)
{
- const size_type vec_size = partitioner->local_size();
+ const size_type vec_size = partitioner_sm->local_size();
AssertDimension(vec_size, v.local_size());
AssertDimension(vec_size, w.local_size());
const VectorType &w = dynamic_cast<const VectorType &>(ww);
Number local_result = add_and_dot_local(a, v, w);
- if (partitioner->n_mpi_processes() > 1)
+ if (partitioner_sm->n_mpi_processes() > 1)
return Utilities::MPI::sum(local_result,
- partitioner->get_mpi_communicator());
+ partitioner_sm->get_mpi_communicator());
else
return local_result;
}