-
Notifications
You must be signed in to change notification settings - Fork 24
Add option to convert cooling times in output file to seconds #148
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
1df072d
81d5d7f
a53e8ea
55c8258
bb93e50
a7228d1
9b4edba
9370056
182e487
266d1f4
5994579
4bc23ae
b142877
bbc962a
ef89289
8fec07e
6eba7c6
3d950f2
20dab87
717b0e5
598b1fb
cce2f7e
582f8b0
32fea30
5da0c69
ba06de0
73212f2
257c8d8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,6 +2,7 @@ | |
| #include "alara.h" | ||
| #include <vector> | ||
| #include <string> | ||
| #include "Output_def.h" | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 | ||
|
|
@@ -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. | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||
|---|---|---|---|---|
|
|
@@ -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]; | ||||
|
|
@@ -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; | ||||
|
|
@@ -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
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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; | ||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think you need/want this line
Suggested change
|
||||
|
|
||||
| case OUTFMT_WDR: | ||||
| next->outTypes |= 1<<type; | ||||
| input >> token; | ||||
|
|
@@ -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) | ||||
|
|
@@ -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; | ||||
| } | ||||
|
|
@@ -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++) { | ||||
|
|
||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -31,4 +31,7 @@ | |
| #define CM3_M3 1e-6 | ||
| #define G_KG 1e-3 | ||
|
|
||
| #define COOLTIME_DEF 1 | ||
| #define COOLTIME_S 2 | ||
|
|
||
| #endif | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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, | ||
|
|
@@ -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) | ||
| { | ||
|
|
@@ -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
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 |
||
|
|
||
| } | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe a short function
That does this to ensure consistency across different places we do this (currently only two)