From: Peter Munch Date: Sun, 17 Jan 2021 09:51:09 +0000 (+0100) Subject: Add new test for MappingFEField for simplex meshes X-Git-Tag: v9.3.0-rc1~599^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F11571%2Fhead;p=dealii.git Add new test for MappingFEField for simplex meshes --- diff --git a/tests/simplex/mapping_fe_fields_02.cc b/tests/simplex/mapping_fe_fields_02.cc new file mode 100644 index 0000000000..9580d402a7 --- /dev/null +++ b/tests/simplex/mapping_fe_fields_02.cc @@ -0,0 +1,111 @@ +// --------------------------------------------------------------------- +// +// Copyright (C) 2020 by the deal.II authors +// +// This file is part of the deal.II library. +// +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE.md at +// the top level directory of deal.II. +// +// --------------------------------------------------------------------- + + +// Like mapping_fe_fields_01 but for deformed meshes tested for linear and +// quadratic mapping. + +#include + +#include +#include +#include +#include + +#include + +#include +#include + +#include +#include +#include + +#include "../tests.h" + +using namespace dealii; + +template +class Solution : public Function +{ +public: + Solution() + : Function(dim) + {} + + double + value(const Point &point, const unsigned int compontent) const + { + return std::sin(point[compontent] * 0.5 * numbers::PI); + } +}; + +void +test(const unsigned int mapping_degree) +{ + const int dim = 2; + + Triangulation tria; + GridGenerator::subdivided_hyper_cube_with_simplices(tria, 4); + + Simplex::FE_P fe(mapping_degree); + FESystem euler_fe(fe, dim); + + DoFHandler dof_handler(tria); + dof_handler.distribute_dofs(fe); + + DoFHandler euler_dof_handler(tria); + euler_dof_handler.distribute_dofs(euler_fe); + + Vector euler_vector(euler_dof_handler.n_dofs()); + + // TODO: not working (missing mapping) + // VectorTools::get_position_vector(euler_dof_handler, euler_vector); + + MappingFE mapping_interpolation(Simplex::FE_P(1)); + VectorTools::interpolate(mapping_interpolation, + euler_dof_handler, + Solution(), + euler_vector); + + MappingFEField mapping(euler_dof_handler, euler_vector); + + { + DataOut data_out; + + data_out.attach_dof_handler(dof_handler); + + Vector solution(dof_handler.n_dofs()); + data_out.add_data_vector(solution, "solution"); + + data_out.build_patches(mapping, 2); + +#if false + std::ofstream output("test." + std::to_string(mapping_degree) + ".vtk"); + data_out.write_vtk(output); +#else + data_out.write_vtk(deallog.get_file_stream()); +#endif + } +} + +int +main() +{ + initlog(); + + test(1); // linear mapping + test(2); // quadratic mapping +} diff --git a/tests/simplex/mapping_fe_fields_02.with_simplex_support=on.output b/tests/simplex/mapping_fe_fields_02.with_simplex_support=on.output new file mode 100644 index 0000000000..e07de1d3ea --- /dev/null +++ b/tests/simplex/mapping_fe_fields_02.with_simplex_support=on.output @@ -0,0 +1,479 @@ + +# vtk DataFile Version 3.0 +#This file was generated +ASCII +DATASET UNSTRUCTURED_GRID + +POINTS 192 double +0.00000 0.00000 0 +0.382683 0.00000 0 +0.00000 0.382683 0 +0.191342 0.00000 0 +0.191342 0.191342 0 +0.00000 0.191342 0 +0.382683 0.382683 0 +0.00000 0.382683 0 +0.382683 0.00000 0 +0.191342 0.382683 0 +0.191342 0.191342 0 +0.382683 0.191342 0 +0.382683 0.00000 0 +0.707107 0.00000 0 +0.382683 0.382683 0 +0.544895 0.00000 0 +0.544895 0.191342 0 +0.382683 0.191342 0 +0.707107 0.382683 0 +0.382683 0.382683 0 +0.707107 0.00000 0 +0.544895 0.382683 0 +0.544895 0.191342 0 +0.707107 0.191342 0 +0.707107 0.00000 0 +0.923880 0.00000 0 +0.707107 0.382683 0 +0.815493 0.00000 0 +0.815493 0.191342 0 +0.707107 0.191342 0 +0.923880 0.382683 0 +0.707107 0.382683 0 +0.923880 0.00000 0 +0.815493 0.382683 0 +0.815493 0.191342 0 +0.923880 0.191342 0 +0.923880 0.00000 0 +1.00000 0.00000 0 +0.923880 0.382683 0 +0.961940 0.00000 0 +0.961940 0.191342 0 +0.923880 0.191342 0 +1.00000 0.382683 0 +0.923880 0.382683 0 +1.00000 0.00000 0 +0.961940 0.382683 0 +0.961940 0.191342 0 +1.00000 0.191342 0 +0.00000 0.382683 0 +0.382683 0.382683 0 +0.00000 0.707107 0 +0.191342 0.382683 0 +0.191342 0.544895 0 +0.00000 0.544895 0 +0.382683 0.707107 0 +0.00000 0.707107 0 +0.382683 0.382683 0 +0.191342 0.707107 0 +0.191342 0.544895 0 +0.382683 0.544895 0 +0.382683 0.382683 0 +0.707107 0.382683 0 +0.382683 0.707107 0 +0.544895 0.382683 0 +0.544895 0.544895 0 +0.382683 0.544895 0 +0.707107 0.707107 0 +0.382683 0.707107 0 +0.707107 0.382683 0 +0.544895 0.707107 0 +0.544895 0.544895 0 +0.707107 0.544895 0 +0.707107 0.382683 0 +0.923880 0.382683 0 +0.707107 0.707107 0 +0.815493 0.382683 0 +0.815493 0.544895 0 +0.707107 0.544895 0 +0.923880 0.707107 0 +0.707107 0.707107 0 +0.923880 0.382683 0 +0.815493 0.707107 0 +0.815493 0.544895 0 +0.923880 0.544895 0 +0.923880 0.382683 0 +1.00000 0.382683 0 +0.923880 0.707107 0 +0.961940 0.382683 0 +0.961940 0.544895 0 +0.923880 0.544895 0 +1.00000 0.707107 0 +0.923880 0.707107 0 +1.00000 0.382683 0 +0.961940 0.707107 0 +0.961940 0.544895 0 +1.00000 0.544895 0 +0.00000 0.707107 0 +0.382683 0.707107 0 +0.00000 0.923880 0 +0.191342 0.707107 0 +0.191342 0.815493 0 +0.00000 0.815493 0 +0.382683 0.923880 0 +0.00000 0.923880 0 +0.382683 0.707107 0 +0.191342 0.923880 0 +0.191342 0.815493 0 +0.382683 0.815493 0 +0.382683 0.707107 0 +0.707107 0.707107 0 +0.382683 0.923880 0 +0.544895 0.707107 0 +0.544895 0.815493 0 +0.382683 0.815493 0 +0.707107 0.923880 0 +0.382683 0.923880 0 +0.707107 0.707107 0 +0.544895 0.923880 0 +0.544895 0.815493 0 +0.707107 0.815493 0 +0.707107 0.707107 0 +0.923880 0.707107 0 +0.707107 0.923880 0 +0.815493 0.707107 0 +0.815493 0.815493 0 +0.707107 0.815493 0 +0.923880 0.923880 0 +0.707107 0.923880 0 +0.923880 0.707107 0 +0.815493 0.923880 0 +0.815493 0.815493 0 +0.923880 0.815493 0 +0.923880 0.707107 0 +1.00000 0.707107 0 +0.923880 0.923880 0 +0.961940 0.707107 0 +0.961940 0.815493 0 +0.923880 0.815493 0 +1.00000 0.923880 0 +0.923880 0.923880 0 +1.00000 0.707107 0 +0.961940 0.923880 0 +0.961940 0.815493 0 +1.00000 0.815493 0 +0.00000 0.923880 0 +0.382683 0.923880 0 +0.00000 1.00000 0 +0.191342 0.923880 0 +0.191342 0.961940 0 +0.00000 0.961940 0 +0.382683 1.00000 0 +0.00000 1.00000 0 +0.382683 0.923880 0 +0.191342 1.00000 0 +0.191342 0.961940 0 +0.382683 0.961940 0 +0.382683 0.923880 0 +0.707107 0.923880 0 +0.382683 1.00000 0 +0.544895 0.923880 0 +0.544895 0.961940 0 +0.382683 0.961940 0 +0.707107 1.00000 0 +0.382683 1.00000 0 +0.707107 0.923880 0 +0.544895 1.00000 0 +0.544895 0.961940 0 +0.707107 0.961940 0 +0.707107 0.923880 0 +0.923880 0.923880 0 +0.707107 1.00000 0 +0.815493 0.923880 0 +0.815493 0.961940 0 +0.707107 0.961940 0 +0.923880 1.00000 0 +0.707107 1.00000 0 +0.923880 0.923880 0 +0.815493 1.00000 0 +0.815493 0.961940 0 +0.923880 0.961940 0 +0.923880 0.923880 0 +1.00000 0.923880 0 +0.923880 1.00000 0 +0.961940 0.923880 0 +0.961940 0.961940 0 +0.923880 0.961940 0 +1.00000 1.00000 0 +0.923880 1.00000 0 +1.00000 0.923880 0 +0.961940 1.00000 0 +0.961940 0.961940 0 +1.00000 0.961940 0 + +CELLS 32 224 + 6 0 1 2 3 4 5 + 6 6 7 8 9 10 11 + 6 12 13 14 15 16 17 + 6 18 19 20 21 22 23 + 6 24 25 26 27 28 29 + 6 30 31 32 33 34 35 + 6 36 37 38 39 40 41 + 6 42 43 44 45 46 47 + 6 48 49 50 51 52 53 + 6 54 55 56 57 58 59 + 6 60 61 62 63 64 65 + 6 66 67 68 69 70 71 + 6 72 73 74 75 76 77 + 6 78 79 80 81 82 83 + 6 84 85 86 87 88 89 + 6 90 91 92 93 94 95 + 6 96 97 98 99 100 101 + 6 102 103 104 105 106 107 + 6 108 109 110 111 112 113 + 6 114 115 116 117 118 119 + 6 120 121 122 123 124 125 + 6 126 127 128 129 130 131 + 6 132 133 134 135 136 137 + 6 138 139 140 141 142 143 + 6 144 145 146 147 148 149 + 6 150 151 152 153 154 155 + 6 156 157 158 159 160 161 + 6 162 163 164 165 166 167 + 6 168 169 170 171 172 173 + 6 174 175 176 177 178 179 + 6 180 181 182 183 184 185 + 6 186 187 188 189 190 191 + +CELL_TYPES 32 + 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 +POINT_DATA 192 +SCALARS solution double 1 +LOOKUP_TABLE default +0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 +# vtk DataFile Version 3.0 +#This file was generated +ASCII +DATASET UNSTRUCTURED_GRID + +POINTS 192 double +0.00000 0.00000 0 +0.382683 0.00000 0 +0.00000 0.382683 0 +0.195090 0.00000 0 +0.195090 0.195090 0 +0.00000 0.195090 0 +0.382683 0.382683 0 +0.00000 0.382683 0 +0.382683 0.00000 0 +0.195090 0.382683 0 +0.195090 0.195090 0 +0.382683 0.195090 0 +0.382683 0.00000 0 +0.707107 0.00000 0 +0.382683 0.382683 0 +0.555570 0.00000 0 +0.555570 0.195090 0 +0.382683 0.195090 0 +0.707107 0.382683 0 +0.382683 0.382683 0 +0.707107 0.00000 0 +0.555570 0.382683 0 +0.555570 0.195090 0 +0.707107 0.195090 0 +0.707107 0.00000 0 +0.923880 0.00000 0 +0.707107 0.382683 0 +0.831470 0.00000 0 +0.831470 0.195090 0 +0.707107 0.195090 0 +0.923880 0.382683 0 +0.707107 0.382683 0 +0.923880 0.00000 0 +0.831470 0.382683 0 +0.831470 0.195090 0 +0.923880 0.195090 0 +0.923880 0.00000 0 +1.00000 0.00000 0 +0.923880 0.382683 0 +0.980785 0.00000 0 +0.980785 0.195090 0 +0.923880 0.195090 0 +1.00000 0.382683 0 +0.923880 0.382683 0 +1.00000 0.00000 0 +0.980785 0.382683 0 +0.980785 0.195090 0 +1.00000 0.195090 0 +0.00000 0.382683 0 +0.382683 0.382683 0 +0.00000 0.707107 0 +0.195090 0.382683 0 +0.195090 0.555570 0 +0.00000 0.555570 0 +0.382683 0.707107 0 +0.00000 0.707107 0 +0.382683 0.382683 0 +0.195090 0.707107 0 +0.195090 0.555570 0 +0.382683 0.555570 0 +0.382683 0.382683 0 +0.707107 0.382683 0 +0.382683 0.707107 0 +0.555570 0.382683 0 +0.555570 0.555570 0 +0.382683 0.555570 0 +0.707107 0.707107 0 +0.382683 0.707107 0 +0.707107 0.382683 0 +0.555570 0.707107 0 +0.555570 0.555570 0 +0.707107 0.555570 0 +0.707107 0.382683 0 +0.923880 0.382683 0 +0.707107 0.707107 0 +0.831470 0.382683 0 +0.831470 0.555570 0 +0.707107 0.555570 0 +0.923880 0.707107 0 +0.707107 0.707107 0 +0.923880 0.382683 0 +0.831470 0.707107 0 +0.831470 0.555570 0 +0.923880 0.555570 0 +0.923880 0.382683 0 +1.00000 0.382683 0 +0.923880 0.707107 0 +0.980785 0.382683 0 +0.980785 0.555570 0 +0.923880 0.555570 0 +1.00000 0.707107 0 +0.923880 0.707107 0 +1.00000 0.382683 0 +0.980785 0.707107 0 +0.980785 0.555570 0 +1.00000 0.555570 0 +0.00000 0.707107 0 +0.382683 0.707107 0 +0.00000 0.923880 0 +0.195090 0.707107 0 +0.195090 0.831470 0 +0.00000 0.831470 0 +0.382683 0.923880 0 +0.00000 0.923880 0 +0.382683 0.707107 0 +0.195090 0.923880 0 +0.195090 0.831470 0 +0.382683 0.831470 0 +0.382683 0.707107 0 +0.707107 0.707107 0 +0.382683 0.923880 0 +0.555570 0.707107 0 +0.555570 0.831470 0 +0.382683 0.831470 0 +0.707107 0.923880 0 +0.382683 0.923880 0 +0.707107 0.707107 0 +0.555570 0.923880 0 +0.555570 0.831470 0 +0.707107 0.831470 0 +0.707107 0.707107 0 +0.923880 0.707107 0 +0.707107 0.923880 0 +0.831470 0.707107 0 +0.831470 0.831470 0 +0.707107 0.831470 0 +0.923880 0.923880 0 +0.707107 0.923880 0 +0.923880 0.707107 0 +0.831470 0.923880 0 +0.831470 0.831470 0 +0.923880 0.831470 0 +0.923880 0.707107 0 +1.00000 0.707107 0 +0.923880 0.923880 0 +0.980785 0.707107 0 +0.980785 0.831470 0 +0.923880 0.831470 0 +1.00000 0.923880 0 +0.923880 0.923880 0 +1.00000 0.707107 0 +0.980785 0.923880 0 +0.980785 0.831470 0 +1.00000 0.831470 0 +0.00000 0.923880 0 +0.382683 0.923880 0 +0.00000 1.00000 0 +0.195090 0.923880 0 +0.195090 0.980785 0 +0.00000 0.980785 0 +0.382683 1.00000 0 +0.00000 1.00000 0 +0.382683 0.923880 0 +0.195090 1.00000 0 +0.195090 0.980785 0 +0.382683 0.980785 0 +0.382683 0.923880 0 +0.707107 0.923880 0 +0.382683 1.00000 0 +0.555570 0.923880 0 +0.555570 0.980785 0 +0.382683 0.980785 0 +0.707107 1.00000 0 +0.382683 1.00000 0 +0.707107 0.923880 0 +0.555570 1.00000 0 +0.555570 0.980785 0 +0.707107 0.980785 0 +0.707107 0.923880 0 +0.923880 0.923880 0 +0.707107 1.00000 0 +0.831470 0.923880 0 +0.831470 0.980785 0 +0.707107 0.980785 0 +0.923880 1.00000 0 +0.707107 1.00000 0 +0.923880 0.923880 0 +0.831470 1.00000 0 +0.831470 0.980785 0 +0.923880 0.980785 0 +0.923880 0.923880 0 +1.00000 0.923880 0 +0.923880 1.00000 0 +0.980785 0.923880 0 +0.980785 0.980785 0 +0.923880 0.980785 0 +1.00000 1.00000 0 +0.923880 1.00000 0 +1.00000 0.923880 0 +0.980785 1.00000 0 +0.980785 0.980785 0 +1.00000 0.980785 0 + +CELLS 32 224 + 6 0 1 2 3 4 5 + 6 6 7 8 9 10 11 + 6 12 13 14 15 16 17 + 6 18 19 20 21 22 23 + 6 24 25 26 27 28 29 + 6 30 31 32 33 34 35 + 6 36 37 38 39 40 41 + 6 42 43 44 45 46 47 + 6 48 49 50 51 52 53 + 6 54 55 56 57 58 59 + 6 60 61 62 63 64 65 + 6 66 67 68 69 70 71 + 6 72 73 74 75 76 77 + 6 78 79 80 81 82 83 + 6 84 85 86 87 88 89 + 6 90 91 92 93 94 95 + 6 96 97 98 99 100 101 + 6 102 103 104 105 106 107 + 6 108 109 110 111 112 113 + 6 114 115 116 117 118 119 + 6 120 121 122 123 124 125 + 6 126 127 128 129 130 131 + 6 132 133 134 135 136 137 + 6 138 139 140 141 142 143 + 6 144 145 146 147 148 149 + 6 150 151 152 153 154 155 + 6 156 157 158 159 160 161 + 6 162 163 164 165 166 167 + 6 168 169 170 171 172 173 + 6 174 175 176 177 178 179 + 6 180 181 182 183 184 185 + 6 186 187 188 189 190 191 + +CELL_TYPES 32 + 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 +POINT_DATA 192 +SCALARS solution double 1 +LOOKUP_TABLE default +0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000