escript  Revision_
FunctionSpace.h
Go to the documentation of this file.
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 Apache License, version 2.0
9 * http://www.apache.org/licenses/LICENSE-2.0
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 
18 #ifndef __ESCRIPT_FUNCTIONSPACE_H__
19 #define __ESCRIPT_FUNCTIONSPACE_H__
20 
21 #include "system_dep.h"
22 
23 #include "AbstractDomain.h"
24 
25 #include <boost/python/list.hpp>
26 #include <list>
27 
28 namespace escript {
29 
30 //
31 // Forward declaration for class Data.
32 class Data;
33 
35 {
36 public:
37  FunctionSpace();
38 
39  FunctionSpace(const_Domain_ptr domain, int functionSpaceType);
40 
41  FunctionSpace(const FunctionSpace& other);
42 
48  int getTypeCode() const;
49 
53  const_Domain_ptr getDomain() const;
54 
60  Domain_ptr getDomainPython() const;
61 
65  bool canTag() const;
66 
70  int getApproximationOrder() const;
71 
76  void setTags(const int newTag, const escript::Data& mask) const;
77 
78  void setTagsByString(const std::string& name, const escript::Data& mask) const;
79 
84  std::pair<int,DataTypes::dim_t> getDataShape() const;
85 
90  bool operator==(const FunctionSpace& other) const;
91 
92  bool operator!=(const FunctionSpace& other) const;
93 
97  std::string toString() const;
98 
102  int getTagFromSampleNo(DataTypes::dim_t sampleNo) const;
103 
107  int getTagFromDataPointNo(DataTypes::dim_t dataPointNo) const;
108 
113  DataTypes::dim_t getReferenceIDFromDataPointNo(DataTypes::dim_t dataPointNo) const;
114 
121  inline
123  return borrowSampleReferenceIDs()[sampleNo];
124  }
125 
130  inline
131  bool ownSample(DataTypes::dim_t sampleNo) const {
132  return m_domain->ownSample(m_functionSpaceType, sampleNo);
133  }
134 
138  const DataTypes::dim_t* borrowSampleReferenceIDs() const;
139 
143  escript::Data getX() const;
144 
148  escript::Data getNormal() const;
149 
154  escript::Data getSize() const;
155 
159  inline
160  DataTypes::dim_t getNumSamples() const { return getDataShape().second; }
161 
165  inline
166  int getNumDPPSample() const { return getNumDataPointsPerSample(); }
167 
168  inline
169  int getNumDataPointsPerSample() const { return getDataShape().first; }
170 
174  inline
175  int getDim() const { return getDomain()->getDim(); }
176 
180  boost::python::list getListOfTags() const;
181 
185  std::list<int> getListOfTagsSTL() const;
186 
190  int getNumberOfTagsInUse() const;
191 
192  const int* borrowListOfTagsInUse() const;
193 
194  inline
195  bool probeInterpolation(const FunctionSpace& other) const
196  {
197  if (*this == other)
198  return true;
199  const_Domain_ptr domain(getDomain());
200  if (*domain == *other.getDomain()) {
201  return domain->probeInterpolationOnDomain(
202  getTypeCode(), other.getTypeCode());
203  }
204  return domain->probeInterpolationAcross(
205  getTypeCode(), *(other.getDomain()), other.getTypeCode());
206  }
207 
208 private:
214  FunctionSpace& operator=(const FunctionSpace& other);
215 
217 
219 };
220 
222 
223 } // end of namespace
224 
225 #endif // __ESCRIPT_FUNCTIONSPACE_H__
226 
Definition: FunctionSpace.h:34
boost::shared_ptr< AbstractDomain > Domain_ptr
Definition: AbstractDomain.h:36
DataTypes::dim_t getNumSamples() const
Returns the number of samples.
Definition: FunctionSpace.h:160
Definition: AbstractContinuousDomain.cpp:22
bool ownSample(DataTypes::dim_t sampleNo) const
Does this process own the sample? For non-MPI builds will always return true.
Definition: FunctionSpace.h:131
const_Domain_ptr getDomain() const
Returns the function space domain.
Definition: FunctionSpace.cpp:102
bool probeInterpolation(const FunctionSpace &other) const
Definition: FunctionSpace.h:195
const_Domain_ptr m_domain
Definition: FunctionSpace.h:216
Data represents a collection of datapoints.
Definition: Data.h:63
int getTypeCode() const
Returns the function space type code.
Definition: FunctionSpace.cpp:94
int getNumDPPSample() const
Returns the number of data points per sample.
Definition: FunctionSpace.h:166
int m_functionSpaceType
Definition: FunctionSpace.h:218
int getDim() const
Return the number of spatial dimensions of the underlying domain.
Definition: FunctionSpace.h:175
DataTypes::dim_t getReferenceIDOfSample(DataTypes::dim_t sampleNo) const
Returns the reference number associated with the given sample number. This function is not efficient...
Definition: FunctionSpace.h:122
#define ESCRIPT_DLL_API
Definition: escriptcore/src/system_dep.h:29
bool canInterpolate(FunctionSpace src, FunctionSpace dest)
Definition: FunctionSpace.cpp:33
int getNumDataPointsPerSample() const
Definition: FunctionSpace.h:169
boost::shared_ptr< const AbstractDomain > const_Domain_ptr
Definition: AbstractDomain.h:39
index_t dim_t
Definition: DataTypes.h:64