3
|
1 // FEGrid.h -*- C++ -*- |
|
2 /* |
|
3 |
1011
|
4 Copyright (C) 1992, 1993, 1994, 1995 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 |
3
|
35 #ifndef Vector |
|
36 #define Vector ColumnVector |
|
37 #endif |
|
38 |
|
39 class FEGrid |
|
40 { |
|
41 public: |
|
42 |
|
43 FEGrid (void); |
|
44 FEGrid (const Vector& elbnds); |
|
45 FEGrid (int nel, double width); |
|
46 FEGrid (int nel, double left, double right); |
|
47 |
|
48 int in_bounds (double x) const; |
|
49 |
|
50 int element (double x) const; |
|
51 |
|
52 double left (void) const; |
|
53 double right (void) const; |
|
54 |
|
55 Vector element_boundaries (void) const; |
|
56 |
|
57 friend ostream& operator << (ostream&, const FEGrid&); |
|
58 |
|
59 protected: |
|
60 |
|
61 Vector elem; |
|
62 |
|
63 private: |
|
64 |
|
65 void error (const char* msg) const; |
|
66 void nel_error (void) const; |
|
67 |
|
68 void check_grid (void) const; |
|
69 }; |
|
70 |
|
71 inline FEGrid::FEGrid (void) {} |
|
72 |
|
73 inline FEGrid::FEGrid (const Vector& elbnds) |
|
74 { elem = elbnds; check_grid (); } |
|
75 |
|
76 inline int FEGrid::in_bounds (double x) const |
|
77 { return (x >= left () && x <= right ()); } |
|
78 |
|
79 inline double FEGrid::left (void) const |
|
80 { return elem.elem (0); } |
|
81 |
|
82 inline double FEGrid::right (void) const |
|
83 { return elem.elem (elem.capacity () - 1); } |
|
84 |
|
85 inline Vector FEGrid::element_boundaries (void) const |
|
86 { return elem; } |
|
87 |
|
88 #endif |
|
89 |
|
90 /* |
|
91 ;;; Local Variables: *** |
|
92 ;;; mode: C++ *** |
|
93 ;;; page-delimiter: "^/\\*" *** |
|
94 ;;; End: *** |
|
95 */ |