escript
Revision_
|
00001 00002 /***************************************************************************** 00003 * 00004 * Copyright (c) 2003-2014 by University of Queensland 00005 * http://www.uq.edu.au 00006 * 00007 * Primary Business: Queensland, Australia 00008 * Licensed under the Open Software License version 3.0 00009 * http://www.opensource.org/licenses/osl-3.0.php 00010 * 00011 * Development until 2012 by Earth Systems Science Computational Center (ESSCC) 00012 * Development 2012-2013 by School of Earth Sciences 00013 * Development from 2014 by Centre for Geoscience Computing (GeoComp) 00014 * 00015 *****************************************************************************/ 00016 00017 00018 #if !defined escript_FunctionSpace_20040323_H 00019 #define escript_FunctionSpace_20040323_H 00020 #include "system_dep.h" 00021 00022 #include "AbstractDomain.h" 00023 #include "NullDomain.h" 00024 00025 #include <string> 00026 #include <list> 00027 00028 namespace escript { 00029 00030 // 00031 // Forward declaration for class Data. 00032 class Data; 00033 00046 class FunctionSpace 00047 { 00048 public: 00063 ESCRIPT_DLL_API 00064 FunctionSpace(); 00065 00073 ESCRIPT_DLL_API 00074 FunctionSpace(const_Domain_ptr domain, 00075 int functionSpaceType); 00076 00077 00078 ESCRIPT_DLL_API 00079 FunctionSpace(const FunctionSpace& other); 00080 00087 ESCRIPT_DLL_API 00088 int 00089 getTypeCode() const; 00090 00095 ESCRIPT_DLL_API 00096 // const 00097 // AbstractDomain& 00098 const_Domain_ptr 00099 getDomain() const; 00100 00107 ESCRIPT_DLL_API 00108 // const 00109 // AbstractDomain& 00110 Domain_ptr 00111 getDomainPython() const; 00112 00113 00114 00118 ESCRIPT_DLL_API 00119 bool 00120 canTag() const; 00121 00126 ESCRIPT_DLL_API 00127 int 00128 getApproximationOrder() const; 00129 00134 ESCRIPT_DLL_API 00135 void setTags(const int newTag, const escript::Data& mask) const; 00136 00137 00138 ESCRIPT_DLL_API 00139 void setTagsByString(const std::string& name, const escript::Data& mask) const; 00140 00141 00146 ESCRIPT_DLL_API 00147 std::pair<int,int> 00148 getDataShape() const; 00149 00156 ESCRIPT_DLL_API 00157 bool 00158 operator==(const FunctionSpace& other) const; 00159 00160 ESCRIPT_DLL_API 00161 bool 00162 operator!=(const FunctionSpace& other) const; 00163 00168 ESCRIPT_DLL_API 00169 std::string 00170 toString() const; 00171 00172 //#define DEBUG_PY_STRINGS 00173 00174 #ifdef DEBUG_PY_STRINGS 00175 00183 ESCRIPT_DLL_API 00184 PyObject * 00185 toPyString() const; 00186 #endif 00187 00192 ESCRIPT_DLL_API 00193 int 00194 getTagFromSampleNo(int sampleNo) const; 00195 00200 ESCRIPT_DLL_API 00201 int 00202 getTagFromDataPointNo(int dataPointNo) const; 00203 00208 ESCRIPT_DLL_API 00209 int getReferenceIDFromDataPointNo(int dataPointNo) const; 00210 00217 ESCRIPT_DLL_API 00218 inline 00219 int 00220 getReferenceIDOfSample(int sampleNo) const 00221 { 00222 return borrowSampleReferenceIDs()[sampleNo]; 00223 } 00224 00229 ESCRIPT_DLL_API 00230 inline 00231 bool 00232 ownSample(int sampleNo) const 00233 { 00234 return m_domain->ownSample(m_functionSpaceType, sampleNo); 00235 } 00236 00241 ESCRIPT_DLL_API 00242 const int* 00243 borrowSampleReferenceIDs() const; 00244 00249 ESCRIPT_DLL_API 00250 escript::Data 00251 getX() const; 00252 00257 ESCRIPT_DLL_API 00258 escript::Data 00259 getNormal() const; 00260 00265 ESCRIPT_DLL_API 00266 escript::Data 00267 getSize() const; 00268 00273 ESCRIPT_DLL_API 00274 inline 00275 int 00276 getNumSamples() const { 00277 return getDataShape().second; 00278 } 00279 00284 ESCRIPT_DLL_API 00285 inline 00286 int 00287 getNumDPPSample() const { 00288 return getNumDataPointsPerSample(); 00289 } 00290 00291 ESCRIPT_DLL_API 00292 inline 00293 int 00294 getNumDataPointsPerSample() const { 00295 return getDataShape().first; 00296 } 00297 00302 ESCRIPT_DLL_API 00303 inline 00304 int 00305 getDim() const { 00306 return getDomain()->getDim(); 00307 } 00312 ESCRIPT_DLL_API 00313 boost::python::list 00314 getListOfTags() const; 00319 ESCRIPT_DLL_API 00320 std::list<int> 00321 getListOfTagsSTL() const; 00322 00327 ESCRIPT_DLL_API 00328 int getNumberOfTagsInUse() const; 00329 00330 ESCRIPT_DLL_API 00331 const int* borrowListOfTagsInUse() const; 00332 00333 ESCRIPT_DLL_API 00334 bool 00335 probeInterpolation(const FunctionSpace& other) const 00336 { 00337 if (*this==other) { 00338 return true; 00339 } else { 00340 const_Domain_ptr domain=getDomain(); 00341 if (*domain==*other.getDomain()) { 00342 return domain->probeInterpolationOnDomain(getTypeCode(),other.getTypeCode()); 00343 } else { 00344 return domain->probeInterpolationACross(getTypeCode(),*(other.getDomain()),other.getTypeCode()); 00345 } 00346 } 00347 } 00348 00349 00350 protected: 00351 00352 private: 00358 ESCRIPT_DLL_API 00359 FunctionSpace& 00360 operator=(const FunctionSpace& other); 00361 00362 // 00363 // function space domain 00364 00365 // const AbstractDomain* m_domain; 00366 const_Domain_ptr m_domain; 00367 00368 00369 // 00370 // function space type code. 00371 int m_functionSpaceType; 00372 00373 }; 00374 00375 ESCRIPT_DLL_API 00376 bool canInterpolate(FunctionSpace src, FunctionSpace dest); 00377 00378 } // end of namespace 00379 00380 #endif