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/numerics/data_out_faces.h> 21 #include <deal.II/grid/tria.h> 22 #include <deal.II/dofs/dof_handler.h> 23 #include <deal.II/dofs/dof_accessor.h> 24 #include <deal.II/grid/tria_iterator.h> 25 #include <deal.II/fe/fe.h> 26 #include <deal.II/fe/fe_values.h> 27 #include <deal.II/hp/fe_values.h> 28 #include <deal.II/fe/mapping_q1.h> 30 DEAL_II_NAMESPACE_OPEN
37 template <
int dim,
int spacedim>
38 ParallelData<dim,spacedim>::
39 ParallelData (
const unsigned int n_datasets,
40 const unsigned int n_subdivisions,
41 const std::vector<unsigned int> &n_postprocessor_outputs,
47 ParallelDataBase<dim,spacedim> (n_datasets,
49 n_postprocessor_outputs,
62 template <
int dim,
int spacedim>
67 patches.push_back (patch);
68 patches.back().patch_index = patches.size()-1;
75 template <
int dim,
typename DoFHandlerType>
80 Assert (dim == DoFHandlerType::dimension,
86 template <
int dim,
typename DoFHandlerType>
93 Assert (cell_and_face->first->is_locally_owned(),
100 for (
unsigned int vertex=0; vertex<
GeometryInfo<dimension-1>::vertices_per_cell; ++vertex)
101 patch.
vertices[vertex] = data.mapping_collection[0].transform_unit_to_real_cell
102 (cell_and_face->first,
105 (cell_and_face->second,
107 cell_and_face->first->face_orientation(cell_and_face->second),
108 cell_and_face->first->face_flip(cell_and_face->second),
109 cell_and_face->first->face_rotation(cell_and_face->second))));
111 if (data.n_datasets > 0)
113 data.reinit_all_fe_values(this->dof_data, cell_and_face->first,
114 cell_and_face->second);
116 = data.get_present_fe_values (0);
131 for (
unsigned int i=0; i<dimension; ++i)
132 for (
unsigned int q=0; q<n_q_points; ++q)
133 patch.
data(patch.
data.
size(0)-dimension+i,q)=q_points[q][i];
136 unsigned int offset=0;
139 for (
unsigned int dataset=0; dataset<this->dof_data.size(); ++dataset)
142 = data.get_present_fe_values (dataset);
144 = this_fe_patch_values.
get_fe().n_components();
146 if (postprocessor != 0)
157 this->dof_data[dataset]->get_function_values (this_fe_patch_values,
158 data.patch_values_scalar.solution_values);
160 this->dof_data[dataset]->get_function_gradients (this_fe_patch_values,
161 data.patch_values_scalar.solution_gradients);
163 this->dof_data[dataset]->get_function_hessians (this_fe_patch_values,
164 data.patch_values_scalar.solution_hessians);
172 const typename DoFHandlerType::active_cell_iterator dh_cell(&cell_and_face->first->get_triangulation(),
173 cell_and_face->first->level(),
174 cell_and_face->first->index(),
175 this->dof_data[dataset]->dof_handler);
176 data.patch_values_scalar.template set_cell<DoFHandlerType> (dh_cell);
179 evaluate_scalar_field(data.patch_values_scalar,
180 data.postprocessed_values[dataset]);
188 this->dof_data[dataset]->get_function_values (this_fe_patch_values,
189 data.patch_values_system.solution_values);
191 this->dof_data[dataset]->get_function_gradients (this_fe_patch_values,
192 data.patch_values_system.solution_gradients);
194 this->dof_data[dataset]->get_function_hessians (this_fe_patch_values,
195 data.patch_values_system.solution_hessians);
203 const typename DoFHandlerType::active_cell_iterator dh_cell(&cell_and_face->first->get_triangulation(),
204 cell_and_face->first->level(),
205 cell_and_face->first->index(),
206 this->dof_data[dataset]->dof_handler);
207 data.patch_values_system.template set_cell<DoFHandlerType> (dh_cell);
210 evaluate_vector_field(data.patch_values_system,
211 data.postprocessed_values[dataset]);
214 for (
unsigned int q=0; q<n_q_points; ++q)
215 for (
unsigned int component=0;
216 component<this->dof_data[dataset]->n_output_variables; ++component)
217 patch.
data(offset+component,q)
218 = data.postprocessed_values[dataset][q](component);
226 this->dof_data[dataset]->get_function_values (this_fe_patch_values,
227 data.patch_values_scalar.solution_values);
228 for (
unsigned int q=0; q<n_q_points; ++q)
229 patch.
data(offset,q) = data.patch_values_scalar.solution_values[q];
234 this->dof_data[dataset]->get_function_values (this_fe_patch_values,
235 data.patch_values_system.solution_values);
238 for (
unsigned int q=0; q<n_q_points; ++q)
239 patch.
data(offset+component,q) =
240 data.patch_values_system.solution_values[q](component);
243 offset += this->dof_data[dataset]->n_output_variables;
247 for (
unsigned int dataset=0; dataset<this->cell_data.size(); ++dataset)
252 Assert (cell_and_face->first->active(),
253 ExcMessage(
"The current function is trying to generate cell-data output " 254 "for a face that does not belong to an active cell. This is " 256 const unsigned int cell_number
257 = std::distance (this->triangulation->begin_active(),
261 = this->cell_data[dataset]->get_cell_data_value (cell_number);
262 for (
unsigned int q=0; q<n_q_points; ++q)
263 patch.
data(dataset+offset,q) = value;
271 template <
int dim,
typename DoFHandlerType>
279 template <
int dim,
typename DoFHandlerType>
281 const unsigned int n_subdivisions_)
286 const unsigned int n_subdivisions = (n_subdivisions_ != 0)
288 : this->default_subdivisions;
290 Assert (n_subdivisions >= 1,
293 Assert (this->triangulation != 0,
296 this->validate_dataset_names();
298 unsigned int n_datasets = this->cell_data.size();
299 for (
unsigned int i=0; i<this->dof_data.size(); ++i)
300 n_datasets += this->dof_data[i]->n_output_variables;
306 std::vector<FaceDescriptor> all_faces;
308 ((face.first != this->triangulation->end())
311 face = next_face(face))
312 all_faces.push_back (face);
315 this->patches.clear ();
316 this->patches.reserve (all_faces.size());
320 std::vector<unsigned int> n_postprocessor_outputs (this->dof_data.size());
321 for (
unsigned int dataset=0; dataset<this->dof_data.size(); ++dataset)
322 if (this->dof_data[dataset]->postprocessor)
323 n_postprocessor_outputs[dataset] = this->dof_data[dataset]->n_output_variables;
325 n_postprocessor_outputs[dataset] = 0;
328 for (
unsigned int i=0; i<this->dof_data.size(); ++i)
329 if (this->dof_data[i]->postprocessor)
330 update_flags |= this->dof_data[i]->postprocessor->get_needed_update_flags();
334 thread_data (n_datasets,
336 n_postprocessor_outputs,
338 this->get_finite_elements(),
342 sample_patch.data.reinit (n_datasets,
343 Utilities::fixed_power<dimension-1>(n_subdivisions+1));
347 &all_faces[0]+all_faces.size(),
349 this, std_cxx11::_1, std_cxx11::_2, std_cxx11::_3),
351 append_patch_to_list<dim,space_dimension>,
352 std_cxx11::_1, std_cxx11::ref(this->patches)),
359 template <
int dim,
typename DoFHandlerType>
365 for (; cell != this->triangulation->end(); ++cell)
366 if (cell->is_locally_owned())
367 for (
unsigned int f=0; f<GeometryInfo<dimension>::faces_per_cell; ++f)
368 if (!surface_only || cell->face(f)->at_boundary())
379 template <
int dim,
typename DoFHandlerType>
389 if (!surface_only || face.first->face(f)->at_boundary())
406 while (active_cell != this->triangulation->end())
410 if (active_cell->is_locally_owned())
411 for (
unsigned int f=0; f<GeometryInfo<dimension>::faces_per_cell; ++f)
412 if (!surface_only || active_cell->face(f)->at_boundary())
414 face.first = active_cell;
425 face.first = this->triangulation->end();
433 #include "data_out_faces.inst" 435 DEAL_II_NAMESPACE_CLOSE
TriaActiveIterator< CellAccessor< dim, spacedim > > active_cell_iterator
static ::ExceptionBase & ExcInvalidNumberOfSubdivisions(int arg1)
const FiniteElement< dim, spacedim > & get_fe() const
void build_one_patch(const FaceDescriptor *cell_and_face, internal::DataOutFaces::ParallelData< dimension, dimension > &data, DataOutBase::Patch< dimension-1, space_dimension > &patch)
Transformed quadrature points.
Point< spacedim > vertices[GeometryInfo< dim >::vertices_per_cell]
virtual FaceDescriptor first_face()
const std::vector< Point< spacedim > > & get_quadrature_points() const
static ::ExceptionBase & ExcMessage(std::string arg1)
void reinit(const TableIndices< N > &new_size, const bool omit_default_initialization=false)
#define Assert(cond, exc)
static ::ExceptionBase & ExcDimensionMismatch(std::size_t arg1, std::size_t arg2)
Abstract base class for mapping classes.
virtual FaceDescriptor next_face(const FaceDescriptor &face)
unsigned int n_subdivisions
Second derivatives of shape functions.
const std::vector< Tensor< 1, spacedim > > & get_all_normal_vectors() const
DataOutFaces(const bool surface_only=true)
const unsigned int n_quadrature_points
std::pair< cell_iterator, unsigned int > FaceDescriptor
static const unsigned int space_dim
Shape function gradients.
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)
static ::ExceptionBase & ExcNotImplemented()
unsigned int size(const unsigned int i) const
bool points_are_available
virtual void build_patches(const unsigned int n_subdivisions=0)
unsigned int n_components(const DoFHandler< dim, spacedim > &dh)
static ::ExceptionBase & ExcNoTriangulationSelected()
static ::ExceptionBase & ExcInternalError()
virtual UpdateFlags get_needed_update_flags() const =0