Skip to content

01.01 processparameters

pcubillos edited this page Dec 30, 2013 · 6 revisions

Source code:

  • argum.c

Walkthrough:

processparameters makes the command-line-argument parser, resets the transithint struct, and fill in its variables with default values and command line arguments.

The code makes an enum list to define command-line-argument keys;
builds up an optdocs struct (command-line-argument parser);
resets the transithint memory and sets default values for some parameters;
and parses the input command line arguments to transithint.

Function List in argum.c:

int processparameters(int argc, char **argv, struct transit *tr)  

Generate the command-line option parser. Initialize transithint and populate it's variables based on the command-line arguments.

int acceptsoltype(transit_ray_solution **sol, char *hname)  

Initialize transit ray solution sol. and determine if any of sol->name matches hname.

int acceptgenhints(struct transit *tr)  

Set output file names in transit (out, toomuch, and sample). Initialize transit.sol. Set geometry and detailed output variables in transit.

void savehint(FILE *out, struct transithint *hints)  

Saves hints structure

int resthint(FILE *in, struct transithint *hint)  

Restore hints structure, the structure needs to have been allocated before

void printintro()

void freemem_hints(struct transithint *h)  

Frees hints structure

void freemem_cloud(struct extcloud *c)  

void freemem_detailout(struct detailout *d)  

void freemem_detailfld(struct detailfld *f)  

Variables modified in processparameters:

  • Initialize tr.ds.th transithint.
  • Set th.fl, th.verbnoise, th.mass, th.tauiso with default values (flags, verbose level, mass or number abundance bool, and per isotope optical depth calculation).
  • Set th.det.tau.name, th.det.ext.name, th.det.cia.name (detailed output default names).
  • Set th.ncia, th.ciafile from command line arguments (Number of CIA files and CIA filenames).
  • Set th.save.ext from command line arguments (filename to save extinction array).
  • Set rest of fields in th.det.tau, th.det.ext, th.det.cia from command line arguments.
  • Set th.minelow, th.solname from command line arguments (low-energy minimum limit and light-ray path solution type).
  • Set th.f_atm, th.f_line, th.f_out, th.f_outsample, th.f_toomuch from command line arguments (atmosphere, line database, output, samplings, tau too much filenames).
  • Set th.ot and update th.fl with TRU_OUTTAU from command line arguments (output optical depth instead of modulation bool).
  • Set th.allowrq from command line arguments (lowest allowed cumulative abundance).
  • Update th.mass from command line arguments.
  • Fill th.onept fields.
  • Update th.fl to include TRU_ATMASK1P flag if set by command line arguments.
  • Set th.rads.i, th.rads.f, th.rads.d, th.rads.fct from command line arguments (radius sampling parameters).
  • Set th.wavs.i, th.wavs.f, th.wavs.d, th.wavs.fct, th.wavs.o from command line arguments (wavelength sampling).
  • Set th.wavs.n, th.wavs.v default values.
  • Set th.wns.i, th.wns.f, th.wns.d, th.wns.fct, th.wns.o from command line arguments (wavenumber sampling).
  • Set th.wns.n, th.wns.v default values.
  • Set th.margin, th.wnm from command line arguments (wavelength and wavenumber margins).
  • Set th.maxratio_doppler, th.voightfine, th.timesalpha from command line arguments (Voigt's width to recalculate the profile, fine-binning oversampling, and half-width of profile in number of broadening half-widths).
  • Update th.verblevel from command line arguments.
  • Modify th.fl to include TRU_EXTINPERISO from command line arguments (calculate extinction per isotope flag).
  • Set th.blowex from command line argument (extinction multiplicative factor).
  • Set th.sg variables except x, y, starmass, starmassfct, starradfct from command line arguments.
  • Set th.toomuch, th.tauiso, th.taulevel, th.modlevel from command line arguments (max optical depth, calculate tau for the single isotope with this index, optical depth integration level, modulation integration level).
  • Fill th.cl fields.

FINDME:

  • CLA_NUMBERQ (which sets th.mass) command line argument is not defined in optdocs.
  • There is no input for sg.starmass.

Clone this wiki locally