/[escript]/branches/split/escriptcore/src/NullDomain.h
ViewVC logotype

Contents of /branches/split/escriptcore/src/NullDomain.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 4773 - (show annotations)
Wed Mar 19 06:19:42 2014 UTC (3 years, 9 months ago) by jfenwick
File MIME type: text/plain
File size: 6432 byte(s)
Fixing Data to use the domain's communicator.
Like it should!


1
2 /*****************************************************************************
3 *
4 * Copyright (c) 2003-2014 by University of Queensland
5 * http://www.uq.edu.au
6 *
7 * Primary Business: Queensland, Australia
8 * Licensed under the Open Software License version 3.0
9 * http://www.opensource.org/licenses/osl-3.0.php
10 *
11 * Development until 2012 by Earth Systems Science Computational Center (ESSCC)
12 * Development 2012-2013 by School of Earth Sciences
13 * Development from 2014 by Centre for Geoscience Computing (GeoComp)
14 *
15 *****************************************************************************/
16
17
18 #if !defined escript_NullDomain_20040604_H
19 #define escript_NullDomain_20040604_H
20 #include "system_dep.h"
21
22 #include "AbstractDomain.h"
23
24 #include <string>
25
26 namespace escript {
27
28 /**
29 \brief
30 NullDomain provides a null value for domain. Needed for the construction
31 of a default FunctionSpace.
32
33 Description:
34 NullDomain provides a null value for domain. Needed for the construction
35 of a default FunctionSpace. Inherits from AbstractDomain and overrides its
36 methods.
37 This domain supports a single type of FunctionSpace for which canTag is true.
38 This compromise is needed to allow the default contructor of DataTagged to
39 have a FunctionSpace which supports tagging.
40 See notes on the borrowListOfTagsInUse() method.
41 */
42
43 class NullDomain : public AbstractDomain {
44
45 public:
46
47 /**
48 \brief
49 Default constructor for NullDomain.
50
51 Description:
52 Default constructor for NullDomain.
53
54 */
55 ESCRIPT_DLL_API
56 NullDomain();
57
58 /**
59 \brief get the communicator for this domain.
60 Returns 0 on non-MPI builds
61 Routine must be implemented by the DomainAdapter
62 */
63 ESCRIPT_DLL_API
64 virtual
65 #ifdef ESYS_MPI
66 MPI_Comm
67 #else
68 unsigned int
69 #endif
70 getMPIComm() const
71 {
72 #ifdef ESYS_MPI
73 return MPI_COMM_WORLD;
74 #else
75 return -1;
76 #endif
77 }
78
79 /**
80 \brief
81 Returns true if the given integer is a valid function space type
82 for this domain.
83 */
84 ESCRIPT_DLL_API
85 virtual bool isValidFunctionSpaceType(int functionSpaceType) const;
86
87 /**
88 \brief
89 Return a description for this domain.
90 */
91 ESCRIPT_DLL_API
92 virtual std::string getDescription() const;
93
94 /**
95 \brief
96 Return a description for the given function space type code.
97 */
98 ESCRIPT_DLL_API
99 virtual std::string functionSpaceTypeAsString(int functionSpaceType) const;
100
101 /**
102 \brief
103 Interpolates data given on source onto target where source and target have to be given on the same domain.
104 NullDomain only has one FunctionSpace so this makes target a shallow copy of source.
105 */
106 ESCRIPT_DLL_API
107 virtual void interpolateOnDomain(escript::Data& target,const escript::Data& source) const;
108 ESCRIPT_DLL_API
109 virtual bool probeInterpolationOnDomain(int functionSpaceType_source,int functionSpaceType_target) const;
110
111 /**
112 \brief
113 Interpolates data given on source onto target where source and target are given on different domains.
114 We do not permit interpolation into the NullDomain so this method always throws.
115 */
116 ESCRIPT_DLL_API
117 virtual void interpolateACross(escript::Data& target, const escript::Data& source) const;
118 ESCRIPT_DLL_API
119 virtual bool probeInterpolationACross(int functionSpaceType_source,const AbstractDomain& targetDomain, int functionSpaceType_target) const;
120
121 /**
122 \brief
123 Return a continuous FunctionSpace.
124 */
125 ESCRIPT_DLL_API
126 virtual int getContinuousFunctionCode() const;
127
128 /**
129 \brief
130 Return a function FunctionSpace.
131 */
132 ESCRIPT_DLL_API
133 virtual int getFunctionCode() const;
134
135 /**
136 \brief
137 Return a function on boundary FunctionSpace.
138 */
139 ESCRIPT_DLL_API
140 virtual int getFunctionOnBoundaryCode() const;
141
142 /**
143 \brief
144 Return a FunctionSpace.
145 */
146 ESCRIPT_DLL_API
147 virtual int getFunctionOnContactZeroCode() const;
148
149 /**
150 \brief
151 Return a FunctionSpace.
152 */
153 ESCRIPT_DLL_API
154 virtual int getFunctionOnContactOneCode() const;
155
156 /**
157 \brief
158 Return a FunctionSpace.
159 */
160 ESCRIPT_DLL_API
161 virtual int getSolutionCode() const;
162
163 /**
164 \brief
165 Return a FunctionSpace.
166 */
167 ESCRIPT_DLL_API
168 virtual int getReducedSolutionCode() const;
169
170 /**
171 \brief
172 Return a FunctionSpace.
173 */
174 ESCRIPT_DLL_API
175 virtual int getDiracDeltaFunctionsCode() const;
176
177 /**
178 \brief
179 Return the number of data points per sample, and the number of samples as a pair.
180 \param functionSpaceCode Input - Code for the function space type.
181 \return pair, first - number of data points per sample, second - number of samples
182 */
183 ESCRIPT_DLL_API
184 virtual std::pair<int,int> getDataShape(int functionSpaceCode) const;
185
186 /**
187 \brief
188 Return the tag key for the given sample number.
189 \param functionSpaceType Input - The function space type.
190 \param sampleNo Input - The sample number.
191 */
192 ESCRIPT_DLL_API
193 virtual int getTagFromSampleNo(int functionSpaceType, int sampleNo) const;
194
195 /**
196 \brief
197 Return a borrowed pointer to the sample reference number id list
198 \param functionSpaceType Input - The function space type.
199 */
200 ESCRIPT_DLL_API
201 virtual const int* borrowSampleReferenceIDs(int functionSpaceType) const;
202
203 /**
204 \brief
205 */
206 ESCRIPT_DLL_API
207 virtual int getDim() const;
208
209 /**
210 \brief
211 Return true if given domains are equal.
212 */
213 ESCRIPT_DLL_API
214 virtual bool operator==(const AbstractDomain& other) const;
215 ESCRIPT_DLL_API
216 virtual bool operator!=(const AbstractDomain& other) const;
217
218 /**
219 \brief Checks if this domain allows tags for the specified functionSpaceCode.
220 */
221 ESCRIPT_DLL_API
222 virtual
223 bool canTag(int functionSpaceCode) const;
224
225 /**
226 \brief
227 return the number of tags in use.
228 For this class the answer is always 1(the default tag).
229 */
230 ESCRIPT_DLL_API
231 virtual int getNumberOfTagsInUse(int functionSpaceCode) const;
232
233 /**
234 \brief returns a pointer to an array with the tags used.
235 For this class the answer will always be {0}
236 */
237 ESCRIPT_DLL_API
238 virtual const int* borrowListOfTagsInUse(int functionSpaceCode) const;
239
240 ESCRIPT_DLL_API
241 bool supportsContactElements() const;
242
243 ESCRIPT_DLL_API
244 virtual escript::Data randomFill(const DataTypes::ShapeType& shape,
245 const FunctionSpace& what, long seed, const boost::python::tuple& filter) const;
246
247 protected:
248
249 private:
250
251 };
252
253 } // end of namespace
254
255 #endif

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26