00001 /* 00002 * Copyright (c) 1999-2003 Bert Kampes 00003 * Copyright (c) 1999-2003 Delft University of Technology, The Netherlands 00004 * 00005 * This file is part of Doris, the Delft o-o radar interferometric software. 00006 * 00007 * Doris program is free software; you can redistribute it and/or modify 00008 * it under the terms of the GNU General Public License as published by 00009 * the Free Software Foundation; either version 2 of the License, or 00010 * (at your option) any later version. 00011 * 00012 * Doris is distributed in the hope that it will be useful, 00013 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00015 * GNU General Public License for more details. 00016 * 00017 * You should have received a copy of the GNU General Public License 00018 * along with this program; if not, write to the Free Software 00019 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00020 * 00021 * Publications that contain results produced by the Doris software should 00022 * contain an acknowledgment. (For example: The interferometric processing 00023 * was performed using the freely available Doris software package developed 00024 * by the Delft Institute for Earth-Oriented Space Research (DEOS), Delft 00025 * University of Technology, or include a reference to: Bert Kampes and 00026 * Stefania Usai. \"Doris: The Delft Object-oriented Radar Interferometric 00027 * software.\" In: proceedings 2nd ITC ORS symposium, August 1999. (cdrom)). 00028 * 00029 */ 00030 /**************************************************************** 00031 * $Source: /users/kampes/DEVELOP/DORIS/doris/src/RCS/ioroutines.hh,v $ 00032 * $Revision: 3.8 $ 00033 * $Date: 2005/03/07 10:38:40 $ 00034 * $Author: kampes $ 00035 * 00036 * Definitions of general input/output routines. 00037 ****************************************************************/ 00038 /**************************************************************** 00039 * Note that the strstream class using a buffer and stream output memory 00040 * can be replaced by the following construction (BK, april 2003): 00041 * ----------------------------------------------------- 00042 * static ostringstream message; 00043 * message << "Hi Bert. " << 1.1 << ends; 00044 * cout << "message.str(): " << message.str() << "\n"; 00045 * message.str(string());// empty buffer 00046 * ----------------------------------------------------- 00047 ****************************************************************/ 00048 00049 00050 #ifndef IOROUTINES_H 00051 #define IOROUTINES_H 00052 00053 #include "constants.hh" // global ONE27, inputstructs etc. 00054 #include "readinput.hh" // input structs 00055 #include "matrixbk.hh" // my matrix class 00056 #include "slcimage.hh" // my slc image class 00057 #include "productinfo.hh" // my 'products' class 00058 00059 #include <cstdlib> // exit 00060 00061 00062 00063 // // ====== Prototypes and inlined functions ====== 00064 // ______ Screenoutput ______ 00065 void printcpu(bool init=false); // prototype 00066 00067 00068 // ====== Prototypes ====== 00069 // ______ Initialization ______ 00070 void inittest(); // Some initial tests 00071 00072 00073 // ______ Find out if initwrite is necessary ______ 00074 bool doinitwrite( 00075 input_gen &generalinput, 00076 int16 imageid); 00077 00078 00079 // ______ Write initial data to files ______ 00080 // ______ id=1: logfile, 2:master result, 3: slaveresult ______ 00081 void initwrite( 00082 const char* file, 00083 int16 fileid); 00084 00085 00086 // ______ Append filein to fileout and remove in ______ 00087 void updatefile( 00088 const char* filein, 00089 const char* fileout); 00090 00091 00092 // ______ Search file for result and return that ______ 00093 bool readres( 00094 char* returnword, 00095 const int16 sizeofreturnword, 00096 const char* file, 00097 const char* patern, 00098 const int16 napatern=0); 00099 00100 00101 // ______ Read coefficients from resultfile ______ 00102 matrix<real8> readcoeff( 00103 const char* file, 00104 const char* pattern, 00105 const int16 Ncoefficients); 00106 00107 00108 // ______ Updates process_control in resultfiles ______ 00109 void updateprocesscontrol( 00110 const char* filein, 00111 int16 fileid); 00112 00113 00114 // ______ Check if only ones results per step ______ 00115 void checkprocessing( 00116 const input_gen &generalinput, 00117 int16 alreadyprocessed[NUMPROCESSES]); 00118 00119 00120 // ______ Check if requested processing is logical ______ 00121 void checkrequest( 00122 int16 step, 00123 int16 alreadyprocess[NUMPROCESSES], ...); 00124 00125 00126 // ______ Check if process control flags are written correctly _____ 00127 void fillcheckprocess( 00128 const char *line, 00129 int16 checkprocess[NUMPROCESSES], 00130 int16 fileid); 00131 00132 00133 // ______ Fill array what is already processed ______ 00134 void fillprocessed( 00135 const char *line, 00136 int16 checkprocess[NUMPROCESSES], 00137 int16 fileid); 00138 00139 00140 // ______ Removes data section from resultfile ______ 00141 void removedatleader( 00142 const char *file); 00143 00144 00145 // ______ True if file existed ______ 00146 bool existed( 00147 const char *file); 00148 00149 00150 // ______ Returns filesize ______ 00151 uint filesize( 00152 const char *file); 00153 00154 00155 // ______ Count number of eols ______ 00156 int32 filelines( 00157 const char *file); 00158 00159 00160 // ______ Pause for interactive processing ______ 00161 void getanswer( 00162 ); 00163 00164 00165 // ______ Open an input file stream ______ 00166 void openfstream( 00167 ifstream &str, 00168 const char* ifilename); 00169 00170 00171 // ______ Open an output file stream ______ 00172 void openfstream( 00173 ofstream &str, 00174 const char* ofilename, 00175 const bool overwrit); 00176 00177 00178 // ______ Check if file is opened correctly ______ 00179 void bk_assert( 00180 const ifstream &str, 00181 const char* ifilename, 00182 const char* callingfilename = "?", 00183 int32 linenumber = 0); 00184 00185 00186 // ______ Check if file is opened correctly ______ 00187 void bk_assert( 00188 const ofstream &str, 00189 const char* ofilename, 00190 const char* callingfilename = "?", 00191 int32 linenumber = 0); 00192 00193 00194 // _____ Convert a string to lower/upper case ______ 00195 void tolower(char *s); 00196 void toupper(char *s); 00197 00198 00199 00200 00201 // // ______ (partially) Fills struct image/inter-info ______ 00202 // void fillslcimage( 00203 // slcimage &image, 00204 // const char *file); 00205 00206 00207 // // ______ Struct slcimage: update it after certain step ______ 00208 // void updateslcimage( 00209 // slcimage &image, 00210 // const char *file, 00211 // const char *iden); 00212 00213 00214 // ______ Fill struct interferogram info ______ 00215 //void fillproductinfo( 00216 // productinfo &interferogram, 00217 00218 // ______ compute overlap in same system ______ 00219 window getoverlap( 00220 const window &master, 00221 const window &slave); 00222 00223 // compute overlap approx with transf. polynomial between slave2master coord.system 00224 window getoverlap( 00225 const slcimage &master, 00226 const slcimage &slave, 00227 const matrix<real8> &cpmL, 00228 const matrix<real8> &cpmP); 00229 00230 00231 // // ______ Struct productinfo: fill info after certain step ______ 00232 // void fillproductinfo( 00233 // productinfo &interferogram, 00234 // const char *file, 00235 // const char *iden); 00236 00237 00238 00239 00240 #endif // IOROUTINES_H 00241 00242 00243