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>
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(),
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);
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);
143 const unsigned int n_components
144 = this_fe_patch_values.
get_fe().n_components();
146 if (postprocessor != 0)
163 if (n_components == 1)
168 this->
dof_data[dataset]->get_function_values (this_fe_patch_values,
171 this->
dof_data[dataset]->get_function_gradients (this_fe_patch_values,
172 data.patch_gradients);
174 this->
dof_data[dataset]->get_function_hessians (this_fe_patch_values,
175 data.patch_hessians);
181 compute_derived_quantities_scalar(data.patch_values,
182 data.patch_gradients,
185 data.patch_evaluation_points,
186 data.postprocessed_values[dataset]);
192 data.resize_system_vectors(n_components);
194 this->
dof_data[dataset]->get_function_values (this_fe_patch_values,
195 data.patch_values_system);
197 this->
dof_data[dataset]->get_function_gradients (this_fe_patch_values,
198 data.patch_gradients_system);
200 this->
dof_data[dataset]->get_function_hessians (this_fe_patch_values,
201 data.patch_hessians_system);
207 compute_derived_quantities_vector(data.patch_values_system,
208 data.patch_gradients_system,
209 data.patch_hessians_system,
211 data.patch_evaluation_points,
212 data.postprocessed_values[dataset]);
215 for (
unsigned int q=0; q<n_q_points; ++q)
216 for (
unsigned int component=0;
217 component<this->
dof_data[dataset]->n_output_variables; ++component)
218 patch.
data(offset+component,q)
219 = data.postprocessed_values[dataset][q](component);
225 if (n_components == 1)
227 this->
dof_data[dataset]->get_function_values (this_fe_patch_values,
229 for (
unsigned int q=0; q<n_q_points; ++q)
230 patch.
data(offset,q) = data.patch_values[q];
234 data.resize_system_vectors(n_components);
235 this->
dof_data[dataset]->get_function_values (this_fe_patch_values,
236 data.patch_values_system);
237 for (
unsigned int component=0; component<n_components;
239 for (
unsigned int q=0; q<n_q_points; ++q)
240 patch.
data(offset+component,q) =
241 data.patch_values_system[q](component);
244 offset+=this->
dof_data[dataset]->n_output_variables;
248 for (
unsigned int dataset=0; dataset<this->
cell_data.size(); ++dataset)
253 Assert (cell_and_face->first->active(),
254 ExcMessage(
"The current function is trying to generate cell-data output " 255 "for a face that does not belong to an active cell. This is " 257 const unsigned int cell_number
262 = this->
cell_data[dataset]->get_cell_data_value (cell_number);
263 for (
unsigned int q=0; q<n_q_points; ++q)
264 patch.
data(dataset+offset,q) = value;
272 template <
int dim,
typename DoFHandlerType>
280 template <
int dim,
typename DoFHandlerType>
282 const unsigned int n_subdivisions_)
287 const unsigned int n_subdivisions = (n_subdivisions_ != 0)
291 Assert (n_subdivisions >= 1,
292 Exceptions::DataOut::ExcInvalidNumberOfSubdivisions(n_subdivisions));
295 Exceptions::DataOut::ExcNoTriangulationSelected());
297 unsigned int n_datasets = this->
cell_data.size();
298 for (
unsigned int i=0; i<this->
dof_data.size(); ++i)
299 n_datasets += this->
dof_data[i]->n_output_variables;
303 std::vector<FaceDescriptor> all_faces;
307 all_faces.push_back (face);
311 this->
patches.reserve (all_faces.size());
315 std::vector<unsigned int> n_postprocessor_outputs (this->
dof_data.size());
316 for (
unsigned int dataset=0; dataset<this->
dof_data.size(); ++dataset)
317 if (this->
dof_data[dataset]->postprocessor)
318 n_postprocessor_outputs[dataset] = this->
dof_data[dataset]->n_output_variables;
320 n_postprocessor_outputs[dataset] = 0;
323 for (
unsigned int i=0; i<this->
dof_data.size(); ++i)
324 if (this->
dof_data[i]->postprocessor)
325 update_flags |= this->
dof_data[i]->postprocessor->get_needed_update_flags();
329 thread_data (n_datasets,
331 n_postprocessor_outputs,
336 sample_patch.n_subdivisions = n_subdivisions;
337 sample_patch.data.reinit (n_datasets,
338 Utilities::fixed_power<dimension-1>(n_subdivisions+1));
342 &all_faces[0]+all_faces.size(),
344 this, std_cxx11::_1, std_cxx11::_2, std_cxx11::_3),
346 append_patch_to_list<dim,space_dimension>,
347 std_cxx11::_1, std_cxx11::ref(this->
patches)),
354 template <
int dim,
typename DoFHandlerType>
361 if (cell->is_locally_owned())
362 for (
unsigned int f=0; f<GeometryInfo<dimension>::faces_per_cell; ++f)
374 template <
int dim,
typename DoFHandlerType>
382 Assert (face.first->is_locally_owned(), ExcInternalError());
384 if (!
surface_only || face.first->face(f)->at_boundary())
405 if (active_cell->is_locally_owned())
406 for (
unsigned int f=0; f<GeometryInfo<dimension>::faces_per_cell; ++f)
407 if (!
surface_only || active_cell->face(f)->at_boundary())
409 face.first = active_cell;
428 #include "data_out_faces.inst" 430 DEAL_II_NAMESPACE_CLOSE
std::vector< std_cxx11::shared_ptr< internal::DataOut::DataEntryBase< DoFHandlerType > > > cell_data
TriaActiveIterator< CellAccessor< dim, spacedim > > active_cell_iterator
static const unsigned int space_dimension
::ExceptionBase & ExcMessage(std::string 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)
active_cell_iterator begin_active(const unsigned int level=0) const
Transformed quadrature points.
unsigned int default_subdivisions
Point< spacedim > vertices[GeometryInfo< dim >::vertices_per_cell]
static const unsigned int dimension
virtual FaceDescriptor first_face()
cell_iterator end() const
const std::vector< Point< spacedim > > & get_quadrature_points() const
void reinit(const TableIndices< N > &new_size, const bool omit_default_initialization=false)
#define Assert(cond, exc)
Abstract base class for mapping classes.
std::vector< Patch > patches
virtual FaceDescriptor next_face(const FaceDescriptor &face)
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
std::vector< std_cxx11::shared_ptr<::hp::FECollection< DoFHandlerType::dimension, DoFHandlerType::space_dimension > > > get_finite_elements() const
static const unsigned int space_dim
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
unsigned int size(const unsigned int i) const
bool points_are_available
virtual void build_patches(const unsigned int n_subdivisions=0)
virtual UpdateFlags get_needed_update_flags() const =0