From 72c67b6d1bc19f9fc172d4b5c72b779226b71b9b Mon Sep 17 00:00:00 2001 From: Martin Kronbichler Date: Fri, 28 Feb 2020 19:27:35 +0100 Subject: [PATCH] Use new tangential vectors --- source/fe/mapping_fe_field.cc | 52 ++++------------------- source/fe/mapping_manifold.cc | 72 +++++++------------------------- source/fe/mapping_q_generic.cc | 75 +++++++--------------------------- 3 files changed, 37 insertions(+), 162 deletions(-) diff --git a/source/fe/mapping_fe_field.cc b/source/fe/mapping_fe_field.cc index 23de12715e..7135428678 100644 --- a/source/fe/mapping_fe_field.cc +++ b/source/fe/mapping_fe_field.cc @@ -581,56 +581,22 @@ MappingFEField::compute_face_data( dim - 1, std::vector>(n_original_q_points)); // Compute tangentials to the unit cell. - for (unsigned int i = 0; i < data.unit_tangentials.size(); ++i) - data.unit_tangentials[i].resize(n_original_q_points); - - if (dim == 2) - { - // ensure a counterclockwise - // orientation of tangentials - static const int tangential_orientation[4] = {-1, 1, 1, -1}; - for (const unsigned int i : GeometryInfo::face_indices()) - { - Tensor<1, dim> tang; - tang[1 - i / 2] = tangential_orientation[i]; - std::fill(data.unit_tangentials[i].begin(), - data.unit_tangentials[i].end(), - tang); - } - } - else if (dim == 3) + for (unsigned int i = 0; i < GeometryInfo::faces_per_cell; ++i) { - for (const unsigned int i : GeometryInfo::face_indices()) + data.unit_tangentials[i].resize(n_original_q_points); + std::fill(data.unit_tangentials[i].begin(), + data.unit_tangentials[i].end(), + GeometryInfo::unit_tangential_vectors[i][0]); + if (dim > 2) { - Tensor<1, dim> tang1, tang2; - - const unsigned int nd = - GeometryInfo::unit_normal_direction[i]; - - // first tangential - // vector in direction - // of the (nd+1)%3 axis - // and inverted in case - // of unit inward normal - tang1[(nd + 1) % dim] = - GeometryInfo::unit_normal_orientation[i]; - // second tangential - // vector in direction - // of the (nd+2)%3 axis - tang2[(nd + 2) % dim] = 1.; - - // same unit tangents - // for all quadrature - // points on this face - std::fill(data.unit_tangentials[i].begin(), - data.unit_tangentials[i].end(), - tang1); + data.unit_tangentials[GeometryInfo::faces_per_cell + i] + .resize(n_original_q_points); std::fill( data.unit_tangentials[GeometryInfo::faces_per_cell + i] .begin(), data.unit_tangentials[GeometryInfo::faces_per_cell + i] .end(), - tang2); + GeometryInfo::unit_tangential_vectors[i][1]); } } } diff --git a/source/fe/mapping_manifold.cc b/source/fe/mapping_manifold.cc index 392f2b250e..fa37729a20 100644 --- a/source/fe/mapping_manifold.cc +++ b/source/fe/mapping_manifold.cc @@ -117,67 +117,23 @@ MappingManifold::InternalData::initialize_face( std::vector>(n_original_q_points)); // Compute tangentials to the unit cell. - for (unsigned int i = 0; i < unit_tangentials.size(); ++i) - unit_tangentials[i].resize(n_original_q_points); - switch (dim) + for (unsigned int i = 0; i < GeometryInfo::faces_per_cell; ++i) { - case 2: + unit_tangentials[i].resize(n_original_q_points); + std::fill(unit_tangentials[i].begin(), + unit_tangentials[i].end(), + GeometryInfo::unit_tangential_vectors[i][0]); + if (dim > 2) { - // ensure a counterclockwise - // orientation of tangentials - static const int tangential_orientation[4] = {-1, 1, 1, -1}; - for (unsigned int i = 0; - i < GeometryInfo::faces_per_cell; - ++i) - { - Tensor<1, dim> tang; - tang[1 - i / 2] = tangential_orientation[i]; - std::fill(unit_tangentials[i].begin(), - unit_tangentials[i].end(), - tang); - } - break; - } - case 3: - { - for (unsigned int i = 0; - i < GeometryInfo::faces_per_cell; - ++i) - { - Tensor<1, dim> tang1, tang2; - - const unsigned int nd = - GeometryInfo::unit_normal_direction[i]; - - // first tangential - // vector in direction - // of the (nd+1)%3 axis - // and inverted in case - // of unit inward normal - tang1[(nd + 1) % dim] = - GeometryInfo::unit_normal_orientation[i]; - // second tangential - // vector in direction - // of the (nd+2)%3 axis - tang2[(nd + 2) % dim] = 1.; - - // same unit tangents - // for all quadrature - // points on this face - std::fill(unit_tangentials[i].begin(), - unit_tangentials[i].end(), - tang1); - std::fill( - unit_tangentials[GeometryInfo::faces_per_cell + i] - .begin(), - unit_tangentials[GeometryInfo::faces_per_cell + i] - .end(), - tang2); - } - break; + unit_tangentials[GeometryInfo::faces_per_cell + i] + .resize(n_original_q_points); + std::fill( + unit_tangentials[GeometryInfo::faces_per_cell + i] + .begin(), + unit_tangentials[GeometryInfo::faces_per_cell + i] + .end(), + GeometryInfo::unit_tangential_vectors[i][1]); } - default: - Assert(false, ExcNotImplemented()); } } } diff --git a/source/fe/mapping_q_generic.cc b/source/fe/mapping_q_generic.cc index ddc4115f7b..f65cca2a41 100644 --- a/source/fe/mapping_q_generic.cc +++ b/source/fe/mapping_q_generic.cc @@ -841,70 +841,23 @@ MappingQGeneric::InternalData::initialize_face( std::vector>(n_original_q_points)); // Compute tangentials to the unit cell. - for (unsigned int i = 0; i < unit_tangentials.size(); ++i) - unit_tangentials[i].resize(n_original_q_points); - switch (dim) + for (unsigned int i = 0; i < GeometryInfo::faces_per_cell; ++i) { - case 2: + unit_tangentials[i].resize(n_original_q_points); + std::fill(unit_tangentials[i].begin(), + unit_tangentials[i].end(), + GeometryInfo::unit_tangential_vectors[i][0]); + if (dim > 2) { - // ensure a counterclockwise orientation of tangentials - static const int tangential_orientation[4] = {-1, 1, 1, -1}; - for (unsigned int i = 0; - i < GeometryInfo::faces_per_cell; - ++i) - { - Tensor<1, dim> tang; - tang[1 - i / 2] = tangential_orientation[i]; - std::fill(unit_tangentials[i].begin(), - unit_tangentials[i].end(), - tang); - } - - break; + unit_tangentials[GeometryInfo::faces_per_cell + i] + .resize(n_original_q_points); + std::fill( + unit_tangentials[GeometryInfo::faces_per_cell + i] + .begin(), + unit_tangentials[GeometryInfo::faces_per_cell + i] + .end(), + GeometryInfo::unit_tangential_vectors[i][1]); } - - case 3: - { - for (unsigned int i = 0; - i < GeometryInfo::faces_per_cell; - ++i) - { - Tensor<1, dim> tang1, tang2; - - const unsigned int nd = - GeometryInfo::unit_normal_direction[i]; - - // first tangential - // vector in direction - // of the (nd+1)%3 axis - // and inverted in case - // of unit inward normal - tang1[(nd + 1) % dim] = - GeometryInfo::unit_normal_orientation[i]; - // second tangential - // vector in direction - // of the (nd+2)%3 axis - tang2[(nd + 2) % dim] = 1.; - - // same unit tangents - // for all quadrature - // points on this face - std::fill(unit_tangentials[i].begin(), - unit_tangentials[i].end(), - tang1); - std::fill( - unit_tangentials[GeometryInfo::faces_per_cell + i] - .begin(), - unit_tangentials[GeometryInfo::faces_per_cell + i] - .end(), - tang2); - } - - break; - } - - default: - Assert(false, ExcNotImplemented()); } } } -- 2.39.5