Jie,
I've tried to read your question a couple of times, but I can't seem to figure out what exactly you want to do. I understand the definition of the delta function located around a given point 'p', but what is (in mathematical formulas) what you want to do in the interpolation process? You have an input and an output vector, but I don't think I understand how they are related.


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];

Can you explain what your tuple now contains? In your first implementation, it 
was
  * cell
  * index of a dof within a cell
But it's not clear to me whether that is still true here. Also, system_to_component_index() returns a std::pair, so that's going to be the data type of 'd'. But then you can write 'd<dim" in the next line, nor 'target_vector[d]' in the last line.

Best
 W.

--
------------------------------------------------------------------------
Wolfgang Bangerth          email:                 [email protected]
                           www: http://www.math.colostate.edu/~bangerth/

--
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.

Reply via email to