| 1 |
/********************************************************************** |
| 2 |
|
| 3 |
FILENAME: uiuc_menu_functions.cpp |
| 4 |
|
| 5 |
---------------------------------------------------------------------- |
| 6 |
|
| 7 |
DESCRIPTION: provides common functions used by different menu |
| 8 |
routines |
| 9 |
|
| 10 |
---------------------------------------------------------------------- |
| 11 |
|
| 12 |
STATUS: alpha version |
| 13 |
|
| 14 |
---------------------------------------------------------------------- |
| 15 |
|
| 16 |
REFERENCES: |
| 17 |
|
| 18 |
---------------------------------------------------------------------- |
| 19 |
|
| 20 |
HISTORY: 04/04/2003 initial release |
| 21 |
06/30/2003 (RD) replaced istrstream with istringstream |
| 22 |
to get rid of the annoying warning about |
| 23 |
using the strstream header |
| 24 |
|
| 25 |
---------------------------------------------------------------------- |
| 26 |
|
| 27 |
AUTHOR(S): Robert Deters <[email protected]> |
| 28 |
Michael Selig <[email protected]> |
| 29 |
|
| 30 |
---------------------------------------------------------------------- |
| 31 |
|
| 32 |
VARIABLES: |
| 33 |
|
| 34 |
---------------------------------------------------------------------- |
| 35 |
|
| 36 |
INPUTS: n/a |
| 37 |
|
| 38 |
---------------------------------------------------------------------- |
| 39 |
|
| 40 |
OUTPUTS: n/a |
| 41 |
|
| 42 |
---------------------------------------------------------------------- |
| 43 |
|
| 44 |
CALLED BY: uiuc_menu_XX() |
| 45 |
|
| 46 |
---------------------------------------------------------------------- |
| 47 |
|
| 48 |
CALLS TO: |
| 49 |
|
| 50 |
---------------------------------------------------------------------- |
| 51 |
|
| 52 |
COPYRIGHT: (C) 2003 by Michael Selig |
| 53 |
|
| 54 |
This program is free software; you can redistribute it and/or |
| 55 |
modify it under the terms of the GNU General Public License |
| 56 |
as published by the Free Software Foundation. |
| 57 |
|
| 58 |
This program is distributed in the hope that it will be useful, |
| 59 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 60 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 61 |
GNU General Public License for more details. |
| 62 |
|
| 63 |
You should have received a copy of the GNU General Public License |
| 64 |
along with this program; if not, write to the Free Software |
| 65 |
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
| 66 |
|
| 67 |
**********************************************************************/ |
| 68 |
|
| 69 |
#include "uiuc_menu_functions.h" |
| 70 |
|
| 71 |
|
| 72 |
bool check_float( const std::string &token) |
| 73 |
{ |
| 74 |
float value; |
| 75 |
std::istringstream stream(token.c_str()); |
| 76 |
return !((stream >> value).fail()); |
| 77 |
} |
| 78 |
|
| 79 |
void d_2_to_3( double array2D[100][100], double array3D[][100][100], int index3D) |
| 80 |
{ |
| 81 |
for (int i=0; i<=99; i++) |
| 82 |
{ |
| 83 |
for (int j=1; j<=99; j++) |
| 84 |
{ |
| 85 |
array3D[index3D][i][j]=array2D[i][j]; |
| 86 |
} |
| 87 |
} |
| 88 |
} |
| 89 |
|
| 90 |
void d_1_to_2( double array1D[100], double array2D[][100], int index2D) |
| 91 |
{ |
| 92 |
for (int i=0; i<=99; i++) |
| 93 |
{ |
| 94 |
array2D[index2D][i]=array1D[i]; |
| 95 |
} |
| 96 |
} |
| 97 |
|
| 98 |
void d_1_to_1( double array1[100], double array2[100] ) |
| 99 |
{ |
| 100 |
for (int i=0; i<=99; i++) |
| 101 |
{ |
| 102 |
array2[i]=array1[i]; |
| 103 |
} |
| 104 |
} |
| 105 |
|
| 106 |
void i_1_to_2( int array1D[100], int array2D[][100], int index2D) |
| 107 |
{ |
| 108 |
for (int i=0; i<=99; i++) |
| 109 |
{ |
| 110 |
array2D[index2D][i]=array1D[i]; |
| 111 |
} |
| 112 |
} |