source: XIOS/trunk/src/distribution.cpp @ 593

Last change on this file since 593 was 553, checked in by mhnguyen, 9 years ago

Seperating global index computation on client and server side

+) Create a class which do mapping in general manner, between client and server index global
+) Remove some redundant functions and variables
+) Add some comments to code

Test
+) On Curie. Only test_new_features.f90
+) Test passes and results are correct.
+) Need to change index from 1 to 0

File size: 775 bytes
Line 
1/*!
2   \file distribution.hpp
3   \author Ha NGUYEN
4   \since 13 Jan 2015
5   \date 09 Feb 2015
6
7   \brief Index distribution on server side.
8 */
9#include "distribution.hpp"
10
11namespace xios {
12
13CDistribution::CDistribution(int rank, int dims, CArray<size_t,1>* globalIndex)
14  : rank_(rank), dims_(dims), globalIndex_(globalIndex)
15{
16  if (0 != globalIndex)
17  {
18    globalIndex_ = new CArray<size_t,1>(globalIndex->numElements());
19    *globalIndex_ = *globalIndex;
20  }
21}
22
23CDistribution::~CDistribution()
24{
25  if (0 != globalIndex_) delete globalIndex_;
26}
27
28const CArray<size_t,1>& CDistribution::getGlobalIndex() const
29{
30  return (*globalIndex_);
31}
32
33int CDistribution::getDims() const
34{
35  return dims_;
36}
37
38int CDistribution::getRank() const
39{
40  return rank_;
41}
42
43} // namespace xios
Note: See TracBrowser for help on using the repository browser.