ASPECT
cpo_bingham_average.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2023 - 2026 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 
38 
48  enum class RotationFormat
49  {
51  };
52 
110  template <int dim>
111  class CpoBinghamAverage : public Interface<dim>, public ::aspect::SimulatorAccess<dim>
112  {
113  public:
117  CpoBinghamAverage() = default;
118 
123  void
124  initialize () override;
125 
126  void
127  update () override;
128 
140  void
141  initialize_one_particle_property (const Point<dim> &position,
142  std::vector<double> &particle_properties) const override;
143 
147  void
148  update_particle_properties (const ParticleUpdateInputs<dim> &inputs,
149  typename ParticleHandler<dim>::particle_iterator_range &particles) const override;
150 
156  need_update () const override;
157 
162  get_update_flags (const unsigned int component) const override;
163 
171  std::vector<std::pair<std::string, unsigned int>>
172  get_property_information() const override;
173 
183  std::array<std::array<double,6>,3>
184  compute_bingham_average(std::vector<Tensor<2,3>> matrices, std::integral_constant<int,6>) const;
185 
186  std::array<std::array<double,4>,3>
187  compute_bingham_average(std::vector<Tensor<2,3>> matrices, std::integral_constant<int,4>) const;
188 
189  std::pair<std::array<double, 4>, std::array<std::array<double,2>,3>>
190  compute_bingham_average(std::vector<Tensor<2,3>> matrices, std::integral_constant<int,2>) const;
191 
195  static
196  void
198 
202  void
203  parse_parameters (ParameterHandler &prm) override;
204 
205  private:
209  unsigned int cpo_data_position;
210 
216 
226  mutable std::mt19937 random_number_generator;
227 
234  unsigned int random_number_seed;
235 
239  unsigned int n_grains;
240 
244  unsigned int n_minerals;
245 
251  unsigned int n_samples;
252 
259  };
260  }
261  }
262 }
263 
264 #endif
void declare_parameters(ParameterHandler &prm)
UpdateFlags
const Particle::Property::CrystalPreferredOrientation< dim > * cpo_particle_property
RotationFormat
This determines whether the mean crystal orientation is output as a rotation matrix, euler angles, or a quaternion.
boost::iterator_range< particle_iterator > particle_iterator_range