> I need to build a Function object —to be sent to
> MatrixCreator::create_laplace_matrix— that is derived from a nodal field.
> 
> Thanks to the tutorials, I can easily do the assembly "by hand":
>   - I define a Vector<double> level_set that is given some values at the
> nodes by some process;
>   - Before looping over the cells, I define a std::vector<double>
> level_set_values(nb_q_points);
>   - Inside the loops over the cells, I compute the value of the field on
> all quadrature points through fe_values.get_function_values(level_set,
> level_set_values);
>   - Then I loop over the quadrature points and the degrees of freedom,
> and compute the cell matrix through if (level_set_values[q_point] > 0.)
> cell_mat(i,j) += [...] else cell_mat(i,j) += [...].
> 
> But, for obvious reasons, I would like to use the wonderful
> MatrixCreator::create_laplace_matrix to assemble the matrix. Is there a
> way to build the required Function object?

The facility you are looking for is the FEFieldFunction class. That said, I 
would still do it the way you describe because it is more efficient: The 
FEFieldFunction class acts like a Function object but that means that every 
time you ask for the value of this function at a particular quadrature point, 
FEFieldFunction needs to go find which cell this quadrature point lies in, 
where on this cell the point is, etc. That's a pretty inefficient way to do 
things, compared to the knowledge you put into your solution:
- you already know what cell you are on
- you know that in reference coordinates the quadrature points are always in 
the same location

But maybe it doesn't matter. Give it a try :-)

Best
 W.

-------------------------------------------------------------------------
Wolfgang Bangerth                email:            [email protected]
                                 www: http://www.math.tamu.edu/~bangerth/
_______________________________________________
dealii mailing list http://poisson.dealii.org/mailman/listinfo/dealii

Reply via email to