Logo  0.95.0-final
Finite Element Embedded Library and Language in C++
Feel++ Feel++ on Github Feel++ community
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
functordomain.hpp
Go to the documentation of this file.
1 /* -*- mode: c++; coding: utf-8; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; show-trailing-whitespace: t -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4
2 
3  This file is part of the Feel library
4 
5  Author(s): Christophe Prud'homme <christophe.prudhomme@feelpp.org>
6  Date: 2005-07-17
7 
8  Copyright (C) 2005,2006 EPFL
9  Copyright (C) 2007 Université Joseph Fourier (Grenoble I)
10 
11  This library is free software; you can redistribute it and/or
12  modify it under the terms of the GNU Lesser General Public
13  License as published by the Free Software Foundation; either
14  version 3.0 of the License, or (at your option) any later version.
15 
16  This library is distributed in the hope that it will be useful,
17  but WITHOUT ANY WARRANTY; without even the implied warranty of
18  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19  Lesser General Public License for more details.
20 
21  You should have received a copy of the GNU Lesser General Public
22  License along with this library; if not, write to the Free Software
23  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
24 */
30 #ifndef __Functordomain_H
31 #define __Functordomain_H 1
32 
33 #include <feel/feelcore/feel.hpp>
34 
35 namespace Feel
36 {
37 namespace vf
38 {
40 
46 template<typename T = double>
47 class FunctorDomain
48 {
49 public:
50  typedef T value_type;
51 
52  FunctorDomain()
53  {}
54 
55  virtual ~FunctorDomain()
56  {}
57 
58  virtual bool hasLowerBound() const
59  {
60  return false;
61  }
62 
63  virtual value_type lowerBound() const
64  {
65  FEELPP_ASSERT( true )( "FunctorDomain::lowerBound() called for a domain without "
66  "a lower bound" );
67  return 0.0;
68  }
69 
70  virtual bool hasUpperBound() const
71  {
72  return false;
73  }
74 
75  virtual value_type upperBound() const
76  {
77  FEELPP_ASSERT( true )( "FunctorDomain::upperBound() called for a domain without "
78  "a upper bound" );
79  return 0.0;
80  }
81 
82  virtual bool hasExcludedPoint() const
83  {
84  return false;
85  }
86 
87  virtual value_type excludedPoint() const
88  {
89  FEELPP_ASSERT( true )( "FunctorDomain::excludedPoint() called for a domain without "
90  "an excluded point" );
91  return 0.0;
92  }
93 
94 };
95 template<typename T = double>
96 class UnboundedDomain : public FunctorDomain<T>
97 {
98  typedef FunctorDomain<T> super;
99 public:
100 
101 
102  typedef typename super::value_type value_type;
103 
104  UnboundedDomain()
105  :
106  super()
107  {}
108 };
109 
110 template<typename T = double>
111 class PositiveDomain : public FunctorDomain<T>
112 {
113  typedef FunctorDomain<T> super;
114 
115 public:
116 
117  typedef typename super::value_type value_type;
118 
119  PositiveDomain()
120  :
121  super()
122  {}
123 
124  virtual bool hasLowerBound() const
125  {
126  return true;
127  }
128 
129  virtual value_type lowerBound() const
130  {
131  return 0.0;
132  }
133 };
134 
135 template<typename T = double>
136 class BoundedDomain : public FunctorDomain<T>
137 {
138  typedef FunctorDomain<T> super;
139 
140 public:
141 
142  typedef typename super::value_type value_type;
143 
144  BoundedDomain( const value_type& lower, const value_type& upper )
145  :
146  super(),
147  lower_( lower ),
148  upper_( upper )
149  {}
150 
151  virtual bool hasLowerBound() const
152  {
153  return true;
154  }
155 
156  virtual value_type lowerBound() const
157  {
158  return lower_;
159  }
160 
161  virtual bool hasUpperBound() const
162  {
163  return true;
164  }
165 
166  virtual value_type upperBound() const
167  {
168  return upper_;
169  }
170 
171 private:
172  value_type lower_;
173 
174  value_type upper_;
175 };
176 
177 template<typename T = double>
178 class LowerBoundedDomain : public FunctorDomain<T>
179 {
180  typedef FunctorDomain<T> super;
181 
182 public:
183 
184  typedef typename super::value_type value_type;
185 
186  LowerBoundedDomain( const value_type& lower )
187  :
188  super(),
189  lower_( lower )
190  {}
191 
192  virtual bool hasLowerBound() const
193  {
194  return true;
195  }
196 
197  virtual value_type lowerBound() const
198  {
199  return lower_;
200  }
201 
202 private:
203  value_type lower_;
204 };
205 
206 template<typename T = double>
207 class NonzeroDomain : public FunctorDomain<T>
208 {
209  typedef FunctorDomain<T> super;
210 
211 public:
212 
213  typedef typename super::value_type value_type;
214 
215  NonzeroDomain()
216  :
217  super()
218  {}
219 
220  virtual bool hasExcludedPoint() const
221  {
222  return true;
223  }
224 
225  virtual value_type excludedPoint() const
226  {
227  return 0.0;
228  }
229 };
231 }
232 }
233 #endif /* __Functordomain_H */

Generated on Fri Oct 25 2013 14:24:13 for Feel++ by doxygen 1.8.4