From 367ec436ebcdfce3b2672d4245c9b35573683a04 Mon Sep 17 00:00:00 2001 From: Sebastian Kinnewig Date: Sun, 14 Apr 2024 18:30:15 +0200 Subject: [PATCH] Implement get_shape_value_component(), get_shape_grad_component() and get_shape_grad_grad_component(). --- source/fe/fe_nedelec_sz.cc | 70 +++++++++++++++++++++++++++++--------- 1 file changed, 54 insertions(+), 16 deletions(-) diff --git a/source/fe/fe_nedelec_sz.cc b/source/fe/fe_nedelec_sz.cc index 6f05014fa2..5fe7376245 100644 --- a/source/fe/fe_nedelec_sz.cc +++ b/source/fe/fe_nedelec_sz.cc @@ -162,13 +162,25 @@ FE_NedelecSZ::shape_value(const unsigned int /*i*/, template double FE_NedelecSZ::shape_value_component( - const unsigned int /*i*/, - const Point & /*p*/, - const unsigned int /*component*/) const + const unsigned int i, + const Point &p, + const unsigned int component) const { - // Not implemented yet: - DEAL_II_NOT_IMPLEMENTED(); - return 0.; + AssertIndexRange(i, this->n_dofs_per_cell()); + AssertIndexRange(component, dim); + + std::unique_ptr< + typename dealii::FiniteElement::InternalDataBase> + data_ptr = std::make_unique(); + + std::vector> p_list = {p}; + + // compute the data + this->evaluate(p_list, update_values, data_ptr); + + // access the data + auto &data = dynamic_cast(*data_ptr); + return data.shape_values[i][0][component]; } @@ -187,12 +199,25 @@ FE_NedelecSZ::shape_grad(const unsigned int /*i*/, template Tensor<1, dim> FE_NedelecSZ::shape_grad_component( - const unsigned int /*i*/, - const Point & /*p*/, - const unsigned int /*component*/) const + const unsigned int i, + const Point &p, + const unsigned int component) const { - DEAL_II_NOT_IMPLEMENTED(); - return Tensor<1, dim>(); + AssertIndexRange(i, this->n_dofs_per_cell()); + AssertIndexRange(component, dim); + + std::unique_ptr< + typename dealii::FiniteElement::InternalDataBase> + data_ptr = std::make_unique(); + + std::vector> p_list = {p}; + + // compute the data + this->evaluate(p_list, update_gradients, data_ptr); + + // access the data + auto &data = dynamic_cast(*data_ptr); + return data.shape_grads[i][0][component]; } @@ -211,12 +236,25 @@ FE_NedelecSZ::shape_grad_grad(const unsigned int /*i*/, template Tensor<2, dim> FE_NedelecSZ::shape_grad_grad_component( - const unsigned int /*i*/, - const Point & /*p*/, - const unsigned int /*component*/) const + const unsigned int i, + const Point &p, + const unsigned int component) const { - DEAL_II_NOT_IMPLEMENTED(); - return Tensor<2, dim>(); + AssertIndexRange(i, this->n_dofs_per_cell()); + AssertIndexRange(component, dim); + + std::unique_ptr< + typename dealii::FiniteElement::InternalDataBase> + data_ptr = std::make_unique(); + + std::vector> p_list = {p}; + + // compute the data + this->evaluate(p_list, update_hessians, data_ptr); + + // access the data + auto &data = dynamic_cast(*data_ptr); + return data.shape_hessians[i][0][component]; } -- 2.39.5