ASPECT
particle_pdf.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2025 - by the authors of the ASPECT code.
3 
4  This file is part of ASPECT.
5 
6  ASPECT is free software; you can redistribute it and/or modify
7  it under the terms of the GNU General Public License as published by
8  the Free Software Foundation; either version 2, or (at your option)
9  any later version.
10 
11  ASPECT is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  GNU General Public License for more details.
15 
16  You should have received a copy of the GNU General Public License
17  along with ASPECT; see the file LICENSE. If not see
18  <http://www.gnu.org/licenses/>.
19 */
20 
21 #ifndef _aspect_postprocess_particle_pdf_h
22 #define _aspect_postprocess_particle_pdf_h
23 
26 #include <algorithm>
27 #include <limits>
28 #include <deal.II/base/table.h>
29 #include <deal.II/particles/property_pool.h>
31 #include <deal.II/base/function_lib.h>
32 
33 namespace aspect
34 {
35  namespace Postprocess
36  {
46  template <int dim>
48  {
49  public:
50 
56  enum class KernelFunctions
57  {
58  gaussian,
59  triangular,
60  uniform,
62  };
63 
74  ParticlePDF(const unsigned int granularity, const double bandwidth,KernelFunctions kernel_function);
75 
84  ParticlePDF(const double bandwidth,KernelFunctions kernel_function);
85 
91  void fill_from_particle_range(const typename Particle::ParticleHandler<dim>::particle_iterator_range particle_range,
92  const unsigned int n_particles_in_cell);
93 
105  const Point<dim> reference_point,
106  std::array<unsigned int,dim> table_index,
107  const unsigned int n_particles_in_cell,
108  const typename Particle::ParticleHandler<dim>::particle_iterator_range particle_range);
109 
117  void add_value_to_function_table(const unsigned int x_index,
118  const unsigned int y_index,
119  const unsigned int z_index,
120  const double input_value);
121 
128  std::array<unsigned int,dim> &index_point,
129  const double input_value);
130 
138  const double input_value,
139  types::particle_index reference_particle_id);
140 
148  const unsigned int x_index,
149  const unsigned int y_index,
150  const unsigned int z_index) const;
151 
156 
160  double get_max();
161 
162 
166  double get_min();
167 
171  double get_standard_deviation();
172 
173  private:
180  Table<dim,double> function_output_table;
181 
190  double bandwidth;
191 
197 
203  unsigned int granularity;
204 
208  double max;
209 
213  double min;
214 
219 
223  double mean;
224 
230  std::vector<double> function_output_vector;
231 
238 
243  types::particle_index max_particle_index;
244 
249  types::particle_index min_particle_index;
250 
258  double apply_selected_kernel_function(const double distance) const;
259 
265  double kernelfunction_uniform(const double distance) const;
266 
272  double kernelfunction_triangular(const double distance) const;
273 
279  double kernelfunction_gaussian(const double distance) const;
280 
281  };
282  }
283 }
284 
285 #endif
double kernelfunction_triangular(const double distance) const
void add_value_to_function_table(const unsigned int x_index, const unsigned int y_index, const unsigned int z_index, const double input_value)
void fill_from_particle_range(const typename Particle::ParticleHandler< dim >::particle_iterator_range particle_range, const unsigned int n_particles_in_cell)
void insert_kernel_sum_from_particle_range(const Point< dim > reference_point, std::array< unsigned int, dim > table_index, const unsigned int n_particles_in_cell, const typename Particle::ParticleHandler< dim >::particle_iterator_range particle_range)
types::particle_index max_particle_index
Definition: particle_pdf.h:243
std::vector< double > function_output_vector
Definition: particle_pdf.h:230
double kernelfunction_gaussian(const double distance) const
ParticlePDF(const unsigned int granularity, const double bandwidth, KernelFunctions kernel_function)
types::particle_index min_particle_index
Definition: particle_pdf.h:249
double evaluate_function_at_index(const unsigned int x_index, const unsigned int y_index, const unsigned int z_index) const
double apply_selected_kernel_function(const double distance) const
double kernelfunction_uniform(const double distance) const
Table< dim, double > function_output_table
Definition: particle_pdf.h:180