ASPECT
particles.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2011 - 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_postprocess_particle_h
22 #define _aspect_postprocess_particle_h
23 
25 
28 
29 #include <deal.II/particles/particle_handler.h>
30 #include <deal.II/base/data_out_base.h>
31 
32 #include <thread>
33 #include <tuple>
34 
35 
36 namespace aspect
37 {
38  namespace Postprocess
39  {
40  namespace internal
41  {
49  template <int dim>
50  class ParticleOutput : public ::DataOutInterface<0,dim>
51  {
52  public:
59  void build_patches(const Particles::ParticleHandler<dim> &particle_handler,
61  const std::vector<std::string> &exclude_output_properties,
62  const bool only_group_3d_vectors);
63 
64  private:
68  const std::vector<DataOutBase::Patch<0,dim>> &
69  get_patches () const override;
70 
74  std::vector<std::string>
75  get_dataset_names () const override;
76 
80  std::vector<
81  std::tuple<unsigned int,
82  unsigned int,
83  std::string,
84  DataComponentInterpretation::DataComponentInterpretation>>
85  get_nonscalar_data_ranges () const override;
86 
91  std::vector<DataOutBase::Patch<0,dim>> patches;
92 
96  std::vector<std::string> dataset_names;
97 
101  std::vector<
102  std::tuple<unsigned int,
103  unsigned int,
104  std::string,
105  DataComponentInterpretation::DataComponentInterpretation>>
107  };
108  }
109 
119  template <int dim>
120  class Particles : public Interface<dim>, public ::aspect::SimulatorAccess<dim>
121  {
122  public:
126  Particles();
127 
131  ~Particles() override;
132 
150  std::pair<std::string,std::string> execute (TableHandler &statistics) override;
151 
155  void save (std::map<std::string, std::string> &status_strings) const override;
156 
160  void load (const std::map<std::string, std::string> &status_strings) override;
161 
166  template <class Archive>
167  void serialize (Archive &ar, const unsigned int version);
168 
172  static
173  void
174  declare_parameters (ParameterHandler &prm);
175 
179  void
180  parse_parameters (ParameterHandler &prm) override;
181 
182  private:
188 
193 
202  void set_last_output_time (const double current_time);
203 
208  unsigned int output_file_number;
209 
213  std::vector<std::string> output_formats;
214 
226  std::map<std::string,std::vector<std::pair<double,std::string>>> times_and_pvtu_file_names;
227 
237  std::map<std::string,std::vector<std::vector<std::string>>> output_file_names_by_timestep;
238 
247  std::map<std::string,std::vector<XDMFEntry>> xdmf_entries;
248 
255  unsigned int group_files;
256 
265 
273 
278  std::thread background_thread;
279 
284  std::vector<std::string> exclude_output_properties;
285 
293  static
294  void writer (const std::string &filename,
295  const std::string &temporary_filename,
296  const std::string &file_contents);
297 
317  void write_description_files (const internal::ParticleOutput<dim> &data_out,
318  const std::string &description_file_prefix,
319  const std::string &solution_file_directory,
320  const std::string &solution_file_prefix,
321  const std::vector<std::string> &filenames);
322  };
323  }
324 }
325 
326 #endif
std::map< std::string, std::vector< XDMFEntry > > xdmf_entries
Definition: particles.h:247
std::vector< std::tuple< unsigned int, unsigned int, std::string, DataComponentInterpretation::DataComponentInterpretation > > get_nonscalar_data_ranges() const override
const std::vector< DataOutBase::Patch< 0, dim > > & get_patches() const override
std::vector< DataOutBase::Patch< 0, dim > > patches
Definition: particles.h:91
std::vector< std::string > get_dataset_names() const override
void declare_parameters(ParameterHandler &prm)
void build_patches(const Particles::ParticleHandler< dim > &particle_handler, const aspect::Particle::Property::ParticlePropertyInformation &property_information, const std::vector< std::string > &exclude_output_properties, const bool only_group_3d_vectors)
Definition: compat.h:59
std::vector< std::string > exclude_output_properties
Definition: particles.h:284
std::map< std::string, std::vector< std::vector< std::string > > > output_file_names_by_timestep
Definition: particles.h:237
std::vector< std::string > dataset_names
Definition: particles.h:96
std::string temporary_output_location
Definition: particles.h:264
std::map< std::string, std::vector< std::pair< double, std::string > > > times_and_pvtu_file_names
Definition: particles.h:226
std::vector< std::tuple< unsigned int, unsigned int, std::string, DataComponentInterpretation::DataComponentInterpretation > > vector_datasets
Definition: particles.h:106
std::vector< std::string > output_formats
Definition: particles.h:213