16#ifndef dealii_particles_utilities
17#define dealii_particles_utilities
94 template <
int dim,
int spacedim,
typename number =
double>
147 template <
int dim,
int spacedim,
typename MatrixType>
181 typename InputVectorType,
182 typename OutputVectorType>
187 const InputVectorType & field_vector,
188 OutputVectorType & interpolated_field,
197 const auto &fe = field_dh.
get_fe();
198 auto particle = particle_handler.
begin();
202 (field_comps.size() == 0 ?
ComponentMask(fe.n_components(),
true) :
213 std::vector<unsigned int> space_gtl(fe.n_components(),
215 for (
unsigned int i = 0, j = 0; i < space_gtl.size(); ++i)
219 std::vector<types::global_dof_index> dof_indices(fe.n_dofs_per_cell());
221 while (particle != particle_handler.
end())
223 const auto &cell = particle->get_surrounding_cell();
224 const auto &dh_cell =
226 dh_cell->get_dof_indices(dof_indices);
230 for (
unsigned int i = 0; particle != pic.end(); ++particle, ++i)
233 particle->get_reference_location();
235 const auto id = particle->get_id();
237 for (
unsigned int j = 0; j < fe.n_dofs_per_cell(); ++j)
240 space_gtl[fe.system_to_component_index(j).first];
242 interpolated_field[
id * n_comps + comp_j] +=
243 fe.shape_value(j, reference_location) *
244 field_vector(dof_indices[j]);
unsigned int size() const
unsigned int n_selected_components(const unsigned int overall_number_of_components=numbers::invalid_unsigned_int) const
const FiniteElement< dim, spacedim > & get_fe(const types::fe_index index=0) const
types::global_dof_index n_dofs() const
particle_iterator begin() const
particle_iterator end() const
types::particle_index n_locally_owned_particles() const
particle_iterator_range particles_in_cell(const typename Triangulation< dim, spacedim >::active_cell_iterator &cell)
types::particle_index get_next_free_particle_index() const
#define DEAL_II_NAMESPACE_OPEN
#define DEAL_II_NAMESPACE_CLOSE
#define Assert(cond, exc)
#define AssertDimension(dim1, dim2)
static ::ExceptionBase & ExcInternalError()
typename ActiveSelector::cell_iterator cell_iterator
void interpolate_field_on_particles(const DoFHandler< dim, spacedim > &field_dh, const Particles::ParticleHandler< dim, spacedim > &particle_handler, const InputVectorType &field_vector, OutputVectorType &interpolated_field, const ComponentMask &field_comps=ComponentMask())
void create_interpolation_matrix(const DoFHandler< dim, spacedim > &space_dh, const Particles::ParticleHandler< dim, spacedim > &particle_handler, MatrixType &matrix, const AffineConstraints< typename MatrixType::value_type > &constraints=AffineConstraints< typename MatrixType::value_type >(), const ComponentMask &space_comps=ComponentMask())
void create_interpolation_sparsity_pattern(const DoFHandler< dim, spacedim > &space_dh, const Particles::ParticleHandler< dim, spacedim > &particle_handler, SparsityPatternBase &sparsity, const AffineConstraints< number > &constraints=AffineConstraints< number >(), const ComponentMask &space_comps=ComponentMask())
static const unsigned int invalid_unsigned_int