/[escript]/trunk/escript/src/TestDomain.h
ViewVC logotype

Annotation of /trunk/escript/src/TestDomain.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2881 - (hide annotations)
Thu Jan 28 02:03:15 2010 UTC (9 years, 6 months ago) by jfenwick
File MIME type: text/plain
File size: 6212 byte(s)
Don't panic.
Updating copyright stamps

1 jfenwick 2483
2     /*******************************************************
3     *
4 jfenwick 2881 * Copyright (c) 2003-2010 by University of Queensland
5 jfenwick 2483 * 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     #if !defined escript_TestDomain_20090618_H
16     #define escript_TestDomain_20090618_H
17     #include "system_dep.h"
18    
19     #include "AbstractDomain.h"
20     #include "FunctionSpace.h"
21    
22     #include <string>
23    
24     namespace escript {
25    
26     /**
27     \brief
28     (Testing use only) Provides a domain to wrap a collection of values.
29    
30     This domain provides more functionality than NullDomain in that it can
31     store varying numbers of samples and points per sample.
32    
33     It currently supports a single function space which does not support tagging.
34     No effort has been made to make this work with MPI
35    
36     \warning This class exists to support testing and should not be used
37     as a general domain without ensuring that it works the way you expect.
38 jfenwick 2809 Also, other doco says that this class can be removed without notice.
39 jfenwick 2483
40     */
41    
42     class TestDomain : public AbstractDomain {
43    
44     public:
45    
46     /**
47     \brief
48     Default constructor for TestDomain.
49    
50     Description:
51     Default constructor for TestDomain.
52    
53     */
54     ESCRIPT_DLL_API
55     TestDomain(int pointspersample, int numsamples);
56    
57     ESCRIPT_DLL_API
58     ~TestDomain();
59    
60     /**
61     \brief
62     Returns true if the given integer is a valid function space type
63     for this domain.
64     */
65     ESCRIPT_DLL_API
66     virtual bool isValidFunctionSpaceType(int functionSpaceType) const;
67    
68     /**
69     \brief
70     Return a description for this domain.
71     */
72     ESCRIPT_DLL_API
73     virtual std::string getDescription() const;
74    
75     /**
76     \brief
77     Return a description for the given function space type code.
78     */
79     ESCRIPT_DLL_API
80     virtual std::string functionSpaceTypeAsString(int functionSpaceType) const;
81    
82     /**
83     \brief
84     Interpolates data given on source onto target where source and target have to be given on the same domain.
85     TestDomain only has one FunctionSpace so this makes target a shallow copy of source.
86     */
87     ESCRIPT_DLL_API
88     virtual void interpolateOnDomain(escript::Data& target,const escript::Data& source) const;
89     ESCRIPT_DLL_API
90     virtual bool probeInterpolationOnDomain(int functionSpaceType_source,int functionSpaceType_target) const;
91    
92 jfenwick 2635 ESCRIPT_DLL_API
93     bool
94     commonFunctionSpace(const std::vector<int>& fs, int& resultcode) const;
95    
96 jfenwick 2483 /**
97     \brief
98     Interpolates data given on source onto target where source and target are given on different domains.
99     We do not permit interpolation into the TestDomain so this method always throws.
100     */
101     ESCRIPT_DLL_API
102     virtual void interpolateACross(escript::Data& target, const escript::Data& source) const;
103     ESCRIPT_DLL_API
104     virtual bool probeInterpolationACross(int functionSpaceType_source,const AbstractDomain& targetDomain, int functionSpaceType_target) const;
105    
106    
107     /**
108     \brief
109     Return a continuous FunctionSpace.
110     */
111     ESCRIPT_DLL_API
112     virtual int getDefaultCode() const;
113    
114    
115     /**
116     \brief
117     Return a continuous FunctionSpace.
118     */
119     ESCRIPT_DLL_API
120     virtual int getContinuousFunctionCode() const;
121    
122     /**
123     \brief
124     Return a function FunctionSpace.
125     */
126     ESCRIPT_DLL_API
127     virtual int getFunctionCode() const;
128    
129     /**
130     \brief
131     Return a function on boundary FunctionSpace.
132     */
133     ESCRIPT_DLL_API
134     virtual int getFunctionOnBoundaryCode() const;
135    
136     /**
137     \brief
138     Return a FunctionSpace.
139     */
140     ESCRIPT_DLL_API
141     virtual int getFunctionOnContactZeroCode() const;
142    
143     /**
144     \brief
145     Return a FunctionSpace.
146     */
147     ESCRIPT_DLL_API
148     virtual int getFunctionOnContactOneCode() const;
149    
150     /**
151     \brief
152     Return a FunctionSpace.
153     */
154     ESCRIPT_DLL_API
155     virtual int getSolutionCode() const;
156    
157     /**
158     \brief
159     Return a FunctionSpace.
160     */
161     ESCRIPT_DLL_API
162     virtual int getReducedSolutionCode() const;
163    
164     /**
165     \brief
166     Return a FunctionSpace.
167     */
168     ESCRIPT_DLL_API
169     virtual int getDiracDeltaFunctionCode() const;
170    
171     /**
172     \brief
173     Return the number of data points per sample, and the number of samples as a pair.
174     \param functionSpaceCode Input - Code for the function space type.
175     \return pair, first - number of data points per sample, second - number of samples
176     */
177     ESCRIPT_DLL_API
178     virtual std::pair<int,int> getDataShape(int functionSpaceCode) const;
179    
180     /**
181     \brief
182     Return the tag key for the given sample number.
183     \param functionSpaceType Input - The function space type.
184     \param sampleNo Input - The sample number.
185     */
186     ESCRIPT_DLL_API
187     virtual int getTagFromSampleNo(int functionSpaceType, int sampleNo) const;
188    
189     /**
190     \brief
191     Return a borrowed pointer to the sample reference number id list
192     \param functionSpaceType Input - The function space type.
193     */
194     ESCRIPT_DLL_API
195 jfenwick 2487 virtual const int* borrowSampleReferenceIDs(int functionSpaceType) const;
196 jfenwick 2483
197     /**
198     \brief
199     */
200     ESCRIPT_DLL_API
201     virtual int getDim() const;
202    
203     /**
204     \brief
205     Return true if given domains are equal.
206     */
207     ESCRIPT_DLL_API
208     virtual bool operator==(const AbstractDomain& other) const;
209     ESCRIPT_DLL_API
210     virtual bool operator!=(const AbstractDomain& other) const;
211    
212     /**
213     \brief Checks if this domain allows tags for the specified functionSpaceCode.
214     */
215     ESCRIPT_DLL_API
216     virtual
217     bool canTag(int functionSpaceCode) const;
218    
219     /**
220     \brief
221     return the number of tags in use.
222     For this class the answer is always 1(the default tag).
223     */
224     ESCRIPT_DLL_API
225     virtual int getNumberOfTagsInUse(int functionSpaceCode) const;
226    
227     /**
228     \brief returns a pointer to an array with the tags used.
229     For this class the answer will always be {0}
230     */
231     ESCRIPT_DLL_API
232 jfenwick 2487 virtual const int* borrowListOfTagsInUse(int functionSpaceCode) const;
233 jfenwick 2483
234     protected:
235    
236     private:
237     int m_samples; // number of samples
238     int m_dpps; // data points per sample
239     int* m_samplerefids; // sample reference ids
240     };
241    
242 jfenwick 2628 ESCRIPT_DLL_API
243 jfenwick 2483 FunctionSpace
244     getTestDomainFunctionSpace(int dpps, int samples);
245    
246     } // end of namespace
247    
248     #endif

  ViewVC Help
Powered by ViewVC 1.1.26