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 
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,
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,
107  };
108  }
109 
119  template <int dim>
120  class Particles : public Interface<dim>, public ::aspect::SimulatorAccess<dim>
121  {
122  public:
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
175 
179  void
181 
182  private:
189  std::vector<double> output_interval;
190 
194  std::vector<double> last_output_time;
195 
205  void set_last_output_time (const unsigned int particle_manager,
206  const double current_time);
207 
212  std::vector<unsigned int> output_file_number;
213 
217  std::vector<std::vector<std::string>> output_formats;
218 
230  std::map<std::string,std::vector<std::pair<double,std::string>>> times_and_pvtu_file_names;
231 
241  std::map<std::string,std::vector<std::vector<std::string>>> output_file_names_by_timestep;
242 
251  std::map<std::string,std::vector<XDMFEntry>> xdmf_entries;
252 
260  unsigned int group_files;
261 
271 
280 
285  std::thread background_thread;
286 
293  std::vector<std::vector<std::string>> exclude_output_properties;
294 
302  static
303  void writer (const std::string &filename,
304  const std::string &temporary_filename,
305  const std::string &file_contents);
306 
327  const std::string &description_file_prefix,
328  const std::string &solution_file_directory,
329  const std::string &solution_file_prefix,
330  const std::vector<std::string> &filenames);
331  };
332  }
333 }
334 
335 #endif
std::vector< unsigned int > output_file_number
Definition: particles.h:212
std::vector< double > last_output_time
Definition: particles.h:194
std::pair< std::string, std::string > execute(TableHandler &statistics) override
void set_last_output_time(const unsigned int particle_manager, const double current_time)
std::map< std::string, std::vector< std::pair< double, std::string > > > times_and_pvtu_file_names
Definition: particles.h:230
void write_description_files(const internal::ParticleOutput< dim > &data_out, const std::string &description_file_prefix, const std::string &solution_file_directory, const std::string &solution_file_prefix, const std::vector< std::string > &filenames)
std::string temporary_output_location
Definition: particles.h:270
std::map< std::string, std::vector< XDMFEntry > > xdmf_entries
Definition: particles.h:251
static void writer(const std::string &filename, const std::string &temporary_filename, const std::string &file_contents)
void load(const std::map< std::string, std::string > &status_strings) override
void parse_parameters(ParameterHandler &prm) override
std::map< std::string, std::vector< std::vector< std::string > > > output_file_names_by_timestep
Definition: particles.h:241
static void declare_parameters(ParameterHandler &prm)
void serialize(Archive &ar, const unsigned int version)
std::vector< std::vector< std::string > > output_formats
Definition: particles.h:217
void save(std::map< std::string, std::string > &status_strings) const override
std::vector< std::vector< std::string > > exclude_output_properties
Definition: particles.h:293
std::vector< double > output_interval
Definition: particles.h:189
std::vector< std::string > dataset_names
Definition: particles.h:96
std::vector< std::tuple< unsigned int, unsigned int, std::string, DataComponentInterpretation::DataComponentInterpretation > > vector_datasets
Definition: particles.h:106
const std::vector< DataOutBase::Patch< 0, dim > > & get_patches() const override
std::vector< DataOutBase::Patch< 0, dim > > patches
Definition: particles.h:91
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)
std::vector< std::tuple< unsigned int, unsigned int, std::string, DataComponentInterpretation::DataComponentInterpretation > > get_nonscalar_data_ranges() const override
std::vector< std::string > get_dataset_names() const override