const unsigned int n_q_points = fe_patch_values.n_quadrature_points;
- // depending on the requested output of curved cells, if necessary
+ // First fill the geometric information for the patch: Where are the
+ // nodes in question located.
+ //
+ // Depending on the requested output of curved cells, if necessary
// append the quadrature points to the last rows of the patch.data
// member. This is the case if we want to produce curved cells at the
// boundary and this cell actually is at the boundary, or else if we
}
+ // Next fill the information we get from DoF data
if (scratch_data.n_datasets > 0)
{
// counter for data records
unsigned int offset = 0;
// first fill dof_data
- for (unsigned int dataset = 0; dataset < this->dof_data.size(); ++dataset)
+ unsigned int dataset_number = 0;
+ for (const auto &dataset : this->dof_data)
{
const FEValuesBase<DoFHandlerType::dimension,
DoFHandlerType::space_dimension>
- &this_fe_patch_values = scratch_data.get_present_fe_values(dataset);
+ &this_fe_patch_values =
+ scratch_data.get_present_fe_values(dataset_number);
const unsigned int n_components =
this_fe_patch_values.get_fe().n_components();
const DataPostprocessor<DoFHandlerType::space_dimension>
- *postprocessor = this->dof_data[dataset]->postprocessor;
+ *postprocessor = dataset->postprocessor;
if (postprocessor != nullptr)
{
postprocessor->get_needed_update_flags();
if ((n_components == 1) &&
- (this->dof_data[dataset]->is_complex_valued() == false))
+ (dataset->is_complex_valued() == false))
{
// At each point there is only one component of value,
// gradient etc. Based on the 'if' statement above, we
// components to the postprocessor, and we can safely
// call the function that evaluates a scalar field
if (update_flags & update_values)
- this->dof_data[dataset]->get_function_values(
+ dataset->get_function_values(
this_fe_patch_values,
internal::DataOutImplementation::ComponentExtractor::
real_part,
scratch_data.patch_values_scalar.solution_values);
if (update_flags & update_gradients)
- this->dof_data[dataset]->get_function_gradients(
+ dataset->get_function_gradients(
this_fe_patch_values,
internal::DataOutImplementation::ComponentExtractor::
real_part,
scratch_data.patch_values_scalar.solution_gradients);
if (update_flags & update_hessians)
- this->dof_data[dataset]->get_function_hessians(
+ dataset->get_function_hessians(
this_fe_patch_values,
internal::DataOutImplementation::ComponentExtractor::
real_part,
&cell_and_index->first->get_triangulation(),
cell_and_index->first->level(),
cell_and_index->first->index(),
- this->dof_data[dataset]->dof_handler);
+ dataset->dof_handler);
scratch_data.patch_values_scalar
.template set_cell<DoFHandlerType>(dh_cell);
// deals with scalar inputs.
postprocessor->evaluate_scalar_field(
scratch_data.patch_values_scalar,
- scratch_data.postprocessed_values[dataset]);
+ scratch_data.postprocessed_values[dataset_number]);
}
else
{
// we want to pass on to the postprocessor. If the field in
// question is real-valued, we'll just extract the (only)
// real component from the solution fields
- if (this->dof_data[dataset]->is_complex_valued() == false)
+ if (dataset->is_complex_valued() == false)
{
scratch_data.resize_system_vectors(n_components);
if (update_flags & update_values)
- this->dof_data[dataset]->get_function_values(
+ dataset->get_function_values(
this_fe_patch_values,
internal::DataOutImplementation::ComponentExtractor::
real_part,
scratch_data.patch_values_system.solution_values);
if (update_flags & update_gradients)
- this->dof_data[dataset]->get_function_gradients(
+ dataset->get_function_gradients(
this_fe_patch_values,
internal::DataOutImplementation::ComponentExtractor::
real_part,
scratch_data.patch_values_system.solution_gradients);
if (update_flags & update_hessians)
- this->dof_data[dataset]->get_function_hessians(
+ dataset->get_function_hessians(
this_fe_patch_values,
internal::DataOutImplementation::ComponentExtractor::
real_part,
// scratch_data.patch_values_system output fields
if (update_flags & update_values)
{
- this->dof_data[dataset]->get_function_values(
+ dataset->get_function_values(
this_fe_patch_values,
internal::DataOutImplementation::
ComponentExtractor::real_part,
if (update_flags & update_gradients)
{
- this->dof_data[dataset]->get_function_gradients(
+ dataset->get_function_gradients(
this_fe_patch_values,
internal::DataOutImplementation::
ComponentExtractor::real_part,
if (update_flags & update_hessians)
{
- this->dof_data[dataset]->get_function_hessians(
+ dataset->get_function_hessians(
this_fe_patch_values,
internal::DataOutImplementation::
ComponentExtractor::real_part,
// that follow the real one
if (update_flags & update_values)
{
- this->dof_data[dataset]->get_function_values(
+ dataset->get_function_values(
this_fe_patch_values,
internal::DataOutImplementation::
ComponentExtractor::imaginary_part,
if (update_flags & update_gradients)
{
- this->dof_data[dataset]->get_function_gradients(
+ dataset->get_function_gradients(
this_fe_patch_values,
internal::DataOutImplementation::
ComponentExtractor::imaginary_part,
if (update_flags & update_hessians)
{
- this->dof_data[dataset]->get_function_hessians(
+ dataset->get_function_hessians(
this_fe_patch_values,
internal::DataOutImplementation::
ComponentExtractor::imaginary_part,
// This is the vector-valued, complex-valued case. In
// essence, we just need to do the same as above,
- // i.e., call the functions in this->dof_data[dataset]
+ // i.e., call the functions in dataset
// to retrieve first the real and then the imaginary
// part of the solution, then copy them to the
// scratch_data.patch_values_system. The difference to
Vector<double>(n_components));
// First get the real part into the tmp object
- this->dof_data[dataset]->get_function_values(
+ dataset->get_function_values(
this_fe_patch_values,
internal::DataOutImplementation::
ComponentExtractor::real_part,
// Then do the same with the imaginary part,
// copying past the end of the previous set of
// values.
- this->dof_data[dataset]->get_function_values(
+ dataset->get_function_values(
this_fe_patch_values,
internal::DataOutImplementation::
ComponentExtractor::imaginary_part,
n_components));
// First the real part
- this->dof_data[dataset]->get_function_gradients(
+ dataset->get_function_gradients(
this_fe_patch_values,
internal::DataOutImplementation::
ComponentExtractor::real_part,
}
// Then the imaginary part
- this->dof_data[dataset]->get_function_gradients(
+ dataset->get_function_gradients(
this_fe_patch_values,
internal::DataOutImplementation::
ComponentExtractor::imaginary_part,
n_components));
// First the real part
- this->dof_data[dataset]->get_function_hessians(
+ dataset->get_function_hessians(
this_fe_patch_values,
internal::DataOutImplementation::
ComponentExtractor::real_part,
}
// Then the imaginary part
- this->dof_data[dataset]->get_function_hessians(
+ dataset->get_function_hessians(
this_fe_patch_values,
internal::DataOutImplementation::
ComponentExtractor::imaginary_part,
&cell_and_index->first->get_triangulation(),
cell_and_index->first->level(),
cell_and_index->first->index(),
- this->dof_data[dataset]->dof_handler);
+ dataset->dof_handler);
scratch_data.patch_values_system
.template set_cell<DoFHandlerType>(dh_cell);
// evaluate_vector_field() function.
postprocessor->evaluate_vector_field(
scratch_data.patch_values_system,
- scratch_data.postprocessed_values[dataset]);
+ scratch_data.postprocessed_values[dataset_number]);
}
// Now we need to copy the result of the postprocessor to
// by the functions in DataOutBase
for (unsigned int q = 0; q < n_q_points; ++q)
for (unsigned int component = 0;
- component < this->dof_data[dataset]->n_output_variables;
+ component < dataset->n_output_variables;
++component)
patch.data(offset + component, q) =
- scratch_data.postprocessed_values[dataset][q](component);
+ scratch_data.postprocessed_values[dataset_number][q](
+ component);
}
else
{
if (n_components == 1)
{
// first output the real part of the solution vector
- this->dof_data[dataset]->get_function_values(
+ dataset->get_function_values(
this_fe_patch_values,
internal::DataOutImplementation::ComponentExtractor::
real_part,
scratch_data.patch_values_scalar.solution_values[q];
// and if there is one, also output the imaginary part
- if (this->dof_data[dataset]->is_complex_valued() == true)
+ if (dataset->is_complex_valued() == true)
{
- this->dof_data[dataset]->get_function_values(
+ dataset->get_function_values(
this_fe_patch_values,
internal::DataOutImplementation::ComponentExtractor::
imaginary_part,
// same as above: first the real part
const unsigned int stride =
- (this->dof_data[dataset]->is_complex_valued() ? 2 : 1);
- this->dof_data[dataset]->get_function_values(
+ (dataset->is_complex_valued() ? 2 : 1);
+ dataset->get_function_values(
this_fe_patch_values,
internal::DataOutImplementation::ComponentExtractor::
real_part,
component);
// and if there is one, also output the imaginary part
- if (this->dof_data[dataset]->is_complex_valued() == true)
+ if (dataset->is_complex_valued() == true)
{
- this->dof_data[dataset]->get_function_values(
+ dataset->get_function_values(
this_fe_patch_values,
internal::DataOutImplementation::ComponentExtractor::
imaginary_part,
// of a complex-valued quantity and if it is not further
// processed by a postprocessor, then we need two output
// slots for each input variable.
- offset += this->dof_data[dataset]->n_output_variables *
- (this->dof_data[dataset]->is_complex_valued() &&
- (this->dof_data[dataset]->postprocessor == nullptr) ?
+ offset += dataset->n_output_variables *
+ (dataset->is_complex_valued() &&
+ (dataset->postprocessor == nullptr) ?
2 :
1);
+
+ // Also update the dataset_number index that we carry along with the
+ // for-loop over all data sets.
+ ++dataset_number;
}
- // then do the cell data. only compute the number of a cell if needed;
+ // Then do the cell data. only compute the number of a cell if needed;
// also make sure that we only access cell data if the
// first_cell/next_cell functions only return active cells
+ //
+ // At least, we don't have to worry about complex-valued vectors/tensors
+ // since cell data is always scalar.
if (this->cell_data.size() != 0)
{
Assert(!cell_and_index->first->has_children(), ExcNotImplemented());
- for (unsigned int dataset = 0; dataset < this->cell_data.size();
- ++dataset)
+ for (const auto &dataset : this->cell_data)
{
// as above, first output the real part
{
const double value =
- this->cell_data[dataset]->get_cell_data_value(
- cell_and_index->second,
- internal::DataOutImplementation::ComponentExtractor::
- real_part);
+ dataset->get_cell_data_value(cell_and_index->second,
+ internal::DataOutImplementation::
+ ComponentExtractor::real_part);
for (unsigned int q = 0; q < n_q_points; ++q)
patch.data(offset, q) = value;
}
// and if there is one, also output the imaginary part
- if (this->cell_data[dataset]->is_complex_valued() == true)
+ if (dataset->is_complex_valued() == true)
{
- const double value =
- this->cell_data[dataset]->get_cell_data_value(
- cell_and_index->second,
- internal::DataOutImplementation::ComponentExtractor::
- imaginary_part);
+ const double value = dataset->get_cell_data_value(
+ cell_and_index->second,
+ internal::DataOutImplementation::ComponentExtractor::
+ imaginary_part);
for (unsigned int q = 0; q < n_q_points; ++q)
patch.data(offset + 1, q) = value;
}
- offset += (this->cell_data[dataset]->is_complex_valued() ? 2 : 1);
+ offset += (dataset->is_complex_valued() ? 2 : 1);
}
}
}