From bf41eeb5f14d995dd7074b5cdfecaff38557286d Mon Sep 17 00:00:00 2001 From: Bruno Blais Date: Tue, 26 Nov 2019 17:05:00 -0500 Subject: [PATCH] Fixed data out according to comments - Removed now useless comments - Pruned out includes that were not needed - Added documentation for constructor and destructor - Removed useless line in the test documentation --- include/deal.II/particles/data_out.h | 42 ++++++++++------------------ source/particles/data_out.cc | 8 +----- tests/particles/data_out_01.cc | 13 +++------ 3 files changed, 20 insertions(+), 43 deletions(-) diff --git a/include/deal.II/particles/data_out.h b/include/deal.II/particles/data_out.h index 67ef100a04..39374a2544 100644 --- a/include/deal.II/particles/data_out.h +++ b/include/deal.II/particles/data_out.h @@ -15,27 +15,19 @@ #ifndef dealii_particles_data_out_h #define dealii_particles_data_out_h -#include +#include + #include #include -#include -#include - -#include -#include +#include -#include -#include -#include +#include +#include -#include -#include DEAL_II_NAMESPACE_OPEN -#ifdef DEAL_II_WITH_P4EST - namespace Particles { /** @@ -49,24 +41,28 @@ namespace Particles * * @author Bruno Blais, Luca Heltai 2019 */ - template class DataOut : public dealii::DataOutInterface<0, spacedim> { public: + /** + *Default constructor for the Particles::DataOut class. + */ DataOut() = default; + /** + *Default destructor for the Particles::DataOut class. + */ ~DataOut() = default; /** - * Build the particles for a given partcle handler + * Build the patches for a given particles handler. * - * @param [in] particle_handler A particle handler for which the patches will be build - * A dim=0 patch is build for each particle. The position of the particle is + * @param [in] particle_handler A particle handler for which the patches will be built + * A dim=0 patch is built for each particle. The position of the particle is * used to build the node position and the ID of the particle is added as a - * single data element - * + * single data element. * * @author Bruno Blais, Luca Heltai 2019 */ @@ -80,9 +76,6 @@ namespace Particles */ virtual const std::vector> & get_patches() const override; - // { - // return patches; - // } /** * Returns the name of the data sets associated with the patches. In the @@ -90,9 +83,6 @@ namespace Particles */ virtual std::vector get_dataset_names() const override; - // { - // return dataset_names; - // } private: std::vector> patches; @@ -105,8 +95,6 @@ namespace Particles } // namespace Particles -#endif // DEAL_II_WITH_P4EST - DEAL_II_NAMESPACE_CLOSE #endif diff --git a/source/particles/data_out.cc b/source/particles/data_out.cc index 68b7e4ba08..44a249a14d 100644 --- a/source/particles/data_out.cc +++ b/source/particles/data_out.cc @@ -18,8 +18,6 @@ DEAL_II_NAMESPACE_OPEN -#ifdef DEAL_II_WITH_P4EST - namespace Particles { template @@ -59,14 +57,10 @@ namespace Particles } // namespace Particles -#endif // DEAL_II_WITH_P4EST - DEAL_II_NAMESPACE_CLOSE DEAL_II_NAMESPACE_OPEN -#ifdef DEAL_II_WITH_P4EST -# include "data_out.inst" -#endif +#include "data_out.inst" DEAL_II_NAMESPACE_CLOSE diff --git a/tests/particles/data_out_01.cc b/tests/particles/data_out_01.cc index 027cff7dbe..560f905e8b 100644 --- a/tests/particles/data_out_01.cc +++ b/tests/particles/data_out_01.cc @@ -43,8 +43,7 @@ test() tr.refine_global(2); MappingQ mapping(1); - // both processes create a particle handler, but only the first creates - // particles + // Create a particle handler using two manually created particles Particles::ParticleHandler particle_handler(tr, mapping); std::vector> position(2); std::vector> reference_position(2); @@ -72,13 +71,9 @@ test() particle_handler.insert_particle(particle1, cell1); particle_handler.insert_particle(particle2, cell2); - Particles::DataOut particle_viz; - particle_viz.build_patches(particle_handler); - particle_viz.write_gnuplot(deallog.get_file_stream()); - - // for (const auto &particle : particle_handler) - // deallog << "Particle id " << particle.get_id() << " is in cell " - // << particle.get_surrounding_cell(tr) << std::endl; + Particles::DataOut particle_output; + particle_output.build_patches(particle_handler); + particle_output.write_gnuplot(deallog.get_file_stream()); } deallog << "OK" << std::endl; -- 2.39.5