From 9dc97732e219c68cd56889b12d347d51792c1c85 Mon Sep 17 00:00:00 2001 From: ESeNonFossiIo Date: Tue, 8 Mar 2016 21:48:45 +0100 Subject: [PATCH] test for ../tests/opencascade/nurbs_patches_manifold_00 --- .../opencascade/nurbs_patches_manifold_00.cc | 81 +++++++++++++++++++ .../nurbs_patches_manifold_00.output | 66 +++++++++++++++ 2 files changed, 147 insertions(+) create mode 100644 tests/opencascade/nurbs_patches_manifold_00.cc create mode 100644 tests/opencascade/nurbs_patches_manifold_00.output diff --git a/tests/opencascade/nurbs_patches_manifold_00.cc b/tests/opencascade/nurbs_patches_manifold_00.cc new file mode 100644 index 0000000000..4e94ad01c0 --- /dev/null +++ b/tests/opencascade/nurbs_patches_manifold_00.cc @@ -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 +#include + +#include +#include +#include +#include +#include + +using namespace OpenCASCADE; + +int main () +{ + std::ofstream logfile("output"); + deallog.attach(logfile); + + std::vector faces; + std::vector edges; + std::vector 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 index 0000000000..c328368336 --- /dev/null +++ b/tests/opencascade/nurbs_patches_manifold_00.output @@ -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::======================================= -- 2.39.5