16 #ifndef dealii_particles_utilities 17 #define dealii_particles_utilities 98 typename SparsityType,
99 typename number =
double>
104 SparsityType & sparsity,
154 template <
int dim,
int spacedim,
typename MatrixType>
190 typename InputVectorType,
191 typename OutputVectorType>
196 const InputVectorType & field_vector,
197 OutputVectorType & interpolated_field,
207 const auto &fe = field_dh.
get_fe();
208 auto particle = particle_handler.
begin();
212 (field_comps.size() == 0 ?
ComponentMask(fe.n_components(),
true) :
223 std::vector<unsigned int> space_gtl(fe.n_components(),
225 for (
unsigned int i = 0, j = 0; i < space_gtl.size(); ++i)
229 std::vector<types::global_dof_index> dof_indices(fe.dofs_per_cell);
231 while (particle != particle_handler.
end())
233 const auto &cell = particle->get_surrounding_cell(tria);
234 const auto &dh_cell =
236 dh_cell->get_dof_indices(dof_indices);
240 for (
unsigned int i = 0; particle != pic.end(); ++particle, ++i)
242 const auto &reference_location =
243 particle->get_reference_location();
245 const auto id = particle->get_id();
247 for (
unsigned int j = 0; j < fe.dofs_per_cell; ++j)
250 space_gtl[fe.system_to_component_index(j).first];
252 interpolated_field[
id * n_comps + comp_j] +=
253 fe.shape_value(j, reference_location) *
254 field_vector(dof_indices[j]);
const Triangulation< dim, spacedim > & get_triangulation() const
static const unsigned int invalid_unsigned_int
#define AssertDimension(dim1, dim2)
types::particle_index n_locally_owned_particles() const
Contents is actually a matrix.
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())
const FiniteElement< dim, spacedim > & get_fe(const unsigned int index=0) const
#define Assert(cond, exc)
particle_iterator_range particles_in_cell(const typename Triangulation< dim, spacedim >::active_cell_iterator &cell)
#define DEAL_II_NAMESPACE_CLOSE
types::global_dof_index n_dofs() const
particle_iterator begin() const
unsigned int size() const
types::particle_index get_next_free_particle_index() const
#define DEAL_II_NAMESPACE_OPEN
unsigned int n_selected_components(const unsigned int overall_number_of_components=numbers::invalid_unsigned_int) const
void create_interpolation_sparsity_pattern(const DoFHandler< dim, spacedim > &space_dh, const Particles::ParticleHandler< dim, spacedim > &particle_handler, SparsityType &sparsity, const AffineConstraints< number > &constraints=AffineConstraints< number >(), const ComponentMask &space_comps=ComponentMask())
typename ActiveSelector::cell_iterator cell_iterator
particle_iterator end() const
static ::ExceptionBase & ExcInternalError()
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())