Dear Jakob,
yes, this is roughly how we do it.
You have a list of possible quadrature point selection (and therefore fevalues), that can be combined together, and that you use to initialize the fevalues for cell_i and cell_j (that may well be the same).
I’m assuming this selection is done in a class that stores these guys (you don’t want to recreate them from scratch), and then returns with a member function (e.g., fev_with_sauter_schwab_quadrature) a reference to your two initialized FEValues.
However, in your case, you’d have to specify “contiguous”: both dof indices map to the same dofhandler, so you need to make sure that the loop over all indices is actually a loop over both cell_i and cell_j indices.
Your local matrix will look like this
A11 | A12
A =
A21 | A22
where A11 will contain interaction between dofs in cell_i, A22 those in cell j, and the off-diagonal will contain the interaction between dofs con cell_i and dofs on cell_j. The major role of FECouplingValues is to make this more readable, i.e.,
// Extractor on first cell
const auto extv = cfv.get_first_extractor(FEValuesExtractor::Scalar(0));
// Extractor on second cell
const auto extu = cfv.get_second_extractor(FEValuesExtractor::Scalar(0));
...
for (const unsigned int q : cfv.quadrature_point_indices()) {
const auto &[x_q,y_q] = cfv.quadrature_point(q);
for (const unsigned int i : cfv.first_dof_indices())
{
const auto &v_i = cfv[extv].value(i, q);
for (const unsigned int j : cfv.second_dof_indices())
{
const auto &u_j = cfv[extu].value(j, q);
local_matrix(i, j) += (Kernel(x_q, y_q) * v_i * u_j * cfv[0].JxW(q) * cfv[1].JxW(q));
}
}
}
fe_values_1.get_dof_indices(d1);
fe_values_2.get_dof_indices(d2);
auto coupling_dof_indices =
fecv.get_coupling_dof_indices(d1, d2);
constraints.distribute_local_to_global(local_matrix, coupling_dof_indices, global_matrix);
As far as your concerns about maybe saving a few quadrature points, the cost of this would be an additional indirection (i.e., you would have to map what unique quadrature point maps to what quadrature index). I’m unsure that saving in that direction would really be effective (remember: premature optimization is the source of all evils). Unless you know for a fact that it would be a problem to replicate a few quadrature points, I would not bother, at least in the first round of implementation. Once you have a working version, then you should profile it, and see where you are spending the most time.
It may be that this is going to be in the repeated quadrature points, but it may also be, in fact, that having those repeated but saving one indirection is faster.
Hope this helps.
L.
> To view this discussion visit
https://groups.google.com/d/msgid/dealii/eaad257b-d3a2-4745-a556-834203d18911n%40googlegroups.com.