Skip to content

Commit 362ae2e

Browse files
committed
clean up tests
1 parent 7e2d0e3 commit 362ae2e

3 files changed

Lines changed: 19 additions & 2 deletions

File tree

components/omega/src/ocn/Tendencies.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,15 @@ Tendencies *Tendencies::get(const std::string &Name ///< [in] Name of tendencies
137137

138138
} // end get tendencies
139139

140+
//------------------------------------------------------------------------------
141+
// Check if tendencies exists by name
142+
bool Tendencies::exists(const std::string &Name ///< [in] Name of tendencies
143+
) {
144+
145+
return AllTendencies.find(Name) != AllTendencies.end();
146+
147+
} // end exists
148+
140149
//------------------------------------------------------------------------------
141150
// read and set config options
142151
void Tendencies::readConfig(Config *OmegaConfig ///< [in] Omega config

components/omega/src/ocn/Tendencies.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,10 @@ class Tendencies {
154154
static Tendencies *get(const std::string &Name ///< [in]
155155
);
156156

157+
// check if tendencies exists by name
158+
static bool exists(const std::string &Name ///< [in]
159+
);
160+
157161
// read and set config options
158162
void readConfig(Config *OmegaConfig);
159163

components/omega/src/ocn/forcingVars/SfcStressForcingVars.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,12 @@ void SfcStressForcingVars::registerFields(
6161
}
6262

6363
void SfcStressForcingVars::unregisterFields() const {
64-
Field::destroy(ZonalStressCell.label());
65-
Field::destroy(MeridStressCell.label());
64+
if (Field::exists(ZonalStressCell.label())) {
65+
Field::destroy(ZonalStressCell.label());
66+
}
67+
if (Field::exists(MeridStressCell.label())) {
68+
Field::destroy(MeridStressCell.label());
69+
}
6670
}
6771

6872
} // namespace OMEGA

0 commit comments

Comments
 (0)