, addresses_(addresses, addresses + number_of_addresses)
, datatypes_(datatypes, datatypes + number_of_datatypes)
{
+ for (auto& datatype : datatypes_)
+ datatype->ref();
+}
+
+Datatype_contents::~Datatype_contents()
+{
+ for (auto& datatype : datatypes_)
+ Datatype::unref(datatype);
}
Type_Contiguous::Type_Contiguous(int size, MPI_Aint lb, MPI_Aint ub, int flags, int block_count, MPI_Datatype old_type)
{
auto* contiguous_buf_char = static_cast<char*>(contiguous_buf);
const auto* noncontiguous_buf_char = static_cast<const char*>(noncontiguous_buf) + lb();
- memcpy(contiguous_buf_char, noncontiguous_buf_char, count * block_count_ * old_type_->size());
+ memcpy(contiguous_buf_char, noncontiguous_buf_char, old_type_->size() * count * block_count_);
}
void Type_Contiguous::unserialize(const void* contiguous_buf, void* noncontiguous_buf, int count, MPI_Op op)
}
int Type_Indexed::clone(MPI_Datatype* type)
-{
+{
*type = new Type_Indexed(this->size(), this->lb(), this->ub(), this->flags(), this->block_count_, this->block_lengths_, (int*)(this->block_indices_), this->old_type_);
(*type)->copy_attrs(this);
return MPI_SUCCESS;