Skip to content

Commit

Permalink
Tests for all four directions added.
Browse files Browse the repository at this point in the history
  • Loading branch information
vidanovic committed Nov 7, 2024
1 parent f26b91b commit dbec8f5
Show file tree
Hide file tree
Showing 40 changed files with 1,591 additions and 90 deletions.
12 changes: 6 additions & 6 deletions src/SingleLayerOptics/src/VenetianCellDescription.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -150,12 +150,13 @@ namespace SingleLayerOptics
const CBeamDirection & t_Direction)
{
// clang-format off
const auto bvf{cellBeamViewFactors(t_Side, t_Direction)};
return Helper::visibleSegmentPercentage(
beamViewFactorsToBeamSegmentViews(
numberOfSegments(),
t_Side,
t_Direction,
cellBeamViewFactors(t_Side, t_Direction))
bvf)
);
// clang-format on
}
Expand Down Expand Up @@ -198,17 +199,16 @@ namespace SingleLayerOptics
CVenetianCellDescription::cellBeamViewFactors(double t_ProfileAngle,
FenestrationCommon::Side t_Side)
{
return m_BeamGeometry.beamViewFactors(-t_ProfileAngle, t_Side);
const auto profileAngle{t_Side == FenestrationCommon::Side::Front ? t_ProfileAngle
: -t_ProfileAngle};
return m_BeamGeometry.beamViewFactors(-profileAngle, t_Side);
}

std::vector<Viewer::BeamViewFactor>
CVenetianCellDescription::cellBeamViewFactors(FenestrationCommon::Side t_Side,
const CBeamDirection & t_Direction)
{
return cellBeamViewFactors(t_Side == FenestrationCommon::Side::Front
? t_Direction.profileAngle()
: -t_Direction.profileAngle(),
t_Side);
return cellBeamViewFactors(t_Direction.profileAngle(), t_Side);
}

double CVenetianCellDescription::T_dir_dir(const FenestrationCommon::Side t_Side,
Expand Down

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,13 @@

#include "WCEViewer.hpp"
#include "WCESingleLayerOptics.hpp"
#include "WCECommon.hpp"


using namespace SingleLayerOptics;
using namespace Viewer;
using namespace FenestrationCommon;

class TestVenetianCellDescriptionFlat45 : public testing::Test
class TestVenetianCellDescriptionFlat45_1 : public testing::Test
{
private:
std::shared_ptr<CVenetianCellDescription> m_Cell;
Expand Down Expand Up @@ -39,7 +38,7 @@ class TestVenetianCellDescriptionFlat45 : public testing::Test
// size_t numOfSlats() { return m_NumOfSlats; };
};

TEST_F(TestVenetianCellDescriptionFlat45, TestVenetian1)
TEST_F(TestVenetianCellDescriptionFlat45_1, TestVenetian1)
{
SCOPED_TRACE("Begin Test: Venetian cell (Flat, 45 degrees slats) - View Factors.");

Expand All @@ -66,7 +65,7 @@ TEST_F(TestVenetianCellDescriptionFlat45, TestVenetian1)
}
}

TEST_F(TestVenetianCellDescriptionFlat45, TestVenetian2)
TEST_F(TestVenetianCellDescriptionFlat45_1, TestVenetian2)
{
SCOPED_TRACE(
"Begin Test: Venetian cell (Flat, 45 degrees slats) - Direct-direct component (0, 0).");
Expand All @@ -80,7 +79,7 @@ TEST_F(TestVenetianCellDescriptionFlat45, TestVenetian2)
EXPECT_NEAR(0, Tdir_dir, 1e-6);
}

TEST_F(TestVenetianCellDescriptionFlat45, TestVenetian3)
TEST_F(TestVenetianCellDescriptionFlat45_1, TestVenetian3)
{
SCOPED_TRACE(
"Begin Test: Venetian cell (Flat, 45 degrees slats) - Direct-direct component (45, 90).");
Expand All @@ -94,7 +93,7 @@ TEST_F(TestVenetianCellDescriptionFlat45, TestVenetian3)
EXPECT_NEAR(1, Tdir_dir, 1e-6);
}

TEST_F(TestVenetianCellDescriptionFlat45, TestVenetian4)
TEST_F(TestVenetianCellDescriptionFlat45_1, TestVenetian4)
{
SCOPED_TRACE(
"Begin Test: Venetian cell (Flat, 45 degrees slats) - Direct-direct component (76.5, 90).");
Expand All @@ -108,7 +107,7 @@ TEST_F(TestVenetianCellDescriptionFlat45, TestVenetian4)
EXPECT_NEAR(0, Tdir_dir, 1e-6);
}

TEST_F(TestVenetianCellDescriptionFlat45, TestVenetian5)
TEST_F(TestVenetianCellDescriptionFlat45_1, TestVenetian5)
{
SCOPED_TRACE(
"Begin Test: Venetian cell (Flat, 45 degrees slats) - Direct-direct component (76.5, 45).");
Expand All @@ -122,7 +121,7 @@ TEST_F(TestVenetianCellDescriptionFlat45, TestVenetian5)
EXPECT_NEAR(0, Tdir_dir, 1e-6);
}

TEST_F(TestVenetianCellDescriptionFlat45, TestVenetian6)
TEST_F(TestVenetianCellDescriptionFlat45_1, TestVenetian6)
{
SCOPED_TRACE(
"Begin Test: Venetian cell (Flat, 45 degrees slats) - Direct-direct component (54, 90).");
Expand All @@ -136,7 +135,7 @@ TEST_F(TestVenetianCellDescriptionFlat45, TestVenetian6)
EXPECT_NEAR(0.46771558343367653, Tdir_dir, 1e-6);
}

TEST_F(TestVenetianCellDescriptionFlat45, TestVenetian7)
TEST_F(TestVenetianCellDescriptionFlat45_1, TestVenetian7)
{
SCOPED_TRACE(
"Begin Test: Venetian cell (Flat, 45 degrees slats) - Direct-direct component (54, 60).");
Expand All @@ -150,7 +149,7 @@ TEST_F(TestVenetianCellDescriptionFlat45, TestVenetian7)
EXPECT_NEAR(0.72849686418372972, Tdir_dir, 1e-6);
}

TEST_F(TestVenetianCellDescriptionFlat45, TestVenetian8)
TEST_F(TestVenetianCellDescriptionFlat45_1, TestVenetian8)
{
SCOPED_TRACE(
"Begin Test: Venetian cell (Flat, 45 degrees slats) - Direct-direct component (36, 90).");
Expand All @@ -164,7 +163,7 @@ TEST_F(TestVenetianCellDescriptionFlat45, TestVenetian8)
EXPECT_NEAR(0.61327273437110064, Tdir_dir, 1e-6);
}

TEST_F(TestVenetianCellDescriptionFlat45, TestVenetian9)
TEST_F(TestVenetianCellDescriptionFlat45_1, TestVenetian9)
{
SCOPED_TRACE(
"Begin Test: Venetian cell (Flat, 45 degrees slats) - Direct-direct component (54, 30).");
Expand All @@ -178,7 +177,7 @@ TEST_F(TestVenetianCellDescriptionFlat45, TestVenetian9)
EXPECT_NEAR(0.55903542711488330, Tdir_dir, 1e-6);
}

TEST_F(TestVenetianCellDescriptionFlat45, TestVenetian10)
TEST_F(TestVenetianCellDescriptionFlat45_1, TestVenetian10)
{
SCOPED_TRACE(
"Begin Test: Venetian cell (Flat, 45 degrees slats) - Direct-direct component (36, 60).");
Expand All @@ -192,7 +191,7 @@ TEST_F(TestVenetianCellDescriptionFlat45, TestVenetian10)
EXPECT_NEAR(0.47561567265428234, Tdir_dir, 1e-6);
}

TEST_F(TestVenetianCellDescriptionFlat45, TestVenetian11)
TEST_F(TestVenetianCellDescriptionFlat45_1, TestVenetian11)
{
SCOPED_TRACE(
"Begin Test: Venetian cell (Flat, 45 degrees slats) - Direct-direct component (36, 30).");
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
#include <memory>
#include <gtest/gtest.h>

#include <WCESingleLayerOptics.hpp>


SingleLayerOptics::CVenetianCellDescription createCellDescription()
{
const auto slatWidth = 0.016; // m
const auto slatSpacing = 0.012; // m
const auto slatTiltAngle = 45;
const auto curvatureRadius = 0;
FenestrationCommon::VenetianGeometry geometry{
slatWidth, slatSpacing, slatTiltAngle, curvatureRadius};
const size_t numOfSlatSegments = 1;

return {geometry, numOfSlatSegments};
}

TEST(TestVenetianCellFlat0_5, BeamViewFactorsFront)
{
auto aCell{createCellDescription()};

const auto vfs{aCell.cellBeamViewFactors(18, FenestrationCommon::Side::Front)};

EXPECT_EQ(1u, vfs.size());

EXPECT_EQ(1u, vfs[0].enclosureIndex);
EXPECT_EQ(0u, vfs[0].segmentIndex);
EXPECT_NEAR(1.0, vfs[0].value, 1e-6);
EXPECT_NEAR(0.800547, vfs[0].percentHit, 1e-6);
}

TEST(TestVenetianCellFlat0_5, BeamViewFactorsBack)
{
auto aCell{createCellDescription()};

const auto vfs{aCell.cellBeamViewFactors(-18, FenestrationCommon::Side::Back)};

EXPECT_EQ(1u, vfs.size());

EXPECT_EQ(0u, vfs[0].enclosureIndex);
EXPECT_EQ(0u, vfs[0].segmentIndex);
EXPECT_NEAR(1.0, vfs[0].value, 1e-6);
EXPECT_NEAR(0.800547, vfs[0].percentHit, 1e-6);
}
Loading

0 comments on commit dbec8f5

Please sign in to comment.