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      <rdeters@uiuc.edu>
28                Michael Selig      <m-selig@uiuc.edu>
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 
check_float(const string & token)71 bool check_float( const string &token)
72 {
73   float value;
74   istringstream stream(token.c_str());
75   return !((stream >> value).fail());
76 }
77 
d_2_to_3(double array2D[100][100],double array3D[][100][100],int index3D)78 void d_2_to_3( double array2D[100][100], double array3D[][100][100], int index3D)
79 {
80   for (int i=0; i<=99; i++)
81     {
82       for (int j=1; j<=99; j++)
83         {
84           array3D[index3D][i][j]=array2D[i][j];
85         }
86     }
87 }
88 
d_1_to_2(double array1D[100],double array2D[][100],int index2D)89 void d_1_to_2( double array1D[100], double array2D[][100], int index2D)
90 {
91   for (int i=0; i<=99; i++)
92     {
93       array2D[index2D][i]=array1D[i];
94     }
95 }
96 
d_1_to_1(double array1[100],double array2[100])97 void d_1_to_1( double array1[100], double array2[100] )
98 {
99   for (int i=0; i<=99; i++)
100     {
101       array2[i]=array1[i];
102     }
103 }
104 
i_1_to_2(int array1D[100],int array2D[][100],int index2D)105 void i_1_to_2( int array1D[100], int array2D[][100], int index2D)
106 {
107   for (int i=0; i<=99; i++)
108     {
109       array2D[index2D][i]=array1D[i];
110     }
111 }
112