escript Revision_
Distribution.h
Go to the documentation of this file.
1
2/*****************************************************************************
3*
4* Copyright (c) 2003-2020 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-2017 by Centre for Geoscience Computing (GeoComp)
14* Development from 2019 by School of Earth and Environmental Sciences
15**
16*****************************************************************************/
17
18#ifndef __ESCRIPT_DISTRIBUTION_H__
19#define __ESCRIPT_DISTRIBUTION_H__
20
21#include <escript/DataTypes.h>
22
23namespace escript {
24
25struct Distribution;
26typedef boost::shared_ptr<Distribution> Distribution_ptr;
27typedef boost::shared_ptr<const Distribution> const_Distribution_ptr;
28
33{
34 Distribution(JMPI mpiInfo, const DataTypes::IndexVector& firstComponent,
36 mpi_info(mpiInfo)
37 {
38 first_component.resize(mpi_info->size + 1);
39 for (int i = 0; i < mpi_info->size+1; ++i)
40 first_component[i] = m * firstComponent[i] + b;
41 }
42
44 {
45 return first_component[mpi_info->rank];
46 }
47
49 {
50 return first_component[mpi_info->rank+1];
51 }
52
54 {
56 }
57
59 {
61 }
62
64 {
65 return first_component[0];
66 }
67
69 {
70 return first_component[mpi_info->size];
71 }
72
75};
76
77} // namespace escript
78
79#endif // __ESCRIPT_DISTRIBUTION_H__
80
std::vector< index_t > IndexVector
Definition: DataTypes.h:64
index_t dim_t
Definition: DataTypes.h:66
int index_t
type for array/matrix indices used both globally and on each rank
Definition: DataTypes.h:61
Definition: AbstractContinuousDomain.cpp:23
boost::shared_ptr< Distribution > Distribution_ptr
Definition: Distribution.h:26
boost::shared_ptr< JMPI_ > JMPI
Definition: EsysMPI.h:76
boost::shared_ptr< const Distribution > const_Distribution_ptr
Definition: Distribution.h:27
Definition: Distribution.h:33
DataTypes::dim_t getMaxGlobalComponents() const
Definition: Distribution.h:68
DataTypes::index_t getFirstComponent() const
Definition: Distribution.h:43
DataTypes::dim_t getMyNumComponents() const
Definition: Distribution.h:58
Distribution(JMPI mpiInfo, const DataTypes::IndexVector &firstComponent, DataTypes::index_t m=1, DataTypes::index_t b=0)
Definition: Distribution.h:34
DataTypes::IndexVector first_component
Definition: Distribution.h:73
DataTypes::dim_t getMinGlobalComponents() const
Definition: Distribution.h:63
DataTypes::index_t getLastComponent() const
Definition: Distribution.h:48
DataTypes::dim_t getGlobalNumComponents() const
Definition: Distribution.h:53
JMPI mpi_info
Definition: Distribution.h:74