/* smpi_datatype.cpp -- MPI primitives to handle datatypes */
-/* Copyright (c) 2009-2019. The SimGrid Team. All rights reserved. */
+/* Copyright (c) 2009-2020. The SimGrid Team. All rights reserved. */
/* This program is free software; you can redistribute it and/or modify it
* under the terms of the license (GNU LGPL) which comes with this package. */
Type_Hindexed::Type_Hindexed(int size, MPI_Aint lb, MPI_Aint ub, int flags, int count, const int* block_lengths,
const MPI_Aint* block_indices, MPI_Datatype old_type)
- : Datatype(size, lb, ub, flags), block_count_(count), old_type_(old_type)
+ : Datatype(size, lb, ub, flags)
+ , block_count_(count)
+ , block_lengths_(new int[count])
+ , block_indices_(new MPI_Aint[count])
+ , old_type_(old_type)
{
old_type_->ref();
- block_lengths_ = new int[count];
- block_indices_ = new MPI_Aint[count];
for (int i = 0; i < count; i++) {
block_lengths_[i] = block_lengths[i];
block_indices_[i] = block_indices[i];
Type_Hindexed::Type_Hindexed(int size, MPI_Aint lb, MPI_Aint ub, int flags, int count, const int* block_lengths,
const int* block_indices, MPI_Datatype old_type, MPI_Aint factor)
- : Datatype(size, lb, ub, flags), block_count_(count), old_type_(old_type)
+ : Datatype(size, lb, ub, flags)
+ , block_count_(count)
+ , block_lengths_(new int[count])
+ , block_indices_(new MPI_Aint[count])
+ , old_type_(old_type)
{
old_type_->ref();
- block_lengths_ = new int[count];
- block_indices_ = new MPI_Aint[count];
for (int i = 0; i < count; i++) {
block_lengths_[i] = block_lengths[i];
block_indices_[i] = block_indices[i] * factor;
{
}
-Type_Struct::Type_Struct(int size,MPI_Aint lb, MPI_Aint ub, int flags, int count, const int* block_lengths, const MPI_Aint* block_indices, const MPI_Datatype* old_types): Datatype(size, lb, ub, flags), block_count_(count){
- block_lengths_= new int[count];
- block_indices_= new MPI_Aint[count];
- old_types_= new MPI_Datatype[count];
+Type_Struct::Type_Struct(int size, MPI_Aint lb, MPI_Aint ub, int flags, int count, const int* block_lengths,
+ const MPI_Aint* block_indices, const MPI_Datatype* old_types)
+ : Datatype(size, lb, ub, flags)
+ , block_count_(count)
+ , block_lengths_(new int[count])
+ , block_indices_(new MPI_Aint[count])
+ , old_types_(new MPI_Datatype[count])
+{
for (int i = 0; i < count; i++) {
block_lengths_[i]=block_lengths[i];
block_indices_[i]=block_indices[i];