access coordinates of quadrature points

35 views
Skip to first unread message

Yann Jobic

unread,
Oct 28, 2024, 1:36:53 PM10/28/24
to dea...@googlegroups.com
Hello,

I'm trying to access the coordinates of the quadrature points.
I'm doing :
QGauss<dim> quadrature_formula(degree + 1);
FEValues<dim> fe_values(fe, quadrature_formula,
update_values | update_quadrature_points |
update_JxW_values | update_gradients);
const std::vector<Point<dim>> & q_list =
quadrature_formula.get_points();

in the loop of the quadrature points,
const Point<dim> & GaussPoint = q_list[q];

And when i'm trying to get the values of GaussPoint, with GaussPoint[0]
(in my case dim=2), i've got the error :

--------------------------------------------------------
An error occurred in line <2778> of file
</local/lib/dealii/9.5.2_with_petsc/include/deal.II/base/table.h> in
function
typename dealii::AlignedVector<T>::reference dealii::Table<2,
ElementType>::operator()(dealii::Table<2, ElementType>::size_type,
dealii::Table<2, ElementType>::size_type) [with T = double; typename
dealii::AlignedVector<T>::reference = double&; dealii::Table<2,
ElementType>::size_type = long unsigned int]
The violated condition was:
::dealii::deal_II_exceptions::internals::compare_less_than(i,
this->table_size[0])
Additional information:
Index 4 is not in the half-open range [0,4).

Stacktrace:
-----------
#0 ./step-22: dealii::Table<2, double>::operator()(unsigned long,
unsigned long)
#1 ./step-22: Step22::StokesProblem<2>::compute_residual()
#2 ./step-22: Step22::StokesProblem<2>::run()
#3 ./step-22: main
--------------------------------------------------------

I don't understand why !!

How can i access to those coordinates ?

Many thanks,

Yann

Yann Jobic

unread,
Oct 28, 2024, 5:24:20 PM10/28/24
to dea...@googlegroups.com
I found my mistake. The written code works fine, but i cannot inspect
the values directly in the debugger. That confused me.
Sorry for polluting the mailing list. Shall both email erased ?
Regards,
Yann

Wolfgang Bangerth

unread,
Oct 28, 2024, 5:54:25 PM10/28/24
to dea...@googlegroups.com

On 10/28/24 15:24, Yann Jobic wrote:
>
> I found my mistake. The written code works fine, but i cannot inspect
> the values directly in the debugger. That confused me.
> Sorry for polluting the mailing list. Shall both email erased ?

You can, but you don't need to.

I'm glad you found the issue. My initial thought reading your question
was that you're looking at the wrong statement and that the statement
you pointed out probably did not cause the error. It seems like that was
the right guess.

Best
W.
Reply all
Reply to author
Forward
0 new messages