17 #ifndef __deal2__data_out_dof_data_h 18 #define __deal2__data_out_dof_data_h 22 #include <deal.II/base/config.h> 23 #include <deal.II/base/smartpointer.h> 24 #include <deal.II/base/data_out_base.h> 25 #include <deal.II/dofs/dof_handler.h> 26 #include <deal.II/grid/tria.h> 27 #include <deal.II/fe/mapping.h> 28 #include <deal.II/hp/q_collection.h> 29 #include <deal.II/hp/fe_collection.h> 30 #include <deal.II/hp/mapping_collection.h> 31 #include <deal.II/hp/fe_values.h> 32 #include <deal.II/numerics/data_postprocessor.h> 33 #include <deal.II/numerics/data_component_interpretation.h> 35 #include <deal.II/base/std_cxx1x/shared_ptr.h> 68 const std::vector<std::string> &
names,
99 std::vector<double> &patch_values)
const = 0;
152 virtual void clear () = 0;
168 const std::vector<std::string>
names;
175 const std::vector<DataComponentInterpretation::DataComponentInterpretation>
210 template <
int dim,
int spacedim>
214 const unsigned int n_subdivisions,
215 const std::vector<unsigned int> &n_postprocessor_outputs,
219 const bool use_face_values);
223 template <
typename DH>
224 void reinit_all_fe_values(std::vector<std_cxx1x::shared_ptr<
DataEntryBase<DH> > > &dof_data,
225 const typename ::Triangulation<dim,spacedim>::cell_iterator &cell,
229 get_present_fe_values(
const unsigned int dataset)
const;
231 void resize_system_vectors(
const unsigned int n_components);
233 const unsigned int n_datasets;
234 const unsigned int n_subdivisions;
236 std::vector<double> patch_values;
237 std::vector<::Vector<double> > patch_values_system;
238 std::vector<Tensor<1,spacedim> > patch_gradients;
239 std::vector<std::vector<Tensor<1,spacedim> > > patch_gradients_system;
240 std::vector<Tensor<2,spacedim> > patch_hessians;
241 std::vector<std::vector<Tensor<2,spacedim> > > patch_hessians_system;
242 std::vector<std::vector<::Vector<double> > > postprocessed_values;
244 const ::hp::MappingCollection<dim,spacedim> mapping_collection;
245 const std::vector<std_cxx1x::shared_ptr<::hp::FECollection<dim,spacedim> > > finite_elements;
248 std::vector<std_cxx1x::shared_ptr<::hp::FEValues<dim,spacedim> > > x_fe_values;
249 std::vector<std_cxx1x::shared_ptr<::hp::FEFaceValues<dim,spacedim> > > x_fe_face_values;
403 template <
class DH,
int patch_dim,
int patch_space_dim=patch_dim>
461 void attach_dof_handler (
const DH &);
472 void attach_triangulation (
const Triangulation<DH::dimension,
473 DH::space_dimension> &);
541 template <
class VECTOR>
542 void add_data_vector (
const VECTOR &data,
543 const std::vector<std::string> &
names,
546 = std::vector<DataComponentInterpretation::DataComponentInterpretation>());
564 template <
class VECTOR>
565 void add_data_vector (
const VECTOR &data,
566 const std::string &name,
569 = std::vector<DataComponentInterpretation::DataComponentInterpretation>());
585 template <
class VECTOR>
588 const std::vector<std::string> &names,
590 = std::vector<DataComponentInterpretation::DataComponentInterpretation>());
597 template <
class VECTOR>
598 void add_data_vector (
const DH &dof_handler,
600 const std::string &name,
602 = std::vector<DataComponentInterpretation::DataComponentInterpretation>());
622 template <
class VECTOR>
623 void add_data_vector (
const VECTOR &data,
632 template <
class VECTOR>
633 void add_data_vector (
const DH &dof_handler,
643 void clear_data_vectors ();
655 void clear_input_data_references ();
690 virtual void clear ();
718 <<
"The vector has size " << arg1
719 <<
" but the DoFHandler objects says there are " << arg2
720 <<
" degrees of freedom and there are " << arg3
721 <<
" active cells.");
727 <<
"Please use only the characters [a-zA-Z0-9_<>()] for" << std::endl
728 <<
"description strings since some graphics formats will only accept these." 730 <<
"The string you gave was <" << arg1
731 <<
">, the invalid character is <" << arg1[arg2]
732 <<
">." << std::endl);
742 <<
"You have to give one name per component in your " 743 <<
"data vector. The number you gave was " << arg1
744 <<
", but the number of components is " << arg2);
760 <<
"When declaring that a number of components in a data\n" 761 <<
"set to be output logically form a vector instead of\n" 762 <<
"simply a set of scalar fields, you need to specify\n" 763 <<
"this for all relevant components. Furthermore,\n" 764 <<
"vectors must always consist of exactly <dim>\n" 765 <<
"components. However, the vector component at\n" 766 <<
"position " << arg1 <<
" with name <" << arg2
767 <<
"> does not satisfy these conditions.");
773 typedef ::DataOutBase::Patch<patch_dim,patch_space_dim>
Patch;
788 std::vector<std_cxx1x::shared_ptr<internal::DataOut::DataEntryBase<DH> > >
dof_data;
793 std::vector<std_cxx1x::shared_ptr<internal::DataOut::DataEntryBase<DH> > >
cell_data;
807 const std::vector<Patch> &get_patches ()
const;
814 std::vector<std::string> get_dataset_names ()
const;
820 std::vector<std_cxx1x::shared_ptr<::hp::FECollection<DH::dimension,DH::space_dimension> > >
821 get_finite_elements()
const;
828 std::vector<std_cxx1x::tuple<unsigned int, unsigned int, std::string> >
829 get_vector_data_ranges ()
const;
835 template <
class,
int,
int>
844 template <
class DH,
int patch_dim,
int patch_space_dim>
851 const std::vector<Patch> source_patches = source.
get_patches ();
853 Assert (source_patches.size () != 0, ExcNoPatches ());
857 ExcIncompatibleDatasetNames());
862 Assert (
patches[0].n_subdivisions == source_patches[0].n_subdivisions,
863 ExcIncompatiblePatchLists());
864 Assert (
patches[0].data.n_rows() == source_patches[0].data.n_rows(),
865 ExcIncompatiblePatchLists());
866 Assert (
patches[0].data.n_cols() == source_patches[0].data.n_cols(),
867 ExcIncompatiblePatchLists());
873 ExcMessage (
"Both sources need to declare the same components " 879 ExcMessage (
"Both sources need to declare the same components " 883 ExcMessage (
"Both sources need to declare the same components " 887 ExcMessage (
"Both sources need to declare the same components " 895 const unsigned int old_n_patches =
patches.size();
897 source_patches.begin(),
898 source_patches.end());
902 for (
unsigned int i=old_n_patches; i<
patches.size(); ++i)
903 for (
unsigned int v=0; v<GeometryInfo<patch_dim>::vertices_per_cell; ++v)
904 patches[i].vertices[v] += shift;
907 for (
unsigned int i=old_n_patches; i<
patches.size(); ++i)
908 patches[i].patch_index += old_n_patches;
911 for (
unsigned int i=old_n_patches; i<
patches.size(); ++i)
912 for (
unsigned int n=0; n<GeometryInfo<patch_dim>::faces_per_cell; ++n)
914 patches[i].neighbors[n] += old_n_patches;
918 DEAL_II_NAMESPACE_CLOSE
unsigned int n_output_variables
virtual std::size_t memory_consumption() const =0
static const unsigned int invalid_unsigned_int
#define DeclException2(Exception2, type1, type2, outsequence)
const std::vector< DataComponentInterpretation::DataComponentInterpretation > data_component_interpretation
virtual const std::vector< Patch > & get_patches() const
SmartPointer< const DH > dofs
::ExceptionBase & ExcMessage(std::string arg1)
virtual void get_function_gradients(const FEValuesBase< DH::dimension, DH::space_dimension > &fe_patch_values, std::vector< Tensor< 1, DH::space_dimension > > &patch_gradients) const =0
DataEntryBase(const DH *dofs, const std::vector< std::string > &names, const std::vector< DataComponentInterpretation::DataComponentInterpretation > &data_component_interpretation)
SmartPointer< const DH > dof_handler
virtual void get_function_values(const FEValuesBase< DH::dimension, DH::space_dimension > &fe_patch_values, std::vector< double > &patch_values) const =0
#define Assert(cond, exc)
#define DeclException0(Exception0)
std::vector< Patch > patches
::DataOutBase::Patch< patch_dim, patch_space_dim > Patch
virtual void get_function_hessians(const FEValuesBase< DH::dimension, DH::space_dimension > &fe_patch_values, std::vector< Tensor< 2, DH::space_dimension > > &patch_hessians) const =0
SmartPointer< const Triangulation< DH::dimension, DH::space_dimension > > triangulation
static const unsigned int no_neighbor
std::vector< std_cxx1x::shared_ptr< internal::DataOut::DataEntryBase< DH > > > cell_data
virtual std::vector< std::string > get_dataset_names() const
const std::vector< std::string > names
std::vector< std_cxx1x::shared_ptr< internal::DataOut::DataEntryBase< DH > > > dof_data
#define DeclException3(Exception3, type1, type2, type3, outsequence)
Triangulation< DH::dimension, DH::space_dimension >::cell_iterator cell_iterator
virtual std::vector< std_cxx1x::tuple< unsigned int, unsigned int, std::string > > get_vector_data_ranges() const
virtual double get_cell_data_value(const unsigned int cell_number) const =0
void merge_patches(const DataOut_DoFData< DH2, patch_dim, patch_space_dim > &source, const Point< patch_space_dim > &shift=Point< patch_space_dim >())
SmartPointer< const ::DataPostprocessor< DH::space_dimension > > postprocessor