NonReducedVariable.h
Go to the documentation of this file.
/*****************************************************************************
*
* Copyright (c) 2014-2017 by The University of Queensland
* http://www.uq.edu.au
*
* Primary Business: Queensland, Australia
* Licensed under the Apache License, version 2.0
* http://www.apache.org/licenses/LICENSE-2.0
*
* Development until 2012 by Earth Systems Science Computational Center (ESSCC)
* Development 2012-2013 by School of Earth Sciences
* Development from 2014 by Centre for Geoscience Computing (GeoComp)
*
*****************************************************************************/
#ifndef __ESCRIPT_NONREDUCEDVARIABLE_H__
#define __ESCRIPT_NONREDUCEDVARIABLE_H__
#include "AbstractReducer.h"
#include "Data.h"
namespace escript
{
// plugs into the import/export mechanism but stays on the
// subworld it was created by (no actual reduction takes place)
class NonReducedVariable : public AbstractReducer
{
public:
NonReducedVariable();
~NonReducedVariable();
// This is not a constructor parameter because
// if these are created outside the subworld, they won't have
// access to a domain yet.
// I also want SplitWorld to be able to set this
void setDomain(escript::Domain_ptr d);
bool valueCompatible(boost::python::object v);
bool reduceLocalValue(boost::python::object v, std::string& errstring);
void reset();
bool checkRemoteCompatibility(JMPI& mpi_info, std::string& errstring);
void getCompatibilityInfo(std::vector<unsigned>& params);
// talk to corresponding processes in other subworlds
bool reduceRemoteValues(MPI_Comm& mpi_info);
// human readable description
std::string description();
// Get a value for this variable from another process
// This is not a reduction and will replace any existing value
bool recvFrom(int localid, int source, JMPI& mpiinfo);
// Send a value to this variable to another process
// This is not a reduction and will replace any existing value
bool sendTo(int localid, int target, JMPI& mpiinfo);
double getDouble();
virtual boost::python::object getPyObj();
// send from proc 0 in the communicator to all others
bool groupSend(MPI_Comm& com, bool imsending);
// reduction with some procs submitting identity values
bool groupReduce(MPI_Comm& com, char mystate);
void copyValueFrom(boost::shared_ptr<AbstractReducer>& src);
private:
boost::python::object value;
boost::python::object identity;
};
Reducer_ptr makeNonReducedVariable();
} // namespace escript
#endif // __ESCRIPT_NONREDUCEDVARIABLE_H__
escript::NonReducedVariable::~NonReducedVariable
~NonReducedVariable()
Definition: NonReducedVariable.cpp:26
escript::Domain_ptr
boost::shared_ptr< AbstractDomain > Domain_ptr
Definition: AbstractDomain.h:36
escript::NonReducedVariable::identity
boost::python::object identity
Definition: NonReducedVariable.h:71
escript::NonReducedVariable
Definition: NonReducedVariable.h:27
escript
Definition: AbstractContinuousDomain.cpp:22
escript::NonReducedVariable::copyValueFrom
void copyValueFrom(boost::shared_ptr< AbstractReducer > &src)
Definition: NonReducedVariable.cpp:108
escript::AbstractReducer
Definition: AbstractReducer.h:41
escript::NonReducedVariable::getPyObj
virtual boost::python::object getPyObj()
Definition: NonReducedVariable.cpp:93
escript::JMPI
boost::shared_ptr< JMPI_ > JMPI
Definition: EsysMPI.h:71
Data.h
escript::NonReducedVariable::reduceLocalValue
bool reduceLocalValue(boost::python::object v, std::string &errstring)
Definition: NonReducedVariable.cpp:43
escript::Reducer_ptr
boost::shared_ptr< AbstractReducer > Reducer_ptr
Definition: AbstractReducer.h:117
escript::NonReducedVariable::groupSend
bool groupSend(MPI_Comm &com, bool imsending)
Definition: NonReducedVariable.cpp:98
escript::makeNonReducedVariable
Reducer_ptr makeNonReducedVariable()
Definition: NonReducedVariable.cpp:122
escript::NonReducedVariable::value
boost::python::object value
Definition: NonReducedVariable.h:70
escript::NonReducedVariable::valueCompatible
bool valueCompatible(boost::python::object v)
Definition: NonReducedVariable.cpp:37
escript::NonReducedVariable::getCompatibilityInfo
void getCompatibilityInfo(std::vector< unsigned > &params)
Definition: NonReducedVariable.cpp:63
escript::NonReducedVariable::recvFrom
bool recvFrom(int localid, int source, JMPI &mpiinfo)
Definition: NonReducedVariable.cpp:78
escript::NonReducedVariable::getDouble
double getDouble()
Definition: NonReducedVariable.cpp:88
escript::NonReducedVariable::groupReduce
bool groupReduce(MPI_Comm &com, char mystate)
Definition: NonReducedVariable.cpp:103
MPI_Comm
int MPI_Comm
Definition: EsysMPI.h:41
escript::NonReducedVariable::reduceRemoteValues
bool reduceRemoteValues(MPI_Comm &mpi_info)
Definition: NonReducedVariable.cpp:68
escript::NonReducedVariable::description
std::string description()
Definition: NonReducedVariable.cpp:73
escript::NonReducedVariable::reset
void reset()
Definition: NonReducedVariable.cpp:50
escript::NonReducedVariable::sendTo
bool sendTo(int localid, int target, JMPI &mpiinfo)
Definition: NonReducedVariable.cpp:83
escript::NonReducedVariable::checkRemoteCompatibility
bool checkRemoteCompatibility(JMPI &mpi_info, std::string &errstring)
Definition: NonReducedVariable.cpp:58
AbstractReducer.h
escript::NonReducedVariable::setDomain
void setDomain(escript::Domain_ptr d)
Definition: NonReducedVariable.cpp:30
escript::NonReducedVariable::NonReducedVariable
NonReducedVariable()
Definition: NonReducedVariable.cpp:21