GCC Code Coverage Report


Directory: ./
Coverage: low: ≥ 0% medium: ≥ 75.0% high: ≥ 90.0%
Coverage Exec / Excl / Total
Lines: 73.8% 31 / 0 / 42
Functions: 76.5% 13 / 0 / 17
Branches: 57.6% 19 / 0 / 33

src/model/Material.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 "Material.hpp"
7 #include "Material_Impl.hpp"
8 #include "StandardsInformationMaterial.hpp"
9 #include "StandardsInformationMaterial_Impl.hpp"
10
11 #include "Model.hpp"
12 #include "Model_Impl.hpp"
13
14 #include "../utilities/core/Assert.hpp"
15
16 namespace openstudio {
17 namespace model {
18
19 namespace detail {
20
21 4628 Material_Impl::Material_Impl(const IdfObject& idfObject, Model_Impl* model, bool keepHandle)
22 4628 : ResourceObject_Impl(idfObject, model, keepHandle) {}
23
24 1088 Material_Impl::Material_Impl(const openstudio::detail::WorkspaceObject_Impl& other, Model_Impl* model, bool keepHandle)
25 1088 : ResourceObject_Impl(other, model, keepHandle) {}
26
27 2307 Material_Impl::Material_Impl(const Material_Impl& other, Model_Impl* model, bool keepHandle) : ResourceObject_Impl(other, model, keepHandle) {}
28
29 287 std::vector<ModelObject> Material_Impl::children() const {
30
3/3
✓ Branch 1 taken 287 times.
✓ Branch 4 taken 287 times.
✓ Branch 7 taken 287 times.
287 std::vector<ModelObject> results(castVector<ModelObject>(getObject<Material>().getModelObjectSources<StandardsInformationMaterial>()));
31
32 287 return results;
33 }
34
35 ✗ double Material_Impl::thickness() const {
36 ✗ return 0.0;
37 }
38
39 ✗ boost::optional<double> Material_Impl::interiorVisibleAbsorptance() const {
40 ✗ return boost::none;
41 }
42
43 ✗ boost::optional<double> Material_Impl::exteriorVisibleAbsorptance() const {
44 ✗ return boost::none;
45 }
46
47 ✗ bool Material_Impl::setThickness(double /*value*/) {
48 ✗ return false;
49 }
50
51 19 StandardsInformationMaterial Material_Impl::standardsInformation() const {
52
2/2
✓ Branch 1 taken 19 times.
✓ Branch 4 taken 19 times.
19 StandardsInformationMaterialVector candidates = getObject<Material>().getModelObjectSources<StandardsInformationMaterial>();
53
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 19 times.
19 if (candidates.size() > 1) {
54 ✗ for (unsigned i = 1, n = candidates.size(); i < n; ++i) {
55 ✗ candidates[i].remove();
56 }
57 ✗ LOG(Warn, "Removed extraneous StandardsInformationMaterial objects pointing to " << briefDescription() << ".");
58 }
59
2/2
✓ Branch 1 taken 1 time.
✓ Branch 2 taken 18 times.
19 if (candidates.size() == 1) {
60
1/1
✓ Branch 2 taken 1 time.
1 return candidates[0];
61 }
62
2/2
✓ Branch 1 taken 18 times.
✓ Branch 4 taken 18 times.
18 return StandardsInformationMaterial(getObject<Material>());
63 19 }
64
65 } // namespace detail
66
67 3519 Material::Material(IddObjectType type, const Model& model) : ResourceObject(type, model) {
68
1/3
✗ Branch 2 not taken.
✓ Branch 3 taken 3519 times.
✗ Branch 5 not taken.
3519 OS_ASSERT(getImpl<detail::Material_Impl>());
69 3519 }
70
71 45 double Material::thickness() const {
72
1/1
✓ Branch 3 taken 45 times.
45 return getImpl<detail::Material_Impl>()->thickness();
73 }
74
75 6 OptionalDouble Material::getVisibleTransmittance() const {
76
1/1
✓ Branch 3 taken 6 times.
6 return getImpl<detail::Material_Impl>()->getVisibleTransmittance();
77 }
78
79 105 boost::optional<double> Material::interiorVisibleAbsorptance() const {
80
1/1
✓ Branch 3 taken 105 times.
105 return getImpl<detail::Material_Impl>()->interiorVisibleAbsorptance();
81 }
82
83 105 boost::optional<double> Material::exteriorVisibleAbsorptance() const {
84
1/1
✓ Branch 3 taken 105 times.
105 return getImpl<detail::Material_Impl>()->exteriorVisibleAbsorptance();
85 }
86
87 448 bool Material::setThickness(double value) {
88
1/1
✓ Branch 3 taken 448 times.
448 return getImpl<detail::Material_Impl>()->setThickness(value);
89 }
90
91 19 StandardsInformationMaterial Material::standardsInformation() const {
92
1/1
✓ Branch 3 taken 19 times.
19 return getImpl<detail::Material_Impl>()->standardsInformation();
93 }
94
95 /// @cond
96
1/1
✓ Branch 3 taken 43777 times.
43777 Material::Material(std::shared_ptr<detail::Material_Impl> impl) : ResourceObject(std::move(impl)) {}
97 /// @endcond
98
99 } // namespace model
100 } // namespace openstudio
101