ASPECT
particles.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2011 - 2022 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 
223  std::vector<std::pair<double,std::string>> times_and_pvtu_file_names;
224 
230  std::vector<std::pair<double,std::vector<std::string>>> times_and_vtu_file_names;
231 
237  std::vector<std::vector<std::string>> output_file_names_by_timestep;
238 
245  std::vector<XDMFEntry> xdmf_entries;
246 
253  unsigned int group_files;
254 
263 
271 
276  std::thread background_thread;
277 
282  std::vector<std::string> exclude_output_properties;
283 
291  static
292  void writer (const std::string &filename,
293  const std::string &temporary_filename,
294  const std::string &file_contents);
295 
312  void write_master_files (const internal::ParticleOutput<dim> &data_out,
313  const std::string &solution_file_prefix,
314  const std::vector<std::string> &filenames);
315  };
316  }
317 }
318 
319 #endif
std::vector< std::tuple< unsigned int, unsigned int, std::string, DataComponentInterpretation::DataComponentInterpretation > > get_nonscalar_data_ranges() const override
std::vector< std::pair< double, std::string > > times_and_pvtu_file_names
Definition: particles.h:223
const std::vector< DataOutBase::Patch< 0, dim > > & get_patches() const override
std::vector< std::pair< double, std::vector< std::string > > > times_and_vtu_file_names
Definition: particles.h:230
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)
std::vector< XDMFEntry > xdmf_entries
Definition: particles.h:245
std::vector< std::string > exclude_output_properties
Definition: particles.h:282
std::vector< std::string > dataset_names
Definition: particles.h:96
std::string temporary_output_location
Definition: particles.h:262
std::vector< std::tuple< unsigned int, unsigned int, std::string, DataComponentInterpretation::DataComponentInterpretation > > vector_datasets
Definition: particles.h:106
std::vector< std::vector< std::string > > output_file_names_by_timestep
Definition: particles.h:237
std::vector< std::string > output_formats
Definition: particles.h:213