/[escript]/branches/arrexp_2137_win_merge/escript/src/NullDomain.cpp
ViewVC logotype

Annotation of /branches/arrexp_2137_win_merge/escript/src/NullDomain.cpp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2087 - (hide annotations)
Mon Nov 24 04:51:30 2008 UTC (10 years, 8 months ago) by jfenwick
Original Path: trunk/escript/src/NullDomain.cpp
File size: 3861 byte(s)
Addressing mantis issue #221.
Interpolation.. and probeInterpolation.. now "work" for the NullDomain.
Work means throw a descriptive exception if you try to move into or out 
of the NullDomain.
The bad_cast exception related to this has been fixed.


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     int defaultList[1]={0}; // 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    
27    
28 jgs 82 NullDomain::NullDomain() {
29     }
30    
31     bool NullDomain::isValidFunctionSpaceType(int functionSpaceType) const
32     {
33 jfenwick 2087 return (functionSpaceType==NullDomainFS);
34 jgs 82 }
35 jgs 115
36 jgs 82 std::string NullDomain::getDescription() const
37     {
38     return "NullDomain";
39     }
40 jfenwick 2087
41     std::string NullDomain::functionSpaceTypeAsString(int functionSpaceType) const
42     {
43     return "Default_FunctionSpace";
44     }
45    
46     void NullDomain::interpolateOnDomain(Data& target,const Data& source) const
47     {
48     if (source.getFunctionSpace().getDomain().get()!=this)
49     throw DomainException("Error - Illegal domain of interpolant.");
50     if (target.getFunctionSpace().getDomain().get()!=this)
51     throw DomainException("Error - Illegal domain of interpolation target.");
52     target=source;
53     }
54    
55     bool NullDomain::probeInterpolationOnDomain(int functionSpaceType_source,int functionSpaceType_target) const
56     {
57     if ((functionSpaceType_source!=functionSpaceType_target) || (functionSpaceType_target!=NullDomainFS))
58     {
59     throw DomainException("Error - Illegal function type for NullDomain.");
60     }
61     return true;
62     }
63    
64     void NullDomain::interpolateACross(Data& target, const Data& source) const
65     {
66     throw DomainException("Error - interpolation to the NullDomain not supported.");
67     }
68    
69     bool NullDomain::probeInterpolationACross(int functionSpaceType_source,const AbstractDomain& targetDomain, int functionSpaceType_target) const
70     {
71     return false;
72     }
73    
74 jgs 82 int NullDomain::getContinuousFunctionCode() const
75     {
76 jfenwick 1802 return NullDomainFS;
77 jgs 82 }
78    
79     int NullDomain::getFunctionCode() const
80     {
81 jfenwick 1802 return NullDomainFS;
82 jgs 82 }
83    
84     int NullDomain::getFunctionOnBoundaryCode() const
85     {
86 jfenwick 1802 return NullDomainFS;
87 jgs 82 }
88    
89     int NullDomain::getFunctionOnContactZeroCode() const
90     {
91 jfenwick 1802 return NullDomainFS;
92 jgs 82 }
93    
94     int NullDomain::getFunctionOnContactOneCode() const
95     {
96 jfenwick 1802 return NullDomainFS;
97 jgs 82 }
98    
99     int NullDomain::getSolutionCode() const
100     {
101 jfenwick 1802 return NullDomainFS;
102 jgs 82 }
103    
104     int NullDomain::getReducedSolutionCode() const
105     {
106 jfenwick 1802 return NullDomainFS;
107 jgs 82 }
108    
109     int NullDomain::getDiracDeltaFunctionCode() const
110     {
111 jfenwick 1802 return NullDomainFS;
112 jgs 82 }
113    
114     std::pair<int,int> NullDomain::getDataShape(int functionSpaceCode) const
115     {
116     //
117     // return an arbitary value
118     return std::pair<int,int>(1,1);
119     }
120    
121     int NullDomain::getTagFromSampleNo(int functionSpaceType, int sampleNo) const
122     {
123     //
124     // return an arbitary value
125     return 1;
126     }
127 jgs 110
128 gross 964 int referenceID=10;
129    
130     int* NullDomain::borrowSampleReferenceIDs(int functionSpaceType) const
131 jgs 110 {
132     //
133     // return an arbitary value
134 gross 964 return &(referenceID);
135 jgs 110 }
136    
137 jgs 82 int NullDomain::getDim() const
138     {
139     //
140     // return an arbitary value
141     return 1;
142     }
143    
144 jgs 121 bool NullDomain::operator==(const AbstractDomain& other) const
145     {
146     const NullDomain* temp=dynamic_cast<const NullDomain*>(&other);
147     if (temp!=0) {
148     return true;
149     } else {
150     return false;
151     }
152     }
153    
154     bool NullDomain::operator!=(const AbstractDomain& other) const
155     {
156     return(!(*this==other));
157     }
158    
159 jfenwick 1802
160    
161     bool NullDomain::canTag(int functionSpaceCode) const
162     {
163     return true;
164     }
165    
166     int NullDomain::getNumberOfTagsInUse(int functionSpaceCode) const
167     {
168     return 1; // this is not arbitrary. It allows us to report that the default tag is in use
169     }
170    
171     int* NullDomain::borrowListOfTagsInUse(int functionSpaceCode) const
172     {
173     return defaultList;
174     }
175    
176    
177    
178 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