3
|
1 // FEGrid.h -*- C++ -*- |
|
2 /* |
|
3 |
382
|
4 Copyright (C) 1992, 1993, 1994 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 |
|
20 Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. |
|
21 |
|
22 */ |
|
23 |
382
|
24 #if !defined (octave_FEGrid_h) |
|
25 #define octave_FEGrid_h 1 |
|
26 |
465
|
27 #if defined (__GNUG__) |
|
28 #pragma interface |
|
29 #endif |
|
30 |
|
31 class ostream; |
|
32 |
|
33 #include "dColVector.h" |
384
|
34 |
382
|
35 extern "C++" { |
3
|
36 |
|
37 #ifndef Vector |
|
38 #define Vector ColumnVector |
|
39 #endif |
|
40 |
|
41 class FEGrid |
|
42 { |
|
43 public: |
|
44 |
|
45 FEGrid (void); |
|
46 FEGrid (const Vector& elbnds); |
|
47 FEGrid (int nel, double width); |
|
48 FEGrid (int nel, double left, double right); |
|
49 |
|
50 int in_bounds (double x) const; |
|
51 |
|
52 int element (double x) const; |
|
53 |
|
54 double left (void) const; |
|
55 double right (void) const; |
|
56 |
|
57 Vector element_boundaries (void) const; |
|
58 |
|
59 friend ostream& operator << (ostream&, const FEGrid&); |
|
60 |
|
61 protected: |
|
62 |
|
63 Vector elem; |
|
64 |
|
65 private: |
|
66 |
|
67 void error (const char* msg) const; |
|
68 void nel_error (void) const; |
|
69 |
|
70 void check_grid (void) const; |
|
71 }; |
|
72 |
|
73 inline FEGrid::FEGrid (void) {} |
|
74 |
|
75 inline FEGrid::FEGrid (const Vector& elbnds) |
|
76 { elem = elbnds; check_grid (); } |
|
77 |
|
78 inline int FEGrid::in_bounds (double x) const |
|
79 { return (x >= left () && x <= right ()); } |
|
80 |
|
81 inline double FEGrid::left (void) const |
|
82 { return elem.elem (0); } |
|
83 |
|
84 inline double FEGrid::right (void) const |
|
85 { return elem.elem (elem.capacity () - 1); } |
|
86 |
|
87 inline Vector FEGrid::element_boundaries (void) const |
|
88 { return elem; } |
|
89 |
382
|
90 } // extern "C++" |
|
91 |
3
|
92 #endif |
|
93 |
|
94 /* |
|
95 ;;; Local Variables: *** |
|
96 ;;; mode: C++ *** |
|
97 ;;; page-delimiter: "^/\\*" *** |
|
98 ;;; End: *** |
|
99 */ |