dolfin team mailing list archive
-
dolfin team
-
Mailing list archive
-
Message #23025
[Question #156272]: Computing numerical integral of a function on a cell
New question #156272 on DOLFIN:
https://answers.launchpad.net/dolfin/+question/156272
Hi all,
I have a very simple question that, for some reason, I'm having a hell
of a time figuring out. I need to evaluate the integral of some
function on each cell -- in order to determine whether or not to
subdivide the cell in question. With Deal.II, I would do something like
the following:
Let 'density' be the function that should be integrated on the cell.
Then
fe_values.reinit (cell);
quadrature_points = fe_values.get_quadrature_points();
// Compute the function value in the cell's quadrature points
density.value_list(quadrature_points,function_values);
// Integral is function values dotted with the Jacobian-times-weights.
double cell_density = 0;
for(size_t q=0;q<N_q;q++)
cell_density += function_values[q]*fe_values.JxW(q);
computes the cell-integral, where the types above are as follows:
Function<dim> density; // This is a continuous function, like the FEniCS 'Expression' class.
FEValues<dim> fe_values(fe, quadrature_formula, update_quadrature_points | update_JxW_values);
vector< Point<dim> > quadrature_points(N_q);
I've been searching both the documentation and the source code for a
long time, and I still haven't figured out how to do this with
Dolfin. It seems I'm completely blind; a bit of help crossing the
street would be much appreciated!
Many thanks in advance.
Cheers,
James
--
You received this question notification because you are a member of
DOLFIN Team, which is an answer contact for DOLFIN.