diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 7aeb714b6..acee381ab 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -24,6 +24,7 @@ jobs: if: steps.setup_python.outcome == 'success' shell: bash -l {0} run: | + sudo apt-get update sudo apt-get install -y doxygen sudo apt-get install -y doxygen-doc python -m pip install -U pip diff --git a/.github/workflows/examples.yml b/.github/workflows/examples.yml index a6838c6aa..0b916793b 100644 --- a/.github/workflows/examples.yml +++ b/.github/workflows/examples.yml @@ -26,7 +26,6 @@ jobs: sudo apt-get install cm-super sudo apt-get install texlive-fonts-recommended texlive-fonts-extra sudo apt-get install dvipng - sudo apt-get update - name: Set up Python id: setup_python diff --git a/.github/workflows/memcheck.yml b/.github/workflows/memcheck.yml index f822a4533..165cde4f6 100644 --- a/.github/workflows/memcheck.yml +++ b/.github/workflows/memcheck.yml @@ -29,6 +29,7 @@ jobs: if: steps.setup_python.outcome == 'success' shell: bash -l {0} run: | + sudo apt-get update sudo apt-get install valgrind - name: Run valgrind test diff --git a/.github/workflows/tests-linux.yml b/.github/workflows/tests-linux.yml index f4d6ca2ea..e7053fd1a 100644 --- a/.github/workflows/tests-linux.yml +++ b/.github/workflows/tests-linux.yml @@ -34,15 +34,19 @@ jobs: if: steps.setup_python.outcome == 'success' shell: bash -l {0} run: | + sudo apt-get update python -m pip install -U pip python -m pip install -e . pip install pytest pytest-cov sudo apt install lcov - - name: Run tests and generate coverage + - name: Run tests + id: test if: steps.install.outcome == 'success' shell: bash -l {0} - run: make coverage + run: | + make opt + pytest --tb=short - name: Check test ouptut created id: check_test_file @@ -51,6 +55,11 @@ jobs: files: "/home/runner/work/vplanet/vplanet/junit/test-results.xml" fail: true + - name: Generate coverage + id: coverage + if: steps.test.outcome == 'success' && steps.check_test_file.outcome == 'success' + run: make coverage + - name: Get unique id uses: Tiryoh/gha-jobid-action@v1 id: jobs diff --git a/.github/workflows/tests-macos-intel.yml b/.github/workflows/tests-macos-intel.yml index b081c9d6a..243088828 100644 --- a/.github/workflows/tests-macos-intel.yml +++ b/.github/workflows/tests-macos-intel.yml @@ -33,7 +33,9 @@ jobs: - name: Run tests if: steps.setup_python.outcome == 'success' - run: make test + run: | + make opt + pytest --tb=short - name: Get unique id uses: Tiryoh/gha-jobid-action@v1 diff --git a/.github/workflows/tests-macos-silicon.yml b/.github/workflows/tests-macos-silicon.yml index aaf48a1b2..283278d1a 100644 --- a/.github/workflows/tests-macos-silicon.yml +++ b/.github/workflows/tests-macos-silicon.yml @@ -35,7 +35,7 @@ jobs: if: steps.setup_python.outcome == 'success' run: | make opt - pytest + pytest --tb=short - name: Get unique id uses: Tiryoh/gha-jobid-action@v1 diff --git a/examples/MagmOc_Earth/Earth.in b/examples/MagmOc_Earth/Earth.in index 9da09b7f4..4aa8b754b 100644 --- a/examples/MagmOc_Earth/Earth.in +++ b/examples/MagmOc_Earth/Earth.in @@ -1,6 +1,6 @@ # Planet a parameters sName Earth # Body's name -saModules magmoc, atmesc # Modules to apply, exact spelling required +saModules magmoc atmesc # Modules to apply, exact spelling required sColor 13aed5 # Physical Properties diff --git a/examples/MagmOc_GJ1132b/GJ1132b.in b/examples/MagmOc_GJ1132b/GJ1132b.in index 0294e599d..e92f7e729 100644 --- a/examples/MagmOc_GJ1132b/GJ1132b.in +++ b/examples/MagmOc_GJ1132b/GJ1132b.in @@ -1,6 +1,6 @@ # Planet a parameters sName GJ1132b # Body's name -saModules magmoc, atmesc # Modules to apply, exact spelling required +saModules magmoc atmesc # Modules to apply, exact spelling required sColor 13aed5 # Physical Properties diff --git a/examples/MagmOc_Trappist1g/g.in b/examples/MagmOc_Trappist1g/g.in index 16c2ccd65..7762930c9 100644 --- a/examples/MagmOc_Trappist1g/g.in +++ b/examples/MagmOc_Trappist1g/g.in @@ -1,6 +1,6 @@ # Planet g parameters sName g # Body's name -saModules magmoc, atmesc, radheat, eqtide # Modules to apply, exact spelling required +saModules magmoc atmesc radheat eqtide # Modules to apply, exact spelling required sColor 13aed5 # Physical Properties diff --git a/src/atmesc.c b/src/atmesc.c index ea011de5d..cef384139 100644 --- a/src/atmesc.c +++ b/src/atmesc.c @@ -905,16 +905,16 @@ Initialize the user options for the atmospheric escape model. void InitializeOptionsAtmEsc(OPTIONS *options, fnReadOption fnRead[]) { int iOpt, iFile; - sprintf(options[OPT_XFRAC].cName, "dXFrac"); - sprintf(options[OPT_XFRAC].cDescr, "Fraction of planet radius in X-ray/UV"); - sprintf(options[OPT_XFRAC].cDefault, "1"); - sprintf(options[OPT_XFRAC].cDimension, "nd"); + fvFormattedString(&options[OPT_XFRAC].cName, "dXFrac"); + fvFormattedString(&options[OPT_XFRAC].cDescr, "Fraction of planet radius in X-ray/UV"); + fvFormattedString(&options[OPT_XFRAC].cDefault, "1"); + fvFormattedString(&options[OPT_XFRAC].cDimension, "nd"); options[OPT_XFRAC].dDefault = 1.0; options[OPT_XFRAC].iType = 2; options[OPT_XFRAC].bMultiFile = 1; fnRead[OPT_XFRAC] = &ReadXFrac; - sprintf( - options[OPT_XFRAC].cLongDescr, + fvFormattedString( + &options[OPT_XFRAC].cLongDescr, "Ratio of the planet's XUV radius to its total radius. The XUV radius " "is\n" "defined to be the distance between the center of the planet and the\n" @@ -922,42 +922,42 @@ void InitializeOptionsAtmEsc(OPTIONS *options, fnReadOption fnRead[]) { "be\n" "in the range (0,1]."); - sprintf(options[OPT_ATMXABSEFFH].cName, "dAtmXAbsEffH"); - sprintf(options[OPT_ATMXABSEFFH].cDescr, + fvFormattedString(&options[OPT_ATMXABSEFFH].cName, "dAtmXAbsEffH"); + fvFormattedString(&options[OPT_ATMXABSEFFH].cDescr, "Hydrogen X-ray/UV absorption efficiency (epsilon)"); - sprintf(options[OPT_ATMXABSEFFH].cDefault, "0.15"); - sprintf(options[OPT_ATMXABSEFFH].cDimension, "nd"); + fvFormattedString(&options[OPT_ATMXABSEFFH].cDefault, "0.15"); + fvFormattedString(&options[OPT_ATMXABSEFFH].cDimension, "nd"); options[OPT_ATMXABSEFFH].dDefault = 0.15; options[OPT_ATMXABSEFFH].iType = 2; options[OPT_ATMXABSEFFH].bMultiFile = 1; fnRead[OPT_ATMXABSEFFH] = &ReadAtmXAbsEffH; - sprintf(options[OPT_ATMXABSEFFH].cLongDescr, + fvFormattedString(&options[OPT_ATMXABSEFFH].cLongDescr, "XUV absoprtion efficiency parameter, epsilon_{XUV}, in Eq. (A1) in\n" "Barnes et al. (2019). Must lie in the range [0,1]."); - sprintf(options[OPT_ATMXABSEFFH2O].cName, "dAtmXAbsEffH2O"); - sprintf(options[OPT_ATMXABSEFFH2O].cDescr, + fvFormattedString(&options[OPT_ATMXABSEFFH2O].cName, "dAtmXAbsEffH2O"); + fvFormattedString(&options[OPT_ATMXABSEFFH2O].cDescr, "Water X-ray/UV absorption efficiency (epsilon)"); - sprintf(options[OPT_ATMXABSEFFH2O].cDefault, "0.30"); - sprintf(options[OPT_ATMXABSEFFH2O].cDimension, "nd"); + fvFormattedString(&options[OPT_ATMXABSEFFH2O].cDefault, "0.30"); + fvFormattedString(&options[OPT_ATMXABSEFFH2O].cDimension, "nd"); options[OPT_ATMXABSEFFH2O].dDefault = 0.30; options[OPT_ATMXABSEFFH2O].iType = 2; options[OPT_ATMXABSEFFH2O].bMultiFile = 1; fnRead[OPT_ATMXABSEFFH2O] = &ReadAtmXAbsEffH2O; - sprintf(options[OPT_ATMXABSEFFH2O].cLongDescr, + fvFormattedString(&options[OPT_ATMXABSEFFH2O].cLongDescr, "XUV absoprtion efficiency parameter for water vapor as defined in\n" "Luger & Barnes (2015, AsBio, 15, 57). Must lie in range [0,1]."); - sprintf(options[OPT_ATMXABSEFFH2OMODEL].cName, "sAtmXAbsEffH2OModel"); - sprintf(options[OPT_ATMXABSEFFH2OMODEL].cDescr, + fvFormattedString(&options[OPT_ATMXABSEFFH2OMODEL].cName, "sAtmXAbsEffH2OModel"); + fvFormattedString(&options[OPT_ATMXABSEFFH2OMODEL].cDescr, "Water X-ray/XUV absorption efficiency evolution model"); - sprintf(options[OPT_ATMXABSEFFH2OMODEL].cDefault, "NONE"); - sprintf(options[OPT_ATMXABSEFFH2OMODEL].cValues, "BOLMONT16 NONE"); - sprintf(options[OPT_ATMXABSEFFH2OMODEL].cDimension, "nd"); + fvFormattedString(&options[OPT_ATMXABSEFFH2OMODEL].cDefault, "NONE"); + fvFormattedString(&options[OPT_ATMXABSEFFH2OMODEL].cValues, "BOLMONT16 NONE"); + fvFormattedString(&options[OPT_ATMXABSEFFH2OMODEL].cDimension, "nd"); options[OPT_ATMXABSEFFH2OMODEL].iType = 3; options[OPT_ATMXABSEFFH2OMODEL].bMultiFile = 1; fnRead[OPT_ATMXABSEFFH2OMODEL] = &ReadAtmXAbsEffH2OModel; - sprintf(options[OPT_ATMXABSEFFH2OMODEL].cLongDescr, + fvFormattedString(&options[OPT_ATMXABSEFFH2OMODEL].cLongDescr, "If BOLMONT16 is selected, then the value of %s will follow the " "model of\n" "Bolmont et al. (2017, MNRAS, 464, 3728). NONE will not change the " @@ -965,51 +965,51 @@ void InitializeOptionsAtmEsc(OPTIONS *options, fnReadOption fnRead[]) { "value for %s.", options[OPT_ATMXABSEFFH2O].cName, options[OPT_ATMXABSEFFH2O].cName); - sprintf(options[OPT_OXYGENMASS].cName, "dOxygenMass"); - sprintf(options[OPT_OXYGENMASS].cDescr, + fvFormattedString(&options[OPT_OXYGENMASS].cName, "dOxygenMass"); + fvFormattedString(&options[OPT_OXYGENMASS].cDescr, "The initial oxygen mass in the atmosphere."); - sprintf(options[OPT_OXYGENMASS].cDefault, "0"); - sprintf(options[OPT_OXYGENMASS].cDimension, "mass"); + fvFormattedString(&options[OPT_OXYGENMASS].cDefault, "0"); + fvFormattedString(&options[OPT_OXYGENMASS].cDimension, "mass"); options[OPT_OXYGENMASS].dDefault = 0; options[OPT_OXYGENMASS].iType = 2; options[OPT_OXYGENMASS].bMultiFile = 1; fnRead[OPT_OXYGENMASS] = &ReadOxygenMass; // No LongDescr needed - sprintf(options[OPT_OXYGENMANTLEMASS].cName, "dOxygenMantleMass"); - sprintf(options[OPT_OXYGENMANTLEMASS].cDescr, + fvFormattedString(&options[OPT_OXYGENMANTLEMASS].cName, "dOxygenMantleMass"); + fvFormattedString(&options[OPT_OXYGENMANTLEMASS].cDescr, "Initial Oxygen Mass in the Mantle"); - sprintf(options[OPT_OXYGENMANTLEMASS].cDefault, "0"); - sprintf(options[OPT_OXYGENMANTLEMASS].cDimension, "mass"); + fvFormattedString(&options[OPT_OXYGENMANTLEMASS].cDefault, "0"); + fvFormattedString(&options[OPT_OXYGENMANTLEMASS].cDimension, "mass"); options[OPT_OXYGENMANTLEMASS].dDefault = 0; options[OPT_OXYGENMANTLEMASS].iType = 2; options[OPT_OXYGENMANTLEMASS].bMultiFile = 1; fnRead[OPT_OXYGENMANTLEMASS] = &ReadOxygenMantleMass; // No LongDescr needed - sprintf(options[OPT_WATERLOSSMODEL].cName, "sWaterLossModel"); - sprintf(options[OPT_WATERLOSSMODEL].cDescr, + fvFormattedString(&options[OPT_WATERLOSSMODEL].cName, "sWaterLossModel"); + fvFormattedString(&options[OPT_WATERLOSSMODEL].cDescr, "Water loss and oxygen buildup model"); - sprintf(options[OPT_WATERLOSSMODEL].cDefault, "LBEXACT"); - sprintf(options[OPT_WATERLOSSMODEL].cValues, "LB15 LBEXACT TIAN LS16"); - sprintf(options[OPT_WATERLOSSMODEL].cDimension, "nd"); + fvFormattedString(&options[OPT_WATERLOSSMODEL].cDefault, "LBEXACT"); + fvFormattedString(&options[OPT_WATERLOSSMODEL].cValues, "LB15 LBEXACT TIAN LS16"); + fvFormattedString(&options[OPT_WATERLOSSMODEL].cDimension, "nd"); options[OPT_WATERLOSSMODEL].iType = 3; options[OPT_WATERLOSSMODEL].bMultiFile = 1; fnRead[OPT_WATERLOSSMODEL] = &ReadWaterLossModel; - sprintf(options[OPT_WATERLOSSMODEL].cLongDescr, + fvFormattedString(&options[OPT_WATERLOSSMODEL].cLongDescr, "The water loss rate will be determined by the selected model.\n" "The options are LB15, LBEXACT, TIAN, and LS16.\n"); - sprintf(options[OPT_PLANETRADIUSMODEL].cName, "sPlanetRadiusModel"); - sprintf(options[OPT_PLANETRADIUSMODEL].cDescr, "Gaseous Planet Radius Model"); - sprintf(options[OPT_PLANETRADIUSMODEL].cDefault, "NONE"); - sprintf(options[OPT_PLANETRADIUSMODEL].cValues, + fvFormattedString(&options[OPT_PLANETRADIUSMODEL].cName, "sPlanetRadiusModel"); + fvFormattedString(&options[OPT_PLANETRADIUSMODEL].cDescr, "Gaseous Planet Radius Model"); + fvFormattedString(&options[OPT_PLANETRADIUSMODEL].cDefault, "NONE"); + fvFormattedString(&options[OPT_PLANETRADIUSMODEL].cValues, "LOPEZ12 PROXCENB LEHMER17 NONE."); options[OPT_PLANETRADIUSMODEL].iType = 3; options[OPT_PLANETRADIUSMODEL].bMultiFile = 1; fnRead[OPT_PLANETRADIUSMODEL] = &ReadPlanetRadiusModel; - sprintf( - options[OPT_PLANETRADIUSMODEL].cLongDescr, + fvFormattedString( + &options[OPT_PLANETRADIUSMODEL].cLongDescr, "If LOPEZ12 is selected, the planet radius will follow the model in\n" "Lopez et al. (2012, ApJ, 761, 59). PROXCENB will use the model for\n" "Proxima b in Barnes et al. (2016, arXiv:1608.06919). LEHMER17 is the\n" @@ -1017,40 +1017,40 @@ void InitializeOptionsAtmEsc(OPTIONS *options, fnReadOption fnRead[]) { "to\n" "remain constant.\n"); - sprintf(options[OPT_INSTANTO2SINK].cName, "bInstantO2Sink"); - sprintf(options[OPT_INSTANTO2SINK].cDescr, + fvFormattedString(&options[OPT_INSTANTO2SINK].cName, "bInstantO2Sink"); + fvFormattedString(&options[OPT_INSTANTO2SINK].cDescr, "Is oxygen absorbed instantaneously at the surface?"); - sprintf(options[OPT_INSTANTO2SINK].cDefault, "0"); + fvFormattedString(&options[OPT_INSTANTO2SINK].cDefault, "0"); options[OPT_INSTANTO2SINK].iType = 0; options[OPT_INSTANTO2SINK].bMultiFile = 1; fnRead[OPT_INSTANTO2SINK] = &ReadInstantO2Sink; - sprintf( - options[OPT_INSTANTO2SINK].cLongDescr, + fvFormattedString( + &options[OPT_INSTANTO2SINK].cLongDescr, "If set to 1, then all oxygen released by photolysis is immediately\n" "removed from the atmosphere. This mimics rapid surface oxidation.\n"); - sprintf(options[OPT_STOPWATERLOSSINHZ].cName, "bStopWaterLossInHZ"); - sprintf(options[OPT_STOPWATERLOSSINHZ].cDescr, + fvFormattedString(&options[OPT_STOPWATERLOSSINHZ].cName, "bStopWaterLossInHZ"); + fvFormattedString(&options[OPT_STOPWATERLOSSINHZ].cDescr, "Stop water photolysis and H escape in the HZ?"); - sprintf(options[OPT_STOPWATERLOSSINHZ].cDefault, "1"); + fvFormattedString(&options[OPT_STOPWATERLOSSINHZ].cDefault, "1"); options[OPT_STOPWATERLOSSINHZ].iType = 0; options[OPT_STOPWATERLOSSINHZ].bMultiFile = 1; fnRead[OPT_STOPWATERLOSSINHZ] = &ReadStopWaterLossInHZ; - sprintf(options[OPT_STOPWATERLOSSINHZ].cLongDescr, + fvFormattedString(&options[OPT_STOPWATERLOSSINHZ].cLongDescr, "If set to 1, then all water photolysis and hydrogen escape will not " "occur\n" "for a planet in the habitable zone, defined to be when the " "instellation\n." "is less than the runaway greenhouse threshold.\n"); - sprintf(options[OPT_BONDILIMITED].cName, "bUseBondiLimited"); - sprintf(options[OPT_BONDILIMITED].cDescr, + fvFormattedString(&options[OPT_BONDILIMITED].cName, "bUseBondiLimited"); + fvFormattedString(&options[OPT_BONDILIMITED].cDescr, "Use Bondi-limited escape for H envelope?"); - sprintf(options[OPT_BONDILIMITED].cDefault, "0"); + fvFormattedString(&options[OPT_BONDILIMITED].cDefault, "0"); options[OPT_BONDILIMITED].iType = 0; options[OPT_BONDILIMITED].bMultiFile = 1; fnRead[OPT_BONDILIMITED] = &ReadBondiLimited; - sprintf(options[OPT_BONDILIMITED].cLongDescr, + fvFormattedString(&options[OPT_BONDILIMITED].cLongDescr, "Force the atmospheric erosion of a H envelope to be Bondi-limited " "where the\n" "mass loss is regulated by the sound speed at the sonic point " @@ -1062,42 +1062,42 @@ void InitializeOptionsAtmEsc(OPTIONS *options, fnReadOption fnRead[]) { "the local blackbody equlibrium temperature (Owen & Wu 2016, " "Equation 2).\n"); - sprintf(options[OPT_ENERGYLIMITED].cName, "bUseEnergyLimited"); - sprintf(options[OPT_ENERGYLIMITED].cDescr, + fvFormattedString(&options[OPT_ENERGYLIMITED].cName, "bUseEnergyLimited"); + fvFormattedString(&options[OPT_ENERGYLIMITED].cDescr, "Use energy-limited escape for H envelope?"); - sprintf(options[OPT_ENERGYLIMITED].cDefault, "0"); + fvFormattedString(&options[OPT_ENERGYLIMITED].cDefault, "0"); options[OPT_ENERGYLIMITED].iType = 0; options[OPT_ENERGYLIMITED].bMultiFile = 1; fnRead[OPT_ENERGYLIMITED] = &ReadEnergyLimited; - sprintf(options[OPT_ENERGYLIMITED].cLongDescr, + fvFormattedString(&options[OPT_ENERGYLIMITED].cLongDescr, "Force the atmospheric erosion of a H envelope to be energy-limited, " "i.e. the\n" "mass loss is directly proportional to the incident XUV flux " "(Equation 5\n" "from Luger et al. (2015)).\n"); - sprintf(options[OPT_RRLIMITED].cName, "bUseRRLimited"); - sprintf(options[OPT_RRLIMITED].cDescr, + fvFormattedString(&options[OPT_RRLIMITED].cName, "bUseRRLimited"); + fvFormattedString(&options[OPT_RRLIMITED].cDescr, "Use radiation/recombination-limited escape for H envelope?"); - sprintf(options[OPT_RRLIMITED].cDefault, "0"); + fvFormattedString(&options[OPT_RRLIMITED].cDefault, "0"); options[OPT_RRLIMITED].iType = 0; options[OPT_RRLIMITED].bMultiFile = 1; fnRead[OPT_RRLIMITED] = &ReadRRLimited; - sprintf(options[OPT_RRLIMITED].cLongDescr, + fvFormattedString(&options[OPT_RRLIMITED].cLongDescr, "Force the atmospheric erosion of a H envelope to be " "radiation/recombination-limited, i.e. the\n" "mass loss is directly proportional to the sqrt of the incident XUV " "flux (Equation 13\n" "from Luger et al. (2015) and Murray-Clay et al. (2009).\n"); - sprintf(options[OPT_ATMESCAUTO].cName, "bAtmEscAuto"); - sprintf(options[OPT_ATMESCAUTO].cDescr, + fvFormattedString(&options[OPT_ATMESCAUTO].cName, "bAtmEscAuto"); + fvFormattedString(&options[OPT_ATMESCAUTO].cDescr, "Let atmesc determine H envelope escape regime?"); - sprintf(options[OPT_ATMESCAUTO].cDefault, "0"); + fvFormattedString(&options[OPT_ATMESCAUTO].cDefault, "0"); options[OPT_ATMESCAUTO].iType = 0; options[OPT_ATMESCAUTO].bMultiFile = 1; fnRead[OPT_ATMESCAUTO] = &ReadAtmEscAuto; - sprintf(options[OPT_ATMESCAUTO].cLongDescr, + fvFormattedString(&options[OPT_ATMESCAUTO].cLongDescr, "Let AtmEsc determine the proper atmospheric escape regime for an " "eroding H envelope.\n" "If the planetary radius exceeds the Roche lobe, the unbound " @@ -1113,30 +1113,30 @@ void InitializeOptionsAtmEsc(OPTIONS *options, fnReadOption fnRead[]) { "is energy-limited and is linearly proportional to the incident XUV " "flux.\n"); - sprintf(options[OPT_HALTDESICCATED].cName, "bHaltSurfaceDesiccated"); - sprintf(options[OPT_HALTDESICCATED].cDescr, "Halt at Desiccation?"); - sprintf(options[OPT_HALTDESICCATED].cDefault, "0"); + fvFormattedString(&options[OPT_HALTDESICCATED].cName, "bHaltSurfaceDesiccated"); + fvFormattedString(&options[OPT_HALTDESICCATED].cDescr, "Halt at Desiccation?"); + fvFormattedString(&options[OPT_HALTDESICCATED].cDefault, "0"); options[OPT_HALTDESICCATED].iType = 0; options[OPT_HALTDESICCATED].bMultiFile = 1; fnRead[OPT_HALTDESICCATED] = &ReadHaltMinSurfaceWaterMass; - sprintf(options[OPT_HALTENVELOPEGONE].cName, "bHaltEnvelopeGone"); - sprintf(options[OPT_HALTENVELOPEGONE].cDescr, + fvFormattedString(&options[OPT_HALTENVELOPEGONE].cName, "bHaltEnvelopeGone"); + fvFormattedString(&options[OPT_HALTENVELOPEGONE].cDescr, "Halt When Envelope Evaporates?"); - sprintf(options[OPT_HALTENVELOPEGONE].cDefault, "0"); + fvFormattedString(&options[OPT_HALTENVELOPEGONE].cDefault, "0"); options[OPT_HALTENVELOPEGONE].bMultiFile = 1; options[OPT_HALTENVELOPEGONE].iType = 0; fnRead[OPT_HALTENVELOPEGONE] = &ReadHaltMinEnvelopeMass; - sprintf(options[OPT_THERMTEMP].cName, "dThermTemp"); - sprintf(options[OPT_THERMTEMP].cDescr, "Thermosphere temperature"); - sprintf(options[OPT_THERMTEMP].cDefault, "400"); - sprintf(options[OPT_THERMTEMP].cDimension, "temperature"); + fvFormattedString(&options[OPT_THERMTEMP].cName, "dThermTemp"); + fvFormattedString(&options[OPT_THERMTEMP].cDescr, "Thermosphere temperature"); + fvFormattedString(&options[OPT_THERMTEMP].cDefault, "400"); + fvFormattedString(&options[OPT_THERMTEMP].cDimension, "temperature"); options[OPT_THERMTEMP].dDefault = 400; options[OPT_THERMTEMP].iType = 2; options[OPT_THERMTEMP].bMultiFile = 1; fnRead[OPT_THERMTEMP] = &ReadThermTemp; - sprintf(options[OPT_THERMTEMP].cLongDescr, + fvFormattedString(&options[OPT_THERMTEMP].cLongDescr, "The thermal temperature of a planet heated by radiation from the " "primary.\n" "The user may set a value which will then remain constant for the " @@ -1147,59 +1147,59 @@ void InitializeOptionsAtmEsc(OPTIONS *options, fnReadOption fnRead[]) { "radiation,\n" "A is albedo and sigma is the Steffan-Boltzman constant.\n"); - sprintf(options[OPT_FLOWTEMP].cName, "dFlowTemp"); - sprintf(options[OPT_FLOWTEMP].cDescr, "Temperature of the hydrodynamic flow"); - sprintf(options[OPT_FLOWTEMP].cDefault, "400"); - sprintf(options[OPT_FLOWTEMP].cDimension, "temperature"); + fvFormattedString(&options[OPT_FLOWTEMP].cName, "dFlowTemp"); + fvFormattedString(&options[OPT_FLOWTEMP].cDescr, "Temperature of the hydrodynamic flow"); + fvFormattedString(&options[OPT_FLOWTEMP].cDefault, "400"); + fvFormattedString(&options[OPT_FLOWTEMP].cDimension, "temperature"); options[OPT_FLOWTEMP].dDefault = 400; options[OPT_FLOWTEMP].iType = 2; options[OPT_FLOWTEMP].bMultiFile = 1; fnRead[OPT_FLOWTEMP] = &ReadFlowTemp; - sprintf(options[OPT_JEANSTIME].cName, "dJeansTime"); - sprintf(options[OPT_JEANSTIME].cDescr, + fvFormattedString(&options[OPT_JEANSTIME].cName, "dJeansTime"); + fvFormattedString(&options[OPT_JEANSTIME].cDescr, "Time at which flow transitions to Jeans escape"); - sprintf(options[OPT_JEANSTIME].cDefault, "1 Gyr"); - sprintf(options[OPT_JEANSTIME].cDimension, "time"); + fvFormattedString(&options[OPT_JEANSTIME].cDefault, "1 Gyr"); + fvFormattedString(&options[OPT_JEANSTIME].cDimension, "time"); options[OPT_JEANSTIME].dDefault = 1.e9 * YEARSEC; options[OPT_JEANSTIME].iType = 2; options[OPT_JEANSTIME].bMultiFile = 1; options[OPT_JEANSTIME].dNeg = 1.e9 * YEARSEC; - sprintf(options[OPT_JEANSTIME].cNeg, "Gyr"); + fvFormattedString(&options[OPT_JEANSTIME].cNeg, "Gyr"); fnRead[OPT_JEANSTIME] = &ReadJeansTime; - sprintf(options[OPT_PRESXUV].cName, "dPresXUV"); - sprintf(options[OPT_PRESXUV].cDescr, "Pressure at base of thermosphere"); - sprintf(options[OPT_PRESXUV].cDefault, "5 Pa"); - sprintf(options[OPT_PRESXUV].cDimension, "pressure"); + fvFormattedString(&options[OPT_PRESXUV].cName, "dPresXUV"); + fvFormattedString(&options[OPT_PRESXUV].cDescr, "Pressure at base of thermosphere"); + fvFormattedString(&options[OPT_PRESXUV].cDefault, "5 Pa"); + fvFormattedString(&options[OPT_PRESXUV].cDimension, "pressure"); options[OPT_PRESXUV].dDefault = 5.0; options[OPT_PRESXUV].iType = 2; options[OPT_PRESXUV].bMultiFile = 1; fnRead[OPT_PRESXUV] = &ReadPresXUV; - sprintf(options[OPT_ATMGASCONST].cName, "dAtmGasConst"); - sprintf(options[OPT_ATMGASCONST].cDescr, "Atmospheric Gas Constant"); - sprintf(options[OPT_ATMGASCONST].cDefault, "4124"); - sprintf(options[OPT_ATMGASCONST].cDimension, "energy/temperature/mass"); + fvFormattedString(&options[OPT_ATMGASCONST].cName, "dAtmGasConst"); + fvFormattedString(&options[OPT_ATMGASCONST].cDescr, "Atmospheric Gas Constant"); + fvFormattedString(&options[OPT_ATMGASCONST].cDefault, "4124"); + fvFormattedString(&options[OPT_ATMGASCONST].cDimension, "energy/temperature/mass"); options[OPT_ATMGASCONST].dDefault = 4124.0; options[OPT_ATMGASCONST].iType = 2; options[OPT_ATMGASCONST].bMultiFile = 1; fnRead[OPT_ATMGASCONST] = &ReadAtmGasConst; - sprintf(options[OPT_FXUV].cName, "dFXUV"); - sprintf(options[OPT_FXUV].cDescr, "XUV flux at the body's orbit"); - sprintf(options[OPT_FXUV].cDimension, "energyflux"); + fvFormattedString(&options[OPT_FXUV].cName, "dFXUV"); + fvFormattedString(&options[OPT_FXUV].cDescr, "XUV flux at the body's orbit"); + fvFormattedString(&options[OPT_FXUV].cDimension, "energyflux"); options[OPT_FXUV].iType = 2; options[OPT_FXUV].bMultiFile = 1; options[OPT_FXUV].dNeg = 1; - sprintf(options[OPT_FXUV].cNeg, "W/m^2"); + fvFormattedString(&options[OPT_FXUV].cNeg, "W/m^2"); fnRead[OPT_FXUV] = &ReadFXUV; - sprintf(options[OPT_MINKTIDE].cName, "dMinKTide"); - sprintf(options[OPT_MINKTIDE].cDescr, + fvFormattedString(&options[OPT_MINKTIDE].cName, "dMinKTide"); + fvFormattedString(&options[OPT_MINKTIDE].cDescr, "Minimum value for stellar gravitaitonal enhancement of mass loss"); - sprintf(options[OPT_MINKTIDE].cDimension, "nd"); - sprintf(options[OPT_MINKTIDE].cDefault, "0.1"); + fvFormattedString(&options[OPT_MINKTIDE].cDimension, "nd"); + fvFormattedString(&options[OPT_MINKTIDE].cDefault, "0.1"); options[OPT_MINKTIDE].iType = 2; options[OPT_MINKTIDE].dDefault = 0.1; options[OPT_MINKTIDE].bMultiFile = 1; @@ -1791,9 +1791,17 @@ void fnPropsAuxAtmEsc(BODY *body, EVOLVE *evolve, IO *io, UPDATE *update, // Diffusion-limited H escape rate double BDIFF = 4.8e19 * pow(body[iBody].dFlowTemp, 0.75); + if (XO == 1) { + body[iBody].dFHDiffLim = 0; + } else { body[iBody].dFHDiffLim = BDIFF * g * ATOMMASS * (QOH - 1.) / (KBOLTZ * body[iBody].dFlowTemp * (1. + XO / (1. - XO))); + } + + if (body[iBody].dOxygenMass == 0) { + body[iBody].dOxygenEta = 0; + } // Is water escaping? if (!fbDoesWaterEscape(body, evolve, io, iBody)) { @@ -1846,10 +1854,11 @@ void fnPropsAuxAtmEsc(BODY *body, EVOLVE *evolve, IO *io, UPDATE *update, (KBOLTZ * body[iBody].dFlowTemp * body[iBody].dFHRef) / (BDIFF * g); FH = body[iBody].dFHRef; + /* Is this necessary? XXX rat = ((body[iBody].dCrossoverMass / ATOMMASS) - QOH) / ((body[iBody].dCrossoverMass / ATOMMASS) - 1.); body[iBody].dOxygenEta = 0; - + */ } else { // mcross >= mo @@ -1859,10 +1868,14 @@ void fnPropsAuxAtmEsc(BODY *body, EVOLVE *evolve, IO *io, UPDATE *update, ATOMMASS * num / den + (KBOLTZ * body[iBody].dFlowTemp * body[iBody].dFHRef) / ((1 + XO * (QOH - 1)) * BDIFF * g); - rat = (body[iBody].dCrossoverMass / ATOMMASS - QOH) / + if (body[iBody].dCrossoverMass != ATOMMASS) { + rat = (body[iBody].dCrossoverMass / ATOMMASS - QOH) / (body[iBody].dCrossoverMass / ATOMMASS - 1.); - FH = body[iBody].dFHRef * pow(1. + (XO / (1. - XO)) * QOH * rat, -1); - body[iBody].dOxygenEta = 2 * XO / (1. - XO) * rat; + FH = body[iBody].dFHRef * pow(1. + (XO / (1. - XO)) * QOH * rat, -1); + body[iBody].dOxygenEta = 2 * XO / (1. - XO) * rat; + } else { + body[iBody].dOxygenEta = 0; + } } } else if (body[iBody].iWaterLossModel == ATMESC_LS2016) { @@ -2140,9 +2153,10 @@ void VerifyAtmEsc(BODY *body, CONTROL *control, FILES *files, OPTIONS *options, } else { int iCol, bError = 0; for (iCol = 0; iCol < files->Outfile[iBody].iNumCols; iCol++) { - if (memcmp(files->Outfile[iBody].caCol[iCol], - output[OUT_PLANETRADXUV].cName, - strlen(output[OUT_PLANETRADXUV].cName)) == 0) { + // if (memcmp(files->Outfile[iBody].caCol[iCol], + // output[OUT_PLANETRADXUV].cName, + // strlen(files->Outfile[iBody].caCol[iCol])) == 0) { + if (strcmp(files->Outfile[iBody].caCol[iCol],output[OUT_PLANETRADXUV].cName) == 0) { /* Match! */ fprintf(stderr, "ERROR: Output option %s only allowed with AtmEsc's LEHMER17 " @@ -2150,8 +2164,9 @@ void VerifyAtmEsc(BODY *body, CONTROL *control, FILES *files, OPTIONS *options, output[OUT_PLANETRADXUV].cName); bError = 1; } - if (memcmp(files->Outfile[iBody].caCol[iCol], output[OUT_RADSOLID].cName, - strlen(output[OUT_RADSOLID].cName)) == 0) { + // if (memcmp(files->Outfile[iBody].caCol[iCol], output[OUT_RADSOLID].cName, + // strlen(files->Outfile[iBody].caCol[iCol])) == 0) { + if (strcmp(files->Outfile[iBody].caCol[iCol], output[OUT_RADSOLID].cName) == 0) { /* Match! */ fprintf(stderr, "ERROR: Output option %s only allowed with AtmEsc's LEHMER17 " @@ -2159,9 +2174,10 @@ void VerifyAtmEsc(BODY *body, CONTROL *control, FILES *files, OPTIONS *options, output[OUT_RADSOLID].cName); bError = 1; } - if (memcmp(files->Outfile[iBody].caCol[iCol], - output[OUT_SCALEHEIGHT].cName, - strlen(output[OUT_SCALEHEIGHT].cName)) == 0) { + // if (memcmp(files->Outfile[iBody].caCol[iCol], + // output[OUT_SCALEHEIGHT].cName, + // strlen(files->Outfile[iBody].caCol[iCol])) == 0) { + if (strcmp(files->Outfile[iBody].caCol[iCol],output[OUT_SCALEHEIGHT].cName) == 0) { /* Match! */ fprintf(stderr, "ERROR: Output option %s only allowed with AtmEsc's LEHMER17 " @@ -2169,8 +2185,9 @@ void VerifyAtmEsc(BODY *body, CONTROL *control, FILES *files, OPTIONS *options, output[OUT_SCALEHEIGHT].cName); bError = 1; } - if (memcmp(files->Outfile[iBody].caCol[iCol], output[OUT_PRESSURF].cName, - strlen(output[OUT_PRESSURF].cName)) == 0) { + // if (memcmp(files->Outfile[iBody].caCol[iCol], output[OUT_PRESSURF].cName, + // strlen(files->Outfile[iBody].caCol[iCol])) == 0) { + if (strcmp(files->Outfile[iBody].caCol[iCol], output[OUT_PRESSURF].cName) == 0) { /* Match! */ fprintf(stderr, "ERROR: Output option %s only allowed with AtmEsc's LEHMER17 " @@ -2638,12 +2655,12 @@ Logs the surface water mass. */ void WriteSurfaceWaterMass(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, - int iBody, double *dTmp, char cUnit[]) { + int iBody, double *dTmp, char **cUnit) { *dTmp = body[iBody].dSurfaceWaterMass; if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { *dTmp /= fdUnitsMass(units->iMass); fsUnitsMass(units->iMass, cUnit); @@ -2665,9 +2682,9 @@ Logs the H escape regime */ void WriteHEscapeRegime(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, - double *dTmp, char cUnit[]) { + double *dTmp, char **cUnit) { *dTmp = body[iBody].iHEscapeRegime; - strcpy(cUnit, ""); + fvFormattedString(cUnit, ""); } /** @@ -2685,13 +2702,13 @@ Logs the atmospheric oxygen mass. */ void WriteOxygenMass(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, - double *dTmp, char cUnit[]) { + double *dTmp, char **cUnit) { *dTmp = body[iBody].dOxygenMass; if (output->bDoNeg[iBody]) { *dTmp *= 1.e-5 * ((BIGG * body[iBody].dMass) / (4. * PI * pow(body[iBody].dRadius, 4))); - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { *dTmp /= fdUnitsMass(units->iMass); fsUnitsMass(units->iMass, cUnit); @@ -2713,10 +2730,10 @@ Logs Ktide, the gravitational enhancement of mass loss. */ void WriteKTide(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, double *dTmp, - char cUnit[]) { + char **cUnit) { *dTmp = body[iBody].dKTide; - strcpy(cUnit, ""); + fvFormattedString(cUnit, ""); } /** @@ -2734,13 +2751,13 @@ Logs the mantle oxygen mass. */ void WriteOxygenMantleMass(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, - int iBody, double *dTmp, char cUnit[]) { + int iBody, double *dTmp, char **cUnit) { *dTmp = body[iBody].dOxygenMantleMass; if (output->bDoNeg[iBody]) { *dTmp *= 1.e-5 * ((BIGG * body[iBody].dMass) / (4. * PI * pow(body[iBody].dRadius, 4))); - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { *dTmp /= fdUnitsMass(units->iMass); fsUnitsMass(units->iMass, cUnit); @@ -2762,12 +2779,12 @@ Logs the planet radius. */ void WritePlanetRadius(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, - double *dTmp, char cUnit[]) { + double *dTmp, char **cUnit) { *dTmp = body[iBody].dRadius; if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { *dTmp /= fdUnitsLength(units->iLength); fsUnitsLength(units->iLength, cUnit); @@ -2789,12 +2806,12 @@ Logs the envelope mass. */ void WriteEnvelopeMass(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, - double *dTmp, char cUnit[]) { + double *dTmp, char **cUnit) { *dTmp = body[iBody].dEnvelopeMass; if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { *dTmp /= fdUnitsMass(units->iMass); fsUnitsMass(units->iMass, cUnit); @@ -2816,7 +2833,7 @@ Logs the semi-major axis corresponding to the current runaway greenhouse limit. */ void WriteRGLimit(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, double *dTmp, - char cUnit[]) { + char **cUnit) { // Get the RG flux double flux = fdHZRG14(body, iBody); @@ -2833,7 +2850,7 @@ void WriteRGLimit(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { *dTmp /= fdUnitsLength(units->iLength); fsUnitsLength(units->iLength, cUnit); @@ -2855,10 +2872,10 @@ Logs the oxygen mixing ratio at the base of the hydrodynamic wind. */ void WriteOxygenMixingRatio(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, - int iBody, double *dTmp, char cUnit[]) { + int iBody, double *dTmp, char **cUnit) { *dTmp = fdAtomicOxygenMixingRatio(body[iBody].dSurfaceWaterMass, body[iBody].dOxygenMass); - strcpy(cUnit, ""); + fvFormattedString(cUnit, ""); } /** @@ -2876,9 +2893,9 @@ Logs the oxygen eta parameter from Luger and Barnes (2015). */ void WriteOxygenEta(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, - double *dTmp, char cUnit[]) { + double *dTmp, char **cUnit) { *dTmp = body[iBody].dOxygenEta; - strcpy(cUnit, ""); + fvFormattedString(cUnit, ""); } /** @@ -2896,9 +2913,9 @@ Logs the XUV absorption efficiency for water. */ void WriteAtmXAbsEffH2O(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, - double *dTmp, char cUnit[]) { + double *dTmp, char **cUnit) { *dTmp = body[iBody].dAtmXAbsEffH2O; - strcpy(cUnit, ""); + fvFormattedString(cUnit, ""); } /** @@ -2916,12 +2933,12 @@ Logs the planet's radius in the XUV. */ void WritePlanetRadXUV(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, - double *dTmp, char cUnit[]) { + double *dTmp, char **cUnit) { *dTmp = body[iBody].dRadXUV; if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { *dTmp /= fdUnitsLength(units->iLength); fsUnitsLength(units->iLength, cUnit); @@ -2945,17 +2962,17 @@ Logs the atmospheric mass loss rate. */ void WriteDEnvMassDt(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, - double *dTmp, char cUnit[]) { + double *dTmp, char **cUnit) { *dTmp = *(update[iBody].pdDEnvelopeMassDtAtmesc); //*dTmp = fnUpdate[iBody][update[iBody].iEnvelopeMass][0]; if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { //*dTmp *= fdUnitsTime(units->iTime)/fdUnitsMass(units->iMass); - strcpy(cUnit, "kg/s"); + fvFormattedString(cUnit, "kg/s"); // XXX Why isn't the other line commented out??? } } @@ -2974,12 +2991,12 @@ Logs the thermospheric temperature. */ void WriteThermTemp(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, - double *dTmp, char cUnit[]) { + double *dTmp, char **cUnit) { *dTmp = body[iBody].dThermTemp; if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { // System units are Kelvins *dTmp = fdUnitsTemp(*dTmp, U_KELVIN, units->iTemp); @@ -3002,12 +3019,12 @@ Logs the temperature of the flow. */ void WriteFlowTemp(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, double *dTmp, - char cUnit[]) { + char **cUnit) { *dTmp = body[iBody].dFlowTemp; if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { // System units are Kelvins *dTmp = fdUnitsTemp(*dTmp, U_KELVIN, units->iTemp); @@ -3030,14 +3047,14 @@ Logs the surface pressure. */ void WritePresSurf(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, double *dTmp, - char cUnit[]) { + char **cUnit) { *dTmp = body[iBody].dPresSurf; if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { - strcpy(cUnit, "Pa"); + fvFormattedString(cUnit, "Pa"); // XXX } } @@ -3056,12 +3073,12 @@ Logs the pressure at the XUV absorption radius. */ void WritePresXUV(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, double *dTmp, - char cUnit[]) { + char **cUnit) { *dTmp = body[iBody].dPresXUV; if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { //*dTmp /= fdUnitsPressure(units->iLength); // fsUnitsLength(units->iLength,cUnit); @@ -3083,12 +3100,12 @@ Logs the time at which the flow transitioned to Jeans escape. */ void WriteJeansTime(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, - double *dTmp, char cUnit[]) { + double *dTmp, char **cUnit) { *dTmp = body[iBody].dJeansTime; if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { *dTmp /= fdUnitsTime(units->iTime); fsUnitsTime(units->iTime, cUnit); @@ -3110,12 +3127,12 @@ Logs the atmospheric scale height. */ void WriteScaleHeight(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, - double *dTmp, char cUnit[]) { + double *dTmp, char **cUnit) { *dTmp = body[iBody].dScaleHeight; if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { *dTmp /= fdUnitsLength(units->iLength); fsUnitsLength(units->iLength, cUnit); @@ -3137,12 +3154,12 @@ Logs the gas constant. */ void WriteAtmGasConst(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, - double *dTmp, char cUnit[]) { + double *dTmp, char **cUnit) { *dTmp = body[iBody].dAtmGasConst; if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { } } @@ -3162,12 +3179,12 @@ Logs the planet's solid radius. */ void WriteRadSolid(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, double *dTmp, - char cUnit[]) { + char **cUnit) { *dTmp = body[iBody].dRadSolid; if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { *dTmp /= fdUnitsLength(units->iLength); fsUnitsLength(units->iLength, cUnit); @@ -3189,12 +3206,12 @@ Logs the planet's Roche radius. */ void WriteRocheRadius(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, - double *dTmp, char cUnit[]) { + double *dTmp, char **cUnit) { *dTmp = body[iBody].dRocheRadius; if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { *dTmp /= fdUnitsLength(units->iLength); fsUnitsLength(units->iLength, cUnit); @@ -3217,12 +3234,12 @@ Logs the planet's Bondi radius. */ void WriteBondiRadius(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, - double *dTmp, char cUnit[]) { + double *dTmp, char **cUnit) { *dTmp = body[iBody].dBondiRadius; if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { *dTmp /= fdUnitsLength(units->iLength); fsUnitsLength(units->iLength, cUnit); @@ -3244,14 +3261,14 @@ Logs the XUV flux received by the planet. */ void WriteFXUV(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, double *dTmp, - char cUnit[]) { + char **cUnit) { *dTmp = body[iBody].dFXUV; if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { - strcpy(cUnit, "W/m^2"); + fvFormattedString(cUnit, "W/m^2"); } } @@ -3271,16 +3288,16 @@ and energy-limited H envelope escape regimes */ void WriteRRCriticalFlux(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, - int iBody, double *dTmp, char cUnit[]) { + int iBody, double *dTmp, char **cUnit) { // Calculate critical flux for body *dTmp = fdRRCriticalFlux(body, iBody); if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { - strcpy(cUnit, "W/m^2"); + fvFormattedString(cUnit, "W/m^2"); } } @@ -3299,12 +3316,12 @@ Logs the crossover mass. */ void WriteCrossoverMass(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, - double *dTmp, char cUnit[]) { + double *dTmp, char **cUnit) { *dTmp = body[iBody].dCrossoverMass; if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { *dTmp /= fdUnitsMass(units->iMass); fsUnitsMass(units->iMass, cUnit); @@ -3326,9 +3343,9 @@ Logs the Water escape regime */ void WriteWaterEscapeRegime(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, - int iBody, double *dTmp, char cUnit[]) { + int iBody, double *dTmp, char **cUnit) { *dTmp = body[iBody].iWaterEscapeRegime; - strcpy(cUnit, ""); + fvFormattedString(cUnit, ""); } @@ -3347,7 +3364,7 @@ Logs the XUV flux received by the planet. */ void WriteFXUVCRITDRAG(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, - double *dTmp, char cUnit[]) { + double *dTmp, char **cUnit) { double BDIFF = 4.8e19 * pow(body[iBody].dFlowTemp, 0.75); double XO = fdAtomicOxygenMixingRatio(body[iBody].dSurfaceWaterMass, body[iBody].dOxygenMass); @@ -3364,9 +3381,9 @@ void WriteFXUVCRITDRAG(BODY *body, CONTROL *control, OUTPUT *output, } if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { - strcpy(cUnit, "W/m^2"); + fvFormattedString(cUnit, "W/m^2"); // XXX } } @@ -3385,9 +3402,9 @@ Logs the Hydrogen Reference Flux */ void WriteHREFFLUX(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, double *dTmp, - char cUnit[]) { + char **cUnit) { *dTmp = body[iBody].dFHRef; - strcpy(cUnit, "m^-2 s^-1"); + fvFormattedString(cUnit, "m^-2 s^-1"); // XXX } /** @@ -3406,9 +3423,9 @@ limited regime) */ void WriteHDiffLimFlux(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, - double *dTmp, char cUnit[]) { + double *dTmp, char **cUnit) { *dTmp = body[iBody].dFHDiffLim; - strcpy(cUnit, "m^-2 s^-1"); + fvFormattedString(cUnit, "m^-2 s^-1"); // XXX } /** @@ -3426,17 +3443,22 @@ Modifier for H Ref Flux to include oxygen drag at a snapshot in time */ void WriteHRefODragMod(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, - double *dTmp, char cUnit[]) { + double *dTmp, char **cUnit) { + // XXX This should probably all just be moved into a function if (body[iBody].dCrossoverMass / ATOMMASS - 1. != 0) { double rat = (body[iBody].dCrossoverMass / ATOMMASS - QOH) / (body[iBody].dCrossoverMass / ATOMMASS - 1.); double XO = fdAtomicOxygenMixingRatio(body[iBody].dSurfaceWaterMass, body[iBody].dOxygenMass); - *dTmp = pow(1. + (XO / (1. - XO)) * QOH * rat, -1); + if (XO == 1) { + *dTmp = 0; + } else { + *dTmp = pow(1. + (XO / (1. - XO)) * QOH * rat, -1); + } } else { *dTmp = -1; } - strcpy(cUnit, ""); + fvFormattedString(cUnit, ""); } @@ -3455,10 +3477,10 @@ Logs the molecular oxygen mixing ratio. */ void WriteMolecOxygenMixingRatio(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, - int iBody, double *dTmp, char cUnit[]) { + int iBody, double *dTmp, char **cUnit) { *dTmp = fdMolecOxygenMixingRatio(body[iBody].dSurfaceWaterMass, body[iBody].dOxygenMass); - strcpy(cUnit, ""); + fvFormattedString(cUnit, ""); } /** @@ -3476,10 +3498,10 @@ Logs the water mixing ratio. */ void WriteWaterAtmMixingRatio(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, - int iBody, double *dTmp, char cUnit[]) { + int iBody, double *dTmp, char **cUnit) { *dTmp = fdWaterAtmMixingRatio(body[iBody].dSurfaceWaterMass, body[iBody].dOxygenMass); - strcpy(cUnit, ""); + fvFormattedString(cUnit, ""); } /** @@ -3490,178 +3512,178 @@ Set up stuff to be logged for atmesc. */ void InitializeOutputAtmEsc(OUTPUT *output, fnWriteOutput fnWrite[]) { - sprintf(output[OUT_SURFACEWATERMASS].cName, "SurfWaterMass"); - sprintf(output[OUT_SURFACEWATERMASS].cDescr, "Surface water mass"); - sprintf(output[OUT_SURFACEWATERMASS].cNeg, "TO"); + fvFormattedString(&output[OUT_SURFACEWATERMASS].cName, "SurfWaterMass"); + fvFormattedString(&output[OUT_SURFACEWATERMASS].cDescr, "Surface water mass"); + fvFormattedString(&output[OUT_SURFACEWATERMASS].cNeg, "TO"); output[OUT_SURFACEWATERMASS].bNeg = 1; output[OUT_SURFACEWATERMASS].dNeg = 1. / TOMASS; output[OUT_SURFACEWATERMASS].iNum = 1; output[OUT_SURFACEWATERMASS].iModuleBit = ATMESC; fnWrite[OUT_SURFACEWATERMASS] = &WriteSurfaceWaterMass; - sprintf(output[OUT_PLANETRADIUS].cName, "PlanetRadius"); - sprintf(output[OUT_PLANETRADIUS].cDescr, "Planet radius"); - sprintf(output[OUT_PLANETRADIUS].cNeg, "Rearth"); + fvFormattedString(&output[OUT_PLANETRADIUS].cName, "PlanetRadius"); + fvFormattedString(&output[OUT_PLANETRADIUS].cDescr, "Planet radius"); + fvFormattedString(&output[OUT_PLANETRADIUS].cNeg, "Rearth"); output[OUT_PLANETRADIUS].bNeg = 1; output[OUT_PLANETRADIUS].dNeg = 1. / REARTH; output[OUT_PLANETRADIUS].iNum = 1; output[OUT_PLANETRADIUS].iModuleBit = ATMESC; fnWrite[OUT_PLANETRADIUS] = &WritePlanetRadius; - sprintf(output[OUT_OXYGENMASS].cName, "OxygenMass"); - sprintf(output[OUT_OXYGENMASS].cDescr, "Oxygen mass in the atmosphere"); - sprintf(output[OUT_OXYGENMASS].cNeg, "bars"); + fvFormattedString(&output[OUT_OXYGENMASS].cName, "OxygenMass"); + fvFormattedString(&output[OUT_OXYGENMASS].cDescr, "Oxygen mass in the atmosphere"); + fvFormattedString(&output[OUT_OXYGENMASS].cNeg, "bars"); output[OUT_OXYGENMASS].bNeg = 1; output[OUT_OXYGENMASS].dNeg = 1; output[OUT_OXYGENMASS].iNum = 1; output[OUT_OXYGENMASS].iModuleBit = ATMESC; fnWrite[OUT_OXYGENMASS] = &WriteOxygenMass; - sprintf(output[OUT_OXYGENMANTLEMASS].cName, "OxygenMantleMass"); - sprintf(output[OUT_OXYGENMANTLEMASS].cDescr, "Mass of oxygen in mantle"); - sprintf(output[OUT_OXYGENMANTLEMASS].cNeg, "bars"); + fvFormattedString(&output[OUT_OXYGENMANTLEMASS].cName, "OxygenMantleMass"); + fvFormattedString(&output[OUT_OXYGENMANTLEMASS].cDescr, "Mass of oxygen in mantle"); + fvFormattedString(&output[OUT_OXYGENMANTLEMASS].cNeg, "bars"); output[OUT_OXYGENMANTLEMASS].bNeg = 1; output[OUT_OXYGENMANTLEMASS].dNeg = 1; output[OUT_OXYGENMANTLEMASS].iNum = 1; output[OUT_OXYGENMANTLEMASS].iModuleBit = ATMESC; fnWrite[OUT_OXYGENMANTLEMASS] = &WriteOxygenMantleMass; - sprintf(output[OUT_RGLIMIT].cName, "RGLimit"); - sprintf(output[OUT_RGLIMIT].cDescr, "Runaway greenhouse semi-major axis"); - sprintf(output[OUT_RGLIMIT].cNeg, "AU"); + fvFormattedString(&output[OUT_RGLIMIT].cName, "RGLimit"); + fvFormattedString(&output[OUT_RGLIMIT].cDescr, "Runaway greenhouse semi-major axis"); + fvFormattedString(&output[OUT_RGLIMIT].cNeg, "AU"); output[OUT_RGLIMIT].bNeg = 1; output[OUT_RGLIMIT].dNeg = 1. / AUM; output[OUT_RGLIMIT].iNum = 1; output[OUT_RGLIMIT].iModuleBit = ATMESC; fnWrite[OUT_RGLIMIT] = &WriteRGLimit; - sprintf(output[OUT_XO].cName, "XO"); - sprintf(output[OUT_XO].cDescr, + fvFormattedString(&output[OUT_XO].cName, "XO"); + fvFormattedString(&output[OUT_XO].cDescr, "Atomic oxygen mixing ratio in upper atmosphere"); output[OUT_XO].bNeg = 0; output[OUT_XO].iNum = 1; output[OUT_XO].iModuleBit = ATMESC; fnWrite[OUT_XO] = &WriteOxygenMixingRatio; - sprintf(output[OUT_ETAO].cName, "EtaO"); - sprintf(output[OUT_ETAO].cDescr, + fvFormattedString(&output[OUT_ETAO].cName, "EtaO"); + fvFormattedString(&output[OUT_ETAO].cDescr, "Oxygen eta parameter (Luger and Barnes 2015)"); output[OUT_ETAO].bNeg = 0; output[OUT_ETAO].iNum = 1; output[OUT_ETAO].iModuleBit = ATMESC; fnWrite[OUT_ETAO] = &WriteOxygenEta; - sprintf(output[OUT_KTIDE].cName, "KTide"); - sprintf(output[OUT_KTIDE].cDescr, + fvFormattedString(&output[OUT_KTIDE].cName, "KTide"); + fvFormattedString(&output[OUT_KTIDE].cDescr, "Mass loss enhancement due to stellar gravity"); output[OUT_KTIDE].bNeg = 0; output[OUT_KTIDE].iNum = 1; output[OUT_KTIDE].iModuleBit = ATMESC; fnWrite[OUT_KTIDE] = &WriteKTide; - sprintf(output[OUT_EPSH2O].cName, "AtmXAbsEffH2O"); - sprintf(output[OUT_EPSH2O].cDescr, + fvFormattedString(&output[OUT_EPSH2O].cName, "AtmXAbsEffH2O"); + fvFormattedString(&output[OUT_EPSH2O].cDescr, "XUV atmospheric escape efficiency for H2O"); output[OUT_EPSH2O].bNeg = 0; output[OUT_EPSH2O].iNum = 1; output[OUT_EPSH2O].iModuleBit = ATMESC; fnWrite[OUT_EPSH2O] = &WriteAtmXAbsEffH2O; - sprintf(output[OUT_ENVELOPEMASS].cName, "EnvelopeMass"); - sprintf(output[OUT_ENVELOPEMASS].cDescr, "Envelope mass"); - sprintf(output[OUT_ENVELOPEMASS].cNeg, "Mearth"); + fvFormattedString(&output[OUT_ENVELOPEMASS].cName, "EnvelopeMass"); + fvFormattedString(&output[OUT_ENVELOPEMASS].cDescr, "Envelope mass"); + fvFormattedString(&output[OUT_ENVELOPEMASS].cNeg, "Mearth"); output[OUT_ENVELOPEMASS].bNeg = 1; output[OUT_ENVELOPEMASS].dNeg = 1. / MEARTH; output[OUT_ENVELOPEMASS].iNum = 1; output[OUT_ENVELOPEMASS].iModuleBit = ATMESC; fnWrite[OUT_ENVELOPEMASS] = &WriteEnvelopeMass; - sprintf(output[OUT_PLANETRADXUV].cName, "RadXUV"); - sprintf(output[OUT_PLANETRADXUV].cDescr, + fvFormattedString(&output[OUT_PLANETRADXUV].cName, "RadXUV"); + fvFormattedString(&output[OUT_PLANETRADXUV].cDescr, "XUV radius separating hydro. dyn. escape and equilibrium"); - sprintf(output[OUT_PLANETRADXUV].cNeg, "Rearth"); + fvFormattedString(&output[OUT_PLANETRADXUV].cNeg, "Rearth"); output[OUT_PLANETRADXUV].bNeg = 1; output[OUT_PLANETRADXUV].dNeg = 1. / REARTH; output[OUT_PLANETRADXUV].iNum = 1; output[OUT_PLANETRADXUV].iModuleBit = ATMESC; fnWrite[OUT_PLANETRADXUV] = &WritePlanetRadXUV; - sprintf(output[OUT_BONDIRADIUS].cName, "BondiRadius"); - sprintf(output[OUT_BONDIRADIUS].cDescr, "Bondi Radius"); + fvFormattedString(&output[OUT_BONDIRADIUS].cName, "BondiRadius"); + fvFormattedString(&output[OUT_BONDIRADIUS].cDescr, "Bondi Radius"); output[OUT_BONDIRADIUS].bNeg = 1; - sprintf(output[OUT_BONDIRADIUS].cNeg, "Rearth"); + fvFormattedString(&output[OUT_BONDIRADIUS].cNeg, "Rearth"); output[OUT_BONDIRADIUS].dNeg = 1. / REARTH; output[OUT_BONDIRADIUS].iNum = 1; output[OUT_BONDIRADIUS].iModuleBit = ATMESC; fnWrite[OUT_BONDIRADIUS] = &WriteBondiRadius; - sprintf(output[OUT_ROCHERADIUS].cName, "RocheRadius"); - sprintf(output[OUT_ROCHERADIUS].cDescr, "Roche Lobe Radius"); + fvFormattedString(&output[OUT_ROCHERADIUS].cName, "RocheRadius"); + fvFormattedString(&output[OUT_ROCHERADIUS].cDescr, "Roche Lobe Radius"); output[OUT_ROCHERADIUS].bNeg = 1; - sprintf(output[OUT_ROCHERADIUS].cNeg, "Rearth"); + fvFormattedString(&output[OUT_ROCHERADIUS].cNeg, "Rearth"); output[OUT_ROCHERADIUS].dNeg = 1. / REARTH; output[OUT_ROCHERADIUS].iNum = 1; output[OUT_ROCHERADIUS].iModuleBit = ATMESC; fnWrite[OUT_ROCHERADIUS] = &WriteRocheRadius; - sprintf(output[OUT_DENVMASSDT].cName, "DEnvMassDt"); - sprintf(output[OUT_DENVMASSDT].cDescr, "Envelope Mass Loss Rate"); - sprintf(output[OUT_DENVMASSDT].cNeg, "Mearth/Myr"); + fvFormattedString(&output[OUT_DENVMASSDT].cName, "DEnvMassDt"); + fvFormattedString(&output[OUT_DENVMASSDT].cDescr, "Envelope Mass Loss Rate"); + fvFormattedString(&output[OUT_DENVMASSDT].cNeg, "Mearth/Myr"); output[OUT_DENVMASSDT].bNeg = 1; output[OUT_DENVMASSDT].dNeg = (YEARSEC * 1e6) / MEARTH; output[OUT_DENVMASSDT].iNum = 1; output[OUT_DENVMASSDT].iModuleBit = ATMESC; fnWrite[OUT_DENVMASSDT] = &WriteDEnvMassDt; - sprintf(output[OUT_THERMTEMP].cName, "ThermTemp"); - sprintf(output[OUT_THERMTEMP].cDescr, "Isothermal atmospheric temperature"); - sprintf(output[OUT_THERMTEMP].cNeg, "K"); + fvFormattedString(&output[OUT_THERMTEMP].cName, "ThermTemp"); + fvFormattedString(&output[OUT_THERMTEMP].cDescr, "Isothermal atmospheric temperature"); + fvFormattedString(&output[OUT_THERMTEMP].cNeg, "K"); output[OUT_THERMTEMP].bNeg = 1; output[OUT_THERMTEMP].dNeg = 1; // default units are K. output[OUT_THERMTEMP].iNum = 1; output[OUT_THERMTEMP].iModuleBit = ATMESC; fnWrite[OUT_THERMTEMP] = &WriteThermTemp; - sprintf(output[OUT_PRESSURF].cName, "PresSurf"); - sprintf(output[OUT_PRESSURF].cDescr, "Surface pressure due to atmosphere"); - sprintf(output[OUT_PRESSURF].cNeg, "GPa"); + fvFormattedString(&output[OUT_PRESSURF].cName, "PresSurf"); + fvFormattedString(&output[OUT_PRESSURF].cDescr, "Surface pressure due to atmosphere"); + fvFormattedString(&output[OUT_PRESSURF].cNeg, "GPa"); output[OUT_PRESSURF].bNeg = 1; output[OUT_PRESSURF].dNeg = 1e-9; output[OUT_PRESSURF].iNum = 1; output[OUT_PRESSURF].iModuleBit = ATMESC; fnWrite[OUT_PRESSURF] = &WritePresSurf; - sprintf(output[OUT_PRESXUV].cName, "PresXUV"); - sprintf(output[OUT_PRESXUV].cDescr, "Pressure at base of thermosphere"); - sprintf(output[OUT_PRESXUV].cNeg, "Pa"); + fvFormattedString(&output[OUT_PRESXUV].cName, "PresXUV"); + fvFormattedString(&output[OUT_PRESXUV].cDescr, "Pressure at base of thermosphere"); + fvFormattedString(&output[OUT_PRESXUV].cNeg, "Pa"); output[OUT_PRESXUV].bNeg = 1; output[OUT_PRESXUV].dNeg = 1; output[OUT_PRESXUV].iNum = 1; output[OUT_PRESXUV].iModuleBit = ATMESC; fnWrite[OUT_PRESXUV] = &WritePresXUV; - sprintf(output[OUT_SCALEHEIGHT].cName, "ScaleHeight"); - sprintf(output[OUT_SCALEHEIGHT].cDescr, + fvFormattedString(&output[OUT_SCALEHEIGHT].cName, "ScaleHeight"); + fvFormattedString(&output[OUT_SCALEHEIGHT].cDescr, "Scale height in Lehmer & Catling (2016) model"); - sprintf(output[OUT_SCALEHEIGHT].cNeg, "km"); + fvFormattedString(&output[OUT_SCALEHEIGHT].cNeg, "km"); output[OUT_SCALEHEIGHT].bNeg = 1; output[OUT_SCALEHEIGHT].dNeg = 0.001; output[OUT_SCALEHEIGHT].iNum = 1; output[OUT_SCALEHEIGHT].iModuleBit = ATMESC; fnWrite[OUT_SCALEHEIGHT] = &WriteScaleHeight; - sprintf(output[OUT_ATMGASCONST].cName, "AtmGasConst"); - sprintf(output[OUT_ATMGASCONST].cDescr, "Atmospheric gas constant"); - sprintf(output[OUT_ATMGASCONST].cNeg, "J / K kg"); + fvFormattedString(&output[OUT_ATMGASCONST].cName, "AtmGasConst"); + fvFormattedString(&output[OUT_ATMGASCONST].cDescr, "Atmospheric gas constant"); + fvFormattedString(&output[OUT_ATMGASCONST].cNeg, "J / K kg"); output[OUT_ATMGASCONST].bNeg = 1; output[OUT_ATMGASCONST].dNeg = 1; output[OUT_ATMGASCONST].iNum = 1; output[OUT_ATMGASCONST].iModuleBit = ATMESC; fnWrite[OUT_ATMGASCONST] = &WriteAtmGasConst; - sprintf(output[OUT_RADSOLID].cName, "RadSolid"); - sprintf(output[OUT_RADSOLID].cDescr, "Radius to the solid surface"); - sprintf(output[OUT_RADSOLID].cNeg, "Rearth"); + fvFormattedString(&output[OUT_RADSOLID].cName, "RadSolid"); + fvFormattedString(&output[OUT_RADSOLID].cDescr, "Radius to the solid surface"); + fvFormattedString(&output[OUT_RADSOLID].cNeg, "Rearth"); output[OUT_RADSOLID].bNeg = 1; output[OUT_RADSOLID].dNeg = 1. / REARTH; output[OUT_RADSOLID].iNum = 1; @@ -3669,102 +3691,94 @@ void InitializeOutputAtmEsc(OUTPUT *output, fnWriteOutput fnWrite[]) { fnWrite[OUT_RADSOLID] = &WriteRadSolid; // What the difference between this and XUVFlux? - sprintf(output[OUT_FXUV].cName, "FXUV"); - sprintf(output[OUT_FXUV].cDescr, "XUV flux"); - sprintf(output[OUT_FXUV].cNeg, "W/m^2"); + fvFormattedString(&output[OUT_FXUV].cName, "FXUV"); + fvFormattedString(&output[OUT_FXUV].cDescr, "XUV flux"); + fvFormattedString(&output[OUT_FXUV].cNeg, "W/m^2"); output[OUT_FXUV].bNeg = 1; output[OUT_FXUV].dNeg = 1; output[OUT_FXUV].iNum = 1; output[OUT_FXUV].iModuleBit = ATMESC; fnWrite[OUT_FXUV] = &WriteFXUV; - sprintf(output[OUT_HESCAPEREGIME].cName, "HEscapeRegime"); - sprintf(output[OUT_HESCAPEREGIME].cDescr, + fvFormattedString(&output[OUT_HESCAPEREGIME].cName, "HEscapeRegime"); + fvFormattedString(&output[OUT_HESCAPEREGIME].cDescr, "Integer flag for H envelope escape regime"); output[OUT_HESCAPEREGIME].bNeg = 0; output[OUT_HESCAPEREGIME].iNum = 1; output[OUT_HESCAPEREGIME].iModuleBit = ATMESC; fnWrite[OUT_HESCAPEREGIME] = &WriteHEscapeRegime; - sprintf(output[OUT_RRCRITICALFLUX].cName, "RRCriticalFlux"); - sprintf(output[OUT_RRCRITICALFLUX].cDescr, + fvFormattedString(&output[OUT_RRCRITICALFLUX].cName, "RRCriticalFlux"); + fvFormattedString(&output[OUT_RRCRITICALFLUX].cDescr, "Critical XUV Flux that separates RR and energy-limited escape"); - sprintf(output[OUT_RRCRITICALFLUX].cNeg, "W/m^2"); + fvFormattedString(&output[OUT_RRCRITICALFLUX].cNeg, "W/m^2"); output[OUT_RRCRITICALFLUX].bNeg = 1; output[OUT_RRCRITICALFLUX].dNeg = 1; output[OUT_RRCRITICALFLUX].iNum = 1; output[OUT_RRCRITICALFLUX].iModuleBit = ATMESC; fnWrite[OUT_RRCRITICALFLUX] = &WriteRRCriticalFlux; - /** Megan addition: crossover mass */ - sprintf(output[OUT_CROSSOVERMASS].cName, "CrossoverMass"); - sprintf(output[OUT_CROSSOVERMASS].cDescr, + fvFormattedString(&output[OUT_CROSSOVERMASS].cName, "CrossoverMass"); + fvFormattedString(&output[OUT_CROSSOVERMASS].cDescr, "Crossover mass, defines oxygen is escaping if mc > mo"); - sprintf(output[OUT_CROSSOVERMASS].cNeg, "amu"); + fvFormattedString(&output[OUT_CROSSOVERMASS].cNeg, "amu"); output[OUT_CROSSOVERMASS].bNeg = 1; output[OUT_CROSSOVERMASS].dNeg = 1. / ATOMMASS; output[OUT_CROSSOVERMASS].iNum = 1; output[OUT_CROSSOVERMASS].iModuleBit = ATMESC; fnWrite[OUT_CROSSOVERMASS] = &WriteCrossoverMass; - /** Megan addition: water escape regime */ - sprintf(output[OUT_WATERESCAPEREGIME].cName, "WaterEscapeRegime"); - sprintf(output[OUT_WATERESCAPEREGIME].cDescr, + fvFormattedString(&output[OUT_WATERESCAPEREGIME].cName, "WaterEscapeRegime"); + fvFormattedString(&output[OUT_WATERESCAPEREGIME].cDescr, "What water escape regime the code is currently in"); output[OUT_WATERESCAPEREGIME].bNeg = 0; output[OUT_WATERESCAPEREGIME].iNum = 1; output[OUT_WATERESCAPEREGIME].iModuleBit = ATMESC; fnWrite[OUT_WATERESCAPEREGIME] = &WriteWaterEscapeRegime; - /** Megan addition: modifier to H ref flux to include O drag */ - sprintf(output[OUT_HREFODRAGMOD].cName, "HRefODragMod"); - sprintf(output[OUT_HREFODRAGMOD].cDescr, + fvFormattedString(&output[OUT_HREFODRAGMOD].cName, "HRefODragMod"); + fvFormattedString(&output[OUT_HREFODRAGMOD].cDescr, "Multiply by H ref flux to get flux with drag"); output[OUT_HREFODRAGMOD].bNeg = 0; output[OUT_HREFODRAGMOD].iNum = 1; output[OUT_HREFODRAGMOD].iModuleBit = ATMESC; fnWrite[OUT_HREFODRAGMOD] = &WriteHRefODragMod; - /** Megan addition: FXUVCRITDRAG for LS16 model */ - sprintf(output[OUT_FXUVCRITDRAG].cName, "FXUVCRITDRAG"); - sprintf(output[OUT_FXUVCRITDRAG].cDescr, "Critical Drag XUV flux"); - sprintf(output[OUT_FXUVCRITDRAG].cNeg, "W/m^2"); + fvFormattedString(&output[OUT_FXUVCRITDRAG].cName, "FXUVCRITDRAG"); + fvFormattedString(&output[OUT_FXUVCRITDRAG].cDescr, "Critical Drag XUV flux"); + fvFormattedString(&output[OUT_FXUVCRITDRAG].cNeg, "W/m^2"); output[OUT_FXUVCRITDRAG].bNeg = 1; output[OUT_FXUVCRITDRAG].dNeg = 1; output[OUT_FXUVCRITDRAG].iNum = 1; output[OUT_FXUVCRITDRAG].iModuleBit = ATMESC; fnWrite[OUT_FXUVCRITDRAG] = &WriteFXUVCRITDRAG; - /** Megan addition: Hydrogen Reference Flux */ - sprintf(output[OUT_HREFFLUX].cName, "HREFFLUX"); - sprintf(output[OUT_HREFFLUX].cDescr, + fvFormattedString(&output[OUT_HREFFLUX].cName, "HREFFLUX"); + fvFormattedString(&output[OUT_HREFFLUX].cDescr, "The Hydrogen Reference Flux (m^-2 s^-1)"); output[OUT_HREFFLUX].bNeg = 0; output[OUT_HREFFLUX].iNum = 1; output[OUT_HREFFLUX].iModuleBit = ATMESC; fnWrite[OUT_HREFFLUX] = &WriteHREFFLUX; - /** Megan addition: Hydrogen Diffusion Flux */ - sprintf(output[OUT_HDIFFFLUX].cName, "HDiffFlux"); - sprintf(output[OUT_HDIFFFLUX].cDescr, + fvFormattedString(&output[OUT_HDIFFFLUX].cName, "HDiffFlux"); + fvFormattedString(&output[OUT_HDIFFFLUX].cDescr, "The Hydrogen Diffusion Flux (m^-2 s^-1)"); output[OUT_HDIFFFLUX].bNeg = 0; output[OUT_HDIFFFLUX].iNum = 1; output[OUT_HDIFFFLUX].iModuleBit = ATMESC; fnWrite[OUT_HDIFFFLUX] = &WriteHDiffLimFlux; - /** Megan addition: Molecular Oxygen Mixing Ratio */ - sprintf(output[OUT_XO2].cName, "XO2"); - sprintf(output[OUT_XO2].cDescr, + fvFormattedString(&output[OUT_XO2].cName, "XO2"); + fvFormattedString(&output[OUT_XO2].cDescr, "Molecular oxygen mixing ratio in atmosphere"); output[OUT_XO2].bNeg = 0; output[OUT_XO2].iNum = 1; output[OUT_XO2].iModuleBit = ATMESC; fnWrite[OUT_XO2] = &WriteMolecOxygenMixingRatio; - /** Megan addition: Water Mixing Ratio in Atmosphere before condensation */ - sprintf(output[OUT_XH2O].cName, "XH2O"); - sprintf(output[OUT_XH2O].cDescr, "Water mixing ratio in upper atmosphere"); + fvFormattedString(&output[OUT_XH2O].cName, "XH2O"); + fvFormattedString(&output[OUT_XH2O].cDescr, "Water mixing ratio in upper atmosphere"); output[OUT_XH2O].bNeg = 0; output[OUT_XH2O].iNum = 1; output[OUT_XH2O].iModuleBit = ATMESC; diff --git a/src/atmesc.h b/src/atmesc.h index 629cb236c..bb4392110 100644 --- a/src/atmesc.h +++ b/src/atmesc.h @@ -177,29 +177,29 @@ void InitializeOutputFunctionAtmEsc(OUTPUT *, int, int); void FinalizeOutputFunctionAtmEsc(OUTPUT *, int, int); void WriteSurfaceWaterMass(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, - UPDATE *, int, double *, char[]); + UPDATE *, int, double *, char**); void WriteOxygenMass(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, UPDATE *, - int, double *, char[]); + int, double *, char**); void WriteOxygenMantleMass(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, - UPDATE *, int, double *, char[]); + UPDATE *, int, double *, char**); void WriteEnvelopeMass(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, UPDATE *, - int, double *, char[]); + int, double *, char**); void WriteRGLimit(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, UPDATE *, int, - double *, char[]); + double *, char**); void WriteBondiRadius(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, UPDATE *, - int, double *, char[]); + int, double *, char**); void WriteRocheRadius(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, UPDATE *, - int, double *, char[]); + int, double *, char**); void WriteOxygenMixingRatio(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, - UPDATE *, int, double *, char[]); + UPDATE *, int, double *, char**); void WriteOxygenEta(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, UPDATE *, - int, double *, char[]); + int, double *, char**); void WriteAtmXAbsEffH2O(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, - UPDATE *, int, double *, char[]); + UPDATE *, int, double *, char**); void WriteRRCriticalFlux(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, - UPDATE *, int, double *, char[]); + UPDATE *, int, double *, char**); void WriteHEscapeRegime(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, - UPDATE *, int, double *, char[]); + UPDATE *, int, double *, char**); /* Logging Functions */ void LogOptionsAtmEsc(CONTROL *, FILE *); diff --git a/src/binary.c b/src/binary.c index 8d061db13..af19513c3 100644 --- a/src/binary.c +++ b/src/binary.c @@ -416,68 +416,68 @@ void ReadHaltRocheLobe(BODY *body, CONTROL *control, FILES *files, void InitializeOptionsBinary(OPTIONS *options, fnReadOption fnRead[]) { int iOpt, iFile; - sprintf(options[OPT_FREEECC].cName, "dFreeEcc"); - sprintf(options[OPT_FREEECC].cDescr, "Circumbinary planet free eccentricity"); - sprintf(options[OPT_FREEECC].cDefault, "0.0"); - sprintf(options[OPT_FREEECC].cDimension, "nd"); + fvFormattedString(&options[OPT_FREEECC].cName, "dFreeEcc"); + fvFormattedString(&options[OPT_FREEECC].cDescr, "Circumbinary planet free eccentricity"); + fvFormattedString(&options[OPT_FREEECC].cDefault, "0.0"); + fvFormattedString(&options[OPT_FREEECC].cDimension, "nd"); options[OPT_FREEECC].dDefault = 0.0; options[OPT_FREEECC].iType = 2; options[OPT_FREEECC].bMultiFile = 1; fnRead[OPT_FREEECC] = &ReadFreeEcc; - sprintf(options[OPT_FREEECC].cLongDescr, + fvFormattedString(&options[OPT_FREEECC].cLongDescr, "The free eccentricity of a circumbinary planet with the BINARY " "module.\n" "Must be in the range [0,1)."); - sprintf(options[OPT_FREEINC].cName, "dFreeInc"); - sprintf(options[OPT_FREEINC].cDescr, "Circumbinary planet free inclination"); - sprintf(options[OPT_FREEINC].cDefault, "0.0 degrees"); - sprintf(options[OPT_FREEINC].cDimension, "angle"); + fvFormattedString(&options[OPT_FREEINC].cName, "dFreeInc"); + fvFormattedString(&options[OPT_FREEINC].cDescr, "Circumbinary planet free inclination"); + fvFormattedString(&options[OPT_FREEINC].cDefault, "0.0 degrees"); + fvFormattedString(&options[OPT_FREEINC].cDimension, "angle"); options[OPT_FREEINC].dDefault = 0.0; options[OPT_FREEINC].iType = 2; options[OPT_FREEINC].bMultiFile = 1; fnRead[OPT_FREEINC] = &ReadFreeInc; - sprintf(options[OPT_FREEINC].cLongDescr, + fvFormattedString(&options[OPT_FREEINC].cLongDescr, "The free inclination of a circumbinary planet with the BINARY " "module.\n" "Must be in the range [0,pi)."); - sprintf(options[OPT_LL13PHIAB].cName, "dLL13PhiAB"); - sprintf(options[OPT_LL13PHIAB].cDescr, + fvFormattedString(&options[OPT_LL13PHIAB].cName, "dLL13PhiAB"); + fvFormattedString(&options[OPT_LL13PHIAB].cDescr, "Binary Initial Mean Anomaly for use in the BINARY module"); - sprintf(options[OPT_LL13PHIAB].cDefault, "0.0 degrees"); - sprintf(options[OPT_LL13PHIAB].cDimension, "angle"); + fvFormattedString(&options[OPT_LL13PHIAB].cDefault, "0.0 degrees"); + fvFormattedString(&options[OPT_LL13PHIAB].cDimension, "angle"); options[OPT_LL13PHIAB].dDefault = 0.0; options[OPT_LL13PHIAB].iType = 2; options[OPT_LL13PHIAB].bMultiFile = 1; fnRead[OPT_LL13PHIAB] = &ReadLL13PhiAB; - sprintf(options[OPT_CBPM0].cName, "dCBPM0"); - sprintf(options[OPT_CBPM0].cDescr, + fvFormattedString(&options[OPT_CBPM0].cName, "dCBPM0"); + fvFormattedString(&options[OPT_CBPM0].cDescr, "Circumbinary planet initial mean anomaly for use in the BINARY " "module"); - sprintf(options[OPT_CBPM0].cDefault, "0.0 degrees"); - sprintf(options[OPT_CBPM0].cDimension, "angle"); + fvFormattedString(&options[OPT_CBPM0].cDefault, "0.0 degrees"); + fvFormattedString(&options[OPT_CBPM0].cDimension, "angle"); options[OPT_CBPM0].dDefault = 0.0; options[OPT_CBPM0].iType = 2; options[OPT_CBPM0].bMultiFile = 1; fnRead[OPT_CBPM0] = &ReadCBPM0; - sprintf(options[OPT_CBPZETA].cName, "dCBPZeta"); - sprintf(options[OPT_CBPZETA].cDescr, + fvFormattedString(&options[OPT_CBPZETA].cName, "dCBPZeta"); + fvFormattedString(&options[OPT_CBPZETA].cDescr, "Circumbinary planet initial z oscillation phase angle"); - sprintf(options[OPT_CBPZETA].cDefault, "0.0 degrees"); - sprintf(options[OPT_CBPZETA].cDimension, "angle"); + fvFormattedString(&options[OPT_CBPZETA].cDefault, "0.0 degrees"); + fvFormattedString(&options[OPT_CBPZETA].cDimension, "angle"); options[OPT_CBPZETA].dDefault = 0.0; options[OPT_CBPZETA].iType = 2; options[OPT_CBPZETA].bMultiFile = 1; fnRead[OPT_CBPZETA] = &ReadCBPZeta; - sprintf(options[OPT_CBPPSI].cName, "dCBPPsi"); - sprintf(options[OPT_CBPPSI].cDescr, + fvFormattedString(&options[OPT_CBPPSI].cName, "dCBPPsi"); + fvFormattedString(&options[OPT_CBPPSI].cDescr, "Circumbinary planet initial R, phi oscillation phase angle"); - sprintf(options[OPT_CBPPSI].cDefault, "0.0 degrees"); - sprintf(options[OPT_CBPPSI].cDimension, "angle"); + fvFormattedString(&options[OPT_CBPPSI].cDefault, "0.0 degrees"); + fvFormattedString(&options[OPT_CBPPSI].cDimension, "angle"); options[OPT_CBPPSI].dDefault = 0.0; options[OPT_CBPPSI].iType = 2; options[OPT_CBPPSI].bMultiFile = 1; @@ -489,52 +489,52 @@ void InitializeOptionsBinary(OPTIONS *options, fnReadOption fnRead[]) { * order modifications to the theory are added. */ - sprintf(options[OPT_LL13N0].cName, "dLL13N0"); - sprintf(options[OPT_LL13N0].cDescr, "Lee+Leung 2013 Mean Motion"); - sprintf(options[OPT_LL13N0].cDefault, "1 /yr"); - sprintf(options[OPT_LL13N0].cDimension, "time^-1"); + fvFormattedString(&options[OPT_LL13N0].cName, "dLL13N0"); + fvFormattedString(&options[OPT_LL13N0].cDescr, "Lee+Leung 2013 Mean Motion"); + fvFormattedString(&options[OPT_LL13N0].cDefault, "1 /yr"); + fvFormattedString(&options[OPT_LL13N0].cDimension, "time^-1"); options[OPT_LL13N0].dDefault = 1. / YEARSEC; options[OPT_LL13N0].iType = 2; options[OPT_LL13N0].bMultiFile = 1; options[OPT_LL13N0].dNeg = 1. / YEARSEC; - sprintf(options[OPT_LL13N0].cNeg, "/Year"); + fvFormattedString(&options[OPT_LL13N0].cNeg, "/Year"); fnRead[OPT_LL13N0] = &ReadLL13N0; - sprintf(options[OPT_LL13K0].cName, "dLL13K0"); - sprintf(options[OPT_LL13K0].cDescr, + fvFormattedString(&options[OPT_LL13K0].cName, "dLL13K0"); + fvFormattedString(&options[OPT_LL13K0].cDescr, "Lee+Leung 2013 Radial Epicyclic Frequency"); - sprintf(options[OPT_LL13K0].cDefault, "1 /yr"); - sprintf(options[OPT_LL13K0].cDimension, "time^-1"); + fvFormattedString(&options[OPT_LL13K0].cDefault, "1 /yr"); + fvFormattedString(&options[OPT_LL13K0].cDimension, "time^-1"); options[OPT_LL13K0].dDefault = 1. / YEARSEC; options[OPT_LL13K0].iType = 2; options[OPT_LL13K0].bMultiFile = 1; options[OPT_LL13K0].dNeg = 1. / YEARSEC; - sprintf(options[OPT_LL13K0].cNeg, "/Year"); + fvFormattedString(&options[OPT_LL13K0].cNeg, "/Year"); fnRead[OPT_LL13K0] = &ReadLL13K0; - sprintf(options[OPT_LL13V0].cName, "dLL13V0"); - sprintf(options[OPT_LL13V0].cDescr, + fvFormattedString(&options[OPT_LL13V0].cName, "dLL13V0"); + fvFormattedString(&options[OPT_LL13V0].cDescr, "Lee+Leung 2013 Radial Epicyclic Frequency"); - sprintf(options[OPT_LL13V0].cDefault, "1 /yr"); - sprintf(options[OPT_LL13V0].cDimension, "time^-1"); + fvFormattedString(&options[OPT_LL13V0].cDefault, "1 /yr"); + fvFormattedString(&options[OPT_LL13V0].cDimension, "time^-1"); options[OPT_LL13V0].dDefault = 1. / YEARSEC; options[OPT_LL13V0].iType = 2; options[OPT_LL13V0].bMultiFile = 1; options[OPT_LL13V0].dNeg = 1. / YEARSEC; - sprintf(options[OPT_LL13V0].cNeg, "/Year"); + fvFormattedString(&options[OPT_LL13V0].cNeg, "/Year"); fnRead[OPT_LL13V0] = &ReadLL13V0; - sprintf(options[OPT_HALTHOLMAN].cName, "bHaltHolmanUnstable"); - sprintf(options[OPT_HALTHOLMAN].cDescr, + fvFormattedString(&options[OPT_HALTHOLMAN].cName, "bHaltHolmanUnstable"); + fvFormattedString(&options[OPT_HALTHOLMAN].cDescr, "Halt when CBP is Holman-Wiegert Unstable?"); - sprintf(options[OPT_HALTHOLMAN].cDefault, "0"); + fvFormattedString(&options[OPT_HALTHOLMAN].cDefault, "0"); options[OPT_HALTHOLMAN].iType = 0; fnRead[OPT_HALTHOLMAN] = &ReadHaltHolmanUnstable; - sprintf(options[OPT_HALTROCHELOBE].cName, "bHaltRocheLobe"); - sprintf(options[OPT_HALTROCHELOBE].cDescr, + fvFormattedString(&options[OPT_HALTROCHELOBE].cName, "bHaltRocheLobe"); + fvFormattedString(&options[OPT_HALTROCHELOBE].cDescr, "Halt when Roche lobe crossing occurs?"); - sprintf(options[OPT_HALTROCHELOBE].cDefault, "0"); + fvFormattedString(&options[OPT_HALTROCHELOBE].cDefault, "0"); options[OPT_HALTROCHELOBE].iType = 0; fnRead[OPT_HALTROCHELOBE] = &ReadHaltRocheLobe; } @@ -1018,7 +1018,7 @@ void VerifyHaltBinary(BODY *body, CONTROL *control, OPTIONS *options, int iBody, void WriteFreeEccBinary(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, - double *dTmp, char cUnit[]) { + double *dTmp, char **cUnit) { // Note: Only makes sense for planets (iBodyType == 0) if (body[iBody].iBodyType == 0) { *dTmp = body[iBody].dFreeEcc; @@ -1026,12 +1026,12 @@ void WriteFreeEccBinary(BODY *body, CONTROL *control, OUTPUT *output, *dTmp = -1; } - strcpy(cUnit, ""); + fvFormattedString(cUnit, ""); } void WriteFreeIncBinary(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, - double *dTmp, char cUnit[]) { + double *dTmp, char **cUnit) { // Note: Only makes sense for planets (iBodyType == 0) if (body[iBody].iBodyType == 0) { *dTmp = body[iBody].dFreeInc; @@ -1041,7 +1041,7 @@ void WriteFreeIncBinary(BODY *body, CONTROL *control, OUTPUT *output, if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { *dTmp /= fdUnitsAngle(units->iAngle); fsUnitsAngle(units->iAngle, cUnit); @@ -1051,7 +1051,7 @@ void WriteFreeIncBinary(BODY *body, CONTROL *control, OUTPUT *output, /** Write the binary primary star radial position */ void WriteBinPriRBinary(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, - double *dTmp, char cUnit[]) { + double *dTmp, char **cUnit) { // Compute current binary true anomaly double meanAnomaly = body[1].dMeanMotion * body[0].dAge + body[1].dLL13PhiAB; @@ -1069,7 +1069,7 @@ void WriteBinPriRBinary(BODY *body, CONTROL *control, OUTPUT *output, *dTmp = body[1].dMass * radius * dInvMass; if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { *dTmp /= fdUnitsLength(units->iLength); fsUnitsLength(units->iLength, cUnit); @@ -1079,7 +1079,7 @@ void WriteBinPriRBinary(BODY *body, CONTROL *control, OUTPUT *output, /** Write the binary secondary star radial position */ void WriteBinSecRBinary(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, - double *dTmp, char cUnit[]) { + double *dTmp, char **cUnit) { // Compute current binary true anomaly double meanAnomaly = body[1].dMeanMotion * body[1].dAge + body[1].dLL13PhiAB; @@ -1097,7 +1097,7 @@ void WriteBinSecRBinary(BODY *body, CONTROL *control, OUTPUT *output, *dTmp = body[0].dMass * radius * dInvMass; if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { *dTmp /= fdUnitsLength(units->iLength); fsUnitsLength(units->iLength, cUnit); @@ -1107,7 +1107,7 @@ void WriteBinSecRBinary(BODY *body, CONTROL *control, OUTPUT *output, void WriteBinPriPhiBinary(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, - int iBody, double *dTmp, char cUnit[]) { + int iBody, double *dTmp, char **cUnit) { // Compute current binary true anomaly double meanAnomaly = body[1].dMeanMotion * body[0].dAge + body[1].dLL13PhiAB; @@ -1117,7 +1117,7 @@ void WriteBinPriPhiBinary(BODY *body, CONTROL *control, OUTPUT *output, *dTmp = fndEccToTrue(eccAnomaly, body[1].dEcc); if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { *dTmp /= fdUnitsAngle(units->iAngle); fsUnitsAngle(units->iAngle, cUnit); @@ -1127,7 +1127,7 @@ void WriteBinPriPhiBinary(BODY *body, CONTROL *control, OUTPUT *output, void WriteBinSecPhiBinary(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, - int iBody, double *dTmp, char cUnit[]) { + int iBody, double *dTmp, char **cUnit) { // Compute current binary true anomaly double meanAnomaly = body[1].dMeanMotion * body[1].dAge + body[1].dLL13PhiAB; @@ -1138,7 +1138,7 @@ void WriteBinSecPhiBinary(BODY *body, CONTROL *control, OUTPUT *output, *dTmp = fndEccToTrue(eccAnomaly, body[1].dEcc) + PI; if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { *dTmp /= fdUnitsAngle(units->iAngle); fsUnitsAngle(units->iAngle, cUnit); @@ -1148,7 +1148,7 @@ void WriteBinSecPhiBinary(BODY *body, CONTROL *control, OUTPUT *output, void WriteCBPPhiBinary(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, - double *dTmp, char cUnit[]) { + double *dTmp, char **cUnit) { if (body[iBody].iBodyType == 0) { *dTmp = body[iBody].dCBPPhi; } else { @@ -1157,7 +1157,7 @@ void WriteCBPPhiBinary(BODY *body, CONTROL *control, OUTPUT *output, if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { *dTmp /= fdUnitsAngle(units->iAngle); fsUnitsAngle(units->iAngle, cUnit); @@ -1166,12 +1166,12 @@ void WriteCBPPhiBinary(BODY *body, CONTROL *control, OUTPUT *output, void WriteCBPPhiDotBinary(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, - int iBody, double *dTmp, char cUnit[]) { + int iBody, double *dTmp, char **cUnit) { *dTmp = body[iBody].dCBPPhiDot; if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { *dTmp *= fdUnitsTime(units->iTime); fsUnitsRate(units->iTime, cUnit); @@ -1180,7 +1180,7 @@ void WriteCBPPhiDotBinary(BODY *body, CONTROL *control, OUTPUT *output, void WriteLL13N0Binary(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, - double *dTmp, char cUnit[]) { + double *dTmp, char **cUnit) { // Note: Only applies to planets (iBodyType == 0) if (body[iBody].iBodyType == 0) { *dTmp = body[iBody].dLL13N0; @@ -1190,7 +1190,7 @@ void WriteLL13N0Binary(BODY *body, CONTROL *control, OUTPUT *output, if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { *dTmp *= fdUnitsTime(units->iTime); fsUnitsTime(units->iTime, cUnit); @@ -1200,7 +1200,7 @@ void WriteLL13N0Binary(BODY *body, CONTROL *control, OUTPUT *output, void WriteLL13K0Binary(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, - double *dTmp, char cUnit[]) { + double *dTmp, char **cUnit) { // Note: Only applies to planets (iBodyType == 0) if (body[iBody].iBodyType == 0) { *dTmp = body[iBody].dLL13K0; @@ -1210,7 +1210,7 @@ void WriteLL13K0Binary(BODY *body, CONTROL *control, OUTPUT *output, if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { *dTmp *= fdUnitsTime(units->iTime); fsUnitsTime(units->iTime, cUnit); @@ -1219,7 +1219,7 @@ void WriteLL13K0Binary(BODY *body, CONTROL *control, OUTPUT *output, void WriteLL13V0Binary(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, - double *dTmp, char cUnit[]) { + double *dTmp, char **cUnit) { // Note: Only applies to planets (iBodyType == 0) if (body[iBody].iBodyType == 0) { *dTmp = body[iBody].dLL13V0; @@ -1229,7 +1229,7 @@ void WriteLL13V0Binary(BODY *body, CONTROL *control, OUTPUT *output, if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { *dTmp *= fdUnitsTime(units->iTime); fsUnitsTime(units->iTime, cUnit); @@ -1239,12 +1239,12 @@ void WriteLL13V0Binary(BODY *body, CONTROL *control, OUTPUT *output, /** Write the circumbinary planet orbital radius (CBPR) */ void WriteCBPRBinary(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, - double *dTmp, char cUnit[]) { + double *dTmp, char **cUnit) { *dTmp = body[iBody].dCBPR; if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { *dTmp /= fdUnitsLength(units->iLength); fsUnitsLength(units->iLength, cUnit); @@ -1254,12 +1254,12 @@ void WriteCBPRBinary(BODY *body, CONTROL *control, OUTPUT *output, /** Write the circumbinary planet guiding radius (CBPR0) */ void WriteCBPR0Binary(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, - double *dTmp, char cUnit[]) { + double *dTmp, char **cUnit) { *dTmp = body[iBody].dR0; if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { *dTmp /= fdUnitsLength(units->iLength); fsUnitsLength(units->iLength, cUnit); @@ -1268,12 +1268,12 @@ void WriteCBPR0Binary(BODY *body, CONTROL *control, OUTPUT *output, void WriteCBPZBinary(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, - double *dTmp, char cUnit[]) { + double *dTmp, char **cUnit) { *dTmp = body[iBody].dCBPZ; if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { *dTmp /= fdUnitsLength(units->iLength); fsUnitsLength(units->iLength, cUnit); @@ -1282,12 +1282,12 @@ void WriteCBPZBinary(BODY *body, CONTROL *control, OUTPUT *output, void WriteCBPRDotBinary(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, - double *dTmp, char cUnit[]) { + double *dTmp, char **cUnit) { *dTmp = body[iBody].dCBPRDot; if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { *dTmp *= fdUnitsTime(units->iTime) / fdUnitsLength(units->iLength); fsUnitsVel(units, cUnit); @@ -1296,12 +1296,12 @@ void WriteCBPRDotBinary(BODY *body, CONTROL *control, OUTPUT *output, void WriteCBPZDotBinary(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, - double *dTmp, char cUnit[]) { + double *dTmp, char **cUnit) { *dTmp = body[iBody].dCBPZDot; if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { *dTmp *= fdUnitsTime(units->iTime) / fdUnitsLength(units->iLength); fsUnitsVel(units, cUnit); @@ -1312,7 +1312,7 @@ void WriteCBPZDotBinary(BODY *body, CONTROL *control, OUTPUT *output, orbit assuming P_bin << P_cbp */ void WriteCBPInsol(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, double *dTmp, - char cUnit[]) { + char **cUnit) { // Make sure that this is a planet, if not, -1 if (iBody < 2 || body[iBody].iBodyType != 0) { @@ -1322,165 +1322,165 @@ void WriteCBPInsol(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, } // Always in units of insolation received by Earth - strcpy(cUnit, "F/F_Earth"); + fvFormattedString(cUnit, "F/F_Earth"); } void InitializeOutputBinary(OUTPUT *output, fnWriteOutput fnWrite[]) { - sprintf(output[OUT_FREEECC].cName, "FreeEcc"); - sprintf(output[OUT_FREEECC].cDescr, "CBP's Free Eccentricity in BINARY"); + fvFormattedString(&output[OUT_FREEECC].cName, "FreeEcc"); + fvFormattedString(&output[OUT_FREEECC].cDescr, "CBP's Free Eccentricity in BINARY"); output[OUT_FREEECC].bNeg = 0; output[OUT_FREEECC].iNum = 1; output[OUT_FREEECC].iModuleBit = BINARY; fnWrite[OUT_FREEECC] = &WriteFreeEccBinary; - sprintf(output[OUT_FREEINC].cName, "FreeInc"); - sprintf(output[OUT_FREEINC].cDescr, "CBP's Free Inclination in BINARY"); - sprintf(output[OUT_FREEINC].cNeg, "Deg"); + fvFormattedString(&output[OUT_FREEINC].cName, "FreeInc"); + fvFormattedString(&output[OUT_FREEINC].cDescr, "CBP's Free Inclination in BINARY"); + fvFormattedString(&output[OUT_FREEINC].cNeg, "Deg"); output[OUT_FREEINC].bNeg = 1; output[OUT_FREEINC].dNeg = 1. / DEGRAD; output[OUT_FREEINC].iNum = 1; output[OUT_FREEINC].iModuleBit = BINARY; fnWrite[OUT_FREEINC] = &WriteFreeIncBinary; - sprintf(output[OUT_CBPPHI].cName, "CBPPhi"); - sprintf(output[OUT_CBPPHI].cDescr, "CBP Orbital Azimuthal Angle in BINARY"); - sprintf(output[OUT_CBPPHI].cNeg, "Deg"); + fvFormattedString(&output[OUT_CBPPHI].cName, "CBPPhi"); + fvFormattedString(&output[OUT_CBPPHI].cDescr, "CBP Orbital Azimuthal Angle in BINARY"); + fvFormattedString(&output[OUT_CBPPHI].cNeg, "Deg"); output[OUT_CBPPHI].bNeg = 1; output[OUT_CBPPHI].dNeg = 1.0 / DEGRAD; output[OUT_CBPPHI].iNum = 1; output[OUT_CBPPHI].iModuleBit = BINARY; fnWrite[OUT_CBPPHI] = &WriteCBPPhiBinary; - sprintf(output[OUT_BINPRIPHI].cName, "BinPriPhi"); - sprintf(output[OUT_BINPRIPHI].cDescr, + fvFormattedString(&output[OUT_BINPRIPHI].cName, "BinPriPhi"); + fvFormattedString(&output[OUT_BINPRIPHI].cDescr, "Binary primary star azimuthal angle in BINARY"); - sprintf(output[OUT_BINPRIPHI].cNeg, "Deg"); + fvFormattedString(&output[OUT_BINPRIPHI].cNeg, "Deg"); output[OUT_BINPRIPHI].bNeg = 1; output[OUT_BINPRIPHI].dNeg = 1.0 / DEGRAD; output[OUT_BINPRIPHI].iNum = 1; output[OUT_BINPRIPHI].iModuleBit = BINARY; fnWrite[OUT_BINPRIPHI] = &WriteBinPriPhiBinary; - sprintf(output[OUT_BINSECPHI].cName, "BinSecPhi"); - sprintf(output[OUT_BINSECPHI].cDescr, + fvFormattedString(&output[OUT_BINSECPHI].cName, "BinSecPhi"); + fvFormattedString(&output[OUT_BINSECPHI].cDescr, "Binary secondary star azimuthal angle in BINARY"); - sprintf(output[OUT_BINSECPHI].cNeg, "Deg"); + fvFormattedString(&output[OUT_BINSECPHI].cNeg, "Deg"); output[OUT_BINSECPHI].bNeg = 1; output[OUT_BINSECPHI].dNeg = 1.0 / DEGRAD; output[OUT_BINSECPHI].iNum = 1; output[OUT_BINSECPHI].iModuleBit = BINARY; fnWrite[OUT_BINSECPHI] = &WriteBinSecPhiBinary; - sprintf(output[OUT_LL13N0].cName, "LL13N0"); - sprintf(output[OUT_LL13N0].cDescr, "CBP Mean Motion in BINARY"); - sprintf(output[OUT_LL13N0].cNeg, "1/year"); + fvFormattedString(&output[OUT_LL13N0].cName, "LL13N0"); + fvFormattedString(&output[OUT_LL13N0].cDescr, "CBP Mean Motion in BINARY"); + fvFormattedString(&output[OUT_LL13N0].cNeg, "1/year"); output[OUT_LL13N0].bNeg = 1; output[OUT_LL13N0].dNeg = 1. / YEARSEC; output[OUT_LL13N0].iNum = 1; output[OUT_LL13N0].iModuleBit = BINARY; fnWrite[OUT_LL13N0] = &WriteLL13N0Binary; - sprintf(output[OUT_LL13K0].cName, "LL13K0"); - sprintf(output[OUT_LL13K0].cDescr, + fvFormattedString(&output[OUT_LL13K0].cName, "LL13K0"); + fvFormattedString(&output[OUT_LL13K0].cDescr, "Leung+Lee 2013 Radial epicyclic frequency"); - sprintf(output[OUT_LL13K0].cNeg, "1/year"); + fvFormattedString(&output[OUT_LL13K0].cNeg, "1/year"); output[OUT_LL13K0].bNeg = 1; output[OUT_LL13K0].dNeg = 1. / YEARSEC; output[OUT_LL13K0].iNum = 1; output[OUT_LL13K0].iModuleBit = BINARY; fnWrite[OUT_LL13K0] = &WriteLL13K0Binary; - sprintf(output[OUT_LL13V0].cName, "LL13V0"); - sprintf(output[OUT_LL13V0].cDescr, + fvFormattedString(&output[OUT_LL13V0].cName, "LL13V0"); + fvFormattedString(&output[OUT_LL13V0].cDescr, "CBP vertical epicyclic frequency in BINARY"); - sprintf(output[OUT_LL13V0].cNeg, "1/year"); + fvFormattedString(&output[OUT_LL13V0].cNeg, "1/year"); output[OUT_LL13V0].bNeg = 1; output[OUT_LL13V0].dNeg = 1. / YEARSEC; output[OUT_LL13V0].iNum = 1; output[OUT_LL13V0].iModuleBit = BINARY; fnWrite[OUT_LL13V0] = &WriteLL13V0Binary; - sprintf(output[OUT_CBPR].cName, "CBPR"); - sprintf(output[OUT_CBPR].cDescr, "CBP's Orbital Radius in BINARY"); + fvFormattedString(&output[OUT_CBPR].cName, "CBPR"); + fvFormattedString(&output[OUT_CBPR].cDescr, "CBP's Orbital Radius in BINARY"); output[OUT_CBPR].bNeg = 1; - sprintf(output[OUT_CBPR].cNeg, "AU"); + fvFormattedString(&output[OUT_CBPR].cNeg, "AU"); output[OUT_CBPR].dNeg = 1.0 / AUM; output[OUT_CBPR].iNum = 1; output[OUT_CBPR].iModuleBit = BINARY; fnWrite[OUT_CBPR] = &WriteCBPRBinary; - sprintf(output[OUT_BINPRIR].cName, "BinPriR"); - sprintf(output[OUT_BINPRIR].cDescr, + fvFormattedString(&output[OUT_BINPRIR].cName, "BinPriR"); + fvFormattedString(&output[OUT_BINPRIR].cDescr, "Radial position of binary primary star for module BINARY"); output[OUT_BINPRIR].bNeg = 1; - sprintf(output[OUT_BINPRIR].cNeg, "AU"); + fvFormattedString(&output[OUT_BINPRIR].cNeg, "AU"); output[OUT_BINPRIR].dNeg = 1.0 / AUM; output[OUT_BINPRIR].iNum = 1; output[OUT_BINPRIR].iModuleBit = BINARY; fnWrite[OUT_BINPRIR] = &WriteBinPriRBinary; - sprintf(output[OUT_BINSECR].cName, "BinSecR"); - sprintf(output[OUT_BINSECR].cDescr, + fvFormattedString(&output[OUT_BINSECR].cName, "BinSecR"); + fvFormattedString(&output[OUT_BINSECR].cDescr, "Radial position of binary secondary star for module BINARY"); output[OUT_BINSECR].bNeg = 1; - sprintf(output[OUT_BINSECR].cNeg, "AU"); + fvFormattedString(&output[OUT_BINSECR].cNeg, "AU"); output[OUT_BINSECR].dNeg = 1.0 / AUM; output[OUT_BINSECR].iNum = 1; output[OUT_BINSECR].iModuleBit = BINARY; fnWrite[OUT_BINSECR] = &WriteBinSecRBinary; - sprintf(output[OUT_CBPR0].cName, "R0"); - sprintf(output[OUT_CBPR0].cDescr, + fvFormattedString(&output[OUT_CBPR0].cName, "R0"); + fvFormattedString(&output[OUT_CBPR0].cDescr, "CBP's Orbital Guiding Center Radius in BINARY"); output[OUT_CBPR0].bNeg = 1; - sprintf(output[OUT_CBPR0].cNeg, "AU"); + fvFormattedString(&output[OUT_CBPR0].cNeg, "AU"); output[OUT_CBPR0].dNeg = 1.0 / AUM; output[OUT_CBPR0].iNum = 1; output[OUT_CBPR0].iModuleBit = BINARY; fnWrite[OUT_CBPR0] = &WriteCBPR0Binary; - sprintf(output[OUT_CBPZ].cName, "CBPZ"); - sprintf( - output[OUT_CBPZ].cDescr, + fvFormattedString(&output[OUT_CBPZ].cName, "CBPZ"); + fvFormattedString( + &output[OUT_CBPZ].cDescr, "CBP's Orbital Cylindrical Height Out of the Orbital Plane in BINARY"); output[OUT_CBPZ].bNeg = 1; - sprintf(output[OUT_CBPZ].cNeg, "AU"); + fvFormattedString(&output[OUT_CBPZ].cNeg, "AU"); output[OUT_CBPZ].dNeg = 1.0 / AUM; output[OUT_CBPZ].iNum = 1; output[OUT_CBPZ].iModuleBit = BINARY; fnWrite[OUT_CBPZ] = &WriteCBPZBinary; - sprintf(output[OUT_CBPRDOT].cName, "CBPRDot"); - sprintf(output[OUT_CBPRDOT].cDescr, + fvFormattedString(&output[OUT_CBPRDOT].cName, "CBPRDot"); + fvFormattedString(&output[OUT_CBPRDOT].cDescr, "CBP's Radial Orbital Velocity in BINARY"); - sprintf(output[OUT_CBPRDOT].cNeg, "/day"); + fvFormattedString(&output[OUT_CBPRDOT].cNeg, "/day"); output[OUT_CBPRDOT].bNeg = 0; output[OUT_CBPRDOT].dNeg = DAYSEC; output[OUT_CBPRDOT].iNum = 1; output[OUT_CBPRDOT].iModuleBit = BINARY; fnWrite[OUT_CBPRDOT] = &WriteCBPRDotBinary; - sprintf(output[OUT_CBPZDOT].cName, "CBPZDot"); - sprintf(output[OUT_CBPZDOT].cDescr, "CBP's Z Orbital Velocity in BINARY"); - sprintf(output[OUT_CBPZDOT].cNeg, "/day"); + fvFormattedString(&output[OUT_CBPZDOT].cName, "CBPZDot"); + fvFormattedString(&output[OUT_CBPZDOT].cDescr, "CBP's Z Orbital Velocity in BINARY"); + fvFormattedString(&output[OUT_CBPZDOT].cNeg, "/day"); output[OUT_CBPZDOT].bNeg = 0; output[OUT_CBPZDOT].dNeg = DAYSEC; output[OUT_CBPZDOT].iNum = 1; output[OUT_CBPZDOT].iModuleBit = BINARY; fnWrite[OUT_CBPZDOT] = &WriteCBPZDotBinary; - sprintf(output[OUT_CBPPHIDOT].cName, "CBPPhiDot"); - sprintf(output[OUT_CBPPHIDOT].cDescr, + fvFormattedString(&output[OUT_CBPPHIDOT].cName, "CBPPhiDot"); + fvFormattedString(&output[OUT_CBPPHIDOT].cDescr, "CBP's Phi Angular Orbital Velocity in BINARY"); - sprintf(output[OUT_CBPPHIDOT].cNeg, "/day"); + fvFormattedString(&output[OUT_CBPPHIDOT].cNeg, "/day"); output[OUT_CBPPHIDOT].bNeg = 0; output[OUT_CBPPHIDOT].dNeg = DAYSEC; output[OUT_CBPPHIDOT].iNum = 1; output[OUT_CBPPHIDOT].iModuleBit = BINARY; fnWrite[OUT_CBPPHIDOT] = &WriteCBPPhiDotBinary; - sprintf(output[OUT_CBPINSOL].cName, "CBPInsol"); - sprintf(output[OUT_CBPINSOL].cDescr, + fvFormattedString(&output[OUT_CBPINSOL].cName, "CBPInsol"); + fvFormattedString(&output[OUT_CBPINSOL].cDescr, "CBP's binary Orbit-Averaged Insolation in BINARY"); output[OUT_CBPINSOL].bNeg = 0; output[OUT_CBPINSOL].iNum = 1; diff --git a/src/binary.h b/src/binary.h index 68b6483fe..c2a595960 100644 --- a/src/binary.h +++ b/src/binary.h @@ -122,39 +122,39 @@ void InitializeOutputFunctionBinary(OUTPUT *, int, int); void InitializeOutputBinary(OUTPUT *, fnWriteOutput[]); void FinalizeOutputFunctionBinary(OUTPUT *, int, int); void WriteFreeEccBinary(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, - UPDATE *, int, double *, char[]); + UPDATE *, int, double *, char**); void WriteFreeIncBinary(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, - UPDATE *, int, double *, char[]); + UPDATE *, int, double *, char**); void WriteLL13N0Binary(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, UPDATE *, - int, double *, char[]); + int, double *, char**); void WriteLL13K0Binary(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, UPDATE *, - int, double *, char[]); + int, double *, char**); void WriteLL13V0Binary(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, UPDATE *, - int, double *, char[]); + int, double *, char**); void WriteCBPRBinary(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, UPDATE *, - int, double *, char[]); + int, double *, char**); void WriteCBPR0Binary(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, UPDATE *, - int, double *, char[]); + int, double *, char**); void WriteBinPriRBinary(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, - UPDATE *, int, double *, char[]); + UPDATE *, int, double *, char**); void WriteBinPriPhiBinary(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, - UPDATE *, int, double *, char[]); + UPDATE *, int, double *, char**); void WriteBinSecRBinary(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, - UPDATE *, int, double *, char[]); + UPDATE *, int, double *, char**); void WriteBinSecPhiBinary(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, - UPDATE *, int, double *, char[]); + UPDATE *, int, double *, char**); void WriteCBPZBinary(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, UPDATE *, - int, double *, char[]); + int, double *, char**); void WriteCBPZDotBinary(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, - UPDATE *, int, double *, char[]); + UPDATE *, int, double *, char**); void WriteCBPPhiBinary(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, UPDATE *, - int, double *, char[]); + int, double *, char**); void WriteCBPRDotBinary(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, - UPDATE *, int, double *, char[]); + UPDATE *, int, double *, char**); void WriteCBPPhiDotBinary(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, - UPDATE *, int, double *, char[]); + UPDATE *, int, double *, char**); void WriteCBPInsol(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, UPDATE *, - int, double *, char[]); + int, double *, char**); /* Logging Functions */ void LogOptionsBinary(CONTROL *, FILE *); diff --git a/src/body.c b/src/body.c index 101e72ad3..3c31b2757 100644 --- a/src/body.c +++ b/src/body.c @@ -442,7 +442,7 @@ void BodyCopy(BODY *dest, BODY *src, EVOLVE *evolve) { Module-specific parameters belong in the fnBodyCopy subroutines. */ for (iBody = 0; iBody < evolve->iNumBodies; iBody++) { - strcpy(dest[iBody].cName, src[iBody].cName); + fvFormattedString(&dest[iBody].cName, src[iBody].cName); dest[iBody].iBodyType = src[iBody].iBodyType; dest[iBody].dMass = src[iBody].dMass; dest[iBody].dRadius = src[iBody].dRadius; diff --git a/src/control.c b/src/control.c index 08bd53cb3..032e46fb1 100644 --- a/src/control.c +++ b/src/control.c @@ -33,13 +33,13 @@ int strcicmp(char const *a, char const *b) { //! Dummy struct used to sort options typedef struct { int index; - char name[OPTLEN]; + char *name; } SORTED_OPTIONS; //! Dummy struct used to sort output typedef struct { int index; - char name[OUTLEN]; + char *name; } SORTED_OUTPUT; //! Comparison function for option names @@ -60,7 +60,8 @@ void sort_options(OPTIONS *options, int sorted[]) { SORTED_OPTIONS sorted_options[MODULEOPTEND]; for (iOpt = 0; iOpt < MODULEOPTEND; iOpt++) { sorted_options[iOpt].index = iOpt; - strcpy(sorted_options[iOpt].name, options[iOpt].cName); + sorted_options[iOpt].name = NULL; + fvFormattedString(&sorted_options[iOpt].name, options[iOpt].cName); } qsort(sorted_options, MODULEOPTEND, sizeof(sorted_options[0]), compare_option_names); @@ -78,7 +79,8 @@ void sort_output(OUTPUT *output, int sorted[]) { SORTED_OUTPUT sorted_output[MODULEOUTEND]; for (iOpt = 0; iOpt < MODULEOUTEND; iOpt++) { sorted_output[iOpt].index = iOpt; - strcpy(sorted_output[iOpt].name, output[iOpt].cName); + sorted_output[iOpt].name=NULL; + fvFormattedString(&sorted_output[iOpt].name, output[iOpt].cName); } qsort(sorted_output, MODULEOUTEND, sizeof(sorted_output[0]), compare_output_names); @@ -92,18 +94,53 @@ void sort_output(OUTPUT *output, int sorted[]) { * Struct Initialization */ -void InitializeControl(CONTROL *control, MODULE *module) { - int iBody, iModule; +void InitializeFilesOptions(FILES *files,OPTIONS *options) { + int iFile,iOption; + + for (iOption=0;iOptioniNumInputs*sizeof(char*)); + for (iFile = 0; iFile < files->iNumInputs; iFile++) { + options[iOption].iLine[iFile] = -1; + options[iOption].cFile[iFile] = NULL; + fvFormattedString(&options[iOption].cFile[iFile], "null"); + if (iFile > 0) { + files->Outfile[iFile-1].caGrid[iOption] = NULL; + files->Outfile[iFile-1].caCol[iOption] = NULL; + } + } + } +} - control->bOutputLapl = 0; +void InitializeFiles(FILES *files, OPTIONS *options, char *sPrimaryFile, char **saBodyFiles, int iNumBodies) { + int iFile; - control->iMassRad = malloc(control->Evolve.iNumBodies * sizeof(int)); - control->fnForceBehavior = - malloc(control->Evolve.iNumBodies * sizeof(fnForceBehaviorModule *)); - control->fnForceBehaviorMulti = - malloc(control->Evolve.iNumBodies * sizeof(fnForceBehaviorModule *)); - control->iNumMultiForce = malloc(control->Evolve.iNumBodies * sizeof(int)); - control->Halt = malloc(control->Evolve.iNumBodies * sizeof(HALT)); + files->iNumInputs = iNumBodies + 1; + files->cLog = NULL; + files->cExe = NULL; + files->Infile = malloc(files->iNumInputs * sizeof(INFILE)); + files->Outfile = malloc(iNumBodies * sizeof(OUTFILE)); + + for (iFile = 0; iFile < files->iNumInputs; iFile++) { + files->Infile[iFile].cIn = NULL; + if (iFile == 0) { + files->Infile[0].iNumLines = iGetNumLines(sPrimaryFile); + fvFormattedString(&files->Infile[0].cIn, sPrimaryFile); + } else { + CheckFileExists(saBodyFiles[iFile-1]); + files->Infile[iFile].iNumLines = iGetNumLines(saBodyFiles[iFile-1]); + fvFormattedString(&files->Infile[iFile].cIn, saBodyFiles[iFile-1]); + + files->Outfile[iFile-1].cOut = NULL; + // Outfile names assigned after reading in output file names + } + RecordCommentsAndWhiteSpace(&files->Infile[iFile]); + } + + InitializeFilesOptions(files,options); +} + +void InitializePropsAux(CONTROL *control, MODULE *module) { + int iBody, iModule; control->fnPropsAux = malloc(control->Evolve.iNumBodies * sizeof(fnPropsAuxModule *)); @@ -111,18 +148,60 @@ void InitializeControl(CONTROL *control, MODULE *module) { malloc(control->Evolve.iNumBodies * sizeof(fnPropsAuxModule *)); for (iBody = 0; iBody < control->Evolve.iNumBodies; iBody++) { - control->fnForceBehavior[iBody] = - malloc(module->iNumModules[iBody] * sizeof(fnForceBehaviorModule)); control->fnPropsAux[iBody] = malloc(module->iNumModules[iBody] * sizeof(fnPropsAuxModule)); + for (iModule = 0; iModule < module->iNumModules[iBody]; iModule++) { + control->fnPropsAux[iBody][iModule] = &PropsAuxNULL; + } + + if (module->iNumModules[iBody] > 0) { + /* XXX Note that the number of elements here is really a permutation, + but this should work for a while. */ + control->fnPropsAuxMulti[iBody] = + malloc(2 * module->iNumModules[iBody] * sizeof(fnPropsAuxModule *)); + } + } + +} + +void InitilizeForceBehavior(CONTROL *control, MODULE *module) { + int iBody; + + control->fnForceBehavior = + malloc(control->Evolve.iNumBodies * sizeof(fnForceBehaviorModule *)); + control->fnForceBehaviorMulti = + malloc(control->Evolve.iNumBodies * sizeof(fnForceBehaviorModule *)); + control->iNumMultiForce = malloc(control->Evolve.iNumBodies * sizeof(int)); + for (iBody = 0; iBody < control->Evolve.iNumBodies; iBody++) { + control->fnForceBehavior[iBody] = + malloc(module->iNumModules[iBody] * sizeof(fnForceBehaviorModule)); + + if (module->iNumModules[iBody] > 0) { + /* XXX Note that the number of elements here is really a permutation, + but this should work for a while. */ + control->fnForceBehaviorMulti[iBody] = malloc( + 2 * module->iNumModules[iBody] * sizeof(fnForceBehaviorModule *)); + } + } +} +void InitializeControlModules(CONTROL *control, MODULE *module) { + int iBody, iModule; + + for (iBody = 0; iBody < control->Evolve.iNumBodies; iBody++) { for (iModule = 0; iModule < module->iNumModules[iBody]; iModule++) { module->fnInitializeControl[iBody][iModule](control, iBody); - control->fnPropsAux[iBody][iModule] = &PropsAuxNULL; } } +} + +void InitializeHalt(CONTROL *control) { + control->Halt = malloc(control->Evolve.iNumBodies * sizeof(HALT)); +} + +void InitializeIo(CONTROL *control) { + int iBody; - // Initialize IO error messages control->Io.baRocheMessage = malloc(control->Evolve.iNumBodies * sizeof(int)); control->Io.baCassiniOneMessage = malloc(control->Evolve.iNumBodies * sizeof(int)); @@ -143,6 +222,18 @@ void InitializeControl(CONTROL *control, MODULE *module) { control->Io.dMaxMutualInc = 0; } +void InitializeControl(CONTROL *control, MODULE *module) { + + InitializePropsAux(control, module); + InitializeIo(control); + InitilizeForceBehavior(control, module); + InitializeHalt(control); + InitializeControlModules(control, module); + + control->bOutputLapl = 0; + control->iMassRad = malloc(control->Evolve.iNumBodies * sizeof(int)); +} + /** This function performs the following tasks: @@ -179,7 +270,7 @@ void InitializeControlEvolve(BODY *body, CONTROL *control, MODULE *module, /* Currently this only matters for RK4 integration. This should be generalized for any integration method. */ if (control->Evolve.iOneStep == RUNGEKUTTA) { - control->Evolve.daDeriv = malloc(4 * sizeof(double **)); + control->Evolve.daDeriv = malloc(4 * sizeof(double **)); control->Evolve.daDerivProc = malloc(4 * sizeof(double ***)); for (iSubStep = 0; iSubStep < 4; iSubStep++) { control->Evolve.daDeriv[iSubStep] = @@ -242,10 +333,14 @@ void WriteDescription(char cLongDescr[], char cDescr[], int iMaxChars) { int bFoo; int iCharsLeft, iWord, iLineWord, iLine, iNumWords, iLineWordNow, iChar; char cDescription[MAXARRAY][OPTLEN]; - char cLine[MAXARRAY][OPTLEN]; + char **cLine; + + cLine = malloc(MAXARRAY * sizeof(char *)); + for (iWord=0;iWord iCharsLeft - strlen(cDescription[iWord]) - 2) { - strcpy(cLine[iLineWord], cDescription[iWord]); + fvFormattedString(&cLine[iLineWord], cDescription[iWord]); // extra 1 for space iCharsLeft -= (strlen(cLine[iLineWord]) + 1); iWord++; @@ -292,19 +387,13 @@ void WriteDescription(char cLongDescr[], char cDescr[], int iMaxChars) { // Now reset counters iCharsLeft = iMaxChars; for (iLineWordNow = 0; iLineWordNow < MAXARRAY; iLineWordNow++) { - memset(cLine[iLineWordNow], '\0', OPTLEN); + cLine[iLineWordNow]=NULL; } iLine++; iLineWord = 0; } printf("+-----------------+--------------------------------------------------" "------------------+\n"); - - /* Reset description for next time - for (iLineWordNow = 0; iLineWordNow < MAXARRAY; iLineWordNow++) { - memset(cDescription[iLineWordNow],'\0',OPTLEN); - } - */ } @@ -387,61 +476,6 @@ void WriteHelpOption(OPTIONS *options, int bLong) { WriteDescription(options->cLongDescr, options->cDescr, iMaxChars); - /* - // Try Long Description first - GetWords(options->cLongDescr,cDescription,&iNumWords,&bFoo); - if (memcmp(cDescription[0], "null", 4) == 0) { - // No long description, try short - memset(cDescription[0],'\0',OPTLEN); - GetWords(options->cDescr,cDescription,&iNumWords,&bFoo); - } - iCharsLeft = iMaxChars; - iWord = 0; // counter for word in description - iLineWord = 0; // counter for word in line - iLine = 0; - - while (iWord < iNumWords) { - // Extra two is for spaces on either side - while (iCharsLeft > iCharsLeft - strlen(cDescription[iWord]) - 2) - { strcpy(cLine[iLineWord],cDescription[iWord]); - // extra 1 for space - iCharsLeft -= (strlen(cLine[iLineWord])+1); - iWord++; - iLineWord++; - if (iWord == iNumWords) { - // Hit end of description inside inner loop - break; - } - } - // Line is full - if (iLine == 0) { - printf("| Description || "); - } else { - printf("| || "); - } - for (iLineWordNow = 0; iLineWordNow < iLineWord; iLineWordNow++) { - // write and erase - printf("%s ",cLine[iLineWordNow]); - } - for (iChar = 0; iChar < iCharsLeft; iChar++) { - printf(" "); - } - printf(" |\n"); - // Now reset counters - iCharsLeft = iMaxChars; - for (iLineWordNow = 0; iLineWordNow < MAXARRAY; iLineWordNow++) { - memset(cLine[iLineWordNow],'\0',OPTLEN); - } - iLine++; - iLineWord = 0; - } - printf("+-----------------+--------------------------------------------------------------------+\n"); - - // Reset description for next time - for (iLineWordNow = 0; iLineWordNow < MAXARRAY; iLineWordNow++) { - memset(cDescription[iLineWordNow],'\0',OPTLEN); - } - */ // Type int typelen; char *typestr; @@ -867,6 +901,33 @@ void fprintd(FILE *fp, double x, int iExp, int iDig) { } } +void AllocateStringMemory(char **sString, int iStringLength) { + if (*sString != NULL) { + free(*sString); + } + *sString = (char *)malloc((iStringLength) * sizeof(char)); + + if (*sString == NULL) { + fprintf(stderr, "ERROR: Failure in function AllocateStringMemory.\n"); + exit(EXIT_EXE); + } +} + +void fvFormattedString(char **sString, const char *sFormattedString, ...) { + va_list vaArgs, vaArgsCopy; + + va_start(vaArgs, sFormattedString); + va_copy(vaArgsCopy, vaArgs); + + int iStringLength = vsnprintf(NULL, 0, sFormattedString, vaArgs) + 1; + va_end(vaArgs); + + AllocateStringMemory(sString, iStringLength); + + vsnprintf(*sString, iStringLength, sFormattedString, vaArgsCopy); + va_end(vaArgsCopy); +} + /* * Unit Conversions */ @@ -893,21 +954,21 @@ double fdUnitsLength(int iType) { } } -void fsUnitsLength(int iType, char cUnit[]) { +void fsUnitsLength(int iType, char **cUnit) { if (iType == U_METER) { - sprintf(cUnit, "m"); + fvFormattedString(cUnit, "m"); } else if (iType == U_CENTIMETER) { - sprintf(cUnit, "cm"); + fvFormattedString(cUnit, "cm"); } else if (iType == U_KILOMETER) { - sprintf(cUnit, "km"); + fvFormattedString(cUnit, "km"); } else if (iType == U_SOLARRADIUS) { - sprintf(cUnit, "Rsun"); + fvFormattedString(cUnit, "Rsun"); } else if (iType == U_EARTHRADIUS) { - sprintf(cUnit, "Rearth"); + fvFormattedString(cUnit, "Rearth"); } else if (iType == U_JUPRADIUS) { - sprintf(cUnit, "Rjupiter"); + fvFormattedString(cUnit, "Rjupiter"); } else if (iType == U_AU) { - sprintf(cUnit, "au"); + fvFormattedString(cUnit, "au"); } else { fprintf(stderr, "ERROR: Unknown iUnitLength %d.\n", iType); exit(EXIT_UNITS); @@ -932,17 +993,17 @@ double fdUnitsTime(int iType) { } } -void fsUnitsTime(int iType, char cUnit[]) { +void fsUnitsTime(int iType, char **cUnit) { if (iType == U_SECOND) { - sprintf(cUnit, "sec"); + fvFormattedString(cUnit, "sec"); } else if (iType == U_DAY) { - sprintf(cUnit, "day"); + fvFormattedString(cUnit, "day"); } else if (iType == U_YEAR) { - sprintf(cUnit, "year"); + fvFormattedString(cUnit, "year"); } else if (iType == U_MYR) { - sprintf(cUnit, "Myr"); + fvFormattedString(cUnit, "Myr"); } else if (iType == U_GYR) { - sprintf(cUnit, "Gyr"); + fvFormattedString(cUnit, "Gyr"); } else { fprintf(stderr, "ERROR: Unknown iUnitTime: %d.\n", iType); exit(EXIT_UNITS); @@ -968,19 +1029,19 @@ double fdUnitsMass(int iType) { } } -void fsUnitsMass(int iType, char cUnit[]) { +void fsUnitsMass(int iType, char **cUnit) { if (iType == U_KILOGRAM) { - sprintf(cUnit, "kg"); + fvFormattedString(cUnit, "kg"); } else if (iType == U_GRAM) { - sprintf(cUnit, "gm"); + fvFormattedString(cUnit, "gm"); } else if (iType == U_SOLARMASS) { - sprintf(cUnit, "Msun"); + fvFormattedString(cUnit, "Msun"); } else if (iType == U_EARTHMASS) { - sprintf(cUnit, "Mearth"); + fvFormattedString(cUnit, "Mearth"); } else if (iType == U_JUPITERMASS) { - sprintf(cUnit, "Mjupiter"); + fvFormattedString(cUnit, "Mjupiter"); } else if (iType == U_NEPTUNEMASS) { - sprintf(cUnit, "Mneptune"); + fvFormattedString(cUnit, "Mneptune"); } else { fprintf(stderr, "ERROR: Unknown iUnitMass: %d.\n", iType); @@ -999,109 +1060,117 @@ double fdUnitsAngle(int iType) { } } -void fsUnitsAngle(int iType, char cUnit[]) { +void fsUnitsAngle(int iType, char **cUnit) { if (iType == U_RADIANS) { - sprintf(cUnit, "rad"); + fvFormattedString(cUnit, "rad"); } else if (iType == U_DEGREES) { - sprintf(cUnit, "deg"); + fvFormattedString(cUnit, "deg"); } else { fprintf(stderr, "ERROR: Unknown Angle type %d\n.", iType); exit(EXIT_UNITS); } } -void fsUnitsViscosity(UNITS *units, char cUnit[]) { - char cTmp[OUTLEN]; +void fsUnitsViscosity(UNITS *units, char **cUnit) { + char *cUnitLength = NULL, *cUnitTime = NULL; - fsUnitsLength(units->iLength, cUnit); - strcat(cUnit, "^2/"); - fsUnitsTime(units->iTime, cTmp); - strcat(cUnit, cTmp); + fsUnitsLength(units->iLength, &cUnitLength); + fsUnitsTime(units->iTime, &cUnitTime); + fvFormattedString(cUnit, "%s^2/%s",cUnitLength,cUnitTime); + free(cUnitLength); + free(cUnitTime); } -void fsUnitsAngMom(UNITS *units, char cUnit[]) { - char cTmp[OPTLEN]; +void fsUnitsAngMom(UNITS *units, char **cUnit) { + char *cUnitMass = NULL, *cUnitLength = NULL, *cUnitTime = NULL; - fsUnitsMass(units->iMass, cUnit); - fsUnitsLength(units->iLength, cTmp); - strcat(cUnit, "*"); - strcat(cUnit, cTmp); - strcat(cUnit, "^2/"); - fsUnitsTime(units->iTime, cTmp); - strcat(cUnit, cTmp); + fsUnitsMass(units->iMass, &cUnitMass); + fsUnitsLength(units->iLength, &cUnitLength); + fsUnitsTime(units->iTime, &cUnitTime); + fvFormattedString(cUnit, "%s*%s^2/%s", cUnitMass, cUnitLength, cUnitTime); + free(cUnitMass); + free(cUnitLength); + free(cUnitTime); } -void fsUnitsDensity(UNITS *units, char cUnit[]) { - char cTmp[OPTLEN]; +void fsUnitsDensity(UNITS *units, char **cUnit) { + char *cUnitMass = NULL, *cUnitLength = NULL; - fsUnitsMass(units->iMass, cUnit); - strcat(cUnit, "/"); - fsUnitsLength(units->iLength, cTmp); - strcat(cUnit, cTmp); - strcat(cUnit, "^3"); + fsUnitsMass(units->iMass, &cUnitMass); + fsUnitsLength(units->iLength, &cUnitLength); + fvFormattedString(cUnit, "%s/%s^3",cUnitMass, cUnitLength); + free(cUnitMass); + free(cUnitLength); } -void fsUnitsVel(UNITS *units, char cUnit[]) { - char cTmp[OPTLEN]; +void fsUnitsVel(UNITS *units, char **cUnit) { + char *cUnitLength = NULL, *cUnitTime = NULL; - fsUnitsLength(units->iLength, cUnit); - strcat(cUnit, "/"); - fsUnitsTime(units->iTime, cTmp); - strcat(cUnit, cTmp); + fsUnitsLength(units->iLength, &cUnitLength); + fsUnitsTime(units->iTime, &cUnitTime); + fvFormattedString(cUnit, "%s/%s", cUnitLength, cUnitTime); + free(cUnitTime); + free(cUnitLength); } -void fsUnitsRate(int iType, char cUnit[]) { - char cTmp[OPTLEN]; +void fsUnitsRate(int iType, char **cUnit) { + char *cUnitTime = NULL; - sprintf(cUnit, "/"); - fsUnitsTime(iType, cTmp); - strcat(cUnit, cTmp); + fsUnitsTime(iType, &cUnitTime); + fvFormattedString(cUnit, "/%s", cUnitTime); + free(cUnitTime); } -/* double fdUnitsRate(int iTime) { - return 1/(fdUnitsTime(iTime)); -}*/ +void fsUnitsRateSquared(int iType, char **cUnit) { + char *cUnitTime = NULL; + + fsUnitsTime(iType, &cUnitTime); + fvFormattedString(cUnit, "/%s^2", cUnitTime); + free(cUnitTime); +} -void fsUnitsAngRate(UNITS *units, char cUnit[]) { - char cTmp[OPTLEN]; +void fsUnitsAngRate(UNITS *units, char **cUnit) { + char *cUnitAngle = NULL, *cUnitTime = NULL; - fsUnitsAngle(units->iAngle, cUnit); - strcat(cUnit, "/"); - fsUnitsTime(units->iTime, cTmp); - strcat(cUnit, cTmp); + fsUnitsAngle(units->iAngle, &cUnitAngle); + fsUnitsTime(units->iTime, &cUnitTime); + fvFormattedString(cUnit, "%s/%s", cUnitAngle, cUnitTime); + free(cUnitTime); + free(cUnitAngle); } -void fsUnitsEnergy(UNITS *units, char cUnit[]) { - char cTmp[OPTLEN]; - - fsUnitsMass(units->iMass, cUnit); - strcat(cUnit, "*"); - fsUnitsLength(units->iLength, cTmp); - strcat(cUnit, cTmp); - strcat(cUnit, "^2/"); - fsUnitsTime(units->iTime, cTmp); - strcat(cUnit, cTmp); - strcat(cUnit, "^2"); +void fsUnitsEnergy(UNITS *units, char **cUnit) { + char *cUnitMass = NULL, *cUnitLength = NULL, *cUnitTime = NULL; + + fsUnitsMass(units->iMass, &cUnitMass); + fsUnitsLength(units->iLength, &cUnitLength); + fsUnitsTime(units->iTime, &cUnitTime); + + fvFormattedString(cUnit, "%s*%s^2/%s^2", cUnitMass, cUnitLength, cUnitTime); + free(cUnitMass); + free(cUnitLength); + free(cUnitTime); } double fdUnitsEnergy(int iTime, int iMass, int iLength) { - double dConversion = fdUnitsMass(iMass) * fdUnitsLength(iLength) * fdUnitsLength(iLength) / - (fdUnitsTime(iTime) * fdUnitsTime(iTime)); + double dConversion = fdUnitsMass(iMass) * fdUnitsLength(iLength) * + fdUnitsLength(iLength) / + (fdUnitsTime(iTime) * fdUnitsTime(iTime)); return dConversion; } -void fsUnitsPower(UNITS *units, char cUnit[]) { - char cTmp[OPTLEN]; - - fsUnitsMass(units->iMass, cUnit); - strcat(cUnit, "*"); - fsUnitsLength(units->iLength, cTmp); - strcat(cUnit, cTmp); - strcat(cUnit, "^2/"); - fsUnitsTime(units->iTime, cTmp); - strcat(cUnit, cTmp); - strcat(cUnit, "^3"); +void fsUnitsPower(UNITS *units, char **cUnit) { + char *cUnitMass = NULL, *cUnitLength = NULL, *cUnitTime = NULL; + + fsUnitsMass(units->iMass, &cUnitMass); + fsUnitsLength(units->iLength, &cUnitLength); + fsUnitsTime(units->iTime, &cUnitTime); + + fvFormattedString(cUnit, "%s*%s^2/%s^3", cUnitMass, cUnitLength, cUnitTime); + free(cUnitMass); + free(cUnitLength); + free(cUnitTime); } double fdUnitsPower(int iTime, int iMass, int iLength) { @@ -1109,17 +1178,15 @@ double fdUnitsPower(int iTime, int iMass, int iLength) { (fdUnitsTime(iTime) * fdUnitsTime(iTime) * fdUnitsTime(iTime)); } -void fsUnitsEnergyFlux(UNITS *units, char cUnit[]) { - char cTmp[OPTLEN]; - - fsUnitsEnergy(units, cUnit); - strcat(cUnit, "/("); - fsUnitsLength(units->iLength, cTmp); - strcat(cUnit, cTmp); - strcat(cUnit, "^2*"); - fsUnitsTime(units->iTime, cTmp); - strcat(cUnit, cTmp); - strcat(cUnit, ")"); +void fsUnitsEnergyFlux(UNITS *units, char **cUnit) { + char *cUnitMass = NULL,*cUnitTime = NULL; + + fsUnitsMass(units->iMass, &cUnitMass); + fsUnitsTime(units->iTime, &cUnitTime); + + fvFormattedString(cUnit, "%s/%s^3", cUnitMass, cUnitTime); + free(cUnitMass); + free(cUnitTime); } double fdUnitsEnergyFlux(int iTime, int iMass, int iLength) { @@ -1175,13 +1242,13 @@ double fdUnitsTemp(double dTemp, int iOldType, int iNewType) { } } -void fsUnitsTemp(int iType, char cUnit[]) { +void fsUnitsTemp(int iType, char **cUnit) { if (iType == U_KELVIN) { - sprintf(cUnit, "K"); + fvFormattedString(cUnit, "K"); } else if (iType == U_CELSIUS) { - sprintf(cUnit, "Celsius"); + fvFormattedString(cUnit, "Celsius"); } else if (iType == U_FARENHEIT) { - sprintf(cUnit, "F"); + fvFormattedString(cUnit, "F"); } else { fprintf(stderr, "ERROR: Unknown iUnitTemp %d.\n", iType); exit(EXIT_UNITS); @@ -1189,13 +1256,13 @@ void fsUnitsTemp(int iType, char cUnit[]) { } // XXX This looks fishy. Should time also be checked here -void fsUnitsTempRate(int iType, char cUnit[]) { +void fsUnitsTempRate(int iType, char **cUnit) { if (iType == U_KELVIN) { - sprintf(cUnit, "K/s"); + fvFormattedString(cUnit, "K/s"); } else if (iType == U_CELSIUS) { - sprintf(cUnit, "C/s"); + fvFormattedString(cUnit, "C/s"); } else if (iType == U_FARENHEIT) { - sprintf(cUnit, "F/s"); + fvFormattedString(cUnit, "F/s"); } else { fprintf(stderr, "ERROR: Unknown iUnitTempRate %d.\n", iType); exit(EXIT_UNITS); @@ -1209,13 +1276,8 @@ void fsUnitsTempRate(int iType, char cUnit[]) { void InfileCopy(INFILE *dest, INFILE *src) { int iLine; - strcpy(dest->cIn, src->cIn); + fvFormattedString(&dest->cIn, src->cIn); for (iLine = 0; iLine < src->iNumLines; iLine++) { dest->bLineOK[iLine] = src->bLineOK[iLine]; } - - /* PHOTOCHEM fields - strcpy(dest->cSpecies,src->cSpecies); - strcpy(dest->cReactions,src->cReactions); - */ } diff --git a/src/control.h b/src/control.h index 991311326..eb5fc2713 100644 --- a/src/control.h +++ b/src/control.h @@ -17,6 +17,8 @@ void InitializeControl(CONTROL *, MODULE *); void InitializeControlEvolve(BODY *, CONTROL *, MODULE *, UPDATE *); void InitializeControlVerifyProperty(CONTROL *); +void InitializeFiles(FILES *, OPTIONS *, char *,char **, int); + void WriteHelpOption(OPTIONS *, int); void WriteHelpOutput(OUTPUT *, int); void HelpOptions(OPTIONS *, int); @@ -26,6 +28,7 @@ void Help(OPTIONS *, OUTPUT *, char[], int); void LineExit(char[], int); char *sLower(char[]); void fprintd(FILE *, double, int, int); +void fvFormattedString(char **, const char *, ...); double fdUnitsLength(int); double fdUnitsTime(int); @@ -35,23 +38,24 @@ double fdUnitsAngle(int); double fdUnitsPower(int, int, int); double fdUnitsEnergy(int, int, int); double fdUnitsEnergyFlux(int, int, int); +void fsUnitsRateSquared(int, char **); // double fdUnitsRate(int); -void fsUnitsLength(int, char[]); -void fsUnitsTime(int, char[]); -void fsUnitsAngle(int, char[]); -void fsUnitsMass(int, char[]); -void fsUnitsTemp(int, char[]); -void fsUnitsTempRate(int, char[]); -void fsUnitsAngMom(UNITS *, char[]); -void fsUnitsDensity(UNITS *, char[]); -void fsUnitsVel(UNITS *, char[]); -void fsUnitsRate(int, char[]); -void fsUnitsAngRate(UNITS *, char[]); -void fsUnitsPower(UNITS *, char[]); -void fsUnitsEnergy(UNITS *, char[]); -void fsUnitsEnergyFlux(UNITS *, char[]); -void fsUnitsViscosity(UNITS *, char[]); +void fsUnitsLength(int, char **); +void fsUnitsTime(int, char **); +void fsUnitsAngle(int, char **); +void fsUnitsMass(int, char **); +void fsUnitsTemp(int, char **); +void fsUnitsTempRate(int, char **); +void fsUnitsAngMom(UNITS *, char **); +void fsUnitsDensity(UNITS *, char **); +void fsUnitsVel(UNITS *, char **); +void fsUnitsRate(int, char **); +void fsUnitsAngRate(UNITS *, char **); +void fsUnitsPower(UNITS *, char **); +void fsUnitsEnergy(UNITS *, char **); +void fsUnitsEnergyFlux(UNITS *, char **); +void fsUnitsViscosity(UNITS *, char **); void InfileCopy(INFILE *, INFILE *); diff --git a/src/distorb.c b/src/distorb.c index c9a7735d9..efd06900c 100644 --- a/src/distorb.c +++ b/src/distorb.c @@ -273,16 +273,16 @@ void ReadOrbitModel(BODY *body, CONTROL *control, FILES *files, void InitializeOptionsDistOrb(OPTIONS *options, fnReadOption fnRead[]) { - sprintf(options[OPT_DFCRIT].cName, "dDfcrit"); - sprintf(options[OPT_DFCRIT].cDescr, + fvFormattedString(&options[OPT_DFCRIT].cName, "dDfcrit"); + fvFormattedString(&options[OPT_DFCRIT].cDescr, "Tolerance parameter for recalculating semi-major axis functions"); - sprintf(options[OPT_DFCRIT].cDefault, "0.1"); - sprintf(options[OPT_DFCRIT].cDimension, "nd"); + fvFormattedString(&options[OPT_DFCRIT].cDefault, "0.1"); + fvFormattedString(&options[OPT_DFCRIT].cDimension, "nd"); options[OPT_DFCRIT].dDefault = 0.1; options[OPT_DFCRIT].iType = 2; options[OPT_DFCRIT].bMultiFile = 0; fnRead[OPT_DFCRIT] = &ReadDfCrit; - sprintf(options[OPT_DFCRIT].cLongDescr, + fvFormattedString(&options[OPT_DFCRIT].cLongDescr, "When running DistOrb with other modules that modify the semi-major " "axis,\n" "set his argument to be the maximum relative change in the Laplace\n" @@ -292,23 +292,23 @@ void InitializeOptionsDistOrb(OPTIONS *options, fnReadOption fnRead[]) { "gain in\n" "accuracy."); - sprintf(options[OPT_INVPLANE].cName, "bInvPlane"); - sprintf(options[OPT_INVPLANE].cDescr, + fvFormattedString(&options[OPT_INVPLANE].cName, "bInvPlane"); + fvFormattedString(&options[OPT_INVPLANE].cDescr, "Convert input coordinates to invariable plane coordinates"); - sprintf(options[OPT_INVPLANE].cDefault, "0"); + fvFormattedString(&options[OPT_INVPLANE].cDefault, "0"); options[OPT_INVPLANE].dDefault = 0; options[OPT_INVPLANE].iType = 0; options[OPT_INVPLANE].bMultiFile = 0; fnRead[OPT_INVPLANE] = &ReadInvPlane; - sprintf(options[OPT_ORBITMODEL].cName, "sOrbitModel"); - sprintf(options[OPT_ORBITMODEL].cDescr, + fvFormattedString(&options[OPT_ORBITMODEL].cName, "sOrbitModel"); + fvFormattedString(&options[OPT_ORBITMODEL].cDescr, "Orbit Model: LL2 [2nd order] RD4 [4th order]"); - sprintf(options[OPT_ORBITMODEL].cDefault, "rd4"); + fvFormattedString(&options[OPT_ORBITMODEL].cDefault, "rd4"); options[OPT_ORBITMODEL].dDefault = RD4; options[OPT_ORBITMODEL].iType = 3; fnRead[OPT_ORBITMODEL] = &ReadOrbitModel; - sprintf(options[OPT_ORBITMODEL].cLongDescr, + fvFormattedString(&options[OPT_ORBITMODEL].cLongDescr, "The secular orbital evolution model used with DistOrb. Option LL2 " "is the\n" "Laplace-Lagrange (eigenvalue) solution that is valid for small " @@ -326,41 +326,41 @@ void InitializeOptionsDistOrb(OPTIONS *options, fnReadOption fnRead[]) { "does not converge.", options[OPT_ORMAXECC].cName); - sprintf(options[OPT_ORMAXECC].cName, "bOverrideMaxEcc"); - sprintf(options[OPT_ORMAXECC].cDescr, + fvFormattedString(&options[OPT_ORMAXECC].cName, "bOverrideMaxEcc"); + fvFormattedString(&options[OPT_ORMAXECC].cDescr, "Override default maximum eccentricity (MAXORBDISTORB) in DistOrb?"); - sprintf(options[OPT_ORMAXECC].cDefault, "0"); + fvFormattedString(&options[OPT_ORMAXECC].cDefault, "0"); options[OPT_ORMAXECC].dDefault = 0; options[OPT_ORMAXECC].iType = 0; options[OPT_ORMAXECC].bMultiFile = 0; fnRead[OPT_ORMAXECC] = &ReadOverrideMaxEcc; - sprintf(options[OPT_ORBITMODEL].cLongDescr, + fvFormattedString(&options[OPT_ORBITMODEL].cLongDescr, "If RD4 is selected for %s, the code will halt if an eccentricity " "reaches\n" "~0.69 unless this flag is set to true.", options[OPT_ORBITMODEL].cName); - sprintf(options[OPT_HALTHILLSTAB].cName, "bHaltHillStab"); - sprintf(options[OPT_HALTHILLSTAB].cDescr, "Halt if Hill unstable?"); - sprintf(options[OPT_HALTHILLSTAB].cDefault, "0"); + fvFormattedString(&options[OPT_HALTHILLSTAB].cName, "bHaltHillStab"); + fvFormattedString(&options[OPT_HALTHILLSTAB].cDescr, "Halt if Hill unstable?"); + fvFormattedString(&options[OPT_HALTHILLSTAB].cDefault, "0"); options[OPT_HALTHILLSTAB].dDefault = 0; options[OPT_HALTHILLSTAB].iType = 0; options[OPT_HALTHILLSTAB].bMultiFile = 0; fnRead[OPT_HALTHILLSTAB] = &ReadHaltHillStab; - sprintf( - options[OPT_HALTHILLSTAB].cLongDescr, + fvFormattedString( + &options[OPT_HALTHILLSTAB].cLongDescr, "If two planets come within the Hill stability criterion, the code will" "halt if this parameter is set"); - sprintf(options[OPT_HALTCLOSEENC].cName, "bHaltCloseEnc"); - sprintf(options[OPT_HALTCLOSEENC].cDescr, "Halt if orbits get too close"); - sprintf(options[OPT_HALTCLOSEENC].cDefault, "0"); + fvFormattedString(&options[OPT_HALTCLOSEENC].cName, "bHaltCloseEnc"); + fvFormattedString(&options[OPT_HALTCLOSEENC].cDescr, "Halt if orbits get too close"); + fvFormattedString(&options[OPT_HALTCLOSEENC].cDefault, "0"); options[OPT_HALTCLOSEENC].dDefault = 0; options[OPT_HALTCLOSEENC].iType = 0; options[OPT_HALTCLOSEENC].bMultiFile = 0; fnRead[OPT_HALTCLOSEENC] = &ReadHaltCloseEnc; - sprintf( - options[OPT_HALTCLOSEENC].cLongDescr, + fvFormattedString( + &options[OPT_HALTCLOSEENC].cLongDescr, "Halt the code if the apocenter of an interior planets is less than 4 " "mutual Hill radii from the pericenter of an outer planet."); @@ -370,58 +370,58 @@ void InitializeOptionsDistOrb(OPTIONS *options, fnReadOption fnRead[]) { that are accurate to higher orders. One could conceivably fake the higher order evolution using only the LL2 solution by doing this. - sprintf(options[OPT_EIGENSET].cName,"bEigenSet"); - sprintf(options[OPT_EIGENSET].cDescr,"Read in eigenvalues/vectors for - DistOrb?"); sprintf(options[OPT_EIGENSET].cDefault,"0"); + fvFormattedString(options[OPT_EIGENSET].cName,"bEigenSet"); + fvFormattedString(options[OPT_EIGENSET].cDescr,"Read in eigenvalues/vectors for + DistOrb?"); fvFormattedString(options[OPT_EIGENSET].cDefault,"0"); options[OPT_EIGENSET].dDefault = 0; options[OPT_EIGENSET].iType = 0; options[OPT_EIGENSET].bMultiFile = 0; fnRead[OPT_EIGENSET] = &ReadEigenSet; - sprintf(options[OPT_EIGENVALUE].cName,"dEigenvalue"); - sprintf(options[OPT_EIGENVALUE].cDescr,"Set this to provide - eigenvalues/vectors at input"); sprintf(options[OPT_EIGENVALUE].cDefault,"0"); - sprintf(options[OPT_EIGENVALUE].cDimension,"nd"); + fvFormattedString(options[OPT_EIGENVALUE].cName,"dEigenvalue"); + fvFormattedString(options[OPT_EIGENVALUE].cDescr,"Set this to provide + eigenvalues/vectors at input"); fvFormattedString(options[OPT_EIGENVALUE].cDefault,"0"); + fvFormattedString(options[OPT_EIGENVALUE].cDimension,"nd"); options[OPT_EIGENVALUE].dDefault = 0; options[OPT_EIGENVALUE].iType = 0; options[OPT_EIGENVALUE].bMultiFile = 0; fnRead[OPT_EIGENVALUE] = &ReadEigenvalue; - sprintf(options[OPT_EIGENVECTOR].cName,"dEigenvector"); - sprintf(options[OPT_EIGENVECTOR].cDescr,"Set this to provide + fvFormattedString(options[OPT_EIGENVECTOR].cName,"dEigenvector"); + fvFormattedString(options[OPT_EIGENVECTOR].cDescr,"Set this to provide eigenvalues/vectors at input"); - sprintf(options[OPT_EIGENVECTOR].cDefault,"0"); - sprintf(options[OPT_EIGENVECTOR].cDimension,"nd"); + fvFormattedString(options[OPT_EIGENVECTOR].cDefault,"0"); + fvFormattedString(options[OPT_EIGENVECTOR].cDimension,"nd"); options[OPT_EIGENVECTOR].dDefault = 0; options[OPT_EIGENVECTOR].iType = 0; options[OPT_EIGENVECTOR].bMultiFile = 0; fnRead[OPT_EIGENVECTOR] = &ReadEigenvector; */ - sprintf(options[OPT_OUTPUTLAPL].cName, "bOutputLapl"); - sprintf(options[OPT_OUTPUTLAPL].cDescr, + fvFormattedString(&options[OPT_OUTPUTLAPL].cName, "bOutputLapl"); + fvFormattedString(&options[OPT_OUTPUTLAPL].cDescr, "Output Laplace functions and related data?"); - sprintf(options[OPT_OUTPUTLAPL].cDefault, "0"); + fvFormattedString(&options[OPT_OUTPUTLAPL].cDefault, "0"); options[OPT_OUTPUTLAPL].dDefault = 0; options[OPT_OUTPUTLAPL].iType = 0; options[OPT_OUTPUTLAPL].bMultiFile = 0; fnRead[OPT_OUTPUTLAPL] = &ReadOutputLapl; - sprintf( - options[OPT_OUTPUTLAPL].cLongDescr, + fvFormattedString( + &options[OPT_OUTPUTLAPL].cLongDescr, "Write files that contain the Laplace coefficients and their " "derivatives\n" "in DistOrb. This file can be used to check that they are recomputed \n" "frequently enough when damping (e.g. EqTide) is included."); - sprintf(options[OPT_OUTPUTEIGEN].cName, "bOutputEigen"); - sprintf(options[OPT_OUTPUTEIGEN].cDescr, "Output Eigenvalues?"); - sprintf(options[OPT_OUTPUTEIGEN].cDefault, "0"); + fvFormattedString(&options[OPT_OUTPUTEIGEN].cName, "bOutputEigen"); + fvFormattedString(&options[OPT_OUTPUTEIGEN].cDescr, "Output Eigenvalues?"); + fvFormattedString(&options[OPT_OUTPUTEIGEN].cDefault, "0"); options[OPT_OUTPUTEIGEN].dDefault = 0; options[OPT_OUTPUTEIGEN].iType = 0; options[OPT_OUTPUTEIGEN].bMultiFile = 0; fnRead[OPT_OUTPUTEIGEN] = &ReadOutputEigen; - sprintf( - options[OPT_OUTPUTLAPL].cLongDescr, + fvFormattedString( + &options[OPT_OUTPUTLAPL].cLongDescr, "Write special files that contain the eigenvalues and eigenvectors of " "the\n" "system with DistOrb. In the LL2 solution, these are already computed. " @@ -476,7 +476,6 @@ double fndCalcLongA(double dLongP, double dArgP) { void VerifyOrbitModel(CONTROL *control, FILES *files, OPTIONS *options) { int iFile, iFound = 0; - char cTmp[8]; for (iFile = 0; iFile < files->iNumInputs; iFile++) { if (options[OPT_ORBITMODEL].iLine[iFile] >= 0) { @@ -499,7 +498,8 @@ void VerifyOrbitModel(CONTROL *control, FILES *files, OPTIONS *options) { } if (iFound == 0) { - strcpy(cTmp, options[OPT_ORBITMODEL].cDefault); + char *cTmp; + fvFormattedString(&cTmp, options[OPT_ORBITMODEL].cDefault); if (!memcmp(sLower(cTmp), "ll2", 3)) { control->Evolve.iDistOrbModel = LL2; } else if (!memcmp(sLower(cTmp), "rd4", 3)) { @@ -513,6 +513,7 @@ void VerifyOrbitModel(CONTROL *control, FILES *files, OPTIONS *options) { /* Chicanery. Since I only want this set once, I will make it seem like the user set it. */ options[OPT_ORBITMODEL].iLine[0] = 1; + free(cTmp); } } @@ -1752,19 +1753,19 @@ int fbCheckMutualIncDistorb(BODY *body, EVOLVE *evolve, HALT *halt, IO *io, /************* DISTORB Outputs ******************/ void WriteEigen(CONTROL *control, SYSTEM *system) { - char cEccEigFile[2 * NAMELEN], cIncEigFile[2 * NAMELEN]; + char *sEccEigFile, *sIncEigFile; int iBody; FILE *fecc, *finc; - sprintf(cEccEigFile, "%s.Ecc.Eigen", system->cName); - sprintf(cIncEigFile, "%s.Inc.Eigen", system->cName); + fvFormattedString(&sEccEigFile, "%s.Ecc.Eigen", system->cName); + fvFormattedString(&sIncEigFile, "%s.Inc.Eigen", system->cName); if (control->Evolve.dTime == 0) { - fecc = fopen(cEccEigFile, "w"); - finc = fopen(cIncEigFile, "w"); + fecc = fopen(sEccEigFile, "w"); + finc = fopen(sIncEigFile, "w"); } else { - fecc = fopen(cEccEigFile, "a"); - finc = fopen(cIncEigFile, "a"); + fecc = fopen(sEccEigFile, "a"); + finc = fopen(sIncEigFile, "a"); } fprintd(fecc, control->Evolve.dTime / fdUnitsTime(control->Units[1].iTime), @@ -1790,7 +1791,7 @@ void WriteEigen(CONTROL *control, SYSTEM *system) { void WriteBodyDEccDtDistOrb(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, - int iBody, double *dTmp, char cUnit[]) { + int iBody, double *dTmp, char **cUnit) { double dDeriv; int iPert; @@ -1808,7 +1809,7 @@ void WriteBodyDEccDtDistOrb(BODY *body, CONTROL *control, OUTPUT *output, if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { *dTmp *= fdUnitsTime(units->iTime); fsUnitsRate(units->iTime, cUnit); @@ -1817,7 +1818,7 @@ void WriteBodyDEccDtDistOrb(BODY *body, CONTROL *control, OUTPUT *output, void WriteBodyDSincDtDistOrb(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, - int iBody, double *dTmp, char cUnit[]) { + int iBody, double *dTmp, char **cUnit) { double dDeriv; int iPert; @@ -1841,7 +1842,7 @@ void WriteBodyDSincDtDistOrb(BODY *body, CONTROL *control, OUTPUT *output, if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { *dTmp *= fdUnitsTime(units->iTime); fsUnitsRate(units->iTime, cUnit); @@ -1850,7 +1851,7 @@ void WriteBodyDSincDtDistOrb(BODY *body, CONTROL *control, OUTPUT *output, void WriteBodyDLongPDtDistOrb(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, - int iBody, double *dTmp, char cUnit[]) { + int iBody, double *dTmp, char **cUnit) { double dDeriv; int iPert; @@ -1868,7 +1869,7 @@ void WriteBodyDLongPDtDistOrb(BODY *body, CONTROL *control, OUTPUT *output, if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { *dTmp *= fdUnitsTime(units->iTime); *dTmp /= fdUnitsAngle(units->iAngle); @@ -1879,7 +1880,7 @@ void WriteBodyDLongPDtDistOrb(BODY *body, CONTROL *control, OUTPUT *output, void WriteBodyDLongADtDistOrb(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, - int iBody, double *dTmp, char cUnit[]) { + int iBody, double *dTmp, char **cUnit) { double dDeriv; int iPert; @@ -1903,7 +1904,7 @@ void WriteBodyDLongADtDistOrb(BODY *body, CONTROL *control, OUTPUT *output, if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { *dTmp *= fdUnitsTime(units->iTime); *dTmp /= fdUnitsAngle(units->iAngle); @@ -1914,7 +1915,7 @@ void WriteBodyDLongADtDistOrb(BODY *body, CONTROL *control, OUTPUT *output, void WriteBodyDIncDtDistOrb(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, - int iBody, double *dTmp, char cUnit[]) { + int iBody, double *dTmp, char **cUnit) { double dDeriv; int iPert; @@ -1940,7 +1941,7 @@ void WriteBodyDIncDtDistOrb(BODY *body, CONTROL *control, OUTPUT *output, if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { *dTmp *= fdUnitsTime(units->iTime); *dTmp /= fdUnitsAngle(units->iAngle); @@ -1951,17 +1952,17 @@ void WriteBodyDIncDtDistOrb(BODY *body, CONTROL *control, OUTPUT *output, void WriteBodySinc(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, double *dTmp, - char cUnit[]) { + char **cUnit) { *dTmp = sqrt(body[iBody].dPinc * body[iBody].dPinc + body[iBody].dQinc * body[iBody].dQinc); - strcpy(cUnit, ""); + fvFormattedString(cUnit, ""); } /* void WriteBodyLongA(BODY *body,CONTROL *control,OUTPUT *output,SYSTEM -*system,UNITS *units,UPDATE *update,int iBody,double *dTmp,char cUnit[]) { if +*system,UNITS *units,UPDATE *update,int iBody,double *dTmp,char **cUnit) { if (body[iBody].bDistOrb) { *dTmp = atan2(body[iBody].dPinc, body[iBody].dQinc); } else if (body[iBody].bGalHabit) { *dTmp = body[iBody].dLongA; } @@ -1975,7 +1976,7 @@ else if (body[iBody].bGalHabit) { *dTmp = body[iBody].dLongA; if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit,output->cNeg); + fvFormattedString(cUnit,output->cNeg); } else { *dTmp /= fdUnitsAngle(units->iAngle); fsUnitsAngle(units->iAngle,cUnit); @@ -1985,23 +1986,23 @@ else if (body[iBody].bGalHabit) { *dTmp = body[iBody].dLongA; void WriteBodyPinc(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, double *dTmp, - char cUnit[]) { + char **cUnit) { *dTmp = body[iBody].dPinc; - strcpy(cUnit, ""); + fvFormattedString(cUnit, ""); } void WriteBodyQinc(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, double *dTmp, - char cUnit[]) { + char **cUnit) { *dTmp = body[iBody].dQinc; - strcpy(cUnit, ""); + fvFormattedString(cUnit, ""); } void WriteBodyDHeccDtDistOrb(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, - int iBody, double *dTmp, char cUnit[]) { + int iBody, double *dTmp, char **cUnit) { /* need to put check for star's output options in verify */ double dDeriv; int iPert; @@ -2016,7 +2017,7 @@ void WriteBodyDHeccDtDistOrb(BODY *body, CONTROL *control, OUTPUT *output, if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { *dTmp *= fdUnitsTime(units->iTime); fsUnitsRate(units->iTime, cUnit); @@ -2025,7 +2026,7 @@ void WriteBodyDHeccDtDistOrb(BODY *body, CONTROL *control, OUTPUT *output, void WriteBodyDKeccDtDistOrb(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, - int iBody, double *dTmp, char cUnit[]) { + int iBody, double *dTmp, char **cUnit) { /* need to put check for star's output options in verify */ double dDeriv; int iPert; @@ -2040,7 +2041,7 @@ void WriteBodyDKeccDtDistOrb(BODY *body, CONTROL *control, OUTPUT *output, if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { *dTmp *= fdUnitsTime(units->iTime); fsUnitsRate(units->iTime, cUnit); @@ -2049,7 +2050,7 @@ void WriteBodyDKeccDtDistOrb(BODY *body, CONTROL *control, OUTPUT *output, void WriteBodyDPincDtDistOrb(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, - int iBody, double *dTmp, char cUnit[]) { + int iBody, double *dTmp, char **cUnit) { /* need to put check for star's output options in verify */ double dDeriv; int iPert; @@ -2064,7 +2065,7 @@ void WriteBodyDPincDtDistOrb(BODY *body, CONTROL *control, OUTPUT *output, if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { *dTmp *= fdUnitsTime(units->iTime); fsUnitsRate(units->iTime, cUnit); @@ -2073,7 +2074,7 @@ void WriteBodyDPincDtDistOrb(BODY *body, CONTROL *control, OUTPUT *output, void WriteBodyDQincDtDistOrb(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, - int iBody, double *dTmp, char cUnit[]) { + int iBody, double *dTmp, char **cUnit) { /* need to put check for star's output options in verify */ double dDeriv; int iPert; @@ -2088,7 +2089,7 @@ void WriteBodyDQincDtDistOrb(BODY *body, CONTROL *control, OUTPUT *output, if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { *dTmp *= fdUnitsTime(units->iTime); fsUnitsRate(units->iTime, cUnit); @@ -2101,104 +2102,104 @@ void InitializeOutputDistOrb(OUTPUT *output, fnWriteOutput fnWrite[]) { // XXX Many of these should be moved to OutputGeneral as they apply to both // DistOrb and SpiNBody - sprintf(output[OUT_DECCDTDISTORB].cName, "DEccDtDistOrb"); - sprintf(output[OUT_DECCDTDISTORB].cDescr, + fvFormattedString(&output[OUT_DECCDTDISTORB].cName, "DEccDtDistOrb"); + fvFormattedString(&output[OUT_DECCDTDISTORB].cDescr, "Body's eccentricity derivative in DistOrb"); - sprintf(output[OUT_DECCDTDISTORB].cNeg, "1/year"); + fvFormattedString(&output[OUT_DECCDTDISTORB].cNeg, "1/year"); output[OUT_DECCDTDISTORB].bNeg = 1; output[OUT_DECCDTDISTORB].dNeg = YEARSEC; output[OUT_DECCDTDISTORB].iModuleBit = DISTORB; fnWrite[OUT_DECCDTDISTORB] = &WriteBodyDEccDtDistOrb; - sprintf(output[OUT_DSINCDTDISTORB].cName, "DSincDtDistOrb"); - sprintf(output[OUT_DSINCDTDISTORB].cDescr, + fvFormattedString(&output[OUT_DSINCDTDISTORB].cName, "DSincDtDistOrb"); + fvFormattedString(&output[OUT_DSINCDTDISTORB].cDescr, "Body's sin(Inc/2) derivative in DistOrb"); - sprintf(output[OUT_DSINCDTDISTORB].cNeg, "1/year"); + fvFormattedString(&output[OUT_DSINCDTDISTORB].cNeg, "1/year"); output[OUT_DSINCDTDISTORB].bNeg = 1; output[OUT_DSINCDTDISTORB].dNeg = YEARSEC; output[OUT_DSINCDTDISTORB].iNum = 1; output[OUT_DSINCDTDISTORB].iModuleBit = DISTORB; fnWrite[OUT_DSINCDTDISTORB] = &WriteBodyDSincDtDistOrb; - sprintf(output[OUT_DINCDTDISTORB].cName, "DIncDtDistOrb"); - sprintf(output[OUT_DINCDTDISTORB].cDescr, + fvFormattedString(&output[OUT_DINCDTDISTORB].cName, "DIncDtDistOrb"); + fvFormattedString(&output[OUT_DINCDTDISTORB].cDescr, "Body's inclination derivative in DistOrb"); - sprintf(output[OUT_DINCDTDISTORB].cNeg, "deg/year"); + fvFormattedString(&output[OUT_DINCDTDISTORB].cNeg, "deg/year"); output[OUT_DINCDTDISTORB].bNeg = 1; output[OUT_DINCDTDISTORB].dNeg = YEARSEC / DEGRAD; output[OUT_DINCDTDISTORB].iNum = 1; output[OUT_DINCDTDISTORB].iModuleBit = DISTORB; fnWrite[OUT_DINCDTDISTORB] = &WriteBodyDIncDtDistOrb; - sprintf(output[OUT_DLONGPDTDISTORB].cName, "DLongPDtDistOrb"); - sprintf(output[OUT_DLONGPDTDISTORB].cDescr, + fvFormattedString(&output[OUT_DLONGPDTDISTORB].cName, "DLongPDtDistOrb"); + fvFormattedString(&output[OUT_DLONGPDTDISTORB].cDescr, "Body's longitude of pericenter derivative in DistOrb"); - sprintf(output[OUT_DLONGPDTDISTORB].cNeg, "deg/yr"); + fvFormattedString(&output[OUT_DLONGPDTDISTORB].cNeg, "deg/yr"); output[OUT_DLONGPDTDISTORB].bNeg = 1; output[OUT_DLONGPDTDISTORB].dNeg = YEARSEC / DEGRAD; output[OUT_DLONGPDTDISTORB].iNum = 1; output[OUT_DLONGPDTDISTORB].iModuleBit = DISTORB; fnWrite[OUT_DLONGPDTDISTORB] = &WriteBodyDLongPDtDistOrb; - sprintf(output[OUT_DLONGADTDISTORB].cName, "DLongADtDistOrb"); - sprintf(output[OUT_DLONGADTDISTORB].cDescr, + fvFormattedString(&output[OUT_DLONGADTDISTORB].cName, "DLongADtDistOrb"); + fvFormattedString(&output[OUT_DLONGADTDISTORB].cDescr, "Body's longitude of ascending node derivative in DistOrb"); - sprintf(output[OUT_DLONGADTDISTORB].cNeg, "deg/yr"); + fvFormattedString(&output[OUT_DLONGADTDISTORB].cNeg, "deg/yr"); output[OUT_DLONGADTDISTORB].bNeg = 1; output[OUT_DLONGADTDISTORB].dNeg = YEARSEC / DEGRAD; output[OUT_DLONGADTDISTORB].iNum = 1; output[OUT_DLONGADTDISTORB].iModuleBit = DISTORB; fnWrite[OUT_DLONGADTDISTORB] = &WriteBodyDLongADtDistOrb; - sprintf(output[OUT_SINC].cName, "Sinc"); - sprintf(output[OUT_SINC].cDescr, "Body's sin(Inc/2) in DistOrb"); + fvFormattedString(&output[OUT_SINC].cName, "Sinc"); + fvFormattedString(&output[OUT_SINC].cDescr, "Body's sin(Inc/2) in DistOrb"); output[OUT_SINC].iNum = 1; output[OUT_SINC].iModuleBit = DISTORB; fnWrite[OUT_SINC] = &WriteBodySinc; - sprintf(output[OUT_PINC].cName, "Pinc"); - sprintf(output[OUT_PINC].cDescr, "Body's Poincare p in DistOrb"); + fvFormattedString(&output[OUT_PINC].cName, "Pinc"); + fvFormattedString(&output[OUT_PINC].cDescr, "Body's Poincare p in DistOrb"); output[OUT_PINC].iNum = 1; output[OUT_PINC].iModuleBit = DISTORB; fnWrite[OUT_PINC] = &WriteBodyPinc; - sprintf(output[OUT_QINC].cName, "Qinc"); - sprintf(output[OUT_QINC].cDescr, "Body's Poincare q in DistOrb"); + fvFormattedString(&output[OUT_QINC].cName, "Qinc"); + fvFormattedString(&output[OUT_QINC].cDescr, "Body's Poincare q in DistOrb"); output[OUT_QINC].iNum = 1; output[OUT_QINC].iModuleBit = DISTORB; fnWrite[OUT_QINC] = &WriteBodyQinc; - sprintf(output[OUT_DHECCDTDISTORB].cName, "DHeccDtDistOrb"); - sprintf(output[OUT_DHECCDTDISTORB].cDescr, + fvFormattedString(&output[OUT_DHECCDTDISTORB].cName, "DHeccDtDistOrb"); + fvFormattedString(&output[OUT_DHECCDTDISTORB].cDescr, "Body's Poincare h derivative in DistOrb"); - sprintf(output[OUT_DHECCDTDISTORB].cNeg, "1/year"); + fvFormattedString(&output[OUT_DHECCDTDISTORB].cNeg, "1/year"); output[OUT_DHECCDTDISTORB].bNeg = 1; output[OUT_DHECCDTDISTORB].dNeg = YEARSEC; output[OUT_DHECCDTDISTORB].iNum = 1; output[OUT_DHECCDTDISTORB].iModuleBit = DISTORB; fnWrite[OUT_DHECCDTDISTORB] = &WriteBodyDHeccDtDistOrb; - sprintf(output[OUT_DKECCDTDISTORB].cName, "DKeccDtDistOrb"); - sprintf(output[OUT_DKECCDTDISTORB].cDescr, "Body's Poincare k in DistOrb"); - sprintf(output[OUT_DKECCDTDISTORB].cNeg, "1/year"); + fvFormattedString(&output[OUT_DKECCDTDISTORB].cName, "DKeccDtDistOrb"); + fvFormattedString(&output[OUT_DKECCDTDISTORB].cDescr, "Body's Poincare k in DistOrb"); + fvFormattedString(&output[OUT_DKECCDTDISTORB].cNeg, "1/year"); output[OUT_DKECCDTDISTORB].bNeg = 1; output[OUT_DKECCDTDISTORB].dNeg = YEARSEC; output[OUT_DKECCDTDISTORB].iNum = 1; output[OUT_DKECCDTDISTORB].iModuleBit = DISTORB; fnWrite[OUT_DKECCDTDISTORB] = &WriteBodyDKeccDtDistOrb; - sprintf(output[OUT_DPINCDTDISTORB].cName, "DPincDtDistOrb"); - sprintf(output[OUT_DPINCDTDISTORB].cDescr, "Body's Poincare p in DistOrb"); - sprintf(output[OUT_DPINCDTDISTORB].cNeg, "1/year"); + fvFormattedString(&output[OUT_DPINCDTDISTORB].cName, "DPincDtDistOrb"); + fvFormattedString(&output[OUT_DPINCDTDISTORB].cDescr, "Body's Poincare p in DistOrb"); + fvFormattedString(&output[OUT_DPINCDTDISTORB].cNeg, "1/year"); output[OUT_DPINCDTDISTORB].bNeg = 1; output[OUT_DPINCDTDISTORB].dNeg = YEARSEC; output[OUT_DPINCDTDISTORB].iNum = 1; output[OUT_DPINCDTDISTORB].iModuleBit = DISTORB; fnWrite[OUT_DPINCDTDISTORB] = &WriteBodyDPincDtDistOrb; - sprintf(output[OUT_DQINCDTDISTORB].cName, "DQincDtDistOrb"); - sprintf(output[OUT_DQINCDTDISTORB].cDescr, "Body's Poincare q in DistOrb"); - sprintf(output[OUT_DQINCDTDISTORB].cNeg, "1/year"); + fvFormattedString(&output[OUT_DQINCDTDISTORB].cName, "DQincDtDistOrb"); + fvFormattedString(&output[OUT_DQINCDTDISTORB].cDescr, "Body's Poincare q in DistOrb"); + fvFormattedString(&output[OUT_DQINCDTDISTORB].cNeg, "1/year"); output[OUT_DQINCDTDISTORB].bNeg = 1; output[OUT_DQINCDTDISTORB].dNeg = YEARSEC; output[OUT_DQINCDTDISTORB].iNum = 1; diff --git a/src/distorb.h b/src/distorb.h index 50c7acca8..8baae76e5 100644 --- a/src/distorb.h +++ b/src/distorb.h @@ -121,37 +121,37 @@ int fbCheckMutualIncDistorb(BODY *, EVOLVE *, HALT *, IO *, UPDATE *, int); void HelpOutputDistOrb(OUTPUT *); void WriteBodyDEccDtDistOrb(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, - UPDATE *, int, double *, char[]); + UPDATE *, int, double *, char**); void WriteBodyDSincDtDistOrb(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, - UPDATE *, int, double *, char[]); + UPDATE *, int, double *, char**); void WriteBodyDLongPDtDistOrb(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, - UPDATE *, int, double *, char[]); + UPDATE *, int, double *, char**); void WriteBodyDLongADtDistOrb(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, - UPDATE *, int, double *, char[]); + UPDATE *, int, double *, char**); void WriteBodyDIncDtDistOrb(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, - UPDATE *, int, double *, char[]); + UPDATE *, int, double *, char**); void WriteBodySinc(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, UPDATE *, - int, double *, char[]); + int, double *, char**); void WriteBodyLongP(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, UPDATE *, - int, double *, char[]); + int, double *, char**); void WriteBodyArgP(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, UPDATE *, - int, double *, char[]); + int, double *, char**); void WriteBodyHecc(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, UPDATE *, - int, double *, char[]); + int, double *, char**); void WriteBodyKecc(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, UPDATE *, - int, double *, char[]); + int, double *, char**); void WriteBodyPinc(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, UPDATE *, - int, double *, char[]); + int, double *, char**); void WriteBodyQinc(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, UPDATE *, - int, double *, char[]); + int, double *, char**); void WriteBodyDHeccDtDistOrb(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, - UPDATE *, int, double *, char[]); + UPDATE *, int, double *, char**); void WriteBodyDKeccDtDistOrb(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, - UPDATE *, int, double *, char[]); + UPDATE *, int, double *, char**); void WriteBodyDPincDtDistOrb(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, - UPDATE *, int, double *, char[]); + UPDATE *, int, double *, char**); void WriteBodyDQincDtDistOrb(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, - UPDATE *, int, double *, char[]); + UPDATE *, int, double *, char**); void InitializeOutputDistOrb(OUTPUT *, fnWriteOutput[]); void WriteEigen(CONTROL *, SYSTEM *); diff --git a/src/distrot.c b/src/distrot.c index c9895e0f4..d02853c1f 100644 --- a/src/distrot.c +++ b/src/distrot.c @@ -148,35 +148,37 @@ void ReadFileOrbitData(BODY *body, CONTROL *control, FILES *files, /* Cannot exist in primary input file -- Each body has an output file */ NotPrimaryInput(iFile, options->cName, files->Infile[iFile].cIn, lTmp, control->Io.iVerbose); - strcpy(body[iFile - 1].cFileOrbitData, cTmp); + body[iFile - 1].cFileOrbitData = NULL; + fvFormattedString(&body[iFile - 1].cFileOrbitData, cTmp); UpdateFoundOption(&files->Infile[iFile], options, lTmp, iFile); } else if (iFile > 0) { - // sprintf(body[iFile-1].cFileOrbitData,"%s",options[OPT_FILEORBITDATA].cDefault); - strcpy(body[iFile - 1].cFileOrbitData, options->cDefault); + // fvFormattedString(body[iFile-1].cFileOrbitData,"%s",options[OPT_FILEORBITDATA].cDefault); + body[iFile - 1].cFileOrbitData = NULL; + fvFormattedString(&body[iFile - 1].cFileOrbitData, options->cDefault); } } void InitializeOptionsDistRot(OPTIONS *options, fnReadOption fnRead[]) { - sprintf(options[OPT_DYNELLIP].cName, "dDynEllip"); - sprintf(options[OPT_DYNELLIP].cDescr, "Planet's dynamical ellipticity"); - sprintf(options[OPT_DYNELLIP].cDefault, "0.00328"); - sprintf(options[OPT_DYNELLIP].cDimension, "nd"); + fvFormattedString(&options[OPT_DYNELLIP].cName, "dDynEllip"); + fvFormattedString(&options[OPT_DYNELLIP].cDescr, "Planet's dynamical ellipticity"); + fvFormattedString(&options[OPT_DYNELLIP].cDefault, "0.00328"); + fvFormattedString(&options[OPT_DYNELLIP].cDimension, "nd"); options[OPT_DYNELLIP].dDefault = 0.00328; options[OPT_DYNELLIP].iType = 2; options[OPT_DYNELLIP].bMultiFile = 1; fnRead[OPT_DYNELLIP] = &ReadDynEllip; - sprintf(options[OPT_CALCDYNELLIP].cName, "bCalcDynEllip"); - sprintf(options[OPT_CALCDYNELLIP].cDescr, + fvFormattedString(&options[OPT_CALCDYNELLIP].cName, "bCalcDynEllip"); + fvFormattedString(&options[OPT_CALCDYNELLIP].cDescr, "Calculate dynamical ellipticity from RotRate"); - sprintf(options[OPT_CALCDYNELLIP].cDefault, "0"); + fvFormattedString(&options[OPT_CALCDYNELLIP].cDefault, "0"); options[OPT_CALCDYNELLIP].dDefault = 0; options[OPT_CALCDYNELLIP].iType = 0; options[OPT_CALCDYNELLIP].bMultiFile = 1; fnRead[OPT_CALCDYNELLIP] = &ReadCalcDynEllip; - sprintf( - options[OPT_CALCDYNELLIP].cLongDescr, + fvFormattedString( + &options[OPT_CALCDYNELLIP].cLongDescr, "In DistRot, set this to 1 to force the equilibrium shape (dynamical \n" "ellipticity) to be calculated based on the current rotation rate and " "\n" @@ -189,54 +191,54 @@ void InitializeOptionsDistRot(OPTIONS *options, fnReadOption fnRead[]) { options[OPT_DYNELLIP].cName // XXX Check this! ); - sprintf(options[OPT_FORCEPRECRATE].cName, "bForcePrecRate"); - sprintf(options[OPT_FORCEPRECRATE].cDescr, + fvFormattedString(&options[OPT_FORCEPRECRATE].cName, "bForcePrecRate"); + fvFormattedString(&options[OPT_FORCEPRECRATE].cDescr, "Set the axial precession to a fixed rate?"); - sprintf(options[OPT_FORCEPRECRATE].cDefault, "0"); + fvFormattedString(&options[OPT_FORCEPRECRATE].cDefault, "0"); options[OPT_FORCEPRECRATE].dDefault = 0; options[OPT_FORCEPRECRATE].iType = 0; options[OPT_FORCEPRECRATE].bMultiFile = 1; fnRead[OPT_FORCEPRECRATE] = &ReadForcePrecRate; - sprintf(options[OPT_FORCEPRECRATE].cLongDescr, + fvFormattedString(&options[OPT_FORCEPRECRATE].cLongDescr, "In DisRot, set the axial precession rate to a fixed value. This " "option \n" "can mimic the forcing of a natural satellite, or be used for " "testing."); - sprintf(options[OPT_PRECRATE].cName, "dPrecRate"); - sprintf(options[OPT_PRECRATE].cDescr, + fvFormattedString(&options[OPT_PRECRATE].cName, "dPrecRate"); + fvFormattedString(&options[OPT_PRECRATE].cDescr, "Fixed rate of axial precession (angle/s)"); - sprintf(options[OPT_PRECRATE].cDefault, "7.7261e-12"); - sprintf(options[OPT_PRECRATE].cDimension, "angle/time"); + fvFormattedString(&options[OPT_PRECRATE].cDefault, "7.7261e-12"); + fvFormattedString(&options[OPT_PRECRATE].cDimension, "angle/time"); options[OPT_PRECRATE].dDefault = 7.7261e-12; options[OPT_PRECRATE].iType = 2; options[OPT_PRECRATE].bMultiFile = 1; fnRead[OPT_PRECRATE] = &ReadPrecRate; - sprintf(options[OPT_READORBITDATA].cLongDescr, + fvFormattedString(&options[OPT_READORBITDATA].cLongDescr, "Value of the body's axial precession frequency if %s is set to 1.\n" "Default value is the modern Earth's value as driven by the Moon.", options[OPT_FORCEPRECRATE].cName); - sprintf(options[OPT_SPECMOMINERTIA].cName, "dSpecMomInertia"); - sprintf(options[OPT_SPECMOMINERTIA].cDescr, + fvFormattedString(&options[OPT_SPECMOMINERTIA].cName, "dSpecMomInertia"); + fvFormattedString(&options[OPT_SPECMOMINERTIA].cDescr, "Specific moment of inertia of polar axis"); - sprintf(options[OPT_SPECMOMINERTIA].cDefault, "0.33"); - sprintf(options[OPT_SPECMOMINERTIA].cDimension, "nd"); + fvFormattedString(&options[OPT_SPECMOMINERTIA].cDefault, "0.33"); + fvFormattedString(&options[OPT_SPECMOMINERTIA].cDimension, "nd"); options[OPT_SPECMOMINERTIA].dDefault = 0.33; options[OPT_SPECMOMINERTIA].iType = 2; options[OPT_SPECMOMINERTIA].bMultiFile = 1; fnRead[OPT_SPECMOMINERTIA] = &ReadSpecMomInertia; - sprintf(options[OPT_FILEORBITDATA].cName, "sFileOrbitData"); + fvFormattedString(&options[OPT_FILEORBITDATA].cName, "sFileOrbitData"); // Define OPT_READORBITDATA so it can be used in the long help - sprintf(options[OPT_READORBITDATA].cName, "bReadOrbitData"); - sprintf(options[OPT_FILEORBITDATA].cDescr, + fvFormattedString(&options[OPT_READORBITDATA].cName, "bReadOrbitData"); + fvFormattedString(&options[OPT_FILEORBITDATA].cDescr, "Name of file containing orbit time series"); - sprintf(options[OPT_FILEORBITDATA].cDefault, "orbit.txt"); + fvFormattedString(&options[OPT_FILEORBITDATA].cDefault, "orbit.txt"); options[OPT_FILEORBITDATA].iType = 3; fnRead[OPT_FILEORBITDATA] = &ReadFileOrbitData; - sprintf( - options[OPT_FILEORBITDATA].cLongDescr, + fvFormattedString( + &options[OPT_FILEORBITDATA].cLongDescr, "File containing pre-computed orbital data. The file must have the \n" "following format: Time SemiMajorAxis Eccentricity Inclination \n" "ArgPericenter LongAscNode MeanAnomaly. The units of those \n" @@ -249,14 +251,14 @@ void InitializeOptionsDistRot(OPTIONS *options, fnReadOption fnRead[]) { options[OPT_FILEORBITDATA].cName, options[OPT_READORBITDATA].cName); // cName defined above - sprintf(options[OPT_READORBITDATA].cDescr, + fvFormattedString(&options[OPT_READORBITDATA].cDescr, "Read in orbital data for use with distrot?"); - sprintf(options[OPT_READORBITDATA].cDefault, "0"); + fvFormattedString(&options[OPT_READORBITDATA].cDefault, "0"); options[OPT_READORBITDATA].dDefault = 0; options[OPT_READORBITDATA].iType = 0; options[OPT_READORBITDATA].bMultiFile = 1; fnRead[OPT_READORBITDATA] = &ReadOrbitData; - sprintf(options[OPT_READORBITDATA].cLongDescr, + fvFormattedString(&options[OPT_READORBITDATA].cLongDescr, "Rather than calculate orbital evolution with DistOrb or SpiNBody, " "users \n" "may read in a previously run simulation. See %s for more \n" @@ -939,7 +941,7 @@ void VerifyHaltDistRot(BODY *body, CONTROL *control, OPTIONS *options, void WriteBodyDOblDtDistRot(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, - int iBody, double *dTmp, char cUnit[]) { + int iBody, double *dTmp, char **cUnit) { double dDeriv, dObldx, dObldy, dObldz; int iPert; @@ -980,7 +982,7 @@ void WriteBodyDOblDtDistRot(BODY *body, CONTROL *control, OUTPUT *output, if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { *dTmp *= fdUnitsTime(units->iTime); fsUnitsRate(units->iTime, cUnit); @@ -991,7 +993,7 @@ void WriteBodyDOblDtDistRot(BODY *body, CONTROL *control, OUTPUT *output, void WriteOblTimeDistRot(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, - int iBody, double *dTmp, char cUnit[]) { + int iBody, double *dTmp, char **cUnit) { double dDeriv, dObldx, dObldy, dObldz; int iPert; @@ -1036,7 +1038,7 @@ void WriteOblTimeDistRot(BODY *body, CONTROL *control, OUTPUT *output, if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { *dTmp *= fdUnitsTime(units->iTime); fsUnitsRate(units->iTime, cUnit); @@ -1047,7 +1049,7 @@ void WriteOblTimeDistRot(BODY *body, CONTROL *control, OUTPUT *output, void WritePrecATimeDistRot(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, - int iBody, double *dTmp, char cUnit[]) { + int iBody, double *dTmp, char **cUnit) { double dDeriv, dpAdx, dpAdy; int iPert; @@ -1077,7 +1079,7 @@ void WritePrecATimeDistRot(BODY *body, CONTROL *control, OUTPUT *output, if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { *dTmp /= fdUnitsTime(units->iTime); fsUnitsTime(units->iTime, cUnit); @@ -1088,7 +1090,7 @@ void WritePrecATimeDistRot(BODY *body, CONTROL *control, OUTPUT *output, void WriteBodyDPrecADtDistRot(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, - int iBody, double *dTmp, char cUnit[]) { + int iBody, double *dTmp, char **cUnit) { double dDeriv, dpAdx, dpAdy; int iPert; @@ -1114,7 +1116,7 @@ void WriteBodyDPrecADtDistRot(BODY *body, CONTROL *control, OUTPUT *output, if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { *dTmp *= fdUnitsTime(units->iTime); *dTmp /= fdUnitsAngle(units->iAngle); @@ -1125,7 +1127,7 @@ void WriteBodyDPrecADtDistRot(BODY *body, CONTROL *control, OUTPUT *output, void WriteBodyDXoblDtDistRot(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, - int iBody, double *dTmp, char cUnit[]) { + int iBody, double *dTmp, char **cUnit) { double dDeriv; int iPert; @@ -1139,7 +1141,7 @@ void WriteBodyDXoblDtDistRot(BODY *body, CONTROL *control, OUTPUT *output, if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { *dTmp *= fdUnitsTime(units->iTime); fsUnitsRate(units->iTime, cUnit); @@ -1148,7 +1150,7 @@ void WriteBodyDXoblDtDistRot(BODY *body, CONTROL *control, OUTPUT *output, void WriteBodyDYoblDtDistRot(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, - int iBody, double *dTmp, char cUnit[]) { + int iBody, double *dTmp, char **cUnit) { double dDeriv; int iPert; @@ -1162,7 +1164,7 @@ void WriteBodyDYoblDtDistRot(BODY *body, CONTROL *control, OUTPUT *output, if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { *dTmp *= fdUnitsTime(units->iTime); fsUnitsRate(units->iTime, cUnit); @@ -1171,7 +1173,7 @@ void WriteBodyDYoblDtDistRot(BODY *body, CONTROL *control, OUTPUT *output, void WriteBodyDZoblDtDistRot(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, - int iBody, double *dTmp, char cUnit[]) { + int iBody, double *dTmp, char **cUnit) { double dDeriv; int iPert; @@ -1185,7 +1187,7 @@ void WriteBodyDZoblDtDistRot(BODY *body, CONTROL *control, OUTPUT *output, if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { *dTmp *= fdUnitsTime(units->iTime); fsUnitsRate(units->iTime, cUnit); @@ -1194,7 +1196,7 @@ void WriteBodyDZoblDtDistRot(BODY *body, CONTROL *control, OUTPUT *output, void WriteXoblTimeDistRot(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, - int iBody, double *dTmp, char cUnit[]) { + int iBody, double *dTmp, char **cUnit) { double dDeriv; int iPert; @@ -1212,7 +1214,7 @@ void WriteXoblTimeDistRot(BODY *body, CONTROL *control, OUTPUT *output, if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { *dTmp *= fdUnitsTime(units->iTime); fsUnitsRate(units->iTime, cUnit); @@ -1221,7 +1223,7 @@ void WriteXoblTimeDistRot(BODY *body, CONTROL *control, OUTPUT *output, void WriteYoblTimeDistRot(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, - int iBody, double *dTmp, char cUnit[]) { + int iBody, double *dTmp, char **cUnit) { double dDeriv; int iPert; @@ -1239,7 +1241,7 @@ void WriteYoblTimeDistRot(BODY *body, CONTROL *control, OUTPUT *output, if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { *dTmp *= fdUnitsTime(units->iTime); fsUnitsRate(units->iTime, cUnit); @@ -1248,7 +1250,7 @@ void WriteYoblTimeDistRot(BODY *body, CONTROL *control, OUTPUT *output, void WriteZoblTimeDistRot(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, - int iBody, double *dTmp, char cUnit[]) { + int iBody, double *dTmp, char **cUnit) { double dDeriv; int iPert; @@ -1266,7 +1268,7 @@ void WriteZoblTimeDistRot(BODY *body, CONTROL *control, OUTPUT *output, if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { *dTmp *= fdUnitsTime(units->iTime); fsUnitsRate(units->iTime, cUnit); @@ -1276,7 +1278,7 @@ void WriteZoblTimeDistRot(BODY *body, CONTROL *control, OUTPUT *output, void WriteBodyCassOne(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, - double *dTmp, char cUnit[]) { + double *dTmp, char **cUnit) { double h, inc, longa, Lnorm = 0.0, obliq, eqnode; int i, jBody; @@ -1376,7 +1378,7 @@ void WriteBodyCassOne(BODY *body, CONTROL *control, OUTPUT *output, void WriteBodyCassTwo(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, - double *dTmp, char cUnit[]) { + double *dTmp, char **cUnit) { double h, inc, longa, Lnorm = 0.0, obliq, eqnode; int i, jBody; @@ -1479,24 +1481,24 @@ void WriteBodyCassTwo(BODY *body, CONTROL *control, OUTPUT *output, void WriteDynEllip(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, double *dTmp, - char cUnit[]) { + char **cUnit) { if (iBody > 0) { *dTmp = body[iBody].dDynEllip; } else { *dTmp = -1; } - sprintf(cUnit, "%s", ""); + fvFormattedString(cUnit, "%s", ""); } void WritePrecFNat(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, double *dTmp, - char cUnit[]) { + char **cUnit) { *dTmp = fndCentralTorqueR(body, iBody); if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { *dTmp *= fdUnitsTime(units->iTime); *dTmp /= fdUnitsAngle(units->iAngle); @@ -1507,122 +1509,122 @@ void WritePrecFNat(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, void InitializeOutputDistRot(OUTPUT *output, fnWriteOutput fnWrite[]) { - sprintf(output[OUT_DOBLDTDISTROT].cName, "DOblDtDistRot"); - sprintf(output[OUT_DOBLDTDISTROT].cDescr, "Body's dobl/dt in DistRot"); - sprintf(output[OUT_DOBLDTDISTROT].cNeg, "deg/year"); + fvFormattedString(&output[OUT_DOBLDTDISTROT].cName, "DOblDtDistRot"); + fvFormattedString(&output[OUT_DOBLDTDISTROT].cDescr, "Body's dobl/dt in DistRot"); + fvFormattedString(&output[OUT_DOBLDTDISTROT].cNeg, "deg/year"); output[OUT_DOBLDTDISTROT].bNeg = 1; output[OUT_DOBLDTDISTROT].dNeg = YEARSEC / DEGRAD; output[OUT_DOBLDTDISTROT].iNum = 1; output[OUT_DOBLDTDISTROT].iModuleBit = DISTROT; fnWrite[OUT_DOBLDTDISTROT] = &WriteBodyDOblDtDistRot; - sprintf(output[OUT_DPRECADTDISTROT].cName, "DPrecADtDistRot"); - sprintf(output[OUT_DPRECADTDISTROT].cDescr, "Body's dpA/dt in DistRot"); - sprintf(output[OUT_DPRECADTDISTROT].cNeg, "deg/year"); + fvFormattedString(&output[OUT_DPRECADTDISTROT].cName, "DPrecADtDistRot"); + fvFormattedString(&output[OUT_DPRECADTDISTROT].cDescr, "Body's dpA/dt in DistRot"); + fvFormattedString(&output[OUT_DPRECADTDISTROT].cNeg, "deg/year"); output[OUT_DPRECADTDISTROT].bNeg = 1; output[OUT_DPRECADTDISTROT].dNeg = YEARSEC / DEGRAD; output[OUT_DPRECADTDISTROT].iNum = 1; output[OUT_DPRECADTDISTROT].iModuleBit = DISTROT; fnWrite[OUT_DPRECADTDISTROT] = &WriteBodyDPrecADtDistRot; - sprintf(output[OUT_DXOBLDTDISTROT].cName, "DXoblDtDistRot"); - sprintf(output[OUT_DXOBLDTDISTROT].cDescr, "Body's dXobl/dt in DistRot"); - sprintf(output[OUT_DXOBLDTDISTROT].cNeg, "1/year"); + fvFormattedString(&output[OUT_DXOBLDTDISTROT].cName, "DXoblDtDistRot"); + fvFormattedString(&output[OUT_DXOBLDTDISTROT].cDescr, "Body's dXobl/dt in DistRot"); + fvFormattedString(&output[OUT_DXOBLDTDISTROT].cNeg, "1/year"); output[OUT_DXOBLDTDISTROT].bNeg = 1; output[OUT_DXOBLDTDISTROT].dNeg = YEARSEC; output[OUT_DXOBLDTDISTROT].iNum = 1; output[OUT_DXOBLDTDISTROT].iModuleBit = DISTROT; fnWrite[OUT_DXOBLDTDISTROT] = &WriteBodyDXoblDtDistRot; - sprintf(output[OUT_DYOBLDTDISTROT].cName, "DYoblDtDistRot"); - sprintf(output[OUT_DYOBLDTDISTROT].cDescr, "Body's dYobl/dt in DistRot"); - sprintf(output[OUT_DYOBLDTDISTROT].cNeg, "1/year"); + fvFormattedString(&output[OUT_DYOBLDTDISTROT].cName, "DYoblDtDistRot"); + fvFormattedString(&output[OUT_DYOBLDTDISTROT].cDescr, "Body's dYobl/dt in DistRot"); + fvFormattedString(&output[OUT_DYOBLDTDISTROT].cNeg, "1/year"); output[OUT_DYOBLDTDISTROT].bNeg = 1; output[OUT_DYOBLDTDISTROT].dNeg = YEARSEC; output[OUT_DYOBLDTDISTROT].iNum = 1; output[OUT_DYOBLDTDISTROT].iModuleBit = DISTROT; fnWrite[OUT_DYOBLDTDISTROT] = &WriteBodyDYoblDtDistRot; - sprintf(output[OUT_DZOBLDTDISTROT].cName, "DZoblDtDistRot"); - sprintf(output[OUT_DZOBLDTDISTROT].cDescr, "Body's dZobl/dt in DistRot"); - sprintf(output[OUT_DZOBLDTDISTROT].cNeg, "1/year"); + fvFormattedString(&output[OUT_DZOBLDTDISTROT].cName, "DZoblDtDistRot"); + fvFormattedString(&output[OUT_DZOBLDTDISTROT].cDescr, "Body's dZobl/dt in DistRot"); + fvFormattedString(&output[OUT_DZOBLDTDISTROT].cNeg, "1/year"); output[OUT_DZOBLDTDISTROT].bNeg = 1; output[OUT_DZOBLDTDISTROT].dNeg = YEARSEC; output[OUT_DZOBLDTDISTROT].iNum = 1; output[OUT_DZOBLDTDISTROT].iModuleBit = DISTROT; fnWrite[OUT_DZOBLDTDISTROT] = &WriteBodyDZoblDtDistRot; - sprintf(output[OUT_XOBLTIMEDISTROT].cName, "XoblTimeDistRot"); - sprintf(output[OUT_XOBLTIMEDISTROT].cDescr, "Xobl timescale in DistRot"); - sprintf(output[OUT_XOBLTIMEDISTROT].cNeg, "year"); + fvFormattedString(&output[OUT_XOBLTIMEDISTROT].cName, "XoblTimeDistRot"); + fvFormattedString(&output[OUT_XOBLTIMEDISTROT].cDescr, "Xobl timescale in DistRot"); + fvFormattedString(&output[OUT_XOBLTIMEDISTROT].cNeg, "year"); output[OUT_XOBLTIMEDISTROT].bNeg = 1; output[OUT_XOBLTIMEDISTROT].dNeg = 1. / YEARSEC; output[OUT_XOBLTIMEDISTROT].iNum = 1; output[OUT_XOBLTIMEDISTROT].iModuleBit = DISTROT; fnWrite[OUT_XOBLTIMEDISTROT] = &WriteXoblTimeDistRot; - sprintf(output[OUT_YOBLTIMEDISTROT].cName, "YoblTimeDistRot"); - sprintf(output[OUT_YOBLTIMEDISTROT].cDescr, "Yobl timescale in DistRot"); - sprintf(output[OUT_YOBLTIMEDISTROT].cNeg, "year"); + fvFormattedString(&output[OUT_YOBLTIMEDISTROT].cName, "YoblTimeDistRot"); + fvFormattedString(&output[OUT_YOBLTIMEDISTROT].cDescr, "Yobl timescale in DistRot"); + fvFormattedString(&output[OUT_YOBLTIMEDISTROT].cNeg, "year"); output[OUT_YOBLTIMEDISTROT].bNeg = 1; output[OUT_YOBLTIMEDISTROT].dNeg = 1. / YEARSEC; output[OUT_YOBLTIMEDISTROT].iNum = 1; output[OUT_YOBLTIMEDISTROT].iModuleBit = DISTROT; fnWrite[OUT_YOBLTIMEDISTROT] = &WriteYoblTimeDistRot; - sprintf(output[OUT_ZOBLTIMEDISTROT].cName, "ZoblTimeDistRot"); - sprintf(output[OUT_ZOBLTIMEDISTROT].cDescr, "Zobl timescale in DistRot"); - sprintf(output[OUT_ZOBLTIMEDISTROT].cNeg, "year"); + fvFormattedString(&output[OUT_ZOBLTIMEDISTROT].cName, "ZoblTimeDistRot"); + fvFormattedString(&output[OUT_ZOBLTIMEDISTROT].cDescr, "Zobl timescale in DistRot"); + fvFormattedString(&output[OUT_ZOBLTIMEDISTROT].cNeg, "year"); output[OUT_ZOBLTIMEDISTROT].bNeg = 1; output[OUT_ZOBLTIMEDISTROT].dNeg = 1. / YEARSEC; output[OUT_ZOBLTIMEDISTROT].iNum = 1; output[OUT_ZOBLTIMEDISTROT].iModuleBit = DISTROT; fnWrite[OUT_ZOBLTIMEDISTROT] = &WriteZoblTimeDistRot; - sprintf(output[OUT_OBLTIMEDISTROT].cName, "OblTimeDistRot"); - sprintf(output[OUT_OBLTIMEDISTROT].cDescr, "Obliquity timescale in DistRot"); - sprintf(output[OUT_OBLTIMEDISTROT].cNeg, "year"); + fvFormattedString(&output[OUT_OBLTIMEDISTROT].cName, "OblTimeDistRot"); + fvFormattedString(&output[OUT_OBLTIMEDISTROT].cDescr, "Obliquity timescale in DistRot"); + fvFormattedString(&output[OUT_OBLTIMEDISTROT].cNeg, "year"); output[OUT_OBLTIMEDISTROT].bNeg = 1; output[OUT_OBLTIMEDISTROT].dNeg = 1. / YEARSEC; output[OUT_OBLTIMEDISTROT].iNum = 1; output[OUT_OBLTIMEDISTROT].iModuleBit = DISTROT; fnWrite[OUT_OBLTIMEDISTROT] = &WriteOblTimeDistRot; - sprintf(output[OUT_PRECATIMEDISTROT].cName, "PrecATimeDistRot"); - sprintf(output[OUT_PRECATIMEDISTROT].cDescr, + fvFormattedString(&output[OUT_PRECATIMEDISTROT].cName, "PrecATimeDistRot"); + fvFormattedString(&output[OUT_PRECATIMEDISTROT].cDescr, "Axial precession timescale in DistRot"); - sprintf(output[OUT_PRECATIMEDISTROT].cNeg, "year"); + fvFormattedString(&output[OUT_PRECATIMEDISTROT].cNeg, "year"); output[OUT_PRECATIMEDISTROT].bNeg = 1; output[OUT_PRECATIMEDISTROT].dNeg = 1. / YEARSEC; output[OUT_PRECATIMEDISTROT].iNum = 1; output[OUT_PRECATIMEDISTROT].iModuleBit = DISTROT; fnWrite[OUT_PRECATIMEDISTROT] = &WritePrecATimeDistRot; - sprintf(output[OUT_CASS1].cName, "CassiniOne"); - sprintf(output[OUT_CASS1].cDescr, + fvFormattedString(&output[OUT_CASS1].cName, "CassiniOne"); + fvFormattedString(&output[OUT_CASS1].cDescr, "First Cassini parameter (misalignment of Cassini state vectors)"); output[OUT_CASS1].bNeg = 0; output[OUT_CASS1].iNum = 1; output[OUT_CASS1].iModuleBit = DISTROT; fnWrite[OUT_CASS1] = &WriteBodyCassOne; - sprintf(output[OUT_CASS2].cName, "CassiniTwo"); - sprintf(output[OUT_CASS2].cDescr, + fvFormattedString(&output[OUT_CASS2].cName, "CassiniTwo"); + fvFormattedString(&output[OUT_CASS2].cDescr, "Second Cassini parameter (alignment of Cassini state vectors"); output[OUT_CASS2].bNeg = 0; output[OUT_CASS2].iNum = 1; output[OUT_CASS2].iModuleBit = DISTROT; fnWrite[OUT_CASS2] = &WriteBodyCassTwo; - sprintf(output[OUT_DYNELLIP].cName, "DynEllip"); - sprintf(output[OUT_DYNELLIP].cDescr, "dynamical ellipticity of planet"); + fvFormattedString(&output[OUT_DYNELLIP].cName, "DynEllip"); + fvFormattedString(&output[OUT_DYNELLIP].cDescr, "dynamical ellipticity of planet"); output[OUT_DYNELLIP].bNeg = 0; output[OUT_DYNELLIP].iNum = 1; output[OUT_DYNELLIP].iModuleBit = DISTROT; fnWrite[OUT_DYNELLIP] = &WriteDynEllip; - sprintf(output[OUT_PRECFNAT].cName, "PrecFNat"); - sprintf(output[OUT_PRECFNAT].cDescr, "natural precession freq of planet"); + fvFormattedString(&output[OUT_PRECFNAT].cName, "PrecFNat"); + fvFormattedString(&output[OUT_PRECFNAT].cDescr, "natural precession freq of planet"); output[OUT_PRECFNAT].bNeg = 0; output[OUT_PRECFNAT].iNum = 1; output[OUT_PRECFNAT].iModuleBit = DISTROT; diff --git a/src/distrot.h b/src/distrot.h index 793a96053..cc2e9b879 100644 --- a/src/distrot.h +++ b/src/distrot.h @@ -77,31 +77,31 @@ void FinalizeUpdateZoblDistRot(BODY *, UPDATE *, int *, int, int, int); void HelpOutputDistRot(OUTPUT *); void WriteBodyDOblDtDistRot(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, - UPDATE *, int, double *, char[]); + UPDATE *, int, double *, char**); void WriteBodyDPrecADtDistRot(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, - UPDATE *, int, double *, char[]); + UPDATE *, int, double *, char**); void WriteBodyDXoblDtDistRot(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, - UPDATE *, int, double *, char[]); + UPDATE *, int, double *, char**); void WriteBodyDYoblADtDistRot(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, - UPDATE *, int, double *, char[]); + UPDATE *, int, double *, char**); void WriteBodyDZoblDtDistRot(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, - UPDATE *, int, double *, char[]); + UPDATE *, int, double *, char**); void WriteBodyXobl(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, UPDATE *, - int, double *, char[]); + int, double *, char**); void WriteBodyYobl(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, UPDATE *, - int, double *, char[]); + int, double *, char**); void WriteBodyZobl(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, UPDATE *, - int, double *, char[]); + int, double *, char**); void WriteOblTimeDistRot(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, - UPDATE *, int, double *, char[]); + UPDATE *, int, double *, char**); void WritePrecATimeDistRot(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, - UPDATE *, int, double *, char[]); + UPDATE *, int, double *, char**); void WriteXoblTimeDistRot(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, - UPDATE *, int, double *, char[]); + UPDATE *, int, double *, char**); void WriteYoblTimeDistRot(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, - UPDATE *, int, double *, char[]); + UPDATE *, int, double *, char**); void WriteZoblTimeDistRot(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, - UPDATE *, int, double *, char[]); + UPDATE *, int, double *, char**); void InitializeOutputDistRot(OUTPUT *, fnWriteOutput[]); diff --git a/src/eqtide.c b/src/eqtide.c index 00af30eeb..de5c84e59 100644 --- a/src/eqtide.c +++ b/src/eqtide.c @@ -613,11 +613,11 @@ void ReadTidePerts(BODY *body, CONTROL *control, FILES *files, OPTIONS *options, SYSTEM *system, int iFile) { int iBody, iNumIndices = 0, iNumLines = 0; int *lTmp; - char saTmp[MAXARRAY][OPTLEN]; + char **saTmp; lTmp = malloc(MAXLINES * sizeof(int)); - AddOptionStringArray(files->Infile[iFile].cIn, options->cName, saTmp, + AddOptionStringArray(files->Infile[iFile].cIn, options->cName, &saTmp, &iNumIndices, &iNumLines, lTmp, control->Io.iVerbose); if (lTmp[0] >= 0) { NotPrimaryInput(iFile, options->cName, files->Infile[iFile].cIn, lTmp[0], @@ -625,8 +625,8 @@ void ReadTidePerts(BODY *body, CONTROL *control, FILES *files, OPTIONS *options, /* Now do some initializing */ body[iFile - 1].iTidePerts = iNumIndices; for (iBody = 0; iBody < iNumIndices; iBody++) { - memset(body[iFile - 1].saTidePerts[iBody], '\0', NAMELEN); - strcpy(body[iFile - 1].saTidePerts[iBody], saTmp[iBody]); + body[iFile - 1].saTidePerts[iBody] = NULL; + fvFormattedString(&body[iFile - 1].saTidePerts[iBody], saTmp[iBody]); } UpdateFoundOptionMulti(&files->Infile[iFile], options, lTmp, iNumLines, iFile); @@ -718,14 +718,14 @@ void ReadEqtideEnvTides(BODY *body, CONTROL *control, FILES *files, void InitializeOptionsEqtide(OPTIONS *options, fnReadOption fnRead[]) { - sprintf(options[OPT_DISCRETEROT].cName, "bDiscreteRot"); - sprintf(options[OPT_DISCRETEROT].cDescr, + fvFormattedString(&options[OPT_DISCRETEROT].cName, "bDiscreteRot"); + fvFormattedString(&options[OPT_DISCRETEROT].cDescr, "Use Discrete Rotation Model (Phase lag only)"); - sprintf(options[OPT_DISCRETEROT].cDefault, "1"); + fvFormattedString(&options[OPT_DISCRETEROT].cDefault, "1"); options[OPT_DISCRETEROT].iType = 0; fnRead[OPT_DISCRETEROT] = &ReadDiscreteRot; - sprintf( - options[OPT_DISCRETEROT].cLongDescr, + fvFormattedString( + &options[OPT_DISCRETEROT].cLongDescr, "In the CPL model of EqTide, this option toggles between two ways in \n" "which the rotation rate behaves once it has damped to equilibrium. \n" "The rigorous model only has two states: 1:1 and 3:2 frequency ratios, " @@ -739,13 +739,13 @@ void InitializeOptionsEqtide(OPTIONS *options, fnReadOption fnRead[]) { "the \n" "mean motion."); - sprintf(options[OPT_FIXORBIT].cName, "bFixOrbit"); - sprintf(options[OPT_FIXORBIT].cDescr, "Fix Orbital Elements?"); - sprintf(options[OPT_FIXORBIT].cDefault, "0"); + fvFormattedString(&options[OPT_FIXORBIT].cName, "bFixOrbit"); + fvFormattedString(&options[OPT_FIXORBIT].cDescr, "Fix Orbital Elements?"); + fvFormattedString(&options[OPT_FIXORBIT].cDefault, "0"); options[OPT_FIXORBIT].iType = 0; options[OPT_FIXORBIT].bMultiFile = 1; fnRead[OPT_FIXORBIT] = &ReadFixOrbit; - sprintf(options[OPT_FIXORBIT].cLongDescr, + fvFormattedString(&options[OPT_FIXORBIT].cLongDescr, "In EqTide, setting this value to 1 holds the eccentricity and " "semi-major \n" "axis fixed during the evolution. This option can be helpful for " @@ -754,18 +754,18 @@ void InitializeOptionsEqtide(OPTIONS *options, fnReadOption fnRead[]) { "eccentricity. \n" "(Although a bFixEcc option would probably be better!)\n"); - sprintf(options[OPT_MAXLOCKDIFF].cName, "dMaxLockDiff"); - sprintf(options[OPT_FORCEEQSPIN].cName, "bForceEqSpin"); // for LongDescr - sprintf(options[OPT_MAXLOCKDIFF].cDescr, + fvFormattedString(&options[OPT_MAXLOCKDIFF].cName, "dMaxLockDiff"); + fvFormattedString(&options[OPT_FORCEEQSPIN].cName, "bForceEqSpin"); // for LongDescr + fvFormattedString(&options[OPT_MAXLOCKDIFF].cDescr, "Maximum relative difference between spin and equilibrium spin rates " "to force equilibrium rate"); - sprintf(options[OPT_MAXLOCKDIFF].cDefault, "0"); - sprintf(options[OPT_MAXLOCKDIFF].cDimension, "nd"); + fvFormattedString(&options[OPT_MAXLOCKDIFF].cDefault, "0"); + fvFormattedString(&options[OPT_MAXLOCKDIFF].cDimension, "nd"); options[OPT_MAXLOCKDIFF].dDefault = 0; options[OPT_MAXLOCKDIFF].iType = 2; options[OPT_MAXLOCKDIFF].bMultiFile = 1; fnRead[OPT_MAXLOCKDIFF] = &ReadMaxLockDiff; - sprintf(options[OPT_MAXLOCKDIFF].cLongDescr, + fvFormattedString(&options[OPT_MAXLOCKDIFF].cLongDescr, "In EqTide, this is the maximum relative difference between the " "actual \n" "spin rate and the equilibrium spin rate without tidal locking. See " @@ -774,13 +774,13 @@ void InitializeOptionsEqtide(OPTIONS *options, fnReadOption fnRead[]) { options[OPT_FORCEEQSPIN].cName, options[OPT_FORCEEQSPIN].cName); // cName defined above - sprintf(options[OPT_FORCEEQSPIN].cDescr, "Force Spin Rate to Equilibrium?"); - sprintf(options[OPT_FORCEEQSPIN].cDefault, "0"); + fvFormattedString(&options[OPT_FORCEEQSPIN].cDescr, "Force Spin Rate to Equilibrium?"); + fvFormattedString(&options[OPT_FORCEEQSPIN].cDefault, "0"); options[OPT_FORCEEQSPIN].iType = 0; options[OPT_FORCEEQSPIN].bMultiFile = 1; fnRead[OPT_FORCEEQSPIN] = &ReadForceEqSpin; - sprintf( - options[OPT_FORCEEQSPIN].cLongDescr, + fvFormattedString( + &options[OPT_FORCEEQSPIN].cLongDescr, "Set this option to 1 to force the rotation rate to the equilibrium \n" "tidal value in EqTide. If set to 0, the rotation rate may \"bounce\" " "\n" @@ -798,191 +798,191 @@ void InitializeOptionsEqtide(OPTIONS *options, fnReadOption fnRead[]) { "torque.", options[OPT_MAXLOCKDIFF].cName); - sprintf(options[OPT_HALTDBLSYNC].cName, "bHaltDblSync"); - sprintf(options[OPT_HALTDBLSYNC].cDescr, "Halt at Double Synchronous State?"); - sprintf(options[OPT_HALTDBLSYNC].cDefault, "0"); + fvFormattedString(&options[OPT_HALTDBLSYNC].cName, "bHaltDblSync"); + fvFormattedString(&options[OPT_HALTDBLSYNC].cDescr, "Halt at Double Synchronous State?"); + fvFormattedString(&options[OPT_HALTDBLSYNC].cDefault, "0"); options[OPT_HALTDBLSYNC].iType = 0; fnRead[OPT_HALTDBLSYNC] = &ReadHaltDblSync; - sprintf(options[OPT_HALTTIDELOCK].cName, "bHaltTideLock"); - sprintf(options[OPT_HALTTIDELOCK].cDescr, "Halt if Tide-Locked?"); - sprintf(options[OPT_HALTTIDELOCK].cDefault, "0"); + fvFormattedString(&options[OPT_HALTTIDELOCK].cName, "bHaltTideLock"); + fvFormattedString(&options[OPT_HALTTIDELOCK].cDescr, "Halt if Tide-Locked?"); + fvFormattedString(&options[OPT_HALTTIDELOCK].cDefault, "0"); options[OPT_HALTTIDELOCK].iType = 0; options[OPT_HALTTIDELOCK].bMultiFile = 1; fnRead[OPT_HALTTIDELOCK] = &ReadHaltTideLock; - sprintf(options[OPT_TIDALRADIUS].cName, "dTidalRadius"); - sprintf(options[OPT_TIDALRADIUS].cDescr, "Eqtide Tidal Radius"); - sprintf(options[OPT_TIDALRADIUS].cDefault, "1 Earth Radius"); - sprintf(options[OPT_TIDALRADIUS].cDimension, "length"); + fvFormattedString(&options[OPT_TIDALRADIUS].cName, "dTidalRadius"); + fvFormattedString(&options[OPT_TIDALRADIUS].cDescr, "Eqtide Tidal Radius"); + fvFormattedString(&options[OPT_TIDALRADIUS].cDefault, "1 Earth Radius"); + fvFormattedString(&options[OPT_TIDALRADIUS].cDimension, "length"); options[OPT_TIDALRADIUS].dDefault = REARTH; options[OPT_TIDALRADIUS].iType = 2; options[OPT_TIDALRADIUS].bMultiFile = 1; options[OPT_TIDALRADIUS].dNeg = REARTH; - sprintf(options[OPT_TIDALRADIUS].cNeg, "Rearth"); + fvFormattedString(&options[OPT_TIDALRADIUS].cNeg, "Rearth"); fnRead[OPT_TIDALRADIUS] = &ReadTidalRadius; - sprintf(options[OPT_HALTSYNCROT].cName, "bHaltSyncRot"); - sprintf(options[OPT_HALTSYNCROT].cDescr, + fvFormattedString(&options[OPT_HALTSYNCROT].cName, "bHaltSyncRot"); + fvFormattedString(&options[OPT_HALTSYNCROT].cDescr, "Halt if the rotation becomes syncrhonous?"); - sprintf(options[OPT_HALTSYNCROT].cDefault, "0"); + fvFormattedString(&options[OPT_HALTSYNCROT].cDefault, "0"); options[OPT_HALTSYNCROT].iType = 0; options[OPT_HALTSYNCROT].bMultiFile = 1; fnRead[OPT_HALTSYNCROT] = &ReadHaltSyncRot; - sprintf(options[OPT_K2].cName, "dK2"); - sprintf(options[OPT_K2].cDescr, "Love Number of Degree 2"); - sprintf(options[OPT_K2].cDefault, "1"); - sprintf(options[OPT_K2].cDimension, "nd"); + fvFormattedString(&options[OPT_K2].cName, "dK2"); + fvFormattedString(&options[OPT_K2].cDescr, "Love Number of Degree 2"); + fvFormattedString(&options[OPT_K2].cDefault, "1"); + fvFormattedString(&options[OPT_K2].cDimension, "nd"); options[OPT_K2].dDefault = 1; options[OPT_K2].iType = 2; options[OPT_K2].bMultiFile = 1; fnRead[OPT_K2] = &ReadK2; - sprintf(options[OPT_K2OCEAN].cName, "dK2Ocean"); - sprintf(options[OPT_K2OCEAN].cDescr, "Ocean's Love Number of Degree 2"); - sprintf(options[OPT_K2OCEAN].cDefault, "0.05"); - sprintf(options[OPT_K2OCEAN].cDimension, "nd"); + fvFormattedString(&options[OPT_K2OCEAN].cName, "dK2Ocean"); + fvFormattedString(&options[OPT_K2OCEAN].cDescr, "Ocean's Love Number of Degree 2"); + fvFormattedString(&options[OPT_K2OCEAN].cDefault, "0.05"); + fvFormattedString(&options[OPT_K2OCEAN].cDimension, "nd"); options[OPT_K2OCEAN].dDefault = 0.01; options[OPT_K2OCEAN].iType = 2; options[OPT_K2OCEAN].bMultiFile = 1; fnRead[OPT_K2OCEAN] = &ReadK2Ocean; - sprintf(options[OPT_K2ENV].cName, "dK2Env"); - sprintf(options[OPT_K2ENV].cDescr, "Envelope's Love Number of Degree 2"); - sprintf(options[OPT_K2ENV].cDefault, "0.01"); - sprintf(options[OPT_K2ENV].cDimension, "nd"); + fvFormattedString(&options[OPT_K2ENV].cName, "dK2Env"); + fvFormattedString(&options[OPT_K2ENV].cDescr, "Envelope's Love Number of Degree 2"); + fvFormattedString(&options[OPT_K2ENV].cDefault, "0.01"); + fvFormattedString(&options[OPT_K2ENV].cDimension, "nd"); options[OPT_K2ENV].dDefault = 0.01; options[OPT_K2ENV].iType = 2; options[OPT_K2ENV].bMultiFile = 1; fnRead[OPT_K2ENV] = &ReadK2Env; - sprintf(options[OPT_MAXLOCKDIFF].cName, "dMaxLockDiff"); - sprintf(options[OPT_MAXLOCKDIFF].cDescr, + fvFormattedString(&options[OPT_MAXLOCKDIFF].cName, "dMaxLockDiff"); + fvFormattedString(&options[OPT_MAXLOCKDIFF].cDescr, "Maximum relative difference between spin and equilibrium spin rates " "to force equilibrium spin rate"); - sprintf(options[OPT_MAXLOCKDIFF].cDefault, "0"); - sprintf(options[OPT_MAXLOCKDIFF].cDimension, "nd"); + fvFormattedString(&options[OPT_MAXLOCKDIFF].cDefault, "0"); + fvFormattedString(&options[OPT_MAXLOCKDIFF].cDimension, "nd"); options[OPT_MAXLOCKDIFF].dDefault = 0; options[OPT_MAXLOCKDIFF].iType = 2; options[OPT_MAXLOCKDIFF].bMultiFile = 1; fnRead[OPT_MAXLOCKDIFF] = &ReadMaxLockDiff; - sprintf(options[OPT_OCEANTIDES].cName, "bOceanTides"); - sprintf(options[OPT_OCEANTIDES].cDescr, "Include effects of ocean tides?"); - sprintf(options[OPT_OCEANTIDES].cDefault, "0"); + fvFormattedString(&options[OPT_OCEANTIDES].cName, "bOceanTides"); + fvFormattedString(&options[OPT_OCEANTIDES].cDescr, "Include effects of ocean tides?"); + fvFormattedString(&options[OPT_OCEANTIDES].cDefault, "0"); options[OPT_OCEANTIDES].iType = 0; options[OPT_OCEANTIDES].bMultiFile = 1; fnRead[OPT_OCEANTIDES] = &ReadEqtideOceanTides; - sprintf(options[OPT_MANTLETIDES].cName, "bMantleTides"); - sprintf(options[OPT_MANTLETIDES].cDescr, "Include effects of mantle tides?"); - sprintf(options[OPT_MANTLETIDES].cDefault, "0"); + fvFormattedString(&options[OPT_MANTLETIDES].cName, "bMantleTides"); + fvFormattedString(&options[OPT_MANTLETIDES].cDescr, "Include effects of mantle tides?"); + fvFormattedString(&options[OPT_MANTLETIDES].cDefault, "0"); options[OPT_MANTLETIDES].iType = 0; options[OPT_MANTLETIDES].bMultiFile = 1; fnRead[OPT_MANTLETIDES] = &ReadEqtideMantleTides; - // XXX What does this do? - sprintf(options[OPT_USETIDALRADIUS].cName, "bUseTidalRadius"); - sprintf(options[OPT_USETIDALRADIUS].cDescr, + // XXX What does this option do? + fvFormattedString(&options[OPT_USETIDALRADIUS].cName, "bUseTidalRadius"); + fvFormattedString(&options[OPT_USETIDALRADIUS].cDescr, "Fix radius used for CPL tidal equations?"); - sprintf(options[OPT_USETIDALRADIUS].cDefault, "0"); + fvFormattedString(&options[OPT_USETIDALRADIUS].cDefault, "0"); options[OPT_USETIDALRADIUS].iType = 0; options[OPT_USETIDALRADIUS].bMultiFile = 1; fnRead[OPT_USETIDALRADIUS] = &ReadUseTidalRadius; - sprintf(options[OPT_ENVTIDES].cName, "bEnvTides"); - sprintf(options[OPT_ENVTIDES].cDescr, + fvFormattedString(&options[OPT_ENVTIDES].cName, "bEnvTides"); + fvFormattedString(&options[OPT_ENVTIDES].cDescr, "Include effects of gaseous envelope tides?"); - sprintf(options[OPT_ENVTIDES].cDefault, "0"); + fvFormattedString(&options[OPT_ENVTIDES].cDefault, "0"); options[OPT_ENVTIDES].iType = 0; options[OPT_ENVTIDES].bMultiFile = 1; fnRead[OPT_ENVTIDES] = &ReadEqtideEnvTides; - sprintf(options[OPT_SYNCECC].cName, "dSyncEcc"); - sprintf(options[OPT_SYNCECC].cDescr, + fvFormattedString(&options[OPT_SYNCECC].cName, "dSyncEcc"); + fvFormattedString(&options[OPT_SYNCECC].cDescr, "Minimum Eccentricity for Non-Synchronous Rotation"); - sprintf(options[OPT_SYNCECC].cDefault, "0"); - sprintf(options[OPT_SYNCECC].cDimension, "nd"); + fvFormattedString(&options[OPT_SYNCECC].cDefault, "0"); + fvFormattedString(&options[OPT_SYNCECC].cDimension, "nd"); options[OPT_SYNCECC].dDefault = 0; options[OPT_SYNCECC].iType = 2; options[OPT_SYNCECC].bMultiFile = 1; fnRead[OPT_SYNCECC] = &ReadSyncEcc; - sprintf(options[OPT_TIDALQ].cName, "dTidalQ"); - sprintf(options[OPT_TIDALQ].cDescr, "Tidal Quality Factor"); - sprintf(options[OPT_TIDALQ].cDefault, "1e6"); - sprintf(options[OPT_TIDALQ].cDimension, "nd"); + fvFormattedString(&options[OPT_TIDALQ].cName, "dTidalQ"); + fvFormattedString(&options[OPT_TIDALQ].cDescr, "Tidal Quality Factor"); + fvFormattedString(&options[OPT_TIDALQ].cDefault, "1e6"); + fvFormattedString(&options[OPT_TIDALQ].cDimension, "nd"); options[OPT_TIDALQ].dDefault = 1e6; options[OPT_TIDALQ].iType = 2; options[OPT_TIDALQ].bMultiFile = 1; fnRead[OPT_TIDALQ] = &ReadTidalQ; - sprintf(options[OPT_TIDALQOCEAN].cName, "dTidalQOcean"); - sprintf(options[OPT_TIDALQOCEAN].cDescr, "Ocean Tidal Quality Factor"); - sprintf(options[OPT_TIDALQOCEAN].cDefault, "12"); - sprintf(options[OPT_TIDALQOCEAN].cDimension, "nd"); + fvFormattedString(&options[OPT_TIDALQOCEAN].cName, "dTidalQOcean"); + fvFormattedString(&options[OPT_TIDALQOCEAN].cDescr, "Ocean Tidal Quality Factor"); + fvFormattedString(&options[OPT_TIDALQOCEAN].cDefault, "12"); + fvFormattedString(&options[OPT_TIDALQOCEAN].cDimension, "nd"); options[OPT_TIDALQOCEAN].dDefault = 12; options[OPT_TIDALQOCEAN].iType = 2; options[OPT_TIDALQOCEAN].bMultiFile = 1; fnRead[OPT_TIDALQOCEAN] = &ReadTidalQOcean; - sprintf(options[OPT_TIDALQENV].cName, "dTidalQEnv"); - sprintf(options[OPT_TIDALQENV].cDescr, "Envelope Tidal Quality Factor"); - sprintf(options[OPT_TIDALQENV].cDefault, "1.0e4"); - sprintf(options[OPT_TIDALQENV].cDimension, "nd"); + fvFormattedString(&options[OPT_TIDALQENV].cName, "dTidalQEnv"); + fvFormattedString(&options[OPT_TIDALQENV].cDescr, "Envelope Tidal Quality Factor"); + fvFormattedString(&options[OPT_TIDALQENV].cDefault, "1.0e4"); + fvFormattedString(&options[OPT_TIDALQENV].cDimension, "nd"); options[OPT_TIDALQENV].dDefault = 1.0e4; options[OPT_TIDALQENV].iType = 2; options[OPT_TIDALQENV].bMultiFile = 1; fnRead[OPT_TIDALQENV] = &ReadTidalQEnv; - sprintf(options[OPT_TIDALTAU].cName, "dTidalTau"); - sprintf(options[OPT_TIDALTAU].cDescr, "Tidal Time Lag"); - sprintf(options[OPT_TIDALTAU].cDefault, "1 Second"); - sprintf(options[OPT_TIDALTAU].cDimension, "time"); + fvFormattedString(&options[OPT_TIDALTAU].cName, "dTidalTau"); + fvFormattedString(&options[OPT_TIDALTAU].cDescr, "Tidal Time Lag"); + fvFormattedString(&options[OPT_TIDALTAU].cDefault, "1 Second"); + fvFormattedString(&options[OPT_TIDALTAU].cDimension, "time"); options[OPT_TIDALTAU].dDefault = 1; options[OPT_TIDALTAU].iType = 2; options[OPT_TIDALTAU].bMultiFile = 1; options[OPT_TIDALTAU].dNeg = 1; - sprintf(options[OPT_TIDALTAU].cNeg, "Seconds"); + fvFormattedString(&options[OPT_TIDALTAU].cNeg, "Seconds"); fnRead[OPT_TIDALTAU] = &ReadTidalTau; - sprintf(options[OPT_TIDEMODEL].cName, "sTideModel"); - sprintf(options[OPT_TIDEMODEL].cDescr, + fvFormattedString(&options[OPT_TIDEMODEL].cName, "sTideModel"); + fvFormattedString(&options[OPT_TIDEMODEL].cDescr, "Tidal Model: p2 [constant-phase-lag, 2nd order] t8 " "[constant-time-lag, 8th order]"); - sprintf(options[OPT_TIDEMODEL].cDefault, "p2"); + fvFormattedString(&options[OPT_TIDEMODEL].cDefault, "p2"); options[OPT_TIDEMODEL].iType = 3; fnRead[OPT_TIDEMODEL] = &ReadTideModel; - sprintf(options[OPT_TIDEPERTS].cName, "saTidePerts"); - sprintf(options[OPT_TIDEPERTS].cDescr, + fvFormattedString(&options[OPT_TIDEPERTS].cName, "saTidePerts"); + fvFormattedString(&options[OPT_TIDEPERTS].cDescr, "Names of bodies engaged in tidal evolution"); - sprintf(options[OPT_TIDEPERTS].cDefault, "none"); + fvFormattedString(&options[OPT_TIDEPERTS].cDefault, "none"); options[OPT_TIDEPERTS].iType = 13; fnRead[OPT_TIDEPERTS] = &ReadTidePerts; - sprintf(options[OPT_OCEANTIDES].cName, "bOceanTides"); - sprintf(options[OPT_OCEANTIDES].cDescr, + fvFormattedString(&options[OPT_OCEANTIDES].cName, "bOceanTides"); + fvFormattedString(&options[OPT_OCEANTIDES].cDescr, "Include tidal dissapation due to oceans?"); - sprintf(options[OPT_OCEANTIDES].cDefault, "0"); + fvFormattedString(&options[OPT_OCEANTIDES].cDefault, "0"); options[OPT_OCEANTIDES].iType = 0; options[OPT_OCEANTIDES].bMultiFile = 1; fnRead[OPT_OCEANTIDES] = &ReadEqtideOceanTides; - sprintf(options[OPT_TIDALQMANTLE].cName, "dTidalQMantle"); - sprintf(options[OPT_TIDALQMANTLE].cDescr, "Tidal Q of Mantle"); - sprintf(options[OPT_TIDALQMANTLE].cDefault, "100"); - sprintf(options[OPT_TIDALQMANTLE].cDimension, "nd"); + fvFormattedString(&options[OPT_TIDALQMANTLE].cName, "dTidalQMantle"); + fvFormattedString(&options[OPT_TIDALQMANTLE].cDescr, "Tidal Q of Mantle"); + fvFormattedString(&options[OPT_TIDALQMANTLE].cDefault, "100"); + fvFormattedString(&options[OPT_TIDALQMANTLE].cDimension, "nd"); options[OPT_TIDALQMANTLE].dDefault = 100; options[OPT_TIDALQMANTLE].iType = 2; options[OPT_TIDALQMANTLE].bMultiFile = 1; fnRead[OPT_TIDALQMANTLE] = &ReadTidalQMantle; - sprintf(options[OPT_K2MANTLE].cName, "dK2Mantle"); - sprintf(options[OPT_K2MANTLE].cDescr, "Mantle's Love Number of Degree 2"); - sprintf(options[OPT_K2MANTLE].cDefault, "0.01"); - sprintf(options[OPT_K2MANTLE].cDimension, "nd"); + fvFormattedString(&options[OPT_K2MANTLE].cName, "dK2Mantle"); + fvFormattedString(&options[OPT_K2MANTLE].cDescr, "Mantle's Love Number of Degree 2"); + fvFormattedString(&options[OPT_K2MANTLE].cDefault, "0.01"); + fvFormattedString(&options[OPT_K2MANTLE].cDimension, "nd"); options[OPT_K2MANTLE].dDefault = 0.01; options[OPT_K2MANTLE].iType = 2; options[OPT_K2MANTLE].bMultiFile = 1; @@ -1304,9 +1304,10 @@ void VerifyCTL(BODY *body, CONTROL *control, FILES *files, OPTIONS *options, if (files->Outfile[iBody].iNumCols > 0) { for (iCol = 0; iCol < files->Outfile[iBody].iNumCols; iCol++) { - if (memcmp(files->Outfile[iBody].caCol[iCol], - output[OUT_EQROTPERCONT].cName, - strlen(output[OUT_EQROTPERCONT].cName)) == 0) { + // if (memcmp(files->Outfile[iBody].caCol[iCol], + // output[OUT_EQROTPERCONT].cName, + // strlen(output[OUT_EQROTPERCONT].cName)) == 0) { + if (strcmp(files->Outfile[iBody].caCol[iCol],output[OUT_EQROTPERCONT].cName) == 0) { if (control->Io.iVerbose >= VERBINPUT) { fprintf(stderr, "ERROR: Time lag model selected; output %s is not allowed.\n", @@ -1320,9 +1321,10 @@ void VerifyCTL(BODY *body, CONTROL *control, FILES *files, OPTIONS *options, options[OPT_OUTPUTORDER].iLine[iBody + 1]); } - if (memcmp(files->Outfile[iBody].caCol[iCol], - output[OUT_EQROTPERDISCRETE].cName, - strlen(output[OUT_EQROTPERDISCRETE].cName)) == 0) { + // if (memcmp(files->Outfile[iBody].caCol[iCol], + // output[OUT_EQROTPERDISCRETE].cName, + // strlen(output[OUT_EQROTPERDISCRETE].cName)) == 0) { + if (strcmp(files->Outfile[iBody].caCol[iCol],output[OUT_EQROTPERDISCRETE].cName) == 0) { if (control->Io.iVerbose >= VERBINPUT) { fprintf(stderr, "ERROR: Time lag model selected; output %s is not allowed.\n", @@ -1336,9 +1338,10 @@ void VerifyCTL(BODY *body, CONTROL *control, FILES *files, OPTIONS *options, options[OPT_OUTPUTORDER].iLine[iBody + 1]); } - if (memcmp(files->Outfile[iBody].caCol[iCol], - output[OUT_EQROTRATECONT].cName, - strlen(output[OUT_EQROTRATECONT].cName)) == 0) { + // if (memcmp(files->Outfile[iBody].caCol[iCol], + // output[OUT_EQROTRATECONT].cName, + // strlen(output[OUT_EQROTRATECONT].cName)) == 0) { + if (strcmp(files->Outfile[iBody].caCol[iCol],output[OUT_EQROTRATECONT].cName) == 0) { if (control->Io.iVerbose >= VERBINPUT) { fprintf(stderr, "ERROR: Time lag model selected; output %s is not allowed.\n", @@ -1352,9 +1355,10 @@ void VerifyCTL(BODY *body, CONTROL *control, FILES *files, OPTIONS *options, options[OPT_OUTPUTORDER].iLine[iBody + 1]); } - if (memcmp(files->Outfile[iBody].caCol[iCol], - output[OUT_EQROTRATEDISCRETE].cName, - strlen(output[OUT_EQROTRATEDISCRETE].cName)) == 0) { + // if (memcmp(files->Outfile[iBody].caCol[iCol], + // output[OUT_EQROTRATEDISCRETE].cName, + // strlen(output[OUT_EQROTRATEDISCRETE].cName)) == 0) { + if (strcmp(files->Outfile[iBody].caCol[iCol],output[OUT_EQROTRATEDISCRETE].cName) == 0) { if (control->Io.iVerbose >= VERBINPUT) { fprintf(stderr, "ERROR: Time lag model selected; output %s is not allowed.\n", @@ -1368,8 +1372,9 @@ void VerifyCTL(BODY *body, CONTROL *control, FILES *files, OPTIONS *options, options[OPT_OUTPUTORDER].iLine[iBody + 1]); } - if (memcmp(files->Outfile[iBody].caCol[iCol], output[OUT_GAMMAORB].cName, - strlen(output[OUT_GAMMAORB].cName)) == 0) { + // if (memcmp(files->Outfile[iBody].caCol[iCol], output[OUT_GAMMAORB].cName, + // strlen(output[OUT_GAMMAORB].cName)) == 0) { + if (strcmp(files->Outfile[iBody].caCol[iCol], output[OUT_GAMMAORB].cName) == 0) { if (control->Io.iVerbose >= VERBINPUT) { fprintf(stderr, "ERROR: Time lag model selected; output %s is not allowed.\n", @@ -1383,8 +1388,9 @@ void VerifyCTL(BODY *body, CONTROL *control, FILES *files, OPTIONS *options, options[OPT_OUTPUTORDER].iLine[iBody + 1]); } - if (memcmp(files->Outfile[iBody].caCol[iCol], output[OUT_GAMMAROT].cName, - strlen(output[OUT_GAMMAROT].cName)) == 0) { + // if (memcmp(files->Outfile[iBody].caCol[iCol], output[OUT_GAMMAROT].cName, + // strlen(output[OUT_GAMMAROT].cName)) == 0) { + if (strcmp(files->Outfile[iBody].caCol[iCol], output[OUT_GAMMAROT].cName) == 0) { if (control->Io.iVerbose >= VERBINPUT) { fprintf(stderr, "ERROR: Time lag model selected; output %s is not allowed.\n", @@ -1398,8 +1404,9 @@ void VerifyCTL(BODY *body, CONTROL *control, FILES *files, OPTIONS *options, options[OPT_OUTPUTORDER].iLine[iBody + 1]); } - if (memcmp(files->Outfile[iBody].caCol[iCol], output[OUT_TIDALQ].cName, - strlen(output[OUT_TIDALQ].cName)) == 0) { + // if (memcmp(files->Outfile[iBody].caCol[iCol], output[OUT_TIDALQ].cName, + // strlen(output[OUT_TIDALQ].cName)) == 0) { + if (strcmp(files->Outfile[iBody].caCol[iCol], output[OUT_TIDALQ].cName) == 0) { if (control->Io.iVerbose >= VERBINPUT) { fprintf(stderr, "ERROR: Time lag model selected; output %s is not allowed.\n", @@ -1603,7 +1610,7 @@ void VerifyPerturbersEqtide(BODY *body, FILES *files, OPTIONS *options, for (iBodyPert = 0; iBodyPert < iNumBodies; iBodyPert++) { if (iBodyPert != iBody) { if (strncmp(body[iBody].saTidePerts[iPert], body[iBodyPert].cName, - sizeof(body[iBody].saTidePerts[iPert])) == 0) { + strlen(body[iBody].saTidePerts[iPert])) == 0) { /* This parameter contains the body # of the "iPert-th" tidal perturber */ body[iBody].iaTidePerts[iPert] = iBodyPert; @@ -1752,7 +1759,6 @@ int fiGetModuleIntEqtide(MODULE *module, int iBody) { void VerifyTideModel(CONTROL *control, FILES *files, OPTIONS *options) { int iFile, iFound = 0; - char cTmp[8]; for (iFile = 0; iFile < files->iNumInputs; iFile++) { if (options[OPT_TIDEMODEL].iLine[iFile] >= 0) { @@ -1775,7 +1781,8 @@ void VerifyTideModel(CONTROL *control, FILES *files, OPTIONS *options) { } if (iFound == 0) { - strcpy(cTmp, options[OPT_TIDEMODEL].cDefault); + char *cTmp=NULL; + fvFormattedString(&cTmp, options[OPT_TIDEMODEL].cDefault); if (!memcmp(sLower(cTmp), "p2", 2)) { control->Evolve.iEqtideModel = CPL; } else if (!memcmp(sLower(cTmp), "t8", 2)) { @@ -1789,6 +1796,7 @@ void VerifyTideModel(CONTROL *control, FILES *files, OPTIONS *options) { /* Chicanery. Since I only want this set once, I will make it seem like the user set it. */ options[OPT_TIDEMODEL].iLine[0] = 1; + free(cTmp); } } @@ -2272,7 +2280,7 @@ void VerifyHaltEqtide(BODY *body, CONTROL *control, OPTIONS *options, int iBody, void WriteBodyDsemiDtEqtide(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, - int iBody, double *dTmp, char cUnit[]) { + int iBody, double *dTmp, char **cUnit) { /* Broken int iPert; @@ -2293,7 +2301,7 @@ void WriteBodyDsemiDtEqtide(BODY *body, CONTROL *control, OUTPUT *output, if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit,output->cNeg); + fvFormattedString(cUnit,output->cNeg); } else { *dTmp *= fdUnitsTime(units->iTime)/fdUnitsLength(units->iLength); fsUnitsVel(units,cUnit); @@ -2305,7 +2313,7 @@ void WriteBodyDsemiDtEqtide(BODY *body, CONTROL *control, OUTPUT *output, void WriteBodyDeccDtEqtide(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, - int iBody, double *dTmp, char cUnit[]) { + int iBody, double *dTmp, char **cUnit) { /* Broken needs to be changed after switch to Hecc + Kecc int iPert; @@ -2325,7 +2333,7 @@ void WriteBodyDeccDtEqtide(BODY *body, CONTROL *control, OUTPUT *output, if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit,output->cNeg); + fvFormattedString(cUnit,output->cNeg); } else { *dTmp *= fdUnitsTime(units->iTime); fsUnitsRate(units->iTime,cUnit); @@ -2336,11 +2344,11 @@ void WriteBodyDeccDtEqtide(BODY *body, CONTROL *control, OUTPUT *output, void WriteLockTime(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, double *dTmp, - char cUnit[]) { + char **cUnit) { *dTmp = body[iBody].dLockTime; if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { *dTmp /= fdUnitsTime(units->iTime); fsUnitsTime(units->iTime, cUnit); @@ -2349,12 +2357,12 @@ void WriteLockTime(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, void WriteTidalRadius(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, - double *dTmp, char cUnit[]) { + double *dTmp, char **cUnit) { *dTmp = body[iBody].dTidalRadius; if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { *dTmp /= fdUnitsLength(units->iLength); fsUnitsLength(units->iLength, cUnit); @@ -2363,7 +2371,7 @@ void WriteTidalRadius(BODY *body, CONTROL *control, OUTPUT *output, void WriteDOblDtEqtide(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, - double *dTmp, char cUnit[]) { + double *dTmp, char **cUnit) { double dFoo; int iPert; @@ -2377,7 +2385,7 @@ void WriteDOblDtEqtide(BODY *body, CONTROL *control, OUTPUT *output, if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { *dTmp *= fdUnitsTime(units->iTime) / fdUnitsAngle(units->iAngle); fsUnitsAngRate(units, cUnit); @@ -2386,7 +2394,7 @@ void WriteDOblDtEqtide(BODY *body, CONTROL *control, OUTPUT *output, void WriteTidalQOcean(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, - double *dTmp, char cUnit[]) { + double *dTmp, char **cUnit) { /* Return -1 if dImK2Ocean is 0. There may be a better way to do this. */ if (body[iBody].dImK2Ocean > 0) { @@ -2395,12 +2403,12 @@ void WriteTidalQOcean(BODY *body, CONTROL *control, OUTPUT *output, *dTmp = -1; } - strcpy(cUnit, ""); + fvFormattedString(cUnit, ""); } void WriteTidalQEnv(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, - double *dTmp, char cUnit[]) { + double *dTmp, char **cUnit) { /* Return -1 if dImK2Env is 0. There may be a better way to do this. */ if (body[iBody].dImK2Env > 0) { @@ -2409,12 +2417,12 @@ void WriteTidalQEnv(BODY *body, CONTROL *control, OUTPUT *output, *dTmp = -1; } - strcpy(cUnit, ""); + fvFormattedString(cUnit, ""); } void WriteDSemiDtEqtide(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, - double *dTmp, char cUnit[]) { + double *dTmp, char **cUnit) { double dDeriv; /* Ensure that we don't overwrite pdDsemiDt */ @@ -2423,7 +2431,7 @@ void WriteDSemiDtEqtide(BODY *body, CONTROL *control, OUTPUT *output, if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { *dTmp *= fdUnitsTime(units->iTime) / fdUnitsLength(units->iLength); fsUnitsVel(units, cUnit); @@ -2432,13 +2440,13 @@ void WriteDSemiDtEqtide(BODY *body, CONTROL *control, OUTPUT *output, void WriteDEccDtEqtide(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, - double *dTmp, char cUnit[]) { + double *dTmp, char **cUnit) { *dTmp = body[iBody].dDeccDtEqtide; if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { *dTmp *= fdUnitsTime(units->iTime); fsUnitsRate(units->iTime, cUnit); @@ -2447,7 +2455,7 @@ void WriteDEccDtEqtide(BODY *body, CONTROL *control, OUTPUT *output, void WriteDMeanMotionDtEqtide(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, - int iBody, double *dTmp, char cUnit[]) { + int iBody, double *dTmp, char **cUnit) { *dTmp = -1.5 * pow(BIGG * (body[0].dMass + body[iBody].dMass) / @@ -2457,17 +2465,16 @@ void WriteDMeanMotionDtEqtide(BODY *body, CONTROL *control, OUTPUT *output, if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { *dTmp *= fdUnitsTime(units->iTime) / fdUnitsLength(units->iLength); - fsUnitsRate(units->iTime, cUnit); - strcat(cUnit, "^2"); + fsUnitsRateSquared(units->iTime, cUnit); } } void WriteDOrbPerDtEqtide(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, - int iBody, double *dTmp, char cUnit[]) { + int iBody, double *dTmp, char **cUnit) { *dTmp = 1.5 * pow(4 * PI * PI * body[iBody].dSemi / @@ -2477,16 +2484,16 @@ void WriteDOrbPerDtEqtide(BODY *body, CONTROL *control, OUTPUT *output, if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { *dTmp *= fdUnitsTime(units->iTime) / fdUnitsLength(units->iLength); - sprintf(cUnit, "%s", ""); + fvFormattedString(cUnit, "%s", ""); } } void WriteDRotPerDtEqtide(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, - int iBody, double *dTmp, char cUnit[]) { + int iBody, double *dTmp, char **cUnit) { double dDeriv; int iPert; @@ -2500,15 +2507,15 @@ void WriteDRotPerDtEqtide(BODY *body, CONTROL *control, OUTPUT *output, *dTmp = dDeriv * (-2 * PI / (body[iBody].dRotRate * body[iBody].dRotRate)); if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { - strcpy(cUnit, ""); + fvFormattedString(cUnit, ""); } } void WriteDRotRateDtEqtide(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, - int iBody, double *dTmp, char cUnit[]) { + int iBody, double *dTmp, char **cUnit) { double dDeriv; int iPert; @@ -2522,17 +2529,16 @@ void WriteDRotRateDtEqtide(BODY *body, CONTROL *control, OUTPUT *output, if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { *dTmp *= fdUnitsTime(units->iTime) * fdUnitsTime(units->iTime); - fsUnitsRate(units->iTime, cUnit); - strcat(cUnit, "^2"); + fsUnitsRateSquared(units->iTime, cUnit); } } void WriteDHeccDtEqtide(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, - double *dTmp, char cUnit[]) { + double *dTmp, char **cUnit) { double dDeriv; /* Ensure that we don't overwrite pdDsemiDt */ @@ -2541,7 +2547,7 @@ void WriteDHeccDtEqtide(BODY *body, CONTROL *control, OUTPUT *output, if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { *dTmp *= fdUnitsTime(units->iTime); fsUnitsRate(units->iTime, cUnit); @@ -2550,7 +2556,7 @@ void WriteDHeccDtEqtide(BODY *body, CONTROL *control, OUTPUT *output, void WriteDKeccDtEqtide(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, - double *dTmp, char cUnit[]) { + double *dTmp, char **cUnit) { double dDeriv; /* Ensure that we don't overwrite pdDsemiDt */ @@ -2559,7 +2565,7 @@ void WriteDKeccDtEqtide(BODY *body, CONTROL *control, OUTPUT *output, if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { *dTmp *= fdUnitsTime(units->iTime); fsUnitsRate(units->iTime, cUnit); @@ -2568,7 +2574,7 @@ void WriteDKeccDtEqtide(BODY *body, CONTROL *control, OUTPUT *output, void WriteDXoblDtEqtide(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, - double *dTmp, char cUnit[]) { + double *dTmp, char **cUnit) { double dDeriv = 0; int iPert; @@ -2581,7 +2587,7 @@ void WriteDXoblDtEqtide(BODY *body, CONTROL *control, OUTPUT *output, if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { *dTmp *= fdUnitsTime(units->iTime); fsUnitsRate(units->iTime, cUnit); @@ -2590,7 +2596,7 @@ void WriteDXoblDtEqtide(BODY *body, CONTROL *control, OUTPUT *output, void WriteDYoblDtEqtide(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, - double *dTmp, char cUnit[]) { + double *dTmp, char **cUnit) { double dDeriv = 0; int iPert; @@ -2603,7 +2609,7 @@ void WriteDYoblDtEqtide(BODY *body, CONTROL *control, OUTPUT *output, if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { *dTmp *= fdUnitsTime(units->iTime); fsUnitsRate(units->iTime, cUnit); @@ -2612,7 +2618,7 @@ void WriteDYoblDtEqtide(BODY *body, CONTROL *control, OUTPUT *output, void WriteDZoblDtEqtide(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, - double *dTmp, char cUnit[]) { + double *dTmp, char **cUnit) { double dDeriv = 0; int iPert; @@ -2625,7 +2631,7 @@ void WriteDZoblDtEqtide(BODY *body, CONTROL *control, OUTPUT *output, if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { *dTmp *= fdUnitsTime(units->iTime); fsUnitsRate(units->iTime, cUnit); @@ -2638,7 +2644,7 @@ void WriteDZoblDtEqtide(BODY *body, CONTROL *control, OUTPUT *output, void WriteEccTimescaleEqtide(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, - int iBody, double *dTmp, char cUnit[]) { + int iBody, double *dTmp, char **cUnit) { double dDeriv, dEcc; // Complicated because primary variable is h or k @@ -2655,7 +2661,7 @@ void WriteEccTimescaleEqtide(BODY *body, CONTROL *control, OUTPUT *output, if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { *dTmp *= fdUnitsTime(units->iTime); fsUnitsTime(units->iTime, cUnit); @@ -2664,7 +2670,7 @@ void WriteEccTimescaleEqtide(BODY *body, CONTROL *control, OUTPUT *output, void WriteEqRotPer(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, double *dTmp, - char cUnit[]) { + char **cUnit) { int iOrbiter = fiAssignTidalOrbiter(body, iBody); *dTmp = fdFreqToPer(fdEqRotRate( @@ -2673,7 +2679,7 @@ void WriteEqRotPer(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { *dTmp /= fdUnitsTime(units->iTime); fsUnitsTime(units->iTime, cUnit); @@ -2682,7 +2688,7 @@ void WriteEqRotPer(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, void WriteEqRotPerCont(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, - double *dTmp, char cUnit[]) { + double *dTmp, char **cUnit) { int iOrbiter = fiAssignTidalOrbiter(body, iBody); @@ -2698,7 +2704,7 @@ void WriteEqRotPerCont(BODY *body, CONTROL *control, OUTPUT *output, if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { *dTmp /= fdUnitsTime(units->iTime); fsUnitsTime(units->iTime, cUnit); @@ -2707,7 +2713,7 @@ void WriteEqRotPerCont(BODY *body, CONTROL *control, OUTPUT *output, void WriteEqRotPerDiscrete(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, - int iBody, double *dTmp, char cUnit[]) { + int iBody, double *dTmp, char **cUnit) { int iOrbiter = fiAssignTidalOrbiter(body, iBody); if (control->Evolve.iEqtideModel == CPL) { @@ -2719,7 +2725,7 @@ void WriteEqRotPerDiscrete(BODY *body, CONTROL *control, OUTPUT *output, if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { *dTmp /= fdUnitsTime(units->iTime); fsUnitsTime(units->iTime, cUnit); @@ -2728,7 +2734,7 @@ void WriteEqRotPerDiscrete(BODY *body, CONTROL *control, OUTPUT *output, void WriteEqRotRate(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, - double *dTmp, char cUnit[]) { + double *dTmp, char **cUnit) { int iOrbiter = fiAssignTidalOrbiter(body, iBody); *dTmp = fdEqRotRate(body, iBody, body[iOrbiter].dMeanMotion, @@ -2737,7 +2743,7 @@ void WriteEqRotRate(BODY *body, CONTROL *control, OUTPUT *output, if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { *dTmp *= fdUnitsTime(units->iTime); fsUnitsRate(units->iTime, cUnit); @@ -2746,7 +2752,7 @@ void WriteEqRotRate(BODY *body, CONTROL *control, OUTPUT *output, void WriteEqRotRateCont(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, - double *dTmp, char cUnit[]) { + double *dTmp, char **cUnit) { int iOrbiter = fiAssignTidalOrbiter(body, iBody); @@ -2761,7 +2767,7 @@ void WriteEqRotRateCont(BODY *body, CONTROL *control, OUTPUT *output, if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { *dTmp *= fdUnitsTime(units->iTime); fsUnitsRate(units->iTime, cUnit); @@ -2770,7 +2776,7 @@ void WriteEqRotRateCont(BODY *body, CONTROL *control, OUTPUT *output, void WriteEqRotRateDiscrete(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, - int iBody, double *dTmp, char cUnit[]) { + int iBody, double *dTmp, char **cUnit) { int iOrbiter = fiAssignTidalOrbiter(body, iBody); if (control->Evolve.iEqtideModel == CPL) { @@ -2782,7 +2788,7 @@ void WriteEqRotRateDiscrete(BODY *body, CONTROL *control, OUTPUT *output, if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { *dTmp *= fdUnitsTime(units->iTime); fsUnitsRate(units->iTime, cUnit); @@ -2792,7 +2798,7 @@ void WriteEqRotRateDiscrete(BODY *body, CONTROL *control, OUTPUT *output, // Equilibrium Tidal Power void WriteEqTidePower(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, - double *dTmp, char cUnit[]) { + double *dTmp, char **cUnit) { int iOrbiter = fiAssignTidalOrbiter(body, iBody); if (control->Evolve.iEqtideModel == CPL) { @@ -2811,7 +2817,7 @@ void WriteEqTidePower(BODY *body, CONTROL *control, OUTPUT *output, if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { *dTmp *= fdUnitsTime(units->iTime); fsUnitsRate(units->iTime, cUnit); @@ -2824,7 +2830,7 @@ void WriteEqTidePower(BODY *body, CONTROL *control, OUTPUT *output, void WriteGammaOrb(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, double *dTmp, - char cUnit[]) { + char **cUnit) { /* Broken */ //*dTmp = @@ -2832,12 +2838,12 @@ void WriteGammaOrb(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, *dTmp = -1; /* Negative option? */ - strcat(cUnit, "sec"); + fsUnitsTime(units->iTime,cUnit); } void WriteGammaRot(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, double *dTmp, - char cUnit[]) { + char **cUnit) { /* Broken @@ -2848,30 +2854,30 @@ void WriteGammaRot(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, *dTmp = -1; /* Negative option? */ - strcat(cUnit, "sec"); + fsUnitsTime(units->iTime,cUnit); } void WriteK2Ocean(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, double *dTmp, - char cUnit[]) { + char **cUnit) { *dTmp = body[iBody].dK2Ocean; - strcpy(cUnit, ""); + fvFormattedString(cUnit, ""); } void WriteK2Env(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, double *dTmp, - char cUnit[]) { + char **cUnit) { *dTmp = body[iBody].dK2Env; - strcpy(cUnit, ""); + fvFormattedString(cUnit, ""); } void WriteOblTimescaleEqtide(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, - int iBody, double *dTmp, char cUnit[]) { + int iBody, double *dTmp, char **cUnit) { /* Broken @@ -2882,26 +2888,26 @@ void WriteOblTimescaleEqtide(BODY *body, CONTROL *control, OUTPUT *output, if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit,output->cNeg); + fvFormattedString(cUnit,output->cNeg); } else { *dTmp *= fdUnitsTime(units->iTime); fsUnitsTime(units->iTime,cUnit); } */ *dTmp = -1; - strcpy(cUnit, ""); + fvFormattedString(cUnit, ""); } void WriteRotTimescaleEqtide(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, - int iBody, double *dTmp, char cUnit[]) { + int iBody, double *dTmp, char **cUnit) { *dTmp = fdTimescaleMulti(body[iBody].dRotRate, *(update[iBody].padDrotDtEqtide), body[iBody].iTidePerts); if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { *dTmp *= fdUnitsTime(units->iTime); fsUnitsTime(units->iTime, cUnit); @@ -2914,12 +2920,12 @@ void WriteRotTimescaleEqtide(BODY *body, CONTROL *control, OUTPUT *output, void WriteSemiTimescaleEqtide(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, - int iBody, double *dTmp, char cUnit[]) { + int iBody, double *dTmp, char **cUnit) { *dTmp = fdTimescale(body[iBody].dSemi, *(update[iBody].pdDsemiDtEqtide)); if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { *dTmp *= fdUnitsTime(units->iTime); fsUnitsTime(units->iTime, cUnit); @@ -2932,7 +2938,7 @@ void WriteSemiTimescaleEqtide(BODY *body, CONTROL *control, OUTPUT *output, void WritePowerEqtide(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, - double *dTmp, char cUnit[]) { + double *dTmp, char **cUnit) { /* Get total tidal power */ *dTmp = fdTidePower(body, iBody, control->Evolve.iEqtideModel); //*dTmp = body[iBody].dTidalPowMan; @@ -2949,7 +2955,7 @@ fprintf(stderr,"TidalZ: %lf\n",body[iBody].dTidalZ[jBody]); if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { *dTmp /= fdUnitsPower(units->iTime, units->iMass, units->iLength); fsUnitsPower(units, cUnit); @@ -2958,14 +2964,14 @@ fprintf(stderr,"TidalZ: %lf\n",body[iBody].dTidalZ[jBody]); void WriteEnergyFluxEqtide(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, - int iBody, double *dTmp, char cUnit[]) { + int iBody, double *dTmp, char **cUnit) { /* Get total tidal surface energy flux */ *dTmp = fdSurfEnFluxEqtide(body, system, update, iBody, control->Evolve.iEqtideModel); if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { *dTmp /= fdUnitsEnergyFlux(units->iTime, units->iMass, units->iLength); fsUnitsEnergyFlux(units, cUnit); @@ -2974,12 +2980,12 @@ void WriteEnergyFluxEqtide(BODY *body, CONTROL *control, OUTPUT *output, void WriteTidalTau(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, double *dTmp, - char cUnit[]) { + char **cUnit) { *dTmp = body[iBody].dTidalTau; if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { *dTmp /= fdUnitsTime(units->iTime); fsUnitsTime(units->iTime, cUnit); @@ -2988,178 +2994,178 @@ void WriteTidalTau(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, void WriteTideLock(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, double *dTmp, - char cUnit[]) { + char **cUnit) { *dTmp = control->Evolve.bForceEqSpin[iBody]; - strcat(cUnit, ""); + fvFormattedString(cUnit, ""); } void InitializeOutputEqtide(OUTPUT *output, fnWriteOutput fnWrite[]) { - sprintf(output[OUT_BODYDSEMIDTEQTIDE].cName, "BodyDsemiDtEqtide"); - sprintf(output[OUT_BODYDSEMIDTEQTIDE].cDescr, + fvFormattedString(&output[OUT_BODYDSEMIDTEQTIDE].cName, "BodyDsemiDtEqtide"); + fvFormattedString(&output[OUT_BODYDSEMIDTEQTIDE].cDescr, "Body's Contribution to dSemi/dt in EqTide"); - sprintf(output[OUT_BODYDSEMIDTEQTIDE].cNeg, "AU/Gyr"); + fvFormattedString(&output[OUT_BODYDSEMIDTEQTIDE].cNeg, "AU/Gyr"); output[OUT_BODYDSEMIDTEQTIDE].bNeg = 1; output[OUT_BODYDSEMIDTEQTIDE].dNeg = YEARSEC * 1e9 / AUM; output[OUT_BODYDSEMIDTEQTIDE].iNum = 1; output[OUT_BODYDSEMIDTEQTIDE].iModuleBit = EQTIDE; fnWrite[OUT_BODYDSEMIDTEQTIDE] = &WriteBodyDsemiDtEqtide; - sprintf( - output[OUT_BODYDSEMIDTEQTIDE].cDescr, + fvFormattedString( + &output[OUT_BODYDSEMIDTEQTIDE].cDescr, "In EqTide, the total change in semi-major axis is due to dissipation " "in " "both bodies. This output parameter returns the change due to current " "body."); - sprintf(output[OUT_BODYDECCDTEQTIDE].cName, "BodyDeccDt"); - sprintf(output[OUT_BODYDECCDTEQTIDE].cDescr, + fvFormattedString(&output[OUT_BODYDECCDTEQTIDE].cName, "BodyDeccDt"); + fvFormattedString(&output[OUT_BODYDECCDTEQTIDE].cDescr, "Body's Contribution to dEcc/dt in EqTide"); - sprintf(output[OUT_BODYDECCDTEQTIDE].cNeg, "/Gyr"); + fvFormattedString(&output[OUT_BODYDECCDTEQTIDE].cNeg, "/Gyr"); output[OUT_BODYDECCDTEQTIDE].bNeg = 1; output[OUT_BODYDECCDTEQTIDE].dNeg = YEARSEC * 1e9; output[OUT_BODYDECCDTEQTIDE].iNum = 1; output[OUT_BODYDECCDTEQTIDE].iModuleBit = EQTIDE; fnWrite[OUT_BODYDECCDTEQTIDE] = &WriteBodyDeccDtEqtide; - sprintf( - output[OUT_BODYDECCDTEQTIDE].cDescr, + fvFormattedString( + &output[OUT_BODYDECCDTEQTIDE].cDescr, "In EqTide, the total change in eccentricity is due to towrues on both " "bodies. This output parameter returns the change due to current " "body."); - sprintf(output[OUT_DOBLDTEQTIDE].cName, "DOblDtEqtide"); - sprintf(output[OUT_DOBLDTEQTIDE].cDescr, + fvFormattedString(&output[OUT_DOBLDTEQTIDE].cName, "DOblDtEqtide"); + fvFormattedString(&output[OUT_DOBLDTEQTIDE].cDescr, "Time Rate of Change of Obliquity in EqTide"); - sprintf(output[OUT_DOBLDTEQTIDE].cNeg, "deg/Gyr"); + fvFormattedString(&output[OUT_DOBLDTEQTIDE].cNeg, "deg/Gyr"); output[OUT_DOBLDTEQTIDE].bNeg = 1; output[OUT_DOBLDTEQTIDE].dNeg = YEARSEC * 1e9 / DEGRAD; output[OUT_DOBLDTEQTIDE].iNum = 1; output[OUT_DOBLDTEQTIDE].iModuleBit = EQTIDE; fnWrite[OUT_DOBLDTEQTIDE] = &WriteDOblDtEqtide; - sprintf(output[OUT_TIDALQOCEAN].cName, "OceanTidalQ"); - sprintf(output[OUT_TIDALQOCEAN].cDescr, "Ocean Tidal Q"); + fvFormattedString(&output[OUT_TIDALQOCEAN].cName, "OceanTidalQ"); + fvFormattedString(&output[OUT_TIDALQOCEAN].cDescr, "Ocean Tidal Q"); output[OUT_TIDALQOCEAN].bNeg = 0; output[OUT_TIDALQOCEAN].iNum = 1; output[OUT_TIDALQOCEAN].iModuleBit = EQTIDE; fnWrite[OUT_TIDALQOCEAN] = WriteTidalQOcean; - sprintf(output[OUT_TIDALRADIUS].cName, "TidalRadius"); - sprintf(output[OUT_TIDALRADIUS].cDescr, "Tidal Radius"); - sprintf(output[OUT_TIDALRADIUS].cNeg, "Rearth"); + fvFormattedString(&output[OUT_TIDALRADIUS].cName, "TidalRadius"); + fvFormattedString(&output[OUT_TIDALRADIUS].cDescr, "Tidal Radius"); + fvFormattedString(&output[OUT_TIDALRADIUS].cNeg, "Rearth"); output[OUT_TIDALRADIUS].bNeg = 1; output[OUT_TIDALRADIUS].dNeg = 1. / REARTH; output[OUT_TIDALRADIUS].iNum = 1; output[OUT_TIDALRADIUS].iModuleBit = EQTIDE; fnWrite[OUT_TIDALRADIUS] = &WriteTidalRadius; - sprintf( - output[OUT_TIDALRADIUS].cDescr, + fvFormattedString( + &output[OUT_TIDALRADIUS].cDescr, "In EqTide, the value of the radius that enters the tidal evolution " "equations. This parameter is distinct from others, such as the radius " "of XUV absorption or a pressure level in an atmosphere."); - sprintf(output[OUT_TIDALQENV].cName, "EnvTidalQ"); - sprintf(output[OUT_TIDALQENV].cDescr, "Envelope Tidal Q"); + fvFormattedString(&output[OUT_TIDALQENV].cName, "EnvTidalQ"); + fvFormattedString(&output[OUT_TIDALQENV].cDescr, "Envelope Tidal Q"); output[OUT_TIDALQENV].bNeg = 0; output[OUT_TIDALQENV].iNum = 1; output[OUT_TIDALQENV].iModuleBit = EQTIDE; fnWrite[OUT_TIDALQENV] = WriteTidalQEnv; - sprintf(output[OUT_DSEMIDTEQTIDE].cName, "DsemiDtEqtide"); - sprintf(output[OUT_DSEMIDTEQTIDE].cDescr, "Total da/dt from EqTide"); - sprintf(output[OUT_DSEMIDTEQTIDE].cNeg, "AU/Gyr"); + fvFormattedString(&output[OUT_DSEMIDTEQTIDE].cName, "DsemiDtEqtide"); + fvFormattedString(&output[OUT_DSEMIDTEQTIDE].cDescr, "Total da/dt from EqTide"); + fvFormattedString(&output[OUT_DSEMIDTEQTIDE].cNeg, "AU/Gyr"); output[OUT_DSEMIDTEQTIDE].bNeg = 1; output[OUT_DSEMIDTEQTIDE].dNeg = (YEARSEC * 1e9) / AUM; output[OUT_DSEMIDTEQTIDE].iNum = 1; output[OUT_DSEMIDTEQTIDE].iModuleBit = EQTIDE; fnWrite[OUT_DSEMIDTEQTIDE] = &WriteDSemiDtEqtide; - sprintf(output[OUT_DECCDTEQTIDE].cName, "DeccDtEqtide"); - sprintf(output[OUT_DECCDTEQTIDE].cDescr, "Total de/dt from EqTide"); - sprintf(output[OUT_DECCDTEQTIDE].cNeg, "/Gyr"); + fvFormattedString(&output[OUT_DECCDTEQTIDE].cName, "DeccDtEqtide"); + fvFormattedString(&output[OUT_DECCDTEQTIDE].cDescr, "Total de/dt from EqTide"); + fvFormattedString(&output[OUT_DECCDTEQTIDE].cNeg, "/Gyr"); output[OUT_DECCDTEQTIDE].bNeg = 1; output[OUT_DECCDTEQTIDE].dNeg = YEARSEC * 1e9; output[OUT_DECCDTEQTIDE].iNum = 1; output[OUT_DECCDTEQTIDE].iModuleBit = EQTIDE; fnWrite[OUT_DECCDTEQTIDE] = &WriteDEccDtEqtide; - sprintf(output[OUT_DMMDTEQTIDE].cName, "DMeanMotionDtEqtide"); - sprintf(output[OUT_DMMDTEQTIDE].cDescr, "Total dMeanMotion/dt from EqTide"); + fvFormattedString(&output[OUT_DMMDTEQTIDE].cName, "DMeanMotionDtEqtide"); + fvFormattedString(&output[OUT_DMMDTEQTIDE].cDescr, "Total dMeanMotion/dt from EqTide"); output[OUT_DMMDTEQTIDE].iNum = 1; output[OUT_DMMDTEQTIDE].iModuleBit = EQTIDE; fnWrite[OUT_DMMDTEQTIDE] = &WriteDMeanMotionDtEqtide; - sprintf(output[OUT_DORBPERDTEQTIDE].cName, "DOrbPerDtEqtide"); - sprintf(output[OUT_DORBPERDTEQTIDE].cDescr, "Total dOrbPer/dt from EqTide"); - sprintf(output[OUT_DORBPERDTEQTIDE].cNeg, "days/Gyr"); + fvFormattedString(&output[OUT_DORBPERDTEQTIDE].cName, "DOrbPerDtEqtide"); + fvFormattedString(&output[OUT_DORBPERDTEQTIDE].cDescr, "Total dOrbPer/dt from EqTide"); + fvFormattedString(&output[OUT_DORBPERDTEQTIDE].cNeg, "days/Gyr"); output[OUT_DORBPERDTEQTIDE].bNeg = 1; output[OUT_DORBPERDTEQTIDE].dNeg = YEARSEC * 1e9 / DAYSEC; output[OUT_DORBPERDTEQTIDE].iNum = 1; output[OUT_DORBPERDTEQTIDE].iModuleBit = EQTIDE; fnWrite[OUT_DORBPERDTEQTIDE] = &WriteDOrbPerDtEqtide; - sprintf(output[OUT_DROTPERDTEQTIDE].cName, "DRotPerDtEqtide"); - sprintf(output[OUT_DROTPERDTEQTIDE].cDescr, + fvFormattedString(&output[OUT_DROTPERDTEQTIDE].cName, "DRotPerDtEqtide"); + fvFormattedString(&output[OUT_DROTPERDTEQTIDE].cDescr, "Time Rate of Change of Rotation Period in EqTide"); - sprintf(output[OUT_DROTPERDTEQTIDE].cNeg, "days/Myr"); + fvFormattedString(&output[OUT_DROTPERDTEQTIDE].cNeg, "days/Myr"); output[OUT_DROTPERDTEQTIDE].bNeg = 1; output[OUT_DROTPERDTEQTIDE].dNeg = DAYSEC / (YEARSEC * 1e6); output[OUT_DROTPERDTEQTIDE].iNum = 1; output[OUT_DROTPERDTEQTIDE].iModuleBit = EQTIDE; fnWrite[OUT_DROTPERDTEQTIDE] = &WriteDRotPerDtEqtide; - sprintf(output[OUT_DROTRATEDTEQTIDE].cName, "DRotRateDtEqtide"); - sprintf(output[OUT_DROTRATEDTEQTIDE].cDescr, + fvFormattedString(&output[OUT_DROTRATEDTEQTIDE].cName, "DRotRateDtEqtide"); + fvFormattedString(&output[OUT_DROTRATEDTEQTIDE].cDescr, "Time Rate of Change of Rotation Rate in EqTide"); output[OUT_DROTRATEDTEQTIDE].bNeg = 0; output[OUT_DROTRATEDTEQTIDE].iNum = 1; output[OUT_DROTRATEDTEQTIDE].iModuleBit = EQTIDE; fnWrite[OUT_DROTRATEDTEQTIDE] = &WriteDRotRateDtEqtide; - sprintf(output[OUT_DHECCDTEQTIDE].cName, "DHEccDtEqtide"); - sprintf(output[OUT_DHECCDTEQTIDE].cDescr, + fvFormattedString(&output[OUT_DHECCDTEQTIDE].cName, "DHEccDtEqtide"); + fvFormattedString(&output[OUT_DHECCDTEQTIDE].cDescr, "Time Rate of Change of Poincare's h in EqTide"); - sprintf(output[OUT_DHECCDTEQTIDE].cNeg, "/Gyr"); + fvFormattedString(&output[OUT_DHECCDTEQTIDE].cNeg, "/Gyr"); output[OUT_DHECCDTEQTIDE].bNeg = 1; output[OUT_DHECCDTEQTIDE].dNeg = (1e9 * YEARSEC); output[OUT_DHECCDTEQTIDE].iNum = 1; output[OUT_DHECCDTEQTIDE].iModuleBit = EQTIDE; fnWrite[OUT_DHECCDTEQTIDE] = &WriteDHeccDtEqtide; - sprintf(output[OUT_DKECCDTEQTIDE].cName, "DKEccDtEqtide"); - sprintf(output[OUT_DKECCDTEQTIDE].cDescr, + fvFormattedString(&output[OUT_DKECCDTEQTIDE].cName, "DKEccDtEqtide"); + fvFormattedString(&output[OUT_DKECCDTEQTIDE].cDescr, "Time Rate of Change of Poincare's k in EqTide"); - sprintf(output[OUT_DKECCDTEQTIDE].cNeg, "/Gyr"); + fvFormattedString(&output[OUT_DKECCDTEQTIDE].cNeg, "/Gyr"); output[OUT_DKECCDTEQTIDE].bNeg = 1; output[OUT_DKECCDTEQTIDE].dNeg = (1e9 * YEARSEC); output[OUT_DKECCDTEQTIDE].iNum = 1; output[OUT_DKECCDTEQTIDE].iModuleBit = EQTIDE; fnWrite[OUT_DKECCDTEQTIDE] = &WriteDKeccDtEqtide; - sprintf(output[OUT_DXOBLDTEQTIDE].cName, "DXoblDtEqtide"); - sprintf(output[OUT_DXOBLDTEQTIDE].cDescr, + fvFormattedString(&output[OUT_DXOBLDTEQTIDE].cName, "DXoblDtEqtide"); + fvFormattedString(&output[OUT_DXOBLDTEQTIDE].cDescr, "Time Rate of Change of Laskar's X in EqTide"); - sprintf(output[OUT_DXOBLDTEQTIDE].cNeg, "/Gyr"); + fvFormattedString(&output[OUT_DXOBLDTEQTIDE].cNeg, "/Gyr"); output[OUT_DXOBLDTEQTIDE].bNeg = 1; output[OUT_DXOBLDTEQTIDE].dNeg = (1e9 * YEARSEC); output[OUT_DXOBLDTEQTIDE].iNum = 1; output[OUT_DXOBLDTEQTIDE].iModuleBit = EQTIDE; fnWrite[OUT_DXOBLDTEQTIDE] = &WriteDXoblDtEqtide; - sprintf(output[OUT_DYOBLDTEQTIDE].cName, "DYoblDtEqtide"); - sprintf(output[OUT_DYOBLDTEQTIDE].cDescr, + fvFormattedString(&output[OUT_DYOBLDTEQTIDE].cName, "DYoblDtEqtide"); + fvFormattedString(&output[OUT_DYOBLDTEQTIDE].cDescr, "Time Rate of Change of Laskar's Y in EqTide"); - sprintf(output[OUT_DYOBLDTEQTIDE].cNeg, "/Gyr"); + fvFormattedString(&output[OUT_DYOBLDTEQTIDE].cNeg, "/Gyr"); output[OUT_DYOBLDTEQTIDE].bNeg = 1; output[OUT_DYOBLDTEQTIDE].dNeg = (1e9 * YEARSEC); output[OUT_DYOBLDTEQTIDE].iNum = 1; output[OUT_DYOBLDTEQTIDE].iModuleBit = EQTIDE; fnWrite[OUT_DYOBLDTEQTIDE] = &WriteDYoblDtEqtide; - sprintf(output[OUT_DZOBLDTEQTIDE].cName, "DZoblDtEqtide"); - sprintf(output[OUT_DZOBLDTEQTIDE].cDescr, + fvFormattedString(&output[OUT_DZOBLDTEQTIDE].cName, "DZoblDtEqtide"); + fvFormattedString(&output[OUT_DZOBLDTEQTIDE].cDescr, "Time Rate of Change of Laskar's Z in EqTide"); - sprintf(output[OUT_DZOBLDTEQTIDE].cNeg, "/Gyr"); + fvFormattedString(&output[OUT_DZOBLDTEQTIDE].cNeg, "/Gyr"); output[OUT_DZOBLDTEQTIDE].bNeg = 1; output[OUT_DZOBLDTEQTIDE].dNeg = (1e9 * YEARSEC); output[OUT_DZOBLDTEQTIDE].iNum = 1; @@ -3170,77 +3176,77 @@ void InitializeOutputEqtide(OUTPUT *output, fnWriteOutput fnWrite[]) { * E */ - sprintf(output[OUT_ECCTIMEEQTIDE].cName, "EccTimeEqtide"); - sprintf(output[OUT_ECCTIMEEQTIDE].cDescr, + fvFormattedString(&output[OUT_ECCTIMEEQTIDE].cName, "EccTimeEqtide"); + fvFormattedString(&output[OUT_ECCTIMEEQTIDE].cDescr, "Timescale for Eccentricity Evolution (e/[de/dt]) in EqTide"); - sprintf(output[OUT_ECCTIMEEQTIDE].cNeg, "years"); + fvFormattedString(&output[OUT_ECCTIMEEQTIDE].cNeg, "years"); output[OUT_ECCTIMEEQTIDE].bNeg = 1; output[OUT_ECCTIMEEQTIDE].dNeg = 1. / YEARSEC; output[OUT_ECCTIMEEQTIDE].iNum = 1; output[OUT_ECCTIMEEQTIDE].iModuleBit = EQTIDE; fnWrite[OUT_ECCTIMEEQTIDE] = &WriteEccTimescaleEqtide; - sprintf(output[OUT_EQROTPER].cName, "EqRotPer"); - sprintf(output[OUT_EQROTPER].cDescr, "Equilibrium Rotation Period"); - sprintf(output[OUT_EQROTPER].cNeg, "days"); + fvFormattedString(&output[OUT_EQROTPER].cName, "EqRotPer"); + fvFormattedString(&output[OUT_EQROTPER].cDescr, "Equilibrium Rotation Period"); + fvFormattedString(&output[OUT_EQROTPER].cNeg, "days"); output[OUT_EQROTPER].bNeg = 1; output[OUT_EQROTPER].dNeg = 1. / DAYSEC; output[OUT_EQROTPER].iNum = 1; output[OUT_EQROTPER].iModuleBit = EQTIDE; fnWrite[OUT_EQROTPER] = &WriteEqRotPer; - sprintf(output[OUT_EQROTPERCONT].cName, "EqRotPerCont"); - sprintf(output[OUT_EQROTPERCONT].cDescr, + fvFormattedString(&output[OUT_EQROTPERCONT].cName, "EqRotPerCont"); + fvFormattedString(&output[OUT_EQROTPERCONT].cDescr, "CPL2 Continuous Equilibrium Rotation Period"); - sprintf(output[OUT_EQROTPERCONT].cNeg, "days"); + fvFormattedString(&output[OUT_EQROTPERCONT].cNeg, "days"); output[OUT_EQROTPERCONT].bNeg = 1; output[OUT_EQROTPERCONT].dNeg = 1. / DAYSEC; output[OUT_EQROTPERCONT].iNum = 1; output[OUT_EQROTPERCONT].iModuleBit = EQTIDE; fnWrite[OUT_EQROTPERCONT] = &WriteEqRotPerCont; - sprintf(output[OUT_EQROTPERDISCRETE].cName, "EqRotPerDiscrete"); - sprintf(output[OUT_EQROTPERDISCRETE].cDescr, + fvFormattedString(&output[OUT_EQROTPERDISCRETE].cName, "EqRotPerDiscrete"); + fvFormattedString(&output[OUT_EQROTPERDISCRETE].cDescr, "CPL2 Discrete Equilibrium Spin Period"); - sprintf(output[OUT_EQROTPERDISCRETE].cNeg, "days"); + fvFormattedString(&output[OUT_EQROTPERDISCRETE].cNeg, "days"); output[OUT_EQROTPERDISCRETE].bNeg = 1; output[OUT_EQROTPERDISCRETE].dNeg = 1. / DAYSEC; output[OUT_EQROTPERDISCRETE].iNum = 1; output[OUT_EQROTPERDISCRETE].iModuleBit = EQTIDE; fnWrite[OUT_EQROTPERDISCRETE] = &WriteEqRotPerDiscrete; - sprintf(output[OUT_EQROTRATE].cName, "EqRotRate"); - sprintf(output[OUT_EQROTRATE].cDescr, "Equilibrium Rotation Rate"); - sprintf(output[OUT_EQROTRATE].cNeg, "/day"); + fvFormattedString(&output[OUT_EQROTRATE].cName, "EqRotRate"); + fvFormattedString(&output[OUT_EQROTRATE].cDescr, "Equilibrium Rotation Rate"); + fvFormattedString(&output[OUT_EQROTRATE].cNeg, "/day"); output[OUT_EQROTRATE].bNeg = 1; output[OUT_EQROTRATE].dNeg = DAYSEC; output[OUT_EQROTRATE].iNum = 1; output[OUT_EQROTRATE].iModuleBit = EQTIDE; fnWrite[OUT_EQROTRATE] = &WriteEqRotRate; - sprintf(output[OUT_EQROTRATECONT].cName, "EqRotRateCont"); - sprintf(output[OUT_EQROTRATECONT].cDescr, + fvFormattedString(&output[OUT_EQROTRATECONT].cName, "EqRotRateCont"); + fvFormattedString(&output[OUT_EQROTRATECONT].cDescr, "CPL2 Continuous Equilibrium Spin Rate"); - sprintf(output[OUT_EQROTRATECONT].cNeg, "/day"); + fvFormattedString(&output[OUT_EQROTRATECONT].cNeg, "/day"); output[OUT_EQROTRATE].bNeg = 1; output[OUT_EQROTRATECONT].dNeg = DAYSEC; output[OUT_EQROTRATECONT].iNum = 1; output[OUT_EQROTRATECONT].iModuleBit = EQTIDE; fnWrite[OUT_EQROTRATECONT] = &WriteEqRotRateCont; - sprintf(output[OUT_EQROTRATEDISCRETE].cName, "EqRotRateDiscrete"); - sprintf(output[OUT_EQROTRATEDISCRETE].cDescr, + fvFormattedString(&output[OUT_EQROTRATEDISCRETE].cName, "EqRotRateDiscrete"); + fvFormattedString(&output[OUT_EQROTRATEDISCRETE].cDescr, "CPL2 Discrete Equilibrium Spin Rate"); - sprintf(output[OUT_EQROTRATEDISCRETE].cNeg, "/day"); + fvFormattedString(&output[OUT_EQROTRATEDISCRETE].cNeg, "/day"); output[OUT_EQROTRATEDISCRETE].bNeg = 1; output[OUT_EQROTRATEDISCRETE].dNeg = DAYSEC; output[OUT_EQROTRATEDISCRETE].iNum = 1; output[OUT_EQROTRATEDISCRETE].iModuleBit = EQTIDE; fnWrite[OUT_EQROTRATEDISCRETE] = &WriteEqRotRateDiscrete; - sprintf(output[OUT_EQTIDEPOWER].cName, "EqTidePower"); - sprintf(output[OUT_EQTIDEPOWER].cDescr, "Equilibrium Power from Tides"); - sprintf(output[OUT_EQTIDEPOWER].cNeg, "/day"); + fvFormattedString(&output[OUT_EQTIDEPOWER].cName, "EqTidePower"); + fvFormattedString(&output[OUT_EQTIDEPOWER].cDescr, "Equilibrium Power from Tides"); + fvFormattedString(&output[OUT_EQTIDEPOWER].cNeg, "/day"); output[OUT_EQTIDEPOWER].bNeg = 1; output[OUT_EQTIDEPOWER].dNeg = DAYSEC; output[OUT_EQTIDEPOWER].iNum = 1; @@ -3252,29 +3258,29 @@ void InitializeOutputEqtide(OUTPUT *output, fnWriteOutput fnWrite[]) { * G */ - sprintf(output[OUT_GAMMAROT].cName, "GammaRot"); - sprintf(output[OUT_GAMMAROT].cDescr, "Gamma_Rotation"); + fvFormattedString(&output[OUT_GAMMAROT].cName, "GammaRot"); + fvFormattedString(&output[OUT_GAMMAROT].cDescr, "Gamma_Rotation"); output[OUT_GAMMAROT].bNeg = 0; output[OUT_GAMMAROT].iNum = 1; output[OUT_GAMMAROT].iModuleBit = EQTIDE; fnWrite[OUT_GAMMAROT] = &WriteGammaRot; - sprintf(output[OUT_GAMMAORB].cName, "GammaOrb"); - sprintf(output[OUT_GAMMAORB].cDescr, "Gamma_Orbital"); + fvFormattedString(&output[OUT_GAMMAORB].cName, "GammaOrb"); + fvFormattedString(&output[OUT_GAMMAORB].cDescr, "Gamma_Orbital"); output[OUT_GAMMAORB].bNeg = 0; output[OUT_GAMMAORB].iNum = 1; output[OUT_GAMMAORB].iModuleBit = EQTIDE; fnWrite[OUT_GAMMAORB] = &WriteGammaOrb; - sprintf(output[OUT_K2OCEAN].cName, "OceanK2"); - sprintf(output[OUT_K2OCEAN].cDescr, "Ocean's Love number k_2"); + fvFormattedString(&output[OUT_K2OCEAN].cName, "OceanK2"); + fvFormattedString(&output[OUT_K2OCEAN].cDescr, "Ocean's Love number k_2"); output[OUT_K2OCEAN].bNeg = 0; output[OUT_K2OCEAN].iNum = 1; output[OUT_K2OCEAN].iModuleBit = EQTIDE; fnWrite[OUT_K2OCEAN] = &WriteK2Ocean; - sprintf(output[OUT_K2ENV].cName, "EnvK2"); - sprintf(output[OUT_K2ENV].cDescr, "Envelope's Love number k_2"); + fvFormattedString(&output[OUT_K2ENV].cName, "EnvK2"); + fvFormattedString(&output[OUT_K2ENV].cDescr, "Envelope's Love number k_2"); output[OUT_K2ENV].bNeg = 0; output[OUT_K2ENV].iNum = 1; output[OUT_K2ENV].iModuleBit = EQTIDE; @@ -3284,10 +3290,10 @@ void InitializeOutputEqtide(OUTPUT *output, fnWriteOutput fnWrite[]) { * O */ - sprintf(output[OUT_OBLTIMEEQTIDE].cName, "OblTimeEqtide"); - sprintf(output[OUT_OBLTIMEEQTIDE].cDescr, + fvFormattedString(&output[OUT_OBLTIMEEQTIDE].cName, "OblTimeEqtide"); + fvFormattedString(&output[OUT_OBLTIMEEQTIDE].cDescr, "Timescale for Obliquity Evolution in EqTide"); - sprintf(output[OUT_OBLTIMEEQTIDE].cNeg, "years"); + fvFormattedString(&output[OUT_OBLTIMEEQTIDE].cNeg, "years"); output[OUT_OBLTIMEEQTIDE].bNeg = 1; output[OUT_OBLTIMEEQTIDE].dNeg = 1. / YEARSEC; output[OUT_OBLTIMEEQTIDE].iNum = 1; @@ -3298,29 +3304,29 @@ void InitializeOutputEqtide(OUTPUT *output, fnWriteOutput fnWrite[]) { * R */ - sprintf(output[OUT_ROTRATETIMEEQTIDE].cName, "RotTimeEqtide"); - sprintf(output[OUT_ROTRATETIMEEQTIDE].cDescr, + fvFormattedString(&output[OUT_ROTRATETIMEEQTIDE].cName, "RotTimeEqtide"); + fvFormattedString(&output[OUT_ROTRATETIMEEQTIDE].cDescr, "Timescale for Rotational Evolution in EqTide"); output[OUT_ROTRATETIMEEQTIDE].bNeg = 0; - sprintf(output[OUT_ROTRATETIMEEQTIDE].cNeg, "years"); + fvFormattedString(&output[OUT_ROTRATETIMEEQTIDE].cNeg, "years"); output[OUT_ROTRATETIMEEQTIDE].bNeg = 1; output[OUT_ROTRATETIMEEQTIDE].dNeg = 1. / YEARSEC; output[OUT_ROTRATETIMEEQTIDE].iNum = 1; output[OUT_ROTRATETIMEEQTIDE].iModuleBit = EQTIDE; fnWrite[OUT_ROTRATETIMEEQTIDE] = &WriteRotTimescaleEqtide; - sprintf(output[OUT_DROTPERDTEQTIDE].cName, "DRotPerDtEqtide"); - sprintf(output[OUT_DROTPERDTEQTIDE].cDescr, + fvFormattedString(&output[OUT_DROTPERDTEQTIDE].cName, "DRotPerDtEqtide"); + fvFormattedString(&output[OUT_DROTPERDTEQTIDE].cDescr, "Time Rate of Change of Rotation Period in EqTide"); - sprintf(output[OUT_DROTPERDTEQTIDE].cNeg, "days/Myr"); + fvFormattedString(&output[OUT_DROTPERDTEQTIDE].cNeg, "days/Myr"); output[OUT_DROTPERDTEQTIDE].bNeg = 1; output[OUT_DROTPERDTEQTIDE].dNeg = DAYSEC / (1e6 * YEARSEC); output[OUT_DROTPERDTEQTIDE].iNum = 1; output[OUT_DROTPERDTEQTIDE].iModuleBit = EQTIDE; fnWrite[OUT_DROTPERDTEQTIDE] = &WriteDRotPerDtEqtide; - sprintf(output[OUT_DROTRATEDTEQTIDE].cName, "DRotRateDtEqtide"); - sprintf(output[OUT_DROTRATEDTEQTIDE].cDescr, + fvFormattedString(&output[OUT_DROTRATEDTEQTIDE].cName, "DRotRateDtEqtide"); + fvFormattedString(&output[OUT_DROTRATEDTEQTIDE].cDescr, "Time Rate of Change of Rotational Frequency in EqTide"); output[OUT_DROTRATEDTEQTIDE].bNeg = 0; output[OUT_DROTRATEDTEQTIDE].iNum = 1; @@ -3331,11 +3337,11 @@ void InitializeOutputEqtide(OUTPUT *output, fnWriteOutput fnWrite[]) { * S */ - sprintf(output[OUT_SEMITIMEEQTIDE].cName, "SemiTimeEqtide"); - sprintf(output[OUT_SEMITIMEEQTIDE].cDescr, + fvFormattedString(&output[OUT_SEMITIMEEQTIDE].cName, "SemiTimeEqtide"); + fvFormattedString(&output[OUT_SEMITIMEEQTIDE].cDescr, "Timescale for Semi-major Axis Evolution (a/[da/dt]) in EqTide"); output[OUT_SEMITIMEEQTIDE].bNeg = 0; - sprintf(output[OUT_SEMITIMEEQTIDE].cNeg, "years"); + fvFormattedString(&output[OUT_SEMITIMEEQTIDE].cNeg, "years"); output[OUT_SEMITIMEEQTIDE].bNeg = 1; output[OUT_SEMITIMEEQTIDE].dNeg = 1. / YEARSEC; output[OUT_SEMITIMEEQTIDE].iNum = 1; @@ -3346,45 +3352,45 @@ void InitializeOutputEqtide(OUTPUT *output, fnWriteOutput fnWrite[]) { * T */ - sprintf(output[OUT_TIDALTAU].cName, "TidalTau"); - sprintf(output[OUT_TIDALTAU].cDescr, "Tidal Time Lag"); - sprintf(output[OUT_TIDALTAU].cNeg, "sec"); + fvFormattedString(&output[OUT_TIDALTAU].cName, "TidalTau"); + fvFormattedString(&output[OUT_TIDALTAU].cDescr, "Tidal Time Lag"); + fvFormattedString(&output[OUT_TIDALTAU].cNeg, "sec"); output[OUT_TIDALTAU].bNeg = 1; output[OUT_TIDALTAU].dNeg = 1; output[OUT_TIDALTAU].iNum = 1; output[OUT_TIDALTAU].iModuleBit = EQTIDE; fnWrite[OUT_TIDALTAU] = &WriteTidalTau; - sprintf(output[OUT_ENFLUXEQTIDE].cName, "SurfEnFluxEqtide"); - sprintf(output[OUT_ENFLUXEQTIDE].cDescr, + fvFormattedString(&output[OUT_ENFLUXEQTIDE].cName, "SurfEnFluxEqtide"); + fvFormattedString(&output[OUT_ENFLUXEQTIDE].cDescr, "Surface Energy Flux due to Tides in EqTide"); - sprintf(output[OUT_ENFLUXEQTIDE].cNeg, "W/m^2"); + fvFormattedString(&output[OUT_ENFLUXEQTIDE].cNeg, "W/m^2"); output[OUT_ENFLUXEQTIDE].bNeg = 1; output[OUT_ENFLUXEQTIDE].dNeg = 1; output[OUT_ENFLUXEQTIDE].iNum = 1; output[OUT_ENFLUXEQTIDE].iModuleBit = EQTIDE; fnWrite[OUT_ENFLUXEQTIDE] = &WriteEnergyFluxEqtide; - sprintf(output[OUT_POWEREQTIDE].cName, "PowerEqtide"); - sprintf(output[OUT_POWEREQTIDE].cDescr, + fvFormattedString(&output[OUT_POWEREQTIDE].cName, "PowerEqtide"); + fvFormattedString(&output[OUT_POWEREQTIDE].cDescr, "Internal Power due to Tides in EqTide"); - sprintf(output[OUT_POWEREQTIDE].cNeg, "TW"); + fvFormattedString(&output[OUT_POWEREQTIDE].cNeg, "TW"); output[OUT_POWEREQTIDE].bNeg = 1; output[OUT_POWEREQTIDE].dNeg = 1e-12; output[OUT_POWEREQTIDE].iNum = 1; output[OUT_POWEREQTIDE].iModuleBit = EQTIDE; fnWrite[OUT_POWEREQTIDE] = &WritePowerEqtide; - sprintf(output[OUT_TIDELOCK].cName, "TideLock"); - sprintf(output[OUT_TIDELOCK].cDescr, "Tidally Locked?"); + fvFormattedString(&output[OUT_TIDELOCK].cName, "TideLock"); + fvFormattedString(&output[OUT_TIDELOCK].cDescr, "Tidally Locked?"); output[OUT_TIDELOCK].bNeg = 0; output[OUT_TIDELOCK].iNum = 1; output[OUT_TIDELOCK].iModuleBit = EQTIDE; fnWrite[OUT_TIDELOCK] = &WriteTideLock; - sprintf(output[OUT_LOCKTIME].cName, "LockTime"); - sprintf(output[OUT_LOCKTIME].cDescr, "Time when body tidally locked."); - sprintf(output[OUT_LOCKTIME].cNeg, "Myr"); + fvFormattedString(&output[OUT_LOCKTIME].cName, "LockTime"); + fvFormattedString(&output[OUT_LOCKTIME].cDescr, "Time when body tidally locked."); + fvFormattedString(&output[OUT_LOCKTIME].cNeg, "Myr"); output[OUT_LOCKTIME].bNeg = 1; output[OUT_LOCKTIME].dNeg = 1. / (YEARSEC * 1e6); output[OUT_LOCKTIME].iNum = 1; diff --git a/src/eqtide.h b/src/eqtide.h index bef4fb018..8cb8db7b8 100644 --- a/src/eqtide.h +++ b/src/eqtide.h @@ -186,76 +186,76 @@ void FinalizeUpdateSemiEqtide(BODY *, UPDATE *, int *, int, int, int); void HelpOutputEqtide(OUTPUT *); void WriteBodyDsemiDtEqtide(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, - UPDATE *, int, double *, char[]); + UPDATE *, int, double *, char**); void WriteBodyDeccDtEqtide(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, - UPDATE *, int, double *, char[]); + UPDATE *, int, double *, char**); void WriteDOblDtEqtide(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, UPDATE *, - int, double *, char[]); + int, double *, char**); void WriteDSemiDtEqtide(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, - UPDATE *, int, double *, char[]); + UPDATE *, int, double *, char**); void WriteDEccDtEqtide(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, UPDATE *, - int, double *, char[]); + int, double *, char**); void WriteDMeanMotionDtEqtide(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, - UPDATE *, int, double *, char[]); + UPDATE *, int, double *, char**); void WriteDOrbPerDtEqtide(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, - UPDATE *, int, double *, char[]); + UPDATE *, int, double *, char**); void WriteDRotPerDtEqtide(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, - UPDATE *, int, double *, char[]); + UPDATE *, int, double *, char**); void WriteDRotRateDtEqtide(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, - UPDATE *, int, double *, char[]); + UPDATE *, int, double *, char**); void WriteEccTimescaleEqtide(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, - UPDATE *, int, double *, char[]); + UPDATE *, int, double *, char**); void WriteEqRotPer(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, UPDATE *, - int, double *, char[]); + int, double *, char**); void WriteEqRotPerCont(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, UPDATE *, - int, double *, char[]); + int, double *, char**); void WriteEqRotPerDiscrete(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, - UPDATE *, int, double *, char[]); + UPDATE *, int, double *, char**); void WriteEqRotRate(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, UPDATE *, - int, double *, char[]); + int, double *, char**); void WriteEqRotRateCont(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, - UPDATE *, int, double *, char[]); + UPDATE *, int, double *, char**); void WriteEqRotRateDiscrete(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, - UPDATE *, int, double *, char[]); + UPDATE *, int, double *, char**); void WriteGammaOrb(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, UPDATE *, - int, double *, char[]); + int, double *, char**); void WriteGammaRot(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, UPDATE *, - int, double *, char[]); + int, double *, char**); void WriteOblTimescaleEqtide(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, - UPDATE *, int, double *, char[]); + UPDATE *, int, double *, char**); void WriteRotTimescaleEqtide(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, - UPDATE *, int, double *, char[]); + UPDATE *, int, double *, char**); void WriteSemiTimescaleEqtide(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, - UPDATE *, int, double *, char[]); + UPDATE *, int, double *, char**); void WritePowerEqtide(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, UPDATE *, - int, double *, char[]); + int, double *, char**); void WriteSurfEnFluxEqtide(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, - UPDATE *, int, double *, char[]); + UPDATE *, int, double *, char**); void WriteEqPower(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, UPDATE *, int, - double *, char[]); + double *, char**); void WriteEqSurfEnFlux(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, UPDATE *, - int, double *, char[]); + int, double *, char**); void WriteTidalQ(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, UPDATE *, int, - double *, char[]); + double *, char**); void WriteTidalTau(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, UPDATE *, - int, double *, char[]); + int, double *, char**); void WriteTideLock(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, UPDATE *, - int, double *, char[]); + int, double *, char**); void WriteLockTime(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, UPDATE *, - int, double *, char[]); + int, double *, char**); // void // WriteImK2(BODY*,CONTROL*,OUTPUT*,SYSTEM*,UNITS*,UPDATE*,int,double*,char[]); void WriteK2Ocean(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, UPDATE *, int, - double *, char[]); + double *, char**); void WriteK2Env(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, UPDATE *, int, - double *, char[]); + double *, char**); void WriteTidalQOcean(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, UPDATE *, - int, double *, char[]); + int, double *, char**); void WriteTidalQEnv(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, UPDATE *, - int, double *, char[]); + int, double *, char**); void InitializeOutputEqtide(OUTPUT *, fnWriteOutput[]); void WriteTidalRadius(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, UPDATE *, - int, double *, char[]); + int, double *, char**); /* Logging Functions */ void LogOptionsEqtide(CONTROL *, FILE *); diff --git a/src/flare.c b/src/flare.c index 50bccbbbf..624b47e0f 100644 --- a/src/flare.c +++ b/src/flare.c @@ -420,19 +420,20 @@ void ReadLXUVFlareConst(BODY *body, void InitializeOptionsFlare(OPTIONS *options, fnReadOption fnRead[]) { int iOpt, iFile; - sprintf(options[OPT_FLAREYINT].cName, "dFlareYInt"); - sprintf(options[OPT_FLAREYINT].cDescr, + fvFormattedString(&options[OPT_FLAREYINT].cName, "dFlareYInt"); + fvFormattedString(&options[OPT_FLAREYINT].cDescr, "Y-Intercept for Flare Frequency"); // Where the curve intercepts the // y axis (y=ax+b, in this case, // the parameter is "b") - sprintf(options[OPT_FLAREYINT].cDefault, "20.9 (Proxima Centauri)"); + fvFormattedString(&options[OPT_FLAREYINT].cDefault, "20.9 (Proxima Centauri)"); options[OPT_FLAREYINT].dDefault = 20.9; options[OPT_FLAREYINT].iType = 2; options[OPT_FLAREYINT].bMultiFile = 1; options[OPT_FLAREYINT].dNeg = 1.0 / DAYSEC; - sprintf(options[OPT_FLAREYINT].cNeg, "1/day"); + fvFormattedString(&options[OPT_FLAREYINT].cNeg, "1/day"); + fvFormattedString(&options[OPT_FLAREYINT].cDimension,"1/time"); fnRead[OPT_FLAREYINT] = &ReadFlareYInt; - sprintf(options[OPT_FLAREYINT].cLongDescr, + fvFormattedString(&options[OPT_FLAREYINT].cLongDescr, " Y-Intercept for flare frequency distribution. Where the curve " "intercepts the" "y axis (y=ax+b, in this case, dFlareYInt = 'b'). This value is " @@ -441,50 +442,51 @@ void InitializeOptionsFlare(OPTIONS *options, fnReadOption fnRead[]) { // TODO: Include the error in the FFD slopes to calculate the upper and higher // limit of XUV luminosity by flares - /*sprintf(options[OPT_FLAREYINTERRORUPPER].cName, "dFlareYIntErrorUpper"); - sprintf(options[OPT_FLAREYINTERRORUPPER].cDescr, "Y-Intercept upper error"); - sprintf(options[OPT_FLAREYINTERRORUPPER].cDefault, "0.0"); + /*fvFormattedString(options[OPT_FLAREYINTERRORUPPER].cName, "dFlareYIntErrorUpper"); + fvFormattedString(options[OPT_FLAREYINTERRORUPPER].cDescr, "Y-Intercept upper error"); + fvFormattedString(options[OPT_FLAREYINTERRORUPPER].cDefault, "0.0"); options[OPT_FLAREYINTERRORUPPER].dDefault = 0.0; options[OPT_FLAREYINTERRORUPPER].iType = 2; options[OPT_FLAREYINTERRORUPPER].bMultiFile = 1; fnRead[OPT_FLAREYINTERRORUPPER] = &ReadFlareYIntErrorUpper; - sprintf(options[OPT_FLAREYINTERRORLOWER].cName, "dFlareYIntErrorLower"); - sprintf(options[OPT_FLAREYINTERRORLOWER].cDescr, "Y-Intercept lower error"); - sprintf(options[OPT_FLAREYINTERRORLOWER].cDefault, "0.0"); + fvFormattedString(options[OPT_FLAREYINTERRORLOWER].cName, "dFlareYIntErrorLower"); + fvFormattedString(options[OPT_FLAREYINTERRORLOWER].cDescr, "Y-Intercept lower error"); + fvFormattedString(options[OPT_FLAREYINTERRORLOWER].cDefault, "0.0"); options[OPT_FLAREYINTERRORLOWER].dDefault = 0.0; options[OPT_FLAREYINTERRORLOWER].iType = 2; options[OPT_FLAREYINTERRORLOWER].bMultiFile = 1; fnRead[OPT_FLAREYINTERRORLOWER] = &ReadFlareYIntErrorLower; */ - sprintf(options[OPT_FLARESLOPE].cName, "dFlareSlope"); - sprintf(options[OPT_FLARESLOPE].cDescr, "Slope for Flare Frequency"); - sprintf(options[OPT_FLARESLOPE].cDefault, "-0.68 (Proxima Centauri)"); + fvFormattedString(&options[OPT_FLARESLOPE].cName, "dFlareSlope"); + fvFormattedString(&options[OPT_FLARESLOPE].cDescr, "Slope for Flare Frequency"); + fvFormattedString(&options[OPT_FLARESLOPE].cDefault, "-0.68 (Proxima Centauri)"); options[OPT_FLARESLOPE].dDefault = -0.68; options[OPT_FLARESLOPE].iType = 2; options[OPT_FLARESLOPE].bMultiFile = 1; options[OPT_FLARESLOPE].dNeg = 1.0 / (DAYSEC * log10(1.0e7)); - sprintf(options[OPT_FLARESLOPE].cNeg, "1/day 1/log10(erg)"); + fvFormattedString(&options[OPT_FLARESLOPE].cNeg, "1/day 1/log10(erg)"); + fvFormattedString(&options[OPT_FLARESLOPE].cDimension,"1/time/energy"); fnRead[OPT_FLARESLOPE] = &ReadFlareSlope; - sprintf( - options[OPT_FLARESLOPE].cLongDescr, + fvFormattedString( + &options[OPT_FLARESLOPE].cLongDescr, " Slope for flare frequency distribution. The user needs to" " input the module of the value for this parameter. The negative signal" " can be use only for input the value in flares/day 1/log10(erg). \n"); // TODO: Include the error in the FFD slopes to calculate the upper and higher // limit of XUV luminosity by flares - /*sprintf(options[OPT_FLARESLOPEERRORUPPER].cName, "dFlareSlopeErrorUpper"); - sprintf(options[OPT_FLARESLOPEERRORUPPER].cDescr, "Slope upper error"); - sprintf(options[OPT_FLARESLOPEERRORUPPER].cDefault, "0.0"); + /*fvFormattedString(options[OPT_FLARESLOPEERRORUPPER].cName, "dFlareSlopeErrorUpper"); + fvFormattedString(options[OPT_FLARESLOPEERRORUPPER].cDescr, "Slope upper error"); + fvFormattedString(options[OPT_FLARESLOPEERRORUPPER].cDefault, "0.0"); options[OPT_FLARESLOPEERRORUPPER].dDefault = 0.0; options[OPT_FLARESLOPEERRORUPPER].iType = 2; options[OPT_FLARESLOPEERRORUPPER].bMultiFile = 1; fnRead[OPT_FLARESLOPEERRORUPPER] = &ReadFlareSlopeErrorUpper; - sprintf(options[OPT_FLARESLOPEERRORLOWER].cName, "dFlareSlopeErrorLower"); - sprintf(options[OPT_FLARESLOPEERRORLOWER].cDescr, "Slope lower error"); - sprintf(options[OPT_FLARESLOPEERRORLOWER].cDefault, "0.0"); + fvFormattedString(options[OPT_FLARESLOPEERRORLOWER].cName, "dFlareSlopeErrorLower"); + fvFormattedString(options[OPT_FLARESLOPEERRORLOWER].cDescr, "Slope lower error"); + fvFormattedString(options[OPT_FLARESLOPEERRORLOWER].cDefault, "0.0"); options[OPT_FLARESLOPEERRORLOWER].dDefault = 0.0; options[OPT_FLARESLOPEERRORLOWER].iType = 2; options[OPT_FLARESLOPEERRORLOWER].bMultiFile = 1; @@ -492,61 +494,64 @@ void InitializeOptionsFlare(OPTIONS *options, fnReadOption fnRead[]) { */ - sprintf(options[OPT_FLAREMINENERGY].cName, "dFlareMinEnergy"); - sprintf(options[OPT_FLAREMINENERGY].cDescr, + fvFormattedString(&options[OPT_FLAREMINENERGY].cName, "dFlareMinEnergy"); + fvFormattedString(&options[OPT_FLAREMINENERGY].cDescr, "Minimum Flare Energy to consider"); - sprintf(options[OPT_FLAREMINENERGY].cDefault, "10^26 J"); + fvFormattedString(&options[OPT_FLAREMINENERGY].cDefault, "10^26 J"); options[OPT_FLAREMINENERGY].dDefault = 1e26; options[OPT_FLAREMINENERGY].iType = 2; options[OPT_FLAREMINENERGY].bMultiFile = 1; options[OPT_FLAREMINENERGY].dNeg = 1e-7; - sprintf(options[OPT_FLAREMINENERGY].cNeg, "ergs"); + fvFormattedString(&options[OPT_FLAREMINENERGY].cNeg, "ergs"); + fvFormattedString(&options[OPT_FLAREMINENERGY].cDimension, "energy"); fnRead[OPT_FLAREMINENERGY] = &ReadFlareMinEnergy; - sprintf(options[OPT_FLAREMAXENERGY].cName, "dFlareMaxEnergy"); - sprintf(options[OPT_FLAREMAXENERGY].cDescr, + fvFormattedString(&options[OPT_FLAREMAXENERGY].cName, "dFlareMaxEnergy"); + fvFormattedString(&options[OPT_FLAREMAXENERGY].cDescr, "Maximum Flare Energy to consider"); - sprintf(options[OPT_FLAREMAXENERGY].cDefault, "10^29 J"); + fvFormattedString(&options[OPT_FLAREMAXENERGY].cDefault, "10^29 J"); options[OPT_FLAREMAXENERGY].dDefault = 1e29; options[OPT_FLAREMAXENERGY].iType = 2; options[OPT_FLAREMAXENERGY].bMultiFile = 1; options[OPT_FLAREMAXENERGY].dNeg = 1e-7; - sprintf(options[OPT_FLAREMAXENERGY].cNeg, "ergs"); + fvFormattedString(&options[OPT_FLAREMAXENERGY].cNeg, "ergs"); + fvFormattedString(&options[OPT_FLAREMAXENERGY].cDimension, "energy"); fnRead[OPT_FLAREMAXENERGY] = &ReadFlareMaxEnergy; - sprintf(options[OPT_LXUVFLARECONST].cName, "dLXUVFlareConst"); - sprintf(options[OPT_LXUVFLARECONST].cDescr, "XUV luminosity of flares"); - sprintf(options[OPT_LXUVFLARECONST].cDefault, "10^22 Watts or 10^29 erg/s"); + fvFormattedString(&options[OPT_LXUVFLARECONST].cName, "dLXUVFlareConst"); + fvFormattedString(&options[OPT_LXUVFLARECONST].cDescr, "XUV luminosity of flares"); + fvFormattedString(&options[OPT_LXUVFLARECONST].cDefault, "10^22 Watts or 10^29 erg/s"); options[OPT_LXUVFLARECONST].dDefault = 1e22; options[OPT_LXUVFLARECONST].iType = 2; options[OPT_LXUVFLARECONST].bMultiFile = 1; options[OPT_LXUVFLARECONST].dNeg = LSUN; - sprintf(options[OPT_LXUVFLARECONST].cNeg, "LSUN"); - sprintf(options[OPT_LXUVFLARECONST].cDimension, "energy/time"); + fvFormattedString(&options[OPT_LXUVFLARECONST].cNeg, "LSUN"); + fvFormattedString(&options[OPT_LXUVFLARECONST].cDimension, "energy/time"); fnRead[OPT_LXUVFLARECONST] = &ReadLXUVFlareConst; // XXX Change to iEnergyBin for next major release - sprintf(options[OPT_FLAREENERGYBIN].cName, "dEnergyBin"); - sprintf(options[OPT_FLAREENERGYBIN].cDescr, + fvFormattedString(&options[OPT_FLAREENERGYBIN].cName, "dEnergyBin"); + fvFormattedString(&options[OPT_FLAREENERGYBIN].cDescr, "Number of energies consider between the minimum and maximum " "energies to calculate the luminosity by flares"); - sprintf(options[OPT_FLAREENERGYBIN].cDefault, + fvFormattedString(&options[OPT_FLAREENERGYBIN].cDefault, "100 energies between dFlareMinEnergy and dFlareMaxEnergy"); options[OPT_FLAREENERGYBIN].dDefault = 100; options[OPT_FLAREENERGYBIN].iType = 1; options[OPT_FLAREENERGYBIN].bMultiFile = 1; options[OPT_FLAREENERGYBIN].dNeg = 1; - sprintf(options[OPT_FLAREENERGYBIN].cNeg, "None"); + fvFormattedString(&options[OPT_FLAREENERGYBIN].cNeg, "None"); + fvFormattedString(&options[OPT_FLAREENERGYBIN].cDimension,"energy"); fnRead[OPT_FLAREENERGYBIN] = &ReadFlareEnergyBin; - sprintf(options[OPT_FLAREFFD].cName, "sFlareFFD"); - sprintf(options[OPT_FLAREFFD].cDescr, "Modes of calculate the FFD"); - sprintf(options[OPT_FLAREFFD].cDefault, "DAVENPORT"); - sprintf(options[OPT_FLAREFFD].cValues, "DAVENPORT LACY NONE"); + fvFormattedString(&options[OPT_FLAREFFD].cName, "sFlareFFD"); + fvFormattedString(&options[OPT_FLAREFFD].cDescr, "Modes of calculate the FFD"); + fvFormattedString(&options[OPT_FLAREFFD].cDefault, "DAVENPORT"); + fvFormattedString(&options[OPT_FLAREFFD].cValues, "DAVENPORT LACY NONE"); options[OPT_FLAREFFD].iType = 3; options[OPT_FLAREFFD].bMultiFile = 1; fnRead[OPT_FLAREFFD] = &ReadFlareFFD; - sprintf(options[OPT_FLAREFFD].cLongDescr, + fvFormattedString(&options[OPT_FLAREFFD].cLongDescr, " If DAVENPORT is selected, the code will employ the model\n" "fro Davenport et al.(2019) the user have\n" "to give the mass and Stellar age, dMass and dAge, as well\n" @@ -562,16 +567,16 @@ void InitializeOptionsFlare(OPTIONS *options, fnReadOption fnRead[]) { " use the XUV luminosity given by the user in the input \n" "file (dLXUVFlareConst). \n"); - sprintf(options[OPT_FLAREBANDPASS].cName, "sFlareBandPass"); - sprintf(options[OPT_FLAREBANDPASS].cDescr, + fvFormattedString(&options[OPT_FLAREBANDPASS].cName, "sFlareBandPass"); + fvFormattedString(&options[OPT_FLAREBANDPASS].cDescr, "Options of band pass of the input energy of flares"); - sprintf(options[OPT_FLAREBANDPASS].cDefault, "KEPLER"); - sprintf(options[OPT_FLAREBANDPASS].cValues, + fvFormattedString(&options[OPT_FLAREBANDPASS].cDefault, "KEPLER"); + fvFormattedString(&options[OPT_FLAREBANDPASS].cValues, "KEPLER UV GOES SXR BOLOMETRIC TESSUV"); options[OPT_FLAREBANDPASS].iType = 3; options[OPT_FLAREBANDPASS].bMultiFile = 1; fnRead[OPT_FLAREBANDPASS] = &ReadFlareBandPass; - sprintf(options[OPT_FLAREBANDPASS].cLongDescr, + fvFormattedString(&options[OPT_FLAREBANDPASS].cLongDescr, /* "If UV or GOES is selected, the code will convert \n" "the input energy of flares from the UV band \n" @@ -598,15 +603,15 @@ void InitializeOptionsFlare(OPTIONS *options, fnReadOption fnRead[]) { "Currently suppressed due to execution errors." ); /* - sprintf(options[OPT_FLARESLOPEUNITS].cName, "sFlareSlopeUnits"); - sprintf(options[OPT_FLARESLOPEUNITS].cDescr, + fvFormattedString(options[OPT_FLARESLOPEUNITS].cName, "sFlareSlopeUnits"); + fvFormattedString(options[OPT_FLARESLOPEUNITS].cDescr, "Options to the units of the FFD in which the FFD slopes are - define"); sprintf(options[OPT_FLARESLOPEUNITS].cDefault, "DAY"); - sprintf(options[OPT_FLARESLOPEUNITS].cValues, "SEC MIN HOUR DAY"); + define"); fvFormattedString(options[OPT_FLARESLOPEUNITS].cDefault, "DAY"); + fvFormattedString(options[OPT_FLARESLOPEUNITS].cValues, "SEC MIN HOUR DAY"); options[OPT_FLARESLOPEUNITS].iType = 3; options[OPT_FLARESLOPEUNITS].bMultiFile = 1; fnRead[OPT_FLARESLOPEUNITS] = &ReadFlareSlopeUnits; - sprintf(options[OPT_FLARESLOPEUNITS].cLongDescr, + fvFormattedString(options[OPT_FLARESLOPEUNITS].cLongDescr, " This option allow the user input the units for the inputed FFD " "slopes. The options are\n" " SEC, for input slopes with FFD in number of flares per seconds, " @@ -992,11 +997,11 @@ void WriteLXUVFlare(BODY *body, UPDATE *update, int iBody, double *dTmp, - char cUnit[]) { + char **cUnit) { *dTmp = fdLXUVFlare(body, control->Evolve.dTimeStep, iBody); if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { *dTmp /= fdUnitsEnergyFlux(units->iTime, units->iMass, units->iLength); fsUnitsEnergyFlux(units, cUnit); @@ -1018,7 +1023,7 @@ void WriteLXUVFlareUpper(BODY *body, *dTmp = body[iBody].dLXUVFlareUpper; if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { *dTmp /= fdUnitsEnergyFlux(units->iTime, units->iMass, units->iLength); fsUnitsEnergyFlux(units, cUnit); @@ -1034,11 +1039,11 @@ void WriteLXUVFlareLower(BODY *body, UPDATE *update, int iBody, double *dTmp, - char cUnit[]) { + char **cUnit) { *dTmp = body[iBody].dLXUVFlareLower; if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { *dTmp /= fdUnitsEnergyFlux(units->iTime, units->iMass, units->iLength); fsUnitsEnergyFlux(units, cUnit); @@ -1053,11 +1058,11 @@ void WriteFlareFreq1(BODY *body, UPDATE *update, int iBody, double *dTmp, - char cUnit[]) { + char **cUnit) { *dTmp = body[iBody].dFlareFreq1; if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { *dTmp *= fdUnitsTime(units->iTime); fsUnitsRate(units->iTime, cUnit); @@ -1071,11 +1076,11 @@ void WriteFlareFreq2(BODY *body, UPDATE *update, int iBody, double *dTmp, - char cUnit[]) { + char **cUnit) { *dTmp = body[iBody].dFlareFreq2; if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { *dTmp *= fdUnitsTime(units->iTime); fsUnitsRate(units->iTime, cUnit); @@ -1089,11 +1094,11 @@ void WriteFlareFreq3(BODY *body, UPDATE *update, int iBody, double *dTmp, - char cUnit[]) { + char **cUnit) { *dTmp = body[iBody].dFlareFreq3; if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { *dTmp *= fdUnitsTime(units->iTime); fsUnitsRate(units->iTime, cUnit); @@ -1107,11 +1112,11 @@ void WriteFlareFreq4(BODY *body, UPDATE *update, int iBody, double *dTmp, - char cUnit[]) { + char **cUnit) { *dTmp = body[iBody].dFlareFreq4; if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { *dTmp *= fdUnitsTime(units->iTime); fsUnitsRate(units->iTime, cUnit); @@ -1125,11 +1130,11 @@ void WriteFlareFreqMin(BODY *body, UPDATE *update, int iBody, double *dTmp, - char cUnit[]) { + char **cUnit) { *dTmp = body[iBody].dFlareFreqMin; if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { *dTmp *= fdUnitsTime(units->iTime); fsUnitsRate(units->iTime, cUnit); @@ -1143,11 +1148,11 @@ void WriteFlareFreqMid(BODY *body, UPDATE *update, int iBody, double *dTmp, - char cUnit[]) { + char **cUnit) { *dTmp = body[iBody].dFlareFreqMid; if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { *dTmp *= fdUnitsTime(units->iTime); fsUnitsRate(units->iTime, cUnit); @@ -1161,11 +1166,11 @@ void WriteFlareFreqMax(BODY *body, UPDATE *update, int iBody, double *dTmp, - char cUnit[]) { + char **cUnit) { *dTmp = body[iBody].dFlareFreqMax; if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { *dTmp *= fdUnitsTime(units->iTime); fsUnitsRate(units->iTime, cUnit); @@ -1179,11 +1184,11 @@ void WriteFlareEnergy1(BODY *body, UPDATE *update, int iBody, double *dTmp, - char cUnit[]) { + char **cUnit) { *dTmp = body[iBody].dFlareEnergy1; if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { *dTmp /= fdUnitsEnergy(units->iTime, units->iMass, units->iLength); fsUnitsEnergy(units, cUnit); @@ -1198,11 +1203,11 @@ void WriteFlareEnergy2(BODY *body, UPDATE *update, int iBody, double *dTmp, - char cUnit[]) { + char **cUnit) { *dTmp = body[iBody].dFlareEnergy2; if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { *dTmp /= fdUnitsEnergy(units->iTime, units->iMass, units->iLength); fsUnitsEnergy(units, cUnit); @@ -1217,11 +1222,11 @@ void WriteFlareEnergy3(BODY *body, UPDATE *update, int iBody, double *dTmp, - char cUnit[]) { + char **cUnit) { *dTmp = body[iBody].dFlareEnergy3; if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { *dTmp /= fdUnitsEnergy(units->iTime, units->iMass, units->iLength); fsUnitsEnergy(units, cUnit); @@ -1236,11 +1241,11 @@ void WriteFlareEnergy4(BODY *body, UPDATE *update, int iBody, double *dTmp, - char cUnit[]) { + char **cUnit) { *dTmp = body[iBody].dFlareEnergy4; if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { *dTmp /= fdUnitsEnergy(units->iTime, units->iMass, units->iLength); fsUnitsEnergy(units, cUnit); @@ -1254,11 +1259,11 @@ void WriteFlareEnergyMin(BODY *body, UPDATE *update, int iBody, double *dTmp, - char cUnit[]) { + char **cUnit) { *dTmp = body[iBody].dFlareEnergyMin; if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { *dTmp /= fdUnitsEnergy(units->iTime, units->iMass, units->iLength); fsUnitsEnergy(units, cUnit); @@ -1272,11 +1277,11 @@ void WriteFlareEnergyMid(BODY *body, UPDATE *update, int iBody, double *dTmp, - char cUnit[]) { + char **cUnit) { *dTmp = body[iBody].dFlareEnergyMid; if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { *dTmp /= fdUnitsEnergy(units->iTime, units->iMass, units->iLength); fsUnitsEnergy(units, cUnit); @@ -1291,11 +1296,11 @@ void WriteFlareEnergyMax(BODY *body, UPDATE *update, int iBody, double *dTmp, - char cUnit[]) { + char **cUnit) { *dTmp = body[iBody].dFlareEnergyMax; if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { *dTmp /= fdUnitsEnergy(units->iTime, units->iMass, units->iLength); fsUnitsEnergy(units, cUnit); @@ -1303,70 +1308,70 @@ void WriteFlareEnergyMax(BODY *body, } void InitializeOutputFlare(OUTPUT *output, fnWriteOutput fnWrite[]) { - sprintf(output[OUT_FLAREFREQ1].cName, "FlareFreq1"); - sprintf(output[OUT_FLAREFREQ1].cDescr, + fvFormattedString(&output[OUT_FLAREFREQ1].cName, "FlareFreq1"); + fvFormattedString(&output[OUT_FLAREFREQ1].cDescr, "First value of flare frequency range"); - sprintf(output[OUT_FLAREFREQ1].cNeg, "/day"); + fvFormattedString(&output[OUT_FLAREFREQ1].cNeg, "/day"); output[OUT_FLAREFREQ1].bNeg = 1; output[OUT_FLAREFREQ1].dNeg = DAYSEC; output[OUT_FLAREFREQ1].iNum = 1; output[OUT_FLAREFREQ1].iModuleBit = FLARE; fnWrite[OUT_FLAREFREQ1] = &WriteFlareFreq1; - sprintf(output[OUT_FLAREFREQ2].cName, "FlareFreq2"); - sprintf(output[OUT_FLAREFREQ2].cDescr, + fvFormattedString(&output[OUT_FLAREFREQ2].cName, "FlareFreq2"); + fvFormattedString(&output[OUT_FLAREFREQ2].cDescr, "Second value of flare frequency range"); - sprintf(output[OUT_FLAREFREQ2].cNeg, "/day"); + fvFormattedString(&output[OUT_FLAREFREQ2].cNeg, "/day"); output[OUT_FLAREFREQ2].bNeg = 1; output[OUT_FLAREFREQ2].dNeg = DAYSEC; output[OUT_FLAREFREQ2].iNum = 1; output[OUT_FLAREFREQ2].iModuleBit = FLARE; fnWrite[OUT_FLAREFREQ2] = &WriteFlareFreq2; - sprintf(output[OUT_FLAREFREQ3].cName, "FlareFreq3"); - sprintf(output[OUT_FLAREFREQ3].cDescr, + fvFormattedString(&output[OUT_FLAREFREQ3].cName, "FlareFreq3"); + fvFormattedString(&output[OUT_FLAREFREQ3].cDescr, "Third value of flare frequency range"); - sprintf(output[OUT_FLAREFREQ3].cNeg, "/day"); + fvFormattedString(&output[OUT_FLAREFREQ3].cNeg, "/day"); output[OUT_FLAREFREQ3].bNeg = 1; output[OUT_FLAREFREQ3].dNeg = DAYSEC; output[OUT_FLAREFREQ3].iNum = 1; output[OUT_FLAREFREQ3].iModuleBit = FLARE; fnWrite[OUT_FLAREFREQ3] = &WriteFlareFreq3; - sprintf(output[OUT_FLAREFREQ4].cName, "FlareFreq4"); - sprintf(output[OUT_FLAREFREQ4].cDescr, + fvFormattedString(&output[OUT_FLAREFREQ4].cName, "FlareFreq4"); + fvFormattedString(&output[OUT_FLAREFREQ4].cDescr, "Fourth value of flare frequency range"); - sprintf(output[OUT_FLAREFREQ4].cNeg, "/day"); + fvFormattedString(&output[OUT_FLAREFREQ4].cNeg, "/day"); output[OUT_FLAREFREQ4].bNeg = 1; output[OUT_FLAREFREQ4].dNeg = DAYSEC; output[OUT_FLAREFREQ4].iNum = 1; output[OUT_FLAREFREQ4].iModuleBit = FLARE; fnWrite[OUT_FLAREFREQ4] = &WriteFlareFreq4; - sprintf(output[OUT_FLAREFREQMIN].cName, "FlareFreqMin"); - sprintf(output[OUT_FLAREFREQMIN].cDescr, + fvFormattedString(&output[OUT_FLAREFREQMIN].cName, "FlareFreqMin"); + fvFormattedString(&output[OUT_FLAREFREQMIN].cDescr, "Frequency of the flares with the lowest energy"); - sprintf(output[OUT_FLAREFREQMIN].cNeg, "/day"); + fvFormattedString(&output[OUT_FLAREFREQMIN].cNeg, "/day"); output[OUT_FLAREFREQMIN].bNeg = 1; output[OUT_FLAREFREQMIN].dNeg = DAYSEC; output[OUT_FLAREFREQMIN].iNum = 1; output[OUT_FLAREFREQMIN].iModuleBit = FLARE; fnWrite[OUT_FLAREFREQMIN] = &WriteFlareFreqMin; - sprintf(output[OUT_FLAREFREQMID].cName, "FlareFreqMid"); - sprintf(output[OUT_FLAREFREQMID].cDescr, + fvFormattedString(&output[OUT_FLAREFREQMID].cName, "FlareFreqMid"); + fvFormattedString(&output[OUT_FLAREFREQMID].cDescr, "Frequency of the flares with the middle energy in the energy range"); - sprintf(output[OUT_FLAREFREQMID].cNeg, "/day"); + fvFormattedString(&output[OUT_FLAREFREQMID].cNeg, "/day"); output[OUT_FLAREFREQMID].bNeg = 1; output[OUT_FLAREFREQMID].dNeg = DAYSEC; output[OUT_FLAREFREQMID].iNum = 1; output[OUT_FLAREFREQMID].iModuleBit = FLARE; fnWrite[OUT_FLAREFREQMID] = &WriteFlareFreqMid; - sprintf(output[OUT_FLAREFREQMAX].cName, "FlareFreqMax"); - sprintf(output[OUT_FLAREFREQMAX].cDescr, + fvFormattedString(&output[OUT_FLAREFREQMAX].cName, "FlareFreqMax"); + fvFormattedString(&output[OUT_FLAREFREQMAX].cDescr, "Frequency of the flares with the highest energy"); - sprintf(output[OUT_FLAREFREQMAX].cNeg, "/day"); + fvFormattedString(&output[OUT_FLAREFREQMAX].cNeg, "/day"); output[OUT_FLAREFREQMAX].bNeg = 1; output[OUT_FLAREFREQMAX].dNeg = DAYSEC; output[OUT_FLAREFREQMAX].iNum = 1; @@ -1374,66 +1379,66 @@ void InitializeOutputFlare(OUTPUT *output, fnWriteOutput fnWrite[]) { fnWrite[OUT_FLAREFREQMAX] = &WriteFlareFreqMax; - sprintf(output[OUT_FLAREENERGY1].cName, "FlareEnergy1"); - sprintf(output[OUT_FLAREENERGY1].cDescr, "First value of flare energy range"); - sprintf(output[OUT_FLAREENERGY1].cNeg, "ergs"); + fvFormattedString(&output[OUT_FLAREENERGY1].cName, "FlareEnergy1"); + fvFormattedString(&output[OUT_FLAREENERGY1].cDescr, "First value of flare energy range"); + fvFormattedString(&output[OUT_FLAREENERGY1].cNeg, "ergs"); output[OUT_FLAREENERGY1].bNeg = 1; output[OUT_FLAREENERGY1].dNeg = 1.0e7; output[OUT_FLAREENERGY1].iNum = 1; output[OUT_FLAREENERGY1].iModuleBit = FLARE; fnWrite[OUT_FLAREENERGY1] = &WriteFlareEnergy1; - sprintf(output[OUT_FLAREENERGY2].cName, "FlareEnergy2"); - sprintf(output[OUT_FLAREENERGY2].cDescr, + fvFormattedString(&output[OUT_FLAREENERGY2].cName, "FlareEnergy2"); + fvFormattedString(&output[OUT_FLAREENERGY2].cDescr, "Second value of flare energy range"); - sprintf(output[OUT_FLAREENERGY2].cNeg, "ergs"); + fvFormattedString(&output[OUT_FLAREENERGY2].cNeg, "ergs"); output[OUT_FLAREENERGY2].bNeg = 1; output[OUT_FLAREENERGY2].dNeg = 1.0e7; output[OUT_FLAREENERGY2].iNum = 1; output[OUT_FLAREENERGY2].iModuleBit = FLARE; fnWrite[OUT_FLAREENERGY2] = &WriteFlareEnergy2; - sprintf(output[OUT_FLAREENERGY3].cName, "FlareEnergy3"); - sprintf(output[OUT_FLAREENERGY3].cDescr, "Third value of flare energy range"); - sprintf(output[OUT_FLAREENERGY3].cNeg, "ergs"); + fvFormattedString(&output[OUT_FLAREENERGY3].cName, "FlareEnergy3"); + fvFormattedString(&output[OUT_FLAREENERGY3].cDescr, "Third value of flare energy range"); + fvFormattedString(&output[OUT_FLAREENERGY3].cNeg, "ergs"); output[OUT_FLAREENERGY3].bNeg = 1; output[OUT_FLAREENERGY3].dNeg = 1.0e7; output[OUT_FLAREENERGY3].iNum = 1; output[OUT_FLAREENERGY3].iModuleBit = FLARE; fnWrite[OUT_FLAREENERGY3] = &WriteFlareEnergy3; - sprintf(output[OUT_FLAREENERGY4].cName, "FlareEnergy4"); - sprintf(output[OUT_FLAREENERGY4].cDescr, + fvFormattedString(&output[OUT_FLAREENERGY4].cName, "FlareEnergy4"); + fvFormattedString(&output[OUT_FLAREENERGY4].cDescr, "Fourth value of flare energy range"); - sprintf(output[OUT_FLAREENERGY4].cNeg, "ergs"); + fvFormattedString(&output[OUT_FLAREENERGY4].cNeg, "ergs"); output[OUT_FLAREENERGY4].bNeg = 1; output[OUT_FLAREENERGY4].dNeg = 1.0e7; output[OUT_FLAREENERGY4].iNum = 1; output[OUT_FLAREENERGY4].iModuleBit = FLARE; fnWrite[OUT_FLAREENERGY4] = &WriteFlareEnergy4; - sprintf(output[OUT_FLAREENERGYMIN].cName, "FlareEnergyMin"); - sprintf(output[OUT_FLAREENERGYMIN].cDescr, "Minimum flare energy"); - sprintf(output[OUT_FLAREENERGYMIN].cNeg, "ergs"); + fvFormattedString(&output[OUT_FLAREENERGYMIN].cName, "FlareEnergyMin"); + fvFormattedString(&output[OUT_FLAREENERGYMIN].cDescr, "Minimum flare energy"); + fvFormattedString(&output[OUT_FLAREENERGYMIN].cNeg, "ergs"); output[OUT_FLAREENERGYMIN].bNeg = 1; output[OUT_FLAREENERGYMIN].dNeg = 1.0e7; output[OUT_FLAREENERGYMIN].iNum = 1; output[OUT_FLAREENERGYMIN].iModuleBit = FLARE; fnWrite[OUT_FLAREENERGYMIN] = &WriteFlareEnergyMin; - sprintf(output[OUT_FLAREENERGYMID].cName, "FlareEnergyMid"); - sprintf(output[OUT_FLAREENERGYMID].cDescr, + fvFormattedString(&output[OUT_FLAREENERGYMID].cName, "FlareEnergyMid"); + fvFormattedString(&output[OUT_FLAREENERGYMID].cDescr, "Middle flare energy in the range of energy values"); - sprintf(output[OUT_FLAREENERGYMID].cNeg, "ergs"); + fvFormattedString(&output[OUT_FLAREENERGYMID].cNeg, "ergs"); output[OUT_FLAREENERGYMID].bNeg = 1; output[OUT_FLAREENERGYMID].dNeg = 1.0e7; output[OUT_FLAREENERGYMID].iNum = 1; output[OUT_FLAREENERGYMID].iModuleBit = FLARE; fnWrite[OUT_FLAREENERGYMID] = &WriteFlareEnergyMid; - sprintf(output[OUT_FLAREENERGYMAX].cName, "FlareEnergyMax"); - sprintf(output[OUT_FLAREENERGYMAX].cDescr, "Maximum flare energy"); - sprintf(output[OUT_FLAREENERGYMAX].cNeg, "ergs"); + fvFormattedString(&output[OUT_FLAREENERGYMAX].cName, "FlareEnergyMax"); + fvFormattedString(&output[OUT_FLAREENERGYMAX].cDescr, "Maximum flare energy"); + fvFormattedString(&output[OUT_FLAREENERGYMAX].cNeg, "ergs"); output[OUT_FLAREENERGYMAX].bNeg = 1; output[OUT_FLAREENERGYMAX].dNeg = 1.0e7; output[OUT_FLAREENERGYMAX].iNum = 1; @@ -1441,9 +1446,9 @@ void InitializeOutputFlare(OUTPUT *output, fnWriteOutput fnWrite[]) { fnWrite[OUT_FLAREENERGYMAX] = &WriteFlareEnergyMax; - sprintf(output[OUT_LXUVFLARE].cName, "LXUVFlare"); - sprintf(output[OUT_LXUVFLARE].cDescr, "XUV Luminosity from flares"); - sprintf(output[OUT_LXUVFLARE].cNeg, "LSUN"); + fvFormattedString(&output[OUT_LXUVFLARE].cName, "LXUVFlare"); + fvFormattedString(&output[OUT_LXUVFLARE].cDescr, "XUV Luminosity from flares"); + fvFormattedString(&output[OUT_LXUVFLARE].cNeg, "LSUN"); output[OUT_LXUVFLARE].bNeg = 1; output[OUT_LXUVFLARE].dNeg = 1. / LSUN; output[OUT_LXUVFLARE].iNum = 1; @@ -1452,22 +1457,22 @@ void InitializeOutputFlare(OUTPUT *output, fnWriteOutput fnWrite[]) { // TODO: Include the error in the FFD slopes to calculate the upper and higher // limit of XUV luminosity by flares - /*sprintf(output[OUT_LXUVFLAREUPPER].cName, "LXUVFlareUpper"); - sprintf(output[OUT_LXUVFLAREUPPER].cDescr, + /*fvFormattedString(output[OUT_LXUVFLAREUPPER].cName, "LXUVFlareUpper"); + fvFormattedString(output[OUT_LXUVFLAREUPPER].cDescr, "Upper limit value to XUV Luminosity from flares when considerer " "flare rate slope and Y-intercept errors"); - sprintf(output[OUT_LXUVFLAREUPPER].cNeg, "LSUN"); + fvFormattedString(output[OUT_LXUVFLAREUPPER].cNeg, "LSUN"); output[OUT_LXUVFLAREUPPER].bNeg = 1; output[OUT_LXUVFLAREUPPER].dNeg = 1. / LSUN; output[OUT_LXUVFLAREUPPER].iNum = 1; output[OUT_LXUVFLAREUPPER].iModuleBit = FLARE; fnWrite[OUT_LXUVFLAREUPPER] = &WriteLXUVFlareUpper; - sprintf(output[OUT_LXUVFLARELOWER].cName, "LXUVFlareLower"); - sprintf(output[OUT_LXUVFLARELOWER].cDescr, + fvFormattedString(output[OUT_LXUVFLARELOWER].cName, "LXUVFlareLower"); + fvFormattedString(output[OUT_LXUVFLARELOWER].cDescr, "Lower limit value to XUV Luminosity from flares when considerer " "flare rate slope and Y-intercept errors"); - sprintf(output[OUT_LXUVFLARELOWER].cNeg, "LSUN"); + fvFormattedString(output[OUT_LXUVFLARELOWER].cNeg, "LSUN"); output[OUT_LXUVFLARELOWER].bNeg = 1; output[OUT_LXUVFLARELOWER].dNeg = 1. / LSUN; output[OUT_LXUVFLARELOWER].iNum = 1; diff --git a/src/flare.h b/src/flare.h index 7647a8180..8d8ca979c 100644 --- a/src/flare.h +++ b/src/flare.h @@ -108,35 +108,35 @@ void InitializeOutputFunctionFlare(OUTPUT *, int, int); void FinalizeOutputFunctionFlare(OUTPUT *, int, int); void WriteLXUVFlare(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, UPDATE *, - int, double *, char[]); + int, double *, char**); void WriteFlareFreq1(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, UPDATE *, - int, double *, char[]); + int, double *, char**); void WriteFlareFreq2(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, UPDATE *, - int, double *, char[]); + int, double *, char**); void WriteFlareFreq3(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, UPDATE *, - int, double *, char[]); + int, double *, char**); void WriteFlareFreq4(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, UPDATE *, - int, double *, char[]); + int, double *, char**); void WriteFlareFreqMin(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, UPDATE *, - int, double *, char[]); + int, double *, char**); void WriteFlareFreqMid(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, UPDATE *, - int, double *, char[]); + int, double *, char**); void WriteFlareFreqMax(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, UPDATE *, - int, double *, char[]); + int, double *, char**); void WriteFlareEnergy1(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, UPDATE *, - int, double *, char[]); + int, double *, char**); void WriteFlareEnergy2(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, UPDATE *, - int, double *, char[]); + int, double *, char**); void WriteFlareEnergy3(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, UPDATE *, - int, double *, char[]); + int, double *, char**); void WriteFlareEnergy4(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, UPDATE *, - int, double *, char[]); + int, double *, char**); void WriteFlareEnergyMin(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, - UPDATE *, int, double *, char[]); + UPDATE *, int, double *, char**); void WriteFlareEnergyMid(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, - UPDATE *, int, double *, char[]); + UPDATE *, int, double *, char**); void WriteFlareEnergyMax(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, - UPDATE *, int, double *, char[]); + UPDATE *, int, double *, char**); /* Logging Functions */ void LogOptionsFlare(CONTROL *, FILE *); diff --git a/src/galhabit.c b/src/galhabit.c index e08a7b26b..b85545188 100644 --- a/src/galhabit.c +++ b/src/galhabit.c @@ -573,199 +573,199 @@ void ReadHostBinMass1(BODY *body, CONTROL *control, FILES *files, } void InitializeOptionsGalHabit(OPTIONS *options, fnReadOption fnRead[]) { - sprintf(options[OPT_GALACDENSITY].cName, "dGalacDensity"); - sprintf(options[OPT_GALACDENSITY].cDescr, "Density of galactic environment"); - sprintf(options[OPT_GALACDENSITY].cDefault, + fvFormattedString(&options[OPT_GALACDENSITY].cName, "dGalacDensity"); + fvFormattedString(&options[OPT_GALACDENSITY].cDescr, "Density of galactic environment"); + fvFormattedString(&options[OPT_GALACDENSITY].cDefault, "0.102"); // need to find updated value - sprintf(options[OPT_GALACDENSITY].cDimension, "mass/length^3"); + fvFormattedString(&options[OPT_GALACDENSITY].cDimension, "mass/length^3"); options[OPT_GALACDENSITY].dDefault = 0.102; options[OPT_GALACDENSITY].iType = 2; options[OPT_GALACDENSITY].bMultiFile = 0; fnRead[OPT_GALACDENSITY] = &ReadGalacDensity; - sprintf(options[OPT_RANDSEED].cName, "iRandSeed"); - sprintf(options[OPT_RANDSEED].cDescr, + fvFormattedString(&options[OPT_RANDSEED].cName, "iRandSeed"); + fvFormattedString(&options[OPT_RANDSEED].cDescr, "Seed for random number generator (stellar encounters)"); - sprintf(options[OPT_RANDSEED].cDefault, "42"); + fvFormattedString(&options[OPT_RANDSEED].cDefault, "42"); options[OPT_RANDSEED].dDefault = 42; options[OPT_RANDSEED].iType = 1; options[OPT_RANDSEED].bMultiFile = 0; fnRead[OPT_RANDSEED] = &ReadRandSeed; - sprintf(options[OPT_ENCOUNTERRAD].cName, "dEncounterRad"); - sprintf(options[OPT_ENCOUNTERRAD].cDescr, + fvFormattedString(&options[OPT_ENCOUNTERRAD].cName, "dEncounterRad"); + fvFormattedString(&options[OPT_ENCOUNTERRAD].cDescr, "Radius at which stellar encounters occur"); - sprintf(options[OPT_ENCOUNTERRAD].cDefault, "206265 AU"); - sprintf(options[OPT_ENCOUNTERRAD].cDimension, "length"); + fvFormattedString(&options[OPT_ENCOUNTERRAD].cDefault, "206265 AU"); + fvFormattedString(&options[OPT_ENCOUNTERRAD].cDimension, "length"); options[OPT_ENCOUNTERRAD].dDefault = 206265.0 * AUM; options[OPT_ENCOUNTERRAD].iType = 2; options[OPT_ENCOUNTERRAD].bMultiFile = 0; fnRead[OPT_ENCOUNTERRAD] = &ReadEncounterRad; - sprintf(options[OPT_RFORM].cName, "dRForm"); - sprintf(options[OPT_RFORM].cDescr, "Galactic formation radius"); - sprintf(options[OPT_RFORM].cDefault, "4.5 kpc"); - sprintf(options[OPT_RFORM].cDimension, "length"); + fvFormattedString(&options[OPT_RFORM].cName, "dRForm"); + fvFormattedString(&options[OPT_RFORM].cDescr, "Galactic formation radius"); + fvFormattedString(&options[OPT_RFORM].cDefault, "4.5 kpc"); + fvFormattedString(&options[OPT_RFORM].cDimension, "length"); options[OPT_RFORM].dDefault = 4.5; options[OPT_RFORM].iType = 2; options[OPT_RFORM].bMultiFile = 0; fnRead[OPT_RFORM] = &ReadRForm; - sprintf(options[OPT_TMIGRATION].cName, "dTMigration"); - sprintf(options[OPT_TMIGRATION].cDescr, "Time of radial migration"); - sprintf(options[OPT_TMIGRATION].cDefault, "3 Gy"); - sprintf(options[OPT_TMIGRATION].cDimension, "time"); + fvFormattedString(&options[OPT_TMIGRATION].cName, "dTMigration"); + fvFormattedString(&options[OPT_TMIGRATION].cDescr, "Time of radial migration"); + fvFormattedString(&options[OPT_TMIGRATION].cDefault, "3 Gy"); + fvFormattedString(&options[OPT_TMIGRATION].cDimension, "time"); options[OPT_TMIGRATION].dDefault = 3e9 * YEARSEC; options[OPT_TMIGRATION].iType = 2; options[OPT_TMIGRATION].bMultiFile = 0; options[OPT_TMIGRATION].dNeg = YEARSEC; - sprintf(options[OPT_TMIGRATION].cNeg, "Years"); + fvFormattedString(&options[OPT_TMIGRATION].cNeg, "Years"); fnRead[OPT_TMIGRATION] = &ReadTMigration; - sprintf(options[OPT_RADIALMIGR].cName, "bRadialMigr"); - sprintf(options[OPT_RADIALMIGR].cDescr, "Use radial migration?"); - sprintf(options[OPT_RADIALMIGR].cDefault, "0"); + fvFormattedString(&options[OPT_RADIALMIGR].cName, "bRadialMigr"); + fvFormattedString(&options[OPT_RADIALMIGR].cDescr, "Use radial migration?"); + fvFormattedString(&options[OPT_RADIALMIGR].cDefault, "0"); options[OPT_RADIALMIGR].dDefault = 0; options[OPT_RADIALMIGR].iType = 0; options[OPT_RADIALMIGR].bMultiFile = 0; fnRead[OPT_RADIALMIGR] = &ReadRadialMigr; - sprintf(options[OPT_GASDENSITY].cName, "dGasDensity"); - sprintf(options[OPT_GASDENSITY].cDescr, "Local ISM density"); - sprintf(options[OPT_GASDENSITY].cDefault, "0.05 Msun pc^3"); - sprintf(options[OPT_GASDENSITY].cDimension, "mass/length^3"); + fvFormattedString(&options[OPT_GASDENSITY].cName, "dGasDensity"); + fvFormattedString(&options[OPT_GASDENSITY].cDescr, "Local ISM density"); + fvFormattedString(&options[OPT_GASDENSITY].cDefault, "0.05 Msun pc^3"); + fvFormattedString(&options[OPT_GASDENSITY].cDimension, "mass/length^3"); options[OPT_GASDENSITY].dDefault = 0.05; options[OPT_GASDENSITY].iType = 2; options[OPT_GASDENSITY].bMultiFile = 0; fnRead[OPT_GASDENSITY] = &ReadGasDensity; - sprintf(options[OPT_DMDENSITY].cName, "dDMDensity"); - sprintf(options[OPT_DMDENSITY].cDescr, "Local dark matter density"); - sprintf(options[OPT_DMDENSITY].cDefault, "0.01 Msun pc^3"); - sprintf(options[OPT_DMDENSITY].cDimension, "mass/length^3"); + fvFormattedString(&options[OPT_DMDENSITY].cName, "dDMDensity"); + fvFormattedString(&options[OPT_DMDENSITY].cDescr, "Local dark matter density"); + fvFormattedString(&options[OPT_DMDENSITY].cDefault, "0.01 Msun pc^3"); + fvFormattedString(&options[OPT_DMDENSITY].cDimension, "mass/length^3"); options[OPT_DMDENSITY].dDefault = 0.01; options[OPT_DMDENSITY].iType = 2; options[OPT_DMDENSITY].bMultiFile = 0; fnRead[OPT_DMDENSITY] = &ReadDMDensity; - sprintf(options[OPT_STARSCALEL].cName, "dStarScaleL"); - sprintf(options[OPT_STARSCALEL].cDescr, "Stellar radial scale length in MW"); - sprintf(options[OPT_STARSCALEL].cDefault, "2.4 kpc"); - sprintf(options[OPT_STARSCALEL].cDimension, "length"); + fvFormattedString(&options[OPT_STARSCALEL].cName, "dStarScaleL"); + fvFormattedString(&options[OPT_STARSCALEL].cDescr, "Stellar radial scale length in MW"); + fvFormattedString(&options[OPT_STARSCALEL].cDefault, "2.4 kpc"); + fvFormattedString(&options[OPT_STARSCALEL].cDimension, "length"); options[OPT_STARSCALEL].dDefault = 2.4; options[OPT_STARSCALEL].iType = 2; options[OPT_STARSCALEL].bMultiFile = 0; fnRead[OPT_STARSCALEL] = &ReadStarScaleL; - sprintf(options[OPT_STELLARENC].cName, "bStellarEnc"); - sprintf(options[OPT_STELLARENC].cDescr, "Model stellar encounters?"); - sprintf(options[OPT_STELLARENC].cDefault, "1"); + fvFormattedString(&options[OPT_STELLARENC].cName, "bStellarEnc"); + fvFormattedString(&options[OPT_STELLARENC].cDescr, "Model stellar encounters?"); + fvFormattedString(&options[OPT_STELLARENC].cDefault, "1"); options[OPT_STELLARENC].dDefault = 1; options[OPT_STELLARENC].iType = 0; options[OPT_STELLARENC].bMultiFile = 0; fnRead[OPT_STELLARENC] = &ReadStellarEnc; - sprintf(options[OPT_OUTPUTENC].cName, "bOutputEnc"); - sprintf(options[OPT_OUTPUTENC].cDescr, + fvFormattedString(&options[OPT_OUTPUTENC].cName, "bOutputEnc"); + fvFormattedString(&options[OPT_OUTPUTENC].cDescr, "Output stellar encounter information?"); - sprintf(options[OPT_OUTPUTENC].cDefault, "0"); + fvFormattedString(&options[OPT_OUTPUTENC].cDefault, "0"); options[OPT_OUTPUTENC].dDefault = 0; options[OPT_OUTPUTENC].iType = 0; options[OPT_OUTPUTENC].bMultiFile = 0; fnRead[OPT_OUTPUTENC] = &ReadOutputEnc; - sprintf(options[OPT_TIMEEVOLVELDISP].cName, "bTimeEvolVelDisp"); - sprintf(options[OPT_TIMEEVOLVELDISP].cDescr, + fvFormattedString(&options[OPT_TIMEEVOLVELDISP].cName, "bTimeEvolVelDisp"); + fvFormattedString(&options[OPT_TIMEEVOLVELDISP].cDescr, "Scale velocity dispersion of stars with sqrt(t)?"); - sprintf(options[OPT_TIMEEVOLVELDISP].cDefault, "1"); - sprintf(options[OPT_TIMEEVOLVELDISP].cDimension, "length/time"); + fvFormattedString(&options[OPT_TIMEEVOLVELDISP].cDefault, "1"); + fvFormattedString(&options[OPT_TIMEEVOLVELDISP].cDimension, "length/time"); options[OPT_TIMEEVOLVELDISP].dDefault = 1; options[OPT_TIMEEVOLVELDISP].iType = 0; options[OPT_TIMEEVOLVELDISP].bMultiFile = 0; fnRead[OPT_TIMEEVOLVELDISP] = &ReadTimeEvolVelDisp; - sprintf(options[OPT_HOSTBINARY].cName, "bHostBinary"); - sprintf(options[OPT_HOSTBINARY].cDescr, + fvFormattedString(&options[OPT_HOSTBINARY].cName, "bHostBinary"); + fvFormattedString(&options[OPT_HOSTBINARY].cDescr, "Include 3 body interactions with binary star"); - sprintf(options[OPT_HOSTBINARY].cDefault, "0"); + fvFormattedString(&options[OPT_HOSTBINARY].cDefault, "0"); options[OPT_HOSTBINARY].dDefault = 0; options[OPT_HOSTBINARY].iType = 0; options[OPT_HOSTBINARY].bMultiFile = 0; fnRead[OPT_HOSTBINARY] = &ReadHostBinary; - sprintf(options[OPT_GALACTIDES].cName, "bGalacTides"); - sprintf(options[OPT_GALACTIDES].cDescr, "Include galactic tides"); - sprintf(options[OPT_GALACTIDES].cDefault, "1"); + fvFormattedString(&options[OPT_GALACTIDES].cName, "bGalacTides"); + fvFormattedString(&options[OPT_GALACTIDES].cDescr, "Include galactic tides"); + fvFormattedString(&options[OPT_GALACTIDES].cDefault, "1"); options[OPT_GALACTIDES].dDefault = 1; options[OPT_GALACTIDES].iType = 0; options[OPT_GALACTIDES].bMultiFile = 0; fnRead[OPT_GALACTIDES] = &ReadGalacTides; - sprintf(options[OPT_MINSTELLARAPPROACH].cName, "dMinStellarApproach"); - sprintf(options[OPT_MINSTELLARAPPROACH].cDescr, + fvFormattedString(&options[OPT_MINSTELLARAPPROACH].cName, "dMinStellarApproach"); + fvFormattedString(&options[OPT_MINSTELLARAPPROACH].cDescr, "Minimum close approach distance to primary"); - sprintf(options[OPT_MINSTELLARAPPROACH].cDefault, "1 AU"); - sprintf(options[OPT_MINSTELLARAPPROACH].cDimension, "length"); + fvFormattedString(&options[OPT_MINSTELLARAPPROACH].cDefault, "1 AU"); + fvFormattedString(&options[OPT_MINSTELLARAPPROACH].cDimension, "length"); options[OPT_MINSTELLARAPPROACH].dDefault = AUM; options[OPT_MINSTELLARAPPROACH].iType = 2; options[OPT_MINSTELLARAPPROACH].bMultiFile = 0; options[OPT_MINSTELLARAPPROACH].dNeg = AUM; - sprintf(options[OPT_MINSTELLARAPPROACH].cNeg, "AU"); + fvFormattedString(&options[OPT_MINSTELLARAPPROACH].cNeg, "AU"); fnRead[OPT_MINSTELLARAPPROACH] = &ReadMinStellarApproach; - sprintf(options[OPT_HOSTBINECC].cName, "dHostBinEcc"); - sprintf(options[OPT_HOSTBINECC].cDescr, "eccentricity of host binary"); - sprintf(options[OPT_HOSTBINECC].cDefault, "0.51"); - sprintf(options[OPT_HOSTBINECC].cDimension, "nd"); + fvFormattedString(&options[OPT_HOSTBINECC].cName, "dHostBinEcc"); + fvFormattedString(&options[OPT_HOSTBINECC].cDescr, "eccentricity of host binary"); + fvFormattedString(&options[OPT_HOSTBINECC].cDefault, "0.51"); + fvFormattedString(&options[OPT_HOSTBINECC].cDimension, "nd"); options[OPT_HOSTBINECC].dDefault = 0.51; options[OPT_HOSTBINECC].iType = 2; options[OPT_HOSTBINECC].bMultiFile = 0; fnRead[OPT_HOSTBINECC] = &ReadHostBinEcc; - sprintf(options[OPT_HOSTBINSEMI].cName, "dHostBinSemi"); - sprintf(options[OPT_HOSTBINSEMI].cDescr, "Semi-major of host binary"); - sprintf(options[OPT_HOSTBINSEMI].cDefault, "17.57 AU"); - sprintf(options[OPT_HOSTBINSEMI].cDimension, "length"); + fvFormattedString(&options[OPT_HOSTBINSEMI].cName, "dHostBinSemi"); + fvFormattedString(&options[OPT_HOSTBINSEMI].cDescr, "Semi-major of host binary"); + fvFormattedString(&options[OPT_HOSTBINSEMI].cDefault, "17.57 AU"); + fvFormattedString(&options[OPT_HOSTBINSEMI].cDimension, "length"); options[OPT_HOSTBINSEMI].dDefault = 17.57 * AUM; options[OPT_HOSTBINSEMI].iType = 2; options[OPT_HOSTBINSEMI].bMultiFile = 0; options[OPT_HOSTBINSEMI].dNeg = AUM; - sprintf(options[OPT_HOSTBINSEMI].cNeg, "AU"); + fvFormattedString(&options[OPT_HOSTBINSEMI].cNeg, "AU"); fnRead[OPT_HOSTBINSEMI] = &ReadHostBinSemi; - sprintf(options[OPT_HOSTBININC].cName, "dHostBinInc"); - sprintf(options[OPT_HOSTBININC].cDescr, "inclination of host binary"); - sprintf(options[OPT_HOSTBININC].cDefault, "60.0 deg"); - sprintf(options[OPT_HOSTBININC].cDimension, "angle"); + fvFormattedString(&options[OPT_HOSTBININC].cName, "dHostBinInc"); + fvFormattedString(&options[OPT_HOSTBININC].cDescr, "inclination of host binary"); + fvFormattedString(&options[OPT_HOSTBININC].cDefault, "60.0 deg"); + fvFormattedString(&options[OPT_HOSTBININC].cDimension, "angle"); options[OPT_HOSTBININC].dDefault = 60.0 * DEGRAD; options[OPT_HOSTBININC].iType = 2; options[OPT_HOSTBININC].bMultiFile = 0; fnRead[OPT_HOSTBININC] = &ReadHostBinInc; - sprintf(options[OPT_HOSTBINARGP].cName, "dHostBinArgP"); - sprintf(options[OPT_HOSTBINARGP].cDescr, "Arg periapse of host binary"); - sprintf(options[OPT_HOSTBINARGP].cDefault, "0.0"); - sprintf(options[OPT_HOSTBINARGP].cDimension, "angle"); + fvFormattedString(&options[OPT_HOSTBINARGP].cName, "dHostBinArgP"); + fvFormattedString(&options[OPT_HOSTBINARGP].cDescr, "Arg periapse of host binary"); + fvFormattedString(&options[OPT_HOSTBINARGP].cDefault, "0.0"); + fvFormattedString(&options[OPT_HOSTBINARGP].cDimension, "angle"); options[OPT_HOSTBINARGP].dDefault = 0.0; options[OPT_HOSTBINARGP].iType = 2; options[OPT_HOSTBINARGP].bMultiFile = 0; fnRead[OPT_HOSTBINARGP] = &ReadHostBinArgP; - sprintf(options[OPT_HOSTBINLONGA].cName, "dHostBinLongA"); - sprintf(options[OPT_HOSTBINLONGA].cDescr, + fvFormattedString(&options[OPT_HOSTBINLONGA].cName, "dHostBinLongA"); + fvFormattedString(&options[OPT_HOSTBINLONGA].cDescr, "Long of ascending node of host binary"); - sprintf(options[OPT_HOSTBINLONGA].cDefault, "0.0"); - sprintf(options[OPT_HOSTBINLONGA].cDimension, "angle"); + fvFormattedString(&options[OPT_HOSTBINLONGA].cDefault, "0.0"); + fvFormattedString(&options[OPT_HOSTBINLONGA].cDimension, "angle"); options[OPT_HOSTBINLONGA].dDefault = 0.0; options[OPT_HOSTBINLONGA].iType = 2; options[OPT_HOSTBINLONGA].bMultiFile = 0; fnRead[OPT_HOSTBINLONGA] = &ReadHostBinLongA; - sprintf(options[OPT_HOSTBINMASS1].cName, "dHostBinMass1"); - sprintf(options[OPT_HOSTBINMASS1].cDescr, "mass of larger host binary star"); - sprintf(options[OPT_HOSTBINMASS1].cDefault, "1.1 Msun"); - sprintf(options[OPT_HOSTBINMASS1].cDimension, "mass"); + fvFormattedString(&options[OPT_HOSTBINMASS1].cName, "dHostBinMass1"); + fvFormattedString(&options[OPT_HOSTBINMASS1].cDescr, "mass of larger host binary star"); + fvFormattedString(&options[OPT_HOSTBINMASS1].cDefault, "1.1 Msun"); + fvFormattedString(&options[OPT_HOSTBINMASS1].cDimension, "mass"); options[OPT_HOSTBINMASS1].dDefault = 1.1 * MSUN; options[OPT_HOSTBINMASS1].iType = 2; options[OPT_HOSTBINMASS1].bMultiFile = 0; @@ -1076,7 +1076,7 @@ void VerifyGalHabit(BODY *body, CONTROL *control, FILES *files, int i, iEqn; int n; double dSigma, dDMR, dStarR, dGasR, dCurrentAge; - char cOut[3 * NAMELEN]; + char *cOut; FILE *fOut; srand(system->iSeed); @@ -1164,7 +1164,7 @@ void VerifyGalHabit(BODY *body, CONTROL *control, FILES *files, if (iBody >= 1) { if (system->bOutputEnc) { - sprintf(cOut, "%s.%s.Encounters", system->cName, body[iBody].cName); + fvFormattedString(&cOut, "%s.%s.Encounters", system->cName, body[iBody].cName); fOut = fopen(cOut, "w"); fprintf(fOut, "#time encdt tstart MV mass sigma impx impy impz u_rel v_rel " @@ -1412,13 +1412,13 @@ void VerifyHaltGalHabit(BODY *body, CONTROL *control, OPTIONS *options, void WriteBodyPeriQ(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, - double *dTmp, char cUnit[]) { + double *dTmp, char **cUnit) { *dTmp = body[iBody].dSemi * (1.0 - body[iBody].dEcc); if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { *dTmp /= fdUnitsLength(units->iLength); fsUnitsLength(units->iLength, cUnit); @@ -1427,42 +1427,42 @@ void WriteBodyPeriQ(BODY *body, CONTROL *control, OUTPUT *output, void WriteBodyEccX(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, double *dTmp, - char cUnit[]) { + char **cUnit) { *dTmp = body[iBody].dEccX; } void WriteBodyEccY(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, double *dTmp, - char cUnit[]) { + char **cUnit) { *dTmp = body[iBody].dEccY; } void WriteBodyEccZ(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, double *dTmp, - char cUnit[]) { + char **cUnit) { *dTmp = body[iBody].dEccZ; } void WriteBodyAngMX(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, - double *dTmp, char cUnit[]) { + double *dTmp, char **cUnit) { *dTmp = body[iBody].dAngMX; } void WriteBodyAngMY(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, - double *dTmp, char cUnit[]) { + double *dTmp, char **cUnit) { *dTmp = body[iBody].dAngMY; } void WriteBodyAngMZ(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, - double *dTmp, char cUnit[]) { + double *dTmp, char **cUnit) { *dTmp = body[iBody].dAngMZ; } @@ -1470,28 +1470,28 @@ void WriteBodyAngMZ(BODY *body, CONTROL *control, OUTPUT *output, void WriteNEncounters(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, - double *dTmp, char cUnit[]) { + double *dTmp, char **cUnit) { *dTmp = (double)system->iNEncounters; } void WriteNBadImpulse(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, - double *dTmp, char cUnit[]) { + double *dTmp, char **cUnit) { *dTmp = (double)body[iBody].iBadImpulse; } void WriteFVelDisp(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, double *dTmp, - char cUnit[]) { + char **cUnit) { *dTmp = system->dScalingFVelDisp; } void WriteDEccDtGalHTidal(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, - int iBody, double *dTmp, char cUnit[]) { + int iBody, double *dTmp, char **cUnit) { double dex, dey, dez; if (body[iBody].bGalacTides) { @@ -1509,7 +1509,7 @@ void WriteDEccDtGalHTidal(BODY *body, CONTROL *control, OUTPUT *output, if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { *dTmp *= fdUnitsTime(units->iTime); fsUnitsRate(units->iTime, cUnit); @@ -1518,7 +1518,7 @@ void WriteDEccDtGalHTidal(BODY *body, CONTROL *control, OUTPUT *output, void WriteDIncDtGalHTidal(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, - int iBody, double *dTmp, char cUnit[]) { + int iBody, double *dTmp, char **cUnit) { double dhx, dhy, dhz, qx, qy, qz; if (body[iBody].bGalacTides) { @@ -1553,7 +1553,7 @@ void WriteDIncDtGalHTidal(BODY *body, CONTROL *control, OUTPUT *output, if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { *dTmp *= fdUnitsTime(units->iTime); *dTmp /= fdUnitsAngle(units->iAngle); @@ -1563,7 +1563,7 @@ void WriteDIncDtGalHTidal(BODY *body, CONTROL *control, OUTPUT *output, void WriteDLongADtGalHTidal(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, - int iBody, double *dTmp, char cUnit[]) { + int iBody, double *dTmp, char **cUnit) { double dhx, dhy, dhz, qx, qy, qz; if (body[iBody].bGalacTides) { @@ -1598,7 +1598,7 @@ void WriteDLongADtGalHTidal(BODY *body, CONTROL *control, OUTPUT *output, if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { *dTmp *= fdUnitsTime(units->iTime); *dTmp /= fdUnitsAngle(units->iAngle); @@ -1608,7 +1608,7 @@ void WriteDLongADtGalHTidal(BODY *body, CONTROL *control, OUTPUT *output, void WriteDArgPDtGalHTidal(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, - int iBody, double *dTmp, char cUnit[]) { + int iBody, double *dTmp, char **cUnit) { double dex, dey, dez, dhx, dhy, dhz, qx, qy, qz, dLAdt, dedt; if (body[iBody].bGalacTides) { @@ -1651,7 +1651,7 @@ void WriteDArgPDtGalHTidal(BODY *body, CONTROL *control, OUTPUT *output, if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { *dTmp *= fdUnitsTime(units->iTime); *dTmp /= fdUnitsAngle(units->iAngle); @@ -1661,121 +1661,121 @@ void WriteDArgPDtGalHTidal(BODY *body, CONTROL *control, OUTPUT *output, void InitializeOutputGalHabit(OUTPUT *output, fnWriteOutput fnWrite[]) { - sprintf(output[OUT_PERIQ].cName, "PeriQ"); - sprintf(output[OUT_PERIQ].cDescr, "Pericenter distance"); - sprintf(output[OUT_PERIQ].cNeg, "AU"); + fvFormattedString(&output[OUT_PERIQ].cName, "PeriQ"); + fvFormattedString(&output[OUT_PERIQ].cDescr, "Pericenter distance"); + fvFormattedString(&output[OUT_PERIQ].cNeg, "AU"); output[OUT_PERIQ].bNeg = 1; output[OUT_PERIQ].dNeg = 1. / AUM; output[OUT_PERIQ].iNum = 1; output[OUT_PERIQ].iModuleBit = GALHABIT; fnWrite[OUT_PERIQ] = &WriteBodyPeriQ; - sprintf(output[OUT_ECCX].cName, "EccX"); - sprintf(output[OUT_ECCX].cDescr, "X component of ecc vector"); - sprintf(output[OUT_ECCX].cNeg, " "); + fvFormattedString(&output[OUT_ECCX].cName, "EccX"); + fvFormattedString(&output[OUT_ECCX].cDescr, "X component of ecc vector"); + fvFormattedString(&output[OUT_ECCX].cNeg, " "); output[OUT_ECCX].bNeg = 0; output[OUT_ECCX].iNum = 1; output[OUT_ECCX].iModuleBit = GALHABIT; fnWrite[OUT_ECCX] = &WriteBodyEccX; - sprintf(output[OUT_ECCY].cName, "EccY"); - sprintf(output[OUT_ECCY].cDescr, "Y component of ecc vector"); - sprintf(output[OUT_ECCY].cNeg, " "); + fvFormattedString(&output[OUT_ECCY].cName, "EccY"); + fvFormattedString(&output[OUT_ECCY].cDescr, "Y component of ecc vector"); + fvFormattedString(&output[OUT_ECCY].cNeg, " "); output[OUT_ECCY].bNeg = 0; output[OUT_ECCY].iNum = 1; output[OUT_ECCY].iModuleBit = GALHABIT; fnWrite[OUT_ECCY] = &WriteBodyEccY; - sprintf(output[OUT_ECCZ].cName, "EccZ"); - sprintf(output[OUT_ECCZ].cDescr, "Z component of ecc vector"); - sprintf(output[OUT_ECCZ].cNeg, " "); + fvFormattedString(&output[OUT_ECCZ].cName, "EccZ"); + fvFormattedString(&output[OUT_ECCZ].cDescr, "Z component of ecc vector"); + fvFormattedString(&output[OUT_ECCZ].cNeg, " "); output[OUT_ECCZ].bNeg = 0; output[OUT_ECCZ].iNum = 1; output[OUT_ECCZ].iModuleBit = GALHABIT; fnWrite[OUT_ECCZ] = &WriteBodyEccZ; - sprintf(output[OUT_ANGMX].cName, "AngMX"); - sprintf(output[OUT_ANGMX].cDescr, "X component of angular mom vector"); - sprintf(output[OUT_ANGMX].cNeg, " "); + fvFormattedString(&output[OUT_ANGMX].cName, "AngMX"); + fvFormattedString(&output[OUT_ANGMX].cDescr, "X component of angular mom vector"); + fvFormattedString(&output[OUT_ANGMX].cNeg, " "); output[OUT_ANGMX].bNeg = 0; output[OUT_ANGMX].iNum = 1; output[OUT_ANGMX].iModuleBit = GALHABIT; fnWrite[OUT_ANGMX] = &WriteBodyAngMX; - sprintf(output[OUT_ANGMY].cName, "AngMY"); - sprintf(output[OUT_ANGMY].cDescr, "Y component of angular mom vector"); - sprintf(output[OUT_ANGMY].cNeg, " "); + fvFormattedString(&output[OUT_ANGMY].cName, "AngMY"); + fvFormattedString(&output[OUT_ANGMY].cDescr, "Y component of angular mom vector"); + fvFormattedString(&output[OUT_ANGMY].cNeg, " "); output[OUT_ANGMY].bNeg = 0; output[OUT_ANGMY].iNum = 1; output[OUT_ANGMY].iModuleBit = GALHABIT; fnWrite[OUT_ANGMY] = &WriteBodyAngMY; - sprintf(output[OUT_ANGMZ].cName, "AngMZ"); - sprintf(output[OUT_ANGMZ].cDescr, "Z component of angular mom vector"); - sprintf(output[OUT_ANGMZ].cNeg, " "); + fvFormattedString(&output[OUT_ANGMZ].cName, "AngMZ"); + fvFormattedString(&output[OUT_ANGMZ].cDescr, "Z component of angular mom vector"); + fvFormattedString(&output[OUT_ANGMZ].cNeg, " "); output[OUT_ANGMZ].bNeg = 0; output[OUT_ANGMZ].iNum = 1; output[OUT_ANGMZ].iModuleBit = GALHABIT; fnWrite[OUT_ANGMZ] = &WriteBodyAngMZ; - sprintf(output[OUT_NENCOUNTERS].cName, "NEncounters"); - sprintf(output[OUT_NENCOUNTERS].cDescr, + fvFormattedString(&output[OUT_NENCOUNTERS].cName, "NEncounters"); + fvFormattedString(&output[OUT_NENCOUNTERS].cDescr, "cumulative number of stellar encounters"); - sprintf(output[OUT_NENCOUNTERS].cNeg, " "); + fvFormattedString(&output[OUT_NENCOUNTERS].cNeg, " "); output[OUT_NENCOUNTERS].bNeg = 0; output[OUT_NENCOUNTERS].iNum = 1; output[OUT_NENCOUNTERS].iModuleBit = GALHABIT; fnWrite[OUT_NENCOUNTERS] = &WriteNEncounters; - sprintf(output[OUT_NBADIMPULSE].cName, "NBadImpulse"); - sprintf(output[OUT_NBADIMPULSE].cDescr, + fvFormattedString(&output[OUT_NBADIMPULSE].cName, "NBadImpulse"); + fvFormattedString(&output[OUT_NBADIMPULSE].cDescr, "cumulative number of questionable encounters"); - sprintf(output[OUT_NBADIMPULSE].cNeg, " "); + fvFormattedString(&output[OUT_NBADIMPULSE].cNeg, " "); output[OUT_NBADIMPULSE].bNeg = 0; output[OUT_NBADIMPULSE].iNum = 1; output[OUT_NBADIMPULSE].iModuleBit = GALHABIT; fnWrite[OUT_NBADIMPULSE] = &WriteNBadImpulse; - sprintf(output[OUT_FVELDISP].cName, "FVelDisp"); - sprintf(output[OUT_FVELDISP].cDescr, + fvFormattedString(&output[OUT_FVELDISP].cName, "FVelDisp"); + fvFormattedString(&output[OUT_FVELDISP].cDescr, "Scaling factor for velocity dispersion"); - sprintf(output[OUT_FVELDISP].cNeg, " "); + fvFormattedString(&output[OUT_FVELDISP].cNeg, " "); output[OUT_FVELDISP].bNeg = 0; output[OUT_FVELDISP].iNum = 1; output[OUT_FVELDISP].iModuleBit = GALHABIT; fnWrite[OUT_FVELDISP] = &WriteFVelDisp; - sprintf(output[OUT_DECCDTGALHTIDAL].cName, "DEccDtGalHTidal"); - sprintf(output[OUT_DECCDTGALHTIDAL].cDescr, + fvFormattedString(&output[OUT_DECCDTGALHTIDAL].cName, "DEccDtGalHTidal"); + fvFormattedString(&output[OUT_DECCDTGALHTIDAL].cDescr, "Body's tidal decc/dt in GalHabit"); - sprintf(output[OUT_DECCDTGALHTIDAL].cNeg, "1/year"); + fvFormattedString(&output[OUT_DECCDTGALHTIDAL].cNeg, "1/year"); output[OUT_DECCDTGALHTIDAL].bNeg = 1; output[OUT_DECCDTGALHTIDAL].dNeg = YEARSEC; output[OUT_DECCDTGALHTIDAL].iModuleBit = GALHABIT; fnWrite[OUT_DECCDTGALHTIDAL] = &WriteDEccDtGalHTidal; - sprintf(output[OUT_DINCDTGALHTIDAL].cName, "DIncDtGalHTidal"); - sprintf(output[OUT_DINCDTGALHTIDAL].cDescr, + fvFormattedString(&output[OUT_DINCDTGALHTIDAL].cName, "DIncDtGalHTidal"); + fvFormattedString(&output[OUT_DINCDTGALHTIDAL].cDescr, "Body's tidal dinc/dt in GalHabit"); - sprintf(output[OUT_DINCDTGALHTIDAL].cNeg, "1/year"); + fvFormattedString(&output[OUT_DINCDTGALHTIDAL].cNeg, "1/year"); output[OUT_DINCDTGALHTIDAL].bNeg = 1; output[OUT_DINCDTGALHTIDAL].dNeg = YEARSEC / DEGRAD; output[OUT_DINCDTGALHTIDAL].iModuleBit = GALHABIT; fnWrite[OUT_DINCDTGALHTIDAL] = &WriteDIncDtGalHTidal; - sprintf(output[OUT_DARGPDTGALHTIDAL].cName, "DArgPDtGalHTidal"); - sprintf(output[OUT_DARGPDTGALHTIDAL].cDescr, + fvFormattedString(&output[OUT_DARGPDTGALHTIDAL].cName, "DArgPDtGalHTidal"); + fvFormattedString(&output[OUT_DARGPDTGALHTIDAL].cDescr, "Body's tidal dargp/dt in GalHabit"); - sprintf(output[OUT_DARGPDTGALHTIDAL].cNeg, "1/year"); + fvFormattedString(&output[OUT_DARGPDTGALHTIDAL].cNeg, "1/year"); output[OUT_DARGPDTGALHTIDAL].bNeg = 1; output[OUT_DARGPDTGALHTIDAL].dNeg = YEARSEC / DEGRAD; output[OUT_DARGPDTGALHTIDAL].iModuleBit = GALHABIT; fnWrite[OUT_DARGPDTGALHTIDAL] = &WriteDArgPDtGalHTidal; - sprintf(output[OUT_DLONGADTGALHTIDAL].cName, "DLongADtGalHTidal"); - sprintf(output[OUT_DLONGADTGALHTIDAL].cDescr, + fvFormattedString(&output[OUT_DLONGADTGALHTIDAL].cName, "DLongADtGalHTidal"); + fvFormattedString(&output[OUT_DLONGADTGALHTIDAL].cDescr, "Body's tidal dlonga/dt in GalHabit"); - sprintf(output[OUT_DLONGADTGALHTIDAL].cNeg, "1/year"); + fvFormattedString(&output[OUT_DLONGADTGALHTIDAL].cNeg, "1/year"); output[OUT_DLONGADTGALHTIDAL].bNeg = 1; output[OUT_DLONGADTGALHTIDAL].dNeg = YEARSEC / DEGRAD; output[OUT_DLONGADTGALHTIDAL].iModuleBit = GALHABIT; @@ -1897,7 +1897,7 @@ void ForceBehaviorGalHabit(BODY *body, MODULE *module, EVOLVE *evolve, IO *io, int iModule) { double dp, dkzi, dVMax, dCurrentAge, dMeanATmp, C; double sinw, cosw, cosw_alt, sign; - char cOut[3 * NAMELEN]; + char *cOut; int idr; FILE *fOut; @@ -2015,7 +2015,7 @@ void ForceBehaviorGalHabit(BODY *body, MODULE *module, EVOLVE *evolve, IO *io, /* write out encounter info */ if (system->bOutputEnc) { - sprintf(cOut, "%s.%s.Encounters", system->cName, body[iBody].cName); + fvFormattedString(&cOut, "%s.%s.Encounters", system->cName, body[iBody].cName); fOut = fopen(cOut, "a"); // fprintf(fOut,"#time MV mass sigma impx impy impz u_s v_s w_s u_r v_r // w_r u_sun v_sun w_sun Rx Ry Rz\n"); @@ -2809,12 +2809,12 @@ void NextEncounterTime(SYSTEM *system, EVOLVE *evolve, double dTime) { } void testrand(SYSTEM *system) { - char cOut[NAMELEN]; + char *cOut; FILE *fOut; double n = 0, m, y = 100; int i; - sprintf(cOut, "randoms"); + fvFormattedString(&cOut, "randoms"); fOut = fopen(cOut, "w"); for (i = 0; i <= 100000; i++) { diff --git a/src/galhabit.h b/src/galhabit.h index 20b1d60f8..8a49e326a 100644 --- a/src/galhabit.h +++ b/src/galhabit.h @@ -91,31 +91,31 @@ void FinalizeUpdatePeriQGalHabit(BODY *, UPDATE *, int *, int, int, int); void FinalizeUpdateArgPGalHabit(BODY *, UPDATE *, int *, int, int, int); void FinalizeUpdateIncGalHabit(BODY *, UPDATE *, int *, int, int, int); void FinalizeUpdateLongAGalHabit(BODY *, UPDATE *, int *, int, int, int); - +void InitializeOutputGalHabit(OUTPUT *, fnWriteOutput[]); void HelpOutputGalHabit(OUTPUT *); + void WriteBodyPeriQ(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, UPDATE *, - int, double *, char[]); + int, double *, char**); void WriteDEccDtGalHTidal(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, - UPDATE *, int, double *, char[]); + UPDATE *, int, double *, char**); void WriteDIncDtGalHTidal(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, - UPDATE *, int, double *, char[]); + UPDATE *, int, double *, char**); void WriteDArgPDtGalHTidal(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, - UPDATE *, int, double *, char[]); + UPDATE *, int, double *, char**); void WriteDLongADtGalHTidal(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, - UPDATE *, int, double *, char[]); -void InitializeOutputGalHabit(OUTPUT *, fnWriteOutput[]); + UPDATE *, int, double *, char**); void WriteBodyEccX(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, UPDATE *, - int, double *, char[]); + int, double *, char**); void WriteBodyEccY(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, UPDATE *, - int, double *, char[]); + int, double *, char**); void WriteBodyEccZ(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, UPDATE *, - int, double *, char[]); + int, double *, char**); void WriteBodyAngMX(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, UPDATE *, - int, double *, char[]); + int, double *, char**); void WriteBodyAngMY(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, UPDATE *, - int, double *, char[]); + int, double *, char**); void WriteBodyAngMZ(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, UPDATE *, - int, double *, char[]); + int, double *, char**); /* Logging Functions */ void LogOptionsGalHabit(CONTROL *, FILE *); diff --git a/src/magmoc.c b/src/magmoc.c index b709939f4..cea343cf5 100644 --- a/src/magmoc.c +++ b/src/magmoc.c @@ -493,171 +493,171 @@ void InitializeOptionsMagmOc(OPTIONS *options, fnReadOption fnRead[]) { /* FeO */ - sprintf(options[OPT_FEO].cName, "dMassFracFeOIni"); // name of the variable - sprintf(options[OPT_FEO].cDescr, + fvFormattedString(&options[OPT_FEO].cName, "dMassFracFeOIni"); // name of the variable + fvFormattedString(&options[OPT_FEO].cDescr, "Initial Mass Fraction of FeO in the " "mantle"); // description that will be shown for vplanet -h - sprintf(options[OPT_FEO].cDefault, + fvFormattedString(&options[OPT_FEO].cDefault, "BSE Earth: 0.0788"); // comment what the default value will be - sprintf(options[OPT_FEO].cDimension, "nd"); + fvFormattedString(&options[OPT_FEO].cDimension, "nd"); options[OPT_FEO].iType = 2; // type of the variable: double?? options[OPT_FEO].bMultiFile = 1; // can it be used in multiple files? 1 = yes options[OPT_FEO].dNeg = 1; // is there a unit other than the SI unit? factor // to convert between both units options[OPT_FEO].dDefault = 0.0788; // default value - sprintf(options[OPT_FEO].cNeg, "no unit"); // specify unit (for help) + fvFormattedString(&options[OPT_FEO].cNeg, "no unit"); // specify unit (for help) fnRead[OPT_FEO] = &ReadMassFracFeOIni; // link read function from above /* Water */ // XXX This probably overlaps with dSurfWaterMass in AtmEsc - sprintf(options[OPT_WATERMASSATM].cName, "dWaterMassAtm"); - sprintf(options[OPT_WATERMASSATM].cDescr, + fvFormattedString(&options[OPT_WATERMASSATM].cName, "dWaterMassAtm"); + fvFormattedString(&options[OPT_WATERMASSATM].cDescr, "Initial Water Mass in the atmosphere"); - sprintf(options[OPT_WATERMASSATM].cDefault, "1 Terrestrial Ocean"); - sprintf(options[OPT_WATERMASSATM].cDimension, "mass"); + fvFormattedString(&options[OPT_WATERMASSATM].cDefault, "1 Terrestrial Ocean"); + fvFormattedString(&options[OPT_WATERMASSATM].cDimension, "mass"); options[OPT_WATERMASSATM].iType = 2; options[OPT_WATERMASSATM].bMultiFile = 1; options[OPT_WATERMASSATM].dNeg = TOMASS; // for input: factor to mulitply for SI - for output: divide // (e.g. 1/TOMASS) options[OPT_WATERMASSATM].dDefault = TOMASS; - sprintf(options[OPT_WATERMASSATM].cNeg, "TO"); + fvFormattedString(&options[OPT_WATERMASSATM].cNeg, "TO"); fnRead[OPT_WATERMASSATM] = &ReadWaterMassAtm; /* CO2 */ - sprintf(options[OPT_CO2MASSMOATM].cName, "dCO2MassMOAtm"); - sprintf(options[OPT_CO2MASSMOATM].cDescr, "Initial CO2 mass in the system"); - sprintf(options[OPT_CO2MASSMOATM].cDefault, "0 TO"); - sprintf(options[OPT_CO2MASSMOATM].cDimension, "mass"); + fvFormattedString(&options[OPT_CO2MASSMOATM].cName, "dCO2MassMOAtm"); + fvFormattedString(&options[OPT_CO2MASSMOATM].cDescr, "Initial CO2 mass in the system"); + fvFormattedString(&options[OPT_CO2MASSMOATM].cDefault, "0 TO"); + fvFormattedString(&options[OPT_CO2MASSMOATM].cDimension, "mass"); options[OPT_CO2MASSMOATM].iType = 2; options[OPT_CO2MASSMOATM].bMultiFile = 1; options[OPT_CO2MASSMOATM].dNeg = TOMASS; // for input: factor to mulitply for SI - for output: divide // (e.g. 1/TOMASS) options[OPT_CO2MASSMOATM].dDefault = 0; - sprintf(options[OPT_CO2MASSMOATM].cNeg, "TO"); + fvFormattedString(&options[OPT_CO2MASSMOATM].cNeg, "TO"); fnRead[OPT_CO2MASSMOATM] = &ReadCO2MassMOAtm; /* Temperature */ - sprintf(options[OPT_SURFTEMP].cName, "dSurfTemp"); - sprintf(options[OPT_SURFTEMP].cDescr, "Initial surface temp"); - sprintf(options[OPT_SURFTEMP].cDefault, "4000 K"); - sprintf(options[OPT_SURFTEMP].cDimension, "temperature"); + fvFormattedString(&options[OPT_SURFTEMP].cName, "dSurfTemp"); + fvFormattedString(&options[OPT_SURFTEMP].cDescr, "Initial surface temp"); + fvFormattedString(&options[OPT_SURFTEMP].cDefault, "4000 K"); + fvFormattedString(&options[OPT_SURFTEMP].cDimension, "temperature"); options[OPT_SURFTEMP].iType = 2; options[OPT_SURFTEMP].bMultiFile = 1; options[OPT_SURFTEMP].dNeg = 1; options[OPT_SURFTEMP].dDefault = 4000; - sprintf(options[OPT_SURFTEMP].cNeg, "Kelvin"); + fvFormattedString(&options[OPT_SURFTEMP].cNeg, "Kelvin"); fnRead[OPT_SURFTEMP] = &ReadSurfTemp; /* Density */ - sprintf(options[OPT_MANMELTDENSITY].cName, "dManMeltDensity"); - sprintf(options[OPT_MANMELTDENSITY].cDescr, "Density of the molten mantle"); - sprintf(options[OPT_MANMELTDENSITY].cDefault, "4000 kg/m^3"); - sprintf(options[OPT_MANMELTDENSITY].cDimension, "mass/length^3"); + fvFormattedString(&options[OPT_MANMELTDENSITY].cName, "dManMeltDensity"); + fvFormattedString(&options[OPT_MANMELTDENSITY].cDescr, "Density of the molten mantle"); + fvFormattedString(&options[OPT_MANMELTDENSITY].cDefault, "4000 kg/m^3"); + fvFormattedString(&options[OPT_MANMELTDENSITY].cDimension, "mass/length^3"); options[OPT_MANMELTDENSITY].iType = 2; options[OPT_MANMELTDENSITY].bMultiFile = 1; options[OPT_MANMELTDENSITY].dNeg = 1; options[OPT_MANMELTDENSITY].dDefault = 4000; - sprintf(options[OPT_MANMELTDENSITY].cNeg, "kg/m^3"); + fvFormattedString(&options[OPT_MANMELTDENSITY].cNeg, "kg/m^3"); fnRead[OPT_MANMELTDENSITY] = &ReadManMeltDensity; /* Water partition coefficient */ - sprintf(options[OPT_WATERPARTCOEFF].cName, "dWaterPartCoeff"); - sprintf(options[OPT_WATERPARTCOEFF].cDescr, + fvFormattedString(&options[OPT_WATERPARTCOEFF].cName, "dWaterPartCoeff"); + fvFormattedString(&options[OPT_WATERPARTCOEFF].cDescr, "Water partition coefficient between melt and solid"); - sprintf(options[OPT_WATERPARTCOEFF].cDefault, "0.01"); - sprintf(options[OPT_WATERPARTCOEFF].cDimension, "nd"); + fvFormattedString(&options[OPT_WATERPARTCOEFF].cDefault, "0.01"); + fvFormattedString(&options[OPT_WATERPARTCOEFF].cDimension, "nd"); options[OPT_WATERPARTCOEFF].iType = 2; options[OPT_WATERPARTCOEFF].bMultiFile = 1; options[OPT_WATERPARTCOEFF].dNeg = 1; options[OPT_WATERPARTCOEFF].dDefault = 0.01; - sprintf(options[OPT_WATERPARTCOEFF].cNeg, "no unit"); + fvFormattedString(&options[OPT_WATERPARTCOEFF].cNeg, "no unit"); fnRead[OPT_WATERPARTCOEFF] = &ReadWaterPartCoeff; /* Magma Ocean Depth */ - sprintf(options[OPT_DEPTHMO].cName, "dDepthMO"); - sprintf(options[OPT_DEPTHMO].cDescr, "Initial depth of the magma ocean"); - sprintf(options[OPT_DEPTHMO].cDefault, "core radius"); - sprintf(options[OPT_DEPTHMO].cDimension, "length"); + fvFormattedString(&options[OPT_DEPTHMO].cName, "dDepthMO"); + fvFormattedString(&options[OPT_DEPTHMO].cDescr, "Initial depth of the magma ocean"); + fvFormattedString(&options[OPT_DEPTHMO].cDefault, "core radius"); + fvFormattedString(&options[OPT_DEPTHMO].cDimension, "length"); options[OPT_DEPTHMO].iType = 2; options[OPT_DEPTHMO].bMultiFile = 1; options[OPT_DEPTHMO].dNeg = 1e3; options[OPT_DEPTHMO].dDefault = 1e6; - sprintf(options[OPT_DEPTHMO].cNeg, "km"); + fvFormattedString(&options[OPT_DEPTHMO].cNeg, "km"); fnRead[OPT_DEPTHMO] = &ReadDepthMO; /* Halts */ - sprintf(options[OPT_HALTMANTLESOLIDIFIED].cName, "bHaltMantleSolidified"); - sprintf(options[OPT_HALTMANTLESOLIDIFIED].cDescr, + fvFormattedString(&options[OPT_HALTMANTLESOLIDIFIED].cName, "bHaltMantleSolidified"); + fvFormattedString(&options[OPT_HALTMANTLESOLIDIFIED].cDescr, "Halt when mantle solidified?"); - sprintf(options[OPT_HALTMANTLESOLIDIFIED].cDefault, "0"); + fvFormattedString(&options[OPT_HALTMANTLESOLIDIFIED].cDefault, "0"); options[OPT_HALTMANTLESOLIDIFIED].iType = 0; fnRead[OPT_HALTMANTLESOLIDIFIED] = &ReadHaltMantleSolidified; - sprintf(options[OPT_HALTMANTLEMELTFRACLOW].cName, "bHaltMantleMeltFracLow"); - sprintf(options[OPT_HALTMANTLEMELTFRACLOW].cDescr, + fvFormattedString(&options[OPT_HALTMANTLEMELTFRACLOW].cName, "bHaltMantleMeltFracLow"); + fvFormattedString(&options[OPT_HALTMANTLEMELTFRACLOW].cDescr, "Halt when mantle mostly solidified?"); - sprintf(options[OPT_HALTMANTLEMELTFRACLOW].cDefault, "0"); + fvFormattedString(&options[OPT_HALTMANTLEMELTFRACLOW].cDefault, "0"); options[OPT_HALTMANTLEMELTFRACLOW].iType = 0; fnRead[OPT_HALTMANTLEMELTFRACLOW] = &ReadHaltMantleMeltFracLow; - sprintf(options[OPT_HALTATMDESISRUFCOOL].cName, "bHaltAtmDesiSurfCool"); - sprintf(options[OPT_HALTATMDESISRUFCOOL].cDescr, + fvFormattedString(&options[OPT_HALTATMDESISRUFCOOL].cName, "bHaltAtmDesiSurfCool"); + fvFormattedString(&options[OPT_HALTATMDESISRUFCOOL].cDescr, "Halt when atmosphere desiccated and surface below 1000K?"); - sprintf(options[OPT_HALTATMDESISRUFCOOL].cDefault, "0"); + fvFormattedString(&options[OPT_HALTATMDESISRUFCOOL].cDefault, "0"); options[OPT_HALTATMDESISRUFCOOL].iType = 0; fnRead[OPT_HALTATMDESISRUFCOOL] = &ReadHaltAtmDesiSurfCool; - sprintf(options[OPT_HALTENTERHABZONE].cName, "bHaltEnterHabZone"); - sprintf(options[OPT_HALTENTERHABZONE].cDescr, + fvFormattedString(&options[OPT_HALTENTERHABZONE].cName, "bHaltEnterHabZone"); + fvFormattedString(&options[OPT_HALTENTERHABZONE].cDescr, "Halt when planet enters habitable zone?"); - sprintf(options[OPT_HALTENTERHABZONE].cDefault, "0"); + fvFormattedString(&options[OPT_HALTENTERHABZONE].cDefault, "0"); options[OPT_HALTENTERHABZONE].iType = 0; fnRead[OPT_HALTENTERHABZONE] = &ReadHaltEnterHabZone; - sprintf(options[OPT_HALTALLPLANETSSOLID].cName, "bHaltAllPlanetsSolid"); - sprintf(options[OPT_HALTALLPLANETSSOLID].cDescr, + fvFormattedString(&options[OPT_HALTALLPLANETSSOLID].cName, "bHaltAllPlanetsSolid"); + fvFormattedString(&options[OPT_HALTALLPLANETSSOLID].cDescr, "Halt when all planets solidified?"); - sprintf(options[OPT_HALTALLPLANETSSOLID].cDefault, "0"); + fvFormattedString(&options[OPT_HALTALLPLANETSSOLID].cDefault, "0"); options[OPT_HALTALLPLANETSSOLID].iType = 0; fnRead[OPT_HALTALLPLANETSSOLID] = &ReadHaltAllPlanetsSolid; // XXX Overlap with bHaltSurfaceDesiccated in AtmEsc - sprintf(options[OPT_HALTALLPLANETSDESICC].cName, "bHaltAllPlanetsDesicc"); - sprintf(options[OPT_HALTALLPLANETSDESICC].cDescr, + fvFormattedString(&options[OPT_HALTALLPLANETSDESICC].cName, "bHaltAllPlanetsDesicc"); + fvFormattedString(&options[OPT_HALTALLPLANETSDESICC].cDescr, "Halt when all planets desiccated?"); - sprintf(options[OPT_HALTALLPLANETSDESICC].cDefault, "0"); + fvFormattedString(&options[OPT_HALTALLPLANETSDESICC].cDefault, "0"); options[OPT_HALTALLPLANETSDESICC].iType = 0; fnRead[OPT_HALTALLPLANETSDESICC] = &ReadHaltAllPlanetsDesicc; /* Model options */ - sprintf(options[OPT_RADIOHEATMODEL].cName, "sRadioHeatModel"); - sprintf(options[OPT_RADIOHEATMODEL].cDescr, "Radiogenic heating model"); - sprintf(options[OPT_RADIOHEATMODEL].cDefault, "NONE"); + fvFormattedString(&options[OPT_RADIOHEATMODEL].cName, "sRadioHeatModel"); + fvFormattedString(&options[OPT_RADIOHEATMODEL].cDescr, "Radiogenic heating model"); + fvFormattedString(&options[OPT_RADIOHEATMODEL].cDefault, "NONE"); options[OPT_RADIOHEATMODEL].iType = 3; options[OPT_RADIOHEATMODEL].bMultiFile = 1; fnRead[OPT_RADIOHEATMODEL] = &ReadRadioHeatModel; - sprintf(options[OPT_MAGMOCATMMODEL].cName, "sMagmOcAtmModel"); - sprintf(options[OPT_MAGMOCATMMODEL].cDescr, + fvFormattedString(&options[OPT_MAGMOCATMMODEL].cName, "sMagmOcAtmModel"); + fvFormattedString(&options[OPT_MAGMOCATMMODEL].cDescr, "Atmospheric flux model: Grey or Petit"); - sprintf(options[OPT_MAGMOCATMMODEL].cDefault, "GREY"); + fvFormattedString(&options[OPT_MAGMOCATMMODEL].cDefault, "GREY"); options[OPT_MAGMOCATMMODEL].iType = 3; options[OPT_MAGMOCATMMODEL].bMultiFile = 1; fnRead[OPT_MAGMOCATMMODEL] = &ReadMagmOcAtmModel; - sprintf(options[OPT_MANQUASISOL].cName, "bOptManQuasiSol"); - sprintf(options[OPT_MANQUASISOL].cDescr, "Solidify when melt frac = 0.4?"); - sprintf(options[OPT_MANQUASISOL].cDefault, "0"); + fvFormattedString(&options[OPT_MANQUASISOL].cName, "bOptManQuasiSol"); + fvFormattedString(&options[OPT_MANQUASISOL].cDescr, "Solidify when melt frac = 0.4?"); + fvFormattedString(&options[OPT_MANQUASISOL].cDefault, "0"); options[OPT_MANQUASISOL].iType = 0; options[OPT_MANQUASISOL].bMultiFile = 1; fnRead[OPT_MANQUASISOL] = &ReadMantleQuasiSolid; @@ -2212,11 +2212,11 @@ void VerifyHaltMagmOc(BODY *body, CONTROL *control, OPTIONS *options, int iBody, void WritePotTemp(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, double *dTmp, - char cUnit[]) { + char **cUnit) { *dTmp = body[iBody].dPotTemp; if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { *dTmp /= fdUnitsTemp(units->iTemp, 1, 0); fsUnitsTemp(units->iTemp, cUnit); @@ -2225,11 +2225,11 @@ void WritePotTemp(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, void WriteSurfTemp(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, double *dTmp, - char cUnit[]) { + char **cUnit) { *dTmp = body[iBody].dSurfTemp; if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { *dTmp /= fdUnitsTemp(units->iTemp, 1, 0); fsUnitsTemp(units->iTemp, cUnit); @@ -2238,11 +2238,11 @@ void WriteSurfTemp(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, void WriteSolidRadius(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, - double *dTmp, char cUnit[]) { + double *dTmp, char **cUnit) { *dTmp = body[iBody].dSolidRadius; if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { *dTmp /= fdUnitsLength(units->iLength); fsUnitsLength(units->iLength, cUnit); @@ -2251,11 +2251,11 @@ void WriteSolidRadius(BODY *body, CONTROL *control, OUTPUT *output, void WriteWaterMassMOAtm(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, - int iBody, double *dTmp, char cUnit[]) { + int iBody, double *dTmp, char **cUnit) { *dTmp = body[iBody].dWaterMassMOAtm; if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { *dTmp /= fdUnitsMass(units->iMass); fsUnitsMass(units->iMass, cUnit); @@ -2264,11 +2264,11 @@ void WriteWaterMassMOAtm(BODY *body, CONTROL *control, OUTPUT *output, void WriteWaterMassSol(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, - double *dTmp, char cUnit[]) { + double *dTmp, char **cUnit) { *dTmp = body[iBody].dWaterMassSol; if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { *dTmp /= fdUnitsMass(units->iMass); fsUnitsMass(units->iMass, cUnit); @@ -2277,11 +2277,11 @@ void WriteWaterMassSol(BODY *body, CONTROL *control, OUTPUT *output, void WriteCO2MassMOAtm(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, - double *dTmp, char cUnit[]) { + double *dTmp, char **cUnit) { *dTmp = body[iBody].dCO2MassMOAtm; if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { *dTmp /= fdUnitsMass(units->iMass); fsUnitsMass(units->iMass, cUnit); @@ -2290,11 +2290,11 @@ void WriteCO2MassMOAtm(BODY *body, CONTROL *control, OUTPUT *output, void WriteCO2MassSol(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, - double *dTmp, char cUnit[]) { + double *dTmp, char **cUnit) { *dTmp = body[iBody].dCO2MassSol; if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { *dTmp /= fdUnitsMass(units->iMass); fsUnitsMass(units->iMass, cUnit); @@ -2303,11 +2303,11 @@ void WriteCO2MassSol(BODY *body, CONTROL *control, OUTPUT *output, void WriteOxygenMassMOAtm(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, - int iBody, double *dTmp, char cUnit[]) { + int iBody, double *dTmp, char **cUnit) { *dTmp = body[iBody].dOxygenMassMOAtm; if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { *dTmp /= fdUnitsMass(units->iMass); fsUnitsMass(units->iMass, cUnit); @@ -2316,11 +2316,11 @@ void WriteOxygenMassMOAtm(BODY *body, CONTROL *control, OUTPUT *output, void WriteOxygenMassSol(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, - double *dTmp, char cUnit[]) { + double *dTmp, char **cUnit) { *dTmp = body[iBody].dOxygenMassSol; if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { *dTmp /= fdUnitsMass(units->iMass); fsUnitsMass(units->iMass, cUnit); @@ -2329,44 +2329,44 @@ void WriteOxygenMassSol(BODY *body, CONTROL *control, OUTPUT *output, void WritePressWaterAtm(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, - double *dTmp, char cUnit[]) { + double *dTmp, char **cUnit) { *dTmp = body[iBody].dPressWaterAtm; if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { } } void WritePressCO2Atm(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, - double *dTmp, char cUnit[]) { + double *dTmp, char **cUnit) { *dTmp = body[iBody].dPressCO2Atm; if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { } } void WritePressOxygenAtm(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, - int iBody, double *dTmp, char cUnit[]) { + int iBody, double *dTmp, char **cUnit) { *dTmp = body[iBody].dPressOxygenAtm; if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { } } void WriteHydrogenMassSpace(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, - int iBody, double *dTmp, char cUnit[]) { + int iBody, double *dTmp, char **cUnit) { *dTmp = body[iBody].dHydrogenMassSpace; if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { *dTmp /= fdUnitsMass(units->iMass); fsUnitsMass(units->iMass, cUnit); @@ -2375,11 +2375,11 @@ void WriteHydrogenMassSpace(BODY *body, CONTROL *control, OUTPUT *output, void WriteOxygenMassSpace(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, - int iBody, double *dTmp, char cUnit[]) { + int iBody, double *dTmp, char **cUnit) { *dTmp = body[iBody].dOxygenMassSpace; if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { *dTmp /= fdUnitsMass(units->iMass); fsUnitsMass(units->iMass, cUnit); @@ -2388,57 +2388,57 @@ void WriteOxygenMassSpace(BODY *body, CONTROL *control, OUTPUT *output, void WriteFracFe2O3Man(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, - double *dTmp, char cUnit[]) { + double *dTmp, char **cUnit) { *dTmp = body[iBody].dFracFe2O3Man; if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { } } void WriteNetFluxAtmo(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, - double *dTmp, char cUnit[]) { + double *dTmp, char **cUnit) { *dTmp = body[iBody].dNetFluxAtmo; if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { } } void WriteWaterFracMelt(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, - double *dTmp, char cUnit[]) { + double *dTmp, char **cUnit) { *dTmp = body[iBody].dWaterFracMelt; if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { } } void WriteCO2FracMelt(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, - double *dTmp, char cUnit[]) { + double *dTmp, char **cUnit) { *dTmp = body[iBody].dCO2FracMelt; if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { } } void WriteRadioPower(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, - double *dTmp, char cUnit[]) { + double *dTmp, char **cUnit) { *dTmp = body[iBody] .dRadioHeat; //* (4/3*PI*body[iBody].dManMeltDensity*(pow(body[iBody].dRadius,3)-pow(body[iBody].dCoreRadius,3))); if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { *dTmp /= fdUnitsPower(units->iTime, units->iMass, units->iLength); fsUnitsPower(units, cUnit); @@ -2447,13 +2447,13 @@ void WriteRadioPower(BODY *body, CONTROL *control, OUTPUT *output, void WriteTidalPower(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, - double *dTmp, char cUnit[]) { + double *dTmp, char **cUnit) { *dTmp = body[iBody] .dTidalHeat; // * (4/3*PI*body[iBody].dManMeltDensity*(pow(body[iBody].dRadius,3)-pow(body[iBody].dCoreRadius,3))); if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { *dTmp /= fdUnitsPower(units->iTime, units->iMass, units->iLength); fsUnitsPower(units, cUnit); @@ -2462,11 +2462,11 @@ void WriteTidalPower(BODY *body, CONTROL *control, OUTPUT *output, void WriteHZInnerEdge(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, - double *dTmp, char cUnit[]) { + double *dTmp, char **cUnit) { *dTmp = body[iBody].dHZInnerEdge; if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { *dTmp /= fdUnitsLength(units->iLength); fsUnitsLength(units->iLength, cUnit); @@ -2475,11 +2475,11 @@ void WriteHZInnerEdge(BODY *body, CONTROL *control, OUTPUT *output, void WriteMeltFraction(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, - double *dTmp, char cUnit[]) { + double *dTmp, char **cUnit) { *dTmp = body[iBody].dMeltFraction; if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { } } @@ -2487,9 +2487,9 @@ void WriteMeltFraction(BODY *body, CONTROL *control, OUTPUT *output, // similar to initialize options void InitializeOutputMagmOc(OUTPUT *output, fnWriteOutput fnWrite[]) { - sprintf(output[OUT_POTTEMP].cName, "PotTemp"); - sprintf(output[OUT_POTTEMP].cDescr, "Potential temperature magma ocean"); - sprintf(output[OUT_POTTEMP].cNeg, "K"); + fvFormattedString(&output[OUT_POTTEMP].cName, "PotTemp"); + fvFormattedString(&output[OUT_POTTEMP].cDescr, "Potential temperature magma ocean"); + fvFormattedString(&output[OUT_POTTEMP].cNeg, "K"); output[OUT_POTTEMP].bNeg = 1; output[OUT_POTTEMP].dNeg = 1; // division factor to get from SI to desired unit @@ -2497,9 +2497,9 @@ void InitializeOutputMagmOc(OUTPUT *output, fnWriteOutput fnWrite[]) { output[OUT_POTTEMP].iModuleBit = MAGMOC; // name of module fnWrite[OUT_POTTEMP] = &WritePotTemp; - sprintf(output[OUT_SURFTEMP].cName, "SurfTemp"); - sprintf(output[OUT_SURFTEMP].cDescr, "Surface temperature magma ocean"); - sprintf(output[OUT_SURFTEMP].cNeg, "K"); + fvFormattedString(&output[OUT_SURFTEMP].cName, "SurfTemp"); + fvFormattedString(&output[OUT_SURFTEMP].cDescr, "Surface temperature magma ocean"); + fvFormattedString(&output[OUT_SURFTEMP].cNeg, "K"); output[OUT_SURFTEMP].bNeg = 1; output[OUT_SURFTEMP].dNeg = 1; // division factor to get from SI to desired unit @@ -2507,10 +2507,10 @@ void InitializeOutputMagmOc(OUTPUT *output, fnWriteOutput fnWrite[]) { output[OUT_SURFTEMP].iModuleBit = MAGMOC; // name of module fnWrite[OUT_SURFTEMP] = &WriteSurfTemp; - sprintf(output[OUT_SOLIDRADIUS].cName, "SolidRadius"); - sprintf(output[OUT_SOLIDRADIUS].cDescr, + fvFormattedString(&output[OUT_SOLIDRADIUS].cName, "SolidRadius"); + fvFormattedString(&output[OUT_SOLIDRADIUS].cDescr, "Solidification radius of the mantle"); - sprintf(output[OUT_SOLIDRADIUS].cNeg, "Rearth"); + fvFormattedString(&output[OUT_SOLIDRADIUS].cNeg, "Rearth"); output[OUT_SOLIDRADIUS].bNeg = 1; output[OUT_SOLIDRADIUS].dNeg = 1 / REARTH; // division factor to get from SI to desired unit @@ -2518,10 +2518,10 @@ void InitializeOutputMagmOc(OUTPUT *output, fnWriteOutput fnWrite[]) { output[OUT_SOLIDRADIUS].iModuleBit = MAGMOC; // name of module fnWrite[OUT_SOLIDRADIUS] = &WriteSolidRadius; - sprintf(output[OUT_WATERMASSMOATM].cName, "WaterMassMOAtm"); - sprintf(output[OUT_WATERMASSMOATM].cDescr, + fvFormattedString(&output[OUT_WATERMASSMOATM].cName, "WaterMassMOAtm"); + fvFormattedString(&output[OUT_WATERMASSMOATM].cDescr, "Water mass in magma ocean and atmosphere"); - sprintf(output[OUT_WATERMASSMOATM].cNeg, "TO"); + fvFormattedString(&output[OUT_WATERMASSMOATM].cNeg, "TO"); output[OUT_WATERMASSMOATM].bNeg = 1; output[OUT_WATERMASSMOATM].dNeg = 1 / TOMASS; // division factor to get from SI to desired unit @@ -2529,9 +2529,9 @@ void InitializeOutputMagmOc(OUTPUT *output, fnWriteOutput fnWrite[]) { output[OUT_WATERMASSMOATM].iModuleBit = MAGMOC; // name of module fnWrite[OUT_WATERMASSMOATM] = &WriteWaterMassMOAtm; - sprintf(output[OUT_WATERMASSSOL].cName, "WaterMassSol"); - sprintf(output[OUT_WATERMASSSOL].cDescr, "Water mass in solidified mantle"); - sprintf(output[OUT_WATERMASSSOL].cNeg, "TO"); + fvFormattedString(&output[OUT_WATERMASSSOL].cName, "WaterMassSol"); + fvFormattedString(&output[OUT_WATERMASSSOL].cDescr, "Water mass in solidified mantle"); + fvFormattedString(&output[OUT_WATERMASSSOL].cNeg, "TO"); output[OUT_WATERMASSSOL].bNeg = 1; output[OUT_WATERMASSSOL].dNeg = 1 / TOMASS; // division factor to get from SI to desired unit @@ -2539,10 +2539,10 @@ void InitializeOutputMagmOc(OUTPUT *output, fnWriteOutput fnWrite[]) { output[OUT_WATERMASSSOL].iModuleBit = MAGMOC; // name of module fnWrite[OUT_WATERMASSSOL] = &WriteWaterMassSol; - sprintf(output[OUT_CO2MASSMOATM].cName, "CO2MassMOAtm"); - sprintf(output[OUT_CO2MASSMOATM].cDescr, + fvFormattedString(&output[OUT_CO2MASSMOATM].cName, "CO2MassMOAtm"); + fvFormattedString(&output[OUT_CO2MASSMOATM].cDescr, "CO2 mass in magma ocean and atmosphere"); - sprintf(output[OUT_CO2MASSMOATM].cNeg, "kg"); + fvFormattedString(&output[OUT_CO2MASSMOATM].cNeg, "kg"); output[OUT_CO2MASSMOATM].bNeg = 1; output[OUT_CO2MASSMOATM].dNeg = 1; // division factor to get from SI to desired unit @@ -2550,9 +2550,9 @@ void InitializeOutputMagmOc(OUTPUT *output, fnWriteOutput fnWrite[]) { output[OUT_CO2MASSMOATM].iModuleBit = MAGMOC; // name of module fnWrite[OUT_CO2MASSMOATM] = &WriteCO2MassMOAtm; - sprintf(output[OUT_CO2MASSSOL].cName, "CO2MassSol"); - sprintf(output[OUT_CO2MASSSOL].cDescr, "CO2 mass in solidified mantle"); - sprintf(output[OUT_CO2MASSSOL].cNeg, "kg"); + fvFormattedString(&output[OUT_CO2MASSSOL].cName, "CO2MassSol"); + fvFormattedString(&output[OUT_CO2MASSSOL].cDescr, "CO2 mass in solidified mantle"); + fvFormattedString(&output[OUT_CO2MASSSOL].cNeg, "kg"); output[OUT_CO2MASSSOL].bNeg = 1; output[OUT_CO2MASSSOL].dNeg = 1; // division factor to get from SI to desired unit @@ -2560,10 +2560,10 @@ void InitializeOutputMagmOc(OUTPUT *output, fnWriteOutput fnWrite[]) { output[OUT_CO2MASSSOL].iModuleBit = MAGMOC; // name of module fnWrite[OUT_CO2MASSSOL] = &WriteCO2MassSol; - sprintf(output[OUT_OXYGENMASSMOATM].cName, "OxygenMassMOAtm"); - sprintf(output[OUT_OXYGENMASSMOATM].cDescr, + fvFormattedString(&output[OUT_OXYGENMASSMOATM].cName, "OxygenMassMOAtm"); + fvFormattedString(&output[OUT_OXYGENMASSMOATM].cDescr, "Oxygen mass in magma ocean and atmosphere"); - sprintf(output[OUT_OXYGENMASSMOATM].cNeg, "kg"); + fvFormattedString(&output[OUT_OXYGENMASSMOATM].cNeg, "kg"); output[OUT_OXYGENMASSMOATM].bNeg = 1; output[OUT_OXYGENMASSMOATM].dNeg = 1; // division factor to get from SI to desired unit @@ -2571,9 +2571,9 @@ void InitializeOutputMagmOc(OUTPUT *output, fnWriteOutput fnWrite[]) { output[OUT_OXYGENMASSMOATM].iModuleBit = MAGMOC; // name of module fnWrite[OUT_OXYGENMASSMOATM] = &WriteOxygenMassMOAtm; - sprintf(output[OUT_OXYGENMASSSOL].cName, "OxygenMassSol"); - sprintf(output[OUT_OXYGENMASSSOL].cDescr, "Oxygen Mass in solidified mantle"); - sprintf(output[OUT_OXYGENMASSSOL].cNeg, "kg"); + fvFormattedString(&output[OUT_OXYGENMASSSOL].cName, "OxygenMassSol"); + fvFormattedString(&output[OUT_OXYGENMASSSOL].cDescr, "Oxygen Mass in solidified mantle"); + fvFormattedString(&output[OUT_OXYGENMASSSOL].cNeg, "kg"); output[OUT_OXYGENMASSSOL].bNeg = 1; output[OUT_OXYGENMASSSOL].dNeg = 1; // division factor to get from SI to desired unit @@ -2581,9 +2581,9 @@ void InitializeOutputMagmOc(OUTPUT *output, fnWriteOutput fnWrite[]) { output[OUT_OXYGENMASSSOL].iModuleBit = MAGMOC; // name of module fnWrite[OUT_OXYGENMASSSOL] = &WriteOxygenMassSol; - sprintf(output[OUT_PRESSWATERATM].cName, "PressWaterAtm"); - sprintf(output[OUT_PRESSWATERATM].cDescr, "Water pressure in atmosphere"); - sprintf(output[OUT_PRESSWATERATM].cNeg, "bar"); + fvFormattedString(&output[OUT_PRESSWATERATM].cName, "PressWaterAtm"); + fvFormattedString(&output[OUT_PRESSWATERATM].cDescr, "Water pressure in atmosphere"); + fvFormattedString(&output[OUT_PRESSWATERATM].cNeg, "bar"); output[OUT_PRESSWATERATM].bNeg = 1; output[OUT_PRESSWATERATM].dNeg = 1 / 1e5; // division factor to get from SI to desired unit @@ -2591,9 +2591,9 @@ void InitializeOutputMagmOc(OUTPUT *output, fnWriteOutput fnWrite[]) { output[OUT_PRESSWATERATM].iModuleBit = MAGMOC; // name of module fnWrite[OUT_PRESSWATERATM] = &WritePressWaterAtm; - sprintf(output[OUT_PRESSCO2ATM].cName, "PressCO2Atm"); - sprintf(output[OUT_PRESSCO2ATM].cDescr, "CO2 pressure in atmosphere"); - sprintf(output[OUT_PRESSCO2ATM].cNeg, "bar"); + fvFormattedString(&output[OUT_PRESSCO2ATM].cName, "PressCO2Atm"); + fvFormattedString(&output[OUT_PRESSCO2ATM].cDescr, "CO2 pressure in atmosphere"); + fvFormattedString(&output[OUT_PRESSCO2ATM].cNeg, "bar"); output[OUT_PRESSCO2ATM].bNeg = 1; output[OUT_PRESSCO2ATM].dNeg = 1 / 1e5; // division factor to get from SI to desired unit @@ -2601,9 +2601,9 @@ void InitializeOutputMagmOc(OUTPUT *output, fnWriteOutput fnWrite[]) { output[OUT_PRESSCO2ATM].iModuleBit = MAGMOC; // name of module fnWrite[OUT_PRESSCO2ATM] = &WritePressCO2Atm; - sprintf(output[OUT_PRESSOXYGENATM].cName, "PressOxygenAtm"); - sprintf(output[OUT_PRESSOXYGENATM].cDescr, "Oxygen pressure in atmosphere"); - sprintf(output[OUT_PRESSOXYGENATM].cNeg, "bar"); + fvFormattedString(&output[OUT_PRESSOXYGENATM].cName, "PressOxygenAtm"); + fvFormattedString(&output[OUT_PRESSOXYGENATM].cDescr, "Oxygen pressure in atmosphere"); + fvFormattedString(&output[OUT_PRESSOXYGENATM].cNeg, "bar"); output[OUT_PRESSOXYGENATM].bNeg = 1; output[OUT_PRESSOXYGENATM].dNeg = 1 / 1e5; // division factor to get from SI to desired unit @@ -2611,9 +2611,9 @@ void InitializeOutputMagmOc(OUTPUT *output, fnWriteOutput fnWrite[]) { output[OUT_PRESSOXYGENATM].iModuleBit = MAGMOC; // name of module fnWrite[OUT_PRESSOXYGENATM] = &WritePressOxygenAtm; - sprintf(output[OUT_HYDROGENMASSSPACE].cName, "HydrogenMassSpace"); - sprintf(output[OUT_HYDROGENMASSSPACE].cDescr, "H mass lost to space"); - sprintf(output[OUT_HYDROGENMASSSPACE].cNeg, "kg"); + fvFormattedString(&output[OUT_HYDROGENMASSSPACE].cName, "HydrogenMassSpace"); + fvFormattedString(&output[OUT_HYDROGENMASSSPACE].cDescr, "H mass lost to space"); + fvFormattedString(&output[OUT_HYDROGENMASSSPACE].cNeg, "kg"); output[OUT_HYDROGENMASSSPACE].bNeg = 1; output[OUT_HYDROGENMASSSPACE].dNeg = 1; // division factor to get from SI to desired unit @@ -2621,9 +2621,9 @@ void InitializeOutputMagmOc(OUTPUT *output, fnWriteOutput fnWrite[]) { output[OUT_HYDROGENMASSSPACE].iModuleBit = MAGMOC; // name of module fnWrite[OUT_HYDROGENMASSSPACE] = &WriteHydrogenMassSpace; - sprintf(output[OUT_OXYGENMASSSPACE].cName, "OxygenMassSpace"); - sprintf(output[OUT_OXYGENMASSSPACE].cDescr, "O atoms lost to space"); - sprintf(output[OUT_OXYGENMASSSPACE].cNeg, "kg"); + fvFormattedString(&output[OUT_OXYGENMASSSPACE].cName, "OxygenMassSpace"); + fvFormattedString(&output[OUT_OXYGENMASSSPACE].cDescr, "O atoms lost to space"); + fvFormattedString(&output[OUT_OXYGENMASSSPACE].cNeg, "kg"); output[OUT_OXYGENMASSSPACE].bNeg = 1; output[OUT_OXYGENMASSSPACE].dNeg = 1; // division factor to get from SI to desired unit @@ -2631,42 +2631,42 @@ void InitializeOutputMagmOc(OUTPUT *output, fnWriteOutput fnWrite[]) { output[OUT_OXYGENMASSSPACE].iModuleBit = MAGMOC; // name of module fnWrite[OUT_OXYGENMASSSPACE] = &WriteOxygenMassSpace; - sprintf(output[OUT_FRACFE2O3MAN].cName, "FracFe2O3Man"); - sprintf(output[OUT_FRACFE2O3MAN].cDescr, + fvFormattedString(&output[OUT_FRACFE2O3MAN].cName, "FracFe2O3Man"); + fvFormattedString(&output[OUT_FRACFE2O3MAN].cDescr, "Fe2O3 mass fraction in magma ocean"); output[OUT_FRACFE2O3MAN].bNeg = 1; output[OUT_FRACFE2O3MAN].iNum = 1; output[OUT_FRACFE2O3MAN].iModuleBit = MAGMOC; // name of module fnWrite[OUT_FRACFE2O3MAN] = &WriteFracFe2O3Man; - sprintf(output[OUT_NETFLUXATMO].cName, "NetFluxAtmo"); - sprintf(output[OUT_NETFLUXATMO].cDescr, "Atmospheric Net Flux (OLR-ASR)"); - sprintf(output[OUT_NETFLUXATMO].cNeg, "W/m^2"); + fvFormattedString(&output[OUT_NETFLUXATMO].cName, "NetFluxAtmo"); + fvFormattedString(&output[OUT_NETFLUXATMO].cDescr, "Atmospheric Net Flux (OLR-ASR)"); + fvFormattedString(&output[OUT_NETFLUXATMO].cNeg, "W/m^2"); output[OUT_NETFLUXATMO].bNeg = 1; output[OUT_NETFLUXATMO].iNum = 1; output[OUT_NETFLUXATMO].iModuleBit = MAGMOC; // name of module fnWrite[OUT_NETFLUXATMO] = &WriteNetFluxAtmo; - sprintf(output[OUT_WATERFRACMELT].cName, "WaterFracMelt"); - sprintf(output[OUT_WATERFRACMELT].cDescr, + fvFormattedString(&output[OUT_WATERFRACMELT].cName, "WaterFracMelt"); + fvFormattedString(&output[OUT_WATERFRACMELT].cDescr, "water mass fraction in magma ocean"); output[OUT_WATERFRACMELT].bNeg = 1; output[OUT_WATERFRACMELT].iNum = 1; output[OUT_WATERFRACMELT].iModuleBit = MAGMOC; // name of module fnWrite[OUT_WATERFRACMELT] = &WriteWaterFracMelt; - sprintf(output[OUT_CO2FRACMELT].cName, "CO2FracMelt"); - sprintf(output[OUT_CO2FRACMELT].cDescr, "CO2 mass fraction in magma ocean"); + fvFormattedString(&output[OUT_CO2FRACMELT].cName, "CO2FracMelt"); + fvFormattedString(&output[OUT_CO2FRACMELT].cDescr, "CO2 mass fraction in magma ocean"); output[OUT_CO2FRACMELT].bNeg = 1; output[OUT_CO2FRACMELT].iNum = 1; output[OUT_CO2FRACMELT].iModuleBit = MAGMOC; // name of module fnWrite[OUT_CO2FRACMELT] = &WriteCO2FracMelt; // XXX Overlap with RadPowerMan from thermint - sprintf(output[OUT_RADIOPOWER].cName, "RadioPower"); - sprintf(output[OUT_RADIOPOWER].cDescr, + fvFormattedString(&output[OUT_RADIOPOWER].cName, "RadioPower"); + fvFormattedString(&output[OUT_RADIOPOWER].cDescr, "Power from radiogenic heating in the mantle"); - sprintf(output[OUT_RADIOPOWER].cNeg, "TW"); + fvFormattedString(&output[OUT_RADIOPOWER].cNeg, "TW"); output[OUT_RADIOPOWER].bNeg = 1; output[OUT_RADIOPOWER].dNeg = 1e-12; output[OUT_RADIOPOWER].iNum = 1; @@ -2674,10 +2674,10 @@ void InitializeOutputMagmOc(OUTPUT *output, fnWriteOutput fnWrite[]) { fnWrite[OUT_RADIOPOWER] = &WriteRadioPower; // XXX Overlap with PowerTidal from Eqtide - sprintf(output[OUT_TIDALPOWER].cName, "TidalPower"); - sprintf(output[OUT_TIDALPOWER].cDescr, + fvFormattedString(&output[OUT_TIDALPOWER].cName, "TidalPower"); + fvFormattedString(&output[OUT_TIDALPOWER].cDescr, "Power from tidal heating in the mantle"); - sprintf(output[OUT_TIDALPOWER].cNeg, "TW"); + fvFormattedString(&output[OUT_TIDALPOWER].cNeg, "TW"); output[OUT_TIDALPOWER].bNeg = 1; output[OUT_TIDALPOWER].dNeg = 1e-12; output[OUT_TIDALPOWER].iNum = 1; @@ -2685,10 +2685,10 @@ void InitializeOutputMagmOc(OUTPUT *output, fnWriteOutput fnWrite[]) { fnWrite[OUT_TIDALPOWER] = &WriteTidalPower; // XXX Overlap with HZ outputs in output.c - sprintf(output[OUT_HZINNEREDGE].cName, "HZInnerEdge"); - sprintf(output[OUT_HZINNEREDGE].cDescr, + fvFormattedString(&output[OUT_HZINNEREDGE].cName, "HZInnerEdge"); + fvFormattedString(&output[OUT_HZINNEREDGE].cDescr, "Inner Edge of the Habitable Zone (Runaway Greenhouse)"); - sprintf(output[OUT_HZINNEREDGE].cNeg, "AU"); + fvFormattedString(&output[OUT_HZINNEREDGE].cNeg, "AU"); output[OUT_HZINNEREDGE].bNeg = 1; output[OUT_HZINNEREDGE].dNeg = 1 / AUM; // division factor to get from SI to desired unit @@ -2696,8 +2696,8 @@ void InitializeOutputMagmOc(OUTPUT *output, fnWriteOutput fnWrite[]) { output[OUT_HZINNEREDGE].iModuleBit = MAGMOC; // name of module fnWrite[OUT_HZINNEREDGE] = &WriteHZInnerEdge; - sprintf(output[OUT_MELTFRACTION].cName, "MeltFraction"); - sprintf(output[OUT_MELTFRACTION].cDescr, "Melt fraction of the magma ocean"); + fvFormattedString(&output[OUT_MELTFRACTION].cName, "MeltFraction"); + fvFormattedString(&output[OUT_MELTFRACTION].cDescr, "Melt fraction of the magma ocean"); output[OUT_MELTFRACTION].bNeg = 1; output[OUT_MELTFRACTION].iNum = 1; output[OUT_MELTFRACTION].iModuleBit = MAGMOC; // name of module diff --git a/src/magmoc.h b/src/magmoc.h index 408158f82..3173772f5 100644 --- a/src/magmoc.h +++ b/src/magmoc.h @@ -209,51 +209,51 @@ void InitializeOutputFunctionMagmOc(OUTPUT *, int, int); void FinalizeOutputFunctionMagmOc(OUTPUT *, int, int); void WritePotTemp(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, UPDATE *, int, - double *, char[]); + double *, char**); void WriteSurfTemp(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, UPDATE *, - int, double *, char[]); + int, double *, char**); void WriteSolidRadius(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, UPDATE *, - int, double *, char[]); + int, double *, char**); void WriteWaterMassMOAtm(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, - UPDATE *, int, double *, char[]); + UPDATE *, int, double *, char**); void WriteWaterMassSol(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, UPDATE *, - int, double *, char[]); + int, double *, char**); void WriteCO2MassMOAtm(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, UPDATE *, - int, double *, char[]); + int, double *, char**); void WriteCO2MassSol(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, UPDATE *, - int, double *, char[]); + int, double *, char**); void WriteOxygenMassMOAtm(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, - UPDATE *, int, double *, char[]); + UPDATE *, int, double *, char**); void WriteOxygenMassSol(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, - UPDATE *, int, double *, char[]); + UPDATE *, int, double *, char**); void WritePressWaterAtm(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, - UPDATE *, int, double *, char[]); + UPDATE *, int, double *, char**); void WritePressCO2Atm(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, UPDATE *, - int, double *, char[]); + int, double *, char**); void WritePressOxygenAtm(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, - UPDATE *, int, double *, char[]); + UPDATE *, int, double *, char**); void WriteHydrogenMassSpace(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, - UPDATE *, int, double *, char[]); + UPDATE *, int, double *, char**); void WriteOxygenMassSpace(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, - UPDATE *, int, double *, char[]); + UPDATE *, int, double *, char**); void WriteFracFe2O3Man(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, UPDATE *, - int, double *, char[]); + int, double *, char**); void WriteNetFluxAtmo(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, UPDATE *, - int, double *, char[]); + int, double *, char**); void WriteWaterFracMelt(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, - UPDATE *, int, double *, char[]); + UPDATE *, int, double *, char**); void WriteCO2FracMelt(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, UPDATE *, - int, double *, char[]); + int, double *, char**); void WriteRadioPower(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, UPDATE *, - int, double *, char[]); + int, double *, char**); void WriteTidalPower(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, UPDATE *, - int, double *, char[]); + int, double *, char**); void WriteSemiMajorAxis(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, - UPDATE *, int, double *, char[]); + UPDATE *, int, double *, char**); void WriteHZInnerEdge(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, UPDATE *, - int, double *, char[]); + int, double *, char**); void WriteMeltFraction(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, UPDATE *, - int, double *, char[]); + int, double *, char**); /* Logging Functions */ void LogOptionsMagmOc(CONTROL *, FILE *); diff --git a/src/module.c b/src/module.c index 70d3f5ffa..511c9462a 100644 --- a/src/module.c +++ b/src/module.c @@ -688,11 +688,11 @@ void ReadModules(BODY *body, CONTROL *control, FILES *files, MODULE *module, OPTIONS *options, int iFile) { int iNumIndices = 0, iNumLines = 0, iModule; int *lTmp; - char saTmp[MAXARRAY][OPTLEN]; + char **saTmp; lTmp = malloc(MAXLINES * sizeof(int)); - AddOptionStringArray(files->Infile[iFile].cIn, options->cName, saTmp, + AddOptionStringArray(files->Infile[iFile].cIn, options->cName, &saTmp, &iNumIndices, &iNumLines, lTmp, control->Io.iVerbose); if (lTmp[0] >= 0) { NotPrimaryInput(iFile, options->cName, files->Infile[iFile].cIn, lTmp[0], @@ -720,43 +720,57 @@ void ReadModules(BODY *body, CONTROL *control, FILES *files, MODULE *module, * ADD NEW MODULES HERE * ************************/ - if (memcmp(sLower(saTmp[iModule]), "eqtide", 6) == 0) { + int iModuleLength = strlen(saTmp[iModule]); + // if (memcmp(sLower(saTmp[iModule]), "eqtide", iModuleLength) == 0) { + if (strcmp(sLower(saTmp[iModule]), "eqtide") == 0) { body[iFile - 1].bEqtide = 1; module->iBitSum[iFile - 1] += EQTIDE; - } else if (memcmp(sLower(saTmp[iModule]), "radheat", 7) == 0) { + // } else if (memcmp(sLower(saTmp[iModule]), "radheat", iModuleLength) == 0) { + } else if (strcmp(sLower(saTmp[iModule]), "radheat") == 0) { body[iFile - 1].bRadheat = 1; module->iBitSum[iFile - 1] += RADHEAT; - } else if (memcmp(sLower(saTmp[iModule]), "distorb", 8) == 0) { + //} else if (memcmp(sLower(saTmp[iModule]), "distorb", iModuleLength) == 0) { + } else if (strcmp(sLower(saTmp[iModule]), "distorb") == 0) { body[iFile - 1].bDistOrb = 1; module->iBitSum[iFile - 1] += DISTORB; - } else if (memcmp(sLower(saTmp[iModule]), "distrot", 7) == 0) { + // } else if (memcmp(sLower(saTmp[iModule]), "distrot", iModuleLength) == 0) { + } else if (strcmp(sLower(saTmp[iModule]), "distrot") == 0) { body[iFile - 1].bDistRot = 1; module->iBitSum[iFile - 1] += DISTROT; - } else if (memcmp(sLower(saTmp[iModule]), "thermint", 8) == 0) { + // } else if (memcmp(sLower(saTmp[iModule]), "thermint", iModuleLength) == 0) { + } else if (strcmp(sLower(saTmp[iModule]), "thermint") == 0) { body[iFile - 1].bThermint = 1; module->iBitSum[iFile - 1] += THERMINT; - } else if (memcmp(sLower(saTmp[iModule]), "atmesc", 6) == 0) { + // } else if (memcmp(sLower(saTmp[iModule]), "atmesc", iModuleLength) == 0) { + } else if (strcmp(sLower(saTmp[iModule]), "atmesc") == 0) { body[iFile - 1].bAtmEsc = 1; module->iBitSum[iFile - 1] += ATMESC; - } else if (memcmp(sLower(saTmp[iModule]), "stellar", 7) == 0) { + // } else if (memcmp(sLower(saTmp[iModule]), "stellar", iModuleLength) == 0) { + } else if (strcmp(sLower(saTmp[iModule]), "stellar") == 0) { body[iFile - 1].bStellar = 1; module->iBitSum[iFile - 1] += STELLAR; - } else if (memcmp(sLower(saTmp[iModule]), "poise", 5) == 0) { + // } else if (memcmp(sLower(saTmp[iModule]), "poise", iModuleLength) == 0) { + } else if (strcmp(sLower(saTmp[iModule]), "poise") == 0) { body[iFile - 1].bPoise = 1; module->iBitSum[iFile - 1] += POISE; - } else if (memcmp(sLower(saTmp[iModule]), "binary", 6) == 0) { + // } else if (memcmp(sLower(saTmp[iModule]), "binary", iModuleLength) == 0) { + } else if (strcmp(sLower(saTmp[iModule]), "binary") == 0) { body[iFile - 1].bBinary = 1; module->iBitSum[iFile - 1] += BINARY; - } else if (memcmp(sLower(saTmp[iModule]), "flare", 5) == 0) { + // } else if (memcmp(sLower(saTmp[iModule]), "flare", iModuleLength) == 0) { + } else if (strcmp(sLower(saTmp[iModule]), "flare") == 0) { body[iFile - 1].bFlare = 1; module->iBitSum[iFile - 1] += FLARE; - } else if (memcmp(sLower(saTmp[iModule]), "galhabit", 8) == 0) { + // } else if (memcmp(sLower(saTmp[iModule]), "galhabit", iModuleLength) == 0) { + } else if (strcmp(sLower(saTmp[iModule]), "galhabit") == 0) { body[iFile - 1].bGalHabit = 1; module->iBitSum[iFile - 1] += GALHABIT; - } else if (memcmp(sLower(saTmp[iModule]), "spinbody", 8) == 0) { + // } else if (memcmp(sLower(saTmp[iModule]), "spinbody", iModuleLength) == 0) { + } else if (strcmp(sLower(saTmp[iModule]), "spinbody") == 0) { body[iFile - 1].bSpiNBody = 1; module->iBitSum[iFile - 1] += SPINBODY; - } else if (memcmp(sLower(saTmp[iModule]), "magmoc", 6) == 0) { + // } else if (memcmp(sLower(saTmp[iModule]), "magmoc", iModuleLength) == 0) { + } else if (strcmp(sLower(saTmp[iModule]), "magmoc") == 0) { body[iFile - 1].bMagmOc = 1; module->iBitSum[iFile - 1] += MAGMOC; } else { @@ -779,6 +793,7 @@ void ReadModules(BODY *body, CONTROL *control, FILES *files, MODULE *module, } } free(lTmp); + free(saTmp); } void PrintModuleList(FILE *file, int iBitSum, int bPadString) { @@ -1005,9 +1020,11 @@ void VerifyModuleMultiEqtideThermint(BODY *body, UPDATE *update, int iBody, int *iModuleProps, int *iModuleForce) { - if (control->Evolve.iEqtideModel == CTL) { - fprintf(stderr,"ERROR: The CTL EqTide model cannot be coupled to ThermInt.\n"); - exit(EXIT_INPUT); + if (body[iBody].bEqtide && body[iBody].bThermint) { + if (control->Evolve.iEqtideModel == CTL) { + fprintf(stderr,"ERROR: The CTL EqTide model cannot be coupled to ThermInt.\n"); + exit(EXIT_INPUT); + } } body[iBody].dTidalPowMan = 0; diff --git a/src/options.c b/src/options.c index eaefcc9a2..17b3409f8 100644 --- a/src/options.c +++ b/src/options.c @@ -27,12 +27,8 @@ void NotPrimaryInput(int iFile, char cName[], char cFile[], int iLine, } } -/* Returns the line with the desiried options AND asserts no duplicate - entries. cLine is the entire text of the line, iLine is the line - number. */ - -/* Is the first non-white space a #? I so, return 1 */ -int CheckComment(char cLine[], int iLen) { +/* Commented lines start with a # */ +int fbCommentedLine(char cLine[], int iLen) { int iPos; for (iPos = 0; iPos < iLen; iPos++) { @@ -48,21 +44,22 @@ int CheckComment(char cLine[], int iLen) { return 0; } -void GetLine(char cFile[], char cOption[], char cLine[], int *iLine, +void GetLine(char *cFile, char *cOption, char **cLine, int *iLine, int iVerbose) { int iLen, bDone = 0, iLineTmp = 0; - char cWord[OPTLEN], cTmp[LINE]; + char cWord[LINE], cTmp[LINE]; FILE *fp; + *cLine = NULL; + iLen = strlen(cOption); fp = fopen(cFile, "r"); - memset(cLine, '\0', LINE); memset(cTmp, '\0', LINE); memset(cWord, '\0', OPTLEN); while (fgets(cTmp, LINE, fp) != NULL) { - if (!CheckComment(cTmp, LINE)) { + if (!fbCommentedLine(cTmp, LINE)) { sscanf(cTmp, "%s", cWord); if (memcmp(cWord, cOption, iLen + 1) == 0) { /* Parameter Found! */ @@ -75,7 +72,7 @@ void GetLine(char cFile[], char cOption[], char cLine[], int *iLine, iLineTmp + 1); exit(1); } - strcpy(cLine, cTmp); + fvFormattedString(cLine, cTmp); *iLine = iLineTmp; bDone = 1; } @@ -92,24 +89,27 @@ void GetLine(char cFile[], char cOption[], char cLine[], int *iLine, recursively, and cLine and *iLine are the line and line number, respectively. */ -void GetNextValidLine(char cFile[], int iStart, char cLine[], int *iLine) { +void GetNextValidLine(char cFile[], int iStart, char **cLine, int *iLine) { FILE *fp; int iPos, iLineTmp, ok = 1; + char cTmp[LINE]; fp = fopen(cFile, "r"); *iLine = 0; + *cLine = NULL; for (iLineTmp = 0; iLineTmp < iStart; iLineTmp++) { - if (fgets(cLine, LINE, fp) == NULL) { + if (fgets(cTmp, LINE, fp) == NULL) { fprintf(stderr, "ERROR: Unable to read next valid line."); LineExit(cFile, iStart); } + fvFormattedString(cLine, cTmp); (*iLine)++; } /* If EOF, return */ - if (fgets(cLine, LINE, fp) == NULL) { - sprintf(cLine, "null"); + if (fgets(cTmp, LINE, fp) == NULL) { + fvFormattedString(cLine, "null"); fclose(fp); return; } @@ -118,15 +118,16 @@ void GetNextValidLine(char cFile[], int iStart, char cLine[], int *iLine) { or blank line (line feed = 10). */ for (iPos = 0; iPos < LINE; iPos++) { - if (cLine[iPos] == 36 || cLine[iPos] == 35 || cLine[iPos] == 10) { + if (cTmp[iPos] == 36 || cTmp[iPos] == 35 || cTmp[iPos] == 10) { /* First character is a $, # or \n: continue */ GetNextValidLine(cFile, iStart + 1, cLine, iLine); fclose(fp); return; } - if (!isspace(cLine[iPos])) { + if (!isspace(cTmp[iPos])) { /* Found next valid line */ fclose(fp); + fvFormattedString(cLine, cTmp); return; } } @@ -155,12 +156,12 @@ int GetPos(char cLine[]) { a trailing $, if so, it is an array that continues to the next line. */ -void GetWords(char cLine[], char cInput[MAXARRAY][OPTLEN], int *iNumWords, +void GetWords(char *cLine, char cInput[MAXARRAY][OPTLEN], int *iNumWords, int *bContinue) { int iPos, iPosStart, iWord; char cTmp[OPTLEN]; - if (strlen(cLine) == 0) { + if (cLine == NULL) { *iNumWords = 0; *bContinue = 0; return; @@ -247,20 +248,16 @@ double dNegativeDouble(OPTIONS options, char cFile[], int iVerbose) { not found, saInput is an array of empty strings, and iLine is unchanged. */ -void AddOptionStringArray(char cFile[], char cOption[], - char saInput[MAXARRAY][OPTLEN], int *iNumIndices, - int *iNumLines, int *iLine, int iVerbose) { - char cLine[LINE], cTmp[MAXARRAY][OPTLEN]; +void AddOptionStringArray(char *cFile, char *cOption, char ***saInput, + int *iNumIndices, int *iNumLines, int *iLine, + int iVerbose) { + char *cLine, cTmp[MAXARRAY][OPTLEN], **saInputCopy; int iPos, iWord, bContinue, iNumWords; FILE *fp; - memset(cLine, '\0', LINE); - - /* iLine=malloc(MAXLINES*sizeof(int)); */ - iLine[0] = -1; - /* Fencepost problem. If cInput continues across multiple lines, + /* Fencepost problem. If saInput continues across multiple lines, then we must keep getting more lines. For the first line, we remove the first word, as it is cOption. iLine must come preassigned and set to 0. */ @@ -270,13 +267,18 @@ void AddOptionStringArray(char cFile[], char cOption[], memset(cTmp[iPos], '\0', OPTLEN); } - GetLine(cFile, cOption, cLine, &iLine[0], iVerbose); + GetLine(cFile, cOption, &cLine, &iLine[0], iVerbose); GetWords(cLine, cTmp, &iNumWords, &bContinue); *iNumLines = 1; + saInputCopy = (char **)malloc(MAXARRAY * sizeof(char *)); + + for (iWord = 0; iWord < MAXARRAY; iWord++) { + saInputCopy[iWord] = NULL; + } for (iWord = 0; iWord < iNumWords - 1; iWord++) { - memset(saInput[iWord], '\0', OPTLEN); - strcpy(saInput[iWord], cTmp[iWord + 1]); + + fvFormattedString(&saInputCopy[iWord], cTmp[iWord + 1]); /* Reset cTmp string: If the next time cTmp is filled, the new string is longer than the old, then vestigial characters can remain after a trailing $. */ @@ -289,12 +291,18 @@ void AddOptionStringArray(char cFile[], char cOption[], /* Now keep getting lines until done */ while (bContinue) { - GetNextValidLine(cFile, iLine[*iNumLines - 1] + 1, cLine, + GetNextValidLine(cFile, iLine[*iNumLines - 1] + 1, &cLine, &iLine[*iNumLines]); if (memcmp(cLine, "null", 4)) { GetWords(cLine, cTmp, &iNumWords, &bContinue); + if (*iNumIndices + iNumWords > MAXARRAY) { + fprintf(stderr, + "ERROR: Too many arguments to %s. Either remove options, or " + "increase value of MAXARRAY", + cOption); + } for (iWord = 0; iWord < iNumWords; iWord++) { - strcpy(saInput[*iNumIndices + iWord], cTmp[iWord]); + fvFormattedString(&saInputCopy[*iNumIndices + iWord], cTmp[iWord]); memset(cTmp[iWord], '\0', OPTLEN); } *iNumIndices += iNumWords; @@ -309,50 +317,53 @@ void AddOptionStringArray(char cFile[], char cOption[], } } } + *saInput = saInputCopy; } /* Get all fields in a double array. The fields are stored in daInput, and the lines which were read are in iNumLines. If a parameter is not found, daInput is empty, and iLine is unchanged. */ -void AddOptionDoubleArray(char cFile[], char cOption[], double *daInput, +void AddOptionDoubleArray(char *cFile, char *cOption, double *daInput, int *iNumIndices, int *iNumLines, int *iLine, int iVerbose) { int iIndex; - char cTmp[MAXARRAY][OPTLEN]; + char **saTmp; - AddOptionStringArray(cFile, cOption, cTmp, iNumIndices, iNumLines, iLine, + AddOptionStringArray(cFile, cOption, &saTmp, iNumIndices, iNumLines, iLine, iVerbose); for (iIndex = 0; iIndex < *iNumIndices; iIndex++) { - daInput[iIndex] = atof(cTmp[iIndex]); + daInput[iIndex] = atof(saTmp[iIndex]); } } -void AddOptionDouble(char cFile[], char cOption[], double *dInput, int *iLine, +void AddOptionDouble(char *cFile, char *cOption, double *dInput, int *iLine, int iVerbose) { - char cTmp[OPTLEN], cLine[LINE]; + char cTmp[OPTLEN], *cLine; - GetLine(cFile, cOption, cLine, iLine, iVerbose); + GetLine(cFile, cOption, &cLine, iLine, iVerbose); if (*iLine >= 0) { sscanf(cLine, "%s %lf", cTmp, dInput); } + free(cLine); } -void AddOptionInt(char cFile[], char cOption[], int *iInput, int *iLine, +void AddOptionInt(char *cFile, char *cOption, int *iInput, int *iLine, int iVerbose) { - char cTmp[OPTLEN], cLine[LINE]; + char cTmp[OPTLEN], *cLine; - GetLine(cFile, cOption, cLine, iLine, iVerbose); + GetLine(cFile, cOption, &cLine, iLine, iVerbose); if (*iLine >= 0) { sscanf(cLine, "%s %d", cTmp, iInput); } + free(cLine); } -void AddOptionBool(char cFile[], char cOption[], int *iInput, int *iLine, +void AddOptionBool(char *cFile, char *cOption, int *iInput, int *iLine, int iVerbose) { AddOptionInt(cFile, cOption, iInput, iLine, iVerbose); - if (*iLine == -1) { // PED 4/9/15 + if (*iLine == -1) { return; } if (*iInput == 0 || *iInput == 1) { @@ -365,76 +376,20 @@ void AddOptionBool(char cFile[], char cOption[], int *iInput, int *iLine, } } -void AddOptionString(char cFile[], char cOption[], char cInput[], int *iLine, +void AddOptionString(char *cFile, char *cOption, char cInput[], int *iLine, int iVerbose) { - char cTmp[OPTLEN], cLine[LINE]; + char cTmp[OPTLEN], *cLine; - memset(cLine, '\0', LINE); memset(cTmp, '\0', OPTLEN); - GetLine(cFile, cOption, cLine, iLine, iVerbose); - sscanf(cLine, "%s %s", cTmp, cInput); -} - -/* Looks like this was deprecated somewhere RB 01/02/24 -int GetNumOut(char cFile[], char cName[], int iLen, int *iLineNum, int iExit) { - char cLine[LINE], cWord[NAMELEN]; - int iPos, j, ok, bDone = 0, iLine = 0, iNumOut; - FILE *fp; - - fp = fopen(cFile, "r"); - if (fp == NULL) { - fprintf(stderr, "Unable to open %s.\n", cFile); - exit(iExit); - } - - while (fgets(cLine, LINE, fp) != NULL) { - // Check for # sign - if (memcmp(cLine, "#", 1) != 0) { - // Check for desired parameter - sscanf(cLine, "%s", cWord); - if (memcmp(cWord, cName, iLen) == 0) { - // Parameter Found! - if (bDone) { - fprintf(stderr, "ERROR: Multiple occurences of parameter %s found.\n", - cName); - fprintf(stderr, "\t%s, lines: %d and %d\n", cFile, *iLineNum, iLine); - exit(iExit); - } - bDone = 1; - *iLineNum = iLine; - - iNumOut = 0; - ok = 1; - for (iPos = 1; iPos < LINE; - iPos++) { // Ignore first character, as it makes conditional - // well-defined - // printf("%d ",cLine[iPos]); - if (ok) { - if (cLine[iPos] == 35) { // 35 is ASCII code for # - // Pound sign! - ok = 0; - iNumOut++; - } - if (isspace(cLine[iPos]) && !isspace(cLine[iPos - 1])) { - iNumOut++; - } - } - } - } - } - iLine++; - for (iPos = 0; iPos < LINE; iPos++) { - cLine[iPos] = 0; - } + GetLine(cFile, cOption, &cLine, iLine, iVerbose); + if (*iLine >= 0) { + sscanf(cLine, "%s %s", cTmp, cInput); } - // Lose the input parameter - iNumOut--; - return iNumOut; + free(cLine); } -*/ -int iGetNumLines(char cFile[]) { +int iGetNumLines(char *cFile) { int iNumLines = 0, iChar, bFileOK = 1; int bComment, bReturn; FILE *fp; @@ -484,44 +439,46 @@ int iGetNumLines(char cFile[]) { return iNumLines; } -void InitializeInput(INFILE *input) { - int iLine, iPos, bBlank; +void CheckFileExists(char *cFile) { FILE *fp; - char cLine[LINE]; - fp = fopen(input->cIn, "r"); + fp = fopen(cFile, "r"); if (fp == NULL) { - fprintf(stderr, "ERROR: Unable to open %s.\n", input->cIn); + fprintf(stderr, "ERROR: Unable to open %s for reading.\n", cFile); exit(EXIT_INPUT); } - input->iNumLines = iGetNumLines(input->cIn); - input->bLineOK = malloc(input->iNumLines * sizeof(int)); - /* - input->cSpecies[0] = 0; - input->cReactions[0] = 0; - */ + fclose(fp); +} + +int fbBlankLine(char *cLine,int iLineLength) { + int iPos,bBlank = 1; + for (iPos = 0; iPos < LINE; iPos++) { + if (!isspace(cLine[iPos]) && cLine[iPos] != '\0') { + bBlank = 0; + } + } + return bBlank; +} + +void RecordCommentsAndWhiteSpace(INFILE *infile) { + int iLine, iPos, bBlank; + char cLine[LINE]; + FILE *fp; + + fp = fopen(infile->cIn, "r"); + infile->bLineOK = malloc(infile->iNumLines * sizeof(int)); - for (iLine = 0; iLine < input->iNumLines; iLine++) { - input->bLineOK[iLine] = 0; + for (iLine = 0; iLine < infile->iNumLines; iLine++) { + infile->bLineOK[iLine] = 0; memset(cLine, '\0', LINE); + // XXX Isn't this the same as CheckFileExists? if (fgets(cLine, LINE, fp) == NULL) { - fprintf(stderr, "ERROR: Unable to open %s.\n", input->cIn); + fprintf(stderr, "ERROR: Unable to open %s.\n", infile->cIn); exit(EXIT_INPUT); } - if (CheckComment(cLine, LINE)) { - input->bLineOK[iLine] = 1; - } else { - // Is it a blank line? - bBlank = 0; - for (iPos = 0; iPos < LINE; iPos++) { - if (!isspace(cLine[iPos]) && cLine[iPos] != '\0') { - bBlank = 1; - } - } - if (!bBlank) { - input->bLineOK[iLine] = 1; - } + if (fbCommentedLine(cLine, LINE) || fbBlankLine(cLine,LINE)) { + infile->bLineOK[iLine] = 1; } } } @@ -555,7 +512,7 @@ void Unrecognized(FILES files) { void UpdateFoundOption(INFILE *input, OPTIONS *options, int iLine, int iFile) { input->bLineOK[iLine] = 1; options->iLine[iFile] = iLine; - strcpy(options->cFile[iFile], input->cIn); + fvFormattedString(&options->cFile[iFile], input->cIn); } void UpdateFoundOptionMulti(INFILE *input, OPTIONS *options, int *iLine, @@ -567,10 +524,11 @@ void UpdateFoundOptionMulti(INFILE *input, OPTIONS *options, int *iLine, The user should be able to figure it out from there. */ options->iLine[iFile] = iLine[0]; - strcpy(options->cFile[iFile], input->cIn); for (iLineNow = 0; iLineNow < iNumLines; iLineNow++) { input->bLineOK[iLine[iLineNow]] = 1; } + + fvFormattedString(&options->cFile[iFile], input->cIn); } void CheckDuplication(FILES *files, OPTIONS *options, char cFile[], int iLine, @@ -579,7 +537,7 @@ void CheckDuplication(FILES *files, OPTIONS *options, char cFile[], int iLine, if (options->bMultiFile) { fprintf(stderr, - "ERROR: CheckDuplication called, but options. bMultiFile = %d\n", + "ERROR: CheckDuplication called, but options.bMultiFile = %d\n", options->bMultiFile); exit(EXIT_INPUT); } @@ -1111,66 +1069,43 @@ void ReadSystemName(CONTROL *control, FILES *files, OPTIONS *options, if (lTmp >= 0) { CheckDuplication(files, options, files->Infile[iFile].cIn, lTmp, control->Io.iVerbose); - strcpy(system->cName, cTmp); + fvFormattedString(&system->cName, cTmp); UpdateFoundOption(&files->Infile[iFile], options, lTmp, iFile); } } -void ReadBodyFileNames(CONTROL *control, FILES *files, OPTIONS *options, - INFILE *infile) { - int iIndex, iNumIndices = 0, iNumLines = 0; - int *lTmp; - char saTmp[MAXARRAY][OPTLEN]; +void ReadBodyFileNames(BODY **body,CONTROL *control, FILES *files, OPTIONS *options, + char *cFile, char ***saBodyFiles, int *iNumLines, int *iaLines) { + int iNumIndices; - lTmp = malloc(MAXLINES * sizeof(int)); + AddOptionStringArray(cFile, options->cName, saBodyFiles, &iNumIndices, + iNumLines, iaLines, control->Io.iVerbose); - AddOptionStringArray(infile->cIn, options->cName, saTmp, &iNumIndices, - &iNumLines, lTmp, control->Io.iVerbose); - - if (lTmp[0] >= 0) { + if (iaLines[0] >= 0) { if (iNumIndices == 0) { if (control->Io.iVerbose >= VERBERR) { fprintf(stderr, "ERROR: No files supplied for option %s.\n", options->cName); } - LineExit(infile->cIn, lTmp[0]); + LineExit(cFile, iaLines[0]); } - files->iNumInputs = iNumIndices + 1; - if (files->iNumInputs >= MAXFILES) { + if (iNumIndices >= MAXFILES) { fprintf(stderr, "ERROR: Number of input files (%d) exceeds MAXFILES (%d).\n", - files->iNumInputs, MAXFILES); + iNumIndices, MAXFILES); fprintf( stderr, "Either use less body files, or increase MAXFILES in vplanet.h.\n"); - LineExit(infile->cIn, lTmp[0]); + LineExit(cFile, iaLines[0]); } } else { fprintf(stderr, "ERROR: Option %s is required in file %s.\n", - options->cName, infile->cIn); + options->cName, cFile); exit(EXIT_INPUT); } - /* With body files identified, must allocate space */ - files->Infile = malloc(files->iNumInputs * sizeof(INFILE)); - files->Infile[0].bLineOK = malloc(infile->iNumLines * sizeof(int)); - - InfileCopy(&files->Infile[0], infile); - - for (iIndex = 0; iIndex < iNumIndices; iIndex++) { - - strcpy(files->Infile[iIndex + 1].cIn, saTmp[iIndex]); - } - control->Evolve.iNumBodies = iNumIndices; - files->Outfile = malloc(iNumIndices * sizeof(OUTFILE)); - for (iIndex = 0; iIndex < iNumIndices; iIndex++) { - memset(files->Outfile[iIndex].cOut, '\0', NAMELEN); - } - - UpdateFoundOptionMulti(&files->Infile[0], options, lTmp, iNumLines, 0); - - free(lTmp); + *body = malloc(control->Evolve.iNumBodies * sizeof(BODY)); } /* @@ -1181,32 +1116,26 @@ void ReadBodyFileNames(CONTROL *control, FILES *files, OPTIONS *options, void ReadInitialOptions(BODY **body, CONTROL *control, FILES *files, MODULE *module, OPTIONS *options, OUTPUT *output, - SYSTEM *system, char infile[]) { - int iFile, iBody, iModule; - INFILE input; + SYSTEM *system, char *sPrimaryFile) { + int iFile, iBody, iModule,iNumBodyFileLines,*iaLines; + char **saBodyFiles; - strcpy(input.cIn, infile); - /* Initialize primary input file */ - InitializeInput(&input); + iaLines=malloc(MAXLINES*sizeof(int)); - /* First find input files */ - ReadBodyFileNames(control, files, &options[OPT_BODYFILES], &input); - system->iNumBodies = control->Evolve.iNumBodies; + ReadBodyFileNames(body, control, files, &options[OPT_BODYFILES], sPrimaryFile, &saBodyFiles, &iNumBodyFileLines, iaLines); - // allocate the body struct - *body = malloc(control->Evolve.iNumBodies * sizeof(BODY)); + InitializeFiles(files, options, sPrimaryFile, saBodyFiles, control->Evolve.iNumBodies); + + UpdateFoundOptionMulti(&files->Infile[0], &options[OPT_BODYFILES], iaLines, iNumBodyFileLines, 0); /* Initialize functions in the module struct */ InitializeModule(*body, control, module); - /* Is iVerbose set in primary input? */ + /* Is iVerbose set ? */ ReadVerbose(files, &options[OPT_VERBOSE], &control->Io.iVerbose, 0); - /* Now we can search through files for all options. First we scan the files - * for Verbosity */ /* We have to initialize other input files first */ for (iFile = 1; iFile < files->iNumInputs; iFile++) { - InitializeInput(&files->Infile[iFile]); ReadVerbose(files, options, &control->Io.iVerbose, iFile); } @@ -1229,13 +1158,12 @@ void ReadInitialOptions(BODY **body, CONTROL *control, FILES *files, for (iBody = 0; iBody < control->Evolve.iNumBodies; iBody++) { FinalizeModule(*body, control, module, iBody); } - /* Check that selected modules are compatable */ + for (iBody = 0; iBody < control->Evolve.iNumBodies; iBody++) { VerifyModuleCompatability(*body, control, files, module, options, iBody); } - - - free(input.bLineOK); + free(saBodyFiles); + free(iaLines); } void AssignDefaultDouble(OPTIONS *options, double *dOption, int iNumFiles) { @@ -1277,7 +1205,7 @@ void AssignDefaultString(OPTIONS *options, char cOption[], int iNumFiles) { } /* If made it here, not input already, so assign default */ - strcpy(cOption, options->cDefault); + fvFormattedString(&cOption, options->cDefault); } int bOptionAlreadyFound(int *iLine, int iNumFiles) { @@ -1427,7 +1355,7 @@ void ReadOutFile(BODY *body, CONTROL *control, FILES *files, OPTIONS *options, /* Cannot exist in primary input file -- Each body has an output file */ NotPrimaryInput(iFile, options->cName, files->Infile[iFile].cIn, lTmp, control->Io.iVerbose); - strcpy(files->Outfile[iFile - 1].cOut, cTmp); + fvFormattedString(&files->Outfile[iFile - 1].cOut, cTmp); UpdateFoundOption(&files->Infile[iFile], options, lTmp, iFile); } else if (iFile > 0) { AssignDefaultString(options, files->Outfile[iFile - 1].cOut, @@ -1582,14 +1510,16 @@ void ReadBodyName(BODY *body, CONTROL *control, FILES *files, OPTIONS *options, /* Cannot exist in primary input file -- Each body has an output file */ NotPrimaryInput(iFile, options->cName, files->Infile[iFile].cIn, lTmp, control->Io.iVerbose); + body[iFile-1].cName=NULL; if (strlen(cTmp) > 0) { - strcpy(body[iFile - 1].cName, cTmp); + fvFormattedString(&body[iFile - 1].cName, cTmp); } else { - sprintf(body[iFile - 1].cName, "%d", iFile); + fvFormattedString(&body[iFile - 1].cName, "%d", iFile); } UpdateFoundOption(&files->Infile[iFile], options, lTmp, iFile); } else if (iFile > 0) { - sprintf(body[iFile - 1].cName, "%d", iFile); + body[iFile-1].cName=NULL; + fvFormattedString(&body[iFile - 1].cName, "%d", iFile); } } @@ -1605,10 +1535,12 @@ void ReadColor(BODY *body, CONTROL *control, FILES *files, OPTIONS *options, if (lTmp >= 0) { NotPrimaryInput(iFile, options->cName, files->Infile[iFile].cIn, lTmp, control->Io.iVerbose); - strcpy(body[iFile - 1].sColor, cTmp); + body[iFile-1].sColor = NULL; + fvFormattedString(&body[iFile - 1].sColor, cTmp); UpdateFoundOption(&files->Infile[iFile], options, lTmp, iFile); } else if (iFile > 0) { - strcpy(body[iFile - 1].sColor, options->cDefault); + body[iFile-1].sColor = NULL; + fvFormattedString(&body[iFile - 1].sColor, options->cDefault); } } @@ -2142,7 +2074,7 @@ void ReadLogFile(BODY *body, CONTROL *control, FILES *files, OPTIONS *options, if (lTmp >= 0) { CheckDuplication(files, options, files->Infile[iFile].cIn, lTmp, control->Io.iVerbose); - strcpy(files->cLog, cTmp); + fvFormattedString(&files->cLog, cTmp); UpdateFoundOption(&files->Infile[iFile], options, lTmp, iFile); } else { /* Assign Default */ @@ -2155,7 +2087,7 @@ void ReadLogFile(BODY *body, CONTROL *control, FILES *files, OPTIONS *options, } } /* Wasn't entered, assign default */ - sprintf(files->cLog, "%s.log", system->cName); + fvFormattedString(&files->cLog, "%s.log", system->cName); } } @@ -2653,16 +2585,19 @@ void ReadCosObl(BODY *body, CONTROL *control, FILES *files, OPTIONS *options, void ReadOutputOrder(FILES *files, MODULE *module, OPTIONS *options, OUTPUT *output, int iFile, int iVerbose) { - int i, j, count, iLen, iNumIndices = 0, bNeg[MAXARRAY], ok = 1, iNumGrid = 0; - int k, iOut = -1, *lTmp, iCol, jCol; - char saTmp[MAXARRAY][OPTLEN], cTmp[OPTLEN], cOption[MAXARRAY][OPTLEN], - cOut[OPTLEN]; + int i, j, count, iLen, iNumIndices = 0, bNeg[MAXARRAY], ok = 1, iNumGrid = 0,iOption; + int k, iOut = -1, *lTmp, iCol, jCol; + char **saTmp, *cTmp = NULL, **cOption, *cOut = NULL; int iLen1, iLen2; - lTmp = malloc(MAXLINES * sizeof(int)); + lTmp = malloc(MAXLINES * sizeof(int)); + cOption = malloc(MAXARRAY * sizeof(char *)); + for (iOption=0;iOptionInfile[iFile].cIn, options[OPT_OUTPUTORDER].cName, - saTmp, &iNumIndices, &files->Infile[iFile].iNumLines, + &saTmp, &iNumIndices, &files->Infile[iFile].iNumLines, lTmp, iVerbose); if (lTmp[0] >= 0) { @@ -2697,22 +2632,22 @@ void ReadOutputOrder(FILES *files, MODULE *module, OPTIONS *options, /* Check for ambiguity */ for (i = 0; i < iNumIndices; i++) { count = 0; /* Number of possibilities */ - for (j = 0; j < OPTLEN; j++) { - cTmp[j] = 0; - } - strcpy(cTmp, saTmp[i]); + // for (j = 0; j < OPTLEN; j++) { + // cTmp[j] = 0; + // } + fvFormattedString(&cTmp, saTmp[i]); for (j = 0; j < MODULEOUTEND; j++) { - for (k = 0; k < OPTLEN; k++) { - cOut[k] = 0; - } - strcpy(cOut, output[j].cName); + // for (k = 0; k < OPTLEN; k++) { + // cOut[k] = 0; + // } + fvFormattedString(&cOut, output[j].cName); iLen1 = strlen(cOut); iLen2 = strlen(cTmp); /* Check for perfect match */ if ((iLen1 == iLen2) && (memcmp(sLower(cTmp), sLower(cOut), strlen(cOut)) == 0)) { /* Output option found! */ - strcpy(cOption[count], output[j].cName); + fvFormattedString(&cOption[count], output[j].cName); count = 1; iOut = j; if (output[j].bGrid == 1) { @@ -2729,7 +2664,7 @@ void ReadOutputOrder(FILES *files, MODULE *module, OPTIONS *options, if (memcmp(sLower(cTmp), sLower(cOut), iLen) == 0 && iLen1 > iLen2) { /* Output option found! */ - strcpy(cOption[count], output[j].cName); + fvFormattedString(&cOption[count], output[j].cName); count++; iOut = j; if (output[j].bGrid == 1) { @@ -2787,12 +2722,12 @@ void ReadOutputOrder(FILES *files, MODULE *module, OPTIONS *options, output[iOut].bDoNeg[iFile - 1] = 0; } if (output[iOut].bGrid == 0 || output[iOut].bGrid == 2) { - memset(files->Outfile[iFile - 1].caCol[i], '\0', OPTLEN); - strcpy(files->Outfile[iFile - 1].caCol[i], output[iOut].cName); + fvFormattedString(&files->Outfile[iFile - 1].caCol[i], + output[iOut].cName); } else { memset(files->Outfile[iFile - 1].caGrid[iNumGrid - 1], '\0', OPTLEN); - strcpy(files->Outfile[iFile - 1].caGrid[iNumGrid - 1], - output[iOut].cName); + fvFormattedString(&files->Outfile[iFile - 1].caGrid[iNumGrid - 1], + output[iOut].cName); } // Is option part of selected modules? if (module->iBitSum[iFile - 1] & output[iOut].iModuleBit) { @@ -2852,20 +2787,27 @@ void ReadOutputOrder(FILES *files, MODULE *module, OPTIONS *options, } free(lTmp); + free(cTmp); + free(cOption); + free(saTmp); + free(cOut); } void ReadGridOutput(FILES *files, OPTIONS *options, OUTPUT *output, int iFile, int iVerbose) { - int i, j, count, iLen, iNumIndices = 0, bNeg[MAXARRAY], ok = 0, iNumGrid = 0; + int i, j, count, iLen, iNumIndices = 0, bNeg[MAXARRAY], ok = 0, iNumGrid = 0,iOption; int k, iOut = -1, *lTmp; - char saTmp[MAXARRAY][OPTLEN], cTmp[OPTLEN], cOption[MAXARRAY][OPTLEN], - cOut[OPTLEN]; + char **saTmp, *cTmp=NULL, **cOption, *cOut=NULL; int iLen1, iLen2; - lTmp = malloc(MAXLINES * sizeof(int)); + lTmp = malloc(MAXLINES * sizeof(int)); + cOption = malloc(MAXARRAY * sizeof(char *)); + for (iOption=0;iOptionInfile[iFile].cIn, options[OPT_GRIDOUTPUT].cName, - saTmp, &iNumIndices, &files->Infile[iFile].iNumLines, + &saTmp, &iNumIndices, &files->Infile[iFile].iNumLines, lTmp, iVerbose); if (lTmp[0] >= 0) { @@ -2890,28 +2832,28 @@ void ReadGridOutput(FILES *files, OPTIONS *options, OUTPUT *output, int iFile, /* Check for ambiguity */ for (i = 0; i < iNumIndices; i++) { count = 0; /* Number of possibilities */ - for (j = 0; j < OPTLEN; j++) { - cTmp[j] = 0; - } - strcpy(cTmp, saTmp[i]); + // for (j = 0; j < OPTLEN; j++) { + // cTmp[j] = 0; + // } + fvFormattedString(&cTmp, saTmp[i]); for (j = 0; j < MODULEOUTEND; j++) { - for (k = 0; k < OPTLEN; k++) { - cOut[k] = 0; - } - strcpy(cOut, output[j].cName); + // for (k = 0; k < OPTLEN; k++) { + // cOut[k] = 0; + // } + fvFormattedString(&cOut, output[j].cName); iLen1 = strlen(cOut); iLen2 = strlen(cTmp); /* Check for perfect match */ if ((iLen1 == iLen2) && (memcmp(sLower(cTmp), sLower(cOut), strlen(cOut)) == 0)) { /* Output option found! */ - strcpy(cOption[count], output[j].cName); + fvFormattedString(&cOption[count], output[j].cName); count = 1; iOut = j; if (output[j].bGrid == 1 || output[j].bGrid == 2) { iNumGrid += 1; } - j = MODULEOUTEND; /* Poor man's break! */ + j = MODULEOUTEND; /* Break! */ } else { if (iLen1 < iLen2) { iLen = iLen1; @@ -2921,7 +2863,7 @@ void ReadGridOutput(FILES *files, OPTIONS *options, OUTPUT *output, int iFile, if (memcmp(sLower(cTmp), sLower(cOut), iLen) == 0 && iLen1 > iLen2) { /* Output option found! */ - strcpy(cOption[count], output[j].cName); + fvFormattedString(&cOption[count], output[j].cName); count++; iOut = j; if (output[j].bGrid == 1 || output[j].bGrid == 2) { @@ -2979,16 +2921,15 @@ void ReadGridOutput(FILES *files, OPTIONS *options, OUTPUT *output, int iFile, } if (output[iOut].bGrid == 0) { memset(files->Outfile[iFile - 1].caCol[i], '\0', OPTLEN); - strcpy(files->Outfile[iFile - 1].caCol[i], output[iOut].cName); + fvFormattedString(&files->Outfile[iFile - 1].caCol[i], + output[iOut].cName); } else { - memset(files->Outfile[iFile - 1].caGrid[iNumGrid - 1], '\0', OPTLEN); - strcpy(files->Outfile[iFile - 1].caGrid[iNumGrid - 1], - output[iOut].cName); + fvFormattedString(&files->Outfile[iFile - 1].caGrid[iNumGrid - 1], + output[iOut].cName); } } } - // files->Outfile[iFile-1].iNumGrid = iNumGrid; UpdateFoundOptionMulti(&files->Infile[iFile], &options[OPT_GRIDOUTPUT], lTmp, files->Infile[iFile].iNumLines, iFile); } @@ -2996,6 +2937,8 @@ void ReadGridOutput(FILES *files, OPTIONS *options, OUTPUT *output, int iFile, files->Outfile[iFile - 1].iNumGrid = iNumGrid; free(lTmp); + free(cTmp); + free(cOption); } void ReadOverwrite(BODY *body, CONTROL *control, FILES *files, OPTIONS *options, @@ -3628,6 +3571,8 @@ void ReadOptions(BODY **body, CONTROL *control, FILES *files, MODULE *module, ReadInitialOptions(body, control, files, module, options, output, system, infile); + InitializeSystem(*body, control,system); + /* Now that we know how many bodies there are, initialize more features */ *update = malloc(control->Evolve.iNumBodies * sizeof(UPDATE)); @@ -3637,7 +3582,7 @@ void ReadOptions(BODY **body, CONTROL *control, FILES *files, MODULE *module, /* Initialize module control */ InitializeControl(control, module); - /* Now read in remaining options */ + /* Now read in multi-module options */ ReadOptionsGeneral(*body, control, files, module, options, output, system, fnRead); @@ -3658,9 +3603,10 @@ void InitializeOptionsGeneral(OPTIONS *options, fnReadOption fnRead[]) { /* Do System Name first as it is used by other options. */ - sprintf(options[OPT_SYSTEMNAME].cName, "sSystemName"); - sprintf(options[OPT_SYSTEMNAME].cDescr, "System Name"); - sprintf(options[OPT_SYSTEMNAME].cDefault, "None - must be supplied"); + fvFormattedString(&options[OPT_SYSTEMNAME].cName, "sSystemName"); + fvFormattedString(&options[OPT_SYSTEMNAME].cDescr, "System Name"); + fvFormattedString(&options[OPT_SYSTEMNAME].cDefault, + "None - must be supplied"); options[OPT_SYSTEMNAME].iModuleBit = 0; options[OPT_SYSTEMNAME].iType = 3; options[OPT_SYSTEMNAME].iFileType = 0; @@ -3672,11 +3618,11 @@ void InitializeOptionsGeneral(OPTIONS *options, fnReadOption fnRead[]) { * */ - sprintf(options[OPT_AGE].cName, "dAge"); - sprintf(options[OPT_AGE].cDescr, "System Age"); - sprintf(options[OPT_AGE].cDefault, "0"); - sprintf(options[OPT_AGE].cNeg, "Gyr"); - sprintf(options[OPT_AGE].cDimension, "time"); + fvFormattedString(&options[OPT_AGE].cName, "dAge"); + fvFormattedString(&options[OPT_AGE].cDescr, "System Age"); + fvFormattedString(&options[OPT_AGE].cDefault, "0"); + fvFormattedString(&options[OPT_AGE].cNeg, "Gyr"); + fvFormattedString(&options[OPT_AGE].cDimension, "time"); options[OPT_AGE].dDefault = 0; options[OPT_AGE].iType = 2; options[OPT_AGE].iModuleBit = 0; @@ -3685,10 +3631,11 @@ void InitializeOptionsGeneral(OPTIONS *options, fnReadOption fnRead[]) { options[OPT_AGE].iFileType = 2; fnRead[OPT_AGE] = &ReadAge; - sprintf(options[OPT_ALBEDOGLOBAL].cName, "dAlbedoGlobal"); - sprintf(options[OPT_ALBEDOGLOBAL].cDescr, "Globally averaged albedo"); - sprintf(options[OPT_ALBEDOGLOBAL].cDefault, "0.3"); - sprintf(options[OPT_ALBEDOGLOBAL].cDimension, "nd"); + fvFormattedString(&options[OPT_ALBEDOGLOBAL].cName, "dAlbedoGlobal"); + fvFormattedString(&options[OPT_ALBEDOGLOBAL].cDescr, + "Globally averaged albedo"); + fvFormattedString(&options[OPT_ALBEDOGLOBAL].cDefault, "0.3"); + fvFormattedString(&options[OPT_ALBEDOGLOBAL].cDimension, "nd"); options[OPT_ALBEDOGLOBAL].dDefault = 0; options[OPT_ALBEDOGLOBAL].bMultiFile = 1; options[OPT_ALBEDOGLOBAL].iType = 2; @@ -3703,18 +3650,18 @@ void InitializeOptionsGeneral(OPTIONS *options, fnReadOption fnRead[]) { * */ - sprintf(options[OPT_BACK].cName, "bDoBackward"); - sprintf(options[OPT_BACK].cDescr, "Do Backward Integration?"); - sprintf(options[OPT_BACK].cDefault, "No"); + fvFormattedString(&options[OPT_BACK].cName, "bDoBackward"); + fvFormattedString(&options[OPT_BACK].cDescr, "Do Backward Integration?"); + fvFormattedString(&options[OPT_BACK].cDefault, "No"); options[OPT_BACK].iType = 0; options[OPT_BACK].iModuleBit = 0; options[OPT_BACK].bNeg = 0; options[OPT_BACK].iFileType = 2; fnRead[OPT_BACK] = &ReadDoBackward; - sprintf(options[OPT_OUTFILE].cName, "sOutFile"); - sprintf(options[OPT_OUTFILE].cDescr, "Name of Output File"); - sprintf(options[OPT_OUTFILE].cDefault, "cSystemName.backward"); + fvFormattedString(&options[OPT_OUTFILE].cName, "sOutFile"); + fvFormattedString(&options[OPT_OUTFILE].cDescr, "Name of Output File"); + fvFormattedString(&options[OPT_OUTFILE].cDefault, "cSystemName.backward"); options[OPT_OUTFILE].iType = 3; options[OPT_OUTFILE].bMultiFile = 1; options[OPT_OUTFILE].iModuleBit = 0; @@ -3722,27 +3669,28 @@ void InitializeOptionsGeneral(OPTIONS *options, fnReadOption fnRead[]) { options[OPT_OUTFILE].iFileType = 2; fnRead[OPT_OUTFILE] = &ReadOutFile; - sprintf(options[OPT_ETA].cName, "dEta"); - sprintf(options[OPT_ETA].cDescr, "Variable Time Step Coefficient"); - sprintf(options[OPT_ETA].cDefault, "1"); - sprintf(options[OPT_ETA].cDimension, "nd"); + fvFormattedString(&options[OPT_ETA].cName, "dEta"); + fvFormattedString(&options[OPT_ETA].cDescr, "Variable Time Step Coefficient"); + fvFormattedString(&options[OPT_ETA].cDefault, "1"); + fvFormattedString(&options[OPT_ETA].cDimension, "nd"); options[OPT_ETA].dDefault = 1; options[OPT_ETA].iType = 2; options[OPT_ETA].iModuleBit = 0; options[OPT_ETA].bNeg = 0; options[OPT_ETA].iFileType = 2; fnRead[OPT_ETA] = &ReadEta; - sprintf(options[OPT_ETA].cLongDescr, - "The timestep will be set to %s times the smallest instantaneous " - "timescale, \n" - "i.e. min(x/(dx/dt) where x represents the primary variables.", - options[OPT_ETA].cName); - - sprintf(options[OPT_OUTPUTTIME].cName, "dOutputTime"); - sprintf(options[OPT_OUTPUTTIME].cDescr, "Output Interval"); - sprintf(options[OPT_OUTPUTTIME].cDefault, "1 year"); - sprintf(options[OPT_OUTPUTTIME].cNeg, "Years"); - sprintf(options[OPT_OUTPUTTIME].cDimension, "time"); + fvFormattedString( + &options[OPT_ETA].cLongDescr, + "The timestep will be set to %s times the smallest instantaneous " + "timescale, \n" + "i.e. min(x/(dx/dt) where x represents the primary variables.", + options[OPT_ETA].cName); + + fvFormattedString(&options[OPT_OUTPUTTIME].cName, "dOutputTime"); + fvFormattedString(&options[OPT_OUTPUTTIME].cDescr, "Output Interval"); + fvFormattedString(&options[OPT_OUTPUTTIME].cDefault, "1 year"); + fvFormattedString(&options[OPT_OUTPUTTIME].cNeg, "Years"); + fvFormattedString(&options[OPT_OUTPUTTIME].cDimension, "time"); options[OPT_OUTPUTTIME].dDefault = YEARSEC; options[OPT_OUTPUTTIME].iType = 2; options[OPT_OUTPUTTIME].iModuleBit = 0; @@ -3751,11 +3699,11 @@ void InitializeOptionsGeneral(OPTIONS *options, fnReadOption fnRead[]) { options[OPT_OUTPUTTIME].iFileType = 2; fnRead[OPT_OUTPUTTIME] = &ReadOutputTime; - sprintf(options[OPT_STOPTIME].cName, "dStopTime"); - sprintf(options[OPT_STOPTIME].cDescr, "Integration Stop Time"); - sprintf(options[OPT_STOPTIME].cDefault, "10 years"); - sprintf(options[OPT_STOPTIME].cNeg, "Years"); - sprintf(options[OPT_STOPTIME].cDimension, "time"); + fvFormattedString(&options[OPT_STOPTIME].cName, "dStopTime"); + fvFormattedString(&options[OPT_STOPTIME].cDescr, "Integration Stop Time"); + fvFormattedString(&options[OPT_STOPTIME].cDefault, "10 years"); + fvFormattedString(&options[OPT_STOPTIME].cNeg, "Years"); + fvFormattedString(&options[OPT_STOPTIME].cDimension, "time"); options[OPT_STOPTIME].dDefault = 10 * YEARSEC; options[OPT_STOPTIME].iType = 2; options[OPT_STOPTIME].iModuleBit = 0; @@ -3764,11 +3712,11 @@ void InitializeOptionsGeneral(OPTIONS *options, fnReadOption fnRead[]) { options[OPT_STOPTIME].iFileType = 2; fnRead[OPT_STOPTIME] = &ReadStopTime; - sprintf(options[OPT_TIMESTEP].cName, "dTimeStep"); - sprintf(options[OPT_TIMESTEP].cDescr, "Integration Timestep"); - sprintf(options[OPT_TIMESTEP].cDefault, "1 year"); - sprintf(options[OPT_TIMESTEP].cNeg, "Years"); - sprintf(options[OPT_TIMESTEP].cDimension, "time"); + fvFormattedString(&options[OPT_TIMESTEP].cName, "dTimeStep"); + fvFormattedString(&options[OPT_TIMESTEP].cDescr, "Integration Timestep"); + fvFormattedString(&options[OPT_TIMESTEP].cDefault, "1 year"); + fvFormattedString(&options[OPT_TIMESTEP].cNeg, "Years"); + fvFormattedString(&options[OPT_TIMESTEP].cDimension, "time"); options[OPT_TIMESTEP].dDefault = YEARSEC; options[OPT_TIMESTEP].iType = 2; options[OPT_TIMESTEP].iModuleBit = 0; @@ -3777,26 +3725,28 @@ void InitializeOptionsGeneral(OPTIONS *options, fnReadOption fnRead[]) { options[OPT_TIMESTEP].iFileType = 2; fnRead[OPT_TIMESTEP] = &ReadTimeStep; - sprintf(options[OPT_VARDT].cName, "bVarDt"); - sprintf(options[OPT_VARDT].cDescr, "Use variable timestep?"); - sprintf(options[OPT_VARDT].cDefault, "None"); + fvFormattedString(&options[OPT_VARDT].cName, "bVarDt"); + fvFormattedString(&options[OPT_VARDT].cDescr, "Use variable timestep?"); + fvFormattedString(&options[OPT_VARDT].cDefault, "None"); options[OPT_VARDT].iType = 0; options[OPT_VARDT].iModuleBit = 0; options[OPT_VARDT].bNeg = 0; options[OPT_VARDT].iFileType = 2; fnRead[OPT_VARDT] = &ReadVarDt; - sprintf(options[OPT_BODYFILES].cName, "saBodyFiles"); - sprintf(options[OPT_BODYFILES].cDescr, "Input files for each body"); - sprintf(options[OPT_BODYFILES].cDefault, "None"); + fvFormattedString(&options[OPT_BODYFILES].cName, "saBodyFiles"); + fvFormattedString(&options[OPT_BODYFILES].cDescr, + "Input files for each body"); + fvFormattedString(&options[OPT_BODYFILES].cDefault, "None"); options[OPT_BODYFILES].iModuleBit = 0; options[OPT_BODYFILES].bNeg = 0; options[OPT_BODYFILES].iFileType = 0; options[OPT_BODYFILES].iType = 13; - sprintf(options[OPT_BODYNAME].cName, "sName"); - sprintf(options[OPT_BODYNAME].cDescr, "Body's Name"); - sprintf(options[OPT_BODYNAME].cDefault, "Integer of Input Order, i.e. 1"); + fvFormattedString(&options[OPT_BODYNAME].cName, "sName"); + fvFormattedString(&options[OPT_BODYNAME].cDescr, "Body's Name"); + fvFormattedString(&options[OPT_BODYNAME].cDefault, + "Integer of Input Order, i.e. 1"); options[OPT_BODYNAME].iType = 3; options[OPT_BODYNAME].iModuleBit = 0; options[OPT_BODYNAME].bNeg = 0; @@ -3809,10 +3759,10 @@ void InitializeOptionsGeneral(OPTIONS *options, fnReadOption fnRead[]) { * */ - sprintf(options[OPT_COLOR].cName, "sColor"); - sprintf(options[OPT_COLOR].cDescr, - "Hexadecimal color code for the body to be used in vplot"); - sprintf(options[OPT_COLOR].cDefault, "000000"); + fvFormattedString(&options[OPT_COLOR].cName, "sColor"); + fvFormattedString(&options[OPT_COLOR].cDescr, + "Hexadecimal color code for the body to be used in vplot"); + fvFormattedString(&options[OPT_COLOR].cDefault, "000000"); options[OPT_COLOR].iType = 3; options[OPT_COLOR].iModuleBit = 0; options[OPT_COLOR].bNeg = 0; @@ -3830,18 +3780,19 @@ void InitializeOptionsGeneral(OPTIONS *options, fnReadOption fnRead[]) { * */ - sprintf(options[OPT_FORW].cName, "bDoForward"); - sprintf(options[OPT_FORW].cDescr, "Do Forward Integration?"); - sprintf(options[OPT_FORW].cDefault, "0"); + fvFormattedString(&options[OPT_FORW].cName, "bDoForward"); + fvFormattedString(&options[OPT_FORW].cDescr, "Do Forward Integration?"); + fvFormattedString(&options[OPT_FORW].cDefault, "0"); options[OPT_FORW].iType = 0; options[OPT_FORW].iModuleBit = 0; options[OPT_FORW].bNeg = 0; options[OPT_FORW].iFileType = 2; fnRead[OPT_FORW] = &ReadDoForward; - sprintf(options[OPT_GRCORR].cName, "bGRCorr"); - sprintf(options[OPT_GRCORR].cDescr, "Use general relativity correction"); - sprintf(options[OPT_GRCORR].cDefault, "0"); + fvFormattedString(&options[OPT_GRCORR].cName, "bGRCorr"); + fvFormattedString(&options[OPT_GRCORR].cDescr, + "Use general relativity correction"); + fvFormattedString(&options[OPT_GRCORR].cDefault, "0"); options[OPT_GRCORR].dDefault = 0; options[OPT_GRCORR].iType = 0; options[OPT_GRCORR].bMultiFile = 1; @@ -3856,11 +3807,11 @@ void InitializeOptionsGeneral(OPTIONS *options, fnReadOption fnRead[]) { * */ - sprintf(options[OPT_HALTMAXECC].cName, "dHaltMaxEcc"); - sprintf(options[OPT_HALTMAXECC].cDescr, - "Maximum eccentricity value that halts ntegration"); - sprintf(options[OPT_HALTMAXECC].cDefault, "1"); - sprintf(options[OPT_HALTMAXECC].cDimension, "nd"); + fvFormattedString(&options[OPT_HALTMAXECC].cName, "dHaltMaxEcc"); + fvFormattedString(&options[OPT_HALTMAXECC].cDescr, + "Maximum eccentricity value that halts ntegration"); + fvFormattedString(&options[OPT_HALTMAXECC].cDefault, "1"); + fvFormattedString(&options[OPT_HALTMAXECC].cDimension, "nd"); options[OPT_HALTMAXECC].dDefault = 1; options[OPT_HALTMAXECC].iType = 2; options[OPT_HALTMAXECC].iModuleBit = EQTIDE + DISTORB; @@ -3868,19 +3819,19 @@ void InitializeOptionsGeneral(OPTIONS *options, fnReadOption fnRead[]) { options[OPT_HALTMAXECC].iFileType = 2; fnRead[OPT_HALTMAXECC] = &ReadHaltMaxEcc; - sprintf(options[OPT_HALTMAXMUTUALINC].cName, "dHaltMaxMutualInc"); - sprintf(options[OPT_HALTMAXMUTUALINC].cDescr, - "Maximum mutual inclination value that halts integration"); - sprintf(options[OPT_HALTMAXMUTUALINC].cDefault, "0 [not checked]"); - sprintf(options[OPT_HALTMAXMUTUALINC].cDimension, "angle"); + fvFormattedString(&options[OPT_HALTMAXMUTUALINC].cName, "dHaltMaxMutualInc"); + fvFormattedString(&options[OPT_HALTMAXMUTUALINC].cDescr, + "Maximum mutual inclination value that halts integration"); + fvFormattedString(&options[OPT_HALTMAXMUTUALINC].cDefault, "0 [not checked]"); + fvFormattedString(&options[OPT_HALTMAXMUTUALINC].cDimension, "angle"); options[OPT_HALTMAXMUTUALINC].dDefault = 0; options[OPT_HALTMAXMUTUALINC].iType = 2; options[OPT_HALTMAXMUTUALINC].iModuleBit = SPINBODY + DISTORB; options[OPT_HALTMAXMUTUALINC].bNeg = 0; options[OPT_HALTMAXMUTUALINC].iFileType = 2; fnRead[OPT_HALTMAXMUTUALINC] = &ReadHaltMaxMutualInc; - sprintf( - options[OPT_HALTMAXMUTUALINC].cLongDescr, + fvFormattedString( + &options[OPT_HALTMAXMUTUALINC].cLongDescr, "The execution halts when dHaltMaxMutualInc is reached. The mutual " "(or\n" "relative) inclination is the value of the angle between the orbital\n" @@ -3898,21 +3849,21 @@ void InitializeOptionsGeneral(OPTIONS *options, fnReadOption fnRead[]) { options[OPT_ORBITMODEL].cName, ((double)MAXMUTUALINCRD4), options[OPT_ORBITMODEL].cName, ((double)MAXMUTUALINCLL2)); - sprintf(options[OPT_HALTMERGE].cName, "bHaltMerge"); - sprintf(options[OPT_HALTMERGE].cDescr, "Halt at Merge"); - sprintf(options[OPT_HALTMERGE].cDefault, - "If eqtide or distorb called 1, else 0"); + fvFormattedString(&options[OPT_HALTMERGE].cName, "bHaltMerge"); + fvFormattedString(&options[OPT_HALTMERGE].cDescr, "Halt at Merge"); + fvFormattedString(&options[OPT_HALTMERGE].cDefault, + "If eqtide or distorb called 1, else 0"); options[OPT_HALTMERGE].iType = 0; options[OPT_HALTMERGE].iModuleBit = EQTIDE + DISTORB + SPINBODY + STELLAR; options[OPT_HALTMERGE].bNeg = 0; options[OPT_HALTMERGE].iFileType = 2; fnRead[OPT_HALTMERGE] = &ReadHaltMerge; - sprintf(options[OPT_HALTMINECC].cName, "dHaltMinEcc"); - sprintf(options[OPT_HALTMINECC].cDescr, - "Minimum Eccentricity Value that Halts Integration"); - sprintf(options[OPT_HALTMINECC].cDefault, "-1"); - sprintf(options[OPT_HALTMINECC].cDimension, "nd"); + fvFormattedString(&options[OPT_HALTMINECC].cName, "dHaltMinEcc"); + fvFormattedString(&options[OPT_HALTMINECC].cDescr, + "Minimum Eccentricity Value that Halts Integration"); + fvFormattedString(&options[OPT_HALTMINECC].cDefault, "-1"); + fvFormattedString(&options[OPT_HALTMINECC].cDimension, "nd"); options[OPT_HALTMINECC].dDefault = -1; options[OPT_HALTMINECC].iType = 2; options[OPT_HALTMINECC].iModuleBit = EQTIDE + SPINBODY + DISTORB; @@ -3920,11 +3871,11 @@ void InitializeOptionsGeneral(OPTIONS *options, fnReadOption fnRead[]) { options[OPT_HALTMINECC].iFileType = 2; fnRead[OPT_HALTMINECC] = &ReadHaltMinEcc; - sprintf(options[OPT_HALTMINOBL].cName, "dHaltMinObl"); - sprintf(options[OPT_HALTMINOBL].cDescr, - "Minimum Obliquity Value that Halts Integration"); - sprintf(options[OPT_HALTMINOBL].cDefault, "-1 degrees"); - sprintf(options[OPT_HALTMINOBL].cDimension, "angle"); + fvFormattedString(&options[OPT_HALTMINOBL].cName, "dHaltMinObl"); + fvFormattedString(&options[OPT_HALTMINOBL].cDescr, + "Minimum Obliquity Value that Halts Integration"); + fvFormattedString(&options[OPT_HALTMINOBL].cDefault, "-1 degrees"); + fvFormattedString(&options[OPT_HALTMINOBL].cDimension, "angle"); options[OPT_HALTMINOBL].dDefault = -DEGRAD; options[OPT_HALTMINOBL].iType = 2; options[OPT_HALTMINOBL].bMultiFile = 1; @@ -3933,12 +3884,12 @@ void InitializeOptionsGeneral(OPTIONS *options, fnReadOption fnRead[]) { options[OPT_HALTMINOBL].iFileType = 2; fnRead[OPT_HALTMINOBL] = &ReadHaltMinObl; - sprintf(options[OPT_HALTMINSEMI].cName, "dHaltMinSemi"); - sprintf(options[OPT_HALTMINSEMI].cDescr, - "Minimum Semi-Major Axis Value that Halts Integration"); - sprintf(options[OPT_HALTMINSEMI].cDefault, "0"); - sprintf(options[OPT_HALTMINSEMI].cNeg, "au"); - sprintf(options[OPT_HALTMINSEMI].cDimension, "length"); + fvFormattedString(&options[OPT_HALTMINSEMI].cName, "dHaltMinSemi"); + fvFormattedString(&options[OPT_HALTMINSEMI].cDescr, + "Minimum Semi-Major Axis Value that Halts Integration"); + fvFormattedString(&options[OPT_HALTMINSEMI].cDefault, "0"); + fvFormattedString(&options[OPT_HALTMINSEMI].cNeg, "au"); + fvFormattedString(&options[OPT_HALTMINSEMI].cDimension, "length"); options[OPT_HALTMINSEMI].dDefault = 0; options[OPT_HALTMINSEMI].iType = 2; options[OPT_HALTMINSEMI].dNeg = AUM; @@ -3947,10 +3898,10 @@ void InitializeOptionsGeneral(OPTIONS *options, fnReadOption fnRead[]) { options[OPT_HALTMINSEMI].iFileType = 2; fnRead[OPT_HALTMINSEMI] = &ReadHaltMinSemi; - sprintf(options[OPT_HALTPOSDEDT].cName, "bHaltPosDeDt"); - sprintf(options[OPT_HALTPOSDEDT].cDescr, "Halt if de/dt > 0?"); - sprintf(options[OPT_HALTPOSDEDT].cDefault, "0"); - sprintf(options[OPT_HALTPOSDEDT].cDimension, "time^-1"); + fvFormattedString(&options[OPT_HALTPOSDEDT].cName, "bHaltPosDeDt"); + fvFormattedString(&options[OPT_HALTPOSDEDT].cDescr, "Halt if de/dt > 0?"); + fvFormattedString(&options[OPT_HALTPOSDEDT].cDefault, "0"); + fvFormattedString(&options[OPT_HALTPOSDEDT].cDimension, "time^-1"); options[OPT_HALTPOSDEDT].iType = 0; options[OPT_HALTPOSDEDT].iModuleBit = EQTIDE + SPINBODY + DISTORB; options[OPT_HALTPOSDEDT].bNeg = 0; @@ -3963,10 +3914,10 @@ void InitializeOptionsGeneral(OPTIONS *options, fnReadOption fnRead[]) { * */ - sprintf(options[OPT_HECC].cName, "dHecc"); - sprintf(options[OPT_HECC].cDescr, "Poincare's h -- Unsupported!"); - sprintf(options[OPT_HECC].cDefault, "-1"); - sprintf(options[OPT_HECC].cDimension, "nd"); + fvFormattedString(&options[OPT_HECC].cName, "dHecc"); + fvFormattedString(&options[OPT_HECC].cDescr, "Poincare's h -- Unsupported!"); + fvFormattedString(&options[OPT_HECC].cDefault, "-1"); + fvFormattedString(&options[OPT_HECC].cDimension, "nd"); options[OPT_HECC].dDefault = -1; options[OPT_HECC].iType = 2; options[OPT_HECC].iModuleBit = DISTORB + SPINBODY; @@ -3980,10 +3931,12 @@ void InitializeOptionsGeneral(OPTIONS *options, fnReadOption fnRead[]) { * */ - sprintf(options[OPT_INTEGRATIONMETHOD].cName, "sIntegrationMethod"); - sprintf(options[OPT_INTEGRATIONMETHOD].cDescr, - "Integration Method: Euler, Runge-Kutta4 (Default = Runge-Kutta4)"); - sprintf(options[OPT_INTEGRATIONMETHOD].cDefault, "Runge-Kutta4"); + fvFormattedString(&options[OPT_INTEGRATIONMETHOD].cName, + "sIntegrationMethod"); + fvFormattedString( + &options[OPT_INTEGRATIONMETHOD].cDescr, + "Integration Method: Euler, Runge-Kutta4 (Default = Runge-Kutta4)"); + fvFormattedString(&options[OPT_INTEGRATIONMETHOD].cDefault, "Runge-Kutta4"); options[OPT_INTEGRATIONMETHOD].iType = 3; options[OPT_INTEGRATIONMETHOD].iModuleBit = 0; options[OPT_INTEGRATIONMETHOD].bNeg = 0; @@ -3998,9 +3951,9 @@ void InitializeOptionsGeneral(OPTIONS *options, fnReadOption fnRead[]) { /* Someday... - sprintf(options[OPT_KECC].cName,"dKecc"); - sprintf(options[OPT_KECC].cDescr,"Poincare's k -- Unsuppoted!"); - sprintf(options[OPT_KECC].cDefault,"-1"); + fvFormattedString(options[OPT_KECC].cName,"dKecc"); + fvFormattedString(options[OPT_KECC].cDescr,"Poincare's k -- Unsuppoted!"); + fvFormattedString(options[OPT_KECC].cDefault,"-1"); options[OPT_KECC].dDefault = -1; options[OPT_KECC].iType = 2; options[OPT_KECC].iModuleBit = DISTORB + SPINBODY; @@ -4016,29 +3969,28 @@ void InitializeOptionsGeneral(OPTIONS *options, fnReadOption fnRead[]) { * */ - sprintf(options[OPT_LOG].cName, "bDoLog"); - sprintf(options[OPT_LOG].cDescr, "Write Log File?"); - sprintf(options[OPT_LOG].cDefault, "0"); + fvFormattedString(&options[OPT_LOG].cName, "bDoLog"); + fvFormattedString(&options[OPT_LOG].cDescr, "Write Log File?"); + fvFormattedString(&options[OPT_LOG].cDefault, "0"); options[OPT_LOG].iType = 0; options[OPT_LOG].iModuleBit = 0; options[OPT_LOG].bNeg = 0; options[OPT_LOG].iFileType = 2; fnRead[OPT_LOG] = &ReadDoLog; - sprintf(options[OPT_LOGFILE].cName, "sLogFile"); - sprintf(options[OPT_LOGFILE].cDescr, "Log File Name"); - + fvFormattedString(&options[OPT_LOGFILE].cName, "sLogFile"); + fvFormattedString(&options[OPT_LOGFILE].cDescr, "Log File Name"); options[OPT_LOGFILE].iType = 3; options[OPT_LOGFILE].iModuleBit = 0; options[OPT_LOGFILE].bNeg = 0; options[OPT_LOGFILE].iFileType = 2; fnRead[OPT_LOGFILE] = &ReadLogFile; - sprintf(options[OPT_LONGP].cName, "dLongP"); - sprintf(options[OPT_LONGP].cDescr, - "Longitude of pericenter of planet's orbit"); - sprintf(options[OPT_LONGP].cDefault, "0"); - sprintf(options[OPT_LONGP].cDimension, "angle"); + fvFormattedString(&options[OPT_LONGP].cName, "dLongP"); + fvFormattedString(&options[OPT_LONGP].cDescr, + "Longitude of pericenter of planet's orbit"); + fvFormattedString(&options[OPT_LONGP].cDefault, "0"); + fvFormattedString(&options[OPT_LONGP].cDimension, "angle"); options[OPT_LONGP].dDefault = 0.0; options[OPT_LONGP].iType = 2; options[OPT_LONGP].bMultiFile = 1; @@ -4047,21 +3999,22 @@ void InitializeOptionsGeneral(OPTIONS *options, fnReadOption fnRead[]) { options[OPT_LONGP].iFileType = 1; fnRead[OPT_LONGP] = &ReadLongP; - sprintf(options[OPT_LUMINOSITY].cName, "dLuminosity"); - sprintf(options[OPT_LUMINOSITY].cDescr, "Initial Luminosity"); - sprintf(options[OPT_LUMINOSITY].cDefault, "0"); - sprintf(options[OPT_LUMINOSITY].cNeg, "LSUN"); - sprintf(options[OPT_LUMINOSITY].cDimension, "energy/time"); + fvFormattedString(&options[OPT_LUMINOSITY].cName, "dLuminosity"); + fvFormattedString(&options[OPT_LUMINOSITY].cDescr, "Initial Luminosity"); + fvFormattedString(&options[OPT_LUMINOSITY].cDefault, "0"); + fvFormattedString(&options[OPT_LUMINOSITY].cNeg, "LSUN"); + fvFormattedString(&options[OPT_LUMINOSITY].cDimension, "energy/time"); options[OPT_LUMINOSITY].dDefault = 0; options[OPT_LUMINOSITY].iType = 2; options[OPT_LUMINOSITY].bMultiFile = 1; options[OPT_LUMINOSITY].dNeg = LSUN; fnRead[OPT_LUMINOSITY] = &ReadLuminosity; - sprintf(options[OPT_LXUV].cName, "dLXUV"); - sprintf(options[OPT_LXUV].cDescr, "Total XUV Luminosity -- Unsupported!"); - sprintf(options[OPT_LXUV].cDefault, "-1"); - sprintf(options[OPT_LXUV].cDimension, "energy/time"); + fvFormattedString(&options[OPT_LXUV].cName, "dLXUV"); + fvFormattedString(&options[OPT_LXUV].cDescr, + "Total XUV Luminosity -- Unsupported!"); + fvFormattedString(&options[OPT_LXUV].cDefault, "-1"); + fvFormattedString(&options[OPT_LXUV].cDimension, "energy/time"); options[OPT_LXUV].dDefault = -1; options[OPT_LXUV].iType = 2; options[OPT_LXUV].iModuleBit = STELLAR; @@ -4075,11 +4028,11 @@ void InitializeOptionsGeneral(OPTIONS *options, fnReadOption fnRead[]) { * */ - sprintf(options[OPT_MINVALUE].cName, "dMinValue"); - sprintf(options[OPT_MINVALUE].cDescr, - "Minimum Non-Zero Value of Eccentricity and Obliquities"); - sprintf(options[OPT_MINVALUE].cDefault, "0"); - sprintf(options[OPT_MINVALUE].cDimension, "nd"); + fvFormattedString(&options[OPT_MINVALUE].cName, "dMinValue"); + fvFormattedString(&options[OPT_MINVALUE].cDescr, + "Minimum Non-Zero Value of Eccentricity and Obliquities"); + fvFormattedString(&options[OPT_MINVALUE].cDefault, "0"); + fvFormattedString(&options[OPT_MINVALUE].cDimension, "nd"); options[OPT_MINVALUE].dDefault = 0; options[OPT_MINVALUE].iType = 2; options[OPT_MINVALUE].iModuleBit = @@ -4088,16 +4041,16 @@ void InitializeOptionsGeneral(OPTIONS *options, fnReadOption fnRead[]) { options[OPT_MINVALUE].iFileType = 2; fnRead[OPT_MINVALUE] = &ReadMinValue; - sprintf(options[OPT_MODULES].cName, "saModules"); - sprintf(options[OPT_MODULES].cDescr, "Body's Module List"); - sprintf(options[OPT_MODULES].cDefault, "none"); + fvFormattedString(&options[OPT_MODULES].cName, "saModules"); + fvFormattedString(&options[OPT_MODULES].cDescr, "Body's Module List"); + fvFormattedString(&options[OPT_MODULES].cDefault, "none"); options[OPT_MODULES].dDefault = -1; options[OPT_MODULES].iModuleBit = 0; options[OPT_MODULES].bNeg = 0; options[OPT_MODULES].iFileType = 0; options[OPT_MODULES].iType = 13; - sprintf( - options[OPT_MODULES].cLongDescr, + fvFormattedString( + &options[OPT_MODULES].cLongDescr, "List of names of modules to be applied to the body. Spelling must be " "exact, but any capitalization works"); @@ -4113,51 +4066,52 @@ void InitializeOptionsGeneral(OPTIONS *options, fnReadOption fnRead[]) { * */ - sprintf(options[OPT_OUTDIGITS].cName, "iDigits"); - sprintf(options[OPT_OUTDIGITS].cDescr, - "Number of Digits After Decimal Point"); - sprintf(options[OPT_OUTDIGITS].cDefault, "4"); + fvFormattedString(&options[OPT_OUTDIGITS].cName, "iDigits"); + fvFormattedString(&options[OPT_OUTDIGITS].cDescr, + "Number of Digits After Decimal Point"); + fvFormattedString(&options[OPT_OUTDIGITS].cDefault, "4"); options[OPT_OUTDIGITS].iType = 1; options[OPT_OUTDIGITS].iModuleBit = 0; options[OPT_OUTDIGITS].bNeg = 0; options[OPT_OUTDIGITS].iFileType = 2; fnRead[OPT_OUTDIGITS] = &ReadDigits; - sprintf( - options[OPT_OUTDIGITS].cLongDescr, + fvFormattedString( + &options[OPT_OUTDIGITS].cLongDescr, "For all floating point output, print this many number of digits after " "the decimal point"); - sprintf(options[OPT_OUTPUTORDER].cName, "saOutputOrder"); - sprintf(options[OPT_OUTPUTORDER].cDescr, "Output Parameter(s)"); - sprintf(options[OPT_OUTPUTORDER].cDefault, "None"); + fvFormattedString(&options[OPT_OUTPUTORDER].cName, "saOutputOrder"); + fvFormattedString(&options[OPT_OUTPUTORDER].cDescr, "Output Parameter(s)"); + fvFormattedString(&options[OPT_OUTPUTORDER].cDefault, "None"); options[OPT_OUTPUTORDER].iType = 13; options[OPT_OUTPUTORDER].iModuleBit = 0; options[OPT_OUTPUTORDER].bNeg = 0; options[OPT_OUTPUTORDER].iFileType = 1; options[OPT_OUTPUTORDER].bMultiFile = 1; - sprintf(options[OPT_GRIDOUTPUT].cName, "saGridOutput"); - sprintf(options[OPT_GRIDOUTPUT].cDescr, "Gridded Output Parameter(s)"); - sprintf(options[OPT_GRIDOUTPUT].cDefault, "None"); + fvFormattedString(&options[OPT_GRIDOUTPUT].cName, "saGridOutput"); + fvFormattedString(&options[OPT_GRIDOUTPUT].cDescr, + "Gridded Output Parameter(s)"); + fvFormattedString(&options[OPT_GRIDOUTPUT].cDefault, "None"); options[OPT_GRIDOUTPUT].iType = 13; options[OPT_GRIDOUTPUT].iModuleBit = POISE; options[OPT_GRIDOUTPUT].bNeg = 0; options[OPT_GRIDOUTPUT].bMultiFile = 1; options[OPT_GRIDOUTPUT].iFileType = 1; - sprintf(options[OPT_OUTSCINOT].cName, "iSciNot"); - sprintf(options[OPT_OUTSCINOT].cDescr, - "Logarithm to Change from Standard to Scientific Notation"); - sprintf(options[OPT_OUTSCINOT].cDefault, "4"); + fvFormattedString(&options[OPT_OUTSCINOT].cName, "iSciNot"); + fvFormattedString(&options[OPT_OUTSCINOT].cDescr, + "Logarithm to Change from Standard to Scientific Notation"); + fvFormattedString(&options[OPT_OUTSCINOT].cDefault, "4"); options[OPT_OUTSCINOT].iType = 1; options[OPT_OUTSCINOT].iModuleBit = 0; options[OPT_OUTSCINOT].bNeg = 0; options[OPT_OUTSCINOT].iFileType = 2; fnRead[OPT_OUTSCINOT] = &ReadSciNot; - sprintf(options[OPT_OVERWRITE].cName, "bOverwrite"); - sprintf(options[OPT_OVERWRITE].cDescr, "Permit file overwrite?"); - sprintf(options[OPT_OVERWRITE].cDefault, "0"); + fvFormattedString(&options[OPT_OVERWRITE].cName, "bOverwrite"); + fvFormattedString(&options[OPT_OVERWRITE].cDescr, "Permit file overwrite?"); + fvFormattedString(&options[OPT_OVERWRITE].cDefault, "0"); options[OPT_OVERWRITE].iType = 0; options[OPT_OVERWRITE].iModuleBit = 0; options[OPT_OVERWRITE].bNeg = 0; @@ -4170,10 +4124,10 @@ void InitializeOptionsGeneral(OPTIONS *options, fnReadOption fnRead[]) { * */ - sprintf(options[OPT_ORBECC].cName, "dEcc"); - sprintf(options[OPT_ORBECC].cDescr, "Orbital Eccentricity"); - sprintf(options[OPT_ORBECC].cDefault, "0"); - sprintf(options[OPT_ORBECC].cDimension, "nd"); + fvFormattedString(&options[OPT_ORBECC].cName, "dEcc"); + fvFormattedString(&options[OPT_ORBECC].cDescr, "Orbital Eccentricity"); + fvFormattedString(&options[OPT_ORBECC].cDefault, "0"); + fvFormattedString(&options[OPT_ORBECC].cDimension, "nd"); options[OPT_ORBECC].dDefault = 0; options[OPT_ORBECC].iType = 2; options[OPT_ORBECC].iModuleBit = 0; @@ -4181,11 +4135,11 @@ void InitializeOptionsGeneral(OPTIONS *options, fnReadOption fnRead[]) { options[OPT_ORBECC].iFileType = 1; fnRead[OPT_ORBECC] = &ReadEcc; - sprintf(options[OPT_ORBMEANMOTION].cName, "dMeanMotion"); - sprintf(options[OPT_ORBMEANMOTION].cDescr, "Orbital Mean Motion"); - sprintf(options[OPT_ORBMEANMOTION].cDefault, "1 /yr"); - sprintf(options[OPT_ORBMEANMOTION].cNeg, "/Year"); - sprintf(options[OPT_ORBMEANMOTION].cDimension, "time^-1"); + fvFormattedString(&options[OPT_ORBMEANMOTION].cName, "dMeanMotion"); + fvFormattedString(&options[OPT_ORBMEANMOTION].cDescr, "Orbital Mean Motion"); + fvFormattedString(&options[OPT_ORBMEANMOTION].cDefault, "1 /yr"); + fvFormattedString(&options[OPT_ORBMEANMOTION].cNeg, "/Year"); + fvFormattedString(&options[OPT_ORBMEANMOTION].cDimension, "time^-1"); options[OPT_ORBMEANMOTION].dDefault = 1. / YEARSEC; options[OPT_ORBMEANMOTION].iType = 2; options[OPT_ORBMEANMOTION].dNeg = 1. / YEARSEC; @@ -4194,11 +4148,11 @@ void InitializeOptionsGeneral(OPTIONS *options, fnReadOption fnRead[]) { options[OPT_ORBMEANMOTION].iFileType = 1; fnRead[OPT_ORBMEANMOTION] = &ReadMeanMotion; - sprintf(options[OPT_ORBPER].cName, "dOrbPeriod"); - sprintf(options[OPT_ORBPER].cDescr, "Orbital Period"); - sprintf(options[OPT_ORBPER].cDefault, "1 year"); - sprintf(options[OPT_ORBPER].cNeg, "Days"); - sprintf(options[OPT_ORBPER].cDimension, "time"); + fvFormattedString(&options[OPT_ORBPER].cName, "dOrbPeriod"); + fvFormattedString(&options[OPT_ORBPER].cDescr, "Orbital Period"); + fvFormattedString(&options[OPT_ORBPER].cDefault, "1 year"); + fvFormattedString(&options[OPT_ORBPER].cNeg, "Days"); + fvFormattedString(&options[OPT_ORBPER].cDimension, "time"); options[OPT_ORBPER].dDefault = YEARSEC; options[OPT_ORBPER].iType = 2; options[OPT_ORBPER].dNeg = DAYSEC; @@ -4207,11 +4161,11 @@ void InitializeOptionsGeneral(OPTIONS *options, fnReadOption fnRead[]) { options[OPT_ORBPER].iFileType = 1; fnRead[OPT_ORBPER] = &ReadOrbPeriod; - sprintf(options[OPT_ORBSEMI].cName, "dSemi"); - sprintf(options[OPT_ORBSEMI].cDescr, "Semi-Major Axis"); - sprintf(options[OPT_ORBSEMI].cDefault, "1 AU"); - sprintf(options[OPT_ORBSEMI].cNeg, "AU"); - sprintf(options[OPT_ORBSEMI].cDimension, "length"); + fvFormattedString(&options[OPT_ORBSEMI].cName, "dSemi"); + fvFormattedString(&options[OPT_ORBSEMI].cDescr, "Semi-Major Axis"); + fvFormattedString(&options[OPT_ORBSEMI].cDefault, "1 AU"); + fvFormattedString(&options[OPT_ORBSEMI].cNeg, "AU"); + fvFormattedString(&options[OPT_ORBSEMI].cDimension, "length"); options[OPT_ORBSEMI].dDefault = AUM; options[OPT_ORBSEMI].iType = 2; options[OPT_ORBSEMI].dNeg = AUM; @@ -4221,11 +4175,12 @@ void InitializeOptionsGeneral(OPTIONS *options, fnReadOption fnRead[]) { options[OPT_ORBSEMI].iFileType = 1; fnRead[OPT_ORBSEMI] = &ReadSemiMajorAxis; - sprintf(options[OPT_INC].cName, "dInc"); - sprintf(options[OPT_INC].cDescr, "Inclination of planet's orbital plane"); - sprintf(options[OPT_INC].cDefault, "0"); - sprintf(options[OPT_INC].cNeg, "Degrees"); - sprintf(options[OPT_INC].cDimension, "angle"); + fvFormattedString(&options[OPT_INC].cName, "dInc"); + fvFormattedString(&options[OPT_INC].cDescr, + "Inclination of planet's orbital plane"); + fvFormattedString(&options[OPT_INC].cDefault, "0"); + fvFormattedString(&options[OPT_INC].cNeg, "Degrees"); + fvFormattedString(&options[OPT_INC].cDimension, "angle"); options[OPT_INC].dDefault = 0.0; options[OPT_INC].iType = 2; options[OPT_INC].bMultiFile = 1; @@ -4235,11 +4190,12 @@ void InitializeOptionsGeneral(OPTIONS *options, fnReadOption fnRead[]) { options[OPT_INC].iFileType = 1; fnRead[OPT_INC] = &ReadInc; - sprintf(options[OPT_ARGP].cName, "dArgP"); - sprintf(options[OPT_ARGP].cDescr, "Argument of pericenter of planet's orbit"); - sprintf(options[OPT_ARGP].cDefault, "0"); - sprintf(options[OPT_ARGP].cNeg, "Degrees"); - sprintf(options[OPT_ARGP].cDimension, "angle"); + fvFormattedString(&options[OPT_ARGP].cName, "dArgP"); + fvFormattedString(&options[OPT_ARGP].cDescr, + "Argument of pericenter of planet's orbit"); + fvFormattedString(&options[OPT_ARGP].cDefault, "0"); + fvFormattedString(&options[OPT_ARGP].cNeg, "Degrees"); + fvFormattedString(&options[OPT_ARGP].cDimension, "angle"); options[OPT_ARGP].dDefault = 0.0; options[OPT_ARGP].iType = 2; options[OPT_ARGP].bMultiFile = 1; @@ -4253,11 +4209,11 @@ void InitializeOptionsGeneral(OPTIONS *options, fnReadOption fnRead[]) { * P */ - sprintf(options[OPT_PRECA].cName, "dPrecA"); - sprintf(options[OPT_PRECA].cDescr, "Planet's precession angle"); - sprintf(options[OPT_PRECA].cDefault, "0"); - sprintf(options[OPT_PRECA].cNeg, "Degrees"); - sprintf(options[OPT_PRECA].cDimension, "angle"); + fvFormattedString(&options[OPT_PRECA].cName, "dPrecA"); + fvFormattedString(&options[OPT_PRECA].cDescr, "Planet's precession angle"); + fvFormattedString(&options[OPT_PRECA].cDefault, "0"); + fvFormattedString(&options[OPT_PRECA].cNeg, "Degrees"); + fvFormattedString(&options[OPT_PRECA].cDimension, "angle"); options[OPT_PRECA].dDefault = 0.0; options[OPT_PRECA].iType = 2; options[OPT_PRECA].bMultiFile = 1; @@ -4267,12 +4223,12 @@ void InitializeOptionsGeneral(OPTIONS *options, fnReadOption fnRead[]) { options[OPT_PRECA].iFileType = 1; fnRead[OPT_PRECA] = &ReadPrecA; - sprintf(options[OPT_LONGA].cName, "dLongA"); - sprintf(options[OPT_LONGA].cDescr, - "Longitude of ascending node of planet's orbital plane"); - sprintf(options[OPT_LONGA].cDefault, "0"); - sprintf(options[OPT_LONGA].cNeg, "Degrees"); - sprintf(options[OPT_LONGA].cDimension, "angle"); + fvFormattedString(&options[OPT_LONGA].cName, "dLongA"); + fvFormattedString(&options[OPT_LONGA].cDescr, + "Longitude of ascending node of planet's orbital plane"); + fvFormattedString(&options[OPT_LONGA].cDefault, "0"); + fvFormattedString(&options[OPT_LONGA].cNeg, "Degrees"); + fvFormattedString(&options[OPT_LONGA].cDimension, "angle"); options[OPT_LONGA].dDefault = 0.0; options[OPT_LONGA].iType = 2; options[OPT_LONGA].bMultiFile = 1; @@ -4282,10 +4238,11 @@ void InitializeOptionsGeneral(OPTIONS *options, fnReadOption fnRead[]) { options[OPT_LONGA].iFileType = 1; fnRead[OPT_LONGA] = &ReadLongA; - sprintf(options[OPT_DYNELLIP].cName, "dDynEllip"); - sprintf(options[OPT_DYNELLIP].cDescr, "Planet's dynamical ellipticity"); - sprintf(options[OPT_DYNELLIP].cDefault, "0.00328"); - sprintf(options[OPT_DYNELLIP].cDimension, "nd"); + fvFormattedString(&options[OPT_DYNELLIP].cName, "dDynEllip"); + fvFormattedString(&options[OPT_DYNELLIP].cDescr, + "Planet's dynamical ellipticity"); + fvFormattedString(&options[OPT_DYNELLIP].cDefault, "0.00328"); + fvFormattedString(&options[OPT_DYNELLIP].cDimension, "nd"); options[OPT_DYNELLIP].dDefault = 0.00328; options[OPT_DYNELLIP].iType = 2; options[OPT_DYNELLIP].bMultiFile = 1; @@ -4294,10 +4251,10 @@ void InitializeOptionsGeneral(OPTIONS *options, fnReadOption fnRead[]) { options[OPT_DYNELLIP].iFileType = 1; fnRead[OPT_DYNELLIP] = &ReadDynEllip; - sprintf(options[OPT_CALCDYNELLIP].cName, "bCalcDynEllip"); - sprintf(options[OPT_CALCDYNELLIP].cDescr, - "Calculate dynamical ellipticity from RotRate"); - sprintf(options[OPT_CALCDYNELLIP].cDefault, "0"); + fvFormattedString(&options[OPT_CALCDYNELLIP].cName, "bCalcDynEllip"); + fvFormattedString(&options[OPT_CALCDYNELLIP].cDescr, + "Calculate dynamical ellipticity from RotRate"); + fvFormattedString(&options[OPT_CALCDYNELLIP].cDefault, "0"); options[OPT_CALCDYNELLIP].dDefault = 0; options[OPT_CALCDYNELLIP].iType = 0; options[OPT_CALCDYNELLIP].bMultiFile = 1; @@ -4306,45 +4263,50 @@ void InitializeOptionsGeneral(OPTIONS *options, fnReadOption fnRead[]) { options[OPT_CALCDYNELLIP].iFileType = 1; fnRead[OPT_CALCDYNELLIP] = &ReadCalcDynEllip; - sprintf(options[OPT_SURFACEWATERMASS].cName, "dSurfWaterMass"); - sprintf(options[OPT_SURFACEWATERMASS].cDescr, "Initial Surface Water Mass"); - sprintf(options[OPT_SURFACEWATERMASS].cDefault, "0"); - sprintf(options[OPT_SURFACEWATERMASS].cNeg, "Terrestrial Oceans (TO)"); - sprintf(options[OPT_SURFACEWATERMASS].cDimension, "mass"); + fvFormattedString(&options[OPT_SURFACEWATERMASS].cName, "dSurfWaterMass"); + fvFormattedString(&options[OPT_SURFACEWATERMASS].cDescr, + "Initial Surface Water Mass"); + fvFormattedString(&options[OPT_SURFACEWATERMASS].cDefault, "0"); + fvFormattedString(&options[OPT_SURFACEWATERMASS].cNeg, + "Terrestrial Oceans (TO)"); + fvFormattedString(&options[OPT_SURFACEWATERMASS].cDimension, "mass"); options[OPT_SURFACEWATERMASS].dDefault = 0; options[OPT_SURFACEWATERMASS].iType = 2; options[OPT_SURFACEWATERMASS].bMultiFile = 1; options[OPT_SURFACEWATERMASS].dNeg = TOMASS; fnRead[OPT_SURFACEWATERMASS] = &ReadSurfaceWaterMass; - sprintf(options[OPT_MINSURFACEWATERMASS].cName, "dMinSurfWaterMass"); - sprintf(options[OPT_MINSURFACEWATERMASS].cDescr, - "Minimum Surface Water Mass"); - sprintf(options[OPT_MINSURFACEWATERMASS].cDefault, "1.e-5 TO"); - sprintf(options[OPT_MINSURFACEWATERMASS].cNeg, "Terrestrial Oceans (TO)"); - sprintf(options[OPT_MINSURFACEWATERMASS].cDimension, "mass"); + fvFormattedString(&options[OPT_MINSURFACEWATERMASS].cName, + "dMinSurfWaterMass"); + fvFormattedString(&options[OPT_MINSURFACEWATERMASS].cDescr, + "Minimum Surface Water Mass"); + fvFormattedString(&options[OPT_MINSURFACEWATERMASS].cDefault, "1.e-5 TO"); + fvFormattedString(&options[OPT_MINSURFACEWATERMASS].cNeg, + "Terrestrial Oceans (TO)"); + fvFormattedString(&options[OPT_MINSURFACEWATERMASS].cDimension, "mass"); options[OPT_MINSURFACEWATERMASS].dDefault = 1.e-5 * TOMASS; options[OPT_MINSURFACEWATERMASS].iType = 2; options[OPT_MINSURFACEWATERMASS].dNeg = TOMASS; options[OPT_MINSURFACEWATERMASS].bMultiFile = 1; fnRead[OPT_MINSURFACEWATERMASS] = &ReadMinSurfaceWaterMass; - sprintf(options[OPT_ENVELOPEMASS].cName, "dEnvelopeMass"); - sprintf(options[OPT_ENVELOPEMASS].cDescr, "Initial Envelope Mass"); - sprintf(options[OPT_ENVELOPEMASS].cDefault, "0"); - sprintf(options[OPT_ENVELOPEMASS].cNeg, "Mearth"); - sprintf(options[OPT_ENVELOPEMASS].cDimension, "mass"); + fvFormattedString(&options[OPT_ENVELOPEMASS].cName, "dEnvelopeMass"); + fvFormattedString(&options[OPT_ENVELOPEMASS].cDescr, "Initial Envelope Mass"); + fvFormattedString(&options[OPT_ENVELOPEMASS].cDefault, "0"); + fvFormattedString(&options[OPT_ENVELOPEMASS].cNeg, "Mearth"); + fvFormattedString(&options[OPT_ENVELOPEMASS].cDimension, "mass"); options[OPT_ENVELOPEMASS].dDefault = 0; options[OPT_ENVELOPEMASS].iType = 2; options[OPT_ENVELOPEMASS].bMultiFile = 1; options[OPT_ENVELOPEMASS].dNeg = MEARTH; fnRead[OPT_ENVELOPEMASS] = &ReadEnvelopeMass; - sprintf(options[OPT_MINENVELOPEMASS].cName, "dMinEnvelopeMass"); - sprintf(options[OPT_MINENVELOPEMASS].cDescr, "Minimum Envelope Mass"); - sprintf(options[OPT_MINENVELOPEMASS].cDefault, "1.e-8 Earth"); - sprintf(options[OPT_MINENVELOPEMASS].cNeg, "Mearth"); - sprintf(options[OPT_MINENVELOPEMASS].cDimension, "mass"); + fvFormattedString(&options[OPT_MINENVELOPEMASS].cName, "dMinEnvelopeMass"); + fvFormattedString(&options[OPT_MINENVELOPEMASS].cDescr, + "Minimum Envelope Mass"); + fvFormattedString(&options[OPT_MINENVELOPEMASS].cDefault, "1.e-8 Earth"); + fvFormattedString(&options[OPT_MINENVELOPEMASS].cNeg, "Mearth"); + fvFormattedString(&options[OPT_MINENVELOPEMASS].cDimension, "mass"); options[OPT_MINENVELOPEMASS].dDefault = 1.e-8 * MEARTH; options[OPT_MINENVELOPEMASS].iType = 2; options[OPT_MINENVELOPEMASS].dNeg = MEARTH; @@ -4356,11 +4318,11 @@ void InitializeOptionsGeneral(OPTIONS *options, fnReadOption fnRead[]) { * */ - sprintf(options[OPT_MASS].cName, "dMass"); - sprintf(options[OPT_MASS].cDescr, "Mass"); - sprintf(options[OPT_MASS].cDefault, "1 Earth Mass"); - sprintf(options[OPT_MASS].cNeg, "Mearth"); - sprintf(options[OPT_MASS].cDimension, "mass"); + fvFormattedString(&options[OPT_MASS].cName, "dMass"); + fvFormattedString(&options[OPT_MASS].cDescr, "Mass"); + fvFormattedString(&options[OPT_MASS].cDefault, "1 Earth Mass"); + fvFormattedString(&options[OPT_MASS].cNeg, "Mearth"); + fvFormattedString(&options[OPT_MASS].cDimension, "mass"); options[OPT_MASS].dDefault = MEARTH; options[OPT_MASS].iType = 2; options[OPT_MASS].bMultiFile = 1; @@ -4370,9 +4332,9 @@ void InitializeOptionsGeneral(OPTIONS *options, fnReadOption fnRead[]) { options[OPT_MASS].iFileType = 1; fnRead[OPT_MASS] = &ReadMass; - sprintf(options[OPT_BODYTYPE].cName, "iBodyType"); - sprintf(options[OPT_BODYTYPE].cDescr, "BodyType"); - sprintf(options[OPT_BODYTYPE].cDefault, "0 Planet"); + fvFormattedString(&options[OPT_BODYTYPE].cName, "iBodyType"); + fvFormattedString(&options[OPT_BODYTYPE].cDescr, "BodyType"); + fvFormattedString(&options[OPT_BODYTYPE].cDefault, "0 Planet"); options[OPT_BODYTYPE].dDefault = 0; options[OPT_BODYTYPE].iType = 1; options[OPT_BODYTYPE].bMultiFile = 1; @@ -4381,10 +4343,11 @@ void InitializeOptionsGeneral(OPTIONS *options, fnReadOption fnRead[]) { options[OPT_BODYTYPE].iFileType = 1; fnRead[OPT_BODYTYPE] = &ReadBodyType; - sprintf(options[OPT_MASSRAD].cName, "sMassRad"); - sprintf(options[OPT_MASSRAD].cDescr, - "Mass-Radius Relationship for Central Body: GS99 RH00 BO06 Sotin07 "); - sprintf(options[OPT_MASSRAD].cDefault, "None"); + fvFormattedString(&options[OPT_MASSRAD].cName, "sMassRad"); + fvFormattedString( + &options[OPT_MASSRAD].cDescr, + "Mass-Radius Relationship for Central Body: GS99 RH00 BO06 Sotin07 "); + fvFormattedString(&options[OPT_MASSRAD].cDefault, "None"); options[OPT_MASSRAD].iType = 3; options[OPT_MASSRAD].bMultiFile = 1; options[OPT_MASSRAD].iModuleBit = @@ -4393,10 +4356,10 @@ void InitializeOptionsGeneral(OPTIONS *options, fnReadOption fnRead[]) { options[OPT_MASSRAD].iFileType = 1; fnRead[OPT_MASSRAD] = &ReadMassRad; - sprintf(options[OPT_OBL].cName, "dObliquity"); - sprintf(options[OPT_OBL].cDescr, "Obliquity"); - sprintf(options[OPT_OBL].cDefault, "0"); - sprintf(options[OPT_OBL].cDimension, "angle"); + fvFormattedString(&options[OPT_OBL].cName, "dObliquity"); + fvFormattedString(&options[OPT_OBL].cDescr, "Obliquity"); + fvFormattedString(&options[OPT_OBL].cDefault, "0"); + fvFormattedString(&options[OPT_OBL].cDimension, "angle"); options[OPT_OBL].dDefault = 0; options[OPT_OBL].iType = 2; options[OPT_OBL].bMultiFile = 1; @@ -4405,10 +4368,10 @@ void InitializeOptionsGeneral(OPTIONS *options, fnReadOption fnRead[]) { options[OPT_OBL].iFileType = 1; fnRead[OPT_OBL] = &ReadObliquity; - sprintf(options[OPT_COSOBL].cName, "dCosObl"); - sprintf(options[OPT_COSOBL].cDescr, "Coine of the Obliquity"); - sprintf(options[OPT_COSOBL].cDefault, "0.5"); - sprintf(options[OPT_COSOBL].cDimension, "nd"); + fvFormattedString(&options[OPT_COSOBL].cName, "dCosObl"); + fvFormattedString(&options[OPT_COSOBL].cDescr, "Coine of the Obliquity"); + fvFormattedString(&options[OPT_COSOBL].cDefault, "0.5"); + fvFormattedString(&options[OPT_COSOBL].cDimension, "nd"); options[OPT_COSOBL].dDefault = 0.5; options[OPT_COSOBL].iType = 2; options[OPT_COSOBL].bMultiFile = 1; @@ -4416,20 +4379,21 @@ void InitializeOptionsGeneral(OPTIONS *options, fnReadOption fnRead[]) { options[OPT_COSOBL].bNeg = 0; options[OPT_COSOBL].iFileType = 1; fnRead[OPT_COSOBL] = &ReadCosObl; - sprintf(options[OPT_COSOBL].cLongDescr, - "Planet formation simulations predict that an isotropic distribution " - "of\n" - "rotational angular momentum vectors is a typical outcome. This " - "result is\n" - "identical to a uniform distribution in cosine obliquity. Use this " - "option\n" - "to sample a realistic distribution of initial obliquities.\n"); - - sprintf(options[OPT_RADIUS].cName, "dRadius"); - sprintf(options[OPT_RADIUS].cDescr, "Radius"); - sprintf(options[OPT_RADIUS].cDefault, "1 Earth Radius"); - sprintf(options[OPT_RADIUS].cNeg, "Rearth"); - sprintf(options[OPT_RADIUS].cDimension, "length"); + fvFormattedString( + &options[OPT_COSOBL].cLongDescr, + "Planet formation simulations predict that an isotropic distribution " + "of\n" + "rotational angular momentum vectors is a typical outcome. This " + "result is\n" + "identical to a uniform distribution in cosine obliquity. Use this " + "option\n" + "to sample a realistic distribution of initial obliquities.\n"); + + fvFormattedString(&options[OPT_RADIUS].cName, "dRadius"); + fvFormattedString(&options[OPT_RADIUS].cDescr, "Radius"); + fvFormattedString(&options[OPT_RADIUS].cDefault, "1 Earth Radius"); + fvFormattedString(&options[OPT_RADIUS].cNeg, "Rearth"); + fvFormattedString(&options[OPT_RADIUS].cDimension, "length"); options[OPT_RADIUS].dDefault = REARTH; options[OPT_RADIUS].iType = 2; options[OPT_RADIUS].bMultiFile = 1; @@ -4439,11 +4403,11 @@ void InitializeOptionsGeneral(OPTIONS *options, fnReadOption fnRead[]) { options[OPT_RADIUS].iFileType = 1; fnRead[OPT_RADIUS] = &ReadRadius; - sprintf(options[OPT_RG].cName, "dRadGyra"); - sprintf(options[OPT_RG].cDescr, - "Radius of Gyration; moment of inertia constant"); - sprintf(options[OPT_RG].cDefault, "0.5"); - sprintf(options[OPT_RG].cDimension, "nd"); + fvFormattedString(&options[OPT_RG].cName, "dRadGyra"); + fvFormattedString(&options[OPT_RG].cDescr, + "Radius of Gyration; moment of inertia constant"); + fvFormattedString(&options[OPT_RG].cDefault, "0.5"); + fvFormattedString(&options[OPT_RG].cDimension, "nd"); options[OPT_RG].dDefault = 0.5; options[OPT_RG].iType = 2; options[OPT_RG].bMultiFile = 1; @@ -4452,11 +4416,11 @@ void InitializeOptionsGeneral(OPTIONS *options, fnReadOption fnRead[]) { options[OPT_RG].iFileType = 1; fnRead[OPT_RG] = &ReadRadiusGyration; - sprintf(options[OPT_ROTPER].cName, "dRotPeriod"); - sprintf(options[OPT_ROTPER].cDescr, "Rotation Period"); - sprintf(options[OPT_ROTPER].cDefault, "1 Day"); - sprintf(options[OPT_ROTPER].cNeg, "Days"); - sprintf(options[OPT_ROTPER].cDimension, "time"); + fvFormattedString(&options[OPT_ROTPER].cName, "dRotPeriod"); + fvFormattedString(&options[OPT_ROTPER].cDescr, "Rotation Period"); + fvFormattedString(&options[OPT_ROTPER].cDefault, "1 Day"); + fvFormattedString(&options[OPT_ROTPER].cNeg, "Days"); + fvFormattedString(&options[OPT_ROTPER].cDimension, "time"); options[OPT_ROTPER].dDefault = DAYSEC; options[OPT_ROTPER].iType = 2; options[OPT_ROTPER].bMultiFile = 1; @@ -4466,11 +4430,12 @@ void InitializeOptionsGeneral(OPTIONS *options, fnReadOption fnRead[]) { options[OPT_ROTPER].iFileType = 1; fnRead[OPT_ROTPER] = &ReadRotPeriod; - sprintf(options[OPT_ROTRATE].cName, "dRotRate"); - sprintf(options[OPT_ROTRATE].cDescr, "Rotational Angular Frequency"); - sprintf(options[OPT_ROTRATE].cDefault, "2*pi/day"); - sprintf(options[OPT_ROTRATE].cNeg, "/Day"); - sprintf(options[OPT_ROTRATE].cDimension, "time^-1"); + fvFormattedString(&options[OPT_ROTRATE].cName, "dRotRate"); + fvFormattedString(&options[OPT_ROTRATE].cDescr, + "Rotational Angular Frequency"); + fvFormattedString(&options[OPT_ROTRATE].cDefault, "2*pi/day"); + fvFormattedString(&options[OPT_ROTRATE].cNeg, "/Day"); + fvFormattedString(&options[OPT_ROTRATE].cDimension, "time^-1"); options[OPT_ROTRATE].dDefault = 2 * PI / DAYSEC; options[OPT_ROTRATE].iType = 2; options[OPT_ROTRATE].bMultiFile = 1; @@ -4480,11 +4445,11 @@ void InitializeOptionsGeneral(OPTIONS *options, fnReadOption fnRead[]) { options[OPT_ROTRATE].iFileType = 1; fnRead[OPT_ROTRATE] = &ReadRotRate; - sprintf(options[OPT_ROTVEL].cName, "dRotVel"); - sprintf(options[OPT_ROTVEL].cDescr, "Rotational Velocity"); - sprintf(options[OPT_ROTVEL].cDefault, "0"); - sprintf(options[OPT_ROTVEL].cNeg, "km/s"); - sprintf(options[OPT_ROTVEL].cDimension, "mass/time"); + fvFormattedString(&options[OPT_ROTVEL].cName, "dRotVel"); + fvFormattedString(&options[OPT_ROTVEL].cDescr, "Rotational Velocity"); + fvFormattedString(&options[OPT_ROTVEL].cDefault, "0"); + fvFormattedString(&options[OPT_ROTVEL].cNeg, "km/s"); + fvFormattedString(&options[OPT_ROTVEL].cDimension, "mass/time"); options[OPT_ROTVEL].dDefault = 0; options[OPT_ROTVEL].iType = 2; options[OPT_ROTVEL].bMultiFile = 1; @@ -4500,75 +4465,78 @@ void InitializeOptionsGeneral(OPTIONS *options, fnReadOption fnRead[]) { * */ - sprintf(options[OPT_UNITANGLE].cName, "sUnitAngle"); - sprintf(options[OPT_UNITANGLE].cDescr, "Angle Units: Degrees Radians"); - sprintf(options[OPT_UNITANGLE].cDefault, "Radians"); + fvFormattedString(&options[OPT_UNITANGLE].cName, "sUnitAngle"); + fvFormattedString(&options[OPT_UNITANGLE].cDescr, + "Angle Units: Degrees Radians"); + fvFormattedString(&options[OPT_UNITANGLE].cDefault, "Radians"); options[OPT_UNITANGLE].iModuleBit = 0; options[OPT_UNITANGLE].bNeg = 0; options[OPT_UNITANGLE].iType = 3; options[OPT_UNITANGLE].iFileType = 2; - sprintf(options[OPT_UNITLENGTH].cName, "sUnitLength"); - sprintf(options[OPT_UNITLENGTH].cDescr, - "Length Units: cm m km Solar Earth Jupiter AU"); - sprintf(options[OPT_UNITLENGTH].cDefault, "cm"); + fvFormattedString(&options[OPT_UNITLENGTH].cName, "sUnitLength"); + fvFormattedString(&options[OPT_UNITLENGTH].cDescr, + "Length Units: cm m km Solar Earth Jupiter AU"); + fvFormattedString(&options[OPT_UNITLENGTH].cDefault, "cm"); options[OPT_UNITLENGTH].iModuleBit = 0; options[OPT_UNITLENGTH].bNeg = 0; options[OPT_UNITLENGTH].iType = 3; options[OPT_UNITLENGTH].iFileType = 2; - sprintf(options[OPT_UNITMASS].cName, "sUnitMass"); - sprintf(options[OPT_UNITMASS].cDescr, - "Mass Units: Grams Kilograms Solar Earth Jupiter Saturn"); - sprintf(options[OPT_UNITMASS].cDefault, "grams"); + fvFormattedString(&options[OPT_UNITMASS].cName, "sUnitMass"); + fvFormattedString(&options[OPT_UNITMASS].cDescr, + "Mass Units: Grams Kilograms Solar Earth Jupiter Saturn"); + fvFormattedString(&options[OPT_UNITMASS].cDefault, "grams"); options[OPT_UNITMASS].iModuleBit = 0; options[OPT_UNITMASS].bNeg = 0; options[OPT_UNITMASS].iType = 3; options[OPT_UNITMASS].iFileType = 2; - sprintf(options[OPT_UNITTIME].cName, "sUnitTime"); - sprintf(options[OPT_UNITTIME].cDescr, - "Time Units: Seconds, Days Years Myr Gyr"); - sprintf(options[OPT_UNITTIME].cDefault, "Seconds"); + fvFormattedString(&options[OPT_UNITTIME].cName, "sUnitTime"); + fvFormattedString(&options[OPT_UNITTIME].cDescr, + "Time Units: Seconds, Days Years Myr Gyr"); + fvFormattedString(&options[OPT_UNITTIME].cDefault, "Seconds"); options[OPT_UNITTIME].iModuleBit = 0; options[OPT_UNITTIME].bNeg = 0; options[OPT_UNITTIME].iType = 3; options[OPT_UNITTIME].iFileType = 2; - sprintf(options[OPT_UNITTEMP].cName, "sUnitTemp"); - sprintf(options[OPT_UNITTEMP].cDescr, - "Temperature Units: Kelvin Celsius Farenheit"); - sprintf(options[OPT_UNITTEMP].cDefault, "Kelvin"); + fvFormattedString(&options[OPT_UNITTEMP].cName, "sUnitTemp"); + fvFormattedString(&options[OPT_UNITTEMP].cDescr, + "Temperature Units: Kelvin Celsius Farenheit"); + fvFormattedString(&options[OPT_UNITTEMP].cDefault, "Kelvin"); options[OPT_UNITTEMP].iModuleBit = 0; options[OPT_UNITTEMP].bNeg = 0; options[OPT_UNITTEMP].iType = 3; options[OPT_UNITTEMP].iFileType = 2; - sprintf(options[OPT_TEMPERATURE].cName, "dTemperature"); - sprintf(options[OPT_TEMPERATURE].cDescr, "Initial effective temperature"); - sprintf(options[OPT_TEMPERATURE].cDefault, "TSUN"); - sprintf(options[OPT_TEMPERATURE].cDimension, "temperature"); + fvFormattedString(&options[OPT_TEMPERATURE].cName, "dTemperature"); + fvFormattedString(&options[OPT_TEMPERATURE].cDescr, + "Initial effective temperature"); + fvFormattedString(&options[OPT_TEMPERATURE].cDefault, "TSUN"); + fvFormattedString(&options[OPT_TEMPERATURE].cDimension, "temperature"); options[OPT_TEMPERATURE].dDefault = TSUN; options[OPT_TEMPERATURE].iType = 2; options[OPT_TEMPERATURE].bMultiFile = 1; fnRead[OPT_TEMPERATURE] = &ReadTemperature; - sprintf(options[OPT_USEOUTERTIDALQ].cName, "bUseOuterTidalQ"); - sprintf(options[OPT_USEOUTERTIDALQ].cDescr, - "User outermost layer's tidal Q as body's total tidal Q?"); - sprintf(options[OPT_USEOUTERTIDALQ].cDefault, "0"); + fvFormattedString(&options[OPT_USEOUTERTIDALQ].cName, "bUseOuterTidalQ"); + fvFormattedString(&options[OPT_USEOUTERTIDALQ].cDescr, + "User outermost layer's tidal Q as body's total tidal Q?"); + fvFormattedString(&options[OPT_USEOUTERTIDALQ].cDefault, "0"); options[OPT_USEOUTERTIDALQ].iType = 0; options[OPT_USEOUTERTIDALQ].bMultiFile = 1; fnRead[OPT_USEOUTERTIDALQ] = &ReadUseOuterTidalQ; - sprintf(options[OPT_USEOUTERTIDALQ].cLongDescr, - "The total tidal Q of a body can be computed either as the sum of\n" - "contributions of all layers (mantle, ocean, envelope), or as the " - "tidal Q\n" - "of the outer most layer. When %s is set to 0, the tidal Q is the " - "sum,\n" - "when set to 1, it is the outer layer's (envelope, then ocean, then\n" - "mantle) value.\n", - options[OPT_USEOUTERTIDALQ].cName); + fvFormattedString( + &options[OPT_USEOUTERTIDALQ].cLongDescr, + "The total tidal Q of a body can be computed either as the sum of\n" + "contributions of all layers (mantle, ocean, envelope), or as the " + "tidal Q\n" + "of the outer most layer. When %s is set to 0, the tidal Q is the " + "sum,\n" + "when set to 1, it is the outer layer's (envelope, then ocean, then\n" + "mantle) value.\n", + options[OPT_USEOUTERTIDALQ].cName); /* * @@ -4576,15 +4544,15 @@ void InitializeOptionsGeneral(OPTIONS *options, fnReadOption fnRead[]) { * */ - sprintf(options[OPT_VERBOSE].cName, "iVerbose"); - sprintf(options[OPT_VERBOSE].cDescr, "Verbosity Level: 0-5"); - sprintf(options[OPT_VERBOSE].cDefault, "3"); + fvFormattedString(&options[OPT_VERBOSE].cName, "iVerbose"); + fvFormattedString(&options[OPT_VERBOSE].cDescr, "Verbosity Level: 0-5"); + fvFormattedString(&options[OPT_VERBOSE].cDefault, "3"); options[OPT_VERBOSE].iModuleBit = 0; options[OPT_VERBOSE].bNeg = 0; options[OPT_VERBOSE].iType = 1; options[OPT_VERBOSE].iFileType = 2; - sprintf( - options[OPT_VERBOSE].cLongDescr, + fvFormattedString( + &options[OPT_VERBOSE].cLongDescr, "Set how much text is written to the screen. 0 = no output, 1 = only\n" "errors, 2 = progress updates, 3 = statements about input choices, 4 " "=\n" @@ -4593,10 +4561,10 @@ void InitializeOptionsGeneral(OPTIONS *options, fnReadOption fnRead[]) { "0 and 5 can be set at execution with the -q and -v options, " "respectively."); - sprintf(options[OPT_VISCUMAN].cName, "dViscUMan"); - sprintf(options[OPT_VISCUMAN].cDescr, "Upper mantle viscosity"); - sprintf(options[OPT_VISCUMAN].cDefault, "0"); - sprintf(options[OPT_VISCUMAN].cDimension, "length^2/time"); + fvFormattedString(&options[OPT_VISCUMAN].cName, "dViscUMan"); + fvFormattedString(&options[OPT_VISCUMAN].cDescr, "Upper mantle viscosity"); + fvFormattedString(&options[OPT_VISCUMAN].cDefault, "0"); + fvFormattedString(&options[OPT_VISCUMAN].cDimension, "length^2/time"); options[OPT_VISCUMAN].dDefault = 0; options[OPT_VISCUMAN].iType = 2; options[OPT_VISCUMAN].bMultiFile = 1; @@ -4613,9 +4581,9 @@ void InitializeOptionsGeneral(OPTIONS *options, fnReadOption fnRead[]) { /* Someday... - sprintf(options[OPT_XOBL].cName,"dXobl"); - sprintf(options[OPT_XOBL].cDescr,"Deitrick's X -- Unsupported!"); - sprintf(options[OPT_XOBL].cDefault,"-1"); + fvFormattedString(options[OPT_XOBL].cName,"dXobl"); + fvFormattedString(options[OPT_XOBL].cDescr,"Deitrick's X -- Unsupported!"); + fvFormattedString(options[OPT_XOBL].cDefault,"-1"); options[OPT_XOBL].dDefault = -1; options[OPT_XOBL].iType = 2; options[OPT_XOBL].iModuleBit = SPINBODY + DISTROT; @@ -4629,9 +4597,9 @@ void InitializeOptionsGeneral(OPTIONS *options, fnReadOption fnRead[]) { * * / - sprintf(options[OPT_YOBL].cName,"dYobl"); - sprintf(options[OPT_YOBL].cDescr,"Deitrick's Y -- Unsupported!"); - sprintf(options[OPT_YOBL].cDefault,"-1"); + fvFormattedString(options[OPT_YOBL].cName,"dYobl"); + fvFormattedString(options[OPT_YOBL].cDescr,"Deitrick's Y -- Unsupported!"); + fvFormattedString(options[OPT_YOBL].cDefault,"-1"); options[OPT_YOBL].dDefault = -1; options[OPT_YOBL].iType = 2; options[OPT_YOBL].iModuleBit = SPINBODY + DISTROT; @@ -4645,9 +4613,9 @@ void InitializeOptionsGeneral(OPTIONS *options, fnReadOption fnRead[]) { * * / - sprintf(options[OPT_ZOBL].cName,"dZobl"); - sprintf(options[OPT_ZOBL].cDescr,"Deitrick's Z -- Unsupported!"); - sprintf(options[OPT_ZOBL].cDefault,"-1"); + fvFormattedString(options[OPT_ZOBL].cName,"dZobl"); + fvFormattedString(options[OPT_ZOBL].cDescr,"Deitrick's Z -- Unsupported!"); + fvFormattedString(options[OPT_ZOBL].cDefault,"-1"); options[OPT_ZOBL].dDefault = -1; options[OPT_ZOBL].iType = 2; options[OPT_ZOBL].iModuleBit = SPINBODY + DISTROT; @@ -4662,34 +4630,30 @@ void InitializeOptions(OPTIONS *options, fnReadOption *fnRead) { /* Initialize all parameters describing the option's location */ for (iOpt = 0; iOpt < MODULEOPTEND; iOpt++) { - memset(options[iOpt].cName, '\0', OPTLEN); - sprintf(options[iOpt].cName, "null"); + + options[iOpt].cName = NULL; + options[iOpt].cDescr = NULL; + options[iOpt].cLongDescr = NULL; + options[iOpt].cDefault = NULL; + options[iOpt].cValues = NULL; + options[iOpt].cNeg = NULL; + options[iOpt].cDimension = NULL; + + fvFormattedString(&options[iOpt].cName, "null"); options[iOpt].iLine = malloc(MAXFILES * sizeof(int)); options[iOpt].bMultiFile = 0; options[iOpt].iMultiIn = 0; options[iOpt].iType = -1; - memset(options[iOpt].cDescr, '\0', OPTDESCR); - sprintf(options[iOpt].cDescr, "null"); - memset(options[iOpt].cLongDescr, '\0', OPTLONDESCR); - sprintf(options[iOpt].cLongDescr, "null"); - memset(options[iOpt].cDefault, '\0', OPTDESCR); - sprintf(options[iOpt].cDefault, "null"); - memset(options[iOpt].cValues, '\0', OPTDESCR); - sprintf(options[iOpt].cValues, "null"); - memset(options[iOpt].cNeg, '\0', OPTDESCR); - sprintf(options[iOpt].cNeg, "null"); - memset(options[iOpt].cDimension, '\0', OPTDESCR); + fvFormattedString(&options[iOpt].cDescr, "null"); + fvFormattedString(&options[iOpt].cLongDescr, "null"); + fvFormattedString(&options[iOpt].cDefault, "null"); + fvFormattedString(&options[iOpt].cValues, "null"); + fvFormattedString(&options[iOpt].cNeg, "null"); options[iOpt].dDefault = NAN; options[iOpt].iModuleBit = 0; options[iOpt].bNeg = 0; options[iOpt].iFileType = 2; options[iOpt].dNeg = 0; - - for (iFile = 0; iFile < MAXFILES; iFile++) { - options[iOpt].iLine[iFile] = -1; - memset(options[iOpt].cFile[iFile], '\0', OPTLEN); - sprintf(options[iOpt].cFile[iFile], "null"); - } } /* Now populate entries for general options. */ diff --git a/src/options.h b/src/options.h index f300bd90f..18f67ffd4 100644 --- a/src/options.h +++ b/src/options.h @@ -120,13 +120,15 @@ /* @cond DOXYGEN_OVERRIDE */ void GetWords(char cLine[], char[MAXARRAY][OPTLEN], int *, int *); - +int iGetNumLines(char *); +void CheckFileExists(char *); +void RecordCommentsAndWhiteSpace(INFILE *); void InitializeOptions(OPTIONS *, fnReadOption *); void ReadOptions(BODY **, CONTROL *, FILES *, MODULE *, OPTIONS *, OUTPUT *, SYSTEM *, UPDATE **, fnReadOption *, char[]); double dNegativeDouble(OPTIONS, char[], int); -void AddOptionStringArray(char[], char[], char[MAXARRAY][OPTLEN], int *, int *, +void AddOptionStringArray(char[], char[], char***, int *, int *, int *, int); void AddOptionDoubleArray(char[], char[], double *, int *, int *, int *, int); void NotPrimaryInput(int, char[], char[], int, int); diff --git a/src/output.c b/src/output.c index c18220290..75dc7e9c7 100644 --- a/src/output.c +++ b/src/output.c @@ -15,11 +15,11 @@ void WriteAge(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, double *dTmp, - char cUnit[]) { + char **cUnit) { *dTmp = body[iBody].dAge; if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { *dTmp /= fdUnitsTime(units->iTime); fsUnitsTime(units->iTime, cUnit); @@ -33,9 +33,9 @@ void WriteAge(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, /* iBodyType */ void WriteBodyType(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, double *dTmp, - char cUnit[]) { + char **cUnit) { *dTmp = body[iBody].iBodyType; - strcpy(cUnit, ""); + fvFormattedString(cUnit, ""); } /* @@ -45,18 +45,18 @@ void WriteBodyType(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, /* Climate-obliquity-precession parameter */ void WriteCOPP(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, double *dTmp, - char cUnit[]) { + char **cUnit) { *dTmp = body[iBody].dEcc * sin(body[iBody].dLongP + body[iBody].dPrecA) * sin(body[iBody].dObliquity); - strcpy(cUnit, ""); + fvFormattedString(cUnit, ""); } /* Critical Semi-major Axis (Holman & Wiegert, 1999 for P-type circumbinary * orbit) */ void WriteCriticalSemi(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, - double *dTmp, char cUnit[]) { + double *dTmp, char **cUnit) { // Only valid for simulations of tidally-interacting binary stars that have // 2 bodies: 0, 1, both stars, with bStellar = bEqtide = 1 @@ -75,7 +75,7 @@ void WriteCriticalSemi(BODY *body, CONTROL *control, OUTPUT *output, if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { *dTmp /= fdUnitsLength(units->iLength); fsUnitsLength(units->iLength, cUnit); @@ -88,7 +88,7 @@ void WriteCriticalSemi(BODY *body, CONTROL *control, OUTPUT *output, void WriteDeltaTime(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, - double *dTmp, char cUnit[]) { + double *dTmp, char **cUnit) { if (control->Evolve.bVarDt) { if (control->Evolve.dTime > 0) { @@ -106,7 +106,7 @@ void WriteDeltaTime(BODY *body, CONTROL *control, OUTPUT *output, } if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { *dTmp /= fdUnitsTime(units->iTime); fsUnitsTime(units->iTime, cUnit); @@ -115,13 +115,13 @@ void WriteDeltaTime(BODY *body, CONTROL *control, OUTPUT *output, void WriteDensity(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, double *dTmp, - char cUnit[]) { + char **cUnit) { *dTmp = fdSphereDensity(body[iBody].dMass, body[iBody].dRadius); if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { *dTmp *= pow(fdUnitsLength(units->iLength), 3) / fdUnitsMass(units->iMass); fsUnitsDensity(units, cUnit); @@ -135,17 +135,17 @@ void WriteDensity(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, void WriteHecc(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, double *dTmp, - char cUnit[]) { + char **cUnit) { *dTmp = body[iBody].dHecc; - strcpy(cUnit, ""); + fvFormattedString(cUnit, ""); } /************* HABITABLE ZONE LIMITS ***********/ void WriteHZLimitDryRunaway(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, - int iBody, double *dTmp, char cUnit[]) { + int iBody, double *dTmp, char **cUnit) { double dLuminosity; int jBody; @@ -166,7 +166,7 @@ void WriteHZLimitDryRunaway(BODY *body, CONTROL *control, OUTPUT *output, if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { *dTmp /= fdUnitsLength(units->iLength); fsUnitsLength(units->iLength, cUnit); @@ -175,7 +175,7 @@ void WriteHZLimitDryRunaway(BODY *body, CONTROL *control, OUTPUT *output, void WriteHZLimitRecentVenus(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, - int iBody, double *dTmp, char cUnit[]) { + int iBody, double *dTmp, char **cUnit) { int iLim; double *daHZLimits; // Array of HZ limits @@ -205,7 +205,7 @@ void WriteHZLimitRecentVenus(BODY *body, CONTROL *control, OUTPUT *output, *dTmp = daHZLimits[0]; if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { *dTmp /= fdUnitsLength(units->iLength); fsUnitsLength(units->iLength, cUnit); @@ -215,7 +215,7 @@ void WriteHZLimitRecentVenus(BODY *body, CONTROL *control, OUTPUT *output, void WriteHZLimitRunawayGreenhouse(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, - int iBody, double *dTmp, char cUnit[]) { + int iBody, double *dTmp, char **cUnit) { double *daHZLimits; // Array of HZ limits daHZLimits = malloc(6 * sizeof(double)); @@ -236,7 +236,7 @@ void WriteHZLimitRunawayGreenhouse(BODY *body, CONTROL *control, OUTPUT *output, *dTmp = daHZLimits[1]; if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { *dTmp /= fdUnitsLength(units->iLength); fsUnitsLength(units->iLength, cUnit); @@ -246,7 +246,7 @@ void WriteHZLimitRunawayGreenhouse(BODY *body, CONTROL *control, OUTPUT *output, void WriteHZLimitMoistGreenhouse(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, - int iBody, double *dTmp, char cUnit[]) { + int iBody, double *dTmp, char **cUnit) { double *daHZLimits; // Array of HZ limits daHZLimits = malloc(6 * sizeof(double)); @@ -266,7 +266,7 @@ void WriteHZLimitMoistGreenhouse(BODY *body, CONTROL *control, OUTPUT *output, *dTmp = daHZLimits[2]; if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { *dTmp /= fdUnitsLength(units->iLength); fsUnitsLength(units->iLength, cUnit); @@ -276,7 +276,7 @@ void WriteHZLimitMoistGreenhouse(BODY *body, CONTROL *control, OUTPUT *output, void WriteHZLimitMaxGreenhouse(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, - int iBody, double *dTmp, char cUnit[]) { + int iBody, double *dTmp, char **cUnit) { double *daHZLimits; // Array of HZ limits daHZLimits = malloc(6 * sizeof(double)); @@ -296,7 +296,7 @@ void WriteHZLimitMaxGreenhouse(BODY *body, CONTROL *control, OUTPUT *output, *dTmp = daHZLimits[3]; if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { *dTmp /= fdUnitsLength(units->iLength); fsUnitsLength(units->iLength, cUnit); @@ -306,7 +306,7 @@ void WriteHZLimitMaxGreenhouse(BODY *body, CONTROL *control, OUTPUT *output, void WriteHZLimitEarlyMars(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, - int iBody, double *dTmp, char cUnit[]) { + int iBody, double *dTmp, char **cUnit) { double *daHZLimits; // Array of HZ limits daHZLimits = malloc(6 * sizeof(double)); @@ -326,7 +326,7 @@ void WriteHZLimitEarlyMars(BODY *body, CONTROL *control, OUTPUT *output, *dTmp = daHZLimits[4]; if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { *dTmp /= fdUnitsLength(units->iLength); fsUnitsLength(units->iLength, cUnit); @@ -340,7 +340,7 @@ void WriteHZLimitEarlyMars(BODY *body, CONTROL *control, OUTPUT *output, void WriteBodyInc(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, double *dTmp, - char cUnit[]) { + char **cUnit) { if (body[iBody].bDistOrb) { *dTmp = fdInclination(body, iBody); } else { @@ -349,7 +349,7 @@ void WriteBodyInc(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { *dTmp /= fdUnitsAngle(units->iAngle); fsUnitsAngle(units->iAngle, cUnit); @@ -358,7 +358,7 @@ void WriteBodyInc(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, void WriteInstellation(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, - double *dTmp, char cUnit[]) { + double *dTmp, char **cUnit) { // Should have special case if bBinary=1 // if (body[iBody].bSpiNBody) @@ -377,7 +377,7 @@ void WriteInstellation(BODY *body, CONTROL *control, OUTPUT *output, if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { *dTmp /= fdUnitsEnergyFlux(units->iTime, units->iMass, units->iLength); fsUnitsEnergyFlux(units, cUnit); @@ -391,13 +391,13 @@ void WriteInstellation(BODY *body, CONTROL *control, OUTPUT *output, void WriteK2Man(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, double *dTmp, - char cUnit[]) { + char **cUnit) { // This is calculated during PropsAux if (body[iBody].bEqtide) { *dTmp = body[iBody].dK2Man; if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } } else { *dTmp = -1; @@ -406,14 +406,14 @@ void WriteK2Man(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, void WriteImK2Man(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, double *dTmp, - char cUnit[]) { + char **cUnit) { if (body[iBody].bEqtide) { *dTmp = body[iBody].dImK2Man; - strcpy(cUnit, ""); + fvFormattedString(cUnit, ""); if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } } else { *dTmp = -1; @@ -422,10 +422,10 @@ void WriteImK2Man(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, void WriteKecc(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, double *dTmp, - char cUnit[]) { + char **cUnit) { *dTmp = body[iBody].dKecc; - strcpy(cUnit, ""); + fvFormattedString(cUnit, ""); } /* @@ -434,7 +434,7 @@ void WriteKecc(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, void WriteBodyLongA(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, - double *dTmp, char cUnit[]) { + double *dTmp, char **cUnit) { if (body[iBody].bDistOrb) { *dTmp = fdLongA(body, iBody); } else { @@ -450,7 +450,7 @@ void WriteBodyLongA(BODY *body, CONTROL *control, OUTPUT *output, if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { *dTmp /= fdUnitsAngle(units->iAngle); fsUnitsAngle(units->iAngle, cUnit); @@ -459,7 +459,7 @@ void WriteBodyLongA(BODY *body, CONTROL *control, OUTPUT *output, void WriteLongP(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, double *dTmp, - char cUnit[]) { + char **cUnit) { if (body[iBody].bSpiNBody || body[iBody].bBinary) { @@ -467,7 +467,7 @@ void WriteLongP(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { *dTmp /= fdUnitsAngle(units->iAngle); fsUnitsAngle(units->iAngle, cUnit); @@ -484,7 +484,7 @@ void WriteLongP(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { *dTmp /= fdUnitsAngle(units->iAngle); fsUnitsAngle(units->iAngle, cUnit); @@ -494,7 +494,7 @@ void WriteLongP(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, void WriteBodyArgP(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, double *dTmp, - char cUnit[]) { + char **cUnit) { double varpi, Omega; if (body[iBody].bDistOrb) { @@ -510,7 +510,7 @@ void WriteBodyArgP(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, } if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { *dTmp /= fdUnitsAngle(units->iAngle); fsUnitsAngle(units->iAngle, cUnit); @@ -519,7 +519,7 @@ void WriteBodyArgP(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, void WriteLXUVTot(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, double *dTmp, - char cUnit[]) { + char **cUnit) { /* Multiple modules can contribute to this output */ int iModule; @@ -541,7 +541,7 @@ void WriteLXUVTot(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { *dTmp /= fdUnitsEnergyFlux(units->iTime, units->iMass, units->iLength); fsUnitsEnergyFlux(units, cUnit); @@ -554,12 +554,12 @@ void WriteLXUVTot(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, void WriteMass(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, double *dTmp, - char cUnit[]) { + char **cUnit) { *dTmp = body[iBody].dMass; if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { *dTmp /= fdUnitsMass(units->iMass); fsUnitsMass(units->iMass, cUnit); @@ -572,14 +572,14 @@ void WriteMass(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, void WriteObliquity(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, - double *dTmp, char cUnit[]) { + double *dTmp, char **cUnit) { *dTmp = atan2(sqrt(pow(body[iBody].dXobl, 2) + pow(body[iBody].dYobl, 2)), body[iBody].dZobl); if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { *dTmp /= fdUnitsAngle(units->iAngle); fsUnitsAngle(units->iAngle, cUnit); @@ -588,7 +588,7 @@ void WriteObliquity(BODY *body, CONTROL *control, OUTPUT *output, void WriteBodyPrecA(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, - double *dTmp, char cUnit[]) { + double *dTmp, char **cUnit) { if (body[iBody].bDistRot == 0 && body[iBody].bPoise == 1) { *dTmp = body[iBody].dPrecA; } else { @@ -604,7 +604,7 @@ void WriteBodyPrecA(BODY *body, CONTROL *control, OUTPUT *output, if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { *dTmp /= fdUnitsAngle(units->iAngle); fsUnitsAngle(units->iAngle, cUnit); @@ -613,7 +613,7 @@ void WriteBodyPrecA(BODY *body, CONTROL *control, OUTPUT *output, void WriteOrbAngMom(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, - double *dTmp, char cUnit[]) { + double *dTmp, char **cUnit) { char cTmp; double *pdOrbMom; if (body[iBody].bSpiNBody) { @@ -628,7 +628,7 @@ void WriteOrbAngMom(BODY *body, CONTROL *control, OUTPUT *output, } if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { *dTmp *= fdUnitsTime(units->iTime) / (fdUnitsMass(units->iMass) * fdUnitsLength(units->iLength) * @@ -639,7 +639,7 @@ void WriteOrbAngMom(BODY *body, CONTROL *control, OUTPUT *output, void WriteOrbEcc(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, double *dTmp, - char cUnit[]) { + char **cUnit) { if (body[iBody].bBinary != 1) { // Not doing binary if (iBody > 0) { if (body[iBody].bDistOrb || body[iBody].bEqtide) { @@ -660,13 +660,13 @@ void WriteOrbEcc(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, *dTmp = -1; } } - sprintf(cUnit, "%s", ""); + fvFormattedString(cUnit, "%s", ""); } // XXX This function doesn't work! void WriteLostEng(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, double *dTmp, - char cUnit[]) { + char **cUnit) { *dTmp = -1; *dTmp = body[iBody].dLostEng; @@ -674,7 +674,7 @@ void WriteLostEng(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { double dConversion = fdUnitsEnergy(units->iTime, units->iMass, units->iLength); *dTmp /= dConversion; @@ -684,13 +684,13 @@ void WriteLostEng(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, void WriteOrbEnergy(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, - double *dTmp, char cUnit[]) { + double *dTmp, char **cUnit) { *dTmp = fdOrbEnergy(body, control, system, iBody); if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { *dTmp /= fdUnitsEnergy(units->iTime, units->iMass, units->iLength); fsUnitsEnergy(units, cUnit); @@ -699,7 +699,7 @@ void WriteOrbEnergy(BODY *body, CONTROL *control, OUTPUT *output, void WriteOrbMeanMotion(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, - double *dTmp, char cUnit[]) { + double *dTmp, char **cUnit) { if (body[iBody].bBinary == 0) { // Not doing binary if (iBody > 0) { @@ -717,7 +717,7 @@ void WriteOrbMeanMotion(BODY *body, CONTROL *control, OUTPUT *output, if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { *dTmp *= fdUnitsTime(units->iTime); fsUnitsRate(units->iTime, cUnit); @@ -726,7 +726,7 @@ void WriteOrbMeanMotion(BODY *body, CONTROL *control, OUTPUT *output, void WriteOrbPeriod(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, - double *dTmp, char cUnit[]) { + double *dTmp, char **cUnit) { if (body[iBody].bBinary == 0) { // Not doing binary if (iBody > 0) { @@ -750,7 +750,7 @@ void WriteOrbPeriod(BODY *body, CONTROL *control, OUTPUT *output, if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { *dTmp /= fdUnitsTime(units->iTime); fsUnitsTime(units->iTime, cUnit); @@ -759,7 +759,7 @@ void WriteOrbPeriod(BODY *body, CONTROL *control, OUTPUT *output, void WriteOrbSemi(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, double *dTmp, - char cUnit[]) { + char **cUnit) { if (body[iBody].bBinary == 0) { // Not doing binary if (iBody > 0) { @@ -779,7 +779,7 @@ void WriteOrbSemi(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { *dTmp /= fdUnitsLength(units->iLength); fsUnitsLength(units->iLength, cUnit); @@ -792,12 +792,12 @@ void WriteOrbSemi(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, void WriteRadius(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, double *dTmp, - char cUnit[]) { + char **cUnit) { *dTmp = body[iBody].dRadius; if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { *dTmp /= fdUnitsLength(units->iLength); fsUnitsLength(units->iLength, cUnit); @@ -806,21 +806,21 @@ void WriteRadius(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, void WriteRadGyra(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, double *dTmp, - char cUnit[]) { + char **cUnit) { *dTmp = body[iBody].dRadGyra; - sprintf(cUnit, "%s", ""); + fvFormattedString(cUnit, "%s", ""); } void WriteRotAngMom(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, - double *dTmp, char cUnit[]) { + double *dTmp, char **cUnit) { *dTmp = fdRotAngMom(body[iBody].dRadGyra, body[iBody].dMass, body[iBody].dRadius, body[iBody].dRotRate); if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { *dTmp *= fdUnitsTime(units->iTime) / (fdUnitsMass(units->iMass) * fdUnitsLength(units->iLength) * @@ -831,13 +831,13 @@ void WriteRotAngMom(BODY *body, CONTROL *control, OUTPUT *output, void WriteRotKinEnergy(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, - double *dTmp, char cUnit[]) { + double *dTmp, char **cUnit) { *dTmp = fdRotKinEnergy(body[iBody].dMass, body[iBody].dRadius, body[iBody].dRadGyra, body[iBody].dRotRate); if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { *dTmp /= fdUnitsEnergy(units->iTime, units->iMass, units->iLength); fsUnitsEnergy(units, cUnit); @@ -846,12 +846,12 @@ void WriteRotKinEnergy(BODY *body, CONTROL *control, OUTPUT *output, void WriteRotRate(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, double *dTmp, - char cUnit[]) { + char **cUnit) { *dTmp = body[iBody].dRotRate; if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { *dTmp *= fdUnitsTime(units->iTime); fsUnitsRate(units->iTime, cUnit); @@ -860,12 +860,12 @@ void WriteRotRate(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, void WriteRotPer(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, double *dTmp, - char cUnit[]) { + char **cUnit) { *dTmp = fdFreqToPer(body[iBody].dRotRate); if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { *dTmp /= fdUnitsTime(units->iTime); fsUnitsTime(units->iTime, cUnit); @@ -874,12 +874,12 @@ void WriteRotPer(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, void WriteRotVel(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, double *dTmp, - char cUnit[]) { + char **cUnit) { *dTmp = fdRotVel(body[iBody].dRadius, body[iBody].dRotRate); if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { *dTmp *= fdUnitsTime(units->iTime) / fdUnitsLength(units->iLength); fsUnitsVel(units, cUnit); @@ -892,7 +892,7 @@ the solid interior, ocean, and/envelope. */ void WriteSurfaceEnergyFlux(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, - int iBody, double *dTmp, char cUnit[]) { + int iBody, double *dTmp, char **cUnit) { /* Surface Energy Flux is complicated because it either all comes through thermint, or it can be from eqtide and/or radheat. */ @@ -936,7 +936,7 @@ void WriteSurfaceEnergyFlux(BODY *body, CONTROL *control, OUTPUT *output, if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { *dTmp /= fdUnitsEnergyFlux(units->iTime, units->iMass, units->iLength); fsUnitsEnergyFlux(units, cUnit); @@ -945,7 +945,7 @@ void WriteSurfaceEnergyFlux(BODY *body, CONTROL *control, OUTPUT *output, void WriteTidalQ(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, double *dTmp, - char cUnit[]) { + char **cUnit) { if (body[iBody].bEqtide) { if (body[iBody].bThermint && !body[iBody].bOcean && !body[iBody].bEnv) { @@ -973,13 +973,13 @@ void WriteTidalQ(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, *dTmp = -1; } - strcpy(cUnit, ""); + fvFormattedString(cUnit, ""); } void WriteTidalQMantle(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, - double *dTmp, char cUnit[]) { + double *dTmp, char **cUnit) { // Updated every timestep by PropsAuxEqtideThermint if (body[iBody].bEqtide) { @@ -987,17 +987,17 @@ void WriteTidalQMantle(BODY *body, CONTROL *control, OUTPUT *output, } else { *dTmp = -1; } - strcpy(cUnit, ""); + fvFormattedString(cUnit, ""); } void WriteTime(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, double *dTmp, - char cUnit[]) { + char **cUnit) { *dTmp = control->Evolve.iDir * control->Evolve.dTime; if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { *dTmp /= fdUnitsTime(units->iTime); fsUnitsTime(units->iTime, cUnit); @@ -1006,13 +1006,13 @@ void WriteTime(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, void WriteTotAngMom(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, - double *dTmp, char cUnit[]) { + double *dTmp, char **cUnit) { *dTmp = fdTotAngMom(body, control, system); if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { *dTmp *= fdUnitsTime(units->iTime) / (fdUnitsMass(units->iMass) * fdUnitsLength(units->iLength) * @@ -1023,13 +1023,13 @@ void WriteTotAngMom(BODY *body, CONTROL *control, OUTPUT *output, void WriteLostAngMom(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, - double *dTmp, char cUnit[]) { + double *dTmp, char **cUnit) { *dTmp = body[iBody].dLostAngMom; if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { *dTmp *= fdUnitsTime(units->iTime) / (fdUnitsMass(units->iMass) * fdUnitsLength(units->iLength) * @@ -1040,13 +1040,13 @@ void WriteLostAngMom(BODY *body, CONTROL *control, OUTPUT *output, void WriteTotEnergy(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, - double *dTmp, char cUnit[]) { + double *dTmp, char **cUnit) { *dTmp = fdTotEnergy(body, control, system); if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { *dTmp /= fdUnitsEnergy(units->iTime, units->iMass, units->iLength); fsUnitsEnergy(units, cUnit); @@ -1055,13 +1055,13 @@ void WriteTotEnergy(BODY *body, CONTROL *control, OUTPUT *output, void WritePotEnergy(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, - double *dTmp, char cUnit[]) { + double *dTmp, char **cUnit) { *dTmp = fdPotEnergy(body, control, system, iBody); if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { *dTmp /= fdUnitsEnergy(units->iTime, units->iMass, units->iLength); fsUnitsEnergy(units, cUnit); @@ -1070,13 +1070,13 @@ void WritePotEnergy(BODY *body, CONTROL *control, OUTPUT *output, void WriteKinEnergy(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, - double *dTmp, char cUnit[]) { + double *dTmp, char **cUnit) { *dTmp = fdKinEnergy(body, control, system, iBody); if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { *dTmp /= fdUnitsEnergy(units->iTime, units->iMass, units->iLength); fsUnitsEnergy(units, cUnit); @@ -1085,13 +1085,13 @@ void WriteKinEnergy(BODY *body, CONTROL *control, OUTPUT *output, void WriteOrbKinEnergy(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, - double *dTmp, char cUnit[]) { + double *dTmp, char **cUnit) { *dTmp = fdOrbKinEnergy(body, control, system, iBody); if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { *dTmp /= fdUnitsEnergy(units->iTime, units->iMass, units->iLength); fsUnitsEnergy(units, cUnit); @@ -1100,7 +1100,7 @@ void WriteOrbKinEnergy(BODY *body, CONTROL *control, OUTPUT *output, void WriteOrbPotEnergy(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, - double *dTmp, char cUnit[]) { + double *dTmp, char **cUnit) { if (iBody > 0) { *dTmp = fdOrbPotEnergy(body, control, system, iBody); @@ -1110,7 +1110,7 @@ void WriteOrbPotEnergy(BODY *body, CONTROL *control, OUTPUT *output, if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { *dTmp /= fdUnitsEnergy(units->iTime, units->iMass, units->iLength); fsUnitsEnergy(units, cUnit); @@ -1119,12 +1119,12 @@ void WriteOrbPotEnergy(BODY *body, CONTROL *control, OUTPUT *output, void WriteTotOrbEnergy(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, - double *dTmp, char cUnit[]) { + double *dTmp, char **cUnit) { *dTmp = fdTotOrbEnergy(body, control, system); if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { *dTmp /= fdUnitsEnergy(units->iTime, units->iMass, units->iLength); fsUnitsEnergy(units, cUnit); @@ -1133,7 +1133,7 @@ void WriteTotOrbEnergy(BODY *body, CONTROL *control, OUTPUT *output, void WriteImK2(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, double *dTmp, - char cUnit[]) { + char **cUnit) { // ImK2 should always be up to date if (body[iBody].bEqtide) { @@ -1141,54 +1141,54 @@ void WriteImK2(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, } else { *dTmp = -1; } - strcpy(cUnit, ""); + fvFormattedString(cUnit, ""); } void WriteK2(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, double *dTmp, - char cUnit[]) { + char **cUnit) { if (body[iBody].bThermint && !body[iBody].bOcean && !body[iBody].bEnv) { *dTmp = fdK2Man(body, iBody); } else { *dTmp = body[iBody].dK2; } - strcpy(cUnit, ""); + fvFormattedString(cUnit, ""); } void WriteXobl(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, double *dTmp, - char cUnit[]) { + char **cUnit) { *dTmp = body[iBody].dXobl; - strcpy(cUnit, ""); + fvFormattedString(cUnit, ""); } void WriteYobl(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, double *dTmp, - char cUnit[]) { + char **cUnit) { *dTmp = body[iBody].dYobl; - strcpy(cUnit, ""); + fvFormattedString(cUnit, ""); } void WriteZobl(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, double *dTmp, - char cUnit[]) { + char **cUnit) { *dTmp = body[iBody].dZobl; - strcpy(cUnit, ""); + fvFormattedString(cUnit, ""); } void WriteMeanAnomaly(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, - double *dTmp, char cUnit[]) { + double *dTmp, char **cUnit) { *dTmp = body[iBody].dMeanA; if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { *dTmp /= fdUnitsAngle(units->iAngle); fsUnitsAngle(units->iAngle, cUnit); @@ -1197,7 +1197,7 @@ void WriteMeanAnomaly(BODY *body, CONTROL *control, OUTPUT *output, void WriteMeanLongitude(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, - double *dTmp, char cUnit[]) { + double *dTmp, char **cUnit) { if (control->Evolve.bUsingDistOrb && iBody != 0) { *dTmp = body[iBody].dMeanL + sqrt(body[iBody].dMu / @@ -1212,7 +1212,7 @@ void WriteMeanLongitude(BODY *body, CONTROL *control, OUTPUT *output, if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { *dTmp /= fdUnitsAngle(units->iAngle); fsUnitsAngle(units->iAngle, cUnit); @@ -1229,9 +1229,9 @@ void InitializeOutputGeneral(OUTPUT *output, fnWriteOutput fnWrite[]) { * Age */ - sprintf(output[OUT_AGE].cName, "Age"); - sprintf(output[OUT_AGE].cDescr, "System Age"); - sprintf(output[OUT_AGE].cNeg, "Gyr"); + fvFormattedString(&output[OUT_AGE].cName, "Age"); + fvFormattedString(&output[OUT_AGE].cDescr, "System Age"); + fvFormattedString(&output[OUT_AGE].cNeg, "Gyr"); output[OUT_AGE].bNeg = 1; output[OUT_AGE].dNeg = 1. / (YEARSEC * 1e9); output[OUT_AGE].iNum = 1; @@ -1242,8 +1242,8 @@ void InitializeOutputGeneral(OUTPUT *output, fnWriteOutput fnWrite[]) { * B */ - sprintf(output[OUT_BODYTYPE].cName, "BodyType"); - sprintf(output[OUT_BODYTYPE].cDescr, "Type of Body (0 == planet)"); + fvFormattedString(&output[OUT_BODYTYPE].cName, "BodyType"); + fvFormattedString(&output[OUT_BODYTYPE].cDescr, "Type of Body (0 == planet)"); output[OUT_BODYTYPE].iNum = 1; output[OUT_BODYTYPE].iModuleBit = 1; fnWrite[OUT_BODYTYPE] = &WriteBodyType; @@ -1252,26 +1252,26 @@ void InitializeOutputGeneral(OUTPUT *output, fnWriteOutput fnWrite[]) { * C */ - sprintf(output[OUT_COPP].cName, "COPP"); - sprintf(output[OUT_COPP].cDescr, "Climate Obliquity Precession Parameter"); + fvFormattedString(&output[OUT_COPP].cName, "COPP"); + fvFormattedString(&output[OUT_COPP].cDescr, "Climate Obliquity Precession Parameter"); output[OUT_COPP].bNeg = 0; output[OUT_COPP].iNum = 1; output[OUT_COPP].iModuleBit = BINARY + EQTIDE + DISTROT + POISE + SPINBODY; fnWrite[OUT_COPP] = &WriteCOPP; - sprintf(output[OUT_COPP].cLongDescr, + fvFormattedString(&output[OUT_COPP].cLongDescr, "eccentriciy * sin(longitude of pericenter + precession angle) * " "sin(obliquity)"); - sprintf(output[OUT_CRITSEMI].cName, "CriticalSemiMajorAxis"); - sprintf(output[OUT_CRITSEMI].cDescr, + fvFormattedString(&output[OUT_CRITSEMI].cName, "CriticalSemiMajorAxis"); + fvFormattedString(&output[OUT_CRITSEMI].cDescr, "Holman & Wiegert (1999) P-type Critical Semi-major Axis"); - sprintf(output[OUT_CRITSEMI].cNeg, "AU"); + fvFormattedString(&output[OUT_CRITSEMI].cNeg, "AU"); output[OUT_CRITSEMI].bNeg = 1; output[OUT_CRITSEMI].dNeg = 1. / AUM; output[OUT_CRITSEMI].iNum = 1; output[OUT_CRITSEMI].iModuleBit = BINARY + EQTIDE + STELLAR; fnWrite[OUT_CRITSEMI] = &WriteCriticalSemi; - sprintf(output[OUT_CRITSEMI].cLongDescr, + fvFormattedString(&output[OUT_CRITSEMI].cLongDescr, "For a circumbinary planet, semi-major axes below a critical value " "result\n" "in unstable orbits. This output parameter prints the instantaneous\n" @@ -1281,18 +1281,18 @@ void InitializeOutputGeneral(OUTPUT *output, fnWriteOutput fnWrite[]) { * D */ - sprintf(output[OUT_DT].cName, "DeltaTime"); - sprintf(output[OUT_DT].cDescr, "Average Timestep Over Last Output Interval"); - sprintf(output[OUT_DT].cNeg, "years"); + fvFormattedString(&output[OUT_DT].cName, "DeltaTime"); + fvFormattedString(&output[OUT_DT].cDescr, "Average Timestep Over Last Output Interval"); + fvFormattedString(&output[OUT_DT].cNeg, "years"); output[OUT_DT].bNeg = 1; output[OUT_DT].dNeg = 1. / YEARSEC; output[OUT_DT].iNum = 1; output[OUT_DT].iModuleBit = 1; fnWrite[OUT_DT] = &WriteDeltaTime; - sprintf(output[OUT_DENSITY].cName, "Density"); - sprintf(output[OUT_DENSITY].cDescr, "Average Density"); - sprintf(output[OUT_DENSITY].cNeg, "EarthDensity"); + fvFormattedString(&output[OUT_DENSITY].cName, "Density"); + fvFormattedString(&output[OUT_DENSITY].cDescr, "Average Density"); + fvFormattedString(&output[OUT_DENSITY].cNeg, "EarthDensity"); output[OUT_DENSITY].bNeg = 1; output[OUT_DENSITY].dNeg = 3 * REARTH * REARTH * REARTH / (4 * PI * MEARTH); // kg/m^3 @@ -1304,96 +1304,96 @@ void InitializeOutputGeneral(OUTPUT *output, fnWriteOutput fnWrite[]) { * H */ - sprintf(output[OUT_HECC].cName, "HEcc"); - sprintf(output[OUT_HECC].cDescr, "Poincare's h (=e*sin(varpi)"); + fvFormattedString(&output[OUT_HECC].cName, "HEcc"); + fvFormattedString(&output[OUT_HECC].cDescr, "Poincare's h (=e*sin(varpi)"); output[OUT_HECC].bNeg = 0; output[OUT_HECC].iNum = 1; output[OUT_HECC].iModuleBit = EQTIDE + DISTORB; fnWrite[OUT_HECC] = &WriteHecc; - sprintf(output[OUT_HZLIMDRYRUNAWAY].cName, "HZLimitDryRunaway"); - sprintf(output[OUT_HZLIMDRYRUNAWAY].cDescr, + fvFormattedString(&output[OUT_HZLIMDRYRUNAWAY].cName, "HZLimitDryRunaway"); + fvFormattedString(&output[OUT_HZLIMDRYRUNAWAY].cDescr, "Semi-major axis of Dry Runaway HZ Limit"); - sprintf(output[OUT_HZLIMDRYRUNAWAY].cNeg, "AU"); + fvFormattedString(&output[OUT_HZLIMDRYRUNAWAY].cNeg, "AU"); output[OUT_HZLIMDRYRUNAWAY].bNeg = 1; output[OUT_HZLIMDRYRUNAWAY].dNeg = 1 / AUM; output[OUT_HZLIMDRYRUNAWAY].iNum = 1; output[OUT_HZLIMDRYRUNAWAY].iModuleBit = 1; fnWrite[OUT_HZLIMDRYRUNAWAY] = &WriteHZLimitDryRunaway; - sprintf(output[OUT_HZLIMDRYRUNAWAY].cLongDescr, + fvFormattedString(&output[OUT_HZLIMDRYRUNAWAY].cLongDescr, "Minimum distance where a \"dry\" planet can be habitable, following " "Abe\n" "et al. (2011), or ~415 W/m^2 net instellation."); - sprintf(output[OUT_HZLIMRECVENUS].cName, "HZLimRecVenus"); - sprintf(output[OUT_HZLIMRECVENUS].cDescr, "Recent Venus HZ Limit"); - sprintf(output[OUT_HZLIMRECVENUS].cNeg, "AU"); + fvFormattedString(&output[OUT_HZLIMRECVENUS].cName, "HZLimRecVenus"); + fvFormattedString(&output[OUT_HZLIMRECVENUS].cDescr, "Recent Venus HZ Limit"); + fvFormattedString(&output[OUT_HZLIMRECVENUS].cNeg, "AU"); output[OUT_HZLIMRECVENUS].bNeg = 1; output[OUT_HZLIMRECVENUS].dNeg = 1. / AUM; output[OUT_HZLIMRECVENUS].iNum = 1; output[OUT_HZLIMRECVENUS].iModuleBit = 1; fnWrite[OUT_HZLIMRECVENUS] = &WriteHZLimitRecentVenus; - sprintf(output[OUT_HZLIMRECVENUS].cLongDescr, + fvFormattedString(&output[OUT_HZLIMRECVENUS].cLongDescr, "Recent Venus habitable zone limit from Kopparapu et al. (2013). The " "value\n" "is determined by the total luminosity and average effective " "temperature\n" "of all interior bodies."); - sprintf(output[OUT_HZLIMRUNAWAY].cName, "HZLimRunaway"); - sprintf(output[OUT_HZLIMRUNAWAY].cDescr, "Runaway Greenhouse HZ Limit"); - sprintf(output[OUT_HZLIMRUNAWAY].cNeg, "AU"); + fvFormattedString(&output[OUT_HZLIMRUNAWAY].cName, "HZLimRunaway"); + fvFormattedString(&output[OUT_HZLIMRUNAWAY].cDescr, "Runaway Greenhouse HZ Limit"); + fvFormattedString(&output[OUT_HZLIMRUNAWAY].cNeg, "AU"); output[OUT_HZLIMRUNAWAY].bNeg = 1; output[OUT_HZLIMRUNAWAY].dNeg = 1. / AUM; output[OUT_HZLIMRUNAWAY].iNum = 1; output[OUT_HZLIMRUNAWAY].iModuleBit = 1; fnWrite[OUT_HZLIMRUNAWAY] = &WriteHZLimitRunawayGreenhouse; - sprintf(output[OUT_HZLIMRUNAWAY].cLongDescr, + fvFormattedString(&output[OUT_HZLIMRUNAWAY].cLongDescr, "Runaway greenhouse habitable zone limit from Kopparapu et al. " "(2013).\n" "The value is determined by the total luminosity and average " "effective\n" "temperature of all interior bodies."); - sprintf(output[OUT_HZLIMMOIST].cName, "HZLimMoistGreenhouse"); - sprintf(output[OUT_HZLIMMOIST].cDescr, "Moist Greenhouse HZ Limit"); - sprintf(output[OUT_HZLIMMOIST].cNeg, "AU"); + fvFormattedString(&output[OUT_HZLIMMOIST].cName, "HZLimMoistGreenhouse"); + fvFormattedString(&output[OUT_HZLIMMOIST].cDescr, "Moist Greenhouse HZ Limit"); + fvFormattedString(&output[OUT_HZLIMMOIST].cNeg, "AU"); output[OUT_HZLIMMOIST].bNeg = 1; output[OUT_HZLIMMOIST].dNeg = 1. / AUM; output[OUT_HZLIMMOIST].iNum = 1; output[OUT_HZLIMMOIST].iModuleBit = 1; fnWrite[OUT_HZLIMMOIST] = &WriteHZLimitMoistGreenhouse; - sprintf( - output[OUT_HZLIMMOIST].cLongDescr, + fvFormattedString( + &output[OUT_HZLIMMOIST].cLongDescr, "Moist greenhouse habitable zone limit from Kopparapu et al. (2013).\n" "The value is determined by the total luminosity and average " "effective\n" "temperature of all interior bodies."); - sprintf(output[OUT_HZLIMMAX].cName, "HZLimMaxGreenhouse"); - sprintf(output[OUT_HZLIMMAX].cDescr, "Maximum Greenhouse HZ Limit"); - sprintf(output[OUT_HZLIMMAX].cNeg, "AU"); + fvFormattedString(&output[OUT_HZLIMMAX].cName, "HZLimMaxGreenhouse"); + fvFormattedString(&output[OUT_HZLIMMAX].cDescr, "Maximum Greenhouse HZ Limit"); + fvFormattedString(&output[OUT_HZLIMMAX].cNeg, "AU"); output[OUT_HZLIMMAX].bNeg = 1; output[OUT_HZLIMMAX].dNeg = 1. / AUM; output[OUT_HZLIMMAX].iNum = 1; output[OUT_HZLIMMAX].iModuleBit = 1; fnWrite[OUT_HZLIMMAX] = &WriteHZLimitMaxGreenhouse; - sprintf(output[OUT_HZLIMMAX].cLongDescr, + fvFormattedString(&output[OUT_HZLIMMAX].cLongDescr, "Maximum greenhouse habitable zone limit from Kopparapu et al. " "(2013).\n" "The value is determined by the total luminosity and average " "effective\n" "temperature of all interior bodies."); - sprintf(output[OUT_HZLIMEARLYMARS].cName, "HZLimEarlyMars"); - sprintf(output[OUT_HZLIMEARLYMARS].cDescr, "Early Mars HZ Limit"); - sprintf(output[OUT_HZLIMEARLYMARS].cNeg, "AU"); + fvFormattedString(&output[OUT_HZLIMEARLYMARS].cName, "HZLimEarlyMars"); + fvFormattedString(&output[OUT_HZLIMEARLYMARS].cDescr, "Early Mars HZ Limit"); + fvFormattedString(&output[OUT_HZLIMEARLYMARS].cNeg, "AU"); output[OUT_HZLIMEARLYMARS].bNeg = 1; output[OUT_HZLIMEARLYMARS].dNeg = 1. / AUM; output[OUT_HZLIMEARLYMARS].iNum = 1; output[OUT_HZLIMEARLYMARS].iModuleBit = 1; fnWrite[OUT_HZLIMEARLYMARS] = &WriteHZLimitEarlyMars; - sprintf(output[OUT_HZLIMEARLYMARS].cLongDescr, + fvFormattedString(&output[OUT_HZLIMEARLYMARS].cLongDescr, "Early Mars habitable zone limit from Kopparapu et al. (2013). The " "value\n" "is determined by the total luminosity and average effective " @@ -1405,9 +1405,9 @@ void InitializeOutputGeneral(OUTPUT *output, fnWriteOutput fnWrite[]) { */ /* Imk2Man */ - sprintf(output[OUT_IMK2MAN].cName, "Imk2Man"); - sprintf(output[OUT_IMK2MAN].cDescr, "Imaginary Love Number k2 Mantle"); - sprintf(output[OUT_IMK2MAN].cNeg, "nd"); + fvFormattedString(&output[OUT_IMK2MAN].cName, "Imk2Man"); + fvFormattedString(&output[OUT_IMK2MAN].cDescr, "Imaginary Love Number k2 Mantle"); + fvFormattedString(&output[OUT_IMK2MAN].cNeg, "nd"); output[OUT_IMK2MAN].bNeg = 1; output[OUT_IMK2MAN].dNeg = 1; output[OUT_IMK2MAN].iNum = 1; @@ -1415,25 +1415,25 @@ void InitializeOutputGeneral(OUTPUT *output, fnWriteOutput fnWrite[]) { fnWrite[OUT_IMK2MAN] = &WriteImK2Man; - sprintf(output[OUT_INC].cName, "Inc"); - sprintf(output[OUT_INC].cDescr, "Body's Inclination"); - sprintf(output[OUT_INC].cNeg, "Deg"); + fvFormattedString(&output[OUT_INC].cName, "Inc"); + fvFormattedString(&output[OUT_INC].cDescr, "Body's Inclination"); + fvFormattedString(&output[OUT_INC].cNeg, "Deg"); output[OUT_INC].bNeg = 1; output[OUT_INC].dNeg = 1. / DEGRAD; output[OUT_INC].iNum = 1; output[OUT_INC].iModuleBit = DISTORB + GALHABIT + SPINBODY + BINARY; fnWrite[OUT_INC] = &WriteBodyInc; - sprintf(output[OUT_INSTELLATION].cName, "Instellation"); - sprintf(output[OUT_INSTELLATION].cDescr, + fvFormattedString(&output[OUT_INSTELLATION].cName, "Instellation"); + fvFormattedString(&output[OUT_INSTELLATION].cDescr, "Orbit-averaged INcident STELLar radiATION"); - sprintf(output[OUT_INSTELLATION].cNeg, "W/m^2"); + fvFormattedString(&output[OUT_INSTELLATION].cNeg, "W/m^2"); output[OUT_INSTELLATION].bNeg = 1; output[OUT_INSTELLATION].dNeg = 1; output[OUT_INSTELLATION].iNum = 1; output[OUT_INSTELLATION].iModuleBit = 1; fnWrite[OUT_INSTELLATION] = &WriteInstellation; - sprintf(output[OUT_INSTELLATION].cLongDescr, + fvFormattedString(&output[OUT_INSTELLATION].cLongDescr, "Total instellation on a planet from all luminous, interior bodies."); /* @@ -1441,17 +1441,17 @@ void InitializeOutputGeneral(OUTPUT *output, fnWriteOutput fnWrite[]) { */ /* K2Man */ - sprintf(output[OUT_K2MAN].cName, "K2Man"); - sprintf(output[OUT_K2MAN].cDescr, "Real Love Number k2 Mantle"); - sprintf(output[OUT_K2MAN].cNeg, "nd"); + fvFormattedString(&output[OUT_K2MAN].cName, "K2Man"); + fvFormattedString(&output[OUT_K2MAN].cDescr, "Real Love Number k2 Mantle"); + fvFormattedString(&output[OUT_K2MAN].cNeg, "nd"); output[OUT_K2MAN].bNeg = 1; output[OUT_K2MAN].dNeg = 1; output[OUT_K2MAN].iNum = 1; output[OUT_K2MAN].iModuleBit = THERMINT + EQTIDE; fnWrite[OUT_K2MAN] = &WriteK2Man; - sprintf(output[OUT_KECC].cName, "KEcc"); - sprintf(output[OUT_KECC].cDescr, "Poincare's k (=e*cos(varpi)"); + fvFormattedString(&output[OUT_KECC].cName, "KEcc"); + fvFormattedString(&output[OUT_KECC].cDescr, "Poincare's k (=e*cos(varpi)"); output[OUT_KECC].bNeg = 0; output[OUT_KECC].iNum = 1; output[OUT_KECC].iModuleBit = EQTIDE + DISTORB; @@ -1461,36 +1461,36 @@ void InitializeOutputGeneral(OUTPUT *output, fnWriteOutput fnWrite[]) { * L */ - sprintf(output[OUT_LONGA].cName, "LongA"); - sprintf(output[OUT_LONGA].cDescr, "Body's Longitude of ascending node"); - sprintf(output[OUT_LONGA].cNeg, "Deg"); + fvFormattedString(&output[OUT_LONGA].cName, "LongA"); + fvFormattedString(&output[OUT_LONGA].cDescr, "Body's Longitude of ascending node"); + fvFormattedString(&output[OUT_LONGA].cNeg, "Deg"); output[OUT_LONGA].bNeg = 1; output[OUT_LONGA].dNeg = 1. / DEGRAD; output[OUT_LONGA].iNum = 1; output[OUT_LONGA].iModuleBit = DISTORB + GALHABIT + SPINBODY + BINARY; fnWrite[OUT_LONGA] = &WriteBodyLongA; - sprintf(output[OUT_LONGP].cName, "LongP"); - sprintf(output[OUT_LONGP].cDescr, "Body's Longitude of pericenter"); - sprintf(output[OUT_LONGP].cNeg, "Deg"); + fvFormattedString(&output[OUT_LONGP].cName, "LongP"); + fvFormattedString(&output[OUT_LONGP].cDescr, "Body's Longitude of pericenter"); + fvFormattedString(&output[OUT_LONGP].cNeg, "Deg"); output[OUT_LONGP].bNeg = 1; output[OUT_LONGP].dNeg = 1. / DEGRAD; output[OUT_LONGP].iNum = 1; output[OUT_LONGP].iModuleBit = EQTIDE + DISTORB + BINARY + SPINBODY; fnWrite[OUT_LONGP] = &WriteLongP; - sprintf(output[OUT_ARGP].cName, "ArgP"); - sprintf(output[OUT_ARGP].cDescr, "Body's argument of pericenter"); - sprintf(output[OUT_ARGP].cNeg, "Deg"); + fvFormattedString(&output[OUT_ARGP].cName, "ArgP"); + fvFormattedString(&output[OUT_ARGP].cDescr, "Body's argument of pericenter"); + fvFormattedString(&output[OUT_ARGP].cNeg, "Deg"); output[OUT_ARGP].bNeg = 1; output[OUT_ARGP].dNeg = 1. / DEGRAD; output[OUT_ARGP].iNum = 1; output[OUT_ARGP].iModuleBit = DISTORB + GALHABIT + SPINBODY + BINARY; fnWrite[OUT_ARGP] = &WriteBodyArgP; - sprintf(output[OUT_LXUVTOT].cName, "LXUVTot"); - sprintf(output[OUT_LXUVTOT].cDescr, "Total XUV Luminosity"); - sprintf(output[OUT_LXUVTOT].cNeg, "LSUN"); + fvFormattedString(&output[OUT_LXUVTOT].cName, "LXUVTot"); + fvFormattedString(&output[OUT_LXUVTOT].cDescr, "Total XUV Luminosity"); + fvFormattedString(&output[OUT_LXUVTOT].cNeg, "LSUN"); output[OUT_LXUVTOT].bNeg = 1; output[OUT_LXUVTOT].dNeg = 1. / LSUN; output[OUT_LXUVTOT].iNum = 1; @@ -1503,9 +1503,9 @@ void InitializeOutputGeneral(OUTPUT *output, fnWriteOutput fnWrite[]) { * M */ - sprintf(output[OUT_MASS].cName, "Mass"); - sprintf(output[OUT_MASS].cDescr, "Mass"); - sprintf(output[OUT_MASS].cNeg, "Mearth"); + fvFormattedString(&output[OUT_MASS].cName, "Mass"); + fvFormattedString(&output[OUT_MASS].cDescr, "Mass"); + fvFormattedString(&output[OUT_MASS].cNeg, "Mearth"); output[OUT_MASS].bNeg = 1; output[OUT_MASS].dNeg = 1. / MEARTH; output[OUT_MASS].iNum = 1; @@ -1517,94 +1517,94 @@ void InitializeOutputGeneral(OUTPUT *output, fnWriteOutput fnWrite[]) { * O */ - sprintf(output[OUT_OBL].cName, "Obliquity"); - sprintf(output[OUT_OBL].cDescr, "Obliquity"); - sprintf(output[OUT_OBL].cNeg, "deg"); + fvFormattedString(&output[OUT_OBL].cName, "Obliquity"); + fvFormattedString(&output[OUT_OBL].cDescr, "Obliquity"); + fvFormattedString(&output[OUT_OBL].cNeg, "deg"); output[OUT_OBL].bNeg = 1; output[OUT_OBL].dNeg = DEGRAD; output[OUT_OBL].iNum = 1; output[OUT_OBL].iModuleBit = EQTIDE + DISTROT + POISE; fnWrite[OUT_OBL] = &WriteObliquity; - sprintf(output[OUT_PRECA].cName, "PrecA"); - sprintf(output[OUT_PRECA].cDescr, "Body's precession angle"); - sprintf(output[OUT_PRECA].cNeg, "Deg"); + fvFormattedString(&output[OUT_PRECA].cName, "PrecA"); + fvFormattedString(&output[OUT_PRECA].cDescr, "Body's precession angle"); + fvFormattedString(&output[OUT_PRECA].cNeg, "Deg"); output[OUT_PRECA].bNeg = 1; output[OUT_PRECA].dNeg = 1. / DEGRAD; output[OUT_PRECA].iNum = 1; output[OUT_PRECA].iModuleBit = EQTIDE + DISTROT + POISE; fnWrite[OUT_PRECA] = &WriteBodyPrecA; - sprintf(output[OUT_PRECA].cLongDescr, + fvFormattedString(&output[OUT_PRECA].cLongDescr, "The precession angle is orthogonal to the obliquity and is measured " "from\n" "the vernal equinox. This angle is a \"dog-leg\" angle as shown in " "Fig. 30\n" "of Barnes et al. (2020)."); - sprintf(output[OUT_ORBANGMOM].cName, "OrbAngMom"); - sprintf(output[OUT_ORBANGMOM].cDescr, "Orbital Angular Momentum"); - sprintf(output[OUT_ORBANGMOM].cNeg, "kg*m^2/s"); + fvFormattedString(&output[OUT_ORBANGMOM].cName, "OrbAngMom"); + fvFormattedString(&output[OUT_ORBANGMOM].cDescr, "Orbital Angular Momentum"); + fvFormattedString(&output[OUT_ORBANGMOM].cNeg, "kg*m^2/s"); output[OUT_ORBANGMOM].bNeg = 1; output[OUT_ORBANGMOM].iNum = 1; output[OUT_ORBANGMOM].dNeg = 1.0; output[OUT_ORBANGMOM].iModuleBit = EQTIDE + DISTORB + BINARY + SPINBODY; fnWrite[OUT_ORBANGMOM] = &WriteOrbAngMom; - sprintf(output[OUT_ORBECC].cName, "Eccentricity"); - sprintf(output[OUT_ORBECC].cDescr, "Orbital Eccentricity"); + fvFormattedString(&output[OUT_ORBECC].cName, "Eccentricity"); + fvFormattedString(&output[OUT_ORBECC].cDescr, "Orbital Eccentricity"); output[OUT_ORBECC].iNum = 1; output[OUT_ORBECC].bNeg = 0; output[OUT_ORBECC].iModuleBit = EQTIDE + DISTORB + BINARY + GALHABIT + POISE + SPINBODY; fnWrite[OUT_ORBECC] = &WriteOrbEcc; - sprintf(output[OUT_MEANA].cName, "MeanAnomaly"); - sprintf(output[OUT_MEANA].cDescr, "Orbital Mean Anomaly"); - sprintf(output[OUT_MEANA].cNeg, "Deg"); + fvFormattedString(&output[OUT_MEANA].cName, "MeanAnomaly"); + fvFormattedString(&output[OUT_MEANA].cDescr, "Orbital Mean Anomaly"); + fvFormattedString(&output[OUT_MEANA].cNeg, "Deg"); output[OUT_MEANA].iNum = 1; output[OUT_MEANA].bNeg = 1; output[OUT_MEANA].dNeg = 1 / DEGRAD; output[OUT_MEANA].iModuleBit = SPINBODY; fnWrite[OUT_MEANA] = &WriteMeanAnomaly; - sprintf(output[OUT_MEANL].cName, "MeanLongitude"); - sprintf(output[OUT_MEANL].cDescr, "Orbital Mean Longitude"); - sprintf(output[OUT_MEANL].cNeg, "Deg"); + fvFormattedString(&output[OUT_MEANL].cName, "MeanLongitude"); + fvFormattedString(&output[OUT_MEANL].cDescr, "Orbital Mean Longitude"); + fvFormattedString(&output[OUT_MEANL].cNeg, "Deg"); output[OUT_MEANL].iNum = 1; output[OUT_MEANL].bNeg = 1; output[OUT_MEANL].dNeg = 1 / DEGRAD; output[OUT_MEANL].iModuleBit = SPINBODY + DISTORB; fnWrite[OUT_MEANL] = &WriteMeanLongitude; - sprintf(output[OUT_ORBEN].cName, "OrbEnergy"); - sprintf(output[OUT_ORBEN].cDescr, "Body's Total Orbital Energy"); - sprintf(output[OUT_ORBEN].cNeg, "ergs"); + fvFormattedString(&output[OUT_ORBEN].cName, "OrbEnergy"); + fvFormattedString(&output[OUT_ORBEN].cDescr, "Body's Total Orbital Energy"); + fvFormattedString(&output[OUT_ORBEN].cNeg, "ergs"); output[OUT_ORBEN].bNeg = 1; output[OUT_ORBEN].iNum = 1; output[OUT_ORBEN].iModuleBit = EQTIDE + DISTORB + BINARY; fnWrite[OUT_ORBEN] = &WriteOrbEnergy; - sprintf(output[OUT_LOSTENG].cName, "LostEnergy"); - sprintf(output[OUT_LOSTENG].cDescr, "Body's Total Lost Energy"); - sprintf(output[OUT_LOSTENG].cNeg, "ergs"); + fvFormattedString(&output[OUT_LOSTENG].cName, "LostEnergy"); + fvFormattedString(&output[OUT_LOSTENG].cDescr, "Body's Total Lost Energy"); + fvFormattedString(&output[OUT_LOSTENG].cNeg, "ergs"); output[OUT_LOSTENG].bNeg = 1; output[OUT_LOSTENG].iNum = 1; output[OUT_LOSTENG].iModuleBit = EQTIDE + STELLAR; fnWrite[OUT_LOSTENG] = &WriteLostEng; - sprintf(output[OUT_LOSTANGMOM].cName, "LostAngMom"); - sprintf(output[OUT_LOSTANGMOM].cDescr, + fvFormattedString(&output[OUT_LOSTANGMOM].cName, "LostAngMom"); + fvFormattedString(&output[OUT_LOSTANGMOM].cDescr, "Lost Angular Momentum due to Magnetic Braking"); - sprintf(output[OUT_LOSTANGMOM].cNeg, "kg*m^2/s"); + fvFormattedString(&output[OUT_LOSTANGMOM].cNeg, "kg*m^2/s"); output[OUT_LOSTANGMOM].bNeg = 1; output[OUT_LOSTANGMOM].iNum = 1; output[OUT_LOSTANGMOM].dNeg = 1.0; output[OUT_LOSTANGMOM].iModuleBit = STELLAR; fnWrite[OUT_LOSTANGMOM] = &WriteLostAngMom; - sprintf(output[OUT_ORBMEANMOTION].cName, "MeanMotion"); - sprintf(output[OUT_ORBMEANMOTION].cDescr, "Orbital Mean Motion"); - sprintf(output[OUT_ORBMEANMOTION].cNeg, "/day"); + fvFormattedString(&output[OUT_ORBMEANMOTION].cName, "MeanMotion"); + fvFormattedString(&output[OUT_ORBMEANMOTION].cDescr, "Orbital Mean Motion"); + fvFormattedString(&output[OUT_ORBMEANMOTION].cNeg, "/day"); output[OUT_ORBMEANMOTION].bNeg = 1; output[OUT_ORBMEANMOTION].dNeg = DAYSEC; output[OUT_ORBMEANMOTION].iNum = 1; @@ -1612,9 +1612,9 @@ void InitializeOutputGeneral(OUTPUT *output, fnWriteOutput fnWrite[]) { EQTIDE + DISTORB + BINARY + SPINBODY + ATMESC + POISE; fnWrite[OUT_ORBMEANMOTION] = &WriteOrbMeanMotion; - sprintf(output[OUT_ORBPER].cName, "OrbPeriod"); - sprintf(output[OUT_ORBPER].cDescr, "Orbital Period"); - sprintf(output[OUT_ORBPER].cNeg, "days"); + fvFormattedString(&output[OUT_ORBPER].cName, "OrbPeriod"); + fvFormattedString(&output[OUT_ORBPER].cDescr, "Orbital Period"); + fvFormattedString(&output[OUT_ORBPER].cNeg, "days"); output[OUT_ORBPER].bNeg = 1; output[OUT_ORBPER].dNeg = 1. / DAYSEC; output[OUT_ORBPER].iNum = 1; @@ -1622,9 +1622,9 @@ void InitializeOutputGeneral(OUTPUT *output, fnWriteOutput fnWrite[]) { EQTIDE + DISTORB + BINARY + POISE + SPINBODY + ATMESC; fnWrite[OUT_ORBPER] = &WriteOrbPeriod; - sprintf(output[OUT_ORBSEMI].cName, "SemiMajorAxis"); - sprintf(output[OUT_ORBSEMI].cDescr, "Semi-major Axis"); - sprintf(output[OUT_ORBSEMI].cNeg, "AU"); + fvFormattedString(&output[OUT_ORBSEMI].cName, "SemiMajorAxis"); + fvFormattedString(&output[OUT_ORBSEMI].cDescr, "Semi-major Axis"); + fvFormattedString(&output[OUT_ORBSEMI].cNeg, "AU"); output[OUT_ORBSEMI].bNeg = 1; output[OUT_ORBSEMI].dNeg = 1. / AUM; output[OUT_ORBSEMI].iNum = 1; @@ -1636,60 +1636,60 @@ void InitializeOutputGeneral(OUTPUT *output, fnWriteOutput fnWrite[]) { * R */ - sprintf(output[OUT_RADIUS].cName, "Radius"); - sprintf(output[OUT_RADIUS].cDescr, "Radius"); + fvFormattedString(&output[OUT_RADIUS].cName, "Radius"); + fvFormattedString(&output[OUT_RADIUS].cDescr, "Radius"); output[OUT_RADIUS].bNeg = 1; - sprintf(output[OUT_RADIUS].cNeg, "Rearth"); + fvFormattedString(&output[OUT_RADIUS].cNeg, "Rearth"); output[OUT_RADIUS].dNeg = 1. / REARTH; output[OUT_RADIUS].iNum = 1; output[OUT_RADIUS].iModuleBit = 1; fnWrite[OUT_RADIUS] = &WriteRadius; - sprintf(output[OUT_RADGYRA].cName, "RadGyra"); - sprintf(output[OUT_RADGYRA].cDescr, + fvFormattedString(&output[OUT_RADGYRA].cName, "RadGyra"); + fvFormattedString(&output[OUT_RADGYRA].cDescr, "Radius of Gyration/Moment of Inertia Constant"); output[OUT_RADGYRA].bNeg = 0; output[OUT_RADGYRA].iNum = 1; output[OUT_RADGYRA].iModuleBit = 1; fnWrite[OUT_RADGYRA] = &WriteRadGyra; - sprintf(output[OUT_ROTANGMOM].cName, "RotAngMom"); - sprintf(output[OUT_ROTANGMOM].cDescr, "Rotational Angular Momentum"); - sprintf(output[OUT_ROTANGMOM].cNeg, "kg*m^2/s"); + fvFormattedString(&output[OUT_ROTANGMOM].cName, "RotAngMom"); + fvFormattedString(&output[OUT_ROTANGMOM].cDescr, "Rotational Angular Momentum"); + fvFormattedString(&output[OUT_ROTANGMOM].cNeg, "kg*m^2/s"); output[OUT_ROTANGMOM].bNeg = 1; output[OUT_ROTANGMOM].iNum = 1; output[OUT_ROTANGMOM].dNeg = 1.0; output[OUT_ROTANGMOM].iModuleBit = EQTIDE + DISTROT + STELLAR + BINARY; fnWrite[OUT_ROTANGMOM] = &WriteRotAngMom; - sprintf(output[OUT_ROTKINENERGY].cName, "RotKinEnergy"); - sprintf(output[OUT_ROTKINENERGY].cDescr, "Body's Rotational Energy"); - sprintf(output[OUT_ROTKINENERGY].cNeg, "ergs"); + fvFormattedString(&output[OUT_ROTKINENERGY].cName, "RotKinEnergy"); + fvFormattedString(&output[OUT_ROTKINENERGY].cDescr, "Body's Rotational Energy"); + fvFormattedString(&output[OUT_ROTKINENERGY].cNeg, "ergs"); output[OUT_ROTKINENERGY].iNum = 1; output[OUT_ROTKINENERGY].iModuleBit = EQTIDE + DISTORB; fnWrite[OUT_ROTKINENERGY] = &WriteRotKinEnergy; - sprintf(output[OUT_ROTPER].cName, "RotPer"); - sprintf(output[OUT_ROTPER].cDescr, "Rotational Period"); - sprintf(output[OUT_ROTPER].cNeg, "days"); + fvFormattedString(&output[OUT_ROTPER].cName, "RotPer"); + fvFormattedString(&output[OUT_ROTPER].cDescr, "Rotational Period"); + fvFormattedString(&output[OUT_ROTPER].cNeg, "days"); output[OUT_ROTPER].bNeg = 1; output[OUT_ROTPER].dNeg = 1. / DAYSEC; output[OUT_ROTPER].iNum = 1; output[OUT_ROTPER].iModuleBit = EQTIDE + DISTROT + STELLAR; fnWrite[OUT_ROTPER] = &WriteRotPer; - sprintf(output[OUT_ROTRATE].cName, "RotRate"); - sprintf(output[OUT_ROTRATE].cDescr, "Rotational Frequency"); - sprintf(output[OUT_ROTRATE].cNeg, "/day"); + fvFormattedString(&output[OUT_ROTRATE].cName, "RotRate"); + fvFormattedString(&output[OUT_ROTRATE].cDescr, "Rotational Frequency"); + fvFormattedString(&output[OUT_ROTRATE].cNeg, "/day"); output[OUT_ROTRATE].bNeg = 1; output[OUT_ROTRATE].dNeg = DAYSEC; output[OUT_ROTRATE].iNum = 1; output[OUT_ROTRATE].iModuleBit = EQTIDE + DISTROT + STELLAR; fnWrite[OUT_ROTRATE] = &WriteRotRate; - sprintf(output[OUT_ROTVEL].cName, "RotVel"); - sprintf(output[OUT_ROTVEL].cDescr, "Rotational Velocity"); - sprintf(output[OUT_ROTVEL].cNeg, "km/s"); + fvFormattedString(&output[OUT_ROTVEL].cName, "RotVel"); + fvFormattedString(&output[OUT_ROTVEL].cDescr, "Rotational Velocity"); + fvFormattedString(&output[OUT_ROTVEL].cNeg, "km/s"); output[OUT_ROTVEL].bNeg = 1; output[OUT_ROTVEL].dNeg = 1e-5; output[OUT_ROTVEL].iNum = 1; @@ -1702,18 +1702,18 @@ void InitializeOutputGeneral(OUTPUT *output, fnWriteOutput fnWrite[]) { * */ - sprintf(output[OUT_SURFENFLUX].cName, "SurfEnFluxTotal"); - sprintf(output[OUT_SURFENFLUX].cDescr, "Total Surface Energy Flux"); - sprintf(output[OUT_SURFENFLUX].cNeg, "W/m^2"); + fvFormattedString(&output[OUT_SURFENFLUX].cName, "SurfEnFluxTotal"); + fvFormattedString(&output[OUT_SURFENFLUX].cDescr, "Total Surface Energy Flux"); + fvFormattedString(&output[OUT_SURFENFLUX].cNeg, "W/m^2"); output[OUT_SURFENFLUX].bNeg = 1; output[OUT_SURFENFLUX].dNeg = 1; output[OUT_SURFENFLUX].iNum = 1; output[OUT_SURFENFLUX].iModuleBit = EQTIDE + RADHEAT + THERMINT; fnWrite[OUT_SURFENFLUX] = &WriteSurfaceEnergyFlux; - sprintf(output[OUT_TIME].cName, "Time"); - sprintf(output[OUT_TIME].cDescr, "Simulation Time"); - sprintf(output[OUT_TIME].cNeg, "Gyr"); + fvFormattedString(&output[OUT_TIME].cName, "Time"); + fvFormattedString(&output[OUT_TIME].cDescr, "Simulation Time"); + fvFormattedString(&output[OUT_TIME].cNeg, "Gyr"); output[OUT_TIME].bNeg = 1; output[OUT_TIME].dNeg = 1. / (YEARSEC * 1e9); output[OUT_TIME].iNum = 1; @@ -1721,9 +1721,9 @@ void InitializeOutputGeneral(OUTPUT *output, fnWriteOutput fnWrite[]) { output[OUT_TIME].iModuleBit = 1; fnWrite[OUT_TIME] = &WriteTime; - sprintf(output[OUT_TOTANGMOM].cName, "TotAngMom"); - sprintf(output[OUT_TOTANGMOM].cDescr, "Total Angular Momentum"); - sprintf(output[OUT_TOTANGMOM].cNeg, "kg*m^2/s"); + fvFormattedString(&output[OUT_TOTANGMOM].cName, "TotAngMom"); + fvFormattedString(&output[OUT_TOTANGMOM].cDescr, "Total Angular Momentum"); + fvFormattedString(&output[OUT_TOTANGMOM].cNeg, "kg*m^2/s"); output[OUT_TOTANGMOM].bNeg = 1; output[OUT_TOTANGMOM].iNum = 1; output[OUT_TOTANGMOM].dNeg = 1.0; @@ -1731,104 +1731,104 @@ void InitializeOutputGeneral(OUTPUT *output, fnWriteOutput fnWrite[]) { EQTIDE + DISTORB + DISTROT + STELLAR + BINARY + SPINBODY; fnWrite[OUT_TOTANGMOM] = &WriteTotAngMom; - sprintf(output[OUT_TOTENERGY].cName, "TotEnergy"); - sprintf(output[OUT_TOTENERGY].cDescr, "Total System Energy"); - sprintf(output[OUT_TOTENERGY].cNeg, "ergs"); + fvFormattedString(&output[OUT_TOTENERGY].cName, "TotEnergy"); + fvFormattedString(&output[OUT_TOTENERGY].cDescr, "Total System Energy"); + fvFormattedString(&output[OUT_TOTENERGY].cNeg, "ergs"); output[OUT_TOTENERGY].bNeg = 1; output[OUT_TOTENERGY].dNeg = 1; output[OUT_TOTENERGY].iNum = 1; output[OUT_TOTENERGY].iModuleBit = EQTIDE + DISTORB + STELLAR + SPINBODY; fnWrite[OUT_TOTENERGY] = &WriteTotEnergy; - sprintf(output[OUT_POTENERGY].cName, "PotEnergy"); - sprintf(output[OUT_POTENERGY].cDescr, "Body's non-orbital Potential Energy"); - sprintf(output[OUT_POTENERGY].cNeg, "ergs"); + fvFormattedString(&output[OUT_POTENERGY].cName, "PotEnergy"); + fvFormattedString(&output[OUT_POTENERGY].cDescr, "Body's non-orbital Potential Energy"); + fvFormattedString(&output[OUT_POTENERGY].cNeg, "ergs"); output[OUT_POTENERGY].bNeg = 1; output[OUT_POTENERGY].dNeg = 1; output[OUT_POTENERGY].iNum = 1; output[OUT_POTENERGY].iModuleBit = 1; fnWrite[OUT_POTENERGY] = &WritePotEnergy; - sprintf(output[OUT_KINENERGY].cName, "KinEnergy"); - sprintf(output[OUT_KINENERGY].cDescr, "Body's non-orbital Kinetic Energy"); - sprintf(output[OUT_KINENERGY].cNeg, "ergs"); + fvFormattedString(&output[OUT_KINENERGY].cName, "KinEnergy"); + fvFormattedString(&output[OUT_KINENERGY].cDescr, "Body's non-orbital Kinetic Energy"); + fvFormattedString(&output[OUT_KINENERGY].cNeg, "ergs"); output[OUT_KINENERGY].bNeg = 1; output[OUT_KINENERGY].dNeg = 1; output[OUT_KINENERGY].iNum = 1; output[OUT_KINENERGY].iModuleBit = 1; fnWrite[OUT_KINENERGY] = &WriteKinEnergy; - sprintf(output[OUT_ORBKINENERGY].cName, "OrbKinEnergy"); - sprintf(output[OUT_ORBKINENERGY].cDescr, "Body's Orbital Kinetic Energy"); - sprintf(output[OUT_ORBKINENERGY].cNeg, "ergs"); + fvFormattedString(&output[OUT_ORBKINENERGY].cName, "OrbKinEnergy"); + fvFormattedString(&output[OUT_ORBKINENERGY].cDescr, "Body's Orbital Kinetic Energy"); + fvFormattedString(&output[OUT_ORBKINENERGY].cNeg, "ergs"); output[OUT_ORBKINENERGY].bNeg = 1; output[OUT_ORBKINENERGY].dNeg = 1; output[OUT_ORBKINENERGY].iNum = 1; output[OUT_ORBKINENERGY].iModuleBit = EQTIDE + DISTORB + BINARY + SPINBODY; fnWrite[OUT_ORBKINENERGY] = &WriteOrbKinEnergy; - sprintf(output[OUT_ORBKINENERGY].cName, "TotOrbEnergy"); - sprintf(output[OUT_ORBKINENERGY].cDescr, "System's Total Orbital Energy"); - sprintf(output[OUT_ORBKINENERGY].cNeg, "ergs"); + fvFormattedString(&output[OUT_ORBKINENERGY].cName, "TotOrbEnergy"); + fvFormattedString(&output[OUT_ORBKINENERGY].cDescr, "System's Total Orbital Energy"); + fvFormattedString(&output[OUT_ORBKINENERGY].cNeg, "ergs"); output[OUT_ORBKINENERGY].bNeg = 1; output[OUT_ORBKINENERGY].dNeg = 1; output[OUT_ORBKINENERGY].iNum = 1; output[OUT_ORBKINENERGY].iModuleBit = EQTIDE + DISTORB + BINARY + SPINBODY; fnWrite[OUT_ORBKINENERGY] = &WriteTotOrbEnergy; - sprintf(output[OUT_ORBPOTENERGY].cName, "OrbPotEnergy"); - sprintf(output[OUT_ORBPOTENERGY].cDescr, "Body's Orbital Potential Energy"); - sprintf(output[OUT_ORBPOTENERGY].cNeg, "ergs"); + fvFormattedString(&output[OUT_ORBPOTENERGY].cName, "OrbPotEnergy"); + fvFormattedString(&output[OUT_ORBPOTENERGY].cDescr, "Body's Orbital Potential Energy"); + fvFormattedString(&output[OUT_ORBPOTENERGY].cNeg, "ergs"); output[OUT_ORBPOTENERGY].bNeg = 1; output[OUT_ORBPOTENERGY].dNeg = 1; output[OUT_ORBPOTENERGY].iNum = 1; output[OUT_ORBPOTENERGY].iModuleBit = EQTIDE + DISTORB + BINARY + SPINBODY; fnWrite[OUT_ORBPOTENERGY] = &WriteOrbPotEnergy; - sprintf(output[OUT_IMK2].cName, "ImK2"); - sprintf(output[OUT_IMK2].cDescr, "Im(k_2)"); + fvFormattedString(&output[OUT_IMK2].cName, "ImK2"); + fvFormattedString(&output[OUT_IMK2].cDescr, "Im(k_2)"); output[OUT_IMK2].bNeg = 0; output[OUT_IMK2].iNum = 1; output[OUT_IMK2].iModuleBit = EQTIDE + THERMINT; fnWrite[OUT_IMK2] = &WriteImK2; - sprintf(output[OUT_K2].cName, "K2"); - sprintf(output[OUT_K2].cDescr, "k_2"); + fvFormattedString(&output[OUT_K2].cName, "K2"); + fvFormattedString(&output[OUT_K2].cDescr, "k_2"); output[OUT_K2].bNeg = 0; output[OUT_K2].iNum = 1; output[OUT_K2].iModuleBit = EQTIDE + THERMINT; fnWrite[OUT_K2] = &WriteK2; - sprintf(output[OUT_TIDALQ].cName, "TidalQ"); - sprintf(output[OUT_TIDALQ].cDescr, "Tidal Q"); + fvFormattedString(&output[OUT_TIDALQ].cName, "TidalQ"); + fvFormattedString(&output[OUT_TIDALQ].cDescr, "Tidal Q"); output[OUT_TIDALQ].bNeg = 0; output[OUT_TIDALQ].iNum = 1; output[OUT_TIDALQ].iModuleBit = EQTIDE + THERMINT; fnWrite[OUT_TIDALQ] = WriteTidalQ; - sprintf(output[OUT_TIDALQMAN].cName, "TidalQMantle"); - sprintf(output[OUT_TIDALQMAN].cDescr, "Mantle's Tidal Q"); + fvFormattedString(&output[OUT_TIDALQMAN].cName, "TidalQMantle"); + fvFormattedString(&output[OUT_TIDALQMAN].cDescr, "Mantle's Tidal Q"); output[OUT_TIDALQMAN].bNeg = 0; output[OUT_TIDALQMAN].iNum = 1; output[OUT_TIDALQMAN].iModuleBit = EQTIDE + THERMINT; fnWrite[OUT_TIDALQMAN] = WriteTidalQMantle; - sprintf(output[OUT_XOBL].cName, "Xobl"); - sprintf(output[OUT_XOBL].cDescr, + fvFormattedString(&output[OUT_XOBL].cName, "Xobl"); + fvFormattedString(&output[OUT_XOBL].cDescr, "Body's sin(obliquity)*cos(precession angle)"); output[OUT_XOBL].iNum = 1; output[OUT_XOBL].iModuleBit = EQTIDE + DISTROT; fnWrite[OUT_XOBL] = &WriteXobl; - sprintf(output[OUT_YOBL].cName, "Yobl"); - sprintf(output[OUT_YOBL].cDescr, + fvFormattedString(&output[OUT_YOBL].cName, "Yobl"); + fvFormattedString(&output[OUT_YOBL].cDescr, "Body's sin(obliquity)*sin(precession angle)"); output[OUT_YOBL].iNum = 1; output[OUT_YOBL].iModuleBit = EQTIDE + DISTROT; fnWrite[OUT_YOBL] = &WriteYobl; - sprintf(output[OUT_ZOBL].cName, "Zobl"); - sprintf(output[OUT_ZOBL].cDescr, "Body's cos(obliquity)"); + fvFormattedString(&output[OUT_ZOBL].cName, "Zobl"); + fvFormattedString(&output[OUT_ZOBL].cDescr, "Body's cos(obliquity)"); output[OUT_ZOBL].iNum = 1; output[OUT_ZOBL].iModuleBit = EQTIDE + DISTROT; fnWrite[OUT_ZOBL] = &WriteZobl; @@ -1846,15 +1846,15 @@ void UnitsSI(UNITS *units) { void WriteLogEntry(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UPDATE *update, fnWriteOutput fnWrite, FILE *fp, int iBody) { double *dTmp; - char cUnit[48]; + char *cUnit=NULL; UNITS units; int i, j, iNumIndices; - cUnit[0] = '\0'; + //cUnit[0] = '\0'; dTmp = malloc(output->iNum * sizeof(double)); UnitsSI(&units); - fnWrite(body, control, output, system, &units, update, iBody, dTmp, cUnit); + fnWrite(body, control, output, system, &units, update, iBody, dTmp, &cUnit); fprintf(fp, "(%s) %s [%s]: ", output->cName, output->cDescr, cUnit); for (j = 0; j < output->iNum; j++) { @@ -1862,6 +1862,7 @@ void WriteLogEntry(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, fprintf(fp, " "); } free(dTmp); + free(cUnit); fprintf(fp, "\n"); } @@ -2007,23 +2008,26 @@ void LogOutputOrder(BODY *body, CONTROL *control, FILES *files, OUTPUT *output, SYSTEM *system, UPDATE *update, fnWriteOutput fnWrite[], FILE *fp, int iBody) { int iCol, iOut, iSubOut, iExtra = 0; - char cCol[MODULEOUTEND][OUTLEN+2]; // +2 for brackets + char **cCol; double *dTmp; - char cUnit[OUTLEN], cTmp[OUTLEN+2]; + char *cUnit=NULL, *cTmp=NULL; + cCol=malloc(MODULEOUTEND*sizeof(char*)); for (iCol = 0; iCol < files->Outfile[iBody].iNumCols; iCol++) { for (iOut = 0; iOut < MODULEOUTEND; iOut++) { - if (memcmp(files->Outfile[iBody].caCol[iCol], output[iOut].cName, - strlen(output[iOut].cName)) == 0) { + // if (memcmp(files->Outfile[iBody].caCol[iCol], output[iOut].cName, + // strlen(output[iOut].cName)) == 0) { + if (strcmp(files->Outfile[iBody].caCol[iCol], output[iOut].cName) == 0) { /* Match! */ dTmp = malloc(output[iOut].iNum * sizeof(double)); fnWrite[iOut](body, control, &output[iOut], system, - &control->Units[iBody], update, iBody, dTmp, cUnit); + &control->Units[iBody], update, iBody, dTmp, &cUnit); for (iSubOut = 0; iSubOut < output[iOut].iNum; iSubOut++) { - strcpy(cCol[iCol + iSubOut + iExtra], + cCol[iCol + iSubOut + iExtra]=NULL; + fvFormattedString(&cCol[iCol + iSubOut + iExtra], files->Outfile[iBody].caCol[iCol]); - sprintf(cTmp, "[%s]", cUnit); - strcat(cCol[iCol + iSubOut + iExtra], cTmp); + fvFormattedString(&cTmp, "[%s]", cUnit); + fvFormattedString(&cCol[iCol + iSubOut + iExtra], cTmp); } iExtra += (output[iOut].iNum - 1); free(dTmp); @@ -2036,29 +2040,33 @@ void LogOutputOrder(BODY *body, CONTROL *control, FILES *files, OUTPUT *output, fprintf(fp, " %s", cCol[iCol]); } fprintf(fp, "\n"); + free(cCol); } void LogGridOutput(BODY *body, CONTROL *control, FILES *files, OUTPUT *output, SYSTEM *system, UPDATE *update, fnWriteOutput fnWrite[], FILE *fp, int iBody) { int iCol, iOut, iSubOut, iExtra = 0; - char cCol[MODULEOUTEND][OUTLEN+2]; // +2 for brackets + char **cCol; // +2 for brackets double *dTmp; - char cUnit[OUTLEN], cTmp[OUTLEN+2]; + char *cUnit=NULL, *cTmp=NULL; + cCol=malloc(MODULEOUTEND*sizeof(char*)); for (iCol = 0; iCol < files->Outfile[iBody].iNumGrid; iCol++) { for (iOut = 0; iOut < MODULEOUTEND; iOut++) { - if (memcmp(files->Outfile[iBody].caGrid[iCol], output[iOut].cName, - strlen(output[iOut].cName)) == 0) { + // if (memcmp(files->Outfile[iBody].caGrid[iCol], output[iOut].cName, + // strlen(output[iOut].cName)) == 0) { + if (strcmp(files->Outfile[iBody].caGrid[iCol], output[iOut].cName) == 0) { /* Match! */ dTmp = malloc(output[iOut].iNum * sizeof(double)); fnWrite[iOut](body, control, &output[iOut], system, - &control->Units[iBody], update, iBody, dTmp, cUnit); + &control->Units[iBody], update, iBody, dTmp, &cUnit); for (iSubOut = 0; iSubOut < output[iOut].iNum; iSubOut++) { - strcpy(cCol[iCol + iSubOut + iExtra], + cCol[iCol + iSubOut + iExtra]=NULL; + fvFormattedString(&cCol[iCol + iSubOut + iExtra], files->Outfile[iBody].caGrid[iCol]); - sprintf(cTmp, "[%s]", cUnit); - strcat(cCol[iCol + iSubOut + iExtra], cTmp); + fvFormattedString(&cTmp, "[%s]", cUnit); + fvFormattedString(&cCol[iCol + iSubOut + iExtra], cTmp); } iExtra += (output[iOut].iNum - 1); free(dTmp); @@ -2072,6 +2080,7 @@ void LogGridOutput(BODY *body, CONTROL *control, FILES *files, OUTPUT *output, fprintf(fp, " %s", cCol[iCol]); } fprintf(fp, "\n"); + free(cCol); } void LogOptions(CONTROL *control, FILES *files, MODULE *module, SYSTEM *system, @@ -2165,7 +2174,7 @@ void LogBody(BODY *body, CONTROL *control, FILES *files, MODULE *module, void WriteLog(BODY *body, CONTROL *control, FILES *files, MODULE *module, OPTIONS *options, OUTPUT *output, SYSTEM *system, UPDATE *update, fnUpdateVariable ***fnUpdate, fnWriteOutput fnWrite[], int iEnd) { - char cTime[OPTLEN]; + char *cTime=NULL; FILE *fp; double dTotTime; @@ -2177,13 +2186,13 @@ void WriteLog(BODY *body, CONTROL *control, FILES *files, MODULE *module, double dDt = fdGetTimeStep(body, control, system, update, fnUpdate); if (iEnd == 0) { - sprintf(cTime, "Input"); + fvFormattedString(&cTime, "Input"); fp = fopen(files->cLog, "w"); } else if (iEnd == 1) { - sprintf(cTime, "Final"); + fvFormattedString(&cTime, "Final"); fp = fopen(files->cLog, "a"); } else if (iEnd == -1) { - sprintf(cTime, "Initial"); + fvFormattedString(&cTime, "Initial"); fp = fopen(files->cLog, "w"); } else { fprintf(stderr, "ERROR: Unknown cTime in output.c:WriteLog.\n"); @@ -2211,7 +2220,7 @@ void WriteOutput(BODY *body, CONTROL *control, FILES *files, OUTPUT *output, int iBody, iCol, iOut, iSubOut, iExtra = 0, iGrid, iLat, jBody, j; double dCol[NUMOPT], *dTmp, dGrid[NUMOPT]; FILE *fp; - char cUnit[OPTLEN], cPoiseGrid[3 * NAMELEN], cLaplaceFunc[3 * NAMELEN]; + char *cUnit, *cPoiseGrid=NULL, *cLaplaceFunc=NULL; /* Write out all data columns for each body. As some data may span more than 1 column, we search the input list sequentially, adding iExtra to the @@ -2229,12 +2238,14 @@ void WriteOutput(BODY *body, CONTROL *control, FILES *files, OUTPUT *output, for (iCol = 0; iCol < files->Outfile[iBody].iNumCols; iCol++) { for (iOut = 0; iOut < MODULEOUTEND; iOut++) { if (output[iOut].bGrid == 0 || output[iOut].bGrid == 2) { - if (memcmp(files->Outfile[iBody].caCol[iCol], output[iOut].cName, - strlen(output[iOut].cName)) == 0) { + // if (memcmp(files->Outfile[iBody].caCol[iCol], output[iOut].cName, + // strlen(output[iOut].cName)) == 0) { + if (strcmp(files->Outfile[iBody].caCol[iCol], output[iOut].cName) == 0) { /* Match! */ dTmp = malloc(output[iOut].iNum * sizeof(double)); + cUnit=NULL; fnWrite[iOut](body, control, &output[iOut], system, - &control->Units[iBody], update, iBody, dTmp, cUnit); + &control->Units[iBody], update, iBody, dTmp, &cUnit); for (iSubOut = 0; iSubOut < output[iOut].iNum; iSubOut++) { dCol[iCol + iSubOut + iExtra] = dTmp[iSubOut]; } @@ -2266,12 +2277,14 @@ void WriteOutput(BODY *body, CONTROL *control, FILES *files, OUTPUT *output, for (iGrid = 0; iGrid < files->Outfile[iBody].iNumGrid; iGrid++) { for (iOut = 0; iOut < MODULEOUTEND; iOut++) { if (output[iOut].bGrid == 1 || output[iOut].bGrid == 2) { - if (memcmp(files->Outfile[iBody].caGrid[iGrid], - output[iOut].cName, strlen(output[iOut].cName)) == 0) { + // if (memcmp(files->Outfile[iBody].caGrid[iGrid], + // output[iOut].cName, strlen(output[iOut].cName)) == 0) { + if (strcmp(files->Outfile[iBody].caGrid[iGrid],output[iOut].cName) == 0) { body[iBody].iWriteLat = iLat; + cUnit=NULL; fnWrite[iOut](body, control, &output[iOut], system, &control->Units[iBody], update, iBody, dTmp, - cUnit); + &cUnit); dGrid[iGrid] = *dTmp; } } @@ -2279,23 +2292,23 @@ void WriteOutput(BODY *body, CONTROL *control, FILES *files, OUTPUT *output, } /* Now write the columns */ - sprintf(cPoiseGrid, "%s.%s.Climate", system->cName, body[iBody].cName); + fvFormattedString(&cPoiseGrid, "%s.%s.Climate", system->cName, body[iBody].cName); if (control->Evolve.dTime == 0 && iLat == 0) { if (body[iBody].iClimateModel == SEA) { WriteDailyInsol(body, control, &output[iOut], system, - &control->Units[iBody], update, iBody, dTmp, cUnit); + &control->Units[iBody], update, iBody, dTmp, &cUnit); WriteSeasonalTemp(body, control, &output[iOut], system, &control->Units[iBody], update, iBody, dTmp, - cUnit); + &cUnit); WriteSeasonalIceBalance(body, control, &output[iOut], system, &control->Units[iBody], update, iBody, dTmp, - cUnit); + &cUnit); WriteSeasonalFluxes(body, control, &output[iOut], system, &control->Units[iBody], update, iBody, dTmp, - cUnit); + &cUnit); WritePlanckB(body, control, &output[iOut], system, - &control->Units[iBody], update, iBody, dTmp, cUnit); + &control->Units[iBody], update, iBody, dTmp, &cUnit); if (body[iBody].dSeasOutputTime != 0) { body[iBody].dSeasNextOutput = body[iBody].dSeasOutputTime; @@ -2310,18 +2323,18 @@ void WriteOutput(BODY *body, CONTROL *control, FILES *files, OUTPUT *output, if (control->Evolve.dTime >= body[iBody].dSeasNextOutput && iLat == 0) { WriteDailyInsol(body, control, &output[iOut], system, - &control->Units[iBody], update, iBody, dTmp, cUnit); + &control->Units[iBody], update, iBody, dTmp, &cUnit); WriteSeasonalTemp(body, control, &output[iOut], system, &control->Units[iBody], update, iBody, dTmp, - cUnit); + &cUnit); WriteSeasonalIceBalance(body, control, &output[iOut], system, &control->Units[iBody], update, iBody, dTmp, - cUnit); + &cUnit); WriteSeasonalFluxes(body, control, &output[iOut], system, &control->Units[iBody], update, iBody, dTmp, - cUnit); + &cUnit); WritePlanckB(body, control, &output[iOut], system, - &control->Units[iBody], update, iBody, dTmp, cUnit); + &control->Units[iBody], update, iBody, dTmp, &cUnit); body[iBody].dSeasNextOutput = control->Evolve.dTime + body[iBody].dSeasOutputTime; @@ -2347,7 +2360,7 @@ void WriteOutput(BODY *body, CONTROL *control, FILES *files, OUTPUT *output, if (control->Evolve.iDistOrbModel == RD4) { /* open body file to write laplace functions and related */ for (jBody = iBody + 1; jBody < control->Evolve.iNumBodies; jBody++) { - sprintf(cLaplaceFunc, "%s.%s.Laplace", body[iBody].cName, + fvFormattedString(&cLaplaceFunc, "%s.%s.Laplace", body[iBody].cName, body[jBody].cName); if (control->Evolve.dTime == 0) { fp = fopen(cLaplaceFunc, "w"); @@ -2392,7 +2405,7 @@ void WriteOutput(BODY *body, CONTROL *control, FILES *files, OUTPUT *output, /* open body file to write laplace functions and related */ for (jBody = iBody + 1; jBody < control->Evolve.iNumBodies; jBody++) { - sprintf(cLaplaceFunc, "%s.%s.Laplace", body[iBody].cName, + fvFormattedString(&cLaplaceFunc, "%s.%s.Laplace", body[iBody].cName, body[jBody].cName); fp = fopen(cLaplaceFunc, "w"); if (body[iBody].dSemi < body[jBody].dSemi) { @@ -2447,27 +2460,30 @@ void WriteOutput(BODY *body, CONTROL *control, FILES *files, OUTPUT *output, } } } + free(cUnit); + free(cPoiseGrid); + free(cLaplaceFunc); } void InitializeOutput(FILES *files, OUTPUT *output, fnWriteOutput fnWrite[]) { int iOut, iBody, iModule; - memset(files->cLog, '\0', NAMELEN); - for (iOut = 0; iOut < MODULEOUTEND; iOut++) { - memset(output[iOut].cName, '\0', OPTLEN); - sprintf(output[iOut].cName, "null"); + output[iOut].cName = NULL; + output[iOut].cDescr = NULL; + output[iOut].cLongDescr = NULL; + output[iOut].cNeg = NULL; + + fvFormattedString(&output[iOut].cName, "null"); output[iOut].bGrid = 0; output[iOut].bNeg = 0; /* Is a negative option allowed */ output[iOut].dNeg = 1; /* Conversion factor for negative options */ output[iOut].iNum = 0; /* Number of parameters associated with option */ output[iOut].bDoNeg = malloc(MAXFILES * sizeof(int)); - memset(output[iOut].cDescr, '\0', OUTDESCR); - sprintf(output[iOut].cDescr, "null"); - memset(output[iOut].cLongDescr, '\0', OUTLONDESCR); - sprintf(output[iOut].cLongDescr, "null"); - memset(output[iOut].cNeg, '\0', OUTDESCR); - sprintf(output[iOut].cNeg, "null"); + output[iOut].iModuleBit = 0; + fvFormattedString(&output[iOut].cDescr, "null"); + fvFormattedString(&output[iOut].cLongDescr, "null"); + fvFormattedString(&output[iOut].cNeg, "null"); for (iBody = 0; iBody < MAXFILES; iBody++) { output[iOut].bDoNeg[iBody] = 0; } diff --git a/src/output.h b/src/output.h index dede94e80..369fea3a5 100644 --- a/src/output.h +++ b/src/output.h @@ -110,8 +110,7 @@ /* @cond DOXYGEN_OVERRIDE */ -void WriteBodyPrecA(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, UPDATE *, - int, double *, char[]); + void Bary2OrbElems(BODY *body, int iBody); void WriteLogEntry(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UPDATE *, fnWriteOutput, FILE *, int); @@ -122,7 +121,9 @@ void WriteOutput(BODY *, CONTROL *, FILES *, OUTPUT *, SYSTEM *, UPDATE *, void WriteLog(BODY *, CONTROL *, FILES *, MODULE *, OPTIONS *, OUTPUT *, SYSTEM *, UPDATE *, fnUpdateVariable ***, fnWriteOutput *, int); void InitializeOutput(FILES*,OUTPUT *, fnWriteOutput *); -void WriteTime(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, UPDATE *, int, - double *, char[]); +void WriteTime(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, UPDATE *, int, + double *, char**); +void WriteBodyPrecA(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, UPDATE *, + int, double *, char**); /* @endcond */ diff --git a/src/poise.c b/src/poise.c index d3cfc28f3..612a4b998 100644 --- a/src/poise.c +++ b/src/poise.c @@ -140,14 +140,15 @@ void ReadFileOrbitOblData(BODY *body, CONTROL *control, FILES *files, AddOptionString(files->Infile[iFile].cIn, options->cName, cTmp, &lTmp, control->Io.iVerbose); + body[iFile - 1].sFileOrbitOblData=NULL; if (lTmp >= 0) { /* Cannot exist in primary input file -- Each body has an output file */ NotPrimaryInput(iFile, options->cName, files->Infile[iFile].cIn, lTmp, control->Io.iVerbose); - strcpy(body[iFile - 1].cFileOrbitOblData, cTmp); + fvFormattedString(&body[iFile - 1].sFileOrbitOblData, cTmp); UpdateFoundOption(&files->Infile[iFile], options, lTmp, iFile); } else if (iFile > 0) - strcpy(body[iFile - 1].cFileOrbitOblData, options->cDefault); + fvFormattedString(&body[iFile - 1].sFileOrbitOblData, options->cDefault); } void ReadIceAlbedo(BODY *body, CONTROL *control, FILES *files, OPTIONS *options, @@ -1124,504 +1125,505 @@ void ReadMinIceSheetHeight(BODY *body, CONTROL *control, FILES *files, } void InitializeOptionsPoise(OPTIONS *options, fnReadOption fnRead[]) { - sprintf(options[OPT_LATCELLNUM].cName, "iLatCellNum"); - sprintf(options[OPT_LATCELLNUM].cDescr, "Number of latitude cells used in" + fvFormattedString(&options[OPT_LATCELLNUM].cName, "iLatCellNum"); + fvFormattedString(&options[OPT_LATCELLNUM].cDescr, "Number of latitude cells used in" " climate model"); - sprintf(options[OPT_LATCELLNUM].cDefault, "50"); + fvFormattedString(&options[OPT_LATCELLNUM].cDefault, "50"); options[OPT_LATCELLNUM].dDefault = 50; options[OPT_LATCELLNUM].iType = 1; options[OPT_LATCELLNUM].bMultiFile = 1; fnRead[OPT_LATCELLNUM] = &ReadLatCellNum; - sprintf(options[OPT_READORBITOBLDATA].cName, "bReadOrbitOblData"); - sprintf(options[OPT_READORBITOBLDATA].cDescr, "Read in orbital and obliquity \ + fvFormattedString(&options[OPT_READORBITOBLDATA].cName, "bReadOrbitOblData"); + fvFormattedString(&options[OPT_READORBITOBLDATA].cDescr, "Read in orbital and obliquity \ data and use with poise"); - sprintf(options[OPT_READORBITOBLDATA].cDefault, "0"); + fvFormattedString(&options[OPT_READORBITOBLDATA].cDefault, "0"); options[OPT_READORBITOBLDATA].dDefault = 0; options[OPT_READORBITOBLDATA].iType = 0; options[OPT_READORBITOBLDATA].bMultiFile = 1; fnRead[OPT_READORBITOBLDATA] = &ReadOrbitOblData; - sprintf(options[OPT_FILEORBITOBLDATA].cName, "sFileOrbitOblData"); - sprintf(options[OPT_FILEORBITOBLDATA].cDescr, "Name of file containing orbit\ + fvFormattedString(&options[OPT_FILEORBITOBLDATA].cName, "sFileOrbitOblData"); + fvFormattedString(&options[OPT_FILEORBITOBLDATA].cDescr, "Name of file containing orbit\ and obliquity time series"); - sprintf(options[OPT_FILEORBITOBLDATA].cDefault, "Obl_data.txt"); + fvFormattedString(&options[OPT_FILEORBITOBLDATA].cDefault, "Obl_data.txt"); options[OPT_FILEORBITOBLDATA].iType = 3; fnRead[OPT_FILEORBITOBLDATA] = &ReadFileOrbitOblData; - sprintf(options[OPT_PLANCKA].cName, "dPlanckA"); - sprintf(options[OPT_PLANCKA].cDescr, "Constant 'A' used in OLR calculation"); - sprintf(options[OPT_PLANCKA].cDefault, "203.3"); + fvFormattedString(&options[OPT_PLANCKA].cName, "dPlanckA"); + fvFormattedString(&options[OPT_PLANCKA].cDescr, "Constant 'A' used in OLR calculation"); + fvFormattedString(&options[OPT_PLANCKA].cDefault, "203.3"); + fvFormattedString(&options[OPT_PLANCKA].cDimension, "nd"); options[OPT_PLANCKA].dDefault = 203.3; options[OPT_PLANCKA].iType = 2; options[OPT_PLANCKA].bMultiFile = 1; fnRead[OPT_PLANCKA] = &ReadPlanckA; - sprintf(options[OPT_PLANCKB].cName, "dPlanckB"); - sprintf(options[OPT_PLANCKB].cDescr, "Sensitivity 'B' used in" + fvFormattedString(&options[OPT_PLANCKB].cName, "dPlanckB"); + fvFormattedString(&options[OPT_PLANCKB].cDescr, "Sensitivity 'B' used in" " OLR calculation"); - sprintf(options[OPT_PLANCKB].cDefault, "2.09"); - sprintf(options[OPT_PLANCKB].cDimension, "nd"); + fvFormattedString(&options[OPT_PLANCKB].cDefault, "2.09"); + fvFormattedString(&options[OPT_PLANCKB].cDimension, "nd"); options[OPT_PLANCKB].dDefault = 2.09; options[OPT_PLANCKB].iType = 2; options[OPT_PLANCKB].bMultiFile = 1; fnRead[OPT_PLANCKB] = &ReadPlanckB; - sprintf(options[OPT_ICEALBEDO].cName, "dIceAlbedo"); - sprintf(options[OPT_ICEALBEDO].cDescr, "Albedo of ice"); - sprintf(options[OPT_ICEALBEDO].cDefault, "0.6"); - sprintf(options[OPT_ICEALBEDO].cDimension, "nd"); + fvFormattedString(&options[OPT_ICEALBEDO].cName, "dIceAlbedo"); + fvFormattedString(&options[OPT_ICEALBEDO].cDescr, "Albedo of ice"); + fvFormattedString(&options[OPT_ICEALBEDO].cDefault, "0.6"); + fvFormattedString(&options[OPT_ICEALBEDO].cDimension, "nd"); options[OPT_ICEALBEDO].dDefault = 0.6; options[OPT_ICEALBEDO].iType = 2; options[OPT_ICEALBEDO].bMultiFile = 1; fnRead[OPT_ICEALBEDO] = &ReadIceAlbedo; - sprintf(options[OPT_SURFALBEDO].cName, "dSurfAlbedo"); - sprintf(options[OPT_SURFALBEDO].cDescr, "Albedo of (ice-free) surface"); - sprintf(options[OPT_SURFALBEDO].cDefault, "0.3"); - sprintf(options[OPT_SURFALBEDO].cDimension, "nd"); + fvFormattedString(&options[OPT_SURFALBEDO].cName, "dSurfAlbedo"); + fvFormattedString(&options[OPT_SURFALBEDO].cDescr, "Albedo of (ice-free) surface"); + fvFormattedString(&options[OPT_SURFALBEDO].cDefault, "0.3"); + fvFormattedString(&options[OPT_SURFALBEDO].cDimension, "nd"); options[OPT_SURFALBEDO].dDefault = 0.3; options[OPT_SURFALBEDO].iType = 2; options[OPT_SURFALBEDO].bMultiFile = 1; fnRead[OPT_SURFALBEDO] = &ReadSurfAlbedo; - sprintf(options[OPT_TGLOBALEST].cName, "dTGlobalInit"); - sprintf(options[OPT_TGLOBALEST].cDescr, "Estimate of initial global" + fvFormattedString(&options[OPT_TGLOBALEST].cName, "dTGlobalInit"); + fvFormattedString(&options[OPT_TGLOBALEST].cDescr, "Estimate of initial global" " temperature"); - sprintf(options[OPT_TGLOBALEST].cDefault, "14.85"); - sprintf(options[OPT_TGLOBALEST].cDimension, "temperature"); + fvFormattedString(&options[OPT_TGLOBALEST].cDefault, "14.85"); + fvFormattedString(&options[OPT_TGLOBALEST].cDimension, "temperature"); options[OPT_TGLOBALEST].dDefault = 14.85; options[OPT_TGLOBALEST].iType = 2; options[OPT_TGLOBALEST].bMultiFile = 1; fnRead[OPT_TGLOBALEST] = &ReadTGlobalInit; - sprintf(options[OPT_PCO2].cName, "dpCO2"); - sprintf(options[OPT_PCO2].cDescr, "Partial pressure of CO2 in atmosphere"); - sprintf(options[OPT_PCO2].cDefault, "3.3e-4"); - sprintf(options[OPT_PCO2].cDimension, "nd"); + fvFormattedString(&options[OPT_PCO2].cName, "dpCO2"); + fvFormattedString(&options[OPT_PCO2].cDescr, "Partial pressure of CO2 in atmosphere"); + fvFormattedString(&options[OPT_PCO2].cDefault, "3.3e-4"); + fvFormattedString(&options[OPT_PCO2].cDimension, "nd"); options[OPT_PCO2].dDefault = 3.3e-4; options[OPT_PCO2].iType = 2; options[OPT_PCO2].bMultiFile = 1; fnRead[OPT_PCO2] = &ReadPCO2; - sprintf(options[OPT_CALCAB].cName, "bCalcAB"); - sprintf(options[OPT_CALCAB].cDescr, "Calculate A and B in OLR function, from" + fvFormattedString(&options[OPT_CALCAB].cName, "bCalcAB"); + fvFormattedString(&options[OPT_CALCAB].cDescr, "Calculate A and B in OLR function, from" " (T & pCO2)"); - sprintf(options[OPT_CALCAB].cDefault, "0"); - sprintf(options[OPT_CALCAB].cDimension, "nd"); + fvFormattedString(&options[OPT_CALCAB].cDefault, "0"); + fvFormattedString(&options[OPT_CALCAB].cDimension, "nd"); options[OPT_CALCAB].dDefault = 0; options[OPT_CALCAB].iType = 0; options[OPT_CALCAB].bMultiFile = 1; fnRead[OPT_CALCAB] = &ReadCalcAB; - sprintf(options[OPT_DIFFUSION].cName, "dDiffusion"); - sprintf(options[OPT_DIFFUSION].cDescr, "Heat diffusion coefficient"); - sprintf(options[OPT_DIFFUSION].cDefault, "0.44"); - sprintf(options[OPT_DIFFUSION].cDimension, "nd"); + fvFormattedString(&options[OPT_DIFFUSION].cName, "dDiffusion"); + fvFormattedString(&options[OPT_DIFFUSION].cDescr, "Heat diffusion coefficient"); + fvFormattedString(&options[OPT_DIFFUSION].cDefault, "0.44"); + fvFormattedString(&options[OPT_DIFFUSION].cDimension, "nd"); options[OPT_DIFFUSION].dDefault = 0.44; options[OPT_DIFFUSION].iType = 2; options[OPT_DIFFUSION].bMultiFile = 1; fnRead[OPT_DIFFUSION] = &ReadDiffusion; - sprintf(options[OPT_HADLEY].cName, "bHadley"); - sprintf(options[OPT_HADLEY].cDescr, "Enable Hadley circulation"); - sprintf(options[OPT_HADLEY].cDefault, "0"); + fvFormattedString(&options[OPT_HADLEY].cName, "bHadley"); + fvFormattedString(&options[OPT_HADLEY].cDescr, "Enable Hadley circulation"); + fvFormattedString(&options[OPT_HADLEY].cDefault, "0"); options[OPT_HADLEY].dDefault = 0; options[OPT_HADLEY].iType = 0; options[OPT_HADLEY].bMultiFile = 1; fnRead[OPT_HADLEY] = &ReadHadley; - sprintf(options[OPT_COLDSTART].cName, "bColdStart"); - sprintf(options[OPT_COLDSTART].cDescr, "Start from snowball Earth" + fvFormattedString(&options[OPT_COLDSTART].cName, "bColdStart"); + fvFormattedString(&options[OPT_COLDSTART].cDescr, "Start from snowball Earth" " conditions"); - sprintf(options[OPT_COLDSTART].cDefault, "0"); + fvFormattedString(&options[OPT_COLDSTART].cDefault, "0"); options[OPT_COLDSTART].dDefault = 0; options[OPT_COLDSTART].iType = 0; options[OPT_COLDSTART].bMultiFile = 1; fnRead[OPT_COLDSTART] = &ReadColdStart; - sprintf(options[OPT_FIXICELAT].cName, "dFixIceLat"); - sprintf(options[OPT_FIXICELAT].cDescr, + fvFormattedString(&options[OPT_FIXICELAT].cName, "dFixIceLat"); + fvFormattedString(&options[OPT_FIXICELAT].cDescr, "Force ice cap latitude to this value"); - sprintf(options[OPT_FIXICELAT].cDefault, "None"); - sprintf(options[OPT_FIXICELAT].cDimension, "nd"); + fvFormattedString(&options[OPT_FIXICELAT].cDefault, "None"); + fvFormattedString(&options[OPT_FIXICELAT].cDimension, "nd"); options[OPT_FIXICELAT].dDefault = 0; options[OPT_FIXICELAT].iType = 2; options[OPT_FIXICELAT].bMultiFile = 1; fnRead[OPT_FIXICELAT] = &ReadFixIceLat; - sprintf(options[OPT_ALBEDOZA].cName, "bAlbedoZA"); - sprintf(options[OPT_ALBEDOZA].cDescr, "Use albedo based on zenith angle"); - sprintf(options[OPT_ALBEDOZA].cDefault, "0"); + fvFormattedString(&options[OPT_ALBEDOZA].cName, "bAlbedoZA"); + fvFormattedString(&options[OPT_ALBEDOZA].cDescr, "Use albedo based on zenith angle"); + fvFormattedString(&options[OPT_ALBEDOZA].cDefault, "0"); options[OPT_ALBEDOZA].dDefault = 0; options[OPT_ALBEDOZA].iType = 0; options[OPT_ALBEDOZA].bMultiFile = 1; fnRead[OPT_ALBEDOZA] = &ReadAlbedoZA; - sprintf(options[OPT_MEPDIFF].cName, "bMEPDiff"); - sprintf(options[OPT_MEPDIFF].cDescr, "Calculate diffusion from max entropy" + fvFormattedString(&options[OPT_MEPDIFF].cName, "bMEPDiff"); + fvFormattedString(&options[OPT_MEPDIFF].cDescr, "Calculate diffusion from max entropy" " production (D=B/4)?"); - sprintf(options[OPT_MEPDIFF].cDefault, "0"); + fvFormattedString(&options[OPT_MEPDIFF].cDefault, "0"); options[OPT_MEPDIFF].dDefault = 0; options[OPT_MEPDIFF].iType = 0; options[OPT_MEPDIFF].bMultiFile = 1; fnRead[OPT_MEPDIFF] = &ReadMEPDiff; - sprintf(options[OPT_HEATCAPANN].cName, "dHeatCapAnn"); - sprintf(options[OPT_HEATCAPANN].cDescr, "Surface heat capacity in annual" + fvFormattedString(&options[OPT_HEATCAPANN].cName, "dHeatCapAnn"); + fvFormattedString(&options[OPT_HEATCAPANN].cDescr, "Surface heat capacity in annual" " model"); - sprintf(options[OPT_HEATCAPANN].cDefault, "0.2"); - sprintf(options[OPT_HEATCAPANN].cDimension, "energy/temperature"); + fvFormattedString(&options[OPT_HEATCAPANN].cDefault, "0.2"); + fvFormattedString(&options[OPT_HEATCAPANN].cDimension, "energy/temperature"); options[OPT_HEATCAPANN].dDefault = 0.2; options[OPT_HEATCAPANN].iType = 2; options[OPT_HEATCAPANN].bMultiFile = 1; fnRead[OPT_HEATCAPANN] = &ReadHeatCapAnn; - sprintf(options[OPT_ICEDEPRATE].cName, "dIceDepRate"); - sprintf(options[OPT_ICEDEPRATE].cDescr, "Deposition rate of ice/snow to form" + fvFormattedString(&options[OPT_ICEDEPRATE].cName, "dIceDepRate"); + fvFormattedString(&options[OPT_ICEDEPRATE].cDescr, "Deposition rate of ice/snow to form" " ice sheets"); - sprintf(options[OPT_ICEDEPRATE].cDefault, "2.9e-5"); - sprintf(options[OPT_ICEDEPRATE].cDimension, "length/time"); + fvFormattedString(&options[OPT_ICEDEPRATE].cDefault, "2.9e-5"); + fvFormattedString(&options[OPT_ICEDEPRATE].cDimension, "length/time"); options[OPT_ICEDEPRATE].dDefault = 2.9e-5; options[OPT_ICEDEPRATE].iType = 2; options[OPT_ICEDEPRATE].bMultiFile = 1; fnRead[OPT_ICEDEPRATE] = &ReadIceDepRate; - sprintf(options[OPT_ICESHEETS].cName, "bIceSheets"); - sprintf(options[OPT_ICESHEETS].cDescr, "Include ice sheets?"); - sprintf(options[OPT_ICESHEETS].cDefault, "0"); + fvFormattedString(&options[OPT_ICESHEETS].cName, "bIceSheets"); + fvFormattedString(&options[OPT_ICESHEETS].cDescr, "Include ice sheets?"); + fvFormattedString(&options[OPT_ICESHEETS].cDefault, "0"); options[OPT_ICESHEETS].dDefault = 0; options[OPT_ICESHEETS].iType = 0; options[OPT_ICESHEETS].bMultiFile = 1; fnRead[OPT_ICESHEETS] = &ReadIceSheets; - sprintf(options[OPT_INITICELAT].cName, "dInitIceLat"); - sprintf(options[OPT_INITICELAT].cDescr, "Sets initial ice sheet latitude"); - sprintf(options[OPT_INITICELAT].cDefault, "90"); - sprintf(options[OPT_INITICELAT].cDimension, "angle"); + fvFormattedString(&options[OPT_INITICELAT].cName, "dInitIceLat"); + fvFormattedString(&options[OPT_INITICELAT].cDescr, "Sets initial ice sheet latitude"); + fvFormattedString(&options[OPT_INITICELAT].cDefault, "90"); + fvFormattedString(&options[OPT_INITICELAT].cDimension, "angle"); options[OPT_INITICELAT].dDefault = 90.0; options[OPT_INITICELAT].iType = 2; options[OPT_INITICELAT].bMultiFile = 1; fnRead[OPT_INITICELAT] = &ReadInitIceLat; - sprintf(options[OPT_INITICEHEIGHT].cName, "dInitIceHeight"); - sprintf(options[OPT_INITICEHEIGHT].cDescr, "Sets initial ice sheet height"); - sprintf(options[OPT_INITICEHEIGHT].cDefault, "50"); // 50 meters - sprintf(options[OPT_INITICEHEIGHT].cDimension, "length"); + fvFormattedString(&options[OPT_INITICEHEIGHT].cName, "dInitIceHeight"); + fvFormattedString(&options[OPT_INITICEHEIGHT].cDescr, "Sets initial ice sheet height"); + fvFormattedString(&options[OPT_INITICEHEIGHT].cDefault, "50"); // 50 meters + fvFormattedString(&options[OPT_INITICEHEIGHT].cDimension, "length"); options[OPT_INITICEHEIGHT].dDefault = 50.0; options[OPT_INITICEHEIGHT].iType = 2; options[OPT_INITICEHEIGHT].bMultiFile = 1; fnRead[OPT_INITICEHEIGHT] = &ReadInitIceHeight; - sprintf(options[OPT_CLIMATEMODEL].cName, "sClimateModel"); - sprintf(options[OPT_CLIMATEMODEL].cDescr, "Use annual or seasonal model"); - sprintf(options[OPT_CLIMATEMODEL].cDefault, "ann"); + fvFormattedString(&options[OPT_CLIMATEMODEL].cName, "sClimateModel"); + fvFormattedString(&options[OPT_CLIMATEMODEL].cDescr, "Use annual or seasonal model"); + fvFormattedString(&options[OPT_CLIMATEMODEL].cDefault, "ann"); options[OPT_CLIMATEMODEL].dDefault = ANN; options[OPT_CLIMATEMODEL].iType = 3; options[OPT_CLIMATEMODEL].bMultiFile = 1; fnRead[OPT_CLIMATEMODEL] = &ReadClimateModel; - sprintf(options[OPT_OLRMODEL].cName, "iOLRModel"); - sprintf(options[OPT_OLRMODEL].cDescr, "Outgoing longwave rad model"); - sprintf(options[OPT_OLRMODEL].cDefault, "sms09"); + fvFormattedString(&options[OPT_OLRMODEL].cName, "iOLRModel"); + fvFormattedString(&options[OPT_OLRMODEL].cDescr, "Outgoing longwave rad model"); + fvFormattedString(&options[OPT_OLRMODEL].cDefault, "sms09"); options[OPT_OLRMODEL].dDefault = SMS09; options[OPT_OLRMODEL].iType = 1; options[OPT_OLRMODEL].bMultiFile = 1; fnRead[OPT_OLRMODEL] = &ReadOLRModel; - sprintf(options[OPT_SKIPSEASENABLED].cName, "bSkipSeasEnabled"); - sprintf(options[OPT_SKIPSEASENABLED].cDescr, "Run annual before seasonal and" + fvFormattedString(&options[OPT_SKIPSEASENABLED].cName, "bSkipSeasEnabled"); + fvFormattedString(&options[OPT_SKIPSEASENABLED].cDescr, "Run annual before seasonal and" " allow skip seas?"); - sprintf(options[OPT_SKIPSEASENABLED].cDefault, "0"); + fvFormattedString(&options[OPT_SKIPSEASENABLED].cDefault, "0"); options[OPT_SKIPSEASENABLED].dDefault = 0; options[OPT_SKIPSEASENABLED].iType = 0; options[OPT_SKIPSEASENABLED].bMultiFile = 1; fnRead[OPT_SKIPSEASENABLED] = &ReadSkipSeasEnabled; - sprintf(options[OPT_HEATCAPLAND].cName, "dHeatCapLand"); - sprintf(options[OPT_HEATCAPLAND].cDescr, "Land heat capacity in seasonal" + fvFormattedString(&options[OPT_HEATCAPLAND].cName, "dHeatCapLand"); + fvFormattedString(&options[OPT_HEATCAPLAND].cDescr, "Land heat capacity in seasonal" " model"); - sprintf(options[OPT_HEATCAPLAND].cDefault, "1.42e7"); // XXX What units? - sprintf(options[OPT_HEATCAPLAND].cDimension, "energy/temperature"); + fvFormattedString(&options[OPT_HEATCAPLAND].cDefault, "1.42e7"); // XXX What units? + fvFormattedString(&options[OPT_HEATCAPLAND].cDimension, "energy/temperature"); options[OPT_HEATCAPLAND].dDefault = 1.42e7; options[OPT_HEATCAPLAND].iType = 2; options[OPT_HEATCAPLAND].bMultiFile = 1; fnRead[OPT_HEATCAPLAND] = &ReadHeatCapLand; - sprintf(options[OPT_HEATCAPWATER].cName, "dHeatCapWater"); - sprintf(options[OPT_HEATCAPWATER].cDescr, "Water heat capacity per meter in" + fvFormattedString(&options[OPT_HEATCAPWATER].cName, "dHeatCapWater"); + fvFormattedString(&options[OPT_HEATCAPWATER].cDescr, "Water heat capacity per meter in" " seasonal model"); - sprintf(options[OPT_HEATCAPWATER].cDefault, "4.2e6"); // XXX What units - sprintf(options[OPT_HEATCAPWATER].cDimension, "energy/temperature"); + fvFormattedString(&options[OPT_HEATCAPWATER].cDefault, "4.2e6"); // XXX What units + fvFormattedString(&options[OPT_HEATCAPWATER].cDimension, "energy/temperature"); options[OPT_HEATCAPWATER].dDefault = 4.2e6; options[OPT_HEATCAPWATER].iType = 2; options[OPT_HEATCAPWATER].bMultiFile = 1; fnRead[OPT_HEATCAPWATER] = &ReadHeatCapWater; - sprintf(options[OPT_MIXINGDEPTH].cName, "dMixingDepth"); - sprintf(options[OPT_MIXINGDEPTH].cDescr, "Mixing depth of ocean in seasonal" + fvFormattedString(&options[OPT_MIXINGDEPTH].cName, "dMixingDepth"); + fvFormattedString(&options[OPT_MIXINGDEPTH].cDescr, "Mixing depth of ocean in seasonal" " model"); - sprintf(options[OPT_MIXINGDEPTH].cDefault, "70"); // meters - sprintf(options[OPT_MIXINGDEPTH].cDimension, "length"); + fvFormattedString(&options[OPT_MIXINGDEPTH].cDefault, "70"); // meters + fvFormattedString(&options[OPT_MIXINGDEPTH].cDimension, "length"); options[OPT_MIXINGDEPTH].dDefault = 70.; options[OPT_MIXINGDEPTH].iType = 2; options[OPT_MIXINGDEPTH].bMultiFile = 1; fnRead[OPT_MIXINGDEPTH] = &ReadMixingDepth; - sprintf(options[OPT_FRZTSEAICE].cName, "dFrzTSeaIce"); - sprintf(options[OPT_FRZTSEAICE].cDescr, "Temp of sea ice formation in" + fvFormattedString(&options[OPT_FRZTSEAICE].cName, "dFrzTSeaIce"); + fvFormattedString(&options[OPT_FRZTSEAICE].cDescr, "Temp of sea ice formation in" " seasonal model"); - sprintf(options[OPT_FRZTSEAICE].cDefault, "-2 deg C"); - sprintf(options[OPT_FRZTSEAICE].cDimension, "temperature"); + fvFormattedString(&options[OPT_FRZTSEAICE].cDefault, "-2 deg C"); + fvFormattedString(&options[OPT_FRZTSEAICE].cDimension, "temperature"); options[OPT_FRZTSEAICE].dDefault = -2.; options[OPT_FRZTSEAICE].iType = 2; options[OPT_FRZTSEAICE].bMultiFile = 1; fnRead[OPT_FRZTSEAICE] = &ReadFrzTSeaIce; - sprintf(options[OPT_NULANDWATER].cName, "dNuLandWater"); - sprintf(options[OPT_NULANDWATER].cDescr, "Coefficient of land-ocean heat" + fvFormattedString(&options[OPT_NULANDWATER].cName, "dNuLandWater"); + fvFormattedString(&options[OPT_NULANDWATER].cDescr, "Coefficient of land-ocean heat" " flux"); - sprintf(options[OPT_NULANDWATER].cDefault, "0.81"); - sprintf(options[OPT_NULANDWATER].cDimension, "energy/length^2"); + fvFormattedString(&options[OPT_NULANDWATER].cDefault, "0.81"); + fvFormattedString(&options[OPT_NULANDWATER].cDimension, "energy/length^2"); options[OPT_NULANDWATER].dDefault = 0.81; options[OPT_NULANDWATER].iType = 2; options[OPT_NULANDWATER].bMultiFile = 1; fnRead[OPT_NULANDWATER] = &ReadNuLandWater; - sprintf(options[OPT_LANDFRAC].cName, "dLandFrac"); - sprintf(options[OPT_LANDFRAC].cDescr, "Fraction of land on the planetary" + fvFormattedString(&options[OPT_LANDFRAC].cName, "dLandFrac"); + fvFormattedString(&options[OPT_LANDFRAC].cDescr, "Fraction of land on the planetary" " surface"); - sprintf(options[OPT_LANDFRAC].cDefault, "0.34"); - sprintf(options[OPT_LANDFRAC].cDimension, "nd"); + fvFormattedString(&options[OPT_LANDFRAC].cDefault, "0.34"); + fvFormattedString(&options[OPT_LANDFRAC].cDimension, "nd"); options[OPT_LANDFRAC].dDefault = 0.34; options[OPT_LANDFRAC].iType = 2; options[OPT_LANDFRAC].bMultiFile = 1; fnRead[OPT_LANDFRAC] = &ReadLandFrac; - sprintf(options[OPT_NSTEPINYEAR].cName, "iNStepInYear"); - sprintf(options[OPT_NSTEPINYEAR].cDescr, "Number of time-steps/year in" + fvFormattedString(&options[OPT_NSTEPINYEAR].cName, "iNStepInYear"); + fvFormattedString(&options[OPT_NSTEPINYEAR].cDescr, "Number of time-steps/year in" " seasonal model"); - sprintf(options[OPT_NSTEPINYEAR].cDefault, "60"); + fvFormattedString(&options[OPT_NSTEPINYEAR].cDefault, "60"); options[OPT_NSTEPINYEAR].dDefault = 60; options[OPT_NSTEPINYEAR].iType = 1; options[OPT_NSTEPINYEAR].bMultiFile = 1; fnRead[OPT_NSTEPINYEAR] = &ReadNStepInYear; - sprintf(options[OPT_NUMYEARS].cName, "iNumYears"); - sprintf(options[OPT_NUMYEARS].cDescr, "Number of years to run seasonal" + fvFormattedString(&options[OPT_NUMYEARS].cName, "iNumYears"); + fvFormattedString(&options[OPT_NUMYEARS].cDescr, "Number of years to run seasonal" " model"); - sprintf(options[OPT_NUMYEARS].cDefault, "10"); + fvFormattedString(&options[OPT_NUMYEARS].cDefault, "10"); options[OPT_NUMYEARS].dDefault = 10; options[OPT_NUMYEARS].iType = 1; options[OPT_NUMYEARS].bMultiFile = 1; fnRead[OPT_NUMYEARS] = &ReadNumYears; - sprintf(options[OPT_SEAICEMODEL].cName, "bSeaIceModel"); - sprintf(options[OPT_SEAICEMODEL].cDescr, "model sea ice dynamics and heat" + fvFormattedString(&options[OPT_SEAICEMODEL].cName, "bSeaIceModel"); + fvFormattedString(&options[OPT_SEAICEMODEL].cDescr, "model sea ice dynamics and heat" " flow?"); - sprintf(options[OPT_SEAICEMODEL].cDefault, "1"); + fvFormattedString(&options[OPT_SEAICEMODEL].cDefault, "1"); options[OPT_SEAICEMODEL].dDefault = 1; options[OPT_SEAICEMODEL].iType = 0; options[OPT_SEAICEMODEL].bMultiFile = 1; fnRead[OPT_SEAICEMODEL] = &ReadSeaIceModel; - sprintf(options[OPT_ICECONDUCT].cName, "dSeaIceConduct"); - sprintf(options[OPT_ICECONDUCT].cDescr, "Heat conductivity of sea ice"); - sprintf(options[OPT_ICECONDUCT].cDefault, "2"); - sprintf(options[OPT_ICECONDUCT].cDimension, "nd"); + fvFormattedString(&options[OPT_ICECONDUCT].cName, "dSeaIceConduct"); + fvFormattedString(&options[OPT_ICECONDUCT].cDescr, "Heat conductivity of sea ice"); + fvFormattedString(&options[OPT_ICECONDUCT].cDefault, "2"); + fvFormattedString(&options[OPT_ICECONDUCT].cDimension, "nd"); options[OPT_ICECONDUCT].dDefault = 2.; options[OPT_ICECONDUCT].iType = 2; options[OPT_ICECONDUCT].bMultiFile = 1; fnRead[OPT_ICECONDUCT] = &ReadSeaIceConduct; - sprintf(options[OPT_ALBEDOLAND].cName, "dAlbedoLand"); - sprintf(options[OPT_ALBEDOLAND].cDescr, "albedo of dry land"); - sprintf(options[OPT_ALBEDOLAND].cDefault, "0.363"); - sprintf(options[OPT_ALBEDOLAND].cDimension, "nd"); + fvFormattedString(&options[OPT_ALBEDOLAND].cName, "dAlbedoLand"); + fvFormattedString(&options[OPT_ALBEDOLAND].cDescr, "albedo of dry land"); + fvFormattedString(&options[OPT_ALBEDOLAND].cDefault, "0.363"); + fvFormattedString(&options[OPT_ALBEDOLAND].cDimension, "nd"); options[OPT_ALBEDOLAND].dDefault = 0.363; options[OPT_ALBEDOLAND].iType = 2; options[OPT_ALBEDOLAND].bMultiFile = 1; fnRead[OPT_ALBEDOLAND] = &ReadAlbedoLand; - sprintf(options[OPT_ALBEDOWATER].cName, "dAlbedoWater"); - sprintf(options[OPT_ALBEDOWATER].cDescr, "albedo of open water"); - sprintf(options[OPT_ALBEDOWATER].cDefault, "0.263"); - sprintf(options[OPT_ALBEDOWATER].cDimension, "nd"); + fvFormattedString(&options[OPT_ALBEDOWATER].cName, "dAlbedoWater"); + fvFormattedString(&options[OPT_ALBEDOWATER].cDescr, "albedo of open water"); + fvFormattedString(&options[OPT_ALBEDOWATER].cDefault, "0.263"); + fvFormattedString(&options[OPT_ALBEDOWATER].cDimension, "nd"); options[OPT_ALBEDOWATER].dDefault = 0.263; options[OPT_ALBEDOWATER].iType = 2; options[OPT_ALBEDOWATER].bMultiFile = 1; fnRead[OPT_ALBEDOWATER] = &ReadAlbedoWater; - sprintf(options[OPT_ICEDT].cName, "iIceDt"); - sprintf(options[OPT_ICEDT].cDescr, "Minimum ice sheet timestep (unit orbital" + fvFormattedString(&options[OPT_ICEDT].cName, "iIceDt"); + fvFormattedString(&options[OPT_ICEDT].cDescr, "Minimum ice sheet timestep (unit orbital" " period)"); - sprintf(options[OPT_ICEDT].cDefault, "5"); + fvFormattedString(&options[OPT_ICEDT].cDefault, "5"); options[OPT_ICEDT].dDefault = 5; options[OPT_ICEDT].iType = 1; options[OPT_ICEDT].bMultiFile = 1; fnRead[OPT_ICEDT] = &ReadIceDt; - sprintf(options[OPT_RERUNSEAS].cName, "iReRunSeas"); - sprintf(options[OPT_RERUNSEAS].cDescr, "how often to rerun seasonal in ice" + fvFormattedString(&options[OPT_RERUNSEAS].cName, "iReRunSeas"); + fvFormattedString(&options[OPT_RERUNSEAS].cDescr, "how often to rerun seasonal in ice" " sheet model, in number of orbital" " periods"); - sprintf(options[OPT_RERUNSEAS].cDefault, "500"); + fvFormattedString(&options[OPT_RERUNSEAS].cDefault, "500"); options[OPT_RERUNSEAS].dDefault = 5; options[OPT_RERUNSEAS].iType = 1; options[OPT_RERUNSEAS].bMultiFile = 1; fnRead[OPT_RERUNSEAS] = &ReadReRunSeas; - sprintf(options[OPT_GEOGRAPHY].cName, "sGeography"); - sprintf(options[OPT_GEOGRAPHY].cDescr, "Type of land distribution"); - sprintf(options[OPT_GEOGRAPHY].cDefault, "uni3"); + fvFormattedString(&options[OPT_GEOGRAPHY].cName, "sGeography"); + fvFormattedString(&options[OPT_GEOGRAPHY].cDescr, "Type of land distribution"); + fvFormattedString(&options[OPT_GEOGRAPHY].cDefault, "uni3"); options[OPT_GEOGRAPHY].dDefault = UNIFORM3; options[OPT_GEOGRAPHY].iType = 3; options[OPT_GEOGRAPHY].bMultiFile = 1; fnRead[OPT_GEOGRAPHY] = &ReadGeography; - sprintf(options[OPT_SEASOUTPUTTIME].cName, "dSeasOutputTime"); - sprintf(options[OPT_SEASOUTPUTTIME].cDescr, "Output interval for seasonal" + fvFormattedString(&options[OPT_SEASOUTPUTTIME].cName, "dSeasOutputTime"); + fvFormattedString(&options[OPT_SEASOUTPUTTIME].cDescr, "Output interval for seasonal" " parameters"); - sprintf(options[OPT_SEASOUTPUTTIME].cDefault, "0"); - sprintf(options[OPT_SEASOUTPUTTIME].cDimension, "nd"); + fvFormattedString(&options[OPT_SEASOUTPUTTIME].cDefault, "0"); + fvFormattedString(&options[OPT_SEASOUTPUTTIME].cDimension, "nd"); options[OPT_SEASOUTPUTTIME].dDefault = 0; options[OPT_SEASOUTPUTTIME].iType = 2; options[OPT_SEASOUTPUTTIME].bMultiFile = 1; fnRead[OPT_SEASOUTPUTTIME] = &ReadSeasOutputTime; - sprintf(options[OPT_FORCEOBLIQ].cName, "bForceObliq"); - sprintf(options[OPT_FORCEOBLIQ].cDescr, "Force obliquity to evolve" + fvFormattedString(&options[OPT_FORCEOBLIQ].cName, "bForceObliq"); + fvFormattedString(&options[OPT_FORCEOBLIQ].cDescr, "Force obliquity to evolve" " sinusoidally?"); - sprintf(options[OPT_FORCEOBLIQ].cDefault, "0"); + fvFormattedString(&options[OPT_FORCEOBLIQ].cDefault, "0"); options[OPT_FORCEOBLIQ].dDefault = 0; options[OPT_FORCEOBLIQ].iType = 0; options[OPT_FORCEOBLIQ].bMultiFile = 1; fnRead[OPT_FORCEOBLIQ] = &ReadForceObliq; - sprintf(options[OPT_DIFFROT].cName, "bDiffRot"); - sprintf(options[OPT_DIFFROT].cDescr, "Adjust heat diffusion for rotation" + fvFormattedString(&options[OPT_DIFFROT].cName, "bDiffRot"); + fvFormattedString(&options[OPT_DIFFROT].cDescr, "Adjust heat diffusion for rotation" " rate?"); - sprintf(options[OPT_DIFFROT].cDefault, "0"); + fvFormattedString(&options[OPT_DIFFROT].cDefault, "0"); options[OPT_DIFFROT].dDefault = 0; options[OPT_DIFFROT].iType = 0; options[OPT_DIFFROT].bMultiFile = 1; fnRead[OPT_DIFFROT] = &ReadDiffRot; - sprintf(options[OPT_OBLIQAMP].cName, "dObliqAmp"); - sprintf(options[OPT_OBLIQAMP].cDescr, "Amplitude of forced obliquity oscill"); - sprintf(options[OPT_OBLIQAMP].cDefault, "50 deg"); - sprintf(options[OPT_OBLIQAMP].cDimension, "angle"); + fvFormattedString(&options[OPT_OBLIQAMP].cName, "dObliqAmp"); + fvFormattedString(&options[OPT_OBLIQAMP].cDescr, "Amplitude of forced obliquity oscill"); + fvFormattedString(&options[OPT_OBLIQAMP].cDefault, "50 deg"); + fvFormattedString(&options[OPT_OBLIQAMP].cDimension, "angle"); options[OPT_OBLIQAMP].dDefault = 50; options[OPT_OBLIQAMP].iType = 2; options[OPT_OBLIQAMP].bMultiFile = 1; fnRead[OPT_OBLIQAMP] = &ReadObliqAmp; - sprintf(options[OPT_OBLIQPER].cName, "dObliqPer"); - sprintf(options[OPT_OBLIQPER].cDescr, "Period of forced obliquity oscill"); - sprintf(options[OPT_OBLIQPER].cDefault, "50000"); // XXX What units? - sprintf(options[OPT_OBLIQPER].cDimension, "time"); + fvFormattedString(&options[OPT_OBLIQPER].cName, "dObliqPer"); + fvFormattedString(&options[OPT_OBLIQPER].cDescr, "Period of forced obliquity oscill"); + fvFormattedString(&options[OPT_OBLIQPER].cDefault, "50000"); // XXX What units? + fvFormattedString(&options[OPT_OBLIQPER].cDimension, "time"); options[OPT_OBLIQPER].dDefault = 50000; options[OPT_OBLIQPER].iType = 2; options[OPT_OBLIQPER].bMultiFile = 1; fnRead[OPT_OBLIQPER] = &ReadObliqPer; - sprintf(options[OPT_FORCEECC].cName, "bForceEcc"); - sprintf(options[OPT_FORCEECC].cDescr, "Force Eccentricity to evolve" + fvFormattedString(&options[OPT_FORCEECC].cName, "bForceEcc"); + fvFormattedString(&options[OPT_FORCEECC].cDescr, "Force Eccentricity to evolve" " sinusoidally?"); - sprintf(options[OPT_FORCEECC].cDefault, "0"); + fvFormattedString(&options[OPT_FORCEECC].cDefault, "0"); options[OPT_FORCEECC].dDefault = 0; options[OPT_FORCEECC].iType = 0; options[OPT_FORCEECC].bMultiFile = 1; fnRead[OPT_FORCEECC] = &ReadForceEcc; - sprintf(options[OPT_ECCAMP].cName, "dEccAmp"); - sprintf(options[OPT_ECCAMP].cDescr, "Amplitude of forced eccentricity" + fvFormattedString(&options[OPT_ECCAMP].cName, "dEccAmp"); + fvFormattedString(&options[OPT_ECCAMP].cDescr, "Amplitude of forced eccentricity" " oscill"); - sprintf(options[OPT_ECCAMP].cDefault, "0.1"); - sprintf(options[OPT_ECCAMP].cDimension, "nd"); + fvFormattedString(&options[OPT_ECCAMP].cDefault, "0.1"); + fvFormattedString(&options[OPT_ECCAMP].cDimension, "nd"); options[OPT_ECCAMP].dDefault = 0.1; options[OPT_ECCAMP].iType = 2; options[OPT_ECCAMP].bMultiFile = 1; fnRead[OPT_ECCAMP] = &ReadEccAmp; - sprintf(options[OPT_ECCPER].cName, "dEccPer"); - sprintf(options[OPT_ECCPER].cDescr, "Period of forced eccentricity oscill"); - sprintf(options[OPT_ECCPER].cDefault, "50000"); // !!! What units? - sprintf(options[OPT_ECCPER].cDimension, "time"); + fvFormattedString(&options[OPT_ECCPER].cName, "dEccPer"); + fvFormattedString(&options[OPT_ECCPER].cDescr, "Period of forced eccentricity oscill"); + fvFormattedString(&options[OPT_ECCPER].cDefault, "50000"); // !!! What units? + fvFormattedString(&options[OPT_ECCPER].cDimension, "time"); options[OPT_ECCPER].dDefault = 50000; options[OPT_ECCPER].iType = 2; options[OPT_ECCPER].bMultiFile = 1; fnRead[OPT_ECCPER] = &ReadEccPer; - sprintf(options[OPT_ACCUMODE].cName, "bAccuracyMode"); - sprintf(options[OPT_ACCUMODE].cDescr, + fvFormattedString(&options[OPT_ACCUMODE].cName, "bAccuracyMode"); + fvFormattedString(&options[OPT_ACCUMODE].cDescr, "Re-invert matrix every EBM time step?"); - sprintf(options[OPT_ACCUMODE].cDefault, "0"); + fvFormattedString(&options[OPT_ACCUMODE].cDefault, "0"); options[OPT_ACCUMODE].dDefault = 0; options[OPT_ACCUMODE].iType = 0; options[OPT_ACCUMODE].bMultiFile = 1; fnRead[OPT_ACCUMODE] = &ReadAccuracyMode; - sprintf(options[OPT_ELEVFB].cName, "bElevFB"); - sprintf(options[OPT_ELEVFB].cDescr, "Use elevation feedback for ice sheet" + fvFormattedString(&options[OPT_ELEVFB].cName, "bElevFB"); + fvFormattedString(&options[OPT_ELEVFB].cDescr, "Use elevation feedback for ice sheet" " ablation?"); - sprintf(options[OPT_ELEVFB].cDefault, "0"); + fvFormattedString(&options[OPT_ELEVFB].cDefault, "0"); options[OPT_ELEVFB].dDefault = 0; options[OPT_ELEVFB].iType = 0; options[OPT_ELEVFB].bMultiFile = 1; fnRead[OPT_ELEVFB] = &ReadElevFB; - sprintf(options[OPT_LAPSER].cName, "dLapseR"); - sprintf(options[OPT_LAPSER].cDescr, "Dry adiabatic lapse rate (for elev" + fvFormattedString(&options[OPT_LAPSER].cName, "dLapseR"); + fvFormattedString(&options[OPT_LAPSER].cDescr, "Dry adiabatic lapse rate (for elev" " feedback)"); - sprintf(options[OPT_LAPSER].cDefault, "9.8e-3 C/m"); - sprintf(options[OPT_LAPSER].cDimension, "temperature/length"); + fvFormattedString(&options[OPT_LAPSER].cDefault, "9.8e-3 C/m"); + fvFormattedString(&options[OPT_LAPSER].cDimension, "temperature/length"); options[OPT_LAPSER].dDefault = 9.8e-3; options[OPT_LAPSER].iType = 2; options[OPT_LAPSER].bMultiFile = 1; fnRead[OPT_LAPSER] = &ReadLapseR; - sprintf(options[OPT_REFHEIGHT].cName, "dRefHeight"); - sprintf(options[OPT_REFHEIGHT].cDescr, "Reference height of atmos temp (for" + fvFormattedString(&options[OPT_REFHEIGHT].cName, "dRefHeight"); + fvFormattedString(&options[OPT_REFHEIGHT].cDescr, "Reference height of atmos temp (for" " elev feedback)"); - sprintf(options[OPT_REFHEIGHT].cDefault, "1000 m"); - sprintf(options[OPT_REFHEIGHT].cDimension, "length"); + fvFormattedString(&options[OPT_REFHEIGHT].cDefault, "1000 m"); + fvFormattedString(&options[OPT_REFHEIGHT].cDimension, "length"); options[OPT_REFHEIGHT].dDefault = 1000.0; options[OPT_REFHEIGHT].iType = 2; options[OPT_REFHEIGHT].bMultiFile = 1; fnRead[OPT_REFHEIGHT] = &ReadRefHeight; - sprintf(options[OPT_ABLATEFF].cName, "dAblateFF"); - sprintf(options[OPT_ABLATEFF].cDescr, "Ice ablation fudge factor"); - sprintf(options[OPT_ABLATEFF].cDefault, "2.3"); - sprintf(options[OPT_ABLATEFF].cDimension, "nd"); + fvFormattedString(&options[OPT_ABLATEFF].cName, "dAblateFF"); + fvFormattedString(&options[OPT_ABLATEFF].cDescr, "Ice ablation fudge factor"); + fvFormattedString(&options[OPT_ABLATEFF].cDefault, "2.3"); + fvFormattedString(&options[OPT_ABLATEFF].cDimension, "nd"); options[OPT_ABLATEFF].dDefault = 2.3; options[OPT_ABLATEFF].iType = 2; options[OPT_ABLATEFF].bMultiFile = 1; fnRead[OPT_ABLATEFF] = &ReadAblateFF; - sprintf(options[OPT_SPINUPTOL].cName, "dSpinUpTol"); - sprintf(options[OPT_SPINUPTOL].cDescr, "Tolerance for spin up phase"); - sprintf(options[OPT_SPINUPTOL].cDefault, "0.1 deg C"); - sprintf(options[OPT_SPINUPTOL].cDimension, "temperature"); + fvFormattedString(&options[OPT_SPINUPTOL].cName, "dSpinUpTol"); + fvFormattedString(&options[OPT_SPINUPTOL].cDescr, "Tolerance for spin up phase"); + fvFormattedString(&options[OPT_SPINUPTOL].cDefault, "0.1 deg C"); + fvFormattedString(&options[OPT_SPINUPTOL].cDimension, "temperature"); options[OPT_SPINUPTOL].dDefault = 0.1; options[OPT_SPINUPTOL].iType = 2; options[OPT_SPINUPTOL].bMultiFile = 1; fnRead[OPT_SPINUPTOL] = &ReadSpinUpTol; - sprintf(options[OPT_MINICEHEIGHT].cName, "dMinIceSheetHeight"); - sprintf(options[OPT_MINICEHEIGHT].cDescr, "Minimum ice sheet height for a" + fvFormattedString(&options[OPT_MINICEHEIGHT].cName, "dMinIceSheetHeight"); + fvFormattedString(&options[OPT_MINICEHEIGHT].cDescr, "Minimum ice sheet height for a" " latitude to be considered" " ice-covered"); - sprintf(options[OPT_MINICEHEIGHT].cDefault, "0.001"); // What units? XXX - sprintf(options[OPT_MINICEHEIGHT].cDimension, "length"); + fvFormattedString(&options[OPT_MINICEHEIGHT].cDefault, "0.001"); // What units? XXX + fvFormattedString(&options[OPT_MINICEHEIGHT].cDimension, "length"); options[OPT_MINICEHEIGHT].dDefault = 0.001; options[OPT_MINICEHEIGHT].iType = 2; options[OPT_MINICEHEIGHT].bMultiFile = 1; options[OPT_MINICEHEIGHT].dNeg = 1; // Convert to SI - sprintf(options[OPT_MINICEHEIGHT].cNeg, "meters"); + fvFormattedString(&options[OPT_MINICEHEIGHT].cNeg, "meters"); fnRead[OPT_MINICEHEIGHT] = &ReadMinIceSheetHeight; - sprintf(options[OPT_MINICEHEIGHT].cLongDescr, + fvFormattedString(&options[OPT_MINICEHEIGHT].cLongDescr, "The minimum thickness of permanent ice in a latitude bin for it to " "be\n" "labeled ice-covered. In some cases, such as rapid thawing, a " @@ -1796,9 +1798,9 @@ void VerifyOrbitOblData(BODY *body, CONTROL *control, OPTIONS *options, options[OPT_READORBITOBLDATA].cName, body[iBody].cName); exit(EXIT_INPUT); } else { - fileorb = fopen(body[iBody].cFileOrbitOblData, "r"); + fileorb = fopen(body[iBody].sFileOrbitOblData, "r"); if (fileorb == NULL) { - printf("ERROR: File %s not found.\n", body[iBody].cFileOrbitOblData); + printf("ERROR: File %s not found.\n", body[iBody].sFileOrbitOblData); exit(EXIT_INPUT); } iNLines = 0; @@ -2683,12 +2685,12 @@ void VerifyHaltPoise(BODY *body, CONTROL *control, OPTIONS *options, int iBody, void WriteTGlobal(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, double *dTmp, - char cUnit[]) { + char **cUnit) { /* Get TGlobal */ *dTmp = body[iBody].dTGlobal; if (output->bDoNeg[iBody]) { /* Units already in Celsius (POISE uses Celsius) */ - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { *dTmp = fdUnitsTemp(*dTmp, U_CELSIUS, U_KELVIN); fsUnitsTime(0, cUnit); @@ -2697,35 +2699,35 @@ void WriteTGlobal(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, void WriteAlbedoGlobal(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, - double *dTmp, char cUnit[]) { + double *dTmp, char **cUnit) { /* Get AlbedoGlobal */ *dTmp = body[iBody].dAlbedoGlobal; - strcpy(cUnit, ""); + fvFormattedString(cUnit, ""); } void WriteSnowball(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, double *dTmp, - char cUnit[]) { + char **cUnit) { /* Get snowball status */ *dTmp = (double)body[iBody].bSnowball; - strcpy(cUnit, ""); + fvFormattedString(cUnit, ""); } void WriteIceCapNorthLand(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, - int iBody, double *dTmp, char cUnit[]) { + int iBody, double *dTmp, char **cUnit) { int iLatIceEdge, bCap; double dLat; fvNorthIceCapLand(body, iBody, &dLat, &iLatIceEdge, &bCap); *dTmp = (double)bCap; - strcpy(cUnit, ""); + fvFormattedString(cUnit, ""); } void WriteIceCapNorthLatLand(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, - int iBody, double *dTmp, char cUnit[]) { + int iBody, double *dTmp, char **cUnit) { int iLatIceEdge, bCap; double dLat; @@ -2734,7 +2736,7 @@ void WriteIceCapNorthLatLand(BODY *body, CONTROL *control, OUTPUT *output, *dTmp = dLat; if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { *dTmp /= fdUnitsAngle(units->iAngle); fsUnitsAngle(units->iAngle, cUnit); @@ -2743,18 +2745,18 @@ void WriteIceCapNorthLatLand(BODY *body, CONTROL *control, OUTPUT *output, void WriteIceCapNorthSea(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, - int iBody, double *dTmp, char cUnit[]) { + int iBody, double *dTmp, char **cUnit) { int iLatIceEdge, bCap; double dLat; fvNorthIceCapSea(body, iBody, &dLat, &iLatIceEdge, &bCap); *dTmp = (double)bCap; - strcpy(cUnit, ""); + fvFormattedString(cUnit, ""); } void WriteIceCapNorthLatSea(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, - int iBody, double *dTmp, char cUnit[]) { + int iBody, double *dTmp, char **cUnit) { int iLatIceEdge, bCap; double dLat; @@ -2763,7 +2765,7 @@ void WriteIceCapNorthLatSea(BODY *body, CONTROL *control, OUTPUT *output, *dTmp = dLat; if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { *dTmp /= fdUnitsAngle(units->iAngle); fsUnitsAngle(units->iAngle, cUnit); @@ -2772,18 +2774,18 @@ void WriteIceCapNorthLatSea(BODY *body, CONTROL *control, OUTPUT *output, void WriteIceCapSouthLand(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, - int iBody, double *dTmp, char cUnit[]) { + int iBody, double *dTmp, char **cUnit) { int iLatIceEdge, bCap; double dLat; fvSouthIceCapLand(body, iBody, &dLat, &iLatIceEdge, &bCap); *dTmp = (double)bCap; - strcpy(cUnit, ""); + fvFormattedString(cUnit, ""); } void WriteIceCapSouthLatLand(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, - int iBody, double *dTmp, char cUnit[]) { + int iBody, double *dTmp, char **cUnit) { int iLatIceEdge, bCap; double dLat; @@ -2792,7 +2794,7 @@ void WriteIceCapSouthLatLand(BODY *body, CONTROL *control, OUTPUT *output, *dTmp = dLat; if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { *dTmp /= fdUnitsAngle(units->iAngle); fsUnitsAngle(units->iAngle, cUnit); @@ -2801,18 +2803,18 @@ void WriteIceCapSouthLatLand(BODY *body, CONTROL *control, OUTPUT *output, void WriteIceCapSouthSea(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, - int iBody, double *dTmp, char cUnit[]) { + int iBody, double *dTmp, char **cUnit) { int iLatIceEdge, bCap; double dLat; fvSouthIceCapSea(body, iBody, &dLat, &iLatIceEdge, &bCap); *dTmp = (double)bCap; - strcpy(cUnit, ""); + fvFormattedString(cUnit, ""); } void WriteIceCapSouthLatSea(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, - int iBody, double *dTmp, char cUnit[]) { + int iBody, double *dTmp, char **cUnit) { int iLatIceEdge, bCap; double dLat; @@ -2822,7 +2824,7 @@ void WriteIceCapSouthLatSea(BODY *body, CONTROL *control, OUTPUT *output, *dTmp = dLat; if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { *dTmp /= fdUnitsAngle(units->iAngle); fsUnitsAngle(units->iAngle, cUnit); @@ -2831,7 +2833,7 @@ void WriteIceCapSouthLatSea(BODY *body, CONTROL *control, OUTPUT *output, void WriteIceBeltLand(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, - double *dTmp, char cUnit[]) { + double *dTmp, char **cUnit) { int iLatNorth, iLatSouth, bBelt; double dLatNorth, dLatSouth; @@ -2839,12 +2841,12 @@ void WriteIceBeltLand(BODY *body, CONTROL *control, OUTPUT *output, &bBelt); *dTmp = (double)bBelt; - strcpy(cUnit, ""); + fvFormattedString(cUnit, ""); } void WriteIceBeltNorthLatLand(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, - int iBody, double *dTmp, char cUnit[]) { + int iBody, double *dTmp, char **cUnit) { int iLatNorth, iLatSouth, bBelt; double dLatNorth, dLatSouth; @@ -2854,7 +2856,7 @@ void WriteIceBeltNorthLatLand(BODY *body, CONTROL *control, OUTPUT *output, *dTmp = dLatNorth; if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { *dTmp /= fdUnitsAngle(units->iAngle); fsUnitsAngle(units->iAngle, cUnit); @@ -2863,7 +2865,7 @@ void WriteIceBeltNorthLatLand(BODY *body, CONTROL *control, OUTPUT *output, void WriteIceBeltSouthLatLand(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, - int iBody, double *dTmp, char cUnit[]) { + int iBody, double *dTmp, char **cUnit) { int iLatNorth, iLatSouth, bBelt; double dLatSouth, dLatNorth; @@ -2873,7 +2875,7 @@ void WriteIceBeltSouthLatLand(BODY *body, CONTROL *control, OUTPUT *output, *dTmp = dLatSouth; if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { *dTmp /= fdUnitsAngle(units->iAngle); fsUnitsAngle(units->iAngle, cUnit); @@ -2882,7 +2884,7 @@ void WriteIceBeltSouthLatLand(BODY *body, CONTROL *control, OUTPUT *output, void WriteIceBeltSea(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, - double *dTmp, char cUnit[]) { + double *dTmp, char **cUnit) { int iLatNorth, iLatSouth, bBelt; double dLatNorth, dLatSouth; @@ -2890,12 +2892,12 @@ void WriteIceBeltSea(BODY *body, CONTROL *control, OUTPUT *output, &bBelt); *dTmp = (double)bBelt; - strcpy(cUnit, ""); + fvFormattedString(cUnit, ""); } void WriteIceBeltNorthLatSea(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, - int iBody, double *dTmp, char cUnit[]) { + int iBody, double *dTmp, char **cUnit) { int iLatNorth, iLatSouth, bBelt; double dLatNorth, dLatSouth; @@ -2905,7 +2907,7 @@ void WriteIceBeltNorthLatSea(BODY *body, CONTROL *control, OUTPUT *output, *dTmp = dLatNorth; if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { *dTmp /= fdUnitsAngle(units->iAngle); fsUnitsAngle(units->iAngle, cUnit); @@ -2914,7 +2916,7 @@ void WriteIceBeltNorthLatSea(BODY *body, CONTROL *control, OUTPUT *output, void WriteIceBeltSouthLatSea(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, - int iBody, double *dTmp, char cUnit[]) { + int iBody, double *dTmp, char **cUnit) { int iLatNorth, iLatSouth, bBelt; double dLatNorth, dLatSouth; @@ -2924,7 +2926,7 @@ void WriteIceBeltSouthLatSea(BODY *body, CONTROL *control, OUTPUT *output, *dTmp = dLatSouth; if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { *dTmp /= fdUnitsAngle(units->iAngle); fsUnitsAngle(units->iAngle, cUnit); @@ -2933,39 +2935,39 @@ void WriteIceBeltSouthLatSea(BODY *body, CONTROL *control, OUTPUT *output, void WriteSnowballLand(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, - double *dTmp, char cUnit[]) { + double *dTmp, char **cUnit) { *dTmp = (double)fbSnowballLand(body, iBody); - strcpy(cUnit, ""); + fvFormattedString(cUnit, ""); } void WriteSnowballSea(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, - double *dTmp, char cUnit[]) { + double *dTmp, char **cUnit) { *dTmp = (double)fbSnowballSea(body, iBody); - strcpy(cUnit, ""); + fvFormattedString(cUnit, ""); } void WriteIceFree(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, double *dTmp, - char cUnit[]) { + char **cUnit) { *dTmp = (double)fbIceFree(body, iBody); - strcpy(cUnit, ""); + fvFormattedString(cUnit, ""); } void WriteSkipSeas(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, double *dTmp, - char cUnit[]) { + char **cUnit) { /* Get AlbedoGlobal */ *dTmp = body[iBody].bSkipSeas; - strcpy(cUnit, ""); + fvFormattedString(cUnit, ""); } void WriteTempLat(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, double *dTmp, - char cUnit[]) { + char **cUnit) { if (body[iBody].iClimateModel == ANN || body[iBody].bSkipSeas == 1) { @@ -2978,7 +2980,7 @@ void WriteTempLat(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, if (output->bDoNeg[iBody]) { /* Units already in Celsius (POISE uses Celsius) */ - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { @@ -2989,7 +2991,7 @@ void WriteTempLat(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, void WriteTempMinLat(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, - double *dTmp, char cUnit[]) { + double *dTmp, char **cUnit) { if (body[iBody].iClimateModel == ANN || body[iBody].bSkipSeas == 1) { @@ -3003,7 +3005,7 @@ void WriteTempMinLat(BODY *body, CONTROL *control, OUTPUT *output, if (output->bDoNeg[iBody]) { /* Units already in Celsius (POISE uses Celsius) */ - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { @@ -3014,7 +3016,7 @@ void WriteTempMinLat(BODY *body, CONTROL *control, OUTPUT *output, void WriteTempMaxLat(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, - double *dTmp, char cUnit[]) { + double *dTmp, char **cUnit) { if (body[iBody].iClimateModel == ANN || body[iBody].bSkipSeas == 1) { @@ -3027,7 +3029,7 @@ void WriteTempMaxLat(BODY *body, CONTROL *control, OUTPUT *output, if (output->bDoNeg[iBody]) { /* Units already in Celsius (POISE uses Celsius) */ - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { @@ -3038,7 +3040,7 @@ void WriteTempMaxLat(BODY *body, CONTROL *control, OUTPUT *output, void WriteTempMaxLand(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, - double *dTmp, char cUnit[]) { + double *dTmp, char **cUnit) { if (body[iBody].iClimateModel == ANN || body[iBody].bSkipSeas == 1) { @@ -3051,7 +3053,7 @@ void WriteTempMaxLand(BODY *body, CONTROL *control, OUTPUT *output, if (output->bDoNeg[iBody]) { /* Units already in Celsius (POISE uses Celsius) */ - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { @@ -3062,7 +3064,7 @@ void WriteTempMaxLand(BODY *body, CONTROL *control, OUTPUT *output, void WriteTempMaxWater(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, - double *dTmp, char cUnit[]) { + double *dTmp, char **cUnit) { if (body[iBody].iClimateModel == ANN || body[iBody].bSkipSeas == 1) { @@ -3075,7 +3077,7 @@ void WriteTempMaxWater(BODY *body, CONTROL *control, OUTPUT *output, if (output->bDoNeg[iBody]) { /* Units already in Celsius (POISE uses Celsius) */ - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { *dTmp = fdUnitsTemp(*dTmp, U_CELSIUS, U_KELVIN); fsUnitsTime(0, cUnit); @@ -3084,7 +3086,7 @@ void WriteTempMaxWater(BODY *body, CONTROL *control, OUTPUT *output, void WriteTempLandLat(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, - double *dTmp, char cUnit[]) { + double *dTmp, char **cUnit) { if (body[iBody].iClimateModel == ANN || body[iBody].bSkipSeas == 1) { @@ -3097,7 +3099,7 @@ void WriteTempLandLat(BODY *body, CONTROL *control, OUTPUT *output, if (output->bDoNeg[iBody]) { /* Units already in Celsius (POISE uses Celsius) */ - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { *dTmp = fdUnitsTemp(*dTmp, U_CELSIUS, U_KELVIN); fsUnitsTime(0, cUnit); @@ -3106,7 +3108,7 @@ void WriteTempLandLat(BODY *body, CONTROL *control, OUTPUT *output, void WriteTempWaterLat(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, - double *dTmp, char cUnit[]) { + double *dTmp, char **cUnit) { if (body[iBody].iClimateModel == ANN || body[iBody].bSkipSeas == 1) { @@ -3119,7 +3121,7 @@ void WriteTempWaterLat(BODY *body, CONTROL *control, OUTPUT *output, if (output->bDoNeg[iBody]) { /* Units already in Celsius (POISE uses Celsius) */ - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { *dTmp = fdUnitsTemp(*dTmp, U_CELSIUS, U_KELVIN); fsUnitsTime(0, cUnit); @@ -3128,14 +3130,14 @@ void WriteTempWaterLat(BODY *body, CONTROL *control, OUTPUT *output, void WriteLatitude(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, double *dTmp, - char cUnit[]) { + char **cUnit) { *dTmp = body[iBody].daLats[body[iBody].iWriteLat]; if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { @@ -3146,7 +3148,7 @@ void WriteLatitude(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, void WriteAlbedoLat(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, - double *dTmp, char cUnit[]) { + double *dTmp, char **cUnit) { if (body[iBody].iClimateModel == ANN || body[iBody].bSkipSeas == 1) { @@ -3157,12 +3159,12 @@ void WriteAlbedoLat(BODY *body, CONTROL *control, OUTPUT *output, *dTmp = body[iBody].daAlbedoAvg[body[iBody].iWriteLat]; } - strcpy(cUnit, ""); + fvFormattedString(cUnit, ""); } void WriteAlbedoLandLat(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, - double *dTmp, char cUnit[]) { + double *dTmp, char **cUnit) { if (body[iBody].iClimateModel == ANN || body[iBody].bSkipSeas == 1) { @@ -3172,12 +3174,12 @@ void WriteAlbedoLandLat(BODY *body, CONTROL *control, OUTPUT *output, *dTmp = body[iBody].daAlbedoAvgL[body[iBody].iWriteLat]; } - strcpy(cUnit, ""); + fvFormattedString(cUnit, ""); } void WriteAlbedoWaterLat(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, - int iBody, double *dTmp, char cUnit[]) { + int iBody, double *dTmp, char **cUnit) { if (body[iBody].iClimateModel == ANN || body[iBody].bSkipSeas == 1) { @@ -3187,18 +3189,18 @@ void WriteAlbedoWaterLat(BODY *body, CONTROL *control, OUTPUT *output, *dTmp = body[iBody].daAlbedoAvgW[body[iBody].iWriteLat]; } - strcpy(cUnit, ""); + fvFormattedString(cUnit, ""); } void WriteFluxInGlobal(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, - double *dTmp, char cUnit[]) { + double *dTmp, char **cUnit) { *dTmp = body[iBody].dFluxInGlobal; if (output->bDoNeg[iBody]) { // Negative option is SI - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { @@ -3209,14 +3211,14 @@ void WriteFluxInGlobal(BODY *body, CONTROL *control, OUTPUT *output, void WriteFluxOutGlobal(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, - double *dTmp, char cUnit[]) { + double *dTmp, char **cUnit) { *dTmp = body[iBody].dFluxOutGlobal; if (output->bDoNeg[iBody]) { // Negative option is SI - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { @@ -3227,14 +3229,14 @@ void WriteFluxOutGlobal(BODY *body, CONTROL *control, OUTPUT *output, void WriteTotIceMass(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, - double *dTmp, char cUnit[]) { + double *dTmp, char **cUnit) { *dTmp = body[iBody].dIceMassTot; if (output->bDoNeg[iBody]) { // Negative option is SI - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { @@ -3245,13 +3247,13 @@ void WriteTotIceMass(BODY *body, CONTROL *control, OUTPUT *output, void WriteIceFlowTot(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, - double *dTmp, char cUnit[]) { + double *dTmp, char **cUnit) { *dTmp = body[iBody].dIceFlowTot; if (output->bDoNeg[iBody]) { // Negative option is SI - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { *dTmp /= fdUnitsMass(units->iMass); fsUnitsMass(units->iMass, cUnit); @@ -3260,14 +3262,14 @@ void WriteIceFlowTot(BODY *body, CONTROL *control, OUTPUT *output, void WriteAreaIceCov(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, - double *dTmp, char cUnit[]) { + double *dTmp, char **cUnit) { fvAreaIceCovered(body, iBody); *dTmp = body[iBody].dAreaIceCov; // if (output->bDoNeg[iBody]) { // // Negative option is SI - // strcpy(cUnit,output->cNeg); + // fvFormattedString(cUnit,output->cNeg); // } else { // *dTmp /= fdUnitsMass(units->iMass); // fsUnitsMass(units->iMass,cUnit); @@ -3276,14 +3278,14 @@ void WriteAreaIceCov(BODY *body, CONTROL *control, OUTPUT *output, void WriteIceBalanceTot(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, - double *dTmp, char cUnit[]) { + double *dTmp, char **cUnit) { *dTmp = body[iBody].dIceBalanceTot; if (output->bDoNeg[iBody]) { // Negative option is SI - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { @@ -3294,13 +3296,13 @@ void WriteIceBalanceTot(BODY *body, CONTROL *control, OUTPUT *output, void WriteAnnualInsol(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, - double *dTmp, char cUnit[]) { + double *dTmp, char **cUnit) { *dTmp = body[iBody].daAnnualInsol[body[iBody].iWriteLat]; if (output->bDoNeg[iBody]) { - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { @@ -3311,13 +3313,13 @@ void WriteAnnualInsol(BODY *body, CONTROL *control, OUTPUT *output, void WritePeakInsol(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, - double *dTmp, char cUnit[]) { + double *dTmp, char **cUnit) { *dTmp = body[iBody].daPeakInsol[body[iBody].iWriteLat]; if (output->bDoNeg[iBody]) { - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { @@ -3328,9 +3330,9 @@ void WritePeakInsol(BODY *body, CONTROL *control, OUTPUT *output, void WriteDailyInsol(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, - double *dTmp, char cUnit[]) { + double *dTmp, char **cUnit) { - char cOut[3 * NAMELEN]; + char *cOut=NULL; FILE *fp; int iLat, iDay; double dTime; @@ -3349,17 +3351,17 @@ void WriteDailyInsol(BODY *body, CONTROL *control, OUTPUT *output, if (dTime == 0) { - sprintf(cOut, "SeasonalClimateFiles/%s.%s.DailyInsol.0", system->cName, + fvFormattedString(&cOut, "SeasonalClimateFiles/%s.%s.DailyInsol.0", system->cName, body[iBody].cName); } else if (dTime < 10000) { - sprintf(cOut, "SeasonalClimateFiles/%s.%s.DailyInsol.%.0f", system->cName, + fvFormattedString(&cOut, "SeasonalClimateFiles/%s.%s.DailyInsol.%.0f", system->cName, body[iBody].cName, dTime); } else { - sprintf(cOut, "SeasonalClimateFiles/%s.%s.DailyInsol.%.2e", system->cName, + fvFormattedString(&cOut, "SeasonalClimateFiles/%s.%s.DailyInsol.%.2e", system->cName, body[iBody].cName, dTime); } @@ -3377,13 +3379,14 @@ void WriteDailyInsol(BODY *body, CONTROL *control, OUTPUT *output, } fclose(fp); + free(cOut); } void WritePlanckB(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, double *dTmp, - char cUnit[]) { + char **cUnit) { - char cOut[3 * NAMELEN]; + char *cOut=NULL; FILE *fp; int iLat, iDay; double dTime; @@ -3402,17 +3405,17 @@ void WritePlanckB(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, if (dTime == 0) { - sprintf(cOut, "SeasonalClimateFiles/%s.%s.PlanckB.0", system->cName, + fvFormattedString(&cOut, "SeasonalClimateFiles/%s.%s.PlanckB.0", system->cName, body[iBody].cName); } else if (dTime < 10000) { - sprintf(cOut, "SeasonalClimateFiles/%s.%s.PlanckB.%.0f", system->cName, + fvFormattedString(&cOut, "SeasonalClimateFiles/%s.%s.PlanckB.%.0f", system->cName, body[iBody].cName, dTime); } else { - sprintf(cOut, "SeasonalClimateFiles/%s.%s.PlanckB.%.2e", system->cName, + fvFormattedString(&cOut, "SeasonalClimateFiles/%s.%s.PlanckB.%.2e", system->cName, body[iBody].cName, dTime); } @@ -3431,13 +3434,14 @@ void WritePlanckB(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, } fclose(fp); + free(cOut); } void WriteSeasonalTemp(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, - double *dTmp, char cUnit[]) { + double *dTmp, char **cUnit) { - char cOut[3 * NAMELEN]; + char *cOut=NULL; FILE *fp; int iLat, iDay; double dTime; @@ -3456,17 +3460,17 @@ void WriteSeasonalTemp(BODY *body, CONTROL *control, OUTPUT *output, if (dTime == 0) { - sprintf(cOut, "SeasonalClimateFiles/%s.%s.SeasonalTemp.0", system->cName, + fvFormattedString(&cOut, "SeasonalClimateFiles/%s.%s.SeasonalTemp.0", system->cName, body[iBody].cName); } else if (dTime < 10000) { - sprintf(cOut, "SeasonalClimateFiles/%s.%s.SeasonalTemp.%.0f", system->cName, + fvFormattedString(&cOut, "SeasonalClimateFiles/%s.%s.SeasonalTemp.%.0f", system->cName, body[iBody].cName, dTime); } else { - sprintf(cOut, "SeasonalClimateFiles/%s.%s.SeasonalTemp.%.2e", system->cName, + fvFormattedString(&cOut, "SeasonalClimateFiles/%s.%s.SeasonalTemp.%.2e", system->cName, body[iBody].cName, dTime); } @@ -3487,14 +3491,14 @@ void WriteSeasonalTemp(BODY *body, CONTROL *control, OUTPUT *output, } fclose(fp); + free(cOut); } void WriteSeasonalFluxes(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, - int iBody, double *dTmp, char cUnit[]) { + int iBody, double *dTmp, char **cUnit) { - char cOutM[3 * NAMELEN], cOutI[3 * NAMELEN], cOutO[3 * NAMELEN], - cOutD[3 * NAMELEN]; + char *cOutM=NULL, *cOutI=NULL, *cOutO=NULL, *cOutD=NULL; FILE *fpM, *fpI, *fpO, *fpD; int iLat, iDay; double dTime; @@ -3513,35 +3517,35 @@ void WriteSeasonalFluxes(BODY *body, CONTROL *control, OUTPUT *output, if (dTime == 0) { - sprintf(cOutM, "SeasonalClimateFiles/%s.%s.SeasonalFMerid.0", system->cName, + fvFormattedString(&cOutM, "SeasonalClimateFiles/%s.%s.SeasonalFMerid.0", system->cName, body[iBody].cName); - sprintf(cOutI, "SeasonalClimateFiles/%s.%s.SeasonalFIn.0", system->cName, + fvFormattedString(&cOutI, "SeasonalClimateFiles/%s.%s.SeasonalFIn.0", system->cName, body[iBody].cName); - sprintf(cOutO, "SeasonalClimateFiles/%s.%s.SeasonalFOut.0", system->cName, + fvFormattedString(&cOutO, "SeasonalClimateFiles/%s.%s.SeasonalFOut.0", system->cName, body[iBody].cName); - sprintf(cOutD, "SeasonalClimateFiles/%s.%s.SeasonalDivF.0", system->cName, + fvFormattedString(&cOutD, "SeasonalClimateFiles/%s.%s.SeasonalDivF.0", system->cName, body[iBody].cName); } else if (dTime < 10000) { - sprintf(cOutM, "SeasonalClimateFiles/%s.%s.SeasonalFMerid.%.0f", + fvFormattedString(&cOutM, "SeasonalClimateFiles/%s.%s.SeasonalFMerid.%.0f", system->cName, body[iBody].cName, dTime); - sprintf(cOutI, "SeasonalClimateFiles/%s.%s.SeasonalFIn.%.0f", system->cName, + fvFormattedString(&cOutI, "SeasonalClimateFiles/%s.%s.SeasonalFIn.%.0f", system->cName, body[iBody].cName, dTime); - sprintf(cOutO, "SeasonalClimateFiles/%s.%s.SeasonalFOut.%.0f", + fvFormattedString(&cOutO, "SeasonalClimateFiles/%s.%s.SeasonalFOut.%.0f", system->cName, body[iBody].cName, dTime); - sprintf(cOutD, "SeasonalClimateFiles/%s.%s.SeasonalDivF.%.0f", + fvFormattedString(&cOutD, "SeasonalClimateFiles/%s.%s.SeasonalDivF.%.0f", system->cName, body[iBody].cName, dTime); } else { - sprintf(cOutM, "SeasonalClimateFiles/%s.%s.SeasonalFMerid.%.2e", + fvFormattedString(&cOutM, "SeasonalClimateFiles/%s.%s.SeasonalFMerid.%.2e", system->cName, body[iBody].cName, dTime); - sprintf(cOutI, "SeasonalClimateFiles/%s.%s.SeasonalFIn.%.2e", system->cName, + fvFormattedString(&cOutI, "SeasonalClimateFiles/%s.%s.SeasonalFIn.%.2e", system->cName, body[iBody].cName, dTime); - sprintf(cOutO, "SeasonalClimateFiles/%s.%s.SeasonalFOut.%.2e", + fvFormattedString(&cOutO, "SeasonalClimateFiles/%s.%s.SeasonalFOut.%.2e", system->cName, body[iBody].cName, dTime); - sprintf(cOutD, "SeasonalClimateFiles/%s.%s.SeasonalDivF.%.2e", + fvFormattedString(&cOutD, "SeasonalClimateFiles/%s.%s.SeasonalDivF.%.2e", system->cName, body[iBody].cName, dTime); } @@ -3584,13 +3588,17 @@ void WriteSeasonalFluxes(BODY *body, CONTROL *control, OUTPUT *output, fclose(fpI); fclose(fpO); fclose(fpD); + free(cOutM); + free(cOutI); + free(cOutO); + free(cOutD); } void WriteSeasonalIceBalance(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, - int iBody, double *dTmp, char cUnit[]) { + int iBody, double *dTmp, char **cUnit) { - char cOut[3 * NAMELEN]; + char *cOut=NULL; FILE *fp; int iLat, iDay; double dTime; @@ -3609,17 +3617,17 @@ void WriteSeasonalIceBalance(BODY *body, CONTROL *control, OUTPUT *output, if (dTime == 0) { - sprintf(cOut, "SeasonalClimateFiles/%s.%s.SeasonalIceBalance.0", + fvFormattedString(&cOut, "SeasonalClimateFiles/%s.%s.SeasonalIceBalance.0", system->cName, body[iBody].cName); } else if (dTime < 10000) { - sprintf(cOut, "SeasonalClimateFiles/%s.%s.SeasonalIceBalance.%.0f", + fvFormattedString(&cOut, "SeasonalClimateFiles/%s.%s.SeasonalIceBalance.%.0f", system->cName, body[iBody].cName, dTime); } else { - sprintf(cOut, "SeasonalClimateFiles/%s.%s.SeasonalIceBalance.%.2e", + fvFormattedString(&cOut, "SeasonalClimateFiles/%s.%s.SeasonalIceBalance.%.2e", system->cName, body[iBody].cName, dTime); } @@ -3637,11 +3645,12 @@ void WriteSeasonalIceBalance(BODY *body, CONTROL *control, OUTPUT *output, } fclose(fp); + free(cOut); } void WriteFluxMerid(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, - double *dTmp, char cUnit[]) { + double *dTmp, char **cUnit) { if (body[iBody].iClimateModel == ANN || body[iBody].bSkipSeas == 1) { @@ -3655,7 +3664,7 @@ void WriteFluxMerid(BODY *body, CONTROL *control, OUTPUT *output, if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { @@ -3666,7 +3675,7 @@ void WriteFluxMerid(BODY *body, CONTROL *control, OUTPUT *output, void WriteFluxIn(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, double *dTmp, - char cUnit[]) { + char **cUnit) { if (body[iBody].iClimateModel == ANN || body[iBody].bSkipSeas == 1) { @@ -3679,7 +3688,7 @@ void WriteFluxIn(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, if (output->bDoNeg[iBody]) { - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { @@ -3690,7 +3699,7 @@ void WriteFluxIn(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, void WriteFluxOut(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, double *dTmp, - char cUnit[]) { + char **cUnit) { if (body[iBody].iClimateModel == ANN || body[iBody].bSkipSeas == 1) { @@ -3703,7 +3712,7 @@ void WriteFluxOut(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, if (output->bDoNeg[iBody]) { - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { @@ -3714,7 +3723,7 @@ void WriteFluxOut(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, void WriteDivFlux(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, double *dTmp, - char cUnit[]) { + char **cUnit) { if (body[iBody].iClimateModel == ANN || body[iBody].bSkipSeas == 1) { *dTmp = body[iBody].daDivFlux[body[iBody].iWriteLat]; @@ -3722,7 +3731,7 @@ void WriteDivFlux(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, *dTmp = body[iBody].daDivFluxAvg[body[iBody].iWriteLat]; } if (output->bDoNeg[iBody]) { - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { *dTmp /= fdUnitsEnergyFlux(units->iTime, units->iMass, units->iLength); fsUnitsEnergyFlux(units, cUnit); @@ -3731,7 +3740,7 @@ void WriteDivFlux(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, void WriteIceMass(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, double *dTmp, - char cUnit[]) { + char **cUnit) { if (body[iBody].bIceSheets) { *dTmp = body[iBody].daIceMass[body[iBody].iWriteLat]; @@ -3741,7 +3750,7 @@ void WriteIceMass(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, } if (output->bDoNeg[iBody]) { - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { //*dTmp /= fdUnitsMass(units->iMass)/pow(fdUnitsLength(units->iLength),2); @@ -3751,7 +3760,7 @@ void WriteIceMass(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, void WriteIceHeight(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, - double *dTmp, char cUnit[]) { + double *dTmp, char **cUnit) { if (body[iBody].bIceSheets) { *dTmp = body[iBody].daIceMass[body[iBody].iWriteLat] / RHOICE; @@ -3760,7 +3769,7 @@ void WriteIceHeight(BODY *body, CONTROL *control, OUTPUT *output, } if (output->bDoNeg[iBody]) { - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { *dTmp /= fdUnitsLength(units->iLength); fsUnitsLength(units->iLength, cUnit); @@ -3769,7 +3778,7 @@ void WriteIceHeight(BODY *body, CONTROL *control, OUTPUT *output, void WriteBedrockH(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, double *dTmp, - char cUnit[]) { + char **cUnit) { if (body[iBody].bIceSheets) { *dTmp = body[iBody].daBedrockH[body[iBody].iWriteLat]; @@ -3778,7 +3787,7 @@ void WriteBedrockH(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, } if (output->bDoNeg[iBody]) { - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { *dTmp /= fdUnitsLength(units->iLength); fsUnitsLength(units->iLength, cUnit); @@ -3787,7 +3796,7 @@ void WriteBedrockH(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, void WritePlanckBAvg(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, - double *dTmp, char cUnit[]) { + double *dTmp, char **cUnit) { if (body[iBody].bIceSheets) { *dTmp = body[iBody].daPlanckBAvg[body[iBody].iWriteLat]; @@ -3796,7 +3805,7 @@ void WritePlanckBAvg(BODY *body, CONTROL *control, OUTPUT *output, } // if (output->bDoNeg[iBody]) { - // strcpy(cUnit,output->cNeg); + // fvFormattedString(cUnit,output->cNeg); // } else { // *dTmp /= fdUnitsLength(units->iLength); // fsUnitsLength(units->iLength,cUnit); @@ -3805,7 +3814,7 @@ void WritePlanckBAvg(BODY *body, CONTROL *control, OUTPUT *output, void WriteDIceMassDt(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, - double *dTmp, char cUnit[]) { + double *dTmp, char **cUnit) { //*dTmp = body[iBody].daIceBalanceAnnual[body[iBody].iWriteLat]; if (body[iBody].bIceSheets) { @@ -3815,7 +3824,7 @@ void WriteDIceMassDt(BODY *body, CONTROL *control, OUTPUT *output, } if (output->bDoNeg[iBody]) { - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { *dTmp /= fdUnitsLength(units->iLength); fsUnitsLength(units->iLength, cUnit); @@ -3824,7 +3833,7 @@ void WriteDIceMassDt(BODY *body, CONTROL *control, OUTPUT *output, void WriteIceAccum(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, double *dTmp, - char cUnit[]) { + char **cUnit) { //*dTmp = body[iBody].daIceBalanceAnnual[body[iBody].iWriteLat]; if (body[iBody].bIceSheets) { @@ -3834,7 +3843,7 @@ void WriteIceAccum(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, } // if (output->bDoNeg[iBody]) { - // strcpy(cUnit,output->cNeg); + // fvFormattedString(cUnit,output->cNeg); // } else { // *dTmp /= fdUnitsLength(units->iLength); // fsUnitsLength(units->iLength,cUnit); @@ -3843,7 +3852,7 @@ void WriteIceAccum(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, void WriteIceAblate(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, - double *dTmp, char cUnit[]) { + double *dTmp, char **cUnit) { //*dTmp = body[iBody].daIceBalanceAnnual[body[iBody].iWriteLat]; if (body[iBody].bIceSheets) { @@ -3853,7 +3862,7 @@ void WriteIceAblate(BODY *body, CONTROL *control, OUTPUT *output, } // if (output->bDoNeg[iBody]) { - // strcpy(cUnit,output->cNeg); + // fvFormattedString(cUnit,output->cNeg); // } else { // *dTmp /= fdUnitsLength(units->iLength); // fsUnitsLength(units->iLength,cUnit); @@ -3863,7 +3872,7 @@ void WriteIceAblate(BODY *body, CONTROL *control, OUTPUT *output, void WriteDIceMassDtFlow(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, - int iBody, double *dTmp, char cUnit[]) { + int iBody, double *dTmp, char **cUnit) { // *dTmp = body[iBody].daIceBalanceAnnual[body[iBody].iWriteLat]; if (body[iBody].bIceSheets) { @@ -3873,7 +3882,7 @@ void WriteDIceMassDtFlow(BODY *body, CONTROL *control, OUTPUT *output, } if (output->bDoNeg[iBody]) { - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { // *dTmp /= fdUnitsMass(units->iMass)/pow(fdUnitsLength(units->iLength),2); // fsUnitsEnergyFlux(units,cUnit); @@ -3882,12 +3891,12 @@ void WriteDIceMassDtFlow(BODY *body, CONTROL *control, OUTPUT *output, void WriteEnergyResL(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, - double *dTmp, char cUnit[]) { + double *dTmp, char **cUnit) { *dTmp = body[iBody].daEnergyResL[body[iBody].iWriteLat]; if (output->bDoNeg[iBody]) { - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { *dTmp /= fdUnitsEnergyFlux(units->iTime, units->iMass, units->iLength); fsUnitsEnergyFlux(units, cUnit); @@ -3896,12 +3905,12 @@ void WriteEnergyResL(BODY *body, CONTROL *control, OUTPUT *output, void WriteEnergyResW(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, - double *dTmp, char cUnit[]) { + double *dTmp, char **cUnit) { *dTmp = body[iBody].daEnergyResW[body[iBody].iWriteLat]; if (output->bDoNeg[iBody]) { - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { *dTmp /= fdUnitsEnergyFlux(units->iTime, units->iMass, units->iLength); fsUnitsEnergyFlux(units, cUnit); @@ -3909,9 +3918,9 @@ void WriteEnergyResW(BODY *body, CONTROL *control, OUTPUT *output, } void InitializeOutputPoise(OUTPUT *output, fnWriteOutput fnWrite[]) { - sprintf(output[OUT_TGLOBAL].cName, "TGlobal"); - sprintf(output[OUT_TGLOBAL].cDescr, "Global mean temperature from POISE"); - sprintf(output[OUT_TGLOBAL].cNeg, "Celsius"); + fvFormattedString(&output[OUT_TGLOBAL].cName, "TGlobal"); + fvFormattedString(&output[OUT_TGLOBAL].cDescr, "Global mean temperature from POISE"); + fvFormattedString(&output[OUT_TGLOBAL].cNeg, "Celsius"); output[OUT_TGLOBAL].bNeg = 1; // conversion is hardcoded in write function output[OUT_TGLOBAL].dNeg = 1; @@ -3919,77 +3928,77 @@ void InitializeOutputPoise(OUTPUT *output, fnWriteOutput fnWrite[]) { output[OUT_TGLOBAL].iModuleBit = POISE; fnWrite[OUT_TGLOBAL] = &WriteTGlobal; - sprintf(output[OUT_ALBEDOGLOBAL].cName, "AlbedoGlobal"); - sprintf(output[OUT_ALBEDOGLOBAL].cDescr, + fvFormattedString(&output[OUT_ALBEDOGLOBAL].cName, "AlbedoGlobal"); + fvFormattedString(&output[OUT_ALBEDOGLOBAL].cDescr, "Global mean bond albedo from POISE"); output[OUT_ALBEDOGLOBAL].bNeg = 0; output[OUT_ALBEDOGLOBAL].iNum = 1; output[OUT_ALBEDOGLOBAL].iModuleBit = POISE; fnWrite[OUT_ALBEDOGLOBAL] = &WriteAlbedoGlobal; - sprintf(output[OUT_SNOWBALL].cName, "Snowball"); - sprintf(output[OUT_SNOWBALL].cDescr, "Is the planet in a snowball state?"); + fvFormattedString(&output[OUT_SNOWBALL].cName, "Snowball"); + fvFormattedString(&output[OUT_SNOWBALL].cDescr, "Is the planet in a snowball state?"); output[OUT_SNOWBALL].bNeg = 0; output[OUT_SNOWBALL].iNum = 1; output[OUT_SNOWBALL].iModuleBit = POISE; fnWrite[OUT_SNOWBALL] = &WriteSnowball; - sprintf(output[OUT_TOTICEMASS].cName, "TotIceMass"); - sprintf(output[OUT_TOTICEMASS].cDescr, "Global total ice mass in ice sheets"); - sprintf(output[OUT_TOTICEMASS].cNeg, "kg"); + fvFormattedString(&output[OUT_TOTICEMASS].cName, "TotIceMass"); + fvFormattedString(&output[OUT_TOTICEMASS].cDescr, "Global total ice mass in ice sheets"); + fvFormattedString(&output[OUT_TOTICEMASS].cNeg, "kg"); output[OUT_TOTICEMASS].bNeg = 1; output[OUT_TOTICEMASS].iNum = 1; output[OUT_TOTICEMASS].iModuleBit = POISE; fnWrite[OUT_TOTICEMASS] = &WriteTotIceMass; - sprintf(output[OUT_TOTICEFLOW].cName, "TotIceFlow"); - sprintf(output[OUT_TOTICEFLOW].cDescr, + fvFormattedString(&output[OUT_TOTICEFLOW].cName, "TotIceFlow"); + fvFormattedString(&output[OUT_TOTICEFLOW].cDescr, "Global total ice flow in ice sheets (should = 0)"); - sprintf(output[OUT_TOTICEFLOW].cNeg, "kg"); + fvFormattedString(&output[OUT_TOTICEFLOW].cNeg, "kg"); output[OUT_TOTICEFLOW].bNeg = 1; output[OUT_TOTICEFLOW].iNum = 1; output[OUT_TOTICEFLOW].iModuleBit = POISE; fnWrite[OUT_TOTICEFLOW] = &WriteIceFlowTot; - sprintf(output[OUT_TOTICEBALANCE].cName, "TotIceBalance"); - sprintf(output[OUT_TOTICEBALANCE].cDescr, + fvFormattedString(&output[OUT_TOTICEBALANCE].cName, "TotIceBalance"); + fvFormattedString(&output[OUT_TOTICEBALANCE].cDescr, "Global total ice balance in ice sheets (this time step)"); - sprintf(output[OUT_TOTICEBALANCE].cNeg, "kg"); + fvFormattedString(&output[OUT_TOTICEBALANCE].cNeg, "kg"); output[OUT_TOTICEBALANCE].bNeg = 1; output[OUT_TOTICEBALANCE].iNum = 1; output[OUT_TOTICEBALANCE].iModuleBit = POISE; fnWrite[OUT_TOTICEBALANCE] = &WriteIceBalanceTot; - sprintf(output[OUT_FLUXINGLOBAL].cName, "FluxInGlobal"); - sprintf(output[OUT_FLUXINGLOBAL].cDescr, + fvFormattedString(&output[OUT_FLUXINGLOBAL].cName, "FluxInGlobal"); + fvFormattedString(&output[OUT_FLUXINGLOBAL].cDescr, "Global mean flux in (insol*(1-albedo)) from POISE"); /* Sadly, Russell, we must set the negative option to W/m^2. - sprintf(output[OUT_FLUXINGLOBAL].cNeg,"pirate-ninjas/m^2"); + fvFormattedString(output[OUT_FLUXINGLOBAL].cNeg,"pirate-ninjas/m^2"); output[OUT_FLUXINGLOBAL].dNeg = 1/40.55185; */ output[OUT_FLUXINGLOBAL].bNeg = 1; output[OUT_FLUXINGLOBAL].dNeg = 1; // Just in case - sprintf(output[OUT_FLUXINGLOBAL].cNeg, "W/m^2"); + fvFormattedString(&output[OUT_FLUXINGLOBAL].cNeg, "W/m^2"); output[OUT_FLUXINGLOBAL].iNum = 1; output[OUT_FLUXINGLOBAL].iModuleBit = POISE; fnWrite[OUT_FLUXINGLOBAL] = &WriteFluxInGlobal; - sprintf(output[OUT_FLUXOUTGLOBAL].cName, "FluxOutGlobal"); - sprintf(output[OUT_FLUXOUTGLOBAL].cDescr, "Global mean flux out from POISE"); + fvFormattedString(&output[OUT_FLUXOUTGLOBAL].cName, "FluxOutGlobal"); + fvFormattedString(&output[OUT_FLUXOUTGLOBAL].cDescr, "Global mean flux out from POISE"); /* Here, too - sprintf(output[OUT_FLUXOUTGLOBAL].cNeg,"pirate-ninjas/m^2"); + fvFormattedString(output[OUT_FLUXOUTGLOBAL].cNeg,"pirate-ninjas/m^2"); output[OUT_FLUXOUTGLOBAL].dNeg = 1/40.55185; */ output[OUT_FLUXOUTGLOBAL].bNeg = 1; output[OUT_FLUXOUTGLOBAL].dNeg = 1; - sprintf(output[OUT_FLUXOUTGLOBAL].cNeg, "W/m^2"); + fvFormattedString(&output[OUT_FLUXOUTGLOBAL].cNeg, "W/m^2"); output[OUT_FLUXOUTGLOBAL].iNum = 1; output[OUT_FLUXOUTGLOBAL].iModuleBit = POISE; fnWrite[OUT_FLUXOUTGLOBAL] = &WriteFluxOutGlobal; - sprintf(output[OUT_TEMPLAT].cName, "TempLat"); - sprintf(output[OUT_TEMPLAT].cDescr, "Surface temperature by latitude."); - sprintf(output[OUT_TEMPLAT].cNeg, "Celsius"); + fvFormattedString(&output[OUT_TEMPLAT].cName, "TempLat"); + fvFormattedString(&output[OUT_TEMPLAT].cDescr, "Surface temperature by latitude."); + fvFormattedString(&output[OUT_TEMPLAT].cNeg, "Celsius"); output[OUT_TEMPLAT].bNeg = 1; // conversion is hardcoded in write function output[OUT_TEMPLAT].dNeg = 1; @@ -3998,10 +4007,10 @@ void InitializeOutputPoise(OUTPUT *output, fnWriteOutput fnWrite[]) { output[OUT_TEMPLAT].iModuleBit = POISE; fnWrite[OUT_TEMPLAT] = &WriteTempLat; - sprintf(output[OUT_TEMPMINLAT].cName, "TempMinLat"); - sprintf(output[OUT_TEMPMINLAT].cDescr, + fvFormattedString(&output[OUT_TEMPMINLAT].cName, "TempMinLat"); + fvFormattedString(&output[OUT_TEMPMINLAT].cDescr, "Minimum surface temperature over a year by latitude."); - sprintf(output[OUT_TEMPMINLAT].cNeg, "Celsius"); + fvFormattedString(&output[OUT_TEMPMINLAT].cNeg, "Celsius"); output[OUT_TEMPMINLAT].bNeg = 1; // conversion is hardcoded in write function output[OUT_TEMPMINLAT].dNeg = 1; @@ -4010,10 +4019,10 @@ void InitializeOutputPoise(OUTPUT *output, fnWriteOutput fnWrite[]) { output[OUT_TEMPMINLAT].iModuleBit = POISE; fnWrite[OUT_TEMPMINLAT] = &WriteTempMinLat; - sprintf(output[OUT_TEMPMAXLAT].cName, "TempMaxLat"); - sprintf(output[OUT_TEMPMAXLAT].cDescr, + fvFormattedString(&output[OUT_TEMPMAXLAT].cName, "TempMaxLat"); + fvFormattedString(&output[OUT_TEMPMAXLAT].cDescr, "Maximum surface temperature over a year by latitude."); - sprintf(output[OUT_TEMPMAXLAT].cNeg, "Celsius"); + fvFormattedString(&output[OUT_TEMPMAXLAT].cNeg, "Celsius"); output[OUT_TEMPMAXLAT].bNeg = 1; // conversion is hardcoded in write function output[OUT_TEMPMAXLAT].dNeg = 1; @@ -4022,10 +4031,10 @@ void InitializeOutputPoise(OUTPUT *output, fnWriteOutput fnWrite[]) { output[OUT_TEMPMAXLAT].iModuleBit = POISE; fnWrite[OUT_TEMPMAXLAT] = &WriteTempMaxLat; - sprintf(output[OUT_TEMPMAXLAND].cName, "TempMaxLand"); - sprintf(output[OUT_TEMPMAXLAND].cDescr, + fvFormattedString(&output[OUT_TEMPMAXLAND].cName, "TempMaxLand"); + fvFormattedString(&output[OUT_TEMPMAXLAND].cDescr, "Maximum surface temperature on land"); - sprintf(output[OUT_TEMPMAXLAND].cNeg, "Celsius"); + fvFormattedString(&output[OUT_TEMPMAXLAND].cNeg, "Celsius"); output[OUT_TEMPMAXLAND].bNeg = 1; // conversion is hardcoded in write function output[OUT_TEMPMAXLAND].dNeg = 1; @@ -4034,10 +4043,10 @@ void InitializeOutputPoise(OUTPUT *output, fnWriteOutput fnWrite[]) { output[OUT_TEMPMAXLAND].iModuleBit = POISE; fnWrite[OUT_TEMPMAXLAND] = &WriteTempMaxLand; - sprintf(output[OUT_TEMPMAXWATER].cName, "TempMaxWater"); - sprintf(output[OUT_TEMPMAXWATER].cDescr, + fvFormattedString(&output[OUT_TEMPMAXWATER].cName, "TempMaxWater"); + fvFormattedString(&output[OUT_TEMPMAXWATER].cDescr, "Maximum surface temperature on water"); - sprintf(output[OUT_TEMPMAXWATER].cNeg, "Celsius"); + fvFormattedString(&output[OUT_TEMPMAXWATER].cNeg, "Celsius"); output[OUT_TEMPMAXWATER].bNeg = 1; // conversion is hardcoded in write function output[OUT_TEMPMAXWATER].dNeg = 1; @@ -4046,10 +4055,10 @@ void InitializeOutputPoise(OUTPUT *output, fnWriteOutput fnWrite[]) { output[OUT_TEMPMAXWATER].iModuleBit = POISE; fnWrite[OUT_TEMPMAXWATER] = &WriteTempMaxWater; - sprintf(output[OUT_TEMPLANDLAT].cName, "TempLandLat"); - sprintf(output[OUT_TEMPLANDLAT].cDescr, + fvFormattedString(&output[OUT_TEMPLANDLAT].cName, "TempLandLat"); + fvFormattedString(&output[OUT_TEMPLANDLAT].cDescr, "Land surface temperature by latitude."); - sprintf(output[OUT_TEMPLANDLAT].cNeg, "Celsius"); + fvFormattedString(&output[OUT_TEMPLANDLAT].cNeg, "Celsius"); output[OUT_TEMPLANDLAT].bNeg = 1; // conversion is hardcoded in write function output[OUT_TEMPLANDLAT].dNeg = 1; @@ -4057,10 +4066,10 @@ void InitializeOutputPoise(OUTPUT *output, fnWriteOutput fnWrite[]) { output[OUT_TEMPLANDLAT].bGrid = 1; fnWrite[OUT_TEMPLANDLAT] = &WriteTempLandLat; - sprintf(output[OUT_TEMPWATERLAT].cName, "TempWaterLat"); - sprintf(output[OUT_TEMPWATERLAT].cDescr, + fvFormattedString(&output[OUT_TEMPWATERLAT].cName, "TempWaterLat"); + fvFormattedString(&output[OUT_TEMPWATERLAT].cDescr, "Water surface temperature by latitude."); - sprintf(output[OUT_TEMPWATERLAT].cNeg, "Celsius"); + fvFormattedString(&output[OUT_TEMPWATERLAT].cNeg, "Celsius"); output[OUT_TEMPWATERLAT].bNeg = 1; // conversion is hardcoded in write function output[OUT_TEMPWATERLAT].dNeg = 1; @@ -4068,9 +4077,9 @@ void InitializeOutputPoise(OUTPUT *output, fnWriteOutput fnWrite[]) { output[OUT_TEMPWATERLAT].bGrid = 1; fnWrite[OUT_TEMPWATERLAT] = &WriteTempWaterLat; - sprintf(output[OUT_LATITUDE].cName, "Latitude"); - sprintf(output[OUT_LATITUDE].cDescr, "Latitude."); - sprintf(output[OUT_LATITUDE].cNeg, "deg"); + fvFormattedString(&output[OUT_LATITUDE].cName, "Latitude"); + fvFormattedString(&output[OUT_LATITUDE].cDescr, "Latitude."); + fvFormattedString(&output[OUT_LATITUDE].cNeg, "deg"); output[OUT_LATITUDE].bNeg = 1; output[OUT_LATITUDE].dNeg = 1 / DEGRAD; output[OUT_LATITUDE].iNum = 1; @@ -4078,32 +4087,32 @@ void InitializeOutputPoise(OUTPUT *output, fnWriteOutput fnWrite[]) { output[OUT_LATITUDE].iModuleBit = POISE; fnWrite[OUT_LATITUDE] = &WriteLatitude; - sprintf(output[OUT_ALBEDOLAT].cName, "AlbedoLat"); - sprintf(output[OUT_ALBEDOLAT].cDescr, "Surface albedo by latitude."); + fvFormattedString(&output[OUT_ALBEDOLAT].cName, "AlbedoLat"); + fvFormattedString(&output[OUT_ALBEDOLAT].cDescr, "Surface albedo by latitude."); output[OUT_ALBEDOLAT].bNeg = 0; output[OUT_ALBEDOLAT].iNum = 1; output[OUT_ALBEDOLAT].bGrid = 1; output[OUT_ALBEDOLAT].iModuleBit = POISE; fnWrite[OUT_ALBEDOLAT] = &WriteAlbedoLat; - sprintf(output[OUT_ALBEDOLANDLAT].cName, "AlbedoLandLat"); - sprintf(output[OUT_ALBEDOLANDLAT].cDescr, "Land surface albedo by latitude."); + fvFormattedString(&output[OUT_ALBEDOLANDLAT].cName, "AlbedoLandLat"); + fvFormattedString(&output[OUT_ALBEDOLANDLAT].cDescr, "Land surface albedo by latitude."); output[OUT_ALBEDOLANDLAT].bNeg = 0; output[OUT_ALBEDOLANDLAT].iNum = 1; output[OUT_ALBEDOLANDLAT].bGrid = 1; fnWrite[OUT_ALBEDOLANDLAT] = &WriteAlbedoLandLat; - sprintf(output[OUT_ALBEDOWATERLAT].cName, "AlbedoWaterLat"); - sprintf(output[OUT_ALBEDOWATERLAT].cDescr, + fvFormattedString(&output[OUT_ALBEDOWATERLAT].cName, "AlbedoWaterLat"); + fvFormattedString(&output[OUT_ALBEDOWATERLAT].cDescr, "Water surface albedo by latitude."); output[OUT_ALBEDOWATERLAT].bNeg = 0; output[OUT_ALBEDOWATERLAT].iNum = 1; output[OUT_ALBEDOWATERLAT].bGrid = 1; fnWrite[OUT_ALBEDOWATERLAT] = &WriteAlbedoWaterLat; - sprintf(output[OUT_ANNUALINSOL].cName, "AnnInsol"); - sprintf(output[OUT_ANNUALINSOL].cDescr, "Annual insolation by latitude."); - sprintf(output[OUT_ANNUALINSOL].cNeg, "W/m^2"); + fvFormattedString(&output[OUT_ANNUALINSOL].cName, "AnnInsol"); + fvFormattedString(&output[OUT_ANNUALINSOL].cDescr, "Annual insolation by latitude."); + fvFormattedString(&output[OUT_ANNUALINSOL].cNeg, "W/m^2"); output[OUT_ANNUALINSOL].bNeg = 1; output[OUT_ANNUALINSOL].dNeg = 1 / 40.55185; output[OUT_ANNUALINSOL].iNum = 1; @@ -4111,9 +4120,9 @@ void InitializeOutputPoise(OUTPUT *output, fnWriteOutput fnWrite[]) { output[OUT_ANNUALINSOL].iModuleBit = POISE; fnWrite[OUT_ANNUALINSOL] = &WriteAnnualInsol; - sprintf(output[OUT_PEAKINSOL].cName, "PeakInsol"); - sprintf(output[OUT_PEAKINSOL].cDescr, "Peak insolation by latitude."); - sprintf(output[OUT_PEAKINSOL].cNeg, "W/m^2"); + fvFormattedString(&output[OUT_PEAKINSOL].cName, "PeakInsol"); + fvFormattedString(&output[OUT_PEAKINSOL].cDescr, "Peak insolation by latitude."); + fvFormattedString(&output[OUT_PEAKINSOL].cNeg, "W/m^2"); output[OUT_PEAKINSOL].bNeg = 1; output[OUT_PEAKINSOL].dNeg = 1 / 40.55185; output[OUT_PEAKINSOL].iNum = 1; @@ -4121,10 +4130,10 @@ void InitializeOutputPoise(OUTPUT *output, fnWriteOutput fnWrite[]) { output[OUT_PEAKINSOL].iModuleBit = POISE; fnWrite[OUT_PEAKINSOL] = &WritePeakInsol; - sprintf(output[OUT_FLUXMERID].cName, "FluxMerid"); - sprintf(output[OUT_FLUXMERID].cDescr, + fvFormattedString(&output[OUT_FLUXMERID].cName, "FluxMerid"); + fvFormattedString(&output[OUT_FLUXMERID].cDescr, "Total meridional (northward) flux by latitude"); - sprintf(output[OUT_FLUXMERID].cNeg, "PW"); + fvFormattedString(&output[OUT_FLUXMERID].cNeg, "PW"); output[OUT_FLUXMERID].bNeg = 1; output[OUT_FLUXMERID].dNeg = 1e-15; output[OUT_FLUXMERID].iNum = 1; @@ -4132,9 +4141,9 @@ void InitializeOutputPoise(OUTPUT *output, fnWriteOutput fnWrite[]) { output[OUT_FLUXMERID].iModuleBit = POISE; fnWrite[OUT_FLUXMERID] = &WriteFluxMerid; - sprintf(output[OUT_FLUXIN].cName, "FluxIn"); - sprintf(output[OUT_FLUXIN].cDescr, "Incoming flux by latitude"); - sprintf(output[OUT_FLUXIN].cNeg, "W/m^2"); + fvFormattedString(&output[OUT_FLUXIN].cName, "FluxIn"); + fvFormattedString(&output[OUT_FLUXIN].cDescr, "Incoming flux by latitude"); + fvFormattedString(&output[OUT_FLUXIN].cNeg, "W/m^2"); output[OUT_FLUXIN].bNeg = 1; output[OUT_FLUXIN].dNeg = 1; output[OUT_FLUXIN].iNum = 1; @@ -4142,9 +4151,9 @@ void InitializeOutputPoise(OUTPUT *output, fnWriteOutput fnWrite[]) { output[OUT_FLUXIN].iModuleBit = POISE; fnWrite[OUT_FLUXIN] = &WriteFluxIn; - sprintf(output[OUT_FLUXOUT].cName, "FluxOut"); - sprintf(output[OUT_FLUXOUT].cDescr, "Outgoing (spaceward) flux by latitude"); - sprintf(output[OUT_FLUXOUT].cNeg, "W/m^2"); + fvFormattedString(&output[OUT_FLUXOUT].cName, "FluxOut"); + fvFormattedString(&output[OUT_FLUXOUT].cDescr, "Outgoing (spaceward) flux by latitude"); + fvFormattedString(&output[OUT_FLUXOUT].cNeg, "W/m^2"); output[OUT_FLUXOUT].bNeg = 1; output[OUT_FLUXOUT].dNeg = 1; output[OUT_FLUXOUT].iNum = 1; @@ -4152,10 +4161,10 @@ void InitializeOutputPoise(OUTPUT *output, fnWriteOutput fnWrite[]) { output[OUT_FLUXOUT].iModuleBit = POISE; fnWrite[OUT_FLUXOUT] = &WriteFluxOut; - sprintf(output[OUT_DIVFLUX].cName, "DivFlux"); - sprintf(output[OUT_DIVFLUX].cDescr, + fvFormattedString(&output[OUT_DIVFLUX].cName, "DivFlux"); + fvFormattedString(&output[OUT_DIVFLUX].cDescr, "Divergence of flux (flow into adjacent cells) by latitude"); - sprintf(output[OUT_DIVFLUX].cNeg, "W/m^2"); + fvFormattedString(&output[OUT_DIVFLUX].cNeg, "W/m^2"); output[OUT_DIVFLUX].bNeg = 1; output[OUT_DIVFLUX].dNeg = 1; output[OUT_DIVFLUX].iNum = 1; @@ -4163,9 +4172,9 @@ void InitializeOutputPoise(OUTPUT *output, fnWriteOutput fnWrite[]) { output[OUT_DIVFLUX].iModuleBit = POISE; fnWrite[OUT_DIVFLUX] = &WriteDivFlux; - sprintf(output[OUT_ICEMASS].cName, "IceMass"); - sprintf(output[OUT_ICEMASS].cDescr, "Mass of ice sheets/area by latitude"); - sprintf(output[OUT_ICEMASS].cNeg, "kg/m^2"); + fvFormattedString(&output[OUT_ICEMASS].cName, "IceMass"); + fvFormattedString(&output[OUT_ICEMASS].cDescr, "Mass of ice sheets/area by latitude"); + fvFormattedString(&output[OUT_ICEMASS].cNeg, "kg/m^2"); output[OUT_ICEMASS].bNeg = 1; output[OUT_ICEMASS].dNeg = 1; output[OUT_ICEMASS].iNum = 1; @@ -4173,9 +4182,9 @@ void InitializeOutputPoise(OUTPUT *output, fnWriteOutput fnWrite[]) { output[OUT_ICEMASS].iModuleBit = POISE; fnWrite[OUT_ICEMASS] = &WriteIceMass; - sprintf(output[OUT_ICEHEIGHT].cName, "IceHeight"); - sprintf(output[OUT_ICEHEIGHT].cDescr, "Height of ice sheets"); - sprintf(output[OUT_ICEHEIGHT].cNeg, "m"); + fvFormattedString(&output[OUT_ICEHEIGHT].cName, "IceHeight"); + fvFormattedString(&output[OUT_ICEHEIGHT].cDescr, "Height of ice sheets"); + fvFormattedString(&output[OUT_ICEHEIGHT].cNeg, "m"); output[OUT_ICEHEIGHT].bNeg = 1; output[OUT_ICEHEIGHT].dNeg = 1; output[OUT_ICEHEIGHT].iNum = 1; @@ -4183,10 +4192,10 @@ void InitializeOutputPoise(OUTPUT *output, fnWriteOutput fnWrite[]) { output[OUT_ICEHEIGHT].iModuleBit = POISE; fnWrite[OUT_ICEHEIGHT] = &WriteIceHeight; - sprintf(output[OUT_DICEMASSDT].cName, "DIceMassDt"); - sprintf(output[OUT_DICEMASSDT].cDescr, + fvFormattedString(&output[OUT_DICEMASSDT].cName, "DIceMassDt"); + fvFormattedString(&output[OUT_DICEMASSDT].cDescr, "derivative of mass of ice sheets/area by latitude"); - sprintf(output[OUT_DICEMASSDT].cNeg, "kg/m^2/s"); + fvFormattedString(&output[OUT_DICEMASSDT].cNeg, "kg/m^2/s"); output[OUT_DICEMASSDT].bNeg = 1; output[OUT_DICEMASSDT].dNeg = 1; output[OUT_DICEMASSDT].iNum = 1; @@ -4194,10 +4203,10 @@ void InitializeOutputPoise(OUTPUT *output, fnWriteOutput fnWrite[]) { output[OUT_DICEMASSDT].iModuleBit = POISE; fnWrite[OUT_DICEMASSDT] = &WriteDIceMassDt; - sprintf(output[OUT_ICEACCUM].cName, "IceAccum"); - sprintf(output[OUT_ICEACCUM].cDescr, + fvFormattedString(&output[OUT_ICEACCUM].cName, "IceAccum"); + fvFormattedString(&output[OUT_ICEACCUM].cDescr, "Ice growth per orbit (accumulation only)"); - sprintf(output[OUT_ICEACCUM].cNeg, "m/orbit"); + fvFormattedString(&output[OUT_ICEACCUM].cNeg, "m/orbit"); output[OUT_ICEACCUM].bNeg = 1; output[OUT_ICEACCUM].dNeg = 1; output[OUT_ICEACCUM].iNum = 1; @@ -4205,9 +4214,9 @@ void InitializeOutputPoise(OUTPUT *output, fnWriteOutput fnWrite[]) { output[OUT_ICEACCUM].iModuleBit = POISE; fnWrite[OUT_ICEACCUM] = &WriteIceAccum; - sprintf(output[OUT_ICEABLATE].cName, "IceAblate"); - sprintf(output[OUT_ICEABLATE].cDescr, "ice decay per orbit (ablation only)"); - sprintf(output[OUT_ICEABLATE].cNeg, "m/orbit"); + fvFormattedString(&output[OUT_ICEABLATE].cName, "IceAblate"); + fvFormattedString(&output[OUT_ICEABLATE].cDescr, "ice decay per orbit (ablation only)"); + fvFormattedString(&output[OUT_ICEABLATE].cNeg, "m/orbit"); output[OUT_ICEABLATE].bNeg = 1; output[OUT_ICEABLATE].dNeg = 1; output[OUT_ICEABLATE].iNum = 1; @@ -4215,9 +4224,9 @@ void InitializeOutputPoise(OUTPUT *output, fnWriteOutput fnWrite[]) { output[OUT_ICEABLATE].iModuleBit = POISE; fnWrite[OUT_ICEABLATE] = &WriteIceAblate; - sprintf(output[OUT_ICEFLOW].cName, "IceFlow"); - sprintf(output[OUT_ICEFLOW].cDescr, "flow of ice sheets/area by latitude"); - sprintf(output[OUT_ICEFLOW].cNeg, "m/s"); + fvFormattedString(&output[OUT_ICEFLOW].cName, "IceFlow"); + fvFormattedString(&output[OUT_ICEFLOW].cDescr, "flow of ice sheets/area by latitude"); + fvFormattedString(&output[OUT_ICEFLOW].cNeg, "m/s"); output[OUT_ICEFLOW].bNeg = 1; output[OUT_ICEFLOW].dNeg = 1; output[OUT_ICEFLOW].iNum = 1; @@ -4225,9 +4234,9 @@ void InitializeOutputPoise(OUTPUT *output, fnWriteOutput fnWrite[]) { output[OUT_ICEFLOW].iModuleBit = POISE; fnWrite[OUT_ICEFLOW] = &WriteDIceMassDtFlow; - sprintf(output[OUT_BEDROCKH].cName, "BedrockH"); - sprintf(output[OUT_BEDROCKH].cDescr, "height/depth of bedrock"); - sprintf(output[OUT_BEDROCKH].cNeg, "m"); + fvFormattedString(&output[OUT_BEDROCKH].cName, "BedrockH"); + fvFormattedString(&output[OUT_BEDROCKH].cDescr, "height/depth of bedrock"); + fvFormattedString(&output[OUT_BEDROCKH].cNeg, "m"); output[OUT_BEDROCKH].bNeg = 1; output[OUT_BEDROCKH].dNeg = 1; output[OUT_BEDROCKH].iNum = 1; @@ -4235,9 +4244,9 @@ void InitializeOutputPoise(OUTPUT *output, fnWriteOutput fnWrite[]) { output[OUT_BEDROCKH].iModuleBit = POISE; fnWrite[OUT_BEDROCKH] = &WriteBedrockH; - sprintf(output[OUT_ENERGYRESL].cName, "EnergyResL"); - sprintf(output[OUT_ENERGYRESL].cDescr, "Energy residual on land"); - sprintf(output[OUT_ENERGYRESL].cNeg, "W/m^2"); + fvFormattedString(&output[OUT_ENERGYRESL].cName, "EnergyResL"); + fvFormattedString(&output[OUT_ENERGYRESL].cDescr, "Energy residual on land"); + fvFormattedString(&output[OUT_ENERGYRESL].cNeg, "W/m^2"); output[OUT_ENERGYRESL].bNeg = 1; output[OUT_ENERGYRESL].dNeg = 1; output[OUT_ENERGYRESL].iNum = 1; @@ -4245,9 +4254,9 @@ void InitializeOutputPoise(OUTPUT *output, fnWriteOutput fnWrite[]) { output[OUT_ENERGYRESL].iModuleBit = POISE; fnWrite[OUT_ENERGYRESL] = &WriteEnergyResL; - sprintf(output[OUT_ENERGYRESW].cName, "EnergyResW"); - sprintf(output[OUT_ENERGYRESW].cDescr, "Energy residual over water"); - sprintf(output[OUT_ENERGYRESW].cNeg, "W/m^2"); + fvFormattedString(&output[OUT_ENERGYRESW].cName, "EnergyResW"); + fvFormattedString(&output[OUT_ENERGYRESW].cDescr, "Energy residual over water"); + fvFormattedString(&output[OUT_ENERGYRESW].cNeg, "W/m^2"); output[OUT_ENERGYRESW].bNeg = 1; output[OUT_ENERGYRESW].dNeg = 1; output[OUT_ENERGYRESW].iNum = 1; @@ -4255,196 +4264,196 @@ void InitializeOutputPoise(OUTPUT *output, fnWriteOutput fnWrite[]) { output[OUT_ENERGYRESW].iModuleBit = POISE; fnWrite[OUT_ENERGYRESW] = &WriteEnergyResW; - sprintf(output[OUT_SKIPSEAS].cName, "SkipSeas"); - sprintf(output[OUT_SKIPSEAS].cDescr, + fvFormattedString(&output[OUT_SKIPSEAS].cName, "SkipSeas"); + fvFormattedString(&output[OUT_SKIPSEAS].cDescr, "Is Seasonal model skipped due to RGH or snowball?"); output[OUT_SKIPSEAS].bNeg = 0; output[OUT_SKIPSEAS].iNum = 1; output[OUT_SKIPSEAS].iModuleBit = POISE; fnWrite[OUT_SKIPSEAS] = &WriteSkipSeas; - sprintf(output[OUT_PLANCKBAVG].cName, "PlanckBAvg"); - sprintf(output[OUT_PLANCKBAVG].cDescr, "Annually averaged Planck B coeff"); - sprintf(output[OUT_PLANCKBAVG].cNeg, "W/m^2/C"); + fvFormattedString(&output[OUT_PLANCKBAVG].cName, "PlanckBAvg"); + fvFormattedString(&output[OUT_PLANCKBAVG].cDescr, "Annually averaged Planck B coeff"); + fvFormattedString(&output[OUT_PLANCKBAVG].cNeg, "W/m^2/C"); output[OUT_PLANCKBAVG].bNeg = 0; output[OUT_PLANCKBAVG].iNum = 1; output[OUT_PLANCKBAVG].bGrid = 1; output[OUT_PLANCKBAVG].iModuleBit = POISE; fnWrite[OUT_PLANCKBAVG] = &WritePlanckBAvg; - sprintf(output[OUT_AREAICECOV].cName, "AreaIceCov"); - sprintf(output[OUT_AREAICECOV].cDescr, "Fractional area ice covered"); - sprintf(output[OUT_AREAICECOV].cNeg, " "); + fvFormattedString(&output[OUT_AREAICECOV].cName, "AreaIceCov"); + fvFormattedString(&output[OUT_AREAICECOV].cDescr, "Fractional area ice covered"); + fvFormattedString(&output[OUT_AREAICECOV].cNeg, " "); output[OUT_AREAICECOV].bNeg = 1; output[OUT_AREAICECOV].iNum = 1; output[OUT_AREAICECOV].iModuleBit = POISE; fnWrite[OUT_AREAICECOV] = &WriteAreaIceCov; - sprintf(output[OUT_NORTHICECAPLAND].cName, "IceCapNorthLand"); - sprintf(output[OUT_NORTHICECAPLAND].cDescr, + fvFormattedString(&output[OUT_NORTHICECAPLAND].cName, "IceCapNorthLand"); + fvFormattedString(&output[OUT_NORTHICECAPLAND].cDescr, "Does the planet have a northern polar ice cap on land?"); output[OUT_NORTHICECAPLAND].bNeg = 0; output[OUT_NORTHICECAPLAND].iNum = 1; output[OUT_NORTHICECAPLAND].iModuleBit = POISE; fnWrite[OUT_NORTHICECAPLAND] = &WriteIceCapNorthLand; - sprintf(output[OUT_NORTHICECAPSEA].cName, "IceCapNorthSea"); - sprintf(output[OUT_NORTHICECAPSEA].cDescr, + fvFormattedString(&output[OUT_NORTHICECAPSEA].cName, "IceCapNorthSea"); + fvFormattedString(&output[OUT_NORTHICECAPSEA].cDescr, "Does the planet have a northern polar sea ice cap"); output[OUT_NORTHICECAPSEA].bNeg = 0; output[OUT_NORTHICECAPSEA].iNum = 1; output[OUT_NORTHICECAPSEA].iModuleBit = POISE; fnWrite[OUT_NORTHICECAPSEA] = &WriteIceCapNorthSea; - sprintf(output[OUT_SOUTHICECAPLAND].cName, "IceCapSouthLand"); - sprintf(output[OUT_SOUTHICECAPLAND].cDescr, + fvFormattedString(&output[OUT_SOUTHICECAPLAND].cName, "IceCapSouthLand"); + fvFormattedString(&output[OUT_SOUTHICECAPLAND].cDescr, "Does the planet have a southern polar ice cap on land?"); output[OUT_SOUTHICECAPLAND].bNeg = 0; output[OUT_SOUTHICECAPLAND].iNum = 1; output[OUT_SOUTHICECAPLAND].iModuleBit = POISE; fnWrite[OUT_SOUTHICECAPLAND] = &WriteIceCapSouthLand; - sprintf(output[OUT_SOUTHICECAPSEA].cName, "IceCapSouthSea"); - sprintf(output[OUT_SOUTHICECAPSEA].cDescr, + fvFormattedString(&output[OUT_SOUTHICECAPSEA].cName, "IceCapSouthSea"); + fvFormattedString(&output[OUT_SOUTHICECAPSEA].cDescr, "Does the planet have a southern polar sea ice cap?"); output[OUT_SOUTHICECAPSEA].bNeg = 0; output[OUT_SOUTHICECAPSEA].iNum = 1; output[OUT_SOUTHICECAPSEA].iModuleBit = POISE; fnWrite[OUT_SOUTHICECAPSEA] = &WriteIceCapSouthSea; - sprintf(output[OUT_ICEBELTLAND].cName, "IceBeltLand"); - sprintf(output[OUT_ICEBELTLAND].cDescr, + fvFormattedString(&output[OUT_ICEBELTLAND].cName, "IceBeltLand"); + fvFormattedString(&output[OUT_ICEBELTLAND].cDescr, "Does the planet have a land ice belt?"); output[OUT_ICEBELTLAND].bNeg = 0; output[OUT_ICEBELTLAND].iNum = 1; output[OUT_ICEBELTLAND].iModuleBit = POISE; fnWrite[OUT_ICEBELTLAND] = &WriteIceBeltLand; - sprintf(output[OUT_ICEBELTSEA].cName, "IceBeltSea"); - sprintf(output[OUT_ICEBELTSEA].cDescr, + fvFormattedString(&output[OUT_ICEBELTSEA].cName, "IceBeltSea"); + fvFormattedString(&output[OUT_ICEBELTSEA].cDescr, "Does the planet have a sea ice belt?"); output[OUT_ICEBELTSEA].bNeg = 0; output[OUT_ICEBELTSEA].iNum = 1; output[OUT_ICEBELTSEA].iModuleBit = POISE; fnWrite[OUT_ICEBELTSEA] = &WriteIceBeltSea; - sprintf(output[OUT_SNOWBALLLAND].cName, "SnowballLand"); - sprintf(output[OUT_SNOWBALLLAND].cDescr, "Is all land covered in ice?"); + fvFormattedString(&output[OUT_SNOWBALLLAND].cName, "SnowballLand"); + fvFormattedString(&output[OUT_SNOWBALLLAND].cDescr, "Is all land covered in ice?"); output[OUT_SNOWBALLLAND].bNeg = 0; output[OUT_SNOWBALLLAND].iNum = 1; output[OUT_SNOWBALLLAND].iModuleBit = POISE; fnWrite[OUT_SNOWBALLLAND] = &WriteSnowballLand; - sprintf(output[OUT_SNOWBALLSEA].cName, "SnowballSea"); - sprintf(output[OUT_SNOWBALLSEA].cDescr, "Is all sea covered in ice?"); + fvFormattedString(&output[OUT_SNOWBALLSEA].cName, "SnowballSea"); + fvFormattedString(&output[OUT_SNOWBALLSEA].cDescr, "Is all sea covered in ice?"); output[OUT_SNOWBALLSEA].bNeg = 0; output[OUT_SNOWBALLSEA].iNum = 1; output[OUT_SNOWBALLSEA].iModuleBit = POISE; fnWrite[OUT_SNOWBALLSEA] = &WriteSnowballSea; - sprintf(output[OUT_ICEFREE].cName, "IceFree"); - sprintf(output[OUT_ICEFREE].cDescr, + fvFormattedString(&output[OUT_ICEFREE].cName, "IceFree"); + fvFormattedString(&output[OUT_ICEFREE].cDescr, "Is the planet free of sea and land ice?"); output[OUT_ICEFREE].bNeg = 0; output[OUT_ICEFREE].iNum = 1; output[OUT_ICEFREE].iModuleBit = POISE; fnWrite[OUT_ICEFREE] = &WriteIceFree; - sprintf(output[OUT_NORTHICECAPLATLAND].cName, "IceCapNorthLatLand"); - sprintf(output[OUT_NORTHICECAPLATLAND].cDescr, + fvFormattedString(&output[OUT_NORTHICECAPLATLAND].cName, "IceCapNorthLatLand"); + fvFormattedString(&output[OUT_NORTHICECAPLATLAND].cDescr, "Southernmost extent of northern land ice cap."); output[OUT_NORTHICECAPLATLAND].bNeg = 0; output[OUT_NORTHICECAPLATLAND].iNum = 1; output[OUT_NORTHICECAPLATLAND].iModuleBit = POISE; fnWrite[OUT_NORTHICECAPLATLAND] = &WriteIceCapNorthLatLand; - sprintf(output[OUT_NORTHICECAPLATLAND].cLongDescr, + fvFormattedString(&output[OUT_NORTHICECAPLATLAND].cLongDescr, "If a northern land ice cap is present, return the latitude of its " "southern edge. If not present, return +100 degrees."); - sprintf(output[OUT_NORTHICECAPLATSEA].cName, "IceCapNorthLatSea"); - sprintf(output[OUT_NORTHICECAPLATSEA].cDescr, + fvFormattedString(&output[OUT_NORTHICECAPLATSEA].cName, "IceCapNorthLatSea"); + fvFormattedString(&output[OUT_NORTHICECAPLATSEA].cDescr, "Southernmost extent of northern sea ice cap."); output[OUT_NORTHICECAPLATSEA].bNeg = 0; output[OUT_NORTHICECAPLATSEA].iNum = 1; output[OUT_NORTHICECAPLATSEA].iModuleBit = POISE; fnWrite[OUT_NORTHICECAPLATSEA] = &WriteIceCapNorthLatSea; - sprintf(output[OUT_NORTHICECAPLATSEA].cLongDescr, + fvFormattedString(&output[OUT_NORTHICECAPLATSEA].cLongDescr, "If a northern sea ice cap is present, return the latitude of its " "southern edge. If not present, return +100 degrees."); - sprintf(output[OUT_SOUTHICECAPLATLAND].cName, "IceCapSouthLatLand"); - sprintf(output[OUT_SOUTHICECAPLATLAND].cDescr, + fvFormattedString(&output[OUT_SOUTHICECAPLATLAND].cName, "IceCapSouthLatLand"); + fvFormattedString(&output[OUT_SOUTHICECAPLATLAND].cDescr, "Northernmost extent of southern land ice cap."); output[OUT_SOUTHICECAPLATLAND].bNeg = 0; output[OUT_SOUTHICECAPLATLAND].iNum = 1; output[OUT_SOUTHICECAPLATLAND].iModuleBit = POISE; fnWrite[OUT_SOUTHICECAPLATLAND] = &WriteIceCapSouthLatLand; - sprintf(output[OUT_SOUTHICECAPLATLAND].cLongDescr, + fvFormattedString(&output[OUT_SOUTHICECAPLATLAND].cLongDescr, "If a southern land ice cap is present, return the latitude of its " "northern edge. If not present, return -100 degrees."); - sprintf(output[OUT_SOUTHICECAPLATSEA].cName, "IceCapSouthLatSea"); - sprintf(output[OUT_SOUTHICECAPLATSEA].cDescr, + fvFormattedString(&output[OUT_SOUTHICECAPLATSEA].cName, "IceCapSouthLatSea"); + fvFormattedString(&output[OUT_SOUTHICECAPLATSEA].cDescr, "Northernmost extent of southern sea ice cap."); output[OUT_SOUTHICECAPLATSEA].bNeg = 0; output[OUT_SOUTHICECAPLATSEA].iNum = 1; output[OUT_SOUTHICECAPLATSEA].iModuleBit = POISE; fnWrite[OUT_SOUTHICECAPLATSEA] = &WriteIceCapSouthLatLand; - sprintf(output[OUT_SOUTHICECAPLATSEA].cLongDescr, + fvFormattedString(&output[OUT_SOUTHICECAPLATSEA].cLongDescr, "If a southern sea ice cap is present, return the latitude of its " "northern edge. If not present, return -100 degrees."); - sprintf(output[OUT_NORTHICEBELTLATLAND].cName, "IceBeltNorthLatLand"); - sprintf(output[OUT_NORTHICEBELTLATLAND].cDescr, + fvFormattedString(&output[OUT_NORTHICEBELTLATLAND].cName, "IceBeltNorthLatLand"); + fvFormattedString(&output[OUT_NORTHICEBELTLATLAND].cDescr, "Northernmost extent of land ice belt."); output[OUT_NORTHICEBELTLATLAND].bNeg = 0; output[OUT_NORTHICEBELTLATLAND].iNum = 1; output[OUT_NORTHICEBELTLATLAND].iModuleBit = POISE; fnWrite[OUT_NORTHICEBELTLATLAND] = &WriteIceBeltNorthLatLand; - sprintf( - output[OUT_NORTHICEBELTLATLAND].cLongDescr, + fvFormattedString( + &output[OUT_NORTHICEBELTLATLAND].cLongDescr, "If a land ice belt is present, return the latitude of its northern " "edge. " "If not present, return 0. Note that some ice belts may in fact have a " "northern edge at the equator."); - sprintf(output[OUT_NORTHICEBELTLATSEA].cName, "IceBeltNorthLatSea"); - sprintf(output[OUT_NORTHICEBELTLATSEA].cDescr, + fvFormattedString(&output[OUT_NORTHICEBELTLATSEA].cName, "IceBeltNorthLatSea"); + fvFormattedString(&output[OUT_NORTHICEBELTLATSEA].cDescr, "Northernmost extent of sea ice belt."); output[OUT_NORTHICEBELTLATSEA].bNeg = 0; output[OUT_NORTHICEBELTLATSEA].iNum = 1; output[OUT_NORTHICEBELTLATSEA].iModuleBit = POISE; fnWrite[OUT_NORTHICEBELTLATSEA] = &WriteIceBeltNorthLatSea; - sprintf( - output[OUT_NORTHICEBELTLATSEA].cLongDescr, + fvFormattedString( + &output[OUT_NORTHICEBELTLATSEA].cLongDescr, "If a sea ice belt is present, return the latitude of its northern " "edge. " "If not present, return 0. Note that some ice belts may in fact have a " "northern edge at the equator."); - sprintf(output[OUT_SOUTHICEBELTLATLAND].cName, "IceBeltSouthLatLand"); - sprintf(output[OUT_SOUTHICEBELTLATLAND].cDescr, + fvFormattedString(&output[OUT_SOUTHICEBELTLATLAND].cName, "IceBeltSouthLatLand"); + fvFormattedString(&output[OUT_SOUTHICEBELTLATLAND].cDescr, "Southernmost extent of land ice belt."); output[OUT_SOUTHICEBELTLATLAND].bNeg = 0; output[OUT_SOUTHICEBELTLATLAND].iNum = 1; output[OUT_SOUTHICEBELTLATLAND].iModuleBit = POISE; fnWrite[OUT_SOUTHICEBELTLATLAND] = &WriteIceBeltSouthLatLand; - sprintf( - output[OUT_SOUTHICEBELTLATLAND].cLongDescr, + fvFormattedString( + &output[OUT_SOUTHICEBELTLATLAND].cLongDescr, "If a land ice belt is present, return the latitude of its southern " "edge. " "If not present, return 0. Note that some ice belts may in fact have a " "southern edge at the equator."); - sprintf(output[OUT_SOUTHICEBELTLATSEA].cName, "IceBeltSouthLatSea"); - sprintf(output[OUT_SOUTHICEBELTLATSEA].cDescr, + fvFormattedString(&output[OUT_SOUTHICEBELTLATSEA].cName, "IceBeltSouthLatSea"); + fvFormattedString(&output[OUT_SOUTHICEBELTLATSEA].cDescr, "Southernmost extent of sea ice belt."); output[OUT_SOUTHICEBELTLATSEA].bNeg = 0; output[OUT_SOUTHICEBELTLATSEA].iNum = 1; output[OUT_SOUTHICEBELTLATSEA].iModuleBit = POISE; fnWrite[OUT_SOUTHICEBELTLATSEA] = &WriteIceBeltSouthLatSea; - sprintf( - output[OUT_SOUTHICEBELTLATSEA].cLongDescr, + fvFormattedString( + &output[OUT_SOUTHICEBELTLATSEA].cLongDescr, "If a sea ice belt is present, return the latitude of its southern " "edge. " "If not present, return 0. Note that some ice belts may in fact have a " diff --git a/src/poise.h b/src/poise.h index ed3931494..2e028c21e 100644 --- a/src/poise.h +++ b/src/poise.h @@ -209,39 +209,39 @@ void FinalizeUpdateIceMassPoise(BODY *, UPDATE *, int *, int, int, int); void HelpOutputPoise(OUTPUT *); void WriteTGlobal(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, UPDATE *, int, - double *, char[]); + double *, char**); void WriteAlbedoGlobal(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, UPDATE *, - int, double *, char[]); + int, double *, char**); void WriteTempLat(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, UPDATE *, int, - double *, char[]); + double *, char**); void WriteTempMinLW(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, UPDATE *, - int, double *, char[]); + int, double *, char**); void WriteTempMaxLW(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, UPDATE *, - int, double *, char[]); + int, double *, char**); void WriteAlbedoLat(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, UPDATE *, - int, double *, char[]); + int, double *, char**); void WriteAnnualInsol(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, UPDATE *, - int, double *, char[]); + int, double *, char**); void WriteDailyInsol(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, UPDATE *, - int, double *, char[]); + int, double *, char**); void WritePlanckB(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, UPDATE *, int, - double *, char[]); + double *, char**); void WritePlanckBAvg(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, UPDATE *, - int, double *, char[]); + int, double *, char**); void WriteSeasonalTemp(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, UPDATE *, - int, double *, char[]); + int, double *, char**); void WriteSeasonalFluxes(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, - UPDATE *, int, double *, char[]); + UPDATE *, int, double *, char**); void WriteSeasonalIceBalance(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, - UPDATE *, int, double *, char[]); + UPDATE *, int, double *, char**); void WriteFluxMerid(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, UPDATE *, - int, double *, char[]); + int, double *, char**); void WriteFluxIn(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, UPDATE *, int, - double *, char[]); + double *, char**); void WriteFluxOut(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, UPDATE *, int, - double *, char[]); + double *, char**); void WriteDivFlux(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, UPDATE *, int, - double *, char[]); + double *, char**); void InitializeOutputPoise(OUTPUT *, fnWriteOutput[]); /* Logging Functions */ diff --git a/src/radheat.c b/src/radheat.c index 27381ddf4..0612b205e 100644 --- a/src/radheat.c +++ b/src/radheat.c @@ -1769,553 +1769,553 @@ void fvReadHaltRadPower(BODY *body, CONTROL *control, FILES *files, void fvInitializeOptionsRadheat(OPTIONS *options, fnReadOption fnRead[]) { /* 26Al */ - sprintf(options[OPT_26ALMASSMAN].cName, "d26AlMassMan"); - sprintf(options[OPT_26ALMASSMAN].cDescr, "Initial Mantle Mass of 26Al"); - sprintf(options[OPT_26ALMASSMAN].cDefault, "0"); - sprintf(options[OPT_26ALMASSMAN].cDimension, "mass"); + fvFormattedString(&options[OPT_26ALMASSMAN].cName, "d26AlMassMan"); + fvFormattedString(&options[OPT_26ALMASSMAN].cDescr, "Initial Mantle Mass of 26Al"); + fvFormattedString(&options[OPT_26ALMASSMAN].cDefault, "0"); + fvFormattedString(&options[OPT_26ALMASSMAN].cDimension, "mass"); options[OPT_26ALMASSMAN].iType = 2; options[OPT_26ALMASSMAN].bMultiFile = 1; options[OPT_26ALMASSMAN].dNeg = MEARTH; options[OPT_26ALMASSMAN].dDefault = 0; - sprintf(options[OPT_26ALMASSMAN].cNeg, "Mearth"); + fvFormattedString(&options[OPT_26ALMASSMAN].cNeg, "Mearth"); fnRead[OPT_26ALMASSMAN] = &fvRead26AlMassMan; - sprintf(options[OPT_26ALMASSCORE].cName, "d26AlMassCore"); - sprintf(options[OPT_26ALMASSCORE].cDescr, "Initial Core Mass of 26Al"); - sprintf(options[OPT_26ALMASSCORE].cDefault, "0"); - sprintf(options[OPT_26ALMASSCORE].cDimension, "mass"); + fvFormattedString(&options[OPT_26ALMASSCORE].cName, "d26AlMassCore"); + fvFormattedString(&options[OPT_26ALMASSCORE].cDescr, "Initial Core Mass of 26Al"); + fvFormattedString(&options[OPT_26ALMASSCORE].cDefault, "0"); + fvFormattedString(&options[OPT_26ALMASSCORE].cDimension, "mass"); options[OPT_26ALMASSCORE].iType = 2; options[OPT_26ALMASSCORE].bMultiFile = 1; options[OPT_26ALMASSCORE].dNeg = MEARTH; options[OPT_26ALMASSCORE].dDefault = 0; - sprintf(options[OPT_26ALMASSCORE].cNeg, "Mearth"); + fvFormattedString(&options[OPT_26ALMASSCORE].cNeg, "Mearth"); fnRead[OPT_26ALMASSCORE] = &fvRead26AlMassCore; - sprintf(options[OPT_26ALNUMMAN].cName, "d26AlNumMan"); - sprintf(options[OPT_26ALNUMMAN].cDescr, + fvFormattedString(&options[OPT_26ALNUMMAN].cName, "d26AlNumMan"); + fvFormattedString(&options[OPT_26ALNUMMAN].cDescr, "Initial Mantle Number of 26Al Atoms"); - sprintf(options[OPT_26ALNUMMAN].cDefault, "0"); - sprintf(options[OPT_26ALNUMMAN].cDimension, "mass"); + fvFormattedString(&options[OPT_26ALNUMMAN].cDefault, "0"); + fvFormattedString(&options[OPT_26ALNUMMAN].cDimension, "mass"); options[OPT_26ALNUMMAN].iType = 2; options[OPT_26ALNUMMAN].bMultiFile = 1; options[OPT_26ALNUMMAN].dNeg = ENUMMAN26AL; options[OPT_26ALNUMMAN].dDefault = 0; - sprintf(options[OPT_26ALNUMMAN].cNeg, "Primordial Earth 26Al Number"); + fvFormattedString(&options[OPT_26ALNUMMAN].cNeg, "Primordial Earth 26Al Number"); fnRead[OPT_26ALNUMMAN] = &fvRead26AlNumMan; - sprintf(options[OPT_26ALNUMCORE].cName, "d26AlNumCore"); - sprintf(options[OPT_26ALNUMCORE].cDescr, "Initial Core Number of 26Al Atoms"); - sprintf(options[OPT_26ALNUMCORE].cDefault, "0"); - sprintf(options[OPT_26ALNUMCORE].cDimension, "nd"); + fvFormattedString(&options[OPT_26ALNUMCORE].cName, "d26AlNumCore"); + fvFormattedString(&options[OPT_26ALNUMCORE].cDescr, "Initial Core Number of 26Al Atoms"); + fvFormattedString(&options[OPT_26ALNUMCORE].cDefault, "0"); + fvFormattedString(&options[OPT_26ALNUMCORE].cDimension, "nd"); options[OPT_26ALNUMCORE].iType = 2; options[OPT_26ALNUMCORE].bMultiFile = 1; options[OPT_26ALNUMCORE].dNeg = ENUMCORE26AL; options[OPT_26ALNUMCORE].dDefault = 0; - sprintf(options[OPT_26ALNUMCORE].cNeg, "Primordial Earth 26Al Number"); + fvFormattedString(&options[OPT_26ALNUMCORE].cNeg, "Primordial Earth 26Al Number"); fnRead[OPT_26ALNUMCORE] = &fvRead26AlNumCore; - sprintf(options[OPT_26ALPOWERMAN].cName, "d26AlPowerMan"); - sprintf(options[OPT_26ALPOWERMAN].cDescr, + fvFormattedString(&options[OPT_26ALPOWERMAN].cName, "d26AlPowerMan"); + fvFormattedString(&options[OPT_26ALPOWERMAN].cDescr, "Initial Mantle Power Production from 26Al Atoms"); - sprintf(options[OPT_26ALPOWERMAN].cDefault, "0"); - sprintf(options[OPT_26ALPOWERMAN].cDimension, "energy/time"); + fvFormattedString(&options[OPT_26ALPOWERMAN].cDefault, "0"); + fvFormattedString(&options[OPT_26ALPOWERMAN].cDimension, "energy/time"); options[OPT_26ALPOWERMAN].iType = 2; options[OPT_26ALPOWERMAN].bMultiFile = 1; options[OPT_26ALPOWERMAN].dNeg = EPOWERMAN26AL; // Earth's POWER of 26Al options[OPT_26ALPOWERMAN].dDefault = 0; - sprintf(options[OPT_26ALPOWERMAN].cNeg, "TW"); + fvFormattedString(&options[OPT_26ALPOWERMAN].cNeg, "TW"); fnRead[OPT_26ALPOWERMAN] = &fvRead26AlPowerMan; - sprintf(options[OPT_26ALPOWERCORE].cName, "d26AlPowerCore"); - sprintf(options[OPT_26ALPOWERCORE].cDescr, + fvFormattedString(&options[OPT_26ALPOWERCORE].cName, "d26AlPowerCore"); + fvFormattedString(&options[OPT_26ALPOWERCORE].cDescr, "Initial Core Power Production from 26Al Atoms"); - sprintf(options[OPT_26ALPOWERCORE].cDefault, "0"); - sprintf(options[OPT_26ALPOWERCORE].cDimension, "energy/time"); + fvFormattedString(&options[OPT_26ALPOWERCORE].cDefault, "0"); + fvFormattedString(&options[OPT_26ALPOWERCORE].cDimension, "energy/time"); options[OPT_26ALPOWERCORE].iType = 2; options[OPT_26ALPOWERCORE].bMultiFile = 1; options[OPT_26ALPOWERCORE].dNeg = EPOWERCORE26AL; // Earth's POWER of 26Al options[OPT_26ALPOWERCORE].dDefault = 0; - sprintf(options[OPT_26ALPOWERCORE].cNeg, "TW"); + fvFormattedString(&options[OPT_26ALPOWERCORE].cNeg, "TW"); fnRead[OPT_26ALPOWERCORE] = &fvRead26AlPowerCore; /* 40K */ - sprintf(options[OPT_40KMASSMAN].cName, "d40KMassMan"); - sprintf(options[OPT_40KMASSMAN].cDescr, "Initial Mantle Mass of 40K"); - sprintf(options[OPT_40KMASSMAN].cDefault, "Primordial Earth"); - sprintf(options[OPT_40KMASSMAN].cDimension, "mass"); + fvFormattedString(&options[OPT_40KMASSMAN].cName, "d40KMassMan"); + fvFormattedString(&options[OPT_40KMASSMAN].cDescr, "Initial Mantle Mass of 40K"); + fvFormattedString(&options[OPT_40KMASSMAN].cDefault, "Primordial Earth"); + fvFormattedString(&options[OPT_40KMASSMAN].cDimension, "mass"); options[OPT_40KMASSMAN].iType = 2; options[OPT_40KMASSMAN].bMultiFile = 1; options[OPT_40KMASSMAN].dNeg = EMASSMAN40K; options[OPT_40KMASSMAN].dDefault = EMASSMAN40K; - sprintf(options[OPT_40KMASSMAN].cNeg, "Primordial Earth Units"); + fvFormattedString(&options[OPT_40KMASSMAN].cNeg, "Primordial Earth Units"); fnRead[OPT_40KMASSMAN] = &fvRead40KMassMan; - sprintf(options[OPT_40KMASSCORE].cName, "d40KMassCore"); - sprintf(options[OPT_40KMASSCORE].cDescr, "Initial Core Mass of 40K"); - sprintf(options[OPT_40KMASSCORE].cDefault, "Primordial Earth Units"); - sprintf(options[OPT_40KMASSCORE].cDimension, "mass"); + fvFormattedString(&options[OPT_40KMASSCORE].cName, "d40KMassCore"); + fvFormattedString(&options[OPT_40KMASSCORE].cDescr, "Initial Core Mass of 40K"); + fvFormattedString(&options[OPT_40KMASSCORE].cDefault, "Primordial Earth Units"); + fvFormattedString(&options[OPT_40KMASSCORE].cDimension, "mass"); options[OPT_40KMASSCORE].iType = 2; options[OPT_40KMASSCORE].bMultiFile = 1; options[OPT_40KMASSCORE].dNeg = EMASSCORE40K; options[OPT_40KMASSCORE].dDefault = EMASSCORE40K; - sprintf(options[OPT_40KMASSCORE].cNeg, "Primordial Earth"); + fvFormattedString(&options[OPT_40KMASSCORE].cNeg, "Primordial Earth"); fnRead[OPT_40KMASSCORE] = &fvRead40KMassCore; - sprintf(options[OPT_40KMASSCRUST].cName, "d40KMassCrust"); - sprintf(options[OPT_40KMASSCRUST].cDescr, "Initial Crust Mass of 40K"); - sprintf(options[OPT_40KMASSCRUST].cDefault, "Primordial Earth"); - sprintf(options[OPT_40KMASSCRUST].cDimension, "mass"); + fvFormattedString(&options[OPT_40KMASSCRUST].cName, "d40KMassCrust"); + fvFormattedString(&options[OPT_40KMASSCRUST].cDescr, "Initial Crust Mass of 40K"); + fvFormattedString(&options[OPT_40KMASSCRUST].cDefault, "Primordial Earth"); + fvFormattedString(&options[OPT_40KMASSCRUST].cDimension, "mass"); options[OPT_40KMASSCRUST].iType = 2; options[OPT_40KMASSCRUST].bMultiFile = 1; options[OPT_40KMASSCRUST].dNeg = EMASSCRUST40K; options[OPT_40KMASSCRUST].dDefault = EMASSCRUST40K; - sprintf(options[OPT_40KMASSCRUST].cNeg, "Primordial Earth Units"); + fvFormattedString(&options[OPT_40KMASSCRUST].cNeg, "Primordial Earth Units"); fnRead[OPT_40KMASSCRUST] = &fvRead40KMassCrust; - sprintf(options[OPT_40KNUMMAN].cName, "d40KNumMan"); - sprintf(options[OPT_40KNUMMAN].cDescr, "Initial Mantle Number of 40K Atoms"); - sprintf(options[OPT_40KNUMMAN].cDefault, "Primordial Earth"); - sprintf(options[OPT_40KNUMMAN].cDimension, "nd"); + fvFormattedString(&options[OPT_40KNUMMAN].cName, "d40KNumMan"); + fvFormattedString(&options[OPT_40KNUMMAN].cDescr, "Initial Mantle Number of 40K Atoms"); + fvFormattedString(&options[OPT_40KNUMMAN].cDefault, "Primordial Earth"); + fvFormattedString(&options[OPT_40KNUMMAN].cDimension, "nd"); options[OPT_40KNUMMAN].iType = 2; options[OPT_40KNUMMAN].bMultiFile = 1; options[OPT_40KNUMMAN].dNeg = ENUMMAN40K; options[OPT_40KNUMMAN].dDefault = ENUMMAN40K; - sprintf(options[OPT_40KNUMMAN].cNeg, "Primordial Earth Units"); + fvFormattedString(&options[OPT_40KNUMMAN].cNeg, "Primordial Earth Units"); fnRead[OPT_40KNUMMAN] = &fvRead40KNumMan; - sprintf(options[OPT_40KNUMCORE].cName, "d40KNumCore"); - sprintf(options[OPT_40KNUMCORE].cDescr, "Initial Core Number of 40K Atoms"); - sprintf(options[OPT_40KNUMCORE].cDefault, "Primordial Earth"); - sprintf(options[OPT_40KNUMCORE].cDimension, "nd"); + fvFormattedString(&options[OPT_40KNUMCORE].cName, "d40KNumCore"); + fvFormattedString(&options[OPT_40KNUMCORE].cDescr, "Initial Core Number of 40K Atoms"); + fvFormattedString(&options[OPT_40KNUMCORE].cDefault, "Primordial Earth"); + fvFormattedString(&options[OPT_40KNUMCORE].cDimension, "nd"); options[OPT_40KNUMCORE].iType = 2; options[OPT_40KNUMCORE].bMultiFile = 1; options[OPT_40KNUMCORE].dNeg = ENUMCORE40K; options[OPT_40KNUMCORE].dDefault = ENUMCORE40K; - sprintf(options[OPT_40KNUMCORE].cNeg, "Primordial Earth Units"); + fvFormattedString(&options[OPT_40KNUMCORE].cNeg, "Primordial Earth Units"); fnRead[OPT_40KNUMCORE] = &fvRead40KNumCore; - sprintf(options[OPT_40KNUMCRUST].cName, "d40KNumCrust"); - sprintf(options[OPT_40KNUMCRUST].cDescr, "Initial Crust Number of 40K Atoms"); - sprintf(options[OPT_40KNUMCRUST].cDefault, "Primordial Earth"); - sprintf(options[OPT_40KNUMCRUST].cDimension, "nd"); + fvFormattedString(&options[OPT_40KNUMCRUST].cName, "d40KNumCrust"); + fvFormattedString(&options[OPT_40KNUMCRUST].cDescr, "Initial Crust Number of 40K Atoms"); + fvFormattedString(&options[OPT_40KNUMCRUST].cDefault, "Primordial Earth"); + fvFormattedString(&options[OPT_40KNUMCRUST].cDimension, "nd"); options[OPT_40KNUMCRUST].iType = 2; options[OPT_40KNUMCRUST].bMultiFile = 1; options[OPT_40KNUMCRUST].dNeg = ENUMCRUST40K; options[OPT_40KNUMCRUST].dDefault = ENUMCRUST40K; - sprintf(options[OPT_40KNUMCRUST].cNeg, "Primordial Earth Units"); + fvFormattedString(&options[OPT_40KNUMCRUST].cNeg, "Primordial Earth Units"); fnRead[OPT_40KNUMCRUST] = &fvRead40KNumCrust; - sprintf(options[OPT_40KPOWERMAN].cName, "d40KPowerMan"); - sprintf(options[OPT_40KPOWERMAN].cDescr, + fvFormattedString(&options[OPT_40KPOWERMAN].cName, "d40KPowerMan"); + fvFormattedString(&options[OPT_40KPOWERMAN].cDescr, "Initial Mantle Power Production from 40K Atoms"); - sprintf(options[OPT_40KPOWERMAN].cDefault, "Primordial Earth"); - sprintf(options[OPT_40KPOWERMAN].cDimension, "energy/time"); + fvFormattedString(&options[OPT_40KPOWERMAN].cDefault, "Primordial Earth"); + fvFormattedString(&options[OPT_40KPOWERMAN].cDimension, "energy/time"); options[OPT_40KPOWERMAN].iType = 2; options[OPT_40KPOWERMAN].bMultiFile = 1; options[OPT_40KPOWERMAN].dNeg = EPOWERMAN40K; // Earth's POWER of 40K options[OPT_40KPOWERMAN].dDefault = EPOWERMAN40K; - sprintf(options[OPT_40KPOWERMAN].cNeg, "Primordial Earth Units"); + fvFormattedString(&options[OPT_40KPOWERMAN].cNeg, "Primordial Earth Units"); fnRead[OPT_40KPOWERMAN] = &fvRead40KPowerMan; - sprintf(options[OPT_40KPOWERCORE].cName, "d40KPowerCore"); - sprintf(options[OPT_40KPOWERCORE].cDescr, + fvFormattedString(&options[OPT_40KPOWERCORE].cName, "d40KPowerCore"); + fvFormattedString(&options[OPT_40KPOWERCORE].cDescr, "Initial Core Power Production from 40K Atoms"); - sprintf(options[OPT_40KPOWERCORE].cDefault, "Primordial Earth"); - sprintf(options[OPT_40KPOWERCORE].cDimension, "energy/time"); + fvFormattedString(&options[OPT_40KPOWERCORE].cDefault, "Primordial Earth"); + fvFormattedString(&options[OPT_40KPOWERCORE].cDimension, "energy/time"); options[OPT_40KPOWERCORE].iType = 2; options[OPT_40KPOWERCORE].bMultiFile = 1; options[OPT_40KPOWERCORE].dNeg = EPOWERCORE40K; // Earth's POWER of 40K options[OPT_40KPOWERCORE].dDefault = EPOWERCORE40K; - sprintf(options[OPT_40KPOWERCORE].cNeg, "Primordial Earth Units"); + fvFormattedString(&options[OPT_40KPOWERCORE].cNeg, "Primordial Earth Units"); fnRead[OPT_40KPOWERCORE] = &fvRead40KPowerCore; - sprintf(options[OPT_40KPOWERCRUST].cName, "d40KPowerCrust"); - sprintf(options[OPT_40KPOWERCRUST].cDescr, + fvFormattedString(&options[OPT_40KPOWERCRUST].cName, "d40KPowerCrust"); + fvFormattedString(&options[OPT_40KPOWERCRUST].cDescr, "Initial Crust Power Production from 40K Atoms"); - sprintf(options[OPT_40KPOWERCRUST].cDefault, "Primordial Earth"); - sprintf(options[OPT_40KPOWERCRUST].cDimension, "energy/time"); + fvFormattedString(&options[OPT_40KPOWERCRUST].cDefault, "Primordial Earth"); + fvFormattedString(&options[OPT_40KPOWERCRUST].cDimension, "energy/time"); options[OPT_40KPOWERCRUST].iType = 2; options[OPT_40KPOWERCRUST].bMultiFile = 1; options[OPT_40KPOWERCRUST].dNeg = EPOWERCRUST40K; // Earth's POWER of 40K options[OPT_40KPOWERCRUST].dDefault = EPOWERCRUST40K; - sprintf(options[OPT_40KPOWERCRUST].cNeg, "Primordial Earth Units"); + fvFormattedString(&options[OPT_40KPOWERCRUST].cNeg, "Primordial Earth Units"); fnRead[OPT_40KPOWERCRUST] = &fvRead40KPowerCrust; /* 232Th */ - sprintf(options[OPT_232THMASSMAN].cName, "d232ThMassMan"); - sprintf(options[OPT_232THMASSMAN].cDescr, "Initial Mass of 232Th"); - sprintf(options[OPT_232THMASSMAN].cDefault, "Primordial Earth"); - sprintf(options[OPT_232THMASSMAN].cDimension, "mass"); + fvFormattedString(&options[OPT_232THMASSMAN].cName, "d232ThMassMan"); + fvFormattedString(&options[OPT_232THMASSMAN].cDescr, "Initial Mass of 232Th"); + fvFormattedString(&options[OPT_232THMASSMAN].cDefault, "Primordial Earth"); + fvFormattedString(&options[OPT_232THMASSMAN].cDimension, "mass"); options[OPT_232THMASSMAN].iType = 2; options[OPT_232THMASSMAN].bMultiFile = 1; options[OPT_232THMASSMAN].dNeg = EMASSMAN232TH; options[OPT_232THMASSMAN].dDefault = EMASSMAN232TH; - sprintf(options[OPT_232THMASSMAN].cNeg, "Primordial Earth Units"); + fvFormattedString(&options[OPT_232THMASSMAN].cNeg, "Primordial Earth Units"); fnRead[OPT_232THMASSMAN] = &fvRead232ThMassMan; - sprintf(options[OPT_232THNUMMAN].cName, "d232ThNumMan"); - sprintf(options[OPT_232THNUMMAN].cDescr, "Initial Number of 232Th Atoms"); - sprintf(options[OPT_232THNUMMAN].cDefault, "Primordial Earth"); - sprintf(options[OPT_232THNUMMAN].cDimension, "nd"); + fvFormattedString(&options[OPT_232THNUMMAN].cName, "d232ThNumMan"); + fvFormattedString(&options[OPT_232THNUMMAN].cDescr, "Initial Number of 232Th Atoms"); + fvFormattedString(&options[OPT_232THNUMMAN].cDefault, "Primordial Earth"); + fvFormattedString(&options[OPT_232THNUMMAN].cDimension, "nd"); options[OPT_232THNUMMAN].iType = 2; options[OPT_232THNUMMAN].bMultiFile = 1; options[OPT_232THNUMMAN].dNeg = ENUMMAN232TH; options[OPT_232THNUMMAN].dDefault = ENUMMAN232TH; - sprintf(options[OPT_232THNUMMAN].cNeg, "Primordial Earth Units"); + fvFormattedString(&options[OPT_232THNUMMAN].cNeg, "Primordial Earth Units"); fnRead[OPT_232THNUMMAN] = &fvRead232ThNumMan; - sprintf(options[OPT_232THPOWERMAN].cName, "d232ThPowerMan"); - sprintf(options[OPT_232THPOWERMAN].cDescr, + fvFormattedString(&options[OPT_232THPOWERMAN].cName, "d232ThPowerMan"); + fvFormattedString(&options[OPT_232THPOWERMAN].cDescr, "Initial Power Production from 232Th Atoms"); - sprintf(options[OPT_232THPOWERMAN].cDefault, "Primordial Earth"); - sprintf(options[OPT_232THPOWERMAN].cDimension, "energy/time"); + fvFormattedString(&options[OPT_232THPOWERMAN].cDefault, "Primordial Earth"); + fvFormattedString(&options[OPT_232THPOWERMAN].cDimension, "energy/time"); options[OPT_232THPOWERMAN].iType = 2; options[OPT_232THPOWERMAN].bMultiFile = 1; options[OPT_232THPOWERMAN].dNeg = EPOWERMAN232TH; // 1e12*1e-7; // cgs options[OPT_232THPOWERMAN].dDefault = EPOWERMAN232TH; - sprintf(options[OPT_232THPOWERMAN].cNeg, "Primordial Earth Units"); + fvFormattedString(&options[OPT_232THPOWERMAN].cNeg, "Primordial Earth Units"); fnRead[OPT_232THPOWERMAN] = &fvRead232ThPowerMan; - sprintf(options[OPT_232THMASSCORE].cName, "d232ThMassCore"); - sprintf(options[OPT_232THMASSCORE].cDescr, "Initial Core Mass of 232Th"); - sprintf(options[OPT_232THMASSCORE].cDefault, "Primordial Earth"); - sprintf(options[OPT_232THMASSCORE].cDimension, "mass"); + fvFormattedString(&options[OPT_232THMASSCORE].cName, "d232ThMassCore"); + fvFormattedString(&options[OPT_232THMASSCORE].cDescr, "Initial Core Mass of 232Th"); + fvFormattedString(&options[OPT_232THMASSCORE].cDefault, "Primordial Earth"); + fvFormattedString(&options[OPT_232THMASSCORE].cDimension, "mass"); options[OPT_232THMASSCORE].iType = 2; options[OPT_232THMASSCORE].bMultiFile = 1; options[OPT_232THMASSCORE].dNeg = EMASSCORE232TH; options[OPT_232THMASSCORE].dDefault = EMASSCORE232TH; - sprintf(options[OPT_232THMASSCORE].cNeg, "Primordial Earth Units"); + fvFormattedString(&options[OPT_232THMASSCORE].cNeg, "Primordial Earth Units"); fnRead[OPT_232THMASSCORE] = &fvRead232ThMassCore; - sprintf(options[OPT_232THNUMCORE].cName, "d232ThNumCore"); - sprintf(options[OPT_232THNUMCORE].cDescr, + fvFormattedString(&options[OPT_232THNUMCORE].cName, "d232ThNumCore"); + fvFormattedString(&options[OPT_232THNUMCORE].cDescr, "Initial Core Number of 232Th Atoms"); - sprintf(options[OPT_232THNUMCORE].cDefault, "Primordial Earth"); - sprintf(options[OPT_232THNUMCORE].cDimension, "nd"); + fvFormattedString(&options[OPT_232THNUMCORE].cDefault, "Primordial Earth"); + fvFormattedString(&options[OPT_232THNUMCORE].cDimension, "nd"); options[OPT_232THNUMCORE].iType = 2; options[OPT_232THNUMCORE].bMultiFile = 1; options[OPT_232THNUMCORE].dNeg = ENUMCORE232TH; options[OPT_232THNUMCORE].dDefault = ENUMCORE232TH; - sprintf(options[OPT_232THNUMCORE].cNeg, "Primordial Earth Units"); + fvFormattedString(&options[OPT_232THNUMCORE].cNeg, "Primordial Earth Units"); fnRead[OPT_232THNUMCORE] = &fvRead232ThNumCore; - sprintf(options[OPT_232THPOWERCORE].cName, "d232ThPowerCore"); - sprintf(options[OPT_232THPOWERCORE].cDescr, + fvFormattedString(&options[OPT_232THPOWERCORE].cName, "d232ThPowerCore"); + fvFormattedString(&options[OPT_232THPOWERCORE].cDescr, "Initial Core Power Production from 232Th Atoms"); - sprintf(options[OPT_232THPOWERCORE].cDefault, "Primordial Earth"); - sprintf(options[OPT_232THPOWERCORE].cDimension, "energy/time"); + fvFormattedString(&options[OPT_232THPOWERCORE].cDefault, "Primordial Earth"); + fvFormattedString(&options[OPT_232THPOWERCORE].cDimension, "energy/time"); options[OPT_232THPOWERCORE].iType = 2; options[OPT_232THPOWERCORE].bMultiFile = 1; options[OPT_232THPOWERCORE].dNeg = EPOWERCORE232TH; // 1e12*1e-7; // cgs options[OPT_232THPOWERCORE].dDefault = EPOWERCORE232TH; - sprintf(options[OPT_232THPOWERCORE].cNeg, "Primordial Earth Units"); + fvFormattedString(&options[OPT_232THPOWERCORE].cNeg, "Primordial Earth Units"); fnRead[OPT_232THPOWERCORE] = &fvRead232ThPowerCore; - sprintf(options[OPT_232THMASSCRUST].cName, "d232ThMassCrust"); - sprintf(options[OPT_232THMASSCRUST].cDescr, "Initial Crust Mass of 232Th"); - sprintf(options[OPT_232THMASSCRUST].cDefault, "Primordial Earth"); - sprintf(options[OPT_232THMASSCRUST].cDimension, "mass"); + fvFormattedString(&options[OPT_232THMASSCRUST].cName, "d232ThMassCrust"); + fvFormattedString(&options[OPT_232THMASSCRUST].cDescr, "Initial Crust Mass of 232Th"); + fvFormattedString(&options[OPT_232THMASSCRUST].cDefault, "Primordial Earth"); + fvFormattedString(&options[OPT_232THMASSCRUST].cDimension, "mass"); options[OPT_232THMASSCRUST].iType = 2; options[OPT_232THMASSCRUST].bMultiFile = 1; options[OPT_232THMASSCRUST].dNeg = EMASSCRUST232TH; options[OPT_232THMASSCRUST].dDefault = EMASSCRUST232TH; - sprintf(options[OPT_232THMASSCRUST].cNeg, "Primordial Earth Units"); + fvFormattedString(&options[OPT_232THMASSCRUST].cNeg, "Primordial Earth Units"); fnRead[OPT_232THMASSCRUST] = &fvRead232ThMassCrust; - sprintf(options[OPT_232THNUMCRUST].cName, "d232ThNumCrust"); - sprintf(options[OPT_232THNUMCRUST].cDescr, + fvFormattedString(&options[OPT_232THNUMCRUST].cName, "d232ThNumCrust"); + fvFormattedString(&options[OPT_232THNUMCRUST].cDescr, "Initial Crust Number of 232Th Atoms"); - sprintf(options[OPT_232THNUMCRUST].cDefault, "Primordial Earth"); - sprintf(options[OPT_232THNUMCRUST].cDimension, "nd"); + fvFormattedString(&options[OPT_232THNUMCRUST].cDefault, "Primordial Earth"); + fvFormattedString(&options[OPT_232THNUMCRUST].cDimension, "nd"); options[OPT_232THNUMCRUST].iType = 2; options[OPT_232THNUMCRUST].bMultiFile = 1; options[OPT_232THNUMCRUST].dNeg = ENUMCRUST232TH; options[OPT_232THNUMCRUST].dDefault = ENUMCRUST232TH; - sprintf(options[OPT_232THNUMCRUST].cNeg, "Primordial Earth Units"); + fvFormattedString(&options[OPT_232THNUMCRUST].cNeg, "Primordial Earth Units"); fnRead[OPT_232THNUMCRUST] = &fvRead232ThNumCrust; - sprintf(options[OPT_232THPOWERCRUST].cName, "d232ThPowerCrust"); - sprintf(options[OPT_232THPOWERCRUST].cDescr, + fvFormattedString(&options[OPT_232THPOWERCRUST].cName, "d232ThPowerCrust"); + fvFormattedString(&options[OPT_232THPOWERCRUST].cDescr, "Initial Crust Power Production from 232Th Atoms"); - sprintf(options[OPT_232THPOWERCRUST].cDefault, "Primordial Earth"); - sprintf(options[OPT_232THPOWERCRUST].cDimension, "energy/time"); + fvFormattedString(&options[OPT_232THPOWERCRUST].cDefault, "Primordial Earth"); + fvFormattedString(&options[OPT_232THPOWERCRUST].cDimension, "energy/time"); options[OPT_232THPOWERCRUST].iType = 2; options[OPT_232THPOWERCRUST].bMultiFile = 1; options[OPT_232THPOWERCRUST].dNeg = EPOWERCRUST232TH; // 1e12*1e-7; // cgs options[OPT_232THPOWERCRUST].dDefault = EPOWERCRUST232TH; - sprintf(options[OPT_232THPOWERCRUST].cNeg, "Primordial Earth Units"); + fvFormattedString(&options[OPT_232THPOWERCRUST].cNeg, "Primordial Earth Units"); fnRead[OPT_232THPOWERCRUST] = &fvRead232ThPowerCrust; /* 238U*/ - sprintf(options[OPT_238UMASSMAN].cName, "d238UMassMan"); - sprintf(options[OPT_238UMASSMAN].cDescr, "Initial Mass of 238U"); - sprintf(options[OPT_238UMASSMAN].cDefault, "Primordial Earth"); - sprintf(options[OPT_238UMASSMAN].cDimension, "mass"); + fvFormattedString(&options[OPT_238UMASSMAN].cName, "d238UMassMan"); + fvFormattedString(&options[OPT_238UMASSMAN].cDescr, "Initial Mass of 238U"); + fvFormattedString(&options[OPT_238UMASSMAN].cDefault, "Primordial Earth"); + fvFormattedString(&options[OPT_238UMASSMAN].cDimension, "mass"); options[OPT_238UMASSMAN].iType = 2; options[OPT_238UMASSMAN].bMultiFile = 1; options[OPT_238UMASSMAN].dNeg = EMASSMAN238U; options[OPT_238UMASSMAN].dDefault = EMASSMAN238U; - sprintf(options[OPT_238UMASSMAN].cNeg, "Primordial Earth Units"); + fvFormattedString(&options[OPT_238UMASSMAN].cNeg, "Primordial Earth Units"); fnRead[OPT_238UMASSMAN] = &fvRead238UMassMan; - sprintf(options[OPT_238UNUMMAN].cName, "d238UNumMan"); - sprintf(options[OPT_238UNUMMAN].cDescr, "Initial Number of 238U Atoms"); - sprintf(options[OPT_238UNUMMAN].cDefault, "Primordial Earth"); - sprintf(options[OPT_238UNUMMAN].cDimension, "nd"); + fvFormattedString(&options[OPT_238UNUMMAN].cName, "d238UNumMan"); + fvFormattedString(&options[OPT_238UNUMMAN].cDescr, "Initial Number of 238U Atoms"); + fvFormattedString(&options[OPT_238UNUMMAN].cDefault, "Primordial Earth"); + fvFormattedString(&options[OPT_238UNUMMAN].cDimension, "nd"); options[OPT_238UNUMMAN].dDefault = 0; options[OPT_238UNUMMAN].iType = 2; options[OPT_238UNUMMAN].bMultiFile = 1; options[OPT_238UNUMMAN].dNeg = ENUMMAN238U; options[OPT_238UNUMMAN].dDefault = ENUMMAN238U; - sprintf(options[OPT_238UNUMMAN].cNeg, "Primordial Earth Units"); + fvFormattedString(&options[OPT_238UNUMMAN].cNeg, "Primordial Earth Units"); fnRead[OPT_238UNUMMAN] = &fvRead238UNumMan; - sprintf(options[OPT_238UPOWERMAN].cName, "d238UPowerMan"); // section added + fvFormattedString(&options[OPT_238UPOWERMAN].cName, "d238UPowerMan"); // section added // PED - sprintf(options[OPT_238UPOWERMAN].cDescr, + fvFormattedString(&options[OPT_238UPOWERMAN].cDescr, "Initial Power Production from 238U Atoms"); - sprintf(options[OPT_238UPOWERMAN].cDefault, "Primordial Earth"); - sprintf(options[OPT_238UPOWERMAN].cDimension, "energy/time"); + fvFormattedString(&options[OPT_238UPOWERMAN].cDefault, "Primordial Earth"); + fvFormattedString(&options[OPT_238UPOWERMAN].cDimension, "energy/time"); options[OPT_238UPOWERMAN].iType = 2; options[OPT_238UPOWERMAN].bMultiFile = 1; options[OPT_238UPOWERMAN].dNeg = EPOWERMAN238U; // 1e12*1e-7; // cgs options[OPT_238UPOWERMAN].dDefault = EPOWERMAN238U; - sprintf(options[OPT_238UPOWERMAN].cNeg, "Primordial Earth Units"); + fvFormattedString(&options[OPT_238UPOWERMAN].cNeg, "Primordial Earth Units"); fnRead[OPT_238UPOWERMAN] = &fvRead238UPowerMan; - sprintf(options[OPT_238UMASSCORE].cName, "d238UMassCore"); - sprintf(options[OPT_238UMASSCORE].cDescr, "Initial Core Mass of 238U"); - sprintf(options[OPT_238UMASSCORE].cDefault, "Primordial Earth"); - sprintf(options[OPT_238UMASSCORE].cDimension, "mass"); + fvFormattedString(&options[OPT_238UMASSCORE].cName, "d238UMassCore"); + fvFormattedString(&options[OPT_238UMASSCORE].cDescr, "Initial Core Mass of 238U"); + fvFormattedString(&options[OPT_238UMASSCORE].cDefault, "Primordial Earth"); + fvFormattedString(&options[OPT_238UMASSCORE].cDimension, "mass"); options[OPT_238UMASSCORE].iType = 2; options[OPT_238UMASSCORE].bMultiFile = 1; options[OPT_238UMASSCORE].dNeg = EMASSCORE238U; options[OPT_238UMASSCORE].dDefault = EMASSCORE238U; - sprintf(options[OPT_238UMASSCORE].cNeg, "Primordial Earth Units"); + fvFormattedString(&options[OPT_238UMASSCORE].cNeg, "Primordial Earth Units"); fnRead[OPT_238UMASSCORE] = &fvRead238UMassCore; - sprintf(options[OPT_238UNUMCORE].cName, "d238UNumCore"); - sprintf(options[OPT_238UNUMCORE].cDescr, "Initial Core Number of 238U Atoms"); - sprintf(options[OPT_238UNUMCORE].cDefault, "Primordial Earth"); - sprintf(options[OPT_238UNUMCORE].cDimension, "nd"); + fvFormattedString(&options[OPT_238UNUMCORE].cName, "d238UNumCore"); + fvFormattedString(&options[OPT_238UNUMCORE].cDescr, "Initial Core Number of 238U Atoms"); + fvFormattedString(&options[OPT_238UNUMCORE].cDefault, "Primordial Earth"); + fvFormattedString(&options[OPT_238UNUMCORE].cDimension, "nd"); options[OPT_238UNUMCORE].dDefault = 0; options[OPT_238UNUMCORE].iType = 2; options[OPT_238UNUMCORE].bMultiFile = 1; options[OPT_238UNUMCORE].dNeg = ENUMCORE238U; options[OPT_238UNUMCORE].dDefault = ENUMCORE238U; - sprintf(options[OPT_238UNUMCORE].cNeg, "Primordial Earth Units"); + fvFormattedString(&options[OPT_238UNUMCORE].cNeg, "Primordial Earth Units"); fnRead[OPT_238UNUMCORE] = &fvRead238UNumCore; - sprintf(options[OPT_238UPOWERCORE].cName, + fvFormattedString(&options[OPT_238UPOWERCORE].cName, "d238UPowerCore"); // section added PED - sprintf(options[OPT_238UPOWERCORE].cDescr, + fvFormattedString(&options[OPT_238UPOWERCORE].cDescr, "Initial Core Power Production from 238U Atoms"); - sprintf(options[OPT_238UPOWERCORE].cDefault, "Primordial Earth"); - sprintf(options[OPT_238UPOWERCORE].cDimension, "energy/time"); + fvFormattedString(&options[OPT_238UPOWERCORE].cDefault, "Primordial Earth"); + fvFormattedString(&options[OPT_238UPOWERCORE].cDimension, "energy/time"); options[OPT_238UPOWERCORE].iType = 2; options[OPT_238UPOWERCORE].bMultiFile = 1; options[OPT_238UPOWERCORE].dNeg = EPOWERCORE238U; // 1e12*1e-7; // cgs options[OPT_238UPOWERCORE].dDefault = EPOWERCORE238U; - sprintf(options[OPT_238UPOWERCORE].cNeg, "Primordial Earth Units"); + fvFormattedString(&options[OPT_238UPOWERCORE].cNeg, "Primordial Earth Units"); fnRead[OPT_238UPOWERCORE] = &fvRead238UPowerCore; - sprintf(options[OPT_238UMASSCRUST].cName, "d238UMassCrust"); - sprintf(options[OPT_238UMASSCRUST].cDescr, "Initial Crust Mass of 238U"); - sprintf(options[OPT_238UMASSCRUST].cDefault, "Primordial Earth"); - sprintf(options[OPT_238UMASSCRUST].cDimension, "mass"); + fvFormattedString(&options[OPT_238UMASSCRUST].cName, "d238UMassCrust"); + fvFormattedString(&options[OPT_238UMASSCRUST].cDescr, "Initial Crust Mass of 238U"); + fvFormattedString(&options[OPT_238UMASSCRUST].cDefault, "Primordial Earth"); + fvFormattedString(&options[OPT_238UMASSCRUST].cDimension, "mass"); options[OPT_238UMASSCRUST].iType = 2; options[OPT_238UMASSCRUST].bMultiFile = 1; options[OPT_238UMASSCRUST].dNeg = EMASSCRUST238U; options[OPT_238UMASSCRUST].dDefault = EMASSCRUST238U; - sprintf(options[OPT_238UMASSCRUST].cNeg, "Primordial Earth Units"); + fvFormattedString(&options[OPT_238UMASSCRUST].cNeg, "Primordial Earth Units"); fnRead[OPT_238UMASSCRUST] = &fvRead238UMassCrust; - sprintf(options[OPT_238UNUMCRUST].cName, "d238UNumCrust"); - sprintf(options[OPT_238UNUMCRUST].cDescr, + fvFormattedString(&options[OPT_238UNUMCRUST].cName, "d238UNumCrust"); + fvFormattedString(&options[OPT_238UNUMCRUST].cDescr, "Initial Crust Number of 238U Atoms"); - sprintf(options[OPT_238UNUMCRUST].cDefault, "Primordial Earth"); - sprintf(options[OPT_238UNUMCRUST].cDimension, "nd"); + fvFormattedString(&options[OPT_238UNUMCRUST].cDefault, "Primordial Earth"); + fvFormattedString(&options[OPT_238UNUMCRUST].cDimension, "nd"); options[OPT_238UNUMCRUST].dDefault = 0; options[OPT_238UNUMCRUST].iType = 2; options[OPT_238UNUMCRUST].bMultiFile = 1; options[OPT_238UNUMCRUST].dNeg = ENUMCRUST238U; options[OPT_238UNUMCRUST].dDefault = ENUMCRUST238U; - sprintf(options[OPT_238UNUMCRUST].cNeg, "Primordial Earth Units"); + fvFormattedString(&options[OPT_238UNUMCRUST].cNeg, "Primordial Earth Units"); fnRead[OPT_238UNUMCRUST] = &fvRead238UNumCrust; - sprintf(options[OPT_238UPOWERCRUST].cName, + fvFormattedString(&options[OPT_238UPOWERCRUST].cName, "d238UPowerCrust"); // section added PED - sprintf(options[OPT_238UPOWERCRUST].cDescr, + fvFormattedString(&options[OPT_238UPOWERCRUST].cDescr, "Initial Crust Power Production from 238U Atoms"); - sprintf(options[OPT_238UPOWERCRUST].cDefault, "Primordial Earth"); - sprintf(options[OPT_238UPOWERCRUST].cDimension, "energy/time"); + fvFormattedString(&options[OPT_238UPOWERCRUST].cDefault, "Primordial Earth"); + fvFormattedString(&options[OPT_238UPOWERCRUST].cDimension, "energy/time"); options[OPT_238UPOWERCRUST].iType = 2; options[OPT_238UPOWERCRUST].bMultiFile = 1; options[OPT_238UPOWERCRUST].dNeg = EPOWERCRUST238U; // 1e12*1e-7; // cgs options[OPT_238UPOWERCRUST].dDefault = EPOWERCRUST238U; - sprintf(options[OPT_238UPOWERCRUST].cNeg, "Primordial Earth Units"); + fvFormattedString(&options[OPT_238UPOWERCRUST].cNeg, "Primordial Earth Units"); fnRead[OPT_238UPOWERCRUST] = &fvRead238UPowerCrust; /* 235U */ - sprintf(options[OPT_235UMASSMAN].cName, "d235UMassMan"); // PED - sprintf(options[OPT_235UMASSMAN].cDescr, "Initial Mass of 235U"); - sprintf(options[OPT_235UMASSMAN].cDefault, "Primordial Earth"); - sprintf(options[OPT_235UMASSMAN].cDimension, "nd"); + fvFormattedString(&options[OPT_235UMASSMAN].cName, "d235UMassMan"); // PED + fvFormattedString(&options[OPT_235UMASSMAN].cDescr, "Initial Mass of 235U"); + fvFormattedString(&options[OPT_235UMASSMAN].cDefault, "Primordial Earth"); + fvFormattedString(&options[OPT_235UMASSMAN].cDimension, "nd"); options[OPT_235UMASSMAN].iType = 2; options[OPT_235UMASSMAN].bMultiFile = 1; options[OPT_235UMASSMAN].dNeg = EMASSMAN235U; options[OPT_235UMASSMAN].dDefault = EMASSMAN235U; - sprintf(options[OPT_235UMASSMAN].cNeg, "Primordial Earth Units"); + fvFormattedString(&options[OPT_235UMASSMAN].cNeg, "Primordial Earth Units"); fnRead[OPT_235UMASSMAN] = &fvRead235UMassMan; - sprintf(options[OPT_235UNUMMAN].cName, "d235UNumMan"); // PED - sprintf(options[OPT_235UNUMMAN].cDescr, "Initial Number of 235U Atoms"); - sprintf(options[OPT_235UNUMMAN].cDefault, "Primordial Earth"); - sprintf(options[OPT_235UNUMMAN].cDimension, "nd"); + fvFormattedString(&options[OPT_235UNUMMAN].cName, "d235UNumMan"); // PED + fvFormattedString(&options[OPT_235UNUMMAN].cDescr, "Initial Number of 235U Atoms"); + fvFormattedString(&options[OPT_235UNUMMAN].cDefault, "Primordial Earth"); + fvFormattedString(&options[OPT_235UNUMMAN].cDimension, "nd"); options[OPT_235UNUMMAN].iType = 2; options[OPT_235UNUMMAN].bMultiFile = 1; options[OPT_235UNUMMAN].dNeg = ENUMMAN235U; options[OPT_235UNUMMAN].dDefault = ENUMMAN235U; - sprintf(options[OPT_235UNUMMAN].cNeg, "Primordial Earth Units"); + fvFormattedString(&options[OPT_235UNUMMAN].cNeg, "Primordial Earth Units"); fnRead[OPT_235UNUMMAN] = &fvRead235UNumMan; - sprintf(options[OPT_235UPOWERMAN].cName, "d235UPowerMan"); // section added + fvFormattedString(&options[OPT_235UPOWERMAN].cName, "d235UPowerMan"); // section added // PED - sprintf(options[OPT_235UPOWERMAN].cDescr, + fvFormattedString(&options[OPT_235UPOWERMAN].cDescr, "Initial Power Production from 235U Atoms"); - sprintf(options[OPT_235UPOWERMAN].cDefault, "Primordial Earth"); - sprintf(options[OPT_235UPOWERMAN].cDimension, "energy/time"); + fvFormattedString(&options[OPT_235UPOWERMAN].cDefault, "Primordial Earth"); + fvFormattedString(&options[OPT_235UPOWERMAN].cDimension, "energy/time"); options[OPT_235UPOWERMAN].iType = 2; options[OPT_235UPOWERMAN].bMultiFile = 1; options[OPT_235UPOWERMAN].dNeg = EPOWERMAN235U; options[OPT_235UPOWERMAN].dDefault = EPOWERMAN235U; - sprintf(options[OPT_235UPOWERMAN].cNeg, "Primoridal Earth Units"); + fvFormattedString(&options[OPT_235UPOWERMAN].cNeg, "Primoridal Earth Units"); fnRead[OPT_235UPOWERMAN] = &fvRead235UPowerMan; - sprintf(options[OPT_235UMASSCORE].cName, "d235UMassCore"); - sprintf(options[OPT_235UMASSCORE].cDescr, "Initial Core Mass of 235U"); - sprintf(options[OPT_235UMASSCORE].cDefault, "Primordial Earth"); - sprintf(options[OPT_235UMASSCORE].cDimension, "mass"); + fvFormattedString(&options[OPT_235UMASSCORE].cName, "d235UMassCore"); + fvFormattedString(&options[OPT_235UMASSCORE].cDescr, "Initial Core Mass of 235U"); + fvFormattedString(&options[OPT_235UMASSCORE].cDefault, "Primordial Earth"); + fvFormattedString(&options[OPT_235UMASSCORE].cDimension, "mass"); options[OPT_235UMASSCORE].iType = 2; options[OPT_235UMASSCORE].bMultiFile = 1; options[OPT_235UMASSCORE].dNeg = EMASSCORE235U; options[OPT_235UMASSCORE].dDefault = EMASSCORE235U; - sprintf(options[OPT_235UMASSCORE].cNeg, "Primordial Earth Units"); + fvFormattedString(&options[OPT_235UMASSCORE].cNeg, "Primordial Earth Units"); fnRead[OPT_235UMASSCORE] = &fvRead235UMassCore; - sprintf(options[OPT_235UNUMCORE].cName, "d235UNumCore"); - sprintf(options[OPT_235UNUMCORE].cDescr, "Initial Core Number of 235U Atoms"); - sprintf(options[OPT_235UNUMCORE].cDefault, "Primordial Earth"); - sprintf(options[OPT_235UNUMCORE].cDimension, "nd"); + fvFormattedString(&options[OPT_235UNUMCORE].cName, "d235UNumCore"); + fvFormattedString(&options[OPT_235UNUMCORE].cDescr, "Initial Core Number of 235U Atoms"); + fvFormattedString(&options[OPT_235UNUMCORE].cDefault, "Primordial Earth"); + fvFormattedString(&options[OPT_235UNUMCORE].cDimension, "nd"); options[OPT_235UNUMCORE].iType = 2; options[OPT_235UNUMCORE].bMultiFile = 1; options[OPT_235UNUMCORE].dNeg = ENUMCORE235U; options[OPT_235UNUMCORE].dDefault = ENUMCORE235U; - sprintf(options[OPT_235UNUMCORE].cNeg, "Primordial Earth Units"); + fvFormattedString(&options[OPT_235UNUMCORE].cNeg, "Primordial Earth Units"); fnRead[OPT_235UNUMCORE] = &fvRead235UNumCore; - sprintf(options[OPT_235UPOWERCORE].cName, + fvFormattedString(&options[OPT_235UPOWERCORE].cName, "d235UPowerCore"); // section added PED - sprintf(options[OPT_235UPOWERCORE].cDescr, + fvFormattedString(&options[OPT_235UPOWERCORE].cDescr, "Initial Core Power Production from 235U Atoms"); - sprintf(options[OPT_235UPOWERCORE].cDefault, "Primordial Earth"); - sprintf(options[OPT_235UPOWERCORE].cDimension, "energy/time"); + fvFormattedString(&options[OPT_235UPOWERCORE].cDefault, "Primordial Earth"); + fvFormattedString(&options[OPT_235UPOWERCORE].cDimension, "energy/time"); options[OPT_235UPOWERCORE].iType = 2; options[OPT_235UPOWERCORE].bMultiFile = 1; options[OPT_235UPOWERCORE].dNeg = EPOWERCORE235U; options[OPT_235UPOWERCORE].dDefault = EPOWERCORE235U; - sprintf(options[OPT_235UPOWERCORE].cNeg, "Primordial Earth Units"); + fvFormattedString(&options[OPT_235UPOWERCORE].cNeg, "Primordial Earth Units"); fnRead[OPT_235UPOWERCORE] = &fvRead235UPowerCore; - sprintf(options[OPT_235UMASSCRUST].cName, "d235UMassCrust"); - sprintf(options[OPT_235UMASSCRUST].cDescr, "Initial Crust Mass of 235U"); - sprintf(options[OPT_235UMASSCRUST].cDefault, "Primordial Earth"); - sprintf(options[OPT_235UMASSCRUST].cDimension, "mass"); + fvFormattedString(&options[OPT_235UMASSCRUST].cName, "d235UMassCrust"); + fvFormattedString(&options[OPT_235UMASSCRUST].cDescr, "Initial Crust Mass of 235U"); + fvFormattedString(&options[OPT_235UMASSCRUST].cDefault, "Primordial Earth"); + fvFormattedString(&options[OPT_235UMASSCRUST].cDimension, "mass"); options[OPT_235UMASSCRUST].iType = 2; options[OPT_235UMASSCRUST].bMultiFile = 1; options[OPT_235UMASSCRUST].dNeg = EMASSCRUST235U; options[OPT_235UMASSCRUST].dDefault = EMASSCRUST235U; - sprintf(options[OPT_235UMASSCRUST].cNeg, "Primordial Earth Units"); + fvFormattedString(&options[OPT_235UMASSCRUST].cNeg, "Primordial Earth Units"); fnRead[OPT_235UMASSCRUST] = &fvRead235UMassCrust; - sprintf(options[OPT_235UNUMCRUST].cName, "d235UNumCrust"); - sprintf(options[OPT_235UNUMCRUST].cDescr, + fvFormattedString(&options[OPT_235UNUMCRUST].cName, "d235UNumCrust"); + fvFormattedString(&options[OPT_235UNUMCRUST].cDescr, "Initial Crust Number of 235U Atoms"); - sprintf(options[OPT_235UNUMCRUST].cDefault, "Primordial Earth"); - sprintf(options[OPT_235UNUMCRUST].cDimension, "nd"); + fvFormattedString(&options[OPT_235UNUMCRUST].cDefault, "Primordial Earth"); + fvFormattedString(&options[OPT_235UNUMCRUST].cDimension, "nd"); options[OPT_235UNUMCRUST].iType = 2; options[OPT_235UNUMCRUST].bMultiFile = 1; options[OPT_235UNUMCRUST].dNeg = ENUMCRUST235U; options[OPT_235UNUMCRUST].dDefault = ENUMCRUST235U; - sprintf(options[OPT_235UNUMCRUST].cNeg, "Primordial Earth Units"); + fvFormattedString(&options[OPT_235UNUMCRUST].cNeg, "Primordial Earth Units"); fnRead[OPT_235UNUMCRUST] = &fvRead235UNumCrust; - sprintf(options[OPT_235UPOWERCRUST].cName, + fvFormattedString(&options[OPT_235UPOWERCRUST].cName, "d235UPowerCrust"); // section added PED - sprintf(options[OPT_235UPOWERCRUST].cDescr, + fvFormattedString(&options[OPT_235UPOWERCRUST].cDescr, "Initial Crust Power Production from 235U Atoms"); - sprintf(options[OPT_235UPOWERCRUST].cDefault, "Primordial Earth"); - sprintf(options[OPT_235UPOWERCRUST].cDimension, "energy/time"); + fvFormattedString(&options[OPT_235UPOWERCRUST].cDefault, "Primordial Earth"); + fvFormattedString(&options[OPT_235UPOWERCRUST].cDimension, "energy/time"); options[OPT_235UPOWERCRUST].iType = 2; options[OPT_235UPOWERCRUST].bMultiFile = 1; options[OPT_235UPOWERCRUST].dNeg = EPOWERCRUST235U; options[OPT_235UPOWERCRUST].dDefault = EPOWERCRUST235U; - sprintf(options[OPT_235UPOWERCRUST].cNeg, "Primordial Earth Units"); + fvFormattedString(&options[OPT_235UPOWERCRUST].cNeg, "Primordial Earth Units"); fnRead[OPT_235UPOWERCRUST] = &fvRead235UPowerCrust; - sprintf(options[OPT_HALT40KPOWER].cName, "dHalt40KPower"); - sprintf(options[OPT_HALT40KPOWER].cDescr, "Minimum 40K Power"); - sprintf(options[OPT_HALT40KPOWER].cDefault, "0"); - sprintf(options[OPT_HALT40KPOWER].cDimension, "energy/time"); + fvFormattedString(&options[OPT_HALT40KPOWER].cName, "dHalt40KPower"); + fvFormattedString(&options[OPT_HALT40KPOWER].cDescr, "Minimum 40K Power"); + fvFormattedString(&options[OPT_HALT40KPOWER].cDefault, "0"); + fvFormattedString(&options[OPT_HALT40KPOWER].cDimension, "energy/time"); options[OPT_HALT40KPOWER].iType = 2; options[OPT_HALT40KPOWER].bMultiFile = 1; options[OPT_HALT40KPOWER].dNeg = 1e12; // TW options[OPT_HALT40KPOWER].dDefault = 0; - sprintf(options[OPT_HALT40KPOWER].cNeg, "TW"); + fvFormattedString(&options[OPT_HALT40KPOWER].cNeg, "TW"); fnRead[OPT_HALT40KPOWER] = &fvReadHalt40KPower; - sprintf(options[OPT_HALT232THPOWER].cName, "dHalt232ThPower"); - sprintf(options[OPT_HALT232THPOWER].cDescr, "Minimum 232Th Power"); - sprintf(options[OPT_HALT232THPOWER].cDefault, "0"); - sprintf(options[OPT_HALT232THPOWER].cDimension, "energy/time"); + fvFormattedString(&options[OPT_HALT232THPOWER].cName, "dHalt232ThPower"); + fvFormattedString(&options[OPT_HALT232THPOWER].cDescr, "Minimum 232Th Power"); + fvFormattedString(&options[OPT_HALT232THPOWER].cDefault, "0"); + fvFormattedString(&options[OPT_HALT232THPOWER].cDimension, "energy/time"); options[OPT_HALT232THPOWER].iType = 2; options[OPT_HALT232THPOWER].bMultiFile = 1; options[OPT_HALT232THPOWER].dNeg = 1e12; // TW options[OPT_HALT232THPOWER].dDefault = 0; - sprintf(options[OPT_HALT232THPOWER].cNeg, "TW"); + fvFormattedString(&options[OPT_HALT232THPOWER].cNeg, "TW"); fnRead[OPT_HALT232THPOWER] = &fvReadHalt232ThPower; - sprintf(options[OPT_HALT235UPOWER].cName, "dHalt235UPower"); - sprintf(options[OPT_HALT235UPOWER].cDescr, "Minimum 235U Power"); - sprintf(options[OPT_HALT235UPOWER].cDefault, "0"); - sprintf(options[OPT_HALT235UPOWER].cDimension, "energy/time"); + fvFormattedString(&options[OPT_HALT235UPOWER].cName, "dHalt235UPower"); + fvFormattedString(&options[OPT_HALT235UPOWER].cDescr, "Minimum 235U Power"); + fvFormattedString(&options[OPT_HALT235UPOWER].cDefault, "0"); + fvFormattedString(&options[OPT_HALT235UPOWER].cDimension, "energy/time"); options[OPT_HALT235UPOWER].iType = 2; options[OPT_HALT235UPOWER].bMultiFile = 1; options[OPT_HALT235UPOWER].dNeg = 1e12; // TW options[OPT_HALT235UPOWER].dDefault = 0; - sprintf(options[OPT_HALT235UPOWER].cNeg, "TW"); + fvFormattedString(&options[OPT_HALT235UPOWER].cNeg, "TW"); fnRead[OPT_HALT235UPOWER] = &fvReadHalt235UPower; - sprintf(options[OPT_HALT238UPOWER].cName, "dHalt238UPower"); - sprintf(options[OPT_HALT238UPOWER].cDescr, "Minimum 238U Power"); - sprintf(options[OPT_HALT238UPOWER].cDefault, "0"); - sprintf(options[OPT_HALT238UPOWER].cDimension, "energy/time"); + fvFormattedString(&options[OPT_HALT238UPOWER].cName, "dHalt238UPower"); + fvFormattedString(&options[OPT_HALT238UPOWER].cDescr, "Minimum 238U Power"); + fvFormattedString(&options[OPT_HALT238UPOWER].cDefault, "0"); + fvFormattedString(&options[OPT_HALT238UPOWER].cDimension, "energy/time"); options[OPT_HALT238UPOWER].iType = 2; options[OPT_HALT238UPOWER].bMultiFile = 1; options[OPT_HALT238UPOWER].dNeg = 1e12; // TW options[OPT_HALT238UPOWER].dDefault = 0; - sprintf(options[OPT_HALT238UPOWER].cNeg, "TW"); + fvFormattedString(&options[OPT_HALT238UPOWER].cNeg, "TW"); fnRead[OPT_HALT238UPOWER] = &fvReadHalt238UPower; - sprintf(options[OPT_HALTRADPOWER].cName, "dHaltRadPower"); - sprintf(options[OPT_HALTRADPOWER].cDescr, "Minimum Total Radgiogenic Power"); - sprintf(options[OPT_HALTRADPOWER].cDefault, "0"); - sprintf(options[OPT_HALTRADPOWER].cDimension, "energy/time"); + fvFormattedString(&options[OPT_HALTRADPOWER].cName, "dHaltRadPower"); + fvFormattedString(&options[OPT_HALTRADPOWER].cDescr, "Minimum Total Radgiogenic Power"); + fvFormattedString(&options[OPT_HALTRADPOWER].cDefault, "0"); + fvFormattedString(&options[OPT_HALTRADPOWER].cDimension, "energy/time"); options[OPT_HALTRADPOWER].iType = 2; options[OPT_HALTRADPOWER].bMultiFile = 1; options[OPT_HALTRADPOWER].dNeg = 1e12; // TW options[OPT_HALTRADPOWER].dDefault = 0; - sprintf(options[OPT_HALTRADPOWER].cNeg, "TW"); + fvFormattedString(&options[OPT_HALTRADPOWER].cNeg, "TW"); fnRead[OPT_HALTRADPOWER] = &fvReadHaltRadPower; } /** @@ -3659,13 +3659,13 @@ void fvVerifyHaltRadheat(BODY *body, CONTROL *control, OPTIONS *options, */ void fvWrite26AlPowerMan(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, - int iBody, double *dTmp, char cUnit[]) { + int iBody, double *dTmp, char **cUnit) { /* Get total power from 26Al *dTmp = -(*(update[iBody].pdD26AlNumManDt))*ENERGY26Al; */ *dTmp = fd26AlPowerMan(update, iBody); if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { *dTmp /= fdUnitsPower(units->iTime, units->iMass, units->iLength); fsUnitsPower(units, cUnit); @@ -3686,12 +3686,12 @@ void fvWrite26AlPowerMan(BODY *body, CONTROL *control, OUTPUT *output, */ void fvWrite26AlEnFlux(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, - double *dTmp, char cUnit[]) { + double *dTmp, char **cUnit) { /* Get surface heat flux from 26Al */ *dTmp = fd26AlEnFlux(body, update, iBody); if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { *dTmp /= fdUnitsEnergyFlux(units->iTime, units->iMass, units->iLength); fsUnitsEnergyFlux(units, cUnit); @@ -3712,11 +3712,11 @@ void fvWrite26AlEnFlux(BODY *body, CONTROL *control, OUTPUT *output, */ void fvWriteD26AlNumDt(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, - double *dTmp, char cUnit[]) { + double *dTmp, char **cUnit) { *dTmp = *(update[iBody].pdD26AlNumManDt); if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { *dTmp *= fdUnitsTime(units->iTime); fsUnitsRate(units->iTime, cUnit); @@ -3737,7 +3737,7 @@ void fvWriteD26AlNumDt(BODY *body, CONTROL *control, OUTPUT *output, */ void fvWrite26AlTimescale(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, - int iBody, double *dTmp, char cUnit[]) { + int iBody, double *dTmp, char **cUnit) { *dTmp = -1; } /** @@ -3755,11 +3755,11 @@ void fvWrite26AlTimescale(BODY *body, CONTROL *control, OUTPUT *output, */ void fvWrite26AlMassMan(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, - double *dTmp, char cUnit[]) { + double *dTmp, char **cUnit) { *dTmp = body[iBody].d26AlNumMan * MASS26AL; if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { *dTmp /= fdUnitsMass(units->iMass); fsUnitsMass(units->iMass, cUnit); @@ -3780,7 +3780,7 @@ void fvWrite26AlMassMan(BODY *body, CONTROL *control, OUTPUT *output, */ void fvWriteD26AlPowerDt(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, - int iBody, double *dTmp, char cUnit[]) { + int iBody, double *dTmp, char **cUnit) { *dTmp = -1; } /** @@ -3798,11 +3798,11 @@ void fvWriteD26AlPowerDt(BODY *body, CONTROL *control, OUTPUT *output, */ void fvWrite26AlNumMan(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, - double *dTmp, char cUnit[]) { + double *dTmp, char **cUnit) { *dTmp = body[iBody].d26AlNumMan; if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } /* else nothing, as it is a number */ } @@ -3823,12 +3823,12 @@ void fvWrite26AlNumMan(BODY *body, CONTROL *control, OUTPUT *output, */ void fvWrite26AlPowerCore(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, - int iBody, double *dTmp, char cUnit[]) { + int iBody, double *dTmp, char **cUnit) { /* Get total power from 26Al */ *dTmp = fd26AlPowerCore(update, iBody); if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { *dTmp /= fdUnitsPower(units->iTime, units->iMass, units->iLength); fsUnitsPower(units, cUnit); @@ -3849,11 +3849,11 @@ void fvWrite26AlPowerCore(BODY *body, CONTROL *control, OUTPUT *output, */ void fvWrite26AlMassCore(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, - int iBody, double *dTmp, char cUnit[]) { + int iBody, double *dTmp, char **cUnit) { *dTmp = body[iBody].d26AlNumCore * MASS26AL; if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { *dTmp /= fdUnitsMass(units->iMass); fsUnitsMass(units->iMass, cUnit); @@ -3874,11 +3874,11 @@ void fvWrite26AlMassCore(BODY *body, CONTROL *control, OUTPUT *output, */ void fvWrite26AlNumCore(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, - double *dTmp, char cUnit[]) { + double *dTmp, char **cUnit) { *dTmp = body[iBody].d26AlNumCore; if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } /* else nothing, as it is a number */ } @@ -3898,11 +3898,11 @@ void fvWrite26AlNumCore(BODY *body, CONTROL *control, OUTPUT *output, */ void fvWrite26AlPowerTot(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, - int iBody, double *dTmp, char cUnit[]) { + int iBody, double *dTmp, char **cUnit) { *dTmp = fd26AlPower(update, iBody); if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { *dTmp /= fdUnitsPower(units->iTime, units->iMass, units->iLength); fsUnitsPower(units, cUnit); @@ -3926,13 +3926,13 @@ void fvWrite26AlPowerTot(BODY *body, CONTROL *control, OUTPUT *output, */ void fvWrite40KPowerMan(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, - double *dTmp, char cUnit[]) { + double *dTmp, char **cUnit) { /* Get total power from 40K *dTmp = -(*(update[iBody].pdD40KNumManDt))*ENERGY40K; */ *dTmp = fd40KPowerMan(update, iBody); if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { *dTmp /= fdUnitsPower(units->iTime, units->iMass, units->iLength); fsUnitsPower(units, cUnit); @@ -3953,12 +3953,12 @@ void fvWrite40KPowerMan(BODY *body, CONTROL *control, OUTPUT *output, */ void fvWrite40KEnFlux(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, - double *dTmp, char cUnit[]) { + double *dTmp, char **cUnit) { /* Get surface heat flux from 40K */ *dTmp = fd40KEnFlux(body, update, iBody); if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { *dTmp /= fdUnitsEnergyFlux(units->iTime, units->iMass, units->iLength); fsUnitsEnergyFlux(units, cUnit); @@ -3979,11 +3979,11 @@ void fvWrite40KEnFlux(BODY *body, CONTROL *control, OUTPUT *output, */ void fvWriteD40KNumDt(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, - double *dTmp, char cUnit[]) { + double *dTmp, char **cUnit) { *dTmp = *(update[iBody].pdD40KNumManDt); if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { *dTmp *= fdUnitsTime(units->iTime); fsUnitsRate(units->iTime, cUnit); @@ -4004,7 +4004,7 @@ void fvWriteD40KNumDt(BODY *body, CONTROL *control, OUTPUT *output, */ void fvWrite40KTimescale(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, - int iBody, double *dTmp, char cUnit[]) { + int iBody, double *dTmp, char **cUnit) { *dTmp = -1; } /** @@ -4022,11 +4022,11 @@ void fvWrite40KTimescale(BODY *body, CONTROL *control, OUTPUT *output, */ void fvWrite40KMassMan(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, - double *dTmp, char cUnit[]) { + double *dTmp, char **cUnit) { *dTmp = body[iBody].d40KNumMan * MASS40K; if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { *dTmp /= fdUnitsMass(units->iMass); fsUnitsMass(units->iMass, cUnit); @@ -4048,7 +4048,7 @@ void fvWrite40KMassMan(BODY *body, CONTROL *control, OUTPUT *output, */ void fvWriteD40KPowerDt(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, - double *dTmp, char cUnit[]) { + double *dTmp, char **cUnit) { *dTmp = -1; } /** @@ -4066,11 +4066,11 @@ void fvWriteD40KPowerDt(BODY *body, CONTROL *control, OUTPUT *output, */ void fvWrite40KNumMan(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, - double *dTmp, char cUnit[]) { + double *dTmp, char **cUnit) { *dTmp = body[iBody].d40KNumMan; if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } /* else nothing, as it is a number */ } @@ -4091,12 +4091,12 @@ void fvWrite40KNumMan(BODY *body, CONTROL *control, OUTPUT *output, */ void fvWrite40KPowerCore(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, - int iBody, double *dTmp, char cUnit[]) { + int iBody, double *dTmp, char **cUnit) { /* Get total power from 40K */ *dTmp = fd40KPowerCore(update, iBody); if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { *dTmp /= fdUnitsPower(units->iTime, units->iMass, units->iLength); fsUnitsPower(units, cUnit); @@ -4117,11 +4117,11 @@ void fvWrite40KPowerCore(BODY *body, CONTROL *control, OUTPUT *output, */ void fvWrite40KMassCore(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, - double *dTmp, char cUnit[]) { + double *dTmp, char **cUnit) { *dTmp = body[iBody].d40KNumCore * MASS40K; if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { *dTmp /= fdUnitsMass(units->iMass); fsUnitsMass(units->iMass, cUnit); @@ -4142,11 +4142,11 @@ void fvWrite40KMassCore(BODY *body, CONTROL *control, OUTPUT *output, */ void fvWrite40KNumCore(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, - double *dTmp, char cUnit[]) { + double *dTmp, char **cUnit) { *dTmp = body[iBody].d40KNumCore; if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } /* else nothing, as it is a number */ } @@ -4167,12 +4167,12 @@ void fvWrite40KNumCore(BODY *body, CONTROL *control, OUTPUT *output, */ void fvWrite40KPowerCrust(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, - int iBody, double *dTmp, char cUnit[]) { + int iBody, double *dTmp, char **cUnit) { /* Get total power from 40K */ *dTmp = fd40KPowerCrust(update, iBody); if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { *dTmp /= fdUnitsPower(units->iTime, units->iMass, units->iLength); fsUnitsPower(units, cUnit); @@ -4193,11 +4193,11 @@ void fvWrite40KPowerCrust(BODY *body, CONTROL *control, OUTPUT *output, */ void fvWrite40KMassCrust(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, - int iBody, double *dTmp, char cUnit[]) { + int iBody, double *dTmp, char **cUnit) { *dTmp = body[iBody].d40KNumCrust * MASS40K; if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { *dTmp /= fdUnitsMass(units->iMass); fsUnitsMass(units->iMass, cUnit); @@ -4218,11 +4218,11 @@ void fvWrite40KMassCrust(BODY *body, CONTROL *control, OUTPUT *output, */ void fvWrite40KNumCrust(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, - double *dTmp, char cUnit[]) { + double *dTmp, char **cUnit) { *dTmp = body[iBody].d40KNumCrust; if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } /* else nothing, as it is a number */ } @@ -4242,11 +4242,11 @@ void fvWrite40KNumCrust(BODY *body, CONTROL *control, OUTPUT *output, */ void fvWrite40KPowerTot(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, - double *dTmp, char cUnit[]) { + double *dTmp, char **cUnit) { *dTmp = fd40KPower(update, iBody); if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { *dTmp /= fdUnitsPower(units->iTime, units->iMass, units->iLength); fsUnitsPower(units, cUnit); @@ -4269,13 +4269,13 @@ void fvWrite40KPowerTot(BODY *body, CONTROL *control, OUTPUT *output, */ void fvWrite232ThEnFlux(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, - double *dTmp, char cUnit[]) { + double *dTmp, char **cUnit) { /* Get surface heat flux from 232Th */ *dTmp = fd232ThEnFlux(body, update, iBody); if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { *dTmp /= fdUnitsEnergyFlux(units->iTime, units->iMass, units->iLength); fsUnitsEnergyFlux(units, cUnit); @@ -4296,12 +4296,12 @@ void fvWrite232ThEnFlux(BODY *body, CONTROL *control, OUTPUT *output, */ void fvWriteD232ThNumDt(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, - double *dTmp, char cUnit[]) { + double *dTmp, char **cUnit) { *dTmp = *(update[iBody].pdD232ThNumManDt); if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { *dTmp *= fdUnitsTime(units->iTime); fsUnitsRate(units->iTime, cUnit); @@ -4322,7 +4322,7 @@ void fvWriteD232ThNumDt(BODY *body, CONTROL *control, OUTPUT *output, */ void fvWritedD232ThPowerDt(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, - int iBody, double *dTmp, char cUnit[]) { + int iBody, double *dTmp, char **cUnit) { *dTmp = -1; } /** @@ -4340,7 +4340,7 @@ void fvWritedD232ThPowerDt(BODY *body, CONTROL *control, OUTPUT *output, */ void fvWrite232ThTimescale(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, - int iBody, double *dTmp, char cUnit[]) { + int iBody, double *dTmp, char **cUnit) { *dTmp = -1; } /** @@ -4358,12 +4358,12 @@ void fvWrite232ThTimescale(BODY *body, CONTROL *control, OUTPUT *output, */ void fvWrite232ThPowerMan(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, - int iBody, double *dTmp, char cUnit[]) { + int iBody, double *dTmp, char **cUnit) { /* Get total heat from 232Th */ *dTmp = fd232ThPowerMan(update, iBody); if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { *dTmp /= fdUnitsPower(units->iTime, units->iMass, units->iLength); fsUnitsPower(units, cUnit); @@ -4384,11 +4384,11 @@ void fvWrite232ThPowerMan(BODY *body, CONTROL *control, OUTPUT *output, */ void fvWrite232ThMassMan(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, - int iBody, double *dTmp, char cUnit[]) { + int iBody, double *dTmp, char **cUnit) { *dTmp = body[iBody].d232ThNumMan * MASS232TH; if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { *dTmp /= fdUnitsMass(units->iMass); fsUnitsMass(units->iMass, cUnit); @@ -4409,11 +4409,11 @@ void fvWrite232ThMassMan(BODY *body, CONTROL *control, OUTPUT *output, */ void fvWrite232ThNumMan(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, - double *dTmp, char cUnit[]) { + double *dTmp, char **cUnit) { *dTmp = body[iBody].d232ThNumMan; if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } /* else nothing, as it is a number */ } @@ -4434,12 +4434,12 @@ void fvWrite232ThNumMan(BODY *body, CONTROL *control, OUTPUT *output, */ void fvWrite232ThPowerCore(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, - int iBody, double *dTmp, char cUnit[]) { + int iBody, double *dTmp, char **cUnit) { /* Get total heat from 232Th */ *dTmp = fd232ThPowerCore(update, iBody); if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { *dTmp /= fdUnitsPower(units->iTime, units->iMass, units->iLength); fsUnitsPower(units, cUnit); @@ -4460,11 +4460,11 @@ void fvWrite232ThPowerCore(BODY *body, CONTROL *control, OUTPUT *output, */ void fvWrite232ThMassCore(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, - int iBody, double *dTmp, char cUnit[]) { + int iBody, double *dTmp, char **cUnit) { *dTmp = body[iBody].d232ThNumCore * MASS232TH; if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { *dTmp /= fdUnitsMass(units->iMass); fsUnitsMass(units->iMass, cUnit); @@ -4485,11 +4485,11 @@ void fvWrite232ThMassCore(BODY *body, CONTROL *control, OUTPUT *output, */ void fvWrite232ThNumCore(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, - int iBody, double *dTmp, char cUnit[]) { + int iBody, double *dTmp, char **cUnit) { *dTmp = body[iBody].d232ThNumCore; if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } /* else nothing, as it is a number */ } @@ -4510,12 +4510,12 @@ void fvWrite232ThNumCore(BODY *body, CONTROL *control, OUTPUT *output, */ void fvWrite232ThPowerCrust(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, - int iBody, double *dTmp, char cUnit[]) { + int iBody, double *dTmp, char **cUnit) { /* Get total heat from 232Th */ *dTmp = fd232ThPowerCrust(update, iBody); if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { *dTmp /= fdUnitsPower(units->iTime, units->iMass, units->iLength); fsUnitsPower(units, cUnit); @@ -4536,11 +4536,11 @@ void fvWrite232ThPowerCrust(BODY *body, CONTROL *control, OUTPUT *output, */ void fvWrite232ThMassCrust(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, - int iBody, double *dTmp, char cUnit[]) { + int iBody, double *dTmp, char **cUnit) { *dTmp = body[iBody].d232ThNumCrust * MASS232TH; if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { *dTmp /= fdUnitsMass(units->iMass); fsUnitsMass(units->iMass, cUnit); @@ -4561,11 +4561,11 @@ void fvWrite232ThMassCrust(BODY *body, CONTROL *control, OUTPUT *output, */ void fvWrite232ThNumCrust(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, - int iBody, double *dTmp, char cUnit[]) { + int iBody, double *dTmp, char **cUnit) { *dTmp = body[iBody].d232ThNumCrust; if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } /* else nothing, as it is a number */ } @@ -4585,11 +4585,11 @@ void fvWrite232ThNumCrust(BODY *body, CONTROL *control, OUTPUT *output, */ void fvWrite232ThPowerTot(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, - int iBody, double *dTmp, char cUnit[]) { + int iBody, double *dTmp, char **cUnit) { *dTmp = fd232ThPower(update, iBody); if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { *dTmp /= fdUnitsPower(units->iTime, units->iMass, units->iLength); fsUnitsPower(units, cUnit); @@ -4612,12 +4612,12 @@ void fvWrite232ThPowerTot(BODY *body, CONTROL *control, OUTPUT *output, */ void fvWrite238UEnFlux(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, - double *dTmp, char cUnit[]) { + double *dTmp, char **cUnit) { /* Get surface heat flux from 238U */ *dTmp = fd238UEnFlux(body, update, iBody); if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { *dTmp /= fdUnitsEnergyFlux(units->iTime, units->iMass, units->iLength); fsUnitsEnergyFlux(units, cUnit); @@ -4638,11 +4638,11 @@ void fvWrite238UEnFlux(BODY *body, CONTROL *control, OUTPUT *output, */ void fvWriteD238UNumDt(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, - double *dTmp, char cUnit[]) { + double *dTmp, char **cUnit) { *dTmp = *(update[iBody].pdD238UNumManDt); if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { *dTmp *= fdUnitsTime(units->iTime); fsUnitsRate(units->iTime, cUnit); @@ -4663,7 +4663,7 @@ void fvWriteD238UNumDt(BODY *body, CONTROL *control, OUTPUT *output, */ void fvWritedD238UPowerDt(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, - int iBody, double *dTmp, char cUnit[]) { + int iBody, double *dTmp, char **cUnit) { *dTmp = -1; } /** @@ -4681,7 +4681,7 @@ void fvWritedD238UPowerDt(BODY *body, CONTROL *control, OUTPUT *output, */ void fvWrite238UTimescale(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, - int iBody, double *dTmp, char cUnit[]) { + int iBody, double *dTmp, char **cUnit) { *dTmp = -1; } @@ -4701,12 +4701,12 @@ void fvWrite238UTimescale(BODY *body, CONTROL *control, OUTPUT *output, */ void fvWrite238UPowerMan(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, - int iBody, double *dTmp, char cUnit[]) { + int iBody, double *dTmp, char **cUnit) { /* Get total power from 238U */ *dTmp = fd238UPowerMan(update, iBody); if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { *dTmp /= fdUnitsPower(units->iTime, units->iMass, units->iLength); fsUnitsPower(units, cUnit); @@ -4727,11 +4727,11 @@ void fvWrite238UPowerMan(BODY *body, CONTROL *control, OUTPUT *output, */ void fvWrite238UMassMan(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, - double *dTmp, char cUnit[]) { + double *dTmp, char **cUnit) { *dTmp = body[iBody].d238UNumMan * MASS238U; if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { *dTmp /= fdUnitsMass(units->iMass); fsUnitsMass(units->iMass, cUnit); @@ -4752,11 +4752,11 @@ void fvWrite238UMassMan(BODY *body, CONTROL *control, OUTPUT *output, */ void fvWrite238UNumMan(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, - double *dTmp, char cUnit[]) { + double *dTmp, char **cUnit) { *dTmp = body[iBody].d238UNumMan; if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } /* else nothing, as it is a number */ } @@ -4777,12 +4777,12 @@ void fvWrite238UNumMan(BODY *body, CONTROL *control, OUTPUT *output, */ void fvWrite238UPowerCore(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, - int iBody, double *dTmp, char cUnit[]) { + int iBody, double *dTmp, char **cUnit) { /* Get total power from 238U */ *dTmp = fd238UPowerCore(update, iBody); if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { *dTmp /= fdUnitsPower(units->iTime, units->iMass, units->iLength); fsUnitsPower(units, cUnit); @@ -4803,11 +4803,11 @@ void fvWrite238UPowerCore(BODY *body, CONTROL *control, OUTPUT *output, */ void fvWrite238UMassCore(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, - int iBody, double *dTmp, char cUnit[]) { + int iBody, double *dTmp, char **cUnit) { *dTmp = body[iBody].d238UNumCore * MASS238U; if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { *dTmp /= fdUnitsMass(units->iMass); fsUnitsMass(units->iMass, cUnit); @@ -4828,11 +4828,11 @@ void fvWrite238UMassCore(BODY *body, CONTROL *control, OUTPUT *output, */ void fvWrite238UNumCore(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, - double *dTmp, char cUnit[]) { + double *dTmp, char **cUnit) { *dTmp = body[iBody].d238UNumCore; if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } /* else nothing, as it is a number */ } @@ -4853,12 +4853,12 @@ void fvWrite238UNumCore(BODY *body, CONTROL *control, OUTPUT *output, */ void fvWrite238UPowerCrust(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, - int iBody, double *dTmp, char cUnit[]) { + int iBody, double *dTmp, char **cUnit) { /* Get total power from 238U */ *dTmp = fd238UPowerCrust(update, iBody); if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { *dTmp /= fdUnitsPower(units->iTime, units->iMass, units->iLength); fsUnitsPower(units, cUnit); @@ -4879,11 +4879,11 @@ void fvWrite238UPowerCrust(BODY *body, CONTROL *control, OUTPUT *output, */ void fvWrite238UMassCrust(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, - int iBody, double *dTmp, char cUnit[]) { + int iBody, double *dTmp, char **cUnit) { *dTmp = body[iBody].d238UNumCrust * MASS238U; if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { *dTmp /= fdUnitsMass(units->iMass); fsUnitsMass(units->iMass, cUnit); @@ -4904,11 +4904,11 @@ void fvWrite238UMassCrust(BODY *body, CONTROL *control, OUTPUT *output, */ void fvWrite238UNumCrust(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, - int iBody, double *dTmp, char cUnit[]) { + int iBody, double *dTmp, char **cUnit) { *dTmp = body[iBody].d238UNumCrust; if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } /* else nothing, as it is a number */ } @@ -4928,11 +4928,11 @@ void fvWrite238UNumCrust(BODY *body, CONTROL *control, OUTPUT *output, */ void fvWrite238UPowerTot(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, - int iBody, double *dTmp, char cUnit[]) { + int iBody, double *dTmp, char **cUnit) { *dTmp = fd238UPower(update, iBody); if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { *dTmp /= fdUnitsPower(units->iTime, units->iMass, units->iLength); fsUnitsPower(units, cUnit); @@ -4956,13 +4956,13 @@ void fvWrite238UPowerTot(BODY *body, CONTROL *control, OUTPUT *output, */ void fvWrite235UEnFlux(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, - double *dTmp, char cUnit[]) { + double *dTmp, char **cUnit) { /* Get surface heat flux from 235U */ *dTmp = fd235UEnFlux(body, update, iBody); if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { *dTmp /= fdUnitsEnergyFlux(units->iTime, units->iMass, units->iLength); fsUnitsEnergyFlux(units, cUnit); @@ -4983,12 +4983,12 @@ void fvWrite235UEnFlux(BODY *body, CONTROL *control, OUTPUT *output, */ void fvWriteD235UNumDt(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, - double *dTmp, char cUnit[]) { + double *dTmp, char **cUnit) { *dTmp = *(update[iBody].pdD235UNumManDt); if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { *dTmp *= fdUnitsTime(units->iTime); fsUnitsRate(units->iTime, cUnit); @@ -5009,7 +5009,7 @@ void fvWriteD235UNumDt(BODY *body, CONTROL *control, OUTPUT *output, */ void fvWritedD235UPowerDt(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, - int iBody, double *dTmp, char cUnit[]) { + int iBody, double *dTmp, char **cUnit) { *dTmp = -1; } /** @@ -5027,7 +5027,7 @@ void fvWritedD235UPowerDt(BODY *body, CONTROL *control, OUTPUT *output, */ void fvWrite235UTimescale(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, - int iBody, double *dTmp, char cUnit[]) { + int iBody, double *dTmp, char **cUnit) { *dTmp = -1; } @@ -5047,12 +5047,12 @@ void fvWrite235UTimescale(BODY *body, CONTROL *control, OUTPUT *output, */ void fvWrite235UPowerMan(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, - int iBody, double *dTmp, char cUnit[]) { + int iBody, double *dTmp, char **cUnit) { /* Get total power from 235U */ *dTmp = -(*(update[iBody].pdD235UNumManDt)) * ENERGY235U; if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { *dTmp /= fdUnitsPower(units->iTime, units->iMass, units->iLength); fsUnitsPower(units, cUnit); @@ -5073,11 +5073,11 @@ void fvWrite235UPowerMan(BODY *body, CONTROL *control, OUTPUT *output, */ void fvWrite235UMassMan(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, - double *dTmp, char cUnit[]) { + double *dTmp, char **cUnit) { *dTmp = body[iBody].d235UNumMan * MASS235U; if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { *dTmp /= fdUnitsMass(units->iMass); fsUnitsMass(units->iMass, cUnit); @@ -5098,11 +5098,11 @@ void fvWrite235UMassMan(BODY *body, CONTROL *control, OUTPUT *output, */ void fvWrite235UNumMan(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, - double *dTmp, char cUnit[]) { + double *dTmp, char **cUnit) { *dTmp = body[iBody].d235UNumMan; if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } /* else nothing, as it is a number */ } @@ -5123,12 +5123,12 @@ void fvWrite235UNumMan(BODY *body, CONTROL *control, OUTPUT *output, */ void fvWrite235UPowerCore(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, - int iBody, double *dTmp, char cUnit[]) { + int iBody, double *dTmp, char **cUnit) { /* Get total power from 235U */ *dTmp = fd235UPowerCore(update, iBody); if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { *dTmp /= fdUnitsPower(units->iTime, units->iMass, units->iLength); fsUnitsPower(units, cUnit); @@ -5149,11 +5149,11 @@ void fvWrite235UPowerCore(BODY *body, CONTROL *control, OUTPUT *output, */ void fvWrite235UMassCore(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, - int iBody, double *dTmp, char cUnit[]) { + int iBody, double *dTmp, char **cUnit) { *dTmp = body[iBody].d235UNumCore * MASS235U; if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { *dTmp /= fdUnitsMass(units->iMass); fsUnitsMass(units->iMass, cUnit); @@ -5174,11 +5174,11 @@ void fvWrite235UMassCore(BODY *body, CONTROL *control, OUTPUT *output, */ void fvWrite235UNumCore(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, - double *dTmp, char cUnit[]) { + double *dTmp, char **cUnit) { *dTmp = body[iBody].d235UNumCore; if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } /* else nothing, as it is a number */ } @@ -5199,12 +5199,12 @@ void fvWrite235UNumCore(BODY *body, CONTROL *control, OUTPUT *output, */ void fvWrite235UPowerCrust(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, - int iBody, double *dTmp, char cUnit[]) { + int iBody, double *dTmp, char **cUnit) { /* Get total power from 235U */ *dTmp = fd235UPowerCrust(update, iBody); if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { *dTmp /= fdUnitsPower(units->iTime, units->iMass, units->iLength); fsUnitsPower(units, cUnit); @@ -5225,11 +5225,11 @@ void fvWrite235UPowerCrust(BODY *body, CONTROL *control, OUTPUT *output, */ void fvWrite235UMassCrust(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, - int iBody, double *dTmp, char cUnit[]) { + int iBody, double *dTmp, char **cUnit) { *dTmp = body[iBody].d235UNumCrust * MASS235U; if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { *dTmp /= fdUnitsMass(units->iMass); fsUnitsMass(units->iMass, cUnit); @@ -5250,11 +5250,11 @@ void fvWrite235UMassCrust(BODY *body, CONTROL *control, OUTPUT *output, */ void fvWrite235UNumCrust(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, - int iBody, double *dTmp, char cUnit[]) { + int iBody, double *dTmp, char **cUnit) { *dTmp = body[iBody].d235UNumCrust; if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } /* else nothing, as it is a number */ } @@ -5274,11 +5274,11 @@ void fvWrite235UNumCrust(BODY *body, CONTROL *control, OUTPUT *output, */ void fvWrite235UPowerTot(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, - int iBody, double *dTmp, char cUnit[]) { + int iBody, double *dTmp, char **cUnit) { *dTmp = fd235UPower(update, iBody); if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { *dTmp /= fdUnitsPower(units->iTime, units->iMass, units->iLength); fsUnitsPower(units, cUnit); @@ -5302,12 +5302,12 @@ void fvWrite235UPowerTot(BODY *body, CONTROL *control, OUTPUT *output, */ void fvWriteRadPowerCrust(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, - int iBody, double *dTmp, char cUnit[]) { + int iBody, double *dTmp, char **cUnit) { /* Radiogenic Power Production in crust*/ *dTmp = fdRadPowerCrust(update, iBody); if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { *dTmp /= fdUnitsPower(units->iTime, units->iMass, units->iLength); fsUnitsPower(units, cUnit); @@ -5328,12 +5328,12 @@ void fvWriteRadPowerCrust(BODY *body, CONTROL *control, OUTPUT *output, */ void fvWriteRadPowerMan(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, - double *dTmp, char cUnit[]) { + double *dTmp, char **cUnit) { /* Radiogenic Power Production in mantle*/ *dTmp = fdRadPowerMan(update, iBody); if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { *dTmp /= fdUnitsPower(units->iTime, units->iMass, units->iLength); fsUnitsPower(units, cUnit); @@ -5354,12 +5354,12 @@ void fvWriteRadPowerMan(BODY *body, CONTROL *control, OUTPUT *output, */ void fvWriteRadPowerCore(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, - int iBody, double *dTmp, char cUnit[]) { + int iBody, double *dTmp, char **cUnit) { /* Total Radiogenic Power Production in core*/ *dTmp = fdRadPowerCore(update, iBody); if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { *dTmp /= fdUnitsPower(units->iTime, units->iMass, units->iLength); fsUnitsPower(units, cUnit); @@ -5380,12 +5380,12 @@ void fvWriteRadPowerCore(BODY *body, CONTROL *control, OUTPUT *output, */ void fvWriteRadPowerTotal(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, - int iBody, double *dTmp, char cUnit[]) { + int iBody, double *dTmp, char **cUnit) { /* Total Radiogenic Power Production */ *dTmp = body[iBody].dRadPowerTotal; if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { *dTmp /= fdUnitsPower(units->iTime, units->iMass, units->iLength); fsUnitsPower(units, cUnit); @@ -5406,12 +5406,12 @@ void fvWriteRadPowerTotal(BODY *body, CONTROL *control, OUTPUT *output, */ void fvWriteSurfEnFluxRadTotal(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, - int iBody, double *dTmp, char cUnit[]) { + int iBody, double *dTmp, char **cUnit) { /* Radiogenic Surface Energy Flux */ *dTmp = fdSurfEnFluxRadTotal(body, system, update, iBody, iBody); if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { *dTmp /= fdUnitsEnergyFlux(units->iTime, units->iMass, units->iLength); fsUnitsEnergyFlux(units, cUnit); @@ -5427,28 +5427,28 @@ void fvWriteSurfEnFluxRadTotal(BODY *body, CONTROL *control, OUTPUT *output, */ void fvInitializeOutputRadheat(OUTPUT *output, fnWriteOutput fnWrite[]) { /* Aluminum */ - sprintf(output[OUT_26ALPOWERMAN].cName, "26AlPowerMan"); - sprintf(output[OUT_26ALPOWERMAN].cDescr, "Total Power Generated by 26Al"); - sprintf(output[OUT_26ALPOWERMAN].cNeg, "TW"); + fvFormattedString(&output[OUT_26ALPOWERMAN].cName, "26AlPowerMan"); + fvFormattedString(&output[OUT_26ALPOWERMAN].cDescr, "Total Power Generated by 26Al"); + fvFormattedString(&output[OUT_26ALPOWERMAN].cNeg, "TW"); output[OUT_26ALPOWERMAN].bNeg = 1; output[OUT_26ALPOWERMAN].dNeg = 1e-12; output[OUT_26ALPOWERMAN].iNum = 1; output[OUT_26ALPOWERMAN].iModuleBit = RADHEAT; fnWrite[OUT_26ALPOWERMAN] = &fvWrite26AlPowerMan; - sprintf(output[OUT_26ALENFLUX].cName, "26AlEnFlux"); - sprintf(output[OUT_26ALENFLUX].cDescr, "Surface Energy Flux from 26Al"); - sprintf(output[OUT_26ALENFLUX].cNeg, "W/m^2"); + fvFormattedString(&output[OUT_26ALENFLUX].cName, "26AlEnFlux"); + fvFormattedString(&output[OUT_26ALENFLUX].cDescr, "Surface Energy Flux from 26Al"); + fvFormattedString(&output[OUT_26ALENFLUX].cNeg, "W/m^2"); output[OUT_26ALENFLUX].bNeg = 1; output[OUT_26ALENFLUX].dNeg = 1; output[OUT_26ALENFLUX].iNum = 1; output[OUT_26ALENFLUX].iModuleBit = RADHEAT; fnWrite[OUT_26ALENFLUX] = &fvWrite26AlEnFlux; - sprintf(output[OUT_26ALDPOWERDT].cName, "D26AlPowerDt"); - sprintf(output[OUT_26ALDPOWERDT].cDescr, + fvFormattedString(&output[OUT_26ALDPOWERDT].cName, "D26AlPowerDt"); + fvFormattedString(&output[OUT_26ALDPOWERDT].cDescr, "Time Rate of Change of 26Al Power Generation"); - sprintf(output[OUT_26ALDPOWERDT].cNeg, "TW/Gyr"); + fvFormattedString(&output[OUT_26ALDPOWERDT].cNeg, "TW/Gyr"); output[OUT_26ALDPOWERDT].bNeg = 1; output[OUT_26ALDPOWERDT].dNeg = 1e9 / 1e12; //[yr/Gyr*TW/W] //1e12/1e9; /* XXX */ @@ -5456,37 +5456,37 @@ void fvInitializeOutputRadheat(OUTPUT *output, fnWriteOutput fnWrite[]) { output[OUT_26ALDPOWERDT].iModuleBit = RADHEAT; fnWrite[OUT_26ALDPOWERDT] = &fvWriteD26AlPowerDt; - sprintf(output[OUT_26ALDNUMDT].cName, "D26AlNumManDt"); - sprintf(output[OUT_26ALDNUMDT].cDescr, + fvFormattedString(&output[OUT_26ALDNUMDT].cName, "D26AlNumManDt"); + fvFormattedString(&output[OUT_26ALDNUMDT].cDescr, "Time Rate of Change of 26Al Heat Generation"); - sprintf(output[OUT_26ALDNUMDT].cNeg, "/Gyr"); + fvFormattedString(&output[OUT_26ALDNUMDT].cNeg, "/Gyr"); output[OUT_26ALDNUMDT].bNeg = 1; output[OUT_26ALDNUMDT].dNeg = YEARSEC * 1e9; //[s/Gyr] output[OUT_26ALDNUMDT].iNum = 1; output[OUT_26ALDNUMDT].iModuleBit = RADHEAT; fnWrite[OUT_26ALDNUMDT] = &fvWriteD26AlNumDt; - sprintf(output[OUT_26ALTIME].cName, "26AlTimescale"); - sprintf(output[OUT_26ALTIME].cDescr, "Timescale for 26Al Power Generation"); - sprintf(output[OUT_26ALTIME].cNeg, "Gyr"); + fvFormattedString(&output[OUT_26ALTIME].cName, "26AlTimescale"); + fvFormattedString(&output[OUT_26ALTIME].cDescr, "Timescale for 26Al Power Generation"); + fvFormattedString(&output[OUT_26ALTIME].cNeg, "Gyr"); output[OUT_26ALTIME].bNeg = 1; output[OUT_26ALTIME].dNeg = 1 / (YEARSEC * 1e9); //[Gyr/s] //YEARSEC*1e9; output[OUT_26ALTIME].iNum = 1; output[OUT_26ALTIME].iModuleBit = RADHEAT; fnWrite[OUT_26ALTIME] = &fvWrite26AlTimescale; - sprintf(output[OUT_26ALMASSMAN].cName, "26AlMassMan"); - sprintf(output[OUT_26ALMASSMAN].cDescr, "Mass of Mantle in 26Al"); - sprintf(output[OUT_26ALMASSMAN].cNeg, "Mearth"); + fvFormattedString(&output[OUT_26ALMASSMAN].cName, "26AlMassMan"); + fvFormattedString(&output[OUT_26ALMASSMAN].cDescr, "Mass of Mantle in 26Al"); + fvFormattedString(&output[OUT_26ALMASSMAN].cNeg, "Mearth"); output[OUT_26ALMASSMAN].bNeg = 1; output[OUT_26ALMASSMAN].dNeg = 1. / MEARTH; //[EMass/kg] output[OUT_26ALMASSMAN].iNum = 1; output[OUT_26ALMASSMAN].iModuleBit = RADHEAT; fnWrite[OUT_26ALMASSMAN] = &fvWrite26AlMassMan; - sprintf(output[OUT_26ALNUMMAN].cName, "26AlNumMan"); - sprintf(output[OUT_26ALNUMMAN].cDescr, "Total Number of 26Al Atoms"); - sprintf(output[OUT_26ALNUMMAN].cNeg, "Initial Primordial Earth Number"); + fvFormattedString(&output[OUT_26ALNUMMAN].cName, "26AlNumMan"); + fvFormattedString(&output[OUT_26ALNUMMAN].cDescr, "Total Number of 26Al Atoms"); + fvFormattedString(&output[OUT_26ALNUMMAN].cNeg, "Initial Primordial Earth Number"); output[OUT_26ALNUMMAN].bNeg = 1; output[OUT_26ALNUMMAN].dNeg = EMASSMAN26AL / MASS26AL; output[OUT_26ALNUMMAN].iNum = 1; @@ -5494,37 +5494,37 @@ void fvInitializeOutputRadheat(OUTPUT *output, fnWriteOutput fnWrite[]) { fnWrite[OUT_26ALNUMMAN] = &fvWrite26AlNumMan; /* Core */ - sprintf(output[OUT_26ALPOWERCORE].cName, "26AlPowerCore"); - sprintf(output[OUT_26ALPOWERCORE].cDescr, "Core Power Generated by 26Al"); - sprintf(output[OUT_26ALPOWERCORE].cNeg, "TW"); + fvFormattedString(&output[OUT_26ALPOWERCORE].cName, "26AlPowerCore"); + fvFormattedString(&output[OUT_26ALPOWERCORE].cDescr, "Core Power Generated by 26Al"); + fvFormattedString(&output[OUT_26ALPOWERCORE].cNeg, "TW"); output[OUT_26ALPOWERCORE].bNeg = 1; output[OUT_26ALPOWERCORE].dNeg = 1 / 1e12; //[TW/W] output[OUT_26ALPOWERCORE].iNum = 1; output[OUT_26ALPOWERCORE].iModuleBit = RADHEAT; fnWrite[OUT_26ALPOWERCORE] = &fvWrite26AlPowerCore; - sprintf(output[OUT_26ALMASSCORE].cName, "26AlMassCore"); - sprintf(output[OUT_26ALMASSCORE].cDescr, "Mass of core in 26Al"); - sprintf(output[OUT_26ALMASSCORE].cNeg, "Mearth"); + fvFormattedString(&output[OUT_26ALMASSCORE].cName, "26AlMassCore"); + fvFormattedString(&output[OUT_26ALMASSCORE].cDescr, "Mass of core in 26Al"); + fvFormattedString(&output[OUT_26ALMASSCORE].cNeg, "Mearth"); output[OUT_26ALMASSCORE].bNeg = 1; output[OUT_26ALMASSCORE].dNeg = 1. / MEARTH; output[OUT_26ALMASSCORE].iNum = 1; output[OUT_26ALMASSCORE].iModuleBit = RADHEAT; fnWrite[OUT_26ALMASSCORE] = &fvWrite26AlMassCore; - sprintf(output[OUT_26ALNUMCORE].cName, "26AlNumCore"); - sprintf(output[OUT_26ALNUMCORE].cDescr, "Total Core Number of 26Al Atoms"); - sprintf(output[OUT_26ALNUMCORE].cNeg, "Initial Primordial Earth Number"); + fvFormattedString(&output[OUT_26ALNUMCORE].cName, "26AlNumCore"); + fvFormattedString(&output[OUT_26ALNUMCORE].cDescr, "Total Core Number of 26Al Atoms"); + fvFormattedString(&output[OUT_26ALNUMCORE].cNeg, "Initial Primordial Earth Number"); output[OUT_26ALNUMCORE].bNeg = 1; output[OUT_26ALNUMCORE].dNeg = EMASSCORE26AL / MASS26AL; output[OUT_26ALNUMCORE].iNum = 1; output[OUT_26ALNUMCORE].iModuleBit = RADHEAT; fnWrite[OUT_26ALNUMCORE] = &fvWrite26AlNumCore; - sprintf(output[OUT_26ALPOWERTOT].cName, "26AlPowerTotal"); - sprintf(output[OUT_26ALPOWERTOT].cDescr, + fvFormattedString(&output[OUT_26ALPOWERTOT].cName, "26AlPowerTotal"); + fvFormattedString(&output[OUT_26ALPOWERTOT].cDescr, "Total Power from Decay of 26Al Atoms"); - sprintf(output[OUT_26ALPOWERTOT].cNeg, "TW"); + fvFormattedString(&output[OUT_26ALPOWERTOT].cNeg, "TW"); output[OUT_26ALPOWERTOT].bNeg = 1; output[OUT_26ALPOWERTOT].dNeg = 1e-12; output[OUT_26ALPOWERTOT].iNum = 1; @@ -5532,65 +5532,65 @@ void fvInitializeOutputRadheat(OUTPUT *output, fnWriteOutput fnWrite[]) { fnWrite[OUT_26ALPOWERTOT] = &fvWrite26AlPowerTot; /* Potassium */ - sprintf(output[OUT_40KENFLUX].cName, "40KEnFlux"); - sprintf(output[OUT_40KENFLUX].cDescr, "Surface Energy Flux from 40K"); - sprintf(output[OUT_40KENFLUX].cNeg, "W/m^2"); + fvFormattedString(&output[OUT_40KENFLUX].cName, "40KEnFlux"); + fvFormattedString(&output[OUT_40KENFLUX].cDescr, "Surface Energy Flux from 40K"); + fvFormattedString(&output[OUT_40KENFLUX].cNeg, "W/m^2"); output[OUT_40KENFLUX].bNeg = 1; output[OUT_40KENFLUX].dNeg = 1; output[OUT_40KENFLUX].iNum = 1; output[OUT_40KENFLUX].iModuleBit = RADHEAT; fnWrite[OUT_40KENFLUX] = &fvWrite40KEnFlux; - sprintf(output[OUT_40KDPOWERDT].cName, "D40KPowerDt"); - sprintf(output[OUT_40KDPOWERDT].cDescr, + fvFormattedString(&output[OUT_40KDPOWERDT].cName, "D40KPowerDt"); + fvFormattedString(&output[OUT_40KDPOWERDT].cDescr, "Time Rate of Change of 40K Power Generation"); - sprintf(output[OUT_40KDPOWERDT].cNeg, "TW/Gyr"); + fvFormattedString(&output[OUT_40KDPOWERDT].cNeg, "TW/Gyr"); output[OUT_40KDPOWERDT].bNeg = 1; output[OUT_40KDPOWERDT].dNeg = 1e9 / 1e12; /* :) */ output[OUT_40KDPOWERDT].iNum = 1; output[OUT_40KDPOWERDT].iModuleBit = RADHEAT; fnWrite[OUT_40KDPOWERDT] = &fvWriteD40KPowerDt; - sprintf(output[OUT_40KDNUMDT].cName, "D40KNumManDt"); - sprintf(output[OUT_40KDNUMDT].cDescr, + fvFormattedString(&output[OUT_40KDNUMDT].cName, "D40KNumManDt"); + fvFormattedString(&output[OUT_40KDNUMDT].cDescr, "Time Rate of Change of 40K Heat Generation"); - sprintf(output[OUT_40KDNUMDT].cNeg, "/Gyr"); + fvFormattedString(&output[OUT_40KDNUMDT].cNeg, "/Gyr"); output[OUT_40KDNUMDT].bNeg = 1; output[OUT_40KDNUMDT].dNeg = YEARSEC * 1e9; output[OUT_40KDNUMDT].iNum = 1; output[OUT_40KDNUMDT].iModuleBit = RADHEAT; fnWrite[OUT_40KDNUMDT] = &fvWriteD40KNumDt; - sprintf(output[OUT_40KTIME].cName, "40KTimescale"); - sprintf(output[OUT_40KTIME].cDescr, "Timescale for 40K Power Generation"); - sprintf(output[OUT_40KTIME].cNeg, "Gyr"); + fvFormattedString(&output[OUT_40KTIME].cName, "40KTimescale"); + fvFormattedString(&output[OUT_40KTIME].cDescr, "Timescale for 40K Power Generation"); + fvFormattedString(&output[OUT_40KTIME].cNeg, "Gyr"); output[OUT_40KTIME].bNeg = 1; output[OUT_40KTIME].dNeg = 1 / (YEARSEC * 1e9); output[OUT_40KTIME].iNum = 1; output[OUT_40KTIME].iModuleBit = RADHEAT; fnWrite[OUT_40KTIME] = &fvWrite40KTimescale; - sprintf(output[OUT_40KPOWERMAN].cName, "40KPowerMan"); - sprintf(output[OUT_40KPOWERMAN].cDescr, "Total Power Generated by 40K"); - sprintf(output[OUT_40KPOWERMAN].cNeg, "TW"); + fvFormattedString(&output[OUT_40KPOWERMAN].cName, "40KPowerMan"); + fvFormattedString(&output[OUT_40KPOWERMAN].cDescr, "Total Power Generated by 40K"); + fvFormattedString(&output[OUT_40KPOWERMAN].cNeg, "TW"); output[OUT_40KPOWERMAN].bNeg = 1; output[OUT_40KPOWERMAN].dNeg = 1e-12; output[OUT_40KPOWERMAN].iNum = 1; output[OUT_40KPOWERMAN].iModuleBit = RADHEAT; fnWrite[OUT_40KPOWERMAN] = &fvWrite40KPowerMan; - sprintf(output[OUT_40KMASSMAN].cName, "40KMassMan"); - sprintf(output[OUT_40KMASSMAN].cDescr, "Total Mass of 40K"); - sprintf(output[OUT_40KMASSMAN].cNeg, "Mearth"); + fvFormattedString(&output[OUT_40KMASSMAN].cName, "40KMassMan"); + fvFormattedString(&output[OUT_40KMASSMAN].cDescr, "Total Mass of 40K"); + fvFormattedString(&output[OUT_40KMASSMAN].cNeg, "Mearth"); output[OUT_40KMASSMAN].bNeg = 1; output[OUT_40KMASSMAN].dNeg = 1. / MEARTH; output[OUT_40KMASSMAN].iNum = 1; output[OUT_40KMASSMAN].iModuleBit = RADHEAT; fnWrite[OUT_40KMASSMAN] = &fvWrite40KMassMan; - sprintf(output[OUT_40KNUMMAN].cName, "40KNumMan"); - sprintf(output[OUT_40KNUMMAN].cDescr, "Total Number of 40K Atoms"); - sprintf(output[OUT_40KNUMMAN].cNeg, "Initial Primordial Earth Number"); + fvFormattedString(&output[OUT_40KNUMMAN].cName, "40KNumMan"); + fvFormattedString(&output[OUT_40KNUMMAN].cDescr, "Total Number of 40K Atoms"); + fvFormattedString(&output[OUT_40KNUMMAN].cNeg, "Initial Primordial Earth Number"); output[OUT_40KNUMMAN].bNeg = 1; output[OUT_40KNUMMAN].dNeg = EMASSMAN40K / MASS40K; output[OUT_40KNUMMAN].iNum = 1; @@ -5598,27 +5598,27 @@ void fvInitializeOutputRadheat(OUTPUT *output, fnWriteOutput fnWrite[]) { fnWrite[OUT_40KNUMMAN] = &fvWrite40KNumMan; /* Core */ - sprintf(output[OUT_40KPOWERCORE].cName, "40KPowerCore"); - sprintf(output[OUT_40KPOWERCORE].cDescr, "Core Power Generated by 40K"); - sprintf(output[OUT_40KPOWERCORE].cNeg, "TW"); + fvFormattedString(&output[OUT_40KPOWERCORE].cName, "40KPowerCore"); + fvFormattedString(&output[OUT_40KPOWERCORE].cDescr, "Core Power Generated by 40K"); + fvFormattedString(&output[OUT_40KPOWERCORE].cNeg, "TW"); output[OUT_40KPOWERCORE].bNeg = 1; output[OUT_40KPOWERCORE].dNeg = 1e-12; // ergs/s -> TW output[OUT_40KPOWERCORE].iNum = 1; output[OUT_40KPOWERCORE].iModuleBit = RADHEAT; fnWrite[OUT_40KPOWERCORE] = &fvWrite40KPowerCore; - sprintf(output[OUT_40KMASSCORE].cName, "40KMassCore"); - sprintf(output[OUT_40KMASSCORE].cDescr, "Total Core Mass of 40K"); - sprintf(output[OUT_40KMASSCORE].cNeg, "Mearth"); + fvFormattedString(&output[OUT_40KMASSCORE].cName, "40KMassCore"); + fvFormattedString(&output[OUT_40KMASSCORE].cDescr, "Total Core Mass of 40K"); + fvFormattedString(&output[OUT_40KMASSCORE].cNeg, "Mearth"); output[OUT_40KMASSCORE].bNeg = 1; output[OUT_40KMASSCORE].dNeg = 1. / MEARTH; output[OUT_40KMASSCORE].iNum = 1; output[OUT_40KMASSCORE].iModuleBit = RADHEAT; fnWrite[OUT_40KMASSCORE] = &fvWrite40KMassCore; - sprintf(output[OUT_40KNUMCORE].cName, "40KNumCore"); - sprintf(output[OUT_40KNUMCORE].cDescr, "Total Core Number of 40K Atoms"); - sprintf(output[OUT_40KNUMCORE].cNeg, "Initial Primordial Earth Number"); + fvFormattedString(&output[OUT_40KNUMCORE].cName, "40KNumCore"); + fvFormattedString(&output[OUT_40KNUMCORE].cDescr, "Total Core Number of 40K Atoms"); + fvFormattedString(&output[OUT_40KNUMCORE].cNeg, "Initial Primordial Earth Number"); output[OUT_40KNUMCORE].bNeg = 1; output[OUT_40KNUMCORE].dNeg = EMASSCORE40K / MASS40K; output[OUT_40KNUMCORE].iNum = 1; @@ -5626,37 +5626,37 @@ void fvInitializeOutputRadheat(OUTPUT *output, fnWriteOutput fnWrite[]) { fnWrite[OUT_40KNUMCORE] = &fvWrite40KNumCore; /* Crust */ - sprintf(output[OUT_40KPOWERCRUST].cName, "40KPowerCrust"); - sprintf(output[OUT_40KPOWERCRUST].cDescr, "Crust Power Generated by 40K"); - sprintf(output[OUT_40KPOWERCRUST].cNeg, "TW"); + fvFormattedString(&output[OUT_40KPOWERCRUST].cName, "40KPowerCrust"); + fvFormattedString(&output[OUT_40KPOWERCRUST].cDescr, "Crust Power Generated by 40K"); + fvFormattedString(&output[OUT_40KPOWERCRUST].cNeg, "TW"); output[OUT_40KPOWERCRUST].bNeg = 1; output[OUT_40KPOWERCRUST].dNeg = 1e-12; // ergs/s -> TW output[OUT_40KPOWERCRUST].iNum = 1; output[OUT_40KPOWERCRUST].iModuleBit = RADHEAT; fnWrite[OUT_40KPOWERCRUST] = &fvWrite40KPowerCrust; - sprintf(output[OUT_40KMASSCRUST].cName, "40KMassCrust"); - sprintf(output[OUT_40KMASSCRUST].cDescr, "Total Crust Mass of 40K"); - sprintf(output[OUT_40KMASSCRUST].cNeg, "Mearth"); + fvFormattedString(&output[OUT_40KMASSCRUST].cName, "40KMassCrust"); + fvFormattedString(&output[OUT_40KMASSCRUST].cDescr, "Total Crust Mass of 40K"); + fvFormattedString(&output[OUT_40KMASSCRUST].cNeg, "Mearth"); output[OUT_40KMASSCRUST].bNeg = 1; output[OUT_40KMASSCRUST].dNeg = 1. / MEARTH; output[OUT_40KMASSCRUST].iNum = 1; output[OUT_40KMASSCRUST].iModuleBit = RADHEAT; fnWrite[OUT_40KMASSCRUST] = &fvWrite40KMassCrust; - sprintf(output[OUT_40KNUMCRUST].cName, "40KNumCrust"); - sprintf(output[OUT_40KNUMCRUST].cDescr, "Total Crust Number of 40K Atoms"); - sprintf(output[OUT_40KNUMCRUST].cNeg, "Initial Primordial Earth Number"); + fvFormattedString(&output[OUT_40KNUMCRUST].cName, "40KNumCrust"); + fvFormattedString(&output[OUT_40KNUMCRUST].cDescr, "Total Crust Number of 40K Atoms"); + fvFormattedString(&output[OUT_40KNUMCRUST].cNeg, "Initial Primordial Earth Number"); output[OUT_40KNUMCRUST].bNeg = 1; output[OUT_40KNUMCRUST].dNeg = EMASSCRUST40K / MASS40K; output[OUT_40KNUMCRUST].iNum = 1; output[OUT_40KNUMCRUST].iModuleBit = RADHEAT; fnWrite[OUT_40KNUMCRUST] = &fvWrite40KNumCrust; - sprintf(output[OUT_40KPOWERTOT].cName, "40KPowerTotal"); - sprintf(output[OUT_40KPOWERTOT].cDescr, + fvFormattedString(&output[OUT_40KPOWERTOT].cName, "40KPowerTotal"); + fvFormattedString(&output[OUT_40KPOWERTOT].cDescr, "Total Power from Decay of 40K Atoms"); - sprintf(output[OUT_40KPOWERTOT].cNeg, "TW"); + fvFormattedString(&output[OUT_40KPOWERTOT].cNeg, "TW"); output[OUT_40KPOWERTOT].bNeg = 1; output[OUT_40KPOWERTOT].dNeg = 1e-12; output[OUT_40KPOWERTOT].iNum = 1; @@ -5664,55 +5664,55 @@ void fvInitializeOutputRadheat(OUTPUT *output, fnWriteOutput fnWrite[]) { fnWrite[OUT_40KPOWERTOT] = &fvWrite40KPowerTot; /* Thorium */ - sprintf(output[OUT_232THPOWERMAN].cName, "232ThPowerMan"); - sprintf(output[OUT_232THPOWERMAN].cDescr, "Total Power Generated by 232Th"); - sprintf(output[OUT_232THPOWERMAN].cNeg, "TW"); + fvFormattedString(&output[OUT_232THPOWERMAN].cName, "232ThPowerMan"); + fvFormattedString(&output[OUT_232THPOWERMAN].cDescr, "Total Power Generated by 232Th"); + fvFormattedString(&output[OUT_232THPOWERMAN].cNeg, "TW"); output[OUT_232THPOWERMAN].bNeg = 1; output[OUT_232THPOWERMAN].dNeg = 1e-12; output[OUT_232THPOWERMAN].iNum = 1; output[OUT_232THPOWERMAN].iModuleBit = RADHEAT; fnWrite[OUT_232THPOWERMAN] = &fvWrite232ThPowerMan; - sprintf(output[OUT_232THENFLUX].cName, "232ThEnFlux"); - sprintf(output[OUT_232THENFLUX].cDescr, "Surface Energy Flux from 232Th"); - sprintf(output[OUT_232THENFLUX].cNeg, "W/m^2"); + fvFormattedString(&output[OUT_232THENFLUX].cName, "232ThEnFlux"); + fvFormattedString(&output[OUT_232THENFLUX].cDescr, "Surface Energy Flux from 232Th"); + fvFormattedString(&output[OUT_232THENFLUX].cNeg, "W/m^2"); output[OUT_232THENFLUX].bNeg = 1; output[OUT_232THENFLUX].dNeg = 1; output[OUT_232THENFLUX].iNum = 1; output[OUT_232THENFLUX].iModuleBit = RADHEAT; fnWrite[OUT_232THENFLUX] = &fvWrite232ThEnFlux; - sprintf(output[OUT_232THDNUMDT].cName, "D232ThNumManDt"); - sprintf(output[OUT_232THDNUMDT].cDescr, + fvFormattedString(&output[OUT_232THDNUMDT].cName, "D232ThNumManDt"); + fvFormattedString(&output[OUT_232THDNUMDT].cDescr, "Time Rate of Change of the number of 232Th nuclei"); - sprintf(output[OUT_232THDNUMDT].cNeg, "/Gyr"); + fvFormattedString(&output[OUT_232THDNUMDT].cNeg, "/Gyr"); output[OUT_232THDNUMDT].bNeg = 1; output[OUT_232THDNUMDT].dNeg = YEARSEC * 1e9; output[OUT_232THDNUMDT].iNum = 1; output[OUT_232THDNUMDT].iModuleBit = RADHEAT; fnWrite[OUT_232THDNUMDT] = &fvWriteD232ThNumDt; - sprintf(output[OUT_232THTIME].cName, "232ThTimescale"); - sprintf(output[OUT_232THTIME].cDescr, "Timescale for 232Th Power Generation"); - sprintf(output[OUT_232THTIME].cNeg, "Gyr"); + fvFormattedString(&output[OUT_232THTIME].cName, "232ThTimescale"); + fvFormattedString(&output[OUT_232THTIME].cDescr, "Timescale for 232Th Power Generation"); + fvFormattedString(&output[OUT_232THTIME].cNeg, "Gyr"); output[OUT_232THTIME].bNeg = 1; output[OUT_232THTIME].dNeg = 1. / (YEARSEC * 1e9); output[OUT_232THTIME].iNum = 1; output[OUT_232THTIME].iModuleBit = RADHEAT; fnWrite[OUT_232THTIME] = &fvWrite232ThTimescale; - sprintf(output[OUT_232THMASSMAN].cName, "232ThMassMan"); - sprintf(output[OUT_232THMASSMAN].cDescr, "Total Mass of 232Th"); - sprintf(output[OUT_232THMASSMAN].cNeg, "Mearth"); + fvFormattedString(&output[OUT_232THMASSMAN].cName, "232ThMassMan"); + fvFormattedString(&output[OUT_232THMASSMAN].cDescr, "Total Mass of 232Th"); + fvFormattedString(&output[OUT_232THMASSMAN].cNeg, "Mearth"); output[OUT_232THMASSMAN].bNeg = 1; output[OUT_232THMASSMAN].dNeg = 1. / MEARTH; output[OUT_232THMASSMAN].iNum = 1; output[OUT_232THMASSMAN].iModuleBit = RADHEAT; fnWrite[OUT_232THMASSMAN] = &fvWrite232ThMassMan; - sprintf(output[OUT_232THNUMMAN].cName, "232ThNumMan"); - sprintf(output[OUT_232THNUMMAN].cDescr, "Total Number of 232Th Atoms"); - sprintf(output[OUT_232THNUMMAN].cNeg, "Initial Primordial Earth Number"); + fvFormattedString(&output[OUT_232THNUMMAN].cName, "232ThNumMan"); + fvFormattedString(&output[OUT_232THNUMMAN].cDescr, "Total Number of 232Th Atoms"); + fvFormattedString(&output[OUT_232THNUMMAN].cNeg, "Initial Primordial Earth Number"); output[OUT_232THNUMMAN].bNeg = 1; output[OUT_232THNUMMAN].dNeg = EMASSMAN232TH / MASS232TH; output[OUT_232THNUMMAN].iNum = 1; @@ -5720,27 +5720,27 @@ void fvInitializeOutputRadheat(OUTPUT *output, fnWriteOutput fnWrite[]) { fnWrite[OUT_232THNUMMAN] = &fvWrite232ThNumMan; /* Core */ - sprintf(output[OUT_232THPOWERCORE].cName, "232ThPowerCore"); - sprintf(output[OUT_232THPOWERCORE].cDescr, "Total Power Generated by 232Th"); - sprintf(output[OUT_232THPOWERCORE].cNeg, "TW"); + fvFormattedString(&output[OUT_232THPOWERCORE].cName, "232ThPowerCore"); + fvFormattedString(&output[OUT_232THPOWERCORE].cDescr, "Total Power Generated by 232Th"); + fvFormattedString(&output[OUT_232THPOWERCORE].cNeg, "TW"); output[OUT_232THPOWERCORE].bNeg = 1; output[OUT_232THPOWERCORE].dNeg = 1e-12; output[OUT_232THPOWERCORE].iNum = 1; output[OUT_232THPOWERCORE].iModuleBit = RADHEAT; fnWrite[OUT_232THPOWERCORE] = &fvWrite232ThPowerCore; - sprintf(output[OUT_232THMASSCORE].cName, "232ThMassCore"); - sprintf(output[OUT_232THMASSCORE].cDescr, "Total Mass of 232Th"); - sprintf(output[OUT_232THMASSCORE].cNeg, "Mearth"); + fvFormattedString(&output[OUT_232THMASSCORE].cName, "232ThMassCore"); + fvFormattedString(&output[OUT_232THMASSCORE].cDescr, "Total Mass of 232Th"); + fvFormattedString(&output[OUT_232THMASSCORE].cNeg, "Mearth"); output[OUT_232THMASSCORE].bNeg = 1; output[OUT_232THMASSCORE].dNeg = 1. / MEARTH; output[OUT_232THMASSCORE].iNum = 1; output[OUT_232THMASSCORE].iModuleBit = RADHEAT; fnWrite[OUT_232THMASSCORE] = &fvWrite232ThMassCore; - sprintf(output[OUT_232THNUMCORE].cName, "232ThNumCore"); - sprintf(output[OUT_232THNUMCORE].cDescr, "Total Number of 232Th Atoms"); - sprintf(output[OUT_232THNUMCORE].cNeg, "Initial Primordial Earth Number"); + fvFormattedString(&output[OUT_232THNUMCORE].cName, "232ThNumCore"); + fvFormattedString(&output[OUT_232THNUMCORE].cDescr, "Total Number of 232Th Atoms"); + fvFormattedString(&output[OUT_232THNUMCORE].cNeg, "Initial Primordial Earth Number"); output[OUT_232THNUMCORE].bNeg = 1; output[OUT_232THNUMCORE].dNeg = EMASSCORE232TH / MASS232TH; output[OUT_232THNUMCORE].iNum = 1; @@ -5748,37 +5748,37 @@ void fvInitializeOutputRadheat(OUTPUT *output, fnWriteOutput fnWrite[]) { fnWrite[OUT_232THNUMCORE] = &fvWrite232ThNumCore; /* Crust */ - sprintf(output[OUT_232THPOWERCRUST].cName, "232ThPowerCrust"); - sprintf(output[OUT_232THPOWERCRUST].cDescr, "Total Power Generated by 232Th"); - sprintf(output[OUT_232THPOWERCRUST].cNeg, "TW"); + fvFormattedString(&output[OUT_232THPOWERCRUST].cName, "232ThPowerCrust"); + fvFormattedString(&output[OUT_232THPOWERCRUST].cDescr, "Total Power Generated by 232Th"); + fvFormattedString(&output[OUT_232THPOWERCRUST].cNeg, "TW"); output[OUT_232THPOWERCRUST].bNeg = 1; output[OUT_232THPOWERCRUST].dNeg = 1e-12; output[OUT_232THPOWERCRUST].iNum = 1; output[OUT_232THPOWERCRUST].iModuleBit = RADHEAT; fnWrite[OUT_232THPOWERCRUST] = &fvWrite232ThPowerCrust; - sprintf(output[OUT_232THMASSCRUST].cName, "232ThMassCrust"); - sprintf(output[OUT_232THMASSCRUST].cDescr, "Total Mass of 232Th"); - sprintf(output[OUT_232THMASSCRUST].cNeg, "Mearth"); + fvFormattedString(&output[OUT_232THMASSCRUST].cName, "232ThMassCrust"); + fvFormattedString(&output[OUT_232THMASSCRUST].cDescr, "Total Mass of 232Th"); + fvFormattedString(&output[OUT_232THMASSCRUST].cNeg, "Mearth"); output[OUT_232THMASSCRUST].bNeg = 1; output[OUT_232THMASSCRUST].dNeg = 1. / MEARTH; output[OUT_232THMASSCRUST].iNum = 1; output[OUT_232THMASSCRUST].iModuleBit = RADHEAT; fnWrite[OUT_232THMASSCRUST] = &fvWrite232ThMassCrust; - sprintf(output[OUT_232THNUMCRUST].cName, "232ThNumCrust"); - sprintf(output[OUT_232THNUMCRUST].cDescr, "Total Number of 232Th Atoms"); - sprintf(output[OUT_232THNUMCRUST].cNeg, "Initial Primordial Earth Number"); + fvFormattedString(&output[OUT_232THNUMCRUST].cName, "232ThNumCrust"); + fvFormattedString(&output[OUT_232THNUMCRUST].cDescr, "Total Number of 232Th Atoms"); + fvFormattedString(&output[OUT_232THNUMCRUST].cNeg, "Initial Primordial Earth Number"); output[OUT_232THNUMCRUST].bNeg = 1; output[OUT_232THNUMCRUST].dNeg = EMASSCRUST232TH / MASS232TH; output[OUT_232THNUMCRUST].iNum = 1; output[OUT_232THNUMCRUST].iModuleBit = RADHEAT; fnWrite[OUT_232THNUMCRUST] = &fvWrite232ThNumCrust; - sprintf(output[OUT_232THPOWERTOT].cName, "232ThPowerTotal"); - sprintf(output[OUT_232THPOWERTOT].cDescr, + fvFormattedString(&output[OUT_232THPOWERTOT].cName, "232ThPowerTotal"); + fvFormattedString(&output[OUT_232THPOWERTOT].cDescr, "Total Power from Decay of 232Th Atoms"); - sprintf(output[OUT_232THPOWERTOT].cNeg, "TW"); + fvFormattedString(&output[OUT_232THPOWERTOT].cNeg, "TW"); output[OUT_232THPOWERTOT].bNeg = 1; output[OUT_232THPOWERTOT].dNeg = 1e-12; output[OUT_232THPOWERTOT].iNum = 1; @@ -5788,55 +5788,55 @@ void fvInitializeOutputRadheat(OUTPUT *output, fnWriteOutput fnWrite[]) { /* Uranium 238 */ - sprintf(output[OUT_238UPOWERMAN].cName, "238UPowerMan"); - sprintf(output[OUT_238UPOWERMAN].cDescr, "Total Power Generated by 238U"); - sprintf(output[OUT_238UPOWERMAN].cNeg, "TW"); + fvFormattedString(&output[OUT_238UPOWERMAN].cName, "238UPowerMan"); + fvFormattedString(&output[OUT_238UPOWERMAN].cDescr, "Total Power Generated by 238U"); + fvFormattedString(&output[OUT_238UPOWERMAN].cNeg, "TW"); output[OUT_238UPOWERMAN].bNeg = 1; output[OUT_238UPOWERMAN].dNeg = 1e-12; output[OUT_238UPOWERMAN].iNum = 1; output[OUT_238UPOWERMAN].iModuleBit = RADHEAT; fnWrite[OUT_238UPOWERMAN] = &fvWrite238UPowerMan; - sprintf(output[OUT_238UENFLUX].cName, "238UEnFlux"); - sprintf(output[OUT_238UENFLUX].cDescr, "Surface Energy Flux due to 238U"); - sprintf(output[OUT_238UENFLUX].cNeg, "W/m^2"); + fvFormattedString(&output[OUT_238UENFLUX].cName, "238UEnFlux"); + fvFormattedString(&output[OUT_238UENFLUX].cDescr, "Surface Energy Flux due to 238U"); + fvFormattedString(&output[OUT_238UENFLUX].cNeg, "W/m^2"); output[OUT_238UENFLUX].bNeg = 1; output[OUT_238UENFLUX].dNeg = 1; output[OUT_238UENFLUX].iNum = 1; output[OUT_238UENFLUX].iModuleBit = RADHEAT; fnWrite[OUT_238UENFLUX] = &fvWrite238UEnFlux; - sprintf(output[OUT_238UDNUMDT].cName, "D238UNumManDt"); - sprintf(output[OUT_238UDNUMDT].cDescr, + fvFormattedString(&output[OUT_238UDNUMDT].cName, "D238UNumManDt"); + fvFormattedString(&output[OUT_238UDNUMDT].cDescr, "Time Rate of Change of the Number of 238U Nuclei"); - sprintf(output[OUT_238UDNUMDT].cNeg, "/Gyr"); + fvFormattedString(&output[OUT_238UDNUMDT].cNeg, "/Gyr"); output[OUT_238UDNUMDT].bNeg = 1; output[OUT_238UDNUMDT].dNeg = YEARSEC * 1e9; output[OUT_238UDNUMDT].iNum = 1; output[OUT_238UDNUMDT].iModuleBit = RADHEAT; fnWrite[OUT_238UDNUMDT] = &fvWriteD238UNumDt; - sprintf(output[OUT_238UTIME].cName, "238UTimescale"); - sprintf(output[OUT_238UTIME].cDescr, "Timescale for 238U Power Generation"); - sprintf(output[OUT_238UTIME].cNeg, "Gyr"); + fvFormattedString(&output[OUT_238UTIME].cName, "238UTimescale"); + fvFormattedString(&output[OUT_238UTIME].cDescr, "Timescale for 238U Power Generation"); + fvFormattedString(&output[OUT_238UTIME].cNeg, "Gyr"); output[OUT_238UTIME].bNeg = 1; output[OUT_238UTIME].dNeg = 1. / (YEARSEC * 1e9); output[OUT_238UTIME].iNum = 1; output[OUT_238UTIME].iModuleBit = RADHEAT; fnWrite[OUT_238UTIME] = &fvWrite238UTimescale; - sprintf(output[OUT_238UMASSMAN].cName, "238UMassMan"); - sprintf(output[OUT_238UMASSMAN].cDescr, "Total Mass of 238U"); - sprintf(output[OUT_238UMASSMAN].cNeg, "Mearth"); + fvFormattedString(&output[OUT_238UMASSMAN].cName, "238UMassMan"); + fvFormattedString(&output[OUT_238UMASSMAN].cDescr, "Total Mass of 238U"); + fvFormattedString(&output[OUT_238UMASSMAN].cNeg, "Mearth"); output[OUT_238UMASSMAN].bNeg = 1; output[OUT_238UMASSMAN].dNeg = 1. / MEARTH; output[OUT_238UMASSMAN].iNum = 1; output[OUT_238UMASSMAN].iModuleBit = RADHEAT; fnWrite[OUT_238UMASSMAN] = &fvWrite238UMassMan; - sprintf(output[OUT_238UNUMMAN].cName, "238UNumMan"); - sprintf(output[OUT_238UNUMMAN].cDescr, "Total Number of 238U Atoms"); - sprintf(output[OUT_238UNUMMAN].cNeg, "Initial Primordial Earth Number"); + fvFormattedString(&output[OUT_238UNUMMAN].cName, "238UNumMan"); + fvFormattedString(&output[OUT_238UNUMMAN].cDescr, "Total Number of 238U Atoms"); + fvFormattedString(&output[OUT_238UNUMMAN].cNeg, "Initial Primordial Earth Number"); output[OUT_238UNUMMAN].bNeg = 1; output[OUT_238UNUMMAN].dNeg = EMASSMAN238U / MASS238U; output[OUT_238UNUMMAN].iNum = 1; @@ -5844,28 +5844,28 @@ void fvInitializeOutputRadheat(OUTPUT *output, fnWriteOutput fnWrite[]) { fnWrite[OUT_238UNUMMAN] = &fvWrite238UNumMan; /* Core */ - sprintf(output[OUT_238UPOWERCORE].cName, "238UPowerCore"); - sprintf(output[OUT_238UPOWERCORE].cDescr, + fvFormattedString(&output[OUT_238UPOWERCORE].cName, "238UPowerCore"); + fvFormattedString(&output[OUT_238UPOWERCORE].cDescr, "Total Core Power Generated by 238U"); - sprintf(output[OUT_238UPOWERCORE].cNeg, "TW"); + fvFormattedString(&output[OUT_238UPOWERCORE].cNeg, "TW"); output[OUT_238UPOWERCORE].bNeg = 1; output[OUT_238UPOWERCORE].dNeg = 1e-12; output[OUT_238UPOWERCORE].iNum = 1; output[OUT_238UPOWERCORE].iModuleBit = RADHEAT; fnWrite[OUT_238UPOWERCORE] = &fvWrite238UPowerCore; - sprintf(output[OUT_238UMASSCORE].cName, "238UMassCore"); - sprintf(output[OUT_238UMASSCORE].cDescr, "Total Core Mass of 238U"); - sprintf(output[OUT_238UMASSCORE].cNeg, "Mearth"); + fvFormattedString(&output[OUT_238UMASSCORE].cName, "238UMassCore"); + fvFormattedString(&output[OUT_238UMASSCORE].cDescr, "Total Core Mass of 238U"); + fvFormattedString(&output[OUT_238UMASSCORE].cNeg, "Mearth"); output[OUT_238UMASSCORE].bNeg = 1; output[OUT_238UMASSCORE].dNeg = 1. / MEARTH; output[OUT_238UMASSCORE].iNum = 1; output[OUT_238UMASSCORE].iModuleBit = RADHEAT; fnWrite[OUT_238UMASSCORE] = &fvWrite238UMassCore; - sprintf(output[OUT_238UNUMCORE].cName, "238UNumCore"); - sprintf(output[OUT_238UNUMCORE].cDescr, "Total Core Number of 238U Atoms"); - sprintf(output[OUT_238UNUMCORE].cNeg, "Initial Primordial Earth Number"); + fvFormattedString(&output[OUT_238UNUMCORE].cName, "238UNumCore"); + fvFormattedString(&output[OUT_238UNUMCORE].cDescr, "Total Core Number of 238U Atoms"); + fvFormattedString(&output[OUT_238UNUMCORE].cNeg, "Initial Primordial Earth Number"); output[OUT_238UNUMCORE].bNeg = 1; output[OUT_238UNUMCORE].dNeg = EMASSCORE238U / MASS238U; output[OUT_238UNUMCORE].iNum = 1; @@ -5873,38 +5873,38 @@ void fvInitializeOutputRadheat(OUTPUT *output, fnWriteOutput fnWrite[]) { fnWrite[OUT_238UNUMCORE] = &fvWrite238UNumCore; /* Crust */ - sprintf(output[OUT_238UPOWERCRUST].cName, "238UPowerCrust"); - sprintf(output[OUT_238UPOWERCRUST].cDescr, + fvFormattedString(&output[OUT_238UPOWERCRUST].cName, "238UPowerCrust"); + fvFormattedString(&output[OUT_238UPOWERCRUST].cDescr, "Total Crust Power Generated by 238U"); - sprintf(output[OUT_238UPOWERCRUST].cNeg, "TW"); + fvFormattedString(&output[OUT_238UPOWERCRUST].cNeg, "TW"); output[OUT_238UPOWERCRUST].bNeg = 1; output[OUT_238UPOWERCRUST].dNeg = 1e-12; output[OUT_238UPOWERCRUST].iNum = 1; output[OUT_238UPOWERCRUST].iModuleBit = RADHEAT; fnWrite[OUT_238UPOWERCRUST] = &fvWrite238UPowerCrust; - sprintf(output[OUT_238UMASSCRUST].cName, "238UMassCrust"); - sprintf(output[OUT_238UMASSCRUST].cDescr, "Total Crust Mass of 238U"); - sprintf(output[OUT_238UMASSCRUST].cNeg, "Mearth"); + fvFormattedString(&output[OUT_238UMASSCRUST].cName, "238UMassCrust"); + fvFormattedString(&output[OUT_238UMASSCRUST].cDescr, "Total Crust Mass of 238U"); + fvFormattedString(&output[OUT_238UMASSCRUST].cNeg, "Mearth"); output[OUT_238UMASSCRUST].bNeg = 1; output[OUT_238UMASSCRUST].dNeg = 1. / MEARTH; output[OUT_238UMASSCRUST].iNum = 1; output[OUT_238UMASSCRUST].iModuleBit = RADHEAT; fnWrite[OUT_238UMASSCRUST] = &fvWrite238UMassCrust; - sprintf(output[OUT_238UNUMCRUST].cName, "238UNumCrust"); - sprintf(output[OUT_238UNUMCRUST].cDescr, "Total Crust Number of 238U Atoms"); - sprintf(output[OUT_238UNUMCRUST].cNeg, "Initial Primordial Earth Number"); + fvFormattedString(&output[OUT_238UNUMCRUST].cName, "238UNumCrust"); + fvFormattedString(&output[OUT_238UNUMCRUST].cDescr, "Total Crust Number of 238U Atoms"); + fvFormattedString(&output[OUT_238UNUMCRUST].cNeg, "Initial Primordial Earth Number"); output[OUT_238UNUMCRUST].bNeg = 1; output[OUT_238UNUMCRUST].dNeg = EMASSCRUST238U / MASS238U; output[OUT_238UNUMCRUST].iNum = 1; output[OUT_238UNUMCRUST].iModuleBit = RADHEAT; fnWrite[OUT_238UNUMCRUST] = &fvWrite238UNumCrust; - sprintf(output[OUT_238UPOWERTOT].cName, "238UPowerTotal"); - sprintf(output[OUT_238UPOWERTOT].cDescr, + fvFormattedString(&output[OUT_238UPOWERTOT].cName, "238UPowerTotal"); + fvFormattedString(&output[OUT_238UPOWERTOT].cDescr, "Total Power from Decay of 238U Atoms"); - sprintf(output[OUT_238UPOWERTOT].cNeg, "TW"); + fvFormattedString(&output[OUT_238UPOWERTOT].cNeg, "TW"); output[OUT_238UPOWERTOT].bNeg = 1; output[OUT_238UPOWERTOT].dNeg = 1e-12; output[OUT_238UPOWERTOT].iNum = 1; @@ -5914,55 +5914,55 @@ void fvInitializeOutputRadheat(OUTPUT *output, fnWriteOutput fnWrite[]) { /* Uranium 235 */ - sprintf(output[OUT_235UPOWERMAN].cName, "235UPowerMan"); - sprintf(output[OUT_235UPOWERMAN].cDescr, "Total Power Generated by 235U"); - sprintf(output[OUT_235UPOWERMAN].cNeg, "TW"); + fvFormattedString(&output[OUT_235UPOWERMAN].cName, "235UPowerMan"); + fvFormattedString(&output[OUT_235UPOWERMAN].cDescr, "Total Power Generated by 235U"); + fvFormattedString(&output[OUT_235UPOWERMAN].cNeg, "TW"); output[OUT_235UPOWERMAN].bNeg = 1; output[OUT_235UPOWERMAN].dNeg = 1e-12; output[OUT_235UPOWERMAN].iNum = 1; output[OUT_235UPOWERMAN].iModuleBit = RADHEAT; fnWrite[OUT_235UPOWERMAN] = &fvWrite235UPowerMan; - sprintf(output[OUT_235UENFLUX].cName, "235UEnFlux"); - sprintf(output[OUT_235UENFLUX].cDescr, "Surface Energy Flux due to 235U"); - sprintf(output[OUT_235UENFLUX].cNeg, "W/m^2"); + fvFormattedString(&output[OUT_235UENFLUX].cName, "235UEnFlux"); + fvFormattedString(&output[OUT_235UENFLUX].cDescr, "Surface Energy Flux due to 235U"); + fvFormattedString(&output[OUT_235UENFLUX].cNeg, "W/m^2"); output[OUT_235UENFLUX].bNeg = 1; output[OUT_235UENFLUX].dNeg = 1; output[OUT_235UENFLUX].iNum = 1; output[OUT_235UENFLUX].iModuleBit = RADHEAT; fnWrite[OUT_235UENFLUX] = &fvWrite235UEnFlux; - sprintf(output[OUT_235UDNUMDT].cName, "D235UNumManDt"); - sprintf(output[OUT_235UDNUMDT].cDescr, + fvFormattedString(&output[OUT_235UDNUMDT].cName, "D235UNumManDt"); + fvFormattedString(&output[OUT_235UDNUMDT].cDescr, "Time Rate of Change of the Number of 235U Nuclei"); - sprintf(output[OUT_235UDNUMDT].cNeg, "/Gyr"); + fvFormattedString(&output[OUT_235UDNUMDT].cNeg, "/Gyr"); output[OUT_235UDNUMDT].bNeg = 1; output[OUT_235UDNUMDT].dNeg = YEARSEC * 1e9; output[OUT_235UDNUMDT].iNum = 1; output[OUT_235UDNUMDT].iModuleBit = RADHEAT; fnWrite[OUT_235UDNUMDT] = &fvWriteD235UNumDt; - sprintf(output[OUT_235UTIME].cName, "235UTimescale"); - sprintf(output[OUT_235UTIME].cDescr, "Timescale for 235U Power Generation"); - sprintf(output[OUT_235UTIME].cNeg, "Gyr"); + fvFormattedString(&output[OUT_235UTIME].cName, "235UTimescale"); + fvFormattedString(&output[OUT_235UTIME].cDescr, "Timescale for 235U Power Generation"); + fvFormattedString(&output[OUT_235UTIME].cNeg, "Gyr"); output[OUT_235UTIME].bNeg = 1; output[OUT_235UTIME].dNeg = 1. / (YEARSEC * 1e9); output[OUT_235UTIME].iNum = 1; output[OUT_235UTIME].iModuleBit = RADHEAT; fnWrite[OUT_235UTIME] = &fvWrite235UTimescale; - sprintf(output[OUT_235UMASSMAN].cName, "235UMassMan"); - sprintf(output[OUT_235UMASSMAN].cDescr, "Total Mass of 235U"); - sprintf(output[OUT_235UMASSMAN].cNeg, "Mearth"); + fvFormattedString(&output[OUT_235UMASSMAN].cName, "235UMassMan"); + fvFormattedString(&output[OUT_235UMASSMAN].cDescr, "Total Mass of 235U"); + fvFormattedString(&output[OUT_235UMASSMAN].cNeg, "Mearth"); output[OUT_235UMASSMAN].bNeg = 1; output[OUT_235UMASSMAN].dNeg = 1. / MEARTH; output[OUT_235UMASSMAN].iNum = 1; output[OUT_235UMASSMAN].iModuleBit = RADHEAT; fnWrite[OUT_235UMASSMAN] = &fvWrite235UMassMan; - sprintf(output[OUT_235UNUMMAN].cName, "235UNumMan"); - sprintf(output[OUT_235UNUMMAN].cDescr, "Total Number of 235U Atoms"); - sprintf(output[OUT_235UNUMMAN].cNeg, "Initial Primordial Earth Number"); + fvFormattedString(&output[OUT_235UNUMMAN].cName, "235UNumMan"); + fvFormattedString(&output[OUT_235UNUMMAN].cDescr, "Total Number of 235U Atoms"); + fvFormattedString(&output[OUT_235UNUMMAN].cNeg, "Initial Primordial Earth Number"); output[OUT_235UNUMMAN].bNeg = 1; output[OUT_235UNUMMAN].dNeg = EMASSMAN235U / MASS235U; output[OUT_235UNUMMAN].iNum = 1; @@ -5970,28 +5970,28 @@ void fvInitializeOutputRadheat(OUTPUT *output, fnWriteOutput fnWrite[]) { fnWrite[OUT_235UNUMMAN] = &fvWrite235UNumMan; /* Core */ - sprintf(output[OUT_235UPOWERCORE].cName, "235UPowerCore"); - sprintf(output[OUT_235UPOWERCORE].cDescr, + fvFormattedString(&output[OUT_235UPOWERCORE].cName, "235UPowerCore"); + fvFormattedString(&output[OUT_235UPOWERCORE].cDescr, "Total Core Power Generated by 235U"); - sprintf(output[OUT_235UPOWERCORE].cNeg, "TW"); + fvFormattedString(&output[OUT_235UPOWERCORE].cNeg, "TW"); output[OUT_235UPOWERCORE].bNeg = 1; output[OUT_235UPOWERCORE].dNeg = 1e-12; output[OUT_235UPOWERCORE].iNum = 1; output[OUT_235UPOWERCORE].iModuleBit = RADHEAT; fnWrite[OUT_235UPOWERCORE] = &fvWrite235UPowerCore; - sprintf(output[OUT_235UMASSCORE].cName, "235UMassCore"); - sprintf(output[OUT_235UMASSCORE].cDescr, "Total Core Mass of 235U"); - sprintf(output[OUT_235UMASSCORE].cNeg, "Mearth"); + fvFormattedString(&output[OUT_235UMASSCORE].cName, "235UMassCore"); + fvFormattedString(&output[OUT_235UMASSCORE].cDescr, "Total Core Mass of 235U"); + fvFormattedString(&output[OUT_235UMASSCORE].cNeg, "Mearth"); output[OUT_235UMASSCORE].bNeg = 1; output[OUT_235UMASSCORE].dNeg = 1. / MEARTH; output[OUT_235UMASSCORE].iNum = 1; output[OUT_235UMASSCORE].iModuleBit = RADHEAT; fnWrite[OUT_235UMASSCORE] = &fvWrite235UMassCore; - sprintf(output[OUT_235UNUMCORE].cName, "235UNumCore"); - sprintf(output[OUT_235UNUMCORE].cDescr, "Total Core Number of 235U Atoms"); - sprintf(output[OUT_235UNUMCORE].cNeg, "Initial Primordial Earth Number"); + fvFormattedString(&output[OUT_235UNUMCORE].cName, "235UNumCore"); + fvFormattedString(&output[OUT_235UNUMCORE].cDescr, "Total Core Number of 235U Atoms"); + fvFormattedString(&output[OUT_235UNUMCORE].cNeg, "Initial Primordial Earth Number"); output[OUT_235UNUMCORE].bNeg = 1; output[OUT_235UNUMCORE].dNeg = EMASSCORE235U / MASS235U; output[OUT_235UNUMCORE].iNum = 1; @@ -5999,38 +5999,38 @@ void fvInitializeOutputRadheat(OUTPUT *output, fnWriteOutput fnWrite[]) { fnWrite[OUT_235UNUMCORE] = &fvWrite235UNumCore; /* Crust */ - sprintf(output[OUT_235UPOWERCRUST].cName, "235UPowerCrust"); - sprintf(output[OUT_235UPOWERCRUST].cDescr, + fvFormattedString(&output[OUT_235UPOWERCRUST].cName, "235UPowerCrust"); + fvFormattedString(&output[OUT_235UPOWERCRUST].cDescr, "Total Crust Power Generated by 235U"); - sprintf(output[OUT_235UPOWERCRUST].cNeg, "TW"); + fvFormattedString(&output[OUT_235UPOWERCRUST].cNeg, "TW"); output[OUT_235UPOWERCRUST].bNeg = 1; output[OUT_235UPOWERCRUST].dNeg = 1e-12; output[OUT_235UPOWERCRUST].iNum = 1; output[OUT_235UPOWERCRUST].iModuleBit = RADHEAT; fnWrite[OUT_235UPOWERCRUST] = &fvWrite235UPowerCrust; - sprintf(output[OUT_235UMASSCRUST].cName, "235UMassCrust"); - sprintf(output[OUT_235UMASSCRUST].cDescr, "Total Crust Mass of 235U"); - sprintf(output[OUT_235UMASSCRUST].cNeg, "Mearth"); + fvFormattedString(&output[OUT_235UMASSCRUST].cName, "235UMassCrust"); + fvFormattedString(&output[OUT_235UMASSCRUST].cDescr, "Total Crust Mass of 235U"); + fvFormattedString(&output[OUT_235UMASSCRUST].cNeg, "Mearth"); output[OUT_235UMASSCRUST].bNeg = 1; output[OUT_235UMASSCRUST].dNeg = 1. / MEARTH; output[OUT_235UMASSCRUST].iNum = 1; output[OUT_235UMASSCRUST].iModuleBit = RADHEAT; fnWrite[OUT_235UMASSCRUST] = &fvWrite235UMassCrust; - sprintf(output[OUT_235UNUMCRUST].cName, "235UNumCrust"); - sprintf(output[OUT_235UNUMCRUST].cDescr, "Total Crust Number of 235U Atoms"); - sprintf(output[OUT_235UNUMCRUST].cNeg, "Initial Primordial Earth Number"); + fvFormattedString(&output[OUT_235UNUMCRUST].cName, "235UNumCrust"); + fvFormattedString(&output[OUT_235UNUMCRUST].cDescr, "Total Crust Number of 235U Atoms"); + fvFormattedString(&output[OUT_235UNUMCRUST].cNeg, "Initial Primordial Earth Number"); output[OUT_235UNUMCRUST].bNeg = 1; output[OUT_235UNUMCRUST].dNeg = EMASSCRUST235U / MASS235U; output[OUT_235UNUMCRUST].iNum = 1; output[OUT_235UNUMCRUST].iModuleBit = RADHEAT; fnWrite[OUT_235UNUMCRUST] = &fvWrite235UNumCrust; - sprintf(output[OUT_235UPOWERTOT].cName, "235UPowerTotal"); - sprintf(output[OUT_235UPOWERTOT].cDescr, + fvFormattedString(&output[OUT_235UPOWERTOT].cName, "235UPowerTotal"); + fvFormattedString(&output[OUT_235UPOWERTOT].cDescr, "Total Power from Decay of 235U Atoms"); - sprintf(output[OUT_235UPOWERTOT].cNeg, "TW"); + fvFormattedString(&output[OUT_235UPOWERTOT].cNeg, "TW"); output[OUT_235UPOWERTOT].bNeg = 1; output[OUT_235UPOWERTOT].dNeg = 1e-12; output[OUT_235UPOWERTOT].iNum = 1; @@ -6039,50 +6039,50 @@ void fvInitializeOutputRadheat(OUTPUT *output, fnWriteOutput fnWrite[]) { /* Totals */ - sprintf(output[OUT_RADPOWERCRUST].cName, "RadPowerCrust"); - sprintf(output[OUT_RADPOWERCRUST].cDescr, + fvFormattedString(&output[OUT_RADPOWERCRUST].cName, "RadPowerCrust"); + fvFormattedString(&output[OUT_RADPOWERCRUST].cDescr, "Total Power Generated by Radiogenic Nuclides in the crust"); - sprintf(output[OUT_RADPOWERCRUST].cNeg, "TW"); + fvFormattedString(&output[OUT_RADPOWERCRUST].cNeg, "TW"); output[OUT_RADPOWERCRUST].bNeg = 1; output[OUT_RADPOWERCRUST].dNeg = 1e-12; output[OUT_RADPOWERCRUST].iNum = 1; output[OUT_RADPOWERCRUST].iModuleBit = RADHEAT; fnWrite[OUT_RADPOWERCRUST] = &fvWriteRadPowerCrust; - sprintf(output[OUT_RADPOWERMAN].cName, "RadPowerMan"); - sprintf(output[OUT_RADPOWERMAN].cDescr, + fvFormattedString(&output[OUT_RADPOWERMAN].cName, "RadPowerMan"); + fvFormattedString(&output[OUT_RADPOWERMAN].cDescr, "Total Power Generated by Radiogenic Nuclides in the mantle"); - sprintf(output[OUT_RADPOWERMAN].cNeg, "TW"); + fvFormattedString(&output[OUT_RADPOWERMAN].cNeg, "TW"); output[OUT_RADPOWERMAN].bNeg = 1; output[OUT_RADPOWERMAN].dNeg = 1e-12; output[OUT_RADPOWERMAN].iNum = 1; output[OUT_RADPOWERMAN].iModuleBit = RADHEAT; fnWrite[OUT_RADPOWERMAN] = &fvWriteRadPowerMan; - sprintf(output[OUT_RADPOWERCORE].cName, "RadPowerCore"); - sprintf(output[OUT_RADPOWERCORE].cDescr, + fvFormattedString(&output[OUT_RADPOWERCORE].cName, "RadPowerCore"); + fvFormattedString(&output[OUT_RADPOWERCORE].cDescr, "Total Power Generated by Radiogenic Nuclides in Core"); - sprintf(output[OUT_RADPOWERCORE].cNeg, "TW"); + fvFormattedString(&output[OUT_RADPOWERCORE].cNeg, "TW"); output[OUT_RADPOWERCORE].bNeg = 1; output[OUT_RADPOWERCORE].dNeg = 1e-12; output[OUT_RADPOWERCORE].iNum = 1; output[OUT_RADPOWERCORE].iModuleBit = RADHEAT; fnWrite[OUT_RADPOWERCORE] = &fvWriteRadPowerCore; - sprintf(output[OUT_RADPOWERTOTAL].cName, "RadPowerTotal"); - sprintf(output[OUT_RADPOWERTOTAL].cDescr, + fvFormattedString(&output[OUT_RADPOWERTOTAL].cName, "RadPowerTotal"); + fvFormattedString(&output[OUT_RADPOWERTOTAL].cDescr, "Total Power Generated by Radiogenic Nuclides in Total (M+C)"); - sprintf(output[OUT_RADPOWERTOTAL].cNeg, "TW"); + fvFormattedString(&output[OUT_RADPOWERTOTAL].cNeg, "TW"); output[OUT_RADPOWERTOTAL].bNeg = 1; output[OUT_RADPOWERTOTAL].dNeg = 1e-12; output[OUT_RADPOWERTOTAL].iNum = 1; output[OUT_RADPOWERTOTAL].iModuleBit = RADHEAT; fnWrite[OUT_RADPOWERTOTAL] = &fvWriteRadPowerTotal; - sprintf(output[OUT_SURFENFLUXRADTOTAL].cName, "SurfEnFluxRadTotal"); - sprintf(output[OUT_SURFENFLUXRADTOTAL].cDescr, + fvFormattedString(&output[OUT_SURFENFLUXRADTOTAL].cName, "SurfEnFluxRadTotal"); + fvFormattedString(&output[OUT_SURFENFLUXRADTOTAL].cDescr, "Total Surface Heat Flux Generated by Radiogenic Nuclides"); - sprintf(output[OUT_SURFENFLUXRADTOTAL].cNeg, "W/m^2"); + fvFormattedString(&output[OUT_SURFENFLUXRADTOTAL].cNeg, "W/m^2"); output[OUT_SURFENFLUXRADTOTAL].bNeg = 1; output[OUT_SURFENFLUXRADTOTAL].dNeg = 1; output[OUT_SURFENFLUXRADTOTAL].iNum = 1; diff --git a/src/radheat.h b/src/radheat.h index f81e11b1d..27cda729d 100644 --- a/src/radheat.h +++ b/src/radheat.h @@ -441,134 +441,134 @@ void fvVerifyHaltRadheat(BODY *, CONTROL *, OPTIONS *, int, int *); #define OUT_SURFENFLUXRADTOTAL 1195 void fvWrite26AlPowerMan(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, - UPDATE *, int, double *, char[]); + UPDATE *, int, double *, char**); void fvWrite26AlEnFlux(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, UPDATE *, - int, double *, char[]); + int, double *, char**); void fvWriteD26AlPowerDt(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, - UPDATE *, int, double *, char[]); + UPDATE *, int, double *, char**); void fvWrite26AlTimescale(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, - UPDATE *, int, double *, char[]); + UPDATE *, int, double *, char**); void fvWrite26AlMassMan(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, - UPDATE *, int, double *, char[]); + UPDATE *, int, double *, char**); void fvWrite26AlNumMan(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, UPDATE *, - int, double *, char[]); + int, double *, char**); void fvWrite26AlPowerCore(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, - UPDATE *, int, double *, char[]); + UPDATE *, int, double *, char**); void fvWrite26AlMassCore(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, - UPDATE *, int, double *, char[]); + UPDATE *, int, double *, char**); void fvWrite26AlNumCore(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, - UPDATE *, int, double *, char[]); + UPDATE *, int, double *, char**); void fvWrite40KPowerMan(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, - UPDATE *, int, double *, char[]); + UPDATE *, int, double *, char**); void fvWrite40KEnFlux(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, UPDATE *, - int, double *, char[]); + int, double *, char**); void fvWriteD40KPowerDt(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, - UPDATE *, int, double *, char[]); + UPDATE *, int, double *, char**); void fvWrite40KTimescale(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, - UPDATE *, int, double *, char[]); + UPDATE *, int, double *, char**); void fvWrite40KMassMan(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, UPDATE *, - int, double *, char[]); + int, double *, char**); void fvWrite40KNumMan(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, UPDATE *, - int, double *, char[]); + int, double *, char**); void fvWrite40KPowerCore(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, - UPDATE *, int, double *, char[]); + UPDATE *, int, double *, char**); void fvWrite40KMassCore(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, - UPDATE *, int, double *, char[]); + UPDATE *, int, double *, char**); void fvWrite40KNumCore(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, UPDATE *, - int, double *, char[]); + int, double *, char**); void fvWrite40KPowerCrust(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, - UPDATE *, int, double *, char[]); + UPDATE *, int, double *, char**); void fvWrite40KMassCrust(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, - UPDATE *, int, double *, char[]); + UPDATE *, int, double *, char**); void fvWrite40KNumCrust(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, - UPDATE *, int, double *, char[]); + UPDATE *, int, double *, char**); void fvWrite232ThPowerMan(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, - UPDATE *, int, double *, char[]); + UPDATE *, int, double *, char**); void fvWrite232ThEnFlux(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, - UPDATE *, int, double *, char[]); + UPDATE *, int, double *, char**); void fvWriteD232ThPowerDt(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, - UPDATE *, int, double *, char[]); + UPDATE *, int, double *, char**); void fvWrite232ThTimescale(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, - UPDATE *, int, double *, char[]); + UPDATE *, int, double *, char**); void fvWrite232ThMassMan(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, - UPDATE *, int, double *, char[]); + UPDATE *, int, double *, char**); void fvWrite232ThNumMan(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, - UPDATE *, int, double *, char[]); + UPDATE *, int, double *, char**); void fvWrite232ThPowerCore(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, - UPDATE *, int, double *, char[]); + UPDATE *, int, double *, char**); void fvWrite232ThMassCore(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, - UPDATE *, int, double *, char[]); + UPDATE *, int, double *, char**); void fvWrite232ThNumCore(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, - UPDATE *, int, double *, char[]); + UPDATE *, int, double *, char**); void fvWrite232ThPowerCrust(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, - UPDATE *, int, double *, char[]); + UPDATE *, int, double *, char**); void fvWrite232ThMassCrust(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, - UPDATE *, int, double *, char[]); + UPDATE *, int, double *, char**); void fvWrite232ThNumCrust(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, - UPDATE *, int, double *, char[]); + UPDATE *, int, double *, char**); void fvWrite238UPowerMan(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, - UPDATE *, int, double *, char[]); + UPDATE *, int, double *, char**); void fvWrite238UEnFlux(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, UPDATE *, - int, double *, char[]); + int, double *, char**); void fvWriteD238UPowerDt(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, - UPDATE *, int, double *, char[]); + UPDATE *, int, double *, char**); void fvWrite238UTimescale(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, - UPDATE *, int, double *, char[]); + UPDATE *, int, double *, char**); void fvWrite238UMassMan(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, - UPDATE *, int, double *, char[]); + UPDATE *, int, double *, char**); void fvWrite238UNumMan(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, UPDATE *, - int, double *, char[]); + int, double *, char**); void fvWrite238UPowerCore(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, - UPDATE *, int, double *, char[]); + UPDATE *, int, double *, char**); void fvWrite238UMassCore(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, - UPDATE *, int, double *, char[]); + UPDATE *, int, double *, char**); void fvWrite238UNumCore(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, - UPDATE *, int, double *, char[]); + UPDATE *, int, double *, char**); void fvWrite238UPowerCrust(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, - UPDATE *, int, double *, char[]); + UPDATE *, int, double *, char**); void fvWrite238UMassCrust(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, - UPDATE *, int, double *, char[]); + UPDATE *, int, double *, char**); void fvWrite238UNumCrust(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, - UPDATE *, int, double *, char[]); + UPDATE *, int, double *, char**); void fvWrite235UPowerMan(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, - UPDATE *, int, double *, char[]); + UPDATE *, int, double *, char**); void fvWrite235UEnFlux(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, UPDATE *, - int, double *, char[]); + int, double *, char**); void fvWriteD235UPowerDt(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, - UPDATE *, int, double *, char[]); + UPDATE *, int, double *, char**); void fvWrite235UTimescale(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, - UPDATE *, int, double *, char[]); + UPDATE *, int, double *, char**); void fvWrite235UMassMan(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, - UPDATE *, int, double *, char[]); + UPDATE *, int, double *, char**); void fvWrite235UNumMan(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, UPDATE *, - int, double *, char[]); + int, double *, char**); void fvWrite235UPowerCore(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, - UPDATE *, int, double *, char[]); + UPDATE *, int, double *, char**); void fvWrite235UMassCore(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, - UPDATE *, int, double *, char[]); + UPDATE *, int, double *, char**); void fvWrite235UNumCore(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, - UPDATE *, int, double *, char[]); + UPDATE *, int, double *, char**); void fvWrite235UPowerCrust(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, - UPDATE *, int, double *, char[]); + UPDATE *, int, double *, char**); void fvWrite235UMassCrust(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, - UPDATE *, int, double *, char[]); + UPDATE *, int, double *, char**); void fvWrite235UNumCrust(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, - UPDATE *, int, double *, char[]); + UPDATE *, int, double *, char**); void fvWriteRadPowerMan(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, - UPDATE *, int, double *, char[]); + UPDATE *, int, double *, char**); void fvWriteRadPowerCore(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, - UPDATE *, int, double *, char[]); + UPDATE *, int, double *, char**); void fvWriteRadPowerCrust(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, - UPDATE *, int, double *, char[]); + UPDATE *, int, double *, char**); void fvWriteRadPowerTotal(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, - UPDATE *, int, double *, char[]); + UPDATE *, int, double *, char**); void fvWriteRadEnFlux(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, UPDATE *, - int, double *, char[]); + int, double *, char**); void fvHelpOutputRadheat(OUTPUT *); void fvInitializeOutputRadheat(OUTPUT *, fnWriteOutput[]); diff --git a/src/spinbody.c b/src/spinbody.c index 1d4726f9e..142b1c550 100644 --- a/src/spinbody.c +++ b/src/spinbody.c @@ -230,73 +230,73 @@ void InitializeOptionsSpiNBody(OPTIONS *options, fnReadOption fnRead[]) { // XXX All of these should be deprecated so that it doesn't matter if the user // calls DistOrb or SpiNBody - sprintf(options[OPT_POSITIONXSPINBODY].cName, "dPositionXSpiNBody"); - sprintf(options[OPT_POSITIONXSPINBODY].cDescr, "X position of the body"); - sprintf(options[OPT_POSITIONXSPINBODY].cDefault, "0"); - sprintf(options[OPT_POSITIONXSPINBODY].cDimension, "length"); + fvFormattedString(&options[OPT_POSITIONXSPINBODY].cName, "dPositionXSpiNBody"); + fvFormattedString(&options[OPT_POSITIONXSPINBODY].cDescr, "X position of the body"); + fvFormattedString(&options[OPT_POSITIONXSPINBODY].cDefault, "0"); + fvFormattedString(&options[OPT_POSITIONXSPINBODY].cDimension, "length"); options[OPT_POSITIONXSPINBODY].dDefault = 0.0; options[OPT_POSITIONXSPINBODY].iType = 2; options[OPT_POSITIONXSPINBODY].bMultiFile = 1; fnRead[OPT_POSITIONXSPINBODY] = &ReadPositionX; - sprintf(options[OPT_POSITIONYSPINBODY].cName, "dPositionYSpiNBody"); - sprintf(options[OPT_POSITIONYSPINBODY].cDescr, "Y position of the body"); - sprintf(options[OPT_POSITIONYSPINBODY].cDefault, "0"); - sprintf(options[OPT_POSITIONYSPINBODY].cDimension, "length"); + fvFormattedString(&options[OPT_POSITIONYSPINBODY].cName, "dPositionYSpiNBody"); + fvFormattedString(&options[OPT_POSITIONYSPINBODY].cDescr, "Y position of the body"); + fvFormattedString(&options[OPT_POSITIONYSPINBODY].cDefault, "0"); + fvFormattedString(&options[OPT_POSITIONYSPINBODY].cDimension, "length"); options[OPT_POSITIONYSPINBODY].dDefault = 0.0; options[OPT_POSITIONYSPINBODY].iType = 2; options[OPT_POSITIONYSPINBODY].bMultiFile = 1; fnRead[OPT_POSITIONYSPINBODY] = &ReadPositionY; - sprintf(options[OPT_POSITIONZSPINBODY].cName, "dPositionZSpiNBody"); - sprintf(options[OPT_POSITIONZSPINBODY].cDescr, "Z position of the body"); - sprintf(options[OPT_POSITIONZSPINBODY].cDefault, "0"); - sprintf(options[OPT_POSITIONZSPINBODY].cDimension, "length"); + fvFormattedString(&options[OPT_POSITIONZSPINBODY].cName, "dPositionZSpiNBody"); + fvFormattedString(&options[OPT_POSITIONZSPINBODY].cDescr, "Z position of the body"); + fvFormattedString(&options[OPT_POSITIONZSPINBODY].cDefault, "0"); + fvFormattedString(&options[OPT_POSITIONZSPINBODY].cDimension, "length"); options[OPT_POSITIONZSPINBODY].dDefault = 0.0; options[OPT_POSITIONZSPINBODY].iType = 2; options[OPT_POSITIONZSPINBODY].bMultiFile = 1; fnRead[OPT_POSITIONZSPINBODY] = &ReadPositionZ; - sprintf(options[OPT_VELXSPINBODY].cName, "dVelXSpiNBody"); - sprintf(options[OPT_VELXSPINBODY].cDescr, "X velocity of the body"); - sprintf(options[OPT_VELXSPINBODY].cDefault, "0"); - sprintf(options[OPT_VELXSPINBODY].cDimension, "length/time"); + fvFormattedString(&options[OPT_VELXSPINBODY].cName, "dVelXSpiNBody"); + fvFormattedString(&options[OPT_VELXSPINBODY].cDescr, "X velocity of the body"); + fvFormattedString(&options[OPT_VELXSPINBODY].cDefault, "0"); + fvFormattedString(&options[OPT_VELXSPINBODY].cDimension, "length/time"); options[OPT_VELXSPINBODY].dDefault = 0.0; options[OPT_VELXSPINBODY].iType = 2; options[OPT_VELXSPINBODY].bMultiFile = 1; fnRead[OPT_VELXSPINBODY] = &ReadVelX; - sprintf(options[OPT_VELYSPINBODY].cName, "dVelYSpiNBody"); - sprintf(options[OPT_VELYSPINBODY].cDescr, "Y velocity of the body"); - sprintf(options[OPT_VELYSPINBODY].cDefault, "0"); - sprintf(options[OPT_VELYSPINBODY].cDimension, "length/time"); + fvFormattedString(&options[OPT_VELYSPINBODY].cName, "dVelYSpiNBody"); + fvFormattedString(&options[OPT_VELYSPINBODY].cDescr, "Y velocity of the body"); + fvFormattedString(&options[OPT_VELYSPINBODY].cDefault, "0"); + fvFormattedString(&options[OPT_VELYSPINBODY].cDimension, "length/time"); options[OPT_VELYSPINBODY].dDefault = 0.0; options[OPT_VELYSPINBODY].iType = 2; options[OPT_VELYSPINBODY].bMultiFile = 1; fnRead[OPT_VELYSPINBODY] = &ReadVelY; - sprintf(options[OPT_VELZSPINBODY].cName, "dVelZSpiNBody"); - sprintf(options[OPT_VELZSPINBODY].cDescr, "Z velocity of the body"); - sprintf(options[OPT_VELZSPINBODY].cDefault, "0"); - sprintf(options[OPT_VELZSPINBODY].cDimension, "length/time"); + fvFormattedString(&options[OPT_VELZSPINBODY].cName, "dVelZSpiNBody"); + fvFormattedString(&options[OPT_VELZSPINBODY].cDescr, "Z velocity of the body"); + fvFormattedString(&options[OPT_VELZSPINBODY].cDefault, "0"); + fvFormattedString(&options[OPT_VELZSPINBODY].cDimension, "length/time"); options[OPT_VELZSPINBODY].dDefault = 0.0; options[OPT_VELZSPINBODY].iType = 2; options[OPT_VELZSPINBODY].bMultiFile = 1; fnRead[OPT_VELZSPINBODY] = &ReadVelZ; - sprintf(options[OPT_MEANA].cName, "dMeanA"); - sprintf(options[OPT_MEANA].cDescr, "Mean anomaly"); - sprintf(options[OPT_MEANA].cDefault, "0.0"); - sprintf(options[OPT_MEANA].cDimension, "angle"); + fvFormattedString(&options[OPT_MEANA].cName, "dMeanA"); + fvFormattedString(&options[OPT_MEANA].cDescr, "Mean anomaly"); + fvFormattedString(&options[OPT_MEANA].cDefault, "0.0"); + fvFormattedString(&options[OPT_MEANA].cDimension, "angle"); options[OPT_MEANA].dDefault = 0.0; options[OPT_MEANA].iType = 2; options[OPT_MEANA].bMultiFile = 1; fnRead[OPT_MEANA] = &ReadMeanA; - sprintf(options[OPT_USEORBPARAMS].cName, "bUseOrbParams"); - sprintf(options[OPT_USEORBPARAMS].cDescr, + fvFormattedString(&options[OPT_USEORBPARAMS].cName, "bUseOrbParams"); + fvFormattedString(&options[OPT_USEORBPARAMS].cDescr, "Flag to use orbital parameters as inputs"); - sprintf(options[OPT_USEORBPARAMS].cDefault, "0"); + fvFormattedString(&options[OPT_USEORBPARAMS].cDefault, "0"); options[OPT_USEORBPARAMS].dDefault = 0; options[OPT_USEORBPARAMS].iType = 0; options[OPT_USEORBPARAMS].bMultiFile = 1; @@ -891,54 +891,54 @@ void VerifyHaltSpiNBody(BODY *body, CONTROL *control, OPTIONS *options, void WritePositionX(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, - double *dTmp, char cUnit[]) { + double *dTmp, char **cUnit) { *dTmp = body[iBody].dPositionX; - strcpy(cUnit, ""); + fvFormattedString(cUnit, ""); } void WritePositionY(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, - double *dTmp, char cUnit[]) { + double *dTmp, char **cUnit) { *dTmp = body[iBody].dPositionY; - strcpy(cUnit, ""); + fvFormattedString(cUnit, ""); } void WritePositionZ(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, - double *dTmp, char cUnit[]) { + double *dTmp, char **cUnit) { *dTmp = body[iBody].dPositionZ; - strcpy(cUnit, ""); + fvFormattedString(cUnit, ""); } void WriteVelX(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, double *dTmp, - char cUnit[]) { + char **cUnit) { *dTmp = body[iBody].dVelX; - strcpy(cUnit, ""); + fvFormattedString(cUnit, ""); } void WriteVelY(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, double *dTmp, - char cUnit[]) { + char **cUnit) { *dTmp = body[iBody].dVelY; - strcpy(cUnit, ""); + fvFormattedString(cUnit, ""); } void WriteVelZ(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, double *dTmp, - char cUnit[]) { + char **cUnit) { *dTmp = body[iBody].dVelZ; - strcpy(cUnit, ""); + fvFormattedString(cUnit, ""); } void WriteInclinationSpinBody(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, - int iBody, double *dTmp, char cUnit[]) { + int iBody, double *dTmp, char **cUnit) { *dTmp = body[iBody].dInc; if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { *dTmp /= fdUnitsAngle(units->iAngle); fsUnitsAngle(units->iAngle, cUnit); @@ -947,12 +947,12 @@ void WriteInclinationSpinBody(BODY *body, CONTROL *control, OUTPUT *output, void WriteLongASpinBody(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, - double *dTmp, char cUnit[]) { + double *dTmp, char **cUnit) { *dTmp = body[iBody].dLongA; if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { *dTmp /= fdUnitsAngle(units->iAngle); fsUnitsAngle(units->iAngle, cUnit); @@ -963,75 +963,75 @@ void InitializeOutputSpiNBody(OUTPUT *output, fnWriteOutput fnWrite[]) { // Output example for dPositionX variable // XXX All of these should be deprecated so that it doesn't matter if the user // calls DistOrb or SpiNBody - sprintf(output[OUT_POSITIONXSPINBODY].cName, "PositionXSpiNBody"); - sprintf(output[OUT_POSITIONXSPINBODY].cDescr, + fvFormattedString(&output[OUT_POSITIONXSPINBODY].cName, "PositionXSpiNBody"); + fvFormattedString(&output[OUT_POSITIONXSPINBODY].cDescr, "Body's x position in SpiNBody"); - // sprintf(output[OUT_POSITIONXSPINBODY].cNeg," "); + // fvFormattedString(output[OUT_POSITIONXSPINBODY].cNeg," "); output[OUT_POSITIONXSPINBODY].bNeg = 0; // output[OUT_POSITIONXSPINBODY].dNeg = 1; output[OUT_POSITIONXSPINBODY].iNum = 1; output[OUT_POSITIONXSPINBODY].iModuleBit = SPINBODY; fnWrite[OUT_POSITIONXSPINBODY] = &WritePositionX; - sprintf(output[OUT_POSITIONYSPINBODY].cName, "PositionYSpiNBody"); - sprintf(output[OUT_POSITIONYSPINBODY].cDescr, + fvFormattedString(&output[OUT_POSITIONYSPINBODY].cName, "PositionYSpiNBody"); + fvFormattedString(&output[OUT_POSITIONYSPINBODY].cDescr, "Body's y position in SpiNBody"); - // sprintf(output[OUT_POSITIONYSPINBODY].cNeg," "); + // fvFormattedString(output[OUT_POSITIONYSPINBODY].cNeg," "); output[OUT_POSITIONYSPINBODY].bNeg = 0; // output[OUT_POSITIONYSPINBODY].dNeg = 1; output[OUT_POSITIONYSPINBODY].iNum = 1; output[OUT_POSITIONYSPINBODY].iModuleBit = SPINBODY; fnWrite[OUT_POSITIONYSPINBODY] = &WritePositionY; - sprintf(output[OUT_POSITIONZSPINBODY].cName, "PositionZSpiNBody"); - sprintf(output[OUT_POSITIONZSPINBODY].cDescr, + fvFormattedString(&output[OUT_POSITIONZSPINBODY].cName, "PositionZSpiNBody"); + fvFormattedString(&output[OUT_POSITIONZSPINBODY].cDescr, "Body's z position in SpiNBody"); - // sprintf(output[OUT_POSITIONZSPINBODY].cNeg," "); + // fvFormattedString(output[OUT_POSITIONZSPINBODY].cNeg," "); output[OUT_POSITIONZSPINBODY].bNeg = 0; // output[OUT_POSITIONZSPINBODY].dNeg = 1; output[OUT_POSITIONZSPINBODY].iNum = 1; output[OUT_POSITIONZSPINBODY].iModuleBit = SPINBODY; fnWrite[OUT_POSITIONZSPINBODY] = &WritePositionZ; - sprintf(output[OUT_VELXSPINBODY].cName, "VelXSpiNBody"); - sprintf(output[OUT_VELXSPINBODY].cDescr, "Body's x velocity in SpiNBody"); - // sprintf(output[OUT_VELXSPINBODY].cNeg," "); + fvFormattedString(&output[OUT_VELXSPINBODY].cName, "VelXSpiNBody"); + fvFormattedString(&output[OUT_VELXSPINBODY].cDescr, "Body's x velocity in SpiNBody"); + // fvFormattedString(output[OUT_VELXSPINBODY].cNeg," "); output[OUT_VELXSPINBODY].bNeg = 0; // output[OUT_VELXSPINBODY].dNeg = 1; output[OUT_VELXSPINBODY].iNum = 1; output[OUT_VELXSPINBODY].iModuleBit = SPINBODY; fnWrite[OUT_VELXSPINBODY] = &WriteVelX; - sprintf(output[OUT_VELYSPINBODY].cName, "VelYSpiNBody"); - sprintf(output[OUT_VELYSPINBODY].cDescr, "Body's y velocity in SpiNBody"); - // sprintf(output[OUT_VELYSPINBODY].cNeg," "); + fvFormattedString(&output[OUT_VELYSPINBODY].cName, "VelYSpiNBody"); + fvFormattedString(&output[OUT_VELYSPINBODY].cDescr, "Body's y velocity in SpiNBody"); + // fvFormattedString(output[OUT_VELYSPINBODY].cNeg," "); output[OUT_VELYSPINBODY].bNeg = 0; // output[OUT_VELYSPINBODY].dNeg = 1; output[OUT_VELYSPINBODY].iNum = 1; output[OUT_VELYSPINBODY].iModuleBit = SPINBODY; fnWrite[OUT_VELYSPINBODY] = &WriteVelY; - sprintf(output[OUT_VELZSPINBODY].cName, "VelZSpiNBody"); - sprintf(output[OUT_VELZSPINBODY].cDescr, "Body's z velocity in SpiNBody"); - // sprintf(output[OUT_VELZSPINBODY].cNeg," "); + fvFormattedString(&output[OUT_VELZSPINBODY].cName, "VelZSpiNBody"); + fvFormattedString(&output[OUT_VELZSPINBODY].cDescr, "Body's z velocity in SpiNBody"); + // fvFormattedString(output[OUT_VELZSPINBODY].cNeg," "); output[OUT_VELZSPINBODY].bNeg = 0; // output[OUT_VELZSPINBODY].dNeg = 1; output[OUT_VELZSPINBODY].iNum = 1; output[OUT_VELZSPINBODY].iModuleBit = SPINBODY; fnWrite[OUT_VELZSPINBODY] = &WriteVelZ; - sprintf(output[OUT_INCSPINBODY].cName, "SpiNBodyInc"); - sprintf(output[OUT_INCSPINBODY].cDescr, "Body's inclination in SpiNBody"); - sprintf(output[OUT_INCSPINBODY].cNeg, "Deg"); + fvFormattedString(&output[OUT_INCSPINBODY].cName, "SpiNBodyInc"); + fvFormattedString(&output[OUT_INCSPINBODY].cDescr, "Body's inclination in SpiNBody"); + fvFormattedString(&output[OUT_INCSPINBODY].cNeg, "Deg"); output[OUT_INCSPINBODY].bNeg = 1; output[OUT_INCSPINBODY].dNeg = 1. / DEGRAD; output[OUT_INCSPINBODY].iNum = 1; output[OUT_INCSPINBODY].iModuleBit = SPINBODY; fnWrite[OUT_INCSPINBODY] = &WriteInclinationSpinBody; - sprintf(output[OUT_LONGASPINBODY].cName, "SpiNBodyLongA"); - sprintf(output[OUT_LONGASPINBODY].cDescr, "Body's inclination in SpiNBody"); - sprintf(output[OUT_LONGASPINBODY].cNeg, "Deg"); + fvFormattedString(&output[OUT_LONGASPINBODY].cName, "SpiNBodyLongA"); + fvFormattedString(&output[OUT_LONGASPINBODY].cDescr, "Body's inclination in SpiNBody"); + fvFormattedString(&output[OUT_LONGASPINBODY].cNeg, "Deg"); output[OUT_LONGASPINBODY].bNeg = 1; output[OUT_LONGASPINBODY].dNeg = 1. / DEGRAD; output[OUT_LONGASPINBODY].iNum = 1; diff --git a/src/spinbody.h b/src/spinbody.h index 7999aa32e..8a4ba0dbc 100644 --- a/src/spinbody.h +++ b/src/spinbody.h @@ -106,28 +106,28 @@ void FinalizeUpdatePositionZSpiNBody(BODY *body, UPDATE *update, int *iEqn, void WritePositionX(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, - double *dTmp, char cUnit[]); + double *dTmp, char **cUnit); void WritePositionY(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, - double *dTmp, char cUnit[]); + double *dTmp, char **cUnit); void WritePositionZ(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, - double *dTmp, char cUnit[]); + double *dTmp, char **cUnit); void WriteVelX(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, double *dTmp, - char cUnit[]); + char **cUnit); void WriteVelY(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, double *dTmp, - char cUnit[]); + char **cUnit); void WriteVelZ(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, double *dTmp, - char cUnit[]); + char **cUnit); void WriteInclinationSpinBody(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, - int iBody, double *dTmp, char cUnit[]); + int iBody, double *dTmp, char **cUnit); void WriteLongASpinBody(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, - double *dTmp, char cUnit[]); + double *dTmp, char **cUnit); void InitializeOutputSpiNBody(OUTPUT *output, fnWriteOutput fnWrite[]); int fbHaltMaxMutualIncSpiNBody(BODY *, EVOLVE *, HALT *, IO *, UPDATE *, diff --git a/src/stellar.c b/src/stellar.c index 9e7492a10..b94fc4623 100644 --- a/src/stellar.c +++ b/src/stellar.c @@ -422,58 +422,58 @@ void ReadHaltEndBaraffeGrid(BODY *body, CONTROL *control, FILES *files, void InitializeOptionsStellar(OPTIONS *options, fnReadOption fnRead[]) { int iOpt, iFile; - sprintf(options[OPT_SATXUVFRAC].cName, "dSatXUVFrac"); - sprintf(options[OPT_SATXUVFRAC].cDescr, "Saturated XUV luminosity fraction"); - sprintf(options[OPT_SATXUVFRAC].cDefault, "1e-3"); - sprintf(options[OPT_SATXUVFRAC].cDimension, "nd"); + fvFormattedString(&options[OPT_SATXUVFRAC].cName, "dSatXUVFrac"); + fvFormattedString(&options[OPT_SATXUVFRAC].cDescr, "Saturated XUV luminosity fraction"); + fvFormattedString(&options[OPT_SATXUVFRAC].cDefault, "1e-3"); + fvFormattedString(&options[OPT_SATXUVFRAC].cDimension, "nd"); options[OPT_SATXUVFRAC].dDefault = 1.e-3; options[OPT_SATXUVFRAC].iType = 2; options[OPT_SATXUVFRAC].bMultiFile = 1; fnRead[OPT_SATXUVFRAC] = &ReadSatXUVFrac; - sprintf( - options[OPT_SATXUVFRAC].cLongDescr, + fvFormattedString( + &options[OPT_SATXUVFRAC].cLongDescr, "After formation stars emit a nearly constant amount of XUV radiation\n" "for a time called the \"saturated\" phase. This parameter sets that " "value\n" "relative to the total (bolometric) luminosity. Must lie in range " "[0,1]."); - sprintf(options[OPT_SATXUVTIME].cName, "dSatXUVTime"); - sprintf(options[OPT_SATXUVTIME].cDescr, "XUV saturation time"); - sprintf(options[OPT_SATXUVTIME].cDefault, "0.1 Gyr"); - sprintf(options[OPT_SATXUVTIME].cDimension, "time"); + fvFormattedString(&options[OPT_SATXUVTIME].cName, "dSatXUVTime"); + fvFormattedString(&options[OPT_SATXUVTIME].cDescr, "XUV saturation time"); + fvFormattedString(&options[OPT_SATXUVTIME].cDefault, "0.1 Gyr"); + fvFormattedString(&options[OPT_SATXUVTIME].cDimension, "time"); options[OPT_SATXUVTIME].dDefault = 1.e8 * YEARSEC; options[OPT_SATXUVTIME].iType = 0; options[OPT_SATXUVTIME].bMultiFile = 1; options[OPT_SATXUVTIME].dNeg = 1e9 * YEARSEC; - sprintf(options[OPT_SATXUVTIME].cNeg, "Gyr"); + fvFormattedString(&options[OPT_SATXUVTIME].cNeg, "Gyr"); fnRead[OPT_SATXUVTIME] = &ReadSatXUVTime; - sprintf(options[OPT_SATXUVTIME].cLongDescr, + fvFormattedString(&options[OPT_SATXUVTIME].cLongDescr, "The time a star will remain in its \"saturated\" phase."); - sprintf(options[OPT_XUVBETA].cName, "dXUVBeta"); - sprintf(options[OPT_XUVBETA].cDescr, "XUV decay power law exponent"); - sprintf(options[OPT_XUVBETA].cDefault, "1.23"); - sprintf(options[OPT_XUVBETA].cDimension, "nd"); + fvFormattedString(&options[OPT_XUVBETA].cName, "dXUVBeta"); + fvFormattedString(&options[OPT_XUVBETA].cDescr, "XUV decay power law exponent"); + fvFormattedString(&options[OPT_XUVBETA].cDefault, "1.23"); + fvFormattedString(&options[OPT_XUVBETA].cDimension, "nd"); options[OPT_XUVBETA].dDefault = 1.23; options[OPT_XUVBETA].iType = 2; options[OPT_XUVBETA].bMultiFile = 1; fnRead[OPT_XUVBETA] = &ReadXUVBeta; - sprintf(options[OPT_XUVBETA].cLongDescr, + fvFormattedString(&options[OPT_XUVBETA].cLongDescr, "After the \"saturation\" phase, the ratio of the XUV to total " "luminosity\n" "will follow a power law followinfg this exponent. Units are " "gigayears."); - sprintf(options[OPT_STELLARMODEL].cName, "sStellarModel"); - sprintf(options[OPT_STELLARMODEL].cDescr, "Stellar evolution model"); - sprintf(options[OPT_STELLARMODEL].cDefault, "BARAFFE"); - sprintf(options[OPT_STELLARMODEL].cValues, "BARAFFE PROXIMA SINEWAVE NONE"); + fvFormattedString(&options[OPT_STELLARMODEL].cName, "sStellarModel"); + fvFormattedString(&options[OPT_STELLARMODEL].cDescr, "Stellar evolution model"); + fvFormattedString(&options[OPT_STELLARMODEL].cDefault, "BARAFFE"); + fvFormattedString(&options[OPT_STELLARMODEL].cValues, "BARAFFE PROXIMA SINEWAVE NONE"); options[OPT_STELLARMODEL].iType = 3; options[OPT_STELLARMODEL].bMultiFile = 1; fnRead[OPT_STELLARMODEL] = &ReadStellarModel; - sprintf( - options[OPT_STELLARMODEL].cLongDescr, + fvFormattedString( + &options[OPT_STELLARMODEL].cLongDescr, "If BARAFFE is selected, luminosity, effective temperature, radius, " "and\n" "radius of gyration will follow the model of Baraffe, I. et al.\n" @@ -482,15 +482,15 @@ void InitializeOptionsStellar(OPTIONS *options, fnReadOption fnRead[]) { "(2016, arXiv:1608.06919). SINEWAVE produces oscillatory luminosity.\n" "NONE will leave them constant.\n"); - sprintf(options[OPT_MAGBRAKINGMODEL].cName, "sMagBrakingModel"); - sprintf(options[OPT_MAGBRAKINGMODEL].cDescr, "Magnetic braking model."); - sprintf(options[OPT_MAGBRAKINGMODEL].cDefault, "REINERS"); - sprintf(options[OPT_MAGBRAKINGMODEL].cValues, + fvFormattedString(&options[OPT_MAGBRAKINGMODEL].cName, "sMagBrakingModel"); + fvFormattedString(&options[OPT_MAGBRAKINGMODEL].cDescr, "Magnetic braking model."); + fvFormattedString(&options[OPT_MAGBRAKINGMODEL].cDefault, "REINERS"); + fvFormattedString(&options[OPT_MAGBRAKINGMODEL].cValues, "REINERS, SKUMANICH, MATT, NONE"); options[OPT_MAGBRAKINGMODEL].iType = 3; options[OPT_MAGBRAKINGMODEL].bMultiFile = 1; fnRead[OPT_MAGBRAKINGMODEL] = &ReadMagBrakingModel; - sprintf(options[OPT_STELLARMODEL].cLongDescr, + fvFormattedString(&options[OPT_STELLARMODEL].cLongDescr, "If REINERS is selected, the stellar magnetic braking model of\n" "Reiners & Mohanty (2012, ApJ, 746, 43) is used to modify the " "rotation rate.\n" @@ -498,27 +498,27 @@ void InitializeOptionsStellar(OPTIONS *options, fnReadOption fnRead[]) { "MATT uses the model from Matt, S. et al. (2015, ApJ, 799, 23).\n" "NONE applies no magnetic torque.\n"); - sprintf(options[OPT_WINDMODEL].cName, "sWindModel"); - sprintf(options[OPT_WINDMODEL].cDescr, "Wind Angular Momentum Loss Model"); - sprintf(options[OPT_WINDMODEL].cDefault, "REINERS"); + fvFormattedString(&options[OPT_WINDMODEL].cName, "sWindModel"); + fvFormattedString(&options[OPT_WINDMODEL].cDescr, "Wind Angular Momentum Loss Model"); + fvFormattedString(&options[OPT_WINDMODEL].cDefault, "REINERS"); options[OPT_WINDMODEL].iType = 3; options[OPT_WINDMODEL].bMultiFile = 1; fnRead[OPT_WINDMODEL] = &ReadWindModel; - sprintf(options[OPT_WINDMODEL].cLongDescr, + fvFormattedString(&options[OPT_WINDMODEL].cLongDescr, "If REINERS is selected, the stellar wind model of Reiners and " "Mohanty\n" "(2012, ApJ, 746, 43) is used to modify the rotation rate."); - sprintf(options[OPT_XUVMODEL].cName, "sXUVModel"); - sprintf(options[OPT_XUVMODEL].cDescr, "XUV Evolution Model"); - sprintf(options[OPT_XUVMODEL].cDefault, "RIBAS"); - sprintf(options[OPT_XUVMODEL].cValues, "RIBAS REINERS NONE"); + fvFormattedString(&options[OPT_XUVMODEL].cName, "sXUVModel"); + fvFormattedString(&options[OPT_XUVMODEL].cDescr, "XUV Evolution Model"); + fvFormattedString(&options[OPT_XUVMODEL].cDefault, "RIBAS"); + fvFormattedString(&options[OPT_XUVMODEL].cValues, "RIBAS REINERS NONE"); options[OPT_XUVMODEL].iType = 3; options[OPT_XUVMODEL].bMultiFile = 1; options[OPT_XUVMODEL].iModuleBit = STELLAR; fnRead[OPT_XUVMODEL] = &ReadXUVModel; - sprintf( - options[OPT_XUVMODEL].cLongDescr, + fvFormattedString( + &options[OPT_XUVMODEL].cLongDescr, "This parameter sets the XUV evolution model used in STELLAR. Setting\n" "this to RIBAS (default) will evolve the XUV luminosity according to \n" "the saturated power law of Ribas et al (2005, ApJ, 611, 680),\n" @@ -529,93 +529,93 @@ void InitializeOptionsStellar(OPTIONS *options, fnReadOption fnRead[]) { "parameter to NONE, in which case the XUV luminosity will remain " "constant."); - sprintf(options[OPT_HZMODEL].cName, "sHZModel"); - sprintf(options[OPT_HZMODEL].cDescr, "Habitable Zone Model: Kopparapu13"); - sprintf(options[OPT_HZMODEL].cDefault, "Kopparapu13"); + fvFormattedString(&options[OPT_HZMODEL].cName, "sHZModel"); + fvFormattedString(&options[OPT_HZMODEL].cDescr, "Habitable Zone Model: Kopparapu13"); + fvFormattedString(&options[OPT_HZMODEL].cDefault, "Kopparapu13"); options[OPT_HZMODEL].iType = 3; options[OPT_HZMODEL].bMultiFile = 1; fnRead[OPT_HZMODEL] = &ReadHZModel; - sprintf(options[OPT_HZMODEL].cLongDescr, + fvFormattedString(&options[OPT_HZMODEL].cLongDescr, "If KOPPARAPU13 is selected then the Recent Venus, Runaway " "Greenhouse,\n" "Maximum Greenhouse, and Early Mars habitable zone limits will be\n" "calculated from Kopparapu, R. et al. (2013, ApJ, 765, 131)."); - sprintf(options[OPT_HALTENDBARAFFEFGRID].cName, "bHaltEndBaraffeGrid"); - sprintf(options[OPT_HALTENDBARAFFEFGRID].cDescr, + fvFormattedString(&options[OPT_HALTENDBARAFFEFGRID].cName, "bHaltEndBaraffeGrid"); + fvFormattedString(&options[OPT_HALTENDBARAFFEFGRID].cDescr, "Halt when we reach the end of the Baraffe+15 grid?"); - sprintf(options[OPT_HALTENDBARAFFEFGRID].cDefault, "1"); + fvFormattedString(&options[OPT_HALTENDBARAFFEFGRID].cDefault, "1"); options[OPT_HALTENDBARAFFEFGRID].iType = 0; fnRead[OPT_HALTENDBARAFFEFGRID] = &ReadHaltEndBaraffeGrid; - sprintf(options[OPT_HALTENDBARAFFEFGRID].cLongDescr, + fvFormattedString(&options[OPT_HALTENDBARAFFEFGRID].cLongDescr, "The BARRAFFE stellar model will only compute parameters until the " "end of\n" "the main sequence. Setting this flag to 1 will halt the code if the " "end\n" "of the model grid is reached."); - sprintf(options[OPT_ROSSBYCUT].cName, "bRossbyCut"); - sprintf(options[OPT_ROSSBYCUT].cDescr, + fvFormattedString(&options[OPT_ROSSBYCUT].cName, "bRossbyCut"); + fvFormattedString(&options[OPT_ROSSBYCUT].cDescr, "Terminate magnetic braking when Rossby number > 2.08?"); - sprintf(options[OPT_ROSSBYCUT].cDefault, "0"); // XXX Units? + fvFormattedString(&options[OPT_ROSSBYCUT].cDefault, "0"); // XXX Units? options[OPT_ROSSBYCUT].iType = 0; options[OPT_ROSSBYCUT].bMultiFile = 1; options[OPT_ROSSBYCUT].iModuleBit = STELLAR; fnRead[OPT_ROSSBYCUT] = &ReadRossbyCut; - sprintf(options[OPT_ROSSBYCUT].cLongDescr, + fvFormattedString(&options[OPT_ROSSBYCUT].cLongDescr, "Van Saders, J. et al. (2019, ApJ, 872, 128) find that when the " "stellar\n" "Rossby number exceeds 2.08, then the magnetic braking is quenched. " "This\n" "flag enforces that behavior."); - sprintf(options[OPT_EVOVLERG].cName, "bEvolveRG"); - sprintf(options[OPT_EVOVLERG].cDescr, "Evolve stellar radius of gyration?"); - sprintf(options[OPT_EVOVLERG].cDefault, "1"); + fvFormattedString(&options[OPT_EVOVLERG].cName, "bEvolveRG"); + fvFormattedString(&options[OPT_EVOVLERG].cDescr, "Evolve stellar radius of gyration?"); + fvFormattedString(&options[OPT_EVOVLERG].cDefault, "1"); options[OPT_EVOVLERG].iType = 0; options[OPT_EVOVLERG].bMultiFile = 1; options[OPT_EVOVLERG].iModuleBit = STELLAR; fnRead[OPT_EVOVLERG] = &ReadEvolveRG; - sprintf(options[OPT_EVOVLERG].cLongDescr, + fvFormattedString(&options[OPT_EVOVLERG].cLongDescr, "Set this flag to 0 to ignore the role of mass concentration in " "stellar\n" "evolution. Only useful for testing purposes."); - sprintf(options[OPT_LUMAMPLITUDE].cName, "dLuminosityAmplitude"); - sprintf(options[OPT_LUMAMPLITUDE].cDescr, + fvFormattedString(&options[OPT_LUMAMPLITUDE].cName, "dLuminosityAmplitude"); + fvFormattedString(&options[OPT_LUMAMPLITUDE].cDescr, "Amplitude of luminosity oscillation for SINEWAVE stellar model"); - sprintf(options[OPT_LUMAMPLITUDE].cDefault, "0.001"); + fvFormattedString(&options[OPT_LUMAMPLITUDE].cDefault, "0.001"); options[OPT_LUMAMPLITUDE].dDefault = 0.001; options[OPT_LUMAMPLITUDE].iType = 0; options[OPT_LUMAMPLITUDE].bMultiFile = 1; options[OPT_LUMAMPLITUDE].iModuleBit = STELLAR; options[OPT_LUMAMPLITUDE].dNeg = LSUN; - sprintf(options[OPT_LUMAMPLITUDE].cNeg, "Solar Luminosity (LSUN)"); + fvFormattedString(&options[OPT_LUMAMPLITUDE].cNeg, "Solar Luminosity (LSUN)"); fnRead[OPT_LUMAMPLITUDE] = &ReadLuminosityAmplitude; - sprintf(options[OPT_LUMPERIOD].cName, "dLuminosityPeriod"); - sprintf(options[OPT_LUMPERIOD].cDescr, + fvFormattedString(&options[OPT_LUMPERIOD].cName, "dLuminosityPeriod"); + fvFormattedString(&options[OPT_LUMPERIOD].cDescr, "Period of luminosity oscillation for SINEWAVE stellar model"); - sprintf(options[OPT_LUMPERIOD].cDefault, "0.001"); + fvFormattedString(&options[OPT_LUMPERIOD].cDefault, "0.001"); options[OPT_LUMPERIOD].dDefault = 0.001; options[OPT_LUMPERIOD].iType = 0; options[OPT_LUMPERIOD].bMultiFile = 1; options[OPT_LUMPERIOD].iModuleBit = STELLAR; options[OPT_LUMPERIOD].dNeg = YEARSEC; - sprintf(options[OPT_LUMPERIOD].cNeg, "Years"); + fvFormattedString(&options[OPT_LUMPERIOD].cNeg, "Years"); fnRead[OPT_LUMPERIOD] = &ReadLuminosityPeriod; - sprintf(options[OPT_LUMPHASE].cName, "dLuminosityPhase"); - sprintf( - options[OPT_LUMPHASE].cDescr, + fvFormattedString(&options[OPT_LUMPHASE].cName, "dLuminosityPhase"); + fvFormattedString( + &options[OPT_LUMPHASE].cDescr, "Phase of luminosity oscillation at age=0 for SINEWAVE stellar model"); - sprintf(options[OPT_LUMPHASE].cDefault, "0"); + fvFormattedString(&options[OPT_LUMPHASE].cDefault, "0"); options[OPT_LUMPHASE].dDefault = 0; options[OPT_LUMPHASE].iType = 0; options[OPT_LUMPHASE].bMultiFile = 1; options[OPT_LUMPHASE].iModuleBit = STELLAR; options[OPT_LUMPHASE].dNeg = DEGRAD; - sprintf(options[OPT_LUMPHASE].cNeg, "Degrees"); + fvFormattedString(&options[OPT_LUMPHASE].cNeg, "Degrees"); fnRead[OPT_LUMPHASE] = &ReadLuminosityPhase; } @@ -1261,12 +1261,12 @@ void VerifyHaltStellar(BODY *body, CONTROL *control, OPTIONS *options, void WriteLuminosity(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, - double *dTmp, char cUnit[]) { + double *dTmp, char **cUnit) { *dTmp = body[iBody].dLuminosity; if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { *dTmp /= fdUnitsPower(units->iTime, units->iMass, units->iLength); fsUnitsPower(units, cUnit); @@ -1275,7 +1275,7 @@ void WriteLuminosity(BODY *body, CONTROL *control, OUTPUT *output, void WriteTemperature(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, - double *dTmp, char cUnit[]) { + double *dTmp, char **cUnit) { *dTmp = body[iBody].dTemperature; // Kelvin only fsUnitsTemp(0, cUnit); @@ -1283,12 +1283,12 @@ void WriteTemperature(BODY *body, CONTROL *control, OUTPUT *output, void WriteLXUV(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, double *dTmp, - char cUnit[]) { + char **cUnit) { *dTmp = body[iBody].dLXUV; if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { *dTmp /= fdUnitsPower(units->iTime, units->iMass, units->iLength); fsUnitsPower(units, cUnit); @@ -1297,30 +1297,29 @@ void WriteLXUV(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, void WriteLXUVFrac(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, double *dTmp, - char cUnit[]) { + char **cUnit) { *dTmp = body[iBody].dLXUV / body[iBody].dLuminosity; - strcpy(cUnit, ""); + fvFormattedString(cUnit, ""); } void WriteRossbyNumber(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, - double *dTmp, char cUnit[]) { + double *dTmp, char **cUnit) { *dTmp = body[iBody].dRotPer / fdCranmerSaar2011TauCZ(body[iBody].dTemperature); - strcpy(cUnit, ""); + fvFormattedString(cUnit, ""); } void WriteWindTorque(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, - double *dTmp, char cUnit[]) { - // int iaBody[1] = {iBody}; // Is this the way, then iaBody below? + double *dTmp, char **cUnit) { *dTmp = fdDJDtMagBrakingStellar(body, system, &iBody); - strcpy(cUnit, ""); + fvFormattedString(cUnit, ""); } void WriteDRotPerDtStellar(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, - int iBody, double *dTmp, char cUnit[]) { + int iBody, double *dTmp, char **cUnit) { double dDeriv; int iPert; @@ -1331,17 +1330,17 @@ void WriteDRotPerDtStellar(BODY *body, CONTROL *control, OUTPUT *output, *dTmp = dDeriv * (-2 * PI / (body[iBody].dRotRate * body[iBody].dRotRate)); if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { - strcpy(cUnit, ""); + fvFormattedString(cUnit, ""); } } void InitializeOutputStellar(OUTPUT *output, fnWriteOutput fnWrite[]) { - sprintf(output[OUT_LUMINOSITY].cName, "Luminosity"); - sprintf(output[OUT_LUMINOSITY].cDescr, "Luminosity"); - sprintf(output[OUT_LUMINOSITY].cNeg, "LSUN"); + fvFormattedString(&output[OUT_LUMINOSITY].cName, "Luminosity"); + fvFormattedString(&output[OUT_LUMINOSITY].cDescr, "Luminosity"); + fvFormattedString(&output[OUT_LUMINOSITY].cNeg, "LSUN"); output[OUT_LUMINOSITY].bNeg = 1; output[OUT_LUMINOSITY].dNeg = 1. / LSUN; output[OUT_LUMINOSITY].iNum = 1; @@ -1349,47 +1348,47 @@ void InitializeOutputStellar(OUTPUT *output, fnWriteOutput fnWrite[]) { fnWrite[OUT_LUMINOSITY] = &WriteLuminosity; // Maybe change to TEFF? XXX - sprintf(output[OUT_TEMPERATURE].cName, "Temperature"); - sprintf(output[OUT_TEMPERATURE].cDescr, "Effective Temperature"); + fvFormattedString(&output[OUT_TEMPERATURE].cName, "Temperature"); + fvFormattedString(&output[OUT_TEMPERATURE].cDescr, "Effective Temperature"); output[OUT_TEMPERATURE].bNeg = 0; output[OUT_TEMPERATURE].iNum = 1; output[OUT_TEMPERATURE].iModuleBit = STELLAR; fnWrite[OUT_TEMPERATURE] = &WriteTemperature; - sprintf(output[OUT_LXUV].cName, "LXUVStellar"); - sprintf(output[OUT_LXUV].cDescr, "Base X-ray/XUV Luminosity"); - sprintf(output[OUT_LXUV].cNeg, "LSUN"); + fvFormattedString(&output[OUT_LXUV].cName, "LXUVStellar"); + fvFormattedString(&output[OUT_LXUV].cDescr, "Base X-ray/XUV Luminosity"); + fvFormattedString(&output[OUT_LXUV].cNeg, "LSUN"); output[OUT_LXUV].bNeg = 1; output[OUT_LXUV].dNeg = 1. / LSUN; output[OUT_LXUV].iNum = 1; output[OUT_LXUV].iModuleBit = STELLAR; fnWrite[OUT_LXUV] = &WriteLXUV; - sprintf(output[OUT_LXUVFRAC].cName, "LXUVFrac"); - sprintf(output[OUT_LXUVFRAC].cDescr, "Fraction of luminosity in XUV"); + fvFormattedString(&output[OUT_LXUVFRAC].cName, "LXUVFrac"); + fvFormattedString(&output[OUT_LXUVFRAC].cDescr, "Fraction of luminosity in XUV"); output[OUT_LXUVFRAC].bNeg = 0; output[OUT_LXUVFRAC].iNum = 1; output[OUT_LXUVFRAC].iModuleBit = STELLAR; fnWrite[OUT_LXUVFRAC] = &WriteLXUVFrac; - sprintf(output[OUT_ROSSBYNUMBER].cName, "RossbyNumber"); - sprintf(output[OUT_ROSSBYNUMBER].cDescr, "Rossby Number"); + fvFormattedString(&output[OUT_ROSSBYNUMBER].cName, "RossbyNumber"); + fvFormattedString(&output[OUT_ROSSBYNUMBER].cDescr, "Rossby Number"); output[OUT_ROSSBYNUMBER].bNeg = 0; output[OUT_ROSSBYNUMBER].iNum = 1; output[OUT_ROSSBYNUMBER].iModuleBit = STELLAR; fnWrite[OUT_ROSSBYNUMBER] = &WriteRossbyNumber; - sprintf(output[OUT_WINDTORQUE].cName, "WindTorque"); - sprintf(output[OUT_WINDTORQUE].cDescr, "Stellar Wind Torque"); + fvFormattedString(&output[OUT_WINDTORQUE].cName, "WindTorque"); + fvFormattedString(&output[OUT_WINDTORQUE].cDescr, "Stellar Wind Torque"); output[OUT_WINDTORQUE].bNeg = 0; output[OUT_WINDTORQUE].iNum = 1; output[OUT_WINDTORQUE].iModuleBit = STELLAR; fnWrite[OUT_WINDTORQUE] = &WriteWindTorque; - sprintf(output[OUT_DROTPERDTSTELLAR].cName, "DRotPerDtStellar"); - sprintf(output[OUT_DROTPERDTSTELLAR].cDescr, + fvFormattedString(&output[OUT_DROTPERDTSTELLAR].cName, "DRotPerDtStellar"); + fvFormattedString(&output[OUT_DROTPERDTSTELLAR].cDescr, "Time Rate of Change of Rotation Period in STELLAR"); - sprintf(output[OUT_DROTPERDTSTELLAR].cNeg, "days/Myr"); + fvFormattedString(&output[OUT_DROTPERDTSTELLAR].cNeg, "days/Myr"); output[OUT_DROTPERDTSTELLAR].bNeg = 1; output[OUT_DROTPERDTSTELLAR].dNeg = DAYSEC / (YEARSEC * 1e6); output[OUT_DROTPERDTSTELLAR].iNum = 1; diff --git a/src/stellar.h b/src/stellar.h index 9dd08eef6..e286e5c90 100644 --- a/src/stellar.h +++ b/src/stellar.h @@ -138,19 +138,19 @@ void InitializeOutputFunctionStellar(OUTPUT *, int, int); void FinalizeOutputFunctionStellar(OUTPUT *, int, int); void WriteLuminosity(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, UPDATE *, - int, double *, char[]); + int, double *, char**); void WriteTemperature(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, UPDATE *, - int, double *, char[]); + int, double *, char**); void WriteLXUV(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, UPDATE *, int, - double *, char[]); + double *, char**); void WriteLXUVFrac(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, UPDATE *, - int, double *, char[]); + int, double *, char**); void WriteRossbyNumber(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, UPDATE *, - int, double *, char[]); + int, double *, char**); void WriteWindTorque(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, UPDATE *, - int, double *, char[]); + int, double *, char**); void WriteDRotPerDtStellar(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, - UPDATE *, int, double *, char[]); + UPDATE *, int, double *, char**); /* Logging Functions */ void LogOptionsStellar(CONTROL *, FILE *); diff --git a/src/system.c b/src/system.c index 4c7d7a22b..21a598107 100644 --- a/src/system.c +++ b/src/system.c @@ -7,6 +7,10 @@ #include "vplanet.h" +void InitializeSystem(BODY *body,CONTROL *control,SYSTEM *system) { + system->iNumBodies = control->Evolve.iNumBodies; +} + /* * Physical Relationships */ diff --git a/src/system.h b/src/system.h index f481529c5..c38dabb4a 100644 --- a/src/system.h +++ b/src/system.h @@ -7,6 +7,8 @@ /* @cond DOXYGEN_OVERRIDE */ +void InitializeSystem(BODY *,CONTROL *,SYSTEM *); + double fdSemiToPeriod(double, double); double fdPeriodToSemi(double, double); double fdSemiToMeanMotion(double, double); diff --git a/src/thermint.c b/src/thermint.c index bf26af644..3fc651193 100644 --- a/src/thermint.c +++ b/src/thermint.c @@ -1181,273 +1181,245 @@ void fvReadImK2ManOrbModel(BODY *body, CONTROL *control, FILES *files, void fvInitializeOptionsThermint(OPTIONS *options, fnReadOption fnRead[]) { int iOpt, iFile; - /* TSurf */ - sprintf(options[OPT_TSURF].cName, "dTSurf"); - sprintf(options[OPT_TSURF].cDescr, "Initial Surface Temperature"); - sprintf(options[OPT_TSURF].cDefault, "300 K"); - sprintf(options[OPT_TSURF].cDimension, "temperature"); + fvFormattedString(&options[OPT_TSURF].cName, "dTSurf"); + fvFormattedString(&options[OPT_TSURF].cDescr, "Initial Surface Temperature"); + fvFormattedString(&options[OPT_TSURF].cDefault, "300 K"); + fvFormattedString(&options[OPT_TSURF].cDimension, "temperature"); options[OPT_TSURF].iType = 2; options[OPT_TSURF].bMultiFile = 1; options[OPT_TSURF].dNeg = 1; // Not sure about this?? options[OPT_TSURF].dDefault = TSURF; - sprintf(options[OPT_TSURF].cNeg, "No negative behavior"); + fvFormattedString(&options[OPT_TSURF].cNeg, "No negative behavior"); fnRead[OPT_TSURF] = &fvReadTSurf; - /* TMan */ - sprintf(options[OPT_TMAN].cName, "dTMan"); - sprintf(options[OPT_TMAN].cDescr, "Initial Mantle Temperature"); - sprintf(options[OPT_TMAN].cDefault, "3000 K"); - sprintf(options[OPT_TMAN].cDimension, "temperature"); + fvFormattedString(&options[OPT_TMAN].cName, "dTMan"); + fvFormattedString(&options[OPT_TMAN].cDescr, "Initial Mantle Temperature"); + fvFormattedString(&options[OPT_TMAN].cDefault, "3000 K"); + fvFormattedString(&options[OPT_TMAN].cDimension, "temperature"); options[OPT_TMAN].iType = 2; options[OPT_TMAN].bMultiFile = 1; options[OPT_TMAN].dNeg = 3000.0; // Not sure about this?? options[OPT_TMAN].dDefault = 3000.0; - sprintf(options[OPT_TMAN].cNeg, "No negative behavior"); + fvFormattedString(&options[OPT_TMAN].cNeg, "No negative behavior"); fnRead[OPT_TMAN] = &fvReadTMan; - /* TCore */ - sprintf(options[OPT_TCORE].cName, "dTCore"); - sprintf(options[OPT_TCORE].cDescr, "Initial Core Temperature"); - sprintf(options[OPT_TCORE].cDefault, "6000 K"); - sprintf(options[OPT_TCORE].cDimension, "temperature"); + fvFormattedString(&options[OPT_TCORE].cName, "dTCore"); + fvFormattedString(&options[OPT_TCORE].cDescr, "Initial Core Temperature"); + fvFormattedString(&options[OPT_TCORE].cDefault, "6000 K"); + fvFormattedString(&options[OPT_TCORE].cDimension, "temperature"); options[OPT_TCORE].iType = 2; options[OPT_TCORE].bMultiFile = 1; options[OPT_TCORE].dNeg = 6000.0; // Not sure about this?? options[OPT_TCORE].dDefault = 6000.0; - sprintf(options[OPT_TCORE].cNeg, "No negative behavior"); + fvFormattedString(&options[OPT_TCORE].cNeg, "No negative behavior"); fnRead[OPT_TCORE] = &fvReadTCore; - /* ViscJumpMan */ - sprintf(options[OPT_VISCJUMPMAN].cName, "dViscJumpMan"); - sprintf(options[OPT_VISCJUMPMAN].cDescr, "ViscJumpMan"); - sprintf(options[OPT_VISCJUMPMAN].cDefault, "VISCJUMPMAN"); - sprintf(options[OPT_VISCJUMPMAN].cDimension, "nd"); + fvFormattedString(&options[OPT_VISCJUMPMAN].cName, "dViscJumpMan"); + fvFormattedString(&options[OPT_VISCJUMPMAN].cDescr, "ViscJumpMan"); + fvFormattedString(&options[OPT_VISCJUMPMAN].cDefault, "VISCJUMPMAN"); + fvFormattedString(&options[OPT_VISCJUMPMAN].cDimension, "nd"); options[OPT_VISCJUMPMAN].iType = 2; options[OPT_VISCJUMPMAN].bMultiFile = 1; options[OPT_VISCJUMPMAN].dNeg = VISCJUMPMAN; options[OPT_VISCJUMPMAN].dDefault = VISCJUMPMAN; - sprintf(options[OPT_VISCJUMPMAN].cNeg, "No negative behavior"); + fvFormattedString(&options[OPT_VISCJUMPMAN].cNeg, "No negative behavior"); fnRead[OPT_VISCJUMPMAN] = &fvReadViscJumpMan; - // Needs a LongDescr - sprintf(options[OPT_VISCJUMPMAN].cLongDescr, + fvFormattedString(&options[OPT_VISCJUMPMAN].cLongDescr, "Numerical factor that is used to get the lower mantle thermal " "boundary \n" "viscosity visc_UMan from the upper mantle viscosity visc_LM by \n" "visc_LM=ViscJumpMan*visc_UM. See eq (163) in Barnes et al (2020)."); - /* ViscRef */ - sprintf(options[OPT_VISCREF].cName, "dViscRef"); - sprintf(options[OPT_VISCREF].cDescr, "ViscRef"); - sprintf(options[OPT_VISCREF].cDefault, "1"); - sprintf(options[OPT_VISCREF].cDimension, "length^2/time"); + fvFormattedString(&options[OPT_VISCREF].cName, "dViscRef"); + fvFormattedString(&options[OPT_VISCREF].cDescr, "ViscRef"); + fvFormattedString(&options[OPT_VISCREF].cDefault, "1"); + fvFormattedString(&options[OPT_VISCREF].cDimension, "length^2/time"); options[OPT_VISCREF].iType = 2; options[OPT_VISCREF].bMultiFile = 1; options[OPT_VISCREF].dNeg = VISCREF; options[OPT_VISCREF].dDefault = VISCREF; - sprintf(options[OPT_VISCREF].cNeg, "No negative behavior"); + fvFormattedString(&options[OPT_VISCREF].cNeg, "No negative behavior"); fnRead[OPT_VISCREF] = &fvReadViscRef; - // Needs a LongDescr - sprintf(options[OPT_VISCREF].cLongDescr, + fvFormattedString(&options[OPT_VISCREF].cLongDescr, "Coefficient in front of viscosity equation \n" "see eq (159) in Barnes et al. (2020)."); - /* TrefLind */ - sprintf(options[OPT_TREFLIND].cName, "dTrefLind"); - sprintf(options[OPT_TREFLIND].cDescr, "TrefLind"); - sprintf(options[OPT_TREFLIND].cDefault, "Value in thermint.h"); - sprintf(options[OPT_TREFLIND].cDimension, "temperature"); + fvFormattedString(&options[OPT_TREFLIND].cName, "dTrefLind"); + fvFormattedString(&options[OPT_TREFLIND].cDescr, "TrefLind"); + fvFormattedString(&options[OPT_TREFLIND].cDefault, "Value in thermint.h"); + fvFormattedString(&options[OPT_TREFLIND].cDimension, "temperature"); options[OPT_TREFLIND].iType = 2; options[OPT_TREFLIND].bMultiFile = 1; options[OPT_TREFLIND].dNeg = 1; // XXX If negative, is really expressed in terms of TREFLIND?? options[OPT_TREFLIND].dDefault = TREFLIND; - sprintf(options[OPT_TREFLIND].cNeg, "No negative behavior"); + fvFormattedString(&options[OPT_TREFLIND].cNeg, "No negative behavior"); fnRead[OPT_TREFLIND] = &fvReadTrefLind; - sprintf(options[OPT_TREFLIND].cLongDescr, + fvFormattedString(&options[OPT_TREFLIND].cLongDescr, "Lindemann's law reference temperature, also called T_Fe0 in " "Driscoll \n" "Bercovici (2015), see their Eq. A23. Default value is set to " "TREFLIND,\n" "which is defined in thermint.h)"); - /* DTChiRef */ - sprintf(options[OPT_DTCHIREF].cName, "dDTChiRef"); - sprintf(options[OPT_DTCHIREF].cDescr, "DTChiRef"); - sprintf(options[OPT_DTCHIREF].cDefault, "Value in thermint.h"); - sprintf(options[OPT_DTCHIREF].cDimension, "temperature"); + fvFormattedString(&options[OPT_DTCHIREF].cName, "dDTChiRef"); + fvFormattedString(&options[OPT_DTCHIREF].cDescr, "DTChiRef"); + fvFormattedString(&options[OPT_DTCHIREF].cDefault, "Value in thermint.h"); + fvFormattedString(&options[OPT_DTCHIREF].cDimension, "temperature"); options[OPT_DTCHIREF].iType = 2; options[OPT_DTCHIREF].bMultiFile = 1; options[OPT_DTCHIREF].dNeg = 1; options[OPT_DTCHIREF].dDefault = DTCHIREF; - sprintf(options[OPT_DTCHIREF].cNeg, "No negative behavior"); + fvFormattedString(&options[OPT_DTCHIREF].cNeg, "No negative behavior"); fnRead[OPT_DTCHIREF] = &fvReadDTChiRef; - // Needs a LongDescr - sprintf( - options[OPT_DTCHIREF].cLongDescr, + fvFormattedString( + &options[OPT_DTCHIREF].cLongDescr, "Core liquidus (melting temperature) depression due to the presence \n" "of light elements in the core. See eq (175) in Barnes et al (2020)."); - /* EruptEff */ - sprintf(options[OPT_ERUPTEFF].cName, "dEruptEff"); - sprintf(options[OPT_ERUPTEFF].cDescr, "Melt Eruption Efficiency"); - sprintf(options[OPT_ERUPTEFF].cDefault, "ERUPTEFF"); - sprintf(options[OPT_ERUPTEFF].cDimension, "nd"); + fvFormattedString(&options[OPT_ERUPTEFF].cName, "dEruptEff"); + fvFormattedString(&options[OPT_ERUPTEFF].cDescr, "Melt Eruption Efficiency"); + fvFormattedString(&options[OPT_ERUPTEFF].cDefault, "ERUPTEFF"); + fvFormattedString(&options[OPT_ERUPTEFF].cDimension, "nd"); options[OPT_ERUPTEFF].iType = 2; options[OPT_ERUPTEFF].bMultiFile = 1; options[OPT_ERUPTEFF].dNeg = ERUPTEFF; // XXX options[OPT_ERUPTEFF].dDefault = ERUPTEFF; - sprintf(options[OPT_ERUPTEFF].cNeg, "No negative behavior"); + fvFormattedString(&options[OPT_ERUPTEFF].cNeg, "No negative behavior"); fnRead[OPT_ERUPTEFF] = &fvReadEruptEff; - // Needs a LongDescr - sprintf(options[OPT_ERUPTEFF].cLongDescr, + fvFormattedString(&options[OPT_ERUPTEFF].cLongDescr, "Fraction of heat in mantle melt that escapes to the surface. \n" "See eq (187) in Barnes et al (2020)."); - /* ViscMeltPhis */ - sprintf(options[OPT_VISCMELTPHIS].cName, "dViscMeltPhis"); - sprintf(options[OPT_VISCMELTPHIS].cDescr, "Viscosity Melt Factor Phi star"); - sprintf(options[OPT_VISCMELTPHIS].cDefault, "Default is VISCMELTPHIS"); - sprintf(options[OPT_VISCMELTPHIS].cDimension, "nd"); + fvFormattedString(&options[OPT_VISCMELTPHIS].cName, "dViscMeltPhis"); + fvFormattedString(&options[OPT_VISCMELTPHIS].cDescr, "Viscosity Melt Factor Phi star"); + fvFormattedString(&options[OPT_VISCMELTPHIS].cDefault, "Default is VISCMELTPHIS"); + fvFormattedString(&options[OPT_VISCMELTPHIS].cDimension, "nd"); options[OPT_VISCMELTPHIS].iType = 2; options[OPT_VISCMELTPHIS].bMultiFile = 1; options[OPT_VISCMELTPHIS].dNeg = VISCMELTPHIS; // XXX options[OPT_VISCMELTPHIS].dDefault = VISCMELTPHIS; - sprintf(options[OPT_VISCMELTPHIS].cNeg, "No negative behavior"); + fvFormattedString(&options[OPT_VISCMELTPHIS].cNeg, "No negative behavior"); fnRead[OPT_VISCMELTPHIS] = &fvReadViscMeltPhis; - sprintf( - options[OPT_VISCMELTPHIS].cLongDescr, + fvFormattedString( + &options[OPT_VISCMELTPHIS].cLongDescr, "Viscosity-melt reduction coefficient, \"phi*\" in Eq. 8 of Driscoll \n" "Bercovici (2015)."); - /* ViscMeltXi */ - sprintf(options[OPT_VISCMELTXI].cName, "dViscMeltXi"); - sprintf(options[OPT_VISCMELTXI].cDescr, "Viscosity Melt Factor Xi"); - sprintf(options[OPT_VISCMELTXI].cDefault, "Default is VISCMELTXI"); - sprintf(options[OPT_VISCMELTXI].cDimension, "nd"); + fvFormattedString(&options[OPT_VISCMELTXI].cName, "dViscMeltXi"); + fvFormattedString(&options[OPT_VISCMELTXI].cDescr, "Viscosity Melt Factor Xi"); + fvFormattedString(&options[OPT_VISCMELTXI].cDefault, "Default is VISCMELTXI"); + fvFormattedString(&options[OPT_VISCMELTXI].cDimension, "nd"); options[OPT_VISCMELTXI].iType = 2; options[OPT_VISCMELTXI].bMultiFile = 1; options[OPT_VISCMELTXI].dNeg = VISCMELTXI; options[OPT_VISCMELTXI].dDefault = VISCMELTXI; - sprintf(options[OPT_VISCMELTXI].cNeg, "No negative behavior"); + fvFormattedString(&options[OPT_VISCMELTXI].cNeg, "No negative behavior"); fnRead[OPT_VISCMELTXI] = &fvReadViscMeltXi; - // Needs a LongDescr - sprintf(options[OPT_VISCMELTXI].cLongDescr, + fvFormattedString(&options[OPT_VISCMELTXI].cLongDescr, "Constant used to compute the reduction in mantle viscosity \n" "due to the presence of melt. See eq (162) in Barnes et al (2020) \n" "and Costa et al (2009) for values for different materials."); - /* ViscMeltGamma */ - sprintf(options[OPT_VISCMELTGAMMA].cName, "dViscMeltGamma"); - sprintf(options[OPT_VISCMELTGAMMA].cDescr, "Viscosity Melt Factor Gamma"); - sprintf(options[OPT_VISCMELTGAMMA].cDefault, "Default is VISCMELTGAMMA"); - sprintf(options[OPT_VISCMELTGAMMA].cDimension, "nd"); + fvFormattedString(&options[OPT_VISCMELTGAMMA].cName, "dViscMeltGamma"); + fvFormattedString(&options[OPT_VISCMELTGAMMA].cDescr, "Viscosity Melt Factor Gamma"); + fvFormattedString(&options[OPT_VISCMELTGAMMA].cDefault, "Default is VISCMELTGAMMA"); + fvFormattedString(&options[OPT_VISCMELTGAMMA].cDimension, "nd"); options[OPT_VISCMELTGAMMA].iType = 2; options[OPT_VISCMELTGAMMA].bMultiFile = 1; options[OPT_VISCMELTGAMMA].dNeg = VISCMELTGAMMA; options[OPT_VISCMELTGAMMA].dDefault = VISCMELTGAMMA; - sprintf(options[OPT_VISCMELTGAMMA].cNeg, "No negative behavior"); + fvFormattedString(&options[OPT_VISCMELTGAMMA].cNeg, "No negative behavior"); fnRead[OPT_VISCMELTGAMMA] = &fvReadViscMeltGamma; - // Needs a LongDescr - sprintf(options[OPT_VISCMELTGAMMA].cLongDescr, + fvFormattedString(&options[OPT_VISCMELTGAMMA].cLongDescr, "Constant used to compute the reduction in mantle viscosity \n" "due to the presence of melt. See eq (162) in Barnes et al (2020) \n" "and Costa et al (2009) for values for different materials."); - /* ViscMeltDelta */ - sprintf(options[OPT_VISCMELTDELTA].cName, "dViscMeltDelta"); - sprintf(options[OPT_VISCMELTDELTA].cDescr, "Viscosity Melt Factor Delta"); - sprintf(options[OPT_VISCMELTDELTA].cDefault, "Default is VISCMELTDELTA"); - sprintf(options[OPT_VISCMELTDELTA].cDimension, "nd"); + fvFormattedString(&options[OPT_VISCMELTDELTA].cName, "dViscMeltDelta"); + fvFormattedString(&options[OPT_VISCMELTDELTA].cDescr, "Viscosity Melt Factor Delta"); + fvFormattedString(&options[OPT_VISCMELTDELTA].cDefault, "Default is VISCMELTDELTA"); + fvFormattedString(&options[OPT_VISCMELTDELTA].cDimension, "nd"); options[OPT_VISCMELTDELTA].iType = 2; options[OPT_VISCMELTDELTA].bMultiFile = 1; options[OPT_VISCMELTDELTA].dNeg = VISCMELTDELTA; options[OPT_VISCMELTDELTA].dDefault = VISCMELTDELTA; - sprintf(options[OPT_VISCMELTDELTA].cNeg, "No negative behavior"); + fvFormattedString(&options[OPT_VISCMELTDELTA].cNeg, "No negative behavior"); fnRead[OPT_VISCMELTDELTA] = &fvReadViscMeltDelta; - // Needs a LongDescr - sprintf(options[OPT_VISCMELTDELTA].cLongDescr, + fvFormattedString(&options[OPT_VISCMELTDELTA].cLongDescr, "Constant used to compute the reduction in mantle viscosity \n" "due to the presence of melt. See eq (161) in Barnes et al (2020) \n" "and Costa et al (2009) for values for different materials."); - /* ViscMeltB */ - sprintf(options[OPT_VISCMELTB].cName, "dViscMeltB"); - sprintf(options[OPT_VISCMELTB].cDescr, "Viscosity Melt Factor B"); - sprintf(options[OPT_VISCMELTB].cDefault, "Default is VISCMELTB"); - sprintf(options[OPT_VISCMELTB].cDimension, "nd"); + fvFormattedString(&options[OPT_VISCMELTB].cName, "dViscMeltB"); + fvFormattedString(&options[OPT_VISCMELTB].cDescr, "Viscosity Melt Factor B"); + fvFormattedString(&options[OPT_VISCMELTB].cDefault, "Default is VISCMELTB"); + fvFormattedString(&options[OPT_VISCMELTB].cDimension, "nd"); options[OPT_VISCMELTB].iType = 2; options[OPT_VISCMELTB].bMultiFile = 1; options[OPT_VISCMELTB].dNeg = VISCMELTB; options[OPT_VISCMELTB].dDefault = VISCMELTB; - sprintf(options[OPT_VISCMELTB].cNeg, "No negative behavior"); + fvFormattedString(&options[OPT_VISCMELTB].cNeg, "No negative behavior"); fnRead[OPT_VISCMELTB] = &fvReadViscMeltB; - // Needs a LongDescr - sprintf(options[OPT_VISCMELTB].cLongDescr, + fvFormattedString(&options[OPT_VISCMELTB].cLongDescr, "Constant used to compute the reduction in mantle viscosity \n" "due to the presence of melt. See eq (161) in Barnes et al (2020) \n" "and Costa et al (2009) for values for different materials."); - /* MeltfactorLMan XXX Added by Rory -- Check!*/ - sprintf(options[OPT_MELTFACTORLMAN].cName, "dMeltfactorLMan"); - sprintf(options[OPT_MELTFACTORLMAN].cDescr, + fvFormattedString(&options[OPT_MELTFACTORLMAN].cName, "dMeltfactorLMan"); + fvFormattedString(&options[OPT_MELTFACTORLMAN].cDescr, "Lower Mantle Viscosity Melt Factor"); - sprintf(options[OPT_MELTFACTORLMAN].cDefault, "%f", MELTFACTORLMAN); - sprintf(options[OPT_MELTFACTORLMAN].cDimension, "nd"); + fvFormattedString(&options[OPT_MELTFACTORLMAN].cDefault, "%f", MELTFACTORLMAN); + fvFormattedString(&options[OPT_MELTFACTORLMAN].cDimension, "nd"); options[OPT_MELTFACTORLMAN].iType = 2; options[OPT_MELTFACTORLMAN].bMultiFile = 1; // XXX Rory doesn't think negative options should be allowed here // options[OPT_MELTFACTORLMAN].dNeg = MELTFACTORLMAN; options[OPT_MELTFACTORLMAN].dDefault = MELTFACTORLMAN; - // sprintf(options[OPT_MELTFACTORLMAN].cNeg,"Default is MELTFACTORLMAN"); + // fvFormattedString(options[OPT_MELTFACTORLMAN].cNeg,"Default is MELTFACTORLMAN"); fnRead[OPT_MELTFACTORLMAN] = &fvReadMeltfactorLMan; - // Needs a LongDescr - sprintf( - options[OPT_MELTFACTORLMAN].cLongDescr, + fvFormattedString( + &options[OPT_MELTFACTORLMAN].cLongDescr, "Use to fix the lower mantle viscosity melt factor, defined as \n" "epsilon_phase in eq (159,160) of Barnes et al (2020). Note that \n" "this is an option. Default behavior is to compute this factor from \n" "the local temperature."); - /* MeltfactorUMan */ - sprintf(options[OPT_MELTFACTORUMAN].cName, "dMeltfactorUMan"); - sprintf(options[OPT_MELTFACTORUMAN].cDescr, + fvFormattedString(&options[OPT_MELTFACTORUMAN].cName, "dMeltfactorUMan"); + fvFormattedString(&options[OPT_MELTFACTORUMAN].cDescr, "Upper Mantle Viscosity Melt Factor"); - sprintf(options[OPT_MELTFACTORUMAN].cDefault, "%f", MELTFACTORUMAN); - sprintf(options[OPT_MELTFACTORUMAN].cDimension, "nd"); + fvFormattedString(&options[OPT_MELTFACTORUMAN].cDefault, "%f", MELTFACTORUMAN); + fvFormattedString(&options[OPT_MELTFACTORUMAN].cDimension, "nd"); options[OPT_MELTFACTORUMAN].iType = 2; options[OPT_MELTFACTORUMAN].bMultiFile = 1; options[OPT_MELTFACTORUMAN].dNeg = MELTFACTORUMAN; options[OPT_MELTFACTORUMAN].dDefault = MELTFACTORUMAN; - sprintf(options[OPT_MELTFACTORUMAN].cNeg, "No negative behavior"); + fvFormattedString(&options[OPT_MELTFACTORUMAN].cNeg, "No negative behavior"); fnRead[OPT_MELTFACTORUMAN] = &fvReadMeltfactorUMan; - // Needs a LongDescr - sprintf( - options[OPT_MELTFACTORUMAN].cLongDescr, + fvFormattedString( + &options[OPT_MELTFACTORUMAN].cLongDescr, "Use to fix the upper mantle viscosity melt factor, defined as \n" "epsilon_phase in eq (159,160) of Barnes et al (2020). Note that \n" "this is an option. Default behavior is to compute this factor from \n" "the local temperature."); - /* FixMeltfactorUMan */ - sprintf(options[OPT_FIXMELTFACTORUMAN].cName, "dFixMeltfactorUMan"); - sprintf(options[OPT_FIXMELTFACTORUMAN].cDescr, "Fix Viscosity Melt Factor"); - sprintf(options[OPT_FIXMELTFACTORUMAN].cDefault, + fvFormattedString(&options[OPT_FIXMELTFACTORUMAN].cName, "dFixMeltfactorUMan"); + fvFormattedString(&options[OPT_FIXMELTFACTORUMAN].cDescr, "Fix Viscosity Melt Factor"); + fvFormattedString(&options[OPT_FIXMELTFACTORUMAN].cDefault, "Default is FIXMELTFACTORUMAN"); - sprintf(options[OPT_FIXMELTFACTORUMAN].cDimension, "nd"); + fvFormattedString(&options[OPT_FIXMELTFACTORUMAN].cDimension, "nd"); options[OPT_FIXMELTFACTORUMAN].iType = 2; options[OPT_FIXMELTFACTORUMAN].bMultiFile = 1; options[OPT_FIXMELTFACTORUMAN].dNeg = FIXMELTFACTORUMAN; options[OPT_FIXMELTFACTORUMAN].dDefault = FIXMELTFACTORUMAN; - sprintf(options[OPT_FIXMELTFACTORUMAN].cNeg, "No negative behavior"); + fvFormattedString(&options[OPT_FIXMELTFACTORUMAN].cNeg, "No negative behavior"); fnRead[OPT_FIXMELTFACTORUMAN] = &fvReadFixMeltfactorUMan; - // Needs a LongDescr - sprintf(options[OPT_FIXMELTFACTORUMAN].cLongDescr, + fvFormattedString(&options[OPT_FIXMELTFACTORUMAN].cLongDescr, "Boolean: 1 tells the code to used a fixed upper mantle viscosity " "melt \n" "factor, 0 tells the code to compute it from the local temperature " "(default)."); - /* StagLid */ /* RB: I don't understand this. STAGLID is 0 in thermint.h, so isn't the default not to use staglid? I'd also prefer to see this change to sThermalMode with options pt, sl, and auto. XXX */ @@ -1456,149 +1428,144 @@ void fvInitializeOptionsThermint(OPTIONS *options, fnReadOption fnRead[]) { used. I changed the cDefault and cNeg below. I don't think there is a negative value option here, right? Should a negative value print a warning? */ - sprintf(options[OPT_STAGLID].cName, "dStagLid"); - sprintf(options[OPT_STAGLID].cDescr, "Stagnant Lid Switch"); - sprintf(options[OPT_STAGLID].cDefault, "Default is STAGLID"); - sprintf(options[OPT_STAGLID].cDimension, "nd"); + fvFormattedString(&options[OPT_STAGLID].cName, "dStagLid"); + fvFormattedString(&options[OPT_STAGLID].cDescr, "Stagnant Lid Switch"); + fvFormattedString(&options[OPT_STAGLID].cDefault, "Default is STAGLID"); + fvFormattedString(&options[OPT_STAGLID].cDimension, "nd"); options[OPT_STAGLID].iType = 2; options[OPT_STAGLID].bMultiFile = 1; options[OPT_STAGLID].dNeg = STAGLID; options[OPT_STAGLID].dDefault = STAGLID; - sprintf(options[OPT_STAGLID].cNeg, "No negative behavior"); + fvFormattedString(&options[OPT_STAGLID].cNeg, "No negative behavior"); fnRead[OPT_STAGLID] = &fvReadStagLid; - /* ManHFlowPref */ - sprintf(options[OPT_MANHFLOWPREF].cName, "dManHFlowPref"); - sprintf(options[OPT_MANHFLOWPREF].cDescr, "Mantle HFlow Prefix"); - sprintf(options[OPT_MANHFLOWPREF].cDefault, "Default is MANHFLOWPREF"); - sprintf(options[OPT_MANHFLOWPREF].cDimension, "nd"); + fvFormattedString(&options[OPT_MANHFLOWPREF].cName, "dManHFlowPref"); + fvFormattedString(&options[OPT_MANHFLOWPREF].cDescr, "Mantle HFlow Prefix"); + fvFormattedString(&options[OPT_MANHFLOWPREF].cDefault, "Default is MANHFLOWPREF"); + fvFormattedString(&options[OPT_MANHFLOWPREF].cDimension, "nd"); options[OPT_MANHFLOWPREF].iType = 2; options[OPT_MANHFLOWPREF].bMultiFile = 1; options[OPT_MANHFLOWPREF].dNeg = MANHFLOWPREF; options[OPT_MANHFLOWPREF].dDefault = MANHFLOWPREF; - sprintf(options[OPT_MANHFLOWPREF].cNeg, "No negative behavior"); + fvFormattedString(&options[OPT_MANHFLOWPREF].cNeg, "No negative behavior"); fnRead[OPT_MANHFLOWPREF] = &fvReadManHFlowPref; - // Needs a LongDescr - sprintf(options[OPT_MANHFLOWPREF].cLongDescr, + fvFormattedString(&options[OPT_MANHFLOWPREF].cLongDescr, "Coefficient in front of HflowUMan, value can be anything. \n" "If StagLid>0 then ManHFlowPref=HFLOWREDUCTSTAG. \n" "Otherwise default behavior is 1."); - /* MagMomCoef */ - sprintf(options[OPT_MAGMOMCOEF].cName, "dMagMomCoef"); - sprintf(options[OPT_MAGMOMCOEF].cDescr, "Magnetic Moment Coefficient"); - sprintf(options[OPT_MAGMOMCOEF].cDefault, "Default is MAGMOMCOEF"); - sprintf(options[OPT_MAGMOMCOEF].cDimension, "nd"); + fvFormattedString(&options[OPT_MAGMOMCOEF].cName, "dMagMomCoef"); + fvFormattedString(&options[OPT_MAGMOMCOEF].cDescr, "Magnetic Moment Coefficient"); + fvFormattedString(&options[OPT_MAGMOMCOEF].cDefault, "Default is MAGMOMCOEF"); + fvFormattedString(&options[OPT_MAGMOMCOEF].cDimension, "nd"); options[OPT_MAGMOMCOEF].iType = 2; options[OPT_MAGMOMCOEF].bMultiFile = 1; options[OPT_MAGMOMCOEF].dNeg = MAGMOMCOEF; options[OPT_MAGMOMCOEF].dDefault = MAGMOMCOEF; - sprintf(options[OPT_MAGMOMCOEF].cNeg, "No negative behavior"); + fvFormattedString(&options[OPT_MAGMOMCOEF].cNeg, "No negative behavior"); fnRead[OPT_MAGMOMCOEF] = &fvReadMagMomCoef; - // Needs a LongDescr - sprintf(options[OPT_MAGMOMCOEF].cLongDescr, + fvFormattedString(&options[OPT_MAGMOMCOEF].cLongDescr, "Coefficient in front of magnetic moment scaling law, \n" "gamma_d in eq (192) in Barnes et al (2020)."); - /* PresSWind */ - sprintf(options[OPT_PRESSWIND].cName, "dPresSWind"); - sprintf(options[OPT_PRESSWIND].cDescr, "Stellar Wind Pressure at body"); - sprintf(options[OPT_PRESSWIND].cDefault, "Default is EPRESSWIND"); - sprintf(options[OPT_PRESSWIND].cDimension, "pressure"); + fvFormattedString(&options[OPT_PRESSWIND].cName, "dPresSWind"); + fvFormattedString(&options[OPT_PRESSWIND].cDescr, "Stellar Wind Pressure at body"); + fvFormattedString(&options[OPT_PRESSWIND].cDefault, "Default is EPRESSWIND"); + fvFormattedString(&options[OPT_PRESSWIND].cDimension, "pressure"); options[OPT_PRESSWIND].iType = 2; options[OPT_PRESSWIND].bMultiFile = 1; options[OPT_PRESSWIND].dNeg = EPRESSWIND; options[OPT_PRESSWIND].dDefault = EPRESSWIND; - sprintf(options[OPT_PRESSWIND].cNeg, "No negative behavior"); + fvFormattedString(&options[OPT_PRESSWIND].cNeg, "No negative behavior"); fnRead[OPT_PRESSWIND] = &fvReadPresSWind; /* Halt at Minimum Mantle Temperature */ - sprintf(options[OPT_HALTMINTMAN].cName, "dHaltMinTMan"); - sprintf(options[OPT_HALTMINTMAN].cDescr, + fvFormattedString(&options[OPT_HALTMINTMAN].cName, "dHaltMinTMan"); + fvFormattedString(&options[OPT_HALTMINTMAN].cDescr, "Halt at Minimum Mantle Temperature"); - sprintf(options[OPT_HALTMINTMAN].cDefault, "0 K"); - sprintf(options[OPT_HALTMINTMAN].cDimension, "temperature"); + fvFormattedString(&options[OPT_HALTMINTMAN].cDefault, "0 K"); + fvFormattedString(&options[OPT_HALTMINTMAN].cDimension, "temperature"); options[OPT_HALTMINTMAN].iType = 2; options[OPT_HALTMINTMAN].bMultiFile = 1; options[OPT_HALTMINTMAN].dNeg = 1; options[OPT_HALTMINTMAN].dDefault = 0; - sprintf(options[OPT_HALTMINTMAN].cNeg, "No negative behavior"); + fvFormattedString(&options[OPT_HALTMINTMAN].cNeg, "No negative behavior"); fnRead[OPT_HALTMINTMAN] = &fvReadHaltMinTMan; /* Halt at Minimum Core Temperature */ - sprintf(options[OPT_HALTMINTCORE].cName, "dHaltMinTCore"); - sprintf(options[OPT_HALTMINTCORE].cDescr, "Halt at Minimum Core Temperature"); - sprintf(options[OPT_HALTMINTCORE].cDefault, "0 K"); - sprintf(options[OPT_HALTMINTCORE].cDimension, "temperature"); + fvFormattedString(&options[OPT_HALTMINTCORE].cName, "dHaltMinTCore"); + fvFormattedString(&options[OPT_HALTMINTCORE].cDescr, "Halt at Minimum Core Temperature"); + fvFormattedString(&options[OPT_HALTMINTCORE].cDefault, "0 K"); + fvFormattedString(&options[OPT_HALTMINTCORE].cDimension, "temperature"); options[OPT_HALTMINTCORE].iType = 2; options[OPT_HALTMINTCORE].bMultiFile = 1; options[OPT_HALTMINTCORE].dNeg = 1; options[OPT_HALTMINTCORE].dDefault = 0; - sprintf(options[OPT_HALTMINTCORE].cNeg, "No negative behavior"); + fvFormattedString(&options[OPT_HALTMINTCORE].cNeg, "No negative behavior"); fnRead[OPT_HALTMINTCORE] = &fvReadHaltMinTCore; /* Begin vemcee parameters */ /* ActViscMan */ - sprintf(options[OPT_ACTVISCMAN].cName, "dActViscMan"); - sprintf(options[OPT_ACTVISCMAN].cDescr, "Mantle viscosity activation energy"); - sprintf(options[OPT_ACTVISCMAN].cDefault, "Default is ACTVISCMAN"); - sprintf(options[OPT_ACTVISCMAN].cDimension, "pressure"); + fvFormattedString(&options[OPT_ACTVISCMAN].cName, "dActViscMan"); + fvFormattedString(&options[OPT_ACTVISCMAN].cDescr, "Mantle viscosity activation energy"); + fvFormattedString(&options[OPT_ACTVISCMAN].cDefault, "Default is ACTVISCMAN"); + fvFormattedString(&options[OPT_ACTVISCMAN].cDimension, "pressure"); options[OPT_ACTVISCMAN].iType = 2; options[OPT_ACTVISCMAN].bMultiFile = 1; options[OPT_ACTVISCMAN].dNeg = ACTVISCMAN; options[OPT_ACTVISCMAN].dDefault = ACTVISCMAN; - sprintf(options[OPT_ACTVISCMAN].cNeg, "No negative behavior"); + fvFormattedString(&options[OPT_ACTVISCMAN].cNeg, "No negative behavior"); fnRead[OPT_ACTVISCMAN] = &fvReadActViscMan; // Needs a LongDescr - sprintf(options[OPT_ACTVISCMAN].cLongDescr, + fvFormattedString(&options[OPT_ACTVISCMAN].cLongDescr, "Mantle viscosity activation energy, E_nu in \n" "eq (159) of Barnes et al (2020). Physically it is\n" "a measure of how sensitive viscosity is to temperature."); /* ShModRef */ - sprintf(options[OPT_SHMODREF].cName, "dShModRef"); - sprintf(options[OPT_SHMODREF].cDescr, + fvFormattedString(&options[OPT_SHMODREF].cName, "dShModRef"); + fvFormattedString(&options[OPT_SHMODREF].cDescr, "Reference kinematic mantle shear modulus"); - sprintf(options[OPT_SHMODREF].cDefault, "Default is SHMODREF"); - sprintf(options[OPT_SHMODREF].cDimension, "pressure"); + fvFormattedString(&options[OPT_SHMODREF].cDefault, "Default is SHMODREF"); + fvFormattedString(&options[OPT_SHMODREF].cDimension, "pressure"); options[OPT_SHMODREF].iType = 2; options[OPT_SHMODREF].bMultiFile = 1; options[OPT_SHMODREF].dNeg = SHMODREF; options[OPT_SHMODREF].dDefault = SHMODREF; - sprintf(options[OPT_SHMODREF].cNeg, "No negative behavior"); + fvFormattedString(&options[OPT_SHMODREF].cNeg, "No negative behavior"); fnRead[OPT_SHMODREF] = &fvReadShModRef; // Needs a LongDescr - sprintf(options[OPT_SHMODREF].cLongDescr, + fvFormattedString(&options[OPT_SHMODREF].cLongDescr, "Reference kinematic mantle shear modulus coefficient, mu_ref\n" "in eq (160) of Barnes et al (2020). Analogous to reference \n" "viscosity ViscRef."); /* Stiffness */ - sprintf(options[OPT_STIFFNESS].cName, "dStiffness"); - sprintf(options[OPT_STIFFNESS].cDescr, "Effective stiffness of mantle"); - sprintf(options[OPT_STIFFNESS].cDefault, "Default is STIFFNESS"); - sprintf(options[OPT_STIFFNESS].cDimension, "pressure"); + fvFormattedString(&options[OPT_STIFFNESS].cName, "dStiffness"); + fvFormattedString(&options[OPT_STIFFNESS].cDescr, "Effective stiffness of mantle"); + fvFormattedString(&options[OPT_STIFFNESS].cDefault, "Default is STIFFNESS"); + fvFormattedString(&options[OPT_STIFFNESS].cDimension, "pressure"); options[OPT_STIFFNESS].iType = 2; options[OPT_STIFFNESS].bMultiFile = 1; options[OPT_STIFFNESS].dNeg = STIFFNESS; options[OPT_STIFFNESS].dDefault = STIFFNESS; - sprintf(options[OPT_STIFFNESS].cNeg, "No negative behavior"); + fvFormattedString(&options[OPT_STIFFNESS].cNeg, "No negative behavior"); fnRead[OPT_STIFFNESS] = &fvReadStiffness; /* DLind */ - sprintf(options[OPT_DLIND].cName, "dDLind"); - sprintf(options[OPT_DLIND].cDescr, + fvFormattedString(&options[OPT_DLIND].cName, "dDLind"); + fvFormattedString(&options[OPT_DLIND].cDescr, "Lindemann's law length scale for iron liquidus"); - sprintf(options[OPT_DLIND].cDefault, "Default is DLIND"); - sprintf(options[OPT_DLIND].cDimension, "length"); + fvFormattedString(&options[OPT_DLIND].cDefault, "Default is DLIND"); + fvFormattedString(&options[OPT_DLIND].cDimension, "length"); options[OPT_DLIND].iType = 2; options[OPT_DLIND].bMultiFile = 1; options[OPT_DLIND].dNeg = DLIND; options[OPT_DLIND].dDefault = DLIND; - sprintf(options[OPT_DLIND].cNeg, "No negative behavior"); + fvFormattedString(&options[OPT_DLIND].cNeg, "No negative behavior"); fnRead[OPT_DLIND] = &fvReadDLind; // Needs a LongDescr - sprintf(options[OPT_DLIND].cLongDescr, + fvFormattedString(&options[OPT_DLIND].cLongDescr, "Length scale for core iron liquidus (Lindemann's law), D_Fe \n" "in eq (175) of Barnes et al (2020). It determines the \n" "curvature of the core iron liquidus as a function of radius \n" @@ -1606,18 +1573,18 @@ void fvInitializeOptionsThermint(OPTIONS *options, fnReadOption fnRead[]) { "with radius."); /* DAdCore */ - sprintf(options[OPT_DADCORE].cName, "dDAdCore"); - sprintf(options[OPT_DADCORE].cDescr, "Liq iron core adiabatic length scale"); - sprintf(options[OPT_DADCORE].cDefault, "Default is DADCORE"); - sprintf(options[OPT_DADCORE].cDimension, "length"); + fvFormattedString(&options[OPT_DADCORE].cName, "dDAdCore"); + fvFormattedString(&options[OPT_DADCORE].cDescr, "Liq iron core adiabatic length scale"); + fvFormattedString(&options[OPT_DADCORE].cDefault, "Default is DADCORE"); + fvFormattedString(&options[OPT_DADCORE].cDimension, "length"); options[OPT_DADCORE].iType = 2; options[OPT_DADCORE].bMultiFile = 1; options[OPT_DADCORE].dNeg = DADCORE; options[OPT_DADCORE].dDefault = DADCORE; - sprintf(options[OPT_DADCORE].cNeg, "No negative behavior"); + fvFormattedString(&options[OPT_DADCORE].cNeg, "No negative behavior"); fnRead[OPT_DADCORE] = &fvReadDAdCore; // Needs a LongDescr - sprintf(options[OPT_DADCORE].cLongDescr, + fvFormattedString(&options[OPT_DADCORE].cLongDescr, "Length scale for core iron adiabatic temperature profile, D_N \n" "in eq (174) of Barnes et al (2020). It determines the \n" "curvature of the core iron adiabat as a function of radius \n" @@ -1625,75 +1592,75 @@ void fvInitializeOptionsThermint(OPTIONS *options, fnReadOption fnRead[]) { "with radius."); /* AdJumpM2UM */ - sprintf(options[OPT_ADJUMPM2UM].cName, "dAdJumpM2UM"); - sprintf(options[OPT_ADJUMPM2UM].cDescr, + fvFormattedString(&options[OPT_ADJUMPM2UM].cName, "dAdJumpM2UM"); + fvFormattedString(&options[OPT_ADJUMPM2UM].cDescr, "Adiabatic temp jump from ave mantle to UM"); - sprintf(options[OPT_ADJUMPM2UM].cDefault, "Default is ADJUMPM2UM"); - sprintf(options[OPT_ADJUMPM2UM].cDimension, "temperature"); + fvFormattedString(&options[OPT_ADJUMPM2UM].cDefault, "Default is ADJUMPM2UM"); + fvFormattedString(&options[OPT_ADJUMPM2UM].cDimension, "temperature"); options[OPT_ADJUMPM2UM].iType = 2; options[OPT_ADJUMPM2UM].bMultiFile = 1; options[OPT_ADJUMPM2UM].dNeg = ADJUMPM2UM; options[OPT_ADJUMPM2UM].dDefault = ADJUMPM2UM; - sprintf(options[OPT_ADJUMPM2UM].cNeg, "No negative behavior"); + fvFormattedString(&options[OPT_ADJUMPM2UM].cNeg, "No negative behavior"); fnRead[OPT_ADJUMPM2UM] = &fvReadAdJumpM2UM; // Needs a LongDescr - sprintf(options[OPT_ADJUMPM2UM].cLongDescr, + fvFormattedString(&options[OPT_ADJUMPM2UM].cLongDescr, "Constant used to relate TUMan to TMan (TUMan=AdJumpM2UM*TMan),\n" "eta_UM below eq (8) in Driscoll & Bercovici (2014)."); /* AdJumpM2LM */ - sprintf(options[OPT_ADJUMPM2LM].cName, "dAdJumpM2LM"); - sprintf(options[OPT_ADJUMPM2LM].cDescr, + fvFormattedString(&options[OPT_ADJUMPM2LM].cName, "dAdJumpM2LM"); + fvFormattedString(&options[OPT_ADJUMPM2LM].cDescr, "Adiabatic temp jump from ave mantle to LM"); - sprintf(options[OPT_ADJUMPM2LM].cDefault, "Default is ADJUMPM2LM"); - sprintf(options[OPT_ADJUMPM2LM].cDimension, "nd"); + fvFormattedString(&options[OPT_ADJUMPM2LM].cDefault, "Default is ADJUMPM2LM"); + fvFormattedString(&options[OPT_ADJUMPM2LM].cDimension, "nd"); options[OPT_ADJUMPM2LM].iType = 2; options[OPT_ADJUMPM2LM].bMultiFile = 1; options[OPT_ADJUMPM2LM].dNeg = ADJUMPM2LM; options[OPT_ADJUMPM2LM].dDefault = ADJUMPM2LM; - sprintf(options[OPT_ADJUMPM2LM].cNeg, "No negative behavior"); + fvFormattedString(&options[OPT_ADJUMPM2LM].cNeg, "No negative behavior"); fnRead[OPT_ADJUMPM2LM] = &fvReadAdJumpM2LM; // Needs a LongDescr - sprintf(options[OPT_ADJUMPM2LM].cLongDescr, + fvFormattedString(&options[OPT_ADJUMPM2LM].cLongDescr, "Constant used to relate TLMan to TMan (TLMan=AdJumpM2LM*TMan),\n" "analogous to AdJumpM2UM."); /* AdJumpC2CMB */ - sprintf(options[OPT_ADJUMPC2CMB].cName, "dAdJumpC2CMB"); - sprintf(options[OPT_ADJUMPC2CMB].cDescr, + fvFormattedString(&options[OPT_ADJUMPC2CMB].cName, "dAdJumpC2CMB"); + fvFormattedString(&options[OPT_ADJUMPC2CMB].cDescr, "Adiabatic temp jump from ave core to CMB"); - sprintf(options[OPT_ADJUMPC2CMB].cDefault, "Default is ADJUMPC2CMB"); - sprintf(options[OPT_ADJUMPC2CMB].cDimension, "nd"); + fvFormattedString(&options[OPT_ADJUMPC2CMB].cDefault, "Default is ADJUMPC2CMB"); + fvFormattedString(&options[OPT_ADJUMPC2CMB].cDimension, "nd"); options[OPT_ADJUMPC2CMB].iType = 2; options[OPT_ADJUMPC2CMB].bMultiFile = 1; options[OPT_ADJUMPC2CMB].dNeg = ADJUMPC2CMB; options[OPT_ADJUMPC2CMB].dDefault = ADJUMPC2CMB; - sprintf(options[OPT_ADJUMPC2CMB].cNeg, "No negative behavior"); + fvFormattedString(&options[OPT_ADJUMPC2CMB].cNeg, "No negative behavior"); fnRead[OPT_ADJUMPC2CMB] = &fvReadAdJumpC2CMB; /* ElecCondCore */ - sprintf(options[OPT_ELECCONDCORE].cName, "dElecCondCore"); - sprintf(options[OPT_ELECCONDCORE].cDescr, "Electrical conductivity of core"); - sprintf(options[OPT_ELECCONDCORE].cDefault, "Default is ELECCONDCORE"); - sprintf(options[OPT_ELECCONDCORE].cDimension, "time^3*ampere^2/mass/length"); + fvFormattedString(&options[OPT_ELECCONDCORE].cName, "dElecCondCore"); + fvFormattedString(&options[OPT_ELECCONDCORE].cDescr, "Electrical conductivity of core"); + fvFormattedString(&options[OPT_ELECCONDCORE].cDefault, "Default is ELECCONDCORE"); + fvFormattedString(&options[OPT_ELECCONDCORE].cDimension, "time^3*ampere^2/mass/length"); options[OPT_ELECCONDCORE].iType = 2; options[OPT_ELECCONDCORE].bMultiFile = 1; options[OPT_ELECCONDCORE].dNeg = ELECCONDCORE; options[OPT_ELECCONDCORE].dDefault = ELECCONDCORE; - sprintf(options[OPT_ELECCONDCORE].cNeg, "No negative behavior"); + fvFormattedString(&options[OPT_ELECCONDCORE].cNeg, "No negative behavior"); fnRead[OPT_ELECCONDCORE] = &fvReadElecCondCore; /* ImK2ManOrbModel */ - sprintf(options[OPT_IMK2MANORBMODEL].cName, "dImK2ManOrbModel"); - sprintf(options[OPT_IMK2MANORBMODEL].cDescr, + fvFormattedString(&options[OPT_IMK2MANORBMODEL].cName, "dImK2ManOrbModel"); + fvFormattedString(&options[OPT_IMK2MANORBMODEL].cDescr, "ImK2Man model to use in orbital equations (1=ImK2(T), 2=k2/Q(T)"); - sprintf(options[OPT_IMK2MANORBMODEL].cDefault, "Default is IMK2MANORBMODEL"); - sprintf(options[OPT_IMK2MANORBMODEL].cDimension, "nd"); + fvFormattedString(&options[OPT_IMK2MANORBMODEL].cDefault, "Default is IMK2MANORBMODEL"); + fvFormattedString(&options[OPT_IMK2MANORBMODEL].cDimension, "nd"); options[OPT_IMK2MANORBMODEL].iType = 2; options[OPT_IMK2MANORBMODEL].bMultiFile = 1; options[OPT_IMK2MANORBMODEL].dNeg = IMK2MANORBMODEL; options[OPT_IMK2MANORBMODEL].dDefault = IMK2MANORBMODEL; - sprintf(options[OPT_IMK2MANORBMODEL].cNeg, "No negative behavior"); + fvFormattedString(&options[OPT_IMK2MANORBMODEL].cNeg, "No negative behavior"); fnRead[OPT_IMK2MANORBMODEL] = &fvReadImK2ManOrbModel; // Needs a LongDescr -- XXX I'm not sure what this does! RB // PD(4/26/21): I don't know what this does either! Presumably its a switch @@ -2151,12 +2118,12 @@ void fvVerifyHaltThermint(BODY *body, CONTROL *control, OPTIONS *options, */ void fvWriteTMan(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, double *dTmp, - char cUnit[]) { + char **cUnit) { /* Get TMan */ *dTmp = body[iBody].dTMan; if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { /* *dTmp /= fdUnitsTemp(body[iBody].dTman,0,units->iTemp); //set "iOldType" to 0, second input var, arbitarily. @@ -2179,12 +2146,12 @@ void fvWriteTMan(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, */ void fvWriteTUMan(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, double *dTmp, - char cUnit[]) { + char **cUnit) { /* Get TUMan */ *dTmp = body[iBody].dTUMan; if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { } } @@ -2203,12 +2170,12 @@ void fvWriteTUMan(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, */ void fvWriteTsolUMan(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, double *dTmp, - char cUnit[]) { + char **cUnit) { /* Get TsolUMan */ *dTmp = body[iBody].dTsolUMan; if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else{ } } @@ -2227,12 +2194,12 @@ void fvWriteTsolUMan(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *syste */ void fvWriteTLMan(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, double *dTmp, - char cUnit[]) { + char **cUnit) { /* Get TLMan */ *dTmp = body[iBody].dTLMan; if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { } } @@ -2251,12 +2218,12 @@ void fvWriteTLMan(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, */ void fvWriteTJumpUMan(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, - double *dTmp, char cUnit[]) { + double *dTmp, char **cUnit) { /* Get TLMan */ *dTmp = body[iBody].dTJumpUMan; if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { } } @@ -2275,12 +2242,12 @@ void fvWriteTJumpUMan(BODY *body, CONTROL *control, OUTPUT *output, */ void fvWriteTJumpLMan(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, - double *dTmp, char cUnit[]) { + double *dTmp, char **cUnit) { /* Get TLMan */ *dTmp = body[iBody].dTJumpLMan; if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { } } @@ -2299,12 +2266,12 @@ void fvWriteTJumpLMan(BODY *body, CONTROL *control, OUTPUT *output, */ void fvWriteSignTJumpUMan(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, - int iBody, double *dTmp, char cUnit[]) { + int iBody, double *dTmp, char **cUnit) { /* Get TLMan */ *dTmp = body[iBody].dSignTJumpUMan; if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { } } @@ -2323,12 +2290,12 @@ void fvWriteSignTJumpUMan(BODY *body, CONTROL *control, OUTPUT *output, */ void fvWriteSignTJumpLMan(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, - int iBody, double *dTmp, char cUnit[]) { + int iBody, double *dTmp, char **cUnit) { /* Get TLMan */ *dTmp = body[iBody].dSignTJumpLMan; if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { } } @@ -2347,12 +2314,12 @@ void fvWriteSignTJumpLMan(BODY *body, CONTROL *control, OUTPUT *output, */ void fvWriteTCMB(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, double *dTmp, - char cUnit[]) { + char **cUnit) { /* Get TCore */ *dTmp = body[iBody].dTCMB; if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { } } @@ -2371,12 +2338,12 @@ void fvWriteTCMB(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, */ void fvWriteTCore(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, double *dTmp, - char cUnit[]) { + char **cUnit) { /* Get TCore */ *dTmp = body[iBody].dTCore; if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { } } @@ -2395,12 +2362,12 @@ void fvWriteTCore(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, */ void fvWriteViscUManArr(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, - double *dTmp, char cUnit[]) { + double *dTmp, char **cUnit) { /* Get ViscUManArr */ *dTmp = body[iBody].dViscUManArr; if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { fsUnitsViscosity(units, cUnit); *dTmp /= fdUnitsTime(units->iTime) / @@ -2422,12 +2389,12 @@ void fvWriteViscUManArr(BODY *body, CONTROL *control, OUTPUT *output, */ void fvWriteViscUMan(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, - double *dTmp, char cUnit[]) { + double *dTmp, char **cUnit) { *dTmp = body[iBody].dViscUMan; if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { fsUnitsViscosity(units, cUnit); *dTmp /= fdUnitsTime(units->iTime) / @@ -2449,12 +2416,12 @@ void fvWriteViscUMan(BODY *body, CONTROL *control, OUTPUT *output, */ void fvWriteDynamicViscosity(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, - int iBody, double *dTmp, char cUnit[]) { + int iBody, double *dTmp, char **cUnit) { *dTmp = fdDynamicViscosity(body, iBody); if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { fsUnitsEnergy(units, cUnit); *dTmp /= fdUnitsEnergy(units->iTime, units->iMass, units->iLength); @@ -2475,12 +2442,12 @@ void fvWriteDynamicViscosity(BODY *body, CONTROL *control, OUTPUT *output, */ void fvWriteViscLMan(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, - double *dTmp, char cUnit[]) { + double *dTmp, char **cUnit) { *dTmp = body[iBody].dViscLMan; if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { fsUnitsViscosity(units, cUnit); *dTmp /= fdUnitsTime(units->iTime) / @@ -2502,12 +2469,12 @@ void fvWriteViscLMan(BODY *body, CONTROL *control, OUTPUT *output, */ void fvWriteViscMMan(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, - double *dTmp, char cUnit[]) { + double *dTmp, char **cUnit) { *dTmp = body[iBody].dViscMMan; if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { fsUnitsViscosity(units, cUnit); *dTmp /= fdUnitsTime(units->iTime) / @@ -2529,12 +2496,12 @@ void fvWriteViscMMan(BODY *body, CONTROL *control, OUTPUT *output, */ void fvWriteViscJumpMan(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, - double *dTmp, char cUnit[]) { + double *dTmp, char **cUnit) { /* Get TLMan */ *dTmp = body[iBody].dViscJumpMan; if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { } } @@ -2553,11 +2520,11 @@ void fvWriteViscJumpMan(BODY *body, CONTROL *control, OUTPUT *output, */ void fvWriteBLUMan(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, double *dTmp, - char cUnit[]) { + char **cUnit) { *dTmp = body[iBody].dBLUMan; if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { } } @@ -2576,11 +2543,11 @@ void fvWriteBLUMan(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, */ void fvWriteBLLMan(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, double *dTmp, - char cUnit[]) { + char **cUnit) { *dTmp = body[iBody].dBLLMan; if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { } } @@ -2599,11 +2566,11 @@ void fvWriteBLLMan(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, */ void fvWriteShmodUMan(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, - double *dTmp, char cUnit[]) { + double *dTmp, char **cUnit) { *dTmp = body[iBody].dShmodUMan; if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { } } @@ -2622,11 +2589,11 @@ void fvWriteShmodUMan(BODY *body, CONTROL *control, OUTPUT *output, */ void fvWriteFMeltUMan(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, - double *dTmp, char cUnit[]) { + double *dTmp, char **cUnit) { *dTmp = body[iBody].dFMeltUMan; if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { } } @@ -2645,11 +2612,11 @@ void fvWriteFMeltUMan(BODY *body, CONTROL *control, OUTPUT *output, */ void fvWriteFMeltLMan(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, - double *dTmp, char cUnit[]) { + double *dTmp, char **cUnit) { *dTmp = body[iBody].dFMeltLMan; if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { } } @@ -2668,11 +2635,11 @@ void fvWriteFMeltLMan(BODY *body, CONTROL *control, OUTPUT *output, */ void fvWriteMeltfactorUMan(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, - int iBody, double *dTmp, char cUnit[]) { + int iBody, double *dTmp, char **cUnit) { *dTmp = body[iBody].dMeltfactorUMan; if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { } } @@ -2691,11 +2658,11 @@ void fvWriteMeltfactorUMan(BODY *body, CONTROL *control, OUTPUT *output, */ void fvWriteMeltfactorLMan(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, - int iBody, double *dTmp, char cUnit[]) { + int iBody, double *dTmp, char **cUnit) { *dTmp = body[iBody].dMeltfactorLMan; if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { } } @@ -2714,11 +2681,11 @@ void fvWriteMeltfactorLMan(BODY *body, CONTROL *control, OUTPUT *output, */ void fvWriteDepthMeltMan(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, - int iBody, double *dTmp, char cUnit[]) { + int iBody, double *dTmp, char **cUnit) { *dTmp = body[iBody].dDepthMeltMan; if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { } } @@ -2737,11 +2704,11 @@ void fvWriteDepthMeltMan(BODY *body, CONTROL *control, OUTPUT *output, */ void fvWriteTDepthMeltMan(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, - int iBody, double *dTmp, char cUnit[]) { + int iBody, double *dTmp, char **cUnit) { *dTmp = body[iBody].dTDepthMeltMan; if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { } } @@ -2760,11 +2727,11 @@ void fvWriteTDepthMeltMan(BODY *body, CONTROL *control, OUTPUT *output, */ void fvWriteTJumpMeltMan(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, - int iBody, double *dTmp, char cUnit[]) { + int iBody, double *dTmp, char **cUnit) { *dTmp = body[iBody].dTJumpMeltMan; if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { } } @@ -2783,11 +2750,11 @@ void fvWriteTJumpMeltMan(BODY *body, CONTROL *control, OUTPUT *output, */ void fvWriteMeltMassFluxMan(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, - int iBody, double *dTmp, char cUnit[]) { + int iBody, double *dTmp, char **cUnit) { *dTmp = body[iBody].dMeltMassFluxMan; if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { } } @@ -2806,11 +2773,11 @@ void fvWriteMeltMassFluxMan(BODY *body, CONTROL *control, OUTPUT *output, */ void fvWriteRayleighMan(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, - double *dTmp, char cUnit[]) { + double *dTmp, char **cUnit) { *dTmp = body[iBody].dRayleighMan; if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { } } @@ -2829,11 +2796,11 @@ void fvWriteRayleighMan(BODY *body, CONTROL *control, OUTPUT *output, */ void fvWriteEruptEff(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, - double *dTmp, char cUnit[]) { + double *dTmp, char **cUnit) { *dTmp = body[iBody].dEruptEff; if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { } } @@ -2853,12 +2820,12 @@ void fvWriteEruptEff(BODY *body, CONTROL *control, OUTPUT *output, */ void fvWriteRIC(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, double *dTmp, - char cUnit[]) { + char **cUnit) { *dTmp = body[iBody].dRIC; if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { } } @@ -2877,11 +2844,11 @@ void fvWriteRIC(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, */ void fvWriteDRICDTCMB(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, - double *dTmp, char cUnit[]) { + double *dTmp, char **cUnit) { *dTmp = body[iBody].dDRICDTCMB; if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { } } @@ -2900,12 +2867,12 @@ void fvWriteDRICDTCMB(BODY *body, CONTROL *control, OUTPUT *output, */ void fvWriteChiOC(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, double *dTmp, - char cUnit[]) { + char **cUnit) { *dTmp = body[iBody].dChiOC; // *dTmp = body[iBody].dRIC; if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { } } @@ -2924,11 +2891,11 @@ void fvWriteChiOC(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, */ void fvWriteChiIC(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, double *dTmp, - char cUnit[]) { + char **cUnit) { *dTmp = body[iBody].dChiIC; if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { } } @@ -2947,11 +2914,11 @@ void fvWriteChiIC(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, */ void fvWriteMassOC(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, double *dTmp, - char cUnit[]) { + char **cUnit) { *dTmp = body[iBody].dMassOC; if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { } } @@ -2970,11 +2937,11 @@ void fvWriteMassOC(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, */ void fvWriteMassIC(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, double *dTmp, - char cUnit[]) { + char **cUnit) { *dTmp = body[iBody].dMassIC; if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { } } @@ -2993,11 +2960,11 @@ void fvWriteMassIC(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, */ void fvWriteMassChiOC(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, - double *dTmp, char cUnit[]) { + double *dTmp, char **cUnit) { *dTmp = body[iBody].dMassChiOC; if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { } } @@ -3016,11 +2983,11 @@ void fvWriteMassChiOC(BODY *body, CONTROL *control, OUTPUT *output, */ void fvWriteMassChiIC(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, - double *dTmp, char cUnit[]) { + double *dTmp, char **cUnit) { *dTmp = body[iBody].dMassChiIC; if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { } } @@ -3039,11 +3006,11 @@ void fvWriteMassChiIC(BODY *body, CONTROL *control, OUTPUT *output, */ void fvWriteDTChi(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, double *dTmp, - char cUnit[]) { + char **cUnit) { *dTmp = body[iBody].dDTChi; if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { } } @@ -3062,11 +3029,11 @@ void fvWriteDTChi(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, */ void fvWriteThermConductOC(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, - int iBody, double *dTmp, char cUnit[]) { + int iBody, double *dTmp, char **cUnit) { *dTmp = body[iBody].dThermConductOC; if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { } } @@ -3085,11 +3052,11 @@ void fvWriteThermConductOC(BODY *body, CONTROL *control, OUTPUT *output, */ void fvWriteCoreBuoyTherm(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, - int iBody, double *dTmp, char cUnit[]) { + int iBody, double *dTmp, char **cUnit) { *dTmp = body[iBody].dCoreBuoyTherm; if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { } } @@ -3108,11 +3075,11 @@ void fvWriteCoreBuoyTherm(BODY *body, CONTROL *control, OUTPUT *output, */ void fvWriteCoreBuoyCompo(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, - int iBody, double *dTmp, char cUnit[]) { + int iBody, double *dTmp, char **cUnit) { *dTmp = body[iBody].dCoreBuoyCompo; if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { } } @@ -3131,11 +3098,11 @@ void fvWriteCoreBuoyCompo(BODY *body, CONTROL *control, OUTPUT *output, */ void fvWriteCoreBuoyTotal(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, - int iBody, double *dTmp, char cUnit[]) { + int iBody, double *dTmp, char **cUnit) { *dTmp = body[iBody].dCoreBuoyTotal; if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { } } @@ -3154,11 +3121,11 @@ void fvWriteCoreBuoyTotal(BODY *body, CONTROL *control, OUTPUT *output, */ void fvWriteGravICB(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, - double *dTmp, char cUnit[]) { + double *dTmp, char **cUnit) { *dTmp = body[iBody].dGravICB; if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { } } @@ -3177,11 +3144,11 @@ void fvWriteGravICB(BODY *body, CONTROL *control, OUTPUT *output, */ void fvWriteMagMom(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, double *dTmp, - char cUnit[]) { + char **cUnit) { *dTmp = body[iBody].dMagMom; if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { } } @@ -3200,11 +3167,11 @@ void fvWriteMagMom(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, */ void fvWriteRICDot(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, double *dTmp, - char cUnit[]) { + char **cUnit) { *dTmp = body[iBody].dRICDot; if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { } } @@ -3223,11 +3190,11 @@ void fvWriteRICDot(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, */ void fvWritePresSWind(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, - double *dTmp, char cUnit[]) { + double *dTmp, char **cUnit) { *dTmp = body[iBody].dPresSWind; if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { } } @@ -3246,11 +3213,11 @@ void fvWritePresSWind(BODY *body, CONTROL *control, OUTPUT *output, */ void fvWriteMagPauseRad(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, - double *dTmp, char cUnit[]) { + double *dTmp, char **cUnit) { *dTmp = body[iBody].dMagPauseRad; if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { } } @@ -3271,11 +3238,11 @@ void fvWriteMagPauseRad(BODY *body, CONTROL *control, OUTPUT *output, */ void fvWriteHfluxUMan(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, - double *dTmp, char cUnit[]) { + double *dTmp, char **cUnit) { *dTmp = body[iBody].dHfluxUMan; if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { } } @@ -3294,11 +3261,11 @@ void fvWriteHfluxUMan(BODY *body, CONTROL *control, OUTPUT *output, */ void fvWriteHfluxLMan(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, - double *dTmp, char cUnit[]) { + double *dTmp, char **cUnit) { *dTmp = body[iBody].dHfluxLMan; if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { } } @@ -3317,11 +3284,11 @@ void fvWriteHfluxLMan(BODY *body, CONTROL *control, OUTPUT *output, */ void fvWriteHfluxCMB(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, - double *dTmp, char cUnit[]) { + double *dTmp, char **cUnit) { *dTmp = body[iBody].dHfluxCMB; if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { } } @@ -3340,11 +3307,11 @@ void fvWriteHfluxCMB(BODY *body, CONTROL *control, OUTPUT *output, */ void fvWriteHfluxCMBAd(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, - double *dTmp, char cUnit[]) { + double *dTmp, char **cUnit) { *dTmp = body[iBody].dHfluxCMBAd; if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { } } @@ -3363,11 +3330,11 @@ void fvWriteHfluxCMBAd(BODY *body, CONTROL *control, OUTPUT *output, */ void fvWriteHfluxCMBConv(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, - int iBody, double *dTmp, char cUnit[]) { + int iBody, double *dTmp, char **cUnit) { *dTmp = body[iBody].dHfluxCMBConv; if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { } } @@ -3386,11 +3353,11 @@ void fvWriteHfluxCMBConv(BODY *body, CONTROL *control, OUTPUT *output, */ void fvWriteHflowUMan(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, - double *dTmp, char cUnit[]) { + double *dTmp, char **cUnit) { *dTmp = body[iBody].dHflowUMan; if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { } } @@ -3409,11 +3376,11 @@ void fvWriteHflowUMan(BODY *body, CONTROL *control, OUTPUT *output, */ void fvWriteHflowSurf(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, - double *dTmp, char cUnit[]) { + double *dTmp, char **cUnit) { *dTmp = body[iBody].dHflowSurf; if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { } } @@ -3432,11 +3399,11 @@ void fvWriteHflowSurf(BODY *body, CONTROL *control, OUTPUT *output, */ void fvWriteHflowLMan(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, - double *dTmp, char cUnit[]) { + double *dTmp, char **cUnit) { *dTmp = body[iBody].dHflowLMan; if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { } } @@ -3455,11 +3422,11 @@ void fvWriteHflowLMan(BODY *body, CONTROL *control, OUTPUT *output, */ void fvWriteHflowCMB(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, - double *dTmp, char cUnit[]) { + double *dTmp, char **cUnit) { *dTmp = body[iBody].dHflowCMB; if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { } } @@ -3478,11 +3445,11 @@ void fvWriteHflowCMB(BODY *body, CONTROL *control, OUTPUT *output, */ void fvWriteHflowLatentMan(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, - int iBody, double *dTmp, char cUnit[]) { + int iBody, double *dTmp, char **cUnit) { *dTmp = body[iBody].dHflowLatentMan; if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { } } @@ -3501,11 +3468,11 @@ void fvWriteHflowLatentMan(BODY *body, CONTROL *control, OUTPUT *output, */ void fvWriteHflowMeltMan(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, - int iBody, double *dTmp, char cUnit[]) { + int iBody, double *dTmp, char **cUnit) { *dTmp = body[iBody].dHflowMeltMan; if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { } } @@ -3524,11 +3491,11 @@ void fvWriteHflowMeltMan(BODY *body, CONTROL *control, OUTPUT *output, */ void fvWriteHflowSecMan(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, - double *dTmp, char cUnit[]) { + double *dTmp, char **cUnit) { *dTmp = body[iBody].dHflowSecMan; if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { } } @@ -3548,11 +3515,11 @@ void fvWriteHflowSecMan(BODY *body, CONTROL *control, OUTPUT *output, */ void fvWriteHflowLatentIC(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, - int iBody, double *dTmp, char cUnit[]) { + int iBody, double *dTmp, char **cUnit) { *dTmp = body[iBody].dHflowLatentIC; if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { } } @@ -3571,11 +3538,11 @@ void fvWriteHflowLatentIC(BODY *body, CONTROL *control, OUTPUT *output, */ void fvWritePowerGravIC(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, - double *dTmp, char cUnit[]) { + double *dTmp, char **cUnit) { *dTmp = body[iBody].dPowerGravIC; if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { } } @@ -3594,12 +3561,12 @@ void fvWritePowerGravIC(BODY *body, CONTROL *control, OUTPUT *output, */ void fvWriteTDotMan(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, - double *dTmp, char cUnit[]) { + double *dTmp, char **cUnit) { /* Get TDotMan */ *dTmp = (*(update[iBody].pdTDotMan)); if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { /* *dTmp /= @@ -3624,12 +3591,12 @@ void fvWriteTDotMan(BODY *body, CONTROL *control, OUTPUT *output, */ void fvWriteTDotCore(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, - double *dTmp, char cUnit[]) { + double *dTmp, char **cUnit) { /* Get TDotCore */ *dTmp = (*(update[iBody].pdTDotCore)); if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { /* *dTmp /= @@ -3655,11 +3622,11 @@ void fvWriteTDotCore(BODY *body, CONTROL *control, OUTPUT *output, */ void fvWriteTrefLind(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system, UNITS *units, UPDATE *update, int iBody, - double *dTmp, char cUnit[]) { + double *dTmp, char **cUnit) { *dTmp = body[iBody].dTrefLind; if (output->bDoNeg[iBody]) { *dTmp *= output->dNeg; - strcpy(cUnit, output->cNeg); + fvFormattedString(cUnit, output->cNeg); } else { } } @@ -3674,74 +3641,74 @@ void fvWriteTrefLind(BODY *body, CONTROL *control, OUTPUT *output, void fvInitializeOutputThermint(OUTPUT *output, fnWriteOutput fnWrite[]) { - sprintf(output[OUT_TMAN].cName, "TMan"); - sprintf(output[OUT_TMAN].cDescr, "Mantle Temperature"); - sprintf(output[OUT_TMAN].cNeg, "K"); + fvFormattedString(&output[OUT_TMAN].cName, "TMan"); + fvFormattedString(&output[OUT_TMAN].cDescr, "Mantle Temperature"); + fvFormattedString(&output[OUT_TMAN].cNeg, "K"); output[OUT_TMAN].bNeg = 1; output[OUT_TMAN].dNeg = 1; output[OUT_TMAN].iNum = 1; output[OUT_TMAN].iModuleBit = THERMINT; fnWrite[OUT_TMAN] = &fvWriteTMan; - sprintf(output[OUT_TUMAN].cName, "TUMan"); - sprintf(output[OUT_TUMAN].cDescr, "Upper Mantle Temperature"); - sprintf(output[OUT_TUMAN].cNeg, "K"); + fvFormattedString(&output[OUT_TUMAN].cName, "TUMan"); + fvFormattedString(&output[OUT_TUMAN].cDescr, "Upper Mantle Temperature"); + fvFormattedString(&output[OUT_TUMAN].cNeg, "K"); output[OUT_TUMAN].bNeg = 1; output[OUT_TUMAN].dNeg = 1; output[OUT_TUMAN].iNum = 1; output[OUT_TUMAN].iModuleBit = THERMINT; fnWrite[OUT_TUMAN] = &fvWriteTUMan; - sprintf(output[OUT_TSOLUMAN].cName, "TsolUMan"); - sprintf(output[OUT_TSOLUMAN].cDescr, "Upper Mantle Thermal Boundary Layer Solidus Temperature"); - sprintf(output[OUT_TSOLUMAN].cNeg, "K"); + fvFormattedString(&output[OUT_TSOLUMAN].cName, "TsolUMan"); + fvFormattedString(&output[OUT_TSOLUMAN].cDescr, "Upper Mantle Thermal Boundary Layer Solidus Temperature"); + fvFormattedString(&output[OUT_TSOLUMAN].cNeg, "K"); output[OUT_TSOLUMAN].bNeg = 1; output[OUT_TSOLUMAN].dNeg = 1; output[OUT_TSOLUMAN].iNum = 1; output[OUT_TSOLUMAN].iModuleBit = THERMINT; fnWrite[OUT_TSOLUMAN] = &fvWriteTsolUMan; - sprintf(output[OUT_TLMAN].cName, "TLMan"); - sprintf(output[OUT_TLMAN].cDescr, "Lower Mantle Temperature"); - sprintf(output[OUT_TLMAN].cNeg, "K"); + fvFormattedString(&output[OUT_TLMAN].cName, "TLMan"); + fvFormattedString(&output[OUT_TLMAN].cDescr, "Lower Mantle Temperature"); + fvFormattedString(&output[OUT_TLMAN].cNeg, "K"); output[OUT_TLMAN].bNeg = 1; output[OUT_TLMAN].dNeg = 1; output[OUT_TLMAN].iNum = 1; output[OUT_TLMAN].iModuleBit = THERMINT; fnWrite[OUT_TLMAN] = &fvWriteTLMan; - sprintf(output[OUT_TJUMPUMAN].cName, "TJumpUMan"); - sprintf(output[OUT_TJUMPUMAN].cDescr, "Upper Mantle Temperature Jump"); - sprintf(output[OUT_TJUMPUMAN].cNeg, "K"); + fvFormattedString(&output[OUT_TJUMPUMAN].cName, "TJumpUMan"); + fvFormattedString(&output[OUT_TJUMPUMAN].cDescr, "Upper Mantle Temperature Jump"); + fvFormattedString(&output[OUT_TJUMPUMAN].cNeg, "K"); output[OUT_TJUMPUMAN].bNeg = 1; output[OUT_TJUMPUMAN].dNeg = 1; output[OUT_TJUMPUMAN].iNum = 1; output[OUT_TJUMPUMAN].iModuleBit = THERMINT; fnWrite[OUT_TJUMPUMAN] = &fvWriteTJumpUMan; - sprintf(output[OUT_TJUMPLMAN].cName, "TJumpLMan"); - sprintf(output[OUT_TJUMPLMAN].cDescr, "Lower Mantle Temperature Jump"); - sprintf(output[OUT_TJUMPLMAN].cNeg, "K"); + fvFormattedString(&output[OUT_TJUMPLMAN].cName, "TJumpLMan"); + fvFormattedString(&output[OUT_TJUMPLMAN].cDescr, "Lower Mantle Temperature Jump"); + fvFormattedString(&output[OUT_TJUMPLMAN].cNeg, "K"); output[OUT_TJUMPLMAN].bNeg = 1; output[OUT_TJUMPLMAN].dNeg = 1; output[OUT_TJUMPLMAN].iNum = 1; output[OUT_TJUMPLMAN].iModuleBit = THERMINT; fnWrite[OUT_TJUMPLMAN] = &fvWriteTJumpLMan; - sprintf(output[OUT_SIGNTJUMPUMAN].cName, "SignTJumpUMan"); - sprintf(output[OUT_SIGNTJUMPUMAN].cDescr, + fvFormattedString(&output[OUT_SIGNTJUMPUMAN].cName, "SignTJumpUMan"); + fvFormattedString(&output[OUT_SIGNTJUMPUMAN].cDescr, "Sign of Upper Mantle Temperature Jump"); - sprintf(output[OUT_SIGNTJUMPUMAN].cNeg, "K"); + fvFormattedString(&output[OUT_SIGNTJUMPUMAN].cNeg, "K"); output[OUT_SIGNTJUMPUMAN].bNeg = 1; output[OUT_SIGNTJUMPUMAN].dNeg = 1; output[OUT_SIGNTJUMPUMAN].iNum = 1; output[OUT_SIGNTJUMPUMAN].iModuleBit = THERMINT; fnWrite[OUT_SIGNTJUMPUMAN] = &fvWriteSignTJumpUMan; - sprintf(output[OUT_SIGNTJUMPLMAN].cName, "SignTJumpLMan"); - sprintf(output[OUT_SIGNTJUMPLMAN].cDescr, + fvFormattedString(&output[OUT_SIGNTJUMPLMAN].cName, "SignTJumpLMan"); + fvFormattedString(&output[OUT_SIGNTJUMPLMAN].cDescr, "Sign of Lower Mantle Temperature Jump"); - sprintf(output[OUT_SIGNTJUMPLMAN].cNeg, "K"); + fvFormattedString(&output[OUT_SIGNTJUMPLMAN].cNeg, "K"); output[OUT_SIGNTJUMPLMAN].bNeg = 1; output[OUT_SIGNTJUMPLMAN].dNeg = 1; output[OUT_SIGNTJUMPLMAN].iNum = 1; @@ -3749,27 +3716,27 @@ void fvInitializeOutputThermint(OUTPUT *output, fnWriteOutput fnWrite[]) { fnWrite[OUT_SIGNTJUMPLMAN] = &fvWriteSignTJumpLMan; // Needs a LongDescr - sprintf(output[OUT_TCMB].cName, "TCMB"); - sprintf(output[OUT_TCMB].cDescr, "CMB Temperature"); - sprintf(output[OUT_TCMB].cNeg, "K"); + fvFormattedString(&output[OUT_TCMB].cName, "TCMB"); + fvFormattedString(&output[OUT_TCMB].cDescr, "CMB Temperature"); + fvFormattedString(&output[OUT_TCMB].cNeg, "K"); output[OUT_TCMB].bNeg = 1; output[OUT_TCMB].dNeg = 1; output[OUT_TCMB].iNum = 1; output[OUT_TCMB].iModuleBit = THERMINT; fnWrite[OUT_TCMB] = &fvWriteTCMB; - sprintf(output[OUT_TCORE].cName, "TCore"); - sprintf(output[OUT_TCORE].cDescr, "Core Temperature"); - sprintf(output[OUT_TCORE].cNeg, "K"); + fvFormattedString(&output[OUT_TCORE].cName, "TCore"); + fvFormattedString(&output[OUT_TCORE].cDescr, "Core Temperature"); + fvFormattedString(&output[OUT_TCORE].cNeg, "K"); output[OUT_TCORE].bNeg = 1; output[OUT_TCORE].dNeg = 1; output[OUT_TCORE].iNum = 1; output[OUT_TCORE].iModuleBit = THERMINT; fnWrite[OUT_TCORE] = &fvWriteTCore; - sprintf(output[OUT_VISCUMAN].cName, "ViscUMan"); - sprintf(output[OUT_VISCUMAN].cDescr, "Upper Mantle Viscosity"); - sprintf(output[OUT_VISCUMAN].cNeg, "m^2/s"); + fvFormattedString(&output[OUT_VISCUMAN].cName, "ViscUMan"); + fvFormattedString(&output[OUT_VISCUMAN].cDescr, "Upper Mantle Viscosity"); + fvFormattedString(&output[OUT_VISCUMAN].cNeg, "m^2/s"); output[OUT_VISCUMAN].bNeg = 1; output[OUT_VISCUMAN].dNeg = 1; output[OUT_VISCUMAN].iNum = 1; @@ -3777,9 +3744,9 @@ void fvInitializeOutputThermint(OUTPUT *output, fnWriteOutput fnWrite[]) { fnWrite[OUT_VISCUMAN] = &fvWriteViscUMan; /* ViscUManArr Arrhenius Only */ - sprintf(output[OUT_VISCUMANARR].cName, "ViscUManArr"); - sprintf(output[OUT_VISCUMANARR].cDescr, "Upper Mantle Arrhenius Viscosity"); - sprintf(output[OUT_VISCUMANARR].cNeg, "m^2/s"); + fvFormattedString(&output[OUT_VISCUMANARR].cName, "ViscUManArr"); + fvFormattedString(&output[OUT_VISCUMANARR].cDescr, "Upper Mantle Arrhenius Viscosity"); + fvFormattedString(&output[OUT_VISCUMANARR].cNeg, "m^2/s"); output[OUT_VISCUMANARR].bNeg = 1; output[OUT_VISCUMANARR].dNeg = 1; output[OUT_VISCUMANARR].iNum = 1; @@ -3788,9 +3755,9 @@ void fvInitializeOutputThermint(OUTPUT *output, fnWriteOutput fnWrite[]) { // Needs a LongDescr /* ViscLMan */ - sprintf(output[OUT_VISCLMAN].cName, "ViscLMan"); - sprintf(output[OUT_VISCLMAN].cDescr, "Lower Mantle Viscosity"); - sprintf(output[OUT_VISCLMAN].cNeg, "m^2/s"); + fvFormattedString(&output[OUT_VISCLMAN].cName, "ViscLMan"); + fvFormattedString(&output[OUT_VISCLMAN].cDescr, "Lower Mantle Viscosity"); + fvFormattedString(&output[OUT_VISCLMAN].cNeg, "m^2/s"); output[OUT_VISCLMAN].bNeg = 1; output[OUT_VISCLMAN].dNeg = 1; output[OUT_VISCLMAN].iNum = 1; @@ -3798,18 +3765,18 @@ void fvInitializeOutputThermint(OUTPUT *output, fnWriteOutput fnWrite[]) { fnWrite[OUT_VISCLMAN] = &fvWriteViscLMan; /* ViscMMan */ - sprintf(output[OUT_VISCMMAN].cName, "ViscMMan"); - sprintf(output[OUT_VISCMMAN].cDescr, "Average (mid) Mantle Viscosity"); - sprintf(output[OUT_VISCMMAN].cNeg, "m^2/s"); + fvFormattedString(&output[OUT_VISCMMAN].cName, "ViscMMan"); + fvFormattedString(&output[OUT_VISCMMAN].cDescr, "Average (mid) Mantle Viscosity"); + fvFormattedString(&output[OUT_VISCMMAN].cNeg, "m^2/s"); output[OUT_VISCMMAN].bNeg = 1; output[OUT_VISCMMAN].dNeg = 1; output[OUT_VISCMMAN].iNum = 1; output[OUT_VISCMMAN].iModuleBit = THERMINT; fnWrite[OUT_VISCMMAN] = &fvWriteViscMMan; - sprintf(output[OUT_VISCJUMPMAN].cName, "ViscJumpMan"); - sprintf(output[OUT_VISCJUMPMAN].cDescr, "Mantle Viscosity Ratio"); - sprintf(output[OUT_VISCJUMPMAN].cNeg, "nd"); + fvFormattedString(&output[OUT_VISCJUMPMAN].cName, "ViscJumpMan"); + fvFormattedString(&output[OUT_VISCJUMPMAN].cDescr, "Mantle Viscosity Ratio"); + fvFormattedString(&output[OUT_VISCJUMPMAN].cNeg, "nd"); output[OUT_VISCJUMPMAN].bNeg = 1; output[OUT_VISCJUMPMAN].dNeg = 1; output[OUT_VISCJUMPMAN].iNum = 1; @@ -3818,9 +3785,9 @@ void fvInitializeOutputThermint(OUTPUT *output, fnWriteOutput fnWrite[]) { // Needs a LongDescr /* BLUMan */ - sprintf(output[OUT_BLUMAN].cName, "BLUMan"); - sprintf(output[OUT_BLUMAN].cDescr, "Boundary Layer Thickness Upper Mantle"); - sprintf(output[OUT_BLUMAN].cNeg, "km"); + fvFormattedString(&output[OUT_BLUMAN].cName, "BLUMan"); + fvFormattedString(&output[OUT_BLUMAN].cDescr, "Boundary Layer Thickness Upper Mantle"); + fvFormattedString(&output[OUT_BLUMAN].cNeg, "km"); output[OUT_BLUMAN].bNeg = 1; output[OUT_BLUMAN].dNeg = 1e-3; // KM; output[OUT_BLUMAN].iNum = 1; @@ -3829,9 +3796,9 @@ void fvInitializeOutputThermint(OUTPUT *output, fnWriteOutput fnWrite[]) { // Needs a LongDescr /* BLLMan */ - sprintf(output[OUT_BLLMAN].cName, "BLLMan"); - sprintf(output[OUT_BLLMAN].cDescr, "Boundary Layer Thickness Lower Mantle"); - sprintf(output[OUT_BLLMAN].cNeg, "km"); + fvFormattedString(&output[OUT_BLLMAN].cName, "BLLMan"); + fvFormattedString(&output[OUT_BLLMAN].cDescr, "Boundary Layer Thickness Lower Mantle"); + fvFormattedString(&output[OUT_BLLMAN].cNeg, "km"); output[OUT_BLLMAN].bNeg = 1; output[OUT_BLLMAN].dNeg = 1e-3; output[OUT_BLLMAN].iNum = 1; @@ -3840,9 +3807,9 @@ void fvInitializeOutputThermint(OUTPUT *output, fnWriteOutput fnWrite[]) { // Needs a LongDescr /* ShmodUMan */ - sprintf(output[OUT_SHMODUMAN].cName, "ShmodUMan"); - sprintf(output[OUT_SHMODUMAN].cDescr, "Shear Modulus Upper Mantle"); - sprintf(output[OUT_SHMODUMAN].cNeg, "Pa"); + fvFormattedString(&output[OUT_SHMODUMAN].cName, "ShmodUMan"); + fvFormattedString(&output[OUT_SHMODUMAN].cDescr, "Shear Modulus Upper Mantle"); + fvFormattedString(&output[OUT_SHMODUMAN].cNeg, "Pa"); output[OUT_SHMODUMAN].bNeg = 1; output[OUT_SHMODUMAN].dNeg = 1; output[OUT_SHMODUMAN].iNum = 1; @@ -3850,9 +3817,9 @@ void fvInitializeOutputThermint(OUTPUT *output, fnWriteOutput fnWrite[]) { fnWrite[OUT_SHMODUMAN] = &fvWriteShmodUMan; /* FMeltUMan */ - sprintf(output[OUT_FMELTUMAN].cName, "FMeltUMan"); - sprintf(output[OUT_FMELTUMAN].cDescr, "Melt Fraction Upper Mantle"); - sprintf(output[OUT_FMELTUMAN].cNeg, "nd"); + fvFormattedString(&output[OUT_FMELTUMAN].cName, "FMeltUMan"); + fvFormattedString(&output[OUT_FMELTUMAN].cDescr, "Melt Fraction Upper Mantle"); + fvFormattedString(&output[OUT_FMELTUMAN].cNeg, "nd"); output[OUT_FMELTUMAN].bNeg = 1; output[OUT_FMELTUMAN].dNeg = 1; output[OUT_FMELTUMAN].iNum = 1; @@ -3860,9 +3827,9 @@ void fvInitializeOutputThermint(OUTPUT *output, fnWriteOutput fnWrite[]) { fnWrite[OUT_FMELTUMAN] = &fvWriteFMeltUMan; /* FMeltLMan */ - sprintf(output[OUT_FMELTLMAN].cName, "FMeltLMan"); - sprintf(output[OUT_FMELTLMAN].cDescr, "Melt Fraction Lower Mantle"); - sprintf(output[OUT_FMELTLMAN].cNeg, "nd"); + fvFormattedString(&output[OUT_FMELTLMAN].cName, "FMeltLMan"); + fvFormattedString(&output[OUT_FMELTLMAN].cDescr, "Melt Fraction Lower Mantle"); + fvFormattedString(&output[OUT_FMELTLMAN].cNeg, "nd"); output[OUT_FMELTLMAN].bNeg = 1; output[OUT_FMELTLMAN].dNeg = 1; output[OUT_FMELTLMAN].iNum = 1; @@ -3870,9 +3837,9 @@ void fvInitializeOutputThermint(OUTPUT *output, fnWriteOutput fnWrite[]) { fnWrite[OUT_FMELTLMAN] = &fvWriteFMeltLMan; /* MeltfactorUMan */ - sprintf(output[OUT_MELTFACTORUMAN].cName, "MeltfactorUMan"); - sprintf(output[OUT_MELTFACTORUMAN].cDescr, "Melt Factor Upper Mantle"); - sprintf(output[OUT_MELTFACTORUMAN].cNeg, "nd"); + fvFormattedString(&output[OUT_MELTFACTORUMAN].cName, "MeltfactorUMan"); + fvFormattedString(&output[OUT_MELTFACTORUMAN].cDescr, "Melt Factor Upper Mantle"); + fvFormattedString(&output[OUT_MELTFACTORUMAN].cNeg, "nd"); output[OUT_MELTFACTORUMAN].bNeg = 1; output[OUT_MELTFACTORUMAN].dNeg = 1; output[OUT_MELTFACTORUMAN].iNum = 1; @@ -3881,9 +3848,9 @@ void fvInitializeOutputThermint(OUTPUT *output, fnWriteOutput fnWrite[]) { // Needs a LongDescr /* MeltfactorLMan */ - sprintf(output[OUT_MELTFACTORLMAN].cName, "MeltfactorLMan"); - sprintf(output[OUT_MELTFACTORLMAN].cDescr, "Melt Factor Lower Mantle"); - sprintf(output[OUT_MELTFACTORLMAN].cNeg, "nd"); + fvFormattedString(&output[OUT_MELTFACTORLMAN].cName, "MeltfactorLMan"); + fvFormattedString(&output[OUT_MELTFACTORLMAN].cDescr, "Melt Factor Lower Mantle"); + fvFormattedString(&output[OUT_MELTFACTORLMAN].cNeg, "nd"); output[OUT_MELTFACTORLMAN].bNeg = 1; output[OUT_MELTFACTORLMAN].dNeg = 1; output[OUT_MELTFACTORLMAN].iNum = 1; @@ -3892,10 +3859,10 @@ void fvInitializeOutputThermint(OUTPUT *output, fnWriteOutput fnWrite[]) { // Needs a LongDescr /* DepthMeltMan */ - sprintf(output[OUT_DEPTHMELTMAN].cName, "DepthMeltMan"); - sprintf(output[OUT_DEPTHMELTMAN].cDescr, + fvFormattedString(&output[OUT_DEPTHMELTMAN].cName, "DepthMeltMan"); + fvFormattedString(&output[OUT_DEPTHMELTMAN].cDescr, "Depth to base of Upper Mantle Melt Region"); - sprintf(output[OUT_DEPTHMELTMAN].cNeg, "m"); + fvFormattedString(&output[OUT_DEPTHMELTMAN].cNeg, "m"); output[OUT_DEPTHMELTMAN].bNeg = 1; output[OUT_DEPTHMELTMAN].dNeg = 1; output[OUT_DEPTHMELTMAN].iNum = 1; @@ -3903,10 +3870,10 @@ void fvInitializeOutputThermint(OUTPUT *output, fnWriteOutput fnWrite[]) { fnWrite[OUT_DEPTHMELTMAN] = &fvWriteDepthMeltMan; /* TDepthMeltMan */ - sprintf(output[OUT_TDEPTHMELTMAN].cName, "TDepthMeltMan"); - sprintf(output[OUT_TDEPTHMELTMAN].cDescr, + fvFormattedString(&output[OUT_TDEPTHMELTMAN].cName, "TDepthMeltMan"); + fvFormattedString(&output[OUT_TDEPTHMELTMAN].cDescr, "Temp at base of Upper Mantle Melt Region"); - sprintf(output[OUT_TDEPTHMELTMAN].cNeg, "K"); + fvFormattedString(&output[OUT_TDEPTHMELTMAN].cNeg, "K"); output[OUT_TDEPTHMELTMAN].bNeg = 1; output[OUT_TDEPTHMELTMAN].dNeg = 1; output[OUT_TDEPTHMELTMAN].iNum = 1; @@ -3914,10 +3881,10 @@ void fvInitializeOutputThermint(OUTPUT *output, fnWriteOutput fnWrite[]) { fnWrite[OUT_TDEPTHMELTMAN] = &fvWriteTDepthMeltMan; /* TJumpMeltMan */ - sprintf(output[OUT_TJUMPMELTMAN].cName, "TJumpMeltMan"); - sprintf(output[OUT_TJUMPMELTMAN].cDescr, + fvFormattedString(&output[OUT_TJUMPMELTMAN].cName, "TJumpMeltMan"); + fvFormattedString(&output[OUT_TJUMPMELTMAN].cDescr, "Temp Jump across Upper Mantle Melt Region"); - sprintf(output[OUT_TJUMPMELTMAN].cNeg, "K"); + fvFormattedString(&output[OUT_TJUMPMELTMAN].cNeg, "K"); output[OUT_TJUMPMELTMAN].bNeg = 1; output[OUT_TJUMPMELTMAN].dNeg = 1; output[OUT_TJUMPMELTMAN].iNum = 1; @@ -3925,9 +3892,9 @@ void fvInitializeOutputThermint(OUTPUT *output, fnWriteOutput fnWrite[]) { fnWrite[OUT_TJUMPMELTMAN] = &fvWriteTJumpMeltMan; /* MeltMassFluxMan */ - sprintf(output[OUT_MELTMASSFLUXMAN].cName, "MeltMassFluxMan"); - sprintf(output[OUT_MELTMASSFLUXMAN].cDescr, "Mantle Melt Mass Flux"); - sprintf(output[OUT_MELTMASSFLUXMAN].cNeg, "kg/s"); + fvFormattedString(&output[OUT_MELTMASSFLUXMAN].cName, "MeltMassFluxMan"); + fvFormattedString(&output[OUT_MELTMASSFLUXMAN].cDescr, "Mantle Melt Mass Flux"); + fvFormattedString(&output[OUT_MELTMASSFLUXMAN].cNeg, "kg/s"); output[OUT_MELTMASSFLUXMAN].bNeg = 1; output[OUT_MELTMASSFLUXMAN].dNeg = 1; output[OUT_MELTMASSFLUXMAN].iNum = 1; @@ -3935,9 +3902,9 @@ void fvInitializeOutputThermint(OUTPUT *output, fnWriteOutput fnWrite[]) { fnWrite[OUT_MELTMASSFLUXMAN] = &fvWriteMeltMassFluxMan; /* EruptEff */ - sprintf(output[OUT_ERUPTEFF].cName, "EruptEff"); - sprintf(output[OUT_ERUPTEFF].cDescr, "Mantle Melt Eruption Efficiency"); - sprintf(output[OUT_ERUPTEFF].cNeg, "nd"); + fvFormattedString(&output[OUT_ERUPTEFF].cName, "EruptEff"); + fvFormattedString(&output[OUT_ERUPTEFF].cDescr, "Mantle Melt Eruption Efficiency"); + fvFormattedString(&output[OUT_ERUPTEFF].cNeg, "nd"); output[OUT_ERUPTEFF].bNeg = 1; output[OUT_ERUPTEFF].dNeg = 1; output[OUT_ERUPTEFF].iNum = 1; @@ -3945,9 +3912,9 @@ void fvInitializeOutputThermint(OUTPUT *output, fnWriteOutput fnWrite[]) { fnWrite[OUT_ERUPTEFF] = &fvWriteEruptEff; /* RayleighMan */ - sprintf(output[OUT_RAYLEIGHMAN].cName, "RayleighMan"); - sprintf(output[OUT_RAYLEIGHMAN].cDescr, "Mantle Rayleigh Number"); - sprintf(output[OUT_RAYLEIGHMAN].cNeg, "nd"); + fvFormattedString(&output[OUT_RAYLEIGHMAN].cName, "RayleighMan"); + fvFormattedString(&output[OUT_RAYLEIGHMAN].cDescr, "Mantle Rayleigh Number"); + fvFormattedString(&output[OUT_RAYLEIGHMAN].cNeg, "nd"); output[OUT_RAYLEIGHMAN].bNeg = 1; output[OUT_RAYLEIGHMAN].dNeg = 1; output[OUT_RAYLEIGHMAN].iNum = 1; @@ -3956,9 +3923,9 @@ void fvInitializeOutputThermint(OUTPUT *output, fnWriteOutput fnWrite[]) { /* CORE WRITES */ /* RIC */ - sprintf(output[OUT_RIC].cName, "RIC"); - sprintf(output[OUT_RIC].cDescr, "Inner Core Radius"); - sprintf(output[OUT_RIC].cNeg, "km"); + fvFormattedString(&output[OUT_RIC].cName, "RIC"); + fvFormattedString(&output[OUT_RIC].cDescr, "Inner Core Radius"); + fvFormattedString(&output[OUT_RIC].cNeg, "km"); output[OUT_RIC].bNeg = 1; output[OUT_RIC].dNeg = 1e-3; output[OUT_RIC].iNum = 1; @@ -3966,9 +3933,9 @@ void fvInitializeOutputThermint(OUTPUT *output, fnWriteOutput fnWrite[]) { fnWrite[OUT_RIC] = &fvWriteRIC; /* DRICDTCMB */ - sprintf(output[OUT_DRICDTCMB].cName, "DRICDTCMB"); - sprintf(output[OUT_DRICDTCMB].cDescr, "d(R_ic)/d(T_cmb)"); - sprintf(output[OUT_DRICDTCMB].cNeg, "m/K"); + fvFormattedString(&output[OUT_DRICDTCMB].cName, "DRICDTCMB"); + fvFormattedString(&output[OUT_DRICDTCMB].cDescr, "d(R_ic)/d(T_cmb)"); + fvFormattedString(&output[OUT_DRICDTCMB].cNeg, "m/K"); output[OUT_DRICDTCMB].bNeg = 1; output[OUT_DRICDTCMB].dNeg = 1; output[OUT_DRICDTCMB].iNum = 1; @@ -3976,9 +3943,9 @@ void fvInitializeOutputThermint(OUTPUT *output, fnWriteOutput fnWrite[]) { fnWrite[OUT_DRICDTCMB] = &fvWriteDRICDTCMB; // Dynamic Viscosity - sprintf(output[OUT_DYNVISC].cName, "DynViscUMan"); - sprintf(output[OUT_DYNVISC].cDescr, "Upper Mantle's Dynamic Viscosity"); - sprintf(output[OUT_DYNVISC].cNeg, "Pa"); + fvFormattedString(&output[OUT_DYNVISC].cName, "DynViscUMan"); + fvFormattedString(&output[OUT_DYNVISC].cDescr, "Upper Mantle's Dynamic Viscosity"); + fvFormattedString(&output[OUT_DYNVISC].cNeg, "Pa"); output[OUT_DYNVISC].bNeg = 1; output[OUT_DYNVISC].dNeg = 1; output[OUT_DYNVISC].iNum = 1; @@ -3986,10 +3953,10 @@ void fvInitializeOutputThermint(OUTPUT *output, fnWriteOutput fnWrite[]) { fnWrite[OUT_DYNVISC] = &fvWriteDynamicViscosity; /* ChiOC */ - sprintf(output[OUT_CHIOC].cName, "ChiOC"); - sprintf(output[OUT_CHIOC].cDescr, + fvFormattedString(&output[OUT_CHIOC].cName, "ChiOC"); + fvFormattedString(&output[OUT_CHIOC].cDescr, "Light Element Concentration in Outer Core"); - sprintf(output[OUT_CHIOC].cNeg, "nd"); + fvFormattedString(&output[OUT_CHIOC].cNeg, "nd"); output[OUT_CHIOC].bNeg = 1; output[OUT_CHIOC].dNeg = 1; output[OUT_CHIOC].iNum = 1; @@ -3997,10 +3964,10 @@ void fvInitializeOutputThermint(OUTPUT *output, fnWriteOutput fnWrite[]) { fnWrite[OUT_CHIOC] = &fvWriteChiOC; /* ChiIC */ - sprintf(output[OUT_CHIIC].cName, "ChiIC"); - sprintf(output[OUT_CHIIC].cDescr, + fvFormattedString(&output[OUT_CHIIC].cName, "ChiIC"); + fvFormattedString(&output[OUT_CHIIC].cDescr, "Light Element Concentration in Inner Core"); - sprintf(output[OUT_CHIIC].cNeg, "nd"); + fvFormattedString(&output[OUT_CHIIC].cNeg, "nd"); output[OUT_CHIIC].bNeg = 1; output[OUT_CHIIC].dNeg = 1; output[OUT_CHIIC].iNum = 1; @@ -4008,9 +3975,9 @@ void fvInitializeOutputThermint(OUTPUT *output, fnWriteOutput fnWrite[]) { fnWrite[OUT_CHIIC] = &fvWriteChiIC; /* MassOC */ - sprintf(output[OUT_MASSOC].cName, "MassOC"); - sprintf(output[OUT_MASSOC].cDescr, "Mass of Outer Core"); - sprintf(output[OUT_MASSOC].cNeg, "EMASSOC"); + fvFormattedString(&output[OUT_MASSOC].cName, "MassOC"); + fvFormattedString(&output[OUT_MASSOC].cDescr, "Mass of Outer Core"); + fvFormattedString(&output[OUT_MASSOC].cNeg, "EMASSOC"); output[OUT_MASSOC].bNeg = 1; output[OUT_MASSOC].dNeg = 1 / (EMASSOC); output[OUT_MASSOC].iNum = 1; @@ -4018,9 +3985,9 @@ void fvInitializeOutputThermint(OUTPUT *output, fnWriteOutput fnWrite[]) { fnWrite[OUT_MASSOC] = &fvWriteMassOC; /* MassIC */ - sprintf(output[OUT_MASSIC].cName, "MassIC"); - sprintf(output[OUT_MASSIC].cDescr, "Mass of Inner Core"); - sprintf(output[OUT_MASSIC].cNeg, "EMASSIC"); + fvFormattedString(&output[OUT_MASSIC].cName, "MassIC"); + fvFormattedString(&output[OUT_MASSIC].cDescr, "Mass of Inner Core"); + fvFormattedString(&output[OUT_MASSIC].cNeg, "EMASSIC"); output[OUT_MASSIC].bNeg = 1; output[OUT_MASSIC].dNeg = 1 / (EMASSIC); output[OUT_MASSIC].iNum = 1; @@ -4028,9 +3995,9 @@ void fvInitializeOutputThermint(OUTPUT *output, fnWriteOutput fnWrite[]) { fnWrite[OUT_MASSIC] = &fvWriteMassIC; /* MassChiOC */ - sprintf(output[OUT_MASSCHIOC].cName, "MassChiOC"); - sprintf(output[OUT_MASSCHIOC].cDescr, "Mass of Chi in Outer Core"); - sprintf(output[OUT_MASSCHIOC].cNeg, "EMASSOC_CHI"); + fvFormattedString(&output[OUT_MASSCHIOC].cName, "MassChiOC"); + fvFormattedString(&output[OUT_MASSCHIOC].cDescr, "Mass of Chi in Outer Core"); + fvFormattedString(&output[OUT_MASSCHIOC].cNeg, "EMASSOC_CHI"); output[OUT_MASSCHIOC].bNeg = 1; output[OUT_MASSCHIOC].dNeg = 1 / (EMASSOC_CHI); output[OUT_MASSCHIOC].iNum = 1; @@ -4039,9 +4006,9 @@ void fvInitializeOutputThermint(OUTPUT *output, fnWriteOutput fnWrite[]) { // Needs a LongDescr /* MassChiIC */ - sprintf(output[OUT_MASSCHIIC].cName, "MassChiIC"); - sprintf(output[OUT_MASSCHIIC].cDescr, "Mass of Chi in Inner Core"); - sprintf(output[OUT_MASSCHIIC].cNeg, "EMASSIC_CHI"); + fvFormattedString(&output[OUT_MASSCHIIC].cName, "MassChiIC"); + fvFormattedString(&output[OUT_MASSCHIIC].cDescr, "Mass of Chi in Inner Core"); + fvFormattedString(&output[OUT_MASSCHIIC].cNeg, "EMASSIC_CHI"); output[OUT_MASSCHIIC].bNeg = 1; output[OUT_MASSCHIIC].dNeg = 1 / (EMASSIC_CHI); output[OUT_MASSCHIIC].iNum = 1; @@ -4050,9 +4017,9 @@ void fvInitializeOutputThermint(OUTPUT *output, fnWriteOutput fnWrite[]) { // Needs a LongDescr /* DTChi */ - sprintf(output[OUT_DTCHI].cName, "DTChi"); - sprintf(output[OUT_DTCHI].cDescr, "Core Liquidus Depression"); - sprintf(output[OUT_DTCHI].cNeg, "K"); + fvFormattedString(&output[OUT_DTCHI].cName, "DTChi"); + fvFormattedString(&output[OUT_DTCHI].cDescr, "Core Liquidus Depression"); + fvFormattedString(&output[OUT_DTCHI].cNeg, "K"); output[OUT_DTCHI].bNeg = 1; output[OUT_DTCHI].dNeg = 1; output[OUT_DTCHI].iNum = 1; @@ -4061,9 +4028,9 @@ void fvInitializeOutputThermint(OUTPUT *output, fnWriteOutput fnWrite[]) { // Needs a LongDescr /* CoreBuoyTherm */ - sprintf(output[OUT_COREBUOYTHERM].cName, "CoreBuoyTherm"); - sprintf(output[OUT_COREBUOYTHERM].cDescr, "Core Thermal Buoyancy Flux"); - sprintf(output[OUT_COREBUOYTHERM].cNeg, "m^2/s^3"); + fvFormattedString(&output[OUT_COREBUOYTHERM].cName, "CoreBuoyTherm"); + fvFormattedString(&output[OUT_COREBUOYTHERM].cDescr, "Core Thermal Buoyancy Flux"); + fvFormattedString(&output[OUT_COREBUOYTHERM].cNeg, "m^2/s^3"); output[OUT_COREBUOYTHERM].bNeg = 1; output[OUT_COREBUOYTHERM].dNeg = 1; output[OUT_COREBUOYTHERM].iNum = 1; @@ -4072,9 +4039,9 @@ void fvInitializeOutputThermint(OUTPUT *output, fnWriteOutput fnWrite[]) { // Needs a LongDescr /* CoreBuoyCompo */ - sprintf(output[OUT_COREBUOYCOMPO].cName, "CoreBuoyCompo"); - sprintf(output[OUT_COREBUOYCOMPO].cDescr, "Core Compositional Buoyancy Flux"); - sprintf(output[OUT_COREBUOYCOMPO].cNeg, "m^2/s^3"); + fvFormattedString(&output[OUT_COREBUOYCOMPO].cName, "CoreBuoyCompo"); + fvFormattedString(&output[OUT_COREBUOYCOMPO].cDescr, "Core Compositional Buoyancy Flux"); + fvFormattedString(&output[OUT_COREBUOYCOMPO].cNeg, "m^2/s^3"); output[OUT_COREBUOYCOMPO].bNeg = 1; output[OUT_COREBUOYCOMPO].dNeg = 1; output[OUT_COREBUOYCOMPO].iNum = 1; @@ -4083,9 +4050,9 @@ void fvInitializeOutputThermint(OUTPUT *output, fnWriteOutput fnWrite[]) { // Needs a LongDescr /* CoreBuoyTotal */ - sprintf(output[OUT_COREBUOYTOTAL].cName, "CoreBuoyTotal"); - sprintf(output[OUT_COREBUOYTOTAL].cDescr, "Core Total Buoyancy Flux"); - sprintf(output[OUT_COREBUOYTOTAL].cNeg, "m^2/s^3"); + fvFormattedString(&output[OUT_COREBUOYTOTAL].cName, "CoreBuoyTotal"); + fvFormattedString(&output[OUT_COREBUOYTOTAL].cDescr, "Core Total Buoyancy Flux"); + fvFormattedString(&output[OUT_COREBUOYTOTAL].cNeg, "m^2/s^3"); output[OUT_COREBUOYTOTAL].bNeg = 1; output[OUT_COREBUOYTOTAL].dNeg = 1; output[OUT_COREBUOYTOTAL].iNum = 1; @@ -4093,9 +4060,9 @@ void fvInitializeOutputThermint(OUTPUT *output, fnWriteOutput fnWrite[]) { fnWrite[OUT_COREBUOYTOTAL] = &fvWriteCoreBuoyTotal; /* GravICB */ - sprintf(output[OUT_GRAVICB].cName, "GravICB"); - sprintf(output[OUT_GRAVICB].cDescr, "ICB Gravity"); - sprintf(output[OUT_GRAVICB].cNeg, "m/s^2"); + fvFormattedString(&output[OUT_GRAVICB].cName, "GravICB"); + fvFormattedString(&output[OUT_GRAVICB].cDescr, "ICB Gravity"); + fvFormattedString(&output[OUT_GRAVICB].cNeg, "m/s^2"); output[OUT_GRAVICB].bNeg = 1; output[OUT_GRAVICB].dNeg = 1; output[OUT_GRAVICB].iNum = 1; @@ -4104,9 +4071,9 @@ void fvInitializeOutputThermint(OUTPUT *output, fnWriteOutput fnWrite[]) { // Needs a LongDescr /* MagMom */ - sprintf(output[OUT_MAGMOM].cName, "MagMom"); - sprintf(output[OUT_MAGMOM].cDescr, "Core Magnetic Moment"); - sprintf(output[OUT_MAGMOM].cNeg, "EMAGMOM"); + fvFormattedString(&output[OUT_MAGMOM].cName, "MagMom"); + fvFormattedString(&output[OUT_MAGMOM].cDescr, "Core Magnetic Moment"); + fvFormattedString(&output[OUT_MAGMOM].cNeg, "EMAGMOM"); output[OUT_MAGMOM].bNeg = 1; output[OUT_MAGMOM].dNeg = 1. / (EMAGMOM); output[OUT_MAGMOM].iNum = 1; @@ -4114,9 +4081,9 @@ void fvInitializeOutputThermint(OUTPUT *output, fnWriteOutput fnWrite[]) { fnWrite[OUT_MAGMOM] = &fvWriteMagMom; /* RICDot */ - sprintf(output[OUT_RICDOT].cName, "RICDot"); - sprintf(output[OUT_RICDOT].cDescr, "Inner Core growth rate"); - sprintf(output[OUT_RICDOT].cNeg, "m/s"); + fvFormattedString(&output[OUT_RICDOT].cName, "RICDot"); + fvFormattedString(&output[OUT_RICDOT].cDescr, "Inner Core growth rate"); + fvFormattedString(&output[OUT_RICDOT].cNeg, "m/s"); output[OUT_RICDOT].bNeg = 1; output[OUT_RICDOT].dNeg = 1; output[OUT_RICDOT].iNum = 1; @@ -4124,9 +4091,9 @@ void fvInitializeOutputThermint(OUTPUT *output, fnWriteOutput fnWrite[]) { fnWrite[OUT_RICDOT] = &fvWriteRICDot; /* PresSWind */ - sprintf(output[OUT_PRESSWIND].cName, "PresSWind"); - sprintf(output[OUT_PRESSWIND].cDescr, "Stellar wind pressure at body"); - sprintf(output[OUT_PRESSWIND].cNeg, "EPRESSWIND"); + fvFormattedString(&output[OUT_PRESSWIND].cName, "PresSWind"); + fvFormattedString(&output[OUT_PRESSWIND].cDescr, "Stellar wind pressure at body"); + fvFormattedString(&output[OUT_PRESSWIND].cNeg, "EPRESSWIND"); output[OUT_PRESSWIND].bNeg = 1; output[OUT_PRESSWIND].dNeg = 1. / (EPRESSWIND); output[OUT_PRESSWIND].iNum = 1; @@ -4134,9 +4101,9 @@ void fvInitializeOutputThermint(OUTPUT *output, fnWriteOutput fnWrite[]) { fnWrite[OUT_PRESSWIND] = &fvWritePresSWind; /* MagPauseRad */ - sprintf(output[OUT_MAGPAUSERAD].cName, "MagPauseRad"); - sprintf(output[OUT_MAGPAUSERAD].cDescr, "Magnetopause Radius"); - sprintf(output[OUT_MAGPAUSERAD].cNeg, "EMAGPAUSERAD"); + fvFormattedString(&output[OUT_MAGPAUSERAD].cName, "MagPauseRad"); + fvFormattedString(&output[OUT_MAGPAUSERAD].cDescr, "Magnetopause Radius"); + fvFormattedString(&output[OUT_MAGPAUSERAD].cNeg, "EMAGPAUSERAD"); output[OUT_MAGPAUSERAD].bNeg = 1; output[OUT_MAGPAUSERAD].dNeg = 1. / (EMAGPAUSERAD); output[OUT_MAGPAUSERAD].iNum = 1; @@ -4145,9 +4112,9 @@ void fvInitializeOutputThermint(OUTPUT *output, fnWriteOutput fnWrite[]) { /* Heat Fluxes/Flows */ /* HFluxUMan */ - sprintf(output[OUT_HFLUXUMAN].cName, "HfluxUMan"); - sprintf(output[OUT_HFLUXUMAN].cDescr, "Heat Flux Upper Mantle"); - sprintf(output[OUT_HFLUXUMAN].cNeg, "W/m^2"); + fvFormattedString(&output[OUT_HFLUXUMAN].cName, "HfluxUMan"); + fvFormattedString(&output[OUT_HFLUXUMAN].cDescr, "Heat Flux Upper Mantle"); + fvFormattedString(&output[OUT_HFLUXUMAN].cNeg, "W/m^2"); output[OUT_HFLUXUMAN].bNeg = 1; output[OUT_HFLUXUMAN].dNeg = 1; output[OUT_HFLUXUMAN].iNum = 1; @@ -4155,9 +4122,9 @@ void fvInitializeOutputThermint(OUTPUT *output, fnWriteOutput fnWrite[]) { fnWrite[OUT_HFLUXUMAN] = &fvWriteHfluxUMan; /* HFluxLMan */ - sprintf(output[OUT_HFLUXLMAN].cName, "HfluxLMan"); - sprintf(output[OUT_HFLUXLMAN].cDescr, "Heat Flux Lower Mantle"); - sprintf(output[OUT_HFLUXLMAN].cNeg, "W/m^2"); + fvFormattedString(&output[OUT_HFLUXLMAN].cName, "HfluxLMan"); + fvFormattedString(&output[OUT_HFLUXLMAN].cDescr, "Heat Flux Lower Mantle"); + fvFormattedString(&output[OUT_HFLUXLMAN].cNeg, "W/m^2"); output[OUT_HFLUXLMAN].bNeg = 1; output[OUT_HFLUXLMAN].dNeg = 1; output[OUT_HFLUXLMAN].iNum = 1; @@ -4165,9 +4132,9 @@ void fvInitializeOutputThermint(OUTPUT *output, fnWriteOutput fnWrite[]) { fnWrite[OUT_HFLUXLMAN] = &fvWriteHfluxLMan; /* HFluxCMB */ - sprintf(output[OUT_HFLUXCMB].cName, "HfluxCMB"); - sprintf(output[OUT_HFLUXCMB].cDescr, "Heat Flux Core-Mantle Boundary"); - sprintf(output[OUT_HFLUXCMB].cNeg, "W/m^2"); + fvFormattedString(&output[OUT_HFLUXCMB].cName, "HfluxCMB"); + fvFormattedString(&output[OUT_HFLUXCMB].cDescr, "Heat Flux Core-Mantle Boundary"); + fvFormattedString(&output[OUT_HFLUXCMB].cNeg, "W/m^2"); output[OUT_HFLUXCMB].bNeg = 1; output[OUT_HFLUXCMB].dNeg = 1; output[OUT_HFLUXCMB].iNum = 1; @@ -4175,10 +4142,10 @@ void fvInitializeOutputThermint(OUTPUT *output, fnWriteOutput fnWrite[]) { fnWrite[OUT_HFLUXCMB] = &fvWriteHfluxCMB; /* HfluxCMBAd */ - sprintf(output[OUT_HFLUXCMBAD].cName, "HfluxCMBAd"); - sprintf(output[OUT_HFLUXCMBAD].cDescr, + fvFormattedString(&output[OUT_HFLUXCMBAD].cName, "HfluxCMBAd"); + fvFormattedString(&output[OUT_HFLUXCMBAD].cDescr, "Adiabatic Heat Flux Core-Mantle Boundary"); - sprintf(output[OUT_HFLUXCMBAD].cNeg, "W/m^2"); + fvFormattedString(&output[OUT_HFLUXCMBAD].cNeg, "W/m^2"); output[OUT_HFLUXCMBAD].bNeg = 1; output[OUT_HFLUXCMBAD].dNeg = 1; output[OUT_HFLUXCMBAD].iNum = 1; @@ -4187,10 +4154,10 @@ void fvInitializeOutputThermint(OUTPUT *output, fnWriteOutput fnWrite[]) { // Needs a LongDescr /* HfluxCMBConv */ - sprintf(output[OUT_HFLUXCMBCONV].cName, "HfluxCMBConv"); - sprintf(output[OUT_HFLUXCMBCONV].cDescr, + fvFormattedString(&output[OUT_HFLUXCMBCONV].cName, "HfluxCMBConv"); + fvFormattedString(&output[OUT_HFLUXCMBCONV].cDescr, "Super-Adiabatic (convective) Heat Flux Core-Mantle Boundary"); - sprintf(output[OUT_HFLUXCMBCONV].cNeg, "W/m^2"); + fvFormattedString(&output[OUT_HFLUXCMBCONV].cNeg, "W/m^2"); output[OUT_HFLUXCMBCONV].bNeg = 1; output[OUT_HFLUXCMBCONV].dNeg = 1; output[OUT_HFLUXCMBCONV].iNum = 1; @@ -4198,10 +4165,10 @@ void fvInitializeOutputThermint(OUTPUT *output, fnWriteOutput fnWrite[]) { fnWrite[OUT_HFLUXCMBCONV] = &fvWriteHfluxCMBConv; /* ThermConductOC */ - sprintf(output[OUT_THERMCONDUCTOC].cName, "ThermConductOC"); - sprintf(output[OUT_THERMCONDUCTOC].cDescr, + fvFormattedString(&output[OUT_THERMCONDUCTOC].cName, "ThermConductOC"); + fvFormattedString(&output[OUT_THERMCONDUCTOC].cDescr, "Thermal Conductivity of the Outer Core"); - sprintf(output[OUT_THERMCONDUCTOC].cNeg, "W/m/K"); + fvFormattedString(&output[OUT_THERMCONDUCTOC].cNeg, "W/m/K"); output[OUT_THERMCONDUCTOC].bNeg = 1; output[OUT_THERMCONDUCTOC].dNeg = 1; output[OUT_THERMCONDUCTOC].iNum = 1; @@ -4209,9 +4176,9 @@ void fvInitializeOutputThermint(OUTPUT *output, fnWriteOutput fnWrite[]) { fnWrite[OUT_THERMCONDUCTOC] = &fvWriteThermConductOC; /* HflowUMan */ - sprintf(output[OUT_HFLOWUMAN].cName, "HflowUMan"); - sprintf(output[OUT_HFLOWUMAN].cDescr, "Heat Flow Upper Mantle"); - sprintf(output[OUT_HFLOWUMAN].cNeg, "TW"); + fvFormattedString(&output[OUT_HFLOWUMAN].cName, "HflowUMan"); + fvFormattedString(&output[OUT_HFLOWUMAN].cDescr, "Heat Flow Upper Mantle"); + fvFormattedString(&output[OUT_HFLOWUMAN].cNeg, "TW"); output[OUT_HFLOWUMAN].bNeg = 1; output[OUT_HFLOWUMAN].dNeg = 1e-12; output[OUT_HFLOWUMAN].iNum = 1; @@ -4219,9 +4186,9 @@ void fvInitializeOutputThermint(OUTPUT *output, fnWriteOutput fnWrite[]) { fnWrite[OUT_HFLOWUMAN] = &fvWriteHflowUMan; /* HFlowLMan */ - sprintf(output[OUT_HFLOWLMAN].cName, "HflowLMan"); - sprintf(output[OUT_HFLOWLMAN].cDescr, "Heat Flow Lower Mantle"); - sprintf(output[OUT_HFLOWLMAN].cNeg, "TW"); + fvFormattedString(&output[OUT_HFLOWLMAN].cName, "HflowLMan"); + fvFormattedString(&output[OUT_HFLOWLMAN].cDescr, "Heat Flow Lower Mantle"); + fvFormattedString(&output[OUT_HFLOWLMAN].cNeg, "TW"); output[OUT_HFLOWLMAN].bNeg = 1; output[OUT_HFLOWLMAN].dNeg = 1e-12; output[OUT_HFLOWLMAN].iNum = 1; @@ -4229,9 +4196,9 @@ void fvInitializeOutputThermint(OUTPUT *output, fnWriteOutput fnWrite[]) { fnWrite[OUT_HFLOWLMAN] = &fvWriteHflowLMan; /* HFlowCMB */ - sprintf(output[OUT_HFLOWCMB].cName, "HflowCMB"); - sprintf(output[OUT_HFLOWCMB].cDescr, "Heat Flow Core-Mantle Boundary"); - sprintf(output[OUT_HFLOWCMB].cNeg, "TW"); + fvFormattedString(&output[OUT_HFLOWCMB].cName, "HflowCMB"); + fvFormattedString(&output[OUT_HFLOWCMB].cDescr, "Heat Flow Core-Mantle Boundary"); + fvFormattedString(&output[OUT_HFLOWCMB].cNeg, "TW"); output[OUT_HFLOWCMB].bNeg = 1; output[OUT_HFLOWCMB].dNeg = 1e-12; output[OUT_HFLOWCMB].iNum = 1; @@ -4239,9 +4206,9 @@ void fvInitializeOutputThermint(OUTPUT *output, fnWriteOutput fnWrite[]) { fnWrite[OUT_HFLOWCMB] = &fvWriteHflowCMB; /* HflowLatentMan */ - sprintf(output[OUT_HFLOWLATENTMAN].cName, "HflowLatentMan"); - sprintf(output[OUT_HFLOWLATENTMAN].cDescr, "Latent Heat Flow Mantle"); - sprintf(output[OUT_HFLOWLATENTMAN].cNeg, "TW"); + fvFormattedString(&output[OUT_HFLOWLATENTMAN].cName, "HflowLatentMan"); + fvFormattedString(&output[OUT_HFLOWLATENTMAN].cDescr, "Latent Heat Flow Mantle"); + fvFormattedString(&output[OUT_HFLOWLATENTMAN].cNeg, "TW"); output[OUT_HFLOWLATENTMAN].bNeg = 1; output[OUT_HFLOWLATENTMAN].dNeg = 1e-12; output[OUT_HFLOWLATENTMAN].iNum = 1; @@ -4249,9 +4216,9 @@ void fvInitializeOutputThermint(OUTPUT *output, fnWriteOutput fnWrite[]) { fnWrite[OUT_HFLOWLATENTMAN] = &fvWriteHflowLatentMan; /* HflowMeltMan */ - sprintf(output[OUT_HFLOWMELTMAN].cName, "HflowMeltMan"); - sprintf(output[OUT_HFLOWMELTMAN].cDescr, "Melt Heat Flow Mantle"); - sprintf(output[OUT_HFLOWMELTMAN].cNeg, "TW"); + fvFormattedString(&output[OUT_HFLOWMELTMAN].cName, "HflowMeltMan"); + fvFormattedString(&output[OUT_HFLOWMELTMAN].cDescr, "Melt Heat Flow Mantle"); + fvFormattedString(&output[OUT_HFLOWMELTMAN].cNeg, "TW"); output[OUT_HFLOWMELTMAN].bNeg = 1; output[OUT_HFLOWMELTMAN].dNeg = 1e-12; output[OUT_HFLOWMELTMAN].iNum = 1; @@ -4259,9 +4226,9 @@ void fvInitializeOutputThermint(OUTPUT *output, fnWriteOutput fnWrite[]) { fnWrite[OUT_HFLOWMELTMAN] = &fvWriteHflowMeltMan; /* HFlowSecMan */ - sprintf(output[OUT_HFLOWSECMAN].cName, "HflowSecMan"); - sprintf(output[OUT_HFLOWSECMAN].cDescr, "Mantle Secular Heat Flow"); - sprintf(output[OUT_HFLOWSECMAN].cNeg, "TW"); + fvFormattedString(&output[OUT_HFLOWSECMAN].cName, "HflowSecMan"); + fvFormattedString(&output[OUT_HFLOWSECMAN].cDescr, "Mantle Secular Heat Flow"); + fvFormattedString(&output[OUT_HFLOWSECMAN].cNeg, "TW"); output[OUT_HFLOWSECMAN].bNeg = 1; output[OUT_HFLOWSECMAN].dNeg = 1e-12; output[OUT_HFLOWSECMAN].iNum = 1; @@ -4270,9 +4237,9 @@ void fvInitializeOutputThermint(OUTPUT *output, fnWriteOutput fnWrite[]) { // Needs a LongDescr /* HFlowSurf */ - sprintf(output[OUT_HFLOWSURF].cName, "HflowSurf"); - sprintf(output[OUT_HFLOWSURF].cDescr, "Heat Flow Surface Total"); - sprintf(output[OUT_HFLOWSURF].cNeg, "TW"); + fvFormattedString(&output[OUT_HFLOWSURF].cName, "HflowSurf"); + fvFormattedString(&output[OUT_HFLOWSURF].cDescr, "Heat Flow Surface Total"); + fvFormattedString(&output[OUT_HFLOWSURF].cNeg, "TW"); output[OUT_HFLOWSURF].bNeg = 1; output[OUT_HFLOWSURF].dNeg = 1e-12; output[OUT_HFLOWSURF].iNum = 1; @@ -4281,9 +4248,9 @@ void fvInitializeOutputThermint(OUTPUT *output, fnWriteOutput fnWrite[]) { // Is this redundant with SurfEnFluxTotal? XXX /* HFlowLatentIC */ - sprintf(output[OUT_HFLOWLATENTIC].cName, "HflowLatentIC"); - sprintf(output[OUT_HFLOWLATENTIC].cDescr, "Latent Heat Release at ICB"); - sprintf(output[OUT_HFLOWLATENTIC].cNeg, "TW"); + fvFormattedString(&output[OUT_HFLOWLATENTIC].cName, "HflowLatentIC"); + fvFormattedString(&output[OUT_HFLOWLATENTIC].cDescr, "Latent Heat Release at ICB"); + fvFormattedString(&output[OUT_HFLOWLATENTIC].cNeg, "TW"); output[OUT_HFLOWLATENTIC].bNeg = 1; output[OUT_HFLOWLATENTIC].dNeg = 1e-12; output[OUT_HFLOWLATENTIC].iNum = 1; @@ -4291,9 +4258,9 @@ void fvInitializeOutputThermint(OUTPUT *output, fnWriteOutput fnWrite[]) { fnWrite[OUT_HFLOWLATENTIC] = &fvWriteHflowLatentIC; /* PowerGravIC */ - sprintf(output[OUT_POWERGRAVIC].cName, "PowerGravIC"); - sprintf(output[OUT_POWERGRAVIC].cDescr, "Gravitational Power Release at ICB"); - sprintf(output[OUT_POWERGRAVIC].cNeg, "TW"); + fvFormattedString(&output[OUT_POWERGRAVIC].cName, "PowerGravIC"); + fvFormattedString(&output[OUT_POWERGRAVIC].cDescr, "Gravitational Power Release at ICB"); + fvFormattedString(&output[OUT_POWERGRAVIC].cNeg, "TW"); output[OUT_POWERGRAVIC].bNeg = 1; output[OUT_POWERGRAVIC].dNeg = 1e-12; output[OUT_POWERGRAVIC].iNum = 1; @@ -4301,9 +4268,9 @@ void fvInitializeOutputThermint(OUTPUT *output, fnWriteOutput fnWrite[]) { fnWrite[OUT_POWERGRAVIC] = &fvWritePowerGravIC; /* TDotMan */ - sprintf(output[OUT_TDOTMAN].cName, "TDotMan"); - sprintf(output[OUT_TDOTMAN].cDescr, "Change in Mantle Temperature"); - sprintf(output[OUT_TDOTMAN].cNeg, "K/s"); + fvFormattedString(&output[OUT_TDOTMAN].cName, "TDotMan"); + fvFormattedString(&output[OUT_TDOTMAN].cDescr, "Change in Mantle Temperature"); + fvFormattedString(&output[OUT_TDOTMAN].cNeg, "K/s"); output[OUT_TDOTMAN].bNeg = 1; output[OUT_TDOTMAN].dNeg = 1; output[OUT_TDOTMAN].iNum = 1; @@ -4311,9 +4278,9 @@ void fvInitializeOutputThermint(OUTPUT *output, fnWriteOutput fnWrite[]) { fnWrite[OUT_TDOTMAN] = &fvWriteTDotMan; /* TDotCore */ - sprintf(output[OUT_TDOTCORE].cName, "TDotCore"); - sprintf(output[OUT_TDOTCORE].cDescr, "Change in Core Temperature"); - sprintf(output[OUT_TDOTCORE].cNeg, "K/s"); + fvFormattedString(&output[OUT_TDOTCORE].cName, "TDotCore"); + fvFormattedString(&output[OUT_TDOTCORE].cDescr, "Change in Core Temperature"); + fvFormattedString(&output[OUT_TDOTCORE].cNeg, "K/s"); output[OUT_TDOTCORE].bNeg = 1; output[OUT_TDOTCORE].dNeg = 1; output[OUT_TDOTCORE].iNum = 1; @@ -4322,9 +4289,9 @@ void fvInitializeOutputThermint(OUTPUT *output, fnWriteOutput fnWrite[]) { /* Constants */ /* TrefLind */ - sprintf(output[OUT_TREFLIND].cName, "TrefLind"); - sprintf(output[OUT_TREFLIND].cDescr, "Core Liquidus Lindeman Reference"); - sprintf(output[OUT_TREFLIND].cNeg, "K"); + fvFormattedString(&output[OUT_TREFLIND].cName, "TrefLind"); + fvFormattedString(&output[OUT_TREFLIND].cDescr, "Core Liquidus Lindeman Reference"); + fvFormattedString(&output[OUT_TREFLIND].cNeg, "K"); output[OUT_TREFLIND].bNeg = 1; output[OUT_TREFLIND].dNeg = 1; output[OUT_TREFLIND].iNum = 1; diff --git a/src/thermint.h b/src/thermint.h index 23838a68f..4e17a884f 100644 --- a/src/thermint.h +++ b/src/thermint.h @@ -592,133 +592,133 @@ void fvInitializeOutputFunctionThermint(OUTPUT *, int, int); void fvFinalizeOutputFunctionThermint(OUTPUT *, int, int); void fvWriteTMan(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, UPDATE *, int, - double *, char[]); + double *, char**); void fvWriteTUMan(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, UPDATE *, int, - double *, char[]); + double *, char**); void fvWriteTsolUMan(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, UPDATE *, int, - double *, char[]); + double *, char**); void fvWriteTLMan(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, UPDATE *, int, - double *, char[]); + double *, char**); void fvWriteTJumpUMan(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, UPDATE *, - int, double *, char[]); + int, double *, char**); void fvWriteTJumpLMan(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, UPDATE *, - int, double *, char[]); + int, double *, char**); void fvWriteSignTJumpUMan(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, - UPDATE *, int, double *, char[]); + UPDATE *, int, double *, char**); void fvWriteSignTJumpLMan(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, - UPDATE *, int, double *, char[]); + UPDATE *, int, double *, char**); void fvWriteTCore(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, UPDATE *, int, - double *, char[]); + double *, char**); void fvWriteTCMB(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, UPDATE *, int, - double *, char[]); + double *, char**); void fvWriteTICB(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, UPDATE *, int, - double *, char[]); + double *, char**); void fvWriteBLUMan(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, UPDATE *, - int, double *, char[]); + int, double *, char**); void fvWriteBLLMan(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, UPDATE *, - int, double *, char[]); + int, double *, char**); void fvWriteViscUManArr(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, - UPDATE *, int, double *, char[]); + UPDATE *, int, double *, char**); void fvWriteViscUMan(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, UPDATE *, - int, double *, char[]); + int, double *, char**); void fvWriteViscLMan(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, UPDATE *, - int, double *, char[]); + int, double *, char**); void fvWriteViscMMan(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, UPDATE *, - int, double *, char[]); + int, double *, char**); void fvWriteShmodUMan(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, UPDATE *, - int, double *, char[]); + int, double *, char**); void fvWriteShmodLMan(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, UPDATE *, - int, double *, char[]); + int, double *, char**); void fvWriteFMeltUMan(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, UPDATE *, - int, double *, char[]); + int, double *, char**); void fvWriteFMeltLMan(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, UPDATE *, - int, double *, char[]); + int, double *, char**); void fvWriteMeltfactorUMan(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, - UPDATE *, int, double *, char[]); + UPDATE *, int, double *, char**); void fvWriteMeltfactorLMan(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, - UPDATE *, int, double *, char[]); + UPDATE *, int, double *, char**); void fvWriteDepthMeltMan(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, - UPDATE *, int, double *, char[]); + UPDATE *, int, double *, char**); void fvWriteTDepthMeltMan(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, - UPDATE *, int, double *, char[]); + UPDATE *, int, double *, char**); void fvWriteTJumpMeltMan(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, - UPDATE *, int, double *, char[]); + UPDATE *, int, double *, char**); void fvWriteMeltMassFluxMan(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, - UPDATE *, int, double *, char[]); + UPDATE *, int, double *, char**); void fvWriteRayleighMan(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, - UPDATE *, int, double *, char[]); + UPDATE *, int, double *, char**); void fvWriteTDotMan(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, UPDATE *, - int, double *, char[]); + int, double *, char**); void fvWriteTDotCore(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, UPDATE *, - int, double *, char[]); + int, double *, char**); void fvWriteHfluxUMan(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, UPDATE *, - int, double *, char[]); + int, double *, char**); void fvWriteHflowUMan(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, UPDATE *, - int, double *, char[]); + int, double *, char**); void fvWriteHflowSecMan(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, - UPDATE *, int, double *, char[]); + UPDATE *, int, double *, char**); void fvWriteHfluxLMan(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, UPDATE *, - int, double *, char[]); + int, double *, char**); void fvWriteHflowLMan(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, UPDATE *, - int, double *, char[]); + int, double *, char**); void fvWriteHflowTidalMan(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, - UPDATE *, int, double *, char[]); + UPDATE *, int, double *, char**); void fvWriteHflowTidalCore(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, - UPDATE *, int, double *, char[]); + UPDATE *, int, double *, char**); void fvWriteHflowLatentMan(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, - UPDATE *, int, double *, char[]); + UPDATE *, int, double *, char**); void fvWriteHflowMeltMan(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, - UPDATE *, int, double *, char[]); + UPDATE *, int, double *, char**); void fvWriteHflowLatentIC(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, - UPDATE *, int, double *, char[]); + UPDATE *, int, double *, char**); void fvWritePowerGravIC(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, - UPDATE *, int, double *, char[]); + UPDATE *, int, double *, char**); void fvWriteHflowICB(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, UPDATE *, - int, double *, char[]); + int, double *, char**); void fvWriteHflowSurf(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, UPDATE *, - int, double *, char[]); + int, double *, char**); void fvWriteTidalPowMan(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, - UPDATE *, int, double *, char[]); + UPDATE *, int, double *, char**); void fvWriteRIC(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, UPDATE *, int, - double *, char[]); + double *, char**); void fvWriteDRICDTCMB(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, UPDATE *, - int, double *, char[]); + int, double *, char**); void fvWriteChiOC(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, UPDATE *, int, - double *, char[]); + double *, char**); void fvWriteChiIC(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, UPDATE *, int, - double *, char[]); + double *, char**); void fvWriteMassOC(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, UPDATE *, - int, double *, char[]); + int, double *, char**); void fvWriteMassIC(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, UPDATE *, - int, double *, char[]); + int, double *, char**); void fvWriteMassChiOC(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, UPDATE *, - int, double *, char[]); + int, double *, char**); void fvWriteMassChiIC(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, UPDATE *, - int, double *, char[]); + int, double *, char**); void fvWriteDTChi(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, UPDATE *, int, - double *, char[]); + double *, char**); void fvWriteThermConductOC(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, - UPDATE *, int, double *, char[]); + UPDATE *, int, double *, char**); void fvWriteHfluxCMBAd(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, UPDATE *, - int, double *, char[]); + int, double *, char**); void fvWriteHfluxCMBConv(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, - UPDATE *, int, double *, char[]); + UPDATE *, int, double *, char**); void fvWriteCoreBuoyTherm(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, - UPDATE *, int, double *, char[]); + UPDATE *, int, double *, char**); void fvWriteCoreBuoyCompo(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, - UPDATE *, int, double *, char[]); + UPDATE *, int, double *, char**); void fvWriteCoreBuoyTotal(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, - UPDATE *, int, double *, char[]); + UPDATE *, int, double *, char**); void fvWriteGravICB(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, UPDATE *, - int, double *, char[]); + int, double *, char**); void fvWriteRICDot(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, UPDATE *, - int, double *, char[]); + int, double *, char**); void fvWriteMagMom(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, UPDATE *, - int, double *, char[]); + int, double *, char**); void fvWritePresSWind(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, UPDATE *, - int, double *, char[]); + int, double *, char**); void fvWriteMagPauseRad(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, - UPDATE *, int, double *, char[]); + UPDATE *, int, double *, char**); /* Logging Functions */ void fvLogOptionsThermint(CONTROL *, FILE *); void fvLogThermint(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UPDATE *, diff --git a/src/update.c b/src/update.c index d55e549a4..34e221aa0 100644 --- a/src/update.c +++ b/src/update.c @@ -20,7 +20,11 @@ void InitializeUpdateBodyPerts(CONTROL *control, UPDATE *update, int iBody) { void InitializeUpdateTmpBody(BODY *body, CONTROL *control, MODULE *module, UPDATE *update, int iBody) { - int iModule; + int jBody,iModule; + + for (jBody=0;jBodyEvolve.iNumBodies;jBody++) { + control->Evolve.tmpBody[jBody].cName = NULL; + } for (iModule = 0; iModule < module->iNumModules[iBody]; iModule++) { module->fnInitializeUpdateTmpBody[iBody][iModule](body, control, update, diff --git a/src/verify.c b/src/verify.c index 49dcd2445..c0ec8eb4e 100644 --- a/src/verify.c +++ b/src/verify.c @@ -39,10 +39,13 @@ int bFloatComparison(double x, double y) { */ int bFileExists(const char *filename) { - FILE *file; - if ((file = fopen(filename, "r"))) { - fclose(file); - return 1; + if (filename != NULL) { + FILE *file; + if ((file = fopen(filename, "r"))) { + fclose(file); + return 1; + } + return 0; } return 0; } @@ -142,7 +145,7 @@ void VerifyNames(BODY *body, CONTROL *control, OPTIONS *options) { options[OPT_BODYNAME].cName, options[OPT_BODYNAME].cFile[iBody] + 1, iBody); } - sprintf(body[iBody].cName, "%d", iBody + 1); + fvFormattedString(&body[iBody].cName, "%d", iBody + 1); } for (jBody = iBody + 1; jBody < control->Evolve.iNumBodies; jBody++) { if (strcmp(body[iBody].cName, body[jBody].cName) == 0) { @@ -355,7 +358,7 @@ void VerifyIntegration(BODY *body, CONTROL *control, FILES *files, OPTIONS *options, SYSTEM *system, fnIntegrate *fnOneStep) { int iFile, iFile1 = 0, iFile2 = 0; - char cTmp[OPTLEN]; + char *cTmp=NULL; // Initialize iDir to 0, i.e. assume no integrations requested to start @@ -383,7 +386,7 @@ void VerifyIntegration(BODY *body, CONTROL *control, FILES *files, if (control->Evolve.bDoBackward) { for (iFile = 1; iFile < files->iNumInputs; iFile++) { if (options[OPT_OUTFILE].iLine[iFile] == -1) { - sprintf(files->Outfile[iFile - 1].cOut, "%s.%s.backward", system->cName, + fvFormattedString(&files->Outfile[iFile - 1].cOut, "%s.%s.backward", system->cName, body[iFile - 1].cName); if (control->Io.iVerbose >= VERBINPUT) { fprintf(stderr, "INFO: %s not set, defaulting to %s.\n", @@ -398,7 +401,7 @@ void VerifyIntegration(BODY *body, CONTROL *control, FILES *files, if (control->Evolve.bDoForward) { for (iFile = 1; iFile < files->iNumInputs; iFile++) { if (options[OPT_OUTFILE].iLine[iFile] == -1) { - sprintf(files->Outfile[iFile - 1].cOut, "%s.%s.forward", system->cName, + fvFormattedString(&files->Outfile[iFile - 1].cOut, "%s.%s.forward", system->cName, body[iFile - 1].cName); if (control->Io.iVerbose >= VERBINPUT) { fprintf(stderr, "INFO: %s not set, defaulting to %s.\n", @@ -475,7 +478,7 @@ void VerifyIntegration(BODY *body, CONTROL *control, FILES *files, *fnOneStep = &RungeKutta4Step; } else { /* Assign Default */ - strcpy(cTmp, options[OPT_INTEGRATIONMETHOD].cDefault); + fvFormattedString(&cTmp, options[OPT_INTEGRATIONMETHOD].cDefault); if (control->Io.iVerbose >= VERBINPUT) { fprintf(stderr, "INFO: %s not set, defaulting to %s.\n", options[OPT_INTEGRATIONMETHOD].cName, diff --git a/src/vplanet.c b/src/vplanet.c index db1e8fddf..3c6709c46 100644 --- a/src/vplanet.c +++ b/src/vplanet.c @@ -29,7 +29,6 @@ We need this wrapper so we can call `main_impl` from Python. int main_impl(int argc, char *argv[]) { #ifdef DEBUG #ifdef __x86_64__ - // feenableexcept(FE_INVALID | FE_OVERFLOW); _MM_SET_EXCEPTION_MASK(_MM_GET_EXCEPTION_MASK() & ~_MM_MASK_INVALID); _MM_SET_EXCEPTION_MASK(_MM_GET_EXCEPTION_MASK() & ~_MM_MASK_OVERFLOW); _MM_SET_EXCEPTION_MASK(_MM_GET_EXCEPTION_MASK() & ~_MM_MASK_DIV_ZERO); @@ -51,7 +50,7 @@ int main_impl(int argc, char *argv[]) { dStartTime = time(NULL); */ - int iOption, iVerbose, iQuiet, iOverwrite; + int iArg, iVerbose, iQuiet, iOverwrite; OPTIONS *options; OUTPUT *output; CONTROL control; @@ -60,18 +59,21 @@ int main_impl(int argc, char *argv[]) { MODULE module; FILES files; SYSTEM system; - char infile[NAMELEN]; + char *sPrimaryFile = NULL; fnReadOption fnRead[MODULEOPTEND]; // XXX Pointers? fnWriteOutput fnWrite[MODULEOUTEND]; fnUpdateVariable ***fnUpdate; fnIntegrate fnOneStep; + control.sGitVersion=NULL; #ifdef GITVERSION - strcpy(control.sGitVersion, GITVERSION); + fvFormattedString(&control.sGitVersion, GITVERSION); #else - strcpy(control.sGitVersion, "Unknown"); + fvFormattedString(&control.sGitVersion, "Unknown"); #endif + system.cName=NULL; + /** Must initialize all options and outputs for all modules independent of what is selected. This allows a complete help screen as well as checks during ReadOptions. This @@ -89,7 +91,8 @@ int main_impl(int argc, char *argv[]) { control.Evolve.iOneStep = 0; /* Copy executable file name to the files struct. */ - strcpy(files.cExe, argv[0]); + files.cExe=NULL; + fvFormattedString(&files.cExe, argv[0]); if (argc == 1) { fprintf(stderr, @@ -106,23 +109,23 @@ int main_impl(int argc, char *argv[]) { control.Io.bOverwrite = -1; /* Check for flags */ - for (iOption = 1; iOption < argc; iOption++) { - if (memcmp(argv[iOption], "-v", 2) == 0) { + for (iArg = 1; iArg < argc; iArg++) { + if (memcmp(argv[iArg], "-v", 2) == 0) { control.Io.iVerbose = 5; - iVerbose = iOption; + iVerbose = iArg; } - if (memcmp(argv[iOption], "-q", 2) == 0) { + if (memcmp(argv[iArg], "-q", 2) == 0) { control.Io.iVerbose = 0; - iQuiet = iOption; + iQuiet = iArg; } - if (memcmp(argv[iOption], "-f", 2) == 0) { + if (memcmp(argv[iArg], "-f", 2) == 0) { control.Io.bOverwrite = 1; - iOverwrite = iOption; + iOverwrite = iArg; } - if (memcmp(argv[iOption], "-h", 2) == 0) { + if (memcmp(argv[iArg], "-h", 2) == 0) { Help(options, output, files.cExe, 0); } - if (memcmp(argv[iOption], "-H", 2) == 0) { + if (memcmp(argv[iArg], "-H", 2) == 0) { Help(options, output, files.cExe, 1); } } @@ -133,15 +136,17 @@ int main_impl(int argc, char *argv[]) { } /* Now identify input file, usually vpl.in */ - for (iOption = 1; iOption < argc; iOption++) { - if (iOption != iVerbose && iOption != iQuiet && iOption != iOverwrite) { - strcpy(infile, argv[iOption]); + for (iArg = 1; iArg < argc; iArg++) { + if (iArg != iVerbose && iArg != iQuiet && iArg != iOverwrite) { + fvFormattedString(&sPrimaryFile, argv[iArg]); } } + CheckFileExists(sPrimaryFile); + /* Read input files */ ReadOptions(&body, &control, &files, &module, options, output, &system, - &update, fnRead, infile); + &update, fnRead, sPrimaryFile); if (control.Io.iVerbose >= VERBINPUT) { printf("Input files read.\n"); diff --git a/src/vplanet.h b/src/vplanet.h index d3236e0c8..309341c5b 100644 --- a/src/vplanet.h +++ b/src/vplanet.h @@ -12,6 +12,7 @@ #include #include #include +#include #include #include #include @@ -179,8 +180,8 @@ typedef struct VERIFY VERIFY; */ struct BODY { /* Body Properties */ - char cName[NAMELEN]; /**< Body's Name */ - char sColor[OPTLEN]; /**< Body color (for plotting) */ + char *cName; /**< Body's Name */ + char *sColor; /**< Body color (for plotting) */ int bMantle; /**< Is there a mantle? */ int bOcean; /**< Is there an ocean? */ @@ -367,7 +368,7 @@ struct BODY { */ int bRelaxDynEllip; /**< shape of planet relaxes when spun down */ int bReadOrbitData; /**< Use orbit data from file rather than distorb */ - char cFileOrbitData[NAMELEN]; /**< read orbital data from this file + char *cFileOrbitData; /**< read orbital data from this file (distorb=0) */ double *daTimeSeries; /**< time series for orbital data */ double *daSemiSeries; /**< time series for orbital data */ @@ -397,7 +398,7 @@ struct BODY { currently) */ int iTidePerts; /**< Number of Tidal Perturbers */ int *iaTidePerts; /**< Body #'s of Tidal Perturbers */ - char saTidePerts[MAXARRAY][NAMELEN]; /**< Names of Tidal Perturbers */ + char *saTidePerts[MAXARRAY]; /**< Names of Tidal Perturbers */ double dK2Man; /**< Mantle k2 love number */ double dK2Ocean; /**< Ocean's Love Number */ double dK2Env; /**< Envelope's Love Number */ @@ -685,7 +686,7 @@ struct BODY { double dPrecA0; /**< Initial pA value used when distrot is not called */ int bReadOrbitOblData; /**< Use orbit and obliquity data from file rather than distrot */ - char cFileOrbitOblData[NAMELEN]; /**< read orbital and obliquity data from + char *sFileOrbitOblData; /**< read orbital and obliquity data from this file (distorb=0) */ double *daOblSeries; /**< time series for obliquity data */ double *daPrecASeries; /**< time series for obliquity data */ @@ -1023,7 +1024,7 @@ struct BODY { typedef double (*fnLaplaceFunction)(double, int); struct SYSTEM { - char cName[NAMELEN]; /**< System's Name */ + char *cName; /**< System's Name */ int iNumBodies; /** Number of bodies in the system; redundant with Evolve! */ @@ -1836,7 +1837,7 @@ struct CONTROL { IO Io; UNITS *Units; - char sGitVersion[64]; + char *sGitVersion; /* Move to BODY */ int *iMassRad; /**< Mass-Radius Relationship */ @@ -1901,13 +1902,13 @@ depends on the total number of modules available. */ * regarding the files that read in. */ struct INFILE { - char cIn[NAMELEN]; /**< File Name */ + char *cIn; /**< File Name */ int *bLineOK; /**< Line number Format OK? */ int iNumLines; /**< Number of Input Lines */ /* Species file for PHOTOCHEM */ - char cSpecies[NAMELEN]; /**< Name of Chemical Species N/I */ + //char cSpecies[NAMELEN]; /**< Name of Chemical Species N/I */ /* Reaction file for PHOTOCHEM */ - char cReactions[NAMELEN]; /**< Names of Chemical Reactions N/I */ + //char cReactions[NAMELEN]; /**< Names of Chemical Reactions N/I */ /* Aerosol scattering files */ /* Aqueous file -- add to SpeciesFile? */ @@ -1918,13 +1919,13 @@ struct INFILE { * regarding the output files. */ struct OUTFILE { - char cOut[2 * NAMELEN + 10]; /**< Output File Name */ + char *cOut; /**< Output File Name */ int iNumCols; /**< Number of Columns in Output File (system.planet+.forward/backward) */ - char caCol[MODULEOUTEND][OPTLEN]; /**< Output Value Name */ + char *caCol[MODULEOUTEND]; /**< Output Value Name */ int bNeg[MODULEOUTEND]; /**< Use Negative Option Units? */ int iNumGrid; /**< Number of grid outputs */ - char caGrid[MODULEOUTEND][OPTLEN]; /**< Gridded output name */ + char *caGrid[MODULEOUTEND]; /**< Gridded output name */ }; @@ -1932,9 +1933,9 @@ struct OUTFILE { * regarding every file. */ struct FILES { - char cExe[LINE]; /**< Name of Executable */ + char *cExe; /**< Name of Executable */ OUTFILE *Outfile; /**< Output File Name for Forward Integration */ - char cLog[NAMELEN + 4]; /**< Log File Name (+4 to allow for ".log" suffix) */ + char *cLog; /**< Log File Name (+4 to allow for ".log" suffix) */ INFILE *Infile; int iNumInputs; /**< Number of Input Files */ }; @@ -1943,28 +1944,28 @@ struct FILES { * regarding the options, including their file data. */ struct OPTIONS { - char cName[OPTLEN]; /**< Option Name */ - char cDescr[OPTDESCR]; /**< Brief Description of Option */ - char cLongDescr[OPTLONDESCR]; /**< Long Description of Option */ - char cValues[OPTDESCR]; /**< Description of permitted values / ranges */ + char *cName; /**< Option Name */ + char *cDescr; /**< Brief Description of Option */ + char *cLongDescr; /**< Long Description of Option */ + char *cValues; /**< Description of permitted values / ranges */ int iType; /**< Cast of input. 0=bool; 1=int; 2=double; 3=string; +10 for array. */ - char cDefault[OPTDESCR]; /**< Description of Default Value */ + char *cDefault; /**< Description of Default Value */ /** Qualitative description of the option, included for connection wtih bigplanet. Options are: time, length, mass, angle, energy, pressure, amperes. Units may be combined with standard mathematical operations, e.g. energy/time, or mass*length/time^2. */ - char cDimension[OPTDESCR]; + char *cDimension; double dDefault; /**< Default Value */ int iModuleBit; /**< Bitwise sum of modules permitted to read option */ int bMultiFile; /**< Option Permitted in Multiple Input Files? */ int iMultiIn; int *iLine; /**< Option's Line number in Input File */ char *iFile; - char cFile[MAXFILES][OPTLEN]; /**< File Name Where Set */ + char **cFile; /**< File Name Where Set */ int bNeg; /**< Is There a Negative Option? */ - char cNeg[OPTDESCR]; /**< Description of Negative Unit Conversion */ + char *cNeg; /**< Description of Negative Unit Conversion */ int iFileType; /**< What type of file can option be in? 0 = primary only, 1 = body file only, 2 = any file */ double dNeg; /**< Conversion Factor to System Units */ @@ -1972,35 +1973,14 @@ struct OPTIONS { /* OUTPUT contains the data regarding every output parameters */ -/* Some output variables must combine output from different modules. - * These functions do that combining. XXX I think this is defunct! - - typedef double (*fnOutputModule)(BODY*,SYSTEM*,UPDATE*,int,int); */ - -/* GRIDOUTPUT will be part of OPTIONS, and contains data for latitudinal - * parameters in POISE */ -// typedef struct { -// char cName[OPTLEN]; /**< Output Name */ -// char cDescr[LINE]; /**< Output Description */ -// int bNeg; /**< Is There a Negative Option? */ -// int *bDoNeg; /**< Should the Output use "Negative" Units? */ -// char cNeg[NAMELEN]; /**< Units of Negative Option */ -// double dNeg; /**< Conversion Factor for Negative Option */ -// int iNum; /**< Number of Columns for Output */ -// -// /* Now add vector output functions */ -// fnOutputModule **fnOutput; /**< Function Pointers to Write Output */ -// -// } GRIDOUTPUT; - struct OUTPUT { - char cName[OPTLEN]; /**< Output Name */ - char cDescr[OUTDESCR]; /**< Output Description */ - char cLongDescr[OUTLONDESCR]; /**< Output Long Description */ + char *cName; /**< Output Name */ + char *cDescr; /**< Output Description */ + char *cLongDescr; /**< Output Long Description */ int bNeg; /**< Is There a Negative Option? */ int iModuleBit; /**< Bit flag for module to check output parameters */ int *bDoNeg; /**< Should the Output use "Negative" Units? */ - char cNeg[OUTDESCR]; /**< Units of Negative Option */ + char *cNeg; /**< Units of Negative Option */ double dNeg; /**< Conversion Factor for Negative Option */ int iNum; /**< Number of Columns for Output */ int bGrid; /**< Is output quantity gridded (e.g. a function of latitude)? */ @@ -2012,7 +1992,7 @@ struct OUTPUT { typedef void (*fnReadOption)(BODY *, CONTROL *, FILES *, OPTIONS *, SYSTEM *, int); typedef void (*fnWriteOutput)(BODY *, CONTROL *, OUTPUT *, SYSTEM *, UNITS *, - UPDATE *, int, double *, char[]); + UPDATE *, int, double *, char**); /* diff --git a/tests/Atmesc/WaterELimNoXUVLB15NoO2SinkBolmont16/test_WaterELimNoXUVLB15NoO2SinkBolmont16.py b/tests/Atmesc/WaterELimNoXUVLB15NoO2SinkBolmont16/test_WaterELimNoXUVLB15NoO2SinkBolmont16.py index 9aecdc234..009583782 100644 --- a/tests/Atmesc/WaterELimNoXUVLB15NoO2SinkBolmont16/test_WaterELimNoXUVLB15NoO2SinkBolmont16.py +++ b/tests/Atmesc/WaterELimNoXUVLB15NoO2SinkBolmont16/test_WaterELimNoXUVLB15NoO2SinkBolmont16.py @@ -55,7 +55,7 @@ "log.initial.earth.XO2": {"value": 0.000000}, "log.initial.earth.XH2O": {"value": 1.000000}, "log.initial.earth.HDiffFlux": {"value": 1.264874e+17, "unit": 1 / u.m ** 2 / u.sec}, - "log.initial.earth.HRefODragMod": {"value": -0.000000}, + "log.initial.earth.HRefODragMod": {"value": -1.000000}, "log.initial.earth.KTide": {"value": 1.000000}, "log.initial.earth.RGDuration": {"value": 0.00000e+00, "unit": u.yr}, "log.final.system.Age": {"value": 3.155760e+15, "unit": u.sec}, @@ -110,7 +110,7 @@ "log.final.earth.XO2": {"value": 0.000000}, "log.final.earth.XH2O": {"value": 1.000000}, "log.final.earth.HDiffFlux": {"value": 1.264874e+17, "unit": 1 / u.m ** 2 / u.sec}, - "log.final.earth.HRefODragMod": {"value": -0.000000}, + "log.final.earth.HRefODragMod": {"value": -1.000000}, "log.final.earth.KTide": {"value": 1.000000}, "log.final.earth.RGDuration": {"value": 0.00000e+00, "unit": u.yr}, } diff --git a/tests/Atmesc/WaterELimNoXUVLB15NoO2SinkConstXAbsEffH2O/test_WaterELimNoXUVLB15NoO2SinkConstXAbsEffH2O.py b/tests/Atmesc/WaterELimNoXUVLB15NoO2SinkConstXAbsEffH2O/test_WaterELimNoXUVLB15NoO2SinkConstXAbsEffH2O.py index 86d760157..73d9384ea 100644 --- a/tests/Atmesc/WaterELimNoXUVLB15NoO2SinkConstXAbsEffH2O/test_WaterELimNoXUVLB15NoO2SinkConstXAbsEffH2O.py +++ b/tests/Atmesc/WaterELimNoXUVLB15NoO2SinkConstXAbsEffH2O/test_WaterELimNoXUVLB15NoO2SinkConstXAbsEffH2O.py @@ -55,7 +55,7 @@ "log.initial.earth.XO2": {"value": 0.000000}, "log.initial.earth.XH2O": {"value": 1.000000}, "log.initial.earth.HDiffFlux": {"value": 1.264874e+17, "unit": 1 / u.m ** 2 / u.sec}, - "log.initial.earth.HRefODragMod": {"value": -0.000000}, + "log.initial.earth.HRefODragMod": {"value": -1.000000}, "log.initial.earth.KTide": {"value": 1.000000}, "log.initial.earth.RGDuration": {"value": 0.00000e+00, "unit": u.yr}, "log.final.system.Age": {"value": 3.155760e+15, "unit": u.sec}, @@ -110,7 +110,7 @@ "log.final.earth.XO2": {"value": 0.000000}, "log.final.earth.XH2O": {"value": 1.000000}, "log.final.earth.HDiffFlux": {"value": 1.264874e+17, "unit": 1 / u.m ** 2 / u.sec}, - "log.final.earth.HRefODragMod": {"value": -0.000000}, + "log.final.earth.HRefODragMod": {"value": -1.000000}, "log.final.earth.KTide": {"value": 1.000000}, "log.final.earth.RGDuration": {"value": 0.00000e+00, "unit": u.yr}, } diff --git a/tests/Atmesc/WaterELimNoXUVLB15SinkO2Bolmont16/test_WaterELimNoXUVLB15SinkO2Bolmont16.py b/tests/Atmesc/WaterELimNoXUVLB15SinkO2Bolmont16/test_WaterELimNoXUVLB15SinkO2Bolmont16.py index 307400492..99bd1d353 100644 --- a/tests/Atmesc/WaterELimNoXUVLB15SinkO2Bolmont16/test_WaterELimNoXUVLB15SinkO2Bolmont16.py +++ b/tests/Atmesc/WaterELimNoXUVLB15SinkO2Bolmont16/test_WaterELimNoXUVLB15SinkO2Bolmont16.py @@ -55,7 +55,7 @@ "log.initial.earth.XO2": {"value": 0.000000}, "log.initial.earth.XH2O": {"value": 1.000000}, "log.initial.earth.HDiffFlux": {"value": 1.264874e+17, "unit": 1 / u.m ** 2 / u.sec}, - "log.initial.earth.HRefODragMod": {"value": -0.000000}, + "log.initial.earth.HRefODragMod": {"value": -1.000000}, "log.initial.earth.KTide": {"value": 1.000000}, "log.initial.earth.RGDuration": {"value": 0.00000e+00, "unit": u.yr}, "log.final.system.Age": {"value": 3.155760e+13, "unit": u.sec}, @@ -110,7 +110,7 @@ "log.final.earth.XO2": {"value": 0.000000}, "log.final.earth.XH2O": {"value": 1.000000}, "log.final.earth.HDiffFlux": {"value": 1.264874e+17, "unit": 1 / u.m ** 2 / u.sec}, - "log.final.earth.HRefODragMod": {"value": -0.000000}, + "log.final.earth.HRefODragMod": {"value": -1.000000}, "log.final.earth.KTide": {"value": 1.000000}, "log.final.earth.RGDuration": {"value": 0.00000e+00, "unit": u.yr}, } diff --git a/tests/Atmesc/WaterELimNoXUVLB15SinkO2ConstXAbsEffH2O/test_WaterELimNoXUVLB15SinkO2ConstXAbsEffH2O.py b/tests/Atmesc/WaterELimNoXUVLB15SinkO2ConstXAbsEffH2O/test_WaterELimNoXUVLB15SinkO2ConstXAbsEffH2O.py index be71cd166..93ee6d9d0 100644 --- a/tests/Atmesc/WaterELimNoXUVLB15SinkO2ConstXAbsEffH2O/test_WaterELimNoXUVLB15SinkO2ConstXAbsEffH2O.py +++ b/tests/Atmesc/WaterELimNoXUVLB15SinkO2ConstXAbsEffH2O/test_WaterELimNoXUVLB15SinkO2ConstXAbsEffH2O.py @@ -55,7 +55,7 @@ "log.initial.earth.XO2": {"value": 0.000000}, "log.initial.earth.XH2O": {"value": 1.000000}, "log.initial.earth.HDiffFlux": {"value": 1.264874e+17, "unit": 1 / u.m ** 2 / u.sec}, - "log.initial.earth.HRefODragMod": {"value": -0.000000}, + "log.initial.earth.HRefODragMod": {"value": -1.000000}, "log.initial.earth.KTide": {"value": 1.000000}, "log.initial.earth.RGDuration": {"value": 0.00000e+00, "unit": u.yr}, "log.final.system.Age": {"value": 3.155760e+15, "unit": u.sec}, @@ -110,7 +110,7 @@ "log.final.earth.XO2": {"value": 0.000000}, "log.final.earth.XH2O": {"value": 1.000000}, "log.final.earth.HDiffFlux": {"value": 1.264874e+17, "unit": 1 / u.m ** 2 / u.sec}, - "log.final.earth.HRefODragMod": {"value": -0.000000}, + "log.final.earth.HRefODragMod": {"value": -1.000000}, "log.final.earth.KTide": {"value": 1.000000}, "log.final.earth.RGDuration": {"value": 0.00000e+00, "unit": u.yr}, } diff --git a/tests/Atmesc/WaterELimNoXUVLBExactNoO2SinkBolmont16/test_WaterELimNoXUVLBExactNoO2SinkBolmont16.py b/tests/Atmesc/WaterELimNoXUVLBExactNoO2SinkBolmont16/test_WaterELimNoXUVLBExactNoO2SinkBolmont16.py index e83445f17..85eeadd57 100644 --- a/tests/Atmesc/WaterELimNoXUVLBExactNoO2SinkBolmont16/test_WaterELimNoXUVLBExactNoO2SinkBolmont16.py +++ b/tests/Atmesc/WaterELimNoXUVLBExactNoO2SinkBolmont16/test_WaterELimNoXUVLBExactNoO2SinkBolmont16.py @@ -55,7 +55,7 @@ "log.initial.earth.XO2": {"value": 0.000000}, "log.initial.earth.XH2O": {"value": 1.000000}, "log.initial.earth.HDiffFlux": {"value": 1.264874e+17, "unit": 1 / u.m ** 2 / u.sec}, - "log.initial.earth.HRefODragMod": {"value": -0.000000}, + "log.initial.earth.HRefODragMod": {"value": -1.000000}, "log.initial.earth.KTide": {"value": 1.000000}, "log.initial.earth.RGDuration": {"value": 0.00000e+00, "unit": u.yr}, "log.final.system.Age": {"value": 3.155760e+15, "unit": u.sec}, @@ -110,7 +110,7 @@ "log.final.earth.XO2": {"value": 0.000000}, "log.final.earth.XH2O": {"value": 1.000000}, "log.final.earth.HDiffFlux": {"value": 1.264874e+17, "unit": 1 / u.m ** 2 / u.sec}, - "log.final.earth.HRefODragMod": {"value": -0.000000}, + "log.final.earth.HRefODragMod": {"value": -1.000000}, "log.final.earth.KTide": {"value": 1.000000}, "log.final.earth.RGDuration": {"value": 0.00000e+00, "unit": u.yr}, } diff --git a/tests/Atmesc/WaterELimNoXUVLBExactNoO2SinkConstXAbsEffH2O/test_WaterELimNoXUVLBExactNoO2SinkConstXAbsEffH2O.py b/tests/Atmesc/WaterELimNoXUVLBExactNoO2SinkConstXAbsEffH2O/test_WaterELimNoXUVLBExactNoO2SinkConstXAbsEffH2O.py index ae825b039..3bff17a7f 100644 --- a/tests/Atmesc/WaterELimNoXUVLBExactNoO2SinkConstXAbsEffH2O/test_WaterELimNoXUVLBExactNoO2SinkConstXAbsEffH2O.py +++ b/tests/Atmesc/WaterELimNoXUVLBExactNoO2SinkConstXAbsEffH2O/test_WaterELimNoXUVLBExactNoO2SinkConstXAbsEffH2O.py @@ -55,7 +55,7 @@ "log.initial.earth.XO2": {"value": 0.000000}, "log.initial.earth.XH2O": {"value": 1.000000}, "log.initial.earth.HDiffFlux": {"value": 1.264874e+17, "unit": 1 / u.m ** 2 / u.sec}, - "log.initial.earth.HRefODragMod": {"value": -0.000000}, + "log.initial.earth.HRefODragMod": {"value": -1.000000}, "log.initial.earth.KTide": {"value": 1.000000}, "log.initial.earth.RGDuration": {"value": 0.00000e+00, "unit": u.yr}, "log.final.system.Age": {"value": 3.155760e+15, "unit": u.sec}, @@ -110,7 +110,7 @@ "log.final.earth.XO2": {"value": 0.000000}, "log.final.earth.XH2O": {"value": 1.000000}, "log.final.earth.HDiffFlux": {"value": 1.264874e+17, "unit": 1 / u.m ** 2 / u.sec}, - "log.final.earth.HRefODragMod": {"value": -0.000000}, + "log.final.earth.HRefODragMod": {"value": -1.000000}, "log.final.earth.KTide": {"value": 1.000000}, "log.final.earth.RGDuration": {"value": 0.00000e+00, "unit": u.yr}, } diff --git a/tests/Atmesc/WaterELimNoXUVLBExactSinkO2Bolmont16/test_WaterELimNoXUVLBExactSinkO2Bolmont16.py b/tests/Atmesc/WaterELimNoXUVLBExactSinkO2Bolmont16/test_WaterELimNoXUVLBExactSinkO2Bolmont16.py index 7bbcc49c6..6c099c37d 100644 --- a/tests/Atmesc/WaterELimNoXUVLBExactSinkO2Bolmont16/test_WaterELimNoXUVLBExactSinkO2Bolmont16.py +++ b/tests/Atmesc/WaterELimNoXUVLBExactSinkO2Bolmont16/test_WaterELimNoXUVLBExactSinkO2Bolmont16.py @@ -55,7 +55,7 @@ "log.initial.earth.XO2": {"value": 0.000000}, "log.initial.earth.XH2O": {"value": 1.000000}, "log.initial.earth.HDiffFlux": {"value": 1.264874e+17, "unit": 1 / u.m ** 2 / u.sec}, - "log.initial.earth.HRefODragMod": {"value": -0.000000}, + "log.initial.earth.HRefODragMod": {"value": -1.000000}, "log.initial.earth.KTide": {"value": 1.000000}, "log.initial.earth.RGDuration": {"value": 0.00000e+00, "unit": u.yr}, "log.final.system.Age": {"value": 3.155760e+15, "unit": u.sec}, @@ -110,7 +110,7 @@ "log.final.earth.XO2": {"value": 0.000000}, "log.final.earth.XH2O": {"value": 1.000000}, "log.final.earth.HDiffFlux": {"value": 1.264874e+17, "unit": 1 / u.m ** 2 / u.sec}, - "log.final.earth.HRefODragMod": {"value": -0.000000}, + "log.final.earth.HRefODragMod": {"value": -1.000000}, "log.final.earth.KTide": {"value": 1.000000}, "log.final.earth.RGDuration": {"value": 0.00000e+00, "unit": u.yr}, } diff --git a/tests/Atmesc/WaterELimNoXUVLBExactSinkO2ConstXAbsEffH2O/test_WaterELimNoXUVLBExactSinkO2ConstXAbsEffH2O.py b/tests/Atmesc/WaterELimNoXUVLBExactSinkO2ConstXAbsEffH2O/test_WaterELimNoXUVLBExactSinkO2ConstXAbsEffH2O.py index 944e82e45..12f365311 100644 --- a/tests/Atmesc/WaterELimNoXUVLBExactSinkO2ConstXAbsEffH2O/test_WaterELimNoXUVLBExactSinkO2ConstXAbsEffH2O.py +++ b/tests/Atmesc/WaterELimNoXUVLBExactSinkO2ConstXAbsEffH2O/test_WaterELimNoXUVLBExactSinkO2ConstXAbsEffH2O.py @@ -55,7 +55,7 @@ "log.initial.earth.XO2": {"value": 0.000000}, "log.initial.earth.XH2O": {"value": 1.000000}, "log.initial.earth.HDiffFlux": {"value": 1.264874e+17, "unit": 1 / u.m ** 2 / u.sec}, - "log.initial.earth.HRefODragMod": {"value": -0.000000}, + "log.initial.earth.HRefODragMod": {"value": -1.000000}, "log.initial.earth.KTide": {"value": 1.000000}, "log.initial.earth.RGDuration": {"value": 0.00000e+00, "unit": u.yr}, "log.final.system.Age": {"value": 3.155760e+15, "unit": u.sec}, @@ -110,7 +110,7 @@ "log.final.earth.XO2": {"value": 0.000000}, "log.final.earth.XH2O": {"value": 1.000000}, "log.final.earth.HDiffFlux": {"value": 1.264874e+17, "unit": 1 / u.m ** 2 / u.sec}, - "log.final.earth.HRefODragMod": {"value": -0.000000}, + "log.final.earth.HRefODragMod": {"value": -1.000000}, "log.final.earth.KTide": {"value": 1.000000}, "log.final.earth.RGDuration": {"value": 0.00000e+00, "unit": u.yr}, } diff --git a/tests/AtmescEqtideMagmocRadheatStellar/MagmOc_Trappist1g/Trappist1.in b/tests/AtmescEqtideMagmocRadheatStellar/MagmOc_Trappist1g/Trappist1.in index 08ff7dfa8..a8cd8498a 100644 --- a/tests/AtmescEqtideMagmocRadheatStellar/MagmOc_Trappist1g/Trappist1.in +++ b/tests/AtmescEqtideMagmocRadheatStellar/MagmOc_Trappist1g/Trappist1.in @@ -1,6 +1,6 @@ # The host star sName Trappist1 # Body's name -saModules stellar, eqtide # Modules to apply, exact spelling required +saModules stellar eqtide # Modules to apply, exact spelling required # Output saOutputOrder Age -Luminosity -LXUVStellar -Radius Temperature diff --git a/tests/AtmescEqtideMagmocRadheatStellar/MagmOc_Trappist1g/g.in b/tests/AtmescEqtideMagmocRadheatStellar/MagmOc_Trappist1g/g.in index 2b84bc49e..e9e0774e7 100644 --- a/tests/AtmescEqtideMagmocRadheatStellar/MagmOc_Trappist1g/g.in +++ b/tests/AtmescEqtideMagmocRadheatStellar/MagmOc_Trappist1g/g.in @@ -1,6 +1,6 @@ # Planet g parameters sName g # Body's name -saModules magmoc, atmesc, radheat, eqtide # Modules to apply, exact spelling required +saModules magmoc atmesc radheat eqtide # Modules to apply, exact spelling required sColor 13aed5 # Physical Properties diff --git a/tests/AtmescFlareStellar/AtmEscFlareDavenport/star.in b/tests/AtmescFlareStellar/AtmEscFlareDavenport/star.in index ddecb0b52..6bcb34368 100644 --- a/tests/AtmescFlareStellar/AtmEscFlareDavenport/star.in +++ b/tests/AtmescFlareStellar/AtmEscFlareDavenport/star.in @@ -1,5 +1,5 @@ sName star # Body's name -saModules stellar, flare +saModules stellar flare # Physical Parameters dMass 0.12 diff --git a/tests/AtmescFlareStellar/AtmEscFlareLacy/star.in b/tests/AtmescFlareStellar/AtmEscFlareLacy/star.in index 386b45752..7835df921 100644 --- a/tests/AtmescFlareStellar/AtmEscFlareLacy/star.in +++ b/tests/AtmescFlareStellar/AtmEscFlareLacy/star.in @@ -1,5 +1,5 @@ sName star # Body's name -saModules stellar, flare +saModules stellar flare # Physical Parameters dMass 0.12 diff --git a/tests/AtmescMagmocStellar/MagmOc_Earth/Earth.in b/tests/AtmescMagmocStellar/MagmOc_Earth/Earth.in index f8cec2e54..dc95dcb08 100644 --- a/tests/AtmescMagmocStellar/MagmOc_Earth/Earth.in +++ b/tests/AtmescMagmocStellar/MagmOc_Earth/Earth.in @@ -1,6 +1,6 @@ # Planet a parameters sName Earth # Body's name -saModules magmoc, atmesc # Modules to apply, exact spelling required +saModules magmoc atmesc # Modules to apply, exact spelling required sColor 13aed5 # Physical Properties diff --git a/tests/AtmescMagmocStellar/MagmOc_GJ1132b/GJ1132b.in b/tests/AtmescMagmocStellar/MagmOc_GJ1132b/GJ1132b.in index ee8816df4..6e25529fb 100644 --- a/tests/AtmescMagmocStellar/MagmOc_GJ1132b/GJ1132b.in +++ b/tests/AtmescMagmocStellar/MagmOc_GJ1132b/GJ1132b.in @@ -1,6 +1,6 @@ # Planet a parameters sName GJ1132b # Body's name -saModules magmoc, atmesc # Modules to apply, exact spelling required +saModules magmoc atmesc # Modules to apply, exact spelling required sColor 13aed5 # Physical Properties diff --git a/tests/Help/test_Help.py b/tests/Help/test_Help.py index 747282a00..06eed534f 100644 --- a/tests/Help/test_Help.py +++ b/tests/Help/test_Help.py @@ -7,6 +7,7 @@ def test_Help(): try: + # Note that this script only passes when run from the top level directory subprocess.check_output("bin/vplanet -H", shell=True) except subprocess.CalledProcessError: raise ValueError(f"Long help failed") diff --git a/tests/sanitizer.py b/tests/sanitizer.py index 1f53add72..b69208df0 100644 --- a/tests/sanitizer.py +++ b/tests/sanitizer.py @@ -6,7 +6,6 @@ # XXX Near duplicates in maketest.py, 02/06/24 def Main(): BuildVPLanet() - print("") dir_list = CollectAllTests() tot_fail = 0 @@ -30,6 +29,9 @@ def Main(): if ("ABORTING" in line): fail = 1 tot_fail += 1 + if (line != "Simulation completed.\n"): + fail = 1 + tot_fail += 1 if fail: print(": FAIL",flush=True) else: diff --git a/tests/valgrind.py b/tests/valgrind.py index a2f66e479..db7ffa899 100644 --- a/tests/valgrind.py +++ b/tests/valgrind.py @@ -6,11 +6,12 @@ # XXX Near duplicates in maketest.py, 02/06/24 def Main(): BuildVPLanet() - print("") dir_list = CollectAllTests() tot_fail = 0 tot_test = 0 + logfile = open("memcheck.log","w") + logfile.write("The following directories were NOT memcheck clean:\n") for dir in dir_list: tot_test += 1 sys.stdout.write(dir) @@ -32,10 +33,12 @@ def Main(): if n_errors > 0: tot_fail += 1 print(": FAIL",flush=True) + logfile.write(dir+'\n') else: print(": pass",flush=True) os.chdir("../../") + logfile.close() print("Done! ") if tot_fail == 0: diff --git a/vplanet/wrapper.py b/vplanet/wrapper.py index f6b7fc2c9..43bf6a558 100644 --- a/vplanet/wrapper.py +++ b/vplanet/wrapper.py @@ -87,9 +87,10 @@ def run( try: subprocess.check_output(args, cwd=path) except subprocess.CalledProcessError as e: + message = e error = True if error: - raise VPLANETError("Error running VPLANET.") + raise VPLANETError(message) # Grab the output output = get_output(path=path, sysname=sysname, units=units)