Computing numerical integral of a function on a cell
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.
// Compute the function value in the cell's quadrature points
density.
// Integral is function values dotted with the Jacobian-
double cell_density = 0;
for(size_t q=0;q<N_q;q++)
cell_density += function_
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_
vector< Point<dim> > quadrature_
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
Question information
- Language:
- English Edit question
- Status:
- Solved
- For:
- DOLFIN Edit question
- Assignee:
- No assignee Edit question
- Solved by:
- Marie Rognes
- Solved:
- Last query:
- Last reply: