options

Contents

options.c

All subroutines necessary to read in all options. Also monitor input files for mistakes and log all option data.

Author

Rory Barnes (RoryBarnes)

Date

May 7 2014

Functions

void NotPrimaryInput(int iFile, char cName[], char cFile[], int iLine, int iVerbose)
int fbCommentedLine(char cLine[], int iLen)
void GetLine(char *cFile, char *cOption, char **cLine, int *iLine, int iVerbose)
void GetNextValidLine(char cFile[], int iStart, char **cLine, int *iLine)
int GetPos(char cLine[])
void GetWords(char *cLine, char cInput[MAXARRAY][OPTLEN], int *iNumWords, int *bContinue)
void PrintDefault(char cName[], char cDefault[], char cFile[], int iVerbose, int iVerbThreshold)
double dNegativeDouble(OPTIONS options, char cFile[], int iVerbose)
void AddOptionStringArray(char *cFile, char *cOption, char ***saInput, int *iNumIndices, int *iNumLines, int *iLine, int iVerbose)
void AddOptionDoubleArray(char *cFile, char *cOption, double *daInput, int *iNumIndices, int *iNumLines, int *iLine, int iVerbose)
void AddOptionDouble(char *cFile, char *cOption, double *dInput, int *iLine, int iVerbose)
void AddOptionInt(char *cFile, char *cOption, int *iInput, int *iLine, int iVerbose)
void AddOptionBool(char *cFile, char *cOption, int *iInput, int *iLine, int iVerbose)
void AddOptionString(char *cFile, char *cOption, char cInput[], int *iLine, int iVerbose)
int iGetNumLines(char *cFile)
void CheckFileExists(char *cFile)
int fbBlankLine(char *cLine, int iLineLength)
void RecordCommentsAndWhiteSpace(INFILE *infile)
void Unrecognized(FILES files)
void UpdateFoundOption(INFILE *input, OPTIONS *options, int iLine, int iFile)
void UpdateFoundOptionMulti(INFILE *input, OPTIONS *options, int *iLine, int iNumLines, int iFile)
void CheckDuplication(FILES *files, OPTIONS *options, char cFile[], int iLine, int iVerbose)
void ReadVerbose(FILES *files, OPTIONS *options, int *iVerbose, int iFile)
int iAssignMassUnit(char cTmp[], int iVerbose, char cFile[], char cName[], int iLine)
void ReadUnitMass(CONTROL *control, FILES *files, OPTIONS *options, int iFile)
int iAssignUnitTime(char cTmp[], int iVerbose, char cFile[], char cName[], int iLine)
void ReadUnitTime(CONTROL *control, FILES *files, OPTIONS *options, int iFile)
int iAssignUnitAngle(char cTmp[], int iVerbose, char cFile[], char cName[], int iLine)
void ReadUnitAngle(CONTROL *control, FILES *files, OPTIONS *options, int iFile)
int iAssignUnitLength(char cTmp[], int iVerbose, char cFile[], char cName[], int iLine)
void ReadUnitLength(CONTROL *control, FILES *files, OPTIONS *options, int iFile)
int iAssignTempUnit(char cTmp[], int iVerbose, char cFile[], char cName[], int iLine)
void ReadUnitTemp(CONTROL *control, FILES *files, OPTIONS *options, int iFile)
void ReadSystemName(CONTROL *control, FILES *files, OPTIONS *options, SYSTEM *system, int iFile)
void ReadBodyFileNames(BODY **body, CONTROL *control, FILES *files, OPTIONS *options, char *cFile, char ***saBodyFiles, int *iNumLines, int *iaLines)
void ReadInitialOptions(BODY **body, CONTROL *control, FILES *files, MODULE *module, OPTIONS *options, OUTPUT *output, SYSTEM *system, char *sPrimaryFile)
void AssignDefaultDouble(OPTIONS *options, double *dOption, int iNumFiles)
void AssignDefaultInt(OPTIONS *options, int *iOption, int iNumFiles)
void AssignDefaultString(OPTIONS *options, char cOption[], int iNumFiles)
int bOptionAlreadyFound(int *iLine, int iNumFiles)
void ReadAge(BODY *body, CONTROL *control, FILES *files, OPTIONS *options, SYSTEM *system, int iFile)
void ReadAlbedoGlobal(BODY *body, CONTROL *control, FILES *files, OPTIONS *options, SYSTEM *system, int iFile)
void ReadBodyType(BODY *body, CONTROL *control, FILES *files, OPTIONS *options, SYSTEM *system, int iFile)
void ReadDoBackward(BODY *body, CONTROL *control, FILES *files, OPTIONS *options, SYSTEM *system, int iFile)
void ReadOutFile(BODY *body, CONTROL *control, FILES *files, OPTIONS *options, SYSTEM *system, int iFile)
void ReadEta(BODY *body, CONTROL *control, FILES *files, OPTIONS *options, SYSTEM *system, int iFile)
void ReadOutputTime(BODY *body, CONTROL *control, FILES *files, OPTIONS *options, SYSTEM *system, int iFile)
void ReadStopTime(BODY *body, CONTROL *control, FILES *files, OPTIONS *options, SYSTEM *system, int iFile)
void ReadTimeStep(BODY *body, CONTROL *control, FILES *files, OPTIONS *options, SYSTEM *system, int iFile)
void ReadVarDt(BODY *body, CONTROL *control, FILES *files, OPTIONS *options, SYSTEM *system, int iFile)
void ReadBodyName(BODY *body, CONTROL *control, FILES *files, OPTIONS *options, SYSTEM *system, int iFile)
void ReadColor(BODY *body, CONTROL *control, FILES *files, OPTIONS *options, SYSTEM *system, int iFile)
void ReadDigits(BODY *body, CONTROL *control, FILES *files, OPTIONS *options, SYSTEM *system, int iFile)
void ReadEcc(BODY *body, CONTROL *control, FILES *files, OPTIONS *options, SYSTEM *system, int iFile)
void ReadEnvelopeMass(BODY *body, CONTROL *control, FILES *files, OPTIONS *options, SYSTEM *system, int iFile)

Read the planet’s initial gaseous envelope mass.

Parameters:
  • body – A pointer to the current BODY instance

  • control – A pointer to the integration CONTROL instance

  • files – A pointer to the array of input FILES

  • options – A pointer to the OPTIONS instance

  • system – A pointer to the SYSTEM instance

  • iFile – The current file number

void ReadDoForward(BODY *body, CONTROL *control, FILES *files, OPTIONS *options, SYSTEM *system, int iFile)
void ReadGRCorr(BODY *body, CONTROL *control, FILES *files, OPTIONS *options, SYSTEM *system, int iFile)
void ReadHaltMaxEcc(BODY *body, CONTROL *control, FILES *files, OPTIONS *options, SYSTEM *system, int iFile)
void ReadHaltMerge(BODY *body, CONTROL *control, FILES *files, OPTIONS *options, SYSTEM *system, int iFile)
void ReadHaltMaxMutualInc(BODY *body, CONTROL *control, FILES *files, OPTIONS *options, SYSTEM *system, int iFile)

Read in the maximum allowed mutual inclination. This parameter applies to both SpiNBbody and DistOrb. If set to 0, then the mutual inclination will not be calculated every timestep in HaltMaxMutualIncSpiNBody or HaltMaxMutualIncDistorb. This parameter can exist in any file, but only once.

Parameters:
  • body – A pointer to the current BODY instance

  • control – A pointer to the integration CONTROL instance

  • files – A pointer to the array of input FILES

  • options – A pointer to the OPTIONS instance

  • system – A pointer to the SYSTEM instance

  • iFile – The current file number

void ReadHaltMinEcc(BODY *body, CONTROL *control, FILES *files, OPTIONS *options, SYSTEM *system, int iFile)
void ReadHaltMinObl(BODY *body, CONTROL *control, FILES *files, OPTIONS *options, SYSTEM *system, int iFile)
void ReadHaltMinSemi(BODY *body, CONTROL *control, FILES *files, OPTIONS *options, SYSTEM *system, int iFile)
void ReadHaltPosDeDt(BODY *body, CONTROL *control, FILES *files, OPTIONS *options, SYSTEM *system, int iFile)
void ReadHecc(BODY *body, CONTROL *control, FILES *files, OPTIONS *options, SYSTEM *system, int iFile)
void ReadIntegrationMethod(BODY *body, CONTROL *control, FILES *files, OPTIONS *options, SYSTEM *system, int iFile)
void ReadKecc(BODY *body, CONTROL *control, FILES *files, OPTIONS *options, SYSTEM *system, int iFile)
void ReadDoLog(BODY *body, CONTROL *control, FILES *files, OPTIONS *options, SYSTEM *system, int iFile)
void ReadLogFile(BODY *body, CONTROL *control, FILES *files, OPTIONS *options, SYSTEM *system, int iFile)
void ReadLongP(BODY *body, CONTROL *control, FILES *files, OPTIONS *options, SYSTEM *system, int iFile)
void ReadLongA(BODY *body, CONTROL *control, FILES *files, OPTIONS *options, SYSTEM *system, int iFile)
void ReadArgP(BODY *body, CONTROL *control, FILES *files, OPTIONS *options, SYSTEM *system, int iFile)
void ReadInc(BODY *body, CONTROL *control, FILES *files, OPTIONS *options, SYSTEM *system, int iFile)
void ReadLuminosity(BODY *body, CONTROL *control, FILES *files, OPTIONS *options, SYSTEM *system, int iFile)
void ReadLXUV(BODY *body, CONTROL *control, FILES *files, OPTIONS *options, SYSTEM *system, int iFile)
void ReadMass(BODY *body, CONTROL *control, FILES *files, OPTIONS *options, SYSTEM *system, int iFile)
void ReadMassRad(BODY *body, CONTROL *control, FILES *files, OPTIONS *options, SYSTEM *system, int iFile)
void ReadMeanMotion(BODY *body, CONTROL *control, FILES *files, OPTIONS *options, SYSTEM *system, int iFile)
void ReadMinSurfaceWaterMass(BODY *body, CONTROL *control, FILES *files, OPTIONS *options, SYSTEM *system, int iFile)

Read the minimum surface water mass.

Parameters:
  • body – A pointer to the current BODY instance

  • control – A pointer to the integration CONTROL instance

  • files – A pointer to the array of input FILES

  • options – A pointer to the OPTIONS instance

  • system – A pointer to the SYSTEM instance

  • iFile – The current file number

void ReadMinEnvelopeMass(BODY *body, CONTROL *control, FILES *files, OPTIONS *options, SYSTEM *system, int iFile)

Read the minimum envelope mass.

Parameters:
  • body – A pointer to the current BODY instance

  • control – A pointer to the integration CONTROL instance

  • files – A pointer to the array of input FILES

  • options – A pointer to the OPTIONS instance

  • system – A pointer to the SYSTEM instance

  • iFile – The current file number

void ReadMinValue(BODY *body, CONTROL *control, FILES *files, OPTIONS *options, SYSTEM *system, int iFile)
void ReadObliquity(BODY *body, CONTROL *control, FILES *files, OPTIONS *options, SYSTEM *system, int iFile)
void ReadCosObl(BODY *body, CONTROL *control, FILES *files, OPTIONS *options, SYSTEM *system, int iFile)
void fvAllocateOutputArrays(char ****saMatch, char ***saOutput, int **baNeg, int **iaMatch, int **iaNumMatches, int iNumArgs, int iFile)
void fvCheckTooManyOutputs(FILES *files, int iFile, int iNumArgs, int iVerbose)
void fvRecordAndRemoveOutputNegativeSigns(char **saArguments, int *baNeg, int iNumArgs)
void fvAssignOutputMatchData(char ***saMatch, char *sOut, int *iaMatch, int *iaNumMatches, int iArg, int iOut)
void fvCheckUnambiguousMatch(OUTPUT *output, char ***saMatch, char *sArg, char *sOut, int *iaMatch, int *iaNumMatches, int iLen1, int iLen2, int iOut, int iArg)
void fvCountAndRecordOutputMatches(OUTPUT *output, char **saArguments, char ***saMatch, int *iaMatch, int *iaNumMatches, int iNumArgs)
void fvCheckNoOutputMatch(FILES *files, char **saArguments, int *lTmp, int *iaNumMatches, int iNumArgs, int iFile, int iVerbose)
void fvCheckOutputAmbiguity(FILES *files, char **saArguments, char ***saMatch, int *lTmp, int *iaNumMatches, int iNumArgs, int iFile, int iVerbose)
void fvCheckOutputNegativesAllowed(FILES *files, OUTPUT *output, char **saArguments, char ***saMatch, int *lTmp, int *baNeg, int *iaMatch, int *iaNumMatches, int iNumArgs, int iFile, int iVerbose)
void fvCheckOutputModuleCompatibility(FILES *files, MODULE *module, OPTIONS *options, OUTPUT *output, int *lTmp, int *iaMatch, int iNumArgs, int iFile, int iVerbose)
void fvCheckOutputDuplication(FILES *files, char ***saMatch, int *lTmp, int iNumArgs, int iFile, int iVerbose)
void fvCheckNotGridOutput(FILES *files, OPTIONS *options, OUTPUT *output, char ***saMatch, int *iaMatch, int *lTmp, int iNumArgs, int iFile, int iVerbose)
void fvAssignOutputData(FILES *files, OUTPUT *output, char **saOutput, int *baNeg, int *iaMatch, int *iNumOut, int iNumArgs, int iFile)
void fvFreeOuputArrays(char ***saMatch, int *baNeg, int *iaNumMatches, int *iaMatch)
void fvGeneralOutputChecks(FILES *files, MODULE *module, OPTIONS *options, OUTPUT *output, char ***saOutput, char **saArguments, char ****saMatch, int **baNeg, int *lTmp, int **iaMatch, int **iaNumMatches, int iNumArgs, int iFile, int iOption, int iVerbose)
void fvfinalizeOutput(FILES *files, MODULE *module, OPTIONS *options, OUTPUT *output, char **saArguments, char ***saMatch, char **saOutput, int *iNumOut, int *baNeg, int *lTmp, int *iaMatch, int *iaNumMatches, int iNumArgs, int iFile, int iOption, int iVerbose)
void fvAssignOutputOrder(FILES *files, MODULE *module, OPTIONS *options, OUTPUT *output, char **saArguments, char ***saOutput, int *lTmp, int iNumArgs, int iFile, int iVerbose)
void ReadOutputOrder(FILES *files, MODULE *module, OPTIONS *options, OUTPUT *output, int iFile, int iVerbose)
void fvCheckNotOutputOrder(FILES *files, OPTIONS *options, OUTPUT *output, char ***saMatch, int *iaMatch, int *lTmp, int iNumArgs, int iFile, int iVerbose)
void fvAssignGridOutput(FILES *files, MODULE *module, OPTIONS *options, OUTPUT *output, char **saArguments, char ***saOutput, int *lTmp, int iNumArgs, int iFile, int iVerbose)
void ReadGridOutput(FILES *files, MODULE *module, OPTIONS *options, OUTPUT *output, int iFile, int iVerbose)
void ReadOverwrite(BODY *body, CONTROL *control, FILES *files, OPTIONS *options, SYSTEM *system, int iFile)
void ReadOrbPeriod(BODY *body, CONTROL *control, FILES *files, OPTIONS *options, SYSTEM *system, int iFile)
void ReadPrecA(BODY *body, CONTROL *control, FILES *files, OPTIONS *options, SYSTEM *system, int iFile)
void ReadDynEllip(BODY *body, CONTROL *control, FILES *files, OPTIONS *options, SYSTEM *system, int iFile)
void ReadCalcDynEllip(BODY *body, CONTROL *control, FILES *files, OPTIONS *options, SYSTEM *system, int iFile)
void ReadRadius(BODY *body, CONTROL *control, FILES *files, OPTIONS *options, SYSTEM *system, int iFile)
void ReadRadiusGyration(BODY *body, CONTROL *control, FILES *files, OPTIONS *options, SYSTEM *system, int iFile)
void ReadRotPeriod(BODY *body, CONTROL *control, FILES *files, OPTIONS *options, SYSTEM *system, int iFile)
void ReadRotRate(BODY *body, CONTROL *control, FILES *files, OPTIONS *options, SYSTEM *system, int iFile)
void ReadRotVel(BODY *body, CONTROL *control, FILES *files, OPTIONS *options, SYSTEM *system, int iFile)
void ReadSciNot(BODY *body, CONTROL *control, FILES *files, OPTIONS *options, SYSTEM *system, int iFile)
void ReadSemiMajorAxis(BODY *body, CONTROL *control, FILES *files, OPTIONS *options, SYSTEM *system, int iFile)
void ReadSurfaceWaterMass(BODY *body, CONTROL *control, FILES *files, OPTIONS *options, SYSTEM *system, int iFile)

Read the planet’s initial surface water mass.

Parameters:
  • body – A pointer to the current BODY instance

  • control – A pointer to the integration CONTROL instance

  • files – A pointer to the array of input FILES

  • options – A pointer to the OPTIONS instance

  • system – A pointer to the SYSTEM instance

  • iFile – The current file number

void ReadTemperature(BODY *body, CONTROL *control, FILES *files, OPTIONS *options, SYSTEM *system, int iFile)
void ReadTidalQ(BODY *body, CONTROL *control, FILES *files, OPTIONS *options, SYSTEM *system, int iFile)
void ReadUseOuterTidalQ(BODY *body, CONTROL *control, FILES *files, OPTIONS *options, SYSTEM *system, int iFile)
void ReadOptionsGeneral(BODY *body, CONTROL *control, FILES *files, MODULE *module, OPTIONS *options, OUTPUT *output, SYSTEM *system, fnReadOption fnRead[])
void ReadViscUMan(BODY *body, CONTROL *control, FILES *files, OPTIONS *options, SYSTEM *system, int iFile)
void ReadOptionsModules(BODY *body, CONTROL *control, FILES *files, MODULE *module, OPTIONS *options, SYSTEM *system, fnReadOption fnRead[])
void ReadXobl(BODY *body, CONTROL *control, FILES *files, OPTIONS *options, SYSTEM *system, int iFile)
void ReadYobl(BODY *body, CONTROL *control, FILES *files, OPTIONS *options, SYSTEM *system, int iFile)
void ReadZobl(BODY *body, CONTROL *control, FILES *files, OPTIONS *options, SYSTEM *system, int iFile)
void ReadOptions(BODY **body, CONTROL *control, FILES *files, MODULE *module, OPTIONS *options, OUTPUT *output, SYSTEM *system, UPDATE **update, fnReadOption fnRead[], char infile[])
void InitializeOptionsGeneral(OPTIONS *options, fnReadOption fnRead[])
void InitializeOptions(OPTIONS *options, fnReadOption *fnRead)

options.h

All subroutines necessary to read in all options. Also monitor input files for mistakes and log all option data.

To add a new option: 1) Add integer definition here 2) Add new option properties in InitializeOptions 3) Write new fnReadOptions function 4) If necessary, modify the ReadOptions subroutine 5) If necessary, modify the Verify process

Author

Rory Barnes (RoryBarnes)

Date

May 7 2014

Defines

OPT_BODYFILES
OPT_MODULES
OPT_SYSTEMNAME
OPT_UNITANGLE
OPT_UNITLENGTH
OPT_UNITMASS
OPT_UNITTIME
OPT_UNITTEMP
OPT_VERBOSE
OPT_AGE
OPT_ALBEDOGLOBAL
OPT_BACK
OPT_OUTFILE
OPT_ETA
OPT_OUTPUTTIME
OPT_STOPTIME
OPT_TIMESTEP
OPT_VARDT
OPT_BODYNAME
OPT_COLOR
OPT_DENSITY
OPT_FORW
OPT_HALTMAXECC
OPT_HALTMAXMUTUALINC
OPT_HALTMERGE
OPT_HALTMINECC
OPT_HALTMINOBL
OPT_HALTMINSEMI
OPT_HALTPOSDEDT
OPT_HECC
OPT_INTEGRATIONMETHOD
OPT_KECC
OPT_LOG
OPT_LOGFILE
OPT_LONGP
OPT_LXUV
OPT_MASS
OPT_MASSRAD
OPT_MINVALUE
OPT_ORBECC
OPT_ORBMEANMOTION
OPT_BODYTYPE
OPT_ORBPER
OPT_ORBSEMI
OPT_INC
OPT_ARGP
OPT_LONGA
OPT_GRCORR
OPT_LUMINOSITY

(Initial) luminosity

OPT_TIDALQ
OPT_USEOUTERTIDALQ
OPT_OUTDIGITS
OPT_OUTPUTORDER
OPT_GRIDOUTPUT
OPT_OUTSCINOT
OPT_OVERWRITE
OPT_PRECA
OPT_DYNELLIP
OPT_CALCDYNELLIP
OPT_PRILUM
OPT_VISCUMAN
OPT_OBL
OPT_COSOBL
OPT_RADIUS
OPT_RG
OPT_ROTPER
OPT_ROTRATE
OPT_ROTVEL
OPT_TEMPERATURE

Effective temperature (initial)

OPT_XOBL
OPT_YOBL
OPT_ZOBL
OPT_SURFACEWATERMASS

Initial surface water mass

OPT_MINSURFACEWATERMASS

Minimum surface water mass (desiccated below this)

OPT_ENVELOPEMASS

Initial envelope mass

OPT_MINENVELOPEMASS

Minimum envelope mass (evaporated below this)