From: Sebastian Kinnewig Date: Sun, 14 Apr 2024 16:30:15 +0000 (+0200) Subject: Implement get_shape_value_component(), get_shape_grad_component() and get_shape_grad_... X-Git-Tag: v9.6.0-rc1~368^2~3 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=367ec436ebcdfce3b2672d4245c9b35573683a04;p=dealii.git Implement get_shape_value_component(), get_shape_grad_component() and get_shape_grad_grad_component(). --- 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]; }