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

Annotation of /trunk/escript/src/NullDomain.cpp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2487 - (hide annotations)
Tue Jun 23 04:26:07 2009 UTC (10 years, 4 months ago) by jfenwick
File size: 4031 byte(s)
Fixed const-ness on some return values.
Null-Domain now reports tag one as being in use.
1 jgs 82
2 ksteube 1312 /*******************************************************
3 ksteube 1811 *
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 ksteube 1312
14 ksteube 1811
15 jfenwick 2087 #include "DomainException.h"
16 jgs 474 #include "NullDomain.h"
17 jfenwick 2087 #include "Data.h"
18 jgs 82
19     namespace escript {
20    
21 jfenwick 1802 namespace {
22 jfenwick 2487 int defaultList[2]={0,1}; // an array to return in borrowListOfTagsInUse();
23 jfenwick 1802 int NullDomainFS=1; // Null domains only support 1 functionspace type.
24     // The choice of =1 as the value is arbitrary
25 jfenwick 2478
26     int referenceID=10; // arbitrary
27 jfenwick 1802 }
28    
29    
30 jgs 82 NullDomain::NullDomain() {
31     }
32    
33     bool NullDomain::isValidFunctionSpaceType(int functionSpaceType) const
34     {
35 jfenwick 2087 return (functionSpaceType==NullDomainFS);
36 jgs 82 }
37 jgs 115
38 jgs 82 std::string NullDomain::getDescription() const
39     {
40     return "NullDomain";
41     }
42 jfenwick 2087
43     std::string NullDomain::functionSpaceTypeAsString(int functionSpaceType) const
44     {
45     return "Default_FunctionSpace";
46     }
47    
48     void NullDomain::interpolateOnDomain(Data& target,const Data& source) const
49     {
50     if (source.getFunctionSpace().getDomain().get()!=this)
51     throw DomainException("Error - Illegal domain of interpolant.");
52     if (target.getFunctionSpace().getDomain().get()!=this)
53     throw DomainException("Error - Illegal domain of interpolation target.");
54     target=source;
55     }
56    
57     bool NullDomain::probeInterpolationOnDomain(int functionSpaceType_source,int functionSpaceType_target) const
58     {
59     if ((functionSpaceType_source!=functionSpaceType_target) || (functionSpaceType_target!=NullDomainFS))
60     {
61     throw DomainException("Error - Illegal function type for NullDomain.");
62     }
63     return true;
64     }
65    
66     void NullDomain::interpolateACross(Data& target, const Data& source) const
67     {
68     throw DomainException("Error - interpolation to the NullDomain not supported.");
69     }
70    
71     bool NullDomain::probeInterpolationACross(int functionSpaceType_source,const AbstractDomain& targetDomain, int functionSpaceType_target) const
72     {
73     return false;
74     }
75    
76 jgs 82 int NullDomain::getContinuousFunctionCode() const
77     {
78 jfenwick 1802 return NullDomainFS;
79 jgs 82 }
80    
81     int NullDomain::getFunctionCode() const
82     {
83 jfenwick 1802 return NullDomainFS;
84 jgs 82 }
85    
86     int NullDomain::getFunctionOnBoundaryCode() const
87     {
88 jfenwick 1802 return NullDomainFS;
89 jgs 82 }
90    
91     int NullDomain::getFunctionOnContactZeroCode() const
92     {
93 jfenwick 1802 return NullDomainFS;
94 jgs 82 }
95    
96     int NullDomain::getFunctionOnContactOneCode() const
97     {
98 jfenwick 1802 return NullDomainFS;
99 jgs 82 }
100    
101     int NullDomain::getSolutionCode() const
102     {
103 jfenwick 1802 return NullDomainFS;
104 jgs 82 }
105    
106     int NullDomain::getReducedSolutionCode() const
107     {
108 jfenwick 1802 return NullDomainFS;
109 jgs 82 }
110    
111     int NullDomain::getDiracDeltaFunctionCode() const
112     {
113 jfenwick 1802 return NullDomainFS;
114 jgs 82 }
115    
116     std::pair<int,int> NullDomain::getDataShape(int functionSpaceCode) const
117     {
118     //
119     // return an arbitary value
120 jfenwick 2478 // - I know it says arbitrary but its not a good idea to change it now.
121     // - some tests assume that the null domain holds a single value
122 jgs 82 return std::pair<int,int>(1,1);
123     }
124    
125     int NullDomain::getTagFromSampleNo(int functionSpaceType, int sampleNo) const
126     {
127     //
128     // return an arbitary value
129     return 1;
130     }
131 jgs 110
132 gross 964
133 jfenwick 2478
134 jfenwick 2487 const int* NullDomain::borrowSampleReferenceIDs(int functionSpaceType) const
135 jgs 110 {
136     //
137     // return an arbitary value
138 gross 964 return &(referenceID);
139 jgs 110 }
140    
141 jgs 82 int NullDomain::getDim() const
142     {
143     //
144     // return an arbitary value
145     return 1;
146     }
147    
148 jgs 121 bool NullDomain::operator==(const AbstractDomain& other) const
149     {
150     const NullDomain* temp=dynamic_cast<const NullDomain*>(&other);
151     if (temp!=0) {
152     return true;
153     } else {
154     return false;
155     }
156     }
157    
158     bool NullDomain::operator!=(const AbstractDomain& other) const
159     {
160     return(!(*this==other));
161     }
162    
163 jfenwick 1802
164    
165     bool NullDomain::canTag(int functionSpaceCode) const
166     {
167     return true;
168     }
169    
170     int NullDomain::getNumberOfTagsInUse(int functionSpaceCode) const
171     {
172     return 1; // this is not arbitrary. It allows us to report that the default tag is in use
173     }
174    
175 jfenwick 2487 const int* NullDomain::borrowListOfTagsInUse(int functionSpaceCode) const
176 jfenwick 1802 {
177     return defaultList;
178     }
179    
180    
181    
182 jgs 82 } // end of namespace

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26