/[escript]/trunk/escript/src/AbstractDomain.cpp
ViewVC logotype

Contents of /trunk/escript/src/AbstractDomain.cpp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1877 - (show annotations)
Tue Oct 14 02:58:39 2008 UTC (10 years, 11 months ago) by ksteube
File size: 6676 byte(s)
convection.py checkpointing uses mkdir/rmdir, and under MPI there
was a race condition.

mkdir needs to be run on only one CPU and then a barrier to prevent
working processors from using the directory before it exists.

Added methods domain.MPIBarrier and domain.onMasterProcessor() to
implement this technique.

A more general solution might be possible in the future.

1
2 /*******************************************************
3 *
4 * Copyright (c) 2003-2008 by University of Queensland
5 * Earth Systems Science Computational Center (ESSCC)
6 * http://www.uq.edu.au/esscc
7 *
8 * Primary Business: Queensland, Australia
9 * Licensed under the Open Software License version 3.0
10 * http://www.opensource.org/licenses/osl-3.0.php
11 *
12 *******************************************************/
13
14
15 #include "AbstractDomain.h"
16 #include "DomainException.h"
17 #include "Data.h"
18 #include "paso/Paso_MPI.h"
19
20 using namespace std;
21
22 namespace escript {
23
24
25 Domain_ptr AbstractDomain::getPtr()
26 {
27 if (_internal_weak_this.expired())
28 {
29 return Domain_ptr(this);
30 }
31 else
32 {
33 return shared_from_this();
34 }
35 }
36
37 const_Domain_ptr AbstractDomain::getPtr() const
38 {
39 if (_internal_weak_this.expired())
40 {
41 return const_Domain_ptr(this);
42 }
43 else
44 {
45 return shared_from_this();
46 }
47 }
48
49 AbstractDomain::AbstractDomain() {
50 }
51
52 AbstractDomain::~AbstractDomain() {
53 }
54
55 int AbstractDomain::getMPISize() const
56 {
57 return 1;
58 }
59 int AbstractDomain::getMPIRank() const
60 {
61 return 0;
62 }
63 void AbstractDomain::MPIBarrier() const
64 {
65 return;
66 }
67 bool AbstractDomain::onMasterProcessor() const
68 {
69 return true;
70 }
71
72
73
74 void AbstractDomain::throwStandardException(const std::string& functionName) const
75 {
76 throw DomainException("Error - Base class function: " + functionName + " should not be called. Programming error.");
77 }
78
79 bool AbstractDomain::isValidFunctionSpaceType(int functionSpaceType) const
80 {
81 throwStandardException("AbstractDomain::isValidFunctionSpaceType");
82 return false;
83 }
84
85 std::string AbstractDomain::getDescription() const
86 {
87 throwStandardException("AbstractDomain::getDescription");
88 return "";
89 }
90
91 std::string AbstractDomain::functionSpaceTypeAsString(int functionSpaceType) const
92 {
93 throwStandardException("AbstractDomain::functionSpaceTypeAsString");
94 return "";
95 }
96
97 int AbstractDomain::getDim() const
98 {
99 throwStandardException("AbstractDomain::getDim");
100 return 0;
101 }
102
103 void AbstractDomain::write(const std::string& filename) const
104 {
105 throwStandardException("AbstractDomain::write");
106 return;
107 }
108 void AbstractDomain::dump(const std::string& filename) const
109 {
110 throwStandardException("AbstractDomain::dump");
111 return;
112 }
113
114 std::pair<int,int> AbstractDomain::getDataShape(int functionSpaceCode) const
115 {
116 throwStandardException("AbstractDomain::getDataShape");
117 return std::pair<int,int>(0,0);
118 }
119
120 int AbstractDomain::getTagFromSampleNo(int functionSpaceType, int sampleNo) const
121 {
122 throwStandardException("AbstractDomain::getTagFromSampleNo");
123 return 0;
124 }
125
126 int* AbstractDomain::borrowSampleReferenceIDs(int functionSpaceType) const
127 {
128 throwStandardException("AbstractDomain::borrowSampleReferenceIDs");
129 return 0;
130 }
131
132 void AbstractDomain::setNewX(const escript::Data& arg)
133 {
134 throwStandardException("AbstractDomain::setNewX");
135 return;
136 }
137
138 void AbstractDomain::interpolateOnDomain(escript::Data& target,const escript::Data& source) const
139 {
140 throwStandardException("AbstractDomain::interpolateOnDomain");
141 return;
142 }
143 void AbstractDomain::interpolateACross(escript::Data& target, const escript::Data& source) const
144 {
145 throwStandardException("AbstractDomain::interpolateACross");
146 return;
147 }
148
149 escript::Data AbstractDomain::getX() const
150 {
151 throwStandardException("AbstractDomain::getX");
152 return Data();
153 }
154
155 escript::Data AbstractDomain::getNormal() const
156 {
157 throwStandardException("AbstractDomain::getNormal");
158 return Data();
159 }
160
161 escript::Data AbstractDomain::getSize() const
162 {
163 throwStandardException("AbstractDomain::getSize");
164 return Data();
165 }
166
167 void AbstractDomain::setToX(escript::Data& out) const
168 {
169 throwStandardException("AbstractDomain::setToX");
170 return;
171 }
172
173 void AbstractDomain::setToNormal(escript::Data& out) const
174 {
175 throwStandardException("AbstractDomain::setToNormal");
176 return;
177 }
178
179 void AbstractDomain::setToSize(escript::Data& out) const
180 {
181 throwStandardException("AbstractDomain::setToSize");
182 return;
183 }
184
185 void AbstractDomain::setToGradient(escript::Data& grad, const escript::Data& arg) const
186 {
187 throwStandardException("AbstractDomain::setToGradient");
188 return;
189 }
190
191 void AbstractDomain::setTags(const int functionSpaceType, const int newTag, const escript::Data& mask) const
192 {
193 throwStandardException("AbstractDomain::setTags");
194 return;
195 }
196
197 void AbstractDomain::saveDX(const std::string& filename,const boost::python::dict& arg) const
198 {
199 throwStandardException("AbstractDomain::saveDX");
200 return;
201 }
202
203 void AbstractDomain::saveVTK(const std::string& filename,const boost::python::dict& arg) const
204 {
205 throwStandardException("AbstractDomain::saveVTK");
206 return;
207 }
208
209 bool AbstractDomain::probeInterpolationOnDomain(int functionSpaceType_source,int functionSpaceType_target) const
210 {
211 throwStandardException("AbstractDomain::probeInterpolationOnDomain");
212 return false;
213 }
214
215 bool AbstractDomain::probeInterpolationACross(int functionSpaceType_source,const AbstractDomain& targetDomain, int functionSpaceType_target) const
216 {
217 throwStandardException("AbstractDomain::probeInterpolationACross");
218 return false;
219 }
220
221 bool AbstractDomain::isCellOriented(int functionSpaceCode) const
222 {
223 throwStandardException("AbstractDomain::isCellOriented");
224 return false;
225 }
226
227 bool AbstractDomain::operator==(const AbstractDomain& other) const
228 {
229 throwStandardException("AbstractDomain::operator==");
230 return false;
231 }
232 bool AbstractDomain::operator!=(const AbstractDomain& other) const
233 {
234 throwStandardException("AbstractDomain::operator!=");
235 return false;
236 }
237
238 AbstractDomain::StatusType AbstractDomain::getStatus() const
239 {
240 throwStandardException("AbstractDomain::getStatus");
241 return 0;
242 }
243 void AbstractDomain::setTagMap(const std::string& name, int tag)
244 {
245 throwStandardException("AbstractDomain::set TagMap is not implemented.");
246 }
247 int AbstractDomain::getTag(const std::string& name) const
248 {
249 throwStandardException("AbstractDomain::getTag is not implemented.");
250 return 0;
251 }
252
253 bool AbstractDomain::isValidTagName(const std::string& name) const
254 {
255 return false;
256 }
257
258 std::string AbstractDomain::showTagNames() const
259 {
260 throwStandardException("AbstractDomain::showTagNames is not implemented.");
261 return string();
262 }
263
264 int AbstractDomain::getNumberOfTagsInUse(int functionSpaceCode) const
265 {
266 throwStandardException("AbstractDomain::getNumberOfTagsInUse is not implemented.");
267 return 0;
268 }
269 int* AbstractDomain::borrowListOfTagsInUse(int functionSpaceCode) const
270 {
271 throwStandardException("AbstractDomain::borrowListOfTagsInUse is not implemented.");
272 return NULL;
273 }
274
275
276 bool AbstractDomain::canTag(int functionspacecode) const
277 {
278 throwStandardException("AbstractDomain::canTag is not implemented.");
279 return false;
280 }
281
282
283
284 } // end of namespace

Properties

Name Value
svn:eol-style native
svn:keywords Author Date Id Revision

  ViewVC Help
Powered by ViewVC 1.1.26