BEM++  2.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Groups Pages
grid.hpp
Go to the documentation of this file.
1 // Copyright (C) 2011-2012 by the BEM++ Authors
2 //
3 // Permission is hereby granted, free of charge, to any person obtaining a copy
4 // of this software and associated documentation files (the "Software"), to deal
5 // in the Software without restriction, including without limitation the rights
6 // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 // copies of the Software, and to permit persons to whom the Software is
8 // furnished to do so, subject to the following conditions:
9 //
10 // The above copyright notice and this permission notice shall be included in
11 // all copies or substantial portions of the Software.
12 //
13 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19 // THE SOFTWARE.
20 
21 #ifndef bempp_grid_hpp
22 #define bempp_grid_hpp
23 
26 #include "../common/common.hpp"
27 #include "../common/shared_ptr.hpp"
28 #include "grid_parameters.hpp"
29 
30 #include "../common/armadillo_fwd.hpp"
31 #include <cstddef> // size_t
32 #include <memory>
33 #include <vector>
34 #include <tbb/mutex.h>
35 
36 
37 namespace Bempp
38 {
39 
41 template<int codim> class Entity;
42 class GeometryFactory;
43 class GridView;
44 class IdSet;
50 class Grid
51 {
52 public:
54  virtual ~Grid() {
55  }
56 
61  virtual int dim() const = 0;
62 
64  virtual int dimWorld() const = 0;
65 
70  virtual int maxLevel() const = 0;
71 
77  virtual std::auto_ptr<GridView> levelView(size_t level) const = 0;
78 
80  virtual std::auto_ptr<GridView> leafView() const = 0;
81 
84  virtual GridParameters::Topology topology() const = 0;
85 
92  virtual std::auto_ptr<GeometryFactory> elementGeometryFactory() const = 0;
93 
99  virtual shared_ptr<Grid> barycentricGrid() const = 0;
100 
103  virtual bool hasBarycentricGrid() const = 0;
104 
107  virtual bool isBarycentricRepresentationOf(const Grid& other) const;
108 
110  virtual const IdSet& globalIdSet() const = 0;
111 
117  void getBoundingBox(arma::Col<double>& lowerBound,
118  arma::Col<double>& upperBound) const;
119 
120 private:
122  mutable arma::Col<double> m_lowerBound, m_upperBound;
124 };
125 
145 std::vector<bool> areInside(const Grid& grid, const arma::Mat<double>& points);
146 std::vector<bool> areInside(const Grid& grid, const arma::Mat<float>& points);
147 
148 } // namespace Bempp
149 
150 #endif
virtual std::auto_ptr< GridView > levelView(size_t level) const =0
View of the entities on grid level level.
virtual const IdSet & globalIdSet() const =0
Reference to the grid&#39;s global id set.
virtual bool hasBarycentricGrid() const =0
Return true if a barycentric refinement of this grid has been created.
virtual int maxLevel() const =0
Maximum level defined in this grid.
Abstract wrapper of a grid.
Definition: grid.hpp:50
virtual std::auto_ptr< GridView > leafView() const =0
View of the leaf entities.
virtual std::auto_ptr< GeometryFactory > elementGeometryFactory() const =0
Factory able to construct empty geometries of codimension 0 compatible with this grid.
virtual int dimWorld() const =0
Dimension of the space containing the grid.
Abstract wrapper of an id set.
Definition: id_set.hpp:37
virtual GridParameters::Topology topology() const =0
Return the topology of the grid.
Topology
Grid topology
Definition: grid_parameters.hpp:33
virtual shared_ptr< Grid > barycentricGrid() const =0
Return a barycentrically refined grid based on the LeafView.
virtual int dim() const =0
Dimension of the grid.
virtual bool isBarycentricRepresentationOf(const Grid &other) const
Return true if this grid is a barycentric representation of other, i.e. if this grid was created by o...
Definition: grid.cpp:60
virtual ~Grid()
Destructor.
Definition: grid.hpp:54
void getBoundingBox(arma::Col< double > &lowerBound, arma::Col< double > &upperBound) const
Get bounding box.
Definition: grid.cpp:68