Dr. Bangerth, Thank you for your hints. I tried using shape_value, but it seems finite_element_output is a protected member. The error shows as follows: error: ‘dealii::internal::FEValuesImplementation::FiniteElementRelatedData<2, 2> dealii::FEValuesBase<2, 2>::finite_element_output’ is protected within this context 59 | double shape_value = fe_values.finite_element_output.shape_value(i, q_index); ^~~~~~~~~~~~~~~~~~~~~ error: ‘class dealii::internal::FEValuesImplementation::FiniteElementRelatedData<2, 2>’ has no member named ‘shape_value’; did you mean ‘shape_values’? By the way, I also want to get the shape_grad of the reference cell to compare with some other code implementation regarding shape function. Based on Thong’s method, the following codes gives me the desired results for a Q1 element: const FE_Q<2> Q_2d_element(1); const Point<2> center(1, 1); for(unsigned int i=0; i<Q_2d_element.n_dofs_per_cell(); i++) { std::cout << " shape value = " << Q_2d_element.shape_value(i, center); std::cout << " shape grad = " << Q_2d_element.shape_grad(i, center) << std::endl; } I wonder if there are other ways to access the shape_grad on the ref cell directly. Do I need to use fe_values.inverse_jacobian(q_index) to convert from shape_grad on the real cell to the reference cell? Best, Michael From: Wolfgang Bangerth On 9/10/21 4:48 PM, Michael Lee wrote: > > I want to require the value of a shape function at some quadrature point. But > the following code throws an error saying finite_element_output is protected. > double shape_value = fe_values.finite_element_output.shape_values(i, q_index); > You already solved the problem, but just for completeness: You get the error because you try to access a 'protected' member variable called 'shape_values' (plural). What you want is to use the 'public' member function 'shape_value' (singular). Best W. -- ------------------------------------------------------------------------ Wolfgang Bangerth email: [email protected] www: http://www.math.colostate.edu/~bangerth/ -- The deal.II project is located at http://www.dealii.org/ For mailing list/forum options, see https://groups.google.com/d/forum/dealii?hl=en --- You received this message because you are subscribed to the Google Groups "deal.II User Group" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/dealii/8cd6a2e7-5ad5-fbf5-3240-3237352335a9%40colostate.edu. The deal.II project is located at http://www.dealii.org/ For mailing list/forum options, see https://groups.google.com/d/forum/dealii?hl=en --- You received this message because you are subscribed to the Google Groups "deal.II User Group" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/dealii/8ACD76BA-4163-4FFB-832E-01D37DCF18C0%40hxcore.ol. |
- Re: [deal.II] How to get the shape_value at the quadratu... Wolfgang Bangerth
- RE: [deal.II] How to get the shape_value at the qua... Michael Li
- Re: [deal.II] How to get the shape_value at the... Wolfgang Bangerth
