Geant4 Cross Reference |
1 // 1 // 2 // ******************************************* 2 // ******************************************************************** 3 // * License and Disclaimer << 3 // * DISCLAIMER * 4 // * 4 // * * 5 // * The Geant4 software is copyright of th << 5 // * The following disclaimer summarizes all the specific disclaimers * 6 // * the Geant4 Collaboration. It is provided << 6 // * of contributors to this software. The specific disclaimers,which * 7 // * conditions of the Geant4 Software License << 7 // * govern, are listed with their locations in: * 8 // * LICENSE and available at http://cern.ch/ << 8 // * http://cern.ch/geant4/license * 9 // * include a list of copyright holders. << 10 // * 9 // * * 11 // * Neither the authors of this software syst 10 // * Neither the authors of this software system, nor their employing * 12 // * institutes,nor the agencies providing fin 11 // * institutes,nor the agencies providing financial support for this * 13 // * work make any representation or warran 12 // * work make any representation or warranty, express or implied, * 14 // * regarding this software system or assum 13 // * regarding this software system or assume any liability for its * 15 // * use. Please see the license in the file << 14 // * use. * 16 // * for the full disclaimer and the limitatio << 17 // * 15 // * * 18 // * This code implementation is the result << 16 // * This code implementation is the intellectual property of the * 19 // * technical work of the GEANT4 collaboratio << 17 // * GEANT4 collaboration. * 20 // * By using, copying, modifying or distri << 18 // * By copying, distributing or modifying the Program (or any work * 21 // * any work based on the software) you ag << 19 // * based on the Program) you indicate your acceptance of this * 22 // * use in resulting scientific publicati << 20 // * statement, and all its terms. * 23 // * acceptance of all terms of the Geant4 Sof << 24 // ******************************************* 21 // ******************************************************************** 25 // 22 // 26 //-------------------------------------------- 23 //-------------------------------------------------------------------------- 27 // File and Version Information: 24 // File and Version Information: >> 25 // $Id: G4HepRepFileXMLWriter.cc,v 1.1 2003/07/12 19:48:15 duns Exp $ 28 // 26 // 29 // Description: 27 // Description: 30 // Create a HepRep XML File (HepRep version 1 28 // Create a HepRep XML File (HepRep version 1). 31 // 29 // 32 // Environment: 30 // Environment: 33 // Software developed for the general High En 31 // Software developed for the general High Energy Physics community. 34 // 32 // 35 // Author : 33 // Author : 36 // J. Perl Original A 34 // J. Perl Original Author 37 // 35 // 38 // Copyright Information: 36 // Copyright Information: 39 // Copyright (C) 2001 Stanford L 37 // Copyright (C) 2001 Stanford Linear Accelerator Center 40 //-------------------------------------------- 38 //------------------------------------------------------------------------ 41 39 42 #include "G4HepRepFileXMLWriter.hh" 40 #include "G4HepRepFileXMLWriter.hh" 43 41 44 #include "G4HepRepMessenger.hh" << 45 #include "G4ios.hh" 42 #include "G4ios.hh" 46 43 47 G4HepRepFileXMLWriter::G4HepRepFileXMLWriter() 44 G4HepRepFileXMLWriter::G4HepRepFileXMLWriter() 48 { 45 { 49 isOpen = false; 46 isOpen = false; 50 init(); 47 init(); 51 } 48 } 52 49 53 void G4HepRepFileXMLWriter::init() 50 void G4HepRepFileXMLWriter::init() 54 { 51 { 55 typeDepth = -1; 52 typeDepth = -1; 56 53 57 int i = -1; 54 int i = -1; 58 while(i++ < 49) << 55 while (i++<49) { 59 { << 60 prevTypeName[i] = new char[1]; 56 prevTypeName[i] = new char[1]; 61 strcpy(prevTypeName[i], ""); << 57 strcpy(prevTypeName[i],""); 62 58 63 inType[i] = false; << 59 inType[i] = false; 64 inInstance[i] = false; 60 inInstance[i] = false; 65 } 61 } 66 62 67 inPrimitive = false; 63 inPrimitive = false; 68 inPoint = false; << 64 inPoint = false; 69 } 65 } 70 66 71 void G4HepRepFileXMLWriter::addType(const char << 67 void G4HepRepFileXMLWriter::addType(const char* name,int newTypeDepth) 72 { 68 { 73 if(fout.good()) << 69 if (fout.good()) 74 { 70 { 75 // Flatten structure if it exceeds maximum 71 // Flatten structure if it exceeds maximum allowed typeDepth of 49. 76 if(newTypeDepth > 49) << 72 if (newTypeDepth > 49) 77 newTypeDepth = 49; 73 newTypeDepth = 49; 78 74 79 if(newTypeDepth < 0) << 75 if (newTypeDepth < 0) 80 newTypeDepth = 0; 76 newTypeDepth = 0; 81 77 82 // Insert any layers that are missing from 78 // Insert any layers that are missing from the hierarchy (protects against 83 // callers that skip from, say, layer 1 to 79 // callers that skip from, say, layer 1 to layer 3 with no layer 2). 84 while(typeDepth < (newTypeDepth - 1)) << 80 while (typeDepth < (newTypeDepth-1)) { 85 { << 86 addType("Layer Inserted by G4HepRepFileX 81 addType("Layer Inserted by G4HepRepFileXMLWriter", typeDepth + 1); 87 addInstance(); 82 addInstance(); 88 } 83 } 89 84 90 // If moving closer to the root, close pre 85 // If moving closer to the root, close previously open types. 91 while(newTypeDepth < typeDepth) << 86 while (newTypeDepth<typeDepth) 92 endType(); 87 endType(); 93 88 94 // Close any remaining primitives of the c 89 // Close any remaining primitives of the current instance. 95 endPrimitive(); 90 endPrimitive(); 96 91 97 // If this is a new type name for the curr 92 // If this is a new type name for the current depth, declare the 98 // new Type. Otherwise, it is just anothe 93 // new Type. Otherwise, it is just another Instance of the current Type. 99 if(strcmp(name, prevTypeName[newTypeDepth] << 94 if (strcmp(name,prevTypeName[newTypeDepth])!=0) 100 { 95 { 101 if(inType[newTypeDepth]) << 96 if (inType[newTypeDepth]) 102 endType(); << 97 endType(); 103 98 104 prevTypeName[newTypeDepth] = new char[st << 99 prevTypeName[newTypeDepth] = new char[strlen(name)+1]; 105 strcpy(prevTypeName[newTypeDepth], name) << 100 strcpy(prevTypeName[newTypeDepth],name); 106 101 107 inType[newTypeDepth] = true; 102 inType[newTypeDepth] = true; 108 indent(); 103 indent(); 109 fout << "<heprep:type version=\"null\" n 104 fout << "<heprep:type version=\"null\" name=\"" << name << "\">" 110 << G4endl; << 105 << G4endl; 111 106 112 typeDepth = newTypeDepth; 107 typeDepth = newTypeDepth; 113 } 108 } 114 } << 109 } else { 115 else << 116 { << 117 #ifdef G4HEPREPFILEDEBUG 110 #ifdef G4HEPREPFILEDEBUG 118 G4cout << "G4HepRepFileXMLWriter:addType N << 111 G4cout << "G4HepRepFileXMLWriter:addType No file is currently open." << G4endl; 119 << G4endl; << 120 #endif 112 #endif 121 } 113 } 122 } 114 } 123 115 124 void G4HepRepFileXMLWriter::addInstance() 116 void G4HepRepFileXMLWriter::addInstance() 125 { 117 { 126 if(fout.good()) << 118 if (fout.good()) 127 { 119 { 128 if(inType[typeDepth]) << 120 if (inType[typeDepth]) 129 { 121 { 130 endInstance(); 122 endInstance(); 131 inInstance[typeDepth] = true; 123 inInstance[typeDepth] = true; 132 indent(); 124 indent(); 133 fout << "<heprep:instance>" << G4endl; 125 fout << "<heprep:instance>" << G4endl; 134 } << 126 } else { 135 else << 136 { << 137 #ifdef G4HEPREPFILEDEBUG 127 #ifdef G4HEPREPFILEDEBUG 138 G4cout << 128 G4cout << "G4HepRepFileXMLWriter:addInstance No HepRep Type is currently open" << G4endl; 139 << "G4HepRepFileXMLWriter:addInstance << 140 << G4endl; << 141 #endif 129 #endif 142 } 130 } 143 } << 131 } else { 144 else << 145 { << 146 #ifdef G4HEPREPFILEDEBUG 132 #ifdef G4HEPREPFILEDEBUG 147 G4cout << "G4HepRepFileXMLWriter:addInstan << 133 G4cout << "G4HepRepFileXMLWriter:addInstance No file is currently open" << G4endl; 148 << G4endl; << 149 #endif 134 #endif 150 } 135 } 151 } 136 } 152 137 153 void G4HepRepFileXMLWriter::addPrimitive() 138 void G4HepRepFileXMLWriter::addPrimitive() 154 { 139 { 155 if(fout.good()) << 140 if (fout.good()) 156 { 141 { 157 if(inInstance[typeDepth]) << 142 if (inInstance[typeDepth]) 158 { 143 { 159 endPrimitive(); 144 endPrimitive(); 160 inPrimitive = true; 145 inPrimitive = true; 161 indent(); 146 indent(); 162 fout << "<heprep:primitive>" << G4endl; 147 fout << "<heprep:primitive>" << G4endl; 163 } << 148 } else { 164 else << 165 { << 166 #ifdef G4HEPREPFILEDEBUG 149 #ifdef G4HEPREPFILEDEBUG 167 G4cout << "G4HepRepFileXMLWriter:addPrim << 150 G4cout << "G4HepRepFileXMLWriter:addPrimitive No HepRep Instance is currently open" << G4endl; 168 "currently open" << 169 << G4endl; << 170 #endif 151 #endif 171 } 152 } 172 } << 153 } else { 173 else << 174 { << 175 #ifdef G4HEPREPFILEDEBUG 154 #ifdef G4HEPREPFILEDEBUG 176 G4cout << "G4HepRepFileXMLWriter:addPrimit << 155 G4cout << "G4HepRepFileXMLWriter:addPrimitive No file is currently open" << G4endl; 177 << G4endl; << 178 #endif 156 #endif 179 } 157 } 180 } 158 } 181 159 182 void G4HepRepFileXMLWriter::addPoint(double x, 160 void G4HepRepFileXMLWriter::addPoint(double x, double y, double z) 183 { 161 { 184 if(fout.good()) << 162 if (fout.good()) 185 { 163 { 186 if(inPrimitive) << 164 if (inPrimitive) 187 { 165 { 188 endPoint(); 166 endPoint(); 189 inPoint = true; 167 inPoint = true; 190 indent(); 168 indent(); 191 << 169 fout << "<heprep:point x=\"" << x << "\" y=\"" << y << "\" z=\"" << z << "\">" << G4endl; 192 // Include scale and center values << 170 } else { 193 G4HepRepMessenger* messenger = G4HepRepM << 194 G4double scale = messenger << 195 G4ThreeVector center = messenger << 196 G4double xNew = scale * ( << 197 G4double yNew = scale * ( << 198 G4double zNew = scale * ( << 199 << 200 fout << "<heprep:point x=\"" << xNew << << 201 << zNew << "\">" << G4endl; << 202 } << 203 else << 204 { << 205 #ifdef G4HEPREPFILEDEBUG 171 #ifdef G4HEPREPFILEDEBUG 206 G4cout << "G4HepRepFileXMLWriter:addPoin << 172 G4cout << "G4HepRepFileXMLWriter:addPoint No HepRep Primitive is currently open" << G4endl; 207 "currently open" << 208 << G4endl; << 209 #endif 173 #endif 210 } 174 } 211 } << 175 } else { 212 else << 213 { << 214 #ifdef G4HEPREPFILEDEBUG 176 #ifdef G4HEPREPFILEDEBUG 215 G4cout << "G4HepRepFileXMLWriter:addPoint << 177 G4cout << "G4HepRepFileXMLWriter:addPoint No file is currently open" << G4endl; 216 << G4endl; << 217 #endif 178 #endif 218 } 179 } 219 } 180 } 220 181 221 void G4HepRepFileXMLWriter::addAttDef(const ch << 182 void G4HepRepFileXMLWriter::addAttDef(const char* name, 222 const ch << 183 const char* desc, >> 184 const char* type, >> 185 const char* extra) 223 { 186 { 224 if(fout.good()) << 187 if (fout.good()) 225 { 188 { 226 indent(); 189 indent(); 227 fout << " <heprep:attdef extra=\"" << ext << 190 fout << " <heprep:attdef extra=\"" << extra << "\" name=\"" << name << "\" type=\"" << type << "\"" << G4endl; 228 << "\" type=\"" << type << "\"" << G4 << 229 indent(); 191 indent(); 230 fout << " desc=\"" << desc << "\"/>" << G 192 fout << " desc=\"" << desc << "\"/>" << G4endl; 231 } << 193 } else { 232 else << 233 { << 234 #ifdef G4HEPREPFILEDEBUG 194 #ifdef G4HEPREPFILEDEBUG 235 G4cout << "G4HepRepFileXMLWriter:addAttDef << 195 G4cout << "G4HepRepFileXMLWriter:addAttDef No file is currently open" << G4endl; 236 << G4endl; << 237 #endif 196 #endif 238 } 197 } 239 } 198 } 240 199 241 // Four methods to fill attValues 200 // Four methods to fill attValues 242 void G4HepRepFileXMLWriter::addAttValue(const << 201 void G4HepRepFileXMLWriter::addAttValue (const char* name, >> 202 const char* value) 243 { 203 { 244 if(fout.good()) << 204 if (fout.good()) 245 { 205 { 246 indent(); 206 indent(); 247 fout << " <heprep:attvalue showLabel=\"NO << 207 fout << " <heprep:attvalue showLabel=\"NONE\" name=\"" << name << "\"" << G4endl; 248 << G4endl; << 249 indent(); 208 indent(); 250 fout << " value=\"" << value << "\"/>" 209 fout << " value=\"" << value << "\"/>" << G4endl; 251 } << 210 } else { 252 else << 253 { << 254 #ifdef G4HEPREPFILEDEBUG 211 #ifdef G4HEPREPFILEDEBUG 255 G4cout << "G4HepRepFileXMLWriter:addAttVal << 212 G4cout << "G4HepRepFileXMLWriter:addAttValue No file is currently open" << G4endl; 256 << G4endl; << 257 #endif 213 #endif 258 } 214 } 259 } 215 } 260 216 261 void G4HepRepFileXMLWriter::addAttValue(const << 217 void G4HepRepFileXMLWriter::addAttValue (const char* name, >> 218 double value) 262 { 219 { 263 if(fout.good()) << 220 if (fout.good()) 264 { 221 { 265 indent(); 222 indent(); 266 fout << " <heprep:attvalue showLabel=\"NO << 223 fout << " <heprep:attvalue showLabel=\"NONE\" name=\"" << name << "\"" << G4endl; 267 << G4endl; << 268 indent(); 224 indent(); 269 fout << " value=\"" << value << "\"/>" 225 fout << " value=\"" << value << "\"/>" << G4endl; 270 } << 226 } else { 271 else << 272 { << 273 #ifdef G4HEPREPFILEDEBUG 227 #ifdef G4HEPREPFILEDEBUG 274 G4cout << "G4HepRepFileXMLWriter:addAttVal << 228 G4cout << "G4HepRepFileXMLWriter:addAttValue No file is currently open" << G4endl; 275 << G4endl; << 276 #endif 229 #endif 277 } 230 } 278 } 231 } 279 232 280 void G4HepRepFileXMLWriter::addAttValue(const << 233 void G4HepRepFileXMLWriter::addAttValue (const char* name, >> 234 int value) 281 { 235 { 282 if(fout.good()) << 236 if (fout.good()) 283 { 237 { 284 indent(); 238 indent(); 285 fout << " <heprep:attvalue showLabel=\"NO << 239 fout << " <heprep:attvalue showLabel=\"NONE\" name=\"" << name << "\"" << G4endl; 286 << G4endl; << 287 indent(); 240 indent(); 288 fout << " value=\"" << value << "\"/>" 241 fout << " value=\"" << value << "\"/>" << G4endl; 289 } << 242 } else { 290 else << 291 { << 292 #ifdef G4HEPREPFILEDEBUG 243 #ifdef G4HEPREPFILEDEBUG 293 G4cout << "G4HepRepFileXMLWriter:addAttVal << 244 G4cout << "G4HepRepFileXMLWriter:addAttValue No file is currently open" << G4endl; 294 << G4endl; << 295 #endif 245 #endif 296 } 246 } 297 } 247 } 298 248 299 void G4HepRepFileXMLWriter::addAttValue(const << 249 void G4HepRepFileXMLWriter::addAttValue (const char* name, >> 250 bool value) 300 { 251 { 301 if(fout.good()) << 252 if (fout.good()) 302 { 253 { 303 indent(); 254 indent(); 304 fout << " <heprep:attvalue showLabel=\"NO << 255 fout << " <heprep:attvalue showLabel=\"NONE\" name=\"" << name << "\"" << G4endl; 305 << G4endl; << 306 indent(); 256 indent(); 307 if(value) << 257 if (value) 308 fout << " value=\"True\"/>" << G4endl 258 fout << " value=\"True\"/>" << G4endl; 309 else 259 else 310 fout << " value=\"False\"/>" << G4end 260 fout << " value=\"False\"/>" << G4endl; 311 } << 261 } else { 312 else << 313 { << 314 #ifdef G4HEPREPFILEDEBUG 262 #ifdef G4HEPREPFILEDEBUG 315 G4cout << "G4HepRepFileXMLWriter:addAttVal << 263 G4cout << "G4HepRepFileXMLWriter:addAttValue No file is currently open" << G4endl; 316 << G4endl; << 317 #endif 264 #endif 318 } 265 } 319 } 266 } 320 267 321 void G4HepRepFileXMLWriter::addAttValue(const << 268 void G4HepRepFileXMLWriter::addAttValue (const char* name, 322 double << 269 double value1, >> 270 double value2, >> 271 double value3) 323 { 272 { 324 if(fout.good()) << 273 if (fout.good()) 325 { 274 { 326 int redness = int(value1 * 255.); << 275 int redness = int(value1*255.); 327 int greenness = int(value2 * 255.); << 276 int greenness = int(value2*255.); 328 int blueness = int(value3 * 255.); << 277 int blueness = int(value3*255.); 329 indent(); 278 indent(); 330 fout << " <heprep:attvalue showLabel=\"NO << 279 fout << " <heprep:attvalue showLabel=\"NONE\" name=\"" << name << "\"" << G4endl; 331 << G4endl; << 332 indent(); 280 indent(); 333 fout << " value=\"" << redness << "," < << 281 fout << " value=\"" << redness << "," << greenness << "," << blueness << "\"/>" << G4endl; 334 << "\"/>" << G4endl; << 282 } else { 335 } << 336 else << 337 { << 338 #ifdef G4HEPREPFILEDEBUG 283 #ifdef G4HEPREPFILEDEBUG 339 G4cout << "G4HepRepFileXMLWriter:addAttVal << 284 G4cout << "G4HepRepFileXMLWriter:addAttValue No file is currently open" << G4endl; 340 << G4endl; << 341 #endif 285 #endif 342 } 286 } 343 } 287 } 344 288 345 void G4HepRepFileXMLWriter::open(const char* f 289 void G4HepRepFileXMLWriter::open(const char* fileSpec) 346 { 290 { 347 if(isOpen) << 291 if (isOpen) 348 close(); 292 close(); 349 << 293 350 fout.open(fileSpec); 294 fout.open(fileSpec); 351 << 295 352 if(fout.good()) << 296 if (fout.good()) { 353 { << 354 fout << "<?xml version=\"1.0\" ?>" << G4en 297 fout << "<?xml version=\"1.0\" ?>" << G4endl; 355 fout << "<heprep:heprep " << 298 fout << "<heprep:heprep xmlns:heprep=\"http://www.freehep.org/HepRep\"" << G4endl; 356 "xmlns:heprep=\"http://www.slac.st << 299 fout << " xmlns:xsi=\"http://www.w3.org/1999/XMLSchema-instance\" xsi:schemaLocation=\"HepRep.xsd\">" << G4endl; 357 << G4endl; << 300 358 fout << " xmlns:xsi=\"http://www.w3.org/1 << 359 "xsi:schemaLocation=\"HepRep.xsd\" << 360 << G4endl; << 361 << 362 isOpen = true; 301 isOpen = true; 363 init(); 302 init(); 364 } << 303 } else { 365 else << 304 G4cout << "G4HepRepFileXMLWriter:open Unable to write to file " << fileSpec << G4endl; 366 { << 367 G4cout << "G4HepRepFileXMLWriter:open Unab << 368 << G4endl; << 369 } 305 } 370 } 306 } 371 307 372 void G4HepRepFileXMLWriter::close() 308 void G4HepRepFileXMLWriter::close() 373 { 309 { 374 // Close any remaining open Types 310 // Close any remaining open Types 375 endTypes(); 311 endTypes(); 376 312 377 if(fout.good()) << 313 if (fout.good()) { 378 { << 379 fout << "</heprep:heprep>" << G4endl; 314 fout << "</heprep:heprep>" << G4endl; 380 fout.close(); << 315 fout.close( ); 381 isOpen = false; 316 isOpen = false; 382 } << 317 } else { 383 else << 384 { << 385 G4cout << "G4HepRepFileXMLWriter:close No 318 G4cout << "G4HepRepFileXMLWriter:close No file is currently open" << G4endl; 386 } 319 } 387 } 320 } 388 321 389 void G4HepRepFileXMLWriter::endTypes() 322 void G4HepRepFileXMLWriter::endTypes() 390 { 323 { 391 // Close any remaining open Types 324 // Close any remaining open Types 392 while(typeDepth > -1) << 325 while(typeDepth>-1) 393 endType(); << 326 endType(); 394 } 327 } 395 328 396 void G4HepRepFileXMLWriter::endType() 329 void G4HepRepFileXMLWriter::endType() 397 { 330 { 398 endInstance(); 331 endInstance(); 399 indent(); 332 indent(); 400 fout << "</heprep:type>" << G4endl; 333 fout << "</heprep:type>" << G4endl; 401 inType[typeDepth] = false; 334 inType[typeDepth] = false; 402 delete[] prevTypeName[typeDepth]; << 335 delete [] prevTypeName[typeDepth]; 403 prevTypeName[typeDepth] = new char[1]; 336 prevTypeName[typeDepth] = new char[1]; 404 strcpy(prevTypeName[typeDepth], ""); << 337 strcpy(prevTypeName[typeDepth],""); 405 typeDepth--; 338 typeDepth--; 406 } 339 } 407 340 408 void G4HepRepFileXMLWriter::endInstance() 341 void G4HepRepFileXMLWriter::endInstance() 409 { 342 { 410 if(inInstance[typeDepth]) << 343 if (inInstance[typeDepth]) 411 { 344 { 412 endPrimitive(); 345 endPrimitive(); 413 indent(); 346 indent(); 414 fout << "</heprep:instance>" << G4endl; 347 fout << "</heprep:instance>" << G4endl; 415 inInstance[typeDepth] = false; 348 inInstance[typeDepth] = false; 416 } 349 } 417 } 350 } 418 351 419 void G4HepRepFileXMLWriter::endPrimitive() 352 void G4HepRepFileXMLWriter::endPrimitive() 420 { 353 { 421 if(inPrimitive) << 354 if (inPrimitive) 422 { 355 { 423 endPoint(); 356 endPoint(); 424 indent(); 357 indent(); 425 fout << "</heprep:primitive>" << G4endl; 358 fout << "</heprep:primitive>" << G4endl; 426 inPrimitive = false; 359 inPrimitive = false; 427 } 360 } 428 } 361 } 429 362 430 void G4HepRepFileXMLWriter::endPoint() 363 void G4HepRepFileXMLWriter::endPoint() 431 { 364 { 432 if(inPoint) << 365 if (inPoint) 433 { 366 { 434 indent(); 367 indent(); 435 fout << "</heprep:point>" << G4endl; 368 fout << "</heprep:point>" << G4endl; 436 inPoint = false; 369 inPoint = false; 437 } 370 } 438 } 371 } 439 372 440 void G4HepRepFileXMLWriter::indent() 373 void G4HepRepFileXMLWriter::indent() 441 { 374 { 442 if(fout.good()) << 375 if (fout.good()) 443 { 376 { 444 int i = 0; 377 int i = 0; 445 while(inType[i] && i < 12) << 378 while (inType[i] && i<12) { 446 { << 447 fout << " "; 379 fout << " "; 448 if(inInstance[i]) << 380 if (inInstance[i]) 449 fout << " "; 381 fout << " "; 450 i++; 382 i++; 451 } 383 } 452 384 453 if(inPrimitive) << 385 if (inPrimitive) 454 fout << " "; 386 fout << " "; 455 if(inPoint) << 387 if (inPoint) 456 fout << " "; 388 fout << " "; 457 } 389 } 458 } 390 } 459 391