Hi,
I figured out a way to do the interpolation (Question 2), but still not
sure how to avoid duplicates (Question 1):
I changed the type of DiracDeltaInterpolator::sources to
std::vector<std::tuple<typename DoFHandler<dim>::active_cell_iterator,
unsigned int,
double>>
which stores the cell iterator, id of support point, weight of an
"influential node". So that DiracDeltaInterpolator::interpolate can be
implemented as:
template <int dim, typename VectorType>
void DiracDeltaInterpolator<dim, VectorType>::interpolate(
const VectorType &source_vector,
Vector<typename VectorType::value_type> &target_vector)
{
target_vector = 0;
const FiniteElement<dim> &fe = dof_handler.get_fe();
std::vector<types::global_dof_index> dof_indices(fe.dofs_per_cell);
for (auto p : sources)
{
std::get<0>(p)->get_dof_indices(dof_indices);
// Vector component of this support point
auto d = fe.system_to_component_index(std::get<1>(p));
Assert(d < dim, ExcMessage("Vector component not less than dim!"));
// Global dof index of this support point
auto index = dof_indices[std::get<1>(p)];
// Interpolate
target_vector[d] += std::get<2>(p) * source_vector[index];
}
}
Now the only issue is that same global dof index will be used in multiple
cells, which is undesired. The only fix I can think of is to use a map, in
which the entries are uniquely identified by "support point coordinates +
vector component". But it seems to be too nasty.
Thanks
Jie
--
The deal.II project is located at http://www.dealii.org/
For mailing list/forum options, see
https://groups.google.com/d/forum/dealii?hl=en
---
You received this message because you are subscribed to the Google Groups
"deal.II User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.