escript Revision_
NonReducedVariable.h
Go to the documentation of this file.
1/*****************************************************************************
2*
3* Copyright (c) 2014-2018 by The University of Queensland
4* http://www.uq.edu.au
5*
6* Primary Business: Queensland, Australia
7* Licensed under the Apache License, version 2.0
8* http://www.apache.org/licenses/LICENSE-2.0
9*
10* Development until 2012 by Earth Systems Science Computational Center (ESSCC)
11* Development 2012-2013 by School of Earth Sciences
12* Development from 2014-2017 by Centre for Geoscience Computing (GeoComp)
13* Development from 2019 by School of Earth and Environmental Sciences
14**
15*****************************************************************************/
16
17#ifndef __ESCRIPT_NONREDUCEDVARIABLE_H__
18#define __ESCRIPT_NONREDUCEDVARIABLE_H__
19
20#include "AbstractReducer.h"
21#include "Data.h"
22
23namespace escript
24{
25
26// plugs into the import/export mechanism but stays on the
27// subworld it was created by (no actual reduction takes place)
29{
30public:
33
34 // This is not a constructor parameter because
35 // if these are created outside the subworld, they won't have
36 // access to a domain yet.
37 // I also want SplitWorld to be able to set this
39 bool valueCompatible(boost::python::object v);
40 bool reduceLocalValue(boost::python::object v, std::string& errstring);
41 void reset();
42 bool checkRemoteCompatibility(JMPI& mpi_info, std::string& errstring);
43
44 void getCompatibilityInfo(std::vector<unsigned>& params);
45
46 // talk to corresponding processes in other subworlds
47 bool reduceRemoteValues(MPI_Comm& mpi_info);
48
49 // human readable description
50 std::string description();
51
52 // Get a value for this variable from another process
53 // This is not a reduction and will replace any existing value
54 bool recvFrom(int localid, int source, JMPI& mpiinfo);
55
56 // Send a value to this variable to another process
57 // This is not a reduction and will replace any existing value
58 bool sendTo(int localid, int target, JMPI& mpiinfo);
59 double getDouble();
60 virtual boost::python::object getPyObj();
61
62 // send from proc 0 in the communicator to all others
63 bool groupSend(MPI_Comm& com, bool imsending);
64
65 // reduction with some procs submitting identity values
66 bool groupReduce(MPI_Comm& com, char mystate);
67
68 void copyValueFrom(boost::shared_ptr<AbstractReducer>& src);
69
70private:
71 boost::python::object value;
72 boost::python::object identity;
73};
74
77
78} // namespace escript
79
80#endif // __ESCRIPT_NONREDUCEDVARIABLE_H__
81
int MPI_Comm
Definition: EsysMPI.h:44
Definition: AbstractReducer.h:44
Definition: NonReducedVariable.h:29
bool sendTo(int localid, int target, JMPI &mpiinfo)
Definition: NonReducedVariable.cpp:84
NonReducedVariable()
Definition: NonReducedVariable.cpp:22
boost::python::object value
Definition: NonReducedVariable.h:71
~NonReducedVariable()
Definition: NonReducedVariable.cpp:27
void getCompatibilityInfo(std::vector< unsigned > &params)
Definition: NonReducedVariable.cpp:64
bool groupSend(MPI_Comm &com, bool imsending)
Definition: NonReducedVariable.cpp:99
double getDouble()
Definition: NonReducedVariable.cpp:89
boost::python::object identity
Definition: NonReducedVariable.h:72
bool recvFrom(int localid, int source, JMPI &mpiinfo)
Definition: NonReducedVariable.cpp:79
bool groupReduce(MPI_Comm &com, char mystate)
Definition: NonReducedVariable.cpp:104
bool valueCompatible(boost::python::object v)
Definition: NonReducedVariable.cpp:38
virtual boost::python::object getPyObj()
Definition: NonReducedVariable.cpp:94
bool checkRemoteCompatibility(JMPI &mpi_info, std::string &errstring)
Definition: NonReducedVariable.cpp:59
void copyValueFrom(boost::shared_ptr< AbstractReducer > &src)
Definition: NonReducedVariable.cpp:109
std::string description()
Definition: NonReducedVariable.cpp:74
void reset()
Definition: NonReducedVariable.cpp:51
bool reduceLocalValue(boost::python::object v, std::string &errstring)
Definition: NonReducedVariable.cpp:44
bool reduceRemoteValues(MPI_Comm &mpi_info)
Definition: NonReducedVariable.cpp:69
void setDomain(escript::Domain_ptr d)
Definition: NonReducedVariable.cpp:31
#define ESCRIPT_DLL_API
Definition: escriptcore/src/system_dep.h:30
Definition: AbstractContinuousDomain.cpp:23
boost::shared_ptr< AbstractReducer > Reducer_ptr
Definition: AbstractReducer.h:119
Reducer_ptr makeNonReducedVariable()
Definition: NonReducedVariable.cpp:123
boost::shared_ptr< AbstractDomain > Domain_ptr
Definition: AbstractDomain.h:43
boost::shared_ptr< JMPI_ > JMPI
Definition: EsysMPI.h:76