29 const std::vector<std::string> &data_component_names,
30 const std::vector<DataComponentInterpretation::DataComponentInterpretation>
31 &data_component_interpretations_)
34 data_component_names.size() == data_component_interpretations_.size(),
36 "When calling Particles::DataOut::build_patches with data component "
37 "names and interpretations you need to provide as many data component "
38 "names as interpretations. Provide the same name for components that "
39 "belong to a single vector or tensor."));
41 if ((data_component_names.size() > 0) &&
47 "You called Particles::DataOut::build_patches with data component "
48 "names and interpretations, but the particles do not seem to own "
52 data_component_names.size() ==
55 "When calling Particles::DataOut::build_patches with data component "
56 "names and interpretations you need to provide as many data component "
57 "names as the particles have properties."));
63 data_component_names.begin(),
64 data_component_names.end());
71 data_component_interpretations_.begin(),
72 data_component_interpretations_.end());
74 const unsigned int n_property_components = data_component_names.size();
79 auto particle = particles.
begin();
80 for (
unsigned int i = 0; particle != particles.
end(); ++particle, ++i)
82 patches[i].vertices[0] = particle->get_location();
86 patches[i].data.reinit(n_data_components, 1);
88 patches[i].data(0, 0) = particle->get_id();
90 if (n_data_components > 1)
93 for (
unsigned int property_index = 0;
94 property_index < n_property_components;
96 patches[i].data(property_index + 1, 0) =
97 properties[property_index];
131 std::tuple<
unsigned int,
144 const unsigned int n_output_components =
146 unsigned int output_component = 0;
147 for (
unsigned int i = 0; i < n_output_components; )
165 i + spacedim <= n_output_components,
168 for (
unsigned int dd = 1; dd < spacedim; ++dd)
179 for (
unsigned int dd = 1; dd < spacedim; ++dd)
190 ranges.emplace_back(std::forward_as_tuple(
192 output_component + spacedim - 1,
199 output_component += spacedim;
207 const unsigned int size = spacedim * spacedim;
211 i + size <= n_output_components,
214 for (
unsigned int dd = 1; dd < size; ++dd)
225 for (
unsigned int dd = 1; dd < size; ++dd)
233 ranges.emplace_back(std::forward_as_tuple(
235 output_component + size - 1,
242 output_component += size;
virtual const std::vector< DataOutBase::Patch< 0, spacedim > > & get_patches() const override
std::vector< std::string > dataset_names
virtual std::vector< std::tuple< unsigned int, unsigned int, std::string, DataComponentInterpretation::DataComponentInterpretation > > get_nonscalar_data_ranges() const override
std::vector< DataOutBase::Patch< 0, spacedim > > patches
std::vector< DataComponentInterpretation::DataComponentInterpretation > data_component_interpretations
void build_patches(const Particles::ParticleHandler< dim, spacedim > &particles, const std::vector< std::string > &data_component_names={}, const std::vector< DataComponentInterpretation::DataComponentInterpretation > &data_component_interpretations={})
virtual std::vector< std::string > get_dataset_names() const override
ArrayView< double > get_properties()
bool has_properties() const
particle_iterator begin() const
particle_iterator end() const
types::particle_index n_locally_owned_particles() const