/[escript]/branches/trilinos_from_5897/escriptcore/src/NullDomain.cpp
ViewVC logotype

Contents of /branches/trilinos_from_5897/escriptcore/src/NullDomain.cpp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 5963 - (show annotations)
Mon Feb 22 06:59:27 2016 UTC (3 years, 3 months ago) by caltinay
File size: 5344 byte(s)
sync and fix.

1
2 /*****************************************************************************
3 *
4 * Copyright (c) 2003-2016 by The University of Queensland
5 * http://www.uq.edu.au
6 *
7 * Primary Business: Queensland, Australia
8 * Licensed under the Open Software License version 3.0
9 * http://www.opensource.org/licenses/osl-3.0.php
10 *
11 * Development until 2012 by Earth Systems Science Computational Center (ESSCC)
12 * Development 2012-2013 by School of Earth Sciences
13 * Development from 2014 by Centre for Geoscience Computing (GeoComp)
14 *
15 *****************************************************************************/
16
17 #define ESNEEDPYTHON
18 #include "esysUtils/first.h"
19
20
21 #include "DomainException.h"
22 #include "NullDomain.h"
23 #include "Data.h"
24
25 namespace escript {
26
27 namespace {
28 int defaultList[2]={0,1}; // an array to return in borrowListOfTagsInUse();
29 }
30
31 // Null domains only support 1 functionspace type.
32 // The choice of -7 as the value is to prevent collision with other domain enums
33 int NullDomain::NullDomainFS = -7;
34 DataTypes::dim_t NullDomain::referenceID = DataTypes::dim_t(10); // arbitrary
35
36 std::string NullDomain::getDescription() const
37 {
38 return "NullDomain";
39 }
40
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 std::pair<int,DataTypes::dim_t> NullDomain::getDataShape(int functionSpaceCode) const
70 {
71 //
72 // return an arbitrary value
73 // - I know it says arbitrary but its not a good idea to change it now.
74 // - some tests assume that the null domain holds a single value
75 return std::pair<int,DataTypes::dim_t>(1,1);
76 }
77
78 bool NullDomain::operator==(const AbstractDomain& other) const
79 {
80 const NullDomain* temp=dynamic_cast<const NullDomain*>(&other);
81 if (temp!=0) {
82 return true;
83 } else {
84 return false;
85 }
86 }
87
88 const int* NullDomain::borrowListOfTagsInUse(int functionSpaceCode) const
89 {
90 return defaultList;
91 }
92
93 escript::Data NullDomain::randomFill(const DataTypes::ShapeType& shape,
94 const FunctionSpace& what, long seed, const boost::python::tuple& filter) const
95 {
96 throw DataException("Attempted randomFill on NullDomain. NullDomains do not store values.");
97 }
98 void NullDomain::dump(std::string const&) const
99 {
100 throwStandardException("NullDomain::dump");
101 }
102 void NullDomain::write(std::string const&) const
103 {
104 throwStandardException("NullDomain::write");
105 }
106 bool NullDomain::commonFunctionSpace(std::vector<int> const&, int&) const
107 {
108 throwStandardException("NullDomain::commonFunctionSpace");
109 return false;
110 }
111 bool NullDomain::isCellOriented(int) const
112 {
113 throwStandardException("NullDomain::isCellOriented");
114 return false;
115 }
116 bool NullDomain::ownSample(int, DataTypes::index_t) const
117 {
118 throwStandardException("NullDomain::ownSample");
119 return false;
120 }
121 int NullDomain::getApproximationOrder(int) const
122 {
123 throwStandardException("NullDomain::getApproximationOrder");
124 return 0;
125 }
126 signed char NullDomain::preferredInterpolationOnDomain(int, int) const
127 {
128 throwStandardException("NullDomain::preferredInterpolationOnDomain");
129 return 0;
130 }
131 std::string NullDomain::showTagNames() const
132 {
133 throwStandardException("NullDomain::showTagNames");
134 return std::string();
135 }
136 int NullDomain::getTag(std::string const&) const
137 {
138 throwStandardException("NullDomain::getTag");
139 return 0;
140 }
141 void NullDomain::setTagMap(std::string const&, int)
142 {
143 throwStandardException("NullDomain::setTagMap");
144 }
145 void NullDomain::setTags(int, int, escript::Data const&) const
146 {
147 throwStandardException("NullDomain::setTags");
148 }
149 void NullDomain::setNewX(escript::Data const&)
150 {
151 throwStandardException("NullDomain::setNewX");
152 }
153 escript::Data NullDomain::getNormal() const
154 {
155 throwStandardException("NullDomain::getNormal");
156 return escript::Data();
157 }
158 void NullDomain::setToNormal(escript::Data&) const
159 {
160 throwStandardException("NullDomain::setToNormal");
161 }
162 void NullDomain::setToGradient(escript::Data&, escript::Data const&) const
163 {
164 throwStandardException("NullDomain::setToGradient");
165 }
166 escript::Data NullDomain::getSize() const
167 {
168 throwStandardException("NullDomain::getSize");
169 return escript::Data();
170 }
171 void NullDomain::setToSize(escript::Data&) const
172 {
173 throwStandardException("NullDomain::setToSize");
174 }
175 escript::Data NullDomain::getX() const
176 {
177 throwStandardException("NullDomain::getX");
178 return escript::Data();
179 }
180 void NullDomain::setToX(escript::Data&) const
181 {
182 throwStandardException("NullDomain::setToX");
183 }
184
185
186 } // end of namespace

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26