1 |
|
2 |
/******************************************************* |
3 |
* |
4 |
* Copyright (c) 2003-2009 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 |
// Please see the discusion in DataAbstract's version of this method |
25 |
// and why I squash the exception |
26 |
Domain_ptr AbstractDomain::getPtr() |
27 |
{ |
28 |
try |
29 |
{ |
30 |
return shared_from_this(); |
31 |
} |
32 |
catch (boost::bad_weak_ptr p) |
33 |
{ |
34 |
return Domain_ptr(this); |
35 |
} |
36 |
} |
37 |
|
38 |
const_Domain_ptr AbstractDomain::getPtr() const |
39 |
{ |
40 |
try |
41 |
{ |
42 |
return shared_from_this(); |
43 |
} |
44 |
catch (boost::bad_weak_ptr p) |
45 |
{ |
46 |
return const_Domain_ptr(this); |
47 |
} |
48 |
} |
49 |
|
50 |
AbstractDomain::AbstractDomain() { |
51 |
} |
52 |
|
53 |
AbstractDomain::~AbstractDomain() { |
54 |
} |
55 |
|
56 |
int AbstractDomain::getMPISize() const |
57 |
{ |
58 |
return 1; |
59 |
} |
60 |
int AbstractDomain::getMPIRank() const |
61 |
{ |
62 |
return 0; |
63 |
} |
64 |
void AbstractDomain::MPIBarrier() const |
65 |
{ |
66 |
throwStandardException("MPIBarrier"); |
67 |
return; |
68 |
} |
69 |
bool AbstractDomain::onMasterProcessor() const |
70 |
{ |
71 |
return true; |
72 |
} |
73 |
|
74 |
ESCRIPT_DLL_API |
75 |
#ifdef PASO_MPI |
76 |
MPI_Comm |
77 |
#else |
78 |
unsigned int |
79 |
#endif |
80 |
AbstractDomain::getMPIComm() const |
81 |
{ |
82 |
throwStandardException("AbstractDomain::getMPIComm"); |
83 |
return false; |
84 |
} |
85 |
|
86 |
|
87 |
void AbstractDomain::throwStandardException(const std::string& functionName) const |
88 |
{ |
89 |
throw DomainException("Error - Base class function: " + functionName + " should not be called. Programming error."); |
90 |
} |
91 |
|
92 |
bool AbstractDomain::isValidFunctionSpaceType(int functionSpaceType) const |
93 |
{ |
94 |
throwStandardException("AbstractDomain::isValidFunctionSpaceType"); |
95 |
return false; |
96 |
} |
97 |
|
98 |
std::string AbstractDomain::getDescription() const |
99 |
{ |
100 |
throwStandardException("AbstractDomain::getDescription"); |
101 |
return ""; |
102 |
} |
103 |
|
104 |
std::string AbstractDomain::functionSpaceTypeAsString(int functionSpaceType) const |
105 |
{ |
106 |
throwStandardException("AbstractDomain::functionSpaceTypeAsString"); |
107 |
return ""; |
108 |
} |
109 |
|
110 |
int AbstractDomain::getDim() const |
111 |
{ |
112 |
throwStandardException("AbstractDomain::getDim"); |
113 |
return 0; |
114 |
} |
115 |
|
116 |
void AbstractDomain::write(const std::string& filename) const |
117 |
{ |
118 |
throwStandardException("AbstractDomain::write"); |
119 |
return; |
120 |
} |
121 |
void AbstractDomain::dump(const std::string& filename) const |
122 |
{ |
123 |
throwStandardException("AbstractDomain::dump"); |
124 |
return; |
125 |
} |
126 |
|
127 |
std::pair<int,int> AbstractDomain::getDataShape(int functionSpaceCode) const |
128 |
{ |
129 |
throwStandardException("AbstractDomain::getDataShape"); |
130 |
return std::pair<int,int>(0,0); |
131 |
} |
132 |
|
133 |
int AbstractDomain::getTagFromSampleNo(int functionSpaceType, int sampleNo) const |
134 |
{ |
135 |
throwStandardException("AbstractDomain::getTagFromSampleNo"); |
136 |
return 0; |
137 |
} |
138 |
|
139 |
const int* AbstractDomain::borrowSampleReferenceIDs(int functionSpaceType) const |
140 |
{ |
141 |
throwStandardException("AbstractDomain::borrowSampleReferenceIDs"); |
142 |
return 0; |
143 |
} |
144 |
|
145 |
void AbstractDomain::setNewX(const escript::Data& arg) |
146 |
{ |
147 |
throwStandardException("AbstractDomain::setNewX"); |
148 |
return; |
149 |
} |
150 |
|
151 |
void AbstractDomain::interpolateOnDomain(escript::Data& target,const escript::Data& source) const |
152 |
{ |
153 |
throwStandardException("AbstractDomain::interpolateOnDomain"); |
154 |
return; |
155 |
} |
156 |
void AbstractDomain::interpolateACross(escript::Data& target, const escript::Data& source) const |
157 |
{ |
158 |
throwStandardException("AbstractDomain::interpolateACross"); |
159 |
return; |
160 |
} |
161 |
|
162 |
escript::Data AbstractDomain::getX() const |
163 |
{ |
164 |
throwStandardException("AbstractDomain::getX"); |
165 |
return Data(); |
166 |
} |
167 |
|
168 |
escript::Data AbstractDomain::getNormal() const |
169 |
{ |
170 |
throwStandardException("AbstractDomain::getNormal"); |
171 |
return Data(); |
172 |
} |
173 |
|
174 |
escript::Data AbstractDomain::getSize() const |
175 |
{ |
176 |
throwStandardException("AbstractDomain::getSize"); |
177 |
return Data(); |
178 |
} |
179 |
|
180 |
void AbstractDomain::setToX(escript::Data& out) const |
181 |
{ |
182 |
throwStandardException("AbstractDomain::setToX"); |
183 |
return; |
184 |
} |
185 |
|
186 |
void AbstractDomain::setToNormal(escript::Data& out) const |
187 |
{ |
188 |
throwStandardException("AbstractDomain::setToNormal"); |
189 |
return; |
190 |
} |
191 |
|
192 |
void AbstractDomain::setToSize(escript::Data& out) const |
193 |
{ |
194 |
throwStandardException("AbstractDomain::setToSize"); |
195 |
return; |
196 |
} |
197 |
|
198 |
void AbstractDomain::setToGradient(escript::Data& grad, const escript::Data& arg) const |
199 |
{ |
200 |
throwStandardException("AbstractDomain::setToGradient"); |
201 |
return; |
202 |
} |
203 |
|
204 |
void AbstractDomain::setTags(const int functionSpaceType, const int newTag, const escript::Data& mask) const |
205 |
{ |
206 |
throwStandardException("AbstractDomain::setTags"); |
207 |
return; |
208 |
} |
209 |
|
210 |
void AbstractDomain::saveDX(const std::string& filename,const boost::python::dict& arg) const |
211 |
{ |
212 |
throwStandardException("AbstractDomain::saveDX"); |
213 |
return; |
214 |
} |
215 |
|
216 |
void AbstractDomain::saveVTK(const std::string& filename,const boost::python::dict& arg, const std::string& metadata, const std::string& metadata_schema) const |
217 |
{ |
218 |
throwStandardException("AbstractDomain::saveVTK"); |
219 |
return; |
220 |
} |
221 |
|
222 |
bool AbstractDomain::probeInterpolationOnDomain(int functionSpaceType_source,int functionSpaceType_target) const |
223 |
{ |
224 |
throwStandardException("AbstractDomain::probeInterpolationOnDomain"); |
225 |
return false; |
226 |
} |
227 |
|
228 |
bool AbstractDomain::commonFunctionSpace(const std::vector<int>& fs, int& resultcode) const |
229 |
{ |
230 |
throwStandardException("AbstractDomain::commonFunctionSpace"); |
231 |
return false; |
232 |
} |
233 |
|
234 |
|
235 |
bool AbstractDomain::probeInterpolationACross(int functionSpaceType_source,const AbstractDomain& targetDomain, int functionSpaceType_target) const |
236 |
{ |
237 |
throwStandardException("AbstractDomain::probeInterpolationACross"); |
238 |
return false; |
239 |
} |
240 |
|
241 |
bool AbstractDomain::isCellOriented(int functionSpaceCode) const |
242 |
{ |
243 |
throwStandardException("AbstractDomain::isCellOriented"); |
244 |
return false; |
245 |
} |
246 |
|
247 |
bool AbstractDomain::operator==(const AbstractDomain& other) const |
248 |
{ |
249 |
throwStandardException("AbstractDomain::operator=="); |
250 |
return false; |
251 |
} |
252 |
bool AbstractDomain::operator!=(const AbstractDomain& other) const |
253 |
{ |
254 |
throwStandardException("AbstractDomain::operator!="); |
255 |
return false; |
256 |
} |
257 |
|
258 |
AbstractDomain::StatusType AbstractDomain::getStatus() const |
259 |
{ |
260 |
return 0; |
261 |
} |
262 |
void AbstractDomain::setTagMap(const std::string& name, int tag) |
263 |
{ |
264 |
throwStandardException("AbstractDomain::set TagMap is not implemented."); |
265 |
} |
266 |
int AbstractDomain::getTag(const std::string& name) const |
267 |
{ |
268 |
throwStandardException("AbstractDomain::getTag is not implemented."); |
269 |
return 0; |
270 |
} |
271 |
|
272 |
bool AbstractDomain::isValidTagName(const std::string& name) const |
273 |
{ |
274 |
return false; |
275 |
} |
276 |
|
277 |
std::string AbstractDomain::showTagNames() const |
278 |
{ |
279 |
throwStandardException("AbstractDomain::showTagNames is not implemented."); |
280 |
return string(); |
281 |
} |
282 |
|
283 |
int AbstractDomain::getNumberOfTagsInUse(int functionSpaceCode) const |
284 |
{ |
285 |
throwStandardException("AbstractDomain::getNumberOfTagsInUse is not implemented."); |
286 |
return 0; |
287 |
} |
288 |
|
289 |
const int* AbstractDomain::borrowListOfTagsInUse(int functionSpaceCode) const |
290 |
{ |
291 |
throwStandardException("AbstractDomain::borrowListOfTagsInUse is not implemented."); |
292 |
return NULL; |
293 |
} |
294 |
|
295 |
|
296 |
bool AbstractDomain::canTag(int functionspacecode) const |
297 |
{ |
298 |
throwStandardException("AbstractDomain::canTag is not implemented."); |
299 |
return false; |
300 |
} |
301 |
|
302 |
|
303 |
} // end of namespace |