27 const std::vector<std::string> &data_component_names,
28 const std::vector<DataComponentInterpretation::DataComponentInterpretation>
29 &data_component_interpretations_)
32 data_component_names.size() == data_component_interpretations_.size(),
34 "When calling Particles::DataOut::build_patches with data component "
35 "names and interpretations you need to provide as many data component "
36 "names as interpretations. Provide the same name for components that "
37 "belong to a single vector or tensor."));
39 if ((data_component_names.size() > 0) &&
45 "You called Particles::DataOut::build_patches with data component "
46 "names and interpretations, but the particles do not seem to own "
50 data_component_names.size() ==
53 "When calling Particles::DataOut::build_patches with data component "
54 "names and interpretations you need to provide as many data component "
55 "names as the particles have properties."));
61 data_component_names.begin(),
62 data_component_names.end());
69 data_component_interpretations_.begin(),
70 data_component_interpretations_.end());
72 const unsigned int n_property_components = data_component_names.size();
77 auto particle = particles.
begin();
78 for (
unsigned int i = 0; particle != particles.
end(); ++particle, ++i)
80 patches[i].vertices[0] = particle->get_location();
84 patches[i].data.reinit(n_data_components, 1);
86 patches[i].data(0, 0) = particle->get_id();
88 if (n_data_components > 1)
91 for (
unsigned int property_index = 0;
92 property_index < n_property_components;
94 patches[i].data(property_index + 1, 0) =
95 properties[property_index];
129 std::tuple<
unsigned int,
142 const unsigned int n_output_components =
144 unsigned int output_component = 0;
145 for (
unsigned int i = 0; i < n_output_components; )
163 i + spacedim <= n_output_components,
166 for (
unsigned int dd = 1; dd < spacedim; ++dd)
177 for (
unsigned int dd = 1; dd < spacedim; ++dd)
188 ranges.emplace_back(std::forward_as_tuple(
190 output_component + spacedim - 1,
197 output_component += spacedim;
205 const unsigned int size = spacedim * spacedim;
209 i + size <= n_output_components,
212 for (
unsigned int dd = 1; dd < size; ++dd)
223 for (
unsigned int dd = 1; dd < size; ++dd)
231 ranges.emplace_back(std::forward_as_tuple(
233 output_component + size - 1,
240 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