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

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

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

trunk/esys2/escript/src/Data/NullDomain.cpp revision 115 by jgs, Fri Mar 4 07:12:47 2005 UTC branches/arrexp_2137_win_merge/escript/src/NullDomain.cpp revision 2213 by jfenwick, Wed Jan 14 00:23:39 2009 UTC
# Line 1  Line 1 
 /*  
  ******************************************************************************  
  *                                                                            *  
  *       COPYRIGHT  ACcESS 2004 -  All Rights Reserved                        *  
  *                                                                            *  
  * This software is the property of ACcESS. No part of this code              *  
  * may be copied in any form or by any means without the expressed written    *  
  * consent of ACcESS.  Copying, use or modification of this software          *  
  * by any unauthorised person is illegal unless that person has a software    *  
  * license agreement with ACcESS.                                             *  
  *                                                                            *  
  ******************************************************************************  
 */  
1    
2  #include "escript/Data/NullDomain.h"  /*******************************************************
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    #include "DomainException.h"
16    #include "NullDomain.h"
17    #include "Data.h"
18    
19  namespace escript {  namespace escript {
20    
21    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  NullDomain::NullDomain() {  NullDomain::NullDomain() {
29  }  }
30    
31  bool NullDomain::isValidFunctionSpaceType(int functionSpaceType) const  bool NullDomain::isValidFunctionSpaceType(int functionSpaceType) const
32  {  {
33    //     return (functionSpaceType==NullDomainFS);
   // allow anything  
   return true;  
34  }  }
35    
36  std::string NullDomain::getDescription() const  std::string NullDomain::getDescription() const
37  {  {
38    return "NullDomain";    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    bool NullDomain::probeInterpolationACross(int functionSpaceType_source,const AbstractDomain& targetDomain, int functionSpaceType_target) const
70    {
71       return false;
72    }
73    
74  int NullDomain::getContinuousFunctionCode() const  int NullDomain::getContinuousFunctionCode() const
75  {  {
76    //    return NullDomainFS;
   // return an arbitary value  
   return 1;  
77  }  }
78    
79  int NullDomain::getFunctionCode() const  int NullDomain::getFunctionCode() const
80  {  {
81    //    return NullDomainFS;
   // return an arbitary value  
   return 1;  
82  }  }
83    
84  int NullDomain::getFunctionOnBoundaryCode() const  int NullDomain::getFunctionOnBoundaryCode() const
85  {  {
86    //    return NullDomainFS;
   // return an arbitary value  
   return 1;  
87  }  }
88    
89  int NullDomain::getFunctionOnContactZeroCode() const  int NullDomain::getFunctionOnContactZeroCode() const
90  {  {
91    //    return NullDomainFS;
   // return an arbitary value  
   return 1;  
92  }  }
93    
94  int NullDomain::getFunctionOnContactOneCode() const  int NullDomain::getFunctionOnContactOneCode() const
95  {  {
96    //    return NullDomainFS;
   // return an arbitary value  
   return 1;  
97  }  }
98    
99  int NullDomain::getSolutionCode() const  int NullDomain::getSolutionCode() const
100  {  {
101    //    return NullDomainFS;
   // return an arbitary value  
   return 1;  
102  }  }
103    
104  int NullDomain::getReducedSolutionCode() const  int NullDomain::getReducedSolutionCode() const
105  {  {
106    //    return NullDomainFS;
   // return an arbitary value  
   return 1;  
107  }  }
108    
109  int NullDomain::getDiracDeltaFunctionCode() const  int NullDomain::getDiracDeltaFunctionCode() const
110  {  {
111    //    return NullDomainFS;
   // return an arbitary value  
   return 1;  
112  }  }
113    
114  std::pair<int,int> NullDomain::getDataShape(int functionSpaceCode) const  std::pair<int,int> NullDomain::getDataShape(int functionSpaceCode) const
# Line 101  int NullDomain::getTagFromSampleNo(int f Line 125  int NullDomain::getTagFromSampleNo(int f
125    return 1;    return 1;
126  }  }
127    
128  int NullDomain::getReferenceNoFromSampleNo(int functionSpaceType, int sampleNo) const  int referenceID=10;
129    
130    int* NullDomain::borrowSampleReferenceIDs(int functionSpaceType) const
131  {  {
132    //    //
133    // return an arbitary value    // return an arbitary value
134    return 1;    return &(referenceID);
135  }  }
136    
137  int NullDomain::getDim() const  int NullDomain::getDim() const
# Line 115  int NullDomain::getDim() const Line 141  int NullDomain::getDim() const
141    return 1;    return 1;
142  }  }
143    
144    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    
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  }  // end of namespace  }  // end of namespace

Legend:
Removed from v.115  
changed lines
  Added in v.2213

  ViewVC Help
Powered by ViewVC 1.1.26