Skip to content

Commit fd27853

Browse files
committed
VelocityWave() method added to StopwatchSagger.
- Just exposed read-only access to a private class member. The information would be good to know.
1 parent d850464 commit fd27853

3 files changed

Lines changed: 21 additions & 0 deletions

File tree

include/models/sagging/stopwatch_sagger.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,10 @@ class StopwatchSagger {
3737
bool Validate(const bool& is_included_warnings = true,
3838
std::list<ErrorMessage>* messages = nullptr) const;
3939

40+
/// \brief Gets the traveling wave velocity.
41+
/// \return The traveling wave velocity.
42+
double VelocityWave() const;
43+
4044
/// \brief Gets the catenary.
4145
/// \return The catenary.
4246
Catenary3d catenary() const;

src/sagging/stopwatch_sagger.cc

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,15 @@ bool StopwatchSagger::Validate(const bool& is_included_warnings,
4242
return is_valid;
4343
}
4444

45+
double StopwatchSagger::VelocityWave() const {
46+
// updates class if necessary
47+
if ((IsUpdated() == false) && (Update() == false)) {
48+
return -999999;
49+
}
50+
51+
return velocity_wave_;
52+
}
53+
4554
Catenary3d StopwatchSagger::catenary() const {
4655
return catenary_;
4756
}

test/sagging/stopwatch_sagger_test.cc

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,3 +51,11 @@ TEST_F(StopwatchSaggerTest, TimeReturn) {
5151
TEST_F(StopwatchSaggerTest, Validate) {
5252
EXPECT_TRUE(s_.Validate(true, nullptr));
5353
}
54+
55+
TEST_F(StopwatchSaggerTest, VelocityWave) {
56+
double value = -999999;
57+
58+
// checks wave velocity
59+
value = s_.VelocityWave();
60+
EXPECT_EQ(401.1, helper::Round(value, 1));
61+
}

0 commit comments

Comments
 (0)