/[escript]/trunk/escriptcore/src/NonReducedVariable.cpp
ViewVC logotype

Annotation of /trunk/escriptcore/src/NonReducedVariable.cpp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 5654 - (hide annotations)
Mon Jun 15 05:21:00 2015 UTC (4 years, 1 month ago) by jfenwick
File size: 2953 byte(s)
further
1 jfenwick 5493 /*****************************************************************************
2     *
3 jfenwick 5593 * Copyright (c) 2015 by The University of Queensland
4 jfenwick 5493 * 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 jfenwick 5565 #define ESNEEDPYTHON
17     #include "esysUtils/first.h"
18 jfenwick 5493
19 jfenwick 5565
20 jfenwick 5493 #include "NonReducedVariable.h"
21 jfenwick 5562 #include "SplitWorldException.h"
22 jfenwick 5493
23 jfenwick 5562 using namespace escript;
24    
25 jfenwick 5493 NonReducedVariable::NonReducedVariable()
26     {
27     valueadded=false;
28     }
29    
30     NonReducedVariable::~NonReducedVariable()
31     {
32 jfenwick 5562 }
33 jfenwick 5493
34     void NonReducedVariable::setDomain(escript::Domain_ptr d)
35     {
36    
37     }
38    
39    
40     // SInce there is no remote transfer, we don't need to check this
41     bool NonReducedVariable::valueCompatible(boost::python::object v)
42     {
43     return true;
44     }
45    
46     // Any new export, replaces the old value
47     bool NonReducedVariable::reduceLocalValue(boost::python::object v, std::string& errstring)
48     {
49     value=v;
50     valueadded=true;
51     return true;
52     }
53    
54     void NonReducedVariable::reset()
55     {
56     value=boost::python::object();
57     valueadded=false;
58     }
59    
60     // Since we aren't actually don't a check here, this call won't function
61     // as a barrier like other implementations of this method
62     bool NonReducedVariable::checkRemoteCompatibility(esysUtils::JMPI& mpi_info, std::string& errstring)
63     {
64     return true;
65     }
66    
67     void NonReducedVariable::getCompatibilityInfo(std::vector<unsigned>& params)
68     {
69     // empty
70     }
71    
72     bool NonReducedVariable::reduceRemoteValues(esysUtils::JMPI& mpi_info, bool active)
73     {
74     return true;
75     }
76    
77     std::string NonReducedVariable::description()
78     {
79     return "Non-Reduced Variable.";
80     }
81    
82     bool NonReducedVariable::recvFrom(Esys_MPI_rank localid, Esys_MPI_rank source, esysUtils::JMPI& mpiinfo)
83     {
84     return true;
85     }
86    
87 jfenwick 5562 bool NonReducedVariable::sendTo(Esys_MPI_rank localid, Esys_MPI_rank source, esysUtils::JMPI& mpiinfo)
88 jfenwick 5493 {
89     return true;
90     }
91    
92     double NonReducedVariable::getDouble()
93     {
94     throw SplitWorldException("No double value from this type.");
95     }
96    
97     boost::python::object NonReducedVariable::getPyObj()
98     {
99     return value;
100     }
101    
102     bool NonReducedVariable::groupSend(MPI_Comm& com)
103     {
104     return true;
105     }
106    
107     bool NonReducedVariable::groupReduce(MPI_Comm& com, char mystate)
108     {
109     return true;
110     }
111    
112 jfenwick 5654 void NonReducedVariable::copyValueFrom(boost::shared_ptr<AbstractReducer>& src)
113     {
114     NonReducedVariable* sr=dynamic_cast<NonReducedVariable*>(src.get());
115     if (sr==0)
116     {
117     throw SplitWorldException("Source and destination need to be the same reducer types.");
118     }
119     value=sr->value;
120     valueadded=true;
121     }
122    
123    
124 jfenwick 5493 namespace escript
125     {
126 jfenwick 5562 Reducer_ptr makeNonReducedVariable()
127 jfenwick 5493 {
128     NonReducedVariable* m=new NonReducedVariable();
129     return Reducer_ptr(m);
130    
131     }
132    
133     }

  ViewVC Help
Powered by ViewVC 1.1.26