From 8d0b99aa8151fbcda173c727ca8ee1f1d3a1f922 Mon Sep 17 00:00:00 2001 From: bangerth Date: Fri, 25 Aug 2006 16:07:04 +0000 Subject: [PATCH] More cleanups. Use sign_change field also for subfaces git-svn-id: https://svn.dealii.org/trunk@13747 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/deal.II/source/fe/fe_poly_tensor.cc | 124 ++++++++++---------- 1 file changed, 63 insertions(+), 61 deletions(-) diff --git a/deal.II/deal.II/source/fe/fe_poly_tensor.cc b/deal.II/deal.II/source/fe/fe_poly_tensor.cc index 43b4eb58d1..d6033386bb 100644 --- a/deal.II/deal.II/source/fe/fe_poly_tensor.cc +++ b/deal.II/deal.II/source/fe/fe_poly_tensor.cc @@ -354,24 +354,23 @@ FE_PolyTensor::fill_fe_values ( // && dynamic_cast*>(&mapping) != 0), // ExcNotImplemented()); - const unsigned int n_dofs = this->dofs_per_cell; - const unsigned int n_quad = quadrature.n_quadrature_points; + const unsigned int n_q_points = quadrature.n_quadrature_points; const UpdateFlags flags(fe_data.current_update_flags()); - Assert(!(flags & update_values) || fe_data.shape_values.size() == n_dofs, - ExcDimensionMismatch(fe_data.shape_values.size(), n_dofs)); - Assert(!(flags & update_values) || fe_data.shape_values[0].size() == n_quad, - ExcDimensionMismatch(fe_data.shape_values[0].size(), n_quad)); + Assert(!(flags & update_values) || fe_data.shape_values.size() == this->dofs_per_cell, + ExcDimensionMismatch(fe_data.shape_values.size(), this->dofs_per_cell)); + Assert(!(flags & update_values) || fe_data.shape_values[0].size() == n_q_points, + ExcDimensionMismatch(fe_data.shape_values[0].size(), n_q_points)); // Create table with sign changes, due to the special structure of the RT elements. // TODO: Preliminary hack to demonstrate the overall prinicple! // Compute eventual sign changes depending on the neighborhood // between two faces. - std::vector sign_change (n_dofs, 1.0); + std::vector sign_change (this->dofs_per_cell, 1.0); get_face_sign_change (cell, this->dofs_per_face, sign_change); - for (unsigned int i=0; idofs_per_cell; ++i) { const unsigned int first = data.shape_function_to_row_table[i]; @@ -382,8 +381,8 @@ FE_PolyTensor::fill_fe_values ( case independent: case independent_on_cartesian: { - for (unsigned int k=0; k::fill_fe_values ( { // Use auxiliary vector for // transformation - std::vector > shape_values (n_quad); + std::vector > shape_values (n_q_points); if (mapping_type == covariant) mapping.transform_covariant(fe_data.shape_values[i], 0, shape_values, mapping_data); @@ -402,7 +401,7 @@ FE_PolyTensor::fill_fe_values ( shape_values, mapping_data); // then copy over to target: - for (unsigned int k=0; k::fill_fe_values ( if (flags & update_gradients) { - std::vector > shape_grads1 (n_quad); - std::vector > shape_grads2 (n_quad); + std::vector > shape_grads1 (n_q_points); + std::vector > shape_grads2 (n_q_points); switch (mapping_type) { @@ -436,8 +435,8 @@ FE_PolyTensor::fill_fe_values ( mapping.transform_covariant(fe_data.shape_grads[i], 0, shape_grads1, mapping_data); - for (unsigned int k=0; k::fill_fe_values ( mapping.transform_covariant(fe_data.shape_grads[i], 0, shape_grads1, mapping_data); - for (unsigned int q=0; q::fill_fe_values ( shape_grads2, mapping_data); - for (unsigned int k=0; k::fill_fe_face_values ( // possible InternalData &fe_data = dynamic_cast (fedata); - const unsigned int n_dofs = this->dofs_per_cell; - const unsigned int n_quad = quadrature.n_quadrature_points; + const unsigned int n_q_points = quadrature.n_quadrature_points; // offset determines which data set // to take (all data sets for all // faces are stored contiguously) @@ -529,7 +527,7 @@ FE_PolyTensor::fill_fe_face_values ( const typename QProjector::DataSetDescriptor dsd; const typename QProjector::DataSetDescriptor offset = dsd.face (face, cell->face_orientation(face), - n_quad); + n_q_points); const UpdateFlags flags(fe_data.update_once | fe_data.update_each); @@ -544,10 +542,10 @@ FE_PolyTensor::fill_fe_face_values ( // Compute eventual sign changes depending // on the neighborhood between two faces. - std::vector sign_change (n_dofs, 1.0); + std::vector sign_change (this->dofs_per_cell, 1.0); get_face_sign_change (cell, this->dofs_per_face, sign_change); - for (unsigned int i=0; idofs_per_cell; ++i) { const unsigned int first = data.shape_function_to_row_table[i]; @@ -558,8 +556,8 @@ FE_PolyTensor::fill_fe_face_values ( case independent: case independent_on_cartesian: { - for (unsigned int k=0; k::fill_fe_face_values ( { // Use auxiliary vector // for transformation - std::vector > shape_values (n_quad); + std::vector > shape_values (n_q_points); if (mapping_type == covariant) mapping.transform_covariant(fe_data.shape_values[i], offset, shape_values, mapping_data); @@ -578,7 +576,7 @@ FE_PolyTensor::fill_fe_face_values ( shape_values, mapping_data); // then copy over to target: - for (unsigned int k=0; k::fill_fe_face_values ( if (flags & update_gradients) { - std::vector > shape_grads1 (n_quad); - std::vector > shape_grads2 (n_quad); + std::vector > shape_grads1 (n_q_points); + std::vector > shape_grads2 (n_q_points); switch (mapping_type) { @@ -622,8 +620,8 @@ FE_PolyTensor::fill_fe_face_values ( { mapping.transform_covariant(fe_data.shape_grads[i], offset, shape_grads1, mapping_data); - for (unsigned int k=0; k::fill_fe_face_values ( mapping.transform_covariant(fe_data.shape_grads[i], offset, shape_grads1, mapping_data); - for (unsigned int q=0; q::fill_fe_face_values ( shape_grads2, mapping_data); - for (unsigned int k=0; k::fill_fe_subface_values ( // possible InternalData &fe_data = dynamic_cast (fedata); - const unsigned int n_dofs = this->dofs_per_cell; - const unsigned int n_quad = quadrature.n_quadrature_points; + const unsigned int n_q_points = quadrature.n_quadrature_points; // offset determines which data set // to take (all data sets for all // sub-faces are stored contiguously) @@ -711,7 +708,7 @@ FE_PolyTensor::fill_fe_subface_values ( const typename QProjector::DataSetDescriptor dsd; const typename QProjector::DataSetDescriptor offset = dsd.subface (face, subface, cell->face_orientation(face), - n_quad); + n_q_points); const UpdateFlags flags(fe_data.update_once | fe_data.update_each); @@ -722,8 +719,13 @@ FE_PolyTensor::fill_fe_subface_values ( //TODO: Size assertions //TODO: Sign change for the face DoFs! + + // Compute eventual sign changes depending + // on the neighborhood between two faces. + std::vector sign_change (this->dofs_per_cell, 1.0); + get_face_sign_change (cell, this->dofs_per_face, sign_change); - for (unsigned int i=0; idofs_per_cell; ++i) { const unsigned int first = data.shape_function_to_row_table[i]; @@ -734,8 +736,8 @@ FE_PolyTensor::fill_fe_subface_values ( case independent: case independent_on_cartesian: { - for (unsigned int k=0; k::fill_fe_subface_values ( { // Use auxiliary vector for // transformation - std::vector > shape_values (n_quad); + std::vector > shape_values (n_q_points); if (mapping_type == covariant) mapping.transform_covariant(fe_data.shape_values[i], offset, shape_values, mapping_data); @@ -754,7 +756,7 @@ FE_PolyTensor::fill_fe_subface_values ( shape_values, mapping_data); // then copy over to target: - for (unsigned int k=0; k::fill_fe_subface_values ( for (unsigned int d=0; d::fill_fe_subface_values ( if (flags & update_gradients) { - std::vector > shape_grads1 (n_quad); - std::vector > shape_grads2 (n_quad); + std::vector > shape_grads1 (n_q_points); + std::vector > shape_grads2 (n_q_points); switch (mapping_type) { @@ -798,8 +800,8 @@ FE_PolyTensor::fill_fe_subface_values ( { mapping.transform_covariant(fe_data.shape_grads[i], offset, shape_grads1, mapping_data); - for (unsigned int k=0; k::fill_fe_subface_values ( mapping.transform_covariant(fe_data.shape_grads[i], offset, shape_grads1, mapping_data); - for (unsigned int q=0; q::fill_fe_subface_values ( shape_grads2, mapping_data); - for (unsigned int k=0; k::fill_fe_subface_values ( const double J = data.cell_JxW_values[k] / quadrature.weight(k); data.shape_gradients[first+d][k] - = /* sign_change[i] * */ shape_grads2[k][d] / J; + = sign_change[i] * shape_grads2[k][d] / J; } break; } -- 2.39.5