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