Dune Core Modules (2.9.0)

domain.hh
Go to the documentation of this file.
1 #ifndef DUNE_SPGRID_DOMAIN_HH
2 #define DUNE_SPGRID_DOMAIN_HH
3 
4 #include <dune/grid/spgrid/cube.hh>
6 #include <dune/grid/spgrid/refinement.hh>
7 
13 namespace Dune
14 {
15 
16  // SPDomain
17  // --------
18 
25  template< class ct, int dim >
26  class SPDomain
27  {
28  typedef SPDomain< ct, dim > This;
29 
30  public:
31  typedef SPCube< ct, dim > Cube;
33 
35  typedef typename Cube::ctype ctype;
36 
38  static const int dimension = Cube::dimension;
39 
41  typedef typename Cube::GlobalVector GlobalVector;
42 
53  SPDomain ( const GlobalVector &a, const GlobalVector &b );
54 
56  SPDomain ( const std::vector< Cube > &cubes, const Topology &topology );
57 
59  const Cube &cube () const { return cube_; }
60 
62  const Topology &topology () const { return topology_; }
63 
70  bool contains ( const GlobalVector &x ) const { return cube().contains( x ); }
71 
76  static This unitCube ();
77 
78  private:
79  Cube cube_;
80  Topology topology_;
81  };
82 
83 
84 
85  // Implementation of SPDomain
86  // --------------------------
87 
88  template< class ct, int dim >
89  inline SPDomain< ct, dim >
90  ::SPDomain ( const GlobalVector &a, const GlobalVector &b )
91  : cube_( a, b ),
92  topology_()
93  {}
94 
95 
96  template< class ct, int dim >
97  inline SPDomain< ct, dim >
98  ::SPDomain ( const std::vector< Cube > &cubes, const Topology &topology )
99  : cube_( cubes[ 0 ] ),
100  topology_( topology )
101  {}
102 
103 
104  template< class ct, int dim >
105  inline typename SPDomain< ct, dim >::This
107  {
108  GlobalVector a, b;
109  for( int i = 0; i < dimension; ++i )
110  {
111  a = ctype( 0 );
112  b = ctype( 1 );
113  }
114  return This( a, b );
115  }
116 
117 } // namespace Dune
118 
119 #endif // #ifndef DUNE_SPGRID_DOMAIN_HH
description of the computational domain
Definition: domain.hh:27
static This unitCube()
obtain a domain modelling the unit cube
Definition: domain.hh:106
const Topology & topology() const
Definition: domain.hh:62
static const int dimension
dimension of the domain
Definition: domain.hh:38
Cube::GlobalVector GlobalVector
type of global vectors, i.e., vectors within the domain
Definition: domain.hh:41
Cube::ctype ctype
coordinate type
Definition: domain.hh:35
SPDomain(const GlobalVector &a, const GlobalVector &b)
constructor
Definition: domain.hh:90
bool contains(const GlobalVector &x) const
determine whether the domain contains a point x
Definition: domain.hh:70
const Cube & cube() const
Definition: domain.hh:59
description of the grid's topology
Definition: topology.hh:31
topology of a Cartesian grid
Dune namespace.
Definition: alignedallocator.hh:13
Creative Commons License   |  Legal Statements / Impressum  |  Hosted by TU Dresden  |  generated with Hugo v0.80.0 (May 16, 22:29, 2024)