From d549659db0197069e87dc474a33065d37518fae7 Mon Sep 17 00:00:00 2001 From: Luca Heltai Date: Tue, 12 Dec 2017 14:37:29 +0100 Subject: [PATCH] Test 2d triangulation. --- tests/opencascade/create_tria_02.cc | 64 ++++++++++ tests/opencascade/create_tria_02.output | 151 ++++++++++++++++++++++++ 2 files changed, 215 insertions(+) create mode 100644 tests/opencascade/create_tria_02.cc create mode 100644 tests/opencascade/create_tria_02.output diff --git a/tests/opencascade/create_tria_02.cc b/tests/opencascade/create_tria_02.cc new file mode 100644 index 0000000000..b7165f3bed --- /dev/null +++ b/tests/opencascade/create_tria_02.cc @@ -0,0 +1,64 @@ +//----------------------------------------------------------- +// +// Copyright (C) 2017 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. +// +//----------------------------------------------------------- + +// Create a NURBS with a quarter of a disc, make a Manifold out of it, create a +// Triangulation with it, attach the manifold, and make a few refinements + +#include "../tests.h" + +#include +#include +#include + +#include + + +using namespace OpenCASCADE; + +int main () +{ + std::ofstream logfile("output"); + + // Create an edge, and make a face out of it by revolving along the z + // axis. + std::vector > ps; + ps.push_back(Point<2>(0, 1)); + ps.push_back(Point<2>(0, 2)); + auto edge = interpolation_curve(ps); + + BRepPrimAPI_MakeRevol::BRepPrimAPI_MakeRevol revol(edge, gp_Ax1(gp_Pnt(0,0,0), gp_Dir(0,0,1)), -numbers::PI/2); + revol.Build(); + auto sh = revol.Shape(); + + std::vector faces; + std::vector edges; + std::vector vertices; + + extract_geometrical_shapes(sh, faces, edges, vertices); + + // Create a boundary projector on the first face. + NURBSPatchManifold<2,2> manifold(faces[0]); + + // Create a Triangulation with a single cell + Triangulation<2,2> tria; + create_triangulation(faces[0], tria); + + // Set the manifold + tria.set_manifold(1, manifold); + tria.set_all_manifold_ids(1); + + tria.refine_global(3); + + // You can open the generated file with gmsh + GridOut gridout; + gridout.write_msh (tria, logfile); +} + diff --git a/tests/opencascade/create_tria_02.output b/tests/opencascade/create_tria_02.output new file mode 100644 index 0000000000..08fcc18bf1 --- /dev/null +++ b/tests/opencascade/create_tria_02.output @@ -0,0 +1,151 @@ +$NOD +81 +1 0 1 0 +2 1 6.12323e-17 0 +3 0 2 0 +4 2 1.22465e-16 0 +5 0.707107 0.707107 0 +6 2.82517e-24 1.5 0 +7 1.5 9.18485e-17 0 +8 1.41421 1.41421 0 +9 1.06066 1.06066 0 +10 0.382683 0.92388 0 +11 0.92388 0.382683 0 +12 1.17769e-24 1.25 0 +13 4.9433e-24 1.75 0 +14 1.25 7.65404e-17 0 +15 1.75 1.07157e-16 0 +16 0.765367 1.84776 0 +17 1.84776 0.765367 0 +18 0.883883 0.883883 0 +19 1.23744 1.23744 0 +20 0.574025 1.38582 0 +21 1.38582 0.574025 0 +22 0.478354 1.15485 0 +23 1.15485 0.478354 0 +24 0.669696 1.61679 0 +25 1.61679 0.669696 0 +26 0.19509 0.980785 0 +27 0.55557 0.83147 0 +28 0.83147 0.55557 0 +29 0.980785 0.19509 0 +30 4.82783e-28 1.125 0 +31 1.29487e-24 1.375 0 +32 1.5303e-24 1.625 0 +33 3.53066e-24 1.875 0 +34 1.125 6.88864e-17 0 +35 1.375 8.41945e-17 0 +36 1.625 9.95026e-17 0 +37 1.875 1.14811e-16 0 +38 0.390181 1.96157 0 +39 1.11114 1.66294 0 +40 1.66294 1.11114 0 +41 1.96157 0.390181 0 +42 0.795495 0.795495 0 +43 0.972272 0.972272 0 +44 1.14905 1.14905 0 +45 1.32583 1.32583 0 +46 0.292635 1.47118 0 +47 0.833355 1.2472 0 +48 1.2472 0.833355 0 +49 1.47118 0.292635 0 +50 0.430519 1.03936 0 +51 0.52619 1.27033 0 +52 0.243863 1.22598 0 +53 0.694463 1.03934 0 +54 1.03936 0.430519 0 +55 1.27033 0.52619 0 +56 1.03934 0.694463 0 +57 1.22598 0.243863 0 +58 0.621861 1.5013 0 +59 0.717531 1.73227 0 +60 0.341408 1.71637 0 +61 0.972248 1.45507 0 +62 1.5013 0.621861 0 +63 1.73227 0.717531 0 +64 1.45507 0.972248 0 +65 1.71637 0.341408 0 +66 0.219477 1.10338 0 +67 0.625017 0.935403 0 +68 0.268249 1.34858 0 +69 0.763909 1.14327 0 +70 0.935403 0.625017 0 +71 1.10338 0.219477 0 +72 1.14327 0.763909 0 +73 1.34858 0.268249 0 +74 0.317022 1.59378 0 +75 0.902802 1.35114 0 +76 0.365794 1.83897 0 +77 1.04169 1.55901 0 +78 1.35114 0.902802 0 +79 1.59378 0.317022 0 +80 1.55901 1.04169 0 +81 1.83897 0.365794 0 +$ENDNOD +$ELM +64 +1 3 0 0 4 1 26 66 30 +2 3 0 0 4 26 10 50 66 +3 3 0 0 4 30 66 52 12 +4 3 0 0 4 66 50 22 52 +5 3 0 0 4 10 27 67 50 +6 3 0 0 4 27 5 42 67 +7 3 0 0 4 50 67 53 22 +8 3 0 0 4 67 42 18 53 +9 3 0 0 4 12 52 68 31 +10 3 0 0 4 52 22 51 68 +11 3 0 0 4 31 68 46 6 +12 3 0 0 4 68 51 20 46 +13 3 0 0 4 22 53 69 51 +14 3 0 0 4 53 18 43 69 +15 3 0 0 4 51 69 47 20 +16 3 0 0 4 69 43 9 47 +17 3 0 0 4 5 28 70 42 +18 3 0 0 4 28 11 54 70 +19 3 0 0 4 42 70 56 18 +20 3 0 0 4 70 54 23 56 +21 3 0 0 4 11 29 71 54 +22 3 0 0 4 29 2 34 71 +23 3 0 0 4 54 71 57 23 +24 3 0 0 4 71 34 14 57 +25 3 0 0 4 18 56 72 43 +26 3 0 0 4 56 23 55 72 +27 3 0 0 4 43 72 48 9 +28 3 0 0 4 72 55 21 48 +29 3 0 0 4 23 57 73 55 +30 3 0 0 4 57 14 35 73 +31 3 0 0 4 55 73 49 21 +32 3 0 0 4 73 35 7 49 +33 3 0 0 4 6 46 74 32 +34 3 0 0 4 46 20 58 74 +35 3 0 0 4 32 74 60 13 +36 3 0 0 4 74 58 24 60 +37 3 0 0 4 20 47 75 58 +38 3 0 0 4 47 9 44 75 +39 3 0 0 4 58 75 61 24 +40 3 0 0 4 75 44 19 61 +41 3 0 0 4 13 60 76 33 +42 3 0 0 4 60 24 59 76 +43 3 0 0 4 33 76 38 3 +44 3 0 0 4 76 59 16 38 +45 3 0 0 4 24 61 77 59 +46 3 0 0 4 61 19 45 77 +47 3 0 0 4 59 77 39 16 +48 3 0 0 4 77 45 8 39 +49 3 0 0 4 9 48 78 44 +50 3 0 0 4 48 21 62 78 +51 3 0 0 4 44 78 64 19 +52 3 0 0 4 78 62 25 64 +53 3 0 0 4 21 49 79 62 +54 3 0 0 4 49 7 36 79 +55 3 0 0 4 62 79 65 25 +56 3 0 0 4 79 36 15 65 +57 3 0 0 4 19 64 80 45 +58 3 0 0 4 64 25 63 80 +59 3 0 0 4 45 80 40 8 +60 3 0 0 4 80 63 17 40 +61 3 0 0 4 25 65 81 63 +62 3 0 0 4 65 15 37 81 +63 3 0 0 4 63 81 41 17 +64 3 0 0 4 81 37 4 41 +$ENDELM -- 2.39.5