* used.
*
* @pre The size of the @p temporary_storage vector has to be at least
- * as large as the sum of the number of entries in the index sets
- * passed to the constructor and the reinit() functions. The reason
- * for this is that this vector is used as buffer for both sending
- * and receiving data.
+ * temporary_storage_size. The reason for this is that this vector is
+ * used as buffer for both sending and receiving data.
*/
template <typename Number>
void
* allows for padding and other post-processing of the received data.
*
* @pre The required size of the vectors are the same as in the functions
- * above.
+ * above.
*/
template <typename Number>
void
* destination vector.
*
* @pre The required size of the vectors are the same as in the functions
- * above.
+ * above.
*/
template <typename Number>
void
* number of processes this process receives data from.
*/
std::pair<unsigned int, unsigned int>
- n_targets();
+ n_targets() const;
+
+ /**
+ * Return the size of the temporary storage needed by the
+ * export_to_ghosted_array() functions, if the temporary storage is
+ * handled by the user code.
+ */
+ unsigned int
+ temporary_storage_size() const;
/**
* Return memory consumption in Byte.
std::pair<unsigned int, unsigned int>
- NoncontiguousPartitioner::n_targets()
+ NoncontiguousPartitioner::n_targets() const
{
return {send_ranks.size(), recv_ranks.size()};
}
+ unsigned int
+ NoncontiguousPartitioner::temporary_storage_size() const
+ {
+ return send_ptr.back();
+ }
+
+
+
types::global_dof_index
NoncontiguousPartitioner::memory_consumption()
{
requests.resize(send_ranks.size() + recv_ranks.size());
if (this->buffers.size() != send_ptr.back() * sizeof(Number))
- this->buffers.resize(send_ptr.back() * sizeof(Number), 0);
+ this->buffers.resize(this->temporary_storage_size() * sizeof(Number));
// perform actual exchange
this->template export_to_ghosted_array<Number>(