escript  Revision_
Distribution.h
Go to the documentation of this file.
1 
2 /*****************************************************************************
3 *
4 * Copyright (c) 2003-2016 by The University of Queensland
5 * http://www.uq.edu.au
6 *
7 * Primary Business: Queensland, Australia
8 * Licensed under the Apache License, version 2.0
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Development until 2012 by Earth Systems Science Computational Center (ESSCC)
12 * Development 2012-2013 by School of Earth Sciences
13 * Development from 2014 by Centre for Geoscience Computing (GeoComp)
14 *
15 *****************************************************************************/
16 
17 #ifndef __ESCRIPT_DISTRIBUTION_H__
18 #define __ESCRIPT_DISTRIBUTION_H__
19 
20 #include <escript/DataTypes.h>
21 
22 namespace escript {
23 
24 struct Distribution;
25 typedef boost::shared_ptr<Distribution> Distribution_ptr;
26 typedef boost::shared_ptr<const Distribution> const_Distribution_ptr;
27 
32 {
33  Distribution(JMPI mpiInfo, const DataTypes::IndexVector& firstComponent,
35  mpi_info(mpiInfo)
36  {
37  first_component.resize(mpi_info->size + 1);
38  for (int i = 0; i < mpi_info->size+1; ++i)
39  first_component[i] = m * firstComponent[i] + b;
40  }
41 
43  {
44  return first_component[mpi_info->rank];
45  }
46 
48  {
49  return first_component[mpi_info->rank+1];
50  }
51 
53  {
55  }
56 
58  {
60  }
61 
63  {
64  return first_component[0];
65  }
66 
68  {
69  return first_component[mpi_info->size];
70  }
71 
74 };
75 
76 } // namespace escript
77 
78 #endif // __ESCRIPT_DISTRIBUTION_H__
79 
DataTypes::dim_t getMyNumComponents() const
Definition: Distribution.h:57
Definition: AbstractContinuousDomain.cpp:22
boost::shared_ptr< Distribution > Distribution_ptr
Definition: Distribution.h:24
std::vector< index_t > IndexVector
Definition: DataTypes.h:62
DataTypes::IndexVector first_component
Definition: Distribution.h:72
boost::shared_ptr< JMPI_ > JMPI
Definition: EsysMPI.h:71
DataTypes::dim_t getMinGlobalComponents() const
Definition: Distribution.h:62
DataTypes::index_t getFirstComponent() const
Definition: Distribution.h:42
int index_t
type for array/matrix indices used both globally and on each rank
Definition: DataTypes.h:59
JMPI mpi_info
Definition: Distribution.h:73
DataTypes::dim_t getMaxGlobalComponents() const
Definition: Distribution.h:67
DataTypes::dim_t getGlobalNumComponents() const
Definition: Distribution.h:52
boost::shared_ptr< const Distribution > const_Distribution_ptr
Definition: Distribution.h:26
Distribution(JMPI mpiInfo, const DataTypes::IndexVector &firstComponent, DataTypes::index_t m=1, DataTypes::index_t b=0)
Definition: Distribution.h:33
DataTypes::index_t getLastComponent() const
Definition: Distribution.h:47
Definition: Distribution.h:31
index_t dim_t
Definition: DataTypes.h:64