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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2487 - (hide annotations)
Tue Jun 23 04:26:07 2009 UTC (11 years, 1 month ago) by jfenwick
File MIME type: text/plain
File size: 6024 byte(s)
Fixed const-ness on some return values.
Null-Domain now reports tag one as being in use.
1 jfenwick 2483
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     #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    
39     */
40    
41     class TestDomain : public AbstractDomain {
42    
43     public:
44    
45     /**
46     \brief
47     Default constructor for TestDomain.
48    
49     Description:
50     Default constructor for TestDomain.
51    
52     */
53     ESCRIPT_DLL_API
54     TestDomain(int pointspersample, int numsamples);
55    
56     ESCRIPT_DLL_API
57     ~TestDomain();
58    
59     /**
60     \brief
61     Returns true if the given integer is a valid function space type
62     for this domain.
63     */
64     ESCRIPT_DLL_API
65     virtual bool isValidFunctionSpaceType(int functionSpaceType) const;
66    
67     /**
68     \brief
69     Return a description for this domain.
70     */
71     ESCRIPT_DLL_API
72     virtual std::string getDescription() const;
73    
74     /**
75     \brief
76     Return a description for the given function space type code.
77     */
78     ESCRIPT_DLL_API
79     virtual std::string functionSpaceTypeAsString(int functionSpaceType) const;
80    
81     /**
82     \brief
83     Interpolates data given on source onto target where source and target have to be given on the same domain.
84     TestDomain only has one FunctionSpace so this makes target a shallow copy of source.
85     */
86     ESCRIPT_DLL_API
87     virtual void interpolateOnDomain(escript::Data& target,const escript::Data& source) const;
88     ESCRIPT_DLL_API
89     virtual bool probeInterpolationOnDomain(int functionSpaceType_source,int functionSpaceType_target) const;
90    
91     /**
92     \brief
93     Interpolates data given on source onto target where source and target are given on different domains.
94     We do not permit interpolation into the TestDomain so this method always throws.
95     */
96     ESCRIPT_DLL_API
97     virtual void interpolateACross(escript::Data& target, const escript::Data& source) const;
98     ESCRIPT_DLL_API
99     virtual bool probeInterpolationACross(int functionSpaceType_source,const AbstractDomain& targetDomain, int functionSpaceType_target) const;
100    
101    
102     /**
103     \brief
104     Return a continuous FunctionSpace.
105     */
106     ESCRIPT_DLL_API
107     virtual int getDefaultCode() const;
108    
109    
110     /**
111     \brief
112     Return a continuous FunctionSpace.
113     */
114     ESCRIPT_DLL_API
115     virtual int getContinuousFunctionCode() const;
116    
117     /**
118     \brief
119     Return a function FunctionSpace.
120     */
121     ESCRIPT_DLL_API
122     virtual int getFunctionCode() const;
123    
124     /**
125     \brief
126     Return a function on boundary FunctionSpace.
127     */
128     ESCRIPT_DLL_API
129     virtual int getFunctionOnBoundaryCode() const;
130    
131     /**
132     \brief
133     Return a FunctionSpace.
134     */
135     ESCRIPT_DLL_API
136     virtual int getFunctionOnContactZeroCode() const;
137    
138     /**
139     \brief
140     Return a FunctionSpace.
141     */
142     ESCRIPT_DLL_API
143     virtual int getFunctionOnContactOneCode() const;
144    
145     /**
146     \brief
147     Return a FunctionSpace.
148     */
149     ESCRIPT_DLL_API
150     virtual int getSolutionCode() const;
151    
152     /**
153     \brief
154     Return a FunctionSpace.
155     */
156     ESCRIPT_DLL_API
157     virtual int getReducedSolutionCode() const;
158    
159     /**
160     \brief
161     Return a FunctionSpace.
162     */
163     ESCRIPT_DLL_API
164     virtual int getDiracDeltaFunctionCode() const;
165    
166     /**
167     \brief
168     Return the number of data points per sample, and the number of samples as a pair.
169     \param functionSpaceCode Input - Code for the function space type.
170     \return pair, first - number of data points per sample, second - number of samples
171     */
172     ESCRIPT_DLL_API
173     virtual std::pair<int,int> getDataShape(int functionSpaceCode) const;
174    
175     /**
176     \brief
177     Return the tag key for the given sample number.
178     \param functionSpaceType Input - The function space type.
179     \param sampleNo Input - The sample number.
180     */
181     ESCRIPT_DLL_API
182     virtual int getTagFromSampleNo(int functionSpaceType, int sampleNo) const;
183    
184     /**
185     \brief
186     Return a borrowed pointer to the sample reference number id list
187     \param functionSpaceType Input - The function space type.
188     */
189     ESCRIPT_DLL_API
190 jfenwick 2487 virtual const int* borrowSampleReferenceIDs(int functionSpaceType) const;
191 jfenwick 2483
192     /**
193     \brief
194     */
195     ESCRIPT_DLL_API
196     virtual int getDim() const;
197    
198     /**
199     \brief
200     Return true if given domains are equal.
201     */
202     ESCRIPT_DLL_API
203     virtual bool operator==(const AbstractDomain& other) const;
204     ESCRIPT_DLL_API
205     virtual bool operator!=(const AbstractDomain& other) const;
206    
207     /**
208     \brief Checks if this domain allows tags for the specified functionSpaceCode.
209     */
210     ESCRIPT_DLL_API
211     virtual
212     bool canTag(int functionSpaceCode) const;
213    
214     /**
215     \brief
216     return the number of tags in use.
217     For this class the answer is always 1(the default tag).
218     */
219     ESCRIPT_DLL_API
220     virtual int getNumberOfTagsInUse(int functionSpaceCode) const;
221    
222     /**
223     \brief returns a pointer to an array with the tags used.
224     For this class the answer will always be {0}
225     */
226     ESCRIPT_DLL_API
227 jfenwick 2487 virtual const int* borrowListOfTagsInUse(int functionSpaceCode) const;
228 jfenwick 2483
229     protected:
230    
231     private:
232     int m_samples; // number of samples
233     int m_dpps; // data points per sample
234     int* m_samplerefids; // sample reference ids
235     };
236    
237     FunctionSpace
238     getTestDomainFunctionSpace(int dpps, int samples);
239    
240     } // end of namespace
241    
242     #endif

  ViewVC Help
Powered by ViewVC 1.1.26