Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
1df072d
add cooling time variables
anu1217 Dec 22, 2025
81d5d7f
add cooling time integers
anu1217 Dec 22, 2025
a53e8ea
add Output_def.h to CoolingTime.h
anu1217 Dec 30, 2025
55c8258
add cooltime_units as argument to writeTotalHeader()
anu1217 Dec 30, 2025
bb93e50
add condition to convert units for total header
anu1217 Dec 31, 2025
a7228d1
add cooltimeUnits
anu1217 Dec 31, 2025
9b4edba
add cooltimeType as argument to setNorm()
anu1217 Dec 31, 2025
9370056
add cooltime_units to Result
anu1217 Dec 31, 2025
182e487
add missing ;
anu1217 Dec 31, 2025
266d1f4
turn getCooltimeMode into a static function
anu1217 Dec 31, 2025
5994579
change name of returned object
anu1217 Dec 31, 2025
4bc23ae
reflect getCooltimeMode being changed to static
anu1217 Dec 31, 2025
b142877
only declare function in Result.h
anu1217 Dec 31, 2025
bbc962a
add logic to writeHeader()
anu1217 Dec 31, 2025
ef89289
fix arguments for writeHeader()
anu1217 Dec 31, 2025
8fec07e
fix logic
anu1217 Dec 31, 2025
6eba7c6
Apply suggestion from @gonuke
anu1217 Jan 7, 2026
3d950f2
Apply suggestion from @gonuke
anu1217 Jan 7, 2026
20dab87
Apply suggestion from @gonuke
anu1217 Jan 7, 2026
717b0e5
Merge branch 'main' into output_s
anu1217 Jan 7, 2026
598b1fb
Merge branch 'svalinn:main' into output_s
anu1217 Jan 7, 2026
cce2f7e
Merge branch 'output_s' of github.com:anu1217/ALARA into output_s
anu1217 Jan 7, 2026
582f8b0
add missing curly braces
anu1217 Jan 7, 2026
32fea30
add condition to ensure cooltime units are printed to top header
anu1217 Jan 7, 2026
5da0c69
redefine char
anu1217 Jan 7, 2026
ba06de0
remove conditional statement
anu1217 Jan 7, 2026
73212f2
remove commented lines
anu1217 Jan 7, 2026
257c8d8
add cooltimeUnits to other responses
anu1217 Jan 7, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 23 additions & 4 deletions src/CoolingTime.C
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

#include "CoolingTime.h"
#include "Input_def.h"
#include "Output_def.h"

/***************************
********* Service *********
Expand Down Expand Up @@ -131,7 +132,7 @@ int CoolingTime::makeCoolingTimes(double *& coolingTimes)

/** There is a column for the isotope, a column for the @shutdown
result, and then a column for each after-shutdown cooling time. */
void CoolingTime::writeHeader()
void CoolingTime::writeHeader(int cooltime_units)
{
CoolingTime *ptr = this;
char textBuf[16];
Expand All @@ -141,7 +142,16 @@ void CoolingTime::writeHeader()
while (ptr->next != NULL)
{
ptr = ptr->next;
sprintf(textBuf,"%7g %c ",ptr->coolingTime, ptr->units);
if (cooltime_units == COOLTIME_S) // print cooling time converted to seconds
{
double t_sec = convertTime(ptr->coolingTime, ptr->units);
sprintf(textBuf, "%9.3e s ", t_sec);
}
else // print cooling time in default units
{
sprintf(textBuf, "%7g %c ", ptr->coolingTime, ptr->units);
}
Comment on lines +145 to +153
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe a short function

std::string coolingTimeStr(int coolTimeUnit)

That does this to ensure consistency across different places we do this (currently only two)


cout << textBuf;
}
cout << endl;
Expand All @@ -168,7 +178,7 @@ void CoolingTime::getCoolTimesStrings(std::vector<std::string>& coolTimesList)
/** There is a column indicating the counter for the total in question,
one column for @ shutdown results, and then one column for each of the
after-shutdown cooling times. */
void CoolingTime::writeTotalHeader(const char* type)
void CoolingTime::writeTotalHeader(const char* type, int cooltime_units)
{
CoolingTime *ptr = this;
char textBuf[16];
Expand All @@ -181,7 +191,16 @@ void CoolingTime::writeTotalHeader(const char* type)
while (ptr->next != NULL)
{
ptr = ptr->next;
sprintf(textBuf,"%7g %c ",ptr->coolingTime, ptr->units);
if (cooltime_units == COOLTIME_S) // print cooling time converted to seconds
{
double t_sec = convertTime(ptr->coolingTime, ptr->units);
sprintf(textBuf, "%9.3e s ", t_sec);
}
else // print cooling time in default units
{
sprintf(textBuf, "%7g %c ", ptr->coolingTime, ptr->units);
}

cout << textBuf;
}
cout << endl;
Expand Down
5 changes: 3 additions & 2 deletions src/CoolingTime.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#include "alara.h"
#include <vector>
#include <string>
#include "Output_def.h"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't need this header here.. it's only needed in the ".C" file


#ifndef COOLINGTIME_H
#define COOLINGTIME_H
Expand Down Expand Up @@ -49,13 +50,13 @@ class CoolingTime
int makeCoolingTimes(double *&);

/// This function writes a header for the standard response table.
void writeHeader();
void writeHeader(int cooltime_units);

/// This function returns a string containing the nth shutdown time
void getCoolTimesStrings(std::vector<std::string>&);

/// This function writes a header for the table of totals.
void writeTotalHeader(const char*);
void writeTotalHeader(const char*, int cooltime_units);

/// This function writes an appropriately sized separator of
/// "===...===" to frame the table.
Expand Down
2 changes: 1 addition & 1 deletion src/Loading.C
Original file line number Diff line number Diff line change
Expand Up @@ -470,7 +470,7 @@ void Loading::write(int response, int writeComp, CoolingTime* coolList,
cout << Result::getReminderStr() << endl;

/* write header for totals */
coolList->writeTotalHeader("zone");
coolList->writeTotalHeader("zone", Result::getCooltimeMode());

/* for each zone */
while (ptr->next != NULL)
Expand Down
2 changes: 1 addition & 1 deletion src/Mixture.C
Original file line number Diff line number Diff line change
Expand Up @@ -616,7 +616,7 @@ void Mixture::write(int response, int writeComp, CoolingTime* coolList,
cout << Result::getReminderStr() << endl;

/* write header for totals */
coolList->writeTotalHeader("mixture");
coolList->writeTotalHeader("mixture", Result::getCooltimeMode());

/* for each mixture */
while (ptr->next != NULL)
Expand Down
48 changes: 37 additions & 11 deletions src/OutputFormat.C
Original file line number Diff line number Diff line change
Expand Up @@ -51,14 +51,18 @@ OutputFormat::OutputFormat(int type)
strcpy(normUnits,"/cm3");
normType = 1;

cooltimeUnits = new char[5];
strcpy(cooltimeUnits,"def");
cooltimeType = 1;

gammaSrc = NULL;
contactDose = NULL;

next = NULL;
}

OutputFormat::OutputFormat(const OutputFormat& o) :
resolution(o.resolution), outTypes(o.outTypes), normType(o.normType), actMult(o.actMult)
resolution(o.resolution), outTypes(o.outTypes), normType(o.normType), actMult(o.actMult), cooltimeType(o.cooltimeType)

{
actUnits = new char[strlen(o.actUnits)+1];
Expand All @@ -67,13 +71,17 @@ OutputFormat::OutputFormat(const OutputFormat& o) :
normUnits = new char[strlen(o.normUnits)+1];
strcpy(normUnits,o.normUnits);

cooltimeUnits = new char[strlen(o.cooltimeUnits)+1];
strcpy(cooltimeUnits,o.cooltimeUnits);

next = NULL;
}

OutputFormat::~OutputFormat()
{
delete[] actUnits;
delete[] normUnits;
delete[] cooltimeUnits;
delete gammaSrc;
delete contactDose;
delete next;
Expand Down Expand Up @@ -175,7 +183,25 @@ OutputFormat* OutputFormat::getOutFmts(istream& input)
next->normType = OUTNORM_CM3;
break;
}
break;

delete[] next->cooltimeUnits;
input >> token;
next->cooltimeUnits = new char[strlen(token)+2];
Comment on lines +188 to +189
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For better or worse, this is not backwards compatible and will make old input files fail. We should discuss how important that is...

strcpy((next->cooltimeUnits)+1,token);
next->cooltimeUnits[0] = '';

switch (tolower(token[0]))
{
case 's':
next->cooltimeType = COOLTIME_S;
break;
case 'def':
default:
next->cooltimeType = COOLTIME_DEF;
break;
}
break;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think you need/want this line

Suggested change
break;


case OUTFMT_WDR:
next->outTypes |= 1<<type;
input >> token;
Expand Down Expand Up @@ -282,7 +308,7 @@ void OutputFormat::write(Volume* volList, Mixture* mixList, Loading* loadList,
/* units */
outTypeNum = 0;
cout << "\t" << Out_Types_Str[outTypeNum] << ": "
<< ptr->actUnits << " " << ptr->normUnits << endl;
<< ptr->actUnits << " " << ptr->normUnits << " " << ptr->cooltimeUnits << endl;
/* regular singular responses */
for (++outTypeNum;outTypeNum<lastSingularResponse;outTypeNum++)
if (ptr->outTypes & 1<<outTypeNum)
Expand All @@ -291,32 +317,32 @@ void OutputFormat::write(Volume* volList, Mixture* mixList, Loading* loadList,
{
case (OUTFMT_ACT):
sprintf(buffer,Out_Types_Str[outTypeNum],
ptr->actUnits,ptr->normUnits);
ptr->actUnits,ptr->normUnits,ptr->cooltimeUnits);
break;
case (OUTFMT_SRC) :
sprintf(buffer,Out_Types_Str[outTypeNum],
/* deliver gamma src filename, */
ptr->normUnits, ptr->gammaSrc->getFileName(),ptr->actUnits,ptr->normUnits);
ptr->normUnits, ptr->gammaSrc->getFileName(),ptr->actUnits,ptr->normUnits,ptr->cooltimeUnits);
break;
case (OUTFMT_CDOSE) :
sprintf(buffer,Out_Types_Str[outTypeNum],
ptr->contactDose->getFileName());
ptr->contactDose->getFileName(),ptr->cooltimeUnits);
break;
case (OUTFMT_ADJ) :
sprintf(buffer,Out_Types_Str[outTypeNum],
ptr->adjointDose->getFileName());
ptr->adjointDose->getFileName(),ptr->cooltimeUnits);
break;
case (OUTFMT_EXP) :
sprintf(buffer, Out_Types_Str[outTypeNum],
ptr->exposureDose->getFileName());
ptr->exposureDose->getFileName(),ptr->cooltimeUnits);
break;
case (OUTFMT_EXP_CYL_VOL) :
sprintf(buffer, Out_Types_Str[outTypeNum],
ptr->exposureCylVolDose->getFileName());
ptr->exposureCylVolDose->getFileName(),ptr->cooltimeUnits);
break;
default:
sprintf(buffer,Out_Types_Str[outTypeNum],
ptr->normUnits);
ptr->normUnits,ptr->cooltimeUnits);
}
cout << "\t" << buffer << endl;
}
Expand All @@ -333,7 +359,7 @@ void OutputFormat::write(Volume* volList, Mixture* mixList, Loading* loadList,
cout << endl << endl;

/* set units for activity */
Result::setNorm(ptr->actMult,ptr->normType);
Result::setNorm(ptr->actMult,ptr->normType,ptr->cooltimeType);

/* for each indicated response */
for (outTypeNum=firstResponse;outTypeNum<lastSingularResponse;outTypeNum++) {
Expand Down
8 changes: 8 additions & 0 deletions src/OutputFormat.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ class OutputFormat
/// including metric prefix) is being used for this output block.
int normType;

/// This is used to store the type of units used for the cooling times
/// in the output tables (default vs seconds)
int cooltimeType;

/// This STL set is used to store a unique list of filenames.
filenameList wdrFilenames;

Expand All @@ -55,6 +59,10 @@ class OutputFormat
/// the results are being shown in (cm3 v. m3 v. g v. kg).
char *normUnits;

/// This string is used to display cooling time units in the default (def)
/// units or in seconds (s) in the header of the output tables
char *cooltimeUnits;

/// This stores the multiplication factor for the activity units.
/** If necessary (based on actUnits), it will store the conversion
between Ci and Bq. */
Expand Down
3 changes: 3 additions & 0 deletions src/Output_def.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,7 @@
#define CM3_M3 1e-6
#define G_KG 1e-3

#define COOLTIME_DEF 1
#define COOLTIME_S 2

#endif
18 changes: 13 additions & 5 deletions src/Result.C
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ double Result::actMult = 1;
double Result::metricMult = 1;
GammaSrc* Result::gammaSrc = NULL;
char* Result::outReminderStr = NULL;
int Result::cooltime_units = COOLTIME_DEF;

/** When called with no arguments, the default constructor sets 'kza'
and 'next' to 0 and NULL, respectively. Otherwise, they are set,
Expand Down Expand Up @@ -339,7 +340,7 @@ void Result::write(int response, int targetKza, Mixture *mixPtr,
cout << outReminderStr << endl;;

/* write a standard header for this table */
coolList->writeHeader();
coolList->writeHeader(Result::getCooltimeMode());

if (response == OUTFMT_SRC)
{
Expand Down Expand Up @@ -592,21 +593,28 @@ void Result::readDump()
}
}

void Result::setNorm(double passedActMult, int normType)
int Result::getCooltimeMode()
{
return cooltime_units;
}


void Result::setNorm(double passedActMult, int normType, int cooltimeType)
{

actMult = passedActMult;

switch (normType) {
switch (normType)
{
case OUTNORM_M3:
metricMult = 1.0/CM3_M3;
break;
case OUTNORM_KG:
metricMult = 1.0/G_KG;
break;
default:
metricMult = 1;
}
cooltime_units = cooltimeType;
}
Comment on lines -608 to +617
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure this is right...

Don't we still want to make sure metricMult is set correctly in the default case? An don't we want to update cooltime_units regardless of the value of normType?


}

Expand Down
6 changes: 5 additions & 1 deletion src/Result.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ class Result
/// data is for.
int kza;

static int cooltime_units;

/// This is an array of results, one for each cooling time and at
/// shutdown.
double *N;
Expand Down Expand Up @@ -129,7 +131,9 @@ class Result

/// This function is used to set actMult from the first argument and
/// metricMult by interpretation of the second argument.
static void setNorm(double,int);
static void setNorm(double,int,int);

static int getCooltimeMode();

/// This function is used to set outReminderStr so that each table
/// makes it clear what is being written. Corresponding function to query
Expand Down
2 changes: 1 addition & 1 deletion src/Volume.C
Original file line number Diff line number Diff line change
Expand Up @@ -778,7 +778,7 @@ void Volume::write(int response, int writeComp, CoolingTime* coolList,
cout << Result::getReminderStr() << endl;

/* write header for totals */
coolList->writeTotalHeader("interval");
coolList->writeTotalHeader("interval", Result::getCooltimeMode());

/* for each interval */
while (ptr->next != NULL)
Expand Down