40template <
int dim,
int spacedim>
50template <
int dim,
int spacedim>
62 for (
typename std::vector<DataVector>::const_iterator i = dof_data.begin();
65 Assert(i->data.size() == 0, ExcDataNotCleared());
66 for (
typename std::vector<DataVector>::const_iterator i = cell_data.begin();
69 Assert(i->data.size() == 0, ExcDataNotCleared());
73template <
int dim,
int spacedim>
82template <
int dim,
int spacedim>
85 const std::string &name,
88 std::vector<std::string> names;
89 names.push_back(name);
90 declare_data_vector(names, vector_type);
94template <
int dim,
int spacedim>
97 const std::vector<std::string> &names,
105 Assert(patches.size() == 0, ExcDataAlreadyAdded());
109 for (
const auto &name : names)
111 for (
const auto &data_set : dof_data)
112 for (
const auto &data_set_name : data_set.names)
113 Assert(name != data_set_name, ExcNameAlreadyUsed(name));
115 for (
const auto &data_set : cell_data)
116 for (
const auto &data_set_name : data_set.names)
117 Assert(name != data_set_name, ExcNameAlreadyUsed(name));
124 dof_data.emplace_back();
125 dof_data.back().names = names;
129 cell_data.emplace_back();
130 cell_data.back().names = names;
136template <
int dim,
int spacedim>
137template <
typename number>
140 const std::string & name)
142 const unsigned int n_components = dof_handler->get_fe(0).n_components();
144 std::vector<std::string> names;
148 if ((n_components == 1) ||
149 (vec.
size() == dof_handler->get_triangulation().n_active_cells()))
151 names.resize(1, name);
157 names.resize(n_components);
158 for (
unsigned int i = 0; i < n_components; ++i)
160 std::ostringstream namebuf;
162 names[i] = name + namebuf.str();
166 add_data_vector(vec, names);
170template <
int dim,
int spacedim>
171template <
typename number>
175 const std::vector<std::string> &names)
177 Assert(dof_handler !=
nullptr,
181 Assert(((vec.
size() == dof_handler->get_triangulation().n_active_cells()) &&
182 (names.size() == 1)) ||
183 ((vec.
size() == dof_handler->n_dofs()) &&
184 (names.size() == dof_handler->get_fe(0).n_components())),
186 names.size(), dof_handler->get_fe(0).n_components()));
187 for (
const auto &name : names)
190 Assert(name.find_first_not_of(
"abcdefghijklmnopqrstuvwxyz"
191 "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
192 "0123456789_<>()") == std::string::npos,
195 name.find_first_not_of(
"abcdefghijklmnopqrstuvwxyz"
196 "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
197 "0123456789_<>()")));
200 if (vec.
size() == dof_handler->n_dofs())
202 typename std::vector<DataVector>::iterator data_vector = dof_data.begin();
203 for (; data_vector != dof_data.end(); ++data_vector)
204 if (data_vector->names == names)
206 data_vector->data.reinit(vec.
size());
216 if (dof_handler->n_dofs() !=
217 dof_handler->get_triangulation().n_active_cells())
218 Assert(
false, ExcVectorNotDeclared(names[0]));
222 if ((vec.
size() != dof_handler->n_dofs()) ||
223 (dof_handler->n_dofs() ==
224 dof_handler->get_triangulation().n_active_cells()))
226 typename std::vector<DataVector>::iterator data_vector =
228 for (; data_vector != cell_data.end(); ++data_vector)
229 if (data_vector->names == names)
231 data_vector->data.reinit(vec.
size());
235 Assert(
false, ExcVectorNotDeclared(names[0]));
245template <
int dim,
int spacedim>
248 const unsigned int nnnn_subdivisions)
252 unsigned int n_subdivisions =
253 (nnnn_subdivisions != 0) ? nnnn_subdivisions : this->default_subdivisions;
255 Assert(n_subdivisions >= 1,
258 Assert(dof_handler !=
nullptr,
261 this->validate_dataset_names();
263 const unsigned int n_components = dof_handler->get_fe(0).n_components();
264 const unsigned int n_datasets =
265 dof_data.size() * n_components + cell_data.size();
270 unsigned int n_patches = 0;
273 cell != dof_handler->end();
301 const unsigned int n_q_points = patch_points.
size();
302 std::vector<double> patch_values(n_q_points);
303 std::vector<Vector<double>> patch_values_system(n_q_points,
313 default_patch.
data.reinit(n_datasets, n_q_points * (n_subdivisions + 1));
314 patches.insert(patches.end(), n_patches, default_patch);
318 typename std::vector<::DataOutBase::Patch<dim + 1, dim + 1>>::iterator
319 patch = patches.begin() + (patches.size() - n_patches);
320 unsigned int cell_number = 0;
323 cell != dof_handler->end();
324 ++cell, ++patch, ++cell_number)
346 patch->vertices[2] =
Point<dim + 1>(cell->vertex(0)(0), parameter);
347 patch->vertices[3] =
Point<dim + 1>(cell->vertex(1)(0), parameter);
353 parameter - parameter_step);
356 parameter - parameter_step);
359 parameter - parameter_step);
362 parameter - parameter_step);
364 Point<dim + 1>(cell->vertex(0)(0), cell->vertex(0)(1), parameter);
366 Point<dim + 1>(cell->vertex(1)(0), cell->vertex(1)(1), parameter);
368 Point<dim + 1>(cell->vertex(2)(0), cell->vertex(2)(1), parameter);
370 Point<dim + 1>(cell->vertex(3)(0), cell->vertex(3)(1), parameter);
386 x_fe_patch_values.
reinit(cell);
391 for (
unsigned int dataset = 0; dataset < dof_data.size(); ++dataset)
393 if (n_components == 1)
395 fe_patch_values.get_function_values(dof_data[dataset].data,
397 for (
unsigned int i = 0; i < n_subdivisions + 1; ++i)
398 for (
unsigned int q = 0; q < n_q_points; ++q)
399 patch->data(dataset, q + n_q_points * i) =
405 fe_patch_values.get_function_values(dof_data[dataset].data,
406 patch_values_system);
407 for (
unsigned int component = 0; component < n_components;
409 for (
unsigned int i = 0; i < n_subdivisions + 1; ++i)
410 for (
unsigned int q = 0; q < n_q_points; ++q)
411 patch->data(dataset * n_components + component,
412 q + n_q_points * i) =
413 patch_values_system[q](component);
418 for (
unsigned int dataset = 0; dataset < cell_data.size(); ++dataset)
420 const double value = cell_data[dataset].data(cell_number);
421 for (
unsigned int q = 0; q < n_q_points; ++q)
422 for (
unsigned int i = 0; i < n_subdivisions + 1; ++i)
423 patch->data(dataset + dof_data.size() * n_components,
424 q * (n_subdivisions + 1) + i) = value;
431template <
int dim,
int spacedim>
436 dof_handler =
nullptr;
437 for (
typename std::vector<DataVector>::iterator i = dof_data.begin();
442 for (
typename std::vector<DataVector>::iterator i = cell_data.begin();
443 i != cell_data.end();
450template <
int dim,
int spacedim>
465template <
int dim,
int spacedim>
466const std::vector<::DataOutBase::Patch<dim + 1, dim + 1>> &
474template <
int dim,
int spacedim>
475std::vector<std::string>
478 std::vector<std::string> names;
479 for (
typename std::vector<DataVector>::const_iterator dataset =
481 dataset != dof_data.end();
483 names.insert(names.end(), dataset->names.begin(), dataset->names.end());
484 for (
typename std::vector<DataVector>::const_iterator dataset =
486 dataset != cell_data.end();
488 names.insert(names.end(), dataset->names.begin(), dataset->names.end());
496#include "data_out_stack.inst"
active_cell_iterator begin_active(const unsigned int level=0) const
unsigned int size() const
const FEValuesType & get_present_fe_values() const
void reinit(const TriaIterator< DoFCellAccessor< dim, spacedim, lda > > &cell, const unsigned int q_index=numbers::invalid_unsigned_int, const unsigned int mapping_index=numbers::invalid_unsigned_int, const unsigned int fe_index=numbers::invalid_unsigned_int)
#define DEAL_II_NAMESPACE_OPEN
#define DEAL_II_NAMESPACE_CLOSE
@ update_values
Shape function values.
static ::ExceptionBase & ExcInvalidCharacter(std::string arg1, size_t arg2)
static ::ExceptionBase & ExcInvalidNumberOfSubdivisions(int arg1)
static ::ExceptionBase & ExcNotImplemented()
static ::ExceptionBase & ExcInvalidNumberOfNames(int arg1, int arg2)
#define Assert(cond, exc)
static ::ExceptionBase & ExcNoDoFHandlerSelected()
static ::ExceptionBase & ExcInternalError()
unsigned int n_subdivisions
std::enable_if< std::is_fundamental< T >::value, std::size_t >::type memory_consumption(const T &t)
void copy(const T *begin, const T *end, U *dest)