Reference documentation for deal.II version 9.2.0
\(\newcommand{\dealvcentcolon}{\mathrel{\mathop{:}}}\) \(\newcommand{\dealcoloneq}{\dealvcentcolon\mathrel{\mkern-1.2mu}=}\) \(\newcommand{\jump}[1]{\left[\!\left[ #1 \right]\!\right]}\) \(\newcommand{\average}[1]{\left\{\!\left\{ #1 \right\}\!\right\}}\)
data_out.cc
Go to the documentation of this file.
1 // ---------------------------------------------------------------------
2 //
3 // Copyright (C) 2017 - 2020 by the deal.II authors
4 //
5 // This file is part of the deal.II library.
6 //
7 // The deal.II library is free software; you can use it, redistribute
8 // it, and/or modify it under the terms of the GNU Lesser General
9 // Public License as published by the Free Software Foundation; either
10 // version 2.1 of the License, or (at your option) any later version.
11 // The full text of the license can be found in the file LICENSE.md at
12 // the top level directory of deal.II.
13 //
14 // ---------------------------------------------------------------------
15 
18 
20 
21 namespace Particles
22 {
23  template <int dim, int spacedim>
24  void
27  {
28  dataset_names.clear();
29  dataset_names.emplace_back("id");
30  patches.resize(particles.n_locally_owned_particles());
31 
32  auto particle = particles.begin();
33  for (unsigned int i = 0; particle != particles.end(); ++particle, ++i)
34  {
35  patches[i].vertices[0] = particle->get_location();
36  patches[i].patch_index = i;
37  patches[i].n_subdivisions = 1;
38  patches[i].data.reinit(dataset_names.size(), 1);
39 
40  patches[i].data(0, 0) = particle->get_id();
41  }
42  }
43 
44 
45 
46  template <int dim, int spacedim>
47  const std::vector<DataOutBase::Patch<0, spacedim>> &
49  {
50  return patches;
51  }
52 
53 
54 
55  template <int dim, int spacedim>
56  std::vector<std::string>
58  {
59  return dataset_names;
60  }
61 
62 } // namespace Particles
63 
64 #include "data_out.inst"
65 
Particles::DataOut::get_dataset_names
virtual std::vector< std::string > get_dataset_names() const override
Definition: data_out.cc:57
particle_handler.h
Particles::DataOut::build_patches
void build_patches(const Particles::ParticleHandler< dim, spacedim > &particles)
Definition: data_out.cc:25
Particles
Definition: data_out.h:27
DEAL_II_NAMESPACE_OPEN
#define DEAL_II_NAMESPACE_OPEN
Definition: config.h:358
Particles::ParticleHandler::end
particle_iterator end() const
Definition: particle_handler.cc:247
Particles::ParticleHandler::n_locally_owned_particles
types::particle_index n_locally_owned_particles() const
Definition: particle_handler.cc:673
Particles::ParticleHandler
Definition: data_out.h:30
Particles::DataOut::get_patches
virtual const std::vector< DataOutBase::Patch< 0, spacedim > > & get_patches() const override
Definition: data_out.cc:48
DEAL_II_NAMESPACE_CLOSE
#define DEAL_II_NAMESPACE_CLOSE
Definition: config.h:359
Particles::ParticleHandler::begin
particle_iterator begin() const
Definition: particle_handler.cc:229
data_out.h