| 1 |
/* |
| 2 |
* This file is part of MUSIC. |
| 3 |
* Copyright (C) 2007, 2008, 2009, 2022 INCF |
| 4 |
* |
| 5 |
* MUSIC is free software; you can redistribute it and/or modify |
| 6 |
* it under the terms of the GNU General Public License as published by |
| 7 |
* the Free Software Foundation; either version 3 of the License, or |
| 8 |
* (at your option) any later version. |
| 9 |
* |
| 10 |
* MUSIC is distributed in the hope that it will be useful, |
| 11 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 |
* GNU General Public License for more details. |
| 14 |
* |
| 15 |
* You should have received a copy of the GNU General Public License |
| 16 |
* along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 17 |
*/ |
| 18 |
|
| 19 |
// This header file needs to be included first since array_data.hh |
| 20 |
// includes <mpi.h> which musy be included first on BG/L |
| 21 |
#include "music/array_data.hh" |
| 22 |
#if MUSIC_USE_MPI |
| 23 |
|
| 24 |
#include "music/linear_index.hh" |
| 25 |
|
| 26 |
namespace MUSIC { |
| 27 |
|
| 28 |
ArrayData::ArrayData (void* buffer, MPI_Datatype type, IndexMap* map) |
| 29 |
: DataMap (buffer), type_ (type), indexMap_ (map->copy ()) |
| 30 |
{ |
| 31 |
} |
| 32 |
|
| 33 |
ArrayData::~ArrayData () |
| 34 |
{ |
| 35 |
delete indexMap_; |
| 36 |
} |
| 37 |
|
| 38 |
ArrayData::ArrayData (void* buffer, |
| 39 |
MPI_Datatype type, |
| 40 |
int baseIndex, |
| 41 |
int size) |
| 42 |
: DataMap (buffer) |
| 43 |
{ |
| 44 |
type_ = type; |
| 45 |
indexMap_ = new LinearIndex (baseIndex, size); |
| 46 |
} |
| 47 |
|
| 48 |
DataMap* |
| 49 |
ArrayData::copy () |
| 50 |
{ |
| 51 |
return new ArrayData (base (), type_, indexMap_); |
| 52 |
} |
| 53 |
|
| 54 |
} |
| 55 |
#endif |