Commit 20a4f41f authored by Chuanren Wu's avatar Chuanren Wu

declear the discretize interface

parent e537c025
...@@ -21,3 +21,5 @@ std::vector<int> discretizeImpl( ...@@ -21,3 +21,5 @@ std::vector<int> discretizeImpl(
const std::vector<double> &vl, const std::vector<double> &vl,
const std::vector<Constraint> &vc const std::vector<Constraint> &vc
); );
#define discretize discretizeImpl
...@@ -18,7 +18,7 @@ TEST(BC, SimpleLine1) ...@@ -18,7 +18,7 @@ TEST(BC, SimpleLine1)
std::vector<double> vl(2); std::vector<double> vl(2);
std::generate(vl.begin(), vl.end(), [](){ return 10.0;} ); std::generate(vl.begin(), vl.end(), [](){ return 10.0;} );
auto v = discretizeImpl(vl, cs); auto v = discretize(vl, cs);
ASSERT_NE(0, v.size()); ASSERT_NE(0, v.size());
EXPECT_LE(10, v[0]); EXPECT_LE(10, v[0]);
EXPECT_LE(10, v[1]); EXPECT_LE(10, v[1]);
...@@ -45,7 +45,7 @@ TEST(BC, SimpleLine2) ...@@ -45,7 +45,7 @@ TEST(BC, SimpleLine2)
std::vector<double> vl(4); std::vector<double> vl(4);
std::generate(vl.begin(), vl.end(), [](){ return 10.0;} ); std::generate(vl.begin(), vl.end(), [](){ return 10.0;} );
auto v = discretizeImpl(vl, cs); auto v = discretize(vl, cs);
ASSERT_NE(0, v.size()); ASSERT_NE(0, v.size());
EXPECT_LE(10, v[0]); EXPECT_LE(10, v[0]);
EXPECT_LE(10, v[1]); EXPECT_LE(10, v[1]);
...@@ -73,7 +73,7 @@ TEST(BC, SingleSegment1) ...@@ -73,7 +73,7 @@ TEST(BC, SingleSegment1)
std::vector<double> vl(4); std::vector<double> vl(4);
std::generate(vl.begin(), vl.end(), [](){ return 10.0;} ); std::generate(vl.begin(), vl.end(), [](){ return 10.0;} );
auto v = discretizeImpl(vl, cs); auto v = discretize(vl, cs);
ASSERT_NE(0, v.size()); ASSERT_NE(0, v.size());
EXPECT_LE(10, v[0]); EXPECT_LE(10, v[0]);
EXPECT_LE(10, v[1]); EXPECT_LE(10, v[1]);
...@@ -106,7 +106,7 @@ TEST(BC, SingleSegment2) ...@@ -106,7 +106,7 @@ TEST(BC, SingleSegment2)
vl.push_back(1000); vl.push_back(1000);
vl.push_back(10000); vl.push_back(10000);
auto v = discretizeImpl(vl, cs); auto v = discretize(vl, cs);
ASSERT_NE(0, v.size()); ASSERT_NE(0, v.size());
EXPECT_LE(10, v[0]); EXPECT_LE(10, v[0]);
EXPECT_LE(100, v[1]); EXPECT_LE(100, v[1]);
...@@ -139,7 +139,7 @@ TEST(BC, SingleSegment3) ...@@ -139,7 +139,7 @@ TEST(BC, SingleSegment3)
vl.push_back(1); vl.push_back(1);
vl.push_back(2); vl.push_back(2);
auto v = discretizeImpl(vl, cs); auto v = discretize(vl, cs);
ASSERT_NE(0, v.size()); ASSERT_NE(0, v.size());
EXPECT_LE(1, v[0]); EXPECT_LE(1, v[0]);
EXPECT_LE(1, v[1]); EXPECT_LE(1, v[1]);
...@@ -167,7 +167,7 @@ TEST(BC, SingleSegment4) ...@@ -167,7 +167,7 @@ TEST(BC, SingleSegment4)
for (vl[1] = 1; vl[1] <= 5; ++vl[1]) { for (vl[1] = 1; vl[1] <= 5; ++vl[1]) {
for (vl[2] = 1; vl[2] <= 5; ++vl[2]) { for (vl[2] = 1; vl[2] <= 5; ++vl[2]) {
for (vl[3] = 1; vl[3] <= 5; ++vl[3]) { for (vl[3] = 1; vl[3] <= 5; ++vl[3]) {
auto v = discretizeImpl(vl, cs); auto v = discretize(vl, cs);
ASSERT_EQ(4, v.size()) ASSERT_EQ(4, v.size())
<< "With equation: " << "With equation: "
<< vl[0] << " + " << vl[1] << " = " << vl[0] << " + " << vl[1] << " = "
...@@ -234,7 +234,7 @@ TEST(BC, TwoSegments1) ...@@ -234,7 +234,7 @@ TEST(BC, TwoSegments1)
vl.push_back(1); vl.push_back(1);
vl.push_back(7); vl.push_back(7);
auto v = discretizeImpl(vl, cs); auto v = discretize(vl, cs);
ASSERT_NE(0, v.size()); ASSERT_NE(0, v.size());
EXPECT_LE(1, v[0]); EXPECT_LE(1, v[0]);
EXPECT_LE(2, v[1]); EXPECT_LE(2, v[1]);
...@@ -308,7 +308,7 @@ TEST(BC, ThreeSegment1) ...@@ -308,7 +308,7 @@ TEST(BC, ThreeSegment1)
std::vector<double> vl(12); std::vector<double> vl(12);
std::generate(vl.begin(), vl.end(), [](){ return 100.0;} ); std::generate(vl.begin(), vl.end(), [](){ return 100.0;} );
auto v = discretizeImpl(vl, cs); auto v = discretize(vl, cs);
ASSERT_NE(0, v.size()); ASSERT_NE(0, v.size());
for (int i = 0; i < 12; ++i) { for (int i = 0; i < 12; ++i) {
EXPECT_LE(10, v[i]) << "on edge " << i; EXPECT_LE(10, v[i]) << "on edge " << i;
...@@ -354,7 +354,7 @@ TEST(BC, Loop1) ...@@ -354,7 +354,7 @@ TEST(BC, Loop1)
std::vector<double> vl = {10, 50, 30, 20}; std::vector<double> vl = {10, 50, 30, 20};
auto v = discretizeImpl(vl, cs); auto v = discretize(vl, cs);
ASSERT_NE(0, v.size()); ASSERT_NE(0, v.size());
EXPECT_LE(10, v[0]); EXPECT_LE(10, v[0]);
EXPECT_LE(10, v[1]); EXPECT_LE(10, v[1]);
...@@ -389,7 +389,7 @@ TEST(BC, Loop2) ...@@ -389,7 +389,7 @@ TEST(BC, Loop2)
std::vector<double> vl = {10, 50, 30, 20}; std::vector<double> vl = {10, 50, 30, 20};
auto v = discretizeImpl(vl, cs); auto v = discretize(vl, cs);
ASSERT_NE(0, v.size()); ASSERT_NE(0, v.size());
EXPECT_LE(10, v[0]); EXPECT_LE(10, v[0]);
EXPECT_LE(10, v[1]); EXPECT_LE(10, v[1]);
...@@ -423,7 +423,7 @@ TEST(BC, LoopFailed1) ...@@ -423,7 +423,7 @@ TEST(BC, LoopFailed1)
std::vector<double> vl = {10, 50, 30, 20}; std::vector<double> vl = {10, 50, 30, 20};
auto v = discretizeImpl(vl, cs); auto v = discretize(vl, cs);
EXPECT_EQ(0, v.size()); EXPECT_EQ(0, v.size());
} }
...@@ -463,7 +463,7 @@ TEST(BC, Combinations1) ...@@ -463,7 +463,7 @@ TEST(BC, Combinations1)
std::vector<double> vl(10); std::vector<double> vl(10);
std::generate(vl.begin(), vl.end(), [](){ return 100.0;} ); std::generate(vl.begin(), vl.end(), [](){ return 100.0;} );
auto v = discretizeImpl(vl, cs); auto v = discretize(vl, cs);
ASSERT_NE(0, v.size()); ASSERT_NE(0, v.size());
} }
...@@ -1463,6 +1463,6 @@ TEST(BC, ComplexSystem) ...@@ -1463,6 +1463,6 @@ TEST(BC, ComplexSystem)
// std::vector<double> vl(466); // std::vector<double> vl(466);
// std::generate(vl.begin(), vl.end(), [](){ return 1000.0;} ); // std::generate(vl.begin(), vl.end(), [](){ return 1000.0;} );
auto v = discretizeImpl(vl, cs); auto v = discretize(vl, cs);
ASSERT_NE(0, v.size()); ASSERT_NE(0, v.size());
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment