16 #include <deal.II/numerics/data_out_stack.h> 17 #include <deal.II/base/quadrature_lib.h> 18 #include <deal.II/base/memory_consumption.h> 19 #include <deal.II/lac/vector.h> 20 #include <deal.II/lac/block_vector.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> 31 DEAL_II_NAMESPACE_OPEN
34 template <
int dim,
int spacedim,
typename DoFHandlerType>
44 template <
int dim,
int spacedim,
typename DoFHandlerType>
49 template <
int dim,
int spacedim,
typename DoFHandlerType>
60 for (
typename std::vector<DataVector>::const_iterator i=
dof_data.begin();
62 Assert (i->data.size() == 0,
64 for (
typename std::vector<DataVector>::const_iterator i=
cell_data.begin();
66 Assert (i->data.size() == 0,
72 template <
int dim,
int spacedim,
typename DoFHandlerType>
83 template <
int dim,
int spacedim,
typename DoFHandlerType>
87 std::vector<std::string> names;
88 names.push_back (name);
93 template <
int dim,
int spacedim,
typename DoFHandlerType>
105 for (std::vector<std::string>::const_iterator name=names.begin(); name!=names.end(); ++name)
107 for (
typename std::vector<DataVector>::const_iterator data_set=
dof_data.begin();
108 data_set!=
dof_data.end(); ++data_set)
109 for (
unsigned int i=0; i<data_set->names.size(); ++i)
112 for (
typename std::vector<DataVector>::const_iterator data_set=
cell_data.begin();
114 for (
unsigned int i=0; i<data_set->names.size(); ++i)
133 template <
int dim,
int spacedim,
typename DoFHandlerType>
134 template <
typename number>
136 const std::string &name)
138 const unsigned int n_components =
dof_handler->get_fe().n_components ();
140 std::vector<std::string> names;
144 if ((n_components == 1) ||
147 names.resize (1, name);
153 names.resize (n_components);
154 for (
unsigned int i=0; i<n_components; ++i)
156 std::ostringstream namebuf;
158 names[i] = name + namebuf.str();
166 template <
int dim,
int spacedim,
typename DoFHandlerType>
167 template <
typename number>
169 const std::vector<std::string> &names)
179 (names.size() ==
dof_handler->get_fe().n_components())),
182 for (
unsigned int i=0; i<names.size(); ++i)
183 Assert (names[i].find_first_not_of(
"abcdefghijklmnopqrstuvwxyz" 184 "ABCDEFGHIJKLMNOPQRSTUVWXYZ" 185 "0123456789_<>()") == std::string::npos,
187 names[i].find_first_not_of(
"abcdefghijklmnopqrstuvwxyz" 188 "ABCDEFGHIJKLMNOPQRSTUVWXYZ" 189 "0123456789_<>()")));
193 typename std::vector<DataVector>::iterator data_vector=
dof_data.begin();
194 for (; data_vector!=
dof_data.end(); ++data_vector)
195 if (data_vector->names == names)
197 data_vector->data.reinit (vec.
size());
199 data_vector->data.begin());
216 typename std::vector<DataVector>::iterator data_vector=
cell_data.begin();
217 for (; data_vector!=
cell_data.end(); ++data_vector)
218 if (data_vector->names == names)
220 data_vector->data.reinit (vec.
size());
222 data_vector->data.begin());
235 template <
int dim,
int spacedim,
typename DoFHandlerType>
240 unsigned int n_subdivisions = (nnnn_subdivisions != 0)
244 Assert (n_subdivisions >= 1,
251 const unsigned int n_components =
dof_handler->get_fe().n_components();
252 const unsigned int n_datasets =
dof_data.size() * n_components +
258 unsigned int n_patches = 0;
259 for (
typename DoFHandlerType::active_cell_iterator
287 const unsigned int n_q_points = patch_points.
size();
288 std::vector<double> patch_values (n_q_points);
289 std::vector<Vector<double> > patch_values_system (n_q_points,
299 default_patch.
data.
reinit (n_datasets, n_q_points*(n_subdivisions+1));
304 typename std::vector< ::DataOutBase::Patch<dim+1,dim+1> >::iterator
306 unsigned int cell_number = 0;
307 for (
typename DoFHandlerType::active_cell_iterator cell=
dof_handler->begin_active();
308 cell !=
dof_handler->end(); ++cell, ++patch, ++cell_number)
310 Assert (cell->is_locally_owned(),
377 x_fe_patch_values.reinit (cell);
379 = x_fe_patch_values.get_present_fe_values ();
382 for (
unsigned int dataset=0; dataset<
dof_data.size(); ++dataset)
384 if (n_components == 1)
388 for (
unsigned int i=0; i<n_subdivisions+1; ++i)
389 for (
unsigned int q=0; q<n_q_points; ++q)
390 patch->data(dataset,q+n_q_points*i) = patch_values[q];
396 patch_values_system);
397 for (
unsigned int component=0; component<n_components; ++component)
398 for (
unsigned int i=0; i<n_subdivisions+1; ++i)
399 for (
unsigned int q=0; q<n_q_points; ++q)
400 patch->data(dataset*n_components+component,
402 = patch_values_system[q](component);
407 for (
unsigned int dataset=0; dataset<
cell_data.size(); ++dataset)
409 const double value =
cell_data[dataset].data(cell_number);
410 for (
unsigned int q=0; q<n_q_points; ++q)
411 for (
unsigned int i=0; i<n_subdivisions+1; ++i)
412 patch->data(dataset+
dof_data.size()*n_components,
413 q*(n_subdivisions+1)+i) = value;
420 template <
int dim,
int spacedim,
typename DoFHandlerType>
425 for (
typename std::vector<DataVector>::iterator i=
dof_data.begin();
429 for (
typename std::vector<DataVector>::iterator i=
cell_data.begin();
436 template <
int dim,
int spacedim,
typename DoFHandlerType>
451 template <
int dim,
int spacedim,
typename DoFHandlerType>
452 const std::vector< ::DataOutBase::Patch<dim+1,dim+1> > &
460 template <
int dim,
int spacedim,
typename DoFHandlerType>
463 std::vector<std::string> names;
464 for (
typename std::vector<DataVector>::const_iterator dataset=
dof_data.begin();
466 names.insert (names.end(), dataset->names.begin(), dataset->names.end());
467 for (
typename std::vector<DataVector>::const_iterator dataset=
cell_data.begin();
469 names.insert (names.end(), dataset->names.begin(), dataset->names.end());
477 #include "data_out_stack.inst" 480 DEAL_II_NAMESPACE_CLOSE
static ::ExceptionBase & ExcNameAlreadyUsed(std::string arg1)
std::vector< ::DataOutBase::Patch< dim+1, dim+1 > > patches
std::size_t memory_consumption() const
static ::ExceptionBase & ExcInvalidNumberOfSubdivisions(int arg1)
SmartPointer< const DoFHandlerType, DataOutStack< dim, spacedim, DoFHandlerType > > dof_handler
std::vector< DataVector > cell_data
static ::ExceptionBase & ExcDataAlreadyAdded()
void attach_dof_handler(const DoFHandlerType &dof_handler)
void get_function_values(const InputVector &fe_function, std::vector< typename InputVector::value_type > &values) const
std::vector< DataVector > dof_data
unsigned int default_subdivisions
static ::ExceptionBase & ExcDataNotCleared()
std::size_t memory_consumption() const
std::vector< std::string > names
void reinit(const TableIndices< N > &new_size, const bool omit_default_initialization=false)
void declare_data_vector(const std::string &name, const VectorType vector_type)
#define Assert(cond, exc)
static ::ExceptionBase & ExcDimensionMismatch(std::size_t arg1, std::size_t arg2)
unsigned int n_subdivisions
static ::ExceptionBase & ExcVectorNotDeclared(std::string arg1)
unsigned int size() const
std_cxx11::enable_if< std_cxx11::is_fundamental< T >::value, std::size_t >::type memory_consumption(const T &t)
virtual std::vector< std::string > get_dataset_names() const
void build_patches(const unsigned int n_subdivisions=0)
virtual const std::vector< ::DataOutBase::Patch< dim+1, dim+1 > > & get_patches() const
void validate_dataset_names() const
static ::ExceptionBase & ExcNotImplemented()
static ::ExceptionBase & ExcInvalidCharacter(std::string arg1, size_t arg2)
void finish_parameter_value()
void new_parameter_value(const double parameter_value, const double parameter_step)
static ::ExceptionBase & ExcNoDoFHandlerSelected()
void add_data_vector(const Vector< number > &vec, const std::string &name)
static ::ExceptionBase & ExcInvalidNumberOfNames(int arg1, int arg2)
static ::ExceptionBase & ExcInternalError()