ASPECT
cpo_bingham_average.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2023 - 2024 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_particle_property_cpo_bingham_average_h
22 #define _aspect_particle_property_cpo_bingham_average_h
23 
27 
28 #include <array>
29 #include <random>
30 
31 namespace aspect
32 {
33  namespace Particle
34  {
35  namespace Property
36  {
37 
70  template <int dim>
71  class CpoBinghamAverage : public Interface<dim>, public ::aspect::SimulatorAccess<dim>
72  {
73  public:
77  CpoBinghamAverage() = default;
78 
83  void
84  initialize () override;
85 
97  void
98  initialize_one_particle_property (const Point<dim> &position,
99  std::vector<double> &particle_properties) const override;
100 
104  void
106  typename ParticleHandler<dim>::particle_iterator_range &particles) const override;
107 
113  need_update () const override;
114 
118  UpdateFlags
119  get_update_flags (const unsigned int component) const override;
120 
128  std::vector<std::pair<std::string, unsigned int>>
129  get_property_information() const override;
130 
139  std::array<std::array<double,6>,3>
140  compute_bingham_average(std::vector<Tensor<2,3>> matrices) const;
141 
145  static
146  void
147  declare_parameters (ParameterHandler &prm);
148 
152  void
153  parse_parameters (ParameterHandler &prm) override;
154 
155  private:
159  unsigned int cpo_data_position;
160 
165  std::unique_ptr<const Particle::Property::CrystalPreferredOrientation<dim>> cpo_particle_property;
166 
171  mutable std::mt19937 random_number_generator;
172 
176  unsigned int random_number_seed;
177 
181  unsigned int n_grains;
182 
186  unsigned int n_minerals;
187 
191  unsigned int n_samples;
192 
193  };
194  }
195  }
196 }
197 
198 #endif
static void declare_parameters(ParameterHandler &prm)
std::unique_ptr< const Particle::Property::CrystalPreferredOrientation< dim > > cpo_particle_property
std::array< std::array< double, 6 >, 3 > compute_bingham_average(std::vector< Tensor< 2, 3 >> matrices) const
Definition: compat.h:59
void parse_parameters(ParameterHandler &prm) override
UpdateFlags get_update_flags(const unsigned int component) const override
UpdateTimeFlags need_update() const override
void update_particle_properties(const ParticleUpdateInputs< dim > &inputs, typename ParticleHandler< dim >::particle_iterator_range &particles) const override
std::vector< std::pair< std::string, unsigned int > > get_property_information() const override
void initialize_one_particle_property(const Point< dim > &position, std::vector< double > &particle_properties) const override