ESScript  Revision_4488
FunctionSpace.h
Go to the documentation of this file.
1 
2 /*****************************************************************************
3 *
4 * Copyright (c) 2003-2013 by 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 since 2012 by School of Earth Sciences
13 *
14 *****************************************************************************/
15 
16 
17 #if !defined escript_FunctionSpace_20040323_H
18 #define escript_FunctionSpace_20040323_H
19 #include "system_dep.h"
20 
21 #include "AbstractDomain.h"
22 #include "NullDomain.h"
23 
24 #include <string>
25 #include <list>
26 
27 namespace escript {
28 
29 //
30 // Forward declaration for class Data.
31 class Data;
32 
46 {
47 public:
63  FunctionSpace();
64 
74  int functionSpaceType);
75 
76 
78  FunctionSpace(const FunctionSpace& other);
79 
87  int
88  getTypeCode() const;
89 
95 // const
96 // AbstractDomain&
98  getDomain() const;
99 
107 // const
108 // AbstractDomain&
109  Domain_ptr
110  getDomainPython() const;
111 
112 
113 
118  bool
119  canTag() const;
120 
126  int
127  getApproximationOrder() const;
128 
134  void setTags(const int newTag, const escript::Data& mask) const;
135 
136 
138  void setTagsByString(const std::string& name, const escript::Data& mask) const;
139 
140 
146  std::pair<int,int>
147  getDataShape() const;
148 
156  bool
157  operator==(const FunctionSpace& other) const;
158 
160  bool
161  operator!=(const FunctionSpace& other) const;
162 
168  std::string
169  toString() const;
170 
171  //#define DEBUG_PY_STRINGS
172 
173 #ifdef DEBUG_PY_STRINGS
174 
183  PyObject *
184  toPyString() const;
185 #endif
186 
192  int
193  getTagFromSampleNo(int sampleNo) const;
194 
200  int
201  getTagFromDataPointNo(int dataPointNo) const;
202 
208  int getReferenceIDFromDataPointNo(int dataPointNo) const;
209 
217  inline
218  int
219  getReferenceIDOfSample(int sampleNo) const
220  {
221  return borrowSampleReferenceIDs()[sampleNo];
222  }
223 
229  inline
230  bool
231  ownSample(int sampleNo) const
232  {
233  return m_domain->ownSample(m_functionSpaceType, sampleNo);
234  }
235 
241  const int*
242  borrowSampleReferenceIDs() const;
243 
250  getX() const;
251 
258  getNormal() const;
259 
266  getSize() const;
267 
273  inline
274  int
275  getNumSamples() const {
276  return getDataShape().second;
277  }
278 
284  inline
285  int
286  getNumDPPSample() const {
287  return getNumDataPointsPerSample();
288  }
289 
291  inline
292  int
294  return getDataShape().first;
295  }
296 
302  inline
303  int
304  getDim() const {
305  return getDomain()->getDim();
306  }
312  boost::python::list
313  getListOfTags() const;
319  std::list<int>
320  getListOfTagsSTL() const;
321 
327  int getNumberOfTagsInUse() const;
328 
330  const int* borrowListOfTagsInUse() const;
331 
333  bool
334  probeInterpolation(const FunctionSpace& other) const
335  {
336  if (*this==other) {
337  return true;
338  } else {
339  const_Domain_ptr domain=getDomain();
340  if (*domain==*other.getDomain()) {
341  return domain->probeInterpolationOnDomain(getTypeCode(),other.getTypeCode());
342  } else {
343  return domain->probeInterpolationACross(getTypeCode(),*(other.getDomain()),other.getTypeCode());
344  }
345  }
346  }
347 
348 
349  protected:
350 
351  private:
358  FunctionSpace&
359  operator=(const FunctionSpace& other);
360 
361  //
362  // function space domain
363 
364 // const AbstractDomain* m_domain;
366 
367 
368  //
369  // function space type code.
371 
372 };
373 
376 
377 } // end of namespace
378 
379 #endif