]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Fix some CGAL tests. 13933/head
authorDavid Wells <drwells@email.unc.edu>
Wed, 8 Jun 2022 16:10:34 +0000 (12:10 -0400)
committerDavid Wells <drwells@email.unc.edu>
Wed, 8 Jun 2022 16:10:34 +0000 (12:10 -0400)
1. Avoid an implicit muParser dependency
2. Fix compilation

tests/cgal/cgal_surface_triangulation_03.cc
tests/cgal/implicit_triangulation_01.cc
tests/cgal/implicit_triangulation_02.cc

index d5c2f4076e14926e60cdcbd75d74b446ce10e51e..98e9e348a313340d0ecc9157b05130d6364482bc 100644 (file)
@@ -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;
index 43c8201681c7ddab1a411efeafa3830ef2c4b569..054fc51ea20dc8076d6c8f541eb85b1eb1e6e0ed 100644 (file)
@@ -17,7 +17,7 @@
 
 #include <deal.II/base/config.h>
 
-#include <deal.II/base/function_parser.h>
+#include <deal.II/base/function.h>
 
 #include <deal.II/grid/grid_generator.h>
 #include <deal.II/grid/grid_out.h>
 
 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(
index a0a76b000880c860d7efecc53f6aab875bfe38a4..5e8456b7ffc51d0b4ca7aadc8b97ebf2f30e22ae 100644 (file)
@@ -17,7 +17,7 @@
 
 #include <deal.II/base/config.h>
 
-#include <deal.II/base/function_parser.h>
+#include <deal.II/base/function.h>
 
 #include <deal.II/grid/grid_generator.h>
 #include <deal.II/grid/grid_out.h>
 
 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;

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.