#include <fstream>
#include <iostream>
-#include <list>
namespace Step41
: Function<dim>()
{}
- virtual double value(const Point<dim> & p,
- const unsigned int component = 0) const override;
- };
-
- template <int dim>
- double RightHandSide<dim>::value(const Point<dim> &,
- const unsigned int component) const
- {
- (void)component;
- Assert(component == 0, ExcIndexRange(component, 0, 1));
+ virtual double value(const Point<dim> & /*p*/,
+ const unsigned int component = 0) const override
+ {
+ (void)component;
+ AssertIndexRange(component, 1);
- return -10;
- }
+ return -10;
+ }
+ };
: Function<dim>()
{}
- virtual double value(const Point<dim> & p,
- const unsigned int component = 0) const override;
- };
-
- template <int dim>
- double BoundaryValues<dim>::value(const Point<dim> &,
- const unsigned int component) const
- {
- (void)component;
- Assert(component == 0, ExcIndexRange(component, 0, 1));
+ virtual double value(const Point<dim> & /*p*/,
+ const unsigned int component = 0) const override
+ {
+ (void)component;
+ AssertIndexRange(component, 1);
- return 0;
- }
+ return 0;
+ }
+ };
{}
virtual double value(const Point<dim> & p,
- const unsigned int component = 0) const override;
+ const unsigned int component = 0) const override
+ {
+ (void)component;
+ Assert(component == 0, ExcIndexRange(component, 0, 1));
+
+ if (p(0) < -0.5)
+ return -0.2;
+ else if (p(0) >= -0.5 && p(0) < 0.0)
+ return -0.4;
+ else if (p(0) >= 0.0 && p(0) < 0.5)
+ return -0.6;
+ else
+ return -0.8;
+ }
};
- template <int dim>
- double Obstacle<dim>::value(const Point<dim> & p,
- const unsigned int component) const
- {
- (void)component;
- Assert(component == 0, ExcIndexRange(component, 0, 1));
-
- if (p(0) < -0.5)
- return -0.2;
- else if (p(0) >= -0.5 && p(0) < 0.0)
- return -0.4;
- else if (p(0) >= 0.0 && p(0) < 0.5)
- return -0.6;
- else
- return -0.8;
- }
-
// @sect3{Implementation of the <code>ObstacleProblem</code> class}
std::vector<types::global_dof_index> local_dof_indices(dofs_per_cell);
- typename DoFHandler<dim>::active_cell_iterator cell =
- dof_handler.begin_active(),
- endc = dof_handler.end();
-
- for (; cell != endc; ++cell)
+ for (const auto &cell : dof_handler.active_cell_iterators())
{
fe_values.reinit(cell);
cell_matrix = 0;
FullMatrix<double> cell_matrix(dofs_per_cell, dofs_per_cell);
std::vector<types::global_dof_index> local_dof_indices(dofs_per_cell);
- typename DoFHandler<dim>::active_cell_iterator cell =
- dof_handler.begin_active(),
- endc = dof_handler.end();
-
- for (; cell != endc; ++cell)
+ for (const auto &cell : dof_handler.active_cell_iterators())
{
fe_values.reinit(cell);
cell_matrix = 0;
const Obstacle<dim> obstacle;
std::vector<bool> dof_touched(dof_handler.n_dofs(), false);
- typename DoFHandler<dim>::active_cell_iterator cell =
- dof_handler.begin_active(),
- endc = dof_handler.end();
- for (; cell != endc; ++cell)
+ for (const auto &cell : dof_handler.active_cell_iterators())
for (unsigned int v = 0; v < GeometryInfo<dim>::vertices_per_cell; ++v)
{
Assert(dof_handler.get_fe().dofs_per_cell ==
data_out.build_patches();
- std::ofstream output_vtk(std::string("output_") +
+ std::ofstream output_vtk("output_" +
Utilities::int_to_string(iteration, 3) + ".vtk");
data_out.write_vtk(output_vtk);
}