00001 // SuperMix version 1.0 C++ source file 00002 // 00003 // Copyright (c) 1999 California Institute of Technology. 00004 // All rights reserved. 00005 // 00006 // Redistribution and use in source and binary forms for noncommercial 00007 // purposes are permitted provided that the above copyright notice and 00008 // this paragraph are duplicated in all such forms and that any 00009 // documentation and other materials related to such distribution and 00010 // use acknowledge that the software was developed by California 00011 // Institute of Technology. Redistribution and/or use in source or 00012 // binary forms is not permitted for any commercial purpose. Use of 00013 // this software does not include a permitted use of the Institute's 00014 // name or trademark for any purpose. 00015 // 00016 // DISCLAIMER: 00017 // THIS SOFTWARE AND/OR RELATED MATERIALS ARE PROVIDED "AS-IS" WITHOUT 00018 // WARRANTY OF ANY KIND INCLUDING ANY WARRANTIES OF PERFORMANCE OR 00019 // MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE OR PURPOSE (AS SET 00020 // FORTH IN UCC 23212-2313) OR FOR ANY PURPOSE WHATSOEVER, FOR THE 00021 // LICENSED PRODUCT, HOWEVER USED. IN NO EVENT SHALL CALTECH/JPL BE 00022 // LIABLE FOR ANY DAMAGES AND/OR COSTS, INCLUDING BUT NOT LIMITED TO 00023 // INCIDENTAL OR CONSEQUENTIAL DAMAGES OF ANY KIND, INCLUDING ECONOMIC 00024 // DAMAGE OR INJURY TO PROPERTY AND LOST PROFITS, REGARDLESS OF 00025 // WHETHER CALTECH/JPL SHALL BE ADVISED, HAVE REASON TO KNOW, OR IN 00026 // FACT SHALL KNOW OF THE POSSIBILITY. THE USER BEARS ALL RISK 00027 // RELATING TO QUALITY AND PERFORMANCE OF THE SOFTWARE AND/OR RELATED 00028 // MATERIALS. 00029 // 00030 /**************************************************************\ 00031 * * 00032 * datafile.h * 00033 * * 00034 * J. Zmuidzinas October 31, 1997 * 00035 * * 00036 * datafile.h contains the declaration for the data file class * 00037 * used by the circuit program. A data file is essentially just * 00038 * a set of columns of floating-point numbers. Comments may be * 00039 * included - all characters following a ! or # character are * 00040 * treated as a comment and are thrown away. * 00041 * * 00042 * NOTE THE ORDER IN DATA ACCESS: * 00043 * read(column#, line#) * 00044 * where column#, row# refer to the position in the file * 00045 * * 00046 * Data are stored in the private real_table in this * 00047 * order; however, the first index of a table is usually called * 00048 * the "row" index and the second index is called the * 00049 * "column" index. * 00050 * * 00051 * 1/19/99: Fixed the file name arguments (added const) * 00052 * 2/5/98: Added member fcn table() to allow direct data * 00053 * access (FR) * 00054 * * 00055 \**************************************************************/ 00056 00057 #ifndef DATAFILE_H 00058 #define DATAFILE_H 1 00059 00060 #include "table.h" 00061 00062 /**************************************************************\ 00063 * * 00064 * class datafile * 00065 * * 00066 \**************************************************************/ 00067 class datafile 00068 { 00069 private: 00070 static const unsigned int maxline ; // maximum number of characters per line 00071 int ncolumns ; // number of columns in data file 00072 int nlines ; // number of lines 00073 real_table data ; // this is where we hold the data 00074 00075 // 00076 // declare a little structure to hold the data temporarily 00077 // 00078 class tempnumber { 00079 public: 00080 int icol ; 00081 int iline ; 00082 double value ; 00083 tempnumber *next ; 00084 }; 00085 00086 public: 00087 // No default constructor is provided, since the file name must be specified 00088 datafile(char const * const filename) ; 00089 00090 // Copy constructor 00091 datafile(const datafile & df) ; 00092 00093 // Assignment operator - change to const argument once table is fixed--fixed 00094 datafile & operator=(const datafile & df); 00095 00096 // Data retrieval - we can let table class do bounds checking 00097 double read(int col, int line) const 00098 { return data.read(col, line); } 00099 00100 int numcolumns() const {return ncolumns;} 00101 int numlines() const {return nlines;} 00102 00103 // Return a pointer to the internal table; to allow copying 00104 const real_table * table() const {return & data; } 00105 00106 }; 00107 00108 #endif /* DATAFILE_H */
Please direct comments and corrections to
supermix@submm.caltech.edu
Go to the supermix home page
Generated by
1.2.7