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());
207 std::copy(vec.
begin(), vec.
end(), data_vector->data.begin());
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());
232 std::copy(vec.
begin(), vec.
end(), data_vector->data.begin());
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;
272 dof_handler->begin_active();
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.
reference_cell = ReferenceCells::get_hypercube<dim + 1>();
314 default_patch.
data.reinit(n_datasets, n_q_points * (n_subdivisions + 1));
315 patches.insert(patches.end(), n_patches, default_patch);
319 typename std::vector<
321 patches.begin() + (patches.size() - n_patches);
322 unsigned int cell_number = 0;
324 dof_handler->begin_active();
325 cell != dof_handler->end();
326 ++cell, ++patch, ++cell_number)
348 patch->vertices[2] =
Point<dim + 1>(cell->vertex(0)(0), parameter);
349 patch->vertices[3] =
Point<dim + 1>(cell->vertex(1)(0), parameter);
355 parameter - parameter_step);
358 parameter - parameter_step);
361 parameter - parameter_step);
364 parameter - parameter_step);
366 Point<dim + 1>(cell->vertex(0)(0), cell->vertex(0)(1), parameter);
368 Point<dim + 1>(cell->vertex(1)(0), cell->vertex(1)(1), parameter);
370 Point<dim + 1>(cell->vertex(2)(0), cell->vertex(2)(1), parameter);
372 Point<dim + 1>(cell->vertex(3)(0), cell->vertex(3)(1), parameter);
388 x_fe_patch_values.
reinit(cell);
393 for (
unsigned int dataset = 0; dataset < dof_data.size(); ++dataset)
395 if (n_components == 1)
399 for (
unsigned int i = 0; i < n_subdivisions + 1; ++i)
400 for (
unsigned int q = 0; q < n_q_points; ++q)
401 patch->data(dataset, q + n_q_points * i) =
408 patch_values_system);
409 for (
unsigned int component = 0; component < n_components;
411 for (
unsigned int i = 0; i < n_subdivisions + 1; ++i)
412 for (
unsigned int q = 0; q < n_q_points; ++q)
413 patch->data(dataset * n_components + component,
414 q + n_q_points * i) =
415 patch_values_system[q](component);
420 for (
unsigned int dataset = 0; dataset < cell_data.size(); ++dataset)
422 const double value = cell_data[dataset].data(cell_number);
423 for (
unsigned int q = 0; q < n_q_points; ++q)
424 for (
unsigned int i = 0; i < n_subdivisions + 1; ++i)
425 patch->data(dataset + dof_data.size() * n_components,
426 q * (n_subdivisions + 1) + i) = value;
433template <
int dim,
int spacedim>
438 dof_handler =
nullptr;
439 for (
typename std::vector<DataVector>::iterator i = dof_data.begin();
444 for (
typename std::vector<DataVector>::iterator i = cell_data.begin();
445 i != cell_data.end();
452template <
int dim,
int spacedim>
467template <
int dim,
int spacedim>
479template <
int dim,
int spacedim>
480std::vector<std::string>
483 std::vector<std::string> names;
484 for (
typename std::vector<DataVector>::const_iterator dataset =
486 dataset != dof_data.end();
488 names.insert(names.end(), dataset->names.begin(), dataset->names.end());
489 for (
typename std::vector<DataVector>::const_iterator dataset =
491 dataset != cell_data.end();
493 names.insert(names.end(), dataset->names.begin(), dataset->names.end());
501#include "data_out_stack.inst"
void get_function_values(const InputVector &fe_function, std::vector< typename InputVector::value_type > &values) 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)
ReferenceCell reference_cell
static ::ExceptionBase & ExcNotImplemented()
static ::ExceptionBase & ExcInvalidNumberOfNames(int arg1, int arg2)
#define Assert(cond, exc)
static ::ExceptionBase & ExcNoDoFHandlerSelected()
static ::ExceptionBase & ExcInternalError()
unsigned int n_subdivisions
typename ActiveSelector::active_cell_iterator active_cell_iterator
std::enable_if< std::is_fundamental< T >::value, std::size_t >::type memory_consumption(const T &t)