ASPECT
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
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 
73  template <int dim>
74  class CpoBinghamAverage : public Interface<dim>, public ::aspect::SimulatorAccess<dim>
75  {
76  public:
80  CpoBinghamAverage() = default;
81 
86  void
87  initialize () override;
88 
100  void
101  initialize_one_particle_property (const Point<dim> &position,
102  std::vector<double> &particle_properties) const override;
103 
107  void
109  typename ParticleHandler<dim>::particle_iterator_range &particles) const override;
110 
116  need_update () const override;
117 
121  UpdateFlags
122  get_update_flags (const unsigned int component) const override;
123 
131  std::vector<std::pair<std::string, unsigned int>>
132  get_property_information() const override;
133 
143  std::array<std::array<double,6>,3>
144  compute_bingham_average(std::vector<Tensor<2,3>> matrices, std::integral_constant<int,6>) const;
145 
146  std::array<std::array<double,4>,3>
147  compute_bingham_average(std::vector<Tensor<2,3>> matrices, std::integral_constant<int,4>) const;
148 
152  static
153  void
154  declare_parameters (ParameterHandler &prm);
155 
159  void
160  parse_parameters (ParameterHandler &prm) override;
161 
162  private:
166  unsigned int cpo_data_position;
167 
172  std::unique_ptr<const Particle::Property::CrystalPreferredOrientation<dim>> cpo_particle_property;
173 
178  mutable std::mt19937 random_number_generator;
179 
183  unsigned int random_number_seed;
184 
188  unsigned int n_grains;
189 
193  unsigned int n_minerals;
194 
198  unsigned int n_samples;
199 
200  /*
201  this sets whether the orientations are represented by rotation matrix or Euler angles.
202  */
204 
205  };
206  }
207  }
208 }
209 
210 #endif
static void declare_parameters(ParameterHandler &prm)
std::unique_ptr< const Particle::Property::CrystalPreferredOrientation< dim > > cpo_particle_property
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
std::array< std::array< double, 6 >, 3 > compute_bingham_average(std::vector< Tensor< 2, 3 >> matrices, std::integral_constant< int, 6 >) const