3
|
1 /* |
|
2 |
2847
|
3 Copyright (C) 1996, 1997 John W. Eaton |
3
|
4 |
|
5 This file is part of Octave. |
|
6 |
|
7 Octave is free software; you can redistribute it and/or modify it |
|
8 under the terms of the GNU General Public License as published by the |
|
9 Free Software Foundation; either version 2, or (at your option) any |
|
10 later version. |
|
11 |
|
12 Octave is distributed in the hope that it will be useful, but WITHOUT |
|
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
15 for more details. |
|
16 |
|
17 You should have received a copy of the GNU General Public License |
|
18 along with Octave; see the file COPYING. If not, write to the Free |
1315
|
19 Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
3
|
20 |
|
21 */ |
|
22 |
382
|
23 #if !defined (octave_FEGrid_h) |
|
24 #define octave_FEGrid_h 1 |
|
25 |
3503
|
26 #include <iostream> |
465
|
27 |
|
28 #include "dColVector.h" |
384
|
29 |
1867
|
30 class |
|
31 FEGrid |
3
|
32 { |
|
33 public: |
|
34 |
1867
|
35 FEGrid (void) |
|
36 : elem () { } |
|
37 |
|
38 FEGrid (const ColumnVector& elbnds) |
|
39 : elem (elbnds) { check_grid (); } |
|
40 |
5275
|
41 FEGrid (octave_idx_type nel, double width); |
1867
|
42 |
5275
|
43 FEGrid (octave_idx_type nel, double left, double right); |
3
|
44 |
1867
|
45 FEGrid (const FEGrid& a) |
|
46 : elem (a.elem) { } |
|
47 |
|
48 FEGrid& operator = (const FEGrid& a) |
|
49 { |
|
50 if (this != &a) |
|
51 elem = a.elem; |
|
52 |
|
53 return *this; |
|
54 } |
|
55 |
|
56 ~FEGrid (void) { } |
|
57 |
5275
|
58 octave_idx_type element (double x) const; |
3
|
59 |
1321
|
60 double left (void) const { return elem.elem (0); } |
1867
|
61 |
1321
|
62 double right (void) const { return elem.elem (elem.capacity () - 1); } |
3
|
63 |
1528
|
64 int in_bounds (double x) const { return (x >= left () && x <= right ()); } |
1321
|
65 |
1528
|
66 ColumnVector element_boundaries (void) const { return elem; } |
3
|
67 |
3504
|
68 friend std::ostream& operator << (std::ostream&, const FEGrid&); |
3
|
69 |
|
70 protected: |
|
71 |
1528
|
72 ColumnVector elem; |
1867
|
73 |
|
74 private: |
|
75 |
|
76 void error (const char* msg) const; |
|
77 void nel_error (void) const; |
|
78 |
|
79 void check_grid (void) const; |
3
|
80 }; |
|
81 |
|
82 #endif |
|
83 |
|
84 /* |
|
85 ;;; Local Variables: *** |
|
86 ;;; mode: C++ *** |
|
87 ;;; End: *** |
|
88 */ |