src/model/WeatherFileDays.cpp
| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | /*********************************************************************************************************************** | ||
| 2 | * OpenStudio(R), Copyright (c) Alliance for Energy Innovation, LLC. | ||
| 3 | * See also https://openstudio.net/license | ||
| 4 | ***********************************************************************************************************************/ | ||
| 5 | |||
| 6 | #include "WeatherFileDays.hpp" | ||
| 7 | #include "WeatherFileDays_Impl.hpp" | ||
| 8 | #include "Site.hpp" | ||
| 9 | #include "Site_Impl.hpp" | ||
| 10 | |||
| 11 | #include <utilities/idd/OS_SizingPeriod_WeatherFileDays_FieldEnums.hxx> | ||
| 12 | #include <utilities/idd/IddEnums.hxx> | ||
| 13 | |||
| 14 | #include "../utilities/core/Assert.hpp" | ||
| 15 | |||
| 16 | namespace openstudio { | ||
| 17 | namespace model { | ||
| 18 | |||
| 19 | namespace detail { | ||
| 20 | |||
| 21 | 3 | WeatherFileDays_Impl::WeatherFileDays_Impl(const IdfObject& idfObject, Model_Impl* model, bool keepHandle) | |
| 22 | 3 | : SizingPeriod_Impl(idfObject, model, keepHandle) { | |
| 23 |
4/6✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
✓ Branch 7 taken 3 times.
✗ Branch 10 not taken.
✓ Branch 11 taken 3 times.
✗ Branch 13 not taken.
|
3 | OS_ASSERT(idfObject.iddObject().type() == WeatherFileDays::iddObjectType()); |
| 24 | 3 | } | |
| 25 | |||
| 26 | ✗ | WeatherFileDays_Impl::WeatherFileDays_Impl(const openstudio::detail::WorkspaceObject_Impl& other, Model_Impl* model, bool keepHandle) | |
| 27 | ✗ | : SizingPeriod_Impl(other, model, keepHandle) { | |
| 28 | ✗ | OS_ASSERT(other.iddObject().type() == WeatherFileDays::iddObjectType()); | |
| 29 | ✗ | } | |
| 30 | |||
| 31 | ✗ | WeatherFileDays_Impl::WeatherFileDays_Impl(const WeatherFileDays_Impl& other, Model_Impl* model, bool keepHandle) | |
| 32 | ✗ | : SizingPeriod_Impl(other, model, keepHandle) {} | |
| 33 | |||
| 34 | // Get all output variable names that could be associated with this object. | ||
| 35 | ✗ | const std::vector<std::string>& WeatherFileDays_Impl::outputVariableNames() const { | |
| 36 | ✗ | static const std::vector<std::string> result; | |
| 37 | ✗ | return result; | |
| 38 | } | ||
| 39 | |||
| 40 | ✗ | IddObjectType WeatherFileDays_Impl::iddObjectType() const { | |
| 41 | ✗ | return WeatherFileDays::iddObjectType(); | |
| 42 | } | ||
| 43 | |||
| 44 | ✗ | void WeatherFileDays_Impl::ensureNoLeapDays() { | |
| 45 | ✗ | boost::optional<int> month; | |
| 46 | ✗ | boost::optional<int> day; | |
| 47 | |||
| 48 | ✗ | month = getInt(OS_SizingPeriod_WeatherFileDaysFields::BeginMonth); | |
| 49 | ✗ | if (month && (month.get() == 2)) { | |
| 50 | ✗ | day = this->getInt(OS_SizingPeriod_WeatherFileDaysFields::BeginDayofMonth); | |
| 51 | ✗ | if (day && (day.get() == 29)) { | |
| 52 | ✗ | this->setInt(OS_SizingPeriod_WeatherFileDaysFields::BeginDayofMonth, 28); | |
| 53 | } | ||
| 54 | } | ||
| 55 | |||
| 56 | ✗ | month = getInt(OS_SizingPeriod_WeatherFileDaysFields::EndMonth); | |
| 57 | ✗ | if (month && (month.get() == 2)) { | |
| 58 | ✗ | day = this->getInt(OS_SizingPeriod_WeatherFileDaysFields::EndDayofMonth); | |
| 59 | ✗ | if (day && (day.get() == 29)) { | |
| 60 | ✗ | this->setInt(OS_SizingPeriod_WeatherFileDaysFields::EndDayofMonth, 28); | |
| 61 | } | ||
| 62 | } | ||
| 63 | ✗ | } | |
| 64 | |||
| 65 | } // namespace detail | ||
| 66 | |||
| 67 | /// constructor | ||
| 68 | 3 | WeatherFileDays::WeatherFileDays(const Model& model) : SizingPeriod(WeatherFileDays::iddObjectType(), model) { | |
| 69 |
1/3✗ Branch 2 not taken.
✓ Branch 3 taken 3 times.
✗ Branch 5 not taken.
|
3 | OS_ASSERT(getImpl<detail::WeatherFileDays_Impl>()); |
| 70 | 3 | } | |
| 71 | |||
| 72 | // constructor | ||
| 73 | ✗ | WeatherFileDays::WeatherFileDays(std::shared_ptr<detail::WeatherFileDays_Impl> impl) : SizingPeriod(std::move(impl)) {} | |
| 74 | |||
| 75 | 7605 | IddObjectType WeatherFileDays::iddObjectType() { | |
| 76 |
1/1✓ Branch 1 taken 7605 times.
|
7605 | IddObjectType result(IddObjectType::OS_SizingPeriod_WeatherFileDays); |
| 77 | 7605 | return result; | |
| 78 | } | ||
| 79 | |||
| 80 | } // namespace model | ||
| 81 | } // namespace openstudio | ||
| 82 |