Skip to content

Commit

Permalink
Merge branch 'master' into coverage-monitor
Browse files Browse the repository at this point in the history
  • Loading branch information
mx-nlte committed Feb 14, 2024
2 parents 43c7e24 + e292c29 commit edac632
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 6 deletions.
17 changes: 16 additions & 1 deletion tests/test_Bernstein.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ int main() {

Eigen::Map<Eigen::MatrixXd> coefs_vector(coefs, 1, P + 1);

for (int p = 0; p < Bembel::Constants::MaxP; ++p) {
for (int p = 0; p <= Bembel::Constants::MaxP; ++p) {
for (auto x : Test::Constants::eq_points) {
double result1 = Basis::ShapeFunctionHandler::evalCoef(p, coefs, x);

Expand All @@ -40,6 +40,21 @@ int main() {
}
}

// Now, we do the same for the derivatives
for (int p = 1; p <= Bembel::Constants::MaxP; ++p) {
for (auto x : Test::Constants::eq_points) {
double result1 = Basis::ShapeFunctionHandler::evalDerCoef(p, coefs, x);

std::vector<double> v = {x};
double result2 =
Spl::DeBoorDer(Eigen::MatrixXd(coefs_vector.leftCols(p + 1)),
Spl::MakeBezierKnotVector(p + 1), v)(0);

BEMBEL_TEST_IF(std::abs(result1 - result2) <
Test::Constants::coefficient_accuracy);
}
}

delete[] coefs;
return 0;
}
10 changes: 5 additions & 5 deletions tests/test_Spline.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ int main() {
using namespace Bembel;

// We test the Bernstein Basis of the BasisHandler against the deBoor code
for (int p = 0; p < Bembel::Constants::MaxP; ++p) {
for (int p = 0; p <= Bembel::Constants::MaxP; ++p) {
for (auto x : Test::Constants::eq_points) {
Eigen::VectorXd result1 = Eigen::VectorXd::Zero(p + 1);
Eigen::VectorXcd result1_complex = Eigen::VectorXcd::Zero(p + 1);
Expand All @@ -40,7 +40,7 @@ int main() {
}

// Now, we do the same for the derivatives
for (int p = 1; p < Bembel::Constants::MaxP; ++p) {
for (int p = 1; p <= Bembel::Constants::MaxP; ++p) {
for (auto x : Test::Constants::eq_points) {
Eigen::VectorXd result1 = Eigen::VectorXd::Zero(p + 1);
Eigen::VectorXcd result1_complex = Eigen::VectorXcd::Zero(p + 1);
Expand All @@ -66,7 +66,7 @@ int main() {

// We test the tensor product Bernstein Basis of the BasisHandler against the
// deBoor code
for (int p = 0; p < Bembel::Constants::MaxP; ++p) {
for (int p = 0; p <= Bembel::Constants::MaxP; ++p) {
for (auto x : Test::Constants::eq_points)
for (auto y : Test::Constants::eq_points) {
Eigen::VectorXd result1 = Eigen::VectorXd::Zero((p + 1) * (p + 1));
Expand Down Expand Up @@ -113,7 +113,7 @@ int main() {
const double x2 = Test::Constants::eq_points[2];
const double y2 = Test::Constants::eq_points[8];
// We test the interactions of two phiphis at exemplary points
for (int p = 0; p < Bembel::Constants::MaxP; ++p) {
for (int p = 0; p <= Bembel::Constants::MaxP; ++p) {
Eigen::MatrixXd result1 =
Eigen::MatrixXd::Zero((p + 1) * (p + 1), (p + 1) * (p + 1));

Expand Down Expand Up @@ -180,7 +180,7 @@ int main() {
}

// We test the interactions of the div of two phiphis at exemplary points
for (int p = 1; p < Bembel::Constants::MaxP; ++p) {
for (int p = 1; p <= Bembel::Constants::MaxP; ++p) {
Eigen::MatrixXd result1 =
Eigen::MatrixXd::Zero(2 * (p + 1) * (p + 1), 2 * (p + 1) * (p + 1));

Expand Down

0 comments on commit edac632

Please sign in to comment.