All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Groups Pages
PartitionIteratorRule.hpp
1 //===========================================================================
2 //
3 // File: PartitionIteratorRule.hpp
4 //
5 // Created: Fri Oct 31 2013
6 //
7 // Author(s): Markus Blatt <markus@dr-blatt.de>
8 //
9 // $Date$
10 //
11 // $Revision$
12 //
13 //===========================================================================
14 
15 /*
16  Copyright 2013 Dr. Blatt - HPC-Simulation & Services.
17  Copyright 2013 Statoil ASA.
18 
19  This file is part of The Open Porous Media project (OPM).
20 
21  OPM is free software: you can redistribute it and/or modify
22  it under the terms of the GNU General Public License as published by
23  the Free Software Foundation, either version 3 of the License, or
24  (at your option) any later version.
25 
26  OPM is distributed in the hope that it will be useful,
27  but WITHOUT ANY WARRANTY; without even the implied warranty of
28  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
29  GNU General Public License for more details.
30 
31  You should have received a copy of the GNU General Public License
32  along with OPM. If not, see <http://www.gnu.org/licenses/>.
33 */
34 namespace Dune
35 {
36 namespace cpgrid
37 {
40  template<PartitionIteratorType pitype>
42  {
43  enum {fullSet=false, emptySet=true};
44 
45  template<int codim>
46  bool isInvalid(const Entity<codim>&)
47  {
48  return true;
49  }
50  };
51 
52  template<>
53  struct PartitionIteratorRule<Interior_Partition>
54  {
55  enum {fullSet=false, emptySet=false};
56  template<int codim>
57  bool isInvalid(const Entity<codim>& e)
58  {
59  if(e.partitionType()==InteriorEntity)
60  return false;
61  return true;
62  }
63  };
64 
65  template<>
66  struct PartitionIteratorRule<InteriorBorder_Partition>
67  {
68  enum {fullSet=false, emptySet=false};
69  template<int codim>
70  bool isInvalid(const Entity<codim>& e)
71  {
72  if(e.partitionType()==InteriorEntity ||
73  e.partitionType()==BorderEntity)
74  return false;
75  return true;
76  }
77  };
78 
79  template<>
80  struct PartitionIteratorRule<Overlap_Partition>
81  {
82  enum {fullSet=false, emptySet=false};
83  template<int codim>
84  bool isInvalid(const Entity<codim>& e)
85  {
86  // interior, border, and overlap are valid!
87  if(e.partitionType()==FrontEntity)
88  return true;
89  return false;
90  }
91  };
92 
93  template<>
94  struct PartitionIteratorRule<All_Partition>
95  {
96  enum {fullSet=true, emptySet=false};
97  template<int codim>
98  bool isInvalid(const Entity<codim>&)
99  {
100  return false;
101  }
102  };
103 
104  template<>
105  struct PartitionIteratorRule<OverlapFront_Partition>
106  : public PartitionIteratorRule<All_Partition>
107  {
108  // Visits everything but ghost entities.
109  // As there are no ghosts in CpGrid, it visits
110  // everything.
111  };
112 
113 } // end namespace cpgrid
114 } // end namespace Dune
PartitionType partitionType() const
For now, the grid is serial and the only partitionType() is InteriorEntity.
Definition: Entity.hpp:384
A rule at what entities to stop.
Definition: PartitionIteratorRule.hpp:41