From: David Wells Date: Wed, 8 Jun 2022 16:10:34 +0000 (-0400) Subject: Fix some CGAL tests. X-Git-Tag: v9.4.0-rc1~51^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F13933%2Fhead;p=dealii.git Fix some CGAL tests. 1. Avoid an implicit muParser dependency 2. Fix compilation --- diff --git a/tests/cgal/cgal_surface_triangulation_03.cc b/tests/cgal/cgal_surface_triangulation_03.cc index d5c2f4076e..98e9e348a3 100644 --- a/tests/cgal/cgal_surface_triangulation_03.cc +++ b/tests/cgal/cgal_surface_triangulation_03.cc @@ -47,7 +47,10 @@ main() std::ifstream input_sm(SOURCE_DIR "/input_grids/tripod.off"); input_sm >> sm; cgal_surface_mesh_to_dealii_triangulation(sm, tria); - go.write_msh(tria, "temp.msh"); + { + std::ofstream out("temp.msh"); + go.write_msh(tria, out); + } remove("temp.msh"); // If we got here, everything is fine. deallog << "OK" << std::endl; @@ -61,7 +64,10 @@ main() std::ifstream input_p(SOURCE_DIR "/input_grids/tripod.off"); input_p >> P; cgal_surface_mesh_to_dealii_triangulation(P, tria); - go.write_msh(tria, "temp.msh"); + { + std::ofstream out("temp.msh"); + go.write_msh(tria, out); + } remove("temp.msh"); // If we got here, everything is fine. deallog << "OK" << std::endl; diff --git a/tests/cgal/implicit_triangulation_01.cc b/tests/cgal/implicit_triangulation_01.cc index 43c8201681..054fc51ea2 100644 --- a/tests/cgal/implicit_triangulation_01.cc +++ b/tests/cgal/implicit_triangulation_01.cc @@ -17,7 +17,7 @@ #include -#include +#include #include #include @@ -27,13 +27,24 @@ using namespace CGAL::parameters; +class ImplicitFunction : public Function<3> +{ +public: + virtual double + value(const Point<3> &p, const unsigned int component = 0) const override + { + return std::pow(1 - std::sqrt(p[0] * p[0] + p[1] * p[1]), 2) + p[2] * p[2] - + .25; + } +}; + int main() { initlog(); // Build a deal.II triangulation - Triangulation<3> tria; - FunctionParser<3> implicit_function("(1-sqrt(x^2+y^2))^2+z^2-.25"); + Triangulation<3> tria; + ImplicitFunction implicit_function; CGALWrappers::AdditionalData<3> data; data.cell_size = 0.4; GridGenerator::implicit_function( diff --git a/tests/cgal/implicit_triangulation_02.cc b/tests/cgal/implicit_triangulation_02.cc index a0a76b0008..5e8456b7ff 100644 --- a/tests/cgal/implicit_triangulation_02.cc +++ b/tests/cgal/implicit_triangulation_02.cc @@ -17,7 +17,7 @@ #include -#include +#include #include #include @@ -27,13 +27,24 @@ using namespace CGAL::parameters; +class ImplicitFunction : public Function<3> +{ +public: + virtual double + value(const Point<3> &p, const unsigned int component = 0) const override + { + return std::pow(1 - std::sqrt(p[0] * p[0] + p[1] * p[1]), 2) + p[2] * p[2] - + .25; + } +}; + int main() { initlog(); // Build a deal.II triangulation - Triangulation<2, 3> tria; - FunctionParser<3> implicit_function("(1-sqrt(x^2+y^2))^2+z^2-.25"); + Triangulation<2, 3> tria; + ImplicitFunction implicit_function; CGALWrappers::AdditionalData<2> data; data.angular_bound = 30.; data.radius_bound = .1;