Skip to content

Commit 9b535ce

Browse files
authored
Removes return or error codes from TimeMgr
Removes return or error codes from TimeMgr removes the return codes from most time manager routines adds use of Error handler in TimeMgr and TimeMgrTest updates unit tests and dependent routines fixes some unused variables in TimeMgr and TimeStepper updates docs
2 parents 9b7ec71 + 1571c90 commit 9b535ce

File tree

16 files changed

+1885
-3283
lines changed

16 files changed

+1885
-3283
lines changed

components/omega/doc/devGuide/TimeMgr.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ monthly Alarm:
231231
OMEGA::TimeInterval IntervalMonthly(1, OMEGA::TimeUnits::Months);
232232
OMEGA::Alarm AlarmMonthly("Every Month", IntervalMontly, StartTime);
233233

234-
Err = ModelClock.attachAlarm(AlarmMonthly);
234+
ModelClock.attachAlarm(AlarmMonthly);
235235
```
236236
The Clock can be used to control the duration of a simulation by using a
237237
TimeInstant that represents the stop time:
@@ -241,7 +241,7 @@ OMEGA::TimeInstant CurrentTime = StartTime;
241241
242242
while (CurrentTime < StopTime) {
243243
244-
Err = ModelClock.advance();
244+
ModelClock.advance();
245245
CurrentTime = ModelClock.getCurrentTime();
246246
247247
...

components/omega/src/infra/IOStream.cpp

Lines changed: 7 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -493,13 +493,8 @@ Error IOStream::create(const std::string &StreamName, //< [in] name of stream
493493

494494
} // end if IOFreqUnits
495495
// If an alarm is set, attach it to the model clock
496-
if (HasAlarm) {
497-
int AlarmErr = ModelClock->attachAlarm(&(NewStream->MyAlarm));
498-
if (AlarmErr != 0) {
499-
ABORT_ERROR("Error attaching alarm to model clock for stream {}",
500-
StreamName);
501-
}
502-
}
496+
if (HasAlarm)
497+
ModelClock->attachAlarm(&(NewStream->MyAlarm));
503498

504499
// Check the file frequency to see if there will be multiple records or
505500
// time slices per file
@@ -559,11 +554,7 @@ Error IOStream::create(const std::string &StreamName, //< [in] name of stream
559554
// create and attach alarm
560555
std::string FileAlarmName = StreamName + "File";
561556
NewStream->FileAlarm = Alarm(FileAlarmName, FileInt, ClockStart);
562-
int AlarmErr = ModelClock->attachAlarm(&(NewStream->FileAlarm));
563-
if (AlarmErr != 0) {
564-
ABORT_ERROR("Error attaching file alarm to model clock for stream {}",
565-
StreamName);
566-
}
557+
ModelClock->attachAlarm(&(NewStream->FileAlarm));
567558

568559
// Check for
569560
} // end multiframe
@@ -594,14 +585,8 @@ Error IOStream::create(const std::string &StreamName, //< [in] name of stream
594585
std::string EndName = StreamName + "End";
595586
NewStream->StartAlarm = Alarm(StartName, Start);
596587
NewStream->EndAlarm = Alarm(EndName, End);
597-
int AlarmErr = ModelClock->attachAlarm(&(NewStream->StartAlarm));
598-
if (AlarmErr != 0)
599-
ABORT_ERROR("Error attaching start alarm to model clock for stream {}",
600-
StreamName);
601-
AlarmErr = ModelClock->attachAlarm(&(NewStream->EndAlarm));
602-
if (AlarmErr != 0)
603-
ABORT_ERROR("Error attaching end alarm to model clock for stream {}",
604-
StreamName);
588+
ModelClock->attachAlarm(&(NewStream->StartAlarm));
589+
ModelClock->attachAlarm(&(NewStream->EndAlarm));
605590
} // endif UseStartEnd
606591

607592
// Now we add the list of field names to the stream
@@ -2293,7 +2278,6 @@ int IOStream::readFieldData(
22932278
LOG_ERROR("Invalid data type while reading field {} for stream {}",
22942279
FieldName, Name);
22952280
return Fail;
2296-
break;
22972281

22982282
} // end switch data type
22992283

@@ -2513,7 +2497,7 @@ int IOStream::writeStream(
25132497
// Update the time field with elapsed time since simulation start
25142498
TimeInterval ElapsedTime = SimTime - StartTime;
25152499
R8 ElapsedTimeR8;
2516-
Err = ElapsedTime.get(ElapsedTimeR8, TimeUnits::Seconds);
2500+
ElapsedTime.get(ElapsedTimeR8, TimeUnits::Seconds);
25172501
HostArray1DR8 OutTime("OutTime", 1);
25182502
OutTime(0) = ElapsedTimeR8;
25192503
Err = Field::attachFieldData("time", OutTime);
@@ -2846,11 +2830,7 @@ std::string IOStream::buildFilename(
28462830
I8 ISecW;
28472831
I8 ISecN;
28482832
I8 ISecD;
2849-
int Err =
2850-
FileTime.get(IYear, IMonth, IDay, IHour, IMin, ISecW, ISecN, ISecD);
2851-
if (Err != 0) {
2852-
LOG_ERROR("Error getting components of simulation time for filename");
2853-
}
2833+
FileTime.get(IYear, IMonth, IDay, IHour, IMin, ISecW, ISecN, ISecD);
28542834

28552835
// Convert these to strings (will pad with zeros if needed later)
28562836
std::string SYear = std::to_string(IYear);

0 commit comments

Comments
 (0)