16 #include <deal.II/base/quadrature_lib.h> 17 #include <deal.II/base/work_stream.h> 18 #include <deal.II/lac/vector.h> 19 #include <deal.II/lac/block_vector.h> 20 #include <deal.II/grid/tria.h> 21 #include <deal.II/dofs/dof_handler.h> 22 #include <deal.II/dofs/dof_accessor.h> 23 #include <deal.II/grid/tria_iterator.h> 24 #include <deal.II/fe/fe.h> 25 #include <deal.II/fe/fe_values.h> 26 #include <deal.II/hp/fe_values.h> 27 #include <deal.II/fe/mapping_q1.h> 28 #include <deal.II/numerics/data_out_rotation.h> 32 DEAL_II_NAMESPACE_OPEN
50 template <
int dim,
int spacedim>
51 ParallelData<dim,spacedim>::
52 ParallelData (
const unsigned int n_datasets,
53 const unsigned int n_subdivisions,
54 const unsigned int n_patches_per_circle,
55 const std::vector<unsigned int> &n_postprocessor_outputs,
61 ParallelDataBase<dim,spacedim> (n_datasets,
63 n_postprocessor_outputs,
68 n_patches_per_circle (n_patches_per_circle)
77 template <
int dim,
int spacedim>
82 for (
unsigned int i=0; i<new_patches.size(); ++i)
84 patches.push_back (new_patches[i]);
93 template <
int dim,
typename DoFHandlerType>
104 Assert (
false, ExcNotImplemented());
108 Assert ((*cell)->is_locally_owned(),
109 ExcNotImplemented());
111 const unsigned int n_patches_per_circle = data.n_patches_per_circle;
114 const unsigned int n_points = data.n_subdivisions+1;
120 std::vector<Point<dimension+1> > angle_directions (n_patches_per_circle+1);
121 for (
unsigned int i=0; i<=n_patches_per_circle; ++i)
124 i/n_patches_per_circle);
126 i/n_patches_per_circle);
129 for (
unsigned int angle=0; angle<n_patches_per_circle; ++angle)
138 const double r1 = (*cell)->vertex(0)(0),
139 r2 = (*cell)->vertex(1)(0);
140 Assert (r1 >= 0, ExcRadialVariableHasNegativeValues(r1));
141 Assert (r2 >= 0, ExcRadialVariableHasNegativeValues(r2));
143 patches[angle].vertices[0] = r1*angle_directions[angle];
144 patches[angle].vertices[1] = r2*angle_directions[angle];
145 patches[angle].vertices[2] = r1*angle_directions[angle+1];
146 patches[angle].vertices[3] = r2*angle_directions[angle+1];
153 for (
unsigned int vertex=0;
154 vertex<GeometryInfo<dimension>::vertices_per_cell;
161 Assert (v(0) >= 0, ExcRadialVariableHasNegativeValues(v(0)));
164 patches[angle].vertices[vertex] = v(0) * angle_directions[angle];
165 patches[angle].vertices[vertex][0] = v(1);
168 = v(0) * angle_directions[angle+1];
177 Assert (
false, ExcNotImplemented());
180 unsigned int offset=0;
183 if (data.n_datasets > 0)
185 data.reinit_all_fe_values(this->
dof_data, *cell);
187 for (
unsigned int dataset=0; dataset<this->
dof_data.size(); ++dataset)
190 = data.get_present_fe_values(dataset);
191 const unsigned int n_components
192 = fe_patch_values.
get_fe().n_components();
194 if (postprocessor != 0)
201 if (n_components == 1)
207 this->
dof_data[dataset]->get_function_values (fe_patch_values,
210 this->
dof_data[dataset]->get_function_gradients (fe_patch_values,
211 data.patch_gradients);
213 this->
dof_data[dataset]->get_function_hessians (fe_patch_values,
214 data.patch_hessians);
219 std::vector<Point<space_dimension> > dummy_normals;
221 compute_derived_quantities_scalar(data.patch_values,
222 data.patch_gradients,
225 data.patch_evaluation_points,
226 data.postprocessed_values[dataset]);
230 data.resize_system_vectors(n_components);
235 this->
dof_data[dataset]->get_function_values (fe_patch_values,
236 data.patch_values_system);
238 this->
dof_data[dataset]->get_function_gradients (fe_patch_values,
239 data.patch_gradients_system);
241 this->
dof_data[dataset]->get_function_hessians (fe_patch_values,
242 data.patch_hessians_system);
247 std::vector<Point<space_dimension> > dummy_normals;
249 compute_derived_quantities_vector(data.patch_values_system,
250 data.patch_gradients_system,
251 data.patch_hessians_system,
253 data.patch_evaluation_points,
254 data.postprocessed_values[dataset]);
257 for (
unsigned int component=0;
258 component<this->
dof_data[dataset]->n_output_variables;
264 for (
unsigned int x=0; x<n_points; ++x)
265 for (
unsigned int y=0; y<n_points; ++y)
266 patches[angle].data(offset+component,
268 = data.postprocessed_values[dataset][x](component);
272 for (
unsigned int x=0; x<n_points; ++x)
273 for (
unsigned int y=0; y<n_points; ++y)
274 for (
unsigned int z=0; z<n_points; ++z)
275 patches[angle].data(offset+component,
276 x*n_points*n_points +
279 = data.postprocessed_values[dataset][x*n_points+z](component);
283 Assert (
false, ExcNotImplemented());
287 else if (n_components == 1)
289 this->
dof_data[dataset]->get_function_values (fe_patch_values,
295 for (
unsigned int x=0; x<n_points; ++x)
296 for (
unsigned int y=0; y<n_points; ++y)
299 = data.patch_values[x];
303 for (
unsigned int x=0; x<n_points; ++x)
304 for (
unsigned int y=0; y<n_points; ++y)
305 for (
unsigned int z=0; z<n_points; ++z)
307 x*n_points*n_points +
310 = data.patch_values[x*n_points+z];
314 Assert (
false, ExcNotImplemented());
320 data.resize_system_vectors(n_components);
321 this->
dof_data[dataset]->get_function_values (fe_patch_values,
322 data.patch_values_system);
324 for (
unsigned int component=0; component<n_components;
330 for (
unsigned int x=0; x<n_points; ++x)
331 for (
unsigned int y=0; y<n_points; ++y)
332 patches[angle].data(offset+component,
334 = data.patch_values_system[x](component);
338 for (
unsigned int x=0; x<n_points; ++x)
339 for (
unsigned int y=0; y<n_points; ++y)
340 for (
unsigned int z=0; z<n_points; ++z)
341 patches[angle].data(offset+component,
342 x*n_points*n_points +
345 = data.patch_values_system[x*n_points+z](component);
349 Assert (
false, ExcNotImplemented());
353 offset+=this->
dof_data[dataset]->n_output_variables;
357 for (
unsigned int dataset=0; dataset<this->
cell_data.size(); ++dataset)
362 Assert ((*cell)->active(),
363 ExcMessage(
"Cell must be active for cell data"));
364 const unsigned int cell_number
368 = this->
cell_data[dataset]->get_cell_data_value (cell_number);
372 for (
unsigned int x=0; x<n_points; ++x)
373 for (
unsigned int y=0; y<n_points; ++y)
374 patches[angle].data(dataset+offset,
381 for (
unsigned int x=0; x<n_points; ++x)
382 for (
unsigned int y=0; y<n_points; ++y)
383 for (
unsigned int z=0; z<n_points; ++z)
384 patches[angle].data(dataset+offset,
385 x*n_points*n_points +
392 Assert (
false, ExcNotImplemented());
401 template <
int dim,
typename DoFHandlerType>
403 const unsigned int nnnn_subdivisions)
409 Exceptions::DataOut::ExcNoTriangulationSelected());
411 const unsigned int n_subdivisions = (nnnn_subdivisions != 0)
414 Assert (n_subdivisions >= 1,
415 Exceptions::DataOut::ExcInvalidNumberOfSubdivisions(n_subdivisions));
417 unsigned int n_datasets=this->
cell_data.size();
418 for (
unsigned int i=0; i<this->
dof_data.size(); ++i)
419 n_datasets+= this->
dof_data[i]->n_output_variables;
422 for (
unsigned int i=0; i<this->
dof_data.size(); ++i)
423 if (this->
dof_data[i]->postprocessor)
424 update_flags |= this->
dof_data[i]->postprocessor->get_needed_update_flags();
429 ExcMessage(
"The update of normal vectors may not be requested for " 430 "evaluation of data on cells via DataPostprocessor."));
435 std::vector<cell_iterator> all_cells;
437 cell = next_cell(cell))
438 all_cells.push_back (cell);
446 this->
patches.reserve (all_cells.size() * n_patches_per_circle);
449 std::vector<unsigned int> n_postprocessor_outputs (this->
dof_data.size());
450 for (
unsigned int dataset=0; dataset<this->
dof_data.size(); ++dataset)
451 if (this->
dof_data[dataset]->postprocessor)
452 n_postprocessor_outputs[dataset] = this->
dof_data[dataset]->n_output_variables;
454 n_postprocessor_outputs[dataset] = 0;
457 thread_data (n_datasets,
458 n_subdivisions, n_patches_per_circle,
459 n_postprocessor_outputs,
463 std::vector<DataOutBase::Patch<dimension+1,space_dimension+1> >
464 new_patches (n_patches_per_circle);
465 for (
unsigned int i=0; i<new_patches.size(); ++i)
467 new_patches[i].n_subdivisions = n_subdivisions;
468 new_patches[i].data.reinit (n_datasets,
469 Utilities::fixed_power<dimension+1>(n_subdivisions+1));
474 &all_cells[0]+all_cells.size(),
476 this, std_cxx11::_1, std_cxx11::_2, std_cxx11::_3),
478 ::append_patch_to_list<dim,space_dimension>,
479 std_cxx11::_1, std_cxx11::ref(this->
patches)),
486 template <
int dim,
typename DoFHandlerType>
494 template <
int dim,
typename DoFHandlerType>
509 #include "data_out_rotation.inst" 512 DEAL_II_NAMESPACE_CLOSE
std::vector< std_cxx11::shared_ptr< internal::DataOut::DataEntryBase< DoFHandlerType > > > cell_data
TriaActiveIterator< CellAccessor< dim, spacedim > > active_cell_iterator
virtual cell_iterator next_cell(const cell_iterator &cell)
::ExceptionBase & ExcMessage(std::string arg1)
void build_one_patch(const cell_iterator *cell, internal::DataOutRotation::ParallelData< dimension, space_dimension > &data, std::vector< DataOutBase::Patch< dimension+1, space_dimension+1 > > &patches)
const FiniteElement< dim, spacedim > & get_fe() const
active_cell_iterator begin_active(const unsigned int level=0) const
Transformed quadrature points.
unsigned int default_subdivisions
static const unsigned int dimension
cell_iterator end() const
const std::vector< Point< spacedim > > & get_quadrature_points() const
#define Assert(cond, exc)
Abstract base class for mapping classes.
std::vector< Patch > patches
Second derivatives of shape functions.
virtual cell_iterator first_cell()
virtual void build_patches(const unsigned int n_patches_per_circle, const unsigned int n_subdivisions=0)
DataOut_DoFData< DoFHandlerType, dimension+1 >::cell_iterator cell_iterator
std::vector< std_cxx11::shared_ptr<::hp::FECollection< DoFHandlerType::dimension, DoFHandlerType::space_dimension > > > get_finite_elements() const
Shape function gradients.
SmartPointer< const Triangulation< DoFHandlerType::dimension, DoFHandlerType::space_dimension > > triangulation
void run(const std::vector< std::vector< Iterator > > &colored_iterators, Worker worker, Copier copier, const ScratchData &sample_scratch_data, const CopyData &sample_copy_data, const unsigned int queue_length=2 *MultithreadInfo::n_threads(), const unsigned int chunk_size=8)
std::vector< std_cxx11::shared_ptr< internal::DataOut::DataEntryBase< DoFHandlerType > > > dof_data
virtual UpdateFlags get_needed_update_flags() const =0