]> https://gitweb.dealii.org/ - dealii.git/commitdiff
test for ../tests/opencascade/nurbs_patches_manifold_00
authorESeNonFossiIo <esenonfossiio@gmail.com>
Tue, 8 Mar 2016 20:48:45 +0000 (21:48 +0100)
committerESeNonFossiIo <esenonfossiio@gmail.com>
Wed, 9 Mar 2016 16:37:29 +0000 (17:37 +0100)
tests/opencascade/nurbs_patches_manifold_00.cc [new file with mode: 0644]
tests/opencascade/nurbs_patches_manifold_00.output [new file with mode: 0644]

diff --git a/tests/opencascade/nurbs_patches_manifold_00.cc b/tests/opencascade/nurbs_patches_manifold_00.cc
new file mode 100644 (file)
index 0000000..4e94ad0
--- /dev/null
@@ -0,0 +1,81 @@
+//-----------------------------------------------------------
+//
+//    Copyright (C) 2014 - 2015 by the deal.II authors
+//
+//    This file is subject to LGPL and may not be distributed
+//    without copyright and license information. Please refer
+//    to the file deal.II/doc/license.html for the  text  and
+//    further information on this license.
+//
+//-----------------------------------------------------------
+
+// Read goteborg.iges and dump its topological structure to the
+// logfile.
+
+#include "../tests.h"
+#include <fstream>
+#include <deal.II/base/logstream.h>
+
+#include <deal.II/opencascade/boundary_lib.h>
+#include <deal.II/opencascade/utilities.h>
+#include <TopTools.hxx>
+#include <TopoDS_Shape.hxx>
+#include <Standard_Stream.hxx>
+
+using namespace OpenCASCADE;
+
+int main ()
+{
+  std::ofstream logfile("output");
+  deallog.attach(logfile);
+
+  std::vector<TopoDS_Face> faces;
+  std::vector<TopoDS_Edge> edges;
+  std::vector<TopoDS_Vertex> vertices;
+
+  TopoDS_Shape sh = read_STEP(SOURCE_DIR "/step_files/goteborg.step");
+  extract_geometrical_shapes(sh, faces, edges, vertices);
+
+  dealii::OpenCASCADE::NURBSPatchManifold<2,3> manifold(faces[0]);
+
+  auto bounds = manifold.get_uv_bounds();
+  auto u_min = std::get<0>(bounds);
+  auto u_max = std::get<1>(bounds);
+  auto v_min = std::get<2>(bounds);
+  auto v_max = std::get<3>(bounds);  
+  
+  deallog << " u_min = " << std::get<0>(bounds) << std::endl;
+  deallog << " u_max = " << std::get<1>(bounds) << std::endl;
+  deallog << " v_min = " << std::get<2>(bounds) << std::endl;
+  deallog << " v_max = " << std::get<3>(bounds) << std::endl;
+
+  deallog << "=======================================" << std::endl;
+  int len = 10;
+  for(unsigned int i = 0; i <= 10; ++i)
+  {
+    double step = ((double)i)/10;
+    deallog << " pos = " <<  step << std::endl;
+    double u_pos = step * u_min + (1-step) * u_max;
+    double v_pos = step * v_min + (1-step) * v_max;
+    Point<2> uv(u_pos, v_pos);
+    deallog << " uv = " << uv << std::endl;
+    auto q = manifold.push_forward(uv);
+    deallog << " q = " << q << std::endl;
+    auto uv_ = manifold.pull_back(q);
+    deallog << " uv = " << uv << std::endl;
+    deallog << "=======================================" << std::endl;
+  }
+
+  double u_pos =  (u_min + u_max)/2;
+  double v_pos =  (v_min + v_max)/2;
+  Point<2> uv(u_pos, v_pos);
+  auto D = manifold.push_forward_gradient(uv);
+  deallog << "=======================================" << std::endl;
+  deallog << " | " <<  D[1][0] << " | " <<  D[0][0] <<" | " << std::endl;
+  deallog << " | " <<  D[1][1] << " | " <<  D[0][1] <<" | " << std::endl;
+  deallog << " | " <<  D[1][2] << " | " <<  D[0][2] <<" | " << std::endl;
+  deallog << "=======================================" << std::endl;
+
+  return 0;
+}
+
diff --git a/tests/opencascade/nurbs_patches_manifold_00.output b/tests/opencascade/nurbs_patches_manifold_00.output
new file mode 100644 (file)
index 0000000..c328368
--- /dev/null
@@ -0,0 +1,66 @@
+
+DEAL:: u_min = 1.96115
+DEAL:: u_max = 10.0000
+DEAL:: v_min = 0.00000
+DEAL:: v_max = 11.0000
+DEAL::=======================================
+DEAL:: pos = 0.00000
+DEAL:: uv = 10.0000 11.0000
+DEAL:: q = -3.05955 0.00000 0.501418
+DEAL:: uv = 10.0000 11.0000
+DEAL::=======================================
+DEAL:: pos = 0.100000
+DEAL:: uv = 9.19611 9.90000
+DEAL:: q = -2.76096 0.0156017 0.279445
+DEAL:: uv = 9.19611 9.90000
+DEAL::=======================================
+DEAL:: pos = 0.200000
+DEAL:: uv = 8.39223 8.80000
+DEAL:: q = -2.63180 0.0159143 0.137329
+DEAL:: uv = 8.39223 8.80000
+DEAL::=======================================
+DEAL:: pos = 0.300000
+DEAL:: uv = 7.58834 7.70000
+DEAL:: q = -2.53098 0.0178089 0.0300784
+DEAL:: uv = 7.58834 7.70000
+DEAL::=======================================
+DEAL:: pos = 0.400000
+DEAL:: uv = 6.78446 6.60000
+DEAL:: q = -2.42303 0.0237883 -0.0495104
+DEAL:: uv = 6.78446 6.60000
+DEAL::=======================================
+DEAL:: pos = 0.500000
+DEAL:: uv = 5.98057 5.50000
+DEAL:: q = -2.31672 0.0322628 -0.0974118
+DEAL:: uv = 5.98057 5.50000
+DEAL::=======================================
+DEAL:: pos = 0.600000
+DEAL:: uv = 5.17669 4.40000
+DEAL:: q = -2.21983 0.0279539 -0.128575
+DEAL:: uv = 5.17669 4.40000
+DEAL::=======================================
+DEAL:: pos = 0.700000
+DEAL:: uv = 4.37280 3.30000
+DEAL:: q = -2.12190 0.0130014 -0.163149
+DEAL:: uv = 4.37280 3.30000
+DEAL::=======================================
+DEAL:: pos = 0.800000
+DEAL:: uv = 3.56892 2.20000
+DEAL:: q = -2.04822 0.00230331 -0.181689
+DEAL:: uv = 3.56892 2.20000
+DEAL::=======================================
+DEAL:: pos = 0.900000
+DEAL:: uv = 2.76503 1.10000
+DEAL:: q = -2.02052 0.00251434 -0.158299
+DEAL:: uv = 2.76503 1.10000
+DEAL::=======================================
+DEAL:: pos = 1.00000
+DEAL:: uv = 1.96115 0.00000
+DEAL:: q = -1.98715 1.02653e-19 -0.149998
+DEAL:: uv = 1.96115 0.00000
+DEAL::=======================================
+DEAL::=======================================
+DEAL:: | -0.00164538 | -0.122937 | 
+DEAL:: | -0.00311282 | -0.000314830 | 
+DEAL:: | 0.0340939 | -0.00164538 | 
+DEAL::=======================================

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.