cloudy  trunk
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
save.h
Go to the documentation of this file.
1 /* This file is part of Cloudy and is copyright (C)1978-2022 by Gary J. Ferland and
2  * others. For conditions of distribution and use see copyright notice in license.txt */
3 
4 #ifndef SAVE_H_
5 #define SAVE_H_
6 
7 #include "energy.h"
8 
9 class diatomics;
10 class TransitionProxy;
11 
12 /* save.h */
13 static const long LIMPUN = 100L;
14 
16 static const long VERSION_TRNCON = 20190210L;
17 
21 void SaveDo(
22  const char *chTime);
23 
25 double PrtLogLin( double value );
26 
34 void Save1Line(
35  const TransitionProxy & t ,
36  FILE * io ,
37  realnum xLimit ,
38  long index,
39  realnum DopplerWidth);
40 
45  FILE * io);
46 
51 void save_opacity(
52  FILE * io,
53  long int np);
54 
59 void SaveSpecial(
60  FILE* io ,
61  const char *chTime);
62 
63 
67 void SaveAllSpeciesLabelsLevels( FILE *ioPUN );
68 
69 
74 void SaveSpecies(
75  FILE* ioPUN,
76  long int ipPun );
77 
83 void SaveSpeciesPseudoCont( const long ipPun, const string &speciesLabel );
84 
91 void SaveSpeciesBands( const long ipPun, const string &speciesLabel,
92  const string &fileBands );
93 
99 void SaveSpeciesOptDep( const long int ipPun, const string &speciesLabel );
100 
101 class molecule;
102 
103 extern void mole_save(FILE *punit, const char speciesname[], const char args[], bool lgHeader, bool lgData, bool lgCoef, double depth);
104 
105 // debug_list -- list of species to print -- add multiple species to get net
106 // rate of change for all together, useful for understanding net sources
107 // sinks to networks
108 // ioOut -- stream
109 // lgPrintReagents -- print abundances of reagents
110 // NPRINT -- max number of reactions
111 // fprint -- minimum fraction of total rate which is worth printing
112 extern void mole_dominant_rates( const vector<const molecule *>& debug_list,
113  FILE *ioOut,
114  bool lgPrintReagents, size_t NPRINT, double fprint );
115 
116 extern void mole_print_species_reactions( molecule *speciesToPrint );
117 
118 
119 /* Print header for Save1LineData() function
120  * \param ioPUN file pointer to write to
121  */
122 void PrintLineDataHeader( FILE * ioPUN );
123 
124 
131 void Save1LineData(
132  const TransitionProxy & t ,
133  FILE * io,
134  bool lgCS_2 );
135 
142 void save_line(
143  FILE * ip,
144  const char *chDo,
145  bool lgEmergent,
146  long ipPun );
147 
151 void save_average(
152  long int ipPun);
153 
157 void Save_Line_RT(
158  FILE * ip);
159 
167 void saveFITSfile(
168  FILE* io,
169  int option,
170  realnum Elo = 0.f,
171  realnum Ehi = 0.f,
172  realnum Enorm = 0.f);
173 
177 void SaveHeat(FILE* io);
178 
183 void CoolSave(FILE * io, const char chJob[]);
184 
189 void SaveGrid(FILE* pnunit, exit_type status);
190 
192 {
193 public:
195  FILE *ipPnunit;
196 };
197 
199 {
200 public:
201  string speciesLabel;
203  wlHi;
204  long nBins;
205 };
206 
208 {
209 public:
210  string filename;
211  string speciesLabel;
212 };
213 
214 struct t_save {
215 
217  {
218  for( long i=0; i < LIMPUN; ++i )
219  {
220  nLineList[i] = -1;
221  lgFITS[i] = false;
222  lgXSPEC[i] = false;
223  FITStype[i] = -1;
224  nAverageList[i] = -1;
225  p_lgSaveTitleDone[i] = false;
226  p_lgSaveHeaderDone[i] = false;
227  }
228  p_lgSaveHeaderNeeded = true;
229  ipSaveGrid = -1;
230  }
231 
233  {
234  for( long i=0; i < LIMPUN; ++i )
235  {
236  SaveLineListFree(i);
237  SaveAverageFree(i);
238  }
239  }
240 
241  void SaveLineListFree(long i)
242  {
243  chLineListLabel[i].clear();
244  wlLineList[i].clear();
245  }
246  void SaveAverageFree(long i)
247  {
248  nAverageList[i] = 0;
249  chAverageType[i].clear();
250  chSaveSpecies[i].clear();
251  /* nAverageIonList is set of ions for averages */
252  nAverageIonList[i].clear();
253  /* nAverage2ndPar is set of second parameters for averages */
254  nAverage2ndPar[i].clear();
255  }
256 
261  vector<string> chLineListLabel[LIMPUN];
263  vector<realnum> wlLineList[LIMPUN];
266 
271  vector<string> chAverageType[LIMPUN];
273  vector<int> nAverageIonList[LIMPUN];
275  vector<int> nAverage2ndPar[LIMPUN];
276 
279 
281  vector<string> chFileName;
282 
285 
288 
291 
300 
304 
307 
310 
313 
316 
318  long int nsave;
319 
321  char chSave[LIMPUN][5];
323 
325  char chOpcTyp[LIMPUN][5];
326 
331 
335 
336 private:
340 
344 
348 
349 public:
350  void SetSaveHeaderNeeded(bool lgVal) { p_lgSaveHeaderNeeded = lgVal; }
351 
353  bool lgSaveTitle(int ipPun) const
354  {
356  }
358 
360  bool lgSaveHeader(int ipPun) const
361  {
363  }
365 
370 
373 
375  string optname[LIMPUN];
376 
381 
383  char chSaveArgs[LIMPUN][5];
384 
385  vector<string> chSaveSpecies[LIMPUN];
386 
390 
392  bool lgFITS[LIMPUN];
393 
396 
399 
403 
405  const char *chConSavEnr[LIMPUN];
406 
408  long int ipConPun;
409 
413 
417 
419  bool lgFLUSH;
420 
424 
427  string chGridPrefix;
428 
432 
436 
439  string chOutputFile;
440 
444  char chPunRltType[7];
445 
449  FILE* ipPoint;
451 
453  bool lgPunConv;
454  FILE* ipPunConv;
455 
456 
458  bool lgSDSOn;
459  FILE* ipSDSFile;
460 
464  FILE * ipDRout;
465  bool lgDROn,
466  lgDRPLst,
467  lgDRHash;
468 
469  /* set true save convergence base */
473 
475  FILE* ioRecom;
476  bool lgioRecom;
477 
480  long int LinEvery;
482 
484  long int ncSaveSkip;
485 
489 
494  // same thing but for absorption lines - default is unity, set to
495  // SaveLWidth if ABSORPTION keyword occurs on save line width command
497 
499 
500  // the frequency at which the continuum volume emissivity should be saved
503 
504  // Switches for save Database command
505  // Wavenumbers vs WLAng, Gf vs A, Collision Rates or not
507 
509  vector<string> contSaveSpeciesLabel;
510  vector<adjPseudoCont> setPseudoCont;
511 
514  vector<save_species_bands> specBands;
515 };
516 
517 extern t_save save;
518 
519 #endif /* SAVE_H_ */
bool lgPunLstIter[LIMPUN]
Definition: save.h:389
vector< string > chAverageType[LIMPUN]
Definition: save.h:271
bool p_lgSaveHeaderNeeded
Definition: save.h:347
vector< int > nAverageIonList[LIMPUN]
Definition: save.h:273
realnum punarg[LIMPUN][3]
Definition: save.h:372
bool lgPunContinuum
Definition: save.h:369
void SaveSpecial(FILE *io, const char *chTime)
void SaveHeat(FILE *io)
Definition: heat_save.cpp:18
void CoolSave(FILE *io, const char chJob[])
Definition: cool_save.cpp:16
STATIC long int ipPun
Definition: save_do.cpp:367
#define NORETURN
Definition: cpu.h:455
bool lgNoClobber[LIMPUN]
Definition: save.h:287
string chGridPrefix
Definition: save.h:427
realnum ResolutionAbs
Definition: save.h:496
bool lgDRHash
Definition: save.h:465
string chFilenamePrefix
Definition: save.h:431
string filename
Definition: save.h:210
vector< save_species_bands > specBands
Definition: save.h:514
void save_line(FILE *ip, const char *chDo, bool lgEmergent, long ipPun)
Definition: save_line.cpp:116
static const long VERSION_TRNCON
Definition: save.h:16
void Save1LineData(const TransitionProxy &t, FILE *io, bool lgCS_2)
bool lgSaveGrid_noclobber
Definition: save.h:299
char chOpcTyp[LIMPUN][5]
Definition: save.h:325
char chHashString[INPUT_LINE_LENGTH]
Definition: save.h:416
void SaveSpeciesBands(const long ipPun, const string &speciesLabel, const string &fileBands)
NORETURN void SaveLineData(FILE *io)
FILE * ipSDSFile
Definition: save.h:459
bool lgioRecom_noclobber
Definition: save.h:296
bool lgFLUSH
Definition: save.h:419
FILE * ioRecom
Definition: save.h:475
char chPunRltType[7]
Definition: save.h:444
FILE * ipPnunit
Definition: save.h:195
bool lgRealSave[LIMPUN]
Definition: save.h:303
Definition: mole.h:142
exit_type
Definition: cddefines.h:142
bool lgTraceConvergeBase_noclobber
Definition: save.h:298
bool lgEmergent[LIMPUN]
Definition: save.h:306
long int nsave
Definition: save.h:318
void mole_save(FILE *punit, const char speciesname[], const char args[], bool lgHeader, bool lgData, bool lgCoef, double depth)
void SaveAllSpeciesLabelsLevels(FILE *ioPUN)
void SaveDo(const char *chTime)
Definition: save_do.cpp:460
FILE * ipPunConv
Definition: save.h:454
bool lgCumulative[LIMPUN]
Definition: save.h:309
string optname[LIMPUN]
Definition: save.h:375
string SpeciesBandFile[LIMPUN]
Definition: save.h:513
long int LinEvery
Definition: save.h:480
void SaveSpeciesOptDep(const long int ipPun, const string &speciesLabel)
void save_opacity(FILE *io, long int np)
bool lg_separate_iterations[LIMPUN]
Definition: save.h:334
bool lgPunConv
Definition: save.h:453
realnum WeakHeatCool
Definition: save.h:488
FILE * ipTraceConvergeBase
Definition: save.h:472
static const long LIMPUN
Definition: save.h:13
~t_save()
Definition: save.h:232
void SaveGrid(FILE *pnunit, exit_type status)
Definition: save_do.cpp:3996
bool lgXSPEC[LIMPUN]
Definition: save.h:395
char chSaveArgs[LIMPUN][5]
Definition: save.h:383
void SaveAverageFree(long i)
Definition: save.h:246
void Save_Line_RT(FILE *ip)
Definition: save_line.cpp:334
long int ncSaveSkip
Definition: save.h:484
void saveFITSfile(FILE *io, int option, realnum Elo=0.f, realnum Ehi=0.f, realnum Enorm=0.f)
Definition: save_fits.cpp:86
realnum wlLo
Definition: save.h:202
Definition: save.h:214
bool lgPunPoint
Definition: save.h:450
float realnum
Definition: cddefines.h:124
bool lgPunPoint_noclobber
Definition: save.h:295
bool lgLuminosityOld
Definition: save.h:423
const int INPUT_LINE_LENGTH
Definition: cddefines.h:301
bool lgSaveDataRates
Definition: save.h:506
long int nSaveEveryZone[LIMPUN]
Definition: save.h:380
bool lgQHSaveFile_noclobber
Definition: save.h:297
vector< int > nAverage2ndPar[LIMPUN]
Definition: save.h:275
long ipSaveGrid
Definition: save.h:284
bool lgLineListRatio[LIMPUN]
Definition: save.h:265
bool lgDRPLst
Definition: save.h:465
FILE * ipPoint
Definition: save.h:449
vector< string > chLineListLabel[LIMPUN]
Definition: save.h:261
bool lgSDSOn
Definition: save.h:458
void SaveTitleDone(int ipPun)
Definition: save.h:357
realnum wlHi
Definition: save.h:202
double PrtLogLin(double value)
Definition: save_do.cpp:370
SaveParams params[LIMPUN]
Definition: save.h:278
long nBins
Definition: save.h:204
void SaveLineListFree(long i)
Definition: save.h:241
vector< string > contSaveSpeciesLabel
Definition: save.h:509
bool lgSaveEveryZone[LIMPUN]
Definition: save.h:379
bool lgLinEvery
Definition: save.h:481
t_save()
Definition: save.h:216
void SaveHeaderDone(int ipPun)
Definition: save.h:364
bool lgPrtIsotropicCont[LIMPUN]
Definition: save.h:315
int FITStype[LIMPUN]
Definition: save.h:398
bool lgFITS[LIMPUN]
Definition: save.h:392
bool p_lgSaveTitleDone[LIMPUN]
Definition: save.h:339
void mole_dominant_rates(const vector< const molecule * > &debug_list, FILE *ioOut, bool lgPrintReagents, size_t NPRINT, double fprint)
vector< realnum > wlLineList[LIMPUN]
Definition: save.h:263
bool lgSaveDataGf
Definition: save.h:506
bool lgHashEndIter[LIMPUN]
Definition: save.h:412
Definition: energy.h:9
bool lgPrtOldStyleLogs[LIMPUN]
Definition: save.h:290
string chOutputFile
Definition: save.h:439
long nAverageList[LIMPUN]
Definition: save.h:269
bool lgTraceConvergeBase
Definition: save.h:470
bool lgSaveTitle(int ipPun) const
Definition: save.h:353
bool lgDROn
Definition: save.h:465
diatomics * whichDiatomToPrint[LIMPUN]
Definition: save.h:322
long ipEmisFreq[LIMPUN]
Definition: save.h:502
void SaveSpecies(FILE *ioPUN, long int ipPun)
string chSpeciesDominantRates[LIMPUN]
Definition: save.h:498
bool lgioRecom
Definition: save.h:476
const char * chConSavEnr[LIMPUN]
Definition: save.h:405
void SaveSpeciesPseudoCont(const long ipPun, const string &speciesLabel)
vector< string > chSaveSpecies[LIMPUN]
Definition: save.h:385
string speciesLabel
Definition: save.h:211
void save_average(long int ipPun)
bool lgTraceConvergeBaseHash
Definition: save.h:470
bool lgPunConv_noclobber
Definition: save.h:293
bool lgSubtrCont
Definition: save.h:312
bool lgSaveDataWn
Definition: save.h:506
t_save save
Definition: save.cpp:5
void SetSaveHeaderNeeded(bool lgVal)
Definition: save.h:350
FILE * ipDRout
Definition: save.h:464
realnum Resolution
Definition: save.h:493
string chRedirectPrefix
Definition: save.h:435
Energy emisfreq[LIMPUN]
Definition: save.h:501
bool lgSaveHeader(int ipPun) const
Definition: save.h:360
bool lgSaveToSeparateFiles[LIMPUN]
Definition: save.h:330
long int ipConPun
Definition: save.h:408
void mole_print_species_reactions(molecule *speciesToPrint)
long nLineList[LIMPUN]
Definition: save.h:259
char chSave[LIMPUN][5]
Definition: save.h:321
void PrintLineDataHeader(FILE *ioPUN)
bool lgPunchFits
Definition: save.h:402
vector< adjPseudoCont > setPseudoCont
Definition: save.h:510
string speciesLabel
Definition: save.h:201
bool lgDROn_noclobber
Definition: save.h:294
vector< string > chFileName
Definition: save.h:281
void Save1Line(const TransitionProxy &t, FILE *io, realnum xLimit, long index, realnum DopplerWidth)
Definition: save_do.cpp:3711
bool p_lgSaveHeaderDone[LIMPUN]
Definition: save.h:343