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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3259 - (show annotations)
Mon Oct 11 01:48:14 2010 UTC (8 years, 11 months ago) by jfenwick
File size: 4099 byte(s)
Merging dudley and scons updates from branches

1
2 /*******************************************************
3 *
4 * Copyright (c) 2003-2010 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 "DomainException.h"
16 #include "NullDomain.h"
17 #include "Data.h"
18
19 namespace escript {
20
21 namespace {
22 int defaultList[2]={0,1}; // an array to return in borrowListOfTagsInUse();
23 int NullDomainFS=1; // Null domains only support 1 functionspace type.
24 // The choice of =1 as the value is arbitrary
25
26 int referenceID=10; // arbitrary
27 }
28
29
30 NullDomain::NullDomain() {
31 }
32
33 bool NullDomain::isValidFunctionSpaceType(int functionSpaceType) const
34 {
35 return (functionSpaceType==NullDomainFS);
36 }
37
38 std::string NullDomain::getDescription() const
39 {
40 return "NullDomain";
41 }
42
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 int NullDomain::getContinuousFunctionCode() const
77 {
78 return NullDomainFS;
79 }
80
81 int NullDomain::getFunctionCode() const
82 {
83 return NullDomainFS;
84 }
85
86 int NullDomain::getFunctionOnBoundaryCode() const
87 {
88 return NullDomainFS;
89 }
90
91 int NullDomain::getFunctionOnContactZeroCode() const
92 {
93 return NullDomainFS;
94 }
95
96 int NullDomain::getFunctionOnContactOneCode() const
97 {
98 return NullDomainFS;
99 }
100
101 int NullDomain::getSolutionCode() const
102 {
103 return NullDomainFS;
104 }
105
106 int NullDomain::getReducedSolutionCode() const
107 {
108 return NullDomainFS;
109 }
110
111 int NullDomain::getDiracDeltaFunctionCode() const
112 {
113 return NullDomainFS;
114 }
115
116 std::pair<int,int> NullDomain::getDataShape(int functionSpaceCode) const
117 {
118 //
119 // return an arbitary value
120 // - 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 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
132
133
134 const int* NullDomain::borrowSampleReferenceIDs(int functionSpaceType) const
135 {
136 //
137 // return an arbitary value
138 return &(referenceID);
139 }
140
141 int NullDomain::getDim() const
142 {
143 //
144 // return an arbitary value
145 return 1;
146 }
147
148 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
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 const int* NullDomain::borrowListOfTagsInUse(int functionSpaceCode) const
176 {
177 return defaultList;
178 }
179
180 bool NullDomain::supportsContactElements() const
181 {
182 return false;
183 }
184
185 } // end of namespace

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26