/[escript]/branches/subworld2/escriptcore/src/NonReducedVariable.h
ViewVC logotype

Contents of /branches/subworld2/escriptcore/src/NonReducedVariable.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 5505 - (show annotations)
Wed Mar 4 23:05:47 2015 UTC (3 years, 11 months ago) by jfenwick
File MIME type: text/plain
File size: 2749 byte(s)
Changes which were sitting in my trunk dir
1 /*****************************************************************************
2 *
3 * Copyright (c) 2014-2015 by University of Queensland
4 * http://www.uq.edu.au
5 *
6 * Primary Business: Queensland, Australia
7 * Licensed under the Open Software License version 3.0
8 * http://www.opensource.org/licenses/osl-3.0.php
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 by Centre for Geoscience Computing (GeoComp)
13 *
14 *****************************************************************************/
15
16 #ifndef __ESCRIPT_NONREDUCEDVARIABLE_H__
17 #define __ESCRIPT_NONREDUCEDVARIABLE_H__
18
19 #include "esysUtils/Esys_MPI.h"
20 #include "escript/Data.h"
21 #include <boost/shared_ptr.hpp>
22 #include "AbstractReducer.h"
23 namespace 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
28 class NonReducedVariable : public AbstractReducer
29 {
30 public:
31 NonReducedVariable();
32 ~NonReducedVariable(){};
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
38 void setDomain(escript::Domain_ptr d);
39 bool valueCompatible(boost::python::object v);
40 bool reduceLocalValue(boost::python::object v, std::string& errstring);
41 void reset();
42 bool checkRemoteCompatibility(esysUtils::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(esysUtils::JMPI& mpi_info, bool active);
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(Esys_MPI_rank localid, Esys_MPI_rank source, esysUtils::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(Esys_MPI_rank localid, Esys_MPI_rank target, esysUtils::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);
64
65 // reduction with some procs submitting identity values
66 bool groupReduce(MPI_Comm& com, char mystate);
67
68 bool localOnly()
69 {
70 return true;
71 }
72
73 private:
74 double value;
75 double identity;
76 };
77
78
79 Reducer_ptr makeNonReducedVariable(std::string type);
80
81
82 }
83
84 #endif // __ESCRIPT_NONREDUCEDVARIABLE_H__
85

  ViewVC Help
Powered by ViewVC 1.1.26