}
-Explicit::Explicit(const FullMatrix<double> &M) : matrix(&M)
+Explicit::Explicit(const FullMatrix<double> &M)
+ : matrix(&M)
{
m.reinit(M.m(), M.n());
}
}
-Implicit::Implicit(const FullMatrix<double> &M) : matrix(&M)
+Implicit::Implicit(const FullMatrix<double> &M)
+ : matrix(&M)
{
m.reinit(M.m(), M.n());
}
// Then we create a FEFaceValues object instead of a FEValues object
// as in the previous function. Again, we pass a mapping as first
// argument.
- FEFaceValues<dim> fe_face_values(
- mapping, fe, quadrature, update_JxW_values);
- ConvergenceTable table;
+ FEFaceValues<dim> fe_face_values(mapping,
+ fe,
+ quadrature,
+ update_JxW_values);
+ ConvergenceTable table;
for (unsigned int refinement = 0; refinement < 6;
++refinement, triangulation.refine_global(1))
// denotes the polynomial degree), and mappings of given order. Print to
// screen what we are about to do.
template <int dim>
- LaplaceProblem<dim>::LaplaceProblem(const unsigned int mapping_degree) :
- fe(1),
- dof_handler(triangulation),
- mapping(mapping_degree)
+ LaplaceProblem<dim>::LaplaceProblem(const unsigned int mapping_degree)
+ : fe(1)
+ , dof_handler(triangulation)
+ , mapping(mapping_degree)
{
std::cout << "Using mapping with degree " << mapping_degree << ":"
<< std::endl
// whose every element equals <code>true</code> when one just default
// constructs such an object, so this is what we'll do here.
std::vector<bool> boundary_dofs(dof_handler.n_dofs(), false);
- DoFTools::extract_boundary_dofs(
- dof_handler, ComponentMask(), boundary_dofs);
+ DoFTools::extract_boundary_dofs(dof_handler,
+ ComponentMask(),
+ boundary_dofs);
// Now first for the generation of the constraints: as mentioned in the
// introduction, we constrain one of the nodes on the boundary by the
// side function.
//
// Let us look at the way the matrix and body forces are integrated:
- const unsigned int gauss_degree = std::max(
- static_cast<unsigned int>(std::ceil(1. * (mapping.get_degree() + 1) / 2)),
- 2U);
- MatrixTools::create_laplace_matrix(
- mapping, dof_handler, QGauss<dim>(gauss_degree), system_matrix);
+ const unsigned int gauss_degree =
+ std::max(static_cast<unsigned int>(
+ std::ceil(1. * (mapping.get_degree() + 1) / 2)),
+ 2U);
+ MatrixTools::create_laplace_matrix(mapping,
+ dof_handler,
+ QGauss<dim>(gauss_degree),
+ system_matrix);
VectorTools::create_right_hand_side(mapping,
dof_handler,
QGauss<dim>(gauss_degree),
// Then, the function just called returns its results as a vector of
// values each of which denotes the norm on one cell. To get the global
// norm, we do the following:
- const double norm = VectorTools::compute_global_error(
- triangulation, norm_per_cell, VectorTools::H1_seminorm);
+ const double norm =
+ VectorTools::compute_global_error(triangulation,
+ norm_per_cell,
+ VectorTools::H1_seminorm);
// Last task -- generate output:
output_table.add_value("cells", triangulation.n_active_cells());
// We start with the constructor. The 1 in the constructor call of
// <code>fe</code> is the polynomial degree.
template <int dim>
- AdvectionProblem<dim>::AdvectionProblem() :
- mapping(),
- fe(1),
- dof_handler(triangulation)
+ AdvectionProblem<dim>::AdvectionProblem()
+ : mapping()
+ , fe(1)
+ , dof_handler(triangulation)
{}
// used. Since the quadratures for cells, boundary and interior faces can
// be selected independently, we have to hand over this value three times.
const unsigned int n_gauss_points = dof_handler.get_fe().degree + 1;
- info_box.initialize_gauss_quadrature(
- n_gauss_points, n_gauss_points, n_gauss_points);
+ info_box.initialize_gauss_quadrature(n_gauss_points,
+ n_gauss_points,
+ n_gauss_points);
// These are the types of values we need for integrating our system. They
// are added to the flags used on cells, boundary and interior faces, as
Vector<float> gradient_indicator(triangulation.n_active_cells());
// Now the approximate gradients are computed
- DerivativeApproximation::approximate_gradient(
- mapping, dof_handler, solution, gradient_indicator);
+ DerivativeApproximation::approximate_gradient(mapping,
+ dof_handler,
+ solution,
+ gradient_indicator);
// and they are cell-wise scaled by the factor $h^{1+d/2}$
typename DoFHandler<dim>::active_cell_iterator cell =
std::pow(cell->diameter(), 1 + 1.0 * dim / 2);
// Finally they serve as refinement indicator.
- GridRefinement::refine_and_coarsen_fixed_number(
- triangulation, gradient_indicator, 0.3, 0.1);
+ GridRefinement::refine_and_coarsen_fixed_number(triangulation,
+ gradient_indicator,
+ 0.3,
+ 0.1);
triangulation.execute_coarsening_and_refinement();
}
template <int dim>
PointValueEvaluation<dim>::PointValueEvaluation(
const Point<dim> &evaluation_point,
- TableHandler & results_table) :
- evaluation_point(evaluation_point),
- results_table(results_table)
+ TableHandler & results_table)
+ : evaluation_point(evaluation_point)
+ , results_table(results_table)
{}
template <int dim>
SolutionOutput<dim>::SolutionOutput(
const std::string & output_name_base,
- const DataOutBase::OutputFormat output_format) :
- output_name_base(output_name_base),
- output_format(output_format)
+ const DataOutBase::OutputFormat output_format)
+ : output_name_base(output_name_base)
+ , output_format(output_format)
{}
// The implementation of the only two non-abstract functions is then
// rather boring:
template <int dim>
- Base<dim>::Base(Triangulation<dim> &coarse_grid) :
- triangulation(&coarse_grid)
+ Base<dim>::Base(Triangulation<dim> &coarse_grid)
+ : triangulation(&coarse_grid)
{}
Solver<dim>::Solver(Triangulation<dim> & triangulation,
const FiniteElement<dim> &fe,
const Quadrature<dim> & quadrature,
- const Function<dim> & boundary_values) :
- Base<dim>(triangulation),
- fe(&fe),
- quadrature(&quadrature),
- dof_handler(triangulation),
- boundary_values(&boundary_values)
+ const Function<dim> & boundary_values)
+ : Base<dim>(triangulation)
+ , fe(&fe)
+ , quadrature(&quadrature)
+ , dof_handler(triangulation)
+ , boundary_values(&boundary_values)
{}
// expression to a function pointer type that is specific to the
// version of the function that you want to call on the task.)
std::map<types::global_dof_index, double> boundary_value_map;
- VectorTools::interpolate_boundary_values(
- dof_handler, 0, *boundary_values, boundary_value_map);
+ VectorTools::interpolate_boundary_values(dof_handler,
+ 0,
+ *boundary_values,
+ boundary_value_map);
rhs_task.join();
linear_system.hanging_node_constraints.condense(linear_system.rhs);
// Now that we have the complete linear system, we can also
// treat boundary values, which need to be eliminated from both
// the matrix and the right hand side:
- MatrixTools::apply_boundary_values(
- boundary_value_map, linear_system.matrix, solution, linear_system.rhs);
+ MatrixTools::apply_boundary_values(boundary_value_map,
+ linear_system.matrix,
+ solution,
+ linear_system.rhs);
}
template <int dim>
Solver<dim>::AssemblyScratchData::AssemblyScratchData(
const FiniteElement<dim> &fe,
- const Quadrature<dim> & quadrature) :
- fe_values(fe, quadrature, update_gradients | update_JxW_values)
+ const Quadrature<dim> & quadrature)
+ : fe_values(fe, quadrature, update_gradients | update_JxW_values)
{}
template <int dim>
Solver<dim>::AssemblyScratchData::AssemblyScratchData(
- const AssemblyScratchData &scratch_data) :
- fe_values(scratch_data.fe_values.get_fe(),
- scratch_data.fe_values.get_quadrature(),
- update_gradients | update_JxW_values)
+ const AssemblyScratchData &scratch_data)
+ : fe_values(scratch_data.fe_values.get_fe(),
+ scratch_data.fe_values.get_quadrature(),
+ update_gradients | update_JxW_values)
{}
const FiniteElement<dim> &fe,
const Quadrature<dim> & quadrature,
const Function<dim> & rhs_function,
- const Function<dim> & boundary_values) :
- Base<dim>(triangulation),
- Solver<dim>(triangulation, fe, quadrature, boundary_values),
- rhs_function(&rhs_function)
+ const Function<dim> & boundary_values)
+ : Base<dim>(triangulation)
+ , Solver<dim>(triangulation, fe, quadrature, boundary_values)
+ , rhs_function(&rhs_function)
{}
const FiniteElement<dim> &fe,
const Quadrature<dim> & quadrature,
const Function<dim> & rhs_function,
- const Function<dim> & boundary_values) :
- Base<dim>(coarse_grid),
- PrimalSolver<dim>(coarse_grid,
- fe,
- quadrature,
- rhs_function,
- boundary_values)
+ const Function<dim> & boundary_values)
+ : Base<dim>(coarse_grid)
+ , PrimalSolver<dim>(coarse_grid,
+ fe,
+ quadrature,
+ rhs_function,
+ boundary_values)
{}
template <int dim>
- RefinementKelly<dim>::RefinementKelly(
- Triangulation<dim> & coarse_grid,
- const FiniteElement<dim> &fe,
- const Quadrature<dim> & quadrature,
- const Function<dim> & rhs_function,
- const Function<dim> & boundary_values) :
- Base<dim>(coarse_grid),
- PrimalSolver<dim>(coarse_grid,
- fe,
- quadrature,
- rhs_function,
- boundary_values)
+ RefinementKelly<dim>::RefinementKelly(Triangulation<dim> & coarse_grid,
+ const FiniteElement<dim> &fe,
+ const Quadrature<dim> & quadrature,
+ const Function<dim> &rhs_function,
+ const Function<dim> &boundary_values)
+ : Base<dim>(coarse_grid)
+ , PrimalSolver<dim>(coarse_grid,
+ fe,
+ quadrature,
+ rhs_function,
+ boundary_values)
{}
typename FunctionMap<dim>::type(),
this->solution,
estimated_error_per_cell);
- GridRefinement::refine_and_coarsen_fixed_number(
- *this->triangulation, estimated_error_per_cell, 0.3, 0.03);
+ GridRefinement::refine_and_coarsen_fixed_number(*this->triangulation,
+ estimated_error_per_cell,
+ 0.3,
+ 0.03);
this->triangulation->execute_coarsening_and_refinement();
}
class Solution : public Function<dim>
{
public:
- Solution() : Function<dim>()
+ Solution()
+ : Function<dim>()
{}
virtual double value(const Point<dim> & p,
class RightHandSide : public Function<dim>
{
public:
- RightHandSide() : Function<dim>()
+ RightHandSide()
+ : Function<dim>()
{}
virtual double value(const Point<dim> & p,
results_table);
// Also generate an evaluator which writes out the solution:
- Evaluation::SolutionOutput<dim> postprocessor2(
- std::string("solution-") + solver_name, DataOutBase::gnuplot);
+ Evaluation::SolutionOutput<dim> postprocessor2(std::string("solution-") +
+ solver_name,
+ DataOutBase::gnuplot);
// Take these two evaluation objects and put them in a list...
std::list<Evaluation::EvaluationBase<dim> *> postprocessor_list;
template <int dim>
PointValueEvaluation<dim>::PointValueEvaluation(
- const Point<dim> &evaluation_point) :
- evaluation_point(evaluation_point)
+ const Point<dim> &evaluation_point)
+ : evaluation_point(evaluation_point)
{}
template <int dim>
PointXDerivativeEvaluation<dim>::PointXDerivativeEvaluation(
- const Point<dim> &evaluation_point) :
- evaluation_point(evaluation_point)
+ const Point<dim> &evaluation_point)
+ : evaluation_point(evaluation_point)
{}
template <int dim>
- GridOutput<dim>::GridOutput(const std::string &output_name_base) :
- output_name_base(output_name_base)
+ GridOutput<dim>::GridOutput(const std::string &output_name_base)
+ : output_name_base(output_name_base)
{}
template <int dim>
- Base<dim>::Base(Triangulation<dim> &coarse_grid) :
- triangulation(&coarse_grid),
- refinement_cycle(numbers::invalid_unsigned_int)
+ Base<dim>::Base(Triangulation<dim> &coarse_grid)
+ : triangulation(&coarse_grid)
+ , refinement_cycle(numbers::invalid_unsigned_int)
{}
const FiniteElement<dim> & fe,
const Quadrature<dim> & quadrature,
const Quadrature<dim - 1> &face_quadrature,
- const Function<dim> & boundary_values) :
- Base<dim>(triangulation),
- fe(&fe),
- quadrature(&quadrature),
- face_quadrature(&face_quadrature),
- dof_handler(triangulation),
- boundary_values(&boundary_values)
+ const Function<dim> & boundary_values)
+ : Base<dim>(triangulation)
+ , fe(&fe)
+ , quadrature(&quadrature)
+ , face_quadrature(&face_quadrature)
+ , dof_handler(triangulation)
+ , boundary_values(&boundary_values)
{}
linear_system.hanging_node_constraints.condense(linear_system.matrix);
std::map<types::global_dof_index, double> boundary_value_map;
- VectorTools::interpolate_boundary_values(
- dof_handler, 0, *boundary_values, boundary_value_map);
+ VectorTools::interpolate_boundary_values(dof_handler,
+ 0,
+ *boundary_values,
+ boundary_value_map);
rhs_task.join();
linear_system.hanging_node_constraints.condense(linear_system.rhs);
- MatrixTools::apply_boundary_values(
- boundary_value_map, linear_system.matrix, solution, linear_system.rhs);
+ MatrixTools::apply_boundary_values(boundary_value_map,
+ linear_system.matrix,
+ solution,
+ linear_system.rhs);
}
template <int dim>
Solver<dim>::AssemblyScratchData::AssemblyScratchData(
const FiniteElement<dim> &fe,
- const Quadrature<dim> & quadrature) :
- fe_values(fe, quadrature, update_gradients | update_JxW_values)
+ const Quadrature<dim> & quadrature)
+ : fe_values(fe, quadrature, update_gradients | update_JxW_values)
{}
template <int dim>
Solver<dim>::AssemblyScratchData::AssemblyScratchData(
- const AssemblyScratchData &scratch_data) :
- fe_values(scratch_data.fe_values.get_fe(),
- scratch_data.fe_values.get_quadrature(),
- update_gradients | update_JxW_values)
+ const AssemblyScratchData &scratch_data)
+ : fe_values(scratch_data.fe_values.get_fe(),
+ scratch_data.fe_values.get_quadrature(),
+ update_gradients | update_JxW_values)
{}
const Quadrature<dim> & quadrature,
const Quadrature<dim - 1> &face_quadrature,
const Function<dim> & rhs_function,
- const Function<dim> &boundary_values) :
- Base<dim>(triangulation),
- Solver<dim>(triangulation,
- fe,
- quadrature,
- face_quadrature,
- boundary_values),
- rhs_function(&rhs_function)
+ const Function<dim> & boundary_values)
+ : Base<dim>(triangulation)
+ , Solver<dim>(triangulation,
+ fe,
+ quadrature,
+ face_quadrature,
+ boundary_values)
+ , rhs_function(&rhs_function)
{}
const Quadrature<dim> & quadrature,
const Quadrature<dim - 1> &face_quadrature,
const Function<dim> & rhs_function,
- const Function<dim> & boundary_values) :
- Base<dim>(coarse_grid),
- PrimalSolver<dim>(coarse_grid,
- fe,
- quadrature,
- face_quadrature,
- rhs_function,
- boundary_values)
+ const Function<dim> & boundary_values)
+ : Base<dim>(coarse_grid)
+ , PrimalSolver<dim>(coarse_grid,
+ fe,
+ quadrature,
+ face_quadrature,
+ rhs_function,
+ boundary_values)
{}
const Quadrature<dim> & quadrature,
const Quadrature<dim - 1> &face_quadrature,
const Function<dim> & rhs_function,
- const Function<dim> & boundary_values) :
- Base<dim>(coarse_grid),
- PrimalSolver<dim>(coarse_grid,
- fe,
- quadrature,
- face_quadrature,
- rhs_function,
- boundary_values)
+ const Function<dim> & boundary_values)
+ : Base<dim>(coarse_grid)
+ , PrimalSolver<dim>(coarse_grid,
+ fe,
+ quadrature,
+ face_quadrature,
+ rhs_function,
+ boundary_values)
{}
typename FunctionMap<dim>::type(),
this->solution,
estimated_error_per_cell);
- GridRefinement::refine_and_coarsen_fixed_number(
- *this->triangulation, estimated_error_per_cell, 0.3, 0.03);
+ GridRefinement::refine_and_coarsen_fixed_number(*this->triangulation,
+ estimated_error_per_cell,
+ 0.3,
+ 0.03);
this->triangulation->execute_coarsening_and_refinement();
}
const Quadrature<dim - 1> &face_quadrature,
const Function<dim> & rhs_function,
const Function<dim> & boundary_values,
- const Function<dim> & weighting_function) :
- Base<dim>(coarse_grid),
- PrimalSolver<dim>(coarse_grid,
- fe,
- quadrature,
- face_quadrature,
- rhs_function,
- boundary_values),
- weighting_function(&weighting_function)
+ const Function<dim> & weighting_function)
+ : Base<dim>(coarse_grid)
+ , PrimalSolver<dim>(coarse_grid,
+ fe,
+ quadrature,
+ face_quadrature,
+ rhs_function,
+ boundary_values)
+ , weighting_function(&weighting_function)
{}
estimated_error_per_cell(cell->active_cell_index()) *=
weighting_function->value(cell->center());
- GridRefinement::refine_and_coarsen_fixed_number(
- *this->triangulation, estimated_error_per_cell, 0.3, 0.03);
+ GridRefinement::refine_and_coarsen_fixed_number(*this->triangulation,
+ estimated_error_per_cell,
+ 0.3,
+ 0.03);
this->triangulation->execute_coarsening_and_refinement();
}
class BoundaryValues : public Function<dim>
{
public:
- BoundaryValues() : Function<dim>()
+ BoundaryValues()
+ : Function<dim>()
{}
virtual double value(const Point<dim> & p,
class RightHandSide : public Function<dim>
{
public:
- RightHandSide() : Function<dim>()
+ RightHandSide()
+ : Function<dim>()
{}
virtual double value(const Point<dim> & p,
class RightHandSide : public Functions::ConstantFunction<dim>
{
public:
- RightHandSide() : Functions::ConstantFunction<dim>(1.)
+ RightHandSide()
+ : Functions::ConstantFunction<dim>(1.)
{}
};
template <int dim>
PointValueEvaluation<dim>::PointValueEvaluation(
- const Point<dim> &evaluation_point) :
- evaluation_point(evaluation_point)
+ const Point<dim> &evaluation_point)
+ : evaluation_point(evaluation_point)
{}
template <int dim>
PointXDerivativeEvaluation<dim>::PointXDerivativeEvaluation(
- const Point<dim> &evaluation_point) :
- evaluation_point(evaluation_point)
+ const Point<dim> &evaluation_point)
+ : evaluation_point(evaluation_point)
{}
const FiniteElement<dim> & fe,
const Quadrature<dim> & quadrature,
const Quadrature<dim - 1> & face_quadrature,
- const DualFunctional::DualFunctionalBase<dim> &dual_functional) :
- Base<dim>(triangulation),
- Solver<dim>(triangulation,
- fe,
- quadrature,
- face_quadrature,
- boundary_values),
- dual_functional(&dual_functional)
+ const DualFunctional::DualFunctionalBase<dim> &dual_functional)
+ : Base<dim>(triangulation)
+ , Solver<dim>(triangulation,
+ fe,
+ quadrature,
+ face_quadrature,
+ boundary_values)
+ , dual_functional(&dual_functional)
{}
WeightedResidual<dim>::CellData::CellData(
const FiniteElement<dim> &fe,
const Quadrature<dim> & quadrature,
- const Function<dim> & right_hand_side) :
- fe_values(fe,
- quadrature,
- update_values | update_hessians | update_quadrature_points |
- update_JxW_values),
- right_hand_side(&right_hand_side),
- cell_residual(quadrature.size()),
- rhs_values(quadrature.size()),
- dual_weights(quadrature.size()),
- cell_laplacians(quadrature.size())
+ const Function<dim> & right_hand_side)
+ : fe_values(fe,
+ quadrature,
+ update_values | update_hessians | update_quadrature_points |
+ update_JxW_values)
+ , right_hand_side(&right_hand_side)
+ , cell_residual(quadrature.size())
+ , rhs_values(quadrature.size())
+ , dual_weights(quadrature.size())
+ , cell_laplacians(quadrature.size())
{}
template <int dim>
- WeightedResidual<dim>::CellData::CellData(const CellData &cell_data) :
- fe_values(cell_data.fe_values.get_fe(),
- cell_data.fe_values.get_quadrature(),
- update_values | update_hessians | update_quadrature_points |
- update_JxW_values),
- right_hand_side(cell_data.right_hand_side),
- cell_residual(cell_data.cell_residual),
- rhs_values(cell_data.rhs_values),
- dual_weights(cell_data.dual_weights),
- cell_laplacians(cell_data.cell_laplacians)
+ WeightedResidual<dim>::CellData::CellData(const CellData &cell_data)
+ : fe_values(cell_data.fe_values.get_fe(),
+ cell_data.fe_values.get_quadrature(),
+ update_values | update_hessians | update_quadrature_points |
+ update_JxW_values)
+ , right_hand_side(cell_data.right_hand_side)
+ , cell_residual(cell_data.cell_residual)
+ , rhs_values(cell_data.rhs_values)
+ , dual_weights(cell_data.dual_weights)
+ , cell_laplacians(cell_data.cell_laplacians)
{}
template <int dim>
WeightedResidual<dim>::FaceData::FaceData(
const FiniteElement<dim> & fe,
- const Quadrature<dim - 1> &face_quadrature) :
- fe_face_values_cell(fe,
- face_quadrature,
- update_values | update_gradients | update_JxW_values |
- update_normal_vectors),
- fe_face_values_neighbor(fe,
- face_quadrature,
- update_values | update_gradients |
- update_JxW_values | update_normal_vectors),
- fe_subface_values_cell(fe, face_quadrature, update_gradients)
+ const Quadrature<dim - 1> &face_quadrature)
+ : fe_face_values_cell(fe,
+ face_quadrature,
+ update_values | update_gradients |
+ update_JxW_values | update_normal_vectors)
+ , fe_face_values_neighbor(fe,
+ face_quadrature,
+ update_values | update_gradients |
+ update_JxW_values | update_normal_vectors)
+ , fe_subface_values_cell(fe, face_quadrature, update_gradients)
{
const unsigned int n_face_q_points = face_quadrature.size();
template <int dim>
- WeightedResidual<dim>::FaceData::FaceData(const FaceData &face_data) :
- fe_face_values_cell(face_data.fe_face_values_cell.get_fe(),
- face_data.fe_face_values_cell.get_quadrature(),
- update_values | update_gradients | update_JxW_values |
- update_normal_vectors),
- fe_face_values_neighbor(
- face_data.fe_face_values_neighbor.get_fe(),
- face_data.fe_face_values_neighbor.get_quadrature(),
- update_values | update_gradients | update_JxW_values |
- update_normal_vectors),
- fe_subface_values_cell(face_data.fe_subface_values_cell.get_fe(),
- face_data.fe_subface_values_cell.get_quadrature(),
- update_gradients),
- jump_residual(face_data.jump_residual),
- dual_weights(face_data.dual_weights),
- cell_grads(face_data.cell_grads),
- neighbor_grads(face_data.neighbor_grads)
+ WeightedResidual<dim>::FaceData::FaceData(const FaceData &face_data)
+ : fe_face_values_cell(face_data.fe_face_values_cell.get_fe(),
+ face_data.fe_face_values_cell.get_quadrature(),
+ update_values | update_gradients |
+ update_JxW_values | update_normal_vectors)
+ , fe_face_values_neighbor(
+ face_data.fe_face_values_neighbor.get_fe(),
+ face_data.fe_face_values_neighbor.get_quadrature(),
+ update_values | update_gradients | update_JxW_values |
+ update_normal_vectors)
+ , fe_subface_values_cell(
+ face_data.fe_subface_values_cell.get_fe(),
+ face_data.fe_subface_values_cell.get_quadrature(),
+ update_gradients)
+ , jump_residual(face_data.jump_residual)
+ , dual_weights(face_data.dual_weights)
+ , cell_grads(face_data.cell_grads)
+ , neighbor_grads(face_data.neighbor_grads)
{}
const Quadrature<dim - 1> &primal_face_quadrature,
const Function<dim> & rhs_function,
const Vector<double> & primal_solution,
- const Vector<double> & dual_weights) :
- cell_data(primal_fe, primal_quadrature, rhs_function),
- face_data(primal_fe, primal_face_quadrature),
- primal_solution(primal_solution),
- dual_weights(dual_weights)
+ const Vector<double> & dual_weights)
+ : cell_data(primal_fe, primal_quadrature, rhs_function)
+ , face_data(primal_fe, primal_face_quadrature)
+ , primal_solution(primal_solution)
+ , dual_weights(dual_weights)
{}
template <int dim>
WeightedResidual<dim>::WeightedResidualScratchData::
WeightedResidualScratchData(
- const WeightedResidualScratchData &scratch_data) :
- cell_data(scratch_data.cell_data),
- face_data(scratch_data.face_data),
- primal_solution(scratch_data.primal_solution),
- dual_weights(scratch_data.dual_weights)
+ const WeightedResidualScratchData &scratch_data)
+ : cell_data(scratch_data.cell_data)
+ , face_data(scratch_data.face_data)
+ , primal_solution(scratch_data.primal_solution)
+ , dual_weights(scratch_data.dual_weights)
{}
const Quadrature<dim - 1> & face_quadrature,
const Function<dim> & rhs_function,
const Function<dim> & bv,
- const DualFunctional::DualFunctionalBase<dim> &dual_functional) :
- Base<dim>(coarse_grid),
- PrimalSolver<dim>(coarse_grid,
- primal_fe,
+ const DualFunctional::DualFunctionalBase<dim> &dual_functional)
+ : Base<dim>(coarse_grid)
+ , PrimalSolver<dim>(coarse_grid,
+ primal_fe,
+ quadrature,
+ face_quadrature,
+ rhs_function,
+ bv)
+ , DualSolver<dim>(coarse_grid,
+ dual_fe,
quadrature,
face_quadrature,
- rhs_function,
- bv),
- DualSolver<dim>(coarse_grid,
- dual_fe,
- quadrature,
- face_quadrature,
- dual_functional)
+ dual_functional)
{}
// largest error indicators that make up for a total of 80 per cent of
// the error, while we coarsen those with the smallest indicators that
// make up for the bottom 2 per cent of the error.
- GridRefinement::refine_and_coarsen_fixed_fraction(
- *this->triangulation, error_indicators, 0.8, 0.02);
+ GridRefinement::refine_and_coarsen_fixed_fraction(*this->triangulation,
+ error_indicators,
+ 0.8,
+ 0.02);
this->triangulation->execute_coarsening_and_refinement();
}
0.5 * face_integrals[cell->face(face_no)];
}
std::cout << " Estimated error="
- << std::accumulate(
- error_indicators.begin(), error_indicators.end(), 0.)
+ << std::accumulate(error_indicators.begin(),
+ error_indicators.end(),
+ 0.)
<< std::endl;
}
// As for the implementation, first the constructor of the parameter object,
// setting all values to their defaults:
template <int dim>
- Framework<dim>::ProblemDescription::ProblemDescription() :
- primal_fe_degree(1),
- dual_fe_degree(2),
- refinement_criterion(dual_weighted_error_estimator),
- max_degrees_of_freedom(20000)
+ Framework<dim>::ProblemDescription::ProblemDescription()
+ : primal_fe_degree(1)
+ , dual_fe_degree(2)
+ , refinement_criterion(dual_weighted_error_estimator)
+ , max_degrees_of_freedom(20000)
{}
class BoundaryValues : public Function<dim>
{
public:
- BoundaryValues() : Function<dim>()
+ BoundaryValues()
+ : Function<dim>()
{}
virtual double value(const Point<dim> & p,
// few tutorials.
template <int dim>
- MinimalSurfaceProblem<dim>::MinimalSurfaceProblem() :
- dof_handler(triangulation),
- fe(2)
+ MinimalSurfaceProblem<dim>::MinimalSurfaceProblem()
+ : dof_handler(triangulation)
+ , fe(2)
{}
for (unsigned int i = 0; i < dofs_per_cell; ++i)
{
for (unsigned int j = 0; j < dofs_per_cell; ++j)
- system_matrix.add(
- local_dof_indices[i], local_dof_indices[j], cell_matrix(i, j));
+ system_matrix.add(local_dof_indices[i],
+ local_dof_indices[j],
+ cell_matrix(i, j));
system_rhs(local_dof_indices[i]) += cell_rhs(i);
}
hanging_node_constraints.condense(system_rhs);
std::map<types::global_dof_index, double> boundary_values;
- VectorTools::interpolate_boundary_values(
- dof_handler, 0, Functions::ZeroFunction<dim>(), boundary_values);
- MatrixTools::apply_boundary_values(
- boundary_values, system_matrix, newton_update, system_rhs);
+ VectorTools::interpolate_boundary_values(dof_handler,
+ 0,
+ Functions::ZeroFunction<dim>(),
+ boundary_values);
+ MatrixTools::apply_boundary_values(boundary_values,
+ system_matrix,
+ newton_update,
+ system_rhs);
}
present_solution,
estimated_error_per_cell);
- GridRefinement::refine_and_coarsen_fixed_number(
- triangulation, estimated_error_per_cell, 0.3, 0.03);
+ GridRefinement::refine_and_coarsen_fixed_number(triangulation,
+ estimated_error_per_cell,
+ 0.3,
+ 0.03);
// Then we need an additional step: if, for example, you flag a cell that
// is once more refined than its neighbor, and that neighbor is not
void MinimalSurfaceProblem<dim>::set_boundary_values()
{
std::map<types::global_dof_index, double> boundary_values;
- VectorTools::interpolate_boundary_values(
- dof_handler, 0, BoundaryValues<dim>(), boundary_values);
+ VectorTools::interpolate_boundary_values(dof_handler,
+ 0,
+ BoundaryValues<dim>(),
+ boundary_values);
for (std::map<types::global_dof_index, double>::const_iterator p =
boundary_values.begin();
p != boundary_values.end();
hanging_node_constraints.condense(residual);
std::vector<bool> boundary_dofs(dof_handler.n_dofs());
- DoFTools::extract_boundary_dofs(
- dof_handler, ComponentMask(), boundary_dofs);
+ DoFTools::extract_boundary_dofs(dof_handler,
+ ComponentMask(),
+ boundary_dofs);
for (unsigned int i = 0; i < dof_handler.n_dofs(); ++i)
if (boundary_dofs[i] == true)
residual(i) = 0;
template <int dim>
- LaplaceIntegrator<dim>::LaplaceIntegrator() :
- MeshWorker::LocalIntegrator<dim>(true, false, false)
+ LaplaceIntegrator<dim>::LaplaceIntegrator()
+ : MeshWorker::LocalIntegrator<dim>(true, false, false)
{}
AssertDimension(dinfo.n_matrices(), 1);
const double coefficient = (dinfo.cell->center()(0) > 0.) ? .1 : 1.;
- LocalIntegrators::Laplace::cell_matrix(
- dinfo.matrix(0, false).matrix, info.fe_values(0), coefficient);
+ LocalIntegrators::Laplace::cell_matrix(dinfo.matrix(0, false).matrix,
+ info.fe_values(0),
+ coefficient);
if (dinfo.n_vectors() > 0)
{
std::vector<double> rhs(info.fe_values(0).n_quadrature_points, 1.);
- LocalIntegrators::L2::L2(
- dinfo.vector(0).block(0), info.fe_values(0), rhs);
+ LocalIntegrators::L2::L2(dinfo.vector(0).block(0),
+ info.fe_values(0),
+ rhs);
}
}
// Triangulation::limit_level_difference_at_vertices flag to the constructor
// of the triangulation class.
template <int dim>
- LaplaceProblem<dim>::LaplaceProblem(const unsigned int degree) :
- triangulation(Triangulation<dim>::limit_level_difference_at_vertices),
- fe(degree),
- dof_handler(triangulation),
- degree(degree)
+ LaplaceProblem<dim>::LaplaceProblem(const unsigned int degree)
+ : triangulation(Triangulation<dim>::limit_level_difference_at_vertices)
+ , fe(degree)
+ , dof_handler(triangulation)
+ , degree(degree)
{}
typename FunctionMap<dim>::type(),
solution,
estimated_error_per_cell);
- GridRefinement::refine_and_coarsen_fixed_number(
- triangulation, estimated_error_per_cell, 0.3, 0.03);
+ GridRefinement::refine_and_coarsen_fixed_number(triangulation,
+ estimated_error_per_cell,
+ 0.3,
+ 0.03);
triangulation.execute_coarsening_and_refinement();
}
template <int dim>
- RightHandSide<dim>::RightHandSide() : Function<dim>(dim)
+ RightHandSide<dim>::RightHandSide()
+ : Function<dim>(dim)
{}
// the latter is determined by testing whether the process currently
// executing the constructor call is the first in the MPI universe.
template <int dim>
- ElasticProblem<dim>::ElasticProblem() :
- mpi_communicator(MPI_COMM_WORLD),
- n_mpi_processes(Utilities::MPI::n_mpi_processes(mpi_communicator)),
- this_mpi_process(Utilities::MPI::this_mpi_process(mpi_communicator)),
- pcout(std::cout, (this_mpi_process == 0)),
- dof_handler(triangulation),
- fe(FE_Q<dim>(1), dim)
+ ElasticProblem<dim>::ElasticProblem()
+ : mpi_communicator(MPI_COMM_WORLD)
+ , n_mpi_processes(Utilities::MPI::n_mpi_processes(mpi_communicator))
+ , this_mpi_process(Utilities::MPI::this_mpi_process(mpi_communicator))
+ , pcout(std::cout, (this_mpi_process == 0))
+ , dof_handler(triangulation)
+ , fe(FE_Q<dim>(1), dim)
{}
// to this process (see step-18 or step-40 for a more efficient way to
// handle this).
DynamicSparsityPattern dsp(dof_handler.n_dofs(), dof_handler.n_dofs());
- DoFTools::make_sparsity_pattern(
- dof_handler, dsp, hanging_node_constraints, false);
+ DoFTools::make_sparsity_pattern(dof_handler,
+ dsp,
+ hanging_node_constraints,
+ false);
// Now we determine the set of locally owned DoFs and use that to
// initialize parallel vectors and matrix. Since the matrix and vectors
const IndexSet locally_owned_dofs =
locally_owned_dofs_per_proc[this_mpi_process];
- system_matrix.reinit(
- locally_owned_dofs, locally_owned_dofs, dsp, mpi_communicator);
+ system_matrix.reinit(locally_owned_dofs,
+ locally_owned_dofs,
+ dsp,
+ mpi_communicator);
solution.reinit(locally_owned_dofs, mpi_communicator);
system_rhs.reinit(locally_owned_dofs, mpi_communicator);
// we therefore do not eliminate the entries in the affected
// columns.
std::map<types::global_dof_index, double> boundary_values;
- VectorTools::interpolate_boundary_values(
- dof_handler, 0, Functions::ZeroFunction<dim>(dim), boundary_values);
+ VectorTools::interpolate_boundary_values(dof_handler,
+ 0,
+ Functions::ZeroFunction<dim>(dim),
+ boundary_values);
MatrixTools::apply_boundary_values(
boundary_values, system_matrix, solution, system_rhs, false);
}
// does it in exactly the same way.
const Vector<float> localized_all_errors(distributed_all_errors);
- GridRefinement::refine_and_coarsen_fixed_number(
- triangulation, localized_all_errors, 0.3, 0.03);
+ GridRefinement::refine_and_coarsen_fixed_number(triangulation,
+ localized_all_errors,
+ 0.3,
+ 0.03);
triangulation.execute_coarsening_and_refinement();
}
template <int dim>
- BodyForce<dim>::BodyForce() : Function<dim>(dim)
+ BodyForce<dim>::BodyForce()
+ : Function<dim>(dim)
{}
template <int dim>
IncrementalBoundaryValues<dim>::IncrementalBoundaryValues(
const double present_time,
- const double present_timestep) :
- Function<dim>(dim),
- velocity(.08),
- present_time(present_time),
- present_timestep(present_timestep)
+ const double present_timestep)
+ : Function<dim>(dim)
+ , velocity(.08)
+ , present_time(present_time)
+ , present_timestep(present_timestep)
{}
// Gaussian quadrature formula with 2 points in each coordinate
// direction. The destructor should be obvious:
template <int dim>
- TopLevel<dim>::TopLevel() :
- triangulation(MPI_COMM_WORLD),
- fe(FE_Q<dim>(1), dim),
- dof_handler(triangulation),
- quadrature_formula(2),
- present_time(0.0),
- present_timestep(1.0),
- end_time(10.0),
- timestep_no(0),
- mpi_communicator(MPI_COMM_WORLD),
- n_mpi_processes(Utilities::MPI::n_mpi_processes(mpi_communicator)),
- this_mpi_process(Utilities::MPI::this_mpi_process(mpi_communicator)),
- pcout(std::cout, this_mpi_process == 0),
- n_local_cells(numbers::invalid_unsigned_int)
+ TopLevel<dim>::TopLevel()
+ : triangulation(MPI_COMM_WORLD)
+ , fe(FE_Q<dim>(1), dim)
+ , dof_handler(triangulation)
+ , quadrature_formula(2)
+ , present_time(0.0)
+ , present_timestep(1.0)
+ , end_time(10.0)
+ , timestep_no(0)
+ , mpi_communicator(MPI_COMM_WORLD)
+ , n_mpi_processes(Utilities::MPI::n_mpi_processes(mpi_communicator))
+ , this_mpi_process(Utilities::MPI::this_mpi_process(mpi_communicator))
+ , pcout(std::cout, this_mpi_process == 0)
+ , n_local_cells(numbers::invalid_unsigned_int)
{}
for (unsigned int j = 0; j < dofs_per_cell; ++j)
for (unsigned int q_point = 0; q_point < n_q_points; ++q_point)
{
- const SymmetricTensor<2, dim> eps_phi_i = get_strain(
- fe_values, i, q_point),
- eps_phi_j = get_strain(
- fe_values, j, q_point);
+ const SymmetricTensor<2, dim>
+ eps_phi_i = get_strain(fe_values, i, q_point),
+ eps_phi_j = get_strain(fe_values, j, q_point);
cell_matrix(i, j) += (eps_phi_i * stress_strain_tensor *
eps_phi_j * fe_values.JxW(q_point));
// motion, it has only its last component set:
FEValuesExtractors::Scalar z_component(dim - 1);
std::map<types::global_dof_index, double> boundary_values;
- VectorTools::interpolate_boundary_values(
- dof_handler, 0, Functions::ZeroFunction<dim>(dim), boundary_values);
+ VectorTools::interpolate_boundary_values(dof_handler,
+ 0,
+ Functions::ZeroFunction<dim>(dim),
+ boundary_values);
VectorTools::interpolate_boundary_values(
dof_handler,
1,
// Once we have that, copy it back into local copies on all processors and
// refine the mesh accordingly:
error_per_cell = distributed_error_per_cell;
- GridRefinement::refine_and_coarsen_fixed_number(
- triangulation, error_per_cell, 0.35, 0.03);
+ GridRefinement::refine_and_coarsen_fixed_number(triangulation,
+ error_per_cell,
+ 0.35,
+ 0.03);
triangulation.execute_coarsening_and_refinement();
// Finally, set up quadrature point data again on the new mesh, and only
// the incremental displacements and the gradients thereof at the
// quadrature points, together with a vector that will hold this
// information:
- FEValues<dim> fe_values(
- fe, quadrature_formula, update_values | update_gradients);
+ FEValues<dim> fe_values(fe,
+ quadrature_formula,
+ update_values | update_gradients);
std::vector<std::vector<Tensor<1, dim>>> displacement_increment_grads(
quadrature_formula.size(), std::vector<Tensor<1, dim>>(dim));
class RightHandSide : public Function<dim>
{
public:
- RightHandSide() : Function<dim>(1)
+ RightHandSide()
+ : Function<dim>(1)
{}
virtual double value(const Point<dim> & p,
class PressureBoundaryValues : public Function<dim>
{
public:
- PressureBoundaryValues() : Function<dim>(1)
+ PressureBoundaryValues()
+ : Function<dim>(1)
{}
virtual double value(const Point<dim> & p,
class ExactSolution : public Function<dim>
{
public:
- ExactSolution() : Function<dim>(dim + 1)
+ ExactSolution()
+ : Function<dim>(dim + 1)
{}
virtual void vector_value(const Point<dim> &p,
class KInverse : public TensorFunction<2, dim>
{
public:
- KInverse() : TensorFunction<2, dim>()
+ KInverse()
+ : TensorFunction<2, dim>()
{}
virtual void value_list(const std::vector<Point<dim>> &points,
// used <code>dim</code> copies of the <code>FE_Q(1)</code> element, one
// copy for the displacement in each coordinate direction.
template <int dim>
- MixedLaplaceProblem<dim>::MixedLaplaceProblem(const unsigned int degree) :
- degree(degree),
- fe(FE_RaviartThomas<dim>(degree), 1, FE_DGQ<dim>(degree), 1),
- dof_handler(triangulation)
+ MixedLaplaceProblem<dim>::MixedLaplaceProblem(const unsigned int degree)
+ : degree(degree)
+ , fe(FE_RaviartThomas<dim>(degree), 1, FE_DGQ<dim>(degree), 1)
+ , dof_handler(triangulation)
{}
cell->get_dof_indices(local_dof_indices);
for (unsigned int i = 0; i < dofs_per_cell; ++i)
for (unsigned int j = 0; j < dofs_per_cell; ++j)
- system_matrix.add(
- local_dof_indices[i], local_dof_indices[j], local_matrix(i, j));
+ system_matrix.add(local_dof_indices[i],
+ local_dof_indices[j],
+ local_matrix(i, j));
for (unsigned int i = 0; i < dofs_per_cell; ++i)
system_rhs(local_dof_indices[i]) += local_rhs(i);
}
template <class MatrixType>
- InverseMatrix<MatrixType>::InverseMatrix(const MatrixType &m) : matrix(&m)
+ InverseMatrix<MatrixType>::InverseMatrix(const MatrixType &m)
+ : matrix(&m)
{}
SchurComplement ::SchurComplement(
const BlockSparseMatrix<double> & A,
- const InverseMatrix<SparseMatrix<double>> &Minv) :
- system_matrix(&A),
- m_inverse(&Minv),
- tmp1(A.block(0, 0).m()),
- tmp2(A.block(0, 0).m())
+ const InverseMatrix<SparseMatrix<double>> &Minv)
+ : system_matrix(&A)
+ , m_inverse(&Minv)
+ , tmp1(A.block(0, 0).m())
+ , tmp2(A.block(0, 0).m())
{}
ApproximateSchurComplement::ApproximateSchurComplement(
- const BlockSparseMatrix<double> &A) :
- system_matrix(&A),
- tmp1(A.block(0, 0).m()),
- tmp2(A.block(0, 0).m())
+ const BlockSparseMatrix<double> &A)
+ : system_matrix(&A)
+ , tmp1(A.block(0, 0).m())
+ , tmp2(A.block(0, 0).m())
{}
ApproximateSchurComplement approximate_schur(system_matrix);
InverseMatrix<ApproximateSchurComplement> approximate_inverse(
approximate_schur);
- cg.solve(
- schur_complement, solution.block(1), schur_rhs, approximate_inverse);
+ cg.solve(schur_complement,
+ solution.block(1),
+ schur_rhs,
+ approximate_inverse);
std::cout << solver_control.last_step()
<< " CG Schur complement iterations to obtain convergence."
quadrature,
VectorTools::L2_norm,
&pressure_mask);
- const double p_l2_error = VectorTools::compute_global_error(
- triangulation, cellwise_errors, VectorTools::L2_norm);
+ const double p_l2_error =
+ VectorTools::compute_global_error(triangulation,
+ cellwise_errors,
+ VectorTools::L2_norm);
VectorTools::integrate_difference(dof_handler,
solution,
quadrature,
VectorTools::L2_norm,
&velocity_mask);
- const double u_l2_error = VectorTools::compute_global_error(
- triangulation, cellwise_errors, VectorTools::L2_norm);
+ const double u_l2_error =
+ VectorTools::compute_global_error(triangulation,
+ cellwise_errors,
+ VectorTools::L2_norm);
std::cout << "Errors: ||e_p||_L2 = " << p_l2_error
<< ", ||e_u||_L2 = " << u_l2_error << std::endl;
interpretation.push_back(DataComponentInterpretation::component_is_scalar);
DataOut<dim> data_out;
- data_out.add_data_vector(
- dof_handler, solution, solution_names, interpretation);
+ data_out.add_data_vector(dof_handler,
+ solution,
+ solution_names,
+ interpretation);
data_out.build_patches(degree + 1);
class PressureRightHandSide : public Function<dim>
{
public:
- PressureRightHandSide() : Function<dim>(1)
+ PressureRightHandSide()
+ : Function<dim>(1)
{}
virtual double value(const Point<dim> & p,
class PressureBoundaryValues : public Function<dim>
{
public:
- PressureBoundaryValues() : Function<dim>(1)
+ PressureBoundaryValues()
+ : Function<dim>(1)
{}
virtual double value(const Point<dim> & p,
class SaturationBoundaryValues : public Function<dim>
{
public:
- SaturationBoundaryValues() : Function<dim>(1)
+ SaturationBoundaryValues()
+ : Function<dim>(1)
{}
virtual double value(const Point<dim> & p,
class InitialValues : public Function<dim>
{
public:
- InitialValues() : Function<dim>(dim + 2)
+ InitialValues()
+ : Function<dim>(dim + 2)
{}
virtual double value(const Point<dim> & p,
class KInverse : public TensorFunction<2, dim>
{
public:
- KInverse() : TensorFunction<2, dim>()
+ KInverse()
+ : TensorFunction<2, dim>()
{}
virtual void value_list(const std::vector<Point<dim>> &points,
class KInverse : public TensorFunction<2, dim>
{
public:
- KInverse() : TensorFunction<2, dim>()
+ KInverse()
+ : TensorFunction<2, dim>()
{}
virtual void
template <class MatrixType>
- InverseMatrix<MatrixType>::InverseMatrix(const MatrixType &m) : matrix(&m)
+ InverseMatrix<MatrixType>::InverseMatrix(const MatrixType &m)
+ : matrix(&m)
{}
SchurComplement::SchurComplement(
const BlockSparseMatrix<double> & A,
- const InverseMatrix<SparseMatrix<double>> &Minv) :
- system_matrix(&A),
- m_inverse(&Minv),
- tmp1(A.block(0, 0).m()),
- tmp2(A.block(0, 0).m())
+ const InverseMatrix<SparseMatrix<double>> &Minv)
+ : system_matrix(&A)
+ , m_inverse(&Minv)
+ , tmp1(A.block(0, 0).m())
+ , tmp2(A.block(0, 0).m())
{}
ApproximateSchurComplement::ApproximateSchurComplement(
- const BlockSparseMatrix<double> &A) :
- system_matrix(&A),
- tmp1(A.block(0, 0).m()),
- tmp2(A.block(0, 0).m())
+ const BlockSparseMatrix<double> &A)
+ : system_matrix(&A)
+ , tmp1(A.block(0, 0).m())
+ , tmp2(A.block(0, 0).m())
{}
// before it is needed first, as described in a subsection of the
// introduction.
template <int dim>
- TwoPhaseFlowProblem<dim>::TwoPhaseFlowProblem(const unsigned int degree) :
- degree(degree),
- fe(FE_RaviartThomas<dim>(degree),
- 1,
- FE_DGQ<dim>(degree),
- 1,
- FE_DGQ<dim>(degree),
- 1),
- dof_handler(triangulation),
- n_refinement_steps(5),
- time_step(0),
- timestep_number(1),
- viscosity(0.2)
+ TwoPhaseFlowProblem<dim>::TwoPhaseFlowProblem(const unsigned int degree)
+ : degree(degree)
+ , fe(FE_RaviartThomas<dim>(degree),
+ 1,
+ FE_DGQ<dim>(degree),
+ 1,
+ FE_DGQ<dim>(degree),
+ 1)
+ , dof_handler(triangulation)
+ , n_refinement_steps(5)
+ , time_step(0)
+ , timestep_number(1)
+ , viscosity(0.2)
{}
cell->get_dof_indices(local_dof_indices);
for (unsigned int i = 0; i < dofs_per_cell; ++i)
for (unsigned int j = 0; j < dofs_per_cell; ++j)
- system_matrix.add(
- local_dof_indices[i], local_dof_indices[j], local_matrix(i, j));
+ system_matrix.add(local_dof_indices[i],
+ local_dof_indices[j],
+ local_matrix(i, j));
for (unsigned int i = 0; i < dofs_per_cell; ++i)
system_rhs(local_dof_indices[i]) += local_rhs(i);
update_values | update_normal_vectors |
update_quadrature_points |
update_JxW_values);
- FEFaceValues<dim> fe_face_values_neighbor(
- fe, face_quadrature_formula, update_values);
+ FEFaceValues<dim> fe_face_values_neighbor(fe,
+ face_quadrature_formula,
+ update_values);
const unsigned int dofs_per_cell = fe.dofs_per_cell;
const unsigned int n_q_points = quadrature_formula.size();
std::vector<Vector<double>> old_solution_values(n_q_points,
Vector<double>(dim + 2));
- std::vector<Vector<double>> old_solution_values_face(
- n_face_q_points, Vector<double>(dim + 2));
+ std::vector<Vector<double>> old_solution_values_face(n_face_q_points,
+ Vector<double>(dim +
+ 2));
std::vector<Vector<double>> old_solution_values_face_neighbor(
n_face_q_points, Vector<double>(dim + 2));
- std::vector<Vector<double>> present_solution_values(
- n_q_points, Vector<double>(dim + 2));
+ std::vector<Vector<double>> present_solution_values(n_q_points,
+ Vector<double>(dim +
+ 2));
std::vector<Vector<double>> present_solution_values_face(
n_face_q_points, Vector<double>(dim + 2));
class BoundaryValues : public Function<dim>
{
public:
- BoundaryValues() : Function<dim>(dim + 1)
+ BoundaryValues()
+ : Function<dim>(dim + 1)
{}
virtual double value(const Point<dim> & p,
class RightHandSide : public Function<dim>
{
public:
- RightHandSide() : Function<dim>(dim + 1)
+ RightHandSide()
+ : Function<dim>(dim + 1)
{}
virtual double value(const Point<dim> & p,
template <class MatrixType, class PreconditionerType>
InverseMatrix<MatrixType, PreconditionerType>::InverseMatrix(
const MatrixType & m,
- const PreconditionerType &preconditioner) :
- matrix(&m),
- preconditioner(&preconditioner)
+ const PreconditionerType &preconditioner)
+ : matrix(&m)
+ , preconditioner(&preconditioner)
{}
template <class PreconditionerType>
SchurComplement<PreconditionerType>::SchurComplement(
const BlockSparseMatrix<double> &system_matrix,
- const InverseMatrix<SparseMatrix<double>, PreconditionerType> &A_inverse) :
- system_matrix(&system_matrix),
- A_inverse(&A_inverse),
- tmp1(system_matrix.block(0, 0).m()),
- tmp2(system_matrix.block(0, 0).m())
+ const InverseMatrix<SparseMatrix<double>, PreconditionerType> &A_inverse)
+ : system_matrix(&system_matrix)
+ , A_inverse(&A_inverse)
+ , tmp1(system_matrix.block(0, 0).m())
+ , tmp2(system_matrix.block(0, 0).m())
{}
// grids are too unstructured), see the documentation of
// <code>Triangulation::MeshSmoothing</code> for details.
template <int dim>
- StokesProblem<dim>::StokesProblem(const unsigned int degree) :
- degree(degree),
- triangulation(Triangulation<dim>::maximum_smoothing),
- fe(FE_Q<dim>(degree + 1), dim, FE_Q<dim>(degree), 1),
- dof_handler(triangulation)
+ StokesProblem<dim>::StokesProblem(const unsigned int degree)
+ : degree(degree)
+ , triangulation(Triangulation<dim>::maximum_smoothing)
+ , fe(FE_Q<dim>(degree + 1), dim, FE_Q<dim>(degree), 1)
+ , dof_handler(triangulation)
{}
// <code>DoFTools::count_dofs_per_component</code>, but now grouped as
// velocity and pressure block via <code>block_component</code>.
std::vector<types::global_dof_index> dofs_per_block(2);
- DoFTools::count_dofs_per_block(
- dof_handler, dofs_per_block, block_component);
+ DoFTools::count_dofs_per_block(dof_handler,
+ dofs_per_block,
+ block_component);
const unsigned int n_u = dofs_per_block[0], n_p = dofs_per_block[1];
std::cout << " Number of active cells: " << triangulation.n_active_cells()
estimated_error_per_cell,
fe.component_mask(pressure));
- GridRefinement::refine_and_coarsen_fixed_number(
- triangulation, estimated_error_per_cell, 0.3, 0.0);
+ GridRefinement::refine_and_coarsen_fixed_number(triangulation,
+ estimated_error_per_cell,
+ 0.3,
+ 0.0);
triangulation.execute_coarsening_and_refinement();
}
const Point<dim> top_right =
(dim == 2 ? Point<dim>(2, 0) : Point<dim>(2, 1, 0));
- GridGenerator::subdivided_hyper_rectangle(
- triangulation, subdivisions, bottom_left, top_right);
+ GridGenerator::subdivided_hyper_rectangle(triangulation,
+ subdivisions,
+ bottom_left,
+ top_right);
}
// A boundary indicator of 1 is set to all boundaries that are subject to
class InitialValuesU : public Function<dim>
{
public:
- InitialValuesU() : Function<dim>()
+ InitialValuesU()
+ : Function<dim>()
{}
virtual double value(const Point<dim> & p,
class InitialValuesV : public Function<dim>
{
public:
- InitialValuesV() : Function<dim>()
+ InitialValuesV()
+ : Function<dim>()
{}
virtual double value(const Point<dim> & p,
class RightHandSide : public Function<dim>
{
public:
- RightHandSide() : Function<dim>()
+ RightHandSide()
+ : Function<dim>()
{}
virtual double value(const Point<dim> & p,
class BoundaryValuesU : public Function<dim>
{
public:
- BoundaryValuesU() : Function<dim>()
+ BoundaryValuesU()
+ : Function<dim>()
{}
virtual double value(const Point<dim> & p,
class BoundaryValuesV : public Function<dim>
{
public:
- BoundaryValuesV() : Function<dim>()
+ BoundaryValuesV()
+ : Function<dim>()
{}
virtual double value(const Point<dim> & p,
// time step, see the section on Courant, Friedrichs, and Lewy in the
// introduction):
template <int dim>
- WaveEquation<dim>::WaveEquation() :
- fe(1),
- dof_handler(triangulation),
- time_step(1. / 64),
- time(time_step),
- timestep_number(1),
- theta(0.5)
+ WaveEquation<dim>::WaveEquation()
+ : fe(1)
+ , dof_handler(triangulation)
+ , time_step(1. / 64)
+ , time(time_step)
+ , timestep_number(1)
+ , theta(0.5)
{}
matrix_v.reinit(sparsity_pattern);
MatrixCreator::create_mass_matrix(dof_handler, QGauss<dim>(3), mass_matrix);
- MatrixCreator::create_laplace_matrix(
- dof_handler, QGauss<dim>(3), laplace_matrix);
+ MatrixCreator::create_laplace_matrix(dof_handler,
+ QGauss<dim>(3),
+ laplace_matrix);
// The rest of the function is spent on setting vector sizes to the
// correct value. The final line closes the hanging node constraints
RightHandSide<dim> rhs_function;
rhs_function.set_time(time);
- VectorTools::create_right_hand_side(
- dof_handler, QGauss<dim>(2), rhs_function, tmp);
+ VectorTools::create_right_hand_side(dof_handler,
+ QGauss<dim>(2),
+ rhs_function,
+ tmp);
forcing_terms = tmp;
forcing_terms *= theta * time_step;
rhs_function.set_time(time - time_step);
- VectorTools::create_right_hand_side(
- dof_handler, QGauss<dim>(2), rhs_function, tmp);
+ VectorTools::create_right_hand_side(dof_handler,
+ QGauss<dim>(2),
+ rhs_function,
+ tmp);
forcing_terms.add((1 - theta) * time_step, tmp);
boundary_values_u_function.set_time(time);
std::map<types::global_dof_index, double> boundary_values;
- VectorTools::interpolate_boundary_values(
- dof_handler, 0, boundary_values_u_function, boundary_values);
+ VectorTools::interpolate_boundary_values(dof_handler,
+ 0,
+ boundary_values_u_function,
+ boundary_values);
// The matrix for solve_u() is the same in every time steps, so one
// could think that it is enough to do this only once at the
// it is the sum of the mass matrix and a weighted Laplace matrix:
matrix_u.copy_from(mass_matrix);
matrix_u.add(theta * theta * time_step * time_step, laplace_matrix);
- MatrixTools::apply_boundary_values(
- boundary_values, matrix_u, solution_u, system_rhs);
+ MatrixTools::apply_boundary_values(boundary_values,
+ matrix_u,
+ solution_u,
+ system_rhs);
}
solve_u();
boundary_values_v_function.set_time(time);
std::map<types::global_dof_index, double> boundary_values;
- VectorTools::interpolate_boundary_values(
- dof_handler, 0, boundary_values_v_function, boundary_values);
+ VectorTools::interpolate_boundary_values(dof_handler,
+ 0,
+ boundary_values_v_function,
+ boundary_values);
matrix_v.copy_from(mass_matrix);
- MatrixTools::apply_boundary_values(
- boundary_values, matrix_v, solution_v, system_rhs);
+ MatrixTools::apply_boundary_values(boundary_values,
+ matrix_v,
+ solution_v,
+ system_rhs);
}
solve_v();
class InitialValuesP : public Function<dim>
{
public:
- InitialValuesP() : Function<dim>()
+ InitialValuesP()
+ : Function<dim>()
{}
virtual double value(const Point<dim> & p,
private:
struct Source
{
- Source(const Point<dim> &l, const double r) : location(l), radius(r)
+ Source(const Point<dim> &l, const double r)
+ : location(l)
+ , radius(r)
{}
const Point<dim> location;
// i.e. theta is set to 0.5. The time step is later selected to satisfy $k =
// \frac hc$: here we initialize it to an invalid number.
template <int dim>
- TATForwardProblem<dim>::TATForwardProblem() :
- fe(1),
- dof_handler(triangulation),
- time_step(std::numeric_limits<double>::quiet_NaN()),
- time(time_step),
- timestep_number(1),
- theta(0.5),
- wave_speed(1.437)
+ TATForwardProblem<dim>::TATForwardProblem()
+ : fe(1)
+ , dof_handler(triangulation)
+ , time_step(std::numeric_limits<double>::quiet_NaN())
+ , time(time_step)
+ , timestep_number(1)
+ , theta(0.5)
+ , wave_speed(1.437)
{
// The second task in the constructor is to initialize the array that
// holds the detector locations. The results of this program were compared
laplace_matrix.reinit(sparsity_pattern);
MatrixCreator::create_mass_matrix(dof_handler, QGauss<dim>(3), mass_matrix);
- MatrixCreator::create_laplace_matrix(
- dof_handler, QGauss<dim>(3), laplace_matrix);
+ MatrixCreator::create_laplace_matrix(dof_handler,
+ QGauss<dim>(3),
+ laplace_matrix);
// The second difference, as mentioned, to step-23 is that we need to
// build the boundary mass matrix that grew out of the absorbing boundary
// domain. Like this:
{
const QGauss<dim - 1> quadrature_formula(3);
- FEFaceValues<dim> fe_values(
- fe, quadrature_formula, update_values | update_JxW_values);
+ FEFaceValues<dim> fe_values(fe,
+ quadrature_formula,
+ update_values | update_JxW_values);
const unsigned int dofs_per_cell = fe.dofs_per_cell;
const unsigned int n_q_points = quadrature_formula.size();
detector_data << time;
for (unsigned int i = 0; i < detector_locations.size(); ++i)
detector_data << " "
- << VectorTools::point_value(
- dof_handler, solution_p, detector_locations[i])
+ << VectorTools::point_value(dof_handler,
+ solution_p,
+ detector_locations[i])
<< " ";
detector_data << std::endl;
class ExactSolution : public Function<dim>
{
public:
- ExactSolution(const unsigned int n_components = 1, const double time = 0.) :
- Function<dim>(n_components, time)
+ ExactSolution(const unsigned int n_components = 1, const double time = 0.)
+ : Function<dim>(n_components, time)
{}
virtual double value(const Point<dim> & p,
const unsigned int component = 0) const override;
class InitialValues : public Function<dim>
{
public:
- InitialValues(const unsigned int n_components = 1, const double time = 0.) :
- Function<dim>(n_components, time)
+ InitialValues(const unsigned int n_components = 1, const double time = 0.)
+ : Function<dim>(n_components, time)
{}
virtual double value(const Point<dim> & p,
// technique in step-24 using GridTools::minimal_cell_diameter would work as
// well.
template <int dim>
- SineGordonProblem<dim>::SineGordonProblem() :
- fe(1),
- dof_handler(triangulation),
- n_global_refinements(6),
- time(-5.4414),
- final_time(2.7207),
- time_step(10 * 1. / std::pow(2., 1. * n_global_refinements)),
- theta(0.5),
- output_timestep_skip(1)
+ SineGordonProblem<dim>::SineGordonProblem()
+ : fe(1)
+ , dof_handler(triangulation)
+ , n_global_refinements(6)
+ , time(-5.4414)
+ , final_time(2.7207)
+ , time_step(10 * 1. / std::pow(2., 1. * n_global_refinements))
+ , theta(0.5)
+ , output_timestep_skip(1)
{}
// @sect4{SineGordonProblem::make_grid_and_dofs}
laplace_matrix.reinit(sparsity_pattern);
MatrixCreator::create_mass_matrix(dof_handler, QGauss<dim>(3), mass_matrix);
- MatrixCreator::create_laplace_matrix(
- dof_handler, QGauss<dim>(3), laplace_matrix);
+ MatrixCreator::create_laplace_matrix(dof_handler,
+ QGauss<dim>(3),
+ laplace_matrix);
solution.reinit(dof_handler.n_dofs());
solution_update.reinit(dof_handler.n_dofs());
class RightHandSide : public Function<dim>
{
public:
- RightHandSide() : Function<dim>(), period(0.2)
+ RightHandSide()
+ : Function<dim>()
+ , period(0.2)
{}
virtual double value(const Point<dim> & p,
// period with 100 time steps) and chooses the Crank Nicolson method
// by setting $\theta=1/2$.
template <int dim>
- HeatEquation<dim>::HeatEquation() :
- fe(1),
- dof_handler(triangulation),
- time(0.0),
- time_step(1. / 500),
- timestep_number(0),
- theta(0.5)
+ HeatEquation<dim>::HeatEquation()
+ : fe(1)
+ , dof_handler(triangulation)
+ , time(0.0)
+ , time_step(1. / 500)
+ , timestep_number(0)
+ , theta(0.5)
{}
laplace_matrix.reinit(sparsity_pattern);
system_matrix.reinit(sparsity_pattern);
- MatrixCreator::create_mass_matrix(
- dof_handler, QGauss<dim>(fe.degree + 1), mass_matrix);
- MatrixCreator::create_laplace_matrix(
- dof_handler, QGauss<dim>(fe.degree + 1), laplace_matrix);
+ MatrixCreator::create_mass_matrix(dof_handler,
+ QGauss<dim>(fe.degree + 1),
+ mass_matrix);
+ MatrixCreator::create_laplace_matrix(dof_handler,
+ QGauss<dim>(fe.degree + 1),
+ laplace_matrix);
solution.reinit(dof_handler.n_dofs());
old_solution.reinit(dof_handler.n_dofs());
solution,
estimated_error_per_cell);
- GridRefinement::refine_and_coarsen_fixed_fraction(
- triangulation, estimated_error_per_cell, 0.6, 0.4);
+ GridRefinement::refine_and_coarsen_fixed_fraction(triangulation,
+ estimated_error_per_cell,
+ 0.6,
+ 0.4);
if (triangulation.n_levels() > max_grid_level)
for (typename Triangulation<dim>::active_cell_iterator cell =
forcing_terms.reinit(solution.size());
- VectorTools::interpolate(
- dof_handler, Functions::ZeroFunction<dim>(), old_solution);
+ VectorTools::interpolate(dof_handler,
+ Functions::ZeroFunction<dim>(),
+ old_solution);
solution = old_solution;
output_results();
// all ends up in the forcing_terms variable:
RightHandSide<dim> rhs_function;
rhs_function.set_time(time);
- VectorTools::create_right_hand_side(
- dof_handler, QGauss<dim>(fe.degree + 1), rhs_function, tmp);
+ VectorTools::create_right_hand_side(dof_handler,
+ QGauss<dim>(fe.degree + 1),
+ rhs_function,
+ tmp);
forcing_terms = tmp;
forcing_terms *= time_step * theta;
rhs_function.set_time(time - time_step);
- VectorTools::create_right_hand_side(
- dof_handler, QGauss<dim>(fe.degree + 1), rhs_function, tmp);
+ VectorTools::create_right_hand_side(dof_handler,
+ QGauss<dim>(fe.degree + 1),
+ rhs_function,
+ tmp);
forcing_terms.add(time_step * (1 - theta), tmp);
boundary_values_function.set_time(time);
std::map<types::global_dof_index, double> boundary_values;
- VectorTools::interpolate_boundary_values(
- dof_handler, 0, boundary_values_function, boundary_values);
-
- MatrixTools::apply_boundary_values(
- boundary_values, system_matrix, solution, system_rhs);
+ VectorTools::interpolate_boundary_values(dof_handler,
+ 0,
+ boundary_values_function,
+ boundary_values);
+
+ MatrixTools::apply_boundary_values(boundary_values,
+ system_matrix,
+ solution,
+ system_rhs);
}
// With this out of the way, all we have to do is solve the
class RightHandSide : public Function<dim>
{
public:
- RightHandSide() : Function<dim>()
+ RightHandSide()
+ : Function<dim>()
{}
virtual double value(const Point<dim> & p,
}
template <int dim>
- LaplaceProblem<dim>::LaplaceProblem() :
- dof_handler(triangulation),
- max_degree(dim <= 2 ? 7 : 5)
+ LaplaceProblem<dim>::LaplaceProblem()
+ : dof_handler(triangulation)
+ , max_degree(dim <= 2 ? 7 : 5)
{
for (unsigned int degree = 2; degree <= max_degree; ++degree)
{
fourier_q_collection.push_back(quadrature);
// Now we are ready to set-up the FESeries::Fourier object
- fourier = std::make_shared<FESeries::Fourier<dim>>(
- N, fe_collection, fourier_q_collection);
+ fourier = std::make_shared<FESeries::Fourier<dim>>(N,
+ fe_collection,
+ fourier_q_collection);
// We need to resize the matrix of fourier coefficients according to the
// number of modes N.
constraints.clear();
DoFTools::make_hanging_node_constraints(dof_handler, constraints);
- VectorTools::interpolate_boundary_values(
- dof_handler, 0, Functions::ZeroFunction<dim>(), constraints);
+ VectorTools::interpolate_boundary_values(dof_handler,
+ 0,
+ Functions::ZeroFunction<dim>(),
+ constraints);
constraints.close();
DynamicSparsityPattern dsp(dof_handler.n_dofs(), dof_handler.n_dofs());
// estimated error to flag those cells for refinement that have the
// largest error. This is what we have always done:
{
- GridRefinement::refine_and_coarsen_fixed_number(
- triangulation, estimated_error_per_cell, 0.3, 0.03);
+ GridRefinement::refine_and_coarsen_fixed_number(triangulation,
+ estimated_error_per_cell,
+ 0.3,
+ 0.03);
// Next we would like to figure out which of the cells that have been
// flagged for refinement should actually have $p$ increased instead of
local_dof_values.reinit(cell->get_fe().dofs_per_cell);
cell->get_dof_values(solution, local_dof_values);
- fourier->calculate(
- local_dof_values, cell->active_fe_index(), fourier_coefficients);
+ fourier->calculate(local_dof_values,
+ cell->active_fe_index(),
+ fourier_coefficients);
// The next thing, as explained in the introduction, is that we wanted
// to only fit our exponential decay of Fourier coefficients to the
std::pair<std::vector<unsigned int>, std::vector<double>> res =
FESeries::process_coefficients<dim>(
fourier_coefficients,
- std::bind(
- &LaplaceProblem<dim>::predicate, this, std::placeholders::_1),
+ std::bind(&LaplaceProblem<dim>::predicate,
+ this,
+ std::placeholders::_1),
VectorTools::Linfty_norm);
Assert(res.first.size() == res.second.size(), ExcInternalError());
//
// At present, material data is stored for 8 different types of
// material. This, as well, may easily be extended in the future.
- MaterialData::MaterialData(const unsigned int n_groups) :
- n_groups(n_groups),
- n_materials(8),
- diffusion(n_materials, n_groups),
- sigma_r(n_materials, n_groups),
- nu_sigma_f(n_materials, n_groups),
- sigma_s(n_materials, n_groups, n_groups),
- chi(n_materials, n_groups)
+ MaterialData::MaterialData(const unsigned int n_groups)
+ : n_groups(n_groups)
+ , n_materials(8)
+ , diffusion(n_materials, n_groups)
+ , sigma_r(n_materials, n_groups)
+ , nu_sigma_f(n_materials, n_groups)
+ , sigma_s(n_materials, n_groups, n_groups)
+ , chi(n_materials, n_groups)
{
switch (this->n_groups)
{
default:
- Assert(
- false,
- ExcMessage("Presently, only data for 2 groups is implemented"));
+ Assert(false,
+ ExcMessage(
+ "Presently, only data for 2 groups is implemented"));
}
}
EnergyGroup<dim>::EnergyGroup(const unsigned int group,
const MaterialData & material_data,
const Triangulation<dim> &coarse_grid,
- const FiniteElement<dim> &fe) :
- group(group),
- material_data(material_data),
- fe(fe),
- dof_handler(triangulation)
+ const FiniteElement<dim> &fe)
+ : group(group)
+ , material_data(material_data)
+ , fe(fe)
+ , dof_handler(triangulation)
{
triangulation.copy_triangulation(coarse_grid);
dof_handler.distribute_dofs(fe);
for (unsigned int i = 0; i < dofs_per_cell; ++i)
for (unsigned int j = 0; j < dofs_per_cell; ++j)
- system_matrix.add(
- local_dof_indices[i], local_dof_indices[j], cell_matrix(i, j));
+ system_matrix.add(local_dof_indices[i],
+ local_dof_indices[j],
+ cell_matrix(i, j));
}
hanging_node_constraints.condense(system_matrix);
FullMatrix<double> unit_matrix(fe.dofs_per_cell);
for (unsigned int i = 0; i < unit_matrix.m(); ++i)
unit_matrix(i, i) = 1;
- assemble_cross_group_rhs_recursive(
- g_prime, cell_iter->first, cell_iter->second, unit_matrix);
+ assemble_cross_group_rhs_recursive(g_prime,
+ cell_iter->first,
+ cell_iter->second,
+ unit_matrix);
}
}
const QGauss<dim> quadrature_formula(fe.degree + 1);
const unsigned int n_q_points = quadrature_formula.size();
- FEValues<dim> fe_values(
- fe, quadrature_formula, update_values | update_JxW_values);
+ FEValues<dim> fe_values(fe,
+ quadrature_formula,
+ update_values | update_JxW_values);
if (cell_g->level() > cell_g_prime->level())
fe_values.reinit(cell_g);
else
fe_values.reinit(cell_g_prime);
- const double fission_dist_XS = material_data.get_fission_dist_XS(
- group, g_prime.group, cell_g_prime->material_id());
+ const double fission_dist_XS =
+ material_data.get_fission_dist_XS(group,
+ g_prime.group,
+ cell_g_prime->material_id());
- const double scattering_XS = material_data.get_scattering_XS(
- g_prime.group, group, cell_g_prime->material_id());
+ const double scattering_XS =
+ material_data.get_scattering_XS(g_prime.group,
+ group,
+ cell_g_prime->material_id());
FullMatrix<double> local_mass_matrix_f(fe.dofs_per_cell,
fe.dofs_per_cell);
prolongation_matrix);
if (cell_g->has_children())
- assemble_cross_group_rhs_recursive(
- g_prime, cell_g->child(child), cell_g_prime, new_matrix);
+ assemble_cross_group_rhs_recursive(g_prime,
+ cell_g->child(child),
+ cell_g_prime,
+ new_matrix);
else
- assemble_cross_group_rhs_recursive(
- g_prime, cell_g, cell_g_prime->child(child), new_matrix);
+ assemble_cross_group_rhs_recursive(g_prime,
+ cell_g,
+ cell_g_prime->child(child),
+ new_matrix);
}
}
const QGauss<dim> quadrature_formula(fe.degree + 1);
const unsigned int n_q_points = quadrature_formula.size();
- FEValues<dim> fe_values(
- fe, quadrature_formula, update_values | update_JxW_values);
+ FEValues<dim> fe_values(fe,
+ quadrature_formula,
+ update_values | update_JxW_values);
std::vector<double> solution_values(n_q_points);
void EnergyGroup<dim>::solve()
{
hanging_node_constraints.condense(system_rhs);
- MatrixTools::apply_boundary_values(
- boundary_values, system_matrix, solution, system_rhs);
+ MatrixTools::apply_boundary_values(boundary_values,
+ system_matrix,
+ solution,
+ system_rhs);
SolverControl solver_control(system_matrix.m(),
1e-12 * system_rhs.l2_norm());
// parameters classes using the ParameterHandler capabilities. We will
// therefore not comment further on this:
template <int dim>
- NeutronDiffusionProblem<dim>::Parameters::Parameters() :
- n_groups(2),
- n_refinement_cycles(5),
- fe_degree(2),
- convergence_tolerance(1e-12)
+ NeutronDiffusionProblem<dim>::Parameters::Parameters()
+ : n_groups(2)
+ , n_refinement_cycles(5)
+ , fe_degree(2)
+ , convergence_tolerance(1e-12)
{}
// and destructor have nothing of much interest:
template <int dim>
NeutronDiffusionProblem<dim>::NeutronDiffusionProblem(
- const Parameters ¶meters) :
- parameters(parameters),
- material_data(parameters.n_groups),
- fe(parameters.fe_degree),
- k_eff(std::numeric_limits<double>::quiet_NaN())
+ const Parameters ¶meters)
+ : parameters(parameters)
+ , material_data(parameters.n_groups)
+ , fe(parameters.fe_degree)
+ , k_eff(std::numeric_limits<double>::quiet_NaN())
{}
{
std::vector<Threads::Thread<double>> threads;
for (unsigned int group = 0; group < parameters.n_groups; ++group)
- threads.push_back(Threads::new_thread(
- &EnergyGroup<dim>::get_fission_source, *energy_groups[group]));
+ threads.push_back(
+ Threads::new_thread(&EnergyGroup<dim>::get_fission_source,
+ *energy_groups[group]));
double fission_source = 0;
for (unsigned int group = 0; group < parameters.n_groups; ++group)
Threads::ThreadGroup<> threads;
for (unsigned int group = 0; group < parameters.n_groups; ++group)
- threads += Threads::new_thread(
- &EnergyGroup<dim>::assemble_system_matrix, *energy_groups[group]);
+ threads +=
+ Threads::new_thread(&EnergyGroup<dim>::assemble_system_matrix,
+ *energy_groups[group]);
threads.join_all();
double error;
class DirichletBoundaryValues : public Function<dim>
{
public:
- DirichletBoundaryValues() : Function<dim>(2){};
+ DirichletBoundaryValues()
+ : Function<dim>(2){};
virtual void vector_value(const Point<dim> &p,
Vector<double> & values) const override;
// The constructor stores a reference to the ParameterHandler object that is
// passed to it:
- ParameterReader::ParameterReader(ParameterHandler ¶mhandler) :
- prm(paramhandler)
+ ParameterReader::ParameterReader(ParameterHandler ¶mhandler)
+ : prm(paramhandler)
{}
// @sect4{<code>ParameterReader::declare_parameters</code>}
// In our case, only the function values of $v$ and $w$ are needed to
// compute $|u|$, so we're good with the update_values flag.
template <int dim>
- ComputeIntensity<dim>::ComputeIntensity() :
- DataPostprocessorScalar<dim>("Intensity", update_values)
+ ComputeIntensity<dim>::ComputeIntensity()
+ : DataPostprocessorScalar<dim>("Intensity", update_values)
{}
// system, which consists of two copies of the scalar Q1 field, one for $v$
// and one for $w$:
template <int dim>
- UltrasoundProblem<dim>::UltrasoundProblem(ParameterHandler ¶m) :
- prm(param),
- dof_handler(triangulation),
- fe(FE_Q<dim>(1), 2)
+ UltrasoundProblem<dim>::UltrasoundProblem(ParameterHandler ¶m)
+ : prm(param)
+ , dof_handler(triangulation)
+ , fe(FE_Q<dim>(1), 2)
{}
update_values | update_gradients |
update_JxW_values);
- FEFaceValues<dim> fe_face_values(
- fe, face_quadrature_formula, update_values | update_JxW_values);
+ FEFaceValues<dim> fe_face_values(fe,
+ face_quadrature_formula,
+ update_values | update_JxW_values);
// As usual, the system matrix is assembled cell by cell, and we need a
// matrix for storing the local cell contributions as well as an index
// ...and then add the entries to the system matrix one by one:
for (unsigned int i = 0; i < dofs_per_cell; ++i)
for (unsigned int j = 0; j < dofs_per_cell; ++j)
- system_matrix.add(
- local_dof_indices[i], local_dof_indices[j], cell_matrix(i, j));
+ system_matrix.add(local_dof_indices[i],
+ local_dof_indices[j],
+ cell_matrix(i, j));
}
// values are provided by the <code>DirichletBoundaryValues</code> class
// we defined above:
std::map<types::global_dof_index, double> boundary_values;
- VectorTools::interpolate_boundary_values(
- dof_handler, 1, DirichletBoundaryValues<dim>(), boundary_values);
-
- MatrixTools::apply_boundary_values(
- boundary_values, system_matrix, solution, system_rhs);
+ VectorTools::interpolate_boundary_values(dof_handler,
+ 1,
+ DirichletBoundaryValues<dim>(),
+ boundary_values);
+
+ MatrixTools::apply_boundary_values(boundary_values,
+ system_matrix,
+ solution,
+ system_rhs);
timer.stop();
deallog << "done (" << timer.cpu_time() << "s)" << std::endl;
// you try to distribute degree of freedom on the mesh using the
// distribute_dofs() function.) All the other member variables of the Step3
// class have a default constructor which does all we want.
-Step3::Step3() : fe(1), dof_handler(triangulation)
+Step3::Step3()
+ : fe(1)
+ , dof_handler(triangulation)
{}
// obtained using local_dof_indices[i]:
for (unsigned int i = 0; i < dofs_per_cell; ++i)
for (unsigned int j = 0; j < dofs_per_cell; ++j)
- system_matrix.add(
- local_dof_indices[i], local_dof_indices[j], cell_matrix(i, j));
+ system_matrix.add(local_dof_indices[i],
+ local_dof_indices[j],
+ cell_matrix(i, j));
// And again, we do the same thing for the right hand side vector.
for (unsigned int i = 0; i < dofs_per_cell; ++i)
// of DoF numbers to boundary values is done by the <code>std::map</code>
// class.
std::map<types::global_dof_index, double> boundary_values;
- VectorTools::interpolate_boundary_values(
- dof_handler, 0, Functions::ZeroFunction<2>(), boundary_values);
+ VectorTools::interpolate_boundary_values(dof_handler,
+ 0,
+ Functions::ZeroFunction<2>(),
+ boundary_values);
// Now that we got the list of boundary DoFs and their respective boundary
// values, let's use them to modify the system of equations
// accordingly. This is done by the following function call:
- MatrixTools::apply_boundary_values(
- boundary_values, system_matrix, solution, system_rhs);
+ MatrixTools::apply_boundary_values(boundary_values,
+ system_matrix,
+ solution,
+ system_rhs);
}
// the quadrature points on faces or subfaces represented by the two objects
// correspond to the same points in physical space.
template <int dim>
- DGTransportEquation<dim>::DGTransportEquation() :
- beta_function(),
- rhs_function(),
- boundary_function()
+ DGTransportEquation<dim>::DGTransportEquation()
+ : beta_function()
+ , rhs_function()
+ , boundary_function()
{}
template <int dim>
- DGMethod<dim>::DGMethod(const bool anisotropic) :
- mapping(),
+ DGMethod<dim>::DGMethod(const bool anisotropic)
+ : mapping()
+ ,
// Change here for DG methods of different degrees.
- degree(1),
- fe(degree),
- dof_handler(triangulation),
- anisotropic_threshold_ratio(3.),
- anisotropic(anisotropic),
+ degree(1)
+ , fe(degree)
+ , dof_handler(triangulation)
+ , anisotropic_threshold_ratio(3.)
+ , anisotropic(anisotropic)
+ ,
// As beta is a linear function, we can choose the degree of the
// quadrature for which the resulting integration is correct. Thus, we
// choose to use <code>degree+1</code> Gauss points, which enables us to
// integrate exactly polynomials of degree <code>2*degree+1</code>, enough
// for all the integrals we will perform in this program.
- quadrature(degree + 1),
- face_quadrature(degree + 1),
- dg()
+ quadrature(degree + 1)
+ , face_quadrature(degree + 1)
+ , dg()
{}
const UpdateFlags neighbor_face_update_flags = update_values;
- FEValues<dim> fe_v(mapping, fe, quadrature, update_flags);
- FEFaceValues<dim> fe_v_face(
- mapping, fe, face_quadrature, face_update_flags);
- FESubfaceValues<dim> fe_v_subface(
- mapping, fe, face_quadrature, face_update_flags);
- FEFaceValues<dim> fe_v_face_neighbor(
- mapping, fe, face_quadrature, neighbor_face_update_flags);
+ FEValues<dim> fe_v(mapping, fe, quadrature, update_flags);
+ FEFaceValues<dim> fe_v_face(mapping,
+ fe,
+ face_quadrature,
+ face_update_flags);
+ FESubfaceValues<dim> fe_v_subface(mapping,
+ fe,
+ face_quadrature,
+ face_update_flags);
+ FEFaceValues<dim> fe_v_face_neighbor(mapping,
+ fe,
+ face_quadrature,
+ neighbor_face_update_flags);
FullMatrix<double> ui_vi_matrix(dofs_per_cell, dofs_per_cell);
for (unsigned int i = 0; i < dofs_per_cell; ++i)
for (unsigned int j = 0; j < dofs_per_cell; ++j)
{
- system_matrix.add(
- dofs[i], dofs_neighbor[j], ue_vi_matrix(i, j));
- system_matrix.add(
- dofs_neighbor[i], dofs[j], ui_ve_matrix(i, j));
+ system_matrix.add(dofs[i],
+ dofs_neighbor[j],
+ ue_vi_matrix(i, j));
+ system_matrix.add(dofs_neighbor[i],
+ dofs[j],
+ ui_ve_matrix(i, j));
system_matrix.add(dofs_neighbor[i],
dofs_neighbor[j],
ue_ve_matrix(i, j));
for (unsigned int i = 0; i < dofs_per_cell; ++i)
for (unsigned int j = 0; j < dofs_per_cell; ++j)
{
- system_matrix.add(
- dofs[i], dofs_neighbor[j], ue_vi_matrix(i, j));
- system_matrix.add(
- dofs_neighbor[i], dofs[j], ui_ve_matrix(i, j));
+ system_matrix.add(dofs[i],
+ dofs_neighbor[j],
+ ue_vi_matrix(i, j));
+ system_matrix.add(dofs_neighbor[i],
+ dofs[j],
+ ui_ve_matrix(i, j));
system_matrix.add(dofs_neighbor[i],
dofs_neighbor[j],
ue_ve_matrix(i, j));
Vector<float> gradient_indicator(triangulation.n_active_cells());
// We approximate the gradient,
- DerivativeApproximation::approximate_gradient(
- mapping, dof_handler, solution2, gradient_indicator);
+ DerivativeApproximation::approximate_gradient(mapping,
+ dof_handler,
+ solution2,
+ gradient_indicator);
// and scale it to obtain an error indicator.
typename DoFHandler<dim>::active_cell_iterator cell =
std::pow(cell->diameter(), 1 + 1.0 * dim / 2);
// Then we use this indicator to flag the 30 percent of the cells with
// highest error indicator to be refined.
- GridRefinement::refine_and_coarsen_fixed_number(
- triangulation, gradient_indicator, 0.3, 0.1);
+ GridRefinement::refine_and_coarsen_fixed_number(triangulation,
+ gradient_indicator,
+ 0.3,
+ 0.1);
// Now the refinement flags are set for those cells with a large error
// indicator. If nothing is done to change this, those cells will be
// refined isotropically. If the @p anisotropic flag given to this
UpdateFlags face_update_flags =
UpdateFlags(update_values | update_JxW_values);
- FEFaceValues<dim> fe_v_face(
- mapping, fe, face_quadrature, face_update_flags);
- FESubfaceValues<dim> fe_v_subface(
- mapping, fe, face_quadrature, face_update_flags);
- FEFaceValues<dim> fe_v_face_neighbor(
- mapping, fe, face_quadrature, update_values);
+ FEFaceValues<dim> fe_v_face(mapping,
+ fe,
+ face_quadrature,
+ face_update_flags);
+ FESubfaceValues<dim> fe_v_subface(mapping,
+ fe,
+ face_quadrature,
+ face_update_flags);
+ FEFaceValues<dim> fe_v_face_neighbor(mapping,
+ fe,
+ face_quadrature,
+ update_values);
// Now we need to loop over all active cells.
typename DoFHandler<dim>::active_cell_iterator cell =
// get an iterator pointing to the cell behind the
// present subface...
typename DoFHandler<dim>::cell_iterator
- neighbor_child = cell->neighbor_child_on_subface(
- face_no, subface_no);
+ neighbor_child =
+ cell->neighbor_child_on_subface(face_no,
+ subface_no);
Assert(!neighbor_child->has_children(),
ExcInternalError());
// ... and reinit the respective FEFaceValues and
// completely isotropic cells for the original mesh.
std::vector<unsigned int> repetitions(dim, 1);
repetitions[0] = 2;
- GridGenerator::subdivided_hyper_rectangle(
- triangulation, repetitions, p1, p2);
+ GridGenerator::subdivided_hyper_rectangle(triangulation,
+ repetitions,
+ p1,
+ p2);
triangulation.refine_global(5 - dim);
}
class TemperatureInitialValues : public Function<dim>
{
public:
- TemperatureInitialValues() : Function<dim>(1)
+ TemperatureInitialValues()
+ : Function<dim>(1)
{}
virtual double value(const Point<dim> & p,
class TemperatureRightHandSide : public Function<dim>
{
public:
- TemperatureRightHandSide() : Function<dim>(1)
+ TemperatureRightHandSide()
+ : Function<dim>(1)
{}
virtual double value(const Point<dim> & p,
template <class MatrixType, class PreconditionerType>
InverseMatrix<MatrixType, PreconditionerType>::InverseMatrix(
const MatrixType & m,
- const PreconditionerType &preconditioner) :
- matrix(&m),
- preconditioner(preconditioner)
+ const PreconditionerType &preconditioner)
+ : matrix(&m)
+ , preconditioner(preconditioner)
{}
const TrilinosWrappers::BlockSparseMatrix &S,
const InverseMatrix<TrilinosWrappers::SparseMatrix,
PreconditionerTypeMp> &Mpinv,
- const PreconditionerTypeA & Apreconditioner) :
- stokes_matrix(&S),
- m_inverse(&Mpinv),
- a_preconditioner(Apreconditioner),
- tmp(complete_index_set(stokes_matrix->block(1, 1).m()))
+ const PreconditionerTypeA & Apreconditioner)
+ : stokes_matrix(&S)
+ , m_inverse(&Mpinv)
+ , a_preconditioner(Apreconditioner)
+ , tmp(complete_index_set(stokes_matrix->block(1, 1).m()))
{}
// initialize the time stepping as well as the options for matrix assembly
// and preconditioning:
template <int dim>
- BoussinesqFlowProblem<dim>::BoussinesqFlowProblem() :
- triangulation(Triangulation<dim>::maximum_smoothing),
- global_Omega_diameter(std::numeric_limits<double>::quiet_NaN()),
- stokes_degree(1),
- stokes_fe(FE_Q<dim>(stokes_degree + 1), dim, FE_Q<dim>(stokes_degree), 1),
- stokes_dof_handler(triangulation),
-
- temperature_degree(2),
- temperature_fe(temperature_degree),
- temperature_dof_handler(triangulation),
-
- time_step(0),
- old_time_step(0),
- timestep_number(0),
- rebuild_stokes_matrix(true),
- rebuild_temperature_matrices(true),
- rebuild_stokes_preconditioner(true)
+ BoussinesqFlowProblem<dim>::BoussinesqFlowProblem()
+ : triangulation(Triangulation<dim>::maximum_smoothing)
+ , global_Omega_diameter(std::numeric_limits<double>::quiet_NaN())
+ , stokes_degree(1)
+ , stokes_fe(FE_Q<dim>(stokes_degree + 1), dim, FE_Q<dim>(stokes_degree), 1)
+ , stokes_dof_handler(triangulation)
+ ,
+
+ temperature_degree(2)
+ , temperature_fe(temperature_degree)
+ , temperature_dof_handler(triangulation)
+ ,
+
+ time_step(0)
+ , old_time_step(0)
+ , timestep_number(0)
+ , rebuild_stokes_matrix(true)
+ , rebuild_temperature_matrices(true)
+ , rebuild_stokes_preconditioner(true)
{}
stokes_constraints);
std::set<types::boundary_id> no_normal_flux_boundaries;
no_normal_flux_boundaries.insert(0);
- VectorTools::compute_no_normal_flux_constraints(
- stokes_dof_handler, 0, no_normal_flux_boundaries, stokes_constraints);
+ VectorTools::compute_no_normal_flux_constraints(stokes_dof_handler,
+ 0,
+ no_normal_flux_boundaries,
+ stokes_constraints);
stokes_constraints.close();
}
{
}
std::vector<types::global_dof_index> stokes_dofs_per_block(2);
- DoFTools::count_dofs_per_block(
- stokes_dof_handler, stokes_dofs_per_block, stokes_sub_blocks);
+ DoFTools::count_dofs_per_block(stokes_dof_handler,
+ stokes_dofs_per_block,
+ stokes_sub_blocks);
const unsigned int n_u = stokes_dofs_per_block[0],
n_p = stokes_dofs_per_block[1],
temperature_matrix.clear();
DynamicSparsityPattern dsp(n_T, n_T);
- DoFTools::make_sparsity_pattern(
- temperature_dof_handler, dsp, temperature_constraints, false);
+ DoFTools::make_sparsity_pattern(temperature_dof_handler,
+ dsp,
+ temperature_constraints,
+ false);
temperature_matrix.reinit(dsp);
temperature_mass_matrix.reinit(temperature_matrix);
std::vector<std::vector<bool>> constant_modes;
FEValuesExtractors::Vector velocity_components(0);
- DoFTools::extract_constant_modes(
- stokes_dof_handler,
- stokes_fe.component_mask(velocity_components),
- constant_modes);
+ DoFTools::extract_constant_modes(stokes_dof_handler,
+ stokes_fe.component_mask(
+ velocity_components),
+ constant_modes);
TrilinosWrappers::PreconditionAMG::AdditionalData amg_data;
amg_data.constant_modes = constant_modes;
update_values | update_quadrature_points | update_JxW_values |
(rebuild_stokes_matrix == true ? update_gradients : UpdateFlags(0)));
- FEValues<dim> temperature_fe_values(
- temperature_fe, quadrature_formula, update_values);
+ FEValues<dim> temperature_fe_values(temperature_fe,
+ quadrature_formula,
+ update_values);
const unsigned int dofs_per_cell = stokes_fe.dofs_per_cell;
const unsigned int n_q_points = quadrature_formula.size();
stokes_matrix,
stokes_rhs);
else
- stokes_constraints.distribute_local_to_global(
- local_rhs, local_dof_indices, stokes_rhs);
+ stokes_constraints.distribute_local_to_global(local_rhs,
+ local_dof_indices,
+ stokes_rhs);
}
rebuild_stokes_matrix = false;
temperature_rhs = 0;
const QGauss<dim> quadrature_formula(temperature_degree + 2);
- FEValues<dim> temperature_fe_values(
- temperature_fe,
- quadrature_formula,
- update_values | update_gradients | update_hessians |
- update_quadrature_points | update_JxW_values);
- FEValues<dim> stokes_fe_values(
- stokes_fe, quadrature_formula, update_values);
+ FEValues<dim> temperature_fe_values(temperature_fe,
+ quadrature_formula,
+ update_values | update_gradients |
+ update_hessians |
+ update_quadrature_points |
+ update_JxW_values);
+ FEValues<dim> stokes_fe_values(stokes_fe,
+ quadrature_formula,
+ update_values);
const unsigned int dofs_per_cell = temperature_fe.dofs_per_cell;
const unsigned int n_q_points = quadrature_formula.size();
}
cell->get_dof_indices(local_dof_indices);
- temperature_constraints.distribute_local_to_global(
- local_rhs, local_dof_indices, temperature_rhs);
+ temperature_constraints.distribute_local_to_global(local_rhs,
+ local_dof_indices,
+ temperature_rhs);
}
}
stokes_solution,
stokes_names,
stokes_component_interpretation);
- data_out.add_data_vector(
- temperature_dof_handler, temperature_solution, "T");
+ data_out.add_data_vector(temperature_dof_handler,
+ temperature_solution,
+ "T");
data_out.build_patches(std::min(stokes_degree, temperature_degree));
std::ofstream output("solution-" +
temperature_solution,
estimated_error_per_cell);
- GridRefinement::refine_and_coarsen_fixed_fraction(
- triangulation, estimated_error_per_cell, 0.8, 0.1);
+ GridRefinement::refine_and_coarsen_fixed_fraction(triangulation,
+ estimated_error_per_cell,
+ 0.8,
+ 0.1);
if (triangulation.n_levels() > max_grid_level)
for (typename Triangulation<dim>::active_cell_iterator cell =
triangulation.begin_active(max_grid_level);
argc, argv, numbers::invalid_unsigned_int);
// This program can only be run in serial. Otherwise, throw an exception.
- AssertThrow(
- Utilities::MPI::n_mpi_processes(MPI_COMM_WORLD) == 1,
- ExcMessage("This program can only be run in serial, use ./step-31"));
+ AssertThrow(Utilities::MPI::n_mpi_processes(MPI_COMM_WORLD) == 1,
+ ExcMessage(
+ "This program can only be run in serial, use ./step-31"));
BoussinesqFlowProblem<2> flow_problem;
flow_problem.run();
class TemperatureInitialValues : public Function<dim>
{
public:
- TemperatureInitialValues() : Function<dim>(1)
+ TemperatureInitialValues()
+ : Function<dim>(1)
{}
virtual double value(const Point<dim> & p,
const TrilinosWrappers::BlockSparseMatrix &Spre,
const PreconditionerTypeMp &Mppreconditioner,
const PreconditionerTypeA & Apreconditioner,
- const bool do_solve_A) :
- stokes_matrix(&S),
- stokes_preconditioner_matrix(&Spre),
- mp_preconditioner(Mppreconditioner),
- a_preconditioner(Apreconditioner),
- do_solve_A(do_solve_A)
+ const bool do_solve_A)
+ : stokes_matrix(&S)
+ , stokes_preconditioner_matrix(&Spre)
+ , mp_preconditioner(Mppreconditioner)
+ , a_preconditioner(Apreconditioner)
+ , do_solve_A(do_solve_A)
{}
void vmult(TrilinosWrappers::MPI::BlockVector & dst,
{
SolverControl solver_control(5000, utmp.l2_norm() * 1e-2);
TrilinosWrappers::SolverCG solver(solver_control);
- solver.solve(
- stokes_matrix->block(0, 0), dst.block(0), utmp, a_preconditioner);
+ solver.solve(stokes_matrix->block(0, 0),
+ dst.block(0),
+ utmp,
+ a_preconditioner);
}
else
a_preconditioner.vmult(dst.block(0), utmp);
const FiniteElement<dim> &stokes_fe,
const Quadrature<dim> & stokes_quadrature,
const Mapping<dim> & mapping,
- const UpdateFlags update_flags) :
- stokes_fe_values(mapping, stokes_fe, stokes_quadrature, update_flags),
- grad_phi_u(stokes_fe.dofs_per_cell),
- phi_p(stokes_fe.dofs_per_cell)
+ const UpdateFlags update_flags)
+ : stokes_fe_values(mapping, stokes_fe, stokes_quadrature, update_flags)
+ , grad_phi_u(stokes_fe.dofs_per_cell)
+ , phi_p(stokes_fe.dofs_per_cell)
{}
template <int dim>
StokesPreconditioner<dim>::StokesPreconditioner(
- const StokesPreconditioner &scratch) :
- stokes_fe_values(scratch.stokes_fe_values.get_mapping(),
- scratch.stokes_fe_values.get_fe(),
- scratch.stokes_fe_values.get_quadrature(),
- scratch.stokes_fe_values.get_update_flags()),
- grad_phi_u(scratch.grad_phi_u),
- phi_p(scratch.phi_p)
+ const StokesPreconditioner &scratch)
+ : stokes_fe_values(scratch.stokes_fe_values.get_mapping(),
+ scratch.stokes_fe_values.get_fe(),
+ scratch.stokes_fe_values.get_quadrature(),
+ scratch.stokes_fe_values.get_update_flags())
+ , grad_phi_u(scratch.grad_phi_u)
+ , phi_p(scratch.phi_p)
{}
const Quadrature<dim> & stokes_quadrature,
const UpdateFlags stokes_update_flags,
const FiniteElement<dim> &temperature_fe,
- const UpdateFlags temperature_update_flags) :
- StokesPreconditioner<dim>(stokes_fe,
- stokes_quadrature,
- mapping,
- stokes_update_flags),
- temperature_fe_values(mapping,
- temperature_fe,
- stokes_quadrature,
- temperature_update_flags),
- phi_u(stokes_fe.dofs_per_cell),
- grads_phi_u(stokes_fe.dofs_per_cell),
- div_phi_u(stokes_fe.dofs_per_cell),
- old_temperature_values(stokes_quadrature.size())
+ const UpdateFlags temperature_update_flags)
+ : StokesPreconditioner<dim>(stokes_fe,
+ stokes_quadrature,
+ mapping,
+ stokes_update_flags)
+ , temperature_fe_values(mapping,
+ temperature_fe,
+ stokes_quadrature,
+ temperature_update_flags)
+ , phi_u(stokes_fe.dofs_per_cell)
+ , grads_phi_u(stokes_fe.dofs_per_cell)
+ , div_phi_u(stokes_fe.dofs_per_cell)
+ , old_temperature_values(stokes_quadrature.size())
{}
template <int dim>
- StokesSystem<dim>::StokesSystem(const StokesSystem<dim> &scratch) :
- StokesPreconditioner<dim>(scratch),
- temperature_fe_values(scratch.temperature_fe_values.get_mapping(),
- scratch.temperature_fe_values.get_fe(),
- scratch.temperature_fe_values.get_quadrature(),
- scratch.temperature_fe_values.get_update_flags()),
- phi_u(scratch.phi_u),
- grads_phi_u(scratch.grads_phi_u),
- div_phi_u(scratch.div_phi_u),
- old_temperature_values(scratch.old_temperature_values)
+ StokesSystem<dim>::StokesSystem(const StokesSystem<dim> &scratch)
+ : StokesPreconditioner<dim>(scratch)
+ , temperature_fe_values(
+ scratch.temperature_fe_values.get_mapping(),
+ scratch.temperature_fe_values.get_fe(),
+ scratch.temperature_fe_values.get_quadrature(),
+ scratch.temperature_fe_values.get_update_flags())
+ , phi_u(scratch.phi_u)
+ , grads_phi_u(scratch.grads_phi_u)
+ , div_phi_u(scratch.div_phi_u)
+ , old_temperature_values(scratch.old_temperature_values)
{}
TemperatureMatrix<dim>::TemperatureMatrix(
const FiniteElement<dim> &temperature_fe,
const Mapping<dim> & mapping,
- const Quadrature<dim> & temperature_quadrature) :
- temperature_fe_values(mapping,
- temperature_fe,
- temperature_quadrature,
- update_values | update_gradients |
- update_JxW_values),
- phi_T(temperature_fe.dofs_per_cell),
- grad_phi_T(temperature_fe.dofs_per_cell)
+ const Quadrature<dim> & temperature_quadrature)
+ : temperature_fe_values(mapping,
+ temperature_fe,
+ temperature_quadrature,
+ update_values | update_gradients |
+ update_JxW_values)
+ , phi_T(temperature_fe.dofs_per_cell)
+ , grad_phi_T(temperature_fe.dofs_per_cell)
{}
template <int dim>
TemperatureMatrix<dim>::TemperatureMatrix(
- const TemperatureMatrix &scratch) :
- temperature_fe_values(scratch.temperature_fe_values.get_mapping(),
- scratch.temperature_fe_values.get_fe(),
- scratch.temperature_fe_values.get_quadrature(),
- scratch.temperature_fe_values.get_update_flags()),
- phi_T(scratch.phi_T),
- grad_phi_T(scratch.grad_phi_T)
+ const TemperatureMatrix &scratch)
+ : temperature_fe_values(
+ scratch.temperature_fe_values.get_mapping(),
+ scratch.temperature_fe_values.get_fe(),
+ scratch.temperature_fe_values.get_quadrature(),
+ scratch.temperature_fe_values.get_update_flags())
+ , phi_T(scratch.phi_T)
+ , grad_phi_T(scratch.grad_phi_T)
{}
const FiniteElement<dim> &temperature_fe,
const FiniteElement<dim> &stokes_fe,
const Mapping<dim> & mapping,
- const Quadrature<dim> & quadrature) :
- temperature_fe_values(mapping,
- temperature_fe,
- quadrature,
- update_values | update_gradients |
- update_hessians | update_quadrature_points |
- update_JxW_values),
- stokes_fe_values(mapping,
- stokes_fe,
- quadrature,
- update_values | update_gradients),
- phi_T(temperature_fe.dofs_per_cell),
- grad_phi_T(temperature_fe.dofs_per_cell),
-
- old_velocity_values(quadrature.size()),
- old_old_velocity_values(quadrature.size()),
- old_strain_rates(quadrature.size()),
- old_old_strain_rates(quadrature.size()),
-
- old_temperature_values(quadrature.size()),
- old_old_temperature_values(quadrature.size()),
- old_temperature_grads(quadrature.size()),
- old_old_temperature_grads(quadrature.size()),
- old_temperature_laplacians(quadrature.size()),
- old_old_temperature_laplacians(quadrature.size())
+ const Quadrature<dim> & quadrature)
+ : temperature_fe_values(mapping,
+ temperature_fe,
+ quadrature,
+ update_values | update_gradients |
+ update_hessians | update_quadrature_points |
+ update_JxW_values)
+ , stokes_fe_values(mapping,
+ stokes_fe,
+ quadrature,
+ update_values | update_gradients)
+ , phi_T(temperature_fe.dofs_per_cell)
+ , grad_phi_T(temperature_fe.dofs_per_cell)
+ ,
+
+ old_velocity_values(quadrature.size())
+ , old_old_velocity_values(quadrature.size())
+ , old_strain_rates(quadrature.size())
+ , old_old_strain_rates(quadrature.size())
+ ,
+
+ old_temperature_values(quadrature.size())
+ , old_old_temperature_values(quadrature.size())
+ , old_temperature_grads(quadrature.size())
+ , old_old_temperature_grads(quadrature.size())
+ , old_temperature_laplacians(quadrature.size())
+ , old_old_temperature_laplacians(quadrature.size())
{}
template <int dim>
- TemperatureRHS<dim>::TemperatureRHS(const TemperatureRHS &scratch) :
- temperature_fe_values(scratch.temperature_fe_values.get_mapping(),
- scratch.temperature_fe_values.get_fe(),
- scratch.temperature_fe_values.get_quadrature(),
- scratch.temperature_fe_values.get_update_flags()),
- stokes_fe_values(scratch.stokes_fe_values.get_mapping(),
- scratch.stokes_fe_values.get_fe(),
- scratch.stokes_fe_values.get_quadrature(),
- scratch.stokes_fe_values.get_update_flags()),
- phi_T(scratch.phi_T),
- grad_phi_T(scratch.grad_phi_T),
-
- old_velocity_values(scratch.old_velocity_values),
- old_old_velocity_values(scratch.old_old_velocity_values),
- old_strain_rates(scratch.old_strain_rates),
- old_old_strain_rates(scratch.old_old_strain_rates),
-
- old_temperature_values(scratch.old_temperature_values),
- old_old_temperature_values(scratch.old_old_temperature_values),
- old_temperature_grads(scratch.old_temperature_grads),
- old_old_temperature_grads(scratch.old_old_temperature_grads),
- old_temperature_laplacians(scratch.old_temperature_laplacians),
- old_old_temperature_laplacians(scratch.old_old_temperature_laplacians)
+ TemperatureRHS<dim>::TemperatureRHS(const TemperatureRHS &scratch)
+ : temperature_fe_values(
+ scratch.temperature_fe_values.get_mapping(),
+ scratch.temperature_fe_values.get_fe(),
+ scratch.temperature_fe_values.get_quadrature(),
+ scratch.temperature_fe_values.get_update_flags())
+ , stokes_fe_values(scratch.stokes_fe_values.get_mapping(),
+ scratch.stokes_fe_values.get_fe(),
+ scratch.stokes_fe_values.get_quadrature(),
+ scratch.stokes_fe_values.get_update_flags())
+ , phi_T(scratch.phi_T)
+ , grad_phi_T(scratch.grad_phi_T)
+ ,
+
+ old_velocity_values(scratch.old_velocity_values)
+ , old_old_velocity_values(scratch.old_old_velocity_values)
+ , old_strain_rates(scratch.old_strain_rates)
+ , old_old_strain_rates(scratch.old_old_strain_rates)
+ ,
+
+ old_temperature_values(scratch.old_temperature_values)
+ , old_old_temperature_values(scratch.old_old_temperature_values)
+ , old_temperature_grads(scratch.old_temperature_grads)
+ , old_old_temperature_grads(scratch.old_old_temperature_grads)
+ , old_temperature_laplacians(scratch.old_temperature_laplacians)
+ , old_old_temperature_laplacians(scratch.old_old_temperature_laplacians)
{}
} // namespace Scratch
template <int dim>
StokesPreconditioner<dim>::StokesPreconditioner(
- const FiniteElement<dim> &stokes_fe) :
- local_matrix(stokes_fe.dofs_per_cell, stokes_fe.dofs_per_cell),
- local_dof_indices(stokes_fe.dofs_per_cell)
+ const FiniteElement<dim> &stokes_fe)
+ : local_matrix(stokes_fe.dofs_per_cell, stokes_fe.dofs_per_cell)
+ , local_dof_indices(stokes_fe.dofs_per_cell)
{}
template <int dim>
StokesPreconditioner<dim>::StokesPreconditioner(
- const StokesPreconditioner &data) :
- local_matrix(data.local_matrix),
- local_dof_indices(data.local_dof_indices)
+ const StokesPreconditioner &data)
+ : local_matrix(data.local_matrix)
+ , local_dof_indices(data.local_dof_indices)
{}
};
template <int dim>
- StokesSystem<dim>::StokesSystem(const FiniteElement<dim> &stokes_fe) :
- StokesPreconditioner<dim>(stokes_fe),
- local_rhs(stokes_fe.dofs_per_cell)
+ StokesSystem<dim>::StokesSystem(const FiniteElement<dim> &stokes_fe)
+ : StokesPreconditioner<dim>(stokes_fe)
+ , local_rhs(stokes_fe.dofs_per_cell)
{}
template <int dim>
- StokesSystem<dim>::StokesSystem(const StokesSystem<dim> &data) :
- StokesPreconditioner<dim>(data),
- local_rhs(data.local_rhs)
+ StokesSystem<dim>::StokesSystem(const StokesSystem<dim> &data)
+ : StokesPreconditioner<dim>(data)
+ , local_rhs(data.local_rhs)
{}
template <int dim>
TemperatureMatrix<dim>::TemperatureMatrix(
- const FiniteElement<dim> &temperature_fe) :
- local_mass_matrix(temperature_fe.dofs_per_cell,
- temperature_fe.dofs_per_cell),
- local_stiffness_matrix(temperature_fe.dofs_per_cell,
- temperature_fe.dofs_per_cell),
- local_dof_indices(temperature_fe.dofs_per_cell)
+ const FiniteElement<dim> &temperature_fe)
+ : local_mass_matrix(temperature_fe.dofs_per_cell,
+ temperature_fe.dofs_per_cell)
+ , local_stiffness_matrix(temperature_fe.dofs_per_cell,
+ temperature_fe.dofs_per_cell)
+ , local_dof_indices(temperature_fe.dofs_per_cell)
{}
template <int dim>
- TemperatureMatrix<dim>::TemperatureMatrix(const TemperatureMatrix &data) :
- local_mass_matrix(data.local_mass_matrix),
- local_stiffness_matrix(data.local_stiffness_matrix),
- local_dof_indices(data.local_dof_indices)
+ TemperatureMatrix<dim>::TemperatureMatrix(const TemperatureMatrix &data)
+ : local_mass_matrix(data.local_mass_matrix)
+ , local_stiffness_matrix(data.local_stiffness_matrix)
+ , local_dof_indices(data.local_dof_indices)
{}
template <int dim>
TemperatureRHS<dim>::TemperatureRHS(
- const FiniteElement<dim> &temperature_fe) :
- local_rhs(temperature_fe.dofs_per_cell),
- local_dof_indices(temperature_fe.dofs_per_cell),
- matrix_for_bc(temperature_fe.dofs_per_cell,
- temperature_fe.dofs_per_cell)
+ const FiniteElement<dim> &temperature_fe)
+ : local_rhs(temperature_fe.dofs_per_cell)
+ , local_dof_indices(temperature_fe.dofs_per_cell)
+ , matrix_for_bc(temperature_fe.dofs_per_cell,
+ temperature_fe.dofs_per_cell)
{}
template <int dim>
- TemperatureRHS<dim>::TemperatureRHS(const TemperatureRHS &data) :
- local_rhs(data.local_rhs),
- local_dof_indices(data.local_dof_indices),
- matrix_for_bc(data.matrix_for_bc)
+ TemperatureRHS<dim>::TemperatureRHS(const TemperatureRHS &data)
+ : local_rhs(data.local_rhs)
+ , local_dof_indices(data.local_dof_indices)
+ , matrix_for_bc(data.matrix_for_bc)
{}
} // namespace CopyData
} // namespace Assembly
// the parameters.
template <int dim>
BoussinesqFlowProblem<dim>::Parameters::Parameters(
- const std::string ¶meter_filename) :
- end_time(1e8),
- initial_global_refinement(2),
- initial_adaptive_refinement(2),
- adaptive_refinement_interval(10),
- stabilization_alpha(2),
- stabilization_c_R(0.11),
- stabilization_beta(0.078),
- stokes_velocity_degree(2),
- use_locally_conservative_discretization(true),
- temperature_degree(2)
+ const std::string ¶meter_filename)
+ : end_time(1e8)
+ , initial_global_refinement(2)
+ , initial_adaptive_refinement(2)
+ , adaptive_refinement_interval(10)
+ , stabilization_alpha(2)
+ , stabilization_c_R(0.11)
+ , stabilization_beta(0.078)
+ , stokes_velocity_degree(2)
+ , use_locally_conservative_discretization(true)
+ , temperature_degree(2)
{
ParameterHandler prm;
BoussinesqFlowProblem<dim>::Parameters::declare_parameters(prm);
// manually also request intermediate summaries every so many time steps in
// the <code>run()</code> function below.
template <int dim>
- BoussinesqFlowProblem<dim>::BoussinesqFlowProblem(Parameters ¶meters_) :
- parameters(parameters_),
- pcout(std::cout, (Utilities::MPI::this_mpi_process(MPI_COMM_WORLD) == 0)),
+ BoussinesqFlowProblem<dim>::BoussinesqFlowProblem(Parameters ¶meters_)
+ : parameters(parameters_)
+ , pcout(std::cout, (Utilities::MPI::this_mpi_process(MPI_COMM_WORLD) == 0))
+ ,
triangulation(MPI_COMM_WORLD,
typename Triangulation<dim>::MeshSmoothing(
Triangulation<dim>::smoothing_on_refinement |
- Triangulation<dim>::smoothing_on_coarsening)),
+ Triangulation<dim>::smoothing_on_coarsening))
+ ,
- global_Omega_diameter(0.),
+ global_Omega_diameter(0.)
+ ,
- mapping(4),
+ mapping(4)
+ ,
stokes_fe(FE_Q<dim>(parameters.stokes_velocity_degree),
dim,
FE_DGP<dim>(parameters.stokes_velocity_degree - 1)) :
static_cast<const FiniteElement<dim> &>(
FE_Q<dim>(parameters.stokes_velocity_degree - 1))),
- 1),
+ 1)
+ ,
- stokes_dof_handler(triangulation),
+ stokes_dof_handler(triangulation)
+ ,
- temperature_fe(parameters.temperature_degree),
- temperature_dof_handler(triangulation),
+ temperature_fe(parameters.temperature_degree)
+ , temperature_dof_handler(triangulation)
+ ,
- time_step(0),
- old_time_step(0),
- timestep_number(0),
- rebuild_stokes_matrix(true),
- rebuild_stokes_preconditioner(true),
- rebuild_temperature_matrices(true),
- rebuild_temperature_preconditioner(true),
+ time_step(0)
+ , old_time_step(0)
+ , timestep_number(0)
+ , rebuild_stokes_matrix(true)
+ , rebuild_stokes_preconditioner(true)
+ , rebuild_temperature_matrices(true)
+ , rebuild_temperature_preconditioner(true)
+ ,
computing_timer(MPI_COMM_WORLD,
pcout,
parameters.stokes_velocity_degree);
const unsigned int n_q_points = quadrature_formula.size();
- FEValues<dim> fe_values(
- mapping, stokes_fe, quadrature_formula, update_values);
+ FEValues<dim> fe_values(mapping,
+ stokes_fe,
+ quadrature_formula,
+ update_values);
std::vector<Tensor<1, dim>> velocity_values(n_q_points);
const FEValuesExtractors::Vector velocities(0);
parameters.stokes_velocity_degree);
const unsigned int n_q_points = quadrature_formula.size();
- FEValues<dim> fe_values(
- mapping, stokes_fe, quadrature_formula, update_values);
+ FEValues<dim> fe_values(mapping,
+ stokes_fe,
+ quadrature_formula,
+ update_values);
std::vector<Tensor<1, dim>> velocity_values(n_q_points);
const FEValuesExtractors::Vector velocities(0);
const QGauss<dim> quadrature_formula(parameters.temperature_degree + 1);
const unsigned int n_q_points = quadrature_formula.size();
- FEValues<dim> fe_values(
- temperature_fe, quadrature_formula, update_values | update_JxW_values);
+ FEValues<dim> fe_values(temperature_fe,
+ quadrature_formula,
+ update_values | update_JxW_values);
std::vector<double> old_temperature_values(n_q_points);
std::vector<double> old_old_temperature_values(n_q_points);
parameters.temperature_degree);
const unsigned int n_q_points = quadrature_formula.size();
- FEValues<dim> fe_values(
- mapping, temperature_fe, quadrature_formula, update_values);
+ FEValues<dim> fe_values(mapping,
+ temperature_fe,
+ quadrature_formula,
+ update_values);
std::vector<double> old_temperature_values(n_q_points);
std::vector<double> old_old_temperature_values(n_q_points);
}
}
- temperature_constraints.distribute_local_to_global(
- cell_vector, local_dof_indices, rhs, matrix_for_bc);
+ temperature_constraints.distribute_local_to_global(cell_vector,
+ local_dof_indices,
+ rhs,
+ matrix_for_bc);
}
rhs.compress(VectorOperation::add);
else
coupling[c][d] = DoFTools::none;
- DoFTools::make_sparsity_pattern(
- stokes_dof_handler,
- coupling,
- sp,
- stokes_constraints,
- false,
- Utilities::MPI::this_mpi_process(MPI_COMM_WORLD));
+ DoFTools::make_sparsity_pattern(stokes_dof_handler,
+ coupling,
+ sp,
+ stokes_constraints,
+ false,
+ Utilities::MPI::this_mpi_process(
+ MPI_COMM_WORLD));
sp.compress();
stokes_matrix.reinit(sp);
else
coupling[c][d] = DoFTools::none;
- DoFTools::make_sparsity_pattern(
- stokes_dof_handler,
- coupling,
- sp,
- stokes_constraints,
- false,
- Utilities::MPI::this_mpi_process(MPI_COMM_WORLD));
+ DoFTools::make_sparsity_pattern(stokes_dof_handler,
+ coupling,
+ sp,
+ stokes_constraints,
+ false,
+ Utilities::MPI::this_mpi_process(
+ MPI_COMM_WORLD));
sp.compress();
stokes_preconditioner_matrix.reinit(sp);
temperature_partitioner,
temperature_relevant_partitioner,
MPI_COMM_WORLD);
- DoFTools::make_sparsity_pattern(
- temperature_dof_handler,
- sp,
- temperature_constraints,
- false,
- Utilities::MPI::this_mpi_process(MPI_COMM_WORLD));
+ DoFTools::make_sparsity_pattern(temperature_dof_handler,
+ sp,
+ temperature_constraints,
+ false,
+ Utilities::MPI::this_mpi_process(
+ MPI_COMM_WORLD));
sp.compress();
temperature_matrix.reinit(sp);
temperature_dof_handler.distribute_dofs(temperature_fe);
std::vector<types::global_dof_index> stokes_dofs_per_block(2);
- DoFTools::count_dofs_per_block(
- stokes_dof_handler, stokes_dofs_per_block, stokes_sub_blocks);
+ DoFTools::count_dofs_per_block(stokes_dof_handler,
+ stokes_dofs_per_block,
+ stokes_sub_blocks);
const unsigned int n_u = stokes_dofs_per_block[0],
n_p = stokes_dofs_per_block[1],
setup_temperature_matrices(temperature_partitioning,
temperature_relevant_partitioning);
- stokes_rhs.reinit(
- stokes_partitioning, stokes_relevant_partitioning, MPI_COMM_WORLD, true);
+ stokes_rhs.reinit(stokes_partitioning,
+ stokes_relevant_partitioning,
+ MPI_COMM_WORLD,
+ true);
stokes_solution.reinit(stokes_relevant_partitioning, MPI_COMM_WORLD);
old_stokes_solution.reinit(stokes_solution);
void BoussinesqFlowProblem<dim>::copy_local_to_global_stokes_preconditioner(
const Assembly::CopyData::StokesPreconditioner<dim> &data)
{
- stokes_constraints.distribute_local_to_global(
- data.local_matrix, data.local_dof_indices, stokes_preconditioner_matrix);
+ stokes_constraints.distribute_local_to_global(data.local_matrix,
+ data.local_dof_indices,
+ stokes_preconditioner_matrix);
}
&BoussinesqFlowProblem<dim>::copy_local_to_global_stokes_preconditioner,
this,
std::placeholders::_1),
- Assembly::Scratch::StokesPreconditioner<dim>(
- stokes_fe,
- quadrature_formula,
- mapping,
- update_JxW_values | update_values | update_gradients),
+ Assembly::Scratch::StokesPreconditioner<dim>(stokes_fe,
+ quadrature_formula,
+ mapping,
+ update_JxW_values |
+ update_values |
+ update_gradients),
Assembly::CopyData::StokesPreconditioner<dim>(stokes_fe));
stokes_preconditioner_matrix.compress(VectorOperation::add);
std::vector<std::vector<bool>> constant_modes;
FEValuesExtractors::Vector velocity_components(0);
- DoFTools::extract_constant_modes(
- stokes_dof_handler,
- stokes_fe.component_mask(velocity_components),
- constant_modes);
+ DoFTools::extract_constant_modes(stokes_dof_handler,
+ stokes_fe.component_mask(
+ velocity_components),
+ constant_modes);
Mp_preconditioner =
std::make_shared<TrilinosWrappers::PreconditionJacobi>();
stokes_matrix,
stokes_rhs);
else
- stokes_constraints.distribute_local_to_global(
- data.local_rhs, data.local_dof_indices, stokes_rhs);
+ stokes_constraints.distribute_local_to_global(data.local_rhs,
+ data.local_dof_indices,
+ stokes_rhs);
}
void BoussinesqFlowProblem<dim>::copy_local_to_global_temperature_matrix(
const Assembly::CopyData::TemperatureMatrix<dim> &data)
{
- temperature_constraints.distribute_local_to_global(
- data.local_mass_matrix, data.local_dof_indices, temperature_mass_matrix);
+ temperature_constraints.distribute_local_to_global(data.local_mass_matrix,
+ data.local_dof_indices,
+ temperature_mass_matrix);
temperature_constraints.distribute_local_to_global(
data.local_stiffness_matrix,
data.local_dof_indices,
&BoussinesqFlowProblem<dim>::copy_local_to_global_temperature_matrix,
this,
std::placeholders::_1),
- Assembly::Scratch::TemperatureMatrix<dim>(
- temperature_fe, mapping, quadrature_formula),
+ Assembly::Scratch::TemperatureMatrix<dim>(temperature_fe,
+ mapping,
+ quadrature_formula),
Assembly::CopyData::TemperatureMatrix<dim>(temperature_fe));
temperature_mass_matrix.compress(VectorOperation::add);
i < distributed_temperature_solution.local_range().second;
++i)
{
- temperature[0] = std::min<double>(
- temperature[0], distributed_temperature_solution(i));
- temperature[1] = std::max<double>(
- temperature[1], distributed_temperature_solution(i));
+ temperature[0] =
+ std::min<double>(temperature[0],
+ distributed_temperature_solution(i));
+ temperature[1] =
+ std::max<double>(temperature[1],
+ distributed_temperature_solution(i));
}
temperature[0] *= -1.0;
template <int dim>
BoussinesqFlowProblem<dim>::Postprocessor::Postprocessor(
const unsigned int partition,
- const double minimal_pressure) :
- partition(partition),
- minimal_pressure(minimal_pressure)
+ const double minimal_pressure)
+ : partition(partition)
+ , minimal_pressure(minimal_pressure)
{}
MPI_COMM_WORLD);
locally_relevant_joint_solution = joint_solution;
- Postprocessor postprocessor(
- Utilities::MPI::this_mpi_process(MPI_COMM_WORLD),
- stokes_solution.block(1).min());
+ Postprocessor postprocessor(Utilities::MPI::this_mpi_process(
+ MPI_COMM_WORLD),
+ stokes_solution.block(1).min());
DataOut<dim> data_out;
data_out.attach_dof_handler(joint_dof_handler);
const QMidpoint<dim> quadrature_formula;
const UpdateFlags update_flags = update_gradients;
- FEValues<dim> fe_v(
- mapping, dof_handler.get_fe(), quadrature_formula, update_flags);
+ FEValues<dim> fe_v(mapping,
+ dof_handler.get_fe(),
+ quadrature_formula,
+ update_flags);
std::vector<std::vector<Tensor<1, dim>>> dU(
1, std::vector<Tensor<1, dim>>(n_components));
template <int dim>
EulerEquations<dim>::Postprocessor::Postprocessor(
- const bool do_schlieren_plot) :
- do_schlieren_plot(do_schlieren_plot)
+ const bool do_schlieren_plot)
+ : do_schlieren_plot(do_schlieren_plot)
{}
Patterns::Selection("gmres|direct"),
"The kind of solver for the linear system. "
"Choices are <gmres|direct>.");
- prm.declare_entry(
- "residual", "1e-10", Patterns::Double(), "Linear solver residual");
- prm.declare_entry(
- "max iters", "300", Patterns::Integer(), "Maximum solver iterations");
- prm.declare_entry(
- "ilut fill", "2", Patterns::Double(), "Ilut preconditioner fill");
+ prm.declare_entry("residual",
+ "1e-10",
+ Patterns::Double(),
+ "Linear solver residual");
+ prm.declare_entry("max iters",
+ "300",
+ Patterns::Integer(),
+ "Maximum solver iterations");
+ prm.declare_entry("ilut fill",
+ "2",
+ Patterns::Double(),
+ "Ilut preconditioner fill");
prm.declare_entry("ilut absolute tolerance",
"1e-9",
Patterns::Double(),
Patterns::Selection("constant|mesh"),
"Whether to use a constant stabilization parameter or "
"a mesh-dependent one");
- prm.declare_entry(
- "stab value", "1", Patterns::Double(), "alpha stabilization");
+ prm.declare_entry("stab value",
+ "1",
+ Patterns::Double(),
+ "alpha stabilization");
}
prm.leave_subsection();
}
"true",
Patterns::Bool(),
"Whether or not to produce schlieren plots");
- prm.declare_entry(
- "step", "-1", Patterns::Double(), "Output once per this period");
+ prm.declare_entry("step",
+ "-1",
+ Patterns::Double(),
+ "Output once per this period");
}
prm.leave_subsection();
}
template <int dim>
- AllParameters<dim>::BoundaryConditions::BoundaryConditions() :
- values(EulerEquations<dim>::n_components)
+ AllParameters<dim>::BoundaryConditions::BoundaryConditions()
+ : values(EulerEquations<dim>::n_components)
{
for (unsigned int c = 0; c < EulerEquations<dim>::n_components; ++c)
kind[c] = EulerEquations<dim>::no_penetration_boundary;
template <int dim>
- AllParameters<dim>::AllParameters() :
- diffusion_power(0.),
- time_step(1.),
- final_time(1.),
- theta(.5),
- is_stationary(true),
- initial_conditions(EulerEquations<dim>::n_components)
+ AllParameters<dim>::AllParameters()
+ : diffusion_power(0.)
+ , time_step(1.)
+ , final_time(1.)
+ , theta(.5)
+ , is_stationary(true)
+ , initial_conditions(EulerEquations<dim>::n_components)
{}
template <int dim>
void AllParameters<dim>::declare_parameters(ParameterHandler &prm)
{
- prm.declare_entry(
- "mesh", "grid.inp", Patterns::Anything(), "intput file name");
+ prm.declare_entry("mesh",
+ "grid.inp",
+ Patterns::Anything(),
+ "intput file name");
prm.declare_entry("diffusion power",
"2.0",
prm.enter_subsection("time stepping");
{
- prm.declare_entry(
- "time step", "0.1", Patterns::Double(0), "simulation time step");
- prm.declare_entry(
- "final time", "10.0", Patterns::Double(0), "simulation end time");
+ prm.declare_entry("time step",
+ "0.1",
+ Patterns::Double(0),
+ "simulation time step");
+ prm.declare_entry("final time",
+ "10.0",
+ Patterns::Double(0),
+ "simulation end time");
prm.declare_entry("theta scheme value",
"0.5",
Patterns::Double(0, 1),
for (unsigned int di = 0; di < EulerEquations<dim>::n_components;
++di)
{
- prm.declare_entry(
- "w_" + Utilities::int_to_string(di),
- "outflow",
- Patterns::Selection("inflow|outflow|pressure"),
- "<inflow|outflow|pressure>");
+ prm.declare_entry("w_" + Utilities::int_to_string(di),
+ "outflow",
+ Patterns::Selection(
+ "inflow|outflow|pressure"),
+ "<inflow|outflow|pressure>");
prm.declare_entry("w_" + Utilities::int_to_string(di) +
" value",
// There is nothing much to say about the constructor. Essentially, it reads
// the input file and fills the parameter object with the parsed values:
template <int dim>
- ConservationLaw<dim>::ConservationLaw(const char *input_filename) :
- mapping(),
- fe(FE_Q<dim>(1), EulerEquations<dim>::n_components),
- dof_handler(triangulation),
- quadrature(2),
- face_quadrature(2),
- verbose_cout(std::cout, false)
+ ConservationLaw<dim>::ConservationLaw(const char *input_filename)
+ : mapping()
+ , fe(FE_Q<dim>(1), EulerEquations<dim>::n_components)
+ , dof_handler(triangulation)
+ , quadrature(2)
+ , face_quadrature(2)
+ , verbose_cout(std::cout, false)
{
ParameterHandler prm;
Parameters::AllParameters<dim>::declare_parameters(prm);
update_normal_vectors,
neighbor_face_update_flags = update_values;
- FEValues<dim> fe_v(mapping, fe, quadrature, update_flags);
- FEFaceValues<dim> fe_v_face(
- mapping, fe, face_quadrature, face_update_flags);
- FESubfaceValues<dim> fe_v_subface(
- mapping, fe, face_quadrature, face_update_flags);
- FEFaceValues<dim> fe_v_face_neighbor(
- mapping, fe, face_quadrature, neighbor_face_update_flags);
- FESubfaceValues<dim> fe_v_subface_neighbor(
- mapping, fe, face_quadrature, neighbor_face_update_flags);
+ FEValues<dim> fe_v(mapping, fe, quadrature, update_flags);
+ FEFaceValues<dim> fe_v_face(mapping,
+ fe,
+ face_quadrature,
+ face_update_flags);
+ FESubfaceValues<dim> fe_v_subface(mapping,
+ fe,
+ face_quadrature,
+ face_update_flags);
+ FEFaceValues<dim> fe_v_face_neighbor(mapping,
+ fe,
+ face_quadrature,
+ neighbor_face_update_flags);
+ FESubfaceValues<dim> fe_v_subface_neighbor(mapping,
+ fe,
+ face_quadrature,
+ neighbor_face_update_flags);
// Then loop over all cells, initialize the FEValues object for the
// current cell and call the function that assembles the problem on this
ExcInternalError());
fe_v_face.reinit(cell, face_no);
- fe_v_subface_neighbor.reinit(
- neighbor, neighbor_face_no, neighbor_subface_no);
+ fe_v_subface_neighbor.reinit(neighbor,
+ neighbor_face_no,
+ neighbor_subface_no);
assemble_face_term(face_no,
fe_v_face,
Table<3, Sacado::Fad::DFad<double>> grad_W(
n_q_points, EulerEquations<dim>::n_components, dim);
- Table<3, double> grad_W_old(
- n_q_points, EulerEquations<dim>::n_components, dim);
+ Table<3, double> grad_W_old(n_q_points,
+ EulerEquations<dim>::n_components,
+ dim);
std::vector<double> residual_derivatives(dofs_per_cell);
{
for (unsigned int k = 0; k < dofs_per_cell; ++k)
residual_derivatives[k] = R_i.fastAccessDx(dofs_per_cell + k);
- system_matrix.add(
- dof_indices[i], dof_indices_neighbor, residual_derivatives);
+ system_matrix.add(dof_indices[i],
+ dof_indices_neighbor,
+ residual_derivatives);
}
right_hand_side(dof_indices[i]) -= R_i.val();
void ConservationLaw<dim>::compute_refinement_indicators(
Vector<double> &refinement_indicators) const
{
- EulerEquations<dim>::compute_refinement_indicators(
- dof_handler, mapping, predictor, refinement_indicators);
+ EulerEquations<dim>::compute_refinement_indicators(dof_handler,
+ mapping,
+ predictor,
+ refinement_indicators);
}
setup_system();
- VectorTools::interpolate(
- dof_handler, parameters.initial_conditions, old_solution);
+ VectorTools::interpolate(dof_handler,
+ parameters.initial_conditions,
+ old_solution);
current_solution = old_solution;
predictor = old_solution;
setup_system();
- VectorTools::interpolate(
- dof_handler, parameters.initial_conditions, old_solution);
+ VectorTools::interpolate(dof_handler,
+ parameters.initial_conditions,
+ old_solution);
current_solution = old_solution;
predictor = old_solution;
}
// knowledge of the number of components.
template <int dim>
BEMProblem<dim>::BEMProblem(const unsigned int fe_degree,
- const unsigned int mapping_degree) :
- fe(fe_degree),
- dh(tria),
- mapping(mapping_degree, true),
- wind(dim),
- singular_quadrature_order(5),
- n_cycles(4),
- external_refinement(5),
- run_in_this_dimension(true),
- extend_solution(true)
+ const unsigned int mapping_degree)
+ : fe(fe_degree)
+ , dh(tria)
+ , mapping(mapping_degree, true)
+ , wind(dim)
+ , singular_quadrature_order(5)
+ , n_cycles(4)
+ , external_refinement(5)
+ , run_in_this_dimension(true)
+ , extend_solution(true)
{}
prm.declare_entry("Number of cycles", "4", Patterns::Integer());
prm.declare_entry("External refinement", "5", Patterns::Integer());
- prm.declare_entry(
- "Extend solution on the -2,2 box", "true", Patterns::Bool());
+ prm.declare_entry("Extend solution on the -2,2 box",
+ "true",
+ Patterns::Bool());
prm.declare_entry("Run 2d simulation", "true", Patterns::Bool());
prm.declare_entry("Run 3d simulation", "true", Patterns::Bool());
prm.enter_subsection("Quadrature rules");
{
- quadrature =
- std::shared_ptr<Quadrature<dim - 1>>(new QuadratureSelector<dim - 1>(
- prm.get("Quadrature type"), prm.get_integer("Quadrature order")));
+ quadrature = std::shared_ptr<Quadrature<dim - 1>>(
+ new QuadratureSelector<dim - 1>(prm.get("Quadrature type"),
+ prm.get_integer("Quadrature order")));
singular_quadrature_order = prm.get_integer("Singular quadrature order");
}
prm.leave_subsection();
// We construct a vector of support points which will be used in the local
// integrations:
std::vector<Point<dim>> support_points(dh.n_dofs());
- DoFTools::map_dofs_to_support_points<dim - 1, dim>(
- mapping, dh, support_points);
+ DoFTools::map_dofs_to_support_points<dim - 1, dim>(mapping,
+ dh,
+ support_points);
// After doing so, we can start the integration loop over all cells, where
difference_per_cell,
QGauss<(dim - 1)>(2 * fe.degree + 1),
VectorTools::L2_norm);
- const double L2_error = VectorTools::compute_global_error(
- tria, difference_per_cell, VectorTools::L2_norm);
+ const double L2_error =
+ VectorTools::compute_global_error(tria,
+ difference_per_cell,
+ VectorTools::L2_norm);
// The error in the alpha vector can be computed directly using the
// Vector::linfty_norm() function, since on each node, the value should be
static std::vector<QGaussOneOverR<2>> quadratures;
if (quadratures.size() == 0)
for (unsigned int i = 0; i < fe.dofs_per_cell; ++i)
- quadratures.emplace_back(
- singular_quadrature_order, fe.get_unit_support_points()[i], true);
+ quadratures.emplace_back(singular_quadrature_order,
+ fe.get_unit_support_points()[i],
+ true);
return quadratures[index];
}
std::vector<Vector<double>> local_wind(n_q_points, Vector<double>(dim));
std::vector<Point<dim>> external_support_points(external_dh.n_dofs());
- DoFTools::map_dofs_to_support_points<dim>(
- StaticMappingQ1<dim>::mapping, external_dh, external_support_points);
+ DoFTools::map_dofs_to_support_points<dim>(StaticMappingQ1<dim>::mapping,
+ external_dh,
+ external_support_points);
for (cell = dh.begin_active(); cell != endc; ++cell)
{
// In the constructor of this class we declare all the parameters. The
// details of how this works have been discussed elsewhere, for example in
// step-19 and step-29.
- Data_Storage::Data_Storage() :
- form(METHOD_ROTATIONAL),
- initial_time(0.),
- final_time(1.),
- Reynolds(1.),
- dt(5e-4),
- n_global_refines(0),
- pressure_degree(1),
- vel_max_iterations(1000),
- vel_Krylov_size(30),
- vel_off_diagonals(60),
- vel_update_prec(15),
- vel_eps(1e-12),
- vel_diag_strength(0.01),
- verbose(true),
- output_interval(15)
+ Data_Storage::Data_Storage()
+ : form(METHOD_ROTATIONAL)
+ , initial_time(0.)
+ , final_time(1.)
+ , Reynolds(1.)
+ , dt(5e-4)
+ , n_global_refines(0)
+ , pressure_degree(1)
+ , vel_max_iterations(1000)
+ , vel_Krylov_size(30)
+ , vel_off_diagonals(60)
+ , vel_update_prec(15)
+ , vel_eps(1e-12)
+ , vel_diag_strength(0.01)
+ , verbose(true)
+ , output_interval(15)
{
prm.declare_entry("Method_Form",
"rotational",
"1.",
Patterns::Double(0.),
" The final time of the simulation. ");
- prm.declare_entry(
- "Reynolds", "1.", Patterns::Double(0.), " The Reynolds number. ");
+ prm.declare_entry("Reynolds",
+ "1.",
+ Patterns::Double(0.),
+ " The Reynolds number. ");
}
prm.leave_subsection();
prm.enter_subsection("Time step data");
{
- prm.declare_entry(
- "dt", "5e-4", Patterns::Double(0.), " The time step size. ");
+ prm.declare_entry("dt",
+ "5e-4",
+ Patterns::Double(0.),
+ " The time step size. ");
}
prm.leave_subsection();
"1000",
Patterns::Integer(1, 1000),
" The maximal number of iterations GMRES must make. ");
- prm.declare_entry(
- "eps", "1e-12", Patterns::Double(0.), " The stopping criterion. ");
+ prm.declare_entry("eps",
+ "1e-12",
+ Patterns::Double(0.),
+ " The stopping criterion. ");
prm.declare_entry("Krylov_size",
"30",
Patterns::Integer(1),
template <int dim>
MultiComponentFunction<dim>::MultiComponentFunction(
- const double initial_time) :
- Function<dim>(1, initial_time),
- comp(0)
+ const double initial_time)
+ : Function<dim>(1, initial_time)
+ , comp(0)
{}
template <int dim>
- Velocity<dim>::Velocity(const double initial_time) :
- MultiComponentFunction<dim>(initial_time)
+ Velocity<dim>::Velocity(const double initial_time)
+ : MultiComponentFunction<dim>(initial_time)
{}
};
template <int dim>
- Pressure<dim>::Pressure(const double initial_time) :
- Function<dim>(1, initial_time)
+ Pressure<dim>::Pressure(const double initial_time)
+ : Function<dim>(1, initial_time)
{}
InitGradPerTaskData(const unsigned int dd,
const unsigned int vdpc,
- const unsigned int pdpc) :
- d(dd),
- vel_dpc(vdpc),
- pres_dpc(pdpc),
- local_grad(vdpc, pdpc),
- vel_local_dof_indices(vdpc),
- pres_local_dof_indices(pdpc)
+ const unsigned int pdpc)
+ : d(dd)
+ , vel_dpc(vdpc)
+ , pres_dpc(pdpc)
+ , local_grad(vdpc, pdpc)
+ , vel_local_dof_indices(vdpc)
+ , pres_local_dof_indices(pdpc)
{}
};
const FE_Q<dim> & fe_p,
const QGauss<dim> &quad,
const UpdateFlags flags_v,
- const UpdateFlags flags_p) :
- nqp(quad.size()),
- fe_val_vel(fe_v, quad, flags_v),
- fe_val_pres(fe_p, quad, flags_p)
+ const UpdateFlags flags_p)
+ : nqp(quad.size())
+ , fe_val_vel(fe_v, quad, flags_v)
+ , fe_val_pres(fe_p, quad, flags_p)
{}
- InitGradScratchData(const InitGradScratchData &data) :
- nqp(data.nqp),
- fe_val_vel(data.fe_val_vel.get_fe(),
- data.fe_val_vel.get_quadrature(),
- data.fe_val_vel.get_update_flags()),
- fe_val_pres(data.fe_val_pres.get_fe(),
- data.fe_val_pres.get_quadrature(),
- data.fe_val_pres.get_update_flags())
+ InitGradScratchData(const InitGradScratchData &data)
+ : nqp(data.nqp)
+ , fe_val_vel(data.fe_val_vel.get_fe(),
+ data.fe_val_vel.get_quadrature(),
+ data.fe_val_vel.get_update_flags())
+ , fe_val_pres(data.fe_val_pres.get_fe(),
+ data.fe_val_pres.get_quadrature(),
+ data.fe_val_pres.get_update_flags())
{}
};
{
FullMatrix<double> local_advection;
std::vector<types::global_dof_index> local_dof_indices;
- AdvectionPerTaskData(const unsigned int dpc) :
- local_advection(dpc, dpc),
- local_dof_indices(dpc)
+ AdvectionPerTaskData(const unsigned int dpc)
+ : local_advection(dpc, dpc)
+ , local_dof_indices(dpc)
{}
};
FEValues<dim> fe_val;
AdvectionScratchData(const FE_Q<dim> & fe,
const QGauss<dim> &quad,
- const UpdateFlags flags) :
- nqp(quad.size()),
- dpc(fe.dofs_per_cell),
- u_star_local(nqp),
- grad_u_star(nqp),
- u_star_tmp(nqp),
- fe_val(fe, quad, flags)
+ const UpdateFlags flags)
+ : nqp(quad.size())
+ , dpc(fe.dofs_per_cell)
+ , u_star_local(nqp)
+ , grad_u_star(nqp)
+ , u_star_tmp(nqp)
+ , fe_val(fe, quad, flags)
{}
- AdvectionScratchData(const AdvectionScratchData &data) :
- nqp(data.nqp),
- dpc(data.dpc),
- u_star_local(nqp),
- grad_u_star(nqp),
- u_star_tmp(nqp),
- fe_val(data.fe_val.get_fe(),
- data.fe_val.get_quadrature(),
- data.fe_val.get_update_flags())
+ AdvectionScratchData(const AdvectionScratchData &data)
+ : nqp(data.nqp)
+ , dpc(data.dpc)
+ , u_star_local(nqp)
+ , grad_u_star(nqp)
+ , u_star_tmp(nqp)
+ , fe_val(data.fe_val.get_fe(),
+ data.fe_val.get_quadrature(),
+ data.fe_val.get_update_flags())
{}
};
// triangulation and load the initial data.
template <int dim>
NavierStokesProjection<dim>::NavierStokesProjection(
- const RunTimeParameters::Data_Storage &data) :
- type(data.form),
- deg(data.pressure_degree),
- dt(data.dt),
- t_0(data.initial_time),
- T(data.final_time),
- Re(data.Reynolds),
- vel_exact(data.initial_time),
- fe_velocity(deg + 1),
- fe_pressure(deg),
- dof_handler_velocity(triangulation),
- dof_handler_pressure(triangulation),
- quadrature_pressure(deg + 1),
- quadrature_velocity(deg + 2),
- vel_max_its(data.vel_max_iterations),
- vel_Krylov_size(data.vel_Krylov_size),
- vel_off_diagonals(data.vel_off_diagonals),
- vel_update_prec(data.vel_update_prec),
- vel_eps(data.vel_eps),
- vel_diag_strength(data.vel_diag_strength)
+ const RunTimeParameters::Data_Storage &data)
+ : type(data.form)
+ , deg(data.pressure_degree)
+ , dt(data.dt)
+ , t_0(data.initial_time)
+ , T(data.final_time)
+ , Re(data.Reynolds)
+ , vel_exact(data.initial_time)
+ , fe_velocity(deg + 1)
+ , fe_pressure(deg)
+ , dof_handler_velocity(triangulation)
+ , dof_handler_pressure(triangulation)
+ , quadrature_pressure(deg + 1)
+ , quadrature_velocity(deg + 2)
+ , vel_max_its(data.vel_max_iterations)
+ , vel_Krylov_size(data.vel_Krylov_size)
+ , vel_off_diagonals(data.vel_off_diagonals)
+ , vel_update_prec(data.vel_update_prec)
+ , vel_eps(data.vel_eps)
+ , vel_diag_strength(data.vel_diag_strength)
{
if (deg < 1)
std::cout
{
vel_exact.set_time(t_0);
vel_exact.set_component(d);
- VectorTools::interpolate(
- dof_handler_velocity, Functions::ZeroFunction<dim>(), u_n_minus_1[d]);
+ VectorTools::interpolate(dof_handler_velocity,
+ Functions::ZeroFunction<dim>(),
+ u_n_minus_1[d]);
vel_exact.advance_time(dt);
- VectorTools::interpolate(
- dof_handler_velocity, Functions::ZeroFunction<dim>(), u_n[d]);
+ VectorTools::interpolate(dof_handler_velocity,
+ Functions::ZeroFunction<dim>(),
+ u_n[d]);
}
}
vel_Laplace.reinit(sparsity_pattern_velocity);
vel_Advection.reinit(sparsity_pattern_velocity);
- MatrixCreator::create_mass_matrix(
- dof_handler_velocity, quadrature_velocity, vel_Mass);
- MatrixCreator::create_laplace_matrix(
- dof_handler_velocity, quadrature_velocity, vel_Laplace);
+ MatrixCreator::create_mass_matrix(dof_handler_velocity,
+ quadrature_velocity,
+ vel_Mass);
+ MatrixCreator::create_laplace_matrix(dof_handler_velocity,
+ quadrature_velocity,
+ vel_Laplace);
}
// The initialization of the matrices that act on the pressure space is
pres_iterative.reinit(sparsity_pattern_pressure);
pres_Mass.reinit(sparsity_pattern_pressure);
- MatrixCreator::create_laplace_matrix(
- dof_handler_pressure, quadrature_pressure, pres_Laplace);
- MatrixCreator::create_mass_matrix(
- dof_handler_pressure, quadrature_pressure, pres_Mass);
+ MatrixCreator::create_laplace_matrix(dof_handler_pressure,
+ quadrature_pressure,
+ pres_Laplace);
+ MatrixCreator::create_mass_matrix(dof_handler_pressure,
+ quadrature_pressure,
+ pres_Mass);
}
{
DynamicSparsityPattern dsp(dof_handler_velocity.n_dofs(),
dof_handler_pressure.n_dofs());
- DoFTools::make_sparsity_pattern(
- dof_handler_velocity, dof_handler_pressure, dsp);
+ DoFTools::make_sparsity_pattern(dof_handler_velocity,
+ dof_handler_pressure,
+ dsp);
sparsity_pattern_pres_vel.copy_from(dsp);
}
- InitGradPerTaskData per_task_data(
- 0, fe_velocity.dofs_per_cell, fe_pressure.dofs_per_cell);
+ InitGradPerTaskData per_task_data(0,
+ fe_velocity.dofs_per_cell,
+ fe_pressure.dofs_per_cell);
InitGradScratchData scratch_data(fe_velocity,
fe_pressure,
quadrature_velocity,
Assert(false, ExcNotImplemented());
}
}
- MatrixTools::apply_boundary_values(
- boundary_values, vel_it_matrix[d], u_n[d], force[d]);
+ MatrixTools::apply_boundary_values(boundary_values,
+ vel_it_matrix[d],
+ u_n[d],
+ force[d]);
}
static std::map<types::global_dof_index, double> bval;
if (reinit_prec)
- VectorTools::interpolate_boundary_values(
- dof_handler_pressure, 3, Functions::ZeroFunction<dim>(), bval);
+ VectorTools::interpolate_boundary_values(dof_handler_pressure,
+ 3,
+ Functions::ZeroFunction<dim>(),
+ bval);
MatrixTools::apply_boundary_values(bval, pres_iterative, phi_n, pres_tmp);
// their values from the input file whose name is specified as an argument
// to this function:
template <int dim>
- EigenvalueProblem<dim>::EigenvalueProblem(const std::string &prm_file) :
- fe(1),
- dof_handler(triangulation)
+ EigenvalueProblem<dim>::EigenvalueProblem(const std::string &prm_file)
+ : fe(1)
+ , dof_handler(triangulation)
{
// TODO investigate why the minimum number of refinement steps required to
// obtain the correct eigenvalue degeneracies is 6
// into the global objects and take care of zero boundary constraints:
cell->get_dof_indices(local_dof_indices);
- constraints.distribute_local_to_global(
- cell_stiffness_matrix, local_dof_indices, stiffness_matrix);
- constraints.distribute_local_to_global(
- cell_mass_matrix, local_dof_indices, mass_matrix);
+ constraints.distribute_local_to_global(cell_stiffness_matrix,
+ local_dof_indices,
+ stiffness_matrix);
+ constraints.distribute_local_to_global(cell_mass_matrix,
+ local_dof_indices,
+ mass_matrix);
}
// At the end of the function, we tell PETSc that the matrices have now
// This program can only be run in serial. Otherwise, throw an exception.
- AssertThrow(
- Utilities::MPI::n_mpi_processes(MPI_COMM_WORLD) == 1,
- ExcMessage("This program can only be run in serial, use ./step-36"));
+ AssertThrow(Utilities::MPI::n_mpi_processes(MPI_COMM_WORLD) == 1,
+ ExcMessage(
+ "This program can only be run in serial, use ./step-36"));
EigenvalueProblem<2> problem("step-36.prm");
problem.run();
class Coefficient : public Function<dim>
{
public:
- Coefficient() : Function<dim>()
+ Coefficient()
+ : Function<dim>()
{}
virtual double value(const Point<dim> & p,
// class that asserts that this class cannot go out of scope while still in
// use in e.g. a preconditioner.
template <int dim, int fe_degree, typename number>
- LaplaceOperator<dim, fe_degree, number>::LaplaceOperator() :
- MatrixFreeOperators::Base<dim, LinearAlgebra::distributed::Vector<number>>()
+ LaplaceOperator<dim, fe_degree, number>::LaplaceOperator()
+ : MatrixFreeOperators::Base<dim,
+ LinearAlgebra::distributed::Vector<number>>()
{}
this->inverse_diagonal_entries->get_vector();
this->data->initialize_dof_vector(inverse_diagonal);
unsigned int dummy = 0;
- this->data->cell_loop(
- &LaplaceOperator::local_compute_diagonal, this, inverse_diagonal, dummy);
+ this->data->cell_loop(&LaplaceOperator::local_compute_diagonal,
+ this,
+ inverse_diagonal,
+ dummy);
this->set_constrained_entries_to_one(inverse_diagonal);
// convergence of the geometric multigrid routines. For the distributed
// grid, we also need to specifically enable the multigrid hierarchy.
template <int dim>
- LaplaceProblem<dim>::LaplaceProblem() :
+ LaplaceProblem<dim>::LaplaceProblem()
+ :
#ifdef DEAL_II_WITH_P4EST
triangulation(
MPI_COMM_WORLD,
Triangulation<dim>::limit_level_difference_at_vertices,
- parallel::distributed::Triangulation<dim>::construct_multigrid_hierarchy),
+ parallel::distributed::Triangulation<dim>::construct_multigrid_hierarchy)
+ ,
#else
- triangulation(Triangulation<dim>::limit_level_difference_at_vertices),
+ triangulation(Triangulation<dim>::limit_level_difference_at_vertices)
+ ,
#endif
- fe(degree_finite_element),
- dof_handler(triangulation),
- setup_time(0.),
- pcout(std::cout, Utilities::MPI::this_mpi_process(MPI_COMM_WORLD) == 0),
+ fe(degree_finite_element)
+ , dof_handler(triangulation)
+ , setup_time(0.)
+ , pcout(std::cout, Utilities::MPI::this_mpi_process(MPI_COMM_WORLD) == 0)
+ ,
// The LaplaceProblem class holds an additional output stream that
// collects detailed timings about the setup phase. This stream, called
// time_details, is disabled by default through the @p false argument
constraints.clear();
constraints.reinit(locally_relevant_dofs);
DoFTools::make_hanging_node_constraints(dof_handler, constraints);
- VectorTools::interpolate_boundary_values(
- dof_handler, 0, Functions::ZeroFunction<dim>(), constraints);
+ VectorTools::interpolate_boundary_values(dof_handler,
+ 0,
+ Functions::ZeroFunction<dim>(),
+ constraints);
constraints.close();
setup_time += time.wall_time();
time_details << "Distribute DoFs & B.C. (CPU/wall) " << time.cpu_time()
(update_gradients | update_JxW_values | update_quadrature_points);
std::shared_ptr<MatrixFree<dim, double>> system_mf_storage(
new MatrixFree<dim, double>());
- system_mf_storage->reinit(
- dof_handler, constraints, QGauss<1>(fe.degree + 1), additional_data);
+ system_mf_storage->reinit(dof_handler,
+ constraints,
+ QGauss<1>(fe.degree + 1),
+ additional_data);
system_matrix.initialize(system_mf_storage);
}
for (unsigned int level = 0; level < nlevels; ++level)
{
IndexSet relevant_dofs;
- DoFTools::extract_locally_relevant_level_dofs(
- dof_handler, level, relevant_dofs);
+ DoFTools::extract_locally_relevant_level_dofs(dof_handler,
+ level,
+ relevant_dofs);
ConstraintMatrix level_constraints;
level_constraints.reinit(relevant_dofs);
level_constraints.add_lines(
QGauss<1>(fe.degree + 1),
additional_data);
- mg_matrices[level].initialize(
- mg_mf_storage_level, mg_constrained_dofs, level);
+ mg_matrices[level].initialize(mg_mf_storage_level,
+ mg_constrained_dofs,
+ level);
mg_matrices[level].evaluate_coefficient(Coefficient<dim>());
}
setup_time += time.wall_time();
class Solution : public Function<dim>
{
public:
- Solution() : Function<dim>()
+ Solution()
+ : Function<dim>()
{}
virtual double value(const Point<dim> & p,
class RightHandSide : public Function<dim>
{
public:
- RightHandSide() : Function<dim>()
+ RightHandSide()
+ : Function<dim>()
{}
virtual double value(const Point<dim> & p,
// DoF handler to the triangulation:
template <int spacedim>
LaplaceBeltramiProblem<spacedim>::LaplaceBeltramiProblem(
- const unsigned degree) :
- fe(degree),
- dof_handler(triangulation),
- mapping(degree)
+ const unsigned degree)
+ : fe(degree)
+ , dof_handler(triangulation)
+ , mapping(degree)
{}
std::set<types::boundary_id> boundary_ids;
boundary_ids.insert(0);
- GridGenerator::extract_boundary_mesh(
- volume_mesh, triangulation, boundary_ids);
+ GridGenerator::extract_boundary_mesh(volume_mesh,
+ triangulation,
+ boundary_ids);
}
triangulation.set_all_manifold_ids(0);
triangulation.set_manifold(0, SphericalManifold<dim, spacedim>());
for (unsigned int i = 0; i < dofs_per_cell; ++i)
{
for (unsigned int j = 0; j < dofs_per_cell; ++j)
- system_matrix.add(
- local_dof_indices[i], local_dof_indices[j], cell_matrix(i, j));
+ system_matrix.add(local_dof_indices[i],
+ local_dof_indices[j],
+ cell_matrix(i, j));
system_rhs(local_dof_indices[i]) += cell_rhs(i);
}
QGauss<dim>(2 * fe.degree + 1),
VectorTools::H1_norm);
- double h1_error = VectorTools::compute_global_error(
- triangulation, difference_per_cell, VectorTools::H1_norm);
+ double h1_error = VectorTools::compute_global_error(triangulation,
+ difference_per_cell,
+ VectorTools::H1_norm);
std::cout << "H1 error = " << h1_error << std::endl;
}
// FiniteElement is provided as a parameter to allow flexibility.
template <int dim>
InteriorPenaltyProblem<dim>::InteriorPenaltyProblem(
- const FiniteElement<dim> &fe) :
- triangulation(Triangulation<dim>::limit_level_difference_at_vertices),
- mapping(),
- fe(fe),
- dof_handler(triangulation),
- estimates(1)
+ const FiniteElement<dim> &fe)
+ : triangulation(Triangulation<dim>::limit_level_difference_at_vertices)
+ , mapping()
+ , fe(fe)
+ , dof_handler(triangulation)
+ , estimates(1)
{
GridGenerator::hyper_cube_slit(triangulation, -1, 1);
}
MeshWorker::IntegrationInfoBox<dim> info_box;
const unsigned int n_gauss_points =
dof_handler.get_fe().tensor_degree() + 1;
- info_box.initialize_gauss_quadrature(
- n_gauss_points, n_gauss_points + 1, n_gauss_points);
+ info_box.initialize_gauss_quadrature(n_gauss_points,
+ n_gauss_points + 1,
+ n_gauss_points);
// but now we need to notify the info box of the finite element function we
// want to evaluate in the quadrature points. First, we create an AnyData
MeshWorker::IntegrationInfoBox<dim> info_box;
const unsigned int n_gauss_points =
dof_handler.get_fe().tensor_degree() + 1;
- info_box.initialize_gauss_quadrature(
- n_gauss_points, n_gauss_points + 1, n_gauss_points);
+ info_box.initialize_gauss_quadrature(n_gauss_points,
+ n_gauss_points + 1,
+ n_gauss_points);
AnyData solution_data;
solution_data.add<Vector<double> *>(&solution, "solution");
class RightHandSide : public Function<dim>
{
public:
- RightHandSide() : Function<dim>()
+ RightHandSide()
+ : Function<dim>()
{}
virtual double value(const Point<dim> & p,
class BoundaryValues : public Function<dim>
{
public:
- BoundaryValues() : Function<dim>()
+ BoundaryValues()
+ : Function<dim>()
{}
virtual double value(const Point<dim> & p,
// and associates the DoFHandler to the triangulation just as in the previous
// example program, step-3:
template <int dim>
-Step4<dim>::Step4() : fe(1), dof_handler(triangulation)
+Step4<dim>::Step4()
+ : fe(1)
+ , dof_handler(triangulation)
{}
for (unsigned int i = 0; i < dofs_per_cell; ++i)
{
for (unsigned int j = 0; j < dofs_per_cell; ++j)
- system_matrix.add(
- local_dof_indices[i], local_dof_indices[j], cell_matrix(i, j));
+ system_matrix.add(local_dof_indices[i],
+ local_dof_indices[j],
+ cell_matrix(i, j));
system_rhs(local_dof_indices[i]) += cell_rhs(i);
}
// object of the class which describes the boundary values we would like to
// use (i.e. the <code>BoundaryValues</code> class declared above):
std::map<types::global_dof_index, double> boundary_values;
- VectorTools::interpolate_boundary_values(
- dof_handler, 0, BoundaryValues<dim>(), boundary_values);
- MatrixTools::apply_boundary_values(
- boundary_values, system_matrix, solution, system_rhs);
+ VectorTools::interpolate_boundary_values(dof_handler,
+ 0,
+ BoundaryValues<dim>(),
+ boundary_values);
+ MatrixTools::apply_boundary_values(boundary_values,
+ system_matrix,
+ solution,
+ system_rhs);
}
// use to determine how much compute time the different parts of the program
// take:
template <int dim>
- LaplaceProblem<dim>::LaplaceProblem() :
- mpi_communicator(MPI_COMM_WORLD),
- triangulation(mpi_communicator,
- typename Triangulation<dim>::MeshSmoothing(
- Triangulation<dim>::smoothing_on_refinement |
- Triangulation<dim>::smoothing_on_coarsening)),
- dof_handler(triangulation),
- fe(2),
- pcout(std::cout, (Utilities::MPI::this_mpi_process(mpi_communicator) == 0)),
- computing_timer(mpi_communicator,
- pcout,
- TimerOutput::summary,
- TimerOutput::wall_times)
+ LaplaceProblem<dim>::LaplaceProblem()
+ : mpi_communicator(MPI_COMM_WORLD)
+ , triangulation(mpi_communicator,
+ typename Triangulation<dim>::MeshSmoothing(
+ Triangulation<dim>::smoothing_on_refinement |
+ Triangulation<dim>::smoothing_on_coarsening))
+ , dof_handler(triangulation)
+ , fe(2)
+ , pcout(std::cout,
+ (Utilities::MPI::this_mpi_process(mpi_communicator) == 0))
+ , computing_timer(mpi_communicator,
+ pcout,
+ TimerOutput::summary,
+ TimerOutput::wall_times)
{}
// locally owned cells (of course the linear solvers will read from it,
// but they do not care about the geometric location of degrees of
// freedom).
- locally_relevant_solution.reinit(
- locally_owned_dofs, locally_relevant_dofs, mpi_communicator);
+ locally_relevant_solution.reinit(locally_owned_dofs,
+ locally_relevant_dofs,
+ mpi_communicator);
system_rhs.reinit(locally_owned_dofs, mpi_communicator);
// The next step is to compute hanging node and boundary value
constraints.clear();
constraints.reinit(locally_relevant_dofs);
DoFTools::make_hanging_node_constraints(dof_handler, constraints);
- VectorTools::interpolate_boundary_values(
- dof_handler, 0, Functions::ZeroFunction<dim>(), constraints);
+ VectorTools::interpolate_boundary_values(dof_handler,
+ 0,
+ Functions::ZeroFunction<dim>(),
+ constraints);
constraints.close();
// The last part of this function deals with initializing the matrix with
mpi_communicator,
locally_relevant_dofs);
- system_matrix.reinit(
- locally_owned_dofs, locally_owned_dofs, dsp, mpi_communicator);
+ system_matrix.reinit(locally_owned_dofs,
+ locally_owned_dofs,
+ dsp,
+ mpi_communicator);
}
class RightHandSide : public Function<dim>
{
public:
- RightHandSide() : Function<dim>()
+ RightHandSide()
+ : Function<dim>()
{}
virtual double value(const Point<dim> & p,
class BoundaryValues : public Function<dim>
{
public:
- BoundaryValues() : Function<dim>()
+ BoundaryValues()
+ : Function<dim>()
{}
virtual double value(const Point<dim> & p,
class Obstacle : public Function<dim>
{
public:
- Obstacle() : Function<dim>()
+ Obstacle()
+ : Function<dim>()
{}
virtual double value(const Point<dim> & p,
// To everyone who has taken a look at the first few tutorial programs, the
// constructor is completely obvious:
template <int dim>
- ObstacleProblem<dim>::ObstacleProblem() : fe(1), dof_handler(triangulation)
+ ObstacleProblem<dim>::ObstacleProblem()
+ : fe(1)
+ , dof_handler(triangulation)
{}
<< std::endl
<< std::endl;
- VectorTools::interpolate_boundary_values(
- dof_handler, 0, BoundaryValues<dim>(), constraints);
+ VectorTools::interpolate_boundary_values(dof_handler,
+ 0,
+ BoundaryValues<dim>(),
+ constraints);
constraints.close();
DynamicSparsityPattern dsp(dof_handler.n_dofs());
Assert(fe.degree == 1, ExcNotImplemented());
const QTrapez<dim> quadrature_formula;
- FEValues<dim> fe_values(
- fe, quadrature_formula, update_values | update_JxW_values);
+ FEValues<dim> fe_values(fe,
+ quadrature_formula,
+ update_values | update_JxW_values);
const unsigned int dofs_per_cell = fe.dofs_per_cell;
const unsigned int n_q_points = quadrature_formula.size();
cell->get_dof_indices(local_dof_indices);
- constraints.distribute_local_to_global(
- cell_matrix, local_dof_indices, mass_matrix);
+ constraints.distribute_local_to_global(cell_matrix,
+ local_dof_indices,
+ mass_matrix);
}
}
// In a final step, we add to the set of constraints on DoFs we have so
// far from the active set those that result from Dirichlet boundary
// values, and close the constraints object:
- VectorTools::interpolate_boundary_values(
- dof_handler, 0, BoundaryValues<dim>(), constraints);
+ VectorTools::interpolate_boundary_values(dof_handler,
+ 0,
+ BoundaryValues<dim>(),
+ constraints);
constraints.close();
}
argc, argv, numbers::invalid_unsigned_int);
// This program can only be run in serial. Otherwise, throw an exception.
- AssertThrow(
- Utilities::MPI::n_mpi_processes(MPI_COMM_WORLD) == 1,
- ExcMessage("This program can only be run in serial, use ./step-41"));
+ AssertThrow(Utilities::MPI::n_mpi_processes(MPI_COMM_WORLD) == 1,
+ ExcMessage(
+ "This program can only be run in serial, use ./step-41"));
ObstacleProblem<2> obstacle_problem;
obstacle_problem.run();
ConstitutiveLaw<dim>::ConstitutiveLaw(double E,
double nu,
double sigma_0,
- double gamma) :
- kappa(E / (3 * (1 - 2 * nu))),
- mu(E / (2 * (1 + nu))),
- sigma_0(sigma_0),
- gamma(gamma),
- stress_strain_tensor_kappa(kappa *
- outer_product(unit_symmetric_tensor<dim>(),
- unit_symmetric_tensor<dim>())),
- stress_strain_tensor_mu(
- 2 * mu *
- (identity_tensor<dim>() - outer_product(unit_symmetric_tensor<dim>(),
- unit_symmetric_tensor<dim>()) /
- 3.0))
+ double gamma)
+ : kappa(E / (3 * (1 - 2 * nu)))
+ , mu(E / (2 * (1 + nu)))
+ , sigma_0(sigma_0)
+ , gamma(gamma)
+ , stress_strain_tensor_kappa(kappa *
+ outer_product(unit_symmetric_tensor<dim>(),
+ unit_symmetric_tensor<dim>()))
+ , stress_strain_tensor_mu(
+ 2 * mu *
+ (identity_tensor<dim>() - outer_product(unit_symmetric_tensor<dim>(),
+ unit_symmetric_tensor<dim>()) /
+ 3.0))
{}
};
template <int dim>
- BoundaryForce<dim>::BoundaryForce() : Function<dim>(dim)
+ BoundaryForce<dim>::BoundaryForce()
+ : Function<dim>(dim)
{}
template <int dim>
- BoundaryValues<dim>::BoundaryValues() : Function<dim>(dim)
+ BoundaryValues<dim>::BoundaryValues()
+ : Function<dim>(dim)
{}
template <int dim>
- SphereObstacle<dim>::SphereObstacle(const double z_surface) :
- Function<dim>(dim),
- z_surface(z_surface)
+ SphereObstacle<dim>::SphereObstacle(const double z_surface)
+ : Function<dim>(dim)
+ , z_surface(z_surface)
{}
// The constructor of this class reads in the data that describes
// the obstacle from the given file name.
template <int dim>
- BitmapFile<dim>::BitmapFile(const std::string &name) :
- obstacle_data(0),
- hx(0),
- hy(0),
- nx(0),
- ny(0)
+ BitmapFile<dim>::BitmapFile(const std::string &name)
+ : obstacle_data(0)
+ , hx(0)
+ , hy(0)
+ , nx(0)
+ , ny(0)
{
std::ifstream f(name);
- AssertThrow(
- f, ExcMessage(std::string("Can't read from file <") + name + ">!"));
+ AssertThrow(f,
+ ExcMessage(std::string("Can't read from file <") + name +
+ ">!"));
std::string temp;
f >> temp >> nx >> ny;
template <int dim>
ChineseObstacle<dim>::ChineseObstacle(const std::string &filename,
- const double z_surface) :
- Function<dim>(dim),
- input_obstacle(filename),
- z_surface(z_surface)
+ const double z_surface)
+ : Function<dim>(dim)
+ , input_obstacle(filename)
+ , z_surface(z_surface)
{}
// creating such a directory if necessary.
template <int dim>
PlasticityContactProblem<dim>::PlasticityContactProblem(
- const ParameterHandler &prm) :
- mpi_communicator(MPI_COMM_WORLD),
- pcout(std::cout, (Utilities::MPI::this_mpi_process(mpi_communicator) == 0)),
- computing_timer(MPI_COMM_WORLD,
- pcout,
- TimerOutput::never,
- TimerOutput::wall_times),
+ const ParameterHandler &prm)
+ : mpi_communicator(MPI_COMM_WORLD)
+ , pcout(std::cout,
+ (Utilities::MPI::this_mpi_process(mpi_communicator) == 0))
+ , computing_timer(MPI_COMM_WORLD,
+ pcout,
+ TimerOutput::never,
+ TimerOutput::wall_times)
+ ,
n_initial_global_refinements(
- prm.get_integer("number of initial refinements")),
- triangulation(mpi_communicator),
- fe_degree(prm.get_integer("polynomial degree")),
- fe(FE_Q<dim>(QGaussLobatto<1>(fe_degree + 1)), dim),
- dof_handler(triangulation),
-
- e_modulus(200000),
- nu(0.3),
- gamma(0.01),
- sigma_0(400.0),
- constitutive_law(e_modulus, nu, sigma_0, gamma),
-
- base_mesh(prm.get("base mesh")),
- obstacle(prm.get("obstacle") == "read from file" ?
- static_cast<const Function<dim> *>(
- new EquationData::ChineseObstacle<dim>(
- "obstacle.pbm",
- (base_mesh == "box" ? 1.0 : 0.5))) :
- static_cast<const Function<dim> *>(
- new EquationData::SphereObstacle<dim>(
- base_mesh == "box" ? 1.0 : 0.5))),
-
- transfer_solution(prm.get_bool("transfer solution")),
- n_refinement_cycles(prm.get_integer("number of cycles")),
- current_refinement_cycle(0)
+ prm.get_integer("number of initial refinements"))
+ , triangulation(mpi_communicator)
+ , fe_degree(prm.get_integer("polynomial degree"))
+ , fe(FE_Q<dim>(QGaussLobatto<1>(fe_degree + 1)), dim)
+ , dof_handler(triangulation)
+ ,
+
+ e_modulus(200000)
+ , nu(0.3)
+ , gamma(0.01)
+ , sigma_0(400.0)
+ , constitutive_law(e_modulus, nu, sigma_0, gamma)
+ ,
+
+ base_mesh(prm.get("base mesh"))
+ , obstacle(prm.get("obstacle") == "read from file" ?
+ static_cast<const Function<dim> *>(
+ new EquationData::ChineseObstacle<dim>(
+ "obstacle.pbm",
+ (base_mesh == "box" ? 1.0 : 0.5))) :
+ static_cast<const Function<dim> *>(
+ new EquationData::SphereObstacle<dim>(
+ base_mesh == "box" ? 1.0 : 0.5)))
+ ,
+
+ transfer_solution(prm.get_bool("transfer solution"))
+ , n_refinement_cycles(prm.get_integer("number of cycles"))
+ , current_refinement_cycle(0)
{
std::string strat = prm.get("refinement strategy");
TrilinosWrappers::SparsityPattern sp(locally_owned_dofs,
mpi_communicator);
- DoFTools::make_sparsity_pattern(
- dof_handler,
- sp,
- constraints_dirichlet_and_hanging_nodes,
- false,
- Utilities::MPI::this_mpi_process(mpi_communicator));
+ DoFTools::make_sparsity_pattern(dof_handler,
+ sp,
+ constraints_dirichlet_and_hanging_nodes,
+ false,
+ Utilities::MPI::this_mpi_process(
+ mpi_communicator));
sp.compress();
newton_matrix.reinit(sp);
{
QGaussLobatto<dim - 1> face_quadrature_formula(fe.degree + 1);
- FEFaceValues<dim> fe_values_face(
- fe, face_quadrature_formula, update_values | update_JxW_values);
+ FEFaceValues<dim> fe_values_face(fe,
+ face_quadrature_formula,
+ update_values | update_JxW_values);
const unsigned int dofs_per_cell = fe.dofs_per_cell;
const unsigned int n_face_q_points = face_quadrature_formula.size();
// looping over quadrature points is equivalent to looping over shape
// functions defined on a face. With this, the code looks as follows:
Quadrature<dim - 1> face_quadrature(fe.get_unit_face_support_points());
- FEFaceValues<dim> fe_values_face(
- fe, face_quadrature, update_quadrature_points);
+ FEFaceValues<dim> fe_values_face(fe,
+ face_quadrature,
+ update_quadrature_points);
const unsigned int dofs_per_face = fe.dofs_per_face;
const unsigned int n_face_q_points = face_quadrature.size();
TimerOutput::Scope t(computing_timer, "Solve: setup preconditioner");
std::vector<std::vector<bool>> constant_modes;
- DoFTools::extract_constant_modes(
- dof_handler, ComponentMask(), constant_modes);
+ DoFTools::extract_constant_modes(dof_handler,
+ ComponentMask(),
+ constant_modes);
TrilinosWrappers::PreconditionAMG::AdditionalData additional_data;
additional_data.constant_modes = constant_modes;
SolverControl solver_control(newton_matrix.m(), solver_tolerance);
SolverBicgstab<TrilinosWrappers::MPI::Vector> solver(solver_control);
- solver.solve(
- newton_matrix, distributed_solution, newton_rhs, preconditioner);
+ solver.solve(newton_matrix,
+ distributed_solution,
+ newton_rhs,
+ preconditioner);
pcout << " Error: " << solver_control.initial_value() << " -> "
<< solver_control.last_value() << " in "
double contact_force = 0.0;
QGauss<dim - 1> face_quadrature_formula(fe.degree + 1);
- FEFaceValues<dim> fe_values_face(
- fe, face_quadrature_formula, update_values | update_JxW_values);
+ FEFaceValues<dim> fe_values_face(fe,
+ face_quadrature_formula,
+ update_values | update_JxW_values);
const unsigned int n_face_q_points = face_quadrature_formula.size();
class PressureRightHandSide : public Function<dim>
{
public:
- PressureRightHandSide() : Function<dim>(1)
+ PressureRightHandSide()
+ : Function<dim>(1)
{}
virtual double value(const Point<dim> & p,
class PressureBoundaryValues : public Function<dim>
{
public:
- PressureBoundaryValues() : Function<dim>(1)
+ PressureBoundaryValues()
+ : Function<dim>(1)
{}
virtual double value(const Point<dim> & p,
class SaturationBoundaryValues : public Function<dim>
{
public:
- SaturationBoundaryValues() : Function<dim>(1)
+ SaturationBoundaryValues()
+ : Function<dim>(1)
{}
virtual double value(const Point<dim> & p,
class SaturationInitialValues : public Function<dim>
{
public:
- SaturationInitialValues() : Function<dim>(1)
+ SaturationInitialValues()
+ : Function<dim>(1)
{}
virtual double value(const Point<dim> & p,
class KInverse : public TensorFunction<2, dim>
{
public:
- KInverse() : TensorFunction<2, dim>()
+ KInverse()
+ : TensorFunction<2, dim>()
{}
virtual void value_list(const std::vector<Point<dim>> &points,
class KInverse : public TensorFunction<2, dim>
{
public:
- KInverse() : TensorFunction<2, dim>()
+ KInverse()
+ : TensorFunction<2, dim>()
{}
virtual void
template <class MatrixType, class PreconditionerType>
InverseMatrix<MatrixType, PreconditionerType>::InverseMatrix(
const MatrixType & m,
- const PreconditionerType &preconditioner) :
- matrix(&m),
- preconditioner(preconditioner)
+ const PreconditionerType &preconditioner)
+ : matrix(&m)
+ , preconditioner(preconditioner)
{}
const TrilinosWrappers::BlockSparseMatrix &S,
const InverseMatrix<TrilinosWrappers::SparseMatrix,
PreconditionerTypeMp> &Mpinv,
- const PreconditionerTypeA & Apreconditioner) :
- darcy_matrix(&S),
- m_inverse(&Mpinv),
- a_preconditioner(Apreconditioner),
- tmp(complete_index_set(darcy_matrix->block(1, 1).m()))
+ const PreconditionerTypeA & Apreconditioner)
+ : darcy_matrix(&S)
+ , m_inverse(&Mpinv)
+ , a_preconditioner(Apreconditioner)
+ , tmp(complete_index_set(darcy_matrix->block(1, 1).m()))
{}
// stepping variables related to operator splitting as well as the option
// for matrix assembly and preconditioning:
template <int dim>
- TwoPhaseFlowProblem<dim>::TwoPhaseFlowProblem(const unsigned int degree) :
- triangulation(Triangulation<dim>::maximum_smoothing),
- global_Omega_diameter(std::numeric_limits<double>::quiet_NaN()),
- degree(degree),
- darcy_degree(degree),
- darcy_fe(FE_Q<dim>(darcy_degree + 1), dim, FE_Q<dim>(darcy_degree), 1),
- darcy_dof_handler(triangulation),
-
- saturation_degree(degree + 1),
- saturation_fe(saturation_degree),
- saturation_dof_handler(triangulation),
-
- saturation_refinement_threshold(0.5),
-
- time(0),
- end_time(10),
-
- current_macro_time_step(0),
- old_macro_time_step(0),
-
- time_step(0),
- old_time_step(0),
- timestep_number(0),
- viscosity(0.2),
- porosity(1.0),
- AOS_threshold(3.0),
+ TwoPhaseFlowProblem<dim>::TwoPhaseFlowProblem(const unsigned int degree)
+ : triangulation(Triangulation<dim>::maximum_smoothing)
+ , global_Omega_diameter(std::numeric_limits<double>::quiet_NaN())
+ , degree(degree)
+ , darcy_degree(degree)
+ , darcy_fe(FE_Q<dim>(darcy_degree + 1), dim, FE_Q<dim>(darcy_degree), 1)
+ , darcy_dof_handler(triangulation)
+ ,
+
+ saturation_degree(degree + 1)
+ , saturation_fe(saturation_degree)
+ , saturation_dof_handler(triangulation)
+ ,
+
+ saturation_refinement_threshold(0.5)
+ ,
+
+ time(0)
+ , end_time(10)
+ ,
+
+ current_macro_time_step(0)
+ , old_macro_time_step(0)
+ ,
+
+ time_step(0)
+ , old_time_step(0)
+ , timestep_number(0)
+ , viscosity(0.2)
+ , porosity(1.0)
+ , AOS_threshold(3.0)
+ ,
rebuild_saturation_matrix(true)
{}
DoFTools::make_hanging_node_constraints(darcy_dof_handler,
darcy_preconditioner_constraints);
- DoFTools::make_zero_boundary_constraints(
- darcy_dof_handler,
- darcy_preconditioner_constraints,
- darcy_fe.component_mask(pressure));
+ DoFTools::make_zero_boundary_constraints(darcy_dof_handler,
+ darcy_preconditioner_constraints,
+ darcy_fe.component_mask(
+ pressure));
darcy_preconditioner_constraints.close();
}
std::vector<types::global_dof_index> darcy_dofs_per_block(2);
- DoFTools::count_dofs_per_block(
- darcy_dof_handler, darcy_dofs_per_block, darcy_block_component);
+ DoFTools::count_dofs_per_block(darcy_dof_handler,
+ darcy_dofs_per_block,
+ darcy_block_component);
const unsigned int n_u = darcy_dofs_per_block[0],
n_p = darcy_dofs_per_block[1],
n_s = saturation_dof_handler.n_dofs();
DynamicSparsityPattern dsp(n_s, n_s);
- DoFTools::make_sparsity_pattern(
- saturation_dof_handler, dsp, saturation_constraints, false);
+ DoFTools::make_sparsity_pattern(saturation_dof_handler,
+ dsp,
+ saturation_constraints,
+ false);
saturation_matrix.reinit(dsp);
update_JxW_values | update_values |
update_gradients |
update_quadrature_points);
- FEValues<dim> saturation_fe_values(
- saturation_fe, quadrature_formula, update_values);
+ FEValues<dim> saturation_fe_values(saturation_fe,
+ quadrature_formula,
+ update_values);
const unsigned int dofs_per_cell = darcy_fe.dofs_per_cell;
const unsigned int n_q_points = quadrature_formula.size();
update_quadrature_points |
update_JxW_values);
- FEValues<dim> saturation_fe_values(
- saturation_fe, quadrature_formula, update_values);
+ FEValues<dim> saturation_fe_values(saturation_fe,
+ quadrature_formula,
+ update_values);
- FEFaceValues<dim> darcy_fe_face_values(
- darcy_fe,
- face_quadrature_formula,
- update_values | update_normal_vectors | update_quadrature_points |
- update_JxW_values);
+ FEFaceValues<dim> darcy_fe_face_values(darcy_fe,
+ face_quadrature_formula,
+ update_values |
+ update_normal_vectors |
+ update_quadrature_points |
+ update_JxW_values);
const unsigned int dofs_per_cell = darcy_fe.dofs_per_cell;
{
QGauss<dim> quadrature_formula(saturation_degree + 2);
- FEValues<dim> saturation_fe_values(
- saturation_fe, quadrature_formula, update_values | update_JxW_values);
+ FEValues<dim> saturation_fe_values(saturation_fe,
+ quadrature_formula,
+ update_values | update_JxW_values);
const unsigned int dofs_per_cell = saturation_fe.dofs_per_cell;
}
cell->get_dof_indices(local_dof_indices);
- saturation_constraints.distribute_local_to_global(
- local_matrix, local_dof_indices, saturation_matrix);
+ saturation_constraints.distribute_local_to_global(local_matrix,
+ local_dof_indices,
+ saturation_matrix);
}
}
update_quadrature_points |
update_JxW_values);
FEValues<dim> darcy_fe_values(darcy_fe, quadrature_formula, update_values);
- FEFaceValues<dim> saturation_fe_face_values(
- saturation_fe,
- face_quadrature_formula,
- update_values | update_normal_vectors | update_quadrature_points |
- update_JxW_values);
- FEFaceValues<dim> darcy_fe_face_values(
- darcy_fe, face_quadrature_formula, update_values);
+ FEFaceValues<dim> saturation_fe_face_values(saturation_fe,
+ face_quadrature_formula,
+ update_values |
+ update_normal_vectors |
+ update_quadrature_points |
+ update_JxW_values);
+ FEFaceValues<dim> darcy_fe_face_values(darcy_fe,
+ face_quadrature_formula,
+ update_values);
FEFaceValues<dim> saturation_fe_face_values_neighbor(
saturation_fe, face_quadrature_formula, update_values);
saturation_fe_values.JxW(q);
}
- saturation_constraints.distribute_local_to_global(
- local_rhs, local_dof_indices, saturation_rhs);
+ saturation_constraints.distribute_local_to_global(local_rhs,
+ local_dof_indices,
+ saturation_rhs);
}
saturation_fe_face_values.shape_value(i, q) *
saturation_fe_face_values.JxW(q);
}
- saturation_constraints.distribute_local_to_global(
- local_rhs, local_dof_indices, saturation_rhs);
+ saturation_constraints.distribute_local_to_global(local_rhs,
+ local_dof_indices,
+ saturation_rhs);
}
TrilinosWrappers::PreconditionIC preconditioner;
preconditioner.initialize(saturation_matrix);
- cg.solve(
- saturation_matrix, saturation_solution, saturation_rhs, preconditioner);
+ cg.solve(saturation_matrix,
+ saturation_solution,
+ saturation_rhs,
+ preconditioner);
saturation_constraints.distribute(saturation_solution);
project_back_saturation();
{
Vector<double> refinement_indicators(triangulation.n_active_cells());
{
- const QMidpoint<dim> quadrature_formula;
- FEValues<dim> fe_values(
- saturation_fe, quadrature_formula, update_gradients);
+ const QMidpoint<dim> quadrature_formula;
+ FEValues<dim> fe_values(saturation_fe,
+ quadrature_formula,
+ update_gradients);
std::vector<Tensor<1, dim>> grad_saturation(1);
TrilinosWrappers::MPI::Vector extrapolated_saturation_solution(
for (unsigned int q = 0; q < n_q_points; ++q)
{
- const double mobility_reciprocal_difference =
- std::fabs(mobility_inverse(present_saturation[q], viscosity) -
- mobility_inverse(
- old_saturation_after_solving_pressure[q], viscosity));
+ const double mobility_reciprocal_difference = std::fabs(
+ mobility_inverse(present_saturation[q], viscosity) -
+ mobility_inverse(old_saturation_after_solving_pressure[q],
+ viscosity));
max_local_mobility_reciprocal_difference =
std::max(max_local_mobility_reciprocal_difference,
const unsigned int n_q_points = quadrature_formula.size();
FEValues<dim> darcy_fe_values(darcy_fe, quadrature_formula, update_values);
- FEValues<dim> saturation_fe_values(
- saturation_fe, quadrature_formula, update_values);
+ FEValues<dim> saturation_fe_values(saturation_fe,
+ quadrature_formula,
+ update_values);
std::vector<Vector<double>> darcy_solution_values(n_q_points,
Vector<double>(dim + 1));
std::pow(global_Omega_diameter, alpha - 2.);
return (beta *
- (max_velocity_times_dF_dS)*std::min(
- cell_diameter,
- std::pow(cell_diameter, alpha) * max_residual / global_scaling));
+ (max_velocity_times_dF_dS)*std::min(cell_diameter,
+ std::pow(cell_diameter, alpha) *
+ max_residual /
+ global_scaling));
}
argc, argv, numbers::invalid_unsigned_int);
// This program can only be run in serial. Otherwise, throw an exception.
- AssertThrow(
- Utilities::MPI::n_mpi_processes(MPI_COMM_WORLD) == 1,
- ExcMessage("This program can only be run in serial, use ./step-43"));
+ AssertThrow(Utilities::MPI::n_mpi_processes(MPI_COMM_WORLD) == 1,
+ ExcMessage(
+ "This program can only be run in serial, use ./step-43"));
TwoPhaseFlowProblem<2> two_phase_flow_problem(1);
two_phase_flow_problem.run();
Patterns::Double(-1.0, 0.5),
"Poisson's ratio");
- prm.declare_entry(
- "Shear modulus", "80.194e6", Patterns::Double(), "Shear modulus");
+ prm.declare_entry("Shear modulus",
+ "80.194e6",
+ Patterns::Double(),
+ "Shear modulus");
}
prm.leave_subsection();
}
{
prm.declare_entry("End time", "1", Patterns::Double(), "End time");
- prm.declare_entry(
- "Time step size", "0.1", Patterns::Double(), "Time step size");
+ prm.declare_entry("Time step size",
+ "0.1",
+ Patterns::Double(),
+ "Time step size");
}
prm.leave_subsection();
}
class Time
{
public:
- Time(const double time_end, const double delta_t) :
- timestep(0),
- time_current(0.0),
- time_end(time_end),
- delta_t(delta_t)
+ Time(const double time_end, const double delta_t)
+ : timestep(0)
+ , time_current(0.0)
+ , time_end(time_end)
+ , delta_t(delta_t)
{}
virtual ~Time()
class Material_Compressible_Neo_Hook_Three_Field
{
public:
- Material_Compressible_Neo_Hook_Three_Field(const double mu,
- const double nu) :
- kappa((2.0 * mu * (1.0 + nu)) / (3.0 * (1.0 - 2.0 * nu))),
- c_1(mu / 2.0),
- det_F(1.0),
- p_tilde(0.0),
- J_tilde(1.0),
- b_bar(Physics::Elasticity::StandardTensors<dim>::I)
+ Material_Compressible_Neo_Hook_Three_Field(const double mu, const double nu)
+ : kappa((2.0 * mu * (1.0 + nu)) / (3.0 * (1.0 - 2.0 * nu)))
+ , c_1(mu / 2.0)
+ , det_F(1.0)
+ , p_tilde(0.0)
+ , J_tilde(1.0)
+ , b_bar(Physics::Elasticity::StandardTensors<dim>::I)
{
Assert(kappa > 0, ExcInternalError());
}
class PointHistory
{
public:
- PointHistory() :
- F_inv(Physics::Elasticity::StandardTensors<dim>::I),
- tau(SymmetricTensor<2, dim>()),
- d2Psi_vol_dJ2(0.0),
- dPsi_vol_dJ(0.0),
- Jc(SymmetricTensor<4, dim>())
+ PointHistory()
+ : F_inv(Physics::Elasticity::StandardTensors<dim>::I)
+ , tau(SymmetricTensor<2, dim>())
+ , d2Psi_vol_dJ2(0.0)
+ , dPsi_vol_dJ(0.0)
+ , Jc(SymmetricTensor<4, dim>())
{}
virtual ~PointHistory()
// normalization factors.
struct Errors
{
- Errors() : norm(1.0), u(1.0), p(1.0), J(1.0)
+ Errors()
+ : norm(1.0)
+ , u(1.0)
+ , p(1.0)
+ , J(1.0)
{}
void reset()
// We initialize the Solid class using data extracted from the parameter file.
template <int dim>
- Solid<dim>::Solid(const std::string &input_file) :
- parameters(input_file),
- vol_reference(0.),
- triangulation(Triangulation<dim>::maximum_smoothing),
- time(parameters.end_time, parameters.delta_t),
- timer(std::cout, TimerOutput::summary, TimerOutput::wall_times),
- degree(parameters.poly_degree),
+ Solid<dim>::Solid(const std::string &input_file)
+ : parameters(input_file)
+ , vol_reference(0.)
+ , triangulation(Triangulation<dim>::maximum_smoothing)
+ , time(parameters.end_time, parameters.delta_t)
+ , timer(std::cout, TimerOutput::summary, TimerOutput::wall_times)
+ , degree(parameters.poly_degree)
+ ,
// The Finite Element System is composed of dim continuous displacement
// DOFs, and discontinuous pressure and dilatation DOFs. In an attempt to
// satisfy the Babuska-Brezzi or LBB stability conditions (see Hughes
FE_DGPMonomial<dim>(parameters.poly_degree - 1),
1, // pressure
FE_DGPMonomial<dim>(parameters.poly_degree - 1),
- 1), // dilatation
- dof_handler_ref(triangulation),
- dofs_per_cell(fe.dofs_per_cell),
- u_fe(first_u_component),
- p_fe(p_component),
- J_fe(J_component),
- dofs_per_block(n_blocks),
- qf_cell(parameters.quad_order),
- qf_face(parameters.quad_order),
- n_q_points(qf_cell.size()),
- n_q_points_f(qf_face.size())
+ 1)
+ , // dilatation
+ dof_handler_ref(triangulation)
+ , dofs_per_cell(fe.dofs_per_cell)
+ , u_fe(first_u_component)
+ , p_fe(p_component)
+ , J_fe(J_component)
+ , dofs_per_block(n_blocks)
+ , qf_cell(parameters.quad_order)
+ , qf_face(parameters.quad_order)
+ , n_q_points(qf_cell.size())
+ , n_q_points_f(qf_face.size())
{
Assert(dim == 2 || dim == 3,
ExcMessage("This problem only works in 2 or 3 space dimensions."));
FullMatrix<double> cell_matrix;
std::vector<types::global_dof_index> local_dof_indices;
- PerTaskData_K(const unsigned int dofs_per_cell) :
- cell_matrix(dofs_per_cell, dofs_per_cell),
- local_dof_indices(dofs_per_cell)
+ PerTaskData_K(const unsigned int dofs_per_cell)
+ : cell_matrix(dofs_per_cell, dofs_per_cell)
+ , local_dof_indices(dofs_per_cell)
{}
void reset()
ScratchData_K(const FiniteElement<dim> &fe_cell,
const QGauss<dim> & qf_cell,
- const UpdateFlags uf_cell) :
- fe_values_ref(fe_cell, qf_cell, uf_cell),
- Nx(qf_cell.size(), std::vector<double>(fe_cell.dofs_per_cell)),
- grad_Nx(qf_cell.size(),
- std::vector<Tensor<2, dim>>(fe_cell.dofs_per_cell)),
- symm_grad_Nx(qf_cell.size(),
- std::vector<SymmetricTensor<2, dim>>(fe_cell.dofs_per_cell))
+ const UpdateFlags uf_cell)
+ : fe_values_ref(fe_cell, qf_cell, uf_cell)
+ , Nx(qf_cell.size(), std::vector<double>(fe_cell.dofs_per_cell))
+ , grad_Nx(qf_cell.size(),
+ std::vector<Tensor<2, dim>>(fe_cell.dofs_per_cell))
+ , symm_grad_Nx(qf_cell.size(),
+ std::vector<SymmetricTensor<2, dim>>(
+ fe_cell.dofs_per_cell))
{}
- ScratchData_K(const ScratchData_K &rhs) :
- fe_values_ref(rhs.fe_values_ref.get_fe(),
- rhs.fe_values_ref.get_quadrature(),
- rhs.fe_values_ref.get_update_flags()),
- Nx(rhs.Nx),
- grad_Nx(rhs.grad_Nx),
- symm_grad_Nx(rhs.symm_grad_Nx)
+ ScratchData_K(const ScratchData_K &rhs)
+ : fe_values_ref(rhs.fe_values_ref.get_fe(),
+ rhs.fe_values_ref.get_quadrature(),
+ rhs.fe_values_ref.get_update_flags())
+ , Nx(rhs.Nx)
+ , grad_Nx(rhs.grad_Nx)
+ , symm_grad_Nx(rhs.symm_grad_Nx)
{}
void reset()
Vector<double> cell_rhs;
std::vector<types::global_dof_index> local_dof_indices;
- PerTaskData_RHS(const unsigned int dofs_per_cell) :
- cell_rhs(dofs_per_cell),
- local_dof_indices(dofs_per_cell)
+ PerTaskData_RHS(const unsigned int dofs_per_cell)
+ : cell_rhs(dofs_per_cell)
+ , local_dof_indices(dofs_per_cell)
{}
void reset()
const QGauss<dim> & qf_cell,
const UpdateFlags uf_cell,
const QGauss<dim - 1> & qf_face,
- const UpdateFlags uf_face) :
- fe_values_ref(fe_cell, qf_cell, uf_cell),
- fe_face_values_ref(fe_cell, qf_face, uf_face),
- Nx(qf_cell.size(), std::vector<double>(fe_cell.dofs_per_cell)),
- symm_grad_Nx(qf_cell.size(),
- std::vector<SymmetricTensor<2, dim>>(fe_cell.dofs_per_cell))
+ const UpdateFlags uf_face)
+ : fe_values_ref(fe_cell, qf_cell, uf_cell)
+ , fe_face_values_ref(fe_cell, qf_face, uf_face)
+ , Nx(qf_cell.size(), std::vector<double>(fe_cell.dofs_per_cell))
+ , symm_grad_Nx(qf_cell.size(),
+ std::vector<SymmetricTensor<2, dim>>(
+ fe_cell.dofs_per_cell))
{}
- ScratchData_RHS(const ScratchData_RHS &rhs) :
- fe_values_ref(rhs.fe_values_ref.get_fe(),
- rhs.fe_values_ref.get_quadrature(),
- rhs.fe_values_ref.get_update_flags()),
- fe_face_values_ref(rhs.fe_face_values_ref.get_fe(),
- rhs.fe_face_values_ref.get_quadrature(),
- rhs.fe_face_values_ref.get_update_flags()),
- Nx(rhs.Nx),
- symm_grad_Nx(rhs.symm_grad_Nx)
+ ScratchData_RHS(const ScratchData_RHS &rhs)
+ : fe_values_ref(rhs.fe_values_ref.get_fe(),
+ rhs.fe_values_ref.get_quadrature(),
+ rhs.fe_values_ref.get_update_flags())
+ , fe_face_values_ref(rhs.fe_face_values_ref.get_fe(),
+ rhs.fe_face_values_ref.get_quadrature(),
+ rhs.fe_face_values_ref.get_update_flags())
+ , Nx(rhs.Nx)
+ , symm_grad_Nx(rhs.symm_grad_Nx)
{}
void reset()
PerTaskData_SC(const unsigned int dofs_per_cell,
const unsigned int n_u,
const unsigned int n_p,
- const unsigned int n_J) :
- cell_matrix(dofs_per_cell, dofs_per_cell),
- local_dof_indices(dofs_per_cell),
- k_orig(dofs_per_cell, dofs_per_cell),
- k_pu(n_p, n_u),
- k_pJ(n_p, n_J),
- k_JJ(n_J, n_J),
- k_pJ_inv(n_p, n_J),
- k_bbar(n_u, n_u),
- A(n_J, n_u),
- B(n_J, n_u),
- C(n_p, n_u)
+ const unsigned int n_J)
+ : cell_matrix(dofs_per_cell, dofs_per_cell)
+ , local_dof_indices(dofs_per_cell)
+ , k_orig(dofs_per_cell, dofs_per_cell)
+ , k_pu(n_p, n_u)
+ , k_pJ(n_p, n_J)
+ , k_JJ(n_J, n_J)
+ , k_pJ_inv(n_p, n_J)
+ , k_bbar(n_u, n_u)
+ , A(n_J, n_u)
+ , B(n_J, n_u)
+ , C(n_p, n_u)
{}
void reset()
ScratchData_UQPH(const FiniteElement<dim> & fe_cell,
const QGauss<dim> & qf_cell,
const UpdateFlags uf_cell,
- const BlockVector<double> &solution_total) :
- solution_total(solution_total),
- solution_grads_u_total(qf_cell.size()),
- solution_values_p_total(qf_cell.size()),
- solution_values_J_total(qf_cell.size()),
- fe_values_ref(fe_cell, qf_cell, uf_cell)
+ const BlockVector<double> &solution_total)
+ : solution_total(solution_total)
+ , solution_grads_u_total(qf_cell.size())
+ , solution_values_p_total(qf_cell.size())
+ , solution_values_J_total(qf_cell.size())
+ , fe_values_ref(fe_cell, qf_cell, uf_cell)
{}
- ScratchData_UQPH(const ScratchData_UQPH &rhs) :
- solution_total(rhs.solution_total),
- solution_grads_u_total(rhs.solution_grads_u_total),
- solution_values_p_total(rhs.solution_values_p_total),
- solution_values_J_total(rhs.solution_values_J_total),
- fe_values_ref(rhs.fe_values_ref.get_fe(),
- rhs.fe_values_ref.get_quadrature(),
- rhs.fe_values_ref.get_update_flags())
+ ScratchData_UQPH(const ScratchData_UQPH &rhs)
+ : solution_total(rhs.solution_total)
+ , solution_grads_u_total(rhs.solution_grads_u_total)
+ , solution_values_p_total(rhs.solution_values_p_total)
+ , solution_values_J_total(rhs.solution_values_J_total)
+ , fe_values_ref(rhs.fe_values_ref.get_fe(),
+ rhs.fe_values_ref.get_quadrature(),
+ rhs.fe_values_ref.get_update_flags())
{}
void reset()
dof_handler_ref.distribute_dofs(fe);
DoFRenumbering::Cuthill_McKee(dof_handler_ref);
DoFRenumbering::component_wise(dof_handler_ref, block_component);
- DoFTools::count_dofs_per_block(
- dof_handler_ref, dofs_per_block, block_component);
+ DoFTools::count_dofs_per_block(dof_handler_ref,
+ dofs_per_block,
+ block_component);
std::cout << "Triangulation:"
<< "\n\t Number of active cells: "
{
std::cout << " Setting up quadrature point data..." << std::endl;
- quadrature_point_history.initialize(
- triangulation.begin_active(), triangulation.end(), n_q_points);
+ quadrature_point_history.initialize(triangulation.begin_active(),
+ triangulation.end(),
+ n_q_points);
// Next we setup the initial quadrature point data.
// Note that when the quadrature point data is retrieved,
// extract $\mathsf{\mathbf{k}}$
// for the dofs associated with
// the current element
- data.k_orig.extract_submatrix_from(
- tangent_matrix, data.local_dof_indices, data.local_dof_indices);
+ data.k_orig.extract_submatrix_from(tangent_matrix,
+ data.local_dof_indices,
+ data.local_dof_indices);
// and next the local matrices for
// $\mathsf{\mathbf{k}}_{ \widetilde{p} u}$
// $\mathsf{\mathbf{k}}_{ \widetilde{p} \widetilde{J}}$
// and
// $\mathsf{\mathbf{k}}_{ \widetilde{J} \widetilde{J}}$:
- data.k_pu.extract_submatrix_from(
- data.k_orig, element_indices_p, element_indices_u);
- data.k_pJ.extract_submatrix_from(
- data.k_orig, element_indices_p, element_indices_J);
- data.k_JJ.extract_submatrix_from(
- data.k_orig, element_indices_J, element_indices_J);
+ data.k_pu.extract_submatrix_from(data.k_orig,
+ element_indices_p,
+ element_indices_u);
+ data.k_pJ.extract_submatrix_from(data.k_orig,
+ element_indices_p,
+ element_indices_J);
+ data.k_JJ.extract_submatrix_from(data.k_orig,
+ element_indices_J,
+ element_indices_J);
// To get the inverse of $\mathsf{\mathbf{k}}_{\widetilde{p}
// \widetilde{J}}$, we invert it directly. This operation is relatively
// \mathsf{\mathbf{k}}_{\widetilde{p} u}
// $
data.k_pu.Tmmult(data.k_bbar, data.C);
- data.k_bbar.scatter_matrix_to(
- element_indices_u, element_indices_u, data.cell_matrix);
+ data.k_bbar.scatter_matrix_to(element_indices_u,
+ element_indices_u,
+ data.cell_matrix);
// Next we place
// $\mathsf{\mathbf{k}}^{-1}_{ \widetilde{p} \widetilde{J}}$
// that we need to remove the
// contribution that already exists there.
data.k_pJ_inv.add(-1.0, data.k_pJ);
- data.k_pJ_inv.scatter_matrix_to(
- element_indices_p, element_indices_J, data.cell_matrix);
+ data.k_pJ_inv.scatter_matrix_to(element_indices_p,
+ element_indices_J,
+ data.cell_matrix);
}
// @sect4{Solid::solve_linear_system}
SolverSelector<Vector<double>> solver_K_con_inv;
solver_K_con_inv.select("cg");
solver_K_con_inv.set_control(solver_control_K_con_inv);
- const auto K_uu_con_inv = inverse_operator(
- K_uu_con, solver_K_con_inv, preconditioner_K_con_inv);
+ const auto K_uu_con_inv =
+ inverse_operator(K_uu_con,
+ solver_K_con_inv,
+ preconditioner_K_con_inv);
// Now we are in a position to solve for the displacement field.
// We can nest the linear operations, and the result is immediately
class BoundaryValues : public Function<dim>
{
public:
- BoundaryValues() : Function<dim>(dim + 1)
+ BoundaryValues()
+ : Function<dim>(dim + 1)
{}
virtual double value(const Point<dim> & p,
class RightHandSide : public Function<dim>
{
public:
- RightHandSide() : Function<dim>(dim + 1)
+ RightHandSide()
+ : Function<dim>(dim + 1)
{}
virtual double value(const Point<dim> & p,
const MatrixType & m,
const PreconditionerType &preconditioner,
const IndexSet & locally_owned,
- const MPI_Comm & mpi_communicator) :
- matrix(&m),
- preconditioner(&preconditioner),
- mpi_communicator(&mpi_communicator),
- tmp(locally_owned, mpi_communicator)
+ const MPI_Comm & mpi_communicator)
+ : matrix(&m)
+ , preconditioner(&preconditioner)
+ , mpi_communicator(&mpi_communicator)
+ , tmp(locally_owned, mpi_communicator)
{}
const InverseMatrix<TrilinosWrappers::SparseMatrix, PreconditionerType>
& A_inverse,
const IndexSet &owned_vel,
- const MPI_Comm &mpi_communicator) :
- system_matrix(&system_matrix),
- A_inverse(&A_inverse),
- tmp1(owned_vel, mpi_communicator),
- tmp2(tmp1)
+ const MPI_Comm &mpi_communicator)
+ : system_matrix(&system_matrix)
+ , A_inverse(&A_inverse)
+ , tmp1(owned_vel, mpi_communicator)
+ , tmp2(tmp1)
{}
template <int dim>
- StokesProblem<dim>::StokesProblem(const unsigned int degree) :
- degree(degree),
- mpi_communicator(MPI_COMM_WORLD),
- triangulation(mpi_communicator),
- fe(FE_Q<dim>(degree + 1), dim, FE_Q<dim>(degree), 1),
- dof_handler(triangulation),
- pcout(std::cout, Utilities::MPI::this_mpi_process(mpi_communicator) == 0),
- mapping(degree + 1)
+ StokesProblem<dim>::StokesProblem(const unsigned int degree)
+ : degree(degree)
+ , mpi_communicator(MPI_COMM_WORLD)
+ , triangulation(mpi_communicator)
+ , fe(FE_Q<dim>(degree + 1), dim, FE_Q<dim>(degree), 1)
+ , dof_handler(triangulation)
+ , pcout(std::cout, Utilities::MPI::this_mpi_process(mpi_communicator) == 0)
+ , mapping(degree + 1)
{}
// @endcond
//
DoFRenumbering::component_wise(dof_handler, block_component);
std::vector<types::global_dof_index> dofs_per_block(2);
- DoFTools::count_dofs_per_block(
- dof_handler, dofs_per_block, block_component);
+ DoFTools::count_dofs_per_block(dof_handler,
+ dofs_per_block,
+ block_component);
const unsigned int n_u = dofs_per_block[0], n_p = dofs_per_block[1];
{
relevant_partitioning,
mpi_communicator);
- DoFTools::make_sparsity_pattern(
- dof_handler,
- bsp,
- constraints,
- false,
- Utilities::MPI::this_mpi_process(mpi_communicator));
+ DoFTools::make_sparsity_pattern(dof_handler,
+ bsp,
+ constraints,
+ false,
+ Utilities::MPI::this_mpi_process(
+ mpi_communicator));
bsp.compress();
}
system_rhs.reinit(owned_partitioning, mpi_communicator);
- solution.reinit(
- owned_partitioning, relevant_partitioning, mpi_communicator);
+ solution.reinit(owned_partitioning,
+ relevant_partitioning,
+ mpi_communicator);
}
// The rest of the program is then again identical to step-22. We will omit
class StokesBoundaryValues : public Function<dim>
{
public:
- StokesBoundaryValues() : Function<dim>(dim + 1 + dim)
+ StokesBoundaryValues()
+ : Function<dim>(dim + 1 + dim)
{}
virtual double value(const Point<dim> & p,
class RightHandSide : public Function<dim>
{
public:
- RightHandSide() : Function<dim>(dim + 1)
+ RightHandSide()
+ : Function<dim>(dim + 1)
{}
virtual double value(const Point<dim> & p,
template <int dim>
FluidStructureProblem<dim>::FluidStructureProblem(
const unsigned int stokes_degree,
- const unsigned int elasticity_degree) :
- stokes_degree(stokes_degree),
- elasticity_degree(elasticity_degree),
- triangulation(Triangulation<dim>::maximum_smoothing),
- stokes_fe(FE_Q<dim>(stokes_degree + 1),
- dim,
- FE_Q<dim>(stokes_degree),
- 1,
- FE_Nothing<dim>(),
- dim),
- elasticity_fe(FE_Nothing<dim>(),
- dim,
- FE_Nothing<dim>(),
- 1,
- FE_Q<dim>(elasticity_degree),
- dim),
- dof_handler(triangulation),
- viscosity(2),
- lambda(1),
- mu(1)
+ const unsigned int elasticity_degree)
+ : stokes_degree(stokes_degree)
+ , elasticity_degree(elasticity_degree)
+ , triangulation(Triangulation<dim>::maximum_smoothing)
+ , stokes_fe(FE_Q<dim>(stokes_degree + 1),
+ dim,
+ FE_Q<dim>(stokes_degree),
+ 1,
+ FE_Nothing<dim>(),
+ dim)
+ , elasticity_fe(FE_Nothing<dim>(),
+ dim,
+ FE_Nothing<dim>(),
+ 1,
+ FE_Q<dim>(elasticity_degree),
+ dim)
+ , dof_handler(triangulation)
+ , viscosity(2)
+ , lambda(1)
+ , mu(1)
{
fe_collection.push_back(stokes_fe);
fe_collection.push_back(elasticity_fe);
DoFTools::make_hanging_node_constraints(dof_handler, constraints);
const FEValuesExtractors::Vector velocities(0);
- VectorTools::interpolate_boundary_values(
- dof_handler,
- 1,
- StokesBoundaryValues<dim>(),
- constraints,
- fe_collection.component_mask(velocities));
+ VectorTools::interpolate_boundary_values(dof_handler,
+ 1,
+ StokesBoundaryValues<dim>(),
+ constraints,
+ fe_collection.component_mask(
+ velocities));
const FEValuesExtractors::Vector displacements(dim + 1);
VectorTools::interpolate_boundary_values(
face_coupling[c][d] = DoFTools::always;
}
- DoFTools::make_flux_sparsity_pattern(
- dof_handler, dsp, cell_coupling, face_coupling);
+ DoFTools::make_flux_sparsity_pattern(dof_handler,
+ dsp,
+ cell_coupling,
+ face_coupling);
constraints.condense(dsp);
sparsity_pattern.copy_from(dsp);
}
const QGauss<dim - 1> common_face_quadrature(
std::max(stokes_degree + 2, elasticity_degree + 2));
- FEFaceValues<dim> stokes_fe_face_values(
- stokes_fe,
- common_face_quadrature,
- update_JxW_values | update_normal_vectors | update_gradients);
- FEFaceValues<dim> elasticity_fe_face_values(
- elasticity_fe, common_face_quadrature, update_values);
- FESubfaceValues<dim> stokes_fe_subface_values(
- stokes_fe,
- common_face_quadrature,
- update_JxW_values | update_normal_vectors | update_gradients);
- FESubfaceValues<dim> elasticity_fe_subface_values(
- elasticity_fe, common_face_quadrature, update_values);
+ FEFaceValues<dim> stokes_fe_face_values(stokes_fe,
+ common_face_quadrature,
+ update_JxW_values |
+ update_normal_vectors |
+ update_gradients);
+ FEFaceValues<dim> elasticity_fe_face_values(elasticity_fe,
+ common_face_quadrature,
+ update_values);
+ FESubfaceValues<dim> stokes_fe_subface_values(stokes_fe,
+ common_face_quadrature,
+ update_JxW_values |
+ update_normal_vectors |
+ update_gradients);
+ FESubfaceValues<dim> elasticity_fe_subface_values(elasticity_fe,
+ common_face_quadrature,
+ update_values);
// ...to objects that are needed to describe the local contributions to
// the global linear system...
face_q_collection.push_back(elasticity_face_quadrature);
const FEValuesExtractors::Vector velocities(0);
- KellyErrorEstimator<dim>::estimate(
- dof_handler,
- face_q_collection,
- typename FunctionMap<dim>::type(),
- solution,
- stokes_estimated_error_per_cell,
- fe_collection.component_mask(velocities));
+ KellyErrorEstimator<dim>::estimate(dof_handler,
+ face_q_collection,
+ typename FunctionMap<dim>::type(),
+ solution,
+ stokes_estimated_error_per_cell,
+ fe_collection.component_mask(
+ velocities));
const FEValuesExtractors::Vector displacements(dim + 1);
- KellyErrorEstimator<dim>::estimate(
- dof_handler,
- face_q_collection,
- typename FunctionMap<dim>::type(),
- solution,
- elasticity_estimated_error_per_cell,
- fe_collection.component_mask(displacements));
+ KellyErrorEstimator<dim>::estimate(dof_handler,
+ face_q_collection,
+ typename FunctionMap<dim>::type(),
+ solution,
+ elasticity_estimated_error_per_cell,
+ fe_collection.component_mask(
+ displacements));
// We then normalize error estimates by dividing by their norm and scale
// the fluid error indicators by a factor of 4 as discussed in the
estimated_error_per_cell(cell->active_cell_index()) = 0;
}
- GridRefinement::refine_and_coarsen_fixed_number(
- triangulation, estimated_error_per_cell, 0.3, 0.0);
+ GridRefinement::refine_and_coarsen_fixed_number(triangulation,
+ estimated_error_per_cell,
+ 0.3,
+ 0.0);
triangulation.execute_coarsening_and_refinement();
}
template <int dim, int fe_degree>
SineGordonOperation<dim, fe_degree>::SineGordonOperation(
const MatrixFree<dim, double> &data_in,
- const double time_step) :
- data(data_in),
- delta_t_sqr(make_vectorized_array(time_step * time_step))
+ const double time_step)
+ : data(data_in)
+ , delta_t_sqr(make_vectorized_array(time_step * time_step))
{
VectorizedArray<double> one = make_vectorized_array(1.);
const std::vector<LinearAlgebra::distributed::Vector<double> *> &src) const
{
dst = 0;
- data.cell_loop(
- &SineGordonOperation<dim, fe_degree>::local_apply, this, dst, src);
+ data.cell_loop(&SineGordonOperation<dim, fe_degree>::local_apply,
+ this,
+ dst,
+ src);
dst.scale(inv_mass_matrix);
}
class ExactSolution : public Function<dim>
{
public:
- ExactSolution(const unsigned int n_components = 1, const double time = 0.) :
- Function<dim>(n_components, time)
+ ExactSolution(const unsigned int n_components = 1, const double time = 0.)
+ : Function<dim>(n_components, time)
{}
virtual double value(const Point<dim> & p,
const unsigned int component = 0) const override;
// conditioning versus equidistant points. To make things more explicit, we
// choose to state the selection of the nodal points nonetheless.
template <int dim>
- SineGordonProblem<dim>::SineGordonProblem() :
- pcout(std::cout, Utilities::MPI::this_mpi_process(MPI_COMM_WORLD) == 0),
+ SineGordonProblem<dim>::SineGordonProblem()
+ : pcout(std::cout, Utilities::MPI::this_mpi_process(MPI_COMM_WORLD) == 0)
+ ,
#ifdef DEAL_II_WITH_P4EST
- triangulation(MPI_COMM_WORLD),
+ triangulation(MPI_COMM_WORLD)
+ ,
#endif
- fe(QGaussLobatto<1>(fe_degree + 1)),
- dof_handler(triangulation),
- n_global_refinements(10 - 2 * dim),
- time(-10),
- time_step(10.),
- final_time(10),
- cfl_number(.1 / fe_degree),
- output_timestep_skip(200)
+ fe(QGaussLobatto<1>(fe_degree + 1))
+ , dof_handler(triangulation)
+ , n_global_refinements(10 - 2 * dim)
+ , time(-10)
+ , time_step(10.)
+ , final_time(10)
+ , cfl_number(.1 / fe_degree)
+ , output_timestep_skip(200)
{}
//@sect4{SineGordonProblem::make_grid_and_dofs}
additional_data.tasks_parallel_scheme =
MatrixFree<dim>::AdditionalData::partition_partition;
- matrix_free_data.reinit(
- dof_handler, constraints, quadrature, additional_data);
+ matrix_free_data.reinit(dof_handler,
+ constraints,
+ quadrature,
+ additional_data);
matrix_free_data.initialize_dof_vector(solution);
old_solution.reinit(solution);
norm_per_cell,
QGauss<dim>(fe_degree + 1),
VectorTools::L2_norm);
- const double solution_norm = VectorTools::compute_global_error(
- triangulation, norm_per_cell, VectorTools::L2_norm);
+ const double solution_norm =
+ VectorTools::compute_global_error(triangulation,
+ norm_per_cell,
+ VectorTools::L2_norm);
pcout << " Time:" << std::setw(8) << std::setprecision(3) << time
<< ", solution norm: " << std::setprecision(5) << std::setw(7)
// the two starting solutions in a <tt>std::vector</tt> of pointers field
// and to set up an instance of the <code> SineGordonOperation class </code>
// based on the finite element degree specified at the top of this file.
- VectorTools::interpolate(
- dof_handler, ExactSolution<dim>(1, time), solution);
- VectorTools::interpolate(
- dof_handler, ExactSolution<dim>(1, time - time_step), old_solution);
+ VectorTools::interpolate(dof_handler,
+ ExactSolution<dim>(1, time),
+ solution);
+ VectorTools::interpolate(dof_handler,
+ ExactSolution<dim>(1, time - time_step),
+ old_solution);
output_results(0);
std::vector<LinearAlgebra::distributed::Vector<double> *>
std::vector<unsigned int> repetitions(2);
repetitions[0] = 3;
repetitions[1] = 2;
- GridGenerator::subdivided_hyper_rectangle(
- tria2, repetitions, Point<2>(1.0, -1.0), Point<2>(4.0, 1.0));
+ GridGenerator::subdivided_hyper_rectangle(tria2,
+ repetitions,
+ Point<2>(1.0, -1.0),
+ Point<2>(4.0, 1.0));
Triangulation<2> triangulation;
GridGenerator::merge_triangulations(tria1, tria2, triangulation);
std::vector<unsigned int> repetitions(2);
repetitions[0] = 14;
repetitions[1] = 2;
- GridGenerator::subdivided_hyper_rectangle(
- triangulation, repetitions, Point<2>(0.0, 0.0), Point<2>(10.0, 1.0));
+ GridGenerator::subdivided_hyper_rectangle(triangulation,
+ repetitions,
+ Point<2>(0.0, 0.0),
+ Point<2>(10.0, 1.0));
GridTools::transform(
[](const Point<2> &in) -> Point<2> {
Triangulation<2> triangulation;
std::vector<unsigned int> repetitions(2);
repetitions[0] = repetitions[1] = 40;
- GridGenerator::subdivided_hyper_rectangle(
- triangulation, repetitions, Point<2>(0.0, 0.0), Point<2>(1.0, 1.0));
+ GridGenerator::subdivided_hyper_rectangle(triangulation,
+ repetitions,
+ Point<2>(0.0, 0.0),
+ Point<2>(1.0, 1.0));
GridTools::transform(Grid6Func(), triangulation);
print_mesh_info(triangulation, "grid-6.eps");
Triangulation<2> triangulation;
std::vector<unsigned int> repetitions(2);
repetitions[0] = repetitions[1] = 16;
- GridGenerator::subdivided_hyper_rectangle(
- triangulation, repetitions, Point<2>(0.0, 0.0), Point<2>(1.0, 1.0));
+ GridGenerator::subdivided_hyper_rectangle(triangulation,
+ repetitions,
+ Point<2>(0.0, 0.0),
+ Point<2>(1.0, 1.0));
GridTools::distort_random(0.3, triangulation, true);
print_mesh_info(triangulation, "grid-7.eps");
// This function is as before.
template <int dim>
-Step5<dim>::Step5() : fe(1), dof_handler(triangulation)
+Step5<dim>::Step5()
+ : fe(1)
+ , dof_handler(triangulation)
{}
for (unsigned int i = 0; i < dofs_per_cell; ++i)
{
for (unsigned int j = 0; j < dofs_per_cell; ++j)
- system_matrix.add(
- local_dof_indices[i], local_dof_indices[j], cell_matrix(i, j));
+ system_matrix.add(local_dof_indices[i],
+ local_dof_indices[j],
+ cell_matrix(i, j));
system_rhs(local_dof_indices[i]) += cell_rhs(i);
}
// With the matrix so built, we use zero boundary values again:
std::map<types::global_dof_index, double> boundary_values;
- VectorTools::interpolate_boundary_values(
- dof_handler, 0, Functions::ZeroFunction<dim>(), boundary_values);
- MatrixTools::apply_boundary_values(
- boundary_values, system_matrix, solution, system_rhs);
+ VectorTools::interpolate_boundary_values(dof_handler,
+ 0,
+ Functions::ZeroFunction<dim>(),
+ boundary_values);
+ MatrixTools::apply_boundary_values(boundary_values,
+ system_matrix,
+ solution,
+ system_rhs);
}
class Coefficient : public Function<dim>
{
public:
- Coefficient() : Function<dim>()
+ Coefficient()
+ : Function<dim>()
{}
virtual double value(const Point<dim> & p,
// flag to the constructor of the
// triangulation class.
template <int dim>
- LaplaceProblem<dim>::LaplaceProblem(const unsigned int degree) :
- pcout(std::cout, (Utilities::MPI::this_mpi_process(MPI_COMM_WORLD) == 0)),
- triangulation(
- MPI_COMM_WORLD,
- Triangulation<dim>::limit_level_difference_at_vertices,
- parallel::distributed::Triangulation<dim>::construct_multigrid_hierarchy),
- fe(degree),
- mg_dof_handler(triangulation),
- degree(degree)
+ LaplaceProblem<dim>::LaplaceProblem(const unsigned int degree)
+ : pcout(std::cout, (Utilities::MPI::this_mpi_process(MPI_COMM_WORLD) == 0))
+ , triangulation(MPI_COMM_WORLD,
+ Triangulation<dim>::limit_level_difference_at_vertices,
+ parallel::distributed::Triangulation<
+ dim>::construct_multigrid_hierarchy)
+ , fe(degree)
+ , mg_dof_handler(triangulation)
+ , degree(degree)
{}
Functions::ConstantFunction<dim> homogeneous_dirichlet_bc(1.0);
dirichlet_boundary_ids.insert(0);
dirichlet_boundary[0] = &homogeneous_dirichlet_bc;
- VectorTools::interpolate_boundary_values(
- mg_dof_handler, dirichlet_boundary, constraints);
+ VectorTools::interpolate_boundary_values(mg_dof_handler,
+ dirichlet_boundary,
+ constraints);
constraints.close();
DynamicSparsityPattern dsp(mg_dof_handler.n_dofs(),
mg_dof_handler.n_dofs());
DoFTools::make_sparsity_pattern(mg_dof_handler, dsp, constraints);
- system_matrix.reinit(
- mg_dof_handler.locally_owned_dofs(), dsp, MPI_COMM_WORLD, true);
+ system_matrix.reinit(mg_dof_handler.locally_owned_dofs(),
+ dsp,
+ MPI_COMM_WORLD,
+ true);
// The multigrid constraints have to be
++level)
{
IndexSet dofset;
- DoFTools::extract_locally_relevant_level_dofs(
- mg_dof_handler, level, dofset);
+ DoFTools::extract_locally_relevant_level_dofs(mg_dof_handler,
+ level,
+ dofset);
boundary_constraints[level].reinit(dofset);
boundary_constraints[level].add_lines(
mg_constrained_dofs.get_refinement_edge_indices(level));
temp_solution.reinit(locally_relevant_set, MPI_COMM_WORLD);
temp_solution = solution;
- KellyErrorEstimator<dim>::estimate(
- static_cast<DoFHandler<dim> &>(mg_dof_handler),
- QGauss<dim - 1>(degree + 1),
- typename FunctionMap<dim>::type(),
- temp_solution,
- estimated_error_per_cell);
+ KellyErrorEstimator<dim>::estimate(static_cast<DoFHandler<dim> &>(
+ mg_dof_handler),
+ QGauss<dim - 1>(degree + 1),
+ typename FunctionMap<dim>::type(),
+ temp_solution,
+ estimated_error_per_cell);
parallel::distributed::GridRefinement::refine_and_coarsen_fixed_fraction(
triangulation, estimated_error_per_cell, 0.3, 0.0);
template <>
const Point<1>
- SolutionBase<1>::source_centers[SolutionBase<1>::n_source_centers] = {
- Point<1>(-1.0 / 3.0),
- Point<1>(0.0),
- Point<1>(+1.0 / 3.0)};
+ SolutionBase<1>::source_centers[SolutionBase<1>::n_source_centers] =
+ {Point<1>(-1.0 / 3.0), Point<1>(0.0), Point<1>(+1.0 / 3.0)};
template <>
const Point<2>
- SolutionBase<2>::source_centers[SolutionBase<2>::n_source_centers] = {
- Point<2>(-0.5, +0.5),
- Point<2>(-0.5, -0.5),
- Point<2>(+0.5, -0.5)};
+ SolutionBase<2>::source_centers[SolutionBase<2>::n_source_centers] =
+ {Point<2>(-0.5, +0.5), Point<2>(-0.5, -0.5), Point<2>(+0.5, -0.5)};
template <>
const Point<3>
class Solution : public Function<dim>, protected SolutionBase<dim>
{
public:
- Solution() : Function<dim>()
+ Solution()
+ : Function<dim>()
{}
virtual double value(const Point<dim> & p,
class SolutionAndGradient : public Function<dim>, protected SolutionBase<dim>
{
public:
- SolutionAndGradient() : Function<dim>(dim)
+ SolutionAndGradient()
+ : Function<dim>(dim)
{}
virtual void vector_value(const Point<dim> &p,
class ConvectionVelocity : public TensorFunction<1, dim>
{
public:
- ConvectionVelocity() : TensorFunction<1, dim>()
+ ConvectionVelocity()
+ : TensorFunction<1, dim>()
{}
virtual Tensor<1, dim> value(const Point<dim> &p) const override;
class RightHandSide : public Function<dim>, protected SolutionBase<dim>
{
public:
- RightHandSide() : Function<dim>()
+ RightHandSide()
+ : Function<dim>()
{}
virtual double value(const Point<dim> & p,
// elements for the local DG part, including the gradient/flux part and the
// scalar part.
template <int dim>
- HDG<dim>::HDG(const unsigned int degree,
- const RefinementMode refinement_mode) :
- fe_local(FE_DGQ<dim>(degree), dim, FE_DGQ<dim>(degree), 1),
- dof_handler_local(triangulation),
- fe(degree),
- dof_handler(triangulation),
- fe_u_post(degree + 1),
- dof_handler_u_post(triangulation),
- refinement_mode(refinement_mode)
+ HDG<dim>::HDG(const unsigned int degree, const RefinementMode refinement_mode)
+ : fe_local(FE_DGQ<dim>(degree), dim, FE_DGQ<dim>(degree), 1)
+ , dof_handler_local(triangulation)
+ , fe(degree)
+ , dof_handler(triangulation)
+ , fe_u_post(degree + 1)
+ , dof_handler_u_post(triangulation)
+ , refinement_mode(refinement_mode)
{}
bool trace_reconstruct;
- PerTaskData(const unsigned int n_dofs, const bool trace_reconstruct) :
- cell_matrix(n_dofs, n_dofs),
- cell_vector(n_dofs),
- dof_indices(n_dofs),
- trace_reconstruct(trace_reconstruct)
+ PerTaskData(const unsigned int n_dofs, const bool trace_reconstruct)
+ : cell_matrix(n_dofs, n_dofs)
+ , cell_vector(n_dofs)
+ , dof_indices(n_dofs)
+ , trace_reconstruct(trace_reconstruct)
{}
};
const QGauss<dim - 1> & face_quadrature_formula,
const UpdateFlags local_flags,
const UpdateFlags local_face_flags,
- const UpdateFlags flags) :
- fe_values_local(fe_local, quadrature_formula, local_flags),
- fe_face_values_local(fe_local, face_quadrature_formula, local_face_flags),
- fe_face_values(fe, face_quadrature_formula, flags),
- ll_matrix(fe_local.dofs_per_cell, fe_local.dofs_per_cell),
- lf_matrix(fe_local.dofs_per_cell, fe.dofs_per_cell),
- fl_matrix(fe.dofs_per_cell, fe_local.dofs_per_cell),
- tmp_matrix(fe.dofs_per_cell, fe_local.dofs_per_cell),
- l_rhs(fe_local.dofs_per_cell),
- tmp_rhs(fe_local.dofs_per_cell),
- q_phi(fe_local.dofs_per_cell),
- q_phi_div(fe_local.dofs_per_cell),
- u_phi(fe_local.dofs_per_cell),
- u_phi_grad(fe_local.dofs_per_cell),
- tr_phi(fe.dofs_per_cell),
- trace_values(face_quadrature_formula.size()),
- fe_local_support_on_face(GeometryInfo<dim>::faces_per_cell),
- fe_support_on_face(GeometryInfo<dim>::faces_per_cell)
+ const UpdateFlags flags)
+ : fe_values_local(fe_local, quadrature_formula, local_flags)
+ , fe_face_values_local(fe_local,
+ face_quadrature_formula,
+ local_face_flags)
+ , fe_face_values(fe, face_quadrature_formula, flags)
+ , ll_matrix(fe_local.dofs_per_cell, fe_local.dofs_per_cell)
+ , lf_matrix(fe_local.dofs_per_cell, fe.dofs_per_cell)
+ , fl_matrix(fe.dofs_per_cell, fe_local.dofs_per_cell)
+ , tmp_matrix(fe.dofs_per_cell, fe_local.dofs_per_cell)
+ , l_rhs(fe_local.dofs_per_cell)
+ , tmp_rhs(fe_local.dofs_per_cell)
+ , q_phi(fe_local.dofs_per_cell)
+ , q_phi_div(fe_local.dofs_per_cell)
+ , u_phi(fe_local.dofs_per_cell)
+ , u_phi_grad(fe_local.dofs_per_cell)
+ , tr_phi(fe.dofs_per_cell)
+ , trace_values(face_quadrature_formula.size())
+ , fe_local_support_on_face(GeometryInfo<dim>::faces_per_cell)
+ , fe_support_on_face(GeometryInfo<dim>::faces_per_cell)
{
for (unsigned int face = 0; face < GeometryInfo<dim>::faces_per_cell;
++face)
}
}
- ScratchData(const ScratchData &sd) :
- fe_values_local(sd.fe_values_local.get_fe(),
- sd.fe_values_local.get_quadrature(),
- sd.fe_values_local.get_update_flags()),
- fe_face_values_local(sd.fe_face_values_local.get_fe(),
- sd.fe_face_values_local.get_quadrature(),
- sd.fe_face_values_local.get_update_flags()),
- fe_face_values(sd.fe_face_values.get_fe(),
- sd.fe_face_values.get_quadrature(),
- sd.fe_face_values.get_update_flags()),
- ll_matrix(sd.ll_matrix),
- lf_matrix(sd.lf_matrix),
- fl_matrix(sd.fl_matrix),
- tmp_matrix(sd.tmp_matrix),
- l_rhs(sd.l_rhs),
- tmp_rhs(sd.tmp_rhs),
- q_phi(sd.q_phi),
- q_phi_div(sd.q_phi_div),
- u_phi(sd.u_phi),
- u_phi_grad(sd.u_phi_grad),
- tr_phi(sd.tr_phi),
- trace_values(sd.trace_values),
- fe_local_support_on_face(sd.fe_local_support_on_face),
- fe_support_on_face(sd.fe_support_on_face)
+ ScratchData(const ScratchData &sd)
+ : fe_values_local(sd.fe_values_local.get_fe(),
+ sd.fe_values_local.get_quadrature(),
+ sd.fe_values_local.get_update_flags())
+ , fe_face_values_local(sd.fe_face_values_local.get_fe(),
+ sd.fe_face_values_local.get_quadrature(),
+ sd.fe_face_values_local.get_update_flags())
+ , fe_face_values(sd.fe_face_values.get_fe(),
+ sd.fe_face_values.get_quadrature(),
+ sd.fe_face_values.get_update_flags())
+ , ll_matrix(sd.ll_matrix)
+ , lf_matrix(sd.lf_matrix)
+ , fl_matrix(sd.fl_matrix)
+ , tmp_matrix(sd.tmp_matrix)
+ , l_rhs(sd.l_rhs)
+ , tmp_rhs(sd.tmp_rhs)
+ , q_phi(sd.q_phi)
+ , q_phi_div(sd.q_phi_div)
+ , u_phi(sd.u_phi)
+ , u_phi_grad(sd.u_phi_grad)
+ , tr_phi(sd.tr_phi)
+ , trace_values(sd.trace_values)
+ , fe_local_support_on_face(sd.fe_local_support_on_face)
+ , fe_support_on_face(sd.fe_support_on_face)
{}
};
const FiniteElement<dim> &fe_local,
const QGauss<dim> & quadrature_formula,
const UpdateFlags local_flags,
- const UpdateFlags flags) :
- fe_values_local(fe_local, quadrature_formula, local_flags),
- fe_values(fe, quadrature_formula, flags),
- u_values(quadrature_formula.size()),
- u_gradients(quadrature_formula.size()),
- cell_matrix(fe.dofs_per_cell, fe.dofs_per_cell),
- cell_rhs(fe.dofs_per_cell),
- cell_sol(fe.dofs_per_cell)
+ const UpdateFlags flags)
+ : fe_values_local(fe_local, quadrature_formula, local_flags)
+ , fe_values(fe, quadrature_formula, flags)
+ , u_values(quadrature_formula.size())
+ , u_gradients(quadrature_formula.size())
+ , cell_matrix(fe.dofs_per_cell, fe.dofs_per_cell)
+ , cell_rhs(fe.dofs_per_cell)
+ , cell_sol(fe.dofs_per_cell)
{}
- PostProcessScratchData(const PostProcessScratchData &sd) :
- fe_values_local(sd.fe_values_local.get_fe(),
- sd.fe_values_local.get_quadrature(),
- sd.fe_values_local.get_update_flags()),
- fe_values(sd.fe_values.get_fe(),
- sd.fe_values.get_quadrature(),
- sd.fe_values.get_update_flags()),
- u_values(sd.u_values),
- u_gradients(sd.u_gradients),
- cell_matrix(sd.cell_matrix),
- cell_rhs(sd.cell_rhs),
- cell_sol(sd.cell_sol)
+ PostProcessScratchData(const PostProcessScratchData &sd)
+ : fe_values_local(sd.fe_values_local.get_fe(),
+ sd.fe_values_local.get_quadrature(),
+ sd.fe_values_local.get_update_flags())
+ , fe_values(sd.fe_values.get_fe(),
+ sd.fe_values.get_quadrature(),
+ sd.fe_values.get_update_flags())
+ , u_values(sd.u_values)
+ , u_gradients(sd.u_gradients)
+ , cell_matrix(sd.cell_matrix)
+ , cell_rhs(sd.cell_rhs)
+ , cell_sol(sd.cell_sol)
{}
};
PerTaskData & task_data)
{
// Construct iterator for dof_handler_local for FEValues reinit function.
- typename DoFHandler<dim>::active_cell_iterator loc_cell(
- &triangulation, cell->level(), cell->index(), &dof_handler_local);
+ typename DoFHandler<dim>::active_cell_iterator loc_cell(&triangulation,
+ cell->level(),
+ cell->index(),
+ &dof_handler_local);
const unsigned int n_q_points =
scratch.fe_values_local.get_quadrature().size();
{
scratch.fl_matrix.mmult(scratch.tmp_matrix, scratch.ll_matrix);
scratch.tmp_matrix.vmult_add(task_data.cell_vector, scratch.l_rhs);
- scratch.tmp_matrix.mmult(
- task_data.cell_matrix, scratch.lf_matrix, true);
+ scratch.tmp_matrix.mmult(task_data.cell_matrix,
+ scratch.lf_matrix,
+ true);
cell->get_dof_indices(task_data.dof_indices);
}
// For (2), we are simply solving (ll_matrix).(solution_local) = (l_rhs).
QGauss<dim>(fe.degree + 2),
VectorTools::L2_norm,
&value_select);
- const double L2_error = VectorTools::compute_global_error(
- triangulation, difference_per_cell, VectorTools::L2_norm);
+ const double L2_error =
+ VectorTools::compute_global_error(triangulation,
+ difference_per_cell,
+ VectorTools::L2_norm);
ComponentSelectFunction<dim> gradient_select(
std::pair<unsigned int, unsigned int>(0, dim), dim + 1);
QGauss<dim>(fe.degree + 2),
VectorTools::L2_norm,
&gradient_select);
- const double grad_error = VectorTools::compute_global_error(
- triangulation, difference_per_cell, VectorTools::L2_norm);
+ const double grad_error =
+ VectorTools::compute_global_error(triangulation,
+ difference_per_cell,
+ VectorTools::L2_norm);
VectorTools::integrate_difference(dof_handler_u_post,
solution_u_post,
difference_per_cell,
QGauss<dim>(fe.degree + 3),
VectorTools::L2_norm);
- const double post_error = VectorTools::compute_global_error(
- triangulation, difference_per_cell, VectorTools::L2_norm);
+ const double post_error =
+ VectorTools::compute_global_error(triangulation,
+ difference_per_cell,
+ VectorTools::L2_norm);
convergence_table.add_value("cells", triangulation.n_active_cells());
convergence_table.add_value("dofs", dof_handler.n_dofs());
PostProcessScratchData & scratch,
unsigned int &)
{
- typename DoFHandler<dim>::active_cell_iterator loc_cell(
- &triangulation, cell->level(), cell->index(), &dof_handler_local);
+ typename DoFHandler<dim>::active_cell_iterator loc_cell(&triangulation,
+ cell->level(),
+ cell->index(),
+ &dof_handler_local);
scratch.fe_values_local.reinit(loc_cell);
scratch.fe_values.reinit(cell);
dim + 1, DataComponentInterpretation::component_is_part_of_vector);
component_interpretation[dim] =
DataComponentInterpretation::component_is_scalar;
- data_out.add_data_vector(
- dof_handler_local, solution_local, names, component_interpretation);
+ data_out.add_data_vector(dof_handler_local,
+ solution_local,
+ names,
+ component_interpretation);
// The second data item we add is the post-processed solution.
// In this case, it is a single scalar variable belonging to
std::vector<std::string> post_name(1, "u_post");
std::vector<DataComponentInterpretation::DataComponentInterpretation>
post_comp_type(1, DataComponentInterpretation::component_is_scalar);
- data_out.add_data_vector(
- dof_handler_u_post, solution_u_post, post_name, post_comp_type);
+ data_out.add_data_vector(dof_handler_u_post,
+ solution_u_post,
+ post_name,
+ post_comp_type);
data_out.build_patches(fe.degree);
data_out.write_vtk(output);
std::vector<DataComponentInterpretation::DataComponentInterpretation>
face_component_type(1, DataComponentInterpretation::component_is_scalar);
- data_out_face.add_data_vector(
- dof_handler, solution, face_name, face_component_type);
+ data_out_face.add_data_vector(dof_handler,
+ solution,
+ face_name,
+ face_component_type);
data_out_face.build_patches(fe.degree);
data_out_face.write_vtk(face_output);
case global_refinement:
{
triangulation.clear();
- GridGenerator::subdivided_hyper_cube(
- triangulation, 2 + (cycle % 2), -1, 1);
+ GridGenerator::subdivided_hyper_cube(triangulation,
+ 2 + (cycle % 2),
+ -1,
+ 1);
triangulation.refine_global(3 - dim + cycle / 2);
break;
}
FEValuesExtractors::Scalar scalar(dim);
typename FunctionMap<dim>::type neumann_boundary;
- KellyErrorEstimator<dim>::estimate(
- dof_handler_local,
- QGauss<dim - 1>(3),
- neumann_boundary,
- solution_local,
- estimated_error_per_cell,
- fe_local.component_mask(scalar));
+ KellyErrorEstimator<dim>::estimate(dof_handler_local,
+ QGauss<dim - 1>(3),
+ neumann_boundary,
+ solution_local,
+ estimated_error_per_cell,
+ fe_local.component_mask(
+ scalar));
GridRefinement::refine_and_coarsen_fixed_number(
triangulation, estimated_error_per_cell, 0.3, 0.);
// We choose quadratic finite elements and we initialize the parameters.
- Diffusion::Diffusion() :
- fe_degree(2),
- diffusion_coefficient(1. / 30.),
- absorption_cross_section(1.),
- fe(fe_degree),
- dof_handler(triangulation)
+ Diffusion::Diffusion()
+ : fe_degree(2)
+ , diffusion_coefficient(1. / 30.)
+ , absorption_cross_section(1.)
+ , fe(fe_degree)
+ , dof_handler(triangulation)
{}
{
dof_handler.distribute_dofs(fe);
- VectorTools::interpolate_boundary_values(
- dof_handler, 1, Functions::ZeroFunction<2>(), constraint_matrix);
+ VectorTools::interpolate_boundary_values(dof_handler,
+ 1,
+ Functions::ZeroFunction<2>(),
+ constraint_matrix);
constraint_matrix.close();
DynamicSparsityPattern dsp(dof_handler.n_dofs());
cell->get_dof_indices(local_dof_indices);
- constraint_matrix.distribute_local_to_global(
- cell_matrix, local_dof_indices, system_matrix);
- constraint_matrix.distribute_local_to_global(
- cell_mass_matrix, local_dof_indices, mass_matrix);
+ constraint_matrix.distribute_local_to_global(cell_matrix,
+ local_dof_indices,
+ system_matrix);
+ constraint_matrix.distribute_local_to_global(cell_mass_matrix,
+ local_dof_indices,
+ mass_matrix);
}
inverse_mass_matrix.initialize(mass_matrix);
cell->get_dof_indices(local_dof_indices);
- constraint_matrix.distribute_local_to_global(
- cell_source, local_dof_indices, tmp);
+ constraint_matrix.distribute_local_to_global(cell_source,
+ local_dof_indices,
+ tmp);
}
Vector<double> value(dof_handler.n_dofs());
const double final_time = 10.;
std::cout << "Explicit methods:" << std::endl;
- explicit_method(
- TimeStepping::FORWARD_EULER, n_time_steps, initial_time, final_time);
+ explicit_method(TimeStepping::FORWARD_EULER,
+ n_time_steps,
+ initial_time,
+ final_time);
std::cout << "Forward Euler: error=" << solution.l2_norm()
<< std::endl;
- explicit_method(
- TimeStepping::RK_THIRD_ORDER, n_time_steps, initial_time, final_time);
+ explicit_method(TimeStepping::RK_THIRD_ORDER,
+ n_time_steps,
+ initial_time,
+ final_time);
std::cout << "Third order Runge-Kutta: error=" << solution.l2_norm()
<< std::endl;
std::cout << "Implicit methods:" << std::endl;
- implicit_method(
- TimeStepping::BACKWARD_EULER, n_time_steps, initial_time, final_time);
+ implicit_method(TimeStepping::BACKWARD_EULER,
+ n_time_steps,
+ initial_time,
+ final_time);
std::cout << "Backward Euler: error=" << solution.l2_norm()
<< std::endl;
- implicit_method(
- TimeStepping::IMPLICIT_MIDPOINT, n_time_steps, initial_time, final_time);
+ implicit_method(TimeStepping::IMPLICIT_MIDPOINT,
+ n_time_steps,
+ initial_time,
+ final_time);
std::cout << "Implicit Midpoint: error=" << solution.l2_norm()
<< std::endl;
- implicit_method(
- TimeStepping::CRANK_NICOLSON, n_time_steps, initial_time, final_time);
+ implicit_method(TimeStepping::CRANK_NICOLSON,
+ n_time_steps,
+ initial_time,
+ final_time);
std::cout << "Crank-Nicolson: error=" << solution.l2_norm()
<< std::endl;
- implicit_method(
- TimeStepping::SDIRK_TWO_STAGES, n_time_steps, initial_time, final_time);
+ implicit_method(TimeStepping::SDIRK_TWO_STAGES,
+ n_time_steps,
+ initial_time,
+ final_time);
std::cout << "SDIRK: error=" << solution.l2_norm()
<< std::endl;
std::cout << std::endl;
std::cout << "Embedded explicit methods:" << std::endl;
- n_steps = embedded_explicit_method(
- TimeStepping::HEUN_EULER, n_time_steps, initial_time, final_time);
+ n_steps = embedded_explicit_method(TimeStepping::HEUN_EULER,
+ n_time_steps,
+ initial_time,
+ final_time);
std::cout << "Heun-Euler: error=" << solution.l2_norm()
<< std::endl;
std::cout << " steps performed=" << n_steps << std::endl;
- n_steps = embedded_explicit_method(
- TimeStepping::BOGACKI_SHAMPINE, n_time_steps, initial_time, final_time);
+ n_steps = embedded_explicit_method(TimeStepping::BOGACKI_SHAMPINE,
+ n_time_steps,
+ initial_time,
+ final_time);
std::cout << "Bogacki-Shampine: error=" << solution.l2_norm()
<< std::endl;
std::cout << " steps performed=" << n_steps << std::endl;
- n_steps = embedded_explicit_method(
- TimeStepping::DOPRI, n_time_steps, initial_time, final_time);
+ n_steps = embedded_explicit_method(TimeStepping::DOPRI,
+ n_time_steps,
+ initial_time,
+ final_time);
std::cout << "Dopri: error=" << solution.l2_norm()
<< std::endl;
std::cout << " steps performed=" << n_steps << std::endl;
- n_steps = embedded_explicit_method(
- TimeStepping::FEHLBERG, n_time_steps, initial_time, final_time);
+ n_steps = embedded_explicit_method(TimeStepping::FEHLBERG,
+ n_time_steps,
+ initial_time,
+ final_time);
std::cout << "Fehlberg: error=" << solution.l2_norm()
<< std::endl;
std::cout << " steps performed=" << n_steps << std::endl;
- n_steps = embedded_explicit_method(
- TimeStepping::CASH_KARP, n_time_steps, initial_time, final_time);
+ n_steps = embedded_explicit_method(TimeStepping::CASH_KARP,
+ n_time_steps,
+ initial_time,
+ final_time);
std::cout << "Cash-Karp: error=" << solution.l2_norm()
<< std::endl;
std::cout << " steps performed=" << n_steps << std::endl;
// member functions we call here are static because (i) they do not
// access any member variables of the class, and (ii) because they are
// called at a time when the object is not initialized fully anyway.
- AfricaTopography::AfricaTopography() :
- topography_data(get_endpoints(),
- n_intervals(),
- Table<2, double>(380, 220, get_data().begin()))
+ AfricaTopography::AfricaTopography()
+ : topography_data(get_endpoints(),
+ n_intervals(),
+ Table<2, double>(380, 220, get_data().begin()))
{}
Point<3> AfricaGeometry::pull_back_wgs84(const Point<3> &x) const
{
- const double b = std::sqrt(R * R * (1 - ellipticity * ellipticity));
- const double ep = std::sqrt((R * R - b * b) / (b * b));
- const double p = std::sqrt(x(0) * x(0) + x(1) * x(1));
- const double th = std::atan2(R * x(2), b * p);
- const double phi = std::atan2(x(1), x(0));
- const double theta = std::atan2(
- x(2) + ep * ep * b * std::pow(std::sin(th), 3),
- (p - (ellipticity * ellipticity * R * std::pow(std::cos(th), 3))));
+ const double b = std::sqrt(R * R * (1 - ellipticity * ellipticity));
+ const double ep = std::sqrt((R * R - b * b) / (b * b));
+ const double p = std::sqrt(x(0) * x(0) + x(1) * x(1));
+ const double th = std::atan2(R * x(2), b * p);
+ const double phi = std::atan2(x(1), x(0));
+ const double theta =
+ std::atan2(x(2) + ep * ep * b * std::pow(std::sin(th), 3),
+ (p -
+ (ellipticity * ellipticity * R * std::pow(std::cos(th), 3))));
const double R_bar =
R / (std::sqrt(1 - ellipticity * ellipticity * std::sin(theta) *
std::sin(theta)));
const std::string & initial_mesh_filename,
const std::string & cad_file_name,
const std::string & output_filename,
- const ProjectionType surface_projection_kind) :
- initial_mesh_filename(initial_mesh_filename),
- cad_file_name(cad_file_name),
- output_filename(output_filename),
- surface_projection_kind(surface_projection_kind)
+ const ProjectionType surface_projection_kind)
+ : initial_mesh_filename(initial_mesh_filename)
+ , cad_file_name(cad_file_name)
+ , output_filename(output_filename)
+ , surface_projection_kind(surface_projection_kind)
{}
TriangulationOnCAD::~TriangulationOnCAD()
case DirectionalProjection:
{
OpenCASCADE::DirectionalProjectionBoundary<2, 3>
- directional_projector(
- bow_surface, Point<3>(0.0, 1.0, 0.0), tolerance);
+ directional_projector(bow_surface,
+ Point<3>(0.0, 1.0, 0.0),
+ tolerance);
tria.set_manifold(1, directional_projector);
break;
template <class Matrix, class Preconditioner>
InverseMatrix<Matrix, Preconditioner>::InverseMatrix(
const Matrix & m,
- const Preconditioner &preconditioner) :
- matrix(&m),
- preconditioner(preconditioner)
+ const Preconditioner &preconditioner)
+ : matrix(&m)
+ , preconditioner(preconditioner)
{}
template <class PreconditionerA, class PreconditionerS>
BlockDiagonalPreconditioner<PreconditionerA, PreconditionerS>::
BlockDiagonalPreconditioner(const PreconditionerA &preconditioner_A,
- const PreconditionerS &preconditioner_S) :
- preconditioner_A(preconditioner_A),
- preconditioner_S(preconditioner_S)
+ const PreconditionerS &preconditioner_S)
+ : preconditioner_A(preconditioner_A)
+ , preconditioner_S(preconditioner_S)
{}
class RightHandSide : public Function<dim>
{
public:
- RightHandSide() : Function<dim>(dim + 1)
+ RightHandSide()
+ : Function<dim>(dim + 1)
{}
virtual void vector_value(const Point<dim> &p,
class ExactSolution : public Function<dim>
{
public:
- ExactSolution() : Function<dim>(dim + 1)
+ ExactSolution()
+ : Function<dim>(dim + 1)
{}
virtual void vector_value(const Point<dim> &p,
template <int dim>
- StokesProblem<dim>::StokesProblem(unsigned int velocity_degree) :
- velocity_degree(velocity_degree),
- viscosity(0.1),
- mpi_communicator(MPI_COMM_WORLD),
- fe(FE_Q<dim>(velocity_degree), dim, FE_Q<dim>(velocity_degree - 1), 1),
- triangulation(mpi_communicator,
- typename Triangulation<dim>::MeshSmoothing(
- Triangulation<dim>::smoothing_on_refinement |
- Triangulation<dim>::smoothing_on_coarsening)),
- dof_handler(triangulation),
- pcout(std::cout, (Utilities::MPI::this_mpi_process(mpi_communicator) == 0)),
- computing_timer(mpi_communicator,
- pcout,
- TimerOutput::summary,
- TimerOutput::wall_times)
+ StokesProblem<dim>::StokesProblem(unsigned int velocity_degree)
+ : velocity_degree(velocity_degree)
+ , viscosity(0.1)
+ , mpi_communicator(MPI_COMM_WORLD)
+ , fe(FE_Q<dim>(velocity_degree), dim, FE_Q<dim>(velocity_degree - 1), 1)
+ , triangulation(mpi_communicator,
+ typename Triangulation<dim>::MeshSmoothing(
+ Triangulation<dim>::smoothing_on_refinement |
+ Triangulation<dim>::smoothing_on_coarsening))
+ , dof_handler(triangulation)
+ , pcout(std::cout,
+ (Utilities::MPI::this_mpi_process(mpi_communicator) == 0))
+ , computing_timer(mpi_communicator,
+ pcout,
+ TimerOutput::summary,
+ TimerOutput::wall_times)
{}
DoFRenumbering::component_wise(dof_handler, stokes_sub_blocks);
std::vector<types::global_dof_index> dofs_per_block(2);
- DoFTools::count_dofs_per_block(
- dof_handler, dofs_per_block, stokes_sub_blocks);
+ DoFTools::count_dofs_per_block(dof_handler,
+ dofs_per_block,
+ stokes_sub_blocks);
const unsigned int n_u = dofs_per_block[0], n_p = dofs_per_block[1];
// Finally, we construct the block vectors with the right sizes. The
// function call with two std::vector<IndexSet> will create a ghosted
// vector.
- locally_relevant_solution.reinit(
- owned_partitioning, relevant_partitioning, mpi_communicator);
+ locally_relevant_solution.reinit(owned_partitioning,
+ relevant_partitioning,
+ mpi_communicator);
system_rhs.reinit(owned_partitioning, mpi_communicator);
}
system_matrix,
system_rhs);
- constraints.distribute_local_to_global(
- cell_matrix2, local_dof_indices, preconditioner_matrix);
+ constraints.distribute_local_to_global(cell_matrix2,
+ local_dof_indices,
+ preconditioner_matrix);
}
system_matrix.compress(VectorOperation::add);
constraints.set_zero(distributed_solution);
- solver.solve(
- system_matrix, distributed_solution, system_rhs, preconditioner);
+ solver.solve(system_matrix,
+ distributed_solution,
+ system_rhs,
+ preconditioner);
pcout << " Solved in " << solver_control.last_step() << " iterations."
<< std::endl;
VectorTools::L2_norm,
&velocity_mask);
- const double error_u_l2 = VectorTools::compute_global_error(
- triangulation, cellwise_errors, VectorTools::L2_norm);
+ const double error_u_l2 =
+ VectorTools::compute_global_error(triangulation,
+ cellwise_errors,
+ VectorTools::L2_norm);
VectorTools::integrate_difference(dof_handler,
locally_relevant_solution,
VectorTools::L2_norm,
&pressure_mask);
- const double error_p_l2 = VectorTools::compute_global_error(
- triangulation, cellwise_errors, VectorTools::L2_norm);
+ const double error_p_l2 =
+ VectorTools::compute_global_error(triangulation,
+ cellwise_errors,
+ VectorTools::L2_norm);
pcout << "error: u_0: " << error_u_l2 << " p_0: " << error_p_l2
<< std::endl;
interpolated.reinit(owned_partitioning, MPI_COMM_WORLD);
VectorTools::interpolate(dof_handler, ExactSolution<dim>(), interpolated);
- LA::MPI::BlockVector interpolated_relevant(
- owned_partitioning, relevant_partitioning, MPI_COMM_WORLD);
+ LA::MPI::BlockVector interpolated_relevant(owned_partitioning,
+ relevant_partitioning,
+ MPI_COMM_WORLD);
interpolated_relevant = interpolated;
{
std::vector<std::string> solution_names(dim, "ref_u");
class Solution : public Function<dim>
{
public:
- Solution() : Function<dim>(dim + 1)
+ Solution()
+ : Function<dim>(dim + 1)
{}
virtual double value(const Point<dim> & p,
const unsigned int component = 0) const override;
class RightHandSide : public Function<dim>
{
public:
- RightHandSide() : Function<dim>(dim + 1)
+ RightHandSide()
+ : Function<dim>(dim + 1)
{}
virtual double value(const Point<dim> & p,
const SparseMatrix<double> & schur_complement_matrix,
const PreconditionerAType & preconditioner_A,
const PreconditionerSType & preconditioner_S,
- const bool do_solve_A) :
- n_iterations_A(0),
- n_iterations_S(0),
- system_matrix(system_matrix),
- schur_complement_matrix(schur_complement_matrix),
- preconditioner_A(preconditioner_A),
- preconditioner_S(preconditioner_S),
- do_solve_A(do_solve_A)
+ const bool do_solve_A)
+ : n_iterations_A(0)
+ , n_iterations_S(0)
+ , system_matrix(system_matrix)
+ , schur_complement_matrix(schur_complement_matrix)
+ , preconditioner_A(preconditioner_A)
+ , preconditioner_S(preconditioner_S)
+ , do_solve_A(do_solve_A)
{}
SolverCG<> cg(solver_control);
dst.block(1) = 0.0;
- cg.solve(
- schur_complement_matrix, dst.block(1), src.block(1), preconditioner_S);
+ cg.solve(schur_complement_matrix,
+ dst.block(1),
+ src.block(1),
+ preconditioner_S);
n_iterations_S += solver_control.last_step();
dst.block(1) *= -1.0;
SolverCG<> cg(solver_control);
dst.block(0) = 0.0;
- cg.solve(
- system_matrix.block(0, 0), dst.block(0), utmp, preconditioner_A);
+ cg.solve(system_matrix.block(0, 0),
+ dst.block(0),
+ utmp,
+ preconditioner_A);
n_iterations_A += solver_control.last_step();
}
template <int dim>
StokesProblem<dim>::StokesProblem(const unsigned int pressure_degree,
- SolverType::type solver_type) :
- pressure_degree(pressure_degree),
- solver_type(solver_type),
- triangulation(Triangulation<dim>::maximum_smoothing),
+ SolverType::type solver_type)
+ : pressure_degree(pressure_degree)
+ , solver_type(solver_type)
+ , triangulation(Triangulation<dim>::maximum_smoothing)
+ ,
// Finite element for the velocity only:
- velocity_fe(FE_Q<dim>(pressure_degree + 1), dim),
+ velocity_fe(FE_Q<dim>(pressure_degree + 1), dim)
+ ,
// Finite element for the whole system:
- fe(velocity_fe, 1, FE_Q<dim>(pressure_degree), 1),
- dof_handler(triangulation),
- velocity_dof_handler(triangulation),
- computing_timer(std::cout, TimerOutput::never, TimerOutput::wall_times)
+ fe(velocity_fe, 1, FE_Q<dim>(pressure_degree), 1)
+ , dof_handler(triangulation)
+ , velocity_dof_handler(triangulation)
+ , computing_timer(std::cout, TimerOutput::never, TimerOutput::wall_times)
{}
}
std::vector<types::global_dof_index> dofs_per_block(2);
- DoFTools::count_dofs_per_block(
- dof_handler, dofs_per_block, block_component);
+ DoFTools::count_dofs_per_block(dof_handler,
+ dofs_per_block,
+ block_component);
const unsigned int n_u = dofs_per_block[0], n_p = dofs_per_block[1];
{
VectorTools::L2_norm,
&velocity_mask);
- const double Velocity_L2_error = VectorTools::compute_global_error(
- triangulation, difference_per_cell, VectorTools::L2_norm);
+ const double Velocity_L2_error =
+ VectorTools::compute_global_error(triangulation,
+ difference_per_cell,
+ VectorTools::L2_norm);
VectorTools::integrate_difference(dof_handler,
solution,
VectorTools::L2_norm,
&pressure_mask);
- const double Pressure_L2_error = VectorTools::compute_global_error(
- triangulation, difference_per_cell, VectorTools::L2_norm);
+ const double Pressure_L2_error =
+ VectorTools::compute_global_error(triangulation,
+ difference_per_cell,
+ VectorTools::L2_norm);
VectorTools::integrate_difference(dof_handler,
solution,
VectorTools::H1_norm,
&velocity_mask);
- const double Velocity_H1_error = VectorTools::compute_global_error(
- triangulation, difference_per_cell, VectorTools::H1_norm);
+ const double Velocity_H1_error =
+ VectorTools::compute_global_error(triangulation,
+ difference_per_cell,
+ VectorTools::H1_norm);
std::cout << std::endl
<< " Velocity L2 Error: " << Velocity_L2_error << std::endl
class BoundaryValues : public Function<dim>
{
public:
- BoundaryValues() : Function<dim>(dim + 1)
+ BoundaryValues()
+ : Function<dim>(dim + 1)
{}
virtual double value(const Point<dim> & p,
const unsigned int component) const override;
double viscosity,
const BlockSparseMatrix<double> &S,
const SparseMatrix<double> & P,
- const PreconditionerMp & Mppreconditioner) :
- gamma(gamma),
- viscosity(viscosity),
- stokes_matrix(S),
- pressure_mass_matrix(P),
- mp_preconditioner(Mppreconditioner)
+ const PreconditionerMp & Mppreconditioner)
+ : gamma(gamma)
+ , viscosity(viscosity)
+ , stokes_matrix(S)
+ , pressure_mass_matrix(P)
+ , mp_preconditioner(Mppreconditioner)
{
A_inverse.initialize(stokes_matrix.block(0, 0));
}
SolverCG<> cg(solver_control);
dst.block(1) = 0.0;
- cg.solve(
- pressure_mass_matrix, dst.block(1), src.block(1), mp_preconditioner);
+ cg.solve(pressure_mass_matrix,
+ dst.block(1),
+ src.block(1),
+ mp_preconditioner);
dst.block(1) *= -(viscosity + gamma);
}
//
template <int dim>
- StationaryNavierStokes<dim>::StationaryNavierStokes(
- const unsigned int degree) :
- viscosity(1.0 / 7500.0),
- gamma(1.0),
- degree(degree),
- triangulation(Triangulation<dim>::maximum_smoothing),
- fe(FE_Q<dim>(degree + 1), dim, FE_Q<dim>(degree), 1),
- dof_handler(triangulation)
+ StationaryNavierStokes<dim>::StationaryNavierStokes(const unsigned int degree)
+ : viscosity(1.0 / 7500.0)
+ , gamma(1.0)
+ , degree(degree)
+ , triangulation(Triangulation<dim>::maximum_smoothing)
+ , fe(FE_Q<dim>(degree + 1), dim, FE_Q<dim>(degree), 1)
+ , dof_handler(triangulation)
{}
// @sect4{StationaryNavierStokes::setup_dofs}
DoFRenumbering::component_wise(dof_handler, block_component);
dofs_per_block.resize(2);
- DoFTools::count_dofs_per_block(
- dof_handler, dofs_per_block, block_component);
+ DoFTools::count_dofs_per_block(dof_handler,
+ dofs_per_block,
+ block_component);
unsigned int dof_u = dofs_per_block[0];
unsigned int dof_p = dofs_per_block[1];
zero_constraints.clear();
DoFTools::make_hanging_node_constraints(dof_handler, zero_constraints);
- VectorTools::interpolate_boundary_values(
- dof_handler,
- 0,
- Functions::ZeroFunction<dim>(dim + 1),
- zero_constraints,
- fe.component_mask(velocities));
+ VectorTools::interpolate_boundary_values(dof_handler,
+ 0,
+ Functions::ZeroFunction<dim>(
+ dim + 1),
+ zero_constraints,
+ fe.component_mask(velocities));
}
zero_constraints.close();
}
else
{
- constraints_used.distribute_local_to_global(
- local_rhs, local_dof_indices, system_rhs);
+ constraints_used.distribute_local_to_global(local_rhs,
+ local_dof_indices,
+ system_rhs);
}
}
const ConstraintMatrix &constraints_used =
initial_step ? nonzero_constraints : zero_constraints;
- SolverControl solver_control(
- system_matrix.m(), 1e-4 * system_rhs.l2_norm(), true);
+ SolverControl solver_control(system_matrix.m(),
+ 1e-4 * system_rhs.l2_norm(),
+ true);
SolverFGMRES<BlockVector<double>> gmres(solver_control);
SparseILU<double> pmass_preconditioner;
estimated_error_per_cell,
fe.component_mask(velocity));
- GridRefinement::refine_and_coarsen_fixed_number(
- triangulation, estimated_error_per_cell, 0.3, 0.0);
+ GridRefinement::refine_and_coarsen_fixed_number(triangulation,
+ estimated_error_per_cell,
+ 0.3,
+ 0.0);
triangulation.prepare_coarsening_and_refinement();
SolutionTransfer<dim, BlockVector<double>> solution_transfer(dof_handler);
class Solution : public Function<dim>
{
public:
- Solution() : Function<dim>()
+ Solution()
+ : Function<dim>()
{}
virtual double value(const Point<dim> &p,
class RightHandSide : public Function<dim>
{
public:
- RightHandSide() : Function<dim>()
+ RightHandSide()
+ : Function<dim>()
{}
virtual double value(const Point<dim> &p,
template <int dim, int fe_degree>
- LaplaceProblem<dim, fe_degree>::LaplaceProblem() :
+ LaplaceProblem<dim, fe_degree>::LaplaceProblem()
+ :
#ifdef DEAL_II_WITH_P4EST
triangulation(
MPI_COMM_WORLD,
Triangulation<dim>::limit_level_difference_at_vertices,
- parallel::distributed::Triangulation<dim>::construct_multigrid_hierarchy),
+ parallel::distributed::Triangulation<dim>::construct_multigrid_hierarchy)
+ ,
#else
- triangulation(Triangulation<dim>::limit_level_difference_at_vertices),
+ triangulation(Triangulation<dim>::limit_level_difference_at_vertices)
+ ,
#endif
- fe(fe_degree),
- dof_handler(triangulation),
- setup_time(0.),
- pcout(std::cout, Utilities::MPI::this_mpi_process(MPI_COMM_WORLD) == 0),
- time_details(std::cout,
- false && Utilities::MPI::this_mpi_process(MPI_COMM_WORLD) == 0)
+ fe(fe_degree)
+ , dof_handler(triangulation)
+ , setup_time(0.)
+ , pcout(std::cout, Utilities::MPI::this_mpi_process(MPI_COMM_WORLD) == 0)
+ , time_details(std::cout,
+ false &&
+ Utilities::MPI::this_mpi_process(MPI_COMM_WORLD) == 0)
{}
update_quadrature_points);
std::shared_ptr<MatrixFree<dim, double>> system_mf_storage(
new MatrixFree<dim, double>());
- system_mf_storage->reinit(
- dof_handler, dummy, QGauss<1>(fe.degree + 1), additional_data);
+ system_mf_storage->reinit(dof_handler,
+ dummy,
+ QGauss<1>(fe.degree + 1),
+ additional_data);
system_matrix.initialize(system_mf_storage);
}
additional_data.level_mg_handler = level;
std::shared_ptr<MatrixFree<dim, float>> mg_mf_storage_level(
new MatrixFree<dim, float>());
- mg_mf_storage_level->reinit(
- dof_handler, dummy, QGauss<1>(fe.degree + 1), additional_data);
+ mg_mf_storage_level->reinit(dof_handler,
+ dummy,
+ QGauss<1>(fe.degree + 1),
+ additional_data);
mg_matrices[level].initialize(mg_mf_storage_level);
}
upper_right[0] = 2.5;
for (unsigned int d = 1; d < dim; ++d)
upper_right[d] = 2.8;
- GridGenerator::hyper_rectangle(
- triangulation, Point<dim>(), upper_right);
+ GridGenerator::hyper_rectangle(triangulation,
+ Point<dim>(),
+ upper_right);
triangulation.begin_active()->face(0)->set_boundary_id(10);
triangulation.begin_active()->face(1)->set_boundary_id(11);
triangulation.begin_active()->face(2)->set_boundary_id(0);
// constructor argument (which was <code>1</code> in all previous examples) by
// the desired polynomial degree (here <code>2</code>):
template <int dim>
-Step6<dim>::Step6() : fe(2), dof_handler(triangulation)
+Step6<dim>::Step6()
+ : fe(2)
+ , dof_handler(triangulation)
{}
// can add constraints to the ConstraintMatrix in either order: if two
// constraints conflict then the constraint matrix either abort or throw an
// exception via the Assert macro.
- VectorTools::interpolate_boundary_values(
- dof_handler, 0, Functions::ZeroFunction<dim>(), constraints);
+ VectorTools::interpolate_boundary_values(dof_handler,
+ 0,
+ Functions::ZeroFunction<dim>(),
+ constraints);
// After all constraints have been added, they need to be sorted and
// rearranged to perform some actions more efficiently. This postprocessing
// method described above. It is from a class that implements several
// different algorithms to refine a triangulation based on cell-wise error
// indicators.
- GridRefinement::refine_and_coarsen_fixed_number(
- triangulation, estimated_error_per_cell, 0.3, 0.03);
+ GridRefinement::refine_and_coarsen_fixed_number(triangulation,
+ estimated_error_per_cell,
+ 0.3,
+ 0.03);
// After the previous function has exited, some cells are flagged for
// refinement, and some other for coarsening. The refinement or coarsening
// `DistributedLagrangeProblem` for two different dimensions, without having
// conflicts in the parameters for the two problems.
template <int dim, int spacedim>
- DistributedLagrangeProblem<dim, spacedim>::Parameters::Parameters() :
- ParameterAcceptor("/Distributed Lagrange<" + Utilities::int_to_string(dim) +
- "," + Utilities::int_to_string(spacedim) + ">/")
+ DistributedLagrangeProblem<dim, spacedim>::Parameters::Parameters()
+ : ParameterAcceptor("/Distributed Lagrange<" +
+ Utilities::int_to_string(dim) + "," +
+ Utilities::int_to_string(spacedim) + ">/")
{
// The ParameterAcceptor::add_parameter() function does a few things:
//
// `ParameterAcceptorProxy` objects, as explained earlier.
template <int dim, int spacedim>
DistributedLagrangeProblem<dim, spacedim>::DistributedLagrangeProblem(
- const Parameters ¶meters) :
- parameters(parameters),
- embedded_configuration_function("Embedded configuration", spacedim),
- embedded_value_function("Embedded value"),
- schur_solver_control("Schur solver control"),
- monitor(std::cout, TimerOutput::summary, TimerOutput::cpu_and_wall_times)
+ const Parameters ¶meters)
+ : parameters(parameters)
+ , embedded_configuration_function("Embedded configuration", spacedim)
+ , embedded_value_function("Embedded value")
+ , schur_solver_control("Schur solver control")
+ , monitor(std::cout, TimerOutput::summary, TimerOutput::cpu_and_wall_times)
{
// Here is a way to set default values for a ParameterAcceptor class
// that was constructed using ParameterAcceptorProxy.
// This is precisely what the `embedded_mapping` is there for.
std::vector<Point<spacedim>> support_points(embedded_dh->n_dofs());
if (parameters.delta_refinement != 0)
- DoFTools::map_dofs_to_support_points(
- *embedded_mapping, *embedded_dh, support_points);
+ DoFTools::map_dofs_to_support_points(*embedded_mapping,
+ *embedded_dh,
+ support_points);
// Once we have the support points of the embedded finite element space, we
// would like to identify what cells of the embedding space contain what
// is not the case, we bail out with an exception.
for (unsigned int i = 0; i < parameters.delta_refinement; ++i)
{
- const auto point_locations = GridTools::compute_point_locations(
- *space_grid_tools_cache, support_points);
+ const auto point_locations =
+ GridTools::compute_point_locations(*space_grid_tools_cache,
+ support_points);
const auto &cells = std::get<0>(point_locations);
for (auto cell : cells)
{
embedding_space_minimal_diameter
<< std::endl;
- AssertThrow(
- embedded_space_maximal_diameter < embedding_space_minimal_diameter,
- ExcMessage("The embedding grid is too refined (or the embedded grid "
- "is too coarse). Adjust the parameters so that the minimal "
- "grid size of the embedding grid is larger "
- "than the maximal grid size of the embedded grid."));
+ AssertThrow(embedded_space_maximal_diameter <
+ embedding_space_minimal_diameter,
+ ExcMessage(
+ "The embedding grid is too refined (or the embedded grid "
+ "is too coarse). Adjust the parameters so that the minimal "
+ "grid size of the embedding grid is larger "
+ "than the maximal grid size of the embedded grid."));
// $\Omega$ has been refined and we can now set up its DoFs
setup_embedding_dofs();
TimerOutput::Scope timer_section(monitor, "Assemble system");
// Embedding stiffness matrix $K$, and the right hand side $G$.
- MatrixTools::create_laplace_matrix(
- *space_dh,
- QGauss<spacedim>(2 * space_fe->degree + 1),
- stiffness_matrix,
- (const Function<spacedim> *)nullptr,
- constraints);
-
- VectorTools::create_right_hand_side(
- *embedded_mapping,
- *embedded_dh,
- QGauss<dim>(2 * embedded_fe->degree + 1),
- embedded_value_function,
- embedded_rhs);
+ MatrixTools::create_laplace_matrix(*space_dh,
+ QGauss<spacedim>(2 * space_fe->degree +
+ 1),
+ stiffness_matrix,
+ (const Function<spacedim> *)nullptr,
+ constraints);
+
+ VectorTools::create_right_hand_side(*embedded_mapping,
+ *embedded_dh,
+ QGauss<dim>(2 * embedded_fe->degree +
+ 1),
+ embedded_value_function,
+ embedded_rhs);
}
{
TimerOutput::Scope timer_section(monitor, "Assemble coupling system");
// <code>dim</code>, but can immediately use the following definition:
template <>
const Point<1>
- SolutionBase<1>::source_centers[SolutionBase<1>::n_source_centers] = {
- Point<1>(-1.0 / 3.0),
- Point<1>(0.0),
- Point<1>(+1.0 / 3.0)};
+ SolutionBase<1>::source_centers[SolutionBase<1>::n_source_centers] =
+ {Point<1>(-1.0 / 3.0), Point<1>(0.0), Point<1>(+1.0 / 3.0)};
// Likewise, we can provide an explicit specialization for
// <code>dim=2</code>. We place the centers for the 2d case as follows:
template <>
const Point<2>
- SolutionBase<2>::source_centers[SolutionBase<2>::n_source_centers] = {
- Point<2>(-0.5, +0.5),
- Point<2>(-0.5, -0.5),
- Point<2>(+0.5, -0.5)};
+ SolutionBase<2>::source_centers[SolutionBase<2>::n_source_centers] =
+ {Point<2>(-0.5, +0.5), Point<2>(-0.5, -0.5), Point<2>(+0.5, -0.5)};
// There remains to assign a value to the half-width of the exponentials. We
// would like to use the same value for all dimensions. In this case, we
class Solution : public Function<dim>, protected SolutionBase<dim>
{
public:
- Solution() : Function<dim>()
+ Solution()
+ : Function<dim>()
{}
virtual double value(const Point<dim> & p,
class RightHandSide : public Function<dim>, protected SolutionBase<dim>
{
public:
- RightHandSide() : Function<dim>()
+ RightHandSide()
+ : Function<dim>()
{}
virtual double value(const Point<dim> & p,
// arguments, and associate the DoF handler object with the triangulation
// (which is empty at present, however).
template <int dim>
- HelmholtzProblem<dim>::HelmholtzProblem(
- const FiniteElement<dim> &fe,
- const RefinementMode refinement_mode) :
- dof_handler(triangulation),
- fe(&fe),
- refinement_mode(refinement_mode)
+ HelmholtzProblem<dim>::HelmholtzProblem(const FiniteElement<dim> &fe,
+ const RefinementMode refinement_mode)
+ : dof_handler(triangulation)
+ , fe(&fe)
+ , refinement_mode(refinement_mode)
{}
for (unsigned int i = 0; i < dofs_per_cell; ++i)
{
for (unsigned int j = 0; j < dofs_per_cell; ++j)
- system_matrix.add(
- local_dof_indices[i], local_dof_indices[j], cell_matrix(i, j));
+ system_matrix.add(local_dof_indices[i],
+ local_dof_indices[j],
+ cell_matrix(i, j));
system_rhs(local_dof_indices[i]) += cell_rhs(i);
}
hanging_node_constraints.condense(system_rhs);
std::map<types::global_dof_index, double> boundary_values;
- VectorTools::interpolate_boundary_values(
- dof_handler, 0, Solution<dim>(), boundary_values);
- MatrixTools::apply_boundary_values(
- boundary_values, system_matrix, solution, system_rhs);
+ VectorTools::interpolate_boundary_values(dof_handler,
+ 0,
+ Solution<dim>(),
+ boundary_values);
+ MatrixTools::apply_boundary_values(boundary_values,
+ system_matrix,
+ solution,
+ system_rhs);
}
difference_per_cell,
QGauss<dim>(3),
VectorTools::L2_norm);
- const double L2_error = VectorTools::compute_global_error(
- triangulation, difference_per_cell, VectorTools::L2_norm);
+ const double L2_error =
+ VectorTools::compute_global_error(triangulation,
+ difference_per_cell,
+ VectorTools::L2_norm);
// By same procedure we get the H1 semi-norm. We re-use the
// <code>difference_per_cell</code> vector since it is no longer used
difference_per_cell,
QGauss<dim>(3),
VectorTools::H1_seminorm);
- const double H1_error = VectorTools::compute_global_error(
- triangulation, difference_per_cell, VectorTools::H1_seminorm);
+ const double H1_error =
+ VectorTools::compute_global_error(triangulation,
+ difference_per_cell,
+ VectorTools::H1_seminorm);
// Finally, we compute the maximum norm. Of course, we can't actually
// compute the true maximum, but only the maximum at the quadrature
difference_per_cell,
q_iterated,
VectorTools::Linfty_norm);
- const double Linfty_error = VectorTools::compute_global_error(
- triangulation, difference_per_cell, VectorTools::Linfty_norm);
+ const double Linfty_error =
+ VectorTools::compute_global_error(triangulation,
+ difference_per_cell,
+ VectorTools::Linfty_norm);
// After all these errors have been computed, we finally write some
// output. In addition, we add the important data to the TableHandler by
// compose the system of, and how often it shall be repeated:
template <int dim>
- ElasticProblem<dim>::ElasticProblem() :
- dof_handler(triangulation),
- fe(FE_Q<dim>(1), dim)
+ ElasticProblem<dim>::ElasticProblem()
+ : dof_handler(triangulation)
+ , fe(FE_Q<dim>(1), dim)
{}
// In fact, the <code>FESystem</code> class has several more constructors
// which can perform more complex operations than just stacking together
for (unsigned int i = 0; i < dofs_per_cell; ++i)
{
for (unsigned int j = 0; j < dofs_per_cell; ++j)
- system_matrix.add(
- local_dof_indices[i], local_dof_indices[j], cell_matrix(i, j));
+ system_matrix.add(local_dof_indices[i],
+ local_dof_indices[j],
+ cell_matrix(i, j));
system_rhs(local_dof_indices[i]) += cell_rhs(i);
}
// need to pass <code>dim</code> as number of components to the zero
// function as well.
std::map<types::global_dof_index, double> boundary_values;
- VectorTools::interpolate_boundary_values(
- dof_handler, 0, Functions::ZeroFunction<dim>(dim), boundary_values);
- MatrixTools::apply_boundary_values(
- boundary_values, system_matrix, solution, system_rhs);
+ VectorTools::interpolate_boundary_values(dof_handler,
+ 0,
+ Functions::ZeroFunction<dim>(dim),
+ boundary_values);
+ MatrixTools::apply_boundary_values(boundary_values,
+ system_matrix,
+ solution,
+ system_rhs);
}
solution,
estimated_error_per_cell);
- GridRefinement::refine_and_coarsen_fixed_number(
- triangulation, estimated_error_per_cell, 0.3, 0.03);
+ GridRefinement::refine_and_coarsen_fixed_number(triangulation,
+ estimated_error_per_cell,
+ 0.3,
+ 0.03);
triangulation.execute_coarsening_and_refinement();
}
class AdvectionField : public TensorFunction<1, dim>
{
public:
- AdvectionField() : TensorFunction<1, dim>()
+ AdvectionField()
+ : TensorFunction<1, dim>()
{}
virtual Tensor<1, dim> value(const Point<dim> &p) const override;
class RightHandSide : public Function<dim>
{
public:
- RightHandSide() : Function<dim>()
+ RightHandSide()
+ : Function<dim>()
{}
virtual double value(const Point<dim> & p,
class BoundaryValues : public Function<dim>
{
public:
- BoundaryValues() : Function<dim>()
+ BoundaryValues()
+ : Function<dim>()
{}
virtual double value(const Point<dim> & p,
// the function <code>setup_system</code> follow the same pattern that was
// used previously, so we need not comment on these three function:
template <int dim>
- AdvectionProblem<dim>::AdvectionProblem() : dof_handler(triangulation), fe(1)
+ AdvectionProblem<dim>::AdvectionProblem()
+ : dof_handler(triangulation)
+ , fe(1)
{}
// class:
template <int dim>
AdvectionProblem<dim>::AssemblyScratchData::AssemblyScratchData(
- const FiniteElement<dim> &fe) :
- fe_values(fe,
- QGauss<dim>(2),
- update_values | update_gradients | update_quadrature_points |
- update_JxW_values),
- fe_face_values(fe,
- QGauss<dim - 1>(2),
- update_values | update_quadrature_points |
- update_JxW_values | update_normal_vectors)
+ const FiniteElement<dim> &fe)
+ : fe_values(fe,
+ QGauss<dim>(2),
+ update_values | update_gradients | update_quadrature_points |
+ update_JxW_values)
+ , fe_face_values(fe,
+ QGauss<dim - 1>(2),
+ update_values | update_quadrature_points |
+ update_JxW_values | update_normal_vectors)
{}
template <int dim>
AdvectionProblem<dim>::AssemblyScratchData::AssemblyScratchData(
- const AssemblyScratchData &scratch_data) :
- fe_values(scratch_data.fe_values.get_fe(),
- scratch_data.fe_values.get_quadrature(),
- update_values | update_gradients | update_quadrature_points |
- update_JxW_values),
- fe_face_values(scratch_data.fe_face_values.get_fe(),
- scratch_data.fe_face_values.get_quadrature(),
- update_values | update_quadrature_points |
- update_JxW_values | update_normal_vectors)
+ const AssemblyScratchData &scratch_data)
+ : fe_values(scratch_data.fe_values.get_fe(),
+ scratch_data.fe_values.get_quadrature(),
+ update_values | update_gradients | update_quadrature_points |
+ update_JxW_values)
+ , fe_face_values(scratch_data.fe_face_values.get_fe(),
+ scratch_data.fe_face_values.get_quadrature(),
+ update_values | update_quadrature_points |
+ update_JxW_values | update_normal_vectors)
{}
{
Vector<float> estimated_error_per_cell(triangulation.n_active_cells());
- GradientEstimation::estimate(
- dof_handler, solution, estimated_error_per_cell);
+ GradientEstimation::estimate(dof_handler,
+ solution,
+ estimated_error_per_cell);
- GridRefinement::refine_and_coarsen_fixed_number(
- triangulation, estimated_error_per_cell, 0.5, 0.03);
+ GridRefinement::refine_and_coarsen_fixed_number(triangulation,
+ estimated_error_per_cell,
+ 0.5,
+ 0.03);
triangulation.execute_coarsening_and_refinement();
}
GradientEstimation::EstimateScratchData<dim>::EstimateScratchData(
const FiniteElement<dim> &fe,
const Vector<double> & solution,
- Vector<float> & error_per_cell) :
- fe_midpoint_value(fe,
- QMidpoint<dim>(),
- update_values | update_quadrature_points),
- solution(solution),
- error_per_cell(error_per_cell)
+ Vector<float> & error_per_cell)
+ : fe_midpoint_value(fe,
+ QMidpoint<dim>(),
+ update_values | update_quadrature_points)
+ , solution(solution)
+ , error_per_cell(error_per_cell)
{}
template <int dim>
GradientEstimation::EstimateScratchData<dim>::EstimateScratchData(
- const EstimateScratchData &scratch_data) :
- fe_midpoint_value(scratch_data.fe_midpoint_value.get_fe(),
- scratch_data.fe_midpoint_value.get_quadrature(),
- update_values | update_quadrature_points),
- solution(scratch_data.solution),
- error_per_cell(scratch_data.error_per_cell)
+ const EstimateScratchData &scratch_data)
+ : fe_midpoint_value(scratch_data.fe_midpoint_value.get_fe(),
+ scratch_data.fe_midpoint_value.get_quadrature(),
+ update_values | update_quadrature_points)
+ , solution(scratch_data.solution)
+ , error_per_cell(scratch_data.error_per_cell)
{}
ExcInvalidVectorLength(error_per_cell.size(),
dof_handler.get_triangulation().n_active_cells()));
- WorkStream::run(
- dof_handler.begin_active(),
- dof_handler.end(),
- &GradientEstimation::template estimate_cell<dim>,
- std::function<void(const EstimateCopyData &)>(),
- EstimateScratchData<dim>(dof_handler.get_fe(), solution, error_per_cell),
- EstimateCopyData());
+ WorkStream::run(dof_handler.begin_active(),
+ dof_handler.end(),
+ &GradientEstimation::template estimate_cell<dim>,
+ std::function<void(const EstimateCopyData &)>(),
+ EstimateScratchData<dim>(dof_handler.get_fe(),
+ solution,
+ error_per_cell),
+ EstimateCopyData());
}
{
template <typename VectorType>
Newton<VectorType>::Newton(OperatorBase &residual,
- OperatorBase &inverse_derivative) :
- residual(&residual),
- inverse_derivative(&inverse_derivative),
- assemble_now(false),
- n_stepsize_iterations(21),
- assemble_threshold(0.),
- debug_vectors(false),
- debug(0)
+ OperatorBase &inverse_derivative)
+ : residual(&residual)
+ , inverse_derivative(&inverse_derivative)
+ , assemble_now(false)
+ , n_stepsize_iterations(21)
+ , assemble_threshold(0.)
+ , debug_vectors(false)
+ , debug(0)
{}
namespace Algorithms
{
template <typename VectorType>
- OutputOperator<VectorType>::OutputOperator() :
- step(numbers::invalid_unsigned_int),
- os(nullptr)
+ OutputOperator<VectorType>::OutputOperator()
+ : step(numbers::invalid_unsigned_int)
+ , os(nullptr)
{}
template <typename VectorType>
{
template <typename VectorType>
ThetaTimestepping<VectorType>::ThetaTimestepping(OperatorBase &e,
- OperatorBase &i) :
- vtheta(0.5),
- adaptive(false),
- op_explicit(&e),
- op_implicit(&i)
+ OperatorBase &i)
+ : vtheta(0.5)
+ , adaptive(false)
+ , op_explicit(&e)
+ , op_implicit(&i)
{
d_explicit.step = numbers::signaling_nan<double>();
d_explicit.time = numbers::signaling_nan<double>();
*/
AlignedVectorCopy(const T *const source_begin,
const T *const source_end,
- T *const destination) :
- source_(source_begin),
- destination_(destination)
+ T *const destination)
+ : source_(source_begin)
+ , destination_(destination)
{
Assert(source_end >= source_begin, ExcInternalError());
Assert(source_end == source_begin || destination != nullptr,
*/
AlignedVectorMove(T *const source_begin,
T *const source_end,
- T *const destination) :
- source_(source_begin),
- destination_(destination)
+ T *const destination)
+ : source_(source_begin)
+ , destination_(destination)
{
Assert(source_end >= source_begin, ExcInternalError());
Assert(source_end == source_begin || destination != nullptr,
*/
AlignedVectorSet(const std::size_t size,
const T & element,
- T *const destination) :
- element_(element),
- destination_(destination),
- trivial_element(false)
+ T *const destination)
+ : element_(element)
+ , destination_(destination)
+ , trivial_element(false)
{
if (size == 0)
return;
// classes (they will never arrive here because they are
// non-trivial).
if (std::is_trivial<T>::value == true && trivial_element)
- std::memset(
- (void *)(destination_ + begin), 0, (end - begin) * sizeof(T));
+ std::memset((void *)(destination_ + begin),
+ 0,
+ (end - begin) * sizeof(T));
else
copy_construct_or_assign(
begin, end, std::integral_constant<bool, initialize_memory>());
* Constructor. Issues a parallel call if there are sufficiently many
* elements, otherwise work in serial.
*/
- AlignedVectorDefaultInitialize(const std::size_t size,
- T *const destination) :
- destination_(destination)
+ AlignedVectorDefaultInitialize(const std::size_t size, T *const destination)
+ : destination_(destination)
{
if (size == 0)
return;
// classes (they will never arrive here because they are
// non-trivial).
if (std::is_trivial<T>::value == true)
- std::memset(
- (void *)(destination_ + begin), 0, (end - begin) * sizeof(T));
+ std::memset((void *)(destination_ + begin),
+ 0,
+ (end - begin) * sizeof(T));
else
default_construct_or_assign(
begin, end, std::integral_constant<bool, initialize_memory>());
template <class T>
-inline AlignedVector<T>::AlignedVector() :
- _data(nullptr),
- _end_data(nullptr),
- _end_allocated(nullptr)
+inline AlignedVector<T>::AlignedVector()
+ : _data(nullptr)
+ , _end_data(nullptr)
+ , _end_allocated(nullptr)
{}
template <class T>
-inline AlignedVector<T>::AlignedVector(const size_type size, const T &init) :
- _data(nullptr),
- _end_data(nullptr),
- _end_allocated(nullptr)
+inline AlignedVector<T>::AlignedVector(const size_type size, const T &init)
+ : _data(nullptr)
+ , _end_data(nullptr)
+ , _end_allocated(nullptr)
{
if (size > 0)
resize(size, init);
template <class T>
-inline AlignedVector<T>::AlignedVector(const AlignedVector<T> &vec) :
- _data(nullptr),
- _end_data(nullptr),
- _end_allocated(nullptr)
+inline AlignedVector<T>::AlignedVector(const AlignedVector<T> &vec)
+ : _data(nullptr)
+ , _end_data(nullptr)
+ , _end_allocated(nullptr)
{
// copy the data from vec
reserve(vec._end_data - vec._data);
template <class T>
-inline AlignedVector<T>::AlignedVector(AlignedVector<T> &&vec) noexcept :
- _data(vec._data),
- _end_data(vec._end_data),
- _end_allocated(vec._end_allocated)
+inline AlignedVector<T>::AlignedVector(AlignedVector<T> &&vec) noexcept
+ : _data(vec._data)
+ , _end_data(vec._end_data)
+ , _end_allocated(vec._end_allocated)
{
vec._data = nullptr;
vec._end_data = nullptr;
// need to still set the values in case the class is non-trivial because
// virtual classes etc. need to run their (default) constructor
if (std::is_trivial<T>::value == false && size_in > old_size)
- dealii::internal::AlignedVectorDefaultInitialize<T, true>(
- size_in - old_size, _data + old_size);
+ dealii::internal::AlignedVectorDefaultInitialize<T, true>(size_in -
+ old_size,
+ _data + old_size);
}
// finally set the desired init values
if (size_in > old_size)
- dealii::internal::AlignedVectorDefaultInitialize<T, true>(
- size_in - old_size, _data + old_size);
+ dealii::internal::AlignedVectorDefaultInitialize<T, true>(size_in -
+ old_size,
+ _data + old_size);
}
// finally set the desired init values
if (size_in > old_size)
- dealii::internal::AlignedVectorSet<T, true>(
- size_in - old_size, init, _data + old_size);
+ dealii::internal::AlignedVectorSet<T, true>(size_in - old_size,
+ init,
+ _data + old_size);
}
// allocate and align along 64-byte boundaries (this is enough for all
// levels of vectorization currently supported by deal.II)
T *new_data;
- Utilities::System::posix_memalign(
- (void **)&new_data, 64, size_actual_allocate);
+ Utilities::System::posix_memalign((void **)&new_data,
+ 64,
+ size_actual_allocate);
// copy data in case there was some content before and release the old
// memory with the function corresponding to the one used for allocating
_end_allocated = _data + new_size;
if (_end_data != _data)
{
- dealii::internal::AlignedVectorMove<T>(
- new_data, new_data + old_size, _data);
+ dealii::internal::AlignedVectorMove<T>(new_data,
+ new_data + old_size,
+ _data);
free(new_data);
}
else
template <typename ElementType>
inline ArrayView<ElementType>::ArrayView(value_type * starting_element,
- const std::size_t n_elements) :
- starting_element(starting_element),
- n_elements(n_elements)
+ const std::size_t n_elements)
+ : starting_element(starting_element)
+ , n_elements(n_elements)
{}
template <typename ElementType>
inline ArrayView<ElementType>::ArrayView(
- const ArrayView<typename std::remove_cv<value_type>::type> &view) :
- starting_element(view.starting_element),
- n_elements(view.n_elements)
+ const ArrayView<typename std::remove_cv<value_type>::type> &view)
+ : starting_element(view.starting_element)
+ , n_elements(view.n_elements)
{}
template <typename ElementType>
inline ArrayView<ElementType>::ArrayView(
- const std::vector<typename std::remove_cv<value_type>::type> &vector) :
- // use delegating constructor
+ const std::vector<typename std::remove_cv<value_type>::type> &vector)
+ : // use delegating constructor
ArrayView(vector.data(), vector.size())
{
// the following static_assert is not strictly necessary because,
template <typename ElementType>
inline ArrayView<ElementType>::ArrayView(
- std::vector<typename std::remove_cv<value_type>::type> &vector) :
- // use delegating constructor
+ std::vector<typename std::remove_cv<value_type>::type> &vector)
+ : // use delegating constructor
ArrayView(vector.data(), vector.size())
{}
std::is_same<typename std::iterator_traits<Iterator>::iterator_category,
typename std::random_access_iterator_tag>::value,
"The provided iterator should be a random access iterator.");
- Assert(
- begin <= end,
- ExcMessage("The beginning of the array view should be before the end."));
+ Assert(begin <= end,
+ ExcMessage(
+ "The beginning of the array view should be before the end."));
Assert(internal::ArrayViewHelper::is_contiguous(begin, end),
ExcMessage("The provided range isn't contiguous in memory!"));
// the reference type, not the value type, knows the constness of the iterator
ArrayView<ElementType>
make_array_view(ElementType *const begin, ElementType *const end)
{
- Assert(
- begin <= end,
- ExcMessage("The beginning of the array view should be before the end."));
+ Assert(begin <= end,
+ ExcMessage(
+ "The beginning of the array view should be before the end."));
return ArrayView<ElementType>(begin, end - begin);
}
*
* @ingroup Exceptions
*/
-# define DeclExceptionMsg(Exception, defaulttext) \
- class Exception : public dealii::ExceptionBase \
- { \
- public: \
- Exception(const std::string &msg = defaulttext) : arg(msg) \
- {} \
- virtual ~Exception() noexcept \
- {} \
- virtual void \
- print_info(std::ostream &out) const override \
- { \
- out << " " << arg << std::endl; \
- } \
- \
- private: \
- const std::string arg; \
+# define DeclExceptionMsg(Exception, defaulttext) \
+ class Exception : public dealii::ExceptionBase \
+ { \
+ public: \
+ Exception(const std::string &msg = defaulttext) \
+ : arg(msg) \
+ {} \
+ virtual ~Exception() noexcept \
+ {} \
+ virtual void \
+ print_info(std::ostream &out) const override \
+ { \
+ out << " " << arg << std::endl; \
+ } \
+ \
+ private: \
+ const std::string arg; \
}
/**
class Exception1 : public dealii::ExceptionBase \
{ \
public: \
- Exception1(type1 const &a1) : arg1(a1) \
+ Exception1(type1 const &a1) \
+ : arg1(a1) \
{} \
virtual ~Exception1() noexcept \
{} \
*
* @ingroup Exceptions
*/
-# define DeclException2(Exception2, type1, type2, outsequence) \
- class Exception2 : public dealii::ExceptionBase \
- { \
- public: \
- Exception2(type1 const &a1, type2 const &a2) : arg1(a1), arg2(a2) \
- {} \
- virtual ~Exception2() noexcept \
- {} \
- virtual void \
- print_info(std::ostream &out) const override \
- { \
- out << " " outsequence << std::endl; \
- } \
- \
- private: \
- type1 const arg1; \
- type2 const arg2; \
+# define DeclException2(Exception2, type1, type2, outsequence) \
+ class Exception2 : public dealii::ExceptionBase \
+ { \
+ public: \
+ Exception2(type1 const &a1, type2 const &a2) \
+ : arg1(a1) \
+ , arg2(a2) \
+ {} \
+ virtual ~Exception2() noexcept \
+ {} \
+ virtual void \
+ print_info(std::ostream &out) const override \
+ { \
+ out << " " outsequence << std::endl; \
+ } \
+ \
+ private: \
+ type1 const arg1; \
+ type2 const arg2; \
}
class Exception3 : public dealii::ExceptionBase \
{ \
public: \
- Exception3(type1 const &a1, type2 const &a2, type3 const &a3) : \
- arg1(a1), \
- arg2(a2), \
- arg3(a3) \
+ Exception3(type1 const &a1, type2 const &a2, type3 const &a3) \
+ : arg1(a1) \
+ , arg2(a2) \
+ , arg3(a3) \
{} \
virtual ~Exception3() noexcept \
{} \
Exception4(type1 const &a1, \
type2 const &a2, \
type3 const &a3, \
- type4 const &a4) : \
- arg1(a1), \
- arg2(a2), \
- arg3(a3), \
- arg4(a4) \
+ type4 const &a4) \
+ : arg1(a1) \
+ , arg2(a2) \
+ , arg3(a3) \
+ , arg4(a4) \
{} \
virtual ~Exception4() noexcept \
{} \
type2 const &a2, \
type3 const &a3, \
type4 const &a4, \
- type5 const &a5) : \
- arg1(a1), \
- arg2(a2), \
- arg3(a3), \
- arg4(a4), \
- arg5(a5) \
+ type5 const &a5) \
+ : arg1(a1) \
+ , arg2(a2) \
+ , arg3(a3) \
+ , arg4(a4) \
+ , arg5(a5) \
{} \
virtual ~Exception5() noexcept \
{} \
# define DeclException4(Exception4, type1, type2, type3, type4, outsequence) \
/** @ingroup Exceptions */ \
/** @dealiiExceptionMessage{outsequence} */ \
- static dealii::ExceptionBase &Exception4( \
- type1 arg1, type2 arg2, type3 arg3, type4 arg4)
+ static dealii::ExceptionBase &Exception4(type1 arg1, \
+ type2 arg2, \
+ type3 arg3, \
+ type4 arg4)
/**
template <int dim, typename RangeNumberType>
Function<dim, RangeNumberType>::Function(const unsigned int n_components,
- const RangeNumberType initial_time) :
- FunctionTime<RangeNumberType>(initial_time),
- n_components(n_components)
+ const RangeNumberType initial_time)
+ : FunctionTime<RangeNumberType>(initial_time)
+ , n_components(n_components)
{
// avoid the construction of function objects that don't return any
// values. This doesn't make much sense in the first place, but will lead
{
template <int dim, typename RangeNumberType>
ZeroFunction<dim, RangeNumberType>::ZeroFunction(
- const unsigned int n_components) :
- ConstantFunction<dim, RangeNumberType>(RangeNumberType(), n_components)
+ const unsigned int n_components)
+ : ConstantFunction<dim, RangeNumberType>(RangeNumberType(), n_components)
{}
} // namespace Functions
template <int dim, typename RangeNumberType>
ConstantFunction<dim, RangeNumberType>::ConstantFunction(
const RangeNumberType value,
- const unsigned int n_components) :
- Function<dim, RangeNumberType>(n_components),
- function_value_vector(n_components, value)
+ const unsigned int n_components)
+ : Function<dim, RangeNumberType>(n_components)
+ , function_value_vector(n_components, value)
{}
template <int dim, typename RangeNumberType>
ConstantFunction<dim, RangeNumberType>::ConstantFunction(
- const std::vector<RangeNumberType> &values) :
- Function<dim, RangeNumberType>(values.size()),
- function_value_vector(values)
+ const std::vector<RangeNumberType> &values)
+ : Function<dim, RangeNumberType>(values.size())
+ , function_value_vector(values)
{}
template <int dim, typename RangeNumberType>
ConstantFunction<dim, RangeNumberType>::ConstantFunction(
- const Vector<RangeNumberType> &values) :
- Function<dim, RangeNumberType>(values.size()),
- function_value_vector(values.size())
+ const Vector<RangeNumberType> &values)
+ : Function<dim, RangeNumberType>(values.size())
+ , function_value_vector(values.size())
{
Assert(values.size() == function_value_vector.size(),
ExcDimensionMismatch(values.size(), function_value_vector.size()));
template <int dim, typename RangeNumberType>
ConstantFunction<dim, RangeNumberType>::ConstantFunction(
const RangeNumberType *begin_ptr,
- const unsigned int n_components) :
- Function<dim, RangeNumberType>(n_components),
- function_value_vector(n_components)
+ const unsigned int n_components)
+ : Function<dim, RangeNumberType>(n_components)
+ , function_value_vector(n_components)
{
Assert(begin_ptr != nullptr, ExcMessage("Null pointer encountered!"));
- std::copy(
- begin_ptr, begin_ptr + n_components, function_value_vector.begin());
+ std::copy(begin_ptr,
+ begin_ptr + n_components,
+ function_value_vector.begin());
}
for (unsigned int i = 0; i < points.size(); ++i)
{
- Assert(
- return_values[i].size() == this->n_components,
- ExcDimensionMismatch(return_values[i].size(), this->n_components));
+ Assert(return_values[i].size() == this->n_components,
+ ExcDimensionMismatch(return_values[i].size(),
+ this->n_components));
std::copy(function_value_vector.begin(),
function_value_vector.end(),
return_values[i].begin());
ComponentSelectFunction<dim, RangeNumberType>::ComponentSelectFunction(
const unsigned int selected,
const RangeNumberType value,
- const unsigned int n_components) :
- ConstantFunction<dim, RangeNumberType>(value, n_components),
- selected_components(std::make_pair(selected, selected + 1))
+ const unsigned int n_components)
+ : ConstantFunction<dim, RangeNumberType>(value, n_components)
+ , selected_components(std::make_pair(selected, selected + 1))
{}
template <int dim, typename RangeNumberType>
ComponentSelectFunction<dim, RangeNumberType>::ComponentSelectFunction(
const unsigned int selected,
- const unsigned int n_components) :
- ConstantFunction<dim, RangeNumberType>(1., n_components),
- selected_components(std::make_pair(selected, selected + 1))
+ const unsigned int n_components)
+ : ConstantFunction<dim, RangeNumberType>(1., n_components)
+ , selected_components(std::make_pair(selected, selected + 1))
{
Assert(selected < n_components, ExcIndexRange(selected, 0, n_components));
}
template <int dim, typename RangeNumberType>
ComponentSelectFunction<dim, RangeNumberType>::ComponentSelectFunction(
const std::pair<unsigned int, unsigned int> &selected,
- const unsigned int n_components) :
- ConstantFunction<dim, RangeNumberType>(1., n_components),
- selected_components(selected)
+ const unsigned int n_components)
+ : ConstantFunction<dim, RangeNumberType>(1., n_components)
+ , selected_components(selected)
{
Assert(selected_components.first < selected_components.second,
ExcMessage("The upper bound of the interval must be larger than "
template <int dim, typename RangeNumberType>
ScalarFunctionFromFunctionObject<dim, RangeNumberType>::
ScalarFunctionFromFunctionObject(
- const std::function<RangeNumberType(const Point<dim> &)> &function_object) :
- Function<dim, RangeNumberType>(1),
- function_object(function_object)
+ const std::function<RangeNumberType(const Point<dim> &)> &function_object)
+ : Function<dim, RangeNumberType>(1)
+ , function_object(function_object)
{}
VectorFunctionFromScalarFunctionObject(
const std::function<RangeNumberType(const Point<dim> &)> &function_object,
const unsigned int selected_component,
- const unsigned int n_components) :
- Function<dim, RangeNumberType>(n_components),
- function_object(function_object),
- selected_component(selected_component)
+ const unsigned int n_components)
+ : Function<dim, RangeNumberType>(n_components)
+ , function_object(function_object)
+ , selected_component(selected_component)
{
Assert(selected_component < this->n_components,
ExcIndexRange(selected_component, 0, this->n_components));
VectorFunctionFromTensorFunction(
const TensorFunction<1, dim, RangeNumberType> &tensor_function,
const unsigned int selected_component,
- const unsigned int n_components) :
- Function<dim, RangeNumberType>(n_components),
- tensor_function(tensor_function),
- selected_component(selected_component)
+ const unsigned int n_components)
+ : Function<dim, RangeNumberType>(n_components)
+ , tensor_function(tensor_function)
+ , selected_component(selected_component)
{
// Verify that the Tensor<1,dim,RangeNumberType> will fit in the given length
// selected_components and not hang over the end of the vector.
template <typename Number>
-FunctionTime<Number>::FunctionTime(const Number initial_time) :
- time(initial_time)
+FunctionTime<Number>::FunctionTime(const Number initial_time)
+ : time(initial_time)
{}
/* -------------- inline functions ------------- */
-inline GeometryPrimitive::GeometryPrimitive(const Object object) :
- object(object)
+inline GeometryPrimitive::GeometryPrimitive(const Object object)
+ : object(object)
{}
-inline GeometryPrimitive::GeometryPrimitive(
- const unsigned int object_dimension) :
- object(static_cast<Object>(object_dimension))
+inline GeometryPrimitive::GeometryPrimitive(const unsigned int object_dimension)
+ : object(static_cast<Object>(object_dimension))
{}
{
template <int dim>
inline SubfaceCase<dim>::SubfaceCase(
- const typename SubfacePossibilities<dim>::Possibilities
- subface_possibility) :
- value(subface_possibility)
+ const typename SubfacePossibilities<dim>::Possibilities subface_possibility)
+ : value(subface_possibility)
{}
template <int dim>
-inline RefinementCase<dim>::RefinementCase() :
- value(RefinementPossibilities<dim>::no_refinement)
+inline RefinementCase<dim>::RefinementCase()
+ : value(RefinementPossibilities<dim>::no_refinement)
{}
template <int dim>
inline RefinementCase<dim>::RefinementCase(
- const typename RefinementPossibilities<dim>::Possibilities refinement_case) :
- value(refinement_case)
+ const typename RefinementPossibilities<dim>::Possibilities refinement_case)
+ : value(refinement_case)
{
// check that only those bits of
// the given argument are set that
// make sense for a given space
// dimension
- Assert(
- (refinement_case & RefinementPossibilities<dim>::isotropic_refinement) ==
- refinement_case,
- ExcInvalidRefinementCase(refinement_case));
+ Assert((refinement_case &
+ RefinementPossibilities<dim>::isotropic_refinement) ==
+ refinement_case,
+ ExcInvalidRefinementCase(refinement_case));
}
template <int dim>
-inline RefinementCase<dim>::RefinementCase(const std::uint8_t refinement_case) :
- value(refinement_case)
+inline RefinementCase<dim>::RefinementCase(const std::uint8_t refinement_case)
+ : value(refinement_case)
{
// check that only those bits of
// the given argument are set that
// make sense for a given space
// dimension
- Assert(
- (refinement_case & RefinementPossibilities<dim>::isotropic_refinement) ==
- refinement_case,
- ExcInvalidRefinementCase(refinement_case));
+ Assert((refinement_case &
+ RefinementPossibilities<dim>::isotropic_refinement) ==
+ refinement_case,
+ ExcInvalidRefinementCase(refinement_case));
}
const RefinementCase<2> refine_case)
{
- Assert(
- child_index < GeometryInfo<2>::n_children(refine_case),
- ExcIndexRange(child_index, 0, GeometryInfo<2>::n_children(refine_case)));
+ Assert(child_index < GeometryInfo<2>::n_children(refine_case),
+ ExcIndexRange(child_index,
+ 0,
+ GeometryInfo<2>::n_children(refine_case)));
Point<2> point = p;
switch (refine_case)
const RefinementCase<3> refine_case)
{
- Assert(
- child_index < GeometryInfo<3>::n_children(refine_case),
- ExcIndexRange(child_index, 0, GeometryInfo<3>::n_children(refine_case)));
+ Assert(child_index < GeometryInfo<3>::n_children(refine_case),
+ ExcIndexRange(child_index,
+ 0,
+ GeometryInfo<3>::n_children(refine_case)));
Point<3> point = p;
// there might be a cleverer way to do
const RefinementCase<3> refine_case)
{
- Assert(
- child_index < GeometryInfo<3>::n_children(refine_case),
- ExcIndexRange(child_index, 0, GeometryInfo<3>::n_children(refine_case)));
+ Assert(child_index < GeometryInfo<3>::n_children(refine_case),
+ ExcIndexRange(child_index,
+ 0,
+ GeometryInfo<3>::n_children(refine_case)));
Point<3> point = p;
// there might be a cleverer way to do
const unsigned int child_index,
const RefinementCase<2> refine_case)
{
- Assert(
- child_index < GeometryInfo<2>::n_children(refine_case),
- ExcIndexRange(child_index, 0, GeometryInfo<2>::n_children(refine_case)));
+ Assert(child_index < GeometryInfo<2>::n_children(refine_case),
+ ExcIndexRange(child_index,
+ 0,
+ GeometryInfo<2>::n_children(refine_case)));
Point<2> point = p;
switch (refine_case)
Assert(line < lines_per_cell, ExcIndexRange(line, 0, lines_per_cell));
Assert(vertex < 2, ExcIndexRange(vertex, 0, 2));
- constexpr unsigned vertices[lines_per_cell][2] = {
- {0, 2}, // bottom face
- {1, 3},
- {0, 1},
- {2, 3},
- {4, 6}, // top face
- {5, 7},
- {4, 5},
- {6, 7},
- {0, 4}, // connects of bottom
- {1, 5}, // top face
- {2, 6},
- {3, 7}};
+ constexpr unsigned vertices[lines_per_cell][2] = {{0, 2}, // bottom face
+ {1, 3},
+ {0, 1},
+ {2, 3},
+ {4, 6}, // top face
+ {5, 7},
+ {4, 5},
+ {6, 7},
+ {0,
+ 4}, // connects of bottom
+ {1, 5}, // top face
+ {2, 6},
+ {3, 7}};
return vertices[line][vertex];
}
Assert(ref_case > RefinementCase<dim - 1>::no_refinement,
ExcMessage("Cell has no children."));
Assert(face < faces_per_cell, ExcIndexRange(face, 0, faces_per_cell));
- Assert(
- subface < GeometryInfo<dim - 1>::n_children(face_ref_case) ||
- (subface == 0 && face_ref_case == RefinementCase<dim - 1>::no_refinement),
- ExcIndexRange(subface, 0, GeometryInfo<2>::n_children(face_ref_case)));
+ Assert(subface < GeometryInfo<dim - 1>::n_children(face_ref_case) ||
+ (subface == 0 &&
+ face_ref_case == RefinementCase<dim - 1>::no_refinement),
+ ExcIndexRange(subface, 0, GeometryInfo<2>::n_children(face_ref_case)));
// invalid number used for invalid cases,
// e.g. when the children are more refined at
switch (i)
{
case 0:
- return Point<3>(
- -(1 - y) * (1 - z), -(1 - x) * (1 - z), -(1 - x) * (1 - y));
+ return Point<3>(-(1 - y) * (1 - z),
+ -(1 - x) * (1 - z),
+ -(1 - x) * (1 - y));
case 1:
return Point<3>((1 - y) * (1 - z), -x * (1 - z), -x * (1 - y));
case 2:
const std::function<std::vector<types::global_dof_index>(
const typename identity<Iterator>::type &)> &get_conflict_indices)
{
- Assert(
- begin != end,
- ExcMessage("GraphColoring is not prepared to deal with empty ranges!"));
+ Assert(begin != end,
+ ExcMessage(
+ "GraphColoring is not prepared to deal with empty ranges!"));
// Create the partitioning.
std::vector<std::vector<Iterator>> partitioning =
inline IndexSet::IntervalAccessor::IntervalAccessor(
const IndexSet * idxset,
- const IndexSet::size_type range_idx) :
- index_set(idxset),
- range_idx(range_idx)
+ const IndexSet::size_type range_idx)
+ : index_set(idxset)
+ , range_idx(range_idx)
{
Assert(range_idx < idxset->n_intervals(),
ExcInternalError("Invalid range index"));
-inline IndexSet::IntervalAccessor::IntervalAccessor(const IndexSet *idxset) :
- index_set(idxset),
- range_idx(numbers::invalid_dof_index)
+inline IndexSet::IntervalAccessor::IntervalAccessor(const IndexSet *idxset)
+ : index_set(idxset)
+ , range_idx(numbers::invalid_dof_index)
{}
inline IndexSet::IntervalAccessor::IntervalAccessor(
- const IndexSet::IntervalAccessor &other) :
- index_set(other.index_set),
- range_idx(other.range_idx)
+ const IndexSet::IntervalAccessor &other)
+ : index_set(other.index_set)
+ , range_idx(other.range_idx)
{
Assert(range_idx == numbers::invalid_dof_index || is_valid(),
ExcMessage("invalid iterator"));
IndexSet::IntervalAccessor::begin() const
{
Assert(is_valid(), ExcMessage("invalid iterator"));
- return IndexSet::ElementIterator(
- index_set, range_idx, index_set->ranges[range_idx].begin);
+ return IndexSet::ElementIterator(index_set,
+ range_idx,
+ index_set->ranges[range_idx].begin);
}
// point to first index in next interval unless we are the last interval.
if (range_idx < index_set->ranges.size() - 1)
- return IndexSet::ElementIterator(
- index_set, range_idx + 1, index_set->ranges[range_idx + 1].begin);
+ return IndexSet::ElementIterator(index_set,
+ range_idx + 1,
+ index_set->ranges[range_idx + 1].begin);
else
return index_set->end();
}
IndexSet::IntervalAccessor::
operator==(const IndexSet::IntervalAccessor &other) const
{
- Assert(
- index_set == other.index_set,
- ExcMessage("Can not compare accessors pointing to different IndexSets"));
+ Assert(index_set == other.index_set,
+ ExcMessage(
+ "Can not compare accessors pointing to different IndexSets"));
return range_idx == other.range_idx;
}
IndexSet::IntervalAccessor::
operator<(const IndexSet::IntervalAccessor &other) const
{
- Assert(
- index_set == other.index_set,
- ExcMessage("Can not compare accessors pointing to different IndexSets"));
+ Assert(index_set == other.index_set,
+ ExcMessage(
+ "Can not compare accessors pointing to different IndexSets"));
return range_idx < other.range_idx;
}
inline IndexSet::IntervalIterator::IntervalIterator(
const IndexSet * idxset,
- const IndexSet::size_type range_idx) :
- accessor(idxset, range_idx)
+ const IndexSet::size_type range_idx)
+ : accessor(idxset, range_idx)
{}
-inline IndexSet::IntervalIterator::IntervalIterator() : accessor(nullptr)
+inline IndexSet::IntervalIterator::IntervalIterator()
+ : accessor(nullptr)
{}
-inline IndexSet::IntervalIterator::IntervalIterator(const IndexSet *idxset) :
- accessor(idxset)
+inline IndexSet::IntervalIterator::IntervalIterator(const IndexSet *idxset)
+ : accessor(idxset)
{}
inline IndexSet::IntervalIterator::IntervalIterator(
- const IndexSet::IntervalIterator &other) :
- accessor(other.accessor)
+ const IndexSet::IntervalIterator &other)
+ : accessor(other.accessor)
{}
IndexSet::IntervalIterator::
operator-(const IndexSet::IntervalIterator &other) const
{
- Assert(
- accessor.index_set == other.accessor.index_set,
- ExcMessage("Can not compare iterators belonging to different IndexSets"));
+ Assert(accessor.index_set == other.accessor.index_set,
+ ExcMessage(
+ "Can not compare iterators belonging to different IndexSets"));
const size_type lhs = (accessor.range_idx == numbers::invalid_dof_index) ?
accessor.index_set->ranges.size() :
inline IndexSet::ElementIterator::ElementIterator(
const IndexSet * idxset,
const IndexSet::size_type range_idx,
- const IndexSet::size_type index) :
- index_set(idxset),
- range_idx(range_idx),
- idx(index)
+ const IndexSet::size_type index)
+ : index_set(idxset)
+ , range_idx(range_idx)
+ , idx(index)
{
Assert(range_idx < index_set->ranges.size(),
ExcMessage(
-inline IndexSet::ElementIterator::ElementIterator(const IndexSet *idxset) :
- index_set(idxset),
- range_idx(numbers::invalid_dof_index),
- idx(numbers::invalid_dof_index)
+inline IndexSet::ElementIterator::ElementIterator(const IndexSet *idxset)
+ : index_set(idxset)
+ , range_idx(numbers::invalid_dof_index)
+ , idx(numbers::invalid_dof_index)
{}
IndexSet::ElementIterator::
operator==(const IndexSet::ElementIterator &other) const
{
- Assert(
- index_set == other.index_set,
- ExcMessage("Can not compare iterators belonging to different IndexSets"));
+ Assert(index_set == other.index_set,
+ ExcMessage(
+ "Can not compare iterators belonging to different IndexSets"));
return range_idx == other.range_idx && idx == other.idx;
}
IndexSet::ElementIterator::
operator<(const IndexSet::ElementIterator &other) const
{
- Assert(
- index_set == other.index_set,
- ExcMessage("Can not compare iterators belonging to different IndexSets"));
+ Assert(index_set == other.index_set,
+ ExcMessage(
+ "Can not compare iterators belonging to different IndexSets"));
return range_idx < other.range_idx ||
(range_idx == other.range_idx && idx < other.idx);
}
IndexSet::ElementIterator::
operator-(const IndexSet::ElementIterator &other) const
{
- Assert(
- index_set == other.index_set,
- ExcMessage("Can not compare iterators belonging to different IndexSets"));
+ Assert(index_set == other.index_set,
+ ExcMessage(
+ "Can not compare iterators belonging to different IndexSets"));
if (*this == other)
return 0;
if (!(*this < other))
/* Range */
-inline IndexSet::Range::Range() :
- begin(numbers::invalid_dof_index),
- end(numbers::invalid_dof_index),
- nth_index_in_set(numbers::invalid_dof_index)
+inline IndexSet::Range::Range()
+ : begin(numbers::invalid_dof_index)
+ , end(numbers::invalid_dof_index)
+ , nth_index_in_set(numbers::invalid_dof_index)
{}
-inline IndexSet::Range::Range(const size_type i1, const size_type i2) :
- begin(i1),
- end(i2),
- nth_index_in_set(numbers::invalid_dof_index)
+inline IndexSet::Range::Range(const size_type i1, const size_type i2)
+ : begin(i1)
+ , end(i2)
+ , nth_index_in_set(numbers::invalid_dof_index)
{}
/* IndexSet itself */
-inline IndexSet::IndexSet() :
- is_compressed(true),
- index_space_size(0),
- largest_range(numbers::invalid_unsigned_int)
+inline IndexSet::IndexSet()
+ : is_compressed(true)
+ , index_space_size(0)
+ , largest_range(numbers::invalid_unsigned_int)
{}
-inline IndexSet::IndexSet(const size_type size) :
- is_compressed(true),
- index_space_size(size),
- largest_range(numbers::invalid_unsigned_int)
+inline IndexSet::IndexSet(const size_type size)
+ : is_compressed(true)
+ , index_space_size(size)
+ , largest_range(numbers::invalid_unsigned_int)
{}
-inline IndexSet::IndexSet(IndexSet &&is) noexcept :
- ranges(std::move(is.ranges)),
- is_compressed(is.is_compressed),
- index_space_size(is.index_space_size),
- largest_range(is.largest_range)
+inline IndexSet::IndexSet(IndexSet &&is) noexcept
+ : ranges(std::move(is.ranges))
+ , is_compressed(is.is_compressed)
+ , index_space_size(is.index_space_size)
+ , largest_range(is.largest_range)
{
is.ranges.clear();
is.is_compressed = true;
else if (index == ranges.back().end)
ranges.back().end++;
else
- ranges.insert(
- Utilities::lower_bound(ranges.begin(), ranges.end(), new_range),
- new_range);
+ ranges.insert(Utilities::lower_bound(ranges.begin(),
+ ranges.end(),
+ new_range),
+ new_range);
is_compressed = false;
}
template <typename Iterator>
inline IteratorRange<Iterator>::IteratorOverIterators::IteratorOverIterators(
- const BaseIterator &iterator) :
- element_of_iterator_collection(iterator)
+ const BaseIterator &iterator)
+ : element_of_iterator_collection(iterator)
{}
template <typename Iterator>
-inline IteratorRange<Iterator>::IteratorRange() : it_begin(), it_end()
+inline IteratorRange<Iterator>::IteratorRange()
+ : it_begin()
+ , it_end()
{}
template <typename Iterator>
inline IteratorRange<Iterator>::IteratorRange(const iterator b,
- const iterator e) :
- it_begin(b),
- it_end(e)
+ const iterator e)
+ : it_begin(b)
+ , it_end(e)
{}
template <class DerivedIterator, class AccessorType>
inline LinearIndexIterator<DerivedIterator, AccessorType>::LinearIndexIterator(
- const AccessorType accessor) :
- accessor(accessor)
+ const AccessorType accessor)
+ : accessor(accessor)
{}
template <class Object>
MGLevelObject<Object>::MGLevelObject(const unsigned int min,
- const unsigned int max) :
- minlevel(0)
+ const unsigned int max)
+ : minlevel(0)
{
resize(min, max);
}
ierr = MPI_Recv(
buffer.data(), len, MPI_CHAR, rank, 21, comm, MPI_STATUS_IGNORE);
AssertThrowMPI(ierr);
- Assert(
- received_objects.find(rank) == received_objects.end(),
- ExcInternalError("I should not receive again from this rank"));
+ Assert(received_objects.find(rank) == received_objects.end(),
+ ExcInternalError(
+ "I should not receive again from this rank"));
received_objects[rank] = Utilities::unpack<T>(buffer);
}
}
// Wait to have sent all objects.
- MPI_Waitall(
- send_to.size(), buffer_send_requests.data(), MPI_STATUSES_IGNORE);
+ MPI_Waitall(send_to.size(),
+ buffer_send_requests.data(),
+ MPI_STATUSES_IGNORE);
return received_objects;
# endif // deal.II with MPI
std::vector<T> received_objects(n_procs);
for (unsigned int i = 0; i < n_procs; ++i)
{
- std::vector<char> local_buffer(
- received_unrolled_buffer.begin() + rdispls[i],
- received_unrolled_buffer.begin() + rdispls[i] + size_all_data[i]);
+ std::vector<char> local_buffer(received_unrolled_buffer.begin() +
+ rdispls[i],
+ received_unrolled_buffer.begin() +
+ rdispls[i] + size_all_data[i]);
received_objects[i] = Utilities::unpack<T>(local_buffer);
}
"values has different size across MPI processes."));
}
# endif
- const int ierr = MPI_Allreduce(
- values != output ?
- // TODO This const_cast is only needed for older
- // (e.g., openMPI 1.6, released in 2012)
- // implementations of MPI-2. It is not needed as
- // of MPI-3 and we should remove it at some
- // point in the future.
- const_cast<void *>(static_cast<const void *>(values.data())) :
- MPI_IN_PLACE,
- static_cast<void *>(output.data()),
- static_cast<int>(values.size()),
- internal::mpi_type_id(values.data()),
- mpi_op,
- mpi_communicator);
+ const int ierr =
+ MPI_Allreduce(values != output ?
+ // TODO This const_cast is only needed for older
+ // (e.g., openMPI 1.6, released in 2012)
+ // implementations of MPI-2. It is not needed as
+ // of MPI-3 and we should remove it at some
+ // point in the future.
+ const_cast<void *>(
+ static_cast<const void *>(values.data())) :
+ MPI_IN_PLACE,
+ static_cast<void *>(output.data()),
+ static_cast<int>(values.size()),
+ internal::mpi_type_id(values.data()),
+ mpi_op,
+ mpi_communicator);
AssertThrowMPI(ierr);
}
else
#ifdef DEAL_II_WITH_MPI
if (job_supports_mpi())
{
- const int ierr = MPI_Allreduce(
- values != output ?
- // TODO This const_cast is only needed for older
- // (e.g., openMPI 1.6, released in 2012)
- // implementations of MPI-2. It is not needed as
- // of MPI-3 and we should remove it at some
- // point in the future.
- const_cast<void *>(static_cast<const void *>(values.data())) :
- MPI_IN_PLACE,
- static_cast<void *>(output.data()),
- static_cast<int>(values.size() * 2),
- internal::mpi_type_id(static_cast<T *>(nullptr)),
- mpi_op,
- mpi_communicator);
+ const int ierr =
+ MPI_Allreduce(values != output ?
+ // TODO This const_cast is only needed for older
+ // (e.g., openMPI 1.6, released in 2012)
+ // implementations of MPI-2. It is not needed as
+ // of MPI-3 and we should remove it at some
+ // point in the future.
+ const_cast<void *>(
+ static_cast<const void *>(values.data())) :
+ MPI_IN_PLACE,
+ static_cast<void *>(output.data()),
+ static_cast<int>(values.size() * 2),
+ internal::mpi_type_id(static_cast<T *>(nullptr)),
+ mpi_op,
+ mpi_communicator);
AssertThrowMPI(ierr);
}
else
/**
* Constructor. Take and package the given function object.
*/
- Body(const F &f) : f(f)
+ Body(const F &f)
+ : f(f)
{}
template <typename Range>
typedef SynchronousIterators<Iterators> SyncIterators;
Iterators x_begin(begin_in, out);
Iterators x_end(end_in, OutputIterator());
- tbb::parallel_for(
- tbb::blocked_range<SyncIterators>(x_begin, x_end, grainsize),
- internal::make_body(predicate),
- tbb::auto_partitioner());
+ tbb::parallel_for(tbb::blocked_range<SyncIterators>(x_begin,
+ x_end,
+ grainsize),
+ internal::make_body(predicate),
+ tbb::auto_partitioner());
#endif
}
typedef SynchronousIterators<Iterators> SyncIterators;
Iterators x_begin(begin_in1, in2, out);
Iterators x_end(end_in1, InputIterator2(), OutputIterator());
- tbb::parallel_for(
- tbb::blocked_range<SyncIterators>(x_begin, x_end, grainsize),
- internal::make_body(predicate),
- tbb::auto_partitioner());
+ tbb::parallel_for(tbb::blocked_range<SyncIterators>(x_begin,
+ x_end,
+ grainsize),
+ internal::make_body(predicate),
+ tbb::auto_partitioner());
#endif
}
Iterators;
typedef SynchronousIterators<Iterators> SyncIterators;
Iterators x_begin(begin_in1, in2, in3, out);
- Iterators x_end(
- end_in1, InputIterator2(), InputIterator3(), OutputIterator());
- tbb::parallel_for(
- tbb::blocked_range<SyncIterators>(x_begin, x_end, grainsize),
- internal::make_body(predicate),
- tbb::auto_partitioner());
+ Iterators x_end(end_in1,
+ InputIterator2(),
+ InputIterator3(),
+ OutputIterator());
+ tbb::parallel_for(tbb::blocked_range<SyncIterators>(x_begin,
+ x_end,
+ grainsize),
+ internal::make_body(predicate),
+ tbb::auto_partitioner());
#endif
}
template <typename Reductor>
ReductionOnSubranges(const Function & f,
const Reductor & reductor,
- const ResultType neutral_element = ResultType()) :
- result(neutral_element),
- f(f),
- neutral_element(neutral_element),
- reductor(reductor)
+ const ResultType neutral_element = ResultType())
+ : result(neutral_element)
+ , f(f)
+ , neutral_element(neutral_element)
+ , reductor(reductor)
{}
/**
* Splitting constructor. See the TBB book for more details about this.
*/
- ReductionOnSubranges(const ReductionOnSubranges &r, tbb::split) :
- result(r.neutral_element),
- f(r.f),
- neutral_element(r.neutral_element),
- reductor(r.reductor)
+ ReductionOnSubranges(const ReductionOnSubranges &r, tbb::split)
+ : result(r.neutral_element)
+ , f(r.f)
+ , neutral_element(r.neutral_element)
+ , reductor(r.reductor)
{}
/**
*/
struct ParallelForWrapper
{
- ParallelForWrapper(const parallel::ParallelForInteger &worker) :
- worker_(worker)
+ ParallelForWrapper(const parallel::ParallelForInteger &worker)
+ : worker_(worker)
{}
void
template <typename... Args>
ParameterAcceptorProxy<SourceClass>::ParameterAcceptorProxy(
const std::string section_name,
- Args... args) :
- SourceClass(args...),
- ParameterAcceptor(section_name)
+ Args... args)
+ : SourceClass(args...)
+ , ParameterAcceptor(section_name)
{}
/**
* Constructor
*/
- Entry() : type(array)
+ Entry()
+ : type(array)
{}
/**
# ifndef DEBUG
if (vector_operation == VectorOperation::insert)
{
- Assert(
- requests.empty(),
- ExcInternalError("Did not expect a non-empty communication "
- "request when inserting. Check that the same "
- "vector_operation argument was passed to "
- "import_from_ghosted_array_start as is passed "
- "to import_from_ghosted_array_finish."));
+ Assert(requests.empty(),
+ ExcInternalError(
+ "Did not expect a non-empty communication "
+ "request when inserting. Check that the same "
+ "vector_operation argument was passed to "
+ "import_from_ghosted_array_start as is passed "
+ "to import_from_ghosted_array_finish."));
# ifdef DEAL_II_WITH_CXX17
if constexpr (std::is_trivial<Number>::value)
# else
if (std::is_trivial<Number>::value)
# endif
- std::memset(
- ghost_array.data(), 0, sizeof(Number) * ghost_array.size());
+ std::memset(ghost_array.data(),
+ 0,
+ sizeof(Number) * ghost_array.size());
else
- std::fill(
- ghost_array.data(), ghost_array.data() + ghost_array.size(), 0);
+ std::fill(ghost_array.data(),
+ ghost_array.data() + ghost_array.size(),
+ 0);
return;
}
# endif
// wait for the send operations to complete
if (requests.size() > 0 && n_ghost_targets > 0)
{
- const int ierr = MPI_Waitall(
- n_ghost_targets, &requests[n_import_targets], MPI_STATUSES_IGNORE);
+ const int ierr = MPI_Waitall(n_ghost_targets,
+ &requests[n_import_targets],
+ MPI_STATUSES_IGNORE);
AssertThrowMPI(ierr);
}
else
# else
if (std::is_trivial<Number>::value)
# endif
- std::memset(
- ghost_array.data(), 0, sizeof(Number) * n_ghost_indices());
+ std::memset(ghost_array.data(),
+ 0,
+ sizeof(Number) * n_ghost_indices());
else
- std::fill(
- ghost_array.data(), ghost_array.data() + n_ghost_indices(), 0);
+ std::fill(ghost_array.data(),
+ ghost_array.data() + n_ghost_indices(),
+ 0);
}
// clear the compress requests
namespace Patterns
{
template <class... PatternTypes>
- Tuple::Tuple(const char *separator, const PatternTypes &... ps) :
- // forward to the version with std::string argument
+ Tuple::Tuple(const char *separator, const PatternTypes &... ps)
+ : // forward to the version with std::string argument
Tuple(std::string(separator), ps...)
{}
template <class... PatternTypes>
- Tuple::Tuple(const std::string &separator, const PatternTypes &... ps) :
- separator(separator)
+ Tuple::Tuple(const std::string &separator, const PatternTypes &... ps)
+ : separator(separator)
{
static_assert(is_base_of_all<PatternBase, PatternTypes...>::value,
"Not all of the input arguments of this function "
template <class... PatternTypes>
- Tuple::Tuple(const PatternTypes &... ps) :
- // forward to the version with the separator argument
+ Tuple::Tuple(const PatternTypes &... ps)
+ : // forward to the version with the separator argument
Tuple(std::string(":"), ps...)
{}
template <int dim, typename Number>
-inline Point<dim, Number>::Point(const Tensor<1, dim, Number> &t) :
- Tensor<1, dim, Number>(t)
+inline Point<dim, Number>::Point(const Tensor<1, dim, Number> &t)
+ : Tensor<1, dim, Number>(t)
{}
template <int dim, typename Number>
inline Point<dim, Number>::Point(const Number x)
{
- Assert(
- dim == 1,
- ExcMessage("You can only initialize Point<1> objects using the constructor "
- "that takes only one argument. Point<dim> objects with dim!=1 "
- "require initialization with the constructor that takes 'dim' "
- "arguments."));
+ Assert(dim == 1,
+ ExcMessage(
+ "You can only initialize Point<1> objects using the constructor "
+ "that takes only one argument. Point<dim> objects with dim!=1 "
+ "require initialization with the constructor that takes 'dim' "
+ "arguments."));
// we can only get here if we pass the assertion. use the switch anyway so
// as to avoid compiler warnings about uninitialized elements or writing
template <int dim, typename Number>
inline Point<dim, Number>::Point(const Number x, const Number y)
{
- Assert(
- dim == 2,
- ExcMessage("You can only initialize Point<2> objects using the constructor "
- "that takes two arguments. Point<dim> objects with dim!=2 "
- "require initialization with the constructor that takes 'dim' "
- "arguments."));
+ Assert(dim == 2,
+ ExcMessage(
+ "You can only initialize Point<2> objects using the constructor "
+ "that takes two arguments. Point<dim> objects with dim!=2 "
+ "require initialization with the constructor that takes 'dim' "
+ "arguments."));
// we can only get here if we pass the assertion. use the indirection anyway
// so as to avoid compiler warnings about uninitialized elements or writing
// beyond the end of the 'values' array
template <int dim, typename Number>
inline Point<dim, Number>::Point(const Number x, const Number y, const Number z)
{
- Assert(
- dim == 3,
- ExcMessage("You can only initialize Point<3> objects using the constructor "
- "that takes three arguments. Point<dim> objects with dim!=3 "
- "require initialization with the constructor that takes 'dim' "
- "arguments."));
+ Assert(dim == 3,
+ ExcMessage(
+ "You can only initialize Point<3> objects using the constructor "
+ "that takes three arguments. Point<dim> objects with dim!=3 "
+ "require initialization with the constructor that takes 'dim' "
+ "arguments."));
// we can only get here if we pass the assertion. use the indirection anyway
// so as to avoid compiler warnings about uninitialized elements or writing
namespace Polynomials
{
template <typename number>
- inline Polynomial<number>::Polynomial() :
- in_lagrange_product_form(false),
- lagrange_weight(1.)
+ inline Polynomial<number>::Polynomial()
+ : in_lagrange_product_form(false)
+ , lagrange_weight(1.)
{}
template <int dim>
template <class Pol>
-PolynomialSpace<dim>::PolynomialSpace(const std::vector<Pol> &pols) :
- polynomials(pols.begin(), pols.end()),
- n_pols(compute_n_pols(polynomials.size())),
- index_map(n_pols),
- index_map_inverse(n_pols)
+PolynomialSpace<dim>::PolynomialSpace(const std::vector<Pol> &pols)
+ : polynomials(pols.begin(), pols.end())
+ , n_pols(compute_n_pols(polynomials.size()))
+ , index_map(n_pols)
+ , index_map_inverse(n_pols)
{
// per default set this index map
// to identity. This map can be
template <int dim>
inline QProjector<dim>::DataSetDescriptor::DataSetDescriptor(
- const unsigned int dataset_offset) :
- dataset_offset(dataset_offset)
+ const unsigned int dataset_offset)
+ : dataset_offset(dataset_offset)
{}
template <int dim>
-inline QProjector<dim>::DataSetDescriptor::DataSetDescriptor() :
- dataset_offset(numbers::invalid_unsigned_int)
+inline QProjector<dim>::DataSetDescriptor::DataSetDescriptor()
+ : dataset_offset(numbers::invalid_unsigned_int)
{}
ContinuousQuadratureDataTransfer<dim, DataType>::
ContinuousQuadratureDataTransfer(const FiniteElement<dim> &projection_fe_,
const Quadrature<dim> & lhs_quadrature,
- const Quadrature<dim> &rhs_quadrature) :
- projection_fe(
- std::unique_ptr<const FiniteElement<dim>>(projection_fe_.clone())),
- data_size_in_bytes(0),
- n_q_points(rhs_quadrature.size()),
- project_to_fe_matrix(projection_fe->dofs_per_cell, n_q_points),
- project_to_qp_matrix(n_q_points, projection_fe->dofs_per_cell),
- handle(numbers::invalid_unsigned_int),
- data_storage(nullptr),
- triangulation(nullptr)
+ const Quadrature<dim> & rhs_quadrature)
+ : projection_fe(
+ std::unique_ptr<const FiniteElement<dim>>(projection_fe_.clone()))
+ , data_size_in_bytes(0)
+ , n_q_points(rhs_quadrature.size())
+ , project_to_fe_matrix(projection_fe->dofs_per_cell, n_q_points)
+ , project_to_qp_matrix(n_q_points, projection_fe->dofs_per_cell)
+ , handle(numbers::invalid_unsigned_int)
+ , data_storage(nullptr)
+ , triangulation(nullptr)
{
Assert(
projection_fe->n_components() == 1,
matrix_dofs_child);
// finally, put back into the map:
- unpack_to_cell_data(
- cell->child(child), matrix_quadrature, data_storage);
+ unpack_to_cell_data(cell->child(child),
+ matrix_quadrature,
+ data_storage);
}
}
else
template <typename T, typename P>
-inline SmartPointer<T, P>::SmartPointer() : t(nullptr), id(typeid(P).name())
+inline SmartPointer<T, P>::SmartPointer()
+ : t(nullptr)
+ , id(typeid(P).name())
{}
template <typename T, typename P>
-inline SmartPointer<T, P>::SmartPointer(T *t) : t(t), id(typeid(P).name())
+inline SmartPointer<T, P>::SmartPointer(T *t)
+ : t(t)
+ , id(typeid(P).name())
{
if (t != nullptr)
t->subscribe(id);
template <typename T, typename P>
-inline SmartPointer<T, P>::SmartPointer(T *t, const char *id) : t(t), id(id)
+inline SmartPointer<T, P>::SmartPointer(T *t, const char *id)
+ : t(t)
+ , id(id)
{
if (t != nullptr)
t->subscribe(id);
template <typename T, typename P>
template <class Q>
-inline SmartPointer<T, P>::SmartPointer(const SmartPointer<T, Q> &tt) :
- t(tt.t),
- id(tt.id)
+inline SmartPointer<T, P>::SmartPointer(const SmartPointer<T, Q> &tt)
+ : t(tt.t)
+ , id(tt.id)
{
if (t != nullptr)
t->subscribe(id);
template <typename T, typename P>
-inline SmartPointer<T, P>::SmartPointer(const SmartPointer<T, P> &tt) :
- t(tt.t),
- id(tt.id)
+inline SmartPointer<T, P>::SmartPointer(const SmartPointer<T, P> &tt)
+ : t(tt.t)
+ , id(tt.id)
{
if (t != nullptr)
t->subscribe(id);
template <int rank_, int dim, bool constness, int P, typename Number>
Accessor<rank_, dim, constness, P, Number>::Accessor(
tensor_type & tensor,
- const TableIndices<rank_> &previous_indices) :
- tensor(tensor),
- previous_indices(previous_indices)
+ const TableIndices<rank_> &previous_indices)
+ : tensor(tensor)
+ , previous_indices(previous_indices)
{}
template <int rank_, int dim, bool constness, typename Number>
Accessor<rank_, dim, constness, 1, Number>::Accessor(
tensor_type & tensor,
- const TableIndices<rank_> &previous_indices) :
- tensor(tensor),
- previous_indices(previous_indices)
+ const TableIndices<rank_> &previous_indices)
+ : tensor(tensor)
+ , previous_indices(previous_indices)
{}
template <int rank_, int dim, typename Number>
inline SymmetricTensor<rank_, dim, Number>::SymmetricTensor(
- const Number (&array)[n_independent_components]) :
- data(*reinterpret_cast<const typename base_tensor_type::array_type *>(array))
+ const Number (&array)[n_independent_components])
+ : data(
+ *reinterpret_cast<const typename base_tensor_type::array_type *>(array))
{
// ensure that the reinterpret_cast above actually works
Assert(sizeof(typename base_tensor_type::array_type) == sizeof(array),
{
typename internal::SymmetricTensorAccessors::
double_contraction_result<rank_, 4, dim, Number, OtherNumber>::type tmp;
- tmp.data = internal::perform_double_contraction<dim, Number, OtherNumber>(
- data, s.data);
+ tmp.data =
+ internal::perform_double_contraction<dim, Number, OtherNumber>(data,
+ s.data);
return tmp;
}
case 3:
{
- static const unsigned int table[3][3] = {
- {0, 3, 4}, {3, 1, 5}, {4, 5, 2}};
+ static const unsigned int table[3][3] = {{0, 3, 4},
+ {3, 1, 5},
+ {4, 5, 2}};
return table[indices[0]][indices[1]];
}
case 4:
{
- static const unsigned int table[4][4] = {
- {0, 4, 5, 6}, {4, 1, 7, 8}, {5, 7, 2, 9}, {6, 8, 9, 3}};
+ static const unsigned int table[4][4] = {{0, 4, 5, 6},
+ {4, 1, 7, 8},
+ {5, 7, 2, 9},
+ {6, 8, 9, 3}};
return table[indices[0]][indices[1]];
}
template <typename Iterators>
-inline SynchronousIterators<Iterators>::SynchronousIterators(
- const Iterators &i) :
- iterators(i)
+inline SynchronousIterators<Iterators>::SynchronousIterators(const Iterators &i)
+ : iterators(i)
{}
template <int N, typename T>
-TableBase<N, T>::TableBase(const TableBase<N, T> &src) : Subscriptor()
+TableBase<N, T>::TableBase(const TableBase<N, T> &src)
+ : Subscriptor()
{
reinit(src.table_size, true);
values = src.values;
template <int N, typename T>
-TableBase<N, T>::TableBase(TableBase<N, T> &&src) noexcept :
- Subscriptor(std::move(src)),
- values(std::move(src.values)),
- table_size(src.table_size)
+TableBase<N, T>::TableBase(TableBase<N, T> &&src) noexcept
+ : Subscriptor(std::move(src))
+ , values(std::move(src.values))
+ , table_size(src.table_size)
{
src.table_size = TableIndices<N>();
}
{
template <int N, typename T, bool C, unsigned int P>
inline Accessor<N, T, C, P>::Accessor(const TableType &table,
- const iterator data) :
- table(table),
- data(data)
+ const iterator data)
+ : table(table)
+ , data(data)
{}
template <int N, typename T, bool C, unsigned int P>
- inline Accessor<N, T, C, P>::Accessor(const Accessor &a) :
- table(a.table),
- data(a.data)
+ inline Accessor<N, T, C, P>::Accessor(const Accessor &a)
+ : table(a.table)
+ , data(a.data)
{}
template <int N, typename T, bool C>
inline Accessor<N, T, C, 1>::Accessor(const TableType &table,
- const iterator data) :
- table(table),
- data(data)
+ const iterator data)
+ : table(table)
+ , data(data)
{}
template <int N, typename T, bool C>
- inline Accessor<N, T, C, 1>::Accessor(const Accessor &a) :
- table(a.table),
- data(a.data)
+ inline Accessor<N, T, C, 1>::Accessor(const Accessor &a)
+ : table(a.table)
+ , data(a.data)
{}
{
reinit(m.size(), true);
if (!empty())
- std::copy(
- m.values.begin(), m.values.begin() + n_elements(), values.begin());
+ std::copy(m.values.begin(),
+ m.values.begin() + n_elements(),
+ values.begin());
return *this;
}
template <typename T>
-inline Table<1, T>::Table(const size_type size) :
- TableBase<1, T>(TableIndices<1>(size))
+inline Table<1, T>::Table(const size_type size)
+ : TableBase<1, T>(TableIndices<1>(size))
{}
template <typename InputIterator>
inline Table<1, T>::Table(const size_type size,
InputIterator entries,
- const bool C_style_indexing) :
- TableBase<1, T>(TableIndices<1>(size), entries, C_style_indexing)
+ const bool C_style_indexing)
+ : TableBase<1, T>(TableIndices<1>(size), entries, C_style_indexing)
{}
template <typename T>
-inline Table<2, T>::Table(const size_type size1, const size_type size2) :
- TableBase<2, T>(TableIndices<2>(size1, size2))
+inline Table<2, T>::Table(const size_type size1, const size_type size2)
+ : TableBase<2, T>(TableIndices<2>(size1, size2))
{}
inline Table<2, T>::Table(const size_type size1,
const size_type size2,
InputIterator entries,
- const bool C_style_indexing) :
- TableBase<2, T>(TableIndices<2>(size1, size2), entries, C_style_indexing)
+ const bool C_style_indexing)
+ : TableBase<2, T>(TableIndices<2>(size1, size2), entries, C_style_indexing)
{}
namespace TransposeTableIterators
{
template <typename T, bool Constness>
- inline AccessorBase<T, Constness>::AccessorBase() :
- container(nullptr),
- linear_index(std::numeric_limits<decltype(linear_index)>::max())
+ inline AccessorBase<T, Constness>::AccessorBase()
+ : container(nullptr)
+ , linear_index(std::numeric_limits<decltype(linear_index)>::max())
{}
template <typename T, bool Constness>
inline AccessorBase<T, Constness>::AccessorBase(
- const container_pointer_type table) :
- container(table),
- linear_index(container->values.size())
+ const container_pointer_type table)
+ : container(table)
+ , linear_index(container->values.size())
{}
template <typename T, bool Constness>
inline AccessorBase<T, Constness>::AccessorBase(
- const AccessorBase<T, false> &a) :
- container(a.container),
- linear_index(a.linear_index)
+ const AccessorBase<T, false> &a)
+ : container(a.container)
+ , linear_index(a.linear_index)
{}
template <typename T, bool Constness>
inline AccessorBase<T, Constness>::AccessorBase(
const container_pointer_type table,
- const std::ptrdiff_t index) :
- container(table),
- linear_index(index)
+ const std::ptrdiff_t index)
+ : container(table)
+ , linear_index(index)
{
Assert(0 <= linear_index && linear_index < container->values.size() + 1,
ExcMessage("The current iterator points outside of the table and is "
template <typename T, bool Constness>
- Iterator<T, Constness>::Iterator(const Accessor<T, Constness> &a) :
- LinearIndexIterator<Iterator<T, Constness>, Accessor<T, Constness>>(a)
+ Iterator<T, Constness>::Iterator(const Accessor<T, Constness> &a)
+ : LinearIndexIterator<Iterator<T, Constness>, Accessor<T, Constness>>(a)
{}
template <typename T, bool Constness>
- Iterator<T, Constness>::Iterator(const container_pointer_type table) :
- LinearIndexIterator<Iterator<T, Constness>, Accessor<T, Constness>>(
- Accessor<T, Constness>(table))
+ Iterator<T, Constness>::Iterator(const container_pointer_type table)
+ : LinearIndexIterator<Iterator<T, Constness>, Accessor<T, Constness>>(
+ Accessor<T, Constness>(table))
{}
template <typename T, bool Constness>
- Iterator<T, Constness>::Iterator(const Iterator<T, false> &i) :
- LinearIndexIterator<Iterator<T, Constness>, Accessor<T, Constness>>(*i)
+ Iterator<T, Constness>::Iterator(const Iterator<T, false> &i)
+ : LinearIndexIterator<Iterator<T, Constness>, Accessor<T, Constness>>(*i)
{}
template <typename T, bool Constness>
Iterator<T, Constness>::Iterator(const container_pointer_type table,
const size_type row_n,
- const size_type col_n) :
- Iterator(table, table->n_rows() * col_n + row_n)
+ const size_type col_n)
+ : Iterator(table, table->n_rows() * col_n + row_n)
{}
template <typename T, bool Constness>
Iterator<T, Constness>::Iterator(const container_pointer_type table,
- const std::ptrdiff_t linear_index) :
- LinearIndexIterator<Iterator<T, Constness>, Accessor<T, Constness>>(
- Accessor<T, Constness>(table, linear_index))
+ const std::ptrdiff_t linear_index)
+ : LinearIndexIterator<Iterator<T, Constness>, Accessor<T, Constness>>(
+ Accessor<T, Constness>(table, linear_index))
{}
} // namespace TransposeTableIterators
//---------------------------------------------------------------------------
template <typename T>
inline TransposeTable<T>::TransposeTable(const size_type size1,
- const size_type size2) :
- TableBase<2, T>(TableIndices<2>(size2, size1))
+ const size_type size2)
+ : TableBase<2, T>(TableIndices<2>(size2, size1))
{}
template <typename T>
inline Table<3, T>::Table(const size_type size1,
const size_type size2,
- const size_type size3) :
- TableBase<3, T>(TableIndices<3>(size1, size2, size3))
+ const size_type size3)
+ : TableBase<3, T>(TableIndices<3>(size1, size2, size3))
{}
const size_type size2,
const size_type size3,
InputIterator entries,
- const bool C_style_indexing) :
- TableBase<3, T>(TableIndices<3>(size1, size2, size3),
- entries,
- C_style_indexing)
+ const bool C_style_indexing)
+ : TableBase<3, T>(TableIndices<3>(size1, size2, size3),
+ entries,
+ C_style_indexing)
{}
inline Table<4, T>::Table(const size_type size1,
const size_type size2,
const size_type size3,
- const size_type size4) :
- TableBase<4, T>(TableIndices<4>(size1, size2, size3, size4))
+ const size_type size4)
+ : TableBase<4, T>(TableIndices<4>(size1, size2, size3, size4))
{}
const size_type size2,
const size_type size3,
const size_type size4,
- const size_type size5) :
- TableBase<5, T>(TableIndices<5>(size1, size2, size3, size4, size5))
+ const size_type size5)
+ : TableBase<5, T>(TableIndices<5>(size1, size2, size3, size4, size5))
{}
const size_type size3,
const size_type size4,
const size_type size5,
- const size_type size6) :
- TableBase<6, T>()
+ const size_type size6)
+ : TableBase<6, T>()
{
TableIndices<6> table_indices;
table_indices[0] = size1;
const size_type size4,
const size_type size5,
const size_type size6,
- const size_type size7) :
- TableBase<7, T>()
+ const size_type size7)
+ : TableBase<7, T>()
{
TableIndices<7> table_indices;
table_indices[0] = size1;
namespace internal
{
template <typename T>
- TableEntry::TableEntry(const T &t) : value(t)
+ TableEntry::TableEntry(const T &t)
+ : value(t)
{}
for (std::map<std::string, Column>::iterator p = columns.begin();
p != columns.end();
++p)
- max_col_length = std::max(
- max_col_length, static_cast<unsigned int>(p->second.entries.size()));
+ max_col_length =
+ std::max(max_col_length,
+ static_cast<unsigned int>(p->second.entries.size()));
while (columns[key].entries.size() + 1 < max_col_length)
{
columns[key].entries.push_back(internal::TableEntry(T()));
internal::TableEntry &entry = columns[key].entries.back();
entry.cache_string(columns[key].scientific, columns[key].precision);
- columns[key].max_length = std::max(
- columns[key].max_length,
- static_cast<unsigned int>(entry.get_cached_string().length()));
+ columns[key].max_length =
+ std::max(columns[key].max_length,
+ static_cast<unsigned int>(
+ entry.get_cached_string().length()));
}
}
Tensor<0, dim, Number>::Tensor()
// Some auto-differentiable numbers need explicit
// zero initialization.
- :
- value(internal::NumberType<Number>::value(0.0))
+ : value(internal::NumberType<Number>::value(0.0))
{}
contract(const Tensor<rank_1, dim, Number> & src1,
const Tensor<rank_2, dim, OtherNumber> &src2)
{
- Assert(
- 0 <= index_1 && index_1 < rank_1,
- ExcMessage("The specified index_1 must lie within the range [0,rank_1)"));
- Assert(
- 0 <= index_2 && index_2 < rank_2,
- ExcMessage("The specified index_2 must lie within the range [0,rank_2)"));
+ Assert(0 <= index_1 && index_1 < rank_1,
+ ExcMessage(
+ "The specified index_1 must lie within the range [0,rank_1)"));
+ Assert(0 <= index_2 && index_2 < rank_2,
+ ExcMessage(
+ "The specified index_2 must lie within the range [0,rank_2)"));
using namespace TensorAccessors;
using namespace TensorAccessors::internal;
double_contract(const Tensor<rank_1, dim, Number> & src1,
const Tensor<rank_2, dim, OtherNumber> &src2)
{
- Assert(
- 0 <= index_1 && index_1 < rank_1,
- ExcMessage("The specified index_1 must lie within the range [0,rank_1)"));
- Assert(
- 0 <= index_3 && index_3 < rank_1,
- ExcMessage("The specified index_3 must lie within the range [0,rank_1)"));
+ Assert(0 <= index_1 && index_1 < rank_1,
+ ExcMessage(
+ "The specified index_1 must lie within the range [0,rank_1)"));
+ Assert(0 <= index_3 && index_3 < rank_1,
+ ExcMessage(
+ "The specified index_3 must lie within the range [0,rank_1)"));
Assert(index_1 != index_3,
ExcMessage("index_1 and index_3 must not be the same"));
- Assert(
- 0 <= index_2 && index_2 < rank_2,
- ExcMessage("The specified index_2 must lie within the range [0,rank_2)"));
- Assert(
- 0 <= index_4 && index_4 < rank_2,
- ExcMessage("The specified index_4 must lie within the range [0,rank_2)"));
+ Assert(0 <= index_2 && index_2 < rank_2,
+ ExcMessage(
+ "The specified index_2 must lie within the range [0,rank_2)"));
+ Assert(0 <= index_4 && index_4 < rank_2,
+ ExcMessage(
+ "The specified index_4 must lie within the range [0,rank_2)"));
Assert(index_2 != index_4,
ExcMessage("index_2 and index_4 must not be the same"));
{
typedef typename ProductType<T1, typename ProductType<T2, T3>::type>::type
return_type;
- return TensorAccessors::contract3<rank_1, rank_2, dim, return_type>(
- left, middle, right);
+ return TensorAccessors::contract3<rank_1, rank_2, dim, return_type>(left,
+ middle,
+ right);
}
class ReorderedIndexView
{
public:
- ReorderedIndexView(typename ReferenceType<T>::type t) : t_(t)
+ ReorderedIndexView(typename ReferenceType<T>::type t)
+ : t_(t)
{}
typedef ReorderedIndexView<index - 1,
class ReorderedIndexView<0, rank, T>
{
public:
- ReorderedIndexView(typename ReferenceType<T>::type t) : t_(t)
+ ReorderedIndexView(typename ReferenceType<T>::type t)
+ : t_(t)
{}
typedef StoreIndex<rank - 1, internal::Identity<T>> value_type;
class ReorderedIndexView<0, 1, T>
{
public:
- ReorderedIndexView(typename ReferenceType<T>::type t) : t_(t)
+ ReorderedIndexView(typename ReferenceType<T>::type t)
+ : t_(t)
{}
typedef typename ReferenceType<typename ValueType<T>::value_type>::type
class Identity
{
public:
- Identity(typename ReferenceType<T>::type t) : t_(t)
+ Identity(typename ReferenceType<T>::type t)
+ : t_(t)
{}
typedef typename ValueType<T>::value_type return_type;
class StoreIndex
{
public:
- StoreIndex(S s, int i) : s_(s), i_(i)
+ StoreIndex(S s, int i)
+ : s_(s)
+ , i_(i)
{}
typedef StoreIndex<rank - 1, StoreIndex<rank, S>> value_type;
class StoreIndex<1, S>
{
public:
- StoreIndex(S s, int i) : s_(s), i_(i)
+ StoreIndex(S s, int i)
+ : s_(s)
+ , i_(i)
{}
typedef
inline static typename ReturnType<rank - position, T>::value_type &
extract(T &t, const ArrayType &indices)
{
- return ExtractHelper<position + 1, rank>::
- template extract<typename ValueType<T>::value_type, ArrayType>(
- t[indices[position]], indices);
+ return ExtractHelper<position + 1, rank>::template extract<
+ typename ValueType<T>::value_type,
+ ArrayType>(t[indices[position]], indices);
}
};
contract(T1 &result, const T2 &left, const T3 &right)
{
for (unsigned int i = 0; i < dim; ++i)
- Contract<no_contr, rank_1 - 1, rank_2, dim>::contract(
- result[i], left[i], right);
+ Contract<no_contr, rank_1 - 1, rank_2, dim>::contract(result[i],
+ left[i],
+ right);
}
};
contract(T1 &result, const T2 &left, const T3 &right)
{
for (unsigned int i = 0; i < dim; ++i)
- Contract<no_contr, no_contr, rank_2 - 1, dim>::contract(
- result[i], left, right[i]);
+ Contract<no_contr, no_contr, rank_2 - 1, dim>::contract(result[i],
+ left,
+ right[i]);
}
};
// zero initialization.
T1 result = dealii::internal::NumberType<T1>::value(0.0);
for (unsigned int i = 0; i < dim; ++i)
- result += Contract2<no_contr - 1, dim>::template contract2<T1>(
- left[i], right[i]);
+ result +=
+ Contract2<no_contr - 1, dim>::template contract2<T1>(left[i],
+ right[i]);
return result;
}
};
// zero initialization.
T1 result = dealii::internal::NumberType<T1>::value(0.0);
for (unsigned int i = 0; i < dim; ++i)
- result += Contract3<0, rank_2 - 1, dim>::template contract3<T1>(
- left, middle[i], right[i]);
+ result +=
+ Contract3<0, rank_2 - 1, dim>::template contract3<T1>(left,
+ middle[i],
+ right[i]);
return result;
}
};
template <int rank, int dim, typename Number>
-TensorFunction<rank, dim, Number>::TensorFunction(const Number initial_time) :
- FunctionTime<Number>(initial_time)
+TensorFunction<rank, dim, Number>::TensorFunction(const Number initial_time)
+ : FunctionTime<Number>(initial_time)
{}
template <int rank, int dim, typename Number>
ConstantTensorFunction<rank, dim, Number>::ConstantTensorFunction(
const Tensor<rank, dim, Number> &value,
- const Number initial_time) :
- TensorFunction<rank, dim, Number>(initial_time),
- _value(value)
+ const Number initial_time)
+ : TensorFunction<rank, dim, Number>(initial_time)
+ , _value(value)
{}
template <int rank, int dim, typename Number>
ZeroTensorFunction<rank, dim, Number>::ZeroTensorFunction(
- const Number initial_time) :
- ConstantTensorFunction<rank, dim, Number>(dealii::Tensor<rank, dim, Number>(),
- initial_time)
+ const Number initial_time)
+ : ConstantTensorFunction<rank, dim, Number>(
+ dealii::Tensor<rank, dim, Number>(),
+ initial_time)
{}
template <int dim, typename PolynomialType>
template <class Pol>
inline TensorProductPolynomials<dim, PolynomialType>::TensorProductPolynomials(
- const std::vector<Pol> &pols) :
- polynomials(pols.begin(), pols.end()),
- n_tensor_pols(Utilities::fixed_power<dim>(pols.size())),
- index_map(n_tensor_pols),
- index_map_inverse(n_tensor_pols)
+ const std::vector<Pol> &pols)
+ : polynomials(pols.begin(), pols.end())
+ , n_tensor_pols(Utilities::fixed_power<dim>(pols.size()))
+ , index_map(n_tensor_pols)
+ , index_map_inverse(n_tensor_pols)
{
// per default set this index map to identity. This map can be changed by
// the user through the set_numbering() function
template <int dim>
template <class Pol>
inline TensorProductPolynomialsBubbles<dim>::TensorProductPolynomialsBubbles(
- const std::vector<Pol> &pols) :
- TensorProductPolynomials<dim>(pols)
+ const std::vector<Pol> &pols)
+ : TensorProductPolynomials<dim>(pols)
{
const unsigned int q_degree = this->polynomials.size() - 1;
const unsigned int n_bubbles = ((q_degree <= 1) ? 1 : dim);
template <int dim>
template <class Pol>
inline TensorProductPolynomialsConst<dim>::TensorProductPolynomialsConst(
- const std::vector<Pol> &pols) :
- TensorProductPolynomials<dim>(pols)
+ const std::vector<Pol> &pols)
+ : TensorProductPolynomials<dim>(pols)
{
// append index for renumbering
this->index_map.push_back(this->n_tensor_pols);
// ----------------- inline and template functions --------------------------
template <typename T>
- inline ThreadLocalStorage<T>::ThreadLocalStorage(const T &t) : data(t)
+ inline ThreadLocalStorage<T>::ThreadLocalStorage(const T &t)
+ : data(t)
{}
template <typename T>
inline ThreadLocalStorage<T>::ThreadLocalStorage(
- const ThreadLocalStorage<T> &t) :
- data(t)
+ const ThreadLocalStorage<T> &t)
+ : data(t)
{}
/**
* Constructor. Lock the mutex.
*/
- ScopedLock(Mutex &m) : mutex(m)
+ ScopedLock(Mutex &m)
+ : mutex(m)
{
mutex.acquire();
}
* Copy constructor. As discussed in this class's documentation, no state
* is copied from the object given as argument.
*/
- Mutex(const Mutex &) : mutex()
+ Mutex(const Mutex &)
+ : mutex()
{}
public:
typedef RT &reference_type;
- inline return_value() : value()
+ inline return_value()
+ : value()
{}
inline reference_type
public:
typedef RT &reference_type;
- inline return_value() : value(nullptr)
+ inline return_value()
+ : value(nullptr)
{}
inline reference_type
/**
* Default constructor.
*/
- ThreadDescriptor() : thread_is_active(false)
+ ThreadDescriptor()
+ : thread_is_active(false)
{}
~ThreadDescriptor()
/**
* Construct a thread object with a function object.
*/
- Thread(const std::function<RT()> &function) :
- thread_descriptor(new internal::ThreadDescriptor<RT>())
+ Thread(const std::function<RT()> &function)
+ : thread_descriptor(new internal::ThreadDescriptor<RT>())
{
// in a second step, start the thread.
thread_descriptor->start(function);
/**
* Copy constructor.
*/
- Thread(const Thread<RT> &t) : thread_descriptor(t.thread_descriptor)
+ Thread(const Thread<RT> &t)
+ : thread_descriptor(t.thread_descriptor)
{}
/**
template <typename RT>
struct TaskEntryPoint : public tbb::task
{
- TaskEntryPoint(TaskDescriptor<RT> &task_descriptor) :
- task_descriptor(task_descriptor)
+ TaskEntryPoint(TaskDescriptor<RT> &task_descriptor)
+ : task_descriptor(task_descriptor)
{}
virtual tbb::task *
template <typename RT>
inline TaskDescriptor<RT>::TaskDescriptor(
- const std::function<RT()> &function) :
- function(function),
- task(nullptr),
- task_is_done(false)
+ const std::function<RT()> &function)
+ : function(function)
+ , task(nullptr)
+ , task_is_done(false)
{}
template <typename RT>
- TaskDescriptor<RT>::TaskDescriptor() : task_is_done(false)
+ TaskDescriptor<RT>::TaskDescriptor()
+ : task_is_done(false)
{
Assert(false, ExcInternalError());
}
template <typename RT>
- TaskDescriptor<RT>::TaskDescriptor(const TaskDescriptor &) :
- task_is_done(false)
+ TaskDescriptor<RT>::TaskDescriptor(const TaskDescriptor &)
+ : task_is_done(false)
{
// we shouldn't be getting here -- task descriptors
// can't be copied
* @post Using this constructor automatically makes the task object
* joinable().
*/
- Task(const Task<RT> &t) : task_descriptor(t.task_descriptor)
+ Task(const Task<RT> &t)
+ : task_descriptor(t.task_descriptor)
{}
*/
struct Status : public TimeStepping<VectorType>::Status
{
- Status() : method(invalid)
+ Status()
+ : method(invalid)
{}
runge_kutta_method method;
*/
struct Status : public TimeStepping<VectorType>::Status
{
- Status() :
- method(invalid),
- n_iterations(numbers::invalid_unsigned_int),
- norm_residual(numbers::signaling_nan<double>())
+ Status()
+ : method(invalid)
+ , n_iterations(numbers::invalid_unsigned_int)
+ , norm_residual(numbers::signaling_nan<double>())
{}
runge_kutta_method method;
ImplicitRungeKutta<VectorType>::ImplicitRungeKutta(
const runge_kutta_method method,
const unsigned int max_it,
- const double tolerance) :
- RungeKutta<VectorType>(),
- skip_linear_combi(false),
- max_it(max_it),
- tolerance(tolerance)
+ const double tolerance)
+ : RungeKutta<VectorType>()
+ , skip_linear_combi(false)
+ , max_it(max_it)
+ , tolerance(tolerance)
{
// virtual functions called in constructors and destructors never use the
// override in a derived class
const double min_delta,
const double max_delta,
const double refine_tol,
- const double coarsen_tol) :
- coarsen_param(coarsen_param),
- refine_param(refine_param),
- min_delta_t(min_delta),
- max_delta_t(max_delta),
- refine_tol(refine_tol),
- coarsen_tol(coarsen_tol),
- last_same_as_first(false),
- last_stage(nullptr),
- status{}
+ const double coarsen_tol)
+ : coarsen_param(coarsen_param)
+ , refine_param(refine_param)
+ , min_delta_t(min_delta)
+ , max_delta_t(max_delta)
+ , refine_tol(refine_tol)
+ , coarsen_tol(coarsen_tol)
+ , last_same_as_first(false)
+ , last_stage(nullptr)
+ , status{}
{
// virtual functions called in constructors and destructors never use the
// override in a derived class
}
inline TimerOutput::Scope::Scope(dealii::TimerOutput &timer_,
- const std::string & section_name_) :
- timer(timer_),
- section_name(section_name_),
- in(true)
+ const std::string & section_name_)
+ : timer(timer_)
+ , section_name(section_name_)
+ , in(true)
{
timer.enter_section(section_name);
}
// verify that the two iterators are properly ordered. since
// we need operator- for the iterator type anyway, do the
// test as follows, rather than via 'last >= first'
- Assert(
- last - first >= 0,
- ExcMessage("The given iterators do not satisfy the proper ordering."));
+ Assert(last - first >= 0,
+ ExcMessage(
+ "The given iterators do not satisfy the proper ordering."));
unsigned int len = static_cast<unsigned int>(last - first);
//---------------------------------------------------------------------------
template <typename VectorType>
-inline VectorSlice<VectorType>::VectorSlice(VectorType &v) :
- v(v),
- start(0),
- length(v.size())
+inline VectorSlice<VectorType>::VectorSlice(VectorType &v)
+ : v(v)
+ , start(0)
+ , length(v.size())
{}
template <typename VectorType>
inline VectorSlice<VectorType>::VectorSlice(VectorType & v,
unsigned int start,
- unsigned int length) :
- v(v),
- start(start),
- length(length)
+ unsigned int length)
+ : v(v)
+ , start(start)
+ , length(length)
{
Assert((start + length <= v.size()),
ExcIndexRange(length, 0, v.size() - start + 1));
__m128d u1 = in[2 * i + 1].data;
__m128d res0 = _mm_unpacklo_pd(u0, u1);
__m128d res1 = _mm_unpackhi_pd(u0, u1);
- _mm_storeu_pd(
- out + 2 * i + offsets[0],
- _mm_add_pd(_mm_loadu_pd(out + 2 * i + offsets[0]), res0));
- _mm_storeu_pd(
- out + 2 * i + offsets[1],
- _mm_add_pd(_mm_loadu_pd(out + 2 * i + offsets[1]), res1));
+ _mm_storeu_pd(out + 2 * i + offsets[0],
+ _mm_add_pd(_mm_loadu_pd(out + 2 * i + offsets[0]),
+ res0));
+ _mm_storeu_pd(out + 2 * i + offsets[1],
+ _mm_add_pd(_mm_loadu_pd(out + 2 * i + offsets[1]),
+ res1));
}
for (unsigned int i = 2 * n_chunks; i < n_entries; ++i)
for (unsigned int v = 0; v < 2; ++v)
/**
* Default constructor.
*/
- ScratchDataObject() : currently_in_use(false)
+ ScratchDataObject()
+ : currently_in_use(false)
{}
- ScratchDataObject(ScratchData *p, const bool in_use) :
- scratch_data(p),
- currently_in_use(in_use)
+ ScratchDataObject(ScratchData *p, const bool in_use)
+ : scratch_data(p)
+ , currently_in_use(in_use)
{}
// TODO: when we push back an object to the list of scratch objects,
// again, but it's certainly awkward. one way to avoid this
// would be to use unique_ptr but we'd need to figure out a way
// to use it in non-C++11 mode
- ScratchDataObject(const ScratchDataObject &o) :
- scratch_data(o.scratch_data),
- currently_in_use(o.currently_in_use)
+ ScratchDataObject(const ScratchDataObject &o)
+ : scratch_data(o.scratch_data)
+ , currently_in_use(o.currently_in_use)
{}
};
* Default constructor. Initialize everything that doesn't have a
* default constructor itself.
*/
- ItemType() :
- n_items(0),
- scratch_data(nullptr),
- sample_scratch_data(nullptr),
- currently_in_use(false)
+ ItemType()
+ : n_items(0)
+ , scratch_data(nullptr)
+ , sample_scratch_data(nullptr)
+ , currently_in_use(false)
{}
};
const unsigned int buffer_size,
const unsigned int chunk_size,
const ScratchData &sample_scratch_data,
- const CopyData & sample_copy_data) :
- tbb::filter(/*is_serial=*/true),
- remaining_iterator_range(begin, end),
- item_buffer(buffer_size),
- sample_scratch_data(sample_scratch_data),
- chunk_size(chunk_size)
+ const CopyData & sample_copy_data)
+ : tbb::filter(/*is_serial=*/true)
+ , remaining_iterator_range(begin, end)
+ , item_buffer(buffer_size)
+ , sample_scratch_data(sample_scratch_data)
+ , chunk_size(chunk_size)
{
// initialize the elements of the ring buffer
for (unsigned int element = 0; element < item_buffer.size();
Worker(
const std::function<void(const Iterator &, ScratchData &, CopyData &)>
& worker,
- bool copier_exist = true) :
- tbb::filter(/* is_serial= */ false),
- worker(worker),
- copier_exist(copier_exist)
+ bool copier_exist = true)
+ : tbb::filter(/* is_serial= */ false)
+ , worker(worker)
+ , copier_exist(copier_exist)
{}
* copying from the additional data object to the global matrix or
* similar.
*/
- Copier(const std::function<void(const CopyData &)> &copier) :
- tbb::filter(/*is_serial=*/true),
- copier(copier)
+ Copier(const std::function<void(const CopyData &)> &copier)
+ : tbb::filter(/*is_serial=*/true)
+ , copier(copier)
{}
/**
* Default constructor.
*/
- ScratchAndCopyDataObjects() : currently_in_use(false)
+ ScratchAndCopyDataObjects()
+ : currently_in_use(false)
{}
ScratchAndCopyDataObjects(ScratchData *p,
CopyData * q,
- const bool in_use) :
- scratch_data(p),
- copy_data(q),
- currently_in_use(in_use)
+ const bool in_use)
+ : scratch_data(p)
+ , copy_data(q)
+ , currently_in_use(in_use)
{}
// TODO: when we push back an object to the list of scratch objects, in
// it's certainly awkward. one way to avoid this would be to use
// unique_ptr but we'd need to figure out a way to use it in
// non-C++11 mode
- ScratchAndCopyDataObjects(const ScratchAndCopyDataObjects &o) :
- scratch_data(o.scratch_data),
- copy_data(o.copy_data),
- currently_in_use(o.currently_in_use)
+ ScratchAndCopyDataObjects(const ScratchAndCopyDataObjects &o)
+ : scratch_data(o.scratch_data)
+ , copy_data(o.copy_data)
+ , currently_in_use(o.currently_in_use)
{}
};
& worker,
const std::function<void(const CopyData &)> &copier,
const ScratchData & sample_scratch_data,
- const CopyData & sample_copy_data) :
- worker(worker),
- copier(copier),
- sample_scratch_data(sample_scratch_data),
- sample_copy_data(sample_copy_data)
+ const CopyData & sample_copy_data)
+ : worker(worker)
+ , copier(copier)
+ , sample_scratch_data(sample_scratch_data)
+ , sample_copy_data(sample_copy_data)
{}
scratch_data = new ScratchData(sample_scratch_data);
copy_data = new CopyData(sample_copy_data);
- scratch_and_copy_data_list.emplace_back(
- scratch_data, copy_data, true);
+ scratch_and_copy_data_list.emplace_back(scratch_data,
+ copy_data,
+ true);
}
}
{
// need to check if the function is not the zero function. To
// check zero-ness, create a C++ function out of it and check that
- if (static_cast<const std::function<void(
- const Iterator &, ScratchData &, CopyData &)> &>(worker))
+ if (static_cast<const std::function<
+ void(const Iterator &, ScratchData &, CopyData &)> &>(worker))
worker(i, scratch_data, copy_data);
if (static_cast<const std::function<void(const CopyData &)> &>(
copier))
typedef typename std::vector<Iterator>::const_iterator RangeType;
- WorkerAndCopier worker_and_copier(
- worker, copier, sample_scratch_data, sample_copy_data);
+ WorkerAndCopier worker_and_copier(worker,
+ copier,
+ sample_scratch_data,
+ sample_copy_data);
tbb::parallel_for(
tbb::blocked_range<RangeType>(colored_iterators[color].begin(),
true),
"Expected a complex float_type");
- static_assert(
- (is_complex_valued == true ? boost::is_complex<ad_type>::value : true),
- "Expected a complex ad_type");
+ static_assert((is_complex_valued == true ?
+ boost::is_complex<ad_type>::value :
+ true),
+ "Expected a complex ad_type");
};
# ifdef __clang__
// Violating this condition when will result in an Adol-C internal
// error. We could rather always throw here in order to provide a
// less cryptic message.
- AssertThrow(
- index < adtl::getNumDir(),
- ExcMessage("The index number of the independent variable being "
- "marked is greater than the number of independent "
- "variables that have been declared."));
+ AssertThrow(index < adtl::getNumDir(),
+ ExcMessage(
+ "The index number of the independent variable being "
+ "marked is greater than the number of independent "
+ "variables that have been declared."));
out.setADValue(index, 1 /*seed value for first derivative*/);
}
static double
directional_derivative(const adouble &, const unsigned int)
{
- AssertThrow(
- false,
- ExcMessage("The derivative values for taped Adol-C numbers must be"
- "computed through the ::gradient function."));
+ AssertThrow(false,
+ ExcMessage(
+ "The derivative values for taped Adol-C numbers must be"
+ "computed through the ::gradient function."));
return 0.0;
}
};
*/
unsigned int n_attached_deserialize;
- using pack_callback_t = std::function<void(
- typename Triangulation<dim, spacedim>::cell_iterator,
- CellStatus,
- void *)>;
+ using pack_callback_t = std::function<
+ void(typename Triangulation<dim, spacedim>::cell_iterator,
+ CellStatus,
+ void *)>;
/**
* List of callback functions registered by register_data_attach() that
DoFHandlerType::space_dimension> *tria,
const int level,
const int index,
- const DoFHandlerType * dof_handler) :
- dealii::internal::DoFAccessorImplementation::Inheritance<
- structdim,
- DoFHandlerType::dimension,
- DoFHandlerType::space_dimension>::BaseClass(tria, level, index),
- dof_handler(const_cast<DoFHandlerType *>(dof_handler))
+ const DoFHandlerType * dof_handler)
+ : dealii::internal::DoFAccessorImplementation::Inheritance<
+ structdim,
+ DoFHandlerType::dimension,
+ DoFHandlerType::space_dimension>::BaseClass(tria, level, index)
+ , dof_handler(const_cast<DoFHandlerType *>(dof_handler))
{
Assert(
tria == nullptr || &dof_handler->get_triangulation() == tria,
template <int structdim, typename DoFHandlerType, bool level_dof_access>
template <int dim2, class DoFHandlerType2, bool level_dof_access2>
inline DoFAccessor<structdim, DoFHandlerType, level_dof_access>::DoFAccessor(
- const DoFAccessor<dim2, DoFHandlerType2, level_dof_access2> &other) :
- BaseClass(other),
- dof_handler(nullptr)
+ const DoFAccessor<dim2, DoFHandlerType2, level_dof_access2> &other)
+ : BaseClass(other)
+ , dof_handler(nullptr)
{
- Assert(
- false,
- ExcMessage("You are trying to assign iterators that are incompatible. "
- "Reasons for incompatibility are that they point to different "
- "types of DoFHandlers (e.g., dealii::DoFHandler and "
- "dealii::hp::DoFHandler) or that they refer to objects of "
- "different dimensionality (e.g., assigning a line iterator "
- "to a quad iterator)."));
+ Assert(false,
+ ExcMessage(
+ "You are trying to assign iterators that are incompatible. "
+ "Reasons for incompatibility are that they point to different "
+ "types of DoFHandlers (e.g., dealii::DoFHandler and "
+ "dealii::hp::DoFHandler) or that they refer to objects of "
+ "different dimensionality (e.g., assigning a line iterator "
+ "to a quad iterator)."));
}
template <int structdim, typename DoFHandlerType, bool level_dof_access>
template <bool level_dof_access2>
inline DoFAccessor<structdim, DoFHandlerType, level_dof_access>::DoFAccessor(
- const DoFAccessor<structdim, DoFHandlerType, level_dof_access2> &other) :
- BaseClass(other),
- dof_handler(const_cast<DoFHandlerType *>(other.dof_handler))
+ const DoFAccessor<structdim, DoFHandlerType, level_dof_access2> &other)
+ : BaseClass(other)
+ , dof_handler(const_cast<DoFHandlerType *>(other.dof_handler))
{}
(void)obj_level;
// faces have no levels
Assert(obj_level == 0, ExcInternalError());
- return dof_handler.faces->lines.get_dof_index(
- dof_handler, obj_index, fe_index, local_index);
+ return dof_handler.faces->lines.get_dof_index(dof_handler,
+ obj_index,
+ fe_index,
+ local_index);
}
(void)obj_level;
// faces have no levels
Assert(obj_level == 0, ExcInternalError());
- return dof_handler.faces->lines.get_dof_index(
- dof_handler, obj_index, fe_index, local_index);
+ return dof_handler.faces->lines.get_dof_index(dof_handler,
+ obj_index,
+ fe_index,
+ local_index);
}
(void)obj_level;
// faces have no levels
Assert(obj_level == 0, ExcInternalError());
- return dof_handler.faces->quads.get_dof_index(
- dof_handler, obj_index, fe_index, local_index);
+ return dof_handler.faces->quads.get_dof_index(dof_handler,
+ obj_index,
+ fe_index,
+ local_index);
}
const unsigned int local_index,
const std::integral_constant<int, 1> &)
{
- return dof_handler.levels[obj_level]->get_dof_index(
- obj_index, fe_index, local_index);
+ return dof_handler.levels[obj_level]->get_dof_index(obj_index,
+ fe_index,
+ local_index);
}
const std::integral_constant<int, 1> &,
const types::global_dof_index global_index)
{
- dof_handler.levels[obj_level]->set_dof_index(
- obj_index, fe_index, local_index, global_index);
+ dof_handler.levels[obj_level]->set_dof_index(obj_index,
+ fe_index,
+ local_index,
+ global_index);
}
const unsigned int local_index,
const std::integral_constant<int, 2> &)
{
- return dof_handler.levels[obj_level]->get_dof_index(
- obj_index, fe_index, local_index);
+ return dof_handler.levels[obj_level]->get_dof_index(obj_index,
+ fe_index,
+ local_index);
}
const std::integral_constant<int, 2> &,
const types::global_dof_index global_index)
{
- dof_handler.levels[obj_level]->set_dof_index(
- obj_index, fe_index, local_index, global_index);
+ dof_handler.levels[obj_level]->set_dof_index(obj_index,
+ fe_index,
+ local_index,
+ global_index);
}
const unsigned int local_index,
const std::integral_constant<int, 3> &)
{
- return dof_handler.levels[obj_level]->get_dof_index(
- obj_index, fe_index, local_index);
+ return dof_handler.levels[obj_level]->get_dof_index(obj_index,
+ fe_index,
+ local_index);
}
const std::integral_constant<int, 3> &,
const types::global_dof_index global_index)
{
- dof_handler.levels[obj_level]->set_dof_index(
- obj_index, fe_index, local_index, global_index);
+ dof_handler.levels[obj_level]->set_dof_index(obj_index,
+ fe_index,
+ local_index,
+ global_index);
}
const unsigned int,
const unsigned int)
{
- Assert(
- false,
- ExcMessage("hp::DoFHandler does not implement multilevel DoFs."));
+ Assert(false,
+ ExcMessage(
+ "hp::DoFHandler does not implement multilevel DoFs."));
return numbers::invalid_dof_index;
}
const unsigned int,
types::global_dof_index)
{
- Assert(
- false,
- ExcMessage("hp::DoFHandler does not implement multilevel DoFs."));
+ Assert(false,
+ ExcMessage(
+ "hp::DoFHandler does not implement multilevel DoFs."));
}
const unsigned int fe_index,
const std::integral_constant<int, 1> &)
{
- return dof_handler.faces->lines.fe_index_is_active(
- dof_handler, obj_index, fe_index, obj_level);
+ return dof_handler.faces->lines.fe_index_is_active(dof_handler,
+ obj_index,
+ fe_index,
+ obj_level);
}
const unsigned int n,
const std::integral_constant<int, 1> &)
{
- return dof_handler.faces->lines.nth_active_fe_index(
- dof_handler, obj_level, obj_index, n);
+ return dof_handler.faces->lines.nth_active_fe_index(dof_handler,
+ obj_level,
+ obj_index,
+ n);
}
const unsigned int fe_index,
const std::integral_constant<int, 1> &)
{
- return dof_handler.faces->lines.fe_index_is_active(
- dof_handler, obj_index, fe_index, obj_level);
+ return dof_handler.faces->lines.fe_index_is_active(dof_handler,
+ obj_index,
+ fe_index,
+ obj_level);
}
const unsigned int n,
const std::integral_constant<int, 1> &)
{
- return dof_handler.faces->lines.nth_active_fe_index(
- dof_handler, obj_level, obj_index, n);
+ return dof_handler.faces->lines.nth_active_fe_index(dof_handler,
+ obj_level,
+ obj_index,
+ n);
}
const unsigned int fe_index,
const std::integral_constant<int, 2> &)
{
- return dof_handler.faces->quads.fe_index_is_active(
- dof_handler, obj_index, fe_index, obj_level);
+ return dof_handler.faces->quads.fe_index_is_active(dof_handler,
+ obj_index,
+ fe_index,
+ obj_level);
}
template <int spacedim>
const unsigned int n,
const std::integral_constant<int, 2> &)
{
- return dof_handler.faces->quads.nth_active_fe_index(
- dof_handler, obj_level, obj_index, n);
+ return dof_handler.faces->quads.nth_active_fe_index(dof_handler,
+ obj_level,
+ obj_index,
+ n);
}
(fe_index == dealii::DoFHandler<dim, spacedim>::default_fe_index),
ExcMessage(
"Only the default FE index is allowed for non-hp DoFHandler objects"));
- Assert(
- local_index < dof_handler.get_fe().dofs_per_vertex,
- ExcIndexRange(local_index, 0, dof_handler.get_fe().dofs_per_vertex));
+ Assert(local_index < dof_handler.get_fe().dofs_per_vertex,
+ ExcIndexRange(local_index,
+ 0,
+ dof_handler.get_fe().dofs_per_vertex));
dof_handler
.vertex_dofs[vertex_index * dof_handler.get_fe().dofs_per_vertex +
const unsigned int local_index,
const types::global_dof_index global_index)
{
- Assert(
- (fe_index != dealii::hp::DoFHandler<dim, spacedim>::default_fe_index),
- ExcMessage("You need to specify a FE index when working "
- "with hp DoFHandlers"));
+ Assert((fe_index !=
+ dealii::hp::DoFHandler<dim, spacedim>::default_fe_index),
+ ExcMessage("You need to specify a FE index when working "
+ "with hp DoFHandlers"));
Assert(dof_handler.fe_collection.size() > 0,
ExcMessage("No finite element collection is associated with "
"this DoFHandler"));
Assert(local_index < dof_handler.get_fe(fe_index).dofs_per_vertex,
- ExcIndexRange(
- local_index, 0, dof_handler.get_fe(fe_index).dofs_per_vertex));
+ ExcIndexRange(local_index,
+ 0,
+ dof_handler.get_fe(fe_index).dofs_per_vertex));
Assert(fe_index < dof_handler.fe_collection.size(), ExcInternalError());
Assert(dof_handler.vertex_dof_offsets[vertex_index] !=
numbers::invalid_unsigned_int,
(fe_index == dealii::DoFHandler<dim, spacedim>::default_fe_index),
ExcMessage(
"Only the default FE index is allowed for non-hp DoFHandler objects"));
- Assert(
- local_index < dof_handler.get_fe().dofs_per_vertex,
- ExcIndexRange(local_index, 0, dof_handler.get_fe().dofs_per_vertex));
+ Assert(local_index < dof_handler.get_fe().dofs_per_vertex,
+ ExcIndexRange(local_index,
+ 0,
+ dof_handler.get_fe().dofs_per_vertex));
return dof_handler
.vertex_dofs[vertex_index * dof_handler.get_fe().dofs_per_vertex +
const unsigned int fe_index,
const unsigned int local_index)
{
- Assert(
- (fe_index != dealii::hp::DoFHandler<dim, spacedim>::default_fe_index),
- ExcMessage("You need to specify a FE index when working "
- "with hp DoFHandlers"));
+ Assert((fe_index !=
+ dealii::hp::DoFHandler<dim, spacedim>::default_fe_index),
+ ExcMessage("You need to specify a FE index when working "
+ "with hp DoFHandlers"));
Assert(dof_handler.fe_collection.size() > 0,
ExcMessage("No finite element collection is associated with "
"this DoFHandler"));
Assert(local_index < dof_handler.get_fe(fe_index).dofs_per_vertex,
- ExcIndexRange(
- local_index, 0, dof_handler.get_fe(fe_index).dofs_per_vertex));
+ ExcIndexRange(local_index,
+ 0,
+ dof_handler.get_fe(fe_index).dofs_per_vertex));
Assert(vertex_index < dof_handler.vertex_dof_offsets.size(),
- ExcIndexRange(
- vertex_index, 0, dof_handler.vertex_dof_offsets.size()));
+ ExcIndexRange(vertex_index,
+ 0,
+ dof_handler.vertex_dof_offsets.size()));
Assert(dof_handler.vertex_dof_offsets[vertex_index] !=
numbers::invalid_unsigned_int,
ExcMessage(
const unsigned int vertex_index,
const unsigned int fe_index)
{
- Assert(
- (fe_index != dealii::hp::DoFHandler<dim, spacedim>::default_fe_index),
- ExcMessage("You need to specify a FE index when working "
- "with hp DoFHandlers"));
+ Assert((fe_index !=
+ dealii::hp::DoFHandler<dim, spacedim>::default_fe_index),
+ ExcMessage("You need to specify a FE index when working "
+ "with hp DoFHandlers"));
Assert(dof_handler.fe_collection.size() > 0,
ExcMessage("No finite element collection is associated with "
"this DoFHandler"));
std::iota(idx.begin(), idx.end(), 0u);
// sort indices based on comparing values in v
- std::sort(
- idx.begin(), idx.end(), [&v_begin](unsigned int i1, unsigned int i2) {
- return *(v_begin + i1) < *(v_begin + i2);
- });
+ std::sort(idx.begin(),
+ idx.end(),
+ [&v_begin](unsigned int i1, unsigned int i2) {
+ return *(v_begin + i1) < *(v_begin + i2);
+ });
return idx;
}
const unsigned int fe_index) const
{
return dealii::internal::DoFAccessorImplementation::Implementation::
- get_vertex_dof_index(
- *this->dof_handler, this->vertex_index(vertex), fe_index, i);
+ get_vertex_dof_index(*this->dof_handler,
+ this->vertex_index(vertex),
+ fe_index,
+ i);
}
Assert(this->dof_handler != nullptr, ExcInvalidObject());
Assert(vertex < GeometryInfo<structdim>::vertices_per_cell,
ExcIndexRange(vertex, 0, GeometryInfo<structdim>::vertices_per_cell));
- Assert(
- i < this->dof_handler->get_fe(fe_index).dofs_per_vertex,
- ExcIndexRange(i, 0, this->dof_handler->get_fe(fe_index).dofs_per_vertex));
+ Assert(i < this->dof_handler->get_fe(fe_index).dofs_per_vertex,
+ ExcIndexRange(i,
+ 0,
+ this->dof_handler->get_fe(fe_index).dofs_per_vertex));
return dealii::internal::DoFAccessorImplementation::Implementation::
- mg_vertex_dof_index(
- *this->dof_handler, level, this->vertex_index(vertex), i);
+ mg_vertex_dof_index(*this->dof_handler,
+ level,
+ this->vertex_index(vertex),
+ i);
}
Assert(this->dof_handler != nullptr, ExcInvalidObject());
Assert(vertex < GeometryInfo<structdim>::vertices_per_cell,
ExcIndexRange(vertex, 0, GeometryInfo<structdim>::vertices_per_cell));
- Assert(
- i < this->dof_handler->get_fe(fe_index).dofs_per_vertex,
- ExcIndexRange(i, 0, this->dof_handler->get_fe(fe_index).dofs_per_vertex));
+ Assert(i < this->dof_handler->get_fe(fe_index).dofs_per_vertex,
+ ExcIndexRange(i,
+ 0,
+ this->dof_handler->get_fe(fe_index).dofs_per_vertex));
return dealii::internal::DoFAccessorImplementation::Implementation::
set_mg_vertex_dof_index(
const unsigned int fe_index) const
{
Assert(this->dof_handler != nullptr, ExcInvalidObject());
- Assert(
- static_cast<unsigned int>(this->level()) < this->dof_handler->levels.size(),
- ExcMessage("The DoFHandler to which this accessor points has not "
- "been initialized, i.e., it doesn't appear that DoF indices "
- "have been distributed on it."));
+ Assert(static_cast<unsigned int>(this->level()) <
+ this->dof_handler->levels.size(),
+ ExcMessage(
+ "The DoFHandler to which this accessor points has not "
+ "been initialized, i.e., it doesn't appear that DoF indices "
+ "have been distributed on it."));
switch (structdim)
{
ExcInternalError());
// now do the actual work
- dealii::internal::DoFAccessorImplementation::get_dof_indices(
- *this, dof_indices, fe_index);
+ dealii::internal::DoFAccessorImplementation::get_dof_indices(*this,
+ dof_indices,
+ fe_index);
}
Assert(false, ExcNotImplemented());
}
- internal::DoFAccessorImplementation::get_mg_dof_indices(
- *this, level, dof_indices, fe_index);
+ internal::DoFAccessorImplementation::get_mg_dof_indices(*this,
+ level,
+ dof_indices,
+ fe_index);
}
Assert(i == 0,
ExcMessage("You can only ask for line zero if the "
"current object is a line itself."));
- return typename dealii::internal::DoFHandlerImplementation::
- Iterators<DoFHandlerType, level_dof_access>::cell_iterator(
- &this->get_triangulation(),
- this->level(),
- this->index(),
- &this->get_dof_handler());
+ return typename dealii::internal::DoFHandlerImplementation::Iterators<
+ DoFHandlerType,
+ level_dof_access>::cell_iterator(&this->get_triangulation(),
+ this->level(),
+ this->index(),
+ &this->get_dof_handler());
}
// otherwise we need to be in structdim>=2
const Triangulation<1, spacedim> * tria,
const typename TriaAccessor<0, 1, spacedim>::VertexKind vertex_kind,
const unsigned int vertex_index,
- const DoFHandlerType<1, spacedim> * dof_handler) :
- BaseClass(tria, vertex_kind, vertex_index),
- dof_handler(const_cast<DoFHandlerType<1, spacedim> *>(dof_handler))
+ const DoFHandlerType<1, spacedim> * dof_handler)
+ : BaseClass(tria, vertex_kind, vertex_index)
+ , dof_handler(const_cast<DoFHandlerType<1, spacedim> *>(dof_handler))
{}
DoFAccessor(const Triangulation<1, spacedim> *,
const int,
const int,
- const DoFHandlerType<1, spacedim> *) :
- dof_handler(nullptr)
+ const DoFHandlerType<1, spacedim> *)
+ : dof_handler(nullptr)
{
- Assert(
- false,
- ExcMessage("This constructor can not be called for face iterators in 1d."));
+ Assert(false,
+ ExcMessage(
+ "This constructor can not be called for face iterators in 1d."));
}
{
for (unsigned int i = 0; i < dof_indices.size(); ++i)
dof_indices[i] = dealii::internal::DoFAccessorImplementation::
- Implementation::get_vertex_dof_index(
- *dof_handler, this->global_vertex_index, fe_index, i);
+ Implementation::get_vertex_dof_index(*dof_handler,
+ this->global_vertex_index,
+ fe_index,
+ i);
}
const unsigned int fe_index) const
{
return dealii::internal::DoFAccessorImplementation::Implementation::
- get_vertex_dof_index(
- *this->dof_handler, this->vertex_index(0), fe_index, i);
+ get_vertex_dof_index(*this->dof_handler,
+ this->vertex_index(0),
+ fe_index,
+ i);
}
vertex < GeometryInfo<dim>::vertices_per_cell;
++vertex)
for (unsigned int d = 0; d < dofs_per_vertex; ++d, ++index)
- accessor.set_vertex_dof_index(
- vertex, d, local_dof_indices[index], accessor.active_fe_index());
+ accessor.set_vertex_dof_index(vertex,
+ d,
+ local_dof_indices[index],
+ accessor.active_fe_index());
// now copy dof numbers into the line. for lines in 3d with the
// wrong orientation, we have already made sure that we're ok
// by picking the correct vertices (this happens automatically
local_dof_indices[index],
accessor.active_fe_index());
for (unsigned int d = 0; d < dofs_per_hex; ++d, ++index)
- accessor.set_dof_index(
- d, local_dof_indices[index], accessor.active_fe_index());
+ accessor.set_dof_index(d,
+ local_dof_indices[index],
+ accessor.active_fe_index());
Assert(index == accessor.get_fe().dofs_per_cell, ExcInternalError());
}
Assert(
accessor.dof_handler != nullptr,
(typename std::decay<decltype(accessor)>::type::ExcInvalidObject()));
- Assert(
- static_cast<unsigned int>(local_source_end - local_source_begin) ==
- accessor.get_fe().dofs_per_cell,
- (typename std::decay<decltype(
- accessor)>::type::ExcVectorDoesNotMatch()));
+ Assert(static_cast<unsigned int>(local_source_end -
+ local_source_begin) ==
+ accessor.get_fe().dofs_per_cell,
+ (typename std::decay<decltype(
+ accessor)>::type::ExcVectorDoesNotMatch()));
Assert(accessor.dof_handler->n_dofs() == global_destination.size(),
(typename std::decay<decltype(
accessor)>::type::ExcVectorDoesNotMatch()));
->cell_dof_indices_cache[accessor.present_index * n_dofs];
// distribute cell vector
- constraints.distribute_local_to_global(
- local_source_begin, local_source_end, dofs, global_destination);
+ constraints.distribute_local_to_global(local_source_begin,
+ local_source_end,
+ dofs,
+ global_destination);
}
DoFHandlerType::space_dimension> *tria,
const int level,
const int index,
- const AccessorData * local_data) :
- DoFAccessor<DoFHandlerType::dimension, DoFHandlerType, level_dof_access>(
- tria,
- level,
- index,
- local_data)
+ const AccessorData * local_data)
+ : DoFAccessor<DoFHandlerType::dimension, DoFHandlerType, level_dof_access>(
+ tria,
+ level,
+ index,
+ local_data)
{}
template <typename DoFHandlerType, bool level_dof_access>
template <int dim2, class DoFHandlerType2, bool level_dof_access2>
inline DoFCellAccessor<DoFHandlerType, level_dof_access>::DoFCellAccessor(
- const DoFAccessor<dim2, DoFHandlerType2, level_dof_access2> &other) :
- BaseClass(other)
+ const DoFAccessor<dim2, DoFHandlerType2, level_dof_access2> &other)
+ : BaseClass(other)
{}
this->dof_handler->levels[this->present_level]->get_cell_cache_start(
this->present_index, this->get_fe().dofs_per_cell);
dealii::internal::DoFAccessorImplementation::Implementation::
- extract_subvector_to(
- values, cache, cache + this->get_fe().dofs_per_cell, local_values_begin);
+ extract_subvector_to(values,
+ cache,
+ cache + this->get_fe().dofs_per_cell,
+ local_values_begin);
}
this->dof_handler->levels[this->present_level]->get_cell_cache_start(
this->present_index, this->get_fe().dofs_per_cell);
- constraints.get_dof_values(
- values, *cache, local_values_begin, local_values_end);
+ constraints.get_dof_values(values,
+ *cache,
+ local_values_begin,
+ local_values_end);
}
OutputVector & global_destination) const
{
dealii::internal::DoFCellAccessorImplementation::Implementation::
- distribute_local_to_global(
- *this, local_source.begin(), local_source.end(), global_destination);
+ distribute_local_to_global(*this,
+ local_source.begin(),
+ local_source.end(),
+ global_destination);
}
OutputVector & global_destination) const
{
dealii::internal::DoFCellAccessorImplementation::Implementation::
- distribute_local_to_global(
- *this, local_source_begin, local_source_end, global_destination);
+ distribute_local_to_global(*this,
+ local_source_begin,
+ local_source_end,
+ global_destination);
}
inline types::global_dof_index
DoFHandler<dim, spacedim>::n_dofs(const unsigned int level) const
{
- Assert(
- has_level_dofs(),
- ExcMessage("n_dofs(level) can only be called after distribute_mg_dofs()"));
+ Assert(has_level_dofs(),
+ ExcMessage(
+ "n_dofs(level) can only be called after distribute_mg_dofs()"));
Assert(level < mg_number_cache.size(), ExcInvalidLevel(level));
return mg_number_cache[level].n_global_dofs;
}
ar &n_cells &fe_name &policy_name;
- AssertThrow(
- n_cells == tria->n_cells(),
- ExcMessage("The object being loaded into does not match the triangulation "
- "that has been stored previously."));
+ AssertThrow(n_cells == tria->n_cells(),
+ ExcMessage(
+ "The object being loaded into does not match the triangulation "
+ "that has been stored previously."));
AssertThrow(
fe_name == this->get_fe(0).get_name(),
ExcMessage(
"The finite element associated with this DoFHandler does not match "
"the one that was associated with the DoFHandler previously stored."));
- AssertThrow(
- policy_name == internal::policy_to_string(*policy),
- ExcMessage("The policy currently associated with this DoFHandler (" +
- internal::policy_to_string(*policy) +
- ") does not match the one that was associated with the "
- "DoFHandler previously stored (" +
- policy_name + ")."));
+ AssertThrow(policy_name == internal::policy_to_string(*policy),
+ ExcMessage(
+ "The policy currently associated with this DoFHandler (" +
+ internal::policy_to_string(*policy) +
+ ") does not match the one that was associated with the "
+ "DoFHandler previously stored (" +
+ policy_name + ")."));
}
/**
* Constructor.
*/
- CompareDownstream(const Tensor<1, dim> &dir) : dir(dir)
+ CompareDownstream(const Tensor<1, dim> &dir)
+ : dir(dir)
{}
/**
* Return true if c1 less c2.
/**
* Constructor.
*/
- ComparePointwiseDownstream(const Tensor<1, dim> &dir) : dir(dir)
+ ComparePointwiseDownstream(const Tensor<1, dim> &dir)
+ : dir(dir)
{}
/**
* Return true if c1 less c2.
// -------------------- inline functions ---------------------
-inline BlockMask::BlockMask(const std::vector<bool> &block_mask) :
- block_mask(block_mask)
+inline BlockMask::BlockMask(const std::vector<bool> &block_mask)
+ : block_mask(block_mask)
{}
-inline BlockMask::BlockMask(const unsigned int n_blocks,
- const bool initializer) :
- block_mask(n_blocks, initializer)
+inline BlockMask::BlockMask(const unsigned int n_blocks, const bool initializer)
+ : block_mask(n_blocks, initializer)
{}
// -------------------- inline functions ---------------------
-inline ComponentMask::ComponentMask(const std::vector<bool> &component_mask) :
- component_mask(component_mask)
+inline ComponentMask::ComponentMask(const std::vector<bool> &component_mask)
+ : component_mask(component_mask)
{}
inline ComponentMask::ComponentMask(const unsigned int n_components,
- const bool initializer) :
- component_mask(n_components, initializer)
+ const bool initializer)
+ : component_mask(n_components, initializer)
{}
template <class PolynomialType, int dim, int spacedim>
FE_DGVector<PolynomialType, dim, spacedim>::FE_DGVector(const unsigned int deg,
- MappingType map) :
- FE_PolyTensor<PolynomialType, dim, spacedim>(
- deg,
- FiniteElementData<dim>(get_dpo_vector(deg),
- dim,
- deg + 1,
- FiniteElementData<dim>::L2),
- std::vector<bool>(PolynomialType::compute_n_pols(deg), true),
- std::vector<ComponentMask>(PolynomialType::compute_n_pols(deg),
- ComponentMask(dim, true)))
+ MappingType map)
+ : FE_PolyTensor<PolynomialType, dim, spacedim>(
+ deg,
+ FiniteElementData<dim>(get_dpo_vector(deg),
+ dim,
+ deg + 1,
+ FiniteElementData<dim>::L2),
+ std::vector<bool>(PolynomialType::compute_n_pols(deg), true),
+ std::vector<ComponentMask>(PolynomialType::compute_n_pols(deg),
+ ComponentMask(dim, true)))
{
this->mapping_type = map;
const unsigned int polynomial_degree = this->tensor_degree();
const PolynomialType & poly_space,
const FiniteElementData<dim> & fe_data,
const std::vector<bool> & restriction_is_additive_flags,
- const std::vector<ComponentMask> &nonzero_components) :
- FiniteElement<dim, spacedim>(fe_data,
- restriction_is_additive_flags,
- nonzero_components),
- poly_space(poly_space)
+ const std::vector<ComponentMask> &nonzero_components)
+ : FiniteElement<dim, spacedim>(fe_data,
+ restriction_is_additive_flags,
+ nonzero_components)
+ , poly_space(poly_space)
{
AssertDimension(dim, PolynomialType::dimension);
}
cell_similarity != CellSimilarity::translation)
{
for (unsigned int k = 0; k < this->dofs_per_cell; ++k)
- mapping.transform(
- make_array_view(fe_data.shape_3rd_derivatives, k),
- mapping_covariant_hessian,
- mapping_internal,
- make_array_view(output_data.shape_3rd_derivatives, k));
+ mapping.transform(make_array_view(fe_data.shape_3rd_derivatives, k),
+ mapping_covariant_hessian,
+ mapping_internal,
+ make_array_view(output_data.shape_3rd_derivatives,
+ k));
for (unsigned int k = 0; k < this->dofs_per_cell; ++k)
- correct_third_derivatives(
- output_data, mapping_data, quadrature.size(), k);
+ correct_third_derivatives(output_data,
+ mapping_data,
+ quadrature.size(),
+ k);
}
}
if (flags & update_3rd_derivatives)
{
for (unsigned int k = 0; k < this->dofs_per_cell; ++k)
- mapping.transform(
- make_array_view(
- fe_data.shape_3rd_derivatives, k, offset, quadrature.size()),
- mapping_covariant_hessian,
- mapping_internal,
- make_array_view(output_data.shape_3rd_derivatives, k));
+ mapping.transform(make_array_view(fe_data.shape_3rd_derivatives,
+ k,
+ offset,
+ quadrature.size()),
+ mapping_covariant_hessian,
+ mapping_internal,
+ make_array_view(output_data.shape_3rd_derivatives,
+ k));
for (unsigned int k = 0; k < this->dofs_per_cell; ++k)
- correct_third_derivatives(
- output_data, mapping_data, quadrature.size(), k);
+ correct_third_derivatives(output_data,
+ mapping_data,
+ quadrature.size(),
+ k);
}
}
if (flags & update_3rd_derivatives)
{
for (unsigned int k = 0; k < this->dofs_per_cell; ++k)
- mapping.transform(
- make_array_view(
- fe_data.shape_3rd_derivatives, k, offset, quadrature.size()),
- mapping_covariant_hessian,
- mapping_internal,
- make_array_view(output_data.shape_3rd_derivatives, k));
+ mapping.transform(make_array_view(fe_data.shape_3rd_derivatives,
+ k,
+ offset,
+ quadrature.size()),
+ mapping_covariant_hessian,
+ mapping_internal,
+ make_array_view(output_data.shape_3rd_derivatives,
+ k));
for (unsigned int k = 0; k < this->dofs_per_cell; ++k)
- correct_third_derivatives(
- output_data, mapping_data, quadrature.size(), k);
+ correct_third_derivatives(output_data,
+ mapping_data,
+ quadrature.size(),
+ k);
}
}
spacedim>
&output_data) const override
{
- return get_face_data(
- update_flags,
- mapping,
- QProjector<dim - 1>::project_to_all_children(quadrature),
- output_data);
+ return get_face_data(update_flags,
+ mapping,
+ QProjector<dim - 1>::project_to_all_children(
+ quadrature),
+ output_data);
}
virtual void
FE_PolyFace<PolynomialType, dim, spacedim>::FE_PolyFace(
const PolynomialType & poly_space,
const FiniteElementData<dim> &fe_data,
- const std::vector<bool> & restriction_is_additive_flags) :
- FiniteElement<dim, spacedim>(
- fe_data,
- restriction_is_additive_flags,
- std::vector<ComponentMask>(1, ComponentMask(1, true))),
- poly_space(poly_space)
+ const std::vector<bool> & restriction_is_additive_flags)
+ : FiniteElement<dim, spacedim>(
+ fe_data,
+ restriction_is_additive_flags,
+ std::vector<ComponentMask>(1, ComponentMask(1, true)))
+ , poly_space(poly_space)
{
AssertDimension(dim, PolynomialType::dimension + 1);
}
double
complex_mean_value(const std::complex<T> &value)
{
- AssertThrow(
- false,
- ExcMessage("FESeries::process_coefficients() can not be used with"
- "complex-valued coefficients and VectorTools::mean norm."));
+ AssertThrow(false,
+ ExcMessage(
+ "FESeries::process_coefficients() can not be used with"
+ "complex-valued coefficients and VectorTools::mean norm."));
return std::abs(value);
}
// of the std::enable_if.
template <int dim, int spacedim>
template <class... FEPairs, typename>
-FESystem<dim, spacedim>::FESystem(FEPairs &&... fe_pairs) :
- FESystem<dim, spacedim>(
- {promote_to_fe_pair<dim, spacedim>(std::forward<FEPairs>(fe_pairs))...})
+FESystem<dim, spacedim>::FESystem(FEPairs &&... fe_pairs)
+ : FESystem<dim, spacedim>(
+ {promote_to_fe_pair<dim, spacedim>(std::forward<FEPairs>(fe_pairs))...})
{}
FESystem<dim, spacedim>::FESystem(
const std::initializer_list<
std::pair<std::unique_ptr<FiniteElement<dim, spacedim>>, unsigned int>>
- &fe_systems) :
- FiniteElement<dim, spacedim>(
- FETools::Compositing::multiply_dof_numbers<dim, spacedim>(fe_systems),
- FETools::Compositing::compute_restriction_is_additive_flags<dim, spacedim>(
- fe_systems),
- FETools::Compositing::compute_nonzero_components<dim, spacedim>(
- fe_systems)),
- base_elements(count_nonzeros(fe_systems))
+ &fe_systems)
+ : FiniteElement<dim, spacedim>(
+ FETools::Compositing::multiply_dof_numbers<dim, spacedim>(fe_systems),
+ FETools::Compositing::compute_restriction_is_additive_flags<dim,
+ spacedim>(
+ fe_systems),
+ FETools::Compositing::compute_nonzero_components<dim, spacedim>(
+ fe_systems))
+ , base_elements(count_nonzeros(fe_systems))
{
std::vector<const FiniteElement<dim, spacedim> *> fes;
std::vector<unsigned int> multiplicities;
for (unsigned int m = 0; m < multiplicities[base]; ++m)
block_indices.push_back(fes[base]->dofs_per_cell);
- return FiniteElementData<dim>(
- dpo,
- (do_tensor_product ? multiplied_n_components : n_components),
- degree,
- total_conformity,
- block_indices);
+ return FiniteElementData<dim>(dpo,
+ (do_tensor_product ?
+ multiplied_n_components :
+ n_components),
+ degree,
+ total_conformity,
+ block_indices);
}
// Now check that all FEs have the same number of components:
for (unsigned int i = 0; i < fes.size(); ++i)
if (multiplicities[i] > 0) // needed because fe might be NULL
- Assert(
- n_components == fes[i]->n_components(),
- ExcDimensionMismatch(n_components, fes[i]->n_components()));
+ Assert(n_components == fes[i]->n_components(),
+ ExcDimensionMismatch(n_components,
+ fes[i]->n_components()));
}
// generate the array that will hold the output
- std::vector<std::vector<bool>> retval(
- n_shape_functions, std::vector<bool>(n_components, false));
+ std::vector<std::vector<bool>> retval(n_shape_functions,
+ std::vector<bool>(n_components,
+ false));
// finally go through all the shape functions of the base elements, and
// copy their flags. this somehow copies the code in build_cell_table,
fe_list.push_back(fe5);
multiplicities.push_back(N5);
- return compute_nonzero_components(
- fe_list, multiplicities, do_tensor_product);
+ return compute_nonzero_components(fe_list,
+ multiplicities,
+ do_tensor_product);
}
fe.base_element(base).dofs_per_line * line_number +
local_index);
- face_system_to_base_table[total_index] = std::make_pair(
- std::make_pair(base, m), face_index_in_base);
+ face_system_to_base_table[total_index] =
+ std::make_pair(std::make_pair(base, m),
+ face_index_in_base);
if (fe.base_element(base).is_primitive(index_in_base))
{
fe.base_element(base).dofs_per_quad * quad_number +
local_index);
- face_system_to_base_table[total_index] = std::make_pair(
- std::make_pair(base, m), face_index_in_base);
+ face_system_to_base_table[total_index] =
+ std::make_pair(std::make_pair(base, m),
+ face_index_in_base);
if (fe.base_element(base).is_primitive(index_in_base))
{
cell_number < GeometryInfo<dim>::max_children_per_face;
++cell_number)
{
- const Quadrature<dim> q_coarse = QProjector<dim>::project_to_subface(
- q_gauss, face_coarse, cell_number);
+ const Quadrature<dim> q_coarse =
+ QProjector<dim>::project_to_subface(q_gauss,
+ face_coarse,
+ cell_number);
FEValues<dim> coarse(mapping, fe, q_coarse, update_values);
typename Triangulation<dim, spacedim>::active_cell_iterator fine_cell =
Triangulation<dim, spacedim> tr;
GridGenerator::hyper_cube(tr, 0, 1);
- FEValues<dim, spacedim> coarse(
- fe, q_fine, update_JxW_values | update_values);
+ FEValues<dim, spacedim> coarse(fe,
+ q_fine,
+ update_JxW_values | update_values);
typename Triangulation<dim, spacedim>::cell_iterator coarse_cell =
tr.begin(0);
// find sub-quadrature
position = name.find('(');
const std::string subquadrature_name(name, 0, position);
- AssertThrow(
- subquadrature_name.compare("QTrapez") == 0,
- ExcNotImplemented("Could not detect quadrature of name " +
- subquadrature_name));
+ AssertThrow(subquadrature_name.compare("QTrapez") == 0,
+ ExcNotImplemented(
+ "Could not detect quadrature of name " +
+ subquadrature_name));
// delete "QTrapez(),"
name.erase(0, position + 3);
const std::pair<int, unsigned int> tmp =
}
catch (const std::string &errline)
{
- AssertThrow(
- false,
- ExcInvalidFEName(parameter_name + std::string(" at ") + errline));
+ AssertThrow(false,
+ ExcInvalidFEName(parameter_name + std::string(" at ") +
+ errline));
return nullptr;
}
}
double_support_point_values_imag.get()[i].reinit(
finite_element.n_components(), false);
- std::transform(
- std::begin(support_point_values[i]),
- std::end(support_point_values[i]),
- std::begin(double_support_point_values_real.get()[i]),
- [](std::complex<number> c) -> double { return c.real(); });
-
- std::transform(
- std::begin(support_point_values[i]),
- std::end(support_point_values[i]),
- std::begin(double_support_point_values_imag.get()[i]),
- [](std::complex<number> c) -> double { return c.imag(); });
+ std::transform(std::begin(support_point_values[i]),
+ std::end(support_point_values[i]),
+ std::begin(double_support_point_values_real.get()[i]),
+ [](std::complex<number> c) -> double {
+ return c.real();
+ });
+
+ std::transform(std::begin(support_point_values[i]),
+ std::end(support_point_values[i]),
+ std::begin(double_support_point_values_imag.get()[i]),
+ [](std::complex<number> c) -> double {
+ return c.imag();
+ });
}
finite_element.convert_generalized_support_point_values_to_dof_values(
finite_element.get_generalized_support_points().size());
AssertDimension(dof_values.size(), finite_element.dofs_per_cell);
- convert_helper<dim, spacedim>(
- finite_element, support_point_values, dof_values);
+ convert_helper<dim, spacedim>(finite_element,
+ support_point_values,
+ dof_values);
}
& tree_index_,
const typename DoFHandler<dim, spacedim>::cell_iterator &dealii_cell_,
const typename dealii::internal::p4est::types<dim>::quadrant
- &p4est_cell_) :
- forest(forest_),
- tree(tree_),
- tree_index(tree_index_),
- dealii_cell(dealii_cell_),
- p4est_cell(p4est_cell_)
+ &p4est_cell_)
+ : forest(forest_)
+ , tree(tree_)
+ , tree_index(tree_index_)
+ , dealii_cell(dealii_cell_)
+ , p4est_cell(p4est_cell_)
{}
};
template <int dim, int spacedim, class OutVector>
ExtrapolateImplementation<dim, spacedim, OutVector>::
- ExtrapolateImplementation() :
- round(0)
+ ExtrapolateImplementation()
+ : round(0)
{}
template <int dim, int spacedim, class OutVector>
- ExtrapolateImplementation<dim, spacedim, OutVector>::CellData::CellData() :
- tree_index(0),
- receiver(0)
+ ExtrapolateImplementation<dim, spacedim, OutVector>::CellData::CellData()
+ : tree_index(0)
+ , receiver(0)
{}
template <int dim, int spacedim, class OutVector>
ExtrapolateImplementation<dim, spacedim, OutVector>::CellData::CellData(
- const unsigned int dofs_per_cell) :
- tree_index(0),
- receiver(0)
+ const unsigned int dofs_per_cell)
+ : tree_index(0)
+ , receiver(0)
{
dof_values.reinit(dofs_per_cell);
}
// needs should come up
Assert(new_needs.size() == 0, ExcInternalError());
- set_dof_values_by_interpolation(
- dealii_cell, p4est_cell, interpolated_values, u2);
+ set_dof_values_by_interpolation(dealii_cell,
+ p4est_cell,
+ interpolated_values,
+ u2);
}
}
dealii_cell->get_dof_handler().get_fe();
const unsigned int dofs_per_cell = fe.dofs_per_cell;
- Assert(
- interpolated_values.size() == dofs_per_cell,
- ExcDimensionMismatch(interpolated_values.size(), dofs_per_cell));
+ Assert(interpolated_values.size() == dofs_per_cell,
+ ExcDimensionMismatch(interpolated_values.size(),
+ dofs_per_cell));
Assert(u.size() == dealii_cell->get_dof_handler().n_dofs(),
ExcDimensionMismatch(u.size(),
dealii_cell->get_dof_handler().n_dofs()));
fe.get_prolongation_matrix(c, dealii_cell->refinement_case())
.vmult(tmp, local_values);
- set_dof_values_by_interpolation(
- dealii_cell->child(c), p4est_child[c], tmp, u);
+ set_dof_values_by_interpolation(dealii_cell->child(c),
+ p4est_child[c],
+ tmp,
+ u);
}
}
}
compute_cells(dof2, u, cells_to_compute, computed_cells, new_needs);
// if there are no cells to compute and no new needs, stop
- ready = Utilities::MPI::sum(
- new_needs.size() + cells_to_compute.size(), communicator);
+ ready =
+ Utilities::MPI::sum(new_needs.size() + cells_to_compute.size(),
+ communicator);
for (typename std::vector<CellData>::const_iterator comp =
computed_cells.begin();
std_cxx14::make_unique<FullMatrix<double>>(dofs_per_cell2,
dofs_per_cell1);
- get_interpolation_matrix(
- cell1->get_fe(), cell2->get_fe(), *interpolation_matrix);
+ get_interpolation_matrix(cell1->get_fe(),
+ cell2->get_fe(),
+ *interpolation_matrix);
interpolation_matrices[&cell1->get_fe()][&cell2->get_fe()] =
std::move(interpolation_matrix);
const types::global_dof_index gdi = dofs[i];
if (u2_elements.is_element(gdi))
{
- ::dealii::internal::ElementAccess<OutVector>::add(
- u2_local(i), dofs[i], u2);
+ ::dealii::internal::ElementAccess<OutVector>::add(u2_local(i),
+ dofs[i],
+ u2);
::dealii::internal::ElementAccess<OutVector>::add(
1, dofs[i], touch_count);
}
const FiniteElement<dim, spacedim> & fe2,
OutVector & u1_interpolated)
{
- Assert(
- dof1.get_fe(0).n_components() == fe2.n_components(),
- ExcDimensionMismatch(dof1.get_fe(0).n_components(), fe2.n_components()));
+ Assert(dof1.get_fe(0).n_components() == fe2.n_components(),
+ ExcDimensionMismatch(dof1.get_fe(0).n_components(),
+ fe2.n_components()));
Assert(u1.size() == dof1.n_dofs(),
ExcDimensionMismatch(u1.size(), dof1.n_dofs()));
Assert(u1_interpolated.size() == dof1.n_dofs(),
const FiniteElement<dim, spacedim> &fe2,
OutVector & u1_difference)
{
- Assert(
- dof1.get_fe(0).n_components() == fe2.n_components(),
- ExcDimensionMismatch(dof1.get_fe(0).n_components(), fe2.n_components()));
+ Assert(dof1.get_fe(0).n_components() == fe2.n_components(),
+ ExcDimensionMismatch(dof1.get_fe(0).n_components(),
+ fe2.n_components()));
Assert(u1.size() == dof1.n_dofs(),
ExcDimensionMismatch(u1.size(), dof1.n_dofs()));
Assert(u1_difference.size() == dof1.n_dofs(),
cell2->get_dof_indices(dofs);
for (unsigned int i = 0; i < n2; ++i)
{
- ::dealii::internal::ElementAccess<OutVector>::add(
- u2_local(i), dofs[i], u2);
+ ::dealii::internal::ElementAccess<OutVector>::add(u2_local(i),
+ dofs[i],
+ u2);
}
++cell1;
inline const FEValuesViews::Scalar<dim, spacedim> &FEValuesBase<dim, spacedim>::
operator[](const FEValuesExtractors::Scalar &scalar) const
{
- Assert(
- scalar.component < fe_values_views_cache.scalars.size(),
- ExcIndexRange(scalar.component, 0, fe_values_views_cache.scalars.size()));
+ Assert(scalar.component < fe_values_views_cache.scalars.size(),
+ ExcIndexRange(scalar.component,
+ 0,
+ fe_values_views_cache.scalars.size()));
return fe_values_views_cache.scalars[scalar.component];
}
namespace FEValuesExtractors
{
- inline Scalar::Scalar() : component(numbers::invalid_unsigned_int)
+ inline Scalar::Scalar()
+ : component(numbers::invalid_unsigned_int)
{}
- inline Scalar::Scalar(const unsigned int component) : component(component)
+ inline Scalar::Scalar(const unsigned int component)
+ : component(component)
{}
- inline Vector::Vector() :
- first_vector_component(numbers::invalid_unsigned_int)
+ inline Vector::Vector()
+ : first_vector_component(numbers::invalid_unsigned_int)
{}
- inline Vector::Vector(const unsigned int first_vector_component) :
- first_vector_component(first_vector_component)
+ inline Vector::Vector(const unsigned int first_vector_component)
+ : first_vector_component(first_vector_component)
{}
template <int rank>
- inline SymmetricTensor<rank>::SymmetricTensor() :
- first_tensor_component(numbers::invalid_unsigned_int)
+ inline SymmetricTensor<rank>::SymmetricTensor()
+ : first_tensor_component(numbers::invalid_unsigned_int)
{}
template <int rank>
inline SymmetricTensor<rank>::SymmetricTensor(
- const unsigned int first_tensor_component) :
- first_tensor_component(first_tensor_component)
+ const unsigned int first_tensor_component)
+ : first_tensor_component(first_tensor_component)
{}
template <int rank>
- inline Tensor<rank>::Tensor() :
- first_tensor_component(numbers::invalid_unsigned_int)
+ inline Tensor<rank>::Tensor()
+ : first_tensor_component(numbers::invalid_unsigned_int)
{}
template <int rank>
- inline Tensor<rank>::Tensor(const unsigned int first_tensor_component) :
- first_tensor_component(first_tensor_component)
+ inline Tensor<rank>::Tensor(const unsigned int first_tensor_component)
+ : first_tensor_component(first_tensor_component)
{}
} // namespace FEValuesExtractors
const unsigned int shape_nr) const
{
Assert(qpoint * n_shape_functions + shape_nr < shape_values.size(),
- ExcIndexRange(
- qpoint * n_shape_functions + shape_nr, 0, shape_values.size()));
+ ExcIndexRange(qpoint * n_shape_functions + shape_nr,
+ 0,
+ shape_values.size()));
return shape_values[qpoint * n_shape_functions + shape_nr];
}
const unsigned int shape_nr)
{
Assert(qpoint * n_shape_functions + shape_nr < shape_values.size(),
- ExcIndexRange(
- qpoint * n_shape_functions + shape_nr, 0, shape_values.size()));
+ ExcIndexRange(qpoint * n_shape_functions + shape_nr,
+ 0,
+ shape_values.size()));
return shape_values[qpoint * n_shape_functions + shape_nr];
}
const unsigned int shape_nr) const
{
Assert(qpoint * n_shape_functions + shape_nr < shape_derivatives.size(),
- ExcIndexRange(
- qpoint * n_shape_functions + shape_nr, 0, shape_derivatives.size()));
+ ExcIndexRange(qpoint * n_shape_functions + shape_nr,
+ 0,
+ shape_derivatives.size()));
return shape_derivatives[qpoint * n_shape_functions + shape_nr];
}
const unsigned int shape_nr)
{
Assert(qpoint * n_shape_functions + shape_nr < shape_derivatives.size(),
- ExcIndexRange(
- qpoint * n_shape_functions + shape_nr, 0, shape_derivatives.size()));
+ ExcIndexRange(qpoint * n_shape_functions + shape_nr,
+ 0,
+ shape_derivatives.size()));
return shape_derivatives[qpoint * n_shape_functions + shape_nr];
}
int dim1,
int dim2>
CompositionManifold<dim, spacedim, chartdim, intermediate_dim, dim1, dim2>::
- CompositionManifold(
- const ChartManifold<dim1, intermediate_dim, chartdim> &F,
- const ChartManifold<dim2, spacedim, intermediate_dim> &G) :
- ChartManifold<dim, spacedim, chartdim>(F.get_periodicity()),
- F(&F),
- G(&G)
+ CompositionManifold(const ChartManifold<dim1, intermediate_dim, chartdim> &F,
+ const ChartManifold<dim2, spacedim, intermediate_dim> &G)
+ : ChartManifold<dim, spacedim, chartdim>(F.get_periodicity())
+ , F(&F)
+ , G(&G)
{
// We don't know what to do with a periodicity in the second manifold, so
// throw an assertion if the second manifold is periodic
template <typename BaseIterator>
template <typename Predicate>
-inline FilteredIterator<BaseIterator>::FilteredIterator(Predicate p) :
- predicate(new PredicateTemplate<Predicate>(p))
+inline FilteredIterator<BaseIterator>::FilteredIterator(Predicate p)
+ : predicate(new PredicateTemplate<Predicate>(p))
{}
template <typename BaseIterator>
template <typename Predicate>
-inline FilteredIterator<BaseIterator>::FilteredIterator(
- Predicate p,
- const BaseIterator &bi) :
- BaseIterator(bi),
- predicate(new PredicateTemplate<Predicate>(p))
+inline FilteredIterator<BaseIterator>::FilteredIterator(Predicate p,
+ const BaseIterator &bi)
+ : BaseIterator(bi)
+ , predicate(new PredicateTemplate<Predicate>(p))
{
if ((this->state() == IteratorState::valid) && !(*predicate)(*this))
set_to_next_positive(bi);
template <typename BaseIterator>
inline FilteredIterator<BaseIterator>::FilteredIterator(
- const FilteredIterator &fi) :
- // this construction looks strange, but without going through the
- // address of fi, GCC would not cast fi to the base class of type
- // BaseIterator but tries to go through constructing a new
- // BaseIterator with an Accessor.
- BaseIterator(*(BaseIterator *)(&fi)),
- predicate(fi.predicate->clone())
+ const FilteredIterator &fi)
+ : // this construction looks strange, but without going through the
+ // address of fi, GCC would not cast fi to the base class of type
+ // BaseIterator but tries to go through constructing a new
+ // BaseIterator with an Accessor.
+ BaseIterator(*(BaseIterator *)(&fi))
+ , predicate(fi.predicate->clone())
{}
template <typename BaseIterator>
template <typename Predicate>
inline FilteredIterator<BaseIterator>::PredicateTemplate<
- Predicate>::PredicateTemplate(const Predicate &predicate) :
- predicate(predicate)
+ Predicate>::PredicateTemplate(const Predicate &predicate)
+ : predicate(predicate)
{}
// ---------------- IteratorFilters::LevelEqualTo ---------
- inline LevelEqualTo::LevelEqualTo(const unsigned int level) : level(level)
+ inline LevelEqualTo::LevelEqualTo(const unsigned int level)
+ : level(level)
{}
// ---------------- IteratorFilters::SubdomainEqualTo ---------
inline SubdomainEqualTo::SubdomainEqualTo(
- const types::subdomain_id subdomain_id) :
- subdomain_id(subdomain_id)
+ const types::subdomain_id subdomain_id)
+ : subdomain_id(subdomain_id)
{}
// ---------------- IteratorFilters::MaterialIdEqualTo ---------
inline MaterialIdEqualTo::MaterialIdEqualTo(
const types::material_id material_id,
- const bool only_locally_owned) :
- material_ids{material_id},
- only_locally_owned(only_locally_owned)
+ const bool only_locally_owned)
+ : material_ids{material_id}
+ , only_locally_owned(only_locally_owned)
{}
inline MaterialIdEqualTo::MaterialIdEqualTo(
const std::set<types::material_id> &material_ids,
- const bool only_locally_owned) :
- material_ids(material_ids),
- only_locally_owned(only_locally_owned)
+ const bool only_locally_owned)
+ : material_ids(material_ids)
+ , only_locally_owned(only_locally_owned)
{}
// ---------------- IteratorFilters::ActiveFEIndexEqualTo ---------
inline ActiveFEIndexEqualTo::ActiveFEIndexEqualTo(
const unsigned int active_fe_index,
- const bool only_locally_owned) :
- active_fe_indices{active_fe_index},
- only_locally_owned(only_locally_owned)
+ const bool only_locally_owned)
+ : active_fe_indices{active_fe_index}
+ , only_locally_owned(only_locally_owned)
{}
inline ActiveFEIndexEqualTo::ActiveFEIndexEqualTo(
const std::set<unsigned int> &active_fe_indices,
- const bool only_locally_owned) :
- active_fe_indices(active_fe_indices),
- only_locally_owned(only_locally_owned)
+ const bool only_locally_owned)
+ : active_fe_indices(active_fe_indices)
+ , only_locally_owned(only_locally_owned)
{}
{
const std::vector<typename MeshType::active_cell_iterator>
children = get_active_child_cells<MeshType>(cell->child(child));
- child_cells.insert(
- child_cells.end(), children.begin(), children.end());
+ child_cells.insert(child_cells.end(),
+ children.begin(),
+ children.end());
}
else
child_cells.push_back(cell->child(child));
};
inline CrossDerivative::CrossDerivative(const unsigned int d0,
- const unsigned int d1) :
- direction_0(d0),
- direction_1(d1)
+ const unsigned int d1)
+ : direction_0(d0)
+ , direction_1(d1)
{}
ExcMessage("This function assumes that the last weight is a "
"dependent variable (and hence we cannot take its "
"derivative directly)."));
- Assert(
- row_n != dependent_direction,
- ExcMessage("We cannot differentiate with respect to the variable "
- "that is assumed to be dependent."));
+ Assert(row_n != dependent_direction,
+ ExcMessage(
+ "We cannot differentiate with respect to the variable "
+ "that is assumed to be dependent."));
const Point<spacedim> manifold_point = f(center);
const Tensor<1, spacedim> stencil_value = cross_stencil<structdim>(
for (unsigned int i = 0;
i < GeometryInfo<structdim>::vertices_per_cell;
++i)
- F_k += (x_k - trial_point) * object->vertex(i) *
- GeometryInfo<structdim>::d_linear_shape_function_gradient(
- xi, i);
+ F_k +=
+ (x_k - trial_point) * object->vertex(i) *
+ GeometryInfo<structdim>::d_linear_shape_function_gradient(xi,
+ i);
Tensor<2, structdim> H_k;
for (unsigned int i = 0;
(void)mesh;
(void)pack;
(void)unpack;
- Assert(
- false,
- ExcMessage("GridTools::exchange_cell_data_to_ghosts() requires MPI."));
+ Assert(false,
+ ExcMessage(
+ "GridTools::exchange_cell_data_to_ghosts() requires MPI."));
# else
constexpr int dim = MeshType::dimension;
constexpr int spacedim = MeshType::space_dimension;
if (send_to.size() > 0)
{
// this cell's data needs to be sent to someone
- typename MeshType::active_cell_iterator mesh_it(
- tria, cell->level(), cell->index(), &mesh);
+ typename MeshType::active_cell_iterator mesh_it(tria,
+ cell->level(),
+ cell->index(),
+ &mesh);
const boost::optional<DataType> data = pack(mesh_it);
chartdim_B>::
TensorProductManifold(
const ChartManifold<dim_A, spacedim_A, chartdim_A> &manifold_A,
- const ChartManifold<dim_B, spacedim_B, chartdim_B> &manifold_B) :
- ChartManifold<dim, spacedim_A + spacedim_B, chartdim_A + chartdim_B>(
- internal::TensorProductManifoldImplementation::concat(
- manifold_A.get_periodicity(),
- manifold_B.get_periodicity())),
- manifold_A(&manifold_A),
- manifold_B(&manifold_B)
+ const ChartManifold<dim_B, spacedim_B, chartdim_B> &manifold_B)
+ : ChartManifold<dim, spacedim_A + spacedim_B, chartdim_A + chartdim_B>(
+ internal::TensorProductManifoldImplementation::concat(
+ manifold_A.get_periodicity(),
+ manifold_B.get_periodicity()))
+ , manifold_A(&manifold_A)
+ , manifold_B(&manifold_B)
{}
template <int dim,
{
Point<spacedim_A> space_point_A;
Point<spacedim_B> space_point_B;
- internal::TensorProductManifoldImplementation::split_point(
- space_point, space_point_A, space_point_B);
+ internal::TensorProductManifoldImplementation::split_point(space_point,
+ space_point_A,
+ space_point_B);
Point<chartdim_A> result_A = manifold_A->pull_back(space_point_A);
Point<chartdim_B> result_B = manifold_B->pull_back(space_point_B);
{
Point<chartdim_A> chart_point_A;
Point<chartdim_B> chart_point_B;
- internal::TensorProductManifoldImplementation::split_point(
- chart_point, chart_point_A, chart_point_B);
+ internal::TensorProductManifoldImplementation::split_point(chart_point,
+ chart_point_A,
+ chart_point_B);
Point<spacedim_A> result_A = manifold_A->push_forward(chart_point_A);
Point<spacedim_B> result_B = manifold_B->push_forward(chart_point_B);
{
Point<chartdim_A> chart_point_A;
Point<chartdim_B> chart_point_B;
- internal::TensorProductManifoldImplementation::split_point(
- chart_point, chart_point_A, chart_point_B);
+ internal::TensorProductManifoldImplementation::split_point(chart_point,
+ chart_point_A,
+ chart_point_B);
DerivativeForm<1, chartdim_A, spacedim_A> result_A =
manifold_A->push_forward_gradient(chart_point_A);
const Triangulation<dim, spacedim> *tria,
const int level,
const int index,
- const AccessorData *) :
- present_level((structdim == dim) ? level : 0),
- present_index(index),
- tria(tria)
+ const AccessorData *)
+ : present_level((structdim == dim) ? level : 0)
+ , present_index(index)
+ , tria(tria)
{
// non-cells have no level, so a 0
// should have been passed, or a -1
template <int structdim, int dim, int spacedim>
inline TriaAccessorBase<structdim, dim, spacedim>::TriaAccessorBase(
- const TriaAccessorBase<structdim, dim, spacedim> &a) :
- present_level(a.present_level),
- present_index(a.present_index),
- tria(a.tria)
+ const TriaAccessorBase<structdim, dim, spacedim> &a)
+ : present_level(a.present_level)
+ , present_index(a.present_index)
+ , tria(a.tria)
{}
template <int structdim, int dim, int spacedim>
InvalidAccessor<structdim, dim, spacedim>::InvalidAccessor(
- const InvalidAccessor &i) :
- TriaAccessorBase<structdim, dim, spacedim>(
- static_cast<const TriaAccessorBase<structdim, dim, spacedim> &>(i))
+ const InvalidAccessor &i)
+ : TriaAccessorBase<structdim, dim, spacedim>(
+ static_cast<const TriaAccessorBase<structdim, dim, spacedim> &>(i))
{
Assert(false,
ExcMessage("You are attempting an illegal conversion between "
face_orientation(const TriaAccessor<3, dim, spacedim> &accessor,
const unsigned int face)
{
- return (
- accessor.tria->levels[accessor.present_level]->cells.face_orientation(
- accessor.present_index, face));
+ return (accessor.tria->levels[accessor.present_level]
+ ->cells.face_orientation(accessor.present_index, face));
}
const Triangulation<dim, spacedim> *parent,
const int level,
const int index,
- const AccessorData * local_data) :
- TriaAccessorBase<structdim, dim, spacedim>(parent, level, index, local_data)
+ const AccessorData * local_data)
+ : TriaAccessorBase<structdim, dim, spacedim>(parent, level, index, local_data)
{}
inline bool
TriaAccessor<structdim, dim, spacedim>::used() const
{
- Assert(
- this->state() == IteratorState::valid,
- TriaAccessorExceptions::ExcDereferenceInvalidObject<TriaAccessor>(*this));
+ Assert(this->state() == IteratorState::valid,
+ TriaAccessorExceptions::ExcDereferenceInvalidObject<TriaAccessor>(
+ *this));
return this->objects().used[this->present_index];
}
TriaAccessor<structdim, dim, spacedim>::vertex_iterator(
const unsigned int i) const
{
- return TriaIterator<TriaAccessor<0, dim, spacedim>>(
- this->tria, 0, vertex_index(i));
+ return TriaIterator<TriaAccessor<0, dim, spacedim>>(this->tria,
+ 0,
+ vertex_index(i));
}
void
TriaAccessor<structdim, dim, spacedim>::set_used_flag() const
{
- Assert(
- this->state() == IteratorState::valid,
- TriaAccessorExceptions::ExcDereferenceInvalidObject<TriaAccessor>(*this));
+ Assert(this->state() == IteratorState::valid,
+ TriaAccessorExceptions::ExcDereferenceInvalidObject<TriaAccessor>(
+ *this));
this->objects().used[this->present_index] = true;
}
void
TriaAccessor<structdim, dim, spacedim>::clear_used_flag() const
{
- Assert(
- this->state() == IteratorState::valid,
- TriaAccessorExceptions::ExcDereferenceInvalidObject<TriaAccessor>(*this));
+ Assert(this->state() == IteratorState::valid,
+ TriaAccessorExceptions::ExcDereferenceInvalidObject<TriaAccessor>(
+ *this));
this->objects().used[this->present_index] = false;
}
RefinementCase<structdim>
TriaAccessor<structdim, dim, spacedim>::refinement_case() const
{
- Assert(
- this->state() == IteratorState::valid,
- TriaAccessorExceptions::ExcDereferenceInvalidObject<TriaAccessor>(*this));
+ Assert(this->state() == IteratorState::valid,
+ TriaAccessorExceptions::ExcDereferenceInvalidObject<TriaAccessor>(
+ *this));
switch (structdim)
{
inline bool
TriaAccessor<structdim, dim, spacedim>::has_children() const
{
- Assert(
- this->state() == IteratorState::valid,
- TriaAccessorExceptions::ExcDereferenceInvalidObject<TriaAccessor>(*this));
+ Assert(this->state() == IteratorState::valid,
+ TriaAccessorExceptions::ExcDereferenceInvalidObject<TriaAccessor>(
+ *this));
// each set of two children are stored
// consecutively, so we only have to find
TriaAccessor<structdim, dim, spacedim>::set_refinement_case(
const RefinementCase<structdim> &refinement_case) const
{
- Assert(
- this->state() == IteratorState::valid,
- TriaAccessorExceptions::ExcDereferenceInvalidObject<TriaAccessor>(*this));
+ Assert(this->state() == IteratorState::valid,
+ TriaAccessorExceptions::ExcDereferenceInvalidObject<TriaAccessor>(
+ *this));
Assert(static_cast<unsigned int>(this->present_index) <
this->objects().refinement_cases.size(),
- ExcIndexRange(
- this->present_index, 0, this->objects().refinement_cases.size()));
+ ExcIndexRange(this->present_index,
+ 0,
+ this->objects().refinement_cases.size()));
this->objects().refinement_cases[this->present_index] = refinement_case;
}
inline void
TriaAccessor<structdim, dim, spacedim>::clear_refinement_case() const
{
- Assert(
- this->state() == IteratorState::valid,
- TriaAccessorExceptions::ExcDereferenceInvalidObject<TriaAccessor>(*this));
+ Assert(this->state() == IteratorState::valid,
+ TriaAccessorExceptions::ExcDereferenceInvalidObject<TriaAccessor>(
+ *this));
Assert(static_cast<unsigned int>(this->present_index) <
this->objects().refinement_cases.size(),
- ExcIndexRange(
- this->present_index, 0, this->objects().refinement_cases.size()));
+ ExcIndexRange(this->present_index,
+ 0,
+ this->objects().refinement_cases.size()));
this->objects().refinement_cases[this->present_index] =
RefinementCase<structdim>::no_refinement;
is_initial_guess_vertex;
// First let all the vertices be outside
- std::fill(
- is_initial_guess_vertex.begin(), is_initial_guess_vertex.end(), false);
+ std::fill(is_initial_guess_vertex.begin(),
+ is_initial_guess_vertex.end(),
+ false);
// Get an initial guess by looking at the largest diagonal
Point<spacedim> center;
const Point<spacedim> p61(this->vertex(6) - this->vertex(1));
const Point<spacedim> p25(this->vertex(2) - this->vertex(5));
const Point<spacedim> p34(this->vertex(3) - this->vertex(4));
- const std::vector<double> diagonals = {
- p70.norm(), p61.norm(), p25.norm(), p34.norm()};
+ const std::vector<double> diagonals = {p70.norm(),
+ p61.norm(),
+ p25.norm(),
+ p34.norm()};
const std::vector<double>::const_iterator it =
std::max_element(diagonals.begin(), diagonals.end());
if (it == diagonals.begin())
template <int dim, int spacedim>
inline TriaAccessor<0, dim, spacedim>::TriaAccessor(
const Triangulation<dim, spacedim> *tria,
- const unsigned int vertex_index) :
- tria(tria),
- global_vertex_index(vertex_index)
+ const unsigned int vertex_index)
+ : tria(tria)
+ , global_vertex_index(vertex_index)
{}
const Triangulation<dim, spacedim> *tria,
const int /*level*/,
const int index,
- const AccessorData *) :
- tria(tria),
- global_vertex_index(index)
+ const AccessorData *)
+ : tria(tria)
+ , global_vertex_index(index)
{}
template <int dim, int spacedim>
template <int structdim2, int dim2, int spacedim2>
inline TriaAccessor<0, dim, spacedim>::TriaAccessor(
- const TriaAccessor<structdim2, dim2, spacedim2> &) :
- tria(nullptr),
- global_vertex_index(numbers::invalid_unsigned_int)
+ const TriaAccessor<structdim2, dim2, spacedim2> &)
+ : tria(nullptr)
+ , global_vertex_index(numbers::invalid_unsigned_int)
{
Assert(false, ExcImpossibleInDim(0));
}
template <int dim, int spacedim>
template <int structdim2, int dim2, int spacedim2>
inline TriaAccessor<0, dim, spacedim>::TriaAccessor(
- const InvalidAccessor<structdim2, dim2, spacedim2> &) :
- tria(nullptr),
- global_vertex_index(numbers::invalid_unsigned_int)
+ const InvalidAccessor<structdim2, dim2, spacedim2> &)
+ : tria(nullptr)
+ , global_vertex_index(numbers::invalid_unsigned_int)
{
Assert(false, ExcImpossibleInDim(0));
}
inline TriaAccessor<0, 1, spacedim>::TriaAccessor(
const Triangulation<1, spacedim> *tria,
const VertexKind vertex_kind,
- const unsigned int vertex_index) :
- tria(tria),
- vertex_kind(vertex_kind),
- global_vertex_index(vertex_index)
+ const unsigned int vertex_index)
+ : tria(tria)
+ , vertex_kind(vertex_kind)
+ , global_vertex_index(vertex_index)
{}
const Triangulation<1, spacedim> *tria,
const int level,
const int index,
- const AccessorData *) :
- tria(tria),
- vertex_kind(interior_vertex),
- global_vertex_index(numbers::invalid_unsigned_int)
+ const AccessorData *)
+ : tria(tria)
+ , vertex_kind(interior_vertex)
+ , global_vertex_index(numbers::invalid_unsigned_int)
{
// in general, calling this constructor should yield an error -- users should
// instead call the one immediately above. however, if you create something
template <int spacedim>
template <int structdim2, int dim2, int spacedim2>
inline TriaAccessor<0, 1, spacedim>::TriaAccessor(
- const TriaAccessor<structdim2, dim2, spacedim2> &) :
- tria(nullptr),
- vertex_kind(interior_vertex),
- global_vertex_index(numbers::invalid_unsigned_int)
+ const TriaAccessor<structdim2, dim2, spacedim2> &)
+ : tria(nullptr)
+ , vertex_kind(interior_vertex)
+ , global_vertex_index(numbers::invalid_unsigned_int)
{
Assert(false, ExcImpossibleInDim(0));
}
template <int spacedim>
template <int structdim2, int dim2, int spacedim2>
inline TriaAccessor<0, 1, spacedim>::TriaAccessor(
- const InvalidAccessor<structdim2, dim2, spacedim2> &) :
- tria(nullptr),
- vertex_kind(interior_vertex),
- global_vertex_index(numbers::invalid_unsigned_int)
+ const InvalidAccessor<structdim2, dim2, spacedim2> &)
+ : tria(nullptr)
+ , vertex_kind(interior_vertex)
+ , global_vertex_index(numbers::invalid_unsigned_int)
{
Assert(false, ExcImpossibleInDim(0));
}
case left_vertex:
case right_vertex:
{
- Assert(
- tria->vertex_to_boundary_id_map_1d->find(this->vertex_index()) !=
- tria->vertex_to_boundary_id_map_1d->end(),
- ExcInternalError());
+ Assert(tria->vertex_to_boundary_id_map_1d->find(
+ this->vertex_index()) !=
+ tria->vertex_to_boundary_id_map_1d->end(),
+ ExcInternalError());
return (*tria->vertex_to_boundary_id_map_1d)[this->vertex_index()];
}
const Triangulation<dim, spacedim> *parent,
const int level,
const int index,
- const AccessorData * local_data) :
- TriaAccessor<dim, dim, spacedim>(parent, level, index, local_data)
+ const AccessorData * local_data)
+ : TriaAccessor<dim, dim, spacedim>(parent, level, index, local_data)
{}
template <int dim, int spacedim>
inline CellAccessor<dim, spacedim>::CellAccessor(
- const TriaAccessor<dim, dim, spacedim> &cell_accessor) :
- TriaAccessor<dim, dim, spacedim>(
- static_cast<const TriaAccessor<dim, dim, spacedim> &>(cell_accessor))
+ const TriaAccessor<dim, dim, spacedim> &cell_accessor)
+ : TriaAccessor<dim, dim, spacedim>(
+ static_cast<const TriaAccessor<dim, dim, spacedim> &>(cell_accessor))
{}
inline TriaIterator<CellAccessor<dim, spacedim>>
CellAccessor<dim, spacedim>::neighbor(const unsigned int i) const
{
- TriaIterator<CellAccessor<dim, spacedim>> q(
- this->tria, neighbor_level(i), neighbor_index(i));
+ TriaIterator<CellAccessor<dim, spacedim>> q(this->tria,
+ neighbor_level(i),
+ neighbor_index(i));
Assert((q.state() == IteratorState::past_the_end) || q->used(),
ExcInternalError());
inline TriaIterator<CellAccessor<dim, spacedim>>
CellAccessor<dim, spacedim>::child(const unsigned int i) const
{
- TriaIterator<CellAccessor<dim, spacedim>> q(
- this->tria, this->present_level + 1, this->child_index(i));
+ TriaIterator<CellAccessor<dim, spacedim>> q(this->tria,
+ this->present_level + 1,
+ this->child_index(i));
Assert((q.state() == IteratorState::past_the_end) || q->used(),
ExcInternalError());
template <typename Accessor>
-inline TriaRawIterator<Accessor>::TriaRawIterator(const Accessor &a) :
- accessor(a)
+inline TriaRawIterator<Accessor>::TriaRawIterator(const Accessor &a)
+ : accessor(a)
{}
template <typename Accessor>
template <typename OtherAccessor>
-inline TriaRawIterator<Accessor>::TriaRawIterator(const OtherAccessor &a) :
- accessor(a)
+inline TriaRawIterator<Accessor>::TriaRawIterator(const OtherAccessor &a)
+ : accessor(a)
{}
template <typename Accessor>
template <typename OtherAccessor>
inline TriaRawIterator<Accessor>::TriaRawIterator(
- const TriaRawIterator<OtherAccessor> &i) :
- accessor(i.accessor)
+ const TriaRawIterator<OtherAccessor> &i)
+ : accessor(i.accessor)
{}
template <typename Accessor>
template <typename OtherAccessor>
inline TriaRawIterator<Accessor>::TriaRawIterator(
- const TriaIterator<OtherAccessor> &i) :
- accessor(i.accessor)
+ const TriaIterator<OtherAccessor> &i)
+ : accessor(i.accessor)
{}
template <typename Accessor>
template <typename OtherAccessor>
inline TriaRawIterator<Accessor>::TriaRawIterator(
- const TriaActiveIterator<OtherAccessor> &i) :
- accessor(i.accessor)
+ const TriaActiveIterator<OtherAccessor> &i)
+ : accessor(i.accessor)
{}
template <typename Accessor>
template <typename OtherAccessor>
inline TriaIterator<Accessor>::TriaIterator(
- const TriaIterator<OtherAccessor> &i) :
- TriaRawIterator<Accessor>(i.accessor)
+ const TriaIterator<OtherAccessor> &i)
+ : TriaRawIterator<Accessor>(i.accessor)
{}
template <typename Accessor>
template <typename OtherAccessor>
inline TriaIterator<Accessor>::TriaIterator(
- const TriaActiveIterator<OtherAccessor> &i) :
- TriaRawIterator<Accessor>(i.accessor)
+ const TriaActiveIterator<OtherAccessor> &i)
+ : TriaRawIterator<Accessor>(i.accessor)
{}
template <typename Accessor>
template <typename OtherAccessor>
inline TriaIterator<Accessor>::TriaIterator(
- const TriaRawIterator<OtherAccessor> &i) :
- TriaRawIterator<Accessor>(i.accessor)
+ const TriaRawIterator<OtherAccessor> &i)
+ : TriaRawIterator<Accessor>(i.accessor)
{
# ifdef DEBUG
// do this like this, because:
template <typename Accessor>
template <typename OtherAccessor>
-TriaIterator<Accessor>::TriaIterator(const OtherAccessor &a) :
- TriaRawIterator<Accessor>(a)
+TriaIterator<Accessor>::TriaIterator(const OtherAccessor &a)
+ : TriaRawIterator<Accessor>(a)
{
# ifdef DEBUG
// do this like this, because:
template <typename Accessor>
template <typename OtherAccessor>
inline TriaActiveIterator<Accessor>::TriaActiveIterator(
- const TriaActiveIterator<OtherAccessor> &i) :
- TriaIterator<Accessor>(i.accessor)
+ const TriaActiveIterator<OtherAccessor> &i)
+ : TriaIterator<Accessor>(i.accessor)
{}
template <typename Accessor>
template <typename OtherAccessor>
inline TriaActiveIterator<Accessor>::TriaActiveIterator(
- const TriaRawIterator<OtherAccessor> &i) :
- TriaIterator<Accessor>(i)
+ const TriaRawIterator<OtherAccessor> &i)
+ : TriaIterator<Accessor>(i)
{
# ifdef DEBUG
// do this like this, because:
template <typename Accessor>
-inline TriaRawIterator<Accessor>::TriaRawIterator() :
- accessor(nullptr, -2, -2, nullptr)
+inline TriaRawIterator<Accessor>::TriaRawIterator()
+ : accessor(nullptr, -2, -2, nullptr)
{}
template <typename Accessor>
inline TriaRawIterator<Accessor>::TriaRawIterator(
- const TriaRawIterator<Accessor> &i) :
- accessor(i.accessor)
+ const TriaRawIterator<Accessor> &i)
+ : accessor(i.accessor)
{}
const Triangulation<Accessor::dimension, Accessor::space_dimension> *parent,
const int level,
const int index,
- const typename Accessor::AccessorData *local_data) :
- accessor(parent, level, index, local_data)
+ const typename Accessor::AccessorData *local_data)
+ : accessor(parent, level, index, local_data)
{}
const TriaAccessorBase<Accessor::structure_dimension,
Accessor::dimension,
Accessor::space_dimension> &tria_accessor,
- const typename Accessor::AccessorData * local_data) :
- accessor(nullptr, -2, -2, local_data)
+ const typename Accessor::AccessorData * local_data)
+ : accessor(nullptr, -2, -2, local_data)
{
accessor.copy_from(tria_accessor);
}
template <typename Accessor>
-inline TriaIterator<Accessor>::TriaIterator() : TriaRawIterator<Accessor>()
+inline TriaIterator<Accessor>::TriaIterator()
+ : TriaRawIterator<Accessor>()
{}
template <typename Accessor>
-inline TriaIterator<Accessor>::TriaIterator(const TriaIterator<Accessor> &i) :
- TriaRawIterator<Accessor>(i.accessor)
+inline TriaIterator<Accessor>::TriaIterator(const TriaIterator<Accessor> &i)
+ : TriaRawIterator<Accessor>(i.accessor)
{}
template <typename Accessor>
-inline TriaIterator<Accessor>::TriaIterator(
- const TriaRawIterator<Accessor> &i) :
- TriaRawIterator<Accessor>(i.accessor)
+inline TriaIterator<Accessor>::TriaIterator(const TriaRawIterator<Accessor> &i)
+ : TriaRawIterator<Accessor>(i.accessor)
{
#ifdef DEBUG
// do this like this, because:
const Triangulation<Accessor::dimension, Accessor::space_dimension> *parent,
const int level,
const int index,
- const typename Accessor::AccessorData *local_data) :
- TriaRawIterator<Accessor>(parent, level, index, local_data)
+ const typename Accessor::AccessorData *local_data)
+ : TriaRawIterator<Accessor>(parent, level, index, local_data)
{
#ifdef DEBUG
// do this like this, because:
const TriaAccessorBase<Accessor::structure_dimension,
Accessor::dimension,
Accessor::space_dimension> &tria_accessor,
- const typename Accessor::AccessorData * local_data) :
- TriaRawIterator<Accessor>(tria_accessor, local_data)
+ const typename Accessor::AccessorData * local_data)
+ : TriaRawIterator<Accessor>(tria_accessor, local_data)
{
#ifdef DEBUG
// do this like this, because:
template <typename Accessor>
-inline TriaActiveIterator<Accessor>::TriaActiveIterator() :
- TriaIterator<Accessor>()
+inline TriaActiveIterator<Accessor>::TriaActiveIterator()
+ : TriaIterator<Accessor>()
{}
template <typename Accessor>
inline TriaActiveIterator<Accessor>::TriaActiveIterator(
- const TriaActiveIterator<Accessor> &i) :
- TriaIterator<Accessor>(static_cast<TriaIterator<Accessor>>(i))
+ const TriaActiveIterator<Accessor> &i)
+ : TriaIterator<Accessor>(static_cast<TriaIterator<Accessor>>(i))
{}
template <typename Accessor>
inline TriaActiveIterator<Accessor>::TriaActiveIterator(
- const TriaRawIterator<Accessor> &i) :
- TriaIterator<Accessor>(i)
+ const TriaRawIterator<Accessor> &i)
+ : TriaIterator<Accessor>(i)
{
#ifdef DEBUG
// do this like this, because:
template <typename Accessor>
inline TriaActiveIterator<Accessor>::TriaActiveIterator(
- const TriaIterator<Accessor> &i) :
- TriaIterator<Accessor>(i)
+ const TriaIterator<Accessor> &i)
+ : TriaIterator<Accessor>(i)
{
#ifdef DEBUG
// do this like this, because:
const Triangulation<Accessor::dimension, Accessor::space_dimension> *parent,
const int level,
const int index,
- const typename Accessor::AccessorData *local_data) :
- TriaIterator<Accessor>(parent, level, index, local_data)
+ const typename Accessor::AccessorData *local_data)
+ : TriaIterator<Accessor>(parent, level, index, local_data)
{
#ifdef DEBUG
// do this like this, because:
const TriaAccessorBase<Accessor::structure_dimension,
Accessor::dimension,
Accessor::space_dimension> &tria_accessor,
- const typename Accessor::AccessorData * local_data) :
- TriaIterator<Accessor>(tria_accessor, local_data)
+ const typename Accessor::AccessorData * local_data)
+ : TriaIterator<Accessor>(tria_accessor, local_data)
{
#ifdef DEBUG
// do this like this, because:
template <typename G>
- inline TriaObjects<G>::TriaObjects() :
- next_free_single(numbers::invalid_unsigned_int),
- next_free_pair(numbers::invalid_unsigned_int),
- reverse_order_next_free_single(false),
- user_data_type(data_unknown)
+ inline TriaObjects<G>::TriaObjects()
+ : next_free_single(numbers::invalid_unsigned_int)
+ , next_free_pair(numbers::invalid_unsigned_int)
+ , reverse_order_next_free_single(false)
+ , user_data_type(data_unknown)
{}
TriaObjectsHex::face_orientation(const unsigned int cell,
const unsigned int face) const
{
- Assert(
- cell < face_orientations.size() / GeometryInfo<3>::faces_per_cell,
- ExcIndexRange(
- 0, cell, face_orientations.size() / GeometryInfo<3>::faces_per_cell));
+ Assert(cell < face_orientations.size() / GeometryInfo<3>::faces_per_cell,
+ ExcIndexRange(0,
+ cell,
+ face_orientations.size() /
+ GeometryInfo<3>::faces_per_cell));
Assert(face < GeometryInfo<3>::faces_per_cell,
ExcIndexRange(0, face, GeometryInfo<3>::faces_per_cell));
const unsigned int local_index,
const unsigned int /*obj_level*/) const
{
- Assert(
- (fe_index != dealii::hp::DoFHandler<dim, spacedim>::default_fe_index),
- ExcMessage("You need to specify a FE index when working "
- "with hp DoFHandlers"));
- Assert(
- fe_index < dof_handler.get_fe_collection().size(),
- ExcIndexRange(fe_index, 0, dof_handler.get_fe_collection().size()));
- Assert(
- local_index <
- dof_handler.get_fe(fe_index).template n_dofs_per_object<structdim>(),
- ExcIndexRange(local_index,
- 0,
- dof_handler.get_fe(fe_index)
- .template n_dofs_per_object<structdim>()));
+ Assert((fe_index !=
+ dealii::hp::DoFHandler<dim, spacedim>::default_fe_index),
+ ExcMessage("You need to specify a FE index when working "
+ "with hp DoFHandlers"));
+ Assert(fe_index < dof_handler.get_fe_collection().size(),
+ ExcIndexRange(fe_index,
+ 0,
+ dof_handler.get_fe_collection().size()));
+ Assert(local_index < dof_handler.get_fe(fe_index)
+ .template n_dofs_per_object<structdim>(),
+ ExcIndexRange(local_index,
+ 0,
+ dof_handler.get_fe(fe_index)
+ .template n_dofs_per_object<structdim>()));
Assert(obj_index < dof_offsets.size(),
ExcIndexRange(obj_index, 0, dof_offsets.size()));
const types::global_dof_index global_index,
const unsigned int /*obj_level*/)
{
- Assert(
- (fe_index != dealii::hp::DoFHandler<dim, spacedim>::default_fe_index),
- ExcMessage("You need to specify a FE index when working "
- "with hp DoFHandlers"));
- Assert(
- fe_index < dof_handler.get_fe_collection().size(),
- ExcIndexRange(fe_index, 0, dof_handler.get_fe_collection().size()));
- Assert(
- local_index <
- dof_handler.get_fe(fe_index).template n_dofs_per_object<structdim>(),
- ExcIndexRange(local_index,
- 0,
- dof_handler.get_fe(fe_index)
- .template n_dofs_per_object<structdim>()));
+ Assert((fe_index !=
+ dealii::hp::DoFHandler<dim, spacedim>::default_fe_index),
+ ExcMessage("You need to specify a FE index when working "
+ "with hp DoFHandlers"));
+ Assert(fe_index < dof_handler.get_fe_collection().size(),
+ ExcIndexRange(fe_index,
+ 0,
+ dof_handler.get_fe_collection().size()));
+ Assert(local_index < dof_handler.get_fe(fe_index)
+ .template n_dofs_per_object<structdim>(),
+ ExcIndexRange(local_index,
+ 0,
+ dof_handler.get_fe(fe_index)
+ .template n_dofs_per_object<structdim>()));
Assert(obj_index < dof_offsets.size(),
ExcIndexRange(obj_index, 0, dof_offsets.size()));
const unsigned int /*obj_level*/) const
{
Assert(obj_index < dof_offsets.size(),
- ExcIndexRange(
- obj_index, 0, static_cast<unsigned int>(dof_offsets.size())));
- Assert(
- (fe_index != dealii::hp::DoFHandler<dim, spacedim>::default_fe_index),
- ExcMessage("You need to specify a FE index when working "
- "with hp DoFHandlers"));
- Assert(
- fe_index < dof_handler.get_fe_collection().size(),
- ExcIndexRange(fe_index, 0, dof_handler.get_fe_collection().size()));
+ ExcIndexRange(obj_index,
+ 0,
+ static_cast<unsigned int>(dof_offsets.size())));
+ Assert((fe_index !=
+ dealii::hp::DoFHandler<dim, spacedim>::default_fe_index),
+ ExcMessage("You need to specify a FE index when working "
+ "with hp DoFHandlers"));
+ Assert(fe_index < dof_handler.get_fe_collection().size(),
+ ExcIndexRange(fe_index,
+ 0,
+ dof_handler.get_fe_collection().size()));
// make sure we are on an
// object for which DoFs have
ExcMessage(
"The object being loaded into does not match the triangulation "
"that has been stored previously."));
- AssertThrow(
- policy_name == dealii::internal::policy_to_string(*policy),
- ExcMessage("The policy currently associated with this DoFHandler (" +
- dealii::internal::policy_to_string(*policy) +
- ") does not match the one that was associated with the "
- "DoFHandler previously stored (" +
- policy_name + ")."));
+ AssertThrow(policy_name == dealii::internal::policy_to_string(*policy),
+ ExcMessage(
+ "The policy currently associated with this DoFHandler (" +
+ dealii::internal::policy_to_string(*policy) +
+ ") does not match the one that was associated with the "
+ "DoFHandler previously stored (" +
+ policy_name + ")."));
}
template <int dim, int spacedim>
// the index is so large that we cannot accept it. (but this
// will not likely happen because it requires someone using an
// FECollection that has more than 32k entries.)
- Assert(
- is_compressed_entry(fe_index) == false,
- ExcMessage("You are using an active_fe_index that is larger than an "
- "internal limitation for these objects. Try to work with "
- "hp::FECollection objects that have a more modest size."));
+ Assert(is_compressed_entry(fe_index) == false,
+ ExcMessage(
+ "You are using an active_fe_index that is larger than an "
+ "internal limitation for these objects. Try to work with "
+ "hp::FECollection objects that have a more modest size."));
active_fe_indices[obj_index] = fe_index;
}
template <typename number>
inline AffineConstraints<number>::AffineConstraints(
- const IndexSet &local_constraints) :
- lines(),
- local_lines(local_constraints),
- sorted(false)
+ const IndexSet &local_constraints)
+ : lines()
+ , local_lines(local_constraints)
+ , sorted(false)
{
// make sure the IndexSet is compressed. Otherwise this can lead to crashes
// that are hard to find (only happen in release mode).
template <typename number>
inline AffineConstraints<number>::AffineConstraints(
- const AffineConstraints &affine_constraints) :
- Subscriptor(),
- lines(affine_constraints.lines),
- lines_cache(affine_constraints.lines_cache),
- local_lines(affine_constraints.local_lines),
- sorted(affine_constraints.sorted)
+ const AffineConstraints &affine_constraints)
+ : Subscriptor()
+ , lines(affine_constraints.lines)
+ , lines_cache(affine_constraints.lines_cache)
+ , local_lines(affine_constraints.local_lines)
+ , sorted(affine_constraints.sorted)
{}
template <typename number>
// if necessary enlarge vector of existing entries for cache
if (line_index >= lines_cache.size())
- lines_cache.resize(
- std::max(2 * static_cast<size_type>(lines_cache.size()), line_index + 1),
- numbers::invalid_size_type);
+ lines_cache.resize(std::max(2 * static_cast<size_type>(lines_cache.size()),
+ line_index + 1),
+ numbers::invalid_size_type);
// push a new line to the end of the list
lines.emplace_back();
++local_vector_begin, ++local_indices_begin)
{
if (is_constrained(*local_indices_begin) == false)
- internal::ElementAccess<VectorType>::add(
- *local_vector_begin, *local_indices_begin, global_vector);
+ internal::ElementAccess<VectorType>::add(*local_vector_begin,
+ *local_indices_begin,
+ global_vector);
else
{
const ConstraintLine &position =
if (p->first == col_val_pair->first)
{
// entry exists, break innermost loop
- Assert(
- p->second == col_val_pair->second,
- ExcEntryAlreadyExists(
- line, col_val_pair->first, p->second, col_val_pair->second));
+ Assert(p->second == col_val_pair->second,
+ ExcEntryAlreadyExists(line,
+ col_val_pair->first,
+ p->second,
+ col_val_pair->second));
break;
}
const bool allow_different_local_lines)
{
(void)allow_different_local_lines;
- Assert(
- allow_different_local_lines || local_lines == other_constraints.local_lines,
- ExcMessage("local_lines for this and the other objects are not the same "
- "although allow_different_local_lines is false."));
+ Assert(allow_different_local_lines ||
+ local_lines == other_constraints.local_lines,
+ ExcMessage(
+ "local_lines for this and the other objects are not the same "
+ "although allow_different_local_lines is false."));
// store the previous state with respect to sorting
const bool object_was_sorted = sorted;
{
// do not bother to resize the lines cache exactly since it is pretty
// cheap to adjust it along the way.
- std::fill(
- lines_cache.begin(), lines_cache.end(), numbers::invalid_size_type);
+ std::fill(lines_cache.begin(),
+ lines_cache.end(),
+ numbers::invalid_size_type);
// reset lines_cache for our own constraints
size_type index = 0;
// complex<float>' for 3rd argument
number v = static_cast<number>(entry->value());
v *= lines[distribute[row]].entries[q].second;
- uncondensed.add(
- lines[distribute[row]].entries[q].first, column, v);
+ uncondensed.add(lines[distribute[row]].entries[q].first,
+ column,
+ v);
}
// set old entry to zero
for (size_type q = 0; q < position_j.entries.size(); ++q)
{
- Assert(
- !(!local_lines.size() ||
- local_lines.is_element(position_j.entries[q].first)) ||
- is_constrained(position_j.entries[q].first) == false,
- ExcMessage("Tried to distribute to a fixed dof."));
+ Assert(!(!local_lines.size() ||
+ local_lines.is_element(
+ position_j.entries[q].first)) ||
+ is_constrained(position_j.entries[q].first) == false,
+ ExcMessage("Tried to distribute to a fixed dof."));
global_vector(position_j.entries[q].first) -=
val * position_j.entries[q].second * matrix_entry;
}
PETScWrappers::MPI::Vector & output,
const std::integral_constant<bool, false> /*is_block_vector*/)
{
- output.reinit(
- locally_owned_elements, needed_elements, vec.get_mpi_communicator());
+ output.reinit(locally_owned_elements,
+ needed_elements,
+ vec.get_mpi_communicator());
output = vec;
}
#endif
// way to efficiently avoid the copy then
const_cast<LinearAlgebra::distributed::Vector<number> &>(vec)
.zero_out_ghosts();
- output.reinit(
- locally_owned_elements, needed_elements, vec.get_mpi_communicator());
+ output.reinit(locally_owned_elements,
+ needed_elements,
+ vec.get_mpi_communicator());
output = vec;
output.update_ghost_values();
}
vec, next_constraint->entries[i].first)) *
next_constraint->entries[i].second);
AssertIsFinite(new_value);
- internal::ElementAccess<VectorType>::set(
- new_value, next_constraint->index, vec);
+ internal::ElementAccess<VectorType>::set(new_value,
+ next_constraint->index,
+ vec);
}
}
}
};
inline Distributing::Distributing(const size_type global_row,
- const size_type local_row) :
- global_row(global_row),
- local_row(local_row),
- constraint_position(numbers::invalid_size_type)
+ const size_type local_row)
+ : global_row(global_row)
+ , local_row(local_row)
+ , constraint_position(numbers::invalid_size_type)
{}
- inline Distributing::Distributing(const Distributing &in) :
- constraint_position(numbers::invalid_size_type)
+ inline Distributing::Distributing(const Distributing &in)
+ : constraint_position(numbers::invalid_size_type)
{
*this = (in);
}
template <typename number>
struct DataCache
{
- DataCache() : row_length(8)
+ DataCache()
+ : row_length(8)
{}
void
class GlobalRowsFromLocal
{
public:
- GlobalRowsFromLocal() : n_active_rows(0), n_inhomogeneous_rows(0)
+ GlobalRowsFromLocal()
+ : n_active_rows(0)
+ , n_inhomogeneous_rows(0)
{}
void
/**
* Constructor, does nothing.
*/
- ScratchData() : in_use(false)
+ ScratchData()
+ : in_use(false)
{}
/**
* Copy constructor, does nothing
*/
- ScratchData(const ScratchData &) : in_use(false)
+ ScratchData(const ScratchData &)
+ : in_use(false)
{}
/**
* Constructor. Grabs a scratch data object on the current thread and
* mark it as used
*/
- ScratchDataAccessor() :
- my_scratch_data(&AffineConstraintsData::scratch_data.get())
+ ScratchDataAccessor()
+ : my_scratch_data(&AffineConstraintsData::scratch_data.get())
{
Assert(my_scratch_data->in_use == false,
ExcMessage(
{
while (matrix_values->column() < column)
++matrix_values;
- Assert(
- matrix_values->column() == column,
- typename SparseMatrix<typename SparseMatrixIterator::MatrixType::
- value_type>::ExcInvalidIndex(row, column));
+ Assert(matrix_values->column() == column,
+ typename SparseMatrix<
+ typename SparseMatrixIterator::MatrixType::value_type>::
+ ExcInvalidIndex(row, column));
matrix_values->value() += value;
}
}
{
const size_type loc_col = global_rows.local_row(j);
const number col_val = matrix_ptr[loc_col];
- dealiiSparseMatrix::add_value(
- col_val, row, global_rows.global_row(j), matrix_values);
+ dealiiSparseMatrix::add_value(col_val,
+ row,
+ global_rows.global_row(j),
+ matrix_values);
}
}
else
{
number col_val = resolve_matrix_entry(
global_rows, global_rows, i, j, loc_row, local_matrix);
- dealiiSparseMatrix::add_value(
- col_val, row, global_rows.global_row(j), matrix_values);
+ dealiiSparseMatrix::add_value(col_val,
+ row,
+ global_rows.global_row(j),
+ matrix_values);
}
}
}
{
const size_type loc_col = global_rows.local_row(j);
const number col_val = matrix_ptr[loc_col];
- dealiiSparseMatrix::add_value(
- col_val, row, global_rows.global_row(j), matrix_values);
+ dealiiSparseMatrix::add_value(col_val,
+ row,
+ global_rows.global_row(j),
+ matrix_values);
}
for (size_type j = i + 1; j < column_end; ++j)
{
const size_type loc_col = global_rows.local_row(j);
const number col_val = matrix_ptr[loc_col];
- dealiiSparseMatrix::add_value(
- col_val, row, global_rows.global_row(j), matrix_values);
+ dealiiSparseMatrix::add_value(col_val,
+ row,
+ global_rows.global_row(j),
+ matrix_values);
}
}
else
{
number col_val = resolve_matrix_entry(
global_rows, global_rows, i, j, loc_row, local_matrix);
- dealiiSparseMatrix::add_value(
- col_val, row, global_rows.global_row(j), matrix_values);
+ dealiiSparseMatrix::add_value(col_val,
+ row,
+ global_rows.global_row(j),
+ matrix_values);
}
for (size_type j = i + 1; j < column_end; ++j)
{
number col_val = resolve_matrix_entry(
global_rows, global_rows, i, j, loc_row, local_matrix);
- dealiiSparseMatrix::add_value(
- col_val, row, global_rows.global_row(j), matrix_values);
+ dealiiSparseMatrix::add_value(col_val,
+ row,
+ global_rows.global_row(j),
+ matrix_values);
}
}
}
if (row == global_rows.global_row(j))
sparse_matrix->begin(row)->value() += col_val;
else
- dealiiSparseMatrix::add_value(
- col_val, row, global_rows.global_row(j), matrix_values);
+ dealiiSparseMatrix::add_value(col_val,
+ row,
+ global_rows.global_row(j),
+ matrix_values);
}
}
else
if (row == global_rows.global_row(j))
sparse_matrix->begin(row)->value() += col_val;
else
- dealiiSparseMatrix::add_value(
- col_val, row, global_rows.global_row(j), matrix_values);
+ dealiiSparseMatrix::add_value(col_val,
+ row,
+ global_rows.global_row(j),
+ matrix_values);
}
}
}
if (position.inhomogeneity != number(0.))
global_rows.set_ith_constraint_inhomogeneous(i);
for (size_type q = 0; q < position.entries.size(); ++q)
- global_rows.insert_index(
- position.entries[q].first, local_row, position.entries[q].second);
+ global_rows.insert_index(position.entries[q].first,
+ local_row,
+ position.entries[q].second);
}
}
// keep the list sorted
else
{
- std::vector<size_type>::iterator it = Utilities::lower_bound(
- active_dofs.begin(), active_dofs.end() - i + 1, new_index);
+ std::vector<size_type>::iterator it =
+ Utilities::lower_bound(active_dofs.begin(),
+ active_dofs.end() - i + 1,
+ new_index);
if (*it != new_index)
active_dofs.insert(it, new_index);
}
// Vector, LinearAlgebra::distributed::vector, etc.
if (std::is_same<typename VectorType::value_type, number>::value)
{
- global_vector.add(
- vector_indices,
- *reinterpret_cast<std::vector<number> *>(&vector_values));
+ global_vector.add(vector_indices,
+ *reinterpret_cast<std::vector<number> *>(
+ &vector_values));
}
else
{
// additional construct that also takes care of block indices.
std::vector<size_type> &block_starts = scratch_data->block_starts;
block_starts.resize(num_blocks + 1);
- internals::make_block_starts(
- sparsity_pattern, actual_dof_indices, block_starts);
+ internals::make_block_starts(sparsity_pattern,
+ actual_dof_indices,
+ block_starts);
for (size_type block = 0; block < num_blocks; ++block)
{
inline ArpackSolver::AdditionalData::AdditionalData(
const unsigned int number_of_arnoldi_vectors,
const WhichEigenvalues eigenvalue_of_interest,
- const bool symmetric) :
- number_of_arnoldi_vectors(number_of_arnoldi_vectors),
- eigenvalue_of_interest(eigenvalue_of_interest),
- symmetric(symmetric)
+ const bool symmetric)
+ : number_of_arnoldi_vectors(number_of_arnoldi_vectors)
+ , eigenvalue_of_interest(eigenvalue_of_interest)
+ , symmetric(symmetric)
{
// Check for possible options for symmetric problems
if (symmetric)
inline ArpackSolver::ArpackSolver(SolverControl & control,
- const AdditionalData &data) :
- solver_control(control),
- additional_data(data),
- initial_vector_provided(false),
- sigmar(0.0),
- sigmai(0.0)
+ const AdditionalData &data)
+ : solver_control(control)
+ , additional_data(data)
+ , initial_vector_provided(false)
+ , sigmar(0.0)
+ , sigmai(0.0)
{}
ArpackExcInvalidEigenvectorSize(nev, eigenvectors.size()));
}
else
- Assert(
- nev + 1 <= eigenvectors.size(),
- ArpackExcInvalidEigenvectorSizeNonsymmetric(nev, eigenvectors.size()));
+ Assert(nev + 1 <= eigenvectors.size(),
+ ArpackExcInvalidEigenvectorSizeNonsymmetric(nev,
+ eigenvectors.size()));
Assert(nev <= eigenvalues.size(),
ArpackExcInvalidEigenvalueSize(nev, eigenvalues.size()));
}
-inline BlockIndices::BlockIndices() : n_blocks(0), start_indices(1, 0)
+inline BlockIndices::BlockIndices()
+ : n_blocks(0)
+ , start_indices(1, 0)
{}
inline BlockIndices::BlockIndices(const unsigned int n_blocks,
- const size_type block_size) :
- n_blocks(n_blocks),
- start_indices(n_blocks + 1)
+ const size_type block_size)
+ : n_blocks(n_blocks)
+ , start_indices(n_blocks + 1)
{
for (size_type i = 0; i <= n_blocks; ++i)
start_indices[i] = i * block_size;
-inline BlockIndices::BlockIndices(const std::vector<size_type> &block_sizes) :
- n_blocks(static_cast<unsigned int>(block_sizes.size())),
- start_indices(block_sizes.size() + 1)
+inline BlockIndices::BlockIndices(const std::vector<size_type> &block_sizes)
+ : n_blocks(static_cast<unsigned int>(block_sizes.size()))
+ , start_indices(block_sizes.size() + 1)
{
reinit(block_sizes);
}
-inline BlockIndices::BlockIndices(BlockIndices &&b) noexcept :
- n_blocks(b.n_blocks),
- start_indices(std::move(b.start_indices))
+inline BlockIndices::BlockIndices(BlockIndices &&b) noexcept
+ : n_blocks(b.n_blocks)
+ , start_indices(std::move(b.start_indices))
{
b.n_blocks = 0;
b.start_indices = std::vector<size_type>(1, 0);
* class LinearOperator are initialized with default variants that throw an
* exception upon invocation.
*/
- BlockLinearOperator(const BlockPayload &payload) :
- LinearOperator<Range, Domain, typename BlockPayload::BlockType>(
- typename BlockPayload::BlockType(payload, payload))
+ BlockLinearOperator(const BlockPayload &payload)
+ : LinearOperator<Range, Domain, typename BlockPayload::BlockType>(
+ typename BlockPayload::BlockType(payload, payload))
{
n_block_rows = []() -> unsigned int {
Assert(
size_type row,
size_type col,
number prefix,
- bool transpose) :
- row(row),
- col(col),
- prefix(prefix),
- transpose(transpose),
- matrix(new_pointer_matrix_base(m,
- typename BlockVectorType::BlockType(),
- typeid(*this).name()))
+ bool transpose)
+ : row(row)
+ , col(col)
+ , prefix(prefix)
+ , transpose(transpose)
+ , matrix(new_pointer_matrix_base(m,
+ typename BlockVectorType::BlockType(),
+ typeid(*this).name()))
{}
namespace BlockMatrixIterators
{
template <class BlockMatrixType>
- inline AccessorBase<BlockMatrixType>::AccessorBase() :
- row_block(0),
- col_block(0)
+ inline AccessorBase<BlockMatrixType>::AccessorBase()
+ : row_block(0)
+ , col_block(0)
{}
inline Accessor<BlockMatrixType, true>::Accessor(
const BlockMatrixType *matrix,
const size_type row,
- const size_type col) :
- matrix(matrix),
- base_iterator(matrix->block(0, 0).begin())
+ const size_type col)
+ : matrix(matrix)
+ , base_iterator(matrix->block(0, 0).begin())
{
(void)col;
Assert(col == 0, ExcNotImplemented());
template <class BlockMatrixType>
inline Accessor<BlockMatrixType, true>::Accessor(
- const Accessor<BlockMatrixType, false> &other) :
- matrix(other.matrix),
- base_iterator(other.base_iterator)
+ const Accessor<BlockMatrixType, false> &other)
+ : matrix(other.matrix)
+ , base_iterator(other.base_iterator)
{
this->row_block = other.row_block;
this->col_block = other.col_block;
template <class BlockMatrixType>
inline Accessor<BlockMatrixType, false>::Accessor(BlockMatrixType *matrix,
const size_type row,
- const size_type col) :
- matrix(matrix),
- base_iterator(matrix->block(0, 0).begin())
+ const size_type col)
+ : matrix(matrix)
+ , base_iterator(matrix->block(0, 0).begin())
{
(void)col;
Assert(col == 0, ExcNotImplemented());
template <typename number>
BlockSparseMatrixEZ<number>::BlockSparseMatrixEZ(const unsigned int rows,
- const unsigned int cols) :
- row_indices(rows, 0),
- column_indices(cols, 0)
+ const unsigned int cols)
+ : row_indices(rows, 0)
+ , column_indices(cols, 0)
{}
template <typename number>
BlockSparseMatrixEZ<number>::BlockSparseMatrixEZ(
- const BlockSparseMatrixEZ<number> &m) :
- Subscriptor(m),
- row_indices(m.row_indices),
- column_indices(m.column_indices),
- blocks(m.blocks)
+ const BlockSparseMatrixEZ<number> &m)
+ : Subscriptor(m)
+ , row_indices(m.row_indices)
+ , column_indices(m.column_indices)
+ , blocks(m.blocks)
{}
unsigned int rowlen =
sub_objects[row_index.first][b]->row_length(row_index.second);
if (index < c + rowlen)
- return block_columns + sub_objects[row_index.first][b]->column_number(
- row_index.second, index - c);
+ return block_columns +
+ sub_objects[row_index.first][b]->column_number(row_index.second,
+ index - c);
c += rowlen;
block_columns += sub_objects[row_index.first][b]->n_cols();
}
template <typename Number>
-BlockVector<Number>::BlockVector(const BlockVector<Number> &v) :
- BlockVectorBase<Vector<Number>>()
+BlockVector<Number>::BlockVector(const BlockVector<Number> &v)
+ : BlockVectorBase<Vector<Number>>()
{
this->components.resize(v.n_blocks());
this->block_indices = v.block_indices;
{
template <class BlockVectorType, bool Constness>
inline Iterator<BlockVectorType, Constness>::Iterator(
- const Iterator<BlockVectorType, Constness> &c) :
- parent(c.parent),
- global_index(c.global_index),
- current_block(c.current_block),
- index_within_block(c.index_within_block),
- next_break_forward(c.next_break_forward),
- next_break_backward(c.next_break_backward)
+ const Iterator<BlockVectorType, Constness> &c)
+ : parent(c.parent)
+ , global_index(c.global_index)
+ , current_block(c.current_block)
+ , index_within_block(c.index_within_block)
+ , next_break_forward(c.next_break_forward)
+ , next_break_backward(c.next_break_backward)
{}
template <class BlockVectorType, bool Constness>
inline Iterator<BlockVectorType, Constness>::Iterator(
- const Iterator<BlockVectorType, !Constness> &c) :
- parent(c.parent),
- global_index(c.global_index),
- current_block(c.current_block),
- index_within_block(c.index_within_block),
- next_break_forward(c.next_break_forward),
- next_break_backward(c.next_break_backward)
+ const Iterator<BlockVectorType, !Constness> &c)
+ : parent(c.parent)
+ , global_index(c.global_index)
+ , current_block(c.current_block)
+ , index_within_block(c.index_within_block)
+ , next_break_forward(c.next_break_forward)
+ , next_break_backward(c.next_break_backward)
{
// Only permit copy-constructing const iterators from non-const
// iterators, and not vice versa (i.e., Constness must always be
const size_type current_block,
const size_type index_within_block,
const size_type next_break_forward,
- const size_type next_break_backward) :
- parent(&parent),
- global_index(global_index),
- current_block(current_block),
- index_within_block(index_within_block),
- next_break_forward(next_break_forward),
- next_break_backward(next_break_backward)
+ const size_type next_break_backward)
+ : parent(&parent)
+ , global_index(global_index)
+ , current_block(current_block)
+ , index_within_block(index_within_block)
+ , next_break_forward(next_break_forward)
+ , next_break_backward(next_break_backward)
{}
template <class BlockVectorType, bool Constness>
- Iterator<BlockVectorType, Constness>::Iterator(
- BlockVector & parent,
- const size_type global_index) :
- parent(&parent),
- global_index(global_index)
+ Iterator<BlockVectorType, Constness>::Iterator(BlockVector & parent,
+ const size_type global_index)
+ : parent(&parent)
+ , global_index(global_index)
{
// find which block we are
// in. for this, take into
{
template <typename number>
inline Accessor<number, true>::Accessor(const MatrixType * matrix,
- const unsigned int row) :
- ChunkSparsityPatternIterators::Accessor(&matrix->get_sparsity_pattern(),
- row),
- matrix(matrix)
+ const unsigned int row)
+ : ChunkSparsityPatternIterators::Accessor(&matrix->get_sparsity_pattern(),
+ row)
+ , matrix(matrix)
{}
template <typename number>
- inline Accessor<number, true>::Accessor(const MatrixType *matrix) :
- ChunkSparsityPatternIterators::Accessor(&matrix->get_sparsity_pattern()),
- matrix(matrix)
+ inline Accessor<number, true>::Accessor(const MatrixType *matrix)
+ : ChunkSparsityPatternIterators::Accessor(&matrix->get_sparsity_pattern())
+ , matrix(matrix)
{}
template <typename number>
inline Accessor<number, true>::Accessor(
- const ChunkSparseMatrixIterators::Accessor<number, false> &a) :
- ChunkSparsityPatternIterators::Accessor(a),
- matrix(&a.get_matrix())
+ const ChunkSparseMatrixIterators::Accessor<number, false> &a)
+ : ChunkSparsityPatternIterators::Accessor(a)
+ , matrix(&a.get_matrix())
{}
template <typename number>
inline Accessor<number, false>::Reference::Reference(const Accessor *accessor,
- const bool) :
- accessor(accessor)
+ const bool)
+ : accessor(accessor)
{}
template <typename number>
inline Accessor<number, false>::Accessor(MatrixType * matrix,
- const unsigned int row) :
- ChunkSparsityPatternIterators::Accessor(&matrix->get_sparsity_pattern(),
- row),
- matrix(matrix)
+ const unsigned int row)
+ : ChunkSparsityPatternIterators::Accessor(&matrix->get_sparsity_pattern(),
+ row)
+ , matrix(matrix)
{}
template <typename number>
- inline Accessor<number, false>::Accessor(MatrixType *matrix) :
- ChunkSparsityPatternIterators::Accessor(&matrix->get_sparsity_pattern()),
- matrix(matrix)
+ inline Accessor<number, false>::Accessor(MatrixType *matrix)
+ : ChunkSparsityPatternIterators::Accessor(&matrix->get_sparsity_pattern())
+ , matrix(matrix)
{}
template <typename number, bool Constness>
inline Iterator<number, Constness>::Iterator(MatrixType * matrix,
- const unsigned int row) :
- accessor(matrix, row)
+ const unsigned int row)
+ : accessor(matrix, row)
{}
template <typename number, bool Constness>
- inline Iterator<number, Constness>::Iterator(MatrixType *matrix) :
- accessor(matrix)
+ inline Iterator<number, Constness>::Iterator(MatrixType *matrix)
+ : accessor(matrix)
{}
template <typename number, bool Constness>
inline Iterator<number, Constness>::Iterator(
- const ChunkSparseMatrixIterators::Iterator<number, false> &i) :
- accessor(*i)
+ const ChunkSparseMatrixIterators::Iterator<number, false> &i)
+ : accessor(*i)
{}
template <typename number>
-ChunkSparseMatrix<number>::ChunkSparseMatrix() :
- cols(nullptr, "ChunkSparseMatrix"),
- val(nullptr),
- max_len(0)
+ChunkSparseMatrix<number>::ChunkSparseMatrix()
+ : cols(nullptr, "ChunkSparseMatrix")
+ , val(nullptr)
+ , max_len(0)
{}
template <typename number>
-ChunkSparseMatrix<number>::ChunkSparseMatrix(const ChunkSparseMatrix &m) :
- Subscriptor(m),
- cols(nullptr, "ChunkSparseMatrix"),
- val(nullptr),
- max_len(0)
+ChunkSparseMatrix<number>::ChunkSparseMatrix(const ChunkSparseMatrix &m)
+ : Subscriptor(m)
+ , cols(nullptr, "ChunkSparseMatrix")
+ , val(nullptr)
+ , max_len(0)
{
- Assert(
- m.cols == nullptr && m.val == nullptr && m.max_len == 0,
- ExcMessage("This constructor can only be called if the provided argument "
- "is an empty matrix. This constructor can not be used to "
- "copy-construct a non-empty matrix. Use the "
- "ChunkSparseMatrix::copy_from() function for that purpose."));
+ Assert(m.cols == nullptr && m.val == nullptr && m.max_len == 0,
+ ExcMessage(
+ "This constructor can only be called if the provided argument "
+ "is an empty matrix. This constructor can not be used to "
+ "copy-construct a non-empty matrix. Use the "
+ "ChunkSparseMatrix::copy_from() function for that purpose."));
}
ChunkSparseMatrix<number>::operator=(const ChunkSparseMatrix<number> &m)
{
(void)m;
- Assert(
- m.cols == nullptr && m.val == nullptr && m.max_len == 0,
- ExcMessage("This operator can only be called if the provided right "
- "hand side is an empty matrix. This operator can not be "
- "used to copy a non-empty matrix. Use the "
- "ChunkSparseMatrix::copy_from() function for that purpose."));
+ Assert(m.cols == nullptr && m.val == nullptr && m.max_len == 0,
+ ExcMessage(
+ "This operator can only be called if the provided right "
+ "hand side is an empty matrix. This operator can not be "
+ "used to copy a non-empty matrix. Use the "
+ "ChunkSparseMatrix::copy_from() function for that purpose."));
return *this;
}
template <typename number>
-ChunkSparseMatrix<number>::ChunkSparseMatrix(const ChunkSparsityPattern &c) :
- cols(nullptr, "ChunkSparseMatrix"),
- val(nullptr),
- max_len(0)
+ChunkSparseMatrix<number>::ChunkSparseMatrix(const ChunkSparsityPattern &c)
+ : cols(nullptr, "ChunkSparseMatrix")
+ , val(nullptr)
+ , max_len(0)
{
// virtual functions called in constructors and destructors never use the
// override in a derived class
template <typename number>
ChunkSparseMatrix<number>::ChunkSparseMatrix(const ChunkSparsityPattern &c,
- const IdentityMatrix & id) :
- cols(nullptr, "ChunkSparseMatrix"),
- val(nullptr),
- max_len(0)
+ const IdentityMatrix & id)
+ : cols(nullptr, "ChunkSparseMatrix")
+ , val(nullptr)
+ , max_len(0)
{
(void)id;
Assert(c.n_rows() == id.m(), ExcDimensionMismatch(c.n_rows(), id.m()));
parallel::apply_to_subranges(
0U,
matrix_size,
- std::bind(
- &internal::ChunkSparseMatrixImplementation::template zero_subrange<
- number>,
- std::placeholders::_1,
- std::placeholders::_2,
- val.get()),
+ std::bind(&internal::ChunkSparseMatrixImplementation::
+ template zero_subrange<number>,
+ std::placeholders::_1,
+ std::placeholders::_2,
+ val.get()),
grain_size);
else if (matrix_size > 0)
std::memset(val.get(), 0, matrix_size * sizeof(number));
// around the matrix. since we have the invariant that padding elements are
// zero, nothing bad can happen here
const size_type chunk_size = cols->get_chunk_size();
- return std::count_if(
- val.get(),
- val.get() +
- cols->sparsity_pattern.n_nonzero_elements() * chunk_size * chunk_size,
- std::bind(std::not_equal_to<double>(), std::placeholders::_1, 0));
+ return std::count_if(val.get(),
+ val.get() + cols->sparsity_pattern.n_nonzero_elements() *
+ chunk_size * chunk_size,
+ std::bind(std::not_equal_to<double>(),
+ std::placeholders::_1,
+ 0));
}
if ((cols_have_padding == false) ||
(*colnum_ptr != cols->sparsity_pattern.n_cols() - 1))
result += internal::ChunkSparseMatrixImplementation::
- chunk_matrix_scalar_product<somenumber>(
- cols->chunk_size,
- val_ptr,
- v_ptr,
- v.begin() + *colnum_ptr * cols->chunk_size);
+ chunk_matrix_scalar_product<somenumber>(cols->chunk_size,
+ val_ptr,
+ v_ptr,
+ v.begin() +
+ *colnum_ptr *
+ cols->chunk_size);
else
// we're at a chunk column that has padding
for (size_type r = 0; r < cols->chunk_size; ++r)
if ((cols_have_padding == false) ||
(*colnum_ptr != cols->sparsity_pattern.n_cols() - 1))
result += internal::ChunkSparseMatrixImplementation::
- chunk_matrix_scalar_product<somenumber>(
- cols->chunk_size,
- val_ptr,
- u_ptr,
- v.begin() + *colnum_ptr * cols->chunk_size);
+ chunk_matrix_scalar_product<somenumber>(cols->chunk_size,
+ val_ptr,
+ u_ptr,
+ v.begin() +
+ *colnum_ptr *
+ cols->chunk_size);
else
// we're at a chunk column that has padding
for (size_type r = 0; r < cols->chunk_size; ++r)
namespace ChunkSparsityPatternIterators
{
inline Accessor::Accessor(const ChunkSparsityPattern *sparsity_pattern,
- const unsigned int row) :
- sparsity_pattern(sparsity_pattern),
- reduced_accessor(row == sparsity_pattern->n_rows() ?
- *sparsity_pattern->sparsity_pattern.end() :
- *sparsity_pattern->sparsity_pattern.begin(
- row / sparsity_pattern->get_chunk_size())),
- chunk_row(row == sparsity_pattern->n_rows() ?
- 0 :
- row % sparsity_pattern->get_chunk_size()),
- chunk_col(0)
+ const unsigned int row)
+ : sparsity_pattern(sparsity_pattern)
+ , reduced_accessor(row == sparsity_pattern->n_rows() ?
+ *sparsity_pattern->sparsity_pattern.end() :
+ *sparsity_pattern->sparsity_pattern.begin(
+ row / sparsity_pattern->get_chunk_size()))
+ , chunk_row(row == sparsity_pattern->n_rows() ?
+ 0 :
+ row % sparsity_pattern->get_chunk_size())
+ , chunk_col(0)
{}
- inline Accessor::Accessor(const ChunkSparsityPattern *sparsity_pattern) :
- sparsity_pattern(sparsity_pattern),
- reduced_accessor(*sparsity_pattern->sparsity_pattern.end()),
- chunk_row(0),
- chunk_col(0)
+ inline Accessor::Accessor(const ChunkSparsityPattern *sparsity_pattern)
+ : sparsity_pattern(sparsity_pattern)
+ , reduced_accessor(*sparsity_pattern->sparsity_pattern.end())
+ , chunk_row(0)
+ , chunk_col(0)
{}
inline Iterator::Iterator(const ChunkSparsityPattern *sparsity_pattern,
- const unsigned int row) :
- accessor(sparsity_pattern, row)
+ const unsigned int row)
+ : accessor(sparsity_pattern, row)
{}
do
{
assumed = old;
- old = atomicCAS(
- address_as_ull,
- assumed,
- __double_as_longlong(val + __longlong_as_double(assumed)));
+ old = atomicCAS(address_as_ull,
+ assumed,
+ __double_as_longlong(val +
+ __longlong_as_double(assumed)));
}
while (assumed != old);
{
inline Accessor::Accessor(const DynamicSparsityPattern *sparsity_pattern,
const size_type row,
- const unsigned int index_within_row) :
- sparsity_pattern(sparsity_pattern),
- current_row(row),
- current_entry(
- ((sparsity_pattern->rowset.size() == 0) ?
- sparsity_pattern->lines[current_row].entries.begin() :
- sparsity_pattern
- ->lines[sparsity_pattern->rowset.index_within_set(current_row)]
- .entries.begin()) +
- index_within_row),
- end_of_row(
- (sparsity_pattern->rowset.size() == 0) ?
- sparsity_pattern->lines[current_row].entries.end() :
- sparsity_pattern
- ->lines[sparsity_pattern->rowset.index_within_set(current_row)]
- .entries.end())
+ const unsigned int index_within_row)
+ : sparsity_pattern(sparsity_pattern)
+ , current_row(row)
+ , current_entry(
+ ((sparsity_pattern->rowset.size() == 0) ?
+ sparsity_pattern->lines[current_row].entries.begin() :
+ sparsity_pattern
+ ->lines[sparsity_pattern->rowset.index_within_set(current_row)]
+ .entries.begin()) +
+ index_within_row)
+ , end_of_row(
+ (sparsity_pattern->rowset.size() == 0) ?
+ sparsity_pattern->lines[current_row].entries.end() :
+ sparsity_pattern
+ ->lines[sparsity_pattern->rowset.index_within_set(current_row)]
+ .entries.end())
{
AssertIndexRange(current_row, sparsity_pattern->n_rows());
Assert((sparsity_pattern->rowset.size() == 0) ||
}
- inline Accessor::Accessor(const DynamicSparsityPattern *sparsity_pattern) :
- sparsity_pattern(sparsity_pattern),
- current_row(numbers::invalid_size_type),
- current_entry(),
- end_of_row()
+ inline Accessor::Accessor(const DynamicSparsityPattern *sparsity_pattern)
+ : sparsity_pattern(sparsity_pattern)
+ , current_row(numbers::invalid_size_type)
+ , current_entry()
+ , end_of_row()
{}
inline Iterator::Iterator(const DynamicSparsityPattern *sparsity_pattern,
const size_type row,
- const unsigned int index_within_row) :
- accessor(sparsity_pattern, row, index_within_row)
+ const unsigned int index_within_row)
+ : accessor(sparsity_pattern, row, index_within_row)
{}
- inline Iterator::Iterator(const DynamicSparsityPattern *sparsity_pattern) :
- accessor(sparsity_pattern)
+ inline Iterator::Iterator(const DynamicSparsityPattern *sparsity_pattern)
+ : accessor(sparsity_pattern)
{}
const size_type local_row =
rowset.size() ? rowset.index_within_set(row) : row;
- Assert(
- index < lines[local_row].entries.size(),
- ExcIndexRangeType<size_type>(index, 0, lines[local_row].entries.size()));
+ Assert(index < lines[local_row].entries.size(),
+ ExcIndexRangeType<size_type>(index,
+ 0,
+ lines[local_row].entries.size()));
return lines[local_row].entries[index];
}
/**
* Constructor. Set the shift parameter.
*/
- AdditionalData(const double shift = 0.) : shift(shift)
+ AdditionalData(const double shift = 0.)
+ : shift(shift)
{}
};
*/
AdditionalData(double relaxation = 1.,
unsigned int start_adaption = 6,
- bool use_residual = true) :
- relaxation(relaxation),
- start_adaption(start_adaption),
- use_residual(use_residual)
+ bool use_residual = true)
+ : relaxation(relaxation)
+ , start_adaption(start_adaption)
+ , use_residual(use_residual)
{}
};
template <class VectorType>
EigenPower<VectorType>::EigenPower(SolverControl & cn,
VectorMemory<VectorType> &mem,
- const AdditionalData & data) :
- Solver<VectorType>(cn, mem),
- additional_data(data)
+ const AdditionalData & data)
+ : Solver<VectorType>(cn, mem)
+ , additional_data(data)
{}
// Check the change of the eigenvalue
// Brrr, this is not really a good criterion
- conv = this->iteration_status(
- iter, std::fabs(1. / length - 1. / old_length), x);
+ conv = this->iteration_status(iter,
+ std::fabs(1. / length - 1. / old_length),
+ x);
}
// in case of failure: throw exception
template <class VectorType>
EigenInverse<VectorType>::EigenInverse(SolverControl & cn,
VectorMemory<VectorType> &mem,
- const AdditionalData & data) :
- Solver<VectorType>(cn, mem),
- additional_data(data)
+ const AdditionalData & data)
+ : Solver<VectorType>(cn, mem)
+ , additional_data(data)
{}
template <typename VectorType>
inline FilteredMatrix<VectorType>::Accessor::Accessor(
const FilteredMatrix<VectorType> *matrix,
- const size_type index) :
- matrix(matrix),
- index(index)
+ const size_type index)
+ : matrix(matrix)
+ , index(index)
{
Assert(index <= matrix->constraints.size(),
ExcIndexRange(index, 0, matrix->constraints.size()));
template <typename VectorType>
inline FilteredMatrix<VectorType>::const_iterator::const_iterator(
const FilteredMatrix<VectorType> *matrix,
- const size_type index) :
- accessor(matrix, index)
+ const size_type index)
+ : accessor(matrix, index)
{}
template <typename VectorType>
-inline FilteredMatrix<VectorType>::FilteredMatrix() :
- expect_constrained_source(false)
+inline FilteredMatrix<VectorType>::FilteredMatrix()
+ : expect_constrained_source(false)
{}
template <typename VectorType>
-inline FilteredMatrix<VectorType>::FilteredMatrix(const FilteredMatrix &fm) :
- Subscriptor(),
- expect_constrained_source(fm.expect_constrained_source),
- matrix(fm.matrix),
- constraints(fm.constraints)
+inline FilteredMatrix<VectorType>::FilteredMatrix(const FilteredMatrix &fm)
+ : Subscriptor()
+ , expect_constrained_source(fm.expect_constrained_source)
+ , matrix(fm.matrix)
+ , constraints(fm.constraints)
{}
template <typename VectorType>
template <typename MatrixType>
inline FilteredMatrix<VectorType>::FilteredMatrix(const MatrixType &m,
- const bool ecs) :
- expect_constrained_source(false)
+ const bool ecs)
+ : expect_constrained_source(false)
{
initialize(m, ecs);
}
// add new constraints to end
const size_type old_size = constraints.size();
constraints.reserve(old_size + new_constraints.size());
- constraints.insert(
- constraints.end(), new_constraints.begin(), new_constraints.end());
+ constraints.insert(constraints.end(),
+ new_constraints.begin(),
+ new_constraints.end());
// then merge the two arrays to
// form one sorted one
std::inplace_merge(constraints.begin(),
template <typename number>
inline FullMatrix<number>::Accessor::Accessor(const FullMatrix<number> *matrix,
const size_type r,
- const size_type c) :
- matrix(matrix),
- a_row(r),
- a_col(c)
+ const size_type c)
+ : matrix(matrix)
+ , a_row(r)
+ , a_col(c)
{}
inline FullMatrix<number>::const_iterator::const_iterator(
const FullMatrix<number> *matrix,
const size_type r,
- const size_type c) :
- accessor(matrix, r, c)
+ const size_type c)
+ : accessor(matrix, r, c)
{}
template <typename number>
-FullMatrix<number>::FullMatrix(const size_type n) : Table<2, number>(n, n)
+FullMatrix<number>::FullMatrix(const size_type n)
+ : Table<2, number>(n, n)
{}
template <typename number>
-FullMatrix<number>::FullMatrix(const size_type m, const size_type n) :
- Table<2, number>(m, n)
+FullMatrix<number>::FullMatrix(const size_type m, const size_type n)
+ : Table<2, number>(m, n)
{}
template <typename number>
FullMatrix<number>::FullMatrix(const size_type m,
const size_type n,
- const number * entries) :
- Table<2, number>(m, n)
+ const number * entries)
+ : Table<2, number>(m, n)
{
this->fill(entries);
}
template <typename number>
-FullMatrix<number>::FullMatrix(const IdentityMatrix &id) :
- Table<2, number>(id.m(), id.n())
+FullMatrix<number>::FullMatrix(const IdentityMatrix &id)
+ : Table<2, number>(id.m(), id.n())
{
for (size_type i = 0; i < id.m(); ++i)
(*this)(i, i) = 1;
#ifndef DOXYGEN
-inline IdentityMatrix::IdentityMatrix() : size(0)
+inline IdentityMatrix::IdentityMatrix()
+ : size(0)
{}
-inline IdentityMatrix::IdentityMatrix(const size_type n) : size(n)
+inline IdentityMatrix::IdentityMatrix(const size_type n)
+ : size(n)
{}
template <typename Number>
- BlockVector<Number>::BlockVector(const BlockVector<Number> &v) :
- BlockVectorBase<Vector<Number>>()
+ BlockVector<Number>::BlockVector(const BlockVector<Number> &v)
+ : BlockVectorBase<Vector<Number>>()
{
this->components.resize(v.n_blocks());
this->block_indices = v.block_indices;
// query). this is the same in all the functions below
int local_result = -1;
for (unsigned int i = 0; i < this->n_blocks(); ++i)
- local_result = std::max(
- local_result, -static_cast<int>(this->block(i).all_zero_local()));
+ local_result =
+ std::max(local_result,
+ -static_cast<int>(this->block(i).all_zero_local()));
if (this->block(0).partitioner->n_mpi_processes() > 1)
return -Utilities::MPI::max(
matrix(i, j) = this->block(i).inner_product_local(V.block(j));
}
- Utilities::MPI::sum(
- matrix, this->block(0).get_mpi_communicator(), matrix);
+ Utilities::MPI::sum(matrix,
+ this->block(0).get_mpi_communicator(),
+ matrix);
}
{
if (new_alloc_size > allocated_size)
{
- Assert(
- ((allocated_size > 0 && values != nullptr) || values == nullptr),
- ExcInternalError());
+ Assert(((allocated_size > 0 && values != nullptr) ||
+ values == nullptr),
+ ExcInternalError());
Number *new_val;
- Utilities::System::posix_memalign(
- (void **)&new_val, 64, sizeof(Number) * new_alloc_size);
+ Utilities::System::posix_memalign((void **)&new_val,
+ 64,
+ sizeof(Number) * new_alloc_size);
values.reset(new_val);
allocated_size = new_alloc_size;
{
// set up parallel partitioner with index sets and communicator
std::shared_ptr<const Utilities::MPI::Partitioner> new_partitioner(
- new Utilities::MPI::Partitioner(
- locally_owned_indices, ghost_indices, communicator));
+ new Utilities::MPI::Partitioner(locally_owned_indices,
+ ghost_indices,
+ communicator));
reinit(new_partitioner);
}
template <typename Number>
- Vector<Number>::Vector() :
- partitioner(new Utilities::MPI::Partitioner()),
- allocated_size(0),
- values(nullptr, &free)
+ Vector<Number>::Vector()
+ : partitioner(new Utilities::MPI::Partitioner())
+ , allocated_size(0)
+ , values(nullptr, &free)
{
reinit(0);
}
template <typename Number>
- Vector<Number>::Vector(const Vector<Number> &v) :
- Subscriptor(),
- allocated_size(0),
- values(nullptr, &free),
- vector_is_ghosted(false)
+ Vector<Number>::Vector(const Vector<Number> &v)
+ : Subscriptor()
+ , allocated_size(0)
+ , values(nullptr, &free)
+ , vector_is_ghosted(false)
{
reinit(v, true);
{
dealii::internal::VectorOperations::Vector_copy<Number, Number>
copier(v.values.get(), values.get());
- internal::VectorOperations::parallel_for(
- copier, 0, partitioner->local_size(), thread_loop_partitioner);
+ internal::VectorOperations::parallel_for(copier,
+ 0,
+ partitioner->local_size(),
+ thread_loop_partitioner);
}
}
template <typename Number>
Vector<Number>::Vector(const IndexSet &local_range,
const IndexSet &ghost_indices,
- const MPI_Comm communicator) :
- allocated_size(0),
- values(nullptr, &free),
- vector_is_ghosted(false)
+ const MPI_Comm communicator)
+ : allocated_size(0)
+ , values(nullptr, &free)
+ , vector_is_ghosted(false)
{
reinit(local_range, ghost_indices, communicator);
}
template <typename Number>
Vector<Number>::Vector(const IndexSet &local_range,
- const MPI_Comm communicator) :
- allocated_size(0),
- values(nullptr, &free),
- vector_is_ghosted(false)
+ const MPI_Comm communicator)
+ : allocated_size(0)
+ , values(nullptr, &free)
+ , vector_is_ghosted(false)
{
reinit(local_range, communicator);
}
template <typename Number>
- Vector<Number>::Vector(const size_type size) :
- allocated_size(0),
- values(nullptr, &free),
- vector_is_ghosted(false)
+ Vector<Number>::Vector(const size_type size)
+ : allocated_size(0)
+ , values(nullptr, &free)
+ , vector_is_ghosted(false)
{
reinit(size, false);
}
template <typename Number>
Vector<Number>::Vector(
- const std::shared_ptr<const Utilities::MPI::Partitioner> &partitioner) :
- allocated_size(0),
- values(nullptr, &free),
- vector_is_ghosted(false)
+ const std::shared_ptr<const Utilities::MPI::Partitioner> &partitioner)
+ : allocated_size(0)
+ , values(nullptr, &free)
+ , vector_is_ghosted(false)
{
reinit(partitioner);
}
{
dealii::internal::VectorOperations::Vector_copy<Number, Number2>
copier(c.values.get(), values.get());
- internal::VectorOperations::parallel_for(
- copier, 0, this_size, thread_loop_partitioner);
+ internal::VectorOperations::parallel_for(copier,
+ 0,
+ this_size,
+ thread_loop_partitioner);
}
if (must_update_ghost_values)
{
dealii::internal::VectorOperations::Vector_copy<Number, Number2>
copier(src.values.get(), values.get());
- internal::VectorOperations::parallel_for(
- copier, 0, partitioner->local_size(), thread_loop_partitioner);
+ internal::VectorOperations::parallel_for(copier,
+ 0,
+ partitioner->local_size(),
+ thread_loop_partitioner);
}
}
AssertThrow(ierr == 0, ExcPETScError(ierr));
const size_type vec_size = local_size();
- petsc_helpers::copy_petsc_vector(
- start_ptr, start_ptr + vec_size, begin());
+ petsc_helpers::copy_petsc_vector(start_ptr,
+ start_ptr + vec_size,
+ begin());
// restore the representation of the vector
ierr = VecRestoreArray(static_cast<const Vec &>(petsc_vec), &start_ptr);
&flag,
MPI_STATUSES_IGNORE);
AssertThrowMPI(ierr);
- Assert(
- flag == 1,
- ExcMessage("MPI found unfinished update_ghost_values() requests"
- "when calling swap, which is not allowed"));
+ Assert(flag == 1,
+ ExcMessage(
+ "MPI found unfinished update_ghost_values() requests"
+ "when calling swap, which is not allowed"));
}
if (compress_requests.size() > 0)
{
internal::VectorOperations::Vector_set<Number> setter(s,
values.get());
- internal::VectorOperations::parallel_for(
- setter, 0, this_size, thread_loop_partitioner);
+ internal::VectorOperations::parallel_for(setter,
+ 0,
+ this_size,
+ thread_loop_partitioner);
}
// if we call Vector::operator=0, we want to zero out all the entries
internal::VectorOperations::Vectorization_add_v<Number> vector_add(
values.get(), v.values.get());
- internal::VectorOperations::parallel_for(
- vector_add, 0, partitioner->local_size(), thread_loop_partitioner);
+ internal::VectorOperations::parallel_for(vector_add,
+ 0,
+ partitioner->local_size(),
+ thread_loop_partitioner);
if (vector_is_ghosted)
update_ghost_values();
internal::VectorOperations::Vectorization_subtract_v<Number>
vector_subtract(values.get(), v.values.get());
- internal::VectorOperations::parallel_for(
- vector_subtract, 0, partitioner->local_size(), thread_loop_partitioner);
+ internal::VectorOperations::parallel_for(vector_subtract,
+ 0,
+ partitioner->local_size(),
+ thread_loop_partitioner);
if (vector_is_ghosted)
update_ghost_values();
internal::VectorOperations::Vectorization_add_factor<Number> vector_add(
values.get(), a);
- internal::VectorOperations::parallel_for(
- vector_add, 0, partitioner->local_size(), thread_loop_partitioner);
+ internal::VectorOperations::parallel_for(vector_add,
+ 0,
+ partitioner->local_size(),
+ thread_loop_partitioner);
if (vector_is_ghosted)
update_ghost_values();
internal::VectorOperations::Vectorization_add_av<Number> vector_add(
values.get(), v.values.get(), a);
- internal::VectorOperations::parallel_for(
- vector_add, 0, partitioner->local_size(), thread_loop_partitioner);
+ internal::VectorOperations::parallel_for(vector_add,
+ 0,
+ partitioner->local_size(),
+ thread_loop_partitioner);
}
internal::VectorOperations::Vectorization_add_avpbw<Number> vector_add(
values.get(), v.values.get(), w.values.get(), a, b);
- internal::VectorOperations::parallel_for(
- vector_add, 0, partitioner->local_size(), thread_loop_partitioner);
+ internal::VectorOperations::parallel_for(vector_add,
+ 0,
+ partitioner->local_size(),
+ thread_loop_partitioner);
if (vector_is_ghosted)
update_ghost_values();
internal::VectorOperations::Vectorization_sadd_xv<Number> vector_sadd(
values.get(), v.values.get(), x);
- internal::VectorOperations::parallel_for(
- vector_sadd, 0, partitioner->local_size(), thread_loop_partitioner);
+ internal::VectorOperations::parallel_for(vector_sadd,
+ 0,
+ partitioner->local_size(),
+ thread_loop_partitioner);
if (vector_is_ghosted)
update_ghost_values();
internal::VectorOperations::Vectorization_sadd_xav<Number> vector_sadd(
values.get(), v.values.get(), a, x);
- internal::VectorOperations::parallel_for(
- vector_sadd, 0, partitioner->local_size(), thread_loop_partitioner);
+ internal::VectorOperations::parallel_for(vector_sadd,
+ 0,
+ partitioner->local_size(),
+ thread_loop_partitioner);
}
internal::VectorOperations::Vectorization_sadd_xavbw<Number> vector_sadd(
values.get(), v.values.get(), w.values.get(), x, a, b);
- internal::VectorOperations::parallel_for(
- vector_sadd, 0, partitioner->local_size(), thread_loop_partitioner);
+ internal::VectorOperations::parallel_for(vector_sadd,
+ 0,
+ partitioner->local_size(),
+ thread_loop_partitioner);
if (vector_is_ghosted)
update_ghost_values();
internal::VectorOperations::Vectorization_multiply_factor<Number>
vector_multiply(values.get(), factor);
- internal::VectorOperations::parallel_for(
- vector_multiply, 0, partitioner->local_size(), thread_loop_partitioner);
+ internal::VectorOperations::parallel_for(vector_multiply,
+ 0,
+ partitioner->local_size(),
+ thread_loop_partitioner);
if (vector_is_ghosted)
update_ghost_values();
internal::VectorOperations::Vectorization_scale<Number> vector_scale(
values.get(), v.values.get());
- internal::VectorOperations::parallel_for(
- vector_scale, 0, partitioner->local_size(), thread_loop_partitioner);
+ internal::VectorOperations::parallel_for(vector_scale,
+ 0,
+ partitioner->local_size(),
+ thread_loop_partitioner);
if (vector_is_ghosted)
update_ghost_values();
internal::VectorOperations::Vectorization_equ_au<Number> vector_equ(
values.get(), v.values.get(), a);
- internal::VectorOperations::parallel_for(
- vector_equ, 0, partitioner->local_size(), thread_loop_partitioner);
+ internal::VectorOperations::parallel_for(vector_equ,
+ 0,
+ partitioner->local_size(),
+ thread_loop_partitioner);
if (vector_is_ghosted)
update_ghost_values();
internal::VectorOperations::Vectorization_equ_aubv<Number> vector_equ(
values.get(), v.values.get(), w.values.get(), a, b);
- internal::VectorOperations::parallel_for(
- vector_equ, 0, partitioner->local_size(), thread_loop_partitioner);
+ internal::VectorOperations::parallel_for(vector_equ,
+ 0,
+ partitioner->local_size(),
+ thread_loop_partitioner);
if (vector_is_ghosted)
update_ghost_values();
AssertDimension(vec_size, w.local_size());
Number sum;
- internal::VectorOperations::AddAndDot<Number> adder(
- this->values.get(), v.values.get(), w.values.get(), a);
+ internal::VectorOperations::AddAndDot<Number> adder(this->values.get(),
+ v.values.get(),
+ w.values.get(),
+ a);
internal::VectorOperations::parallel_reduce(
adder, 0, vec_size, sum, thread_loop_partitioner);
AssertIsFinite(sum);
/*--------------------------- Inline functions ----------------------------*/
template <typename Number>
- inline Vector<Number>::Vector(const Vector<Number> &V) :
- ReadWriteVector<Number>(V)
+ inline Vector<Number>::Vector(const Vector<Number> &V)
+ : ReadWriteVector<Number>(V)
{}
template <typename Number>
- inline Vector<Number>::Vector(const size_type n) : ReadWriteVector<Number>(n)
+ inline Vector<Number>::Vector(const size_type n)
+ : ReadWriteVector<Number>(n)
{}
// Downcast V. If fails, throws an exception.
const Vector<Number> &down_V = dynamic_cast<const Vector<Number> &>(V);
- Assert(
- down_V.size() == this->size(),
- ExcMessage("Cannot add two vectors with different numbers of elements"));
+ Assert(down_V.size() == this->size(),
+ ExcMessage(
+ "Cannot add two vectors with different numbers of elements"));
ReadWriteVector<Number>::reinit(down_V, omit_zeroing_entries);
}
dealii::internal::VectorOperations::Vector_copy<Number, Number> copier(
in_vector.values.get(), this->values.get());
- internal::VectorOperations::parallel_for(
- copier, 0, this->size(), this->thread_loop_partitioner);
+ internal::VectorOperations::parallel_for(copier,
+ 0,
+ this->size(),
+ this->thread_loop_partitioner);
return *this;
}
dealii::internal::VectorOperations::Vector_copy<Number, Number2> copier(
in_vector.values.get(), this->values.get());
- internal::VectorOperations::parallel_for(
- copier, 0, this->size(), this->thread_loop_partitioner);
+ internal::VectorOperations::parallel_for(copier,
+ 0,
+ this->size(),
+ this->thread_loop_partitioner);
return *this;
}
internal::VectorOperations::Vector_set<Number> setter(Number(),
this->values.get());
- internal::VectorOperations::parallel_for(
- setter, 0, this->size(), this->thread_loop_partitioner);
+ internal::VectorOperations::parallel_for(setter,
+ 0,
+ this->size(),
+ this->thread_loop_partitioner);
return *this;
}
internal::VectorOperations::Vectorization_multiply_factor<Number>
vector_multiply(this->values.get(), factor);
- internal::VectorOperations::parallel_for(
- vector_multiply, 0, this->size(), this->thread_loop_partitioner);
+ internal::VectorOperations::parallel_for(vector_multiply,
+ 0,
+ this->size(),
+ this->thread_loop_partitioner);
return *this;
}
// Downcast V. If fails, throws an exception.
const Vector<Number> &down_V = dynamic_cast<const Vector<Number> &>(V);
- Assert(
- down_V.size() == this->size(),
- ExcMessage("Cannot add two vectors with different numbers of elements"));
+ Assert(down_V.size() == this->size(),
+ ExcMessage(
+ "Cannot add two vectors with different numbers of elements"));
internal::VectorOperations::Vectorization_add_v<Number> vector_add(
this->values.get(), down_V.values.get());
- internal::VectorOperations::parallel_for(
- vector_add, 0, this->size(), this->thread_loop_partitioner);
+ internal::VectorOperations::parallel_for(vector_add,
+ 0,
+ this->size(),
+ this->thread_loop_partitioner);
return *this;
}
"Cannot subtract two vectors with different numbers of elements"));
internal::VectorOperations::Vectorization_subtract_v<Number>
vector_subtract(this->values.get(), down_V.values.get());
- internal::VectorOperations::parallel_for(
- vector_subtract, 0, this->size(), this->thread_loop_partitioner);
+ internal::VectorOperations::parallel_for(vector_subtract,
+ 0,
+ this->size(),
+ this->thread_loop_partitioner);
return *this;
}
internal::VectorOperations::Vectorization_add_factor<Number> vector_add(
this->values.get(), a);
- internal::VectorOperations::parallel_for(
- vector_add, 0, this->size(), this->thread_loop_partitioner);
+ internal::VectorOperations::parallel_for(vector_add,
+ 0,
+ this->size(),
+ this->thread_loop_partitioner);
}
// Downcast V. If fails, throws an exception.
const Vector<Number> &down_V = dynamic_cast<const Vector<Number> &>(V);
AssertIsFinite(a);
- Assert(
- down_V.size() == this->size(),
- ExcMessage("Cannot add two vectors with different numbers of elements"));
+ Assert(down_V.size() == this->size(),
+ ExcMessage(
+ "Cannot add two vectors with different numbers of elements"));
internal::VectorOperations::Vectorization_add_av<Number> vector_add_av(
this->values.get(), down_V.values.get(), a);
- internal::VectorOperations::parallel_for(
- vector_add_av, 0, this->size(), this->thread_loop_partitioner);
+ internal::VectorOperations::parallel_for(vector_add_av,
+ 0,
+ this->size(),
+ this->thread_loop_partitioner);
}
// Downcast W. If fails, throws an exception.
const Vector<Number> &down_W = dynamic_cast<const Vector<Number> &>(W);
AssertIsFinite(a);
- Assert(
- down_V.size() == this->size(),
- ExcMessage("Cannot add two vectors with different numbers of elements"));
+ Assert(down_V.size() == this->size(),
+ ExcMessage(
+ "Cannot add two vectors with different numbers of elements"));
AssertIsFinite(b);
- Assert(
- down_W.size() == this->size(),
- ExcMessage("Cannot add two vectors with different numbers of elements"));
+ Assert(down_W.size() == this->size(),
+ ExcMessage(
+ "Cannot add two vectors with different numbers of elements"));
internal::VectorOperations::Vectorization_add_avpbw<Number> vector_add(
this->values.get(), down_V.values.get(), down_W.values.get(), a, b);
- internal::VectorOperations::parallel_for(
- vector_add, 0, this->size(), this->thread_loop_partitioner);
+ internal::VectorOperations::parallel_for(vector_add,
+ 0,
+ this->size(),
+ this->thread_loop_partitioner);
}
const Vector<Number> &down_V = dynamic_cast<const Vector<Number> &>(V);
internal::VectorOperations::Vectorization_sadd_xav<Number> vector_sadd_xav(
this->values.get(), down_V.values.get(), a, s);
- internal::VectorOperations::parallel_for(
- vector_sadd_xav, 0, this->size(), this->thread_loop_partitioner);
+ internal::VectorOperations::parallel_for(vector_sadd_xav,
+ 0,
+ this->size(),
+ this->thread_loop_partitioner);
}
// Downcast scaling_factors. If fails, throws an exception.
const Vector<Number> &down_scaling_factors =
dynamic_cast<const Vector<Number> &>(scaling_factors);
- Assert(
- down_scaling_factors.size() == this->size(),
- ExcMessage("Cannot add two vectors with different numbers of elements"));
+ Assert(down_scaling_factors.size() == this->size(),
+ ExcMessage(
+ "Cannot add two vectors with different numbers of elements"));
internal::VectorOperations::Vectorization_scale<Number> vector_scale(
this->values.get(), down_scaling_factors.values.get());
- internal::VectorOperations::parallel_for(
- vector_scale, 0, this->size(), this->thread_loop_partitioner);
+ internal::VectorOperations::parallel_for(vector_scale,
+ 0,
+ this->size(),
+ this->thread_loop_partitioner);
}
const Vector<Number> &down_V = dynamic_cast<const Vector<Number> &>(V);
internal::VectorOperations::Vectorization_equ_au<Number> vector_equ(
this->values.get(), down_V.values.get(), a);
- internal::VectorOperations::parallel_for(
- vector_equ, 0, this->size(), this->thread_loop_partitioner);
+ internal::VectorOperations::parallel_for(vector_equ,
+ 0,
+ this->size(),
+ this->thread_loop_partitioner);
}
// Downcast W. If fails, throws an exception.
const Vector<Number> &down_W = dynamic_cast<const Vector<Number> &>(W);
AssertIsFinite(a);
- Assert(
- down_V.size() == this->size(),
- ExcMessage("Cannot add two vectors with different numbers of elements"));
- Assert(
- down_W.size() == this->size(),
- ExcMessage("Cannot add two vectors with different numbers of elements"));
+ Assert(down_V.size() == this->size(),
+ ExcMessage(
+ "Cannot add two vectors with different numbers of elements"));
+ Assert(down_W.size() == this->size(),
+ ExcMessage(
+ "Cannot add two vectors with different numbers of elements"));
Number sum;
- internal::VectorOperations::AddAndDot<Number> adder(
- this->values.get(), down_V.values.get(), down_W.values.get(), a);
+ internal::VectorOperations::AddAndDot<Number> adder(this->values.get(),
+ down_V.values.get(),
+ down_W.values.get(),
+ a);
internal::VectorOperations::parallel_reduce(
adder, 0, this->size(), sum, this->thread_loop_partitioner);
AssertIsFinite(sum);
LAPACKFullMatrix<number>::Tvmult_add(Vector<number2> &,
const Vector<number2> &) const
{
- Assert(
- false,
- ExcMessage("LAPACKFullMatrix<number>::Tvmult_add must be called with a "
- "matching Vector<double> vector type."));
+ Assert(false,
+ ExcMessage(
+ "LAPACKFullMatrix<number>::Tvmult_add must be called with a "
+ "matching Vector<double> vector type."));
}
* be used for any linear operator operations, and will throw an exception
* upon invocation.
*/
- LinearOperator(const Payload &payload = Payload()) :
- Payload(payload),
- is_null_operator(false)
+ LinearOperator(const Payload &payload = Payload())
+ : Payload(payload)
+ , is_null_operator(false)
{
vmult = [](Range &, const Domain &) {
Assert(false,
template <typename MatrixType>
-inline MatrixBlock<MatrixType>::MatrixBlock() :
- row(numbers::invalid_size_type),
- column(numbers::invalid_size_type)
+inline MatrixBlock<MatrixType>::MatrixBlock()
+ : row(numbers::invalid_size_type)
+ , column(numbers::invalid_size_type)
{}
template <typename MatrixType>
-inline MatrixBlock<MatrixType>::MatrixBlock(const MatrixBlock<MatrixType> &M) :
- Subscriptor(),
- row(M.row),
- column(M.column),
- matrix(M.matrix),
- row_indices(M.row_indices),
- column_indices(M.column_indices)
+inline MatrixBlock<MatrixType>::MatrixBlock(const MatrixBlock<MatrixType> &M)
+ : Subscriptor()
+ , row(M.row)
+ , column(M.column)
+ , matrix(M.matrix)
+ , row_indices(M.row_indices)
+ , column_indices(M.column_indices)
{}
template <typename MatrixType>
-inline MatrixBlock<MatrixType>::MatrixBlock(size_type i, size_type j) :
- row(i),
- column(j)
+inline MatrixBlock<MatrixType>::MatrixBlock(size_type i, size_type j)
+ : row(i)
+ , column(j)
{}
template <typename MatrixType>
inline MGMatrixBlockVector<MatrixType>::MGMatrixBlockVector(const bool e,
- const bool f) :
- edge_matrices(e),
- edge_flux_matrices(f)
+ const bool f)
+ : edge_matrices(e)
+ , edge_flux_matrices(f)
{}
template <class ACCESSOR>
inline MatrixIterator<ACCESSOR>::MatrixIterator(MatrixType * matrix,
const size_type r,
- const size_type i) :
- accessor(matrix, r, i)
+ const size_type i)
+ : accessor(matrix, r, i)
{}
template <class ACCESSOR>
template <class OtherAccessor>
inline MatrixIterator<ACCESSOR>::MatrixIterator(
- const MatrixIterator<OtherAccessor> &other) :
- accessor(other.accessor)
+ const MatrixIterator<OtherAccessor> &other)
+ : accessor(other.accessor)
{}
PackagedOperation()
{
apply = [](Range &) {
- Assert(
- false,
- ExcMessage("Uninitialized PackagedOperation<Range>::apply called"));
+ Assert(false,
+ ExcMessage(
+ "Uninitialized PackagedOperation<Range>::apply called"));
};
apply_add = [](Range &) {
- Assert(
- false,
- ExcMessage("Uninitialized PackagedOperation<Range>::apply_add called"));
+ Assert(false,
+ ExcMessage(
+ "Uninitialized PackagedOperation<Range>::apply_add called"));
};
reinit_vector = [](Range &, bool) {
/**
* Constructor.
*/
- Shift(const MatrixType &A, const MatrixType &B, const double sigma) :
- A(A),
- B(B),
- sigma(sigma)
+ Shift(const MatrixType &A, const MatrixType &B, const double sigma)
+ : A(A)
+ , B(B)
+ , sigma(sigma)
{}
/**
const unsigned int number_of_arnoldi_vectors,
const WhichEigenvalues eigenvalue_of_interest,
const bool symmetric,
- const int mode) :
- number_of_arnoldi_vectors(number_of_arnoldi_vectors),
- eigenvalue_of_interest(eigenvalue_of_interest),
- symmetric(symmetric),
- mode(mode)
+ const int mode)
+ : number_of_arnoldi_vectors(number_of_arnoldi_vectors)
+ , eigenvalue_of_interest(eigenvalue_of_interest)
+ , symmetric(symmetric)
+ , mode(mode)
{
// Check for possible options for symmetric problems
if (symmetric)
template <typename VectorType>
PArpackSolver<VectorType>::PArpackSolver(SolverControl & control,
const MPI_Comm & mpi_communicator,
- const AdditionalData &data) :
- solver_control(control),
- additional_data(data),
- mpi_communicator(mpi_communicator),
- mpi_communicator_fortran(MPI_Comm_c2f(mpi_communicator)),
- lworkl(0),
- nloc(0),
- ncv(0),
- ldv(0),
- initial_vector_provided(false),
- ldz(0),
- lworkev(0),
- sigmar(0.0),
- sigmai(0.0)
+ const AdditionalData &data)
+ : solver_control(control)
+ , additional_data(data)
+ , mpi_communicator(mpi_communicator)
+ , mpi_communicator_fortran(MPI_Comm_c2f(mpi_communicator))
+ , lworkl(0)
+ , nloc(0)
+ , ncv(0)
+ , ldv(0)
+ , initial_vector_provided(false)
+ , ldz(0)
+ , lworkev(0)
+ , sigmar(0.0)
+ , sigmai(0.0)
{}
initial_vector_provided = true;
Assert(resid.size() == local_indices.size(),
ExcDimensionMismatch(resid.size(), local_indices.size()));
- vec.extract_subvector_to(
- local_indices.begin(), local_indices.end(), resid.data());
+ vec.extract_subvector_to(local_indices.begin(),
+ local_indices.end(),
+ resid.data());
}
{
if (additional_data.symmetric)
{
- Assert(
- n_eigenvalues <= eigenvectors.size(),
- PArpackExcInvalidEigenvectorSize(n_eigenvalues, eigenvectors.size()));
+ Assert(n_eigenvalues <= eigenvectors.size(),
+ PArpackExcInvalidEigenvectorSize(n_eigenvalues,
+ eigenvectors.size()));
}
else
Assert(n_eigenvalues + 1 <= eigenvectors.size(),
// implemented modes
// store the result
- dst.extract_subvector_to(
- local_indices.begin(), local_indices.end(), workd.data() + shift_y);
+ dst.extract_subvector_to(local_indices.begin(),
+ local_indices.end(),
+ workd.data() + shift_y);
} // end of pd*aupd_ loop
// 1 - compute eigenvectors,
{
inline const_iterator::Accessor::Accessor(const MatrixBase *matrix,
const size_type row,
- const size_type index) :
- matrix(const_cast<MatrixBase *>(matrix)),
- a_row(row),
- a_index(index)
+ const size_type index)
+ : matrix(const_cast<MatrixBase *>(matrix))
+ , a_row(row)
+ , a_index(index)
{
visit_present_row();
}
inline const_iterator::const_iterator(const MatrixBase *matrix,
const size_type row,
- const size_type index) :
- accessor(matrix, row, index)
+ const size_type index)
+ : accessor(matrix, row, index)
{}
}
- inline BlockVector::BlockVector(const BlockVector &v) :
- BlockVectorBase<Vector>()
+ inline BlockVector::BlockVector(const BlockVector &v)
+ : BlockVectorBase<Vector>()
{
this->components.resize(v.n_blocks());
this->block_indices = v.block_indices;
this->components.resize(this->n_blocks());
for (unsigned int i = 0; i < this->n_blocks(); ++i)
- this->components[i].reinit(
- communicator, block_sizes[i], local_sizes[i], omit_zeroing_entries);
+ this->components[i].reinit(communicator,
+ block_sizes[i],
+ local_sizes[i],
+ omit_zeroing_entries);
}
this->components.resize(this->n_blocks());
for (unsigned int i = 0; i < this->n_blocks(); ++i)
- block(i).reinit(
- parallel_partitioning[i], ghost_entries[i], communicator);
+ block(i).reinit(parallel_partitioning[i],
+ ghost_entries[i],
+ communicator);
}
template <typename number>
Vector::Vector(const MPI_Comm & communicator,
const dealii::Vector<number> &v,
- const size_type local_size) :
- communicator(communicator)
+ const size_type local_size)
+ : communicator(communicator)
{
Vector::create_vector(v.size(), local_size);
namespace internal
{
inline VectorReference::VectorReference(const VectorBase &vector,
- const size_type index) :
- vector(vector),
- index(index)
+ const size_type index)
+ : vector(vector)
+ , index(index)
{}
VectorBase::extract_subvector_to(const std::vector<size_type> &indices,
std::vector<PetscScalar> & values) const
{
- extract_subvector_to(
- &(indices[0]), &(indices[0]) + indices.size(), &(values[0]));
+ extract_subvector_to(&(indices[0]),
+ &(indices[0]) + indices.size(),
+ &(values[0]));
}
template <typename ForwardIterator, typename OutputIterator>
template <typename MatrixType, typename VectorType>
-PointerMatrix<MatrixType, VectorType>::PointerMatrix(const MatrixType *M) :
- m(M, typeid(*this).name())
+PointerMatrix<MatrixType, VectorType>::PointerMatrix(const MatrixType *M)
+ : m(M, typeid(*this).name())
{}
template <typename MatrixType, typename VectorType>
-PointerMatrix<MatrixType, VectorType>::PointerMatrix(const char *name) :
- m(nullptr, name)
+PointerMatrix<MatrixType, VectorType>::PointerMatrix(const char *name)
+ : m(nullptr, name)
{}
template <typename MatrixType, typename VectorType>
PointerMatrix<MatrixType, VectorType>::PointerMatrix(const MatrixType *M,
- const char * name) :
- m(M, name)
+ const char * name)
+ : m(M, name)
{}
template <typename MatrixType, typename VectorType>
PointerMatrixAux<MatrixType, VectorType>::PointerMatrixAux(
VectorMemory<VectorType> *mem,
- const MatrixType * M) :
- mem(mem, typeid(*this).name()),
- m(M, typeid(*this).name())
+ const MatrixType * M)
+ : mem(mem, typeid(*this).name())
+ , m(M, typeid(*this).name())
{
if (mem == 0)
mem = &my_memory;
template <typename MatrixType, typename VectorType>
PointerMatrixAux<MatrixType, VectorType>::PointerMatrixAux(
VectorMemory<VectorType> *mem,
- const char * name) :
- mem(mem, name),
- m(0, name)
+ const char * name)
+ : mem(mem, name)
+ , m(0, name)
{
if (mem == 0)
mem = &my_memory;
PointerMatrixAux<MatrixType, VectorType>::PointerMatrixAux(
VectorMemory<VectorType> *mem,
const MatrixType * M,
- const char * name) :
- mem(mem, name),
- m(M, name)
+ const char * name)
+ : mem(mem, name)
+ , m(M, name)
{
if (mem == nullptr)
mem = &my_memory;
template <typename number>
-PointerMatrixVector<number>::PointerMatrixVector(const Vector<number> *M) :
- m(M, typeid(*this).name())
+PointerMatrixVector<number>::PointerMatrixVector(const Vector<number> *M)
+ : m(M, typeid(*this).name())
{}
template <typename number>
-PointerMatrixVector<number>::PointerMatrixVector(const char *name) : m(0, name)
+PointerMatrixVector<number>::PointerMatrixVector(const char *name)
+ : m(0, name)
{}
template <typename number>
PointerMatrixVector<number>::PointerMatrixVector(const Vector<number> *M,
- const char * name) :
- m(M, name)
+ const char * name)
+ : m(M, name)
{}
#ifndef DOXYGEN
-inline PreconditionIdentity::PreconditionIdentity() : n_rows(0), n_columns(0)
+inline PreconditionIdentity::PreconditionIdentity()
+ : n_rows(0)
+ , n_columns(0)
{}
template <typename MatrixType>
//---------------------------------------------------------------------------
inline PreconditionRichardson::AdditionalData::AdditionalData(
- const double relaxation) :
- relaxation(relaxation)
+ const double relaxation)
+ : relaxation(relaxation)
{}
-inline PreconditionRichardson::PreconditionRichardson() :
- relaxation(0),
- n_rows(0),
- n_columns(0)
+inline PreconditionRichardson::PreconditionRichardson()
+ : relaxation(0)
+ , n_rows(0)
+ , n_columns(0)
{
AdditionalData add_data;
relaxation = add_data.relaxation;
PreconditionPSOR<MatrixType>::AdditionalData::AdditionalData(
const std::vector<size_type> &permutation,
const std::vector<size_type> &inverse_permutation,
- const typename PreconditionRelaxation<MatrixType>::AdditionalData
- ¶meters) :
- permutation(permutation),
- inverse_permutation(inverse_permutation),
- parameters(parameters)
+ const typename PreconditionRelaxation<MatrixType>::AdditionalData ¶meters)
+ : permutation(permutation)
+ , inverse_permutation(inverse_permutation)
+ , parameters(parameters)
{}
template <typename MatrixType, class VectorType>
PreconditionUseMatrix<MatrixType, VectorType>::PreconditionUseMatrix(
const MatrixType & M,
- const function_ptr method) :
- matrix(M),
- precondition(method)
+ const function_ptr method)
+ : matrix(M)
+ , precondition(method)
{}
template <typename MatrixType>
inline PreconditionRelaxation<MatrixType>::AdditionalData::AdditionalData(
- const double relaxation) :
- relaxation(relaxation)
+ const double relaxation)
+ : relaxation(relaxation)
{}
const Number factor2,
Number * update1,
Number * update2,
- Number * dst) :
- src(src),
- matrix_diagonal_inverse(matrix_diagonal_inverse),
- do_startup(factor1 == Number()),
- start_zero(start_zero),
- factor1(factor1),
- factor2(factor2),
- update1(update1),
- update2(update2),
- dst(dst)
+ Number * dst)
+ : src(src)
+ , matrix_diagonal_inverse(matrix_diagonal_inverse)
+ , do_startup(factor1 == Number())
+ , start_zero(start_zero)
+ , factor1(factor1)
+ , factor2(factor2)
+ , update1(update1)
+ , update2(update2)
+ , dst(dst)
{}
void
struct VectorUpdatesRange : public parallel::ParallelForInteger
{
VectorUpdatesRange(const VectorUpdater<Number> &updater,
- const std::size_t size) :
- updater(updater)
+ const std::size_t size)
+ : updater(updater)
{
if (size < internal::VectorImplementation::minimum_parallel_grain_size)
apply_to_subrange(0, size);
const bool nonzero_starting,
const unsigned int eig_cg_n_iterations,
const double eig_cg_residual,
- const double max_eigenvalue) :
- degree(degree),
- smoothing_range(smoothing_range),
- nonzero_starting(nonzero_starting),
- eig_cg_n_iterations(eig_cg_n_iterations),
- eig_cg_residual(eig_cg_residual),
- max_eigenvalue(max_eigenvalue)
+ const double max_eigenvalue)
+ : degree(degree)
+ , smoothing_range(smoothing_range)
+ , nonzero_starting(nonzero_starting)
+ , eig_cg_n_iterations(eig_cg_n_iterations)
+ , eig_cg_residual(eig_cg_residual)
+ , max_eigenvalue(max_eigenvalue)
{}
template <typename MatrixType, typename VectorType, typename PreconditionerType>
inline PreconditionChebyshev<MatrixType, VectorType, PreconditionerType>::
- PreconditionChebyshev() :
- theta(1.),
- delta(1.),
- eigenvalues_are_initialized(false)
+ PreconditionChebyshev()
+ : theta(1.)
+ , delta(1.)
+ , eigenvalues_are_initialized(false)
{
static_assert(
std::is_same<size_type, typename VectorType::size_type>::value,
double max_eigenvalue, min_eigenvalue;
if (data.eig_cg_n_iterations > 0)
{
- Assert(
- data.eig_cg_n_iterations > 2,
- ExcMessage("Need to set at least two iterations to find eigenvalues."));
+ Assert(data.eig_cg_n_iterations > 2,
+ ExcMessage(
+ "Need to set at least two iterations to find eigenvalues."));
// set a very strict tolerance to force at least two iterations
ReductionControl control(
inline PreconditionBlockJacobi<MatrixType, inverse_type>::const_iterator::
Accessor::Accessor(
const PreconditionBlockJacobi<MatrixType, inverse_type> *matrix,
- const size_type row) :
- matrix(matrix),
- b_iterator(&matrix->inverse(0), 0, 0),
- b_end(&matrix->inverse(0), 0, 0)
+ const size_type row)
+ : matrix(matrix)
+ , b_iterator(&matrix->inverse(0), 0, 0)
+ , b_end(&matrix->inverse(0), 0, 0)
{
bs = matrix->block_size();
a_block = row / bs;
inline PreconditionBlockJacobi<MatrixType, inverse_type>::const_iterator::
const_iterator(
const PreconditionBlockJacobi<MatrixType, inverse_type> *matrix,
- const size_type row) :
- accessor(matrix, row)
+ const size_type row)
+ : accessor(matrix, row)
{}
const size_type block_size,
const double relaxation,
const bool invert_diagonal,
- const bool same_diagonal) :
- relaxation(relaxation),
- block_size(block_size),
- invert_diagonal(invert_diagonal),
- same_diagonal(same_diagonal),
- inversion(PreconditionBlockBase<inverse_type>::gauss_jordan),
- threshold(0.)
+ const bool same_diagonal)
+ : relaxation(relaxation)
+ , block_size(block_size)
+ , invert_diagonal(invert_diagonal)
+ , same_diagonal(same_diagonal)
+ , inversion(PreconditionBlockBase<inverse_type>::gauss_jordan)
+ , threshold(0.)
{}
template <typename MatrixType, typename inverse_type>
-PreconditionBlock<MatrixType, inverse_type>::PreconditionBlock(bool store) :
- PreconditionBlockBase<inverse_type>(store),
- blocksize(0),
- A(nullptr, typeid(*this).name()),
- relaxation(1.0)
+PreconditionBlock<MatrixType, inverse_type>::PreconditionBlock(bool store)
+ : PreconditionBlockBase<inverse_type>(store)
+ , blocksize(0)
+ , A(nullptr, typeid(*this).name())
+ , relaxation(1.0)
{}
blocksize = bsize;
relaxation = parameters.relaxation;
const unsigned int nblocks = A->m() / bsize;
- this->reinit(
- nblocks, blocksize, parameters.same_diagonal, parameters.inversion);
+ this->reinit(nblocks,
+ blocksize,
+ parameters.same_diagonal,
+ parameters.inversion);
if (parameters.invert_diagonal)
{
template <typename MatrixType, typename inverse_type>
-PreconditionBlockSOR<MatrixType, inverse_type>::PreconditionBlockSOR() :
- PreconditionBlock<MatrixType, inverse_type>(false)
+PreconditionBlockSOR<MatrixType, inverse_type>::PreconditionBlockSOR()
+ : PreconditionBlock<MatrixType, inverse_type>(false)
{}
template <typename MatrixType, typename inverse_type>
-PreconditionBlockSOR<MatrixType, inverse_type>::PreconditionBlockSOR(
- bool store) :
- PreconditionBlock<MatrixType, inverse_type>(store)
+PreconditionBlockSOR<MatrixType, inverse_type>::PreconditionBlockSOR(bool store)
+ : PreconditionBlock<MatrixType, inverse_type>(store)
{}
template <typename MatrixType, typename inverse_type>
-PreconditionBlockSSOR<MatrixType, inverse_type>::PreconditionBlockSSOR() :
- PreconditionBlockSOR<MatrixType, inverse_type>(true)
+PreconditionBlockSSOR<MatrixType, inverse_type>::PreconditionBlockSSOR()
+ : PreconditionBlockSOR<MatrixType, inverse_type>(true)
{}
template <typename number>
inline PreconditionBlockBase<number>::PreconditionBlockBase(bool store,
- Inversion method) :
- inversion(method),
- n_diagonal_blocks(0),
- var_store_diagonals(store),
- var_same_diagonal(false),
- var_inverses_ready(false)
+ Inversion method)
+ : inversion(method)
+ , n_diagonal_blocks(0)
+ , var_store_diagonals(store)
+ , var_same_diagonal(false)
+ , var_inverses_ready(false)
{}
template <typename MatrixType, typename VectorType>
PreconditionSelector<MatrixType, VectorType>::PreconditionSelector(
const std::string & preconditioning,
- const typename VectorType::value_type &omega) :
- preconditioning(preconditioning),
- omega(omega)
+ const typename VectorType::value_type &omega)
+ : preconditioning(preconditioning)
+ , omega(omega)
{}
#ifndef DOXYGEN
template <typename Number>
- inline ReadWriteVector<Number>::ReadWriteVector() :
- Subscriptor(),
- values(nullptr, free)
+ inline ReadWriteVector<Number>::ReadWriteVector()
+ : Subscriptor()
+ , values(nullptr, free)
{
// virtual functions called in constructors and destructors never use the
// override in a derived class
template <typename Number>
inline ReadWriteVector<Number>::ReadWriteVector(
- const ReadWriteVector<Number> &v) :
- Subscriptor(),
- values(nullptr, free)
+ const ReadWriteVector<Number> &v)
+ : Subscriptor()
+ , values(nullptr, free)
{
this->operator=(v);
}
template <typename Number>
- inline ReadWriteVector<Number>::ReadWriteVector(const size_type size) :
- Subscriptor(),
- values(nullptr, free)
+ inline ReadWriteVector<Number>::ReadWriteVector(const size_type size)
+ : Subscriptor()
+ , values(nullptr, free)
{
// virtual functions called in constructors and destructors never use the
// override in a derived class
template <typename Number>
inline ReadWriteVector<Number>::ReadWriteVector(
- const IndexSet &locally_stored_indices) :
- Subscriptor(),
- values(nullptr, free)
+ const IndexSet &locally_stored_indices)
+ : Subscriptor()
+ , values(nullptr, free)
{
// virtual functions called in constructors and destructors never use the
// override in a derived class
template <typename Functor>
inline ReadWriteVector<Number>::FunctorTemplate<Functor>::FunctorTemplate(
ReadWriteVector<Number> &parent,
- const Functor & functor) :
- parent(parent),
- functor(functor)
+ const Functor & functor)
+ : parent(parent)
+ , functor(functor)
{}
else
{
Number *new_values;
- Utilities::System::posix_memalign(
- (void **)&new_values, 64, sizeof(Number) * new_alloc_size);
+ Utilities::System::posix_memalign((void **)&new_values,
+ 64,
+ sizeof(Number) * new_alloc_size);
values.reset(new_values);
if (new_alloc_size >= 4 * dealii::internal::VectorImplementation::
ReadWriteVector<Number>::apply(const Functor &func)
{
FunctorTemplate<Functor> functor(*this, func);
- internal::VectorOperations::parallel_for(
- functor, 0, n_elements(), thread_loop_partitioner);
+ internal::VectorOperations::parallel_for(functor,
+ 0,
+ n_elements(),
+ thread_loop_partitioner);
}
dealii::internal::VectorOperations::Vector_copy<Number, Number> copier(
in_vector.values.get(), values.get());
- dealii::internal::VectorOperations::parallel_for(
- copier, 0, n_elements(), thread_loop_partitioner);
+ dealii::internal::VectorOperations::parallel_for(copier,
+ 0,
+ n_elements(),
+ thread_loop_partitioner);
return *this;
}
dealii::internal::VectorOperations::Vector_copy<Number, Number2> copier(
in_vector.values.get(), values.get());
- dealii::internal::VectorOperations::parallel_for(
- copier, 0, n_elements(), thread_loop_partitioner);
+ dealii::internal::VectorOperations::parallel_for(copier,
+ 0,
+ n_elements(),
+ thread_loop_partitioner);
return *this;
}
epetra_comm_pattern =
std::dynamic_pointer_cast<const EpetraWrappers::CommunicationPattern>(
communication_pattern);
- AssertThrow(
- epetra_comm_pattern != nullptr,
- ExcMessage(std::string("The communication pattern is not of type ") +
- "LinearAlgebra::EpetraWrappers::CommunicationPattern."));
+ AssertThrow(epetra_comm_pattern != nullptr,
+ ExcMessage(
+ std::string("The communication pattern is not of type ") +
+ "LinearAlgebra::EpetraWrappers::CommunicationPattern."));
}
Epetra_Import import(epetra_comm_pattern->get_epetra_import());
const typename PreconditionBlockBase<InverseNumberType>::Inversion
inversion,
const double threshold,
- VectorType * temp_ghost_vector) :
- relaxation(relaxation),
- invert_diagonal(invert_diagonal),
- same_diagonal(same_diagonal),
- inversion(inversion),
- threshold(threshold),
- temp_ghost_vector(temp_ghost_vector)
+ VectorType * temp_ghost_vector)
+ : relaxation(relaxation)
+ , invert_diagonal(invert_diagonal)
+ , same_diagonal(same_diagonal)
+ , inversion(inversion)
+ , threshold(threshold)
+ , temp_ghost_vector(temp_ghost_vector)
{}
if (n_converged > n_eigenpairs)
n_converged = n_eigenpairs;
- AssertThrow(
- n_converged == n_eigenpairs,
- ExcSLEPcEigenvectorConvergenceMismatchError(n_converged, n_eigenpairs));
+ AssertThrow(n_converged == n_eigenpairs,
+ ExcSLEPcEigenvectorConvergenceMismatchError(n_converged,
+ n_eigenpairs));
AssertThrow(eigenvectors.size() != 0, ExcSLEPcWrappersUsageError());
eigenvectors.resize(n_converged, eigenvectors.front());
if (n_converged >= n_eigenpairs)
n_converged = n_eigenpairs;
- AssertThrow(
- n_converged == n_eigenpairs,
- ExcSLEPcEigenvectorConvergenceMismatchError(n_converged, n_eigenpairs));
+ AssertThrow(n_converged == n_eigenpairs,
+ ExcSLEPcEigenvectorConvergenceMismatchError(n_converged,
+ n_eigenpairs));
AssertThrow(eigenvectors.size() != 0, ExcSLEPcWrappersUsageError());
eigenvectors.resize(n_converged, eigenvectors.front());
AssertThrow(A.n() == B.n(), ExcDimensionMismatch(A.n(), B.n()));
// and incompatible eigenvalue/eigenvector sizes
- AssertThrow(
- real_eigenvalues.size() == imag_eigenvalues.size(),
- ExcDimensionMismatch(real_eigenvalues.size(), imag_eigenvalues.size()));
- AssertThrow(
- real_eigenvectors.size() == imag_eigenvectors.size(),
- ExcDimensionMismatch(real_eigenvectors.size(), imag_eigenvectors.size()));
+ AssertThrow(real_eigenvalues.size() == imag_eigenvalues.size(),
+ ExcDimensionMismatch(real_eigenvalues.size(),
+ imag_eigenvalues.size()));
+ AssertThrow(real_eigenvectors.size() == imag_eigenvectors.size(),
+ ExcDimensionMismatch(real_eigenvectors.size(),
+ imag_eigenvectors.size()));
// Panic if the number of eigenpairs wanted is out of bounds.
AssertThrow((n_eigenpairs > 0) && (n_eigenpairs <= A.m()),
if (n_converged >= n_eigenpairs)
n_converged = n_eigenpairs;
- AssertThrow(
- n_converged == n_eigenpairs,
- ExcSLEPcEigenvectorConvergenceMismatchError(n_converged, n_eigenpairs));
+ AssertThrow(n_converged == n_eigenpairs,
+ ExcSLEPcEigenvectorConvergenceMismatchError(n_converged,
+ n_eigenpairs));
AssertThrow((real_eigenvectors.size() != 0) &&
(imag_eigenvectors.size() != 0),
ExcSLEPcWrappersUsageError());
* signal is called, but not the vector that will be returned if the
* signal's return value indicates that the iteration should be terminated.
*/
- boost::signals2::signal<SolverControl::State(
- const unsigned int iteration,
- const double check_value,
- const VectorType & current_iterate),
- StateCombiner>
+ boost::signals2::signal<
+ SolverControl::State(const unsigned int iteration,
+ const double check_value,
+ const VectorType & current_iterate),
+ StateCombiner>
iteration_status;
};
template <class VectorType>
inline Solver<VectorType>::Solver(SolverControl & solver_control,
- VectorMemory<VectorType> &vector_memory) :
- memory(vector_memory)
+ VectorMemory<VectorType> &vector_memory)
+ : memory(vector_memory)
{
// connect the solver control object to the signal. SolverControl::check
// only takes two arguments, the iteration and the check_value, and so
template <class VectorType>
-inline Solver<VectorType>::Solver(SolverControl &solver_control) :
- // use the static memory object this class owns
+inline Solver<VectorType>::Solver(SolverControl &solver_control)
+ : // use the static memory object this class owns
memory(static_vector_memory)
{
// connect the solver control object to the signal. SolverControl::check
* parameter 1e-10.
*/
explicit AdditionalData(const bool exact_residual = true,
- const double breakdown = 1.e-10) :
- exact_residual(exact_residual),
- breakdown(breakdown)
+ const double breakdown = 1.e-10)
+ : exact_residual(exact_residual)
+ , breakdown(breakdown)
{}
/**
* Flag for exact computation of residual.
const bool breakdown,
const SolverControl::State state,
const unsigned int last_step,
- const double last_residual) :
- breakdown(breakdown),
- state(state),
- last_step(last_step),
- last_residual(last_residual)
+ const double last_residual)
+ : breakdown(breakdown)
+ , state(state)
+ , last_step(last_step)
+ , last_residual(last_residual)
{}
template <typename VectorType>
SolverBicgstab<VectorType>::SolverBicgstab(SolverControl & cn,
VectorMemory<VectorType> &mem,
- const AdditionalData & data) :
- Solver<VectorType>(cn, mem),
- Vx(nullptr),
- Vb(nullptr),
- additional_data(data)
+ const AdditionalData & data)
+ : Solver<VectorType>(cn, mem)
+ , Vx(nullptr)
+ , Vb(nullptr)
+ , additional_data(data)
{}
template <typename VectorType>
SolverBicgstab<VectorType>::SolverBicgstab(SolverControl & cn,
- const AdditionalData &data) :
- Solver<VectorType>(cn),
- Vx(nullptr),
- Vb(nullptr),
- additional_data(data)
+ const AdditionalData &data)
+ : Solver<VectorType>(cn)
+ , Vx(nullptr)
+ , Vb(nullptr)
+ , additional_data(data)
{}
while (state.breakdown == true);
// in case of failure: throw exception
- AssertThrow(
- state.state == SolverControl::success,
- SolverControl::NoConvergence(state.last_step, state.last_residual));
+ AssertThrow(state.state == SolverControl::success,
+ SolverControl::NoConvergence(state.last_step,
+ state.last_residual));
// otherwise exit as normal
}
template <typename VectorType>
SolverCG<VectorType>::SolverCG(SolverControl & cn,
VectorMemory<VectorType> &mem,
- const AdditionalData & data) :
- Solver<VectorType>(cn, mem),
- additional_data(data)
+ const AdditionalData & data)
+ : Solver<VectorType>(cn, mem)
+ , additional_data(data)
{}
template <typename VectorType>
-SolverCG<VectorType>::SolverCG(SolverControl &cn, const AdditionalData &data) :
- Solver<VectorType>(cn),
- additional_data(data)
+SolverCG<VectorType>::SolverCG(SolverControl &cn, const AdditionalData &data)
+ : Solver<VectorType>(cn)
+ , additional_data(data)
{}
all_condition_numbers_signal);
}
- compute_eigs_and_cond(
- diagonal, offdiagonal, eigenvalues_signal, condition_number_signal);
+ compute_eigs_and_cond(diagonal,
+ offdiagonal,
+ eigenvalues_signal,
+ condition_number_signal);
// in case of failure: throw exception
if (conv != SolverControl::success)
class NoConvergence : public dealii::ExceptionBase
{
public:
- NoConvergence(const unsigned int last_step, const double last_residual) :
- last_step(last_step),
- last_residual(last_residual)
+ NoConvergence(const unsigned int last_step, const double last_residual)
+ : last_step(last_step)
+ , last_residual(last_residual)
{}
virtual ~NoConvergence() noexcept override = default;
SolverFIRE<VectorType>::AdditionalData::AdditionalData(
const double initial_timestep,
const double maximum_timestep,
- const double maximum_linfty_norm) :
- initial_timestep(initial_timestep),
- maximum_timestep(maximum_timestep),
- maximum_linfty_norm(maximum_linfty_norm)
+ const double maximum_linfty_norm)
+ : initial_timestep(initial_timestep)
+ , maximum_timestep(maximum_timestep)
+ , maximum_linfty_norm(maximum_linfty_norm)
{
AssertThrow(initial_timestep > 0. && maximum_timestep > 0. &&
maximum_linfty_norm > 0.,
template <typename VectorType>
SolverFIRE<VectorType>::SolverFIRE(SolverControl & solver_control,
VectorMemory<VectorType> &vector_memory,
- const AdditionalData & data) :
- Solver<VectorType>(solver_control, vector_memory),
- additional_data(data)
+ const AdditionalData & data)
+ : Solver<VectorType>(solver_control, vector_memory)
+ , additional_data(data)
{}
template <typename VectorType>
SolverFIRE<VectorType>::SolverFIRE(SolverControl & solver_control,
- const AdditionalData &data) :
- Solver<VectorType>(solver_control),
- additional_data(data)
+ const AdditionalData &data)
+ : Solver<VectorType>(solver_control)
+ , additional_data(data)
{}
* Constructor. By default, set the maximum basis size to 30.
*/
explicit AdditionalData(const unsigned int max_basis_size = 30,
- const bool /*use_default_residual*/ = true) :
- max_basis_size(max_basis_size)
+ const bool /*use_default_residual*/ = true)
+ : max_basis_size(max_basis_size)
{}
/**
{
template <class VectorType>
inline TmpVectors<VectorType>::TmpVectors(const unsigned int max_size,
- VectorMemory<VectorType> &vmem) :
- mem(vmem),
- data(max_size)
+ VectorMemory<VectorType> &vmem)
+ : mem(vmem)
+ , data(max_size)
{}
const unsigned int max_n_tmp_vectors,
const bool right_preconditioning,
const bool use_default_residual,
- const bool force_re_orthogonalization) :
- max_n_tmp_vectors(max_n_tmp_vectors),
- right_preconditioning(right_preconditioning),
- use_default_residual(use_default_residual),
- force_re_orthogonalization(force_re_orthogonalization)
+ const bool force_re_orthogonalization)
+ : max_n_tmp_vectors(max_n_tmp_vectors)
+ , right_preconditioning(right_preconditioning)
+ , use_default_residual(use_default_residual)
+ , force_re_orthogonalization(force_re_orthogonalization)
{
Assert(3 <= max_n_tmp_vectors,
ExcMessage("SolverGMRES needs at least three "
template <class VectorType>
SolverGMRES<VectorType>::SolverGMRES(SolverControl & cn,
VectorMemory<VectorType> &mem,
- const AdditionalData & data) :
- Solver<VectorType>(cn, mem),
- additional_data(data)
+ const AdditionalData & data)
+ : Solver<VectorType>(cn, mem)
+ , additional_data(data)
{}
template <class VectorType>
SolverGMRES<VectorType>::SolverGMRES(SolverControl & cn,
- const AdditionalData &data) :
- Solver<VectorType>(cn),
- additional_data(data)
+ const AdditionalData &data)
+ : Solver<VectorType>(cn)
+ , additional_data(data)
{}
// Orthogonalization
h(0) = vv * orthogonal_vectors[0];
for (unsigned int i = 1; i < dim; ++i)
- h(i) = vv.add_and_dot(
- -h(i - 1), orthogonal_vectors[i - 1], orthogonal_vectors[i]);
+ h(i) = vv.add_and_dot(-h(i - 1),
+ orthogonal_vectors[i - 1],
+ orthogonal_vectors[i]);
double norm_vv =
std::sqrt(vv.add_and_dot(-h(dim - 1), orthogonal_vectors[dim - 1], vv));
h(0) += htmp;
for (unsigned int i = 1; i < dim; ++i)
{
- htmp = vv.add_and_dot(
- -htmp, orthogonal_vectors[i - 1], orthogonal_vectors[i]);
+ htmp = vv.add_and_dot(-htmp,
+ orthogonal_vectors[i - 1],
+ orthogonal_vectors[i]);
h(i) += htmp;
}
norm_vv =
const double preconditioned_res = x_->l2_norm();
last_res = preconditioned_res;
- iteration_state = this->iteration_status(
- accumulated_iterations, preconditioned_res, x);
+ iteration_state =
+ this->iteration_status(accumulated_iterations,
+ preconditioned_res,
+ x);
}
}
};
template <class VectorType>
SolverFGMRES<VectorType>::SolverFGMRES(SolverControl & cn,
VectorMemory<VectorType> &mem,
- const AdditionalData & data) :
- Solver<VectorType>(cn, mem),
- additional_data(data)
+ const AdditionalData & data)
+ : Solver<VectorType>(cn, mem)
+ , additional_data(data)
{}
template <class VectorType>
SolverFGMRES<VectorType>::SolverFGMRES(SolverControl & cn,
- const AdditionalData &data) :
- Solver<VectorType>(cn),
- additional_data(data)
+ const AdditionalData &data)
+ : Solver<VectorType>(cn)
+ , additional_data(data)
{}
template <class VectorType>
SolverMinRes<VectorType>::SolverMinRes(SolverControl & cn,
VectorMemory<VectorType> &mem,
- const AdditionalData &) :
- Solver<VectorType>(cn, mem),
- res2(numbers::signaling_nan<double>())
+ const AdditionalData &)
+ : Solver<VectorType>(cn, mem)
+ , res2(numbers::signaling_nan<double>())
{}
template <class VectorType>
SolverMinRes<VectorType>::SolverMinRes(SolverControl &cn,
- const AdditionalData &) :
- Solver<VectorType>(cn),
- res2(numbers::signaling_nan<double>())
+ const AdditionalData &)
+ : Solver<VectorType>(cn)
+ , res2(numbers::signaling_nan<double>())
{}
explicit AdditionalData(const bool left_preconditioning = false,
const double solver_tolerance = 1.e-9,
const bool breakdown_testing = true,
- const double breakdown_threshold = 1.e-16) :
- left_preconditioning(left_preconditioning),
- solver_tolerance(solver_tolerance),
- breakdown_testing(breakdown_testing),
- breakdown_threshold(breakdown_threshold)
+ const double breakdown_threshold = 1.e-16)
+ : left_preconditioning(left_preconditioning)
+ , solver_tolerance(solver_tolerance)
+ , breakdown_testing(breakdown_testing)
+ , breakdown_threshold(breakdown_threshold)
{}
/**
template <class VectorType>
SolverQMRS<VectorType>::IterationResult::IterationResult(
const SolverControl::State state,
- const double last_residual) :
- state(state),
- last_residual(last_residual)
+ const double last_residual)
+ : state(state)
+ , last_residual(last_residual)
{}
template <class VectorType>
SolverQMRS<VectorType>::SolverQMRS(SolverControl & cn,
VectorMemory<VectorType> &mem,
- const AdditionalData & data) :
- Solver<VectorType>(cn, mem),
- additional_data(data),
- step(0)
+ const AdditionalData & data)
+ : Solver<VectorType>(cn, mem)
+ , additional_data(data)
+ , step(0)
{}
template <class VectorType>
SolverQMRS<VectorType>::SolverQMRS(SolverControl & cn,
- const AdditionalData &data) :
- Solver<VectorType>(cn),
- additional_data(data),
- step(0)
+ const AdditionalData &data)
+ : Solver<VectorType>(cn)
+ , additional_data(data)
+ , step(0)
{}
template <class VectorType>
template <class VectorType>
SolverRelaxation<VectorType>::SolverRelaxation(SolverControl &cn,
- const AdditionalData &) :
- Solver<VectorType>(cn)
+ const AdditionalData &)
+ : Solver<VectorType>(cn)
{}
template <class VectorType>
inline SolverRichardson<VectorType>::AdditionalData::AdditionalData(
const double omega,
- const bool use_preconditioned_residual) :
- omega(omega),
- use_preconditioned_residual(use_preconditioned_residual)
+ const bool use_preconditioned_residual)
+ : omega(omega)
+ , use_preconditioned_residual(use_preconditioned_residual)
{}
template <class VectorType>
SolverRichardson<VectorType>::SolverRichardson(SolverControl & cn,
VectorMemory<VectorType> &mem,
- const AdditionalData & data) :
- Solver<VectorType>(cn, mem),
- additional_data(data)
+ const AdditionalData & data)
+ : Solver<VectorType>(cn, mem)
+ , additional_data(data)
{}
template <class VectorType>
SolverRichardson<VectorType>::SolverRichardson(SolverControl & cn,
- const AdditionalData &data) :
- Solver<VectorType>(cn),
- additional_data(data)
+ const AdditionalData &data)
+ : Solver<VectorType>(cn)
+ , additional_data(data)
{}
const double strengthen_diag,
const unsigned int extra_off_diag,
const bool use_prev_sparsity,
- const SparsityPattern *use_this_spars) :
- strengthen_diagonal(strengthen_diag),
- extra_off_diagonals(extra_off_diag),
- use_previous_sparsity(use_prev_sparsity),
- use_this_sparsity(use_this_spars)
+ const SparsityPattern *use_this_spars)
+ : strengthen_diagonal(strengthen_diag)
+ , extra_off_diagonals(extra_off_diag)
+ , use_previous_sparsity(use_prev_sparsity)
+ , use_this_sparsity(use_this_spars)
{}
DEAL_II_NAMESPACE_OPEN
template <typename number>
-SparseLUDecomposition<number>::SparseLUDecomposition() :
- SparseMatrix<number>(),
- strengthen_diagonal(0),
- own_sparsity(nullptr)
+SparseLUDecomposition<number>::SparseLUDecomposition()
+ : SparseMatrix<number>()
+ , strengthen_diagonal(0)
+ , own_sparsity(nullptr)
{}
}
// now use this sparsity pattern
- Assert(
- sparsity_pattern_to_use->n_rows() == sparsity_pattern_to_use->n_cols(),
- ExcMessage("It is not possible to compute this matrix decomposition for "
- "matrices that are not square."));
+ Assert(sparsity_pattern_to_use->n_rows() == sparsity_pattern_to_use->n_cols(),
+ ExcMessage(
+ "It is not possible to compute this matrix decomposition for "
+ "matrices that are not square."));
{
std::vector<const size_type *> tmp;
tmp.swap(prebuilt_lower_bound);
number * this_ptr = this->val.get();
const number *const end_ptr = this_ptr + this->n_nonzero_elements();
if (std::is_same<somenumber, number>::value == true)
- std::memcpy(
- this_ptr, input_ptr, this->n_nonzero_elements() * sizeof(number));
+ std::memcpy(this_ptr,
+ input_ptr,
+ this->n_nonzero_elements() * sizeof(number));
else
for (; this_ptr != end_ptr; ++input_ptr, ++this_ptr)
*this_ptr = *input_ptr;
namespace SparseMatrixIterators
{
template <typename number>
- inline Accessor<number, true>::Accessor(
- const MatrixType *matrix,
- const std::size_t index_within_matrix) :
- SparsityPatternIterators::Accessor(&matrix->get_sparsity_pattern(),
- index_within_matrix),
- matrix(matrix)
+ inline Accessor<number, true>::Accessor(const MatrixType *matrix,
+ const std::size_t index_within_matrix)
+ : SparsityPatternIterators::Accessor(&matrix->get_sparsity_pattern(),
+ index_within_matrix)
+ , matrix(matrix)
{}
template <typename number>
- inline Accessor<number, true>::Accessor(const MatrixType *matrix) :
- SparsityPatternIterators::Accessor(&matrix->get_sparsity_pattern()),
- matrix(matrix)
+ inline Accessor<number, true>::Accessor(const MatrixType *matrix)
+ : SparsityPatternIterators::Accessor(&matrix->get_sparsity_pattern())
+ , matrix(matrix)
{}
template <typename number>
inline Accessor<number, true>::Accessor(
- const SparseMatrixIterators::Accessor<number, false> &a) :
- SparsityPatternIterators::Accessor(a),
- matrix(&a.get_matrix())
+ const SparseMatrixIterators::Accessor<number, false> &a)
+ : SparsityPatternIterators::Accessor(a)
+ , matrix(&a.get_matrix())
{}
template <typename number>
inline Accessor<number, false>::Reference::Reference(const Accessor *accessor,
- const bool) :
- accessor(accessor)
+ const bool)
+ : accessor(accessor)
{}
template <typename number>
inline Accessor<number, false>::Accessor(MatrixType * matrix,
- const std::size_t index) :
- SparsityPatternIterators::Accessor(&matrix->get_sparsity_pattern(), index),
- matrix(matrix)
+ const std::size_t index)
+ : SparsityPatternIterators::Accessor(&matrix->get_sparsity_pattern(), index)
+ , matrix(matrix)
{}
template <typename number>
- inline Accessor<number, false>::Accessor(MatrixType *matrix) :
- SparsityPatternIterators::Accessor(&matrix->get_sparsity_pattern()),
- matrix(matrix)
+ inline Accessor<number, false>::Accessor(MatrixType *matrix)
+ : SparsityPatternIterators::Accessor(&matrix->get_sparsity_pattern())
+ , matrix(matrix)
{}
template <typename number, bool Constness>
inline Iterator<number, Constness>::Iterator(MatrixType * matrix,
- const std::size_t index) :
- accessor(matrix, index)
+ const std::size_t index)
+ : accessor(matrix, index)
{}
template <typename number, bool Constness>
- inline Iterator<number, Constness>::Iterator(MatrixType *matrix) :
- accessor(matrix)
+ inline Iterator<number, Constness>::Iterator(MatrixType *matrix)
+ : accessor(matrix)
{}
template <typename number, bool Constness>
inline Iterator<number, Constness>::Iterator(
- const SparseMatrixIterators::Iterator<number, false> &i) :
- accessor(*i)
+ const SparseMatrixIterators::Iterator<number, false> &i)
+ : accessor(*i)
{}
template <typename number>
-SparseMatrix<number>::SparseMatrix() :
- cols(nullptr, "SparseMatrix"),
- val(nullptr),
- max_len(0)
+SparseMatrix<number>::SparseMatrix()
+ : cols(nullptr, "SparseMatrix")
+ , val(nullptr)
+ , max_len(0)
{}
template <typename number>
-SparseMatrix<number>::SparseMatrix(const SparseMatrix &m) :
- Subscriptor(m),
- cols(nullptr, "SparseMatrix"),
- val(nullptr),
- max_len(0)
+SparseMatrix<number>::SparseMatrix(const SparseMatrix &m)
+ : Subscriptor(m)
+ , cols(nullptr, "SparseMatrix")
+ , val(nullptr)
+ , max_len(0)
{
- Assert(
- m.cols == nullptr && m.val == nullptr && m.max_len == 0,
- ExcMessage("This constructor can only be called if the provided argument "
- "is an empty matrix. This constructor can not be used to "
- "copy-construct a non-empty matrix. Use the "
- "SparseMatrix::copy_from() function for that purpose."));
+ Assert(m.cols == nullptr && m.val == nullptr && m.max_len == 0,
+ ExcMessage(
+ "This constructor can only be called if the provided argument "
+ "is an empty matrix. This constructor can not be used to "
+ "copy-construct a non-empty matrix. Use the "
+ "SparseMatrix::copy_from() function for that purpose."));
}
template <typename number>
-SparseMatrix<number>::SparseMatrix(SparseMatrix<number> &&m) noexcept :
- Subscriptor(std::move(m)),
- cols(m.cols),
- val(std::move(m.val)),
- max_len(m.max_len)
+SparseMatrix<number>::SparseMatrix(SparseMatrix<number> &&m) noexcept
+ : Subscriptor(std::move(m))
+ , cols(m.cols)
+ , val(std::move(m.val))
+ , max_len(m.max_len)
{
m.cols = nullptr;
m.val = nullptr;
template <typename number>
-SparseMatrix<number>::SparseMatrix(const SparsityPattern &c) :
- cols(nullptr, "SparseMatrix"),
- val(nullptr),
- max_len(0)
+SparseMatrix<number>::SparseMatrix(const SparsityPattern &c)
+ : cols(nullptr, "SparseMatrix")
+ , val(nullptr)
+ , max_len(0)
{
// virtual functions called in constructors and destructors never use the
// override in a derived class
template <typename number>
SparseMatrix<number>::SparseMatrix(const SparsityPattern &c,
- const IdentityMatrix & id) :
- cols(nullptr, "SparseMatrix"),
- val(nullptr),
- max_len(0)
+ const IdentityMatrix & id)
+ : cols(nullptr, "SparseMatrix")
+ , val(nullptr)
+ , max_len(0)
{
(void)id;
Assert(c.n_rows() == id.m(), ExcDimensionMismatch(c.n_rows(), id.m()));
Assert(val != nullptr, ExcNotInitialized());
Assert(cols == matrix.cols, ExcDifferentSparsityPatterns());
- std::copy(
- matrix.val.get(), matrix.val.get() + cols->n_nonzero_elements(), val.get());
+ std::copy(matrix.val.get(),
+ matrix.val.get() + cols->n_nonzero_elements(),
+ val.get());
return *this;
}
// really sorted
#ifdef DEBUG
for (size_type i = 1; i < n_cols; ++i)
- Assert(
- col_indices[i] > col_indices[i - 1],
- ExcMessage("List of indices is unsorted or contains duplicates."));
+ Assert(col_indices[i] > col_indices[i - 1],
+ ExcMessage(
+ "List of indices is unsorted or contains duplicates."));
#endif
const size_type *this_cols = &cols->colnums[cols->rowstart[row]];
val_ptr[counter] += values[i];
}
- Assert(
- counter < cols->row_length(row),
- ExcMessage("Specified invalid column indices in add function."));
+ Assert(counter < cols->row_length(row),
+ ExcMessage(
+ "Specified invalid column indices in add function."));
}
else
{
val_ptr[counter] += values[i];
}
- Assert(
- counter < cols->row_length(row),
- ExcMessage("Specified invalid column indices in add function."));
+ Assert(counter < cols->row_length(row),
+ ExcMessage(
+ "Specified invalid column indices in add function."));
}
return;
}
// special treatment for diagonal
if (sp_B.n_rows() == sp_B.n_cols())
{
- C.add(
- i,
- *new_cols,
- numberC(A_val) *
- numberC(B.val[new_cols - &sp_B.colnums[sp_B.rowstart[0]]]) *
- numberC(use_vector ? V(col) : 1));
+ C.add(i,
+ *new_cols,
+ numberC(A_val) *
+ numberC(
+ B.val[new_cols - &sp_B.colnums[sp_B.rowstart[0]]]) *
+ numberC(use_vector ? V(col) : 1));
++new_cols;
}
// special treatment for diagonal
if (sp_B.n_rows() == sp_B.n_cols())
- C.add(
- row,
- i,
- numberC(A_val) *
- numberC(B.val[new_cols - 1 - &sp_B.colnums[sp_B.rowstart[0]]]) *
- numberC(use_vector ? V(i) : 1));
+ C.add(row,
+ i,
+ numberC(A_val) *
+ numberC(
+ B.val[new_cols - 1 - &sp_B.colnums[sp_B.rowstart[0]]]) *
+ numberC(use_vector ? V(i) : 1));
// now the innermost loop that goes over all the elements in row
// 'col' of matrix B. Cache the elements, and then write them into C
template <typename number>
inline SparseMatrixEZ<number>::Entry::Entry(const size_type column,
- const number & value) :
- column(column),
- value(value)
+ const number & value)
+ : column(column)
+ , value(value)
{}
template <typename number>
-inline SparseMatrixEZ<number>::Entry::Entry() : column(invalid), value(0)
+inline SparseMatrixEZ<number>::Entry::Entry()
+ : column(invalid)
+ , value(0)
{}
template <typename number>
-inline SparseMatrixEZ<number>::RowInfo::RowInfo(const size_type start) :
- start(start),
- length(0),
- diagonal(invalid_diagonal)
+inline SparseMatrixEZ<number>::RowInfo::RowInfo(const size_type start)
+ : start(start)
+ , length(0)
+ , diagonal(invalid_diagonal)
{}
inline SparseMatrixEZ<number>::const_iterator::Accessor::Accessor(
const SparseMatrixEZ<number> *matrix,
const size_type r,
- const unsigned short i) :
- matrix(matrix),
- a_row(r),
- a_index(i)
+ const unsigned short i)
+ : matrix(matrix)
+ , a_row(r)
+ , a_index(i)
{}
inline SparseMatrixEZ<number>::const_iterator::const_iterator(
const SparseMatrixEZ<number> *matrix,
const size_type r,
- const unsigned short i) :
- accessor(matrix, r, i)
+ const unsigned short i)
+ : accessor(matrix, r, i)
{
// Finish if this is the end()
if (r == accessor.matrix->m() && i == 0)
//---------------------------------------------------------------------------
template <typename number>
-SparseMatrixEZ<number>::SparseMatrixEZ() :
- n_columns(0),
- increment(1),
- saved_default_row_length(0)
+SparseMatrixEZ<number>::SparseMatrixEZ()
+ : n_columns(0)
+ , increment(1)
+ , saved_default_row_length(0)
{}
template <typename number>
-SparseMatrixEZ<number>::SparseMatrixEZ(const SparseMatrixEZ<number> &m) :
- Subscriptor(m),
- n_columns(0),
- increment(m.increment),
- saved_default_row_length(m.saved_default_row_length)
+SparseMatrixEZ<number>::SparseMatrixEZ(const SparseMatrixEZ<number> &m)
+ : Subscriptor(m)
+ , n_columns(0)
+ , increment(m.increment)
+ , saved_default_row_length(m.saved_default_row_length)
{
- Assert(
- m.m() == 0 && m.n() == 0,
- ExcMessage("This constructor can only be called if the provided argument "
- "is an empty matrix. This constructor can not be used to "
- "copy-construct a non-empty matrix. Use the "
- "SparseMatrixEZ::copy_from() function for that purpose."));
+ Assert(m.m() == 0 && m.n() == 0,
+ ExcMessage(
+ "This constructor can only be called if the provided argument "
+ "is an empty matrix. This constructor can not be used to "
+ "copy-construct a non-empty matrix. Use the "
+ "SparseMatrixEZ::copy_from() function for that purpose."));
}
DEAL_II_NAMESPACE_OPEN
template <typename number>
-SparseMIC<number>::SparseMIC() : diag(0), inv_diag(0), inner_sums(0)
+SparseMIC<number>::SparseMIC()
+ : diag(0)
+ , inv_diag(0)
+ , inner_sums(0)
{}
DEAL_II_NAMESPACE_OPEN
template <typename number>
-SparseVanka<number>::SparseVanka() :
- matrix(),
- conserve_mem(false),
- selected(),
- n_threads(0),
- inverses(),
- _m(0),
- _n(0)
+SparseVanka<number>::SparseVanka()
+ : matrix()
+ , conserve_mem(false)
+ , selected()
+ , n_threads(0)
+ , inverses()
+ , _m(0)
+ , _n(0)
{}
template <typename number>
SparseVanka<number>::SparseVanka(const SparseMatrix<number> &M,
const std::vector<bool> & selected_dofs,
const bool conserve_mem,
- const unsigned int n_threads) :
- matrix(&M, typeid(*this).name()),
- conserve_mem(conserve_mem),
- selected(&selected_dofs),
- n_threads(n_threads),
- inverses(M.m(), nullptr),
- _m(M.m()),
- _n(M.n())
+ const unsigned int n_threads)
+ : matrix(&M, typeid(*this).name())
+ , conserve_mem(conserve_mem)
+ , selected(&selected_dofs)
+ , n_threads(n_threads)
+ , inverses(M.m(), nullptr)
+ , _m(M.m())
+ , _n(M.n())
{
Assert(M.m() == M.n(), ExcNotQuadratic());
Assert(M.m() == selected->size(),
// Now spawn the threads
Threads::ThreadGroup<> threads;
for (unsigned int i = 0; i < n_threads; ++i)
- threads += Threads::new_thread(
- fun_ptr, *this, blocking[i].first, blocking[i].second);
+ threads += Threads::new_thread(fun_ptr,
+ *this,
+ blocking[i].first,
+ blocking[i].second);
threads.join_all();
#endif
}
// couple with @p row.
local_index.clear();
for (size_type i = 0; i < row_length; ++i)
- local_index.insert(std::pair<size_type, size_type>(
- structure.column_number(row, i), i));
+ local_index.insert(
+ std::pair<size_type, size_type>(structure.column_number(row, i),
+ i));
// Build local matrix and rhs
for (std::map<size_type, size_type>::const_iterator is =
SparseVanka<number>::AdditionalData::AdditionalData(
const std::vector<bool> &selected,
const bool conserve_mem,
- const unsigned int n_threads) :
- selected(selected),
- conserve_mem(conserve_mem),
- n_threads(n_threads)
+ const unsigned int n_threads)
+ : selected(selected)
+ , conserve_mem(conserve_mem)
+ , n_threads(n_threads)
{}
const unsigned int n_blocks,
const BlockingStrategy blocking_strategy,
const bool conserve_memory,
- const unsigned int n_threads) :
- SparseVanka<number>(M, selected, conserve_memory, n_threads),
- n_blocks(n_blocks),
- dof_masks(n_blocks, std::vector<bool>(M.m(), false))
+ const unsigned int n_threads)
+ : SparseVanka<number>(M, selected, conserve_memory, n_threads)
+ , n_blocks(n_blocks)
+ , dof_masks(n_blocks, std::vector<bool>(M.m(), false))
{
compute_dof_masks(M, selected, blocking_strategy);
}
// simpler for the compiler
// by giving it the correct
// type right away:
- typedef void (SparseVanka<number>::*mem_fun_p)(
- Vector<number2> &,
- const Vector<number2> &,
- const std::vector<bool> *const) const;
+ typedef void (
+ SparseVanka<number>::*mem_fun_p)(Vector<number2> &,
+ const Vector<number2> &,
+ const std::vector<bool> *const) const;
const mem_fun_p comp =
&SparseVanka<number>::template apply_preconditioner<number2>;
Threads::ThreadGroup<> threads;
namespace SparsityPatternIterators
{
inline Accessor::Accessor(const SparsityPattern *sparsity_pattern,
- const std::size_t i) :
- sparsity_pattern(sparsity_pattern),
- index_within_sparsity(i)
+ const std::size_t i)
+ : sparsity_pattern(sparsity_pattern)
+ , index_within_sparsity(i)
{}
- inline Accessor::Accessor(const SparsityPattern *sparsity_pattern) :
- sparsity_pattern(sparsity_pattern),
- index_within_sparsity(sparsity_pattern->rowstart[sparsity_pattern->rows])
+ inline Accessor::Accessor(const SparsityPattern *sparsity_pattern)
+ : sparsity_pattern(sparsity_pattern)
+ , index_within_sparsity(sparsity_pattern->rowstart[sparsity_pattern->rows])
{}
{
Assert(is_valid_entry() == true, ExcInvalidIterator());
- const std::size_t *insert_point = std::upper_bound(
- sparsity_pattern->rowstart.get(),
- sparsity_pattern->rowstart.get() + sparsity_pattern->rows + 1,
- index_within_sparsity);
+ const std::size_t *insert_point =
+ std::upper_bound(sparsity_pattern->rowstart.get(),
+ sparsity_pattern->rowstart.get() +
+ sparsity_pattern->rows + 1,
+ index_within_sparsity);
return insert_point - sparsity_pattern->rowstart.get() - 1;
}
inline Iterator::Iterator(const SparsityPattern *sparsity_pattern,
- const std::size_t i) :
- accessor(sparsity_pattern, i)
+ const std::size_t i)
+ : accessor(sparsity_pattern, i)
{}
template <typename number>
-SwappableVector<number>::SwappableVector() : data_is_preloaded(false)
+SwappableVector<number>::SwappableVector()
+ : data_is_preloaded(false)
{}
template <typename number>
-SwappableVector<number>::SwappableVector(const SwappableVector<number> &v) :
- Vector<number>(v),
- filename(),
- data_is_preloaded(false)
+SwappableVector<number>::SwappableVector(const SwappableVector<number> &v)
+ : Vector<number>(v)
+ , filename()
+ , data_is_preloaded(false)
{
Assert(v.filename == "", ExcInvalidCopyOperation());
}
std::array<Table<2, Number>, dim> mass_copy;
std::array<Table<2, Number>, dim> deriv_copy;
- std::transform(
- mass_matrix.cbegin(),
- mass_matrix.cend(),
- mass_copy.begin(),
- [](const FullMatrix<Number> &m) -> Table<2, Number> { return m; });
- std::transform(
- derivative_matrix.cbegin(),
- derivative_matrix.cend(),
- deriv_copy.begin(),
- [](const FullMatrix<Number> &m) -> Table<2, Number> { return m; });
+ std::transform(mass_matrix.cbegin(),
+ mass_matrix.cend(),
+ mass_copy.begin(),
+ [](const FullMatrix<Number> &m) -> Table<2, Number> {
+ return m;
+ });
+ std::transform(derivative_matrix.cbegin(),
+ derivative_matrix.cend(),
+ deriv_copy.begin(),
+ [](const FullMatrix<Number> &m) -> Table<2, Number> {
+ return m;
+ });
reinit_impl(std::move(mass_copy), std::move(deriv_copy));
}
std::array<Table<2, Number>, dim> derivative_matrices;
std::fill(mass_matrices.begin(), mass_matrices.end(), mass_matrix);
- std::fill(
- derivative_matrices.begin(), derivative_matrices.end(), derivative_matrix);
+ std::fill(derivative_matrices.begin(),
+ derivative_matrices.end(),
+ derivative_matrix);
reinit_impl(std::move(mass_matrices), std::move(derivative_matrices));
}
std::array<Table<2, VectorizedArray<Number>>, dim> derivative_matrices;
std::fill(mass_matrices.begin(), mass_matrices.end(), mass_matrix);
- std::fill(
- derivative_matrices.begin(), derivative_matrices.end(), derivative_matrix);
+ std::fill(derivative_matrices.begin(),
+ derivative_matrices.end(),
+ derivative_matrix);
reinit_impl(std::move(mass_matrices), std::move(derivative_matrices));
}
const MPI_Comm & communicator,
const bool vector_writable)
{
- reinit(
- parallel_partitioning, ghost_values, communicator, vector_writable);
+ reinit(parallel_partitioning,
+ ghost_values,
+ communicator,
+ vector_writable);
}
- inline BlockVector::BlockVector(const BlockVector &v) :
- dealii::BlockVectorBase<MPI::Vector>()
+ inline BlockVector::BlockVector(const BlockVector &v)
+ : dealii::BlockVectorBase<MPI::Vector>()
{
this->components.resize(v.n_blocks());
this->block_indices = v.block_indices;
preconditioner->OperatorDomainMap().NumMyElements());
AssertDimension(static_cast<TrilinosWrappers::types::int_type>(src.size()),
preconditioner->OperatorRangeMap().NumMyElements());
- Epetra_Vector tril_dst(
- View, preconditioner->OperatorDomainMap(), dst.begin());
+ Epetra_Vector tril_dst(View,
+ preconditioner->OperatorDomainMap(),
+ dst.begin());
Epetra_Vector tril_src(View,
preconditioner->OperatorRangeMap(),
const_cast<double *>(src.begin()));
preconditioner->OperatorDomainMap().NumMyElements());
AssertDimension(static_cast<TrilinosWrappers::types::int_type>(src.size()),
preconditioner->OperatorRangeMap().NumMyElements());
- Epetra_Vector tril_dst(
- View, preconditioner->OperatorDomainMap(), dst.begin());
+ Epetra_Vector tril_dst(View,
+ preconditioner->OperatorDomainMap(),
+ dst.begin());
Epetra_Vector tril_src(View,
preconditioner->OperatorRangeMap(),
const_cast<double *>(src.begin()));
LinearAlgebra::distributed::Vector<double> & dst,
const LinearAlgebra::distributed::Vector<double> &src) const
{
- AssertDimension(
- static_cast<TrilinosWrappers::types::int_type>(dst.local_size()),
- preconditioner->OperatorDomainMap().NumMyElements());
- AssertDimension(
- static_cast<TrilinosWrappers::types::int_type>(src.local_size()),
- preconditioner->OperatorRangeMap().NumMyElements());
- Epetra_Vector tril_dst(
- View, preconditioner->OperatorDomainMap(), dst.begin());
+ AssertDimension(static_cast<TrilinosWrappers::types::int_type>(
+ dst.local_size()),
+ preconditioner->OperatorDomainMap().NumMyElements());
+ AssertDimension(static_cast<TrilinosWrappers::types::int_type>(
+ src.local_size()),
+ preconditioner->OperatorRangeMap().NumMyElements());
+ Epetra_Vector tril_dst(View,
+ preconditioner->OperatorDomainMap(),
+ dst.begin());
Epetra_Vector tril_src(View,
preconditioner->OperatorRangeMap(),
const_cast<double *>(src.begin()));
LinearAlgebra::distributed::Vector<double> & dst,
const LinearAlgebra::distributed::Vector<double> &src) const
{
- AssertDimension(
- static_cast<TrilinosWrappers::types::int_type>(dst.local_size()),
- preconditioner->OperatorDomainMap().NumMyElements());
- AssertDimension(
- static_cast<TrilinosWrappers::types::int_type>(src.local_size()),
- preconditioner->OperatorRangeMap().NumMyElements());
- Epetra_Vector tril_dst(
- View, preconditioner->OperatorDomainMap(), dst.begin());
+ AssertDimension(static_cast<TrilinosWrappers::types::int_type>(
+ dst.local_size()),
+ preconditioner->OperatorDomainMap().NumMyElements());
+ AssertDimension(static_cast<TrilinosWrappers::types::int_type>(
+ src.local_size()),
+ preconditioner->OperatorRangeMap().NumMyElements());
+ Epetra_Vector tril_dst(View,
+ preconditioner->OperatorDomainMap(),
+ dst.begin());
Epetra_Vector tril_src(View,
preconditioner->OperatorRangeMap(),
const_cast<double *>(src.begin()));
{
if (transpose == false)
{
- Assert(
- src.Map().SameAs(mtrx.DomainMap()) == true,
- ExcMessage("Column map of matrix does not fit with vector map!"));
- Assert(
- dst.Map().SameAs(mtrx.RangeMap()) == true,
- ExcMessage("Row map of matrix does not fit with vector map!"));
+ Assert(src.Map().SameAs(mtrx.DomainMap()) == true,
+ ExcMessage(
+ "Column map of matrix does not fit with vector map!"));
+ Assert(dst.Map().SameAs(mtrx.RangeMap()) == true,
+ ExcMessage(
+ "Row map of matrix does not fit with vector map!"));
}
else
{
- Assert(
- src.Map().SameAs(mtrx.RangeMap()) == true,
- ExcMessage("Column map of matrix does not fit with vector map!"));
- Assert(
- dst.Map().SameAs(mtrx.DomainMap()) == true,
- ExcMessage("Row map of matrix does not fit with vector map!"));
+ Assert(src.Map().SameAs(mtrx.RangeMap()) == true,
+ ExcMessage(
+ "Column map of matrix does not fit with vector map!"));
+ Assert(dst.Map().SameAs(mtrx.DomainMap()) == true,
+ ExcMessage(
+ "Row map of matrix does not fit with vector map!"));
}
(void)mtrx; // removes -Wunused-variable in optimized mode
(void)src;
Assert(src.Map().SameAs(op.OperatorDomainMap()) == true,
ExcMessage(
"Column map of operator does not fit with vector map!"));
- Assert(
- dst.Map().SameAs(op.OperatorRangeMap()) == true,
- ExcMessage("Row map of operator does not fit with vector map!"));
+ Assert(dst.Map().SameAs(op.OperatorRangeMap()) == true,
+ ExcMessage(
+ "Row map of operator does not fit with vector map!"));
}
else
{
Assert(src.Map().SameAs(op.OperatorRangeMap()) == true,
ExcMessage(
"Column map of operator does not fit with vector map!"));
- Assert(
- dst.Map().SameAs(op.OperatorDomainMap()) == true,
- ExcMessage("Row map of operator does not fit with vector map!"));
+ Assert(dst.Map().SameAs(op.OperatorDomainMap()) == true,
+ ExcMessage(
+ "Row map of operator does not fit with vector map!"));
}
(void)op; // removes -Wunused-variable in optimized mode
(void)src;
{
inline AccessorBase::AccessorBase(SparseMatrix *matrix,
size_type row,
- size_type index) :
- matrix(matrix),
- a_row(row),
- a_index(index)
+ size_type index)
+ : matrix(matrix)
+ , a_row(row)
+ , a_index(index)
{
visit_present_row();
}
inline Accessor<true>::Accessor(MatrixType * matrix,
const size_type row,
- const size_type index) :
- AccessorBase(const_cast<SparseMatrix *>(matrix), row, index)
+ const size_type index)
+ : AccessorBase(const_cast<SparseMatrix *>(matrix), row, index)
{}
template <bool Other>
- inline Accessor<true>::Accessor(const Accessor<Other> &other) :
- AccessorBase(other)
+ inline Accessor<true>::Accessor(const Accessor<Other> &other)
+ : AccessorBase(other)
{}
}
- inline Accessor<false>::Reference::Reference(const Accessor<false> &acc) :
- accessor(const_cast<Accessor<false> &>(acc))
+ inline Accessor<false>::Reference::Reference(const Accessor<false> &acc)
+ : accessor(const_cast<Accessor<false> &>(acc))
{}
Accessor<false>::Reference::operator=(const TrilinosScalar n) const
{
(*accessor.value_cache)[accessor.a_index] = n;
- accessor.matrix->set(
- accessor.row(), accessor.column(), static_cast<TrilinosScalar>(*this));
+ accessor.matrix->set(accessor.row(),
+ accessor.column(),
+ static_cast<TrilinosScalar>(*this));
return *this;
}
Accessor<false>::Reference::operator+=(const TrilinosScalar n) const
{
(*accessor.value_cache)[accessor.a_index] += n;
- accessor.matrix->set(
- accessor.row(), accessor.column(), static_cast<TrilinosScalar>(*this));
+ accessor.matrix->set(accessor.row(),
+ accessor.column(),
+ static_cast<TrilinosScalar>(*this));
return *this;
}
Accessor<false>::Reference::operator-=(const TrilinosScalar n) const
{
(*accessor.value_cache)[accessor.a_index] -= n;
- accessor.matrix->set(
- accessor.row(), accessor.column(), static_cast<TrilinosScalar>(*this));
+ accessor.matrix->set(accessor.row(),
+ accessor.column(),
+ static_cast<TrilinosScalar>(*this));
return *this;
}
Accessor<false>::Reference::operator*=(const TrilinosScalar n) const
{
(*accessor.value_cache)[accessor.a_index] *= n;
- accessor.matrix->set(
- accessor.row(), accessor.column(), static_cast<TrilinosScalar>(*this));
+ accessor.matrix->set(accessor.row(),
+ accessor.column(),
+ static_cast<TrilinosScalar>(*this));
return *this;
}
Accessor<false>::Reference::operator/=(const TrilinosScalar n) const
{
(*accessor.value_cache)[accessor.a_index] /= n;
- accessor.matrix->set(
- accessor.row(), accessor.column(), static_cast<TrilinosScalar>(*this));
+ accessor.matrix->set(accessor.row(),
+ accessor.column(),
+ static_cast<TrilinosScalar>(*this));
return *this;
}
inline Accessor<false>::Accessor(MatrixType * matrix,
const size_type row,
- const size_type index) :
- AccessorBase(matrix, row, index)
+ const size_type index)
+ : AccessorBase(matrix, row, index)
{}
template <bool Constness>
inline Iterator<Constness>::Iterator(MatrixType * matrix,
const size_type row,
- const size_type index) :
- accessor(matrix, row, index)
+ const size_type index)
+ : accessor(matrix, row, index)
{}
template <bool Constness>
template <bool Other>
- inline Iterator<Constness>::Iterator(const Iterator<Other> &other) :
- accessor(other.accessor)
+ inline Iterator<Constness>::Iterator(const Iterator<Other> &other)
+ : accessor(other.accessor)
{}
if (last_action == Insert)
{
int ierr;
- ierr = matrix->GlobalAssemble(
- *column_space_map, matrix->RowMap(), false);
+ ierr = matrix->GlobalAssemble(*column_space_map,
+ matrix->RowMap(),
+ false);
Assert(ierr == 0, ExcTrilinosError(ierr));
(void)ierr; // removes -Wunused-but-set-variable in optimized mode
// as well as from TrilinosWrappers::SparseMatrix::Tvmult
Assert(&tril_src != &tril_dst,
TrilinosWrappers::SparseMatrix::ExcSourceEqualsDestination());
- internal::check_vector_map_equality(
- payload, tril_src, tril_dst, !payload.UseTranspose());
+ internal::check_vector_map_equality(payload,
+ tril_src,
+ tril_dst,
+ !payload.UseTranspose());
solver.solve(payload, tril_dst, tril_src, preconditioner);
};
// as well as from TrilinosWrappers::SparseMatrix::Tvmult
Assert(&tril_src != &tril_dst,
TrilinosWrappers::SparseMatrix::ExcSourceEqualsDestination());
- internal::check_vector_map_equality(
- payload, tril_src, tril_dst, payload.UseTranspose());
+ internal::check_vector_map_equality(payload,
+ tril_src,
+ tril_dst,
+ payload.UseTranspose());
const_cast<TrilinosPayload &>(payload).transpose();
solver.solve(payload, tril_dst, tril_src, preconditioner);
{
inline Accessor::Accessor(const SparsityPattern *sp,
const size_type row,
- const size_type index) :
- sparsity_pattern(const_cast<SparsityPattern *>(sp)),
- a_row(row),
- a_index(index)
+ const size_type index)
+ : sparsity_pattern(const_cast<SparsityPattern *>(sp))
+ , a_row(row)
+ , a_index(index)
{
visit_present_row();
}
inline Iterator::Iterator(const SparsityPattern *sp,
const size_type row,
- const size_type index) :
- accessor(sp, row, index)
+ const size_type index)
+ : accessor(sp, row, index)
{}
namespace internal
{
inline VectorReference::VectorReference(MPI::Vector & vector,
- const size_type index) :
- vector(vector),
- index(index)
+ const size_type index)
+ : vector(vector)
+ , index(index)
{}
const TrilinosWrappers::types::int_type my_row =
nonlocal_vector->Map().LID(
static_cast<TrilinosWrappers::types::int_type>(row));
- Assert(
- my_row != -1,
- ExcMessage("Attempted to write into off-processor vector entry "
- "that has not be specified as being writable upon "
- "initialization"));
+ Assert(my_row != -1,
+ ExcMessage(
+ "Attempted to write into off-processor vector entry "
+ "that has not be specified as being writable upon "
+ "initialization"));
(*nonlocal_vector)[0][my_row] += values[i];
compressed = false;
}
{
Assert(f != 0, ExcDivideByZero());
const NumberType tau = g / f;
- AssertThrow(
- std::abs(tau) < 1.,
- ExcMessage("real-valued Hyperbolic rotation does not exist for (" +
- std::to_string(f) + "," + std::to_string(g) + ")"));
+ AssertThrow(std::abs(tau) < 1.,
+ ExcMessage(
+ "real-valued Hyperbolic rotation does not exist for (" +
+ std::to_string(f) + "," + std::to_string(g) + ")"));
const NumberType u =
std::copysign(sqrt((1. - tau) * (1. + tau)),
f); // <-- more stable than std::sqrt(1.-tau*tau)
//------------------------ inline functions
template <typename Number>
-inline Vector<Number>::Vector() :
- vec_size(0),
- max_vec_size(0),
- values(nullptr, &free)
+inline Vector<Number>::Vector()
+ : vec_size(0)
+ , max_vec_size(0)
+ , values(nullptr, &free)
{
// virtual functions called in constructors and destructors never use the
// override in a derived class
template <typename Number>
template <typename InputIterator>
-Vector<Number>::Vector(const InputIterator first, const InputIterator last) :
- vec_size(0),
- max_vec_size(0),
- values(nullptr, &free)
+Vector<Number>::Vector(const InputIterator first, const InputIterator last)
+ : vec_size(0)
+ , max_vec_size(0)
+ , values(nullptr, &free)
{
// allocate memory. do not initialize it, as we will copy over to it in a
// second
template <typename Number>
-inline Vector<Number>::Vector(const size_type n) :
- vec_size(0),
- max_vec_size(0),
- values(nullptr, &free)
+inline Vector<Number>::Vector(const size_type n)
+ : vec_size(0)
+ , max_vec_size(0)
+ , values(nullptr, &free)
{
// virtual functions called in constructors and destructors never use the
// override in a derived class
DEAL_II_NAMESPACE_OPEN
template <typename Number>
-Vector<Number>::Vector(const Vector<Number> &v) :
- Subscriptor(),
- vec_size(v.size()),
- max_vec_size(v.size()),
- values(nullptr, &free)
+Vector<Number>::Vector(const Vector<Number> &v)
+ : Subscriptor()
+ , vec_size(v.size())
+ , max_vec_size(v.size())
+ , values(nullptr, &free)
{
if (vec_size != 0)
{
template <typename Number>
-Vector<Number>::Vector(Vector<Number> &&v) noexcept :
- Subscriptor(std::move(v)),
- vec_size(v.vec_size),
- max_vec_size(v.max_vec_size),
- values(std::move(v.values)),
- thread_loop_partitioner(std::move(v.thread_loop_partitioner))
+Vector<Number>::Vector(Vector<Number> &&v) noexcept
+ : Subscriptor(std::move(v))
+ , vec_size(v.vec_size)
+ , max_vec_size(v.max_vec_size)
+ , values(std::move(v.values))
+ , thread_loop_partitioner(std::move(v.thread_loop_partitioner))
{
v.vec_size = 0;
v.max_vec_size = 0;
template <typename Number>
template <typename OtherNumber>
-Vector<Number>::Vector(const Vector<OtherNumber> &v) :
- Subscriptor(),
- vec_size(v.size()),
- max_vec_size(v.size()),
- values(nullptr, &free)
+Vector<Number>::Vector(const Vector<OtherNumber> &v)
+ : Subscriptor()
+ , vec_size(v.size())
+ , max_vec_size(v.size())
+ , values(nullptr, &free)
{
if (vec_size != 0)
{
if (out.size() != v_size)
out.reinit(v_size, true);
- internal::VectorOperations::copy(
- start_ptr, start_ptr + out.size(), out.begin());
+ internal::VectorOperations::copy(start_ptr,
+ start_ptr + out.size(),
+ out.begin());
ierr = VecRestoreArray(sequential_vector, &start_ptr);
AssertThrow(ierr == 0, ExcPETScError(ierr));
template <typename Number>
-Vector<Number>::Vector(const PETScWrappers::VectorBase &v) :
- Subscriptor(),
- vec_size(0),
- max_vec_size(0),
- values(nullptr, &free)
+Vector<Number>::Vector(const PETScWrappers::VectorBase &v)
+ : Subscriptor()
+ , vec_size(0)
+ , max_vec_size(0)
+ , values(nullptr, &free)
{
if (v.size() != 0)
{
#ifdef DEAL_II_WITH_TRILINOS
template <typename Number>
-Vector<Number>::Vector(const TrilinosWrappers::MPI::Vector &v) :
- Subscriptor(),
- vec_size(v.size()),
- max_vec_size(v.size()),
- values(nullptr, &free)
+Vector<Number>::Vector(const TrilinosWrappers::MPI::Vector &v)
+ : Subscriptor()
+ , vec_size(v.size())
+ , max_vec_size(v.size())
+ , values(nullptr, &free)
{
if (vec_size != 0)
{
{
dealii::internal::VectorOperations::Vector_copy<Number, Number> copier(
v.values.get(), values.get());
- internal::VectorOperations::parallel_for(
- copier, 0, vec_size, thread_loop_partitioner);
+ internal::VectorOperations::parallel_for(copier,
+ 0,
+ vec_size,
+ thread_loop_partitioner);
}
return *this;
dealii::internal::VectorOperations::Vector_copy<Number, Number2> copier(
v.values.get(), values.get());
- internal::VectorOperations::parallel_for(
- copier, 0, vec_size, thread_loop_partitioner);
+ internal::VectorOperations::parallel_for(copier,
+ 0,
+ vec_size,
+ thread_loop_partitioner);
return *this;
}
if (vec_size > 0)
{
internal::VectorOperations::Vector_set<Number> setter(s, values.get());
- internal::VectorOperations::parallel_for(
- setter, 0, vec_size, thread_loop_partitioner);
+ internal::VectorOperations::parallel_for(setter,
+ 0,
+ vec_size,
+ thread_loop_partitioner);
}
return *this;
internal::VectorOperations::Vectorization_multiply_factor<Number>
vector_multiply(values.get(), factor);
- internal::VectorOperations::parallel_for(
- vector_multiply, 0, vec_size, thread_loop_partitioner);
+ internal::VectorOperations::parallel_for(vector_multiply,
+ 0,
+ vec_size,
+ thread_loop_partitioner);
return *this;
}
internal::VectorOperations::Vectorization_add_av<Number> vector_add_av(
values.get(), v.values.get(), a);
- internal::VectorOperations::parallel_for(
- vector_add_av, 0, vec_size, thread_loop_partitioner);
+ internal::VectorOperations::parallel_for(vector_add_av,
+ 0,
+ vec_size,
+ thread_loop_partitioner);
}
internal::VectorOperations::Vectorization_sadd_xav<Number> vector_sadd_xav(
values.get(), v.values.get(), a, x);
- internal::VectorOperations::parallel_for(
- vector_sadd_xav, 0, vec_size, thread_loop_partitioner);
+ internal::VectorOperations::parallel_for(vector_sadd_xav,
+ 0,
+ vec_size,
+ thread_loop_partitioner);
}
AssertDimension(vec_size, W.size());
Number sum;
- internal::VectorOperations::AddAndDot<Number> adder(
- this->values.get(), V.values.get(), W.values.get(), a);
+ internal::VectorOperations::AddAndDot<Number> adder(this->values.get(),
+ V.values.get(),
+ W.values.get(),
+ a);
internal::VectorOperations::parallel_reduce(
adder, 0, vec_size, sum, thread_loop_partitioner);
AssertIsFinite(sum);
internal::VectorOperations::Vectorization_add_v<Number> vector_add(
values.get(), v.values.get());
- internal::VectorOperations::parallel_for(
- vector_add, 0, vec_size, thread_loop_partitioner);
+ internal::VectorOperations::parallel_for(vector_add,
+ 0,
+ vec_size,
+ thread_loop_partitioner);
return *this;
}
internal::VectorOperations::Vectorization_subtract_v<Number> vector_subtract(
values.get(), v.values.get());
- internal::VectorOperations::parallel_for(
- vector_subtract, 0, vec_size, thread_loop_partitioner);
+ internal::VectorOperations::parallel_for(vector_subtract,
+ 0,
+ vec_size,
+ thread_loop_partitioner);
return *this;
}
internal::VectorOperations::Vectorization_add_factor<Number> vector_add(
values.get(), v);
- internal::VectorOperations::parallel_for(
- vector_add, 0, vec_size, thread_loop_partitioner);
+ internal::VectorOperations::parallel_for(vector_add,
+ 0,
+ vec_size,
+ thread_loop_partitioner);
}
internal::VectorOperations::Vectorization_add_avpbw<Number> vector_add(
values.get(), v.values.get(), w.values.get(), a, b);
- internal::VectorOperations::parallel_for(
- vector_add, 0, vec_size, thread_loop_partitioner);
+ internal::VectorOperations::parallel_for(vector_add,
+ 0,
+ vec_size,
+ thread_loop_partitioner);
}
internal::VectorOperations::Vectorization_sadd_xv<Number> vector_sadd(
values.get(), v.values.get(), x);
- internal::VectorOperations::parallel_for(
- vector_sadd, 0, vec_size, thread_loop_partitioner);
+ internal::VectorOperations::parallel_for(vector_sadd,
+ 0,
+ vec_size,
+ thread_loop_partitioner);
}
internal::VectorOperations::Vectorization_scale<Number> vector_scale(
values.get(), s.values.get());
- internal::VectorOperations::parallel_for(
- vector_scale, 0, vec_size, thread_loop_partitioner);
+ internal::VectorOperations::parallel_for(vector_scale,
+ 0,
+ vec_size,
+ thread_loop_partitioner);
}
internal::VectorOperations::Vectorization_equ_au<Number> vector_equ(
values.get(), u.values.get(), a);
- internal::VectorOperations::parallel_for(
- vector_equ, 0, vec_size, thread_loop_partitioner);
+ internal::VectorOperations::parallel_for(vector_equ,
+ 0,
+ vec_size,
+ thread_loop_partitioner);
}
internal::VectorOperations::Vectorization_ratio<Number> vector_ratio(
values.get(), a.values.get(), b.values.get());
- internal::VectorOperations::parallel_for(
- vector_ratio, 0, vec_size, thread_loop_partitioner);
+ internal::VectorOperations::parallel_for(vector_ratio,
+ 0,
+ vec_size,
+ thread_loop_partitioner);
}
{
// allocate memory with the proper alignment requirements of 64 bytes
Number *new_values;
- Utilities::System::posix_memalign(
- (void **)&new_values, 64, sizeof(Number) * max_vec_size);
+ Utilities::System::posix_memalign((void **)&new_values,
+ 64,
+ sizeof(Number) * max_vec_size);
// copy:
for (size_type i = 0; i < copy_n_el; ++i)
new_values[i] = values[i];
template <typename VectorType>
-inline VectorMemory<VectorType>::Pointer::Pointer(
- VectorMemory<VectorType> &mem) :
- std::unique_ptr<VectorType, std::function<void(VectorType *)>>(
- mem.alloc(),
- [&mem](VectorType *v) { mem.free(v); })
+inline VectorMemory<VectorType>::Pointer::Pointer(VectorMemory<VectorType> &mem)
+ : std::unique_ptr<VectorType, std::function<void(VectorType *)>>(
+ mem.alloc(),
+ [&mem](VectorType *v) { mem.free(v); })
{}
Threads::Mutex GrowingVectorMemory<VectorType>::mutex;
template <typename VectorType>
-inline GrowingVectorMemory<VectorType>::Pool::Pool() : data(nullptr)
+inline GrowingVectorMemory<VectorType>::Pool::Pool()
+ : data(nullptr)
{}
const size_type initial_size,
const bool log_statistics)
- :
- total_alloc(0),
- current_alloc(0),
- log_statistics(log_statistics)
+ : total_alloc(0)
+ , current_alloc(0)
+ , log_statistics(log_statistics)
{
Threads::Mutex::ScopedLock lock(mutex);
pool.initialize(initial_size);
{
TBBForFunctor(Functor & functor,
const size_type start,
- const size_type end) :
- functor(functor),
- start(start),
- end(end)
+ const size_type end)
+ : functor(functor)
+ , start(start)
+ , end(end)
{
const size_type vec_size = end - start;
// set chunk size for sub-tasks
4 * internal::VectorImplementation::minimum_parallel_grain_size &&
MultithreadInfo::n_threads() > 1)
{
- Assert(
- partitioner.get() != nullptr,
- ExcInternalError("Unexpected initialization of Vector that does "
- "not set the TBB partitioner to a usable state."));
+ Assert(partitioner.get() != nullptr,
+ ExcInternalError(
+ "Unexpected initialization of Vector that does "
+ "not set the TBB partitioner to a usable state."));
std::shared_ptr<tbb::affinity_partitioner> tbb_partitioner =
partitioner->acquire_one_partitioner();
template <typename Number>
struct Vector_set
{
- Vector_set(Number value, Number *dst) : value(value), dst(dst)
+ Vector_set(Number value, Number *dst)
+ : value(value)
+ , dst(dst)
{
Assert(dst != nullptr, ExcInternalError());
}
template <typename Number, typename OtherNumber>
struct Vector_copy
{
- Vector_copy(const OtherNumber *src, Number *dst) : src(src), dst(dst)
+ Vector_copy(const OtherNumber *src, Number *dst)
+ : src(src)
+ , dst(dst)
{
Assert(src != nullptr, ExcInternalError());
Assert(dst != nullptr, ExcInternalError());
template <typename Number>
struct Vectorization_multiply_factor
{
- Vectorization_multiply_factor(Number *val, Number factor) :
- val(val),
- factor(factor)
+ Vectorization_multiply_factor(Number *val, Number factor)
+ : val(val)
+ , factor(factor)
{}
void
template <typename Number>
struct Vectorization_add_av
{
- Vectorization_add_av(Number *val, Number *v_val, Number factor) :
- val(val),
- v_val(v_val),
- factor(factor)
+ Vectorization_add_av(Number *val, Number *v_val, Number factor)
+ : val(val)
+ , v_val(v_val)
+ , factor(factor)
{}
void
template <typename Number>
struct Vectorization_sadd_xav
{
- Vectorization_sadd_xav(Number *val, Number *v_val, Number a, Number x) :
- val(val),
- v_val(v_val),
- a(a),
- x(x)
+ Vectorization_sadd_xav(Number *val, Number *v_val, Number a, Number x)
+ : val(val)
+ , v_val(v_val)
+ , a(a)
+ , x(x)
{}
void
template <typename Number>
struct Vectorization_subtract_v
{
- Vectorization_subtract_v(Number *val, Number *v_val) :
- val(val),
- v_val(v_val)
+ Vectorization_subtract_v(Number *val, Number *v_val)
+ : val(val)
+ , v_val(v_val)
{}
void
template <typename Number>
struct Vectorization_add_factor
{
- Vectorization_add_factor(Number *val, Number factor) :
- val(val),
- factor(factor)
+ Vectorization_add_factor(Number *val, Number factor)
+ : val(val)
+ , factor(factor)
{}
void
template <typename Number>
struct Vectorization_add_v
{
- Vectorization_add_v(Number *val, Number *v_val) : val(val), v_val(v_val)
+ Vectorization_add_v(Number *val, Number *v_val)
+ : val(val)
+ , v_val(v_val)
{}
void
Number *v_val,
Number *w_val,
Number a,
- Number b) :
- val(val),
- v_val(v_val),
- w_val(w_val),
- a(a),
- b(b)
+ Number b)
+ : val(val)
+ , v_val(v_val)
+ , w_val(w_val)
+ , a(a)
+ , b(b)
{}
void
template <typename Number>
struct Vectorization_sadd_xv
{
- Vectorization_sadd_xv(Number *val, Number *v_val, Number x) :
- val(val),
- v_val(v_val),
- x(x)
+ Vectorization_sadd_xv(Number *val, Number *v_val, Number x)
+ : val(val)
+ , v_val(v_val)
+ , x(x)
{}
void
Number *w_val,
Number x,
Number a,
- Number b) :
- val(val),
- v_val(v_val),
- w_val(w_val),
- x(x),
- a(a),
- b(b)
+ Number b)
+ : val(val)
+ , v_val(v_val)
+ , w_val(w_val)
+ , x(x)
+ , a(a)
+ , b(b)
{}
void
template <typename Number>
struct Vectorization_scale
{
- Vectorization_scale(Number *val, Number *v_val) : val(val), v_val(v_val)
+ Vectorization_scale(Number *val, Number *v_val)
+ : val(val)
+ , v_val(v_val)
{}
void
template <typename Number>
struct Vectorization_equ_au
{
- Vectorization_equ_au(Number *val, Number *u_val, Number a) :
- val(val),
- u_val(u_val),
- a(a)
+ Vectorization_equ_au(Number *val, Number *u_val, Number a)
+ : val(val)
+ , u_val(u_val)
+ , a(a)
{}
void
Number *u_val,
Number *v_val,
Number a,
- Number b) :
- val(val),
- u_val(u_val),
- v_val(v_val),
- a(a),
- b(b)
+ Number b)
+ : val(val)
+ , u_val(u_val)
+ , v_val(v_val)
+ , a(a)
+ , b(b)
{}
void
Number *w_val,
Number a,
Number b,
- Number c) :
- val(val),
- u_val(u_val),
- v_val(v_val),
- w_val(w_val),
- a(a),
- b(b),
- c(c)
+ Number c)
+ : val(val)
+ , u_val(u_val)
+ , v_val(v_val)
+ , w_val(w_val)
+ , a(a)
+ , b(b)
+ , c(c)
{}
void
template <typename Number>
struct Vectorization_ratio
{
- Vectorization_ratio(Number *val, Number *a_val, Number *b_val) :
- val(val),
- a_val(a_val),
- b_val(b_val)
+ Vectorization_ratio(Number *val, Number *a_val, Number *b_val)
+ : val(val)
+ , a_val(a_val)
+ , b_val(b_val)
{}
void
std::is_same<Number, Number2>::value &&
(VectorizedArray<Number>::n_array_elements > 1);
- Dot(const Number *X, const Number2 *Y) : X(X), Y(Y)
+ Dot(const Number *X, const Number2 *Y)
+ : X(X)
+ , Y(Y)
{}
Number
static const bool vectorizes =
VectorizedArray<Number>::n_array_elements > 1;
- Norm2(const Number *X) : X(X)
+ Norm2(const Number *X)
+ : X(X)
{}
RealType
static const bool vectorizes =
VectorizedArray<Number>::n_array_elements > 1;
- Norm1(const Number *X) : X(X)
+ Norm1(const Number *X)
+ : X(X)
{}
RealType
static const bool vectorizes =
VectorizedArray<Number>::n_array_elements > 1;
- NormP(const Number *X, RealType p) : X(X), p(p)
+ NormP(const Number *X, RealType p)
+ : X(X)
+ , p(p)
{}
RealType
static const bool vectorizes =
VectorizedArray<Number>::n_array_elements > 1;
- MeanValue(const Number *X) : X(X)
+ MeanValue(const Number *X)
+ : X(X)
{}
Number
static const bool vectorizes =
VectorizedArray<Number>::n_array_elements > 1;
- AddAndDot(Number *X, const Number *V, const Number *W, Number a) :
- X(X),
- V(V),
- W(W),
- a(a)
+ AddAndDot(Number *X, const Number *V, const Number *W, Number a)
+ : X(X)
+ , V(V)
+ , W(W)
+ , a(a)
{}
Number
ResultType r0, r1, r2, r3;
accumulate_recursive(op, first, first + new_size, r0);
accumulate_recursive(op, first + new_size, first + 2 * new_size, r1);
- accumulate_recursive(
- op, first + 2 * new_size, first + 3 * new_size, r2);
+ accumulate_recursive(op,
+ first + 2 * new_size,
+ first + 3 * new_size,
+ r2);
accumulate_recursive(op, first + 3 * new_size, last, r3);
r0 += r1;
r2 += r3;
TBBReduceFunctor(const Operation &op,
const size_type start,
- const size_type end) :
- op(op),
- start(start),
- end(end)
+ const size_type end)
+ : op(op)
+ , start(start)
+ , end(end)
{
const size_type vec_size = end - start;
// set chunk size for sub-tasks
4 * internal::VectorImplementation::minimum_parallel_grain_size &&
MultithreadInfo::n_threads() > 1)
{
- Assert(
- partitioner.get() != nullptr,
- ExcInternalError("Unexpected initialization of Vector that does "
- "not set the TBB partitioner to a usable state."));
+ Assert(partitioner.get() != nullptr,
+ ExcInternalError(
+ "Unexpected initialization of Vector that does "
+ "not set the TBB partitioner to a usable state."));
std::shared_ptr<tbb::affinity_partitioner> tbb_partitioner =
partitioner->acquire_one_partitioner();
- TBBReduceFunctor<Operation, ResultType> generic_functor(
- op, start, end);
+ TBBReduceFunctor<Operation, ResultType> generic_functor(op,
+ start,
+ end);
tbb::parallel_for(
tbb::blocked_range<size_type>(0, generic_functor.n_chunks, 1),
generic_functor,
FEEvaluation<dim, fe_degree, n_q_points_1d, n_components_, Number>::
FEEvaluation(int cell_id,
const data_type * data,
- SharedData<dim, Number> *shdata) :
- n_cells(data->n_cells),
- padding_length(data->padding_length),
- constraint_mask(data->constraint_mask[cell_id]),
- values(shdata->values)
+ SharedData<dim, Number> *shdata)
+ : n_cells(data->n_cells)
+ , padding_length(data->padding_length)
+ , constraint_mask(data->constraint_mask[cell_id])
+ , values(shdata->values)
{
local_to_global = data->local_to_global + padding_length * cell_id;
inv_jac = data->inv_jacobian + padding_length * cell_id;
AdditionalData(
const ParallelizationScheme parallelization_scheme = parallel_in_elem,
const UpdateFlags mapping_update_flags = update_gradients |
- update_JxW_values) :
- parallelization_scheme(parallelization_scheme),
- mapping_update_flags(mapping_update_flags)
+ update_JxW_values)
+ : parallelization_scheme(parallelization_scheme)
+ , mapping_update_flags(mapping_update_flags)
{}
/**
struct SharedData
{
__device__
- SharedData(Number *vd, Number *gq[dim]) :
- values(vd)
+ SharedData(Number *vd, Number *gq[dim])
+ : values(vd)
{
for (int d = 0; d < dim; ++d)
gradients[d] = gq[d];
const Quadrature<1> & quad,
const ::dealii::internal::MatrixFreeFunctions::ShapeInfo<Number>
& shape_info,
- const UpdateFlags &update_flags) :
- data(data),
- fe_degree(data->fe_degree),
- dofs_per_cell(data->dofs_per_cell),
- q_points_per_cell(data->q_points_per_cell),
- fe_values(mapping,
- fe,
- Quadrature<dim>(quad),
- update_inverse_jacobians | update_quadrature_points |
- update_values | update_gradients | update_JxW_values),
- lexicographic_inv(shape_info.lexicographic_numbering),
- update_flags(update_flags),
- padding_length(data->get_padding_length())
+ const UpdateFlags &update_flags)
+ : data(data)
+ , fe_degree(data->fe_degree)
+ , dofs_per_cell(data->dofs_per_cell)
+ , q_points_per_cell(data->q_points_per_cell)
+ , fe_values(mapping,
+ fe,
+ Quadrature<dim>(quad),
+ update_inverse_jacobians | update_quadrature_points |
+ update_values | update_gradients | update_JxW_values)
+ , lexicographic_inv(shape_info.lexicographic_numbering)
+ , update_flags(update_flags)
+ , padding_length(data->get_padding_length())
{
local_dof_indices.resize(data->dofs_per_cell);
lexicographic_dof_indices.resize(dofs_per_cell);
// Local-to-global mapping
if (data->parallelization_scheme ==
MatrixFree<dim, Number>::parallel_over_elem)
- internal::transpose_in_place(
- local_to_global_host, n_cells, padding_length);
+ internal::transpose_in_place(local_to_global_host,
+ n_cells,
+ padding_length);
alloc_and_copy(&data->local_to_global[color],
local_to_global_host,
{
if (data->parallelization_scheme ==
MatrixFree<dim, Number>::parallel_over_elem)
- internal::transpose_in_place(
- q_points_host, n_cells, padding_length);
+ internal::transpose_in_place(q_points_host,
+ n_cells,
+ padding_length);
- alloc_and_copy(
- &data->q_points[color], q_points_host, n_cells * padding_length);
+ alloc_and_copy(&data->q_points[color],
+ q_points_host,
+ n_cells * padding_length);
}
// Jacobian determinants/quadrature weights
// are together, etc., i.e., reorder indices from
// cell_id*q_points_per_cell*dim*dim + q*dim*dim +i to
// i*q_points_per_cell*n_cells + cell_id*q_points_per_cell+q
- internal::transpose_in_place(
- inv_jacobian_host, padding_length * n_cells, dim * dim);
+ internal::transpose_in_place(inv_jacobian_host,
+ padding_length * n_cells,
+ dim * dim);
// Transpose second time means we get the following index order:
// q*n_cells*dim*dim + i*n_cells + cell_id which is good for an
// element-level parallelization
if (data->parallelization_scheme ==
MatrixFree<dim, Number>::parallel_over_elem)
- internal::transpose_in_place(
- inv_jacobian_host, n_cells * dim * dim, padding_length);
+ internal::transpose_in_place(inv_jacobian_host,
+ n_cells * dim * dim,
+ padding_length);
alloc_and_copy(&data->inv_jacobian[color],
inv_jacobian_host,
n_cells * dim * dim * padding_length);
}
- alloc_and_copy(
- &data->constraint_mask[color], constraint_mask_host, n_cells);
+ alloc_and_copy(&data->constraint_mask[color],
+ constraint_mask_host,
+ n_cells);
}
template <int dim, typename Number>
- MatrixFree<dim, Number>::MatrixFree() :
- constrained_dofs(nullptr),
- padding_length(0)
+ MatrixFree<dim, Number>::MatrixFree()
+ : constrained_dofs(nullptr)
+ , padding_length(0)
{}
CUDAVector<Number> &dst) const
{
internal::set_constrained_dofs<Number>
- <<<constraint_grid_dim, constraint_block_dim>>>(
- constrained_dofs, n_constrained_dofs, val, dst.get_values());
+ <<<constraint_grid_dim, constraint_block_dim>>>(constrained_dofs,
+ n_constrained_dofs,
+ val,
+ dst.get_values());
}
{
for (unsigned int i = 0; i < n_colors; ++i)
internal::apply_kernel_shmem<dim, Number, functor>
- <<<grid_dim[i], block_dim[i]>>>(
- func, get_data(i), src.get_values(), dst.get_values());
+ <<<grid_dim[i], block_dim[i]>>>(func,
+ get_data(i),
+ src.get_values(),
+ dst.get_values());
}
n_q_points_1d,
Number>::values(const Number *in, Number *out) const
{
- apply<direction, dof_to_quad, add, in_place>(
- global_shape_values, in, out);
+ apply<direction, dof_to_quad, add, in_place>(global_shape_values,
+ in,
+ out);
}
Number>::gradients(const Number *in,
Number * out) const
{
- apply<direction, dof_to_quad, add, in_place>(
- global_shape_gradients, in, out);
+ apply<direction, dof_to_quad, add, in_place>(global_shape_gradients,
+ in,
+ out);
}
template <typename Number>
- ConstraintValues<Number>::ConstraintValues() :
- constraints(FPArrayComparator<double>(1.))
+ ConstraintValues<Number>::ConstraintValues()
+ : constraints(FPArrayComparator<double>(1.))
{}
template <typename Number>
new_constraint_indicator.reserve(constraint_indicator.size());
if (store_plain_indices == true)
{
- new_rowstart_plain.resize(
- vectorization_length * task_info.cell_partition_data.back() + 1,
- numbers::invalid_unsigned_int);
+ new_rowstart_plain.resize(vectorization_length *
+ task_info.cell_partition_data.back() +
+ 1,
+ numbers::invalid_unsigned_int);
new_plain_indices.reserve(plain_dof_indices.size());
}
if (sp->column() != block)
row_entries.insert(renumbering[sp->column()], insert_pos);
}
- connectivity.add_entries(
- renumbering[block], row_entries.begin(), row_entries.end());
+ connectivity.add_entries(renumbering[block],
+ row_entries.begin(),
+ row_entries.end());
}
}
} // namespace
// Create a temporary sparsity pattern that holds to each degree of
// freedom on which cells it appears, i.e., store the connectivity
// between cells and dofs
- SparsityPattern connectivity_dof(
- n_rows, task_info.n_active_cells, row_lengths);
+ SparsityPattern connectivity_dof(n_rows,
+ task_info.n_active_cells,
+ row_lengths);
parallel::apply_to_subranges(0,
task_info.n_active_cells,
std::bind(&fill_connectivity_dofs,
const TaskInfo &task_info) const
{
out << " Memory row starts indices: ";
- task_info.print_memory_statistics(
- out, (row_starts.capacity() * sizeof(*row_starts.begin())));
+ task_info.print_memory_statistics(out,
+ (row_starts.capacity() *
+ sizeof(*row_starts.begin())));
out << " Memory dof indices: ";
task_info.print_memory_statistics(
out, MemoryConsumption::memory_consumption(dof_indices));
// grad xy
if (evaluate_gradients == false)
eval.template gradients<0, true, false>(values_dofs, temp1);
- eval.template gradients<1, true, false>(
- temp1, hessians_quad + 2 * n_q_points);
+ eval.template gradients<1, true, false>(temp1,
+ hessians_quad +
+ 2 * n_q_points);
// grad xx
eval.template hessians<0, true, false>(values_dofs, temp1);
// grad y
eval.template values<0, true, false>(values_dofs, temp1);
if (evaluate_gradients == true)
- eval.template gradients<1, true, false>(
- temp1, gradients_quad + n_q_points);
+ eval.template gradients<1, true, false>(temp1,
+ gradients_quad +
+ n_q_points);
// grad yy
if (evaluate_hessians == true)
- eval.template hessians<1, true, false>(
- temp1, hessians_quad + n_q_points);
+ eval.template hessians<1, true, false>(temp1,
+ hessians_quad +
+ n_q_points);
// val: can use values applied in x
if (evaluate_values == true)
temp1);
eval.template values<1, true, false>(temp1, temp2);
}
- eval.template gradients<2, true, false>(
- temp2, hessians_quad + 4 * n_q_points);
+ eval.template gradients<2, true, false>(temp2,
+ hessians_quad +
+ 4 * n_q_points);
// grad xy
eval.template gradients<1, true, false>(temp1, temp2);
- eval.template values<2, true, false>(
- temp2, hessians_quad + 3 * n_q_points);
+ eval.template values<2, true, false>(temp2,
+ hessians_quad +
+ 3 * n_q_points);
// grad xx
eval.template hessians<0, true, false>(values_dofs, temp1);
if (evaluate_gradients == true)
{
eval.template gradients<1, true, false>(temp1, temp2);
- eval.template values<2, true, false>(
- temp2, gradients_quad + n_q_points);
+ eval.template values<2, true, false>(temp2,
+ gradients_quad +
+ n_q_points);
}
if (evaluate_hessians == true)
// grad yz
if (evaluate_gradients == false)
eval.template gradients<1, true, false>(temp1, temp2);
- eval.template gradients<2, true, false>(
- temp2, hessians_quad + 5 * n_q_points);
+ eval.template gradients<2, true, false>(temp2,
+ hessians_quad +
+ 5 * n_q_points);
// grad yy
eval.template hessians<1, true, false>(temp1, temp2);
- eval.template values<2, true, false>(
- temp2, hessians_quad + n_q_points);
+ eval.template values<2, true, false>(temp2,
+ hessians_quad +
+ n_q_points);
}
// grad z: can use the values applied in x direction stored in
// temp1
eval.template values<1, true, false>(temp1, temp2);
if (evaluate_gradients == true)
- eval.template gradients<2, true, false>(
- temp2, gradients_quad + 2 * n_q_points);
+ eval.template gradients<2, true, false>(temp2,
+ gradients_quad +
+ 2 * n_q_points);
// grad zz: can use the values applied in x and y direction stored
// in temp2
if (evaluate_hessians == true)
- eval.template hessians<2, true, false>(
- temp2, hessians_quad + 2 * n_q_points);
+ eval.template hessians<2, true, false>(temp2,
+ hessians_quad +
+ 2 * n_q_points);
// val: can use the values applied in x & y direction stored in
// temp2
}
if (integrate_gradients == true)
{
- eval.template gradients<1, false, false>(
- gradients_quad + n_q_points, temp1);
+ eval.template gradients<1, false, false>(gradients_quad +
+ n_q_points,
+ temp1);
if (integrate_values)
eval.template values<1, false, true>(values_quad, temp1);
if (add_into_values_array == false)
}
if (integrate_gradients == true)
{
- eval.template gradients<2, false, false>(
- gradients_quad + 2 * n_q_points, temp1);
+ eval.template gradients<2, false, false>(gradients_quad +
+ 2 * n_q_points,
+ temp1);
if (integrate_values)
eval.template values<2, false, true>(values_quad, temp1);
eval.template values<1, false, false>(temp1, temp2);
- eval.template values<2, false, false>(
- gradients_quad + n_q_points, temp1);
+ eval.template values<2, false, false>(gradients_quad +
+ n_q_points,
+ temp1);
eval.template gradients<1, false, true>(temp1, temp2);
if (add_into_values_array == false)
eval.template values<0, false, false>(temp2, values_dofs);
values_out -= Utilities::fixed_power<dim>(np_2);
if (next_dim < dim)
for (unsigned int q = np_1; q != 0; --q)
- FEEvaluationImplBasisChange<variant,
- next_dim,
- basis_size_1,
- basis_size_2,
- 1,
- Number,
- Number2>::
- do_forward(
- transformation_matrix,
- values_in + (q - 1) * Utilities::fixed_power<next_dim>(np_1),
- values_out + (q - 1) * Utilities::fixed_power<next_dim>(np_2),
- basis_size_1_variable,
- basis_size_2_variable);
+ FEEvaluationImplBasisChange<
+ variant,
+ next_dim,
+ basis_size_1,
+ basis_size_2,
+ 1,
+ Number,
+ Number2>::do_forward(transformation_matrix,
+ values_in +
+ (q - 1) *
+ Utilities::fixed_power<next_dim>(np_1),
+ values_out +
+ (q - 1) *
+ Utilities::fixed_power<next_dim>(np_2),
+ basis_size_1_variable,
+ basis_size_2_variable);
// the recursion stops if dim==1 or if dim==2 and
// basis_size_1==basis_size_2 (the latter is used because the
Assert(
basis_size_1 != 0 || basis_size_1_variable <= basis_size_2_variable,
ExcMessage("The second dimension must not be smaller than the first"));
- Assert(
- add_into_result == false || values_in != values_out,
- ExcMessage("Input and output cannot alias with each other when "
- "adding the result of the basis change to existing data"));
+ Assert(add_into_result == false || values_in != values_out,
+ ExcMessage(
+ "Input and output cannot alias with each other when "
+ "adding the result of the basis change to existing data"));
constexpr int next_dim =
(dim > 2 ||
1,
Number,
Number2>::
- do_backward(
- transformation_matrix,
- add_into_result,
- values_in + q * Utilities::fixed_power<next_dim>(np_2),
- values_out + q * Utilities::fixed_power<next_dim>(np_1),
- basis_size_1_variable,
- basis_size_2_variable);
+ do_backward(transformation_matrix,
+ add_into_result,
+ values_in +
+ q * Utilities::fixed_power<next_dim>(np_2),
+ values_out +
+ q * Utilities::fixed_power<next_dim>(np_1),
+ basis_size_1_variable,
+ basis_size_2_variable);
values_in += Utilities::fixed_power<dim>(np_2);
values_out += Utilities::fixed_power<dim>(np_1);
n_components,
Number,
Number2>::do_forward(transformation_matrix,
- values_in + (q - 1) * Utilities::pow(
- basis_size_1, dim - 1),
- my_scratch + (q - 1) * Utilities::pow(
- basis_size_2, dim - 1));
+ values_in +
+ (q - 1) *
+ Utilities::pow(basis_size_1, dim - 1),
+ my_scratch +
+ (q - 1) *
+ Utilities::pow(basis_size_2, dim - 1));
EvaluatorTensorProduct<variant,
dim,
basis_size_1,
my_scratch + i, my_scratch + i);
}
for (unsigned int q = 0; q < basis_size_1; ++q)
- FEEvaluationImplBasisChange<variant,
- next_dim,
- basis_size_1,
- basis_size_2,
- n_components,
- Number,
- Number2>::do_backward(transformation_matrix,
- false,
- my_scratch +
- q * Utilities::pow(
- basis_size_2,
- dim - 1),
- values_out +
- q * Utilities::pow(
- basis_size_1,
- dim - 1));
+ FEEvaluationImplBasisChange<
+ variant,
+ next_dim,
+ basis_size_1,
+ basis_size_2,
+ n_components,
+ Number,
+ Number2>::do_backward(transformation_matrix,
+ false,
+ my_scratch +
+ q * Utilities::pow(basis_size_2, dim - 1),
+ values_out +
+ q * Utilities::pow(basis_size_1, dim - 1));
}
};
eval.template gradients<0, true, false>(values_dofs,
gradients_quad);
if (dim > 1)
- eval.template gradients<1, true, false>(
- values_dofs, gradients_quad + n_q_points);
+ eval.template gradients<1, true, false>(values_dofs,
+ gradients_quad +
+ n_q_points);
if (dim > 2)
- eval.template gradients<2, true, false>(
- values_dofs, gradients_quad + 2 * n_q_points);
+ eval.template gradients<2, true, false>(values_dofs,
+ gradients_quad +
+ 2 * n_q_points);
}
if (evaluate_hessians == true)
{
eval.template hessians<0, true, false>(values_dofs, hessians_quad);
if (dim > 1)
{
- eval.template gradients<1, true, false>(
- gradients_quad, hessians_quad + dim * n_q_points);
- eval.template hessians<1, true, false>(
- values_dofs, hessians_quad + n_q_points);
+ eval.template gradients<1, true, false>(gradients_quad,
+ hessians_quad +
+ dim * n_q_points);
+ eval.template hessians<1, true, false>(values_dofs,
+ hessians_quad +
+ n_q_points);
}
if (dim > 2)
{
- eval.template gradients<2, true, false>(
- gradients_quad, hessians_quad + 4 * n_q_points);
+ eval.template gradients<2, true, false>(gradients_quad,
+ hessians_quad +
+ 4 * n_q_points);
eval.template gradients<2, true, false>(
gradients_quad + n_q_points, hessians_quad + 5 * n_q_points);
- eval.template hessians<2, true, false>(
- values_dofs, hessians_quad + 2 * n_q_points);
+ eval.template hessians<2, true, false>(values_dofs,
+ hessians_quad +
+ 2 * n_q_points);
}
hessians_quad += (dim * (dim + 1)) / 2 * n_q_points;
}
eval.template gradients<0, false, false>(gradients_quad,
values_dofs);
if (dim > 1)
- eval.template gradients<1, false, true>(
- gradients_quad + n_q_points, values_dofs);
+ eval.template gradients<1, false, true>(gradients_quad +
+ n_q_points,
+ values_dofs);
if (dim > 2)
- eval.template gradients<2, false, true>(
- gradients_quad + 2 * n_q_points, values_dofs);
+ eval.template gradients<2, false, true>(gradients_quad +
+ 2 * n_q_points,
+ values_dofs);
}
gradients_quad += dim * n_q_points;
values_quad += n_q_points;
eval1.template values<0, true, false>(values_dofs,
scratch_data);
- eval2.template gradients<1, true, false>(
- scratch_data, gradients_quad + n_q_points);
+ eval2.template gradients<1, true, false>(scratch_data,
+ gradients_quad +
+ n_q_points);
if (evaluate_val == true)
eval2.template values<1, true, false>(scratch_data,
break;
case 2:
- eval1.template values<0, true, false>(
- values_dofs + size_deg,
- gradients_quad + (dim - 1) * n_q_points);
+ eval1.template values<0, true, false>(values_dofs + size_deg,
+ gradients_quad +
+ (dim - 1) *
+ n_q_points);
eval1.template gradients<0, true, false>(values_dofs,
gradients_quad);
if (evaluate_val == true)
switch (dim)
{
case 3:
- eval2.template values<1, false, false>(
- gradients_quad + 2 * n_q_points,
- gradients_quad + 2 * n_q_points);
+ eval2.template values<1, false, false>(gradients_quad +
+ 2 * n_q_points,
+ gradients_quad +
+ 2 * n_q_points);
eval1.template values<0, false, false>(
gradients_quad + 2 * n_q_points, values_dofs + size_deg);
if (symmetric_evaluate && n_q_points_1d > fe_degree)
*/
struct FaceIdentifier
{
- FaceIdentifier() :
- n_hanging_faces_smaller_subdomain(0),
- n_hanging_faces_larger_subdomain(0)
+ FaceIdentifier()
+ : n_hanging_faces_smaller_subdomain(0)
+ , n_hanging_faces_larger_subdomain(0)
{}
std::vector<std::pair<CellId, CellId>> shared_faces;
#ifndef DOXYGEN
template <int dim>
- FaceSetup<dim>::FaceSetup() : use_active_cells(true)
+ FaceSetup<dim>::FaceSetup()
+ : use_active_cells(true)
{}
if (left_face_orientation != 0)
{
info.face_orientation = 8 + left_face_orientation;
- Assert(
- right_face_orientation == 0,
- ExcMessage("Face seems to be wrongly oriented from both sides"));
+ Assert(right_face_orientation == 0,
+ ExcMessage(
+ "Face seems to be wrongly oriented from both sides"));
}
else
info.face_orientation = right_face_orientation;
is_contiguous = false;
if (is_contiguous)
{
- AssertIndexRange(
- f, faces_type[type].size() - vectorization_width + 1);
+ AssertIndexRange(f,
+ faces_type[type].size() -
+ vectorization_width + 1);
for (unsigned int v = 0; v < vectorization_width; ++v)
{
macro_face.cells_interior[v] =
const unsigned int quad_no_in,
const unsigned int fe_degree,
const unsigned int n_q_points,
- const bool is_interior_face) :
- scratch_data_array(data_in.acquire_scratch_data()),
- quad_no(quad_no_in),
- n_fe_components(data_in.get_dof_info(dof_no).start_components.back()),
- active_fe_index(fe_degree != numbers::invalid_unsigned_int ?
- data_in.get_dof_info(dof_no).fe_index_from_degree(
- first_selected_component,
- fe_degree) :
- 0),
- active_quad_index(fe_degree != numbers::invalid_unsigned_int ?
- (is_face ? data_in.get_mapping_info()
- .face_data[quad_no_in]
- .quad_index_from_n_q_points(n_q_points) :
- data_in.get_mapping_info()
- .cell_data[quad_no_in]
- .quad_index_from_n_q_points(n_q_points)) :
- 0),
- n_quadrature_points(fe_degree != numbers::invalid_unsigned_int ?
- n_q_points :
- (is_face ? data_in
- .get_shape_info(dof_no,
- quad_no_in,
- active_fe_index,
- active_quad_index)
- .n_q_points_face :
- data_in
- .get_shape_info(dof_no,
- quad_no_in,
- active_fe_index,
- active_quad_index)
- .n_q_points)),
- matrix_info(&data_in),
- dof_info(&data_in.get_dof_info(dof_no)),
- mapping_data(internal::MatrixFreeFunctions::
- MappingInfoCellsOrFaces<dim, Number, is_face>::get(
- data_in.get_mapping_info(),
- quad_no)),
- data(&data_in.get_shape_info(
- dof_no,
- quad_no_in,
- dof_info->component_to_base_index[first_selected_component],
- active_fe_index,
- active_quad_index)),
- jacobian(nullptr),
- J_value(nullptr),
- normal_vectors(nullptr),
- normal_x_jacobian(nullptr),
- quadrature_weights(
- mapping_data->descriptor[active_quad_index].quadrature_weights.begin()),
- cell(numbers::invalid_unsigned_int),
- is_interior_face(is_interior_face),
- dof_access_index(
- is_face ?
- (is_interior_face ?
- internal::MatrixFreeFunctions::DoFInfo::dof_access_face_interior :
- internal::MatrixFreeFunctions::DoFInfo::dof_access_face_exterior) :
- internal::MatrixFreeFunctions::DoFInfo::dof_access_cell),
- cell_type(internal::MatrixFreeFunctions::general),
- dof_values_initialized(false),
- values_quad_initialized(false),
- gradients_quad_initialized(false),
- hessians_quad_initialized(false),
- values_quad_submitted(false),
- gradients_quad_submitted(false),
- first_selected_component(first_selected_component)
+ const bool is_interior_face)
+ : scratch_data_array(data_in.acquire_scratch_data())
+ , quad_no(quad_no_in)
+ , n_fe_components(data_in.get_dof_info(dof_no).start_components.back())
+ , active_fe_index(fe_degree != numbers::invalid_unsigned_int ?
+ data_in.get_dof_info(dof_no).fe_index_from_degree(
+ first_selected_component,
+ fe_degree) :
+ 0)
+ , active_quad_index(fe_degree != numbers::invalid_unsigned_int ?
+ (is_face ? data_in.get_mapping_info()
+ .face_data[quad_no_in]
+ .quad_index_from_n_q_points(n_q_points) :
+ data_in.get_mapping_info()
+ .cell_data[quad_no_in]
+ .quad_index_from_n_q_points(n_q_points)) :
+ 0)
+ , n_quadrature_points(fe_degree != numbers::invalid_unsigned_int ?
+ n_q_points :
+ (is_face ? data_in
+ .get_shape_info(dof_no,
+ quad_no_in,
+ active_fe_index,
+ active_quad_index)
+ .n_q_points_face :
+ data_in
+ .get_shape_info(dof_no,
+ quad_no_in,
+ active_fe_index,
+ active_quad_index)
+ .n_q_points))
+ , matrix_info(&data_in)
+ , dof_info(&data_in.get_dof_info(dof_no))
+ , mapping_data(internal::MatrixFreeFunctions::
+ MappingInfoCellsOrFaces<dim, Number, is_face>::get(
+ data_in.get_mapping_info(),
+ quad_no))
+ , data(&data_in.get_shape_info(
+ dof_no,
+ quad_no_in,
+ dof_info->component_to_base_index[first_selected_component],
+ active_fe_index,
+ active_quad_index))
+ , jacobian(nullptr)
+ , J_value(nullptr)
+ , normal_vectors(nullptr)
+ , normal_x_jacobian(nullptr)
+ , quadrature_weights(
+ mapping_data->descriptor[active_quad_index].quadrature_weights.begin())
+ , cell(numbers::invalid_unsigned_int)
+ , is_interior_face(is_interior_face)
+ , dof_access_index(
+ is_face ?
+ (is_interior_face ?
+ internal::MatrixFreeFunctions::DoFInfo::dof_access_face_interior :
+ internal::MatrixFreeFunctions::DoFInfo::dof_access_face_exterior) :
+ internal::MatrixFreeFunctions::DoFInfo::dof_access_cell)
+ , cell_type(internal::MatrixFreeFunctions::general)
+ , dof_values_initialized(false)
+ , values_quad_initialized(false)
+ , gradients_quad_initialized(false)
+ , hessians_quad_initialized(false)
+ , values_quad_submitted(false)
+ , gradients_quad_submitted(false)
+ , first_selected_component(first_selected_component)
{
set_data_pointers();
Assert(matrix_info->mapping_initialized() == true, ExcNotInitialized());
const Quadrature<1> & quadrature,
const UpdateFlags update_flags,
const unsigned int first_selected_component,
- const FEEvaluationBase<dim, n_components_other, Number> *other) :
- scratch_data_array(new AlignedVector<VectorizedArray<Number>>()),
- quad_no(numbers::invalid_unsigned_int),
- n_fe_components(n_components_),
- active_fe_index(numbers::invalid_unsigned_int),
- active_quad_index(numbers::invalid_unsigned_int),
- n_quadrature_points(
- Utilities::fixed_power < is_face ? dim - 1 : dim > (quadrature.size())),
- matrix_info(nullptr),
- dof_info(nullptr),
- mapping_data(nullptr),
+ const FEEvaluationBase<dim, n_components_other, Number> *other)
+ : scratch_data_array(new AlignedVector<VectorizedArray<Number>>())
+ , quad_no(numbers::invalid_unsigned_int)
+ , n_fe_components(n_components_)
+ , active_fe_index(numbers::invalid_unsigned_int)
+ , active_quad_index(numbers::invalid_unsigned_int)
+ , n_quadrature_points(
+ Utilities::fixed_power < is_face ? dim - 1 : dim > (quadrature.size()))
+ , matrix_info(nullptr)
+ , dof_info(nullptr)
+ , mapping_data(nullptr)
+ ,
// select the correct base element from the given FE component
data(new internal::MatrixFreeFunctions::ShapeInfo<VectorizedArray<Number>>(
quadrature,
fe,
- fe.component_to_base_index(first_selected_component).first)),
- jacobian(nullptr),
- J_value(nullptr),
- normal_vectors(nullptr),
- normal_x_jacobian(nullptr),
- quadrature_weights(nullptr),
- cell(0),
- cell_type(internal::MatrixFreeFunctions::general),
- is_interior_face(true),
- dof_access_index(internal::MatrixFreeFunctions::DoFInfo::dof_access_cell),
- dof_values_initialized(false),
- values_quad_initialized(false),
- gradients_quad_initialized(false),
- hessians_quad_initialized(false),
- values_quad_submitted(false),
- gradients_quad_submitted(false),
+ fe.component_to_base_index(first_selected_component).first))
+ , jacobian(nullptr)
+ , J_value(nullptr)
+ , normal_vectors(nullptr)
+ , normal_x_jacobian(nullptr)
+ , quadrature_weights(nullptr)
+ , cell(0)
+ , cell_type(internal::MatrixFreeFunctions::general)
+ , is_interior_face(true)
+ , dof_access_index(internal::MatrixFreeFunctions::DoFInfo::dof_access_cell)
+ , dof_values_initialized(false)
+ , values_quad_initialized(false)
+ , gradients_quad_initialized(false)
+ , hessians_quad_initialized(false)
+ , values_quad_submitted(false)
+ , gradients_quad_submitted(false)
+ ,
// keep the number of the selected component within the current base element
// for reading dof values
first_selected_component(first_selected_component)
template <int dim, int n_components_, typename Number, bool is_face>
inline FEEvaluationBase<dim, n_components_, Number, is_face>::FEEvaluationBase(
- const FEEvaluationBase<dim, n_components_, Number, is_face> &other) :
- scratch_data_array(other.matrix_info == nullptr ?
- new AlignedVector<VectorizedArray<Number>>() :
- other.matrix_info->acquire_scratch_data()),
- quad_no(other.quad_no),
- n_fe_components(other.n_fe_components),
- active_fe_index(other.active_fe_index),
- active_quad_index(other.active_quad_index),
- n_quadrature_points(other.n_quadrature_points),
- matrix_info(other.matrix_info),
- dof_info(other.dof_info),
- mapping_data(other.mapping_data),
- data(other.matrix_info == nullptr ?
- new internal::MatrixFreeFunctions::ShapeInfo<VectorizedArray<Number>>(
- *other.data) :
- other.data),
- jacobian(nullptr),
- J_value(nullptr),
- normal_vectors(nullptr),
- normal_x_jacobian(nullptr),
- quadrature_weights(
- other.matrix_info == nullptr ?
- nullptr :
- mapping_data->descriptor[active_quad_index].quadrature_weights.begin()),
- cell(numbers::invalid_unsigned_int),
- cell_type(internal::MatrixFreeFunctions::general),
- is_interior_face(other.is_interior_face),
- dof_access_index(other.dof_access_index),
- dof_values_initialized(false),
- values_quad_initialized(false),
- gradients_quad_initialized(false),
- hessians_quad_initialized(false),
- values_quad_submitted(false),
- gradients_quad_submitted(false),
- first_selected_component(other.first_selected_component)
+ const FEEvaluationBase<dim, n_components_, Number, is_face> &other)
+ : scratch_data_array(other.matrix_info == nullptr ?
+ new AlignedVector<VectorizedArray<Number>>() :
+ other.matrix_info->acquire_scratch_data())
+ , quad_no(other.quad_no)
+ , n_fe_components(other.n_fe_components)
+ , active_fe_index(other.active_fe_index)
+ , active_quad_index(other.active_quad_index)
+ , n_quadrature_points(other.n_quadrature_points)
+ , matrix_info(other.matrix_info)
+ , dof_info(other.dof_info)
+ , mapping_data(other.mapping_data)
+ , data(
+ other.matrix_info == nullptr ?
+ new internal::MatrixFreeFunctions::ShapeInfo<VectorizedArray<Number>>(
+ *other.data) :
+ other.data)
+ , jacobian(nullptr)
+ , J_value(nullptr)
+ , normal_vectors(nullptr)
+ , normal_x_jacobian(nullptr)
+ , quadrature_weights(
+ other.matrix_info == nullptr ?
+ nullptr :
+ mapping_data->descriptor[active_quad_index].quadrature_weights.begin())
+ , cell(numbers::invalid_unsigned_int)
+ , cell_type(internal::MatrixFreeFunctions::general)
+ , is_interior_face(other.is_interior_face)
+ , dof_access_index(other.dof_access_index)
+ , dof_values_initialized(false)
+ , values_quad_initialized(false)
+ , gradients_quad_initialized(false)
+ , hessians_quad_initialized(false)
+ , values_quad_submitted(false)
+ , gradients_quad_submitted(false)
+ , first_selected_component(other.first_selected_component)
{
set_data_pointers();
{
(void)vec;
(void)dof_info;
- Assert(
- vec.partitioners_are_compatible(*dof_info.vector_partitioner),
- ExcMessage("The parallel layout of the given vector is not "
- "compatible with the parallel partitioning in MatrixFree. "
- "Use MatrixFree::initialize_dof_vector to get a "
- "compatible vector."));
+ Assert(vec.partitioners_are_compatible(*dof_info.vector_partitioner),
+ ExcMessage(
+ "The parallel layout of the given vector is not "
+ "compatible with the parallel partitioning in MatrixFree. "
+ "Use MatrixFree::initialize_dof_vector to get a "
+ "compatible vector."));
}
// A class to use the same code to read from and write to vector
VectorizedArray<Number> *dof_values,
std::integral_constant<bool, true>) const
{
- dealii::vectorized_load_and_transpose(
- dofs_per_cell, vec.begin(), dof_indices, dof_values);
+ dealii::vectorized_load_and_transpose(dofs_per_cell,
+ vec.begin(),
+ dof_indices,
+ dof_values);
}
for (unsigned int v = 0; v < n_vectorization_actual; ++v)
for (unsigned int i = 0; i < dofs_per_component; ++i)
for (unsigned int comp = 0; comp < n_components; ++comp)
- operation.process_dof(
- dof_indices[v][i], *src[comp], values_dofs[comp][i][v]);
+ operation.process_dof(dof_indices[v][i],
+ *src[comp],
+ values_dofs[comp][i][v]);
}
else
{
if (n_components == 1 || n_fe_components == 1)
{
for (unsigned int c = 0; c < n_components; ++c)
- Assert(
- src[c] != nullptr,
- ExcMessage("The finite element underlying this FEEvaluation "
- "object is scalar, but you requested " +
- std::to_string(n_components) +
- " components via the template argument in "
- "FEEvaluation. In that case, you must pass an "
- "std::vector<VectorType> or a BlockVector to " +
- "read_dof_values and distribute_local_to_global."));
+ Assert(src[c] != nullptr,
+ ExcMessage(
+ "The finite element underlying this FEEvaluation "
+ "object is scalar, but you requested " +
+ std::to_string(n_components) +
+ " components via the template argument in "
+ "FEEvaluation. In that case, you must pass an "
+ "std::vector<VectorType> or a BlockVector to " +
+ "read_dof_values and distribute_local_to_global."));
unsigned int ind_local = 0;
for (; index_indicators != next_index_indicators; ++index_indicators)
matrix_info->constraint_pool_end(indicator.second);
for (; data_val != end_pool; ++data_val, ++dof_indices[v])
for (unsigned int comp = 0; comp < n_components; ++comp)
- operation.process_constraint(
- *dof_indices[v], *data_val, *src[comp], value[comp]);
+ operation.process_constraint(*dof_indices[v],
+ *data_val,
+ *src[comp],
+ value[comp]);
for (unsigned int comp = 0; comp < n_components; ++comp)
operation.post_constraints(value[comp],
for (; ind_local < dofs_per_component; ++dof_indices[v], ++ind_local)
for (unsigned int comp = 0; comp < n_components; ++comp)
- operation.process_dof(
- *dof_indices[v], *src[comp], values_dofs[comp][ind_local][v]);
+ operation.process_dof(*dof_indices[v],
+ *src[comp],
+ values_dofs[comp][ind_local][v]);
}
else
{
matrix_info->constraint_pool_end(indicator.second);
for (; data_val != end_pool; ++data_val, ++dof_indices[v])
- operation.process_constraint(
- *dof_indices[v], *data_val, *src[0], value);
+ operation.process_constraint(*dof_indices[v],
+ *data_val,
+ *src[0],
+ value);
operation.post_constraints(value,
values_dofs[comp][ind_local][v]);
++dof_indices[v], ++ind_local)
{
AssertIndexRange(*dof_indices[v], src[0]->size());
- operation.process_dof(
- *dof_indices[v], *src[0], values_dofs[comp][ind_local][v]);
+ operation.process_dof(*dof_indices[v],
+ *src[0],
+ values_dofs[comp][ind_local][v]);
}
if (apply_constraints == true && comp + 1 < n_components)
if (n_components == 1 || n_fe_components == 1)
for (unsigned int v = 0; v < vectorization_populated; ++v)
for (unsigned int i = 0; i < data->dofs_per_component_on_cell; ++i)
- operation.process_dof(
- dof_indices[v] + i, *src[comp], values_dofs[comp][i][v]);
+ operation.process_dof(dof_indices[v] + i,
+ *src[comp],
+ values_dofs[comp][i][v]);
else
for (unsigned int v = 0; v < vectorization_populated; ++v)
for (unsigned int i = 0; i < data->dofs_per_component_on_cell; ++i)
// compute laplacian before the gradient because it needs to access
// unscaled gradient data
VectorizedArray<Number> tmp[dim][dim];
- internal::hessian_unit_times_jac(
- jac, this->hessians_quad[comp], q_point, tmp);
+ internal::hessian_unit_times_jac(jac,
+ this->hessians_quad[comp],
+ q_point,
+ tmp);
// compute first part of hessian, J * tmp = J * hess_unit(u) * J^T
for (unsigned int d = 0; d < dim; ++d)
// compute laplacian before the gradient because it needs to access
// unscaled gradient data
VectorizedArray<Number> tmp[dim][dim];
- internal::hessian_unit_times_jac(
- jac, this->hessians_quad[comp], q_point, tmp);
+ internal::hessian_unit_times_jac(jac,
+ this->hessians_quad[comp],
+ q_point,
+ tmp);
// compute first part of hessian, J * tmp = J * hess_unit(u) * J^T
for (unsigned int d = 0; d < dim; ++d)
// compute laplacian before the gradient because it needs to access
// unscaled gradient data
VectorizedArray<Number> tmp[dim][dim];
- internal::hessian_unit_times_jac(
- jac, this->hessians_quad[comp], q_point, tmp);
+ internal::hessian_unit_times_jac(jac,
+ this->hessians_quad[comp],
+ q_point,
+ tmp);
// compute only the trace part of hessian, J * tmp = J *
// hess_unit(u) * J^T
// compute laplacian before the gradient because it needs to access
// unscaled gradient data
VectorizedArray<Number> tmp[dim][dim];
- internal::hessian_unit_times_jac(
- jac, this->hessians_quad[comp], q_point, tmp);
+ internal::hessian_unit_times_jac(jac,
+ this->hessians_quad[comp],
+ q_point,
+ tmp);
// compute only the trace part of hessian, J * tmp = J *
// hess_unit(u) * J^T
const unsigned int quad_no_in,
const unsigned int fe_degree,
const unsigned int n_q_points,
- const bool is_interior_face) :
- FEEvaluationBase<dim, n_components_, Number, is_face>(
- data_in,
- dof_no,
- first_selected_component,
- quad_no_in,
- fe_degree,
- n_q_points,
- is_interior_face)
+ const bool is_interior_face)
+ : FEEvaluationBase<dim, n_components_, Number, is_face>(
+ data_in,
+ dof_no,
+ first_selected_component,
+ quad_no_in,
+ fe_degree,
+ n_q_points,
+ is_interior_face)
{}
const Quadrature<1> & quadrature,
const UpdateFlags update_flags,
const unsigned int first_selected_component,
- const FEEvaluationBase<dim, n_components_other, Number, is_face> *other) :
- FEEvaluationBase<dim, n_components_, Number, is_face>(
- mapping,
- fe,
- quadrature,
- update_flags,
- first_selected_component,
- other)
+ const FEEvaluationBase<dim, n_components_other, Number, is_face> *other)
+ : FEEvaluationBase<dim, n_components_, Number, is_face>(
+ mapping,
+ fe,
+ quadrature,
+ update_flags,
+ first_selected_component,
+ other)
{}
template <int dim, int n_components_, typename Number, bool is_face>
inline FEEvaluationAccess<dim, n_components_, Number, is_face>::
FEEvaluationAccess(
- const FEEvaluationAccess<dim, n_components_, Number, is_face> &other) :
- FEEvaluationBase<dim, n_components_, Number, is_face>(other)
+ const FEEvaluationAccess<dim, n_components_, Number, is_face> &other)
+ : FEEvaluationBase<dim, n_components_, Number, is_face>(other)
{}
const unsigned int quad_no_in,
const unsigned int fe_degree,
const unsigned int n_q_points,
- const bool is_interior_face) :
- FEEvaluationBase<dim, 1, Number, is_face>(data_in,
- dof_no,
- first_selected_component,
- quad_no_in,
- fe_degree,
- n_q_points,
- is_interior_face)
+ const bool is_interior_face)
+ : FEEvaluationBase<dim, 1, Number, is_face>(data_in,
+ dof_no,
+ first_selected_component,
+ quad_no_in,
+ fe_degree,
+ n_q_points,
+ is_interior_face)
{}
const Quadrature<1> & quadrature,
const UpdateFlags update_flags,
const unsigned int first_selected_component,
- const FEEvaluationBase<dim, n_components_other, Number, is_face> *other) :
- FEEvaluationBase<dim, 1, Number, is_face>(mapping,
- fe,
- quadrature,
- update_flags,
- first_selected_component,
- other)
+ const FEEvaluationBase<dim, n_components_other, Number, is_face> *other)
+ : FEEvaluationBase<dim, 1, Number, is_face>(mapping,
+ fe,
+ quadrature,
+ update_flags,
+ first_selected_component,
+ other)
{}
template <int dim, typename Number, bool is_face>
inline FEEvaluationAccess<dim, 1, Number, is_face>::FEEvaluationAccess(
- const FEEvaluationAccess<dim, 1, Number, is_face> &other) :
- FEEvaluationBase<dim, 1, Number, is_face>(other)
+ const FEEvaluationAccess<dim, 1, Number, is_face> &other)
+ : FEEvaluationBase<dim, 1, Number, is_face>(other)
{}
const unsigned int quad_no_in,
const unsigned int fe_degree,
const unsigned int n_q_points,
- const bool is_interior_face) :
- FEEvaluationBase<dim, dim, Number, is_face>(data_in,
- dof_no,
- first_selected_component,
- quad_no_in,
- fe_degree,
- n_q_points,
- is_interior_face)
+ const bool is_interior_face)
+ : FEEvaluationBase<dim, dim, Number, is_face>(data_in,
+ dof_no,
+ first_selected_component,
+ quad_no_in,
+ fe_degree,
+ n_q_points,
+ is_interior_face)
{}
const Quadrature<1> & quadrature,
const UpdateFlags update_flags,
const unsigned int first_selected_component,
- const FEEvaluationBase<dim, n_components_other, Number, is_face> *other) :
- FEEvaluationBase<dim, dim, Number, is_face>(mapping,
- fe,
- quadrature,
- update_flags,
- first_selected_component,
- other)
+ const FEEvaluationBase<dim, n_components_other, Number, is_face> *other)
+ : FEEvaluationBase<dim, dim, Number, is_face>(mapping,
+ fe,
+ quadrature,
+ update_flags,
+ first_selected_component,
+ other)
{}
template <int dim, typename Number, bool is_face>
inline FEEvaluationAccess<dim, dim, Number, is_face>::FEEvaluationAccess(
- const FEEvaluationAccess<dim, dim, Number, is_face> &other) :
- FEEvaluationBase<dim, dim, Number, is_face>(other)
+ const FEEvaluationAccess<dim, dim, Number, is_face> &other)
+ : FEEvaluationBase<dim, dim, Number, is_face>(other)
{}
switch (dim)
{
case 1:
- Assert(
- false,
- ExcMessage("Computing the curl in 1d is not a useful operation"));
+ Assert(false,
+ ExcMessage(
+ "Computing the curl in 1d is not a useful operation"));
break;
case 2:
curl[0] = grad[1][0] - grad[0][1];
switch (dim)
{
case 1:
- Assert(
- false,
- ExcMessage("Testing by the curl in 1d is not a useful operation"));
+ Assert(false,
+ ExcMessage(
+ "Testing by the curl in 1d is not a useful operation"));
break;
case 2:
grad[1][0] = curl[0];
const unsigned int quad_no_in,
const unsigned int fe_degree,
const unsigned int n_q_points,
- const bool is_interior_face) :
- FEEvaluationBase<1, 1, Number, is_face>(data_in,
- dof_no,
- first_selected_component,
- quad_no_in,
- fe_degree,
- n_q_points,
- is_interior_face)
+ const bool is_interior_face)
+ : FEEvaluationBase<1, 1, Number, is_face>(data_in,
+ dof_no,
+ first_selected_component,
+ quad_no_in,
+ fe_degree,
+ n_q_points,
+ is_interior_face)
{}
const Quadrature<1> & quadrature,
const UpdateFlags update_flags,
const unsigned int first_selected_component,
- const FEEvaluationBase<1, n_components_other, Number, is_face> *other) :
- FEEvaluationBase<1, 1, Number, is_face>(mapping,
- fe,
- quadrature,
- update_flags,
- first_selected_component,
- other)
+ const FEEvaluationBase<1, n_components_other, Number, is_face> *other)
+ : FEEvaluationBase<1, 1, Number, is_face>(mapping,
+ fe,
+ quadrature,
+ update_flags,
+ first_selected_component,
+ other)
{}
template <typename Number, bool is_face>
inline FEEvaluationAccess<1, 1, Number, is_face>::FEEvaluationAccess(
- const FEEvaluationAccess<1, 1, Number, is_face> &other) :
- FEEvaluationBase<1, 1, Number, is_face>(other)
+ const FEEvaluationAccess<1, 1, Number, is_face> &other)
+ : FEEvaluationBase<1, 1, Number, is_face>(other)
{}
FEEvaluation(const MatrixFree<dim, Number> &data_in,
const unsigned int fe_no,
const unsigned int quad_no,
- const unsigned int first_selected_component) :
- BaseClass(data_in,
- fe_no,
- first_selected_component,
- quad_no,
- fe_degree,
- static_n_q_points),
- dofs_per_component(this->data->dofs_per_component_on_cell),
- dofs_per_cell(this->data->dofs_per_component_on_cell * n_components_),
- n_q_points(this->data->n_q_points)
+ const unsigned int first_selected_component)
+ : BaseClass(data_in,
+ fe_no,
+ first_selected_component,
+ quad_no,
+ fe_degree,
+ static_n_q_points)
+ , dofs_per_component(this->data->dofs_per_component_on_cell)
+ , dofs_per_cell(this->data->dofs_per_component_on_cell * n_components_)
+ , n_q_points(this->data->n_q_points)
{
check_template_arguments(fe_no, 0);
}
const FiniteElement<dim> &fe,
const Quadrature<1> & quadrature,
const UpdateFlags update_flags,
- const unsigned int first_selected_component) :
- BaseClass(mapping,
- fe,
- quadrature,
- update_flags,
- first_selected_component,
- static_cast<FEEvaluationBase<dim, 1, Number, false> *>(nullptr)),
- dofs_per_component(this->data->dofs_per_component_on_cell),
- dofs_per_cell(this->data->dofs_per_component_on_cell * n_components_),
- n_q_points(this->data->n_q_points)
+ const unsigned int first_selected_component)
+ : BaseClass(mapping,
+ fe,
+ quadrature,
+ update_flags,
+ first_selected_component,
+ static_cast<FEEvaluationBase<dim, 1, Number, false> *>(nullptr))
+ , dofs_per_component(this->data->dofs_per_component_on_cell)
+ , dofs_per_cell(this->data->dofs_per_component_on_cell * n_components_)
+ , n_q_points(this->data->n_q_points)
{
check_template_arguments(numbers::invalid_unsigned_int, 0);
}
FEEvaluation(const FiniteElement<dim> &fe,
const Quadrature<1> & quadrature,
const UpdateFlags update_flags,
- const unsigned int first_selected_component) :
- BaseClass(StaticMappingQ1<dim>::mapping,
- fe,
- quadrature,
- update_flags,
- first_selected_component,
- static_cast<FEEvaluationBase<dim, 1, Number, false> *>(nullptr)),
- dofs_per_component(this->data->dofs_per_component_on_cell),
- dofs_per_cell(this->data->dofs_per_component_on_cell * n_components_),
- n_q_points(this->data->n_q_points)
+ const unsigned int first_selected_component)
+ : BaseClass(StaticMappingQ1<dim>::mapping,
+ fe,
+ quadrature,
+ update_flags,
+ first_selected_component,
+ static_cast<FEEvaluationBase<dim, 1, Number, false> *>(nullptr))
+ , dofs_per_component(this->data->dofs_per_component_on_cell)
+ , dofs_per_cell(this->data->dofs_per_component_on_cell * n_components_)
+ , n_q_points(this->data->n_q_points)
{
check_template_arguments(numbers::invalid_unsigned_int, 0);
}
inline FEEvaluation<dim, fe_degree, n_q_points_1d, n_components_, Number>::
FEEvaluation(const FiniteElement<dim> & fe,
const FEEvaluationBase<dim, n_components_other, Number> &other,
- const unsigned int first_selected_component) :
- BaseClass(other.mapped_geometry->get_fe_values().get_mapping(),
- fe,
- other.mapped_geometry->get_quadrature(),
- other.mapped_geometry->get_fe_values().get_update_flags(),
- first_selected_component,
- &other),
- dofs_per_component(this->data->dofs_per_component_on_cell),
- dofs_per_cell(this->data->dofs_per_component_on_cell * n_components_),
- n_q_points(this->data->n_q_points)
+ const unsigned int first_selected_component)
+ : BaseClass(other.mapped_geometry->get_fe_values().get_mapping(),
+ fe,
+ other.mapped_geometry->get_quadrature(),
+ other.mapped_geometry->get_fe_values().get_update_flags(),
+ first_selected_component,
+ &other)
+ , dofs_per_component(this->data->dofs_per_component_on_cell)
+ , dofs_per_cell(this->data->dofs_per_component_on_cell * n_components_)
+ , n_q_points(this->data->n_q_points)
{
check_template_arguments(numbers::invalid_unsigned_int, 0);
}
int n_components_,
typename Number>
inline FEEvaluation<dim, fe_degree, n_q_points_1d, n_components_, Number>::
- FEEvaluation(const FEEvaluation &other) :
- BaseClass(other),
- dofs_per_component(this->data->dofs_per_component_on_cell),
- dofs_per_cell(this->data->dofs_per_component_on_cell * n_components_),
- n_q_points(this->data->n_q_points)
+ FEEvaluation(const FEEvaluation &other)
+ : BaseClass(other)
+ , dofs_per_component(this->data->dofs_per_component_on_cell)
+ , dofs_per_cell(this->data->dofs_per_component_on_cell * n_components_)
+ , n_q_points(this->data->n_q_points)
{
check_template_arguments(numbers::invalid_unsigned_int, 0);
}
const bool is_interior_face,
const unsigned int dof_no,
const unsigned int quad_no,
- const unsigned int first_selected_component) :
- BaseClass(matrix_free,
- dof_no,
- first_selected_component,
- quad_no,
- fe_degree,
- static_n_q_points,
- is_interior_face),
- dofs_per_component(this->data->dofs_per_component_on_cell),
- dofs_per_cell(this->data->dofs_per_component_on_cell * n_components_),
- n_q_points(this->data->n_q_points_face)
+ const unsigned int first_selected_component)
+ : BaseClass(matrix_free,
+ dof_no,
+ first_selected_component,
+ quad_no,
+ fe_degree,
+ static_n_q_points,
+ is_interior_face)
+ , dofs_per_component(this->data->dofs_per_component_on_cell)
+ , dofs_per_cell(this->data->dofs_per_component_on_cell * n_components_)
+ , n_q_points(this->data->n_q_points_face)
{}
Assert(this->mapped_geometry == nullptr,
ExcMessage("FEEvaluation was initialized without a matrix-free object."
" Integer indexing is not possible"));
- Assert(
- this->is_interior_face == true,
- ExcMessage("Cell-based FEFaceEvaluation::reinit only possible for the "
- "interior face with second argument to constructor as true"));
+ Assert(this->is_interior_face == true,
+ ExcMessage(
+ "Cell-based FEFaceEvaluation::reinit only possible for the "
+ "interior face with second argument to constructor as true"));
if (this->mapped_geometry != nullptr)
return;
Assert(this->matrix_info != nullptr, ExcNotInitialized());
inline MappingDataOnTheFly<dim, Number>::MappingDataOnTheFly(
const Mapping<dim> & mapping,
const Quadrature<1> &quadrature,
- const UpdateFlags update_flags) :
- fe_values(mapping,
- fe_dummy,
- Quadrature<dim>(quadrature),
- MappingInfo<dim, Number>::compute_update_flags(update_flags)),
- quadrature_1d(quadrature)
+ const UpdateFlags update_flags)
+ : fe_values(mapping,
+ fe_dummy,
+ Quadrature<dim>(quadrature),
+ MappingInfo<dim, Number>::compute_update_flags(update_flags))
+ , quadrature_1d(quadrature)
{
mapping_info_storage.descriptor.resize(1);
mapping_info_storage.descriptor[0].initialize(quadrature);
template <int dim, typename Number>
inline MappingDataOnTheFly<dim, Number>::MappingDataOnTheFly(
const Quadrature<1> &quadrature,
- const UpdateFlags update_flags) :
- MappingDataOnTheFly(::dealii::StaticMappingQ1<dim, dim>::mapping,
- quadrature,
- update_flags)
+ const UpdateFlags update_flags)
+ : MappingDataOnTheFly(::dealii::StaticMappingQ1<dim, dim>::mapping,
+ quadrature,
+ update_flags)
{}
template <int structdim, int spacedim, typename Number>
MappingInfoStorage<structdim, spacedim, Number>::QuadratureDescriptor ::
- QuadratureDescriptor() :
- n_q_points(numbers::invalid_unsigned_int)
+ QuadratureDescriptor()
+ : n_q_points(numbers::invalid_unsigned_int)
{}
template <int dim, typename Number>
struct CompressedCellData
{
- CompressedCellData(const double expected_size) :
- data(FPArrayComparator<Number>(expected_size))
+ CompressedCellData(const double expected_size)
+ : data(FPArrayComparator<Number>(expected_size))
{}
std::map<
template <int dim, typename Number>
- LocalData<dim, Number>::LocalData(const double jac_size_in) :
- jac_size(jac_size_in)
+ LocalData<dim, Number>::LocalData(const double jac_size_in)
+ : jac_size(jac_size_in)
{}
// select the inverse of the Jacobian (not the Jacobian as in the
// CompressedCellData) and add another factor of 512 to account for
// some roundoff effects.
- CompressedFaceData(const Number jacobian_size) :
- data(FPArrayComparator<Number>(512. / jacobian_size)),
- jacobian_size(jacobian_size)
+ CompressedFaceData(const Number jacobian_size)
+ : data(FPArrayComparator<Number>(512. / jacobian_size))
+ , jacobian_size(jacobian_size)
{}
// Store the Jacobians on both sides of a face (2*(dim*dim) entries),
else if (dim == 1)
return 0;
else
- Assert(
- false,
- ExcNotImplemented("Not possible in dim=" + std::to_string(dim)));
+ Assert(false,
+ ExcNotImplemented("Not possible in dim=" +
+ std::to_string(dim)));
return numbers::invalid_unsigned_int;
}
// finally compute the normal times the jacobian
for (unsigned int i = 0; i < data_faces_local.size(); ++i)
- tasks += Threads::new_task(
- &compute_normal_times_jacobian<dim, Number>,
- work_per_chunk * i,
- std::min(work_per_chunk * (i + 1), (unsigned int)faces.size()),
- face_type,
- faces,
- face_data[my_q]);
+ tasks +=
+ Threads::new_task(&compute_normal_times_jacobian<dim, Number>,
+ work_per_chunk * i,
+ std::min(work_per_chunk * (i + 1),
+ (unsigned int)faces.size()),
+ face_type,
+ faces,
+ face_data[my_q]);
tasks.join_all();
}
}
const SizeInfo &task_info) const
{
out << " Cell types: ";
- task_info.print_memory_statistics(
- out, cell_type.capacity() * sizeof(GeometryType));
+ task_info.print_memory_statistics(out,
+ cell_type.capacity() *
+ sizeof(GeometryType));
out << " Face types: ";
- task_info.print_memory_statistics(
- out, face_type.capacity() * sizeof(GeometryType));
+ task_info.print_memory_statistics(out,
+ face_type.capacity() *
+ sizeof(GeometryType));
for (unsigned int j = 0; j < cell_data.size(); ++j)
{
out << " Data component " << j << std::endl;
/* ------------------------------------------------------------------ */
template <typename Number>
- FPArrayComparator<Number>::FPArrayComparator(const Number scaling) :
- tolerance(scaling * std::numeric_limits<double>::epsilon() * 1024.)
+ FPArrayComparator<Number>::FPArrayComparator(const Number scaling)
+ : tolerance(scaling * std::numeric_limits<double>::epsilon() * 1024.)
{}
const bool initialize_mapping = true,
const bool overlap_communication_computation = true,
const bool hold_all_faces_to_owned_cells = false,
- const bool cell_vectorization_categories_strict = false) :
- tasks_parallel_scheme(tasks_parallel_scheme),
- tasks_block_size(tasks_block_size),
- mapping_update_flags(mapping_update_flags),
- mapping_update_flags_boundary_faces(mapping_update_flags_boundary_faces),
- mapping_update_flags_inner_faces(mapping_update_flags_inner_faces),
- mapping_update_flags_faces_by_cells(mapping_update_flags_faces_by_cells),
- level_mg_handler(level_mg_handler),
- store_plain_indices(store_plain_indices),
- initialize_indices(initialize_indices),
- initialize_mapping(initialize_mapping),
- overlap_communication_computation(overlap_communication_computation),
- hold_all_faces_to_owned_cells(hold_all_faces_to_owned_cells),
- cell_vectorization_categories_strict(cell_vectorization_categories_strict)
+ const bool cell_vectorization_categories_strict = false)
+ : tasks_parallel_scheme(tasks_parallel_scheme)
+ , tasks_block_size(tasks_block_size)
+ , mapping_update_flags(mapping_update_flags)
+ , mapping_update_flags_boundary_faces(mapping_update_flags_boundary_faces)
+ , mapping_update_flags_inner_faces(mapping_update_flags_inner_faces)
+ , mapping_update_flags_faces_by_cells(mapping_update_flags_faces_by_cells)
+ , level_mg_handler(level_mg_handler)
+ , store_plain_indices(store_plain_indices)
+ , initialize_indices(initialize_indices)
+ , initialize_mapping(initialize_mapping)
+ , overlap_communication_computation(overlap_communication_computation)
+ , hold_all_faces_to_owned_cells(hold_all_faces_to_owned_cells)
+ , cell_vectorization_categories_strict(
+ cell_vectorization_categories_strict)
{}
/**
*/
struct DoFHandlers
{
- DoFHandlers() :
- active_dof_handler(usual),
- n_dof_handlers(0),
- level(numbers::invalid_unsigned_int)
+ DoFHandlers()
+ : active_dof_handler(usual)
+ , n_dof_handlers(0)
+ , level(numbers::invalid_unsigned_int)
{}
std::vector<SmartPointer<const DoFHandler<dim>>> dof_handler;
if (fe_index >= dof_info[dof_handler_component].max_fe_index)
return std::pair<unsigned int, unsigned int>(range.second, range.second);
else
- return create_cell_subrange_hp_by_index(
- range, fe_index, dof_handler_component);
+ return create_cell_subrange_hp_by_index(range,
+ fe_index,
+ dof_handler_component);
}
const dealii::MatrixFree<dim, Number> &matrix_free,
const typename dealii::MatrixFree<dim, Number>::DataAccessOnFaces
vector_face_access,
- const unsigned int n_components) :
- matrix_free(matrix_free),
- vector_face_access(
- matrix_free.get_task_info().face_partition_data.empty() ?
- dealii::MatrixFree<dim, Number>::DataAccessOnFaces::unspecified :
- vector_face_access),
- ghosts_were_set(false)
+ const unsigned int n_components)
+ : matrix_free(matrix_free)
+ , vector_face_access(
+ matrix_free.get_task_info().face_partition_data.empty() ?
+ dealii::MatrixFree<dim, Number>::DataAccessOnFaces::unspecified :
+ vector_face_access)
+ , ghosts_were_set(false)
# ifdef DEAL_II_WITH_MPI
- ,
- tmp_data(n_components),
- requests(n_components)
+ , tmp_data(n_components)
+ , requests(n_components)
# endif
{
(void)n_components;
const typename MF::DataAccessOnFaces src_vector_face_access =
MF::DataAccessOnFaces::none,
const typename MF::DataAccessOnFaces dst_vector_face_access =
- MF::DataAccessOnFaces::none) :
- matrix_free(matrix_free),
- container(const_cast<Container &>(container)),
- cell_function(cell_function),
- face_function(face_function),
- boundary_function(boundary_function),
- src(src),
- dst(dst),
- src_data_exchanger(matrix_free,
- src_vector_face_access,
- n_components(src)),
- dst_data_exchanger(matrix_free,
- dst_vector_face_access,
- n_components(dst)),
- src_and_dst_are_same(PointerComparison::equal(&src, &dst)),
- zero_dst_vector_setting(zero_dst_vector_setting && !src_and_dst_are_same)
+ MF::DataAccessOnFaces::none)
+ : matrix_free(matrix_free)
+ , container(const_cast<Container &>(container))
+ , cell_function(cell_function)
+ , face_function(face_function)
+ , boundary_function(boundary_function)
+ , src(src)
+ , dst(dst)
+ , src_data_exchanger(matrix_free,
+ src_vector_face_access,
+ n_components(src))
+ , dst_data_exchanger(matrix_free,
+ dst_vector_face_access,
+ n_components(dst))
+ , src_and_dst_are_same(PointerComparison::equal(&src, &dst))
+ , zero_dst_vector_setting(zero_dst_vector_setting &&
+ !src_and_dst_are_same)
{}
// Runs the cell work. If no function is given, nothing is done
MFClassWrapper(const function_type cell,
const function_type face,
- const function_type boundary) :
- cell(cell),
- face(face),
- boundary(boundary)
+ const function_type boundary)
+ : cell(cell)
+ , face(face)
+ , boundary(boundary)
{}
void
// --------------------- MatrixFree -----------------------------------
template <int dim, typename Number>
-MatrixFree<dim, Number>::MatrixFree() :
- Subscriptor(),
- indices_are_initialized(false),
- mapping_is_initialized(false)
+MatrixFree<dim, Number>::MatrixFree()
+ : Subscriptor()
+ , indices_are_initialized(false)
+ , mapping_is_initialized(false)
{}
template <int dim, typename Number>
-MatrixFree<dim, Number>::MatrixFree(const MatrixFree<dim, Number> &other) :
- Subscriptor()
+MatrixFree<dim, Number>::MatrixFree(const MatrixFree<dim, Number> &other)
+ : Subscriptor()
{
copy_from(other);
}
std::pair<unsigned int, unsigned int> index =
cell_level_index[macro_cell_number * vectorization_length + vector_number];
- return typename DoFHandler<dim>::cell_iterator(
- &dofh->get_triangulation(), index.first, index.second, dofh);
+ return typename DoFHandler<dim>::cell_iterator(&dofh->get_triangulation(),
+ index.first,
+ index.second,
+ dofh);
}
const hp::DoFHandler<dim> *dofh = dof_handlers.hp_dof_handler[dof_index];
std::pair<unsigned int, unsigned int> index =
cell_level_index[macro_cell_number * vectorization_length + vector_number];
- return typename hp::DoFHandler<dim>::cell_iterator(
- &dofh->get_triangulation(), index.first, index.second, dofh);
+ return typename hp::DoFHandler<dim>::cell_iterator(&dofh->get_triangulation(),
+ index.first,
+ index.second,
+ dofh);
}
my_pid :
numbers::invalid_subdomain_id;
for (; cell != end_cell; ++cell)
- internal::MatrixFreeFunctions::resolve_cell(
- cell, cell_level_index, subdomain_id);
+ internal::MatrixFreeFunctions::resolve_cell(cell,
+ cell_level_index,
+ subdomain_id);
Assert(n_mpi_procs > 1 ||
cell_level_index.size() == tria.n_active_cells(),
my_pid :
numbers::invalid_subdomain_id;
for (; cell != end_cell; ++cell)
- internal::MatrixFreeFunctions::resolve_cell(
- cell, cell_level_index, subdomain_id);
+ internal::MatrixFreeFunctions::resolve_cell(cell,
+ cell_level_index,
+ subdomain_id);
Assert(n_mpi_procs > 1 || cell_level_index.size() == tria.n_active_cells(),
ExcInternalError());
// set locally owned range for each component
Assert(locally_owned_set[no].is_contiguous(), ExcNotImplemented());
- dof_info[no].vector_partitioner.reset(new Utilities::MPI::Partitioner(
- locally_owned_set[no], task_info.communicator));
+ dof_info[no].vector_partitioner.reset(
+ new Utilities::MPI::Partitioner(locally_owned_set[no],
+ task_info.communicator));
// initialize the arrays for indices
const unsigned int n_components_total =
// can parallelize by threads
Assert(additional_data.cell_vectorization_category.empty(),
ExcNotImplemented());
- task_info.initial_setup_blocks_tasks(
- subdomain_boundary_cells, renumbering, irregular_cells);
+ task_info.initial_setup_blocks_tasks(subdomain_boundary_cells,
+ renumbering,
+ irregular_cells);
task_info.guess_block_size(dof_info[0].dofs_per_cell[0]);
unsigned int n_macro_cells_before =
update_default)
make_connectivity_graph_faces(connectivity);
if (task_info.n_active_cells > 0)
- dof_info[0].make_connectivity_graph(
- task_info, renumbering, connectivity);
+ dof_info[0].make_connectivity_graph(task_info,
+ renumbering,
+ connectivity);
task_info.make_thread_graph(dof_info[0].cell_active_fe_index,
connectivity,
AssertDimension(constraint_pool_data.size(), length);
for (unsigned int no = 0; no < n_fe; ++no)
- dof_info[no].reorder_cells(
- task_info, renumbering, constraint_pool_row_index, irregular_cells);
+ dof_info[no].reorder_cells(task_info,
+ renumbering,
+ constraint_pool_row_index,
+ irregular_cells);
// Finally resort the faces and collect several faces for vectorization
if ((additional_data.mapping_update_flags_inner_faces |
dof_info[no].plain_dof_indices[i]));
}
std::sort(ghost_indices.begin(), ghost_indices.end());
- ghost_indices.erase(
- std::unique(ghost_indices.begin(), ghost_indices.end()),
- ghost_indices.end());
+ ghost_indices.erase(std::unique(ghost_indices.begin(),
+ ghost_indices.end()),
+ ghost_indices.end());
IndexSet compressed_set(part.size());
compressed_set.add_indices(ghost_indices.begin(),
ghost_indices.end());
stride));
i += shape.dofs_per_component_on_cell * stride;
}
- AssertDimension(
- i, dof_info[no].dofs_per_cell[0] * stride);
+ AssertDimension(i,
+ dof_info[no].dofs_per_cell[0] *
+ stride);
}
else if (dof_info[no].index_storage_variants
[internal::MatrixFreeFunctions::DoFInfo::
IndexStorageVariants::contiguous)
has_noncontiguous_cell = true;
}
- has_noncontiguous_cell = Utilities::MPI::min(
- (int)has_noncontiguous_cell, task_info.communicator);
+ has_noncontiguous_cell =
+ Utilities::MPI::min((int)has_noncontiguous_cell,
+ task_info.communicator);
std::sort(ghost_indices.begin(), ghost_indices.end());
- ghost_indices.erase(
- std::unique(ghost_indices.begin(), ghost_indices.end()),
- ghost_indices.end());
+ ghost_indices.erase(std::unique(ghost_indices.begin(),
+ ghost_indices.end()),
+ ghost_indices.end());
IndexSet compressed_set(part.size());
compressed_set.add_indices(ghost_indices.begin(),
ghost_indices.end());
stride));
i += shape.dofs_per_component_on_cell * stride;
}
- AssertDimension(
- i, dof_info[no].dofs_per_cell[0] * stride);
+ AssertDimension(i,
+ dof_info[no].dofs_per_cell[0] *
+ stride);
}
}
std::sort(ghost_indices.begin(), ghost_indices.end());
- ghost_indices.erase(
- std::unique(ghost_indices.begin(), ghost_indices.end()),
- ghost_indices.end());
+ ghost_indices.erase(std::unique(ghost_indices.begin(),
+ ghost_indices.end()),
+ ghost_indices.end());
IndexSet compressed_set(part.size());
compressed_set.add_indices(ghost_indices.begin(),
ghost_indices.end());
}
}
std::sort(new_indices.begin(), new_indices.end());
- connectivity_direct.add_entries(
- cell,
- new_indices.begin(),
- std::unique(new_indices.begin(), new_indices.end()));
+ connectivity_direct.add_entries(cell,
+ new_indices.begin(),
+ std::unique(new_indices.begin(),
+ new_indices.end()));
}
}
new_indices.push_back(it_neigh->column());
}
std::sort(new_indices.begin(), new_indices.end());
- connectivity.add_entries(
- block,
- new_indices.begin(),
- std::unique(new_indices.begin(), new_indices.end()));
+ connectivity.add_entries(block,
+ new_indices.begin(),
+ std::unique(new_indices.begin(),
+ new_indices.end()));
}
}
} // namespace
template <int dim, int fe_degree, int n_components, typename Number>
inline CellwiseInverseMassMatrix<dim, fe_degree, n_components, Number>::
CellwiseInverseMassMatrix(
- const FEEvaluationBase<dim, n_components, Number> &fe_eval) :
- fe_eval(fe_eval)
+ const FEEvaluationBase<dim, n_components, Number> &fe_eval)
+ : fe_eval(fe_eval)
{
FullMatrix<double> shapes_1d(fe_degree + 1, fe_degree + 1);
for (unsigned int i = 0, c = 0; i < shapes_1d.m(); ++i)
AlignedVector<VectorizedArray<Number>> &inverse_jxw) const
{
constexpr unsigned int dofs_per_cell = Utilities::pow(fe_degree + 1, dim);
- Assert(
- inverse_jxw.size() > 0 && inverse_jxw.size() % dofs_per_cell == 0,
- ExcMessage("Expected diagonal to be a multiple of scalar dof per cells"));
+ Assert(inverse_jxw.size() > 0 && inverse_jxw.size() % dofs_per_cell == 0,
+ ExcMessage(
+ "Expected diagonal to be a multiple of scalar dof per cells"));
// temporarily reduce size of inverse_jxw to dofs_per_cell to get JxW values
// from fe_eval (will not reallocate any memory)
VectorizedArray<Number> * out_array) const
{
constexpr unsigned int dofs_per_cell = Utilities::pow(fe_degree + 1, dim);
- Assert(
- inverse_coefficients.size() > 0 &&
- inverse_coefficients.size() % dofs_per_cell == 0,
- ExcMessage("Expected diagonal to be a multiple of scalar dof per cells"));
+ Assert(inverse_coefficients.size() > 0 &&
+ inverse_coefficients.size() % dofs_per_cell == 0,
+ ExcMessage(
+ "Expected diagonal to be a multiple of scalar dof per cells"));
if (inverse_coefficients.size() != dofs_per_cell)
AssertDimension(n_actual_components * dofs_per_cell,
inverse_coefficients.size());
//----------------- Base operator -----------------------------
template <int dim, typename VectorType>
- Base<dim, VectorType>::Base() : Subscriptor(), have_interface_matrices(false)
+ Base<dim, VectorType>::Base()
+ : Subscriptor()
+ , have_interface_matrices(false)
{}
//------------------------- MGInterfaceOperator ------------------------------
template <typename OperatorType>
- MGInterfaceOperator<OperatorType>::MGInterfaceOperator() :
- Subscriptor(),
- mf_base_operator(nullptr)
+ MGInterfaceOperator<OperatorType>::MGInterfaceOperator()
+ : Subscriptor()
+ , mf_base_operator(nullptr)
{}
int n_components,
typename VectorType>
MassOperator<dim, fe_degree, n_q_points_1d, n_components, VectorType>::
- MassOperator() :
- Base<dim, VectorType>()
+ MassOperator()
+ : Base<dim, VectorType>()
{}
MassOperator<dim, fe_degree, n_q_points_1d, n_components, VectorType>::
apply_add(VectorType &dst, const VectorType &src) const
{
- Base<dim, VectorType>::data->cell_loop(
- &MassOperator::local_apply_cell, this, dst, src);
+ Base<dim, VectorType>::data->cell_loop(&MassOperator::local_apply_cell,
+ this,
+ dst,
+ src);
}
int n_components,
typename VectorType>
LaplaceOperator<dim, fe_degree, n_q_points_1d, n_components, VectorType>::
- LaplaceOperator() :
- Base<dim, VectorType>()
+ LaplaceOperator()
+ : Base<dim, VectorType>()
{}
this->initialize_dof_vector(inverse_diagonal_vector);
this->initialize_dof_vector(diagonal_vector);
- this->data->cell_loop(
- &LaplaceOperator::local_diagonal_cell, this, diagonal_vector, dummy);
+ this->data->cell_loop(&LaplaceOperator::local_diagonal_cell,
+ this,
+ diagonal_vector,
+ dummy);
this->set_constrained_entries_to_one(diagonal_vector);
inverse_diagonal_vector = diagonal_vector;
LaplaceOperator<dim, fe_degree, n_q_points_1d, n_components, VectorType>::
apply_add(VectorType &dst, const VectorType &src) const
{
- Base<dim, VectorType>::data->cell_loop(
- &LaplaceOperator::local_apply_cell, this, dst, src);
+ Base<dim, VectorType>::data->cell_loop(&LaplaceOperator::local_apply_cell,
+ this,
+ dst,
+ src);
}
namespace
{
Assert(non_negative((*scalar_coefficient)(cell, q)),
ExcMessage("Coefficient must be non-negative"));
- phi.submit_gradient(
- (*scalar_coefficient)(cell, q) * phi.get_gradient(q), q);
+ phi.submit_gradient((*scalar_coefficient)(cell, q) *
+ phi.get_gradient(q),
+ q);
}
}
else
template <typename Number>
template <int dim>
- inline ShapeInfo<Number>::ShapeInfo(
- const Quadrature<1> & quad,
- const FiniteElement<dim> &fe_in,
- const unsigned int base_element_number) :
- element_type(tensor_general),
- fe_degree(0),
- n_q_points_1d(0),
- n_q_points(0),
- dofs_per_component_on_cell(0),
- n_q_points_face(0),
- dofs_per_component_on_face(0),
- nodal_at_cell_boundaries(false)
+ inline ShapeInfo<Number>::ShapeInfo(const Quadrature<1> & quad,
+ const FiniteElement<dim> &fe_in,
+ const unsigned int base_element_number)
+ : element_type(tensor_general)
+ , fe_degree(0)
+ , n_q_points_1d(0)
+ , n_q_points(0)
+ , dofs_per_component_on_cell(0)
+ , n_q_points_face(0)
+ , dofs_per_component_on_face(0)
+ , nodal_at_cell_boundaries(false)
{
reinit(quad, fe_in, base_element_number);
}
} // namespace
template <typename Number>
- ShapeInfo<Number>::ShapeInfo() :
- element_type(tensor_general),
- fe_degree(numbers::invalid_unsigned_int),
- n_q_points_1d(0),
- n_q_points(0),
- dofs_per_component_on_cell(0),
- n_q_points_face(0),
- dofs_per_component_on_face(0),
- nodal_at_cell_boundaries(false)
+ ShapeInfo<Number>::ShapeInfo()
+ : element_type(tensor_general)
+ , fe_degree(numbers::invalid_unsigned_int)
+ , n_q_points_1d(0)
+ , n_q_points(0)
+ , dofs_per_component_on_cell(0)
+ , n_q_points_face(0)
+ , dofs_per_component_on_face(0)
+ , nodal_at_cell_boundaries(false)
{}
// invert numbering again. Need to do it manually because we might
// have undefined blocks
- lexicographic_numbering.resize(
- fe_in.element_multiplicity(base_element_number) *
- fe->dofs_per_cell,
- numbers::invalid_unsigned_int);
+ lexicographic_numbering.resize(fe_in.element_multiplicity(
+ base_element_number) *
+ fe->dofs_per_cell,
+ numbers::invalid_unsigned_int);
for (unsigned int i = 0; i < lexicographic.size(); ++i)
if (lexicographic[i] != numbers::invalid_unsigned_int)
{
* Empty constructor. Does nothing. Be careful when using 'values' and
* related methods because they need to be filled with the other pointer
*/
- EvaluatorTensorProduct() :
- shape_values(nullptr),
- shape_gradients(nullptr),
- shape_hessians(nullptr)
+ EvaluatorTensorProduct()
+ : shape_values(nullptr)
+ , shape_gradients(nullptr)
+ , shape_hessians(nullptr)
{}
/**
const AlignedVector<Number2> &shape_gradients,
const AlignedVector<Number2> &shape_hessians,
const unsigned int dummy1 = 0,
- const unsigned int dummy2 = 0) :
- shape_values(shape_values.begin()),
- shape_gradients(shape_gradients.begin()),
- shape_hessians(shape_hessians.begin())
+ const unsigned int dummy2 = 0)
+ : shape_values(shape_values.begin())
+ , shape_gradients(shape_gradients.begin())
+ , shape_hessians(shape_hessians.begin())
{
// We can enter this function either for the apply() path that has
// n_rows * n_columns entries or for the apply_face() path that only has
{
static_assert(one_line == false || direction == dim - 1,
"Single-line evaluation only works for direction=dim-1.");
- Assert(
- shape_data != nullptr,
- ExcMessage("The given array shape_data must not be the null pointer!"));
+ Assert(shape_data != nullptr,
+ ExcMessage(
+ "The given array shape_data must not be the null pointer!"));
Assert(dim == direction + 1 || one_line == true || n_rows == n_columns ||
in != out,
ExcMessage("In-place operation only supported for "
static_assert(dim > 0 && dim < 4, "Only dim=1,2,3 supported");
static_assert(max_derivative >= 0 && max_derivative < 3,
"Only derivative orders 0-2 implemented");
- Assert(
- shape_values != nullptr,
- ExcMessage("The given array shape_values must not be the null pointer."));
+ Assert(shape_values != nullptr,
+ ExcMessage(
+ "The given array shape_values must not be the null pointer."));
constexpr int n_blocks1 = dim > 1 ? n_rows : 1;
constexpr int n_blocks2 = dim > 2 ? n_rows : 1;
* Empty constructor. Does nothing. Be careful when using 'values' and
* related methods because they need to be filled with the other constructor
*/
- EvaluatorTensorProduct() :
- shape_values(nullptr),
- shape_gradients(nullptr),
- shape_hessians(nullptr),
- n_rows(numbers::invalid_unsigned_int),
- n_columns(numbers::invalid_unsigned_int)
+ EvaluatorTensorProduct()
+ : shape_values(nullptr)
+ , shape_gradients(nullptr)
+ , shape_hessians(nullptr)
+ , n_rows(numbers::invalid_unsigned_int)
+ , n_columns(numbers::invalid_unsigned_int)
{}
/**
const AlignedVector<Number2> &shape_gradients,
const AlignedVector<Number2> &shape_hessians,
const unsigned int n_rows,
- const unsigned int n_columns) :
- shape_values(shape_values.begin()),
- shape_gradients(shape_gradients.begin()),
- shape_hessians(shape_hessians.begin()),
- n_rows(n_rows),
- n_columns(n_columns)
+ const unsigned int n_columns)
+ : shape_values(shape_values.begin())
+ , shape_gradients(shape_gradients.begin())
+ , shape_hessians(shape_hessians.begin())
+ , n_rows(n_rows)
+ , n_columns(n_columns)
{
// We can enter this function either for the apply() path that has
// n_rows * n_columns entries or for the apply_face() path that only has
{
static_assert(one_line == false || direction == dim - 1,
"Single-line evaluation only works for direction=dim-1.");
- Assert(
- shape_data != nullptr,
- ExcMessage("The given array shape_data must not be the null pointer!"));
+ Assert(shape_data != nullptr,
+ ExcMessage(
+ "The given array shape_data must not be the null pointer!"));
Assert(dim == direction + 1 || one_line == true || n_rows == n_columns ||
in != out,
ExcMessage("In-place operation only supported for "
apply_face(const Number *DEAL_II_RESTRICT in,
Number *DEAL_II_RESTRICT out) const
{
- Assert(
- shape_values != nullptr,
- ExcMessage("The given array shape_data must not be the null pointer!"));
+ Assert(shape_values != nullptr,
+ ExcMessage(
+ "The given array shape_data must not be the null pointer!"));
static_assert(dim > 0 && dim < 4, "Only dim=1,2,3 supported");
const int n_blocks1 = dim > 1 ? n_rows : 1;
const int n_blocks2 = dim > 2 ? n_rows : 1;
const AlignedVector<Number2> &shape_gradients,
const AlignedVector<Number2> &shape_hessians,
const unsigned int dummy1 = 0,
- const unsigned int dummy2 = 0) :
- shape_values(shape_values.begin()),
- shape_gradients(shape_gradients.begin()),
- shape_hessians(shape_hessians.begin())
+ const unsigned int dummy2 = 0)
+ : shape_values(shape_values.begin())
+ , shape_gradients(shape_gradients.begin())
+ , shape_hessians(shape_hessians.begin())
{
Assert(shape_values.size() == 0 ||
shape_values.size() == n_rows * n_columns,
* related methods because they need to be filled with the other
* constructor passing in at least an array for the values.
*/
- EvaluatorTensorProduct() :
- shape_values(nullptr),
- shape_gradients(nullptr),
- shape_hessians(nullptr)
+ EvaluatorTensorProduct()
+ : shape_values(nullptr)
+ , shape_gradients(nullptr)
+ , shape_hessians(nullptr)
{}
/**
* Constructor, taking the data from ShapeInfo (using the even-odd
* variants stored there)
*/
- EvaluatorTensorProduct(const AlignedVector<Number2> &shape_values) :
- shape_values(shape_values.begin()),
- shape_gradients(nullptr),
- shape_hessians(nullptr)
+ EvaluatorTensorProduct(const AlignedVector<Number2> &shape_values)
+ : shape_values(shape_values.begin())
+ , shape_gradients(nullptr)
+ , shape_hessians(nullptr)
{
AssertDimension(shape_values.size(), n_rows * ((n_columns + 1) / 2));
}
const AlignedVector<Number2> &shape_gradients,
const AlignedVector<Number2> &shape_hessians,
const unsigned int dummy1 = 0,
- const unsigned int dummy2 = 0) :
- shape_values(shape_values.begin()),
- shape_gradients(shape_gradients.begin()),
- shape_hessians(shape_hessians.begin())
+ const unsigned int dummy2 = 0)
+ : shape_values(shape_values.begin())
+ , shape_gradients(shape_gradients.begin())
+ , shape_hessians(shape_hessians.begin())
{
// In this function, we allow for dummy pointers if some of values,
// gradients or hessians should not be computed
gradients_one_line(const Number in[], Number out[]) const
{
Assert(shape_gradients != nullptr, ExcNotInitialized());
- apply<direction, contract_over_rows, add, 1, true>(
- shape_gradients, in, out);
+ apply<direction, contract_over_rows, add, 1, true>(shape_gradients,
+ in,
+ out);
}
template <int direction, bool contract_over_rows, bool add>
hessians_one_line(const Number in[], Number out[]) const
{
Assert(shape_hessians != nullptr, ExcNotInitialized());
- apply<direction, contract_over_rows, add, 2, true>(
- shape_hessians, in, out);
+ apply<direction, contract_over_rows, add, 2, true>(shape_hessians,
+ in,
+ out);
}
/**
* related methods because they need to be filled with the other
* constructor passing in at least an array for the values.
*/
- EvaluatorTensorProduct() :
- shape_values(nullptr),
- shape_gradients(nullptr),
- shape_hessians(nullptr)
+ EvaluatorTensorProduct()
+ : shape_values(nullptr)
+ , shape_gradients(nullptr)
+ , shape_hessians(nullptr)
{}
/**
* Constructor, taking the data from ShapeInfo (using the even-odd
* variants stored there)
*/
- EvaluatorTensorProduct(const AlignedVector<Number> &shape_values) :
- shape_values(shape_values.begin()),
- shape_gradients(nullptr),
- shape_hessians(nullptr)
+ EvaluatorTensorProduct(const AlignedVector<Number> &shape_values)
+ : shape_values(shape_values.begin())
+ , shape_gradients(nullptr)
+ , shape_hessians(nullptr)
{}
/**
const AlignedVector<Number2> &shape_gradients,
const AlignedVector<Number2> &shape_hessians,
const unsigned int dummy1 = 0,
- const unsigned int dummy2 = 0) :
- shape_values(shape_values.begin()),
- shape_gradients(shape_gradients.begin()),
- shape_hessians(shape_hessians.begin())
+ const unsigned int dummy2 = 0)
+ : shape_values(shape_values.begin())
+ , shape_gradients(shape_gradients.begin())
+ , shape_hessians(shape_hessians.begin())
{
(void)dummy1;
(void)dummy2;
gradients_one_line(const Number in[], Number out[]) const
{
Assert(shape_gradients != nullptr, ExcNotInitialized());
- apply<direction, contract_over_rows, add, 1, true>(
- shape_gradients, in, out);
+ apply<direction, contract_over_rows, add, 1, true>(shape_gradients,
+ in,
+ out);
}
template <int direction, bool contract_over_rows, bool add>
hessians_one_line(const Number in[], Number out[]) const
{
Assert(shape_hessians != nullptr, ExcNotInitialized());
- apply<direction, contract_over_rows, add, 0, true>(
- shape_hessians, in, out);
+ apply<direction, contract_over_rows, add, 0, true>(shape_hessians,
+ in,
+ out);
}
/**
ResidualLocalBlocksToGlobalBlocks<VectorType>::assemble(const DOFINFO &info)
{
for (unsigned int i = 0; i < residuals.size(); ++i)
- assemble(
- *(residuals.entry<VectorType>(i)), info.vector(i), info.indices);
+ assemble(*(residuals.entry<VectorType>(i)),
+ info.vector(i),
+ info.indices);
}
{
for (unsigned int i = 0; i < residuals.size(); ++i)
{
- assemble(
- *(residuals.entry<VectorType>(i)), info1.vector(i), info1.indices);
- assemble(
- *(residuals.entry<VectorType>(i)), info2.vector(i), info2.indices);
+ assemble(*(residuals.entry<VectorType>(i)),
+ info1.vector(i),
+ info1.indices);
+ assemble(*(residuals.entry<VectorType>(i)),
+ info2.vector(i),
+ info2.indices);
}
}
template <typename MatrixType, typename number>
inline MatrixLocalBlocksToGlobalBlocks<MatrixType, number>::
- MatrixLocalBlocksToGlobalBlocks(double threshold) :
- threshold(threshold)
+ MatrixLocalBlocksToGlobalBlocks(double threshold)
+ : threshold(threshold)
{}
for (unsigned int i = 0; i < sliced_col_indices.size(); ++i)
sliced_col_indices[i] = dof2[bi.block_start(block_col) + i];
- constraints->distribute_local_to_global(
- local, sliced_row_indices, sliced_col_indices, global);
+ constraints->distribute_local_to_global(local,
+ sliced_row_indices,
+ sliced_col_indices,
+ global);
}
}
template <typename MatrixType, typename number>
inline MGMatrixLocalBlocksToGlobalBlocks<MatrixType, number>::
- MGMatrixLocalBlocksToGlobalBlocks(double threshold) :
- threshold(threshold)
+ MGMatrixLocalBlocksToGlobalBlocks(double threshold)
+ : threshold(threshold)
{}
//----------------------------------------------------------------------//
template <int dim, int spacedim, typename number>
- DoFInfo<dim, spacedim, number>::DoFInfo() :
- face_number(numbers::invalid_unsigned_int),
- sub_number(numbers::invalid_unsigned_int),
- level_cell(false)
+ DoFInfo<dim, spacedim, number>::DoFInfo()
+ : face_number(numbers::invalid_unsigned_int)
+ , sub_number(numbers::invalid_unsigned_int)
+ , level_cell(false)
{}
template <int dim, int spacedim, typename number>
DoFInfo<dim, spacedim, number>::DoFInfo(
- const DoFHandler<dim, spacedim> &dof_handler) :
- face_number(numbers::invalid_unsigned_int),
- sub_number(numbers::invalid_unsigned_int),
- level_cell(false)
+ const DoFHandler<dim, spacedim> &dof_handler)
+ : face_number(numbers::invalid_unsigned_int)
+ , sub_number(numbers::invalid_unsigned_int)
+ , level_cell(false)
{
std::vector<types::global_dof_index> aux(1);
aux[0] = dof_handler.get_fe().dofs_per_cell;
//----------------------------------------------------------------------//
template <int dim, class DOFINFO>
- inline DoFInfoBox<dim, DOFINFO>::DoFInfoBox(const DOFINFO &seed) :
- cell(seed),
- cell_valid(true)
+ inline DoFInfoBox<dim, DOFINFO>::DoFInfoBox(const DOFINFO &seed)
+ : cell(seed)
+ , cell_valid(true)
{
for (unsigned int i = 0; i < GeometryInfo<dim>::faces_per_cell; ++i)
{
template <int dim, class DOFINFO>
inline DoFInfoBox<dim, DOFINFO>::DoFInfoBox(
- const DoFInfoBox<dim, DOFINFO> &other) :
- cell(other.cell),
- cell_valid(other.cell_valid)
+ const DoFInfoBox<dim, DOFINFO> &other)
+ : cell(other.cell)
+ , cell_valid(other.cell_valid)
{
for (unsigned int i = 0; i < GeometryInfo<dim>::faces_per_cell; ++i)
{
namespace MeshWorker
{
template <int dim, int spacedim, typename number>
- DoFInfo<dim, spacedim, number>::DoFInfo(const BlockInfo &info) :
- face_number(numbers::invalid_unsigned_int),
- sub_number(numbers::invalid_unsigned_int),
- block_info(&info, typeid(*this).name()),
- level_cell(false)
+ DoFInfo<dim, spacedim, number>::DoFInfo(const BlockInfo &info)
+ : face_number(numbers::invalid_unsigned_int)
+ , sub_number(numbers::invalid_unsigned_int)
+ , block_info(&info, typeid(*this).name())
+ , level_cell(false)
{
indices_by_block.resize(info.local().size());
for (unsigned int i = 0; i < indices_by_block.size(); ++i)
//----------------------------------------------------------------------//
template <typename number>
- inline CellsAndFaces<number>::CellsAndFaces() : separate_faces(true)
+ inline CellsAndFaces<number>::CellsAndFaces()
+ : separate_faces(true)
{}
//----------------------------------------------------------------------//
template <int dim, int sdim>
- inline IntegrationInfo<dim, sdim>::IntegrationInfo() :
- fevalv(0),
- multigrid(false),
- global_data(std::make_shared<VectorDataBase<dim, sdim>>()),
- n_components(numbers::invalid_unsigned_int)
+ inline IntegrationInfo<dim, sdim>::IntegrationInfo()
+ : fevalv(0)
+ , multigrid(false)
+ , global_data(std::make_shared<VectorDataBase<dim, sdim>>())
+ , n_components(numbers::invalid_unsigned_int)
{}
template <int dim, int sdim>
inline IntegrationInfo<dim, sdim>::IntegrationInfo(
- const IntegrationInfo<dim, sdim> &other) :
- multigrid(other.multigrid),
- values(other.values),
- gradients(other.gradients),
- hessians(other.hessians),
- global_data(other.global_data),
- fe_pointer(other.fe_pointer),
- n_components(other.n_components)
+ const IntegrationInfo<dim, sdim> &other)
+ : multigrid(other.multigrid)
+ , values(other.values)
+ , gradients(other.gradients)
+ , hessians(other.hessians)
+ , global_data(other.global_data)
+ , fe_pointer(other.fe_pointer)
+ , n_components(other.n_components)
{
fevalv.resize(other.fevalv.size());
for (unsigned int i = 0; i < other.fevalv.size(); ++i)
{
fevalv.resize(el.n_base_elements());
for (unsigned int i = 0; i < fevalv.size(); ++i)
- fevalv[i] = std::make_shared<FEVALUES>(
- mapping, el.base_element(i), quadrature, flags);
+ fevalv[i] = std::make_shared<FEVALUES>(mapping,
+ el.base_element(i),
+ quadrature,
+ flags);
}
n_components = el.n_components();
}
const BlockInfo *block_info)
{
initialize_update_flags();
- initialize_gauss_quadrature(
- (cell_flags & update_values) ? (el.tensor_degree() + 1) :
- el.tensor_degree(),
- (boundary_flags & update_values) ? (el.tensor_degree() + 1) :
- el.tensor_degree(),
- (face_flags & update_values) ? (el.tensor_degree() + 1) :
- el.tensor_degree(),
- false);
+ initialize_gauss_quadrature((cell_flags & update_values) ?
+ (el.tensor_degree() + 1) :
+ el.tensor_degree(),
+ (boundary_flags & update_values) ?
+ (el.tensor_degree() + 1) :
+ el.tensor_degree(),
+ (face_flags & update_values) ?
+ (el.tensor_degree() + 1) :
+ el.tensor_degree(),
+ false);
cell.template initialize<FEValues<dim, sdim>>(
el, mapping, cell_quadrature, cell_flags, block_info);
/**
* Constructor.
*/
- LoopControl() :
- own_cells(true),
- ghost_cells(false),
- faces_to_ghost(LoopControl::one),
- own_faces(LoopControl::one),
- cells_first(true)
+ LoopControl()
+ : own_cells(true)
+ , ghost_cells(false)
+ , faces_to_ghost(LoopControl::one)
+ , own_faces(LoopControl::one)
+ , cells_first(true)
{}
/**
dof_info.exterior_face_available[face_no] = true;
dof_info.interior[face_no].reinit(cell, face, face_no);
info.face.reinit(dof_info.interior[face_no]);
- dof_info.exterior[face_no].reinit(
- neighbor,
- neighbor->face(neighbor_face_no),
- neighbor_face_no);
+ dof_info.exterior[face_no].reinit(neighbor,
+ neighbor->face(
+ neighbor_face_no),
+ neighbor_face_no);
info.neighbor.reinit(dof_info.exterior[face_no]);
face_worker(dof_info.interior[face_no],
}
- inline GnuplotPatch::GnuplotPatch() :
- n_vectors(numbers::invalid_unsigned_int),
- n_points(numbers::invalid_unsigned_int),
- os(nullptr)
+ inline GnuplotPatch::GnuplotPatch()
+ : n_vectors(numbers::invalid_unsigned_int)
+ , n_points(numbers::invalid_unsigned_int)
+ , os(nullptr)
{}
info.indices_by_block[i];
if (constraints != nullptr)
- constraints->distribute_local_to_global(
- info.vector(k).block(i), ldi, *v);
+ constraints->distribute_local_to_global(info.vector(k).block(i),
+ ldi,
+ *v);
else
v->add(ldi, info.vector(k).block(i));
}
//----------------------------------------------------------------------//
template <typename MatrixType>
- inline MatrixSimple<MatrixType>::MatrixSimple(double threshold) :
- threshold(threshold)
+ inline MatrixSimple<MatrixType>::MatrixSimple(double threshold)
+ : threshold(threshold)
{}
{
for (unsigned int m = 0; m < matrix.size(); ++m)
{
- assemble(
- info1.matrix(m, false).matrix, m, info1.indices, info1.indices);
- assemble(
- info1.matrix(m, true).matrix, m, info1.indices, info2.indices);
- assemble(
- info2.matrix(m, false).matrix, m, info2.indices, info2.indices);
- assemble(
- info2.matrix(m, true).matrix, m, info2.indices, info1.indices);
+ assemble(info1.matrix(m, false).matrix,
+ m,
+ info1.indices,
+ info1.indices);
+ assemble(info1.matrix(m, true).matrix,
+ m,
+ info1.indices,
+ info2.indices);
+ assemble(info2.matrix(m, false).matrix,
+ m,
+ info2.indices,
+ info2.indices);
+ assemble(info2.matrix(m, true).matrix,
+ m,
+ info2.indices,
+ info1.indices);
}
}
else
//----------------------------------------------------------------------//
template <typename MatrixType>
- inline MGMatrixSimple<MatrixType>::MGMatrixSimple(double threshold) :
- threshold(threshold)
+ inline MGMatrixSimple<MatrixType>::MGMatrixSimple(double threshold)
+ : threshold(threshold)
{}
//----------------------------------------------------------------------//
template <typename MatrixType, typename VectorType>
- SystemSimple<MatrixType, VectorType>::SystemSimple(double t) :
- MatrixSimple<MatrixType>(t)
+ SystemSimple<MatrixType, VectorType>::SystemSimple(double t)
+ : MatrixSimple<MatrixType>(t)
{}
for (unsigned int j = 0; j < indices.size(); ++j)
for (unsigned int k = 0; k < indices.size(); ++k)
if (std::fabs(M(j, k)) >= MatrixSimple<MatrixType>::threshold)
- MatrixSimple<MatrixType>::matrix[index]->add(
- indices[j], indices[k], M(j, k));
+ MatrixSimple<MatrixType>::matrix[index]->add(indices[j],
+ indices[k],
+ M(j, k));
}
else
{
for (unsigned int j = 0; j < i1.size(); ++j)
for (unsigned int k = 0; k < i2.size(); ++k)
if (std::fabs(M(j, k)) >= MatrixSimple<MatrixType>::threshold)
- MatrixSimple<MatrixType>::matrix[index]->add(
- i1[j], i2[k], M(j, k));
+ MatrixSimple<MatrixType>::matrix[index]->add(i1[j],
+ i2[k],
+ M(j, k));
}
else
{
namespace MeshWorker
{
template <int dim, int spacedim, typename Number>
- VectorDataBase<dim, spacedim, Number>::VectorDataBase(
- const VectorSelector &v) :
- VectorSelector(v)
+ VectorDataBase<dim, spacedim, Number>::VectorDataBase(const VectorSelector &v)
+ : VectorSelector(v)
{}
//----------------------------------------------------------------------//
template <typename VectorType, int dim, int spacedim>
- VectorData<VectorType, dim, spacedim>::VectorData(const VectorSelector &s) :
- VectorDataBase<dim, spacedim, typename VectorType::value_type>(s)
+ VectorData<VectorType, dim, spacedim>::VectorData(const VectorSelector &s)
+ : VectorDataBase<dim, spacedim, typename VectorType::value_type>(s)
{}
VectorSlice<std::vector<
std::vector<Tensor<1, spacedim, typename VectorType::value_type>>>>
dst(gradients[i], component, n_comp);
- fe.get_function_gradients(
- *src, make_slice(index, start, size), dst, true);
+ fe.get_function_gradients(*src,
+ make_slice(index, start, size),
+ dst,
+ true);
}
for (unsigned int i = 0; i < this->n_hessians(); ++i)
VectorSlice<std::vector<
std::vector<Tensor<2, spacedim, typename VectorType::value_type>>>>
dst(hessians[i], component, n_comp);
- fe.get_function_hessians(
- *src, make_slice(index, start, size), dst, true);
+ fe.get_function_hessians(*src,
+ make_slice(index, start, size),
+ dst,
+ true);
}
}
//----------------------------------------------------------------------//
template <typename VectorType, int dim, int spacedim>
- MGVectorData<VectorType, dim, spacedim>::MGVectorData(
- const VectorSelector &s) :
- VectorData<VectorType, dim, spacedim>(s)
+ MGVectorData<VectorType, dim, spacedim>::MGVectorData(const VectorSelector &s)
+ : VectorData<VectorType, dim, spacedim>(s)
{}
data.read_ptr<MGLevelObject<VectorType>>(this->value_index(i));
VectorSlice<std::vector<std::vector<typename VectorType::value_type>>>
dst(values[i], component, n_comp);
- fe.get_function_values(
- (*src)[level], make_slice(index, start, size), dst, true);
+ fe.get_function_values((*src)[level],
+ make_slice(index, start, size),
+ dst,
+ true);
}
for (unsigned int i = 0; i < this->n_gradients(); ++i)
VectorSlice<std::vector<
std::vector<Tensor<1, spacedim, typename VectorType::value_type>>>>
dst(gradients[i], component, n_comp);
- fe.get_function_gradients(
- (*src)[level], make_slice(index, start, size), dst, true);
+ fe.get_function_gradients((*src)[level],
+ make_slice(index, start, size),
+ dst,
+ true);
}
for (unsigned int i = 0; i < this->n_hessians(); ++i)
VectorSlice<std::vector<
std::vector<Tensor<2, spacedim, typename VectorType::value_type>>>>
dst(hessians[i], component, n_comp);
- fe.get_function_hessians(
- (*src)[level], make_slice(index, start, size), dst, true);
+ fe.get_function_hessians((*src)[level],
+ make_slice(index, start, size),
+ dst,
+ true);
}
}
} // namespace MeshWorker
const bool variable,
const bool symmetric,
const bool transpose,
- const bool reverse) :
- MGSmoother<BlockVector<number>>(steps, variable, symmetric, transpose),
- reverse(reverse),
- mem(&mem)
+ const bool reverse)
+ : MGSmoother<BlockVector<number>>(steps, variable, symmetric, transpose)
+ , reverse(reverse)
+ , mem(&mem)
{}
template <typename MatrixType, class RelaxationType, typename number>
const bool variable,
const bool symmetric,
const bool transpose,
- const bool reverse) :
- MGSmoother<BlockVector<number>>(steps, variable, symmetric, transpose),
- reverse(reverse),
- mem(&this->vector_memory)
+ const bool reverse)
+ : MGSmoother<BlockVector<number>>(steps, variable, symmetric, transpose)
+ , reverse(reverse)
+ , mem(&this->vector_memory)
{}
#ifndef DOXYGEN
/* ------------------ Functions for MGCoarseGridApplySmoother -----------*/
template <class VectorType>
-MGCoarseGridApplySmoother<VectorType>::MGCoarseGridApplySmoother() :
- coarse_smooth(nullptr)
+MGCoarseGridApplySmoother<VectorType>::MGCoarseGridApplySmoother()
+ : coarse_smooth(nullptr)
{}
template <class VectorType>
MGCoarseGridApplySmoother<VectorType>::MGCoarseGridApplySmoother(
- const MGSmootherBase<VectorType> &coarse_smooth) :
- coarse_smooth(nullptr)
+ const MGSmootherBase<VectorType> &coarse_smooth)
+ : coarse_smooth(nullptr)
{
initialize(coarse_smooth);
}
MGCoarseGridApplySmoother<VectorType>::initialize(
const MGSmootherBase<VectorType> &coarse_smooth_)
{
- coarse_smooth = SmartPointer<const MGSmootherBase<VectorType>,
- MGCoarseGridApplySmoother<VectorType>>(
- &coarse_smooth_, typeid(*this).name());
+ coarse_smooth =
+ SmartPointer<const MGSmootherBase<VectorType>,
+ MGCoarseGridApplySmoother<VectorType>>(&coarse_smooth_,
+ typeid(*this).name());
}
template <typename SolverType, class VectorType>
-MGCoarseGridLACIteration<SolverType, VectorType>::MGCoarseGridLACIteration() :
- solver(0, typeid(*this).name()),
- matrix(0),
- precondition(0)
+MGCoarseGridLACIteration<SolverType, VectorType>::MGCoarseGridLACIteration()
+ : solver(0, typeid(*this).name())
+ , matrix(0)
+ , precondition(0)
{}
MGCoarseGridLACIteration<SolverType, VectorType>::MGCoarseGridLACIteration(
SolverType & s,
const MatrixType & m,
- const PreconditionerType &p) :
- solver(&s, typeid(*this).name())
+ const PreconditionerType &p)
+ : solver(&s, typeid(*this).name())
{
// Workaround: Unfortunately, not every "m" object has a rich enough
// interface to populate reinit_(domain|range)_vector. Thus, supply an
MGCoarseGridIterativeSolver<VectorType,
SolverType,
MatrixType,
- PreconditionerType>::MGCoarseGridIterativeSolver() :
- solver(0, typeid(*this).name()),
- matrix(0, typeid(*this).name()),
- preconditioner(0, typeid(*this).name())
+ PreconditionerType>::MGCoarseGridIterativeSolver()
+ : solver(0, typeid(*this).name())
+ , matrix(0, typeid(*this).name())
+ , preconditioner(0, typeid(*this).name())
{}
PreconditionerType>::
MGCoarseGridIterativeSolver(SolverType & solver,
const MatrixType & matrix,
- const PreconditionerType &preconditioner) :
- solver(&solver, typeid(*this).name()),
- matrix(&matrix, typeid(*this).name()),
- preconditioner(&preconditioner, typeid(*this).name())
+ const PreconditionerType &preconditioner)
+ : solver(&solver, typeid(*this).name())
+ , matrix(&matrix, typeid(*this).name())
+ , preconditioner(&preconditioner, typeid(*this).name())
{}
!level_constraints[l].is_constrained(dofs_1[i]))
{
level_constraints[l].add_line(dofs_2[i]);
- level_constraints[l].add_entry(
- dofs_2[i], dofs_1[i], 1.);
+ level_constraints[l].add_entry(dofs_2[i],
+ dofs_1[i],
+ 1.);
}
}
}
// At this point boundary_indices is empty.
boundary_indices.resize(n_levels);
- MGTools::make_boundary_list(
- dof, function_map, boundary_indices, component_mask);
+ MGTools::make_boundary_list(dof,
+ function_map,
+ boundary_indices,
+ component_mask);
}
ExcInternalError());
boundary_indices.resize(n_levels);
- MGTools::make_boundary_list(
- dof, boundary_ids, boundary_indices, component_mask);
+ MGTools::make_boundary_list(dof,
+ boundary_ids,
+ boundary_indices,
+ component_mask);
}
/*----------------------------------------------------------------------*/
template <typename MatrixType, typename number>
-MGMatrixSelect<MatrixType, number>::MGMatrixSelect(
- const unsigned int row,
- const unsigned int col,
- MGLevelObject<MatrixType> *p) :
- matrix(p, typeid(*this).name()),
- row(row),
- col(col)
+MGMatrixSelect<MatrixType, number>::MGMatrixSelect(const unsigned int row,
+ const unsigned int col,
+ MGLevelObject<MatrixType> *p)
+ : matrix(p, typeid(*this).name())
+ , row(row)
+ , col(col)
{}
inline MGSmoother<VectorType>::MGSmoother(const unsigned int steps,
const bool variable,
const bool symmetric,
- const bool transpose) :
- steps(steps),
- variable(variable),
- symmetric(symmetric),
- transpose(transpose),
- debug(0)
+ const bool transpose)
+ : steps(steps)
+ , variable(variable)
+ , symmetric(symmetric)
+ , transpose(transpose)
+ , debug(0)
{}
const unsigned int steps,
const bool variable,
const bool symmetric,
- const bool transpose) :
- MGSmoother<VectorType>(steps, variable, symmetric, transpose)
+ const bool transpose)
+ : MGSmoother<VectorType>(steps, variable, symmetric, transpose)
{}
MGSmootherRelaxation(const unsigned int steps,
const bool variable,
const bool symmetric,
- const bool transpose) :
- MGSmoother<VectorType>(steps, variable, symmetric, transpose)
+ const bool transpose)
+ : MGSmoother<VectorType>(steps, variable, symmetric, transpose)
{}
MGSmootherPrecondition(const unsigned int steps,
const bool variable,
const bool symmetric,
- const bool transpose) :
- MGSmoother<VectorType>(steps, variable, symmetric, transpose)
+ const bool transpose)
+ : MGSmoother<VectorType>(steps, variable, symmetric, transpose)
{}
// adaptive refinement) and the numbering of the finest level DoFs and
// the global DoFs are the same, we can do a plain copy
AssertDimension(dst[dst.max_level()].size(), src.size());
- internal::copy_vector(
- copy_indices[dst.max_level()], src, dst[dst.max_level()]);
+ internal::copy_vector(copy_indices[dst.max_level()],
+ src,
+ dst[dst.max_level()]);
return;
}
if (perform_plain_copy)
{
AssertDimension(dst.size(), src[src.max_level()].size());
- internal::copy_vector(
- copy_indices[src.max_level()], src[src.max_level()], dst);
+ internal::copy_vector(copy_indices[src.max_level()],
+ src[src.max_level()],
+ dst);
return;
}
MGLevelObject<Vector<number>> & dst,
const BlockVector<number2> & src) const
{
- do_copy_to_mg(
- mg_dof_handler, dst, src.block(target_component[selected_component]));
+ do_copy_to_mg(mg_dof_handler,
+ dst,
+ src.block(target_component[selected_component]));
}
const MGLevelObject<Vector<number>> &src) const
{
dst = 0;
- do_copy_from_mg(
- mg_dof_handler, dst.block(target_component[selected_component]), src);
+ do_copy_from_mg(mg_dof_handler,
+ dst.block(target_component[selected_component]),
+ src);
if (constraints != nullptr)
constraints->condense(dst);
}
const unsigned int n_blocks =
*std::max_element(target_component.begin(), target_component.end()) + 1;
std::vector<types::global_dof_index> dofs_per_block(n_blocks);
- DoFTools::count_dofs_per_block(
- mg_dof_handler, dofs_per_block, target_component);
+ DoFTools::count_dofs_per_block(mg_dof_handler,
+ dofs_per_block,
+ target_component);
BlockVector<number> tmp;
tmp.reinit(n_blocks);
for (unsigned int b = 0; b < n_blocks; ++b)
MGLevelObject<IndexSet> relevant_dofs(min_level, max_level);
for (unsigned int level = min_level; level <= max_level; ++level)
{
- DoFTools::extract_locally_relevant_level_dofs(
- dof_handler, level, relevant_dofs[level]);
+ DoFTools::extract_locally_relevant_level_dofs(dof_handler,
+ level,
+ relevant_dofs[level]);
if (dst[level].size() !=
dof_handler.locally_owned_mg_dofs(level).size() ||
dst[level].local_size() !=
const LinearAlgebra::distributed::BlockVector<Number2> & src) const
{
AssertDimension(matrix_free_transfer_vector.size(), 1);
- Assert(
- same_for_all,
- ExcMessage("This object was initialized with support for usage with one "
- "DoFHandler for each block, but this method assumes that "
- "the same DoFHandler is used for all the blocks!"));
+ Assert(same_for_all,
+ ExcMessage(
+ "This object was initialized with support for usage with one "
+ "DoFHandler for each block, but this method assumes that "
+ "the same DoFHandler is used for all the blocks!"));
const std::vector<const DoFHandler<dim, spacedim> *> mg_dofs(src.n_blocks(),
&mg_dof);
for (unsigned int l = min_level; l <= max_level; ++l)
dst_non_block[l].reinit(dst[l].block(b));
const unsigned int data_block = same_for_all ? 0 : b;
- matrix_free_transfer_vector[data_block].copy_to_mg(
- *mg_dof[b], dst_non_block, src.block(b));
+ matrix_free_transfer_vector[data_block].copy_to_mg(*mg_dof[b],
+ dst_non_block,
+ src.block(b));
for (unsigned int l = min_level; l <= max_level; ++l)
dst[l].block(b) = dst_non_block[l];
src_non_block[l] = src[l].block(b);
}
const unsigned int data_block = same_for_all ? 0 : b;
- matrix_free_transfer_vector[data_block].copy_from_mg(
- *mg_dof[b], dst.block(b), src_non_block);
+ matrix_free_transfer_vector[data_block].copy_from_mg(*mg_dof[b],
+ dst.block(b),
+ src_non_block);
}
}
const MGSmootherBase<VectorType> &post_smooth,
const unsigned int min_level,
const unsigned int max_level,
- Cycle cycle) :
- cycle_type(cycle),
- minlevel(min_level),
- matrix(&matrix, typeid(*this).name()),
- coarse(&coarse, typeid(*this).name()),
- transfer(&transfer, typeid(*this).name()),
- pre_smooth(&pre_smooth, typeid(*this).name()),
- post_smooth(&post_smooth, typeid(*this).name()),
- edge_down(nullptr, typeid(*this).name()),
- edge_up(nullptr, typeid(*this).name()),
- debug(0)
+ Cycle cycle)
+ : cycle_type(cycle)
+ , minlevel(min_level)
+ , matrix(&matrix, typeid(*this).name())
+ , coarse(&coarse, typeid(*this).name())
+ , transfer(&transfer, typeid(*this).name())
+ , pre_smooth(&pre_smooth, typeid(*this).name())
+ , post_smooth(&post_smooth, typeid(*this).name())
+ , edge_down(nullptr, typeid(*this).name())
+ , edge_up(nullptr, typeid(*this).name())
+ , debug(0)
{
const unsigned int dof_handler_max_level =
mg_dof_handler.get_triangulation().n_global_levels() - 1;
const MGSmootherBase<VectorType> &post_smooth,
const unsigned int min_level,
const unsigned int max_level,
- Cycle cycle) :
- cycle_type(cycle),
- matrix(&matrix, typeid(*this).name()),
- coarse(&coarse, typeid(*this).name()),
- transfer(&transfer, typeid(*this).name()),
- pre_smooth(&pre_smooth, typeid(*this).name()),
- post_smooth(&post_smooth, typeid(*this).name()),
- edge_out(nullptr, typeid(*this).name()),
- edge_in(nullptr, typeid(*this).name()),
- edge_down(nullptr, typeid(*this).name()),
- edge_up(nullptr, typeid(*this).name()),
- debug(0)
+ Cycle cycle)
+ : cycle_type(cycle)
+ , matrix(&matrix, typeid(*this).name())
+ , coarse(&coarse, typeid(*this).name())
+ , transfer(&transfer, typeid(*this).name())
+ , pre_smooth(&pre_smooth, typeid(*this).name())
+ , post_smooth(&post_smooth, typeid(*this).name())
+ , edge_out(nullptr, typeid(*this).name())
+ , edge_in(nullptr, typeid(*this).name())
+ , edge_down(nullptr, typeid(*this).name())
+ , edge_up(nullptr, typeid(*this).name())
+ , debug(0)
{
if (max_level == numbers::invalid_unsigned_int)
maxlevel = matrix.get_maxlevel();
if (uses_dof_handler_vector)
transfer.copy_from_mg_add(dof_handler_vector, dst, multigrid.solution);
else
- transfer.copy_from_mg_add(
- *dof_handler_vector[0], dst, multigrid.solution);
+ transfer.copy_from_mg_add(*dof_handler_vector[0],
+ dst,
+ multigrid.solution);
signals.transfer_to_global(false);
}
multigrid.cycle();
signals.transfer_to_global(true);
- transfer.copy_from_mg_add(
- *dof_handler_vector[0], dst, multigrid.solution);
+ transfer.copy_from_mg_add(*dof_handler_vector[0],
+ dst,
+ multigrid.solution);
signals.transfer_to_global(false);
}
} // namespace PreconditionMGImplementation
PreconditionMG<dim, VectorType, TRANSFER>::PreconditionMG(
const DoFHandler<dim> &dof_handler,
Multigrid<VectorType> &mg,
- const TRANSFER & transfer) :
- dof_handler_vector(1, &dof_handler),
- dof_handler_vector_raw(1, &dof_handler),
- multigrid(&mg),
- transfer(&transfer),
- uses_dof_handler_vector(false)
+ const TRANSFER & transfer)
+ : dof_handler_vector(1, &dof_handler)
+ , dof_handler_vector_raw(1, &dof_handler)
+ , multigrid(&mg)
+ , transfer(&transfer)
+ , uses_dof_handler_vector(false)
{}
template <int dim, typename VectorType, class TRANSFER>
PreconditionMG<dim, VectorType, TRANSFER>::PreconditionMG(
const std::vector<const DoFHandler<dim> *> &dof_handler,
Multigrid<VectorType> & mg,
- const TRANSFER & transfer) :
- dof_handler_vector(dof_handler.size()),
- dof_handler_vector_raw(dof_handler.size()),
- multigrid(&mg),
- transfer(&transfer),
- uses_dof_handler_vector(true)
+ const TRANSFER & transfer)
+ : dof_handler_vector(dof_handler.size())
+ , dof_handler_vector_raw(dof_handler.size())
+ , multigrid(&mg)
+ , transfer(&transfer)
+ , uses_dof_handler_vector(true)
{
for (unsigned int i = 0; i < dof_handler.size(); ++i)
{
DynamicSparsityPattern ci_sparsity;
ci_sparsity.reinit(dof_handler.n_dofs(level - 1),
dof_handler.n_dofs(level));
- MGTools::make_flux_sparsity_pattern_edge(
- dof_handler, ci_sparsity, level);
+ MGTools::make_flux_sparsity_pattern_edge(dof_handler,
+ ci_sparsity,
+ level);
sparsity_edge[level].copy_from(ci_sparsity);
matrix_up[level].reinit(sparsity_edge[level]);
matrix_down[level].reinit(sparsity_edge[level]);
std::shared_ptr<dealii::hp::FECollection<dim, spacedim>>>
& finite_elements,
const UpdateFlags update_flags,
- const bool use_face_values) :
- n_datasets(n_datasets),
- n_subdivisions(n_subdivisions),
- postprocessed_values(n_postprocessor_outputs.size()),
- mapping_collection(mapping),
- finite_elements(finite_elements),
- update_flags(update_flags)
+ const bool use_face_values)
+ : n_datasets(n_datasets)
+ , n_subdivisions(n_subdivisions)
+ , postprocessed_values(n_postprocessor_outputs.size())
+ , mapping_collection(mapping)
+ , finite_elements(finite_elements)
+ , update_flags(update_flags)
{
unsigned int n_q_points = 0;
if (use_face_values == false)
// x_fe_values
template <int dim, int spacedim>
ParallelDataBase<dim, spacedim>::ParallelDataBase(
- const ParallelDataBase<dim, spacedim> &data) :
- n_datasets(data.n_datasets),
- n_subdivisions(data.n_subdivisions),
- patch_values_scalar(data.patch_values_scalar),
- patch_values_system(data.patch_values_system),
- postprocessed_values(data.postprocessed_values),
- mapping_collection(data.mapping_collection),
- finite_elements(data.finite_elements),
- update_flags(data.update_flags)
+ const ParallelDataBase<dim, spacedim> &data)
+ : n_datasets(data.n_datasets)
+ , n_subdivisions(data.n_subdivisions)
+ , patch_values_scalar(data.patch_values_scalar)
+ , patch_values_system(data.patch_values_system)
+ , postprocessed_values(data.postprocessed_values)
+ , mapping_collection(data.mapping_collection)
+ , finite_elements(data.finite_elements)
+ , update_flags(data.update_flags)
{
if (data.x_fe_values.empty() == false)
{
const std::vector<std::string> &names_in,
const std::vector<
DataComponentInterpretation::DataComponentInterpretation>
- &data_component_interpretation) :
- dof_handler(
- dofs,
- typeid(dealii::DataOut_DoFData<DoFHandlerType,
- DoFHandlerType::dimension,
- DoFHandlerType::space_dimension>)
- .name()),
- names(names_in),
- data_component_interpretation(data_component_interpretation),
- postprocessor(nullptr, typeid(*this).name()),
- n_output_variables(names.size())
+ &data_component_interpretation)
+ : dof_handler(dofs,
+ typeid(
+ dealii::DataOut_DoFData<DoFHandlerType,
+ DoFHandlerType::dimension,
+ DoFHandlerType::space_dimension>)
+ .name())
+ , names(names_in)
+ , data_component_interpretation(data_component_interpretation)
+ , postprocessor(nullptr, typeid(*this).name())
+ , n_output_variables(names.size())
{
Assert(names.size() == data_component_interpretation.size(),
ExcDimensionMismatch(data_component_interpretation.size(),
DataEntryBase<DoFHandlerType>::DataEntryBase(
const DoFHandlerType *dofs,
const DataPostprocessor<DoFHandlerType::space_dimension>
- *data_postprocessor) :
- dof_handler(
- dofs,
- typeid(dealii::DataOut_DoFData<DoFHandlerType,
- DoFHandlerType::dimension,
- DoFHandlerType::space_dimension>)
- .name()),
- names(data_postprocessor->get_names()),
- data_component_interpretation(
- data_postprocessor->get_data_component_interpretation()),
- postprocessor(data_postprocessor, typeid(*this).name()),
- n_output_variables(names.size())
+ *data_postprocessor)
+ : dof_handler(dofs,
+ typeid(
+ dealii::DataOut_DoFData<DoFHandlerType,
+ DoFHandlerType::dimension,
+ DoFHandlerType::space_dimension>)
+ .name())
+ , names(data_postprocessor->get_names())
+ , data_component_interpretation(
+ data_postprocessor->get_data_component_interpretation())
+ , postprocessor(data_postprocessor, typeid(*this).name())
+ , n_output_variables(names.size())
{
Assert(data_postprocessor->get_names().size() ==
data_postprocessor->get_data_component_interpretation().size(),
const std::vector<std::string> &names,
const std::vector<
DataComponentInterpretation::DataComponentInterpretation>
- &data_component_interpretation) :
- DataEntryBase<DoFHandlerType>(dofs, names, data_component_interpretation),
- vector(data)
+ &data_component_interpretation)
+ : DataEntryBase<DoFHandlerType>(dofs,
+ names,
+ data_component_interpretation)
+ , vector(data)
{}
const DoFHandlerType *dofs,
const VectorType * data,
const DataPostprocessor<DoFHandlerType::space_dimension>
- *data_postprocessor) :
- DataEntryBase<DoFHandlerType>(dofs, data_postprocessor),
- vector(data)
+ *data_postprocessor)
+ : DataEntryBase<DoFHandlerType>(dofs, data_postprocessor)
+ , vector(data)
{}
template <typename DoFHandlerType, int patch_dim, int patch_space_dim>
-DataOut_DoFData<DoFHandlerType, patch_dim, patch_space_dim>::DataOut_DoFData() :
- triangulation(nullptr, typeid(*this).name()),
- dofs(nullptr, typeid(*this).name())
+DataOut_DoFData<DoFHandlerType, patch_dim, patch_space_dim>::DataOut_DoFData()
+ : triangulation(nullptr, typeid(*this).name())
+ , dofs(nullptr, typeid(*this).name())
{}
typename DoFHandlerType::cell_iterator
CommonInputs<spacedim>::get_cell() const
{
- Assert(
- cell.empty() == false,
- ExcMessage("You are trying to access the cell associated with a "
- "DataPostprocessorInputs::Scalar object for which no cell has "
- "been set."));
+ Assert(cell.empty() == false,
+ ExcMessage(
+ "You are trying to access the cell associated with a "
+ "DataPostprocessorInputs::Scalar object for which no cell has "
+ "been set."));
Assert(boost::any_cast<typename DoFHandlerType::cell_iterator>(&cell) !=
nullptr,
ExcMessage(
template <typename VectorType, int dim, int spacedim>
DoFOutputOperator<VectorType, dim, spacedim>::DoFOutputOperator(
const std::string &filename_base,
- const unsigned int digits) :
- filename_base(filename_base),
- digits(digits)
+ const unsigned int digits)
+ : filename_base(filename_base)
+ , digits(digits)
{
out.set_default_format(DataOutBase::gnuplot);
}
SolverControl & control,
VectorMemory<VectorType> &mem,
DataOut<dim> & data_out,
- const std::string & basename) :
- SolverType(control, mem),
- out(data_out),
- basename(basename)
+ const std::string & basename)
+ : SolverType(control, mem)
+ , out(data_out)
+ , basename(basename)
{}
const types::material_id material_id,
const typename FunctionMap<spacedim, number>::type *neumann_bc,
const ComponentMask & component_mask,
- const Function<spacedim> * coefficients) :
- finite_element(fe),
- face_quadratures(face_quadratures),
- fe_face_values_cell(
- mapping,
- finite_element,
- face_quadratures,
- update_gradients | update_JxW_values |
- (need_quadrature_points ? update_quadrature_points : UpdateFlags()) |
- update_normal_vectors),
- fe_face_values_neighbor(mapping,
- finite_element,
- face_quadratures,
- update_gradients | update_normal_vectors),
- fe_subface_values(mapping,
- finite_element,
- face_quadratures,
- update_gradients | update_normal_vectors),
- phi(n_solution_vectors,
- std::vector<std::vector<number>>(
- face_quadratures.max_n_quadrature_points(),
- std::vector<number>(fe.n_components()))),
- psi(n_solution_vectors,
- std::vector<std::vector<Tensor<1, spacedim, number>>>(
- face_quadratures.max_n_quadrature_points(),
- std::vector<Tensor<1, spacedim, number>>(fe.n_components()))),
- neighbor_psi(
- n_solution_vectors,
- std::vector<std::vector<Tensor<1, spacedim, number>>>(
- face_quadratures.max_n_quadrature_points(),
- std::vector<Tensor<1, spacedim, number>>(fe.n_components()))),
- normal_vectors(face_quadratures.max_n_quadrature_points()),
- neighbor_normal_vectors(face_quadratures.max_n_quadrature_points()),
- coefficient_values1(face_quadratures.max_n_quadrature_points()),
- coefficient_values(face_quadratures.max_n_quadrature_points(),
- dealii::Vector<double>(fe.n_components())),
- JxW_values(face_quadratures.max_n_quadrature_points()),
- subdomain_id(subdomain_id),
- material_id(material_id),
- neumann_bc(neumann_bc),
- component_mask(component_mask),
- coefficients(coefficients)
+ const Function<spacedim> * coefficients)
+ : finite_element(fe)
+ , face_quadratures(face_quadratures)
+ , fe_face_values_cell(mapping,
+ finite_element,
+ face_quadratures,
+ update_gradients | update_JxW_values |
+ (need_quadrature_points ?
+ update_quadrature_points :
+ UpdateFlags()) |
+ update_normal_vectors)
+ , fe_face_values_neighbor(mapping,
+ finite_element,
+ face_quadratures,
+ update_gradients | update_normal_vectors)
+ , fe_subface_values(mapping,
+ finite_element,
+ face_quadratures,
+ update_gradients | update_normal_vectors)
+ , phi(n_solution_vectors,
+ std::vector<std::vector<number>>(
+ face_quadratures.max_n_quadrature_points(),
+ std::vector<number>(fe.n_components())))
+ , psi(n_solution_vectors,
+ std::vector<std::vector<Tensor<1, spacedim, number>>>(
+ face_quadratures.max_n_quadrature_points(),
+ std::vector<Tensor<1, spacedim, number>>(fe.n_components())))
+ , neighbor_psi(n_solution_vectors,
+ std::vector<std::vector<Tensor<1, spacedim, number>>>(
+ face_quadratures.max_n_quadrature_points(),
+ std::vector<Tensor<1, spacedim, number>>(
+ fe.n_components())))
+ , normal_vectors(face_quadratures.max_n_quadrature_points())
+ , neighbor_normal_vectors(face_quadratures.max_n_quadrature_points())
+ , coefficient_values1(face_quadratures.max_n_quadrature_points())
+ , coefficient_values(face_quadratures.max_n_quadrature_points(),
+ dealii::Vector<double>(fe.n_components()))
+ , JxW_values(face_quadratures.max_n_quadrature_points())
+ , subdomain_id(subdomain_id)
+ , material_id(material_id)
+ , neumann_bc(neumann_bc)
+ , component_mask(component_mask)
+ , coefficients(coefficients)
{}
std::vector<dealii::Vector<number>> g(
n_q_points, dealii::Vector<number>(n_components));
parallel_data.neumann_bc->find(boundary_id)
- ->second->vector_value_list(
- fe_face_values_cell.get_present_fe_values()
- .get_quadrature_points(),
- g);
+ ->second->vector_value_list(fe_face_values_cell
+ .get_present_fe_values()
+ .get_quadrature_points(),
+ g);
for (unsigned int n = 0; n < n_solution_vectors; ++n)
for (unsigned int component = 0; component < n_components;
// get restriction of finite element function of @p{neighbor} to the
// common face. in the hp case, use the quadrature formula that
// matches the one we would use for the present cell
- fe_face_values_neighbor.reinit(
- neighbor, neighbor_neighbor, cell->active_fe_index());
+ fe_face_values_neighbor.reinit(neighbor,
+ neighbor_neighbor,
+ cell->active_fe_index());
factor = regular_face_factor<DoFHandlerType>(cell,
face_no,
}
else
{
- factor = boundary_face_factor<DoFHandlerType>(
- cell, face_no, fe_face_values_cell, strategy);
+ factor = boundary_face_factor<DoFHandlerType>(cell,
+ face_no,
+ fe_face_values_cell,
+ strategy);
}
// now go to the generic function that does all the other things
Assert(!neighbor_child->has_children(), ExcInternalError());
// restrict the finite element on the present cell to the subface
- fe_subface_values.reinit(
- cell, face_no, subface_no, cell->active_fe_index());
+ fe_subface_values.reinit(cell,
+ face_no,
+ subface_no,
+ cell->active_fe_index());
// restrict the finite element on the neighbor cell to the common
// @p{subface}.
- fe_face_values.reinit(
- neighbor_child, neighbor_neighbor, cell->active_fe_index());
+ fe_face_values.reinit(neighbor_child,
+ neighbor_neighbor,
+ cell->active_fe_index());
const double factor =
irregular_face_factor<DoFHandlerType>(cell,
#ifdef DEAL_II_WITH_P4EST
if (dynamic_cast<const parallel::distributed::Triangulation<dim, spacedim> *>(
&dof_handler.get_triangulation()) != nullptr)
- Assert(
- (subdomain_id_ == numbers::invalid_subdomain_id) ||
- (subdomain_id_ ==
- dynamic_cast<const parallel::distributed::Triangulation<dim, spacedim>
- &>(dof_handler.get_triangulation())
- .locally_owned_subdomain()),
- ExcMessage("For parallel distributed triangulations, the only "
- "valid subdomain_id that can be passed here is the "
- "one that corresponds to the locally owned subdomain id."));
+ Assert((subdomain_id_ == numbers::invalid_subdomain_id) ||
+ (subdomain_id_ ==
+ dynamic_cast<
+ const parallel::distributed::Triangulation<dim, spacedim> &>(
+ dof_handler.get_triangulation())
+ .locally_owned_subdomain()),
+ ExcMessage(
+ "For parallel distributed triangulations, the only "
+ "valid subdomain_id that can be passed here is the "
+ "one that corresponds to the locally owned subdomain id."));
const types::subdomain_id subdomain_id =
((dynamic_cast<const parallel::distributed::Triangulation<dim, spacedim> *>(
i != neumann_bc.end();
++i)
Assert(i->second->n_components == n_components,
- ExcInvalidBoundaryFunction(
- i->first, i->second->n_components, n_components));
+ ExcInvalidBoundaryFunction(i->first,
+ i->second->n_components,
+ n_components));
Assert(component_mask.represents_n_components(n_components),
ExcInvalidComponentMask());
FEFieldFunction<dim, DoFHandlerType, VectorType>::FEFieldFunction(
const DoFHandlerType &mydh,
const VectorType & myv,
- const Mapping<dim> & mymapping) :
- Function<dim, typename VectorType::value_type>(
- mydh.get_fe(0).n_components()),
- dh(&mydh, "FEFieldFunction"),
- data_vector(myv),
- mapping(mymapping),
- cache(dh->get_triangulation(), mymapping),
- cell_hint(dh->end())
+ const Mapping<dim> & mymapping)
+ : Function<dim, typename VectorType::value_type>(
+ mydh.get_fe(0).n_components())
+ , dh(&mydh, "FEFieldFunction")
+ , data_vector(myv)
+ , mapping(mymapping)
+ , cache(dh->get_triangulation(), mymapping)
+ , cell_hint(dh->end())
{}
quadrature_collection.push_back(Quadrature<dim>(qpoints[i], ww));
}
// Get a function value object
- hp::FEValues<dim> fe_v(
- mapping_collection, fe_collection, quadrature_collection, update_values);
+ hp::FEValues<dim> fe_v(mapping_collection,
+ fe_collection,
+ quadrature_collection,
+ update_values);
// Now gather all the information we need
for (unsigned int i = 0; i < n_cells; ++i)
{
template <int dim>
KDTree<dim>::PointCloudAdaptor::PointCloudAdaptor(
- const std::vector<Point<dim>> &_points) :
- points(_points)
+ const std::vector<Point<dim>> &_points)
+ : points(_points)
{}
template <typename DoFHandlerType>
inline IteratorRange<DoFHandlerType>::IteratorRange(
const active_cell_iterator &first,
- const active_cell_iterator &second) :
- first(first),
- second(second)
+ const active_cell_iterator &second)
+ : first(first)
+ , second(second)
{}
template <typename DoFHandlerType>
- inline IteratorRange<DoFHandlerType>::IteratorRange(
- const iterator_pair &ip) :
- first(ip.first),
- second(ip.second)
+ inline IteratorRange<DoFHandlerType>::IteratorRange(const iterator_pair &ip)
+ : first(ip.first)
+ , second(ip.second)
{}
const Function<spacedim, number> * coefficient,
const Function<spacedim, number> * rhs_function,
const ::dealii::hp::QCollection<dim> & quadrature,
- const ::dealii::hp::MappingCollection<dim, spacedim> &mapping) :
- fe_collection(fe),
- quadrature_collection(quadrature),
- mapping_collection(mapping),
- x_fe_values(mapping_collection,
- fe_collection,
- quadrature_collection,
- update_flags),
- coefficient_values(quadrature_collection.max_n_quadrature_points()),
- coefficient_vector_values(
- quadrature_collection.max_n_quadrature_points(),
- dealii::Vector<number>(fe_collection.n_components())),
- rhs_values(quadrature_collection.max_n_quadrature_points()),
- rhs_vector_values(
- quadrature_collection.max_n_quadrature_points(),
- dealii::Vector<number>(fe_collection.n_components())),
- coefficient(coefficient),
- rhs_function(rhs_function),
- update_flags(update_flags)
+ const ::dealii::hp::MappingCollection<dim, spacedim> &mapping)
+ : fe_collection(fe)
+ , quadrature_collection(quadrature)
+ , mapping_collection(mapping)
+ , x_fe_values(mapping_collection,
+ fe_collection,
+ quadrature_collection,
+ update_flags)
+ , coefficient_values(quadrature_collection.max_n_quadrature_points())
+ , coefficient_vector_values(
+ quadrature_collection.max_n_quadrature_points(),
+ dealii::Vector<number>(fe_collection.n_components()))
+ , rhs_values(quadrature_collection.max_n_quadrature_points())
+ , rhs_vector_values(quadrature_collection.max_n_quadrature_points(),
+ dealii::Vector<number>(
+ fe_collection.n_components()))
+ , coefficient(coefficient)
+ , rhs_function(rhs_function)
+ , update_flags(update_flags)
{}
- Scratch(const Scratch &data) :
- fe_collection(data.fe_collection),
- quadrature_collection(data.quadrature_collection),
- mapping_collection(data.mapping_collection),
- x_fe_values(mapping_collection,
- fe_collection,
- quadrature_collection,
- data.update_flags),
- coefficient_values(data.coefficient_values),
- coefficient_vector_values(data.coefficient_vector_values),
- rhs_values(data.rhs_values),
- rhs_vector_values(data.rhs_vector_values),
- coefficient(data.coefficient),
- rhs_function(data.rhs_function),
- update_flags(data.update_flags)
+ Scratch(const Scratch &data)
+ : fe_collection(data.fe_collection)
+ , quadrature_collection(data.quadrature_collection)
+ , mapping_collection(data.mapping_collection)
+ , x_fe_values(mapping_collection,
+ fe_collection,
+ quadrature_collection,
+ data.update_flags)
+ , coefficient_values(data.coefficient_values)
+ , coefficient_vector_values(data.coefficient_vector_values)
+ , rhs_values(data.rhs_values)
+ , rhs_vector_values(data.rhs_vector_values)
+ , coefficient(data.coefficient)
+ , rhs_function(data.rhs_function)
+ , update_flags(data.update_flags)
{}
Scratch &
if (data.coefficient->n_components == 1)
for (unsigned int point = 0; point < n_q_points;
++point)
- add_data += (data.coefficient_values[point] *
- fe_values.shape_value_component(
- i, point, comp_i) *
- fe_values.shape_value_component(
- j, point, comp_i) *
- JxW[point]);
+ add_data +=
+ (data.coefficient_values[point] *
+ fe_values.shape_value_component(i,
+ point,
+ comp_i) *
+ fe_values.shape_value_component(j,
+ point,
+ comp_i) *
+ JxW[point]);
else
for (unsigned int point = 0; point < n_q_points;
++point)
add_data +=
(data.coefficient_vector_values[point](comp_i) *
- fe_values.shape_value_component(
- i, point, comp_i) *
- fe_values.shape_value_component(
- j, point, comp_i) *
+ fe_values.shape_value_component(i,
+ point,
+ comp_i) *
+ fe_values.shape_value_component(j,
+ point,
+ comp_i) *
JxW[point]);
}
else
for (unsigned int point = 0; point < n_q_points;
++point)
add_data +=
- ((fe_values.shape_grad_component(
- i, point, comp_i) *
- fe_values.shape_grad_component(
- j, point, comp_i)) *
+ ((fe_values.shape_grad_component(i,
+ point,
+ comp_i) *
+ fe_values.shape_grad_component(j,
+ point,
+ comp_i)) *
JxW[point] * data.coefficient_values[point]);
else
for (unsigned int point = 0; point < n_q_points;
++point)
add_data +=
- ((fe_values.shape_grad_component(
- i, point, comp_i) *
- fe_values.shape_grad_component(
- j, point, comp_i)) *
+ ((fe_values.shape_grad_component(i,
+ point,
+ comp_i) *
+ fe_values.shape_grad_component(j,
+ point,
+ comp_i)) *
JxW[point] *
data.coefficient_vector_values[point](comp_i));
}
*matrix,
*right_hand_side);
else
- data.constraints->distribute_local_to_global(
- data.cell_matrix, data.dof_indices, *matrix);
+ data.constraints->distribute_local_to_global(data.cell_matrix,
+ data.dof_indices,
+ *matrix);
}
template <typename DoFHandlerType, typename number>
- CopyData<DoFHandlerType, number>::CopyData() :
- dofs_per_cell(numbers::invalid_unsigned_int)
+ CopyData<DoFHandlerType, number>::CopyData()
+ : dofs_per_cell(numbers::invalid_unsigned_int)
{}
template <typename DoFHandlerType, typename number>
- CopyData<DoFHandlerType, number>::CopyData(CopyData const &data) :
- dofs_per_cell(data.dofs_per_cell),
- dofs(data.dofs),
- dof_is_on_face(data.dof_is_on_face),
- cell(data.cell),
- cell_matrix(data.cell_matrix),
- cell_vector(data.cell_vector)
+ CopyData<DoFHandlerType, number>::CopyData(CopyData const &data)
+ : dofs_per_cell(data.dofs_per_cell)
+ , dofs(data.dofs)
+ , dof_is_on_face(data.dof_is_on_face)
+ , cell(data.cell)
+ , cell_matrix(data.cell_matrix)
+ , cell_vector(data.cell_vector)
{}
} // namespace AssemblerBoundary
} // namespace internal
hp::QCollection<dim> q_collection(q);
hp::MappingCollection<dim, spacedim> mapping_collection(mapping);
MatrixCreator::internal::AssemblerData::Scratch<dim, spacedim, number>
- assembler_data(
- fe_collection,
- update_values | update_JxW_values |
- (coefficient != nullptr ? update_quadrature_points : UpdateFlags(0)),
- coefficient,
- /*rhs_function=*/nullptr,
- q_collection,
- mapping_collection);
+ assembler_data(fe_collection,
+ update_values | update_JxW_values |
+ (coefficient != nullptr ? update_quadrature_points :
+ UpdateFlags(0)),
+ coefficient,
+ /*rhs_function=*/nullptr,
+ q_collection,
+ mapping_collection);
MatrixCreator::internal::AssemblerData::CopyData<number> copy_data;
copy_data.cell_matrix.reinit(
ExcDimensionMismatch(matrix.n(), dof.n_dofs()));
MatrixCreator::internal::AssemblerData::Scratch<dim, spacedim, number>
- assembler_data(
- dof.get_fe_collection(),
- update_values | update_JxW_values |
- (coefficient != nullptr ? update_quadrature_points : UpdateFlags(0)),
- coefficient,
- /*rhs_function=*/nullptr,
- q,
- mapping);
+ assembler_data(dof.get_fe_collection(),
+ update_values | update_JxW_values |
+ (coefficient != nullptr ? update_quadrature_points :
+ UpdateFlags(0)),
+ coefficient,
+ /*rhs_function=*/nullptr,
+ q,
+ mapping);
MatrixCreator::internal::AssemblerData::CopyData<number> copy_data;
copy_data.cell_matrix.reinit(
assembler_data.fe_collection.max_dofs_per_cell(),
++j)
copy_data.cell_matrix.back()(i, j) +=
coefficient_vector_values[point](comp) *
- fe_values.shape_value_component(
- j, point, comp) *
- fe_values.shape_value_component(
- i, point, comp) *
+ fe_values.shape_value_component(j,
+ point,
+ comp) *
+ fe_values.shape_value_component(i,
+ point,
+ comp) *
normal_adjustment[point][comp] * weight;
copy_data.cell_vector.back()(i) +=
rhs_values_system[point](
component_mapping[comp]) *
- fe_values.shape_value_component(
- i, point, comp) *
+ fe_values.shape_value_component(i,
+ point,
+ comp) *
normal_adjustment[point][comp] * weight;
}
}
WorkStream::run(
dof.begin_active(),
dof.end(),
- static_cast<std::function<void(
- typename DoFHandler<dim, spacedim>::active_cell_iterator const &,
- MatrixCreator::internal::AssemblerBoundary::Scratch const &,
- MatrixCreator::internal::AssemblerBoundary::
- CopyData<DoFHandler<dim, spacedim>, number> &)>>(
+ static_cast<std::function<
+ void(typename DoFHandler<dim, spacedim>::active_cell_iterator const &,
+ MatrixCreator::internal::AssemblerBoundary::Scratch const &,
+ MatrixCreator::internal::AssemblerBoundary::
+ CopyData<DoFHandler<dim, spacedim>, number> &)>>(
std::bind(
&internal::create_boundary_mass_matrix_1<dim, spacedim, number>,
std::placeholders::_1,
UpdateFlags update_flags =
UpdateFlags(update_values | update_JxW_values | update_normal_vectors |
update_quadrature_points);
- hp::FEFaceValues<dim, spacedim> x_fe_values(
- mapping, fe_collection, q, update_flags);
+ hp::FEFaceValues<dim, spacedim> x_fe_values(mapping,
+ fe_collection,
+ q,
+ update_flags);
// two variables for the coefficient,
// one for the two cases indicated in
++j)
copy_data.cell_matrix.back()(i, j) +=
coefficient_vector_values[point](comp) *
- fe_values.shape_value_component(
- i, point, comp) *
- fe_values.shape_value_component(
- j, point, comp) *
+ fe_values.shape_value_component(i,
+ point,
+ comp) *
+ fe_values.shape_value_component(j,
+ point,
+ comp) *
normal_adjustment[point][comp] * weight;
copy_data.cell_vector.back()(i) +=
rhs_values_system[point](
component_mapping[comp]) *
- fe_values.shape_value_component(
- i, point, comp) *
+ fe_values.shape_value_component(i,
+ point,
+ comp) *
normal_adjustment[point][comp] * weight;
}
}
hp::QCollection<dim> q_collection(q);
hp::MappingCollection<dim, spacedim> mapping_collection(mapping);
MatrixCreator::internal::AssemblerData::Scratch<dim, spacedim, double>
- assembler_data(
- fe_collection,
- update_gradients | update_JxW_values |
- (coefficient != nullptr ? update_quadrature_points : UpdateFlags(0)),
- coefficient,
- /*rhs_function=*/nullptr,
- q_collection,
- mapping_collection);
+ assembler_data(fe_collection,
+ update_gradients | update_JxW_values |
+ (coefficient != nullptr ? update_quadrature_points :
+ UpdateFlags(0)),
+ coefficient,
+ /*rhs_function=*/nullptr,
+ q_collection,
+ mapping_collection);
MatrixCreator::internal::AssemblerData::CopyData<double> copy_data;
copy_data.cell_matrix.reinit(
assembler_data.fe_collection.max_dofs_per_cell(),
ExcDimensionMismatch(matrix.n(), dof.n_dofs()));
MatrixCreator::internal::AssemblerData::Scratch<dim, spacedim, double>
- assembler_data(
- dof.get_fe_collection(),
- update_gradients | update_JxW_values |
- (coefficient != nullptr ? update_quadrature_points : UpdateFlags(0)),
- coefficient,
- /*rhs_function=*/nullptr,
- q,
- mapping);
+ assembler_data(dof.get_fe_collection(),
+ update_gradients | update_JxW_values |
+ (coefficient != nullptr ? update_quadrature_points :
+ UpdateFlags(0)),
+ coefficient,
+ /*rhs_function=*/nullptr,
+ q,
+ mapping);
MatrixCreator::internal::AssemblerData::CopyData<double> copy_data;
copy_data.cell_matrix.reinit(
assembler_data.fe_collection.max_dofs_per_cell(),
*/
struct Pointerstruct
{
- Pointerstruct() :
- indices_ptr(nullptr),
- dof_values_ptr(nullptr),
- active_fe_index(0)
+ Pointerstruct()
+ : indices_ptr(nullptr)
+ , dof_values_ptr(nullptr)
+ , active_fe_index(0)
{}
Pointerstruct(std::vector<types::global_dof_index> *indices_ptr_in,
- const unsigned int active_fe_index_in = 0) :
- indices_ptr(indices_ptr_in),
- dof_values_ptr(nullptr),
- active_fe_index(active_fe_index_in)
+ const unsigned int active_fe_index_in = 0)
+ : indices_ptr(indices_ptr_in)
+ , dof_values_ptr(nullptr)
+ , active_fe_index(active_fe_index_in)
{}
Pointerstruct(
std::vector<Vector<typename VectorType::value_type>> *dof_values_ptr_in,
- const unsigned int active_fe_index_in = 0) :
- indices_ptr(nullptr),
- dof_values_ptr(dof_values_ptr_in),
- active_fe_index(active_fe_index_in)
+ const unsigned int active_fe_index_in = 0)
+ : indices_ptr(nullptr)
+ , dof_values_ptr(dof_values_ptr_in)
+ , active_fe_index(active_fe_index_in)
{}
std::size_t
memory_consumption() const;
destination;
// value[m] <- sum inverse_jacobians[m][n] * old_value[n]:
- TensorAccessors::contract<1, 2, 1, dim>(
- destination, inverse_jacobians[i], source);
+ TensorAccessors::contract<1, 2, 1, dim>(destination,
+ inverse_jacobians[i],
+ source);
destination *= jacobians[i].determinant();
// now copy things back into the input=output vector
}
else
{
- transform<dim, spacedim>(
- fe.conforming_space, offset, fe_values_jacobians, function_values);
+ transform<dim, spacedim>(fe.conforming_space,
+ offset,
+ fe_values_jacobians,
+ function_values);
return (offset + fe.n_components());
}
}
VectorType & vec,
const ComponentMask & component_mask)
{
- Assert(
- component_mask.represents_n_components(
- dof_handler.get_fe().n_components()),
- ExcMessage("The number of components in the mask has to be either "
- "zero or equal to the number of components in the finite "
- "element."));
+ Assert(component_mask.represents_n_components(
+ dof_handler.get_fe().n_components()),
+ ExcMessage(
+ "The number of components in the mask has to be either "
+ "zero or equal to the number of components in the finite "
+ "element."));
Assert(vec.size() == dof_handler.n_dofs(),
ExcDimensionMismatch(vec.size(), dof_handler.n_dofs()));
// locations as well as Jacobians and their inverses.
// the latter are only needed for Hcurl or Hdiv conforming elements,
// but we'll just always include them.
- hp::FEValues<dim, spacedim> fe_values(
- mapping_collection,
- fe,
- support_quadrature,
- update_quadrature_points | update_jacobians | update_inverse_jacobians);
+ hp::FEValues<dim, spacedim> fe_values(mapping_collection,
+ fe,
+ support_quadrature,
+ update_quadrature_points |
+ update_jacobians |
+ update_inverse_jacobians);
//
// Now loop over all locally owned, active cells.
for (const auto i : interpolation.locally_owned_elements())
{
- const auto value = ::dealii::internal::ElementAccess<VectorType>::get(
- interpolation, i);
+ const auto value =
+ ::dealii::internal::ElementAccess<VectorType>::get(interpolation,
+ i);
const auto weight =
::dealii::internal::ElementAccess<VectorType>::get(weights, i);
- ::dealii::internal::ElementAccess<VectorType>::set(
- value / weight, i, vec);
+ ::dealii::internal::ElementAccess<VectorType>::set(value / weight,
+ i,
+ vec);
}
vec.compress(VectorOperation::insert);
}
SparsityPattern sparsity;
{
DynamicSparsityPattern dsp(dof.n_dofs(), dof.n_dofs());
- DoFTools::make_sparsity_pattern(
- dof, dsp, constraints, !constraints_are_compatible);
+ DoFTools::make_sparsity_pattern(dof,
+ dsp,
+ constraints,
+ !constraints_are_compatible);
sparsity.copy_from(dsp);
}
// it may be of another type than Vector<double> and that wouldn't
// necessarily go together with the matrix and other functions
for (unsigned int i = 0; i < vec.size(); ++i)
- ::dealii::internal::ElementAccess<VectorType>::set(
- vec(i), i, vec_result);
+ ::dealii::internal::ElementAccess<VectorType>::set(vec(i),
+ i,
+ vec_result);
}
const IndexSet & locally_owned_dofs = dof.locally_owned_dofs();
IndexSet::ElementIterator it = locally_owned_dofs.begin();
for (; it != locally_owned_dofs.end(); ++it)
- ::dealii::internal::ElementAccess<VectorType>::set(
- work_result(*it), *it, vec_result);
+ ::dealii::internal::ElementAccess<VectorType>::set(work_result(*it),
+ *it,
+ vec_result);
vec_result.compress(VectorOperation::insert);
}
// assemble right hand side:
{
- FEValues<dim> fe_values(
- mapping, dof.get_fe(), quadrature, update_values | update_JxW_values);
+ FEValues<dim> fe_values(mapping,
+ dof.get_fe(),
+ quadrature,
+ update_values | update_JxW_values);
const unsigned int dofs_per_cell = dof.get_fe().dofs_per_cell;
const unsigned int n_q_points = quadrature.size();
}
cell->get_dof_indices(local_dof_indices);
- constraints.distribute_local_to_global(
- cell_rhs, local_dof_indices, rhs);
+ constraints.distribute_local_to_global(cell_rhs,
+ local_dof_indices,
+ rhs);
}
rhs.compress(VectorOperation::add);
}
const IndexSet & locally_owned_dofs = dof.locally_owned_dofs();
IndexSet::ElementIterator it = locally_owned_dofs.begin();
for (; it != locally_owned_dofs.end(); ++it)
- ::dealii::internal::ElementAccess<VectorType>::set(
- vec(*it), *it, vec_result);
+ ::dealii::internal::ElementAccess<VectorType>::set(vec(*it),
+ *it,
+ vec_result);
vec_result.compress(VectorOperation::insert);
}
const IndexSet & locally_owned_dofs = dof.locally_owned_dofs();
IndexSet::ElementIterator it = locally_owned_dofs.begin();
for (; it != locally_owned_dofs.end(); ++it)
- ::dealii::internal::ElementAccess<VectorType>::set(
- vec(*it), *it, vec_result);
+ ::dealii::internal::ElementAccess<VectorType>::set(vec(*it),
+ *it,
+ vec_result);
vec_result.compress(VectorOperation::insert);
}
} // namespace
cell->get_dof_indices(dofs);
- constraints.distribute_local_to_global(
- cell_vector, dofs, rhs_vector);
+ constraints.distribute_local_to_global(cell_vector,
+ dofs,
+ rhs_vector);
}
}
else
++comp_i)
if (fe.get_nonzero_components(i)[comp_i])
{
- cell_vector(i) += rhs_values[point](comp_i) *
- fe_values.shape_value_component(
- i, point, comp_i) *
- weights[point];
+ cell_vector(i) +=
+ rhs_values[point](comp_i) *
+ fe_values.shape_value_component(i,
+ point,
+ comp_i) *
+ weights[point];
}
}
cell->get_dof_indices(dofs);
- constraints.distribute_local_to_global(
- cell_vector, dofs, rhs_vector);
+ constraints.distribute_local_to_global(cell_vector,
+ dofs,
+ rhs_vector);
}
}
}
UpdateFlags update_flags =
UpdateFlags(update_values | update_quadrature_points | update_JxW_values);
- hp::FEValues<dim, spacedim> x_fe_values(
- mapping, fe, quadrature, update_flags);
+ hp::FEValues<dim, spacedim> x_fe_values(mapping,
+ fe,
+ quadrature,
+ update_flags);
const unsigned int n_components = fe.n_components();
cell->get_dof_indices(dofs);
- constraints.distribute_local_to_global(
- cell_vector, dofs, rhs_vector);
+ constraints.distribute_local_to_global(cell_vector,
+ dofs,
+ rhs_vector);
}
}
else
++comp_i)
if (cell->get_fe().get_nonzero_components(i)[comp_i])
{
- cell_vector(i) += rhs_values[point](comp_i) *
- fe_values.shape_value_component(
- i, point, comp_i) *
- weights[point];
+ cell_vector(i) +=
+ rhs_values[point](comp_i) *
+ fe_values.shape_value_component(i,
+ point,
+ comp_i) *
+ weights[point];
}
}
cell->get_dof_indices(dofs);
- constraints.distribute_local_to_global(
- cell_vector, dofs, rhs_vector);
+ constraints.distribute_local_to_global(cell_vector,
+ dofs,
+ rhs_vector);
}
}
}
Quadrature<dim> q(
GeometryInfo<dim>::project_to_unit_cell(cell_point.second));
- FEValues<dim, spacedim> fe_values(
- mapping, dof_handler.get_fe(), q, UpdateFlags(update_values));
+ FEValues<dim, spacedim> fe_values(mapping,
+ dof_handler.get_fe(),
+ q,
+ UpdateFlags(update_values));
fe_values.reinit(cell_point.first);
const unsigned int dofs_per_cell = dof_handler.get_fe().dofs_per_cell;
const Point<spacedim> & p,
Vector<double> & rhs_vector)
{
- create_point_source_vector(
- StaticMappingQ1<dim, spacedim>::mapping, dof_handler, p, rhs_vector);
+ create_point_source_vector(StaticMappingQ1<dim, spacedim>::mapping,
+ dof_handler,
+ p,
+ rhs_vector);
}
const Point<spacedim> & p,
Vector<double> & rhs_vector)
{
- create_point_source_vector(
- hp::StaticMappingQ1<dim>::mapping_collection, dof_handler, p, rhs_vector);
+ create_point_source_vector(hp::StaticMappingQ1<dim>::mapping_collection,
+ dof_handler,
+ p,
+ rhs_vector);
}
GeometryInfo<dim>::project_to_unit_cell(cell_point.second));
const FEValuesExtractors::Vector vec(0);
- FEValues<dim, spacedim> fe_values(
- mapping, dof_handler.get_fe(), q, UpdateFlags(update_values));
+ FEValues<dim, spacedim> fe_values(mapping,
+ dof_handler.get_fe(),
+ q,
+ UpdateFlags(update_values));
fe_values.reinit(cell_point.first);
const unsigned int dofs_per_cell = dof_handler.get_fe().dofs_per_cell;
++comp_i)
if (fe.get_nonzero_components(i)[comp_i])
{
- cell_vector(i) += rhs_values[point](comp_i) *
- fe_values.shape_value_component(
- i, point, comp_i) *
- weights[point];
+ cell_vector(i) +=
+ rhs_values[point](comp_i) *
+ fe_values.shape_value_component(i,
+ point,
+ comp_i) *
+ weights[point];
}
}
++comp_i)
if (cell->get_fe().get_nonzero_components(i)[comp_i])
{
- cell_vector(i) += rhs_values[point](comp_i) *
- fe_values.shape_value_component(
- i, point, comp_i) *
- weights[point];
+ cell_vector(i) +=
+ rhs_values[point](comp_i) *
+ fe_values.shape_value_component(i,
+ point,
+ comp_i) *
+ weights[point];
}
}
dofs.resize(dofs_per_cell);
ExcDimensionMismatch(fe.n_components(),
boundary_function.n_components));
- Assert(
- component_mask.n_selected_components(fe.n_components()) > 0,
- ComponentMask::ExcNoComponentSelected());
+ Assert(component_mask.n_selected_components(
+ fe.n_components()) > 0,
+ ComponentMask::ExcNoComponentSelected());
// now set the value of the vertex degree of
// freedom. setting also creates the entry in the
// resize array. avoid construction of a memory
// allocating temporary if possible
if (dof_values_system.size() < fe.dofs_per_face)
- dof_values_system.resize(
- fe.dofs_per_face,
- Vector<number>(fe.n_components()));
+ dof_values_system.resize(fe.dofs_per_face,
+ Vector<number>(
+ fe.n_components()));
else
dof_values_system.resize(fe.dofs_per_face);
// get only the one component that this function has
dof_values_scalar.resize(fe.dofs_per_face);
function_map.find(boundary_component)
- ->second->value_list(
- dof_locations, dof_values_scalar, 0);
+ ->second->value_list(dof_locations,
+ dof_values_scalar,
+ 0);
// enter into list
++i)
selected_boundary_components.insert(i->first);
- DoFTools::map_dof_to_boundary_indices(
- dof, selected_boundary_components, dof_to_boundary_mapping);
+ DoFTools::map_dof_to_boundary_indices(dof,
+ selected_boundary_components,
+ dof_to_boundary_mapping);
// Done if no degrees of freedom on the boundary
if (dof.n_boundary_dofs(boundary_functions) == 0)
// set up sparsity structure
DynamicSparsityPattern dsp(dof.n_boundary_dofs(boundary_functions),
dof.n_boundary_dofs(boundary_functions));
- DoFTools::make_boundary_sparsity_pattern(
- dof, boundary_functions, dof_to_boundary_mapping, dsp);
+ DoFTools::make_boundary_sparsity_pattern(dof,
+ boundary_functions,
+ dof_to_boundary_mapping,
+ dsp);
SparsityPattern sparsity;
sparsity.copy_from(dsp);
std::vector<bool> & dofs_processed)
{
const unsigned int spacedim = dim;
- hp_fe_values.reinit(
- cell,
- cell->active_fe_index() * GeometryInfo<dim>::faces_per_cell + face);
+ hp_fe_values.reinit(cell,
+ cell->active_fe_index() *
+ GeometryInfo<dim>::faces_per_cell +
+ face);
// Initialize the required
// objects.
const FEValues<dim> &fe_values = hp_fe_values.get_present_fe_values();
((dynamic_cast<const FE_Nedelec<dim> *>(&fe) !=
nullptr) &&
(2 * fe.degree <= i) && (i < 4 * fe.degree)))
- tmp -= dof_values[i] *
- fe_values[vec].value(
- fe.face_to_cell_index(i, face), q_point);
+ tmp -=
+ dof_values[i] *
+ fe_values[vec].value(fe.face_to_cell_index(i, face),
+ q_point);
const double JxW = std::sqrt(
fe_values.JxW(q_point) /
fe.degree)))
{
const Tensor<1, dim> shape_value =
- (JxW * fe_values[vec].value(
- fe.face_to_cell_index(i, face), q_point));
+ (JxW *
+ fe_values[vec].value(fe.face_to_cell_index(i, face),
+ q_point));
for (unsigned int d = 0; d < dim; ++d)
assembling_matrix(index, dim * q_point + d) =
((dynamic_cast<const FE_Nedelec<dim> *>(&fe) !=
nullptr) &&
(i < 2 * fe.degree)))
- tmp -= dof_values[i] *
- fe_values[vec].value(
- fe.face_to_cell_index(i, face), q_point);
+ tmp -=
+ dof_values[i] *
+ fe_values[vec].value(fe.face_to_cell_index(i, face),
+ q_point);
const double JxW = std::sqrt(
fe_values.JxW(q_point) /
i)))
{
const Tensor<1, dim> shape_value =
- JxW * fe_values[vec].value(
- fe.face_to_cell_index(i, face), q_point);
+ JxW *
+ fe_values[vec].value(fe.face_to_cell_index(i, face),
+ q_point);
for (unsigned int d = 0; d < dim; ++d)
assembling_matrix(index, dim * q_point + d) =
reference_edge_quadrature, line),
face));
- hp::FEValues<dim> fe_edge_values(
- mapping_collection,
- fe_collection,
- edge_quadrature_collection,
- update_jacobians | update_JxW_values | update_quadrature_points |
- update_values);
+ hp::FEValues<dim> fe_edge_values(mapping_collection,
+ fe_collection,
+ edge_quadrature_collection,
+ update_jacobians |
+ update_JxW_values |
+ update_quadrature_points |
+ update_values);
for (; cell != dof_handler.end(); ++cell)
if (cell->at_boundary() && cell->is_locally_owned())
face));
}
- hp::FEValues<dim> fe_edge_values(
- mapping_collection,
- fe_collection,
- edge_quadrature_collection,
- update_jacobians | update_JxW_values | update_quadrature_points |
- update_values);
+ hp::FEValues<dim> fe_edge_values(mapping_collection,
+ fe_collection,
+ edge_quadrature_collection,
+ update_jacobians |
+ update_JxW_values |
+ update_quadrature_points |
+ update_values);
for (; cell != dof_handler.end(); ++cell)
if (cell->at_boundary() && cell->is_locally_owned())
const unsigned int lines_per_face =
GeometryInfo<dim>::lines_per_face;
std::vector<std::vector<unsigned int>>
- associated_edge_dof_to_face_dof(
- lines_per_face, std::vector<unsigned int>(degree + 1));
+ associated_edge_dof_to_face_dof(lines_per_face,
+ std::vector<unsigned int>(degree +
+ 1));
std::vector<unsigned int> associated_edge_dofs(lines_per_face);
for (unsigned int line = 0; line < lines_per_face; ++line)
}
// Sanity check:
associated_edge_dofs[line] = associated_edge_dof_index;
- Assert(
- associated_edge_dofs[line] == degree + 1,
- ExcMessage("Error: Unexpected number of 3D edge DoFs"));
+ Assert(associated_edge_dofs[line] == degree + 1,
+ ExcMessage(
+ "Error: Unexpected number of 3D edge DoFs"));
}
// Next find the face DoFs associated with the vector components
const unsigned int cell_j =
fe.face_to_cell_index(j_face_idx, face);
- cross_product_j = cross_product_3d(
- normal_vector,
- fe_face_values[vec].value(cell_j, q_point));
+ cross_product_j =
+ cross_product_3d(normal_vector,
+ fe_face_values[vec].value(cell_j,
+ q_point));
for (unsigned int i = 0; i < associated_face_dofs; ++i)
{
face_quadrature_collection.push_back(reference_face_quadrature);
}
- hp::FEFaceValues<dim> fe_face_values(
- mapping_collection,
- fe_collection,
- face_quadrature_collection,
- update_values | update_quadrature_points | update_normal_vectors |
- update_JxW_values);
+ hp::FEFaceValues<dim> fe_face_values(mapping_collection,
+ fe_collection,
+ face_quadrature_collection,
+ update_values |
+ update_quadrature_points |
+ update_normal_vectors |
+ update_JxW_values);
// Storage for dof values found and whether they have been processed:
std::vector<bool> dofs_processed;
}
}
- hp::FEValues<dim> fe_edge_values(
- mapping_collection,
- fe_collection,
- edge_quadrature_collection,
- update_jacobians | update_JxW_values |
- update_quadrature_points | update_values);
+ hp::FEValues<dim> fe_edge_values(mapping_collection,
+ fe_collection,
+ edge_quadrature_collection,
+ update_jacobians |
+ update_JxW_values |
+ update_quadrature_points |
+ update_values);
for (; cell != dof_handler.end(); ++cell)
{
const std::vector<Tensor<1, 2>> &normals =
fe_values.get_all_normal_vectors();
const unsigned int
- face_coordinate_direction[GeometryInfo<2>::faces_per_cell] = {
- 1, 1, 0, 0};
+ face_coordinate_direction[GeometryInfo<2>::faces_per_cell] = {1,
+ 1,
+ 0,
+ 0};
std::vector<Vector<double>> values(fe_values.n_quadrature_points,
Vector<double>(2));
Vector<double> dof_values(fe.dofs_per_face);
QProjector<dim>::project_to_face(quadrature, face));
}
- hp::FEFaceValues<dim> fe_face_values(
- mapping_collection,
- fe_collection,
- face_quadrature_collection,
- update_JxW_values | update_normal_vectors | update_quadrature_points |
- update_values);
- hp::FEValues<dim> fe_values(mapping_collection,
+ hp::FEFaceValues<dim> fe_face_values(mapping_collection,
+ fe_collection,
+ face_quadrature_collection,
+ update_JxW_values |
+ update_normal_vectors |
+ update_quadrature_points |
+ update_values);
+ hp::FEValues<dim> fe_values(mapping_collection,
fe_collection,
quadrature_collection,
update_jacobians);
// now enter the (dofs,(normal_vector,cell)) entry into
// the map
- dof_to_normals_map.insert(std::make_pair(
- vector_dofs, std::make_pair(normal_vector, cell)));
+ dof_to_normals_map.insert(
+ std::make_pair(vector_dofs,
+ std::make_pair(normal_vector, cell)));
dof_vector_to_b_values.insert(
std::make_pair(vector_dofs, b_values));
// in the same entry, store again the now averaged normal vector
// and the new count
- cell_to_normals_map[q->second.second] = std::make_pair(
- (old_normal * old_count + q->second.first) / (old_count + 1),
- old_count + 1);
+ cell_to_normals_map[q->second.second] =
+ std::make_pair((old_normal * old_count + q->second.first) /
+ (old_count + 1),
+ old_count + 1);
}
Assert(cell_to_normals_map.size() >= 1, ExcInternalError());
dof_vector_to_b_values[dof_indices];
for (unsigned int i = 0; i < dim; ++i)
normal_value += b_values[i] * normal[i];
- internal::add_constraint(
- dof_indices, normal, constraints, normal_value);
+ internal::add_constraint(dof_indices,
+ normal,
+ constraints,
+ normal_value);
break;
}
same_dof_range[0]->first;
const Vector<double> b_values =
dof_vector_to_b_values[dof_indices];
- internal::add_tangentiality_constraints(
- dof_indices, average_tangent, constraints, b_values);
+ internal::add_tangentiality_constraints(dof_indices,
+ average_tangent,
+ constraints,
+ b_values);
}
}
}
const unsigned int component =
fe.face_system_to_component_index(i).first -
first_vector_component;
- n_scalar_indices = std::max(
- n_scalar_indices,
- fe.face_system_to_component_index(i).second + 1);
+ n_scalar_indices =
+ std::max(n_scalar_indices,
+ fe.face_system_to_component_index(i).second +
+ 1);
cell_vector_dofs[fe.face_system_to_component_index(i)
.second][component] = face_dofs[i];
{
constraints.add_line(new_index);
if (std::abs(normal[d]) > 1e-13)
- constraints.add_entry(
- new_index, (*it)[constrained_index], -normal[d]);
+ constraints.add_entry(new_index,
+ (*it)[constrained_index],
+ -normal[d]);
constraints.set_inhomogeneity(new_index, boundary_value[d]);
}
}
const dealii::hp::MappingCollection<dim, spacedim> &mapping,
const dealii::hp::FECollection<dim, spacedim> & fe,
const dealii::hp::QCollection<dim> & q,
- const UpdateFlags update_flags) :
- x_fe_values(mapping, fe, q, update_flags)
+ const UpdateFlags update_flags)
+ : x_fe_values(mapping, fe, q, update_flags)
{}
template <int dim, int spacedim, typename Number>
IDScratchData<dim, spacedim, Number>::IDScratchData(
- const IDScratchData &data) :
- x_fe_values(data.x_fe_values.get_mapping_collection(),
- data.x_fe_values.get_fe_collection(),
- data.x_fe_values.get_quadrature_collection(),
- data.x_fe_values.get_update_flags())
+ const IDScratchData &data)
+ : x_fe_values(data.x_fe_values.get_mapping_collection(),
+ data.x_fe_values.get_fe_collection(),
+ data.x_fe_values.get_quadrature_collection(),
+ data.x_fe_values.get_update_flags())
{}
template <int dim, int spacedim, typename Number>
const dealii::hp::FECollection<dim, spacedim> &fe_collection =
dof.get_fe_collection();
- IDScratchData<dim, spacedim, Number> data(
- mapping, fe_collection, q, update_flags);
+ IDScratchData<dim, spacedim, Number> data(mapping,
+ fe_collection,
+ q,
+ update_flags);
// loop over all cells
for (typename DoFHandlerType::active_cell_iterator cell =
const Function<spacedim> * weight,
const double exponent)
{
- internal ::do_integrate_difference(
- hp::MappingCollection<dim, spacedim>(mapping),
- dof,
- fe_function,
- exact_solution,
- difference,
- hp::QCollection<dim>(q),
- norm,
- weight,
- exponent);
+ internal ::do_integrate_difference(hp::MappingCollection<dim, spacedim>(
+ mapping),
+ dof,
+ fe_function,
+ exact_solution,
+ difference,
+ hp::QCollection<dim>(q),
+ norm,
+ weight,
+ exponent);
}
const Function<spacedim> * weight,
const double exponent)
{
- internal ::do_integrate_difference(
- hp::MappingCollection<dim, spacedim>(mapping),
- dof,
- fe_function,
- exact_solution,
- difference,
- q,
- norm,
- weight,
- exponent);
+ internal ::do_integrate_difference(hp::MappingCollection<dim, spacedim>(
+ mapping),
+ dof,
+ fe_function,
+ exact_solution,
+ difference,
+ q,
+ norm,
+ weight,
+ exponent);
}
case W1infty_norm:
{
- AssertThrow(
- false,
- ExcMessage("compute_global_error() is impossible for "
- "the W1infty_norm. See the documentation for "
- "NormType::W1infty_norm for more information."));
+ AssertThrow(false,
+ ExcMessage(
+ "compute_global_error() is impossible for "
+ "the W1infty_norm. See the documentation for "
+ "NormType::W1infty_norm for more information."));
return std::numeric_limits<double>::infinity();
}
const VectorType & fe_function,
const Point<spacedim> & point)
{
- return point_value(
- StaticMappingQ1<dim, spacedim>::mapping, dof, fe_function, point);
+ return point_value(StaticMappingQ1<dim, spacedim>::mapping,
+ dof,
+ fe_function,
+ point);
}
const Quadrature<dim> quadrature(
GeometryInfo<dim>::project_to_unit_cell(cell_point.second));
- hp::FEValues<dim, spacedim> hp_fe_values(
- mapping, fe, hp::QCollection<dim>(quadrature), update_values);
+ hp::FEValues<dim, spacedim> hp_fe_values(mapping,
+ fe,
+ hp::QCollection<dim>(quadrature),
+ update_values);
hp_fe_values.reinit(cell_point.first);
const FEValues<dim, spacedim> &fe_values =
hp_fe_values.get_present_fe_values();
const VectorType & fe_function,
const Point<spacedim> & point)
{
- return point_gradient(
- StaticMappingQ1<dim, spacedim>::mapping, dof, fe_function, point);
+ return point_gradient(StaticMappingQ1<dim, spacedim>::mapping,
+ dof,
+ fe_function,
+ point);
}
const Quadrature<dim> quadrature(
GeometryInfo<dim>::project_to_unit_cell(cell_point.second));
- hp::FEValues<dim, spacedim> hp_fe_values(
- mapping, fe, hp::QCollection<dim>(quadrature), update_gradients);
+ hp::FEValues<dim, spacedim> hp_fe_values(mapping,
+ fe,
+ hp::QCollection<dim>(quadrature),
+ update_gradients);
hp_fe_values.reinit(cell_point.first);
const FEValues<dim, spacedim> &fe_values =
hp_fe_values.get_present_fe_values();
template <typename VectorType>
VectorAdaptor<VectorType>::VectorAdaptor(
- const Teuchos::RCP<VectorType> &vector_ptr) :
- vector_ptr(vector_ptr)
+ const Teuchos::RCP<VectorType> &vector_ptr)
+ : vector_ptr(vector_ptr)
{}
else
{
Assert((component_n < Tensor<2, 2>::n_independent_components),
- ExcIndexRange(
- component_n, 0, Tensor<2, 2>::n_independent_components));
+ ExcIndexRange(component_n,
+ 0,
+ Tensor<2, 2>::n_independent_components));
}
- static const unsigned int indices[4][2] = {
- {0, 0}, {1, 1}, {0, 1}, {1, 0}};
+ static const unsigned int indices[4][2] = {{0, 0},
+ {1, 1},
+ {0, 1},
+ {1, 0}};
return std::make_pair(indices[component_n][0],
indices[component_n][1]);
}
else
{
Assert((component_n < Tensor<2, 3>::n_independent_components),
- ExcIndexRange(
- component_n, 0, Tensor<2, 3>::n_independent_components));
+ ExcIndexRange(component_n,
+ 0,
+ Tensor<2, 3>::n_independent_components));
}
static const unsigned int indices[9][2] = {{0, 0},
{
Assert(mtrx.m() == dim, ExcDimensionMismatch(mtrx.m(), dim));
Assert(mtrx.n() == 1, ExcDimensionMismatch(mtrx.n(), 1));
- Assert(
- mtrx.n_elements() == v.n_independent_components,
- ExcDimensionMismatch(mtrx.n_elements(), v.n_independent_components));
+ Assert(mtrx.n_elements() == v.n_independent_components,
+ ExcDimensionMismatch(mtrx.n_elements(),
+ v.n_independent_components));
const unsigned int n_rows = mtrx.m();
const unsigned int n_cols = mtrx.n();
{
Assert(mtrx.m() == dim, ExcDimensionMismatch(mtrx.m(), dim));
Assert(mtrx.n() == dim, ExcDimensionMismatch(mtrx.n(), dim));
- Assert(
- mtrx.n_elements() == t.n_independent_components,
- ExcDimensionMismatch(mtrx.n_elements(), t.n_independent_components));
+ Assert(mtrx.n_elements() == t.n_independent_components,
+ ExcDimensionMismatch(mtrx.n_elements(),
+ t.n_independent_components));
const unsigned int n_rows = mtrx.m();
const unsigned int n_cols = mtrx.n();
void
to_tensor(const FullMatrix<Number> &mtrx, Tensor<3, dim, Number> &t)
{
- Assert(
- (mtrx.m() == Tensor<1, dim, Number>::n_independent_components) ||
- (mtrx.m() == Tensor<2, dim, Number>::n_independent_components) ||
- (mtrx.m() ==
- SymmetricTensor<2, dim, Number>::n_independent_components),
- ExcNotationExcFullMatrixToTensorColSize3(
- mtrx.m(),
- Tensor<1, dim, Number>::n_independent_components,
- Tensor<2, dim, Number>::n_independent_components,
- SymmetricTensor<2, dim, Number>::n_independent_components));
- Assert(
- (mtrx.n() == Tensor<1, dim, Number>::n_independent_components) ||
- (mtrx.n() == Tensor<2, dim, Number>::n_independent_components) ||
- (mtrx.n() ==
- SymmetricTensor<2, dim, Number>::n_independent_components),
- ExcNotationExcFullMatrixToTensorColSize3(
- mtrx.n(),
- Tensor<1, dim, Number>::n_independent_components,
- Tensor<2, dim, Number>::n_independent_components,
- SymmetricTensor<2, dim, Number>::n_independent_components));
+ Assert((mtrx.m() == Tensor<1, dim, Number>::n_independent_components) ||
+ (mtrx.m() ==
+ Tensor<2, dim, Number>::n_independent_components) ||
+ (mtrx.m() ==
+ SymmetricTensor<2, dim, Number>::n_independent_components),
+ ExcNotationExcFullMatrixToTensorColSize3(
+ mtrx.m(),
+ Tensor<1, dim, Number>::n_independent_components,
+ Tensor<2, dim, Number>::n_independent_components,
+ SymmetricTensor<2, dim, Number>::n_independent_components));
+ Assert((mtrx.n() == Tensor<1, dim, Number>::n_independent_components) ||
+ (mtrx.n() ==
+ Tensor<2, dim, Number>::n_independent_components) ||
+ (mtrx.n() ==
+ SymmetricTensor<2, dim, Number>::n_independent_components),
+ ExcNotationExcFullMatrixToTensorColSize3(
+ mtrx.n(),
+ Tensor<1, dim, Number>::n_independent_components,
+ Tensor<2, dim, Number>::n_independent_components,
+ SymmetricTensor<2, dim, Number>::n_independent_components));
const unsigned int n_rows = mtrx.m();
const unsigned int n_cols = mtrx.n();
Assert((mtrx.n() == Tensor<2, dim, Number>::n_independent_components),
ExcDimensionMismatch(
mtrx.n(), Tensor<2, dim, Number>::n_independent_components));
- Assert(
- mtrx.n_elements() == t.n_independent_components,
- ExcDimensionMismatch(mtrx.n_elements(), t.n_independent_components));
+ Assert(mtrx.n_elements() == t.n_independent_components,
+ ExcDimensionMismatch(mtrx.n_elements(),
+ t.n_independent_components));
const unsigned int n_rows = mtrx.m();
const unsigned int n_cols = mtrx.n();
ExcDimensionMismatch(
mtrx.n(),
SymmetricTensor<2, dim, Number>::n_independent_components));
- Assert(
- mtrx.n_elements() == st.n_independent_components,
- ExcDimensionMismatch(mtrx.n_elements(), st.n_independent_components));
+ Assert(mtrx.n_elements() == st.n_independent_components,
+ ExcDimensionMismatch(mtrx.n_elements(),
+ st.n_independent_components));
const unsigned int n_rows = mtrx.m();
const unsigned int n_cols = mtrx.n();
const bool implicit_function_is_time_independent = false,
// Error parameters
const double &absolute_tolerance = 1e-6,
- const double &relative_tolerance = 1e-5) :
- initial_time(initial_time),
- final_time(final_time),
- initial_step_size(initial_step_size),
- minimum_step_size(minimum_step_size),
- absolute_tolerance(absolute_tolerance),
- relative_tolerance(relative_tolerance),
- maximum_order(maximum_order),
- output_period(output_period),
- maximum_non_linear_iterations(maximum_non_linear_iterations),
- implicit_function_is_linear(implicit_function_is_linear),
- implicit_function_is_time_independent(
- implicit_function_is_time_independent)
+ const double &relative_tolerance = 1e-5)
+ : initial_time(initial_time)
+ , final_time(final_time)
+ , initial_step_size(initial_step_size)
+ , minimum_step_size(minimum_step_size)
+ , absolute_tolerance(absolute_tolerance)
+ , relative_tolerance(relative_tolerance)
+ , maximum_order(maximum_order)
+ , output_period(output_period)
+ , maximum_non_linear_iterations(maximum_non_linear_iterations)
+ , implicit_function_is_linear(implicit_function_is_linear)
+ , implicit_function_is_time_independent(
+ implicit_function_is_time_independent)
{}
/**
const double &relative_tolerance = 1e-5,
const bool & ignore_algebraic_terms_for_errors = true,
// Initial conditions parameters
- const InitialConditionCorrection &ic_type = use_y_diff,
- const InitialConditionCorrection &reset_type = use_y_diff,
- const unsigned int &maximum_non_linear_iterations_ic = 5) :
- initial_time(initial_time),
- final_time(final_time),
- initial_step_size(initial_step_size),
- minimum_step_size(minimum_step_size),
- absolute_tolerance(absolute_tolerance),
- relative_tolerance(relative_tolerance),
- maximum_order(maximum_order),
- output_period(output_period),
- ignore_algebraic_terms_for_errors(ignore_algebraic_terms_for_errors),
- ic_type(ic_type),
- reset_type(reset_type),
- maximum_non_linear_iterations_ic(maximum_non_linear_iterations_ic),
- maximum_non_linear_iterations(maximum_non_linear_iterations)
+ const InitialConditionCorrection &ic_type = use_y_diff,
+ const InitialConditionCorrection &reset_type = use_y_diff,
+ const unsigned int & maximum_non_linear_iterations_ic = 5)
+ : initial_time(initial_time)
+ , final_time(final_time)
+ , initial_step_size(initial_step_size)
+ , minimum_step_size(minimum_step_size)
+ , absolute_tolerance(absolute_tolerance)
+ , relative_tolerance(relative_tolerance)
+ , maximum_order(maximum_order)
+ , output_period(output_period)
+ , ignore_algebraic_terms_for_errors(ignore_algebraic_terms_for_errors)
+ , ic_type(ic_type)
+ , reset_type(reset_type)
+ , maximum_non_linear_iterations_ic(maximum_non_linear_iterations_ic)
+ , maximum_non_linear_iterations(maximum_non_linear_iterations)
{}
/**
const double & maximum_newton_step = 0.0,
const double & dq_relative_error = 0.0,
const unsigned int & maximum_beta_failures = 0,
- const unsigned int & anderson_subspace_size = 0) :
- strategy(strategy),
- maximum_non_linear_iterations(maximum_non_linear_iterations),
- function_tolerance(function_tolerance),
- step_tolerance(step_tolerance),
- no_init_setup(no_init_setup),
- maximum_setup_calls(maximum_setup_calls),
- maximum_newton_step(maximum_newton_step),
- dq_relative_error(dq_relative_error),
- maximum_beta_failures(maximum_beta_failures),
- anderson_subspace_size(anderson_subspace_size)
+ const unsigned int & anderson_subspace_size = 0)
+ : strategy(strategy)
+ , maximum_non_linear_iterations(maximum_non_linear_iterations)
+ , function_tolerance(function_tolerance)
+ , step_tolerance(step_tolerance)
+ , no_init_setup(no_init_setup)
+ , maximum_setup_calls(maximum_setup_calls)
+ , maximum_newton_step(maximum_newton_step)
+ , dq_relative_error(dq_relative_error)
+ , maximum_beta_failures(maximum_beta_failures)
+ , anderson_subspace_size(anderson_subspace_size)
{}
/**
add_parameters(ParameterHandler &prm)
{
static std::string strategy_str("newton");
- prm.add_parameter(
- "Solution strategy",
- strategy_str,
- "Choose among newton|linesearch|fixed_point|picard",
- Patterns::Selection("newton|linesearch|fixed_point|picard"));
+ prm.add_parameter("Solution strategy",
+ strategy_str,
+ "Choose among newton|linesearch|fixed_point|picard",
+ Patterns::Selection(
+ "newton|linesearch|fixed_point|picard"));
prm.add_action("Solution strategy", [&](const std::string &value) {
if (value == "newton")
strategy = newton;
double tolerance,
double start_step,
double print_step,
- double max_step) :
- start_val(start),
- final_val(final),
- tolerance_val(tolerance),
- strategy_val(uniform),
- start_step_val(start_step),
- max_step_val(max_step),
- min_step_val(0),
- current_step_val(start_step),
- step_val(start_step),
- print_step(print_step),
- next_print_val(print_step > 0. ? start_val + print_step : start_val - 1.)
+ double max_step)
+ : start_val(start)
+ , final_val(final)
+ , tolerance_val(tolerance)
+ , strategy_val(uniform)
+ , start_step_val(start_step)
+ , max_step_val(max_step)
+ , min_step_val(0)
+ , current_step_val(start_step)
+ , step_val(start_step)
+ , print_step(print_step)
+ , next_print_val(print_step > 0. ? start_val + print_step : start_val - 1.)
{
now_val = start_val;
strcpy(format, "T.%06.3f");
param.declare_entry("Max step", "1.", Patterns::Double());
param.declare_entry("Tolerance", "1.e-2", Patterns::Double());
param.declare_entry("Print step", "-1.", Patterns::Double());
- param.declare_entry(
- "Strategy", "uniform", Patterns::Selection("uniform|doubling"));
+ param.declare_entry("Strategy",
+ "uniform",
+ Patterns::Selection("uniform|doubling"));
}
AutoDerivativeFunction<dim>::AutoDerivativeFunction(
const double hh,
const unsigned int n_components,
- const double initial_time) :
- Function<dim>(n_components, initial_time),
- h(1),
- ht(dim),
- formula(Euler)
+ const double initial_time)
+ : Function<dim>(n_components, initial_time)
+ , h(1)
+ , ht(dim)
+ , formula(Euler)
{
set_h(hh);
set_formula();
{
for (unsigned int i = 0; i < spacedim; ++i)
{
- this->boundary_points.first[i] = std::min(
- this->boundary_points.first[i], other_bbox.boundary_points.first[i]);
- this->boundary_points.second[i] = std::max(
- this->boundary_points.second[i], other_bbox.boundary_points.second[i]);
+ this->boundary_points.first[i] =
+ std::min(this->boundary_points.first[i],
+ other_bbox.boundary_points.first[i]);
+ this->boundary_points.second[i] =
+ std::max(this->boundary_points.second[i],
+ other_bbox.boundary_points.second[i]);
}
}
DEAL_II_NAMESPACE_OPEN
-ConditionalOStream::ConditionalOStream(std::ostream &stream,
- const bool active) :
- output_stream(stream),
- active_flag(active)
+ConditionalOStream::ConditionalOStream(std::ostream &stream, const bool active)
+ : output_stream(stream)
+ , active_flag(active)
{}
}
else
{
- add_value(
- rate_key,
- dim * std::log(std::fabs(values[i - 1] / values[i])) /
- std::log(std::fabs(ref_values[i] / ref_values[i - 1])));
+ add_value(rate_key,
+ dim * std::log(std::fabs(values[i - 1] / values[i])) /
+ std::log(
+ std::fabs(ref_values[i] / ref_values[i - 1])));
}
}
break;
col_iter != columns.end();
++col_iter)
if (!col_iter->second.flag)
- evaluate_convergence_rates(
- col_iter->first, reference_column_key, rate_mode);
+ evaluate_convergence_rates(col_iter->first,
+ reference_column_key,
+ rate_mode);
}
(n_data_sets + spacedim) :
n_data_sets,
patch->data.n_rows()));
- Assert(
- (n_data_sets == 0) ||
- (patch->data.n_cols() ==
- Utilities::fixed_power<dim>(n_subdivisions + 1)),
- ExcInvalidDatasetSize(patch->data.n_cols(), n_subdivisions + 1));
+ Assert((n_data_sets == 0) ||
+ (patch->data.n_cols() ==
+ Utilities::fixed_power<dim>(n_subdivisions + 1)),
+ ExcInvalidDatasetSize(patch->data.n_cols(),
+ n_subdivisions + 1));
for (unsigned int i = 0; i < patch->data.n_cols(); ++i, ++next_value)
for (unsigned int data_set = 0; data_set < n_data_sets; ++data_set)
- DataOutFilter::DataOutFilter() :
- flags(false, true),
- node_dim(numbers::invalid_unsigned_int),
- vertices_per_cell(numbers::invalid_unsigned_int)
+ DataOutFilter::DataOutFilter()
+ : flags(false, true)
+ , node_dim(numbers::invalid_unsigned_int)
+ , vertices_per_cell(numbers::invalid_unsigned_int)
{}
- DataOutFilter::DataOutFilter(const DataOutBase::DataOutFilterFlags &flags) :
- flags(flags),
- node_dim(numbers::invalid_unsigned_int),
- vertices_per_cell(numbers::invalid_unsigned_int)
+ DataOutFilter::DataOutFilter(const DataOutBase::DataOutFilterFlags &flags)
+ : flags(flags)
+ , node_dim(numbers::invalid_unsigned_int)
+ , vertices_per_cell(numbers::invalid_unsigned_int)
{}
/*
* Constructor. Stores a reference to the output stream for immediate use.
*/
- StreamBase(std::ostream &stream, const FlagsType &flags) :
- selected_component(numbers::invalid_unsigned_int),
- stream(stream),
- flags(flags)
+ StreamBase(std::ostream &stream, const FlagsType &flags)
+ : selected_component(numbers::invalid_unsigned_int)
+ , stream(stream)
+ , flags(flags)
{}
/**
//----------------------------------------------------------------------//
- DXStream::DXStream(std::ostream &out, const DataOutBase::DXFlags &f) :
- StreamBase<DataOutBase::DXFlags>(out, f)
+ DXStream::DXStream(std::ostream &out, const DataOutBase::DXFlags &f)
+ : StreamBase<DataOutBase::DXFlags>(out, f)
{}
//----------------------------------------------------------------------//
- GmvStream::GmvStream(std::ostream &out, const DataOutBase::GmvFlags &f) :
- StreamBase<DataOutBase::GmvFlags>(out, f)
+ GmvStream::GmvStream(std::ostream &out, const DataOutBase::GmvFlags &f)
+ : StreamBase<DataOutBase::GmvFlags>(out, f)
{}
TecplotStream::TecplotStream(std::ostream & out,
- const DataOutBase::TecplotFlags &f) :
- StreamBase<DataOutBase::TecplotFlags>(out, f)
+ const DataOutBase::TecplotFlags &f)
+ : StreamBase<DataOutBase::TecplotFlags>(out, f)
{}
- UcdStream::UcdStream(std::ostream &out, const DataOutBase::UcdFlags &f) :
- StreamBase<DataOutBase::UcdFlags>(out, f)
+ UcdStream::UcdStream(std::ostream &out, const DataOutBase::UcdFlags &f)
+ : StreamBase<DataOutBase::UcdFlags>(out, f)
{}
//----------------------------------------------------------------------//
- VtkStream::VtkStream(std::ostream &out, const DataOutBase::VtkFlags &f) :
- StreamBase<DataOutBase::VtkFlags>(out, f)
+ VtkStream::VtkStream(std::ostream &out, const DataOutBase::VtkFlags &f)
+ : StreamBase<DataOutBase::VtkFlags>(out, f)
{}
- VtuStream::VtuStream(std::ostream &out, const DataOutBase::VtkFlags &f) :
- StreamBase<DataOutBase::VtkFlags>(out, f)
+ VtuStream::VtuStream(std::ostream &out, const DataOutBase::VtkFlags &f)
+ : StreamBase<DataOutBase::VtkFlags>(out, f)
{}
template <int dim, int spacedim>
- Patch<dim, spacedim>::Patch() :
- patch_index(no_neighbor),
- n_subdivisions(1),
- points_are_available(false)
+ Patch<dim, spacedim>::Patch()
+ : patch_index(no_neighbor)
+ , n_subdivisions(1)
+ , points_are_available(false)
// all the other data has a constructor of its own, except for the
// "neighbors" field, which we set to invalid values.
{
unsigned int Patch<0, spacedim>::n_subdivisions = 1;
template <int spacedim>
- Patch<0, spacedim>::Patch() :
- patch_index(no_neighbor),
- points_are_available(false)
+ Patch<0, spacedim>::Patch()
+ : patch_index(no_neighbor)
+ , points_are_available(false)
{
Assert(spacedim <= 3, ExcNotImplemented());
}
- UcdFlags::UcdFlags(const bool write_preamble) : write_preamble(write_preamble)
+ UcdFlags::UcdFlags(const bool write_preamble)
+ : write_preamble(write_preamble)
{}
- GnuplotFlags::GnuplotFlags(const std::vector<std::string> &labels) :
- space_dimension_labels(labels)
+ GnuplotFlags::GnuplotFlags(const std::vector<std::string> &labels)
+ : space_dimension_labels(labels)
{}
PovrayFlags::PovrayFlags(const bool smooth,
const bool bicubic_patch,
- const bool external_data) :
- smooth(smooth),
- bicubic_patch(bicubic_patch),
- external_data(external_data)
+ const bool external_data)
+ : smooth(smooth)
+ , bicubic_patch(bicubic_patch)
+ , external_data(external_data)
{}
DataOutFilterFlags::DataOutFilterFlags(const bool filter_duplicate_vertices,
- const bool xdmf_hdf5_output) :
- filter_duplicate_vertices(filter_duplicate_vertices),
- xdmf_hdf5_output(xdmf_hdf5_output)
+ const bool xdmf_hdf5_output)
+ : filter_duplicate_vertices(filter_duplicate_vertices)
+ , xdmf_hdf5_output(xdmf_hdf5_output)
{}
DXFlags::DXFlags(const bool write_neighbors,
const bool int_binary,
const bool coordinates_binary,
- const bool data_binary) :
- write_neighbors(write_neighbors),
- int_binary(int_binary),
- coordinates_binary(coordinates_binary),
- data_binary(data_binary),
- data_double(false)
+ const bool data_binary)
+ : write_neighbors(write_neighbors)
+ , int_binary(int_binary)
+ , coordinates_binary(coordinates_binary)
+ , data_binary(data_binary)
+ , data_double(false)
{}
const int polar_angle,
const unsigned int line_thickness,
const bool margin,
- const bool draw_colorbar) :
- height(4000),
- width(0),
- height_vector(height_vector),
- azimuth_angle(azimuth_angle),
- polar_angle(polar_angle),
- line_thickness(line_thickness),
- margin(margin),
- draw_colorbar(draw_colorbar)
+ const bool draw_colorbar)
+ : height(4000)
+ , width(0)
+ , height_vector(height_vector)
+ , azimuth_angle(azimuth_angle)
+ , polar_angle(polar_angle)
+ , line_thickness(line_thickness)
+ , margin(margin)
+ , draw_colorbar(draw_colorbar)
{}
const bool draw_mesh,
const bool draw_cells,
const bool shade_cells,
- const ColorFunction color_function) :
- height_vector(height_vector),
- color_vector(color_vector),
- size_type(size_type),
- size(size),
- line_width(line_width),
- azimut_angle(azimut_angle),
- turn_angle(turn_angle),
- z_scaling(z_scaling),
- draw_mesh(draw_mesh),
- draw_cells(draw_cells),
- shade_cells(shade_cells),
- color_function(color_function)
+ const ColorFunction color_function)
+ : height_vector(height_vector)
+ , color_vector(color_vector)
+ , size_type(size_type)
+ , size(size)
+ , line_width(line_width)
+ , azimut_angle(azimut_angle)
+ , turn_angle(turn_angle)
+ , z_scaling(z_scaling)
+ , draw_mesh(draw_mesh)
+ , draw_cells(draw_cells)
+ , shade_cells(shade_cells)
+ , color_function(color_function)
{}
"true",
Patterns::Bool(),
"Whether the interior of cells shall be shaded");
- prm.declare_entry(
- "Color function",
- "default",
- Patterns::Selection("default|grey scale|reverse grey scale"),
- "Name of a color function used to colorize mesh lines "
- "and/or cell interiors");
+ prm.declare_entry("Color function",
+ "default",
+ Patterns::Selection(
+ "default|grey scale|reverse grey scale"),
+ "Name of a color function used to colorize mesh lines "
+ "and/or cell interiors");
}
TecplotFlags::TecplotFlags(const char * tecplot_binary_file_name,
const char * zone_name,
- const double solution_time) :
- tecplot_binary_file_name(tecplot_binary_file_name),
- zone_name(zone_name),
- solution_time(solution_time)
+ const double solution_time)
+ : tecplot_binary_file_name(tecplot_binary_file_name)
+ , zone_name(zone_name)
+ , solution_time(solution_time)
{}
VtkFlags::VtkFlags(const double time,
const unsigned int cycle,
const bool print_date_and_time,
- const VtkFlags::ZlibCompressionLevel compression_level) :
- time(time),
- cycle(cycle),
- print_date_and_time(print_date_and_time),
- compression_level(compression_level)
+ const VtkFlags::ZlibCompressionLevel compression_level)
+ : time(time)
+ , cycle(cycle)
+ , print_date_and_time(print_date_and_time)
+ , compression_level(compression_level)
{}
case 2:
Assert((flags.height_vector < patch->data.n_rows()) ||
patch->data.n_rows() == 0,
- ExcIndexRange(
- flags.height_vector, 0, patch->data.n_rows()));
+ ExcIndexRange(flags.height_vector,
+ 0,
+ patch->data.n_rows()));
heights[0] =
patch->data.n_rows() != 0 ?
patch->data(flags.height_vector, i1 * d1 + i2 * d2) *
if (flags.draw_cells && flags.shade_cells)
{
- Assert(
- (flags.color_vector < patch->data.n_rows()) ||
- patch->data.n_rows() == 0,
- ExcIndexRange(flags.color_vector, 0, patch->data.n_rows()));
+ Assert((flags.color_vector < patch->data.n_rows()) ||
+ patch->data.n_rows() == 0,
+ ExcIndexRange(flags.color_vector,
+ 0,
+ patch->data.n_rows()));
const double color_values[4] = {
patch->data.n_rows() != 0 ?
patch->data(flags.color_vector, i1 * d1 + i2 * d2) :
{
if (flags.shade_cells)
{
- const EpsFlags::RgbValues rgb_values = (*flags.color_function)(
- cell->color_value, min_color_value, max_color_value);
+ const EpsFlags::RgbValues rgb_values =
+ (*flags.color_function)(cell->color_value,
+ min_color_value,
+ max_color_value);
// write out color
if (rgb_values.is_grey())
inline TecplotMacros::TecplotMacros(const unsigned int n_nodes,
const unsigned int n_vars,
const unsigned int n_cells,
- const unsigned int n_vert) :
- n_nodes(n_nodes),
- n_vars(n_vars),
- n_cells(n_cells),
- n_vert(n_vert)
+ const unsigned int n_vert)
+ : n_nodes(n_nodes)
+ , n_vars(n_vars)
+ , n_cells(n_cells)
+ , n_vert(n_vert)
{
nodalData.resize(n_nodes * n_vars);
connData.resize(n_cells * n_vert);
for (unsigned int n_th_vector = 0; n_th_vector < vector_data_ranges.size();
++n_th_vector)
{
- AssertThrow(
- std::get<1>(vector_data_ranges[n_th_vector]) >=
- std::get<0>(vector_data_ranges[n_th_vector]),
- ExcLowerRange(std::get<1>(vector_data_ranges[n_th_vector]),
- std::get<0>(vector_data_ranges[n_th_vector])));
+ AssertThrow(std::get<1>(vector_data_ranges[n_th_vector]) >=
+ std::get<0>(vector_data_ranges[n_th_vector]),
+ ExcLowerRange(std::get<1>(vector_data_ranges[n_th_vector]),
+ std::get<0>(
+ vector_data_ranges[n_th_vector])));
AssertThrow(std::get<1>(vector_data_ranges[n_th_vector]) < n_data_sets,
ExcIndexRange(std::get<1>(vector_data_ranges[n_th_vector]),
0,
n_data_sets));
- AssertThrow(
- std::get<1>(vector_data_ranges[n_th_vector]) + 1 -
- std::get<0>(vector_data_ranges[n_th_vector]) <=
- 3,
- ExcMessage("Can't declare a vector with more than 3 components "
- "in VTK"));
+ AssertThrow(std::get<1>(vector_data_ranges[n_th_vector]) + 1 -
+ std::get<0>(vector_data_ranges[n_th_vector]) <=
+ 3,
+ ExcMessage(
+ "Can't declare a vector with more than 3 components "
+ "in VTK"));
// mark these components as already written:
for (unsigned int i = std::get<0>(vector_data_ranges[n_th_vector]);
for (unsigned int n_th_vector = 0; n_th_vector < vector_data_ranges.size();
++n_th_vector)
{
- AssertThrow(
- std::get<1>(vector_data_ranges[n_th_vector]) >=
- std::get<0>(vector_data_ranges[n_th_vector]),
- ExcLowerRange(std::get<1>(vector_data_ranges[n_th_vector]),
- std::get<0>(vector_data_ranges[n_th_vector])));
+ AssertThrow(std::get<1>(vector_data_ranges[n_th_vector]) >=
+ std::get<0>(vector_data_ranges[n_th_vector]),
+ ExcLowerRange(std::get<1>(vector_data_ranges[n_th_vector]),
+ std::get<0>(
+ vector_data_ranges[n_th_vector])));
AssertThrow(std::get<1>(vector_data_ranges[n_th_vector]) < n_data_sets,
ExcIndexRange(std::get<1>(vector_data_ranges[n_th_vector]),
0,
n_data_sets));
- AssertThrow(
- std::get<1>(vector_data_ranges[n_th_vector]) + 1 -
- std::get<0>(vector_data_ranges[n_th_vector]) <=
- 3,
- ExcMessage("Can't declare a vector with more than 3 components "
- "in VTK"));
+ AssertThrow(std::get<1>(vector_data_ranges[n_th_vector]) + 1 -
+ std::get<0>(vector_data_ranges[n_th_vector]) <=
+ 3,
+ ExcMessage(
+ "Can't declare a vector with more than 3 components "
+ "in VTK"));
// mark these components as already
// written:
std::get<0>(vector_data_ranges[n_th_vector]))
{
case 0:
- data.push_back(data_vectors(
- std::get<0>(vector_data_ranges[n_th_vector]), n));
+ data.push_back(
+ data_vectors(std::get<0>(vector_data_ranges[n_th_vector]),
+ n));
data.push_back(0);
data.push_back(0);
break;
case 1:
- data.push_back(data_vectors(
- std::get<0>(vector_data_ranges[n_th_vector]), n));
+ data.push_back(
+ data_vectors(std::get<0>(vector_data_ranges[n_th_vector]),
+ n));
data.push_back(data_vectors(
std::get<0>(vector_data_ranges[n_th_vector]) + 1, n));
data.push_back(0);
break;
case 2:
- data.push_back(data_vectors(
- std::get<0>(vector_data_ranges[n_th_vector]), n));
+ data.push_back(
+ data_vectors(std::get<0>(vector_data_ranges[n_th_vector]),
+ n));
data.push_back(data_vectors(
std::get<0>(vector_data_ranges[n_th_vector]) + 1, n));
data.push_back(data_vectors(
for (unsigned int n_th_vector = 0; n_th_vector < vector_data_ranges.size();
++n_th_vector)
{
- AssertThrow(
- std::get<1>(vector_data_ranges[n_th_vector]) >=
- std::get<0>(vector_data_ranges[n_th_vector]),
- ExcLowerRange(std::get<1>(vector_data_ranges[n_th_vector]),
- std::get<0>(vector_data_ranges[n_th_vector])));
+ AssertThrow(std::get<1>(vector_data_ranges[n_th_vector]) >=
+ std::get<0>(vector_data_ranges[n_th_vector]),
+ ExcLowerRange(std::get<1>(vector_data_ranges[n_th_vector]),
+ std::get<0>(
+ vector_data_ranges[n_th_vector])));
AssertThrow(std::get<1>(vector_data_ranges[n_th_vector]) < n_data_sets,
ExcIndexRange(std::get<1>(vector_data_ranges[n_th_vector]),
0,
n_data_sets));
- AssertThrow(
- std::get<1>(vector_data_ranges[n_th_vector]) + 1 -
- std::get<0>(vector_data_ranges[n_th_vector]) <=
- 3,
- ExcMessage("Can't declare a vector with more than 3 components "
- "in VTK"));
+ AssertThrow(std::get<1>(vector_data_ranges[n_th_vector]) + 1 -
+ std::get<0>(vector_data_ranges[n_th_vector]) <=
+ 3,
+ ExcMessage(
+ "Can't declare a vector with more than 3 components "
+ "in VTK"));
// mark these components as already
// written:
y_max = std::max(y_max, (double)projected_points[2][1]);
y_max = std::max(y_max, (double)projected_points[3][1]);
- Assert(
- (flags.height_vector < patch->data.n_rows()) ||
- patch->data.n_rows() == 0,
- ExcIndexRange(flags.height_vector, 0, patch->data.n_rows()));
+ Assert((flags.height_vector < patch->data.n_rows()) ||
+ patch->data.n_rows() == 0,
+ ExcIndexRange(flags.height_vector,
+ 0,
+ patch->data.n_rows()));
- z_min = std::min(
- z_min,
- (double)patch->data(flags.height_vector, i1 * d1 + i2 * d2));
+ z_min = std::min(z_min,
+ (double)patch->data(flags.height_vector,
+ i1 * d1 + i2 * d2));
z_min = std::min(z_min,
(double)patch->data(flags.height_vector,
(i1 + 1) * d1 + i2 * d2));
(double)patch->data(flags.height_vector,
(i1 + 1) * d1 + (i2 + 1) * d2));
- z_max = std::max(
- z_max,
- (double)patch->data(flags.height_vector, i1 * d1 + i2 * d2));
+ z_max = std::max(z_max,
+ (double)patch->data(flags.height_vector,
+ i1 * d1 + i2 * d2));
z_max = std::max(z_max,
(double)patch->data(flags.height_vector,
(i1 + 1) * d1 + i2 * d2));
0,
n_subdivisions);
- Assert(
- (flags.height_vector < patch->data.n_rows()) ||
- patch->data.n_rows() == 0,
- ExcIndexRange(flags.height_vector, 0, patch->data.n_rows()));
+ Assert((flags.height_vector < patch->data.n_rows()) ||
+ patch->data.n_rows() == 0,
+ ExcIndexRange(flags.height_vector,
+ 0,
+ patch->data.n_rows()));
vertices[0][0] = projected_vertices[0][0];
vertices[0][1] = projected_vertices[0][1];
camera_horizontal,
camera_focus);
- x_min_perspective = std::min(
- x_min_perspective, (double)projection_decompositions[0][0]);
- x_min_perspective = std::min(
- x_min_perspective, (double)projection_decompositions[1][0]);
- x_min_perspective = std::min(
- x_min_perspective, (double)projection_decompositions[2][0]);
- x_min_perspective = std::min(
- x_min_perspective, (double)projection_decompositions[3][0]);
-
- x_max_perspective = std::max(
- x_max_perspective, (double)projection_decompositions[0][0]);
- x_max_perspective = std::max(
- x_max_perspective, (double)projection_decompositions[1][0]);
- x_max_perspective = std::max(
- x_max_perspective, (double)projection_decompositions[2][0]);
- x_max_perspective = std::max(
- x_max_perspective, (double)projection_decompositions[3][0]);
-
- y_min_perspective = std::min(
- y_min_perspective, (double)projection_decompositions[0][1]);
- y_min_perspective = std::min(
- y_min_perspective, (double)projection_decompositions[1][1]);
- y_min_perspective = std::min(
- y_min_perspective, (double)projection_decompositions[2][1]);
- y_min_perspective = std::min(
- y_min_perspective, (double)projection_decompositions[3][1]);
-
- y_max_perspective = std::max(
- y_max_perspective, (double)projection_decompositions[0][1]);
- y_max_perspective = std::max(
- y_max_perspective, (double)projection_decompositions[1][1]);
- y_max_perspective = std::max(
- y_max_perspective, (double)projection_decompositions[2][1]);
- y_max_perspective = std::max(
- y_max_perspective, (double)projection_decompositions[3][1]);
+ x_min_perspective =
+ std::min(x_min_perspective,
+ (double)projection_decompositions[0][0]);
+ x_min_perspective =
+ std::min(x_min_perspective,
+ (double)projection_decompositions[1][0]);
+ x_min_perspective =
+ std::min(x_min_perspective,
+ (double)projection_decompositions[2][0]);
+ x_min_perspective =
+ std::min(x_min_perspective,
+ (double)projection_decompositions[3][0]);
+
+ x_max_perspective =
+ std::max(x_max_perspective,
+ (double)projection_decompositions[0][0]);
+ x_max_perspective =
+ std::max(x_max_perspective,
+ (double)projection_decompositions[1][0]);
+ x_max_perspective =
+ std::max(x_max_perspective,
+ (double)projection_decompositions[2][0]);
+ x_max_perspective =
+ std::max(x_max_perspective,
+ (double)projection_decompositions[3][0]);
+
+ y_min_perspective =
+ std::min(y_min_perspective,
+ (double)projection_decompositions[0][1]);
+ y_min_perspective =
+ std::min(y_min_perspective,
+ (double)projection_decompositions[1][1]);
+ y_min_perspective =
+ std::min(y_min_perspective,
+ (double)projection_decompositions[2][1]);
+ y_min_perspective =
+ std::min(y_min_perspective,
+ (double)projection_decompositions[3][1]);
+
+ y_max_perspective =
+ std::max(y_max_perspective,
+ (double)projection_decompositions[0][1]);
+ y_max_perspective =
+ std::max(y_max_perspective,
+ (double)projection_decompositions[1][1]);
+ y_max_perspective =
+ std::max(y_max_perspective,
+ (double)projection_decompositions[2][1]);
+ y_max_perspective =
+ std::max(y_max_perspective,
+ (double)projection_decompositions[3][1]);
}
}
}
0,
n_subdivisions);
- Assert(
- (flags.height_vector < patch->data.n_rows()) ||
- patch->data.n_rows() == 0,
- ExcIndexRange(flags.height_vector, 0, patch->data.n_rows()));
+ Assert((flags.height_vector < patch->data.n_rows()) ||
+ patch->data.n_rows() == 0,
+ ExcIndexRange(flags.height_vector,
+ 0,
+ patch->data.n_rows()));
cell.vertices[0][0] = projected_vertices[0][0];
cell.vertices[0][1] = projected_vertices[0][1];
template <int dim, int spacedim>
-DataOutInterface<dim, spacedim>::DataOutInterface() :
- default_subdivisions(1),
- default_fmt(DataOutBase::default_format)
+DataOutInterface<dim, spacedim>::DataOutInterface()
+ : default_subdivisions(1)
+ , default_fmt(DataOutBase::default_format)
{}
std::ostream & out,
const std::vector<std::string> &piece_names) const
{
- DataOutBase::write_pvtu_record(
- out, piece_names, get_dataset_names(), get_vector_data_ranges());
+ DataOutBase::write_pvtu_record(out,
+ piece_names,
+ get_dataset_names(),
+ get_vector_data_ranges());
}
std::get<0>(vector_data_ranges[n_th_vector])));
AssertThrow(
std::get<1>(vector_data_ranges[n_th_vector]) < n_data_sets,
- ExcIndexRange(
- std::get<1>(vector_data_ranges[n_th_vector]), 0, n_data_sets));
+ ExcIndexRange(std::get<1>(vector_data_ranges[n_th_vector]),
+ 0,
+ n_data_sets));
// Determine the vector name
// Concatenate all the
}
// Write data to the filter object
- filtered_data.write_data_set(
- vector_name, pt_data_vector_dim, data_set, data_vectors);
+ filtered_data.write_data_set(vector_name,
+ pt_data_vector_dim,
+ data_set,
+ data_vectors);
// Advance the current data set
data_set += pt_data_vector_dim;
if (write_mesh_file)
{
// Overwrite any existing files (change this to an option?)
- h5_mesh_file_id = H5Fcreate(
- mesh_filename.c_str(), H5F_ACC_TRUNC, H5P_DEFAULT, file_plist_id);
+ h5_mesh_file_id = H5Fcreate(mesh_filename.c_str(),
+ H5F_ACC_TRUNC,
+ H5P_DEFAULT,
+ file_plist_id);
AssertThrow(h5_mesh_file_id >= 0, ExcIO());
// Create the dataspace for the nodes and cells
else
{
// Otherwise we need to open a new file
- h5_solution_file_id = H5Fcreate(
- solution_filename.c_str(), H5F_ACC_TRUNC, H5P_DEFAULT, file_plist_id);
+ h5_solution_file_id = H5Fcreate(solution_filename.c_str(),
+ H5F_ACC_TRUNC,
+ H5P_DEFAULT,
+ file_plist_id);
AssertThrow(h5_solution_file_id >= 0, ExcIO());
}
const std::string &name = std::get<2>(ranges[n_th_vector]);
if (name != "")
{
- Assert(
- all_names.find(name) == all_names.end(),
- ExcMessage("Error: names of fields in DataOut need to be unique, "
- "but '" +
- name + "' is used more than once."));
+ Assert(all_names.find(name) == all_names.end(),
+ ExcMessage(
+ "Error: names of fields in DataOut need to be unique, "
+ "but '" +
+ name + "' is used more than once."));
all_names.insert(name);
for (unsigned int i = std::get<0>(ranges[n_th_vector]);
i <= std::get<1>(ranges[n_th_vector]);
if (data_set_written[data_set] == false)
{
const std::string &name = data_names[data_set];
- Assert(
- all_names.find(name) == all_names.end(),
- ExcMessage("Error: names of fields in DataOut need to be unique, "
- "but '" +
- name + "' is used more than once."));
+ Assert(all_names.find(name) == all_names.end(),
+ ExcMessage(
+ "Error: names of fields in DataOut need to be unique, "
+ "but '" +
+ name + "' is used more than once."));
all_names.insert(name);
}
}
s << "[Version: "
<< dealii::DataOutBase::Deal_II_IntermediateFlags::format_version << "]";
- Assert(
- header == s.str(),
- ExcMessage("Invalid or incompatible file format. Intermediate format "
- "files can only be read by the same deal.II version as they "
- "are written by."));
+ Assert(header == s.str(),
+ ExcMessage(
+ "Invalid or incompatible file format. Intermediate format "
+ "files can only be read by the same deal.II version as they "
+ "are written by."));
}
// then read the rest of the data
// ---------------------------------------------- XDMFEntry ----------
-XDMFEntry::XDMFEntry() :
- valid(false),
- h5_sol_filename(""),
- h5_mesh_filename(""),
- entry_time(0.0),
- num_nodes(numbers::invalid_unsigned_int),
- num_cells(numbers::invalid_unsigned_int),
- dimension(numbers::invalid_unsigned_int),
- space_dimension(numbers::invalid_unsigned_int)
+XDMFEntry::XDMFEntry()
+ : valid(false)
+ , h5_sol_filename("")
+ , h5_mesh_filename("")
+ , entry_time(0.0)
+ , num_nodes(numbers::invalid_unsigned_int)
+ , num_cells(numbers::invalid_unsigned_int)
+ , dimension(numbers::invalid_unsigned_int)
+ , space_dimension(numbers::invalid_unsigned_int)
{}
const double time,
const unsigned int nodes,
const unsigned int cells,
- const unsigned int dim) :
- XDMFEntry(filename, filename, time, nodes, cells, dim, dim)
+ const unsigned int dim)
+ : XDMFEntry(filename, filename, time, nodes, cells, dim, dim)
{}
const double time,
const unsigned int nodes,
const unsigned int cells,
- const unsigned int dim) :
- XDMFEntry(mesh_filename, solution_filename, time, nodes, cells, dim, dim)
+ const unsigned int dim)
+ : XDMFEntry(mesh_filename, solution_filename, time, nodes, cells, dim, dim)
{}
const unsigned int nodes,
const unsigned int cells,
const unsigned int dim,
- const unsigned int spacedim) :
- valid(true),
- h5_sol_filename(solution_filename),
- h5_mesh_filename(mesh_filename),
- entry_time(time),
- num_nodes(nodes),
- num_cells(cells),
- dimension(dim),
- space_dimension(spacedim)
+ const unsigned int spacedim)
+ : valid(true)
+ , h5_sol_filename(solution_filename)
+ , h5_mesh_filename(mesh_filename)
+ , entry_time(time)
+ , num_nodes(nodes)
+ , num_cells(cells)
+ , dimension(dim)
+ , space_dimension(spacedim)
{}
}
- Event::Event() : all_true(false), flags(names.size(), false)
+ Event::Event()
+ : all_true(false)
+ , flags(names.size(), false)
{}
-ExceptionBase::ExceptionBase() :
- file(""),
- line(0),
- function(""),
- cond(""),
- exc(""),
- stacktrace(nullptr),
- n_stacktrace_frames(0),
- what_str("")
+ExceptionBase::ExceptionBase()
+ : file("")
+ , line(0)
+ , function("")
+ , cond("")
+ , exc("")
+ , stacktrace(nullptr)
+ , n_stacktrace_frames(0)
+ , what_str("")
{
#ifdef DEAL_II_HAVE_GLIBC_STACKTRACE
for (unsigned int i = 0;
-ExceptionBase::ExceptionBase(const ExceptionBase &exc) :
- file(exc.file),
- line(exc.line),
- function(exc.function),
- cond(exc.cond),
- exc(exc.exc),
- stacktrace(
- nullptr), // don't copy stacktrace to avoid double de-allocation problem
- n_stacktrace_frames(0),
- what_str(
- "") // don't copy the error message, it gets generated dynamically by what()
+ExceptionBase::ExceptionBase(const ExceptionBase &exc)
+ : file(exc.file)
+ , line(exc.line)
+ , function(exc.function)
+ , cond(exc.cond)
+ , exc(exc.exc)
+ , stacktrace(nullptr)
+ , // don't copy stacktrace to avoid double de-allocation problem
+ n_stacktrace_frames(0)
+ , what_str("") // don't copy the error message, it gets generated dynamically
+ // by what()
{
#ifdef DEAL_II_HAVE_GLIBC_STACKTRACE
for (unsigned int i = 0;
#ifdef DEAL_II_WITH_MPI
namespace StandardExceptions
{
- ExcMPI::ExcMPI(const int error_code) : error_code(error_code)
+ ExcMPI::ExcMPI(const int error_code)
+ : error_code(error_code)
{}
void
namespace Functions
{
template <int dim>
- FlowFunction<dim>::FlowFunction() :
- Function<dim>(dim + 1),
- mean_pressure(0),
- aux_values(dim + 1),
- aux_gradients(dim + 1)
+ FlowFunction<dim>::FlowFunction()
+ : Function<dim>(dim + 1)
+ , mean_pressure(0)
+ , aux_values(dim + 1)
+ , aux_gradients(dim + 1)
{}
//----------------------------------------------------------------------//
template <int dim>
- PoisseuilleFlow<dim>::PoisseuilleFlow(const double r, const double Re) :
- radius(r),
- Reynolds(Re)
+ PoisseuilleFlow<dim>::PoisseuilleFlow(const double r, const double Re)
+ : radius(r)
+ , Reynolds(Re)
{
Assert(Reynolds != 0., ExcMessage("Reynolds number cannot be zero"));
}
//----------------------------------------------------------------------//
template <int dim>
- StokesCosine<dim>::StokesCosine(const double nu, const double r) :
- viscosity(nu),
- reaction(r)
+ StokesCosine<dim>::StokesCosine(const double nu, const double r)
+ : viscosity(nu)
+ , reaction(r)
{}
const double StokesLSingularity::lambda = 0.54448373678246;
- StokesLSingularity::StokesLSingularity() :
- omega(3. / 2. * numbers::PI),
- coslo(cos(lambda * omega)),
- lp(1. + lambda),
- lm(1. - lambda)
+ StokesLSingularity::StokesLSingularity()
+ : omega(3. / 2. * numbers::PI)
+ , coslo(cos(lambda * omega))
+ , lp(1. + lambda)
+ , lm(1. - lambda)
{}
//----------------------------------------------------------------------//
- Kovasznay::Kovasznay(double Re, bool stokes) : Reynolds(Re), stokes(stokes)
+ Kovasznay::Kovasznay(double Re, bool stokes)
+ : Reynolds(Re)
+ , stokes(stokes)
{
long double r2 = Reynolds / 2.;
long double b = 4 * numbers::PI * numbers::PI;
{
template <int dim>
CSpline<dim>::CSpline(const std::vector<double> &x_,
- const std::vector<double> &y_) :
- interpolation_points(x_),
- interpolation_values(y_)
+ const std::vector<double> &y_)
+ : interpolation_points(x_)
+ , interpolation_values(y_)
{
Assert(interpolation_points.size() > 0,
ExcCSplineEmpty(interpolation_points.size()));
// check that input vector @p interpolation_points is provided in ascending order:
for (unsigned int i = 0; i < interpolation_points.size() - 1; i++)
AssertThrow(interpolation_points[i] < interpolation_points[i + 1],
- ExcCSplineOrder(
- i, interpolation_points[i], interpolation_points[i + 1]));
+ ExcCSplineOrder(i,
+ interpolation_points[i],
+ interpolation_points[i + 1]));
acc = gsl_interp_accel_alloc();
const unsigned int n = interpolation_points.size();
cspline = gsl_spline_alloc(gsl_interp_cspline, n);
// gsl_spline_init returns something but it seems nobody knows what
- gsl_spline_init(
- cspline, interpolation_points.data(), interpolation_values.data(), n);
+ gsl_spline_init(cspline,
+ interpolation_points.data(),
+ interpolation_values.data(),
+ n);
}
const double &x = p[0];
Assert(x >= interpolation_points.front() &&
x <= interpolation_points.back(),
- ExcCSplineRange(
- x, interpolation_points.front(), interpolation_points.back()));
+ ExcCSplineRange(x,
+ interpolation_points.front(),
+ interpolation_points.back()));
return gsl_spline_eval(cspline, x, acc);
}
const double &x = p[0];
Assert(x >= interpolation_points.front() &&
x <= interpolation_points.back(),
- ExcCSplineRange(
- x, interpolation_points.front(), interpolation_points.back()));
+ ExcCSplineRange(x,
+ interpolation_points.front(),
+ interpolation_points.back()));
const double deriv = gsl_spline_eval_deriv(cspline, x, acc);
Tensor<1, dim> res;
const double &x = p[0];
Assert(x >= interpolation_points.front() &&
x <= interpolation_points.back(),
- ExcCSplineRange(
- x, interpolation_points.front(), interpolation_points.back()));
+ ExcCSplineRange(x,
+ interpolation_points.front(),
+ interpolation_points.back()));
return gsl_spline_eval_deriv2(cspline, x, acc);
}
template <int dim>
FunctionDerivative<dim>::FunctionDerivative(const Function<dim> &f,
const Point<dim> & dir,
- const double h) :
- AutoDerivativeFunction<dim>(h, f.n_components, f.get_time()),
- f(f),
- h(h),
- incr(1, h * dir)
+ const double h)
+ : AutoDerivativeFunction<dim>(h, f.n_components, f.get_time())
+ , f(f)
+ , h(h)
+ , incr(1, h * dir)
{
set_formula();
}
template <int dim>
FunctionDerivative<dim>::FunctionDerivative(const Function<dim> & f,
const std::vector<Point<dim>> &dir,
- const double h) :
- AutoDerivativeFunction<dim>(h, f.n_components, f.get_time()),
- f(f),
- h(h),
- incr(dir.size())
+ const double h)
+ : AutoDerivativeFunction<dim>(h, f.n_components, f.get_time())
+ , f(f)
+ , h(h)
+ , incr(dir.size())
{
for (unsigned int i = 0; i < incr.size(); ++i)
incr[i] = h * dir[i];
template <int dim>
- PillowFunction<dim>::PillowFunction(const double offset) : offset(offset)
+ PillowFunction<dim>::PillowFunction(const double offset)
+ : offset(offset)
{}
//////////////////////////////////////////////////////////////////////
template <int dim>
- CosineFunction<dim>::CosineFunction(const unsigned int n_components) :
- Function<dim>(n_components)
+ CosineFunction<dim>::CosineFunction(const unsigned int n_components)
+ : Function<dim>(n_components)
{}
//////////////////////////////////////////////////////////////////////
template <int dim>
- CosineGradFunction<dim>::CosineGradFunction() : Function<dim>(dim)
+ CosineGradFunction<dim>::CosineGradFunction()
+ : Function<dim>(dim)
{}
//////////////////////////////////////////////////////////////////////
- LSingularityGradFunction::LSingularityGradFunction() : Function<2>(2)
+ LSingularityGradFunction::LSingularityGradFunction()
+ : Function<2>(2)
{}
template <int dim>
JumpFunction<dim>::JumpFunction(const Point<dim> &direction,
- const double steepness) :
- direction(direction),
- steepness(steepness)
+ const double steepness)
+ : direction(direction)
+ , steepness(steepness)
{
switch (dim)
{
template <int dim>
FourierCosineFunction<dim>::FourierCosineFunction(
- const Tensor<1, dim> &fourier_coefficients) :
- Function<dim>(1),
- fourier_coefficients(fourier_coefficients)
+ const Tensor<1, dim> &fourier_coefficients)
+ : Function<dim>(1)
+ , fourier_coefficients(fourier_coefficients)
{}
template <int dim>
FourierSineFunction<dim>::FourierSineFunction(
- const Tensor<1, dim> &fourier_coefficients) :
- Function<dim>(1),
- fourier_coefficients(fourier_coefficients)
+ const Tensor<1, dim> &fourier_coefficients)
+ : Function<dim>(1)
+ , fourier_coefficients(fourier_coefficients)
{}
template <int dim>
FourierSineSum<dim>::FourierSineSum(
const std::vector<Point<dim>> &fourier_coefficients,
- const std::vector<double> & weights) :
- Function<dim>(1),
- fourier_coefficients(fourier_coefficients),
- weights(weights)
+ const std::vector<double> & weights)
+ : Function<dim>(1)
+ , fourier_coefficients(fourier_coefficients)
+ , weights(weights)
{
Assert(fourier_coefficients.size() > 0, ExcZero());
Assert(fourier_coefficients.size() == weights.size(),
template <int dim>
FourierCosineSum<dim>::FourierCosineSum(
const std::vector<Point<dim>> &fourier_coefficients,
- const std::vector<double> & weights) :
- Function<dim>(1),
- fourier_coefficients(fourier_coefficients),
- weights(weights)
+ const std::vector<double> & weights)
+ : Function<dim>(1)
+ , fourier_coefficients(fourier_coefficients)
+ , weights(weights)
{
Assert(fourier_coefficients.size() > 0, ExcZero());
Assert(fourier_coefficients.size() == weights.size(),
template <int dim>
Monomial<dim>::Monomial(const Tensor<1, dim> &exponents,
- const unsigned int n_components) :
- Function<dim>(n_components),
- exponents(exponents)
+ const unsigned int n_components)
+ : Function<dim>(n_components)
+ , exponents(exponents)
{}
else
{
if (p[s] < 0)
- Assert(
- std::floor(exponents[s]) == exponents[s],
- ExcMessage("Exponentiation of a negative base number with "
- "a real exponent can't be performed."));
+ Assert(std::floor(exponents[s]) == exponents[s],
+ ExcMessage(
+ "Exponentiation of a negative base number with "
+ "a real exponent can't be performed."));
prod *=
(s == d ? exponents[s] * std::pow(p[s], exponents[s] - 1) :
std::pow(p[s], exponents[s]));
template <int dim>
Bessel1<dim>::Bessel1(const unsigned int order,
const double wave_number,
- const Point<dim> center) :
- order(order),
- wave_number(wave_number),
- center(center)
+ const Point<dim> center)
+ : order(order)
+ , wave_number(wave_number)
+ , center(center)
{}
template <int dim>
template <int dim>
InterpolatedTensorProductGridData<dim>::InterpolatedTensorProductGridData(
const std::array<std::vector<double>, dim> &coordinate_values,
- const Table<dim, double> & data_values) :
- coordinate_values(coordinate_values),
- data_values(data_values)
+ const Table<dim, double> & data_values)
+ : coordinate_values(coordinate_values)
+ , data_values(data_values)
{
for (unsigned int d = 0; d < dim; ++d)
{
ExcMessage(
"Coordinate arrays must be sorted in strictly ascending order."));
- Assert(
- data_values.size()[d] == coordinate_values[d].size(),
- ExcMessage("Data and coordinate tables do not have the same size."));
+ Assert(data_values.size()[d] == coordinate_values[d].size(),
+ ExcMessage(
+ "Data and coordinate tables do not have the same size."));
}
}
{
// get the index of the first element of the coordinate arrays that is
// larger than p[d]
- ix[d] =
- (std::lower_bound(
- coordinate_values[d].begin(), coordinate_values[d].end(), p[d]) -
- coordinate_values[d].begin());
+ ix[d] = (std::lower_bound(coordinate_values[d].begin(),
+ coordinate_values[d].end(),
+ p[d]) -
+ coordinate_values[d].begin());
// the one we want is the index of the coordinate to the left, however,
// so decrease it by one (unless we have a point to the left of all, in
Point<dim> p_unit;
for (unsigned int d = 0; d < dim; ++d)
- p_unit[d] = std::max(
- std::min((p[d] - coordinate_values[d][ix[d]]) / dx[d], 1.), 0.0);
+ p_unit[d] =
+ std::max(std::min((p[d] - coordinate_values[d][ix[d]]) / dx[d], 1.),
+ 0.0);
return gradient_interpolate(data_values, ix, p_unit, dx);
}
InterpolatedUniformGridData<dim>::InterpolatedUniformGridData(
const std::array<std::pair<double, double>, dim> &interval_endpoints,
const std::array<unsigned int, dim> & n_subintervals,
- const Table<dim, double> & data_values) :
- interval_endpoints(interval_endpoints),
- n_subintervals(n_subintervals),
- data_values(data_values)
+ const Table<dim, double> & data_values)
+ : interval_endpoints(interval_endpoints)
+ , n_subintervals(n_subintervals)
+ , data_values(data_values)
{
for (unsigned int d = 0; d < dim; ++d)
{
const double delta_x =
((interval_endpoints[d].second - interval_endpoints[d].first) /
n_subintervals[d]);
- p_unit[d] = std::max(
- std::min((p[d] - interval_endpoints[d].first - ix[d] * delta_x) /
- delta_x,
- 1.),
- 0.);
+ p_unit[d] = std::max(std::min((p[d] - interval_endpoints[d].first -
+ ix[d] * delta_x) /
+ delta_x,
+ 1.),
+ 0.);
}
return interpolate(data_values, ix, p_unit);
template <int dim>
Polynomial<dim>::Polynomial(const Table<2, double> & exponents,
- const std::vector<double> &coefficients) :
- Function<dim>(1),
- exponents(exponents),
- coefficients(coefficients)
+ const std::vector<double> &coefficients)
+ : Function<dim>(1)
+ , exponents(exponents)
+ , coefficients(coefficients)
{
Assert(exponents.n_rows() == coefficients.size(),
ExcDimensionMismatch(exponents.n_rows(), coefficients.size()));
CutOffFunctionBase<dim>::CutOffFunctionBase(const double r,
const Point<dim> p,
const unsigned int n_components,
- const unsigned int select) :
- Function<dim>(n_components),
- center(p),
- radius(r),
- selected(select)
+ const unsigned int select)
+ : Function<dim>(n_components)
+ , center(p)
+ , radius(r)
+ , selected(select)
{}
const double r,
const Point<dim> p,
const unsigned int n_components,
- const unsigned int select) :
- CutOffFunctionBase<dim>(r, p, n_components, select)
+ const unsigned int select)
+ : CutOffFunctionBase<dim>(r, p, n_components, select)
{}
CutOffFunctionW1<dim>::CutOffFunctionW1(const double r,
const Point<dim> p,
const unsigned int n_components,
- const unsigned int select) :
- CutOffFunctionBase<dim>(r, p, n_components, select)
+ const unsigned int select)
+ : CutOffFunctionBase<dim>(r, p, n_components, select)
{}
const double r,
const Point<dim> p,
const unsigned int n_components,
- const unsigned int select) :
- CutOffFunctionBase<dim>(r, p, n_components, select)
+ const unsigned int select)
+ : CutOffFunctionBase<dim>(r, p, n_components, select)
{}
template <int dim>
FunctionParser<dim>::FunctionParser(const unsigned int n_components,
const double initial_time,
- const double h) :
- AutoDerivativeFunction<dim>(h, n_components, initial_time),
- initialized(false),
- n_vars(0)
+ const double h)
+ : AutoDerivativeFunction<dim>(h, n_components, initial_time)
+ , initialized(false)
+ , n_vars(0)
{}
template <int dim>
Spherical<dim>::Spherical(const Point<dim> & p,
- const unsigned int n_components) :
- Function<dim>(n_components),
- coordinate_system_offset(p)
+ const unsigned int n_components)
+ : Function<dim>(n_components)
+ , coordinate_system_offset(p)
{
AssertThrow(dim == 3, ExcNotImplemented());
}
# ifdef DEAL_II_WITH_64BIT_INDICES
-IndexSet::IndexSet(const Epetra_Map &map) :
- is_compressed(true),
- index_space_size(1 + map.MaxAllGID64()),
- largest_range(numbers::invalid_unsigned_int)
+IndexSet::IndexSet(const Epetra_Map &map)
+ : is_compressed(true)
+ , index_space_size(1 + map.MaxAllGID64())
+ , largest_range(numbers::invalid_unsigned_int)
{
Assert(map.MinAllGID64() == 0,
ExcMessage("The Epetra_Map does not contain the global index 0, which "
// this is the standard 32-bit implementation
-IndexSet::IndexSet(const Epetra_Map &map) :
- is_compressed(true),
- index_space_size(1 + map.MaxAllGID()),
- largest_range(numbers::invalid_unsigned_int)
+IndexSet::IndexSet(const Epetra_Map &map)
+ : is_compressed(true)
+ , index_space_size(1 + map.MaxAllGID())
+ , largest_range(numbers::invalid_unsigned_int)
{
Assert(map.MinAllGID() == 0,
ExcMessage("The Epetra_Map does not contain the global index 0, which "
if (ranges.size() == 0 || begin > ranges.back().end)
ranges.push_back(new_range);
else
- ranges.insert(
- Utilities::lower_bound(ranges.begin(), ranges.end(), new_range),
- new_range);
+ ranges.insert(Utilities::lower_bound(ranges.begin(),
+ ranges.end(),
+ new_range),
+ new_range);
is_compressed = false;
}
}
Assert(other.ranges.size() == 0 ||
other.ranges.back().end - 1 < index_space_size,
- ExcIndexRangeType<size_type>(
- other.ranges.back().end - 1, 0, index_space_size));
+ ExcIndexRangeType<size_type>(other.ranges.back().end - 1,
+ 0,
+ index_space_size));
compress();
other.compress();
-LogStream::Prefix::Prefix(const std::string &text) : stream(&deallog)
+LogStream::Prefix::Prefix(const std::string &text)
+ : stream(&deallog)
{
stream->push(text);
}
-LogStream::Prefix::Prefix(const std::string &text, LogStream &s) : stream(&s)
+LogStream::Prefix::Prefix(const std::string &text, LogStream &s)
+ : stream(&s)
{
stream->push(text);
}
}
catch (...)
{
- AssertNothrow(
- false,
- ExcMessage("An exception occurred in LogStream::Prefix::~Prefix."));
+ AssertNothrow(false,
+ ExcMessage(
+ "An exception occurred in LogStream::Prefix::~Prefix."));
}
}
-LogStream::LogStream() :
- std_out(&std::cout),
- file(nullptr),
- std_depth(0),
- file_depth(10000),
- print_thread_id(false),
- at_newline(true)
+LogStream::LogStream()
+ : std_out(&std::cout)
+ , file(nullptr)
+ , std_depth(0)
+ , file_depth(10000)
+ , print_thread_id(false)
+ , at_newline(true)
{
get_prefixes().push("DEAL:");
}
// Implement a minimalistic stream buffer that only stores the fact
// whether overflow or sync was called
public:
- QueryStreambuf() : flushed_(false), newline_written_(false)
+ QueryStreambuf()
+ : flushed_(false)
+ , newline_written_(false)
{}
bool
flushed()
{
Assert(destinations[i] < n_procs,
ExcIndexRange(destinations[i], 0, n_procs));
- Assert(
- destinations[i] != myid,
- ExcMessage("There is no point in communicating with ourselves."));
+ Assert(destinations[i] != myid,
+ ExcMessage(
+ "There is no point in communicating with ourselves."));
}
// in there, padded with -1's
std::vector<unsigned int> my_destinations(max_n_destinations,
numbers::invalid_unsigned_int);
- std::copy(
- destinations.begin(), destinations.end(), my_destinations.begin());
+ std::copy(destinations.begin(),
+ destinations.end(),
+ my_destinations.begin());
// now exchange these (we could communicate less data if we used
// MPI_Allgatherv, but we'd have to communicate my_n_destinations to all
for (S : REAL_SCALARS)
{
- template void sum<S>(
- const SparseMatrix<S> &, const MPI_Comm &, SparseMatrix<S> &);
+ template void sum<S>(const SparseMatrix<S> &,
+ const MPI_Comm &,
+ SparseMatrix<S> &);
}
for (S : MPI_SCALARS)
{
- template void sum<LAPACKFullMatrix<S>>(
- const LAPACKFullMatrix<S> &, const MPI_Comm &, LAPACKFullMatrix<S> &);
+ template void sum<LAPACKFullMatrix<S>>(const LAPACKFullMatrix<S> &,
+ const MPI_Comm &,
+ LAPACKFullMatrix<S> &);
- template void sum<Vector<S>>(
- const Vector<S> &, const MPI_Comm &, Vector<S> &);
+ template void sum<Vector<S>>(const Vector<S> &,
+ const MPI_Comm &,
+ Vector<S> &);
- template void sum<FullMatrix<S>>(
- const FullMatrix<S> &, const MPI_Comm &, FullMatrix<S> &);
+ template void sum<FullMatrix<S>>(const FullMatrix<S> &,
+ const MPI_Comm &,
+ FullMatrix<S> &);
- template void sum<S>(
- const ArrayView<const S> &, const MPI_Comm &, const ArrayView<S> &);
+ template void sum<S>(const ArrayView<const S> &,
+ const MPI_Comm &,
+ const ArrayView<S> &);
template S sum<S>(const S &, const MPI_Comm &);
- template void sum<std::vector<S>>(
- const std::vector<S> &, const MPI_Comm &, std::vector<S> &);
+ template void sum<std::vector<S>>(const std::vector<S> &,
+ const MPI_Comm &,
+ std::vector<S> &);
template S max<S>(const S &, const MPI_Comm &);
- template void max<std::vector<S>>(
- const std::vector<S> &, const MPI_Comm &, std::vector<S> &);
+ template void max<std::vector<S>>(const std::vector<S> &,
+ const MPI_Comm &,
+ std::vector<S> &);
template S min<S>(const S &, const MPI_Comm &);
- template void min<std::vector<S>>(
- const std::vector<S> &, const MPI_Comm &, std::vector<S> &);
+ template void min<std::vector<S>>(const std::vector<S> &,
+ const MPI_Comm &,
+ std::vector<S> &);
// The fixed-length array (i.e., things declared like T(&values)[N])
// versions of the functions above live in the header file mpi.h since the
penv + ">"));
}
- AssertThrow(
- max_threads_env > 0,
- ExcMessage("When specifying the <DEAL_II_NUM_THREADS> environment "
- "variable, it needs to be a positive number."));
+ AssertThrow(max_threads_env > 0,
+ ExcMessage(
+ "When specifying the <DEAL_II_NUM_THREADS> environment "
+ "variable, it needs to be a positive number."));
if (n_max_threads != numbers::invalid_unsigned_int)
n_max_threads = std::min(n_max_threads, max_threads_env);
namespace internal
{
#ifdef DEAL_II_WITH_THREADS
- TBBPartitioner::TBBPartitioner() :
- my_partitioner(std::make_shared<tbb::affinity_partitioner>()),
- in_use(false)
+ TBBPartitioner::TBBPartitioner()
+ : my_partitioner(std::make_shared<tbb::affinity_partitioner>())
+ , in_use(false)
{}
TBBPartitioner::~TBBPartitioner()
{
- AssertNothrow(
- in_use == false,
- ExcInternalError("A vector partitioner goes out of scope, but "
- "it appears to be still in use."));
+ AssertNothrow(in_use == false,
+ ExcInternalError(
+ "A vector partitioner goes out of scope, but "
+ "it appears to be still in use."));
}
// Static parameter handler
ParameterHandler ParameterAcceptor::prm;
-ParameterAcceptor::ParameterAcceptor(const std::string &name) :
- acceptor_id(class_list.size()),
- section_name(name)
+ParameterAcceptor::ParameterAcceptor(const std::string &name)
+ : acceptor_id(class_list.size())
+ , section_name(name)
{
SmartPointer<ParameterAcceptor> pt(
this, boost::core::demangle(typeid(*this).name()).c_str());
if ((previous_path.size() > 0) && has_trailing == false)
previous_path.resize(previous_path.size() - 1);
- sections.insert(
- sections.begin(), previous_path.begin(), previous_path.end());
+ sections.insert(sections.begin(),
+ previous_path.begin(),
+ previous_path.end());
// Exit the for cycle
break;
}
DEAL_II_NAMESPACE_OPEN
-ParameterHandler::ParameterHandler() :
- entries(new boost::property_tree::ptree())
+ParameterHandler::ParameterHandler()
+ : entries(new boost::property_tree::ptree())
{}
if (!is_concatenated)
{
- scan_line_or_cleanup(
- fully_concatenated_line, filename, current_logical_line_n);
+ scan_line_or_cleanup(fully_concatenated_line,
+ filename,
+ current_logical_line_n);
fully_concatenated_line.clear();
}
patterns.back()->description());
// as documented, do the default value checking at the very end
- AssertThrow(
- pattern.match(default_value),
- ExcValueDoesNotMatchPattern(default_value, pattern.description()));
+ AssertThrow(pattern.match(default_value),
+ ExcValueDoesNotMatchPattern(default_value,
+ pattern.description()));
}
">, but the latter does not exist."));
// then also make sure that what is being referred to is in
// fact a parameter (not an alias or subsection)
- Assert(
- entries->get_optional<std::string>(
- get_current_full_path(existing_entry_name) + path_separator + "value"),
- ExcMessage("You are trying to declare an alias entry <" + alias_name +
- "> that references an entry <" + existing_entry_name +
- ">, but the latter does not seem to be a "
- "parameter declaration."));
+ Assert(entries->get_optional<std::string>(
+ get_current_full_path(existing_entry_name) + path_separator +
+ "value"),
+ ExcMessage("You are trying to declare an alias entry <" + alias_name +
+ "> that references an entry <" + existing_entry_name +
+ ">, but the latter does not seem to be a "
+ "parameter declaration."));
// now also make sure that if the alias has already been
// entry
if (entries->get_optional<std::string>(get_current_full_path(alias_name)))
{
- Assert(
- entries->get_optional<std::string>(get_current_full_path(alias_name) +
- path_separator + "alias"),
- ExcMessage("You are trying to declare an alias entry <" + alias_name +
- "> but a non-alias entry already exists in this "
- "subsection (i.e., there is either a preexisting "
- "further subsection, or a parameter entry, with "
- "the same name as the alias)."));
- Assert(
- entries->get<std::string>(get_current_full_path(alias_name) +
- path_separator + "alias") ==
- existing_entry_name,
- ExcMessage("You are trying to declare an alias entry <" + alias_name +
- "> but an alias entry already exists in this "
- "subsection and this existing alias references a "
- "different parameter entry. Specifically, "
- "you are trying to reference the entry <" +
- existing_entry_name +
- "> whereas the existing alias references "
- "the entry <" +
- entries->get<std::string>(get_current_full_path(alias_name) +
- path_separator + "alias") +
- ">."));
+ Assert(entries->get_optional<std::string>(
+ get_current_full_path(alias_name) + path_separator + "alias"),
+ ExcMessage("You are trying to declare an alias entry <" +
+ alias_name +
+ "> but a non-alias entry already exists in this "
+ "subsection (i.e., there is either a preexisting "
+ "further subsection, or a parameter entry, with "
+ "the same name as the alias)."));
+ Assert(entries->get<std::string>(get_current_full_path(alias_name) +
+ path_separator + "alias") ==
+ existing_entry_name,
+ ExcMessage(
+ "You are trying to declare an alias entry <" + alias_name +
+ "> but an alias entry already exists in this "
+ "subsection and this existing alias references a "
+ "different parameter entry. Specifically, "
+ "you are trying to reference the entry <" +
+ existing_entry_name +
+ "> whereas the existing alias references "
+ "the entry <" +
+ entries->get<std::string>(get_current_full_path(alias_name) +
+ path_separator + "alias") +
+ ">."));
}
entries->put(get_current_full_path(alias_name) + path_separator + "alias",
const unsigned int pattern_index =
entries->get<unsigned int>(path + path_separator + "pattern");
AssertThrow(patterns[pattern_index]->match(new_value),
- ExcValueDoesNotMatchPattern(
- new_value,
- entries->get<std::string>(path + path_separator +
- "pattern_description")));
+ ExcValueDoesNotMatchPattern(new_value,
+ entries->get<std::string>(
+ path + path_separator +
+ "pattern_description")));
// then also execute the actions associated with this
// parameter (if any have been provided)
{
longest_name =
std::max(longest_name, demangle(p->first).length());
- longest_value = std::max(
- longest_value, p->second.get<std::string>("value").length());
+ longest_value =
+ std::max(longest_value,
+ p->second.get<std::string>("value").length());
}
// print entries one by one. make sure they are sorted by using
std::vector<std::string> directory_path = target_subsection_path;
directory_path.emplace_back(subsection);
- recursively_print_parameters(
- directory_path, style, overall_indent_level + 1, out);
+ recursively_print_parameters(directory_path,
+ style,
+ overall_indent_level + 1,
+ out);
switch (style)
{
p != current_section.end();
++p)
if (is_parameter_node(p->second) == true)
- longest_value = std::max(
- longest_value, p->second.get<std::string>("value").length());
+ longest_value =
+ std::max(longest_value,
+ p->second.get<std::string>("value").length());
// print entries one by one. make sure they are sorted by using
const std::string subsection = Utilities::trim(line);
// check whether subsection exists
- AssertThrow(
- entries->get_child_optional(get_current_full_path(subsection)),
- ExcNoSubsection(current_line_n,
- input_filename,
- demangle(get_current_full_path(subsection))));
+ AssertThrow(entries->get_child_optional(
+ get_current_full_path(subsection)),
+ ExcNoSubsection(current_line_n,
+ input_filename,
+ demangle(get_current_full_path(subsection))));
// subsection exists
subsection_path.push_back(subsection);
std::ifstream input(line.c_str());
AssertThrow(input,
- ExcCannotOpenIncludeStatementFile(
- current_line_n, input_filename, line));
+ ExcCannotOpenIncludeStatementFile(current_line_n,
+ input_filename,
+ line));
parse_input(input);
}
else
-MultipleParameterLoop::MultipleParameterLoop() : n_branches(0)
+MultipleParameterLoop::MultipleParameterLoop()
+ : n_branches(0)
{}
{
const std::string value = p->second.get<std::string>("value");
if (value.find('{') != std::string::npos)
- multiple_choices.emplace_back(
- subsection_path, demangle(p->first), value);
+ multiple_choices.emplace_back(subsection_path,
+ demangle(p->first),
+ value);
}
// then loop over all subsections
MultipleParameterLoop::Entry::Entry(const std::vector<std::string> &ssp,
const std::string & Name,
- const std::string & Value) :
- subsection_path(ssp),
- entry_name(Name),
- entry_value(Value),
- type(Entry::array)
+ const std::string & Value)
+ : subsection_path(ssp)
+ , entry_name(Name)
+ , entry_value(Value)
+ , type(Entry::array)
{}
std::string multiple(entry_value,
entry_value.find('{') + 1,
entry_value.rfind('}') - entry_value.find('{') - 1);
- std::string postfix(
- entry_value, entry_value.rfind('}') + 1, std::string::npos);
+ std::string postfix(entry_value,
+ entry_value.rfind('}') + 1,
+ std::string::npos);
// if array entry {{..}}: delete inner
// pair of braces
if (multiple[0] == '{')
{
template <int dim>
ParsedFunction<dim>::ParsedFunction(const unsigned int n_components,
- const double h) :
- AutoDerivativeFunction<dim>(h, n_components),
- function_object(n_components)
+ const double h)
+ : AutoDerivativeFunction<dim>(h, n_components)
+ , function_object(n_components)
{}
function_object.initialize(vnames, expression, constants, true);
break;
default:
- AssertThrow(
- false,
- ExcMessage("The list of variables specified is <" + vnames +
- "> which is a list of length " +
- Utilities::int_to_string(nn) +
- " but it has to be a list of length equal to" +
- " either dim (for a time-independent function)" +
- " or dim+1 (for a time-dependent function)."));
+ AssertThrow(false,
+ ExcMessage(
+ "The list of variables specified is <" + vnames +
+ "> which is a list of length " +
+ Utilities::int_to_string(nn) +
+ " but it has to be a list of length equal to" +
+ " either dim (for a time-independent function)" +
+ " or dim+1 (for a time-dependent function)."));
}
}
{
namespace MPI
{
- Partitioner::Partitioner() :
- global_size(0),
- local_range_data(
- std::pair<types::global_dof_index, types::global_dof_index>(0, 0)),
- n_ghost_indices_data(0),
- n_import_indices_data(0),
- n_ghost_indices_in_larger_set(0),
- my_pid(0),
- n_procs(1),
- communicator(MPI_COMM_SELF),
- have_ghost_indices(false)
+ Partitioner::Partitioner()
+ : global_size(0)
+ , local_range_data(
+ std::pair<types::global_dof_index, types::global_dof_index>(0, 0))
+ , n_ghost_indices_data(0)
+ , n_import_indices_data(0)
+ , n_ghost_indices_in_larger_set(0)
+ , my_pid(0)
+ , n_procs(1)
+ , communicator(MPI_COMM_SELF)
+ , have_ghost_indices(false)
{}
- Partitioner::Partitioner(const unsigned int size) :
- global_size(size),
- locally_owned_range_data(size),
- local_range_data(
- std::pair<types::global_dof_index, types::global_dof_index>(0, size)),
- n_ghost_indices_data(0),
- n_import_indices_data(0),
- n_ghost_indices_in_larger_set(0),
- my_pid(0),
- n_procs(1),
- communicator(MPI_COMM_SELF),
- have_ghost_indices(false)
+ Partitioner::Partitioner(const unsigned int size)
+ : global_size(size)
+ , locally_owned_range_data(size)
+ , local_range_data(
+ std::pair<types::global_dof_index, types::global_dof_index>(0, size))
+ , n_ghost_indices_data(0)
+ , n_import_indices_data(0)
+ , n_ghost_indices_in_larger_set(0)
+ , my_pid(0)
+ , n_procs(1)
+ , communicator(MPI_COMM_SELF)
+ , have_ghost_indices(false)
{
locally_owned_range_data.add_range(0, size);
locally_owned_range_data.compress();
Partitioner::Partitioner(const IndexSet &locally_owned_indices,
const IndexSet &ghost_indices_in,
- const MPI_Comm communicator_in) :
- global_size(
- static_cast<types::global_dof_index>(locally_owned_indices.size())),
- n_ghost_indices_data(0),
- n_import_indices_data(0),
- n_ghost_indices_in_larger_set(0),
- my_pid(0),
- n_procs(1),
- communicator(communicator_in),
- have_ghost_indices(false)
+ const MPI_Comm communicator_in)
+ : global_size(
+ static_cast<types::global_dof_index>(locally_owned_indices.size()))
+ , n_ghost_indices_data(0)
+ , n_import_indices_data(0)
+ , n_ghost_indices_in_larger_set(0)
+ , my_pid(0)
+ , n_procs(1)
+ , communicator(communicator_in)
+ , have_ghost_indices(false)
{
set_owned_indices(locally_owned_indices);
set_ghost_indices(ghost_indices_in);
Partitioner::Partitioner(const IndexSet &locally_owned_indices,
- const MPI_Comm communicator_in) :
- global_size(
- static_cast<types::global_dof_index>(locally_owned_indices.size())),
- n_ghost_indices_data(0),
- n_import_indices_data(0),
- n_ghost_indices_in_larger_set(0),
- my_pid(0),
- n_procs(1),
- communicator(communicator_in),
- have_ghost_indices(false)
+ const MPI_Comm communicator_in)
+ : global_size(
+ static_cast<types::global_dof_index>(locally_owned_indices.size()))
+ , n_ghost_indices_data(0)
+ , n_import_indices_data(0)
+ , n_ghost_indices_in_larger_set(0)
+ , my_pid(0)
+ , n_procs(1)
+ , communicator(communicator_in)
+ , have_ghost_indices(false)
{
set_owned_indices(locally_owned_indices);
}
if (larger_ghost_index_set.size() == 0)
{
ghost_indices_subset_chunks_by_rank_data.clear();
- ghost_indices_subset_data.emplace_back(
- local_size(), local_size() + n_ghost_indices());
+ ghost_indices_subset_data.emplace_back(local_size(),
+ local_size() +
+ n_ghost_indices());
n_ghost_indices_in_larger_set = n_ghost_indices_data;
}
else
if (expanded_numbering[i] == last_index + 1)
ghost_indices_subset.back().second++;
else
- ghost_indices_subset.emplace_back(
- expanded_numbering[i], expanded_numbering[i] + 1);
+ ghost_indices_subset.emplace_back(expanded_numbering[i],
+ expanded_numbering[i] +
+ 1);
last_index = expanded_numbering[i];
}
shift += ghost_targets_data[p].second;
if (Utilities::MPI::job_supports_mpi())
{
int communicators_same = 0;
- const int ierr = MPI_Comm_compare(
- part.communicator, communicator, &communicators_same);
+ const int ierr = MPI_Comm_compare(part.communicator,
+ communicator,
+ &communicators_same);
AssertThrowMPI(ierr);
if (!(communicators_same == MPI_IDENT ||
communicators_same == MPI_CONGRUENT))
for (SCALAR : MPI_SCALARS)
{
#ifdef DEAL_II_WITH_MPI
- template void
- Utilities::MPI::Partitioner::export_to_ghosted_array_start<SCALAR>(
- const unsigned int,
- const ArrayView<const SCALAR> &,
- const ArrayView<SCALAR> &,
- const ArrayView<SCALAR> &,
- std::vector<MPI_Request> &) const;
- template void
- Utilities::MPI::Partitioner::export_to_ghosted_array_finish<SCALAR>(
- const ArrayView<SCALAR> &, std::vector<MPI_Request> &) const;
- template void
- Utilities::MPI::Partitioner::import_from_ghosted_array_start<SCALAR>(
- const VectorOperation::values,
- const unsigned int,
- const ArrayView<SCALAR> &,
- const ArrayView<SCALAR> &,
- std::vector<MPI_Request> &) const;
- template void
- Utilities::MPI::Partitioner::import_from_ghosted_array_finish<SCALAR>(
- const VectorOperation::values,
- const ArrayView<const SCALAR> &,
- const ArrayView<SCALAR> &,
- const ArrayView<SCALAR> &,
- std::vector<MPI_Request> &) const;
+ template void Utilities::MPI::Partitioner::export_to_ghosted_array_start<
+ SCALAR>(const unsigned int,
+ const ArrayView<const SCALAR> &,
+ const ArrayView<SCALAR> &,
+ const ArrayView<SCALAR> &,
+ std::vector<MPI_Request> &) const;
+ template void Utilities::MPI::Partitioner::export_to_ghosted_array_finish<
+ SCALAR>(const ArrayView<SCALAR> &, std::vector<MPI_Request> &) const;
+ template void Utilities::MPI::Partitioner::import_from_ghosted_array_start<
+ SCALAR>(const VectorOperation::values,
+ const unsigned int,
+ const ArrayView<SCALAR> &,
+ const ArrayView<SCALAR> &,
+ std::vector<MPI_Request> &) const;
+ template void Utilities::MPI::Partitioner::import_from_ghosted_array_finish<
+ SCALAR>(const VectorOperation::values,
+ const ArrayView<const SCALAR> &,
+ const ArrayView<SCALAR> &,
+ const ArrayView<SCALAR> &,
+ std::vector<MPI_Request> &) const;
#endif
}
}
-PathSearch::PathSearch(const std::string &cls, const unsigned int debug) :
- cls(cls),
- my_path_list(get_path_list(cls)),
- my_suffix_list(get_suffix_list(cls)),
- debug(debug)
+PathSearch::PathSearch(const std::string &cls, const unsigned int debug)
+ : cls(cls)
+ , my_path_list(get_path_list(cls))
+ , my_suffix_list(get_suffix_list(cls))
+ , debug(debug)
{}
const char *Integer::description_init = "[Integer";
- Integer::Integer(const int lower_bound, const int upper_bound) :
- lower_bound(lower_bound),
- upper_bound(upper_bound)
+ Integer::Integer(const int lower_bound, const int upper_bound)
+ : lower_bound(lower_bound)
+ , upper_bound(upper_bound)
{}
std::unique_ptr<Integer>
Integer::create(const std::string &description)
{
- if (description.compare(
- 0, std::strlen(description_init), description_init) == 0)
+ if (description.compare(0,
+ std::strlen(description_init),
+ description_init) == 0)
{
std::istringstream is(description);
const char *Double::description_init = "[Double";
- Double::Double(const double lower_bound, const double upper_bound) :
- lower_bound(lower_bound),
- upper_bound(upper_bound)
+ Double::Double(const double lower_bound, const double upper_bound)
+ : lower_bound(lower_bound)
+ , upper_bound(upper_bound)
{}
Double::create(const std::string &description)
{
const std::string description_init_str = description_init;
- if (description.compare(
- 0, description_init_str.size(), description_init_str) != 0)
+ if (description.compare(0,
+ description_init_str.size(),
+ description_init_str) != 0)
return std::unique_ptr<Double>();
if (*description.rbegin() != ']')
return std::unique_ptr<Double>();
const char *Selection::description_init = "[Selection";
- Selection::Selection(const std::string &seq) : sequence(seq)
+ Selection::Selection(const std::string &seq)
+ : sequence(seq)
{
while (sequence.find(" |") != std::string::npos)
sequence.replace(sequence.find(" |"), 2, "|");
std::unique_ptr<Selection>
Selection::create(const std::string &description)
{
- if (description.compare(
- 0, std::strlen(description_init), description_init) == 0)
+ if (description.compare(0,
+ std::strlen(description_init),
+ description_init) == 0)
{
std::string sequence(description);
List::List(const PatternBase &p,
const unsigned int min_elements,
const unsigned int max_elements,
- const std::string &separator) :
- pattern(p.clone()),
- min_elements(min_elements),
- max_elements(max_elements),
- separator(separator)
+ const std::string &separator)
+ : pattern(p.clone())
+ , min_elements(min_elements)
+ , max_elements(max_elements)
+ , separator(separator)
{
Assert(min_elements <= max_elements,
ExcInvalidRange(min_elements, max_elements));
- List::List(const List &other) :
- pattern(other.pattern->clone()),
- min_elements(other.min_elements),
- max_elements(other.max_elements),
- separator(other.separator)
+ List::List(const List &other)
+ : pattern(other.pattern->clone())
+ , min_elements(other.min_elements)
+ , max_elements(other.max_elements)
+ , separator(other.separator)
{}
std::unique_ptr<List>
List::create(const std::string &description)
{
- if (description.compare(
- 0, std::strlen(description_init), description_init) == 0)
+ if (description.compare(0,
+ std::strlen(description_init),
+ description_init) == 0)
{
unsigned int min_elements = 0, max_elements = 0;
else
separator = ",";
- return std_cxx14::make_unique<List>(
- *base_pattern, min_elements, max_elements, separator);
+ return std_cxx14::make_unique<List>(*base_pattern,
+ min_elements,
+ max_elements,
+ separator);
}
else
return std::unique_ptr<List>();
const unsigned int min_elements,
const unsigned int max_elements,
const std::string &separator,
- const std::string &key_value_separator) :
- key_pattern(p_key.clone()),
- value_pattern(p_value.clone()),
- min_elements(min_elements),
- max_elements(max_elements),
- separator(separator),
- key_value_separator(key_value_separator)
+ const std::string &key_value_separator)
+ : key_pattern(p_key.clone())
+ , value_pattern(p_value.clone())
+ , min_elements(min_elements)
+ , max_elements(max_elements)
+ , separator(separator)
+ , key_value_separator(key_value_separator)
{
Assert(min_elements <= max_elements,
ExcInvalidRange(min_elements, max_elements));
ExcMessage("The separator must have a non-zero length."));
Assert(key_value_separator.size() > 0,
ExcMessage("The key_value_separator must have a non-zero length."));
- Assert(
- separator != key_value_separator,
- ExcMessage("The separator can not be the same of the key_value_separator "
- "since that is used as the separator between the two elements "
- "of <key:value> pairs"));
+ Assert(separator != key_value_separator,
+ ExcMessage(
+ "The separator can not be the same of the key_value_separator "
+ "since that is used as the separator between the two elements "
+ "of <key:value> pairs"));
}
- Map::Map(const Map &other) :
- key_pattern(other.key_pattern->clone()),
- value_pattern(other.value_pattern->clone()),
- min_elements(other.min_elements),
- max_elements(other.max_elements),
- separator(other.separator),
- key_value_separator(other.key_value_separator)
+ Map::Map(const Map &other)
+ : key_pattern(other.key_pattern->clone())
+ , value_pattern(other.value_pattern->clone())
+ , min_elements(other.min_elements)
+ , max_elements(other.max_elements)
+ , separator(other.separator)
+ , key_value_separator(other.key_value_separator)
{}
std::unique_ptr<Map>
Map::create(const std::string &description)
{
- if (description.compare(
- 0, std::strlen(description_init), description_init) == 0)
+ if (description.compare(0,
+ std::strlen(description_init),
+ description_init) == 0)
{
unsigned int min_elements = 0, max_elements = 0;
is.ignore(strlen("..."));
if (!(is >> max_elements))
- return std_cxx14::make_unique<Map>(
- *key_pattern, *value_pattern, min_elements);
+ return std_cxx14::make_unique<Map>(*key_pattern,
+ *value_pattern,
+ min_elements);
is.ignore(strlen(" (inclusive) separated by <"));
std::string separator;
Tuple::Tuple(const std::vector<std::unique_ptr<PatternBase>> &ps,
- const std::string & separator) :
- separator(separator)
+ const std::string & separator)
+ : separator(separator)
{
Assert(ps.size() > 0,
ExcMessage("The Patterns list must have a non-zero length."));
Tuple::Tuple(const std::vector<std::unique_ptr<PatternBase>> &ps,
- const char * separator) :
- Tuple(ps, std::string(separator))
+ const char * separator)
+ : Tuple(ps, std::string(separator))
{}
- Tuple::Tuple(const Tuple &other) : separator(other.separator)
+ Tuple::Tuple(const Tuple &other)
+ : separator(other.separator)
{
patterns.resize(other.patterns.size());
for (unsigned int i = 0; i < other.patterns.size(); ++i)
std::unique_ptr<Tuple>
Tuple::create(const std::string &description)
{
- if (description.compare(
- 0, std::strlen(description_init), description_init) == 0)
+ if (description.compare(0,
+ std::strlen(description_init),
+ description_init) == 0)
{
std::vector<std::unique_ptr<PatternBase>> patterns;
std::unique_ptr<MultipleSelection>
MultipleSelection::create(const std::string &description)
{
- if (description.compare(
- 0, std::strlen(description_init), description_init) == 0)
+ if (description.compare(0,
+ std::strlen(description_init),
+ description_init) == 0)
{
std::string sequence(description);
const char *Bool::description_init = "[Bool";
- Bool::Bool() : Selection("true|false")
+ Bool::Bool()
+ : Selection("true|false")
{}
std::unique_ptr<Bool>
Bool::create(const std::string &description)
{
- if (description.compare(
- 0, std::strlen(description_init), description_init) == 0)
+ if (description.compare(0,
+ std::strlen(description_init),
+ description_init) == 0)
return std_cxx14::make_unique<Bool>();
else
return std::unique_ptr<Bool>();
std::unique_ptr<Anything>
Anything::create(const std::string &description)
{
- if (description.compare(
- 0, std::strlen(description_init), description_init) == 0)
+ if (description.compare(0,
+ std::strlen(description_init),
+ description_init) == 0)
return std_cxx14::make_unique<Anything>();
else
return std::unique_ptr<Anything>();
const char *FileName::description_init = "[FileName";
- FileName::FileName(const FileType type) : file_type(type)
+ FileName::FileName(const FileType type)
+ : file_type(type)
{}
std::unique_ptr<FileName>
FileName::create(const std::string &description)
{
- if (description.compare(
- 0, std::strlen(description_init), description_init) == 0)
+ if (description.compare(0,
+ std::strlen(description_init),
+ description_init) == 0)
{
std::istringstream is(description);
std::string file_type;
std::unique_ptr<DirectoryName>
DirectoryName::create(const std::string &description)
{
- if (description.compare(
- 0, std::strlen(description_init), description_init) == 0)
+ if (description.compare(0,
+ std::strlen(description_init),
+ description_init) == 0)
return std_cxx14::make_unique<DirectoryName>();
else
return std::unique_ptr<DirectoryName>();
template <typename number>
- Polynomial<number>::Polynomial(const std::vector<number> &a) :
- coefficients(a),
- in_lagrange_product_form(false),
- lagrange_weight(1.)
+ Polynomial<number>::Polynomial(const std::vector<number> &a)
+ : coefficients(a)
+ , in_lagrange_product_form(false)
+ , lagrange_weight(1.)
{}
template <typename number>
- Polynomial<number>::Polynomial(const unsigned int n) :
- coefficients(n + 1, 0.),
- in_lagrange_product_form(false),
- lagrange_weight(1.)
+ Polynomial<number>::Polynomial(const unsigned int n)
+ : coefficients(n + 1, 0.)
+ , in_lagrange_product_form(false)
+ , lagrange_weight(1.)
{}
template <typename number>
Polynomial<number>::Polynomial(const std::vector<Point<1>> &supp,
- const unsigned int center) :
- in_lagrange_product_form(true)
+ const unsigned int center)
+ : in_lagrange_product_form(true)
{
Assert(supp.size() > 0, ExcEmptyObject());
AssertIndexRange(center, supp.size());
template <typename number>
- Monomial<number>::Monomial(unsigned int n, double coefficient) :
- Polynomial<number>(make_vector(n, coefficient))
+ Monomial<number>::Monomial(unsigned int n, double coefficient)
+ : Polynomial<number>(make_vector(n, coefficient))
{}
LagrangeEquidistant::LagrangeEquidistant(const unsigned int n,
- const unsigned int support_point) :
- Polynomial<double>(internal::LagrangeEquidistantImplementation::
- generate_equidistant_unit_points(n),
- support_point)
+ const unsigned int support_point)
+ : Polynomial<double>(internal::LagrangeEquidistantImplementation::
+ generate_equidistant_unit_points(n),
+ support_point)
{
Assert(coefficients.size() == 0, ExcInternalError());
- Legendre::Legendre(const unsigned int k) : Polynomial<double>(0)
+ Legendre::Legendre(const unsigned int k)
+ : Polynomial<double>(0)
{
this->coefficients.clear();
this->in_lagrange_product_form = true;
// ------------------ class Lobatto -------------------- //
- Lobatto::Lobatto(const unsigned int p) :
- Polynomial<double>(compute_coefficients(p))
+ Lobatto::Lobatto(const unsigned int p)
+ : Polynomial<double>(compute_coefficients(p))
{}
std::vector<double>
- Hierarchical::Hierarchical(const unsigned int k) :
- Polynomial<double>(get_coefficients(k))
+ Hierarchical::Hierarchical(const unsigned int k)
+ : Polynomial<double>(get_coefficients(k))
{}
// ------------------ HermiteInterpolation --------------- //
- HermiteInterpolation::HermiteInterpolation(const unsigned int p) :
- Polynomial<double>(0)
+ HermiteInterpolation::HermiteInterpolation(const unsigned int p)
+ : Polynomial<double>(0)
{
this->coefficients.clear();
this->in_lagrange_product_form = true;
HermiteLikeInterpolation::HermiteLikeInterpolation(const unsigned int degree,
- const unsigned int index) :
- Polynomial<double>(0)
+ const unsigned int index)
+ : Polynomial<double>(0)
{
AssertIndexRange(index, degree + 1);
} // namespace
template <int dim>
-PolynomialsABF<dim>::PolynomialsABF(const unsigned int k) :
- my_degree(k),
- polynomial_space(get_abf_polynomials<dim>(k)),
- n_pols(compute_n_pols(k))
+PolynomialsABF<dim>::PolynomialsABF(const unsigned int k)
+ : my_degree(k)
+ , polynomial_space(get_abf_polynomials<dim>(k))
+ , n_pols(compute_n_pols(k))
{
// check that the dimensions match. we only store one of the 'dim'
// anisotropic polynomials that make up the vector-valued space, so
DEAL_II_NAMESPACE_OPEN
-PolynomialsAdini::PolynomialsAdini() :
- coef(12, 12),
- dx(12, 12),
- dy(12, 12),
- dxx(12, 12),
- dyy(12, 12),
- dxy(12, 12)
+PolynomialsAdini::PolynomialsAdini()
+ : coef(12, 12)
+ , dx(12, 12)
+ , dy(12, 12)
+ , dxx(12, 12)
+ , dyy(12, 12)
+ , dxy(12, 12)
{
// 1 x y xx yy xy 3x 3y xyy xxy 3xy x3y
// 0 1 2 3 4 5 6 7 8 9 10 11
template <int dim>
-PolynomialsBDM<dim>::PolynomialsBDM(const unsigned int k) :
- polynomial_space(Polynomials::Legendre::generate_complete_basis(k)),
- monomials((dim == 2) ? (1) : (k + 2)),
- n_pols(compute_n_pols(k)),
- p_values(polynomial_space.n()),
- p_grads(polynomial_space.n()),
- p_grad_grads(polynomial_space.n())
+PolynomialsBDM<dim>::PolynomialsBDM(const unsigned int k)
+ : polynomial_space(Polynomials::Legendre::generate_complete_basis(k))
+ , monomials((dim == 2) ? (1) : (k + 2))
+ , n_pols(compute_n_pols(k))
+ , p_values(polynomial_space.n())
+ , p_grads(polynomial_space.n())
+ , p_grad_grads(polynomial_space.n())
{
switch (dim)
{
template <typename number>
PolynomialsBernstein<number>::PolynomialsBernstein(const unsigned int index,
- const unsigned int degree) :
- Polynomials::Polynomial<number>(
- get_bernstein_coefficients<number>(index, degree))
+ const unsigned int degree)
+ : Polynomials::Polynomial<number>(
+ get_bernstein_coefficients<number>(index, degree))
{}
DEAL_II_NAMESPACE_OPEN
-IntegratedLegendreSZ::IntegratedLegendreSZ(const unsigned int k) :
- Polynomials::Polynomial<double>(get_coefficients(k))
+IntegratedLegendreSZ::IntegratedLegendreSZ(const unsigned int k)
+ : Polynomials::Polynomial<double>(get_coefficients(k))
{}
template <int dim>
-PolynomialsNedelec<dim>::PolynomialsNedelec(const unsigned int k) :
- my_degree(k),
- polynomial_space(create_polynomials(k)),
- n_pols(compute_n_pols(k))
+PolynomialsNedelec<dim>::PolynomialsNedelec(const unsigned int k)
+ : my_degree(k)
+ , polynomial_space(create_polynomials(k))
+ , n_pols(compute_n_pols(k))
{}
template <int dim>
template <int dim>
-PolynomialsP<dim>::PolynomialsP(const unsigned int p) :
- PolynomialSpace<dim>(
- Polynomials::Monomial<double>::generate_complete_basis(p)),
- p(p)
+PolynomialsP<dim>::PolynomialsP(const unsigned int p)
+ : PolynomialSpace<dim>(
+ Polynomials::Monomial<double>::generate_complete_basis(p))
+ , p(p)
{
std::vector<unsigned int> index_map(this->n());
create_polynomial_ordering(index_map);
namespace
{
- const unsigned int imap3[4][20] = {
- {0},
- {0, 1, 2, 3},
- {0, 1, 3, 6, 4, 7, 8, 2, 5, 9},
- {0, 1, 4, 10, 5, 11, 13, 2, 7, 16, 14, 6, 12, 8, 15, 17, 18, 3, 9, 19}};
+ const unsigned int imap3[4][20] = {{0},
+ {0, 1, 2, 3},
+ {0, 1, 3, 6, 4, 7, 8, 2, 5, 9},
+ {0, 1, 4, 10, 5, 11, 13, 2, 7, 16,
+ 14, 6, 12, 8, 15, 17, 18, 3, 9, 19}};
}
template <>
const Polynomial<number> &coefficients_on_interval,
const unsigned int n_intervals,
const unsigned int interval,
- const bool spans_next_interval) :
- polynomial(coefficients_on_interval),
- n_intervals(n_intervals),
- interval(interval),
- spans_two_intervals(spans_next_interval)
+ const bool spans_next_interval)
+ : polynomial(coefficients_on_interval)
+ , n_intervals(n_intervals)
+ , interval(interval)
+ , spans_two_intervals(spans_next_interval)
{
Assert(n_intervals > 0, ExcMessage("No intervals given"));
AssertIndexRange(interval, n_intervals);
template <int dim>
-PolynomialsRaviartThomas<dim>::PolynomialsRaviartThomas(const unsigned int k) :
- my_degree(k),
- polynomial_space(create_polynomials(k)),
- n_pols(compute_n_pols(k))
+PolynomialsRaviartThomas<dim>::PolynomialsRaviartThomas(const unsigned int k)
+ : my_degree(k)
+ , polynomial_space(create_polynomials(k))
+ , n_pols(compute_n_pols(k))
{}
template <int dim>
-PolynomialsRT_Bubbles<dim>::PolynomialsRT_Bubbles(const unsigned int k) :
- my_degree(k),
- raviart_thomas_space(k - 1),
- monomials(k + 2),
- n_pols(compute_n_pols(k))
+PolynomialsRT_Bubbles<dim>::PolynomialsRT_Bubbles(const unsigned int k)
+ : my_degree(k)
+ , raviart_thomas_space(k - 1)
+ , monomials(k + 2)
+ , n_pols(compute_n_pols(k))
{
Assert(dim >= 2, ExcImpossibleInDim(dim));
// monoval_i = x^i,
// monoval_plus = x^(k+1)
for (unsigned int d = 0; d < dim; ++d)
- monomials[my_degree + 1].value(
- unit_point(d), n_derivatives, monoval_plus[d]);
+ monomials[my_degree + 1].value(unit_point(d),
+ n_derivatives,
+ monoval_plus[d]);
for (unsigned int i = 0; i <= my_degree; ++i, ++start)
{
// monoval_* = x^*, monoval_jplus = x^(j+1)
for (unsigned int d = 0; d < dim; ++d)
{
- monomials[my_degree + 1].value(
- unit_point(d), n_derivatives, monoval_plus[d]);
+ monomials[my_degree + 1].value(unit_point(d),
+ n_derivatives,
+ monoval_plus[d]);
monomials[my_degree].value(unit_point(d), n_derivatives, monoval[d]);
}
{
for (unsigned int d = 0; d < dim; ++d)
{
- monomials[j].value(
- unit_point(d), n_derivatives, monoval_j[d]);
- monomials[j + 1].value(
- unit_point(d), n_derivatives, monoval_jplus[d]);
+ monomials[j].value(unit_point(d),
+ n_derivatives,
+ monoval_j[d]);
+ monomials[j + 1].value(unit_point(d),
+ n_derivatives,
+ monoval_jplus[d]);
}
if (values.size() != 0)
// finally, get the rows:
int n_process_rows = Np / n_process_columns;
- Assert(
- n_process_columns >= 1 && n_process_rows >= 1 &&
- n_processes >= n_process_rows * n_process_columns,
- ExcMessage("error in process grid: " + std::to_string(n_process_rows) +
- "x" + std::to_string(n_process_columns) + "=" +
- std::to_string(n_process_rows * n_process_columns) +
- " out of " + std::to_string(n_processes)));
+ Assert(n_process_columns >= 1 && n_process_rows >= 1 &&
+ n_processes >= n_process_rows * n_process_columns,
+ ExcMessage(
+ "error in process grid: " + std::to_string(n_process_rows) + "x" +
+ std::to_string(n_process_columns) + "=" +
+ std::to_string(n_process_rows * n_process_columns) + " out of " +
+ std::to_string(n_processes)));
return std::make_pair(n_process_rows, n_process_columns);
{
ProcessGrid::ProcessGrid(
MPI_Comm mpi_comm,
- const std::pair<unsigned int, unsigned int> &grid_dimensions) :
- mpi_communicator(mpi_comm),
- this_mpi_process(Utilities::MPI::this_mpi_process(mpi_communicator)),
- n_mpi_processes(Utilities::MPI::n_mpi_processes(mpi_communicator)),
- n_process_rows(grid_dimensions.first),
- n_process_columns(grid_dimensions.second)
+ const std::pair<unsigned int, unsigned int> &grid_dimensions)
+ : mpi_communicator(mpi_comm)
+ , this_mpi_process(Utilities::MPI::this_mpi_process(mpi_communicator))
+ , n_mpi_processes(Utilities::MPI::n_mpi_processes(mpi_communicator))
+ , n_process_rows(grid_dimensions.first)
+ , n_process_columns(grid_dimensions.second)
{
Assert(grid_dimensions.first > 0,
ExcMessage("Number of process grid rows has to be positive."));
const unsigned int n_rows_matrix,
const unsigned int n_columns_matrix,
const unsigned int row_block_size,
- const unsigned int column_block_size) :
- ProcessGrid(mpi_comm,
- compute_processor_grid_sizes(mpi_comm,
- n_rows_matrix,
- n_columns_matrix,
- row_block_size,
- column_block_size))
+ const unsigned int column_block_size)
+ : ProcessGrid(mpi_comm,
+ compute_processor_grid_sizes(mpi_comm,
+ n_rows_matrix,
+ n_columns_matrix,
+ row_block_size,
+ column_block_size))
{}
ProcessGrid::ProcessGrid(MPI_Comm mpi_comm,
const unsigned int n_rows,
- const unsigned int n_columns) :
- ProcessGrid(mpi_comm, std::make_pair(n_rows, n_columns))
+ const unsigned int n_columns)
+ : ProcessGrid(mpi_comm, std::make_pair(n_rows, n_columns))
{}
template <>
-Quadrature<0>::Quadrature(const unsigned int n_q) :
- quadrature_points(n_q),
- weights(n_q, 0),
- is_tensor_product_flag(false)
+Quadrature<0>::Quadrature(const unsigned int n_q)
+ : quadrature_points(n_q)
+ , weights(n_q, 0)
+ , is_tensor_product_flag(false)
{}
template <int dim>
-Quadrature<dim>::Quadrature(const unsigned int n_q) :
- quadrature_points(n_q, Point<dim>()),
- weights(n_q, 0),
- is_tensor_product_flag(dim == 1)
+Quadrature<dim>::Quadrature(const unsigned int n_q)
+ : quadrature_points(n_q, Point<dim>())
+ , weights(n_q, 0)
+ , is_tensor_product_flag(dim == 1)
{}
template <int dim>
Quadrature<dim>::Quadrature(const std::vector<Point<dim>> &points,
- const std::vector<double> & weights) :
- quadrature_points(points),
- weights(weights),
- is_tensor_product_flag(dim == 1)
+ const std::vector<double> & weights)
+ : quadrature_points(points)
+ , weights(weights)
+ , is_tensor_product_flag(dim == 1)
{
Assert(weights.size() == points.size(),
ExcDimensionMismatch(weights.size(), points.size()));
template <int dim>
-Quadrature<dim>::Quadrature(const std::vector<Point<dim>> &points) :
- quadrature_points(points),
- weights(points.size(), std::numeric_limits<double>::infinity()),
- is_tensor_product_flag(dim == 1)
+Quadrature<dim>::Quadrature(const std::vector<Point<dim>> &points)
+ : quadrature_points(points)
+ , weights(points.size(), std::numeric_limits<double>::infinity())
+ , is_tensor_product_flag(dim == 1)
{
Assert(weights.size() == points.size(),
ExcDimensionMismatch(weights.size(), points.size()));
template <int dim>
-Quadrature<dim>::Quadrature(const Point<dim> &point) :
- quadrature_points(std::vector<Point<dim>>(1, point)),
- weights(std::vector<double>(1, 1.)),
- is_tensor_product_flag(true),
- tensor_basis(new std::array<Quadrature<1>, dim>())
+Quadrature<dim>::Quadrature(const Point<dim> &point)
+ : quadrature_points(std::vector<Point<dim>>(1, point))
+ , weights(std::vector<double>(1, 1.))
+ , is_tensor_product_flag(true)
+ , tensor_basis(new std::array<Quadrature<1>, dim>())
{
for (unsigned int i = 0; i < dim; ++i)
{
template <>
-Quadrature<1>::Quadrature(const Point<1> &point) :
- quadrature_points(std::vector<Point<1>>(1, point)),
- weights(std::vector<double>(1, 1.)),
- is_tensor_product_flag(true)
+Quadrature<1>::Quadrature(const Point<1> &point)
+ : quadrature_points(std::vector<Point<1>>(1, point))
+ , weights(std::vector<double>(1, 1.))
+ , is_tensor_product_flag(true)
{}
template <int dim>
-Quadrature<dim>::Quadrature(const SubQuadrature &q1, const Quadrature<1> &q2) :
- quadrature_points(q1.size() * q2.size()),
- weights(q1.size() * q2.size()),
- is_tensor_product_flag(q1.is_tensor_product())
+Quadrature<dim>::Quadrature(const SubQuadrature &q1, const Quadrature<1> &q2)
+ : quadrature_points(q1.size() * q2.size())
+ , weights(q1.size() * q2.size())
+ , is_tensor_product_flag(q1.is_tensor_product())
{
unsigned int present_index = 0;
for (unsigned int i2 = 0; i2 < q2.size(); ++i2)
template <>
-Quadrature<1>::Quadrature(const SubQuadrature &, const Quadrature<1> &q2) :
- quadrature_points(q2.size()),
- weights(q2.size()),
- is_tensor_product_flag(true)
+Quadrature<1>::Quadrature(const SubQuadrature &, const Quadrature<1> &q2)
+ : quadrature_points(q2.size())
+ , weights(q2.size())
+ , is_tensor_product_flag(true)
{
unsigned int present_index = 0;
for (unsigned int i2 = 0; i2 < q2.size(); ++i2)
template <>
-Quadrature<0>::Quadrature(const Quadrature<1> &) :
- Subscriptor(),
+Quadrature<0>::Quadrature(const Quadrature<1> &)
+ : Subscriptor()
+ ,
// quadrature_points(1),
- weights(1, 1.),
- is_tensor_product_flag(false)
+ weights(1, 1.)
+ , is_tensor_product_flag(false)
{}
template <>
-Quadrature<1>::Quadrature(const Quadrature<0> &) : Subscriptor()
+Quadrature<1>::Quadrature(const Quadrature<0> &)
+ : Subscriptor()
{
// this function should never be
// called -- this should be the
template <int dim>
-Quadrature<dim>::Quadrature(const Quadrature<dim != 1 ? 1 : 0> &q) :
- Subscriptor(),
- quadrature_points(Utilities::fixed_power<dim>(q.size())),
- weights(Utilities::fixed_power<dim>(q.size())),
- is_tensor_product_flag(true)
+Quadrature<dim>::Quadrature(const Quadrature<dim != 1 ? 1 : 0> &q)
+ : Subscriptor()
+ , quadrature_points(Utilities::fixed_power<dim>(q.size()))
+ , weights(Utilities::fixed_power<dim>(q.size()))
+ , is_tensor_product_flag(true)
{
Assert(dim <= 3, ExcNotImplemented());
template <int dim>
-Quadrature<dim>::Quadrature(const Quadrature<dim> &q) :
- Subscriptor(),
- quadrature_points(q.quadrature_points),
- weights(q.weights),
- is_tensor_product_flag(q.is_tensor_product_flag)
+Quadrature<dim>::Quadrature(const Quadrature<dim> &q)
+ : Subscriptor()
+ , quadrature_points(q.quadrature_points)
+ , weights(q.weights)
+ , is_tensor_product_flag(q.is_tensor_product_flag)
{
if (dim > 1 && is_tensor_product_flag)
tensor_basis =
//---------------------------------------------------------------------------
template <int dim>
-QAnisotropic<dim>::QAnisotropic(const Quadrature<1> &qx) :
- Quadrature<dim>(qx.size())
+QAnisotropic<dim>::QAnisotropic(const Quadrature<1> &qx)
+ : Quadrature<dim>(qx.size())
{
Assert(dim == 1, ExcImpossibleInDim(dim));
unsigned int k = 0;
template <int dim>
QAnisotropic<dim>::QAnisotropic(const Quadrature<1> &qx,
- const Quadrature<1> &qy) :
- Quadrature<dim>(qx.size() * qy.size())
+ const Quadrature<1> &qy)
+ : Quadrature<dim>(qx.size() * qy.size())
{
Assert(dim == 2, ExcImpossibleInDim(dim));
}
template <>
-QAnisotropic<2>::QAnisotropic(const Quadrature<1> &qx,
- const Quadrature<1> &qy) :
- Quadrature<2>(qx.size() * qy.size())
+QAnisotropic<2>::QAnisotropic(const Quadrature<1> &qx, const Quadrature<1> &qy)
+ : Quadrature<2>(qx.size() * qy.size())
{
unsigned int k = 0;
for (unsigned int k2 = 0; k2 < qy.size(); ++k2)
template <int dim>
QAnisotropic<dim>::QAnisotropic(const Quadrature<1> &qx,
const Quadrature<1> &qy,
- const Quadrature<1> &qz) :
- Quadrature<dim>(qx.size() * qy.size() * qz.size())
+ const Quadrature<1> &qz)
+ : Quadrature<dim>(qx.size() * qy.size() * qz.size())
{
Assert(dim == 3, ExcImpossibleInDim(dim));
}
template <>
QAnisotropic<3>::QAnisotropic(const Quadrature<1> &qx,
const Quadrature<1> &qy,
- const Quadrature<1> &qz) :
- Quadrature<3>(qx.size() * qy.size() * qz.size())
+ const Quadrature<1> &qz)
+ : Quadrature<3>(qx.size() * qy.size() * qz.size())
{
unsigned int k = 0;
for (unsigned int k3 = 0; k3 < qz.size(); ++k3)
std::vector<Point<dim>> q_points(n_q_points);
for (unsigned int i = 0; i < n_q_points; ++i)
- q_points[i] = GeometryInfo<dim>::child_to_cell_coordinates(
- quadrature.point(i), child_no);
+ q_points[i] =
+ GeometryInfo<dim>::child_to_cell_coordinates(quadrature.point(i),
+ child_no);
// for the weights, things are
// equally simple: copy them and
template <>
-QIterated<0>::QIterated(const Quadrature<1> &, const unsigned int) :
- Quadrature<0>()
+QIterated<0>::QIterated(const Quadrature<1> &, const unsigned int)
+ : Quadrature<0>()
{
Assert(false, ExcNotImplemented());
}
template <>
QIterated<1>::QIterated(const Quadrature<1> &base_quadrature,
- const unsigned int n_copies) :
- Quadrature<1>(
- internal::QIteratedImplementation::uses_both_endpoints(base_quadrature) ?
- (base_quadrature.size() - 1) * n_copies + 1 :
- base_quadrature.size() * n_copies)
+ const unsigned int n_copies)
+ : Quadrature<1>(
+ internal::QIteratedImplementation::uses_both_endpoints(base_quadrature) ?
+ (base_quadrature.size() - 1) * n_copies + 1 :
+ base_quadrature.size() * n_copies)
{
// fill(*this, base_quadrature, n_copies);
Assert(base_quadrature.size() > 0, ExcNotInitialized());
// of lower dimensional iterated quadrature formulae
template <int dim>
QIterated<dim>::QIterated(const Quadrature<1> &base_quadrature,
- const unsigned int N) :
- Quadrature<dim>(QIterated<dim - 1>(base_quadrature, N),
- QIterated<1>(base_quadrature, N))
+ const unsigned int N)
+ : Quadrature<dim>(QIterated<dim - 1>(base_quadrature, N),
+ QIterated<1>(base_quadrature, N))
{}
template <>
-QGauss<0>::QGauss(const unsigned int) :
- // there are n_q^dim == 1
- // points
+QGauss<0>::QGauss(const unsigned int)
+ : // there are n_q^dim == 1
+ // points
Quadrature<0>(1)
{
// the single quadrature point gets unit
template <>
-QGaussLobatto<0>::QGaussLobatto(const unsigned int) :
- // there are n_q^dim == 1
- // points
+QGaussLobatto<0>::QGaussLobatto(const unsigned int)
+ : // there are n_q^dim == 1
+ // points
Quadrature<0>(1)
{
// the single quadrature point gets unit
template <>
-QGauss<1>::QGauss(const unsigned int n) : Quadrature<1>(n)
+QGauss<1>::QGauss(const unsigned int n)
+ : Quadrature<1>(n)
{
if (n == 0)
return;
template <>
-QGaussLobatto<1>::QGaussLobatto(const unsigned int n) : Quadrature<1>(n)
+QGaussLobatto<1>::QGaussLobatto(const unsigned int n)
+ : Quadrature<1>(n)
{
Assert(n >= 2, ExcNotImplemented());
template <>
-QMidpoint<1>::QMidpoint() : Quadrature<1>(1)
+QMidpoint<1>::QMidpoint()
+ : Quadrature<1>(1)
{
this->quadrature_points[0] = Point<1>(0.5);
this->weights[0] = 1.0;
template <>
-QTrapez<1>::QTrapez() : Quadrature<1>(2)
+QTrapez<1>::QTrapez()
+ : Quadrature<1>(2)
{
static const double xpts[] = {0.0, 1.0};
static const double wts[] = {0.5, 0.5};
template <>
-QSimpson<1>::QSimpson() : Quadrature<1>(3)
+QSimpson<1>::QSimpson()
+ : Quadrature<1>(3)
{
static const double xpts[] = {0.0, 0.5, 1.0};
static const double wts[] = {1. / 6., 2. / 3., 1. / 6.};
template <>
-QMilne<1>::QMilne() : Quadrature<1>(5)
+QMilne<1>::QMilne()
+ : Quadrature<1>(5)
{
static const double xpts[] = {0.0, .25, .5, .75, 1.0};
static const double wts[] = {
template <>
-QWeddle<1>::QWeddle() : Quadrature<1>(7)
+QWeddle<1>::QWeddle()
+ : Quadrature<1>(7)
{
static const double xpts[] = {
0.0, 1. / 6., 1. / 3., .5, 2. / 3., 5. / 6., 1.0};
template <>
-QGaussLog<1>::QGaussLog(const unsigned int n, const bool revert) :
- Quadrature<1>(n)
+QGaussLog<1>::QGaussLog(const unsigned int n, const bool revert)
+ : Quadrature<1>(n)
{
std::vector<double> p = get_quadrature_points(n);
std::vector<double> w = get_quadrature_weights(n);
QGaussLogR<1>::QGaussLogR(const unsigned int n,
const Point<1> origin,
const double alpha,
- const bool factor_out_singularity) :
- Quadrature<1>(
- ((origin[0] == 0) || (origin[0] == 1)) ? (alpha == 1 ? n : 2 * n) : 4 * n),
- fraction(((origin[0] == 0) || (origin[0] == 1.)) ? 1. : origin[0])
+ const bool factor_out_singularity)
+ : Quadrature<1>(
+ ((origin[0] == 0) || (origin[0] == 1)) ? (alpha == 1 ? n : 2 * n) : 4 * n)
+ , fraction(((origin[0] == 0) || (origin[0] == 1.)) ? 1. : origin[0])
{
// The three quadrature formulas that make this one up. There are
// at most two when the origin is one of the extremes, and there is
template <>
QGaussOneOverR<2>::QGaussOneOverR(const unsigned int n,
const Point<2> singularity,
- const bool factor_out_singularity) :
- Quadrature<2>(quad_size(singularity, n))
+ const bool factor_out_singularity)
+ : Quadrature<2>(quad_size(singularity, n))
{
// We treat all the cases in the
// same way. Split the element in 4
template <>
QGaussOneOverR<2>::QGaussOneOverR(const unsigned int n,
const unsigned int vertex_index,
- const bool factor_out_singularity) :
- Quadrature<2>(2 * n * n)
+ const bool factor_out_singularity)
+ : Quadrature<2>(2 * n * n)
{
// This version of the constructor
// works only for the 4
template <int dim>
-QSorted<dim>::QSorted(const Quadrature<dim> &quad) : Quadrature<dim>(quad)
+QSorted<dim>::QSorted(const Quadrature<dim> &quad)
+ : Quadrature<dim>(quad)
{
std::vector<unsigned int> permutation(quad.size());
for (unsigned int i = 0; i < quad.size(); ++i)
// tensor product of lower dimensions
template <int dim>
-QGauss<dim>::QGauss(const unsigned int n) :
- Quadrature<dim>(QGauss<dim - 1>(n), QGauss<1>(n))
+QGauss<dim>::QGauss(const unsigned int n)
+ : Quadrature<dim>(QGauss<dim - 1>(n), QGauss<1>(n))
{}
template <int dim>
-QGaussLobatto<dim>::QGaussLobatto(const unsigned int n) :
- Quadrature<dim>(QGaussLobatto<dim - 1>(n), QGaussLobatto<1>(n))
+QGaussLobatto<dim>::QGaussLobatto(const unsigned int n)
+ : Quadrature<dim>(QGaussLobatto<dim - 1>(n), QGaussLobatto<1>(n))
{}
template <int dim>
-QMidpoint<dim>::QMidpoint() :
- Quadrature<dim>(QMidpoint<dim - 1>(), QMidpoint<1>())
+QMidpoint<dim>::QMidpoint()
+ : Quadrature<dim>(QMidpoint<dim - 1>(), QMidpoint<1>())
{}
template <int dim>
-QTrapez<dim>::QTrapez() : Quadrature<dim>(QTrapez<dim - 1>(), QTrapez<1>())
+QTrapez<dim>::QTrapez()
+ : Quadrature<dim>(QTrapez<dim - 1>(), QTrapez<1>())
{}
template <int dim>
-QSimpson<dim>::QSimpson() : Quadrature<dim>(QSimpson<dim - 1>(), QSimpson<1>())
+QSimpson<dim>::QSimpson()
+ : Quadrature<dim>(QSimpson<dim - 1>(), QSimpson<1>())
{}
template <int dim>
-QMilne<dim>::QMilne() : Quadrature<dim>(QMilne<dim - 1>(), QMilne<1>())
+QMilne<dim>::QMilne()
+ : Quadrature<dim>(QMilne<dim - 1>(), QMilne<1>())
{}
template <int dim>
-QWeddle<dim>::QWeddle() : Quadrature<dim>(QWeddle<dim - 1>(), QWeddle<1>())
+QWeddle<dim>::QWeddle()
+ : Quadrature<dim>(QWeddle<dim - 1>(), QWeddle<1>())
{}
template <int dim>
QTelles<dim>::QTelles(const Quadrature<1> &base_quad,
- const Point<dim> & singularity) :
- // We need the explicit implementation if dim == 1. If dim > 1 we use the
- // former implementation and apply a tensorial product to obtain the higher
- // dimensions.
+ const Point<dim> & singularity)
+ : // We need the explicit implementation if dim == 1. If dim > 1 we use the
+ // former implementation and apply a tensorial product to obtain the higher
+ // dimensions.
Quadrature<dim>(
dim == 2 ?
QAnisotropic<dim>(QTelles<1>(base_quad, Point<1>(singularity[0])),
{}
template <int dim>
-QTelles<dim>::QTelles(const unsigned int n, const Point<dim> &singularity) :
- // In this case we map the standard Gauss Legendre formula using the given
- // singularity point coordinates.
+QTelles<dim>::QTelles(const unsigned int n, const Point<dim> &singularity)
+ : // In this case we map the standard Gauss Legendre formula using the given
+ // singularity point coordinates.
Quadrature<dim>(QTelles<dim>(QGauss<1>(n), singularity))
{}
template <>
-QTelles<1>::QTelles(const Quadrature<1> &base_quad,
- const Point<1> & singularity) :
- // We explicitly implement the Telles' variable change if dim == 1.
+QTelles<1>::QTelles(const Quadrature<1> &base_quad, const Point<1> &singularity)
+ : // We explicitly implement the Telles' variable change if dim == 1.
Quadrature<1>(base_quad)
{
// We define all the constants to be used in the implementation of
template <>
-QGaussChebyshev<1>::QGaussChebyshev(const unsigned int n) : Quadrature<1>(n)
+QGaussChebyshev<1>::QGaussChebyshev(const unsigned int n)
+ : Quadrature<1>(n)
{
Assert(n > 0, ExcMessage("Need at least one point for the quadrature rule"));
std::vector<double> p = internal::QGaussChebyshev::get_quadrature_points(n);
template <int dim>
-QGaussChebyshev<dim>::QGaussChebyshev(const unsigned int n) :
- Quadrature<dim>(QGaussChebyshev<1>(n))
+QGaussChebyshev<dim>::QGaussChebyshev(const unsigned int n)
+ : Quadrature<dim>(QGaussChebyshev<1>(n))
{}
template <>
-QGaussRadauChebyshev<1>::QGaussRadauChebyshev(const unsigned int n,
- EndPoint ep) :
- Quadrature<1>(n),
- ep(ep)
+QGaussRadauChebyshev<1>::QGaussRadauChebyshev(const unsigned int n, EndPoint ep)
+ : Quadrature<1>(n)
+ , ep(ep)
{
Assert(n > 0, ExcMessage("Need at least one point for quadrature rules"));
std::vector<double> p =
template <int dim>
QGaussRadauChebyshev<dim>::QGaussRadauChebyshev(const unsigned int n,
- EndPoint ep) :
- Quadrature<dim>(QGaussRadauChebyshev<1>(
- n,
- static_cast<QGaussRadauChebyshev<1>::EndPoint>(ep))),
- ep(ep)
+ EndPoint ep)
+ : Quadrature<dim>(QGaussRadauChebyshev<1>(
+ n,
+ static_cast<QGaussRadauChebyshev<1>::EndPoint>(ep)))
+ , ep(ep)
{}
template <>
-QGaussLobattoChebyshev<1>::QGaussLobattoChebyshev(const unsigned int n) :
- Quadrature<1>(n)
+QGaussLobattoChebyshev<1>::QGaussLobattoChebyshev(const unsigned int n)
+ : Quadrature<1>(n)
{
- Assert(
- n > 1,
- ExcMessage("Need at least two points for Gauss-Lobatto quadrature rule"));
+ Assert(n > 1,
+ ExcMessage(
+ "Need at least two points for Gauss-Lobatto quadrature rule"));
std::vector<double> p =
internal::QGaussLobattoChebyshev::get_quadrature_points(n);
std::vector<double> w =
template <int dim>
-QGaussLobattoChebyshev<dim>::QGaussLobattoChebyshev(const unsigned int n) :
- Quadrature<dim>(QGaussLobattoChebyshev<1>(n))
+QGaussLobattoChebyshev<dim>::QGaussLobattoChebyshev(const unsigned int n)
+ : Quadrature<dim>(QGaussLobattoChebyshev<1>(n))
{}
QTrianglePolar::QTrianglePolar(const Quadrature<1> &radial_quadrature,
- const Quadrature<1> &angular_quadrature) :
- QSimplex<2>(Quadrature<2>())
+ const Quadrature<1> &angular_quadrature)
+ : QSimplex<2>(Quadrature<2>())
{
const QAnisotropic<2> base(radial_quadrature, angular_quadrature);
this->quadrature_points.resize(base.size());
-QTrianglePolar::QTrianglePolar(const unsigned int &n) :
- QTrianglePolar(QGauss<1>(n), QGauss<1>(n))
+QTrianglePolar::QTrianglePolar(const unsigned int &n)
+ : QTrianglePolar(QGauss<1>(n), QGauss<1>(n))
{}
QDuffy::QDuffy(const Quadrature<1> &radial_quadrature,
const Quadrature<1> &angular_quadrature,
- const double beta) :
- QSimplex<2>(Quadrature<2>())
+ const double beta)
+ : QSimplex<2>(Quadrature<2>())
{
const QAnisotropic<2> base(radial_quadrature, angular_quadrature);
this->quadrature_points.resize(base.size());
-QDuffy::QDuffy(const unsigned int n, const double beta) :
- QDuffy(QGauss<1>(n), QGauss<1>(n), beta)
+QDuffy::QDuffy(const unsigned int n, const double beta)
+ : QDuffy(QGauss<1>(n), QGauss<1>(n), beta)
{}
template <int dim>
QSplit<dim>::QSplit(const QSimplex<dim> &base, const Point<dim> &split_point)
{
- AssertThrow(
- GeometryInfo<dim>::is_inside_unit_cell(split_point, 1e-12),
- ExcMessage("The split point should be inside the unit reference cell."));
+ AssertThrow(GeometryInfo<dim>::is_inside_unit_cell(split_point, 1e-12),
+ ExcMessage(
+ "The split point should be inside the unit reference cell."));
std::array<Point<dim>, dim + 1> vertices;
vertices[0] = split_point;
template <int dim>
QuadratureSelector<dim>::QuadratureSelector(const std::string &s,
- const unsigned int order) :
- Quadrature<dim>(create_quadrature(s, order).get_points(),
- create_quadrature(s, order).get_weights())
+ const unsigned int order)
+ : Quadrature<dim>(create_quadrature(s, order).get_points(),
+ create_quadrature(s, order).get_weights())
{}
static const char *unknown_subscriber = "unknown subscriber";
-Subscriptor::Subscriptor() : counter(0), object_info(nullptr)
+Subscriptor::Subscriptor()
+ : counter(0)
+ , object_info(nullptr)
{
// this has to go somewhere to avoid an extra warning.
(void)unknown_subscriber;
-Subscriptor::Subscriptor(const Subscriptor &) : counter(0), object_info(nullptr)
+Subscriptor::Subscriptor(const Subscriptor &)
+ : counter(0)
+ , object_info(nullptr)
{}
-Subscriptor::Subscriptor(Subscriptor &&subscriptor) noexcept :
- counter(0),
- object_info(subscriptor.object_info)
+Subscriptor::Subscriptor(Subscriptor &&subscriptor) noexcept
+ : counter(0)
+ , object_info(subscriptor.object_info)
{
subscriptor.check_no_subscribers();
}
if (infostring == "")
infostring = "<none>";
- AssertNothrow(
- counter == 0,
- ExcInUse(counter.load(), object_info->name(), infostring));
+ AssertNothrow(counter == 0,
+ ExcInUse(counter.load(),
+ object_info->name(),
+ infostring));
}
else
{
/* ------------------------------------------------ */
-TableHandler::Column::Column(const std::string &tex_caption) :
- tex_caption(tex_caption),
- tex_format("c"),
- precision(4),
- scientific(false),
- flag(0),
- max_length(0)
+TableHandler::Column::Column(const std::string &tex_caption)
+ : tex_caption(tex_caption)
+ , tex_format("c")
+ , precision(4)
+ , scientific(false)
+ , flag(0)
+ , max_length(0)
{}
-TableHandler::Column::Column() :
- tex_caption(),
- tex_format("c"),
- precision(4),
- scientific(false),
- flag(0),
- max_length(0)
+TableHandler::Column::Column()
+ : tex_caption()
+ , tex_format("c")
+ , precision(4)
+ , scientific(false)
+ , flag(0)
+ , max_length(0)
{}
/*---------------------------------------------------------------------*/
-TableHandler::TableHandler() : auto_fill_mode(false)
+TableHandler::TableHandler()
+ : auto_fill_mode(false)
{}
for (std::map<std::string, Column>::iterator p = columns.begin();
p != columns.end();
++p)
- max_col_length = std::max(
- max_col_length, static_cast<unsigned int>(p->second.entries.size()));
+ max_col_length =
+ std::max(max_col_length,
+ static_cast<unsigned int>(p->second.entries.size()));
// then pad all columns to that length with empty strings
col->second.entries.emplace_back("");
internal::TableEntry &entry = col->second.entries.back();
entry.cache_string(col->second.scientific, col->second.precision);
- col->second.max_length = std::max(
- col->second.max_length,
- static_cast<unsigned int>(entry.get_cached_string().length()));
+ col->second.max_length =
+ std::max(col->second.max_length,
+ static_cast<unsigned int>(
+ entry.get_cached_string().length()));
}
}
{
Assert(i < Utilities::fixed_power<dim>(polynomials.size()),
ExcInternalError());
- internal::compute_tensor_index(
- index_map[i], polynomials.size(), polynomials.size(), indices);
+ internal::compute_tensor_index(index_map[i],
+ polynomials.size(),
+ polynomials.size(),
+ indices);
}
else
for (unsigned int i = 0; i < n_polynomials; ++i)
for (unsigned d = 0; d < dim; ++d)
- polynomials[i].value(
- p(d), n_values_and_derivatives, &values_1d[i][d][0]);
+ polynomials[i].value(p(d),
+ n_values_and_derivatives,
+ &values_1d[i][d][0]);
unsigned int indices[3];
unsigned int ind = 0;
template <int dim>
AnisotropicPolynomials<dim>::AnisotropicPolynomials(
- const std::vector<std::vector<Polynomials::Polynomial<double>>> &pols) :
- polynomials(pols),
- n_tensor_pols(get_n_tensor_pols(pols))
+ const std::vector<std::vector<Polynomials::Polynomial<double>>> &pols)
+ : polynomials(pols)
+ , n_tensor_pols(get_n_tensor_pols(pols))
{
Assert(pols.size() == dim, ExcDimensionMismatch(pols.size(), dim));
for (unsigned int d = 0; d < dim; ++d)
#endif
if (dim == 1)
- internal::compute_tensor_index(
- i, polynomials[0].size(), 0 /*not used*/, indices);
+ internal::compute_tensor_index(i,
+ polynomials[0].size(),
+ 0 /*not used*/,
+ indices);
else
- internal::compute_tensor_index(
- i, polynomials[0].size(), polynomials[1].size(), indices);
+ internal::compute_tensor_index(i,
+ polynomials[0].size(),
+ polynomials[1].size(),
+ indices);
}
ExcDimensionMismatch2(grad_grads.size(), max_q_indices + n_bubbles, 0));
Assert(third_derivatives.size() == max_q_indices + n_bubbles ||
third_derivatives.size() == 0,
- ExcDimensionMismatch2(
- third_derivatives.size(), max_q_indices + n_bubbles, 0));
+ ExcDimensionMismatch2(third_derivatives.size(),
+ max_q_indices + n_bubbles,
+ 0));
Assert(fourth_derivatives.size() == max_q_indices + n_bubbles ||
fourth_derivatives.size() == 0,
- ExcDimensionMismatch2(
- fourth_derivatives.size(), max_q_indices + n_bubbles, 0));
+ ExcDimensionMismatch2(fourth_derivatives.size(),
+ max_q_indices + n_bubbles,
+ 0));
bool do_values = false, do_grads = false, do_grad_grads = false;
bool do_3rd_derivatives = false, do_4th_derivatives = false;
ExcDimensionMismatch2(grad_grads.size(), this->n_tensor_pols + 1, 0));
Assert(third_derivatives.size() == this->n_tensor_pols + 1 ||
third_derivatives.size() == 0,
- ExcDimensionMismatch2(
- third_derivatives.size(), this->n_tensor_pols + 1, 0));
+ ExcDimensionMismatch2(third_derivatives.size(),
+ this->n_tensor_pols + 1,
+ 0));
Assert(fourth_derivatives.size() == this->n_tensor_pols + 1 ||
fourth_derivatives.size() == 0,
- ExcDimensionMismatch2(
- fourth_derivatives.size(), this->n_tensor_pols + 1, 0));
+ ExcDimensionMismatch2(fourth_derivatives.size(),
+ this->n_tensor_pols + 1,
+ 0));
// remove slot for const value, go into the base class compute method and
// finally append the const value again
PosixThreadBarrier::PosixThreadBarrier(const unsigned int count,
const char *,
- void *) :
- count(count)
+ void *)
+ : count(count)
{
// throw an exception unless we
// have the special case that a
template <typename clock_type_>
-Timer::ClockMeasurements<clock_type_>::ClockMeasurements() :
- current_lap_start_time(clock_type::now()),
- accumulated_time(duration_type::zero()),
- last_lap_time(duration_type::zero())
+Timer::ClockMeasurements<clock_type_>::ClockMeasurements()
+ : current_lap_start_time(clock_type::now())
+ , accumulated_time(duration_type::zero())
+ , last_lap_time(duration_type::zero())
{}
-Timer::Timer() : Timer(MPI_COMM_SELF, /*sync_lap_times=*/false)
+Timer::Timer()
+ : Timer(MPI_COMM_SELF, /*sync_lap_times=*/false)
{}
-Timer::Timer(MPI_Comm mpi_communicator, const bool sync_lap_times_) :
- running(false),
- mpi_communicator(mpi_communicator),
- sync_lap_times(sync_lap_times_)
+Timer::Timer(MPI_Comm mpi_communicator, const bool sync_lap_times_)
+ : running(false)
+ , mpi_communicator(mpi_communicator)
+ , sync_lap_times(sync_lap_times_)
{
reset();
start();
cpu_times.last_lap_time =
cpu_clock_type::now() - cpu_times.current_lap_start_time;
- last_lap_wall_time_data = Utilities::MPI::min_max_avg(
- internal::TimerImplementation::to_seconds(wall_times.last_lap_time),
- mpi_communicator);
+ last_lap_wall_time_data =
+ Utilities::MPI::min_max_avg(internal::TimerImplementation::to_seconds(
+ wall_times.last_lap_time),
+ mpi_communicator);
if (sync_lap_times)
{
wall_times.last_lap_time =
}
wall_times.accumulated_time += wall_times.last_lap_time;
cpu_times.accumulated_time += cpu_times.last_lap_time;
- accumulated_wall_time_data = Utilities::MPI::min_max_avg(
- internal::TimerImplementation::to_seconds(wall_times.accumulated_time),
- mpi_communicator);
+ accumulated_wall_time_data =
+ Utilities::MPI::min_max_avg(internal::TimerImplementation::to_seconds(
+ wall_times.accumulated_time),
+ mpi_communicator);
}
return internal::TimerImplementation::to_seconds(cpu_times.accumulated_time);
}
}
else
{
- return Utilities::MPI::sum(
- internal::TimerImplementation::to_seconds(cpu_times.accumulated_time),
- mpi_communicator);
+ return Utilities::MPI::sum(internal::TimerImplementation::to_seconds(
+ cpu_times.accumulated_time),
+ mpi_communicator);
}
}
TimerOutput::TimerOutput(std::ostream & stream,
const OutputFrequency output_frequency,
- const OutputType output_type) :
- output_frequency(output_frequency),
- output_type(output_type),
- out_stream(stream, true),
- output_is_enabled(true),
- mpi_communicator(MPI_COMM_SELF)
+ const OutputType output_type)
+ : output_frequency(output_frequency)
+ , output_type(output_type)
+ , out_stream(stream, true)
+ , output_is_enabled(true)
+ , mpi_communicator(MPI_COMM_SELF)
{}
TimerOutput::TimerOutput(ConditionalOStream & stream,
const OutputFrequency output_frequency,
- const OutputType output_type) :
- output_frequency(output_frequency),
- output_type(output_type),
- out_stream(stream),
- output_is_enabled(true),
- mpi_communicator(MPI_COMM_SELF)
+ const OutputType output_type)
+ : output_frequency(output_frequency)
+ , output_type(output_type)
+ , out_stream(stream)
+ , output_is_enabled(true)
+ , mpi_communicator(MPI_COMM_SELF)
{}
TimerOutput::TimerOutput(MPI_Comm mpi_communicator,
std::ostream & stream,
const OutputFrequency output_frequency,
- const OutputType output_type) :
- output_frequency(output_frequency),
- output_type(output_type),
- out_stream(stream, true),
- output_is_enabled(true),
- mpi_communicator(mpi_communicator)
+ const OutputType output_type)
+ : output_frequency(output_frequency)
+ , output_type(output_type)
+ , out_stream(stream, true)
+ , output_is_enabled(true)
+ , mpi_communicator(mpi_communicator)
{}
TimerOutput::TimerOutput(MPI_Comm mpi_communicator,
ConditionalOStream & stream,
const OutputFrequency output_frequency,
- const OutputType output_type) :
- output_frequency(output_frequency),
- output_type(output_type),
- out_stream(stream),
- output_is_enabled(true),
- mpi_communicator(mpi_communicator)
+ const OutputType output_type)
+ : output_frequency(output_frequency)
+ , output_type(output_type)
+ , out_stream(stream)
+ , output_is_enabled(true)
+ , mpi_communicator(mpi_communicator)
{}
// delete the index from the list of
// active ones
- active_sections.erase(std::find(
- active_sections.begin(), active_sections.end(), actual_section_name));
+ active_sections.erase(std::find(active_sections.begin(),
+ active_sections.end(),
+ actual_section_name));
}
char *p;
errno = 0;
const int i = std::strtol(s.c_str(), &p, 10);
- AssertThrow(
- !((errno != 0) || (s.size() == 0) || ((s.size() > 0) && (*p != '\0'))),
- ExcMessage("Can't convert <" + s + "> to an integer."));
+ AssertThrow(!((errno != 0) || (s.size() == 0) ||
+ ((s.size() > 0) && (*p != '\0'))),
+ ExcMessage("Can't convert <" + s + "> to an integer."));
return i;
}
char *p;
errno = 0;
const double d = std::strtod(s.c_str(), &p);
- AssertThrow(
- !((errno != 0) || (s.size() == 0) || ((s.size() > 0) && (*p != '\0'))),
- ExcMessage("Can't convert <" + s + "> to a double."));
+ AssertThrow(!((errno != 0) || (s.size() == 0) ||
+ ((s.size() > 0) && (*p != '\0'))),
+ ExcMessage("Can't convert <" + s + "> to a double."));
return d;
}
// count how many of our own elements would be above this threshold
// and then add to it the number for all the others
- unsigned int my_count = std::count_if(
- criteria.begin(), criteria.end(), [test_threshold](const double c) {
- return c > test_threshold;
- });
+ unsigned int my_count =
+ std::count_if(criteria.begin(),
+ criteria.end(),
+ [test_threshold](const double c) {
+ return c > test_threshold;
+ });
unsigned int total_count;
ierr = MPI_Reduce(&my_count,
{
typename dealii::parallel::distributed::
Triangulation<dim, spacedim>::cell_iterator cell =
- cell_from_quad(
- triangulation, sides[i].treeid, *(sides[i].quad));
+ cell_from_quad(triangulation,
+ sides[i].treeid,
+ *(sides[i].quad));
Assert(cell->is_ghost(),
ExcMessage("ghost quad did not find ghost cell"));
dealii::types::subdomain_id *subid =
{
typename dealii::parallel::distributed::
Triangulation<dim, spacedim>::cell_iterator cell =
- cell_from_quad(
- triangulation, sides[i].treeid, *(sides[i].quad));
+ cell_from_quad(triangulation,
+ sides[i].treeid,
+ *(sides[i].quad));
Assert(!cell->is_ghost(),
ExcMessage("local quad found ghost cell"));
const typename dealii::Triangulation<dim, spacedim>::MeshSmoothing
smooth_grid,
const bool allow_artificial_cells,
- const Settings settings) :
- dealii::parallel::Triangulation<dim, spacedim>(mpi_communicator,
- smooth_grid,
- false),
- settings(settings),
- allow_artificial_cells(allow_artificial_cells)
+ const Settings settings)
+ : dealii::parallel::Triangulation<dim, spacedim>(mpi_communicator,
+ smooth_grid,
+ false)
+ , settings(settings)
+ , allow_artificial_cells(allow_artificial_cells)
{
const auto partition_settings =
(partition_zoltan | partition_metis | partition_zorder |
if (partition_settings == partition_zoltan)
{
# ifndef DEAL_II_TRILINOS_WITH_ZOLTAN
- AssertThrow(
- false,
- ExcMessage("Choosing 'partition_zoltan' requires the library "
- "to be compiled with support for Zoltan! "
- "Instead, you might use 'partition_auto' to select "
- "a partitioning algorithm that is supported "
- "by your current configuration."));
+ AssertThrow(false,
+ ExcMessage(
+ "Choosing 'partition_zoltan' requires the library "
+ "to be compiled with support for Zoltan! "
+ "Instead, you might use 'partition_auto' to select "
+ "a partitioning algorithm that is supported "
+ "by your current configuration."));
# else
GridTools::partition_triangulation(
this->n_subdomains, *this, SparsityTools::Partitioner::zoltan);
else if (partition_settings == partition_metis)
{
# ifndef DEAL_II_WITH_METIS
- AssertThrow(
- false,
- ExcMessage("Choosing 'partition_metis' requires the library "
- "to be compiled with support for METIS! "
- "Instead, you might use 'partition_auto' to select "
- "a partitioning algorithm that is supported "
- "by your current configuration."));
+ AssertThrow(false,
+ ExcMessage(
+ "Choosing 'partition_metis' requires the library "
+ "to be compiled with support for METIS! "
+ "Instead, you might use 'partition_auto' to select "
+ "a partitioning algorithm that is supported "
+ "by your current configuration."));
# else
- GridTools::partition_triangulation(
- this->n_subdomains, *this, SparsityTools::Partitioner::metis);
+ GridTools::partition_triangulation(this->n_subdomains,
+ *this,
+ SparsityTools::Partitioner::metis);
# endif
}
else if (partition_settings == partition_zorder)
{
template <int dim, typename VectorType, typename DoFHandlerType>
SolutionTransfer<dim, VectorType, DoFHandlerType>::SolutionTransfer(
- const DoFHandlerType &dof) :
- dof_handler(&dof, typeid(*this).name()),
- handle(numbers::invalid_unsigned_int)
+ const DoFHandlerType &dof)
+ : dof_handler(&dof, typeid(*this).name())
+ , handle(numbers::invalid_unsigned_int)
{
Assert(
(dynamic_cast<const parallel::distributed::
for (int i = 0; i < l; ++i)
{
- typename Triangulation<dim, spacedim>::cell_iterator cell(
- tria, i, dealii_index);
+ typename Triangulation<dim, spacedim>::cell_iterator cell(tria,
+ i,
+ dealii_index);
if (cell->has_children() == false)
{
cell->clear_coarsen_flag();
dealii_index = cell->child_index(child_id);
}
- typename Triangulation<dim, spacedim>::cell_iterator cell(
- tria, l, dealii_index);
+ typename Triangulation<dim, spacedim>::cell_iterator cell(tria,
+ l,
+ dealii_index);
if (cell->has_children())
delete_all_children<dim, spacedim>(cell);
else
template <int dim, int spacedim>
PartitionWeights<dim, spacedim>::PartitionWeights(
- const std::vector<unsigned int> &cell_weights) :
- cell_weights_list(cell_weights)
+ const std::vector<unsigned int> &cell_weights)
+ : cell_weights_list(cell_weights)
{
// set the current pointer to the first element of the list, given that
// we will walk through it sequentially
MPI_Comm mpi_communicator,
const typename dealii::Triangulation<dim, spacedim>::MeshSmoothing
smooth_grid,
- const Settings settings_) :
- // Do not check for distorted cells.
- // For multigrid, we need limit_level_difference_at_vertices
- // to make sure the transfer operators only need to consider two levels.
+ const Settings settings_)
+ : // Do not check for distorted cells.
+ // For multigrid, we need limit_level_difference_at_vertices
+ // to make sure the transfer operators only need to consider two levels.
dealii::parallel::Triangulation<dim, spacedim>(
mpi_communicator,
(settings_ & construct_multigrid_hierarchy) ?
smooth_grid |
Triangulation<dim, spacedim>::limit_level_difference_at_vertices) :
smooth_grid,
- false),
- settings(settings_),
- triangulation_has_content(false),
- connectivity(nullptr),
- parallel_forest(nullptr),
- cell_attached_data({0, 0, 0, {}})
+ false)
+ , settings(settings_)
+ , triangulation_has_content(false)
+ , connectivity(nullptr)
+ , parallel_forest(nullptr)
+ , cell_attached_data({0, 0, 0, {}})
{
parallel_ghost = nullptr;
}
std::memcpy(ptr, &num_cells, sizeof(unsigned int));
ptr += sizeof(unsigned int);
- std::memcpy(
- ptr, tree_index.data(), num_cells * sizeof(unsigned int));
+ std::memcpy(ptr,
+ tree_index.data(),
+ num_cells * sizeof(unsigned int));
ptr += num_cells * sizeof(unsigned int);
std::memcpy(
ptr += sizeof(unsigned int) * cells;
quadrants.resize(cells);
- memcpy(
- quadrants.data(),
- ptr,
- sizeof(typename dealii::internal::p4est::types<dim>::quadrant) *
- cells);
+ memcpy(quadrants.data(),
+ ptr,
+ sizeof(
+ typename dealii::internal::p4est::types<dim>::quadrant) *
+ cells);
ptr +=
sizeof(typename dealii::internal::p4est::types<dim>::quadrant) *
cells;
{
Assert(parallel_forest != nullptr,
ExcMessage("Can't produce output when no forest is created yet."));
- dealii::internal::p4est::functions<dim>::vtk_write_file(
- parallel_forest, nullptr, file_basename);
+ dealii::internal::p4est::functions<dim>::vtk_write_file(parallel_forest,
+ nullptr,
+ file_basename);
}
// and release the data
void *userptr = parallel_forest->user_pointer;
- dealii::internal::p4est::functions<dim>::reset_data(
- parallel_forest, 0, nullptr, nullptr);
+ dealii::internal::p4est::functions<dim>::reset_data(parallel_forest,
+ 0,
+ nullptr,
+ nullptr);
parallel_forest->user_pointer = userptr;
}
unsigned int
Triangulation<dim, spacedim>::get_checksum() const
{
- Assert(
- parallel_forest != nullptr,
- ExcMessage("Can't produce a check sum when no forest is created yet."));
+ Assert(parallel_forest != nullptr,
+ ExcMessage(
+ "Can't produce a check sum when no forest is created yet."));
return dealii::internal::p4est::functions<dim>::checksum(parallel_forest);
}
unsigned int>>>
vertex_to_cell;
get_vertex_to_cell_mappings(*this, vertex_touch_count, vertex_to_cell);
- const dealii::internal::p4est::types<2>::locidx num_vtt = std::accumulate(
- vertex_touch_count.begin(), vertex_touch_count.end(), 0u);
+ const dealii::internal::p4est::types<2>::locidx num_vtt =
+ std::accumulate(vertex_touch_count.begin(),
+ vertex_touch_count.end(),
+ 0u);
// now create a connectivity object with the right sizes for all
// arrays. set vertex information only in debug mode (saves a few bytes
unsigned int>>>
vertex_to_cell;
get_vertex_to_cell_mappings(*this, vertex_touch_count, vertex_to_cell);
- const dealii::internal::p4est::types<2>::locidx num_vtt = std::accumulate(
- vertex_touch_count.begin(), vertex_touch_count.end(), 0u);
+ const dealii::internal::p4est::types<2>::locidx num_vtt =
+ std::accumulate(vertex_touch_count.begin(),
+ vertex_touch_count.end(),
+ 0u);
// now create a connectivity object with the right sizes for all
// arrays. set vertex information only in debug mode (saves a few bytes
std::pair<Triangulation<3>::active_cell_iterator, unsigned int>>>
vertex_to_cell;
get_vertex_to_cell_mappings(*this, vertex_touch_count, vertex_to_cell);
- const dealii::internal::p4est::types<2>::locidx num_vtt = std::accumulate(
- vertex_touch_count.begin(), vertex_touch_count.end(), 0u);
+ const dealii::internal::p4est::types<2>::locidx num_vtt =
+ std::accumulate(vertex_touch_count.begin(),
+ vertex_touch_count.end(),
+ 0u);
std::vector<unsigned int> edge_touch_count;
std::vector<std::list<
unsigned int coarse_cell_index =
p4est_tree_to_coarse_cell_permutation[ghost_tree];
- match_quadrant<dim, spacedim>(
- this, coarse_cell_index, *quadr, ghost_owner);
+ match_quadrant<dim, spacedim>(this,
+ coarse_cell_index,
+ *quadr,
+ ghost_owner);
}
// fix all the flags to make sure we have a consistent mesh
cell != this->end();
++cell)
if (cell->is_locally_owned() && cell->refine_flag_set())
- Assert(
- cell->refine_flag_set() ==
- RefinementPossibilities<dim>::isotropic_refinement,
- ExcMessage("This class does not support anisotropic refinement"));
+ Assert(cell->refine_flag_set() ==
+ RefinementPossibilities<dim>::isotropic_refinement,
+ ExcMessage(
+ "This class does not support anisotropic refinement"));
# endif
Triangulation<dim, spacedim>::communicate_locally_moved_vertices(
const std::vector<bool> &vertex_locally_moved)
{
- Assert(
- vertex_locally_moved.size() == this->n_vertices(),
- ExcDimensionMismatch(vertex_locally_moved.size(), this->n_vertices()));
+ Assert(vertex_locally_moved.size() == this->n_vertices(),
+ ExcDimensionMismatch(vertex_locally_moved.size(),
+ this->n_vertices()));
# ifdef DEBUG
{
const std::vector<bool> locally_owned_vertices =
dealii::internal::p4est::init_coarse_quadrant<dim>(
p4est_coarse_cell);
- CommunicateLocallyMovedVertices::
- set_vertices_recursively<dim, spacedim>(
- *this,
- p4est_coarse_cell,
- cell,
- cellinfo.quadrants[c],
- cellinfo.first_vertices[c],
- cellinfo.first_vertex_indices[c]);
+ CommunicateLocallyMovedVertices::set_vertices_recursively<
+ dim,
+ spacedim>(*this,
+ p4est_coarse_cell,
+ cell,
+ cellinfo.quadrants[c],
+ cellinfo.first_vertices[c],
+ cellinfo.first_vertex_indices[c]);
}
}
// and release the data
void *userptr = parallel_forest->user_pointer;
- dealii::internal::p4est::functions<dim>::reset_data(
- parallel_forest, 0, nullptr, nullptr);
+ dealii::internal::p4est::functions<dim>::reset_data(parallel_forest,
+ 0,
+ nullptr,
+ nullptr);
parallel_forest->user_pointer = userptr;
}
}
{
Assert(dim > 1, ExcNotImplemented());
- return dealii::internal::p4est::
- compute_vertices_with_ghost_neighbors<dim, spacedim>(
- *this, this->parallel_forest, this->parallel_ghost);
+ return dealii::internal::p4est::compute_vertices_with_ghost_neighbors<
+ dim,
+ spacedim>(*this, this->parallel_forest, this->parallel_ghost);
}
// separate)
triangulation_has_content = true;
- Assert(
- other_tria.n_levels() == 1,
- ExcMessage("Parallel distributed triangulations can only be copied, "
- "if they are not refined!"));
+ Assert(other_tria.n_levels() == 1,
+ ExcMessage(
+ "Parallel distributed triangulations can only be copied, "
+ "if they are not refined!"));
if (const dealii::parallel::distributed::Triangulation<dim, spacedim>
*other_tria_x =
MPI_Comm mpi_communicator,
const typename dealii::Triangulation<1, spacedim>::MeshSmoothing
smooth_grid,
- const Settings /*settings*/) :
- dealii::parallel::Triangulation<1, spacedim>(mpi_communicator,
- smooth_grid,
- false)
+ const Settings /*settings*/)
+ : dealii::parallel::Triangulation<1, spacedim>(mpi_communicator,
+ smooth_grid,
+ false)
{
Assert(false, ExcNotImplemented());
}
MPI_Comm mpi_communicator,
const typename dealii::Triangulation<dim, spacedim>::MeshSmoothing
smooth_grid,
- const bool check_for_distorted_cells) :
- dealii::Triangulation<dim, spacedim>(smooth_grid,
- check_for_distorted_cells),
- mpi_communicator(mpi_communicator),
- my_subdomain(Utilities::MPI::this_mpi_process(this->mpi_communicator)),
- n_subdomains(Utilities::MPI::n_mpi_processes(this->mpi_communicator))
+ const bool check_for_distorted_cells)
+ : dealii::Triangulation<dim, spacedim>(smooth_grid,
+ check_for_distorted_cells)
+ , mpi_communicator(mpi_communicator)
+ , my_subdomain(Utilities::MPI::this_mpi_process(this->mpi_communicator))
+ , n_subdomains(Utilities::MPI::n_mpi_processes(this->mpi_communicator))
{
#ifndef DEAL_II_WITH_MPI
Assert(false,
}
template <int dim, int spacedim>
- Triangulation<dim, spacedim>::NumberCache::NumberCache() :
- n_global_active_cells(0),
- n_global_levels(0)
+ Triangulation<dim, spacedim>::NumberCache::NumberCache()
+ : n_global_active_cells(0)
+ , n_global_levels(0)
{}
template <int dim, int spacedim>
template <int structdim, int dim, int spacedim>
DoFInvalidAccessor<structdim, dim, spacedim>::DoFInvalidAccessor(
- const DoFInvalidAccessor &i) :
- InvalidAccessor<structdim, dim, spacedim>(
- static_cast<const InvalidAccessor<structdim, dim, spacedim> &>(i))
+ const DoFInvalidAccessor &i)
+ : InvalidAccessor<structdim, dim, spacedim>(
+ static_cast<const InvalidAccessor<structdim, dim, spacedim> &>(i))
{
Assert(false,
ExcMessage("You are attempting an illegal conversion between "
// mesh). consequently, we cannot interpolate from children's FE
// space to this cell's (unknown) FE space unless an explicit
// fe_index is given
- Assert(
- (dynamic_cast<DoFHandler<DoFHandlerType::dimension,
- DoFHandlerType::space_dimension> *>(
- this->dof_handler) != nullptr) ||
- (fe_index != DoFHandlerType::default_fe_index),
- ExcMessage("You cannot call this function on non-active cells "
- "of hp::DoFHandler objects unless you provide an explicit "
- "finite element index because they do not have naturally "
- "associated finite element spaces associated: degrees "
- "of freedom are only distributed on active cells for which "
- "the active_fe_index has been set."));
+ Assert((dynamic_cast<DoFHandler<DoFHandlerType::dimension,
+ DoFHandlerType::space_dimension> *>(
+ this->dof_handler) != nullptr) ||
+ (fe_index != DoFHandlerType::default_fe_index),
+ ExcMessage(
+ "You cannot call this function on non-active cells "
+ "of hp::DoFHandler objects unless you provide an explicit "
+ "finite element index because they do not have naturally "
+ "associated finite element spaces associated: degrees "
+ "of freedom are only distributed on active cells for which "
+ "the active_fe_index has been set."));
const FiniteElement<dim, spacedim> &fe =
this->get_dof_handler().get_fe(fe_index);
// interpolation itself either from its own children or
// by interpolating from the finite element on an active
// child to the finite element space requested here
- this->child(child)->get_interpolated_dof_values(
- values, tmp1, fe_index);
+ this->child(child)->get_interpolated_dof_values(values,
+ tmp1,
+ fe_index);
// interpolate these to the mother cell
fe.get_restriction_matrix(child, this->refinement_case())
.vmult(tmp2, tmp1);
for (VEC : VECTOR_TYPES; deal_II_dimension : DIMENSIONS; lda : BOOL)
{
template void DoFCellAccessor<DoFHandler<deal_II_dimension>, lda>::
- get_interpolated_dof_values(
- const VEC &, Vector<VEC::value_type> &, const unsigned int fe_index)
- const;
+ get_interpolated_dof_values(const VEC &,
+ Vector<VEC::value_type> &,
+ const unsigned int fe_index) const;
#if deal_II_dimension != 3
for (VEC : VECTOR_TYPES; deal_II_dimension : DIMENSIONS; lda : BOOL)
{
template void DoFCellAccessor<hp::DoFHandler<deal_II_dimension>, lda>::
- get_interpolated_dof_values(
- const VEC &, Vector<VEC::value_type> &, const unsigned int fe_index)
- const;
+ get_interpolated_dof_values(const VEC &,
+ Vector<VEC::value_type> &,
+ const unsigned int fe_index) const;
#if deal_II_dimension != 3
else
// otherwise distribute them to the children
{
- Assert(
- (dynamic_cast<DoFHandler<DoFHandlerType::dimension,
- DoFHandlerType::space_dimension> *>(
- this->dof_handler) != nullptr) ||
- (fe_index != DoFHandlerType::default_fe_index),
- ExcMessage("You cannot call this function on non-active cells "
- "of hp::DoFHandler objects unless you provide an explicit "
- "finite element index because they do not have naturally "
- "associated finite element spaces associated: degrees "
- "of freedom are only distributed on active cells for which "
- "the active_fe_index has been set."));
+ Assert((dynamic_cast<DoFHandler<DoFHandlerType::dimension,
+ DoFHandlerType::space_dimension> *>(
+ this->dof_handler) != nullptr) ||
+ (fe_index != DoFHandlerType::default_fe_index),
+ ExcMessage(
+ "You cannot call this function on non-active cells "
+ "of hp::DoFHandler objects unless you provide an explicit "
+ "finite element index because they do not have naturally "
+ "associated finite element spaces associated: degrees "
+ "of freedom are only distributed on active cells for which "
+ "the active_fe_index has been set."));
const FiniteElement<dim, spacedim> &fe =
this->get_dof_handler().get_fe(fe_index);
if (tmp.size() > 0)
fe.get_prolongation_matrix(child, this->refinement_case())
.vmult(tmp, local_values);
- this->child(child)->set_dof_values_by_interpolation(
- tmp, values, fe_index);
+ this->child(child)->set_dof_values_by_interpolation(tmp,
+ values,
+ fe_index);
}
}
}
for (VEC : VECTOR_TYPES; deal_II_dimension : DIMENSIONS; lda : BOOL)
{
template void DoFCellAccessor<DoFHandler<deal_II_dimension>, lda>::
- set_dof_values_by_interpolation(
- const Vector<VEC::value_type> &, VEC &, const unsigned int fe_index)
- const;
+ set_dof_values_by_interpolation(const Vector<VEC::value_type> &,
+ VEC &,
+ const unsigned int fe_index) const;
#if deal_II_dimension != 3
for (VEC : VECTOR_TYPES; deal_II_dimension : DIMENSIONS; lda : BOOL)
{
template void DoFCellAccessor<hp::DoFHandler<deal_II_dimension>, lda>::
- set_dof_values_by_interpolation(
- const Vector<VEC::value_type> &, VEC &, const unsigned int fe_index)
- const;
+ set_dof_values_by_interpolation(const Vector<VEC::value_type> &,
+ VEC &,
+ const unsigned int fe_index) const;
#if deal_II_dimension != 3
Assert(min_level[vertex] < n_levels, ExcInternalError());
Assert(max_level[vertex] >= min_level[vertex],
ExcInternalError());
- dof_handler.mg_vertex_dofs[vertex].init(
- min_level[vertex], max_level[vertex], fe.dofs_per_vertex);
+ dof_handler.mg_vertex_dofs[vertex].init(min_level[vertex],
+ max_level[vertex],
+ fe.dofs_per_vertex);
}
else
Assert(min_level[vertex] < n_levels, ExcInternalError());
Assert(max_level[vertex] >= min_level[vertex],
ExcInternalError());
- dof_handler.mg_vertex_dofs[vertex].init(
- min_level[vertex], max_level[vertex], fe.dofs_per_vertex);
+ dof_handler.mg_vertex_dofs[vertex].init(min_level[vertex],
+ max_level[vertex],
+ fe.dofs_per_vertex);
}
else
const unsigned int local_index,
const std::integral_constant<int, 1>)
{
- return mg_level->dof_object.get_dof_index(
- dof_handler, obj_index, fe_index, local_index);
+ return mg_level->dof_object.get_dof_index(dof_handler,
+ obj_index,
+ fe_index,
+ local_index);
}
template <int spacedim>
const unsigned int local_index,
const std::integral_constant<int, 1>)
{
- return mg_faces->lines.get_dof_index(
- dof_handler, obj_index, fe_index, local_index);
+ return mg_faces->lines.get_dof_index(dof_handler,
+ obj_index,
+ fe_index,
+ local_index);
}
template <int spacedim>
const unsigned int local_index,
const std::integral_constant<int, 2>)
{
- return mg_level->dof_object.get_dof_index(
- dof_handler, obj_index, fe_index, local_index);
+ return mg_level->dof_object.get_dof_index(dof_handler,
+ obj_index,
+ fe_index,
+ local_index);
}
template <int spacedim>
const unsigned int local_index,
const std::integral_constant<int, 1>)
{
- return mg_faces->lines.get_dof_index(
- dof_handler, obj_index, fe_index, local_index);
+ return mg_faces->lines.get_dof_index(dof_handler,
+ obj_index,
+ fe_index,
+ local_index);
}
template <int spacedim>
const unsigned int local_index,
const std::integral_constant<int, 2>)
{
- return mg_faces->quads.get_dof_index(
- dof_handler, obj_index, fe_index, local_index);
+ return mg_faces->quads.get_dof_index(dof_handler,
+ obj_index,
+ fe_index,
+ local_index);
}
template <int spacedim>
const unsigned int local_index,
const std::integral_constant<int, 3>)
{
- return mg_level->dof_object.get_dof_index(
- dof_handler, obj_index, fe_index, local_index);
+ return mg_level->dof_object.get_dof_index(dof_handler,
+ obj_index,
+ fe_index,
+ local_index);
}
template <int spacedim>
template <int dim, int spacedim>
-DoFHandler<dim, spacedim>::DoFHandler(
- const Triangulation<dim, spacedim> &tria) :
- tria(&tria, typeid(*this).name()),
- faces(nullptr),
- mg_faces(nullptr)
+DoFHandler<dim, spacedim>::DoFHandler(const Triangulation<dim, spacedim> &tria)
+ : tria(&tria, typeid(*this).name())
+ , faces(nullptr)
+ , mg_faces(nullptr)
{
// decide whether we need a sequential or a parallel distributed policy
if (dynamic_cast<const parallel::shared::Triangulation<dim, spacedim> *>(
template <int dim, int spacedim>
-DoFHandler<dim, spacedim>::DoFHandler() : tria(nullptr, typeid(*this).name())
+DoFHandler<dim, spacedim>::DoFHandler()
+ : tria(nullptr, typeid(*this).name())
{}
DoFHandler<dim, spacedim>::renumber_dofs(
const std::vector<types::global_dof_index> &new_numbers)
{
- Assert(
- levels.size() > 0,
- ExcMessage("You need to distribute DoFs before you can renumber them."));
+ Assert(levels.size() > 0,
+ ExcMessage(
+ "You need to distribute DoFs before you can renumber them."));
#ifdef DEBUG
if (dynamic_cast<const parallel::shared::Triangulation<dim, spacedim> *>(
}
else
for (types::global_dof_index i = 0; i < new_numbers.size(); ++i)
- Assert(
- new_numbers[i] < n_dofs(),
- ExcMessage("New DoF index is not less than the total number of dofs."));
+ Assert(new_numbers[i] < n_dofs(),
+ ExcMessage(
+ "New DoF index is not less than the total number of dofs."));
#endif
number_cache = policy->renumber_dofs(new_numbers);
}
else
for (types::global_dof_index i = 0; i < new_numbers.size(); ++i)
- Assert(
- new_numbers[i] < n_dofs(level),
- ExcMessage("New DoF index is not less than the total number of dofs."));
+ Assert(new_numbers[i] < n_dofs(level),
+ ExcMessage(
+ "New DoF index is not less than the total number of dofs."));
#endif
mg_number_cache[level] = policy->renumber_mg_dofs(level, new_numbers);
template <int dim, int spacedim>
-DoFHandler<dim, spacedim>::MGVertexDoFs::MGVertexDoFs() :
- coarsest_level(numbers::invalid_unsigned_int),
- finest_level(0)
+DoFHandler<dim, spacedim>::MGVertexDoFs::MGVertexDoFs()
+ : coarsest_level(numbers::invalid_unsigned_int)
+ , finest_level(0)
{}
const unsigned int n_indices = n_levels * dofs_per_vertex;
indices = std_cxx14::make_unique<types::global_dof_index[]>(n_indices);
- std::fill(
- indices.get(), indices.get() + n_indices, numbers::invalid_dof_index);
+ std::fill(indices.get(),
+ indices.get() + n_indices,
+ numbers::invalid_dof_index);
}
else
indices.reset();
numbers::invalid_dof_index)
for (unsigned int d = 0; d < fe.dofs_per_vertex;
++d, ++next_free_dof)
- cell->set_vertex_dof_index(
- vertex, d, next_free_dof, fe_index);
+ cell->set_vertex_dof_index(vertex,
+ d,
+ next_free_dof,
+ fe_index);
// finally for the line. this one shouldn't be numbered yet
if (fe.dofs_per_line > 0)
{
- Assert(
- (cell->dof_index(0, fe_index) == numbers::invalid_dof_index),
- ExcInternalError());
+ Assert((cell->dof_index(0, fe_index) ==
+ numbers::invalid_dof_index),
+ ExcInternalError());
for (unsigned int d = 0; d < fe.dofs_per_line;
++d, ++next_free_dof)
numbers::invalid_dof_index)
for (unsigned int d = 0; d < fe.dofs_per_vertex;
++d, ++next_free_dof)
- cell->set_vertex_dof_index(
- vertex, d, next_free_dof, fe_index);
+ cell->set_vertex_dof_index(vertex,
+ d,
+ next_free_dof,
+ fe_index);
// next the sides. do the same as above: check whether the
// line is already numbered for the present fe_index, and if
// finally for the quad. this one shouldn't be numbered yet
if (fe.dofs_per_quad > 0)
{
- Assert(
- (cell->dof_index(0, fe_index) == numbers::invalid_dof_index),
- ExcInternalError());
+ Assert((cell->dof_index(0, fe_index) ==
+ numbers::invalid_dof_index),
+ ExcInternalError());
for (unsigned int d = 0; d < fe.dofs_per_quad;
++d, ++next_free_dof)
numbers::invalid_dof_index)
for (unsigned int d = 0; d < fe.dofs_per_vertex;
++d, ++next_free_dof)
- cell->set_vertex_dof_index(
- vertex, d, next_free_dof, fe_index);
+ cell->set_vertex_dof_index(vertex,
+ d,
+ next_free_dof,
+ fe_index);
// next the four lines. do the same as above: check whether
// the line is already numbered for the present fe_index,
// finally for the hex. this one shouldn't be numbered yet
if (fe.dofs_per_hex > 0)
{
- Assert(
- (cell->dof_index(0, fe_index) == numbers::invalid_dof_index),
- ExcInternalError());
+ Assert((cell->dof_index(0, fe_index) ==
+ numbers::invalid_dof_index),
+ ExcInternalError());
for (unsigned int d = 0; d < fe.dofs_per_hex;
++d, ++next_free_dof)
{
const unsigned int first_fe_index =
dealii::internal::DoFAccessorImplementation::
- Implementation::nth_active_vertex_fe_index(
- dof_handler, vertex_index, 0);
+ Implementation::nth_active_vertex_fe_index(dof_handler,
+ vertex_index,
+ 0);
// loop over all the other FEs with which we want
// to identify the DoF indices of the first FE of
identities[i].first,
most_dominating_fe_index);
const types::global_dof_index
- slave_dof_index = line->dof_index(
- identities[i].second, other_fe_index);
+ slave_dof_index =
+ line->dof_index(identities[i].second,
+ other_fe_index);
- Assert(
- (dof_identities.find(master_dof_index) ==
- dof_identities.end()) ||
- (dof_identities[slave_dof_index] ==
- master_dof_index),
- ExcInternalError());
+ Assert((dof_identities.find(
+ master_dof_index) ==
+ dof_identities.end()) ||
+ (dof_identities[slave_dof_index] ==
+ master_dof_index),
+ ExcInternalError());
dof_identities[slave_dof_index] =
master_dof_index;
// finally, do the renumbering. verify that previous dof indices
// were indeed all valid on all cells that we touch if we were
// told to do so
- renumber_dofs(
- new_dof_indices, IndexSet(0), dof_handler, check_validity);
+ renumber_dofs(new_dof_indices,
+ IndexSet(0),
+ dof_handler,
+ check_validity);
return next_free_dof;
if (!cell->is_artificial())
if ((subdomain_id == numbers::invalid_subdomain_id) ||
(cell->subdomain_id() == subdomain_id))
- next_free_dof = Implementation::distribute_dofs_on_cell(
- dof_handler, cell, next_free_dof);
+ next_free_dof =
+ Implementation::distribute_dofs_on_cell(dof_handler,
+ cell,
+ next_free_dof);
// Step 2: unify dof indices in case this is an hp DoFHandler
//
cell->level(),
0,
d,
- neighbor->mg_vertex_dof_index(
- cell->level(), 1, d));
+ neighbor->mg_vertex_dof_index(cell->level(),
+ 1,
+ d));
else
for (unsigned int d = 0;
d < cell->get_fe().dofs_per_vertex;
cell->level(),
1,
d,
- neighbor->mg_vertex_dof_index(
- cell->level(), 0, d));
+ neighbor->mg_vertex_dof_index(cell->level(),
+ 0,
+ d));
// next neighbor
continue;
// otherwise: create dofs newly
for (unsigned int d = 0; d < cell->get_fe().dofs_per_vertex;
++d)
- cell->set_mg_vertex_dof_index(
- cell->level(), v, d, next_free_dof++);
+ cell->set_mg_vertex_dof_index(cell->level(),
+ v,
+ d,
+ next_free_dof++);
}
// dofs of line
numbers::invalid_dof_index)
for (unsigned int d = 0; d < cell->get_fe().dofs_per_vertex;
++d)
- cell->set_mg_vertex_dof_index(
- cell->level(), vertex, d, next_free_dof++);
+ cell->set_mg_vertex_dof_index(cell->level(),
+ vertex,
+ d,
+ next_free_dof++);
// for the four sides
if (cell->get_fe().dofs_per_line > 0)
numbers::invalid_dof_index)
for (unsigned int d = 0; d < cell->get_fe().dofs_per_vertex;
++d)
- cell->set_mg_vertex_dof_index(
- cell->level(), vertex, d, next_free_dof++);
+ cell->set_mg_vertex_dof_index(cell->level(),
+ vertex,
+ d,
+ next_free_dof++);
// for the lines
if (cell->get_fe().dofs_per_line > 0)
{
const unsigned int fe_index =
dealii::internal::DoFAccessorImplementation::
- Implementation::nth_active_vertex_fe_index(
- dof_handler, vertex_index, f);
+ Implementation::nth_active_vertex_fe_index(dof_handler,
+ vertex_index,
+ f);
for (unsigned int d = 0;
d < dof_handler.get_fe(fe_index).dofs_per_vertex;
{
const types::global_dof_index old_dof_index =
dealii::internal::DoFAccessorImplementation::
- Implementation::get_vertex_dof_index(
- dof_handler, vertex_index, fe_index, d);
+ Implementation::get_vertex_dof_index(dof_handler,
+ vertex_index,
+ fe_index,
+ d);
// if check_validity was set, then we are to verify that
// the previous indices were all valid. this really should
// work on separate data structures
Threads::TaskGroup<> tasks;
tasks += Threads::new_task([&]() {
- renumber_vertex_dofs(
- new_numbers, indices, dof_handler, check_validity);
+ renumber_vertex_dofs(new_numbers,
+ indices,
+ dof_handler,
+ check_validity);
});
tasks += Threads::new_task(
[&]() { renumber_face_dofs(new_numbers, indices, dof_handler); });
for (unsigned int d = 0; d < dof_handler.get_fe().dofs_per_vertex;
++d)
{
- const dealii::types::global_dof_index idx = i->get_index(
- level, d, dof_handler.get_fe().dofs_per_vertex);
+ const dealii::types::global_dof_index idx =
+ i->get_index(level,
+ d,
+ dof_handler.get_fe().dofs_per_vertex);
if (check_validity)
Assert(idx != numbers::invalid_dof_index,
template <class DoFHandlerType>
- Sequential<DoFHandlerType>::Sequential(DoFHandlerType &dof_handler) :
- dof_handler(&dof_handler)
+ Sequential<DoFHandlerType>::Sequential(DoFHandlerType &dof_handler)
+ : dof_handler(&dof_handler)
{}
NumberCache
Sequential<DoFHandlerType>::distribute_dofs() const
{
- const types::global_dof_index n_dofs = Implementation::distribute_dofs(
- numbers::invalid_subdomain_id, *dof_handler);
+ const types::global_dof_index n_dofs =
+ Implementation::distribute_dofs(numbers::invalid_subdomain_id,
+ *dof_handler);
// return a sequential, complete index set
return NumberCache(n_dofs);
Sequential<DoFHandlerType>::renumber_dofs(
const std::vector<types::global_dof_index> &new_numbers) const
{
- Implementation::renumber_dofs(
- new_numbers, IndexSet(0), *dof_handler, true);
+ Implementation::renumber_dofs(new_numbers,
+ IndexSet(0),
+ *dof_handler,
+ true);
// return a sequential, complete index set. take into account that the
// number of DoF indices may in fact be smaller than there were before
template <class DoFHandlerType>
ParallelShared<DoFHandlerType>::ParallelShared(
- DoFHandlerType &dof_handler) :
- dof_handler(&dof_handler)
+ DoFHandlerType &dof_handler)
+ : dof_handler(&dof_handler)
{}
// first let the sequential algorithm do its magic. it is going to
// enumerate DoFs on all cells, regardless of owner
- const types::global_dof_index n_dofs = Implementation::distribute_dofs(
- numbers::invalid_subdomain_id, *this->dof_handler);
+ const types::global_dof_index n_dofs =
+ Implementation::distribute_dofs(numbers::invalid_subdomain_id,
+ *this->dof_handler);
// then re-enumerate them based on their subdomain association.
// for this, we first have to identify for each current DoF
// version of the function because we do things on all
// cells and all cells have their subdomain ids and DoFs
// correctly set
- Implementation::renumber_dofs(
- new_dof_indices, IndexSet(0), *this->dof_handler, true);
+ Implementation::renumber_dofs(new_dof_indices,
+ IndexSet(0),
+ *this->dof_handler,
+ true);
// update the number cache. for this, we first have to find the
// subdomain association for each DoF again following renumbering, from
// determine the total number of subdomain ids used
const std::vector<types::subdomain_id>
level_subdomain_association =
- get_dof_level_subdomain_association(
- *this->dof_handler, n_dofs_on_level, n_procs, lvl);
+ get_dof_level_subdomain_association(*this->dof_handler,
+ n_dofs_on_level,
+ n_procs,
+ lvl);
// then renumber the subdomains by first looking at those
// belonging to subdomain 0, then those of subdomain 1, etc. note
// the IndexSets cheap. an assertion at the top verifies that this
// assumption is true
const std::vector<types::subdomain_id> level_subdomain_association =
- get_dof_level_subdomain_association(
- *this->dof_handler, n_dofs_on_level, n_procs, lvl);
+ get_dof_level_subdomain_association(*this->dof_handler,
+ n_dofs_on_level,
+ n_procs,
+ lvl);
for (unsigned int i = 1; i < n_dofs_on_level; ++i)
Assert(level_subdomain_association[i] >=
// let the sequential algorithm do its magic; ignore the
// return type, but reconstruct the number cache based on
// which DoFs each process owns
- Implementation::renumber_dofs(
- global_gathered_numbers, IndexSet(0), *this->dof_handler, true);
+ Implementation::renumber_dofs(global_gathered_numbers,
+ IndexSet(0),
+ *this->dof_handler,
+ true);
const NumberCache number_cache(
DoFTools::locally_owned_dofs_per_subdomain(*this->dof_handler),
MPI_Status status;
int len;
- int ierr = MPI_Probe(
- MPI_ANY_SOURCE, 10101, tria.get_communicator(), &status);
+ int ierr = MPI_Probe(MPI_ANY_SOURCE,
+ 10101,
+ tria.get_communicator(),
+ &status);
AssertThrowMPI(ierr);
ierr = MPI_Get_count(&status, MPI_BYTE, &len);
AssertThrowMPI(ierr);
MPI_Status status;
int len;
- int ierr = MPI_Probe(
- MPI_ANY_SOURCE, 10102, tria.get_communicator(), &status);
+ int ierr = MPI_Probe(MPI_ANY_SOURCE,
+ 10102,
+ tria.get_communicator(),
+ &status);
AssertThrowMPI(ierr);
ierr = MPI_Get_count(&status, MPI_BYTE, &len);
AssertThrowMPI(ierr);
// buffers.
if (requests.size() > 0)
{
- const int ierr = MPI_Waitall(
- requests.size(), requests.data(), MPI_STATUSES_IGNORE);
+ const int ierr = MPI_Waitall(requests.size(),
+ requests.data(),
+ MPI_STATUSES_IGNORE);
AssertThrowMPI(ierr);
}
if (reply_requests.size() > 0)
else
// we already know the dof index. check that there
// is no conflict
- Assert(
- (received_dof_indices[i] == numbers::invalid_dof_index) ||
- (received_dof_indices[i] == local_dof_indices[i]),
- ExcInternalError());
+ Assert((received_dof_indices[i] ==
+ numbers::invalid_dof_index) ||
+ (received_dof_indices[i] == local_dof_indices[i]),
+ ExcInternalError());
const_cast<typename DoFHandlerType::active_cell_iterator &>(cell)
->set_dof_indices(local_dof_indices);
template <class DoFHandlerType>
ParallelDistributed<DoFHandlerType>::ParallelDistributed(
- DoFHandlerType &dof_handler) :
- dof_handler(&dof_handler)
+ DoFHandlerType &dof_handler)
+ : dof_handler(&dof_handler)
{}
// now re-enumerate all dofs to this shifted and condensed
// numbering form. we renumber some dofs as invalid, so
// choose the nocheck-version.
- Implementation::renumber_dofs(
- renumbering, IndexSet(0), *dof_handler, false);
+ Implementation::renumber_dofs(renumbering,
+ IndexSet(0),
+ *dof_handler,
+ false);
// now a little bit of housekeeping
const dealii::types::global_dof_index n_global_dofs =
}
NumberCache number_cache(locally_owned_dofs_per_processor,
triangulation->locally_owned_subdomain());
- Assert(
- number_cache
- .locally_owned_dofs_per_processor[triangulation
- ->locally_owned_subdomain()]
- .n_elements() == number_cache.n_locally_owned_dofs,
- ExcInternalError());
+ Assert(number_cache
+ .locally_owned_dofs_per_processor
+ [triangulation->locally_owned_subdomain()]
+ .n_elements() == number_cache.n_locally_owned_dofs,
+ ExcInternalError());
Assert(
!number_cache
.locally_owned_dofs_per_processor[triangulation
{
if (cell->is_ghost())
{
- Assert(
- false,
- ExcMessage("A ghost cell ended up with incomplete "
- "DoF index information. This should not "
- "have happened!"));
+ Assert(false,
+ ExcMessage(
+ "A ghost cell ended up with incomplete "
+ "DoF index information. This should not "
+ "have happened!"));
}
else
{
&dof_handler->get_triangulation())));
Assert(triangulation != nullptr, ExcInternalError());
- AssertThrow(
- (triangulation->settings &
- parallel::distributed::Triangulation<dim, spacedim>::
- construct_multigrid_hierarchy),
- ExcMessage("Multigrid DoFs can only be distributed on a parallel "
- "Triangulation if the flag construct_multigrid_hierarchy "
- "is set in the constructor."));
+ AssertThrow((triangulation->settings &
+ parallel::distributed::Triangulation<dim, spacedim>::
+ construct_multigrid_hierarchy),
+ ExcMessage(
+ "Multigrid DoFs can only be distributed on a parallel "
+ "Triangulation if the flag construct_multigrid_hierarchy "
+ "is set in the constructor."));
const unsigned int n_cpus =
}
// determine maximum size of IndexSet
- const unsigned int max_size = Utilities::MPI::max(
- my_data.size(), triangulation->get_communicator());
+ const unsigned int max_size =
+ Utilities::MPI::max(my_data.size(),
+ triangulation->get_communicator());
// as the MPI_Allgather call will be reading max_size elements, and
// as this may be past the end of my_data, we need to increase the
}
}
- return NumberCache(
- locally_owned_dofs_per_processor,
- Utilities::MPI::this_mpi_process(triangulation->get_communicator()));
+ return NumberCache(locally_owned_dofs_per_processor,
+ Utilities::MPI::this_mpi_process(
+ triangulation->get_communicator()));
#endif
}
// use Utilities::MPI::Partitioner for handling the data exchange
// of the new numbers, which is simply the extraction of ghost data
IndexSet relevant_dofs;
- DoFTools::extract_locally_relevant_level_dofs(
- *dof_handler, level, relevant_dofs);
+ DoFTools::extract_locally_relevant_level_dofs(*dof_handler,
+ level,
+ relevant_dofs);
std::vector<types::global_dof_index> ghosted_new_numbers(
relevant_dofs.n_elements());
{
- Utilities::MPI::Partitioner partitioner(
- index_sets[my_rank], relevant_dofs, tr->get_communicator());
+ Utilities::MPI::Partitioner partitioner(index_sets[my_rank],
+ relevant_dofs,
+ tr->get_communicator());
std::vector<types::global_dof_index> temp_array(
partitioner.n_import_indices());
const unsigned int communication_channel = 17;
{
std::vector<types::global_dof_index> renumbering(
dof_handler.n_dofs(), numbers::invalid_dof_index);
- compute_Cuthill_McKee(
- renumbering, dof_handler, reversed_numbering, use_constraints);
+ compute_Cuthill_McKee(renumbering,
+ dof_handler,
+ reversed_numbering,
+ use_constraints);
// actually perform renumbering;
// this is dimension specific and
{
std::vector<types::global_dof_index> renumbering(
dof_handler.n_dofs(), numbers::invalid_dof_index);
- compute_king_ordering(
- renumbering, dof_handler, reversed_numbering, use_constraints);
+ compute_king_ordering(renumbering,
+ dof_handler,
+ reversed_numbering,
+ use_constraints);
// actually perform renumbering;
// this is dimension specific and
{
std::vector<types::global_dof_index> renumbering(
dof_handler.n_dofs(), numbers::invalid_dof_index);
- compute_minimum_degree(
- renumbering, dof_handler, reversed_numbering, use_constraints);
+ compute_minimum_degree(renumbering,
+ dof_handler,
+ reversed_numbering,
+ use_constraints);
// actually perform renumbering;
// this is dimension specific and
make_iterator_property_map(degree.begin(), id, degree[0]),
inverse_perm.data(),
perm.data(),
- make_iterator_property_map(
- supernode_sizes.begin(), id, supernode_sizes[0]),
+ make_iterator_property_map(supernode_sizes.begin(),
+ id,
+ supernode_sizes[0]),
delta,
id);
if (reversed_numbering == true)
std::copy(perm.begin(), perm.end(), new_dof_indices.begin());
else
- std::copy(
- inverse_perm.begin(), inverse_perm.end(), new_dof_indices.begin());
+ std::copy(inverse_perm.begin(),
+ inverse_perm.end(),
+ new_dof_indices.begin());
}
} // namespace boost
DynamicSparsityPattern dsp(dof_handler.n_dofs(), dof_handler.n_dofs());
DoFTools::make_sparsity_pattern(dof_handler, dsp, constraints);
- SparsityTools::reorder_Cuthill_McKee(
- dsp, new_indices, starting_indices);
+ SparsityTools::reorder_Cuthill_McKee(dsp,
+ new_indices,
+ starting_indices);
if (reversed_numbering)
new_indices = Utilities::reverse_permutation(new_indices);
}
// then create first the global sparsity pattern, and then the local
// sparsity pattern from the global one by transferring its indices to
// processor-local (locally owned or locally active) index space
- DynamicSparsityPattern dsp(
- dof_handler.n_dofs(), dof_handler.n_dofs(), index_set_to_use);
+ DynamicSparsityPattern dsp(dof_handler.n_dofs(),
+ dof_handler.n_dofs(),
+ index_set_to_use);
DoFTools::make_sparsity_pattern(dof_handler, dsp, constraints);
DynamicSparsityPattern local_sparsity(index_set_to_use.n_elements(),
if (col != row && index_set_to_use.is_element(col))
row_entries.push_back(index_set_to_use.index_within_set(col));
}
- local_sparsity.add_entries(
- i, row_entries.begin(), row_entries.end(), true);
+ local_sparsity.add_entries(i,
+ row_entries.begin(),
+ row_entries.end(),
+ true);
}
// translate starting indices from global to local indices
AssertDimension(new_indices.size(), locally_owned_dofs.n_elements());
std::vector<types::global_dof_index> my_new_indices(
index_set_to_use.n_elements());
- SparsityTools::reorder_Cuthill_McKee(
- local_sparsity, my_new_indices, local_starting_indices);
+ SparsityTools::reorder_Cuthill_McKee(local_sparsity,
+ my_new_indices,
+ local_starting_indices);
if (reversed_numbering)
my_new_indices = Utilities::reverse_permutation(my_new_indices);
fe_collection.n_components()));
for (unsigned int i = 0; i < component_order.size(); ++i)
- Assert(
- component_order[i] < fe_collection.n_components(),
- ExcIndexRange(component_order[i], 0, fe_collection.n_components()));
+ Assert(component_order[i] < fe_collection.n_components(),
+ ExcIndexRange(component_order[i],
+ 0,
+ fe_collection.n_components()));
// vector to hold the dof indices on
// the cell we visit at a time
dim,
spacedim,
typename DoFHandler<dim, spacedim>::active_cell_iterator,
- typename DoFHandler<dim, spacedim>::level_cell_iterator>(
- renumbering, start, end, false);
+ typename DoFHandler<dim, spacedim>::level_cell_iterator>(renumbering,
+ start,
+ end,
+ false);
if (result == 0)
return;
dim,
spacedim,
typename hp::DoFHandler<dim, spacedim>::active_cell_iterator,
- typename hp::DoFHandler<dim, spacedim>::level_cell_iterator>(
- renumbering, start, end, false);
+ typename hp::DoFHandler<dim, spacedim>::level_cell_iterator>(renumbering,
+ start,
+ end,
+ false);
if (result == 0)
return;
dim,
spacedim,
typename DoFHandler<dim, spacedim>::level_cell_iterator,
- typename DoFHandler<dim, spacedim>::level_cell_iterator>(
- renumbering, start, end, true);
+ typename DoFHandler<dim, spacedim>::level_cell_iterator>(renumbering,
+ start,
+ end,
+ true);
if (result == 0)
return;
std::vector<types::global_dof_index> renumbering(
dof_handler.n_dofs(level), numbers::invalid_dof_index);
- compute_sort_selected_dofs_back(
- renumbering, dof_handler, selected_dofs, level);
+ compute_sort_selected_dofs_back(renumbering,
+ dof_handler,
+ selected_dofs,
+ level);
dof_handler.renumber_dofs(level, renumbering);
}
}
}
}
- Assert(
- global_index == n_global_dofs,
- ExcMessage("Traversing over the given set of cells did not cover all "
- "degrees of freedom in the DoFHandler. Does the set of cells "
- "not include all active cells?"));
+ Assert(global_index == n_global_dofs,
+ ExcMessage(
+ "Traversing over the given set of cells did not cover all "
+ "degrees of freedom in the DoFHandler. Does the set of cells "
+ "not include all active cells?"));
for (types::global_dof_index i = 0; i < reverse.size(); ++i)
new_indices[reverse[i]] = i;
}
}
}
- Assert(
- global_index == n_global_dofs,
- ExcMessage("Traversing over the given set of cells did not cover all "
- "degrees of freedom in the DoFHandler. Does the set of cells "
- "not include all cells of the specified level?"));
+ Assert(global_index == n_global_dofs,
+ ExcMessage(
+ "Traversing over the given set of cells did not cover all "
+ "degrees of freedom in the DoFHandler. Does the set of cells "
+ "not include all cells of the specified level?"));
for (types::global_dof_index i = 0; i < new_order.size(); ++i)
new_order[reverse[i]] = i;
fe_collection[comp].get_unit_support_points()));
}
hp::FEValues<DoFHandlerType::dimension, DoFHandlerType::space_dimension>
- hp_fe_values(
- fe_collection, quadrature_collection, update_quadrature_points);
+ hp_fe_values(fe_collection,
+ quadrature_collection,
+ update_quadrature_points);
std::vector<bool> already_touched(n_dofs, false);
ComparePointwiseDownstream<DoFHandlerType::space_dimension> comparator(
direction);
- std::sort(
- support_point_list.begin(), support_point_list.end(), comparator);
+ std::sort(support_point_list.begin(),
+ support_point_list.end(),
+ comparator);
for (types::global_dof_index i = 0; i < n_dofs; ++i)
new_indices[support_point_list[i].second] = i;
}
ComparePointwiseDownstream<DoFHandlerType::space_dimension> comparator(
direction);
- std::sort(
- support_point_list.begin(), support_point_list.end(), comparator);
+ std::sort(support_point_list.begin(),
+ support_point_list.end(),
+ comparator);
for (types::global_dof_index i = 0; i < n_dofs; ++i)
new_indices[support_point_list[i].second] = i;
}
/**
* Constructor.
*/
- ClockCells(const Point<dim> ¢er, bool counter) :
- center(center),
- counter(counter)
+ ClockCells(const Point<dim> ¢er, bool counter)
+ : center(center)
+ , counter(counter)
{}
/**
for (unsigned int i = 1; i < n_dofs; ++i)
{
// get a random number between 0 and i (inclusive)
- const unsigned int j = ::boost::random::uniform_int_distribution<>(
- 0, i)(random_number_generator);
+ const unsigned int j =
+ ::boost::random::uniform_int_distribution<>(0, i)(
+ random_number_generator);
// if possible, swap the elements
if (i != j)
DoFHandlerType::space_dimension>
&fe_collection = dof.get_fe_collection();
Assert(fe_collection.n_components() < 256, ExcNotImplemented());
- Assert(
- dofs_by_block.size() == dof.n_locally_owned_dofs(),
- ExcDimensionMismatch(dofs_by_block.size(), dof.n_locally_owned_dofs()));
+ Assert(dofs_by_block.size() == dof.n_locally_owned_dofs(),
+ ExcDimensionMismatch(dofs_by_block.size(),
+ dof.n_locally_owned_dofs()));
// next set up a table for the degrees of freedom on each of the
// cells (regardless of the fact whether it is listed in the
ExcMessage(
"The given component mask is not sized correctly to represent the "
"components of the given finite element."));
- Assert(
- selected_dofs.size() == dof.n_locally_owned_dofs(),
- ExcDimensionMismatch(selected_dofs.size(), dof.n_locally_owned_dofs()));
+ Assert(selected_dofs.size() == dof.n_locally_owned_dofs(),
+ ExcDimensionMismatch(selected_dofs.size(),
+ dof.n_locally_owned_dofs()));
// two special cases: no component is selected, and all components are
// selected; both rather stupid, but easy to catch
std::vector<bool> & selected_dofs)
{
// simply defer to the other extract_level_dofs() function
- extract_level_dofs(
- level, dof, dof.get_fe().component_mask(block_mask), selected_dofs);
+ extract_level_dofs(level,
+ dof,
+ dof.get_fe().component_mask(block_mask),
+ selected_dofs);
}
// sort, compress out duplicates, fill into index set
std::sort(dofs_on_ghosts.begin(), dofs_on_ghosts.end());
- dof_set.add_indices(
- dofs_on_ghosts.begin(),
- std::unique(dofs_on_ghosts.begin(), dofs_on_ghosts.end()));
+ dof_set.add_indices(dofs_on_ghosts.begin(),
+ std::unique(dofs_on_ghosts.begin(),
+ dofs_on_ghosts.end()));
dof_set.compress();
}
// sort, compress out duplicates, fill into index set
std::sort(dofs_on_ghosts.begin(), dofs_on_ghosts.end());
- dof_set.add_indices(
- dofs_on_ghosts.begin(),
- std::unique(dofs_on_ghosts.begin(), dofs_on_ghosts.end()));
+ dof_set.add_indices(dofs_on_ghosts.begin(),
+ std::unique(dofs_on_ghosts.begin(),
+ dofs_on_ghosts.end()));
dof_set.compress();
}
std::vector<unsigned char> dofs_by_component(
dof_handler.n_locally_owned_dofs());
- internal::get_component_association(
- dof_handler, component_mask, dofs_by_component);
+ internal::get_component_association(dof_handler,
+ component_mask,
+ dofs_by_component);
unsigned int n_selected_dofs = 0;
for (unsigned int i = 0; i < n_components; ++i)
if (component_mask[i] == true)
// If the Triangulation is distributed, the only thing we can usefully
// ask is for its locally owned subdomain
- Assert(
- (dynamic_cast<const parallel::distributed::Triangulation<
- DoFHandlerType::dimension,
- DoFHandlerType::space_dimension> *>(
- &dof_handler.get_triangulation()) == nullptr),
- ExcMessage("For parallel::distributed::Triangulation objects and "
- "associated DoF handler objects, asking for any information "
- "related to a subdomain other than the locally owned one does "
- "not make sense."));
+ Assert((dynamic_cast<const parallel::distributed::Triangulation<
+ DoFHandlerType::dimension,
+ DoFHandlerType::space_dimension> *>(
+ &dof_handler.get_triangulation()) == nullptr),
+ ExcMessage(
+ "For parallel::distributed::Triangulation objects and "
+ "associated DoF handler objects, asking for any information "
+ "related to a subdomain other than the locally owned one does "
+ "not make sense."));
// The following is a random process (flip of a coin), thus should be called
// once only.
{
// If the Triangulation is distributed, the only thing we can usefully
// ask is for its locally owned subdomain
- Assert(
- (dynamic_cast<const parallel::distributed::Triangulation<
- DoFHandlerType::dimension,
- DoFHandlerType::space_dimension> *>(
- &dof_handler.get_triangulation()) == nullptr),
- ExcMessage("For parallel::distributed::Triangulation objects and "
- "associated DoF handler objects, asking for any information "
- "related to a subdomain other than the locally owned one does "
- "not make sense."));
+ Assert((dynamic_cast<const parallel::distributed::Triangulation<
+ DoFHandlerType::dimension,
+ DoFHandlerType::space_dimension> *>(
+ &dof_handler.get_triangulation()) == nullptr),
+ ExcMessage(
+ "For parallel::distributed::Triangulation objects and "
+ "associated DoF handler objects, asking for any information "
+ "related to a subdomain other than the locally owned one does "
+ "not make sense."));
// Collect all the locally owned DoFs
// Note: Even though the distribution of DoFs by the
"associated DoF handler objects, asking for any subdomain other "
"than the locally owned one does not make sense."));
- Assert(
- subdomain_association.size() == dof_handler.n_dofs(),
- ExcDimensionMismatch(subdomain_association.size(), dof_handler.n_dofs()));
+ Assert(subdomain_association.size() == dof_handler.n_dofs(),
+ ExcDimensionMismatch(subdomain_association.size(),
+ dof_handler.n_dofs()));
// catch an error that happened in some versions of the shared tria
// distribute_dofs() function where we were trying to call this
dof_handler.n_dofs());
get_subdomain_association(dof_handler, subdomain_association);
- return std::count(
- subdomain_association.begin(), subdomain_association.end(), subdomain);
+ return std::count(subdomain_association.begin(),
+ subdomain_association.end(),
+ subdomain);
}
}
// sort indices and remove duplicates
std::sort(subdomain_indices.begin(), subdomain_indices.end());
- subdomain_indices.erase(
- std::unique(subdomain_indices.begin(), subdomain_indices.end()),
- subdomain_indices.end());
+ subdomain_indices.erase(std::unique(subdomain_indices.begin(),
+ subdomain_indices.end()),
+ subdomain_indices.end());
// insert into IndexSet
index_set.add_indices(subdomain_indices.begin(), subdomain_indices.end());
get_subdomain_association(dof_handler, subdomain_association);
std::vector<unsigned char> component_association(dof_handler.n_dofs());
- internal::get_component_association(
- dof_handler, std::vector<bool>(), component_association);
+ internal::get_component_association(dof_handler,
+ std::vector<bool>(),
+ component_association);
for (unsigned int c = 0; c < dof_handler.get_fe(0).n_components(); ++c)
{
// do so in parallel
std::vector<unsigned char> dofs_by_component(
dof_handler.n_locally_owned_dofs());
- internal::get_component_association(
- dof_handler, ComponentMask(), dofs_by_component);
+ internal::get_component_association(dof_handler,
+ ComponentMask(),
+ dofs_by_component);
// next count what we got
unsigned int component = 0;
std::vector<types::global_dof_index> &mapping)
{
mapping.clear();
- mapping.insert(
- mapping.end(), dof_handler.n_dofs(), numbers::invalid_dof_index);
+ mapping.insert(mapping.end(),
+ dof_handler.n_dofs(),
+ numbers::invalid_dof_index);
std::vector<types::global_dof_index> dofs_on_face;
dofs_on_face.reserve(max_dofs_per_face(dof_handler));
ExcInvalidBoundaryIndicator());
mapping.clear();
- mapping.insert(
- mapping.end(), dof_handler.n_dofs(), numbers::invalid_dof_index);
+ mapping.insert(mapping.end(),
+ dof_handler.n_dofs(),
+ numbers::invalid_dof_index);
// return if there is nothing to do
if (boundary_ids.size() == 0)
//
// The weights of the quadrature rule have been set to invalid
// values by the used constructor.
- hp::FEValues<dim, spacedim> hp_fe_values(
- mapping, fe_collection, q_coll_dummy, update_quadrature_points);
+ hp::FEValues<dim, spacedim> hp_fe_values(mapping,
+ fe_collection,
+ q_coll_dummy,
+ update_quadrature_points);
typename DoFHandlerType::active_cell_iterator cell = dof_handler
.begin_active(),
endc = dof_handler.end();
// gets a MappingCollection
const hp::MappingCollection<dim, spacedim> mapping_collection(mapping);
- internal::map_dofs_to_support_points(
- mapping_collection, dof_handler, support_points);
+ internal::map_dofs_to_support_points(mapping_collection,
+ dof_handler,
+ support_points);
}
// gets a MappingCollection
const hp::MappingCollection<dim, spacedim> mapping_collection(mapping);
- internal::map_dofs_to_support_points(
- mapping_collection, dof_handler, support_points);
+ internal::map_dofs_to_support_points(mapping_collection,
+ dof_handler,
+ support_points);
}
for (cell = dof_handler.begin(level); cell != endc; ++cell)
if (cell->is_locally_owned_on_level())
++i;
- block_list.reinit(
- i, dof_handler.n_dofs(), dof_handler.get_fe().dofs_per_cell);
+ block_list.reinit(i,
+ dof_handler.n_dofs(),
+ dof_handler.get_fe().dofs_per_cell);
i = 0;
for (cell = dof_handler.begin(level); cell != endc; ++cell)
if (cell->is_locally_owned_on_level())
// At this point, the list of patches is ready. Now we enter the dofs
// into the sparsity pattern.
- block_list.reinit(
- vertex_dof_count.size(), dof_handler.n_dofs(level), vertex_dof_count);
+ block_list.reinit(vertex_dof_count.size(),
+ dof_handler.n_dofs(level),
+ vertex_dof_count);
std::vector<types::global_dof_index> indices;
std::vector<bool> exclude;
std::vector<bool> &);
#endif
- template void
- DoFTools::extract_boundary_dofs<DoFHandler<deal_II_dimension>>(
- const DoFHandler<deal_II_dimension> &,
- const ComponentMask &,
- std::vector<bool> &,
- const std::set<types::boundary_id> &);
+ template void DoFTools::extract_boundary_dofs<
+ DoFHandler<deal_II_dimension>>(const DoFHandler<deal_II_dimension> &,
+ const ComponentMask &,
+ std::vector<bool> &,
+ const std::set<types::boundary_id> &);
template void
DoFTools::extract_boundary_dofs<hp::DoFHandler<deal_II_dimension>>(
std::vector<bool> &,
const std::set<types::boundary_id> &);
- template void
- DoFTools::extract_boundary_dofs<DoFHandler<deal_II_dimension>>(
- const DoFHandler<deal_II_dimension> &,
- const ComponentMask &,
- IndexSet &,
- const std::set<types::boundary_id> &);
+ template void DoFTools::extract_boundary_dofs<
+ DoFHandler<deal_II_dimension>>(const DoFHandler<deal_II_dimension> &,
+ const ComponentMask &,
+ IndexSet &,
+ const std::set<types::boundary_id> &);
template void
DoFTools::extract_boundary_dofs<hp::DoFHandler<deal_II_dimension>>(
DoFTools::locally_relevant_dofs_per_subdomain<hp::DoFHandler<1, 3>>(
const hp::DoFHandler<1, 3> &dof_handler);
- template unsigned int
- DoFTools::count_dofs_with_subdomain_association<DoFHandler<1, 3>>(
- const DoFHandler<1, 3> &, const types::subdomain_id);
- template IndexSet
- DoFTools::dof_indices_with_subdomain_association<DoFHandler<1, 3>>(
- const DoFHandler<1, 3> &, const types::subdomain_id);
- template void
- DoFTools::count_dofs_with_subdomain_association<DoFHandler<1, 3>>(
- const DoFHandler<1, 3> &,
- const types::subdomain_id,
- std::vector<unsigned int> &);
+ template unsigned int DoFTools::count_dofs_with_subdomain_association<
+ DoFHandler<1, 3>>(const DoFHandler<1, 3> &, const types::subdomain_id);
+ template IndexSet DoFTools::dof_indices_with_subdomain_association<
+ DoFHandler<1, 3>>(const DoFHandler<1, 3> &, const types::subdomain_id);
+ template void DoFTools::count_dofs_with_subdomain_association<
+ DoFHandler<1, 3>>(const DoFHandler<1, 3> &,
+ const types::subdomain_id,
+ std::vector<unsigned int> &);
template unsigned int
DoFTools::count_dofs_with_subdomain_association<hp::DoFHandler<1, 3>>(
template IndexSet
DoFTools::dof_indices_with_subdomain_association<hp::DoFHandler<1, 3>>(
const hp::DoFHandler<1, 3> &, const types::subdomain_id);
- template void
- DoFTools::count_dofs_with_subdomain_association<hp::DoFHandler<1, 3>>(
- const hp::DoFHandler<1, 3> &,
- const types::subdomain_id,
- std::vector<unsigned int> &);
+ template void DoFTools::count_dofs_with_subdomain_association<
+ hp::DoFHandler<1, 3>>(const hp::DoFHandler<1, 3> &,
+ const types::subdomain_id,
+ std::vector<unsigned int> &);
#endif
- template void
- DoFTools::count_dofs_per_component<DoFHandler<deal_II_dimension>>(
- const DoFHandler<deal_II_dimension> &,
- std::vector<types::global_dof_index> &,
- bool,
- std::vector<unsigned int>);
+ template void DoFTools::count_dofs_per_component<
+ DoFHandler<deal_II_dimension>>(const DoFHandler<deal_II_dimension> &,
+ std::vector<types::global_dof_index> &,
+ bool,
+ std::vector<unsigned int>);
template void
DoFTools::count_dofs_per_component<hp::DoFHandler<deal_II_dimension>>(
std::vector<types::global_dof_index> &,
const std::vector<unsigned int> &);
- template void
- DoFTools::map_dof_to_boundary_indices<DoFHandler<deal_II_dimension>>(
- const DoFHandler<deal_II_dimension> &,
- const std::set<types::boundary_id> &,
- std::vector<types::global_dof_index> &);
+ template void DoFTools::map_dof_to_boundary_indices<
+ DoFHandler<deal_II_dimension>>(const DoFHandler<deal_II_dimension> &,
+ const std::set<types::boundary_id> &,
+ std::vector<types::global_dof_index> &);
- template void
- DoFTools::map_dof_to_boundary_indices<DoFHandler<deal_II_dimension>>(
- const DoFHandler<deal_II_dimension> &,
- std::vector<types::global_dof_index> &);
+ template void DoFTools::map_dof_to_boundary_indices<
+ DoFHandler<deal_II_dimension>>(const DoFHandler<deal_II_dimension> &,
+ std::vector<types::global_dof_index> &);
{
master_dof_mask =
std_cxx14::make_unique<std::vector<bool>>(fe1.dofs_per_face);
- select_master_dofs_for_face_restriction(
- fe1, fe2, face_interpolation_matrix, *master_dof_mask);
+ select_master_dofs_for_face_restriction(fe1,
+ fe2,
+ face_interpolation_matrix,
+ *master_dof_mask);
}
}
{
if (matrix == nullptr)
{
- matrix = std_cxx14::make_unique<FullMatrix<double>>(
- fe2.dofs_per_face, fe1.dofs_per_face);
+ matrix =
+ std_cxx14::make_unique<FullMatrix<double>>(fe2.dofs_per_face,
+ fe1.dofs_per_face);
fe1.get_face_interpolation_matrix(fe2, *matrix);
}
}
{
if (matrix == nullptr)
{
- matrix = std_cxx14::make_unique<FullMatrix<double>>(
- fe2.dofs_per_face, fe1.dofs_per_face);
+ matrix =
+ std_cxx14::make_unique<FullMatrix<double>>(fe2.dofs_per_face,
+ fe1.dofs_per_face);
fe1.get_subface_interpolation_matrix(fe2, subface, *matrix);
}
}
&split_matrix)
{
AssertDimension(master_dof_mask.size(), face_interpolation_matrix.m());
- Assert(
- std::count(master_dof_mask.begin(), master_dof_mask.end(), true) ==
- static_cast<signed int>(face_interpolation_matrix.n()),
- ExcInternalError());
+ Assert(std::count(master_dof_mask.begin(),
+ master_dof_mask.end(),
+ true) ==
+ static_cast<signed int>(face_interpolation_matrix.n()),
+ ExcInternalError());
if (split_matrix == nullptr)
{
dofs_on_children.clear();
dofs_on_children.reserve(n_dofs_on_children);
- Assert(
- n_dofs_on_mother == fe.constraints().n(),
- ExcDimensionMismatch(n_dofs_on_mother, fe.constraints().n()));
+ Assert(n_dofs_on_mother == fe.constraints().n(),
+ ExcDimensionMismatch(n_dofs_on_mother,
+ fe.constraints().n()));
Assert(n_dofs_on_children == fe.constraints().m(),
ExcDimensionMismatch(n_dofs_on_children,
fe.constraints().m()));
dofs_on_children.clear();
dofs_on_children.reserve(n_dofs_on_children);
- Assert(
- n_dofs_on_mother == fe.constraints().n(),
- ExcDimensionMismatch(n_dofs_on_mother, fe.constraints().n()));
+ Assert(n_dofs_on_mother == fe.constraints().n(),
+ ExcDimensionMismatch(n_dofs_on_mother,
+ fe.constraints().n()));
Assert(n_dofs_on_children == fe.constraints().m(),
ExcDimensionMismatch(n_dofs_on_children,
fe.constraints().m()));
// In the case that both faces have children, we loop over all
// children and apply make_periodicty_constrains recursively:
- Assert(
- face_1->n_children() == GeometryInfo<dim>::max_children_per_face &&
- face_2->n_children() == GeometryInfo<dim>::max_children_per_face,
- ExcNotImplemented());
+ Assert(face_1->n_children() ==
+ GeometryInfo<dim>::max_children_per_face &&
+ face_2->n_children() ==
+ GeometryInfo<dim>::max_children_per_face,
+ ExcNotImplemented());
for (unsigned int i = 0; i < GeometryInfo<dim>::max_children_per_face;
++i)
// face_1. Therefore face_flip has to be toggled if
// face_rotation is true:
// In case of inverted orientation, nothing has to be done.
- set_periodicity_constraints(
- face_1,
- face_2,
- transformation,
- constraint_matrix,
- component_mask,
- face_orientation,
- face_orientation ? face_rotation ^ face_flip : face_flip,
- face_rotation);
+ set_periodicity_constraints(face_1,
+ face_2,
+ transformation,
+ constraint_matrix,
+ component_mask,
+ face_orientation,
+ face_orientation ?
+ face_rotation ^ face_flip :
+ face_flip,
+ face_rotation);
}
}
}
GridTools::collect_periodic_faces(
dof_handler, b_id1, b_id2, direction, matched_faces);
- make_periodicity_constraints<DoFHandlerType>(
- matched_faces, constraints, component_mask);
+ make_periodicity_constraints<DoFHandlerType>(matched_faces,
+ constraints,
+ component_mask);
}
matched_faces;
// Collect matching periodic cells on the coarsest level:
- GridTools::collect_periodic_faces(
- dof_handler, b_id, direction, matched_faces);
-
- make_periodicity_constraints<DoFHandlerType>(
- matched_faces, constraints, component_mask);
+ GridTools::collect_periodic_faces(dof_handler,
+ b_id,
+ direction,
+ matched_faces);
+
+ make_periodicity_constraints<DoFHandlerType>(matched_faces,
+ constraints,
+ component_mask);
}
dof_is_interesting[local_dof_indices[i]] = true;
};
- n_parameters_on_fine_grid = std::count(
- dof_is_interesting.begin(), dof_is_interesting.end(), true);
+ n_parameters_on_fine_grid = std::count(dof_is_interesting.begin(),
+ dof_is_interesting.end(),
+ true);
};
// Find out if a dof has a contribution in this
// component, and if so, add it to the list
const std::vector<types::global_dof_index>::iterator
- it_index_on_cell = std::find(
- cell_dofs.begin(), cell_dofs.end(), face_dofs[i]);
+ it_index_on_cell = std::find(cell_dofs.begin(),
+ cell_dofs.end(),
+ face_dofs[i]);
Assert(it_index_on_cell != cell_dofs.end(),
ExcInvalidIterator());
const unsigned int index_on_cell =
// If we have a distributed::Triangulation only allow locally_owned
// subdomain. Not setting a subdomain is also okay, because we skip
// ghost cells in the loop below.
- Assert(
- (dof.get_triangulation().locally_owned_subdomain() ==
- numbers::invalid_subdomain_id) ||
- (subdomain_id == numbers::invalid_subdomain_id) ||
- (subdomain_id == dof.get_triangulation().locally_owned_subdomain()),
- ExcMessage(
- "For parallel::distributed::Triangulation objects and "
- "associated DoF handler objects, asking for any subdomain other "
- "than the locally owned one does not make sense."));
+ Assert((dof.get_triangulation().locally_owned_subdomain() ==
+ numbers::invalid_subdomain_id) ||
+ (subdomain_id == numbers::invalid_subdomain_id) ||
+ (subdomain_id ==
+ dof.get_triangulation().locally_owned_subdomain()),
+ ExcMessage(
+ "For parallel::distributed::Triangulation objects and "
+ "associated DoF handler objects, asking for any subdomain other "
+ "than the locally owned one does not make sense."));
std::vector<types::global_dof_index> dofs_on_this_cell;
dofs_on_this_cell.reserve(max_dofs_per_cell(dof));
// make sparsity pattern for this cell. if no constraints pattern
// was given, then the following call acts as if simply no
// constraints existed
- constraints.add_entries_local_to_global(
- dofs_on_this_cell, sparsity, keep_constrained_dofs);
+ constraints.add_entries_local_to_global(dofs_on_this_cell,
+ sparsity,
+ keep_constrained_dofs);
}
}
ExcDimensionMismatch(sparsity.n_rows(), n_dofs));
Assert(sparsity.n_cols() == n_dofs,
ExcDimensionMismatch(sparsity.n_cols(), n_dofs));
- Assert(
- couplings.n_rows() == dof.get_fe(0).n_components(),
- ExcDimensionMismatch(couplings.n_rows(), dof.get_fe(0).n_components()));
- Assert(
- couplings.n_cols() == dof.get_fe(0).n_components(),
- ExcDimensionMismatch(couplings.n_cols(), dof.get_fe(0).n_components()));
+ Assert(couplings.n_rows() == dof.get_fe(0).n_components(),
+ ExcDimensionMismatch(couplings.n_rows(),
+ dof.get_fe(0).n_components()));
+ Assert(couplings.n_cols() == dof.get_fe(0).n_components(),
+ ExcDimensionMismatch(couplings.n_cols(),
+ dof.get_fe(0).n_components()));
// If we have a distributed::Triangulation only allow locally_owned
// subdomain. Not setting a subdomain is also okay, because we skip
// ghost cells in the loop below.
- Assert(
- (dof.get_triangulation().locally_owned_subdomain() ==
- numbers::invalid_subdomain_id) ||
- (subdomain_id == numbers::invalid_subdomain_id) ||
- (subdomain_id == dof.get_triangulation().locally_owned_subdomain()),
- ExcMessage(
- "For parallel::distributed::Triangulation objects and "
- "associated DoF handler objects, asking for any subdomain other "
- "than the locally owned one does not make sense."));
+ Assert((dof.get_triangulation().locally_owned_subdomain() ==
+ numbers::invalid_subdomain_id) ||
+ (subdomain_id == numbers::invalid_subdomain_id) ||
+ (subdomain_id ==
+ dof.get_triangulation().locally_owned_subdomain()),
+ ExcMessage(
+ "For parallel::distributed::Triangulation objects and "
+ "associated DoF handler objects, asking for any subdomain other "
+ "than the locally owned one does not make sense."));
const hp::FECollection<DoFHandlerType::dimension,
DoFHandlerType::space_dimension> &fe_collection =
std::vector<Table<2, bool>> bool_dof_mask(fe_collection.size());
for (unsigned int f = 0; f < fe_collection.size(); ++f)
{
- bool_dof_mask[f].reinit(TableIndices<2>(
- fe_collection[f].dofs_per_cell, fe_collection[f].dofs_per_cell));
+ bool_dof_mask[f].reinit(
+ TableIndices<2>(fe_collection[f].dofs_per_cell,
+ fe_collection[f].dofs_per_cell));
bool_dof_mask[f].fill(false);
for (unsigned int i = 0; i < fe_collection[f].dofs_per_cell; ++i)
for (unsigned int j = 0; j < fe_collection[f].dofs_per_cell; ++j)
// If we have a distributed::Triangulation only allow locally_owned
// subdomain. Not setting a subdomain is also okay, because we skip
// ghost cells in the loop below.
- Assert(
- (dof.get_triangulation().locally_owned_subdomain() ==
- numbers::invalid_subdomain_id) ||
- (subdomain_id == numbers::invalid_subdomain_id) ||
- (subdomain_id == dof.get_triangulation().locally_owned_subdomain()),
- ExcMessage(
- "For parallel::distributed::Triangulation objects and "
- "associated DoF handler objects, asking for any subdomain other "
- "than the locally owned one does not make sense."));
+ Assert((dof.get_triangulation().locally_owned_subdomain() ==
+ numbers::invalid_subdomain_id) ||
+ (subdomain_id == numbers::invalid_subdomain_id) ||
+ (subdomain_id ==
+ dof.get_triangulation().locally_owned_subdomain()),
+ ExcMessage(
+ "For parallel::distributed::Triangulation objects and "
+ "associated DoF handler objects, asking for any subdomain other "
+ "than the locally owned one does not make sense."));
std::vector<types::global_dof_index> dofs_on_this_cell;
std::vector<types::global_dof_index> dofs_on_other_cell;
// make sparsity pattern for this cell. if no constraints pattern
// was given, then the following call acts as if simply no
// constraints existed
- constraints.add_entries_local_to_global(
- dofs_on_this_cell, sparsity, keep_constrained_dofs);
+ constraints.add_entries_local_to_global(dofs_on_this_cell,
+ sparsity,
+ keep_constrained_dofs);
for (unsigned int face = 0;
face < GeometryInfo<DoFHandlerType::dimension>::faces_per_cell;
const FiniteElement<dim, spacedim> &fe,
const Table<2, Coupling> & component_couplings)
{
- Assert(
- component_couplings.n_rows() == fe.n_components(),
- ExcDimensionMismatch(component_couplings.n_rows(), fe.n_components()));
- Assert(
- component_couplings.n_cols() == fe.n_components(),
- ExcDimensionMismatch(component_couplings.n_cols(), fe.n_components()));
+ Assert(component_couplings.n_rows() == fe.n_components(),
+ ExcDimensionMismatch(component_couplings.n_rows(),
+ fe.n_components()));
+ Assert(component_couplings.n_cols() == fe.n_components(),
+ ExcDimensionMismatch(component_couplings.n_cols(),
+ fe.n_components()));
const unsigned int n_dofs = fe.dofs_per_cell;
std::vector<types::global_dof_index> dofs_on_other_cell(
fe.dofs_per_cell);
- const Table<2, Coupling> int_dof_mask =
- dof_couplings_from_component_couplings(
- fe, int_mask),
- flux_dof_mask =
- dof_couplings_from_component_couplings(
- fe, flux_mask);
+ const Table<2, Coupling>
+ int_dof_mask = dof_couplings_from_component_couplings(fe, int_mask),
+ flux_dof_mask = dof_couplings_from_component_couplings(fe, flux_mask);
Table<2, bool> support_on_face(
fe.dofs_per_cell,
.get_nonzero_components(j)
.first_selected_component());
- Assert(
- jj <
- sub_neighbor->get_fe().n_components(),
- ExcInternalError());
+ Assert(jj < sub_neighbor->get_fe()
+ .n_components(),
+ ExcInternalError());
if ((flux_mask(ii, jj) == always) ||
(flux_mask(ii, jj) == nonzero))
// If we have a distributed::Triangulation only allow locally_owned
// subdomain. Not setting a subdomain is also okay, because we skip
// ghost cells in the loop below.
- Assert(
- (dof.get_triangulation().locally_owned_subdomain() ==
- numbers::invalid_subdomain_id) ||
- (subdomain_id == numbers::invalid_subdomain_id) ||
- (subdomain_id == dof.get_triangulation().locally_owned_subdomain()),
- ExcMessage(
- "For parallel::distributed::Triangulation objects and "
- "associated DoF handler objects, asking for any subdomain other "
- "than the locally owned one does not make sense."));
+ Assert((dof.get_triangulation().locally_owned_subdomain() ==
+ numbers::invalid_subdomain_id) ||
+ (subdomain_id == numbers::invalid_subdomain_id) ||
+ (subdomain_id ==
+ dof.get_triangulation().locally_owned_subdomain()),
+ ExcMessage(
+ "For parallel::distributed::Triangulation objects and "
+ "associated DoF handler objects, asking for any subdomain other "
+ "than the locally owned one does not make sense."));
internal::make_flux_sparsity_pattern(dof,
sparsity,
const std::vector<types::global_dof_index> &,
SP &);
- template void
- DoFTools::make_boundary_sparsity_pattern<hp::DoFHandler<deal_II_dimension>,
- SP>(
- const hp::DoFHandler<deal_II_dimension> &dof,
- const std::vector<types::global_dof_index> &,
- SP &);
+ template void DoFTools::make_boundary_sparsity_pattern<
+ hp::DoFHandler<deal_II_dimension>,
+ SP>(const hp::DoFHandler<deal_II_dimension> &dof,
+ const std::vector<types::global_dof_index> &,
+ SP &);
template void
DoFTools::make_flux_sparsity_pattern<DoFHandler<deal_II_dimension>, SP>(
{
namespace DoFHandlerImplementation
{
- NumberCache::NumberCache() : n_global_dofs(0), n_locally_owned_dofs(0)
+ NumberCache::NumberCache()
+ : n_global_dofs(0)
+ , n_locally_owned_dofs(0)
{}
- NumberCache::NumberCache(const types::global_dof_index n_global_dofs) :
- n_global_dofs(n_global_dofs),
- n_locally_owned_dofs(n_global_dofs),
- locally_owned_dofs(complete_index_set(n_global_dofs)),
- n_locally_owned_dofs_per_processor(1, n_global_dofs),
- locally_owned_dofs_per_processor(1, complete_index_set(n_global_dofs))
+ NumberCache::NumberCache(const types::global_dof_index n_global_dofs)
+ : n_global_dofs(n_global_dofs)
+ , n_locally_owned_dofs(n_global_dofs)
+ , locally_owned_dofs(complete_index_set(n_global_dofs))
+ , n_locally_owned_dofs_per_processor(1, n_global_dofs)
+ , locally_owned_dofs_per_processor(1, complete_index_set(n_global_dofs))
{}
NumberCache::NumberCache(
const std::vector<IndexSet> &locally_owned_dofs_per_processor,
- const unsigned int my_rank) :
- locally_owned_dofs_per_processor(locally_owned_dofs_per_processor)
+ const unsigned int my_rank)
+ : locally_owned_dofs_per_processor(locally_owned_dofs_per_processor)
{
const unsigned int n_procs = locally_owned_dofs_per_processor.size();
template <int dim, int spacedim>
-FiniteElement<dim, spacedim>::InternalDataBase::InternalDataBase() :
- update_each(update_default)
+FiniteElement<dim, spacedim>::InternalDataBase::InternalDataBase()
+ : update_each(update_default)
{}
FiniteElement<dim, spacedim>::FiniteElement(
const FiniteElementData<dim> & fe_data,
const std::vector<bool> & r_i_a_f,
- const std::vector<ComponentMask> &nonzero_c) :
- FiniteElementData<dim>(fe_data),
- adjust_quad_dof_index_for_face_orientation_table(
- dim == 3 ? this->dofs_per_quad : 0,
- dim == 3 ? 8 : 0),
- adjust_line_dof_index_for_line_orientation_table(
- dim == 3 ? this->dofs_per_line : 0),
- system_to_base_table(this->dofs_per_cell),
- face_system_to_base_table(this->dofs_per_face),
- component_to_base_table(this->components,
- std::make_pair(std::make_pair(0U, 0U), 0U)),
+ const std::vector<ComponentMask> &nonzero_c)
+ : FiniteElementData<dim>(fe_data)
+ , adjust_quad_dof_index_for_face_orientation_table(dim == 3 ?
+ this->dofs_per_quad :
+ 0,
+ dim == 3 ? 8 : 0)
+ , adjust_line_dof_index_for_line_orientation_table(
+ dim == 3 ? this->dofs_per_line : 0)
+ , system_to_base_table(this->dofs_per_cell)
+ , face_system_to_base_table(this->dofs_per_face)
+ , component_to_base_table(this->components,
+ std::make_pair(std::make_pair(0U, 0U), 0U))
+ ,
// Special handling of vectors of length one: in this case, we
// assume that all entries were supposed to be equal
restriction_is_additive_flags(
r_i_a_f.size() == 1 ? std::vector<bool>(fe_data.dofs_per_cell, r_i_a_f[0]) :
- r_i_a_f),
- nonzero_components(
- nonzero_c.size() == 1 ?
- std::vector<ComponentMask>(fe_data.dofs_per_cell, nonzero_c[0]) :
- nonzero_c),
- n_nonzero_components_table(compute_n_nonzero_components(nonzero_components)),
- cached_primitivity(std::find_if(n_nonzero_components_table.begin(),
- n_nonzero_components_table.end(),
- std::bind(std::not_equal_to<unsigned int>(),
- std::placeholders::_1,
- 1U)) ==
- n_nonzero_components_table.end())
+ r_i_a_f)
+ , nonzero_components(
+ nonzero_c.size() == 1 ?
+ std::vector<ComponentMask>(fe_data.dofs_per_cell, nonzero_c[0]) :
+ nonzero_c)
+ , n_nonzero_components_table(compute_n_nonzero_components(nonzero_components))
+ , cached_primitivity(std::find_if(n_nonzero_components_table.begin(),
+ n_nonzero_components_table.end(),
+ std::bind(std::not_equal_to<unsigned int>(),
+ std::placeholders::_1,
+ 1U)) ==
+ n_nonzero_components_table.end())
{
Assert(restriction_is_additive_flags.size() == this->dofs_per_cell,
ExcDimensionMismatch(restriction_is_additive_flags.size(),
ref < RefinementCase<dim>::isotropic_refinement + 1;
++ref)
{
- prolongation[ref - 1].resize(
- GeometryInfo<dim>::n_children(RefinementCase<dim>(ref)),
- FullMatrix<double>());
- restriction[ref - 1].resize(
- GeometryInfo<dim>::n_children(RefinementCase<dim>(ref)),
- FullMatrix<double>());
+ prolongation[ref - 1].resize(GeometryInfo<dim>::n_children(
+ RefinementCase<dim>(ref)),
+ FullMatrix<double>());
+ restriction[ref - 1].resize(GeometryInfo<dim>::n_children(
+ RefinementCase<dim>(ref)),
+ FullMatrix<double>());
}
adjust_quad_dof_index_for_face_orientation_table.fill(0);
const RefinementCase<dim> &refinement_case) const
{
Assert(refinement_case < RefinementCase<dim>::isotropic_refinement + 1,
- ExcIndexRange(
- refinement_case, 0, RefinementCase<dim>::isotropic_refinement + 1));
- Assert(
- refinement_case != RefinementCase<dim>::no_refinement,
- ExcMessage("Restriction matrices are only available for refined cells!"));
- Assert(
- child < GeometryInfo<dim>::n_children(RefinementCase<dim>(refinement_case)),
- ExcIndexRange(
- child,
- 0,
- GeometryInfo<dim>::n_children(RefinementCase<dim>(refinement_case))));
+ ExcIndexRange(refinement_case,
+ 0,
+ RefinementCase<dim>::isotropic_refinement + 1));
+ Assert(refinement_case != RefinementCase<dim>::no_refinement,
+ ExcMessage(
+ "Restriction matrices are only available for refined cells!"));
+ Assert(child <
+ GeometryInfo<dim>::n_children(RefinementCase<dim>(refinement_case)),
+ ExcIndexRange(child,
+ 0,
+ GeometryInfo<dim>::n_children(
+ RefinementCase<dim>(refinement_case))));
// we use refinement_case-1 here. the -1 takes care of the origin of the
// vector, as for RefinementCase<dim>::no_refinement (=0) there is no data
// available and so the vector indices are shifted
const RefinementCase<dim> &refinement_case) const
{
Assert(refinement_case < RefinementCase<dim>::isotropic_refinement + 1,
- ExcIndexRange(
- refinement_case, 0, RefinementCase<dim>::isotropic_refinement + 1));
- Assert(
- refinement_case != RefinementCase<dim>::no_refinement,
- ExcMessage("Prolongation matrices are only available for refined cells!"));
- Assert(
- child < GeometryInfo<dim>::n_children(RefinementCase<dim>(refinement_case)),
- ExcIndexRange(
- child,
- 0,
- GeometryInfo<dim>::n_children(RefinementCase<dim>(refinement_case))));
+ ExcIndexRange(refinement_case,
+ 0,
+ RefinementCase<dim>::isotropic_refinement + 1));
+ Assert(refinement_case != RefinementCase<dim>::no_refinement,
+ ExcMessage(
+ "Prolongation matrices are only available for refined cells!"));
+ Assert(child <
+ GeometryInfo<dim>::n_children(RefinementCase<dim>(refinement_case)),
+ ExcIndexRange(child,
+ 0,
+ GeometryInfo<dim>::n_children(
+ RefinementCase<dim>(refinement_case))));
// we use refinement_case-1 here. the -1 takes care
// of the origin of the vector, as for
// RefinementCase::no_refinement (=0) there is no
// other than standard orientation
if ((face_orientation != true) || (face_flip != false) ||
(face_rotation != false))
- Assert(
- (this->dofs_per_line <= 1) && (this->dofs_per_quad <= 1),
- ExcMessage("The function in this base class can not handle this case. "
- "Rather, the derived class you are using must provide "
- "an overloaded version but apparently hasn't done so. See "
- "the documentation of this function for more information."));
+ Assert((this->dofs_per_line <= 1) && (this->dofs_per_quad <= 1),
+ ExcMessage(
+ "The function in this base class can not handle this case. "
+ "Rather, the derived class you are using must provide "
+ "an overloaded version but apparently hasn't done so. See "
+ "the documentation of this function for more information."));
// we need to distinguish between DoFs on vertices, lines and in 3d quads.
// do so in a sequence of if-else statements
#ifdef DEBUG
// check that it is contiguous:
for (unsigned int c = 0; c < n_total_components; ++c)
- Assert(
- (c < first_selected && (!mask[c])) ||
- (c >= first_selected && c < first_selected + n_selected && mask[c]) ||
- (c >= first_selected + n_selected && !mask[c]),
- ExcMessage("Error: the given ComponentMask is not contiguous!"));
+ Assert((c < first_selected && (!mask[c])) ||
+ (c >= first_selected && c < first_selected + n_selected &&
+ mask[c]) ||
+ (c >= first_selected + n_selected && !mask[c]),
+ ExcMessage("Error: the given ComponentMask is not contiguous!"));
#endif
return get_sub_fe(first_selected, n_selected);
template <int dim>
-FE_ABF<dim>::FE_ABF(const unsigned int deg) :
- FE_PolyTensor<PolynomialsABF<dim>, dim>(
- deg,
- FiniteElementData<dim>(get_dpo_vector(deg),
- dim,
- deg + 2,
- FiniteElementData<dim>::Hdiv),
- std::vector<bool>(PolynomialsABF<dim>::compute_n_pols(deg), true),
- std::vector<ComponentMask>(PolynomialsABF<dim>::compute_n_pols(deg),
- std::vector<bool>(dim, true))),
- rt_order(deg)
+FE_ABF<dim>::FE_ABF(const unsigned int deg)
+ : FE_PolyTensor<PolynomialsABF<dim>, dim>(
+ deg,
+ FiniteElementData<dim>(get_dpo_vector(deg),
+ dim,
+ deg + 2,
+ FiniteElementData<dim>::Hdiv),
+ std::vector<bool>(PolynomialsABF<dim>::compute_n_pols(deg), true),
+ std::vector<ComponentMask>(PolynomialsABF<dim>::compute_n_pols(deg),
+ std::vector<bool>(dim, true)))
+ , rt_order(deg)
{
Assert(dim >= 2, ExcImpossibleInDim(dim));
const unsigned int n_dofs = this->dofs_per_cell;
// TODO: Here the canonical extension of the principle
// behind the ABF elements is implemented. It is unclear,
// if this really leads to the ABF spaces in 3D!
- interior_weights_abf.reinit(TableIndices<3>(
- cell_quadrature.size(), polynomials_abf[0]->n() * dim, dim));
+ interior_weights_abf.reinit(TableIndices<3>(cell_quadrature.size(),
+ polynomials_abf[0]->n() * dim,
+ dim));
Tensor<1, dim> poly_grad;
for (unsigned int k = 0; k < cell_quadrature.size(); ++k)
{
for (unsigned int i = 0; i < polynomials_abf[0]->n() * dim; ++i)
{
- poly_grad = polynomials_abf[i % dim]->compute_grad(
- i / dim, cell_quadrature.point(k)) *
- cell_quadrature.weight(k);
+ poly_grad =
+ polynomials_abf[i % dim]->compute_grad(i / dim,
+ cell_quadrature.point(k)) *
+ cell_quadrature.weight(k);
// The minus sign comes from the use of the Gauss theorem to replace
// the divergence.
for (unsigned int d = 0; d < dim; ++d)
// subcell are NOT
// transformed, so we
// have to do it here.
- this->restriction[iso][child](
- face * this->dofs_per_face + i_face, i_child) +=
+ this->restriction[iso][child](face * this->dofs_per_face +
+ i_face,
+ i_child) +=
Utilities::fixed_power<dim - 1>(.5) * q_sub.weight(k) *
cached_values_face(i_child, k) *
this->shape_value_component(
for (unsigned int i_weight = 0; i_weight < polynomials[d]->n();
++i_weight)
{
- this->restriction[iso][child](
- start_cell_dofs + i_weight * dim + d, i_child) +=
+ this->restriction[iso][child](start_cell_dofs + i_weight * dim +
+ d,
+ i_child) +=
q_sub.weight(k) * cached_values_cell(i_child, k, d) *
polynomials[d]->compute_value(i_weight, q_sub.point(k));
}
Assert(support_point_values.size() == this->generalized_support_points.size(),
ExcDimensionMismatch(support_point_values.size(),
this->generalized_support_points.size()));
- Assert(
- support_point_values[0].size() == this->n_components(),
- ExcDimensionMismatch(support_point_values[0].size(), this->n_components()));
+ Assert(support_point_values[0].size() == this->n_components(),
+ ExcDimensionMismatch(support_point_values[0].size(),
+ this->n_components()));
Assert(nodal_values.size() == this->dofs_per_cell,
ExcDimensionMismatch(nodal_values.size(), this->dofs_per_cell));
DEAL_II_NAMESPACE_OPEN
template <int dim>
-FE_BDM<dim>::FE_BDM(const unsigned int deg) :
- FE_PolyTensor<PolynomialsBDM<dim>, dim>(
- deg,
- FiniteElementData<dim>(get_dpo_vector(deg),
- dim,
- deg + 1,
- FiniteElementData<dim>::Hdiv),
- get_ria_vector(deg),
- std::vector<ComponentMask>(PolynomialsBDM<dim>::compute_n_pols(deg),
- std::vector<bool>(dim, true)))
+FE_BDM<dim>::FE_BDM(const unsigned int deg)
+ : FE_PolyTensor<PolynomialsBDM<dim>, dim>(
+ deg,
+ FiniteElementData<dim>(get_dpo_vector(deg),
+ dim,
+ deg + 1,
+ FiniteElementData<dim>::Hdiv),
+ get_ria_vector(deg),
+ std::vector<ComponentMask>(PolynomialsBDM<dim>::compute_n_pols(deg),
+ std::vector<bool>(dim, true)))
{
Assert(dim >= 2, ExcImpossibleInDim(dim));
Assert(
AssertDimension(dbase,
this->dofs_per_face * GeometryInfo<dim>::faces_per_cell);
- AssertDimension(
- pbase, this->generalized_support_points.size() - test_values_cell.size());
+ AssertDimension(pbase,
+ this->generalized_support_points.size() -
+ test_values_cell.size());
// Done for BDM1
if (dbase == this->dofs_per_cell)
// point values on faces in 2D. In 3D, this is impossible, since the
// moments are only taken with respect to PolynomialsP.
if (dim > 2)
- internal::FE_BDM::initialize_test_values(
- test_values_face, face_points, deg);
+ internal::FE_BDM::initialize_test_values(test_values_face,
+ face_points,
+ deg);
if (deg <= 1)
return;
// the test functions in the
// interior quadrature points
- internal::FE_BDM::initialize_test_values(
- test_values_cell, cell_points, deg - 2);
+ internal::FE_BDM::initialize_test_values(test_values_cell,
+ cell_points,
+ deg - 2);
}
template <int dim, int spacedim>
-FE_Bernstein<dim, spacedim>::FE_Bernstein(const unsigned int degree) :
- FE_Q_Base<TensorProductPolynomials<dim>, dim, spacedim>(
- this->renumber_bases(degree),
- FiniteElementData<dim>(this->get_dpo_vector(degree),
- 1,
- degree,
- FiniteElementData<dim>::H1),
- std::vector<bool>(1, false))
+FE_Bernstein<dim, spacedim>::FE_Bernstein(const unsigned int degree)
+ : FE_Q_Base<TensorProductPolynomials<dim>, dim, spacedim>(
+ this->renumber_bases(degree),
+ FiniteElementData<dim>(this->get_dpo_vector(degree),
+ 1,
+ degree,
+ FiniteElementData<dim>::H1),
+ std::vector<bool>(1, false))
{}
FullMatrix<double> & interpolation_matrix) const
{
Assert(dim > 1, ExcImpossibleInDim(1));
- get_subface_interpolation_matrix(
- source_fe, numbers::invalid_unsigned_int, interpolation_matrix);
+ get_subface_interpolation_matrix(source_fe,
+ numbers::invalid_unsigned_int,
+ interpolation_matrix);
}
const unsigned int subface,
FullMatrix<double> & interpolation_matrix) const
{
- Assert(
- interpolation_matrix.m() == x_source_fe.dofs_per_face,
- ExcDimensionMismatch(interpolation_matrix.m(), x_source_fe.dofs_per_face));
+ Assert(interpolation_matrix.m() == x_source_fe.dofs_per_face,
+ ExcDimensionMismatch(interpolation_matrix.m(),
+ x_source_fe.dofs_per_face));
// see if source is a Bernstein element
if (const FE_Bernstein<dim, spacedim> *source_fe =
{
// have this test in here since a table of size 2x0 reports its size as
// 0x0
- Assert(
- interpolation_matrix.n() == this->dofs_per_face,
- ExcDimensionMismatch(interpolation_matrix.n(), this->dofs_per_face));
+ Assert(interpolation_matrix.n() == this->dofs_per_face,
+ ExcDimensionMismatch(interpolation_matrix.n(),
+ this->dofs_per_face));
// Make sure that the element for which the DoFs should be constrained
// is the one with the higher polynomial degree. Actually the procedure
const unsigned int n_components,
const unsigned int degree,
const Conformity conformity,
- const BlockIndices & block_indices) :
- dofs_per_vertex(dofs_per_object[0]),
- dofs_per_line(dofs_per_object[1]),
- dofs_per_quad(dim > 1 ? dofs_per_object[2] : 0),
- dofs_per_hex(dim > 2 ? dofs_per_object[3] : 0),
- first_line_index(GeometryInfo<dim>::vertices_per_cell * dofs_per_vertex),
- first_quad_index(first_line_index +
- GeometryInfo<dim>::lines_per_cell * dofs_per_line),
- first_hex_index(first_quad_index +
- GeometryInfo<dim>::quads_per_cell * dofs_per_quad),
- first_face_line_index(GeometryInfo<dim - 1>::vertices_per_cell *
- dofs_per_vertex),
- first_face_quad_index(
- (dim == 3 ? GeometryInfo<dim - 1>::vertices_per_cell * dofs_per_vertex :
- GeometryInfo<dim>::vertices_per_cell * dofs_per_vertex) +
- GeometryInfo<dim - 1>::lines_per_cell * dofs_per_line),
- dofs_per_face(GeometryInfo<dim>::vertices_per_face * dofs_per_vertex +
- GeometryInfo<dim>::lines_per_face * dofs_per_line +
- GeometryInfo<dim>::quads_per_face * dofs_per_quad),
- dofs_per_cell(GeometryInfo<dim>::vertices_per_cell * dofs_per_vertex +
- GeometryInfo<dim>::lines_per_cell * dofs_per_line +
- GeometryInfo<dim>::quads_per_cell * dofs_per_quad +
- GeometryInfo<dim>::hexes_per_cell * dofs_per_hex),
- components(n_components),
- degree(degree),
- conforming_space(conformity),
- block_indices_data(
- block_indices.size() == 0 ? BlockIndices(1, dofs_per_cell) : block_indices)
+ const BlockIndices & block_indices)
+ : dofs_per_vertex(dofs_per_object[0])
+ , dofs_per_line(dofs_per_object[1])
+ , dofs_per_quad(dim > 1 ? dofs_per_object[2] : 0)
+ , dofs_per_hex(dim > 2 ? dofs_per_object[3] : 0)
+ , first_line_index(GeometryInfo<dim>::vertices_per_cell * dofs_per_vertex)
+ , first_quad_index(first_line_index +
+ GeometryInfo<dim>::lines_per_cell * dofs_per_line)
+ , first_hex_index(first_quad_index +
+ GeometryInfo<dim>::quads_per_cell * dofs_per_quad)
+ , first_face_line_index(GeometryInfo<dim - 1>::vertices_per_cell *
+ dofs_per_vertex)
+ , first_face_quad_index(
+ (dim == 3 ? GeometryInfo<dim - 1>::vertices_per_cell * dofs_per_vertex :
+ GeometryInfo<dim>::vertices_per_cell * dofs_per_vertex) +
+ GeometryInfo<dim - 1>::lines_per_cell * dofs_per_line)
+ , dofs_per_face(GeometryInfo<dim>::vertices_per_face * dofs_per_vertex +
+ GeometryInfo<dim>::lines_per_face * dofs_per_line +
+ GeometryInfo<dim>::quads_per_face * dofs_per_quad)
+ , dofs_per_cell(GeometryInfo<dim>::vertices_per_cell * dofs_per_vertex +
+ GeometryInfo<dim>::lines_per_cell * dofs_per_line +
+ GeometryInfo<dim>::quads_per_cell * dofs_per_quad +
+ GeometryInfo<dim>::hexes_per_cell * dofs_per_hex)
+ , components(n_components)
+ , degree(degree)
+ , conforming_space(conformity)
+ , block_indices_data(block_indices.size() == 0 ?
+ BlockIndices(1, dofs_per_cell) :
+ block_indices)
{
Assert(dofs_per_object.size() == dim + 1,
ExcDimensionMismatch(dofs_per_object.size() - 1, dim));
DEAL_II_NAMESPACE_OPEN
template <int dim, int spacedim>
-FE_DGNedelec<dim, spacedim>::FE_DGNedelec(const unsigned int p) :
- FE_DGVector<PolynomialsNedelec<dim>, dim, spacedim>(p, mapping_nedelec)
+FE_DGNedelec<dim, spacedim>::FE_DGNedelec(const unsigned int p)
+ : FE_DGVector<PolynomialsNedelec<dim>, dim, spacedim>(p, mapping_nedelec)
{}
template <int dim, int spacedim>
-FE_DGRaviartThomas<dim, spacedim>::FE_DGRaviartThomas(const unsigned int p) :
- FE_DGVector<PolynomialsRaviartThomas<dim>, dim, spacedim>(
- p,
- mapping_raviart_thomas)
+FE_DGRaviartThomas<dim, spacedim>::FE_DGRaviartThomas(const unsigned int p)
+ : FE_DGVector<PolynomialsRaviartThomas<dim>, dim, spacedim>(
+ p,
+ mapping_raviart_thomas)
{}
template <int dim, int spacedim>
-FE_DGBDM<dim, spacedim>::FE_DGBDM(const unsigned int p) :
- FE_DGVector<PolynomialsBDM<dim>, dim, spacedim>(p, mapping_bdm)
+FE_DGBDM<dim, spacedim>::FE_DGBDM(const unsigned int p)
+ : FE_DGVector<PolynomialsBDM<dim>, dim, spacedim>(p, mapping_bdm)
{}
DEAL_II_NAMESPACE_OPEN
template <int dim, int spacedim>
-FE_DGP<dim, spacedim>::FE_DGP(const unsigned int degree) :
- FE_Poly<PolynomialSpace<dim>, dim, spacedim>(
- PolynomialSpace<dim>(
- Polynomials::Legendre::generate_complete_basis(degree)),
- FiniteElementData<dim>(get_dpo_vector(degree),
- 1,
- degree,
- FiniteElementData<dim>::L2),
- std::vector<bool>(
- FiniteElementData<dim>(get_dpo_vector(degree), 1, degree).dofs_per_cell,
- true),
- std::vector<ComponentMask>(
- FiniteElementData<dim>(get_dpo_vector(degree), 1, degree).dofs_per_cell,
- std::vector<bool>(1, true)))
+FE_DGP<dim, spacedim>::FE_DGP(const unsigned int degree)
+ : FE_Poly<PolynomialSpace<dim>, dim, spacedim>(
+ PolynomialSpace<dim>(
+ Polynomials::Legendre::generate_complete_basis(degree)),
+ FiniteElementData<dim>(get_dpo_vector(degree),
+ 1,
+ degree,
+ FiniteElementData<dim>::L2),
+ std::vector<bool>(
+ FiniteElementData<dim>(get_dpo_vector(degree), 1, degree).dofs_per_cell,
+ true),
+ std::vector<ComponentMask>(
+ FiniteElementData<dim>(get_dpo_vector(degree), 1, degree).dofs_per_cell,
+ std::vector<bool>(1, true)))
{
// Reinit the vectors of restriction and prolongation matrices to the right
// sizes
template <int dim>
-FE_DGPMonomial<dim>::FE_DGPMonomial(const unsigned int degree) :
- FE_Poly<PolynomialsP<dim>, dim>(
- PolynomialsP<dim>(degree),
- FiniteElementData<dim>(get_dpo_vector(degree),
- 1,
- degree,
- FiniteElementData<dim>::L2),
- std::vector<bool>(
- FiniteElementData<dim>(get_dpo_vector(degree), 1, degree).dofs_per_cell,
- true),
- std::vector<ComponentMask>(
- FiniteElementData<dim>(get_dpo_vector(degree), 1, degree).dofs_per_cell,
- std::vector<bool>(1, true)))
+FE_DGPMonomial<dim>::FE_DGPMonomial(const unsigned int degree)
+ : FE_Poly<PolynomialsP<dim>, dim>(
+ PolynomialsP<dim>(degree),
+ FiniteElementData<dim>(get_dpo_vector(degree),
+ 1,
+ degree,
+ FiniteElementData<dim>::L2),
+ std::vector<bool>(
+ FiniteElementData<dim>(get_dpo_vector(degree), 1, degree).dofs_per_cell,
+ true),
+ std::vector<ComponentMask>(
+ FiniteElementData<dim>(get_dpo_vector(degree), 1, degree).dofs_per_cell,
+ std::vector<bool>(1, true)))
{
Assert(this->poly_space.n() == this->dofs_per_cell, ExcInternalError());
Assert(this->poly_space.degree() == this->degree, ExcInternalError());
// is necessarily empty -- i.e. there isn't
// much we need to do here.
(void)interpolation_matrix;
- AssertThrow(
- (x_source_fe.get_name().find("FE_DGPMonomial<") == 0) ||
- (dynamic_cast<const FE_DGPMonomial<dim> *>(&x_source_fe) != nullptr),
- typename FiniteElement<dim>::ExcInterpolationNotImplemented());
+ AssertThrow((x_source_fe.get_name().find("FE_DGPMonomial<") == 0) ||
+ (dynamic_cast<const FE_DGPMonomial<dim> *>(&x_source_fe) !=
+ nullptr),
+ typename FiniteElement<dim>::ExcInterpolationNotImplemented());
Assert(interpolation_matrix.m() == 0,
ExcDimensionMismatch(interpolation_matrix.m(), 0));
// is necessarily empty -- i.e. there isn't
// much we need to do here.
(void)interpolation_matrix;
- AssertThrow(
- (x_source_fe.get_name().find("FE_DGPMonomial<") == 0) ||
- (dynamic_cast<const FE_DGPMonomial<dim> *>(&x_source_fe) != nullptr),
- typename FiniteElement<dim>::ExcInterpolationNotImplemented());
+ AssertThrow((x_source_fe.get_name().find("FE_DGPMonomial<") == 0) ||
+ (dynamic_cast<const FE_DGPMonomial<dim> *>(&x_source_fe) !=
+ nullptr),
+ typename FiniteElement<dim>::ExcInterpolationNotImplemented());
Assert(interpolation_matrix.m() == 0,
ExcDimensionMismatch(interpolation_matrix.m(), 0));
template <int dim, int spacedim>
FE_DGPNonparametric<dim, spacedim>::FE_DGPNonparametric(
- const unsigned int degree) :
- FiniteElement<dim, spacedim>(
- FiniteElementData<dim>(get_dpo_vector(degree),
- 1,
- degree,
- FiniteElementData<dim>::L2),
- std::vector<bool>(
- FiniteElementData<dim>(get_dpo_vector(degree), 1, degree).dofs_per_cell,
- true),
- std::vector<ComponentMask>(
- FiniteElementData<dim>(get_dpo_vector(degree), 1, degree).dofs_per_cell,
- std::vector<bool>(1, true))),
- polynomial_space(Polynomials::Legendre::generate_complete_basis(degree))
+ const unsigned int degree)
+ : FiniteElement<dim, spacedim>(
+ FiniteElementData<dim>(get_dpo_vector(degree),
+ 1,
+ degree,
+ FiniteElementData<dim>::L2),
+ std::vector<bool>(
+ FiniteElementData<dim>(get_dpo_vector(degree), 1, degree).dofs_per_cell,
+ true),
+ std::vector<ComponentMask>(
+ FiniteElementData<dim>(get_dpo_vector(degree), 1, degree).dofs_per_cell,
+ std::vector<bool>(1, true)))
+ , polynomial_space(Polynomials::Legendre::generate_complete_basis(degree))
{
const unsigned int n_dofs = this->dofs_per_cell;
for (unsigned int ref_case = RefinementCase<dim>::cut_x;
template <int dim, int spacedim>
-FE_DGQ<dim, spacedim>::FE_DGQ(const unsigned int degree) :
- FE_Poly<TensorProductPolynomials<dim>, dim, spacedim>(
- TensorProductPolynomials<dim>(Polynomials::generate_complete_Lagrange_basis(
- internal::FE_DGQ::get_QGaussLobatto_points(degree))),
- FiniteElementData<dim>(get_dpo_vector(degree),
- 1,
- degree,
- FiniteElementData<dim>::L2),
- std::vector<bool>(
- FiniteElementData<dim>(get_dpo_vector(degree), 1, degree).dofs_per_cell,
- true),
- std::vector<ComponentMask>(
- FiniteElementData<dim>(get_dpo_vector(degree), 1, degree).dofs_per_cell,
- std::vector<bool>(1, true)))
+FE_DGQ<dim, spacedim>::FE_DGQ(const unsigned int degree)
+ : FE_Poly<TensorProductPolynomials<dim>, dim, spacedim>(
+ TensorProductPolynomials<dim>(
+ Polynomials::generate_complete_Lagrange_basis(
+ internal::FE_DGQ::get_QGaussLobatto_points(degree))),
+ FiniteElementData<dim>(get_dpo_vector(degree),
+ 1,
+ degree,
+ FiniteElementData<dim>::L2),
+ std::vector<bool>(
+ FiniteElementData<dim>(get_dpo_vector(degree), 1, degree).dofs_per_cell,
+ true),
+ std::vector<ComponentMask>(
+ FiniteElementData<dim>(get_dpo_vector(degree), 1, degree).dofs_per_cell,
+ std::vector<bool>(1, true)))
{
// Compute support points, which are the tensor product of the Lagrange
// interpolation points in the constructor.
template <int dim, int spacedim>
FE_DGQ<dim, spacedim>::FE_DGQ(
- const std::vector<Polynomials::Polynomial<double>> &polynomials) :
- FE_Poly<TensorProductPolynomials<dim>, dim, spacedim>(
- TensorProductPolynomials<dim>(polynomials),
- FiniteElementData<dim>(get_dpo_vector(polynomials.size() - 1),
- 1,
- polynomials.size() - 1,
- FiniteElementData<dim>::L2),
- std::vector<bool>(
- FiniteElementData<dim>(get_dpo_vector(polynomials.size() - 1),
- 1,
- polynomials.size() - 1)
- .dofs_per_cell,
- true),
- std::vector<ComponentMask>(
+ const std::vector<Polynomials::Polynomial<double>> &polynomials)
+ : FE_Poly<TensorProductPolynomials<dim>, dim, spacedim>(
+ TensorProductPolynomials<dim>(polynomials),
FiniteElementData<dim>(get_dpo_vector(polynomials.size() - 1),
1,
- polynomials.size() - 1)
- .dofs_per_cell,
- std::vector<bool>(1, true)))
+ polynomials.size() - 1,
+ FiniteElementData<dim>::L2),
+ std::vector<bool>(FiniteElementData<dim>(get_dpo_vector(
+ polynomials.size() - 1),
+ 1,
+ polynomials.size() - 1)
+ .dofs_per_cell,
+ true),
+ std::vector<ComponentMask>(
+ FiniteElementData<dim>(get_dpo_vector(polynomials.size() - 1),
+ 1,
+ polynomials.size() - 1)
+ .dofs_per_cell,
+ std::vector<bool>(1, true)))
{
// No support points can be defined in general. Derived classes might define
// support points like the class FE_DGQArbitraryNodes
// source FE is also a
// DGQ element
typedef FiniteElement<dim, spacedim> FE;
- AssertThrow(
- (dynamic_cast<const FE_DGQ<dim, spacedim> *>(&x_source_fe) != nullptr),
- typename FE::ExcInterpolationNotImplemented());
+ AssertThrow((dynamic_cast<const FE_DGQ<dim, spacedim> *>(&x_source_fe) !=
+ nullptr),
+ typename FE::ExcInterpolationNotImplemented());
// ok, source is a Q element, so
// we will be able to do the work
Assert(interpolation_matrix.m() == this->dofs_per_cell,
ExcDimensionMismatch(interpolation_matrix.m(), this->dofs_per_cell));
- Assert(
- interpolation_matrix.n() == source_fe.dofs_per_cell,
- ExcDimensionMismatch(interpolation_matrix.n(), source_fe.dofs_per_cell));
+ Assert(interpolation_matrix.n() == source_fe.dofs_per_cell,
+ ExcDimensionMismatch(interpolation_matrix.n(),
+ source_fe.dofs_per_cell));
// compute the interpolation
// much we need to do here.
(void)interpolation_matrix;
typedef FiniteElement<dim, spacedim> FE;
- AssertThrow(
- (dynamic_cast<const FE_DGQ<dim, spacedim> *>(&x_source_fe) != nullptr),
- typename FE::ExcInterpolationNotImplemented());
+ AssertThrow((dynamic_cast<const FE_DGQ<dim, spacedim> *>(&x_source_fe) !=
+ nullptr),
+ typename FE::ExcInterpolationNotImplemented());
Assert(interpolation_matrix.m() == 0,
ExcDimensionMismatch(interpolation_matrix.m(), 0));
// much we need to do here.
(void)interpolation_matrix;
typedef FiniteElement<dim, spacedim> FE;
- AssertThrow(
- (dynamic_cast<const FE_DGQ<dim, spacedim> *>(&x_source_fe) != nullptr),
- typename FE::ExcInterpolationNotImplemented());
+ AssertThrow((dynamic_cast<const FE_DGQ<dim, spacedim> *>(&x_source_fe) !=
+ nullptr),
+ typename FE::ExcInterpolationNotImplemented());
Assert(interpolation_matrix.m() == 0,
ExcDimensionMismatch(interpolation_matrix.m(), 0));
const RefinementCase<dim> &refinement_case) const
{
Assert(refinement_case < RefinementCase<dim>::isotropic_refinement + 1,
- ExcIndexRange(
- refinement_case, 0, RefinementCase<dim>::isotropic_refinement + 1));
- Assert(
- refinement_case != RefinementCase<dim>::no_refinement,
- ExcMessage("Prolongation matrices are only available for refined cells!"));
- Assert(
- child < GeometryInfo<dim>::n_children(refinement_case),
- ExcIndexRange(child, 0, GeometryInfo<dim>::n_children(refinement_case)));
+ ExcIndexRange(refinement_case,
+ 0,
+ RefinementCase<dim>::isotropic_refinement + 1));
+ Assert(refinement_case != RefinementCase<dim>::no_refinement,
+ ExcMessage(
+ "Prolongation matrices are only available for refined cells!"));
+ Assert(child < GeometryInfo<dim>::n_children(refinement_case),
+ ExcIndexRange(child,
+ 0,
+ GeometryInfo<dim>::n_children(refinement_case)));
// initialization upon first request
if (this->prolongation[refinement_case - 1][child].n() == 0)
GeometryInfo<dim>::n_children(RefinementCase<dim>(refinement_case)),
FullMatrix<double>(this->dofs_per_cell, this->dofs_per_cell));
if (dim == spacedim)
- FETools::compute_embedding_matrices(
- *this, isotropic_matrices, true);
+ FETools::compute_embedding_matrices(*this,
+ isotropic_matrices,
+ true);
else
- FETools::compute_embedding_matrices(
- FE_DGQ<dim>(this->degree), isotropic_matrices, true);
+ FETools::compute_embedding_matrices(FE_DGQ<dim>(this->degree),
+ isotropic_matrices,
+ true);
this_nonconst.prolongation[refinement_case - 1].swap(
isotropic_matrices.back());
}
const RefinementCase<dim> &refinement_case) const
{
Assert(refinement_case < RefinementCase<dim>::isotropic_refinement + 1,
- ExcIndexRange(
- refinement_case, 0, RefinementCase<dim>::isotropic_refinement + 1));
- Assert(
- refinement_case != RefinementCase<dim>::no_refinement,
- ExcMessage("Restriction matrices are only available for refined cells!"));
- Assert(
- child < GeometryInfo<dim>::n_children(refinement_case),
- ExcIndexRange(child, 0, GeometryInfo<dim>::n_children(refinement_case)));
+ ExcIndexRange(refinement_case,
+ 0,
+ RefinementCase<dim>::isotropic_refinement + 1));
+ Assert(refinement_case != RefinementCase<dim>::no_refinement,
+ ExcMessage(
+ "Restriction matrices are only available for refined cells!"));
+ Assert(child < GeometryInfo<dim>::n_children(refinement_case),
+ ExcIndexRange(child,
+ 0,
+ GeometryInfo<dim>::n_children(refinement_case)));
// initialization upon first request
if (this->restriction[refinement_case - 1][child].n() == 0)
GeometryInfo<dim>::n_children(RefinementCase<dim>(refinement_case)),
FullMatrix<double>(this->dofs_per_cell, this->dofs_per_cell));
if (dim == spacedim)
- FETools::compute_projection_matrices(
- *this, isotropic_matrices, true);
+ FETools::compute_projection_matrices(*this,
+ isotropic_matrices,
+ true);
else
- FETools::compute_projection_matrices(
- FE_DGQ<dim>(this->degree), isotropic_matrices, true);
+ FETools::compute_projection_matrices(FE_DGQ<dim>(this->degree),
+ isotropic_matrices,
+ true);
this_nonconst.restriction[refinement_case - 1].swap(
isotropic_matrices.back());
}
template <int dim, int spacedim>
FE_DGQArbitraryNodes<dim, spacedim>::FE_DGQArbitraryNodes(
- const Quadrature<1> &points) :
- FE_DGQ<dim, spacedim>(
- Polynomials::generate_complete_Lagrange_basis(points.get_points()))
+ const Quadrature<1> &points)
+ : FE_DGQ<dim, spacedim>(
+ Polynomials::generate_complete_Lagrange_basis(points.get_points()))
{
Assert(points.size() > 0,
(typename FiniteElement<dim, spacedim>::ExcFEHasNoSupportPoints()));
// ---------------------------------- FE_DGQLegendre -------------------------
template <int dim, int spacedim>
-FE_DGQLegendre<dim, spacedim>::FE_DGQLegendre(const unsigned int degree) :
- FE_DGQ<dim, spacedim>(Polynomials::Legendre::generate_complete_basis(degree))
+FE_DGQLegendre<dim, spacedim>::FE_DGQLegendre(const unsigned int degree)
+ : FE_DGQ<dim, spacedim>(
+ Polynomials::Legendre::generate_complete_basis(degree))
{}
// ---------------------------------- FE_DGQHermite --------------------------
template <int dim, int spacedim>
-FE_DGQHermite<dim, spacedim>::FE_DGQHermite(const unsigned int degree) :
- FE_DGQ<dim, spacedim>(
- Polynomials::HermiteLikeInterpolation::generate_complete_basis(degree))
+FE_DGQHermite<dim, spacedim>::FE_DGQHermite(const unsigned int degree)
+ : FE_DGQ<dim, spacedim>(
+ Polynomials::HermiteLikeInterpolation::generate_complete_basis(degree))
{}
&)>>> & functions)
{
AssertThrow(fes.size() > 0, ExcMessage("FEs size should be >=1"));
- AssertThrow(
- fes.size() == multiplicities.size(),
- ExcMessage("FEs and multiplicities should have the same size"));
+ AssertThrow(fes.size() == multiplicities.size(),
+ ExcMessage(
+ "FEs and multiplicities should have the same size"));
AssertThrow(functions.size() == fes.size() - 1,
ExcDimensionMismatch(functions.size(), fes.size() - 1));
template <int dim, int spacedim>
FE_Enriched<dim, spacedim>::FE_Enriched(
- const FiniteElement<dim, spacedim> &fe_base) :
- FE_Enriched<dim, spacedim>(
- fe_base,
- FE_Nothing<dim, spacedim>(fe_base.n_components(), true),
- nullptr)
+ const FiniteElement<dim, spacedim> &fe_base)
+ : FE_Enriched<dim, spacedim>(fe_base,
+ FE_Nothing<dim, spacedim>(fe_base.n_components(),
+ true),
+ nullptr)
{}
FE_Enriched<dim, spacedim>::FE_Enriched(
const FiniteElement<dim, spacedim> &fe_base,
const FiniteElement<dim, spacedim> &fe_enriched,
- const Function<spacedim> * enrichment_function) :
- FE_Enriched<dim, spacedim>(
- &fe_base,
- std::vector<const FiniteElement<dim, spacedim> *>(1, &fe_enriched),
- std::vector<std::vector<std::function<const Function<spacedim> *(
- const typename Triangulation<dim, spacedim>::cell_iterator &)>>>(
- 1,
- std::vector<std::function<const Function<spacedim> *(
- const typename Triangulation<dim, spacedim>::cell_iterator &)>>(
+ const Function<spacedim> * enrichment_function)
+ : FE_Enriched<dim, spacedim>(
+ &fe_base,
+ std::vector<const FiniteElement<dim, spacedim> *>(1, &fe_enriched),
+ std::vector<std::vector<std::function<const Function<spacedim> *(
+ const typename Triangulation<dim, spacedim>::cell_iterator &)>>>(
1,
- [=](const typename Triangulation<dim, spacedim>::cell_iterator &)
- -> const Function<spacedim> * { return enrichment_function; })))
+ std::vector<std::function<const Function<spacedim> *(
+ const typename Triangulation<dim, spacedim>::cell_iterator &)>>(
+ 1,
+ [=](const typename Triangulation<dim, spacedim>::cell_iterator &)
+ -> const Function<spacedim> * { return enrichment_function; })))
{}
const FiniteElement<dim, spacedim> * fe_base,
const std::vector<const FiniteElement<dim, spacedim> *> &fe_enriched,
const std::vector<std::vector<std::function<const Function<spacedim> *(
- const typename Triangulation<dim, spacedim>::cell_iterator &)>>>
- &functions) :
- FE_Enriched<dim, spacedim>(
- internal::FE_Enriched::build_fes(fe_base, fe_enriched),
- internal::FE_Enriched::build_multiplicities(functions),
- functions)
+ const typename Triangulation<dim, spacedim>::cell_iterator &)>>> &functions)
+ : FE_Enriched<dim, spacedim>(
+ internal::FE_Enriched::build_fes(fe_base, fe_enriched),
+ internal::FE_Enriched::build_multiplicities(functions),
+ functions)
{}
const std::vector<const FiniteElement<dim, spacedim> *> &fes,
const std::vector<unsigned int> & multiplicities,
const std::vector<std::vector<std::function<const Function<spacedim> *(
- const typename Triangulation<dim, spacedim>::cell_iterator &)>>>
- &functions) :
- FiniteElement<dim, spacedim>(
- FETools::Compositing::multiply_dof_numbers(fes, multiplicities, false),
- FETools::Compositing::compute_restriction_is_additive_flags(fes,
- multiplicities),
- FETools::Compositing::compute_nonzero_components(fes,
- multiplicities,
- false)),
- enrichments(functions),
- is_enriched(internal::FE_Enriched::check_if_enriched(fes)),
- fe_system(
- std_cxx14::make_unique<FESystem<dim, spacedim>>(fes, multiplicities))
+ const typename Triangulation<dim, spacedim>::cell_iterator &)>>> &functions)
+ : FiniteElement<dim, spacedim>(
+ FETools::Compositing::multiply_dof_numbers(fes, multiplicities, false),
+ FETools::Compositing::compute_restriction_is_additive_flags(
+ fes,
+ multiplicities),
+ FETools::Compositing::compute_nonzero_components(fes,
+ multiplicities,
+ false))
+ , enrichments(functions)
+ , is_enriched(internal::FE_Enriched::check_if_enriched(fes))
+ , fe_system(
+ std_cxx14::make_unique<FESystem<dim, spacedim>>(fes, multiplicities))
{
// descriptive error are thrown within the function.
- Assert(
- internal::FE_Enriched::consistency_check(fes, multiplicities, functions),
- ExcInternalError());
+ Assert(internal::FE_Enriched::consistency_check(fes,
+ multiplicities,
+ functions),
+ ExcInternalError());
initialize(fes, multiplicities);
{
auto data =
fe_system->get_face_data(update_flags, mapping, quadrature, output_data);
- return setup_data(
- Utilities::dynamic_unique_cast<
- typename FESystem<dim, spacedim>::InternalData>(std::move(data)),
- update_flags,
- quadrature);
+ return setup_data(Utilities::dynamic_unique_cast<
+ typename FESystem<dim, spacedim>::InternalData>(
+ std::move(data)),
+ update_flags,
+ quadrature);
}
{
auto data =
fe_system->get_subface_data(update_flags, mapping, quadrature, output_data);
- return setup_data(
- Utilities::dynamic_unique_cast<
- typename FESystem<dim, spacedim>::InternalData>(std::move(data)),
- update_flags,
- quadrature);
+ return setup_data(Utilities::dynamic_unique_cast<
+ typename FESystem<dim, spacedim>::InternalData>(
+ std::move(data)),
+ update_flags,
+ quadrature);
}
&output_data) const
{
auto data = fe_system->get_data(flags, mapping, quadrature, output_data);
- return setup_data(
- Utilities::dynamic_unique_cast<
- typename FESystem<dim, spacedim>::InternalData>(std::move(data)),
- flags,
- quadrature);
+ return setup_data(Utilities::dynamic_unique_cast<
+ typename FESystem<dim, spacedim>::InternalData>(
+ std::move(data)),
+ flags,
+ quadrature);
}
Assert(enrichments[base_no - 1][m](cell) != nullptr,
ExcMessage("The pointer to the enrichment function is NULL"));
- Assert(
- enrichments[base_no - 1][m](cell)->n_components == 1,
- ExcMessage("Only scalar-valued enrichment functions are allowed"));
+ Assert(enrichments[base_no - 1][m](cell)->n_components == 1,
+ ExcMessage(
+ "Only scalar-valued enrichment functions are allowed"));
if (flags & update_hessians)
{
- Assert(
- fe_data.enrichment[base_no][m].hessians.size() == n_q_points,
- ExcDimensionMismatch(
- fe_data.enrichment[base_no][m].hessians.size(), n_q_points));
+ Assert(fe_data.enrichment[base_no][m].hessians.size() ==
+ n_q_points,
+ ExcDimensionMismatch(
+ fe_data.enrichment[base_no][m].hessians.size(),
+ n_q_points));
for (unsigned int q = 0; q < n_q_points; q++)
fe_data.enrichment[base_no][m].hessians[q] =
enrichments[base_no - 1][m](cell)->hessian(
if (flags & update_gradients)
{
- Assert(
- fe_data.enrichment[base_no][m].gradients.size() == n_q_points,
- ExcDimensionMismatch(
- fe_data.enrichment[base_no][m].gradients.size(), n_q_points));
+ Assert(fe_data.enrichment[base_no][m].gradients.size() ==
+ n_q_points,
+ ExcDimensionMismatch(
+ fe_data.enrichment[base_no][m].gradients.size(),
+ n_q_points));
for (unsigned int q = 0; q < n_q_points; q++)
fe_data.enrichment[base_no][m].gradients[q] =
enrichments[base_no - 1][m](cell)->gradient(
if (flags & update_values)
{
- Assert(
- fe_data.enrichment[base_no][m].values.size() == n_q_points,
- ExcDimensionMismatch(
- fe_data.enrichment[base_no][m].values.size(), n_q_points));
+ Assert(fe_data.enrichment[base_no][m].values.size() == n_q_points,
+ ExcDimensionMismatch(
+ fe_data.enrichment[base_no][m].values.size(),
+ n_q_points));
for (unsigned int q = 0; q < n_q_points; q++)
fe_data.enrichment[base_no][m].values[q] =
enrichments[base_no - 1][m](cell)->value(
if (const FE_Enriched<dim, spacedim> *fe_enr_other =
dynamic_cast<const FE_Enriched<dim, spacedim> *>(&source))
{
- fe_system->get_subface_interpolation_matrix(
- fe_enr_other->get_fe_system(), subface, matrix);
+ fe_system->get_subface_interpolation_matrix(fe_enr_other->get_fe_system(),
+ subface,
+ matrix);
}
else
{
template <int dim, int spacedim>
FE_Enriched<dim, spacedim>::InternalData::InternalData(
- std::unique_ptr<typename FESystem<dim, spacedim>::InternalData>
- fesystem_data) :
- fesystem_data(std::move(fesystem_data))
+ std::unique_ptr<typename FESystem<dim, spacedim>::InternalData> fesystem_data)
+ : fesystem_data(std::move(fesystem_data))
{}
} // namespace internal
template <int dim, int spacedim>
-FE_FaceQ<dim, spacedim>::FE_FaceQ(const unsigned int degree) :
- FE_PolyFace<TensorProductPolynomials<dim - 1>, dim, spacedim>(
- TensorProductPolynomials<dim - 1>(
- Polynomials::generate_complete_Lagrange_basis(
- internal::FE_FaceQImplementation::get_QGaussLobatto_points(degree))),
- FiniteElementData<dim>(get_dpo_vector(degree),
- 1,
- degree,
- FiniteElementData<dim>::L2),
- std::vector<bool>(1, true))
+FE_FaceQ<dim, spacedim>::FE_FaceQ(const unsigned int degree)
+ : FE_PolyFace<TensorProductPolynomials<dim - 1>, dim, spacedim>(
+ TensorProductPolynomials<dim - 1>(
+ Polynomials::generate_complete_Lagrange_basis(
+ internal::FE_FaceQImplementation::get_QGaussLobatto_points(degree))),
+ FiniteElementData<dim>(get_dpo_vector(degree),
+ 1,
+ degree,
+ FiniteElementData<dim>::L2),
+ std::vector<bool>(1, true))
{
// initialize unit face support points
const unsigned int codim = dim - 1;
const FiniteElement<dim, spacedim> &source_fe,
FullMatrix<double> & interpolation_matrix) const
{
- get_subface_interpolation_matrix(
- source_fe, numbers::invalid_unsigned_int, interpolation_matrix);
+ get_subface_interpolation_matrix(source_fe,
+ numbers::invalid_unsigned_int,
+ interpolation_matrix);
}
Assert(interpolation_matrix.n() == this->dofs_per_face,
ExcDimensionMismatch(interpolation_matrix.n(), this->dofs_per_face));
- Assert(
- interpolation_matrix.m() == x_source_fe.dofs_per_face,
- ExcDimensionMismatch(interpolation_matrix.m(), x_source_fe.dofs_per_face));
+ Assert(interpolation_matrix.m() == x_source_fe.dofs_per_face,
+ ExcDimensionMismatch(interpolation_matrix.m(),
+ x_source_fe.dofs_per_face));
// see if source is a FaceQ element
if (const FE_FaceQ<dim, spacedim> *source_fe =
for (unsigned int n1 = 0; n1 < identities_1d.size(); ++n1)
for (unsigned int n2 = 0; n2 < identities_1d.size(); ++n2)
- identities.emplace_back(
- identities_1d[n1].first * (p + 1) + identities_1d[n2].first,
- identities_1d[n1].second * (q + 1) + identities_1d[n2].second);
+ identities.emplace_back(identities_1d[n1].first * (p + 1) +
+ identities_1d[n2].first,
+ identities_1d[n1].second * (q + 1) +
+ identities_1d[n2].second);
return identities;
}
// ----------------------------- FE_FaceQ<1,spacedim> ------------------------
template <int spacedim>
-FE_FaceQ<1, spacedim>::FE_FaceQ(const unsigned int degree) :
- FiniteElement<1, spacedim>(
- FiniteElementData<1>(get_dpo_vector(degree),
- 1,
- degree,
- FiniteElementData<1>::L2),
- std::vector<bool>(1, true),
- std::vector<ComponentMask>(1, ComponentMask(1, true)))
+FE_FaceQ<1, spacedim>::FE_FaceQ(const unsigned int degree)
+ : FiniteElement<1, spacedim>(
+ FiniteElementData<1>(get_dpo_vector(degree),
+ 1,
+ degree,
+ FiniteElementData<1>::L2),
+ std::vector<bool>(1, true),
+ std::vector<ComponentMask>(1, ComponentMask(1, true)))
{
this->unit_face_support_points.resize(1);
const FiniteElement<1, spacedim> &source_fe,
FullMatrix<double> & interpolation_matrix) const
{
- get_subface_interpolation_matrix(
- source_fe, numbers::invalid_unsigned_int, interpolation_matrix);
+ get_subface_interpolation_matrix(source_fe,
+ numbers::invalid_unsigned_int,
+ interpolation_matrix);
}
(void)x_source_fe;
Assert(interpolation_matrix.n() == this->dofs_per_face,
ExcDimensionMismatch(interpolation_matrix.n(), this->dofs_per_face));
- Assert(
- interpolation_matrix.m() == x_source_fe.dofs_per_face,
- ExcDimensionMismatch(interpolation_matrix.m(), x_source_fe.dofs_per_face));
+ Assert(interpolation_matrix.m() == x_source_fe.dofs_per_face,
+ ExcDimensionMismatch(interpolation_matrix.m(),
+ x_source_fe.dofs_per_face));
interpolation_matrix(0, 0) = 1.;
}
const FiniteElement<1, spacedim> & /*fe_other*/) const
{
// this element is always discontinuous at vertices
- return std::vector<std::pair<unsigned int, unsigned int>>(
- 1, std::make_pair(0U, 0U));
+ return std::vector<std::pair<unsigned int, unsigned int>>(1,
+ std::make_pair(0U,
+ 0U));
}
// --------------------------------------- FE_FaceP --------------------------
template <int dim, int spacedim>
-FE_FaceP<dim, spacedim>::FE_FaceP(const unsigned int degree) :
- FE_PolyFace<PolynomialSpace<dim - 1>, dim, spacedim>(
- PolynomialSpace<dim - 1>(
- Polynomials::Legendre::generate_complete_basis(degree)),
- FiniteElementData<dim>(get_dpo_vector(degree),
- 1,
- degree,
- FiniteElementData<dim>::L2),
- std::vector<bool>(1, true))
+FE_FaceP<dim, spacedim>::FE_FaceP(const unsigned int degree)
+ : FE_PolyFace<PolynomialSpace<dim - 1>, dim, spacedim>(
+ PolynomialSpace<dim - 1>(
+ Polynomials::Legendre::generate_complete_basis(degree)),
+ FiniteElementData<dim>(get_dpo_vector(degree),
+ 1,
+ degree,
+ FiniteElementData<dim>::L2),
+ std::vector<bool>(1, true))
{}
const FiniteElement<dim, spacedim> &source_fe,
FullMatrix<double> & interpolation_matrix) const
{
- get_subface_interpolation_matrix(
- source_fe, numbers::invalid_unsigned_int, interpolation_matrix);
+ get_subface_interpolation_matrix(source_fe,
+ numbers::invalid_unsigned_int,
+ interpolation_matrix);
}
Assert(interpolation_matrix.n() == this->dofs_per_face,
ExcDimensionMismatch(interpolation_matrix.n(), this->dofs_per_face));
- Assert(
- interpolation_matrix.m() == x_source_fe.dofs_per_face,
- ExcDimensionMismatch(interpolation_matrix.m(), x_source_fe.dofs_per_face));
+ Assert(interpolation_matrix.m() == x_source_fe.dofs_per_face,
+ ExcDimensionMismatch(interpolation_matrix.m(),
+ x_source_fe.dofs_per_face));
// see if source is a FaceP element
if (const FE_FaceP<dim, spacedim> *source_fe =
template <int spacedim>
-FE_FaceP<1, spacedim>::FE_FaceP(const unsigned int degree) :
- FE_FaceQ<1, spacedim>(degree)
+FE_FaceP<1, spacedim>::FE_FaceP(const unsigned int degree)
+ : FE_FaceQ<1, spacedim>(degree)
{}
template <int dim>
-FE_Nedelec<dim>::FE_Nedelec(const unsigned int order) :
- FE_PolyTensor<PolynomialsNedelec<dim>, dim>(
- order,
- FiniteElementData<dim>(get_dpo_vector(order),
- dim,
- order + 1,
- FiniteElementData<dim>::Hcurl),
- std::vector<bool>(PolynomialsNedelec<dim>::compute_n_pols(order), true),
- std::vector<ComponentMask>(PolynomialsNedelec<dim>::compute_n_pols(order),
- std::vector<bool>(dim, true)))
+FE_Nedelec<dim>::FE_Nedelec(const unsigned int order)
+ : FE_PolyTensor<PolynomialsNedelec<dim>, dim>(
+ order,
+ FiniteElementData<dim>(get_dpo_vector(order),
+ dim,
+ order + 1,
+ FiniteElementData<dim>::Hcurl),
+ std::vector<bool>(PolynomialsNedelec<dim>::compute_n_pols(order), true),
+ std::vector<ComponentMask>(PolynomialsNedelec<dim>::compute_n_pols(order),
+ std::vector<bool>(dim, true)))
{
#ifdef DEBUG_NEDELEC
deallog << get_name() << std::endl;
case 3:
{
- this->interface_constraints.reinit(
- 4 * (this->dofs_per_face - this->degree), this->dofs_per_face);
+ this->interface_constraints.reinit(4 * (this->dofs_per_face -
+ this->degree),
+ this->dofs_per_face);
unsigned int target_row = 0;
dof, quadrature_point_2, 1) -
this->restriction[index][i](i * this->degree,
dof) *
- this->shape_value_component(
- i * this->degree, quadrature_point_0, 1));
- tmp(1) = -1.0 * weight *
- this->restriction[index][i + 2](
- i * this->degree, dof) *
- this->shape_value_component(
- i * this->degree, quadrature_point_0, 1);
+ this->shape_value_component(i * this->degree,
+ quadrature_point_0,
+ 1));
+ tmp(1) =
+ -1.0 * weight *
+ this->restriction[index][i + 2](i * this->degree,
+ dof) *
+ this->shape_value_component(i * this->degree,
+ quadrature_point_0,
+ 1);
quadrature_point_2 = Point<dim>(
2.0 * edge_quadrature_points[q_point](0), i);
tmp(2) =
- weight * (2.0 * this->shape_value_component(
- dof, quadrature_point_2, 0) -
- this->restriction[index][2 * i](
- (i + 2) * this->degree, dof) *
- this->shape_value_component(
- (i + 2) * this->degree,
- quadrature_point_1,
- 0));
+ weight *
+ (2.0 * this->shape_value_component(
+ dof, quadrature_point_2, 0) -
+ this->restriction[index][2 * i]((i + 2) *
+ this->degree,
+ dof) *
+ this->shape_value_component((i + 2) *
+ this->degree,
+ quadrature_point_1,
+ 0));
tmp(3) =
-1.0 * weight *
this->restriction[index][2 * i + 1](
else
{
- tmp(0) = -1.0 * weight *
- this->restriction[index][i](
- i * this->degree, dof) *
- this->shape_value_component(
- i * this->degree, quadrature_point_0, 1);
+ tmp(0) =
+ -1.0 * weight *
+ this->restriction[index][i](i * this->degree,
+ dof) *
+ this->shape_value_component(i * this->degree,
+ quadrature_point_0,
+ 1);
Point<dim> quadrature_point_2(
i,
dof, quadrature_point_2, 1) -
this->restriction[index][i + 2](i * this->degree,
dof) *
- this->shape_value_component(
- i * this->degree, quadrature_point_0, 1));
+ this->shape_value_component(i * this->degree,
+ quadrature_point_0,
+ 1));
tmp(2) =
-1.0 * weight *
- this->restriction[index][2 * i](
- (i + 2) * this->degree, dof) *
+ this->restriction[index][2 * i]((i + 2) *
+ this->degree,
+ dof) *
this->shape_value_component(
(i + 2) * this->degree, quadrature_point_1, 0);
quadrature_point_2 = Point<dim>(
2.0 * edge_quadrature_points[q_point](0) - 1.0,
i);
tmp(3) =
- weight * (2.0 * this->shape_value_component(
- dof, quadrature_point_2, 0) -
- this->restriction[index][2 * i + 1](
- (i + 2) * this->degree, dof) *
- this->shape_value_component(
- (i + 2) * this->degree,
- quadrature_point_1,
- 0));
+ weight *
+ (2.0 * this->shape_value_component(
+ dof, quadrature_point_2, 0) -
+ this->restriction[index][2 * i + 1](
+ (i + 2) * this->degree, dof) *
+ this->shape_value_component((i + 2) *
+ this->degree,
+ quadrature_point_1,
+ 0));
}
for (unsigned int j = 0; j < this->degree - 1; ++j)
const unsigned int &n_quadrature_points = quadrature.size();
{
- FullMatrix<double> assembling_matrix(
- (this->degree - 1) * this->degree, n_quadrature_points);
+ FullMatrix<double> assembling_matrix((this->degree - 1) *
+ this->degree,
+ n_quadrature_points);
for (unsigned int q_point = 0; q_point < n_quadrature_points;
++q_point)
2.0 * quadrature_points[q_point](0) - 1.0,
2.0 * quadrature_points[q_point](1));
- tmp(2) += 2.0 * this->shape_value_component(
- dof, quadrature_point, 0);
- tmp(3) += 2.0 * this->shape_value_component(
- dof, quadrature_point, 1);
+ tmp(2) +=
+ 2.0 * this->shape_value_component(dof,
+ quadrature_point,
+ 0);
+ tmp(3) +=
+ 2.0 * this->shape_value_component(dof,
+ quadrature_point,
+ 1);
}
else
2.0 * quadrature_points[q_point](0) - 1.0,
2.0 * quadrature_points[q_point](1) - 1.0);
- tmp(6) += 2.0 * this->shape_value_component(
- dof, quadrature_point, 0);
- tmp(7) += 2.0 * this->shape_value_component(
- dof, quadrature_point, 1);
+ tmp(6) +=
+ 2.0 * this->shape_value_component(dof,
+ quadrature_point,
+ 0);
+ tmp(7) +=
+ 2.0 * this->shape_value_component(dof,
+ quadrature_point,
+ 1);
}
for (unsigned int i = 0; i < 2; ++i)
for (unsigned int j = 0; j < this->degree; ++j)
{
- tmp(2 * i) -= this->restriction[index][i](
- j + 2 * this->degree, dof) *
- this->shape_value_component(
- j + 2 * this->degree,
- quadrature_points[q_point],
- 0);
- tmp(2 * i + 1) -= this->restriction[index][i](
- i * this->degree + j, dof) *
- this->shape_value_component(
- i * this->degree + j,
- quadrature_points[q_point],
- 1);
+ tmp(2 * i) -=
+ this->restriction[index][i](j + 2 * this->degree,
+ dof) *
+ this->shape_value_component(
+ j + 2 * this->degree,
+ quadrature_points[q_point],
+ 0);
+ tmp(2 * i + 1) -=
+ this->restriction[index][i](i * this->degree + j,
+ dof) *
+ this->shape_value_component(
+ i * this->degree + j,
+ quadrature_points[q_point],
+ 1);
tmp(2 * (i + 2)) -= this->restriction[index][i + 2](
j + 3 * this->degree, dof) *
this->shape_value_component(
Point<dim> quadrature_point(
i, 2.0 * edge_quadrature_points[q_point](0), j);
- this->restriction[index][i + 4 * j](
- (i + 4 * j) * this->degree, dof) +=
+ this->restriction[index][i + 4 * j]((i + 4 * j) *
+ this->degree,
+ dof) +=
weight *
this->shape_value_component(dof, quadrature_point, 1);
- quadrature_point = Point<dim>(
- 2.0 * edge_quadrature_points[q_point](0), i, j);
+ quadrature_point =
+ Point<dim>(2.0 * edge_quadrature_points[q_point](0),
+ i,
+ j);
this->restriction[index][2 * (i + 2 * j)](
(i + 4 * j + 2) * this->degree, dof) +=
weight *
this->shape_value_component(dof, quadrature_point, 0);
- quadrature_point = Point<dim>(
- i, j, 2.0 * edge_quadrature_points[q_point](0));
- this->restriction[index][i + 2 * j](
- (i + 2 * (j + 4)) * this->degree, dof) +=
+ quadrature_point =
+ Point<dim>(i,
+ j,
+ 2.0 * edge_quadrature_points[q_point](0));
+ this->restriction[index][i + 2 * j]((i + 2 * (j + 4)) *
+ this->degree,
+ dof) +=
weight *
this->shape_value_component(dof, quadrature_point, 2);
}
Point<dim> quadrature_point(
i, 2.0 * edge_quadrature_points[q_point](0) - 1.0, j);
- this->restriction[index][i + 4 * j + 2](
- (i + 4 * j) * this->degree, dof) +=
+ this->restriction[index][i + 4 * j + 2]((i + 4 * j) *
+ this->degree,
+ dof) +=
weight *
this->shape_value_component(dof, quadrature_point, 1);
quadrature_point = Point<dim>(
(i + 4 * j) * this->degree,
quadrature_point_0,
1));
- tmp(1) = -1.0 * weight *
- this->restriction[index][i + 4 * j + 2](
- (i + 4 * j) * this->degree, dof) *
- this->shape_value_component(
- (i + 4 * j) * this->degree,
- quadrature_point_0,
- 1);
+ tmp(1) =
+ -1.0 * weight *
+ this->restriction[index][i + 4 * j + 2](
+ (i + 4 * j) * this->degree, dof) *
+ this->shape_value_component((i + 4 * j) *
+ this->degree,
+ quadrature_point_0,
+ 1);
quadrature_point_3 = Point<dim>(
2.0 * edge_quadrature_points[q_point](0), i, j);
tmp(2) =
else
{
- tmp(0) = -1.0 * weight *
- this->restriction[index][i + 4 * j](
- (i + 4 * j) * this->degree, dof) *
- this->shape_value_component(
- (i + 4 * j) * this->degree,
- quadrature_point_0,
- 1);
+ tmp(0) =
+ -1.0 * weight *
+ this->restriction[index][i + 4 * j](
+ (i + 4 * j) * this->degree, dof) *
+ this->shape_value_component((i + 4 * j) *
+ this->degree,
+ quadrature_point_0,
+ 1);
Point<dim> quadrature_point_3(
i,
n_edge_dofs,
dof) = solution(l * deg + m, 2 * (j + 2 * k));
- if (std::abs(solution(
- l * deg + m, 2 * (j + 2 * k) + 1)) > 1e-14)
+ if (std::abs(solution(l * deg + m,
+ 2 * (j + 2 * k) + 1)) >
+ 1e-14)
this->restriction[index][i + 2 * (2 * j + k)](
((2 * i + 1) * deg + m) * this->degree + l +
n_edge_dofs,
dof) =
solution(l * deg + m, 2 * (j + 2 * (k + 2)));
- if (std::abs(solution(
- l * deg + m, 2 * (j + 2 * k) + 9)) > 1e-14)
+ if (std::abs(solution(l * deg + m,
+ 2 * (j + 2 * k) + 9)) >
+ 1e-14)
this->restriction[index][2 * (i + 2 * j) + k](
((2 * i + 5) * deg + m) * this->degree + l +
n_edge_dofs,
dof) =
solution(l * deg + m, 2 * (j + 2 * (k + 4)));
- if (std::abs(solution(
- l * deg + m, 2 * (j + 2 * k) + 17)) > 1e-14)
+ if (std::abs(solution(l * deg + m,
+ 2 * (j + 2 * k) + 17)) >
+ 1e-14)
this->restriction[index][2 * (2 * i + j) + k](
((2 * i + 9) * deg + m) * this->degree + l +
n_edge_dofs,
2.0 * quadrature_points[q_point](1) - 1.0,
2.0 * quadrature_points[q_point](2));
- tmp(18) += 2.0 * this->shape_value_component(
- dof, quadrature_point, 0);
- tmp(19) += 2.0 * this->shape_value_component(
- dof, quadrature_point, 1);
- tmp(20) += 2.0 * this->shape_value_component(
- dof, quadrature_point, 2);
+ tmp(18) +=
+ 2.0 * this->shape_value_component(dof,
+ quadrature_point,
+ 0);
+ tmp(19) +=
+ 2.0 * this->shape_value_component(dof,
+ quadrature_point,
+ 1);
+ tmp(20) +=
+ 2.0 * this->shape_value_component(dof,
+ quadrature_point,
+ 2);
}
else
2.0 * quadrature_points[q_point](1) - 1.0,
2.0 * quadrature_points[q_point](2) - 1.0);
- tmp(21) += 2.0 * this->shape_value_component(
- dof, quadrature_point, 0);
- tmp(22) += 2.0 * this->shape_value_component(
- dof, quadrature_point, 1);
- tmp(23) += 2.0 * this->shape_value_component(
- dof, quadrature_point, 2);
+ tmp(21) +=
+ 2.0 * this->shape_value_component(dof,
+ quadrature_point,
+ 0);
+ tmp(22) +=
+ 2.0 * this->shape_value_component(dof,
+ quadrature_point,
+ 1);
+ tmp(23) +=
+ 2.0 * this->shape_value_component(dof,
+ quadrature_point,
+ 2);
}
for (unsigned int i = 0; i < 2; ++i)
for (unsigned int m = 0; m < deg; ++m)
for (unsigned int n = 0; n < deg; ++n)
{
- if (std::abs(solution(
- (l * deg + m) * deg + n,
- 3 * (i + 2 * (j + 2 * k)))) > 1e-14)
+ if (std::abs(
+ solution((l * deg + m) * deg + n,
+ 3 * (i + 2 * (j + 2 * k)))) >
+ 1e-14)
this->restriction[index][2 * (2 * i + j) + k](
(l * deg + m) * deg + n + n_boundary_dofs,
dof) = solution((l * deg + m) * deg + n,
3 * (i + 2 * (j + 2 * k)));
- if (std::abs(solution(
- (l * deg + m) * deg + n,
- 3 * (i + 2 * (j + 2 * k)) + 1)) > 1e-14)
+ if (std::abs(
+ solution((l * deg + m) * deg + n,
+ 3 * (i + 2 * (j + 2 * k)) + 1)) >
+ 1e-14)
this->restriction[index][2 * (2 * i + j) + k](
(l + (m + deg) * this->degree) * deg + n +
n_boundary_dofs,
solution((l * deg + m) * deg + n,
3 * (i + 2 * (j + 2 * k)) + 1);
- if (std::abs(solution(
- (l * deg + m) * deg + n,
- 3 * (i + 2 * (j + 2 * k)) + 2)) > 1e-14)
+ if (std::abs(
+ solution((l * deg + m) * deg + n,
+ 3 * (i + 2 * (j + 2 * k)) + 2)) >
+ 1e-14)
this->restriction[index][2 * (2 * i + j) + k](
l +
((m + 2 * deg) * deg + n) * this->degree +
for (unsigned int j = 0; j < q - 1; ++j)
{
- interpolation_matrix(
- GeometryInfo<dim>::lines_per_face * p + i * (p - 1) + j,
- GeometryInfo<dim>::lines_per_face * q + i * (q - 1) + j) = 1.0;
- interpolation_matrix(
- GeometryInfo<dim>::lines_per_face * p + i + (j + p - 1) * p,
- GeometryInfo<dim>::lines_per_face * q + i + (j + q - 1) * q) =
- 1.0;
+ interpolation_matrix(GeometryInfo<dim>::lines_per_face * p +
+ i * (p - 1) + j,
+ GeometryInfo<dim>::lines_per_face * q +
+ i * (q - 1) + j) = 1.0;
+ interpolation_matrix(GeometryInfo<dim>::lines_per_face * p + i +
+ (j + p - 1) * p,
+ GeometryInfo<dim>::lines_per_face * q + i +
+ (j + q - 1) * q) = 1.0;
}
}
}
0.5 * (edge_quadrature_points[q_point](0) + subface));
const Point<dim> quadrature_point_1(
0.0, edge_quadrature_points[q_point](0));
- const double tmp = edge_quadrature.weight(q_point) *
- (0.5 * this->shape_value_component(
- dof, quadrature_point_0, 1) -
- interpolation_matrix(0, dof) *
- source_fe.shape_value_component(
- 0, quadrature_point_1, 1));
+ const double tmp =
+ edge_quadrature.weight(q_point) *
+ (0.5 * this->shape_value_component(dof,
+ quadrature_point_0,
+ 1) -
+ interpolation_matrix(0, dof) *
+ source_fe.shape_value_component(0,
+ quadrature_point_1,
+ 1));
for (unsigned int i = 0; i < source_fe.degree - 1; ++i)
system_rhs(i) +=
case 3:
{
- const double shifts[4][2] = {
- {0.0, 0.0}, {1.0, 0.0}, {0.0, 1.0}, {1.0, 1.0}};
+ const double shifts[4][2] = {{0.0, 0.0},
+ {1.0, 0.0},
+ {0.0, 1.0},
+ {1.0, 1.0}};
for (unsigned int dof = 0; dof < this->dofs_per_face; ++dof)
for (unsigned int q_point = 0; q_point < n_edge_quadrature_points;
interpolation_matrix(i * source_fe.degree, dof) *
source_fe.shape_value_component(
i * source_fe.degree, quadrature_point_1, 1));
- quadrature_point_0 = Point<dim>(
- 0.5 * (edge_quadrature_points[q_point](0) +
- shifts[subface][0]),
- 0.5 * (i + shifts[subface][1]),
- 0.0);
- quadrature_point_1 = Point<dim>(
- edge_quadrature_points[q_point](0), i, 0.0);
+ quadrature_point_0 =
+ Point<dim>(0.5 *
+ (edge_quadrature_points[q_point](0) +
+ shifts[subface][0]),
+ 0.5 * (i + shifts[subface][1]),
+ 0.0);
+ quadrature_point_1 =
+ Point<dim>(edge_quadrature_points[q_point](0),
+ i,
+ 0.0);
tmp(i + 2) =
- weight * (0.5 * this->shape_value_component(
- this->face_to_cell_index(dof, 4),
- quadrature_point_0,
- 0) -
- interpolation_matrix(
- (i + 2) * source_fe.degree, dof) *
- source_fe.shape_value_component(
- (i + 2) * source_fe.degree,
- quadrature_point_1,
- 0));
+ weight *
+ (0.5 * this->shape_value_component(
+ this->face_to_cell_index(dof, 4),
+ quadrature_point_0,
+ 0) -
+ interpolation_matrix((i + 2) * source_fe.degree,
+ dof) *
+ source_fe.shape_value_component(
+ (i + 2) * source_fe.degree,
+ quadrature_point_1,
+ 0));
}
for (unsigned int i = 0; i < source_fe.degree - 1; ++i)
{
if (std::abs(solution(i * (source_fe.degree - 1) + j,
0)) > 1e-14)
- interpolation_matrix(
- i * (source_fe.degree - 1) + j + n_boundary_dofs,
- dof) = solution(i * (source_fe.degree - 1) + j, 0);
+ interpolation_matrix(i * (source_fe.degree - 1) + j +
+ n_boundary_dofs,
+ dof) =
+ solution(i * (source_fe.degree - 1) + j, 0);
if (std::abs(solution(i * (source_fe.degree - 1) + j,
1)) > 1e-14)
const RefinementCase<dim> &refinement_case) const
{
Assert(refinement_case < RefinementCase<dim>::isotropic_refinement + 1,
- ExcIndexRange(
- refinement_case, 0, RefinementCase<dim>::isotropic_refinement + 1));
- Assert(
- refinement_case != RefinementCase<dim>::no_refinement,
- ExcMessage("Prolongation matrices are only available for refined cells!"));
- Assert(
- child < GeometryInfo<dim>::n_children(refinement_case),
- ExcIndexRange(child, 0, GeometryInfo<dim>::n_children(refinement_case)));
+ ExcIndexRange(refinement_case,
+ 0,
+ RefinementCase<dim>::isotropic_refinement + 1));
+ Assert(refinement_case != RefinementCase<dim>::no_refinement,
+ ExcMessage(
+ "Prolongation matrices are only available for refined cells!"));
+ Assert(child < GeometryInfo<dim>::n_children(refinement_case),
+ ExcIndexRange(child,
+ 0,
+ GeometryInfo<dim>::n_children(refinement_case)));
// initialization upon first request
if (this->prolongation[refinement_case - 1][child].n() == 0)
const RefinementCase<dim> &refinement_case) const
{
Assert(refinement_case < RefinementCase<dim>::isotropic_refinement + 1,
- ExcIndexRange(
- refinement_case, 0, RefinementCase<dim>::isotropic_refinement + 1));
- Assert(
- refinement_case != RefinementCase<dim>::no_refinement,
- ExcMessage("Restriction matrices are only available for refined cells!"));
- Assert(
- child < GeometryInfo<dim>::n_children(RefinementCase<dim>(refinement_case)),
- ExcIndexRange(
- child,
- 0,
- GeometryInfo<dim>::n_children(RefinementCase<dim>(refinement_case))));
+ ExcIndexRange(refinement_case,
+ 0,
+ RefinementCase<dim>::isotropic_refinement + 1));
+ Assert(refinement_case != RefinementCase<dim>::no_refinement,
+ ExcMessage(
+ "Restriction matrices are only available for refined cells!"));
+ Assert(child <
+ GeometryInfo<dim>::n_children(RefinementCase<dim>(refinement_case)),
+ ExcIndexRange(child,
+ 0,
+ GeometryInfo<dim>::n_children(
+ RefinementCase<dim>(refinement_case))));
// initialization upon first request
if (this->restriction[refinement_case - 1][child].n() == 0)
Assert(support_point_values.size() == this->generalized_support_points.size(),
ExcDimensionMismatch(support_point_values.size(),
this->generalized_support_points.size()));
- Assert(
- support_point_values[0].size() == this->n_components(),
- ExcDimensionMismatch(support_point_values[0].size(), this->n_components()));
+ Assert(support_point_values[0].size() == this->n_components(),
+ ExcDimensionMismatch(support_point_values[0].size(),
+ this->n_components()));
Assert(nodal_values.size() == this->dofs_per_cell,
ExcDimensionMismatch(nodal_values.size(), this->dofs_per_cell));
std::fill(nodal_values.begin(), nodal_values.end(), 0.0);
// Constructor:
template <int dim>
-FE_NedelecSZ<dim>::FE_NedelecSZ(const unsigned int degree) :
- FiniteElement<dim, dim>(
- FiniteElementData<dim>(get_dpo_vector(degree),
- dim,
- degree + 1,
- FiniteElementData<dim>::Hcurl),
- std::vector<bool>(compute_num_dofs(degree), true),
- std::vector<ComponentMask>(compute_num_dofs(degree),
- std::vector<bool>(dim, true)))
+FE_NedelecSZ<dim>::FE_NedelecSZ(const unsigned int degree)
+ : FiniteElement<dim, dim>(
+ FiniteElementData<dim>(get_dpo_vector(degree),
+ dim,
+ degree + 1,
+ FiniteElementData<dim>::Hcurl),
+ std::vector<bool>(compute_num_dofs(degree), true),
+ std::vector<ComponentMask>(compute_num_dofs(degree),
+ std::vector<bool>(dim, true)))
{
Assert(dim >= 2, ExcImpossibleInDim(dim));
if (flags & update_gradients)
{
- data->shape_grads.resize(
- this->dofs_per_cell,
- std::vector<DerivativeForm<1, dim, dim>>(n_q_points));
+ data->shape_grads.resize(this->dofs_per_cell,
+ std::vector<DerivativeForm<1, dim, dim>>(
+ n_q_points));
}
// Not implementing second derivatives yet:
if (flags & update_hessians)
// Fill the values for edge lambda and edge sigma:
const unsigned int
- edge_sigma_direction[GeometryInfo<2>::lines_per_cell] = {
- 1, 1, 0, 0};
+ edge_sigma_direction[GeometryInfo<2>::lines_per_cell] = {1,
+ 1,
+ 0,
+ 0};
data->edge_lambda_values.resize(lines_per_cell,
std::vector<double>(n_q_points));
const UpdateFlags flags(fe_data.update_each);
const unsigned int n_q_points = quadrature.size();
- Assert(
- !(flags & update_values) ||
- fe_data.shape_values.size() == this->dofs_per_cell,
- ExcDimensionMismatch(fe_data.shape_values.size(), this->dofs_per_cell));
+ Assert(!(flags & update_values) ||
+ fe_data.shape_values.size() == this->dofs_per_cell,
+ ExcDimensionMismatch(fe_data.shape_values.size(),
+ this->dofs_per_cell));
Assert(!(flags & update_values) ||
fe_data.shape_values[0].size() == n_q_points,
ExcDimensionMismatch(fe_data.shape_values[0].size(), n_q_points));
fe_data.shape_values.size() == this->dofs_per_cell,
ExcDimensionMismatch(fe_data.shape_values.size(),
this->dofs_per_cell));
- Assert(
- !(flags & update_values) ||
- fe_data.shape_values[0].size() == n_q_points,
- ExcDimensionMismatch(fe_data.shape_values[0].size(), n_q_points));
+ Assert(!(flags & update_values) ||
+ fe_data.shape_values[0].size() == n_q_points,
+ ExcDimensionMismatch(fe_data.shape_values[0].size(),
+ n_q_points));
// Useful geometry info:
const unsigned int vertices_per_face(
faces_per_cell, std::vector<unsigned int>(vertices_per_face));
const unsigned int
- vertex_opposite_on_face[GeometryInfo<3>::vertices_per_face] = {
- 3, 2, 1, 0};
+ vertex_opposite_on_face[GeometryInfo<3>::vertices_per_face] = {3,
+ 2,
+ 1,
+ 0};
const unsigned int
vertices_adjacent_on_face[GeometryInfo<3>::vertices_per_face][2] = {
const UpdateFlags flags(fe_data.update_each);
const unsigned int n_q_points = quadrature.size();
- Assert(
- !(flags & update_values) ||
- fe_data.shape_values.size() == this->dofs_per_cell,
- ExcDimensionMismatch(fe_data.shape_values.size(), this->dofs_per_cell));
+ Assert(!(flags & update_values) ||
+ fe_data.shape_values.size() == this->dofs_per_cell,
+ ExcDimensionMismatch(fe_data.shape_values.size(),
+ this->dofs_per_cell));
Assert(!(flags & update_values) ||
fe_data.shape_values[0].size() == n_q_points,
ExcDimensionMismatch(fe_data.shape_values[0].size(), n_q_points));
// Now update the edge-based DoFs, which depend on the cell.
// This will fill in the missing items in the InternalData
// (fe_internal/fe_data) which was not filled in by get_data.
- fill_edge_values(
- cell, QProjector<dim>::project_to_all_faces(quadrature), fe_data);
+ fill_edge_values(cell,
+ QProjector<dim>::project_to_all_faces(quadrature),
+ fe_data);
if (dim == 3 && this->degree > 1)
{
- fill_face_values(
- cell, QProjector<dim>::project_to_all_faces(quadrature), fe_data);
+ fill_face_values(cell,
+ QProjector<dim>::project_to_all_faces(quadrature),
+ fe_data);
}
const UpdateFlags flags(fe_data.update_each);
std::vector<Tensor<1, dim>> transformed_shape_values(n_q_points);
for (unsigned int dof = 0; dof < this->dofs_per_cell; ++dof)
{
- mapping.transform(
- make_array_view(fe_data.shape_values[dof], offset, n_q_points),
- mapping_covariant,
- mapping_internal,
- make_array_view(transformed_shape_values));
+ mapping.transform(make_array_view(fe_data.shape_values[dof],
+ offset,
+ n_q_points),
+ mapping_covariant,
+ mapping_internal,
+ make_array_view(transformed_shape_values));
const unsigned int first =
data.shape_function_to_row_table[dof * this->n_components() +
std::vector<Tensor<2, dim>> transformed_shape_grads(n_q_points);
for (unsigned int dof = 0; dof < this->dofs_per_cell; ++dof)
{
- mapping.transform(
- make_array_view(fe_data.shape_grads[dof], offset, n_q_points),
- mapping_covariant_gradient,
- mapping_internal,
- make_array_view(transformed_shape_grads));
+ mapping.transform(make_array_view(fe_data.shape_grads[dof],
+ offset,
+ n_q_points),
+ mapping_covariant_gradient,
+ mapping_internal,
+ make_array_view(transformed_shape_grads));
const unsigned int first =
data.shape_function_to_row_table[dof * this->n_components() +
template <int dim, int spacedim>
FE_Nothing<dim, spacedim>::FE_Nothing(const unsigned int n_components,
- const bool dominate) :
- FiniteElement<dim, spacedim>(
- FiniteElementData<dim>(std::vector<unsigned>(dim + 1, 0),
- n_components,
- 0,
- FiniteElementData<dim>::unknown),
- std::vector<bool>(),
- std::vector<ComponentMask>()),
- dominate(dominate)
+ const bool dominate)
+ : FiniteElement<dim, spacedim>(
+ FiniteElementData<dim>(std::vector<unsigned>(dim + 1, 0),
+ n_components,
+ 0,
+ FiniteElementData<dim>::unknown),
+ std::vector<bool>(),
+ std::vector<ComponentMask>())
+ , dominate(dominate)
{
// in most other elements we have to set up all sorts of stuff
// here. there isn't much that we have to do here; in particular,
DEAL_II_NAMESPACE_OPEN
-FE_P1NC::FE_P1NC() :
- FiniteElement<2, 2>(
- FiniteElementData<2>(get_dpo_vector(), 1, 1, FiniteElementData<2>::L2),
- std::vector<bool>(1, false),
- std::vector<ComponentMask>(4, ComponentMask(1, true)))
+FE_P1NC::FE_P1NC()
+ : FiniteElement<2, 2>(
+ FiniteElementData<2>(get_dpo_vector(), 1, 1, FiniteElementData<2>::L2),
+ std::vector<bool>(1, false),
+ std::vector<ComponentMask>(4, ComponentMask(1, true)))
{
// face support points: 2 end vertices
unit_face_support_points.resize(2);
for (unsigned int i = 0; i < quadrature_on_face.size(); ++i)
for (unsigned int k = 0; k < this->dofs_per_cell; ++k)
{
- const Point<2> quadrature_point = mapping.transform_unit_to_real_cell(
- cell, quadrature_on_face.point(i));
+ const Point<2> quadrature_point =
+ mapping.transform_unit_to_real_cell(cell,
+ quadrature_on_face.point(i));
output_data.shape_values[k][i] =
(coeffs[k][0] * quadrature_point(0) +
cell_similarity != CellSimilarity::translation)
{
for (unsigned int k = 0; k < this->dofs_per_cell; ++k)
- mapping.transform(
- make_array_view(fe_data.shape_3rd_derivatives, k),
- mapping_covariant_hessian,
- mapping_internal,
- make_array_view(output_data.shape_3rd_derivatives, k));
+ mapping.transform(make_array_view(fe_data.shape_3rd_derivatives, k),
+ mapping_covariant_hessian,
+ mapping_internal,
+ make_array_view(output_data.shape_3rd_derivatives,
+ k));
for (unsigned int k = 0; k < this->dofs_per_cell; ++k)
- correct_third_derivatives(
- output_data, mapping_data, quadrature.size(), k);
+ correct_third_derivatives(output_data,
+ mapping_data,
+ quadrature.size(),
+ k);
}
}
cell_similarity != CellSimilarity::translation)
{
for (unsigned int k = 0; k < this->dofs_per_cell; ++k)
- mapping.transform(
- make_array_view(fe_data.shape_3rd_derivatives, k),
- mapping_covariant_hessian,
- mapping_internal,
- make_array_view(output_data.shape_3rd_derivatives, k));
+ mapping.transform(make_array_view(fe_data.shape_3rd_derivatives, k),
+ mapping_covariant_hessian,
+ mapping_internal,
+ make_array_view(output_data.shape_3rd_derivatives,
+ k));
for (unsigned int k = 0; k < this->dofs_per_cell; ++k)
- correct_third_derivatives(
- output_data, mapping_data, quadrature.size(), k);
+ correct_third_derivatives(output_data,
+ mapping_data,
+ quadrature.size(),
+ k);
}
}
cell_similarity != CellSimilarity::translation)
{
for (unsigned int k = 0; k < this->dofs_per_cell; ++k)
- mapping.transform(
- make_array_view(fe_data.shape_3rd_derivatives, k),
- mapping_covariant_hessian,
- mapping_internal,
- make_array_view(output_data.shape_3rd_derivatives, k));
+ mapping.transform(make_array_view(fe_data.shape_3rd_derivatives, k),
+ mapping_covariant_hessian,
+ mapping_internal,
+ make_array_view(output_data.shape_3rd_derivatives,
+ k));
for (unsigned int k = 0; k < this->dofs_per_cell; ++k)
- correct_third_derivatives(
- output_data, mapping_data, quadrature.size(), k);
+ correct_third_derivatives(output_data,
+ mapping_data,
+ quadrature.size(),
+ k);
}
}
cell_similarity != CellSimilarity::translation)
{
for (unsigned int k = 0; k < this->dofs_per_cell; ++k)
- mapping.transform(
- make_array_view(fe_data.shape_3rd_derivatives, k),
- mapping_covariant_hessian,
- mapping_internal,
- make_array_view(output_data.shape_3rd_derivatives, k));
+ mapping.transform(make_array_view(fe_data.shape_3rd_derivatives, k),
+ mapping_covariant_hessian,
+ mapping_internal,
+ make_array_view(output_data.shape_3rd_derivatives,
+ k));
for (unsigned int k = 0; k < this->dofs_per_cell; ++k)
- correct_third_derivatives(
- output_data, mapping_data, quadrature.size(), k);
+ correct_third_derivatives(output_data,
+ mapping_data,
+ quadrature.size(),
+ k);
}
}
const unsigned int degree,
const FiniteElementData<dim> & fe_data,
const std::vector<bool> & restriction_is_additive_flags,
- const std::vector<ComponentMask> &nonzero_components) :
- FiniteElement<dim, spacedim>(fe_data,
- restriction_is_additive_flags,
- nonzero_components),
- mapping_type(MappingType::mapping_none),
- poly_space(PolynomialType(degree))
+ const std::vector<ComponentMask> &nonzero_components)
+ : FiniteElement<dim, spacedim>(fe_data,
+ restriction_is_additive_flags,
+ nonzero_components)
+ , mapping_type(MappingType::mapping_none)
+ , poly_space(PolynomialType(degree))
{
cached_point(0) = -1;
// Set up the table converting
const unsigned int n_q_points = quadrature.size();
- Assert(
- !(fe_data.update_each & update_values) ||
- fe_data.shape_values.size()[0] == this->dofs_per_cell,
- ExcDimensionMismatch(fe_data.shape_values.size()[0], this->dofs_per_cell));
+ Assert(!(fe_data.update_each & update_values) ||
+ fe_data.shape_values.size()[0] == this->dofs_per_cell,
+ ExcDimensionMismatch(fe_data.shape_values.size()[0],
+ this->dofs_per_cell));
Assert(!(fe_data.update_each & update_values) ||
fe_data.shape_values.size()[1] == n_q_points,
ExcDimensionMismatch(fe_data.shape_values.size()[1], n_q_points));
std::fill(fe_data.sign_change.begin(), fe_data.sign_change.end(), 1.0);
if (mapping_type == mapping_raviart_thomas)
- internal::FE_PolyTensor::get_face_sign_change_rt(
- cell, this->dofs_per_face, fe_data.sign_change);
+ internal::FE_PolyTensor::get_face_sign_change_rt(cell,
+ this->dofs_per_face,
+ fe_data.sign_change);
else if (mapping_type == mapping_nedelec)
- internal::FE_PolyTensor::get_face_sign_change_nedelec(
- cell, this->dofs_per_face, fe_data.sign_change);
+ internal::FE_PolyTensor::get_face_sign_change_nedelec(cell,
+ this->dofs_per_face,
+ fe_data.sign_change);
for (unsigned int i = 0; i < this->dofs_per_cell; ++i)
case mapping_covariant:
case mapping_contravariant:
{
- mapping.transform(
- make_array_view(fe_data.shape_values, i),
- mapping_type,
- mapping_internal,
- make_array_view(fe_data.transformed_shape_values));
+ mapping.transform(make_array_view(fe_data.shape_values, i),
+ mapping_type,
+ mapping_internal,
+ make_array_view(
+ fe_data.transformed_shape_values));
for (unsigned int k = 0; k < n_q_points; ++k)
for (unsigned int d = 0; d < dim; ++d)
case mapping_raviart_thomas:
case mapping_piola:
{
- mapping.transform(
- make_array_view(fe_data.shape_values, i),
- mapping_piola,
- mapping_internal,
- make_array_view(fe_data.transformed_shape_values));
+ mapping.transform(make_array_view(fe_data.shape_values, i),
+ mapping_piola,
+ mapping_internal,
+ make_array_view(
+ fe_data.transformed_shape_values));
for (unsigned int k = 0; k < n_q_points; ++k)
for (unsigned int d = 0; d < dim; ++d)
output_data.shape_values(first + d, k) =
case mapping_nedelec:
{
- mapping.transform(
- make_array_view(fe_data.shape_values, i),
- mapping_covariant,
- mapping_internal,
- make_array_view(fe_data.transformed_shape_values));
+ mapping.transform(make_array_view(fe_data.shape_values, i),
+ mapping_covariant,
+ mapping_internal,
+ make_array_view(
+ fe_data.transformed_shape_values));
for (unsigned int k = 0; k < n_q_points; ++k)
for (unsigned int d = 0; d < dim; ++d)
{
case mapping_none:
{
- mapping.transform(
- make_array_view(fe_data.shape_grads, i),
- mapping_covariant,
- mapping_internal,
- make_array_view(fe_data.transformed_shape_grads));
+ mapping.transform(make_array_view(fe_data.shape_grads, i),
+ mapping_covariant,
+ mapping_internal,
+ make_array_view(
+ fe_data.transformed_shape_grads));
for (unsigned int k = 0; k < n_q_points; ++k)
for (unsigned int d = 0; d < dim; ++d)
output_data.shape_gradients[first + d][k] =
}
case mapping_covariant:
{
- mapping.transform(
- make_array_view(fe_data.shape_grads, i),
- mapping_covariant_gradient,
- mapping_internal,
- make_array_view(fe_data.transformed_shape_grads));
+ mapping.transform(make_array_view(fe_data.shape_grads, i),
+ mapping_covariant_gradient,
+ mapping_internal,
+ make_array_view(
+ fe_data.transformed_shape_grads));
for (unsigned int k = 0; k < n_q_points; ++k)
for (unsigned int d = 0; d < spacedim; ++d)
std::fill(fe_data.sign_change.begin(), fe_data.sign_change.end(), 1.0);
if (mapping_type == mapping_raviart_thomas)
- internal::FE_PolyTensor::get_face_sign_change_rt(
- cell, this->dofs_per_face, fe_data.sign_change);
+ internal::FE_PolyTensor::get_face_sign_change_rt(cell,
+ this->dofs_per_face,
+ fe_data.sign_change);
else if (mapping_type == mapping_nedelec)
- internal::FE_PolyTensor::get_face_sign_change_nedelec(
- cell, this->dofs_per_face, fe_data.sign_change);
+ internal::FE_PolyTensor::get_face_sign_change_nedelec(cell,
+ this->dofs_per_face,
+ fe_data.sign_change);
for (unsigned int i = 0; i < this->dofs_per_cell; ++i)
{
case mapping_contravariant:
{
const ArrayView<Tensor<1, spacedim>>
- transformed_shape_values = make_array_view(
- fe_data.transformed_shape_values, offset, n_q_points);
- mapping.transform(
- make_array_view(
- fe_data.shape_values, i, offset, n_q_points),
- mapping_type,
- mapping_internal,
- transformed_shape_values);
+ transformed_shape_values =
+ make_array_view(fe_data.transformed_shape_values,
+ offset,
+ n_q_points);
+ mapping.transform(make_array_view(fe_data.shape_values,
+ i,
+ offset,
+ n_q_points),
+ mapping_type,
+ mapping_internal,
+ transformed_shape_values);
for (unsigned int k = 0; k < n_q_points; ++k)
for (unsigned int d = 0; d < dim; ++d)
case mapping_piola:
{
const ArrayView<Tensor<1, spacedim>>
- transformed_shape_values = make_array_view(
- fe_data.transformed_shape_values, offset, n_q_points);
- mapping.transform(
- make_array_view(
- fe_data.shape_values, i, offset, n_q_points),
- mapping_piola,
- mapping_internal,
- transformed_shape_values);
+ transformed_shape_values =
+ make_array_view(fe_data.transformed_shape_values,
+ offset,
+ n_q_points);
+ mapping.transform(make_array_view(fe_data.shape_values,
+ i,
+ offset,
+ n_q_points),
+ mapping_piola,
+ mapping_internal,
+ transformed_shape_values);
for (unsigned int k = 0; k < n_q_points; ++k)
for (unsigned int d = 0; d < dim; ++d)
output_data.shape_values(first + d, k) =
case mapping_nedelec:
{
const ArrayView<Tensor<1, spacedim>>
- transformed_shape_values = make_array_view(
- fe_data.transformed_shape_values, offset, n_q_points);
- mapping.transform(
- make_array_view(
- fe_data.shape_values, i, offset, n_q_points),
- mapping_covariant,
- mapping_internal,
- transformed_shape_values);
+ transformed_shape_values =
+ make_array_view(fe_data.transformed_shape_values,
+ offset,
+ n_q_points);
+ mapping.transform(make_array_view(fe_data.shape_values,
+ i,
+ offset,
+ n_q_points),
+ mapping_covariant,
+ mapping_internal,
+ transformed_shape_values);
for (unsigned int k = 0; k < n_q_points; ++k)
for (unsigned int d = 0; d < dim; ++d)
case mapping_none:
{
const ArrayView<Tensor<2, spacedim>> transformed_shape_grads =
- make_array_view(
- fe_data.transformed_shape_grads, offset, n_q_points);
+ make_array_view(fe_data.transformed_shape_grads,
+ offset,
+ n_q_points);
mapping.transform(
make_array_view(fe_data.shape_grads, i, offset, n_q_points),
mapping_covariant,
case mapping_covariant:
{
const ArrayView<Tensor<2, spacedim>> transformed_shape_grads =
- make_array_view(
- fe_data.transformed_shape_grads, offset, n_q_points);
+ make_array_view(fe_data.transformed_shape_grads,
+ offset,
+ n_q_points);
mapping.transform(
make_array_view(fe_data.shape_grads, i, offset, n_q_points),
mapping_covariant_gradient,
case mapping_contravariant:
{
const ArrayView<Tensor<2, spacedim>> transformed_shape_grads =
- make_array_view(
- fe_data.transformed_shape_grads, offset, n_q_points);
+ make_array_view(fe_data.transformed_shape_grads,
+ offset,
+ n_q_points);
for (unsigned int k = 0; k < n_q_points; ++k)
fe_data.untransformed_shape_grads[k + offset] =
fe_data.shape_grads[i][k + offset];
mapping.transform(
- make_array_view(
- fe_data.untransformed_shape_grads, offset, n_q_points),
+ make_array_view(fe_data.untransformed_shape_grads,
+ offset,
+ n_q_points),
mapping_contravariant_gradient,
mapping_internal,
transformed_shape_grads);
case mapping_piola:
{
const ArrayView<Tensor<2, spacedim>> transformed_shape_grads =
- make_array_view(
- fe_data.transformed_shape_grads, offset, n_q_points);
+ make_array_view(fe_data.transformed_shape_grads,
+ offset,
+ n_q_points);
for (unsigned int k = 0; k < n_q_points; ++k)
fe_data.untransformed_shape_grads[k + offset] =
fe_data.shape_grads[i][k + offset];
mapping.transform(
- make_array_view(
- fe_data.untransformed_shape_grads, offset, n_q_points),
+ make_array_view(fe_data.untransformed_shape_grads,
+ offset,
+ n_q_points),
mapping_piola_gradient,
mapping_internal,
transformed_shape_grads);
fe_data.shape_grads[i][k + offset];
const ArrayView<Tensor<2, spacedim>> transformed_shape_grads =
- make_array_view(
- fe_data.transformed_shape_grads, offset, n_q_points);
+ make_array_view(fe_data.transformed_shape_grads,
+ offset,
+ n_q_points);
mapping.transform(
- make_array_view(
- fe_data.untransformed_shape_grads, offset, n_q_points),
+ make_array_view(fe_data.untransformed_shape_grads,
+ offset,
+ n_q_points),
mapping_covariant_gradient,
mapping_internal,
transformed_shape_grads);
case mapping_none:
{
const ArrayView<Tensor<3, spacedim>>
- transformed_shape_hessians = make_array_view(
- fe_data.transformed_shape_hessians, offset, n_q_points);
- mapping.transform(
- make_array_view(
- fe_data.shape_grad_grads, i, offset, n_q_points),
- mapping_covariant_gradient,
- mapping_internal,
- transformed_shape_hessians);
+ transformed_shape_hessians =
+ make_array_view(fe_data.transformed_shape_hessians,
+ offset,
+ n_q_points);
+ mapping.transform(make_array_view(fe_data.shape_grad_grads,
+ i,
+ offset,
+ n_q_points),
+ mapping_covariant_gradient,
+ mapping_internal,
+ transformed_shape_hessians);
for (unsigned int k = 0; k < n_q_points; ++k)
for (unsigned int d = 0; d < spacedim; ++d)
fe_data.shape_grad_grads[i][k + offset];
const ArrayView<Tensor<3, spacedim>>
- transformed_shape_hessians = make_array_view(
- fe_data.transformed_shape_hessians, offset, n_q_points);
+ transformed_shape_hessians =
+ make_array_view(fe_data.transformed_shape_hessians,
+ offset,
+ n_q_points);
mapping.transform(
make_array_view(fe_data.untransformed_shape_hessian_tensors,
offset,
fe_data.shape_grad_grads[i][k + offset];
const ArrayView<Tensor<3, spacedim>>
- transformed_shape_hessians = make_array_view(
- fe_data.transformed_shape_hessians, offset, n_q_points);
+ transformed_shape_hessians =
+ make_array_view(fe_data.transformed_shape_hessians,
+ offset,
+ n_q_points);
mapping.transform(
make_array_view(fe_data.untransformed_shape_hessian_tensors,
offset,
fe_data.shape_grad_grads[i][k + offset];
const ArrayView<Tensor<3, spacedim>>
- transformed_shape_hessians = make_array_view(
- fe_data.transformed_shape_hessians, offset, n_q_points);
+ transformed_shape_hessians =
+ make_array_view(fe_data.transformed_shape_hessians,
+ offset,
+ n_q_points);
mapping.transform(
make_array_view(fe_data.untransformed_shape_hessian_tensors,
offset,
fe_data.shape_grad_grads[i][k + offset];
const ArrayView<Tensor<3, spacedim>>
- transformed_shape_hessians = make_array_view(
- fe_data.transformed_shape_hessians, offset, n_q_points);
+ transformed_shape_hessians =
+ make_array_view(fe_data.transformed_shape_hessians,
+ offset,
+ n_q_points);
mapping.transform(
make_array_view(fe_data.untransformed_shape_hessian_tensors,
offset,
std::fill(fe_data.sign_change.begin(), fe_data.sign_change.end(), 1.0);
if (mapping_type == mapping_raviart_thomas)
- internal::FE_PolyTensor::get_face_sign_change_rt(
- cell, this->dofs_per_face, fe_data.sign_change);
+ internal::FE_PolyTensor::get_face_sign_change_rt(cell,
+ this->dofs_per_face,
+ fe_data.sign_change);
else if (mapping_type == mapping_nedelec)
- internal::FE_PolyTensor::get_face_sign_change_nedelec(
- cell, this->dofs_per_face, fe_data.sign_change);
+ internal::FE_PolyTensor::get_face_sign_change_nedelec(cell,
+ this->dofs_per_face,
+ fe_data.sign_change);
for (unsigned int i = 0; i < this->dofs_per_cell; ++i)
{
case mapping_contravariant:
{
const ArrayView<Tensor<1, spacedim>>
- transformed_shape_values = make_array_view(
- fe_data.transformed_shape_values, offset, n_q_points);
- mapping.transform(
- make_array_view(
- fe_data.shape_values, i, offset, n_q_points),
- mapping_type,
- mapping_internal,
- transformed_shape_values);
+ transformed_shape_values =
+ make_array_view(fe_data.transformed_shape_values,
+ offset,
+ n_q_points);
+ mapping.transform(make_array_view(fe_data.shape_values,
+ i,
+ offset,
+ n_q_points),
+ mapping_type,
+ mapping_internal,
+ transformed_shape_values);
for (unsigned int k = 0; k < n_q_points; ++k)
for (unsigned int d = 0; d < dim; ++d)
case mapping_piola:
{
const ArrayView<Tensor<1, spacedim>>
- transformed_shape_values = make_array_view(
- fe_data.transformed_shape_values, offset, n_q_points);
-
- mapping.transform(
- make_array_view(
- fe_data.shape_values, i, offset, n_q_points),
- mapping_piola,
- mapping_internal,
- transformed_shape_values);
+ transformed_shape_values =
+ make_array_view(fe_data.transformed_shape_values,
+ offset,
+ n_q_points);
+
+ mapping.transform(make_array_view(fe_data.shape_values,
+ i,
+ offset,
+ n_q_points),
+ mapping_piola,
+ mapping_internal,
+ transformed_shape_values);
for (unsigned int k = 0; k < n_q_points; ++k)
for (unsigned int d = 0; d < dim; ++d)
output_data.shape_values(first + d, k) =
case mapping_nedelec:
{
const ArrayView<Tensor<1, spacedim>>
- transformed_shape_values = make_array_view(
- fe_data.transformed_shape_values, offset, n_q_points);
+ transformed_shape_values =
+ make_array_view(fe_data.transformed_shape_values,
+ offset,
+ n_q_points);
- mapping.transform(
- make_array_view(
- fe_data.shape_values, i, offset, n_q_points),
- mapping_covariant,
- mapping_internal,
- transformed_shape_values);
+ mapping.transform(make_array_view(fe_data.shape_values,
+ i,
+ offset,
+ n_q_points),
+ mapping_covariant,
+ mapping_internal,
+ transformed_shape_values);
for (unsigned int k = 0; k < n_q_points; ++k)
for (unsigned int d = 0; d < dim; ++d)
if (fe_data.update_each & update_gradients)
{
const ArrayView<Tensor<2, spacedim>> transformed_shape_grads =
- make_array_view(
- fe_data.transformed_shape_grads, offset, n_q_points);
+ make_array_view(fe_data.transformed_shape_grads,
+ offset,
+ n_q_points);
switch (mapping_type)
{
case mapping_none:
fe_data.shape_grads[i][k + offset];
mapping.transform(
- make_array_view(
- fe_data.untransformed_shape_grads, offset, n_q_points),
+ make_array_view(fe_data.untransformed_shape_grads,
+ offset,
+ n_q_points),
mapping_contravariant_gradient,
mapping_internal,
transformed_shape_grads);
fe_data.shape_grads[i][k + offset];
mapping.transform(
- make_array_view(
- fe_data.untransformed_shape_grads, offset, n_q_points),
+ make_array_view(fe_data.untransformed_shape_grads,
+ offset,
+ n_q_points),
mapping_piola_gradient,
mapping_internal,
transformed_shape_grads);
fe_data.shape_grads[i][k + offset];
mapping.transform(
- make_array_view(
- fe_data.untransformed_shape_grads, offset, n_q_points),
+ make_array_view(fe_data.untransformed_shape_grads,
+ offset,
+ n_q_points),
mapping_covariant_gradient,
mapping_internal,
transformed_shape_grads);
case mapping_none:
{
const ArrayView<Tensor<3, spacedim>>
- transformed_shape_hessians = make_array_view(
- fe_data.transformed_shape_hessians, offset, n_q_points);
- mapping.transform(
- make_array_view(
- fe_data.shape_grad_grads, i, offset, n_q_points),
- mapping_covariant_gradient,
- mapping_internal,
- transformed_shape_hessians);
+ transformed_shape_hessians =
+ make_array_view(fe_data.transformed_shape_hessians,
+ offset,
+ n_q_points);
+ mapping.transform(make_array_view(fe_data.shape_grad_grads,
+ i,
+ offset,
+ n_q_points),
+ mapping_covariant_gradient,
+ mapping_internal,
+ transformed_shape_hessians);
for (unsigned int k = 0; k < n_q_points; ++k)
for (unsigned int d = 0; d < spacedim; ++d)
fe_data.shape_grad_grads[i][k + offset];
const ArrayView<Tensor<3, spacedim>>
- transformed_shape_hessians = make_array_view(
- fe_data.transformed_shape_hessians, offset, n_q_points);
+ transformed_shape_hessians =
+ make_array_view(fe_data.transformed_shape_hessians,
+ offset,
+ n_q_points);
mapping.transform(
make_array_view(fe_data.untransformed_shape_hessian_tensors,
offset,
fe_data.shape_grad_grads[i][k + offset];
const ArrayView<Tensor<3, spacedim>>
- transformed_shape_hessians = make_array_view(
- fe_data.transformed_shape_hessians, offset, n_q_points);
+ transformed_shape_hessians =
+ make_array_view(fe_data.transformed_shape_hessians,
+ offset,
+ n_q_points);
mapping.transform(
make_array_view(fe_data.untransformed_shape_hessian_tensors,
offset,
fe_data.shape_grad_grads[i][k + offset];
const ArrayView<Tensor<3, spacedim>>
- transformed_shape_hessians = make_array_view(
- fe_data.transformed_shape_hessians, offset, n_q_points);
+ transformed_shape_hessians =
+ make_array_view(fe_data.transformed_shape_hessians,
+ offset,
+ n_q_points);
mapping.transform(
make_array_view(fe_data.untransformed_shape_hessian_tensors,
offset,
fe_data.shape_grad_grads[i][k + offset];
const ArrayView<Tensor<3, spacedim>>
- transformed_shape_hessians = make_array_view(
- fe_data.transformed_shape_hessians, offset, n_q_points);
+ transformed_shape_hessians =
+ make_array_view(fe_data.transformed_shape_hessians,
+ offset,
+ n_q_points);
mapping.transform(
make_array_view(fe_data.untransformed_shape_hessian_tensors,
offset,
template <int dim, int spacedim>
-FE_Q<dim, spacedim>::FE_Q(const unsigned int degree) :
- FE_Q_Base<TensorProductPolynomials<dim>, dim, spacedim>(
- TensorProductPolynomials<dim>(Polynomials::generate_complete_Lagrange_basis(
- internal::FE_Q::get_QGaussLobatto_points(degree))),
- FiniteElementData<dim>(this->get_dpo_vector(degree),
- 1,
- degree,
- FiniteElementData<dim>::H1),
- std::vector<bool>(1, false))
+FE_Q<dim, spacedim>::FE_Q(const unsigned int degree)
+ : FE_Q_Base<TensorProductPolynomials<dim>, dim, spacedim>(
+ TensorProductPolynomials<dim>(
+ Polynomials::generate_complete_Lagrange_basis(
+ internal::FE_Q::get_QGaussLobatto_points(degree))),
+ FiniteElementData<dim>(this->get_dpo_vector(degree),
+ 1,
+ degree,
+ FiniteElementData<dim>::H1),
+ std::vector<bool>(1, false))
{
this->initialize(internal::FE_Q::get_QGaussLobatto_points(degree));
}
template <int dim, int spacedim>
-FE_Q<dim, spacedim>::FE_Q(const Quadrature<1> &points) :
- FE_Q_Base<TensorProductPolynomials<dim>, dim, spacedim>(
- TensorProductPolynomials<dim>(
- Polynomials::generate_complete_Lagrange_basis(points.get_points())),
- FiniteElementData<dim>(this->get_dpo_vector(points.size() - 1),
- 1,
- points.size() - 1,
- FiniteElementData<dim>::H1),
- std::vector<bool>(1, false))
+FE_Q<dim, spacedim>::FE_Q(const Quadrature<1> &points)
+ : FE_Q_Base<TensorProductPolynomials<dim>, dim, spacedim>(
+ TensorProductPolynomials<dim>(
+ Polynomials::generate_complete_Lagrange_basis(points.get_points())),
+ FiniteElementData<dim>(this->get_dpo_vector(points.size() - 1),
+ 1,
+ points.size() - 1,
+ FiniteElementData<dim>::H1),
+ std::vector<bool>(1, false))
{
this->initialize(points.get_points());
}
const std::vector<unsigned int> face_index_map =
internal::FE_Q_Base::face_lexicographic_to_hierarchic_numbering<dim>(
q_deg);
- Assert(
- std::abs(fe.poly_space.compute_value(index_map_inverse[0], Point<dim>()) -
- 1.) < 1e-14,
- ExcInternalError());
+ Assert(std::abs(
+ fe.poly_space.compute_value(index_map_inverse[0], Point<dim>()) -
+ 1.) < 1e-14,
+ ExcInternalError());
for (unsigned int i = 0; i < constraint_points.size(); ++i)
for (unsigned int j = 0; j < q_deg + 1; ++j)
subface < GeometryInfo<dim - 1>::max_children_per_face;
++subface)
{
- QProjector<dim - 1>::project_to_subface(
- qline, face, subface, p_line);
- constraint_points.insert(
- constraint_points.end(), p_line.begin(), p_line.end());
+ QProjector<dim - 1>::project_to_subface(qline,
+ face,
+ subface,
+ p_line);
+ constraint_points.insert(constraint_points.end(),
+ p_line.begin(),
+ p_line.end());
}
// Create constraints for interior nodes
const std::vector<unsigned int> face_index_map =
internal::FE_Q_Base::face_lexicographic_to_hierarchic_numbering<dim>(
q_deg);
- Assert(
- std::abs(fe.poly_space.compute_value(index_map_inverse[0], Point<dim>()) -
- 1.) < 1e-14,
- ExcInternalError());
+ Assert(std::abs(
+ fe.poly_space.compute_value(index_map_inverse[0], Point<dim>()) -
+ 1.) < 1e-14,
+ ExcInternalError());
fe.interface_constraints.TableBase<2, double>::reinit(
fe.interface_constraints_size());
FE_Q_Base<PolynomialType, dim, spacedim>::FE_Q_Base(
const PolynomialType & poly_space,
const FiniteElementData<dim> &fe_data,
- const std::vector<bool> & restriction_is_additive_flags) :
- FE_Poly<PolynomialType, dim, spacedim>(
- poly_space,
- fe_data,
- restriction_is_additive_flags,
- std::vector<ComponentMask>(1, std::vector<bool>(1, true))),
- q_degree(
- std::is_same<PolynomialType, TensorProductPolynomialsBubbles<dim>>::value ?
- this->degree - 1 :
- this->degree)
+ const std::vector<bool> & restriction_is_additive_flags)
+ : FE_Poly<PolynomialType, dim, spacedim>(
+ poly_space,
+ fe_data,
+ restriction_is_additive_flags,
+ std::vector<ComponentMask>(1, std::vector<bool>(1, true)))
+ , q_degree(std::is_same<PolynomialType,
+ TensorProductPolynomialsBubbles<dim>>::value ?
+ this->degree - 1 :
+ this->degree)
{}
&x_source_fe))
{
// ok, source is a Q element, so we will be able to do the work
- Assert(
- interpolation_matrix.m() == this->dofs_per_cell,
- ExcDimensionMismatch(interpolation_matrix.m(), this->dofs_per_cell));
+ Assert(interpolation_matrix.m() == this->dofs_per_cell,
+ ExcDimensionMismatch(interpolation_matrix.m(),
+ this->dofs_per_cell));
Assert(interpolation_matrix.n() == x_source_fe.dofs_per_cell,
ExcDimensionMismatch(interpolation_matrix.m(),
x_source_fe.dofs_per_cell));
FullMatrix<double> & interpolation_matrix) const
{
Assert(dim > 1, ExcImpossibleInDim(1));
- get_subface_interpolation_matrix(
- source_fe, numbers::invalid_unsigned_int, interpolation_matrix);
+ get_subface_interpolation_matrix(source_fe,
+ numbers::invalid_unsigned_int,
+ interpolation_matrix);
}
const unsigned int subface,
FullMatrix<double> & interpolation_matrix) const
{
- Assert(
- interpolation_matrix.m() == x_source_fe.dofs_per_face,
- ExcDimensionMismatch(interpolation_matrix.m(), x_source_fe.dofs_per_face));
+ Assert(interpolation_matrix.m() == x_source_fe.dofs_per_face,
+ ExcDimensionMismatch(interpolation_matrix.m(),
+ x_source_fe.dofs_per_face));
// see if source is a Q element
if (const FE_Q_Base<PolynomialType, dim, spacedim> *source_fe =
{
// have this test in here since a table of size 2x0 reports its size as
// 0x0
- Assert(
- interpolation_matrix.n() == this->dofs_per_face,
- ExcDimensionMismatch(interpolation_matrix.n(), this->dofs_per_face));
+ Assert(interpolation_matrix.n() == this->dofs_per_face,
+ ExcDimensionMismatch(interpolation_matrix.n(),
+ this->dofs_per_face));
// Make sure that the element for which the DoFs should be constrained
// is the one with the higher polynomial degree. Actually the procedure
const RefinementCase<dim> &refinement_case) const
{
Assert(refinement_case < RefinementCase<dim>::isotropic_refinement + 1,
- ExcIndexRange(
- refinement_case, 0, RefinementCase<dim>::isotropic_refinement + 1));
- Assert(
- refinement_case != RefinementCase<dim>::no_refinement,
- ExcMessage("Prolongation matrices are only available for refined cells!"));
- Assert(
- child < GeometryInfo<dim>::n_children(refinement_case),
- ExcIndexRange(child, 0, GeometryInfo<dim>::n_children(refinement_case)));
+ ExcIndexRange(refinement_case,
+ 0,
+ RefinementCase<dim>::isotropic_refinement + 1));
+ Assert(refinement_case != RefinementCase<dim>::no_refinement,
+ ExcMessage(
+ "Prolongation matrices are only available for refined cells!"));
+ Assert(child < GeometryInfo<dim>::n_children(refinement_case),
+ ExcIndexRange(child,
+ 0,
+ GeometryInfo<dim>::n_children(refinement_case)));
// initialization upon first request
if (this->prolongation[refinement_case - 1][child].n() == 0)
"prevents the sum to be one."));
for (unsigned int j = 0; j < q_dofs_per_cell; ++j)
if (j != i)
- Assert(
- std::fabs(this->poly_space.compute_value(
- i, this->unit_support_points[j])) < eps,
- ExcInternalError("The Lagrange polynomial does not evaluate "
- "to one or zero in a nodal point. "
- "This typically indicates that the "
- "polynomial interpolation is "
- "ill-conditioned such that round-off "
- "prevents the sum to be one."));
+ Assert(std::fabs(this->poly_space.compute_value(
+ i, this->unit_support_points[j])) < eps,
+ ExcInternalError(
+ "The Lagrange polynomial does not evaluate "
+ "to one or zero in a nodal point. "
+ "This typically indicates that the "
+ "polynomial interpolation is "
+ "ill-conditioned such that round-off "
+ "prevents the sum to be one."));
}
#endif
const unsigned int diag_comp = index_map_inverse[j * step_size_diag];
const Point<dim> p_subcell = this->unit_support_points[diag_comp];
const Point<dim> p_cell =
- GeometryInfo<dim>::child_to_cell_coordinates(
- p_subcell, child, refinement_case);
+ GeometryInfo<dim>::child_to_cell_coordinates(p_subcell,
+ child,
+ refinement_case);
for (unsigned int i = 0; i < dofs1d; ++i)
for (unsigned int d = 0; d < dim; ++d)
{
const RefinementCase<dim> &refinement_case) const
{
Assert(refinement_case < RefinementCase<dim>::isotropic_refinement + 1,
- ExcIndexRange(
- refinement_case, 0, RefinementCase<dim>::isotropic_refinement + 1));
- Assert(
- refinement_case != RefinementCase<dim>::no_refinement,
- ExcMessage("Restriction matrices are only available for refined cells!"));
- Assert(
- child < GeometryInfo<dim>::n_children(refinement_case),
- ExcIndexRange(child, 0, GeometryInfo<dim>::n_children(refinement_case)));
+ ExcIndexRange(refinement_case,
+ 0,
+ RefinementCase<dim>::isotropic_refinement + 1));
+ Assert(refinement_case != RefinementCase<dim>::no_refinement,
+ ExcMessage(
+ "Restriction matrices are only available for refined cells!"));
+ Assert(child < GeometryInfo<dim>::n_children(refinement_case),
+ ExcIndexRange(child,
+ 0,
+ GeometryInfo<dim>::n_children(refinement_case)));
// initialization upon first request
if (this->restriction[refinement_case - 1][child].n() == 0)
// check whether this interpolation point is inside this child cell
const Point<dim> p_subcell =
- GeometryInfo<dim>::cell_to_child_coordinates(
- p_cell, child, refinement_case);
+ GeometryInfo<dim>::cell_to_child_coordinates(p_cell,
+ child,
+ refinement_case);
if (GeometryInfo<dim>::is_inside_unit_cell(p_subcell))
{
// same logic as in initialize_embedding to evaluate the
for (unsigned int d = 0; d < dim; ++d)
{
Point<dim> point;
- point[0] = p_subcell[d];
- evaluations1d[j][d] = this->poly_space.compute_value(
- index_map_inverse[j], point);
+ point[0] = p_subcell[d];
+ evaluations1d[j][d] =
+ this->poly_space.compute_value(index_map_inverse[j],
+ point);
}
unsigned int j_indices[dim];
internal::FE_Q_Base::zero_indices<dim>(j_indices);
for (unsigned int i = 0; i < nc; ++i)
{
- Assert(
- matrices[ref_case - 1][i].n() == dpc,
- ExcDimensionMismatch(matrices[ref_case - 1][i].n(), dpc));
- Assert(
- matrices[ref_case - 1][i].m() == dpc,
- ExcDimensionMismatch(matrices[ref_case - 1][i].m(), dpc));
+ Assert(matrices[ref_case - 1][i].n() == dpc,
+ ExcDimensionMismatch(matrices[ref_case - 1][i].n(),
+ dpc));
+ Assert(matrices[ref_case - 1][i].m() == dpc,
+ ExcDimensionMismatch(matrices[ref_case - 1][i].m(),
+ dpc));
}
// create a respective refinement on the triangulation
template <int dim, int spacedim>
-FE_Q_Bubbles<dim, spacedim>::FE_Q_Bubbles(const unsigned int q_degree) :
- FE_Q_Base<TensorProductPolynomialsBubbles<dim>, dim, spacedim>(
- TensorProductPolynomialsBubbles<dim>(
- Polynomials::generate_complete_Lagrange_basis(
- QGaussLobatto<1>(q_degree + 1).get_points())),
- FiniteElementData<dim>(get_dpo_vector(q_degree),
- 1,
- q_degree + 1,
- FiniteElementData<dim>::H1),
- get_riaf_vector(q_degree)),
- n_bubbles((q_degree <= 1) ? 1 : dim)
+FE_Q_Bubbles<dim, spacedim>::FE_Q_Bubbles(const unsigned int q_degree)
+ : FE_Q_Base<TensorProductPolynomialsBubbles<dim>, dim, spacedim>(
+ TensorProductPolynomialsBubbles<dim>(
+ Polynomials::generate_complete_Lagrange_basis(
+ QGaussLobatto<1>(q_degree + 1).get_points())),
+ FiniteElementData<dim>(get_dpo_vector(q_degree),
+ 1,
+ q_degree + 1,
+ FiniteElementData<dim>::H1),
+ get_riaf_vector(q_degree))
+ , n_bubbles((q_degree <= 1) ? 1 : dim)
{
Assert(q_degree > 0,
ExcMessage("This element can only be used for polynomial degrees "
this->reinit_restriction_and_prolongation_matrices();
if (dim == spacedim)
{
- internal::FE_Q_Bubbles::compute_embedding_matrices(
- *this, this->prolongation, false);
+ internal::FE_Q_Bubbles::compute_embedding_matrices(*this,
+ this->prolongation,
+ false);
// Fill restriction matrices with L2-projection
FETools::compute_projection_matrices(*this, this->restriction);
}
template <int dim, int spacedim>
-FE_Q_Bubbles<dim, spacedim>::FE_Q_Bubbles(const Quadrature<1> &points) :
- FE_Q_Base<TensorProductPolynomialsBubbles<dim>, dim, spacedim>(
- TensorProductPolynomialsBubbles<dim>(
- Polynomials::generate_complete_Lagrange_basis(points.get_points())),
- FiniteElementData<dim>(get_dpo_vector(points.size() - 1),
- 1,
- points.size(),
- FiniteElementData<dim>::H1),
- get_riaf_vector(points.size() - 1)),
- n_bubbles((points.size() - 1 <= 1) ? 1 : dim)
+FE_Q_Bubbles<dim, spacedim>::FE_Q_Bubbles(const Quadrature<1> &points)
+ : FE_Q_Base<TensorProductPolynomialsBubbles<dim>, dim, spacedim>(
+ TensorProductPolynomialsBubbles<dim>(
+ Polynomials::generate_complete_Lagrange_basis(points.get_points())),
+ FiniteElementData<dim>(get_dpo_vector(points.size() - 1),
+ 1,
+ points.size(),
+ FiniteElementData<dim>::H1),
+ get_riaf_vector(points.size() - 1))
+ , n_bubbles((points.size() - 1 <= 1) ? 1 : dim)
{
Assert(points.size() > 1,
ExcMessage("This element can only be used for polynomial degrees "
this->reinit_restriction_and_prolongation_matrices();
if (dim == spacedim)
{
- internal::FE_Q_Bubbles::compute_embedding_matrices(
- *this, this->prolongation, false);
+ internal::FE_Q_Bubbles::compute_embedding_matrices(*this,
+ this->prolongation,
+ false);
// Fill restriction matrices with L2-projection
FETools::compute_projection_matrices(*this, this->restriction);
}
}
}
// Do not consider the discontinuous node for dimension 1
- Assert(
- index == n_points || (dim == 1 && index == n_points + n_bubbles),
- ExcMessage("Could not decode support points in one coordinate direction."));
+ Assert(index == n_points || (dim == 1 && index == n_points + n_bubbles),
+ ExcMessage(
+ "Could not decode support points in one coordinate direction."));
// Check whether the support points are equidistant.
for (unsigned int j = 0; j < n_points; j++)
this->unit_support_points.size()));
Assert(nodal_values.size() == this->dofs_per_cell,
ExcDimensionMismatch(nodal_values.size(), this->dofs_per_cell));
- Assert(
- support_point_values[0].size() == this->n_components(),
- ExcDimensionMismatch(support_point_values[0].size(), this->n_components()));
+ Assert(support_point_values[0].size() == this->n_components(),
+ ExcDimensionMismatch(support_point_values[0].size(),
+ this->n_components()));
for (unsigned int i = 0; i < this->dofs_per_cell - 1; ++i)
{
(typename FiniteElement<dim, spacedim>::ExcInterpolationNotImplemented()));
Assert(interpolation_matrix.m() == this->dofs_per_cell,
ExcDimensionMismatch(interpolation_matrix.m(), this->dofs_per_cell));
- Assert(
- interpolation_matrix.n() == x_source_fe.dofs_per_cell,
- ExcDimensionMismatch(interpolation_matrix.m(), x_source_fe.dofs_per_cell));
+ Assert(interpolation_matrix.n() == x_source_fe.dofs_per_cell,
+ ExcDimensionMismatch(interpolation_matrix.m(),
+ x_source_fe.dofs_per_cell));
// Provide a short cut in case we are just inquiring the identity
auto casted_fe = dynamic_cast<const FEQBUBBLES *>(&x_source_fe);
const RefinementCase<dim> &refinement_case) const
{
Assert(refinement_case < RefinementCase<dim>::isotropic_refinement + 1,
- ExcIndexRange(
- refinement_case, 0, RefinementCase<dim>::isotropic_refinement + 1));
- Assert(
- refinement_case != RefinementCase<dim>::no_refinement,
- ExcMessage("Prolongation matrices are only available for refined cells!"));
- Assert(
- child < GeometryInfo<dim>::n_children(refinement_case),
- ExcIndexRange(child, 0, GeometryInfo<dim>::n_children(refinement_case)));
+ ExcIndexRange(refinement_case,
+ 0,
+ RefinementCase<dim>::isotropic_refinement + 1));
+ Assert(refinement_case != RefinementCase<dim>::no_refinement,
+ ExcMessage(
+ "Prolongation matrices are only available for refined cells!"));
+ Assert(child < GeometryInfo<dim>::n_children(refinement_case),
+ ExcIndexRange(child,
+ 0,
+ GeometryInfo<dim>::n_children(refinement_case)));
Assert(this->prolongation[refinement_case - 1][child].n() != 0,
ExcMessage("This prolongation matrix has not been computed yet!"));
const RefinementCase<dim> &refinement_case) const
{
Assert(refinement_case < RefinementCase<dim>::isotropic_refinement + 1,
- ExcIndexRange(
- refinement_case, 0, RefinementCase<dim>::isotropic_refinement + 1));
- Assert(
- refinement_case != RefinementCase<dim>::no_refinement,
- ExcMessage("Restriction matrices are only available for refined cells!"));
- Assert(
- child < GeometryInfo<dim>::n_children(refinement_case),
- ExcIndexRange(child, 0, GeometryInfo<dim>::n_children(refinement_case)));
+ ExcIndexRange(refinement_case,
+ 0,
+ RefinementCase<dim>::isotropic_refinement + 1));
+ Assert(refinement_case != RefinementCase<dim>::no_refinement,
+ ExcMessage(
+ "Restriction matrices are only available for refined cells!"));
+ Assert(child < GeometryInfo<dim>::n_children(refinement_case),
+ ExcIndexRange(child,
+ 0,
+ GeometryInfo<dim>::n_children(refinement_case)));
Assert(this->restriction[refinement_case - 1][child].n() != 0,
ExcMessage("This restriction matrix has not been computed yet!"));
template <int dim, int spacedim>
-FE_Q_DG0<dim, spacedim>::FE_Q_DG0(const unsigned int degree) :
- FE_Q_Base<TensorProductPolynomialsConst<dim>, dim, spacedim>(
- TensorProductPolynomialsConst<dim>(
- Polynomials::generate_complete_Lagrange_basis(
- QGaussLobatto<1>(degree + 1).get_points())),
- FiniteElementData<dim>(get_dpo_vector(degree),
- 1,
- degree,
- FiniteElementData<dim>::L2),
- get_riaf_vector(degree))
+FE_Q_DG0<dim, spacedim>::FE_Q_DG0(const unsigned int degree)
+ : FE_Q_Base<TensorProductPolynomialsConst<dim>, dim, spacedim>(
+ TensorProductPolynomialsConst<dim>(
+ Polynomials::generate_complete_Lagrange_basis(
+ QGaussLobatto<1>(degree + 1).get_points())),
+ FiniteElementData<dim>(get_dpo_vector(degree),
+ 1,
+ degree,
+ FiniteElementData<dim>::L2),
+ get_riaf_vector(degree))
{
Assert(degree > 0,
ExcMessage("This element can only be used for polynomial degrees "
template <int dim, int spacedim>
-FE_Q_DG0<dim, spacedim>::FE_Q_DG0(const Quadrature<1> &points) :
- FE_Q_Base<TensorProductPolynomialsConst<dim>, dim, spacedim>(
- TensorProductPolynomialsConst<dim>(
- Polynomials::generate_complete_Lagrange_basis(points.get_points())),
- FiniteElementData<dim>(get_dpo_vector(points.size() - 1),
- 1,
- points.size() - 1,
- FiniteElementData<dim>::L2),
- get_riaf_vector(points.size() - 1))
+FE_Q_DG0<dim, spacedim>::FE_Q_DG0(const Quadrature<1> &points)
+ : FE_Q_Base<TensorProductPolynomialsConst<dim>, dim, spacedim>(
+ TensorProductPolynomialsConst<dim>(
+ Polynomials::generate_complete_Lagrange_basis(points.get_points())),
+ FiniteElementData<dim>(get_dpo_vector(points.size() - 1),
+ 1,
+ points.size() - 1,
+ FiniteElementData<dim>::L2),
+ get_riaf_vector(points.size() - 1))
{
const int degree = points.size() - 1;
(void)degree;
}
}
// Do not consider the discontinuous node for dimension 1
- Assert(
- index == n_points || (dim == 1 && index == n_points + 1),
- ExcMessage("Could not decode support points in one coordinate direction."));
+ Assert(index == n_points || (dim == 1 && index == n_points + 1),
+ ExcMessage(
+ "Could not decode support points in one coordinate direction."));
// Check whether the support points are equidistant.
for (unsigned int j = 0; j < n_points; j++)
this->unit_support_points.size()));
Assert(nodal_dofs.size() == this->dofs_per_cell,
ExcDimensionMismatch(nodal_dofs.size(), this->dofs_per_cell));
- Assert(
- support_point_values[0].size() == this->n_components(),
- ExcDimensionMismatch(support_point_values[0].size(), this->n_components()));
+ Assert(support_point_values[0].size() == this->n_components(),
+ ExcDimensionMismatch(support_point_values[0].size(),
+ this->n_components()));
for (unsigned int i = 0; i < this->dofs_per_cell - 1; ++i)
{
Assert(interpolation_matrix.m() == this->dofs_per_cell,
ExcDimensionMismatch(interpolation_matrix.m(), this->dofs_per_cell));
- Assert(
- interpolation_matrix.n() == x_source_fe.dofs_per_cell,
- ExcDimensionMismatch(interpolation_matrix.m(), x_source_fe.dofs_per_cell));
+ Assert(interpolation_matrix.n() == x_source_fe.dofs_per_cell,
+ ExcDimensionMismatch(interpolation_matrix.m(),
+ x_source_fe.dofs_per_cell));
this->FE_Q_Base<TensorProductPolynomialsConst<dim>, dim, spacedim>::
get_interpolation_matrix(x_source_fe, interpolation_matrix);
template <int dim>
-FE_Q_Hierarchical<dim>::FE_Q_Hierarchical(const unsigned int degree) :
- FE_Poly<TensorProductPolynomials<dim>, dim>(
- Polynomials::Hierarchical::generate_complete_basis(degree),
- FiniteElementData<dim>(get_dpo_vector(degree),
- 1,
- degree,
- FiniteElementData<dim>::H1),
- std::vector<bool>(
- FiniteElementData<dim>(get_dpo_vector(degree), 1, degree).dofs_per_cell,
- false),
- std::vector<ComponentMask>(
- FiniteElementData<dim>(get_dpo_vector(degree), 1, degree).dofs_per_cell,
- std::vector<bool>(1, true))),
- face_renumber(face_fe_q_hierarchical_to_hierarchic_numbering(degree))
+FE_Q_Hierarchical<dim>::FE_Q_Hierarchical(const unsigned int degree)
+ : FE_Poly<TensorProductPolynomials<dim>, dim>(
+ Polynomials::Hierarchical::generate_complete_basis(degree),
+ FiniteElementData<dim>(get_dpo_vector(degree),
+ 1,
+ degree,
+ FiniteElementData<dim>::H1),
+ std::vector<bool>(
+ FiniteElementData<dim>(get_dpo_vector(degree), 1, degree).dofs_per_cell,
+ false),
+ std::vector<ComponentMask>(
+ FiniteElementData<dim>(get_dpo_vector(degree), 1, degree).dofs_per_cell,
+ std::vector<bool>(1, true)))
+ , face_renumber(face_fe_q_hierarchical_to_hierarchic_numbering(degree))
{
this->poly_space.set_numbering(
hierarchic_to_fe_q_hierarchical_numbering(*this));
ExcMessage(
"Prolongation matrices are only available for isotropic refinement!"));
- Assert(
- child < GeometryInfo<dim>::n_children(refinement_case),
- ExcIndexRange(child, 0, GeometryInfo<dim>::n_children(refinement_case)));
+ Assert(child < GeometryInfo<dim>::n_children(refinement_case),
+ ExcIndexRange(child,
+ 0,
+ GeometryInfo<dim>::n_children(refinement_case)));
return this->prolongation[refinement_case - 1][child];
}
dofs_subcell[0](2 + j, i % dofs_1d) *
dofs_subcell[0](2 + k, (i - (i % dofs_1d)) / dofs_1d);
// subcell 1
- this->interface_constraints(
- 5 + 12 * (this->degree - 1) + j + k * (this->degree - 1) +
- (this->degree - 1) * (this->degree - 1),
- face_renumber[i]) =
+ this->interface_constraints(5 + 12 * (this->degree - 1) +
+ j + k * (this->degree - 1) +
+ (this->degree - 1) *
+ (this->degree - 1),
+ face_renumber[i]) =
dofs_subcell[1](2 + j, i % dofs_1d) *
dofs_subcell[0](2 + k, (i - (i % dofs_1d)) / dofs_1d);
// subcell 2
- this->interface_constraints(
- 5 + 12 * (this->degree - 1) + j + k * (this->degree - 1) +
- 2 * (this->degree - 1) * (this->degree - 1),
- face_renumber[i]) =
+ this->interface_constraints(5 + 12 * (this->degree - 1) +
+ j + k * (this->degree - 1) +
+ 2 * (this->degree - 1) *
+ (this->degree - 1),
+ face_renumber[i]) =
dofs_subcell[0](2 + j, i % dofs_1d) *
dofs_subcell[1](2 + k, (i - (i % dofs_1d)) / dofs_1d);
// subcell 3
- this->interface_constraints(
- 5 + 12 * (this->degree - 1) + j + k * (this->degree - 1) +
- 3 * (this->degree - 1) * (this->degree - 1),
- face_renumber[i]) =
+ this->interface_constraints(5 + 12 * (this->degree - 1) +
+ j + k * (this->degree - 1) +
+ 3 * (this->degree - 1) *
+ (this->degree - 1),
+ face_renumber[i]) =
dofs_subcell[1](2 + j, i % dofs_1d) *
dofs_subcell[1](2 + k, (i - (i % dofs_1d)) / dofs_1d);
}
this->prolongation[iso][c](j, i) =
dofs_subcell[c0](renumber[j] % dofs_1d,
renumber[i] % dofs_1d) *
- dofs_subcell[c1](
- (renumber[j] - (renumber[j] % dofs_1d)) / dofs_1d,
- (renumber[i] - (renumber[i] % dofs_1d)) / dofs_1d);
+ dofs_subcell[c1]((renumber[j] - (renumber[j] % dofs_1d)) /
+ dofs_1d,
+ (renumber[i] - (renumber[i] % dofs_1d)) /
+ dofs_1d);
this->restriction[iso][c](j, i) =
dofs_cell[c0](renumber[j] % dofs_1d,
renumber[i] % dofs_1d) *
- dofs_cell[c1](
- (renumber[j] - (renumber[j] % dofs_1d)) / dofs_1d,
- (renumber[i] - (renumber[i] % dofs_1d)) / dofs_1d);
+ dofs_cell[c1]((renumber[j] - (renumber[j] % dofs_1d)) /
+ dofs_1d,
+ (renumber[i] - (renumber[i] % dofs_1d)) /
+ dofs_1d);
}
break;
}
// source FE is also a
// Q_Hierarchical element
typedef FE_Q_Hierarchical<dim> FEQHierarchical;
- AssertThrow(
- (x_source_fe.get_name().find("FE_Q_Hierarchical<") == 0) ||
- (dynamic_cast<const FEQHierarchical *>(&x_source_fe) != nullptr),
- (typename FiniteElement<dim>::ExcInterpolationNotImplemented()));
+ AssertThrow((x_source_fe.get_name().find("FE_Q_Hierarchical<") == 0) ||
+ (dynamic_cast<const FEQHierarchical *>(&x_source_fe) !=
+ nullptr),
+ (typename FiniteElement<dim>::ExcInterpolationNotImplemented()));
Assert(interpolation_matrix.n() == this->dofs_per_face,
ExcDimensionMismatch(interpolation_matrix.n(), this->dofs_per_face));
- Assert(
- interpolation_matrix.m() == x_source_fe.dofs_per_face,
- ExcDimensionMismatch(interpolation_matrix.m(), x_source_fe.dofs_per_face));
+ Assert(interpolation_matrix.m() == x_source_fe.dofs_per_face,
+ ExcDimensionMismatch(interpolation_matrix.m(),
+ x_source_fe.dofs_per_face));
// ok, source is a Q_Hierarchical element, so
// we will be able to do the work
GeometryInfo<3>::vertices_per_face) = 1;
for (unsigned int j = 0; j < this->degree - 1; ++j)
- interpolation_matrix(
- (i + GeometryInfo<3>::lines_per_face) *
- (x_source_fe.degree - 1) +
- j + GeometryInfo<3>::vertices_per_face,
- (i + GeometryInfo<3>::lines_per_face) * (this->degree - 1) +
- j + GeometryInfo<3>::vertices_per_face) = 1;
+ interpolation_matrix((i + GeometryInfo<3>::lines_per_face) *
+ (x_source_fe.degree - 1) +
+ j + GeometryInfo<3>::vertices_per_face,
+ (i + GeometryInfo<3>::lines_per_face) *
+ (this->degree - 1) +
+ j + GeometryInfo<3>::vertices_per_face) =
+ 1;
}
}
}
// source FE is also a
// Q_Hierarchical element
typedef FE_Q_Hierarchical<dim> FEQHierarchical;
- AssertThrow(
- (x_source_fe.get_name().find("FE_Q_Hierarchical<") == 0) ||
- (dynamic_cast<const FEQHierarchical *>(&x_source_fe) != nullptr),
- (typename FiniteElement<dim>::ExcInterpolationNotImplemented()));
+ AssertThrow((x_source_fe.get_name().find("FE_Q_Hierarchical<") == 0) ||
+ (dynamic_cast<const FEQHierarchical *>(&x_source_fe) !=
+ nullptr),
+ (typename FiniteElement<dim>::ExcInterpolationNotImplemented()));
Assert(interpolation_matrix.n() == this->dofs_per_face,
ExcDimensionMismatch(interpolation_matrix.n(), this->dofs_per_face));
- Assert(
- interpolation_matrix.m() == x_source_fe.dofs_per_face,
- ExcDimensionMismatch(interpolation_matrix.m(), x_source_fe.dofs_per_face));
+ Assert(interpolation_matrix.m() == x_source_fe.dofs_per_face,
+ ExcDimensionMismatch(interpolation_matrix.m(),
+ x_source_fe.dofs_per_face));
// ok, source is a Q_Hierarchical element, so
// we will be able to do the work
for (unsigned int line = 0;
line < GeometryInfo<3>::lines_per_face;
++line)
- interpolation_matrix(
- 3, i + line * (this->degree - 1) + 4) = -0.5;
+ interpolation_matrix(3,
+ i + line * (this->degree - 1) +
+ 4) = -0.5;
for (unsigned int j = 0; j < this->degree - 1;)
{
- interpolation_matrix(
- 3, i + (j + 4) * this->degree - j) = 1.0;
- j = j + 2;
+ interpolation_matrix(3,
+ i + (j + 4) * this->degree - j) =
+ 1.0;
+ j = j + 2;
}
interpolation_matrix(1, i + 2 * (this->degree + 1)) =
for (unsigned int line = 0;
line < GeometryInfo<3>::lines_per_face;
++line)
- interpolation_matrix(
- 2, i + line * (this->degree - 1) + 4) = -0.5;
+ interpolation_matrix(2,
+ i + line * (this->degree - 1) +
+ 4) = -0.5;
for (unsigned int j = 0; j < this->degree - 1;)
{
- interpolation_matrix(
- 2, i + (j + 4) * this->degree - j) = 1.0;
- j = j + 2;
+ interpolation_matrix(2,
+ i + (j + 4) * this->degree - j) =
+ 1.0;
+ j = j + 2;
}
interpolation_matrix(0, i + 2 * (this->degree + 1)) =
for (unsigned int j = 0; j < this->degree - 1;)
{
- interpolation_matrix(
- i + 2, j + (i + 2) * this->degree + 2 - i) = tmp;
+ interpolation_matrix(i + 2,
+ j + (i + 2) * this->degree + 2 -
+ i) = tmp;
interpolation_matrix(i + 3 * source_fe.degree - 1,
i + (j + 4) * this->degree - j -
- 2) = tmp;
- j = j + 2;
+ 2) = tmp;
+ j = j + 2;
}
tmp *= -1.0;
for (unsigned int k = 0; k < this->degree - 1;)
{
- interpolation_matrix(
- i + 2, k + (j + 2) * this->degree + 2 - j) =
- tmp;
- k = k + 2;
+ interpolation_matrix(i + 2,
+ k + (j + 2) * this->degree +
+ 2 - j) = tmp;
+ k = k + 2;
}
}
for (unsigned int line = 0;
line < GeometryInfo<3>::lines_per_face;
++line)
- interpolation_matrix(
- 1, i + line * (this->degree - 1) + 4) = -0.5;
+ interpolation_matrix(1,
+ i + line * (this->degree - 1) +
+ 4) = -0.5;
for (unsigned int j = 0; j < this->degree - 1;)
{
- interpolation_matrix(
- 1, i + (j + 4) * this->degree - j) = 1.0;
- j = j + 2;
+ interpolation_matrix(1,
+ i + (j + 4) * this->degree - j) =
+ 1.0;
+ j = j + 2;
}
interpolation_matrix(0, i + 4) = -1.0;
for (unsigned int line = 0;
line < GeometryInfo<3>::lines_per_face;
++line)
- interpolation_matrix(
- 0, i + line * (this->degree - 1) + 4) = -0.5;
+ interpolation_matrix(0,
+ i + line * (this->degree - 1) +
+ 4) = -0.5;
for (unsigned int j = 0; j < this->degree - 1;)
{
- interpolation_matrix(
- 0, i + (j + 4) * this->degree - j) = 1.0;
- j = j + 2;
+ interpolation_matrix(0,
+ i + (j + 4) * this->degree - j) =
+ 1.0;
+ j = j + 2;
}
interpolation_matrix(1, i + 4) = -1.0;
for (unsigned int j = 0; j < this->degree - 1;)
{
- interpolation_matrix(
- i + 2, j + (i + 2) * this->degree + 2 - i) = tmp;
+ interpolation_matrix(i + 2,
+ j + (i + 2) * this->degree + 2 -
+ i) = tmp;
interpolation_matrix(i + 2 * source_fe.degree,
i + (j + 4) * this->degree - 2) =
tmp;
for (unsigned int k = 0; k < this->degree - 1;)
{
- interpolation_matrix(
- i + 2, k + (j + 2) * this->degree + 2 - j) =
- tmp;
+ interpolation_matrix(i + 2,
+ k + (j + 2) * this->degree +
+ 2 - j) = tmp;
interpolation_matrix(i + 2 * source_fe.degree,
j + (k + 4) * this->degree -
- 2) = tmp;
- k = k + 2;
+ 2) = tmp;
+ k = k + 2;
}
}
}
template <int dim, int spacedim>
-FE_Q_iso_Q1<dim, spacedim>::FE_Q_iso_Q1(const unsigned int subdivisions) :
- FE_Q_Base<
- TensorProductPolynomials<dim, Polynomials::PiecewisePolynomial<double>>,
- dim,
- spacedim>(
- TensorProductPolynomials<dim, Polynomials::PiecewisePolynomial<double>>(
- Polynomials::generate_complete_Lagrange_basis_on_subdivisions(
- subdivisions,
- 1)),
- FiniteElementData<dim>(this->get_dpo_vector(subdivisions),
- 1,
- subdivisions,
- FiniteElementData<dim>::H1),
- std::vector<bool>(1, false))
+FE_Q_iso_Q1<dim, spacedim>::FE_Q_iso_Q1(const unsigned int subdivisions)
+ : FE_Q_Base<
+ TensorProductPolynomials<dim, Polynomials::PiecewisePolynomial<double>>,
+ dim,
+ spacedim>(
+ TensorProductPolynomials<dim, Polynomials::PiecewisePolynomial<double>>(
+ Polynomials::generate_complete_Lagrange_basis_on_subdivisions(
+ subdivisions,
+ 1)),
+ FiniteElementData<dim>(this->get_dpo_vector(subdivisions),
+ 1,
+ subdivisions,
+ FiniteElementData<dim>::H1),
+ std::vector<bool>(1, false))
{
Assert(subdivisions > 0,
ExcMessage("This element can only be used with a positive number of "
template <int dim>
FE_RannacherTurek<dim>::FE_RannacherTurek(
const unsigned int order,
- const unsigned int n_face_support_points) :
- FE_Poly<PolynomialsRannacherTurek<dim>, dim>(
- PolynomialsRannacherTurek<dim>(),
- FiniteElementData<dim>(this->get_dpo_vector(),
- 1,
- 2,
- FiniteElementData<dim>::L2),
- std::vector<bool>(4, false), // restriction not implemented
- std::vector<ComponentMask>(4, std::vector<bool>(1, true))),
- order(order),
- n_face_support_points(n_face_support_points)
+ const unsigned int n_face_support_points)
+ : FE_Poly<PolynomialsRannacherTurek<dim>, dim>(
+ PolynomialsRannacherTurek<dim>(),
+ FiniteElementData<dim>(this->get_dpo_vector(),
+ 1,
+ 2,
+ FiniteElementData<dim>::L2),
+ std::vector<bool>(4, false), // restriction not implemented
+ std::vector<ComponentMask>(4, std::vector<bool>(1, true)))
+ , order(order)
+ , n_face_support_points(n_face_support_points)
{
Assert(dim == 2, ExcNotImplemented());
Assert(order == 0, ExcNotImplemented());
template <int dim>
-FE_RaviartThomas<dim>::FE_RaviartThomas(const unsigned int deg) :
- FE_PolyTensor<PolynomialsRaviartThomas<dim>, dim>(
- deg,
- FiniteElementData<dim>(get_dpo_vector(deg),
- dim,
- deg + 1,
- FiniteElementData<dim>::Hdiv),
- std::vector<bool>(PolynomialsRaviartThomas<dim>::compute_n_pols(deg), true),
- std::vector<ComponentMask>(
- PolynomialsRaviartThomas<dim>::compute_n_pols(deg),
- std::vector<bool>(dim, true)))
+FE_RaviartThomas<dim>::FE_RaviartThomas(const unsigned int deg)
+ : FE_PolyTensor<PolynomialsRaviartThomas<dim>, dim>(
+ deg,
+ FiniteElementData<dim>(get_dpo_vector(deg),
+ dim,
+ deg + 1,
+ FiniteElementData<dim>::Hdiv),
+ std::vector<bool>(PolynomialsRaviartThomas<dim>::compute_n_pols(deg),
+ true),
+ std::vector<ComponentMask>(PolynomialsRaviartThomas<dim>::compute_n_pols(
+ deg),
+ std::vector<bool>(dim, true)))
{
Assert(dim >= 2, ExcImpossibleInDim(dim));
const unsigned int n_dofs = this->dofs_per_cell;
FullMatrix<double> face_embeddings[GeometryInfo<dim>::max_children_per_face];
for (unsigned int i = 0; i < GeometryInfo<dim>::max_children_per_face; ++i)
face_embeddings[i].reinit(this->dofs_per_face, this->dofs_per_face);
- FETools::compute_face_embedding_matrices<dim, double>(
- *this, face_embeddings, 0, 0);
+ FETools::compute_face_embedding_matrices<dim, double>(*this,
+ face_embeddings,
+ 0,
+ 0);
this->interface_constraints.reinit((1 << (dim - 1)) * this->dofs_per_face,
this->dofs_per_face);
unsigned int target_row = 0;
// subcell are NOT
// transformed, so we
// have to do it here.
- this->restriction[iso][child](
- face * this->dofs_per_face + i_face, i_child) +=
+ this->restriction[iso][child](face * this->dofs_per_face +
+ i_face,
+ i_child) +=
Utilities::fixed_power<dim - 1>(.5) * q_sub.weight(k) *
cached_values_on_face(i_child, k) *
this->shape_value_component(
// Store shape values, since the
// evaluation suffers if not
// ordered by point
- Table<3, double> cached_values_on_cell(
- this->dofs_per_cell, q_cell.size(), dim);
+ Table<3, double> cached_values_on_cell(this->dofs_per_cell,
+ q_cell.size(),
+ dim);
for (unsigned int k = 0; k < q_cell.size(); ++k)
for (unsigned int i = 0; i < this->dofs_per_cell; ++i)
for (unsigned int d = 0; d < dim; ++d)
for (unsigned int i_weight = 0; i_weight < polynomials[d]->n();
++i_weight)
{
- this->restriction[iso][child](
- start_cell_dofs + i_weight * dim + d, i_child) +=
+ this->restriction[iso][child](start_cell_dofs + i_weight * dim +
+ d,
+ i_child) +=
q_sub.weight(k) * cached_values_on_cell(i_child, k, d) *
polynomials[d]->compute_value(i_weight, q_sub.point(k));
}
this->generalized_support_points.size()));
Assert(nodal_values.size() == this->dofs_per_cell,
ExcDimensionMismatch(nodal_values.size(), this->dofs_per_cell));
- Assert(
- support_point_values[0].size() == this->n_components(),
- ExcDimensionMismatch(support_point_values[0].size(), this->n_components()));
+ Assert(support_point_values[0].size() == this->n_components(),
+ ExcDimensionMismatch(support_point_values[0].size(),
+ this->n_components()));
std::fill(nodal_values.begin(), nodal_values.end(), 0.);
template <int dim>
-FE_RaviartThomasNodal<dim>::FE_RaviartThomasNodal(const unsigned int deg) :
- FE_PolyTensor<PolynomialsRaviartThomas<dim>, dim>(
- deg,
- FiniteElementData<dim>(get_dpo_vector(deg),
- dim,
- deg + 1,
- FiniteElementData<dim>::Hdiv),
- get_ria_vector(deg),
- std::vector<ComponentMask>(
- PolynomialsRaviartThomas<dim>::compute_n_pols(deg),
- std::vector<bool>(dim, true)))
+FE_RaviartThomasNodal<dim>::FE_RaviartThomasNodal(const unsigned int deg)
+ : FE_PolyTensor<PolynomialsRaviartThomas<dim>, dim>(
+ deg,
+ FiniteElementData<dim>(get_dpo_vector(deg),
+ dim,
+ deg + 1,
+ FiniteElementData<dim>::Hdiv),
+ get_ria_vector(deg),
+ std::vector<ComponentMask>(PolynomialsRaviartThomas<dim>::compute_n_pols(
+ deg),
+ std::vector<bool>(dim, true)))
{
Assert(dim >= 2, ExcImpossibleInDim(dim));
const unsigned int n_dofs = this->dofs_per_cell;
FullMatrix<double> face_embeddings[GeometryInfo<dim>::max_children_per_face];
for (unsigned int i = 0; i < GeometryInfo<dim>::max_children_per_face; ++i)
face_embeddings[i].reinit(this->dofs_per_face, this->dofs_per_face);
- FETools::compute_face_embedding_matrices<dim, double>(
- *this, face_embeddings, 0, 0);
+ FETools::compute_face_embedding_matrices<dim, double>(*this,
+ face_embeddings,
+ 0,
+ 0);
this->interface_constraints.reinit((1 << (dim - 1)) * this->dofs_per_face,
this->dofs_per_face);
unsigned int target_row = 0;
((d == 0) ? low : high), ((d == 1) ? low : high));
break;
case 3:
- quadrature = std_cxx14::make_unique<QAnisotropic<dim>>(
- ((d == 0) ? low : high),
- ((d == 1) ? low : high),
- ((d == 2) ? low : high));
+ quadrature =
+ std_cxx14::make_unique<QAnisotropic<dim>>(((d == 0) ? low : high),
+ ((d == 1) ? low : high),
+ ((d == 2) ? low :
+ high));
break;
default:
Assert(false, ExcNotImplemented());
this->generalized_support_points.size()));
Assert(nodal_values.size() == this->dofs_per_cell,
ExcDimensionMismatch(nodal_values.size(), this->dofs_per_cell));
- Assert(
- support_point_values[0].size() == this->n_components(),
- ExcDimensionMismatch(support_point_values[0].size(), this->n_components()));
+ Assert(support_point_values[0].size() == this->n_components(),
+ ExcDimensionMismatch(support_point_values[0].size(),
+ this->n_components()));
// First do interpolation on
// faces. There, the component
Assert(interpolation_matrix.n() == this->dofs_per_face,
ExcDimensionMismatch(interpolation_matrix.n(), this->dofs_per_face));
- Assert(
- interpolation_matrix.m() == x_source_fe.dofs_per_face,
- ExcDimensionMismatch(interpolation_matrix.m(), x_source_fe.dofs_per_face));
+ Assert(interpolation_matrix.m() == x_source_fe.dofs_per_face,
+ ExcDimensionMismatch(interpolation_matrix.m(),
+ x_source_fe.dofs_per_face));
// ok, source is a RaviartThomasNodal element, so
// we will be able to do the work
Assert(interpolation_matrix.n() == this->dofs_per_face,
ExcDimensionMismatch(interpolation_matrix.n(), this->dofs_per_face));
- Assert(
- interpolation_matrix.m() == x_source_fe.dofs_per_face,
- ExcDimensionMismatch(interpolation_matrix.m(), x_source_fe.dofs_per_face));
+ Assert(interpolation_matrix.m() == x_source_fe.dofs_per_face,
+ ExcDimensionMismatch(interpolation_matrix.m(),
+ x_source_fe.dofs_per_face));
// ok, source is a RaviartThomasNodal element, so
// we will be able to do the work
template <int dim>
-FE_RT_Bubbles<dim>::FE_RT_Bubbles(const unsigned int deg) :
- FE_PolyTensor<PolynomialsRT_Bubbles<dim>, dim>(
- deg,
- FiniteElementData<dim>(get_dpo_vector(deg),
- dim,
- deg + 1,
- FiniteElementData<dim>::Hdiv),
- get_ria_vector(deg),
- std::vector<ComponentMask>(PolynomialsRT_Bubbles<dim>::compute_n_pols(deg),
- std::vector<bool>(dim, true)))
+FE_RT_Bubbles<dim>::FE_RT_Bubbles(const unsigned int deg)
+ : FE_PolyTensor<PolynomialsRT_Bubbles<dim>, dim>(
+ deg,
+ FiniteElementData<dim>(get_dpo_vector(deg),
+ dim,
+ deg + 1,
+ FiniteElementData<dim>::Hdiv),
+ get_ria_vector(deg),
+ std::vector<ComponentMask>(PolynomialsRT_Bubbles<dim>::compute_n_pols(
+ deg),
+ std::vector<bool>(dim, true)))
{
Assert(dim >= 2, ExcImpossibleInDim(dim));
Assert(
FullMatrix<double> face_embeddings[GeometryInfo<dim>::max_children_per_face];
for (unsigned int i = 0; i < GeometryInfo<dim>::max_children_per_face; ++i)
face_embeddings[i].reinit(this->dofs_per_face, this->dofs_per_face);
- FETools::compute_face_embedding_matrices<dim, double>(
- *this, face_embeddings, 0, 0);
+ FETools::compute_face_embedding_matrices<dim, double>(*this,
+ face_embeddings,
+ 0,
+ 0);
this->interface_constraints.reinit((1 << (dim - 1)) * this->dofs_per_face,
this->dofs_per_face);
unsigned int target_row = 0;
((d == 0) ? low : high), ((d == 1) ? low : high));
break;
case 3:
- quadrature = std_cxx14::make_unique<QAnisotropic<dim>>(
- ((d == 0) ? low : high),
- ((d == 1) ? low : high),
- ((d == 2) ? low : high));
+ quadrature =
+ std_cxx14::make_unique<QAnisotropic<dim>>(((d == 0) ? low : high),
+ ((d == 1) ? low : high),
+ ((d == 2) ? low :
+ high));
break;
default:
Assert(false, ExcNotImplemented());
this->generalized_support_points.size()));
Assert(nodal_values.size() == this->dofs_per_cell,
ExcDimensionMismatch(nodal_values.size(), this->dofs_per_cell));
- Assert(
- support_point_values[0].size() == this->n_components(),
- ExcDimensionMismatch(support_point_values[0].size(), this->n_components()));
+ Assert(support_point_values[0].size() == this->n_components(),
+ ExcDimensionMismatch(support_point_values[0].size(),
+ this->n_components()));
// First do interpolation on faces. There, the component
// evaluated depends on the face direction and orientation.
template <int dim>
Fourier<dim>::Fourier(const unsigned int N,
const hp::FECollection<dim> &fe_collection,
- const hp::QCollection<dim> & q_collection) :
- fe_collection(&fe_collection),
- q_collection(&q_collection),
- fourier_transform_matrices(fe_collection.size())
+ const hp::QCollection<dim> & q_collection)
+ : fe_collection(&fe_collection)
+ , q_collection(&q_collection)
+ , fourier_transform_matrices(fe_collection.size())
{
set_k_vectors(k_vectors, N);
unrolled_coefficients.resize(k_vectors.n_elements());
for (unsigned int k = 0; k < k_vectors.size(0); ++k)
for (unsigned int j = 0; j < (*fe_collection)[fe].dofs_per_cell; ++j)
- fourier_transform_matrices[fe](k, j) = integrate(
- (*fe_collection)[fe], (*q_collection)[fe], k_vectors(k), j);
+ fourier_transform_matrices[fe](k, j) = integrate((*fe_collection)[fe],
+ (*q_collection)[fe],
+ k_vectors(k),
+ j);
}
}
template <int dim>
Legendre<dim>::Legendre(const unsigned int size_in_each_direction,
const hp::FECollection<dim> &fe_collection,
- const hp::QCollection<dim> & q_collection) :
- N(size_in_each_direction),
- fe_collection(&fe_collection),
- q_collection(&q_collection),
- legendre_transform_matrices(fe_collection.size()),
- unrolled_coefficients(Utilities::fixed_power<dim>(N), 0.)
+ const hp::QCollection<dim> & q_collection)
+ : N(size_in_each_direction)
+ , fe_collection(&fe_collection)
+ , q_collection(&q_collection)
+ , legendre_transform_matrices(fe_collection.size())
+ , unrolled_coefficients(Utilities::fixed_power<dim>(N), 0.)
{}
template <int dim>
unsigned int
count_nonzeros(const std::vector<unsigned int> &vec)
{
- return std::count_if(
- vec.begin(), vec.end(), [](const unsigned int i) { return i > 0; });
+ return std::count_if(vec.begin(), vec.end(), [](const unsigned int i) {
+ return i > 0;
+ });
}
} // namespace
} // namespace FESystemImplementation
template <int dim, int spacedim>
FESystem<dim, spacedim>::InternalData::InternalData(
- const unsigned int n_base_elements) :
- base_fe_datas(n_base_elements),
- base_fe_output_objects(n_base_elements)
+ const unsigned int n_base_elements)
+ : base_fe_datas(n_base_elements)
+ , base_fe_output_objects(n_base_elements)
{}
template <int dim, int spacedim>
FESystem<dim, spacedim>::FESystem(const FiniteElement<dim, spacedim> &fe,
- const unsigned int n_elements) :
- FiniteElement<dim, spacedim>(
- FETools::Compositing::multiply_dof_numbers(&fe, n_elements),
- FETools::Compositing::compute_restriction_is_additive_flags(&fe,
- n_elements),
- FETools::Compositing::compute_nonzero_components(&fe, n_elements)),
- base_elements((n_elements > 0))
+ const unsigned int n_elements)
+ : FiniteElement<dim, spacedim>(
+ FETools::Compositing::multiply_dof_numbers(&fe, n_elements),
+ FETools::Compositing::compute_restriction_is_additive_flags(&fe,
+ n_elements),
+ FETools::Compositing::compute_nonzero_components(&fe, n_elements))
+ , base_elements((n_elements > 0))
{
std::vector<const FiniteElement<dim, spacedim> *> fes;
fes.push_back(&fe);
FESystem<dim, spacedim>::FESystem(const FiniteElement<dim, spacedim> &fe1,
const unsigned int n1,
const FiniteElement<dim, spacedim> &fe2,
- const unsigned int n2) :
- FiniteElement<dim, spacedim>(
- FETools::Compositing::multiply_dof_numbers(&fe1, n1, &fe2, n2),
- FETools::Compositing::compute_restriction_is_additive_flags(&fe1,
- n1,
- &fe2,
- n2),
- FETools::Compositing::compute_nonzero_components(&fe1, n1, &fe2, n2)),
- base_elements((n1 > 0) + (n2 > 0))
+ const unsigned int n2)
+ : FiniteElement<dim, spacedim>(
+ FETools::Compositing::multiply_dof_numbers(&fe1, n1, &fe2, n2),
+ FETools::Compositing::compute_restriction_is_additive_flags(&fe1,
+ n1,
+ &fe2,
+ n2),
+ FETools::Compositing::compute_nonzero_components(&fe1, n1, &fe2, n2))
+ , base_elements((n1 > 0) + (n2 > 0))
{
std::vector<const FiniteElement<dim, spacedim> *> fes;
fes.push_back(&fe1);
const FiniteElement<dim, spacedim> &fe2,
const unsigned int n2,
const FiniteElement<dim, spacedim> &fe3,
- const unsigned int n3) :
- FiniteElement<dim, spacedim>(
- FETools::Compositing::multiply_dof_numbers(&fe1, n1, &fe2, n2, &fe3, n3),
- FETools::Compositing::compute_restriction_is_additive_flags(&fe1,
- n1,
- &fe2,
- n2,
- &fe3,
- n3),
- FETools::Compositing::compute_nonzero_components(&fe1,
- n1,
- &fe2,
- n2,
- &fe3,
- n3)),
- base_elements((n1 > 0) + (n2 > 0) + (n3 > 0))
+ const unsigned int n3)
+ : FiniteElement<dim, spacedim>(
+ FETools::Compositing::multiply_dof_numbers(&fe1, n1, &fe2, n2, &fe3, n3),
+ FETools::Compositing::compute_restriction_is_additive_flags(&fe1,
+ n1,
+ &fe2,
+ n2,
+ &fe3,
+ n3),
+ FETools::Compositing::compute_nonzero_components(&fe1,
+ n1,
+ &fe2,
+ n2,
+ &fe3,
+ n3))
+ , base_elements((n1 > 0) + (n2 > 0) + (n3 > 0))
{
std::vector<const FiniteElement<dim, spacedim> *> fes;
fes.push_back(&fe1);
const FiniteElement<dim, spacedim> &fe3,
const unsigned int n3,
const FiniteElement<dim, spacedim> &fe4,
- const unsigned int n4) :
- FiniteElement<dim, spacedim>(
- FETools::Compositing::multiply_dof_numbers(&fe1,
- n1,
- &fe2,
- n2,
- &fe3,
- n3,
- &fe4,
- n4),
- FETools::Compositing::compute_restriction_is_additive_flags(&fe1,
- n1,
- &fe2,
- n2,
- &fe3,
- n3,
- &fe4,
- n4),
- FETools::Compositing::compute_nonzero_components(&fe1,
- n1,
- &fe2,
- n2,
- &fe3,
- n3,
- &fe4,
- n4)),
- base_elements((n1 > 0) + (n2 > 0) + (n3 > 0) + (n4 > 0))
+ const unsigned int n4)
+ : FiniteElement<dim, spacedim>(
+ FETools::Compositing::multiply_dof_numbers(&fe1,
+ n1,
+ &fe2,
+ n2,
+ &fe3,
+ n3,
+ &fe4,
+ n4),
+ FETools::Compositing::compute_restriction_is_additive_flags(&fe1,
+ n1,
+ &fe2,
+ n2,
+ &fe3,
+ n3,
+ &fe4,
+ n4),
+ FETools::Compositing::compute_nonzero_components(&fe1,
+ n1,
+ &fe2,
+ n2,
+ &fe3,
+ n3,
+ &fe4,
+ n4))
+ , base_elements((n1 > 0) + (n2 > 0) + (n3 > 0) + (n4 > 0))
{
std::vector<const FiniteElement<dim, spacedim> *> fes;
fes.push_back(&fe1);
const FiniteElement<dim, spacedim> &fe4,
const unsigned int n4,
const FiniteElement<dim, spacedim> &fe5,
- const unsigned int n5) :
- FiniteElement<dim, spacedim>(
- FETools::Compositing::
- multiply_dof_numbers(&fe1, n1, &fe2, n2, &fe3, n3, &fe4, n4, &fe5, n5),
- FETools::Compositing::compute_restriction_is_additive_flags(&fe1,
- n1,
- &fe2,
- n2,
- &fe3,
- n3,
- &fe4,
- n4,
- &fe5,
- n5),
- FETools::Compositing::compute_nonzero_components(&fe1,
- n1,
- &fe2,
- n2,
- &fe3,
- n3,
- &fe4,
- n4,
- &fe5,
- n5)),
- base_elements((n1 > 0) + (n2 > 0) + (n3 > 0) + (n4 > 0) + (n5 > 0))
+ const unsigned int n5)
+ : FiniteElement<dim, spacedim>(
+ FETools::Compositing::
+ multiply_dof_numbers(&fe1, n1, &fe2, n2, &fe3, n3, &fe4, n4, &fe5, n5),
+ FETools::Compositing::compute_restriction_is_additive_flags(&fe1,
+ n1,
+ &fe2,
+ n2,
+ &fe3,
+ n3,
+ &fe4,
+ n4,
+ &fe5,
+ n5),
+ FETools::Compositing::compute_nonzero_components(&fe1,
+ n1,
+ &fe2,
+ n2,
+ &fe3,
+ n3,
+ &fe4,
+ n4,
+ &fe5,
+ n5))
+ , base_elements((n1 > 0) + (n2 > 0) + (n3 > 0) + (n4 > 0) + (n5 > 0))
{
std::vector<const FiniteElement<dim, spacedim> *> fes;
fes.push_back(&fe1);
template <int dim, int spacedim>
FESystem<dim, spacedim>::FESystem(
const std::vector<const FiniteElement<dim, spacedim> *> &fes,
- const std::vector<unsigned int> & multiplicities) :
- FiniteElement<dim, spacedim>(
- FETools::Compositing::multiply_dof_numbers(fes, multiplicities),
- FETools::Compositing::compute_restriction_is_additive_flags(fes,
- multiplicities),
- FETools::Compositing::compute_nonzero_components(fes, multiplicities)),
- base_elements(
- internal::FESystemImplementation::count_nonzeros(multiplicities))
+ const std::vector<unsigned int> & multiplicities)
+ : FiniteElement<dim, spacedim>(
+ FETools::Compositing::multiply_dof_numbers(fes, multiplicities),
+ FETools::Compositing::compute_restriction_is_additive_flags(
+ fes,
+ multiplicities),
+ FETools::Compositing::compute_nonzero_components(fes, multiplicities))
+ , base_elements(
+ internal::FESystemImplementation::count_nonzeros(multiplicities))
{
initialize(fes, multiplicities);
}
const Point<dim> & p) const
{
Assert(i < this->dofs_per_cell, ExcIndexRange(i, 0, this->dofs_per_cell));
- Assert(
- this->is_primitive(i),
- (typename FiniteElement<dim, spacedim>::ExcShapeFunctionNotPrimitive(i)));
+ Assert(this->is_primitive(i),
+ (typename FiniteElement<dim, spacedim>::ExcShapeFunctionNotPrimitive(
+ i)));
return (base_element(this->system_to_base_table[i].first.first)
.shape_value(this->system_to_base_table[i].second, p));
const Point<dim> & p) const
{
Assert(i < this->dofs_per_cell, ExcIndexRange(i, 0, this->dofs_per_cell));
- Assert(
- this->is_primitive(i),
- (typename FiniteElement<dim, spacedim>::ExcShapeFunctionNotPrimitive(i)));
+ Assert(this->is_primitive(i),
+ (typename FiniteElement<dim, spacedim>::ExcShapeFunctionNotPrimitive(
+ i)));
return (base_element(this->system_to_base_table[i].first.first)
.shape_grad(this->system_to_base_table[i].second, p));
const Point<dim> & p) const
{
Assert(i < this->dofs_per_cell, ExcIndexRange(i, 0, this->dofs_per_cell));
- Assert(
- this->is_primitive(i),
- (typename FiniteElement<dim, spacedim>::ExcShapeFunctionNotPrimitive(i)));
+ Assert(this->is_primitive(i),
+ (typename FiniteElement<dim, spacedim>::ExcShapeFunctionNotPrimitive(
+ i)));
return (base_element(this->system_to_base_table[i].first.first)
.shape_grad_grad(this->system_to_base_table[i].second, p));
const Point<dim> & p) const
{
Assert(i < this->dofs_per_cell, ExcIndexRange(i, 0, this->dofs_per_cell));
- Assert(
- this->is_primitive(i),
- (typename FiniteElement<dim, spacedim>::ExcShapeFunctionNotPrimitive(i)));
+ Assert(this->is_primitive(i),
+ (typename FiniteElement<dim, spacedim>::ExcShapeFunctionNotPrimitive(
+ i)));
return (base_element(this->system_to_base_table[i].first.first)
.shape_3rd_derivative(this->system_to_base_table[i].second, p));
const Point<dim> & p) const
{
Assert(i < this->dofs_per_cell, ExcIndexRange(i, 0, this->dofs_per_cell));
- Assert(
- this->is_primitive(i),
- (typename FiniteElement<dim, spacedim>::ExcShapeFunctionNotPrimitive(i)));
+ Assert(this->is_primitive(i),
+ (typename FiniteElement<dim, spacedim>::ExcShapeFunctionNotPrimitive(
+ i)));
return (base_element(this->system_to_base_table[i].first.first)
.shape_4th_derivative(this->system_to_base_table[i].second, p));
Assert((interpolation_matrix.m() == this->dofs_per_cell) ||
(x_source_fe.dofs_per_cell == 0),
ExcDimensionMismatch(interpolation_matrix.m(), this->dofs_per_cell));
- Assert(
- (interpolation_matrix.n() == x_source_fe.dofs_per_cell) ||
- (this->dofs_per_cell == 0),
- ExcDimensionMismatch(interpolation_matrix.m(), x_source_fe.dofs_per_cell));
+ Assert((interpolation_matrix.n() == x_source_fe.dofs_per_cell) ||
+ (this->dofs_per_cell == 0),
+ ExcDimensionMismatch(interpolation_matrix.m(),
+ x_source_fe.dofs_per_cell));
// there are certain conditions that the two elements have to satisfy so
// that this can work.
const RefinementCase<dim> &refinement_case) const
{
Assert(refinement_case < RefinementCase<dim>::isotropic_refinement + 1,
- ExcIndexRange(
- refinement_case, 0, RefinementCase<dim>::isotropic_refinement + 1));
- Assert(
- refinement_case != RefinementCase<dim>::no_refinement,
- ExcMessage("Restriction matrices are only available for refined cells!"));
- Assert(
- child < GeometryInfo<dim>::n_children(refinement_case),
- ExcIndexRange(child, 0, GeometryInfo<dim>::n_children(refinement_case)));
+ ExcIndexRange(refinement_case,
+ 0,
+ RefinementCase<dim>::isotropic_refinement + 1));
+ Assert(refinement_case != RefinementCase<dim>::no_refinement,
+ ExcMessage(
+ "Restriction matrices are only available for refined cells!"));
+ Assert(child < GeometryInfo<dim>::n_children(refinement_case),
+ ExcIndexRange(child,
+ 0,
+ GeometryInfo<dim>::n_children(refinement_case)));
// initialization upon first request
if (this->restriction[refinement_case - 1][child].n() == 0)
const RefinementCase<dim> &refinement_case) const
{
Assert(refinement_case < RefinementCase<dim>::isotropic_refinement + 1,
- ExcIndexRange(
- refinement_case, 0, RefinementCase<dim>::isotropic_refinement + 1));
- Assert(
- refinement_case != RefinementCase<dim>::no_refinement,
- ExcMessage("Restriction matrices are only available for refined cells!"));
- Assert(
- child < GeometryInfo<dim>::n_children(refinement_case),
- ExcIndexRange(child, 0, GeometryInfo<dim>::n_children(refinement_case)));
+ ExcIndexRange(refinement_case,
+ 0,
+ RefinementCase<dim>::isotropic_refinement + 1));
+ Assert(refinement_case != RefinementCase<dim>::no_refinement,
+ ExcMessage(
+ "Restriction matrices are only available for refined cells!"));
+ Assert(child < GeometryInfo<dim>::n_children(refinement_case),
+ ExcIndexRange(child,
+ 0,
+ GeometryInfo<dim>::n_children(refinement_case)));
// initialization upon first request, construction completely analogous to
// restriction matrix
// out of the base output object into the system output object,
// but we can't because we can't know what the elements already
// copied and/or will want to update on every cell
- auto base_fe_data = base_element(base_no).get_data(
- flags, mapping, quadrature, base_fe_output_object);
+ auto base_fe_data = base_element(base_no).get_data(flags,
+ mapping,
+ quadrature,
+ base_fe_output_object);
data->set_fe_data(base_no, std::move(base_fe_data));
}
init_tasks += Threads::new_task([&]() {
// the array into which we want to write should have the correct size
// already.
- Assert(
- this->adjust_quad_dof_index_for_face_orientation_table.n_elements() ==
- 8 * this->dofs_per_quad,
- ExcInternalError());
+ Assert(this->adjust_quad_dof_index_for_face_orientation_table
+ .n_elements() == 8 * this->dofs_per_quad,
+ ExcInternalError());
// to obtain the shifts for this composed element, copy the shift
// information of the base elements
{
Assert(interpolation_matrix.n() == this->dofs_per_face,
ExcDimensionMismatch(interpolation_matrix.n(), this->dofs_per_face));
- Assert(
- interpolation_matrix.m() == x_source_fe.dofs_per_face,
- ExcDimensionMismatch(interpolation_matrix.m(), x_source_fe.dofs_per_face));
+ Assert(interpolation_matrix.m() == x_source_fe.dofs_per_face,
+ ExcDimensionMismatch(interpolation_matrix.m(),
+ x_source_fe.dofs_per_face));
// since dofs for each base are independent, we only have to stack things up
// from base element to base element
Assert(interpolation_matrix.n() == this->dofs_per_face,
ExcDimensionMismatch(interpolation_matrix.n(), this->dofs_per_face));
- Assert(
- interpolation_matrix.m() == x_source_fe.dofs_per_face,
- ExcDimensionMismatch(interpolation_matrix.m(), x_source_fe.dofs_per_face));
+ Assert(interpolation_matrix.m() == x_source_fe.dofs_per_face,
+ ExcDimensionMismatch(interpolation_matrix.m(),
+ x_source_fe.dofs_per_face));
// since dofs for each base are independent, we only have to stack things up
// from base element to base element
// get the interpolation from the bases
base_to_base_interpolation.reinit(base_other.dofs_per_face,
base.dofs_per_face);
- base.get_subface_interpolation_matrix(
- base_other, subface, base_to_base_interpolation);
+ base.get_subface_interpolation_matrix(base_other,
+ subface,
+ base_to_base_interpolation);
// now translate entries. we'd like to have something like
// face_base_to_system_index, but that doesn't exist. rather, all we
this->system_to_base_index(k);
if (ind.first.first == i)
for (unsigned int c = 0; c < base_table.first.n_rows(); ++c)
- constant_modes(
- comp + ind.first.second * base_table.first.n_rows() + c, k) =
- base_table.first(c, ind.second);
+ constant_modes(comp +
+ ind.first.second * base_table.first.n_rows() + c,
+ k) = base_table.first(c, ind.second);
}
for (unsigned int r = 0; r < element_multiplicity; ++r)
for (unsigned int c = 0; c < base_table.second.size(); ++c)
template <int dim, int spacedim>
-FE_TraceQ<dim, spacedim>::FE_TraceQ(const unsigned int degree) :
- FE_PolyFace<TensorProductPolynomials<dim - 1>, dim, spacedim>(
- TensorProductPolynomials<dim - 1>(
- Polynomials::generate_complete_Lagrange_basis(
- QGaussLobatto<1>(degree + 1).get_points())),
- FiniteElementData<dim>(get_dpo_vector(degree),
- 1,
- degree,
- FiniteElementData<dim>::L2),
- std::vector<bool>(1, true)),
- fe_q(degree)
+FE_TraceQ<dim, spacedim>::FE_TraceQ(const unsigned int degree)
+ : FE_PolyFace<TensorProductPolynomials<dim - 1>, dim, spacedim>(
+ TensorProductPolynomials<dim - 1>(
+ Polynomials::generate_complete_Lagrange_basis(
+ QGaussLobatto<1>(degree + 1).get_points())),
+ FiniteElementData<dim>(get_dpo_vector(degree),
+ 1,
+ degree,
+ FiniteElementData<dim>::L2),
+ std::vector<bool>(1, true))
+ , fe_q(degree)
{
Assert(degree > 0,
ExcMessage("FE_Trace can only be used for polynomial degrees "
const FiniteElement<dim, spacedim> &source_fe,
FullMatrix<double> & interpolation_matrix) const
{
- get_subface_interpolation_matrix(
- source_fe, numbers::invalid_unsigned_int, interpolation_matrix);
+ get_subface_interpolation_matrix(source_fe,
+ numbers::invalid_unsigned_int,
+ interpolation_matrix);
}
// this is the code from FE_FaceQ
Assert(interpolation_matrix.n() == this->dofs_per_face,
ExcDimensionMismatch(interpolation_matrix.n(), this->dofs_per_face));
- Assert(
- interpolation_matrix.m() == x_source_fe.dofs_per_face,
- ExcDimensionMismatch(interpolation_matrix.m(), x_source_fe.dofs_per_face));
+ Assert(interpolation_matrix.m() == x_source_fe.dofs_per_face,
+ ExcDimensionMismatch(interpolation_matrix.m(),
+ x_source_fe.dofs_per_face));
// see if source is a FaceQ element
if (const FE_TraceQ<dim, spacedim> *source_fe =
dynamic_cast<const FE_TraceQ<dim, spacedim> *>(&x_source_fe))
{
- fe_q.get_subface_interpolation_matrix(
- source_fe->fe_q, subface, interpolation_matrix);
+ fe_q.get_subface_interpolation_matrix(source_fe->fe_q,
+ subface,
+ interpolation_matrix);
}
else if (dynamic_cast<const FE_Nothing<dim> *>(&x_source_fe) != nullptr)
{
template <int spacedim>
-FE_TraceQ<1, spacedim>::FE_TraceQ(const unsigned int degree) :
- FE_FaceQ<1, spacedim>(degree)
+FE_TraceQ<1, spacedim>::FE_TraceQ(const unsigned int degree)
+ : FE_FaceQ<1, spacedim>(degree)
{}
{
template <int dim, int spacedim>
Scalar<dim, spacedim>::Scalar(const FEValuesBase<dim, spacedim> &fe_values,
- const unsigned int component) :
- fe_values(&fe_values),
- component(component),
- shape_function_data(this->fe_values->fe->dofs_per_cell)
+ const unsigned int component)
+ : fe_values(&fe_values)
+ , component(component)
+ , shape_function_data(this->fe_values->fe->dofs_per_cell)
{
const FiniteElement<dim, spacedim> &fe = *this->fe_values->fe;
Assert(component < fe.n_components(),
template <int dim, int spacedim>
- Scalar<dim, spacedim>::Scalar() :
- fe_values(nullptr),
- component(numbers::invalid_unsigned_int)
+ Scalar<dim, spacedim>::Scalar()
+ : fe_values(nullptr)
+ , component(numbers::invalid_unsigned_int)
{}
template <int dim, int spacedim>
Vector<dim, spacedim>::Vector(const FEValuesBase<dim, spacedim> &fe_values,
- const unsigned int first_vector_component) :
- fe_values(&fe_values),
- first_vector_component(first_vector_component),
- shape_function_data(this->fe_values->fe->dofs_per_cell)
+ const unsigned int first_vector_component)
+ : fe_values(&fe_values)
+ , first_vector_component(first_vector_component)
+ , shape_function_data(this->fe_values->fe->dofs_per_cell)
{
const FiniteElement<dim, spacedim> &fe = *this->fe_values->fe;
Assert(first_vector_component + spacedim - 1 < fe.n_components(),
- ExcIndexRange(
- first_vector_component + spacedim - 1, 0, fe.n_components()));
+ ExcIndexRange(first_vector_component + spacedim - 1,
+ 0,
+ fe.n_components()));
// TODO: we'd like to use the fields with the same name as these
// variables from FEValuesBase, but they aren't initialized yet
template <int dim, int spacedim>
- Vector<dim, spacedim>::Vector() :
- fe_values(nullptr),
- first_vector_component(numbers::invalid_unsigned_int)
+ Vector<dim, spacedim>::Vector()
+ : fe_values(nullptr)
+ , first_vector_component(numbers::invalid_unsigned_int)
{}
template <int dim, int spacedim>
SymmetricTensor<2, dim, spacedim>::SymmetricTensor(
const FEValuesBase<dim, spacedim> &fe_values,
- const unsigned int first_tensor_component) :
- fe_values(&fe_values),
- first_tensor_component(first_tensor_component),
- shape_function_data(this->fe_values->fe->dofs_per_cell)
+ const unsigned int first_tensor_component)
+ : fe_values(&fe_values)
+ , first_tensor_component(first_tensor_component)
+ , shape_function_data(this->fe_values->fe->dofs_per_cell)
{
const FiniteElement<dim, spacedim> &fe = *this->fe_values->fe;
Assert(first_tensor_component + (dim * dim + dim) / 2 - 1 <
template <int dim, int spacedim>
- SymmetricTensor<2, dim, spacedim>::SymmetricTensor() :
- fe_values(nullptr),
- first_tensor_component(numbers::invalid_unsigned_int)
+ SymmetricTensor<2, dim, spacedim>::SymmetricTensor()
+ : fe_values(nullptr)
+ , first_tensor_component(numbers::invalid_unsigned_int)
{}
template <int dim, int spacedim>
Tensor<2, dim, spacedim>::Tensor(const FEValuesBase<dim, spacedim> &fe_values,
- const unsigned int first_tensor_component) :
- fe_values(&fe_values),
- first_tensor_component(first_tensor_component),
- shape_function_data(this->fe_values->fe->dofs_per_cell)
+ const unsigned int first_tensor_component)
+ : fe_values(&fe_values)
+ , first_tensor_component(first_tensor_component)
+ , shape_function_data(this->fe_values->fe->dofs_per_cell)
{
const FiniteElement<dim, spacedim> &fe = *this->fe_values->fe;
Assert(first_tensor_component + dim * dim - 1 < fe.n_components(),
- ExcIndexRange(
- first_tensor_component + dim * dim - 1, 0, fe.n_components()));
+ ExcIndexRange(first_tensor_component + dim * dim - 1,
+ 0,
+ fe.n_components()));
// TODO: we'd like to use the fields with the same name as these
// variables from FEValuesBase, but they aren't initialized yet
// at the time we get here, so re-create it all
template <int dim, int spacedim>
- Tensor<2, dim, spacedim>::Tensor() :
- fe_values(nullptr),
- first_tensor_component(numbers::invalid_unsigned_int)
+ Tensor<2, dim, spacedim>::Tensor()
+ : fe_values(nullptr)
+ , first_tensor_component(numbers::invalid_unsigned_int)
{}
Assert(fe_values->update_flags & update_hessians,
(typename FEValuesBase<dim, spacedim>::ExcAccessToUninitializedField(
"update_hessians")));
- Assert(
- laplacians.size() == fe_values->n_quadrature_points,
- ExcDimensionMismatch(laplacians.size(), fe_values->n_quadrature_points));
+ Assert(laplacians.size() == fe_values->n_quadrature_points,
+ ExcDimensionMismatch(laplacians.size(),
+ fe_values->n_quadrature_points));
Assert(fe_values->present_cell.get() != nullptr,
ExcMessage("FEValues object is not reinit'ed to any cell"));
Assert(
Assert(fe_values->update_flags & update_hessians,
(typename FEValuesBase<dim, spacedim>::ExcAccessToUninitializedField(
"update_hessians")));
- Assert(
- laplacians.size() == fe_values->n_quadrature_points,
- ExcDimensionMismatch(laplacians.size(), fe_values->n_quadrature_points));
+ Assert(laplacians.size() == fe_values->n_quadrature_points,
+ ExcDimensionMismatch(laplacians.size(),
+ fe_values->n_quadrature_points));
Assert(fe_values->present_cell.get() != nullptr,
ExcMessage("FEValues object is not reinit'ed to any cell"));
AssertDimension(dof_values.size(), fe_values->dofs_per_cell);
template <int dim, int spacedim>
template <typename CI>
-FEValuesBase<dim, spacedim>::CellIterator<CI>::CellIterator(const CI &cell) :
- cell(cell)
+FEValuesBase<dim, spacedim>::CellIterator<CI>::CellIterator(const CI &cell)
+ : cell(cell)
{}
template <int dim, int spacedim>
FEValuesBase<dim, spacedim>::TriaCellIterator::TriaCellIterator(
- const typename Triangulation<dim, spacedim>::cell_iterator &cell) :
- cell(cell)
+ const typename Triangulation<dim, spacedim>::cell_iterator &cell)
+ : cell(cell)
{}
const unsigned int dofs_per_cell,
const UpdateFlags flags,
const Mapping<dim, spacedim> & mapping,
- const FiniteElement<dim, spacedim> &fe) :
- n_quadrature_points(n_q_points),
- dofs_per_cell(dofs_per_cell),
- mapping(&mapping, typeid(*this).name()),
- fe(&fe, typeid(*this).name()),
- cell_similarity(CellSimilarity::Similarity::none),
- fe_values_views_cache(*this)
+ const FiniteElement<dim, spacedim> &fe)
+ : n_quadrature_points(n_q_points)
+ , dofs_per_cell(dofs_per_cell)
+ , mapping(&mapping, typeid(*this).name())
+ , fe(&fe, typeid(*this).name())
+ , cell_similarity(CellSimilarity::Similarity::none)
+ , fe_values_views_cache(*this)
{
Assert(n_q_points > 0,
ExcMessage("There is nothing useful you can do with an FEValues "
typedef typename VectorType::value_type Number;
// initialize with zero
for (unsigned int i = 0; i < values.size(); ++i)
- std::fill_n(
- values[i].begin(), values[i].size(), typename VectorType::value_type());
+ std::fill_n(values[i].begin(),
+ values[i].size(),
+ typename VectorType::value_type());
// see if there the current cell has DoFs at all, and if not
// then there is nothing else to do.
// get function values of dofs on this cell
Vector<Number> dof_values(dofs_per_cell);
present_cell->get_interpolated_dof_values(fe_function, dof_values);
- internal::do_function_values(
- dof_values.begin(), this->finite_element_output.shape_values, values);
+ internal::do_function_values(dof_values.begin(),
+ this->finite_element_output.shape_values,
+ values);
}
boost::container::small_vector<Number, 200> dof_values(dofs_per_cell);
for (unsigned int i = 0; i < dofs_per_cell; ++i)
dof_values[i] = internal::get_vector_element(fe_function, indices[i]);
- internal::do_function_values(
- dof_values.data(), this->finite_element_output.shape_values, values);
+ internal::do_function_values(dof_values.data(),
+ this->finite_element_output.shape_values,
+ values);
}
// get function values of dofs on this cell
Vector<Number> dof_values(dofs_per_cell);
present_cell->get_interpolated_dof_values(fe_function, dof_values);
- internal::do_function_derivatives(
- dof_values.begin(), this->finite_element_output.shape_gradients, gradients);
+ internal::do_function_derivatives(dof_values.begin(),
+ this->finite_element_output.shape_gradients,
+ gradients);
}
boost::container::small_vector<Number, 200> dof_values(dofs_per_cell);
for (unsigned int i = 0; i < dofs_per_cell; ++i)
dof_values[i] = internal::get_vector_element(fe_function, indices[i]);
- internal::do_function_derivatives(
- dof_values.data(), this->finite_element_output.shape_gradients, gradients);
+ internal::do_function_derivatives(dof_values.data(),
+ this->finite_element_output.shape_gradients,
+ gradients);
}
// get function values of dofs on this cell
Vector<Number> dof_values(dofs_per_cell);
present_cell->get_interpolated_dof_values(fe_function, dof_values);
- internal::do_function_derivatives(
- dof_values.begin(), this->finite_element_output.shape_hessians, hessians);
+ internal::do_function_derivatives(dof_values.begin(),
+ this->finite_element_output.shape_hessians,
+ hessians);
}
boost::container::small_vector<Number, 200> dof_values(dofs_per_cell);
for (unsigned int i = 0; i < dofs_per_cell; ++i)
dof_values[i] = internal::get_vector_element(fe_function, indices[i]);
- internal::do_function_derivatives(
- dof_values.data(), this->finite_element_output.shape_hessians, hessians);
+ internal::do_function_derivatives(dof_values.data(),
+ this->finite_element_output.shape_hessians,
+ hessians);
}
// get function values of dofs on this cell
Vector<Number> dof_values(dofs_per_cell);
present_cell->get_interpolated_dof_values(fe_function, dof_values);
- internal::do_function_laplacians(
- dof_values.begin(), this->finite_element_output.shape_hessians, laplacians);
+ internal::do_function_laplacians(dof_values.begin(),
+ this->finite_element_output.shape_hessians,
+ laplacians);
}
boost::container::small_vector<Number, 200> dof_values(dofs_per_cell);
for (unsigned int i = 0; i < dofs_per_cell; ++i)
dof_values[i] = internal::get_vector_element(fe_function, indices[i]);
- internal::do_function_laplacians(
- dof_values.data(), this->finite_element_output.shape_hessians, laplacians);
+ internal::do_function_laplacians(dof_values.data(),
+ this->finite_element_output.shape_hessians,
+ laplacians);
}
FEValues<dim, spacedim>::FEValues(const Mapping<dim, spacedim> & mapping,
const FiniteElement<dim, spacedim> &fe,
const Quadrature<dim> & q,
- const UpdateFlags update_flags) :
- FEValuesBase<dim, spacedim>(q.size(),
- fe.dofs_per_cell,
- update_default,
- mapping,
- fe),
- quadrature(q)
+ const UpdateFlags update_flags)
+ : FEValuesBase<dim, spacedim>(q.size(),
+ fe.dofs_per_cell,
+ update_default,
+ mapping,
+ fe)
+ , quadrature(q)
{
initialize(update_flags);
}
template <int dim, int spacedim>
FEValues<dim, spacedim>::FEValues(const FiniteElement<dim, spacedim> &fe,
const Quadrature<dim> & q,
- const UpdateFlags update_flags) :
- FEValuesBase<dim, spacedim>(q.size(),
- fe.dofs_per_cell,
- update_default,
- StaticMappingQ1<dim, spacedim>::mapping,
- fe),
- quadrature(q)
+ const UpdateFlags update_flags)
+ : FEValuesBase<dim, spacedim>(q.size(),
+ fe.dofs_per_cell,
+ update_default,
+ StaticMappingQ1<dim, spacedim>::mapping,
+ fe)
+ , quadrature(q)
{
initialize(update_flags);
}
// initialize the base classes
if (flags & update_mapping)
this->mapping_output.initialize(this->n_quadrature_points, flags);
- this->finite_element_output.initialize(
- this->n_quadrature_points, *this->fe, flags);
+ this->finite_element_output.initialize(this->n_quadrature_points,
+ *this->fe,
+ flags);
// then get objects into which the FE and the Mapping can store
// intermediate data used across calls to reinit. we can do this in parallel
std::unique_ptr<typename Mapping<dim, spacedim>::InternalDataBase>>
mapping_get_data;
if (flags & update_mapping)
- mapping_get_data = Threads::new_task(
- &Mapping<dim, spacedim>::get_data, *this->mapping, flags, quadrature);
+ mapping_get_data = Threads::new_task(&Mapping<dim, spacedim>::get_data,
+ *this->mapping,
+ flags,
+ quadrature);
this->update_flags = flags;
const UpdateFlags,
const Mapping<dim, spacedim> & mapping,
const FiniteElement<dim, spacedim> &fe,
- const Quadrature<dim - 1> & quadrature) :
- FEValuesBase<dim, spacedim>(n_q_points,
- dofs_per_cell,
- update_default,
- mapping,
- fe),
- present_face_index(numbers::invalid_unsigned_int),
- quadrature(quadrature)
+ const Quadrature<dim - 1> & quadrature)
+ : FEValuesBase<dim, spacedim>(n_q_points,
+ dofs_per_cell,
+ update_default,
+ mapping,
+ fe)
+ , present_face_index(numbers::invalid_unsigned_int)
+ , quadrature(quadrature)
{}
const Mapping<dim, spacedim> & mapping,
const FiniteElement<dim, spacedim> &fe,
const Quadrature<dim - 1> & quadrature,
- const UpdateFlags update_flags) :
- FEFaceValuesBase<dim, spacedim>(quadrature.size(),
- fe.dofs_per_cell,
- update_flags,
- mapping,
- fe,
- quadrature)
+ const UpdateFlags update_flags)
+ : FEFaceValuesBase<dim, spacedim>(quadrature.size(),
+ fe.dofs_per_cell,
+ update_flags,
+ mapping,
+ fe,
+ quadrature)
{
initialize(update_flags);
}
FEFaceValues<dim, spacedim>::FEFaceValues(
const FiniteElement<dim, spacedim> &fe,
const Quadrature<dim - 1> & quadrature,
- const UpdateFlags update_flags) :
- FEFaceValuesBase<dim, spacedim>(quadrature.size(),
- fe.dofs_per_cell,
- update_flags,
- StaticMappingQ1<dim, spacedim>::mapping,
- fe,
- quadrature)
+ const UpdateFlags update_flags)
+ : FEFaceValuesBase<dim, spacedim>(quadrature.size(),
+ fe.dofs_per_cell,
+ update_flags,
+ StaticMappingQ1<dim, spacedim>::mapping,
+ fe,
+ quadrature)
{
initialize(update_flags);
}
// initialize the base classes
if (flags & update_mapping)
this->mapping_output.initialize(this->n_quadrature_points, flags);
- this->finite_element_output.initialize(
- this->n_quadrature_points, *this->fe, flags);
+ this->finite_element_output.initialize(this->n_quadrature_points,
+ *this->fe,
+ flags);
// then get objects into which the FE and the Mapping can store
// intermediate data used across calls to reinit. this can be done in parallel
const Mapping<dim, spacedim> & mapping,
const FiniteElement<dim, spacedim> &fe,
const Quadrature<dim - 1> & quadrature,
- const UpdateFlags update_flags) :
- FEFaceValuesBase<dim, spacedim>(quadrature.size(),
- fe.dofs_per_cell,
- update_flags,
- mapping,
- fe,
- quadrature)
+ const UpdateFlags update_flags)
+ : FEFaceValuesBase<dim, spacedim>(quadrature.size(),
+ fe.dofs_per_cell,
+ update_flags,
+ mapping,
+ fe,
+ quadrature)
{
initialize(update_flags);
}
FESubfaceValues<dim, spacedim>::FESubfaceValues(
const FiniteElement<dim, spacedim> &fe,
const Quadrature<dim - 1> & quadrature,
- const UpdateFlags update_flags) :
- FEFaceValuesBase<dim, spacedim>(quadrature.size(),
- fe.dofs_per_cell,
- update_flags,
- StaticMappingQ1<dim, spacedim>::mapping,
- fe,
- quadrature)
+ const UpdateFlags update_flags)
+ : FEFaceValuesBase<dim, spacedim>(quadrature.size(),
+ fe.dofs_per_cell,
+ update_flags,
+ StaticMappingQ1<dim, spacedim>::mapping,
+ fe,
+ quadrature)
{
initialize(update_flags);
}
// initialize the base classes
if (flags & update_mapping)
this->mapping_output.initialize(this->n_quadrature_points, flags);
- this->finite_element_output.initialize(
- this->n_quadrature_points, *this->fe, flags);
+ this->finite_element_output.initialize(this->n_quadrature_points,
+ *this->fe,
+ flags);
// then get objects into which the FE and the Mapping can store
// intermediate data used across calls to reinit. this can be done
// but unfortunately the current function is also called for
// faces without children (see tests/fe/mapping.cc). Therefore,
// we must use following workaround of two separate assertions
- Assert(
- cell->face(face_no)->has_children() ||
- subface_no < GeometryInfo<dim>::max_children_per_face,
- ExcIndexRange(subface_no, 0, GeometryInfo<dim>::max_children_per_face));
- Assert(
- !cell->face(face_no)->has_children() ||
- subface_no < cell->face(face_no)->number_of_children(),
- ExcIndexRange(subface_no, 0, cell->face(face_no)->number_of_children()));
+ Assert(cell->face(face_no)->has_children() ||
+ subface_no < GeometryInfo<dim>::max_children_per_face,
+ ExcIndexRange(subface_no,
+ 0,
+ GeometryInfo<dim>::max_children_per_face));
+ Assert(!cell->face(face_no)->has_children() ||
+ subface_no < cell->face(face_no)->number_of_children(),
+ ExcIndexRange(subface_no,
+ 0,
+ cell->face(face_no)->number_of_children()));
Assert(cell->has_children() == false,
ExcMessage("You can't use subface data for cells that are "
"already refined. Iterate over their children "
/// @p get_interpolated_dof_values
/// of the iterator with the
/// given arguments.
- virtual void get_interpolated_dof_values(
- const VEC &in, Vector<VEC::value_type> &out) const = 0;
+ virtual void get_interpolated_dof_values(const VEC & in,
+ Vector<VEC::value_type> &out)
+ const = 0;
}
/// @p get_interpolated_dof_values
/// of the iterator with the
/// given arguments.
- virtual void get_interpolated_dof_values(
- const VEC &in, Vector<VEC::value_type> &out) const override;
+ virtual void get_interpolated_dof_values(const VEC & in,
+ Vector<VEC::value_type> &out)
+ const override;
}
std::vector<VEC::value_type> &) const;
template void FEValuesBase<deal_II_dimension, deal_II_space_dimension>::
- get_function_laplacians<VEC>(
- const VEC &, std::vector<Vector<VEC::value_type>> &) const;
+ get_function_laplacians<VEC>(const VEC &,
+ std::vector<Vector<VEC::value_type>> &)
+ const;
template void FEValuesBase<deal_II_dimension, deal_II_space_dimension>::
get_function_laplacians<VEC>(
std::vector<IndexSet::value_type> &) const;
template void FEValuesBase<deal_II_dimension, deal_II_space_dimension>::
- get_function_values<IndexSet>(
- const IndexSet &, std::vector<Vector<IndexSet::value_type>> &) const;
+ get_function_values<IndexSet>(const IndexSet &,
+ std::vector<Vector<IndexSet::value_type>> &)
+ const;
template void FEValuesBase<deal_II_dimension, deal_II_space_dimension>::
get_function_values<IndexSet>(
bool) const;
template void FEValuesBase<deal_II_dimension, deal_II_space_dimension>::
- get_function_laplacians<IndexSet>(
- const IndexSet &, std::vector<IndexSet::value_type> &) const;
+ get_function_laplacians<IndexSet>(const IndexSet &,
+ std::vector<IndexSet::value_type> &)
+ const;
template void FEValuesBase<deal_II_dimension, deal_II_space_dimension>::
get_function_laplacians<IndexSet>(
const IndexSet &,
template <int dim, int spacedim>
-Mapping<dim, spacedim>::InternalDataBase::InternalDataBase() :
- update_each(update_default)
+Mapping<dim, spacedim>::InternalDataBase::InternalDataBase()
+ : update_each(update_default)
{}
template <int dim, int spacedim>
-MappingC1<dim, spacedim>::MappingC1Generic::MappingC1Generic() :
- MappingQGeneric<dim, spacedim>(3)
+MappingC1<dim, spacedim>::MappingC1Generic::MappingC1Generic()
+ : MappingQGeneric<dim, spacedim>(3)
{}
template <int dim, int spacedim>
-MappingC1<dim, spacedim>::MappingC1() : MappingQ<dim, spacedim>(3)
+MappingC1<dim, spacedim>::MappingC1()
+ : MappingQ<dim, spacedim>(3)
{
Assert(dim > 1, ExcImpossibleInDim(dim));
template <int dim, int spacedim>
MappingCartesian<dim, spacedim>::InternalData::InternalData(
- const Quadrature<dim> &q) :
- cell_extents(numbers::signaling_nan<Tensor<1, dim>>()),
- volume_element(numbers::signaling_nan<double>()),
- quadrature_points(q.get_points())
+ const Quadrature<dim> &q)
+ : cell_extents(numbers::signaling_nan<Tensor<1, dim>>())
+ , volume_element(numbers::signaling_nan<double>())
+ , quadrature_points(q.get_points())
{}
// tests/fe/mapping.cc). Therefore,
// we must use following workaround
// of two separate assertions
- Assert(
- (sub_no == invalid_face_number) ||
- cell->face(face_no)->has_children() ||
- (sub_no + 1 < GeometryInfo<dim>::max_children_per_face + 1),
- ExcIndexRange(sub_no, 0, GeometryInfo<dim>::max_children_per_face));
+ Assert((sub_no == invalid_face_number) ||
+ cell->face(face_no)->has_children() ||
+ (sub_no + 1 < GeometryInfo<dim>::max_children_per_face + 1),
+ ExcIndexRange(sub_no,
+ 0,
+ GeometryInfo<dim>::max_children_per_face));
Assert((sub_no == invalid_face_number) ||
!cell->face(face_no)->has_children() ||
(sub_no < cell->face(face_no)->n_children()),
{
static const Point<dim> normals[GeometryInfo<1>::faces_per_cell] =
{Point<dim>(-1.), Point<dim>(1.)};
- std::fill(
- normal_vectors.begin(), normal_vectors.end(), normals[face_no]);
+ std::fill(normal_vectors.begin(),
+ normal_vectors.end(),
+ normals[face_no]);
break;
}
Point<dim>(1, 0),
Point<dim>(0, -1),
Point<dim>(0, 1)};
- std::fill(
- normal_vectors.begin(), normal_vectors.end(), normals[face_no]);
+ std::fill(normal_vectors.begin(),
+ normal_vectors.end(),
+ normals[face_no]);
break;
}
Point<dim>(0, 1, 0),
Point<dim>(0, 0, -1),
Point<dim>(0, 0, 1)};
- std::fill(
- normal_vectors.begin(), normal_vectors.end(), normals[face_no]);
+ std::fill(normal_vectors.begin(),
+ normal_vectors.end(),
+ normals[face_no]);
break;
}
template <int dim, int spacedim, typename VectorType, typename DoFHandlerType>
MappingFEField<dim, spacedim, VectorType, DoFHandlerType>::InternalData::
InternalData(const FiniteElement<dim, spacedim> &fe,
- const ComponentMask & mask) :
- unit_tangentials(),
- n_shape_functions(fe.dofs_per_cell),
- mask(mask),
- local_dof_indices(fe.dofs_per_cell),
- local_dof_values(fe.dofs_per_cell)
+ const ComponentMask & mask)
+ : unit_tangentials()
+ , n_shape_functions(fe.dofs_per_cell)
+ , mask(mask)
+ , local_dof_indices(fe.dofs_per_cell)
+ , local_dof_values(fe.dofs_per_cell)
{}
const unsigned int shape_nr)
{
Assert(qpoint * n_shape_functions + shape_nr < shape_values.size(),
- ExcIndexRange(
- qpoint * n_shape_functions + shape_nr, 0, shape_values.size()));
+ ExcIndexRange(qpoint * n_shape_functions + shape_nr,
+ 0,
+ shape_values.size()));
return shape_values[qpoint * n_shape_functions + shape_nr];
}
derivative(const unsigned int qpoint, const unsigned int shape_nr) const
{
Assert(qpoint * n_shape_functions + shape_nr < shape_derivatives.size(),
- ExcIndexRange(
- qpoint * n_shape_functions + shape_nr, 0, shape_derivatives.size()));
+ ExcIndexRange(qpoint * n_shape_functions + shape_nr,
+ 0,
+ shape_derivatives.size()));
return shape_derivatives[qpoint * n_shape_functions + shape_nr];
}
derivative(const unsigned int qpoint, const unsigned int shape_nr)
{
Assert(qpoint * n_shape_functions + shape_nr < shape_derivatives.size(),
- ExcIndexRange(
- qpoint * n_shape_functions + shape_nr, 0, shape_derivatives.size()));
+ ExcIndexRange(qpoint * n_shape_functions + shape_nr,
+ 0,
+ shape_derivatives.size()));
return shape_derivatives[qpoint * n_shape_functions + shape_nr];
}
MappingFEField<dim, spacedim, VectorType, DoFHandlerType>::MappingFEField(
const DoFHandlerType &euler_dof_handler,
const VectorType & euler_vector,
- const ComponentMask & mask) :
- euler_vector(&euler_vector),
- euler_dof_handler(&euler_dof_handler),
- fe_mask(
- mask.size() ?
- mask :
- ComponentMask(euler_dof_handler.get_fe().get_nonzero_components(0).size(),
- true)),
- fe_to_real(fe_mask.size(), numbers::invalid_unsigned_int),
- fe_values(this->euler_dof_handler->get_fe(),
- get_vertex_quadrature<dim>(),
- update_values)
+ const ComponentMask & mask)
+ : euler_vector(&euler_vector)
+ , euler_dof_handler(&euler_dof_handler)
+ , fe_mask(mask.size() ?
+ mask :
+ ComponentMask(
+ euler_dof_handler.get_fe().get_nonzero_components(0).size(),
+ true))
+ , fe_to_real(fe_mask.size(), numbers::invalid_unsigned_int)
+ , fe_values(this->euler_dof_handler->get_fe(),
+ get_vertex_quadrature<dim>(),
+ update_values)
{
unsigned int size = 0;
for (unsigned int i = 0; i < fe_mask.size(); ++i)
template <int dim, int spacedim, typename VectorType, typename DoFHandlerType>
MappingFEField<dim, spacedim, VectorType, DoFHandlerType>::MappingFEField(
- const MappingFEField<dim, spacedim, VectorType, DoFHandlerType> &mapping) :
- euler_vector(mapping.euler_vector),
- euler_dof_handler(mapping.euler_dof_handler),
- fe_mask(mapping.fe_mask),
- fe_to_real(mapping.fe_to_real),
- fe_values(mapping.euler_dof_handler->get_fe(),
- get_vertex_quadrature<dim>(),
- update_values)
+ const MappingFEField<dim, spacedim, VectorType, DoFHandlerType> &mapping)
+ : euler_vector(mapping.euler_vector)
+ , euler_dof_handler(mapping.euler_dof_handler)
+ , fe_mask(mapping.fe_mask)
+ , fe_to_real(mapping.fe_to_real)
+ , fe_values(mapping.euler_dof_handler->get_fe(),
+ get_vertex_quadrature<dim>(),
+ update_values)
{}
const unsigned int shape_nr) const
{
Assert(qpoint * n_shape_functions + shape_nr < shape_values.size(),
- ExcIndexRange(
- qpoint * n_shape_functions + shape_nr, 0, shape_values.size()));
+ ExcIndexRange(qpoint * n_shape_functions + shape_nr,
+ 0,
+ shape_values.size()));
return shape_values[qpoint * n_shape_functions + shape_nr];
}
{
AssertDimension(output_data.JxW_values.size(), n_q_points);
- Assert(
- !(update_flags & update_normal_vectors) ||
- (output_data.normal_vectors.size() == n_q_points),
- ExcDimensionMismatch(output_data.normal_vectors.size(), n_q_points));
+ Assert(!(update_flags & update_normal_vectors) ||
+ (output_data.normal_vectors.size() == n_q_points),
+ ExcDimensionMismatch(output_data.normal_vectors.size(),
+ n_q_points));
if (cell_similarity != CellSimilarity::translation)
{
if (update_flags & update_normal_vectors)
{
- Assert(
- spacedim - dim == 1,
- ExcMessage("There is no cell normal in codim 2."));
+ Assert(spacedim - dim == 1,
+ ExcMessage(
+ "There is no cell normal in codim 2."));
if (dim == 1)
output_data.normal_vectors[point] =
cell,
face_no,
numbers::invalid_unsigned_int,
- QProjector<dim>::DataSetDescriptor::subface(
- face_no,
- subface_no,
- cell->face_orientation(face_no),
- cell->face_flip(face_no),
- cell->face_rotation(face_no),
- quadrature.size(),
- cell->subface_case(face_no)),
+ QProjector<dim>::DataSetDescriptor::subface(face_no,
+ subface_no,
+ cell->face_orientation(
+ face_no),
+ cell->face_flip(face_no),
+ cell->face_rotation(face_no),
+ quadrature.size(),
+ cell->subface_case(face_no)),
quadrature,
data,
euler_dof_handler->get_fe(),
AssertDimension(input.size(), output.size());
internal::MappingFEFieldImplementation::
- transform_fields<dim, spacedim, 1, VectorType, DoFHandlerType>(
- input, mapping_type, mapping_data, output);
+ transform_fields<dim, spacedim, 1, VectorType, DoFHandlerType>(input,
+ mapping_type,
+ mapping_data,
+ output);
}
update_internal_dofs(cell, dynamic_cast<InternalData &>(*mdata));
- return do_transform_real_to_unit_cell(
- cell, p, initial_p_unit, dynamic_cast<InternalData &>(*mdata));
+ return do_transform_real_to_unit_cell(cell,
+ p,
+ initial_p_unit,
+ dynamic_cast<InternalData &>(*mdata));
}
dof_cell->get_dof_indices(data.local_dof_indices);
for (unsigned int i = 0; i < data.local_dof_values.size(); ++i)
- data.local_dof_values[i] = internal::ElementAccess<VectorType>::get(
- *euler_vector, data.local_dof_indices[i]);
+ data.local_dof_values[i] =
+ internal::ElementAccess<VectorType>::get(*euler_vector,
+ data.local_dof_indices[i]);
}
// explicit instantiations
{
const Point<dim> ei = Point<dim>::unit_vector(i);
const double pi = p[i];
- Assert(
- pi >= 0 && pi <= 1.0,
- ExcInternalError("Was expecting a quadrature point "
- "inside the unit reference element."));
+ Assert(pi >= 0 && pi <= 1.0,
+ ExcInternalError(
+ "Was expecting a quadrature point "
+ "inside the unit reference element."));
// In the length L, we store also the direction sign,
// which is positive, if the coordinate is < .5,
{
AssertDimension(output_data.JxW_values.size(), n_q_points);
- Assert(
- !(update_flags & update_normal_vectors) ||
- (output_data.normal_vectors.size() == n_q_points),
- ExcDimensionMismatch(output_data.normal_vectors.size(), n_q_points));
+ Assert(!(update_flags & update_normal_vectors) ||
+ (output_data.normal_vectors.size() == n_q_points),
+ ExcDimensionMismatch(output_data.normal_vectors.size(),
+ n_q_points));
for (unsigned int point = 0; point < n_q_points; ++point)
{
if (update_flags & update_normal_vectors)
{
- Assert(
- spacedim == dim + 1,
- ExcMessage("There is no (unique) cell normal for " +
- Utilities::int_to_string(dim) +
- "-dimensional cells in " +
- Utilities::int_to_string(spacedim) +
- "-dimensional space. This only works if the "
- "space dimension is one greater than the "
- "dimensionality of the mesh cells."));
+ Assert(spacedim == dim + 1,
+ ExcMessage(
+ "There is no (unique) cell normal for " +
+ Utilities::int_to_string(dim) +
+ "-dimensional cells in " +
+ Utilities::int_to_string(spacedim) +
+ "-dimensional space. This only works if the "
+ "space dimension is one greater than the "
+ "dimensionality of the mesh cells."));
if (dim == 1)
output_data.normal_vectors[point] =
data.manifold = &cell->face(face_no)->get_manifold();
- maybe_compute_q_points<dim, spacedim>(
- data_set, data, output_data.quadrature_points);
+ maybe_compute_q_points<dim, spacedim>(data_set,
+ data,
+ output_data.quadrature_points);
maybe_update_Jacobians<dim, spacedim>(data_set, data);
maybe_compute_face_data(mapping,
const ArrayView<Tensor<rank, spacedim>> & output)
{
AssertDimension(input.size(), output.size());
- Assert(
- (dynamic_cast<const typename dealii::MappingManifold<dim, spacedim>::
- InternalData *>(&mapping_data) != nullptr),
- ExcInternalError());
+ Assert((dynamic_cast<const typename dealii::
+ MappingManifold<dim, spacedim>::InternalData *>(
+ &mapping_data) != nullptr),
+ ExcInternalError());
const typename dealii::MappingManifold<dim, spacedim>::InternalData
&data =
static_cast<const typename dealii::MappingManifold<dim, spacedim>::
const ArrayView<Tensor<rank, spacedim>> & output)
{
AssertDimension(input.size(), output.size());
- Assert(
- (dynamic_cast<const typename dealii::MappingManifold<dim, spacedim>::
- InternalData *>(&mapping_data) != nullptr),
- ExcInternalError());
+ Assert((dynamic_cast<const typename dealii::
+ MappingManifold<dim, spacedim>::InternalData *>(
+ &mapping_data) != nullptr),
+ ExcInternalError());
const typename dealii::MappingManifold<dim, spacedim>::InternalData
&data =
static_cast<const typename dealii::MappingManifold<dim, spacedim>::
for (unsigned int i = 0; i < output.size(); ++i)
{
- DerivativeForm<1, spacedim, dim> A = apply_transformation(
- data.contravariant[i], transpose(input[i]));
+ DerivativeForm<1, spacedim, dim> A =
+ apply_transformation(data.contravariant[i],
+ transpose(input[i]));
output[i] =
apply_transformation(data.covariant[i], A.transpose());
}
for (unsigned int i = 0; i < output.size(); ++i)
{
- DerivativeForm<1, spacedim, dim> A = apply_transformation(
- data.covariant[i], transpose(input[i]));
+ DerivativeForm<1, spacedim, dim> A =
+ apply_transformation(data.covariant[i],
+ transpose(input[i]));
output[i] =
apply_transformation(data.covariant[i], A.transpose());
}
{
DerivativeForm<1, spacedim, dim> A =
apply_transformation(data.covariant[i], input[i]);
- Tensor<2, spacedim> T = apply_transformation(
- data.contravariant[i], A.transpose());
+ Tensor<2, spacedim> T =
+ apply_transformation(data.contravariant[i],
+ A.transpose());
output[i] = transpose(T);
output[i] /= data.volume_elements[i];
const ArrayView<Tensor<3, spacedim>> & output)
{
AssertDimension(input.size(), output.size());
- Assert(
- (dynamic_cast<const typename dealii::MappingManifold<dim, spacedim>::
- InternalData *>(&mapping_data) != nullptr),
- ExcInternalError());
+ Assert((dynamic_cast<const typename dealii::
+ MappingManifold<dim, spacedim>::InternalData *>(
+ &mapping_data) != nullptr),
+ ExcInternalError());
const typename dealii::MappingManifold<dim, spacedim>::InternalData
&data =
static_cast<const typename dealii::MappingManifold<dim, spacedim>::
const ArrayView<Tensor<rank + 1, spacedim>> & output)
{
AssertDimension(input.size(), output.size());
- Assert(
- (dynamic_cast<const typename dealii::MappingManifold<dim, spacedim>::
- InternalData *>(&mapping_data) != nullptr),
- ExcInternalError());
+ Assert((dynamic_cast<const typename dealii::
+ MappingManifold<dim, spacedim>::InternalData *>(
+ &mapping_data) != nullptr),
+ ExcInternalError());
const typename dealii::MappingManifold<dim, spacedim>::InternalData
&data =
static_cast<const typename dealii::MappingManifold<dim, spacedim>::
const typename Mapping<dim, spacedim>::InternalDataBase &mapping_data,
const ArrayView<Tensor<1, spacedim>> & output) const
{
- internal::MappingManifoldImplementation::transform_fields(
- input, mapping_type, mapping_data, output);
+ internal::MappingManifoldImplementation::transform_fields(input,
+ mapping_type,
+ mapping_data,
+ output);
}
switch (mapping_type)
{
case mapping_contravariant:
- internal::MappingManifoldImplementation::transform_fields(
- input, mapping_type, mapping_data, output);
+ internal::MappingManifoldImplementation::transform_fields(input,
+ mapping_type,
+ mapping_data,
+ output);
return;
case mapping_piola_gradient:
template <int dim, int spacedim>
-MappingQ<dim, spacedim>::InternalData::InternalData() :
- use_mapping_q1_on_current_cell(false)
+MappingQ<dim, spacedim>::InternalData::InternalData()
+ : use_mapping_q1_on_current_cell(false)
{}
template <int dim, int spacedim>
MappingQ<dim, spacedim>::MappingQ(const unsigned int degree,
- const bool use_mapping_q_on_all_cells) :
- polynomial_degree(degree),
+ const bool use_mapping_q_on_all_cells)
+ : polynomial_degree(degree)
+ ,
// see whether we want to use *this* mapping objects on *all* cells,
// or defer to an explicit Q1 mapping on interior cells. if
// it; if dim!=spacedim, there is also no need for anything because
// we're most likely on a curved manifold
use_mapping_q_on_all_cells(degree == 1 || use_mapping_q_on_all_cells ||
- (dim != spacedim)),
+ (dim != spacedim))
+ ,
// create a Q1 mapping for use on interior cells (if necessary)
// or to create a good initial guess in transform_real_to_unit_cell()
- q1_mapping(std::make_shared<MappingQGeneric<dim, spacedim>>(1)),
+ q1_mapping(std::make_shared<MappingQGeneric<dim, spacedim>>(1))
+ ,
// create a Q_p mapping; if p=1, simply share the Q_1 mapping already
// created via the shared_ptr objects
template <int dim, int spacedim>
-MappingQ<dim, spacedim>::MappingQ(const MappingQ<dim, spacedim> &mapping) :
- polynomial_degree(mapping.polynomial_degree),
- use_mapping_q_on_all_cells(mapping.use_mapping_q_on_all_cells)
+MappingQ<dim, spacedim>::MappingQ(const MappingQ<dim, spacedim> &mapping)
+ : polynomial_degree(mapping.polynomial_degree)
+ , use_mapping_q_on_all_cells(mapping.use_mapping_q_on_all_cells)
{
// Note that we really do have to use clone() here, since mapping.q1_mapping
// may be MappingQ1Eulerian and mapping.qp_mapping may be MappingQEulerian.
template <int dim, int spacedim>
-MappingQ1<dim, spacedim>::MappingQ1() : MappingQGeneric<dim, spacedim>(1)
+MappingQ1<dim, spacedim>::MappingQ1()
+ : MappingQGeneric<dim, spacedim>(1)
{}
template <int dim, class VectorType, int spacedim>
MappingQ1Eulerian<dim, VectorType, spacedim>::MappingQ1Eulerian(
const DoFHandler<dim, spacedim> &shiftmap_dof_handler,
- const VectorType & euler_transform_vectors) :
- MappingQGeneric<dim, spacedim>(1),
- euler_transform_vectors(&euler_transform_vectors),
- shiftmap_dof_handler(&shiftmap_dof_handler)
+ const VectorType & euler_transform_vectors)
+ : MappingQGeneric<dim, spacedim>(1)
+ , euler_transform_vectors(&euler_transform_vectors)
+ , shiftmap_dof_handler(&shiftmap_dof_handler)
{}
MappingQEulerian<dim, VectorType, spacedim>::MappingQEulerianGeneric::
MappingQEulerianGeneric(
const unsigned int degree,
- const MappingQEulerian<dim, VectorType, spacedim> &mapping_q_eulerian) :
- MappingQGeneric<dim, spacedim>(degree),
- mapping_q_eulerian(mapping_q_eulerian),
- support_quadrature(degree),
- fe_values(mapping_q_eulerian.euler_dof_handler->get_fe(),
- support_quadrature,
- update_values | update_quadrature_points)
+ const MappingQEulerian<dim, VectorType, spacedim> &mapping_q_eulerian)
+ : MappingQGeneric<dim, spacedim>(degree)
+ , mapping_q_eulerian(mapping_q_eulerian)
+ , support_quadrature(degree)
+ , fe_values(mapping_q_eulerian.euler_dof_handler->get_fe(),
+ support_quadrature,
+ update_values | update_quadrature_points)
{}
const unsigned int degree,
const DoFHandler<dim, spacedim> &euler_dof_handler,
const VectorType & euler_vector,
- const unsigned int level) :
- MappingQ<dim, spacedim>(degree, true),
- euler_vector(&euler_vector),
- euler_dof_handler(&euler_dof_handler),
- level(level)
+ const unsigned int level)
+ : MappingQ<dim, spacedim>(degree, true)
+ , euler_vector(&euler_vector)
+ , euler_dof_handler(&euler_dof_handler)
+ , level(level)
{
// reset the q1 mapping we use for interior cells (and previously
// set by the MappingQ constructor) to a MappingQ1Eulerian with the
template <int dim, class VectorType, int spacedim>
MappingQEulerian<dim, VectorType, spacedim>::MappingQEulerianGeneric::
- SupportQuadrature::SupportQuadrature(const unsigned int map_degree) :
- Quadrature<dim>(Utilities::fixed_power<dim>(map_degree + 1))
+ SupportQuadrature::SupportQuadrature(const unsigned int map_degree)
+ : Quadrature<dim>(Utilities::fixed_power<dim>(map_degree + 1))
{
// first we determine the support points on the unit cell in lexicographic
// order, which are (in accordance with MappingQ) the support points of
if (mg_vector)
{
dof_cell->get_mg_dof_indices(dof_indices);
- fe_values.get_function_values(
- *mapping_q_eulerian.euler_vector, dof_indices, shift_vector);
+ fe_values.get_function_values(*mapping_q_eulerian.euler_vector,
+ dof_indices,
+ shift_vector);
}
else
fe_values.get_function_values(*mapping_q_eulerian.euler_vector,
template <int dim, int spacedim>
MappingQGeneric<dim, spacedim>::InternalData::InternalData(
- const unsigned int polynomial_degree) :
- polynomial_degree(polynomial_degree),
- n_shape_functions(Utilities::fixed_power<dim>(polynomial_degree + 1)),
- line_support_points(QGaussLobatto<1>(polynomial_degree + 1)),
- tensor_product_quadrature(false)
+ const unsigned int polynomial_degree)
+ : polynomial_degree(polynomial_degree)
+ , n_shape_functions(Utilities::fixed_power<dim>(polynomial_degree + 1))
+ , line_support_points(QGaussLobatto<1>(polynomial_degree + 1))
+ , tensor_product_quadrature(false)
{}
GeometryInfo<1>::vertices_per_cell);
for (unsigned int q = 0; q < polynomial_degree - 1; ++q)
for (unsigned int i = 0; i < GeometryInfo<1>::vertices_per_cell; ++i)
- output[0](q, i) = GeometryInfo<1>::d_linear_shape_function(
- quadrature.point(q + 1), i);
+ output[0](q, i) =
+ GeometryInfo<1>::d_linear_shape_function(quadrature.point(q + 1),
+ i);
if (dim > 1)
output[1] = compute_support_point_weights_on_quad(polynomial_degree);
template <int dim, int spacedim>
-MappingQGeneric<dim, spacedim>::MappingQGeneric(const unsigned int p) :
- polynomial_degree(p),
- line_support_points(this->polynomial_degree + 1),
- fe_q(dim == 3 ? new FE_Q<dim>(this->polynomial_degree) : nullptr),
- support_point_weights_perimeter_to_interior(
- internal::MappingQGenericImplementation::
- compute_support_point_weights_perimeter_to_interior(
- this->polynomial_degree,
- dim)),
- support_point_weights_cell(
- internal::MappingQGenericImplementation::compute_support_point_weights_cell<
- dim>(this->polynomial_degree))
+MappingQGeneric<dim, spacedim>::MappingQGeneric(const unsigned int p)
+ : polynomial_degree(p)
+ , line_support_points(this->polynomial_degree + 1)
+ , fe_q(dim == 3 ? new FE_Q<dim>(this->polynomial_degree) : nullptr)
+ , support_point_weights_perimeter_to_interior(
+ internal::MappingQGenericImplementation::
+ compute_support_point_weights_perimeter_to_interior(
+ this->polynomial_degree,
+ dim))
+ , support_point_weights_cell(
+ internal::MappingQGenericImplementation::
+ compute_support_point_weights_cell<dim>(this->polynomial_degree))
{
Assert(p >= 1,
ExcMessage("It only makes sense to create polynomial mappings "
template <int dim, int spacedim>
MappingQGeneric<dim, spacedim>::MappingQGeneric(
- const MappingQGeneric<dim, spacedim> &mapping) :
- polynomial_degree(mapping.polynomial_degree),
- line_support_points(mapping.line_support_points),
- fe_q(dim == 3 ? new FE_Q<dim>(*mapping.fe_q) : nullptr),
- support_point_weights_perimeter_to_interior(
- mapping.support_point_weights_perimeter_to_interior),
- support_point_weights_cell(mapping.support_point_weights_cell)
+ const MappingQGeneric<dim, spacedim> &mapping)
+ : polynomial_degree(mapping.polynomial_degree)
+ , line_support_points(mapping.line_support_points)
+ , fe_q(dim == 3 ? new FE_Q<dim>(*mapping.fe_q) : nullptr)
+ , support_point_weights_perimeter_to_interior(
+ mapping.support_point_weights_perimeter_to_interior)
+ , support_point_weights_cell(mapping.support_point_weights_cell)
{}
// dispatch to the various specializations for spacedim=dim,
// spacedim=dim+1, etc
return internal::MappingQGenericImplementation::
- do_transform_real_to_unit_cell_internal_codim1<1>(
- cell, p, initial_p_unit, *mdata);
+ do_transform_real_to_unit_cell_internal_codim1<1>(cell,
+ p,
+ initial_p_unit,
+ *mdata);
}
// dispatch to the various specializations for spacedim=dim,
// spacedim=dim+1, etc
return internal::MappingQGenericImplementation::
- do_transform_real_to_unit_cell_internal_codim1<2>(
- cell, p, initial_p_unit, *mdata);
+ do_transform_real_to_unit_cell_internal_codim1<2>(cell,
+ p,
+ initial_p_unit,
+ *mdata);
}
template <>
// perform the Newton iteration and return the result. note that this
// statement may throw an exception, which we simply pass up to the
// caller
- return this->transform_real_to_unit_cell_internal(
- cell, p, initial_p_unit);
+ return this->transform_real_to_unit_cell_internal(cell,
+ p,
+ initial_p_unit);
}
}
QProjector<dim>::DataSetDescriptor::cell(),
data);
- internal::MappingQGenericImplementation::
- maybe_update_jacobian_grads<dim, spacedim>(
- computed_cell_similarity,
- QProjector<dim>::DataSetDescriptor::cell(),
- data,
- output_data.jacobian_grads);
+ internal::MappingQGenericImplementation::maybe_update_jacobian_grads<
+ dim,
+ spacedim>(computed_cell_similarity,
+ QProjector<dim>::DataSetDescriptor::cell(),
+ data,
+ output_data.jacobian_grads);
}
internal::MappingQGenericImplementation::
{
AssertDimension(output_data.JxW_values.size(), n_q_points);
- Assert(
- !(update_flags & update_normal_vectors) ||
- (output_data.normal_vectors.size() == n_q_points),
- ExcDimensionMismatch(output_data.normal_vectors.size(), n_q_points));
+ Assert(!(update_flags & update_normal_vectors) ||
+ (output_data.normal_vectors.size() == n_q_points),
+ ExcDimensionMismatch(output_data.normal_vectors.size(),
+ n_q_points));
if (computed_cell_similarity != CellSimilarity::translation)
{
maybe_compute_q_points<dim, spacedim>(
data_set, data, output_data.quadrature_points);
- maybe_update_Jacobians<dim, spacedim>(
- CellSimilarity::none, data_set, data);
+ maybe_update_Jacobians<dim, spacedim>(CellSimilarity::none,
+ data_set,
+ data);
maybe_update_jacobian_grads<dim, spacedim>(
CellSimilarity::none, data_set, data, output_data.jacobian_grads);
}
const ArrayView<Tensor<rank, spacedim>> & output)
{
AssertDimension(input.size(), output.size());
- Assert(
- (dynamic_cast<const typename dealii::MappingQGeneric<dim, spacedim>::
- InternalData *>(&mapping_data) != nullptr),
- ExcInternalError());
+ Assert((dynamic_cast<const typename dealii::
+ MappingQGeneric<dim, spacedim>::InternalData *>(
+ &mapping_data) != nullptr),
+ ExcInternalError());
const typename dealii::MappingQGeneric<dim, spacedim>::InternalData
&data =
static_cast<const typename dealii::MappingQGeneric<dim, spacedim>::
const ArrayView<Tensor<rank, spacedim>> & output)
{
AssertDimension(input.size(), output.size());
- Assert(
- (dynamic_cast<const typename dealii::MappingQGeneric<dim, spacedim>::
- InternalData *>(&mapping_data) != nullptr),
- ExcInternalError());
+ Assert((dynamic_cast<const typename dealii::
+ MappingQGeneric<dim, spacedim>::InternalData *>(
+ &mapping_data) != nullptr),
+ ExcInternalError());
const typename dealii::MappingQGeneric<dim, spacedim>::InternalData
&data =
static_cast<const typename dealii::MappingQGeneric<dim, spacedim>::
for (unsigned int i = 0; i < output.size(); ++i)
{
- DerivativeForm<1, spacedim, dim> A = apply_transformation(
- data.contravariant[i], transpose(input[i]));
+ DerivativeForm<1, spacedim, dim> A =
+ apply_transformation(data.contravariant[i],
+ transpose(input[i]));
output[i] =
apply_transformation(data.covariant[i], A.transpose());
}
for (unsigned int i = 0; i < output.size(); ++i)
{
- DerivativeForm<1, spacedim, dim> A = apply_transformation(
- data.covariant[i], transpose(input[i]));
+ DerivativeForm<1, spacedim, dim> A =
+ apply_transformation(data.covariant[i],
+ transpose(input[i]));
output[i] =
apply_transformation(data.covariant[i], A.transpose());
}
{
DerivativeForm<1, spacedim, dim> A =
apply_transformation(data.covariant[i], input[i]);
- Tensor<2, spacedim> T = apply_transformation(
- data.contravariant[i], A.transpose());
+ Tensor<2, spacedim> T =
+ apply_transformation(data.contravariant[i],
+ A.transpose());
output[i] = transpose(T);
output[i] /= data.volume_elements[i];
const ArrayView<Tensor<3, spacedim>> & output)
{
AssertDimension(input.size(), output.size());
- Assert(
- (dynamic_cast<const typename dealii::MappingQGeneric<dim, spacedim>::
- InternalData *>(&mapping_data) != nullptr),
- ExcInternalError());
+ Assert((dynamic_cast<const typename dealii::
+ MappingQGeneric<dim, spacedim>::InternalData *>(
+ &mapping_data) != nullptr),
+ ExcInternalError());
const typename dealii::MappingQGeneric<dim, spacedim>::InternalData
&data =
static_cast<const typename dealii::MappingQGeneric<dim, spacedim>::
const ArrayView<Tensor<rank + 1, spacedim>> & output)
{
AssertDimension(input.size(), output.size());
- Assert(
- (dynamic_cast<const typename dealii::MappingQGeneric<dim, spacedim>::
- InternalData *>(&mapping_data) != nullptr),
- ExcInternalError());
+ Assert((dynamic_cast<const typename dealii::
+ MappingQGeneric<dim, spacedim>::InternalData *>(
+ &mapping_data) != nullptr),
+ ExcInternalError());
const typename dealii::MappingQGeneric<dim, spacedim>::InternalData
&data =
static_cast<const typename dealii::MappingQGeneric<dim, spacedim>::
const typename Mapping<dim, spacedim>::InternalDataBase &mapping_data,
const ArrayView<Tensor<1, spacedim>> & output) const
{
- internal::MappingQGenericImplementation::transform_fields(
- input, mapping_type, mapping_data, output);
+ internal::MappingQGenericImplementation::transform_fields(input,
+ mapping_type,
+ mapping_data,
+ output);
}
switch (mapping_type)
{
case mapping_contravariant:
- internal::MappingQGenericImplementation::transform_fields(
- input, mapping_type, mapping_data, output);
+ internal::MappingQGenericImplementation::transform_fields(input,
+ mapping_type,
+ mapping_data,
+ output);
return;
case mapping_piola_gradient:
const std::size_t n_rows = support_point_weights_cell.size(0);
a.resize(a.size() + n_rows);
auto a_view = make_array_view(a.end() - n_rows, a.end());
- cell->get_manifold().get_new_points(
- make_array_view(a.begin(), a.end() - n_rows),
- support_point_weights_cell,
- a_view);
+ cell->get_manifold().get_new_points(make_array_view(a.begin(),
+ a.end() - n_rows),
+ support_point_weights_cell,
+ a_view);
}
else
switch (dim)
{
AdditionalParameters::AdditionalParameters(
const double characteristic_length,
- const std::string &output_base_name) :
- characteristic_length(characteristic_length),
- output_base_name(output_base_name)
+ const std::string &output_base_name)
+ : characteristic_length(characteristic_length)
+ , output_base_name(output_base_name)
{}
<< log_file_name << " 2> " << warnings_file_name;
const auto ret_value = std::system(command.str().c_str());
- AssertThrow(
- ret_value == 0,
- ExcMessage("Gmsh failed to run. Check the " + log_file_name + " file."));
+ AssertThrow(ret_value == 0,
+ ExcMessage("Gmsh failed to run. Check the " + log_file_name +
+ " file."));
std::ifstream grid_file(msh_file_name);
Assert(grid_file, ExcIO());
ExcMessage("Failed to remove " + *filename));
}
const auto ret_value = std::remove(dir_template);
- AssertThrow(
- ret_value == 0,
- ExcMessage("Failed to remove " + std::string(dir_template)));
+ AssertThrow(ret_value == 0,
+ ExcMessage("Failed to remove " +
+ std::string(dir_template)));
}
}
# endif
DEAL_II_NAMESPACE_OPEN
-CellId::CellId() :
- coarse_cell_id(numbers::invalid_unsigned_int),
- n_child_indices(numbers::invalid_unsigned_int)
+CellId::CellId()
+ : coarse_cell_id(numbers::invalid_unsigned_int)
+ , n_child_indices(numbers::invalid_unsigned_int)
{
// initialize the child indices to invalid values
// (the only allowed values are between zero and
CellId::CellId(const unsigned int coarse_cell_id,
- const std::vector<std::uint8_t> &id) :
- coarse_cell_id(coarse_cell_id),
- n_child_indices(id.size())
+ const std::vector<std::uint8_t> &id)
+ : coarse_cell_id(coarse_cell_id)
+ , n_child_indices(id.size())
{
Assert(n_child_indices < child_indices.size(), ExcInternalError());
std::copy(id.begin(), id.end(), child_indices.begin());
CellId::CellId(const unsigned int coarse_cell_id,
const unsigned int n_child_indices,
- const std::uint8_t *id) :
- coarse_cell_id(coarse_cell_id),
- n_child_indices(n_child_indices)
+ const std::uint8_t *id)
+ : coarse_cell_id(coarse_cell_id)
+ , n_child_indices(n_child_indices)
{
Assert(n_child_indices < child_indices.size(), ExcInternalError());
memcpy(&(child_indices[0]), id, n_child_indices);
typename Triangulation<dim, spacedim>::cell_iterator
CellId::to_cell(const Triangulation<dim, spacedim> &tria) const
{
- typename Triangulation<dim, spacedim>::cell_iterator cell(
- &tria, 0, coarse_cell_id);
+ typename Triangulation<dim, spacedim>::cell_iterator cell(&tria,
+ 0,
+ coarse_cell_id);
for (unsigned int i = 0; i < n_child_indices; ++i)
cell = cell->child(static_cast<unsigned int>(child_indices[i]));
const double r)
{
const unsigned int dim = 3;
- Assert(
- n_cells > 4,
- ExcMessage("More than 4 cells are needed to create a moebius grid."));
+ Assert(n_cells > 4,
+ ExcMessage(
+ "More than 4 cells are needed to create a moebius grid."));
Assert(r > 0 && R > 0,
ExcMessage("Outer and inner radius must be positive."));
Assert(R > r,
// Check that the order of the vertices makes sense, i.e., the volume of the
// cell is positive.
- Assert(
- GridTools::volume(tria) > 0.,
- ExcMessage("The volume of the cell is not greater than zero. "
- "This could be due to the wrong ordering of the vertices."));
+ Assert(GridTools::volume(tria) > 0.,
+ ExcMessage(
+ "The volume of the cell is not greater than zero. "
+ "This could be due to the wrong ordering of the vertices."));
}
{
// Check that the first two vectors are not linear combinations to
// avoid zero division later on.
- Assert(
- std::abs(edges[0] * edges[1] /
- (edges[0].norm() * edges[1].norm()) -
- 1.0) > 1.0e-15,
- ExcMessage("Edges in subdivided_parallelepiped() must point in"
- " different directions."));
+ Assert(std::abs(edges[0] * edges[1] /
+ (edges[0].norm() * edges[1].norm()) -
+ 1.0) > 1.0e-15,
+ ExcMessage(
+ "Edges in subdivided_parallelepiped() must point in"
+ " different directions."));
const Tensor<1, spacedim> plane_normal =
cross_product_3d(edges[0], edges[1]);
double epsilon = 10;
for (unsigned int i = 0; i < dim; ++i)
epsilon = std::min(epsilon, 0.01 * delta[i][i]);
- Assert(
- epsilon > 0,
- ExcMessage("The distance between corner points must be positive."))
+ Assert(epsilon > 0,
+ ExcMessage(
+ "The distance between corner points must be positive."))
// actual code is external since
// 1-D is different from 2/3D.
double x = 0;
for (unsigned int j = 0; j < step_sizes.at(i).size(); j++)
x += step_sizes[i][j];
- Assert(
- std::fabs(x - (p2(i) - p1(i))) <= 1e-12 * std::fabs(x),
- ExcMessage("The sequence of step sizes in coordinate direction " +
- Utilities::int_to_string(i) +
- " must be equal to the distance of the two given "
- "points in this coordinate direction."));
+ Assert(std::fabs(x - (p2(i) - p1(i))) <= 1e-12 * std::fabs(x),
+ ExcMessage(
+ "The sequence of step sizes in coordinate direction " +
+ Utilities::int_to_string(i) +
+ " must be equal to the distance of the two given "
+ "points in this coordinate direction."));
}
double min_size =
*std::min_element(step_sizes[0].begin(), step_sizes[0].end());
for (unsigned int i = 1; i < dim; ++i)
- min_size = std::min(
- min_size,
- *std::min_element(step_sizes[i].begin(), step_sizes[i].end()));
+ min_size = std::min(min_size,
+ *std::min_element(step_sizes[i].begin(),
+ step_sizes[i].end()));
const double epsilon = 0.01 * min_size;
// actual code is external since
const double right,
const bool colorize)
{
- const double rl2 = (right + left) / 2;
- const Point<2> vertices[10] = {Point<2>(left, left),
+ const double rl2 = (right + left) / 2;
+ const Point<2> vertices[10] = {Point<2>(left, left),
Point<2>(rl2, left),
Point<2>(rl2, rl2),
Point<2>(left, rl2),
Point<2>(left, right),
Point<2>(right, right),
Point<2>(rl2, left)};
- const int cell_vertices[4][4] = {
- {0, 1, 3, 2}, {9, 4, 2, 5}, {3, 2, 7, 6}, {2, 5, 6, 8}};
+ const int cell_vertices[4][4] = {{0, 1, 3, 2},
+ {9, 4, 2, 5},
+ {3, 2, 7, 6},
+ {2, 5, 6, 8}};
std::vector<CellData<2>> cells(4, CellData<2>());
for (unsigned int i = 0; i < 4; ++i)
{
cells[i].vertices[j] = cell_vertices[i][j];
cells[i].material_id = 0;
}
- tria.create_triangulation(
- std::vector<Point<2>>(std::begin(vertices), std::end(vertices)),
- cells,
- SubCellData()); // no boundary information
+ tria.create_triangulation(std::vector<Point<2>>(std::begin(vertices),
+ std::end(vertices)),
+ cells,
+ SubCellData()); // no boundary information
if (colorize)
{
cells[i].material_id = 0;
}
- tria.create_triangulation(
- std::vector<Point<2>>(std::begin(vertices), std::end(vertices)),
- cells,
- SubCellData());
+ tria.create_triangulation(std::vector<Point<2>>(std::begin(vertices),
+ std::end(vertices)),
+ cells,
+ SubCellData());
if (colorize)
{
cells[i].manifold_id = i == 2 ? 1 : numbers::flat_manifold_id;
}
- tria.create_triangulation(
- std::vector<Point<2>>(std::begin(vertices), std::end(vertices)),
- cells,
- SubCellData()); // no boundary information
+ tria.create_triangulation(std::vector<Point<2>>(std::begin(vertices),
+ std::end(vertices)),
+ cells,
+ SubCellData()); // no boundary information
tria.set_all_manifold_ids_on_boundary(0);
tria.set_manifold(0, SphericalManifold<2>(p));
if (internal_manifolds)
// equilibrate cell sizes at
// transition from the inner part
// to the radial cells
- const Point<dim> vertices[7] = {
- p + Point<dim>(0, 0) * radius,
- p + Point<dim>(+1, 0) * radius,
- p + Point<dim>(+1, 0) * (radius / 2),
- p + Point<dim>(0, +1) * (radius / 2),
- p + Point<dim>(+1, +1) * (radius / (2 * sqrt(2.0))),
- p + Point<dim>(0, +1) * radius,
- p + Point<dim>(+1, +1) * (radius / std::sqrt(2.0))};
+ const Point<dim> vertices[7] = {p + Point<dim>(0, 0) * radius,
+ p + Point<dim>(+1, 0) * radius,
+ p + Point<dim>(+1, 0) * (radius / 2),
+ p + Point<dim>(0, +1) * (radius / 2),
+ p + Point<dim>(+1, +1) *
+ (radius / (2 * sqrt(2.0))),
+ p + Point<dim>(0, +1) * radius,
+ p + Point<dim>(+1, +1) *
+ (radius / std::sqrt(2.0))};
const int cell_vertices[3][4] = {{0, 2, 3, 4}, {1, 6, 2, 4}, {5, 3, 6, 4}};
cells[i].material_id = 0;
}
- tria.create_triangulation(
- std::vector<Point<dim>>(std::begin(vertices), std::end(vertices)),
- cells,
- SubCellData()); // no boundary information
+ tria.create_triangulation(std::vector<Point<dim>>(std::begin(vertices),
+ std::end(vertices)),
+ cells,
+ SubCellData()); // no boundary information
Triangulation<dim>::cell_iterator cell = tria.begin();
Triangulation<dim>::cell_iterator end = tria.end();
p + Point<2>(0, +1) * radius,
p + Point<2>(+1, +1) * (radius / std::sqrt(2.0))};
- const int cell_vertices[5][4] = {
- {0, 1, 2, 3}, {2, 3, 4, 5}, {1, 7, 3, 5}, {6, 4, 7, 5}};
+ const int cell_vertices[5][4] = {{0, 1, 2, 3},
+ {2, 3, 4, 5},
+ {1, 7, 3, 5},
+ {6, 4, 7, 5}};
std::vector<CellData<2>> cells(4, CellData<2>());
cells[i].material_id = 0;
}
- tria.create_triangulation(
- std::vector<Point<2>>(std::begin(vertices), std::end(vertices)),
- cells,
- SubCellData()); // no boundary information
+ tria.create_triangulation(std::vector<Point<2>>(std::begin(vertices),
+ std::end(vertices)),
+ cells,
+ SubCellData()); // no boundary information
Triangulation<2>::cell_iterator cell = tria.begin();
Triangulation<2>::cell_iterator end = tria.end();
cells[i].vertices[j] = cell_vertices[i][j];
cells[i].material_id = 0;
}
- tria.create_triangulation(
- std::vector<Point<3>>(std::begin(vertices), std::end(vertices)),
- cells,
- SubCellData()); // no boundary information
+ tria.create_triangulation(std::vector<Point<3>>(std::begin(vertices),
+ std::end(vertices)),
+ cells,
+ SubCellData()); // no boundary information
if (colorize)
{
for (unsigned int x = 0; x < 4; ++x)
vertices[k++] = Point<3>(coords[x], coords[y], coords[z]);
- const types::material_id materials[27] = {
- 21, 20, 22, 17, 16, 18, 25, 24, 26, 5, 4, 6, 1, 0,
- 2, 9, 8, 10, 37, 36, 38, 33, 32, 34, 41, 40, 42};
+ const types::material_id materials[27] = {21, 20, 22, 17, 16, 18, 25,
+ 24, 26, 5, 4, 6, 1, 0,
+ 2, 9, 8, 10, 37, 36, 38,
+ 33, 32, 34, 41, 40, 42};
std::vector<CellData<3>> cells(27);
k = 0;
cells[i].material_id = 0;
}
- tria.create_triangulation(
- std::vector<Point<3>>(std::begin(vertices), std::end(vertices)),
- cells,
- SubCellData()); // no boundary information
+ tria.create_triangulation(std::vector<Point<3>>(std::begin(vertices),
+ std::end(vertices)),
+ cells,
+ SubCellData()); // no boundary information
if (colorize)
{
cells[i].manifold_id = i == 0 ? numbers::flat_manifold_id : 1;
}
- tria.create_triangulation(
- std::vector<Point<3>>(std::begin(vertices), std::end(vertices)),
- cells,
- SubCellData()); // no boundary information
+ tria.create_triangulation(std::vector<Point<3>>(std::begin(vertices),
+ std::end(vertices)),
+ cells,
+ SubCellData()); // no boundary information
tria.set_all_manifold_ids_on_boundary(0);
tria.set_manifold(0, SphericalManifold<3>(p));
if (internal_manifold)
cells[i].material_id = 0;
}
- tria.create_triangulation(
- std::vector<Point<3>>(std::begin(vertices), std::end(vertices)),
- cells,
- SubCellData()); // no boundary information
+ tria.create_triangulation(std::vector<Point<3>>(std::begin(vertices),
+ std::end(vertices)),
+ cells,
+ SubCellData()); // no boundary information
// set boundary indicators for the
// faces at the ends to 1 and 2,
cells[i].material_id = 0;
}
- tria.create_triangulation(
- std::vector<Point<dim>>(std::begin(vertices), std::end(vertices)),
- cells,
- SubCellData()); // no boundary information
+ tria.create_triangulation(std::vector<Point<dim>>(std::begin(vertices),
+ std::end(vertices)),
+ cells,
+ SubCellData()); // no boundary information
Triangulation<dim>::cell_iterator cell = tria.begin();
Triangulation<dim>::cell_iterator end = tria.end();
cells[i].material_id = 0;
}
- tria.create_triangulation(
- std::vector<Point<3>>(std::begin(vertices), std::end(vertices)),
- cells,
- SubCellData()); // no boundary information
+ tria.create_triangulation(std::vector<Point<3>>(std::begin(vertices),
+ std::end(vertices)),
+ cells,
+ SubCellData()); // no boundary information
Triangulation<3>::cell_iterator cell = tria.begin();
Triangulation<3>::cell_iterator end = tria.end();
cells[i].material_id = 0;
}
- tria.create_triangulation(
- std::vector<Point<3>>(std::begin(vertices), std::end(vertices)),
- cells,
- SubCellData()); // no boundary information
+ tria.create_triangulation(std::vector<Point<3>>(std::begin(vertices),
+ std::end(vertices)),
+ cells,
+ SubCellData()); // no boundary information
}
else
{
cells[i].material_id = 0;
}
- tria.create_triangulation(
- vertices, cells, SubCellData()); // no boundary information
+ tria.create_triangulation(vertices,
+ cells,
+ SubCellData()); // no boundary information
}
else
{
for (unsigned int j = 0; j <= N_z; ++j)
for (unsigned int i = 0; i < 2 * N_r; ++i)
{
- const Point<3> v(
- vertices_2d[i][0], vertices_2d[i][1], j * length / N_z);
+ const Point<3> v(vertices_2d[i][0],
+ vertices_2d[i][1],
+ j * length / N_z);
vertices_3d.push_back(v);
}
++cell)
if (cells_to_remove.find(cell) == cells_to_remove.end())
{
- Assert(
- static_cast<unsigned int>(cell->level()) ==
- input_triangulation.n_levels() - 1,
- ExcMessage("Your input triangulation appears to have "
- "adaptively refined cells. This is not allowed. You can "
- "only call this function on a triangulation in which "
- "all cells are on the same refinement level."));
+ Assert(static_cast<unsigned int>(cell->level()) ==
+ input_triangulation.n_levels() - 1,
+ ExcMessage(
+ "Your input triangulation appears to have "
+ "adaptively refined cells. This is not allowed. You can "
+ "only call this function on a triangulation in which "
+ "all cells are on the same refinement level."));
CellData<dim> this_cell;
for (unsigned int v = 0; v < GeometryInfo<dim>::vertices_per_cell;
// necessary and create the triangulation
SubCellData subcell_data;
std::vector<unsigned int> considered_vertices;
- GridTools::delete_duplicated_vertices(
- vertices, cells, subcell_data, considered_vertices);
+ GridTools::delete_duplicated_vertices(vertices,
+ cells,
+ subcell_data,
+ considered_vertices);
// then clear the old triangulation and create the new one
result.clear();
const double height,
Triangulation<3, 3> & result)
{
- Assert(
- input.n_levels() == 1,
- ExcMessage("The input triangulation must be a coarse mesh, i.e., it must "
- "not have been refined."));
+ Assert(input.n_levels() == 1,
+ ExcMessage(
+ "The input triangulation must be a coarse mesh, i.e., it must "
+ "not have been refined."));
Assert(result.n_cells() == 0,
ExcMessage("The output triangulation object needs to be empty."));
Assert(height > 0,
ExcMessage("The given height for extrusion must be positive."));
- Assert(
- n_slices >= 2,
- ExcMessage("The number of slices for extrusion must be at least 2."));
+ Assert(n_slices >= 2,
+ ExcMessage(
+ "The number of slices for extrusion must be at least 2."));
const double delta_h = height / (n_slices - 1);
std::vector<double> slices_z_values;
const std::vector<double> &slice_coordinates,
Triangulation<3, 3> & result)
{
- Assert(
- input.n_levels() == 1,
- ExcMessage("The input triangulation must be a coarse mesh, i.e., it must "
- "not have been refined."));
+ Assert(input.n_levels() == 1,
+ ExcMessage(
+ "The input triangulation must be a coarse mesh, i.e., it must "
+ "not have been refined."));
Assert(result.n_cells() == 0,
ExcMessage("The output triangulation object needs to be empty."));
- Assert(
- slice_coordinates.size() >= 2,
- ExcMessage("The number of slices for extrusion must be at least 2."));
+ Assert(slice_coordinates.size() >= 2,
+ ExcMessage(
+ "The number of slices for extrusion must be at least 2."));
const unsigned int n_slices = slice_coordinates.size();
Assert(std::is_sorted(slice_coordinates.begin(), slice_coordinates.end()),
ExcMessage("Slice z-coordinates should be in ascending order"));
// then mark the bottom and top boundaries of the extruded mesh
// with max_boundary_id+1 and max_boundary_id+2. check that this
// remains valid
- Assert(
- (max_boundary_id != numbers::invalid_boundary_id) &&
- (max_boundary_id + 1 != numbers::invalid_boundary_id) &&
- (max_boundary_id + 2 != numbers::invalid_boundary_id),
- ExcMessage("The input triangulation to this function is using boundary "
- "indicators in a range that do not allow using "
- "max_boundary_id+1 and max_boundary_id+2 as boundary "
- "indicators for the bottom and top faces of the "
- "extruded triangulation."));
+ Assert((max_boundary_id != numbers::invalid_boundary_id) &&
+ (max_boundary_id + 1 != numbers::invalid_boundary_id) &&
+ (max_boundary_id + 2 != numbers::invalid_boundary_id),
+ ExcMessage(
+ "The input triangulation to this function is using boundary "
+ "indicators in a range that do not allow using "
+ "max_boundary_id+1 and max_boundary_id+2 as boundary "
+ "indicators for the bottom and top faces of the "
+ "extruded triangulation."));
for (Triangulation<2, 2>::cell_iterator cell = input.begin();
cell != input.end();
++cell)
} // namespace
template <int dim, int spacedim>
-GridIn<dim, spacedim>::GridIn() :
- tria(nullptr, typeid(*this).name()),
- default_format(ucd)
+GridIn<dim, spacedim>::GridIn()
+ : tria(nullptr, typeid(*this).name())
+ , default_format(ucd)
{}
}
else
- AssertThrow(
- false,
- ExcMessage("While reading VTK file, failed to find POINTS section"));
+ AssertThrow(false,
+ ExcMessage(
+ "While reading VTK file, failed to find POINTS section"));
//////////////////ignoring space between points and cells
}
}
else
- AssertThrow(
- false,
- ExcMessage("While reading VTK file, failed to find CELLS section"));
+ AssertThrow(false,
+ ExcMessage(
+ "While reading VTK file, failed to find CELLS section"));
/////////////////////Processing the CELL_TYPES
/// section////////////////////////
if (linenew.size() > textnew[0].size())
linenew.resize(textnew[0].size());
- AssertThrow(
- linenew.compare(textnew[i]) == 0,
- ExcMessage(
- std::string("While reading VTK file, failed to find <") +
- textnew[i] + "> section"));
+ AssertThrow(linenew.compare(textnew[i]) == 0,
+ ExcMessage(
+ std::string(
+ "While reading VTK file, failed to find <") +
+ textnew[i] + "> section"));
}
// read material ids first for all cells, then for all
return;
}
else
- AssertThrow(
- false,
- ExcMessage("While reading VTK file, failed to find CELLS section"));
+ AssertThrow(false,
+ ExcMessage(
+ "While reading VTK file, failed to find CELLS section"));
}
no_quad++;
}
else
- AssertThrow(
- false,
- ExcMessage("Unknown element label <" +
- Utilities::int_to_string(type) +
- "> when running in dim=" + Utilities::int_to_string(dim)));
+ AssertThrow(false,
+ ExcMessage("Unknown element label <" +
+ Utilities::int_to_string(type) +
+ "> when running in dim=" +
+ Utilities::int_to_string(dim)));
}
// note that so far all materials and bcs are explicitly set to 0
else
{
// no such vertex index
- AssertThrow(
- false, ExcInvalidVertexIndex(cell, cells.back().vertices[i]));
+ AssertThrow(false,
+ ExcInvalidVertexIndex(cell,
+ cells.back().vertices[i]));
cells.back().vertices[i] = numbers::invalid_unsigned_int;
}
std::numeric_limits<types::boundary_id>::max()));
// we use only boundary_ids in the range from 0 to
// numbers::internal_face_boundary_id-1
- Assert(
- material_id < numbers::internal_face_boundary_id,
- ExcIndexRange(material_id, 0, numbers::internal_face_boundary_id));
+ Assert(material_id < numbers::internal_face_boundary_id,
+ ExcIndexRange(material_id,
+ 0,
+ numbers::internal_face_boundary_id));
if (apply_all_indicators_to_manifolds)
subcelldata.boundary_lines.back().manifold_id =
else
{
// no such vertex index
- AssertThrow(
- false,
- ExcInvalidVertexIndex(
- cell, subcelldata.boundary_lines.back().vertices[i]));
+ AssertThrow(false,
+ ExcInvalidVertexIndex(
+ cell,
+ subcelldata.boundary_lines.back().vertices[i]));
subcelldata.boundary_lines.back().vertices[i] =
numbers::invalid_unsigned_int;
};
std::numeric_limits<types::boundary_id>::max()));
// we use only boundary_ids in the range from 0 to
// numbers::internal_face_boundary_id-1
- Assert(
- material_id < numbers::internal_face_boundary_id,
- ExcIndexRange(material_id, 0, numbers::internal_face_boundary_id));
+ Assert(material_id < numbers::internal_face_boundary_id,
+ ExcIndexRange(material_id,
+ 0,
+ numbers::internal_face_boundary_id));
if (apply_all_indicators_to_manifolds)
subcelldata.boundary_quads.back().manifold_id =
{
AssertThrow(vertex_indices.find(cells.back().vertices[i]) !=
vertex_indices.end(),
- ExcInvalidVertexIndexGmsh(
- cell, elm_number, cells.back().vertices[i]));
+ ExcInvalidVertexIndexGmsh(cell,
+ elm_number,
+ cells.back().vertices[i]));
// vertex with this index exists
cells.back().vertices[i] =
std::numeric_limits<types::boundary_id>::max()));
// we use only boundary_ids in the range from 0 to
// numbers::internal_face_boundary_id-1
- Assert(
- material_id < numbers::internal_face_boundary_id,
- ExcIndexRange(material_id, 0, numbers::internal_face_boundary_id));
+ Assert(material_id < numbers::internal_face_boundary_id,
+ ExcIndexRange(material_id,
+ 0,
+ numbers::internal_face_boundary_id));
subcelldata.boundary_lines.back().boundary_id =
static_cast<types::boundary_id>(material_id);
else
{
// no such vertex index
- AssertThrow(
- false,
- ExcInvalidVertexIndex(
- cell, subcelldata.boundary_lines.back().vertices[i]));
+ AssertThrow(false,
+ ExcInvalidVertexIndex(
+ cell,
+ subcelldata.boundary_lines.back().vertices[i]));
subcelldata.boundary_lines.back().vertices[i] =
numbers::invalid_unsigned_int;
};
std::numeric_limits<types::boundary_id>::max()));
// we use only boundary_ids in the range from 0 to
// numbers::internal_face_boundary_id-1
- Assert(
- material_id < numbers::internal_face_boundary_id,
- ExcIndexRange(material_id, 0, numbers::internal_face_boundary_id));
+ Assert(material_id < numbers::internal_face_boundary_id,
+ ExcIndexRange(material_id,
+ 0,
+ numbers::internal_face_boundary_id));
subcelldata.boundary_quads.back().boundary_id =
static_cast<types::boundary_id>(material_id);
ExcIO());
std::vector<int> vertex_indices(n_bquads * vertices_per_quad);
- vertex_indices_var->get(
- &*vertex_indices.begin(), n_bquads, vertices_per_quad);
+ vertex_indices_var->get(&*vertex_indices.begin(),
+ n_bquads,
+ vertices_per_quad);
for (unsigned int i = 0; i < vertex_indices.size(); ++i)
AssertThrow(vertex_indices[i] >= 0, ExcIO());
AssertThrow(bvertex_indices_var->is_valid(), ExcIO());
AssertThrow(bvertex_indices_var->num_dims() == 2, ExcIO());
const unsigned int n_bquads = bvertex_indices_var->get_dim(0)->size();
- AssertThrow(
- static_cast<unsigned int>(bvertex_indices_var->get_dim(1)->size()) ==
- GeometryInfo<dim>::vertices_per_face,
- ExcIO());
+ AssertThrow(static_cast<unsigned int>(
+ bvertex_indices_var->get_dim(1)->size()) ==
+ GeometryInfo<dim>::vertices_per_face,
+ ExcIO());
std::vector<int> bvertex_indices(n_bquads * vertices_per_quad);
- bvertex_indices_var->get(
- &*bvertex_indices.begin(), n_bquads, vertices_per_quad);
+ bvertex_indices_var->get(&*bvertex_indices.begin(),
+ n_bquads,
+ vertices_per_quad);
// next we read
// int boundarymarker_of_surfaces(
else if (Utilities::match_at_string_start(entries[i], "ZONETYPE="))
// unsupported ZONETYPE
{
- AssertThrow(
- false,
- ExcMessage("The tecplot file contains an unsupported ZONETYPE."));
+ AssertThrow(false,
+ ExcMessage(
+ "The tecplot file contains an unsupported ZONETYPE."));
}
else if (Utilities::match_at_string_start(entries[i],
"DATAPACKING=POINT"))
// or o-type grids around a body
// (airfoil). this automatically deletes
// unused vertices as well.
- GridTools::delete_duplicated_vertices(
- vertices, cells, subcelldata, boundary_vertices);
+ GridTools::delete_duplicated_vertices(vertices,
+ cells,
+ subcelldata,
+ boundary_vertices);
}
else
{
Assimp::Importer importer;
// And have it read the given file with some postprocessing
- const aiScene *scene = importer.ReadFile(
- filename.c_str(),
- aiProcess_RemoveComponent | aiProcess_JoinIdenticalVertices |
- aiProcess_ImproveCacheLocality | aiProcess_SortByPType |
- aiProcess_OptimizeGraph | aiProcess_OptimizeMeshes);
+ const aiScene *scene =
+ importer.ReadFile(filename.c_str(),
+ aiProcess_RemoveComponent |
+ aiProcess_JoinIdenticalVertices |
+ aiProcess_ImproveCacheLocality | aiProcess_SortByPType |
+ aiProcess_OptimizeGraph | aiProcess_OptimizeMeshes);
// If the import failed, report it
AssertThrow(scene, ExcMessage(importer.GetErrorString()))
// consists only of spaces, and
// if not put the whole thing
// back and return
- if (std::find_if(
- line.begin(),
- line.end(),
- std::bind(std::not_equal_to<char>(), std::placeholders::_1, ' ')) !=
- line.end())
+ if (std::find_if(line.begin(),
+ line.end(),
+ std::bind(std::not_equal_to<char>(),
+ std::placeholders::_1,
+ ' ')) != line.end())
{
in.putback('\n');
for (int i = line.length() - 1; i >= 0; --i)
namespace
{
template <int dim>
- Abaqus_to_UCD<dim>::Abaqus_to_UCD() :
- tolerance(5e-16) // Used to offset Cubit tolerance error when outputting
- // value close to zero
+ Abaqus_to_UCD<dim>::Abaqus_to_UCD()
+ : tolerance(5e-16) // Used to offset Cubit tolerance error when outputting
+ // value close to zero
{
AssertThrow(dim == 2 || dim == 3, ExcNotImplemented());
}
goto cont;
// Change all characters to upper case
- std::transform(
- line.begin(), line.end(), line.begin(), ::toupper);
+ std::transform(line.begin(),
+ line.end(),
+ line.begin(),
+ ::toupper);
// Surface can be created from ELSET, or directly from cells
// If elsets_list contains a key with specific name - refers to
line.find("MATERIAL=") + material_key.size();
const std::size_t material_id_start = line.find('-', last_equal);
int material_id = 0;
- from_string(
- material_id, line.substr(material_id_start + 1), std::dec);
+ from_string(material_id,
+ line.substr(material_id_start + 1),
+ std::dec);
// Assign material id to cells
const std::vector<int> &elset_cells = elsets_list[elset_name];
const bool write_faces,
const bool write_diameter,
const bool write_measure,
- const bool write_all_faces) :
- write_cells(write_cells),
- write_faces(write_faces),
- write_diameter(write_diameter),
- write_measure(write_measure),
- write_all_faces(write_all_faces)
+ const bool write_all_faces)
+ : write_cells(write_cells)
+ , write_faces(write_faces)
+ , write_diameter(write_diameter)
+ , write_measure(write_measure)
+ , write_all_faces(write_all_faces)
{}
void
}
- Msh::Msh(const bool write_faces, const bool write_lines) :
- write_faces(write_faces),
- write_lines(write_lines)
+ Msh::Msh(const bool write_faces, const bool write_lines)
+ : write_faces(write_faces)
+ , write_lines(write_lines)
{}
void
Ucd::Ucd(const bool write_preamble,
const bool write_faces,
- const bool write_lines) :
- write_preamble(write_preamble),
- write_faces(write_faces),
- write_lines(write_lines)
+ const bool write_lines)
+ : write_preamble(write_preamble)
+ , write_faces(write_faces)
+ , write_lines(write_lines)
{}
Gnuplot::Gnuplot(const bool write_cell_numbers,
const unsigned int n_extra_curved_line_points,
const bool curved_inner_cells,
- const bool write_additional_boundary_lines) :
- write_cell_numbers(write_cell_numbers),
- n_extra_curved_line_points(n_extra_curved_line_points),
- n_boundary_face_points(this->n_extra_curved_line_points),
- curved_inner_cells(curved_inner_cells),
- write_additional_boundary_lines(write_additional_boundary_lines)
+ const bool write_additional_boundary_lines)
+ : write_cell_numbers(write_cell_numbers)
+ , n_extra_curved_line_points(n_extra_curved_line_points)
+ , n_boundary_face_points(this->n_extra_curved_line_points)
+ , curved_inner_cells(curved_inner_cells)
+ , write_additional_boundary_lines(write_additional_boundary_lines)
{}
// TODO we can get rid of these extra constructors and assignment operators
// once we remove the reference member variable.
- Gnuplot::Gnuplot(const Gnuplot &flags) :
- Gnuplot(flags.write_cell_numbers,
- flags.n_extra_curved_line_points,
- flags.curved_inner_cells,
- flags.write_additional_boundary_lines)
+ Gnuplot::Gnuplot(const Gnuplot &flags)
+ : Gnuplot(flags.write_cell_numbers,
+ flags.n_extra_curved_line_points,
+ flags.curved_inner_cells,
+ flags.write_additional_boundary_lines)
{}
const double line_width,
const bool color_lines_on_user_flag,
const unsigned int n_boundary_face_points,
- const bool color_lines_level) :
- size_type(size_type),
- size(size),
- line_width(line_width),
- color_lines_on_user_flag(color_lines_on_user_flag),
- n_boundary_face_points(n_boundary_face_points),
- color_lines_level(color_lines_level)
+ const bool color_lines_level)
+ : size_type(size_type)
+ , size(size)
+ , line_width(line_width)
+ , color_lines_on_user_flag(color_lines_on_user_flag)
+ , n_boundary_face_points(n_boundary_face_points)
+ , color_lines_level(color_lines_level)
{}
"Depending on this parameter, either the"
"width or height "
"of the eps is scaled to \"Size\"");
- param.declare_entry(
- "Size", "300", Patterns::Integer(), "Size of the output in points");
+ param.declare_entry("Size",
+ "300",
+ Patterns::Integer(),
+ "Size of the output in points");
param.declare_entry("Line width",
"0.5",
Patterns::Double(),
const unsigned int size,
const double line_width,
const bool color_lines_on_user_flag,
- const unsigned int n_boundary_face_points) :
- EpsFlagsBase(size_type,
- size,
- line_width,
- color_lines_on_user_flag,
- n_boundary_face_points)
+ const unsigned int n_boundary_face_points)
+ : EpsFlagsBase(size_type,
+ size,
+ line_width,
+ color_lines_on_user_flag,
+ n_boundary_face_points)
{}
const bool write_cell_numbers,
const bool write_cell_number_level,
const bool write_vertex_numbers,
- const bool color_lines_level) :
- EpsFlagsBase(size_type,
- size,
- line_width,
- color_lines_on_user_flag,
- n_boundary_face_points,
- color_lines_level),
- write_cell_numbers(write_cell_numbers),
- write_cell_number_level(write_cell_number_level),
- write_vertex_numbers(write_vertex_numbers)
+ const bool color_lines_level)
+ : EpsFlagsBase(size_type,
+ size,
+ line_width,
+ color_lines_on_user_flag,
+ n_boundary_face_points,
+ color_lines_level)
+ , write_cell_numbers(write_cell_numbers)
+ , write_cell_number_level(write_cell_number_level)
+ , write_vertex_numbers(write_vertex_numbers)
{}
const bool color_lines_on_user_flag,
const unsigned int n_boundary_face_points,
const double azimut_angle,
- const double turn_angle) :
- EpsFlagsBase(size_type,
- size,
- line_width,
- color_lines_on_user_flag,
- n_boundary_face_points),
- azimut_angle(azimut_angle),
- turn_angle(turn_angle)
+ const double turn_angle)
+ : EpsFlagsBase(size_type,
+ size,
+ line_width,
+ color_lines_on_user_flag,
+ n_boundary_face_points)
+ , azimut_angle(azimut_angle)
+ , turn_angle(turn_angle)
{}
- XFig::XFig() :
- draw_boundary(true),
- color_by(material_id),
- level_depth(true),
- n_boundary_face_points(0),
- scaling(1., 1.),
- fill_style(20),
- line_style(0),
- line_thickness(1),
- boundary_style(0),
- boundary_thickness(3)
+ XFig::XFig()
+ : draw_boundary(true)
+ , color_by(material_id)
+ , level_depth(true)
+ , n_boundary_face_points(0)
+ , scaling(1., 1.)
+ , fill_style(20)
+ , line_style(0)
+ , line_thickness(1)
+ , boundary_style(0)
+ , boundary_thickness(3)
{}
const bool label_material_id,
const bool label_subdomain_id,
const bool draw_colorbar,
- const bool draw_legend) :
- height(1000),
- width(0),
- line_thickness(line_thickness),
- boundary_line_thickness(boundary_line_thickness),
- margin(margin),
- background(background),
- azimuth_angle(azimuth_angle),
- polar_angle(polar_angle),
- coloring(coloring),
- convert_level_number_to_height(convert_level_number_to_height),
- level_height_factor(0.3f),
- cell_font_scaling(1.f),
- label_level_number(label_level_number),
- label_cell_index(label_cell_index),
- label_material_id(label_material_id),
- label_subdomain_id(label_subdomain_id),
- label_level_subdomain_id(false),
- draw_colorbar(draw_colorbar),
- draw_legend(draw_legend)
+ const bool draw_legend)
+ : height(1000)
+ , width(0)
+ , line_thickness(line_thickness)
+ , boundary_line_thickness(boundary_line_thickness)
+ , margin(margin)
+ , background(background)
+ , azimuth_angle(azimuth_angle)
+ , polar_angle(polar_angle)
+ , coloring(coloring)
+ , convert_level_number_to_height(convert_level_number_to_height)
+ , level_height_factor(0.3f)
+ , cell_font_scaling(1.f)
+ , label_level_number(label_level_number)
+ , label_cell_index(label_cell_index)
+ , label_material_id(label_material_id)
+ , label_subdomain_id(label_subdomain_id)
+ , label_level_subdomain_id(false)
+ , draw_colorbar(draw_colorbar)
+ , draw_legend(draw_legend)
{}
- MathGL::MathGL() : draw_bounding_box(false) // box
+ MathGL::MathGL()
+ : draw_bounding_box(false) // box
{}
void
-GridOut::GridOut() : default_format(none)
+GridOut::GridOut()
+ : default_format(none)
{}
void
GridOut::declare_parameters(ParameterHandler ¶m)
{
- param.declare_entry(
- "Format", "none", Patterns::Selection(get_output_format_names()));
+ param.declare_entry("Format",
+ "none",
+ Patterns::Selection(get_output_format_names()));
param.enter_subsection("DX");
GridOutFlags::DX::declare_parameters(param);
LineEntry(const Point<2> & f,
const Point<2> & s,
const bool c,
- const unsigned int l) :
- first(f),
- second(s),
- colorize(c),
- level(l)
+ const unsigned int l)
+ : first(f)
+ , second(s)
+ , colorize(c)
+ , level(l)
{}
};
cell, q_projector.point(offset + i)));
const Point<2> p1(p1_dim(0), p1_dim(1));
- line_list.emplace_back(
- p0, p1, face->user_flag_set(), cell->level());
+ line_list.emplace_back(p0,
+ p1,
+ face->user_flag_set(),
+ cell->level());
p0 = p1;
}
// generate last piece
const Point<dim> p1_dim(face->vertex(1));
const Point<2> p1(p1_dim(0), p1_dim(1));
- line_list.emplace_back(
- p0, p1, face->user_flag_set(), cell->level());
+ line_list.emplace_back(p0,
+ p1,
+ face->user_flag_set(),
+ cell->level());
}
}
}
Assert(criteria.is_non_negative(), ExcNegativeCriteria());
const std::pair<double, double> adjusted_fractions =
- adjust_refine_and_coarsen_number_fraction<dim>(
- criteria.size(), max_n_cells, top_fraction, bottom_fraction);
+ adjust_refine_and_coarsen_number_fraction<dim>(criteria.size(),
+ max_n_cells,
+ top_fraction,
+ bottom_fraction);
const int refine_cells =
static_cast<int>(adjusted_fractions.first * criteria.size());
tmp.begin() + tmp.size() - coarsen_cells,
tmp.end(),
std::greater<double>());
- coarsen(
- tria, criteria, *(tmp.begin() + tmp.size() - coarsen_cells));
+ coarsen(tria,
+ criteria,
+ *(tmp.begin() + tmp.size() - coarsen_cells));
}
}
}
const double,
const unsigned int);
- template void
- GridRefinement::refine_and_coarsen_fixed_fraction<deal_II_dimension,
- S,
- deal_II_dimension>(
- Triangulation<deal_II_dimension> &,
- const dealii::Vector<S> &,
- const double,
- const double,
- const unsigned int);
+ template void GridRefinement::refine_and_coarsen_fixed_fraction<
+ deal_II_dimension,
+ S,
+ deal_II_dimension>(Triangulation<deal_II_dimension> &,
+ const dealii::Vector<S> &,
+ const double,
+ const double,
+ const unsigned int);
template void GridRefinement::
refine_and_coarsen_optimize<deal_II_dimension, S, deal_II_dimension>(
/**
* Construct an edge from the global indices of its two vertices.
*/
- CheapEdge(const unsigned int v0, const unsigned int v1) : v0(v0), v1(v1)
+ CheapEdge(const unsigned int v0, const unsigned int v1)
+ : v0(v0)
+ , v1(v1)
{}
/**
/**
* Default constructor. Initialize the fields with invalid values.
*/
- AdjacentCell() :
- cell_index(numbers::invalid_unsigned_int),
- edge_within_cell(numbers::invalid_unsigned_int)
+ AdjacentCell()
+ : cell_index(numbers::invalid_unsigned_int)
+ , edge_within_cell(numbers::invalid_unsigned_int)
{}
/**
* Constructor. Initialize the fields with the given values.
*/
AdjacentCell(const unsigned int cell_index,
- const unsigned int edge_within_cell) :
- cell_index(cell_index),
- edge_within_cell(edge_within_cell)
+ const unsigned int edge_within_cell)
+ : cell_index(cell_index)
+ , edge_within_cell(edge_within_cell)
{}
* in @p cell, and selecting the edge with number @p edge_number
* within this cell. Initialize the edge as unoriented.
*/
- Edge(const CellData<dim> &cell, const unsigned int edge_number) :
- orientation_status(not_oriented)
+ Edge(const CellData<dim> &cell, const unsigned int edge_number)
+ : orientation_status(not_oriented)
{
Assert(edge_number < GeometryInfo<dim>::lines_per_cell,
ExcInternalError());
unsigned int starting_vertex_of_edge[GeometryInfo<dim>::lines_per_cell];
for (unsigned int e = 0; e < GeometryInfo<dim>::lines_per_cell; ++e)
{
- Assert(
- edge_list[cell_list[cell_index].edge_indices[e]].orientation_status !=
- Edge<dim>::not_oriented,
- ExcInternalError());
+ Assert(edge_list[cell_list[cell_index].edge_indices[e]]
+ .orientation_status != Edge<dim>::not_oriented,
+ ExcInternalError());
if (edge_list[cell_list[cell_index].edge_indices[e]]
.orientation_status == Edge<dim>::forward)
starting_vertex_of_edge[e] =
// might work also on single cells, grids
// with both kind of cells are very likely to
// be broken. Check for this here.
- AssertThrow(
- n_negative_cells == 0 || n_negative_cells == cells.size(),
- ExcMessage(
- std::string("This class assumes that either all cells have positive "
+ AssertThrow(n_negative_cells == 0 || n_negative_cells == cells.size(),
+ ExcMessage(
+ std::string(
+ "This class assumes that either all cells have positive "
"volume, or that all cells have been specified in an "
"inverted vertex order so that their volume is negative. "
"(In the latter case, this class automatically inverts "
"negative volume. You need to check your mesh which "
"cells these are and how they got there.\n"
"As a hint, of the total ") +
- Utilities::to_string(cells.size()) + " cells in the mesh, " +
- Utilities::to_string(n_negative_cells) +
- " appear to have a negative volume."));
+ Utilities::to_string(cells.size()) + " cells in the mesh, " +
+ Utilities::to_string(n_negative_cells) +
+ " appear to have a negative volume."));
}
// wants a finite element. create a cheap element as a dummy
// element
FE_Nothing<dim, spacedim> dummy_fe;
- FEValues<dim, spacedim> fe_values(
- mapping, dummy_fe, quadrature_formula, update_JxW_values);
+ FEValues<dim, spacedim> fe_values(mapping,
+ dummy_fe,
+ quadrature_formula,
+ update_JxW_values);
typename Triangulation<dim, spacedim>::active_cell_iterator
cell = triangulation.begin_active(),
for (unsigned int c = 0; c < subcelldata.boundary_lines.size(); ++c)
for (unsigned int v = 0; v < GeometryInfo<1>::vertices_per_cell; ++v)
{
- Assert(
- subcelldata.boundary_lines[c].vertices[v] <
- new_vertex_numbers.size(),
- ExcMessage("Invalid vertex index in subcelldata.boundary_lines. "
- "subcelldata.boundary_lines[" +
- Utilities::int_to_string(c) + "].vertices[" +
- Utilities::int_to_string(v) + "]=" +
- Utilities::int_to_string(
- subcelldata.boundary_lines[c].vertices[v]) +
- " is invalid, because only " +
- Utilities::int_to_string(vertices.size()) +
- " vertices were supplied."));
+ Assert(subcelldata.boundary_lines[c].vertices[v] <
+ new_vertex_numbers.size(),
+ ExcMessage(
+ "Invalid vertex index in subcelldata.boundary_lines. "
+ "subcelldata.boundary_lines[" +
+ Utilities::int_to_string(c) + "].vertices[" +
+ Utilities::int_to_string(v) + "]=" +
+ Utilities::int_to_string(
+ subcelldata.boundary_lines[c].vertices[v]) +
+ " is invalid, because only " +
+ Utilities::int_to_string(vertices.size()) +
+ " vertices were supplied."));
subcelldata.boundary_lines[c].vertices[v] =
new_vertex_numbers[subcelldata.boundary_lines[c].vertices[v]];
}
for (unsigned int c = 0; c < subcelldata.boundary_quads.size(); ++c)
for (unsigned int v = 0; v < GeometryInfo<2>::vertices_per_cell; ++v)
{
- Assert(
- subcelldata.boundary_quads[c].vertices[v] <
- new_vertex_numbers.size(),
- ExcMessage("Invalid vertex index in subcelldata.boundary_quads. "
- "subcelldata.boundary_quads[" +
- Utilities::int_to_string(c) + "].vertices[" +
- Utilities::int_to_string(v) + "]=" +
- Utilities::int_to_string(
- subcelldata.boundary_quads[c].vertices[v]) +
- " is invalid, because only " +
- Utilities::int_to_string(vertices.size()) +
- " vertices were supplied."));
+ Assert(subcelldata.boundary_quads[c].vertices[v] <
+ new_vertex_numbers.size(),
+ ExcMessage(
+ "Invalid vertex index in subcelldata.boundary_quads. "
+ "subcelldata.boundary_quads[" +
+ Utilities::int_to_string(c) + "].vertices[" +
+ Utilities::int_to_string(v) + "]=" +
+ Utilities::int_to_string(
+ subcelldata.boundary_quads[c].vertices[v]) +
+ " is invalid, because only " +
+ Utilities::int_to_string(vertices.size()) +
+ " vertices were supplied."));
subcelldata.boundary_quads[c].vertices[v] =
new_vertex_numbers[subcelldata.boundary_quads[c].vertices[v]];
class Shift
{
public:
- explicit Shift(const Tensor<1, spacedim> &shift) : shift(shift)
+ explicit Shift(const Tensor<1, spacedim> &shift)
+ : shift(shift)
{}
Point<spacedim>
operator()(const Point<spacedim> p) const
class Rotate2d
{
public:
- explicit Rotate2d(const double angle) : angle(angle)
+ explicit Rotate2d(const double angle)
+ : angle(angle)
{}
Point<2>
operator()(const Point<2> &p) const
class Rotate3d
{
public:
- Rotate3d(const double angle, const unsigned int axis) :
- angle(angle),
- axis(axis)
+ Rotate3d(const double angle, const unsigned int axis)
+ : angle(angle)
+ , axis(axis)
{}
Point<3>
class Scale
{
public:
- explicit Scale(const double factor) : factor(factor)
+ explicit Scale(const double factor)
+ : factor(factor)
{}
Point<spacedim>
operator()(const Point<spacedim> p) const
almost_infinite_length);
// also note if a vertex is at the boundary
- std::vector<bool> at_boundary(
- keep_boundary ? triangulation.n_vertices() : 0, false);
+ std::vector<bool> at_boundary(keep_boundary ? triangulation.n_vertices() :
+ 0,
+ false);
// for parallel::shared::Triangulation we need to work on all vertices,
// not just the ones related to loacally owned cells;
const bool is_parallel_shared =
at_boundary[line->vertex_index(1)] = true;
}
- minimal_length[line->vertex_index(0)] = std::min(
- line->diameter(), minimal_length[line->vertex_index(0)]);
- minimal_length[line->vertex_index(1)] = std::min(
- line->diameter(), minimal_length[line->vertex_index(1)]);
+ minimal_length[line->vertex_index(0)] =
+ std::min(line->diameter(),
+ minimal_length[line->vertex_index(0)]);
+ minimal_length[line->vertex_index(1)] =
+ std::min(line->diameter(),
+ minimal_length[line->vertex_index(1)]);
}
}
else // dim==1
if (cell->at_boundary(vertex) == true)
at_boundary[cell->vertex_index(vertex)] = true;
- minimal_length[cell->vertex_index(0)] = std::min(
- cell->diameter(), minimal_length[cell->vertex_index(0)]);
- minimal_length[cell->vertex_index(1)] = std::min(
- cell->diameter(), minimal_length[cell->vertex_index(1)]);
+ minimal_length[cell->vertex_index(0)] =
+ std::min(cell->diameter(),
+ minimal_length[cell->vertex_index(0)]);
+ minimal_length[cell->vertex_index(1)] =
+ std::min(cell->diameter(),
+ minimal_length[cell->vertex_index(1)]);
}
}
const std::vector<Point<spacedim>> &vertices = tria.get_vertices();
- Assert(
- tria.get_vertices().size() == marked_vertices.size() ||
- marked_vertices.size() == 0,
- ExcDimensionMismatch(tria.get_vertices().size(), marked_vertices.size()));
+ Assert(tria.get_vertices().size() == marked_vertices.size() ||
+ marked_vertices.size() == 0,
+ ExcDimensionMismatch(tria.get_vertices().size(),
+ marked_vertices.size()));
// If p is an element of marked_vertices,
// and q is that of used_Vertices,
auto vertices = extract_used_vertices(tria, mapping);
- Assert(
- tria.get_vertices().size() == marked_vertices.size() ||
- marked_vertices.size() == 0,
- ExcDimensionMismatch(tria.get_vertices().size(), marked_vertices.size()));
+ Assert(tria.get_vertices().size() == marked_vertices.size() ||
+ marked_vertices.size() == 0,
+ ExcDimensionMismatch(tria.get_vertices().size(),
+ marked_vertices.size()));
// If p is an element of marked_vertices,
// and q is that of used_Vertices,
vertex_to_cell_centers[closest_vertex_index]);
};
- std::sort(
- neighbor_permutation.begin(), neighbor_permutation.end(), comp);
+ std::sort(neighbor_permutation.begin(),
+ neighbor_permutation.end(),
+ comp);
// It is possible the vertex is close
// to an edge, thus we add a tolerance
// setting it initially to 1e-10
ExcMessage("Error: couldn't merge bounding boxes!"));
}
}
- Assert(
- merged_b_boxes.size() <= max_boxes,
- ExcMessage("Error: couldn't reach target number of bounding boxes!"));
+ Assert(merged_b_boxes.size() <= max_boxes,
+ ExcMessage(
+ "Error: couldn't reach target number of bounding boxes!"));
return merged_b_boxes;
}
}
break; // We can check now the next process
}
}
- Assert(
- owners_found.size() > 0,
- ExcMessage("No owners found for the point " + std::to_string(pt)));
+ Assert(owners_found.size() > 0,
+ ExcMessage("No owners found for the point " +
+ std::to_string(pt)));
if (owners_found.size() == 1)
map_owners_found[pt] = owners_found[0];
else
adjacent_cell = vertex_to_cell[cell->vertex_index(i)].begin(),
end_adj_cell = vertex_to_cell[cell->vertex_index(i)].end();
for (; adjacent_cell != end_adj_cell; ++adjacent_cell)
- lowest_subdomain_id = std::min(
- lowest_subdomain_id, (*adjacent_cell)->subdomain_id());
+ lowest_subdomain_id =
+ std::min(lowest_subdomain_id,
+ (*adjacent_cell)->subdomain_id());
// See if I "own" this vertex
if (lowest_subdomain_id == cell->subdomain_id())
cell = triangulation.begin_active();
cell != triangulation.end();
++cell)
- indexmap[std::pair<unsigned int, unsigned int>(
- cell->level(), cell->index())] = cell->active_cell_index();
+ indexmap[std::pair<unsigned int, unsigned int>(cell->level(),
+ cell->index())] =
+ cell->active_cell_index();
// next loop over all cells and their neighbors to build the sparsity
// pattern. note that it's a bit hard to enter all the connections when a
}
// Call the other more general function
- partition_triangulation(
- n_partitions, cell_weights, triangulation, partitioner);
+ partition_triangulation(n_partitions,
+ cell_weights,
+ triangulation,
+ partitioner);
}
std::vector<types::global_dof_index> p4est_tree_to_coarse_cell_permutation;
DynamicSparsityPattern cell_connectivity;
- GridTools::get_vertex_connectivity_of_cells_on_level(
- triangulation, 0, cell_connectivity);
+ GridTools::get_vertex_connectivity_of_cells_on_level(triangulation,
+ 0,
+ cell_connectivity);
coarse_cell_to_p4est_tree_permutation.resize(triangulation.n_cells(0));
SparsityTools::reorder_hierarchical(cell_connectivity,
coarse_cell_to_p4est_tree_permutation);
get_subdomain_association(const Triangulation<dim, spacedim> &triangulation,
std::vector<types::subdomain_id> & subdomain)
{
- Assert(
- subdomain.size() == triangulation.n_active_cells(),
- ExcDimensionMismatch(subdomain.size(), triangulation.n_active_cells()));
+ Assert(subdomain.size() == triangulation.n_active_cells(),
+ ExcDimensionMismatch(subdomain.size(),
+ triangulation.n_active_cells()));
for (typename Triangulation<dim, spacedim>::active_cell_iterator cell =
triangulation.begin_active();
cell != triangulation.end();
++e)
diameter = std::min(
diameter,
- get_face_midpoint(
- object, f, std::integral_constant<int, structdim>())
+ get_face_midpoint(object,
+ f,
+ std::integral_constant<int, structdim>())
.distance(get_face_midpoint(
object, e, std::integral_constant<int, structdim>())));
reset_boundary_ids ?
std::vector<types::boundary_id>(src_boundary_ids.size(), 0) :
src_boundary_ids;
- map_boundary_to_manifold_ids(
- src_boundary_ids, dst_manifold_ids, tria, reset_boundary_id);
+ map_boundary_to_manifold_ids(src_boundary_ids,
+ dst_manifold_ids,
+ tria,
+ reset_boundary_id);
}
for (unsigned int f = 0; f < GeometryInfo<dim>::faces_per_cell; ++f)
{
if (cell->at_boundary(f) == false)
- cell->face(f)->set_manifold_id(std::min(
- cell->material_id(), cell->neighbor(f)->material_id()));
+ cell->face(f)->set_manifold_id(
+ std::min(cell->material_id(),
+ cell->neighbor(f)->material_id()));
else
cell->face(f)->set_manifold_id(cell->material_id());
}
subcelldata_to_add.boundary_quads.push_back(quad);
}
}
- GridTools::delete_unused_vertices(
- vertices, cells_to_add, subcelldata_to_add);
+ GridTools::delete_unused_vertices(vertices,
+ cells_to_add,
+ subcelldata_to_add);
GridReordering<dim, spacedim>::reorder_cells(cells_to_add, true);
// Save manifolds
auto &cell_maps = std::get<1>(current_c.first->second);
auto &cell_pts = std::get<2>(current_c.first->second);
auto &cell_ranks = std::get<3>(current_c.first->second);
- cell_qpts.insert(
- cell_qpts.end(), in_qpoints[c].begin(), in_qpoints[c].end());
- cell_maps.insert(
- cell_maps.end(), in_maps[c].begin(), in_maps[c].end());
- cell_pts.insert(
- cell_pts.end(), in_points[c].begin(), in_points[c].end());
+ cell_qpts.insert(cell_qpts.end(),
+ in_qpoints[c].begin(),
+ in_qpoints[c].end());
+ cell_maps.insert(cell_maps.end(),
+ in_maps[c].begin(),
+ in_maps[c].end());
+ cell_pts.insert(cell_pts.end(),
+ in_points[c].begin(),
+ in_points[c].end());
std::vector<unsigned int> ranks_tmp(in_points[c].size(),
in_rank);
- cell_ranks.insert(
- cell_ranks.end(), ranks_tmp.begin(), ranks_tmp.end());
+ cell_ranks.insert(cell_ranks.end(),
+ ranks_tmp.begin(),
+ ranks_tmp.end());
}
}
}
std::vector<std::vector<unsigned int>> in_maps;
std::vector<std::vector<Point<spacedim>>> in_points;
- auto cpt_loc_pts = compute_point_locations_unmap(
- cache, rank_and_points.second.first);
+ auto cpt_loc_pts =
+ compute_point_locations_unmap(cache,
+ rank_and_points.second.first);
for (const auto &map_c_pt_idx : cpt_loc_pts)
{
// Human-readable variables:
{
const auto &point_idx = pt_to_guesses.first;
const auto &probable_owners_rks = pt_to_guesses.second;
- if (!std::binary_search(
- classified_pts.begin(), classified_pts.end(), point_idx))
+ if (!std::binary_search(classified_pts.begin(),
+ classified_pts.end(),
+ point_idx))
// The point wasn't found in ghost or locally owned cells: adding it
// to the map
for (unsigned int i = 0; i < probable_owners_rks.size(); ++i)
// Step 6: use compute point locations on the uncertain points and
// merge output
- internal::distributed_cptloc::compute_and_merge_from_map(
- cache, check_pts, temporary_unmap, true);
+ internal::distributed_cptloc::compute_and_merge_from_map(cache,
+ check_pts,
+ temporary_unmap,
+ true);
// Copying data from the unordered map to the tuple
// and returning output
#ifndef DEAL_II_WITH_MPI
(void)local_bboxes;
(void)mpi_communicator;
- Assert(
- false,
- ExcMessage("GridTools::exchange_local_bounding_boxes() requires MPI."));
+ Assert(false,
+ ExcMessage(
+ "GridTools::exchange_local_bounding_boxes() requires MPI."));
return {};
#else
// Step 1: preparing data to be sent
{
template <int dim, int spacedim>
Cache<dim, spacedim>::Cache(const Triangulation<dim, spacedim> &tria,
- const Mapping<dim, spacedim> & mapping) :
- update_flags(update_all),
- tria(&tria),
- mapping(&mapping)
+ const Mapping<dim, spacedim> & mapping)
+ : update_flags(update_all)
+ , tria(&tria)
+ , mapping(&mapping)
{
tria_signal =
tria.signals.any_change.connect([&]() { mark_for_update(update_all); });
const std::vector<Point<spacedim>> &vertices = tria.get_vertices();
- Assert(
- tria.get_vertices().size() == marked_vertices.size() ||
- marked_vertices.size() == 0,
- ExcDimensionMismatch(tria.get_vertices().size(), marked_vertices.size()));
+ Assert(tria.get_vertices().size() == marked_vertices.size() ||
+ marked_vertices.size() == 0,
+ ExcDimensionMismatch(tria.get_vertices().size(),
+ marked_vertices.size()));
// If p is an element of marked_vertices,
// and q is that of used_Vertices,
auto vertices = extract_used_vertices(tria, mapping);
- Assert(
- tria.get_vertices().size() == marked_vertices.size() ||
- marked_vertices.size() == 0,
- ExcDimensionMismatch(tria.get_vertices().size(), marked_vertices.size()));
+ Assert(tria.get_vertices().size() == marked_vertices.size() ||
+ marked_vertices.size() == 0,
+ ExcDimensionMismatch(tria.get_vertices().size(),
+ marked_vertices.size()));
// If p is an element of marked_vertices,
// and q is that of used_Vertices,
const std::vector<typename MeshType::active_cell_iterator>
ghost_cell_layer_within_distance =
- compute_active_cell_layer_within_distance(
- mesh, predicate, layer_thickness);
+ compute_active_cell_layer_within_distance(mesh,
+ predicate,
+ layer_thickness);
// Check that we never return locally owned or artificial cells
// What is left should only be the ghost cells
const unsigned int size_new = matched_pairs.size();
for (unsigned int i = size_old; i < size_new; ++i)
{
- Assert(
- matched_pairs[i].orientation == 1,
- ExcMessage("Found a face match with non standard orientation. "
- "This function is only suitable for meshes with cells "
- "in default orientation"));
+ Assert(matched_pairs[i].orientation == 1,
+ ExcMessage(
+ "Found a face match with non standard orientation. "
+ "This function is only suitable for meshes with cells "
+ "in default orientation"));
}
#endif
}
template <class MeshType>
-InterGridMap<MeshType>::InterGridMap() :
- source_grid(nullptr, typeid(*this).name()),
- destination_grid(nullptr, typeid(*this).name())
+InterGridMap<MeshType>::InterGridMap()
+ : source_grid(nullptr, typeid(*this).name())
+ , destination_grid(nullptr, typeid(*this).name())
{}
Assert(n_points > 0, ExcMessage("There should be at least one point."));
- Assert(
- n_points == weights.size(),
- ExcMessage("There should be as many surrounding points as weights given."));
+ Assert(n_points == weights.size(),
+ ExcMessage(
+ "There should be as many surrounding points as weights given."));
Assert(std::abs(std::accumulate(weights.begin(), weights.end(), 0.0) - 1.0) <
tol,
weight = w / (weights[permutation[i]] + w);
if (std::abs(weight) > 1e-14)
- p = get_intermediate_point(
- p, surrounding_points[permutation[i]], 1.0 - weight);
+ p = get_intermediate_point(p,
+ surrounding_points[permutation[i]],
+ 1.0 - weight);
w += weights[permutation[i]];
}
for (unsigned int row = 0; row < weights.size(0); ++row)
{
- new_points[row] = get_new_point(
- make_array_view(surrounding_points.begin(), surrounding_points.end()),
- make_array_view(weights, row));
+ new_points[row] =
+ get_new_point(make_array_view(surrounding_points.begin(),
+ surrounding_points.end()),
+ make_array_view(weights, row));
}
}
const typename Triangulation<dim, spacedim>::line_iterator &line) const
{
const auto points_weights = get_default_points_and_weights(line);
- return get_new_point(
- make_array_view(points_weights.first.begin(), points_weights.first.end()),
- make_array_view(points_weights.second.begin(),
- points_weights.second.end()));
+ return get_new_point(make_array_view(points_weights.first.begin(),
+ points_weights.first.end()),
+ make_array_view(points_weights.second.begin(),
+ points_weights.second.end()));
}
const typename Triangulation<dim, spacedim>::quad_iterator &quad) const
{
const auto points_weights = get_default_points_and_weights(quad);
- return get_new_point(
- make_array_view(points_weights.first.begin(), points_weights.first.end()),
- make_array_view(points_weights.second.begin(),
- points_weights.second.end()));
+ return get_new_point(make_array_view(points_weights.first.begin(),
+ points_weights.first.end()),
+ make_array_view(points_weights.second.begin(),
+ points_weights.second.end()));
}
const Triangulation<3, 3>::hex_iterator &hex) const
{
const auto points_weights = get_default_points_and_weights(hex, true);
- return get_new_point(
- make_array_view(points_weights.first.begin(), points_weights.first.end()),
- make_array_view(points_weights.second.begin(),
- points_weights.second.end()));
+ return get_new_point(make_array_view(points_weights.first.begin(),
+ points_weights.first.end()),
+ make_array_view(points_weights.second.begin(),
+ points_weights.second.end()));
}
template <int dim, int spacedim>
FlatManifold<dim, spacedim>::FlatManifold(
const Tensor<1, spacedim> &periodicity,
- const double tolerance) :
- periodicity(periodicity),
- tolerance(tolerance)
+ const double tolerance)
+ : periodicity(periodicity)
+ , tolerance(tolerance)
{}
for (unsigned int i = 0; i < surrounding_points.size(); ++i)
{
minP[d] = std::min(minP[d], surrounding_points[i][d]);
- Assert(
- (surrounding_points[i][d] <
- periodicity[d] + tolerance * periodicity[d]) ||
- (surrounding_points[i][d] >= -tolerance * periodicity[d]),
- ExcPeriodicBox(d, surrounding_points[i], periodicity[d]));
+ Assert((surrounding_points[i][d] <
+ periodicity[d] + tolerance * periodicity[d]) ||
+ (surrounding_points[i][d] >=
+ -tolerance * periodicity[d]),
+ ExcPeriodicBox(d, surrounding_points[i], periodicity[d]));
}
// compute the weighted average point, possibly taking into account
// TODO should this use surrounding_points_start or surrounding_points?
// The older version used surrounding_points
- new_points[row] = project_to_manifold(
- make_array_view(surrounding_points.begin(), surrounding_points.end()),
- new_point);
+ new_points[row] =
+ project_to_manifold(make_array_view(surrounding_points.begin(),
+ surrounding_points.end()),
+ new_point);
}
}
{
const unsigned int vertices_per_face = GeometryInfo<3>::vertices_per_face;
- static const unsigned int neighboring_vertices[4][2] = {
- {1, 2}, {3, 0}, {0, 3}, {2, 1}};
+ static const unsigned int neighboring_vertices[4][2] = {{1, 2},
+ {3, 0},
+ {0, 3},
+ {2, 1}};
for (unsigned int vertex = 0; vertex < vertices_per_face; ++vertex)
{
// first define the two tangent vectors at the vertex by using the
/* -------------------------- ChartManifold --------------------- */
template <int dim, int spacedim, int chartdim>
ChartManifold<dim, spacedim, chartdim>::ChartManifold(
- const Tensor<1, chartdim> &periodicity) :
- sub_manifold(periodicity)
+ const Tensor<1, chartdim> &periodicity)
+ : sub_manifold(periodicity)
{}
// determinant is the product of chartdim factors, take the
// chartdim-th root of it in comparing against the size of the
// derivative
- Assert(
- std::pow(std::abs(F_prime.determinant()), 1. / chartdim) >=
- 1e-12 * F_prime.norm(),
- ExcMessage("The derivative of a chart function must not be singular."));
+ Assert(std::pow(std::abs(F_prime.determinant()), 1. / chartdim) >=
+ 1e-12 * F_prime.norm(),
+ ExcMessage(
+ "The derivative of a chart function must not be singular."));
const Tensor<1, chartdim> delta =
sub_manifold.get_tangent_vector(pull_back(x1), pull_back(x2));
// ============================================================
template <int dim, int spacedim>
-PolarManifold<dim, spacedim>::PolarManifold(const Point<spacedim> center) :
- ChartManifold<dim, spacedim, spacedim>(
- PolarManifold<dim, spacedim>::get_periodicity()),
- center(center)
+PolarManifold<dim, spacedim>::PolarManifold(const Point<spacedim> center)
+ : ChartManifold<dim, spacedim, spacedim>(
+ PolarManifold<dim, spacedim>::get_periodicity())
+ , center(center)
{}
template <int dim, int spacedim>
SphericalManifold<dim, spacedim>::SphericalManifold(
- const Point<spacedim> center) :
- center(center),
- polar_manifold(center)
+ const Point<spacedim> center)
+ : center(center)
+ , polar_manifold(center)
{}
}
const auto minmax_distance =
std::minmax_element(distances_to_center.begin(), distances_to_center.end());
- const auto min_distance_to_first_vertex = std::min_element(
- distances_to_first_vertex.begin(), distances_to_first_vertex.end());
+ const auto min_distance_to_first_vertex =
+ std::min_element(distances_to_first_vertex.begin(),
+ distances_to_first_vertex.end());
if (*minmax_distance.second - *minmax_distance.first <
1.e-10 * *min_distance_to_first_vertex)
}
const auto minmax_distance =
std::minmax_element(distances_to_center.begin(), distances_to_center.end());
- const auto min_distance_to_first_vertex = std::min_element(
- distances_to_first_vertex.begin(), distances_to_first_vertex.end());
+ const auto min_distance_to_first_vertex =
+ std::min_element(distances_to_first_vertex.begin(),
+ distances_to_first_vertex.end());
if (*minmax_distance.second - *minmax_distance.first <
1.e-10 * *min_distance_to_first_vertex)
// To avoid duplicating all of the logic in get_new_points, simply call it
// for one position.
Point<spacedim> new_point;
- get_new_points(
- vertices, weights, make_array_view(&new_point, &new_point + 1));
+ get_new_points(vertices,
+ weights,
+ make_array_view(&new_point, &new_point + 1));
return new_point;
}
const ArrayView<const Tensor<1, spacedim>> array_merged_directions =
make_array_view(merged_directions.begin(),
merged_directions.begin() + n_unique_directions);
- const ArrayView<const double> array_merged_distances = make_array_view(
- merged_distances.begin(), merged_distances.begin() + n_unique_directions);
+ const ArrayView<const double> array_merged_distances =
+ make_array_view(merged_distances.begin(),
+ merged_distances.begin() + n_unique_directions);
for (unsigned int row = 0; row < weight_rows; ++row)
if (!accurate_point_was_found[row])
SphericalManifold<3, 3> unit_manifold;
Assert(std::abs(weights[0] + weights[1] - 1.0) < 1e-13,
ExcMessage("Weights do not sum up to 1"));
- Point<3> intermediate = unit_manifold.get_intermediate_point(
- Point<3>(directions[0]), Point<3>(directions[1]), weights[1]);
+ Point<3> intermediate =
+ unit_manifold.get_intermediate_point(Point<3>(directions[0]),
+ Point<3>(directions[1]),
+ weights[1]);
return intermediate;
}
// CylindricalManifold
// ============================================================
template <int dim, int spacedim>
-CylindricalManifold<dim, spacedim>::CylindricalManifold(
- const unsigned int axis,
- const double tolerance) :
- CylindricalManifold<dim, spacedim>(Point<spacedim>::unit_vector(axis),
- Point<spacedim>(),
- tolerance)
+CylindricalManifold<dim, spacedim>::CylindricalManifold(const unsigned int axis,
+ const double tolerance)
+ : CylindricalManifold<dim, spacedim>(Point<spacedim>::unit_vector(axis),
+ Point<spacedim>(),
+ tolerance)
{
// do not use static_assert to make dimension-independent programming
// easier.
CylindricalManifold<dim, spacedim>::CylindricalManifold(
const Tensor<1, spacedim> &direction,
const Point<spacedim> & point_on_axis,
- const double tolerance) :
- ChartManifold<dim, spacedim, 3>(Tensor<1, 3>({0, 2. * numbers::PI, 0})),
- normal_direction(internal::compute_normal(direction, true)),
- direction(direction / direction.norm()),
- point_on_axis(point_on_axis),
- tolerance(tolerance)
+ const double tolerance)
+ : ChartManifold<dim, spacedim, 3>(Tensor<1, 3>({0, 2. * numbers::PI, 0}))
+ , normal_direction(internal::compute_normal(direction, true))
+ , direction(direction / direction.norm())
+ , point_on_axis(point_on_axis)
+ , tolerance(tolerance)
{
// do not use static_assert to make dimension-independent programming
// easier.
const Function<chartdim> & push_forward_function,
const Function<spacedim> & pull_back_function,
const Tensor<1, chartdim> &periodicity,
- const double tolerance) :
- ChartManifold<dim, spacedim, chartdim>(periodicity),
- push_forward_function(&push_forward_function),
- pull_back_function(&pull_back_function),
- tolerance(tolerance),
- owns_pointers(false),
- finite_difference_step(0)
+ const double tolerance)
+ : ChartManifold<dim, spacedim, chartdim>(periodicity)
+ , push_forward_function(&push_forward_function)
+ , pull_back_function(&pull_back_function)
+ , tolerance(tolerance)
+ , owns_pointers(false)
+ , finite_difference_step(0)
{
AssertDimension(push_forward_function.n_components, spacedim);
AssertDimension(pull_back_function.n_components, chartdim);
const std::string chart_vars,
const std::string space_vars,
const double tolerance,
- const double h) :
- ChartManifold<dim, spacedim, chartdim>(periodicity),
- const_map(const_map),
- tolerance(tolerance),
- owns_pointers(true),
- push_forward_expression(push_forward_expression),
- pull_back_expression(pull_back_expression),
- chart_vars(chart_vars),
- space_vars(space_vars),
- finite_difference_step(h)
+ const double h)
+ : ChartManifold<dim, spacedim, chartdim>(periodicity)
+ , const_map(const_map)
+ , tolerance(tolerance)
+ , owns_pointers(true)
+ , push_forward_expression(push_forward_expression)
+ , pull_back_expression(pull_back_expression)
+ , chart_vars(chart_vars)
+ , space_vars(space_vars)
+ , finite_difference_step(h)
{
FunctionParser<chartdim> *pf = new FunctionParser<chartdim>(spacedim, 0.0, h);
FunctionParser<spacedim> *pb = new FunctionParser<spacedim>(chartdim, 0.0, h);
template <int dim>
-TorusManifold<dim>::TorusManifold(const double R, const double r) :
- ChartManifold<dim, 3, 3>(Point<3>(2 * numbers::PI, 2 * numbers::PI, 0.0)),
- r(r),
- R(R)
+TorusManifold<dim>::TorusManifold(const double R, const double r)
+ : ChartManifold<dim, 3, 3>(Point<3>(2 * numbers::PI, 2 * numbers::PI, 0.0))
+ , r(r)
+ , R(R)
{
Assert(R > r,
ExcMessage("Outer radius R must be greater than the inner "
// ============================================================
template <int dim, int spacedim>
TransfiniteInterpolationManifold<dim,
- spacedim>::TransfiniteInterpolationManifold() :
- triangulation(nullptr),
- level_coarse(-1)
+ spacedim>::TransfiniteInterpolationManifold()
+ : triangulation(nullptr)
+ , level_coarse(-1)
{
AssertThrow(dim > 1, ExcNotImplemented());
}
if (line_manifold_id == my_manifold_id ||
line_manifold_id == numbers::invalid_manifold_id)
{
- weights_vertices[GeometryInfo<2>::line_to_cell_vertices(
- line, 0)] -= my_weight * (1. - line_point);
- weights_vertices[GeometryInfo<2>::line_to_cell_vertices(
- line, 1)] -= my_weight * line_point;
+ weights_vertices[GeometryInfo<2>::line_to_cell_vertices(line,
+ 0)] -=
+ my_weight * (1. - line_point);
+ weights_vertices[GeometryInfo<2>::line_to_cell_vertices(line,
+ 1)] -=
+ my_weight * line_point;
}
else
{
if (line_manifold_id == my_manifold_id ||
line_manifold_id == numbers::invalid_manifold_id)
{
- weights_vertices[GeometryInfo<3>::line_to_cell_vertices(
- line, 0)] -= my_weight * (1. - line_point);
- weights_vertices[GeometryInfo<3>::line_to_cell_vertices(
- line, 1)] -= my_weight * (line_point);
+ weights_vertices[GeometryInfo<3>::line_to_cell_vertices(line,
+ 0)] -=
+ my_weight * (1. - line_point);
+ weights_vertices[GeometryInfo<3>::line_to_cell_vertices(line,
+ 1)] -=
+ my_weight * (line_point);
}
else
{
Assert(GeometryInfo<dim>::is_inside_unit_cell(chart_point, 1e-6),
ExcMessage("chart_point is not in unit interval"));
- return compute_transfinite_interpolation(
- *cell, chart_point, coarse_cell_is_flat[cell->index()]);
+ return compute_transfinite_interpolation(*cell,
+ chart_point,
+ coarse_cell_is_flat[cell->index()]);
}
// avoid checking outside of the unit interval
modified[d] += step;
Tensor<1, spacedim> difference =
- compute_transfinite_interpolation(
- *cell, modified, coarse_cell_is_flat[cell->index()]) -
+ compute_transfinite_interpolation(*cell,
+ modified,
+ coarse_cell_is_flat[cell->index()]) -
pushed_forward_chart_point;
for (unsigned int e = 0; e < spacedim; ++e)
grad[e][d] = difference[e] / step;
// as those are relatively expensive and failure occurs quite regularly in
// the implementation of the compute_chart_points method.
Tensor<1, spacedim> residual =
- point - compute_transfinite_interpolation(
- *cell, chart_point, coarse_cell_is_flat[cell->index()]);
+ point -
+ compute_transfinite_interpolation(*cell,
+ chart_point,
+ coarse_cell_is_flat[cell->index()]);
const double tolerance = 1e-21 * Utilities::fixed_power<2>(cell->diameter());
double residual_norm_square = residual.norm_square();
DerivativeForm<1, dim, spacedim> inv_grad;
// chart region. Note that the Jacobian here represents the
// derivative of the forward map and should have a positive
// determinant since we use properly oriented meshes.
- DerivativeForm<1, dim, spacedim> grad = push_forward_gradient(
- cell, chart_point, Point<spacedim>(point - residual));
+ DerivativeForm<1, dim, spacedim> grad =
+ push_forward_gradient(cell,
+ chart_point,
+ Point<spacedim>(point - residual));
if (grad.determinant() <= 0.0)
return outside;
inv_grad = grad.covariant_form();
// check if point is inside 1.2 times the unit cell to avoid
// hitting points very far away from valid ones in the manifolds
- while (!GeometryInfo<dim>::is_inside_unit_cell(
- chart_point + alpha * update, 0.2) &&
- alpha > 1e-7)
+ while (
+ !GeometryInfo<dim>::is_inside_unit_cell(chart_point + alpha * update,
+ 0.2) &&
+ alpha > 1e-7)
alpha *= 0.5;
const Tensor<1, spacedim> old_residual = residual;
message << "Transformation to chart coordinates: " << std::endl;
for (unsigned int i = 0; i < surrounding_points.size(); ++i)
{
- message << surrounding_points[i] << " -> "
- << pull_back(
- cell,
- surrounding_points[i],
- cell->real_to_unit_cell_affine_approximation(
- surrounding_points[i]))
- << std::endl;
+ message
+ << surrounding_points[i] << " -> "
+ << pull_back(cell,
+ surrounding_points[i],
+ cell->real_to_unit_cell_affine_approximation(
+ surrounding_points[i]))
+ << std::endl;
}
}
boost::container::small_vector<Point<dim>, 100> new_points_on_chart(
weights.size(0));
- chart_manifold.get_new_points(
- chart_points_view,
- weights,
- make_array_view(new_points_on_chart.begin(), new_points_on_chart.end()));
+ chart_manifold.get_new_points(chart_points_view,
+ weights,
+ make_array_view(new_points_on_chart.begin(),
+ new_points_on_chart.end()));
for (unsigned int row = 0; row < weights.size(0); ++row)
new_points[row] = push_forward(cell, new_points_on_chart[row]);
template <int dim, int spacedim>
PersistentTriangulation<dim, spacedim>::PersistentTriangulation(
- const Triangulation<dim, spacedim> &coarse_grid) :
- coarse_grid(&coarse_grid, typeid(*this).name())
+ const Triangulation<dim, spacedim> &coarse_grid)
+ : coarse_grid(&coarse_grid, typeid(*this).name())
{}
template <int dim, int spacedim>
PersistentTriangulation<dim, spacedim>::PersistentTriangulation(
- const PersistentTriangulation<dim, spacedim> &old_tria) :
- // default initialize
- // tria, i.e. it will be
- // empty on first use
- Triangulation<dim, spacedim>(),
- coarse_grid(old_tria.coarse_grid),
- refine_flags(old_tria.refine_flags),
- coarsen_flags(old_tria.coarsen_flags)
+ const PersistentTriangulation<dim, spacedim> &old_tria)
+ : // default initialize
+ // tria, i.e. it will be
+ // empty on first use
+ Triangulation<dim, spacedim>()
+ , coarse_grid(old_tria.coarse_grid)
+ , refine_flags(old_tria.refine_flags)
+ , coarsen_flags(old_tria.coarsen_flags)
{
Assert(old_tria.n_levels() == 0, ExcTriaNotEmpty());
}
{
namespace TriangulationImplementation
{
- NumberCache<1>::NumberCache() : n_levels(0), n_lines(0), n_active_lines(0)
+ NumberCache<1>::NumberCache()
+ : n_levels(0)
+ , n_lines(0)
+ , n_active_lines(0)
// all other fields are
// default constructed
{}
}
- NumberCache<2>::NumberCache() : n_quads(0), n_active_quads(0)
+ NumberCache<2>::NumberCache()
+ : n_quads(0)
+ , n_active_quads(0)
// all other fields are
// default constructed
{}
- NumberCache<3>::NumberCache() : n_hexes(0), n_active_hexes(0)
+ NumberCache<3>::NumberCache()
+ : n_hexes(0)
+ , n_active_hexes(0)
// all other fields are
// default constructed
{}
const unsigned int face_no,
RefinementCase<dim - 1> &expected_face_ref_case)
{
- return face_will_be_refined_by_neighbor_internal(
- cell, face_no, expected_face_ref_case);
+ return face_will_be_refined_by_neighbor_internal(cell,
+ face_no,
+ expected_face_ref_case);
}
// throw an exception if no such cells should exist.
if (!triangulation.check_for_distorted_cells)
{
- const double cell_measure = GridTools::cell_measure<1>(
- triangulation.vertices, cells[cell_no].vertices);
+ const double cell_measure =
+ GridTools::cell_measure<1>(triangulation.vertices,
+ cells[cell_no].vertices);
AssertThrow(cell_measure > 0,
ExcGridHasInvalidCell(cell_no));
}
// See the note in the 1D function on this if statement.
if (!triangulation.check_for_distorted_cells)
{
- const double cell_measure = GridTools::cell_measure<2>(
- triangulation.vertices, cells[cell_no].vertices);
+ const double cell_measure =
+ GridTools::cell_measure<2>(triangulation.vertices,
+ cells[cell_no].vertices);
AssertThrow(cell_measure > 0,
ExcGridHasInvalidCell(cell_no));
}
// is at least two. if not so,
// then clean triangulation and
// exit with an exception
- AssertThrow(
- *(std::min_element(vertex_touch_count.begin(),
- vertex_touch_count.end())) >= 2,
- ExcMessage("During creation of a triangulation, a part of the "
- "algorithm encountered a vertex that is part of only "
- "a single adjacent line. However, in 2d, every vertex "
- "needs to be at least part of two lines."));
+ AssertThrow(*(std::min_element(vertex_touch_count.begin(),
+ vertex_touch_count.end())) >= 2,
+ ExcMessage(
+ "During creation of a triangulation, a part of the "
+ "algorithm encountered a vertex that is part of only "
+ "a single adjacent line. However, in 2d, every vertex "
+ "needs to be at least part of two lines."));
}
// reserve enough space
for (; boundary_line != end_boundary_line; ++boundary_line)
{
typename Triangulation<dim, spacedim>::line_iterator line;
- std::pair<int, int> line_vertices(std::make_pair(
- boundary_line->vertices[0], boundary_line->vertices[1]));
+ std::pair<int, int> line_vertices(
+ std::make_pair(boundary_line->vertices[0],
+ boundary_line->vertices[1]));
if (needed_lines.find(line_vertices) != needed_lines.end())
// line found in this direction
line = needed_lines[line_vertices];
}
// assert that we only set boundary info once
- AssertThrow(
- !(line->boundary_id() != 0 &&
- line->boundary_id() != numbers::internal_face_boundary_id),
- ExcMultiplySetLineInfoOfLine(line_vertices.first,
- line_vertices.second));
+ AssertThrow(!(line->boundary_id() != 0 &&
+ line->boundary_id() !=
+ numbers::internal_face_boundary_id),
+ ExcMultiplySetLineInfoOfLine(line_vertices.first,
+ line_vertices.second));
// Assert that only exterior lines are given a boundary
// indicator; however, it is possible that someone may
// See the note in the 1D function on this if statement.
if (!triangulation.check_for_distorted_cells)
{
- const double cell_measure = GridTools::cell_measure<3>(
- triangulation.vertices, cells[cell_no].vertices);
+ const double cell_measure =
+ GridTools::cell_measure<3>(triangulation.vertices,
+ cells[cell_no].vertices);
AssertThrow(cell_measure > 0, ExcGridHasInvalidCell(cell_no));
}
}
// later set the
// face_orientation flag
const internal::TriangulationImplementation::TriaObject<2>
- test_quad_1(
- quad.face(2),
- quad.face(3),
- quad.face(0),
- quad.face(1)), // face_orientation=false, face_flip=false,
- // face_rotation=false
- test_quad_2(
- quad.face(0),
- quad.face(1),
- quad.face(3),
- quad.face(2)), // face_orientation=false, face_flip=false,
- // face_rotation=true
- test_quad_3(
- quad.face(3),
- quad.face(2),
- quad.face(1),
- quad.face(0)), // face_orientation=false, face_flip=true,
- // face_rotation=false
- test_quad_4(
- quad.face(1),
- quad.face(0),
- quad.face(2),
- quad.face(3)), // face_orientation=false, face_flip=true,
- // face_rotation=true
- test_quad_5(
- quad.face(2),
- quad.face(3),
- quad.face(1),
- quad.face(0)), // face_orientation=true, face_flip=false,
- // face_rotation=true
- test_quad_6(
- quad.face(1),
- quad.face(0),
- quad.face(3),
- quad.face(2)), // face_orientation=true, face_flip=true,
- // face_rotation=false
- test_quad_7(
- quad.face(3),
- quad.face(2),
- quad.face(0),
- quad.face(1)); // face_orientation=true, face_flip=true,
- // face_rotation=true
+ test_quad_1(quad.face(2),
+ quad.face(3),
+ quad.face(0),
+ quad.face(
+ 1)), // face_orientation=false, face_flip=false,
+ // face_rotation=false
+ test_quad_2(quad.face(0),
+ quad.face(1),
+ quad.face(3),
+ quad.face(
+ 2)), // face_orientation=false, face_flip=false,
+ // face_rotation=true
+ test_quad_3(quad.face(3),
+ quad.face(2),
+ quad.face(1),
+ quad.face(
+ 0)), // face_orientation=false, face_flip=true,
+ // face_rotation=false
+ test_quad_4(quad.face(1),
+ quad.face(0),
+ quad.face(2),
+ quad.face(
+ 3)), // face_orientation=false, face_flip=true,
+ // face_rotation=true
+ test_quad_5(quad.face(2),
+ quad.face(3),
+ quad.face(1),
+ quad.face(
+ 0)), // face_orientation=true, face_flip=false,
+ // face_rotation=true
+ test_quad_6(quad.face(1),
+ quad.face(0),
+ quad.face(3),
+ quad.face(
+ 2)), // face_orientation=true, face_flip=true,
+ // face_rotation=false
+ test_quad_7(quad.face(3),
+ quad.face(2),
+ quad.face(0),
+ quad.face(
+ 1)); // face_orientation=true, face_flip=true,
+ // face_rotation=true
if (needed_quads.find(test_quad_1) == needed_quads.end() &&
needed_quads.find(test_quad_2) == needed_quads.end() &&
needed_quads.find(test_quad_3) == needed_quads.end() &&
quad.face(1),
quad.face(0)), // face_orientation=false,
// face_flip=true, face_rotation=false
- test_quad_4(
- quad.face(1),
- quad.face(0),
- quad.face(2),
- quad.face(3)), // face_orientation=false,
- // face_flip=true, face_rotation=true
+ test_quad_4(quad.face(1),
+ quad.face(0),
+ quad.face(2),
+ quad.face(
+ 3)), // face_orientation=false,
+ // face_flip=true, face_rotation=true
test_quad_5(
quad.face(2),
quad.face(3),
quad.face(3),
quad.face(2)), // face_orientation=true,
// face_flip=true, face_rotation=false
- test_quad_7(
- quad.face(3),
- quad.face(2),
- quad.face(0),
- quad.face(1)); // face_orientation=true,
- // face_flip=true, face_rotation=true
+ test_quad_7(quad.face(3),
+ quad.face(2),
+ quad.face(0),
+ quad.face(
+ 1)); // face_orientation=true,
+ // face_flip=true, face_rotation=true
if (needed_quads.find(test_quad_1) != needed_quads.end())
{
face_iterator[face] = needed_quads[test_quad_1].first;
for (; boundary_line != end_boundary_line; ++boundary_line)
{
typename Triangulation<dim, spacedim>::line_iterator line;
- std::pair<int, int> line_vertices(std::make_pair(
- boundary_line->vertices[0], boundary_line->vertices[1]));
+ std::pair<int, int> line_vertices(
+ std::make_pair(boundary_line->vertices[0],
+ boundary_line->vertices[1]));
if (needed_lines.find(line_vertices) != needed_lines.end())
// line found in this
// direction
// different than the
// previously set value
if (line->boundary_id() != 0)
- AssertThrow(
- line->boundary_id() == boundary_line->boundary_id,
- ExcMessage("Duplicate boundary lines are only allowed "
- "if they carry the same boundary indicator."));
+ AssertThrow(line->boundary_id() == boundary_line->boundary_id,
+ ExcMessage(
+ "Duplicate boundary lines are only allowed "
+ "if they carry the same boundary indicator."));
line->set_boundary_id_internal(boundary_line->boundary_id);
// Set manifold id if given
boundary_quad
->vertices[GeometryInfo<dim - 1>::line_to_cell_vertices(i,
0)],
- boundary_quad
- ->vertices[GeometryInfo<dim - 1>::line_to_cell_vertices(
- i, 1)]);
+ boundary_quad->vertices
+ [GeometryInfo<dim - 1>::line_to_cell_vertices(i, 1)]);
// check whether line
// already exists
// different than the
// previously set value
if (quad->boundary_id() != 0)
- AssertThrow(
- quad->boundary_id() == boundary_quad->boundary_id,
- ExcMessage("Duplicate boundary quads are only allowed "
- "if they carry the same boundary indicator."));
+ AssertThrow(quad->boundary_id() == boundary_quad->boundary_id,
+ ExcMessage(
+ "Duplicate boundary quads are only allowed "
+ "if they carry the same boundary indicator."));
quad->set_boundary_id_internal(boundary_quad->boundary_id);
quad->set_manifold_id(boundary_quad->manifold_id);
// add to needed vertices how many
// vertices are already in use
- needed_vertices += std::count_if(
- triangulation.vertices_used.begin(),
- triangulation.vertices_used.end(),
- std::bind(std::equal_to<bool>(), std::placeholders::_1, true));
+ needed_vertices += std::count_if(triangulation.vertices_used.begin(),
+ triangulation.vertices_used.end(),
+ std::bind(std::equal_to<bool>(),
+ std::placeholders::_1,
+ true));
// if we need more vertices: create them, if not: leave the
// array as is, since shrinking is not really possible because
// some of the vertices at the end may be in use
triangulation.faces->lines.reserve_space(n_lines_in_pairs, 0);
// add to needed vertices how many vertices are already in use
- needed_vertices += std::count_if(
- triangulation.vertices_used.begin(),
- triangulation.vertices_used.end(),
- std::bind(std::equal_to<bool>(), std::placeholders::_1, true));
+ needed_vertices += std::count_if(triangulation.vertices_used.begin(),
+ triangulation.vertices_used.end(),
+ std::bind(std::equal_to<bool>(),
+ std::placeholders::_1,
+ true));
// if we need more vertices: create them, if not: leave the
// array as is, since shrinking is not really possible because
// some of the vertices at the end may be in use
// face. therefore we set the user_index
// uniquely
{
- Assert(
- aface->refinement_case() ==
- RefinementCase<dim -
- 1>::isotropic_refinement ||
- aface->refinement_case() ==
- RefinementCase<dim - 1>::no_refinement,
- ExcInternalError());
+ Assert(aface->refinement_case() ==
+ RefinementCase<
+ dim - 1>::isotropic_refinement ||
+ aface->refinement_case() ==
+ RefinementCase<dim - 1>::no_refinement,
+ ExcInternalError());
aface->set_user_index(face_ref_case);
}
}
// add to needed vertices how many vertices are already in use
- needed_vertices += std::count_if(
- triangulation.vertices_used.begin(),
- triangulation.vertices_used.end(),
- std::bind(std::equal_to<bool>(), std::placeholders::_1, true));
+ needed_vertices += std::count_if(triangulation.vertices_used.begin(),
+ triangulation.vertices_used.end(),
+ std::bind(std::equal_to<bool>(),
+ std::placeholders::_1,
+ true));
// if we need more vertices: create them, if not: leave the
// array as is, since shrinking is not really possible because
// some of the vertices at the end may be in use
ExcInternalError());
// this quad needs to be refined anisotropically
- Assert(
- quad->user_index() == RefinementCase<dim - 1>::cut_x ||
- quad->user_index() == RefinementCase<dim - 1>::cut_y,
- ExcInternalError());
+ Assert(quad->user_index() ==
+ RefinementCase<dim - 1>::cut_x ||
+ quad->user_index() ==
+ RefinementCase<dim - 1>::cut_y,
+ ExcInternalError());
// make the new line interior to the quad
typename Triangulation<dim, spacedim>::raw_line_iterator
new_child[i]->set(
internal::TriangulationImplementation::
- TriaObject<1>(
- old_child[i]->vertex_index(0),
- old_child[i]->vertex_index(1)));
+ TriaObject<1>(old_child[i]->vertex_index(0),
+ old_child[i]->vertex_index(
+ 1)));
new_child[i]->set_boundary_id_internal(
old_child[i]->boundary_id());
new_child[i]->set_manifold_id(
// first, create the new internal line
new_lines[0]->set(
internal::TriangulationImplementation::TriaObject<
- 1>(
- middle_vertex_index<dim, spacedim>(hex->face(4)),
- middle_vertex_index<dim, spacedim>(
- hex->face(5))));
+ 1>(middle_vertex_index<dim, spacedim>(
+ hex->face(4)),
+ middle_vertex_index<dim, spacedim>(
+ hex->face(5))));
// again, first collect some data about the
// indices of the lines, with the following
// first, create the new internal line
new_lines[0]->set(
internal::TriangulationImplementation::TriaObject<
- 1>(
- middle_vertex_index<dim, spacedim>(hex->face(2)),
- middle_vertex_index<dim, spacedim>(
- hex->face(3))));
+ 1>(middle_vertex_index<dim, spacedim>(
+ hex->face(2)),
+ middle_vertex_index<dim, spacedim>(
+ hex->face(3))));
// again, first collect some data about the
// indices of the lines, with the following
// internal line
new_lines[0]->set(
internal::TriangulationImplementation::TriaObject<
- 1>(
- middle_vertex_index<dim, spacedim>(hex->face(0)),
- middle_vertex_index<dim, spacedim>(
- hex->face(1))));
+ 1>(middle_vertex_index<dim, spacedim>(
+ hex->face(0)),
+ middle_vertex_index<dim, spacedim>(
+ hex->face(1))));
// again, first collect some data about the
// indices of the lines, with the following
template <int dim, int spacedim>
Triangulation<dim, spacedim>::Triangulation(
const MeshSmoothing smooth_grid,
- const bool check_for_distorted_cells) :
- smooth_grid(smooth_grid),
- anisotropic_refinement(false),
- check_for_distorted_cells(check_for_distorted_cells)
+ const bool check_for_distorted_cells)
+ : smooth_grid(smooth_grid)
+ , anisotropic_refinement(false)
+ , check_for_distorted_cells(check_for_distorted_cells)
{
if (dim == 1)
{
template <int dim, int spacedim>
Triangulation<dim, spacedim>::Triangulation(
- Triangulation<dim, spacedim> &&tria) noexcept :
- Subscriptor(std::move(tria)),
- smooth_grid(tria.smooth_grid),
- periodic_face_pairs_level_0(std::move(tria.periodic_face_pairs_level_0)),
- periodic_face_map(std::move(tria.periodic_face_map)),
- levels(std::move(tria.levels)),
- faces(std::move(tria.faces)),
- vertices(std::move(tria.vertices)),
- vertices_used(std::move(tria.vertices_used)),
- manifold(std::move(tria.manifold)),
- anisotropic_refinement(tria.anisotropic_refinement),
- check_for_distorted_cells(tria.check_for_distorted_cells),
- number_cache(std::move(tria.number_cache)),
- vertex_to_boundary_id_map_1d(std::move(tria.vertex_to_boundary_id_map_1d)),
- vertex_to_manifold_id_map_1d(std::move(tria.vertex_to_manifold_id_map_1d))
+ Triangulation<dim, spacedim> &&tria) noexcept
+ : Subscriptor(std::move(tria))
+ , smooth_grid(tria.smooth_grid)
+ , periodic_face_pairs_level_0(std::move(tria.periodic_face_pairs_level_0))
+ , periodic_face_map(std::move(tria.periodic_face_map))
+ , levels(std::move(tria.levels))
+ , faces(std::move(tria.faces))
+ , vertices(std::move(tria.vertices))
+ , vertices_used(std::move(tria.vertices_used))
+ , manifold(std::move(tria.manifold))
+ , anisotropic_refinement(tria.anisotropic_refinement)
+ , check_for_distorted_cells(tria.check_for_distorted_cells)
+ , number_cache(std::move(tria.number_cache))
+ , vertex_to_boundary_id_map_1d(std::move(tria.vertex_to_boundary_id_map_1d))
+ , vertex_to_manifold_id_map_1d(std::move(tria.vertex_to_manifold_id_map_1d))
{
tria.number_cache = internal::TriangulationImplementation::NumberCache<dim>();
}
{
Assert((vertices.size() == 0) && (levels.size() == 0) && (faces == nullptr),
ExcTriangulationNotEmpty(vertices.size(), levels.size()));
- Assert(
- (other_tria.levels.size() != 0) && (other_tria.vertices.size() != 0) &&
- (dim == 1 || other_tria.faces != nullptr),
- ExcMessage("When calling Triangulation::copy_triangulation(), "
- "the target triangulation must be empty but the source "
- "triangulation (the argument to this function) must contain "
- "something. Here, it seems like the source does not "
- "contain anything at all."));
+ Assert((other_tria.levels.size() != 0) && (other_tria.vertices.size() != 0) &&
+ (dim == 1 || other_tria.faces != nullptr),
+ ExcMessage(
+ "When calling Triangulation::copy_triangulation(), "
+ "the target triangulation must be empty but the source "
+ "triangulation (the argument to this function) must contain "
+ "something. Here, it seems like the source does not "
+ "contain anything at all."));
// copy normal elements
{
// If we have visited this guy, then the ordering and
// the orientation should agree
- Assert(
- !(correct(i, j) ^ (neighbor->direction_flag() ==
- (*cell)->direction_flag())),
- ExcNonOrientableTriangulation());
+ Assert(!(correct(i, j) ^
+ (neighbor->direction_flag() ==
+ (*cell)->direction_flag())),
+ ExcNonOrientableTriangulation());
}
else
{
{
std::vector<bool> v;
save_refine_flags(v);
- write_bool_vector(
- mn_tria_refine_flags_begin, v, mn_tria_refine_flags_end, out);
+ write_bool_vector(mn_tria_refine_flags_begin,
+ v,
+ mn_tria_refine_flags_end,
+ out);
}
{
std::vector<bool> v;
save_coarsen_flags(v);
- write_bool_vector(
- mn_tria_coarsen_flags_begin, v, mn_tria_coarsen_flags_end, out);
+ write_bool_vector(mn_tria_coarsen_flags_begin,
+ v,
+ mn_tria_coarsen_flags_end,
+ out);
}
Triangulation<dim, spacedim>::load_coarsen_flags(std::istream &in)
{
std::vector<bool> v;
- read_bool_vector(
- mn_tria_coarsen_flags_begin, v, mn_tria_coarsen_flags_end, in);
+ read_bool_vector(mn_tria_coarsen_flags_begin,
+ v,
+ mn_tria_coarsen_flags_end,
+ in);
load_coarsen_flags(v);
}
if (dim >= 2)
{
tmp.clear();
- tmp.insert(
- tmp.end(), v.begin() + n_lines(), v.begin() + n_lines() + n_quads());
+ tmp.insert(tmp.end(),
+ v.begin() + n_lines(),
+ v.begin() + n_lines() + n_quads());
load_user_flags_quad(tmp);
}
{
std::vector<bool> v;
save_user_flags_line(v);
- write_bool_vector(
- mn_tria_line_user_flags_begin, v, mn_tria_line_user_flags_end, out);
+ write_bool_vector(mn_tria_line_user_flags_begin,
+ v,
+ mn_tria_line_user_flags_end,
+ out);
}
Triangulation<dim, spacedim>::load_user_flags_line(std::istream &in)
{
std::vector<bool> v;
- read_bool_vector(
- mn_tria_line_user_flags_begin, v, mn_tria_line_user_flags_end, in);
+ read_bool_vector(mn_tria_line_user_flags_begin,
+ v,
+ mn_tria_line_user_flags_end,
+ in);
load_user_flags_line(v);
}
{
std::vector<bool> v;
save_user_flags_quad(v);
- write_bool_vector(
- mn_tria_quad_user_flags_begin, v, mn_tria_quad_user_flags_end, out);
+ write_bool_vector(mn_tria_quad_user_flags_begin,
+ v,
+ mn_tria_quad_user_flags_end,
+ out);
}
Triangulation<dim, spacedim>::load_user_flags_quad(std::istream &in)
{
std::vector<bool> v;
- read_bool_vector(
- mn_tria_quad_user_flags_begin, v, mn_tria_quad_user_flags_end, in);
+ read_bool_vector(mn_tria_quad_user_flags_begin,
+ v,
+ mn_tria_quad_user_flags_end,
+ in);
load_user_flags_quad(v);
}
{
std::vector<bool> v;
save_user_flags_hex(v);
- write_bool_vector(
- mn_tria_hex_user_flags_begin, v, mn_tria_hex_user_flags_end, out);
+ write_bool_vector(mn_tria_hex_user_flags_begin,
+ v,
+ mn_tria_hex_user_flags_end,
+ out);
}
Triangulation<dim, spacedim>::load_user_flags_hex(std::istream &in)
{
std::vector<bool> v;
- read_bool_vector(
- mn_tria_hex_user_flags_begin, v, mn_tria_hex_user_flags_end, in);
+ read_bool_vector(mn_tria_hex_user_flags_begin,
+ v,
+ mn_tria_hex_user_flags_end,
+ in);
load_user_flags_hex(v);
}
if (dim >= 2)
{
tmp.clear();
- tmp.insert(
- tmp.end(), v.begin() + n_lines(), v.begin() + n_lines() + n_quads());
+ tmp.insert(tmp.end(),
+ v.begin() + n_lines(),
+ v.begin() + n_lines() + n_quads());
load_user_indices_quad(tmp);
}
if (dim >= 2)
{
tmp.clear();
- tmp.insert(
- tmp.end(), v.begin() + n_lines(), v.begin() + n_lines() + n_quads());
+ tmp.insert(tmp.end(),
+ v.begin() + n_lines(),
+ v.begin() + n_lines() + n_quads());
load_user_pointers_quad(tmp);
}
typename Triangulation<dim, spacedim>::cell_iterator
Triangulation<dim, spacedim>::end() const
{
- return cell_iterator(
- const_cast<Triangulation<dim, spacedim> *>(this), -1, -1);
+ return cell_iterator(const_cast<Triangulation<dim, spacedim> *>(this),
+ -1,
+ -1);
}
}
else
{
- vertex_iterator i = raw_vertex_iterator(
- const_cast<Triangulation<dim, spacedim> *>(this), 0, 0);
+ vertex_iterator i =
+ raw_vertex_iterator(const_cast<Triangulation<dim, spacedim> *>(this),
+ 0,
+ 0);
if (i.state() != IteratorState::valid)
return i;
// This loop will end because every triangulation has used vertices.
typename Triangulation<dim, spacedim>::line_iterator
Triangulation<dim, spacedim>::end_line() const
{
- return raw_line_iterator(
- const_cast<Triangulation<dim, spacedim> *>(this), -1, -1);
+ return raw_line_iterator(const_cast<Triangulation<dim, spacedim> *>(this),
+ -1,
+ -1);
}
typename Triangulation<dim, spacedim>::quad_iterator
Triangulation<dim, spacedim>::end_quad() const
{
- return raw_quad_iterator(
- const_cast<Triangulation<dim, spacedim> *>(this), -1, -1);
+ return raw_quad_iterator(const_cast<Triangulation<dim, spacedim> *>(this),
+ -1,
+ -1);
}
typename Triangulation<dim, spacedim>::hex_iterator
Triangulation<dim, spacedim>::end_hex() const
{
- return raw_hex_iterator(
- const_cast<Triangulation<dim, spacedim> *>(this), -1, -1);
+ return raw_hex_iterator(const_cast<Triangulation<dim, spacedim> *>(this),
+ -1,
+ -1);
}
unsigned int
Triangulation<dim, spacedim>::n_used_vertices() const
{
- return std::count_if(
- vertices_used.begin(),
- vertices_used.end(),
- std::bind(std::equal_to<bool>(), std::placeholders::_1, true));
+ return std::count_if(vertices_used.begin(),
+ vertices_used.end(),
+ std::bind(std::equal_to<bool>(),
+ std::placeholders::_1,
+ true));
}
for (unsigned int vertex = 0;
vertex < GeometryInfo<dim>::vertices_per_cell;
++vertex)
- vertex_level[cell->vertex_index(vertex)] = std::max(
- vertex_level[cell->vertex_index(vertex)], cell->level());
+ vertex_level[cell->vertex_index(vertex)] =
+ std::max(vertex_level[cell->vertex_index(vertex)],
+ cell->level());
else
{
// if coarsen flag is set then tentatively assume
for (unsigned int vertex = 0;
vertex < GeometryInfo<dim>::vertices_per_cell;
++vertex)
- vertex_level[cell->vertex_index(vertex)] = std::max(
- vertex_level[cell->vertex_index(vertex)], cell->level());
+ vertex_level[cell->vertex_index(vertex)] =
+ std::max(vertex_level[cell->vertex_index(vertex)],
+ cell->level());
else
{
// if coarsen flag is set then tentatively assume
(face_ref_case == RefinementCase<dim>::cut_y &&
needed_face_ref_case ==
RefinementCase<dim>::cut_x))
- changed = cell->flag_for_face_refinement(
- i, face_ref_case);
+ changed =
+ cell->flag_for_face_refinement(i,
+ face_ref_case);
}
}
}
w[i] = GeometryInfo<structdim>::d_linear_shape_function(coordinates, i);
}
- return this->get_manifold().get_new_point(
- make_array_view(p.begin(), p.end()), make_array_view(w.begin(), w.end()));
+ return this->get_manifold().get_new_point(make_array_view(p.begin(), p.end()),
+ make_array_view(w.begin(),
+ w.end()));
}
[1] = {{-1.000000}, {1.000000}};
template <>
- const double TransformR2UAffine<1>::Kb[GeometryInfo<1>::vertices_per_cell] = {
- 1.000000,
- 0.000000};
+ const double TransformR2UAffine<1>::Kb[GeometryInfo<1>::vertices_per_cell] =
+ {1.000000, 0.000000};
/*
{
Assert(this->used(), TriaAccessorExceptions::ExcCellNotUsed());
Assert(this->present_level > 0, TriaAccessorExceptions::ExcCellHasNoParent());
- TriaIterator<CellAccessor<dim, spacedim>> q(
- this->tria, this->present_level - 1, parent_index());
+ TriaIterator<CellAccessor<dim, spacedim>> q(this->tria,
+ this->present_level - 1,
+ parent_index());
return q;
}
// call a helper function, that translates the current
// subface number to a subface number for the current
// FaceRefineCase
- return std::make_pair(
- face_no_guess,
- translate_subface_no(face_guess, subface_no));
+ return std::make_pair(face_no_guess,
+ translate_subface_no(face_guess,
+ subface_no));
if (face_guess->child(subface_no)->has_children())
for (unsigned int subsub_no = 0;
// call a helper function, that translates the current
// subface number to a subface number for the current
// FaceRefineCase
- return std::make_pair(
- face_no, translate_subface_no(face, subface_no));
+ return std::make_pair(face_no,
+ translate_subface_no(face,
+ subface_no));
if (face->child(subface_no)->has_children())
for (unsigned int subsub_no = 0;
// call a helper function, that translates the current
// subface number and subsubface number to a subface
// number for the current FaceRefineCase
- return std::make_pair(
- face_no,
- translate_subface_no(face, subface_no, subsub_no));
+ return std::make_pair(face_no,
+ translate_subface_no(face,
+ subface_no,
+ subsub_no));
}
}
typedef TriaIterator<CellAccessor<dim, spacedim>> cell_iterator;
// my_it : is the iterator to the current cell.
cell_iterator my_it(*this);
- if (this->tria->periodic_face_map.find(std::pair<cell_iterator, unsigned int>(
- my_it, i_face)) != this->tria->periodic_face_map.end())
+ if (this->tria->periodic_face_map.find(
+ std::pair<cell_iterator, unsigned int>(my_it, i_face)) !=
+ this->tria->periodic_face_map.end())
return true;
return false;
}
RefinementCase<dim>::no_refinement);
coarsen_flags.reserve(total_cells);
- coarsen_flags.insert(
- coarsen_flags.end(), total_cells - coarsen_flags.size(), false);
+ coarsen_flags.insert(coarsen_flags.end(),
+ total_cells - coarsen_flags.size(),
+ false);
active_cell_indices.reserve(total_cells);
active_cell_indices.insert(active_cell_indices.end(),
numbers::invalid_unsigned_int);
subdomain_ids.reserve(total_cells);
- subdomain_ids.insert(
- subdomain_ids.end(), total_cells - subdomain_ids.size(), 0);
+ subdomain_ids.insert(subdomain_ids.end(),
+ total_cells - subdomain_ids.size(),
+ 0);
level_subdomain_ids.reserve(total_cells);
level_subdomain_ids.insert(level_subdomain_ids.end(),
direction_flags.clear();
parents.reserve((int)(total_cells + 1) / 2);
- parents.insert(
- parents.end(), (total_cells + 1) / 2 - parents.size(), -1);
+ parents.insert(parents.end(),
+ (total_cells + 1) / 2 - parents.size(),
+ -1);
neighbors.reserve(total_cells * (2 * dimension));
neighbors.insert(neighbors.end(),
RefinementCase<3>::no_refinement);
coarsen_flags.reserve(total_cells);
- coarsen_flags.insert(
- coarsen_flags.end(), total_cells - coarsen_flags.size(), false);
+ coarsen_flags.insert(coarsen_flags.end(),
+ total_cells - coarsen_flags.size(),
+ false);
active_cell_indices.reserve(total_cells);
active_cell_indices.insert(active_cell_indices.end(),
numbers::invalid_unsigned_int);
subdomain_ids.reserve(total_cells);
- subdomain_ids.insert(
- subdomain_ids.end(), total_cells - subdomain_ids.size(), 0);
+ subdomain_ids.insert(subdomain_ids.end(),
+ total_cells - subdomain_ids.size(),
+ 0);
level_subdomain_ids.reserve(total_cells);
level_subdomain_ids.insert(level_subdomain_ids.end(),
direction_flags.clear();
parents.reserve((int)(total_cells + 1) / 2);
- parents.insert(
- parents.end(), (total_cells + 1) / 2 - parents.size(), -1);
+ parents.insert(parents.end(),
+ (total_cells + 1) / 2 - parents.size(),
+ -1);
neighbors.reserve(total_cells * (2 * dimension));
neighbors.insert(neighbors.end(),
used.insert(used.end(), new_size - used.size(), false);
user_flags.reserve(new_size);
- user_flags.insert(
- user_flags.end(), new_size - user_flags.size(), false);
+ user_flags.insert(user_flags.end(),
+ new_size - user_flags.size(),
+ false);
const unsigned int factor =
GeometryInfo<G::dimension>::max_children_per_cell / 2;
children.reserve(factor * new_size);
- children.insert(
- children.end(), factor * new_size - children.size(), -1);
+ children.insert(children.end(),
+ factor * new_size - children.size(),
+ -1);
if (G::dimension > 1)
{
else
next_free_pair = pos + 2;
- return typename dealii::Triangulation<dim, spacedim>::raw_hex_iterator(
- &tria, level, pos);
+ return
+ typename dealii::Triangulation<dim, spacedim>::raw_hex_iterator(&tria,
+ level,
+ pos);
}
TriaObjectsHex::reserve_space(const unsigned int new_hexes)
{
const unsigned int new_size =
- new_hexes +
- std::count_if(
- used.begin(),
- used.end(),
- std::bind(std::equal_to<bool>(), std::placeholders::_1, true));
+ new_hexes + std::count_if(used.begin(),
+ used.end(),
+ std::bind(std::equal_to<bool>(),
+ std::placeholders::_1,
+ true));
// see above...
if (new_size > cells.size())
used.insert(used.end(), new_size - used.size(), false);
user_flags.reserve(new_size);
- user_flags.insert(
- user_flags.end(), new_size - user_flags.size(), false);
+ user_flags.insert(user_flags.end(),
+ new_size - user_flags.size(),
+ false);
children.reserve(4 * new_size);
children.insert(children.end(), 4 * new_size - children.size(), -1);
// have on each level, allocate the memory. note that we
// allocate offsets for all faces, though only the active
// ones will have a non-invalid value later on
- face_dof_offsets = std::vector<unsigned int>(
- dof_handler.tria->n_raw_faces(), (unsigned int)(-1));
- face_dof_indices = std::vector<types::global_dof_index>(
- n_face_slots, numbers::invalid_dof_index);
+ face_dof_offsets =
+ std::vector<unsigned int>(dof_handler.tria->n_raw_faces(),
+ (unsigned int)(-1));
+ face_dof_indices =
+ std::vector<types::global_dof_index>(n_face_slots,
+ numbers::invalid_dof_index);
// with the memory now allocated, loop over the
// dof_handler.cells again and prime the _offset values as
static unsigned int
max_couplings_between_dofs(const DoFHandler<1, spacedim> &dof_handler)
{
- return std::min(
- static_cast<types::global_dof_index>(
- 3 * dof_handler.fe_collection.max_dofs_per_vertex() +
- 2 * dof_handler.fe_collection.max_dofs_per_line()),
- dof_handler.n_dofs());
+ return std::min(static_cast<types::global_dof_index>(
+ 3 *
+ dof_handler.fe_collection.max_dofs_per_vertex() +
+ 2 * dof_handler.fe_collection.max_dofs_per_line()),
+ dof_handler.n_dofs());
}
active_fe_indices[cell->active_cell_index()] =
cell->active_fe_index();
- Utilities::MPI::sum(
- active_fe_indices, tr->get_communicator(), active_fe_indices);
+ Utilities::MPI::sum(active_fe_indices,
+ tr->get_communicator(),
+ active_fe_indices);
// now go back and fill the active_fe_index on ghost
// cells. we would like to call cell->set_active_fe_index(),
GridTools::exchange_cell_data_to_ghosts<
unsigned int,
- dealii::hp::DoFHandler<dim, spacedim>>(
- dof_handler, pack, unpack);
+ dealii::hp::DoFHandler<dim, spacedim>>(dof_handler,
+ pack,
+ unpack);
}
else
{
template <int dim, int spacedim>
- DoFHandler<dim, spacedim>::DoFHandler() :
- tria(nullptr, typeid(*this).name()),
- faces(nullptr)
+ DoFHandler<dim, spacedim>::DoFHandler()
+ : tria(nullptr, typeid(*this).name())
+ , faces(nullptr)
{}
template <int dim, int spacedim>
DoFHandler<dim, spacedim>::DoFHandler(
- const Triangulation<dim, spacedim> &tria) :
- tria(&tria, typeid(*this).name()),
- faces(nullptr)
+ const Triangulation<dim, spacedim> &tria)
+ : tria(&tria, typeid(*this).name())
+ , faces(nullptr)
{
setup_policy_and_listeners();
// cover all fe indices presently in use on the mesh
for (active_cell_iterator cell = begin_active(); cell != end(); ++cell)
if (cell->is_locally_owned())
- Assert(
- cell->active_fe_index() < fe_collection.size(),
- ExcInvalidFEIndex(cell->active_fe_index(), fe_collection.size()));
+ Assert(cell->active_fe_index() < fe_collection.size(),
+ ExcInvalidFEIndex(cell->active_fe_index(),
+ fe_collection.size()));
// then allocate space for all the other tables
std_cxx14::make_unique<internal::DoFHandlerImplementation::Policy::
Sequential<DoFHandler<dim, spacedim>>>(*this);
- tria_listeners.push_back(
- this->tria->signals.pre_refinement.connect(std::bind(
- &DoFHandler<dim, spacedim>::pre_refinement_action, std::ref(*this))));
- tria_listeners.push_back(
- this->tria->signals.post_refinement.connect(std::bind(
- &DoFHandler<dim, spacedim>::post_refinement_action, std::ref(*this))));
+ tria_listeners.push_back(this->tria->signals.pre_refinement.connect(
+ std::bind(&DoFHandler<dim, spacedim>::pre_refinement_action,
+ std::ref(*this))));
+ tria_listeners.push_back(this->tria->signals.post_refinement.connect(
+ std::bind(&DoFHandler<dim, spacedim>::post_refinement_action,
+ std::ref(*this))));
tria_listeners.push_back(this->tria->signals.create.connect(std::bind(
&DoFHandler<dim, spacedim>::post_refinement_action, std::ref(*this))));
}
DoFHandler<dim, spacedim>::renumber_dofs(
const std::vector<types::global_dof_index> &new_numbers)
{
- Assert(
- levels.size() > 0,
- ExcMessage("You need to distribute DoFs before you can renumber them."));
+ Assert(levels.size() > 0,
+ ExcMessage(
+ "You need to distribute DoFs before you can renumber them."));
AssertDimension(new_numbers.size(), n_locally_owned_dofs());
// store refinement cases, so use the 'children' vector
// instead
if (dim == 1)
- std::transform(
- tria->levels[i]->cells.children.begin(),
- tria->levels[i]->cells.children.end(),
- has_children_level->begin(),
- std::bind(std::not_equal_to<int>(), std::placeholders::_1, -1));
+ std::transform(tria->levels[i]->cells.children.begin(),
+ tria->levels[i]->cells.children.end(),
+ has_children_level->begin(),
+ std::bind(std::not_equal_to<int>(),
+ std::placeholders::_1,
+ -1));
else
std::transform(tria->levels[i]->cells.refinement_cases.begin(),
tria->levels[i]->cells.refinement_cases.end(),
it != fes.end();
++it)
{
- Assert(
- *it < fe_collection.size(),
- ExcIndexRangeType<unsigned int>(*it, 0, fe_collection.size()));
+ Assert(*it < fe_collection.size(),
+ ExcIndexRangeType<unsigned int>(*it,
+ 0,
+ fe_collection.size()));
domination =
domination & fe_collection[cur_fe].compare_for_face_domination(
fe_collection[*it]);
const dealii::hp::FECollection<dim, FEValuesType::space_dimension>
& fe_collection,
const dealii::hp::QCollection<q_dim> &q_collection,
- const UpdateFlags update_flags) :
- fe_collection(&fe_collection),
- mapping_collection(&mapping_collection),
- q_collection(q_collection),
- fe_values_table(fe_collection.size(),
- mapping_collection.size(),
- q_collection.size()),
- present_fe_values_index(numbers::invalid_unsigned_int,
- numbers::invalid_unsigned_int,
- numbers::invalid_unsigned_int),
- update_flags(update_flags)
+ const UpdateFlags update_flags)
+ : fe_collection(&fe_collection)
+ , mapping_collection(&mapping_collection)
+ , q_collection(q_collection)
+ , fe_values_table(fe_collection.size(),
+ mapping_collection.size(),
+ q_collection.size())
+ , present_fe_values_index(numbers::invalid_unsigned_int,
+ numbers::invalid_unsigned_int,
+ numbers::invalid_unsigned_int)
+ , update_flags(update_flags)
{}
const dealii::hp::FECollection<dim, FEValuesType::space_dimension>
& fe_collection,
const dealii::hp::QCollection<q_dim> &q_collection,
- const UpdateFlags update_flags) :
- fe_collection(&fe_collection),
- mapping_collection(
- &dealii::hp::StaticMappingQ1<dim, FEValuesType::space_dimension>::
- mapping_collection),
- q_collection(q_collection),
- fe_values_table(fe_collection.size(), 1, q_collection.size()),
- present_fe_values_index(numbers::invalid_unsigned_int,
- numbers::invalid_unsigned_int,
- numbers::invalid_unsigned_int),
- update_flags(update_flags)
+ const UpdateFlags update_flags)
+ : fe_collection(&fe_collection)
+ , mapping_collection(
+ &dealii::hp::StaticMappingQ1<dim, FEValuesType::space_dimension>::
+ mapping_collection)
+ , q_collection(q_collection)
+ , fe_values_table(fe_collection.size(), 1, q_collection.size())
+ , present_fe_values_index(numbers::invalid_unsigned_int,
+ numbers::invalid_unsigned_int,
+ numbers::invalid_unsigned_int)
+ , update_flags(update_flags)
{}
const hp::MappingCollection<dim, spacedim> &mapping,
const hp::FECollection<dim, spacedim> & fe_collection,
const hp::QCollection<dim> & q_collection,
- const UpdateFlags update_flags) :
- internal::hp::FEValuesBase<dim, dim, dealii::FEValues<dim, spacedim>>(
- mapping,
- fe_collection,
- q_collection,
- update_flags)
+ const UpdateFlags update_flags)
+ : internal::hp::FEValuesBase<dim, dim, dealii::FEValues<dim, spacedim>>(
+ mapping,
+ fe_collection,
+ q_collection,
+ update_flags)
{}
FEValues<dim, spacedim>::FEValues(
const hp::FECollection<dim, spacedim> &fe_collection,
const hp::QCollection<dim> & q_collection,
- const UpdateFlags update_flags) :
- internal::hp::FEValuesBase<dim, dim, dealii::FEValues<dim, spacedim>>(
- fe_collection,
- q_collection,
- update_flags)
+ const UpdateFlags update_flags)
+ : internal::hp::FEValuesBase<dim, dim, dealii::FEValues<dim, spacedim>>(
+ fe_collection,
+ q_collection,
+ update_flags)
{}
// some checks
Assert(real_q_index < this->q_collection.size(),
ExcIndexRange(real_q_index, 0, this->q_collection.size()));
- Assert(
- real_mapping_index < this->mapping_collection->size(),
- ExcIndexRange(real_mapping_index, 0, this->mapping_collection->size()));
+ Assert(real_mapping_index < this->mapping_collection->size(),
+ ExcIndexRange(real_mapping_index,
+ 0,
+ this->mapping_collection->size()));
Assert(real_fe_index < this->fe_collection->size(),
ExcIndexRange(real_fe_index, 0, this->fe_collection->size()));
// some checks
Assert(real_q_index < this->q_collection.size(),
ExcIndexRange(real_q_index, 0, this->q_collection.size()));
- Assert(
- real_mapping_index < this->mapping_collection->size(),
- ExcIndexRange(real_mapping_index, 0, this->mapping_collection->size()));
+ Assert(real_mapping_index < this->mapping_collection->size(),
+ ExcIndexRange(real_mapping_index,
+ 0,
+ this->mapping_collection->size()));
Assert(real_fe_index < this->fe_collection->size(),
ExcIndexRange(real_fe_index, 0, this->fe_collection->size()));
const hp::MappingCollection<dim, spacedim> &mapping,
const hp::FECollection<dim, spacedim> & fe_collection,
const hp::QCollection<dim - 1> & q_collection,
- const UpdateFlags update_flags) :
- internal::hp::
- FEValuesBase<dim, dim - 1, dealii::FEFaceValues<dim, spacedim>>(
- mapping,
- fe_collection,
- q_collection,
- update_flags)
+ const UpdateFlags update_flags)
+ : internal::hp::
+ FEValuesBase<dim, dim - 1, dealii::FEFaceValues<dim, spacedim>>(
+ mapping,
+ fe_collection,
+ q_collection,
+ update_flags)
{}
FEFaceValues<dim, spacedim>::FEFaceValues(
const hp::FECollection<dim, spacedim> &fe_collection,
const hp::QCollection<dim - 1> & q_collection,
- const UpdateFlags update_flags) :
- internal::hp::
- FEValuesBase<dim, dim - 1, dealii::FEFaceValues<dim, spacedim>>(
- fe_collection,
- q_collection,
- update_flags)
+ const UpdateFlags update_flags)
+ : internal::hp::
+ FEValuesBase<dim, dim - 1, dealii::FEFaceValues<dim, spacedim>>(
+ fe_collection,
+ q_collection,
+ update_flags)
{}
// some checks
Assert(real_q_index < this->q_collection.size(),
ExcIndexRange(real_q_index, 0, this->q_collection.size()));
- Assert(
- real_mapping_index < this->mapping_collection->size(),
- ExcIndexRange(real_mapping_index, 0, this->mapping_collection->size()));
+ Assert(real_mapping_index < this->mapping_collection->size(),
+ ExcIndexRange(real_mapping_index,
+ 0,
+ this->mapping_collection->size()));
Assert(real_fe_index < this->fe_collection->size(),
ExcIndexRange(real_fe_index, 0, this->fe_collection->size()));
// some checks
Assert(real_q_index < this->q_collection.size(),
ExcIndexRange(real_q_index, 0, this->q_collection.size()));
- Assert(
- real_mapping_index < this->mapping_collection->size(),
- ExcIndexRange(real_mapping_index, 0, this->mapping_collection->size()));
+ Assert(real_mapping_index < this->mapping_collection->size(),
+ ExcIndexRange(real_mapping_index,
+ 0,
+ this->mapping_collection->size()));
Assert(real_fe_index < this->fe_collection->size(),
ExcIndexRange(real_fe_index, 0, this->fe_collection->size()));
const hp::MappingCollection<dim, spacedim> &mapping,
const hp::FECollection<dim, spacedim> & fe_collection,
const hp::QCollection<dim - 1> & q_collection,
- const UpdateFlags update_flags) :
- internal::hp::
- FEValuesBase<dim, dim - 1, dealii::FESubfaceValues<dim, spacedim>>(
- mapping,
- fe_collection,
- q_collection,
- update_flags)
+ const UpdateFlags update_flags)
+ : internal::hp::
+ FEValuesBase<dim, dim - 1, dealii::FESubfaceValues<dim, spacedim>>(
+ mapping,
+ fe_collection,
+ q_collection,
+ update_flags)
{}
FESubfaceValues<dim, spacedim>::FESubfaceValues(
const hp::FECollection<dim, spacedim> &fe_collection,
const hp::QCollection<dim - 1> & q_collection,
- const UpdateFlags update_flags) :
- internal::hp::
- FEValuesBase<dim, dim - 1, dealii::FESubfaceValues<dim, spacedim>>(
- fe_collection,
- q_collection,
- update_flags)
+ const UpdateFlags update_flags)
+ : internal::hp::
+ FEValuesBase<dim, dim - 1, dealii::FESubfaceValues<dim, spacedim>>(
+ fe_collection,
+ q_collection,
+ update_flags)
{}
// some checks
Assert(real_q_index < this->q_collection.size(),
ExcIndexRange(real_q_index, 0, this->q_collection.size()));
- Assert(
- real_mapping_index < this->mapping_collection->size(),
- ExcIndexRange(real_mapping_index, 0, this->mapping_collection->size()));
+ Assert(real_mapping_index < this->mapping_collection->size(),
+ ExcIndexRange(real_mapping_index,
+ 0,
+ this->mapping_collection->size()));
Assert(real_fe_index < this->fe_collection->size(),
ExcIndexRange(real_fe_index, 0, this->fe_collection->size()));
// some checks
Assert(real_q_index < this->q_collection.size(),
ExcIndexRange(real_q_index, 0, this->q_collection.size()));
- Assert(
- real_mapping_index < this->mapping_collection->size(),
- ExcIndexRange(real_mapping_index, 0, this->mapping_collection->size()));
+ Assert(real_mapping_index < this->mapping_collection->size(),
+ ExcIndexRange(real_mapping_index,
+ 0,
+ this->mapping_collection->size()));
Assert(real_fe_index < this->fe_collection->size(),
ExcIndexRange(real_fe_index, 0, this->fe_collection->size()));
template <int dim, int spacedim>
MappingCollection<dim, spacedim>::MappingCollection(
- const MappingCollection<dim, spacedim> &mapping_collection) :
- Subscriptor(),
+ const MappingCollection<dim, spacedim> &mapping_collection)
+ : Subscriptor()
+ ,
// copy the array
// of shared
// pointers. nothing
*/
#define INSTANTIATE_DLTG_VECTOR(VectorType) \
- template void \
- AffineConstraints<VectorType::value_type>::condense<VectorType>( \
- const VectorType &, VectorType &) const; \
+ template void AffineConstraints<VectorType::value_type>::condense< \
+ VectorType>(const VectorType &, VectorType &) const; \
template void \
AffineConstraints<VectorType::value_type>::condense<VectorType>( \
VectorType &) const; \
bool, \
std::integral_constant<bool, true>) const
-#define INSTANTIATE_DLTG_MATRIX(MatrixType) \
- template void AffineConstraints<MatrixType::value_type>:: \
- distribute_local_to_global<MatrixType>( \
- const FullMatrix<MatrixType::value_type> &, \
- const std::vector<AffineConstraints::size_type> &, \
- const std::vector<AffineConstraints::size_type> &, \
- MatrixType &) const; \
- template void AffineConstraints<MatrixType::value_type>:: \
- distribute_local_to_global<MatrixType>( \
- const FullMatrix<MatrixType::value_type> &, \
- const std::vector<AffineConstraints::size_type> &, \
- const AffineConstraints<MatrixType::value_type> &, \
- const std::vector<AffineConstraints::size_type> &, \
- MatrixType &) const
+#define INSTANTIATE_DLTG_MATRIX(MatrixType) \
+ template void \
+ AffineConstraints<MatrixType::value_type>::distribute_local_to_global< \
+ MatrixType>(const FullMatrix<MatrixType::value_type> &, \
+ const std::vector<AffineConstraints::size_type> &, \
+ const std::vector<AffineConstraints::size_type> &, \
+ MatrixType &) const; \
+ template void \
+ AffineConstraints<MatrixType::value_type>::distribute_local_to_global< \
+ MatrixType>(const FullMatrix<MatrixType::value_type> &, \
+ const std::vector<AffineConstraints::size_type> &, \
+ const AffineConstraints<MatrixType::value_type> &, \
+ const std::vector<AffineConstraints::size_type> &, \
+ MatrixType &) const
#ifdef DEAL_II_WITH_PETSC
INSTANTIATE_DLTG_VECTOR(PETScWrappers::MPI::Vector);
for (S : REAL_AND_COMPLEX_SCALARS; T : DEAL_II_VEC_TEMPLATES)
{
- template void
- AffineConstraints<S>::distribute_local_to_global<DiagonalMatrix<T<S>>>(
- const FullMatrix<S> &,
- const std::vector<size_type> &,
- DiagonalMatrix<T<S>> &) const;
+ template void AffineConstraints<S>::distribute_local_to_global<
+ DiagonalMatrix<T<S>>>(const FullMatrix<S> &,
+ const std::vector<size_type> &,
+ DiagonalMatrix<T<S>> &) const;
template void AffineConstraints<S>::distribute_local_to_global<
DiagonalMatrix<LinearAlgebra::distributed::T<S>>>(
const std::vector<size_type> &,
DiagonalMatrix<LinearAlgebra::distributed::T<S>> &) const;
- template void
- AffineConstraints<S>::distribute_local_to_global<DiagonalMatrix<T<S>>,
- T<S>>(
- const FullMatrix<S> &,
- const Vector<S> &,
- const std::vector<size_type> &,
- DiagonalMatrix<T<S>> &,
- T<S> &,
- bool,
- std::integral_constant<bool, false>) const;
+ template void AffineConstraints<S>::distribute_local_to_global<
+ DiagonalMatrix<T<S>>,
+ T<S>>(const FullMatrix<S> &,
+ const Vector<S> &,
+ const std::vector<size_type> &,
+ DiagonalMatrix<T<S>> &,
+ T<S> &,
+ bool,
+ std::integral_constant<bool, false>) const;
template void AffineConstraints<S>::distribute_local_to_global<
DiagonalMatrix<LinearAlgebra::distributed::T<S>>,
for (S : REAL_AND_COMPLEX_SCALARS)
{
- template void
- AffineConstraints<S>::distribute_local_to_global<BlockSparseMatrix<S>,
- Vector<S>>(
- const FullMatrix<S> &,
- const Vector<S> &,
- const std::vector<AffineConstraints<S>::size_type> &,
- BlockSparseMatrix<S> &,
- Vector<S> &,
- bool,
- std::integral_constant<bool, true>) const;
+ template void AffineConstraints<S>::distribute_local_to_global<
+ BlockSparseMatrix<S>,
+ Vector<S>>(const FullMatrix<S> &,
+ const Vector<S> &,
+ const std::vector<AffineConstraints<S>::size_type> &,
+ BlockSparseMatrix<S> &,
+ Vector<S> &,
+ bool,
+ std::integral_constant<bool, true>) const;
- template void
- AffineConstraints<S>::distribute_local_to_global<BlockSparseMatrix<S>,
- BlockVector<S>>(
- const FullMatrix<S> &,
- const Vector<S> &,
- const std::vector<AffineConstraints<S>::size_type> &,
- BlockSparseMatrix<S> &,
- BlockVector<S> &,
- bool,
- std::integral_constant<bool, true>) const;
+ template void AffineConstraints<S>::distribute_local_to_global<
+ BlockSparseMatrix<S>,
+ BlockVector<S>>(const FullMatrix<S> &,
+ const Vector<S> &,
+ const std::vector<AffineConstraints<S>::size_type> &,
+ BlockSparseMatrix<S> &,
+ BlockVector<S> &,
+ bool,
+ std::integral_constant<bool, true>) const;
template void
AffineConstraints<S>::distribute_local_to_global<BlockSparseMatrix<S>>(
template <typename number, typename BlockVectorType>
-BlockMatrixArray<number, BlockVectorType>::Entry::Entry(const Entry &e) :
- row(e.row),
- col(e.col),
- prefix(e.prefix),
- transpose(e.transpose),
- matrix(e.matrix)
+BlockMatrixArray<number, BlockVectorType>::Entry::Entry(const Entry &e)
+ : row(e.row)
+ , col(e.col)
+ , prefix(e.prefix)
+ , transpose(e.transpose)
+ , matrix(e.matrix)
{
Entry &e2 = const_cast<Entry &>(e);
e2.matrix = nullptr;
template <typename number, typename BlockVectorType>
-BlockMatrixArray<number, BlockVectorType>::BlockMatrixArray() :
- block_rows(0),
- block_cols(0)
+BlockMatrixArray<number, BlockVectorType>::BlockMatrixArray()
+ : block_rows(0)
+ , block_cols(0)
{}
template <typename number, typename BlockVectorType>
BlockMatrixArray<number, BlockVectorType>::BlockMatrixArray(
const unsigned int n_block_rows,
- const unsigned int n_block_cols) :
- block_rows(n_block_rows),
- block_cols(n_block_cols)
+ const unsigned int n_block_cols)
+ : block_rows(n_block_rows)
+ , block_cols(n_block_cols)
{}
//---------------------------------------------------------------------------
template <typename number, typename BlockVectorType>
-BlockTrianglePrecondition<number,
- BlockVectorType>::BlockTrianglePrecondition() :
- BlockMatrixArray<number, BlockVectorType>(),
- backward(false)
+BlockTrianglePrecondition<number, BlockVectorType>::BlockTrianglePrecondition()
+ : BlockMatrixArray<number, BlockVectorType>()
+ , backward(false)
{}
template <typename number, typename BlockVectorType>
BlockTrianglePrecondition<number, BlockVectorType>::BlockTrianglePrecondition(
- const unsigned int block_rows) :
- BlockMatrixArray<number, BlockVectorType>(block_rows, block_rows),
- backward(false)
+ const unsigned int block_rows)
+ : BlockMatrixArray<number, BlockVectorType>(block_rows, block_rows)
+ , backward(false)
{}
template <class SparsityPatternBase>
-BlockSparsityPatternBase<SparsityPatternBase>::BlockSparsityPatternBase() :
- rows(0),
- columns(0)
+BlockSparsityPatternBase<SparsityPatternBase>::BlockSparsityPatternBase()
+ : rows(0)
+ , columns(0)
{}
template <class SparsityPatternBase>
BlockSparsityPatternBase<SparsityPatternBase>::BlockSparsityPatternBase(
const size_type n_block_rows,
- const size_type n_block_columns) :
- rows(0),
- columns(0)
+ const size_type n_block_columns)
+ : rows(0)
+ , columns(0)
{
reinit(n_block_rows, n_block_columns);
}
template <class SparsityPatternBase>
BlockSparsityPatternBase<SparsityPatternBase>::BlockSparsityPatternBase(
- const BlockSparsityPatternBase &s) :
- Subscriptor(),
- rows(0),
- columns(0)
+ const BlockSparsityPatternBase &s)
+ : Subscriptor()
+ , rows(0)
+ , columns(0)
{
(void)s;
Assert(s.rows == 0 && s.columns == 0,
BlockSparsityPattern::BlockSparsityPattern(const size_type n_rows,
- const size_type n_columns) :
- BlockSparsityPatternBase<SparsityPattern>(n_rows, n_columns)
+ const size_type n_columns)
+ : BlockSparsityPatternBase<SparsityPattern>(n_rows, n_columns)
{}
const size_type length = rows.block_size(i);
if (row_lengths[j].size() == 1)
- block(i, j).reinit(
- rows.block_size(i), cols.block_size(j), row_lengths[j][0]);
+ block(i, j).reinit(rows.block_size(i),
+ cols.block_size(j),
+ row_lengths[j][0]);
else
{
VectorSlice<const std::vector<unsigned int>> block_rows(
row_lengths[j], start, length);
- block(i, j).reinit(
- rows.block_size(i), cols.block_size(j), block_rows);
+ block(i, j).reinit(rows.block_size(i),
+ cols.block_size(j),
+ block_rows);
}
}
this->collect_sizes();
BlockDynamicSparsityPattern::BlockDynamicSparsityPattern(
const size_type n_rows,
- const size_type n_columns) :
- BlockSparsityPatternBase<DynamicSparsityPattern>(n_rows, n_columns)
+ const size_type n_columns)
+ : BlockSparsityPatternBase<DynamicSparsityPattern>(n_rows, n_columns)
{}
BlockDynamicSparsityPattern::BlockDynamicSparsityPattern(
const std::vector<size_type> &row_indices,
- const std::vector<size_type> &col_indices) :
- BlockSparsityPatternBase<DynamicSparsityPattern>(row_indices.size(),
- col_indices.size())
+ const std::vector<size_type> &col_indices)
+ : BlockSparsityPatternBase<DynamicSparsityPattern>(row_indices.size(),
+ col_indices.size())
{
for (size_type i = 0; i < row_indices.size(); ++i)
for (size_type j = 0; j < col_indices.size(); ++j)
BlockDynamicSparsityPattern::BlockDynamicSparsityPattern(
- const std::vector<IndexSet> &partitioning) :
- BlockSparsityPatternBase<DynamicSparsityPattern>(partitioning.size(),
- partitioning.size())
+ const std::vector<IndexSet> &partitioning)
+ : BlockSparsityPatternBase<DynamicSparsityPattern>(partitioning.size(),
+ partitioning.size())
{
for (size_type i = 0; i < partitioning.size(); ++i)
for (size_type j = 0; j < partitioning.size(); ++j)
- this->block(i, j).reinit(
- partitioning[i].size(), partitioning[j].size(), partitioning[i]);
+ this->block(i, j).reinit(partitioning[i].size(),
+ partitioning[j].size(),
+ partitioning[i]);
this->collect_sizes();
}
partitioning.size());
for (size_type i = 0; i < partitioning.size(); ++i)
for (size_type j = 0; j < partitioning.size(); ++j)
- this->block(i, j).reinit(
- partitioning[i].size(), partitioning[j].size(), partitioning[i]);
+ this->block(i, j).reinit(partitioning[i].size(),
+ partitioning[j].size(),
+ partitioning[i]);
this->collect_sizes();
}
namespace TrilinosWrappers
{
BlockSparsityPattern::BlockSparsityPattern(const size_type n_rows,
- const size_type n_columns) :
- dealii::BlockSparsityPatternBase<SparsityPattern>(n_rows, n_columns)
+ const size_type n_columns)
+ : dealii::BlockSparsityPatternBase<SparsityPattern>(n_rows, n_columns)
{}
BlockSparsityPattern::BlockSparsityPattern(
const std::vector<size_type> &row_indices,
- const std::vector<size_type> &col_indices) :
- BlockSparsityPatternBase<SparsityPattern>(row_indices.size(),
- col_indices.size())
+ const std::vector<size_type> &col_indices)
+ : BlockSparsityPatternBase<SparsityPattern>(row_indices.size(),
+ col_indices.size())
{
for (size_type i = 0; i < row_indices.size(); ++i)
for (size_type j = 0; j < col_indices.size(); ++j)
BlockSparsityPattern::BlockSparsityPattern(
- const std::vector<Epetra_Map> ¶llel_partitioning) :
- BlockSparsityPatternBase<SparsityPattern>(parallel_partitioning.size(),
- parallel_partitioning.size())
+ const std::vector<Epetra_Map> ¶llel_partitioning)
+ : BlockSparsityPatternBase<SparsityPattern>(parallel_partitioning.size(),
+ parallel_partitioning.size())
{
for (size_type i = 0; i < parallel_partitioning.size(); ++i)
for (size_type j = 0; j < parallel_partitioning.size(); ++j)
BlockSparsityPattern::BlockSparsityPattern(
const std::vector<IndexSet> ¶llel_partitioning,
- const MPI_Comm & communicator) :
- BlockSparsityPatternBase<SparsityPattern>(parallel_partitioning.size(),
- parallel_partitioning.size())
+ const MPI_Comm & communicator)
+ : BlockSparsityPatternBase<SparsityPattern>(parallel_partitioning.size(),
+ parallel_partitioning.size())
{
for (size_type i = 0; i < parallel_partitioning.size(); ++i)
for (size_type j = 0; j < parallel_partitioning.size(); ++j)
- this->block(i, j).reinit(
- parallel_partitioning[i], parallel_partitioning[j], communicator);
+ this->block(i, j).reinit(parallel_partitioning[i],
+ parallel_partitioning[j],
+ communicator);
this->collect_sizes();
}
const std::vector<IndexSet> &row_parallel_partitioning,
const std::vector<IndexSet> &col_parallel_partitioning,
const std::vector<IndexSet> &writable_rows,
- const MPI_Comm & communicator) :
- BlockSparsityPatternBase<SparsityPattern>(row_parallel_partitioning.size(),
- col_parallel_partitioning.size())
+ const MPI_Comm & communicator)
+ : BlockSparsityPatternBase<SparsityPattern>(
+ row_parallel_partitioning.size(),
+ col_parallel_partitioning.size())
{
for (size_type i = 0; i < row_parallel_partitioning.size(); ++i)
for (size_type j = 0; j < col_parallel_partitioning.size(); ++j)
parallel_partitioning.size(), parallel_partitioning.size());
for (size_type i = 0; i < parallel_partitioning.size(); ++i)
for (size_type j = 0; j < parallel_partitioning.size(); ++j)
- this->block(i, j).reinit(
- parallel_partitioning[i], parallel_partitioning[j], communicator);
+ this->block(i, j).reinit(parallel_partitioning[i],
+ parallel_partitioning[j],
+ communicator);
this->collect_sizes();
}
template S2 ChunkSparseMatrix<S1>::matrix_scalar_product<S2>(
const Vector<S2> &, const Vector<S2> &) const;
- template S2 ChunkSparseMatrix<S1>::residual<S2>(
- Vector<S2> &, const Vector<S2> &, const Vector<S2> &) const;
+ template S2 ChunkSparseMatrix<S1>::residual<S2>(Vector<S2> &,
+ const Vector<S2> &,
+ const Vector<S2> &) const;
template void ChunkSparseMatrix<S1>::precondition_SSOR<S2>(
Vector<S2> &, const Vector<S2> &, const S1) const;
const std::vector<types::global_dof_index> &,
const std::vector<types::global_dof_index> &,
const S1) const;
- template void ChunkSparseMatrix<S1>::SOR_step<S2>(
- Vector<S2> &, const Vector<S2> &, const S1) const;
- template void ChunkSparseMatrix<S1>::TSOR_step<S2>(
- Vector<S2> &, const Vector<S2> &, const S1) const;
- template void ChunkSparseMatrix<S1>::SSOR_step<S2>(
- Vector<S2> &, const Vector<S2> &, const S1) const;
+ template void ChunkSparseMatrix<S1>::SOR_step<S2>(Vector<S2> &,
+ const Vector<S2> &,
+ const S1) const;
+ template void ChunkSparseMatrix<S1>::TSOR_step<S2>(Vector<S2> &,
+ const Vector<S2> &,
+ const S1) const;
+ template void ChunkSparseMatrix<S1>::SSOR_step<S2>(Vector<S2> &,
+ const Vector<S2> &,
+ const S1) const;
}
-ChunkSparsityPattern::ChunkSparsityPattern(const ChunkSparsityPattern &s) :
- Subscriptor(),
- chunk_size(s.chunk_size),
- sparsity_pattern(s.sparsity_pattern)
+ChunkSparsityPattern::ChunkSparsityPattern(const ChunkSparsityPattern &s)
+ : Subscriptor()
+ , chunk_size(s.chunk_size)
+ , sparsity_pattern(s.sparsity_pattern)
{
Assert(s.rows == 0 && s.cols == 0,
ExcMessage(
ChunkSparsityPattern &
ChunkSparsityPattern::operator=(const ChunkSparsityPattern &s)
{
- Assert(
- s.rows == 0 && s.cols == 0,
- ExcMessage("This operator can only be called if the provided argument "
- "is the sparsity pattern for an empty matrix. This operator can "
- "not be used to copy a non-empty sparsity pattern."));
+ Assert(s.rows == 0 && s.cols == 0,
+ ExcMessage(
+ "This operator can only be called if the provided argument "
+ "is the sparsity pattern for an empty matrix. This operator can "
+ "not be used to copy a non-empty sparsity pattern."));
Assert(rows == 0 && cols == 0,
ExcMessage("This operator can only be called if the current object is "
m <= sparsity_pattern_for_chunks.n_rows() * chunk_size_in,
ExcMessage("Number of rows m is not compatible with chunk size "
"and number of rows in sparsity pattern for the chunks."));
- Assert(
- n > (sparsity_pattern_for_chunks.n_cols() - 1) * chunk_size_in &&
- n <= sparsity_pattern_for_chunks.n_cols() * chunk_size_in,
- ExcMessage("Number of columns m is not compatible with chunk size "
- "and number of columns in sparsity pattern for the chunks."));
+ Assert(n > (sparsity_pattern_for_chunks.n_cols() - 1) * chunk_size_in &&
+ n <= sparsity_pattern_for_chunks.n_cols() * chunk_size_in,
+ ExcMessage(
+ "Number of columns m is not compatible with chunk size "
+ "and number of columns in sparsity pattern for the chunks."));
internal::copy_sparsity(sparsity_pattern_for_chunks, sparsity_pattern);
chunk_size = chunk_size_in;
template <typename Number>
SolverDirect<Number>::AdditionalData::AdditionalData(
- const std::string &solver_type) :
- solver_type(solver_type)
+ const std::string &solver_type)
+ : solver_type(solver_type)
{}
template <typename Number>
SolverDirect<Number>::SolverDirect(const Utilities::CUDA::Handle &handle,
SolverControl & cn,
- const AdditionalData & data) :
- cuda_handle(handle),
- solver_control(cn),
- additional_data(data.solver_type)
+ const AdditionalData & data)
+ : cuda_handle(handle)
+ , solver_control(cn)
+ , additional_data(data.solver_type)
{}
const LinearAlgebra::CUDAWrappers::Vector<Number> &b)
{
if (additional_data.solver_type == "Cholesky")
- internal::cholesky_factorization(
- cuda_handle.cusolver_sp_handle, A, b.get_values(), x.get_values());
+ internal::cholesky_factorization(cuda_handle.cusolver_sp_handle,
+ A,
+ b.get_values(),
+ x.get_values());
else if (additional_data.solver_type == "LU_dense")
internal::lu_factorization(cuda_handle.cusparse_handle,
cuda_handle.cusolver_dn_handle,
b.get_values(),
x.get_values());
else if (additional_data.solver_type == "LU_host")
- internal::lu_factorization(
- cuda_handle.cusolver_sp_handle, A, b.get_values(), x.get_values());
+ internal::lu_factorization(cuda_handle.cusolver_sp_handle,
+ A,
+ b.get_values(),
+ x.get_values());
else
AssertThrow(false,
ExcMessage("The provided solver name " +
template <typename Number>
- SparseMatrix<Number>::SparseMatrix() :
- nnz(0),
- n_rows(0),
- val_dev(nullptr),
- column_index_dev(nullptr),
- row_ptr_dev(nullptr),
- descr(nullptr)
+ SparseMatrix<Number>::SparseMatrix()
+ : nnz(0)
+ , n_rows(0)
+ , val_dev(nullptr)
+ , column_index_dev(nullptr)
+ , row_ptr_dev(nullptr)
+ , descr(nullptr)
{}
template <typename Number>
SparseMatrix<Number>::SparseMatrix(
Utilities::CUDA::Handle & handle,
- const ::dealii::SparseMatrix<Number> &sparse_matrix_host) :
- val_dev(nullptr),
- column_index_dev(nullptr),
- row_ptr_dev(nullptr),
- descr(nullptr)
+ const ::dealii::SparseMatrix<Number> &sparse_matrix_host)
+ : val_dev(nullptr)
+ , column_index_dev(nullptr)
+ , row_ptr_dev(nullptr)
+ , descr(nullptr)
{
reinit(handle, sparse_matrix_host);
}
// Copy the elements to the gpu
cudaError_t error_code = cudaMalloc(&val_dev, nnz * sizeof(Number));
AssertCuda(error_code);
- error_code = cudaMemcpy(
- val_dev, &val[0], nnz * sizeof(Number), cudaMemcpyHostToDevice);
+ error_code = cudaMemcpy(val_dev,
+ &val[0],
+ nnz * sizeof(Number),
+ cudaMemcpyHostToDevice);
AssertCuda(error_code);
// Copy the column indices to the gpu
typename Vector<Number>::size_type local_idx)
{
if (block_size >= 64)
- result_buffer[local_idx] = Operation::reduction_op(
- result_buffer[local_idx], result_buffer[local_idx + 32]);
+ result_buffer[local_idx] =
+ Operation::reduction_op(result_buffer[local_idx],
+ result_buffer[local_idx + 32]);
if (block_size >= 32)
- result_buffer[local_idx] = Operation::reduction_op(
- result_buffer[local_idx], result_buffer[local_idx + 16]);
+ result_buffer[local_idx] =
+ Operation::reduction_op(result_buffer[local_idx],
+ result_buffer[local_idx + 16]);
if (block_size >= 16)
- result_buffer[local_idx] = Operation::reduction_op(
- result_buffer[local_idx], result_buffer[local_idx + 8]);
+ result_buffer[local_idx] =
+ Operation::reduction_op(result_buffer[local_idx],
+ result_buffer[local_idx + 8]);
if (block_size >= 8)
- result_buffer[local_idx] = Operation::reduction_op(
- result_buffer[local_idx], result_buffer[local_idx + 4]);
+ result_buffer[local_idx] =
+ Operation::reduction_op(result_buffer[local_idx],
+ result_buffer[local_idx + 4]);
if (block_size >= 4)
- result_buffer[local_idx] = Operation::reduction_op(
- result_buffer[local_idx], result_buffer[local_idx + 2]);
+ result_buffer[local_idx] =
+ Operation::reduction_op(result_buffer[local_idx],
+ result_buffer[local_idx + 2]);
if (block_size >= 2)
- result_buffer[local_idx] = Operation::reduction_op(
- result_buffer[local_idx], result_buffer[local_idx + 1]);
+ result_buffer[local_idx] =
+ Operation::reduction_op(result_buffer[local_idx],
+ result_buffer[local_idx + 1]);
}
s = s >> 1)
{
if (local_idx < s)
- result_buffer[local_idx] = Operation::reduction_op(
- result_buffer[local_idx], result_buffer[local_idx + s]);
+ result_buffer[local_idx] =
+ Operation::reduction_op(result_buffer[local_idx],
+ result_buffer[local_idx + s]);
__syncthreads();
}
template <typename Number>
- Vector<Number>::Vector() : val(nullptr), n_elements(0)
+ Vector<Number>::Vector()
+ : val(nullptr)
+ , n_elements(0)
{}
template <typename Number>
- Vector<Number>::Vector(const Vector<Number> &V) : n_elements(V.n_elements)
+ Vector<Number>::Vector(const Vector<Number> &V)
+ : n_elements(V.n_elements)
{
// Allocate the memory
cudaError_t error_code = cudaMalloc(&val, n_elements * sizeof(Number));
AssertCuda(error_code);
// Copy the values.
- error_code = cudaMemcpy(
- val, V.val, n_elements * sizeof(Number), cudaMemcpyDeviceToDevice);
+ error_code = cudaMemcpy(val,
+ V.val,
+ n_elements * sizeof(Number),
+ cudaMemcpyDeviceToDevice);
AssertCuda(error_code);
}
template <typename Number>
- Vector<Number>::Vector(const size_type n) : val(nullptr), n_elements(0)
+ Vector<Number>::Vector(const size_type n)
+ : val(nullptr)
+ , n_elements(0)
{
reinit(n, false);
}
const int n_blocks = 1 + (n_elements - 1) / (chunk_size * block_size);
internal::double_vector_reduction<Number, internal::DotProduct<Number>>
- <<<dim3(n_blocks, 1), dim3(block_size)>>>(
- result_device,
- val,
- down_V.val,
- static_cast<unsigned int>(n_elements));
+ <<<dim3(n_blocks, 1), dim3(block_size)>>>(result_device,
+ val,
+ down_V.val,
+ static_cast<unsigned int>(
+ n_elements));
// Copy the result back to the host
Number result;
- error_code = cudaMemcpy(
- &result, result_device, sizeof(Number), cudaMemcpyDeviceToHost);
+ error_code = cudaMemcpy(&result,
+ result_device,
+ sizeof(Number),
+ cudaMemcpyDeviceToHost);
AssertCuda(error_code);
// Free the memory on the device
error_code = cudaFree(result_device);
"Cannot scale two vectors with different numbers of elements."));
const int n_blocks = 1 + (n_elements - 1) / (chunk_size * block_size);
- internal::scale<Number><<<dim3(n_blocks, 1), dim3(block_size)>>>(
- val, down_scaling_factors.val, n_elements);
+ internal::scale<Number>
+ <<<dim3(n_blocks, 1), dim3(block_size)>>>(val,
+ down_scaling_factors.val,
+ n_elements);
// Check that the kernel was launched correctly
AssertCuda(cudaGetLastError());
const int n_blocks = 1 + (n_elements - 1) / (chunk_size * block_size);
internal::reduction<Number, internal::ElemSum<Number>>
- <<<dim3(n_blocks, 1), dim3(block_size)>>>(
- result_device, val, n_elements);
+ <<<dim3(n_blocks, 1), dim3(block_size)>>>(result_device,
+ val,
+ n_elements);
// Copy the result back to the host
Number result;
- error_code = cudaMemcpy(
- &result, result_device, sizeof(Number), cudaMemcpyDeviceToHost);
+ error_code = cudaMemcpy(&result,
+ result_device,
+ sizeof(Number),
+ cudaMemcpyDeviceToHost);
AssertCuda(error_code);
// Free the memory on the device
error_code = cudaFree(result_device);
const int n_blocks = 1 + (n_elements - 1) / (chunk_size * block_size);
internal::reduction<Number, internal::L1Norm<Number>>
- <<<dim3(n_blocks, 1), dim3(block_size)>>>(
- result_device, val, n_elements);
+ <<<dim3(n_blocks, 1), dim3(block_size)>>>(result_device,
+ val,
+ n_elements);
// Copy the result back to the host
Number result;
- error_code = cudaMemcpy(
- &result, result_device, sizeof(Number), cudaMemcpyDeviceToHost);
+ error_code = cudaMemcpy(&result,
+ result_device,
+ sizeof(Number),
+ cudaMemcpyDeviceToHost);
AssertCuda(error_code);
// Free the memory on the device
error_code = cudaFree(result_device);
const int n_blocks = 1 + (n_elements - 1) / (chunk_size * block_size);
internal::reduction<Number, internal::LInfty<Number>>
- <<<dim3(n_blocks, 1), dim3(block_size)>>>(
- result_device, val, n_elements);
+ <<<dim3(n_blocks, 1), dim3(block_size)>>>(result_device,
+ val,
+ n_elements);
// Copy the result back to the host
Number result;
- error_code = cudaMemcpy(
- &result, result_device, sizeof(Number), cudaMemcpyDeviceToHost);
+ error_code = cudaMemcpy(&result,
+ result_device,
+ sizeof(Number),
+ cudaMemcpyDeviceToHost);
AssertCuda(error_code);
// Free the memory on the device
error_code = cudaFree(result_device);
// Copy the vector to the host
Number * cpu_val = new Number[n_elements];
- cudaError_t error_code = cudaMemcpy(
- cpu_val, val, n_elements * sizeof(Number), cudaMemcpyHostToDevice);
+ cudaError_t error_code = cudaMemcpy(cpu_val,
+ val,
+ n_elements * sizeof(Number),
+ cudaMemcpyHostToDevice);
AssertCuda(error_code);
for (unsigned int i = 0; i < n_elements; ++i)
out << cpu_val[i] << std::endl;
}
-DynamicSparsityPattern::DynamicSparsityPattern() :
- have_entries(false),
- rows(0),
- cols(0),
- rowset(0)
+DynamicSparsityPattern::DynamicSparsityPattern()
+ : have_entries(false)
+ , rows(0)
+ , cols(0)
+ , rowset(0)
{}
-DynamicSparsityPattern::DynamicSparsityPattern(
- const DynamicSparsityPattern &s) :
- Subscriptor(),
- have_entries(false),
- rows(0),
- cols(0),
- rowset(0)
+DynamicSparsityPattern::DynamicSparsityPattern(const DynamicSparsityPattern &s)
+ : Subscriptor()
+ , have_entries(false)
+ , rows(0)
+ , cols(0)
+ , rowset(0)
{
(void)s;
Assert(s.rows == 0 && s.cols == 0,
DynamicSparsityPattern::DynamicSparsityPattern(const size_type m,
const size_type n,
- const IndexSet &rowset_) :
- have_entries(false),
- rows(0),
- cols(0),
- rowset(0)
+ const IndexSet &rowset_)
+ : have_entries(false)
+ , rows(0)
+ , cols(0)
+ , rowset(0)
{
reinit(m, n, rowset_);
}
-DynamicSparsityPattern::DynamicSparsityPattern(const IndexSet &rowset_) :
- have_entries(false),
- rows(0),
- cols(0),
- rowset(0)
+DynamicSparsityPattern::DynamicSparsityPattern(const IndexSet &rowset_)
+ : have_entries(false)
+ , rows(0)
+ , cols(0)
+ , rowset(0)
{
reinit(rowset_.size(), rowset_.size(), rowset_);
}
-DynamicSparsityPattern::DynamicSparsityPattern(const size_type n) :
- have_entries(false),
- rows(0),
- cols(0),
- rowset(0)
+DynamicSparsityPattern::DynamicSparsityPattern(const size_type n)
+ : have_entries(false)
+ , rows(0)
+ , cols(0)
+ , rowset(0)
{
reinit(n, n);
}
DynamicSparsityPattern::operator=(const DynamicSparsityPattern &s)
{
(void)s;
- Assert(
- s.rows == 0 && s.cols == 0,
- ExcMessage("This operator can only be called if the provided argument "
- "is the sparsity pattern for an empty matrix. This operator can "
- "not be used to copy a non-empty sparsity pattern."));
+ Assert(s.rows == 0 && s.cols == 0,
+ ExcMessage(
+ "This operator can only be called if the provided argument "
+ "is the sparsity pattern for an empty matrix. This operator can "
+ "not be used to copy a non-empty sparsity pattern."));
Assert(rows == 0 && cols == 0,
ExcMessage("This operator can only be called if the current object is"
cols = n;
rowset = rowset_;
- Assert(
- rowset.size() == 0 || rowset.size() == m,
- ExcMessage("The IndexSet argument to this function needs to either "
- "be empty (indicating the complete set of rows), or have size "
- "equal to the desired number of rows as specified by the "
- "first argument to this function. (Of course, the number "
- "of indices in this IndexSet may be less than the number "
- "of rows, but the *size* of the IndexSet must be equal.)"));
+ Assert(rowset.size() == 0 || rowset.size() == m,
+ ExcMessage(
+ "The IndexSet argument to this function needs to either "
+ "be empty (indicating the complete set of rows), or have size "
+ "equal to the desired number of rows as specified by the "
+ "first argument to this function. (Of course, the number "
+ "of indices in this IndexSet may be less than the number "
+ "of rows, but the *size* of the IndexSet must be equal.)"));
std::vector<Line> new_lines(rowset.size() == 0 ? rows : rowset.n_elements());
lines.swap(new_lines);
const size_type rowindex =
rowset.size() == 0 ? i : rowset.index_within_set(i);
- return std::binary_search(
- lines[rowindex].entries.begin(), lines[rowindex].entries.end(), j);
+ return std::binary_search(lines[rowindex].entries.begin(),
+ lines[rowindex].entries.end(),
+ j);
}
namespace LACExceptions
{
- ExcPETScError::ExcPETScError(const int error_code) : error_code(error_code)
+ ExcPETScError::ExcPETScError(const int error_code)
+ : error_code(error_code)
{}
void
{
template class FullMatrix<S>;
- template void FullMatrix<S>::print(
- LogStream &, const unsigned int, const unsigned int) const;
- template void FullMatrix<S>::print(
- std::ostream &, const unsigned int, const unsigned int) const;
+ template void FullMatrix<S>::print(LogStream &,
+ const unsigned int,
+ const unsigned int) const;
+ template void FullMatrix<S>::print(std::ostream &,
+ const unsigned int,
+ const unsigned int) const;
template void FullMatrix<S>::copy_from<1>(const Tensor<2, 1> &,
const unsigned int,
template void FullMatrix<S1>::fill<S2>(
const FullMatrix<S2> &, size_type, size_type, size_type, size_type);
template void FullMatrix<S1>::add<S2>(const S1, const FullMatrix<S2> &);
- template void FullMatrix<S1>::add<S2>(
- const S1, const FullMatrix<S2> &, const S1, const FullMatrix<S2> &);
+ template void FullMatrix<S1>::add<S2>(const S1,
+ const FullMatrix<S2> &,
+ const S1,
+ const FullMatrix<S2> &);
template void FullMatrix<S1>::add<S2>(const S1,
const FullMatrix<S2> &,
const S1,
template void FullMatrix<S1>::Tadd<S2>(
const FullMatrix<S2> &, S1, size_type, size_type, size_type, size_type);
template void FullMatrix<S1>::equ<S2>(const S1, const FullMatrix<S2> &);
- template void FullMatrix<S1>::equ<S2>(
- const S1, const FullMatrix<S2> &, const S1, const FullMatrix<S2> &);
+ template void FullMatrix<S1>::equ<S2>(const S1,
+ const FullMatrix<S2> &,
+ const S1,
+ const FullMatrix<S2> &);
template void FullMatrix<S1>::equ<S2>(const S1,
const FullMatrix<S2> &,
const S1,
const FullMatrix<S2> &,
const S1,
const FullMatrix<S2> &);
- template void FullMatrix<S1>::mmult<S2>(
- FullMatrix<S2> &, const FullMatrix<S2> &, const bool) const;
- template void FullMatrix<S1>::Tmmult<S2>(
- FullMatrix<S2> &, const FullMatrix<S2> &, const bool) const;
- template void FullMatrix<S1>::mTmult<S2>(
- FullMatrix<S2> &, const FullMatrix<S2> &, const bool) const;
- template void FullMatrix<S1>::TmTmult<S2>(
- FullMatrix<S2> &, const FullMatrix<S2> &, const bool) const;
+ template void FullMatrix<S1>::mmult<S2>(FullMatrix<S2> &,
+ const FullMatrix<S2> &,
+ const bool) const;
+ template void FullMatrix<S1>::Tmmult<S2>(FullMatrix<S2> &,
+ const FullMatrix<S2> &,
+ const bool) const;
+ template void FullMatrix<S1>::mTmult<S2>(FullMatrix<S2> &,
+ const FullMatrix<S2> &,
+ const bool) const;
+ template void FullMatrix<S1>::TmTmult<S2>(FullMatrix<S2> &,
+ const FullMatrix<S2> &,
+ const bool) const;
template void FullMatrix<S1>::invert<S2>(const FullMatrix<S2> &);
template void FullMatrix<S1>::left_invert<S2>(const FullMatrix<S2> &);
// real matrices can be multiplied by real or complex vectors
for (S1 : REAL_SCALARS; S2 : REAL_AND_COMPLEX_SCALARS)
{
- template void FullMatrix<S1>::vmult<S2>(
- Vector<S2> &, const Vector<S2> &, bool) const;
- template void FullMatrix<S1>::Tvmult<S2>(
- Vector<S2> &, const Vector<S2> &, bool) const;
- template S2 FullMatrix<S1>::matrix_norm_square<S2>(const Vector<S2> &)
+ template void FullMatrix<S1>::vmult<S2>(Vector<S2> &,
+ const Vector<S2> &,
+ bool) const;
+ template void FullMatrix<S1>::Tvmult<S2>(Vector<S2> &,
+ const Vector<S2> &,
+ bool) const;
+ template S2 FullMatrix<S1>::matrix_norm_square<S2>(const Vector<S2> &)
+ const;
+ template S2 FullMatrix<S1>::matrix_scalar_product<S2>(const Vector<S2> &,
+ const Vector<S2> &)
const;
- template S2 FullMatrix<S1>::matrix_scalar_product<S2>(
- const Vector<S2> &, const Vector<S2> &) const;
template void FullMatrix<S1>::forward<S2>(Vector<S2> &, const Vector<S2> &)
const;
template void FullMatrix<S1>::backward<S2>(Vector<S2> &, const Vector<S2> &)
const;
- template void FullMatrix<S1>::precondition_Jacobi<S2>(
- Vector<S2> &, const Vector<S2> &, const S1) const;
+ template void FullMatrix<S1>::precondition_Jacobi<S2>(Vector<S2> &,
+ const Vector<S2> &,
+ const S1) const;
}
// complex matrices can be multiplied only by complex vectors
for (S1 : COMPLEX_SCALARS; S2 : COMPLEX_SCALARS)
{
- template void FullMatrix<S1>::vmult<S2>(
- Vector<S2> &, const Vector<S2> &, bool) const;
- template void FullMatrix<S1>::Tvmult<S2>(
- Vector<S2> &, const Vector<S2> &, bool) const;
- template S2 FullMatrix<S1>::matrix_norm_square<S2>(const Vector<S2> &)
+ template void FullMatrix<S1>::vmult<S2>(Vector<S2> &,
+ const Vector<S2> &,
+ bool) const;
+ template void FullMatrix<S1>::Tvmult<S2>(Vector<S2> &,
+ const Vector<S2> &,
+ bool) const;
+ template S2 FullMatrix<S1>::matrix_norm_square<S2>(const Vector<S2> &)
+ const;
+ template S2 FullMatrix<S1>::matrix_scalar_product<S2>(const Vector<S2> &,
+ const Vector<S2> &)
const;
- template S2 FullMatrix<S1>::matrix_scalar_product<S2>(
- const Vector<S2> &, const Vector<S2> &) const;
template void FullMatrix<S1>::forward<S2>(Vector<S2> &, const Vector<S2> &)
const;
template void FullMatrix<S1>::backward<S2>(Vector<S2> &, const Vector<S2> &)
const;
- template void FullMatrix<S1>::precondition_Jacobi<S2>(
- Vector<S2> &, const Vector<S2> &, const S1) const;
+ template void FullMatrix<S1>::precondition_Jacobi<S2>(Vector<S2> &,
+ const Vector<S2> &,
+ const S1) const;
}
for (S1, S2, S3 : REAL_SCALARS)
{
- template S1 FullMatrix<S1>::residual<S2, S3>(
- Vector<S2> &, const Vector<S2> &, const Vector<S3> &) const;
+ template S1 FullMatrix<S1>::residual<S2, S3>(Vector<S2> &,
+ const Vector<S2> &,
+ const Vector<S3> &) const;
}
template void FullMatrix<S1>::fill<S2>(
const FullMatrix<S2> &, size_type, size_type, size_type, size_type);
template void FullMatrix<S1>::add<S2>(const S1, const FullMatrix<S2> &);
- template void FullMatrix<S1>::add<S2>(
- const S1, const FullMatrix<S2> &, const S1, const FullMatrix<S2> &);
+ template void FullMatrix<S1>::add<S2>(const S1,
+ const FullMatrix<S2> &,
+ const S1,
+ const FullMatrix<S2> &);
template void FullMatrix<S1>::add<S2>(const S1,
const FullMatrix<S2> &,
const S1,
template void FullMatrix<S1>::Tadd<S2>(
const FullMatrix<S2> &, S1, size_type, size_type, size_type, size_type);
template void FullMatrix<S1>::equ<S2>(const S1, const FullMatrix<S2> &);
- template void FullMatrix<S1>::equ<S2>(
- const S1, const FullMatrix<S2> &, const S1, const FullMatrix<S2> &);
+ template void FullMatrix<S1>::equ<S2>(const S1,
+ const FullMatrix<S2> &,
+ const S1,
+ const FullMatrix<S2> &);
template void FullMatrix<S1>::equ<S2>(const S1,
const FullMatrix<S2> &,
const S1,
const FullMatrix<S2> &,
const S1,
const FullMatrix<S2> &);
- template void FullMatrix<S1>::mmult<S2>(
- FullMatrix<S2> &, const FullMatrix<S2> &, const bool) const;
- template void FullMatrix<S1>::Tmmult<S2>(
- FullMatrix<S2> &, const FullMatrix<S2> &, const bool) const;
+ template void FullMatrix<S1>::mmult<S2>(FullMatrix<S2> &,
+ const FullMatrix<S2> &,
+ const bool) const;
+ template void FullMatrix<S1>::Tmmult<S2>(FullMatrix<S2> &,
+ const FullMatrix<S2> &,
+ const bool) const;
template void FullMatrix<S1>::invert<S2>(const FullMatrix<S2> &);
template void FullMatrix<S1>::left_invert<S2>(const FullMatrix<S2> &);
for (S1, S2, S3 : COMPLEX_SCALARS)
{
- template S1 FullMatrix<S1>::residual<S2, S3>(
- Vector<S2> &, const Vector<S2> &, const Vector<S3> &) const;
+ template S1 FullMatrix<S1>::residual<S2, S3>(Vector<S2> &,
+ const Vector<S2> &,
+ const Vector<S3> &) const;
}
using namespace LAPACKSupport;
template <typename number>
-LAPACKFullMatrix<number>::LAPACKFullMatrix(const size_type n) :
- TransposeTable<number>(n, n),
- state(matrix),
- property(general)
+LAPACKFullMatrix<number>::LAPACKFullMatrix(const size_type n)
+ : TransposeTable<number>(n, n)
+ , state(matrix)
+ , property(general)
{}
template <typename number>
-LAPACKFullMatrix<number>::LAPACKFullMatrix(const size_type m,
- const size_type n) :
- TransposeTable<number>(m, n),
- state(matrix),
- property(general)
+LAPACKFullMatrix<number>::LAPACKFullMatrix(const size_type m, const size_type n)
+ : TransposeTable<number>(m, n)
+ , state(matrix)
+ , property(general)
{}
template <typename number>
-LAPACKFullMatrix<number>::LAPACKFullMatrix(const LAPACKFullMatrix &M) :
- TransposeTable<number>(M),
- state(matrix),
- property(general)
+LAPACKFullMatrix<number>::LAPACKFullMatrix(const LAPACKFullMatrix &M)
+ : TransposeTable<number>(M)
+ , state(matrix)
+ , property(general)
{}
}
else
{
- Assert(
- false,
- ExcMessage("The matrix has to be either factorized or triangular."));
+ Assert(false,
+ ExcMessage(
+ "The matrix has to be either factorized or triangular."));
}
Assert(info == 0, ExcInternalError());
}
else
{
- Assert(
- false,
- ExcMessage("The matrix has to be either factorized or triangular."));
+ Assert(false,
+ ExcMessage(
+ "The matrix has to be either factorized or triangular."));
}
Assert(info == 0, ExcInternalError());
DEAL_II_NAMESPACE_OPEN
-MeanValueFilter::MeanValueFilter(size_type component) : component(component)
+MeanValueFilter::MeanValueFilter(size_type component)
+ : component(component)
{}
template void
MatrixOut::Options::Options(const bool show_absolute_values,
const unsigned int block_size,
- const bool discontinuous) :
- show_absolute_values(show_absolute_values),
- block_size(block_size),
- discontinuous(discontinuous)
+ const bool discontinuous)
+ : show_absolute_values(show_absolute_values)
+ , block_size(block_size)
+ , discontinuous(discontinuous)
{}
- MatrixBase::MatrixBase() :
- matrix(nullptr),
- last_action(VectorOperation::unknown)
+ MatrixBase::MatrixBase()
+ : matrix(nullptr)
+ , last_action(VectorOperation::unknown)
{}
namespace PETScWrappers
{
- MatrixFree::MatrixFree() : communicator(PETSC_COMM_SELF)
+ MatrixFree::MatrixFree()
+ : communicator(PETSC_COMM_SELF)
{
const int m = 0;
do_reinit(m, m, m, m);
const unsigned int m,
const unsigned int n,
const unsigned int local_rows,
- const unsigned int local_columns) :
- communicator(communicator)
+ const unsigned int local_columns)
+ : communicator(communicator)
{
do_reinit(m, n, local_rows, local_columns);
}
const unsigned int n,
const std::vector<unsigned int> &local_rows_per_process,
const std::vector<unsigned int> &local_columns_per_process,
- const unsigned int this_process) :
- communicator(communicator)
+ const unsigned int this_process)
+ : communicator(communicator)
{
Assert(local_rows_per_process.size() == local_columns_per_process.size(),
ExcDimensionMismatch(local_rows_per_process.size(),
MatrixFree::MatrixFree(const unsigned int m,
const unsigned int n,
const unsigned int local_rows,
- const unsigned int local_columns) :
- communicator(MPI_COMM_WORLD)
+ const unsigned int local_columns)
+ : communicator(MPI_COMM_WORLD)
{
do_reinit(m, n, local_rows, local_columns);
}
const unsigned int n,
const std::vector<unsigned int> &local_rows_per_process,
const std::vector<unsigned int> &local_columns_per_process,
- const unsigned int this_process) :
- communicator(MPI_COMM_WORLD)
+ const unsigned int this_process)
+ : communicator(MPI_COMM_WORLD)
{
Assert(local_rows_per_process.size() == local_columns_per_process.size(),
ExcDimensionMismatch(local_rows_per_process.size(),
{
namespace MPI
{
- SparseMatrix::SparseMatrix() : communicator(MPI_COMM_SELF)
+ SparseMatrix::SparseMatrix()
+ : communicator(MPI_COMM_SELF)
{
// just like for vectors: since we
// create an empty matrix, we can as
const size_type local_columns,
const size_type n_nonzero_per_row,
const bool is_symmetric,
- const size_type n_offdiag_nonzero_per_row) :
- communicator(communicator)
+ const size_type n_offdiag_nonzero_per_row)
+ : communicator(communicator)
{
do_reinit(m,
n,
const size_type local_columns,
const std::vector<size_type> &row_lengths,
const bool is_symmetric,
- const std::vector<size_type> &offdiag_row_lengths) :
- communicator(communicator)
+ const std::vector<size_type> &offdiag_row_lengths)
+ : communicator(communicator)
{
do_reinit(m,
n,
const std::vector<size_type> &local_rows_per_process,
const std::vector<size_type> &local_columns_per_process,
const unsigned int this_process,
- const bool preset_nonzero_locations) :
- communicator(communicator)
+ const bool preset_nonzero_locations)
+ : communicator(communicator)
{
do_reinit(sparsity_pattern,
local_rows_per_process,
// TODO: There must be a significantly better way to provide information
// about the off-diagonal blocks of the matrix. this way, petsc keeps
// allocating tiny chunks of memory, and gets completely hung up over this
- const PetscErrorCode ierr = MatCreateAIJ(
- communicator,
- local_rows,
- local_columns,
- m,
- n,
- 0,
- int_row_lengths.data(),
- 0,
- offdiag_row_lengths.size() ? int_offdiag_row_lengths.data() : nullptr,
- &matrix);
+ const PetscErrorCode ierr =
+ MatCreateAIJ(communicator,
+ local_rows,
+ local_columns,
+ m,
+ n,
+ 0,
+ int_row_lengths.data(),
+ 0,
+ offdiag_row_lengths.size() ?
+ int_offdiag_row_lengths.data() :
+ nullptr,
+ &matrix);
// TODO: Sometimes the actual number of nonzero entries allocated is
// greater than the number of nonzero entries, which petsc will complain
ierr = MatGetOwnershipRangeColumn(matrix, &min, &max);
AssertThrow(ierr == 0, ExcPETScError(ierr));
- Assert(
- n_loc_cols == max - min,
- ExcMessage("PETSc is requiring non contiguous memory allocation."));
+ Assert(n_loc_cols == max - min,
+ ExcMessage(
+ "PETSc is requiring non contiguous memory allocation."));
IndexSet indices(n_cols);
indices.add_range(min, max);
ierr = MatGetOwnershipRange(matrix, &min, &max);
AssertThrow(ierr == 0, ExcPETScError(ierr));
- Assert(
- n_loc_rows == max - min,
- ExcMessage("PETSc is requiring non contiguous memory allocation."));
+ Assert(n_loc_rows == max - min,
+ ExcMessage(
+ "PETSc is requiring non contiguous memory allocation."));
IndexSet indices(n_rows);
indices.add_range(min, max);
{
namespace MPI
{
- Vector::Vector() : communicator(MPI_COMM_SELF)
+ Vector::Vector()
+ : communicator(MPI_COMM_SELF)
{
// virtual functions called in constructors and destructors never use the
// override in a derived class
Vector::Vector(const MPI_Comm &communicator,
const size_type n,
- const size_type local_size) :
- communicator(communicator)
+ const size_type local_size)
+ : communicator(communicator)
{
Vector::create_vector(n, local_size);
}
Vector::Vector(const MPI_Comm & communicator,
const VectorBase &v,
- const size_type local_size) :
- VectorBase(v),
- communicator(communicator)
+ const size_type local_size)
+ : VectorBase(v)
+ , communicator(communicator)
{
// In the past (before it was deprecated) this constructor did a
// byte-for-byte copy of v. This choice resulted in two problems:
Vector::Vector(const IndexSet &local,
const IndexSet &ghost,
- const MPI_Comm &communicator) :
- communicator(communicator)
+ const MPI_Comm &communicator)
+ : communicator(communicator)
{
Assert(local.is_ascending_and_one_to_one(communicator),
ExcNotImplemented());
- Vector::Vector(const IndexSet &local, const MPI_Comm &communicator) :
- communicator(communicator)
+ Vector::Vector(const IndexSet &local, const MPI_Comm &communicator)
+ : communicator(communicator)
{
Assert(local.is_ascending_and_one_to_one(communicator),
ExcNotImplemented());
namespace PETScWrappers
{
- PreconditionerBase::PreconditionerBase() : pc(nullptr), matrix(nullptr)
+ PreconditionerBase::PreconditionerBase()
+ : pc(nullptr)
+ , matrix(nullptr)
{}
PreconditionerBase::~PreconditionerBase()
/* ----------------- PreconditionSOR -------------------- */
- PreconditionSOR::AdditionalData::AdditionalData(const double omega) :
- omega(omega)
+ PreconditionSOR::AdditionalData::AdditionalData(const double omega)
+ : omega(omega)
{}
/* ----------------- PreconditionSSOR -------------------- */
- PreconditionSSOR::AdditionalData::AdditionalData(const double omega) :
- omega(omega)
+ PreconditionSSOR::AdditionalData::AdditionalData(const double omega)
+ : omega(omega)
{}
/* ----------------- PreconditionEisenstat -------------------- */
- PreconditionEisenstat::AdditionalData::AdditionalData(const double omega) :
- omega(omega)
+ PreconditionEisenstat::AdditionalData::AdditionalData(const double omega)
+ : omega(omega)
{}
/* ----------------- PreconditionICC -------------------- */
- PreconditionICC::AdditionalData::AdditionalData(const unsigned int levels) :
- levels(levels)
+ PreconditionICC::AdditionalData::AdditionalData(const unsigned int levels)
+ : levels(levels)
{}
/* ----------------- PreconditionILU -------------------- */
- PreconditionILU::AdditionalData::AdditionalData(const unsigned int levels) :
- levels(levels)
+ PreconditionILU::AdditionalData::AdditionalData(const unsigned int levels)
+ : levels(levels)
{}
const double strong_threshold,
const double max_row_sum,
const unsigned int aggressive_coarsening_num_levels,
- const bool output_details) :
- symmetric_operator(symmetric_operator),
- strong_threshold(strong_threshold),
- max_row_sum(max_row_sum),
- aggressive_coarsening_num_levels(aggressive_coarsening_num_levels),
- output_details(output_details)
+ const bool output_details)
+ : symmetric_operator(symmetric_operator)
+ , strong_threshold(strong_threshold)
+ , max_row_sum(max_row_sum)
+ , aggressive_coarsening_num_levels(aggressive_coarsening_num_levels)
+ , output_details(output_details)
{}
set_option_value("-pc_hypre_boomeramg_print_statistics", "1");
}
- set_option_value(
- "-pc_hypre_boomeramg_agg_nl",
- Utilities::to_string(additional_data.aggressive_coarsening_num_levels));
+ set_option_value("-pc_hypre_boomeramg_agg_nl",
+ Utilities::to_string(
+ additional_data.aggressive_coarsening_num_levels));
std::stringstream ssStream;
ssStream << additional_data.max_row_sum;
const unsigned int n_levels,
const double threshold,
const double filter,
- const bool output_details) :
- symmetric(symmetric),
- n_levels(n_levels),
- threshold(threshold),
- filter(filter),
- output_details(output_details)
+ const bool output_details)
+ : symmetric(symmetric)
+ , n_levels(n_levels)
+ , threshold(threshold)
+ , filter(filter)
+ , output_details(output_details)
{}
PreconditionLU::AdditionalData::AdditionalData(const double pivoting,
const double zero_pivot,
- const double damping) :
- pivoting(pivoting),
- zero_pivot(zero_pivot),
- damping(damping)
+ const double damping)
+ : pivoting(pivoting)
+ , zero_pivot(zero_pivot)
+ , damping(damping)
{}
- SolverBase::SolverBase(SolverControl &cn, const MPI_Comm &mpi_communicator) :
- solver_control(cn),
- mpi_communicator(mpi_communicator)
+ SolverBase::SolverBase(SolverControl &cn, const MPI_Comm &mpi_communicator)
+ : solver_control(cn)
+ , mpi_communicator(mpi_communicator)
{}
# if DEAL_II_PETSC_VERSION_LT(3, 5, 0)
// the last argument is irrelevant here,
// since we use the solver only once anyway
- ierr = KSPSetOperators(
- solver_data->ksp, A, preconditioner, SAME_PRECONDITIONER);
+ ierr = KSPSetOperators(solver_data->ksp,
+ A,
+ preconditioner,
+ SAME_PRECONDITIONER);
# else
ierr = KSPSetOperators(solver_data->ksp, A, preconditioner);
# endif
/* ---------------------- SolverRichardson ------------------------ */
- SolverRichardson::AdditionalData::AdditionalData(const double omega) :
- omega(omega)
+ SolverRichardson::AdditionalData::AdditionalData(const double omega)
+ : omega(omega)
{}
SolverRichardson::SolverRichardson(SolverControl & cn,
const MPI_Comm & mpi_communicator,
- const AdditionalData &data) :
- SolverBase(cn, mpi_communicator),
- additional_data(data)
+ const AdditionalData &data)
+ : SolverBase(cn, mpi_communicator)
+ , additional_data(data)
{}
SolverChebychev::SolverChebychev(SolverControl & cn,
const MPI_Comm & mpi_communicator,
- const AdditionalData &data) :
- SolverBase(cn, mpi_communicator),
- additional_data(data)
+ const AdditionalData &data)
+ : SolverBase(cn, mpi_communicator)
+ , additional_data(data)
{}
SolverCG::SolverCG(SolverControl & cn,
const MPI_Comm & mpi_communicator,
- const AdditionalData &data) :
- SolverBase(cn, mpi_communicator),
- additional_data(data)
+ const AdditionalData &data)
+ : SolverBase(cn, mpi_communicator)
+ , additional_data(data)
{}
SolverBiCG::SolverBiCG(SolverControl & cn,
const MPI_Comm & mpi_communicator,
- const AdditionalData &data) :
- SolverBase(cn, mpi_communicator),
- additional_data(data)
+ const AdditionalData &data)
+ : SolverBase(cn, mpi_communicator)
+ , additional_data(data)
{}
SolverGMRES::AdditionalData::AdditionalData(
const unsigned int restart_parameter,
- const bool right_preconditioning) :
- restart_parameter(restart_parameter),
- right_preconditioning(right_preconditioning)
+ const bool right_preconditioning)
+ : restart_parameter(restart_parameter)
+ , right_preconditioning(right_preconditioning)
{}
SolverGMRES::SolverGMRES(SolverControl & cn,
const MPI_Comm & mpi_communicator,
- const AdditionalData &data) :
- SolverBase(cn, mpi_communicator),
- additional_data(data)
+ const AdditionalData &data)
+ : SolverBase(cn, mpi_communicator)
+ , additional_data(data)
{}
// and do some equally nasty stuff that at
// least doesn't yield warnings...
int (*fun_ptr)(KSP, int);
- ierr = PetscObjectQueryFunction(
- (PetscObject)(ksp), "KSPGMRESSetRestart_C", (void (**)()) & fun_ptr);
+ ierr = PetscObjectQueryFunction((PetscObject)(ksp),
+ "KSPGMRESSetRestart_C",
+ (void (**)()) & fun_ptr);
AssertThrow(ierr == 0, ExcPETScError(ierr));
ierr = (*fun_ptr)(ksp, additional_data.restart_parameter);
SolverBicgstab::SolverBicgstab(SolverControl & cn,
const MPI_Comm & mpi_communicator,
- const AdditionalData &data) :
- SolverBase(cn, mpi_communicator),
- additional_data(data)
+ const AdditionalData &data)
+ : SolverBase(cn, mpi_communicator)
+ , additional_data(data)
{}
SolverCGS::SolverCGS(SolverControl & cn,
const MPI_Comm & mpi_communicator,
- const AdditionalData &data) :
- SolverBase(cn, mpi_communicator),
- additional_data(data)
+ const AdditionalData &data)
+ : SolverBase(cn, mpi_communicator)
+ , additional_data(data)
{}
SolverTFQMR::SolverTFQMR(SolverControl & cn,
const MPI_Comm & mpi_communicator,
- const AdditionalData &data) :
- SolverBase(cn, mpi_communicator),
- additional_data(data)
+ const AdditionalData &data)
+ : SolverBase(cn, mpi_communicator)
+ , additional_data(data)
{}
SolverTCQMR::SolverTCQMR(SolverControl & cn,
const MPI_Comm & mpi_communicator,
- const AdditionalData &data) :
- SolverBase(cn, mpi_communicator),
- additional_data(data)
+ const AdditionalData &data)
+ : SolverBase(cn, mpi_communicator)
+ , additional_data(data)
{}
SolverCR::SolverCR(SolverControl & cn,
const MPI_Comm & mpi_communicator,
- const AdditionalData &data) :
- SolverBase(cn, mpi_communicator),
- additional_data(data)
+ const AdditionalData &data)
+ : SolverBase(cn, mpi_communicator)
+ , additional_data(data)
{}
SolverLSQR::SolverLSQR(SolverControl & cn,
const MPI_Comm & mpi_communicator,
- const AdditionalData &data) :
- SolverBase(cn, mpi_communicator),
- additional_data(data)
+ const AdditionalData &data)
+ : SolverBase(cn, mpi_communicator)
+ , additional_data(data)
{}
SolverPreOnly::SolverPreOnly(SolverControl & cn,
const MPI_Comm & mpi_communicator,
- const AdditionalData &data) :
- SolverBase(cn, mpi_communicator),
- additional_data(data)
+ const AdditionalData &data)
+ : SolverBase(cn, mpi_communicator)
+ , additional_data(data)
{}
SparseDirectMUMPS::SparseDirectMUMPS(SolverControl & cn,
const MPI_Comm & mpi_communicator,
- const AdditionalData &data) :
- SolverBase(cn, mpi_communicator),
- additional_data(data),
- symmetric_mode(false)
+ const AdditionalData &data)
+ : SolverBase(cn, mpi_communicator)
+ , additional_data(data)
+ , symmetric_mode(false)
{}
for (size_type i = 0; i < sparsity_pattern.n_rows(); ++i)
row_lengths[i] = sparsity_pattern.row_length(i);
- do_reinit(
- sparsity_pattern.n_rows(), sparsity_pattern.n_cols(), row_lengths, false);
+ do_reinit(sparsity_pattern.n_rows(),
+ sparsity_pattern.n_cols(),
+ row_lengths,
+ false);
// next preset the exact given matrix
// entries with zeros, if the user
}
} // namespace internal
- VectorBase::VectorBase() :
- vector(nullptr),
- ghosted(false),
- last_action(::dealii::VectorOperation::unknown),
- obtained_ownership(true)
+ VectorBase::VectorBase()
+ : vector(nullptr)
+ , ghosted(false)
+ , last_action(::dealii::VectorOperation::unknown)
+ , obtained_ownership(true)
{
Assert(MultithreadInfo::is_running_single_threaded(),
ExcMessage("PETSc does not support multi-threaded access, set "
- VectorBase::VectorBase(const VectorBase &v) :
- Subscriptor(),
- ghosted(v.ghosted),
- ghost_indices(v.ghost_indices),
- last_action(::dealii::VectorOperation::unknown),
- obtained_ownership(true)
+ VectorBase::VectorBase(const VectorBase &v)
+ : Subscriptor()
+ , ghosted(v.ghosted)
+ , ghost_indices(v.ghost_indices)
+ , last_action(::dealii::VectorOperation::unknown)
+ , obtained_ownership(true)
{
Assert(MultithreadInfo::is_running_single_threaded(),
ExcMessage("PETSc does not support multi-threaded access, set "
- VectorBase::VectorBase(const Vec &v) :
- Subscriptor(),
- vector(v),
- ghosted(false),
- last_action(::dealii::VectorOperation::unknown),
- obtained_ownership(false)
+ VectorBase::VectorBase(const Vec &v)
+ : Subscriptor()
+ , vector(v)
+ , ghosted(false)
+ , last_action(::dealii::VectorOperation::unknown)
+ , obtained_ownership(false)
{
Assert(MultithreadInfo::is_running_single_threaded(),
ExcMessage("PETSc does not support multi-threaded access, set "
const std::shared_ptr<const Utilities::MPI::ProcessGrid> &process_grid,
const size_type row_block_size_,
const size_type column_block_size_,
- const LAPACKSupport::Property property_) :
- uplo('L'), // for non-symmetric matrices this is not needed
- first_process_row(0),
- first_process_column(0),
- submatrix_row(1),
- submatrix_column(1)
+ const LAPACKSupport::Property property_)
+ : uplo('L')
+ , // for non-symmetric matrices this is not needed
+ first_process_row(0)
+ , first_process_column(0)
+ , submatrix_row(1)
+ , submatrix_column(1)
{
reinit(n_rows_,
n_columns_,
const size_type size,
const std::shared_ptr<const Utilities::MPI::ProcessGrid> process_grid,
const size_type block_size,
- const LAPACKSupport::Property property) :
- ScaLAPACKMatrix<NumberType>(size,
- size,
- process_grid,
- block_size,
- block_size,
- property)
+ const LAPACKSupport::Property property)
+ : ScaLAPACKMatrix<NumberType>(size,
+ size,
+ process_grid,
+ block_size,
+ block_size,
+ property)
{}
// Currently, copying of matrices will only be supported if A and B share the
// same MPI communicator
int ierr, comparison;
- ierr = MPI_Comm_compare(
- grid->mpi_communicator, B.grid->mpi_communicator, &comparison);
+ ierr = MPI_Comm_compare(grid->mpi_communicator,
+ B.grid->mpi_communicator,
+ &comparison);
AssertThrowMPI(ierr);
Assert(comparison == MPI_IDENT,
ExcMessage("Matrix A and B must have a common MPI Communicator"));
int union_n_process_rows =
Utilities::MPI::n_mpi_processes(this->grid->mpi_communicator);
int union_n_process_columns = 1;
- Cblacs_gridinit(
- &union_blacs_context, order, union_n_process_rows, union_n_process_columns);
+ Cblacs_gridinit(&union_blacs_context,
+ order,
+ union_n_process_rows,
+ union_n_process_columns);
int n_grid_rows_A, n_grid_columns_A, my_row_A, my_column_A;
Cblacs_gridinfo(this->grid->blacs_context,
// first argument, even if the program we are currently running
// and that is calling this function only works on a subset of
// processes. the same holds for the wrapper/fallback we are using here.
- ierr = Utilities::MPI::create_group(
- MPI_COMM_WORLD, group_union, 5, &mpi_communicator_union);
+ ierr = Utilities::MPI::create_group(MPI_COMM_WORLD,
+ group_union,
+ 5,
+ &mpi_communicator_union);
AssertThrowMPI(ierr);
/*
ExcDimensionMismatch(B.n_rows, C.n_columns));
Assert(this->row_block_size == C.row_block_size,
ExcDimensionMismatch(this->row_block_size, C.row_block_size));
- Assert(
- this->column_block_size == B.column_block_size,
- ExcDimensionMismatch(this->column_block_size, B.column_block_size));
+ Assert(this->column_block_size == B.column_block_size,
+ ExcDimensionMismatch(this->column_block_size,
+ B.column_block_size));
Assert(B.row_block_size == C.column_block_size,
ExcDimensionMismatch(B.row_block_size, C.column_block_size));
}
Assert(!std::isnan(value_limits.second),
ExcMessage("value_limits.second is NaN"));
- std::pair<unsigned int, unsigned int> indices = std::make_pair(
- numbers::invalid_unsigned_int, numbers::invalid_unsigned_int);
+ std::pair<unsigned int, unsigned int> indices =
+ std::make_pair(numbers::invalid_unsigned_int,
+ numbers::invalid_unsigned_int);
return eigenpairs_symmetric(compute_eigenvectors, indices, value_limits);
}
// distributed matrix
std::unique_ptr<ScaLAPACKMatrix<NumberType>> eigenvectors =
compute_eigenvectors ?
- std_cxx14::make_unique<ScaLAPACKMatrix<NumberType>>(
- n_rows, grid, row_block_size) :
+ std_cxx14::make_unique<ScaLAPACKMatrix<NumberType>>(n_rows,
+ grid,
+ row_block_size) :
std_cxx14::make_unique<ScaLAPACKMatrix<NumberType>>(
grid->n_process_rows, grid->n_process_columns, grid, 1, 1);
AssertIsFinite(value_limits.first);
AssertIsFinite(value_limits.second);
- const std::pair<unsigned int, unsigned int> indices = std::make_pair(
- numbers::invalid_unsigned_int, numbers::invalid_unsigned_int);
+ const std::pair<unsigned int, unsigned int> indices =
+ std::make_pair(numbers::invalid_unsigned_int,
+ numbers::invalid_unsigned_int);
return eigenpairs_symmetric_MRRR(compute_eigenvectors, indices, value_limits);
}
// distributed matrix.
std::unique_ptr<ScaLAPACKMatrix<NumberType>> eigenvectors =
compute_eigenvectors ?
- std_cxx14::make_unique<ScaLAPACKMatrix<NumberType>>(
- n_rows, grid, row_block_size) :
+ std_cxx14::make_unique<ScaLAPACKMatrix<NumberType>>(n_rows,
+ grid,
+ row_block_size) :
std_cxx14::make_unique<ScaLAPACKMatrix<NumberType>>(
grid->n_process_rows, grid->n_process_columns, grid, 1, 1);
ExcDimensionMismatch(row_block_size, VT->row_block_size));
Assert(column_block_size == VT->column_block_size,
ExcDimensionMismatch(column_block_size, VT->column_block_size));
- Assert(
- grid->blacs_context == VT->grid->blacs_context,
- ExcDimensionMismatch(grid->blacs_context, VT->grid->blacs_context));
+ Assert(grid->blacs_context == VT->grid->blacs_context,
+ ExcDimensionMismatch(grid->blacs_context,
+ VT->grid->blacs_context));
}
Threads::Mutex::ScopedLock lock(mutex);
// see
// https://www.ibm.com/support/knowledgecenter/en/SSNR5K_4.2.0/com.ibm.cluster.pessl.v4r2.pssl100.doc/am6gr_lgels.htm
- Assert(
- row_block_size == column_block_size,
- ExcMessage("Use identical block sizes for rows and columns of matrix A"));
- Assert(
- B.row_block_size == B.column_block_size,
- ExcMessage("Use identical block sizes for rows and columns of matrix B"));
- Assert(
- row_block_size == B.row_block_size,
- ExcMessage("Use identical block-cyclic distribution for matrices A and B"));
+ Assert(row_block_size == column_block_size,
+ ExcMessage(
+ "Use identical block sizes for rows and columns of matrix A"));
+ Assert(B.row_block_size == B.column_block_size,
+ ExcMessage(
+ "Use identical block sizes for rows and columns of matrix B"));
+ Assert(row_block_size == B.row_block_size,
+ ExcMessage(
+ "Use identical block-cyclic distribution for matrices A and B"));
Threads::Mutex::ScopedLock lock(mutex);
Assert(state == LAPACKSupport::matrix,
ExcMessage(
"Matrix has to be in Matrix state before calling this function."));
- Assert(
- row_block_size == column_block_size,
- ExcMessage("Use identical block sizes for rows and columns of matrix A"));
+ Assert(row_block_size == column_block_size,
+ ExcMessage(
+ "Use identical block sizes for rows and columns of matrix A"));
Assert(
ratio > 0. && ratio < 1.,
ExcMessage(
* an effectively serial ScaLAPACK matrix to gather the contents from the
* current object
*/
- const auto column_grid = std::make_shared<Utilities::MPI::ProcessGrid>(
- this->grid->mpi_communicator, 1, 1);
+ const auto column_grid =
+ std::make_shared<Utilities::MPI::ProcessGrid>(this->grid->mpi_communicator,
+ 1,
+ 1);
const int MB = n_rows, NB = n_columns;
ScaLAPACKMatrix<NumberType> tmp(n_rows, n_columns, column_grid, MB, NB);
*
* Create a 1xn_processes column grid
*/
- const auto column_grid = std::make_shared<Utilities::MPI::ProcessGrid>(
- this->grid->mpi_communicator, 1, n_mpi_processes);
+ const auto column_grid =
+ std::make_shared<Utilities::MPI::ProcessGrid>(this->grid->mpi_communicator,
+ 1,
+ n_mpi_processes);
const int MB = n_rows, NB = std::ceil(n_columns / n_mpi_processes);
ScaLAPACKMatrix<NumberType> tmp(n_rows, n_columns, column_grid, MB, NB);
* file
*/
// create a 1xP column grid with P being the number of MPI processes
- const auto one_grid = std::make_shared<Utilities::MPI::ProcessGrid>(
- this->grid->mpi_communicator, 1, 1);
+ const auto one_grid =
+ std::make_shared<Utilities::MPI::ProcessGrid>(this->grid->mpi_communicator,
+ 1,
+ 1);
const int MB = n_rows, NB = n_columns;
ScaLAPACKMatrix<NumberType> tmp(n_rows, n_columns, one_grid, MB, NB);
* of the matrix, which they can write to the file
*/
// create a 1xP column grid with P being the number of MPI processes
- const auto column_grid = std::make_shared<Utilities::MPI::ProcessGrid>(
- this->grid->mpi_communicator, 1, n_mpi_processes);
+ const auto column_grid =
+ std::make_shared<Utilities::MPI::ProcessGrid>(this->grid->mpi_communicator,
+ 1,
+ n_mpi_processes);
const int MB = n_rows, NB = std::ceil(n_columns / n_mpi_processes);
ScaLAPACKMatrix<NumberType> tmp(n_rows, n_columns, column_grid, MB, NB);
namespace SLEPcWrappers
{
- SolverBase::SolverBase(SolverControl &cn, const MPI_Comm &mpi_communicator) :
- solver_control(cn),
- mpi_communicator(mpi_communicator),
- reason(EPS_CONVERGED_ITERATING)
+ SolverBase::SolverBase(SolverControl &cn, const MPI_Comm &mpi_communicator)
+ : solver_control(cn)
+ , mpi_communicator(mpi_communicator)
+ , reason(EPS_CONVERGED_ITERATING)
{
// create eigensolver context
PetscErrorCode ierr = EPSCreate(mpi_communicator, &eps);
// hand over the absolute tolerance and the maximum number of
// iteration steps to the SLEPc convergence criterion.
- ierr = EPSSetTolerances(
- eps, this->solver_control.tolerance(), this->solver_control.max_steps());
+ ierr = EPSSetTolerances(eps,
+ this->solver_control.tolerance(),
+ this->solver_control.max_steps());
AssertThrow(ierr == 0, ExcSLEPcError(ierr));
// default values:
/* ---------------------- SolverKrylovSchur ------------------------ */
SolverKrylovSchur::SolverKrylovSchur(SolverControl & cn,
const MPI_Comm & mpi_communicator,
- const AdditionalData &data) :
- SolverBase(cn, mpi_communicator),
- additional_data(data)
+ const AdditionalData &data)
+ : SolverBase(cn, mpi_communicator)
+ , additional_data(data)
{
const PetscErrorCode ierr =
EPSSetType(eps, const_cast<char *>(EPSKRYLOVSCHUR));
/* ---------------------- SolverArnoldi ------------------------ */
SolverArnoldi::AdditionalData::AdditionalData(
- const bool delayed_reorthogonalization) :
- delayed_reorthogonalization(delayed_reorthogonalization)
+ const bool delayed_reorthogonalization)
+ : delayed_reorthogonalization(delayed_reorthogonalization)
{}
SolverArnoldi::SolverArnoldi(SolverControl & cn,
const MPI_Comm & mpi_communicator,
- const AdditionalData &data) :
- SolverBase(cn, mpi_communicator),
- additional_data(data)
+ const AdditionalData &data)
+ : SolverBase(cn, mpi_communicator)
+ , additional_data(data)
{
PetscErrorCode ierr = EPSSetType(eps, const_cast<char *>(EPSARNOLDI));
AssertThrow(ierr == 0, ExcSLEPcError(ierr));
/* ---------------------- Lanczos ------------------------ */
- SolverLanczos::AdditionalData::AdditionalData(
- const EPSLanczosReorthogType r) :
- reorthog(r)
+ SolverLanczos::AdditionalData::AdditionalData(const EPSLanczosReorthogType r)
+ : reorthog(r)
{}
SolverLanczos::SolverLanczos(SolverControl & cn,
const MPI_Comm & mpi_communicator,
- const AdditionalData &data) :
- SolverBase(cn, mpi_communicator),
- additional_data(data)
+ const AdditionalData &data)
+ : SolverBase(cn, mpi_communicator)
+ , additional_data(data)
{
PetscErrorCode ierr = EPSSetType(eps, const_cast<char *>(EPSLANCZOS));
AssertThrow(ierr == 0, ExcSLEPcError(ierr));
/* ----------------------- Power ------------------------- */
SolverPower::SolverPower(SolverControl & cn,
const MPI_Comm & mpi_communicator,
- const AdditionalData &data) :
- SolverBase(cn, mpi_communicator),
- additional_data(data)
+ const AdditionalData &data)
+ : SolverBase(cn, mpi_communicator)
+ , additional_data(data)
{
PetscErrorCode ierr = EPSSetType(eps, const_cast<char *>(EPSPOWER));
AssertThrow(ierr == 0, ExcSLEPcError(ierr));
/* ---------------- Generalized Davidson ----------------- */
SolverGeneralizedDavidson::AdditionalData::AdditionalData(
- bool double_expansion) :
- double_expansion(double_expansion)
+ bool double_expansion)
+ : double_expansion(double_expansion)
{}
SolverGeneralizedDavidson::SolverGeneralizedDavidson(
SolverControl & cn,
const MPI_Comm & mpi_communicator,
- const AdditionalData &data) :
- SolverBase(cn, mpi_communicator),
- additional_data(data)
+ const AdditionalData &data)
+ : SolverBase(cn, mpi_communicator)
+ , additional_data(data)
{
PetscErrorCode ierr = EPSSetType(eps, const_cast<char *>(EPSGD));
AssertThrow(ierr == 0, ExcSLEPcError(ierr));
/* ------------------ Jacobi Davidson -------------------- */
SolverJacobiDavidson::SolverJacobiDavidson(SolverControl & cn,
const MPI_Comm &mpi_communicator,
- const AdditionalData &data) :
- SolverBase(cn, mpi_communicator),
- additional_data(data)
+ const AdditionalData &data)
+ : SolverBase(cn, mpi_communicator)
+ , additional_data(data)
{
const PetscErrorCode ierr = EPSSetType(eps, const_cast<char *>(EPSJD));
AssertThrow(ierr == 0, ExcSLEPcError(ierr));
/* ---------------------- LAPACK ------------------------- */
SolverLAPACK::SolverLAPACK(SolverControl & cn,
const MPI_Comm & mpi_communicator,
- const AdditionalData &data) :
- SolverBase(cn, mpi_communicator),
- additional_data(data)
+ const AdditionalData &data)
+ : SolverBase(cn, mpi_communicator)
+ , additional_data(data)
{
// 'Tis overwhelmingly likely that PETSc/SLEPc *always* has
// BLAS/LAPACK, but let's be defensive.
/* ------------------- TransformationShift --------------------- */
TransformationShift::AdditionalData::AdditionalData(
- const double shift_parameter) :
- shift_parameter(shift_parameter)
+ const double shift_parameter)
+ : shift_parameter(shift_parameter)
{}
TransformationShift::TransformationShift(const MPI_Comm &mpi_communicator,
- const AdditionalData &data) :
- TransformationBase(mpi_communicator),
- additional_data(data)
+ const AdditionalData &data)
+ : TransformationBase(mpi_communicator)
+ , additional_data(data)
{
PetscErrorCode ierr = STSetType(st, const_cast<char *>(STSHIFT));
AssertThrow(ierr == 0, SolverBase::ExcSLEPcError(ierr));
/* ---------------- TransformationShiftInvert ------------------ */
TransformationShiftInvert::AdditionalData::AdditionalData(
- const double shift_parameter) :
- shift_parameter(shift_parameter)
+ const double shift_parameter)
+ : shift_parameter(shift_parameter)
{}
TransformationShiftInvert::TransformationShiftInvert(
const MPI_Comm & mpi_communicator,
- const AdditionalData &data) :
- TransformationBase(mpi_communicator),
- additional_data(data)
+ const AdditionalData &data)
+ : TransformationBase(mpi_communicator)
+ , additional_data(data)
{
PetscErrorCode ierr = STSetType(st, const_cast<char *>(STSINVERT));
AssertThrow(ierr == 0, SolverBase::ExcSLEPcError(ierr));
/* --------------- TransformationSpectrumFolding ----------------- */
TransformationSpectrumFolding::AdditionalData::AdditionalData(
- const double shift_parameter) :
- shift_parameter(shift_parameter)
+ const double shift_parameter)
+ : shift_parameter(shift_parameter)
{}
TransformationSpectrumFolding::TransformationSpectrumFolding(
const MPI_Comm & mpi_communicator,
- const AdditionalData &data) :
- TransformationBase(mpi_communicator),
- additional_data(data)
+ const AdditionalData &data)
+ : TransformationBase(mpi_communicator)
+ , additional_data(data)
{
# if DEAL_II_PETSC_VERSION_LT(3, 5, 0)
PetscErrorCode ierr = STSetType(st, const_cast<char *>(STFOLD));
TransformationCayley::AdditionalData::AdditionalData(
const double shift_parameter,
- const double antishift_parameter) :
- shift_parameter(shift_parameter),
- antishift_parameter(antishift_parameter)
+ const double antishift_parameter)
+ : shift_parameter(shift_parameter)
+ , antishift_parameter(antishift_parameter)
{}
TransformationCayley::TransformationCayley(const MPI_Comm &mpi_communicator,
- const AdditionalData &data) :
- TransformationBase(mpi_communicator),
- additional_data(data)
+ const AdditionalData &data)
+ : TransformationBase(mpi_communicator)
+ , additional_data(data)
{
PetscErrorCode ierr = STSetType(st, const_cast<char *>(STCAYLEY));
AssertThrow(ierr == 0, SolverBase::ExcSLEPcError(ierr));
DEAL_II_NAMESPACE_OPEN
-internal::SolverBicgstabData::SolverBicgstabData() :
- alpha(0.),
- beta(0.),
- omega(0.),
- rho(0.),
- rhobar(0.),
- step(numbers::invalid_unsigned_int),
- res(numbers::signaling_nan<double>())
+internal::SolverBicgstabData::SolverBicgstabData()
+ : alpha(0.)
+ , beta(0.)
+ , omega(0.)
+ , rho(0.)
+ , rhobar(0.)
+ , step(numbers::invalid_unsigned_int)
+ , res(numbers::signaling_nan<double>())
{}
SolverControl::SolverControl(const unsigned int maxiter,
const double tolerance,
const bool m_log_history,
- const bool m_log_result) :
- maxsteps(maxiter),
- tol(tolerance),
- lcheck(failure),
- initial_val(numbers::signaling_nan<double>()),
- lvalue(numbers::signaling_nan<double>()),
- lstep(numbers::invalid_unsigned_int),
- check_failure(false),
- relative_failure_residual(0),
- failure_residual(0),
- m_log_history(m_log_history),
- m_log_frequency(1),
- m_log_result(m_log_result),
- history_data_enabled(false)
+ const bool m_log_result)
+ : maxsteps(maxiter)
+ , tol(tolerance)
+ , lcheck(failure)
+ , initial_val(numbers::signaling_nan<double>())
+ , lvalue(numbers::signaling_nan<double>())
+ , lstep(numbers::invalid_unsigned_int)
+ , check_failure(false)
+ , relative_failure_residual(0)
+ , failure_residual(0)
+ , m_log_history(m_log_history)
+ , m_log_frequency(1)
+ , m_log_result(m_log_result)
+ , history_data_enabled(false)
{}
const double tol,
const double red,
const bool m_log_history,
- const bool m_log_result) :
- SolverControl(n, tol, m_log_history, m_log_result),
- reduce(red),
- reduced_tol(numbers::signaling_nan<double>())
+ const bool m_log_result)
+ : SolverControl(n, tol, m_log_history, m_log_result)
+ , reduce(red)
+ , reduced_tol(numbers::signaling_nan<double>())
{}
-ReductionControl::ReductionControl(const SolverControl &c) :
- SolverControl(c),
- reduce(numbers::signaling_nan<double>()),
- reduced_tol(numbers::signaling_nan<double>())
+ReductionControl::ReductionControl(const SolverControl &c)
+ : SolverControl(c)
+ , reduce(numbers::signaling_nan<double>())
+ , reduced_tol(numbers::signaling_nan<double>())
{
set_reduction(0.);
}
IterationNumberControl::IterationNumberControl(const unsigned int n,
const double tolerance,
const bool m_log_history,
- const bool m_log_result) :
- SolverControl(n, tolerance, m_log_history, m_log_result)
+ const bool m_log_result)
+ : SolverControl(n, tolerance, m_log_history, m_log_result)
{}
const double tolerance,
const unsigned int n_consecutive_iterations,
const bool m_log_history,
- const bool m_log_result) :
- SolverControl(n, tolerance, m_log_history, m_log_result),
- n_consecutive_iterations(n_consecutive_iterations),
- n_converged_iterations(0)
+ const bool m_log_result)
+ : SolverControl(n, tolerance, m_log_history, m_log_result)
+ , n_consecutive_iterations(n_consecutive_iterations)
+ , n_converged_iterations(0)
{
AssertThrow(n_consecutive_iterations > 0,
ExcMessage("n_consecutive_iterations should be positive"));
-ConsecutiveControl::ConsecutiveControl(const SolverControl &c) :
- SolverControl(c),
- n_consecutive_iterations(1),
- n_converged_iterations(0)
+ConsecutiveControl::ConsecutiveControl(const SolverControl &c)
+ : SolverControl(c)
+ , n_consecutive_iterations(1)
+ , n_converged_iterations(0)
{}
#ifdef DEAL_II_WITH_UMFPACK
-SparseDirectUMFPACK::SparseDirectUMFPACK() :
- _m(0),
- _n(0),
- symbolic_decomposition(nullptr),
- numeric_decomposition(nullptr),
- control(UMFPACK_CONTROL)
+SparseDirectUMFPACK::SparseDirectUMFPACK()
+ : _m(0)
+ , _n(0)
+ , symbolic_decomposition(nullptr)
+ , numeric_decomposition(nullptr)
+ , control(UMFPACK_CONTROL)
{
umfpack_dl_defaults(control.data());
}
#else
-SparseDirectUMFPACK::SparseDirectUMFPACK() :
- _m(0),
- _n(0),
- symbolic_decomposition(0),
- numeric_decomposition(0),
- control(0)
+SparseDirectUMFPACK::SparseDirectUMFPACK()
+ : _m(0)
+ , _n(0)
+ , symbolic_decomposition(0)
+ , numeric_decomposition(0)
+ , control(0)
{}
// explicit instantiations for SparseMatrixUMFPACK
#define InstantiateUMFPACK(MatrixType) \
template void SparseDirectUMFPACK::factorize(const MatrixType &); \
- template void SparseDirectUMFPACK::solve( \
- const MatrixType &, Vector<double> &, bool); \
- template void SparseDirectUMFPACK::solve( \
- const MatrixType &, BlockVector<double> &, bool); \
+ template void SparseDirectUMFPACK::solve(const MatrixType &, \
+ Vector<double> &, \
+ bool); \
+ template void SparseDirectUMFPACK::solve(const MatrixType &, \
+ BlockVector<double> &, \
+ bool); \
template void SparseDirectUMFPACK::initialize(const MatrixType &, \
const AdditionalData);
template S2 SparseMatrix<S1>::matrix_norm_square<S2>(const Vector<S2> &)
const;
- template S2 SparseMatrix<S1>::matrix_scalar_product<S2>(
- const Vector<S2> &, const Vector<S2> &) const;
+ template S2 SparseMatrix<S1>::matrix_scalar_product<S2>(const Vector<S2> &,
+ const Vector<S2> &)
+ const;
- template S2 SparseMatrix<S1>::residual<S2>(
- Vector<S2> &, const Vector<S2> &, const Vector<S2> &) const;
+ template S2 SparseMatrix<S1>::residual<S2>(Vector<S2> &,
+ const Vector<S2> &,
+ const Vector<S2> &) const;
template void SparseMatrix<S1>::precondition_SSOR<S2>(
Vector<S2> &,
const S1,
const std::vector<std::size_t> &) const;
- template void SparseMatrix<S1>::precondition_SOR<S2>(
- Vector<S2> &, const Vector<S2> &, const S1) const;
+ template void SparseMatrix<S1>::precondition_SOR<S2>(Vector<S2> &,
+ const Vector<S2> &,
+ const S1) const;
- template void SparseMatrix<S1>::precondition_TSOR<S2>(
- Vector<S2> &, const Vector<S2> &, const S1) const;
+ template void SparseMatrix<S1>::precondition_TSOR<S2>(Vector<S2> &,
+ const Vector<S2> &,
+ const S1) const;
- template void SparseMatrix<S1>::precondition_Jacobi<S2>(
- Vector<S2> &, const Vector<S2> &, const S1) const;
+ template void SparseMatrix<S1>::precondition_Jacobi<S2>(Vector<S2> &,
+ const Vector<S2> &,
+ const S1) const;
template void SparseMatrix<S1>::SOR<S2>(Vector<S2> &, const S1) const;
template void SparseMatrix<S1>::TSOR<S2>(Vector<S2> &, const S1) const;
const std::vector<size_type> &,
const std::vector<size_type> &,
const S1) const;
- template void SparseMatrix<S1>::Jacobi_step<S2>(
- Vector<S2> &, const Vector<S2> &, const S1) const;
- template void SparseMatrix<S1>::SOR_step<S2>(
- Vector<S2> &, const Vector<S2> &, const S1) const;
- template void SparseMatrix<S1>::TSOR_step<S2>(
- Vector<S2> &, const Vector<S2> &, const S1) const;
- template void SparseMatrix<S1>::SSOR_step<S2>(
- Vector<S2> &, const Vector<S2> &, const S1) const;
+ template void SparseMatrix<S1>::Jacobi_step<S2>(Vector<S2> &,
+ const Vector<S2> &,
+ const S1) const;
+ template void SparseMatrix<S1>::SOR_step<S2>(Vector<S2> &,
+ const Vector<S2> &,
+ const S1) const;
+ template void SparseMatrix<S1>::TSOR_step<S2>(Vector<S2> &,
+ const Vector<S2> &,
+ const S1) const;
+ template void SparseMatrix<S1>::SSOR_step<S2>(Vector<S2> &,
+ const Vector<S2> &,
+ const S1) const;
}
for (S1, S2, S3 : REAL_SCALARS; V1, V2 : DEAL_II_VEC_TEMPLATES)
template S2 SparseMatrix<S1>::matrix_norm_square<S2>(const Vector<S2> &)
const;
- template S2 SparseMatrix<S1>::matrix_scalar_product<S2>(
- const Vector<S2> &, const Vector<S2> &) const;
+ template S2 SparseMatrix<S1>::matrix_scalar_product<S2>(const Vector<S2> &,
+ const Vector<S2> &)
+ const;
- template S2 SparseMatrix<S1>::residual<S2>(
- Vector<S2> &, const Vector<S2> &, const Vector<S2> &) const;
+ template S2 SparseMatrix<S1>::residual<S2>(Vector<S2> &,
+ const Vector<S2> &,
+ const Vector<S2> &) const;
template void SparseMatrix<S1>::precondition_SSOR<S2>(
Vector<S2> &,
const S1,
const std::vector<std::size_t> &) const;
- template void SparseMatrix<S1>::precondition_SOR<S2>(
- Vector<S2> &, const Vector<S2> &, const S1) const;
+ template void SparseMatrix<S1>::precondition_SOR<S2>(Vector<S2> &,
+ const Vector<S2> &,
+ const S1) const;
- template void SparseMatrix<S1>::precondition_TSOR<S2>(
- Vector<S2> &, const Vector<S2> &, const S1) const;
+ template void SparseMatrix<S1>::precondition_TSOR<S2>(Vector<S2> &,
+ const Vector<S2> &,
+ const S1) const;
- template void SparseMatrix<S1>::precondition_Jacobi<S2>(
- Vector<S2> &, const Vector<S2> &, const S1) const;
+ template void SparseMatrix<S1>::precondition_Jacobi<S2>(Vector<S2> &,
+ const Vector<S2> &,
+ const S1) const;
template void SparseMatrix<S1>::SOR<S2>(Vector<S2> &, const S1) const;
template void SparseMatrix<S1>::TSOR<S2>(Vector<S2> &, const S1) const;
const std::vector<size_type> &,
const std::vector<size_type> &,
const S1) const;
- template void SparseMatrix<S1>::Jacobi_step<S2>(
- Vector<S2> &, const Vector<S2> &, const S1) const;
- template void SparseMatrix<S1>::SOR_step<S2>(
- Vector<S2> &, const Vector<S2> &, const S1) const;
- template void SparseMatrix<S1>::TSOR_step<S2>(
- Vector<S2> &, const Vector<S2> &, const S1) const;
- template void SparseMatrix<S1>::SSOR_step<S2>(
- Vector<S2> &, const Vector<S2> &, const S1) const;
+ template void SparseMatrix<S1>::Jacobi_step<S2>(Vector<S2> &,
+ const Vector<S2> &,
+ const S1) const;
+ template void SparseMatrix<S1>::SOR_step<S2>(Vector<S2> &,
+ const Vector<S2> &,
+ const S1) const;
+ template void SparseMatrix<S1>::TSOR_step<S2>(Vector<S2> &,
+ const Vector<S2> &,
+ const S1) const;
+ template void SparseMatrix<S1>::SSOR_step<S2>(Vector<S2> &,
+ const Vector<S2> &,
+ const S1) const;
}
for (S1, S2, S3 : COMPLEX_SCALARS; V1, V2 : DEAL_II_VEC_TEMPLATES)
const Vector<S2> &,
const S1,
const std::vector<std::size_t> &) const;
- template void SparseMatrixEZ<S1>::precondition_SOR<S2>(
- Vector<S2> &, const Vector<S2> &, const S1) const;
- template void SparseMatrixEZ<S1>::precondition_TSOR<S2>(
- Vector<S2> &, const Vector<S2> &, const S1) const;
+ template void SparseMatrixEZ<S1>::precondition_SOR<S2>(Vector<S2> &,
+ const Vector<S2> &,
+ const S1) const;
+ template void SparseMatrixEZ<S1>::precondition_TSOR<S2>(Vector<S2> &,
+ const Vector<S2> &,
+ const S1) const;
template void SparseMatrixEZ<S1>::precondition_Jacobi<S2>(
Vector<S2> &, const Vector<S2> &, const S1) const;
}
-SparsityPattern::SparsityPattern() :
- max_dim(0),
- max_vec_len(0),
- rowstart(nullptr),
- colnums(nullptr),
- compressed(false),
- store_diagonal_first_in_row(false)
+SparsityPattern::SparsityPattern()
+ : max_dim(0)
+ , max_vec_len(0)
+ , rowstart(nullptr)
+ , colnums(nullptr)
+ , compressed(false)
+ , store_diagonal_first_in_row(false)
{
reinit(0, 0, 0);
}
-SparsityPattern::SparsityPattern(const SparsityPattern &s) :
- Subscriptor(),
- max_dim(0),
- max_vec_len(0),
- rowstart(nullptr),
- colnums(nullptr),
- compressed(false),
- store_diagonal_first_in_row(false)
+SparsityPattern::SparsityPattern(const SparsityPattern &s)
+ : Subscriptor()
+ , max_dim(0)
+ , max_vec_len(0)
+ , rowstart(nullptr)
+ , colnums(nullptr)
+ , compressed(false)
+ , store_diagonal_first_in_row(false)
{
(void)s;
Assert(s.empty(),
SparsityPattern::SparsityPattern(const size_type m,
const size_type n,
- const unsigned int max_per_row) :
- max_dim(0),
- max_vec_len(0),
- rowstart(nullptr),
- colnums(nullptr),
- compressed(false),
- store_diagonal_first_in_row(m == n)
+ const unsigned int max_per_row)
+ : max_dim(0)
+ , max_vec_len(0)
+ , rowstart(nullptr)
+ , colnums(nullptr)
+ , compressed(false)
+ , store_diagonal_first_in_row(m == n)
{
reinit(m, n, max_per_row);
}
SparsityPattern::SparsityPattern(const size_type m,
const size_type n,
- const std::vector<unsigned int> &row_lengths) :
- max_dim(0),
- max_vec_len(0),
- rowstart(nullptr),
- colnums(nullptr),
- store_diagonal_first_in_row(m == n)
+ const std::vector<unsigned int> &row_lengths)
+ : max_dim(0)
+ , max_vec_len(0)
+ , rowstart(nullptr)
+ , colnums(nullptr)
+ , store_diagonal_first_in_row(m == n)
{
reinit(m, n, row_lengths);
}
SparsityPattern::SparsityPattern(const size_type m,
- const unsigned int max_per_row) :
- max_dim(0),
- max_vec_len(0),
- rowstart(nullptr),
- colnums(nullptr)
+ const unsigned int max_per_row)
+ : max_dim(0)
+ , max_vec_len(0)
+ , rowstart(nullptr)
+ , colnums(nullptr)
{
reinit(m, m, max_per_row);
}
SparsityPattern::SparsityPattern(const size_type m,
- const std::vector<unsigned int> &row_lengths) :
- max_dim(0),
- max_vec_len(0),
- rowstart(nullptr),
- colnums(nullptr)
+ const std::vector<unsigned int> &row_lengths)
+ : max_dim(0)
+ , max_vec_len(0)
+ , rowstart(nullptr)
+ , colnums(nullptr)
{
reinit(m, m, row_lengths);
}
SparsityPattern::SparsityPattern(const SparsityPattern &original,
const unsigned int max_per_row,
- const size_type extra_off_diagonals) :
- max_dim(0),
- max_vec_len(0),
- rowstart(nullptr),
- colnums(nullptr)
+ const size_type extra_off_diagonals)
+ : max_dim(0)
+ , max_vec_len(0)
+ , rowstart(nullptr)
+ , colnums(nullptr)
{
Assert(original.rows == original.cols, ExcNotQuadratic());
Assert(original.is_compressed(), ExcNotCompressed());
// necessary (see the @p{copy} commands)
const size_type *const original_last_before_side_diagonals =
(row > extra_off_diagonals ?
- Utilities::lower_bound(
- original_row_start, original_row_end, row - extra_off_diagonals) :
+ Utilities::lower_bound(original_row_start,
+ original_row_end,
+ row - extra_off_diagonals) :
original_row_start);
const size_type *const original_first_after_side_diagonals =
(row < rows - extra_off_diagonals - 1 ?
- std::upper_bound(
- original_row_start, original_row_end, row + extra_off_diagonals) :
+ std::upper_bound(original_row_start,
+ original_row_end,
+ row + extra_off_diagonals) :
original_row_end);
// find first free slot. the first slot in each row is the diagonal
*next_free_slot = row + i;
// copy rest
- next_free_slot = std::copy(
- original_first_after_side_diagonals, original_row_end, next_free_slot);
+ next_free_slot = std::copy(original_first_after_side_diagonals,
+ original_row_end,
+ next_free_slot);
// this error may happen if the sum of previous elements per row and
// those of the new diagonals exceeds the maximum number of elements per
SparsityPattern::operator=(const SparsityPattern &s)
{
(void)s;
- Assert(
- s.empty(),
- ExcMessage("This operator can only be called if the provided argument "
- "is the sparsity pattern for an empty matrix. This operator can "
- "not be used to copy a non-empty sparsity pattern."));
+ Assert(s.empty(),
+ ExcMessage(
+ "This operator can only be called if the provided argument "
+ "is the sparsity pattern for an empty matrix. This operator can "
+ "not be used to copy a non-empty sparsity pattern."));
Assert(this->empty(),
ExcMessage("This operator can only be called if the current object is "
colnums = std_cxx14::make_unique<size_type[]>(max_vec_len);
}
- max_row_length = (row_lengths.size() == 0 ?
- 0 :
- std::min(static_cast<size_type>(*std::max_element(
- row_lengths.begin(), row_lengths.end())),
- n));
+ max_row_length =
+ (row_lengths.size() == 0 ?
+ 0 :
+ std::min(static_cast<size_type>(
+ *std::max_element(row_lengths.begin(), row_lengths.end())),
+ n));
if (store_diagonal_first_in_row && (max_row_length == 0) && (m != 0))
max_row_length = 1;
// first find out how many non-zero elements there are, in order to allocate
// the right amount of memory
- const std::size_t nonzero_elements = std::count_if(
- &colnums[rowstart[0]],
- &colnums[rowstart[rows]],
- std::bind(
- std::not_equal_to<size_type>(), std::placeholders::_1, invalid_entry));
+ const std::size_t nonzero_elements =
+ std::count_if(&colnums[rowstart[0]],
+ &colnums[rowstart[rows]],
+ std::bind(std::not_equal_to<size_type>(),
+ std::placeholders::_1,
+ invalid_entry));
// now allocate the respective memory
std::unique_ptr<size_type[]> new_colnums(new size_type[nonzero_elements]);
const size_type *sorted_region_start =
(store_diagonal_first_in_row ? &colnums[rowstart[i] + 1] :
&colnums[rowstart[i]]);
- const size_type *const p = Utilities::lower_bound<const size_type *>(
- sorted_region_start, &colnums[rowstart[i + 1]], j);
+ const size_type *const p =
+ Utilities::lower_bound<const size_type *>(sorted_region_start,
+ &colnums[rowstart[i + 1]],
+ j);
if ((p != &colnums[rowstart[i + 1]]) && (*p == j))
return (p - colnums.get());
else
{
if (store_diagonal_first_in_row && *it == row)
continue;
- Assert(
- k <= rowstart[row + 1],
- ExcNotEnoughSpace(row, rowstart[row + 1] - rowstart[row]));
+ Assert(k <= rowstart[row + 1],
+ ExcNotEnoughSpace(row,
+ rowstart[row + 1] - rowstart[row]));
colnums[k++] = *it;
}
else
ExcDimensionMismatch(cell_weights.size(),
sparsity_pattern.n_rows()));
int_cell_weights.resize(cell_weights.size());
- std::copy(
- cell_weights.begin(), cell_weights.end(), int_cell_weights.begin());
+ std::copy(cell_weights.begin(),
+ cell_weights.end(),
+ int_cell_weights.begin());
}
// Set a pointer to the optional cell weighting information.
// METIS expects a null pointer if there are no weights to be considered.
SparsityPattern::ExcNotCompressed());
Assert(n_partitions > 0, ExcInvalidNumberOfPartitions(n_partitions));
- Assert(
- partition_indices.size() == sparsity_pattern.n_rows(),
- ExcInvalidArraySize(partition_indices.size(), sparsity_pattern.n_rows()));
+ Assert(partition_indices.size() == sparsity_pattern.n_rows(),
+ ExcInvalidArraySize(partition_indices.size(),
+ sparsity_pattern.n_rows()));
// check for an easy return
if (n_partitions == 1 || (sparsity_pattern.n_rows() == 1))
}
if (partitioner == Partitioner::metis)
- partition_metis(
- sparsity_pattern, cell_weights, n_partitions, partition_indices);
+ partition_metis(sparsity_pattern,
+ cell_weights,
+ n_partitions,
+ partition_indices);
else if (partitioner == Partitioner::zoltan)
- partition_zoltan(
- sparsity_pattern, cell_weights, n_partitions, partition_indices);
+ partition_zoltan(sparsity_pattern,
+ cell_weights,
+ n_partitions,
+ partition_indices);
else
AssertThrow(false, ExcInternalError());
}
global_ids[i] = i;
// Call ZOLTAN coloring algorithm
- int rc = zz->Color(
- num_gid_entries, num_objects, global_ids.data(), color_exp.data());
+ int rc = zz->Color(num_gid_entries,
+ num_objects,
+ global_ids.data(),
+ color_exp.data());
(void)rc;
// Check for error code
Assert(starting_indices.size() <= sparsity.n_rows(),
ExcMessage(
"You can't specify more starting indices than there are rows"));
- Assert(
- sparsity.row_index_set().size() == 0 ||
- sparsity.row_index_set().size() == sparsity.n_rows(),
- ExcMessage("Only valid for sparsity patterns which store all rows."));
+ Assert(sparsity.row_index_set().size() == 0 ||
+ sparsity.row_index_set().size() == sparsity.n_rows(),
+ ExcMessage(
+ "Only valid for sparsity patterns which store all rows."));
for (SparsityPattern::size_type i = 0; i < starting_indices.size(); ++i)
Assert(starting_indices[i] < sparsity.n_rows(),
ExcMessage("Invalid starting index: All starting indices need "
starting_indices);
// initialize the new_indices array with invalid values
- std::fill(
- new_indices.begin(), new_indices.end(), numbers::invalid_size_type);
+ std::fill(new_indices.begin(),
+ new_indices.end(),
+ numbers::invalid_size_type);
// if no starting indices were given: find dof with lowest coordination
// number
{
AssertDimension(connectivity.n_rows(), connectivity.n_cols());
AssertDimension(connectivity.n_rows(), renumbering.size());
- Assert(
- connectivity.row_index_set().size() == 0 ||
- connectivity.row_index_set().size() == connectivity.n_rows(),
- ExcMessage("Only valid for sparsity patterns which store all rows."));
+ Assert(connectivity.row_index_set().size() == 0 ||
+ connectivity.row_index_set().size() == connectivity.n_rows(),
+ ExcMessage(
+ "Only valid for sparsity patterns which store all rows."));
std::vector<types::global_dof_index> touched_nodes(
connectivity.n_rows(), numbers::invalid_dof_index);
using namespace LAPACKSupport;
template <typename number>
-TridiagonalMatrix<number>::TridiagonalMatrix(size_type size, bool symmetric) :
- diagonal(size, 0.),
- left((symmetric ? 0 : size), 0.),
- right(size, 0.),
- is_symmetric(symmetric),
- state(matrix)
+TridiagonalMatrix<number>::TridiagonalMatrix(size_type size, bool symmetric)
+ : diagonal(size, 0.)
+ , left((symmetric ? 0 : size), 0.)
+ , right(size, 0.)
+ , is_symmetric(symmetric)
+ , state(matrix)
{}
for (size_type r = 0; r < this->n_block_rows(); ++r)
for (size_type c = 0; c < this->n_block_cols(); ++c)
{
- this->sub_objects[r][c]->reinit(
- parallel_partitioning[r],
- parallel_partitioning[c],
- dealii_block_sparse_matrix.block(r, c),
- drop_tolerance);
+ this->sub_objects[r][c]->reinit(parallel_partitioning[r],
+ parallel_partitioning[c],
+ dealii_block_sparse_matrix.block(r,
+ c),
+ drop_tolerance);
}
collect_sizes();
components.resize(n_blocks());
for (size_type i = 0; i < n_blocks(); ++i)
- components[i].reinit(
- parallel_partitioning[i], communicator, omit_zeroing_entries);
+ components[i].reinit(parallel_partitioning[i],
+ communicator,
+ omit_zeroing_entries);
collect_sizes();
}
{
namespace EpetraWrappers
{
- Vector::Vector() :
- vector(new Epetra_FEVector(
- Epetra_Map(0, 0, 0, Utilities::Trilinos::comm_self())))
+ Vector::Vector()
+ : vector(new Epetra_FEVector(
+ Epetra_Map(0, 0, 0, Utilities::Trilinos::comm_self())))
{}
- Vector::Vector(const Vector &V) :
- Subscriptor(),
- vector(new Epetra_FEVector(V.trilinos_vector()))
+ Vector::Vector(const Vector &V)
+ : Subscriptor()
+ , vector(new Epetra_FEVector(V.trilinos_vector()))
{}
Vector::Vector(const IndexSet ¶llel_partitioner,
- const MPI_Comm &communicator) :
- vector(new Epetra_FEVector(
- parallel_partitioner.make_trilinos_map(communicator, false)))
+ const MPI_Comm &communicator)
+ : vector(new Epetra_FEVector(
+ parallel_partitioner.make_trilinos_map(communicator, false)))
{}
# if DEAL_II_TRILINOS_VERSION_GTE(11, 11, 0)
Epetra_Import data_exchange(vector->Map(),
down_V.trilinos_vector().Map());
- const int ierr = vector->Import(
- down_V.trilinos_vector(), data_exchange, Epetra_AddLocalAlso);
+ const int ierr = vector->Import(down_V.trilinos_vector(),
+ data_exchange,
+ Epetra_AddLocalAlso);
Assert(ierr == 0, ExcTrilinosError(ierr));
(void)ierr;
# else
Assert(vector->Map().SameAs(down_scaling_factors.trilinos_vector().Map()),
ExcDifferentParallelPartitioning());
- const int ierr = vector->Multiply(
- 1.0, down_scaling_factors.trilinos_vector(), *vector, 0.0);
+ const int ierr = vector->Multiply(1.0,
+ down_scaling_factors.trilinos_vector(),
+ *vector,
+ 0.0);
Assert(ierr == 0, ExcTrilinosError(ierr));
(void)ierr;
}
const MPI_Comm &mpi_comm)
{
source_stored_elements = source_index_set;
- epetra_comm_pattern = std::make_shared<CommunicationPattern>(
- locally_owned_elements(), source_index_set, mpi_comm);
+ epetra_comm_pattern =
+ std::make_shared<CommunicationPattern>(locally_owned_elements(),
+ source_index_set,
+ mpi_comm);
}
} // namespace EpetraWrappers
} // namespace LinearAlgebra
{
PreconditionBase::PreconditionBase()
# ifdef DEAL_II_WITH_MPI
- :
- communicator(MPI_COMM_SELF)
+ : communicator(MPI_COMM_SELF)
# endif
{}
- PreconditionBase::PreconditionBase(const PreconditionBase &base) :
- Subscriptor(),
- preconditioner(base.preconditioner),
+ PreconditionBase::PreconditionBase(const PreconditionBase &base)
+ : Subscriptor()
+ , preconditioner(base.preconditioner)
+ ,
# ifdef DEAL_II_WITH_MPI
- communicator(base.communicator),
+ communicator(base.communicator)
+ ,
# endif
vector_distributor(new Epetra_Map(*base.vector_distributor))
{}
PreconditionJacobi::AdditionalData::AdditionalData(
const double omega,
const double min_diagonal,
- const unsigned int n_sweeps) :
- omega(omega),
- min_diagonal(min_diagonal),
- n_sweeps(n_sweeps)
+ const unsigned int n_sweeps)
+ : omega(omega)
+ , min_diagonal(min_diagonal)
+ , n_sweeps(n_sweeps)
{}
/* -------------------------- PreconditionSSOR -------------------------- */
- PreconditionSSOR::AdditionalData::AdditionalData(
- const double omega,
- const double min_diagonal,
- const unsigned int overlap,
- const unsigned int n_sweeps) :
- omega(omega),
- min_diagonal(min_diagonal),
- overlap(overlap),
- n_sweeps(n_sweeps)
+ PreconditionSSOR::AdditionalData::AdditionalData(const double omega,
+ const double min_diagonal,
+ const unsigned int overlap,
+ const unsigned int n_sweeps)
+ : omega(omega)
+ , min_diagonal(min_diagonal)
+ , overlap(overlap)
+ , n_sweeps(n_sweeps)
{}
PreconditionSOR::AdditionalData::AdditionalData(const double omega,
const double min_diagonal,
const unsigned int overlap,
- const unsigned int n_sweeps) :
- omega(omega),
- min_diagonal(min_diagonal),
- overlap(overlap),
- n_sweeps(n_sweeps)
+ const unsigned int n_sweeps)
+ : omega(omega)
+ , min_diagonal(min_diagonal)
+ , overlap(overlap)
+ , n_sweeps(n_sweeps)
{}
const std::string &block_creation_type,
const double omega,
const double min_diagonal,
- const unsigned int n_sweeps) :
- block_size(block_size),
- block_creation_type(block_creation_type),
- omega(omega),
- min_diagonal(min_diagonal),
- n_sweeps(n_sweeps)
+ const unsigned int n_sweeps)
+ : block_size(block_size)
+ , block_creation_type(block_creation_type)
+ , omega(omega)
+ , min_diagonal(min_diagonal)
+ , n_sweeps(n_sweeps)
{}
// Block relaxation setup fails if we have no locally owned rows. As a
// work-around we just pretend to use point relaxation on those processors:
- preconditioner.reset(Ifpack().Create(
- (matrix.trilinos_matrix().NumMyRows() == 0) ? "point relaxation" :
- "block relaxation",
- const_cast<Epetra_CrsMatrix *>(&matrix.trilinos_matrix()),
- 0));
+ preconditioner.reset(
+ Ifpack().Create((matrix.trilinos_matrix().NumMyRows() == 0) ?
+ "point relaxation" :
+ "block relaxation",
+ const_cast<Epetra_CrsMatrix *>(&matrix.trilinos_matrix()),
+ 0));
Ifpack_Preconditioner *ifpack =
static_cast<Ifpack_Preconditioner *>(preconditioner.get());
const double omega,
const double min_diagonal,
const unsigned int overlap,
- const unsigned int n_sweeps) :
- block_size(block_size),
- block_creation_type(block_creation_type),
- omega(omega),
- min_diagonal(min_diagonal),
- overlap(overlap),
- n_sweeps(n_sweeps)
+ const unsigned int n_sweeps)
+ : block_size(block_size)
+ , block_creation_type(block_creation_type)
+ , omega(omega)
+ , min_diagonal(min_diagonal)
+ , overlap(overlap)
+ , n_sweeps(n_sweeps)
{}
// Block relaxation setup fails if we have no locally owned rows. As a
// work-around we just pretend to use point relaxation on those processors:
- preconditioner.reset(Ifpack().Create(
- (matrix.trilinos_matrix().NumMyRows() == 0) ? "point relaxation" :
- "block relaxation",
- const_cast<Epetra_CrsMatrix *>(&matrix.trilinos_matrix()),
- additional_data.overlap));
+ preconditioner.reset(
+ Ifpack().Create((matrix.trilinos_matrix().NumMyRows() == 0) ?
+ "point relaxation" :
+ "block relaxation",
+ const_cast<Epetra_CrsMatrix *>(&matrix.trilinos_matrix()),
+ additional_data.overlap));
Ifpack_Preconditioner *ifpack =
static_cast<Ifpack_Preconditioner *>(preconditioner.get());
const double omega,
const double min_diagonal,
const unsigned int overlap,
- const unsigned int n_sweeps) :
- block_size(block_size),
- block_creation_type(block_creation_type),
- omega(omega),
- min_diagonal(min_diagonal),
- overlap(overlap),
- n_sweeps(n_sweeps)
+ const unsigned int n_sweeps)
+ : block_size(block_size)
+ , block_creation_type(block_creation_type)
+ , omega(omega)
+ , min_diagonal(min_diagonal)
+ , overlap(overlap)
+ , n_sweeps(n_sweeps)
{}
// Block relaxation setup fails if we have no locally owned rows. As a
// work-around we just pretend to use point relaxation on those processors:
- preconditioner.reset(Ifpack().Create(
- (matrix.trilinos_matrix().NumMyRows() == 0) ? "point relaxation" :
- "block relaxation",
- const_cast<Epetra_CrsMatrix *>(&matrix.trilinos_matrix()),
- additional_data.overlap));
+ preconditioner.reset(
+ Ifpack().Create((matrix.trilinos_matrix().NumMyRows() == 0) ?
+ "point relaxation" :
+ "block relaxation",
+ const_cast<Epetra_CrsMatrix *>(&matrix.trilinos_matrix()),
+ additional_data.overlap));
Ifpack_Preconditioner *ifpack =
static_cast<Ifpack_Preconditioner *>(preconditioner.get());
PreconditionIC::AdditionalData::AdditionalData(const unsigned int ic_fill,
const double ic_atol,
const double ic_rtol,
- const unsigned int overlap) :
- ic_fill(ic_fill),
- ic_atol(ic_atol),
- ic_rtol(ic_rtol),
- overlap(overlap)
+ const unsigned int overlap)
+ : ic_fill(ic_fill)
+ , ic_atol(ic_atol)
+ , ic_rtol(ic_rtol)
+ , overlap(overlap)
{}
PreconditionILU::AdditionalData::AdditionalData(const unsigned int ilu_fill,
const double ilu_atol,
const double ilu_rtol,
- const unsigned int overlap) :
- ilu_fill(ilu_fill),
- ilu_atol(ilu_atol),
- ilu_rtol(ilu_rtol),
- overlap(overlap)
+ const unsigned int overlap)
+ : ilu_fill(ilu_fill)
+ , ilu_atol(ilu_atol)
+ , ilu_rtol(ilu_rtol)
+ , overlap(overlap)
{}
const unsigned int ilut_fill,
const double ilut_atol,
const double ilut_rtol,
- const unsigned int overlap) :
- ilut_drop(ilut_drop),
- ilut_fill(ilut_fill),
- ilut_atol(ilut_atol),
- ilut_rtol(ilut_rtol),
- overlap(overlap)
+ const unsigned int overlap)
+ : ilut_drop(ilut_drop)
+ , ilut_fill(ilut_fill)
+ , ilut_atol(ilut_atol)
+ , ilut_rtol(ilut_rtol)
+ , overlap(overlap)
{}
/* ---------------------- PreconditionBlockDirect --------------------- */
PreconditionBlockwiseDirect::AdditionalData::AdditionalData(
- const unsigned int overlap) :
- overlap(overlap)
+ const unsigned int overlap)
+ : overlap(overlap)
{}
const double eigenvalue_ratio,
const double min_eigenvalue,
const double min_diagonal,
- const bool nonzero_starting) :
- degree(degree),
- max_eigenvalue(max_eigenvalue),
- eigenvalue_ratio(eigenvalue_ratio),
- min_eigenvalue(min_eigenvalue),
- min_diagonal(min_diagonal),
- nonzero_starting(nonzero_starting)
+ const bool nonzero_starting)
+ : degree(degree)
+ , max_eigenvalue(max_eigenvalue)
+ , eigenvalue_ratio(eigenvalue_ratio)
+ , min_eigenvalue(min_eigenvalue)
+ , min_diagonal(min_diagonal)
+ , nonzero_starting(nonzero_starting)
{}
const unsigned int smoother_overlap,
const bool output_details,
const char * smoother_type,
- const char * coarse_type) :
- elliptic(elliptic),
- higher_order_elements(higher_order_elements),
- n_cycles(n_cycles),
- w_cycle(w_cycle),
- aggregation_threshold(aggregation_threshold),
- constant_modes(constant_modes),
- smoother_sweeps(smoother_sweeps),
- smoother_overlap(smoother_overlap),
- output_details(output_details),
- smoother_type(smoother_type),
- coarse_type(coarse_type)
+ const char * coarse_type)
+ : elliptic(elliptic)
+ , higher_order_elements(higher_order_elements)
+ , n_cycles(n_cycles)
+ , w_cycle(w_cycle)
+ , aggregation_threshold(aggregation_threshold)
+ , constant_modes(constant_modes)
+ , smoother_sweeps(smoother_sweeps)
+ , smoother_overlap(smoother_overlap)
+ , output_details(output_details)
+ , smoother_type(smoother_type)
+ , coarse_type(coarse_type)
{}
Assert(global_size ==
static_cast<size_type>(
TrilinosWrappers::global_length(distributed_constant_modes)),
- ExcDimensionMismatch(
- global_size,
- TrilinosWrappers::global_length(distributed_constant_modes)));
+ ExcDimensionMismatch(global_size,
+ TrilinosWrappers::global_length(
+ distributed_constant_modes)));
const bool constant_modes_are_global =
additional_data.constant_modes[0].size() == global_size;
const size_type my_size = domain_map.NumMyElements();
const Teuchos::ParameterList &ml_parameters)
{
preconditioner.reset();
- preconditioner = std::make_shared<ML_Epetra::MultiLevelPreconditioner>(
- matrix, ml_parameters);
+ preconditioner =
+ std::make_shared<ML_Epetra::MultiLevelPreconditioner>(matrix,
+ ml_parameters);
}
const unsigned int smoother_overlap,
const bool output_details,
const char * smoother_type,
- const char * coarse_type) :
- elliptic(elliptic),
- n_cycles(n_cycles),
- w_cycle(w_cycle),
- aggregation_threshold(aggregation_threshold),
- constant_modes(constant_modes),
- smoother_sweeps(smoother_sweeps),
- smoother_overlap(smoother_overlap),
- output_details(output_details),
- smoother_type(smoother_type),
- coarse_type(coarse_type)
+ const char * coarse_type)
+ : elliptic(elliptic)
+ , n_cycles(n_cycles)
+ , w_cycle(w_cycle)
+ , aggregation_threshold(aggregation_threshold)
+ , constant_modes(constant_modes)
+ , smoother_sweeps(smoother_sweeps)
+ , smoother_overlap(smoother_overlap)
+ , output_details(output_details)
+ , smoother_type(smoother_type)
+ , coarse_type(coarse_type)
{}
PreconditionAMGMueLu::PreconditionAMGMueLu()
{
# ifdef DEAL_II_WITH_64BIT_INDICES
- AssertThrow(
- false,
- ExcMessage("PreconditionAMGMueLu does not support 64bit-indices!"));
+ AssertThrow(false,
+ ExcMessage(
+ "PreconditionAMGMueLu does not support 64bit-indices!"));
# endif
}
ExcDimensionMismatch(n_relevant_rows, my_size));
Assert(n_rows == static_cast<size_type>(TrilinosWrappers::global_length(
distributed_constant_modes)),
- ExcDimensionMismatch(
- n_rows,
- TrilinosWrappers::global_length(distributed_constant_modes)));
+ ExcDimensionMismatch(n_rows,
+ TrilinosWrappers::global_length(
+ distributed_constant_modes)));
(void)n_relevant_rows;
(void)global_length;
{
SolverBase::AdditionalData::AdditionalData(
const bool output_solver_details,
- const unsigned int gmres_restart_parameter) :
- output_solver_details(output_solver_details),
- gmres_restart_parameter(gmres_restart_parameter)
+ const unsigned int gmres_restart_parameter)
+ : output_solver_details(output_solver_details)
+ , gmres_restart_parameter(gmres_restart_parameter)
{}
- SolverBase::SolverBase(SolverControl &cn, const AdditionalData &data) :
- solver_name(gmres),
- solver_control(cn),
- additional_data(data)
+ SolverBase::SolverBase(SolverControl &cn, const AdditionalData &data)
+ : solver_name(gmres)
+ , solver_control(cn)
+ , additional_data(data)
{}
SolverBase::SolverBase(const SolverBase::SolverName solver_name,
SolverControl & cn,
- const AdditionalData & data) :
- solver_name(solver_name),
- solver_control(cn),
- additional_data(data)
+ const AdditionalData & data)
+ : solver_name(solver_name)
+ , solver_control(cn)
+ , additional_data(data)
{}
ExcMessage("Matrix is not compressed. Call compress() method."));
Epetra_Vector ep_x(View, A.domain_partitioner(), x.begin());
- Epetra_Vector ep_b(
- View, A.range_partitioner(), const_cast<double *>(b.begin()));
+ Epetra_Vector ep_b(View,
+ A.range_partitioner(),
+ const_cast<double *>(b.begin()));
// We need an Epetra_LinearProblem object to let the AztecOO solver know
// about the matrix and vectors.
const PreconditionBase & preconditioner)
{
Epetra_Vector ep_x(View, A.OperatorDomainMap(), x.begin());
- Epetra_Vector ep_b(
- View, A.OperatorRangeMap(), const_cast<double *>(b.begin()));
+ Epetra_Vector ep_b(View,
+ A.OperatorRangeMap(),
+ const_cast<double *>(b.begin()));
// We need an Epetra_LinearProblem object to let the AztecOO solver know
// about the matrix and vectors.
{
// In case we call the solver with deal.II vectors, we create views of the
// vectors in Epetra format.
- AssertDimension(
- static_cast<TrilinosWrappers::types::int_type>(x.local_size()),
- A.domain_partitioner().NumMyElements());
- AssertDimension(
- static_cast<TrilinosWrappers::types::int_type>(b.local_size()),
- A.range_partitioner().NumMyElements());
+ AssertDimension(static_cast<TrilinosWrappers::types::int_type>(
+ x.local_size()),
+ A.domain_partitioner().NumMyElements());
+ AssertDimension(static_cast<TrilinosWrappers::types::int_type>(
+ b.local_size()),
+ A.range_partitioner().NumMyElements());
Epetra_Vector ep_x(View, A.domain_partitioner(), x.begin());
- Epetra_Vector ep_b(
- View, A.range_partitioner(), const_cast<double *>(b.begin()));
+ Epetra_Vector ep_b(View,
+ A.range_partitioner(),
+ const_cast<double *>(b.begin()));
// We need an Epetra_LinearProblem object to let the AztecOO solver know
// about the matrix and vectors.
const dealii::LinearAlgebra::distributed::Vector<double> &b,
const PreconditionBase &preconditioner)
{
- AssertDimension(
- static_cast<TrilinosWrappers::types::int_type>(x.local_size()),
- A.OperatorDomainMap().NumMyElements());
- AssertDimension(
- static_cast<TrilinosWrappers::types::int_type>(b.local_size()),
- A.OperatorRangeMap().NumMyElements());
+ AssertDimension(static_cast<TrilinosWrappers::types::int_type>(
+ x.local_size()),
+ A.OperatorDomainMap().NumMyElements());
+ AssertDimension(static_cast<TrilinosWrappers::types::int_type>(
+ b.local_size()),
+ A.OperatorRangeMap().NumMyElements());
Epetra_Vector ep_x(View, A.OperatorDomainMap(), x.begin());
- Epetra_Vector ep_b(
- View, A.OperatorRangeMap(), const_cast<double *>(b.begin()));
+ Epetra_Vector ep_b(View,
+ A.OperatorRangeMap(),
+ const_cast<double *>(b.begin()));
// We need an Epetra_LinearProblem object to let the AztecOO solver know
// about the matrix and vectors.
if (CurrentIter == 0)
initial_residual = current_residual;
- return status_test_collection->CheckStatus(
- CurrentIter, CurrentResVector, CurrentResNormEst, SolutionUpdated);
+ return status_test_collection->CheckStatus(CurrentIter,
+ CurrentResVector,
+ CurrentResNormEst,
+ SolutionUpdated);
}
virtual AztecOO_StatusType
const int & max_steps,
const double & tolerance,
const double & reduction,
- const Epetra_LinearProblem &linear_problem) :
- initial_residual(std::numeric_limits<double>::max()),
- current_residual(std::numeric_limits<double>::max())
+ const Epetra_LinearProblem &linear_problem)
+ : initial_residual(std::numeric_limits<double>::max())
+ , current_residual(std::numeric_limits<double>::max())
{
// Consider linear problem converged if any of the collection
// of criterion are met
set_preconditioner(solver, preconditioner);
// ... set some options, ...
- solver.SetAztecOption(
- AZ_output, additional_data.output_solver_details ? AZ_all : AZ_none);
+ solver.SetAztecOption(AZ_output,
+ additional_data.output_solver_details ? AZ_all :
+ AZ_none);
solver.SetAztecOption(AZ_conv, AZ_noscaled);
// By default, the Trilinos solver chooses convergence criterion based on
/* ---------------------- SolverCG ------------------------ */
- SolverCG::AdditionalData::AdditionalData(const bool output_solver_details) :
- SolverBase::AdditionalData(output_solver_details)
+ SolverCG::AdditionalData::AdditionalData(const bool output_solver_details)
+ : SolverBase::AdditionalData(output_solver_details)
{}
- SolverCG::SolverCG(SolverControl &cn, const AdditionalData &data) :
- SolverBase(cn, data),
- additional_data(data)
+ SolverCG::SolverCG(SolverControl &cn, const AdditionalData &data)
+ : SolverBase(cn, data)
+ , additional_data(data)
{
solver_name = cg;
}
SolverGMRES::AdditionalData::AdditionalData(
const bool output_solver_details,
- const unsigned int restart_parameter) :
- SolverBase::AdditionalData(output_solver_details, restart_parameter)
+ const unsigned int restart_parameter)
+ : SolverBase::AdditionalData(output_solver_details, restart_parameter)
{}
- SolverGMRES::SolverGMRES(SolverControl &cn, const AdditionalData &data) :
- SolverBase(cn, data),
- additional_data(data)
+ SolverGMRES::SolverGMRES(SolverControl &cn, const AdditionalData &data)
+ : SolverBase(cn, data)
+ , additional_data(data)
{
solver_name = gmres;
}
/* ---------------------- SolverBicgstab ------------------------ */
SolverBicgstab::AdditionalData::AdditionalData(
- const bool output_solver_details) :
- SolverBase::AdditionalData(output_solver_details)
+ const bool output_solver_details)
+ : SolverBase::AdditionalData(output_solver_details)
{}
- SolverBicgstab::SolverBicgstab(SolverControl & cn,
- const AdditionalData &data) :
- SolverBase(cn, data),
- additional_data(data)
+ SolverBicgstab::SolverBicgstab(SolverControl &cn, const AdditionalData &data)
+ : SolverBase(cn, data)
+ , additional_data(data)
{
solver_name = bicgstab;
}
/* ---------------------- SolverCGS ------------------------ */
- SolverCGS::AdditionalData::AdditionalData(const bool output_solver_details) :
- SolverBase::AdditionalData(output_solver_details)
+ SolverCGS::AdditionalData::AdditionalData(const bool output_solver_details)
+ : SolverBase::AdditionalData(output_solver_details)
{}
- SolverCGS::SolverCGS(SolverControl &cn, const AdditionalData &data) :
- SolverBase(cn, data),
- additional_data(data)
+ SolverCGS::SolverCGS(SolverControl &cn, const AdditionalData &data)
+ : SolverBase(cn, data)
+ , additional_data(data)
{
solver_name = cgs;
}
/* ---------------------- SolverTFQMR ------------------------ */
- SolverTFQMR::AdditionalData::AdditionalData(
- const bool output_solver_details) :
- SolverBase::AdditionalData(output_solver_details)
+ SolverTFQMR::AdditionalData::AdditionalData(const bool output_solver_details)
+ : SolverBase::AdditionalData(output_solver_details)
{}
- SolverTFQMR::SolverTFQMR(SolverControl &cn, const AdditionalData &data) :
- SolverBase(cn, data),
- additional_data(data)
+ SolverTFQMR::SolverTFQMR(SolverControl &cn, const AdditionalData &data)
+ : SolverBase(cn, data)
+ , additional_data(data)
{
solver_name = tfqmr;
}
/* ---------------------- SolverDirect ------------------------ */
SolverDirect::AdditionalData::AdditionalData(const bool output_solver_details,
- const std::string &solver_type) :
- output_solver_details(output_solver_details),
- solver_type(solver_type)
+ const std::string &solver_type)
+ : output_solver_details(output_solver_details)
+ , solver_type(solver_type)
{}
- SolverDirect::SolverDirect(SolverControl &cn, const AdditionalData &data) :
- solver_control(cn),
- additional_data(data.output_solver_details, data.solver_type)
+ SolverDirect::SolverDirect(SolverControl &cn, const AdditionalData &data)
+ : solver_control(cn)
+ , additional_data(data.output_solver_details, data.solver_type)
{}
// solver, if possible.
Amesos Factory;
- AssertThrow(
- Factory.Query(additional_data.solver_type.c_str()),
- ExcMessage(std::string("You tried to select the solver type <") +
- additional_data.solver_type +
- "> but this solver is not supported by Trilinos either "
- "because it does not exist, or because Trilinos was not "
- "configured for its use."));
+ AssertThrow(Factory.Query(additional_data.solver_type.c_str()),
+ ExcMessage(
+ std::string("You tried to select the solver type <") +
+ additional_data.solver_type +
+ "> but this solver is not supported by Trilinos either "
+ "because it does not exist, or because Trilinos was not "
+ "configured for its use."));
solver.reset(
Factory.Create(additional_data.solver_type.c_str(), *linear_problem));
dealii::LinearAlgebra::distributed::Vector<double> & x,
const dealii::LinearAlgebra::distributed::Vector<double> &b)
{
- Epetra_Vector ep_x(
- View, linear_problem->GetOperator()->OperatorDomainMap(), x.begin());
+ Epetra_Vector ep_x(View,
+ linear_problem->GetOperator()->OperatorDomainMap(),
+ x.begin());
Epetra_Vector ep_b(View,
linear_problem->GetOperator()->OperatorRangeMap(),
const_cast<double *>(b.begin()));
// solver, if possible.
Amesos Factory;
- AssertThrow(
- Factory.Query(additional_data.solver_type.c_str()),
- ExcMessage(std::string("You tried to select the solver type <") +
- additional_data.solver_type +
- "> but this solver is not supported by Trilinos either "
- "because it does not exist, or because Trilinos was not "
- "configured for its use."));
+ AssertThrow(Factory.Query(additional_data.solver_type.c_str()),
+ ExcMessage(
+ std::string("You tried to select the solver type <") +
+ additional_data.solver_type +
+ "> but this solver is not supported by Trilinos either "
+ "because it does not exist, or because Trilinos was not "
+ "configured for its use."));
solver.reset(
Factory.Create(additional_data.solver_type.c_str(), *linear_problem));
Assert(A.local_range().second == A.m(),
ExcMessage("Can only work in serial when using deal.II vectors."));
Epetra_Vector ep_x(View, A.domain_partitioner(), x.begin());
- Epetra_Vector ep_b(
- View, A.range_partitioner(), const_cast<double *>(b.begin()));
+ Epetra_Vector ep_b(View,
+ A.range_partitioner(),
+ const_cast<double *>(b.begin()));
// We need an Epetra_LinearProblem object to let the Amesos solver know
// about the matrix and vectors.
dealii::LinearAlgebra::distributed::Vector<double> & x,
const dealii::LinearAlgebra::distributed::Vector<double> &b)
{
- AssertDimension(
- static_cast<TrilinosWrappers::types::int_type>(x.local_size()),
- A.domain_partitioner().NumMyElements());
- AssertDimension(
- static_cast<TrilinosWrappers::types::int_type>(b.local_size()),
- A.range_partitioner().NumMyElements());
+ AssertDimension(static_cast<TrilinosWrappers::types::int_type>(
+ x.local_size()),
+ A.domain_partitioner().NumMyElements());
+ AssertDimension(static_cast<TrilinosWrappers::types::int_type>(
+ b.local_size()),
+ A.range_partitioner().NumMyElements());
Epetra_Vector ep_x(View, A.domain_partitioner(), x.begin());
- Epetra_Vector ep_b(
- View, A.range_partitioner(), const_cast<double *>(b.begin()));
+ Epetra_Vector ep_b(View,
+ A.range_partitioner(),
+ const_cast<double *>(b.begin()));
// We need an Epetra_LinearProblem object to let the Amesos solver know
// about the matrix and vectors.
// thread on a configuration with
// MPI will still get a parallel
// interface.
- SparseMatrix::SparseMatrix() :
- column_space_map(new Epetra_Map(0, 0, Utilities::Trilinos::comm_self())),
- matrix(
- new Epetra_FECrsMatrix(View, *column_space_map, *column_space_map, 0)),
- last_action(Zero),
- compressed(true)
+ SparseMatrix::SparseMatrix()
+ : column_space_map(new Epetra_Map(0, 0, Utilities::Trilinos::comm_self()))
+ , matrix(
+ new Epetra_FECrsMatrix(View, *column_space_map, *column_space_map, 0))
+ , last_action(Zero)
+ , compressed(true)
{
matrix->FillComplete();
}
SparseMatrix::SparseMatrix(const Epetra_Map &input_map,
- const size_type n_max_entries_per_row) :
- column_space_map(new Epetra_Map(input_map)),
- matrix(new Epetra_FECrsMatrix(
- Copy,
- *column_space_map,
- TrilinosWrappers::types::int_type(n_max_entries_per_row),
- false)),
- last_action(Zero),
- compressed(false)
+ const size_type n_max_entries_per_row)
+ : column_space_map(new Epetra_Map(input_map))
+ , matrix(new Epetra_FECrsMatrix(Copy,
+ *column_space_map,
+ TrilinosWrappers::types::int_type(
+ n_max_entries_per_row),
+ false))
+ , last_action(Zero)
+ , compressed(false)
{}
- SparseMatrix::SparseMatrix(
- const Epetra_Map & input_map,
- const std::vector<unsigned int> &n_entries_per_row) :
- column_space_map(new Epetra_Map(input_map)),
- matrix(new Epetra_FECrsMatrix(
- Copy,
- *column_space_map,
- (int *)const_cast<unsigned int *>(&(n_entries_per_row[0])),
- false)),
- last_action(Zero),
- compressed(false)
+ SparseMatrix::SparseMatrix(const Epetra_Map & input_map,
+ const std::vector<unsigned int> &n_entries_per_row)
+ : column_space_map(new Epetra_Map(input_map))
+ , matrix(new Epetra_FECrsMatrix(Copy,
+ *column_space_map,
+ (int *)const_cast<unsigned int *>(
+ &(n_entries_per_row[0])),
+ false))
+ , last_action(Zero)
+ , compressed(false)
{}
SparseMatrix::SparseMatrix(const Epetra_Map &input_row_map,
const Epetra_Map &input_col_map,
- const size_type n_max_entries_per_row) :
- column_space_map(new Epetra_Map(input_col_map)),
- matrix(new Epetra_FECrsMatrix(
- Copy,
- input_row_map,
- TrilinosWrappers::types::int_type(n_max_entries_per_row),
- false)),
- last_action(Zero),
- compressed(false)
+ const size_type n_max_entries_per_row)
+ : column_space_map(new Epetra_Map(input_col_map))
+ , matrix(new Epetra_FECrsMatrix(Copy,
+ input_row_map,
+ TrilinosWrappers::types::int_type(
+ n_max_entries_per_row),
+ false))
+ , last_action(Zero)
+ , compressed(false)
{}
- SparseMatrix::SparseMatrix(
- const Epetra_Map & input_row_map,
- const Epetra_Map & input_col_map,
- const std::vector<unsigned int> &n_entries_per_row) :
- column_space_map(new Epetra_Map(input_col_map)),
- matrix(new Epetra_FECrsMatrix(
- Copy,
- input_row_map,
- (int *)const_cast<unsigned int *>(&(n_entries_per_row[0])),
- false)),
- last_action(Zero),
- compressed(false)
+ SparseMatrix::SparseMatrix(const Epetra_Map & input_row_map,
+ const Epetra_Map & input_col_map,
+ const std::vector<unsigned int> &n_entries_per_row)
+ : column_space_map(new Epetra_Map(input_col_map))
+ , matrix(new Epetra_FECrsMatrix(Copy,
+ input_row_map,
+ (int *)const_cast<unsigned int *>(
+ &(n_entries_per_row[0])),
+ false))
+ , last_action(Zero)
+ , compressed(false)
{}
SparseMatrix::SparseMatrix(const size_type m,
const size_type n,
- const unsigned int n_max_entries_per_row) :
- column_space_map(
- new Epetra_Map(static_cast<TrilinosWrappers::types::int_type>(n),
- 0,
- Utilities::Trilinos::comm_self())),
+ const unsigned int n_max_entries_per_row)
+ : column_space_map(
+ new Epetra_Map(static_cast<TrilinosWrappers::types::int_type>(n),
+ 0,
+ Utilities::Trilinos::comm_self()))
+ ,
// on one processor only, we know how the
// columns of the matrix will be
Utilities::Trilinos::comm_self()),
*column_space_map,
n_max_entries_per_row,
- false)),
- last_action(Zero),
- compressed(false)
+ false))
+ , last_action(Zero)
+ , compressed(false)
{}
- SparseMatrix::SparseMatrix(
- const size_type m,
- const size_type n,
- const std::vector<unsigned int> &n_entries_per_row) :
- column_space_map(
- new Epetra_Map(static_cast<TrilinosWrappers::types::int_type>(n),
- 0,
- Utilities::Trilinos::comm_self())),
- matrix(new Epetra_FECrsMatrix(
- Copy,
- Epetra_Map(static_cast<TrilinosWrappers::types::int_type>(m),
- 0,
- Utilities::Trilinos::comm_self()),
- *column_space_map,
- (int *)const_cast<unsigned int *>(&(n_entries_per_row[0])),
- false)),
- last_action(Zero),
- compressed(false)
+ SparseMatrix::SparseMatrix(const size_type m,
+ const size_type n,
+ const std::vector<unsigned int> &n_entries_per_row)
+ : column_space_map(
+ new Epetra_Map(static_cast<TrilinosWrappers::types::int_type>(n),
+ 0,
+ Utilities::Trilinos::comm_self()))
+ , matrix(new Epetra_FECrsMatrix(
+ Copy,
+ Epetra_Map(static_cast<TrilinosWrappers::types::int_type>(m),
+ 0,
+ Utilities::Trilinos::comm_self()),
+ *column_space_map,
+ (int *)const_cast<unsigned int *>(&(n_entries_per_row[0])),
+ false))
+ , last_action(Zero)
+ , compressed(false)
{}
SparseMatrix::SparseMatrix(const IndexSet & parallel_partitioning,
const MPI_Comm & communicator,
- const unsigned int n_max_entries_per_row) :
- column_space_map(new Epetra_Map(
- parallel_partitioning.make_trilinos_map(communicator, false))),
- matrix(new Epetra_FECrsMatrix(Copy,
- *column_space_map,
- n_max_entries_per_row,
- false)),
- last_action(Zero),
- compressed(false)
+ const unsigned int n_max_entries_per_row)
+ : column_space_map(new Epetra_Map(
+ parallel_partitioning.make_trilinos_map(communicator, false)))
+ , matrix(new Epetra_FECrsMatrix(Copy,
+ *column_space_map,
+ n_max_entries_per_row,
+ false))
+ , last_action(Zero)
+ , compressed(false)
{}
- SparseMatrix::SparseMatrix(
- const IndexSet & parallel_partitioning,
- const MPI_Comm & communicator,
- const std::vector<unsigned int> &n_entries_per_row) :
- column_space_map(new Epetra_Map(
- parallel_partitioning.make_trilinos_map(communicator, false))),
- matrix(new Epetra_FECrsMatrix(
- Copy,
- *column_space_map,
- (int *)const_cast<unsigned int *>(&(n_entries_per_row[0])),
- false)),
- last_action(Zero),
- compressed(false)
+ SparseMatrix::SparseMatrix(const IndexSet ¶llel_partitioning,
+ const MPI_Comm &communicator,
+ const std::vector<unsigned int> &n_entries_per_row)
+ : column_space_map(new Epetra_Map(
+ parallel_partitioning.make_trilinos_map(communicator, false)))
+ , matrix(new Epetra_FECrsMatrix(Copy,
+ *column_space_map,
+ (int *)const_cast<unsigned int *>(
+ &(n_entries_per_row[0])),
+ false))
+ , last_action(Zero)
+ , compressed(false)
{}
SparseMatrix::SparseMatrix(const IndexSet &row_parallel_partitioning,
const IndexSet &col_parallel_partitioning,
const MPI_Comm &communicator,
- const size_type n_max_entries_per_row) :
- column_space_map(new Epetra_Map(
- col_parallel_partitioning.make_trilinos_map(communicator, false))),
- matrix(new Epetra_FECrsMatrix(
- Copy,
- row_parallel_partitioning.make_trilinos_map(communicator, false),
- n_max_entries_per_row,
- false)),
- last_action(Zero),
- compressed(false)
+ const size_type n_max_entries_per_row)
+ : column_space_map(new Epetra_Map(
+ col_parallel_partitioning.make_trilinos_map(communicator, false)))
+ , matrix(new Epetra_FECrsMatrix(
+ Copy,
+ row_parallel_partitioning.make_trilinos_map(communicator, false),
+ n_max_entries_per_row,
+ false))
+ , last_action(Zero)
+ , compressed(false)
{}
- SparseMatrix::SparseMatrix(
- const IndexSet & row_parallel_partitioning,
- const IndexSet & col_parallel_partitioning,
- const MPI_Comm & communicator,
- const std::vector<unsigned int> &n_entries_per_row) :
- column_space_map(new Epetra_Map(
- col_parallel_partitioning.make_trilinos_map(communicator, false))),
- matrix(new Epetra_FECrsMatrix(
- Copy,
- row_parallel_partitioning.make_trilinos_map(communicator, false),
- (int *)const_cast<unsigned int *>(&(n_entries_per_row[0])),
- false)),
- last_action(Zero),
- compressed(false)
+ SparseMatrix::SparseMatrix(const IndexSet &row_parallel_partitioning,
+ const IndexSet &col_parallel_partitioning,
+ const MPI_Comm &communicator,
+ const std::vector<unsigned int> &n_entries_per_row)
+ : column_space_map(new Epetra_Map(
+ col_parallel_partitioning.make_trilinos_map(communicator, false)))
+ , matrix(new Epetra_FECrsMatrix(
+ Copy,
+ row_parallel_partitioning.make_trilinos_map(communicator, false),
+ (int *)const_cast<unsigned int *>(&(n_entries_per_row[0])),
+ false))
+ , last_action(Zero)
+ , compressed(false)
{}
- SparseMatrix::SparseMatrix(const SparsityPattern &sparsity_pattern) :
- column_space_map(new Epetra_Map(sparsity_pattern.domain_partitioner())),
- matrix(new Epetra_FECrsMatrix(Copy,
- sparsity_pattern.trilinos_sparsity_pattern(),
- false)),
- last_action(Zero),
- compressed(true)
+ SparseMatrix::SparseMatrix(const SparsityPattern &sparsity_pattern)
+ : column_space_map(new Epetra_Map(sparsity_pattern.domain_partitioner()))
+ , matrix(
+ new Epetra_FECrsMatrix(Copy,
+ sparsity_pattern.trilinos_sparsity_pattern(),
+ false))
+ , last_action(Zero)
+ , compressed(true)
{
- Assert(
- sparsity_pattern.trilinos_sparsity_pattern().Filled() == true,
- ExcMessage("The Trilinos sparsity pattern has not been compressed."));
+ Assert(sparsity_pattern.trilinos_sparsity_pattern().Filled() == true,
+ ExcMessage(
+ "The Trilinos sparsity pattern has not been compressed."));
compress(VectorOperation::insert);
}
- SparseMatrix::SparseMatrix(SparseMatrix &&other) noexcept :
- column_space_map(std::move(other.column_space_map)),
- matrix(std::move(other.matrix)),
- nonlocal_matrix(std::move(other.nonlocal_matrix)),
- nonlocal_matrix_exporter(std::move(other.nonlocal_matrix_exporter)),
- last_action(other.last_action),
- compressed(other.compressed)
+ SparseMatrix::SparseMatrix(SparseMatrix &&other) noexcept
+ : column_space_map(std::move(other.column_space_map))
+ , matrix(std::move(other.matrix))
+ , nonlocal_matrix(std::move(other.nonlocal_matrix))
+ , nonlocal_matrix_exporter(std::move(other.nonlocal_matrix_exporter))
+ , last_action(other.last_action)
+ , compressed(other.compressed)
{
other.last_action = Zero;
other.compressed = false;
int n_entries, rhs_n_entries;
TrilinosScalar *value_ptr, *rhs_value_ptr;
int * index_ptr, *rhs_index_ptr;
- int ierr = rhs.matrix->ExtractMyRowView(
- row_local, rhs_n_entries, rhs_value_ptr, rhs_index_ptr);
+ int ierr = rhs.matrix->ExtractMyRowView(row_local,
+ rhs_n_entries,
+ rhs_value_ptr,
+ rhs_index_ptr);
(void)ierr;
Assert(ierr == 0, ExcTrilinosError(ierr));
- ierr = matrix->ExtractMyRowView(
- row_local, n_entries, value_ptr, index_ptr);
+ ierr = matrix->ExtractMyRowView(row_local,
+ n_entries,
+ value_ptr,
+ index_ptr);
Assert(ierr == 0, ExcTrilinosError(ierr));
if (n_entries != rhs_n_entries ||
}
if (rhs.nonlocal_matrix.get() != nullptr)
- nonlocal_matrix = std_cxx14::make_unique<Epetra_CrsMatrix>(
- Copy, rhs.nonlocal_matrix->Graph());
+ nonlocal_matrix =
+ std_cxx14::make_unique<Epetra_CrsMatrix>(Copy,
+ rhs.nonlocal_matrix->Graph());
}
if (input_row_map.Comm().MyPID() == 0)
{
- AssertDimension(
- sparsity_pattern.n_rows(),
- static_cast<size_type>(
- TrilinosWrappers::n_global_elements(input_row_map)));
- AssertDimension(
- sparsity_pattern.n_cols(),
- static_cast<size_type>(
- TrilinosWrappers::n_global_elements(input_col_map)));
+ AssertDimension(sparsity_pattern.n_rows(),
+ static_cast<size_type>(
+ TrilinosWrappers::n_global_elements(
+ input_row_map)));
+ AssertDimension(sparsity_pattern.n_cols(),
+ static_cast<size_type>(
+ TrilinosWrappers::n_global_elements(
+ input_col_map)));
}
column_space_map = std_cxx14::make_unique<Epetra_Map>(input_col_map);
if (exchange_data)
{
SparsityPattern trilinos_sparsity;
- trilinos_sparsity.reinit(
- input_row_map, input_col_map, sparsity_pattern, exchange_data);
+ trilinos_sparsity.reinit(input_row_map,
+ input_col_map,
+ sparsity_pattern,
+ exchange_data);
matrix = std_cxx14::make_unique<Epetra_FECrsMatrix>(
Copy, trilinos_sparsity.trilinos_sparsity_pattern(), false);
for (size_type col = 0; p != sparsity_pattern.end(row); ++p, ++col)
row_indices[col] = p->column();
}
- graph->Epetra_CrsGraph::InsertGlobalIndices(
- row, row_length, row_indices.data());
+ graph->Epetra_CrsGraph::InsertGlobalIndices(row,
+ row_length,
+ row_indices.data());
}
// Eventually, optimize the graph structure (sort indices, make memory
graph->OptimizeStorage();
// check whether we got the number of columns right.
- AssertDimension(
- sparsity_pattern.n_cols(),
- static_cast<size_type>(TrilinosWrappers::n_global_cols(*graph)));
+ AssertDimension(sparsity_pattern.n_cols(),
+ static_cast<size_type>(
+ TrilinosWrappers::n_global_cols(*graph)));
(void)n_global_cols;
// And now finally generate the matrix.
{
public:
Epetra_CrsGraphMod(const Epetra_Map &row_map,
- const int * n_entries_per_row) :
- Epetra_CrsGraph(Copy, row_map, n_entries_per_row, true){};
+ const int * n_entries_per_row)
+ : Epetra_CrsGraph(Copy, row_map, n_entries_per_row, true){};
void
SetIndicesAreGlobal()
0, TrilinosWrappers::n_global_elements(input_row_map));
}
relevant_rows.compress();
- Assert(
- relevant_rows.n_elements() >=
- static_cast<unsigned int>(input_row_map.NumMyElements()),
- ExcMessage("Locally relevant rows of sparsity pattern must contain "
- "all locally owned rows"));
+ Assert(relevant_rows.n_elements() >=
+ static_cast<unsigned int>(input_row_map.NumMyElements()),
+ ExcMessage(
+ "Locally relevant rows of sparsity pattern must contain "
+ "all locally owned rows"));
// check whether the relevant rows correspond to exactly the same map as
// the owned rows. In that case, do not create the nonlocal graph and
}
}
- Epetra_Map off_processor_map(
- -1,
- ghost_rows.size(),
- (ghost_rows.size() > 0) ? (ghost_rows.data()) : nullptr,
- 0,
- input_row_map.Comm());
+ Epetra_Map off_processor_map(-1,
+ ghost_rows.size(),
+ (ghost_rows.size() > 0) ?
+ (ghost_rows.data()) :
+ nullptr,
+ 0,
+ input_row_map.Comm());
std::unique_ptr<Epetra_CrsGraph> graph;
std::unique_ptr<Epetra_CrsGraphMod> nonlocal_graph;
row_indices[col] = sparsity_pattern.column_number(global_row, col);
if (input_row_map.MyGID(global_row))
- graph->InsertGlobalIndices(
- global_row, row_length, row_indices.data());
+ graph->InsertGlobalIndices(global_row,
+ row_length,
+ row_indices.data());
else
{
Assert(nonlocal_graph.get() != nullptr, ExcInternalError());
- nonlocal_graph->InsertGlobalIndices(
- global_row, row_length, row_indices.data());
+ nonlocal_graph->InsertGlobalIndices(global_row,
+ row_length,
+ row_indices.data());
}
}
graph->FillComplete(input_col_map, input_row_map);
graph->OptimizeStorage();
- AssertDimension(
- sparsity_pattern.n_cols(),
- static_cast<size_type>(TrilinosWrappers::n_global_cols(*graph)));
+ AssertDimension(sparsity_pattern.n_cols(),
+ static_cast<size_type>(
+ TrilinosWrappers::n_global_cols(*graph)));
matrix = std_cxx14::make_unique<Epetra_FECrsMatrix>(Copy, *graph, false);
}
void
SparseMatrix::reinit(const SparsityPatternType &sparsity_pattern)
{
- const Epetra_Map rows(
- static_cast<TrilinosWrappers::types::int_type>(sparsity_pattern.n_rows()),
- 0,
- Utilities::Trilinos::comm_self());
- const Epetra_Map columns(
- static_cast<TrilinosWrappers::types::int_type>(sparsity_pattern.n_cols()),
- 0,
- Utilities::Trilinos::comm_self());
+ const Epetra_Map rows(static_cast<TrilinosWrappers::types::int_type>(
+ sparsity_pattern.n_rows()),
+ 0,
+ Utilities::Trilinos::comm_self());
+ const Epetra_Map columns(static_cast<TrilinosWrappers::types::int_type>(
+ sparsity_pattern.n_cols()),
+ 0,
+ Utilities::Trilinos::comm_self());
reinit_matrix(rows,
columns,
// processor must have set the correct entry
nonlocal_matrix->FillComplete(*column_space_map, matrix->RowMap());
if (nonlocal_matrix_exporter.get() == nullptr)
- nonlocal_matrix_exporter = std_cxx14::make_unique<Epetra_Export>(
- nonlocal_matrix->RowMap(), matrix->RowMap());
+ nonlocal_matrix_exporter =
+ std_cxx14::make_unique<Epetra_Export>(nonlocal_matrix->RowMap(),
+ matrix->RowMap());
ierr =
matrix->Export(*nonlocal_matrix, *nonlocal_matrix_exporter, mode);
AssertThrow(ierr == 0, ExcTrilinosError(ierr));
// When we clear the matrix, reset
// the pointer and generate an
// empty matrix.
- column_space_map = std_cxx14::make_unique<Epetra_Map>(
- 0, 0, Utilities::Trilinos::comm_self());
+ column_space_map =
+ std_cxx14::make_unique<Epetra_Map>(0,
+ 0,
+ Utilities::Trilinos::comm_self());
matrix =
std_cxx14::make_unique<Epetra_FECrsMatrix>(View, *column_space_map, 0);
nonlocal_matrix.reset();
// sure that we have not generated
// an error.
// TODO Check that col_indices are int and not long long
- int ierr = matrix->ExtractMyRowView(
- trilinos_i, nnz_extracted, values, col_indices);
+ int ierr = matrix->ExtractMyRowView(trilinos_i,
+ nnz_extracted,
+ values,
+ col_indices);
(void)ierr;
Assert(ierr == 0, ExcTrilinosError(ierr));
// Generate the view and make
// sure that we have not generated
// an error.
- int ierr = matrix->ExtractMyRowView(
- trilinos_i, nnz_extracted, values, col_indices);
+ int ierr = matrix->ExtractMyRowView(trilinos_i,
+ nnz_extracted,
+ values,
+ col_indices);
(void)ierr;
Assert(ierr == 0, ExcTrilinosError(ierr));
ierr = 0;
}
else
- ierr = matrix->Epetra_CrsMatrix::ReplaceGlobalValues(
- row, n_columns, col_value_ptr, col_index_ptr);
+ ierr = matrix->Epetra_CrsMatrix::ReplaceGlobalValues(row,
+ n_columns,
+ col_value_ptr,
+ col_index_ptr);
}
else
{
if (matrix->RowMap().MyGID(
static_cast<TrilinosWrappers::types::int_type>(row)) == true)
{
- ierr = matrix->Epetra_CrsMatrix::SumIntoGlobalValues(
- row, n_columns, col_value_ptr, col_index_ptr);
+ ierr = matrix->Epetra_CrsMatrix::SumIntoGlobalValues(row,
+ n_columns,
+ col_value_ptr,
+ col_index_ptr);
AssertThrow(ierr == 0, ExcTrilinosError(ierr));
}
else if (nonlocal_matrix.get() != nullptr)
ExcMessage("Attempted to write into off-processor matrix row "
"that has not be specified as being writable upon "
"initialization"));
- ierr = nonlocal_matrix->SumIntoGlobalValues(
- row, n_columns, col_value_ptr, col_index_ptr);
+ ierr = nonlocal_matrix->SumIntoGlobalValues(row,
+ n_columns,
+ col_value_ptr,
+ col_index_ptr);
AssertThrow(ierr == 0, ExcTrilinosError(ierr));
}
else
int n_entries, rhs_n_entries;
TrilinosScalar *value_ptr, *rhs_value_ptr;
int * index_ptr, *rhs_index_ptr;
- int ierr = rhs.matrix->ExtractMyRowView(
- row_local, rhs_n_entries, rhs_value_ptr, rhs_index_ptr);
+ int ierr = rhs.matrix->ExtractMyRowView(row_local,
+ rhs_n_entries,
+ rhs_value_ptr,
+ rhs_index_ptr);
(void)ierr;
Assert(ierr == 0, ExcTrilinosError(ierr));
const TrilinosWrappers::types::int_type rhs_global_col =
global_column_index(*rhs.matrix, rhs_index_ptr[i]);
int local_col = matrix->ColMap().LID(rhs_global_col);
- int *local_index = Utilities::lower_bound(
- index_ptr, index_ptr + n_entries, local_col);
- Assert(
- local_index != index_ptr + n_entries &&
- *local_index == local_col,
- ExcMessage("Adding the entries from the other matrix "
- "failed, because the sparsity pattern "
- "of that matrix includes more elements than the "
- "calling matrix, which is not allowed."));
+ int *local_index = Utilities::lower_bound(index_ptr,
+ index_ptr + n_entries,
+ local_col);
+ Assert(local_index != index_ptr + n_entries &&
+ *local_index == local_col,
+ ExcMessage(
+ "Adding the entries from the other matrix "
+ "failed, because the sparsity pattern "
+ "of that matrix includes more elements than the "
+ "calling matrix, which is not allowed."));
value_ptr[local_index - index_ptr] += factor * rhs_value_ptr[i];
}
}
const TrilinosWrappers::MPI::Vector &in,
const TrilinosWrappers::MPI::Vector &out)
{
- Assert(
- in.vector_partitioner().SameAs(m.DomainMap()) == true,
- ExcMessage("Column map of matrix does not fit with vector map!"));
+ Assert(in.vector_partitioner().SameAs(m.DomainMap()) == true,
+ ExcMessage(
+ "Column map of matrix does not fit with vector map!"));
Assert(out.vector_partitioner().SameAs(m.RangeMap()) == true,
ExcMessage("Row map of matrix does not fit with vector map!"));
(void)m;
(void)src;
(void)dst;
- internal::SparseMatrixImplementation::check_vector_map_equality(
- *matrix, src, dst);
+ internal::SparseMatrixImplementation::check_vector_map_equality(*matrix,
+ src,
+ dst);
const size_type dst_local_size = internal::end(dst) - internal::begin(dst);
AssertDimension(dst_local_size,
static_cast<size_type>(matrix->RangeMap().NumMyPoints()));
Epetra_MultiVector tril_dst(
View, matrix->RangeMap(), internal::begin(dst), dst_local_size, 1);
- Epetra_MultiVector tril_src(
- View,
- matrix->DomainMap(),
- const_cast<TrilinosScalar *>(internal::begin(src)),
- src_local_size,
- 1);
+ Epetra_MultiVector tril_src(View,
+ matrix->DomainMap(),
+ const_cast<TrilinosScalar *>(
+ internal::begin(src)),
+ src_local_size,
+ 1);
const int ierr = matrix->Multiply(false, tril_src, tril_dst);
Assert(ierr == 0, ExcTrilinosError(ierr));
Assert(&src != &dst, ExcSourceEqualsDestination());
Assert(matrix->Filled(), ExcMatrixNotCompressed());
- internal::SparseMatrixImplementation::check_vector_map_equality(
- *matrix, dst, src);
+ internal::SparseMatrixImplementation::check_vector_map_equality(*matrix,
+ dst,
+ src);
const size_type dst_local_size = internal::end(dst) - internal::begin(dst);
AssertDimension(dst_local_size,
static_cast<size_type>(matrix->DomainMap().NumMyPoints()));
Teuchos::RCP<Epetra_CrsMatrix> mod_B;
if (use_vector == false)
{
- mod_B = Teuchos::rcp(
- const_cast<Epetra_CrsMatrix *>(&inputright.trilinos_matrix()),
- false);
+ mod_B = Teuchos::rcp(const_cast<Epetra_CrsMatrix *>(
+ &inputright.trilinos_matrix()),
+ false);
}
else
{
int N_entries = -1;
double *new_data, *B_data;
mod_B->ExtractMyRowView(i, N_entries, new_data);
- inputright.trilinos_matrix().ExtractMyRowView(
- i, N_entries, B_data);
+ inputright.trilinos_matrix().ExtractMyRowView(i,
+ N_entries,
+ B_data);
double value = V.trilinos_vector()[0][i];
for (TrilinosWrappers::types::int_type j = 0; j < N_entries; ++j)
new_data[j] = value * B_data[j];
SparseMatrix transposed_mat;
if (transpose_left == false)
- ML_Operator_WrapEpetraCrsMatrix(
- const_cast<Epetra_CrsMatrix *>(&inputleft.trilinos_matrix()),
- A_,
- false);
+ ML_Operator_WrapEpetraCrsMatrix(const_cast<Epetra_CrsMatrix *>(
+ &inputleft.trilinos_matrix()),
+ A_,
+ false);
else
{
// create transposed matrix
{
int num_entries, *indices;
double *values;
- inputleft.trilinos_matrix().ExtractMyRowView(
- i, num_entries, values, indices);
+ inputleft.trilinos_matrix().ExtractMyRowView(i,
+ num_entries,
+ values,
+ indices);
Assert(num_entries >= 0, ExcInternalError());
const auto & trilinos_matrix = inputleft.trilinos_matrix();
values[j]);
}
transposed_mat.compress(VectorOperation::insert);
- ML_Operator_WrapEpetraCrsMatrix(
- const_cast<Epetra_CrsMatrix *>(&transposed_mat.trilinos_matrix()),
- A_,
- false);
+ ML_Operator_WrapEpetraCrsMatrix(const_cast<Epetra_CrsMatrix *>(
+ &transposed_mat.trilinos_matrix()),
+ A_,
+ false);
}
ML_Operator_WrapEpetraCrsMatrix(mod_B.get(), B_, false);
namespace LinearOperatorImplementation
{
- TrilinosPayload::TrilinosPayload() :
- use_transpose(false),
+ TrilinosPayload::TrilinosPayload()
+ : use_transpose(false)
+ ,
# ifdef DEAL_II_WITH_MPI
- communicator(MPI_COMM_SELF),
- domain_map(IndexSet().make_trilinos_map(communicator.Comm())),
- range_map(IndexSet().make_trilinos_map(communicator.Comm()))
+ communicator(MPI_COMM_SELF)
+ , domain_map(IndexSet().make_trilinos_map(communicator.Comm()))
+ , range_map(IndexSet().make_trilinos_map(communicator.Comm()))
# else
- domain_map(internal::make_serial_Epetra_map(IndexSet())),
- range_map(internal::make_serial_Epetra_map(IndexSet()))
+ domain_map(internal::make_serial_Epetra_map(IndexSet()))
+ , range_map(internal::make_serial_Epetra_map(IndexSet()))
# endif
{
vmult = [](Range &, const Domain &) {
TrilinosPayload::TrilinosPayload(
const TrilinosWrappers::SparseMatrix &matrix_exemplar,
- const TrilinosWrappers::SparseMatrix &matrix) :
- use_transpose(matrix_exemplar.trilinos_matrix().UseTranspose()),
+ const TrilinosWrappers::SparseMatrix &matrix)
+ : use_transpose(matrix_exemplar.trilinos_matrix().UseTranspose())
+ ,
# ifdef DEAL_II_WITH_MPI
- communicator(matrix_exemplar.get_mpi_communicator()),
- domain_map(
- matrix_exemplar.locally_owned_domain_indices().make_trilinos_map(
- communicator.Comm())),
- range_map(
- matrix_exemplar.locally_owned_range_indices().make_trilinos_map(
- communicator.Comm()))
+ communicator(matrix_exemplar.get_mpi_communicator())
+ , domain_map(
+ matrix_exemplar.locally_owned_domain_indices().make_trilinos_map(
+ communicator.Comm()))
+ , range_map(
+ matrix_exemplar.locally_owned_range_indices().make_trilinos_map(
+ communicator.Comm()))
# else
domain_map(internal::make_serial_Epetra_map(
- matrix_exemplar.locally_owned_domain_indices())),
- range_map(internal::make_serial_Epetra_map(
- matrix_exemplar.locally_owned_range_indices()))
+ matrix_exemplar.locally_owned_domain_indices()))
+ , range_map(internal::make_serial_Epetra_map(
+ matrix_exemplar.locally_owned_range_indices()))
# endif
{
vmult = [&matrix_exemplar, &matrix](Range & tril_dst,
TrilinosPayload::TrilinosPayload(
const TrilinosWrappers::SparseMatrix & matrix_exemplar,
- const TrilinosWrappers::PreconditionBase &preconditioner) :
- use_transpose(matrix_exemplar.trilinos_matrix().UseTranspose()),
+ const TrilinosWrappers::PreconditionBase &preconditioner)
+ : use_transpose(matrix_exemplar.trilinos_matrix().UseTranspose())
+ ,
# ifdef DEAL_II_WITH_MPI
- communicator(matrix_exemplar.get_mpi_communicator()),
- domain_map(
- matrix_exemplar.locally_owned_domain_indices().make_trilinos_map(
- communicator.Comm())),
- range_map(
- matrix_exemplar.locally_owned_range_indices().make_trilinos_map(
- communicator.Comm()))
+ communicator(matrix_exemplar.get_mpi_communicator())
+ , domain_map(
+ matrix_exemplar.locally_owned_domain_indices().make_trilinos_map(
+ communicator.Comm()))
+ , range_map(
+ matrix_exemplar.locally_owned_range_indices().make_trilinos_map(
+ communicator.Comm()))
# else
domain_map(internal::make_serial_Epetra_map(
- matrix_exemplar.locally_owned_domain_indices())),
- range_map(internal::make_serial_Epetra_map(
- matrix_exemplar.locally_owned_range_indices()))
+ matrix_exemplar.locally_owned_domain_indices()))
+ , range_map(internal::make_serial_Epetra_map(
+ matrix_exemplar.locally_owned_range_indices()))
# endif
{
vmult = [&matrix_exemplar, &preconditioner](Range & tril_dst,
AssertThrow(ierr == 0, ExcTrilinosError(ierr));
};
- inv_Tvmult = [&matrix_exemplar, &preconditioner](
- Range &tril_dst, const Domain &tril_src) {
+ inv_Tvmult = [&matrix_exemplar,
+ &preconditioner](Range & tril_dst,
+ const Domain &tril_src) {
// Duplicated from TrilinosWrappers::PreconditionBase::vmult
// as well as from TrilinosWrappers::SparseMatrix::Tvmult
Assert(&tril_src != &tril_dst,
TrilinosPayload::TrilinosPayload(
const TrilinosWrappers::PreconditionBase &preconditioner_exemplar,
- const TrilinosWrappers::PreconditionBase &preconditioner) :
- use_transpose(
- preconditioner_exemplar.trilinos_operator().UseTranspose()),
+ const TrilinosWrappers::PreconditionBase &preconditioner)
+ : use_transpose(
+ preconditioner_exemplar.trilinos_operator().UseTranspose())
+ ,
# ifdef DEAL_II_WITH_MPI
- communicator(preconditioner_exemplar.get_mpi_communicator()),
- domain_map(preconditioner_exemplar.locally_owned_domain_indices()
- .make_trilinos_map(communicator.Comm())),
- range_map(preconditioner_exemplar.locally_owned_range_indices()
- .make_trilinos_map(communicator.Comm()))
+ communicator(preconditioner_exemplar.get_mpi_communicator())
+ , domain_map(preconditioner_exemplar.locally_owned_domain_indices()
+ .make_trilinos_map(communicator.Comm()))
+ , range_map(preconditioner_exemplar.locally_owned_range_indices()
+ .make_trilinos_map(communicator.Comm()))
# else
domain_map(internal::make_serial_Epetra_map(
- preconditioner_exemplar.locally_owned_domain_indices())),
- range_map(internal::make_serial_Epetra_map(
- preconditioner_exemplar.locally_owned_range_indices()))
+ preconditioner_exemplar.locally_owned_domain_indices()))
+ , range_map(internal::make_serial_Epetra_map(
+ preconditioner_exemplar.locally_owned_range_indices()))
# endif
{
vmult = [&preconditioner_exemplar,
AssertThrow(ierr == 0, ExcTrilinosError(ierr));
};
- inv_Tvmult = [&preconditioner_exemplar, &preconditioner](
- Range &tril_dst, const Domain &tril_src) {
+ inv_Tvmult = [&preconditioner_exemplar,
+ &preconditioner](Range & tril_dst,
+ const Domain &tril_src) {
// Duplicated from TrilinosWrappers::PreconditionBase::vmult
// as well as from TrilinosWrappers::SparseMatrix::Tvmult
Assert(&tril_src != &tril_dst,
- TrilinosPayload::TrilinosPayload(const TrilinosPayload &payload) :
- vmult(payload.vmult),
- Tvmult(payload.Tvmult),
- inv_vmult(payload.inv_vmult),
- inv_Tvmult(payload.inv_Tvmult),
- use_transpose(payload.use_transpose),
- communicator(payload.communicator),
- domain_map(payload.domain_map),
- range_map(payload.range_map)
+ TrilinosPayload::TrilinosPayload(const TrilinosPayload &payload)
+ : vmult(payload.vmult)
+ , Tvmult(payload.Tvmult)
+ , inv_vmult(payload.inv_vmult)
+ , inv_Tvmult(payload.inv_Tvmult)
+ , use_transpose(payload.use_transpose)
+ , communicator(payload.communicator)
+ , domain_map(payload.domain_map)
+ , range_map(payload.range_map)
{}
// Composite copy constructor
// This is required for PackagedOperations
TrilinosPayload::TrilinosPayload(const TrilinosPayload &first_op,
- const TrilinosPayload &second_op) :
- use_transpose(false), // The combination of operators provides the exact
- // definition of the operation
- communicator(first_op.communicator),
- domain_map(second_op.domain_map),
- range_map(first_op.range_map)
+ const TrilinosPayload &second_op)
+ : use_transpose(false)
+ , // The combination of operators provides the exact
+ // definition of the operation
+ communicator(first_op.communicator)
+ , domain_map(second_op.domain_map)
+ , range_map(first_op.range_map)
{}
typedef typename TrilinosPayload::VectorType Intermediate;
typedef TrilinosWrappers::MPI::Vector GVMVectorType;
- Assert(
- first_op.locally_owned_domain_indices() ==
- second_op.locally_owned_domain_indices(),
- ExcMessage("Operators are set to work on incompatible IndexSets."));
- Assert(
- first_op.locally_owned_range_indices() ==
- second_op.locally_owned_range_indices(),
- ExcMessage("Operators are set to work on incompatible IndexSets."));
+ Assert(first_op.locally_owned_domain_indices() ==
+ second_op.locally_owned_domain_indices(),
+ ExcMessage(
+ "Operators are set to work on incompatible IndexSets."));
+ Assert(first_op.locally_owned_range_indices() ==
+ second_op.locally_owned_range_indices(),
+ ExcMessage(
+ "Operators are set to work on incompatible IndexSets."));
TrilinosPayload return_op(first_op, second_op);
// Duplicated from TrilinosWrappers::SparseMatrix::vmult
const size_type i_local_size = i->end() - i->begin();
- AssertDimension(
- i_local_size,
- static_cast<size_type>(first_op_init_map.NumMyPoints()));
+ AssertDimension(i_local_size,
+ static_cast<size_type>(
+ first_op_init_map.NumMyPoints()));
const Epetra_Map &second_op_init_map = second_op.OperatorDomainMap();
- AssertDimension(
- i_local_size,
- static_cast<size_type>(second_op_init_map.NumMyPoints()));
+ AssertDimension(i_local_size,
+ static_cast<size_type>(
+ second_op_init_map.NumMyPoints()));
(void)second_op_init_map;
Intermediate tril_int(View,
first_op_init_map,
// Duplicated from TrilinosWrappers::SparseMatrix::vmult
const size_type i_local_size = i->end() - i->begin();
- AssertDimension(
- i_local_size,
- static_cast<size_type>(first_op_init_map.NumMyPoints()));
+ AssertDimension(i_local_size,
+ static_cast<size_type>(
+ first_op_init_map.NumMyPoints()));
const Epetra_Map &second_op_init_map = second_op.OperatorRangeMap();
- AssertDimension(
- i_local_size,
- static_cast<size_type>(second_op_init_map.NumMyPoints()));
+ AssertDimension(i_local_size,
+ static_cast<size_type>(
+ second_op_init_map.NumMyPoints()));
(void)second_op_init_map;
Intermediate tril_int(View,
first_op_init_map,
// Duplicated from TrilinosWrappers::SparseMatrix::vmult
const size_type i_local_size = i->end() - i->begin();
- AssertDimension(
- i_local_size,
- static_cast<size_type>(first_op_init_map.NumMyPoints()));
+ AssertDimension(i_local_size,
+ static_cast<size_type>(
+ first_op_init_map.NumMyPoints()));
const Epetra_Map &second_op_init_map = second_op.OperatorRangeMap();
- AssertDimension(
- i_local_size,
- static_cast<size_type>(second_op_init_map.NumMyPoints()));
+ AssertDimension(i_local_size,
+ static_cast<size_type>(
+ second_op_init_map.NumMyPoints()));
(void)second_op_init_map;
Intermediate tril_int(View,
first_op_init_map,
// Duplicated from TrilinosWrappers::SparseMatrix::vmult
const size_type i_local_size = i->end() - i->begin();
- AssertDimension(
- i_local_size,
- static_cast<size_type>(first_op_init_map.NumMyPoints()));
+ AssertDimension(i_local_size,
+ static_cast<size_type>(
+ first_op_init_map.NumMyPoints()));
const Epetra_Map &second_op_init_map = second_op.OperatorDomainMap();
- AssertDimension(
- i_local_size,
- static_cast<size_type>(second_op_init_map.NumMyPoints()));
+ AssertDimension(i_local_size,
+ static_cast<size_type>(
+ second_op_init_map.NumMyPoints()));
(void)second_op_init_map;
Intermediate tril_int(View,
first_op_init_map,
typedef typename TrilinosPayload::VectorType Intermediate;
typedef TrilinosWrappers::MPI::Vector GVMVectorType;
- AssertThrow(
- first_op.locally_owned_domain_indices() ==
- second_op.locally_owned_range_indices(),
- ExcMessage("Operators are set to work on incompatible IndexSets."));
+ AssertThrow(first_op.locally_owned_domain_indices() ==
+ second_op.locally_owned_range_indices(),
+ ExcMessage(
+ "Operators are set to work on incompatible IndexSets."));
TrilinosPayload return_op(first_op, second_op);
// Duplicated from TrilinosWrappers::SparseMatrix::vmult
const size_type i_local_size = i->end() - i->begin();
- AssertDimension(
- i_local_size,
- static_cast<size_type>(first_op_init_map.NumMyPoints()));
+ AssertDimension(i_local_size,
+ static_cast<size_type>(
+ first_op_init_map.NumMyPoints()));
const Epetra_Map &second_op_init_map = second_op.OperatorRangeMap();
- AssertDimension(
- i_local_size,
- static_cast<size_type>(second_op_init_map.NumMyPoints()));
+ AssertDimension(i_local_size,
+ static_cast<size_type>(
+ second_op_init_map.NumMyPoints()));
(void)second_op_init_map;
Intermediate tril_int(View,
first_op_init_map,
// Duplicated from TrilinosWrappers::SparseMatrix::vmult
const size_type i_local_size = i->end() - i->begin();
- AssertDimension(
- i_local_size,
- static_cast<size_type>(first_op_init_map.NumMyPoints()));
+ AssertDimension(i_local_size,
+ static_cast<size_type>(
+ first_op_init_map.NumMyPoints()));
const Epetra_Map &second_op_init_map = second_op.OperatorDomainMap();
- AssertDimension(
- i_local_size,
- static_cast<size_type>(second_op_init_map.NumMyPoints()));
+ AssertDimension(i_local_size,
+ static_cast<size_type>(
+ second_op_init_map.NumMyPoints()));
(void)second_op_init_map;
Intermediate tril_int(View,
first_op_init_map,
// Duplicated from TrilinosWrappers::SparseMatrix::vmult
const size_type i_local_size = i->end() - i->begin();
- AssertDimension(
- i_local_size,
- static_cast<size_type>(first_op_init_map.NumMyPoints()));
+ AssertDimension(i_local_size,
+ static_cast<size_type>(
+ first_op_init_map.NumMyPoints()));
const Epetra_Map &second_op_init_map = second_op.OperatorDomainMap();
- AssertDimension(
- i_local_size,
- static_cast<size_type>(second_op_init_map.NumMyPoints()));
+ AssertDimension(i_local_size,
+ static_cast<size_type>(
+ second_op_init_map.NumMyPoints()));
(void)second_op_init_map;
Intermediate tril_int(View,
first_op_init_map,
// Duplicated from TrilinosWrappers::SparseMatrix::vmult
const size_type i_local_size = i->end() - i->begin();
- AssertDimension(
- i_local_size,
- static_cast<size_type>(first_op_init_map.NumMyPoints()));
+ AssertDimension(i_local_size,
+ static_cast<size_type>(
+ first_op_init_map.NumMyPoints()));
const Epetra_Map &second_op_init_map = second_op.OperatorRangeMap();
- AssertDimension(
- i_local_size,
- static_cast<size_type>(second_op_init_map.NumMyPoints()));
+ AssertDimension(i_local_size,
+ static_cast<size_type>(
+ second_op_init_map.NumMyPoints()));
(void)second_op_init_map;
Intermediate tril_int(View,
first_op_init_map,
std_cxx14::make_unique<Epetra_Map>(TrilinosWrappers::types::int_type(0),
TrilinosWrappers::types::int_type(0),
Utilities::Trilinos::comm_self());
- graph = std_cxx14::make_unique<Epetra_FECrsGraph>(
- View, *column_space_map, *column_space_map, 0);
+ graph = std_cxx14::make_unique<Epetra_FECrsGraph>(View,
+ *column_space_map,
+ *column_space_map,
+ 0);
graph->FillComplete();
}
- SparsityPattern::SparsityPattern(SparsityPattern &&other) noexcept :
- Subscriptor(std::move(other)),
- column_space_map(std::move(other.column_space_map)),
- graph(std::move(other.graph)),
- nonlocal_graph(std::move(other.nonlocal_graph))
+ SparsityPattern::SparsityPattern(SparsityPattern &&other) noexcept
+ : Subscriptor(std::move(other))
+ , column_space_map(std::move(other.column_space_map))
+ , graph(std::move(other.graph))
+ , nonlocal_graph(std::move(other.nonlocal_graph))
{}
// Copy function only works if the
// sparsity pattern is empty.
- SparsityPattern::SparsityPattern(const SparsityPattern &input_sparsity) :
- Subscriptor(),
- column_space_map(new Epetra_Map(TrilinosWrappers::types::int_type(0),
- TrilinosWrappers::types::int_type(0),
- Utilities::Trilinos::comm_self())),
- graph(new Epetra_FECrsGraph(View, *column_space_map, *column_space_map, 0))
+ SparsityPattern::SparsityPattern(const SparsityPattern &input_sparsity)
+ : Subscriptor()
+ , column_space_map(new Epetra_Map(TrilinosWrappers::types::int_type(0),
+ TrilinosWrappers::types::int_type(0),
+ Utilities::Trilinos::comm_self()))
+ , graph(
+ new Epetra_FECrsGraph(View, *column_space_map, *column_space_map, 0))
{
(void)input_sparsity;
- Assert(
- input_sparsity.n_rows() == 0,
- ExcMessage("Copy constructor only works for empty sparsity patterns."));
+ Assert(input_sparsity.n_rows() == 0,
+ ExcMessage(
+ "Copy constructor only works for empty sparsity patterns."));
}
// release memory before reallocation
nonlocal_graph.reset();
graph.reset();
- AssertDimension(
- n_entries_per_row.size(),
- static_cast<size_type>(TrilinosWrappers::n_global_elements(row_map)));
+ AssertDimension(n_entries_per_row.size(),
+ static_cast<size_type>(
+ TrilinosWrappers::n_global_elements(row_map)));
column_space_map = std_cxx14::make_unique<Epetra_Map>(col_map);
std::vector<int> local_entries_per_row(
nonlocal_graph.reset();
graph.reset();
- AssertDimension(
- sp.n_rows(),
- static_cast<size_type>(TrilinosWrappers::n_global_elements(row_map)));
- AssertDimension(
- sp.n_cols(),
- static_cast<size_type>(TrilinosWrappers::n_global_elements(col_map)));
+ AssertDimension(sp.n_rows(),
+ static_cast<size_type>(
+ TrilinosWrappers::n_global_elements(row_map)));
+ AssertDimension(sp.n_cols(),
+ static_cast<size_type>(
+ TrilinosWrappers::n_global_elements(col_map)));
column_space_map = std_cxx14::make_unique<Epetra_Map>(col_map);
- Assert(
- row_map.LinearMap() == true,
- ExcMessage("This function only works if the row map is contiguous."));
+ Assert(row_map.LinearMap() == true,
+ ExcMessage(
+ "This function only works if the row map is contiguous."));
const size_type first_row = TrilinosWrappers::min_my_gid(row_map),
last_row = TrilinosWrappers::max_my_gid(row_map) + 1;
++p;
}
}
- graph->Epetra_CrsGraph::InsertGlobalIndices(
- row, row_length, row_indices.data());
+ graph->Epetra_CrsGraph::InsertGlobalIndices(row,
+ row_length,
+ row_indices.data());
}
else
for (size_type row = 0; row < sp.n_rows(); ++row)
row_indices.data());
}
- int ierr = graph->GlobalAssemble(
- *column_space_map,
- static_cast<const Epetra_Map &>(graph->RangeMap()),
- true);
+ int ierr = graph->GlobalAssemble(*column_space_map,
+ static_cast<const Epetra_Map &>(
+ graph->RangeMap()),
+ true);
AssertThrow(ierr == 0, ExcTrilinosError(ierr));
ierr = graph->OptimizeStorage();
# ifdef DEBUG
{
IndexSet tmp = writable_rows & row_parallel_partitioning;
- Assert(
- tmp == row_parallel_partitioning,
- ExcMessage("The set of writable rows passed to this method does not "
- "contain the locally owned rows, which is not allowed."));
+ Assert(tmp == row_parallel_partitioning,
+ ExcMessage(
+ "The set of writable rows passed to this method does not "
+ "contain the locally owned rows, which is not allowed."));
}
# endif
nonlocal_partitioner.subtract_set(row_parallel_partitioning);
std_cxx14::make_unique<Epetra_Map>(TrilinosWrappers::types::int_type(0),
TrilinosWrappers::types::int_type(0),
Utilities::Trilinos::comm_self());
- graph = std_cxx14::make_unique<Epetra_FECrsGraph>(
- View, *column_space_map, *column_space_map, 0);
+ graph = std_cxx14::make_unique<Epetra_FECrsGraph>(View,
+ *column_space_map,
+ *column_space_map,
+ 0);
graph->FillComplete();
nonlocal_graph.reset();
Assert(nonlocal_graph->RowMap().NumMyElements() == 0 ||
nonlocal_graph->IndicesAreGlobal() == true,
ExcInternalError());
- nonlocal_graph->FillComplete(
- *column_space_map,
- static_cast<const Epetra_Map &>(graph->RangeMap()));
+ nonlocal_graph->FillComplete(*column_space_map,
+ static_cast<const Epetra_Map &>(
+ graph->RangeMap()));
nonlocal_graph->OptimizeStorage();
Epetra_Export exporter(nonlocal_graph->RowMap(), graph->RowMap());
ierr = graph->Export(*nonlocal_graph, exporter, Add);
AssertThrow(ierr == 0, ExcTrilinosError(ierr));
- ierr = graph->FillComplete(
- *column_space_map,
- static_cast<const Epetra_Map &>(graph->RangeMap()));
+ ierr = graph->FillComplete(*column_space_map,
+ static_cast<const Epetra_Map &>(
+ graph->RangeMap()));
}
else
- ierr = graph->GlobalAssemble(
- *column_space_map,
- static_cast<const Epetra_Map &>(graph->RangeMap()),
- true);
+ ierr = graph->GlobalAssemble(*column_space_map,
+ static_cast<const Epetra_Map &>(
+ graph->RangeMap()),
+ true);
AssertThrow(ierr == 0, ExcTrilinosError(ierr));
static_cast<TrilinosWrappers::types::int_type>(i - indices[j]));
}
}
- graph->Comm().MaxAll(
- (TrilinosWrappers::types::int_type *)&local_b, &global_b, 1);
+ graph->Comm().MaxAll((TrilinosWrappers::types::int_type *)&local_b,
+ &global_b,
+ 1);
return static_cast<size_type>(global_b);
}
namespace MPI
{
- Vector::Vector() :
- Subscriptor(),
- last_action(Zero),
- compressed(true),
- has_ghosts(false),
- vector(new Epetra_FEVector(
- Epetra_Map(0, 0, 0, Utilities::Trilinos::comm_self())))
+ Vector::Vector()
+ : Subscriptor()
+ , last_action(Zero)
+ , compressed(true)
+ , has_ghosts(false)
+ , vector(new Epetra_FEVector(
+ Epetra_Map(0, 0, 0, Utilities::Trilinos::comm_self())))
{}
Vector::Vector(const IndexSet ¶llel_partitioning,
- const MPI_Comm &communicator) :
- Vector()
+ const MPI_Comm &communicator)
+ : Vector()
{
reinit(parallel_partitioning, communicator);
}
- Vector::Vector(const Vector &v) : Vector()
+ Vector::Vector(const Vector &v)
+ : Vector()
{
has_ghosts = v.has_ghosts;
vector = std_cxx14::make_unique<Epetra_FEVector>(*v.vector);
- Vector::Vector(Vector &&v) noexcept : Vector()
+ Vector::Vector(Vector &&v) noexcept
+ : Vector()
{
// initialize a minimal, valid object and swap
swap(v);
Vector::Vector(const IndexSet ¶llel_partitioner,
const Vector & v,
- const MPI_Comm &communicator) :
- Vector()
+ const MPI_Comm &communicator)
+ : Vector()
{
AssertThrow(parallel_partitioner.size() ==
static_cast<size_type>(
TrilinosWrappers::n_global_elements(v.vector->Map())),
- ExcDimensionMismatch(
- parallel_partitioner.size(),
- TrilinosWrappers::n_global_elements(v.vector->Map())));
+ ExcDimensionMismatch(parallel_partitioner.size(),
+ TrilinosWrappers::n_global_elements(
+ v.vector->Map())));
vector = std_cxx14::make_unique<Epetra_FEVector>(
parallel_partitioner.make_trilinos_map(communicator, true));
Vector::Vector(const IndexSet &local,
const IndexSet &ghost,
- const MPI_Comm &communicator) :
- Vector()
+ const MPI_Comm &communicator)
+ : Vector()
{
reinit(local, ghost, communicator, false);
}
if (import_data == true)
{
- AssertThrow(
- static_cast<size_type>(
- TrilinosWrappers::global_length(*actual_vec)) == v.size(),
- ExcDimensionMismatch(TrilinosWrappers::global_length(*actual_vec),
- v.size()));
+ AssertThrow(static_cast<size_type>(TrilinosWrappers::global_length(
+ *actual_vec)) == v.size(),
+ ExcDimensionMismatch(TrilinosWrappers::global_length(
+ *actual_vec),
+ v.size()));
Epetra_Import data_exchange(vector->Map(), actual_vec->Map());
}
if (v.nonlocal_vector.get() != nullptr)
- nonlocal_vector = std_cxx14::make_unique<Epetra_MultiVector>(
- v.nonlocal_vector->Map(), 1);
+ nonlocal_vector =
+ std_cxx14::make_unique<Epetra_MultiVector>(v.nonlocal_vector->Map(),
+ 1);
return *this;
}
Assert(comm_ptr != nullptr, ExcInternalError());
Utilities::MPI::MinMaxAvg result =
Utilities::MPI::min_max_avg(double_mode, comm_ptr->GetMpiComm());
- Assert(
- result.max - result.min < 1e-5,
- ExcMessage("Not all processors agree whether the last operation on "
- "this vector was an addition or a set operation. This will "
- "prevent the compress() operation from succeeding."));
+ Assert(result.max - result.min < 1e-5,
+ ExcMessage(
+ "Not all processors agree whether the last operation on "
+ "this vector was an addition or a set operation. This will "
+ "prevent the compress() operation from succeeding."));
# endif
# endif
template void MatrixFree<deal_II_dimension, float>::
print_memory_consumption<ConditionalOStream>(ConditionalOStream &) const;
- template void
- MatrixFree<deal_II_dimension, double>::internal_reinit<double>(
- const Mapping<deal_II_dimension> &,
- const std::vector<const DoFHandler<deal_II_dimension> *> &,
- const std::vector<const AffineConstraints<double> *> &,
- const std::vector<IndexSet> &,
- const std::vector<hp::QCollection<1>> &,
- const AdditionalData &);
-
- template void
- MatrixFree<deal_II_dimension, double>::internal_reinit<double>(
- const Mapping<deal_II_dimension> &,
- const std::vector<const hp::DoFHandler<deal_II_dimension> *> &,
- const std::vector<const AffineConstraints<double> *> &,
- const std::vector<IndexSet> &,
- const std::vector<hp::QCollection<1>> &,
- const AdditionalData &);
+ template void MatrixFree<deal_II_dimension, double>::internal_reinit<
+ double>(const Mapping<deal_II_dimension> &,
+ const std::vector<const DoFHandler<deal_II_dimension> *> &,
+ const std::vector<const AffineConstraints<double> *> &,
+ const std::vector<IndexSet> &,
+ const std::vector<hp::QCollection<1>> &,
+ const AdditionalData &);
+
+ template void MatrixFree<deal_II_dimension, double>::internal_reinit<
+ double>(const Mapping<deal_II_dimension> &,
+ const std::vector<const hp::DoFHandler<deal_II_dimension> *> &,
+ const std::vector<const AffineConstraints<double> *> &,
+ const std::vector<IndexSet> &,
+ const std::vector<hp::QCollection<1>> &,
+ const AdditionalData &);
template void MatrixFree<deal_II_dimension, float>::internal_reinit<double>(
const Mapping<deal_II_dimension> &,
public:
ActualCellWork(MFWorkerInterface **worker_pointer,
const unsigned int partition,
- const TaskInfo & task_info) :
- worker(nullptr),
- worker_pointer(worker_pointer),
- partition(partition),
- task_info(task_info)
+ const TaskInfo & task_info)
+ : worker(nullptr)
+ , worker_pointer(worker_pointer)
+ , partition(partition)
+ , task_info(task_info)
{}
ActualCellWork(MFWorkerInterface &worker,
const unsigned int partition,
- const TaskInfo & task_info) :
- worker(&worker),
- worker_pointer(nullptr),
- partition(partition),
- task_info(task_info)
+ const TaskInfo & task_info)
+ : worker(&worker)
+ , worker_pointer(nullptr)
+ , partition(partition)
+ , task_info(task_info)
{}
void
CellWork(MFWorkerInterface &worker,
const unsigned int partition,
const TaskInfo & task_info,
- const bool is_blocked) :
- dummy(nullptr),
- work(worker, partition, task_info),
- is_blocked(is_blocked)
+ const bool is_blocked)
+ : dummy(nullptr)
+ , work(worker, partition, task_info)
+ , is_blocked(is_blocked)
{}
tbb::task *
PartitionWork(MFWorkerInterface &function_in,
const unsigned int partition_in,
const TaskInfo & task_info_in,
- const bool is_blocked_in = false) :
- dummy(nullptr),
- function(function_in),
- partition(partition_in),
- task_info(task_info_in),
- is_blocked(is_blocked_in)
+ const bool is_blocked_in = false)
+ : dummy(nullptr)
+ , function(function_in)
+ , partition(partition_in)
+ , task_info(task_info_in)
+ , is_blocked(is_blocked_in)
{}
tbb::task *
public:
CellWork(MFWorkerInterface &worker_in,
const TaskInfo & task_info_in,
- const unsigned int partition_in) :
- worker(worker_in),
- task_info(task_info_in),
- partition(partition_in)
+ const unsigned int partition_in)
+ : worker(worker_in)
+ , task_info(task_info_in)
+ , partition(partition_in)
{}
void
PartitionWork(MFWorkerInterface &worker_in,
const unsigned int partition_in,
const TaskInfo & task_info_in,
- const bool is_blocked_in) :
- dummy(nullptr),
- worker(worker_in),
- partition(partition_in),
- task_info(task_info_in),
- is_blocked(is_blocked_in)
+ const bool is_blocked_in)
+ : dummy(nullptr)
+ , worker(worker_in)
+ , partition(partition_in)
+ , task_info(task_info_in)
+ , is_blocked(is_blocked_in)
{}
tbb::task *
class MPICommunication : public tbb::task
{
public:
- MPICommunication(MFWorkerInterface &worker_in, const bool do_compress) :
- worker(worker_in),
- do_compress(do_compress)
+ MPICommunication(MFWorkerInterface &worker_in, const bool do_compress)
+ : worker(worker_in)
+ , do_compress(do_compress)
{}
tbb::task *
if (odds == evens)
{
worker[evens] = new (worker[j]->allocate_child())
- partition::PartitionWork(
- funct, 2 * j + 1, *this, false);
+ partition::PartitionWork(funct,
+ 2 * j + 1,
+ *this,
+ false);
worker[j]->spawn(*worker[evens]);
}
else
if (part == 0)
worker[worker_index] =
new (worker_compr->allocate_child())
- color::PartitionWork(
- funct, slice_index, *this, false);
+ color::PartitionWork(funct,
+ slice_index,
+ *this,
+ false);
else
- worker[worker_index] =
- new (root->allocate_child()) color::PartitionWork(
- funct, slice_index, *this, false);
+ worker[worker_index] = new (root->allocate_child())
+ color::PartitionWork(funct,
+ slice_index,
+ *this,
+ false);
slice_index++;
for (; slice_index < partition_row_index[part + 1];
slice_index++)
worker_index++;
worker[worker_index] =
new (worker[worker_index - 1]->allocate_child())
- color::PartitionWork(
- funct, slice_index, *this, false);
+ color::PartitionWork(funct,
+ slice_index,
+ *this,
+ false);
}
worker[worker_index]->set_ref_count(2);
if (part > 0)
{
blocked_worker[part / 2] =
new (worker[worker_index - 1]->allocate_child())
- color::PartitionWork(
- funct, slice_index, *this, true);
+ color::PartitionWork(funct,
+ slice_index,
+ *this,
+ true);
slice_index++;
if (slice_index < partition_row_index[part + 1])
{
blocked_worker[part / 2]->set_ref_count(1);
worker[worker_index] = new (
blocked_worker[part / 2]->allocate_child())
- color::PartitionWork(
- funct, slice_index, *this, false);
+ color::PartitionWork(funct,
+ slice_index,
+ *this,
+ false);
slice_index++;
}
else
}
worker[worker_index] =
new (worker[worker_index - 1]->allocate_child())
- color::PartitionWork(
- funct, slice_index, *this, false);
+ color::PartitionWork(funct,
+ slice_index,
+ *this,
+ false);
}
spawn_index_child = worker_index;
worker_index++;
// Create connectivity graph for blocks based on connectivity graph for
// cells.
DynamicSparsityPattern connectivity(n_blocks, n_blocks);
- make_connectivity_cells_to_blocks(
- irregular_cells, connectivity_large, connectivity);
+ make_connectivity_cells_to_blocks(irregular_cells,
+ connectivity_large,
+ connectivity);
// Create cell-block partitioning.
// if we want to block before partitioning, create connectivity graph
// for blocks based on connectivity graph for cells.
DynamicSparsityPattern connectivity_blocks(n_blocks, n_blocks);
- make_connectivity_cells_to_blocks(
- irregular_cells, connectivity, connectivity_blocks);
+ make_connectivity_cells_to_blocks(irregular_cells,
+ connectivity,
+ connectivity_blocks);
unsigned int n_blocks = 0;
if (scheme == partition_color ||
template class LocalResults<double>;
template <int dim, int spacedim, typename number>
- LocalIntegrator<dim, spacedim, number>::LocalIntegrator() :
- use_cell(true),
- use_boundary(true),
- use_face(true)
+ LocalIntegrator<dim, spacedim, number>::LocalIntegrator()
+ : use_cell(true)
+ , use_boundary(true)
+ , use_face(true)
{}
template <int dim, int spacedim, typename number>
LocalIntegrator<dim, spacedim, number>::LocalIntegrator(bool c,
bool b,
- bool f) :
- use_cell(c),
- use_boundary(b),
- use_face(f)
+ bool f)
+ : use_cell(c)
+ , use_boundary(b)
+ , use_face(f)
{}
IndexSet index_set(mg_dof.locally_owned_dofs().size());
std::vector<types::global_dof_index> accessed_indices;
- ghosted_level_vector.resize(
- 0, mg_dof.get_triangulation().n_global_levels() - 1);
+ ghosted_level_vector.resize(0,
+ mg_dof.get_triangulation().n_global_levels() -
+ 1);
std::vector<IndexSet> level_index_set(
mg_dof.get_triangulation().n_global_levels());
for (unsigned int l = 0; l < mg_dof.get_triangulation().n_global_levels();
std::sort(accessed_indices.begin(), accessed_indices.end());
index_set.add_indices(accessed_indices.begin(), accessed_indices.end());
index_set.compress();
- ghosted_global_vector.reinit(
- mg_dof.locally_owned_dofs(), index_set, mpi_communicator);
+ ghosted_global_vector.reinit(mg_dof.locally_owned_dofs(),
+ index_set,
+ mpi_communicator);
// localize the copy indices for faster access. Since all access will be
// through the ghosted vector in 'data', we can use this (much faster)
// now do a global reduction over all processors to see what operation
// they can agree upon
- perform_plain_copy = Utilities::MPI::min(
- static_cast<int>(my_perform_plain_copy), mpi_communicator);
- perform_renumbered_plain_copy = Utilities::MPI::min(
- static_cast<int>(my_perform_renumbered_plain_copy), mpi_communicator);
+ perform_plain_copy =
+ Utilities::MPI::min(static_cast<int>(my_perform_plain_copy),
+ mpi_communicator);
+ perform_renumbered_plain_copy =
+ Utilities::MPI::min(static_cast<int>(my_perform_renumbered_plain_copy),
+ mpi_communicator);
// if we do a plain copy, no need to hold additional ghosted vectors
if (perform_renumbered_plain_copy)
ExcDimensionMismatch(couplings.n_rows(), fe.n_components()));
Assert(couplings.n_cols() == fe.n_components(),
ExcDimensionMismatch(couplings.n_cols(), fe.n_components()));
- Assert(
- flux_couplings.n_rows() == fe.n_components(),
- ExcDimensionMismatch(flux_couplings.n_rows(), fe.n_components()));
- Assert(
- flux_couplings.n_cols() == fe.n_components(),
- ExcDimensionMismatch(flux_couplings.n_cols(), fe.n_components()));
+ Assert(flux_couplings.n_rows() == fe.n_components(),
+ ExcDimensionMismatch(flux_couplings.n_rows(),
+ fe.n_components()));
+ Assert(flux_couplings.n_cols() == fe.n_components(),
+ ExcDimensionMismatch(flux_couplings.n_cols(),
+ fe.n_components()));
cell_indices.resize(fe.dofs_per_cell);
cell->get_mg_dof_indices(cell_indices);
// next count what we got
for (unsigned int block = 0; block < fe.n_blocks(); ++block)
- dofs_per_block[l][target_block[block]] += std::count(
- dofs_in_block[block].begin(), dofs_in_block[block].end(), true);
+ dofs_per_block[l][target_block[block]] +=
+ std::count(dofs_in_block[block].begin(),
+ dofs_in_block[block].end(),
+ true);
}
}
continue;
std::fill(cell_dofs.begin(), cell_dofs.end(), false);
- std::fill(
- cell_dofs_interface.begin(), cell_dofs_interface.end(), false);
+ std::fill(cell_dofs_interface.begin(),
+ cell_dofs_interface.end(),
+ false);
for (unsigned int face_nr = 0;
face_nr < GeometryInfo<dim>::faces_per_cell;
const DoFHandler<deal_II_dimension> &,
const std::vector<bool> &);
- template void
- MGTransferBlockSelect<float>::build_matrices<deal_II_dimension>(
- const DoFHandler<deal_II_dimension> &,
- const DoFHandler<deal_II_dimension> &,
- const unsigned int);
+ template void MGTransferBlockSelect<float>::build_matrices<
+ deal_II_dimension>(const DoFHandler<deal_II_dimension> &,
+ const DoFHandler<deal_II_dimension> &,
+ const unsigned int);
- template void
- MGTransferBlockSelect<double>::build_matrices<deal_II_dimension>(
- const DoFHandler<deal_II_dimension> &,
- const DoFHandler<deal_II_dimension> &,
- const unsigned int);
+ template void MGTransferBlockSelect<double>::build_matrices<
+ deal_II_dimension>(const DoFHandler<deal_II_dimension> &,
+ const DoFHandler<deal_II_dimension> &,
+ const unsigned int);
template void MGTransferBlock<float>::copy_to_mg(
const DoFHandler<deal_II_dimension> &,
mg_dof.get_triangulation().n_levels(),
std::vector<types::global_dof_index>(n_components));
- MGTools::count_dofs_per_block(
- mg_dof, dofs_per_component, mg_target_component);
+ MGTools::count_dofs_per_block(mg_dof,
+ dofs_per_component,
+ mg_target_component);
for (unsigned int level = 0; level < n_levels - 1; ++level)
{
if (boundary_indices[level].size() == 0)
DoFPair(const unsigned int level,
const types::global_dof_index global_dof_index,
- const types::global_dof_index level_dof_index) :
- level(level),
- global_dof_index(global_dof_index),
- level_dof_index(level_dof_index)
+ const types::global_dof_index level_dof_index)
+ : level(level)
+ , global_dof_index(global_dof_index)
+ , level_dof_index(level_dof_index)
{}
- DoFPair() :
- level(numbers::invalid_unsigned_int),
- global_dof_index(numbers::invalid_dof_index),
- level_dof_index(numbers::invalid_dof_index)
+ DoFPair()
+ : level(numbers::invalid_unsigned_int)
+ , global_dof_index(numbers::invalid_dof_index)
+ , level_dof_index(numbers::invalid_dof_index)
{}
};
global_dof_indices[i], level_dof_indices[i]);
// send this to the owner of the level_dof:
- send_data_temp.emplace_back(
- level, global_dof_indices[i], level_dof_indices[i]);
+ send_data_temp.emplace_back(level,
+ global_dof_indices[i],
+ level_dof_indices[i]);
}
else
{
{
MPI_Status status;
int len;
- int ierr = MPI_Probe(
- MPI_ANY_SOURCE, 71, tria->get_communicator(), &status);
+ int ierr = MPI_Probe(MPI_ANY_SOURCE,
+ 71,
+ tria->get_communicator(),
+ &status);
AssertThrowMPI(ierr);
ierr = MPI_Get_count(&status, MPI_BYTE, &len);
AssertThrowMPI(ierr);
// * wait for all MPI_Isend to complete
if (requests.size() > 0)
{
- const int ierr = MPI_Waitall(
- requests.size(), requests.data(), MPI_STATUSES_IGNORE);
+ const int ierr = MPI_Waitall(requests.size(),
+ requests.data(),
+ MPI_STATUSES_IGNORE);
AssertThrowMPI(ierr);
requests.clear();
}
std::less<std::pair<types::global_dof_index, types::global_dof_index>>
compare;
for (unsigned int level = 0; level < copy_indices.size(); ++level)
- std::sort(
- copy_indices[level].begin(), copy_indices[level].end(), compare);
+ std::sort(copy_indices[level].begin(),
+ copy_indices[level].end(),
+ compare);
for (unsigned int level = 0; level < copy_indices_level_mine.size();
++level)
std::sort(copy_indices_level_mine[level].begin(),
{
std::sort(ghosted_level_dofs.begin(), ghosted_level_dofs.end());
IndexSet ghosted_dofs(locally_owned.size());
- ghosted_dofs.add_indices(
- ghosted_level_dofs.begin(),
- std::unique(ghosted_level_dofs.begin(), ghosted_level_dofs.end()));
+ ghosted_dofs.add_indices(ghosted_level_dofs.begin(),
+ std::unique(ghosted_level_dofs.begin(),
+ ghosted_level_dofs.end()));
ghosted_dofs.compress();
// Add possible ghosts from the previous content in the vector
template <int dim, typename Number>
-MGTransferMatrixFree<dim, Number>::MGTransferMatrixFree() :
- fe_degree(0),
- element_is_continuous(false),
- n_components(0),
- n_child_cell_dofs(0)
+MGTransferMatrixFree<dim, Number>::MGTransferMatrixFree()
+ : fe_degree(0)
+ , element_is_continuous(false)
+ , n_components(0)
+ , n_child_cell_dofs(0)
{}
template <int dim, typename Number>
MGTransferMatrixFree<dim, Number>::MGTransferMatrixFree(
- const MGConstrainedDoFs &mg_c) :
- fe_degree(0),
- element_is_continuous(false),
- n_components(0),
- n_child_cell_dofs(0)
+ const MGConstrainedDoFs &mg_c)
+ : fe_degree(0)
+ , element_is_continuous(false)
+ , n_components(0)
+ , n_child_cell_dofs(0)
{
this->mg_constrained_dofs = &mg_c;
}
template <int dim, typename Number>
MGTransferBlockMatrixFree<dim, Number>::MGTransferBlockMatrixFree(
- const MGConstrainedDoFs &mg_c) :
- same_for_all(true)
+ const MGConstrainedDoFs &mg_c)
+ : same_for_all(true)
{
matrix_free_transfer_vector.emplace_back(mg_c);
}
template <int dim, typename Number>
MGTransferBlockMatrixFree<dim, Number>::MGTransferBlockMatrixFree(
- const std::vector<MGConstrainedDoFs> &mg_c) :
- same_for_all(false)
+ const std::vector<MGConstrainedDoFs> &mg_c)
+ : same_for_all(false)
{
for (unsigned int i = 0; i < mg_c.size(); ++i)
matrix_free_transfer_vector.emplace_back(mg_c[i]);
for (unsigned int b = 0; b < n_blocks; ++b)
{
const unsigned int data_block = same_for_all ? 0 : b;
- matrix_free_transfer_vector[data_block].prolongate(
- to_level, dst.block(b), src.block(b));
+ matrix_free_transfer_vector[data_block].prolongate(to_level,
+ dst.block(b),
+ src.block(b));
}
}
for (unsigned int b = 0; b < n_blocks; ++b)
{
const unsigned int data_block = same_for_all ? 0 : b;
- matrix_free_transfer_vector[data_block].restrict_and_add(
- from_level, dst.block(b), src.block(b));
+ matrix_free_transfer_vector[data_block].restrict_and_add(from_level,
+ dst.block(b),
+ src.block(b));
}
}
// increment dofs_per_cell since a useless diagonal element will be
// stored
IndexSet level_p1_relevant_dofs;
- DoFTools::extract_locally_relevant_level_dofs(
- mg_dof, level + 1, level_p1_relevant_dofs);
- DynamicSparsityPattern dsp(
- this->sizes[level + 1], this->sizes[level], level_p1_relevant_dofs);
+ DoFTools::extract_locally_relevant_level_dofs(mg_dof,
+ level + 1,
+ level_p1_relevant_dofs);
+ DynamicSparsityPattern dsp(this->sizes[level + 1],
+ this->sizes[level],
+ level_p1_relevant_dofs);
typename DoFHandler<dim>::cell_iterator cell, endc = mg_dof.end(level);
for (cell = mg_dof.begin(level); cell != endc; ++cell)
if (cell->has_children() &&
cell->child(child)->get_mg_dof_indices(dof_indices_child);
- replace(
- this->mg_constrained_dofs, level + 1, dof_indices_child);
+ replace(this->mg_constrained_dofs,
+ level + 1,
+ dof_indices_child);
// now tag the entries in the
// matrix which will be used
for (unsigned int j = 0; j < dofs_per_cell; ++j)
if (prolongation(i, j) != 0)
entries.push_back(dof_indices_parent[j]);
- dsp.add_entries(
- dof_indices_child[i], entries.begin(), entries.end());
+ dsp.add_entries(dof_indices_child[i],
+ entries.begin(),
+ entries.end());
}
}
}
cell->child(child)->get_mg_dof_indices(dof_indices_child);
- replace(
- this->mg_constrained_dofs, level + 1, dof_indices_child);
+ replace(this->mg_constrained_dofs,
+ level + 1,
+ dof_indices_child);
// now set the entries in the matrix
for (unsigned int i = 0; i < dofs_per_cell; ++i)
DEAL_II_NAMESPACE_OPEN
-MGTransferBlockBase::MGTransferBlockBase() : n_mg_blocks(0)
+MGTransferBlockBase::MGTransferBlockBase()
+ : n_mg_blocks(0)
{}
-MGTransferBlockBase::MGTransferBlockBase(const MGConstrainedDoFs &mg_c) :
- n_mg_blocks(0),
- mg_constrained_dofs(&mg_c)
+MGTransferBlockBase::MGTransferBlockBase(const MGConstrainedDoFs &mg_c)
+ : n_mg_blocks(0)
+ , mg_constrained_dofs(&mg_c)
{}
MGTransferBlockBase::MGTransferBlockBase(
const AffineConstraints<double> & /*c*/,
- const MGConstrainedDoFs &mg_c) :
- n_mg_blocks(0),
- mg_constrained_dofs(&mg_c)
+ const MGConstrainedDoFs &mg_c)
+ : n_mg_blocks(0)
+ , mg_constrained_dofs(&mg_c)
{}
template <typename number>
-MGTransferBlock<number>::MGTransferBlock() :
- memory(nullptr, typeid(*this).name())
+MGTransferBlock<number>::MGTransferBlock()
+ : memory(nullptr, typeid(*this).name())
{}
//----------------------------------------------------------------------//
template <typename number>
-MGTransferSelect<number>::MGTransferSelect() :
- selected_component(0),
- mg_selected_component(0)
+MGTransferSelect<number>::MGTransferSelect()
+ : selected_component(0)
+ , mg_selected_component(0)
{}
template <typename number>
-MGTransferSelect<number>::MGTransferSelect(const AffineConstraints<double> &c) :
- selected_component(0),
- mg_selected_component(0),
- constraints(&c)
+MGTransferSelect<number>::MGTransferSelect(const AffineConstraints<double> &c)
+ : selected_component(0)
+ , mg_selected_component(0)
+ , constraints(&c)
{}
//----------------------------------------------------------------------//
template <typename number>
-MGTransferBlockSelect<number>::MGTransferBlockSelect() : selected_block(0)
+MGTransferBlockSelect<number>::MGTransferBlockSelect()
+ : selected_block(0)
{}
template <typename number>
MGTransferBlockSelect<number>::MGTransferBlockSelect(
- const MGConstrainedDoFs &mg_c) :
- MGTransferBlockBase(mg_c),
- selected_block(0)
+ const MGConstrainedDoFs &mg_c)
+ : MGTransferBlockBase(mg_c)
+ , selected_block(0)
{}
template <typename number>
MGTransferBlockSelect<number>::MGTransferBlockSelect(
const AffineConstraints<double> & /*c*/,
- const MGConstrainedDoFs &mg_c) :
- MGTransferBlockBase(mg_c),
- selected_block(0)
+ const MGConstrainedDoFs &mg_c)
+ : MGTransferBlockBase(mg_c)
+ , selected_block(0)
{}
std::vector<types::global_dof_index> dofs(immersed_fe.dofs_per_cell);
std::vector<types::global_dof_index> odofs(space_fe.dofs_per_cell);
- FEValues<dim1, spacedim> fe_v(
- immersed_mapping, immersed_fe, quad, update_quadrature_points);
+ FEValues<dim1, spacedim> fe_v(immersed_mapping,
+ immersed_fe,
+ quad,
+ update_quadrature_points);
// Take care of components
const ComponentMask space_c =
const std::vector<Point<dim0>> & qps = qpoints[c];
const std::vector<unsigned int> &ids = maps[c];
- FEValues<dim0, spacedim> o_fe_v(
- cache.get_mapping(), space_dh.get_fe(), qps, update_values);
+ FEValues<dim0, spacedim> o_fe_v(cache.get_mapping(),
+ space_dh.get_fe(),
+ qps,
+ update_values);
o_fe_v.reinit(ocell);
ocell->get_dof_indices(odofs);
}
// Now assemble the matrices
- constraints.distribute_local_to_global(
- cell_matrix, odofs, dofs, matrix);
+ constraints.distribute_local_to_global(cell_matrix,
+ odofs,
+ dofs,
+ matrix);
}
}
}
ImmersedSurfaceQuadrature<dim>::ImmersedSurfaceQuadrature(
const std::vector<Point<dim>> & points,
const std::vector<double> & weights,
- const std::vector<Tensor<1, dim>> &normals) :
- Quadrature<dim>(points, weights),
- normals(normals)
+ const std::vector<Tensor<1, dim>> &normals)
+ : Quadrature<dim>(points, weights)
+ , normals(normals)
{
AssertDimension(weights.size(), points.size());
AssertDimension(normals.size(), points.size());
std::shared_ptr<dealii::hp::FECollection<dim, spacedim>>>
& finite_elements,
const UpdateFlags update_flags,
- const std::vector<std::vector<unsigned int>> &cell_to_patch_index_map) :
- ParallelDataBase<dim, spacedim>(n_datasets,
- n_subdivisions,
- n_postprocessor_outputs,
- mapping,
- finite_elements,
- update_flags,
- false),
- cell_to_patch_index_map(&cell_to_patch_index_map)
+ const std::vector<std::vector<unsigned int>> &cell_to_patch_index_map)
+ : ParallelDataBase<dim, spacedim>(n_datasets,
+ n_subdivisions,
+ n_postprocessor_outputs,
+ mapping,
+ finite_elements,
+ update_flags,
+ false)
+ , cell_to_patch_index_map(&cell_to_patch_index_map)
{}
} // namespace DataOutImplementation
} // namespace internal
const std::vector<Point<DoFHandlerType::space_dimension>> &q_points =
fe_patch_values.get_quadrature_points();
- patch.data.reinit(
- scratch_data.n_datasets + DoFHandlerType::space_dimension, n_q_points);
+ patch.data.reinit(scratch_data.n_datasets +
+ DoFHandlerType::space_dimension,
+ n_q_points);
for (unsigned int i = 0; i < DoFHandlerType::space_dimension; ++i)
for (unsigned int q = 0; q < n_q_points; ++q)
patch.data(patch.data.size(0) - DoFHandlerType::space_dimension + i,
const std::vector<
std::shared_ptr<dealii::hp::FECollection<dim, spacedim>>>
& finite_elements,
- const UpdateFlags update_flags) :
- internal::DataOutImplementation::ParallelDataBase<dim, spacedim>(
- n_datasets,
- n_subdivisions,
- n_postprocessor_outputs,
- mapping,
- finite_elements,
- update_flags,
- true)
+ const UpdateFlags update_flags)
+ : internal::DataOutImplementation::ParallelDataBase<dim, spacedim>(
+ n_datasets,
+ n_subdivisions,
+ n_postprocessor_outputs,
+ mapping,
+ finite_elements,
+ update_flags,
+ true)
{}
template <int dim, typename DoFHandlerType>
-DataOutFaces<dim, DoFHandlerType>::DataOutFaces(const bool so) :
- surface_only(so)
+DataOutFaces<dim, DoFHandlerType>::DataOutFaces(const bool so)
+ : surface_only(so)
{
Assert(dim == DoFHandlerType::dimension, ExcNotImplemented());
}
if (data.n_datasets > 0)
{
- data.reinit_all_fe_values(
- this->dof_data, cell_and_face->first, cell_and_face->second);
+ data.reinit_all_fe_values(this->dof_data,
+ cell_and_face->first,
+ cell_and_face->second);
const FEValuesBase<dimension> &fe_patch_values =
data.get_present_fe_values(0);
const std::vector<
std::shared_ptr<dealii::hp::FECollection<dim, spacedim>>>
& finite_elements,
- const UpdateFlags update_flags) :
- internal::DataOutImplementation::ParallelDataBase<dim, spacedim>(
- n_datasets,
- n_subdivisions,
- n_postprocessor_outputs,
- mapping,
- finite_elements,
- update_flags,
- false),
- n_patches_per_circle(n_patches_per_circle)
+ const UpdateFlags update_flags)
+ : internal::DataOutImplementation::ParallelDataBase<dim, spacedim>(
+ n_datasets,
+ n_subdivisions,
+ n_postprocessor_outputs,
+ mapping,
+ finite_elements,
+ update_flags,
+ false)
+ , n_patches_per_circle(n_patches_per_circle)
{}
for (unsigned int x = 0; x < n_points; ++x)
for (unsigned int y = 0; y < n_points; ++y)
for (unsigned int z = 0; z < n_points; ++z)
- my_patches[angle].data(
- offset + component,
- x * n_points * n_points + y * n_points +
- z) = data.patch_values_system
- .solution_values[x * n_points + z](
- component);
+ my_patches[angle].data(offset + component,
+ x * n_points *
+ n_points +
+ y * n_points + z) =
+ data.patch_values_system
+ .solution_values[x * n_points + z](
+ component);
break;
default:
const hp::QCollection<dim> q_collection(patch_points);
const hp::FECollection<dim> &fe_collection = dof_handler->get_fe_collection();
- hp::FEValues<dim> x_fe_patch_values(
- fe_collection, q_collection, update_values);
+ hp::FEValues<dim> x_fe_patch_values(fe_collection,
+ q_collection,
+ update_values);
const unsigned int n_q_points = patch_points.size();
std::vector<double> patch_values(n_q_points);
template <int dim>
DataPostprocessorScalar<dim>::DataPostprocessorScalar(
const std::string &name,
- const UpdateFlags update_flags) :
- name(name),
- update_flags(update_flags)
+ const UpdateFlags update_flags)
+ : name(name)
+ , update_flags(update_flags)
{}
template <int dim>
DataPostprocessorVector<dim>::DataPostprocessorVector(
const std::string &name,
- const UpdateFlags update_flags) :
- name(name),
- update_flags(update_flags)
+ const UpdateFlags update_flags)
+ : name(name)
+ , update_flags(update_flags)
{}
template <int dim>
DataPostprocessorTensor<dim>::DataPostprocessorTensor(
const std::string &name,
- const UpdateFlags update_flags) :
- name(name),
- update_flags(update_flags)
+ const UpdateFlags update_flags)
+ : name(name)
+ , update_flags(update_flags)
{}
// ...and get the value of the
// projected derivative...
const typename DerivativeDescription::ProjectedDerivative
- this_midpoint_value = DerivativeDescription::get_projected_derivative(
- fe_midpoint_value, solution, component);
+ this_midpoint_value =
+ DerivativeDescription::get_projected_derivative(fe_midpoint_value,
+ solution,
+ component);
// ...and the place where it lives
const Point<dim> this_center = fe_midpoint_value.quadrature_point(0);
#ifdef DEAL_II_WITH_P4EST
if (dynamic_cast<const parallel::distributed::Triangulation<1, spacedim> *>(
&dof_handler.get_triangulation()) != nullptr)
- Assert(
- (subdomain_id_ == numbers::invalid_subdomain_id) ||
- (subdomain_id_ ==
- dynamic_cast<const parallel::distributed::Triangulation<1, spacedim>
- &>(dof_handler.get_triangulation())
- .locally_owned_subdomain()),
- ExcMessage("For parallel distributed triangulations, the only "
- "valid subdomain_id that can be passed here is the "
- "one that corresponds to the locally owned subdomain id."));
+ Assert((subdomain_id_ == numbers::invalid_subdomain_id) ||
+ (subdomain_id_ ==
+ dynamic_cast<
+ const parallel::distributed::Triangulation<1, spacedim> &>(
+ dof_handler.get_triangulation())
+ .locally_owned_subdomain()),
+ ExcMessage(
+ "For parallel distributed triangulations, the only "
+ "valid subdomain_id that can be passed here is the "
+ "one that corresponds to the locally owned subdomain id."));
const types::subdomain_id subdomain_id =
((dynamic_cast<const parallel::distributed::Triangulation<1, spacedim> *>(
i != neumann_bc.end();
++i)
Assert(i->second->n_components == n_components,
- ExcInvalidBoundaryFunction(
- i->first, i->second->n_components, n_components));
+ ExcInvalidBoundaryFunction(i->first,
+ i->second->n_components,
+ n_components));
Assert(component_mask.represents_n_components(n_components),
ExcInvalidComponentMask());
i != neumann_bc.end();
++i)
Assert(i->second->n_components == n_components,
- ExcInvalidBoundaryFunction(
- i->first, i->second->n_components, n_components));
+ ExcInvalidBoundaryFunction(i->first,
+ i->second->n_components,
+ n_components));
// reserve one slot for each cell and set it to zero
for (unsigned int n = 0; n < n_solution_vectors; ++n)
// for the neighbor gradient, we need several auxiliary fields, depending on
// the way we get it (see below)
std::vector<std::vector<std::vector<Tensor<1, spacedim, number>>>>
- gradients_here(
- n_solution_vectors,
- std::vector<std::vector<Tensor<1, spacedim, number>>>(
- 2, std::vector<Tensor<1, spacedim, number>>(n_components)));
+ gradients_here(n_solution_vectors,
+ std::vector<std::vector<Tensor<1, spacedim, number>>>(
+ 2,
+ std::vector<Tensor<1, spacedim, number>>(n_components)));
std::vector<std::vector<std::vector<Tensor<1, spacedim, number>>>>
gradients_neighbor(gradients_here);
std::vector<Vector<typename ProductType<number, double>::type>>
- grad_dot_n_neighbor(
- n_solution_vectors,
- Vector<typename ProductType<number, double>::type>(n_components));
+ grad_dot_n_neighbor(n_solution_vectors,
+ Vector<typename ProductType<number, double>::type>(
+ n_components));
// reserve some space for coefficient values at one point. if there is no
// coefficient, then we fill it by unity once and for all and don't set it
hp::MappingCollection<1, spacedim> mapping_collection;
mapping_collection.push_back(mapping);
- hp::FEValues<1, spacedim> fe_values(
- mapping_collection, fe, q_collection, update_gradients);
+ hp::FEValues<1, spacedim> fe_values(mapping_collection,
+ fe,
+ q_collection,
+ update_gradients);
hp::FEFaceValues<1, spacedim> fe_face_values(
/*mapping_collection,*/ fe, q_face_collection, update_normal_vectors);
-Histogram::Interval::Interval(const double left_point,
- const double right_point) :
- left_point(left_point),
- right_point(right_point),
- content(0)
+Histogram::Interval::Interval(const double left_point, const double right_point)
+ : left_point(left_point)
+ , right_point(right_point)
+ , content(0)
{}
const unsigned int n_intervals,
const IntervalSpacing interval_spacing)
{
- Assert(
- values.size() > 0,
- ExcMessage("Your input data needs to contain at least one input vector."));
+ Assert(values.size() > 0,
+ ExcMessage(
+ "Your input data needs to contain at least one input vector."));
Assert(n_intervals > 0,
ExcMessage("The number of intervals needs to be at least one."));
for (unsigned int i = 0; i < values.size(); ++i)
const comparator logarithmic_less_function =
&Histogram::template logarithmic_less<number>;
- min_value = *std::min_element(
- values[0].begin(), values[0].end(), logarithmic_less_function);
+ min_value = *std::min_element(values[0].begin(),
+ values[0].end(),
+ logarithmic_less_function);
- max_value = *std::max_element(
- values[0].begin(), values[0].end(), logarithmic_less_function);
+ max_value = *std::max_element(values[0].begin(),
+ values[0].end(),
+ logarithmic_less_function);
for (unsigned int i = 1; i < values.size(); ++i)
{
(std::log(max_value) - std::log(min_value)) / n_intervals;
for (unsigned int n = 0; n < n_intervals; ++n)
- intervals[0].emplace_back(
- std::exp(std::log(min_value) + n * delta),
- std::exp(std::log(min_value) + (n + 1) * delta));
+ intervals[0].emplace_back(std::exp(std::log(min_value) + n * delta),
+ std::exp(std::log(min_value) +
+ (n + 1) * delta));
break;
};
const IntervalSpacing interval_spacing)
{
std::vector<Vector<number>> values_list(1, values);
- evaluate(
- values_list, std::vector<double>(1, 0.), n_intervals, interval_spacing);
+ evaluate(values_list,
+ std::vector<double>(1, 0.),
+ n_intervals,
+ interval_spacing);
}
template <int dim>
KDTree<dim>::KDTree(const unsigned int & max_leaf_size,
- const std::vector<Point<dim>> &pts) :
- max_leaf_size(max_leaf_size)
+ const std::vector<Point<dim>> &pts)
+ : max_leaf_size(max_leaf_size)
{
if (pts.size() > 0)
set_points(pts);
const unsigned int column) =
&column_less_than<typename SparseMatrix<number>::iterator>;
const typename SparseMatrix<number>::iterator p =
- Utilities::lower_bound(
- matrix.begin(row) + 1, matrix.end(row), dof_number, comp);
+ Utilities::lower_bound(matrix.begin(row) + 1,
+ matrix.end(row),
+ dof_number,
+ comp);
// check whether this line has an entry in the
// regarding column (check for ==dof_number and !=
template <int dim>
PointValueHistory<dim>::PointValueHistory(
- const unsigned int n_independent_variables) :
- n_indep(n_independent_variables)
+ const unsigned int n_independent_variables)
+ : n_indep(n_independent_variables)
{
closed = false;
cleared = false;
template <int dim>
PointValueHistory<dim>::PointValueHistory(
const DoFHandler<dim> &dof_handler,
- const unsigned int n_independent_variables) :
- dof_handler(&dof_handler),
- n_indep(n_independent_variables)
+ const unsigned int n_independent_variables)
+ : dof_handler(&dof_handler)
+ , n_indep(n_independent_variables)
{
closed = false;
cleared = false;
if (have_dof_handler)
{
tria_listener =
- dof_handler->get_triangulation().signals.any_change.connect(std::bind(
- &PointValueHistory<dim>::tria_change_listener, std::ref(*this)));
+ dof_handler->get_triangulation().signals.any_change.connect(
+ std::bind(&PointValueHistory<dim>::tria_change_listener,
+ std::ref(*this)));
}
}
if (have_dof_handler)
{
tria_listener =
- dof_handler->get_triangulation().signals.any_change.connect(std::bind(
- &PointValueHistory<dim>::tria_change_listener, std::ref(*this)));
+ dof_handler->get_triangulation().signals.any_change.connect(
+ std::bind(&PointValueHistory<dim>::tria_change_listener,
+ std::ref(*this)));
}
return *this;
// FE.
Quadrature<dim> support_point_quadrature(
dof_handler->get_fe().get_unit_support_points());
- FEValues<dim> fe_values(
- dof_handler->get_fe(), support_point_quadrature, update_quadrature_points);
- unsigned int n_support_points =
+ FEValues<dim> fe_values(dof_handler->get_fe(),
+ support_point_quadrature,
+ update_quadrature_points);
+ unsigned int n_support_points =
dof_handler->get_fe().get_unit_support_points().size();
unsigned int n_components = dof_handler->get_fe(0).n_components();
// FE.
Quadrature<dim> support_point_quadrature(
dof_handler->get_fe().get_unit_support_points());
- FEValues<dim> fe_values(
- dof_handler->get_fe(), support_point_quadrature, update_quadrature_points);
- unsigned int n_support_points =
+ FEValues<dim> fe_values(dof_handler->get_fe(),
+ support_point_quadrature,
+ update_quadrature_points);
+ unsigned int n_support_points =
dof_handler->get_fe().get_unit_support_points().size();
unsigned int n_components = dof_handler->get_fe(0).n_components();
}
internal::PointValueHistoryImplementation::PointGeometryData<dim>
- new_point_geometry_data(
- locations[point], current_points[point], new_solution_indices);
+ new_point_geometry_data(locations[point],
+ current_points[point],
+ new_solution_indices);
point_geometry_data.push_back(new_point_geometry_data);
unsigned int solution_index = point->solution_indices[comp];
data_store_field
->second[data_store_index * n_stored + store_index]
- .push_back(internal::ElementAccess<VectorType>::get(
- solution, solution_index));
+ .push_back(
+ internal::ElementAccess<VectorType>::get(solution,
+ solution_index));
store_index++;
}
}
// we now have a point to query, need to know what cell it is in
const Point<dim> requested_location = point->requested_location;
const typename DoFHandler<dim>::active_cell_iterator cell =
- GridTools::find_active_cell_around_point(
- StaticMappingQ1<dim>::mapping, *dof_handler, requested_location)
+ GridTools::find_active_cell_around_point(StaticMappingQ1<dim>::mapping,
+ *dof_handler,
+ requested_location)
.first;
// Make a Vector <double> for the value
// at the point. It will have as many
// components as there are in the fe.
- VectorTools::point_value(
- *dof_handler, solution, point->requested_location, value);
+ VectorTools::point_value(*dof_handler,
+ solution,
+ point->requested_location,
+ value);
// Look up the component_mask and add
// in components according to that mask
locations = std::vector<Point<dim>>();
- FEValues<dim> fe_values(
- dof_handler->get_fe(), quadrature, update_quadrature_points);
+ FEValues<dim> fe_values(dof_handler->get_fe(),
+ quadrature,
+ update_quadrature_points);
unsigned int n_quadrature_points = quadrature.size();
std::vector<Point<dim>> evaluation_points;
// need to know what cell it is in
Point<dim> requested_location = point->requested_location;
typename DoFHandler<dim>::active_cell_iterator cell =
- GridTools::find_active_cell_around_point(
- StaticMappingQ1<dim>::mapping, *dof_handler, requested_location)
+ GridTools::find_active_cell_around_point(StaticMappingQ1<dim>::mapping,
+ *dof_handler,
+ requested_location)
.first;
fe_values.reinit(cell);
template <int dim, typename VectorType, typename DoFHandlerType>
SolutionTransfer<dim, VectorType, DoFHandlerType>::SolutionTransfer(
- const DoFHandlerType &dof) :
- dof_handler(&dof, typeid(*this).name()),
- n_dofs_old(0),
- prepared_for(none)
+ const DoFHandlerType &dof)
+ : dof_handler(&dof, typeid(*this).name())
+ , n_dofs_old(0)
+ , prepared_for(none)
{
Assert((dynamic_cast<const parallel::distributed::Triangulation<
DoFHandlerType::dimension,
for (unsigned int i = 0; i < dofs_per_cell; ++i)
local_values(i) = internal::ElementAccess<VectorType>::get(
in, (*pointerstruct->second.indices_ptr)[i]);
- cell->set_dof_values_by_interpolation(
- local_values, out, this_fe_index);
+ cell->set_dof_values_by_interpolation(local_values,
+ out,
+ this_fe_index);
}
}
}
// cell->get_interpolated_dof_values already does all of the
// interpolations between spaces
for (unsigned int j = 0; j < in_size; ++j)
- cell->get_interpolated_dof_values(
- all_in[j], dof_values_on_cell[n_cf][j], target_fe_index);
+ cell->get_interpolated_dof_values(all_in[j],
+ dof_values_on_cell[n_cf][j],
+ target_fe_index);
cell_map[std::make_pair(cell->level(), cell->index())] =
Pointerstruct(&dof_values_on_cell[n_cf], target_fe_index);
++n_cf;
{
tmp.reinit(in_size, true);
for (unsigned int i = 0; i < in_size; ++i)
- tmp(i) = internal::ElementAccess<VectorType>::get(
- all_in[j], (*indexptr)[i]);
+ tmp(i) =
+ internal::ElementAccess<VectorType>::get(all_in[j],
+ (*indexptr)[i]);
- cell->set_dof_values_by_interpolation(
- tmp, all_out[j], old_fe_index);
+ cell->set_dof_values_by_interpolation(tmp,
+ all_out[j],
+ old_fe_index);
}
}
else if (valuesptr)
for (unsigned int i = 0; i < dofs_per_cell; ++i)
- internal::ElementAccess<VectorType>::set(
- (*data)(i), dofs[i], all_out[j]);
+ internal::ElementAccess<VectorType>::set((*data)(i),
+ dofs[i],
+ all_out[j]);
}
}
// undefined status
DEAL_II_NAMESPACE_OPEN
-TimeDependent::TimeSteppingData::TimeSteppingData(
- const unsigned int look_ahead,
- const unsigned int look_back) :
- look_ahead(look_ahead),
- look_back(look_back)
+TimeDependent::TimeSteppingData::TimeSteppingData(const unsigned int look_ahead,
+ const unsigned int look_back)
+ : look_ahead(look_ahead)
+ , look_back(look_back)
{}
TimeDependent::TimeDependent(const TimeSteppingData &data_primal,
const TimeSteppingData &data_dual,
- const TimeSteppingData &data_postprocess) :
- sweep_no(numbers::invalid_unsigned_int),
- timestepping_data_primal(data_primal),
- timestepping_data_dual(data_dual),
- timestepping_data_postprocess(data_postprocess)
+ const TimeSteppingData &data_postprocess)
+ : sweep_no(numbers::invalid_unsigned_int)
+ , timestepping_data_primal(data_primal)
+ , timestepping_data_dual(data_dual)
+ , timestepping_data_postprocess(data_postprocess)
{}
void
TimeDependent::solve_primal_problem()
{
- do_loop(
- std::bind(&TimeStepBase::init_for_primal_problem, std::placeholders::_1),
- std::bind(&TimeStepBase::solve_primal_problem, std::placeholders::_1),
- timestepping_data_primal,
- forward);
+ do_loop(std::bind(&TimeStepBase::init_for_primal_problem,
+ std::placeholders::_1),
+ std::bind(&TimeStepBase::solve_primal_problem, std::placeholders::_1),
+ timestepping_data_primal,
+ forward);
}
void
TimeDependent::solve_dual_problem()
{
- do_loop(
- std::bind(&TimeStepBase::init_for_dual_problem, std::placeholders::_1),
- std::bind(&TimeStepBase::solve_dual_problem, std::placeholders::_1),
- timestepping_data_dual,
- backward);
+ do_loop(std::bind(&TimeStepBase::init_for_dual_problem,
+ std::placeholders::_1),
+ std::bind(&TimeStepBase::solve_dual_problem, std::placeholders::_1),
+ timestepping_data_dual,
+ backward);
}
void
TimeDependent::postprocess()
{
- do_loop(
- std::bind(&TimeStepBase::init_for_postprocessing, std::placeholders::_1),
- std::bind(&TimeStepBase::postprocess_timestep, std::placeholders::_1),
- timestepping_data_postprocess,
- forward);
+ do_loop(std::bind(&TimeStepBase::init_for_postprocessing,
+ std::placeholders::_1),
+ std::bind(&TimeStepBase::postprocess_timestep, std::placeholders::_1),
+ timestepping_data_postprocess,
+ forward);
}
/* --------------------------------------------------------------------- */
-TimeStepBase::TimeStepBase(const double time) :
- previous_timestep(nullptr),
- next_timestep(nullptr),
- sweep_no(numbers::invalid_unsigned_int),
- timestep_no(numbers::invalid_unsigned_int),
- time(time),
- next_action(numbers::invalid_unsigned_int)
+TimeStepBase::TimeStepBase(const double time)
+ : previous_timestep(nullptr)
+ , next_timestep(nullptr)
+ , sweep_no(numbers::invalid_unsigned_int)
+ , timestep_no(numbers::invalid_unsigned_int)
+ , time(time)
+ , next_action(numbers::invalid_unsigned_int)
{}
template <int dim>
-TimeStepBase_Tria<dim>::TimeStepBase_Tria() :
- TimeStepBase(0),
- tria(nullptr, typeid(*this).name()),
- coarse_grid(nullptr, typeid(*this).name()),
- flags(),
- refinement_flags(0)
+TimeStepBase_Tria<dim>::TimeStepBase_Tria()
+ : TimeStepBase(0)
+ , tria(nullptr, typeid(*this).name())
+ , coarse_grid(nullptr, typeid(*this).name())
+ , flags()
+ , refinement_flags(0)
{
Assert(false, ExcPureFunctionCalled());
}
const double time,
const Triangulation<dim> &coarse_grid,
const Flags & flags,
- const RefinementFlags & refinement_flags) :
- TimeStepBase(time),
- tria(nullptr, typeid(*this).name()),
- coarse_grid(&coarse_grid, typeid(*this).name()),
- flags(flags),
- refinement_flags(refinement_flags)
+ const RefinementFlags & refinement_flags)
+ : TimeStepBase(time)
+ , tria(nullptr, typeid(*this).name())
+ , coarse_grid(&coarse_grid, typeid(*this).name())
+ , flags(flags)
+ , refinement_flags(refinement_flags)
{}
template <int dim>
-TimeStepBase_Tria_Flags::Flags<dim>::Flags() :
- delete_and_rebuild_tria(false),
- wakeup_level_to_build_grid(0),
- sleep_level_to_delete_grid(0)
+TimeStepBase_Tria_Flags::Flags<dim>::Flags()
+ : delete_and_rebuild_tria(false)
+ , wakeup_level_to_build_grid(0)
+ , sleep_level_to_delete_grid(0)
{
Assert(false, ExcInternalError());
}
TimeStepBase_Tria_Flags::Flags<dim>::Flags(
const bool delete_and_rebuild_tria,
const unsigned int wakeup_level_to_build_grid,
- const unsigned int sleep_level_to_delete_grid) :
- delete_and_rebuild_tria(delete_and_rebuild_tria),
- wakeup_level_to_build_grid(wakeup_level_to_build_grid),
- sleep_level_to_delete_grid(sleep_level_to_delete_grid)
+ const unsigned int sleep_level_to_delete_grid)
+ : delete_and_rebuild_tria(delete_and_rebuild_tria)
+ , wakeup_level_to_build_grid(wakeup_level_to_build_grid)
+ , sleep_level_to_delete_grid(sleep_level_to_delete_grid)
{
// Assert (!delete_and_rebuild_tria || (wakeup_level_to_build_grid>=1),
// ExcInvalidParameter(wakeup_level_to_build_grid));
const CorrectionRelaxations &correction_relaxations,
const unsigned int cell_number_correction_steps,
const bool mirror_flags_to_previous_grid,
- const bool adapt_grids) :
- max_refinement_level(max_refinement_level),
- first_sweep_with_correction(first_sweep_with_correction),
- min_cells_for_correction(min_cells_for_correction),
- cell_number_corridor_top(cell_number_corridor_top),
- cell_number_corridor_bottom(cell_number_corridor_bottom),
- correction_relaxations(correction_relaxations.size() != 0 ?
- correction_relaxations :
- default_correction_relaxations),
- cell_number_correction_steps(cell_number_correction_steps),
- mirror_flags_to_previous_grid(mirror_flags_to_previous_grid),
- adapt_grids(adapt_grids)
+ const bool adapt_grids)
+ : max_refinement_level(max_refinement_level)
+ , first_sweep_with_correction(first_sweep_with_correction)
+ , min_cells_for_correction(min_cells_for_correction)
+ , cell_number_corridor_top(cell_number_corridor_top)
+ , cell_number_corridor_bottom(cell_number_corridor_bottom)
+ , correction_relaxations(correction_relaxations.size() != 0 ?
+ correction_relaxations :
+ default_correction_relaxations)
+ , cell_number_correction_steps(cell_number_correction_steps)
+ , mirror_flags_to_previous_grid(mirror_flags_to_previous_grid)
+ , adapt_grids(adapt_grids)
{
Assert(cell_number_corridor_top >= 0,
ExcInvalidValue(cell_number_corridor_top));
template <int dim>
TimeStepBase_Tria_Flags::RefinementData<dim>::RefinementData(
const double _refinement_threshold,
- const double _coarsening_threshold) :
- refinement_threshold(_refinement_threshold),
+ const double _coarsening_threshold)
+ : refinement_threshold(_refinement_threshold)
+ ,
// in some rare cases it may happen that
// both thresholds are the same (e.g. if
// there are many cells with the same
DirectionalProjectionBoundary<dim, spacedim>::clone() const
{
return std::unique_ptr<Manifold<dim, spacedim>>(
- new DirectionalProjectionBoundary(
- this->sh, this->direction, this->tolerance));
+ new DirectionalProjectionBoundary(this->sh,
+ this->direction,
+ this->tolerance));
}
template <int dim, int spacedim>
NormalProjectionManifold<dim, spacedim>::NormalProjectionManifold(
const TopoDS_Shape &sh,
- const double tolerance) :
- sh(sh),
- tolerance(tolerance)
+ const double tolerance)
+ : sh(sh)
+ , tolerance(tolerance)
{
Assert(spacedim == 3, ExcNotImplemented());
}
DirectionalProjectionManifold<dim, spacedim>::DirectionalProjectionManifold(
const TopoDS_Shape & sh,
const Tensor<1, spacedim> &direction,
- const double tolerance) :
- sh(sh),
- direction(direction),
- tolerance(tolerance)
+ const double tolerance)
+ : sh(sh)
+ , direction(direction)
+ , tolerance(tolerance)
{
Assert(spacedim == 3, ExcNotImplemented());
}
template <int dim, int spacedim>
NormalToMeshProjectionManifold<dim, spacedim>::NormalToMeshProjectionManifold(
const TopoDS_Shape &sh,
- const double tolerance) :
- sh(sh),
- tolerance(tolerance)
+ const double tolerance)
+ : sh(sh)
+ , tolerance(tolerance)
{
Assert(spacedim == 3, ExcNotImplemented());
Assert(
for (unsigned int i = 0; i < surrounding_points.size(); ++i)
{
std::tuple<Point<3>, Tensor<1, 3>, double, double>
- p_and_diff_forms = closest_point_and_differential_forms(
- sh, surrounding_points[i], tolerance);
+ p_and_diff_forms =
+ closest_point_and_differential_forms(sh,
+ surrounding_points[i],
+ tolerance);
average_normal += std::get<1>(p_and_diff_forms);
}
template <int dim, int spacedim>
ArclengthProjectionLineManifold<dim, spacedim>::
ArclengthProjectionLineManifold(const TopoDS_Shape &sh,
- const double tolerance) :
+ const double tolerance)
+ :
ChartManifold<dim, spacedim, 1>(sh.Closed() ? Point<1>(shape_length(sh)) :
- Point<1>()),
- sh(sh),
- curve(curve_adaptor(sh)),
- tolerance(tolerance),
- length(shape_length(sh))
+ Point<1>())
+ , sh(sh)
+ , curve(curve_adaptor(sh))
+ , tolerance(tolerance)
+ , length(shape_length(sh))
{
Assert(spacedim >= 2, ExcImpossibleInDimSpacedim(dim, spacedim));
}
ArclengthProjectionLineManifold<dim, spacedim>::push_forward(
const Point<1> &chart_point) const
{
- GCPnts_AbscissaPoint AP(
- curve->GetCurve(), chart_point[0], curve->GetCurve().FirstParameter());
- gp_Pnt P = curve->GetCurve().Value(AP.Parameter());
+ GCPnts_AbscissaPoint AP(curve->GetCurve(),
+ chart_point[0],
+ curve->GetCurve().FirstParameter());
+ gp_Pnt P = curve->GetCurve().Value(AP.Parameter());
return point<spacedim>(P);
}
template <int dim, int spacedim>
- NURBSPatchManifold<dim, spacedim>::NURBSPatchManifold(
- const TopoDS_Face &face,
- const double tolerance) :
- face(face),
- tolerance(tolerance)
+ NURBSPatchManifold<dim, spacedim>::NURBSPatchManifold(const TopoDS_Face &face,
+ const double tolerance)
+ : face(face)
+ , tolerance(tolerance)
{}
NURBSPatchManifold<dim, spacedim>::push_forward(
const Point<2> &chart_point) const
{
- return ::dealii::OpenCASCADE::push_forward<spacedim>(
- face, chart_point[0], chart_point[1]);
+ return ::dealii::OpenCASCADE::push_forward<spacedim>(face,
+ chart_point[0],
+ chart_point[1]);
}
template <int dim, int spacedim>
if (spacedim > 2)
DX[2][0] = Du.Z();
else
- Assert(
- std::abs(Du.Z()) < tolerance,
- ExcMessage("Expecting derivative along Z to be zero! Bailing out."));
+ Assert(std::abs(Du.Z()) < tolerance,
+ ExcMessage(
+ "Expecting derivative along Z to be zero! Bailing out."));
DX[0][1] = Dv.X();
DX[1][1] = Dv.Y();
if (spacedim > 2)
DX[2][1] = Dv.Z();
else
- Assert(
- std::abs(Dv.Z()) < tolerance,
- ExcMessage("Expecting derivative along Z to be zero! Bailing out."));
+ Assert(std::abs(Dv.Z()) < tolerance,
+ ExcMessage(
+ "Expecting derivative along Z to be zero! Bailing out."));
return DX;
}
for (exp.Init(shape, TopAbs_VERTEX); exp.More(); exp.Next(), ++n_vertices)
{
}
- return std::tuple<unsigned int, unsigned int, unsigned int>(
- n_faces, n_edges, n_vertices);
+ return std::tuple<unsigned int, unsigned int, unsigned int>(n_faces,
+ n_edges,
+ n_vertices);
}
void
std::sort(curve_points.begin(),
curve_points.end(),
[&](const Point<dim> &p1, const Point<dim> &p2) {
- return OpenCASCADE::point_compare(
- p1, p2, direction, tolerance);
+ return OpenCASCADE::point_compare(p1,
+ p2,
+ direction,
+ tolerance);
});
}
Max_Curvature *= -1;
}
- return std::tuple<Point<3>, Tensor<1, 3>, double, double>(
- point<3>(Value), normal, Min_Curvature, Max_Curvature);
+ return std::tuple<Point<3>, Tensor<1, 3>, double, double>(point<3>(Value),
+ normal,
+ Min_Curvature,
+ Max_Curvature);
}
const bool closed,
const double tolerance);
- template Point<deal_II_dimension> push_forward(
- const TopoDS_Shape &in_shape, const double u, const double v);
+ template Point<deal_II_dimension> push_forward(const TopoDS_Shape &in_shape,
+ const double u,
+ const double v);
template Point<deal_II_dimension> line_intersection(
const TopoDS_Shape & in_shape,
namespace Particles
{
template <int dim, int spacedim>
- Particle<dim, spacedim>::Particle() :
- location(),
- reference_location(),
- id(0),
- property_pool(nullptr),
- properties(PropertyPool::invalid_handle)
+ Particle<dim, spacedim>::Particle()
+ : location()
+ , reference_location()
+ , id(0)
+ , property_pool(nullptr)
+ , properties(PropertyPool::invalid_handle)
{}
template <int dim, int spacedim>
Particle<dim, spacedim>::Particle(const Point<spacedim> &location,
const Point<dim> & reference_location,
- const types::particle_index id) :
- location(location),
- reference_location(reference_location),
- id(id),
- property_pool(nullptr),
- properties(PropertyPool::invalid_handle)
+ const types::particle_index id)
+ : location(location)
+ , reference_location(reference_location)
+ , id(id)
+ , property_pool(nullptr)
+ , properties(PropertyPool::invalid_handle)
{}
template <int dim, int spacedim>
- Particle<dim, spacedim>::Particle(const Particle<dim, spacedim> &particle) :
- location(particle.get_location()),
- reference_location(particle.get_reference_location()),
- id(particle.get_id()),
- property_pool(particle.property_pool),
- properties((particle.has_properties()) ?
- property_pool->allocate_properties_array() :
- PropertyPool::invalid_handle)
+ Particle<dim, spacedim>::Particle(const Particle<dim, spacedim> &particle)
+ : location(particle.get_location())
+ , reference_location(particle.get_reference_location())
+ , id(particle.get_id())
+ , property_pool(particle.property_pool)
+ , properties((particle.has_properties()) ?
+ property_pool->allocate_properties_array() :
+ PropertyPool::invalid_handle)
{
if (particle.has_properties())
{
template <int dim, int spacedim>
- Particle<dim, spacedim>::Particle(
- Particle<dim, spacedim> &&particle) noexcept :
- location(std::move(particle.location)),
- reference_location(std::move(particle.reference_location)),
- id(std::move(particle.id)),
- property_pool(std::move(particle.property_pool)),
- properties(std::move(particle.properties))
+ Particle<dim, spacedim>::Particle(Particle<dim, spacedim> &&particle) noexcept
+ : location(std::move(particle.location))
+ , reference_location(std::move(particle.reference_location))
+ , id(std::move(particle.id))
+ , property_pool(std::move(particle.property_pool))
+ , properties(std::move(particle.properties))
{
particle.properties = PropertyPool::invalid_handle;
}
"This is not allowed."));
if (old_properties.size() > 0)
- std::copy(
- new_properties.begin(), new_properties.end(), old_properties.begin());
+ std::copy(new_properties.begin(),
+ new_properties.end(),
+ old_properties.begin());
}
namespace Particles
{
template <int dim, int spacedim>
- ParticleAccessor<dim, spacedim>::ParticleAccessor() : map(nullptr), particle()
+ ParticleAccessor<dim, spacedim>::ParticleAccessor()
+ : map(nullptr)
+ , particle()
{}
ParticleAccessor<dim, spacedim>::ParticleAccessor(
const std::multimap<internal::LevelInd, Particle<dim, spacedim>> &map,
const typename std::multimap<internal::LevelInd,
- Particle<dim, spacedim>>::iterator &particle) :
- map(
- const_cast<std::multimap<internal::LevelInd, Particle<dim, spacedim>> *>(
- &map)),
- particle(particle)
+ Particle<dim, spacedim>>::iterator & particle)
+ : map(const_cast<
+ std::multimap<internal::LevelInd, Particle<dim, spacedim>> *>(&map))
+ , particle(particle)
{}
namespace Particles
{
template <int dim, int spacedim>
- ParticleHandler<dim, spacedim>::ParticleHandler() :
- triangulation(),
- particles(),
- ghost_particles(),
- global_number_of_particles(0),
- global_max_particles_per_cell(0),
- next_free_particle_index(0),
- property_pool(new PropertyPool(0)),
- size_callback(),
- store_callback(),
- load_callback(),
- handle(numbers::invalid_unsigned_int)
+ ParticleHandler<dim, spacedim>::ParticleHandler()
+ : triangulation()
+ , particles()
+ , ghost_particles()
+ , global_number_of_particles(0)
+ , global_max_particles_per_cell(0)
+ , next_free_particle_index(0)
+ , property_pool(new PropertyPool(0))
+ , size_callback()
+ , store_callback()
+ , load_callback()
+ , handle(numbers::invalid_unsigned_int)
{}
ParticleHandler<dim, spacedim>::ParticleHandler(
const parallel::distributed::Triangulation<dim, spacedim> &triangulation,
const Mapping<dim, spacedim> & mapping,
- const unsigned int n_properties) :
- triangulation(&triangulation, typeid(*this).name()),
- mapping(&mapping, typeid(*this).name()),
- particles(),
- ghost_particles(),
- global_number_of_particles(0),
- global_max_particles_per_cell(0),
- next_free_particle_index(0),
- property_pool(new PropertyPool(n_properties)),
- size_callback(),
- store_callback(),
- load_callback(),
- handle(numbers::invalid_unsigned_int)
+ const unsigned int n_properties)
+ : triangulation(&triangulation, typeid(*this).name())
+ , mapping(&mapping, typeid(*this).name())
+ , particles()
+ , ghost_particles()
+ , global_number_of_particles(0)
+ , global_max_particles_per_cell(0)
+ , next_free_particle_index(0)
+ , property_pool(new PropertyPool(n_properties))
+ , size_callback()
+ , store_callback()
+ , load_callback()
+ , handle(numbers::invalid_unsigned_int)
{}
std::max(local_max_particles_per_cell, current_particles_per_cell);
}
- global_number_of_particles = dealii::Utilities::MPI::sum(
- particles.size(), triangulation->get_communicator());
+ global_number_of_particles =
+ dealii::Utilities::MPI::sum(particles.size(),
+ triangulation->get_communicator());
next_free_particle_index =
dealii::Utilities::MPI::max(locally_highest_index,
triangulation->get_communicator()) +
1;
- global_max_particles_per_cell = dealii::Utilities::MPI::max(
- local_max_particles_per_cell, triangulation->get_communicator());
+ global_max_particles_per_cell =
+ dealii::Utilities::MPI::max(local_max_particles_per_cell,
+ triangulation->get_communicator());
}
{
typename std::multimap<internal::LevelInd,
Particle<dim, spacedim>>::iterator it =
- particles.insert(std::make_pair(
- internal::LevelInd(cell->level(), cell->index()), particle));
+ particles.insert(
+ std::make_pair(internal::LevelInd(cell->level(), cell->index()),
+ particle));
particle_iterator particle_it(particles, it);
particle_it->set_property_pool(*property_pool);
{
hint = particles.insert(
hint,
- std::make_pair(
- current_cell,
- Particle<dim, spacedim>(positions[index_map[i][p]],
- local_positions[i][p],
- local_start_index + index_map[i][p])));
+ std::make_pair(current_cell,
+ Particle<dim, spacedim>(positions[index_map[i][p]],
+ local_positions[i][p],
+ local_start_index +
+ index_map[i][p])));
}
}
// Create a corresponding map of vectors from vertex to cell center
const std::vector<std::vector<Tensor<1, spacedim>>>
- vertex_to_cell_centers(GridTools::vertex_to_cell_centers_directions(
- *triangulation, vertex_to_cells));
+ vertex_to_cell_centers(
+ GridTools::vertex_to_cell_centers_directions(*triangulation,
+ vertex_to_cells));
std::vector<unsigned int> neighbor_permutation;
for (unsigned int i = 0; i < n_neighbor_cells; ++i)
neighbor_permutation[i] = i;
- std::sort(
- neighbor_permutation.begin(),
- neighbor_permutation.end(),
- std::bind(&compare_particle_association<spacedim>,
- std::placeholders::_1,
- std::placeholders::_2,
- std::cref(vertex_to_particle),
- std::cref(vertex_to_cell_centers[closest_vertex_index])));
+ std::sort(neighbor_permutation.begin(),
+ neighbor_permutation.end(),
+ std::bind(&compare_particle_association<spacedim>,
+ std::placeholders::_1,
+ std::placeholders::_2,
+ std::cref(vertex_to_particle),
+ std::cref(
+ vertex_to_cell_centers[closest_vertex_index])));
// Search all of the cells adjacent to the closest vertex of the
// previous cell Most likely we will find the particle in them.
Particle<dim, spacedim>(recv_data_it, property_pool.get())));
if (load_callback)
- recv_data_it = load_callback(
- particle_iterator(received_particles, recv_particle), recv_data_it);
+ recv_data_it =
+ load_callback(particle_iterator(received_particles, recv_particle),
+ recv_data_it);
}
- AssertThrow(
- recv_data_it == recv_data.data() + recv_data.size(),
- ExcMessage("The amount of data that was read into new particles "
- "does not match the amount of data sent around."));
+ AssertThrow(recv_data_it == recv_data.data() + recv_data.size(),
+ ExcMessage(
+ "The amount of data that was read into new particles "
+ "does not match the amount of data sent around."));
}
# endif
if (global_max_particles_per_cell > 0)
{
- const std::function<void(
- const typename Triangulation<dim, spacedim>::cell_iterator &,
- const typename Triangulation<dim, spacedim>::CellStatus,
- void *)>
+ const std::function<
+ void(const typename Triangulation<dim, spacedim>::cell_iterator &,
+ const typename Triangulation<dim, spacedim>::CellStatus,
+ void *)>
callback_function =
std::bind(&ParticleHandler<dim, spacedim>::store_particles,
std::cref(*this),
(size_per_particle * global_max_particles_per_cell) *
(serialization ? 1 : std::pow(2, dim));
- handle = non_const_triangulation->register_data_attach(
- transfer_size_per_cell, callback_function);
+ handle =
+ non_const_triangulation->register_data_attach(transfer_size_per_cell,
+ callback_function);
}
}
// data correctly. Only do this if something was actually stored.
if (serialization && (global_max_particles_per_cell > 0))
{
- const std::function<void(
- const typename Triangulation<dim, spacedim>::cell_iterator &,
- const typename Triangulation<dim, spacedim>::CellStatus,
- void *)>
+ const std::function<
+ void(const typename Triangulation<dim, spacedim>::cell_iterator &,
+ const typename Triangulation<dim, spacedim>::CellStatus,
+ void *)>
callback_function =
std::bind(&ParticleHandler<dim, spacedim>::store_particles,
std::cref(*this),
const std::size_t transfer_size_per_cell =
sizeof(unsigned int) +
(size_per_particle * global_max_particles_per_cell);
- handle = non_const_triangulation->register_data_attach(
- transfer_size_per_cell, callback_function);
+ handle =
+ non_const_triangulation->register_data_attach(transfer_size_per_cell,
+ callback_function);
}
// Check if something was stored and load it
if (handle != numbers::invalid_unsigned_int)
{
- const std::function<void(
- const typename Triangulation<dim, spacedim>::cell_iterator &,
- const typename Triangulation<dim, spacedim>::CellStatus,
- const void *)>
+ const std::function<
+ void(const typename Triangulation<dim, spacedim>::cell_iterator &,
+ const typename Triangulation<dim, spacedim>::CellStatus,
+ const void *)>
callback_function =
std::bind(&ParticleHandler<dim, spacedim>::load_particles,
std::ref(*this),
# else
position_hint = particles.insert(
position_hint,
- std::make_pair(
- std::make_pair(cell->level(), cell->index()),
- Particle<dim, spacedim>(pdata, property_pool.get())));
+ std::make_pair(std::make_pair(cell->level(), cell->index()),
+ Particle<dim, spacedim>(pdata,
+ property_pool.get())));
# endif
++position_hint;
}
# else
position_hint = particles.insert(
position_hint,
- std::make_pair(
- std::make_pair(cell->level(), cell->index()),
- Particle<dim, spacedim>(pdata, property_pool.get())));
+ std::make_pair(std::make_pair(cell->level(), cell->index()),
+ Particle<dim, spacedim>(pdata,
+ property_pool.get())));
# endif
const Point<dim> p_unit = mapping->transform_real_to_unit_cell(
cell, position_hint->second.get_location());
// compilers that report a -std=c++11 (like gcc 4.6)
// implement it, so require C++14 instead.
# ifdef DEAL_II_WITH_CXX14
- position_hints[child_index] = particles.emplace_hint(
- position_hints[child_index],
- std::make_pair(child->level(), child->index()),
- std::move(p));
+ position_hints[child_index] =
+ particles.emplace_hint(position_hints[child_index],
+ std::make_pair(child->level(),
+ child->index()),
+ std::move(p));
# else
position_hints[child_index] = particles.insert(
position_hints[child_index],
ParticleIterator<dim, spacedim>::ParticleIterator(
const std::multimap<internal::LevelInd, Particle<dim, spacedim>> &map,
const typename std::multimap<internal::LevelInd,
- Particle<dim, spacedim>>::iterator &particle) :
- accessor(map, particle)
+ Particle<dim, spacedim>>::iterator & particle)
+ : accessor(map, particle)
{}
const PropertyPool::Handle PropertyPool::invalid_handle = nullptr;
- PropertyPool::PropertyPool(const unsigned int n_properties_per_slot) :
- n_properties(n_properties_per_slot)
+ PropertyPool::PropertyPool(const unsigned int n_properties_per_slot)
+ : n_properties(n_properties_per_slot)
{}
template <typename VectorType>
ARKode<VectorType>::ARKode(const AdditionalData &data,
- const MPI_Comm mpi_comm) :
- data(data),
- arkode_mem(nullptr),
- yy(nullptr),
- abs_tolls(nullptr),
- communicator(is_serial_vector<VectorType>::value ?
- MPI_COMM_SELF :
- Utilities::MPI::duplicate_communicator(mpi_comm))
+ const MPI_Comm mpi_comm)
+ : data(data)
+ , arkode_mem(nullptr)
+ , yy(nullptr)
+ , abs_tolls(nullptr)
+ , communicator(is_serial_vector<VectorType>::value ?
+ MPI_COMM_SELF :
+ Utilities::MPI::duplicate_communicator(mpi_comm))
{
set_functions_to_trigger_an_assert();
}
}
else
{
- status = ARKodeSStolerances(
- arkode_mem, data.relative_tolerance, data.absolute_tolerance);
+ status = ARKodeSStolerances(arkode_mem,
+ data.relative_tolerance,
+ data.absolute_tolerance);
AssertARKode(status);
}
copy(*src_yy, yy);
copy(*src_yp, yp);
- int err = solver.setup_jacobian(
- IDA_mem->ida_tn, *src_yy, *src_yp, IDA_mem->ida_cj);
+ int err = solver.setup_jacobian(IDA_mem->ida_tn,
+ *src_yy,
+ *src_yp,
+ IDA_mem->ida_cj);
return err;
}
} // namespace
template <typename VectorType>
- IDA<VectorType>::IDA(const AdditionalData &data, const MPI_Comm mpi_comm) :
- data(data),
- ida_mem(nullptr),
- yy(nullptr),
- yp(nullptr),
- abs_tolls(nullptr),
- diff_id(nullptr),
- communicator(is_serial_vector<VectorType>::value ?
- MPI_COMM_SELF :
- Utilities::MPI::duplicate_communicator(mpi_comm))
+ IDA<VectorType>::IDA(const AdditionalData &data, const MPI_Comm mpi_comm)
+ : data(data)
+ , ida_mem(nullptr)
+ , yy(nullptr)
+ , yp(nullptr)
+ , abs_tolls(nullptr)
+ , diff_id(nullptr)
+ , communicator(is_serial_vector<VectorType>::value ?
+ MPI_COMM_SELF :
+ Utilities::MPI::duplicate_communicator(mpi_comm))
{
set_functions_to_trigger_an_assert();
}
}
else
{
- status = IDASStolerances(
- ida_mem, data.relative_tolerance, data.absolute_tolerance);
+ status = IDASStolerances(ida_mem,
+ data.relative_tolerance,
+ data.absolute_tolerance);
AssertIDA(status);
}
template <typename VectorType>
KINSOL<VectorType>::KINSOL(const AdditionalData &data,
- const MPI_Comm mpi_comm) :
- data(data),
- kinsol_mem(nullptr),
- solution(nullptr),
- u_scale(nullptr),
- f_scale(nullptr),
- communicator(is_serial_vector<VectorType>::value ?
- MPI_COMM_SELF :
- Utilities::MPI::duplicate_communicator(mpi_comm))
+ const MPI_Comm mpi_comm)
+ : data(data)
+ , kinsol_mem(nullptr)
+ , solution(nullptr)
+ , u_scale(nullptr)
+ , f_scale(nullptr)
+ , communicator(is_serial_vector<VectorType>::value ?
+ MPI_COMM_SELF :
+ Utilities::MPI::duplicate_communicator(mpi_comm))
{
set_functions_to_trigger_an_assert();
}
SmartPointer<SquareRoot, SquareRootResidual> discretization;
public:
- SquareRootResidual(SquareRoot &problem) : discretization(&problem)
+ SquareRootResidual(SquareRoot &problem)
+ : discretization(&problem)
{}
virtual void
SmartPointer<SquareRoot, SquareRootSolver> solver;
public:
- SquareRootSolver(SquareRoot &problem) : solver(&problem)
+ SquareRootSolver(SquareRoot &problem)
+ : solver(&problem)
{}
virtual void
}
-Explicit::Explicit(const FullMatrix<double> &M) : matrix(&M)
+Explicit::Explicit(const FullMatrix<double> &M)
+ : matrix(&M)
{
m.reinit(M.m(), M.n());
}
}
-Implicit::Implicit(const FullMatrix<double> &M) : matrix(&M)
+Implicit::Implicit(const FullMatrix<double> &M)
+ : matrix(&M)
{
m.reinit(M.m(), M.n());
}
class MyFunction : public Function<dim>
{
public:
- MyFunction() : Function<dim>(){};
+ MyFunction()
+ : Function<dim>(){};
virtual double
value(const Point<dim> &p, const unsigned int) const
template <int dim>
-EigenvalueProblem<dim>::EigenvalueProblem(unsigned int n_eigenvalues) :
- fe(1),
- dof_handler(triangulation),
- n_eigenvalues(n_eigenvalues)
+EigenvalueProblem<dim>::EigenvalueProblem(unsigned int n_eigenvalues)
+ : fe(1)
+ , dof_handler(triangulation)
+ , n_eigenvalues(n_eigenvalues)
{}
cell->get_dof_indices(local_dof_indices);
- constraints.distribute_local_to_global(
- cell_stiffness_matrix, local_dof_indices, stiffness_matrix);
- constraints.distribute_local_to_global(
- cell_mass_matrix, local_dof_indices, mass_matrix);
+ constraints.distribute_local_to_global(cell_stiffness_matrix,
+ local_dof_indices,
+ stiffness_matrix);
+ constraints.distribute_local_to_global(cell_mass_matrix,
+ local_dof_indices,
+ mass_matrix);
}
stiffness_matrix.compress(VectorOperation::add);
public:
PETScInverse(const dealii::PETScWrappers::MatrixBase &A,
dealii::SolverControl & cn,
- const MPI_Comm &mpi_communicator = PETSC_COMM_SELF) :
- solver(cn, mpi_communicator),
- matrix(A),
- preconditioner(matrix)
+ const MPI_Comm &mpi_communicator = PETSC_COMM_SELF)
+ : solver(cn, mpi_communicator)
+ , matrix(A)
+ , preconditioner(matrix)
{}
void
for (unsigned int i = 0; i < n_mpi_processes; i++)
n_locally_owned_dofs[i] = locally_owned_dofs_per_processor[i].n_elements();
- dealii::SparsityTools::distribute_sparsity_pattern(
- csp, n_locally_owned_dofs, mpi_communicator, locally_relevant_dofs);
+ dealii::SparsityTools::distribute_sparsity_pattern(csp,
+ n_locally_owned_dofs,
+ mpi_communicator,
+ locally_relevant_dofs);
// Initialise the stiffness and mass matrices
- stiffness_matrix.reinit(
- locally_owned_dofs, locally_owned_dofs, csp, mpi_communicator);
+ stiffness_matrix.reinit(locally_owned_dofs,
+ locally_owned_dofs,
+ csp,
+ mpi_communicator);
- mass_matrix.reinit(
- locally_owned_dofs, locally_owned_dofs, csp, mpi_communicator);
+ mass_matrix.reinit(locally_owned_dofs,
+ locally_owned_dofs,
+ csp,
+ mpi_communicator);
eigenvalues.resize(number_of_eigenvalues);
mass_matrix = 0;
dealii::QGauss<dim> quadrature_formula(2);
- dealii::FEValues<dim> fe_values(
- fe,
- quadrature_formula,
- dealii::update_values | dealii::update_gradients |
- dealii::update_quadrature_points | dealii::update_JxW_values);
+ dealii::FEValues<dim> fe_values(fe,
+ quadrature_formula,
+ dealii::update_values |
+ dealii::update_gradients |
+ dealii::update_quadrature_points |
+ dealii::update_JxW_values);
const unsigned int dofs_per_cell = fe.dofs_per_cell;
const unsigned int n_q_points = quadrature_formula.size();
cell->get_dof_indices(local_dof_indices);
- constraints.distribute_local_to_global(
- cell_stiffness_matrix, local_dof_indices, stiffness_matrix);
- constraints.distribute_local_to_global(
- cell_mass_matrix, local_dof_indices, mass_matrix);
+ constraints.distribute_local_to_global(cell_stiffness_matrix,
+ local_dof_indices,
+ stiffness_matrix);
+ constraints.distribute_local_to_global(cell_mass_matrix,
+ local_dof_indices,
+ mass_matrix);
}
}
try
{
- dealii::Utilities::MPI::MPI_InitFinalize mpi_initialization(
- argc, argv, 1);
+ dealii::Utilities::MPI::MPI_InitFinalize mpi_initialization(argc,
+ argv,
+ 1);
{
test();
}
constraints.clear();
constraints.reinit(locally_relevant_dofs);
DoFTools::make_hanging_node_constraints(dof_handler, constraints);
- VectorTools::interpolate_boundary_values(
- dof_handler, 0, Functions::ZeroFunction<dim>(), constraints);
+ VectorTools::interpolate_boundary_values(dof_handler,
+ 0,
+ Functions::ZeroFunction<dim>(),
+ constraints);
constraints.close();
DynamicSparsityPattern csp(locally_relevant_dofs);
for (unsigned int i = 0; i < n_mpi_processes; i++)
n_locally_owned_dofs[i] = locally_owned_dofs_per_processor[i].n_elements();
- SparsityTools::distribute_sparsity_pattern(
- csp, n_locally_owned_dofs, mpi_communicator, locally_relevant_dofs);
+ SparsityTools::distribute_sparsity_pattern(csp,
+ n_locally_owned_dofs,
+ mpi_communicator,
+ locally_relevant_dofs);
// Initialise the stiffness and mass matrices
- stiffness_matrix.reinit(
- locally_owned_dofs, locally_owned_dofs, csp, mpi_communicator);
+ stiffness_matrix.reinit(locally_owned_dofs,
+ locally_owned_dofs,
+ csp,
+ mpi_communicator);
- mass_matrix.reinit(
- locally_owned_dofs, locally_owned_dofs, csp, mpi_communicator);
+ mass_matrix.reinit(locally_owned_dofs,
+ locally_owned_dofs,
+ csp,
+ mpi_communicator);
eigenvalues.resize(number_of_eigenvalues);
cell->get_dof_indices(local_dof_indices);
- constraints.distribute_local_to_global(
- cell_stiffness_matrix, local_dof_indices, stiffness_matrix);
- constraints.distribute_local_to_global(
- cell_mass_matrix, local_dof_indices, mass_matrix);
+ constraints.distribute_local_to_global(cell_stiffness_matrix,
+ local_dof_indices,
+ stiffness_matrix);
+ constraints.distribute_local_to_global(cell_mass_matrix,
+ local_dof_indices,
+ mass_matrix);
}
}
PArpackSolver<TrilinosWrappers::MPI::Vector>::largest_real_part,
false);
- SolverControl solver_control(
- dof_handler.n_dofs(), 1e-9, /*log_history*/ false, /*log_results*/ false);
+ SolverControl solver_control(dof_handler.n_dofs(),
+ 1e-9,
+ /*log_history*/ false,
+ /*log_results*/ false);
- PArpackSolver<TrilinosWrappers::MPI::Vector> eigensolver(
- solver_control, mpi_communicator, additional_data);
+ PArpackSolver<TrilinosWrappers::MPI::Vector> eigensolver(solver_control,
+ mpi_communicator,
+ additional_data);
eigensolver.reinit(locally_owned_dofs);
eigensolver.set_shift(shift);
arpack_vectors[0] = 1.;
template <int dim>
- EigenvalueProblem<dim>::EigenvalueProblem(const std::string &prm_file) :
- fe(1),
- dof_handler(triangulation)
+ EigenvalueProblem<dim>::EigenvalueProblem(const std::string &prm_file)
+ : fe(1)
+ , dof_handler(triangulation)
{}
cell->get_dof_indices(local_dof_indices);
- constraints.distribute_local_to_global(
- cell_stiffness_matrix, local_dof_indices, stiffness_matrix);
- constraints.distribute_local_to_global(
- cell_mass_matrix, local_dof_indices, mass_matrix);
+ constraints.distribute_local_to_global(cell_stiffness_matrix,
+ local_dof_indices,
+ stiffness_matrix);
+ constraints.distribute_local_to_global(cell_mass_matrix,
+ local_dof_indices,
+ mass_matrix);
}
stiffness_matrix.compress(VectorOperation::add);
template <int dim>
- EigenvalueProblem<dim>::EigenvalueProblem(const std::string &prm_file) :
- fe(1),
- dof_handler(triangulation)
+ EigenvalueProblem<dim>::EigenvalueProblem(const std::string &prm_file)
+ : fe(1)
+ , dof_handler(triangulation)
{}
cell->get_dof_indices(local_dof_indices);
- constraints.distribute_local_to_global(
- cell_stiffness_matrix, local_dof_indices, stiffness_matrix);
- constraints.distribute_local_to_global(
- cell_mass_matrix, local_dof_indices, mass_matrix);
+ constraints.distribute_local_to_global(cell_stiffness_matrix,
+ local_dof_indices,
+ stiffness_matrix);
+ constraints.distribute_local_to_global(cell_mass_matrix,
+ local_dof_indices,
+ mass_matrix);
}
stiffness_matrix.compress(VectorOperation::add);
public:
PETScInverse(const dealii::PETScWrappers::MatrixBase &A,
dealii::SolverControl & cn,
- const MPI_Comm &mpi_communicator = PETSC_COMM_SELF) :
- solver(cn, mpi_communicator),
- matrix(A),
- preconditioner(matrix)
+ const MPI_Comm &mpi_communicator = PETSC_COMM_SELF)
+ : solver(cn, mpi_communicator)
+ , matrix(A)
+ , preconditioner(matrix)
{}
void
for (unsigned int i = 0; i < n_mpi_processes; i++)
n_locally_owned_dofs[i] = locally_owned_dofs_per_processor[i].n_elements();
- dealii::SparsityTools::distribute_sparsity_pattern(
- csp, n_locally_owned_dofs, mpi_communicator, locally_relevant_dofs);
+ dealii::SparsityTools::distribute_sparsity_pattern(csp,
+ n_locally_owned_dofs,
+ mpi_communicator,
+ locally_relevant_dofs);
// Initialise the stiffness and mass matrices
- stiffness_matrix.reinit(
- locally_owned_dofs, locally_owned_dofs, csp, mpi_communicator);
+ stiffness_matrix.reinit(locally_owned_dofs,
+ locally_owned_dofs,
+ csp,
+ mpi_communicator);
- mass_matrix.reinit(
- locally_owned_dofs, locally_owned_dofs, csp, mpi_communicator);
+ mass_matrix.reinit(locally_owned_dofs,
+ locally_owned_dofs,
+ csp,
+ mpi_communicator);
eigenfunctions.resize(5);
for (unsigned int i = 0; i < eigenfunctions.size(); ++i)
mass_matrix = 0;
dealii::QGauss<dim> quadrature_formula(2);
- dealii::FEValues<dim> fe_values(
- fe,
- quadrature_formula,
- dealii::update_values | dealii::update_gradients |
- dealii::update_quadrature_points | dealii::update_JxW_values);
+ dealii::FEValues<dim> fe_values(fe,
+ quadrature_formula,
+ dealii::update_values |
+ dealii::update_gradients |
+ dealii::update_quadrature_points |
+ dealii::update_JxW_values);
const unsigned int dofs_per_cell = fe.dofs_per_cell;
const unsigned int n_q_points = quadrature_formula.size();
cell->get_dof_indices(local_dof_indices);
- constraints.distribute_local_to_global(
- cell_stiffness_matrix, local_dof_indices, stiffness_matrix);
- constraints.distribute_local_to_global(
- cell_mass_matrix, local_dof_indices, mass_matrix);
+ constraints.distribute_local_to_global(cell_stiffness_matrix,
+ local_dof_indices,
+ stiffness_matrix);
+ constraints.distribute_local_to_global(cell_mass_matrix,
+ local_dof_indices,
+ mass_matrix);
}
stiffness_matrix.compress(dealii::VectorOperation::add);
for (unsigned int i = 0; i < eigenvalues.size(); i++)
eigenfunctions[i] = PetscScalar();
- dealii::SolverControl solver_control(
- dof_handler.n_dofs(), 1e-9, /*log_history*/ false, /*log_results*/ false);
+ dealii::SolverControl solver_control(dof_handler.n_dofs(),
+ 1e-9,
+ /*log_history*/ false,
+ /*log_results*/ false);
PETScInverse inverse(stiffness_matrix, solver_control, mpi_communicator);
const unsigned int num_arnoldi_vectors = 2 * eigenvalues.size() + 2;
try
{
- dealii::Utilities::MPI::MPI_InitFinalize mpi_initialization(
- argc, argv, 1);
+ dealii::Utilities::MPI::MPI_InitFinalize mpi_initialization(argc,
+ argv,
+ 1);
{
test();
}
ConstraintMatrix constraints;
constraints.reinit(locally_relevant_dofs);
DoFTools::make_hanging_node_constraints(dof_handler, constraints);
- VectorTools::interpolate_boundary_values(
- dof_handler, 0, Functions::ZeroFunction<dim>(), constraints);
+ VectorTools::interpolate_boundary_values(dof_handler,
+ 0,
+ Functions::ZeroFunction<dim>(),
+ constraints);
constraints.close();
std::shared_ptr<MatrixFree<dim, double>> mf_data(
typedef LinearAlgebra::distributed::Vector<double> VectorType;
SolverCG<VectorType> solver_c(inner_control_c);
PreconditionIdentity preconditioner;
- const auto shift_and_invert = inverse_operator(
- linear_operator<VectorType>(laplace), solver_c, preconditioner);
+ const auto shift_and_invert =
+ inverse_operator(linear_operator<VectorType>(laplace),
+ solver_c,
+ preconditioner);
const unsigned int num_arnoldi_vectors = 2 * eigenvalues.size() + 2;
PArpackSolver<LinearAlgebra::distributed::Vector<double>>::AdditionalData
- additional_data(
- num_arnoldi_vectors,
- PArpackSolver<
- LinearAlgebra::distributed::Vector<double>>::largest_magnitude,
- true);
-
- SolverControl solver_control(
- dof_handler.n_dofs(), 1e-9, /*log_history*/ false, /*log_results*/ false);
+ additional_data(num_arnoldi_vectors,
+ PArpackSolver<LinearAlgebra::distributed::Vector<double>>::
+ largest_magnitude,
+ true);
+
+ SolverControl solver_control(dof_handler.n_dofs(),
+ 1e-9,
+ /*log_history*/ false,
+ /*log_results*/ false);
PArpackSolver<LinearAlgebra::distributed::Vector<double>> eigensolver(
solver_control, mpi_communicator, additional_data);
ConstraintMatrix constraints;
constraints.reinit(locally_relevant_dofs);
DoFTools::make_hanging_node_constraints(dof_handler, constraints);
- VectorTools::interpolate_boundary_values(
- dof_handler, 0, Functions::ZeroFunction<dim>(), constraints);
+ VectorTools::interpolate_boundary_values(dof_handler,
+ 0,
+ Functions::ZeroFunction<dim>(),
+ constraints);
constraints.close();
std::shared_ptr<MatrixFree<dim, double>> mf_data(
typedef LinearAlgebra::distributed::Vector<double> VectorType;
SolverCG<VectorType> solver_c(inner_control_c);
PreconditionIdentity preconditioner;
- const auto invert = inverse_operator(
- linear_operator<VectorType>(mass), solver_c, preconditioner);
+ const auto invert = inverse_operator(linear_operator<VectorType>(mass),
+ solver_c,
+ preconditioner);
const unsigned int num_arnoldi_vectors = 2 * eigenvalues.size() + 40;
PArpackSolver<LinearAlgebra::distributed::Vector<double>>::AdditionalData
- additional_data(
- num_arnoldi_vectors,
- PArpackSolver<
- LinearAlgebra::distributed::Vector<double>>::largest_magnitude,
- true,
- 2);
+ additional_data(num_arnoldi_vectors,
+ PArpackSolver<LinearAlgebra::distributed::Vector<double>>::
+ largest_magnitude,
+ true,
+ 2);
SolverControl solver_control(dof_handler.n_dofs(),
1e-10,
for (unsigned int j = 0; j < eigenfunctions.size(); j++)
{
const double err = std::abs(eigenfunctions[j] * Bx - (i == j));
- Assert(
- err < precision,
- ExcMessage("Eigenvectors " + Utilities::int_to_string(i) +
- " and " + Utilities::int_to_string(j) +
- " are not orthonormal: " + std::to_string(err)));
+ Assert(err < precision,
+ ExcMessage(
+ "Eigenvectors " + Utilities::int_to_string(i) + " and " +
+ Utilities::int_to_string(j) +
+ " are not orthonormal: " + std::to_string(err)));
}
laplace.vmult(Ax, eigenfunctions[i]);
ConstraintMatrix constraints;
constraints.reinit(locally_relevant_dofs);
DoFTools::make_hanging_node_constraints(dof_handler, constraints);
- VectorTools::interpolate_boundary_values(
- dof_handler, 0, Functions::ZeroFunction<dim>(), constraints);
+ VectorTools::interpolate_boundary_values(dof_handler,
+ 0,
+ Functions::ZeroFunction<dim>(),
+ constraints);
constraints.close();
std::shared_ptr<MatrixFree<dim, double>> mf_data(
typedef LinearAlgebra::distributed::Vector<double> VectorType;
SolverCG<VectorType> solver_c(inner_control_c);
PreconditionIdentity preconditioner;
- const auto invert = inverse_operator(
- linear_operator<VectorType>(mass), solver_c, preconditioner);
+ const auto invert = inverse_operator(linear_operator<VectorType>(mass),
+ solver_c,
+ preconditioner);
const unsigned int num_arnoldi_vectors = 2 * eigenvalues.size() + 10;
PArpackSolver<LinearAlgebra::distributed::Vector<double>>::AdditionalData
- additional_data(
- num_arnoldi_vectors,
- PArpackSolver<
- LinearAlgebra::distributed::Vector<double>>::largest_magnitude,
- true,
- 1);
+ additional_data(num_arnoldi_vectors,
+ PArpackSolver<LinearAlgebra::distributed::Vector<double>>::
+ largest_magnitude,
+ true,
+ 1);
- SolverControl solver_control(
- dof_handler.n_dofs(), 1e-9, /*log_history*/ false, /*log_results*/ false);
+ SolverControl solver_control(dof_handler.n_dofs(),
+ 1e-9,
+ /*log_history*/ false,
+ /*log_results*/ false);
PArpackSolver<LinearAlgebra::distributed::Vector<double>> eigensolver(
solver_control, mpi_communicator, additional_data);
{
const double err =
std::abs(eigenfunctions[j] * eigenfunctions[i] - (i == j));
- Assert(
- err < precision,
- ExcMessage("Eigenvectors " + Utilities::int_to_string(i) +
- " and " + Utilities::int_to_string(j) +
- " are not orthonormal: " + std::to_string(err)));
+ Assert(err < precision,
+ ExcMessage(
+ "Eigenvectors " + Utilities::int_to_string(i) + " and " +
+ Utilities::int_to_string(j) +
+ " are not orthonormal: " + std::to_string(err)));
}
laplace.vmult(Ax, eigenfunctions[i]);
constraints.clear();
constraints.reinit(locally_relevant_dofs);
DoFTools::make_hanging_node_constraints(dof_handler, constraints);
- VectorTools::interpolate_boundary_values(
- dof_handler, 0, Functions::ZeroFunction<dim>(), constraints);
+ VectorTools::interpolate_boundary_values(dof_handler,
+ 0,
+ Functions::ZeroFunction<dim>(),
+ constraints);
constraints.close();
DynamicSparsityPattern csp(locally_relevant_dofs);
for (unsigned int i = 0; i < n_mpi_processes; i++)
n_locally_owned_dofs[i] = locally_owned_dofs_per_processor[i].n_elements();
- SparsityTools::distribute_sparsity_pattern(
- csp, n_locally_owned_dofs, mpi_communicator, locally_relevant_dofs);
+ SparsityTools::distribute_sparsity_pattern(csp,
+ n_locally_owned_dofs,
+ mpi_communicator,
+ locally_relevant_dofs);
// Initialise the stiffness and mass matrices
- stiffness_matrix.reinit(
- locally_owned_dofs, locally_owned_dofs, csp, mpi_communicator);
+ stiffness_matrix.reinit(locally_owned_dofs,
+ locally_owned_dofs,
+ csp,
+ mpi_communicator);
- mass_matrix.reinit(
- locally_owned_dofs, locally_owned_dofs, csp, mpi_communicator);
+ mass_matrix.reinit(locally_owned_dofs,
+ locally_owned_dofs,
+ csp,
+ mpi_communicator);
eigenfunctions.resize(5);
for (unsigned int i = 0; i < eigenfunctions.size(); ++i)
cell->get_dof_indices(local_dof_indices);
- constraints.distribute_local_to_global(
- cell_stiffness_matrix, local_dof_indices, stiffness_matrix);
- constraints.distribute_local_to_global(
- cell_mass_matrix, local_dof_indices, mass_matrix);
+ constraints.distribute_local_to_global(cell_stiffness_matrix,
+ local_dof_indices,
+ stiffness_matrix);
+ constraints.distribute_local_to_global(cell_mass_matrix,
+ local_dof_indices,
+ mass_matrix);
}
stiffness_matrix.compress(VectorOperation::add);
PArpackSolver<TrilinosWrappers::MPI::Vector>::largest_magnitude,
true);
- SolverControl solver_control(
- dof_handler.n_dofs(), 1e-9, /*log_history*/ false, /*log_results*/ false);
+ SolverControl solver_control(dof_handler.n_dofs(),
+ 1e-9,
+ /*log_history*/ false,
+ /*log_results*/ false);
- PArpackSolver<TrilinosWrappers::MPI::Vector> eigensolver(
- solver_control, mpi_communicator, additional_data);
+ PArpackSolver<TrilinosWrappers::MPI::Vector> eigensolver(solver_control,
+ mpi_communicator,
+ additional_data);
eigensolver.reinit(locally_owned_dofs);
eigensolver.set_shift(shift);
eigenfunctions[0] = 1.;
class Function : public FunctionBase
{
public:
- Function() : size_(2)
+ Function()
+ : size_(2)
{
deallog << "Construct object" << std::endl;
}
- Function(const Function &f) : size_(f.size_), vec(f.vec)
+ Function(const Function &f)
+ : size_(f.size_)
+ , vec(f.vec)
{
deallog << "Copy construct object" << std::endl;
}
class foo
{
public:
- foo(const unsigned int a) : vec(1, a)
+ foo(const unsigned int a)
+ : vec(1, a)
{}
- foo(const foo &bar) : vec(bar.vec)
+ foo(const foo &bar)
+ : vec(bar.vec)
{}
foo &
operator=(const foo &bar)
template <int dim>
-AutoSinExp<dim>::AutoSinExp() : AutoDerivativeFunction<dim>(1e-6, 2)
+AutoSinExp<dim>::AutoSinExp()
+ : AutoDerivativeFunction<dim>(1e-6, 2)
{}
class MyFunction : public Function<dim>
{
public:
- MyFunction() : Function<dim>(1)
+ MyFunction()
+ : Function<dim>(1)
{}
double
class MyFunction : public Function<dim>
{
public:
- MyFunction() : Function<dim>(1)
+ MyFunction()
+ : Function<dim>(1)
{}
double
class MyQData
{
public:
- MyQData() : value(default_value){};
+ MyQData()
+ : value(default_value){};
virtual ~MyQData(){};
double value;
table_2.add_value("key", i);
}
- table.evaluate_convergence_rates(
- "error", "key", ConvergenceTable::reduction_rate);
- table_2.evaluate_convergence_rates(
- "error", "key", ConvergenceTable::reduction_rate_log2);
+ table.evaluate_convergence_rates("error",
+ "key",
+ ConvergenceTable::reduction_rate);
+ table_2.evaluate_convergence_rates("error",
+ "key",
+ ConvergenceTable::reduction_rate_log2);
// output
table.write_text(deallog.get_file_stream());
table_1.add_value("n_cells", 128);
table_1.add_value("error", 9.597e-07);
table_1.set_scientific("error", true);
- table_1.evaluate_convergence_rates(
- "error", "n_cells", ConvergenceTable::reduction_rate);
- table_1.evaluate_convergence_rates(
- "error", "n_cells", ConvergenceTable::reduction_rate_log2, 1);
+ table_1.evaluate_convergence_rates("error",
+ "n_cells",
+ ConvergenceTable::reduction_rate);
+ table_1.evaluate_convergence_rates("error",
+ "n_cells",
+ ConvergenceTable::reduction_rate_log2,
+ 1);
table_1.write_text(deallog.get_file_stream());
deallog << std::endl << "Testing 2d data" << std::endl;
table_2.add_value("n_cells", 4096);
table_2.add_value("error", 1.587e-05);
table_2.set_scientific("error", true);
- table_2.evaluate_convergence_rates(
- "error", "n_cells", ConvergenceTable::reduction_rate);
- table_2.evaluate_convergence_rates(
- "error", "n_cells", ConvergenceTable::reduction_rate_log2, 2);
+ table_2.evaluate_convergence_rates("error",
+ "n_cells",
+ ConvergenceTable::reduction_rate);
+ table_2.evaluate_convergence_rates("error",
+ "n_cells",
+ ConvergenceTable::reduction_rate_log2,
+ 2);
table_2.write_text(deallog.get_file_stream());
deallog << std::endl << "Testing 3d data" << std::endl;
table_3.add_value("n_cells", 262144);
table_3.add_value("error", 9.275e-04);
table_3.set_scientific("error", true);
- table_3.evaluate_convergence_rates(
- "error", "n_cells", ConvergenceTable::reduction_rate);
- table_3.evaluate_convergence_rates(
- "error", "n_cells", ConvergenceTable::reduction_rate_log2, 3);
+ table_3.evaluate_convergence_rates("error",
+ "n_cells",
+ ConvergenceTable::reduction_rate);
+ table_3.evaluate_convergence_rates("error",
+ "n_cells",
+ ConvergenceTable::reduction_rate_log2,
+ 3);
table_3.write_text(deallog.get_file_stream());
}
t.add_value("error", 0.1);
t.add_value("cells", t2);
t.add_value("error", 0.025);
- t.evaluate_convergence_rates(
- "error", "cells", ConvergenceTable::reduction_rate_log2, 2);
+ t.evaluate_convergence_rates("error",
+ "cells",
+ ConvergenceTable::reduction_rate_log2,
+ 2);
t.write_text(deallog.get_file_stream());
}
AssertThrow(t == transpose(t), ExcInternalError());
// check norm of tensor
- AssertThrow(
- std::fabs(t.norm() - std::sqrt(1. * 1 + 2 * 2 + 3 * 3 + 2 * 4 * 4 +
- 2 * 5 * 5 + 2 * 6 * 6)) < 1e-14,
- ExcInternalError());
+ AssertThrow(std::fabs(t.norm() -
+ std::sqrt(1. * 1 + 2 * 2 + 3 * 3 + 2 * 4 * 4 +
+ 2 * 5 * 5 + 2 * 6 * 6)) < 1e-14,
+ ExcInternalError());
deallog << "OK" << std::endl;
}
// initialized with units
FunctionParser<2> fp;
function[0] = "x * cm + y * m + PI";
- fp.initialize(
- FunctionParser<2>::default_variable_names(), function, constants);
+ fp.initialize(FunctionParser<2>::default_variable_names(),
+ function,
+ constants);
deallog << "Function "
<< "[" << function[0] << "]"
// that's a string, not vector of
// strings
FunctionParser<2> fp4;
- fp4.initialize(
- FunctionParser<2>::default_variable_names(), function[0], constants);
+ fp4.initialize(FunctionParser<2>::default_variable_names(),
+ function[0],
+ constants);
deallog << "Function "
<< "[" << function[0] << "]"
// compatibility
FunctionParser<2> fp2;
function[0] = "x + y + PI";
- fp2.initialize(
- FunctionParser<2>::default_variable_names(), function, constants);
+ fp2.initialize(FunctionParser<2>::default_variable_names(),
+ function,
+ constants);
deallog << "Function "
<< "[" << function[0] << "]"
<< " @point "
// same as above but the function is
// a string, not a vector
FunctionParser<2> fp3;
- fp3.initialize(
- FunctionParser<2>::default_variable_names(), function[0], constants);
+ fp3.initialize(FunctionParser<2>::default_variable_names(),
+ function[0],
+ constants);
deallog << "Function "
<< "[" << function[0] << "]"
struct copy_data
{
int value;
- copy_data() : value(0)
+ copy_data()
+ : value(0)
{}
};
template <int dim>
DerivativeTestFunction<dim>::DerivativeTestFunction(const Function<dim> &f,
- const double h) :
- AutoDerivativeFunction<dim>(h, f.n_components),
- func(f)
+ const double h)
+ : AutoDerivativeFunction<dim>(h, f.n_components)
+ , func(f)
{
this->set_formula(AutoDerivativeFunction<dim>::FourthOrder);
}
object.vector_value(p, v);
for (unsigned int c = 0; c < dim + 2; ++c)
if (c == 0 || c == dim + 1)
- AssertThrow(v(c) == 0, ExcInternalError()) else AssertThrow(
- v(c) == p[c - 1], ExcInternalError());
+ AssertThrow(v(c) == 0,
+ ExcInternalError()) else AssertThrow(v(c) == p[c - 1],
+ ExcInternalError());
}
deallog << "OK" << std::endl;
Table<3, double>
fill(const std::array<std::vector<double>, 3> &coordinates)
{
- Table<3, double> data(
- coordinates[0].size(), coordinates[1].size(), coordinates[2].size());
+ Table<3, double> data(coordinates[0].size(),
+ coordinates[1].size(),
+ coordinates[2].size());
for (unsigned int i = 0; i < coordinates[0].size(); ++i)
for (unsigned int j = 0; j < coordinates[1].size(); ++j)
for (unsigned int k = 0; k < coordinates[2].size(); ++k)
Table<3, double>
fill(const std::array<std::vector<double>, 3> &coordinates)
{
- Table<3, double> data(
- coordinates[0].size(), coordinates[1].size(), coordinates[2].size());
+ Table<3, double> data(coordinates[0].size(),
+ coordinates[1].size(),
+ coordinates[2].size());
for (unsigned int i = 0; i < coordinates[0].size(); ++i)
for (unsigned int j = 0; j < coordinates[1].size(); ++j)
for (unsigned int k = 0; k < coordinates[2].size(); ++k)
const Table<dim, double> data = fill(coordinates);
- Functions::InterpolatedUniformGridData<dim> f(
- intervals, n_subintervals, data);
+ Functions::InterpolatedUniformGridData<dim> f(intervals,
+ n_subintervals,
+ data);
// now choose a number of randomly chosen points inside the box and
// verify that the functions returned are correct
TESTEE<dim> constant_vector_function(
component_data[2 /*of MAX_N_COMPONENT*/], n_component);
- test_one_object<dim, Number>(
- constant_vector_function, n_points, n_component);
+ test_one_object<dim, Number>(constant_vector_function,
+ n_points,
+ n_component);
}
// Construct with std::vector<>
// Close file to let Test use it.
TESTEE<dim> constant_vector_function(v);
- test_one_object<dim, Number>(
- constant_vector_function, n_points, n_component);
+ test_one_object<dim, Number>(constant_vector_function,
+ n_points,
+ n_component);
}
// Construct with Vector
// Close file to let Test use it.
TESTEE<dim> constant_vector_function(v);
- test_one_object<dim, Number>(
- constant_vector_function, n_points, n_component);
+ test_one_object<dim, Number>(constant_vector_function,
+ n_points,
+ n_component);
}
// Construct with pointer and offset
// Close file to let Test use it.
TESTEE<dim> constant_vector_function(&component_data[0], n_component);
- test_one_object<dim, Number>(
- constant_vector_function, n_points, n_component);
+ test_one_object<dim, Number>(constant_vector_function,
+ n_points,
+ n_component);
}
return;
class ExpFunc : public Function<dim>
{
public:
- ExpFunc(const Point<dim> &origin, const double &Z) :
- Function<dim>(1),
- origin(origin),
- Z(Z)
+ ExpFunc(const Point<dim> &origin, const double &Z)
+ : Function<dim>(1)
+ , origin(origin)
+ , Z(Z)
{}
virtual double
class ExpFunc2 : public Functions::Spherical<dim>
{
public:
- ExpFunc2(const Point<dim> &origin, const double &Z) :
- Functions::Spherical<dim>(origin),
- Z(Z)
+ ExpFunc2(const Point<dim> &origin, const double &Z)
+ : Functions::Spherical<dim>(origin)
+ , Z(Z)
{}
private:
class RefFunc : public Function<dim>
{
public:
- RefFunc(const Point<dim> origin = Point<dim>()) :
- Function<dim>(1),
- origin(origin)
+ RefFunc(const Point<dim> origin = Point<dim>())
+ : Function<dim>(1)
+ , origin(origin)
{}
virtual double
class SphFunc : public Functions::Spherical<dim>
{
public:
- SphFunc(const Point<dim> origin = Point<dim>()) :
- Functions::Spherical<dim>(origin)
+ SphFunc(const Point<dim> origin = Point<dim>())
+ : Functions::Spherical<dim>(origin)
{}
private:
for (unsigned int i = 0; i < merged.size(); ++i)
{
- Assert(
- merged.is_element(i) ==
- (a.is_element(i) || (i >= offset && other.is_element(i - offset))),
- ExcInternalError());
+ Assert(merged.is_element(i) ==
+ (a.is_element(i) ||
+ (i >= offset && other.is_element(i - offset))),
+ ExcInternalError());
}
}
{
deallog << index_set.nth_index_in_set(i) << std::endl;
- AssertThrow(
- index_set.index_within_set(index_set.nth_index_in_set(i) == i),
- ExcInternalError());
+ AssertThrow(index_set.index_within_set(index_set.nth_index_in_set(i) ==
+ i),
+ ExcInternalError());
}
deallog << "OK" << std::endl;
{
deallog << index_set.nth_index_in_set(i) << std::endl;
- AssertThrow(
- index_set.index_within_set(index_set.nth_index_in_set(i) == i),
- ExcInternalError());
+ AssertThrow(index_set.index_within_set(index_set.nth_index_in_set(i) ==
+ i),
+ ExcInternalError());
}
deallog << "OK" << std::endl;
deallog << static_cast<typename numbers::NumberTraits<T>::real_type>(1)
<< " --> ";
- deallog << is_finite(T(
- static_cast<typename numbers::NumberTraits<T>::real_type>(1), 0))
+ deallog << is_finite(
+ T(static_cast<typename numbers::NumberTraits<T>::real_type>(1),
+ 0))
<< ' ';
- deallog << is_finite(T(
- 0, static_cast<typename numbers::NumberTraits<T>::real_type>(1)))
+ deallog << is_finite(
+ T(0,
+ static_cast<typename numbers::NumberTraits<T>::real_type>(1)))
<< std::endl;
deallog << static_cast<typename numbers::NumberTraits<T>::real_type>(-1)
// set a=x+y-z, which happens to be
// zero
- parallel::transform(
- x.begin(),
- x.end(),
- y.begin(),
- z.begin(),
- a.begin(),
- (boost::lambda::_1 + boost::lambda::_2 - boost::lambda::_3),
- 10);
+ parallel::transform(x.begin(),
+ x.end(),
+ y.begin(),
+ z.begin(),
+ a.begin(),
+ (boost::lambda::_1 + boost::lambda::_2 -
+ boost::lambda::_3),
+ 10);
AssertThrow(a.l2_norm() == 0, ExcInternalError());
<< " ) " << std::setw(22) << std::setprecision(16)
<< 0.5 + 0.5 * roots_reference[i]
<< " (fval = " << std::setw(9) << std::setprecision(3)
- << jacobi_polynomial_value(
- degree, alpha, beta, 0.5 + 0.5 * roots_reference[i])
+ << jacobi_polynomial_value(degree,
+ alpha,
+ beta,
+ 0.5 + 0.5 * roots_reference[i])
<< " )" << std::endl;
deallog << std::endl;
}
<< " ) " << std::setw(22) << std::setprecision(19)
<< 0.5 + 0.5 * roots_reference[i]
<< " (fval = " << std::setw(9) << std::setprecision(3)
- << jacobi_polynomial_value(
- degree, alpha, beta, 0.5 + 0.5 * roots_reference[i])
+ << jacobi_polynomial_value(degree,
+ alpha,
+ beta,
+ 0.5 + 0.5 * roots_reference[i])
<< " )" << std::endl;
deallog << std::endl;
}
<< std::endl;
check<std::complex<double>, std::complex<double>, std::complex<double>>();
- deallog << (ProductType<std::complex<double>, std::complex<double>>::type(
- 2.345, 1.23) *
- ProductType<std::complex<double>, std::complex<double>>::type(
- 3.456, 2.45))
- << ' '
- << (ProductType<std::complex<double>, std::complex<double>>::type(
- std::complex<double>(2.345, 1.23) *
- std::complex<double>(3.456, 2.45)))
- << std::endl;
+ deallog
+ << (ProductType<std::complex<double>, std::complex<double>>::type(2.345,
+ 1.23) *
+ ProductType<std::complex<double>, std::complex<double>>::type(3.456,
+ 2.45))
+ << ' '
+ << (ProductType<std::complex<double>, std::complex<double>>::type(
+ std::complex<double>(2.345, 1.23) * std::complex<double>(3.456, 2.45)))
+ << std::endl;
deallog << "OK" << std::endl;
}
{
std::cout << q_points[q] << " " << q_basis[0].get_points()[q]
<< std::endl;
- AssertThrow(
- std::abs((q_points[q] - q_basis[0].get_points()[q]).norm()) <
- 1.e-10,
- ExcInternalError());
+ AssertThrow(std::abs(
+ (q_points[q] - q_basis[0].get_points()[q]).norm()) <
+ 1.e-10,
+ ExcInternalError());
AssertThrow(std::abs(q_weights[q] - q_basis[0].get_weights()[q]) <
1.e-10,
ExcInternalError());
class MyFunction : public Function<dim>
{
public:
- MyFunction() : Function<dim>(1)
+ MyFunction()
+ : Function<dim>(1)
{}
double
class MyFunction : public Function<dim>
{
public:
- MyFunction() : Function<dim>(1)
+ MyFunction()
+ : Function<dim>(1)
{}
double
class MyFunction : public Function<dim>
{
public:
- MyFunction() : Function<dim>(1)
+ MyFunction()
+ : Function<dim>(1)
{}
double
deallog << std::endl
<< "# Area: "
- << std::accumulate(
- quad.get_weights().begin(), quad.get_weights().end(), 0.0)
+ << std::accumulate(quad.get_weights().begin(),
+ quad.get_weights().end(),
+ 0.0)
<< std::endl
<< std::endl;
deallog << std::endl
<< "# Area 2: "
- << std::accumulate(
- quad2.get_weights().begin(), quad2.get_weights().end(), 0.0)
+ << std::accumulate(quad2.get_weights().begin(),
+ quad2.get_weights().end(),
+ 0.0)
<< std::endl
<< std::endl;
}
deallog << std::endl
<< "# Area: "
- << std::accumulate(
- quad.get_weights().begin(), quad.get_weights().end(), 0.0)
+ << std::accumulate(quad.get_weights().begin(),
+ quad.get_weights().end(),
+ 0.0)
<< std::endl
<< std::endl;
deallog << std::endl
<< "# Area 2: "
- << std::accumulate(
- quad2.get_weights().begin(), quad2.get_weights().end(), 0.0)
+ << std::accumulate(quad2.get_weights().begin(),
+ quad2.get_weights().end(),
+ 0.0)
<< std::endl
<< std::endl;
}
deallog << std::endl
<< "# Area: "
- << std::accumulate(
- quad.get_weights().begin(), quad.get_weights().end(), 0.0)
+ << std::accumulate(quad.get_weights().begin(),
+ quad.get_weights().end(),
+ 0.0)
<< std::endl
<< std::endl;
deallog << std::endl
<< "# Area 2: "
- << std::accumulate(
- quad2.get_weights().begin(), quad2.get_weights().end(), 0.0)
+ << std::accumulate(quad2.get_weights().begin(),
+ quad2.get_weights().end(),
+ 0.0)
<< std::endl
<< std::endl;
}
deallog << std::endl
<< "# Area: "
- << std::accumulate(
- quad.get_weights().begin(), quad.get_weights().end(), 0.0)
+ << std::accumulate(quad.get_weights().begin(),
+ quad.get_weights().end(),
+ 0.0)
<< std::endl
<< std::endl;
deallog << std::endl
<< "# Area: "
- << std::accumulate(
- quad.get_weights().begin(), quad.get_weights().end(), 0.0)
+ << std::accumulate(quad.get_weights().begin(),
+ quad.get_weights().end(),
+ 0.0)
<< std::endl
<< std::endl;
if (quad.size() == n * n * 3)
deallog << std::endl
<< "# Area: "
- << std::accumulate(
- quad.get_weights().begin(), quad.get_weights().end(), 0.0)
+ << std::accumulate(quad.get_weights().begin(),
+ quad.get_weights().end(),
+ 0.0)
<< std::endl
<< std::endl;
if (quad.size() == n * n * 2)
deallog << std::endl
<< "# dim = " << dim << ", quad size = " << quad.size()
<< ", computed area = "
- << std::accumulate(
- quad.get_weights().begin(), quad.get_weights().end(), 0.0)
+ << std::accumulate(quad.get_weights().begin(),
+ quad.get_weights().end(),
+ 0.0)
<< std::endl
<< std::endl;
const char *name;
public:
- Test(const char *n) : name(n)
+ Test(const char *n)
+ : name(n)
{
deallog << "Construct " << name << std::endl;
}
for (unsigned int i = 0; i < I; ++i)
for (unsigned int j = 0; j < J; ++j)
for (unsigned int k = 0; k < K; ++k)
- AssertThrow(
- Td[i][j][k].end() - Td[i][j][k].begin() ==
- static_cast<signed int>(L),
- ExcDimensionMismatch(Td[i][j][k].end() - Td[i][j][k].begin(),
- static_cast<signed int>(L)));
+ AssertThrow(Td[i][j][k].end() - Td[i][j][k].begin() ==
+ static_cast<signed int>(L),
+ ExcDimensionMismatch(Td[i][j][k].end() -
+ Td[i][j][k].begin(),
+ static_cast<signed int>(L)));
};
// 5d-table
class Function : public FunctionBase
{
public:
- Function() : size_(2)
+ Function()
+ : size_(2)
{
deallog << "Construct object" << std::endl;
}
- Function(const Function &f) : size_(f.size_), vec(f.vec)
+ Function(const Function &f)
+ : size_(f.size_)
+ , vec(f.vec)
{
deallog << "Copy construct object" << std::endl;
}
test();
}
else
- Assert(
- false,
- ExcInternalError("did somebody mess with LimitConcurrency in tests.h?"));
+ Assert(false,
+ ExcInternalError(
+ "did somebody mess with LimitConcurrency in tests.h?"));
deallog << "* now with thread limit 1:" << std::endl;
MultithreadInfo::set_thread_limit(1);
{
Threads::ThreadLocalStorage<int> tls_data;
- X() : tls_data(42)
+ X()
+ : tls_data(42)
{}
int
{
Threads::ThreadLocalStorage<int> tls_data;
- X() : tls_data(42)
+ X()
+ : tls_data(42)
{}
int
struct X
{
- X() : i(1){};
+ X()
+ : i(1){};
int i;
};
struct X
{
- X() : i(1){};
+ X()
+ : i(1){};
int i;
};
struct X
{
- X(int i) : i(i)
+ X(int i)
+ : i(i)
{}
int i;
struct X
{
- X(int i) : i(i)
+ X(int i)
+ : i(i)
{}
int i;
struct X
{
- X(int i) : i(i)
+ X(int i)
+ : i(i)
{}
int i;
struct X
{
- X(int i) : i(i)
+ X(int i)
+ : i(i)
{}
int i;
struct X
{
- X(int i) : i(i)
+ X(int i)
+ : i(i)
{}
int i;
struct Y
{
- Y(int i) : i(i)
+ Y(int i)
+ : i(i)
{}
int i;
struct X
{
- X() : i(0)
+ X()
+ : i(0)
{}
- X(const X &x) : i(x.i + 1)
+ X(const X &x)
+ : i(x.i + 1)
{}
X &
operator=(const X &x)
{
public:
// default constructor
- X() : value(13)
+ X()
+ : value(13)
{}
- X(int i) : value(i)
+ X(int i)
+ : value(i)
{}
// delete the copy constructor
class X
{
public:
- X(int i) : value(i)
+ X(int i)
+ : value(i)
{}
// default constructor
- X() : value(13)
+ X()
+ : value(13)
{}
// delete the copy constructor
const auto t1 = std::chrono::system_clock::now();
// verify that the timer wall time is not double the manually calculated one
- AssertThrow(
- std::abs(
- double(
- std::chrono::duration_cast<std::chrono::seconds>(t1 - t0).count()) -
- timer.wall_time()) < 0.5,
- ExcMessage("The measured times should be close."));
+ AssertThrow(std::abs(
+ double(std::chrono::duration_cast<std::chrono::seconds>(t1 - t0)
+ .count()) -
+ timer.wall_time()) < 0.5,
+ ExcMessage("The measured times should be close."));
deallog << "OK" << std::endl;
}
try
{
std::cerr << "TimerOutput::Scope with MPI_COMM_SELF\n";
- TimerOutput timer_out(
- MPI_COMM_SELF, std::cerr, TimerOutput::summary, TimerOutput::cpu_times);
+ TimerOutput timer_out(MPI_COMM_SELF,
+ std::cerr,
+ TimerOutput::summary,
+ TimerOutput::cpu_times);
TimerOutput::Scope timer_scope(timer_out, "Section1");
throw Timer07Exception();
// convert everything between the |s to xs so that we have consistent
// output.
const std::string::iterator start_pipe =
- std::find(
- std::string::reverse_iterator(next_number), output.rend(), '|')
+ std::find(std::string::reverse_iterator(next_number),
+ output.rend(),
+ '|')
.base();
Assert(start_pipe != output.end(), ExcInternalError());
const std::string::iterator end_pipe =
// UNPACK BUFFER
double unpacked_array[N];
- Utilities::unpack(
- buffer.cbegin(), buffer.cbegin() + buffer_separator, unpacked_array);
- Point<dim> unpacked_point = Utilities::unpack<Point<dim>>(
- buffer.cbegin() + buffer_separator, buffer.cend());
+ Utilities::unpack(buffer.cbegin(),
+ buffer.cbegin() + buffer_separator,
+ unpacked_array);
+ Point<dim> unpacked_point =
+ Utilities::unpack<Point<dim>>(buffer.cbegin() + buffer_separator,
+ buffer.cend());
// TEST RESULTS
bool equal_array = true;
Utilities::unpack(array_compressed.cbegin(),
array_compressed.cend(),
unpacked_array_compressed);
- Point<dim> unpacked_point_compressed = Utilities::unpack<Point<dim>>(
- point_compressed.cbegin(), point_compressed.cend());
+ Point<dim> unpacked_point_compressed =
+ Utilities::unpack<Point<dim>>(point_compressed.cbegin(),
+ point_compressed.cend());
double unpacked_array_uncompressed[N];
Utilities::unpack(array_uncompressed.cbegin(),
array_uncompressed.cend(),
unpacked_array_uncompressed,
false);
- Point<dim> unpacked_point_uncompressed = Utilities::unpack<Point<dim>>(
- point_uncompressed.cbegin(), point_uncompressed.cend(), false);
+ Point<dim> unpacked_point_uncompressed =
+ Utilities::unpack<Point<dim>>(point_uncompressed.cbegin(),
+ point_uncompressed.cend(),
+ false);
// check if unpacked results are okay
bool equal_array = true;
// try something nasty
try
{
- Point<dim> forbidden = Utilities::unpack<Point<dim>>(
- point_compressed.cbegin(), point_compressed.cend(), false);
+ Point<dim> forbidden =
+ Utilities::unpack<Point<dim>>(point_compressed.cbegin(),
+ point_compressed.cend(),
+ false);
}
catch (const boost::archive::archive_exception &)
{
try
{
double forbidden[N];
- Utilities::unpack(
- array_compressed.cbegin(), array_compressed.cend(), forbidden, false);
+ Utilities::unpack(array_compressed.cbegin(),
+ array_compressed.cend(),
+ forbidden,
+ false);
}
catch (const boost::archive::archive_exception &)
{
try
{
- Point<dim> forbidden = Utilities::unpack<Point<dim>>(
- point_uncompressed.cbegin(), point_uncompressed.cend(), true);
+ Point<dim> forbidden =
+ Utilities::unpack<Point<dim>>(point_uncompressed.cbegin(),
+ point_uncompressed.cend(),
+ true);
}
catch (const boost::archive::archive_exception &)
{
eval.is_cartesian = true;
eval.cartesian_weight = random_value<double>();
for (unsigned int i = 0; i < 4; ++i)
- eval.cartesian_weight = std::max(
- eval.cartesian_weight, eval.cartesian_weight * eval.cartesian_weight);
+ eval.cartesian_weight =
+ std::max(eval.cartesian_weight,
+ eval.cartesian_weight * eval.cartesian_weight);
eval.general_weight[0] = 0.2313342 * eval.cartesian_weight;
eval.jac_weight[0] = random_value<double>();
}
template <int dim>
struct Scratch
{
- Scratch(const FiniteElement<dim> &fe, const Quadrature<dim> &quadrature) :
- fe_collection(fe),
- quadrature_collection(quadrature),
- x_fe_values(fe_collection,
- quadrature_collection,
- update_quadrature_points),
- rhs_values(quadrature_collection.size())
+ Scratch(const FiniteElement<dim> &fe, const Quadrature<dim> &quadrature)
+ : fe_collection(fe)
+ , quadrature_collection(quadrature)
+ , x_fe_values(fe_collection,
+ quadrature_collection,
+ update_quadrature_points)
+ , rhs_values(quadrature_collection.size())
{}
- Scratch(const Scratch &data) :
- fe_collection(data.fe_collection),
- quadrature_collection(data.quadrature_collection),
- x_fe_values(fe_collection,
- quadrature_collection,
- update_quadrature_points),
- rhs_values(data.rhs_values)
+ Scratch(const Scratch &data)
+ : fe_collection(data.fe_collection)
+ , quadrature_collection(data.quadrature_collection)
+ , x_fe_values(fe_collection,
+ quadrature_collection,
+ update_quadrature_points)
+ , rhs_values(data.rhs_values)
{}
const FiniteElement<dim> &fe_collection;
Scratch<dim> assembler_data(fe, q);
CopyData copy_data;
copy_data.cell_rhs.resize(8);
- WorkStream::run(
- triangulation.begin_active(),
- triangulation.end(),
- &mass_assembler<dim>,
- std::bind(©_local_to_global, std::placeholders::_1, &sum),
- assembler_data,
- copy_data,
- 8,
- 1);
+ WorkStream::run(triangulation.begin_active(),
+ triangulation.end(),
+ &mass_assembler<dim>,
+ std::bind(©_local_to_global,
+ std::placeholders::_1,
+ &sum),
+ assembler_data,
+ copy_data,
+ 8,
+ 1);
Assert(std::fabs(sum - 288.) < 1e-12, ExcInternalError());
deallog << sum << std::endl;
template <int dim>
struct Scratch
{
- Scratch(const FiniteElement<dim> &fe, const Quadrature<dim> &quadrature) :
- fe_collection(fe),
- quadrature_collection(quadrature),
- x_fe_values(fe_collection,
- quadrature_collection,
- update_quadrature_points),
- rhs_values(quadrature_collection.size())
+ Scratch(const FiniteElement<dim> &fe, const Quadrature<dim> &quadrature)
+ : fe_collection(fe)
+ , quadrature_collection(quadrature)
+ , x_fe_values(fe_collection,
+ quadrature_collection,
+ update_quadrature_points)
+ , rhs_values(quadrature_collection.size())
{}
- Scratch(const Scratch &data) :
- fe_collection(data.fe_collection),
- quadrature_collection(data.quadrature_collection),
- x_fe_values(fe_collection,
- quadrature_collection,
- update_quadrature_points),
- rhs_values(data.rhs_values)
+ Scratch(const Scratch &data)
+ : fe_collection(data.fe_collection)
+ , quadrature_collection(data.quadrature_collection)
+ , x_fe_values(fe_collection,
+ quadrature_collection,
+ update_quadrature_points)
+ , rhs_values(data.rhs_values)
{}
const FiniteElement<dim> &fe_collection;
Scratch<dim> assembler_data(fe, q);
CopyData copy_data;
copy_data.cell_rhs.resize(8);
- WorkStream::run(
- GraphColoring::make_graph_coloring(
- triangulation.begin_active(),
- triangulation.end(),
- std::function<std::vector<types::global_dof_index>(
- const Triangulation<dim>::active_cell_iterator &)>(
- &conflictor<dim>)),
- &mass_assembler<dim>,
- std::bind(©_local_to_global, std::placeholders::_1, &sum),
- assembler_data,
- copy_data,
- 8,
- 1);
+ WorkStream::run(GraphColoring::make_graph_coloring(
+ triangulation.begin_active(),
+ triangulation.end(),
+ std::function<std::vector<types::global_dof_index>(
+ const Triangulation<dim>::active_cell_iterator &)>(
+ &conflictor<dim>)),
+ &mass_assembler<dim>,
+ std::bind(©_local_to_global,
+ std::placeholders::_1,
+ &sum),
+ assembler_data,
+ copy_data,
+ 8,
+ 1);
Assert(std::fabs(sum - 288.) < 1e-12, ExcInternalError());
deallog << sum << std::endl;
for (unsigned int i = 0; i < 200; ++i)
v.push_back(i);
- WorkStream::run(
- GraphColoring::make_graph_coloring(
- v.begin(),
- v.end(),
- std::function<std::vector<types::global_dof_index>(
- const std::vector<unsigned int>::iterator &)>(&conflictor)),
- &worker,
- &copier,
- ScratchData(),
- CopyData());
+ WorkStream::run(GraphColoring::make_graph_coloring(
+ v.begin(),
+ v.end(),
+ std::function<std::vector<types::global_dof_index>(
+ const std::vector<unsigned int>::iterator &)>(
+ &conflictor)),
+ &worker,
+ &copier,
+ ScratchData(),
+ CopyData());
// now simulate what we should have gotten
Vector<double> comp(result.size());
};
template <int dim>
-SystemTest<dim>::SystemTest() :
- fe(FE_Nedelec<dim>(0), 2, FE_Q<dim>(1), 1),
- dof_handler(triangulation)
+SystemTest<dim>::SystemTest()
+ : fe(FE_Nedelec<dim>(0), 2, FE_Q<dim>(1), 1)
+ , dof_handler(triangulation)
{}
};
template <int dim>
-SystemTest<dim>::SystemTest() :
- fe(FE_Nedelec<dim>(0), 2, FE_Q<dim>(1), 1),
- dof_handler(triangulation)
+SystemTest<dim>::SystemTest()
+ : fe(FE_Nedelec<dim>(0), 2, FE_Q<dim>(1), 1)
+ , dof_handler(triangulation)
{}
};
template <int dim>
-SystemTest<dim>::SystemTest() :
- fe(FE_Nedelec<dim>(0), 2, FE_Q<dim>(1), 1),
- dof_handler(triangulation)
+SystemTest<dim>::SystemTest()
+ : fe(FE_Nedelec<dim>(0), 2, FE_Q<dim>(1), 1)
+ , dof_handler(triangulation)
{}
};
template <int dim>
-VectorBoundaryValues<dim>::VectorBoundaryValues() : Function<dim>(2)
+VectorBoundaryValues<dim>::VectorBoundaryValues()
+ : Function<dim>(2)
{}
template <int dim>
// first component: Q1-Element,
// second component: lowest order DG_Element
template <int dim>
-FindBug<dim>::FindBug() :
- fe(FE_Q<dim>(1), 1, FE_DGP<dim>(0), 1),
- dof_handler(triangulation)
+FindBug<dim>::FindBug()
+ : fe(FE_Q<dim>(1), 1, FE_DGP<dim>(0), 1)
+ , dof_handler(triangulation)
{}
// get a list of those boundary DoFs which
// we want to be fixed:
- DoFTools::extract_boundary_dofs(
- dof_handler, component_mask, fixed_dofs, boundary_ids);
+ DoFTools::extract_boundary_dofs(dof_handler,
+ component_mask,
+ fixed_dofs,
+ boundary_ids);
// (Primitive) Check if the DoFs
// where adjusted correctly (note
template <int dim>
-BoundaryFunction<dim>::BoundaryFunction() : Function<dim>(dim + 1)
+BoundaryFunction<dim>::BoundaryFunction()
+ : Function<dim>(dim + 1)
{}
// Construct FE with first component: Nedelec-Element,
// second component: Q1_Element
template <int dim>
-ImposeBC<dim>::ImposeBC() :
- fe(FE_Nedelec<dim>(0), 1, FE_Q<dim>(1), 1),
- dof_handler(triangulation)
+ImposeBC<dim>::ImposeBC()
+ : fe(FE_Nedelec<dim>(0), 1, FE_Q<dim>(1), 1)
+ , dof_handler(triangulation)
{}
std::vector<bool> ned_boundary_dofs(dof_handler.n_dofs());
std::set<types::boundary_id> boundary_ids;
boundary_ids.insert(0);
- DoFTools::extract_boundary_dofs(
- dof_handler, bc_component_select, ned_boundary_dofs, boundary_ids);
+ DoFTools::extract_boundary_dofs(dof_handler,
+ bc_component_select,
+ ned_boundary_dofs,
+ boundary_ids);
for (unsigned int i = 0; i < dof_handler.n_dofs(); ++i)
std::vector<bool> p_boundary_dofs(dof_handler.n_dofs());
std::set<types::boundary_id> boundary_ids;
boundary_ids.insert(0);
- DoFTools::extract_boundary_dofs(
- dof_handler, bc_component_select, p_boundary_dofs, boundary_ids);
+ DoFTools::extract_boundary_dofs(dof_handler,
+ bc_component_select,
+ p_boundary_dofs,
+ boundary_ids);
for (unsigned int i = 0; i < dof_handler.n_dofs(); ++i)
{
// error: pressure boundary DoF
// applying boundary values later on, or
// (2) applying them right away
std::map<types::global_dof_index, double> boundary_values;
- VectorTools::interpolate_boundary_values(
- dof_handler, 0, Functions::ConstantFunction<dim>(1.), boundary_values);
+ VectorTools::interpolate_boundary_values(dof_handler,
+ 0,
+ Functions::ConstantFunction<dim>(1.),
+ boundary_values);
std::vector<types::global_dof_index> local_dofs(fe.dofs_per_cell);
FullMatrix<double> local_matrix(fe.dofs_per_cell, fe.dofs_per_cell);
// applying boundary values later on, or
// (2) applying them right away
std::map<types::global_dof_index, double> boundary_values;
- VectorTools::interpolate_boundary_values(
- dof_handler, 0, Functions::ConstantFunction<dim>(1.), boundary_values);
+ VectorTools::interpolate_boundary_values(dof_handler,
+ 0,
+ Functions::ConstantFunction<dim>(1.),
+ boundary_values);
std::vector<types::global_dof_index> local_dofs(fe.dofs_per_cell);
FullMatrix<double> local_matrix(fe.dofs_per_cell, fe.dofs_per_cell);
dof_handler.n_dofs(),
dof_handler.max_couplings_between_dofs());
sparsity_pattern.block(0, 1).reinit(dof_handler.n_dofs(), 1, 1);
- sparsity_pattern.block(1, 0).reinit(
- 1, dof_handler.n_dofs(), dof_handler.n_dofs());
+ sparsity_pattern.block(1, 0).reinit(1,
+ dof_handler.n_dofs(),
+ dof_handler.n_dofs());
sparsity_pattern.block(1, 1).reinit(1, 1, 1);
sparsity_pattern.collect_sizes();
dof_handler.n_dofs(),
dof_handler.max_couplings_between_dofs());
sparsity_pattern.block(0, 1).reinit(dof_handler.n_dofs(), 1, 1);
- sparsity_pattern.block(1, 0).reinit(
- 1, dof_handler.n_dofs(), dof_handler.n_dofs());
+ sparsity_pattern.block(1, 0).reinit(1,
+ dof_handler.n_dofs(),
+ dof_handler.n_dofs());
sparsity_pattern.block(1, 1).reinit(1, 1, 1);
sparsity_pattern.collect_sizes();
class TestFunction : public Function<2>
{
public:
- TestFunction() : Function<2>()
+ TestFunction()
+ : Function<2>()
{}
virtual double
value(const Point<2> &p, const unsigned int) const
VectorTools::interpolate(dof_handler, F(), phi_solution);
gradient_phi.reinit(triangulation.n_active_cells());
- DerivativeApproximation::approximate_gradient(
- dof_handler, phi_solution, gradient_phi);
+ DerivativeApproximation::approximate_gradient(dof_handler,
+ phi_solution,
+ gradient_phi);
gradient_phi_min = 1e30;
gradient_phi_max = -1;
class MySquareFunction : public Function<dim>
{
public:
- MySquareFunction() : Function<dim>(2)
+ MySquareFunction()
+ : Function<dim>(2)
{}
virtual double
class MySquareFunction : public Function<dim>
{
public:
- MySquareFunction() : Function<dim>(2)
+ MySquareFunction()
+ : Function<dim>(2)
{}
virtual double
class F : public Function<dim>
{
public:
- F(const unsigned int q, const unsigned int n_components) :
- Function<dim>(n_components),
- q(q)
+ F(const unsigned int q, const unsigned int n_components)
+ : Function<dim>(n_components)
+ , q(q)
{}
virtual double
<< std::endl;
if (q <= p - order_difference)
- AssertThrow(
- error.l2_norm() <= 1e-10 * projection.l2_norm(),
- ExcFailedProjection(error.l2_norm() / projection.l2_norm()));
+ AssertThrow(error.l2_norm() <= 1e-10 * projection.l2_norm(),
+ ExcFailedProjection(error.l2_norm() /
+ projection.l2_norm()));
}
}
class F : public Function<dim>
{
public:
- F(const unsigned int q, const unsigned int n_components) :
- Function<dim>(n_components),
- q(q)
+ F(const unsigned int q, const unsigned int n_components)
+ : Function<dim>(n_components)
+ , q(q)
{}
virtual double
<< std::endl;
if (q <= p - order_difference)
- AssertThrow(
- error.l2_norm() <= 1e-10 * projection.l2_norm(),
- ExcFailedProjection(error.l2_norm() / projection.l2_norm()));
+ AssertThrow(error.l2_norm() <= 1e-10 * projection.l2_norm(),
+ ExcFailedProjection(error.l2_norm() /
+ projection.l2_norm()));
}
}
class F : public Function<dim>
{
public:
- F(const unsigned int q, const unsigned int n_components) :
- Function<dim>(n_components),
- q(q)
+ F(const unsigned int q, const unsigned int n_components)
+ : Function<dim>(n_components)
+ , q(q)
{}
virtual double
<< std::endl;
if (q <= p - order_difference)
- AssertThrow(
- error.l2_norm() <= 1e-10 * projection.l2_norm(),
- ExcFailedProjection(error.l2_norm() / projection.l2_norm()));
+ AssertThrow(error.l2_norm() <= 1e-10 * projection.l2_norm(),
+ ExcFailedProjection(error.l2_norm() /
+ projection.l2_norm()));
}
}
try
{
face_constraints.reinit(fe2.dofs_per_face, fe1.dofs_per_face);
- fe1.get_subface_interpolation_matrix(
- fe2, subface, face_constraints);
+ fe1.get_subface_interpolation_matrix(fe2,
+ subface,
+ face_constraints);
deallog << fe1.get_name() << " vs. " << fe2.get_name()
<< std::endl;
try
{
face_constraints.reinit(fe1.dofs_per_face, fe2.dofs_per_face);
- fe2.get_subface_interpolation_matrix(
- fe1, subface, face_constraints);
+ fe2.get_subface_interpolation_matrix(fe1,
+ subface,
+ face_constraints);
deallog << fe2.get_name() << " vs. " << fe1.get_name()
<< std::endl;
class F : public Function<dim>
{
public:
- F() : Function<dim>(2)
+ F()
+ : Function<dim>(2)
{}
virtual void
vector_value(const Point<dim> &p, Vector<double> &v) const
class F : public Function<dim>
{
public:
- F() : Function<dim>(2)
+ F()
+ : Function<dim>(2)
{}
virtual void
vector_value(const Point<dim> &p, Vector<double> &v) const
class F : public Function<dim>
{
public:
- F() : Function<dim>(2)
+ F()
+ : Function<dim>(2)
{}
virtual void
vector_value(const Point<dim> &p, Vector<double> &v) const
class F : public Function<dim>
{
public:
- F() : Function<dim>(2)
+ F()
+ : Function<dim>(2)
{}
virtual void
vector_value(const Point<dim> &p, Vector<double> &v) const
class F : public Function<dim>
{
public:
- F() : Function<dim>(2)
+ F()
+ : Function<dim>(2)
{}
virtual void
vector_value(const Point<dim> &p, Vector<double> &v) const
class F : public Function<dim>
{
public:
- F() : Function<dim>(2)
+ F()
+ : Function<dim>(2)
{}
virtual void
class F : public Function<dim>
{
public:
- F() : Function<dim>(2)
+ F()
+ : Function<dim>(2)
{}
virtual void
template <int dim>
-TestFunction<dim>::TestFunction(const unsigned int p_order) : p_order(p_order)
+TestFunction<dim>::TestFunction(const unsigned int p_order)
+ : p_order(p_order)
{
std::vector<double> coeff(p_order);
template <int dim>
TestFEQConstraints<dim>::TestFEQConstraints(unsigned int p_order,
- unsigned int refinements) :
- refinements(refinements),
- p_order(p_order),
- fe(p_order),
- dof_handler(triangulation)
+ unsigned int refinements)
+ : refinements(refinements)
+ , p_order(p_order)
+ , fe(p_order)
+ , dof_handler(triangulation)
{}
for (unsigned int i = 0; i < n_cells; ++i)
estimated_error_per_cell(i) = random_value<double>();
- GridRefinement::refine_and_coarsen_fixed_number(
- triangulation, estimated_error_per_cell, 0.3, 0.03);
+ GridRefinement::refine_and_coarsen_fixed_number(triangulation,
+ estimated_error_per_cell,
+ 0.3,
+ 0.03);
triangulation.execute_coarsening_and_refinement();
}
FullMatrix<double> X(fe.dofs_per_cell, q_rhs.size());
- FETools::compute_projection_from_quadrature_points_matrix(
- fe, q_lhs, q_rhs, X);
+ FETools::compute_projection_from_quadrature_points_matrix(fe,
+ q_lhs,
+ q_rhs,
+ X);
output_matrix(X);
}
FullMatrix<double> X(fe.dofs_per_cell, q_rhs.size());
- FETools::compute_projection_from_quadrature_points_matrix(
- fe, q_lhs, q_rhs, X);
+ FETools::compute_projection_from_quadrature_points_matrix(fe,
+ q_lhs,
+ q_rhs,
+ X);
// then compute the matrix that
// interpolates back to the quadrature
FullMatrix<double> X(fe.dofs_per_cell, q_rhs.size());
- FETools::compute_projection_from_quadrature_points_matrix(
- fe, q_lhs, q_rhs, X);
+ FETools::compute_projection_from_quadrature_points_matrix(fe,
+ q_lhs,
+ q_rhs,
+ X);
output_matrix(X);
}
return;
// test with different quadrature formulas
- Quadrature<dim> q_rhs(
- fe.get_unit_support_points(),
- std::vector<double>(fe.dofs_per_cell, 1. / fe.dofs_per_cell));
+ Quadrature<dim> q_rhs(fe.get_unit_support_points(),
+ std::vector<double>(fe.dofs_per_cell,
+ 1. / fe.dofs_per_cell));
FullMatrix<double> X(fe.dofs_per_cell, q_rhs.size());
AssertThrow(X.m() == X.n(), ExcInternalError());
- FETools::compute_projection_from_quadrature_points_matrix(
- fe, q_rhs, q_rhs, X);
+ FETools::compute_projection_from_quadrature_points_matrix(fe,
+ q_rhs,
+ q_rhs,
+ X);
for (unsigned int i = 0; i < X.m(); ++i)
X(i, i) -= 1;
FullMatrix<double> X(fe.dofs_per_cell, q_rhs.size());
- FETools::compute_projection_from_quadrature_points_matrix(
- fe, q_lhs, q_rhs, X);
+ FETools::compute_projection_from_quadrature_points_matrix(fe,
+ q_lhs,
+ q_rhs,
+ X);
// then compute the matrix that
// interpolates back to the quadrature
try
{
std::pair<Triangulation<2>::active_cell_iterator, Point<2>> current_cell =
- GridTools::find_active_cell_around_point(
- MappingQGeneric<2>(1), triangulation, test_point);
+ GridTools::find_active_cell_around_point(MappingQGeneric<2>(1),
+ triangulation,
+ test_point);
deallog << "cell: index = " << current_cell.first->index()
<< " level = " << current_cell.first->level() << std::endl;
hp::DoFHandler<3> dof_handler(tria);
dof_handler.distribute_dofs(fes);
- GridTools::find_active_cell_around_point(
- mappings, dof_handler, p2); // triggered exception
+ GridTools::find_active_cell_around_point(mappings,
+ dof_handler,
+ p2); // triggered exception
}
const std::vector<Point<3>> &v = tria.get_vertices();
for (unsigned i = 0; i < v.size(); i++)
deallog << "["
- << GridTools::find_closest_vertex(
- tria, v[i] + Point<3>(0.01, -0.01, 0.01))
+ << GridTools::find_closest_vertex(tria,
+ v[i] +
+ Point<3>(0.01, -0.01, 0.01))
<< "] ";
deallog << std::endl;
template <int dim>
-LaplaceProblem<dim>::LaplaceProblem() : fe(1), dof_handler(triangulation)
+LaplaceProblem<dim>::LaplaceProblem()
+ : fe(1)
+ , dof_handler(triangulation)
{}
class Coefficient : public Function<dim>
{
public:
- Coefficient() : Function<dim>()
+ Coefficient()
+ : Function<dim>()
{}
virtual double
// the desired polynomial degree
// (here <code>2</code>):
template <int dim>
-LaplaceProblem<dim>::LaplaceProblem() : dof_handler(triangulation), fe(2)
+LaplaceProblem<dim>::LaplaceProblem()
+ : dof_handler(triangulation)
+ , fe(2)
{}
for (unsigned int i = 0; i < dofs_per_cell; ++i)
{
for (unsigned int j = 0; j < dofs_per_cell; ++j)
- system_matrix.add(
- local_dof_indices[i], local_dof_indices[j], cell_matrix(i, j));
+ system_matrix.add(local_dof_indices[i],
+ local_dof_indices[j],
+ cell_matrix(i, j));
system_rhs(local_dof_indices[i]) += cell_rhs(i);
}
// happens *after* the elimination
// of hanging nodes.
std::map<types::global_dof_index, double> boundary_values;
- VectorTools::interpolate_boundary_values(
- dof_handler, 0, Functions::ZeroFunction<dim>(), boundary_values);
- MatrixTools::apply_boundary_values(
- boundary_values, system_matrix, solution, system_rhs);
+ VectorTools::interpolate_boundary_values(dof_handler,
+ 0,
+ Functions::ZeroFunction<dim>(),
+ boundary_values);
+ MatrixTools::apply_boundary_values(boundary_values,
+ system_matrix,
+ solution,
+ system_rhs);
}
// several different algorithms to
// refine a triangulation based on
// cell-wise error indicators.
- GridRefinement::refine_and_coarsen_fixed_number(
- triangulation, estimated_error_per_cell, 0.3, 0.03);
+ GridRefinement::refine_and_coarsen_fixed_number(triangulation,
+ estimated_error_per_cell,
+ 0.3,
+ 0.03);
// After the previous function has
// exited, some cells are flagged
// boundary values and boundary
// constraints
std::map<types::global_dof_index, double> boundary_values;
- VectorTools::interpolate_boundary_values(
- dof_handler, 0, Functions::ConstantFunction<dim>(1.), boundary_values);
+ VectorTools::interpolate_boundary_values(dof_handler,
+ 0,
+ Functions::ConstantFunction<dim>(1.),
+ boundary_values);
ConstraintMatrix constraints;
constraints.clear();
DoFTools::make_zero_boundary_constraints(dof_handler, constraints);
// boundary values and boundary
// constraints
std::map<types::global_dof_index, double> boundary_values;
- VectorTools::interpolate_boundary_values(
- dof_handler, 1, Functions::ConstantFunction<dim>(1.), boundary_values);
+ VectorTools::interpolate_boundary_values(dof_handler,
+ 1,
+ Functions::ConstantFunction<dim>(1.),
+ boundary_values);
ConstraintMatrix constraints;
constraints.clear();
DoFTools::make_zero_boundary_constraints(dof_handler, 1, constraints);
std::vector<Point<dim>> hp_map(hp_dof_handler.n_dofs());
DoFTools::map_dofs_to_support_points(mapping, dof_handler, map);
- DoFTools::map_dofs_to_support_points(
- mapping_collection, hp_dof_handler, hp_map);
+ DoFTools::map_dofs_to_support_points(mapping_collection,
+ hp_dof_handler,
+ hp_map);
// output the elements
for (unsigned int i = 0; i < hp_map.size(); i++)
// now map the dofs to the support points and show them on the screen
std::vector<Point<dim>> hp_map(hp_dof_handler.n_dofs());
- DoFTools::map_dofs_to_support_points(
- mapping_collection, hp_dof_handler, hp_map);
+ DoFTools::map_dofs_to_support_points(mapping_collection,
+ hp_dof_handler,
+ hp_map);
// output the elements
for (unsigned int i = 0; i < hp_map.size(); i++)
QGauss<dim - 1> q_face(3);
- FEFaceValues<dim> fe_face_values(
- fe, q_face, update_normal_vectors | update_JxW_values);
+ FEFaceValues<dim> fe_face_values(fe,
+ q_face,
+ update_normal_vectors | update_JxW_values);
FESubfaceValues<dim> fe_subface_values(
fe, q_face, update_normal_vectors | update_JxW_values);
QGauss<dim - 1> q_face(3);
- FEFaceValues<dim> fe_face_values(
- mapping, fe, q_face, update_normal_vectors | update_JxW_values);
+ FEFaceValues<dim> fe_face_values(mapping,
+ fe,
+ q_face,
+ update_normal_vectors | update_JxW_values);
FESubfaceValues<dim> fe_subface_values(
mapping, fe, q_face, update_normal_vectors | update_JxW_values);
QGauss<dim - 1> q_face(3);
- FEFaceValues<dim> fe_face_values(
- mapping, fe, q_face, update_normal_vectors | update_JxW_values);
+ FEFaceValues<dim> fe_face_values(mapping,
+ fe,
+ q_face,
+ update_normal_vectors | update_JxW_values);
FESubfaceValues<dim> fe_subface_values(
mapping, fe, q_face, update_normal_vectors | update_JxW_values);
QGauss<dim - 1> q_face(3);
- FEFaceValues<dim> fe_face_values(
- mapping, fe, q_face, update_normal_vectors | update_JxW_values);
+ FEFaceValues<dim> fe_face_values(mapping,
+ fe,
+ q_face,
+ update_normal_vectors | update_JxW_values);
FESubfaceValues<dim> fe_subface_values(
mapping, fe, q_face, update_normal_vectors | update_JxW_values);
};
template <int dim>
-MakeFlux<dim>::MakeFlux() : fe(1), dof_handler(triangulation)
+MakeFlux<dim>::MakeFlux()
+ : fe(1)
+ , dof_handler(triangulation)
{}
Triangulation<dim> triangulation;
std::vector<unsigned int> repetitions(dim, 1);
repetitions[0] = 2;
- GridGenerator::subdivided_hyper_rectangle(
- triangulation,
- repetitions,
- Point<dim>(),
- (dim == 2 ? Point<dim>(2, 1) : Point<dim>(2, 1, 1)));
+ GridGenerator::subdivided_hyper_rectangle(triangulation,
+ repetitions,
+ Point<dim>(),
+ (dim == 2 ? Point<dim>(2, 1) :
+ Point<dim>(2, 1, 1)));
FE_Q<dim> fe(1);
DoFHandler<dim> dof_handler(triangulation);
dof_handler.distribute_dofs(fe);
ConstraintMatrix cm;
- DoFTools::make_periodicity_constraints(
- dof_handler.begin(0)->face(0), (++dof_handler.begin(0))->face(1), cm);
+ DoFTools::make_periodicity_constraints(dof_handler.begin(0)->face(0),
+ (++dof_handler.begin(0))->face(1),
+ cm);
cm.print(deallog.get_file_stream());
}
Triangulation<dim> triangulation;
std::vector<unsigned int> repetitions(dim, 1);
repetitions[0] = 2;
- GridGenerator::subdivided_hyper_rectangle(
- triangulation,
- repetitions,
- Point<dim>(),
- (dim == 2 ? Point<dim>(2, 1) : Point<dim>(2, 1, 1)));
+ GridGenerator::subdivided_hyper_rectangle(triangulation,
+ repetitions,
+ Point<dim>(),
+ (dim == 2 ? Point<dim>(2, 1) :
+ Point<dim>(2, 1, 1)));
triangulation.begin_active()->set_refine_flag();
triangulation.execute_coarsening_and_refinement();
dof_handler.distribute_dofs(fe);
ConstraintMatrix cm;
- DoFTools::make_periodicity_constraints(
- dof_handler.begin(0)->face(0), (++dof_handler.begin(0))->face(1), cm);
+ DoFTools::make_periodicity_constraints(dof_handler.begin(0)->face(0),
+ (++dof_handler.begin(0))->face(1),
+ cm);
cm.print(deallog.get_file_stream());
}
Triangulation<dim> triangulation;
std::vector<unsigned int> repetitions(dim, 1);
repetitions[0] = 2;
- GridGenerator::subdivided_hyper_rectangle(
- triangulation,
- repetitions,
- Point<dim>(),
- (dim == 2 ? Point<dim>(2, 1) : Point<dim>(2, 1, 1)));
+ GridGenerator::subdivided_hyper_rectangle(triangulation,
+ repetitions,
+ Point<dim>(),
+ (dim == 2 ? Point<dim>(2, 1) :
+ Point<dim>(2, 1, 1)));
triangulation.begin_active()->set_refine_flag();
triangulation.execute_coarsening_and_refinement();
triangulation.begin_active(1)->set_refine_flag();
dof_handler.distribute_dofs(fe);
ConstraintMatrix cm;
- DoFTools::make_periodicity_constraints(
- dof_handler.begin(0)->face(0), (++dof_handler.begin(0))->face(1), cm);
+ DoFTools::make_periodicity_constraints(dof_handler.begin(0)->face(0),
+ (++dof_handler.begin(0))->face(1),
+ cm);
cm.print(deallog.get_file_stream());
}
Triangulation<dim> triangulation;
std::vector<unsigned int> repetitions(dim, 1);
repetitions[0] = 2;
- GridGenerator::subdivided_hyper_rectangle(
- triangulation,
- repetitions,
- Point<dim>(),
- (dim == 2 ? Point<dim>(2, 1) : Point<dim>(2, 1, 1)));
+ GridGenerator::subdivided_hyper_rectangle(triangulation,
+ repetitions,
+ Point<dim>(),
+ (dim == 2 ? Point<dim>(2, 1) :
+ Point<dim>(2, 1, 1)));
triangulation.begin_active()->set_refine_flag();
triangulation.execute_coarsening_and_refinement();
triangulation.begin_active(1)->set_refine_flag();
std::vector<bool> mask(2, true);
mask[1] = false;
ConstraintMatrix cm;
- DoFTools::make_periodicity_constraints(
- dof_handler.begin(0)->face(0), (++dof_handler.begin(0))->face(1), cm, mask);
+ DoFTools::make_periodicity_constraints(dof_handler.begin(0)->face(0),
+ (++dof_handler.begin(0))->face(1),
+ cm,
+ mask);
cm.print(deallog.get_file_stream());
}
ConstraintMatrix constraints;
};
-Deal2PeriodicBug::Deal2PeriodicBug() : fe(2), dof_handler(triangulation)
+Deal2PeriodicBug::Deal2PeriodicBug()
+ : fe(2)
+ , dof_handler(triangulation)
{}
constraints.close();
std::map<types::global_dof_index, Point<dim>> support_points;
- DoFTools::map_dofs_to_support_points(
- MappingQ<dim, dim>(1), dof_handler, support_points);
+ DoFTools::map_dofs_to_support_points(MappingQ<dim, dim>(1),
+ dof_handler,
+ support_points);
for (const auto &line : constraints.get_lines())
for (const auto &entry : line.entries)
deallog << "DoF " << line.index << " at " << support_points[line.index]
class PeriodicReference : public Function<dim>
{
public:
- PeriodicReference() : Function<dim>()
+ PeriodicReference()
+ : Function<dim>()
{}
virtual double
value(const Point<dim> &p, const unsigned int component = 0) const override
constraints.close();
std::map<types::global_dof_index, Point<dim>> support_points;
- DoFTools::map_dofs_to_support_points(
- MappingQ<dim, dim>(1), dof_handler, support_points);
+ DoFTools::map_dofs_to_support_points(MappingQ<dim, dim>(1),
+ dof_handler,
+ support_points);
for (const auto &line : constraints.get_lines())
for (const auto &entry : line.entries)
deallog << "DoF " << line.index << " at " << support_points[line.index]
class PeriodicReference : public Function<dim>
{
public:
- PeriodicReference() : Function<dim>()
+ PeriodicReference()
+ : Function<dim>()
{}
virtual double
value(const Point<dim> &p, const unsigned int component = 0) const override
class MySquareFunction : public Function<dim>
{
public:
- MySquareFunction() : Function<dim>()
+ MySquareFunction()
+ : Function<dim>()
{}
virtual double
class MyExpFunction : public Function<dim>
{
public:
- MyExpFunction() : Function<dim>()
+ MyExpFunction()
+ : Function<dim>()
{}
virtual double
class MySquareFunction : public Function<dim>
{
public:
- MySquareFunction() : Function<dim>()
+ MySquareFunction()
+ : Function<dim>()
{}
virtual double
class MyExpFunction : public Function<dim>
{
public:
- MyExpFunction() : Function<dim>()
+ MyExpFunction()
+ : Function<dim>()
{}
virtual double
class MySquareFunction : public Function<dim>
{
public:
- MySquareFunction() : Function<dim>()
+ MySquareFunction()
+ : Function<dim>()
{}
virtual double
class MyExpFunction : public Function<dim>
{
public:
- MyExpFunction() : Function<dim>()
+ MyExpFunction()
+ : Function<dim>()
{}
virtual double
VectorTools::point_gradient(dof, v, p[i], gradient);
deallog << -gradient[0] << std::endl;
- Assert(
- std::abs((gradient[0] - function.gradient(p[i])).norm_square()) <
- 1e-4,
- ExcInternalError());
+ Assert(std::abs(
+ (gradient[0] - function.gradient(p[i])).norm_square()) <
+ 1e-4,
+ ExcInternalError());
const Tensor<1, dim> scalar_gradient =
VectorTools::point_gradient(dof, v, p[i]);
class MySquareFunction : public Function<dim>
{
public:
- MySquareFunction() : Function<dim>()
+ MySquareFunction()
+ : Function<dim>()
{}
virtual double
class MyExpFunction : public Function<dim>
{
public:
- MyExpFunction() : Function<dim>()
+ MyExpFunction()
+ : Function<dim>()
{}
virtual double
VectorTools::point_gradient(mapping, dof, v, p[i], gradient);
deallog << -gradient[0] << std::endl;
- Assert(
- std::abs((gradient[0] - function.gradient(p[i])).norm_square()) <
- 1e-4,
- ExcInternalError());
+ Assert(std::abs(
+ (gradient[0] - function.gradient(p[i])).norm_square()) <
+ 1e-4,
+ ExcInternalError());
const Tensor<1, dim> scalar_gradient =
VectorTools::point_gradient(dof, v, p[i]);
class MySquareFunction : public Function<dim>
{
public:
- MySquareFunction() : Function<dim>()
+ MySquareFunction()
+ : Function<dim>()
{}
virtual double
class MyExpFunction : public Function<dim>
{
public:
- MyExpFunction() : Function<dim>()
+ MyExpFunction()
+ : Function<dim>()
{}
virtual double
VectorTools::point_gradient(dof_handler, v, p[i], gradient);
deallog << -gradient[0] << std::endl;
- Assert(
- std::abs((gradient[0] - function.gradient(p[i])).norm_square()) <
- 1e-4,
- ExcInternalError());
+ Assert(std::abs(
+ (gradient[0] - function.gradient(p[i])).norm_square()) <
+ 1e-4,
+ ExcInternalError());
const Tensor<1, dim> scalar_gradient =
VectorTools::point_gradient(dof_handler, v, p[i]);
class MySquareFunction : public Function<dim>
{
public:
- MySquareFunction() : Function<dim>()
+ MySquareFunction()
+ : Function<dim>()
{}
virtual double
class MyExpFunction : public Function<dim>
{
public:
- MyExpFunction() : Function<dim>()
+ MyExpFunction()
+ : Function<dim>()
{}
virtual double
mapping_1, dof_handler, v, p[i], gradient);
deallog << -gradient[0] << std::endl;
- Assert(
- std::abs((gradient[0] - function.gradient(p[i])).norm_square()) <
- 1e-4,
- ExcInternalError());
+ Assert(std::abs(
+ (gradient[0] - function.gradient(p[i])).norm_square()) <
+ 1e-4,
+ ExcInternalError());
VectorTools::point_gradient(
mapping_2, dof_handler, v, p[i], gradient);
deallog << -gradient[0] << std::endl;
- Assert(
- std::abs((gradient[0] - function.gradient(p[i])).norm_square()) <
- 1e-4,
- ExcInternalError());
+ Assert(std::abs(
+ (gradient[0] - function.gradient(p[i])).norm_square()) <
+ 1e-4,
+ ExcInternalError());
const Tensor<1, dim> scalar_gradient_1 =
VectorTools::point_gradient(mapping_1, dof_handler, v, p[i]);
class MySquareFunction : public Function<dim>
{
public:
- MySquareFunction() : Function<dim>()
+ MySquareFunction()
+ : Function<dim>()
{}
virtual double
class MyExpFunction : public Function<dim>
{
public:
- MyExpFunction() : Function<dim>()
+ MyExpFunction()
+ : Function<dim>()
{}
virtual double
class MySquareFunction : public Function<dim>
{
public:
- MySquareFunction() : Function<dim>()
+ MySquareFunction()
+ : Function<dim>()
{}
virtual double
class MyExpFunction : public Function<dim>
{
public:
- MyExpFunction() : Function<dim>()
+ MyExpFunction()
+ : Function<dim>()
{}
virtual double
class MySquareFunction : public Function<dim>
{
public:
- MySquareFunction() : Function<dim>()
+ MySquareFunction()
+ : Function<dim>()
{}
virtual double
class MyExpFunction : public Function<dim>
{
public:
- MyExpFunction() : Function<dim>()
+ MyExpFunction()
+ : Function<dim>()
{}
virtual double
class MySquareFunction : public Function<dim>
{
public:
- MySquareFunction() : Function<dim>()
+ MySquareFunction()
+ : Function<dim>()
{}
virtual double
class MyExpFunction : public Function<dim>
{
public:
- MyExpFunction() : Function<dim>()
+ MyExpFunction()
+ : Function<dim>()
{}
virtual double
// finally generate a triangulation
// out of this
GridReordering<3>::reorder_cells(cells);
- coarse_grid.create_triangulation_compatibility(
- vertices, cells, SubCellData());
+ coarse_grid.create_triangulation_compatibility(vertices,
+ cells,
+ SubCellData());
}
{
QGauss<2> quadrature(3);
FE_Q<3> fe(1);
- FEFaceValues<3> fe_face_values1(
- fe, quadrature, update_quadrature_points | update_JxW_values);
- FEFaceValues<3> fe_face_values2(
- fe, quadrature, update_quadrature_points | update_JxW_values);
+ FEFaceValues<3> fe_face_values1(fe,
+ quadrature,
+ update_quadrature_points | update_JxW_values);
+ FEFaceValues<3> fe_face_values2(fe,
+ quadrature,
+ update_quadrature_points | update_JxW_values);
DoFHandler<3> dof_handler(tria);
dof_handler.distribute_dofs(fe);
class MyFunction : public Function<dim>
{
public:
- MyFunction() : Function<dim>(){};
+ MyFunction()
+ : Function<dim>(){};
virtual double
value(const Point<dim> &p, const unsigned int) const
template <>
const Point<1>
- SolutionBase<1>::source_centers[SolutionBase<1>::n_source_centers] = {
- Point<1>(-1.0 / 3.0),
- Point<1>(0.0),
- Point<1>(+1.0 / 3.0)};
+ SolutionBase<1>::source_centers[SolutionBase<1>::n_source_centers] =
+ {Point<1>(-1.0 / 3.0), Point<1>(0.0), Point<1>(+1.0 / 3.0)};
template <>
const Point<2>
- SolutionBase<2>::source_centers[SolutionBase<2>::n_source_centers] = {
- Point<2>(-0.5, +0.5),
- Point<2>(-0.5, -0.5),
- Point<2>(+0.5, -0.5)};
+ SolutionBase<2>::source_centers[SolutionBase<2>::n_source_centers] =
+ {Point<2>(-0.5, +0.5), Point<2>(-0.5, -0.5), Point<2>(+0.5, -0.5)};
template <>
const Point<3>
class Solution : public Function<dim>, protected SolutionBase<dim>
{
public:
- Solution() : Function<dim>()
+ Solution()
+ : Function<dim>()
{}
virtual double
class RightHandSide : public Function<dim>, protected SolutionBase<dim>
{
public:
- RightHandSide() : Function<dim>()
+ RightHandSide()
+ : Function<dim>()
{}
virtual double
template <int dim>
HelmholtzProblem<dim>::HelmholtzProblem(const unsigned int fe_degree,
- const RefinementMode refinement_mode) :
- fe(fe_degree),
- dof_handler(triangulation),
- fe_trace(fe_degree),
- dof_handler_trace(triangulation),
- refinement_mode(refinement_mode)
+ const RefinementMode refinement_mode)
+ : fe(fe_degree)
+ , dof_handler(triangulation)
+ , fe_trace(fe_degree)
+ , dof_handler_trace(triangulation)
+ , refinement_mode(refinement_mode)
{
deallog << "Solving with Q" << fe_degree << " elements, "
<< (refinement_mode == global_refinement ? "global" : "adaptive")
constraints.clear();
DoFTools::make_hanging_node_constraints(dof_handler, constraints);
- VectorTools::interpolate_boundary_values(
- dof_handler, 0, Solution<dim>(), constraints);
+ VectorTools::interpolate_boundary_values(dof_handler,
+ 0,
+ Solution<dim>(),
+ constraints);
constraints.close();
{
constraints_trace.clear();
DoFTools::make_hanging_node_constraints(dof_handler_trace, constraints_trace);
- VectorTools::interpolate_boundary_values(
- dof_handler_trace, 0, Solution<dim>(), constraints_trace);
+ VectorTools::interpolate_boundary_values(dof_handler_trace,
+ 0,
+ Solution<dim>(),
+ constraints_trace);
constraints_trace.close();
{
DynamicSparsityPattern csp(dof_handler_trace.n_dofs());
- DoFTools::make_sparsity_pattern(
- dof_handler_trace, csp, constraints_trace, false);
+ DoFTools::make_sparsity_pattern(dof_handler_trace,
+ csp,
+ constraints_trace,
+ false);
sparsity_pattern_trace.copy_from(csp);
}
PreconditionSSOR<> preconditioner;
preconditioner.initialize(system_matrix_trace, 1.2);
- cg.solve(
- system_matrix_trace, solution_trace, system_rhs_trace, preconditioner);
+ cg.solve(system_matrix_trace,
+ solution_trace,
+ system_rhs_trace,
+ preconditioner);
constraints_trace.distribute(solution_trace);
}
DoFHandler<dim> dof_handler(triangulation);
- FEFaceValues<dim> x_fe_face_values(
- mapping, fe, quadrature, update_JxW_values);
+ FEFaceValues<dim> x_fe_face_values(mapping,
+ fe,
+ quadrature,
+ update_JxW_values);
for (unsigned int refinement = 0; refinement < 2;
++refinement, triangulation.refine_global(1))
{
GridOutFlags::Gnuplot gnuplot_flags(false, 30);
grid_out.set_flags(gnuplot_flags);
- grid_out.write_gnuplot(
- triangulation, deallog.get_file_stream(), &mapping);
+ grid_out.write_gnuplot(triangulation,
+ deallog.get_file_stream(),
+ &mapping);
}
deallog << std::endl;
}
DoFHandler<dim> dof_handler(triangulation);
- FEValues<dim> x_fe_values(
- mapping, dummy_fe, quadrature, update_JxW_values);
+ FEValues<dim> x_fe_values(mapping,
+ dummy_fe,
+ quadrature,
+ update_JxW_values);
ConvergenceTable table;
DoFHandler<dim> dof_handler(triangulation);
- FEFaceValues<dim> x_fe_face_values(
- mapping, fe, quadrature, update_JxW_values);
- ConvergenceTable table;
+ FEFaceValues<dim> x_fe_face_values(mapping,
+ fe,
+ quadrature,
+ update_JxW_values);
+ ConvergenceTable table;
for (unsigned int refinement = 0; refinement < (degree != 4 ? 6 : 4);
++refinement, triangulation.refine_global(1))
template <int dim>
-LaplaceProblem<dim>::LaplaceProblem(const unsigned int mapping_degree) :
- fe(1),
- dof_handler(triangulation),
- mapping(mapping_degree)
+LaplaceProblem<dim>::LaplaceProblem(const unsigned int mapping_degree)
+ : fe(1)
+ , dof_handler(triangulation)
+ , mapping(mapping_degree)
{
deallog << "Using mapping with degree " << mapping_degree << ":" << std::endl
<< "============================" << std::endl;
system_rhs.reinit(dof_handler.n_dofs());
std::vector<bool> boundary_dofs(dof_handler.n_dofs(), false);
- DoFTools::extract_boundary_dofs(
- dof_handler, std::vector<bool>(1, true), boundary_dofs);
+ DoFTools::extract_boundary_dofs(dof_handler,
+ std::vector<bool>(1, true),
+ boundary_dofs);
const unsigned int first_boundary_dof =
std::distance(boundary_dofs.begin(),
void
LaplaceProblem<dim>::assemble_and_solve()
{
- const unsigned int gauss_degree = std::max(
- static_cast<unsigned int>(std::ceil(1. * (mapping.get_degree() + 1) / 2)),
- 2U);
- MatrixTools::create_laplace_matrix(
- mapping, dof_handler, QGauss<dim>(gauss_degree), system_matrix);
+ const unsigned int gauss_degree =
+ std::max(static_cast<unsigned int>(
+ std::ceil(1. * (mapping.get_degree() + 1) / 2)),
+ 2U);
+ MatrixTools::create_laplace_matrix(mapping,
+ dof_handler,
+ QGauss<dim>(gauss_degree),
+ system_matrix);
VectorTools::create_right_hand_side(mapping,
dof_handler,
QGauss<dim>(gauss_degree),
Functions::ConstantFunction<dim>(-2),
system_rhs);
Vector<double> tmp(system_rhs.size());
- VectorTools::create_boundary_right_hand_side(
- mapping,
- dof_handler,
- QGauss<dim - 1>(gauss_degree),
- Functions::ConstantFunction<dim>(1),
- tmp);
+ VectorTools::create_boundary_right_hand_side(mapping,
+ dof_handler,
+ QGauss<dim - 1>(gauss_degree),
+ Functions::ConstantFunction<dim>(
+ 1),
+ tmp);
system_rhs += tmp;
mean_value_constraints.condense(system_matrix);
template <int dim>
-DGTransportEquation<dim>::DGTransportEquation() :
- beta_function(),
- rhs_function(),
- boundary_function()
+DGTransportEquation<dim>::DGTransportEquation()
+ : beta_function()
+ , rhs_function()
+ , boundary_function()
{}
template <int dim>
-DGMethod<dim>::DGMethod() :
- mapping(1),
- fe(1),
- dof_handler(triangulation),
- quadrature(4),
- face_quadrature(4),
- dg()
+DGMethod<dim>::DGMethod()
+ : mapping(1)
+ , fe(1)
+ , dof_handler(triangulation)
+ , quadrature(4)
+ , face_quadrature(4)
+ , dg()
{}
FEValues<dim> fe_v(mapping, fe, quadrature, update_flags);
FEFaceValues<dim> fe_v_face(mapping, fe, face_quadrature, face_update_flags);
- FESubfaceValues<dim> fe_v_subface(
- mapping, fe, face_quadrature, face_update_flags);
- FEFaceValues<dim> fe_v_face_neighbor(
- mapping, fe, face_quadrature, neighbor_face_update_flags);
- FESubfaceValues<dim> fe_v_subface_neighbor(
- mapping, fe, face_quadrature, neighbor_face_update_flags);
+ FESubfaceValues<dim> fe_v_subface(mapping,
+ fe,
+ face_quadrature,
+ face_update_flags);
+ FEFaceValues<dim> fe_v_face_neighbor(mapping,
+ fe,
+ face_quadrature,
+ neighbor_face_update_flags);
+ FESubfaceValues<dim> fe_v_subface_neighbor(mapping,
+ fe,
+ face_quadrature,
+ neighbor_face_update_flags);
FullMatrix<double> ui_vi_matrix(dofs_per_cell, dofs_per_cell);
FullMatrix<double> ue_vi_matrix(dofs_per_cell, dofs_per_cell);
for (unsigned int i = 0; i < dofs_per_cell; ++i)
for (unsigned int k = 0; k < dofs_per_cell; ++k)
- system_matrix.add(
- dofs[i], dofs_neighbor[k], ue_vi_matrix(i, k));
+ system_matrix.add(dofs[i],
+ dofs_neighbor[k],
+ ue_vi_matrix(i, k));
}
}
else
ExcInternalError());
fe_v_face.reinit(cell, face_no);
- fe_v_subface_neighbor.reinit(
- neighbor, neighbor_face_no, neighbor_subface_no);
+ fe_v_subface_neighbor.reinit(neighbor,
+ neighbor_face_no,
+ neighbor_subface_no);
dg.assemble_face_term1(fe_v_face,
fe_v_subface_neighbor,
for (unsigned int i = 0; i < dofs_per_cell; ++i)
for (unsigned int k = 0; k < dofs_per_cell; ++k)
- system_matrix.add(
- dofs[i], dofs_neighbor[k], ue_vi_matrix(i, k));
+ system_matrix.add(dofs[i],
+ dofs_neighbor[k],
+ ue_vi_matrix(i, k));
}
}
}
FEValues<dim> fe_v(mapping, fe, quadrature, update_flags);
FEFaceValues<dim> fe_v_face(mapping, fe, face_quadrature, face_update_flags);
- FESubfaceValues<dim> fe_v_subface(
- mapping, fe, face_quadrature, face_update_flags);
- FEFaceValues<dim> fe_v_face_neighbor(
- mapping, fe, face_quadrature, neighbor_face_update_flags);
+ FESubfaceValues<dim> fe_v_subface(mapping,
+ fe,
+ face_quadrature,
+ face_update_flags);
+ FEFaceValues<dim> fe_v_face_neighbor(mapping,
+ fe,
+ face_quadrature,
+ neighbor_face_update_flags);
FullMatrix<double> ui_vi_matrix(dofs_per_cell, dofs_per_cell);
for (unsigned int i = 0; i < dofs_per_cell; ++i)
for (unsigned int j = 0; j < dofs_per_cell; ++j)
{
- system_matrix.add(
- dofs[i], dofs_neighbor[j], ue_vi_matrix(i, j));
- system_matrix.add(
- dofs_neighbor[i], dofs[j], ui_ve_matrix(i, j));
+ system_matrix.add(dofs[i],
+ dofs_neighbor[j],
+ ue_vi_matrix(i, j));
+ system_matrix.add(dofs_neighbor[i],
+ dofs[j],
+ ui_ve_matrix(i, j));
system_matrix.add(dofs_neighbor[i],
dofs_neighbor[j],
ue_ve_matrix(i, j));
for (unsigned int i = 0; i < dofs_per_cell; ++i)
for (unsigned int j = 0; j < dofs_per_cell; ++j)
{
- system_matrix.add(
- dofs[i], dofs_neighbor[j], ue_vi_matrix(i, j));
- system_matrix.add(
- dofs_neighbor[i], dofs[j], ui_ve_matrix(i, j));
+ system_matrix.add(dofs[i],
+ dofs_neighbor[j],
+ ue_vi_matrix(i, j));
+ system_matrix.add(dofs_neighbor[i],
+ dofs[j],
+ ui_ve_matrix(i, j));
system_matrix.add(dofs_neighbor[i],
dofs_neighbor[j],
ue_ve_matrix(i, j));
{
Vector<float> gradient_indicator(triangulation.n_active_cells());
- DerivativeApproximation::approximate_gradient(
- mapping, dof_handler, solution2, gradient_indicator);
+ DerivativeApproximation::approximate_gradient(mapping,
+ dof_handler,
+ solution2,
+ gradient_indicator);
typename DoFHandler<dim>::active_cell_iterator cell =
dof_handler.begin_active(),
gradient_indicator(cell_no) *=
std::pow(cell->diameter(), 1 + 1.0 * dim / 2);
- GridRefinement::refine_and_coarsen_fixed_number(
- triangulation, gradient_indicator, 0.3, 0.1);
+ GridRefinement::refine_and_coarsen_fixed_number(triangulation,
+ gradient_indicator,
+ 0.3,
+ 0.1);
triangulation.execute_coarsening_and_refinement();
}
template <int dim>
PointValueEvaluation<dim>::PointValueEvaluation(
const Point<dim> &evaluation_point,
- TableHandler & results_table) :
- evaluation_point(evaluation_point),
- results_table(results_table)
+ TableHandler & results_table)
+ : evaluation_point(evaluation_point)
+ , results_table(results_table)
{}
template <int dim>
SolutionOutput<dim>::SolutionOutput(
const std::string & output_name_base,
- const DataOutBase::OutputFormat output_format) :
- output_name_base(output_name_base),
- output_format(output_format)
+ const DataOutBase::OutputFormat output_format)
+ : output_name_base(output_name_base)
+ , output_format(output_format)
{}
template <int dim>
- Base<dim>::Base(Triangulation<dim> &coarse_grid) : triangulation(&coarse_grid)
+ Base<dim>::Base(Triangulation<dim> &coarse_grid)
+ : triangulation(&coarse_grid)
{}
Solver<dim>::Solver(Triangulation<dim> & triangulation,
const FiniteElement<dim> &fe,
const Quadrature<dim> & quadrature,
- const Function<dim> & boundary_values) :
- Base<dim>(triangulation),
- fe(&fe),
- quadrature(&quadrature),
- dof_handler(triangulation),
- boundary_values(&boundary_values)
+ const Function<dim> & boundary_values)
+ : Base<dim>(triangulation)
+ , fe(&fe)
+ , quadrature(&quadrature)
+ , dof_handler(triangulation)
+ , boundary_values(&boundary_values)
{}
const unsigned int n_threads = MultithreadInfo::n_threads();
std::vector<std::pair<active_cell_iterator, active_cell_iterator>>
- thread_ranges = Threads::split_range<active_cell_iterator>(
- dof_handler.begin_active(), dof_handler.end(), n_threads);
+ thread_ranges =
+ Threads::split_range<active_cell_iterator>(dof_handler.begin_active(),
+ dof_handler.end(),
+ n_threads);
Threads::Mutex mutex;
Threads::ThreadGroup<> threads;
linear_system.hanging_node_constraints.condense(linear_system.rhs);
std::map<types::global_dof_index, double> boundary_value_map;
- VectorTools::interpolate_boundary_values(
- dof_handler, 0, *boundary_values, boundary_value_map);
+ VectorTools::interpolate_boundary_values(dof_handler,
+ 0,
+ *boundary_values,
+ boundary_value_map);
threads.join_all();
linear_system.hanging_node_constraints.condense(linear_system.matrix);
- MatrixTools::apply_boundary_values(
- boundary_value_map, linear_system.matrix, solution, linear_system.rhs);
+ MatrixTools::apply_boundary_values(boundary_value_map,
+ linear_system.matrix,
+ solution,
+ linear_system.rhs);
}
const typename DoFHandler<dim>::active_cell_iterator &end_cell,
Threads::Mutex & mutex) const
{
- FEValues<dim> fe_values(
- *fe, *quadrature, update_gradients | update_JxW_values);
+ FEValues<dim> fe_values(*fe,
+ *quadrature,
+ update_gradients | update_JxW_values);
const unsigned int dofs_per_cell = fe->dofs_per_cell;
const unsigned int n_q_points = quadrature->size();
Threads::Mutex::ScopedLock lock(mutex);
for (unsigned int i = 0; i < dofs_per_cell; ++i)
for (unsigned int j = 0; j < dofs_per_cell; ++j)
- linear_system.matrix.add(
- local_dof_indices[i], local_dof_indices[j], cell_matrix(i, j));
+ linear_system.matrix.add(local_dof_indices[i],
+ local_dof_indices[j],
+ cell_matrix(i, j));
};
}
const FiniteElement<dim> &fe,
const Quadrature<dim> & quadrature,
const Function<dim> & rhs_function,
- const Function<dim> & boundary_values) :
- Base<dim>(triangulation),
- Solver<dim>(triangulation, fe, quadrature, boundary_values),
- rhs_function(&rhs_function)
+ const Function<dim> & boundary_values)
+ : Base<dim>(triangulation)
+ , Solver<dim>(triangulation, fe, quadrature, boundary_values)
+ , rhs_function(&rhs_function)
{}
template <int dim>
- RefinementGlobal<dim>::RefinementGlobal(
- Triangulation<dim> & coarse_grid,
- const FiniteElement<dim> &fe,
- const Quadrature<dim> & quadrature,
- const Function<dim> & rhs_function,
- const Function<dim> & boundary_values) :
- Base<dim>(coarse_grid),
- PrimalSolver<dim>(coarse_grid,
- fe,
- quadrature,
- rhs_function,
- boundary_values)
+ RefinementGlobal<dim>::RefinementGlobal(Triangulation<dim> & coarse_grid,
+ const FiniteElement<dim> &fe,
+ const Quadrature<dim> & quadrature,
+ const Function<dim> &rhs_function,
+ const Function<dim> &boundary_values)
+ : Base<dim>(coarse_grid)
+ , PrimalSolver<dim>(coarse_grid,
+ fe,
+ quadrature,
+ rhs_function,
+ boundary_values)
{}
const FiniteElement<dim> &fe,
const Quadrature<dim> & quadrature,
const Function<dim> & rhs_function,
- const Function<dim> &boundary_values) :
- Base<dim>(coarse_grid),
- PrimalSolver<dim>(coarse_grid,
- fe,
- quadrature,
- rhs_function,
- boundary_values)
+ const Function<dim> &boundary_values)
+ : Base<dim>(coarse_grid)
+ , PrimalSolver<dim>(coarse_grid,
+ fe,
+ quadrature,
+ rhs_function,
+ boundary_values)
{}
typename FunctionMap<dim>::type(),
this->solution,
estimated_error_per_cell);
- GridRefinement::refine_and_coarsen_fixed_number(
- *this->triangulation, estimated_error_per_cell, 0.3, 0.03);
+ GridRefinement::refine_and_coarsen_fixed_number(*this->triangulation,
+ estimated_error_per_cell,
+ 0.3,
+ 0.03);
this->triangulation->execute_coarsening_and_refinement();
}
class Solution : public Function<dim>
{
public:
- Solution() : Function<dim>()
+ Solution()
+ : Function<dim>()
{}
virtual double
class RightHandSide : public Function<dim>
{
public:
- RightHandSide() : Function<dim>()
+ RightHandSide()
+ : Function<dim>()
{}
virtual double
Evaluation::PointValueEvaluation<dim> postprocessor1(Point<dim>(0.5, 0.5),
results_table);
- Evaluation::SolutionOutput<dim> postprocessor2(
- std::string("solution-") + solver_name, DataOutBase::gnuplot);
+ Evaluation::SolutionOutput<dim> postprocessor2(std::string("solution-") +
+ solver_name,
+ DataOutBase::gnuplot);
std::list<Evaluation::EvaluationBase<dim> *> postprocessor_list;
postprocessor_list.push_back(&postprocessor1);
template <int dim>
PointValueEvaluation<dim>::PointValueEvaluation(
- const Point<dim> &evaluation_point) :
- evaluation_point(evaluation_point)
+ const Point<dim> &evaluation_point)
+ : evaluation_point(evaluation_point)
{}
template <int dim>
PointXDerivativeEvaluation<dim>::PointXDerivativeEvaluation(
- const Point<dim> &evaluation_point) :
- evaluation_point(evaluation_point)
+ const Point<dim> &evaluation_point)
+ : evaluation_point(evaluation_point)
{}
template <int dim>
- GridOutput<dim>::GridOutput(const std::string &output_name_base) :
- output_name_base(output_name_base)
+ GridOutput<dim>::GridOutput(const std::string &output_name_base)
+ : output_name_base(output_name_base)
{}
template <int dim>
- Base<dim>::Base(Triangulation<dim> &coarse_grid) : triangulation(&coarse_grid)
+ Base<dim>::Base(Triangulation<dim> &coarse_grid)
+ : triangulation(&coarse_grid)
{}
const FiniteElement<dim> & fe,
const Quadrature<dim> & quadrature,
const Quadrature<dim - 1> &face_quadrature,
- const Function<dim> & boundary_values) :
- Base<dim>(triangulation),
- fe(&fe),
- quadrature(&quadrature),
- face_quadrature(&face_quadrature),
- dof_handler(triangulation),
- boundary_values(&boundary_values)
+ const Function<dim> & boundary_values)
+ : Base<dim>(triangulation)
+ , fe(&fe)
+ , quadrature(&quadrature)
+ , face_quadrature(&face_quadrature)
+ , dof_handler(triangulation)
+ , boundary_values(&boundary_values)
{}
const unsigned int n_threads = MultithreadInfo::n_threads();
std::vector<std::pair<active_cell_iterator, active_cell_iterator>>
- thread_ranges = Threads::split_range<active_cell_iterator>(
- dof_handler.begin_active(), dof_handler.end(), n_threads);
+ thread_ranges =
+ Threads::split_range<active_cell_iterator>(dof_handler.begin_active(),
+ dof_handler.end(),
+ n_threads);
{
Threads::Mutex mutex;
linear_system.hanging_node_constraints.condense(linear_system.rhs);
std::map<types::global_dof_index, double> boundary_value_map;
- VectorTools::interpolate_boundary_values(
- dof_handler, 0, *boundary_values, boundary_value_map);
+ VectorTools::interpolate_boundary_values(dof_handler,
+ 0,
+ *boundary_values,
+ boundary_value_map);
linear_system.hanging_node_constraints.condense(linear_system.matrix);
- MatrixTools::apply_boundary_values(
- boundary_value_map, linear_system.matrix, solution, linear_system.rhs);
+ MatrixTools::apply_boundary_values(boundary_value_map,
+ linear_system.matrix,
+ solution,
+ linear_system.rhs);
}
const typename DoFHandler<dim>::active_cell_iterator &end_cell,
Threads::Mutex & mutex) const
{
- FEValues<dim> fe_values(
- *fe, *quadrature, update_gradients | update_JxW_values);
+ FEValues<dim> fe_values(*fe,
+ *quadrature,
+ update_gradients | update_JxW_values);
const unsigned int dofs_per_cell = fe->dofs_per_cell;
const unsigned int n_q_points = quadrature->size();
Threads::Mutex::ScopedLock lock(mutex);
for (unsigned int i = 0; i < dofs_per_cell; ++i)
for (unsigned int j = 0; j < dofs_per_cell; ++j)
- linear_system.matrix.add(
- local_dof_indices[i], local_dof_indices[j], cell_matrix(i, j));
+ linear_system.matrix.add(local_dof_indices[i],
+ local_dof_indices[j],
+ cell_matrix(i, j));
};
}
const Quadrature<dim> & quadrature,
const Quadrature<dim - 1> &face_quadrature,
const Function<dim> & rhs_function,
- const Function<dim> & boundary_values) :
- Base<dim>(triangulation),
- Solver<dim>(triangulation,
- fe,
- quadrature,
- face_quadrature,
- boundary_values),
- rhs_function(&rhs_function)
+ const Function<dim> & boundary_values)
+ : Base<dim>(triangulation)
+ , Solver<dim>(triangulation,
+ fe,
+ quadrature,
+ face_quadrature,
+ boundary_values)
+ , rhs_function(&rhs_function)
{}
const Quadrature<dim> & quadrature,
const Quadrature<dim - 1> &face_quadrature,
const Function<dim> & rhs_function,
- const Function<dim> & boundary_values) :
- Base<dim>(coarse_grid),
- PrimalSolver<dim>(coarse_grid,
- fe,
- quadrature,
- face_quadrature,
- rhs_function,
- boundary_values)
+ const Function<dim> & boundary_values)
+ : Base<dim>(coarse_grid)
+ , PrimalSolver<dim>(coarse_grid,
+ fe,
+ quadrature,
+ face_quadrature,
+ rhs_function,
+ boundary_values)
{}
const Quadrature<dim> & quadrature,
const Quadrature<dim - 1> &face_quadrature,
const Function<dim> & rhs_function,
- const Function<dim> & boundary_values) :
- Base<dim>(coarse_grid),
- PrimalSolver<dim>(coarse_grid,
- fe,
- quadrature,
- face_quadrature,
- rhs_function,
- boundary_values)
+ const Function<dim> & boundary_values)
+ : Base<dim>(coarse_grid)
+ , PrimalSolver<dim>(coarse_grid,
+ fe,
+ quadrature,
+ face_quadrature,
+ rhs_function,
+ boundary_values)
{}
typename FunctionMap<dim>::type(),
this->solution,
estimated_error_per_cell);
- GridRefinement::refine_and_coarsen_fixed_number(
- *this->triangulation, estimated_error_per_cell, 0.3, 0.03);
+ GridRefinement::refine_and_coarsen_fixed_number(*this->triangulation,
+ estimated_error_per_cell,
+ 0.3,
+ 0.03);
this->triangulation->execute_coarsening_and_refinement();
}
const Quadrature<dim - 1> &face_quadrature,
const Function<dim> & rhs_function,
const Function<dim> & boundary_values,
- const Function<dim> & weighting_function) :
- Base<dim>(coarse_grid),
- PrimalSolver<dim>(coarse_grid,
- fe,
- quadrature,
- face_quadrature,
- rhs_function,
- boundary_values),
- weighting_function(&weighting_function)
+ const Function<dim> & weighting_function)
+ : Base<dim>(coarse_grid)
+ , PrimalSolver<dim>(coarse_grid,
+ fe,
+ quadrature,
+ face_quadrature,
+ rhs_function,
+ boundary_values)
+ , weighting_function(&weighting_function)
{}
for (unsigned int cell_index = 0; cell != endc; ++cell, ++cell_index)
estimated_error(cell_index) *= weighting_function->value(cell->center());
- GridRefinement::refine_and_coarsen_fixed_number(
- *this->triangulation, estimated_error, 0.3, 0.03);
+ GridRefinement::refine_and_coarsen_fixed_number(*this->triangulation,
+ estimated_error,
+ 0.3,
+ 0.03);
this->triangulation->execute_coarsening_and_refinement();
}
class BoundaryValues : public Function<dim>
{
public:
- BoundaryValues() : Function<dim>()
+ BoundaryValues()
+ : Function<dim>()
{}
virtual double
class RightHandSide : public Function<dim>
{
public:
- RightHandSide() : Function<dim>()
+ RightHandSide()
+ : Function<dim>()
{}
virtual double
class RightHandSide : public Functions::ConstantFunction<dim>
{
public:
- RightHandSide() : Functions::ConstantFunction<dim>(1.)
+ RightHandSide()
+ : Functions::ConstantFunction<dim>(1.)
{}
};
template <int dim>
PointValueEvaluation<dim>::PointValueEvaluation(
- const Point<dim> &evaluation_point) :
- evaluation_point(evaluation_point)
+ const Point<dim> &evaluation_point)
+ : evaluation_point(evaluation_point)
{}
template <int dim>
PointXDerivativeEvaluation<dim>::PointXDerivativeEvaluation(
- const Point<dim> &evaluation_point) :
- evaluation_point(evaluation_point)
+ const Point<dim> &evaluation_point)
+ : evaluation_point(evaluation_point)
{}
const FiniteElement<dim> & fe,
const Quadrature<dim> & quadrature,
const Quadrature<dim - 1> & face_quadrature,
- const DualFunctional::DualFunctionalBase<dim> &dual_functional) :
- Base<dim>(triangulation),
- Solver<dim>(triangulation,
- fe,
- quadrature,
- face_quadrature,
- boundary_values),
- dual_functional(&dual_functional)
+ const DualFunctional::DualFunctionalBase<dim> &dual_functional)
+ : Base<dim>(triangulation)
+ , Solver<dim>(triangulation,
+ fe,
+ quadrature,
+ face_quadrature,
+ boundary_values)
+ , dual_functional(&dual_functional)
{}
WeightedResidual<dim>::CellData::CellData(
const FiniteElement<dim> &fe,
const Quadrature<dim> & quadrature,
- const Function<dim> & right_hand_side) :
- fe_values(fe,
- quadrature,
- update_values | update_hessians | update_quadrature_points |
- update_JxW_values),
- right_hand_side(&right_hand_side)
+ const Function<dim> & right_hand_side)
+ : fe_values(fe,
+ quadrature,
+ update_values | update_hessians | update_quadrature_points |
+ update_JxW_values)
+ , right_hand_side(&right_hand_side)
{
const unsigned int n_q_points = quadrature.size();
template <int dim>
WeightedResidual<dim>::FaceData::FaceData(
const FiniteElement<dim> & fe,
- const Quadrature<dim - 1> &face_quadrature) :
- fe_face_values_cell(fe,
- face_quadrature,
- update_values | update_gradients | update_JxW_values |
- update_normal_vectors),
- fe_face_values_neighbor(fe,
- face_quadrature,
- update_values | update_gradients |
- update_JxW_values | update_normal_vectors),
- fe_subface_values_cell(fe, face_quadrature, update_gradients)
+ const Quadrature<dim - 1> &face_quadrature)
+ : fe_face_values_cell(fe,
+ face_quadrature,
+ update_values | update_gradients | update_JxW_values |
+ update_normal_vectors)
+ , fe_face_values_neighbor(fe,
+ face_quadrature,
+ update_values | update_gradients |
+ update_JxW_values | update_normal_vectors)
+ , fe_subface_values_cell(fe, face_quadrature, update_gradients)
{
const unsigned int n_face_q_points = face_quadrature.size();
const Quadrature<dim - 1> & face_quadrature,
const Function<dim> & rhs_function,
const Function<dim> & bv,
- const DualFunctional::DualFunctionalBase<dim> &dual_functional) :
- Base<dim>(coarse_grid),
- PrimalSolver<dim>(coarse_grid,
- primal_fe,
+ const DualFunctional::DualFunctionalBase<dim> &dual_functional)
+ : Base<dim>(coarse_grid)
+ , PrimalSolver<dim>(coarse_grid,
+ primal_fe,
+ quadrature,
+ face_quadrature,
+ rhs_function,
+ bv)
+ , DualSolver<dim>(coarse_grid,
+ dual_fe,
quadrature,
face_quadrature,
- rhs_function,
- bv),
- DualSolver<dim>(coarse_grid,
- dual_fe,
- quadrature,
- face_quadrature,
- dual_functional)
+ dual_functional)
{}
++i)
*i = std::fabs(*i);
- GridRefinement::refine_and_coarsen_fixed_fraction(
- *this->triangulation, error_indicators, 0.8, 0.02);
+ GridRefinement::refine_and_coarsen_fixed_fraction(*this->triangulation,
+ error_indicators,
+ 0.8,
+ 0.02);
this->triangulation->execute_coarsening_and_refinement();
}
0.5 * face_integrals[cell->face(face_no)];
};
deallog << " Estimated error="
- << std::accumulate(
- error_indicators.begin(), error_indicators.end(), 0.)
+ << std::accumulate(error_indicators.begin(),
+ error_indicators.end(),
+ 0.)
<< std::endl;
}
const PrimalSolver<dim> &primal_solver = *this;
const DualSolver<dim> & dual_solver = *this;
- CellData cell_data(
- *dual_solver.fe, *dual_solver.quadrature, *primal_solver.rhs_function);
+ CellData cell_data(*dual_solver.fe,
+ *dual_solver.quadrature,
+ *primal_solver.rhs_function);
FaceData face_data(*dual_solver.fe, *dual_solver.face_quadrature);
active_cell_iterator cell = dual_solver.dof_handler.begin_active();
template <int dim>
-Framework<dim>::ProblemDescription::ProblemDescription() :
- primal_fe_degree(1),
- dual_fe_degree(2),
- refinement_criterion(dual_weighted_error_estimator),
- max_degrees_of_freedom(5000)
+Framework<dim>::ProblemDescription::ProblemDescription()
+ : primal_fe_degree(1)
+ , dual_fe_degree(2)
+ , refinement_criterion(dual_weighted_error_estimator)
+ , max_degrees_of_freedom(5000)
{}
template <int dim>
-LaplaceProblem<dim>::LaplaceProblem() :
- triangulation(Triangulation<dim>::limit_level_difference_at_vertices),
- fe(1),
- mg_dof_handler(triangulation)
+LaplaceProblem<dim>::LaplaceProblem()
+ : triangulation(Triangulation<dim>::limit_level_difference_at_vertices)
+ , fe(1)
+ , mg_dof_handler(triangulation)
{}
for (unsigned int i = 0; i < dofs_per_cell; ++i)
{
for (unsigned int j = 0; j < dofs_per_cell; ++j)
- system_matrix.add(
- local_dof_indices[i], local_dof_indices[j], cell_matrix(i, j));
+ system_matrix.add(local_dof_indices[i],
+ local_dof_indices[j],
+ cell_matrix(i, j));
system_rhs(local_dof_indices[i]) += cell_rhs(i);
};
for (unsigned int i = 0; i < dofs_per_cell; ++i)
{
for (unsigned int j = 0; j < dofs_per_cell; ++j)
- mg_matrices[level].add(
- local_dof_indices[i], local_dof_indices[j], cell_matrix(i, j));
+ mg_matrices[level].add(local_dof_indices[i],
+ local_dof_indices[j],
+ cell_matrix(i, j));
};
};
}
static const FE_Q<2> finite_element(1);
dof_handler.distribute_dofs(finite_element);
- SparsityPattern sparsity_pattern(
- dof_handler.n_dofs(), dof_handler.n_dofs(), 20);
+ SparsityPattern sparsity_pattern(dof_handler.n_dofs(),
+ dof_handler.n_dofs(),
+ 20);
DoFTools::make_sparsity_pattern(dof_handler, sparsity_pattern);
sparsity_pattern.compress();
};
-LaplaceProblem::LaplaceProblem() : fe(1), dof_handler(triangulation)
+LaplaceProblem::LaplaceProblem()
+ : fe(1)
+ , dof_handler(triangulation)
{}
for (unsigned int i = 0; i < dofs_per_cell; ++i)
for (unsigned int j = 0; j < dofs_per_cell; ++j)
- system_matrix.add(
- local_dof_indices[i], local_dof_indices[j], cell_matrix(i, j));
+ system_matrix.add(local_dof_indices[i],
+ local_dof_indices[j],
+ cell_matrix(i, j));
for (unsigned int i = 0; i < dofs_per_cell; ++i)
system_rhs(local_dof_indices[i]) += cell_rhs(i);
std::map<types::global_dof_index, double> boundary_values;
- VectorTools::interpolate_boundary_values(
- dof_handler, 0, Functions::ZeroFunction<2>(), boundary_values);
- MatrixTools::apply_boundary_values(
- boundary_values, system_matrix, solution, system_rhs);
+ VectorTools::interpolate_boundary_values(dof_handler,
+ 0,
+ Functions::ZeroFunction<2>(),
+ boundary_values);
+ MatrixTools::apply_boundary_values(boundary_values,
+ system_matrix,
+ solution,
+ system_rhs);
}
class RightHandSide : public Function<dim>
{
public:
- RightHandSide() : Function<dim>()
+ RightHandSide()
+ : Function<dim>()
{}
virtual double
class BoundaryValues : public Function<dim>
{
public:
- BoundaryValues() : Function<dim>()
+ BoundaryValues()
+ : Function<dim>()
{}
virtual double
template <int dim>
-LaplaceProblem<dim>::LaplaceProblem() : fe(1), dof_handler(triangulation)
+LaplaceProblem<dim>::LaplaceProblem()
+ : fe(1)
+ , dof_handler(triangulation)
{}
for (unsigned int i = 0; i < dofs_per_cell; ++i)
{
for (unsigned int j = 0; j < dofs_per_cell; ++j)
- system_matrix.add(
- local_dof_indices[i], local_dof_indices[j], cell_matrix(i, j));
+ system_matrix.add(local_dof_indices[i],
+ local_dof_indices[j],
+ cell_matrix(i, j));
system_rhs(local_dof_indices[i]) += cell_rhs(i);
}
std::map<types::global_dof_index, double> boundary_values;
- VectorTools::interpolate_boundary_values(
- dof_handler, 0, BoundaryValues<dim>(), boundary_values);
- MatrixTools::apply_boundary_values(
- boundary_values, system_matrix, solution, system_rhs);
+ VectorTools::interpolate_boundary_values(dof_handler,
+ 0,
+ BoundaryValues<dim>(),
+ boundary_values);
+ MatrixTools::apply_boundary_values(boundary_values,
+ system_matrix,
+ solution,
+ system_rhs);
}
template <int dim>
-Step4<dim>::Step4() : fe(1), dof_handler(triangulation)
+Step4<dim>::Step4()
+ : fe(1)
+ , dof_handler(triangulation)
{}
template <int dim>
-Step4<dim>::Step4() : fe(1), dof_handler(triangulation)
+Step4<dim>::Step4()
+ : fe(1)
+ , dof_handler(triangulation)
{}
class Coefficient : public Function<dim>
{
public:
- Coefficient() : Function<dim>()
+ Coefficient()
+ : Function<dim>()
{}
virtual double
template <int dim>
-LaplaceProblem<dim>::LaplaceProblem() : fe(1), dof_handler(triangulation)
+LaplaceProblem<dim>::LaplaceProblem()
+ : fe(1)
+ , dof_handler(triangulation)
{}
for (unsigned int i = 0; i < dofs_per_cell; ++i)
{
for (unsigned int j = 0; j < dofs_per_cell; ++j)
- system_matrix.add(
- local_dof_indices[i], local_dof_indices[j], cell_matrix(i, j));
+ system_matrix.add(local_dof_indices[i],
+ local_dof_indices[j],
+ cell_matrix(i, j));
system_rhs(local_dof_indices[i]) += cell_rhs(i);
}
}
std::map<types::global_dof_index, double> boundary_values;
- VectorTools::interpolate_boundary_values(
- dof_handler, 0, Functions::ZeroFunction<dim>(), boundary_values);
- MatrixTools::apply_boundary_values(
- boundary_values, system_matrix, solution, system_rhs);
+ VectorTools::interpolate_boundary_values(dof_handler,
+ 0,
+ Functions::ZeroFunction<dim>(),
+ boundary_values);
+ MatrixTools::apply_boundary_values(boundary_values,
+ system_matrix,
+ solution,
+ system_rhs);
}
template <>
const Point<1>
- SolutionBase<1>::source_centers[SolutionBase<1>::n_source_centers] = {
- Point<1>(-1.0 / 3.0),
- Point<1>(0.0),
- Point<1>(+1.0 / 3.0)};
+ SolutionBase<1>::source_centers[SolutionBase<1>::n_source_centers] =
+ {Point<1>(-1.0 / 3.0), Point<1>(0.0), Point<1>(+1.0 / 3.0)};
template <>
const Point<2>
- SolutionBase<2>::source_centers[SolutionBase<2>::n_source_centers] = {
- Point<2>(-0.5, +0.5),
- Point<2>(-0.5, -0.5),
- Point<2>(+0.5, -0.5)};
+ SolutionBase<2>::source_centers[SolutionBase<2>::n_source_centers] =
+ {Point<2>(-0.5, +0.5), Point<2>(-0.5, -0.5), Point<2>(+0.5, -0.5)};
template <>
const Point<3>
class Solution : public Function<dim>, protected SolutionBase<dim>
{
public:
- Solution() : Function<dim>()
+ Solution()
+ : Function<dim>()
{}
virtual double
class SolutionAndGradient : public Function<dim>, protected SolutionBase<dim>
{
public:
- SolutionAndGradient() : Function<dim>(dim + 1)
+ SolutionAndGradient()
+ : Function<dim>(dim + 1)
{}
virtual void
class ConvectionVelocity : public TensorFunction<1, dim>
{
public:
- ConvectionVelocity() : TensorFunction<1, dim>()
+ ConvectionVelocity()
+ : TensorFunction<1, dim>()
{}
virtual Tensor<1, dim>
class RightHandSide : public Function<dim>, protected SolutionBase<dim>
{
public:
- RightHandSide() : Function<dim>()
+ RightHandSide()
+ : Function<dim>()
{}
virtual double
template <int dim>
- HDG<dim>::HDG(const unsigned int degree) :
- fe_local(FE_DGQ<dim>(degree), dim + 1),
- dof_handler_local(triangulation),
- fe(degree),
- dof_handler(triangulation),
- fe_u_post(degree + 1),
- dof_handler_u_post(triangulation)
+ HDG<dim>::HDG(const unsigned int degree)
+ : fe_local(FE_DGQ<dim>(degree), dim + 1)
+ , dof_handler_local(triangulation)
+ , fe(degree)
+ , dof_handler(triangulation)
+ , fe_u_post(degree + 1)
+ , dof_handler_u_post(triangulation)
{}
bool trace_reconstruct;
- PerTaskData(const unsigned int n_dofs, const bool trace_reconstruct) :
- cell_matrix(n_dofs, n_dofs),
- cell_vector(n_dofs),
- dof_indices(n_dofs),
- trace_reconstruct(trace_reconstruct)
+ PerTaskData(const unsigned int n_dofs, const bool trace_reconstruct)
+ : cell_matrix(n_dofs, n_dofs)
+ , cell_vector(n_dofs)
+ , dof_indices(n_dofs)
+ , trace_reconstruct(trace_reconstruct)
{}
};
const QGauss<dim - 1> & face_quadrature_formula,
const UpdateFlags local_flags,
const UpdateFlags local_face_flags,
- const UpdateFlags flags) :
- fe_values_local(fe_local, quadrature_formula, local_flags),
- fe_face_values_local(fe_local, face_quadrature_formula, local_face_flags),
- fe_face_values(fe, face_quadrature_formula, flags),
- ll_matrix(fe_local.dofs_per_cell, fe_local.dofs_per_cell),
- lf_matrix(fe_local.dofs_per_cell, fe.dofs_per_cell),
- fl_matrix(fe.dofs_per_cell, fe_local.dofs_per_cell),
- tmp_matrix(fe.dofs_per_cell, fe_local.dofs_per_cell),
- l_rhs(fe_local.dofs_per_cell),
- tmp_rhs(fe_local.dofs_per_cell),
- q_phi(fe_local.dofs_per_cell),
- q_phi_div(fe_local.dofs_per_cell),
- u_phi(fe_local.dofs_per_cell),
- u_phi_grad(fe_local.dofs_per_cell),
- tr_phi(fe.dofs_per_cell),
- trace_values(face_quadrature_formula.size()),
- fe_local_support_on_face(GeometryInfo<dim>::faces_per_cell),
- fe_support_on_face(GeometryInfo<dim>::faces_per_cell)
+ const UpdateFlags flags)
+ : fe_values_local(fe_local, quadrature_formula, local_flags)
+ , fe_face_values_local(fe_local,
+ face_quadrature_formula,
+ local_face_flags)
+ , fe_face_values(fe, face_quadrature_formula, flags)
+ , ll_matrix(fe_local.dofs_per_cell, fe_local.dofs_per_cell)
+ , lf_matrix(fe_local.dofs_per_cell, fe.dofs_per_cell)
+ , fl_matrix(fe.dofs_per_cell, fe_local.dofs_per_cell)
+ , tmp_matrix(fe.dofs_per_cell, fe_local.dofs_per_cell)
+ , l_rhs(fe_local.dofs_per_cell)
+ , tmp_rhs(fe_local.dofs_per_cell)
+ , q_phi(fe_local.dofs_per_cell)
+ , q_phi_div(fe_local.dofs_per_cell)
+ , u_phi(fe_local.dofs_per_cell)
+ , u_phi_grad(fe_local.dofs_per_cell)
+ , tr_phi(fe.dofs_per_cell)
+ , trace_values(face_quadrature_formula.size())
+ , fe_local_support_on_face(GeometryInfo<dim>::faces_per_cell)
+ , fe_support_on_face(GeometryInfo<dim>::faces_per_cell)
{
for (unsigned int face = 0; face < GeometryInfo<dim>::faces_per_cell;
++face)
}
}
- ScratchData(const ScratchData &sd) :
- fe_values_local(sd.fe_values_local.get_fe(),
- sd.fe_values_local.get_quadrature(),
- sd.fe_values_local.get_update_flags()),
- fe_face_values_local(sd.fe_face_values_local.get_fe(),
- sd.fe_face_values_local.get_quadrature(),
- sd.fe_face_values_local.get_update_flags()),
- fe_face_values(sd.fe_face_values.get_fe(),
- sd.fe_face_values.get_quadrature(),
- sd.fe_face_values.get_update_flags()),
- ll_matrix(sd.ll_matrix),
- lf_matrix(sd.lf_matrix),
- fl_matrix(sd.fl_matrix),
- tmp_matrix(sd.tmp_matrix),
- l_rhs(sd.l_rhs),
- tmp_rhs(sd.tmp_rhs),
- q_phi(sd.q_phi),
- q_phi_div(sd.q_phi_div),
- u_phi(sd.u_phi),
- u_phi_grad(sd.u_phi_grad),
- tr_phi(sd.tr_phi),
- trace_values(sd.trace_values),
- fe_local_support_on_face(sd.fe_local_support_on_face),
- fe_support_on_face(sd.fe_support_on_face)
+ ScratchData(const ScratchData &sd)
+ : fe_values_local(sd.fe_values_local.get_fe(),
+ sd.fe_values_local.get_quadrature(),
+ sd.fe_values_local.get_update_flags())
+ , fe_face_values_local(sd.fe_face_values_local.get_fe(),
+ sd.fe_face_values_local.get_quadrature(),
+ sd.fe_face_values_local.get_update_flags())
+ , fe_face_values(sd.fe_face_values.get_fe(),
+ sd.fe_face_values.get_quadrature(),
+ sd.fe_face_values.get_update_flags())
+ , ll_matrix(sd.ll_matrix)
+ , lf_matrix(sd.lf_matrix)
+ , fl_matrix(sd.fl_matrix)
+ , tmp_matrix(sd.tmp_matrix)
+ , l_rhs(sd.l_rhs)
+ , tmp_rhs(sd.tmp_rhs)
+ , q_phi(sd.q_phi)
+ , q_phi_div(sd.q_phi_div)
+ , u_phi(sd.u_phi)
+ , u_phi_grad(sd.u_phi_grad)
+ , tr_phi(sd.tr_phi)
+ , trace_values(sd.trace_values)
+ , fe_local_support_on_face(sd.fe_local_support_on_face)
+ , fe_support_on_face(sd.fe_support_on_face)
{}
};
const FiniteElement<dim> &fe_local,
const QGauss<dim> & quadrature_formula,
const UpdateFlags local_flags,
- const UpdateFlags flags) :
- fe_values_local(fe_local, quadrature_formula, local_flags),
- fe_values(fe, quadrature_formula, flags),
- u_values(quadrature_formula.size()),
- u_gradients(quadrature_formula.size()),
- cell_matrix(fe.dofs_per_cell, fe.dofs_per_cell),
- cell_rhs(fe.dofs_per_cell),
- cell_sol(fe.dofs_per_cell)
+ const UpdateFlags flags)
+ : fe_values_local(fe_local, quadrature_formula, local_flags)
+ , fe_values(fe, quadrature_formula, flags)
+ , u_values(quadrature_formula.size())
+ , u_gradients(quadrature_formula.size())
+ , cell_matrix(fe.dofs_per_cell, fe.dofs_per_cell)
+ , cell_rhs(fe.dofs_per_cell)
+ , cell_sol(fe.dofs_per_cell)
{}
- PostProcessScratchData(const PostProcessScratchData &sd) :
- fe_values_local(sd.fe_values_local.get_fe(),
- sd.fe_values_local.get_quadrature(),
- sd.fe_values_local.get_update_flags()),
- fe_values(sd.fe_values.get_fe(),
- sd.fe_values.get_quadrature(),
- sd.fe_values.get_update_flags()),
- u_values(sd.u_values),
- u_gradients(sd.u_gradients),
- cell_matrix(sd.cell_matrix),
- cell_rhs(sd.cell_rhs),
- cell_sol(sd.cell_sol)
+ PostProcessScratchData(const PostProcessScratchData &sd)
+ : fe_values_local(sd.fe_values_local.get_fe(),
+ sd.fe_values_local.get_quadrature(),
+ sd.fe_values_local.get_update_flags())
+ , fe_values(sd.fe_values.get_fe(),
+ sd.fe_values.get_quadrature(),
+ sd.fe_values.get_update_flags())
+ , u_values(sd.u_values)
+ , u_gradients(sd.u_gradients)
+ , cell_matrix(sd.cell_matrix)
+ , cell_rhs(sd.cell_rhs)
+ , cell_sol(sd.cell_sol)
{}
};
ScratchData & scratch,
PerTaskData & task_data)
{
- typename DoFHandler<dim>::active_cell_iterator loc_cell(
- &triangulation, cell->level(), cell->index(), &dof_handler_local);
+ typename DoFHandler<dim>::active_cell_iterator loc_cell(&triangulation,
+ cell->level(),
+ cell->index(),
+ &dof_handler_local);
const unsigned int n_q_points =
scratch.fe_values_local.get_quadrature().size();
{
scratch.fl_matrix.mmult(scratch.tmp_matrix, scratch.ll_matrix);
scratch.tmp_matrix.vmult_add(task_data.cell_vector, scratch.l_rhs);
- scratch.tmp_matrix.mmult(
- task_data.cell_matrix, scratch.lf_matrix, true);
+ scratch.tmp_matrix.mmult(task_data.cell_matrix,
+ scratch.lf_matrix,
+ true);
cell->get_dof_indices(task_data.dof_indices);
}
else
PostProcessScratchData & scratch,
unsigned int &)
{
- typename DoFHandler<dim>::active_cell_iterator loc_cell(
- &triangulation, cell->level(), cell->index(), &dof_handler_local);
+ typename DoFHandler<dim>::active_cell_iterator loc_cell(&triangulation,
+ cell->level(),
+ cell->index(),
+ &dof_handler_local);
scratch.fe_values_local.reinit(loc_cell);
scratch.fe_values.reinit(cell);
template <>
const Point<1>
- SolutionBase<1>::source_centers[SolutionBase<1>::n_source_centers] = {
- Point<1>(-1.0 / 3.0),
- Point<1>(0.0),
- Point<1>(+1.0 / 3.0)};
+ SolutionBase<1>::source_centers[SolutionBase<1>::n_source_centers] =
+ {Point<1>(-1.0 / 3.0), Point<1>(0.0), Point<1>(+1.0 / 3.0)};
template <>
const Point<2>
- SolutionBase<2>::source_centers[SolutionBase<2>::n_source_centers] = {
- Point<2>(-0.5, +0.5),
- Point<2>(-0.5, -0.5),
- Point<2>(+0.5, -0.5)};
+ SolutionBase<2>::source_centers[SolutionBase<2>::n_source_centers] =
+ {Point<2>(-0.5, +0.5), Point<2>(-0.5, -0.5), Point<2>(+0.5, -0.5)};
template <>
const Point<3>
class Solution : public Function<dim>, protected SolutionBase<dim>
{
public:
- Solution() : Function<dim>()
+ Solution()
+ : Function<dim>()
{}
virtual double
class SolutionAndGradient : public Function<dim>, protected SolutionBase<dim>
{
public:
- SolutionAndGradient() : Function<dim>(dim + 1)
+ SolutionAndGradient()
+ : Function<dim>(dim + 1)
{}
virtual void
class ConvectionVelocity : public TensorFunction<1, dim>
{
public:
- ConvectionVelocity() : TensorFunction<1, dim>()
+ ConvectionVelocity()
+ : TensorFunction<1, dim>()
{}
virtual Tensor<1, dim>
class RightHandSide : public Function<dim>, protected SolutionBase<dim>
{
public:
- RightHandSide() : Function<dim>()
+ RightHandSide()
+ : Function<dim>()
{}
virtual double
template <int dim>
- HDG<dim>::HDG(const unsigned int degree) :
- fe_local(FE_DGP<dim>(degree), dim + 1),
- dof_handler_local(triangulation),
- fe(degree),
- dof_handler(triangulation),
- fe_u_post(degree + 1),
- dof_handler_u_post(triangulation)
+ HDG<dim>::HDG(const unsigned int degree)
+ : fe_local(FE_DGP<dim>(degree), dim + 1)
+ , dof_handler_local(triangulation)
+ , fe(degree)
+ , dof_handler(triangulation)
+ , fe_u_post(degree + 1)
+ , dof_handler_u_post(triangulation)
{}
bool trace_reconstruct;
- PerTaskData(const unsigned int n_dofs, const bool trace_reconstruct) :
- cell_matrix(n_dofs, n_dofs),
- cell_vector(n_dofs),
- dof_indices(n_dofs),
- trace_reconstruct(trace_reconstruct)
+ PerTaskData(const unsigned int n_dofs, const bool trace_reconstruct)
+ : cell_matrix(n_dofs, n_dofs)
+ , cell_vector(n_dofs)
+ , dof_indices(n_dofs)
+ , trace_reconstruct(trace_reconstruct)
{}
};
const QGauss<dim - 1> & face_quadrature_formula,
const UpdateFlags local_flags,
const UpdateFlags local_face_flags,
- const UpdateFlags flags) :
- fe_values_local(fe_local, quadrature_formula, local_flags),
- fe_face_values_local(fe_local, face_quadrature_formula, local_face_flags),
- fe_face_values(fe, face_quadrature_formula, flags),
- ll_matrix(fe_local.dofs_per_cell, fe_local.dofs_per_cell),
- lf_matrix(fe_local.dofs_per_cell, fe.dofs_per_cell),
- fl_matrix(fe.dofs_per_cell, fe_local.dofs_per_cell),
- tmp_matrix(fe.dofs_per_cell, fe_local.dofs_per_cell),
- l_rhs(fe_local.dofs_per_cell),
- tmp_rhs(fe_local.dofs_per_cell),
- q_phi(fe_local.dofs_per_cell),
- q_phi_div(fe_local.dofs_per_cell),
- u_phi(fe_local.dofs_per_cell),
- u_phi_grad(fe_local.dofs_per_cell),
- tr_phi(fe.dofs_per_cell),
- trace_values(face_quadrature_formula.size()),
- fe_local_support_on_face(GeometryInfo<dim>::faces_per_cell),
- fe_support_on_face(GeometryInfo<dim>::faces_per_cell)
+ const UpdateFlags flags)
+ : fe_values_local(fe_local, quadrature_formula, local_flags)
+ , fe_face_values_local(fe_local,
+ face_quadrature_formula,
+ local_face_flags)
+ , fe_face_values(fe, face_quadrature_formula, flags)
+ , ll_matrix(fe_local.dofs_per_cell, fe_local.dofs_per_cell)
+ , lf_matrix(fe_local.dofs_per_cell, fe.dofs_per_cell)
+ , fl_matrix(fe.dofs_per_cell, fe_local.dofs_per_cell)
+ , tmp_matrix(fe.dofs_per_cell, fe_local.dofs_per_cell)
+ , l_rhs(fe_local.dofs_per_cell)
+ , tmp_rhs(fe_local.dofs_per_cell)
+ , q_phi(fe_local.dofs_per_cell)
+ , q_phi_div(fe_local.dofs_per_cell)
+ , u_phi(fe_local.dofs_per_cell)
+ , u_phi_grad(fe_local.dofs_per_cell)
+ , tr_phi(fe.dofs_per_cell)
+ , trace_values(face_quadrature_formula.size())
+ , fe_local_support_on_face(GeometryInfo<dim>::faces_per_cell)
+ , fe_support_on_face(GeometryInfo<dim>::faces_per_cell)
{
for (unsigned int face = 0; face < GeometryInfo<dim>::faces_per_cell;
++face)
}
}
- ScratchData(const ScratchData &sd) :
- fe_values_local(sd.fe_values_local.get_fe(),
- sd.fe_values_local.get_quadrature(),
- sd.fe_values_local.get_update_flags()),
- fe_face_values_local(sd.fe_face_values_local.get_fe(),
- sd.fe_face_values_local.get_quadrature(),
- sd.fe_face_values_local.get_update_flags()),
- fe_face_values(sd.fe_face_values.get_fe(),
- sd.fe_face_values.get_quadrature(),
- sd.fe_face_values.get_update_flags()),
- ll_matrix(sd.ll_matrix),
- lf_matrix(sd.lf_matrix),
- fl_matrix(sd.fl_matrix),
- tmp_matrix(sd.tmp_matrix),
- l_rhs(sd.l_rhs),
- tmp_rhs(sd.tmp_rhs),
- q_phi(sd.q_phi),
- q_phi_div(sd.q_phi_div),
- u_phi(sd.u_phi),
- u_phi_grad(sd.u_phi_grad),
- tr_phi(sd.tr_phi),
- trace_values(sd.trace_values),
- fe_local_support_on_face(sd.fe_local_support_on_face),
- fe_support_on_face(sd.fe_support_on_face)
+ ScratchData(const ScratchData &sd)
+ : fe_values_local(sd.fe_values_local.get_fe(),
+ sd.fe_values_local.get_quadrature(),
+ sd.fe_values_local.get_update_flags())
+ , fe_face_values_local(sd.fe_face_values_local.get_fe(),
+ sd.fe_face_values_local.get_quadrature(),
+ sd.fe_face_values_local.get_update_flags())
+ , fe_face_values(sd.fe_face_values.get_fe(),
+ sd.fe_face_values.get_quadrature(),
+ sd.fe_face_values.get_update_flags())
+ , ll_matrix(sd.ll_matrix)
+ , lf_matrix(sd.lf_matrix)
+ , fl_matrix(sd.fl_matrix)
+ , tmp_matrix(sd.tmp_matrix)
+ , l_rhs(sd.l_rhs)
+ , tmp_rhs(sd.tmp_rhs)
+ , q_phi(sd.q_phi)
+ , q_phi_div(sd.q_phi_div)
+ , u_phi(sd.u_phi)
+ , u_phi_grad(sd.u_phi_grad)
+ , tr_phi(sd.tr_phi)
+ , trace_values(sd.trace_values)
+ , fe_local_support_on_face(sd.fe_local_support_on_face)
+ , fe_support_on_face(sd.fe_support_on_face)
{}
};
const FiniteElement<dim> &fe_local,
const QGauss<dim> & quadrature_formula,
const UpdateFlags local_flags,
- const UpdateFlags flags) :
- fe_values_local(fe_local, quadrature_formula, local_flags),
- fe_values(fe, quadrature_formula, flags),
- u_values(quadrature_formula.size()),
- u_gradients(quadrature_formula.size()),
- cell_matrix(fe.dofs_per_cell, fe.dofs_per_cell),
- cell_rhs(fe.dofs_per_cell),
- cell_sol(fe.dofs_per_cell)
+ const UpdateFlags flags)
+ : fe_values_local(fe_local, quadrature_formula, local_flags)
+ , fe_values(fe, quadrature_formula, flags)
+ , u_values(quadrature_formula.size())
+ , u_gradients(quadrature_formula.size())
+ , cell_matrix(fe.dofs_per_cell, fe.dofs_per_cell)
+ , cell_rhs(fe.dofs_per_cell)
+ , cell_sol(fe.dofs_per_cell)
{}
- PostProcessScratchData(const PostProcessScratchData &sd) :
- fe_values_local(sd.fe_values_local.get_fe(),
- sd.fe_values_local.get_quadrature(),
- sd.fe_values_local.get_update_flags()),
- fe_values(sd.fe_values.get_fe(),
- sd.fe_values.get_quadrature(),
- sd.fe_values.get_update_flags()),
- u_values(sd.u_values),
- u_gradients(sd.u_gradients),
- cell_matrix(sd.cell_matrix),
- cell_rhs(sd.cell_rhs),
- cell_sol(sd.cell_sol)
+ PostProcessScratchData(const PostProcessScratchData &sd)
+ : fe_values_local(sd.fe_values_local.get_fe(),
+ sd.fe_values_local.get_quadrature(),
+ sd.fe_values_local.get_update_flags())
+ , fe_values(sd.fe_values.get_fe(),
+ sd.fe_values.get_quadrature(),
+ sd.fe_values.get_update_flags())
+ , u_values(sd.u_values)
+ , u_gradients(sd.u_gradients)
+ , cell_matrix(sd.cell_matrix)
+ , cell_rhs(sd.cell_rhs)
+ , cell_sol(sd.cell_sol)
{}
};
ScratchData & scratch,
PerTaskData & task_data)
{
- typename DoFHandler<dim>::active_cell_iterator loc_cell(
- &triangulation, cell->level(), cell->index(), &dof_handler_local);
+ typename DoFHandler<dim>::active_cell_iterator loc_cell(&triangulation,
+ cell->level(),
+ cell->index(),
+ &dof_handler_local);
const unsigned int n_q_points =
scratch.fe_values_local.get_quadrature().size();
{
scratch.fl_matrix.mmult(scratch.tmp_matrix, scratch.ll_matrix);
scratch.tmp_matrix.vmult_add(task_data.cell_vector, scratch.l_rhs);
- scratch.tmp_matrix.mmult(
- task_data.cell_matrix, scratch.lf_matrix, true);
+ scratch.tmp_matrix.mmult(task_data.cell_matrix,
+ scratch.lf_matrix,
+ true);
cell->get_dof_indices(task_data.dof_indices);
}
else
PostProcessScratchData & scratch,
unsigned int &)
{
- typename DoFHandler<dim>::active_cell_iterator loc_cell(
- &triangulation, cell->level(), cell->index(), &dof_handler_local);
+ typename DoFHandler<dim>::active_cell_iterator loc_cell(&triangulation,
+ cell->level(),
+ cell->index(),
+ &dof_handler_local);
scratch.fe_values_local.reinit(loc_cell);
scratch.fe_values.reinit(cell);
class Coefficient : public Function<dim>
{
public:
- Coefficient() : Function<dim>()
+ Coefficient()
+ : Function<dim>()
{}
virtual double
template <int dim>
-LaplaceProblem<dim>::LaplaceProblem() : dof_handler(triangulation), fe(2)
+LaplaceProblem<dim>::LaplaceProblem()
+ : dof_handler(triangulation)
+ , fe(2)
{}
for (unsigned int i = 0; i < dofs_per_cell; ++i)
{
for (unsigned int j = 0; j < dofs_per_cell; ++j)
- system_matrix.add(
- local_dof_indices[i], local_dof_indices[j], cell_matrix(i, j));
+ system_matrix.add(local_dof_indices[i],
+ local_dof_indices[j],
+ cell_matrix(i, j));
system_rhs(local_dof_indices[i]) += cell_rhs(i);
}
hanging_node_constraints.condense(system_rhs);
std::map<types::global_dof_index, double> boundary_values;
- VectorTools::interpolate_boundary_values(
- dof_handler, 0, Functions::ZeroFunction<dim>(), boundary_values);
- MatrixTools::apply_boundary_values(
- boundary_values, system_matrix, solution, system_rhs);
+ VectorTools::interpolate_boundary_values(dof_handler,
+ 0,
+ Functions::ZeroFunction<dim>(),
+ boundary_values);
+ MatrixTools::apply_boundary_values(boundary_values,
+ system_matrix,
+ solution,
+ system_rhs);
}
solution,
estimated_error_per_cell);
- GridRefinement::refine_and_coarsen_optimize(
- triangulation, estimated_error_per_cell, 5);
+ GridRefinement::refine_and_coarsen_optimize(triangulation,
+ estimated_error_per_cell,
+ 5);
triangulation.execute_coarsening_and_refinement();
}
class Coefficient : public Function<dim>
{
public:
- Coefficient() : Function<dim>()
+ Coefficient()
+ : Function<dim>()
{}
virtual double
template <int dim>
-LaplaceProblem<dim>::LaplaceProblem() : dof_handler(triangulation), fe(2)
+LaplaceProblem<dim>::LaplaceProblem()
+ : dof_handler(triangulation)
+ , fe(2)
{}
for (unsigned int i = 0; i < dofs_per_cell; ++i)
{
for (unsigned int j = 0; j < dofs_per_cell; ++j)
- system_matrix.add(
- local_dof_indices[i], local_dof_indices[j], cell_matrix(i, j));
+ system_matrix.add(local_dof_indices[i],
+ local_dof_indices[j],
+ cell_matrix(i, j));
system_rhs(local_dof_indices[i]) += cell_rhs(i);
}
hanging_node_constraints.condense(system_rhs);
std::map<types::global_dof_index, double> boundary_values;
- VectorTools::interpolate_boundary_values(
- dof_handler, 0, Functions::ZeroFunction<dim>(), boundary_values);
- MatrixTools::apply_boundary_values(
- boundary_values, system_matrix, solution, system_rhs);
+ VectorTools::interpolate_boundary_values(dof_handler,
+ 0,
+ Functions::ZeroFunction<dim>(),
+ boundary_values);
+ MatrixTools::apply_boundary_values(boundary_values,
+ system_matrix,
+ solution,
+ system_rhs);
}
class Coefficient : public Function<dim>
{
public:
- Coefficient() : Function<dim>()
+ Coefficient()
+ : Function<dim>()
{}
virtual double
template <int dim>
-LaplaceProblem<dim>::LaplaceProblem() : dof_handler(triangulation), fe(2)
+LaplaceProblem<dim>::LaplaceProblem()
+ : dof_handler(triangulation)
+ , fe(2)
{}
for (unsigned int i = 0; i < dofs_per_cell; ++i)
{
for (unsigned int j = 0; j < dofs_per_cell; ++j)
- system_matrix.add(
- local_dof_indices[i], local_dof_indices[j], cell_matrix(i, j));
+ system_matrix.add(local_dof_indices[i],
+ local_dof_indices[j],
+ cell_matrix(i, j));
system_rhs(local_dof_indices[i]) += cell_rhs(i);
}
hanging_node_constraints.condense(system_rhs);
std::map<types::global_dof_index, double> boundary_values;
- VectorTools::interpolate_boundary_values(
- dof_handler, 0, Functions::ZeroFunction<dim>(), boundary_values);
- MatrixTools::apply_boundary_values(
- boundary_values, system_matrix, solution, system_rhs);
+ VectorTools::interpolate_boundary_values(dof_handler,
+ 0,
+ Functions::ZeroFunction<dim>(),
+ boundary_values);
+ MatrixTools::apply_boundary_values(boundary_values,
+ system_matrix,
+ solution,
+ system_rhs);
}
solution,
estimated_error_per_cell);
- GridRefinement::refine_and_coarsen_fixed_number(
- triangulation, estimated_error_per_cell, 0.3, 0.03);
+ GridRefinement::refine_and_coarsen_fixed_number(triangulation,
+ estimated_error_per_cell,
+ 0.3,
+ 0.03);
triangulation.execute_coarsening_and_refinement();
}
template <>
const Point<1>
- SolutionBase<1>::source_centers[SolutionBase<1>::n_source_centers] = {
- Point<1>(-1.0 / 3.0),
- Point<1>(0.0),
- Point<1>(+1.0 / 3.0)};
+ SolutionBase<1>::source_centers[SolutionBase<1>::n_source_centers] =
+ {Point<1>(-1.0 / 3.0), Point<1>(0.0), Point<1>(+1.0 / 3.0)};
template <>
const Point<2>
- SolutionBase<2>::source_centers[SolutionBase<2>::n_source_centers] = {
- Point<2>(-0.5, +0.5),
- Point<2>(-0.5, -0.5),
- Point<2>(+0.5, -0.5)};
+ SolutionBase<2>::source_centers[SolutionBase<2>::n_source_centers] =
+ {Point<2>(-0.5, +0.5), Point<2>(-0.5, -0.5), Point<2>(+0.5, -0.5)};
template <int dim>
const double SolutionBase<dim>::width = 1. / 3.;
class Solution : public Function<dim>, protected SolutionBase<dim>
{
public:
- Solution() : Function<dim>()
+ Solution()
+ : Function<dim>()
{}
virtual double
class RightHandSide : public Function<dim>, protected SolutionBase<dim>
{
public:
- RightHandSide() : Function<dim>()
+ RightHandSide()
+ : Function<dim>()
{}
virtual double
template <int dim>
HelmholtzProblem<dim>::HelmholtzProblem(const FiniteElement<dim> &fe,
- const RefinementMode refinement_mode) :
- dof_handler(triangulation),
- fe(&fe),
- refinement_mode(refinement_mode)
+ const RefinementMode refinement_mode)
+ : dof_handler(triangulation)
+ , fe(&fe)
+ , refinement_mode(refinement_mode)
{}
for (unsigned int i = 0; i < dofs_per_cell; ++i)
{
for (unsigned int j = 0; j < dofs_per_cell; ++j)
- system_matrix.add(
- local_dof_indices[i], local_dof_indices[j], cell_matrix(i, j));
+ system_matrix.add(local_dof_indices[i],
+ local_dof_indices[j],
+ cell_matrix(i, j));
system_rhs(local_dof_indices[i]) += cell_rhs(i);
}
hanging_node_constraints.condense(system_rhs);
std::map<types::global_dof_index, double> boundary_values;
- VectorTools::interpolate_boundary_values(
- dof_handler, 0, Solution<dim>(), boundary_values);
- MatrixTools::apply_boundary_values(
- boundary_values, system_matrix, solution, system_rhs);
+ VectorTools::interpolate_boundary_values(dof_handler,
+ 0,
+ Solution<dim>(),
+ boundary_values);
+ MatrixTools::apply_boundary_values(boundary_values,
+ system_matrix,
+ solution,
+ system_rhs);
}
template <int dim>
-RightHandSide<dim>::RightHandSide() : Function<dim>(dim)
+RightHandSide<dim>::RightHandSide()
+ : Function<dim>(dim)
{}
template <int dim>
-ElasticProblem<dim>::ElasticProblem() :
- dof_handler(triangulation),
- fe(FE_Q<dim>(1), dim)
+ElasticProblem<dim>::ElasticProblem()
+ : dof_handler(triangulation)
+ , fe(FE_Q<dim>(1), dim)
{}
for (unsigned int i = 0; i < dofs_per_cell; ++i)
{
for (unsigned int j = 0; j < dofs_per_cell; ++j)
- system_matrix.add(
- local_dof_indices[i], local_dof_indices[j], cell_matrix(i, j));
+ system_matrix.add(local_dof_indices[i],
+ local_dof_indices[j],
+ cell_matrix(i, j));
system_rhs(local_dof_indices[i]) += cell_rhs(i);
}
hanging_node_constraints.condense(system_rhs);
std::map<types::global_dof_index, double> boundary_values;
- VectorTools::interpolate_boundary_values(
- dof_handler, 0, Functions::ZeroFunction<dim>(dim), boundary_values);
- MatrixTools::apply_boundary_values(
- boundary_values, system_matrix, solution, system_rhs);
+ VectorTools::interpolate_boundary_values(dof_handler,
+ 0,
+ Functions::ZeroFunction<dim>(dim),
+ boundary_values);
+ MatrixTools::apply_boundary_values(boundary_values,
+ system_matrix,
+ solution,
+ system_rhs);
}
solution,
estimated_error_per_cell);
- GridRefinement::refine_and_coarsen_fixed_number(
- triangulation, estimated_error_per_cell, 0.3, 0.03);
+ GridRefinement::refine_and_coarsen_fixed_number(triangulation,
+ estimated_error_per_cell,
+ 0.3,
+ 0.03);
triangulation.execute_coarsening_and_refinement();
}
try
{
face_constraints.reinit(fe2.dofs_per_face, fe1.dofs_per_face);
- fe1.get_subface_interpolation_matrix(
- fe2, subface, face_constraints);
+ fe1.get_subface_interpolation_matrix(fe2,
+ subface,
+ face_constraints);
deallog << fe1.get_name() << " vs. " << fe2.get_name()
<< std::endl;
try
{
face_constraints.reinit(fe1.dofs_per_face, fe2.dofs_per_face);
- fe2.get_subface_interpolation_matrix(
- fe1, subface, face_constraints);
+ fe2.get_subface_interpolation_matrix(fe1,
+ subface,
+ face_constraints);
deallog << fe2.get_name() << " vs. " << fe1.get_name()
<< std::endl;
QGauss<dim - 1> q_face(3);
- FEFaceValues<dim> fe_face_values(
- fe,
- q_face,
- update_normal_vectors | update_quadrature_points | update_JxW_values);
- FESubfaceValues<dim> fe_subface_values(
- fe,
- q_face,
- update_normal_vectors | update_quadrature_points | update_JxW_values);
+ FEFaceValues<dim> fe_face_values(fe,
+ q_face,
+ update_normal_vectors |
+ update_quadrature_points |
+ update_JxW_values);
+ FESubfaceValues<dim> fe_subface_values(fe,
+ q_face,
+ update_normal_vectors |
+ update_quadrature_points |
+ update_JxW_values);
double v1 = 0, v2 = 0;
for (typename DoFHandler<dim>::active_cell_iterator cell =
QGauss<dim - 1> q_face(3);
- FEFaceValues<dim> fe_face_values(
- mapping,
- fe,
- q_face,
- update_normal_vectors | update_quadrature_points | update_JxW_values);
- FESubfaceValues<dim> fe_subface_values(
- mapping,
- fe,
- q_face,
- update_normal_vectors | update_quadrature_points | update_JxW_values);
+ FEFaceValues<dim> fe_face_values(mapping,
+ fe,
+ q_face,
+ update_normal_vectors |
+ update_quadrature_points |
+ update_JxW_values);
+ FESubfaceValues<dim> fe_subface_values(mapping,
+ fe,
+ q_face,
+ update_normal_vectors |
+ update_quadrature_points |
+ update_JxW_values);
double v1 = 0, v2 = 0;
for (typename DoFHandler<dim>::active_cell_iterator cell =
QGauss<dim - 1> q_face(3);
- FEFaceValues<dim> fe_face_values(
- mapping,
- fe,
- q_face,
- update_normal_vectors | update_quadrature_points | update_JxW_values);
- FESubfaceValues<dim> fe_subface_values(
- mapping,
- fe,
- q_face,
- update_normal_vectors | update_quadrature_points | update_JxW_values);
+ FEFaceValues<dim> fe_face_values(mapping,
+ fe,
+ q_face,
+ update_normal_vectors |
+ update_quadrature_points |
+ update_JxW_values);
+ FESubfaceValues<dim> fe_subface_values(mapping,
+ fe,
+ q_face,
+ update_normal_vectors |
+ update_quadrature_points |
+ update_JxW_values);
double v1 = 0, v2 = 0;
for (typename DoFHandler<dim>::active_cell_iterator cell =
QGauss<dim - 1> q_face(3);
- FEFaceValues<dim> fe_face_values(
- mapping,
- fe,
- q_face,
- update_normal_vectors | update_quadrature_points | update_JxW_values);
- FESubfaceValues<dim> fe_subface_values(
- mapping,
- fe,
- q_face,
- update_normal_vectors | update_quadrature_points | update_JxW_values);
+ FEFaceValues<dim> fe_face_values(mapping,
+ fe,
+ q_face,
+ update_normal_vectors |
+ update_quadrature_points |
+ update_JxW_values);
+ FESubfaceValues<dim> fe_subface_values(mapping,
+ fe,
+ q_face,
+ update_normal_vectors |
+ update_quadrature_points |
+ update_JxW_values);
double v1 = 0, v2 = 0;
for (typename DoFHandler<dim>::active_cell_iterator cell =
};
template <int spacedim>
-BEM<spacedim>::BEM() : fe(0), dof_handler(tria), fe_q(1), dof_handler_q(tria)
+BEM<spacedim>::BEM()
+ : fe(0)
+ , dof_handler(tria)
+ , fe_q(1)
+ , dof_handler_q(tria)
{
velocity[0] = 1.;
}
{
const QGauss<spacedim - 1> quadrature_formula(2);
const QGaussLog<1> qlog(1);
- FEValues<spacedim - 1, spacedim> fe_values_i(
- fe,
- quadrature_formula,
- update_JxW_values | update_normal_vectors | update_quadrature_points),
+ FEValues<spacedim - 1, spacedim> fe_values_i(fe,
+ quadrature_formula,
+ update_JxW_values |
+ update_normal_vectors |
+ update_quadrature_points),
fe_values_j(fe,
quadrature_formula,
update_JxW_values | update_normal_vectors |
// surface faces
std::set<types::boundary_id> boundary_ids;
boundary_ids.insert(0);
- GridGenerator::extract_boundary_mesh(
- volume_mesh, boundary_mesh, boundary_ids);
+ GridGenerator::extract_boundary_mesh(volume_mesh,
+ boundary_mesh,
+ boundary_ids);
deallog << volume_mesh.n_active_cells() << std::endl;
deallog << boundary_mesh.n_active_cells() << std::endl;
class Identity : public Function<dim>
{
public:
- Identity() : Function<dim>(dim)
+ Identity()
+ : Function<dim>(dim)
{}
class MySquareFunction : public Function<dim>
{
public:
- MySquareFunction() : Function<dim>(2)
+ MySquareFunction()
+ : Function<dim>(2)
{}
virtual double
class MyFunction : public Function<dim>
{
public:
- MyFunction() : Function<dim>(1)
+ MyFunction()
+ : Function<dim>(1)
{}
virtual double
class MyNormalDerivative : public Function<dim>
{
public:
- MyNormalDerivative() : Function<dim>(1)
+ MyNormalDerivative()
+ : Function<dim>(1)
{}
virtual double
set<types::boundary_id> boundary_ids;
boundary_ids.insert(0);
- surface_to_volume_mapping = GridGenerator::extract_boundary_mesh(
- volume_mesh, boundary_mesh, boundary_ids);
+ surface_to_volume_mapping =
+ GridGenerator::extract_boundary_mesh(volume_mesh,
+ boundary_mesh,
+ boundary_ids);
save_mesh(boundary_mesh);
}
set<types::boundary_id> boundary_ids;
boundary_ids.insert(1);
- surface_to_volume_mapping = GridGenerator::extract_boundary_mesh(
- volume_mesh, boundary_mesh, boundary_ids);
+ surface_to_volume_mapping =
+ GridGenerator::extract_boundary_mesh(volume_mesh,
+ boundary_mesh,
+ boundary_ids);
deallog << volume_mesh.n_active_cells() << std::endl;
deallog << boundary_mesh.n_active_cells() << std::endl;
template <int spacedim>
- Extract_Mesh_Test<spacedim>::Extract_Mesh_Test() :
- space_fe(spacedim),
- boundary_fe(1),
- space_dof_handler(volume_mesh_triangulation),
- contact_dof_handler(boundary_triangulation)
+ Extract_Mesh_Test<spacedim>::Extract_Mesh_Test()
+ : space_fe(spacedim)
+ , boundary_fe(1)
+ , space_dof_handler(volume_mesh_triangulation)
+ , contact_dof_handler(boundary_triangulation)
{}
template <int spacedim>
std::map<typename DoFHandler<boundary_dim, spacedim>::cell_iterator,
typename DoFHandler<spacedim>::face_iterator>
- element_assignment = GridGenerator::extract_boundary_mesh(
- space_dof_handler, contact_dof_handler, boundary_ids);
+ element_assignment =
+ GridGenerator::extract_boundary_mesh(space_dof_handler,
+ contact_dof_handler,
+ boundary_ids);
contact_dof_handler.distribute_dofs(boundary_fe);
const FE_DGQ<dim, spacedim> fe_help(0);
DoFHandler<dim, spacedim> dof_handler_help(triangulation);
dof_handler_help.distribute_dofs(fe_help);
- FEValues<dim, spacedim> fe_values_help(
- fe_help, q_midpoint, update_normal_vectors);
+ FEValues<dim, spacedim> fe_values_help(fe_help,
+ q_midpoint,
+ update_normal_vectors);
deallog << "no. of cells " << triangulation.n_cells() << std::endl;
deallog << "no. of dofs " << dof_handler.n_dofs() << std::endl;
cell->face(0)->set_all_boundary_ids(1);
std::set<types::boundary_id> boundary_ids;
boundary_ids.insert(0);
- GridGenerator::extract_boundary_mesh(
- volume_mesh, boundary_mesh, boundary_ids);
+ GridGenerator::extract_boundary_mesh(volume_mesh,
+ boundary_mesh,
+ boundary_ids);
}
boundary_mesh.begin_active()->set_refine_flag();
boundary_mesh.execute_coarsening_and_refinement();
cell->face(0)->set_all_boundary_ids(1);
std::set<types::boundary_id> boundary_ids;
boundary_ids.insert(0);
- GridGenerator::extract_boundary_mesh(
- volume_mesh, boundary_mesh, boundary_ids);
+ GridGenerator::extract_boundary_mesh(volume_mesh,
+ boundary_mesh,
+ boundary_ids);
}
boundary_mesh.begin_active()->set_refine_flag();
boundary_mesh.execute_coarsening_and_refinement();
cell->face(0)->set_all_boundary_ids(1);
std::set<types::boundary_id> boundary_ids;
boundary_ids.insert(0);
- GridGenerator::extract_boundary_mesh(
- volume_mesh, boundary_mesh, boundary_ids);
+ GridGenerator::extract_boundary_mesh(volume_mesh,
+ boundary_mesh,
+ boundary_ids);
}
Triangulation<dim, spacedim>::active_cell_iterator cell =
DoFHandler<1> dh(tria);
- FEValues<1> fe_values(
- feq, qlog, update_JxW_values | update_quadrature_points),
+ FEValues<1> fe_values(feq,
+ qlog,
+ update_JxW_values | update_quadrature_points),
fev_help(feq, qgauss, update_JxW_values | update_quadrature_points);
for (unsigned int nq = 2; nq < 13; ++nq)
{
QGaussLogR<1> quad(nq, origins[nos], alphas[nas]);
- QGaussLogR<1> factored_quad(
- nq, origins[nos], alphas[nas], true);
+ QGaussLogR<1> factored_quad(nq,
+ origins[nos],
+ alphas[nas],
+ true);
double approx_integral = 0;
double approx_integral_factored = 0;
class X : public Function<dim>
{
public:
- X() : Function<dim>(dim)
+ X()
+ : Function<dim>(dim)
{}
double
class X : public Function<dim>
{
public:
- X() : Function<dim>(dim)
+ X()
+ : Function<dim>(dim)
{}
double
for (unsigned int boundary_id = 0; boundary_id < 2; ++boundary_id)
{
std::map<types::global_dof_index, double> bv;
- VectorTools::interpolate_boundary_values(
- dof_handler, boundary_id, X<spacedim>(), bv);
+ VectorTools::interpolate_boundary_values(dof_handler,
+ boundary_id,
+ X<spacedim>(),
+ bv);
deallog << bv.size() << " boundary degrees of freedom" << std::endl;
for (std::map<types::global_dof_index, double>::const_iterator i =
AssertThrow(bv.find(cell->face(f)->vertex_dof_index(v, i)) !=
bv.end(),
ExcInternalError());
- AssertThrow(
- bv[cell->face(f)->vertex_dof_index(v, i)] ==
- X<spacedim>().value(cell->face(f)->vertex(v), i),
- ExcInternalError());
+ AssertThrow(bv[cell->face(f)->vertex_dof_index(v, i)] ==
+ X<spacedim>().value(cell->face(f)->vertex(v),
+ i),
+ ExcInternalError());
}
}
}
MappingQGeneric<dim - 1, dim> mapping(1);
FE_Q<dim - 1, dim> fe(1);
- FEValues<dim - 1, dim> fe_values(
- mapping, fe, quadrature, update_normal_vectors);
+ FEValues<dim - 1, dim> fe_values(mapping,
+ fe,
+ quadrature,
+ update_normal_vectors);
for (typename Triangulation<dim - 1, dim>::active_cell_iterator cell =
boundary_mesh.begin_active();
MappingQ<dim - 1, dim> mapping(2);
FE_Q<dim - 1, dim> fe(1);
- FEValues<dim - 1, dim> fe_values(
- mapping, fe, quadrature, update_normal_vectors);
+ FEValues<dim - 1, dim> fe_values(mapping,
+ fe,
+ quadrature,
+ update_normal_vectors);
for (typename Triangulation<dim - 1, dim>::active_cell_iterator cell =
boundary_mesh.begin_active();
grid_out.write_ucd(tria, logfile);
QTrapez<dim> quad;
- MappingQEulerian<dim, Vector<double>, spacedim> mapping(
- degree, shift_dh, shift);
+ MappingQEulerian<dim, Vector<double>, spacedim> mapping(degree,
+ shift_dh,
+ shift);
typename Triangulation<dim, spacedim>::active_cell_iterator
cell = tria.begin_active(),
dh.distribute_dofs(fe);
- FEFaceValues<dim - 1, dim> fe_face_values(
- mapping, fe, QTrapez<dim - 2>(), update_normal_vectors);
+ FEFaceValues<dim - 1, dim> fe_face_values(mapping,
+ fe,
+ QTrapez<dim - 2>(),
+ update_normal_vectors);
for (typename DoFHandler<dim - 1, dim>::active_cell_iterator cell =
dh.begin_active();
std::set<types::boundary_id> boundary_ids;
boundary_ids.insert(0);
- GridGenerator::extract_boundary_mesh(
- volume_mesh, triangulation, boundary_ids);
+ GridGenerator::extract_boundary_mesh(volume_mesh,
+ triangulation,
+ boundary_ids);
triangulation.reset_manifold(0);
GridTools::transform(&warp<3>, triangulation);
}
cell->get_dof_indices(local_dof_indices);
- constraints.distribute_local_to_global(
- cell_matrix, local_dof_indices, sparse_matrix);
+ constraints.distribute_local_to_global(cell_matrix,
+ local_dof_indices,
+ sparse_matrix);
}
}
for (unsigned i = 0; i < n_dofs; ++i)
class MatrixFreeTest
{
public:
- MatrixFreeTest(const CUDAWrappers::MatrixFree<dim, Number> &data_in) :
- data(data_in){};
+ MatrixFreeTest(const CUDAWrappers::MatrixFree<dim, Number> &data_in)
+ : data(data_in){};
void
vmult(LinearAlgebra::CUDAWrappers::Vector<Number> & dst,
for (unsigned int j = j_min; j < j_max; ++j)
column_indices[i].emplace_back(j);
}
- sparsity_pattern.copy_from(
- size, size, column_indices.begin(), column_indices.end());
+ sparsity_pattern.copy_from(size,
+ size,
+ column_indices.begin(),
+ column_indices.end());
matrix.reinit(sparsity_pattern);
for (unsigned int i = 0; i < size; ++i)
{
rhs_dev.import(rhs_host, VectorOperation::insert);
LinearAlgebra::CUDAWrappers::Vector<double> solution_dev(size);
- const std::array<std::string, 3> solver_names{
- "Cholesky", "LU_dense", "LU_host"};
+ const std::array<std::string, 3> solver_names{"Cholesky",
+ "LU_dense",
+ "LU_host"};
for (auto solver_type : solver_names)
{
CUDAWrappers::SolverDirect<double>::AdditionalData data(solver_type);
SolverControl solver_control;
- CUDAWrappers::SolverDirect<double> solver(
- cuda_handle, solver_control, data);
+ CUDAWrappers::SolverDirect<double> solver(cuda_handle,
+ solver_control,
+ data);
solver.solve(matrix_dev, solution_dev, rhs_dev);
// Move the result back to the host
int nnz = A_dev.n_nonzero_elements();
std::vector<double> val_host(nnz);
- cuda_error_code = cudaMemcpy(
- &val_host[0], val_dev, nnz * sizeof(double), cudaMemcpyDeviceToHost);
+ cuda_error_code = cudaMemcpy(&val_host[0],
+ val_dev,
+ nnz * sizeof(double),
+ cudaMemcpyDeviceToHost);
AssertCuda(cuda_error_code);
std::vector<int> column_index_host(nnz);
template <int dim>
-LaplaceProblem<dim>::LaplaceProblem() : fe(1), dof_handler(triangulation)
+LaplaceProblem<dim>::LaplaceProblem()
+ : fe(1)
+ , dof_handler(triangulation)
{}
class FilteredDataOut : public DataOut<dim>
{
public:
- FilteredDataOut(const unsigned int subdomain_id) : subdomain_id(subdomain_id)
+ FilteredDataOut(const unsigned int subdomain_id)
+ : subdomain_id(subdomain_id)
{}
virtual typename DataOut<dim>::cell_iterator
FilteredDataOut<dim> data_out(0);
data_out.attach_dof_handler(dof_handler);
- data_out.add_data_vector(
- cell_data, "cell_data", DataOut<dim>::type_cell_data);
+ data_out.add_data_vector(cell_data,
+ "cell_data",
+ DataOut<dim>::type_cell_data);
data_out.build_patches();
data_out.write_deal_II_intermediate(deallog.get_file_stream());
DataOut<dim> data_out;
try
{
- data_out.add_data_vector(
- dof_handler, vec, names, component_interpretation);
+ data_out.add_data_vector(dof_handler,
+ vec,
+ names,
+ component_interpretation);
data_out.build_patches(mapping, 2);
}
catch (ExceptionBase &exc)
data_out.attach_dof_handler(dof_handler);
try
{
- data_out.add_data_vector(
- vec, names, DataOut<dim>::type_automatic, component_interpretation);
+ data_out.add_data_vector(vec,
+ names,
+ DataOut<dim>::type_automatic,
+ component_interpretation);
data_out.build_patches(mapping, 2);
}
catch (ExceptionBase &exc)
{
public:
DataOutX(const std::vector<::DataOutBase::Patch<dim, spacedim>> &patches,
- const std::vector<std::string> & names) :
- patches(patches),
- names(names)
+ const std::vector<std::string> & names)
+ : patches(patches)
+ , names(names)
{}
virtual const std::vector<::DataOutBase::Patch<dim, spacedim>> &
DataOut<dim> data_out;
data_out.attach_dof_handler(dof_handler);
data_out.add_data_vector(v, std::vector<std::string>{"field_a", "field_b"});
- data_out.add_data_vector(
- w, std::vector<std::string>{"real_field_a", "real_field_b"});
+ data_out.add_data_vector(w,
+ std::vector<std::string>{"real_field_a",
+ "real_field_b"});
data_out.build_patches();
data_out.write_gnuplot(deallog.get_file_stream());
}
// create triangulation
Triangulation<2> triangulation;
- triangulation.create_triangulation_compatibility(
- vertices, cells, SubCellData());
+ triangulation.create_triangulation_compatibility(vertices,
+ cells,
+ SubCellData());
// now provide everything that is
// needed for solving a Laplace
// equation.
{
DataOutFaces<dim> data_out_faces;
data_out_faces.attach_dof_handler(dof_handler);
- data_out_faces.add_data_vector(
- v_node, "node_data", DataOutFaces<dim>::type_dof_data);
- data_out_faces.add_data_vector(
- v_cell, "cell_data", DataOutFaces<dim>::type_cell_data);
+ data_out_faces.add_data_vector(v_node,
+ "node_data",
+ DataOutFaces<dim>::type_dof_data);
+ data_out_faces.add_data_vector(v_cell,
+ "cell_data",
+ DataOutFaces<dim>::type_cell_data);
data_out_faces.build_patches();
data_out_faces.write_dx(deallog.get_file_stream());
DataOutFaces<dim> data_out_faces;
data_out_faces.attach_dof_handler(dof_handler);
- data_out_faces.add_data_vector(
- v_node, "node_data", DataOutFaces<dim>::type_dof_data);
- data_out_faces.add_data_vector(
- v_cell, "cell_data", DataOutFaces<dim>::type_cell_data);
+ data_out_faces.add_data_vector(v_node,
+ "node_data",
+ DataOutFaces<dim>::type_dof_data);
+ data_out_faces.add_data_vector(v_cell,
+ "cell_data",
+ DataOutFaces<dim>::type_cell_data);
data_out_faces.build_patches();
data_out_faces.write_dx(deallog.get_file_stream());
class MyPostprocessor : public DataPostprocessorScalar<dim>
{
public:
- MyPostprocessor() : DataPostprocessorScalar<dim>("data", update_values)
+ MyPostprocessor()
+ : DataPostprocessorScalar<dim>("data", update_values)
{}
virtual void
class MyPostprocessor : public DataPostprocessorVector<dim>
{
public:
- MyPostprocessor() : DataPostprocessorVector<dim>("data", update_values)
+ MyPostprocessor()
+ : DataPostprocessorVector<dim>("data", update_values)
{}
virtual void
std::string output_basename = std::to_string(dim) + std::to_string(spacedim);
- DataOutBase::write_hdf5_parallel(
- patches, data_filter, output_basename + ".h5", MPI_COMM_SELF);
+ DataOutBase::write_hdf5_parallel(patches,
+ data_filter,
+ output_basename + ".h5",
+ MPI_COMM_SELF);
const double current_time = 0.0;
XDMFEntry entry(output_basename + ".h5",
template <int dim>
-LaplaceProblem<dim>::LaplaceProblem() :
- fe(FE_Q<dim>(1), 2),
- dof_handler(triangulation)
+LaplaceProblem<dim>::LaplaceProblem()
+ : fe(FE_Q<dim>(1), 2)
+ , dof_handler(triangulation)
{}
class SinesAndCosines : public Function<dim>
{
public:
- SinesAndCosines() : Function<dim>(2)
+ SinesAndCosines()
+ : Function<dim>(2)
{}
double
template <int dim>
-LaplaceProblem<dim>::LaplaceProblem() :
- fe(FE_Q<dim>(1), 2),
- dof_handler(triangulation)
+LaplaceProblem<dim>::LaplaceProblem()
+ : fe(FE_Q<dim>(1), 2)
+ , dof_handler(triangulation)
{}
class SinesAndCosines : public Function<dim>
{
public:
- SinesAndCosines() : Function<dim>(2)
+ SinesAndCosines()
+ : Function<dim>(2)
{}
double
class MyPostprocessor : public DataPostprocessorScalar<dim>
{
public:
- MyPostprocessor() : DataPostprocessorScalar<dim>("magnitude", update_values)
+ MyPostprocessor()
+ : DataPostprocessorScalar<dim>("magnitude", update_values)
{}
virtual void
class MyPostprocessor : public DataPostprocessorScalar<dim>
{
public:
- MyPostprocessor() : DataPostprocessorScalar<dim>("data", update_values)
+ MyPostprocessor()
+ : DataPostprocessorScalar<dim>("data", update_values)
{}
virtual void
template <int dim>
- ElasticProblem<dim>::ElasticProblem() :
- dof_handler(triangulation),
- fe(FE_Q<dim>(1), dim)
+ ElasticProblem<dim>::ElasticProblem()
+ : dof_handler(triangulation)
+ , fe(FE_Q<dim>(1), dim)
{}
for (unsigned int i = 0; i < dofs_per_cell; ++i)
{
for (unsigned int j = 0; j < dofs_per_cell; ++j)
- system_matrix.add(
- local_dof_indices[i], local_dof_indices[j], cell_matrix(i, j));
+ system_matrix.add(local_dof_indices[i],
+ local_dof_indices[j],
+ cell_matrix(i, j));
system_rhs(local_dof_indices[i]) += cell_rhs(i);
}
hanging_node_constraints.condense(system_rhs);
std::map<types::global_dof_index, double> boundary_values;
- VectorTools::interpolate_boundary_values(
- dof_handler, 0, Functions::ZeroFunction<dim>(dim), boundary_values);
- MatrixTools::apply_boundary_values(
- boundary_values, system_matrix, solution, system_rhs);
+ VectorTools::interpolate_boundary_values(dof_handler,
+ 0,
+ Functions::ZeroFunction<dim>(dim),
+ boundary_values);
+ MatrixTools::apply_boundary_values(boundary_values,
+ system_matrix,
+ solution,
+ system_rhs);
}
solution,
estimated_error_per_cell);
- GridRefinement::refine_and_coarsen_fixed_number(
- triangulation, estimated_error_per_cell, 0.3, 0.03);
+ GridRefinement::refine_and_coarsen_fixed_number(triangulation,
+ estimated_error_per_cell,
+ 0.3,
+ 0.03);
triangulation.execute_coarsening_and_refinement();
}
class StrainPostprocessor : public DataPostprocessorTensor<dim>
{
public:
- StrainPostprocessor() :
- DataPostprocessorTensor<dim>("strain", update_gradients)
+ StrainPostprocessor()
+ : DataPostprocessorTensor<dim>("strain", update_gradients)
{}
virtual void
template <int dim>
-LaplaceProblem<dim>::LaplaceProblem() :
- fe(FE_Q<dim>(1), 2),
- dof_handler(triangulation)
+LaplaceProblem<dim>::LaplaceProblem()
+ : fe(FE_Q<dim>(1), 2)
+ , dof_handler(triangulation)
{}
class SinesAndCosines : public Function<dim>
{
public:
- SinesAndCosines() : Function<dim>(2)
+ SinesAndCosines()
+ : Function<dim>(2)
{}
double
class MyPostprocessor : public DataPostprocessorVector<dim>
{
public:
- MyPostprocessor() :
- DataPostprocessorVector<dim>("magnitude_times_d", update_values)
+ MyPostprocessor()
+ : DataPostprocessorVector<dim>("magnitude_times_d", update_values)
{}
virtual void
class MyPostprocessor : public DataPostprocessorVector<dim>
{
public:
- MyPostprocessor() : DataPostprocessorVector<dim>("data", update_values)
+ MyPostprocessor()
+ : DataPostprocessorVector<dim>("data", update_values)
{}
virtual void
template <int dim>
-Step6<dim>::Step6() : dof_handler(triangulation), fe(2)
+Step6<dim>::Step6()
+ : dof_handler(triangulation)
+ , fe(2)
{}
DoFTools::make_hanging_node_constraints(dof_handler, constraints);
- VectorTools::interpolate_boundary_values(
- dof_handler, 0, ZeroFunction<dim>(), constraints);
+ VectorTools::interpolate_boundary_values(dof_handler,
+ 0,
+ ZeroFunction<dim>(),
+ constraints);
constraints.close();
solution,
estimated_error_per_cell);
- GridRefinement::refine_and_coarsen_fixed_number(
- triangulation, estimated_error_per_cell, 0.3, 0.03);
+ GridRefinement::refine_and_coarsen_fixed_number(triangulation,
+ estimated_error_per_cell,
+ 0.3,
+ 0.03);
triangulation.execute_coarsening_and_refinement();
}
class HeatFluxPostprocessor : public DataPostprocessorVector<dim>
{
public:
- HeatFluxPostprocessor() :
- // like above, but now also make sure that DataOut provides
- // us with coordinates of the evaluation points:
+ HeatFluxPostprocessor()
+ : // like above, but now also make sure that DataOut provides
+ // us with coordinates of the evaluation points:
DataPostprocessorVector<dim>("heatflux",
update_gradients | update_quadrature_points)
{}
{
DataOutRotation<dim> data_out_rotation;
data_out_rotation.attach_dof_handler(dof_handler);
- data_out_rotation.add_data_vector(
- v_node, "node_data", DataOutRotation<dim>::type_dof_data);
- data_out_rotation.add_data_vector(
- v_cell, "cell_data", DataOutRotation<dim>::type_cell_data);
+ data_out_rotation.add_data_vector(v_node,
+ "node_data",
+ DataOutRotation<dim>::type_dof_data);
+ data_out_rotation.add_data_vector(v_cell,
+ "cell_data",
+ DataOutRotation<dim>::type_cell_data);
data_out_rotation.build_patches(4);
data_out_rotation.write_dx(deallog.get_file_stream());
DataOutRotation<dim> data_out_rotation;
data_out_rotation.attach_dof_handler(dof_handler);
- data_out_rotation.add_data_vector(
- v_node, "node_data", DataOutRotation<dim>::type_dof_data);
- data_out_rotation.add_data_vector(
- v_cell, "cell_data", DataOutRotation<dim>::type_cell_data);
+ data_out_rotation.add_data_vector(v_node,
+ "node_data",
+ DataOutRotation<dim>::type_dof_data);
+ data_out_rotation.add_data_vector(v_cell,
+ "cell_data",
+ DataOutRotation<dim>::type_cell_data);
data_out_rotation.build_patches(4);
data_out_rotation.write_dx(deallog.get_file_stream());
class MyPostprocessor : public DataPostprocessorScalar<dim>
{
public:
- MyPostprocessor() : DataPostprocessorScalar<dim>("data", update_values)
+ MyPostprocessor()
+ : DataPostprocessorScalar<dim>("data", update_values)
{}
virtual void
class Location : public Point<dim>
{
public:
- Location(const Point<dim> &in) : Point<dim>(in)
+ Location(const Point<dim> &in)
+ : Point<dim>(in)
{}
inline bool
template <int dim>
TriaTest<dim>::TriaTest(
- const typename dealii::Triangulation<dim>::MeshSmoothing smoothing_option) :
- mpi_communicator(MPI_COMM_WORLD),
- triangulation(mpi_communicator, smoothing_option),
- myid(Utilities::MPI::this_mpi_process(mpi_communicator)),
- I_am_host(myid == 0),
- case_name(smoothing_option ? "smooth-" : "no_smooth-")
+ const typename dealii::Triangulation<dim>::MeshSmoothing smoothing_option)
+ : mpi_communicator(MPI_COMM_WORLD)
+ , triangulation(mpi_communicator, smoothing_option)
+ , myid(Utilities::MPI::this_mpi_process(mpi_communicator))
+ , I_am_host(myid == 0)
+ , case_name(smoothing_option ? "smooth-" : "no_smooth-")
{
std::vector<unsigned int> repetitions;
Point<dim> p1;
data_out.attach_triangulation(triangulation);
{
const std::string data_name("refine_flag");
- data_out.add_data_vector(
- refine_mark, data_name, DataOut<dim>::type_cell_data);
+ data_out.add_data_vector(refine_mark,
+ data_name,
+ DataOut<dim>::type_cell_data);
}
data_out.build_patches();
std::vector<unsigned int> subdivisions(3, 2);
subdivisions[2] = 1;
- GridGenerator::subdivided_hyper_rectangle(
- tr, subdivisions, Point<3>(0, 0, 0), Point<3>(2, 2, 1));
+ GridGenerator::subdivided_hyper_rectangle(tr,
+ subdivisions,
+ Point<3>(0, 0, 0),
+ Point<3>(2, 2, 1));
tr.begin_active()->set_refine_flag();
tr.execute_coarsening_and_refinement();
for (unsigned int c = 0; c < 8; ++c)
class Location : public Point<dim>
{
public:
- Location(const Point<dim> &in) : Point<dim>(in)
+ Location(const Point<dim> &in)
+ : Point<dim>(in)
{}
inline bool
template <int dim>
TriaTest<dim>::TriaTest(
- const typename dealii::Triangulation<dim>::MeshSmoothing smoothing_option) :
- mpi_communicator(MPI_COMM_WORLD),
- triangulation(mpi_communicator, smoothing_option),
- myid(Utilities::MPI::this_mpi_process(mpi_communicator)),
- I_am_host(myid == 0),
- case_name(smoothing_option ? "smooth-" : "no_smooth-")
+ const typename dealii::Triangulation<dim>::MeshSmoothing smoothing_option)
+ : mpi_communicator(MPI_COMM_WORLD)
+ , triangulation(mpi_communicator, smoothing_option)
+ , myid(Utilities::MPI::this_mpi_process(mpi_communicator))
+ , I_am_host(myid == 0)
+ , case_name(smoothing_option ? "smooth-" : "no_smooth-")
{
std::vector<unsigned int> repetitions;
Point<dim> p1;
data_out.attach_triangulation(triangulation);
{
const std::string data_name("refine_flag");
- data_out.add_data_vector(
- refine_mark, data_name, DataOut<dim>::type_cell_data);
+ data_out.add_data_vector(refine_mark,
+ data_name,
+ DataOut<dim>::type_cell_data);
}
data_out.build_patches();
class MyFunction : public Function<dim>
{
public:
- MyFunction() : Function<dim>(){};
+ MyFunction()
+ : Function<dim>(){};
virtual double
value(const Point<dim> &p, const unsigned int) const
class MyFunction : public Function<dim>
{
public:
- MyFunction() : Function<dim>(){};
+ MyFunction()
+ : Function<dim>(){};
virtual double
value(const Point<dim> &p, const unsigned int) const
{
deallog.push("ff");
- SparsityPattern bl(
- tr.n_cells(level - 1), dof.n_dofs(level), (1 << dim) * fe.dofs_per_cell);
+ SparsityPattern bl(tr.n_cells(level - 1),
+ dof.n_dofs(level),
+ (1 << dim) * fe.dofs_per_cell);
;
DoFTools::make_child_patches(bl, dof, level, false, false);
bl.compress();
}
{
deallog.push("tf");
- SparsityPattern bl(
- tr.n_cells(level - 1), dof.n_dofs(level), (1 << dim) * fe.dofs_per_cell);
+ SparsityPattern bl(tr.n_cells(level - 1),
+ dof.n_dofs(level),
+ (1 << dim) * fe.dofs_per_cell);
;
DoFTools::make_child_patches(bl, dof, level, true, false);
bl.compress();
}
{
deallog.push("tt");
- SparsityPattern bl(
- tr.n_cells(level - 1), dof.n_dofs(level), (1 << dim) * fe.dofs_per_cell);
+ SparsityPattern bl(tr.n_cells(level - 1),
+ dof.n_dofs(level),
+ (1 << dim) * fe.dofs_per_cell);
;
DoFTools::make_child_patches(bl, dof, level, true, true);
bl.compress();
GridGenerator::hyper_L(trl);
trl.refine_global(1);
- FESystem<dim, dim> fe1(
- FESystem<dim, dim>(FE_Q<dim, dim>(2), dim), 1, FE_Q<dim, dim>(1), 1);
+ FESystem<dim, dim> fe1(FESystem<dim, dim>(FE_Q<dim, dim>(2), dim),
+ 1,
+ FE_Q<dim, dim>(1),
+ 1);
deallog.push("Square");
test_block_list(trc, fe1);
fe_values.JxW(q);
}
cell->get_dof_indices(local_dof_indices);
- constraints.distribute_local_to_global(
- local_matrix, local_dof_indices, system_matrix);
+ constraints.distribute_local_to_global(local_matrix,
+ local_dof_indices,
+ system_matrix);
}
}
Smoother::AdditionalData smoother_data;
Smoother smoother;
- DoFTools::make_vertex_patches(
- smoother_data.block_list, dof, tr.n_levels() - 1, exclude_boundary_dofs);
+ DoFTools::make_vertex_patches(smoother_data.block_list,
+ dof,
+ tr.n_levels() - 1,
+ exclude_boundary_dofs);
smoother_data.block_list.compress();
smoother_data.inversion = PreconditionBlockBase<double>::svd;
smoother_data.threshold = 1.e-8;
Smoother::AdditionalData smoother_data;
Smoother smoother;
- DoFTools::make_vertex_patches(
- smoother_data.block_list, dof, tr.n_levels() - 1, exclude_boundary_dofs);
+ DoFTools::make_vertex_patches(smoother_data.block_list,
+ dof,
+ tr.n_levels() - 1,
+ exclude_boundary_dofs);
smoother_data.block_list.compress();
smoother_data.inversion = PreconditionBlockBase<double>::svd;
smoother_data.kernel_size = 1;
template <int dim>
-TestCases<dim>::TestCases() : tria(nullptr), dof(nullptr)
+TestCases<dim>::TestCases()
+ : tria(nullptr)
+ , dof(nullptr)
{}
{
std::vector<unsigned int> target_component(n_components, 0U);
dofs_per_component.resize(1);
- DoFTools::count_dofs_per_component(
- dof_handler, dofs_per_component, false, target_component);
+ DoFTools::count_dofs_per_component(dof_handler,
+ dofs_per_component,
+ false,
+ target_component);
for (unsigned int i = 0;
i < std::min(n_components, (unsigned int)dofs_per_component.size());
++i)
deallog << ' ' << dofs_per_component[i];
deallog << std::endl;
- DoFTools::count_dofs_per_component(
- dof_handler, dofs_per_component, true, target_component);
+ DoFTools::count_dofs_per_component(dof_handler,
+ dofs_per_component,
+ true,
+ target_component);
for (unsigned int i = 0;
i < std::min(n_components, (unsigned int)dofs_per_component.size());
++i)
target_component[i] = 1;
dofs_per_component.resize(2);
- DoFTools::count_dofs_per_component(
- dof_handler, dofs_per_component, false, target_component);
+ DoFTools::count_dofs_per_component(dof_handler,
+ dofs_per_component,
+ false,
+ target_component);
for (unsigned int i = 0;
i < std::min(n_components, (unsigned int)dofs_per_component.size());
++i)
deallog << ' ' << dofs_per_component[i];
deallog << std::endl;
- DoFTools::count_dofs_per_component(
- dof_handler, dofs_per_component, true, target_component);
+ DoFTools::count_dofs_per_component(dof_handler,
+ dofs_per_component,
+ true,
+ target_component);
for (unsigned int i = 0;
i < std::min(n_components, (unsigned int)dofs_per_component.size());
++i)
// first with all components
{
- DoFTools::extract_boundary_dofs(
- dof_handler, component_select, boundary_dofs);
+ DoFTools::extract_boundary_dofs(dof_handler,
+ component_select,
+ boundary_dofs);
output_bool_vector(boundary_dofs);
}
for (unsigned int i = 1; i < component_select.size(); i += 2)
component_select[i] = false;
{
- DoFTools::extract_boundary_dofs(
- dof_handler, component_select, boundary_dofs);
+ DoFTools::extract_boundary_dofs(dof_handler,
+ component_select,
+ boundary_dofs);
output_bool_vector(boundary_dofs);
}
{
std::set<types::boundary_id> boundary_ids;
boundary_ids.insert(0);
- DoFTools::extract_boundary_dofs(
- dof_handler, component_select, boundary_dofs, boundary_ids);
+ DoFTools::extract_boundary_dofs(dof_handler,
+ component_select,
+ boundary_dofs,
+ boundary_ids);
output_bool_vector(boundary_dofs);
}
}
std::vector<bool> component_mask(dof_handler.get_fe().n_components(),
false);
component_mask[0] = true;
- DoFTools::extract_dofs(
- dof_handler, ComponentMask(component_mask), component_dofs);
+ DoFTools::extract_dofs(dof_handler,
+ ComponentMask(component_mask),
+ component_dofs);
for (unsigned int i = 0; i < dof_data.size(); ++i)
if (component_dofs[i] == true)
std::vector<bool> component_mask(dof_handler.get_fe().n_components(),
false);
component_mask.back() = true;
- DoFTools::extract_dofs(
- dof_handler, ComponentMask(component_mask), component_dofs);
+ DoFTools::extract_dofs(dof_handler,
+ ComponentMask(component_mask),
+ component_dofs);
for (unsigned int i = 0; i < dof_data.size(); ++i)
if (component_dofs[i] == true)
dof_data(i) = i + 1;
std::vector<types::global_dof_index> map(dof_handler.n_dofs());
DoFTools::map_dof_to_boundary_indices(dof_handler, map);
- const unsigned int n_blocks = std::min(
- static_cast<types::global_dof_index>(dof_handler.get_fe().n_components()),
- dof_handler.n_boundary_dofs());
+ const unsigned int n_blocks = std::min(static_cast<types::global_dof_index>(
+ dof_handler.get_fe().n_components()),
+ dof_handler.n_boundary_dofs());
BlockSparsityPattern sp(n_blocks, n_blocks);
// split dofs almost arbitrarily to
// blocks
std::vector<types::global_dof_index> map(dof_handler.n_dofs());
DoFTools::map_dof_to_boundary_indices(dof_handler, map);
- const unsigned int n_blocks = std::min(
- static_cast<types::global_dof_index>(dof_handler.get_fe().n_components()),
- dof_handler.n_boundary_dofs());
+ const unsigned int n_blocks = std::min(static_cast<types::global_dof_index>(
+ dof_handler.get_fe().n_components()),
+ dof_handler.n_boundary_dofs());
BlockDynamicSparsityPattern sp(n_blocks, n_blocks);
// split dofs almost arbitrarily to
// blocks
boundary_ids[0] = nullptr;
const types::global_dof_index n_boundary_dofs =
dof_handler.n_boundary_dofs(boundary_ids);
- const unsigned int n_blocks = std::min(
- static_cast<types::global_dof_index>(dof_handler.get_fe().n_components()),
- n_boundary_dofs);
+ const unsigned int n_blocks = std::min(static_cast<types::global_dof_index>(
+ dof_handler.get_fe().n_components()),
+ n_boundary_dofs);
BlockDynamicSparsityPattern sp(n_blocks, n_blocks);
// split dofs almost arbitrarily to
// blocks
// first with all components
{
- DoFTools::extract_dofs_with_support_on_boundary(
- dof_handler, component_select, boundary_dofs);
+ DoFTools::extract_dofs_with_support_on_boundary(dof_handler,
+ component_select,
+ boundary_dofs);
output_bool_vector(boundary_dofs);
}
for (unsigned int i = 1; i < component_select.size(); i += 2)
component_select[i] = false;
{
- DoFTools::extract_dofs_with_support_on_boundary(
- dof_handler, component_select, boundary_dofs);
+ DoFTools::extract_dofs_with_support_on_boundary(dof_handler,
+ component_select,
+ boundary_dofs);
output_bool_vector(boundary_dofs);
}
{
std::set<types::boundary_id> boundary_ids;
boundary_ids.insert(0);
- DoFTools::extract_dofs_with_support_on_boundary(
- dof_handler, component_select, boundary_dofs, boundary_ids);
+ DoFTools::extract_dofs_with_support_on_boundary(dof_handler,
+ component_select,
+ boundary_dofs,
+ boundary_ids);
output_bool_vector(boundary_dofs);
}
}
// Apply periodic boundary conditions only in the one direction where
// we can match the (locally refined) faces:
- DoFTools::make_periodicity_constraints(
- dof_handler.begin(0)->face(0), dof_handler.begin(0)->face(1), cm);
+ DoFTools::make_periodicity_constraints(dof_handler.begin(0)->face(0),
+ dof_handler.begin(0)->face(1),
+ cm);
cm.close();
deallog << cm.n_constraints() << std::endl;
ConstraintMatrix constraint_matrix;
ConstraintMatrix constraint_matrix_reverse;
std::vector<Point<dim>> support_points(dof_handler.n_dofs());
- DoFTools::map_dofs_to_support_points<dim>(
- mapping, dof_handler, support_points);
+ DoFTools::map_dofs_to_support_points<dim>(mapping,
+ dof_handler,
+ support_points);
FEValuesExtractors::Vector v(0);
FEValuesExtractors::Scalar v_1(0);
constraint_matrix.print(deallog.get_file_stream());
constraint_matrix.close();
- DoFTools::make_periodicity_constraints(
- face_2,
- face_1,
- constraint_matrix_reverse,
- velocity_mask,
- orientation[0],
- orientation[0] ? orientation[1] ^ orientation[2] : orientation[1],
- orientation[2]);
+ DoFTools::make_periodicity_constraints(face_2,
+ face_1,
+ constraint_matrix_reverse,
+ velocity_mask,
+ orientation[0],
+ orientation[0] ?
+ orientation[1] ^ orientation[2] :
+ orientation[1],
+ orientation[2]);
deallog << "Reverse Matching:" << std::endl;
constraint_matrix_reverse.print(deallog.get_file_stream());
constraint_matrix_reverse.close();
ConstraintMatrix constraint_matrix;
std::vector<Point<dim>> support_points(dof_handler.n_dofs());
- DoFTools::map_dofs_to_support_points<dim>(
- mapping, dof_handler, support_points);
+ DoFTools::map_dofs_to_support_points<dim>(mapping,
+ dof_handler,
+ support_points);
// Look for the two outermost faces:
typename DoFHandler<dim>::face_iterator face_1 =
ConstraintMatrix constraint_matrix;
std::vector<Point<dim>> support_points(dof_handler.n_dofs());
- DoFTools::map_dofs_to_support_points<dim>(
- mapping, dof_handler, support_points);
+ DoFTools::map_dofs_to_support_points<dim>(mapping,
+ dof_handler,
+ support_points);
// Look for the two outermost faces:
typename DoFHandler<dim>::face_iterator face_1 =
ConstraintMatrix constraint_matrix;
std::vector<Point<dim>> support_points(dof_handler.n_dofs());
- DoFTools::map_dofs_to_support_points<dim>(
- mapping, dof_handler, support_points);
+ DoFTools::map_dofs_to_support_points<dim>(mapping,
+ dof_handler,
+ support_points);
// Look for the two outermost faces:
typename DoFHandler<dim>::face_iterator face_1 =
ConstraintMatrix constraint_matrix;
ConstraintMatrix constraint_matrix_reverse;
std::vector<Point<dim>> support_points(dof_handler.n_dofs());
- DoFTools::map_dofs_to_support_points<dim>(
- mapping, dof_handler, support_points);
+ DoFTools::map_dofs_to_support_points<dim>(mapping,
+ dof_handler,
+ support_points);
FEValuesExtractors::Vector v(0);
FEValuesExtractors::Scalar v_1(0);
constraint_matrix.print(deallog.get_file_stream());
constraint_matrix.close();
- DoFTools::make_periodicity_constraints(
- face_2,
- face_1,
- constraint_matrix_reverse,
- velocity_mask,
- orientation[0],
- orientation[0] ? orientation[1] ^ orientation[2] : orientation[1],
- orientation[2]);
+ DoFTools::make_periodicity_constraints(face_2,
+ face_1,
+ constraint_matrix_reverse,
+ velocity_mask,
+ orientation[0],
+ orientation[0] ?
+ orientation[1] ^ orientation[2] :
+ orientation[1],
+ orientation[2]);
deallog << "Reverse Matching:" << std::endl;
constraint_matrix_reverse.print(deallog.get_file_stream());
constraint_matrix_reverse.close();
dealii::parallel::distributed::Triangulation<dim> triangulation(
MPI_COMM_WORLD);
- GridGenerator::hyper_rectangle(
- triangulation, Point<dim>(0, 0), Point<dim>(1, 1), true);
+ GridGenerator::hyper_rectangle(triangulation,
+ Point<dim>(0, 0),
+ Point<dim>(1, 1),
+ true);
triangulation.refine_global(1);
// Extra refinement to generate hanging nodes
// Generate sparsity pattern
DynamicSparsityPattern sp(relevant_partitioning);
- DoFTools::make_flux_sparsity_pattern(
- dh,
- sp,
- constraints,
- false,
- coupling,
- flux_coupling,
- Utilities::MPI::this_mpi_process(MPI_COMM_WORLD));
+ DoFTools::make_flux_sparsity_pattern(dh,
+ sp,
+ constraints,
+ false,
+ coupling,
+ flux_coupling,
+ Utilities::MPI::this_mpi_process(
+ MPI_COMM_WORLD));
SparsityTools::distribute_sparsity_pattern(
sp,
dh.n_locally_owned_dofs_per_processor(),
// Setup system
Triangulation<dim> triangulation;
- GridGenerator::hyper_rectangle(
- triangulation, Point<dim>(0, 0), Point<dim>(1, 1));
+ GridGenerator::hyper_rectangle(triangulation,
+ Point<dim>(0, 0),
+ Point<dim>(1, 1));
if (flag == 0)
triangulation.refine_global(2);
// Setup system
parallel::distributed::Triangulation<dim> triangulation(MPI_COMM_WORLD);
- GridGenerator::hyper_rectangle(
- triangulation, Point<dim>(0, 0), Point<dim>(1, 1));
+ GridGenerator::hyper_rectangle(triangulation,
+ Point<dim>(0, 0),
+ Point<dim>(1, 1));
if (flag == 0)
triangulation.refine_global(2);
for (unsigned int i = 0; i < dh.n_dofs(); ++i)
{
LinearAlgebra::distributed::Vector<double> &s = shape_functions[i];
- s.reinit(
- dh.locally_owned_dofs(), locally_relevant_set, MPI_COMM_WORLD);
+ s.reinit(dh.locally_owned_dofs(),
+ locally_relevant_set,
+ MPI_COMM_WORLD);
s = 0.;
if (dh.locally_owned_dofs().is_element(i))
s[i] = 1.0;
cm.distribute(s);
s.update_ghost_values();
- data_out.add_data_vector(
- s, std::string("N_") + Utilities::int_to_string(i));
+ data_out.add_data_vector(s,
+ std::string("N_") +
+ Utilities::int_to_string(i));
}
Vector<float> subdomain(triangulation.n_active_cells());
// Setup system
Triangulation<dim> triangulation;
- GridGenerator::hyper_rectangle(
- triangulation, Point<dim>(0, 0), Point<dim>(1, 1));
+ GridGenerator::hyper_rectangle(triangulation,
+ Point<dim>(0, 0),
+ Point<dim>(1, 1));
triangulation.refine_global(1);
// Setup system
parallel::distributed::Triangulation<dim> triangulation(MPI_COMM_WORLD);
- GridGenerator::hyper_rectangle(
- triangulation, Point<dim>(0, 0), Point<dim>(1, 1));
+ GridGenerator::hyper_rectangle(triangulation,
+ Point<dim>(0, 0),
+ Point<dim>(1, 1));
triangulation.refine_global(1);
s = 0.;
s = sl;
- data_out.add_data_vector(
- s, std::string("N_") + dealii::Utilities::int_to_string(i));
+ data_out.add_data_vector(s,
+ std::string("N_") +
+ dealii::Utilities::int_to_string(i));
}
Vector<float> subdomain(triangulation.n_active_cells());
{
const unsigned int ind = locally_owned_set.nth_index_in_set(i);
const double v = rhs[ind];
- AssertThrow(
- std::abs(v) < 1e-12,
- ExcMessage("Element " + std::to_string(ind) + " has an error " +
- std::to_string(v) + " on the process " +
- std::to_string(dealii::Utilities::MPI::this_mpi_process(
- MPI_COMM_WORLD))));
+ AssertThrow(std::abs(v) < 1e-12,
+ ExcMessage(
+ "Element " + std::to_string(ind) + " has an error " +
+ std::to_string(v) + " on the process " +
+ std::to_string(dealii::Utilities::MPI::this_mpi_process(
+ MPI_COMM_WORLD))));
}
if (dealii::Utilities::MPI::this_mpi_process(MPI_COMM_WORLD) == 0)
std::vector<unsigned int> rep(dim, 1);
rep[0] = 2;
- GridGenerator::subdivided_hyper_rectangle(
- triangulation, rep, Point<dim>(), Point<dim>(2.0, 1.0));
- FESystem<dim> fe(
- FE_Q<dim>(velocity_degree), dim, FE_Q<dim>(velocity_degree - 1), 1);
+ GridGenerator::subdivided_hyper_rectangle(triangulation,
+ rep,
+ Point<dim>(),
+ Point<dim>(2.0, 1.0));
+ FESystem<dim> fe(FE_Q<dim>(velocity_degree),
+ dim,
+ FE_Q<dim>(velocity_degree - 1),
+ 1);
DoFHandler<dim> dof_handler(triangulation);
dof_handler.distribute_dofs(fe);
out << "e" << std::endl;
std::map<types::global_dof_index, Point<dim>> support_points;
- DoFTools::map_dofs_to_support_points(
- MappingQ1<dim>(), dof_handler, support_points);
+ DoFTools::map_dofs_to_support_points(MappingQ1<dim>(),
+ dof_handler,
+ support_points);
DoFTools::write_gnuplot_dof_support_point_info(deallog.get_file_stream(),
support_points);
out << "e" << std::endl;
deallog << "level=" << level << std::endl;
std::vector<bool> dofs(dof.n_dofs(level));
- DoFTools::extract_level_dofs(
- level, dof, ComponentMask(component_mask), dofs);
+ DoFTools::extract_level_dofs(level,
+ dof,
+ ComponentMask(component_mask),
+ dofs);
for (unsigned int d = 0; d < dofs.size(); ++d)
deallog << dofs[d];
deallog << "level=" << level << std::endl;
std::vector<bool> dofs(dof.n_dofs(level));
- DoFTools::extract_level_dofs(
- level, dof, BlockMask(component_mask), dofs);
+ DoFTools::extract_level_dofs(level,
+ dof,
+ BlockMask(component_mask),
+ dofs);
for (unsigned int d = 0; d < dofs.size(); ++d)
deallog << dofs[d];
class F : public Function<dim>
{
public:
- F(const unsigned int q) : q(q)
+ F(const unsigned int q)
+ : q(q)
{}
virtual double
dof_handler.distribute_dofs(fe);
Vector<double> interpolant(dof_handler.n_dofs());
- VectorTools::interpolate_based_on_material_id(
- MappingQGeneric<dim>(1), dof_handler, functions, interpolant);
+ VectorTools::interpolate_based_on_material_id(MappingQGeneric<dim>(1),
+ dof_handler,
+ functions,
+ interpolant);
for (typename DoFHandler<dim>::active_cell_iterator cell =
dof_handler.begin_active();
cell != dof_handler.end();
};
template <int dim>
-VectorBoundaryValues<dim>::VectorBoundaryValues() : Function<dim>(dim + 1)
+VectorBoundaryValues<dim>::VectorBoundaryValues()
+ : Function<dim>(dim + 1)
{}
template <int dim>
// first component: Q1-Element,
// second component: lowest order DG_Element
template <int dim>
-FindBug<dim>::FindBug() :
- fe(FE_RaviartThomas<dim>(0), 1, FE_Q<dim>(1), 1),
- dof_handler(triangulation)
+FindBug<dim>::FindBug()
+ : fe(FE_RaviartThomas<dim>(0), 1, FE_Q<dim>(1), 1)
+ , dof_handler(triangulation)
{}
// get a list of those boundary DoFs which
// we want to be fixed:
- DoFTools::extract_boundary_dofs(
- dof_handler, component_mask, fixed_dofs, boundary_ids);
+ DoFTools::extract_boundary_dofs(dof_handler,
+ component_mask,
+ fixed_dofs,
+ boundary_ids);
// (Primitive) Check if the DoFs
// where adjusted correctly (note
dof_handler.distribute_dofs(fe);
std::map<types::global_dof_index, double> boundary_values;
- VectorTools::interpolate_boundary_values(
- dof_handler, 10, Functions::SquareFunction<dim>(), boundary_values);
- VectorTools::interpolate_boundary_values(
- dof_handler, 20, Functions::SquareFunction<dim>(), boundary_values);
+ VectorTools::interpolate_boundary_values(dof_handler,
+ 10,
+ Functions::SquareFunction<dim>(),
+ boundary_values);
+ VectorTools::interpolate_boundary_values(dof_handler,
+ 20,
+ Functions::SquareFunction<dim>(),
+ boundary_values);
deallog << boundary_values.size() << std::endl;
for (std::map<types::global_dof_index, double>::const_iterator p =
boundary_values.begin();
class F : public Function<dim>
{
public:
- F(const unsigned int q) : q(q)
+ F(const unsigned int q)
+ : q(q)
{}
virtual double
class F : public Function<dim>
{
public:
- F(const unsigned int q) : q(q)
+ F(const unsigned int q)
+ : q(q)
{}
virtual double
class F : public Function<dim>
{
public:
- F(const unsigned int q) : q(q)
+ F(const unsigned int q)
+ : q(q)
{}
virtual double
class F : public Function<dim>
{
public:
- F(const unsigned int q) : q(q)
+ F(const unsigned int q)
+ : q(q)
{}
virtual double
class F : public Function<dim>
{
public:
- F(const unsigned int q) : Function<dim>(3), q(q)
+ F(const unsigned int q)
+ : Function<dim>(3)
+ , q(q)
{}
virtual void
class F : public Function<dim>
{
public:
- F(const unsigned int q) : Function<dim>(3), q(q)
+ F(const unsigned int q)
+ : Function<dim>(3)
+ , q(q)
{}
virtual void
class F : public Function<dim>
{
public:
- F(const unsigned int q, const double adj) : Function<dim>(3), q(q), adj(adj)
+ F(const unsigned int q, const double adj)
+ : Function<dim>(3)
+ , q(q)
+ , adj(adj)
{}
virtual void
for (unsigned int q = 0; q <= p + 2; ++q)
{
// interpolate the function with mask 1
- VectorTools::interpolate(
- dof_handler, F<dim>(q, adj1), interpolant, mask1);
+ VectorTools::interpolate(dof_handler,
+ F<dim>(q, adj1),
+ interpolant,
+ mask1);
// interpolate the function with mask 2
- VectorTools::interpolate(
- dof_handler, F<dim>(q, adj2), interpolant, mask2);
+ VectorTools::interpolate(dof_handler,
+ F<dim>(q, adj2),
+ interpolant,
+ mask2);
// then compute the interpolation error for mask 1
VectorTools::integrate_difference(dof_handler,
class F : public Function<dim>
{
public:
- F(const unsigned int q, const double adj) : Function<dim>(3), q(q), adj(adj)
+ F(const unsigned int q, const double adj)
+ : Function<dim>(3)
+ , q(q)
+ , adj(adj)
{}
virtual void
for (unsigned int q = 0; q <= p + 2; ++q)
{
// interpolate the function
- VectorTools::interpolate(
- dof_handler, F<dim>(q, adj1), interpolant, mask1);
- VectorTools::interpolate(
- dof_handler, F<dim>(q, adj2), interpolant, mask2);
+ VectorTools::interpolate(dof_handler,
+ F<dim>(q, adj1),
+ interpolant,
+ mask1);
+ VectorTools::interpolate(dof_handler,
+ F<dim>(q, adj2),
+ interpolant,
+ mask2);
constraints.distribute(interpolant);
GridGenerator::hyper_cube(triangulation_2, 2, 3);
Triangulation<1, spacedim> triangulation;
- GridGenerator::merge_triangulations(
- triangulation_1, triangulation_2, triangulation);
+ GridGenerator::merge_triangulations(triangulation_1,
+ triangulation_2,
+ triangulation);
FESystem<1, spacedim> fe(FE_Q<1, spacedim>(1), 1, FE_DGQ<1, spacedim>(1), 1);
GridGenerator::hyper_cube(triangulation_2, 2, 3);
Triangulation<1, spacedim> triangulation;
- GridGenerator::merge_triangulations(
- triangulation_1, triangulation_2, triangulation);
+ GridGenerator::merge_triangulations(triangulation_1,
+ triangulation_2,
+ triangulation);
// assign boundary ids
triangulation.begin()->face(0)->set_boundary_id(12);
class Coefficient : public Function<dim>
{
public:
- Coefficient() : Function<dim>()
+ Coefficient()
+ : Function<dim>()
{}
virtual double
template <int dim>
-Step6<dim>::Step6() : dof_handler(triangulation), fe(2)
+Step6<dim>::Step6()
+ : dof_handler(triangulation)
+ , fe(2)
{}
DoFTools::make_hanging_node_constraints(dof_handler, constraints);
- VectorTools::interpolate_boundary_values(
- dof_handler, 0, Functions::ZeroFunction<dim>(), constraints);
+ VectorTools::interpolate_boundary_values(dof_handler,
+ 0,
+ Functions::ZeroFunction<dim>(),
+ constraints);
constraints.close();
solution,
estimated_error_per_cell);
- GridRefinement::refine_and_coarsen_fixed_number(
- triangulation, estimated_error_per_cell, 0.3, 0.03);
+ GridRefinement::refine_and_coarsen_fixed_number(triangulation,
+ estimated_error_per_cell,
+ 0.3,
+ 0.03);
triangulation.execute_coarsening_and_refinement();
}
// first way: direct generation
SparsityPattern sparsity_1(dof.n_boundary_dofs(),
dof.max_couplings_between_boundary_dofs());
- DoFTools::make_boundary_sparsity_pattern(
- dof, dof_to_boundary_mapping, sparsity_1);
+ DoFTools::make_boundary_sparsity_pattern(dof,
+ dof_to_boundary_mapping,
+ sparsity_1);
sparsity_1.compress();
// second way: via a DynamicSparsityPattern
// first way: direct generation
SparsityPattern sparsity_1(dof.n_boundary_dofs(),
dof.max_couplings_between_boundary_dofs());
- DoFTools::make_boundary_sparsity_pattern(
- dof, dof_to_boundary_mapping, sparsity_1);
+ DoFTools::make_boundary_sparsity_pattern(dof,
+ dof_to_boundary_mapping,
+ sparsity_1);
sparsity_1.compress();
// second way: via a DynamicSparsityPattern
dof_1.distribute_dofs(element);
dof_2.distribute_dofs(element);
- SparsityPattern sparsity(
- dof_1.n_dofs(), dof_2.n_dofs(), std::max(dof_1.n_dofs(), dof_2.n_dofs()));
+ SparsityPattern sparsity(dof_1.n_dofs(),
+ dof_2.n_dofs(),
+ std::max(dof_1.n_dofs(), dof_2.n_dofs()));
DoFTools::make_sparsity_pattern(dof_1, dof_2, sparsity);
sparsity.compress();
dof_1.distribute_dofs(element_1);
dof_2.distribute_dofs(element_2);
- SparsityPattern sparsity(
- dof_1.n_dofs(), dof_2.n_dofs(), std::max(dof_1.n_dofs(), dof_2.n_dofs()));
+ SparsityPattern sparsity(dof_1.n_dofs(),
+ dof_2.n_dofs(),
+ std::max(dof_1.n_dofs(), dof_2.n_dofs()));
DoFTools::make_sparsity_pattern(dof_1, dof_2, sparsity);
sparsity.compress();
dof_1.distribute_dofs(element_1);
dof_2.distribute_dofs(element_2);
- SparsityPattern sparsity(
- dof_1.n_dofs(), dof_2.n_dofs(), std::max(dof_1.n_dofs(), dof_2.n_dofs()));
+ SparsityPattern sparsity(dof_1.n_dofs(),
+ dof_2.n_dofs(),
+ std::max(dof_1.n_dofs(), dof_2.n_dofs()));
DoFTools::make_sparsity_pattern(dof_1, dof_2, sparsity);
sparsity.compress();
class TestMap1 : public Function<dim>
{
public:
- TestMap1(const unsigned int n_components) : Function<dim>(n_components)
+ TestMap1(const unsigned int n_components)
+ : Function<dim>(n_components)
{}
virtual ~TestMap1()
const double phi;
public:
- TestDef1(const unsigned int n_components, const double ph) :
- Function<dim>(n_components),
- phi(ph)
+ TestDef1(const unsigned int n_components, const double ph)
+ : Function<dim>(n_components)
+ , phi(ph)
{}
virtual ~TestDef1()
const double scale;
public:
- TestDef2(const unsigned int n_components, const double sc) :
- Function<dim>(n_components),
- scale(sc)
+ TestDef2(const unsigned int n_components, const double sc)
+ : Function<dim>(n_components)
+ , scale(sc)
{}
virtual ~TestDef2()
const double scale;
public:
- TestDef3(const unsigned int n_components, const double sc) :
- Function<dim>(n_components),
- scale(sc)
+ TestDef3(const unsigned int n_components, const double sc)
+ : Function<dim>(n_components)
+ , scale(sc)
{}
virtual ~TestDef3()
std::vector<Polynomials::Polynomial<double>> polys;
public:
- TestPoly(unsigned int deg) : Function<dim>(2)
+ TestPoly(unsigned int deg)
+ : Function<dim>(2)
{
std::vector<double> coeff(deg, 0.0);
for (unsigned int p = 0; p < 4; ++p)
class RightHandSide : public Function<dim>
{
public:
- RightHandSide() : Function<dim>()
+ RightHandSide()
+ : Function<dim>()
{}
virtual double
template <int dim>
-LaplaceProblem<dim>::LaplaceProblem() : dof_handler(triangulation)
+LaplaceProblem<dim>::LaplaceProblem()
+ : dof_handler(triangulation)
{
for (unsigned int degree = 2; degree < (dim == 2 ? 8 : 5); ++degree)
{
for (unsigned int i = 0; i < dofs_per_cell; ++i)
{
for (unsigned int j = 0; j < dofs_per_cell; ++j)
- system_matrix.add(
- local_dof_indices[i], local_dof_indices[j], cell_matrix(i, j));
+ system_matrix.add(local_dof_indices[i],
+ local_dof_indices[j],
+ cell_matrix(i, j));
system_rhs(local_dof_indices[i]) += cell_rhs(i);
}
hanging_node_constraints.condense(system_rhs);
condense.stop();
std::map<types::global_dof_index, double> boundary_values;
- VectorTools::interpolate_boundary_values(
- dof_handler, 0, Functions::ZeroFunction<dim>(), boundary_values);
- MatrixTools::apply_boundary_values(
- boundary_values, system_matrix, solution, system_rhs);
+ VectorTools::interpolate_boundary_values(dof_handler,
+ 0,
+ Functions::ZeroFunction<dim>(),
+ boundary_values);
+ MatrixTools::apply_boundary_values(boundary_values,
+ system_matrix,
+ solution,
+ system_rhs);
}
template <int dim>
if (!((i == 0) && (j == 0) && (k == 0)) &&
(i * i + j * j + k * k < N * N))
{
- k_vectors.push_back(Point<dim>(
- numbers::PI * i, numbers::PI * j, numbers::PI * k));
+ k_vectors.push_back(Point<dim>(numbers::PI * i,
+ numbers::PI * j,
+ numbers::PI * k));
k_vectors_magnitude.push_back(i * i + j * j + k * k);
}
Vector<float> smoothness_indicators(triangulation.n_active_cells());
estimate_smoothness(smoothness_indicators);
- GridRefinement::refine_and_coarsen_fixed_number(
- triangulation, estimated_error_per_cell, 0.3, 0.03);
+ GridRefinement::refine_and_coarsen_fixed_number(triangulation,
+ estimated_error_per_cell,
+ 0.3,
+ 0.03);
float max_smoothness = 0,
min_smoothness = smoothness_indicators.linfty_norm();
estimate_smoothness(smoothness_indicators);
Vector<double> smoothness_field(dof_handler.n_dofs());
- DoFTools::distribute_cell_to_dof_vector(
- dof_handler, smoothness_indicators, smoothness_field);
+ DoFTools::distribute_cell_to_dof_vector(dof_handler,
+ smoothness_indicators,
+ smoothness_field);
Vector<float> fe_indices(triangulation.n_active_cells());
{
static const Point<3> vertices_1[] = {
// points on the lower surface
Point<dim>(0, 0, -4),
- Point<dim>(
- std::cos(0 * numbers::PI / 6), std::sin(0 * numbers::PI / 6), -4),
- Point<dim>(
- std::cos(2 * numbers::PI / 6), std::sin(2 * numbers::PI / 6), -4),
- Point<dim>(
- std::cos(4 * numbers::PI / 6), std::sin(4 * numbers::PI / 6), -4),
- Point<dim>(
- std::cos(6 * numbers::PI / 6), std::sin(6 * numbers::PI / 6), -4),
- Point<dim>(
- std::cos(8 * numbers::PI / 6), std::sin(8 * numbers::PI / 6), -4),
- Point<dim>(
- std::cos(10 * numbers::PI / 6), std::sin(10 * numbers::PI / 6), -4),
+ Point<dim>(std::cos(0 * numbers::PI / 6),
+ std::sin(0 * numbers::PI / 6),
+ -4),
+ Point<dim>(std::cos(2 * numbers::PI / 6),
+ std::sin(2 * numbers::PI / 6),
+ -4),
+ Point<dim>(std::cos(4 * numbers::PI / 6),
+ std::sin(4 * numbers::PI / 6),
+ -4),
+ Point<dim>(std::cos(6 * numbers::PI / 6),
+ std::sin(6 * numbers::PI / 6),
+ -4),
+ Point<dim>(std::cos(8 * numbers::PI / 6),
+ std::sin(8 * numbers::PI / 6),
+ -4),
+ Point<dim>(std::cos(10 * numbers::PI / 6),
+ std::sin(10 * numbers::PI / 6),
+ -4),
// same points on the top
// of the stem, with
Point<dim>(std::cos(4 * numbers::PI / 6), std::sin(4 * numbers::PI / 6), 4),
Point<dim>(std::cos(6 * numbers::PI / 6), std::sin(6 * numbers::PI / 6), 4),
Point<dim>(std::cos(8 * numbers::PI / 6), std::sin(8 * numbers::PI / 6), 4),
- Point<dim>(
- std::cos(10 * numbers::PI / 6), std::sin(10 * numbers::PI / 6), 4),
+ Point<dim>(std::cos(10 * numbers::PI / 6),
+ std::sin(10 * numbers::PI / 6),
+ 4),
// point at top of chevron
Point<dim>(0, 0, 4 + std::sqrt(2.) / 2),
std::sin(2 * numbers::PI / 6),
0) *
4,
- Point<dim>(
- std::cos(0 * numbers::PI / 6), std::sin(0 * numbers::PI / 6), 7) +
- Point<dim>(
- std::cos(2 * numbers::PI / 6), std::sin(2 * numbers::PI / 6), 0) *
+ Point<dim>(std::cos(0 * numbers::PI / 6),
+ std::sin(0 * numbers::PI / 6),
+ 7) +
+ Point<dim>(std::cos(2 * numbers::PI / 6),
+ std::sin(2 * numbers::PI / 6),
+ 0) *
4,
- Point<dim>(
- std::cos(2 * numbers::PI / 6), std::sin(2 * numbers::PI / 6), 7) +
- Point<dim>(
- std::cos(2 * numbers::PI / 6), std::sin(2 * numbers::PI / 6), 0) *
+ Point<dim>(std::cos(2 * numbers::PI / 6),
+ std::sin(2 * numbers::PI / 6),
+ 7) +
+ Point<dim>(std::cos(2 * numbers::PI / 6),
+ std::sin(2 * numbers::PI / 6),
+ 0) *
4,
- Point<dim>(
- std::cos(4 * numbers::PI / 6), std::sin(4 * numbers::PI / 6), 7) +
- Point<dim>(
- std::cos(2 * numbers::PI / 6), std::sin(2 * numbers::PI / 6), 0) *
+ Point<dim>(std::cos(4 * numbers::PI / 6),
+ std::sin(4 * numbers::PI / 6),
+ 7) +
+ Point<dim>(std::cos(2 * numbers::PI / 6),
+ std::sin(2 * numbers::PI / 6),
+ 0) *
4,
// points at the top of the
std::sin(6 * numbers::PI / 6),
0) *
4,
- Point<dim>(
- std::cos(4 * numbers::PI / 6), std::sin(4 * numbers::PI / 6), 7) +
- Point<dim>(
- std::cos(6 * numbers::PI / 6), std::sin(6 * numbers::PI / 6), 0) *
+ Point<dim>(std::cos(4 * numbers::PI / 6),
+ std::sin(4 * numbers::PI / 6),
+ 7) +
+ Point<dim>(std::cos(6 * numbers::PI / 6),
+ std::sin(6 * numbers::PI / 6),
+ 0) *
4,
- Point<dim>(
- std::cos(6 * numbers::PI / 6), std::sin(6 * numbers::PI / 6), 7) +
- Point<dim>(
- std::cos(6 * numbers::PI / 6), std::sin(6 * numbers::PI / 6), 0) *
+ Point<dim>(std::cos(6 * numbers::PI / 6),
+ std::sin(6 * numbers::PI / 6),
+ 7) +
+ Point<dim>(std::cos(6 * numbers::PI / 6),
+ std::sin(6 * numbers::PI / 6),
+ 0) *
4,
- Point<dim>(
- std::cos(8 * numbers::PI / 6), std::sin(8 * numbers::PI / 6), 7) +
- Point<dim>(
- std::cos(6 * numbers::PI / 6), std::sin(6 * numbers::PI / 6), 0) *
+ Point<dim>(std::cos(8 * numbers::PI / 6),
+ std::sin(8 * numbers::PI / 6),
+ 7) +
+ Point<dim>(std::cos(6 * numbers::PI / 6),
+ std::sin(6 * numbers::PI / 6),
+ 0) *
4,
// points at the top of the
std::sin(10 * numbers::PI / 6),
0) *
4,
- Point<dim>(
- std::cos(8 * numbers::PI / 6), std::sin(8 * numbers::PI / 6), 7) +
- Point<dim>(
- std::cos(10 * numbers::PI / 6), std::sin(10 * numbers::PI / 6), 0) *
+ Point<dim>(std::cos(8 * numbers::PI / 6),
+ std::sin(8 * numbers::PI / 6),
+ 7) +
+ Point<dim>(std::cos(10 * numbers::PI / 6),
+ std::sin(10 * numbers::PI / 6),
+ 0) *
4,
- Point<dim>(
- std::cos(10 * numbers::PI / 6), std::sin(10 * numbers::PI / 6), 7) +
- Point<dim>(
- std::cos(10 * numbers::PI / 6), std::sin(10 * numbers::PI / 6), 0) *
+ Point<dim>(std::cos(10 * numbers::PI / 6),
+ std::sin(10 * numbers::PI / 6),
+ 7) +
+ Point<dim>(std::cos(10 * numbers::PI / 6),
+ std::sin(10 * numbers::PI / 6),
+ 0) *
4,
- Point<dim>(
- std::cos(0 * numbers::PI / 6), std::sin(0 * numbers::PI / 6), 7) +
- Point<dim>(
- std::cos(10 * numbers::PI / 6), std::sin(10 * numbers::PI / 6), 0) *
+ Point<dim>(std::cos(0 * numbers::PI / 6),
+ std::sin(0 * numbers::PI / 6),
+ 7) +
+ Point<dim>(std::cos(10 * numbers::PI / 6),
+ std::sin(10 * numbers::PI / 6),
+ 0) *
4,
};
template <int dim>
PointValueEvaluation<dim>::PointValueEvaluation(
- const Point<dim> &evaluation_point) :
- evaluation_point(evaluation_point)
+ const Point<dim> &evaluation_point)
+ : evaluation_point(evaluation_point)
{}
template <int dim>
PointXDerivativeEvaluation<dim>::PointXDerivativeEvaluation(
- const Point<dim> &evaluation_point) :
- evaluation_point(evaluation_point)
+ const Point<dim> &evaluation_point)
+ : evaluation_point(evaluation_point)
{}
template <int dim>
- GridOutput<dim>::GridOutput(const std::string &output_name_base) :
- output_name_base(output_name_base)
+ GridOutput<dim>::GridOutput(const std::string &output_name_base)
+ : output_name_base(output_name_base)
{}
template <int dim>
- Base<dim>::Base(Triangulation<dim> &coarse_grid) : triangulation(&coarse_grid)
+ Base<dim>::Base(Triangulation<dim> &coarse_grid)
+ : triangulation(&coarse_grid)
{}
const hp::FECollection<dim> & fe,
const hp::QCollection<dim> & quadrature,
const hp::QCollection<dim - 1> &face_quadrature,
- const Function<dim> & boundary_values) :
- Base<dim>(triangulation),
- fe(&fe),
- quadrature(&quadrature),
- face_quadrature(&face_quadrature),
- dof_handler(triangulation),
- boundary_values(&boundary_values)
+ const Function<dim> & boundary_values)
+ : Base<dim>(triangulation)
+ , fe(&fe)
+ , quadrature(&quadrature)
+ , face_quadrature(&face_quadrature)
+ , dof_handler(triangulation)
+ , boundary_values(&boundary_values)
{}
const unsigned int n_threads = MultithreadInfo::n_threads();
std::vector<std::pair<active_cell_iterator, active_cell_iterator>>
- thread_ranges = Threads::split_range<active_cell_iterator>(
- dof_handler.begin_active(), dof_handler.end(), n_threads);
+ thread_ranges =
+ Threads::split_range<active_cell_iterator>(dof_handler.begin_active(),
+ dof_handler.end(),
+ n_threads);
Threads::Mutex mutex;
Threads::ThreadGroup<> threads;
linear_system.hanging_node_constraints.condense(linear_system.rhs);
std::map<types::global_dof_index, double> boundary_value_map;
- VectorTools::interpolate_boundary_values(
- dof_handler, 0, *boundary_values, boundary_value_map);
+ VectorTools::interpolate_boundary_values(dof_handler,
+ 0,
+ *boundary_values,
+ boundary_value_map);
threads.join_all();
linear_system.hanging_node_constraints.condense(linear_system.matrix);
- MatrixTools::apply_boundary_values(
- boundary_value_map, linear_system.matrix, solution, linear_system.rhs);
+ MatrixTools::apply_boundary_values(boundary_value_map,
+ linear_system.matrix,
+ solution,
+ linear_system.rhs);
}
const typename hp::DoFHandler<dim>::active_cell_iterator &end_cell,
Threads::Mutex & mutex) const
{
- hp::FEValues<dim> fe_values(
- *fe, *quadrature, update_gradients | update_JxW_values);
+ hp::FEValues<dim> fe_values(*fe,
+ *quadrature,
+ update_gradients | update_JxW_values);
const unsigned int dofs_per_cell = (*fe)[0].dofs_per_cell;
const unsigned int n_q_points = (*quadrature)[0].size();
Threads::Mutex::ScopedLock lock(mutex);
for (unsigned int i = 0; i < dofs_per_cell; ++i)
for (unsigned int j = 0; j < dofs_per_cell; ++j)
- linear_system.matrix.add(
- local_dof_indices[i], local_dof_indices[j], cell_matrix(i, j));
+ linear_system.matrix.add(local_dof_indices[i],
+ local_dof_indices[j],
+ cell_matrix(i, j));
};
}
const hp::QCollection<dim> & quadrature,
const hp::QCollection<dim - 1> &face_quadrature,
const Function<dim> & rhs_function,
- const Function<dim> & boundary_values) :
- Base<dim>(triangulation),
- Solver<dim>(triangulation,
- fe,
- quadrature,
- face_quadrature,
- boundary_values),
- rhs_function(&rhs_function)
+ const Function<dim> & boundary_values)
+ : Base<dim>(triangulation)
+ , Solver<dim>(triangulation,
+ fe,
+ quadrature,
+ face_quadrature,
+ boundary_values)
+ , rhs_function(&rhs_function)
{}
const hp::QCollection<dim> & quadrature,
const hp::QCollection<dim - 1> &face_quadrature,
const Function<dim> & rhs_function,
- const Function<dim> & boundary_values) :
- Base<dim>(coarse_grid),
- PrimalSolver<dim>(coarse_grid,
- fe,
- quadrature,
- face_quadrature,
- rhs_function,
- boundary_values)
+ const Function<dim> & boundary_values)
+ : Base<dim>(coarse_grid)
+ , PrimalSolver<dim>(coarse_grid,
+ fe,
+ quadrature,
+ face_quadrature,
+ rhs_function,
+ boundary_values)
{}
const hp::QCollection<dim> & quadrature,
const hp::QCollection<dim - 1> &face_quadrature,
const Function<dim> & rhs_function,
- const Function<dim> & boundary_values) :
- Base<dim>(coarse_grid),
- PrimalSolver<dim>(coarse_grid,
- fe,
- quadrature,
- face_quadrature,
- rhs_function,
- boundary_values)
+ const Function<dim> & boundary_values)
+ : Base<dim>(coarse_grid)
+ , PrimalSolver<dim>(coarse_grid,
+ fe,
+ quadrature,
+ face_quadrature,
+ rhs_function,
+ boundary_values)
{}
typename FunctionMap<dim>::type(),
this->solution,
estimated_error_per_cell);
- GridRefinement::refine_and_coarsen_fixed_number(
- *this->triangulation, estimated_error_per_cell, 0.3, 0.03);
+ GridRefinement::refine_and_coarsen_fixed_number(*this->triangulation,
+ estimated_error_per_cell,
+ 0.3,
+ 0.03);
this->triangulation->execute_coarsening_and_refinement();
}
const hp::QCollection<dim - 1> &face_quadrature,
const Function<dim> & rhs_function,
const Function<dim> & boundary_values,
- const Function<dim> & weighting_function) :
- Base<dim>(coarse_grid),
- PrimalSolver<dim>(coarse_grid,
- fe,
- quadrature,
- face_quadrature,
- rhs_function,
- boundary_values),
- weighting_function(&weighting_function)
+ const Function<dim> & weighting_function)
+ : Base<dim>(coarse_grid)
+ , PrimalSolver<dim>(coarse_grid,
+ fe,
+ quadrature,
+ face_quadrature,
+ rhs_function,
+ boundary_values)
+ , weighting_function(&weighting_function)
{}
for (unsigned int cell_index = 0; cell != endc; ++cell, ++cell_index)
estimated_error(cell_index) *= weighting_function->value(cell->center());
- GridRefinement::refine_and_coarsen_fixed_number(
- *this->triangulation, estimated_error, 0.3, 0.03);
+ GridRefinement::refine_and_coarsen_fixed_number(*this->triangulation,
+ estimated_error,
+ 0.3,
+ 0.03);
this->triangulation->execute_coarsening_and_refinement();
}
class BoundaryValues : public Function<dim>
{
public:
- BoundaryValues() : Function<dim>()
+ BoundaryValues()
+ : Function<dim>()
{}
virtual double
class RightHandSide : public Function<dim>
{
public:
- RightHandSide() : Function<dim>()
+ RightHandSide()
+ : Function<dim>()
{}
virtual double
class RightHandSide : public Functions::ConstantFunction<dim>
{
public:
- RightHandSide() : Functions::ConstantFunction<dim>(1.)
+ RightHandSide()
+ : Functions::ConstantFunction<dim>(1.)
{}
};
template <int dim>
PointValueEvaluation<dim>::PointValueEvaluation(
- const Point<dim> &evaluation_point) :
- evaluation_point(evaluation_point)
+ const Point<dim> &evaluation_point)
+ : evaluation_point(evaluation_point)
{}
template <int dim>
PointXDerivativeEvaluation<dim>::PointXDerivativeEvaluation(
- const Point<dim> &evaluation_point) :
- evaluation_point(evaluation_point)
+ const Point<dim> &evaluation_point)
+ : evaluation_point(evaluation_point)
{}
const hp::FECollection<dim> & fe,
const hp::QCollection<dim> & quadrature,
const hp::QCollection<dim - 1> & face_quadrature,
- const DualFunctional::DualFunctionalBase<dim> &dual_functional) :
- Base<dim>(triangulation),
- Solver<dim>(triangulation,
- fe,
- quadrature,
- face_quadrature,
- boundary_values),
- dual_functional(&dual_functional)
+ const DualFunctional::DualFunctionalBase<dim> &dual_functional)
+ : Base<dim>(triangulation)
+ , Solver<dim>(triangulation,
+ fe,
+ quadrature,
+ face_quadrature,
+ boundary_values)
+ , dual_functional(&dual_functional)
{}
WeightedResidual<dim>::CellData::CellData(
const hp::FECollection<dim> &fe,
const hp::QCollection<dim> & quadrature,
- const Function<dim> & right_hand_side) :
- fe_values(fe,
- quadrature,
- update_values | update_hessians | update_quadrature_points |
- update_JxW_values),
- right_hand_side(&right_hand_side)
+ const Function<dim> & right_hand_side)
+ : fe_values(fe,
+ quadrature,
+ update_values | update_hessians | update_quadrature_points |
+ update_JxW_values)
+ , right_hand_side(&right_hand_side)
{
const unsigned int n_q_points = quadrature[0].size();
template <int dim>
WeightedResidual<dim>::FaceData::FaceData(
const hp::FECollection<dim> & fe,
- const hp::QCollection<dim - 1> &face_quadrature) :
- fe_face_values_cell(fe,
- face_quadrature,
- update_values | update_gradients | update_JxW_values |
- update_normal_vectors),
- fe_face_values_neighbor(fe,
- face_quadrature,
- update_values | update_gradients |
- update_JxW_values | update_normal_vectors),
- fe_subface_values_cell(fe, face_quadrature, update_gradients)
+ const hp::QCollection<dim - 1> &face_quadrature)
+ : fe_face_values_cell(fe,
+ face_quadrature,
+ update_values | update_gradients | update_JxW_values |
+ update_normal_vectors)
+ , fe_face_values_neighbor(fe,
+ face_quadrature,
+ update_values | update_gradients |
+ update_JxW_values | update_normal_vectors)
+ , fe_subface_values_cell(fe, face_quadrature, update_gradients)
{
const unsigned int n_face_q_points = face_quadrature[0].size();
const hp::QCollection<dim - 1> & face_quadrature,
const Function<dim> & rhs_function,
const Function<dim> & bv,
- const DualFunctional::DualFunctionalBase<dim> &dual_functional) :
- Base<dim>(coarse_grid),
- PrimalSolver<dim>(coarse_grid,
- primal_fe,
+ const DualFunctional::DualFunctionalBase<dim> &dual_functional)
+ : Base<dim>(coarse_grid)
+ , PrimalSolver<dim>(coarse_grid,
+ primal_fe,
+ quadrature,
+ face_quadrature,
+ rhs_function,
+ bv)
+ , DualSolver<dim>(coarse_grid,
+ dual_fe,
quadrature,
face_quadrature,
- rhs_function,
- bv),
- DualSolver<dim>(coarse_grid,
- dual_fe,
- quadrature,
- face_quadrature,
- dual_functional)
+ dual_functional)
{}
++i)
*i = std::fabs(*i);
- GridRefinement::refine_and_coarsen_fixed_fraction(
- *this->triangulation, error_indicators, 0.8, 0.02);
+ GridRefinement::refine_and_coarsen_fixed_fraction(*this->triangulation,
+ error_indicators,
+ 0.8,
+ 0.02);
this->triangulation->execute_coarsening_and_refinement();
}
0.5 * face_integrals[cell->face(face_no)];
};
deallog << " Estimated error="
- << std::accumulate(
- error_indicators.begin(), error_indicators.end(), 0.)
+ << std::accumulate(error_indicators.begin(),
+ error_indicators.end(),
+ 0.)
<< std::endl;
}
const PrimalSolver<dim> &primal_solver = *this;
const DualSolver<dim> & dual_solver = *this;
- CellData cell_data(
- *dual_solver.fe, *dual_solver.quadrature, *primal_solver.rhs_function);
+ CellData cell_data(*dual_solver.fe,
+ *dual_solver.quadrature,
+ *primal_solver.rhs_function);
FaceData face_data(*dual_solver.fe, *dual_solver.face_quadrature);
active_cell_iterator cell = dual_solver.dof_handler.begin_active();
template <int dim>
-Framework<dim>::ProblemDescription::ProblemDescription() :
- primal_fe_degree(1),
- dual_fe_degree(2),
- refinement_criterion(dual_weighted_error_estimator),
- max_degrees_of_freedom(5000)
+Framework<dim>::ProblemDescription::ProblemDescription()
+ : primal_fe_degree(1)
+ , dual_fe_degree(2)
+ , refinement_criterion(dual_weighted_error_estimator)
+ , max_degrees_of_freedom(5000)
{}
class InitializationValues : public Function<1>
{
public:
- InitializationValues() : Function<1>()
+ InitializationValues()
+ : Function<1>()
{}
virtual double
template <int dim>
-MinimizationProblem<dim>::MinimizationProblem(const unsigned int run_number) :
- run_number(run_number),
- fe(FE_Q<dim>(1)),
- dof_handler(triangulation)
+MinimizationProblem<dim>::MinimizationProblem(const unsigned int run_number)
+ : run_number(run_number)
+ , fe(FE_Q<dim>(1))
+ , dof_handler(triangulation)
{}
MinimizationProblem<1>::initialize_solution()
{
present_solution.reinit(dof_handler.n_dofs());
- VectorTools::interpolate(
- dof_handler, InitializationValues(), present_solution);
+ VectorTools::interpolate(dof_handler,
+ InitializationValues(),
+ present_solution);
hp::DoFHandler<1>::cell_iterator cell;
cell = dof_handler.begin(0);
for (unsigned int i = 0; i < dofs_per_cell; ++i)
{
for (unsigned int j = 0; j < dofs_per_cell; ++j)
- matrix.add(
- local_dof_indices[i], local_dof_indices[j], cell_matrix(i, j));
+ matrix.add(local_dof_indices[i],
+ local_dof_indices[j],
+ cell_matrix(i, j));
residual(local_dof_indices[i]) += cell_rhs(i);
}
hanging_node_constraints.condense(residual);
std::map<types::global_dof_index, double> boundary_values;
- VectorTools::interpolate_boundary_values(
- dof_handler, 0, Functions::ZeroFunction<dim>(), boundary_values);
+ VectorTools::interpolate_boundary_values(dof_handler,
+ 0,
+ Functions::ZeroFunction<dim>(),
+ boundary_values);
if (dim == 1)
- VectorTools::interpolate_boundary_values(
- dof_handler, 1, Functions::ZeroFunction<dim>(), boundary_values);
+ VectorTools::interpolate_boundary_values(dof_handler,
+ 1,
+ Functions::ZeroFunction<dim>(),
+ boundary_values);
Vector<double> dummy(residual.size());
MatrixTools::apply_boundary_values(boundary_values, matrix, dummy, residual);
}
}
}
- GridRefinement::refine_and_coarsen_fixed_number(
- triangulation, error_indicators, 0.3, 0.03);
+ GridRefinement::refine_and_coarsen_fixed_number(triangulation,
+ error_indicators,
+ 0.3,
+ 0.03);
triangulation.prepare_coarsening_and_refinement();
SolutionTransfer<dim> solution_transfer(dof_handler);
class TestMap1 : public Function<dim>
{
public:
- TestMap1(const unsigned int n_components) : Function<dim>(n_components)
+ TestMap1(const unsigned int n_components)
+ : Function<dim>(n_components)
{}
virtual ~TestMap1()
const double phi;
public:
- TestDef1(const unsigned int n_components, const double ph) :
- Function<dim>(n_components),
- phi(ph)
+ TestDef1(const unsigned int n_components, const double ph)
+ : Function<dim>(n_components)
+ , phi(ph)
{}
virtual ~TestDef1()
const double scale;
public:
- TestDef2(const unsigned int n_components, const double sc) :
- Function<dim>(n_components),
- scale(sc)
+ TestDef2(const unsigned int n_components, const double sc)
+ : Function<dim>(n_components)
+ , scale(sc)
{}
virtual ~TestDef2()
const double scale;
public:
- TestDef3(const unsigned int n_components, const double sc) :
- Function<dim>(n_components),
- scale(sc)
+ TestDef3(const unsigned int n_components, const double sc)
+ : Function<dim>(n_components)
+ , scale(sc)
{}
virtual ~TestDef3()
{
// Use a high order quadrature.
QGauss<2> quad(6);
- FEValues<2> fe_values(
- mapping,
- dof_handler->get_fe(),
- quad,
- UpdateFlags(update_values | update_quadrature_points | update_JxW_values));
+ FEValues<2> fe_values(mapping,
+ dof_handler->get_fe(),
+ quad,
+ UpdateFlags(update_values | update_quadrature_points |
+ update_JxW_values));
const unsigned int n_q_points = quad.size();
const unsigned int n_components = dof_handler->get_fe().n_components();
class TestMap1 : public Function<dim>
{
public:
- TestMap1(const unsigned int n_components) : Function<dim>(n_components)
+ TestMap1(const unsigned int n_components)
+ : Function<dim>(n_components)
{}
virtual ~TestMap1()
const double phi;
public:
- TestDef1(const unsigned int n_components, const double ph) :
- Function<dim>(n_components),
- phi(ph)
+ TestDef1(const unsigned int n_components, const double ph)
+ : Function<dim>(n_components)
+ , phi(ph)
{}
virtual ~TestDef1()
const double scale;
public:
- TestDef2(const unsigned int n_components, const double sc) :
- Function<dim>(n_components),
- scale(sc)
+ TestDef2(const unsigned int n_components, const double sc)
+ : Function<dim>(n_components)
+ , scale(sc)
{}
virtual ~TestDef2()
const double scale;
public:
- TestDef3(const unsigned int n_components, const double sc) :
- Function<dim>(n_components),
- scale(sc)
+ TestDef3(const unsigned int n_components, const double sc)
+ : Function<dim>(n_components)
+ , scale(sc)
{}
virtual ~TestDef3()
class InitializationValues : public Function<1>
{
public:
- InitializationValues() : Function<1>()
+ InitializationValues()
+ : Function<1>()
{}
virtual double
template <int dim>
-MinimizationProblem<dim>::MinimizationProblem(const unsigned int run_number) :
- run_number(run_number),
- fe(1),
- dof_handler(triangulation)
+MinimizationProblem<dim>::MinimizationProblem(const unsigned int run_number)
+ : run_number(run_number)
+ , fe(1)
+ , dof_handler(triangulation)
{}
MinimizationProblem<1>::initialize_solution()
{
present_solution.reinit(dof_handler.n_dofs());
- VectorTools::interpolate(
- dof_handler, InitializationValues(), present_solution);
+ VectorTools::interpolate(dof_handler,
+ InitializationValues(),
+ present_solution);
DoFHandler<1>::cell_iterator cell;
cell = dof_handler.begin(0);
for (unsigned int i = 0; i < dofs_per_cell; ++i)
{
for (unsigned int j = 0; j < dofs_per_cell; ++j)
- matrix.add(
- local_dof_indices[i], local_dof_indices[j], cell_matrix(i, j));
+ matrix.add(local_dof_indices[i],
+ local_dof_indices[j],
+ cell_matrix(i, j));
residual(local_dof_indices[i]) += cell_rhs(i);
}
hanging_node_constraints.condense(residual);
std::map<types::global_dof_index, double> boundary_values;
- VectorTools::interpolate_boundary_values(
- dof_handler, 0, Functions::ZeroFunction<dim>(), boundary_values);
+ VectorTools::interpolate_boundary_values(dof_handler,
+ 0,
+ Functions::ZeroFunction<dim>(),
+ boundary_values);
if (dim == 1)
- VectorTools::interpolate_boundary_values(
- dof_handler, 1, Functions::ZeroFunction<dim>(), boundary_values);
+ VectorTools::interpolate_boundary_values(dof_handler,
+ 1,
+ Functions::ZeroFunction<dim>(),
+ boundary_values);
Vector<double> dummy(residual.size());
MatrixTools::apply_boundary_values(boundary_values, matrix, dummy, residual);
}
}
}
- GridRefinement::refine_and_coarsen_fixed_number(
- triangulation, error_indicators, 0.3, 0.03);
+ GridRefinement::refine_and_coarsen_fixed_number(triangulation,
+ error_indicators,
+ 0.3,
+ 0.03);
triangulation.prepare_coarsening_and_refinement();
SolutionTransfer<dim> solution_transfer(dof_handler);
class MySquareFunction : public Function<dim>
{
public:
- MySquareFunction() : Function<dim>(dim)
+ MySquareFunction()
+ : Function<dim>(dim)
{}
virtual double
quadrature.push_back(QGauss<dim - 1>(3 + i));
Vector<double> rhs(dof.n_dofs());
- VectorTools::create_boundary_right_hand_side(
- dof, quadrature, MySquareFunction<dim>(), rhs);
+ VectorTools::create_boundary_right_hand_side(dof,
+ quadrature,
+ MySquareFunction<dim>(),
+ rhs);
for (unsigned int i = 0; i < rhs.size(); ++i)
deallog << rhs(i) << std::endl;
}
class MySquareFunction : public Function<dim>
{
public:
- MySquareFunction() : Function<dim>(dim)
+ MySquareFunction()
+ : Function<dim>(dim)
{}
virtual double
quadrature.push_back(QGauss<dim>(3 + i));
Vector<double> rhs(dof.n_dofs());
- VectorTools::create_right_hand_side(
- dof, quadrature, MySquareFunction<dim>(), rhs);
+ VectorTools::create_right_hand_side(dof,
+ quadrature,
+ MySquareFunction<dim>(),
+ rhs);
for (unsigned int i = 0; i < rhs.size(); ++i)
deallog << rhs(i) << std::endl;
}
// set up mass matrix and right hand side
vec.reinit(dof.n_dofs());
- SparsityPattern sparsity(
- dof.n_dofs(), dof.n_dofs(), dof.max_couplings_between_dofs());
+ SparsityPattern sparsity(dof.n_dofs(),
+ dof.n_dofs(),
+ dof.max_couplings_between_dofs());
DoFTools::make_sparsity_pattern(dof, sparsity);
constraints.condense(sparsity);
PreconditionSSOR<> prec;
prec.initialize(mass_matrix, 1.2);
// solve
- check_solver_within_range(
- cg.solve(mass_matrix, vec, tmp, prec), control.last_step(), 16, 17);
+ check_solver_within_range(cg.solve(mass_matrix, vec, tmp, prec),
+ control.last_step(),
+ 16,
+ 17);
// distribute solution
constraints.distribute(vec);
// set up mass matrix and right hand side
vec.reinit(dof.n_dofs());
- SparsityPattern sparsity(
- dof.n_dofs(), dof.n_dofs(), dof.max_couplings_between_dofs());
+ SparsityPattern sparsity(dof.n_dofs(),
+ dof.n_dofs(),
+ dof.max_couplings_between_dofs());
DoFTools::make_sparsity_pattern(dof, sparsity);
constraints.condense(sparsity);
points[1][d] = 0.85;
const Quadrature<dim> quadrature(points);
- FEValues<dim> fe_values(
- mapping, fe, quadrature, update_gradients | update_jacobians);
+ FEValues<dim> fe_values(mapping,
+ fe,
+ quadrature,
+ update_gradients | update_jacobians);
for (typename DoFHandler<dim>::active_cell_iterator cell = dof.begin_active();
cell != dof.end();
class ExactSolution : public Function<dim>
{
public:
- ExactSolution() : Function<dim>(2)
+ ExactSolution()
+ : Function<dim>(2)
{}
virtual double
value(const Point<dim> &p, const unsigned int component) const;
// DEFINE RIGHT HAND SIDE MEMBERS
template <int dim>
-RightHandSide<dim>::RightHandSide() : Function<dim>(dim)
+RightHandSide<dim>::RightHandSide()
+ : Function<dim>(dim)
{}
template <int dim>
inline void
// END RIGHT HAND SIDE MEMBERS
template <int dim>
-MaxwellProblem<dim>::MaxwellProblem(const unsigned int order) :
- dof_handler(triangulation),
- fe(order)
+MaxwellProblem<dim>::MaxwellProblem(const unsigned int order)
+ : dof_handler(triangulation)
+ , fe(order)
{
p_order = order;
quad_order = p_order + 2;
class TestMap1 : public Function<dim>
{
public:
- TestMap1(const unsigned int n_components) : Function<dim>(n_components)
+ TestMap1(const unsigned int n_components)
+ : Function<dim>(n_components)
{}
virtual ~TestMap1()
// set up mass matrix and right hand side
vec.reinit(dof.n_dofs());
- SparsityPattern sparsity(
- dof.n_dofs(), dof.n_dofs(), dof.max_couplings_between_dofs());
+ SparsityPattern sparsity(dof.n_dofs(),
+ dof.n_dofs(),
+ dof.max_couplings_between_dofs());
DoFTools::make_sparsity_pattern(dof, sparsity);
constraints.condense(sparsity);
QTrapez<dim> q;
// QIterated<dim> q(q_trapez, div);
- FEValues<dim> fe(
- mapping, finel, q, UpdateFlags(update_gradients | update_hessians));
+ FEValues<dim> fe(mapping,
+ finel,
+ q,
+ UpdateFlags(update_gradients | update_hessians));
fe.reinit(c);
unsigned int k = 0;
QTrapez<dim> q;
// QIterated<dim> q(q_trapez, div);
- FEValues<dim> fe(
- mapping, finel, q, UpdateFlags(update_gradients | update_hessians));
+ FEValues<dim> fe(mapping,
+ finel,
+ q,
+ UpdateFlags(update_gradients | update_hessians));
fe.reinit(c);
unsigned int k = 0;
QGauss<dim - 1> q(1);
// QIterated<dim> q(q_trapez, div);
- FEFaceValues<dim> fe(
- mapping, finel, q, UpdateFlags(update_gradients | update_hessians));
+ FEFaceValues<dim> fe(mapping,
+ finel,
+ q,
+ UpdateFlags(update_gradients | update_hessians));
for (unsigned int face = 0; face < GeometryInfo<dim>::faces_per_cell; ++face)
{
fe.reinit(c, face);
{
Tensor<1, dim> gradient =
fe_face_values[single_component].gradient(i, q);
- Tensor<2, dim> gradient_normal_outer_prod = outer_product(
- gradient, fe_face_values.normal_vector(q));
+ Tensor<2, dim> gradient_normal_outer_prod =
+ outer_product(gradient,
+ fe_face_values.normal_vector(q));
boundary_integral +=
gradient_normal_outer_prod * fe_face_values.JxW(q);
}
class EnrichmentFunction : public Function<dim>
{
public:
- EnrichmentFunction() : Function<dim>(1)
+ EnrichmentFunction()
+ : Function<dim>(1)
{}
virtual double
class EnrichmentFunction : public Function<dim>
{
public:
- EnrichmentFunction() : Function<dim>(1)
+ EnrichmentFunction()
+ : Function<dim>(1)
{}
virtual double
dof_handler.distribute_dofs(fe);
QGauss<dim> quadrature(1);
- FEValues<dim> fe_values(
- fe, quadrature, update_values | update_gradients | update_JxW_values);
+ FEValues<dim> fe_values(fe,
+ quadrature,
+ update_values | update_gradients | update_JxW_values);
typename DoFHandler<dim>::active_cell_iterator cell =
dof_handler.begin_active(),
class EnrichmentFunction : public Function<dim>
{
public:
- EnrichmentFunction() : Function<dim>(1)
+ EnrichmentFunction()
+ : Function<dim>(1)
{}
virtual double
class EnrichmentFunction : public Function<dim>
{
public:
- EnrichmentFunction() : Function<dim>(1)
+ EnrichmentFunction()
+ : Function<dim>(1)
{}
virtual double
dof_handler.distribute_dofs(fe);
QGauss<dim> quadrature(2);
- FEValues<dim> fe_values(
- fe, quadrature, update_values | update_gradients | update_JxW_values);
+ FEValues<dim> fe_values(fe,
+ quadrature,
+ update_values | update_gradients | update_JxW_values);
Vector<double> solution_fe(dof_handler.n_dofs()),
solution_pou(dof_handler.n_dofs()), solution(dof_handler.n_dofs());
class EnrichmentFunction : public Function<dim>
{
public:
- EnrichmentFunction() : Function<dim>(1)
+ EnrichmentFunction()
+ : Function<dim>(1)
{}
virtual double
class EnrichmentFunction : public Function<dim>
{
public:
- EnrichmentFunction() : Function<dim>(1)
+ EnrichmentFunction()
+ : Function<dim>(1)
{}
virtual double
class EnrichmentFunction : public Function<dim>
{
public:
- EnrichmentFunction() : Function<dim>(1)
+ EnrichmentFunction()
+ : Function<dim>(1)
{}
virtual double
class EnrichmentFunction : public Function<dim>
{
public:
- EnrichmentFunction() : Function<dim>(1)
+ EnrichmentFunction()
+ : Function<dim>(1)
{}
virtual double
{
Triangulation<dim> triangulationL;
Triangulation<dim> triangulationR;
- GridGenerator::hyper_cube(
- triangulationL, -1, 0); // create a square [-1,0]^d domain
- GridGenerator::hyper_cube(
- triangulationR, -1, 0); // create a square [-1,0]^d domain
+ GridGenerator::hyper_cube(triangulationL,
+ -1,
+ 0); // create a square [-1,0]^d domain
+ GridGenerator::hyper_cube(triangulationR,
+ -1,
+ 0); // create a square [-1,0]^d domain
Point<dim> shift_vector;
shift_vector[0] = 1.0;
GridTools::shift(shift_vector, triangulationR);
- GridGenerator::merge_triangulations(
- triangulationL, triangulationR, triangulation);
+ GridGenerator::merge_triangulations(triangulationL,
+ triangulationR,
+ triangulation);
}
hp::DoFHandler<dim> dof_handler(triangulation);
{
Triangulation<dim> triangulationL;
Triangulation<dim> triangulationR;
- GridGenerator::hyper_cube(
- triangulationL, -1, 0); // create a square [-1,0]^d domain
- GridGenerator::hyper_cube(
- triangulationR, -1, 0); // create a square [-1,0]^d domain
+ GridGenerator::hyper_cube(triangulationL,
+ -1,
+ 0); // create a square [-1,0]^d domain
+ GridGenerator::hyper_cube(triangulationR,
+ -1,
+ 0); // create a square [-1,0]^d domain
Point<dim> shift_vector;
shift_vector[0] = 1.0;
GridTools::shift(shift_vector, triangulationR);
- GridGenerator::merge_triangulations(
- triangulationL, triangulationR, triangulation);
+ GridGenerator::merge_triangulations(triangulationL,
+ triangulationR,
+ triangulation);
}
hp::DoFHandler<dim> dof_handler(triangulation);
class EnrichmentFunction : public Function<dim>
{
public:
- EnrichmentFunction() : Function<dim>(1)
+ EnrichmentFunction()
+ : Function<dim>(1)
{}
virtual double
p2[d] = 2.0;
repetitions[d] = 3;
}
- GridGenerator::subdivided_hyper_rectangle(
- triangulation, repetitions, p1, p2);
+ GridGenerator::subdivided_hyper_rectangle(triangulation,
+ repetitions,
+ p1,
+ p2);
if (distort)
GridTools::distort_random(0.1, triangulation);
class EnrichmentFunction : public Function<dim>
{
public:
- EnrichmentFunction(const Point<dim> &origin) :
- Function<dim>(1),
- origin(origin)
+ EnrichmentFunction(const Point<dim> &origin)
+ : Function<dim>(1)
+ , origin(origin)
{}
virtual double
p2[d] = 2.0;
repetitions[d] = 3;
}
- GridGenerator::subdivided_hyper_rectangle(
- triangulation, repetitions, p1, p2);
+ GridGenerator::subdivided_hyper_rectangle(triangulation,
+ repetitions,
+ p1,
+ p2);
if (distort)
GridTools::distort_random(0.1, triangulation);
class PotentialFunction : public Function<dim>
{
public:
- PotentialFunction() : Function<dim>(1)
+ PotentialFunction()
+ : Function<dim>(1)
{}
virtual double
public:
EnrichmentFunction(const Point<dim> &origin,
const double & Z,
- const double & radius) :
- Function<dim>(1),
- origin(origin),
- Z(Z),
- radius(radius)
+ const double & radius)
+ : Function<dim>(1)
+ , origin(origin)
+ , Z(Z)
+ , radius(radius)
{}
virtual double
};
template <int dim>
- EigenvalueProblem<dim>::EigenvalueProblem() :
- dof_handler(triangulation),
- mpi_communicator(MPI_COMM_WORLD),
- n_mpi_processes(Utilities::MPI::n_mpi_processes(mpi_communicator)),
- this_mpi_process(Utilities::MPI::this_mpi_process(mpi_communicator)),
- pcout(std::cout, (this_mpi_process == 0)),
- number_of_eigenvalues(1),
- enrichment(
- Point<dim>(),
- /*Z*/ 1.0,
- /*radius*/ 2.5), // radius is set such that 8 cells are marked as enriched
- fe_extractor(/*dofs start at...*/ 0),
- fe_fe_index(0),
- fe_material_id(0),
- pou_extractor(/*dofs start at (scalar fields!)*/ 1),
- pou_fe_index(1),
- pou_material_id(1)
+ EigenvalueProblem<dim>::EigenvalueProblem()
+ : dof_handler(triangulation)
+ , mpi_communicator(MPI_COMM_WORLD)
+ , n_mpi_processes(Utilities::MPI::n_mpi_processes(mpi_communicator))
+ , this_mpi_process(Utilities::MPI::this_mpi_process(mpi_communicator))
+ , pcout(std::cout, (this_mpi_process == 0))
+ , number_of_eigenvalues(1)
+ , enrichment(Point<dim>(),
+ /*Z*/ 1.0,
+ /*radius*/ 2.5)
+ , // radius is set such that 8 cells are marked as enriched
+ fe_extractor(/*dofs start at...*/ 0)
+ , fe_fe_index(0)
+ , fe_material_id(0)
+ , pou_extractor(/*dofs start at (scalar fields!)*/ 1)
+ , pou_fe_index(1)
+ , pou_material_id(1)
{
GridGenerator::hyper_cube(triangulation, -10, 10);
triangulation.refine_global(2); // 64 cells
constraints.clear();
constraints.reinit(locally_relevant_dofs);
DoFTools::make_hanging_node_constraints(dof_handler, constraints);
- VectorTools::interpolate_boundary_values(
- dof_handler, 0, Functions::ZeroFunction<dim>(1), constraints);
+ VectorTools::interpolate_boundary_values(dof_handler,
+ 0,
+ Functions::ZeroFunction<dim>(1),
+ constraints);
constraints.close();
// Initialise the stiffness and mass matrices
n_locally_owned_dofs[i] =
locally_owned_dofs_per_processor[i].n_elements();
- SparsityTools::distribute_sparsity_pattern(
- csp, n_locally_owned_dofs, mpi_communicator, locally_relevant_dofs);
+ SparsityTools::distribute_sparsity_pattern(csp,
+ n_locally_owned_dofs,
+ mpi_communicator,
+ locally_relevant_dofs);
- stiffness_matrix.reinit(
- locally_owned_dofs, locally_owned_dofs, csp, mpi_communicator);
+ stiffness_matrix.reinit(locally_owned_dofs,
+ locally_owned_dofs,
+ csp,
+ mpi_communicator);
- mass_matrix.reinit(
- locally_owned_dofs, locally_owned_dofs, csp, mpi_communicator);
+ mass_matrix.reinit(locally_owned_dofs,
+ locally_owned_dofs,
+ csp,
+ mpi_communicator);
// reinit vectors
eigenfunctions.resize(number_of_eigenvalues);
{
eigenfunctions[i].reinit(locally_owned_dofs,
mpi_communicator); // without ghost dofs
- eigenfunctions_locally_relevant[i].reinit(
- locally_owned_dofs, locally_relevant_dofs, mpi_communicator);
+ eigenfunctions_locally_relevant[i].reinit(locally_owned_dofs,
+ locally_relevant_dofs,
+ mpi_communicator);
vec_estimated_error_per_cell[i].reinit(triangulation.n_active_cells());
}
cell->get_dof_indices(local_dof_indices);
- constraints.distribute_local_to_global(
- cell_stiffness_matrix, local_dof_indices, stiffness_matrix);
- constraints.distribute_local_to_global(
- cell_mass_matrix, local_dof_indices, mass_matrix);
+ constraints.distribute_local_to_global(cell_stiffness_matrix,
+ local_dof_indices,
+ stiffness_matrix);
+ constraints.distribute_local_to_global(cell_mass_matrix,
+ local_dof_indices,
+ mass_matrix);
}
stiffness_matrix.compress(VectorOperation::add);
class PotentialFunction : public dealii::Function<dim>
{
public:
- PotentialFunction() : dealii::Function<dim>(1)
+ PotentialFunction()
+ : dealii::Function<dim>(1)
{}
virtual double
public:
EnrichmentFunction(const Point<dim> &origin,
const double & Z,
- const double & radius) :
- Function<dim>(1),
- origin(origin),
- Z(Z),
- radius(radius)
+ const double & radius)
+ : Function<dim>(1)
+ , origin(origin)
+ , Z(Z)
+ , radius(radius)
{}
virtual double
};
template <int dim>
- EigenvalueProblem<dim>::EigenvalueProblem() :
- dof_handler(triangulation),
- mpi_communicator(MPI_COMM_WORLD),
- n_mpi_processes(dealii::Utilities::MPI::n_mpi_processes(mpi_communicator)),
- this_mpi_process(
- dealii::Utilities::MPI::this_mpi_process(mpi_communicator)),
- pcout(std::cout, (this_mpi_process == 0)),
- number_of_eigenvalues(1),
- enrichment(
- Point<dim>(),
- /*Z*/ 1.0,
- /*radius*/ 2.5), // radius is set such that 8 cells are marked as enriched
- fe_extractor(/*dofs start at...*/ 0),
- fe_group(/*in FE*/ 0),
- fe_fe_index(0),
- fe_material_id(0),
- pou_extractor(/*dofs start at (scalar fields!)*/ 1),
- pou_group(/*FE*/ 1),
- pou_fe_index(1),
- pou_material_id(1)
+ EigenvalueProblem<dim>::EigenvalueProblem()
+ : dof_handler(triangulation)
+ , mpi_communicator(MPI_COMM_WORLD)
+ , n_mpi_processes(dealii::Utilities::MPI::n_mpi_processes(mpi_communicator))
+ , this_mpi_process(
+ dealii::Utilities::MPI::this_mpi_process(mpi_communicator))
+ , pcout(std::cout, (this_mpi_process == 0))
+ , number_of_eigenvalues(1)
+ , enrichment(Point<dim>(),
+ /*Z*/ 1.0,
+ /*radius*/ 2.5)
+ , // radius is set such that 8 cells are marked as enriched
+ fe_extractor(/*dofs start at...*/ 0)
+ , fe_group(/*in FE*/ 0)
+ , fe_fe_index(0)
+ , fe_material_id(0)
+ , pou_extractor(/*dofs start at (scalar fields!)*/ 1)
+ , pou_group(/*FE*/ 1)
+ , pou_fe_index(1)
+ , pou_material_id(1)
{
dealii::GridGenerator::hyper_cube(triangulation, -10, 10);
triangulation.refine_global(2); // 64 cells
constraints.clear();
constraints.reinit(locally_relevant_dofs);
DoFTools::make_hanging_node_constraints(dof_handler, constraints);
- VectorTools::interpolate_boundary_values(
- dof_handler, 0, Functions::ZeroFunction<dim>(2), constraints);
+ VectorTools::interpolate_boundary_values(dof_handler,
+ 0,
+ Functions::ZeroFunction<dim>(2),
+ constraints);
constrain_pou_dofs();
constraints.close();
n_locally_owned_dofs[i] =
locally_owned_dofs_per_processor[i].n_elements();
- SparsityTools::distribute_sparsity_pattern(
- csp, n_locally_owned_dofs, mpi_communicator, locally_relevant_dofs);
+ SparsityTools::distribute_sparsity_pattern(csp,
+ n_locally_owned_dofs,
+ mpi_communicator,
+ locally_relevant_dofs);
- stiffness_matrix.reinit(
- locally_owned_dofs, locally_owned_dofs, csp, mpi_communicator);
+ stiffness_matrix.reinit(locally_owned_dofs,
+ locally_owned_dofs,
+ csp,
+ mpi_communicator);
- mass_matrix.reinit(
- locally_owned_dofs, locally_owned_dofs, csp, mpi_communicator);
+ mass_matrix.reinit(locally_owned_dofs,
+ locally_owned_dofs,
+ csp,
+ mpi_communicator);
// reinit vectors
eigenfunctions.resize(number_of_eigenvalues);
{
eigenfunctions[i].reinit(locally_owned_dofs,
mpi_communicator); // without ghost dofs
- eigenfunctions_locally_relevant[i].reinit(
- locally_owned_dofs, locally_relevant_dofs, mpi_communicator);
+ eigenfunctions_locally_relevant[i].reinit(locally_owned_dofs,
+ locally_relevant_dofs,
+ mpi_communicator);
vec_estimated_error_per_cell[i].reinit(triangulation.n_active_cells());
}
cell->get_dof_indices(local_dof_indices);
- constraints.distribute_local_to_global(
- cell_stiffness_matrix, local_dof_indices, stiffness_matrix);
- constraints.distribute_local_to_global(
- cell_mass_matrix, local_dof_indices, mass_matrix);
+ constraints.distribute_local_to_global(cell_stiffness_matrix,
+ local_dof_indices,
+ stiffness_matrix);
+ constraints.distribute_local_to_global(cell_mass_matrix,
+ local_dof_indices,
+ mass_matrix);
}
stiffness_matrix.compress(dealii::VectorOperation::add);
std::pair<unsigned int, double>
EigenvalueProblem<dim>::solve()
{
- dealii::SolverControl solver_control(
- dof_handler.n_dofs(), 1e-9, false, false);
+ dealii::SolverControl solver_control(dof_handler.n_dofs(),
+ 1e-9,
+ false,
+ false);
dealii::SLEPcWrappers::SolverKrylovSchur eigensolver(solver_control,
mpi_communicator);
};
template <int dim>
- Postprocessor<dim>::Postprocessor(const EnrichmentFunction<dim> &enrichment) :
- DataPostprocessorScalar<dim>("total_solution",
- update_values | update_q_points),
- enrichment(enrichment)
+ Postprocessor<dim>::Postprocessor(const EnrichmentFunction<dim> &enrichment)
+ : DataPostprocessorScalar<dim>("total_solution",
+ update_values | update_q_points)
+ , enrichment(enrichment)
{}
template <int dim>
{
try
{
- dealii::Utilities::MPI::MPI_InitFinalize mpi_initialization(
- argc, argv, 1);
+ dealii::Utilities::MPI::MPI_InitFinalize mpi_initialization(argc,
+ argv,
+ 1);
{
Step36::EigenvalueProblem<dim> step36;
dealii::PETScWrappers::set_option_value("-eps_target", "-1.0");
std::vector<unsigned int> repetitions(3, 1);
repetitions[0] = 2;
- GridGenerator::subdivided_hyper_rectangle(
- tria, repetitions, Point<3>(-1.0, 0.0, 0.0), Point<3>(1.0, 1.0, 1.0));
+ GridGenerator::subdivided_hyper_rectangle(tria,
+ repetitions,
+ Point<3>(-1.0, 0.0, 0.0),
+ Point<3>(1.0, 1.0, 1.0));
}
void create_triangulation(Triangulation<3> &tria,
const QGauss<3> quadrature(2);
const unsigned int n_q_points = quadrature.size();
Functions::FEFieldFunction<3> fe_field_function(dof_handler, u);
- FEValues<3> fe_values(
- fe, quadrature, update_quadrature_points | update_values);
- std::vector<Vector<double>> values(n_q_points, Vector<double>(3));
- std::vector<Tensor<1, 3>> values_ref(n_q_points);
+ FEValues<3> fe_values(fe,
+ quadrature,
+ update_quadrature_points | update_values);
+ std::vector<Vector<double>> values(n_q_points, Vector<double>(3));
+ std::vector<Tensor<1, 3>> values_ref(n_q_points);
for (DoFHandler<3>::active_cell_iterator cell =
dof_handler_ref.begin_active();
const QGauss<3> quadrature(2);
const unsigned int n_q_points = quadrature.size();
Functions::FEFieldFunction<3> fe_field_function(dof_handler, u);
- FEValues<3> fe_values(
- fe, quadrature, update_quadrature_points | update_values);
- std::vector<Vector<double>> values(n_q_points, Vector<double>(3));
- std::vector<Tensor<1, 3>> values_ref(n_q_points);
+ FEValues<3> fe_values(fe,
+ quadrature,
+ update_quadrature_points | update_values);
+ std::vector<Vector<double>> values(n_q_points, Vector<double>(3));
+ std::vector<Tensor<1, 3>> values_ref(n_q_points);
for (DoFHandler<3>::active_cell_iterator cell =
dof_handler_ref.begin_active();
QGauss<dim - 1> q(4);
Assert(q.size() == 1, ExcInternalError());
- FEFaceValues<dim> fe_values(
- mapping,
- fe,
- q,
- UpdateFlags(update_quadrature_points | update_JxW_values | update_values |
- update_gradients | update_hessians | update_normal_vectors));
+ FEFaceValues<dim> fe_values(mapping,
+ fe,
+ q,
+ UpdateFlags(update_quadrature_points |
+ update_JxW_values | update_values |
+ update_gradients | update_hessians |
+ update_normal_vectors));
for (unsigned int face_nr = 0; face_nr < GeometryInfo<dim>::faces_per_cell;
++face_nr)
{
Tensor<1, dim> gradient =
fe_face_values[single_component].gradient(i, q);
- Tensor<2, dim> gradient_normal_outer_prod = outer_product(
- gradient, fe_face_values.normal_vector(q));
+ Tensor<2, dim> gradient_normal_outer_prod =
+ outer_product(gradient,
+ fe_face_values.normal_vector(q));
boundary_integral +=
gradient_normal_outer_prod * fe_face_values.JxW(q);
}
std::vector<unsigned int> repetitions(3, 1);
repetitions[0] = 2;
- GridGenerator::subdivided_hyper_rectangle(
- tria, repetitions, Point<3>(-1.0, 0.0, 0.0), Point<3>(1.0, 1.0, 1.0));
+ GridGenerator::subdivided_hyper_rectangle(tria,
+ repetitions,
+ Point<3>(-1.0, 0.0, 0.0),
+ Point<3>(1.0, 1.0, 1.0));
}
void create_triangulation(Triangulation<3> &tria,
class SimplePolynomial : public Function<dim>
{
public:
- SimplePolynomial() : Function<dim>(2)
+ SimplePolynomial()
+ : Function<dim>(2)
{}
void
vector_value_list(const std::vector<Point<dim>> &points,
};
template <int dim>
- polytest<dim>::polytest(unsigned int degree) :
- p_order(degree),
- quad_order(2 * degree + 3),
- dof_handler(tria),
- fe(degree)
+ polytest<dim>::polytest(unsigned int degree)
+ : p_order(degree)
+ , quad_order(2 * degree + 3)
+ , dof_handler(tria)
+ , fe(degree)
{}
template <int dim>
polytest<dim>::~polytest()
dof_handler, 0, boundary_function, 0, constraints);
constraints.close();
DynamicSparsityPattern c_sparsity(dof_handler.n_dofs());
- DoFTools::make_sparsity_pattern(
- dof_handler, c_sparsity, constraints, false);
+ DoFTools::make_sparsity_pattern(dof_handler,
+ c_sparsity,
+ constraints,
+ false);
sparsity_pattern.copy_from(c_sparsity);
system_matrix.reinit(sparsity_pattern);
};
template <int dim>
- ExactSolution<dim>::ExactSolution() : Function<dim>(dim)
+ ExactSolution<dim>::ExactSolution()
+ : Function<dim>(dim)
{}
template <int dim>
void
};
template <int dim>
- MaxwellProblem<dim>::MaxwellProblem(const unsigned int order) :
- mapping(1),
- dof_handler(triangulation),
- fe(order),
- exact_solution()
+ MaxwellProblem<dim>::MaxwellProblem(const unsigned int order)
+ : mapping(1)
+ , dof_handler(triangulation)
+ , fe(order)
+ , exact_solution()
{
p_order = order;
quad_order = 2 * (p_order + 1);
constraints.close();
DynamicSparsityPattern c_sparsity(dof_handler.n_dofs());
- DoFTools::make_sparsity_pattern(
- dof_handler, c_sparsity, constraints, false);
+ DoFTools::make_sparsity_pattern(dof_handler,
+ c_sparsity,
+ constraints,
+ false);
sparsity_pattern.copy_from(c_sparsity);
system_matrix.reinit(sparsity_pattern);
{
Triangulation<dim> triangulationL;
Triangulation<dim> triangulationR;
- GridGenerator::hyper_cube(
- triangulationL, -1, 0); // create a square [-1,0]^d domain
- GridGenerator::hyper_cube(
- triangulationR, -1, 0); // create a square [-1,0]^d domain
+ GridGenerator::hyper_cube(triangulationL,
+ -1,
+ 0); // create a square [-1,0]^d domain
+ GridGenerator::hyper_cube(triangulationR,
+ -1,
+ 0); // create a square [-1,0]^d domain
Point<dim> shift_vector;
shift_vector[0] = 1.0;
GridTools::shift(shift_vector, triangulationR);
- GridGenerator::merge_triangulations(
- triangulationL, triangulationR, triangulation);
+ GridGenerator::merge_triangulations(triangulationL,
+ triangulationR,
+ triangulation);
}
hp::DoFHandler<dim> dof_handler(triangulation);
class VectorFunction : public Function<dim>
{
public:
- VectorFunction() : Function<dim>(dim)
+ VectorFunction()
+ : Function<dim>(dim)
{}
virtual double
value(const Point<dim> &p, const unsigned int component) const;
triangulation.refine_global();
else
{
- GridRefinement::refine_and_coarsen_fixed_number(
- triangulation, diff, 0.3, 0.0);
+ GridRefinement::refine_and_coarsen_fixed_number(triangulation,
+ diff,
+ 0.3,
+ 0.0);
triangulation.prepare_coarsening_and_refinement();
triangulation.execute_coarsening_and_refinement();
}
class VectorFunction : public Function<dim>
{
public:
- VectorFunction() : Function<dim>(dim)
+ VectorFunction()
+ : Function<dim>(dim)
{}
virtual double
value(const Point<dim> &p, const unsigned int component) const;
update_JxW_values | update_quadrature_points |
update_values | update_gradients |
update_hessians);
- FEFaceValues<dim> fe_face_values(
- mapping,
- fe,
- face_quadrature,
- update_JxW_values | update_quadrature_points | update_values |
- update_gradients | update_normal_vectors);
- unsigned int cell_index = 0;
+ FEFaceValues<dim> fe_face_values(mapping,
+ fe,
+ face_quadrature,
+ update_JxW_values |
+ update_quadrature_points |
+ update_values | update_gradients |
+ update_normal_vectors);
+ unsigned int cell_index = 0;
for (typename DoFHandler<dim>::active_cell_iterator cell =
dof_handler.begin_active();
triangulation.refine_global();
else
{
- GridRefinement::refine_and_coarsen_fixed_number(
- triangulation, diff, 0.3, 0.0);
+ GridRefinement::refine_and_coarsen_fixed_number(triangulation,
+ diff,
+ 0.3,
+ 0.0);
triangulation.prepare_coarsening_and_refinement();
triangulation.execute_coarsening_and_refinement();
}
{
initlog();
- CHECK_SYS3(
- FE_DGQArbitraryNodes<2>(QIterated<1>(QTrapez<1>(), 3)),
- 1,
- FESystem<2>(FE_DGQArbitraryNodes<2>(QIterated<1>(QTrapez<1>(), 3)), 3),
- 1,
- FESystem<2>(FE_Q<2>(2), 3, FE_DGQ<2>(0), 1),
- 2,
- 2);
+ CHECK_SYS3(FE_DGQArbitraryNodes<2>(QIterated<1>(QTrapez<1>(), 3)),
+ 1,
+ FESystem<2>(FE_DGQArbitraryNodes<2>(QIterated<1>(QTrapez<1>(), 3)),
+ 3),
+ 1,
+ FESystem<2>(FE_Q<2>(2), 3, FE_DGQ<2>(0), 1),
+ 2,
+ 2);
}
{
initlog();
- CHECK_SYS3(
- FE_Nedelec<2>(0),
- 1,
- FESystem<2>(FE_DGQArbitraryNodes<2>(QIterated<1>(QTrapez<1>(), 3)), 3),
- 1,
- FESystem<2>(FE_Q<2>(2), 3, FE_Nedelec<2>(0), 2),
- 2,
- 2);
+ CHECK_SYS3(FE_Nedelec<2>(0),
+ 1,
+ FESystem<2>(FE_DGQArbitraryNodes<2>(QIterated<1>(QTrapez<1>(), 3)),
+ 3),
+ 1,
+ FESystem<2>(FE_Q<2>(2), 3, FE_Nedelec<2>(0), 2),
+ 2,
+ 2);
}
};
template <int dim>
-BubbleFunction<dim>::BubbleFunction(unsigned int degree,
- unsigned int direction) :
- Function<dim>(),
- m_degree(degree),
- m_direction(direction)
+BubbleFunction<dim>::BubbleFunction(unsigned int degree, unsigned int direction)
+ : Function<dim>()
+ , m_degree(degree)
+ , m_direction(direction)
{}
template <int dim>
};
template <int dim>
-Step3<dim>::Step3(FiniteElement<dim> *fe, const unsigned int degree) :
- fe(fe),
- dof_handler(triangulation),
- m_degree(degree + 1)
+Step3<dim>::Step3(FiniteElement<dim> *fe, const unsigned int degree)
+ : fe(fe)
+ , dof_handler(triangulation)
+ , m_degree(degree + 1)
{}
for (unsigned int i = 0; i < dofs_per_cell; ++i)
for (unsigned int j = 0; j < dofs_per_cell; ++j)
- system_matrix.add(
- local_dof_indices[i], local_dof_indices[j], cell_matrix(i, j));
+ system_matrix.add(local_dof_indices[i],
+ local_dof_indices[j],
+ cell_matrix(i, j));
for (unsigned int i = 0; i < dofs_per_cell; ++i)
system_rhs(local_dof_indices[i]) += cell_rhs(i);
class ExactSolution : public Function<dim>
{
public:
- ExactSolution() : Function<dim>(dim + 1)
+ ExactSolution()
+ : Function<dim>(dim + 1)
{}
/*virtual*/ double
class JumpFunction : public Function<dim>
{
public:
- JumpFunction() : Function<dim>(1)
+ JumpFunction()
+ : Function<dim>(1)
{}
double
class RightHandSide : public Function<dim>
{
public:
- RightHandSide() : Function<dim>(dim + 1)
+ RightHandSide()
+ : Function<dim>(dim + 1)
{}
/*virtual*/ double
template <class Matrix, class Preconditioner>
InverseMatrix<Matrix, Preconditioner>::InverseMatrix(
const Matrix & m,
- const Preconditioner &preconditioner) :
- matrix(&m),
- preconditioner(&preconditioner)
+ const Preconditioner &preconditioner)
+ : matrix(&m)
+ , preconditioner(&preconditioner)
{}
template <class Matrix, class Preconditioner>
template <class Preconditioner>
SchurComplement<Preconditioner>::SchurComplement(
const BlockSparseMatrix<double> & system_matrix,
- const InverseMatrix<SparseMatrix<double>, Preconditioner> &A_inverse) :
- system_matrix(&system_matrix),
- A_inverse(&A_inverse),
- tmp1(system_matrix.block(0, 0).m()),
- tmp2(system_matrix.block(0, 0).m())
+ const InverseMatrix<SparseMatrix<double>, Preconditioner> &A_inverse)
+ : system_matrix(&system_matrix)
+ , A_inverse(&A_inverse)
+ , tmp1(system_matrix.block(0, 0).m())
+ , tmp2(system_matrix.block(0, 0).m())
{}
template <int dim>
StokesProblem<dim>::StokesProblem(const unsigned int degree,
- FESystem<dim> & fe_) :
- degree(degree),
- triangulation(Triangulation<dim>::maximum_smoothing),
- fe(fe_),
- dof_handler(triangulation)
+ FESystem<dim> & fe_)
+ : degree(degree)
+ , triangulation(Triangulation<dim>::maximum_smoothing)
+ , fe(fe_)
+ , dof_handler(triangulation)
{}
template <int dim>
constraints.close();
std::vector<types::global_dof_index> dofs_per_block(2);
- DoFTools::count_dofs_per_block(
- dof_handler, dofs_per_block, block_component);
+ DoFTools::count_dofs_per_block(dof_handler,
+ dofs_per_block,
+ block_component);
const unsigned int n_u = dofs_per_block[0], n_p = dofs_per_block[1];
deallog << " Number of active cells: " << triangulation.n_active_cells()
{
Tensor<1, dim> gradient =
fe_face_values[single_component].gradient(i, q);
- Tensor<2, dim> gradient_normal_outer_prod = outer_product(
- gradient, fe_face_values.normal_vector(q));
+ Tensor<2, dim> gradient_normal_outer_prod =
+ outer_product(gradient,
+ fe_face_values.normal_vector(q));
boundary_integral +=
gradient_normal_outer_prod * fe_face_values.JxW(q);
}
dofh.initialize(tria, fe);
QGauss<2> quadrature(8);
- FEValues<2> fev(
- fe, quadrature, update_values | update_gradients | update_JxW_values);
+ FEValues<2> fev(fe,
+ quadrature,
+ update_values | update_gradients | update_JxW_values);
fev.reinit(dofh.begin_active());
for (unsigned int i = 0; i < fe.dofs_per_cell; ++i)
{
initlog();
- CHECK_SYS3(
- FE_DGQArbitraryNodes<2>(QIterated<1>(QTrapez<1>(), 3)),
- 1,
- FESystem<2>(FE_DGQArbitraryNodes<2>(QIterated<1>(QTrapez<1>(), 3)), 3),
- 1,
- FESystem<2>(FE_Q<2>(2), 3, FE_DGQ<2>(0), 1),
- 2,
- 2);
+ CHECK_SYS3(FE_DGQArbitraryNodes<2>(QIterated<1>(QTrapez<1>(), 3)),
+ 1,
+ FESystem<2>(FE_DGQArbitraryNodes<2>(QIterated<1>(QTrapez<1>(), 3)),
+ 3),
+ 1,
+ FESystem<2>(FE_Q<2>(2), 3, FE_DGQ<2>(0), 1),
+ 2,
+ 2);
}
{
initlog();
- CHECK_SYS3(
- FE_Nedelec<2>(0),
- 1,
- FESystem<2>(FE_DGQArbitraryNodes<2>(QIterated<1>(QTrapez<1>(), 3)), 3),
- 1,
- FESystem<2>(FE_Q<2>(2), 3, FE_Nedelec<2>(0), 2),
- 2,
- 2);
+ CHECK_SYS3(FE_Nedelec<2>(0),
+ 1,
+ FESystem<2>(FE_DGQArbitraryNodes<2>(QIterated<1>(QTrapez<1>(), 3)),
+ 3),
+ 1,
+ FESystem<2>(FE_Q<2>(2), 3, FE_Nedelec<2>(0), 2),
+ 2,
+ 2);
}
{
initlog();
- CHECK_SYS3(
- FE_Nedelec<2>(1),
- 1,
- FESystem<2>(FE_DGQArbitraryNodes<2>(QIterated<1>(QTrapez<1>(), 3)), 3),
- 1,
- FESystem<2>(FE_Q<2>(2), 3, FE_Nedelec<2>(1), 2),
- 2,
- 2);
+ CHECK_SYS3(FE_Nedelec<2>(1),
+ 1,
+ FESystem<2>(FE_DGQArbitraryNodes<2>(QIterated<1>(QTrapez<1>(), 3)),
+ 3),
+ 1,
+ FESystem<2>(FE_Q<2>(2), 3, FE_Nedelec<2>(1), 2),
+ 2,
+ 2);
}
{
Tensor<1, dim> gradient =
fe_face_values[single_component].gradient(i, q);
- Tensor<2, dim> gradient_normal_outer_prod = outer_product(
- gradient, fe_face_values.normal_vector(q));
+ Tensor<2, dim> gradient_normal_outer_prod =
+ outer_product(gradient,
+ fe_face_values.normal_vector(q));
boundary_integral +=
gradient_normal_outer_prod * fe_face_values.JxW(q);
}
Table<dim, std::complex<double>> fourier_coefficients;
fourier_coefficients.reinit(TableIndices<1>(N));
- fourier.calculate(
- local_dof_values, cell_active_fe_index, fourier_coefficients);
+ fourier.calculate(local_dof_values,
+ cell_active_fe_index,
+ fourier_coefficients);
deallog << "calculated:" << std::endl;
for (unsigned int i = 0; i < N; i++)
class LegendreFunction : public Function<dim>
{
public:
- LegendreFunction(const std::vector<double> coefficients) :
- dealii::Function<dim>(1),
- coefficients(coefficients)
+ LegendreFunction(const std::vector<double> coefficients)
+ : dealii::Function<dim>(1)
+ , coefficients(coefficients)
{}
virtual double
class LegendreFunction : public Function<dim>
{
public:
- LegendreFunction() : Function<dim>(1)
+ LegendreFunction()
+ : Function<dim>(1)
{}
virtual double
class LegendreFunction : public Function<dim>
{
public:
- LegendreFunction(const Table<dim, double> &coefficients) :
- dealii::Function<dim>(1),
- coefficients(coefficients)
+ LegendreFunction(const Table<dim, double> &coefficients)
+ : dealii::Function<dim>(1)
+ , coefficients(coefficients)
{}
virtual double
local_dof_values[i] = dofs[i];
const unsigned int cell_active_fe_index = 0;
- fourier.calculate(
- local_dof_values, cell_active_fe_index, fourier_coefficients);
+ fourier.calculate(local_dof_values,
+ cell_active_fe_index,
+ fourier_coefficients);
for (unsigned int i = 0; i < fourier_coefficients.size(0); i++)
for (unsigned int j = 0; j < fourier_coefficients.size(1); j++)
{
std::map<types::global_dof_index, Point<dim>> support_points;
MappingQ1<dim> mapping;
- DoFTools::map_dofs_to_support_points(
- mapping, dof_handler, support_points);
+ DoFTools::map_dofs_to_support_points(mapping,
+ dof_handler,
+ support_points);
const std::string filename = "grid" + Utilities::int_to_string(dim) +
Utilities::int_to_string(renumber) + ".gp";
template <int dim>
MySimulator<dim>::VectorElementDestroyer::VectorElementDestroyer(
- const std::vector<const FiniteElement<dim> *> &pointers) :
- data(pointers)
+ const std::vector<const FiniteElement<dim> *> &pointers)
+ : data(pointers)
{}
template <int dim>
template <int dim>
-MySimulator<dim>::MySimulator(const unsigned int polynomial_degree) :
- fe(VectorElementDestroyer(create_fe_list(polynomial_degree)).get_data(),
- create_fe_multiplicities())
+MySimulator<dim>::MySimulator(const unsigned int polynomial_degree)
+ : fe(VectorElementDestroyer(create_fe_list(polynomial_degree)).get_data(),
+ create_fe_multiplicities())
{}
for (unsigned int i = 0; i < nc; ++i)
{
deallog << fe.get_name() << " embedding " << i << std::endl;
- print_formatted(
- P[RefinementCase<dim>::isotropic_refinement - 1][i], 8, 6);
+ print_formatted(P[RefinementCase<dim>::isotropic_refinement - 1][i],
+ 8,
+ 6);
}
}
class PushForward : public Function<dim>
{
public:
- PushForward() : Function<dim>(dim)
+ PushForward()
+ : Function<dim>(dim)
{}
double
class PullBack : public Function<dim>
{
public:
- PullBack() : Function<dim>(dim)
+ PullBack()
+ : Function<dim>(dim)
{}
double
public FunctionManifold<dim>
{
public:
- CubicRoofManifold() : FunctionManifold<dim>(this->forward, this->backward)
+ CubicRoofManifold()
+ : FunctionManifold<dim>(this->forward, this->backward)
{}
};
template <int dim>
-JxWError<dim>::JxWError(const unsigned int n_global_refines) :
- manufactured_solution(new HardManufacturedSolution<dim>()),
- manufactured_forcing(new HardManufacturedForcing<dim>()),
- finite_element(fe_order),
- dof_handler(triangulation),
- cell_quadrature(fe_order + 1),
- cell_mapping(fe_order)
+JxWError<dim>::JxWError(const unsigned int n_global_refines)
+ : manufactured_solution(new HardManufacturedSolution<dim>())
+ , manufactured_forcing(new HardManufacturedForcing<dim>())
+ , finite_element(fe_order)
+ , dof_handler(triangulation)
+ , cell_quadrature(fe_order + 1)
+ , cell_mapping(fe_order)
{
boundary_manifold = cubic_roof(triangulation);
JxWError<dim>::solve()
{
{
- SolverControl solver_control(
- std::max(types::global_dof_index(100),
- static_cast<types::global_dof_index>(system_rhs.size())),
- 1e-14 * system_rhs.l2_norm(),
- false,
- false);
+ SolverControl solver_control(std::max(types::global_dof_index(100),
+ static_cast<types::global_dof_index>(
+ system_rhs.size())),
+ 1e-14 * system_rhs.l2_norm(),
+ false,
+ false);
SolverCG<> solver(solver_control);
PreconditionSSOR<> preconditioner;
preconditioner.initialize(system_matrix, 1.2);
QIterated<dim>(QGauss<1>(finite_element.degree), 2),
VectorTools::L2_norm);
- const double l2_error = VectorTools::compute_global_error(
- triangulation, cell_l2_error, VectorTools::L2_norm);
+ const double l2_error =
+ VectorTools::compute_global_error(triangulation,
+ cell_l2_error,
+ VectorTools::L2_norm);
return l2_error;
}
class F : public Function<dim>
{
public:
- F(const unsigned int q) : q(q)
+ F(const unsigned int q)
+ : q(q)
{}
virtual double
deallog << "FE=" << fe.get_name() << std::endl;
const QGauss<dim> quadrature(2);
- FEValues<dim> fe_values(
- fe, quadrature, update_values | update_gradients | update_hessians);
+ FEValues<dim> fe_values(fe,
+ quadrature,
+ update_values | update_gradients | update_hessians);
fe_values.reinit(dof.begin_active());
for (unsigned int c = 0; c < fe.n_components(); ++c)
deallog << "FE=" << fe.get_name() << std::endl;
const QGauss<dim> quadrature(2);
- FEValues<dim> fe_values(
- fe, quadrature, update_values | update_gradients | update_hessians);
+ FEValues<dim> fe_values(fe,
+ quadrature,
+ update_values | update_gradients | update_hessians);
fe_values.reinit(dof.begin_active());
for (unsigned int c = 0; c < fe.n_components(); ++c)
deallog << fe_values[vec_components].divergence(i, q) << ' ';
for (unsigned int k = 0; k < dim; ++k)
for (unsigned int l = 0; l < dim; ++l)
- deallog << fe_values[vec_components].symmetric_gradient(
- i, q)[k][l]
- << ' ';
+ deallog
+ << fe_values[vec_components].symmetric_gradient(i, q)[k][l]
+ << ' ';
deallog << std::endl;
for (unsigned int k = 0; k < dim; ++k)
for (unsigned int l = 0; l < dim; ++l)
deallog << "FE=" << fe.get_name() << std::endl;
const QGauss<dim> quadrature(2);
- FEValues<dim> fe_values(
- fe, quadrature, update_values | update_gradients | update_hessians);
+ FEValues<dim> fe_values(fe,
+ quadrature,
+ update_values | update_gradients | update_hessians);
for (typename DoFHandler<dim>::active_cell_iterator cell = dof.begin_active();
cell != dof.end();
++cell)
deallog << "FE=" << fe.get_name() << std::endl;
const QGauss<dim> quadrature(2);
- FEValues<dim> fe_values(
- fe, quadrature, update_values | update_gradients | update_hessians);
+ FEValues<dim> fe_values(fe,
+ quadrature,
+ update_values | update_gradients | update_hessians);
for (typename DoFHandler<dim>::active_cell_iterator cell = dof.begin_active();
cell != dof.end();
++cell)
for (unsigned int d = 0; d < dim; ++d)
{
- AssertThrow(
- fe_values[vec_components].value(i, q)[d] ==
- fe_values.shape_value_component(i, q, c + d),
- ExcInternalError());
+ AssertThrow(fe_values[vec_components].value(i, q)[d] ==
+ fe_values.shape_value_component(i,
+ q,
+ c + d),
+ ExcInternalError());
AssertThrow(fe_values[vec_components].gradient(i, q)[d] ==
fe_values.shape_grad_component(i, q, c + d),
2),
ExcInternalError());
- AssertThrow(
- fe_values[vec_components].hessian(i, q)[d] ==
- fe_values.shape_hessian_component(i, q, c + d),
- ExcInternalError());
+ AssertThrow(fe_values[vec_components].hessian(i, q)[d] ==
+ fe_values.shape_hessian_component(i,
+ q,
+ c + d),
+ ExcInternalError());
}
}
}
fe_function(i) = i + 1;
const QGauss<dim> quadrature(2);
- FEValues<dim> fe_values(
- fe, quadrature, update_values | update_gradients | update_hessians);
+ FEValues<dim> fe_values(fe,
+ quadrature,
+ update_values | update_gradients | update_hessians);
fe_values.reinit(dof.begin_active());
std::vector<double> scalar_values(quadrature.size());
fe_function(i) = i + 1;
const QGauss<dim> quadrature(2);
- FEValues<dim> fe_values(
- fe, quadrature, update_values | update_gradients | update_hessians);
+ FEValues<dim> fe_values(fe,
+ quadrature,
+ update_values | update_gradients | update_hessians);
fe_values.reinit(dof.begin_active());
std::vector<Tensor<1, dim>> scalar_values(quadrature.size());
fe_function(i) = i + 1;
const QGauss<dim> quadrature(2);
- FEValues<dim> fe_values(
- fe, quadrature, update_values | update_gradients | update_hessians);
+ FEValues<dim> fe_values(fe,
+ quadrature,
+ update_values | update_gradients | update_hessians);
fe_values.reinit(dof.begin_active());
std::vector<Tensor<2, dim>> scalar_values(quadrature.size());
fe_function(i) = i + 1;
const QGauss<dim> quadrature(2);
- FEValues<dim> fe_values(
- fe, quadrature, update_values | update_gradients | update_hessians);
+ FEValues<dim> fe_values(fe,
+ quadrature,
+ update_values | update_gradients | update_hessians);
fe_values.reinit(dof.begin_active());
std::vector<double> scalar_values(quadrature.size());
fe_function(i) = i + 1;
const QGauss<dim> quadrature(2);
- FEValues<dim> fe_values(
- fe, quadrature, update_values | update_gradients | update_hessians);
+ FEValues<dim> fe_values(fe,
+ quadrature,
+ update_values | update_gradients | update_hessians);
fe_values.reinit(dof.begin_active());
std::vector<Tensor<1, dim>> scalar_values(quadrature.size());
fe_function(i) = i + 1;
const QGauss<dim> quadrature(2);
- FEValues<dim> fe_values(
- fe, quadrature, update_values | update_gradients | update_hessians);
+ FEValues<dim> fe_values(fe,
+ quadrature,
+ update_values | update_gradients | update_hessians);
fe_values.reinit(dof.begin_active());
std::vector<Tensor<2, dim>> scalar_values(quadrature.size());
fe_function(i) = i + 1;
const QGauss<dim> quadrature(2);
- FEValues<dim> fe_values(
- fe, quadrature, update_values | update_gradients | update_hessians);
+ FEValues<dim> fe_values(fe,
+ quadrature,
+ update_values | update_gradients | update_hessians);
fe_values.reinit(dof.begin_active());
std::vector<Tensor<2, dim>> scalar_values(quadrature.size());
fe_function(i) = i + 1;
const QGauss<dim> quadrature(2);
- FEValues<dim> fe_values(
- fe, quadrature, update_values | update_gradients | update_hessians);
+ FEValues<dim> fe_values(fe,
+ quadrature,
+ update_values | update_gradients | update_hessians);
fe_values.reinit(dof.begin_active());
std::vector<Tensor<2, dim>> scalar_values(quadrature.size());
fe_function(i) = i + 1;
const QGauss<dim> quadrature(2);
- FEValues<dim> fe_values(
- fe, quadrature, update_values | update_gradients | update_hessians);
+ FEValues<dim> fe_values(fe,
+ quadrature,
+ update_values | update_gradients | update_hessians);
fe_values.reinit(dof.begin_active());
std::vector<Tensor<2, dim>> scalar_values(quadrature.size());
fe_function(i) = i + 1;
const QGauss<dim> quadrature(2);
- FEValues<dim> fe_values(
- fe, quadrature, update_values | update_gradients | update_hessians);
+ FEValues<dim> fe_values(fe,
+ quadrature,
+ update_values | update_gradients | update_hessians);
fe_values.reinit(dof.begin_active());
std::vector<Tensor<1, dim>> selected_vector_values(quadrature.size());
fe_function(i) = i + 1;
const QGauss<dim> quadrature(2);
- FEValues<dim> fe_values(
- fe, quadrature, update_values | update_gradients | update_hessians);
+ FEValues<dim> fe_values(fe,
+ quadrature,
+ update_values | update_gradients | update_hessians);
fe_values.reinit(dof.begin_active());
std::vector<Tensor<2, dim>> selected_vector_values(quadrature.size());
fe_function(i) = i + 1;
const QGauss<dim> quadrature(2);
- FEValues<dim> fe_values(
- fe, quadrature, update_values | update_gradients | update_hessians);
+ FEValues<dim> fe_values(fe,
+ quadrature,
+ update_values | update_gradients | update_hessians);
fe_values.reinit(dof.begin_active());
std::vector<Tensor<3, dim>> selected_vector_values(quadrature.size());
fe_function(i) = i + 1;
const QGauss<dim> quadrature(2);
- FEValues<dim> fe_values(
- fe, quadrature, update_values | update_gradients | update_hessians);
+ FEValues<dim> fe_values(fe,
+ quadrature,
+ update_values | update_gradients | update_hessians);
fe_values.reinit(dof.begin_active());
std::vector<Tensor<1, dim>> selected_vector_values(quadrature.size());
fe_function(i) = i + 1;
const QGauss<dim> quadrature(2);
- FEValues<dim> fe_values(
- fe, quadrature, update_values | update_gradients | update_hessians);
+ FEValues<dim> fe_values(fe,
+ quadrature,
+ update_values | update_gradients | update_hessians);
fe_values.reinit(dof.begin_active());
std::vector<Tensor<2, dim>> selected_vector_values(quadrature.size());
fe_function(i) = i + 1;
const QGauss<dim> quadrature(2);
- FEValues<dim> fe_values(
- fe, quadrature, update_values | update_gradients | update_hessians);
+ FEValues<dim> fe_values(fe,
+ quadrature,
+ update_values | update_gradients | update_hessians);
fe_values.reinit(dof.begin_active());
std::vector<Tensor<3, dim>> selected_vector_values(quadrature.size());
fe_function(i) = i + 1;
const QGauss<dim> quadrature(2);
- FEValues<dim> fe_values(
- fe, quadrature, update_values | update_gradients | update_hessians);
+ FEValues<dim> fe_values(fe,
+ quadrature,
+ update_values | update_gradients | update_hessians);
fe_values.reinit(dof.begin_active());
std::vector<SymmetricTensor<2, dim>> selected_vector_values(
fe_function(i) = i + 1;
const QGauss<dim> quadrature(2);
- FEValues<dim> fe_values(
- fe, quadrature, update_values | update_gradients | update_hessians);
+ FEValues<dim> fe_values(fe,
+ quadrature,
+ update_values | update_gradients | update_hessians);
fe_values.reinit(dof.begin_active());
std::vector<SymmetricTensor<2, dim>> selected_vector_values(
fe_function(i) = i + 1;
const QGauss<dim> quadrature(2);
- FEValues<dim> fe_values(
- fe, quadrature, update_values | update_gradients | update_hessians);
+ FEValues<dim> fe_values(fe,
+ quadrature,
+ update_values | update_gradients | update_hessians);
fe_values.reinit(dof.begin_active());
std::vector<double> selected_vector_values(quadrature.size());
fe_function(i) = i + 1;
const QGauss<dim> quadrature(2);
- FEValues<dim> fe_values(
- fe, quadrature, update_values | update_gradients | update_hessians);
+ FEValues<dim> fe_values(fe,
+ quadrature,
+ update_values | update_gradients | update_hessians);
fe_values.reinit(dof.begin_active());
std::vector<double> selected_vector_values(quadrature.size());
};
template <int dim>
-MixedElastoPlasticity<dim>::MixedElastoPlasticity(const unsigned int degree) :
- degree(degree),
- n_stress_components((dim * (dim + 1)) / 2),
- n_gamma_components(1),
- fe(FE_Q<dim>(degree),
- n_stress_components,
- FE_Q<dim>(degree),
- n_gamma_components),
- dof_handler(triangulation)
+MixedElastoPlasticity<dim>::MixedElastoPlasticity(const unsigned int degree)
+ : degree(degree)
+ , n_stress_components((dim * (dim + 1)) / 2)
+ , n_gamma_components(1)
+ , fe(FE_Q<dim>(degree),
+ n_stress_components,
+ FE_Q<dim>(degree),
+ n_gamma_components)
+ , dof_handler(triangulation)
{}
template <int dim>
<< std::endl;
// stress -> 0 gamma -> 1
- std::vector<unsigned int> block_component(
- n_stress_components + n_gamma_components, 1);
+ std::vector<unsigned int> block_component(n_stress_components +
+ n_gamma_components,
+ 1);
for (unsigned int ii = 0; ii < n_stress_components; ii++)
block_component[ii] = 0;
};
template <int dim>
-MixedElastoPlasticity<dim>::MixedElastoPlasticity(const unsigned int degree) :
- degree(degree),
- n_stress_components(dim * dim),
- n_gamma_components(1),
- fe(FE_Q<dim>(degree),
- n_stress_components,
- FE_Q<dim>(degree),
- n_gamma_components),
- dof_handler(triangulation)
+MixedElastoPlasticity<dim>::MixedElastoPlasticity(const unsigned int degree)
+ : degree(degree)
+ , n_stress_components(dim * dim)
+ , n_gamma_components(1)
+ , fe(FE_Q<dim>(degree),
+ n_stress_components,
+ FE_Q<dim>(degree),
+ n_gamma_components)
+ , dof_handler(triangulation)
{}
template <int dim>
<< std::endl;
// stress -> 0 gamma -> 1
- std::vector<unsigned int> block_component(
- n_stress_components + n_gamma_components, 1);
+ std::vector<unsigned int> block_component(n_stress_components +
+ n_gamma_components,
+ 1);
for (unsigned int ii = 0; ii < n_stress_components; ii++)
block_component[ii] = 0;
template <int dim>
-MixedElastoPlasticity<dim>::MixedElastoPlasticity(const unsigned int degree) :
- degree(degree),
- n_stress_components((dim * (dim + 1)) / 2),
- n_gamma_components(1),
- fe(FE_Q<dim>(degree),
- n_stress_components,
- FE_Q<dim>(degree),
- n_gamma_components),
- dof_handler(triangulation)
+MixedElastoPlasticity<dim>::MixedElastoPlasticity(const unsigned int degree)
+ : degree(degree)
+ , n_stress_components((dim * (dim + 1)) / 2)
+ , n_gamma_components(1)
+ , fe(FE_Q<dim>(degree),
+ n_stress_components,
+ FE_Q<dim>(degree),
+ n_gamma_components)
+ , dof_handler(triangulation)
{}
<< std::endl;
// stress -> 0 gamma -> 1
- std::vector<unsigned int> block_component(
- n_stress_components + n_gamma_components, 1);
+ std::vector<unsigned int> block_component(n_stress_components +
+ n_gamma_components,
+ 1);
for (unsigned int ii = 0; ii < n_stress_components; ii++)
block_component[ii] = 0;
{
DoFHandler<dim> dof_scalar(tr);
dof_scalar.distribute_dofs(fe_scalar);
- FEValues<dim> fe_values_scalar(
- fe_scalar, quadrature, update_values | update_gradients);
+ FEValues<dim> fe_values_scalar(fe_scalar,
+ quadrature,
+ update_values | update_gradients);
fe_values_scalar.reinit(dof_scalar.begin_active());
for (unsigned int i = 0; i < fe_scalar.dofs_per_cell; ++i)
{
AssertThrow(val_q[ind_k] == scalar_values[i_node][q],
ExcInternalError());
- AssertThrow(
- (grad_q[ind_k[0]][ind_k[1]] == scalar_gradients[i_node][q]),
- ExcInternalError());
+ AssertThrow((grad_q[ind_k[0]][ind_k[1]] ==
+ scalar_gradients[i_node][q]),
+ ExcInternalError());
}
else
{
class F : public Function<2>
{
public:
- F() : Function<2>(2)
+ F()
+ : Function<2>(2)
{}
virtual void
// curl of this function should be
// curl F = d_x F_y - d_y F_x = 2x
// verify that this is true
- AssertThrow(
- std::fabs(curls[q][0] - 2 * fe_values.quadrature_point(q)[0]) <= 1e-10,
- ExcInternalError());
+ AssertThrow(std::fabs(curls[q][0] -
+ 2 * fe_values.quadrature_point(q)[0]) <= 1e-10,
+ ExcInternalError());
}
}
class F : public Function<2>
{
public:
- F() : Function<2>(2)
+ F()
+ : Function<2>(2)
{}
virtual void
// curl of this function should be
// curl F = d_x F_y - d_y F_x = 2x
// verify that this is true
- AssertThrow(
- std::fabs(curls[q][0] - 2 * fe_values.quadrature_point(q)[0]) <= 1e-10,
- ExcInternalError());
+ AssertThrow(std::fabs(curls[q][0] -
+ 2 * fe_values.quadrature_point(q)[0]) <= 1e-10,
+ ExcInternalError());
}
}
class VectorFunction : public Function<dim>
{
public:
- VectorFunction() : Function<dim>(dim)
+ VectorFunction()
+ : Function<dim>(dim)
{}
virtual double
value(const Point<dim> &p, const unsigned int component) const;
cell->get_dof_indices(local_dof_indices);
std::vector<double> local_dof_values(fe.dofs_per_cell);
- cell->get_dof_values(
- solution, local_dof_values.begin(), local_dof_values.end());
+ cell->get_dof_values(solution,
+ local_dof_values.begin(),
+ local_dof_values.end());
// Convert the DoF values so that they are potentially of
// a different number type
cell->get_dof_indices(local_dof_indices);
std::vector<double> local_dof_values(fe.dofs_per_cell);
- cell->get_dof_values(
- solution, local_dof_values.begin(), local_dof_values.end());
+ cell->get_dof_values(solution,
+ local_dof_values.begin(),
+ local_dof_values.end());
// Convert the DoF values so that they are potentially of
// a different number type
};
template <int dim>
-MixedElastoPlasticity<dim>::MixedElastoPlasticity(const unsigned int degree) :
- degree(degree),
- n_stress_components(dim * dim),
- n_gamma_components(1),
- fe(FE_Q<dim>(degree),
- n_stress_components,
- FE_Q<dim>(degree),
- n_gamma_components),
- dof_handler(triangulation)
+MixedElastoPlasticity<dim>::MixedElastoPlasticity(const unsigned int degree)
+ : degree(degree)
+ , n_stress_components(dim * dim)
+ , n_gamma_components(1)
+ , fe(FE_Q<dim>(degree),
+ n_stress_components,
+ FE_Q<dim>(degree),
+ n_gamma_components)
+ , dof_handler(triangulation)
{}
template <int dim>
<< std::endl;
// stress -> 0 gamma -> 1
- std::vector<unsigned int> block_component(
- n_stress_components + n_gamma_components, 1);
+ std::vector<unsigned int> block_component(n_stress_components +
+ n_gamma_components,
+ 1);
for (unsigned int ii = 0; ii < n_stress_components; ii++)
block_component[ii] = 0;
for (unsigned int i = 1; i < 4; ++i)
for (unsigned int j = i; j < 4; ++j)
- do_check(
- FESystem<dim>(
- FE_Q<dim>(QIterated<1>(QTrapez<1>(), i)), 1, FE_DGQ<dim>(i - 1), 1),
- FESystem<dim>(
- FE_Q<dim>(QIterated<1>(QTrapez<1>(), j)), 1, FE_DGQ<dim>(j - 1), 1));
+ do_check(FESystem<dim>(FE_Q<dim>(QIterated<1>(QTrapez<1>(), i)),
+ 1,
+ FE_DGQ<dim>(i - 1),
+ 1),
+ FESystem<dim>(FE_Q<dim>(QIterated<1>(QTrapez<1>(), j)),
+ 1,
+ FE_DGQ<dim>(j - 1),
+ 1));
}
class Q1WedgeFunction : public Function<dim>
{
public:
- Q1WedgeFunction() : Function<dim>(COMP)
+ Q1WedgeFunction()
+ : Function<dim>(COMP)
{}
double
class F : public Function<dim>
{
public:
- F(const unsigned int q, const double adj) : Function<dim>(4), q(q), adj(adj)
+ F(const unsigned int q, const double adj)
+ : Function<dim>(4)
+ , q(q)
+ , adj(adj)
{}
virtual void
for (unsigned int q = 0; q <= p + 2; ++q)
{
// interpolate the function with mask 1
- VectorTools::interpolate(
- dof_handler, F<dim>(q, adj1), interpolant, mask1);
+ VectorTools::interpolate(dof_handler,
+ F<dim>(q, adj1),
+ interpolant,
+ mask1);
// interpolate the function with mask 2
- VectorTools::interpolate(
- dof_handler, F<dim>(q, adj2), interpolant, mask2);
+ VectorTools::interpolate(dof_handler,
+ F<dim>(q, adj2),
+ interpolant,
+ mask2);
// then compute the interpolation error for mask 1
VectorTools::integrate_difference(dof_handler,
deallog << fe.get_name() << ", Fails for including non-interpolating FE ";
try
{
- VectorTools::interpolate(
- dof_handler, F<dim>(0, 0.0), interpolant, mask_fail);
+ VectorTools::interpolate(dof_handler,
+ F<dim>(0, 0.0),
+ interpolant,
+ mask_fail);
}
catch (const ExceptionBase &e)
{
}
{
deallog << dim << "D Jacobian pushed forward gradients:" << std::endl;
- FEValues<dim> fe_val(
- mapping, dummy, quad, update_jacobian_pushed_forward_grads);
+ FEValues<dim> fe_val(mapping,
+ dummy,
+ quad,
+ update_jacobian_pushed_forward_grads);
typename Triangulation<dim>::active_cell_iterator cell =
tria.begin_active(),
endc = tria.end();
}
{
deallog << dim << "D Jacobian pushed forward hessians:" << std::endl;
- FEValues<dim> fe_val(
- mapping, dummy, quad, update_jacobian_pushed_forward_2nd_derivatives);
+ FEValues<dim> fe_val(mapping,
+ dummy,
+ quad,
+ update_jacobian_pushed_forward_2nd_derivatives);
typename Triangulation<dim>::active_cell_iterator cell =
tria.begin_active(),
endc = tria.end();
{
deallog << dim
<< "D Jacobian pushed forward hessian gradients:" << std::endl;
- FEValues<dim> fe_val(
- mapping, dummy, quad, update_jacobian_pushed_forward_3rd_derivatives);
+ FEValues<dim> fe_val(mapping,
+ dummy,
+ quad,
+ update_jacobian_pushed_forward_3rd_derivatives);
typename Triangulation<dim>::active_cell_iterator cell =
tria.begin_active(),
endc = tria.end();
{
FEFaceValues<dim> fe_val(mapping, dummy, quad, update_inverse_jacobians);
- FESubfaceValues<dim> fe_sub_val(
- mapping, dummy, quad, update_inverse_jacobians);
+ FESubfaceValues<dim> fe_sub_val(mapping,
+ dummy,
+ quad,
+ update_inverse_jacobians);
deallog << dim << "D inverse Jacobians:" << std::endl;
typename Triangulation<dim>::active_cell_iterator cell =
{
FEFaceValues<dim> fe_val(mapping, dummy, quad, update_jacobian_grads);
- FESubfaceValues<dim> fe_sub_val(
- mapping, dummy, quad, update_jacobian_grads);
+ FESubfaceValues<dim> fe_sub_val(mapping,
+ dummy,
+ quad,
+ update_jacobian_grads);
deallog << dim << "D Jacobian gradients:" << std::endl;
typename Triangulation<dim>::active_cell_iterator cell =
}
{
- FEFaceValues<dim> fe_val(
- mapping, dummy, quad, update_jacobian_pushed_forward_grads);
- FESubfaceValues<dim> fe_sub_val(
- mapping, dummy, quad, update_jacobian_pushed_forward_grads);
+ FEFaceValues<dim> fe_val(mapping,
+ dummy,
+ quad,
+ update_jacobian_pushed_forward_grads);
+ FESubfaceValues<dim> fe_sub_val(mapping,
+ dummy,
+ quad,
+ update_jacobian_pushed_forward_grads);
deallog << dim << "D Jacobian pushed forward gradients:" << std::endl;
typename Triangulation<dim>::active_cell_iterator cell =
}
{
- FEFaceValues<dim> fe_val(
- mapping, dummy, quad, update_jacobian_2nd_derivatives);
- FESubfaceValues<dim> fe_sub_val(
- mapping, dummy, quad, update_jacobian_2nd_derivatives);
+ FEFaceValues<dim> fe_val(mapping,
+ dummy,
+ quad,
+ update_jacobian_2nd_derivatives);
+ FESubfaceValues<dim> fe_sub_val(mapping,
+ dummy,
+ quad,
+ update_jacobian_2nd_derivatives);
deallog << dim << "D Jacobian hessians:" << std::endl;
typename Triangulation<dim>::active_cell_iterator cell =
}
{
- FEFaceValues<dim> fe_val(
- mapping, dummy, quad, update_jacobian_pushed_forward_2nd_derivatives);
+ FEFaceValues<dim> fe_val(mapping,
+ dummy,
+ quad,
+ update_jacobian_pushed_forward_2nd_derivatives);
FESubfaceValues<dim> fe_sub_val(
mapping, dummy, quad, update_jacobian_pushed_forward_2nd_derivatives);
}
{
- FEFaceValues<dim> fe_val(
- mapping, dummy, quad, update_jacobian_3rd_derivatives);
- FESubfaceValues<dim> fe_sub_val(
- mapping, dummy, quad, update_jacobian_3rd_derivatives);
+ FEFaceValues<dim> fe_val(mapping,
+ dummy,
+ quad,
+ update_jacobian_3rd_derivatives);
+ FESubfaceValues<dim> fe_sub_val(mapping,
+ dummy,
+ quad,
+ update_jacobian_3rd_derivatives);
deallog << dim << "D Jacobian hessian gradients:" << std::endl;
typename Triangulation<dim>::active_cell_iterator cell =
}
{
- FEFaceValues<dim> fe_val(
- mapping, dummy, quad, update_jacobian_pushed_forward_3rd_derivatives);
+ FEFaceValues<dim> fe_val(mapping,
+ dummy,
+ quad,
+ update_jacobian_pushed_forward_3rd_derivatives);
FESubfaceValues<dim> fe_sub_val(
mapping, dummy, quad, update_jacobian_pushed_forward_3rd_derivatives);
{
FEFaceValues<dim> fe_val(mapping, dummy, quad, update_inverse_jacobians);
- FESubfaceValues<dim> fe_sub_val(
- mapping, dummy, quad, update_inverse_jacobians);
+ FESubfaceValues<dim> fe_sub_val(mapping,
+ dummy,
+ quad,
+ update_inverse_jacobians);
deallog << dim << "D inverse Jacobians:" << std::endl;
typename Triangulation<dim>::active_cell_iterator cell =
{
FEFaceValues<dim> fe_val(mapping, dummy, quad, update_jacobian_grads);
- FESubfaceValues<dim> fe_sub_val(
- mapping, dummy, quad, update_jacobian_grads);
+ FESubfaceValues<dim> fe_sub_val(mapping,
+ dummy,
+ quad,
+ update_jacobian_grads);
deallog << dim << "D Jacobian gradients:" << std::endl;
typename Triangulation<dim>::active_cell_iterator cell =
}
{
- FEFaceValues<dim> fe_val(
- mapping, dummy, quad, update_jacobian_pushed_forward_grads);
- FESubfaceValues<dim> fe_sub_val(
- mapping, dummy, quad, update_jacobian_pushed_forward_grads);
+ FEFaceValues<dim> fe_val(mapping,
+ dummy,
+ quad,
+ update_jacobian_pushed_forward_grads);
+ FESubfaceValues<dim> fe_sub_val(mapping,
+ dummy,
+ quad,
+ update_jacobian_pushed_forward_grads);
deallog << dim << "D Jacobian pushed forward gradients:" << std::endl;
typename Triangulation<dim>::active_cell_iterator cell =
}
{
- FEFaceValues<dim> fe_val(
- mapping, dummy, quad, update_jacobian_2nd_derivatives);
- FESubfaceValues<dim> fe_sub_val(
- mapping, dummy, quad, update_jacobian_2nd_derivatives);
+ FEFaceValues<dim> fe_val(mapping,
+ dummy,
+ quad,
+ update_jacobian_2nd_derivatives);
+ FESubfaceValues<dim> fe_sub_val(mapping,
+ dummy,
+ quad,
+ update_jacobian_2nd_derivatives);
deallog << dim << "D Jacobian hessians:" << std::endl;
typename Triangulation<dim>::active_cell_iterator cell =
}
{
- FEFaceValues<dim> fe_val(
- mapping, dummy, quad, update_jacobian_pushed_forward_2nd_derivatives);
+ FEFaceValues<dim> fe_val(mapping,
+ dummy,
+ quad,
+ update_jacobian_pushed_forward_2nd_derivatives);
FESubfaceValues<dim> fe_sub_val(
mapping, dummy, quad, update_jacobian_pushed_forward_2nd_derivatives);
}
{
- FEFaceValues<dim> fe_val(
- mapping, dummy, quad, update_jacobian_3rd_derivatives);
- FESubfaceValues<dim> fe_sub_val(
- mapping, dummy, quad, update_jacobian_3rd_derivatives);
+ FEFaceValues<dim> fe_val(mapping,
+ dummy,
+ quad,
+ update_jacobian_3rd_derivatives);
+ FESubfaceValues<dim> fe_sub_val(mapping,
+ dummy,
+ quad,
+ update_jacobian_3rd_derivatives);
deallog << dim << "D Jacobian hessian gradients:" << std::endl;
typename Triangulation<dim>::active_cell_iterator cell =
}
{
- FEFaceValues<dim> fe_val(
- mapping, dummy, quad, update_jacobian_pushed_forward_3rd_derivatives);
+ FEFaceValues<dim> fe_val(mapping,
+ dummy,
+ quad,
+ update_jacobian_pushed_forward_3rd_derivatives);
FESubfaceValues<dim> fe_sub_val(
mapping, dummy, quad, update_jacobian_pushed_forward_3rd_derivatives);
{
FEFaceValues<dim> fe_val(mapping, dummy, quad, update_inverse_jacobians);
- FESubfaceValues<dim> fe_sub_val(
- mapping, dummy, quad, update_inverse_jacobians);
+ FESubfaceValues<dim> fe_sub_val(mapping,
+ dummy,
+ quad,
+ update_inverse_jacobians);
deallog << dim << "D inverse Jacobians:" << std::endl;
typename Triangulation<dim>::active_cell_iterator cell =
{
FEFaceValues<dim> fe_val(mapping, dummy, quad, update_jacobian_grads);
- FESubfaceValues<dim> fe_sub_val(
- mapping, dummy, quad, update_jacobian_grads);
+ FESubfaceValues<dim> fe_sub_val(mapping,
+ dummy,
+ quad,
+ update_jacobian_grads);
deallog << dim << "D Jacobian gradients:" << std::endl;
typename Triangulation<dim>::active_cell_iterator cell =
}
{
- FEFaceValues<dim> fe_val(
- mapping, dummy, quad, update_jacobian_pushed_forward_grads);
- FESubfaceValues<dim> fe_sub_val(
- mapping, dummy, quad, update_jacobian_pushed_forward_grads);
+ FEFaceValues<dim> fe_val(mapping,
+ dummy,
+ quad,
+ update_jacobian_pushed_forward_grads);
+ FESubfaceValues<dim> fe_sub_val(mapping,
+ dummy,
+ quad,
+ update_jacobian_pushed_forward_grads);
deallog << dim << "D Jacobian pushed forward gradients:" << std::endl;
typename Triangulation<dim>::active_cell_iterator cell =
}
{
- FEFaceValues<dim> fe_val(
- mapping, dummy, quad, update_jacobian_2nd_derivatives);
- FESubfaceValues<dim> fe_sub_val(
- mapping, dummy, quad, update_jacobian_2nd_derivatives);
+ FEFaceValues<dim> fe_val(mapping,
+ dummy,
+ quad,
+ update_jacobian_2nd_derivatives);
+ FESubfaceValues<dim> fe_sub_val(mapping,
+ dummy,
+ quad,
+ update_jacobian_2nd_derivatives);
deallog << dim << "D Jacobian hessians:" << std::endl;
typename Triangulation<dim>::active_cell_iterator cell =
}
{
- FEFaceValues<dim> fe_val(
- mapping, dummy, quad, update_jacobian_pushed_forward_2nd_derivatives);
+ FEFaceValues<dim> fe_val(mapping,
+ dummy,
+ quad,
+ update_jacobian_pushed_forward_2nd_derivatives);
FESubfaceValues<dim> fe_sub_val(
mapping, dummy, quad, update_jacobian_pushed_forward_2nd_derivatives);
}
{
- FEFaceValues<dim> fe_val(
- mapping, dummy, quad, update_jacobian_3rd_derivatives);
- FESubfaceValues<dim> fe_sub_val(
- mapping, dummy, quad, update_jacobian_3rd_derivatives);
+ FEFaceValues<dim> fe_val(mapping,
+ dummy,
+ quad,
+ update_jacobian_3rd_derivatives);
+ FESubfaceValues<dim> fe_sub_val(mapping,
+ dummy,
+ quad,
+ update_jacobian_3rd_derivatives);
deallog << dim << "D Jacobian hessian gradients:" << std::endl;
typename Triangulation<dim>::active_cell_iterator cell =
}
{
- FEFaceValues<dim> fe_val(
- mapping, dummy, quad, update_jacobian_pushed_forward_3rd_derivatives);
+ FEFaceValues<dim> fe_val(mapping,
+ dummy,
+ quad,
+ update_jacobian_pushed_forward_3rd_derivatives);
FESubfaceValues<dim> fe_sub_val(
mapping, dummy, quad, update_jacobian_pushed_forward_3rd_derivatives);
std::pair<unsigned int, unsigned int> neighbor_face =
c->neighbor_of_coarser_neighbor(face);
- fesubface.reinit(
- c->neighbor(face), neighbor_face.first, neighbor_face.second);
+ fesubface.reinit(c->neighbor(face),
+ neighbor_face.first,
+ neighbor_face.second);
fesubface.get_function_values(values, shape_values2);
for (unsigned int k = 0; k < feface.n_quadrature_points; ++k)
{
deallog << feface.quadrature_point(k);
- plot_diff(
- shape_values1[k], shape_values2[k], feface.normal_vector(k));
+ plot_diff(shape_values1[k],
+ shape_values2[k],
+ feface.normal_vector(k));
}
}
else
for (unsigned int k = 0; k < feface.n_quadrature_points; ++k)
{
deallog << feface.quadrature_point(k);
- plot_diff(
- shape_values1[k], shape_values2[k], feface.normal_vector(k));
+ plot_diff(shape_values1[k],
+ shape_values2[k],
+ feface.normal_vector(k));
}
}
}
QTrapez<dim> quadrature;
std::vector<Vector<double>> shape_values(quadrature.size(),
Vector<double>(dim));
- FEValues<dim> fe(
- fe_ned, quadrature, update_values | update_quadrature_points);
+ FEValues<dim> fe(fe_ned,
+ quadrature,
+ update_values | update_quadrature_points);
for (typename DoFHandler<dim>::active_cell_iterator c = dof.begin_active();
c != dof.end();
// use the old-style constraints
struct MyFE : FE_Nedelec<3>
{
- MyFE() : FE_Nedelec<3>(0){};
+ MyFE()
+ : FE_Nedelec<3>(0){};
virtual bool
hp_constraints_are_implemented() const
{
Triangulation<dim> triangulation;
std::vector<unsigned int> subdivisions(dim, 1);
subdivisions[0] = 2;
- GridGenerator::subdivided_hyper_rectangle(
- triangulation,
- subdivisions,
- Point<dim>(),
- (dim == 3 ? Point<dim>(2, 1, 1) : Point<dim>(2, 1)));
+ GridGenerator::subdivided_hyper_rectangle(triangulation,
+ subdivisions,
+ Point<dim>(),
+ (dim == 3 ? Point<dim>(2, 1, 1) :
+ Point<dim>(2, 1)));
(++triangulation.begin_active())->set_refine_flag();
triangulation.execute_coarsening_and_refinement();
Triangulation<dim> triangulation;
std::vector<unsigned int> subdivisions(dim, 1);
subdivisions[0] = 2;
- GridGenerator::subdivided_hyper_rectangle(
- triangulation,
- subdivisions,
- Point<dim>(),
- (dim == 3 ? Point<dim>(2, 1, 1) : Point<dim>(2, 1)));
+ GridGenerator::subdivided_hyper_rectangle(triangulation,
+ subdivisions,
+ Point<dim>(),
+ (dim == 3 ? Point<dim>(2, 1, 1) :
+ Point<dim>(2, 1)));
(++triangulation.begin_active())->set_refine_flag();
triangulation.execute_coarsening_and_refinement();
class SimplePolynomial : public Function<dim>
{
public:
- SimplePolynomial() : Function<dim>(2)
+ SimplePolynomial()
+ : Function<dim>(2)
{}
void
vector_value_list(const std::vector<Point<dim>> &points,
};
template <int dim>
- polytest<dim>::polytest(unsigned int degree) :
- p_order(degree),
- quad_order(2 * degree + 3),
- dof_handler(tria),
- fe(degree)
+ polytest<dim>::polytest(unsigned int degree)
+ : p_order(degree)
+ , quad_order(2 * degree + 3)
+ , dof_handler(tria)
+ , fe(degree)
{}
template <int dim>
polytest<dim>::~polytest()
dof_handler, 0, boundary_function, 0, constraints);
constraints.close();
DynamicSparsityPattern c_sparsity(dof_handler.n_dofs());
- DoFTools::make_sparsity_pattern(
- dof_handler, c_sparsity, constraints, false);
+ DoFTools::make_sparsity_pattern(dof_handler,
+ c_sparsity,
+ constraints,
+ false);
sparsity_pattern.copy_from(c_sparsity);
system_matrix.reinit(sparsity_pattern);
};
template <int dim>
- ExactSolution<dim>::ExactSolution() : Function<dim>(dim)
+ ExactSolution<dim>::ExactSolution()
+ : Function<dim>(dim)
{}
template <int dim>
void
};
template <int dim>
- MaxwellProblem<dim>::MaxwellProblem(const unsigned int order) :
- mapping(1),
- dof_handler(triangulation),
- fe(order),
- exact_solution()
+ MaxwellProblem<dim>::MaxwellProblem(const unsigned int order)
+ : mapping(1)
+ , dof_handler(triangulation)
+ , fe(order)
+ , exact_solution()
{
p_order = order;
quad_order = 2 * (p_order + 1);
constraints.close();
DynamicSparsityPattern c_sparsity(dof_handler.n_dofs());
- DoFTools::make_sparsity_pattern(
- dof_handler, c_sparsity, constraints, false);
+ DoFTools::make_sparsity_pattern(dof_handler,
+ c_sparsity,
+ constraints,
+ false);
sparsity_pattern.copy_from(c_sparsity);
system_matrix.reinit(sparsity_pattern);
QGauss<dim> quadrature(3);
const unsigned int n_q_points = quadrature.size();
- FEValues<dim> fe_values(
- fe, quadrature, update_values | update_gradients | update_JxW_values);
+ FEValues<dim> fe_values(fe,
+ quadrature,
+ update_values | update_gradients | update_JxW_values);
const double nu = 3.14159265358e-2;
QGauss<dim> quadrature(3);
const unsigned int n_q_points = quadrature.size();
- FEValues<dim> fe_values(
- fe, quadrature, update_values | update_gradients | update_JxW_values);
+ FEValues<dim> fe_values(fe,
+ quadrature,
+ update_values | update_gradients | update_JxW_values);
const double nu = 3.14159265358e-2;
QGauss<dim> quadrature(3);
const unsigned int n_q_points = quadrature.size();
- FEValues<dim> fe_values(
- fe, quadrature, update_values | update_gradients | update_JxW_values);
+ FEValues<dim> fe_values(fe,
+ quadrature,
+ update_values | update_gradients | update_JxW_values);
const double nu = 3.14159265358e-2;
// velocity-pressure coupling
if ((comp_i < dim) && (comp_j == dim))
local_matrix(i, j) +=
- (-fe_values.shape_grad_component(
- i, q, comp_i)[comp_i] *
+ (-fe_values.shape_grad_component(i,
+ q,
+ comp_i)[comp_i] *
fe_values.shape_value_component(j, q, comp_j) *
fe_values.JxW(q));
if ((comp_i == dim) && (comp_j < dim))
local_matrix(i, j) +=
(fe_values.shape_value_component(i, q, comp_i) *
- fe_values.shape_grad_component(
- j, q, comp_j)[comp_j] *
+ fe_values.shape_grad_component(j,
+ q,
+ comp_j)[comp_j] *
fe_values.JxW(q));
};
QGauss<dim> quadrature(3);
const unsigned int n_q_points = quadrature.size();
- FEValues<dim> fe_values(
- fe, quadrature, update_values | update_gradients | update_JxW_values);
+ FEValues<dim> fe_values(fe,
+ quadrature,
+ update_values | update_gradients | update_JxW_values);
const double nu = 3.14159265358e-2;
QGauss<dim> quadrature(3);
const unsigned int n_q_points = quadrature.size();
- FEValues<dim> fe_values(
- fe, quadrature, update_values | update_gradients | update_JxW_values);
+ FEValues<dim> fe_values(fe,
+ quadrature,
+ update_values | update_gradients | update_JxW_values);
const double nu = 3.14159265358e-2;
// velocity-pressure coupling
if ((comp_i < dim) && (comp_j == dim))
local_matrix(i, j) +=
- (-fe_values.shape_grad_component(
- i, q, comp_i)[comp_i] *
+ (-fe_values.shape_grad_component(i,
+ q,
+ comp_i)[comp_i] *
fe_values.shape_value_component(j, q, comp_j) *
fe_values.JxW(q));
if ((comp_i == dim) && (comp_j < dim))
local_matrix(i, j) +=
(fe_values.shape_value_component(i, q, comp_i) *
- fe_values.shape_grad_component(
- j, q, comp_j)[comp_j] *
+ fe_values.shape_grad_component(j,
+ q,
+ comp_j)[comp_j] *
fe_values.JxW(q));
};
QTrapez<1> q_trapez;
const unsigned int div = 10;
QIterated<dim> q(q_trapez, div);
- FEValues<dim> fe(
- fe_rt, q, update_values | update_gradients | update_quadrature_points);
+ FEValues<dim> fe(fe_rt,
+ q,
+ update_values | update_gradients | update_quadrature_points);
fe.reinit(c);
Assert(fe.get_fe().n_components() == dim, ExcInternalError());
class TestMap1 : public Function<dim>
{
public:
- TestMap1(const unsigned int n_components) : Function<dim>(n_components)
+ TestMap1(const unsigned int n_components)
+ : Function<dim>(n_components)
{}
virtual ~TestMap1()
const double phi;
public:
- TestDef1(const unsigned int n_components, const double ph) :
- Function<dim>(n_components),
- phi(ph)
+ TestDef1(const unsigned int n_components, const double ph)
+ : Function<dim>(n_components)
+ , phi(ph)
{}
virtual ~TestDef1()
const double scale;
public:
- TestDef2(const unsigned int n_components, const double sc) :
- Function<dim>(n_components),
- scale(sc)
+ TestDef2(const unsigned int n_components, const double sc)
+ : Function<dim>(n_components)
+ , scale(sc)
{}
virtual ~TestDef2()
const double scale;
public:
- TestDef3(const unsigned int n_components, const double sc) :
- Function<dim>(n_components),
- scale(sc)
+ TestDef3(const unsigned int n_components, const double sc)
+ : Function<dim>(n_components)
+ , scale(sc)
{}
virtual ~TestDef3()
std::vector<Polynomials::Polynomial<double>> polys;
public:
- TestPoly(unsigned int deg) : Function<dim>(2)
+ TestPoly(unsigned int deg)
+ : Function<dim>(2)
{
std::vector<double> coeff(deg, 0.0);
for (unsigned int p = 0; p < 4; ++p)
QTrapez<dim - 1> quadrature;
- FESubfaceValues<dim> fe_values(
- fe_rt_bubbles, quadrature, update_gradients);
+ FESubfaceValues<dim> fe_values(fe_rt_bubbles,
+ quadrature,
+ update_gradients);
fe_values.reinit(dof.begin_active(), 0, 0);
for (unsigned int q = 0; q < quadrature.size(); ++q)
{
dof.distribute_dofs(fe);
const QGauss<dim> quadrature(2);
- FEValues<dim> fe_values(
- fe, quadrature, update_covariant_transformation | update_hessians);
+ FEValues<dim> fe_values(fe,
+ quadrature,
+ update_covariant_transformation | update_hessians);
fe_values.reinit(dof.begin_active());
if (!cell->face(f)->at_boundary())
{
const QProjector<2>::DataSetDescriptor offset =
- (QProjector<2>::DataSetDescriptor::face(
- f,
- cell->face_orientation(f),
- cell->face_flip(f),
- cell->face_rotation(f),
- quad.size()));
+ (QProjector<2>::DataSetDescriptor::face(f,
+ cell->face_orientation(
+ f),
+ cell->face_flip(f),
+ cell->face_rotation(f),
+ quad.size()));
fe_v_face.reinit(cell, f);
DoFHandler<2>::active_cell_iterator cell_n = cell->neighbor(f);
QGauss<dim> quadrature(other.degree + 1);
Table<3, double> other_values(quadrature.size(), other.dofs_per_cell, dim);
Table<3, double> nodes_values(quadrature.size(), other.dofs_per_cell, dim);
- Table<3, Tensor<1, dim>> other_grads(
- quadrature.size(), other.dofs_per_cell, dim);
- Table<3, Tensor<1, dim>> nodes_grads(
- quadrature.size(), other.dofs_per_cell, dim);
+ Table<3, Tensor<1, dim>> other_grads(quadrature.size(),
+ other.dofs_per_cell,
+ dim);
+ Table<3, Tensor<1, dim>> nodes_grads(quadrature.size(),
+ other.dofs_per_cell,
+ dim);
for (unsigned int k = 0; k < quadrature.size(); ++k)
for (unsigned int i = 0; i < other.dofs_per_cell; ++i)
for (unsigned int d = 0; d < dim; ++d)
QTrapez<1> q_trapez;
const unsigned int div = 10;
QIterated<dim> q(q_trapez, div);
- FEValues<dim> fe(
- fe_rt, q, update_values | update_gradients | update_quadrature_points);
+ FEValues<dim> fe(fe_rt,
+ q,
+ update_values | update_gradients | update_quadrature_points);
fe.reinit(c);
for (unsigned int q_point = 0; q_point < q.size(); ++q_point)
QTrapez<1> q_trapez;
QIterated<dim> q(q_trapez, div);
- FEValues<dim> fe(
- mapping,
- finel,
- q,
- UpdateFlags(update_values | update_gradients | update_hessians));
+ FEValues<dim> fe(mapping,
+ finel,
+ q,
+ UpdateFlags(update_values | update_gradients |
+ update_hessians));
sprintf(fname, "Cell%dd-%s", dim, name);
// cerr << "\n" << fname << "\n";
const unsigned int div = 4;
- QTrapez<1> q_trapez;
- QIterated<dim - 1> q(q_trapez, div);
- FEFaceValues<dim> fe(
- mapping, finel, q, UpdateFlags(uflags | update_quadrature_points));
- FESubfaceValues<dim> sub(
- mapping, finel, q, UpdateFlags(uflags | update_quadrature_points));
+ QTrapez<1> q_trapez;
+ QIterated<dim - 1> q(q_trapez, div);
+ FEFaceValues<dim> fe(mapping,
+ finel,
+ q,
+ UpdateFlags(uflags | update_quadrature_points));
+ FESubfaceValues<dim> sub(mapping,
+ finel,
+ q,
+ UpdateFlags(uflags | update_quadrature_points));
sprintf(fname, "Face%dd-%s", dim, name);
deallog.push(fname);
{
const Tensor<3, dim>
t1 = sub.shape_3rd_derivative(i, k),
- t2 = sub.shape_3rd_derivative_component(
- i, k, c);
+ t2 =
+ sub.shape_3rd_derivative_component(i,
+ k,
+ c);
Assert(t1 == t2, ExcInternalError());
}
}
if (fe.is_primitive(i))
for (unsigned int c = 0; c < fe.n_components(); ++c)
- Assert(
- ((c == fe.system_to_component_index(i).first) &&
- (fe_values.shape_grad(i, x) ==
- fe_values.shape_grad_component(i, x, c))) ||
- ((c != fe.system_to_component_index(i).first) &&
- (fe_values.shape_grad_component(i, x, c) == Tensor<1, dim>())),
- ExcInternalError());
+ Assert(((c == fe.system_to_component_index(i).first) &&
+ (fe_values.shape_grad(i, x) ==
+ fe_values.shape_grad_component(i, x, c))) ||
+ ((c != fe.system_to_component_index(i).first) &&
+ (fe_values.shape_grad_component(i, x, c) ==
+ Tensor<1, dim>())),
+ ExcInternalError());
}
// check second derivatives
check<2>(fe);
}
{
- FESystem<2> fe = {
- FESystem<2>(FE_Q<2>(1) ^ 2) ^ 1, FE_DGQ<2>(2) ^ 0, FE_Q<2>(1) ^ 1};
+ FESystem<2> fe = {FESystem<2>(FE_Q<2>(1) ^ 2) ^ 1,
+ FE_DGQ<2>(2) ^ 0,
+ FE_Q<2>(1) ^ 1};
check<2>(fe);
}
check<2>(fe);
}
{
- FESystem<2> fe(
- FESystem<2>(FE_Q<2>(1) ^ 2) ^ 1, FE_DGQ<2>(2) ^ 0, FE_Q<2>(1));
+ FESystem<2> fe(FESystem<2>(FE_Q<2>(1) ^ 2) ^ 1,
+ FE_DGQ<2>(2) ^ 0,
+ FE_Q<2>(1));
check<2>(fe);
}
C.add(-1., D);
deallog << "Difference: "
- << filter_out_small_numbers(
- C.l1_norm(), std::numeric_limits<Number>::epsilon() * 100.)
+ << filter_out_small_numbers(C.l1_norm(),
+ std::numeric_limits<Number>::epsilon() *
+ 100.)
<< std::endl;
}
C.add(-1., D);
deallog << "Difference: "
- << filter_out_small_numbers(
- C.l1_norm(), 100. * std::numeric_limits<Number>::epsilon())
+ << filter_out_small_numbers(C.l1_norm(),
+ 100. *
+ std::numeric_limits<Number>::epsilon())
<< std::endl;
}
DoFRenumbering::component_wise(stokes_dof_handler, stokes_sub_blocks);
std::vector<types::global_dof_index> stokes_dofs_per_block(2);
- DoFTools::count_dofs_per_block(
- stokes_dof_handler, stokes_dofs_per_block, stokes_sub_blocks);
+ DoFTools::count_dofs_per_block(stokes_dof_handler,
+ stokes_dofs_per_block,
+ stokes_sub_blocks);
const unsigned int n_u = stokes_dofs_per_block[0],
n_p = stokes_dofs_per_block[1];
coupling[1][1] = DoFTools::always;
coupling[0][1] = DoFTools::always;
- DoFTools::make_sparsity_pattern(
- stokes_dof_handler,
- coupling,
- sp,
- cm,
- false,
- Utilities::MPI::this_mpi_process(MPI_COMM_WORLD));
+ DoFTools::make_sparsity_pattern(stokes_dof_handler,
+ coupling,
+ sp,
+ cm,
+ false,
+ Utilities::MPI::this_mpi_process(
+ MPI_COMM_WORLD));
SparsityTools::distribute_sparsity_pattern(
sp,
DoFRenumbering::component_wise(stokes_dof_handler, stokes_sub_blocks);
std::vector<types::global_dof_index> stokes_dofs_per_block(2);
- DoFTools::count_dofs_per_block(
- stokes_dof_handler, stokes_dofs_per_block, stokes_sub_blocks);
+ DoFTools::count_dofs_per_block(stokes_dof_handler,
+ stokes_dofs_per_block,
+ stokes_sub_blocks);
const unsigned int n_u = stokes_dofs_per_block[0],
n_p = stokes_dofs_per_block[1];
coupling[1][1] = DoFTools::always;
coupling[0][1] = DoFTools::always;
- DoFTools::make_sparsity_pattern(
- stokes_dof_handler,
- coupling,
- sp,
- cm,
- false,
- Utilities::MPI::this_mpi_process(MPI_COMM_WORLD));
+ DoFTools::make_sparsity_pattern(stokes_dof_handler,
+ coupling,
+ sp,
+ cm,
+ false,
+ Utilities::MPI::this_mpi_process(
+ MPI_COMM_WORLD));
sp.compress();
DoFTools::extract_locally_relevant_dofs(dof_handler, locally_relevant_dofs);
locally_relevant_partitioning.push_back(
locally_relevant_dofs.get_view(0, dofs_per_block[0]));
- locally_relevant_partitioning.push_back(locally_relevant_dofs.get_view(
- dofs_per_block[0], dofs_per_block[0] + dofs_per_block[1]));
+ locally_relevant_partitioning.push_back(
+ locally_relevant_dofs.get_view(dofs_per_block[0],
+ dofs_per_block[0] + dofs_per_block[1]));
IndexSet locally_owned_dofs = dof_handler.locally_owned_dofs();
locally_owned_partitioning.push_back(
locally_owned_dofs.get_view(0, dofs_per_block[0]));
- locally_owned_partitioning.push_back(locally_owned_dofs.get_view(
- dofs_per_block[0], dofs_per_block[0] + dofs_per_block[1]));
+ locally_owned_partitioning.push_back(
+ locally_owned_dofs.get_view(dofs_per_block[0],
+ dofs_per_block[0] + dofs_per_block[1]));
deallog << "owned: ";
locally_owned_dofs.print(deallog);
}
cell->get_dof_indices(local_dof_indices);
- constraints.distribute_local_to_global(
- local_matrix, local_dof_indices, A);
+ constraints.distribute_local_to_global(local_matrix,
+ local_dof_indices,
+ A);
}
A.compress(VectorOperation::add);
DoFTools::extract_locally_relevant_dofs(dof_handler, locally_relevant_dofs);
locally_relevant_partitioning.push_back(
locally_relevant_dofs.get_view(0, dofs_per_block[0]));
- locally_relevant_partitioning.push_back(locally_relevant_dofs.get_view(
- dofs_per_block[0], dofs_per_block[0] + dofs_per_block[1]));
+ locally_relevant_partitioning.push_back(
+ locally_relevant_dofs.get_view(dofs_per_block[0],
+ dofs_per_block[0] + dofs_per_block[1]));
IndexSet locally_owned_dofs = dof_handler.locally_owned_dofs();
locally_owned_partitioning.push_back(
locally_owned_dofs.get_view(0, dofs_per_block[0]));
- locally_owned_partitioning.push_back(locally_owned_dofs.get_view(
- dofs_per_block[0], dofs_per_block[0] + dofs_per_block[1]));
+ locally_owned_partitioning.push_back(
+ locally_owned_dofs.get_view(dofs_per_block[0],
+ dofs_per_block[0] + dofs_per_block[1]));
deallog << "owned: ";
locally_owned_dofs.print(deallog);
TrilinosWrappers::BlockSparsityPattern sp(locally_owned_partitioning,
MPI_COMM_WORLD);
- DoFTools::make_sparsity_pattern(
- dof_handler,
- sp,
- constraints,
- false,
- Utilities::MPI::this_mpi_process(MPI_COMM_WORLD));
+ DoFTools::make_sparsity_pattern(dof_handler,
+ sp,
+ constraints,
+ false,
+ Utilities::MPI::this_mpi_process(
+ MPI_COMM_WORLD));
sp.compress();
typename LA::MPI::BlockSparseMatrix A;
A.reinit(sp);
}
cell->get_dof_indices(local_dof_indices);
- constraints.distribute_local_to_global(
- local_matrix, local_dof_indices, A);
+ constraints.distribute_local_to_global(local_matrix,
+ local_dof_indices,
+ A);
}
A.compress(VectorOperation::add);
deallog.push("deal.II");
LinearAlgebra::distributed::Vector<double> w(local, MPI_COMM_WORLD);
set(w);
- LinearAlgebra::distributed::Vector<double> v(
- local, dense_local, MPI_COMM_WORLD);
+ LinearAlgebra::distributed::Vector<double> v(local,
+ dense_local,
+ MPI_COMM_WORLD);
v = w; // get copy of vector including ghost elements
test(v);
deallog.pop();
LinearAlgebra::distributed::BlockVector<double> w(partitioning,
MPI_COMM_WORLD);
set(w);
- LinearAlgebra::distributed::BlockVector<double> v(
- partitioning, dense_partitioning, MPI_COMM_WORLD);
+ LinearAlgebra::distributed::BlockVector<double> v(partitioning,
+ dense_partitioning,
+ MPI_COMM_WORLD);
v = w; // get copy of vector including ghost elements
test(v);
deallog.pop();
deallog.push("PETSc");
PETScWrappers::MPI::BlockVector w(partitioning, MPI_COMM_WORLD);
set(w);
- PETScWrappers::MPI::BlockVector v(
- partitioning, dense_partitioning, MPI_COMM_WORLD);
+ PETScWrappers::MPI::BlockVector v(partitioning,
+ dense_partitioning,
+ MPI_COMM_WORLD);
v = w; // get copy of vector including ghost elements
test(v);
deallog.pop();
deallog.push("Trilinos");
TrilinosWrappers::MPI::BlockVector w(partitioning, MPI_COMM_WORLD);
set(w);
- TrilinosWrappers::MPI::BlockVector v(
- partitioning, dense_partitioning, MPI_COMM_WORLD);
+ TrilinosWrappers::MPI::BlockVector v(partitioning,
+ dense_partitioning,
+ MPI_COMM_WORLD);
v = w; // get copy of vector including ghost elements
test(v);
deallog.pop();
// DynamicSparsityPattern sp (owned);
DynamicSparsityPattern sp(relevant);
typename LA::MPI::SparseMatrix matrix;
- DoFTools::make_sparsity_pattern(
- dof_handler,
- sp,
- cm,
- false,
- Utilities::MPI::this_mpi_process(MPI_COMM_WORLD));
+ DoFTools::make_sparsity_pattern(dof_handler,
+ sp,
+ cm,
+ false,
+ Utilities::MPI::this_mpi_process(
+ MPI_COMM_WORLD));
SparsityTools::distribute_sparsity_pattern(
sp,
dof_handler.n_locally_owned_dofs_per_processor(),
DynamicSparsityPattern sp(relevant);
typename LA::MPI::SparseMatrix matrix;
- DoFTools::make_sparsity_pattern(
- dof_handler,
- sp,
- cm,
- false,
- Utilities::MPI::this_mpi_process(MPI_COMM_WORLD));
+ DoFTools::make_sparsity_pattern(dof_handler,
+ sp,
+ cm,
+ false,
+ Utilities::MPI::this_mpi_process(
+ MPI_COMM_WORLD));
SparsityTools::distribute_sparsity_pattern(
sp,
dof_handler.n_locally_owned_dofs_per_processor(),
TrilinosWrappers::SparsityPattern sp(owned, MPI_COMM_WORLD);
typename LA::MPI::SparseMatrix matrix;
- DoFTools::make_sparsity_pattern(
- dof_handler,
- sp,
- cm,
- false,
- Utilities::MPI::this_mpi_process(MPI_COMM_WORLD));
+ DoFTools::make_sparsity_pattern(dof_handler,
+ sp,
+ cm,
+ false,
+ Utilities::MPI::this_mpi_process(
+ MPI_COMM_WORLD));
sp.compress();
matrix.reinit(sp);
++cell)
for (unsigned int v = 0; v < GeometryInfo<dim>::vertices_per_cell; ++v)
{
- min_adjacent_cell_level[cell->vertex_index(v)] = std::min<unsigned int>(
- min_adjacent_cell_level[cell->vertex_index(v)], cell->level());
- max_adjacent_cell_level[cell->vertex_index(v)] = std::max<unsigned int>(
- min_adjacent_cell_level[cell->vertex_index(v)], cell->level());
+ min_adjacent_cell_level[cell->vertex_index(v)] =
+ std::min<unsigned int>(min_adjacent_cell_level[cell->vertex_index(v)],
+ cell->level());
+ max_adjacent_cell_level[cell->vertex_index(v)] =
+ std::max<unsigned int>(min_adjacent_cell_level[cell->vertex_index(v)],
+ cell->level());
}
for (unsigned int k = 0; k < tr.n_vertices(); ++k)
++cell)
for (unsigned int v = 0; v < GeometryInfo<dim>::vertices_per_cell; ++v)
{
- min_adjacent_cell_level[cell->vertex_index(v)] = std::min<unsigned int>(
- min_adjacent_cell_level[cell->vertex_index(v)], cell->level());
- max_adjacent_cell_level[cell->vertex_index(v)] = std::max<unsigned int>(
- min_adjacent_cell_level[cell->vertex_index(v)], cell->level());
+ min_adjacent_cell_level[cell->vertex_index(v)] =
+ std::min<unsigned int>(min_adjacent_cell_level[cell->vertex_index(v)],
+ cell->level());
+ max_adjacent_cell_level[cell->vertex_index(v)] =
+ std::max<unsigned int>(min_adjacent_cell_level[cell->vertex_index(v)],
+ cell->level());
}
for (unsigned int k = 0; k < tr.n_vertices(); ++k)
++cell)
for (unsigned int v = 0; v < GeometryInfo<dim>::vertices_per_cell; ++v)
{
- min_adjacent_cell_level[cell->vertex_index(v)] = std::min<unsigned int>(
- min_adjacent_cell_level[cell->vertex_index(v)], cell->level());
- max_adjacent_cell_level[cell->vertex_index(v)] = std::max<unsigned int>(
- min_adjacent_cell_level[cell->vertex_index(v)], cell->level());
+ min_adjacent_cell_level[cell->vertex_index(v)] =
+ std::min<unsigned int>(min_adjacent_cell_level[cell->vertex_index(v)],
+ cell->level());
+ max_adjacent_cell_level[cell->vertex_index(v)] =
+ std::max<unsigned int>(min_adjacent_cell_level[cell->vertex_index(v)],
+ cell->level());
}
for (unsigned int k = 0; k < tr.n_vertices(); ++k)
if (my_pair.first->is_locally_owned())
{
computed_pts++;
- auto cells_it = std::find(
- computed_cells.begin(), computed_cells.end(), my_pair.first);
+ auto cells_it = std::find(computed_cells.begin(),
+ computed_cells.end(),
+ my_pair.first);
if (cells_it == computed_cells.end())
{
tria.end())) ==
static_cast<signed int>(tria.n_active_cells(3)),
ExcInternalError());
- logfile << "Check 4: "
- << (std::distance(
- FI(std::bind(predicate, std::placeholders::_1, 3))
- .set_to_next_positive(tria.begin_active()),
- FI(std::bind(predicate, std::placeholders::_1, 3),
- tria.end())) ==
- static_cast<signed int>(tria.n_active_cells(3)) ?
- "OK" :
- "Failed")
- << std::endl;
+ logfile
+ << "Check 4: "
+ << (std::distance(FI(std::bind(predicate, std::placeholders::_1, 3))
+ .set_to_next_positive(tria.begin_active()),
+ FI(std::bind(predicate, std::placeholders::_1, 3),
+ tria.end())) ==
+ static_cast<signed int>(tria.n_active_cells(3)) ?
+ "OK" :
+ "Failed")
+ << std::endl;
};
const IteratorFilters::LevelEqualTo predicate(3);
FilteredIterator<active_cell_iterator>
begin = make_filtered_iterator(tria.begin_active(), predicate),
- end = make_filtered_iterator(
- static_cast<active_cell_iterator>(tria.end()), predicate);
+ end =
+ make_filtered_iterator(static_cast<active_cell_iterator>(tria.end()),
+ predicate);
Assert(std::distance(begin, end) ==
static_cast<signed int>(tria.n_active_cells(3)),
tria.end())) ==
static_cast<signed int>(tria.n_active_cells(3)),
ExcInternalError());
- logfile << "Check 4: "
- << (std::distance(
- FI(std::bind(predicate, std::placeholders::_1, 3))
- .set_to_next_positive(tria.begin_active()),
- FI(std::bind(predicate, std::placeholders::_1, 3),
- tria.end())) ==
- static_cast<signed int>(tria.n_active_cells(3)) ?
- "OK" :
- "Failed")
- << std::endl;
+ logfile
+ << "Check 4: "
+ << (std::distance(FI(std::bind(predicate, std::placeholders::_1, 3))
+ .set_to_next_positive(tria.begin_active()),
+ FI(std::bind(predicate, std::placeholders::_1, 3),
+ tria.end())) ==
+ static_cast<signed int>(tria.n_active_cells(3)) ?
+ "OK" :
+ "Failed")
+ << std::endl;
};
{
Triangulation<2> triangulation;
Triangulation<3> tr;
- GridGenerator::hyper_rectangle(
- triangulation, Point<2>(0, 0), Point<2>(1, 1), true);
+ GridGenerator::hyper_rectangle(triangulation,
+ Point<2>(0, 0),
+ Point<2>(1, 1),
+ true);
GridGenerator::extrude_triangulation(triangulation, 3, 2.0, tr);
GridOut go;
++cell)
cells_to_remove.insert(cell);
- GridGenerator::create_triangulation_with_removed_cells(
- triangulation, cells_to_remove, tr);
+ GridGenerator::create_triangulation_with_removed_cells(triangulation,
+ cells_to_remove,
+ tr);
GridOut go;
go.write_gnuplot(tr, out);
}
class Shift : public Function<spacedim>
{
public:
- Shift() : Function<spacedim>(spacedim)
+ Shift()
+ : Function<spacedim>(spacedim)
{}
virtual double
displacement_dof_handler.initialize(triangulation, displacement_fe);
Vector<double> displacements(displacement_dof_handler.n_dofs());
- VectorTools::interpolate(
- displacement_dof_handler, Shift<spacedim>(), displacements);
+ VectorTools::interpolate(displacement_dof_handler,
+ Shift<spacedim>(),
+ displacements);
MappingQ1Eulerian<dim, Vector<double>, spacedim> mapping(
displacement_dof_handler, displacements);
const bool include_artificial)
{
GridOut out;
- out.write_mesh_per_processor_as_vtu(
- tr, filename, view_levels, include_artificial);
+ out.write_mesh_per_processor_as_vtu(tr,
+ filename,
+ view_levels,
+ include_artificial);
// copy the .pvtu and .vtu files
// into the logstream
const bool include_artificial)
{
GridOut out;
- out.write_mesh_per_processor_as_vtu(
- tr, filename, view_levels, include_artificial);
+ out.write_mesh_per_processor_as_vtu(tr,
+ filename,
+ view_levels,
+ include_artificial);
// copy the .pvtu and .vtu files
// into the logstream
Point<2> center(0., 0.);
- GridGenerator::hyper_cube_with_cylindrical_hole(
- triangulation, inner_radius, outer_radius);
+ GridGenerator::hyper_cube_with_cylindrical_hole(triangulation,
+ inner_radius,
+ outer_radius);
triangulation.reset_manifold(0);
triangulation.refine_global(1);
Point<2> center(0., 0.);
- GridGenerator::hyper_cube_with_cylindrical_hole(
- triangulation, inner_radius, outer_radius);
+ GridGenerator::hyper_cube_with_cylindrical_hole(triangulation,
+ inner_radius,
+ outer_radius);
triangulation.refine_global(1);
for (unsigned int l = 0; l < 3; ++l)
const unsigned int n_subdivisions = (2 * dim + 1);
Triangulation<dim> triangulation;
- GridGenerator::subdivided_parallelepiped(
- triangulation, n_subdivisions, corners, colorize);
+ GridGenerator::subdivided_parallelepiped(triangulation,
+ n_subdivisions,
+ corners,
+ colorize);
GridOut grid_out;
Triangulation<dim> triangulation;
- GridGenerator::subdivided_parallelepiped(
- triangulation, subd, corners, colorize);
+ GridGenerator::subdivided_parallelepiped(triangulation,
+ subd,
+ corners,
+ colorize);
{
std::map<unsigned int, unsigned int> boundary_count;
const unsigned int n_subdivisions = 1;
Triangulation<3> triangulation;
- GridGenerator::subdivided_parallelepiped(
- triangulation, n_subdivisions, corners);
+ GridGenerator::subdivided_parallelepiped(triangulation,
+ n_subdivisions,
+ corners);
dealii::GridTools::remove_anisotropy<3>(triangulation,
/*max ratio =*/1.2);
<< "Halo " << cell_2->level() << " " << cell_2->index()
<< " " << cell_2->id() << " " << cell_2->id().to_string()
<< std::endl;
- AssertThrow(
- cell_2 == cell_1,
- ExcMessage("Halo cell is not identical to ghost cell."));
+ AssertThrow(cell_2 == cell_1,
+ ExcMessage(
+ "Halo cell is not identical to ghost cell."));
}
}
}
// By using MappingQEulerian with the position vector, we are making
// everything bigger by a factor 2.
- MappingQEulerian<dim, Vector<double>, spacedim> map_fe(
- degree, dof_sys, euler);
+ MappingQEulerian<dim, Vector<double>, spacedim> map_fe(degree,
+ dof_sys,
+ euler);
deallog << "Min diameter : " << GridTools::minimal_cell_diameter(tria)
<< std::endl
class L2_inverse : public Function<dim>
{
public:
- L2_inverse(const std::vector<Point<dim>> &distance_source) :
- Function<dim>(),
- distance_source(distance_source)
+ L2_inverse(const std::vector<Point<dim>> &distance_source)
+ : Function<dim>()
+ , distance_source(distance_source)
{
Assert(distance_source.size() > 0, ExcNotImplemented());
}
{
const Point<dim> &old_vertex = face->vertex(vertex_no);
- Point<dim> new_vertex(
- old_vertex[0],
- old_vertex[1],
- (old_vertex[0] <= 0 ?
- old_vertex[2] / 2 :
- old_vertex[2] / (2 + 4 * old_vertex[0] * old_vertex[0])));
+ Point<dim> new_vertex(old_vertex[0],
+ old_vertex[1],
+ (old_vertex[0] <= 0 ?
+ old_vertex[2] / 2 :
+ old_vertex[2] / (2 + 4 * old_vertex[0] *
+ old_vertex[0])));
new_points[face->vertex_index(vertex_no)] = new_vertex;
}
// refined if that
// has not yet
// happened
- typename DoFHandler<dim>::cell_iterator cell2(
- &tria_2, cell->level(), cell->index(), &dof_2);
+ typename DoFHandler<dim>::cell_iterator cell2(&tria_2,
+ cell->level(),
+ cell->index(),
+ &dof_2);
if (!cell2->has_children())
cell2->set_refine_flag();
};
// set up the bulk triangulation
Triangulation<2> bulk_triangulation;
- GridGenerator::subdivided_hyper_rectangle(
- bulk_triangulation, {22u, 4u}, Point<2>(0.0, 0.0), Point<2>(2.2, 0.41));
+ GridGenerator::subdivided_hyper_rectangle(bulk_triangulation,
+ {22u, 4u},
+ Point<2>(0.0, 0.0),
+ Point<2>(2.2, 0.41));
std::set<Triangulation<2>::active_cell_iterator> cells_to_remove;
Tensor<1, 2> cylinder_triangulation_offset;
for (const auto cell : bulk_triangulation.active_cell_iterators())
}
}
Triangulation<2> result_1;
- GridGenerator::create_triangulation_with_removed_cells(
- bulk_triangulation, cells_to_remove, result_1);
+ GridGenerator::create_triangulation_with_removed_cells(bulk_triangulation,
+ cells_to_remove,
+ result_1);
// set up the cylinder triangulation
Triangulation<2> cylinder_triangulation;
- GridGenerator::hyper_cube_with_cylindrical_hole(
- cylinder_triangulation, 0.05, 0.41 / 4.0);
+ GridGenerator::hyper_cube_with_cylindrical_hole(cylinder_triangulation,
+ 0.05,
+ 0.41 / 4.0);
GridTools::shift(cylinder_triangulation_offset, cylinder_triangulation);
// dumb hack
for (const auto cell : cylinder_triangulation.active_cell_iterators())
for (const auto cell : tria.active_cell_iterators())
for (unsigned int line_n = 0; line_n < GeometryInfo<2>::lines_per_cell;
++line_n)
- min_line_length = std::min(
- min_line_length,
- (cell->line(line_n)->vertex(0) - cell->line(line_n)->vertex(1))
- .norm());
+ min_line_length = std::min(min_line_length,
+ (cell->line(line_n)->vertex(0) -
+ cell->line(line_n)->vertex(1))
+ .norm());
return min_line_length;
};
Triangulation<2> result_2;
- GridGenerator::merge_triangulations(
- result_1, cylinder_triangulation, result_2, tolerance);
+ GridGenerator::merge_triangulations(result_1,
+ cylinder_triangulation,
+ result_2,
+ tolerance);
const types::manifold_id tfi_id = 1;
const types::manifold_id polar_id = 0;
}
// de-duplicate
std::sort(inner_pointers.begin(), inner_pointers.end());
- inner_pointers.erase(
- std::unique(inner_pointers.begin(), inner_pointers.end()),
- inner_pointers.end());
+ inner_pointers.erase(std::unique(inner_pointers.begin(),
+ inner_pointers.end()),
+ inner_pointers.end());
// find the current center...
Point<2> center;
// finally generate a triangulation
// out of this
GridReordering<3>::reorder_cells(cells);
- coarse_grid.create_triangulation_compatibility(
- vertices, cells, SubCellData());
+ coarse_grid.create_triangulation_compatibility(vertices,
+ cells,
+ SubCellData());
}
}
// finally generate a triangulation
// out of this
- coarse_grid.create_triangulation_compatibility(
- vertices, cells, SubCellData());
+ coarse_grid.create_triangulation_compatibility(vertices,
+ cells,
+ SubCellData());
}
const unsigned int n_vertices_per_surface = 8;
Assert(vertices.size() == n_vertices_per_surface * 2, ExcInternalError());
- const unsigned int connectivity[3][4] = {
- {1, 2, 3, 0}, {3, 4, 5, 0}, {0, 5, 6, 7}};
+ const unsigned int connectivity[3][4] = {{1, 2, 3, 0},
+ {3, 4, 5, 0},
+ {0, 5, 6, 7}};
for (unsigned int i = 0; i < 3; ++i)
{
CellData<3> cell;
// finally generate a triangulation
// out of this
GridReordering<3>::reorder_cells(cells);
- coarse_grid.create_triangulation_compatibility(
- vertices, cells, SubCellData());
+ coarse_grid.create_triangulation_compatibility(vertices,
+ cells,
+ SubCellData());
}
quadrature,
update_quadrature_points | update_JxW_values |
update_normal_vectors);
- FESubfaceValues<3> fe_face_values2(
- fe,
- quadrature,
- update_quadrature_points | update_JxW_values | update_normal_vectors);
+ FESubfaceValues<3> fe_face_values2(fe,
+ quadrature,
+ update_quadrature_points |
+ update_JxW_values |
+ update_normal_vectors);
DoFHandler<3> dof_handler(tria);
dof_handler.distribute_dofs(fe);
QGauss<2> q_face(3);
- FEFaceValues<3> fe_face_values(
- fe, q_face, update_normal_vectors | update_JxW_values);
+ FEFaceValues<3> fe_face_values(fe,
+ q_face,
+ update_normal_vectors | update_JxW_values);
FESubfaceValues<3> fe_subface_values(
fe, q_face, update_normal_vectors | update_JxW_values);
{
QTrapez<2> quadrature;
FE_Q<3> fe(1);
- FEFaceValues<3> fe_face_values1(
- fe, quadrature, update_quadrature_points | update_JxW_values);
- FEFaceValues<3> fe_face_values2(
- fe, quadrature, update_quadrature_points | update_JxW_values);
+ FEFaceValues<3> fe_face_values1(fe,
+ quadrature,
+ update_quadrature_points | update_JxW_values);
+ FEFaceValues<3> fe_face_values2(fe,
+ quadrature,
+ update_quadrature_points | update_JxW_values);
DoFHandler<3> dof_handler(tria);
dof_handler.distribute_dofs(fe);
class F : public Function<dim>
{
public:
- F(const unsigned int q) : q(q)
+ F(const unsigned int q)
+ : q(q)
{}
virtual double
for (unsigned int q = 0; q <= p + 2; ++q)
{
// interpolate the function
- VectorTools::interpolate(
- mapping, dof_handler, F<dim>(q), interpolant);
+ VectorTools::interpolate(mapping,
+ dof_handler,
+ F<dim>(q),
+ interpolant);
// then compute the interpolation error
VectorTools::integrate_difference(mapping,
class F : public Function<dim>
{
public:
- F(const unsigned int q) : q(q)
+ F(const unsigned int q)
+ : q(q)
{}
virtual double
for (unsigned int q = 0; q <= p + 2; ++q)
{
// interpolate the function
- VectorTools::interpolate(
- mapping, dof_handler, F<dim>(q), interpolant);
+ VectorTools::interpolate(mapping,
+ dof_handler,
+ F<dim>(q),
+ interpolant);
// then compute the interpolation error
VectorTools::integrate_difference(mapping,
class F : public Function<dim>
{
public:
- F(const unsigned int q) : q(q)
+ F(const unsigned int q)
+ : q(q)
{}
virtual double
for (unsigned int q = 0; q <= p + 2; ++q)
{
// interpolate the function
- VectorTools::interpolate(
- mapping, dof_handler, F<dim>(q), interpolant);
+ VectorTools::interpolate(mapping,
+ dof_handler,
+ F<dim>(q),
+ interpolant);
// then compute the interpolation error
VectorTools::integrate_difference(mapping,
{
QTrapez<2> quadrature;
FE_Q<3> fe(1);
- FEFaceValues<3> fe_face_values1(
- fe, quadrature, update_quadrature_points | update_JxW_values);
- FEFaceValues<3> fe_face_values2(
- fe, quadrature, update_quadrature_points | update_JxW_values);
+ FEFaceValues<3> fe_face_values1(fe,
+ quadrature,
+ update_quadrature_points | update_JxW_values);
+ FEFaceValues<3> fe_face_values2(fe,
+ quadrature,
+ update_quadrature_points | update_JxW_values);
DoFHandler<3> dof_handler(tria);
dof_handler.distribute_dofs(fe);
std::vector<unsigned int> ref(2);
ref[0] = 100;
ref[1] = 3;
- GridGenerator::subdivided_hyper_rectangle(
- triangulation, ref, Point<2>(), Point<2>(100, 3));
+ GridGenerator::subdivided_hyper_rectangle(triangulation,
+ ref,
+ Point<2>(),
+ Point<2>(100, 3));
// refine all cells at the lower
// boundary. we then have 600 cells
{
p += face->vertex(v) *
linear_interpolator.shape_value(v, Point<2>(xi, eta));
- normal += normals[v] * linear_interpolator.shape_value(
- v, Point<2>(xi, eta));
+ normal +=
+ normals[v] *
+ linear_interpolator.shape_value(v, Point<2>(xi, eta));
}
normal /= normal.norm();
deallog << "n_active_cells: " << tria.n_active_cells() << std::endl;
- GridRefinement::refine_and_coarsen_fixed_fraction(
- tria, estimated_error_per_cell, 0.25, 0);
+ GridRefinement::refine_and_coarsen_fixed_fraction(tria,
+ estimated_error_per_cell,
+ 0.25,
+ 0);
tria.execute_coarsening_and_refinement();
deallog << "n_active_cells: " << tria.n_active_cells() << std::endl;
std::vector<bool> selected_dofs(dof_handler.n_dofs());
for (unsigned int subdomain = 0; subdomain < (1 << dim); ++subdomain)
{
- DoFTools::extract_subdomain_dofs(
- dof_handler, subdomain, selected_dofs);
- AssertThrow(
- static_cast<unsigned int>(
- std::count(selected_dofs.begin(), selected_dofs.end(), true)) ==
- dof_handler.n_dofs() / (1 << dim),
- ExcNumberMismatch(
- std::count(selected_dofs.begin(), selected_dofs.end(), true),
- dof_handler.n_dofs() / (1 << dim)));
+ DoFTools::extract_subdomain_dofs(dof_handler,
+ subdomain,
+ selected_dofs);
+ AssertThrow(static_cast<unsigned int>(std::count(
+ selected_dofs.begin(), selected_dofs.end(), true)) ==
+ dof_handler.n_dofs() / (1 << dim),
+ ExcNumberMismatch(std::count(selected_dofs.begin(),
+ selected_dofs.end(),
+ true),
+ dof_handler.n_dofs() / (1 << dim)));
}
deallog << "Check 3 (dim=" << dim << ") ok" << std::endl;
};
std::vector<bool> selected_dofs(dof_handler.n_dofs());
for (unsigned int subdomain = 0; subdomain < (1 << dim); ++subdomain)
{
- DoFTools::extract_subdomain_dofs(
- dof_handler, subdomain, selected_dofs);
+ DoFTools::extract_subdomain_dofs(dof_handler,
+ subdomain,
+ selected_dofs);
AssertThrow(
static_cast<unsigned int>(
std::count(selected_dofs.begin(), selected_dofs.end(), true)) ==
dof_handler.distribute_dofs(fe_collection);
deallog << "Coarse mesh:" << std::endl;
- print_dofs<spacedim>(
- dof_handler.begin_active()->face(0), 0, fe1.dofs_per_face);
- print_dofs<spacedim>(
- dof_handler.begin_active()->face(1), 0, fe1.dofs_per_face);
+ print_dofs<spacedim>(dof_handler.begin_active()->face(0),
+ 0,
+ fe1.dofs_per_face);
+ print_dofs<spacedim>(dof_handler.begin_active()->face(1),
+ 0,
+ fe1.dofs_per_face);
tria.refine_global(2);
{
<< ", active_fe_index=" << cell->active_fe_index() << std::endl;
print_dofs<spacedim>(cell, cell->get_fe().dofs_per_cell);
- print_dofs<spacedim>(
- cell->face(0), cell->active_fe_index(), cell->get_fe().dofs_per_face);
- print_dofs<spacedim>(
- cell->face(1), cell->active_fe_index(), cell->get_fe().dofs_per_face);
+ print_dofs<spacedim>(cell->face(0),
+ cell->active_fe_index(),
+ cell->get_fe().dofs_per_face);
+ print_dofs<spacedim>(cell->face(1),
+ cell->active_fe_index(),
+ cell->get_fe().dofs_per_face);
}
}
class MySquareFunction : public Function<dim>
{
public:
- MySquareFunction() : Function<dim>(dim + 1)
+ MySquareFunction()
+ : Function<dim>(dim + 1)
{}
virtual double
SparsityPattern sparsity(dof.n_boundary_dofs(function_map),
dof.max_couplings_between_boundary_dofs());
- DoFTools::make_boundary_sparsity_pattern(
- dof, function_map, dof_to_boundary_mapping, sparsity);
+ DoFTools::make_boundary_sparsity_pattern(dof,
+ function_map,
+ dof_to_boundary_mapping,
+ sparsity);
sparsity.compress();
SparseMatrix<double> matrix;
class MySquareFunction : public Function<dim>
{
public:
- MySquareFunction() : Function<dim>(2 * dim + 1)
+ MySquareFunction()
+ : Function<dim>(2 * dim + 1)
{}
virtual double
SparsityPattern sparsity(dof.n_boundary_dofs(function_map),
dof.max_couplings_between_boundary_dofs());
- DoFTools::make_boundary_sparsity_pattern(
- dof, function_map, dof_to_boundary_mapping, sparsity);
+ DoFTools::make_boundary_sparsity_pattern(dof,
+ function_map,
+ dof_to_boundary_mapping,
+ sparsity);
sparsity.compress();
SparseMatrix<double> matrix;
}
template <int dim>
-ExactSolution<dim>::ExactSolution() : Function<dim>()
+ExactSolution<dim>::ExactSolution()
+ : Function<dim>()
{}
};
template <int dim>
- LaplaceProblem<dim>::LaplaceProblem() : dof_handler(triangulation)
+ LaplaceProblem<dim>::LaplaceProblem()
+ : dof_handler(triangulation)
{
fe.push_back(FE_Q<dim>(1));
quadrature.push_back(QGauss<dim>(2));
for (unsigned int i = 0; i < dofs_per_cell; ++i)
for (unsigned int j = 0; j < dofs_per_cell; ++j)
- system_matrix.add(
- local_dof_indices[i], local_dof_indices[j], cell_matrix(i, j));
+ system_matrix.add(local_dof_indices[i],
+ local_dof_indices[j],
+ cell_matrix(i, j));
for (unsigned int i = 0; i < dofs_per_cell; ++i)
system_rhs(local_dof_indices[i]) += cell_rhs(i);
std::map<types::global_dof_index, double> boundary_values;
- VectorTools::interpolate_boundary_values(
- dof_handler, 0, exact_solution, boundary_values);
- VectorTools::interpolate_boundary_values(
- dof_handler, 1, exact_solution, boundary_values);
- MatrixTools::apply_boundary_values(
- boundary_values, system_matrix, solution, system_rhs);
+ VectorTools::interpolate_boundary_values(dof_handler,
+ 0,
+ exact_solution,
+ boundary_values);
+ VectorTools::interpolate_boundary_values(dof_handler,
+ 1,
+ exact_solution,
+ boundary_values);
+ MatrixTools::apply_boundary_values(boundary_values,
+ system_matrix,
+ solution,
+ system_rhs);
}
template <int dim>
};
template <int dim>
- LaplaceProblem<dim>::LaplaceProblem() : fe(1), dof_handler(triangulation)
+ LaplaceProblem<dim>::LaplaceProblem()
+ : fe(1)
+ , dof_handler(triangulation)
{}
template <int dim>
for (unsigned int i = 0; i < dofs_per_cell; ++i)
for (unsigned int j = 0; j < dofs_per_cell; ++j)
- system_matrix.add(
- local_dof_indices[i], local_dof_indices[j], cell_matrix(i, j));
+ system_matrix.add(local_dof_indices[i],
+ local_dof_indices[j],
+ cell_matrix(i, j));
for (unsigned int i = 0; i < dofs_per_cell; ++i)
system_rhs(local_dof_indices[i]) += cell_rhs(i);
std::map<types::global_dof_index, double> boundary_values;
- VectorTools::interpolate_boundary_values(
- dof_handler, 0, exact_solution, boundary_values);
- VectorTools::interpolate_boundary_values(
- dof_handler, 1, exact_solution, boundary_values);
- MatrixTools::apply_boundary_values(
- boundary_values, system_matrix, solution, system_rhs);
+ VectorTools::interpolate_boundary_values(dof_handler,
+ 0,
+ exact_solution,
+ boundary_values);
+ VectorTools::interpolate_boundary_values(dof_handler,
+ 1,
+ exact_solution,
+ boundary_values);
+ MatrixTools::apply_boundary_values(boundary_values,
+ system_matrix,
+ solution,
+ system_rhs);
}
template <int dim>
Triangulation<3> triangulation;
std::vector<unsigned int> subdivisions(3, 2);
subdivisions[2] = 1;
- GridGenerator::subdivided_hyper_rectangle(
- triangulation, subdivisions, Point<3>(), Point<3>(2, 2, 1));
+ GridGenerator::subdivided_hyper_rectangle(triangulation,
+ subdivisions,
+ Point<3>(),
+ Point<3>(2, 2, 1));
hp::FECollection<3> fe;
fe.push_back(FE_Q<3>(1));
Triangulation<3> triangulation;
std::vector<unsigned int> subdivisions(3, 2);
subdivisions[2] = 1;
- GridGenerator::subdivided_hyper_rectangle(
- triangulation, subdivisions, Point<3>(), Point<3>(2, 2, 1));
+ GridGenerator::subdivided_hyper_rectangle(triangulation,
+ subdivisions,
+ Point<3>(),
+ Point<3>(2, 2, 1));
hp::FECollection<3> fe;
fe.push_back(FE_Q<3>(1));
Triangulation<dim> triangulation;
std::vector<unsigned int> subdivisions(dim, 1);
subdivisions[0] = 2;
- GridGenerator::subdivided_hyper_rectangle(
- triangulation,
- subdivisions,
- Point<dim>(),
- (dim == 3 ? Point<dim>(2, 1, 1) : Point<dim>(2, 1)));
+ GridGenerator::subdivided_hyper_rectangle(triangulation,
+ subdivisions,
+ Point<dim>(),
+ (dim == 3 ? Point<dim>(2, 1, 1) :
+ Point<dim>(2, 1)));
(++triangulation.begin_active())->set_refine_flag();
triangulation.execute_coarsening_and_refinement();
class RightHandSide : public Function<dim>
{
public:
- RightHandSide() : Function<dim>()
+ RightHandSide()
+ : Function<dim>()
{}
virtual double
template <int dim>
-LaplaceProblem<dim>::LaplaceProblem() : dof_handler(triangulation)
+LaplaceProblem<dim>::LaplaceProblem()
+ : dof_handler(triangulation)
{
for (unsigned int degree = 2; degree < 5; ++degree)
{
for (unsigned int i = 0; i < dofs_per_cell; ++i)
{
for (unsigned int j = 0; j < dofs_per_cell; ++j)
- system_matrix.add(
- local_dof_indices[i], local_dof_indices[j], cell_matrix(i, j));
+ system_matrix.add(local_dof_indices[i],
+ local_dof_indices[j],
+ cell_matrix(i, j));
system_rhs(local_dof_indices[i]) += cell_rhs(i);
}
hanging_node_constraints.condense(system_rhs);
condense.stop();
std::map<types::global_dof_index, double> boundary_values;
- VectorTools::interpolate_boundary_values(
- dof_handler, 0, Functions::ZeroFunction<dim>(), boundary_values);
- MatrixTools::apply_boundary_values(
- boundary_values, system_matrix, solution, system_rhs);
+ VectorTools::interpolate_boundary_values(dof_handler,
+ 0,
+ Functions::ZeroFunction<dim>(),
+ boundary_values);
+ MatrixTools::apply_boundary_values(boundary_values,
+ system_matrix,
+ solution,
+ system_rhs);
}
template <int dim>
if (!((i == 0) && (j == 0) && (k == 0)) &&
(i * i + j * j + k * k < N * N))
{
- k_vectors.push_back(Point<dim>(
- numbers::PI * i, numbers::PI * j, numbers::PI * k));
+ k_vectors.push_back(Point<dim>(numbers::PI * i,
+ numbers::PI * j,
+ numbers::PI * k));
k_vectors_magnitude.push_back(i * i + j * j + k * k);
}
Vector<float> smoothness_indicators(triangulation.n_active_cells());
estimate_smoothness(smoothness_indicators);
- GridRefinement::refine_and_coarsen_fixed_number(
- triangulation, estimated_error_per_cell, 0.3, 0.03);
+ GridRefinement::refine_and_coarsen_fixed_number(triangulation,
+ estimated_error_per_cell,
+ 0.3,
+ 0.03);
float max_smoothness = 0,
min_smoothness = smoothness_indicators.linfty_norm();
estimate_smoothness(smoothness_indicators);
Vector<double> smoothness_field(dof_handler.n_dofs());
- DoFTools::distribute_cell_to_dof_vector(
- dof_handler, smoothness_indicators, smoothness_field);
+ DoFTools::distribute_cell_to_dof_vector(dof_handler,
+ smoothness_indicators,
+ smoothness_field);
Vector<float> fe_indices(triangulation.n_active_cells());
{
class RightHandSide : public Function<dim>
{
public:
- RightHandSide() : Function<dim>()
+ RightHandSide()
+ : Function<dim>()
{}
virtual double
template <int dim>
-LaplaceProblem<dim>::LaplaceProblem() : dof_handler(triangulation)
+LaplaceProblem<dim>::LaplaceProblem()
+ : dof_handler(triangulation)
{
for (unsigned int degree = 2; degree < 5; ++degree)
{
for (unsigned int i = 0; i < dofs_per_cell; ++i)
{
for (unsigned int j = 0; j < dofs_per_cell; ++j)
- system_matrix.add(
- local_dof_indices[i], local_dof_indices[j], cell_matrix(i, j));
+ system_matrix.add(local_dof_indices[i],
+ local_dof_indices[j],
+ cell_matrix(i, j));
system_rhs(local_dof_indices[i]) += cell_rhs(i);
}
hanging_node_constraints.condense(system_rhs);
condense.stop();
std::map<types::global_dof_index, double> boundary_values;
- VectorTools::interpolate_boundary_values(
- dof_handler, 0, Functions::ZeroFunction<dim>(), boundary_values);
- MatrixTools::apply_boundary_values(
- boundary_values, system_matrix, solution, system_rhs);
+ VectorTools::interpolate_boundary_values(dof_handler,
+ 0,
+ Functions::ZeroFunction<dim>(),
+ boundary_values);
+ MatrixTools::apply_boundary_values(boundary_values,
+ system_matrix,
+ solution,
+ system_rhs);
}
template <int dim>
if (!((i == 0) && (j == 0) && (k == 0)) &&
(i * i + j * j + k * k < N * N))
{
- k_vectors.push_back(Point<dim>(
- numbers::PI * i, numbers::PI * j, numbers::PI * k));
+ k_vectors.push_back(Point<dim>(numbers::PI * i,
+ numbers::PI * j,
+ numbers::PI * k));
k_vectors_magnitude.push_back(i * i + j * j + k * k);
}
Vector<float> smoothness_indicators(triangulation.n_active_cells());
estimate_smoothness(smoothness_indicators);
- GridRefinement::refine_and_coarsen_fixed_number(
- triangulation, estimated_error_per_cell, 0.3, 0.03);
+ GridRefinement::refine_and_coarsen_fixed_number(triangulation,
+ estimated_error_per_cell,
+ 0.3,
+ 0.03);
float max_smoothness = 0,
min_smoothness = smoothness_indicators.linfty_norm();
estimate_smoothness(smoothness_indicators);
Vector<double> smoothness_field(dof_handler.n_dofs());
- DoFTools::distribute_cell_to_dof_vector(
- dof_handler, smoothness_indicators, smoothness_field);
+ DoFTools::distribute_cell_to_dof_vector(dof_handler,
+ smoothness_indicators,
+ smoothness_field);
Vector<float> fe_indices(triangulation.n_active_cells());
{
ExactSolution<dim> exact_solution;
std::map<types::global_dof_index, double> boundary_values;
- VectorTools::interpolate_boundary_values(
- dof_handler, 0, exact_solution, boundary_values);
+ VectorTools::interpolate_boundary_values(dof_handler,
+ 0,
+ exact_solution,
+ boundary_values);
if (dim == 1)
- VectorTools::interpolate_boundary_values(
- dof_handler, 1, exact_solution, boundary_values);
+ VectorTools::interpolate_boundary_values(dof_handler,
+ 1,
+ exact_solution,
+ boundary_values);
for (std::map<types::global_dof_index, double>::iterator i =
boundary_values.begin();
template <int dim>
- Problem<dim>::Problem() : dof_handler(triangulation)
+ Problem<dim>::Problem()
+ : dof_handler(triangulation)
{
GridGenerator::hyper_cube(triangulation);
for (unsigned int degree = 1; degree <= 7; ++degree)
template <int dim>
QuadraticTimeCircle<dim>::QuadraticTimeCircle(
- const unsigned int n_global_refines) :
- n_global_refines(n_global_refines),
- dof_handler(triangulation)
+ const unsigned int n_global_refines)
+ : n_global_refines(n_global_refines)
+ , dof_handler(triangulation)
{
boundary_manifold = ladutenko_circle(triangulation);
typename Triangulation<dim>::active_cell_iterator cell = triangulation
Triangulation<dim> triangulation;
std::vector<unsigned int> subdivisions(dim, 1U);
subdivisions[0] = 2;
- GridGenerator::subdivided_hyper_rectangle(
- triangulation, subdivisions, Point<dim>(0, 0), Point<dim>(2, 1));
+ GridGenerator::subdivided_hyper_rectangle(triangulation,
+ subdivisions,
+ Point<dim>(0, 0),
+ Point<dim>(2, 1));
hp::FECollection<dim> fe_collection;
fe_collection.push_back(FESystem<dim>(FE_Nothing<dim>(), 1));
Triangulation<dim> triangulation;
std::vector<unsigned int> subdivisions(dim, 1U);
subdivisions[0] = 2;
- GridGenerator::subdivided_hyper_rectangle(
- triangulation, subdivisions, Point<dim>(0, 0), Point<dim>(2, 1));
+ GridGenerator::subdivided_hyper_rectangle(triangulation,
+ subdivisions,
+ Point<dim>(0, 0),
+ Point<dim>(2, 1));
hp::FECollection<dim> fe_collection;
fe_collection.push_back(FESystem<dim>(FE_Q<dim>(1), 1, FE_Nothing<dim>(), 1));
};
template <int dim>
-MixedFECollection<dim>::MixedFECollection() :
- continuous_fe(FE_Q<dim>(1), dim),
- discontinuous_fe(FE_DGQ<dim>(1), dim),
- dof_handler(triangulation)
+MixedFECollection<dim>::MixedFECollection()
+ : continuous_fe(FE_Q<dim>(1), dim)
+ , discontinuous_fe(FE_DGQ<dim>(1), dim)
+ , dof_handler(triangulation)
{}
template <int dim>
Triangulation<dim> triangulation;
std::vector<unsigned int> subdivisions(dim, 1U);
subdivisions[0] = 2;
- GridGenerator::subdivided_hyper_rectangle(
- triangulation, subdivisions, Point<dim>(0, 0), Point<dim>(2, 1));
+ GridGenerator::subdivided_hyper_rectangle(triangulation,
+ subdivisions,
+ Point<dim>(0, 0),
+ Point<dim>(2, 1));
for (unsigned int i = 0; i < 2; ++i)
{
hp::FECollection<dim> fe_collection;
deallog << dof_handler.n_dofs() << " dofs" << std::endl;
std::map<types::global_dof_index, double> bv;
- VectorTools::interpolate_boundary_values(
- dof_handler, 0, Functions::ZeroFunction<dim>(1), bv);
+ VectorTools::interpolate_boundary_values(dof_handler,
+ 0,
+ Functions::ZeroFunction<dim>(1),
+ bv);
for (std::map<types::global_dof_index, double>::iterator p = bv.begin();
p != bv.end();
++p)
deallog << dof_handler.n_dofs() << " dofs" << std::endl;
std::map<types::global_dof_index, double> bv;
- VectorTools::interpolate_boundary_values(
- dof_handler, 0, Functions::ZeroFunction<dim>(2), bv);
+ VectorTools::interpolate_boundary_values(dof_handler,
+ 0,
+ Functions::ZeroFunction<dim>(2),
+ bv);
for (std::map<types::global_dof_index, double>::iterator p = bv.begin();
p != bv.end();
++p)
deallog << dof_handler.n_dofs() << " dofs" << std::endl;
std::map<types::global_dof_index, double> bv;
- VectorTools::interpolate_boundary_values(
- dof_handler, 0, Functions::ZeroFunction<dim>(4), bv);
+ VectorTools::interpolate_boundary_values(dof_handler,
+ 0,
+ Functions::ZeroFunction<dim>(4),
+ bv);
for (std::map<types::global_dof_index, double>::iterator p = bv.begin();
p != bv.end();
++p)
class BoundaryValues : public Function<dim>
{
public:
- BoundaryValues() : Function<dim>(dim)
+ BoundaryValues()
+ : Function<dim>(dim)
{}
virtual void
};
template <int dim>
-ConstrainValues<dim>::ConstrainValues() :
- Function<dim>(dim) /*pass down to the main class the number of components of
- the function*/
+ConstrainValues<dim>::ConstrainValues()
+ : Function<dim>(dim) /*pass down to the main class the number of components of
+ the function*/
{}
template <int dim>
/* constructor*/
template <int dim>
-ElasticProblem<dim>::ElasticProblem() :
- n_blocks(2),
- n_components(dim * n_blocks),
- first_u_comp(0),
- first_lamda_comp(dim),
- degree(1),
- dofs_per_block(n_blocks),
- dof_handler(triangulation), /*assotiate dof_handler to the triangulation */
+ElasticProblem<dim>::ElasticProblem()
+ : n_blocks(2)
+ , n_components(dim * n_blocks)
+ , first_u_comp(0)
+ , first_lamda_comp(dim)
+ , degree(1)
+ , dofs_per_block(n_blocks)
+ , dof_handler(triangulation)
+ , /*assotiate dof_handler to the triangulation */
elasticity_fe(
FE_Q<dim>(degree),
dim, // use dim FE_Q of a given degree to represent displacements
FE_Nothing<dim>(),
dim // zero extension of lagrange multipliers elsewhere in the domain
- ),
- elasticity_w_lagrange_fe(FE_Q<dim>(degree),
- dim,
- FE_Q<dim>(degree),
- dim // same for lagrange multipliers
- ),
- u_fe(first_u_comp),
- lamda_fe(first_lamda_comp),
- id_of_lagrange_mult(1),
- beta1(1.0)
+ )
+ , elasticity_w_lagrange_fe(FE_Q<dim>(degree),
+ dim,
+ FE_Q<dim>(degree),
+ dim // same for lagrange multipliers
+ )
+ , u_fe(first_u_comp)
+ , lamda_fe(first_lamda_comp)
+ , id_of_lagrange_mult(1)
+ , beta1(1.0)
{
fe.push_back(elasticity_fe); // FE index 0
fe.push_back(elasticity_w_lagrange_fe); // FE index 1
{
Triangulation<dim> triangulationL;
Triangulation<dim> triangulationR;
- GridGenerator::hyper_cube(
- triangulationL, -1, 0); // create a square [-1,1]^d domain
- GridGenerator::hyper_cube(
- triangulationR, -1, 0); // create a square [-1,1]^d domain
+ GridGenerator::hyper_cube(triangulationL,
+ -1,
+ 0); // create a square [-1,1]^d domain
+ GridGenerator::hyper_cube(triangulationR,
+ -1,
+ 0); // create a square [-1,1]^d domain
Point<dim> shift_vector;
shift_vector[0] = 1.0;
GridTools::shift(shift_vector, triangulationR);
i);
}
- GridGenerator::merge_triangulations(
- triangulationL, triangulationR, triangulation);
+ GridGenerator::merge_triangulations(triangulationL,
+ triangulationR,
+ triangulation);
// triangulation.refine_global (2); //refine twice globally before solving
}
Vector<double> solution(dof_handler.n_dofs());
- VectorTools::interpolate(
- dof_handler, Functions::ZeroFunction<dim>(2 * dim + 1), solution);
+ VectorTools::interpolate(dof_handler,
+ Functions::ZeroFunction<dim>(2 * dim + 1),
+ solution);
deallog << "l2_norm = " << solution.l2_norm() << std::endl;
}
Vector<double> solution(dof_handler.n_dofs());
- VectorTools::interpolate(
- dof_handler, Functions::ZeroFunction<dim>(2), solution);
+ VectorTools::interpolate(dof_handler,
+ Functions::ZeroFunction<dim>(2),
+ solution);
deallog << "l2_norm = " << solution.l2_norm() << std::endl;
}
Assert(false, ExcNotImplemented());
}
- GridGenerator::subdivided_hyper_rectangle(
- triangulation, subdivisions, p1, p2);
+ GridGenerator::subdivided_hyper_rectangle(triangulation,
+ subdivisions,
+ p1,
+ p2);
// Create FE Collection and insert two FE objects
// (RT0 - DGQ0 - Q1 ^ dim) and (Nothing - Nothing - Q2 ^ dim)
face_coupling[c][d] = DoFTools::always;
}
- DoFTools::make_flux_sparsity_pattern(
- dof_handler, dsp, cell_coupling, face_coupling);
+ DoFTools::make_flux_sparsity_pattern(dof_handler,
+ dsp,
+ cell_coupling,
+ face_coupling);
dsp.compress();
// Print sparsity pattern
Assert(false, ExcNotImplemented());
}
- GridGenerator::subdivided_hyper_rectangle(
- triangulation, subdivisions, p1, p2);
+ GridGenerator::subdivided_hyper_rectangle(triangulation,
+ subdivisions,
+ p1,
+ p2);
// Create FE Collection and insert two FE objects
// DGQ0 and DGQ1
cell_coupling(0, 0) = DoFTools::always;
face_coupling(0, 0) = DoFTools::always;
- DoFTools::make_flux_sparsity_pattern(
- dof_handler, dsp, cell_coupling, face_coupling);
+ DoFTools::make_flux_sparsity_pattern(dof_handler,
+ dsp,
+ cell_coupling,
+ face_coupling);
dsp.compress();
// Print sparsity pattern, we expect that all dofs couple with each other.
cell_coupling(0, 0) = DoFTools::always;
face_coupling(0, 0) = DoFTools::none;
- DoFTools::make_flux_sparsity_pattern(
- dof_handler, dsp, cell_coupling, face_coupling);
+ DoFTools::make_flux_sparsity_pattern(dof_handler,
+ dsp,
+ cell_coupling,
+ face_coupling);
dsp.compress();
// Print sparsity pattern, we expect no couplings across the face.
cell_coupling(0, 0) = DoFTools::none;
face_coupling(0, 0) = DoFTools::always;
- DoFTools::make_flux_sparsity_pattern(
- dof_handler, dsp, cell_coupling, face_coupling);
+ DoFTools::make_flux_sparsity_pattern(dof_handler,
+ dsp,
+ cell_coupling,
+ face_coupling);
dsp.compress();
// Print sparsity pattern, we expect that all dofs couple with each other.
cell_coupling(0, 0) = DoFTools::none;
face_coupling(0, 0) = DoFTools::none;
- DoFTools::make_flux_sparsity_pattern(
- dof_handler, dsp, cell_coupling, face_coupling);
+ DoFTools::make_flux_sparsity_pattern(dof_handler,
+ dsp,
+ cell_coupling,
+ face_coupling);
dsp.compress();
// Print sparsity pattern, we expect no couplings.
// then do the same with the "correct", local fe_index
Vector<double> local2(cell->get_fe().dofs_per_cell);
- cell->get_interpolated_dof_values(
- solution, local2, cell->active_fe_index());
+ cell->get_interpolated_dof_values(solution,
+ local2,
+ cell->active_fe_index());
// and do it a third time with the fe_index for a Q1 element
Vector<double> local3(fe[0].dofs_per_cell);
VectorTools::interpolate(dof_handler, test_function, interpolant_1);
// then compute the interpolation error
- VectorTools::integrate_difference(
- dof_handler,
- interpolant_1,
- test_function,
- error,
- hp::QCollection<dim>(QGauss<dim>(min_degree + 2)),
- VectorTools::L2_norm);
+ VectorTools::integrate_difference(dof_handler,
+ interpolant_1,
+ test_function,
+ error,
+ hp::QCollection<dim>(
+ QGauss<dim>(min_degree + 2)),
+ VectorTools::L2_norm);
Assert(error.l2_norm() < 1e-12 * interpolant_1.l2_norm(),
ExcInternalError());
deallog << " Relative interpolation error before constraints: "
interpolant_1);
// then compute the interpolation error
- VectorTools::integrate_difference(
- dof_handler,
- interpolant_1,
- test_function,
- error,
- hp::QCollection<dim>(QGauss<dim>(min_degree)),
- VectorTools::L2_norm);
+ VectorTools::integrate_difference(dof_handler,
+ interpolant_1,
+ test_function,
+ error,
+ hp::QCollection<dim>(
+ QGauss<dim>(min_degree)),
+ VectorTools::L2_norm);
Assert(error.l2_norm() < 1e-12 * interpolant_1.l2_norm(),
ExcInternalError());
deallog << " Relative interpolation error before constraints: "
p2[0] = 1.0;
std::vector<unsigned int> repetitoins(dim, 1);
repetitoins[0] = 2;
- GridGenerator::subdivided_hyper_rectangle(
- triangulation, repetitoins, p1, p2);
+ GridGenerator::subdivided_hyper_rectangle(triangulation,
+ repetitoins,
+ p1,
+ p2);
}
hp::DoFHandler<dim> dof_handler(triangulation);
p1[0] = -1.0;
std::vector<unsigned int> repetitoins(dim, 1);
repetitoins[0] = 2;
- GridGenerator::subdivided_hyper_rectangle(
- triangulation, repetitoins, p1, p2);
+ GridGenerator::subdivided_hyper_rectangle(triangulation,
+ repetitoins,
+ p1,
+ p2);
}
hp::DoFHandler<dim> dof_handler(triangulation);
}
// sort
- std::sort(
- pairs_point_value.begin(), pairs_point_value.end(), less_than_key<dim>());
+ std::sort(pairs_point_value.begin(),
+ pairs_point_value.end(),
+ less_than_key<dim>());
for (unsigned int p = 0; p < pairs_point_value.size(); p++)
{
const Point<dim> & pt = pairs_point_value[p].first;
{
Triangulation<dim> triangulationL;
Triangulation<dim> triangulationR;
- GridGenerator::hyper_cube(
- triangulationL, -1, 0); // create a square [-1,0]^d domain
- GridGenerator::hyper_cube(
- triangulationR, -1, 0); // create a square [-1,0]^d domain
+ GridGenerator::hyper_cube(triangulationL,
+ -1,
+ 0); // create a square [-1,0]^d domain
+ GridGenerator::hyper_cube(triangulationR,
+ -1,
+ 0); // create a square [-1,0]^d domain
Point<dim> shift_vector;
shift_vector[0] = 1.0;
GridTools::shift(shift_vector, triangulationR);
- GridGenerator::merge_triangulations(
- triangulationL, triangulationR, triangulation);
+ GridGenerator::merge_triangulations(triangulationL,
+ triangulationR,
+ triangulation);
}
hp::FECollection<dim> fe;
// interpolate a linear function
Vector<double> vec(dof_handler.n_dofs());
- VectorTools::interpolate(
- dof_handler,
- Functions::Monomial<dim>(
- dim == 1 ? Point<dim>(1.) :
- (dim == 2 ? Point<dim>(1., 0.) : Point<dim>(1., 0., 0.))),
- vec);
+ VectorTools::interpolate(dof_handler,
+ Functions::Monomial<dim>(
+ dim == 1 ? Point<dim>(1.) :
+ (dim == 2 ? Point<dim>(1., 0.) :
+ Point<dim>(1., 0., 0.))),
+ vec);
Vector<float> diff(tria.n_active_cells());
// interpolate a linear function
Vector<double> vec(dof_handler.n_dofs());
- VectorTools::interpolate(
- dof_handler,
- VectorFunctionFromScalarFunctionObject<dim>(&f<dim>, 0, dim),
- vec);
+ VectorTools::interpolate(dof_handler,
+ VectorFunctionFromScalarFunctionObject<dim>(&f<dim>,
+ 0,
+ dim),
+ vec);
Vector<float> diff(tria.n_active_cells());
class F : public Function<dim>
{
public:
- F(const unsigned int q) : q(q)
+ F(const unsigned int q)
+ : q(q)
{}
virtual double
VectorTools::interpolate(dof_handler, F<dim>(q), interpolant);
// then compute the interpolation error
- VectorTools::integrate_difference(
- dof_handler,
- interpolant,
- F<dim>(q),
- error,
- hp::QCollection<dim>(QGauss<dim>(q + 2)),
- VectorTools::L2_norm);
+ VectorTools::integrate_difference(dof_handler,
+ interpolant,
+ F<dim>(q),
+ error,
+ hp::QCollection<dim>(
+ QGauss<dim>(q + 2)),
+ VectorTools::L2_norm);
if (q <= p)
AssertThrow(error.l2_norm() < 1e-12 * interpolant.l2_norm(),
ExcInternalError());
class F : public Function<dim>
{
public:
- F(const unsigned int q) : q(q)
+ F(const unsigned int q)
+ : q(q)
{}
virtual double
constraints.distribute(interpolant);
// then compute the interpolation error
- VectorTools::integrate_difference(
- dof_handler,
- interpolant,
- F<dim>(q),
- error,
- hp::QCollection<dim>(QGauss<dim>(q + 2)),
- VectorTools::L2_norm);
+ VectorTools::integrate_difference(dof_handler,
+ interpolant,
+ F<dim>(q),
+ error,
+ hp::QCollection<dim>(
+ QGauss<dim>(q + 2)),
+ VectorTools::L2_norm);
if (q <= p)
AssertThrow(error.l2_norm() < 1e-12 * interpolant.l2_norm(),
ExcInternalError());
Vector<float> error(triangulation.n_active_cells());
// interpolate the function
- VectorTools::interpolate(
- dof_handler,
- Functions::ZeroFunction<dim>(hp_fe[0].n_components()),
- interpolant);
+ VectorTools::interpolate(dof_handler,
+ Functions::ZeroFunction<dim>(
+ hp_fe[0].n_components()),
+ interpolant);
deallog << interpolant.l2_norm() << std::endl;
}
// Constructor
template <int dim>
diffusionMechanics<dim>::diffusionMechanics(const unsigned int mech_degree,
- const unsigned int diff_degree) :
- mech_degree(mech_degree),
- diff_degree(diff_degree),
- omega1_fe(FE_Q<dim>(mech_degree), dim, FE_Q<dim>(diff_degree), 1),
- omega2_fe(FE_Q<dim>(mech_degree), dim, FE_Nothing<dim>(), 1),
- dof_handler(triangulation),
- quadrature_formula(3),
- face_quadrature_formula(2)
+ const unsigned int diff_degree)
+ : mech_degree(mech_degree)
+ , diff_degree(diff_degree)
+ , omega1_fe(FE_Q<dim>(mech_degree), dim, FE_Q<dim>(diff_degree), 1)
+ , omega2_fe(FE_Q<dim>(mech_degree), dim, FE_Nothing<dim>(), 1)
+ , dof_handler(triangulation)
+ , quadrature_formula(3)
+ , face_quadrature_formula(2)
{
// Nodal Solution names
for (unsigned int i = 0; i < dim; ++i)
class InitialConditions : public Function<dim>
{
public:
- InitialConditions() : Function<dim>(totalDOF)
+ InitialConditions()
+ : Function<dim>(totalDOF)
{}
void
vector_value(const Point<dim> &p, Vector<double> &values) const
Vector<double> interpolant(dof_handler.n_dofs());
// interpolate the function
- VectorTools::interpolate(
- dof_handler, Functions::ConstantFunction<dim>(3.14), interpolant);
+ VectorTools::interpolate(dof_handler,
+ Functions::ConstantFunction<dim>(3.14),
+ interpolant);
deallog << interpolant.mean_value() << std::endl;
}
class F : public Function<dim>
{
public:
- F(const unsigned int q) : q(q)
+ F(const unsigned int q)
+ : q(q)
{}
virtual double
VectorTools::interpolate(dof_handler, F<dim>(q), interpolant);
// then compute the interpolation error
- VectorTools::integrate_difference(
- dof_handler,
- interpolant,
- F<dim>(q),
- error,
- hp::QCollection<dim>(QGauss<dim>(q + 2)),
- VectorTools::L2_norm);
+ VectorTools::integrate_difference(dof_handler,
+ interpolant,
+ F<dim>(q),
+ error,
+ hp::QCollection<dim>(
+ QGauss<dim>(q + 2)),
+ VectorTools::L2_norm);
if (q <= p)
AssertThrow(error.l2_norm() < 1e-12 * interpolant.l2_norm(),
ExcInternalError());
class F : public Function<dim>
{
public:
- F(const unsigned int q) : q(q)
+ F(const unsigned int q)
+ : q(q)
{}
virtual double
constraints.distribute(interpolant);
// then compute the interpolation error
- VectorTools::integrate_difference(
- dof_handler,
- interpolant,
- F<dim>(q),
- error,
- hp::QCollection<dim>(QGauss<dim>(q + 2)),
- VectorTools::L2_norm);
+ VectorTools::integrate_difference(dof_handler,
+ interpolant,
+ F<dim>(q),
+ error,
+ hp::QCollection<dim>(
+ QGauss<dim>(q + 2)),
+ VectorTools::L2_norm);
if (q <= p)
AssertThrow(error.l2_norm() < 1e-12 * interpolant.l2_norm(),
ExcInternalError());
class F : public Function<dim>
{
public:
- F(const unsigned int q) : Function<dim>(3), q(q)
+ F(const unsigned int q)
+ : Function<dim>(3)
+ , q(q)
{}
virtual void
VectorTools::interpolate(dof_handler, F<dim>(q), interpolant);
// then compute the interpolation error
- VectorTools::integrate_difference(
- dof_handler,
- interpolant,
- F<dim>(q),
- error,
- hp::QCollection<dim>(QGauss<dim>(q + 2)),
- VectorTools::L2_norm);
+ VectorTools::integrate_difference(dof_handler,
+ interpolant,
+ F<dim>(q),
+ error,
+ hp::QCollection<dim>(
+ QGauss<dim>(q + 2)),
+ VectorTools::L2_norm);
if (q <= p)
Assert(error.l2_norm() < 1e-12 * interpolant.l2_norm(),
ExcInternalError());
class F : public Function<dim>
{
public:
- F(const unsigned int q) : Function<dim>(3), q(q)
+ F(const unsigned int q)
+ : Function<dim>(3)
+ , q(q)
{}
virtual void
constraints.distribute(interpolant);
// then compute the interpolation error
- VectorTools::integrate_difference(
- dof_handler,
- interpolant,
- F<dim>(q),
- error,
- hp::QCollection<dim>(QGauss<dim>(q + 2)),
- VectorTools::L2_norm);
+ VectorTools::integrate_difference(dof_handler,
+ interpolant,
+ F<dim>(q),
+ error,
+ hp::QCollection<dim>(
+ QGauss<dim>(q + 2)),
+ VectorTools::L2_norm);
if (q <= p)
Assert(error.l2_norm() < 1e-12 * interpolant.l2_norm(),
ExcInternalError());
class MySquareFunction : public Function<dim>
{
public:
- MySquareFunction() : Function<dim>(2)
+ MySquareFunction()
+ : Function<dim>(2)
{}
virtual double
SparsityPattern sparsity(dof.n_boundary_dofs(function_map),
dof.max_couplings_between_boundary_dofs());
- DoFTools::make_boundary_sparsity_pattern(
- dof, function_map, dof_to_boundary_mapping, sparsity);
+ DoFTools::make_boundary_sparsity_pattern(dof,
+ function_map,
+ dof_to_boundary_mapping,
+ sparsity);
sparsity.compress();
SparseMatrix<double> matrix;
class MySquareFunction : public Function<dim>
{
public:
- MySquareFunction() : Function<dim>(2)
+ MySquareFunction()
+ : Function<dim>(2)
{}
virtual double
SparsityPattern sparsity(dof.n_boundary_dofs(function_map),
dof.max_couplings_between_boundary_dofs());
- DoFTools::make_boundary_sparsity_pattern(
- dof, function_map, dof_to_boundary_mapping, sparsity);
+ DoFTools::make_boundary_sparsity_pattern(dof,
+ function_map,
+ dof_to_boundary_mapping,
+ sparsity);
sparsity.compress();
SparseMatrix<double> matrix;
GridGenerator::hyper_cube(triangulation_2, 2, 3);
Triangulation<1, spacedim> triangulation;
- GridGenerator::merge_triangulations(
- triangulation_1, triangulation_2, triangulation);
+ GridGenerator::merge_triangulations(triangulation_1,
+ triangulation_2,
+ triangulation);
hp::FECollection<1, spacedim> fe;
GridGenerator::hyper_cube(triangulation_2, 2, 3);
Triangulation<1, spacedim> triangulation;
- GridGenerator::merge_triangulations(
- triangulation_1, triangulation_2, triangulation);
+ GridGenerator::merge_triangulations(triangulation_1,
+ triangulation_2,
+ triangulation);
// assign boundary ids
triangulation.begin()->face(0)->set_boundary_id(12);
// somewhat small. it won't
// be zero since we project
// and do not interpolate
- Assert(
- std::fabs(v(cell->vertex_dof_index(i, 0, cell->active_fe_index())) -
- F<dim>().value(cell->vertex(i))) < 1e-4,
- ExcInternalError());
+ Assert(std::fabs(
+ v(cell->vertex_dof_index(i, 0, cell->active_fe_index())) -
+ F<dim>().value(cell->vertex(i))) < 1e-4,
+ ExcInternalError());
deallog << cell->vertex(i) << ' '
<< v(cell->vertex_dof_index(i, 0, cell->active_fe_index()))
<< std::endl;
// somewhat small. it won't
// be zero since we project
// and do not interpolate
- Assert(
- std::fabs(v(cell->vertex_dof_index(i, 0, cell->active_fe_index())) -
- F<dim>().value(cell->vertex(i))) < 1e-4,
- ExcInternalError());
+ Assert(std::fabs(
+ v(cell->vertex_dof_index(i, 0, cell->active_fe_index())) -
+ F<dim>().value(cell->vertex(i))) < 1e-4,
+ ExcInternalError());
deallog << cell->vertex(i) << ' '
<< v(cell->vertex_dof_index(i, 0, cell->active_fe_index()))
<< std::endl;
};
template <int dim>
- MixedFECollection<dim>::MixedFECollection() : dof_handler(triangulation)
+ MixedFECollection<dim>::MixedFECollection()
+ : dof_handler(triangulation)
{}
template <int dim>
Triangulation<dim> tr;
std::vector<unsigned int> sub(3, 1U);
sub[0] = 2;
- GridGenerator::subdivided_hyper_rectangle(
- tr, sub, Point<dim>(), Point<dim>(2, 1, 1));
+ GridGenerator::subdivided_hyper_rectangle(tr,
+ sub,
+ Point<dim>(),
+ Point<dim>(2, 1, 1));
hp::FECollection<dim> fe_collection;
fe_collection.push_back(FE_Q<dim>(2));
cell->set_dof_values_by_interpolation(local, solution1);
// then do the same with the "correct", local fe_index
- cell->set_dof_values_by_interpolation(
- local, solution2, cell->active_fe_index());
+ cell->set_dof_values_by_interpolation(local,
+ solution2,
+ cell->active_fe_index());
// now verify correctness
AssertThrow(solution1 == solution2, ExcInternalError());
class MyFunction : public Function<dim>
{
public:
- MyFunction() : Function<dim>(){};
+ MyFunction()
+ : Function<dim>(){};
virtual double
value(const Point<dim> &p, const unsigned int) const
// on points of QGauss of order 2.
MyFunction<dim> func;
{
- double error = 0;
- const hp::QCollection<dim> quad(QGauss<dim>(2));
- hp::FEValues<dim> hp_fe_val(
- fe_q, quad, update_values | update_quadrature_points);
+ double error = 0;
+ const hp::QCollection<dim> quad(QGauss<dim>(2));
+ hp::FEValues<dim> hp_fe_val(fe_q,
+ quad,
+ update_values | update_quadrature_points);
std::vector<double> vals(quad[0].size());
typename hp::DoFHandler<dim>::active_cell_iterator cell = q_dof_handler
.begin_active(),
{
double error = 0;
const hp::QCollection<dim> quad(QGauss<dim>(2));
- hp::FEValues<dim> hp_fe_val(
- fe_dgq, quad, update_values | update_quadrature_points);
- std::vector<double> vals(quad[0].size());
+ hp::FEValues<dim> hp_fe_val(fe_dgq,
+ quad,
+ update_values | update_quadrature_points);
+ std::vector<double> vals(quad[0].size());
typename hp::DoFHandler<dim>::active_cell_iterator
celldg = dgq_dof_handler.begin_active(),
endc = dgq_dof_handler.end();
class MyFunction : public Function<dim>
{
public:
- MyFunction() : Function<dim>(){};
+ MyFunction()
+ : Function<dim>(){};
virtual double
value(const Point<dim> &p, const unsigned int) const
hp::QCollection<dim> quad;
quad.push_back(QTrapez<dim>());
- hp::FEValues<dim> hp_fe_val(
- fe_q, quad, update_values | update_quadrature_points);
+ hp::FEValues<dim> hp_fe_val(fe_q,
+ quad,
+ update_values | update_quadrature_points);
std::vector<types::global_dof_index> local_dof_indices;
typename hp::DoFHandler<dim>::active_cell_iterator cell = q_dof_handler
.begin_active(),
// check correctness by comparing the values
// on points of QGauss of order 2.
{
- double error = 0;
- const hp::QCollection<dim> quad(QGauss<dim>(2));
- hp::FEValues<dim> hp_fe_val(
- fe_q, quad, update_values | update_quadrature_points);
+ double error = 0;
+ const hp::QCollection<dim> quad(QGauss<dim>(2));
+ hp::FEValues<dim> hp_fe_val(fe_q,
+ quad,
+ update_values | update_quadrature_points);
std::vector<double> vals(quad[0].size());
typename hp::DoFHandler<dim>::active_cell_iterator cell = q_dof_handler
.begin_active(),
GridOutFlags::Gnuplot gnuplot_flags(false, 30);
grid_out.set_flags(gnuplot_flags);
- grid_out.write_gnuplot(
- triangulation, deallog.get_file_stream(), &mapping);
+ grid_out.write_gnuplot(triangulation,
+ deallog.get_file_stream(),
+ &mapping);
}
deallog << std::endl;
}
hp::DoFHandler<dim> dof_handler(triangulation);
- hp::FEValues<dim> x_fe_values(
- mapping, dummy_fe, quadrature, update_JxW_values);
+ hp::FEValues<dim> x_fe_values(mapping,
+ dummy_fe,
+ quadrature,
+ update_JxW_values);
ConvergenceTable table;
hp::DoFHandler<dim> dof_handler(triangulation);
- hp::FEFaceValues<dim> x_fe_face_values(
- mapping, fe, quadrature, update_JxW_values);
- ConvergenceTable table;
+ hp::FEFaceValues<dim> x_fe_face_values(mapping,
+ fe,
+ quadrature,
+ update_JxW_values);
+ ConvergenceTable table;
for (unsigned int refinement = 0; refinement < (degree != 4 ? 6 : 4);
++refinement, triangulation.refine_global(1))
template <int dim>
-LaplaceProblem<dim>::LaplaceProblem(const unsigned int mapping_degree) :
- fe(FE_Q<dim>(1)),
- dof_handler(triangulation),
- mapping(MappingQ<dim>(mapping_degree))
+LaplaceProblem<dim>::LaplaceProblem(const unsigned int mapping_degree)
+ : fe(FE_Q<dim>(1))
+ , dof_handler(triangulation)
+ , mapping(MappingQ<dim>(mapping_degree))
{
deallog << "Using mapping with degree " << mapping_degree << ":" << std::endl
<< "============================" << std::endl;
system_rhs.reinit(dof_handler.n_dofs());
std::vector<bool> boundary_dofs(dof_handler.n_dofs(), false);
- DoFTools::extract_boundary_dofs(
- dof_handler, std::vector<bool>(1, true), boundary_dofs);
+ DoFTools::extract_boundary_dofs(dof_handler,
+ std::vector<bool>(1, true),
+ boundary_dofs);
const unsigned int first_boundary_dof =
std::distance(boundary_dofs.begin(),
1. * (static_cast<const MappingQ<dim> &>(mapping[0]).get_degree() + 1) /
2)),
2U);
- MatrixTools::create_laplace_matrix(
- mapping,
- dof_handler,
- hp::QCollection<dim>(QGauss<dim>(gauss_degree)),
- system_matrix);
- VectorTools::create_right_hand_side(
- mapping,
- dof_handler,
- hp::QCollection<dim>(QGauss<dim>(gauss_degree)),
- Functions::ConstantFunction<dim>(-2),
- system_rhs);
+ MatrixTools::create_laplace_matrix(mapping,
+ dof_handler,
+ hp::QCollection<dim>(
+ QGauss<dim>(gauss_degree)),
+ system_matrix);
+ VectorTools::create_right_hand_side(mapping,
+ dof_handler,
+ hp::QCollection<dim>(
+ QGauss<dim>(gauss_degree)),
+ Functions::ConstantFunction<dim>(-2),
+ system_rhs);
Vector<double> tmp(system_rhs.size());
VectorTools::create_boundary_right_hand_side(
mapping,
mean_value_constraints.distribute(solution);
Vector<float> norm_per_cell(triangulation.n_active_cells());
- VectorTools::integrate_difference(
- mapping,
- dof_handler,
- solution,
- Functions::ZeroFunction<dim>(),
- norm_per_cell,
- hp::QCollection<dim>(QGauss<dim>(gauss_degree + 1)),
- VectorTools::H1_seminorm);
+ VectorTools::integrate_difference(mapping,
+ dof_handler,
+ solution,
+ Functions::ZeroFunction<dim>(),
+ norm_per_cell,
+ hp::QCollection<dim>(
+ QGauss<dim>(gauss_degree + 1)),
+ VectorTools::H1_seminorm);
const double norm = norm_per_cell.l2_norm();
output_table.add_value("cells", triangulation.n_active_cells());
template <int dim>
-DGTransportEquation<dim>::DGTransportEquation() :
- beta_function(),
- rhs_function(),
- boundary_function()
+DGTransportEquation<dim>::DGTransportEquation()
+ : beta_function()
+ , rhs_function()
+ , boundary_function()
{}
template <int dim>
-DGMethod<dim>::DGMethod() :
- mapping(MappingQGeneric<dim>(1)),
- fe(FE_DGQ<dim>(1)),
- dof_handler(triangulation),
- quadrature(QGauss<dim>(4)),
- face_quadrature(QGauss<dim - 1>(4)),
- dg()
+DGMethod<dim>::DGMethod()
+ : mapping(MappingQGeneric<dim>(1))
+ , fe(FE_DGQ<dim>(1))
+ , dof_handler(triangulation)
+ , quadrature(QGauss<dim>(4))
+ , face_quadrature(QGauss<dim - 1>(4))
+ , dg()
{}
hp::FEValues<dim> fe_v(mapping, fe, quadrature, update_flags);
- hp::FEFaceValues<dim> fe_v_face(
- mapping, fe, face_quadrature, face_update_flags);
- hp::FESubfaceValues<dim> fe_v_subface(
- mapping, fe, face_quadrature, face_update_flags);
- hp::FEFaceValues<dim> fe_v_face_neighbor(
- mapping, fe, face_quadrature, neighbor_face_update_flags);
- hp::FESubfaceValues<dim> fe_v_subface_neighbor(
- mapping, fe, face_quadrature, neighbor_face_update_flags);
+ hp::FEFaceValues<dim> fe_v_face(mapping,
+ fe,
+ face_quadrature,
+ face_update_flags);
+ hp::FESubfaceValues<dim> fe_v_subface(mapping,
+ fe,
+ face_quadrature,
+ face_update_flags);
+ hp::FEFaceValues<dim> fe_v_face_neighbor(mapping,
+ fe,
+ face_quadrature,
+ neighbor_face_update_flags);
+ hp::FESubfaceValues<dim> fe_v_subface_neighbor(mapping,
+ fe,
+ face_quadrature,
+ neighbor_face_update_flags);
FullMatrix<double> ui_vi_matrix(dofs_per_cell, dofs_per_cell);
FullMatrix<double> ue_vi_matrix(dofs_per_cell, dofs_per_cell);
for (unsigned int i = 0; i < dofs_per_cell; ++i)
for (unsigned int k = 0; k < dofs_per_cell; ++k)
- system_matrix.add(
- dofs[i], dofs_neighbor[k], ue_vi_matrix(i, k));
+ system_matrix.add(dofs[i],
+ dofs_neighbor[k],
+ ue_vi_matrix(i, k));
}
}
else
ExcInternalError());
fe_v_face.reinit(cell, face_no);
- fe_v_subface_neighbor.reinit(
- neighbor, neighbor_face_no, neighbor_subface_no);
+ fe_v_subface_neighbor.reinit(neighbor,
+ neighbor_face_no,
+ neighbor_subface_no);
dg.assemble_face_term1(fe_v_face,
fe_v_subface_neighbor,
for (unsigned int i = 0; i < dofs_per_cell; ++i)
for (unsigned int k = 0; k < dofs_per_cell; ++k)
- system_matrix.add(
- dofs[i], dofs_neighbor[k], ue_vi_matrix(i, k));
+ system_matrix.add(dofs[i],
+ dofs_neighbor[k],
+ ue_vi_matrix(i, k));
}
}
}
const UpdateFlags neighbor_face_update_flags = update_values;
- hp::FEValues<dim> fe_v(mapping, fe, quadrature, update_flags);
- hp::FEFaceValues<dim> fe_v_face(
- mapping, fe, face_quadrature, face_update_flags);
- hp::FESubfaceValues<dim> fe_v_subface(
- mapping, fe, face_quadrature, face_update_flags);
- hp::FEFaceValues<dim> fe_v_face_neighbor(
- mapping, fe, face_quadrature, neighbor_face_update_flags);
+ hp::FEValues<dim> fe_v(mapping, fe, quadrature, update_flags);
+ hp::FEFaceValues<dim> fe_v_face(mapping,
+ fe,
+ face_quadrature,
+ face_update_flags);
+ hp::FESubfaceValues<dim> fe_v_subface(mapping,
+ fe,
+ face_quadrature,
+ face_update_flags);
+ hp::FEFaceValues<dim> fe_v_face_neighbor(mapping,
+ fe,
+ face_quadrature,
+ neighbor_face_update_flags);
FullMatrix<double> ui_vi_matrix(dofs_per_cell, dofs_per_cell);
for (unsigned int i = 0; i < dofs_per_cell; ++i)
for (unsigned int j = 0; j < dofs_per_cell; ++j)
{
- system_matrix.add(
- dofs[i], dofs_neighbor[j], ue_vi_matrix(i, j));
- system_matrix.add(
- dofs_neighbor[i], dofs[j], ui_ve_matrix(i, j));
+ system_matrix.add(dofs[i],
+ dofs_neighbor[j],
+ ue_vi_matrix(i, j));
+ system_matrix.add(dofs_neighbor[i],
+ dofs[j],
+ ui_ve_matrix(i, j));
system_matrix.add(dofs_neighbor[i],
dofs_neighbor[j],
ue_ve_matrix(i, j));
for (unsigned int i = 0; i < dofs_per_cell; ++i)
for (unsigned int j = 0; j < dofs_per_cell; ++j)
{
- system_matrix.add(
- dofs[i], dofs_neighbor[j], ue_vi_matrix(i, j));
- system_matrix.add(
- dofs_neighbor[i], dofs[j], ui_ve_matrix(i, j));
+ system_matrix.add(dofs[i],
+ dofs_neighbor[j],
+ ue_vi_matrix(i, j));
+ system_matrix.add(dofs_neighbor[i],
+ dofs[j],
+ ui_ve_matrix(i, j));
system_matrix.add(dofs_neighbor[i],
dofs_neighbor[j],
ue_ve_matrix(i, j));
{
Vector<float> gradient_indicator(triangulation.n_active_cells());
- DerivativeApproximation::approximate_gradient(
- mapping[0], dof_handler, solution2, gradient_indicator);
+ DerivativeApproximation::approximate_gradient(mapping[0],
+ dof_handler,
+ solution2,
+ gradient_indicator);
typename hp::DoFHandler<dim>::active_cell_iterator cell = dof_handler
.begin_active(),
gradient_indicator(cell_no) *=
std::pow(cell->diameter(), 1 + 1.0 * dim / 2);
- GridRefinement::refine_and_coarsen_fixed_number(
- triangulation, gradient_indicator, 0.3, 0.1);
+ GridRefinement::refine_and_coarsen_fixed_number(triangulation,
+ gradient_indicator,
+ 0.3,
+ 0.1);
triangulation.execute_coarsening_and_refinement();
}
template <int dim>
PointValueEvaluation<dim>::PointValueEvaluation(
const Point<dim> &evaluation_point,
- TableHandler & results_table) :
- evaluation_point(evaluation_point),
- results_table(results_table)
+ TableHandler & results_table)
+ : evaluation_point(evaluation_point)
+ , results_table(results_table)
{}
template <int dim>
SolutionOutput<dim>::SolutionOutput(
const std::string & output_name_base,
- const DataOutBase::OutputFormat output_format) :
- output_name_base(output_name_base),
- output_format(output_format)
+ const DataOutBase::OutputFormat output_format)
+ : output_name_base(output_name_base)
+ , output_format(output_format)
{}
template <int dim>
- Base<dim>::Base(Triangulation<dim> &coarse_grid) : triangulation(&coarse_grid)
+ Base<dim>::Base(Triangulation<dim> &coarse_grid)
+ : triangulation(&coarse_grid)
{}
Solver<dim>::Solver(Triangulation<dim> & triangulation,
const hp::FECollection<dim> &fe,
const hp::QCollection<dim> & quadrature,
- const Function<dim> & boundary_values) :
- Base<dim>(triangulation),
- fe(&fe),
- quadrature(&quadrature),
- dof_handler(triangulation),
- boundary_values(&boundary_values)
+ const Function<dim> & boundary_values)
+ : Base<dim>(triangulation)
+ , fe(&fe)
+ , quadrature(&quadrature)
+ , dof_handler(triangulation)
+ , boundary_values(&boundary_values)
{}
const unsigned int n_threads = MultithreadInfo::n_threads();
std::vector<std::pair<active_cell_iterator, active_cell_iterator>>
- thread_ranges = Threads::split_range<active_cell_iterator>(
- dof_handler.begin_active(), dof_handler.end(), n_threads);
+ thread_ranges =
+ Threads::split_range<active_cell_iterator>(dof_handler.begin_active(),
+ dof_handler.end(),
+ n_threads);
Threads::Mutex mutex;
Threads::ThreadGroup<> threads;
linear_system.hanging_node_constraints.condense(linear_system.rhs);
std::map<types::global_dof_index, double> boundary_value_map;
- VectorTools::interpolate_boundary_values(
- dof_handler, 0, *boundary_values, boundary_value_map);
+ VectorTools::interpolate_boundary_values(dof_handler,
+ 0,
+ *boundary_values,
+ boundary_value_map);
threads.join_all();
linear_system.hanging_node_constraints.condense(linear_system.matrix);
- MatrixTools::apply_boundary_values(
- boundary_value_map, linear_system.matrix, solution, linear_system.rhs);
+ MatrixTools::apply_boundary_values(boundary_value_map,
+ linear_system.matrix,
+ solution,
+ linear_system.rhs);
}
const typename hp::DoFHandler<dim>::active_cell_iterator &end_cell,
Threads::Mutex & mutex) const
{
- hp::FEValues<dim> fe_values(
- *fe, *quadrature, update_gradients | update_JxW_values);
+ hp::FEValues<dim> fe_values(*fe,
+ *quadrature,
+ update_gradients | update_JxW_values);
const unsigned int dofs_per_cell = (*fe)[0].dofs_per_cell;
const unsigned int n_q_points = (*quadrature)[0].size();
Threads::Mutex::ScopedLock lock(mutex);
for (unsigned int i = 0; i < dofs_per_cell; ++i)
for (unsigned int j = 0; j < dofs_per_cell; ++j)
- linear_system.matrix.add(
- local_dof_indices[i], local_dof_indices[j], cell_matrix(i, j));
+ linear_system.matrix.add(local_dof_indices[i],
+ local_dof_indices[j],
+ cell_matrix(i, j));
};
}
const hp::FECollection<dim> &fe,
const hp::QCollection<dim> & quadrature,
const Function<dim> & rhs_function,
- const Function<dim> &boundary_values) :
- Base<dim>(triangulation),
- Solver<dim>(triangulation, fe, quadrature, boundary_values),
- rhs_function(&rhs_function)
+ const Function<dim> & boundary_values)
+ : Base<dim>(triangulation)
+ , Solver<dim>(triangulation, fe, quadrature, boundary_values)
+ , rhs_function(&rhs_function)
{}
const hp::FECollection<dim> &fe,
const hp::QCollection<dim> & quadrature,
const Function<dim> & rhs_function,
- const Function<dim> & boundary_values) :
- Base<dim>(coarse_grid),
- PrimalSolver<dim>(coarse_grid,
- fe,
- quadrature,
- rhs_function,
- boundary_values)
+ const Function<dim> & boundary_values)
+ : Base<dim>(coarse_grid)
+ , PrimalSolver<dim>(coarse_grid,
+ fe,
+ quadrature,
+ rhs_function,
+ boundary_values)
{}
const hp::FECollection<dim> &fe,
const hp::QCollection<dim> & quadrature,
const Function<dim> &rhs_function,
- const Function<dim> &boundary_values) :
- Base<dim>(coarse_grid),
- PrimalSolver<dim>(coarse_grid,
- fe,
- quadrature,
- rhs_function,
- boundary_values)
+ const Function<dim> &boundary_values)
+ : Base<dim>(coarse_grid)
+ , PrimalSolver<dim>(coarse_grid,
+ fe,
+ quadrature,
+ rhs_function,
+ boundary_values)
{}
typename FunctionMap<dim>::type(),
this->solution,
estimated_error_per_cell);
- GridRefinement::refine_and_coarsen_fixed_number(
- *this->triangulation, estimated_error_per_cell, 0.3, 0.03);
+ GridRefinement::refine_and_coarsen_fixed_number(*this->triangulation,
+ estimated_error_per_cell,
+ 0.3,
+ 0.03);
this->triangulation->execute_coarsening_and_refinement();
}
class Solution : public Function<dim>
{
public:
- Solution() : Function<dim>()
+ Solution()
+ : Function<dim>()
{}
virtual double
class RightHandSide : public Function<dim>
{
public:
- RightHandSide() : Function<dim>()
+ RightHandSide()
+ : Function<dim>()
{}
virtual double
Evaluation::PointValueEvaluation<dim> postprocessor1(Point<dim>(0.5, 0.5),
results_table);
- Evaluation::SolutionOutput<dim> postprocessor2(
- std::string("solution-") + solver_name, DataOutBase::gnuplot);
+ Evaluation::SolutionOutput<dim> postprocessor2(std::string("solution-") +
+ solver_name,
+ DataOutBase::gnuplot);
std::list<Evaluation::EvaluationBase<dim> *> postprocessor_list;
postprocessor_list.push_back(&postprocessor1);
static const hp::FECollection<2> finite_element(FE_Q<2>(1));
dof_handler.distribute_dofs(finite_element);
- SparsityPattern sparsity_pattern(
- dof_handler.n_dofs(), dof_handler.n_dofs(), 20);
+ SparsityPattern sparsity_pattern(dof_handler.n_dofs(),
+ dof_handler.n_dofs(),
+ 20);
DoFTools::make_sparsity_pattern(dof_handler, sparsity_pattern);
sparsity_pattern.compress();
class RightHandSide : public Function<dim>
{
public:
- RightHandSide() : Function<dim>()
+ RightHandSide()
+ : Function<dim>()
{}
virtual double
template <int dim>
- LaplaceProblem<dim>::LaplaceProblem() :
- dof_handler(triangulation),
- max_degree(dim <= 2 ? 7 : 5)
+ LaplaceProblem<dim>::LaplaceProblem()
+ : dof_handler(triangulation)
+ , max_degree(dim <= 2 ? 7 : 5)
{
for (unsigned int degree = 2; degree <= max_degree; ++degree)
{
for (unsigned int i = 0; i < fe_collection.size(); i++)
fourier_q_collection.push_back(quadrature);
- fourier = std::make_shared<FESeries::Fourier<dim>>(
- N, fe_collection, fourier_q_collection);
+ fourier = std::make_shared<FESeries::Fourier<dim>>(N,
+ fe_collection,
+ fourier_q_collection);
resize(fourier_coefficients, N);
}
constraints.clear();
DoFTools::make_hanging_node_constraints(dof_handler, constraints);
- VectorTools::interpolate_boundary_values(
- dof_handler, 0, Functions::ZeroFunction<dim>(), constraints);
+ VectorTools::interpolate_boundary_values(dof_handler,
+ 0,
+ Functions::ZeroFunction<dim>(),
+ constraints);
constraints.close();
DynamicSparsityPattern dsp(dof_handler.n_dofs(), dof_handler.n_dofs());
}
{
- GridRefinement::refine_and_coarsen_fixed_number(
- triangulation, estimated_error_per_cell, 0.3, 0.03);
+ GridRefinement::refine_and_coarsen_fixed_number(triangulation,
+ estimated_error_per_cell,
+ 0.3,
+ 0.03);
float max_smoothness = *std::min_element(smoothness_indicators.begin(),
smoothness_indicators.end()),
local_dof_values.reinit(cell->get_fe().dofs_per_cell);
cell->get_dof_values(solution, local_dof_values);
- fourier->calculate(
- local_dof_values, cell->active_fe_index(), fourier_coefficients);
+ fourier->calculate(local_dof_values,
+ cell->active_fe_index(),
+ fourier_coefficients);
std::pair<std::vector<unsigned int>, std::vector<double>> res =
- FESeries::process_coefficients<dim>(
- fourier_coefficients, predicate_ind<dim>, VectorTools::Linfty_norm);
+ FESeries::process_coefficients<dim>(fourier_coefficients,
+ predicate_ind<dim>,
+ VectorTools::Linfty_norm);
Assert(res.first.size() == res.second.size(), ExcInternalError());
};
-LaplaceProblem::LaplaceProblem() : fe(FE_Q<2>(1)), dof_handler(triangulation)
+LaplaceProblem::LaplaceProblem()
+ : fe(FE_Q<2>(1))
+ , dof_handler(triangulation)
{}
for (unsigned int i = 0; i < dofs_per_cell; ++i)
for (unsigned int j = 0; j < dofs_per_cell; ++j)
- system_matrix.add(
- local_dof_indices[i], local_dof_indices[j], cell_matrix(i, j));
+ system_matrix.add(local_dof_indices[i],
+ local_dof_indices[j],
+ cell_matrix(i, j));
for (unsigned int i = 0; i < dofs_per_cell; ++i)
system_rhs(local_dof_indices[i]) += cell_rhs(i);
std::map<types::global_dof_index, double> boundary_values;
- VectorTools::interpolate_boundary_values(
- dof_handler, 0, Functions::ZeroFunction<2>(), boundary_values);
- MatrixTools::apply_boundary_values(
- boundary_values, system_matrix, solution, system_rhs);
+ VectorTools::interpolate_boundary_values(dof_handler,
+ 0,
+ Functions::ZeroFunction<2>(),
+ boundary_values);
+ MatrixTools::apply_boundary_values(boundary_values,
+ system_matrix,
+ solution,
+ system_rhs);
}
};
-LaplaceProblem::LaplaceProblem() : dof_handler(triangulation)
+LaplaceProblem::LaplaceProblem()
+ : dof_handler(triangulation)
{}
for (unsigned int i = 0; i < dofs_per_cell; ++i)
for (unsigned int j = 0; j < dofs_per_cell; ++j)
- system_matrix.add(
- local_dof_indices[i], local_dof_indices[j], cell_matrix(i, j));
+ system_matrix.add(local_dof_indices[i],
+ local_dof_indices[j],
+ cell_matrix(i, j));
for (unsigned int i = 0; i < dofs_per_cell; ++i)
system_rhs(local_dof_indices[i]) += cell_rhs(i);
hanging_node_constraints.condense(system_rhs);
std::map<types::global_dof_index, double> boundary_values;
- VectorTools::interpolate_boundary_values(
- dof_handler, 0, Functions::ZeroFunction<2>(), boundary_values);
- MatrixTools::apply_boundary_values(
- boundary_values, system_matrix, solution, system_rhs);
+ VectorTools::interpolate_boundary_values(dof_handler,
+ 0,
+ Functions::ZeroFunction<2>(),
+ boundary_values);
+ MatrixTools::apply_boundary_values(boundary_values,
+ system_matrix,
+ solution,
+ system_rhs);
}
};
-LaplaceProblem::LaplaceProblem() : dof_handler(triangulation)
+LaplaceProblem::LaplaceProblem()
+ : dof_handler(triangulation)
{}
for (unsigned int i = 0; i < dofs_per_cell; ++i)
for (unsigned int j = 0; j < dofs_per_cell; ++j)
- system_matrix.add(
- local_dof_indices[i], local_dof_indices[j], cell_matrix(i, j));
+ system_matrix.add(local_dof_indices[i],
+ local_dof_indices[j],
+ cell_matrix(i, j));
for (unsigned int i = 0; i < dofs_per_cell; ++i)
system_rhs(local_dof_indices[i]) += cell_rhs(i);
std::map<types::boundary_id, const Function<2> *> b_v_functions{
{types::boundary_id(0), &zero}};
- VectorTools::interpolate_boundary_values(
- mappings, dof_handler, b_v_functions, boundary_values);
- MatrixTools::apply_boundary_values(
- boundary_values, system_matrix, solution, system_rhs);
+ VectorTools::interpolate_boundary_values(mappings,
+ dof_handler,
+ b_v_functions,
+ boundary_values);
+ MatrixTools::apply_boundary_values(boundary_values,
+ system_matrix,
+ solution,
+ system_rhs);
}
};
-LaplaceProblem::LaplaceProblem() : dof_handler(triangulation)
+LaplaceProblem::LaplaceProblem()
+ : dof_handler(triangulation)
{}
for (unsigned int i = 0; i < dofs_per_cell; ++i)
for (unsigned int j = 0; j < dofs_per_cell; ++j)
- system_matrix.add(
- local_dof_indices[i], local_dof_indices[j], cell_matrix(i, j));
+ system_matrix.add(local_dof_indices[i],
+ local_dof_indices[j],
+ cell_matrix(i, j));
for (unsigned int i = 0; i < dofs_per_cell; ++i)
system_rhs(local_dof_indices[i]) += cell_rhs(i);
hanging_node_constraints.condense(system_rhs);
std::map<types::global_dof_index, double> boundary_values;
- VectorTools::interpolate_boundary_values(
- dof_handler, 0, Functions::ZeroFunction<2>(), boundary_values);
- MatrixTools::apply_boundary_values(
- boundary_values, system_matrix, solution, system_rhs);
+ VectorTools::interpolate_boundary_values(dof_handler,
+ 0,
+ Functions::ZeroFunction<2>(),
+ boundary_values);
+ MatrixTools::apply_boundary_values(boundary_values,
+ system_matrix,
+ solution,
+ system_rhs);
}
};
-LaplaceProblem::LaplaceProblem() : dof_handler(triangulation)
+LaplaceProblem::LaplaceProblem()
+ : dof_handler(triangulation)
{}
for (unsigned int i = 0; i < dofs_per_cell; ++i)
for (unsigned int j = 0; j < dofs_per_cell; ++j)
- system_matrix.add(
- local_dof_indices[i], local_dof_indices[j], cell_matrix(i, j));
+ system_matrix.add(local_dof_indices[i],
+ local_dof_indices[j],
+ cell_matrix(i, j));
for (unsigned int i = 0; i < dofs_per_cell; ++i)
system_rhs(local_dof_indices[i]) += cell_rhs(i);
hanging_node_constraints.condense(system_rhs);
std::map<types::global_dof_index, double> boundary_values;
- VectorTools::interpolate_boundary_values(
- dof_handler, 0, Functions::ZeroFunction<2>(), boundary_values);
- MatrixTools::apply_boundary_values(
- boundary_values, system_matrix, solution, system_rhs);
+ VectorTools::interpolate_boundary_values(dof_handler,
+ 0,
+ Functions::ZeroFunction<2>(),
+ boundary_values);
+ MatrixTools::apply_boundary_values(boundary_values,
+ system_matrix,
+ solution,
+ system_rhs);
}
class RightHandSide : public Function<dim>
{
public:
- RightHandSide() : Function<dim>()
+ RightHandSide()
+ : Function<dim>()
{}
virtual double
class BoundaryValues : public Function<dim>
{
public:
- BoundaryValues() : Function<dim>()
+ BoundaryValues()
+ : Function<dim>()
{}
virtual double
template <int dim>
-LaplaceProblem<dim>::LaplaceProblem() :
- fe(FE_Q<dim>(1)),
- dof_handler(triangulation)
+LaplaceProblem<dim>::LaplaceProblem()
+ : fe(FE_Q<dim>(1))
+ , dof_handler(triangulation)
{}
for (unsigned int i = 0; i < dofs_per_cell; ++i)
{
for (unsigned int j = 0; j < dofs_per_cell; ++j)
- system_matrix.add(
- local_dof_indices[i], local_dof_indices[j], cell_matrix(i, j));
+ system_matrix.add(local_dof_indices[i],
+ local_dof_indices[j],
+ cell_matrix(i, j));
system_rhs(local_dof_indices[i]) += cell_rhs(i);
}
std::map<types::global_dof_index, double> boundary_values;
- VectorTools::interpolate_boundary_values(
- dof_handler, 0, BoundaryValues<dim>(), boundary_values);
- MatrixTools::apply_boundary_values(
- boundary_values, system_matrix, solution, system_rhs);
+ VectorTools::interpolate_boundary_values(dof_handler,
+ 0,
+ BoundaryValues<dim>(),
+ boundary_values);
+ MatrixTools::apply_boundary_values(boundary_values,
+ system_matrix,
+ solution,
+ system_rhs);
}
class Coefficient : public Function<dim>
{
public:
- Coefficient() : Function<dim>()
+ Coefficient()
+ : Function<dim>()
{}
virtual double
template <int dim>
-LaplaceProblem<dim>::LaplaceProblem() :
- fe(FE_Q<dim>(1)),
- dof_handler(triangulation)
+LaplaceProblem<dim>::LaplaceProblem()
+ : fe(FE_Q<dim>(1))
+ , dof_handler(triangulation)
{}
for (unsigned int i = 0; i < dofs_per_cell; ++i)
{
for (unsigned int j = 0; j < dofs_per_cell; ++j)
- system_matrix.add(
- local_dof_indices[i], local_dof_indices[j], cell_matrix(i, j));
+ system_matrix.add(local_dof_indices[i],
+ local_dof_indices[j],
+ cell_matrix(i, j));
system_rhs(local_dof_indices[i]) += cell_rhs(i);
}
}
std::map<types::global_dof_index, double> boundary_values;
- VectorTools::interpolate_boundary_values(
- dof_handler, 0, Functions::ZeroFunction<dim>(), boundary_values);
- MatrixTools::apply_boundary_values(
- boundary_values, system_matrix, solution, system_rhs);
+ VectorTools::interpolate_boundary_values(dof_handler,
+ 0,
+ Functions::ZeroFunction<dim>(),
+ boundary_values);
+ MatrixTools::apply_boundary_values(boundary_values,
+ system_matrix,
+ solution,
+ system_rhs);
}
class Coefficient : public Function<dim>
{
public:
- Coefficient() : Function<dim>()
+ Coefficient()
+ : Function<dim>()
{}
virtual double
template <int dim>
-LaplaceProblem<dim>::LaplaceProblem() :
- dof_handler(triangulation),
- fe(FE_Q<dim>(2))
+LaplaceProblem<dim>::LaplaceProblem()
+ : dof_handler(triangulation)
+ , fe(FE_Q<dim>(2))
{}
for (unsigned int i = 0; i < dofs_per_cell; ++i)
{
for (unsigned int j = 0; j < dofs_per_cell; ++j)
- system_matrix.add(
- local_dof_indices[i], local_dof_indices[j], cell_matrix(i, j));
+ system_matrix.add(local_dof_indices[i],
+ local_dof_indices[j],
+ cell_matrix(i, j));
system_rhs(local_dof_indices[i]) += cell_rhs(i);
}
hanging_node_constraints.condense(system_rhs);
std::map<types::global_dof_index, double> boundary_values;
- VectorTools::interpolate_boundary_values(
- dof_handler, 0, Functions::ZeroFunction<dim>(), boundary_values);
- MatrixTools::apply_boundary_values(
- boundary_values, system_matrix, solution, system_rhs);
+ VectorTools::interpolate_boundary_values(dof_handler,
+ 0,
+ Functions::ZeroFunction<dim>(),
+ boundary_values);
+ MatrixTools::apply_boundary_values(boundary_values,
+ system_matrix,
+ solution,
+ system_rhs);
}
solution,
estimated_error_per_cell);
- GridRefinement::refine_and_coarsen_fixed_number(
- triangulation, estimated_error_per_cell, 0.3, 0.03);
+ GridRefinement::refine_and_coarsen_fixed_number(triangulation,
+ estimated_error_per_cell,
+ 0.3,
+ 0.03);
triangulation.execute_coarsening_and_refinement();
}
template <>
const Point<1>
- SolutionBase<1>::source_centers[SolutionBase<1>::n_source_centers] = {
- Point<1>(-1.0 / 3.0),
- Point<1>(0.0),
- Point<1>(+1.0 / 3.0)};
+ SolutionBase<1>::source_centers[SolutionBase<1>::n_source_centers] =
+ {Point<1>(-1.0 / 3.0), Point<1>(0.0), Point<1>(+1.0 / 3.0)};
template <>
const Point<2>
- SolutionBase<2>::source_centers[SolutionBase<2>::n_source_centers] = {
- Point<2>(-0.5, +0.5),
- Point<2>(-0.5, -0.5),
- Point<2>(+0.5, -0.5)};
+ SolutionBase<2>::source_centers[SolutionBase<2>::n_source_centers] =
+ {Point<2>(-0.5, +0.5), Point<2>(-0.5, -0.5), Point<2>(+0.5, -0.5)};
template <int dim>
const double SolutionBase<dim>::width = 1. / 3.;
class Solution : public Function<dim>, protected SolutionBase<dim>
{
public:
- Solution() : Function<dim>()
+ Solution()
+ : Function<dim>()
{}
virtual double
class RightHandSide : public Function<dim>, protected SolutionBase<dim>
{
public:
- RightHandSide() : Function<dim>()
+ RightHandSide()
+ : Function<dim>()
{}
virtual double
template <int dim>
HelmholtzProblem<dim>::HelmholtzProblem(const hp::FECollection<dim> &fe,
- const RefinementMode refinement_mode) :
- dof_handler(triangulation),
- fe(&fe),
- refinement_mode(refinement_mode)
+ const RefinementMode refinement_mode)
+ : dof_handler(triangulation)
+ , fe(&fe)
+ , refinement_mode(refinement_mode)
{}
update_values | update_gradients |
update_quadrature_points | update_JxW_values);
- hp::FEFaceValues<dim> x_fe_face_values(
- *fe,
- face_quadrature_formula,
- update_values | update_quadrature_points | update_normal_vectors |
- update_JxW_values);
+ hp::FEFaceValues<dim> x_fe_face_values(*fe,
+ face_quadrature_formula,
+ update_values |
+ update_quadrature_points |
+ update_normal_vectors |
+ update_JxW_values);
const RightHandSide<dim> right_hand_side;
std::vector<double> rhs_values(n_q_points);
for (unsigned int i = 0; i < dofs_per_cell; ++i)
{
for (unsigned int j = 0; j < dofs_per_cell; ++j)
- system_matrix.add(
- local_dof_indices[i], local_dof_indices[j], cell_matrix(i, j));
+ system_matrix.add(local_dof_indices[i],
+ local_dof_indices[j],
+ cell_matrix(i, j));
system_rhs(local_dof_indices[i]) += cell_rhs(i);
}
hanging_node_constraints.condense(system_rhs);
std::map<types::global_dof_index, double> boundary_values;
- VectorTools::interpolate_boundary_values(
- dof_handler, 0, Solution<dim>(), boundary_values);
- MatrixTools::apply_boundary_values(
- boundary_values, system_matrix, solution, system_rhs);
+ VectorTools::interpolate_boundary_values(dof_handler,
+ 0,
+ Solution<dim>(),
+ boundary_values);
+ MatrixTools::apply_boundary_values(boundary_values,
+ system_matrix,
+ solution,
+ system_rhs);
}
template <int dim>
-RightHandSide<dim>::RightHandSide() : Function<dim>(dim)
+RightHandSide<dim>::RightHandSide()
+ : Function<dim>(dim)
{}
template <int dim>
-ElasticProblem<dim>::ElasticProblem() :
- dof_handler(triangulation),
- fe(FESystem<dim>(FE_Q<dim>(1), dim))
+ElasticProblem<dim>::ElasticProblem()
+ : dof_handler(triangulation)
+ , fe(FESystem<dim>(FE_Q<dim>(1), dim))
{}
for (unsigned int i = 0; i < dofs_per_cell; ++i)
{
for (unsigned int j = 0; j < dofs_per_cell; ++j)
- system_matrix.add(
- local_dof_indices[i], local_dof_indices[j], cell_matrix(i, j));
+ system_matrix.add(local_dof_indices[i],
+ local_dof_indices[j],
+ cell_matrix(i, j));
system_rhs(local_dof_indices[i]) += cell_rhs(i);
}
hanging_node_constraints.condense(system_rhs);
std::map<types::global_dof_index, double> boundary_values;
- VectorTools::interpolate_boundary_values(
- dof_handler, 0, Functions::ZeroFunction<dim>(dim), boundary_values);
- MatrixTools::apply_boundary_values(
- boundary_values, system_matrix, solution, system_rhs);
+ VectorTools::interpolate_boundary_values(dof_handler,
+ 0,
+ Functions::ZeroFunction<dim>(dim),
+ boundary_values);
+ MatrixTools::apply_boundary_values(boundary_values,
+ system_matrix,
+ solution,
+ system_rhs);
}
solution,
estimated_error_per_cell);
- GridRefinement::refine_and_coarsen_fixed_number(
- triangulation, estimated_error_per_cell, 0.3, 0.03);
+ GridRefinement::refine_and_coarsen_fixed_number(triangulation,
+ estimated_error_per_cell,
+ 0.3,
+ 0.03);
triangulation.execute_coarsening_and_refinement();
}
class MySquareFunction : public Function<dim>
{
public:
- MySquareFunction() : Function<dim>(2)
+ MySquareFunction()
+ : Function<dim>(2)
{}
virtual double
quadrature.push_back(QGauss<dim - 1>(3));
Vector<double> rhs(dof.n_dofs());
- VectorTools::create_boundary_right_hand_side(
- dof, quadrature, MySquareFunction<dim>(), rhs);
+ VectorTools::create_boundary_right_hand_side(dof,
+ quadrature,
+ MySquareFunction<dim>(),
+ rhs);
for (unsigned int i = 0; i < rhs.size(); ++i)
deallog << rhs(i) << std::endl;
}
class MySquareFunction : public Function<dim>
{
public:
- MySquareFunction() : Function<dim>(dim)
+ MySquareFunction()
+ : Function<dim>(dim)
{}
virtual double
quadrature.push_back(QGauss<dim - 1>(3));
Vector<double> rhs(dof.n_dofs());
- VectorTools::create_boundary_right_hand_side(
- dof, quadrature, MySquareFunction<dim>(), rhs);
+ VectorTools::create_boundary_right_hand_side(dof,
+ quadrature,
+ MySquareFunction<dim>(),
+ rhs);
for (unsigned int i = 0; i < rhs.size(); ++i)
deallog << rhs(i) << std::endl;
}
class MySquareFunction : public Function<dim>
{
public:
- MySquareFunction() : Function<dim>(1)
+ MySquareFunction()
+ : Function<dim>(1)
{}
virtual double
quadrature.push_back(QGauss<dim - 1>(3));
Vector<double> rhs(dof.n_dofs());
- VectorTools::create_boundary_right_hand_side(
- dof, quadrature, MySquareFunction<dim>(), rhs);
+ VectorTools::create_boundary_right_hand_side(dof,
+ quadrature,
+ MySquareFunction<dim>(),
+ rhs);
for (unsigned int i = 0; i < rhs.size(); ++i)
deallog << rhs(i) << std::endl;
}
class MySquareFunction : public Function<dim>
{
public:
- MySquareFunction() : Function<dim>(2)
+ MySquareFunction()
+ : Function<dim>(2)
{}
virtual double
quadrature.push_back(QGauss<dim - 1>(3 + i));
Vector<double> rhs(dof.n_dofs());
- VectorTools::create_boundary_right_hand_side(
- dof, quadrature, MySquareFunction<dim>(), rhs);
+ VectorTools::create_boundary_right_hand_side(dof,
+ quadrature,
+ MySquareFunction<dim>(),
+ rhs);
for (unsigned int i = 0; i < rhs.size(); ++i)
deallog << rhs(i) << std::endl;
}
class MySquareFunction : public Function<dim>
{
public:
- MySquareFunction() : Function<dim>(1)
+ MySquareFunction()
+ : Function<dim>(1)
{}
virtual double
quadrature.push_back(QGauss<dim - 1>(3 + i));
Vector<double> rhs(dof.n_dofs());
- VectorTools::create_boundary_right_hand_side(
- dof, quadrature, MySquareFunction<dim>(), rhs);
+ VectorTools::create_boundary_right_hand_side(dof,
+ quadrature,
+ MySquareFunction<dim>(),
+ rhs);
for (unsigned int i = 0; i < rhs.size(); ++i)
deallog << rhs(i) << std::endl;
}
mapping.push_back(MappingQ<dim>(i + 1));
Vector<double> rhs(dof.n_dofs());
- VectorTools::create_point_source_vector(
- mapping, dof, tr.begin()->center(), rhs);
+ VectorTools::create_point_source_vector(mapping,
+ dof,
+ tr.begin()->center(),
+ rhs);
for (unsigned int i = 0; i < rhs.size(); ++i)
deallog << rhs(i) << std::endl;
}
class MySquareFunction : public Function<dim>
{
public:
- MySquareFunction() : Function<dim>(2)
+ MySquareFunction()
+ : Function<dim>(2)
{}
virtual double
quadrature.push_back(QGauss<dim>(3));
Vector<double> rhs(dof.n_dofs());
- VectorTools::create_right_hand_side(
- dof, quadrature, MySquareFunction<dim>(), rhs);
+ VectorTools::create_right_hand_side(dof,
+ quadrature,
+ MySquareFunction<dim>(),
+ rhs);
for (unsigned int i = 0; i < rhs.size(); ++i)
deallog << rhs(i) << std::endl;
}
class MySquareFunction : public Function<dim>
{
public:
- MySquareFunction() : Function<dim>(dim)
+ MySquareFunction()
+ : Function<dim>(dim)
{}
virtual double
quadrature.push_back(QGauss<dim>(3));
Vector<double> rhs(dof.n_dofs());
- VectorTools::create_right_hand_side(
- dof, quadrature, MySquareFunction<dim>(), rhs);
+ VectorTools::create_right_hand_side(dof,
+ quadrature,
+ MySquareFunction<dim>(),
+ rhs);
for (unsigned int i = 0; i < rhs.size(); ++i)
deallog << rhs(i) << std::endl;
}
class MySquareFunction : public Function<dim>
{
public:
- MySquareFunction() : Function<dim>(1)
+ MySquareFunction()
+ : Function<dim>(1)
{}
virtual double
quadrature.push_back(QGauss<dim>(3));
Vector<double> rhs(dof.n_dofs());
- VectorTools::create_right_hand_side(
- dof, quadrature, MySquareFunction<dim>(), rhs);
+ VectorTools::create_right_hand_side(dof,
+ quadrature,
+ MySquareFunction<dim>(),
+ rhs);
for (unsigned int i = 0; i < rhs.size(); ++i)
deallog << rhs(i) << std::endl;
}
class MySquareFunction : public Function<dim>
{
public:
- MySquareFunction() : Function<dim>(2)
+ MySquareFunction()
+ : Function<dim>(2)
{}
virtual double
quadrature.push_back(QGauss<dim>(3 + i));
Vector<double> rhs(dof.n_dofs());
- VectorTools::create_right_hand_side(
- dof, quadrature, MySquareFunction<dim>(), rhs);
+ VectorTools::create_right_hand_side(dof,
+ quadrature,
+ MySquareFunction<dim>(),
+ rhs);
for (unsigned int i = 0; i < rhs.size(); ++i)
deallog << rhs(i) << std::endl;
}
class MySquareFunction : public Function<dim>
{
public:
- MySquareFunction() : Function<dim>(1)
+ MySquareFunction()
+ : Function<dim>(1)
{}
virtual double
quadrature.push_back(QGauss<dim>(3 + i));
Vector<double> rhs(dof.n_dofs());
- VectorTools::create_right_hand_side(
- dof, quadrature, MySquareFunction<dim>(), rhs);
+ VectorTools::create_right_hand_side(dof,
+ quadrature,
+ MySquareFunction<dim>(),
+ rhs);
for (unsigned int i = 0; i < rhs.size(); ++i)
deallog << rhs(i) << std::endl;
}
u = 0.;
u(i) = 1.;
w = 0.;
- fev.get_function_values(
- u,
- indices,
- VectorSlice<std::vector<std::vector<double>>>(uval),
- true);
+ fev.get_function_values(u,
+ indices,
+ VectorSlice<std::vector<std::vector<double>>>(
+ uval),
+ true);
cell_residual(w, fev, make_slice(uval), vel);
M.vmult(v, u);
w.add(-1., v);
u = 0.;
u(i) = 1.;
w = 0.;
- fev.get_function_values(
- u,
- indices,
- VectorSlice<std::vector<std::vector<double>>>(uval),
- true);
+ fev.get_function_values(u,
+ indices,
+ VectorSlice<std::vector<std::vector<double>>>(
+ uval),
+ true);
upwind_value_residual(
w, fev, make_slice(uval), make_slice(null_val), vel);
M.vmult(v, u);
u1(i1) = 1.;
w1 = 0.;
w2 = 0.;
- fev1.get_function_values(
- u1,
- indices1,
- VectorSlice<std::vector<std::vector<double>>>(u1val),
- true);
+ fev1.get_function_values(u1,
+ indices1,
+ VectorSlice<std::vector<std::vector<double>>>(
+ u1val),
+ true);
upwind_face_residual(
w1, w2, fev1, fev2, make_slice(u1val), make_slice(nullval), vel);
M11.vmult(v1, u1);
}
w1 = 0.;
w2 = 0.;
- fev2.get_function_values(
- u1,
- indices2,
- VectorSlice<std::vector<std::vector<double>>>(u1val),
- true);
+ fev2.get_function_values(u1,
+ indices2,
+ VectorSlice<std::vector<std::vector<double>>>(
+ u1val),
+ true);
upwind_face_residual(
w1, w2, fev1, fev2, make_slice(nullval), make_slice(u1val), vel);
M12.vmult(v1, u1);
{
deallog << fe.get_name() << std::endl << "cell matrix" << std::endl;
QGauss<dim> quadrature(fe.tensor_degree());
- FEValues<dim> fev(
- fe, quadrature, update_values | update_gradients | update_JxW_values);
+ FEValues<dim> fev(fe,
+ quadrature,
+ update_values | update_gradients | update_JxW_values);
typename Triangulation<dim>::cell_iterator cell1 = tr.begin(1);
fev.reinit(cell1);
class RightHandSide : public Function<dim>
{
public:
- RightHandSide() : Function<dim>()
+ RightHandSide()
+ : Function<dim>()
{}
virtual double
class BoundaryValues : public Function<dim>
{
public:
- BoundaryValues() : Function<dim>()
+ BoundaryValues()
+ : Function<dim>()
{}
virtual double
class FluxBoundaryValues : public Function<dim>
{
public:
- FluxBoundaryValues() : Function<dim>()
+ FluxBoundaryValues()
+ : Function<dim>()
{}
virtual double
class Advection : public TensorFunction<1, dim>
{
public:
- Advection() : TensorFunction<1, dim>()
+ Advection()
+ : TensorFunction<1, dim>()
{}
virtual Tensor<1, dim>
template <int dim>
MeshWorkerConstraintMatrixTest<dim>::MeshWorkerConstraintMatrixTest(
- const FiniteElement<dim> &fe) :
- mapping(),
- dof_handler(triangulation),
- fe(fe)
+ const FiniteElement<dim> &fe)
+ : mapping()
+ , dof_handler(triangulation)
+ , fe(fe)
{
GridGenerator::hyper_cube(this->triangulation, -1, 1);
std::string fe_name = fe.get_name();
std::size_t found = fe_name.find(str);
if (found != std::string::npos)
- DoFTools::make_flux_sparsity_pattern(
- dof_handler, c_sparsity, constraints, false);
+ DoFTools::make_flux_sparsity_pattern(dof_handler,
+ c_sparsity,
+ constraints,
+ false);
else
- DoFTools::make_sparsity_pattern(
- dof_handler, c_sparsity, constraints, false);
+ DoFTools::make_sparsity_pattern(dof_handler,
+ c_sparsity,
+ constraints,
+ false);
sparsity_pattern.copy_from(c_sparsity);
MeshWorker::IntegrationInfoBox<dim> info_box;
const unsigned int n_gauss_points = dof_handler.get_fe().degree + 1;
- info_box.initialize_gauss_quadrature(
- n_gauss_points, n_gauss_points, n_gauss_points);
+ info_box.initialize_gauss_quadrature(n_gauss_points,
+ n_gauss_points,
+ n_gauss_points);
UpdateFlags update_flags =
update_quadrature_points | update_values | update_gradients;
MeshWorker::IntegrationInfoBox<dim> info_box;
const unsigned int n_gauss_points = dof_handler.get_fe().degree + 1;
- info_box.initialize_gauss_quadrature(
- n_gauss_points, n_gauss_points, n_gauss_points);
+ info_box.initialize_gauss_quadrature(n_gauss_points,
+ n_gauss_points,
+ n_gauss_points);
UpdateFlags update_flags =
update_quadrature_points | update_values | update_gradients;
{
this->constraintsInhom.clear();
// boundary constraints
- VectorTools::interpolate_boundary_values(
- this->dof_handler, 0, BoundaryValues<dim>(), this->constraintsInhom);
+ VectorTools::interpolate_boundary_values(this->dof_handler,
+ 0,
+ BoundaryValues<dim>(),
+ this->constraintsInhom);
// constraint of the origin
std::map<types::global_dof_index, Point<dim>> support_points;
- DoFTools::map_dofs_to_support_points(
- this->mapping, this->dof_handler, support_points);
+ DoFTools::map_dofs_to_support_points(this->mapping,
+ this->dof_handler,
+ support_points);
for (unsigned int dof_index = 0; dof_index < this->dof_handler.n_dofs();
++dof_index)
{
deallog << fv.get_name() << " x " << fs.get_name() << std::endl
<< "cell matrix" << std::endl;
QGauss<dim> quadrature(fv.tensor_degree() + 1);
- FEValues<dim> fev(
- fv, quadrature, update_values | update_gradients | update_JxW_values);
- FEValues<dim> fes(
- fs, quadrature, update_values | update_gradients | update_JxW_values);
+ FEValues<dim> fev(fv,
+ quadrature,
+ update_values | update_gradients | update_JxW_values);
+ FEValues<dim> fes(fs,
+ quadrature,
+ update_values | update_gradients | update_JxW_values);
typename Triangulation<dim>::cell_iterator cell1 = tr.begin(1);
fev.reinit(cell1);
test_boundary(fev1, fes1);
}
- FEFaceValues<dim> fev2(
- fv, face_quadrature, update_values | update_gradients | update_JxW_values);
- FEFaceValues<dim> fes2(
- fs, face_quadrature, update_values | update_gradients | update_JxW_values);
+ FEFaceValues<dim> fev2(fv,
+ face_quadrature,
+ update_values | update_gradients | update_JxW_values);
+ FEFaceValues<dim> fes2(fs,
+ face_quadrature,
+ update_values | update_gradients | update_JxW_values);
typename Triangulation<dim>::cell_iterator cell2 = cell1->neighbor(1);
deallog << "face_matrix " << 0 << std::endl;
u = 0.;
u(i) = 1.;
w = 0.;
- fev.get_function_values(
- u,
- indices,
- VectorSlice<std::vector<std::vector<double>>>(uval),
- true);
+ fev.get_function_values(u,
+ indices,
+ VectorSlice<std::vector<std::vector<double>>>(
+ uval),
+ true);
fev.get_function_gradients(
u,
indices,
nullval(d, std::vector<double>(fev2.n_quadrature_points, 0.));
std::vector<std::vector<Tensor<1, dim>>> u1grad(
d, std::vector<Tensor<1, dim>>(fev1.n_quadrature_points)),
- nullgrad(
- d,
- std::vector<Tensor<1, dim>>(fev2.n_quadrature_points, Tensor<1, dim>()));
+ nullgrad(d,
+ std::vector<Tensor<1, dim>>(fev2.n_quadrature_points,
+ Tensor<1, dim>()));
std::vector<types::global_dof_index> indices1(n1), indices2(n2);
for (unsigned int i = 0; i < n1; ++i)
u1(i1) = 1.;
w1 = 0.;
w2 = 0.;
- fev1.get_function_values(
- u1,
- indices1,
- VectorSlice<std::vector<std::vector<double>>>(u1val),
- true);
+ fev1.get_function_values(u1,
+ indices1,
+ VectorSlice<std::vector<std::vector<double>>>(
+ u1val),
+ true);
fev1.get_function_gradients(
u1,
indices1,
w1 = 0.;
w2 = 0.;
- fev2.get_function_values(
- u1,
- indices2,
- VectorSlice<std::vector<std::vector<double>>>(u1val),
- true);
+ fev2.get_function_values(u1,
+ indices2,
+ VectorSlice<std::vector<std::vector<double>>>(
+ u1val),
+ true);
fev2.get_function_gradients(
u1,
indices2,
test_boundary(fef1);
}
- FEFaceValues<dim> fef2(
- fe, face_quadrature, update_values | update_gradients | update_JxW_values);
+ FEFaceValues<dim> fef2(fe,
+ face_quadrature,
+ update_values | update_gradients | update_JxW_values);
typename Triangulation<dim>::cell_iterator cell2 = cell1->neighbor(1);
deallog << "face_matrix " << 0 << std::endl;
u = 0.;
u(i) = 1.;
w = 0.;
- fev.get_function_values(
- u,
- indices,
- VectorSlice<std::vector<std::vector<double>>>(uval),
- true);
+ fev.get_function_values(u,
+ indices,
+ VectorSlice<std::vector<std::vector<double>>>(
+ uval),
+ true);
fev.get_function_gradients(
u,
indices,
u = 0.;
u(i) = 1.;
w = 0.;
- fev.get_function_values(
- u,
- indices,
- VectorSlice<std::vector<std::vector<double>>>(uval),
- true);
+ fev.get_function_values(u,
+ indices,
+ VectorSlice<std::vector<std::vector<double>>>(
+ uval),
+ true);
fev.get_function_gradients(
u,
indices,
nullval(d, std::vector<double>(fev2.n_quadrature_points, 0.));
std::vector<std::vector<Tensor<1, dim>>> u1grad(
d, std::vector<Tensor<1, dim>>(fev1.n_quadrature_points)),
- nullgrad(
- d,
- std::vector<Tensor<1, dim>>(fev2.n_quadrature_points, Tensor<1, dim>()));
+ nullgrad(d,
+ std::vector<Tensor<1, dim>>(fev2.n_quadrature_points,
+ Tensor<1, dim>()));
std::vector<types::global_dof_index> indices1(n1), indices2(n2);
for (unsigned int i = 0; i < n1; ++i)
u1(i1) = 1.;
w1 = 0.;
w2 = 0.;
- fev1.get_function_values(
- u1,
- indices1,
- VectorSlice<std::vector<std::vector<double>>>(u1val),
- true);
+ fev1.get_function_values(u1,
+ indices1,
+ VectorSlice<std::vector<std::vector<double>>>(
+ u1val),
+ true);
fev1.get_function_gradients(
u1,
indices1,
w1 = 0.;
w2 = 0.;
- fev2.get_function_values(
- u1,
- indices2,
- VectorSlice<std::vector<std::vector<double>>>(u1val),
- true);
+ fev2.get_function_values(u1,
+ indices2,
+ VectorSlice<std::vector<std::vector<double>>>(
+ u1val),
+ true);
fev2.get_function_gradients(
u1,
indices2,
test_boundary(fef1);
}
- FEFaceValues<dim> fef2(
- fe, face_quadrature, update_values | update_gradients | update_JxW_values);
+ FEFaceValues<dim> fef2(fe,
+ face_quadrature,
+ update_values | update_gradients | update_JxW_values);
typename Triangulation<dim>::cell_iterator cell2 = cell1->neighbor(1);
deallog << "face_matrix " << 0 << std::endl;
u = 0.;
u(i) = 1.;
w = 0.;
- fev.get_function_values(
- u,
- indices,
- VectorSlice<std::vector<std::vector<double>>>(uval),
- true);
+ fev.get_function_values(u,
+ indices,
+ VectorSlice<std::vector<std::vector<double>>>(
+ uval),
+ true);
fev.get_function_gradients(
u,
indices,
nullval(d, std::vector<double>(fev2.n_quadrature_points, 0.));
std::vector<std::vector<Tensor<1, dim>>> u1grad(
d, std::vector<Tensor<1, dim>>(fev1.n_quadrature_points)),
- nullgrad(
- d,
- std::vector<Tensor<1, dim>>(fev2.n_quadrature_points, Tensor<1, dim>()));
+ nullgrad(d,
+ std::vector<Tensor<1, dim>>(fev2.n_quadrature_points,
+ Tensor<1, dim>()));
std::vector<types::global_dof_index> indices1(n1), indices2(n2);
for (unsigned int i = 0; i < n1; ++i)
u1(i1) = 1.;
w1 = 0.;
w2 = 0.;
- fev1.get_function_values(
- u1,
- indices1,
- VectorSlice<std::vector<std::vector<double>>>(u1val),
- true);
+ fev1.get_function_values(u1,
+ indices1,
+ VectorSlice<std::vector<std::vector<double>>>(
+ u1val),
+ true);
fev1.get_function_gradients(
u1,
indices1,
w1 = 0.;
w2 = 0.;
- fev2.get_function_values(
- u1,
- indices2,
- VectorSlice<std::vector<std::vector<double>>>(u1val),
- true);
+ fev2.get_function_values(u1,
+ indices2,
+ VectorSlice<std::vector<std::vector<double>>>(
+ u1val),
+ true);
fev2.get_function_gradients(
u1,
indices2,
test_boundary(fef1);
}
- FEFaceValues<dim> fef2(
- fe, face_quadrature, update_values | update_gradients | update_JxW_values);
+ FEFaceValues<dim> fef2(fe,
+ face_quadrature,
+ update_values | update_gradients | update_JxW_values);
typename Triangulation<dim>::cell_iterator cell2 = cell1->neighbor(1);
deallog << "face_matrix " << 0 << std::endl;
MeshWorker::IntegrationInfoBox<dim> info_box;
const unsigned int n_gauss_points = dof_handler.get_fe().tensor_degree() + 1;
- info_box.initialize_gauss_quadrature(
- n_gauss_points, n_gauss_points, n_gauss_points);
+ info_box.initialize_gauss_quadrature(n_gauss_points,
+ n_gauss_points,
+ n_gauss_points);
info_box.initialize_update_flags();
UpdateFlags update_flags = update_values | update_gradients;
info_box.add_update_flags(update_flags, true, true, true, true);
MeshWorker::IntegrationInfoBox<dim> info_box;
const unsigned int n_gauss_points = dof_handler.get_fe().tensor_degree() + 1;
- info_box.initialize_gauss_quadrature(
- n_gauss_points, n_gauss_points, n_gauss_points);
+ info_box.initialize_gauss_quadrature(n_gauss_points,
+ n_gauss_points,
+ n_gauss_points);
info_box.initialize_update_flags();
UpdateFlags update_flags = update_values | update_gradients;
info_box.add_update_flags(update_flags, true, true, true, true);
MeshWorker::IntegrationInfoBox<dim> info_box;
const unsigned int n_gauss_points = dof_handler.get_fe().tensor_degree() + 1;
- info_box.initialize_gauss_quadrature(
- n_gauss_points, n_gauss_points, n_gauss_points);
+ info_box.initialize_gauss_quadrature(n_gauss_points,
+ n_gauss_points,
+ n_gauss_points);
info_box.initialize_update_flags();
UpdateFlags update_flags = update_values | update_gradients;
info_box.add_update_flags(update_flags, true, true, true, true);
MeshWorker::IntegrationInfoBox<dim> info_box;
const unsigned int n_gauss_points = dof_handler.get_fe().tensor_degree() + 1;
- info_box.initialize_gauss_quadrature(
- n_gauss_points, n_gauss_points, n_gauss_points);
+ info_box.initialize_gauss_quadrature(n_gauss_points,
+ n_gauss_points,
+ n_gauss_points);
info_box.initialize_update_flags();
UpdateFlags update_flags = update_values | update_gradients;
info_box.add_update_flags(update_flags, true, true, true, true);
template <int dim>
- AdvectionProblem<dim>::AdvectionProblem() :
- mapping(1),
- wavespeed(1.0),
- dof_handler(triangulation),
- fe(FE_DGQ<dim>(0), 1), // p=0, and solving for a scalar
+ AdvectionProblem<dim>::AdvectionProblem()
+ : mapping(1)
+ , wavespeed(1.0)
+ , dof_handler(triangulation)
+ , fe(FE_DGQ<dim>(0), 1)
+ , // p=0, and solving for a scalar
upos(0)
{}
MeshWorker::IntegrationInfoBox<dim> info_box;
- info_box.initialize_gauss_quadrature(
- n_gauss_points, n_gauss_points, n_gauss_points);
+ info_box.initialize_gauss_quadrature(n_gauss_points,
+ n_gauss_points,
+ n_gauss_points);
info_box.initialize_update_flags();
UpdateFlags update_flags =
template <typename VectorType, class Matrix, class Sparsity>
LaplaceProblem<VectorType, Matrix, Sparsity>::LaplaceProblem(
- const unsigned int n_blocks) :
- n_blocks(n_blocks),
- fe(1),
- dof_handler(triangulation)
+ const unsigned int n_blocks)
+ : n_blocks(n_blocks)
+ , fe(1)
+ , dof_handler(triangulation)
{
sparsity_pattern.reinit(n_blocks, n_blocks);
}
template <>
LaplaceProblem<Vector<double>, SparseMatrix<double>, SparsityPattern>::
- LaplaceProblem(const unsigned int n_blocks) :
- n_blocks(n_blocks),
- fe(1),
- dof_handler(triangulation)
+ LaplaceProblem(const unsigned int n_blocks)
+ : n_blocks(n_blocks)
+ , fe(1)
+ , dof_handler(triangulation)
{}
template <>
LaplaceProblem<Vector<float>, SparseMatrix<float>, SparsityPattern>::
- LaplaceProblem(const unsigned int n_blocks) :
- n_blocks(n_blocks),
- fe(1),
- dof_handler(triangulation)
+ LaplaceProblem(const unsigned int n_blocks)
+ : n_blocks(n_blocks)
+ , fe(1)
+ , dof_handler(triangulation)
{}
LaplaceProblem<VectorType, Matrix, Sparsity>::assemble_system()
{
QGauss<2> quadrature_formula(2);
- FEValues<2> fe_values(
- fe,
- quadrature_formula,
- UpdateFlags(update_values | update_gradients | update_JxW_values));
+ FEValues<2> fe_values(fe,
+ quadrature_formula,
+ UpdateFlags(update_values | update_gradients |
+ update_JxW_values));
const unsigned int dofs_per_cell = fe.dofs_per_cell;
const unsigned int n_q_points = quadrature_formula.size();
for (unsigned int i = 0; i < dofs_per_cell; ++i)
for (unsigned int j = 0; j < dofs_per_cell; ++j)
- system_matrix.add(
- local_dof_indices[i], local_dof_indices[j], cell_matrix(i, j));
+ system_matrix.add(local_dof_indices[i],
+ local_dof_indices[j],
+ cell_matrix(i, j));
for (unsigned int i = 0; i < dofs_per_cell; ++i)
system_rhs(local_dof_indices[i]) += cell_rhs(i);
0,
Functions::ZeroFunction<2, typename VectorType::value_type>(),
boundary_values);
- MatrixTools::apply_boundary_values(
- boundary_values, system_matrix, solution, system_rhs);
+ MatrixTools::apply_boundary_values(boundary_values,
+ system_matrix,
+ solution,
+ system_rhs);
}
deallog << "Check 6: " << (v1 == v2 ? "true" : "false") << std::endl;
// check std::transform
- std::transform(
- v1.begin(),
- v1.end(),
- v2.begin(),
- std::bind(std::multiplies<double>(), std::placeholders::_1, 2.0));
+ std::transform(v1.begin(),
+ v1.end(),
+ v2.begin(),
+ std::bind(std::multiplies<double>(),
+ std::placeholders::_1,
+ 2.0));
v2 *= 1. / 2;
deallog << "Check 7: " << (v1 == v2 ? "true" : "false") << std::endl;
template <int dim>
-Step6<dim>::Step6() : fe(2), dof_handler(triangulation)
+Step6<dim>::Step6()
+ : fe(2)
+ , dof_handler(triangulation)
{}
constraints.clear();
DoFTools::make_hanging_node_constraints(dof_handler, constraints);
- VectorTools::interpolate_boundary_values(
- dof_handler, 0, Functions::ConstantFunction<dim>(1.), constraints);
+ VectorTools::interpolate_boundary_values(dof_handler,
+ 0,
+ Functions::ConstantFunction<dim>(1.),
+ constraints);
constraints.close();
DynamicSparsityPattern dsp(dof_handler.n_dofs());
solution,
estimated_error_per_cell);
- GridRefinement::refine_and_coarsen_fixed_number(
- triangulation, estimated_error_per_cell, 0.3, 0.03);
+ GridRefinement::refine_and_coarsen_fixed_number(triangulation,
+ estimated_error_per_cell,
+ 0.3,
+ 0.03);
triangulation.execute_coarsening_and_refinement();
}
std::vector<types::global_dof_index> dofs_per_block(
3, 0); // 3 blocks, count dofs:
- DoFTools::count_dofs_per_component(
- dh, dofs_per_block, false, block_component);
+ DoFTools::count_dofs_per_component(dh,
+ dofs_per_block,
+ false,
+ block_component);
DoFRenumbering::component_wise(dh, block_component);
GeometryInfo<dim>::unit_normal_direction[other_face];
std::vector<std::pair<types::global_dof_index, double>> rhs;
- const unsigned int constrained = fe.face_to_cell_index(
- (fvertex == 0) ? 2 : fe.dofs_per_face - 1, face);
+ const unsigned int constrained =
+ fe.face_to_cell_index((fvertex == 0) ? 2 : fe.dofs_per_face - 1,
+ face);
double constrained_weight = 0.;
for (unsigned int i = 0; i < fe.dofs_per_cell; ++i)
if (i == constrained)
constrained_weight = vertex_constraints[vertex][d][i];
else if (vertex_constraints[vertex][d][i] != 0.)
- rhs.push_back(std::make_pair(
- cell_indices[i], -vertex_constraints[vertex][d][i]));
+ rhs.push_back(
+ std::make_pair(cell_indices[i],
+ -vertex_constraints[vertex][d][i]));
if (vertex_constraints[neighbor_vertex][d][i] != 0.)
rhs.push_back(std::make_pair(
neighbor_indices[i],
<< "Total number of constraints: "
<< correct_constraints.n_constraints() << std::endl;
- VectorTools::interpolate_boundary_values(
- dof, 0, Functions::ConstantFunction<dim>(1.), library_constraints);
+ VectorTools::interpolate_boundary_values(dof,
+ 0,
+ Functions::ConstantFunction<dim>(1.),
+ library_constraints);
library_constraints.close();
// the two constraint matrices should look the
ConstraintMatrix constraints;
DoFTools::make_hanging_node_constraints(dof, constraints);
- VectorTools::interpolate_boundary_values(
- dof, 1, Functions::ZeroFunction<dim>(), constraints);
+ VectorTools::interpolate_boundary_values(dof,
+ 1,
+ Functions::ZeroFunction<dim>(),
+ constraints);
constraints.close();
SparsityPattern sparsity;
else
local_mat(i, j) = random_value<double>();
cell->get_dof_indices(local_dof_indices);
- constraints.distribute_local_to_global(
- local_mat, local_dof_indices, sparse);
- constraints.distribute_local_to_global(
- local_mat, local_dof_indices, full);
+ constraints.distribute_local_to_global(local_mat,
+ local_dof_indices,
+ sparse);
+ constraints.distribute_local_to_global(local_mat,
+ local_dof_indices,
+ full);
}
// now check that the entries are indeed the
ConstraintMatrix constraints;
DoFTools::make_hanging_node_constraints(dof, constraints);
- VectorTools::interpolate_boundary_values(
- dof, 1, Functions::ZeroFunction<dim>(), constraints);
+ VectorTools::interpolate_boundary_values(dof,
+ 1,
+ Functions::ZeroFunction<dim>(),
+ constraints);
constraints.close();
SparsityPattern sparsity;
else
local_mat(i, j) = random_value<double>();
cell->get_dof_indices(local_dof_indices);
- constraints.distribute_local_to_global(
- local_mat, local_dof_indices, sparse);
- constraints.distribute_local_to_global(
- local_mat, local_dof_indices, chunk_sparse);
+ constraints.distribute_local_to_global(local_mat,
+ local_dof_indices,
+ sparse);
+ constraints.distribute_local_to_global(local_mat,
+ local_dof_indices,
+ chunk_sparse);
}
// now check that the entries are indeed the
deallog << "Shifted constraints" << std::endl;
constraints1.print(deallog.get_file_stream());
- constraints1.merge(
- constraints2, ConstraintMatrix::no_conflicts_allowed, true);
+ constraints1.merge(constraints2,
+ ConstraintMatrix::no_conflicts_allowed,
+ true);
deallog << "Shifted and merged constraints" << std::endl;
constraints1.print(deallog.get_file_stream());
ConstraintMatrix constraints(relevant_set);
DoFTools::make_hanging_node_constraints(dof, constraints);
- VectorTools::interpolate_boundary_values(
- dof, 0, Functions::ZeroFunction<dim>(), constraints);
+ VectorTools::interpolate_boundary_values(dof,
+ 0,
+ Functions::ZeroFunction<dim>(),
+ constraints);
constraints.close();
deallog << "Testing " << dof.get_fe().get_name() << std::endl;
TrilinosWrappers::SparseMatrix sparse_matrix;
{
TrilinosWrappers::SparsityPattern csp(owned_set, MPI_COMM_WORLD);
- DoFTools::make_sparsity_pattern(
- dof,
- csp,
- constraints,
- true,
- Utilities::MPI::this_mpi_process(MPI_COMM_WORLD));
+ DoFTools::make_sparsity_pattern(dof,
+ csp,
+ constraints,
+ true,
+ Utilities::MPI::this_mpi_process(
+ MPI_COMM_WORLD));
csp.compress();
sparse_matrix.reinit(csp);
}
{
QGauss<dim> quadrature_formula(fe_degree + 1);
- FEValues<dim> fe_values(
- dof.get_fe(), quadrature_formula, update_gradients | update_JxW_values);
+ FEValues<dim> fe_values(dof.get_fe(),
+ quadrature_formula,
+ update_gradients | update_JxW_values);
const unsigned int dofs_per_cell = dof.get_fe().dofs_per_cell;
const unsigned int n_q_points = quadrature_formula.size();
}
cell->get_dof_indices(local_dof_indices);
- constraints.distribute_local_to_global(
- cell_matrix, local_dof_indices, sparse_matrix);
- constraints.distribute_local_to_global(
- cell_matrix, local_dof_indices, diagonal_matrix);
+ constraints.distribute_local_to_global(cell_matrix,
+ local_dof_indices,
+ sparse_matrix);
+ constraints.distribute_local_to_global(cell_matrix,
+ local_dof_indices,
+ diagonal_matrix);
}
}
sparse_matrix.compress(VectorOperation::add);
Vector<double> f(dof.n_dofs());
- SparsityPattern A_pattern(
- dof.n_dofs(), dof.n_dofs(), dof.max_couplings_between_dofs());
+ SparsityPattern A_pattern(dof.n_dofs(),
+ dof.n_dofs(),
+ dof.max_couplings_between_dofs());
DoFTools::make_sparsity_pattern(dof, A_pattern);
A_pattern.compress();
class BoundaryValues : public Function<dim>
{
public:
- BoundaryValues() : Function<dim>()
+ BoundaryValues()
+ : Function<dim>()
{}
virtual double
class RightHandSide : public Function<dim>
{
public:
- RightHandSide() : Function<dim>()
+ RightHandSide()
+ : Function<dim>()
{}
virtual double
template <int dim>
-LaplaceProblem<dim>::LaplaceProblem() :
- dof_handler(triangulation),
- max_degree(5)
+LaplaceProblem<dim>::LaplaceProblem()
+ : dof_handler(triangulation)
+ , max_degree(5)
{
if (dim == 2)
for (unsigned int degree = 2; degree <= max_degree; ++degree)
{
test_all_constraints.merge(hanging_nodes_only);
std::map<types::global_dof_index, double> boundary_values;
- VectorTools::interpolate_boundary_values(
- dof_handler, 0, BoundaryValues<dim>(), boundary_values);
+ VectorTools::interpolate_boundary_values(dof_handler,
+ 0,
+ BoundaryValues<dim>(),
+ boundary_values);
std::map<types::global_dof_index, double>::const_iterator boundary_value =
boundary_values.begin();
for (; boundary_value != boundary_values.end(); ++boundary_value)
hanging_nodes_only.condense(reference_matrix, reference_rhs);
std::map<types::global_dof_index, double> boundary_values;
- VectorTools::interpolate_boundary_values(
- dof_handler, 0, BoundaryValues<dim>(), boundary_values);
- MatrixTools::apply_boundary_values(
- boundary_values, reference_matrix, solution, reference_rhs);
+ VectorTools::interpolate_boundary_values(dof_handler,
+ 0,
+ BoundaryValues<dim>(),
+ boundary_values);
+ MatrixTools::apply_boundary_values(boundary_values,
+ reference_matrix,
+ solution,
+ reference_rhs);
deallog << " Reference matrix nonzeros: "
<< reference_matrix.n_nonzero_elements() << ", actually: "
for (unsigned int i = 0; i < estimated_error_per_cell.size(); ++i)
estimated_error_per_cell(i) = i;
- GridRefinement::refine_and_coarsen_fixed_number(
- triangulation, estimated_error_per_cell, 0.3, 0.03);
+ GridRefinement::refine_and_coarsen_fixed_number(triangulation,
+ estimated_error_per_cell,
+ 0.3,
+ 0.03);
triangulation.execute_coarsening_and_refinement();
}
if (!((i == 0) && (j == 0) && (k == 0)) &&
(i * i + j * j + k * k < N * N))
{
- k_vectors.push_back(Point<dim>(
- numbers::PI * i, numbers::PI * j, numbers::PI * k));
+ k_vectors.push_back(Point<dim>(numbers::PI * i,
+ numbers::PI * j,
+ numbers::PI * k));
k_vectors_magnitude.push_back(i * i + j * j + k * k);
}
class RightHandSide : public Function<dim>
{
public:
- RightHandSide() : Function<dim>()
+ RightHandSide()
+ : Function<dim>()
{}
virtual double
template <int dim>
-AdvectionProblem<dim>::AdvectionProblem() :
- dof_handler(triangulation),
- fe(FE_Q<dim>(2), 2)
+AdvectionProblem<dim>::AdvectionProblem()
+ : dof_handler(triangulation)
+ , fe(FE_Q<dim>(2), 2)
{}
std::map<types::global_dof_index, double> boundary_values;
VectorTools::interpolate_boundary_values(
dof_handler, 0, Functions::ConstantFunction<dim>(1., 2), boundary_values);
- MatrixTools::apply_boundary_values(
- boundary_values, reference_matrix, test_rhs, reference_rhs);
+ MatrixTools::apply_boundary_values(boundary_values,
+ reference_matrix,
+ test_rhs,
+ reference_rhs);
}
class RightHandSide : public Function<dim>
{
public:
- RightHandSide() : Function<dim>()
+ RightHandSide()
+ : Function<dim>()
{}
virtual double
template <int dim>
-AdvectionProblem<dim>::AdvectionProblem() : dof_handler(triangulation), fe(2)
+AdvectionProblem<dim>::AdvectionProblem()
+ : dof_handler(triangulation)
+ , fe(2)
{}
// boundary function
{
std::map<types::global_dof_index, double> boundary_values;
- VectorTools::interpolate_boundary_values(
- dof_handler, 0, RightHandSide<dim>(), boundary_values);
+ VectorTools::interpolate_boundary_values(dof_handler,
+ 0,
+ RightHandSide<dim>(),
+ boundary_values);
std::map<types::global_dof_index, double>::const_iterator boundary_value =
boundary_values.begin();
for (; boundary_value != boundary_values.end(); ++boundary_value)
// use some other rhs vector as dummy for
// application of Dirichlet conditions
std::map<types::global_dof_index, double> boundary_values;
- VectorTools::interpolate_boundary_values(
- dof_handler, 0, RightHandSide<dim>(), boundary_values);
- MatrixTools::apply_boundary_values(
- boundary_values, reference_matrix, test_rhs, reference_rhs);
+ VectorTools::interpolate_boundary_values(dof_handler,
+ 0,
+ RightHandSide<dim>(),
+ boundary_values);
+ MatrixTools::apply_boundary_values(boundary_values,
+ reference_matrix,
+ test_rhs,
+ reference_rhs);
}
class Coefficient : public Function<dim>
{
public:
- Coefficient() : Function<dim>()
+ Coefficient()
+ : Function<dim>()
{}
virtual double
template <int dim>
-LaplaceProblem<dim>::LaplaceProblem() : fe(1), dof_handler(triangulation)
+LaplaceProblem<dim>::LaplaceProblem()
+ : fe(1)
+ , dof_handler(triangulation)
{}
<< std::endl;
constraints.clear();
- VectorTools::interpolate_boundary_values(
- dof_handler, 0, Functions::ConstantFunction<dim>(1), constraints);
+ VectorTools::interpolate_boundary_values(dof_handler,
+ 0,
+ Functions::ConstantFunction<dim>(1),
+ constraints);
constraints.close();
sparsity_pattern.reinit(dof_handler.n_dofs(),
dof_handler.n_dofs(),
dof_handler.max_couplings_between_dofs());
- DoFTools::make_sparsity_pattern(
- dof_handler, sparsity_pattern, constraints, false);
+ DoFTools::make_sparsity_pattern(dof_handler,
+ sparsity_pattern,
+ constraints,
+ false);
sparsity_pattern.compress();
system_matrix.reinit(sparsity_pattern);
// now do just the right hand side (with
// local matrix for eliminating
// inhomogeneities)
- constraints.distribute_local_to_global(
- cell_rhs, local_dof_indices, test, cell_matrix);
+ constraints.distribute_local_to_global(cell_rhs,
+ local_dof_indices,
+ test,
+ cell_matrix);
}
// and compare whether we really got the
acc * size * std::abs(value),
ExcInternalError());
const number l2_norma = vec.l2_norm();
- AssertThrow(
- std::abs(l2_norma - std::abs(value) * std::sqrt((number)size)) <
- acc * std::sqrt((number)size) * std::abs(value),
- ExcInternalError());
+ AssertThrow(std::abs(l2_norma -
+ std::abs(value) * std::sqrt((number)size)) <
+ acc * std::sqrt((number)size) * std::abs(value),
+ ExcInternalError());
}
}
}
// Check the vector
for (unsigned int i = 0; i < size; ++i)
- AssertThrow(
- std::abs(vec[i] - (double)i) < eps,
- ExcMessage("Value in the vector has been changed by boost archive"));
+ AssertThrow(std::abs(vec[i] - (double)i) < eps,
+ ExcMessage(
+ "Value in the vector has been changed by boost archive"));
}
class RightHandSide : public Function<dim>
{
public:
- RightHandSide() : Function<dim>()
+ RightHandSide()
+ : Function<dim>()
{}
virtual double
class BoundaryValues : public Function<dim>
{
public:
- BoundaryValues() : Function<dim>()
+ BoundaryValues()
+ : Function<dim>()
{}
virtual double
template <int dim>
-Step4<dim>::Step4() : fe(1), dof_handler(triangulation)
+Step4<dim>::Step4()
+ : fe(1)
+ , dof_handler(triangulation)
{}
constraints.clear();
std::map<unsigned int, double> boundary_values;
- VectorTools::interpolate_boundary_values(
- dof_handler, 0, BoundaryValues<dim>(), constraints);
+ VectorTools::interpolate_boundary_values(dof_handler,
+ 0,
+ BoundaryValues<dim>(),
+ constraints);
constraints.close();
DynamicSparsityPattern c_sparsity(dof_handler.n_dofs());
class RightHandSide : public Function<dim>
{
public:
- RightHandSide() : Function<dim>()
+ RightHandSide()
+ : Function<dim>()
{}
virtual double
class RightHandSideTwo : public Function<dim>
{
public:
- RightHandSideTwo() : Function<dim>()
+ RightHandSideTwo()
+ : Function<dim>()
{}
virtual double
class BoundaryValues : public Function<dim>
{
public:
- BoundaryValues() : Function<dim>()
+ BoundaryValues()
+ : Function<dim>()
{}
virtual double
template <int dim>
-Step4<dim>::Step4() :
- triangulation(MPI_COMM_WORLD,
- typename Triangulation<dim>::MeshSmoothing(
- Triangulation<dim>::smoothing_on_refinement |
- Triangulation<dim>::smoothing_on_coarsening)),
- fe(1),
- dof_handler(triangulation)
+Step4<dim>::Step4()
+ : triangulation(MPI_COMM_WORLD,
+ typename Triangulation<dim>::MeshSmoothing(
+ Triangulation<dim>::smoothing_on_refinement |
+ Triangulation<dim>::smoothing_on_coarsening))
+ , fe(1)
+ , dof_handler(triangulation)
{}
constraints.clear();
std::map<unsigned int, double> boundary_values;
- VectorTools::interpolate_boundary_values(
- dof_handler, 0, BoundaryValues<dim>(), constraints);
+ VectorTools::interpolate_boundary_values(dof_handler,
+ 0,
+ BoundaryValues<dim>(),
+ constraints);
constraints.close();
IndexSet locally_owned_dofs = dof_handler.locally_owned_dofs();
MPI_COMM_WORLD,
locally_relevant_dofs);
- system_matrix.reinit(
- locally_owned_dofs, locally_owned_dofs, dsp, MPI_COMM_WORLD);
+ system_matrix.reinit(locally_owned_dofs,
+ locally_owned_dofs,
+ dsp,
+ MPI_COMM_WORLD);
solution.reinit(locally_relevant_dofs, MPI_COMM_WORLD);
- system_rhs.reinit(
- locally_owned_dofs, locally_relevant_dofs, MPI_COMM_WORLD, true);
+ system_rhs.reinit(locally_owned_dofs,
+ locally_relevant_dofs,
+ MPI_COMM_WORLD,
+ true);
}
class RightHandSide : public Function<dim>
{
public:
- RightHandSide() : Function<dim>()
+ RightHandSide()
+ : Function<dim>()
{}
virtual double
class RightHandSideTwo : public Function<dim>
{
public:
- RightHandSideTwo() : Function<dim>()
+ RightHandSideTwo()
+ : Function<dim>()
{}
virtual double
class BoundaryValues : public Function<dim>
{
public:
- BoundaryValues() : Function<dim>()
+ BoundaryValues()
+ : Function<dim>()
{}
virtual double
template <int dim>
-Step4<dim>::Step4() :
- triangulation(MPI_COMM_WORLD,
- typename Triangulation<dim>::MeshSmoothing(
- Triangulation<dim>::smoothing_on_refinement |
- Triangulation<dim>::smoothing_on_coarsening)),
- fe(1),
- dof_handler(triangulation)
+Step4<dim>::Step4()
+ : triangulation(MPI_COMM_WORLD,
+ typename Triangulation<dim>::MeshSmoothing(
+ Triangulation<dim>::smoothing_on_refinement |
+ Triangulation<dim>::smoothing_on_coarsening))
+ , fe(1)
+ , dof_handler(triangulation)
{}
constraints.clear();
std::map<unsigned int, double> boundary_values;
- VectorTools::interpolate_boundary_values(
- dof_handler, 0, BoundaryValues<dim>(), constraints);
+ VectorTools::interpolate_boundary_values(dof_handler,
+ 0,
+ BoundaryValues<dim>(),
+ constraints);
constraints.close();
IndexSet locally_owned_dofs = dof_handler.locally_owned_dofs();
MPI_COMM_WORLD,
locally_relevant_dofs);
- system_matrix.reinit(
- locally_owned_dofs, locally_owned_dofs, dsp, MPI_COMM_WORLD);
+ system_matrix.reinit(locally_owned_dofs,
+ locally_owned_dofs,
+ dsp,
+ MPI_COMM_WORLD);
solution.reinit(locally_relevant_dofs, MPI_COMM_WORLD);
- system_rhs.reinit(
- locally_owned_dofs, locally_relevant_dofs, MPI_COMM_WORLD, true);
+ system_rhs.reinit(locally_owned_dofs,
+ locally_relevant_dofs,
+ MPI_COMM_WORLD,
+ true);
}
vector.reinit(partitioning);
// Assemble system: Mass matrix and constrant RHS vector
- FEValues<dim> fe_values(
- fe, quadrature_formula, update_values | update_JxW_values);
+ FEValues<dim> fe_values(fe,
+ quadrature_formula,
+ update_values | update_JxW_values);
const unsigned int n_q_points = quadrature_formula.size();
FullMatrix<double> cell_matrix(dofs_per_cell, dofs_per_cell);
Vector<double> cell_rhs(dofs_per_cell);
// TrilinosWrappers::SparseMatrix::vmult
out_lo_pyld = 0.0;
const size_type o_local_size = out_lo_pyld.end() - out_lo_pyld.begin();
- AssertDimension(
- o_local_size,
- static_cast<size_type>(lo_A.OperatorRangeMap().NumMyPoints()));
- PayloadVectorType tril_out_lo_pyld(
- View,
- lo_A.OperatorRangeMap(),
- const_cast<TrilinosScalar *>(out_lo_pyld.begin()),
- o_local_size,
- 1);
- const size_type b_local_size = b.end() - b.begin();
- AssertDimension(
- b_local_size,
- static_cast<size_type>(lo_A.OperatorDomainMap().NumMyPoints()));
+ AssertDimension(o_local_size,
+ static_cast<size_type>(
+ lo_A.OperatorRangeMap().NumMyPoints()));
+ PayloadVectorType tril_out_lo_pyld(View,
+ lo_A.OperatorRangeMap(),
+ const_cast<TrilinosScalar *>(
+ out_lo_pyld.begin()),
+ o_local_size,
+ 1);
+ const size_type b_local_size = b.end() - b.begin();
+ AssertDimension(b_local_size,
+ static_cast<size_type>(
+ lo_A.OperatorDomainMap().NumMyPoints()));
PayloadVectorType tril_b_pyld(View,
lo_A.OperatorDomainMap(),
const_cast<TrilinosScalar *>(b.begin()),
// Lastly we test functionality added by the Payload
out_lo_pyld = 0.0;
const size_type o_local_size = out_lo_pyld.end() - out_lo_pyld.begin();
- AssertDimension(
- o_local_size,
- static_cast<size_type>(lo_A_T.OperatorRangeMap().NumMyPoints()));
- PayloadVectorType tril_out_lo_pyld(
- View,
- lo_A_T.OperatorRangeMap(),
- const_cast<TrilinosScalar *>(out_lo_pyld.begin()),
- o_local_size,
- 1);
- const size_type b_local_size = b.end() - b.begin();
- AssertDimension(
- b_local_size,
- static_cast<size_type>(lo_A_T.OperatorDomainMap().NumMyPoints()));
+ AssertDimension(o_local_size,
+ static_cast<size_type>(
+ lo_A_T.OperatorRangeMap().NumMyPoints()));
+ PayloadVectorType tril_out_lo_pyld(View,
+ lo_A_T.OperatorRangeMap(),
+ const_cast<TrilinosScalar *>(
+ out_lo_pyld.begin()),
+ o_local_size,
+ 1);
+ const size_type b_local_size = b.end() - b.begin();
+ AssertDimension(b_local_size,
+ static_cast<size_type>(
+ lo_A_T.OperatorDomainMap().NumMyPoints()));
PayloadVectorType tril_b_pyld(View,
lo_A_T.OperatorDomainMap(),
const_cast<TrilinosScalar *>(b.begin()),
const auto lo_A_T_x_lo_A = lo_A_T * lo_A; // Construct composite operator
out_lo_pyld = 0.0;
const size_type o_local_size = out_lo_pyld.end() - out_lo_pyld.begin();
- AssertDimension(
- o_local_size,
- static_cast<size_type>(lo_A_T_x_lo_A.OperatorRangeMap().NumMyPoints()));
- PayloadVectorType tril_out_lo_pyld(
- View,
- lo_A_T_x_lo_A.OperatorRangeMap(),
- const_cast<TrilinosScalar *>(out_lo_pyld.begin()),
- o_local_size,
- 1);
- const size_type b_local_size = b.end() - b.begin();
+ AssertDimension(o_local_size,
+ static_cast<size_type>(
+ lo_A_T_x_lo_A.OperatorRangeMap().NumMyPoints()));
+ PayloadVectorType tril_out_lo_pyld(View,
+ lo_A_T_x_lo_A.OperatorRangeMap(),
+ const_cast<TrilinosScalar *>(
+ out_lo_pyld.begin()),
+ o_local_size,
+ 1);
+ const size_type b_local_size = b.end() - b.begin();
AssertDimension(b_local_size,
static_cast<size_type>(
lo_A_T_x_lo_A.OperatorDomainMap().NumMyPoints()));
transpose_operator(lo_A * lo_A_T); // Construct composite operator
out_lo_pyld = 0.0;
const size_type o_local_size = out_lo_pyld.end() - out_lo_pyld.begin();
- AssertDimension(
- o_local_size,
- static_cast<size_type>(lo_A_x_lo_A_T.OperatorRangeMap().NumMyPoints()));
- PayloadVectorType tril_out_lo_pyld(
- View,
- lo_A_x_lo_A_T.OperatorRangeMap(),
- const_cast<TrilinosScalar *>(out_lo_pyld.begin()),
- o_local_size,
- 1);
- const size_type b_local_size = b.end() - b.begin();
+ AssertDimension(o_local_size,
+ static_cast<size_type>(
+ lo_A_x_lo_A_T.OperatorRangeMap().NumMyPoints()));
+ PayloadVectorType tril_out_lo_pyld(View,
+ lo_A_x_lo_A_T.OperatorRangeMap(),
+ const_cast<TrilinosScalar *>(
+ out_lo_pyld.begin()),
+ o_local_size,
+ 1);
+ const size_type b_local_size = b.end() - b.begin();
AssertDimension(b_local_size,
static_cast<size_type>(
lo_A_x_lo_A_T.OperatorDomainMap().NumMyPoints()));
locally_owned_dofs = dof_handler.locally_owned_dofs();
locally_owned_partitioning.push_back(
locally_owned_dofs.get_view(0, dofs_per_block[0]));
- locally_owned_partitioning.push_back(locally_owned_dofs.get_view(
- dofs_per_block[0], dofs_per_block[0] + dofs_per_block[1]));
+ locally_owned_partitioning.push_back(
+ locally_owned_dofs.get_view(dofs_per_block[0],
+ dofs_per_block[0] + dofs_per_block[1]));
DoFTools::extract_locally_relevant_dofs(dof_handler, locally_relevant_dofs);
locally_relevant_partitioning.push_back(
locally_relevant_dofs.get_view(0, dofs_per_block[0]));
- locally_relevant_partitioning.push_back(locally_relevant_dofs.get_view(
- dofs_per_block[0], dofs_per_block[0] + dofs_per_block[1]));
+ locally_relevant_partitioning.push_back(
+ locally_relevant_dofs.get_view(dofs_per_block[0],
+ dofs_per_block[0] + dofs_per_block[1]));
constraints.clear();
constraints.reinit(locally_relevant_dofs);
locally_owned_partitioning,
locally_relevant_partitioning,
mpi_communicator);
- DoFTools::make_sparsity_pattern(
- dof_handler,
- coupling,
- dsp,
- constraints,
- false,
- Utilities::MPI::this_mpi_process(mpi_communicator));
+ DoFTools::make_sparsity_pattern(dof_handler,
+ coupling,
+ dsp,
+ constraints,
+ false,
+ Utilities::MPI::this_mpi_process(
+ mpi_communicator));
dsp.compress();
matrix.clear();
vector.reinit(locally_owned_partitioning, mpi_communicator);
// Assemble system: Mass matrix and constrant RHS vector
- FEValues<dim> fe_values(
- fe, quadrature_formula, update_values | update_JxW_values);
+ FEValues<dim> fe_values(fe,
+ quadrature_formula,
+ update_values | update_JxW_values);
const unsigned int n_q_points = quadrature_formula.size();
FullMatrix<double> cell_matrix(dofs_per_cell, dofs_per_cell);
Vector<double> cell_rhs(dofs_per_cell);
// TrilinosWrappers::SparseMatrix::vmult
out_lo_pyld = 0.0;
const size_type o_local_size = out_lo_pyld.end() - out_lo_pyld.begin();
- AssertDimension(
- o_local_size,
- static_cast<size_type>(lo_A.OperatorRangeMap().NumMyPoints()));
- PayloadVectorType tril_out_lo_pyld(
- View,
- lo_A.OperatorRangeMap(),
- const_cast<TrilinosScalar *>(out_lo_pyld.begin()),
- o_local_size,
- 1);
- const size_type b_local_size = b.end() - b.begin();
- AssertDimension(
- b_local_size,
- static_cast<size_type>(lo_A.OperatorDomainMap().NumMyPoints()));
+ AssertDimension(o_local_size,
+ static_cast<size_type>(
+ lo_A.OperatorRangeMap().NumMyPoints()));
+ PayloadVectorType tril_out_lo_pyld(View,
+ lo_A.OperatorRangeMap(),
+ const_cast<TrilinosScalar *>(
+ out_lo_pyld.begin()),
+ o_local_size,
+ 1);
+ const size_type b_local_size = b.end() - b.begin();
+ AssertDimension(b_local_size,
+ static_cast<size_type>(
+ lo_A.OperatorDomainMap().NumMyPoints()));
PayloadVectorType tril_b_pyld(View,
lo_A.OperatorDomainMap(),
const_cast<TrilinosScalar *>(b.begin()),
// Lastly we test functionality added by the Payload
out_lo_pyld = 0.0;
const size_type o_local_size = out_lo_pyld.end() - out_lo_pyld.begin();
- AssertDimension(
- o_local_size,
- static_cast<size_type>(lo_A_T.OperatorRangeMap().NumMyPoints()));
- PayloadVectorType tril_out_lo_pyld(
- View,
- lo_A_T.OperatorRangeMap(),
- const_cast<TrilinosScalar *>(out_lo_pyld.begin()),
- o_local_size,
- 1);
- const size_type b_local_size = b.end() - b.begin();
- AssertDimension(
- b_local_size,
- static_cast<size_type>(lo_A_T.OperatorDomainMap().NumMyPoints()));
+ AssertDimension(o_local_size,
+ static_cast<size_type>(
+ lo_A_T.OperatorRangeMap().NumMyPoints()));
+ PayloadVectorType tril_out_lo_pyld(View,
+ lo_A_T.OperatorRangeMap(),
+ const_cast<TrilinosScalar *>(
+ out_lo_pyld.begin()),
+ o_local_size,
+ 1);
+ const size_type b_local_size = b.end() - b.begin();
+ AssertDimension(b_local_size,
+ static_cast<size_type>(
+ lo_A_T.OperatorDomainMap().NumMyPoints()));
PayloadVectorType tril_b_pyld(View,
lo_A_T.OperatorDomainMap(),
const_cast<TrilinosScalar *>(b.begin()),
const auto lo_A_T_x_lo_A = lo_A_T * lo_A; // Construct composite operator
out_lo_pyld = 0.0;
const size_type o_local_size = out_lo_pyld.end() - out_lo_pyld.begin();
- AssertDimension(
- o_local_size,
- static_cast<size_type>(lo_A_T_x_lo_A.OperatorRangeMap().NumMyPoints()));
- PayloadVectorType tril_out_lo_pyld(
- View,
- lo_A_T_x_lo_A.OperatorRangeMap(),
- const_cast<TrilinosScalar *>(out_lo_pyld.begin()),
- o_local_size,
- 1);
- const size_type b_local_size = b.end() - b.begin();
+ AssertDimension(o_local_size,
+ static_cast<size_type>(
+ lo_A_T_x_lo_A.OperatorRangeMap().NumMyPoints()));
+ PayloadVectorType tril_out_lo_pyld(View,
+ lo_A_T_x_lo_A.OperatorRangeMap(),
+ const_cast<TrilinosScalar *>(
+ out_lo_pyld.begin()),
+ o_local_size,
+ 1);
+ const size_type b_local_size = b.end() - b.begin();
AssertDimension(b_local_size,
static_cast<size_type>(
lo_A_T_x_lo_A.OperatorDomainMap().NumMyPoints()));
transpose_operator(lo_A * lo_A_T); // Construct composite operator
out_lo_pyld = 0.0;
const size_type o_local_size = out_lo_pyld.end() - out_lo_pyld.begin();
- AssertDimension(
- o_local_size,
- static_cast<size_type>(lo_A_x_lo_A_T.OperatorRangeMap().NumMyPoints()));
- PayloadVectorType tril_out_lo_pyld(
- View,
- lo_A_x_lo_A_T.OperatorRangeMap(),
- const_cast<TrilinosScalar *>(out_lo_pyld.begin()),
- o_local_size,
- 1);
- const size_type b_local_size = b.end() - b.begin();
+ AssertDimension(o_local_size,
+ static_cast<size_type>(
+ lo_A_x_lo_A_T.OperatorRangeMap().NumMyPoints()));
+ PayloadVectorType tril_out_lo_pyld(View,
+ lo_A_x_lo_A_T.OperatorRangeMap(),
+ const_cast<TrilinosScalar *>(
+ out_lo_pyld.begin()),
+ o_local_size,
+ 1);
+ const size_type b_local_size = b.end() - b.begin();
AssertDimension(b_local_size,
static_cast<size_type>(
lo_A_x_lo_A_T.OperatorDomainMap().NumMyPoints()));
class MySquareFunction : public Function<dim>
{
public:
- MySquareFunction() : Function<dim>(2)
+ MySquareFunction()
+ : Function<dim>(2)
{}
virtual double
SparsityPattern sparsity(dof.n_boundary_dofs(function_map),
dof.max_couplings_between_boundary_dofs());
- DoFTools::make_boundary_sparsity_pattern(
- dof, function_map, dof_to_boundary_mapping, sparsity);
+ DoFTools::make_boundary_sparsity_pattern(dof,
+ function_map,
+ dof_to_boundary_mapping,
+ sparsity);
sparsity.compress();
SparseMatrix<double> matrix;
sparse_matrix.set(i, j, static_cast<signed int>(i - j));
MatrixOut matrix_out;
- matrix_out.build_patches(
- sparse_matrix, "sparse_matrix", MatrixOut::Options(true));
+ matrix_out.build_patches(sparse_matrix,
+ "sparse_matrix",
+ MatrixOut::Options(true));
matrix_out.write_eps(logfile);
};
(1. * i * i / 20 / 20 - 1. * j * j * j / 20 / 20 / 20);
MatrixOut matrix_out;
- matrix_out.build_patches(
- full_matrix, "collated_matrix", MatrixOut::Options(false, 4));
+ matrix_out.build_patches(full_matrix,
+ "collated_matrix",
+ MatrixOut::Options(false, 4));
matrix_out.write_gmv(logfile);
};
}
sparse_matrix.set(i, j, i + 3 * j);
MatrixOut matrix_out;
- matrix_out.build_patches(
- sparse_matrix, "sparse_matrix", MatrixOut::Options(true, 1, true));
+ matrix_out.build_patches(sparse_matrix,
+ "sparse_matrix",
+ MatrixOut::Options(true, 1, true));
matrix_out.write_gnuplot(logfile);
}
}
class FullMatrixModified : public FullMatrix<double>
{
public:
- FullMatrixModified(unsigned int size1, unsigned int size2) :
- FullMatrix<double>(size1, size2)
+ FullMatrixModified(unsigned int size1, unsigned int size2)
+ : FullMatrix<double>(size1, size2)
{}
double
template <typename number>
-QuickMatrix<number>::QuickMatrix(unsigned int nx, unsigned int ny) :
- nx(nx),
- ny(ny)
+QuickMatrix<number>::QuickMatrix(unsigned int nx, unsigned int ny)
+ : nx(nx)
+ , ny(ny)
{}
template <typename number>
SolverCG<Vector<double>> solver_S_approx(solver_control_S_approx);
PreconditionJacobi<SparseMatrix<double>> preconditioner_S_approx;
preconditioner_S_approx.initialize(A.block(0, 0)); // Same space as S
- const auto lo_S_inv_approx = inverse_operator(
- lo_S_approx, solver_S_approx, preconditioner_S_approx);
+ const auto lo_S_inv_approx = inverse_operator(lo_S_approx,
+ solver_S_approx,
+ preconditioner_S_approx);
// Setup outer solver: Exact inverse of Schur complement
SolverControl solver_control_S(11, 1.0e-10, false, false);
class BoundaryValues : public Function<dim>
{
public:
- BoundaryValues() : Function<dim>(dim + 1)
+ BoundaryValues()
+ : Function<dim>(dim + 1)
{}
virtual double
value(const Point<dim> &p, const unsigned int component = 0) const;
class RightHandSide : public Function<dim>
{
public:
- RightHandSide() : Function<dim>(dim + 1)
+ RightHandSide()
+ : Function<dim>(dim + 1)
{}
virtual double
value(const Point<dim> &p, const unsigned int component = 0) const;
}
template <int dim>
- StokesProblem<dim>::StokesProblem(const unsigned int degree) :
- degree(degree),
- triangulation(Triangulation<dim>::maximum_smoothing),
- fe(FE_Q<dim>(degree + 1), dim, FE_Q<dim>(degree), 1),
- dof_handler(triangulation)
+ StokesProblem<dim>::StokesProblem(const unsigned int degree)
+ : degree(degree)
+ , triangulation(Triangulation<dim>::maximum_smoothing)
+ , fe(FE_Q<dim>(degree + 1), dim, FE_Q<dim>(degree), 1)
+ , dof_handler(triangulation)
{}
template <int dim>
}
constraints.close();
std::vector<types::global_dof_index> dofs_per_block(2);
- DoFTools::count_dofs_per_block(
- dof_handler, dofs_per_block, block_component);
+ DoFTools::count_dofs_per_block(dof_handler,
+ dofs_per_block,
+ block_component);
const unsigned int n_u = dofs_per_block[0], n_p = dofs_per_block[1];
deallog << " Number of active cells: " << triangulation.n_active_cells()
<< std::endl
SparseILU<double> preconditioner_A;
preconditioner_A.initialize(system_matrix.block(0, 0),
SparseILU<double>::AdditionalData());
- ReductionControl solver_control_A(
- system_matrix.block(0, 0).m(), 1e-10, 1e-6);
- SolverCG<> solver_A(solver_control_A);
- const auto A_inv = inverse_operator(A, solver_A, preconditioner_A);
+ ReductionControl solver_control_A(system_matrix.block(0, 0).m(),
+ 1e-10,
+ 1e-6);
+ SolverCG<> solver_A(solver_control_A);
+ const auto A_inv = inverse_operator(A, solver_A, preconditioner_A);
// Inverse of mass matrix stored in block "D"
SparseILU<double> preconditioner_M;
preconditioner_M.initialize(system_matrix.block(1, 1),
SparseILU<double>::AdditionalData());
- ReductionControl solver_control_M(
- system_matrix.block(1, 1).m(), 1e-10, 1e-6);
- SolverCG<> solver_M(solver_control_M);
- const auto M_inv = inverse_operator(M, solver_M, preconditioner_M);
+ ReductionControl solver_control_M(system_matrix.block(1, 1).m(),
+ 1e-10,
+ 1e-6);
+ SolverCG<> solver_M(solver_control_M);
+ const auto M_inv = inverse_operator(M, solver_M, preconditioner_M);
// Schur complement
const auto S = schur_complement(A_inv, B, C, D0);
// Inverse of Schur complement
- ReductionControl solver_control_S(
- system_matrix.block(1, 1).m(), 1e-10, 1e-6);
- SolverCG<> solver_S(solver_control_S);
- const auto S_inv = inverse_operator(S, solver_S, M_inv);
+ ReductionControl solver_control_S(system_matrix.block(1, 1).m(),
+ 1e-10,
+ 1e-6);
+ SolverCG<> solver_S(solver_control_S);
+ const auto S_inv = inverse_operator(S, solver_S, M_inv);
Vector<double> & x = solution.block(0);
Vector<double> & y = solution.block(1);
solution,
estimated_error_per_cell,
fe.component_mask(pressure));
- GridRefinement::refine_and_coarsen_fixed_number(
- triangulation, estimated_error_per_cell, 0.3, 0.0);
+ GridRefinement::refine_and_coarsen_fixed_number(triangulation,
+ estimated_error_per_cell,
+ 0.3,
+ 0.0);
triangulation.execute_coarsening_and_refinement();
}
(dim == 2 ? Point<dim>(-2, -1) : Point<dim>(-2, 0, -1));
const Point<dim> top_right =
(dim == 2 ? Point<dim>(2, 0) : Point<dim>(2, 1, 0));
- GridGenerator::subdivided_hyper_rectangle(
- triangulation, subdivisions, bottom_left, top_right);
+ GridGenerator::subdivided_hyper_rectangle(triangulation,
+ subdivisions,
+ bottom_left,
+ top_right);
}
for (typename Triangulation<dim>::active_cell_iterator cell =
triangulation.begin_active();
cg.connect(&monitor_norm);
cg.connect(&monitor_mean);
- SolverGMRES<> gmres(
- control, mem, SolverGMRES<>::AdditionalData(/*max_vecs=*/8));
+ SolverGMRES<> gmres(control,
+ mem,
+ SolverGMRES<>::AdditionalData(/*max_vecs=*/8));
gmres.connect(&monitor_norm);
gmres.connect(&monitor_mean);
SolverGMRES<> solver_gmres(solver_control);
// Attach all possible slots.
solver_gmres.connect_condition_number_slot(
- std::bind(
- output_double_number, std::placeholders::_1, "Condition number: "),
+ std::bind(output_double_number,
+ std::placeholders::_1,
+ "Condition number: "),
true);
solver_gmres.connect_condition_number_slot(
std::bind(output_double_number,
GrowingVectorMemory<> mem;
SolverControl control(10, 1.e-13, false);
- SolverRichardson<> rich(
- control, mem, SolverRichardson<>::AdditionalData(/*omega=*/.01));
- SolverRichardson<> prich(
- control, mem, SolverRichardson<>::AdditionalData(/*omega=*/1.));
+ SolverRichardson<> rich(control,
+ mem,
+ SolverRichardson<>::AdditionalData(/*omega=*/.01));
+ SolverRichardson<> prich(control,
+ mem,
+ SolverRichardson<>::AdditionalData(/*omega=*/1.));
const types::global_dof_index block_size =
(types::global_dof_index)std::sqrt(A.n() + .3);
Vector<double> f(A.m());
GrowingVectorMemory<> mem;
- SolverControl control(10, 1.e-13, false);
- SolverRichardson<> rich(
- control, mem, SolverRichardson<>::AdditionalData(/*omega=*/.01));
- SolverRichardson<> prich(
- control, mem, SolverRichardson<>::AdditionalData(/*omega=*/1.));
+ SolverControl control(10, 1.e-13, false);
+ SolverRichardson<> rich(control,
+ mem,
+ SolverRichardson<>::AdditionalData(/*omega=*/.01));
+ SolverRichardson<> prich(control,
+ mem,
+ SolverRichardson<>::AdditionalData(/*omega=*/1.));
PreconditionIdentity identity;
PreconditionJacobi<BlockSparseMatrix<double>> jacobi;
jacobi.initialize(A, .5);
auto subtract_and_assign =
[](AlignedVector<VectorizedArray<double>> & lhs,
const AlignedVector<VectorizedArray<double>> &rhs) {
- std::transform(
- lhs.begin(),
- lhs.end(),
- rhs.begin(),
- lhs.begin(),
- [](const VectorizedArray<double> lval,
- const VectorizedArray<double> rval) { return lval - rval; });
+ std::transform(lhs.begin(),
+ lhs.end(),
+ rhs.begin(),
+ lhs.begin(),
+ [](const VectorizedArray<double> lval,
+ const VectorizedArray<double> rval) {
+ return lval - rval;
+ });
};
const ArrayView<VectorizedArray<double>> view1(v1.begin(), v1.size());
auto subtract_and_assign =
[](AlignedVector<VectorizedArray<double>> & lhs,
const AlignedVector<VectorizedArray<double>> &rhs) {
- std::transform(
- lhs.begin(),
- lhs.end(),
- rhs.begin(),
- lhs.begin(),
- [](const VectorizedArray<double> lval,
- const VectorizedArray<double> rval) { return lval - rval; });
+ std::transform(lhs.begin(),
+ lhs.end(),
+ rhs.begin(),
+ lhs.begin(),
+ [](const VectorizedArray<double> lval,
+ const VectorizedArray<double> rval) {
+ return lval - rval;
+ });
};
const ArrayView<VectorizedArray<double>> view1(v1.begin(), v1.size());
auto subtract_and_assign =
[](AlignedVector<VectorizedArray<float>> & lhs,
const AlignedVector<VectorizedArray<float>> &rhs) {
- std::transform(
- lhs.begin(),
- lhs.end(),
- rhs.begin(),
- lhs.begin(),
- [](const VectorizedArray<float> lval,
- const VectorizedArray<float> rval) { return lval - rval; });
+ std::transform(lhs.begin(),
+ lhs.end(),
+ rhs.begin(),
+ lhs.begin(),
+ [](const VectorizedArray<float> lval,
+ const VectorizedArray<float> rval) {
+ return lval - rval;
+ });
};
const ArrayView<VectorizedArray<float>> view1(v1.begin(), v1.size());
auto subtract_and_assign =
[](AlignedVector<VectorizedArray<double>> & lhs,
const AlignedVector<VectorizedArray<double>> &rhs) {
- std::transform(
- lhs.begin(),
- lhs.end(),
- rhs.begin(),
- lhs.begin(),
- [](const VectorizedArray<double> lval,
- const VectorizedArray<double> rval) { return lval - rval; });
+ std::transform(lhs.begin(),
+ lhs.end(),
+ rhs.begin(),
+ lhs.begin(),
+ [](const VectorizedArray<double> lval,
+ const VectorizedArray<double> rval) {
+ return lval - rval;
+ });
};
const ArrayView<VectorizedArray<double>> view1(v1.begin(), v1.size());
// estimate from CG
{
- ReductionControl control(
- k,
- std::sqrt(std::numeric_limits<double>::epsilon()),
- 1e-10,
- false,
- false);
+ ReductionControl control(k,
+ std::sqrt(
+ std::numeric_limits<double>::epsilon()),
+ 1e-10,
+ false,
+ false);
std::vector<double> estimated_eigenvalues;
SolverCG<PETScWrappers::MPI::Vector> solver(control);
solver.connect_eigenvalues_slot(
ConstraintMatrix constraints;
constraints.reinit(locally_relevant_dofs);
DoFTools::make_hanging_node_constraints(dof_handler, constraints);
- VectorTools::interpolate_boundary_values(
- dof_handler, 0, Functions::ZeroFunction<dim>(), constraints);
+ VectorTools::interpolate_boundary_values(dof_handler,
+ 0,
+ Functions::ZeroFunction<dim>(),
+ constraints);
constraints.close();
std::shared_ptr<MatrixFree<dim, double>> mf_data(
const unsigned int num_arnoldi_vectors = 2 * eigenvalues.size() + 10;
PArpackSolver<LinearAlgebra::distributed::Vector<double>>::AdditionalData
- additional_data(
- num_arnoldi_vectors,
- PArpackSolver<
- LinearAlgebra::distributed::Vector<double>>::largest_magnitude,
- true,
- 1);
+ additional_data(num_arnoldi_vectors,
+ PArpackSolver<LinearAlgebra::distributed::Vector<double>>::
+ largest_magnitude,
+ true,
+ 1);
SolverControl solver_control(dof_handler.n_dofs(),
1e-10,
{
const double err =
std::abs(eigenfunctions[j] * eigenfunctions[i] - (i == j));
- Assert(
- err < precision,
- ExcMessage("Eigenvectors " + Utilities::int_to_string(i) +
- " and " + Utilities::int_to_string(j) +
- " are not orthonormal: " + std::to_string(err)));
+ Assert(err < precision,
+ ExcMessage(
+ "Eigenvectors " + Utilities::int_to_string(i) + " and " +
+ Utilities::int_to_string(j) +
+ " are not orthonormal: " + std::to_string(err)));
}
OP.vmult(Ax, eigenfunctions[i]);
acc * size * std::abs(value),
ExcInternalError());
const number l2_norma = vec.l2_norm();
- AssertThrow(
- std::abs(l2_norma - std::abs(value) * std::sqrt((number)size)) <
- acc * std::sqrt((number)size) * std::abs(value),
- ExcInternalError());
+ AssertThrow(std::abs(l2_norma -
+ std::abs(value) * std::sqrt((number)size)) <
+ acc * std::sqrt((number)size) * std::abs(value),
+ ExcInternalError());
const number lp_norma = vec.lp_norm(3.);
AssertThrow(
std::abs(lp_norma -
new ::dealii::parallel::internal::TBBPartitioner());
Number *val;
- Utilities::System::posix_memalign(
- (void **)&val, 64, sizeof(Number) * size);
+ Utilities::System::posix_memalign((void **)&val,
+ 64,
+ sizeof(Number) * size);
const Number s = 3.1415;
internal::VectorOperations::Vector_set<Number> setter(s, val);
{
const unsigned int begin = i * chunk_size;
const unsigned int end = std::min((i + 1) * chunk_size, size);
- internal::VectorOperations::parallel_for(
- setter, begin, end, thread_loop_partitioner);
+ internal::VectorOperations::parallel_for(setter,
+ begin,
+ end,
+ thread_loop_partitioner);
}
// check values:
new ::dealii::parallel::internal::TBBPartitioner());
Number *val;
- Utilities::System::posix_memalign(
- (void **)&val, 64, sizeof(Number) * size);
+ Utilities::System::posix_memalign((void **)&val,
+ 64,
+ sizeof(Number) * size);
for (unsigned int i = 0; i < size; ++i)
val[i] = random_value<double>();
std::placeholders::_1,
"Condition number estimate: "),
true);
- cg.connect_eigenvalues_slot(std::bind(
- output_eigenvalues<double>, std::placeholders::_1, "Final Eigenvalues: "));
+ cg.connect_eigenvalues_slot(std::bind(output_eigenvalues<double>,
+ std::placeholders::_1,
+ "Final Eigenvalues: "));
for (unsigned int size = 4; size <= 30; size *= 3)
class MyFlatManifold : public ChartManifold<dim, spacedim, spacedim>
{
public:
- MyFlatManifold(const Tensor<1, spacedim> &periodicity) :
- ChartManifold<dim, spacedim, spacedim>(periodicity)
+ MyFlatManifold(const Tensor<1, spacedim> &periodicity)
+ : ChartManifold<dim, spacedim, spacedim>(periodicity)
{}
virtual std::unique_ptr<Manifold<dim, spacedim>>
class MyFlatManifold : public ChartManifold<dim, spacedim, spacedim + 1>
{
public:
- MyFlatManifold(const Tensor<1, spacedim + 1> &periodicity) :
- ChartManifold<dim, spacedim, spacedim + 1>(periodicity)
+ MyFlatManifold(const Tensor<1, spacedim + 1> &periodicity)
+ : ChartManifold<dim, spacedim, spacedim + 1>(periodicity)
{}
virtual std::unique_ptr<Manifold<dim, spacedim>>
class MyFlatManifold : public ChartManifold<dim, spacedim, spacedim>
{
public:
- MyFlatManifold(const Tensor<1, spacedim> &periodicity) :
- ChartManifold<dim, spacedim, spacedim>(periodicity)
+ MyFlatManifold(const Tensor<1, spacedim> &periodicity)
+ : ChartManifold<dim, spacedim, spacedim>(periodicity)
{}
class MyFlatManifold : public ChartManifold<dim, spacedim, spacedim>
{
public:
- MyFlatManifold(const Tensor<1, spacedim> &periodicity) :
- ChartManifold<dim, spacedim, spacedim>(periodicity)
+ MyFlatManifold(const Tensor<1, spacedim> &periodicity)
+ : ChartManifold<dim, spacedim, spacedim>(periodicity)
{}
virtual std::unique_ptr<Manifold<dim, spacedim>>
static const int spacedim = 3;
static const int chartdim = 3;
- MyCylinderManifold() : ChartManifold<dim, spacedim, spacedim>(periodicity)
+ MyCylinderManifold()
+ : ChartManifold<dim, spacedim, spacedim>(periodicity)
{}
static const int spacedim = 3;
static const int chartdim = 3;
- MyCylinderManifold() : ChartManifold<dim, spacedim, spacedim>(periodicity)
+ MyCylinderManifold()
+ : ChartManifold<dim, spacedim, spacedim>(periodicity)
{}
virtual std::unique_ptr<Manifold<2, 3>>
deallog << "=================================" << std::endl;
;
for (unsigned int i = 0; i < num_points; i++)
- deallog << manifold.get_intermediate_point(
- P1, P2, (1.0 * i) / (num_points - 1))
+ deallog << manifold.get_intermediate_point(P1,
+ P2,
+ (1.0 * i) / (num_points - 1))
<< std::endl;
deallog << "=================================" << std::endl;
}
SphericalManifold<3> spherical;
- Point<3> p1(
- -0.036923837121444085, -0.87096345314118251, -0.075394254055706517);
- Point<3> p2(
- -0.037583190343442631, -0.8865163726762405, -0.076740572095662762);
+ Point<3> p1(-0.036923837121444085,
+ -0.87096345314118251,
+ -0.075394254055706517);
+ Point<3> p2(-0.037583190343442631,
+ -0.8865163726762405,
+ -0.076740572095662762);
// when projected to radius one, both points are almost the same:
// p1/p1.norm() : [-0.042198670995936091, -0.99538680358992271,
// at outer boundary, the normal should point outwards and be
// aligned with the point down to roundoff. Check this for the
// second face vertex as well as the center.
- deallog << "Outer normal correctness (should be 0): "
- << (1.0 - cell->face(f)->vertex(1) *
- spherical.normal_vector(
- cell->face(f), cell->face(f)->vertex(1)))
- << " "
- << (1.0 -
- cell->face(f)->center(/*respect_manifold=*/true) *
- spherical.normal_vector(
- cell->face(f), cell->face(f)->center(true)))
- << std::endl;
+ deallog
+ << "Outer normal correctness (should be 0): "
+ << (1.0 - cell->face(f)->vertex(1) *
+ spherical.normal_vector(cell->face(f),
+ cell->face(f)->vertex(1)))
+ << " "
+ << (1.0 -
+ cell->face(f)->center(/*respect_manifold=*/true) *
+ spherical.normal_vector(cell->face(f),
+ cell->face(f)->center(true)))
+ << std::endl;
}
else if (std::abs(cell->face(f)->vertex(1).norm() - 0.5) < 1e-1)
{
// at inner boundary, the normal should point inwards and be
// aligned with the point down to roundoff. Check this for the
// second face vertex as well as the center.
- deallog << "Inner normal correctness (should be 0): "
- << (0.5 - cell->face(f)->vertex(1) *
- spherical.normal_vector(
- cell->face(f), cell->face(f)->vertex(1)))
- << " "
- << (0.5 -
- cell->face(f)->center(/*respect_manifold=*/true) *
- spherical.normal_vector(
- cell->face(f), cell->face(f)->center(true)))
- << std::endl;
+ deallog
+ << "Inner normal correctness (should be 0): "
+ << (0.5 - cell->face(f)->vertex(1) *
+ spherical.normal_vector(cell->face(f),
+ cell->face(f)->vertex(1)))
+ << " "
+ << (0.5 -
+ cell->face(f)->center(/*respect_manifold=*/true) *
+ spherical.normal_vector(cell->face(f),
+ cell->face(f)->center(true)))
+ << std::endl;
}
}
for (auto cell : tria.active_cell_iterators())
// adjust the point to lie on the same radius as the vertex points
// by a weighting where the normal should again be perfectly aligned
// with the point itself.
- deallog << "Approximate normal in " << cell->face(f)->center(false)
- << ": "
- << spherical.normal_vector(cell->face(f),
- cell->face(f)->center(false))
- << ", adjusted: "
- << spherical.normal_vector(
- cell->face(f),
- cell->face(f)->center(false) /
- cell->face(f)->center(false).norm() *
- cell->face(f)->vertex(1).norm())
- << std::endl;
+ deallog
+ << "Approximate normal in " << cell->face(f)->center(false) << ": "
+ << spherical.normal_vector(cell->face(f),
+ cell->face(f)->center(false))
+ << ", adjusted: "
+ << spherical.normal_vector(cell->face(f),
+ cell->face(f)->center(false) /
+ cell->face(f)->center(false).norm() *
+ cell->face(f)->vertex(1).norm())
+ << std::endl;
}
return 0;
const double tolerance = 1e-8;
for (unsigned int q = 0; q < quadrature.size(); ++q)
{
- const Tensor<1, dim> normal_manifold = spherical.normal_vector(
- cell->face(f), fe_values.quadrature_point(q));
+ const Tensor<1, dim> normal_manifold =
+ spherical.normal_vector(cell->face(f),
+ fe_values.quadrature_point(q));
const Tensor<1, dim> normal_feval = fe_values.normal_vector(q);
if (std::abs(1.0 - std::abs(normal_manifold * normal_feval)) >
tolerance)
const double tolerance = 1e-7;
for (unsigned int q = 0; q < quadrature.size(); ++q)
{
- const Tensor<1, dim> normal_manifold = spherical.normal_vector(
- cell->face(f), fe_values.quadrature_point(q));
+ const Tensor<1, dim> normal_manifold =
+ spherical.normal_vector(cell->face(f),
+ fe_values.quadrature_point(q));
if (cell->face(f)->boundary_id() == 2)
{
- const Tensor<1, dim> normal_flat = flat.normal_vector(
- cell->face(f), fe_values.quadrature_point(q));
+ const Tensor<1, dim> normal_flat =
+ flat.normal_vector(cell->face(f),
+ fe_values.quadrature_point(q));
if (std::abs(1.0 - std::abs(normal_manifold * normal_flat)) >
tolerance)
deallog
points.push_back(cell->face(face)->vertex(0));
points.push_back(cell->face(face)->vertex(1));
std::vector<double> weights(2);
- weights[0] = 0.1;
- weights[1] = 0.9;
- Point<spacedim> p = cell->get_manifold().get_new_point(
- make_array_view(points), make_array_view(weights));
+ weights[0] = 0.1;
+ weights[1] = 0.9;
+ Point<spacedim> p =
+ cell->get_manifold().get_new_point(make_array_view(points),
+ make_array_view(weights));
Point<spacedim> pref =
cell->face(face)->get_manifold().get_new_point(
make_array_view(points), make_array_view(weights));
points.push_back(cell->face(face)->vertex(0));
points.push_back(cell->face(face)->vertex(1));
std::vector<double> weights(2);
- weights[0] = 0.1;
- weights[1] = 0.9;
- Point<spacedim> p = cell->get_manifold().get_new_point(
- make_array_view(points), make_array_view(weights));
+ weights[0] = 0.1;
+ weights[1] = 0.9;
+ Point<spacedim> p =
+ cell->get_manifold().get_new_point(make_array_view(points),
+ make_array_view(weights));
Point<spacedim> pref =
cell->face(face)->get_manifold().get_new_point(
make_array_view(points), make_array_view(weights));
points.push_back(cell->face(face)->vertex(0));
points.push_back(cell->face(face)->vertex(1));
std::vector<double> weights(2);
- weights[0] = 0.1;
- weights[1] = 0.9;
- Point<spacedim> p = cell->get_manifold().get_new_point(
- make_array_view(points), make_array_view(weights));
+ weights[0] = 0.1;
+ weights[1] = 0.9;
+ Point<spacedim> p =
+ cell->get_manifold().get_new_point(make_array_view(points),
+ make_array_view(weights));
Point<spacedim> pref =
cell->face(face)->get_manifold().get_new_point(
make_array_view(points), make_array_view(weights));
cell_idx++;
}
- tria.create_triangulation(
- vertices, cells, SubCellData()); // no boundary information
+ tria.create_triangulation(vertices,
+ cells,
+ SubCellData()); // no boundary information
double eps = 1e-5 * x[0];
unsigned int label = 100;
};
template <int dim>
-Mygrid<dim>::Mygrid(unsigned int r) : refinement(r)
+Mygrid<dim>::Mygrid(unsigned int r)
+ : refinement(r)
{}
template <int dim>
const double outer_radius = 0.5;
const double tol = 1e-6;
Triangulation<dim> tria;
- GridGenerator::hyper_cube_with_cylindrical_hole(
- tria, inner_radius, outer_radius);
+ GridGenerator::hyper_cube_with_cylindrical_hole(tria,
+ inner_radius,
+ outer_radius);
tria.reset_all_manifolds();
// Enumerate the flat boundaries and the curved one separately. Also provide
QGauss<dim - 1> q(4);
Assert(q.size() == 1, ExcInternalError());
- FEFaceValues<dim> fe_values(
- mapping,
- fe,
- q,
- UpdateFlags(update_quadrature_points | update_JxW_values | update_values |
- update_gradients | update_hessians | update_normal_vectors));
+ FEFaceValues<dim> fe_values(mapping,
+ fe,
+ q,
+ UpdateFlags(update_quadrature_points |
+ update_JxW_values | update_values |
+ update_gradients | update_hessians |
+ update_normal_vectors));
for (unsigned int face_nr = 0; face_nr < GeometryInfo<dim>::faces_per_cell;
++face_nr)
QGauss<dim - 1> q(4);
Assert(q.size() == 1, ExcInternalError());
- FEFaceValues<dim> fe_values(
- mapping,
- fe,
- q,
- UpdateFlags(update_quadrature_points | update_JxW_values | update_values |
- update_gradients | update_hessians | update_normal_vectors));
+ FEFaceValues<dim> fe_values(mapping,
+ fe,
+ q,
+ UpdateFlags(update_quadrature_points |
+ update_JxW_values | update_values |
+ update_gradients | update_hessians |
+ update_normal_vectors));
for (unsigned int face_nr = 0; face_nr < GeometryInfo<dim>::faces_per_cell;
++face_nr)
const unsigned int nq =
(unsigned int)(.01 + std::pow(q.size(), 1. / (dim - 1)));
- FESubfaceValues<dim> fe_values(
- mapping,
- fe,
- q,
- UpdateFlags(update_quadrature_points | update_normal_vectors));
+ FESubfaceValues<dim> fe_values(mapping,
+ fe,
+ q,
+ UpdateFlags(update_quadrature_points |
+ update_normal_vectors));
for (unsigned int face_nr = 0; face_nr < GeometryInfo<dim>::faces_per_cell;
++face_nr)
for (unsigned int sub_nr = 0;
cells[0].vertices[j] = cell_vertices[0][j];
cells[0].material_id = 0;
- tria->create_triangulation(
- std::vector<Point<2>>(&vertices[0], &vertices[4]),
- cells,
- SubCellData());
+ tria->create_triangulation(std::vector<Point<2>>(&vertices[0],
+ &vertices[4]),
+ cells,
+ SubCellData());
exact_areas.push_back(9.);
}
QIterated<dim> quadrature_formula(QTrapez<1>(), fe.degree);
- FEValues<dim, spacedim> fe_values(
- map_fe, fe_sys, quadrature_formula, update_values | update_JxW_values);
+ FEValues<dim, spacedim> fe_values(map_fe,
+ fe_sys,
+ quadrature_formula,
+ update_values | update_JxW_values);
typename DoFHandler<dim, spacedim>::active_cell_iterator cell =
dof_sys
IndexSet locally_relevant_euler;
DoFTools::extract_locally_relevant_dofs(dh, locally_relevant_euler);
- map_vector.reinit(
- dh.locally_owned_dofs(), locally_relevant_euler, MPI_COMM_WORLD);
+ map_vector.reinit(dh.locally_owned_dofs(),
+ locally_relevant_euler,
+ MPI_COMM_WORLD);
VectorTools::get_position_vector(dh, map_vector);
break;
}
- const FESystem<dim, spacedim> fesystem(
- FE_Q<dim, spacedim>(1), 1, FE_Bernstein<dim, spacedim>(2), spacedim);
+ const FESystem<dim, spacedim> fesystem(FE_Q<dim, spacedim>(1),
+ 1,
+ FE_Bernstein<dim, spacedim>(2),
+ spacedim);
DoFHandler<dim, spacedim> dhb(triangulation);
dhb.distribute_dofs(fesystem);
break;
}
- const FESystem<dim, spacedim> fesystem(
- FE_Q<dim, spacedim>(1), 1, FE_Q<dim, spacedim>(2), spacedim);
+ const FESystem<dim, spacedim> fesystem(FE_Q<dim, spacedim>(1),
+ 1,
+ FE_Q<dim, spacedim>(2),
+ spacedim);
DoFHandler<dim, spacedim> dhq(triangulation);
dhq.distribute_dofs(fesystem);
MappingManifold<dim, spacedim> mapping;
- FEValues<dim, spacedim> fe_values(
- mapping, fe, quad, update_quadrature_points);
+ FEValues<dim, spacedim> fe_values(mapping,
+ fe,
+ quad,
+ update_quadrature_points);
for (typename Triangulation<dim, spacedim>::active_cell_iterator cell =
triangulation.begin_active();
MappingManifold<dim, spacedim> mapping_manifold;
MappingQGeneric<dim, spacedim> mapping_q(1);
- FEValues<dim, spacedim> fe_values_mapping(
- mapping_manifold, fe, quad, update_jacobians);
+ FEValues<dim, spacedim> fe_values_mapping(mapping_manifold,
+ fe,
+ quad,
+ update_jacobians);
FEValues<dim, spacedim> fe_values_q(mapping_q, fe, quad, update_jacobians);
MappingManifold<dim, spacedim> mapping_manifold;
MappingQGeneric<dim, spacedim> mapping_q(1);
- FEValues<dim, spacedim> fe_values_mapping(
- mapping_manifold, fe, quad, update_jacobians);
+ FEValues<dim, spacedim> fe_values_mapping(mapping_manifold,
+ fe,
+ quad,
+ update_jacobians);
FEValues<dim, spacedim> fe_values_q(mapping_q, fe, quad, update_jacobians);
MappingManifold<dim, spacedim> mapping_manifold;
MappingQGeneric<dim, spacedim> mapping_q(1);
- FEFaceValues<dim, spacedim> fe_values_mapping(
- mapping_manifold, fe, quad, update_jacobians);
-
- FEFaceValues<dim, spacedim> fe_values_q(
- mapping_q, fe, quad, update_jacobians);
+ FEFaceValues<dim, spacedim> fe_values_mapping(mapping_manifold,
+ fe,
+ quad,
+ update_jacobians);
+
+ FEFaceValues<dim, spacedim> fe_values_q(mapping_q,
+ fe,
+ quad,
+ update_jacobians);
typename Triangulation<dim, spacedim>::active_cell_iterator cell =
triangulation.begin_active();
FE_Q<dim, spacedim> fe(1);
const QGauss<dim - 1> quad(3);
- FEFaceValues<dim, spacedim> fe_v(
- map_manifold, fe, quad, update_JxW_values);
- double area = 0;
+ FEFaceValues<dim, spacedim> fe_v(map_manifold,
+ fe,
+ quad,
+ update_JxW_values);
+ double area = 0;
for (typename Triangulation<dim, spacedim>::active_cell_iterator cell =
triangulation.begin_active();
};
-LaplaceProblem::LaplaceProblem() : fe(1), dof_handler(triangulation)
+LaplaceProblem::LaplaceProblem()
+ : fe(1)
+ , dof_handler(triangulation)
{}
for (unsigned int i = 0; i < dofs_per_cell; ++i)
for (unsigned int j = 0; j < dofs_per_cell; ++j)
- system_matrix.add(
- local_dof_indices[i], local_dof_indices[j], cell_matrix(i, j));
+ system_matrix.add(local_dof_indices[i],
+ local_dof_indices[j],
+ cell_matrix(i, j));
for (unsigned int i = 0; i < dofs_per_cell; ++i)
system_rhs(local_dof_indices[i]) += cell_rhs(i);
std::map<types::global_dof_index, double> boundary_values;
- VectorTools::interpolate_boundary_values(
- dof_handler, 0, Functions::ZeroFunction<2>(), boundary_values);
- MatrixTools::apply_boundary_values(
- boundary_values, system_matrix, solution, system_rhs);
+ VectorTools::interpolate_boundary_values(dof_handler,
+ 0,
+ Functions::ZeroFunction<2>(),
+ boundary_values);
+ MatrixTools::apply_boundary_values(boundary_values,
+ system_matrix,
+ solution,
+ system_rhs);
}
for (unsigned int face = 0; face < GeometryInfo<2>::faces_per_cell; ++face)
{
deallog << "For face: " << face << ", the test point projects to: "
- << mapping.project_real_point_to_unit_point_on_face(
- cell, face, testp)
+ << mapping.project_real_point_to_unit_point_on_face(cell,
+ face,
+ testp)
<< std::endl;
}
}
for (unsigned int face = 0; face < GeometryInfo<3>::faces_per_cell; ++face)
{
deallog << "For face: " << face << ", the test point projects to: "
- << mapping.project_real_point_to_unit_point_on_face(
- cell, face, testp)
+ << mapping.project_real_point_to_unit_point_on_face(cell,
+ face,
+ testp)
<< std::endl;
}
}
for (unsigned int face = 0; face < GeometryInfo<3>::faces_per_cell; ++face)
{
deallog << "For face: " << face << ", the test point projects to: "
- << mapping.project_real_point_to_unit_point_on_face(
- cell, face, testp)
+ << mapping.project_real_point_to_unit_point_on_face(cell,
+ face,
+ testp)
<< std::endl;
}
}
static constexpr int dim = 2;
public:
- RefineTest(const unsigned int refine_case) :
- triangulation(),
- dof_handler(triangulation),
- refine_case(refine_case)
+ RefineTest(const unsigned int refine_case)
+ : triangulation()
+ , dof_handler(triangulation)
+ , refine_case(refine_case)
{
make_grid();
test_mapping();
class Displacement : public Function<dim>
{
public:
- Displacement() : Function<dim>(dim)
+ Displacement()
+ : Function<dim>(dim)
{}
double
MappingQ<3> mapping(4);
QGauss<2> q_face(3);
- FEFaceValues<3> fe_face_values(
- mapping, fe, q_face, update_normal_vectors | update_JxW_values);
+ FEFaceValues<3> fe_face_values(mapping,
+ fe,
+ q_face,
+ update_normal_vectors | update_JxW_values);
fe_face_values.reinit(dof_handler.begin_active(), 0);
// if we got here, we got past the previous
class ImposedDisplacement : public Function<dim>
{
public:
- ImposedDisplacement() : Function<dim>(dim)
+ ImposedDisplacement()
+ : Function<dim>(dim)
{}
virtual void
vector_value(const Point<dim> &p, Vector<double> &value) const;
// .... CONSTRUCTOR
template <int dim>
-MappingTest<dim>::MappingTest(unsigned int degree) :
- dof_handler(triangulation),
- fe(FE_Q<dim>(degree), dim),
- degree(degree)
+MappingTest<dim>::MappingTest(unsigned int degree)
+ : dof_handler(triangulation)
+ , fe(FE_Q<dim>(degree), dim)
+ , degree(degree)
{}
dof_handler.distribute_dofs(fe);
displacements.reinit(dof_handler.n_dofs());
- VectorTools::interpolate(
- MappingQGeneric<dim>(1), dof_handler, imposed_displacement, displacements);
+ VectorTools::interpolate(MappingQGeneric<dim>(1),
+ dof_handler,
+ imposed_displacement,
+ displacements);
explicitly_move_mesh();
}
class Displacement : public Function<dim>
{
public:
- Displacement() : Function<dim>(dim)
+ Displacement()
+ : Function<dim>(dim)
{}
double
class Displacement : public Function<dim>
{
public:
- Displacement() : Function<dim>(dim)
+ Displacement()
+ : Function<dim>(dim)
{}
double
class Displacement : public Function<dim>
{
public:
- Displacement() : Function<dim>(dim)
+ Displacement()
+ : Function<dim>(dim)
{}
double
grid_out.write_ucd(tria, logfile);
QTrapez<dim> quad;
- MappingQEulerian<dim, Vector<double>, spacedim> mapping(
- degree, shift_dh, shift);
+ MappingQEulerian<dim, Vector<double>, spacedim> mapping(degree,
+ shift_dh,
+ shift);
typename Triangulation<dim, spacedim>::active_cell_iterator
cell = tria.begin_active(),
shift(i) = 0.1;
QGauss<dim> quad(degree + 1);
- MappingQEulerian<dim, Vector<double>, spacedim> mapping(
- degree, shift_dh, shift);
+ MappingQEulerian<dim, Vector<double>, spacedim> mapping(degree,
+ shift_dh,
+ shift);
Triangulation<dim, spacedim>::active_cell_iterator cell = tria.begin_active(),
endc = tria.end();
class Displacement : public Function<dim>
{
public:
- Displacement() : Function<dim>(dim)
+ Displacement()
+ : Function<dim>(dim)
{}
double
DoFTools::extract_locally_relevant_dofs(dof_handler, locally_relevant_dofs);
PETScWrappers::MPI::Vector x(locally_owned_dofs, MPI_COMM_WORLD);
- PETScWrappers::MPI::Vector x_relevant(
- locally_owned_dofs, locally_relevant_dofs, MPI_COMM_WORLD);
+ PETScWrappers::MPI::Vector x_relevant(locally_owned_dofs,
+ locally_relevant_dofs,
+ MPI_COMM_WORLD);
VectorTools::interpolate(dof_handler, Displacement<dim>(), x);
x_relevant = x;
- MappingQEulerian<dim, PETScWrappers::MPI::Vector> euler(
- 2, dof_handler, x_relevant);
+ MappingQEulerian<dim, PETScWrappers::MPI::Vector> euler(2,
+ dof_handler,
+ x_relevant);
// now the actual test
DataOut<dim> data_out;
class Displacement : public Function<dim>
{
public:
- Displacement() : Function<dim>(dim)
+ Displacement()
+ : Function<dim>(dim)
{}
double
// Displacement vector
LinearAlgebra::distributed::Vector<NumberType> displacement;
- displacement.reinit(
- locally_owned_dofs_euler, locally_relevant_dofs_euler, mpi_communicator);
+ displacement.reinit(locally_owned_dofs_euler,
+ locally_relevant_dofs_euler,
+ mpi_communicator);
VectorTools::project<dim,
LinearAlgebra::distributed::Vector<NumberType>,
const unsigned int min_level = 0;
MGLevelObject<LinearAlgebra::distributed::Vector<LevelNumberType>>
displacement_level(min_level, max_level);
- mg_transfer_euler.interpolate_to_mg(
- dof_handler_euler, displacement_level, displacement);
+ mg_transfer_euler.interpolate_to_mg(dof_handler_euler,
+ displacement_level,
+ displacement);
// First, check fine-level only:
{
ConstraintMatrix level_constraints;
IndexSet relevant_dofs;
- DoFTools::extract_locally_relevant_level_dofs(
- dof_handler, level, relevant_dofs);
+ DoFTools::extract_locally_relevant_level_dofs(dof_handler,
+ level,
+ relevant_dofs);
level_constraints.reinit(relevant_dofs);
level_constraints.add_lines(
mg_constrained_dofs.get_boundary_indices(level));
MatrixFree<dim, LevelNumberType> mg_level_euler;
MappingQEulerian<dim, LinearAlgebra::distributed::Vector<LevelNumberType>>
- euler_level(
- euler_fe_degree, dof_handler_euler, displacement_level[level], level);
+ euler_level(euler_fe_degree,
+ dof_handler_euler,
+ displacement_level[level],
+ level);
mg_level_euler.reinit(euler_level,
dof_handler,
mg_additional_data);
MatrixFree<dim, LevelNumberType> mg_level;
- mg_level.reinit(
- dof_handler, level_constraints, quadrature_formula, mg_additional_data);
+ mg_level.reinit(dof_handler,
+ level_constraints,
+ quadrature_formula,
+ mg_additional_data);
// go through all cells and quadrature points:
{
for (unsigned int v = 0;
v < VectorizedArray<NumberType>::n_array_elements;
++v)
- AssertThrow(
- dist[v] < 1e-8,
- ExcMessage("Level " + std::to_string(level) +
- " distance: " + std::to_string(dist[v])));
+ AssertThrow(dist[v] < 1e-8,
+ ExcMessage(
+ "Level " + std::to_string(level) +
+ " distance: " + std::to_string(dist[v])));
}
}
}
class Displacement : public Function<dim>
{
public:
- Displacement() : Function<dim>(dim)
+ Displacement()
+ : Function<dim>(dim)
{}
double
// Displacement vector
LinearAlgebra::distributed::Vector<NumberType> displacement;
- displacement.reinit(
- locally_owned_dofs_euler, locally_relevant_dofs_euler, mpi_communicator);
+ displacement.reinit(locally_owned_dofs_euler,
+ locally_relevant_dofs_euler,
+ mpi_communicator);
displacement = 0.;
Displacement<dim> displacement_function;
// first, move via mapping:
- VectorTools::interpolate(
- dof_handler_euler, displacement_function, displacement);
+ VectorTools::interpolate(dof_handler_euler,
+ displacement_function,
+ displacement);
displacement.compress(VectorOperation::insert);
displacement.update_ghost_values();
class Displacement : public Function<dim>
{
public:
- Displacement() : Function<dim>(dim)
+ Displacement()
+ : Function<dim>(dim)
{}
double
DoFTools::extract_locally_relevant_dofs(dof_handler, locally_relevant_dofs);
TrilinosWrappers::MPI::Vector x(locally_owned_dofs, MPI_COMM_WORLD);
- TrilinosWrappers::MPI::Vector x_relevant(
- locally_owned_dofs, locally_relevant_dofs, MPI_COMM_WORLD);
+ TrilinosWrappers::MPI::Vector x_relevant(locally_owned_dofs,
+ locally_relevant_dofs,
+ MPI_COMM_WORLD);
VectorTools::interpolate(dof_handler, Displacement<dim>(), x);
x_relevant = x;
- MappingQEulerian<dim, TrilinosWrappers::MPI::Vector> euler(
- 2, dof_handler, x_relevant);
+ MappingQEulerian<dim, TrilinosWrappers::MPI::Vector> euler(2,
+ dof_handler,
+ x_relevant);
// now the actual test
std::map<unsigned int, Point<dim>> active_vertices =
class VectorFunction : public Function<dim>
{
public:
- VectorFunction(unsigned n_components) : Function<dim>(n_components)
+ VectorFunction(unsigned n_components)
+ : Function<dim>(n_components)
{}
virtual double
value(const Point<dim> &p, const unsigned int component) const;
class PushForward : public Function<dim>
{
public:
- PushForward() :
- Function<dim>(dim, 0.),
- h(0.028),
- x_max(4.5 * h),
- y_max(2.036 * h),
- z_max(4.5 * h),
- y_FoR(h)
+ PushForward()
+ : Function<dim>(dim, 0.)
+ , h(0.028)
+ , x_max(4.5 * h)
+ , y_max(2.036 * h)
+ , z_max(4.5 * h)
+ , y_FoR(h)
{}
virtual ~PushForward(){};
class PullBack : public Function<dim>
{
public:
- PullBack() :
- Function<dim>(dim, 0.),
- h(0.028),
- x_max(4.5 * h),
- y_max(2.036 * h),
- z_max(4.5 * h),
- y_FoR(h)
+ PullBack()
+ : Function<dim>(dim, 0.)
+ , h(0.028)
+ , x_max(4.5 * h)
+ , y_max(2.036 * h)
+ , z_max(4.5 * h)
+ , y_FoR(h)
{}
virtual ~PullBack(){};
template <int dim, int fe_degree>
struct Data
{
- Data(const FiniteElement<dim> &fe) :
- fe_values(fe,
- QGauss<dim>(fe.degree + 1),
- update_values | update_gradients | update_JxW_values),
- fe_eval(1,
- FEEvaluation<dim, fe_degree>(fe,
- QGauss<1>(fe.degree + 1),
- fe_values.get_update_flags())),
- cell_matrix(fe.dofs_per_cell, fe.dofs_per_cell),
- test_matrix(cell_matrix)
+ Data(const FiniteElement<dim> &fe)
+ : fe_values(fe,
+ QGauss<dim>(fe.degree + 1),
+ update_values | update_gradients | update_JxW_values)
+ , fe_eval(1,
+ FEEvaluation<dim, fe_degree>(fe,
+ QGauss<1>(fe.degree + 1),
+ fe_values.get_update_flags()))
+ , cell_matrix(fe.dofs_per_cell, fe.dofs_per_cell)
+ , test_matrix(cell_matrix)
{}
- Data(const Data &data) :
- fe_values(data.fe_values.get_mapping(),
- data.fe_values.get_fe(),
- data.fe_values.get_quadrature(),
- data.fe_values.get_update_flags()),
- fe_eval(data.fe_eval),
- cell_matrix(data.cell_matrix),
- test_matrix(data.test_matrix)
+ Data(const Data &data)
+ : fe_values(data.fe_values.get_mapping(),
+ data.fe_values.get_fe(),
+ data.fe_values.get_quadrature(),
+ data.fe_values.get_update_flags())
+ , fe_eval(data.fe_eval)
+ , cell_matrix(data.cell_matrix)
+ , test_matrix(data.test_matrix)
{}
FEValues<dim> fe_values;
int
main(int argc, char **argv)
{
- Utilities::MPI::MPI_InitFinalize mpi_init(
- argc, argv, testing_max_num_threads());
- MPILogInitAll log;
+ Utilities::MPI::MPI_InitFinalize mpi_init(argc,
+ argv,
+ testing_max_num_threads());
+ MPILogInitAll log;
test<2>();
test<3>();
}
{
int dummy;
result.zero_out_ghosts();
- data.cell_loop(
- &LaplaceOperator::local_diagonal_by_cell, this, result, dummy);
+ data.cell_loop(&LaplaceOperator::local_diagonal_by_cell,
+ this,
+ result,
+ dummy);
}
void
dof.distribute_dofs(fe);
ConstraintMatrix constraints;
DoFTools::make_hanging_node_constraints(dof, constraints);
- VectorTools::interpolate_boundary_values(
- dof, 0, Functions::ZeroFunction<dim>(), constraints);
+ VectorTools::interpolate_boundary_values(dof,
+ 0,
+ Functions::ZeroFunction<dim>(),
+ constraints);
constraints.close();
const QGauss<1> quad(2);
dof.distribute_dofs(fe);
ConstraintMatrix constraints;
DoFTools::make_hanging_node_constraints(dof, constraints);
- VectorTools::interpolate_boundary_values(
- dof, 0, Functions::ZeroFunction<dim>(), constraints);
+ VectorTools::interpolate_boundary_values(dof,
+ 0,
+ Functions::ZeroFunction<dim>(),
+ constraints);
constraints.close();
// std::cout << "Number of cells: " <<
typedef typename DoFHandler<dim>::active_cell_iterator CellIterator;
typedef double Number;
- MatrixFreeTest(const MatrixFree<dim, Number> &data_in) : data(data_in){};
+ MatrixFreeTest(const MatrixFree<dim, Number> &data_in)
+ : data(data_in){};
void
local_apply(const MatrixFree<dim, Number> & data,
vmult(VectorType &dst, const VectorType &src) const
{
dst = 0;
- data.cell_loop(
- &MatrixFreeTest<dim, degree_p, VectorType>::local_apply, this, dst, src);
+ data.cell_loop(&MatrixFreeTest<dim, degree_p, VectorType>::local_apply,
+ this,
+ dst,
+ src);
};
private:
constraints_p.close();
std::vector<types::global_dof_index> dofs_per_block(2);
- DoFTools::count_dofs_per_block(
- dof_handler, dofs_per_block, stokes_sub_blocks);
+ DoFTools::count_dofs_per_block(dof_handler,
+ dofs_per_block,
+ stokes_sub_blocks);
// std::cout << "Number of active cells: "
// << triangulation.n_active_cells()
local_matrix(i, j) = local_matrix(j, i);
cell->get_dof_indices(local_dof_indices);
- constraints.distribute_local_to_global(
- local_matrix, local_dof_indices, system_matrix);
+ constraints.distribute_local_to_global(local_matrix,
+ local_dof_indices,
+ system_matrix);
}
}
p2[0] = 2;
for (unsigned int d = 1; d < dim; ++d)
p2[d] = 1;
- GridGenerator::subdivided_hyper_rectangle(
- tria, refinements, Point<dim>(), p2);
+ GridGenerator::subdivided_hyper_rectangle(tria,
+ refinements,
+ Point<dim>(),
+ p2);
tria.begin()->face(0)->set_all_boundary_ids(10);
tria.last()->face(1)->set_all_boundary_ids(11);
int
main(int argc, char **argv)
{
- Utilities::MPI::MPI_InitFinalize mpi_init(
- argc, argv, testing_max_num_threads());
- MPILogInitAll log;
+ Utilities::MPI::MPI_InitFinalize mpi_init(argc,
+ argv,
+ testing_max_num_threads());
+ MPILogInitAll log;
deallog << std::setprecision(3);
{
public:
typedef VectorizedArray<Number> vector_t;
- MatrixFreeTest(const MatrixFree<dim, Number> &data_in) : data(data_in){};
+ MatrixFreeTest(const MatrixFree<dim, Number> &data_in)
+ : data(data_in){};
void
vmult(Vector<Number> &dst, const Vector<Number> &src) const
MatrixFreeTest<dim, fe_degree, number> mf(mf_data);
Vector<number> in(dof.n_dofs()), out(dof.n_dofs());
- VectorTools::create_right_hand_side(
- dof, QGauss<dim>(fe_degree + 1), Functions::CosineFunction<dim>(), in);
+ VectorTools::create_right_hand_side(dof,
+ QGauss<dim>(fe_degree + 1),
+ Functions::CosineFunction<dim>(),
+ in);
// prescribe number of iterations in CG instead of tolerance. This is needed
// to get the same test output on different platforms where roundoff errors
class MatrixFreeTest
{
public:
- MatrixFreeTest(const MatrixFree<dim, number> &data) : data(data), error(2)
+ MatrixFreeTest(const MatrixFree<dim, number> &data)
+ : data(data)
+ , error(2)
{}
~MatrixFreeTest()
class MatrixFreeTest
{
public:
- MatrixFreeTest(const MatrixFree<dim, number> &data) : data(data), error(2)
+ MatrixFreeTest(const MatrixFree<dim, number> &data)
+ : data(data)
+ , error(2)
{}
~MatrixFreeTest()
class MatrixFreeTest
{
public:
- MatrixFreeTest(const MatrixFree<dim, Number> &data_in) :
- data(data_in),
- fe_val(data.get_dof_handler().get_fe(),
- Quadrature<dim>(data.get_quadrature(0)),
- update_values | update_gradients | update_hessians){};
+ MatrixFreeTest(const MatrixFree<dim, Number> &data_in)
+ : data(data_in)
+ , fe_val(data.get_dof_handler().get_fe(),
+ Quadrature<dim>(data.get_quadrature(0)),
+ update_values | update_gradients | update_hessians){};
MatrixFreeTest(const MatrixFree<dim, Number> &data_in,
- const Mapping<dim> & mapping) :
- data(data_in),
- fe_val(mapping,
- data.get_dof_handler().get_fe(),
- Quadrature<dim>(data.get_quadrature(0)),
- update_values | update_gradients | update_hessians){};
+ const Mapping<dim> & mapping)
+ : data(data_in)
+ , fe_val(mapping,
+ data.get_dof_handler().get_fe(),
+ Quadrature<dim>(data.get_quadrature(0)),
+ update_values | update_gradients | update_hessians){};
virtual ~MatrixFreeTest()
{}
class MatrixFreeTest
{
public:
- MatrixFreeTest(const MatrixFree<dim, number> &data) : data(data)
+ MatrixFreeTest(const MatrixFree<dim, number> &data)
+ : data(data)
{}
void
ConstraintMatrix constraints;
DoFTools::make_hanging_node_constraints(dof, constraints);
- VectorTools::interpolate_boundary_values(
- dof, 1, Functions::ZeroFunction<dim>(), constraints);
+ VectorTools::interpolate_boundary_values(dof,
+ 1,
+ Functions::ZeroFunction<dim>(),
+ constraints);
constraints.close();
do_test<dim, fe_degree, float>(dof, constraints);
public:
typedef std::vector<Vector<Number>> VectorType;
- MatrixFreeTest(const MatrixFree<dim, Number> &data_in) :
- data(data_in),
- fe_val0(data.get_dof_handler(0).get_fe(),
- Quadrature<dim>(data.get_quadrature(0)),
- update_values | update_gradients | update_hessians),
- fe_val1(data.get_dof_handler(1).get_fe(),
- Quadrature<dim>(data.get_quadrature(1)),
- update_values | update_gradients | update_hessians){};
+ MatrixFreeTest(const MatrixFree<dim, Number> &data_in)
+ : data(data_in)
+ , fe_val0(data.get_dof_handler(0).get_fe(),
+ Quadrature<dim>(data.get_quadrature(0)),
+ update_values | update_gradients | update_hessians)
+ , fe_val1(data.get_dof_handler(1).get_fe(),
+ Quadrature<dim>(data.get_quadrature(1)),
+ update_values | update_gradients | update_hessians){};
void
operator()(const MatrixFree<dim, Number> &data,
const std::pair<unsigned int, unsigned int> &cell_range) const
{
FEEvaluation<dim, fe_degree, fe_degree + 1, 1, Number> fe_eval0(data, 0, 0);
- FEEvaluation<dim, fe_degree + 1, fe_degree + 2, 1, Number> fe_eval1(
- data, 1, 1);
+ FEEvaluation<dim, fe_degree + 1, fe_degree + 2, 1, Number> fe_eval1(data,
+ 1,
+ 1);
std::vector<double> reference_values0(fe_eval0.n_q_points);
std::vector<Tensor<1, dim>> reference_grads0(fe_eval0.n_q_points);
std::vector<Tensor<2, dim>> reference_hess0(fe_eval0.n_q_points);
public:
typedef std::vector<Vector<Number>> VectorType;
- MatrixFreeTest(const MatrixFree<dim, Number> &data_in) :
- data(data_in),
- fe_val0(data.get_dof_handler(0).get_fe(),
- Quadrature<dim>(data.get_quadrature(0)),
- update_values | update_gradients | update_hessians),
- fe_val1(data.get_dof_handler(1).get_fe(),
- Quadrature<dim>(data.get_quadrature(1)),
- update_values | update_gradients | update_hessians),
- fe_val2(data.get_dof_handler(2).get_fe(),
- Quadrature<dim>(data.get_quadrature(1)),
- update_values | update_gradients | update_hessians){};
+ MatrixFreeTest(const MatrixFree<dim, Number> &data_in)
+ : data(data_in)
+ , fe_val0(data.get_dof_handler(0).get_fe(),
+ Quadrature<dim>(data.get_quadrature(0)),
+ update_values | update_gradients | update_hessians)
+ , fe_val1(data.get_dof_handler(1).get_fe(),
+ Quadrature<dim>(data.get_quadrature(1)),
+ update_values | update_gradients | update_hessians)
+ , fe_val2(data.get_dof_handler(2).get_fe(),
+ Quadrature<dim>(data.get_quadrature(1)),
+ update_values | update_gradients | update_hessians){};
void
operator()(const MatrixFree<dim, Number> &data,
{
FEEvaluation<dim, 0, 1, 1, Number> fe_eval0(data, 0, 0);
FEEvaluation<dim, fe_degree, fe_degree + 1, 1, Number> fe_eval1(data, 1, 1);
- FEEvaluation<dim, fe_degree + 1, fe_degree + 1, 1, Number> fe_eval2(
- data, 2, 1);
+ FEEvaluation<dim, fe_degree + 1, fe_degree + 1, 1, Number> fe_eval2(data,
+ 2,
+ 1);
std::vector<double> reference_values0(fe_eval0.n_q_points);
std::vector<Tensor<1, dim>> reference_grads0(fe_eval0.n_q_points);
std::vector<Tensor<2, dim>> reference_hess0(fe_eval0.n_q_points);
MatrixFree<dim, number> mf_data;
if (fe_degree > 1)
- sub_test<dim, fe_degree, fe_degree - 1, number>(
- dof, constraints, mf_data, solution);
- sub_test<dim, fe_degree, fe_degree, number>(
- dof, constraints, mf_data, solution);
- sub_test<dim, fe_degree, fe_degree + 2, number>(
- dof, constraints, mf_data, solution);
+ sub_test<dim, fe_degree, fe_degree - 1, number>(dof,
+ constraints,
+ mf_data,
+ solution);
+ sub_test<dim, fe_degree, fe_degree, number>(dof,
+ constraints,
+ mf_data,
+ solution);
+ sub_test<dim, fe_degree, fe_degree + 2, number>(dof,
+ constraints,
+ mf_data,
+ solution);
if (dim == 2)
- sub_test<dim, fe_degree, fe_degree + 3, number>(
- dof, constraints, mf_data, solution);
+ sub_test<dim, fe_degree, fe_degree + 3, number>(dof,
+ constraints,
+ mf_data,
+ solution);
}
MatrixFree<dim, number> mf_data;
if (fe_degree > 1)
- sub_test<dim, fe_degree, fe_degree - 1, number>(
- dof, constraints, mf_data, solution);
- sub_test<dim, fe_degree, fe_degree, number>(
- dof, constraints, mf_data, solution);
- sub_test<dim, fe_degree, fe_degree + 2, number>(
- dof, constraints, mf_data, solution);
+ sub_test<dim, fe_degree, fe_degree - 1, number>(dof,
+ constraints,
+ mf_data,
+ solution);
+ sub_test<dim, fe_degree, fe_degree, number>(dof,
+ constraints,
+ mf_data,
+ solution);
+ sub_test<dim, fe_degree, fe_degree + 2, number>(dof,
+ constraints,
+ mf_data,
+ solution);
if (dim == 2)
- sub_test<dim, fe_degree, fe_degree + 3, number>(
- dof, constraints, mf_data, solution);
+ sub_test<dim, fe_degree, fe_degree + 3, number>(dof,
+ constraints,
+ mf_data,
+ solution);
}
public:
typedef Vector<Number> VectorType;
- MatrixFreeTest(const MatrixFree<dim, Number> &data_in) : data(data_in){};
+ MatrixFreeTest(const MatrixFree<dim, Number> &data_in)
+ : data(data_in){};
void
operator()(const MatrixFree<dim, Number> & data,
public:
typedef Vector<Number> VectorType;
- MatrixFreeTest(const MatrixFree<dim, Number> &data_in) : data(data_in){};
+ MatrixFreeTest(const MatrixFree<dim, Number> &data_in)
+ : data(data_in){};
void
operator()(const MatrixFree<dim, Number> & data,
class MatrixFreeTest
{
public:
- MatrixFreeTest(const MatrixFree<dim, Number> &data_in) : data(data_in){};
+ MatrixFreeTest(const MatrixFree<dim, Number> &data_in)
+ : data(data_in){};
// make function virtual to allow derived
// classes to define a different function
ConstraintMatrix constraints;
DoFTools::make_hanging_node_constraints(dof, constraints);
- VectorTools::interpolate_boundary_values(
- dof, 1, Functions::ZeroFunction<dim>(), constraints);
+ VectorTools::interpolate_boundary_values(dof,
+ 1,
+ Functions::ZeroFunction<dim>(),
+ constraints);
constraints.close();
do_test<dim, fe_degree, double>(dof, constraints);
public:
typedef std::vector<Vector<Number> *> VectorType;
- MatrixFreeTest(const MatrixFree<dim, Number> &data_in) :
- data(data_in),
- fe_val(data.get_dof_handler().get_fe(),
- Quadrature<dim>(data.get_quadrature(0)),
- update_values | update_gradients | update_JxW_values){};
+ MatrixFreeTest(const MatrixFree<dim, Number> &data_in)
+ : data(data_in)
+ , fe_val(data.get_dof_handler().get_fe(),
+ Quadrature<dim>(data.get_quadrature(0)),
+ update_values | update_gradients | update_JxW_values){};
void
operator()(const MatrixFree<dim, Number> & data,
public:
typedef std::vector<Vector<Number>> VectorType;
- MatrixFreeTest(const MatrixFree<dim, Number> &data_in) :
- data(data_in),
- fe_val0(data.get_dof_handler(0).get_fe(),
- Quadrature<dim>(data.get_quadrature(0)),
- update_values | update_gradients | update_JxW_values),
- fe_val01(data.get_dof_handler(0).get_fe(),
- Quadrature<dim>(data.get_quadrature(1)),
- update_values | update_gradients | update_JxW_values),
- fe_val1(data.get_dof_handler(1).get_fe(),
- Quadrature<dim>(data.get_quadrature(1)),
- update_values | update_gradients | update_JxW_values){};
+ MatrixFreeTest(const MatrixFree<dim, Number> &data_in)
+ : data(data_in)
+ , fe_val0(data.get_dof_handler(0).get_fe(),
+ Quadrature<dim>(data.get_quadrature(0)),
+ update_values | update_gradients | update_JxW_values)
+ , fe_val01(data.get_dof_handler(0).get_fe(),
+ Quadrature<dim>(data.get_quadrature(1)),
+ update_values | update_gradients | update_JxW_values)
+ , fe_val1(data.get_dof_handler(1).get_fe(),
+ Quadrature<dim>(data.get_quadrature(1)),
+ update_values | update_gradients | update_JxW_values){};
void
operator()(const MatrixFree<dim, Number> & data,
const std::pair<unsigned int, unsigned int> &cell_range) const
{
FEEvaluation<dim, fe_degree, fe_degree + 1, 1, Number> fe_eval0(data, 0, 0);
- FEEvaluation<dim, fe_degree + 1, fe_degree + 2, 1, Number> fe_eval1(
- data, 1, 1);
+ FEEvaluation<dim, fe_degree + 1, fe_degree + 2, 1, Number> fe_eval1(data,
+ 1,
+ 1);
FEEvaluation<dim, fe_degree, fe_degree + 2, 1, Number> fe_eval01(data, 0, 1);
const unsigned int n_q_points0 = fe_eval0.n_q_points;
const unsigned int n_q_points1 = fe_eval1.n_q_points;
public:
typedef std::vector<Vector<Number>> VectorType;
- MatrixFreeTest(const MatrixFree<dim, Number> &data_in) :
- data(data_in),
- fe_val0(data.get_dof_handler(0).get_fe(),
- Quadrature<dim>(data.get_quadrature(0)),
- update_values | update_gradients | update_JxW_values),
- fe_val01(data.get_dof_handler(0).get_fe(),
- Quadrature<dim>(data.get_quadrature(1)),
- update_values | update_gradients | update_JxW_values),
- fe_val1(data.get_dof_handler(1).get_fe(),
- Quadrature<dim>(data.get_quadrature(1)),
- update_values | update_gradients | update_JxW_values){};
+ MatrixFreeTest(const MatrixFree<dim, Number> &data_in)
+ : data(data_in)
+ , fe_val0(data.get_dof_handler(0).get_fe(),
+ Quadrature<dim>(data.get_quadrature(0)),
+ update_values | update_gradients | update_JxW_values)
+ , fe_val01(data.get_dof_handler(0).get_fe(),
+ Quadrature<dim>(data.get_quadrature(1)),
+ update_values | update_gradients | update_JxW_values)
+ , fe_val1(data.get_dof_handler(1).get_fe(),
+ Quadrature<dim>(data.get_quadrature(1)),
+ update_values | update_gradients | update_JxW_values){};
void
operator()(const MatrixFree<dim, Number> & data,
class MatrixFreeTest
{
public:
- MatrixFreeTest(const MatrixFree<dim, Number> &data_in) : data(data_in){};
+ MatrixFreeTest(const MatrixFree<dim, Number> &data_in)
+ : data(data_in){};
MatrixFreeTest(const MatrixFree<dim, Number> &data_in,
- const Mapping<dim> & mapping) :
- data(data_in){};
+ const Mapping<dim> & mapping)
+ : data(data_in){};
virtual ~MatrixFreeTest()
{}
class SimpleField : public Function<dim>
{
public:
- SimpleField() : Function<dim>(1)
+ SimpleField()
+ : Function<dim>(1)
{}
double
// interpolate:
LinearAlgebra::distributed::Vector<LevelNumberType> fine_projection;
- fine_projection.reinit(
- locally_owned_dofs, locally_relevant_dofs, mpi_communicator);
+ fine_projection.reinit(locally_owned_dofs,
+ locally_relevant_dofs,
+ mpi_communicator);
VectorTools::project(dof_handler,
constraints,
QGauss<dim>(n_q_points + 2),
const std::string mg_mesh = "mg_mesh";
GridOut grid_out;
- grid_out.write_mesh_per_processor_as_vtu(
- triangulation, mg_mesh, true, true);
+ grid_out.write_mesh_per_processor_as_vtu(triangulation,
+ mg_mesh,
+ true,
+ true);
}
// MG hanging node constraints
QGauss<dim> quadrature(n_q_points);
std::vector<LevelNumberType> q_values(quadrature.size());
- FEValues<dim> fe_values(
- fe, quadrature, update_values | update_quadrature_points);
+ FEValues<dim> fe_values(fe,
+ quadrature,
+ update_values | update_quadrature_points);
for (unsigned int level = max_level + 1; level != min_level;)
{
--level;
{
fe_values.reinit(cell);
cell->get_mg_dof_indices(dof_indices);
- fe_values.get_function_values(
- level_projection[level], dof_indices, q_values);
+ fe_values.get_function_values(level_projection[level],
+ dof_indices,
+ q_values);
const std::vector<Point<dim>> &q_points =
fe_values.get_quadrature_points();
class MatrixFreeTest
{
public:
- MatrixFreeTest(const MatrixFree<dim, Number> &data_in) : data(data_in){};
+ MatrixFreeTest(const MatrixFree<dim, Number> &data_in)
+ : data(data_in){};
void
local_mass_operator(
class MatrixFreeTest
{
public:
- MatrixFreeTest(const MatrixFree<dim, Number> &data_in) : data(data_in){};
+ MatrixFreeTest(const MatrixFree<dim, Number> &data_in)
+ : data(data_in){};
void
local_mass_operator(
class MatrixFreeTest
{
public:
- MatrixFreeTest(const MatrixFree<dim, Number> &data_in) : data(data_in){};
+ MatrixFreeTest(const MatrixFree<dim, Number> &data_in)
+ : data(data_in){};
void
local_mass_operator(
ConstraintMatrix constraints(relevant_set);
DoFTools::make_hanging_node_constraints(dof, constraints);
- VectorTools::interpolate_boundary_values(
- dof, 0, Functions::ZeroFunction<dim>(), constraints);
+ VectorTools::interpolate_boundary_values(dof,
+ 0,
+ Functions::ZeroFunction<dim>(),
+ constraints);
constraints.close();
deallog << "Testing " << dof.get_fe().get_name() << std::endl;
TrilinosWrappers::SparseMatrix sparse_matrix;
{
TrilinosWrappers::SparsityPattern csp(owned_set, MPI_COMM_WORLD);
- DoFTools::make_sparsity_pattern(
- dof,
- csp,
- constraints,
- true,
- Utilities::MPI::this_mpi_process(MPI_COMM_WORLD));
+ DoFTools::make_sparsity_pattern(dof,
+ csp,
+ constraints,
+ true,
+ Utilities::MPI::this_mpi_process(
+ MPI_COMM_WORLD));
csp.compress();
sparse_matrix.reinit(csp);
}
{
QGauss<dim> quadrature_formula(fe_degree + 1);
- FEValues<dim> fe_values(
- dof.get_fe(), quadrature_formula, update_gradients | update_JxW_values);
+ FEValues<dim> fe_values(dof.get_fe(),
+ quadrature_formula,
+ update_gradients | update_JxW_values);
const unsigned int dofs_per_cell = dof.get_fe().dofs_per_cell;
const unsigned int n_q_points = quadrature_formula.size();
}
cell->get_dof_indices(local_dof_indices);
- constraints.distribute_local_to_global(
- cell_matrix, local_dof_indices, sparse_matrix);
+ constraints.distribute_local_to_global(cell_matrix,
+ local_dof_indices,
+ sparse_matrix);
}
}
sparse_matrix.compress(VectorOperation::add);
class F : public Function<dim>
{
public:
- F(const unsigned int q, const unsigned int n_components) :
- Function<dim>(n_components),
- q(q)
+ F(const unsigned int q, const unsigned int n_components)
+ : Function<dim>(n_components)
+ , q(q)
{}
virtual double
ConstraintMatrix constraints(relevant_set);
DoFTools::make_hanging_node_constraints(dof, constraints);
- VectorTools::interpolate_boundary_values(
- dof, 0, Functions::ZeroFunction<dim>(), constraints);
+ VectorTools::interpolate_boundary_values(dof,
+ 0,
+ Functions::ZeroFunction<dim>(),
+ constraints);
constraints.close();
deallog << "Testing " << dof.get_fe().get_name() << std::endl;
TrilinosWrappers::SparseMatrix sparse_matrix;
{
TrilinosWrappers::SparsityPattern csp(owned_set, MPI_COMM_WORLD);
- DoFTools::make_sparsity_pattern(
- dof,
- csp,
- constraints,
- true,
- Utilities::MPI::this_mpi_process(MPI_COMM_WORLD));
+ DoFTools::make_sparsity_pattern(dof,
+ csp,
+ constraints,
+ true,
+ Utilities::MPI::this_mpi_process(
+ MPI_COMM_WORLD));
csp.compress();
sparse_matrix.reinit(csp);
}
}
cell->get_dof_indices(local_dof_indices);
- constraints.distribute_local_to_global(
- cell_matrix, local_dof_indices, sparse_matrix);
+ constraints.distribute_local_to_global(cell_matrix,
+ local_dof_indices,
+ sparse_matrix);
}
}
sparse_matrix.compress(VectorOperation::add);
ConstraintMatrix constraints(relevant_set);
DoFTools::make_hanging_node_constraints(dof, constraints);
- VectorTools::interpolate_boundary_values(
- dof, 0, Functions::ZeroFunction<dim>(), constraints);
+ VectorTools::interpolate_boundary_values(dof,
+ 0,
+ Functions::ZeroFunction<dim>(),
+ constraints);
constraints.close();
deallog << "Testing " << dof.get_fe().get_name() << std::endl;
TrilinosWrappers::SparseMatrix sparse_matrix;
{
TrilinosWrappers::SparsityPattern csp(owned_set, MPI_COMM_WORLD);
- DoFTools::make_sparsity_pattern(
- dof,
- csp,
- constraints,
- true,
- Utilities::MPI::this_mpi_process(MPI_COMM_WORLD));
+ DoFTools::make_sparsity_pattern(dof,
+ csp,
+ constraints,
+ true,
+ Utilities::MPI::this_mpi_process(
+ MPI_COMM_WORLD));
csp.compress();
sparse_matrix.reinit(csp);
}
}
cell->get_dof_indices(local_dof_indices);
- constraints.distribute_local_to_global(
- cell_matrix, local_dof_indices, sparse_matrix);
+ constraints.distribute_local_to_global(cell_matrix,
+ local_dof_indices,
+ sparse_matrix);
}
}
sparse_matrix.compress(VectorOperation::add);
ConstraintMatrix constraints(relevant_set);
DoFTools::make_hanging_node_constraints(dof, constraints);
- VectorTools::interpolate_boundary_values(
- dof, 0, Functions::ZeroFunction<dim>(), constraints);
+ VectorTools::interpolate_boundary_values(dof,
+ 0,
+ Functions::ZeroFunction<dim>(),
+ constraints);
constraints.close();
deallog << "Testing " << dof.get_fe().get_name() << std::endl;
TrilinosWrappers::SparseMatrix sparse_matrix;
{
TrilinosWrappers::SparsityPattern csp(owned_set, MPI_COMM_WORLD);
- DoFTools::make_sparsity_pattern(
- dof,
- csp,
- constraints,
- true,
- Utilities::MPI::this_mpi_process(MPI_COMM_WORLD));
+ DoFTools::make_sparsity_pattern(dof,
+ csp,
+ constraints,
+ true,
+ Utilities::MPI::this_mpi_process(
+ MPI_COMM_WORLD));
csp.compress();
sparse_matrix.reinit(csp);
}
}
cell->get_dof_indices(local_dof_indices);
- constraints.distribute_local_to_global(
- cell_matrix, local_dof_indices, sparse_matrix);
+ constraints.distribute_local_to_global(cell_matrix,
+ local_dof_indices,
+ sparse_matrix);
}
}
sparse_matrix.compress(VectorOperation::add);
TrilinosWrappers::SparseMatrix sparse_matrix;
{
TrilinosWrappers::SparsityPattern csp(owned_set, MPI_COMM_WORLD);
- DoFTools::make_sparsity_pattern(
- dof,
- csp,
- constraints,
- true,
- Utilities::MPI::this_mpi_process(MPI_COMM_WORLD));
+ DoFTools::make_sparsity_pattern(dof,
+ csp,
+ constraints,
+ true,
+ Utilities::MPI::this_mpi_process(
+ MPI_COMM_WORLD));
csp.compress();
sparse_matrix.reinit(csp);
}
}
cell->get_dof_indices(local_dof_indices);
- constraints.distribute_local_to_global(
- cell_matrix, local_dof_indices, sparse_matrix);
+ constraints.distribute_local_to_global(cell_matrix,
+ local_dof_indices,
+ sparse_matrix);
}
}
sparse_matrix.compress(VectorOperation::add);
DoFTools::extract_locally_relevant_dofs(dof, relevant_set);
ConstraintMatrix constraints_0(relevant_set), constraints_1(relevant_set);
- VectorTools::interpolate_boundary_values(
- dof, 0, Functions::ZeroFunction<dim>(), constraints_0);
+ VectorTools::interpolate_boundary_values(dof,
+ 0,
+ Functions::ZeroFunction<dim>(),
+ constraints_0);
constraints_0.close();
constraints_1.close();
DoFHandler<dim> dof(tria);
dof.distribute_dofs(fe);
ConstraintMatrix constraints;
- VectorTools::interpolate_boundary_values(
- dof, 0, Functions::ZeroFunction<dim>(), constraints);
+ VectorTools::interpolate_boundary_values(dof,
+ 0,
+ Functions::ZeroFunction<dim>(),
+ constraints);
constraints.close();
do_test<dim, fe_degree, double, fe_degree + 1>(dof, constraints);
dof.distribute_dofs(fe);
ConstraintMatrix constraints;
DoFTools::make_hanging_node_constraints(dof, constraints);
- VectorTools::interpolate_boundary_values(
- dof, 0, Functions::ZeroFunction<dim>(), constraints);
+ VectorTools::interpolate_boundary_values(dof,
+ 0,
+ Functions::ZeroFunction<dim>(),
+ constraints);
constraints.close();
do_test<dim, fe_degree, double, fe_degree + 1>(dof, constraints);
dof.distribute_dofs(fe);
ConstraintMatrix constraints;
DoFTools::make_hanging_node_constraints(dof, constraints);
- VectorTools::interpolate_boundary_values(
- dof, 0, Functions::ZeroFunction<dim>(), constraints);
+ VectorTools::interpolate_boundary_values(dof,
+ 0,
+ Functions::ZeroFunction<dim>(),
+ constraints);
constraints.close();
do_test<dim, fe_degree, double, fe_degree + 1>(dof, constraints);
dof.distribute_dofs(fe);
ConstraintMatrix constraints;
DoFTools::make_hanging_node_constraints(dof, constraints);
- VectorTools::interpolate_boundary_values(
- dof, 0, Functions::ZeroFunction<dim>(), constraints);
+ VectorTools::interpolate_boundary_values(dof,
+ 0,
+ Functions::ZeroFunction<dim>(),
+ constraints);
constraints.close();
// do not enable templates in FEEvaluation
// only interior DoFs on the elements, but try
// anyway
DoFTools::make_hanging_node_constraints(dof, constraints);
- VectorTools::interpolate_boundary_values(
- dof, 0, Functions::ZeroFunction<dim>(), constraints);
+ VectorTools::interpolate_boundary_values(dof,
+ 0,
+ Functions::ZeroFunction<dim>(),
+ constraints);
constraints.close();
do_test<dim, fe_degree, double, fe_degree + 1>(dof, constraints);
dof.distribute_dofs(fe);
ConstraintMatrix constraints;
DoFTools::make_hanging_node_constraints(dof, constraints);
- VectorTools::interpolate_boundary_values(
- dof, 0, Functions::ZeroFunction<dim>(), constraints);
+ VectorTools::interpolate_boundary_values(dof,
+ 0,
+ Functions::ZeroFunction<dim>(),
+ constraints);
constraints.close();
do_test<dim, fe_degree, double, fe_degree + 1>(dof, constraints);
dof.distribute_dofs(fe);
ConstraintMatrix constraints;
DoFTools::make_hanging_node_constraints(dof, constraints);
- VectorTools::interpolate_boundary_values(
- dof, 0, Functions::ZeroFunction<dim>(), constraints);
+ VectorTools::interpolate_boundary_values(dof,
+ 0,
+ Functions::ZeroFunction<dim>(),
+ constraints);
constraints.close();
do_test<dim, fe_degree, double, fe_degree + 1>(dof, constraints);
ConstraintMatrix constraints(relevant_set);
DoFTools::make_hanging_node_constraints(dof, constraints);
- VectorTools::interpolate_boundary_values(
- dof, 0, Functions::ZeroFunction<dim>(), constraints);
+ VectorTools::interpolate_boundary_values(dof,
+ 0,
+ Functions::ZeroFunction<dim>(),
+ constraints);
constraints.close();
deallog << "Testing " << dof.get_fe().get_name() << std::endl;
TrilinosWrappers::SparseMatrix sparse_matrix;
{
TrilinosWrappers::SparsityPattern csp(owned_set, MPI_COMM_WORLD);
- DoFTools::make_sparsity_pattern(
- dof,
- csp,
- constraints,
- true,
- Utilities::MPI::this_mpi_process(MPI_COMM_WORLD));
+ DoFTools::make_sparsity_pattern(dof,
+ csp,
+ constraints,
+ true,
+ Utilities::MPI::this_mpi_process(
+ MPI_COMM_WORLD));
csp.compress();
sparse_matrix.reinit(csp);
}
}
cell->get_dof_indices(local_dof_indices);
- constraints.distribute_local_to_global(
- cell_matrix, local_dof_indices, sparse_matrix);
+ constraints.distribute_local_to_global(cell_matrix,
+ local_dof_indices,
+ sparse_matrix);
}
}
sparse_matrix.compress(VectorOperation::add);
ConstraintMatrix constraints(relevant_set);
DoFTools::make_hanging_node_constraints(dof, constraints);
- VectorTools::interpolate_boundary_values(
- dof, 0, Functions::ZeroFunction<dim>(), constraints);
+ VectorTools::interpolate_boundary_values(dof,
+ 0,
+ Functions::ZeroFunction<dim>(),
+ constraints);
constraints.close();
deallog << "Testing " << dof.get_fe().get_name() << std::endl;
fe_eval.evaluate(true, true, false);
for (unsigned int q = 0; q < n_q_points; ++q)
{
- fe_eval.submit_value(
- make_vectorized_array(Number(10)) * fe_eval.get_value(q), q);
+ fe_eval.submit_value(make_vectorized_array(Number(10)) *
+ fe_eval.get_value(q),
+ q);
fe_eval.submit_gradient(fe_eval.get_gradient(q), q);
}
fe_eval.integrate(true, true);
static const std::size_t n_vectors =
VectorizedArray<Number>::n_array_elements;
- MatrixFreeTest(const MatrixFree<dim, Number> &data_in) : data(data_in){};
+ MatrixFreeTest(const MatrixFree<dim, Number> &data_in)
+ : data(data_in){};
void
vmult(
{
for (unsigned int i = 0; i < dst.size(); ++i)
dst[i] = 0;
- const std::function<void(
- const MatrixFree<dim, Number> &,
- std::vector<LinearAlgebra::distributed::Vector<Number>> &,
- const std::vector<LinearAlgebra::distributed::Vector<Number>> &,
- const std::pair<unsigned int, unsigned int> &)>
+ const std::function<
+ void(const MatrixFree<dim, Number> &,
+ std::vector<LinearAlgebra::distributed::Vector<Number>> &,
+ const std::vector<LinearAlgebra::distributed::Vector<Number>> &,
+ const std::pair<unsigned int, unsigned int> &)>
wrap = helmholtz_operator<dim, fe_degree, Number>;
data.cell_loop(wrap, dst, src);
};
ConstraintMatrix constraints(relevant_set);
DoFTools::make_hanging_node_constraints(dof, constraints);
- VectorTools::interpolate_boundary_values(
- dof, 0, Functions::ZeroFunction<dim>(), constraints);
+ VectorTools::interpolate_boundary_values(dof,
+ 0,
+ Functions::ZeroFunction<dim>(),
+ constraints);
constraints.close();
deallog << "Testing " << dof.get_fe().get_name() << std::endl;
TrilinosWrappers::SparseMatrix sparse_matrix;
{
TrilinosWrappers::SparsityPattern csp(owned_set, MPI_COMM_WORLD);
- DoFTools::make_sparsity_pattern(
- dof,
- csp,
- constraints,
- true,
- Utilities::MPI::this_mpi_process(MPI_COMM_WORLD));
+ DoFTools::make_sparsity_pattern(dof,
+ csp,
+ constraints,
+ true,
+ Utilities::MPI::this_mpi_process(
+ MPI_COMM_WORLD));
csp.compress();
sparse_matrix.reinit(csp);
}
}
cell->get_dof_indices(local_dof_indices);
- constraints.distribute_local_to_global(
- cell_matrix, local_dof_indices, sparse_matrix);
+ constraints.distribute_local_to_global(cell_matrix,
+ local_dof_indices,
+ sparse_matrix);
}
}
sparse_matrix.compress(VectorOperation::add);
fe_eval.evaluate(true, true, false);
for (unsigned int q = 0; q < n_q_points; ++q)
{
- fe_eval.submit_value(
- make_vectorized_array(Number(10)) * fe_eval.get_value(q), q);
+ fe_eval.submit_value(make_vectorized_array(Number(10)) *
+ fe_eval.get_value(q),
+ q);
fe_eval.submit_gradient(fe_eval.get_gradient(q), q);
}
fe_eval.integrate(true, true);
static const std::size_t n_vectors =
VectorizedArray<Number>::n_array_elements;
- MatrixFreeTest(const MatrixFree<dim, Number> &data_in) : data(data_in){};
+ MatrixFreeTest(const MatrixFree<dim, Number> &data_in)
+ : data(data_in){};
void
vmult(LinearAlgebra::distributed::BlockVector<Number> & dst,
const LinearAlgebra::distributed::BlockVector<Number> &src) const
{
dst = 0;
- const std::function<void(
- const MatrixFree<dim, Number> &,
- LinearAlgebra::distributed::BlockVector<Number> &,
- const LinearAlgebra::distributed::BlockVector<Number> &,
- const std::pair<unsigned int, unsigned int> &)>
+ const std::function<
+ void(const MatrixFree<dim, Number> &,
+ LinearAlgebra::distributed::BlockVector<Number> &,
+ const LinearAlgebra::distributed::BlockVector<Number> &,
+ const std::pair<unsigned int, unsigned int> &)>
wrap = helmholtz_operator<dim, fe_degree, Number>;
data.cell_loop(wrap, dst, src);
};
ConstraintMatrix constraints(relevant_set);
DoFTools::make_hanging_node_constraints(dof, constraints);
- VectorTools::interpolate_boundary_values(
- dof, 0, Functions::ZeroFunction<dim>(), constraints);
+ VectorTools::interpolate_boundary_values(dof,
+ 0,
+ Functions::ZeroFunction<dim>(),
+ constraints);
constraints.close();
deallog << "Testing " << dof.get_fe().get_name() << std::endl;
}
cell->get_dof_indices(local_dof_indices);
- constraints.distribute_local_to_global(
- cell_matrix, local_dof_indices, sparse_matrix);
+ constraints.distribute_local_to_global(cell_matrix,
+ local_dof_indices,
+ sparse_matrix);
}
}
sparse_matrix.compress(VectorOperation::add);
{
public:
MatrixFreeTest(const DoFHandler<dim> & dof_handler,
- const ConstraintMatrix &constraints) :
- dof_handler(dof_handler),
- constraints(constraints)
+ const ConstraintMatrix &constraints)
+ : dof_handler(dof_handler)
+ , constraints(constraints)
{}
void
}
cell->get_dof_indices(local_dof_indices);
- constraints.distribute_local_to_global(
- cell_matrix, local_dof_indices, sparse_matrix);
+ constraints.distribute_local_to_global(cell_matrix,
+ local_dof_indices,
+ sparse_matrix);
}
}
dof.distribute_dofs(fe);
ConstraintMatrix constraints;
DoFTools::make_hanging_node_constraints(dof, constraints);
- VectorTools::interpolate_boundary_values(
- dof, 0, Functions::ZeroFunction<dim>(), constraints);
+ VectorTools::interpolate_boundary_values(dof,
+ 0,
+ Functions::ZeroFunction<dim>(),
+ constraints);
constraints.close();
do_test<dim, fe_degree, double>(dof, constraints);
{
public:
MatrixFreeTest(const DoFHandler<dim> & dof_handler,
- const ConstraintMatrix &constraints) :
- dof_handler(dof_handler),
- constraints(constraints)
+ const ConstraintMatrix &constraints)
+ : dof_handler(dof_handler)
+ , constraints(constraints)
{}
void
fe_eval.evaluate(true, true, false);
for (unsigned int q = 0; q < fe_eval.n_q_points; ++q)
{
- fe_eval.submit_value(
- make_vectorized_array<Number>(10.) * fe_eval.get_value(q), q);
+ fe_eval.submit_value(make_vectorized_array<Number>(10.) *
+ fe_eval.get_value(q),
+ q);
fe_eval.submit_gradient(fe_eval.get_gradient(q), q);
}
fe_eval.integrate(true, true);
}
cell->get_dof_indices(local_dof_indices);
- constraints.distribute_local_to_global(
- cell_matrix, local_dof_indices, sparse_matrix);
+ constraints.distribute_local_to_global(cell_matrix,
+ local_dof_indices,
+ sparse_matrix);
}
}
dof.distribute_dofs(fe);
ConstraintMatrix constraints;
DoFTools::make_hanging_node_constraints(dof, constraints);
- VectorTools::interpolate_boundary_values(
- dof, 0, Functions::ZeroFunction<dim>(dim), constraints);
+ VectorTools::interpolate_boundary_values(dof,
+ 0,
+ Functions::ZeroFunction<dim>(dim),
+ constraints);
constraints.close();
do_test<dim, fe_degree, double>(dof, constraints);
dof.distribute_dofs(fe);
ConstraintMatrix constraints;
DoFTools::make_hanging_node_constraints(dof, constraints);
- VectorTools::interpolate_boundary_values(
- dof, 0, Functions::ZeroFunction<dim>(), constraints);
+ VectorTools::interpolate_boundary_values(dof,
+ 0,
+ Functions::ZeroFunction<dim>(),
+ constraints);
constraints.close();
do_test<dim, fe_degree, double, fe_degree + 1>(dof, constraints);
class MatrixFreeTest
{
public:
- MatrixFreeTest(const MatrixFree<dim, Number> &data_in) : data(data_in){};
+ MatrixFreeTest(const MatrixFree<dim, Number> &data_in)
+ : data(data_in){};
void
vmult(VectorType &dst, const VectorType &src) const
}
cell->get_dof_indices(local_dof_indices);
- constraints.distribute_local_to_global(
- cell_matrix, local_dof_indices, sparse_matrix);
+ constraints.distribute_local_to_global(cell_matrix,
+ local_dof_indices,
+ sparse_matrix);
}
}
dof.distribute_dofs(fe);
ConstraintMatrix constraints;
DoFTools::make_hanging_node_constraints(dof, constraints);
- VectorTools::interpolate_boundary_values(
- dof, 0, Functions::ZeroFunction<dim>(), constraints);
+ VectorTools::interpolate_boundary_values(dof,
+ 0,
+ Functions::ZeroFunction<dim>(),
+ constraints);
constraints.close();
do_test<dim, fe_degree, double>(dof, constraints);
ConstraintMatrix constraints(relevant_set);
DoFTools::make_hanging_node_constraints(dof, constraints);
- VectorTools::interpolate_boundary_values(
- dof, 0, Functions::ZeroFunction<dim>(), constraints);
+ VectorTools::interpolate_boundary_values(dof,
+ 0,
+ Functions::ZeroFunction<dim>(),
+ constraints);
constraints.close();
deallog << "Testing " << dof.get_fe().get_name() << std::endl;
TrilinosWrappers::SparseMatrix sparse_matrix;
{
TrilinosWrappers::SparsityPattern csp(owned_set, MPI_COMM_WORLD);
- DoFTools::make_sparsity_pattern(
- dof,
- csp,
- constraints,
- true,
- Utilities::MPI::this_mpi_process(MPI_COMM_WORLD));
+ DoFTools::make_sparsity_pattern(dof,
+ csp,
+ constraints,
+ true,
+ Utilities::MPI::this_mpi_process(
+ MPI_COMM_WORLD));
csp.compress();
sparse_matrix.reinit(csp);
}
}
cell->get_dof_indices(local_dof_indices);
- constraints.distribute_local_to_global(
- cell_matrix, local_dof_indices, sparse_matrix);
+ constraints.distribute_local_to_global(cell_matrix,
+ local_dof_indices,
+ sparse_matrix);
}
}
sparse_matrix.compress(VectorOperation::add);
phi1.evaluate(true, true, false);
for (unsigned int q = 0; q < n_q_points; ++q)
{
- phi0.submit_value(
- make_vectorized_array(Number(10)) * phi0.get_value(q), q);
+ phi0.submit_value(make_vectorized_array(Number(10)) *
+ phi0.get_value(q),
+ q);
phi0.submit_gradient(phi0.get_gradient(q), q);
- phi1.submit_value(
- make_vectorized_array(Number(10)) * phi1.get_value(q), q);
+ phi1.submit_value(make_vectorized_array(Number(10)) *
+ phi1.get_value(q),
+ q);
phi1.submit_gradient(phi1.get_gradient(q), q);
}
phi0.integrate(true, true);
static const std::size_t n_vectors =
VectorizedArray<Number>::n_array_elements;
- MatrixFreeTest(const MatrixFree<dim, Number> &data_in) : data(data_in){};
+ MatrixFreeTest(const MatrixFree<dim, Number> &data_in)
+ : data(data_in){};
void
vmult(LinearAlgebra::distributed::BlockVector<Number> & dst,
{
for (unsigned int i = 0; i < dst.size(); ++i)
dst[i] = 0;
- const std::function<void(
- const MatrixFree<dim, Number> &,
- LinearAlgebra::distributed::BlockVector<Number> &,
- const LinearAlgebra::distributed::BlockVector<Number> &,
- const std::pair<unsigned int, unsigned int> &)>
+ const std::function<
+ void(const MatrixFree<dim, Number> &,
+ LinearAlgebra::distributed::BlockVector<Number> &,
+ const LinearAlgebra::distributed::BlockVector<Number> &,
+ const std::pair<unsigned int, unsigned int> &)>
wrap = helmholtz_operator<dim, fe_degree, Number>;
data.cell_loop(wrap, dst, src);
};
ConstraintMatrix constraints;
DoFTools::make_hanging_node_constraints(dof, constraints);
- VectorTools::interpolate_boundary_values(
- dof, 0, Functions::ZeroFunction<dim>(), constraints);
+ VectorTools::interpolate_boundary_values(dof,
+ 0,
+ Functions::ZeroFunction<dim>(),
+ constraints);
constraints.close();
deallog << "Testing " << dof.get_fe().get_name() << std::endl;
}
cell->get_dof_indices(local_dof_indices);
- constraints.distribute_local_to_global(
- cell_matrix, local_dof_indices, sparse_matrix);
+ constraints.distribute_local_to_global(cell_matrix,
+ local_dof_indices,
+ sparse_matrix);
}
}
fe_eval.evaluate(true, true, false);
for (unsigned int q = 0; q < n_q_points; ++q)
{
- fe_eval.submit_value(
- make_vectorized_array(Number(10)) * fe_eval.get_value(q), q);
+ fe_eval.submit_value(make_vectorized_array(Number(10)) *
+ fe_eval.get_value(q),
+ q);
fe_eval.submit_gradient(fe_eval.get_gradient(q), q);
}
fe_eval.integrate(true, true);
static const std::size_t n_vectors =
VectorizedArray<Number>::n_array_elements;
- MatrixFreeTest(const MatrixFree<dim, Number> &data_in) : data(data_in){};
+ MatrixFreeTest(const MatrixFree<dim, Number> &data_in)
+ : data(data_in){};
void
vmult(LinearAlgebra::distributed::BlockVector<Number> & dst,
{
for (unsigned int i = 0; i < dst.size(); ++i)
dst[i] = 0;
- const std::function<void(
- const MatrixFree<dim, Number> &,
- LinearAlgebra::distributed::BlockVector<Number> &,
- const LinearAlgebra::distributed::BlockVector<Number> &,
- const std::pair<unsigned int, unsigned int> &)>
+ const std::function<
+ void(const MatrixFree<dim, Number> &,
+ LinearAlgebra::distributed::BlockVector<Number> &,
+ const LinearAlgebra::distributed::BlockVector<Number> &,
+ const std::pair<unsigned int, unsigned int> &)>
wrap = helmholtz_operator<dim, fe_degree, Number>;
data.cell_loop(wrap, dst, src);
};
ConstraintMatrix constraints;
DoFTools::make_hanging_node_constraints(dof, constraints);
- VectorTools::interpolate_boundary_values(
- dof, 0, Functions::ZeroFunction<dim>(), constraints);
+ VectorTools::interpolate_boundary_values(dof,
+ 0,
+ Functions::ZeroFunction<dim>(),
+ constraints);
constraints.close();
deallog << "Testing " << dof.get_fe().get_name() << std::endl;
}
cell->get_dof_indices(local_dof_indices);
- constraints.distribute_local_to_global(
- cell_matrix, local_dof_indices, sparse_matrix);
+ constraints.distribute_local_to_global(cell_matrix,
+ local_dof_indices,
+ sparse_matrix);
}
}
fe_eval.evaluate(true, true, false);
for (unsigned int q = 0; q < n_q_points; ++q)
{
- fe_eval.submit_value(
- make_vectorized_array(Number(10)) * fe_eval.get_value(q), q);
+ fe_eval.submit_value(make_vectorized_array(Number(10)) *
+ fe_eval.get_value(q),
+ q);
fe_eval.submit_gradient(fe_eval.get_gradient(q), q);
}
fe_eval.integrate(true, true);
static const std::size_t n_vectors =
VectorizedArray<Number>::n_array_elements;
- MatrixFreeTest(const MatrixFree<dim, Number> &data_in) : data(data_in){};
+ MatrixFreeTest(const MatrixFree<dim, Number> &data_in)
+ : data(data_in){};
void
vmult(
{
for (unsigned int i = 0; i < dst.size(); ++i)
*dst[i] = 0;
- const std::function<void(
- const MatrixFree<dim, Number> &,
- std::vector<LinearAlgebra::distributed::Vector<Number> *> &,
- const std::vector<LinearAlgebra::distributed::Vector<Number> *> &,
- const std::pair<unsigned int, unsigned int> &)>
+ const std::function<
+ void(const MatrixFree<dim, Number> &,
+ std::vector<LinearAlgebra::distributed::Vector<Number> *> &,
+ const std::vector<LinearAlgebra::distributed::Vector<Number> *> &,
+ const std::pair<unsigned int, unsigned int> &)>
wrap = helmholtz_operator<dim, fe_degree, Number>;
data.cell_loop(wrap, dst, src);
};
ConstraintMatrix constraints(relevant_set);
DoFTools::make_hanging_node_constraints(dof, constraints);
- VectorTools::interpolate_boundary_values(
- dof, 0, Functions::ZeroFunction<dim>(), constraints);
+ VectorTools::interpolate_boundary_values(dof,
+ 0,
+ Functions::ZeroFunction<dim>(),
+ constraints);
constraints.close();
deallog << "Testing " << dof.get_fe().get_name() << std::endl;
TrilinosWrappers::SparseMatrix sparse_matrix;
{
TrilinosWrappers::SparsityPattern csp(owned_set, MPI_COMM_WORLD);
- DoFTools::make_sparsity_pattern(
- dof,
- csp,
- constraints,
- true,
- Utilities::MPI::this_mpi_process(MPI_COMM_WORLD));
+ DoFTools::make_sparsity_pattern(dof,
+ csp,
+ constraints,
+ true,
+ Utilities::MPI::this_mpi_process(
+ MPI_COMM_WORLD));
csp.compress();
sparse_matrix.reinit(csp);
}
}
cell->get_dof_indices(local_dof_indices);
- constraints.distribute_local_to_global(
- cell_matrix, local_dof_indices, sparse_matrix);
+ constraints.distribute_local_to_global(cell_matrix,
+ local_dof_indices,
+ sparse_matrix);
}
}
sparse_matrix.compress(VectorOperation::add);
fe_eval.evaluate(true, true, false);
for (unsigned int q = 0; q < n_q_points; ++q)
{
- fe_eval.submit_value(
- make_vectorized_array(Number(10)) * fe_eval.get_value(q), q);
+ fe_eval.submit_value(make_vectorized_array(Number(10)) *
+ fe_eval.get_value(q),
+ q);
fe_eval.submit_gradient(fe_eval.get_gradient(q), q);
- fe_eval2.submit_value(
- make_vectorized_array(Number(10)) * fe_eval2.get_value(q), q);
+ fe_eval2.submit_value(make_vectorized_array(Number(10)) *
+ fe_eval2.get_value(q),
+ q);
fe_eval2.submit_gradient(fe_eval2.get_gradient(q), q);
}
fe_eval2.integrate(true, true);
static const std::size_t n_vectors =
VectorizedArray<Number>::n_array_elements;
- MatrixFreeTest(const MatrixFree<dim, Number> &data_in) : data(data_in){};
+ MatrixFreeTest(const MatrixFree<dim, Number> &data_in)
+ : data(data_in){};
void
vmult(
{
for (unsigned int i = 0; i < dst.size(); ++i)
*dst[i] = 0;
- const std::function<void(
- const MatrixFree<dim, Number> &,
- std::vector<LinearAlgebra::distributed::Vector<Number> *> &,
- const std::vector<LinearAlgebra::distributed::Vector<Number> *> &,
- const std::pair<unsigned int, unsigned int> &)>
+ const std::function<
+ void(const MatrixFree<dim, Number> &,
+ std::vector<LinearAlgebra::distributed::Vector<Number> *> &,
+ const std::vector<LinearAlgebra::distributed::Vector<Number> *> &,
+ const std::pair<unsigned int, unsigned int> &)>
wrap = helmholtz_operator<dim, fe_degree, Number>;
data.cell_loop(wrap, dst, src);
};
ConstraintMatrix constraints(relevant_set);
DoFTools::make_hanging_node_constraints(dof, constraints);
- VectorTools::interpolate_boundary_values(
- dof, 0, Functions::ZeroFunction<dim>(), constraints);
+ VectorTools::interpolate_boundary_values(dof,
+ 0,
+ Functions::ZeroFunction<dim>(),
+ constraints);
constraints.close();
deallog << "Testing " << dof.get_fe().get_name() << std::endl;
TrilinosWrappers::SparseMatrix sparse_matrix;
{
TrilinosWrappers::SparsityPattern csp(owned_set, MPI_COMM_WORLD);
- DoFTools::make_sparsity_pattern(
- dof,
- csp,
- constraints,
- true,
- Utilities::MPI::this_mpi_process(MPI_COMM_WORLD));
+ DoFTools::make_sparsity_pattern(dof,
+ csp,
+ constraints,
+ true,
+ Utilities::MPI::this_mpi_process(
+ MPI_COMM_WORLD));
csp.compress();
sparse_matrix.reinit(csp);
}
}
cell->get_dof_indices(local_dof_indices);
- constraints.distribute_local_to_global(
- cell_matrix, local_dof_indices, sparse_matrix);
+ constraints.distribute_local_to_global(cell_matrix,
+ local_dof_indices,
+ sparse_matrix);
}
}
sparse_matrix.compress(VectorOperation::add);
class MatrixFreeBlock
{
public:
- MatrixFreeBlock(const MatrixFree<dim, Number> &data_in) : data(data_in)
+ MatrixFreeBlock(const MatrixFree<dim, Number> &data_in)
+ : data(data_in)
{}
void
ConstraintMatrix constraints(relevant_set);
DoFTools::make_hanging_node_constraints(dof, constraints);
- VectorTools::interpolate_boundary_values(
- dof, 0, Functions::ZeroFunction<dim>(), constraints);
+ VectorTools::interpolate_boundary_values(dof,
+ 0,
+ Functions::ZeroFunction<dim>(),
+ constraints);
constraints.close();
deallog << "Testing " << dof.get_fe().get_name() << std::endl;
}
cell->get_dof_indices(local_dof_indices);
- constraints.distribute_local_to_global(
- cell_matrix, local_dof_indices, sparse_matrix);
+ constraints.distribute_local_to_global(cell_matrix,
+ local_dof_indices,
+ sparse_matrix);
}
}
typedef typename DoFHandler<dim>::active_cell_iterator CellIterator;
typedef double Number;
- MatrixFreeTest(const MatrixFree<dim, Number> &data_in) : data(data_in){};
+ MatrixFreeTest(const MatrixFree<dim, Number> &data_in)
+ : data(data_in){};
void
local_apply(const MatrixFree<dim, Number> & data,
vmult(VectorType &dst, const VectorType &src) const
{
dst = 0;
- data.cell_loop(
- &MatrixFreeTest<dim, degree, VectorType>::local_apply, this, dst, src);
+ data.cell_loop(&MatrixFreeTest<dim, degree, VectorType>::local_apply,
+ this,
+ dst,
+ src);
};
private:
local_matrix(i, j) = local_matrix(j, i);
cell->get_dof_indices(local_dof_indices);
- constraints.distribute_local_to_global(
- local_matrix, local_dof_indices, system_matrix);
+ constraints.distribute_local_to_global(local_matrix,
+ local_dof_indices,
+ system_matrix);
}
}
typedef typename DoFHandler<dim>::active_cell_iterator CellIterator;
typedef double Number;
- MatrixFreeTest(const MatrixFree<dim, Number> &data_in) : data(data_in){};
+ MatrixFreeTest(const MatrixFree<dim, Number> &data_in)
+ : data(data_in){};
void
local_apply(const MatrixFree<dim, Number> & data,
AssertDimension(dst.size(), dim);
for (unsigned int d = 0; d < dim; ++d)
dst[d] = 0;
- data.cell_loop(
- &MatrixFreeTest<dim, degree, VectorType>::local_apply, this, dst, src);
+ data.cell_loop(&MatrixFreeTest<dim, degree, VectorType>::local_apply,
+ this,
+ dst,
+ src);
};
private:
local_matrix(i, j) = local_matrix(j, i);
cell->get_dof_indices(local_dof_indices);
- constraints.distribute_local_to_global(
- local_matrix, local_dof_indices, system_matrix);
+ constraints.distribute_local_to_global(local_matrix,
+ local_dof_indices,
+ system_matrix);
}
}
class PeriodicHillManifold : public ChartManifold<dim>
{
public:
- PeriodicHillManifold() :
- ChartManifold<dim>(),
- h(0.028),
- x_max(9.0 * h),
- y_max(2.036 * h),
- y_FoR(h)
+ PeriodicHillManifold()
+ : ChartManifold<dim>()
+ , h(0.028)
+ , x_max(9.0 * h)
+ , y_max(2.036 * h)
+ , y_FoR(h)
{}
virtual std::unique_ptr<Manifold<dim>>
Y = Yn;
iter++;
}
- AssertThrow(
- iter < maxiter,
- ExcMessage("Newton within PullBack did not find the solution. "));
+ AssertThrow(iter < maxiter,
+ ExcMessage(
+ "Newton within PullBack did not find the solution. "));
xi[1] = Y;
}
else if (x[0] > x_max / 2.0)
Y = Yn;
iter++;
}
- AssertThrow(
- iter < maxiter,
- ExcMessage("Newton within PullBack did not find the solution. "));
+ AssertThrow(iter < maxiter,
+ ExcMessage(
+ "Newton within PullBack did not find the solution. "));
xi[1] = Y;
}
return xi;
if (dim == 3)
p[2] = -2.25 * h;
- GridGenerator::subdivided_hyper_rectangle(
- triangulation, refinements, p, coordinates);
+ GridGenerator::subdivided_hyper_rectangle(triangulation,
+ refinements,
+ p,
+ coordinates);
triangulation.last()->vertex(0)[1] = 0.;
if (dim == 3)
class MatrixFreeTest
{
public:
- MatrixFreeTest(const MatrixFree<dim, number> &data) : data(data)
+ MatrixFreeTest(const MatrixFree<dim, number> &data)
+ : data(data)
{}
void
public:
MatrixFreeVariant(const MatrixFree<dim, number> &data,
const bool zero_within_loop = true,
- const unsigned int start_vector_component = 0) :
- data(data),
- zero_within_loop(zero_within_loop),
- start_vector_component(start_vector_component)
+ const unsigned int start_vector_component = 0)
+ : data(data)
+ , zero_within_loop(zero_within_loop)
+ , start_vector_component(start_vector_component)
{}
void
public:
MatrixFreeAdvection(const MatrixFree<dim, number> &data,
const bool zero_within_loop = true,
- const unsigned int start_vector_component = 0) :
- data(data),
- zero_within_loop(zero_within_loop),
- start_vector_component(start_vector_component)
+ const unsigned int start_vector_component = 0)
+ : data(data)
+ , zero_within_loop(zero_within_loop)
+ , start_vector_component(start_vector_component)
{
for (unsigned int d = 0; d < dim; ++d)
advection[d] = 0.4 + 0.12 * d;
phi.reinit(cell);
phi.gather_evaluate(src, true, false);
for (unsigned int q = 0; q < phi.n_q_points; ++q)
- phi.submit_gradient(
- multiply_by_advection(advection, phi.get_value(q)), q);
+ phi.submit_gradient(multiply_by_advection(advection,
+ phi.get_value(q)),
+ q);
phi.integrate_scatter(false, true, dst);
}
}
[GeometryInfo<dim>::unit_normal_direction[dinfo.face_number]] *
info.fe_values(0).normal_vector(0)));
double penalty = normal_volume_fraction * std::max(1U, deg) * (deg + 1.0);
- LocalIntegrators::Laplace ::nitsche_matrix(
- dinfo.matrix(0, false).matrix, info.fe_values(0), penalty);
+ LocalIntegrators::Laplace ::nitsche_matrix(dinfo.matrix(0, false).matrix,
+ info.fe_values(0),
+ penalty);
}
UpdateFlags update_flags =
update_values | update_gradients | update_jacobians;
info_box.add_update_flags_all(update_flags);
- info_box.initialize_gauss_quadrature(
- n_q_points_1d, n_q_points_1d, n_q_points_1d);
+ info_box.initialize_gauss_quadrature(n_q_points_1d,
+ n_q_points_1d,
+ n_q_points_1d);
info_box.initialize(dof.get_fe(), mapping);
MeshWorker::DoFInfo<dim> dof_info(dof);
int
main(int argc, char **argv)
{
- Utilities::MPI::MPI_InitFinalize mpi_init(
- argc, argv, testing_max_num_threads());
+ Utilities::MPI::MPI_InitFinalize mpi_init(argc,
+ argv,
+ testing_max_num_threads());
mpi_initlog();
#else
int
class MatrixFreeTestHP
{
public:
- MatrixFreeTestHP(const MatrixFree<dim, Number> &data_in) : data(data_in){};
+ MatrixFreeTestHP(const MatrixFree<dim, Number> &data_in)
+ : data(data_in){};
void
local_apply(const MatrixFree<dim, Number> & data,
std::pair<unsigned int, unsigned int> subrange_deg =
data.create_cell_subrange_hp(cell_range, 1);
if (subrange_deg.second > subrange_deg.first)
- helmholtz_operator<dim, 1, Vector<Number>, 2>(
- data, dst, src, subrange_deg);
+ helmholtz_operator<dim, 1, Vector<Number>, 2>(data,
+ dst,
+ src,
+ subrange_deg);
subrange_deg = data.create_cell_subrange_hp(cell_range, 2);
if (subrange_deg.second > subrange_deg.first)
- helmholtz_operator<dim, 2, Vector<Number>, 3>(
- data, dst, src, subrange_deg);
+ helmholtz_operator<dim, 2, Vector<Number>, 3>(data,
+ dst,
+ src,
+ subrange_deg);
subrange_deg = data.create_cell_subrange_hp(cell_range, 3);
if (subrange_deg.second > subrange_deg.first)
- helmholtz_operator<dim, 3, Vector<Number>, 4>(
- data, dst, src, subrange_deg);
+ helmholtz_operator<dim, 3, Vector<Number>, 4>(data,
+ dst,
+ src,
+ subrange_deg);
subrange_deg = data.create_cell_subrange_hp(cell_range, 4);
if (subrange_deg.second > subrange_deg.first)
- helmholtz_operator<dim, 4, Vector<Number>, 5>(
- data, dst, src, subrange_deg);
+ helmholtz_operator<dim, 4, Vector<Number>, 5>(data,
+ dst,
+ src,
+ subrange_deg);
subrange_deg = data.create_cell_subrange_hp(cell_range, 5);
if (subrange_deg.second > subrange_deg.first)
- helmholtz_operator<dim, 5, Vector<Number>, 6>(
- data, dst, src, subrange_deg);
+ helmholtz_operator<dim, 5, Vector<Number>, 6>(data,
+ dst,
+ src,
+ subrange_deg);
subrange_deg = data.create_cell_subrange_hp(cell_range, 6);
if (subrange_deg.second > subrange_deg.first)
- helmholtz_operator<dim, 6, Vector<Number>, 7>(
- data, dst, src, subrange_deg);
+ helmholtz_operator<dim, 6, Vector<Number>, 7>(data,
+ dst,
+ src,
+ subrange_deg);
subrange_deg = data.create_cell_subrange_hp(cell_range, 7);
if (subrange_deg.second > subrange_deg.first)
- helmholtz_operator<dim, 7, Vector<Number>, 8>(
- data, dst, src, subrange_deg);
+ helmholtz_operator<dim, 7, Vector<Number>, 8>(data,
+ dst,
+ src,
+ subrange_deg);
}
void
dof.distribute_dofs(fe_collection);
ConstraintMatrix constraints;
DoFTools::make_hanging_node_constraints(dof, constraints);
- VectorTools::interpolate_boundary_values(
- dof, 0, Functions::ZeroFunction<dim>(), constraints);
+ VectorTools::interpolate_boundary_values(dof,
+ 0,
+ Functions::ZeroFunction<dim>(),
+ constraints);
constraints.close();
DynamicSparsityPattern csp(dof.n_dofs(), dof.n_dofs());
DoFTools::make_sparsity_pattern(dof, csp, constraints, false);
local_dof_indices.resize(dofs_per_cell);
cell->get_dof_indices(local_dof_indices);
- constraints.distribute_local_to_global(
- cell_matrix, local_dof_indices, system_matrix);
+ constraints.distribute_local_to_global(cell_matrix,
+ local_dof_indices,
+ system_matrix);
}
}
ConstraintMatrix constraints(relevant_set);
DoFTools::make_hanging_node_constraints(dof, constraints);
- VectorTools::interpolate_boundary_values(
- dof, 0, Functions::ZeroFunction<dim>(), constraints);
+ VectorTools::interpolate_boundary_values(dof,
+ 0,
+ Functions::ZeroFunction<dim>(),
+ constraints);
constraints.close();
deallog << "Testing " << dof.get_fe().get_name() << std::endl;
}
cell->get_dof_indices(local_dof_indices);
- constraints.distribute_local_to_global(
- cell_matrix, local_dof_indices, sparse_matrix);
+ constraints.distribute_local_to_global(cell_matrix,
+ local_dof_indices,
+ sparse_matrix);
}
}
public:
typedef VectorizedArray<Number> vector_t;
- MatrixFreeTest(const MatrixFree<dim, Number> &data_in) : data(data_in)
+ MatrixFreeTest(const MatrixFree<dim, Number> &data_in)
+ : data(data_in)
{}
void
vmult(VectorType &dst, const VectorType &src) const
{
dst = 0;
- const std::function<void(
- const MatrixFree<dim, typename VectorType::value_type> &,
- VectorType &,
- const VectorType &,
- const std::pair<unsigned int, unsigned int> &)>
+ const std::function<
+ void(const MatrixFree<dim, typename VectorType::value_type> &,
+ VectorType &,
+ const VectorType &,
+ const std::pair<unsigned int, unsigned int> &)>
wrap = helmholtz_operator<dim, fe_degree, VectorType, n_q_points_1d>;
data.cell_loop(wrap, dst, src);
}
dof.distribute_dofs(fe);
dof.distribute_mg_dofs(fe);
ConstraintMatrix constraints;
- VectorTools::interpolate_boundary_values(
- dof, 0, Functions::ZeroFunction<dim>(), constraints);
+ VectorTools::interpolate_boundary_values(dof,
+ 0,
+ Functions::ZeroFunction<dim>(),
+ constraints);
constraints.close();
// std::cout << "Number of cells: " <<
SparseMatrix<double> system_matrix;
{
DynamicSparsityPattern csp(dof.n_dofs(), dof.n_dofs());
- DoFTools::make_sparsity_pattern(
- static_cast<const DoFHandler<dim> &>(dof), csp, constraints, false);
+ DoFTools::make_sparsity_pattern(static_cast<const DoFHandler<dim> &>(dof),
+ csp,
+ constraints,
+ false);
sparsity.copy_from(csp);
}
system_matrix.reinit(sparsity);
fe_values.JxW(q_point));
}
cell->get_dof_indices(local_dof_indices);
- constraints.distribute_local_to_global(
- cell_matrix, local_dof_indices, system_matrix);
+ constraints.distribute_local_to_global(cell_matrix,
+ local_dof_indices,
+ system_matrix);
}
// now to the MG assembly
typedef typename DoFHandler<dim>::active_cell_iterator CellIterator;
typedef double Number;
- MatrixFreeTest(const MatrixFree<dim, Number> &data_in) : data(data_in){};
+ MatrixFreeTest(const MatrixFree<dim, Number> &data_in)
+ : data(data_in){};
void
local_apply(const MatrixFree<dim, Number> & data,
AssertDimension(dst.size(), dim + 1);
for (unsigned int d = 0; d < dim + 1; ++d)
dst[d] = 0;
- data.cell_loop(
- &MatrixFreeTest<dim, degree_p, VectorType>::local_apply, this, dst, src);
+ data.cell_loop(&MatrixFreeTest<dim, degree_p, VectorType>::local_apply,
+ this,
+ dst,
+ src);
};
private:
local_matrix(i, j) = local_matrix(j, i);
cell->get_dof_indices(local_dof_indices);
- constraints.distribute_local_to_global(
- local_matrix, local_dof_indices, system_matrix);
+ constraints.distribute_local_to_global(local_matrix,
+ local_dof_indices,
+ system_matrix);
}
}
}
cell->get_dof_indices(local_dof_indices);
- constraints.distribute_local_to_global(
- local_matrix, local_dof_indices, system_matrix);
+ constraints.distribute_local_to_global(local_matrix,
+ local_dof_indices,
+ system_matrix);
}
}
typedef typename DoFHandler<dim>::active_cell_iterator CellIterator;
typedef double Number;
- MatrixFreeTest(const MatrixFree<dim, Number> &data_in) : data(data_in)
+ MatrixFreeTest(const MatrixFree<dim, Number> &data_in)
+ : data(data_in)
{}
void
const std::pair<unsigned int, unsigned int> &cell_range) const
{
typedef VectorizedArray<Number> vector_t;
- FEEvaluation<dim, degree_p + 1, degree_p + 2, dim, Number> velocity(
- data, 0, 0, 0);
- FEEvaluation<dim, degree_p, degree_p + 2, 1, Number> pressure(
- data, 0, 0, dim);
+ FEEvaluation<dim, degree_p + 1, degree_p + 2, dim, Number> velocity(data,
+ 0,
+ 0,
+ 0);
+ FEEvaluation<dim, degree_p, degree_p + 2, 1, Number> pressure(data,
+ 0,
+ 0,
+ dim);
for (unsigned int cell = cell_range.first; cell < cell_range.second; ++cell)
{
vmult(VectorType &dst, const VectorType &src) const
{
dst = 0;
- data.cell_loop(
- &MatrixFreeTest<dim, degree_p, VectorType>::local_apply, this, dst, src);
+ data.cell_loop(&MatrixFreeTest<dim, degree_p, VectorType>::local_apply,
+ this,
+ dst,
+ src);
};
private:
no_normal_flux_boundaries.insert(0);
no_normal_flux_boundaries.insert(1);
DoFTools::make_hanging_node_constraints(dof_handler, constraints);
- VectorTools::compute_normal_flux_constraints(
- dof_handler, 0, no_normal_flux_boundaries, constraints);
+ VectorTools::compute_normal_flux_constraints(dof_handler,
+ 0,
+ no_normal_flux_boundaries,
+ constraints);
constraints.close();
std::vector<types::global_dof_index> dofs_per_block(2);
- DoFTools::count_dofs_per_block(
- dof_handler, dofs_per_block, stokes_sub_blocks);
+ DoFTools::count_dofs_per_block(dof_handler,
+ dofs_per_block,
+ stokes_sub_blocks);
{
BlockDynamicSparsityPattern csp(2, 2);
local_matrix(i, j) = local_matrix(j, i);
cell->get_dof_indices(local_dof_indices);
- constraints.distribute_local_to_global(
- local_matrix, local_dof_indices, system_matrix);
+ constraints.distribute_local_to_global(local_matrix,
+ local_dof_indices,
+ system_matrix);
}
}
typedef typename DoFHandler<dim>::active_cell_iterator CellIterator;
typedef double Number;
- MatrixFreeTest(const MatrixFree<dim, Number> &data_in) : data(data_in){};
+ MatrixFreeTest(const MatrixFree<dim, Number> &data_in)
+ : data(data_in){};
void
local_apply(const MatrixFree<dim, Number> & data,
vmult(VectorType &dst, const VectorType &src) const
{
dst = 0;
- data.cell_loop(
- &MatrixFreeTest<dim, degree_p, VectorType>::local_apply, this, dst, src);
+ data.cell_loop(&MatrixFreeTest<dim, degree_p, VectorType>::local_apply,
+ this,
+ dst,
+ src);
};
private:
constraints_p.close();
std::vector<types::global_dof_index> dofs_per_block(2);
- DoFTools::count_dofs_per_block(
- dof_handler, dofs_per_block, stokes_sub_blocks);
+ DoFTools::count_dofs_per_block(dof_handler,
+ dofs_per_block,
+ stokes_sub_blocks);
// std::cout << "Number of active cells: "
// << triangulation.n_active_cells()
local_matrix(i, j) = local_matrix(j, i);
cell->get_dof_indices(local_dof_indices);
- constraints.distribute_local_to_global(
- local_matrix, local_dof_indices, system_matrix);
+ constraints.distribute_local_to_global(local_matrix,
+ local_dof_indices,
+ system_matrix);
}
}
typedef typename DoFHandler<dim>::active_cell_iterator CellIterator;
typedef double Number;
- MatrixFreeTest(const MatrixFree<dim, Number> &data_in) : data(data_in){};
+ MatrixFreeTest(const MatrixFree<dim, Number> &data_in)
+ : data(data_in){};
void
local_apply(const MatrixFree<dim, Number> & data,
vmult(VectorType &dst, const VectorType &src) const
{
dst = 0;
- data.cell_loop(
- &MatrixFreeTest<dim, VectorType>::local_apply, this, dst, src);
+ data.cell_loop(&MatrixFreeTest<dim, VectorType>::local_apply,
+ this,
+ dst,
+ src);
};
private:
constraints_p.close();
std::vector<types::global_dof_index> dofs_per_block(2);
- DoFTools::count_dofs_per_block(
- dof_handler, dofs_per_block, stokes_sub_blocks);
+ DoFTools::count_dofs_per_block(dof_handler,
+ dofs_per_block,
+ stokes_sub_blocks);
// std::cout << "Number of active cells: "
// << triangulation.n_active_cells()
local_matrix(i, j) = local_matrix(j, i);
cell->get_dof_indices(local_dof_indices);
- constraints.distribute_local_to_global(
- local_matrix, local_dof_indices, system_matrix);
+ constraints.distribute_local_to_global(local_matrix,
+ local_dof_indices,
+ system_matrix);
}
}
typedef typename DoFHandler<dim>::active_cell_iterator CellIterator;
typedef double Number;
- MatrixFreeTest(const MatrixFree<dim, Number> &data_in) : data(data_in){};
+ MatrixFreeTest(const MatrixFree<dim, Number> &data_in)
+ : data(data_in){};
void
local_apply(const MatrixFree<dim, Number> & data,
const std::pair<unsigned int, unsigned int> &cell_range) const
{
typedef VectorizedArray<Number> vector_t;
- FEEvaluation<dim, degree_p + 1, degree_p + 2, dim, Number> velocity(
- data, 0, 0, 0);
- FEEvaluation<dim, degree_p, degree_p + 2, 1, Number> pressure(
- data, 0, 0, dim);
+ FEEvaluation<dim, degree_p + 1, degree_p + 2, dim, Number> velocity(data,
+ 0,
+ 0,
+ 0);
+ FEEvaluation<dim, degree_p, degree_p + 2, 1, Number> pressure(data,
+ 0,
+ 0,
+ dim);
for (unsigned int cell = cell_range.first; cell < cell_range.second; ++cell)
{
vmult(VectorType &dst, const VectorType &src) const
{
dst = 0;
- data.cell_loop(
- &MatrixFreeTest<dim, degree_p, VectorType>::local_apply, this, dst, src);
+ data.cell_loop(&MatrixFreeTest<dim, degree_p, VectorType>::local_apply,
+ this,
+ dst,
+ src);
};
private:
local_matrix(i, j) = local_matrix(j, i);
cell->get_dof_indices(local_dof_indices);
- constraints.distribute_local_to_global(
- local_matrix, local_dof_indices, system_matrix);
+ constraints.distribute_local_to_global(local_matrix,
+ local_dof_indices,
+ system_matrix);
}
}
typedef typename DoFHandler<dim>::active_cell_iterator CellIterator;
typedef double Number;
- MatrixFreeTest(const MatrixFree<dim, Number> &data_in) : data(data_in){};
+ MatrixFreeTest(const MatrixFree<dim, Number> &data_in)
+ : data(data_in){};
void
local_apply(const MatrixFree<dim, Number> & data,
AssertDimension(dst.size(), dim + 1);
for (unsigned int d = 0; d < dim + 1; ++d)
dst[d] = 0;
- data.cell_loop(
- &MatrixFreeTest<dim, degree_p, VectorType>::local_apply, this, dst, src);
+ data.cell_loop(&MatrixFreeTest<dim, degree_p, VectorType>::local_apply,
+ this,
+ dst,
+ src);
};
private:
local_matrix(i, j) = local_matrix(j, i);
cell->get_dof_indices(local_dof_indices);
- constraints.distribute_local_to_global(
- local_matrix, local_dof_indices, system_matrix);
+ constraints.distribute_local_to_global(local_matrix,
+ local_dof_indices,
+ system_matrix);
}
}
typedef typename DoFHandler<dim>::active_cell_iterator CellIterator;
typedef double Number;
- MatrixFreeTest(const MatrixFree<dim, Number> &data_in) : data(data_in){};
+ MatrixFreeTest(const MatrixFree<dim, Number> &data_in)
+ : data(data_in){};
void
local_apply(const MatrixFree<dim, Number> & data,
local_matrix(i, j) = local_matrix(j, i);
cell->get_dof_indices(local_dof_indices);
- constraints.distribute_local_to_global(
- local_matrix, local_dof_indices, system_matrix);
+ constraints.distribute_local_to_global(local_matrix,
+ local_dof_indices,
+ system_matrix);
}
}
LinearAlgebra::distributed::Vector<typename LAPLACEOPERATOR::value_type>>
{
public:
- MGTransferMF(const MGLevelObject<LAPLACEOPERATOR> &laplace) :
- laplace_operator(laplace){};
+ MGTransferMF(const MGLevelObject<LAPLACEOPERATOR> &laplace)
+ : laplace_operator(laplace){};
/**
* Overload copy_to_mg from MGTransferPrebuilt
{
public:
MGTransferMF(const MGLevelObject<LAPLACEOPERATOR> &laplace,
- const MGConstrainedDoFs & mg_constrained_dofs) :
- MGTransferMatrixFree<dim, typename LAPLACEOPERATOR::value_type>(
- mg_constrained_dofs),
- laplace_operator(laplace){};
+ const MGConstrainedDoFs & mg_constrained_dofs)
+ : MGTransferMatrixFree<dim, typename LAPLACEOPERATOR::value_type>(
+ mg_constrained_dofs)
+ , laplace_operator(laplace){};
/**
* Overload copy_to_mg from MGTransferPrebuilt
{
public:
MGTransferMF(const MGLevelObject<LAPLACEOPERATOR> &laplace,
- const MGConstrainedDoFs & mg_constrained_dofs) :
- MGTransferMatrixFree<dim, typename LAPLACEOPERATOR::value_type>(
- mg_constrained_dofs),
- laplace_operator(laplace){};
+ const MGConstrainedDoFs & mg_constrained_dofs)
+ : MGTransferMatrixFree<dim, typename LAPLACEOPERATOR::value_type>(
+ mg_constrained_dofs)
+ , laplace_operator(laplace){};
/**
* Overload copy_to_mg from MGTransferPrebuilt
public:
bool read_vector;
- MatrixFreeTest(const MatrixFree<dim, Number> &data_in) :
- read_vector(false),
- data(data_in){};
+ MatrixFreeTest(const MatrixFree<dim, Number> &data_in)
+ : read_vector(false)
+ , data(data_in){};
void
operator()(const MatrixFree<dim, Number> &data,
++it)
functions[*it] = &zero;
if (level == numbers::invalid_unsigned_int)
- VectorTools::interpolate_boundary_values(
- dof_handler, functions, constraints);
+ VectorTools::interpolate_boundary_values(dof_handler,
+ functions,
+ constraints);
else
{
std::vector<types::global_dof_index> local_dofs;
: public MGTransferPrebuilt<LinearAlgebra::distributed::Vector<double>>
{
public:
- MGTransferPrebuiltMF(const MGLevelObject<MatrixType> &laplace) :
- laplace_operator(laplace){};
+ MGTransferPrebuiltMF(const MGLevelObject<MatrixType> &laplace)
+ : laplace_operator(laplace){};
/**
* Overload copy_to_mg from MGTransferPrebuilt to get the vectors compatible
ConstraintMatrix constraints;
constraints.reinit(locally_relevant_dofs);
DoFTools::make_hanging_node_constraints(dof, constraints);
- VectorTools::interpolate_boundary_values(
- dof, dirichlet_boundary, constraints);
+ VectorTools::interpolate_boundary_values(dof,
+ dirichlet_boundary,
+ constraints);
constraints.close();
// level constraints:
level_constraints,
QGauss<1>(n_q_points_1d),
mg_additional_data);
- mg_matrices[level].initialize(
- std::make_shared<MatrixFree<dim, number>>(mg_level_data[level]),
- mg_constrained_dofs,
- level);
+ mg_matrices[level].initialize(std::make_shared<MatrixFree<dim, number>>(
+ mg_level_data[level]),
+ mg_constrained_dofs,
+ level);
mg_matrices[level].compute_diagonal();
}
DoFTools::extract_locally_relevant_dofs(dof_handler, relevant_dofs);
constraints.reinit(relevant_dofs);
DoFTools::make_hanging_node_constraints(dof_handler, constraints);
- VectorTools::interpolate_boundary_values(
- dof_handler, dirichlet_boundary, constraints);
+ VectorTools::interpolate_boundary_values(dof_handler,
+ dirichlet_boundary,
+ constraints);
}
else
{
IndexSet relevant_dofs;
- DoFTools::extract_locally_relevant_level_dofs(
- dof_handler, level, relevant_dofs);
+ DoFTools::extract_locally_relevant_level_dofs(dof_handler,
+ level,
+ relevant_dofs);
constraints.reinit(relevant_dofs);
constraints.add_lines(mg_constrained_dofs.get_boundary_indices(level));
{
public:
MGTransferMF(const MGLevelObject<LAPLACEOPERATOR> &laplace,
- const MGConstrainedDoFs & mg_constrained_dofs) :
- MGTransferPrebuilt<LinearAlgebra::distributed::Vector<double>>(
- mg_constrained_dofs),
- laplace_operator(laplace)
+ const MGConstrainedDoFs & mg_constrained_dofs)
+ : MGTransferPrebuilt<LinearAlgebra::distributed::Vector<double>>(
+ mg_constrained_dofs)
+ , laplace_operator(laplace)
{}
/**
{
public:
MGTransferMF(const MGLevelObject<LAPLACEOPERATOR> &laplace,
- const MGConstrainedDoFs & mg_constrained_dofs) :
- MGTransferMatrixFree<dim, typename LAPLACEOPERATOR::value_type>(
- mg_constrained_dofs),
- laplace_operator(laplace)
+ const MGConstrainedDoFs & mg_constrained_dofs)
+ : MGTransferMatrixFree<dim, typename LAPLACEOPERATOR::value_type>(
+ mg_constrained_dofs)
+ , laplace_operator(laplace)
{}
/**
ConstraintMatrix constraints;
constraints.reinit(locally_relevant_dofs);
DoFTools::make_hanging_node_constraints(dof, constraints);
- VectorTools::interpolate_boundary_values(
- dof, dirichlet_boundary, constraints);
+ VectorTools::interpolate_boundary_values(dof,
+ dirichlet_boundary,
+ constraints);
constraints.close();
// level constraints:
level_constraints,
QGauss<1>(n_q_points_1d),
mg_additional_data);
- mg_matrices[level].initialize(
- std::make_shared<MatrixFree<dim, number>>(mg_level_data[level]),
- mg_constrained_dofs,
- level);
+ mg_matrices[level].initialize(std::make_shared<MatrixFree<dim, number>>(
+ mg_level_data[level]),
+ mg_constrained_dofs,
+ level);
mg_matrices[level].compute_diagonal();
}
MGLevelObject<MGInterfaceOperator<LevelMatrixType>> mg_interface_matrices;
DoFTools::extract_locally_relevant_dofs(dof_handler, relevant_dofs);
constraints.reinit(relevant_dofs);
DoFTools::make_hanging_node_constraints(dof_handler, constraints);
- VectorTools::interpolate_boundary_values(
- dof_handler, dirichlet_boundary, constraints);
+ VectorTools::interpolate_boundary_values(dof_handler,
+ dirichlet_boundary,
+ constraints);
}
else
{
IndexSet relevant_dofs;
- DoFTools::extract_locally_relevant_level_dofs(
- dof_handler, level, relevant_dofs);
+ DoFTools::extract_locally_relevant_level_dofs(dof_handler,
+ level,
+ relevant_dofs);
constraints.reinit(relevant_dofs);
constraints.add_lines(mg_constrained_dofs.get_boundary_indices(level));
{
public:
MGTransferMF(const MGLevelObject<LAPLACEOPERATOR> &laplace,
- const MGConstrainedDoFs & mg_constrained_dofs) :
- MGTransferMatrixFree<dim, typename LAPLACEOPERATOR::value_type>(
- mg_constrained_dofs),
- laplace_operator(laplace)
+ const MGConstrainedDoFs & mg_constrained_dofs)
+ : MGTransferMatrixFree<dim, typename LAPLACEOPERATOR::value_type>(
+ mg_constrained_dofs)
+ , laplace_operator(laplace)
{}
/**
int
main(int argc, char **argv)
{
- Utilities::MPI::MPI_InitFinalize mpi_init(
- argc, argv, testing_max_num_threads());
+ Utilities::MPI::MPI_InitFinalize mpi_init(argc,
+ argv,
+ testing_max_num_threads());
mpi_initlog();
{
public:
MGTransferMF(const MGLevelObject<LAPLACEOPERATOR> &laplace,
- const MGConstrainedDoFs & mg_constrained_dofs) :
- MGTransferMatrixFree<dim, typename LAPLACEOPERATOR::value_type>(
- mg_constrained_dofs),
- laplace_operator(laplace)
+ const MGConstrainedDoFs & mg_constrained_dofs)
+ : MGTransferMatrixFree<dim, typename LAPLACEOPERATOR::value_type>(
+ mg_constrained_dofs)
+ , laplace_operator(laplace)
{}
/**
ConstraintMatrix constraints;
constraints.reinit(locally_relevant_dofs);
DoFTools::make_hanging_node_constraints(dof, constraints);
- VectorTools::interpolate_boundary_values(
- dof, dirichlet_boundary, constraints);
+ VectorTools::interpolate_boundary_values(dof,
+ dirichlet_boundary,
+ constraints);
constraints.close();
// level constraints:
level_constraints,
QGauss<1>(n_q_points_1d),
mg_additional_data);
- mg_matrices[level].initialize(
- std::make_shared<MatrixFree<dim, number>>(mg_level_data[level]),
- mg_constrained_dofs,
- level);
+ mg_matrices[level].initialize(std::make_shared<MatrixFree<dim, number>>(
+ mg_level_data[level]),
+ mg_constrained_dofs,
+ level);
mg_matrices[level].compute_diagonal();
}
MGLevelObject<MGInterfaceOperator<LevelMatrixType>> mg_interface_matrices;
DoFTools::extract_locally_relevant_dofs(dof_handler, relevant_dofs);
constraints.reinit(relevant_dofs);
DoFTools::make_hanging_node_constraints(dof_handler, constraints);
- VectorTools::interpolate_boundary_values(
- dof_handler, dirichlet_boundary, constraints);
+ VectorTools::interpolate_boundary_values(dof_handler,
+ dirichlet_boundary,
+ constraints);
}
else
{
IndexSet relevant_dofs;
- DoFTools::extract_locally_relevant_level_dofs(
- dof_handler, level, relevant_dofs);
+ DoFTools::extract_locally_relevant_level_dofs(dof_handler,
+ level,
+ relevant_dofs);
constraints.reinit(relevant_dofs);
constraints.add_lines(mg_constrained_dofs.get_boundary_indices(level));
{
public:
MGTransferMF(const MGLevelObject<LAPLACEOPERATOR> &laplace,
- const MGConstrainedDoFs & mg_constrained_dofs) :
- MGTransferMatrixFree<dim, typename LAPLACEOPERATOR::value_type>(
- mg_constrained_dofs),
- laplace_operator(laplace)
+ const MGConstrainedDoFs & mg_constrained_dofs)
+ : MGTransferMatrixFree<dim, typename LAPLACEOPERATOR::value_type>(
+ mg_constrained_dofs)
+ , laplace_operator(laplace)
{}
/**
typedef typename BlockVectorType::value_type value_type;
typedef typename BlockVectorType::size_type size_type;
- BlockLaplace() : Subscriptor()
+ BlockLaplace()
+ : Subscriptor()
{}
void
ConstraintMatrix constraints;
constraints.reinit(locally_relevant_dofs);
DoFTools::make_hanging_node_constraints(dof, constraints);
- VectorTools::interpolate_boundary_values(
- dof, dirichlet_boundary, constraints);
+ VectorTools::interpolate_boundary_values(dof,
+ dirichlet_boundary,
+ constraints);
constraints.close();
// level constraints:
level_constraints,
QGauss<1>(n_q_points_1d),
mg_additional_data);
- mg_matrices[level].initialize(
- std::make_shared<MatrixFree<dim, number>>(mg_level_data[level]),
- mg_constrained_dofs,
- level);
+ mg_matrices[level].initialize(std::make_shared<MatrixFree<dim, number>>(
+ mg_level_data[level]),
+ mg_constrained_dofs,
+ level);
mg_matrices[level].compute_diagonal();
}
{
public:
MGTransferMF(const MGLevelObject<LAPLACEOPERATOR> &laplace,
- const MGConstrainedDoFs & mg_constrained_dofs) :
- MGTransferMatrixFree<dim, typename LAPLACEOPERATOR::value_type>(
- mg_constrained_dofs),
- laplace_operator(laplace)
+ const MGConstrainedDoFs & mg_constrained_dofs)
+ : MGTransferMatrixFree<dim, typename LAPLACEOPERATOR::value_type>(
+ mg_constrained_dofs)
+ , laplace_operator(laplace)
{}
/**
ConstraintMatrix constraints;
constraints.reinit(locally_relevant_dofs);
DoFTools::make_hanging_node_constraints(dof, constraints);
- VectorTools::interpolate_boundary_values(
- dof, dirichlet_boundary, constraints);
+ VectorTools::interpolate_boundary_values(dof,
+ dirichlet_boundary,
+ constraints);
constraints.close();
// level constraints:
level_constraints,
QGauss<1>(n_q_points_1d),
mg_additional_data);
- mg_matrices[level].initialize(
- std::make_shared<MatrixFree<dim, number>>(mg_level_data[level]),
- mg_constrained_dofs,
- level);
+ mg_matrices[level].initialize(std::make_shared<MatrixFree<dim, number>>(
+ mg_level_data[level]),
+ mg_constrained_dofs,
+ level);
mg_matrices[level].compute_diagonal();
}
MGLevelObject<MGInterfaceOperator<LevelMatrixType>> mg_interface_matrices;
typedef typename BlockVectorType::value_type value_type;
typedef typename BlockVectorType::size_type size_type;
- BlockLaplace() : Subscriptor()
+ BlockLaplace()
+ : Subscriptor()
{}
void
const std::vector<MGConstrainedDoFs> &mg_constrained_dofs,
const unsigned int level)
{
- laplace1.initialize(
- data, mg_constrained_dofs[0], level, std::vector<unsigned int>(1, 0));
- laplace2.initialize(
- data, mg_constrained_dofs[1], level, std::vector<unsigned int>(1, 1));
+ laplace1.initialize(data,
+ mg_constrained_dofs[0],
+ level,
+ std::vector<unsigned int>(1, 0));
+ laplace2.initialize(data,
+ mg_constrained_dofs[1],
+ level,
+ std::vector<unsigned int>(1, 1));
}
void
{
constraints[i].reinit(locally_relevant_dofs[i]);
DoFTools::make_hanging_node_constraints(*dof[i], constraints[i]);
- VectorTools::interpolate_boundary_values(
- *dof[i], dirichlet_boundary, constraints[i]);
+ VectorTools::interpolate_boundary_values(*dof[i],
+ dirichlet_boundary,
+ constraints[i]);
constraints[i].close();
constraints_ptrs[i] = &constraints[i];
}
for (unsigned int i = 0; i < dof.size(); ++i)
{
IndexSet relevant_dofs;
- DoFTools::extract_locally_relevant_level_dofs(
- *dof[i], level, relevant_dofs);
+ DoFTools::extract_locally_relevant_level_dofs(*dof[i],
+ level,
+ relevant_dofs);
level_constraints[i].reinit(relevant_dofs);
level_constraints[i].add_lines(
mg_constrained_dofs[i].get_boundary_indices(level));
mg_level_data[level].reinit(
mapping, dof, level_constraints_ptrs, quad, mg_additional_data);
- mg_matrices[level].initialize(
- std::make_shared<MatrixFree<dim, number>>(mg_level_data[level]),
- mg_constrained_dofs,
- level);
+ mg_matrices[level].initialize(std::make_shared<MatrixFree<dim, number>>(
+ mg_level_data[level]),
+ mg_constrained_dofs,
+ level);
mg_matrices[level].compute_diagonal();
}
MGLevelObject<MGInterfaceOperator<LevelMatrixType>> mg_interface_matrices;
- mg_interface_matrices.resize(
- 0, dof[0]->get_triangulation().n_global_levels() - 1);
+ mg_interface_matrices.resize(0,
+ dof[0]->get_triangulation().n_global_levels() -
+ 1);
for (unsigned int level = 0;
level < dof[0]->get_triangulation().n_global_levels();
++level)
++it)
functions[*it] = &zero;
if (level == numbers::invalid_unsigned_int)
- VectorTools::interpolate_boundary_values(
- dof_handler, functions, constraints);
+ VectorTools::interpolate_boundary_values(dof_handler,
+ functions,
+ constraints);
else
{
std::vector<types::global_dof_index> local_dofs;
{
public:
MGTransferPrebuiltMF(const MGLevelObject<MatrixType> &laplace,
- const MGConstrainedDoFs & mg_constrained_dofs) :
- MGTransferMatrixFree<dim, typename MatrixType::value_type>(
- mg_constrained_dofs),
- laplace_operator(laplace){};
+ const MGConstrainedDoFs & mg_constrained_dofs)
+ : MGTransferMatrixFree<dim, typename MatrixType::value_type>(
+ mg_constrained_dofs)
+ , laplace_operator(laplace){};
/**
* Overload copy_to_mg from MGTransferPrebuilt to get the vectors compatible
double error_points = 0, abs_points = 0;
const unsigned int n_cells = mf_data.n_macro_cells();
FEEvaluation<dim, fe_degree> fe_eval(mf_data);
- FEValues<dim> fe_values(
- mapping, fe, mf_data.get_quadrature(), update_quadrature_points);
+ FEValues<dim> fe_values(mapping,
+ fe,
+ mf_data.get_quadrature(),
+ update_quadrature_points);
typedef VectorizedArray<double> vector_t;
for (unsigned int cell = 0; cell < n_cells; ++cell)
class Coefficient : public Function<dim>
{
public:
- Coefficient() : Function<dim>()
+ Coefficient()
+ : Function<dim>()
{}
virtual double
template <int dim, int fe_degree, typename number>
- LaplaceOperator<dim, fe_degree, number>::LaplaceOperator() : Subscriptor()
+ LaplaceOperator<dim, fe_degree, number>::LaplaceOperator()
+ : Subscriptor()
{}
additional_data.level_mg_handler = level;
additional_data.mapping_update_flags =
(update_gradients | update_JxW_values | update_quadrature_points);
- data.reinit(
- dof_handler, constraints, QGauss<1>(fe_degree + 1), additional_data);
+ data.reinit(dof_handler,
+ constraints,
+ QGauss<1>(fe_degree + 1),
+ additional_data);
evaluate_coefficient(Coefficient<dim>());
}
phi.read_dof_values(src);
phi.evaluate(false, true, false);
for (unsigned int q = 0; q < phi.n_q_points; ++q)
- phi.submit_gradient(
- coefficient[cell * phi.n_q_points + q] * phi.get_gradient(q), q);
+ phi.submit_gradient(coefficient[cell * phi.n_q_points + q] *
+ phi.get_gradient(q),
+ q);
phi.integrate(false, true);
phi.distribute_local_to_global(dst);
}
template <int dim>
- LaplaceProblem<dim>::LaplaceProblem() :
- triangulation(Triangulation<dim>::limit_level_difference_at_vertices),
- fe(degree_finite_element),
- dof_handler(triangulation)
+ LaplaceProblem<dim>::LaplaceProblem()
+ : triangulation(Triangulation<dim>::limit_level_difference_at_vertices)
+ , fe(degree_finite_element)
+ , dof_handler(triangulation)
{}
<< std::endl;
constraints.clear();
- VectorTools::interpolate_boundary_values(
- dof_handler, 0, Functions::ZeroFunction<dim>(), constraints);
+ VectorTools::interpolate_boundary_values(dof_handler,
+ 0,
+ Functions::ZeroFunction<dim>(),
+ constraints);
constraints.close();
system_matrix.reinit(dof_handler, constraints);
dirichlet_boundary[0] = &homogeneous_dirichlet_bc;
std::vector<std::set<types::global_dof_index>> boundary_indices(
triangulation.n_levels());
- MGTools::make_boundary_list(
- dof_handler, dirichlet_boundary, boundary_indices);
+ MGTools::make_boundary_list(dof_handler,
+ dirichlet_boundary,
+ boundary_indices);
for (unsigned int level = 0; level < nlevels; ++level)
{
std::set<types::global_dof_index>::iterator bc_it =
LaplaceProblem<dim>::assemble_system()
{
QGauss<dim> quadrature_formula(fe.degree + 1);
- FEValues<dim> fe_values(
- fe, quadrature_formula, update_values | update_JxW_values);
+ FEValues<dim> fe_values(fe,
+ quadrature_formula,
+ update_values | update_JxW_values);
const unsigned int dofs_per_cell = fe.dofs_per_cell;
const unsigned int n_q_points = quadrature_formula.size();
coefficient_values[q] * fe_values.JxW(q));
local_diagonal(i) = local_diag;
}
- mg_constraints[level].distribute_local_to_global(
- local_diagonal, local_dof_indices, diagonals[level]);
+ mg_constraints[level].distribute_local_to_global(local_diagonal,
+ local_dof_indices,
+ diagonals[level]);
if (level == 0)
{
coefficient_values[q] * fe_values.JxW(q));
local_matrix(i, j) = add_value;
}
- mg_constraints[0].distribute_local_to_global(
- local_matrix, local_dof_indices, coarse_matrix);
+ mg_constraints[0].distribute_local_to_global(local_matrix,
+ local_dof_indices,
+ coarse_matrix);
}
}
template <int dim, int fe_degree>
SineGordonOperation<dim, fe_degree>::SineGordonOperation(
const MatrixFree<dim, double> &data_in,
- const double time_step) :
- data(data_in),
- delta_t_sqr(make_vectorized_array(time_step * time_step))
+ const double time_step)
+ : data(data_in)
+ , delta_t_sqr(make_vectorized_array(time_step * time_step))
{
VectorizedArray<double> one = make_vectorized_array(1.);
const std::vector<LinearAlgebra::distributed::Vector<double> *> &src) const
{
dst = 0;
- data.cell_loop(
- &SineGordonOperation<dim, fe_degree>::local_apply, this, dst, src);
+ data.cell_loop(&SineGordonOperation<dim, fe_degree>::local_apply,
+ this,
+ dst,
+ src);
dst.scale(inv_mass_matrix);
}
class ExactSolution : public Function<dim>
{
public:
- ExactSolution(const unsigned int n_components = 1, const double time = 0.) :
- Function<dim>(n_components, time)
+ ExactSolution(const unsigned int n_components = 1, const double time = 0.)
+ : Function<dim>(n_components, time)
{}
virtual double
value(const Point<dim> &p, const unsigned int component = 0) const;
template <int dim>
- SineGordonProblem<dim>::SineGordonProblem() :
+ SineGordonProblem<dim>::SineGordonProblem()
+ :
#ifdef DEAL_II_WITH_P4EST
- triangulation(MPI_COMM_WORLD),
+ triangulation(MPI_COMM_WORLD)
+ ,
#endif
- fe(QGaussLobatto<1>(fe_degree + 1)),
- dof_handler(triangulation),
- n_global_refinements(8 - 2 * dim),
- time(-10),
- final_time(-9),
- cfl_number(.1 / fe_degree),
- output_timestep_skip(200)
+ fe(QGaussLobatto<1>(fe_degree + 1))
+ , dof_handler(triangulation)
+ , n_global_refinements(8 - 2 * dim)
+ , time(-10)
+ , final_time(-9)
+ , cfl_number(.1 / fe_degree)
+ , output_timestep_skip(200)
{}
additional_data.tasks_parallel_scheme =
MatrixFree<dim>::AdditionalData::partition_partition;
- matrix_free_data.reinit(
- dof_handler, constraints, quadrature, additional_data);
+ matrix_free_data.reinit(dof_handler,
+ constraints,
+ quadrature,
+ additional_data);
matrix_free_data.initialize_dof_vector(solution);
old_solution.reinit(solution);
<< std::endl;
- VectorTools::interpolate(
- dof_handler, ExactSolution<dim>(1, time), solution);
- VectorTools::interpolate(
- dof_handler, ExactSolution<dim>(1, time - time_step), old_solution);
+ VectorTools::interpolate(dof_handler,
+ ExactSolution<dim>(1, time),
+ solution);
+ VectorTools::interpolate(dof_handler,
+ ExactSolution<dim>(1, time - time_step),
+ old_solution);
output_results(0);
std::vector<LinearAlgebra::distributed::Vector<double> *>
template <int dim, int fe_degree>
SineGordonOperation<dim, fe_degree>::SineGordonOperation(
const MatrixFree<dim, double> &data_in,
- const double time_step) :
- data(data_in),
- delta_t_sqr(make_vectorized_array(time_step * time_step))
+ const double time_step)
+ : data(data_in)
+ , delta_t_sqr(make_vectorized_array(time_step * time_step))
{
VectorizedArray<double> one = make_vectorized_array(1.);
const std::vector<LinearAlgebra::distributed::Vector<double> *> &src) const
{
dst = 0;
- data.cell_loop(
- &SineGordonOperation<dim, fe_degree>::local_apply, this, dst, src);
+ data.cell_loop(&SineGordonOperation<dim, fe_degree>::local_apply,
+ this,
+ dst,
+ src);
dst.scale(inv_mass_matrix);
}
class ExactSolution : public Function<dim>
{
public:
- ExactSolution(const unsigned int n_components = 1, const double time = 0.) :
- Function<dim>(n_components, time)
+ ExactSolution(const unsigned int n_components = 1, const double time = 0.)
+ : Function<dim>(n_components, time)
{}
virtual double
value(const Point<dim> &p, const unsigned int component = 0) const;
template <int dim>
- SineGordonProblem<dim>::SineGordonProblem() :
- fe(QGaussLobatto<1>(fe_degree + 1)),
- dof_handler(triangulation),
- n_global_refinements(2),
- time(-10),
- final_time(-9.75),
- cfl_number(.1 / fe_degree),
- output_timestep_skip(1)
+ SineGordonProblem<dim>::SineGordonProblem()
+ : fe(QGaussLobatto<1>(fe_degree + 1))
+ , dof_handler(triangulation)
+ , n_global_refinements(2)
+ , time(-10)
+ , final_time(-9.75)
+ , cfl_number(.1 / fe_degree)
+ , output_timestep_skip(1)
{}
additional_data.tasks_parallel_scheme =
MatrixFree<dim>::AdditionalData::none;
- matrix_free_data.reinit(
- dof_handler, constraints, quadrature, additional_data);
+ matrix_free_data.reinit(dof_handler,
+ constraints,
+ quadrature,
+ additional_data);
matrix_free_data.initialize_dof_vector(solution);
old_solution.reinit(solution);
<< std::endl;
- VectorTools::interpolate(
- dof_handler, ExactSolution<dim>(1, time), solution);
- VectorTools::interpolate(
- dof_handler, ExactSolution<dim>(1, time - time_step), old_solution);
+ VectorTools::interpolate(dof_handler,
+ ExactSolution<dim>(1, time),
+ solution);
+ VectorTools::interpolate(dof_handler,
+ ExactSolution<dim>(1, time - time_step),
+ old_solution);
output_norm();
std::vector<LinearAlgebra::distributed::Vector<double> *>
template <int dim, int fe_degree>
SineGordonOperation<dim, fe_degree>::SineGordonOperation(
const MatrixFree<dim, double> &data_in,
- const double time_step) :
- data(data_in),
- delta_t_sqr(make_vectorized_array(time_step * time_step))
+ const double time_step)
+ : data(data_in)
+ , delta_t_sqr(make_vectorized_array(time_step * time_step))
{
VectorizedArray<double> one = make_vectorized_array(1.);
const std::vector<LinearAlgebra::distributed::Vector<double> *> &src) const
{
dst = 0;
- data.cell_loop(
- &SineGordonOperation<dim, fe_degree>::local_apply, this, dst, src);
+ data.cell_loop(&SineGordonOperation<dim, fe_degree>::local_apply,
+ this,
+ dst,
+ src);
dst.scale(inv_mass_matrix);
}
class InitialSolution : public Function<dim>
{
public:
- InitialSolution(const unsigned int n_components = 1,
- const double time = 0.) :
- Function<dim>(n_components, time)
+ InitialSolution(const unsigned int n_components = 1, const double time = 0.)
+ : Function<dim>(n_components, time)
{}
virtual double
value(const Point<dim> &p, const unsigned int component = 0) const;
template <int dim>
- SineGordonProblem<dim>::SineGordonProblem() :
+ SineGordonProblem<dim>::SineGordonProblem()
+ :
#ifdef DEAL_II_WITH_P4EST
- triangulation(MPI_COMM_WORLD),
+ triangulation(MPI_COMM_WORLD)
+ ,
#endif
- fe(QGaussLobatto<1>(fe_degree + 1)),
- dof_handler(triangulation),
- n_global_refinements(9 - 2 * dim),
- time(-10),
- final_time(-9),
- cfl_number(.1 / fe_degree),
- output_timestep_skip(200)
+ fe(QGaussLobatto<1>(fe_degree + 1))
+ , dof_handler(triangulation)
+ , n_global_refinements(9 - 2 * dim)
+ , time(-10)
+ , final_time(-9)
+ , cfl_number(.1 / fe_degree)
+ , output_timestep_skip(200)
{}
additional_data.tasks_parallel_scheme =
MatrixFree<dim>::AdditionalData::partition_partition;
- matrix_free_data.reinit(
- dof_handler, constraints, quadrature, additional_data);
+ matrix_free_data.reinit(dof_handler,
+ constraints,
+ quadrature,
+ additional_data);
matrix_free_data.initialize_dof_vector(solution);
old_solution.reinit(solution);
<< std::endl;
- VectorTools::interpolate(
- dof_handler, InitialSolution<dim>(1, time), solution);
- VectorTools::interpolate(
- dof_handler, InitialSolution<dim>(1, time - time_step), old_solution);
+ VectorTools::interpolate(dof_handler,
+ InitialSolution<dim>(1, time),
+ solution);
+ VectorTools::interpolate(dof_handler,
+ InitialSolution<dim>(1, time - time_step),
+ old_solution);
output_results(0);
std::vector<LinearAlgebra::distributed::Vector<double> *>
const PreconditionerA & Apreconditioner,
const bool do_solve_A,
const double A_block_tolerance,
- const double S_block_tolerance) :
- stokes_matrix(S),
- mass_matrix(Mass),
- mp_preconditioner(Mppreconditioner),
- a_preconditioner(Apreconditioner),
- do_solve_A(do_solve_A),
- n_iterations_A_(0),
- n_iterations_S_(0),
- A_block_tolerance(A_block_tolerance),
- S_block_tolerance(S_block_tolerance)
+ const double S_block_tolerance)
+ : stokes_matrix(S)
+ , mass_matrix(Mass)
+ , mp_preconditioner(Mppreconditioner)
+ , a_preconditioner(Apreconditioner)
+ , do_solve_A(do_solve_A)
+ , n_iterations_A_(0)
+ , n_iterations_S_(0)
+ , A_block_tolerance(A_block_tolerance)
+ , S_block_tolerance(S_block_tolerance)
{}
template <class StokesMatrixType,
// first solve with the bottom left block, which we have built
// as a mass matrix with the inverse of the viscosity
{
- SolverControl solver_control(
- 1000, src.block(1).l2_norm() * S_block_tolerance, false, false);
+ SolverControl solver_control(1000,
+ src.block(1).l2_norm() * S_block_tolerance,
+ false,
+ false);
SolverCG<LinearAlgebra::distributed::Vector<double>> solver(
solver_control);
try
{
dst.block(1) = 0.0;
- solver.solve(
- mass_matrix, dst.block(1), src.block(1), mp_preconditioner);
+ solver.solve(mass_matrix,
+ dst.block(1),
+ src.block(1),
+ mp_preconditioner);
n_iterations_S_ += solver_control.last_step();
}
// if the solver fails, report the error from processor 0 with some
class ExactSolution_BoundaryValues : public Function<dim>
{
public:
- ExactSolution_BoundaryValues() : Function<dim>(dim + 1)
+ ExactSolution_BoundaryValues()
+ : Function<dim>(dim + 1)
{}
virtual void
vector_value(const Point<dim> &p, Vector<double> &value) const;
class ExactSolution_BoundaryValues_u : public Function<dim>
{
public:
- ExactSolution_BoundaryValues_u() : Function<dim>(dim)
+ ExactSolution_BoundaryValues_u()
+ : Function<dim>(dim)
{}
virtual void
vector_value(const Point<dim> &p, Vector<double> &value) const;
Base<dim, LinearAlgebra::distributed::BlockVector<number>>
{
public:
- StokesOperator() :
- MatrixFreeOperators::
- Base<dim, LinearAlgebra::distributed::BlockVector<number>>()
+ StokesOperator()
+ : MatrixFreeOperators::
+ Base<dim, LinearAlgebra::distributed::BlockVector<number>>()
{}
void
clear();
Base<dim, LinearAlgebra::distributed::Vector<number>>
{
public:
- MassMatrixOperator() :
- MatrixFreeOperators::Base<dim,
- LinearAlgebra::distributed::Vector<number>>()
+ MassMatrixOperator()
+ : MatrixFreeOperators::Base<dim,
+ LinearAlgebra::distributed::Vector<number>>()
{}
void
clear();
pressure.read_dof_values(src);
pressure.evaluate(true, false);
for (unsigned int q = 0; q < pressure.n_q_points; ++q)
- pressure.submit_value(
- one_over_viscosity(cell, q) * pressure.get_value(q), q);
+ pressure.submit_value(one_over_viscosity(cell, q) *
+ pressure.get_value(q),
+ q);
pressure.integrate(true, false);
pressure.distribute_local_to_global(dst);
}
this->data->initialize_dof_vector(inverse_diagonal);
this->data->initialize_dof_vector(diagonal);
- this->data->cell_loop(
- &MassMatrixOperator::local_compute_diagonal, this, diagonal, dummy);
+ this->data->cell_loop(&MassMatrixOperator::local_compute_diagonal,
+ this,
+ diagonal,
+ dummy);
this->set_constrained_entries_to_one(diagonal);
inverse_diagonal = diagonal;
pressure.evaluate(true, false, false);
for (unsigned int q = 0; q < pressure.n_q_points; ++q)
- pressure.submit_value(
- one_over_viscosity(cell, q) * pressure.get_value(q), q);
+ pressure.submit_value(one_over_viscosity(cell, q) *
+ pressure.get_value(q),
+ q);
pressure.integrate(true, false);
diagonal[i] = pressure.begin_dof_values()[i];
Base<dim, LinearAlgebra::distributed::Vector<number>>
{
public:
- ABlockOperator() :
- MatrixFreeOperators::Base<dim,
- LinearAlgebra::distributed::Vector<number>>()
+ ABlockOperator()
+ : MatrixFreeOperators::Base<dim,
+ LinearAlgebra::distributed::Vector<number>>()
{}
void
clear();
this->inverse_diagonal_entries->get_vector();
this->data->initialize_dof_vector(inverse_diagonal);
unsigned int dummy = 0;
- this->data->cell_loop(
- &ABlockOperator::local_compute_diagonal, this, inverse_diagonal, dummy);
+ this->data->cell_loop(&ABlockOperator::local_compute_diagonal,
+ this,
+ inverse_diagonal,
+ dummy);
this->set_constrained_entries_to_one(inverse_diagonal);
template <int dim>
- StokesProblem<dim>::StokesProblem() :
- degree_u(velocity_degree),
- fe_u(FE_Q<dim>(degree_u), dim),
- fe_p(FE_Q<dim>(degree_u - 1)),
- triangulation(
- MPI_COMM_WORLD,
- typename Triangulation<dim>::MeshSmoothing(
- Triangulation<dim>::limit_level_difference_at_vertices |
- Triangulation<dim>::smoothing_on_refinement |
- Triangulation<dim>::smoothing_on_coarsening),
- parallel::distributed::Triangulation<dim>::construct_multigrid_hierarchy),
- dof_handler_u(triangulation),
- dof_handler_p(triangulation)
+ StokesProblem<dim>::StokesProblem()
+ : degree_u(velocity_degree)
+ , fe_u(FE_Q<dim>(degree_u), dim)
+ , fe_p(FE_Q<dim>(degree_u - 1))
+ , triangulation(MPI_COMM_WORLD,
+ typename Triangulation<dim>::MeshSmoothing(
+ Triangulation<dim>::limit_level_difference_at_vertices |
+ Triangulation<dim>::smoothing_on_refinement |
+ Triangulation<dim>::smoothing_on_coarsening),
+ parallel::distributed::Triangulation<
+ dim>::construct_multigrid_hierarchy)
+ , dof_handler_u(triangulation)
+ , dof_handler_p(triangulation)
{}
template <int dim>
for (unsigned int level = 0; level < n_levels; ++level)
{
IndexSet relevant_dofs;
- DoFTools::extract_locally_relevant_level_dofs(
- dof_handler_u, level, relevant_dofs);
+ DoFTools::extract_locally_relevant_level_dofs(dof_handler_u,
+ level,
+ relevant_dofs);
ConstraintMatrix level_constraints;
level_constraints.reinit(relevant_dofs);
level_constraints.add_lines(
QGauss<1>(degree_u + 1),
additional_data);
- mg_matrices[level].initialize(
- mg_mf_storage_level, mg_constrained_dofs, level);
+ mg_matrices[level].initialize(mg_mf_storage_level,
+ mg_constrained_dofs,
+ level);
mg_matrices[level].evaluate_2_x_viscosity(Viscosity<dim>(sinker));
mg_matrices[level].compute_diagonal();
}
std::shared_ptr<MatrixFree<dim, double>> matrix_free_homogeneous(
new MatrixFree<dim, double>());
- matrix_free_homogeneous->reinit(
- dofs, constraints_no_dirchlet, QGauss<1>(degree_u + 1), data);
+ matrix_free_homogeneous->reinit(dofs,
+ constraints_no_dirchlet,
+ QGauss<1>(degree_u + 1),
+ data);
operator_homogeneous.initialize(matrix_free_homogeneous);
operator_homogeneous.evaluate_2_x_viscosity(Viscosity<dim>(sinker));
PrimitiveVectorMemory<block_vector_t> mem;
- SolverControl solver_control_cheap(
- n_cheap_stokes_solver_steps, solver_tolerance, false, false);
+ SolverControl solver_control_cheap(n_cheap_stokes_solver_steps,
+ solver_tolerance,
+ false,
+ false);
typedef MGTransferMatrixFree<dim, double> Transfer;
mg.set_edge_matrices(mg_interface, mg_interface);
- PreconditionMG<dim, vector_t, Transfer> prec_A(
- dof_handler_u, mg, mg_transfer);
+ PreconditionMG<dim, vector_t, Transfer> prec_A(dof_handler_u,
+ mg,
+ mg_transfer);
typedef PreconditionChebyshev<MassMatrixType, vector_t> MassPrec;
MassPrec prec_S;
dof.distribute_dofs(fe);
ConstraintMatrix constraints;
DoFTools::make_hanging_node_constraints(dof, constraints);
- VectorTools::interpolate_boundary_values(
- dof, 0, Functions::ZeroFunction<dim>(), constraints);
+ VectorTools::interpolate_boundary_values(dof,
+ 0,
+ Functions::ZeroFunction<dim>(),
+ constraints);
constraints.close();
// std::cout << "Number of cells: " <<
class MatrixFreeTestHP
{
public:
- MatrixFreeTestHP(const MatrixFree<dim, Number> &data_in) : data(data_in){};
+ MatrixFreeTestHP(const MatrixFree<dim, Number> &data_in)
+ : data(data_in){};
void
local_apply(const MatrixFree<dim, Number> & data,
// Ask MatrixFree for cell_range for different
// orders
std::pair<unsigned int, unsigned int> subrange_deg;
-#define CALL_METHOD(degree) \
- subrange_deg = data.create_cell_subrange_hp(cell_range, degree); \
- if (subrange_deg.second > subrange_deg.first) \
- helmholtz_operator<dim, degree, Vector<Number>, degree + 1>( \
- data, dst, src, subrange_deg)
+#define CALL_METHOD(degree) \
+ subrange_deg = data.create_cell_subrange_hp(cell_range, degree); \
+ if (subrange_deg.second > subrange_deg.first) \
+ helmholtz_operator<dim, degree, Vector<Number>, degree + 1>(data, \
+ dst, \
+ src, \
+ subrange_deg)
CALL_METHOD(1);
CALL_METHOD(2);
dof.distribute_dofs(fe_collection);
ConstraintMatrix constraints;
DoFTools::make_hanging_node_constraints(dof, constraints);
- VectorTools::interpolate_boundary_values(
- dof, 0, Functions::ZeroFunction<dim>(), constraints);
+ VectorTools::interpolate_boundary_values(dof,
+ 0,
+ Functions::ZeroFunction<dim>(),
+ constraints);
constraints.close();
// std::cout << "Number of cells: " <<
unsigned int n_own_cells;
unsigned int n_ghost_cells;
- CopyData() : n_cells(0), n_own_cells(0), n_ghost_cells(0)
+ CopyData()
+ : n_cells(0)
+ , n_own_cells(0)
+ , n_ghost_cells(0)
{}
void
std::function<void(const Iterator &, ScratchData &, CopyData &)>
empty_cell_worker;
- std::function<void(
- const Iterator &, const unsigned int &, ScratchData &, CopyData &)>
+ std::function<
+ void(const Iterator &, const unsigned int &, ScratchData &, CopyData &)>
empty_boundary_worker;
auto print_summary = [&]() {
unsigned int n_own_cells;
unsigned int n_ghost_cells;
- CopyData() : n_cells(0), n_own_cells(0), n_ghost_cells(0)
+ CopyData()
+ : n_cells(0)
+ , n_own_cells(0)
+ , n_ghost_cells(0)
{}
void
// denotes the polynomial degree), and mappings of given order. Print to
// screen what we are about to do.
template <int dim>
- LaplaceProblem<dim>::LaplaceProblem(const unsigned int mapping_degree) :
- fe(1),
- dof_handler(triangulation),
- mapping(mapping_degree)
+ LaplaceProblem<dim>::LaplaceProblem(const unsigned int mapping_degree)
+ : fe(1)
+ , dof_handler(triangulation)
+ , mapping(mapping_degree)
{
deallog << "Using mapping with degree " << mapping_degree << ":\n"
<< "============================" << std::endl;
system_rhs.reinit(dof_handler.n_dofs());
std::vector<bool> boundary_dofs(dof_handler.n_dofs(), false);
- DoFTools::extract_boundary_dofs(
- dof_handler, ComponentMask(), boundary_dofs);
+ DoFTools::extract_boundary_dofs(dof_handler,
+ ComponentMask(),
+ boundary_dofs);
const unsigned int first_boundary_dof = std::distance(
boundary_dofs.begin(),
{
ScratchData(const Mapping<dim> & mapping,
const FiniteElement<dim> &fe,
- const unsigned int quadrature_degree) :
- fe_values(mapping,
- fe,
- QGauss<dim>(quadrature_degree),
- update_values | update_gradients | update_quadrature_points |
- update_JxW_values),
- fe_face_values(mapping,
- fe,
- QGauss<dim - 1>(quadrature_degree),
- update_values | update_quadrature_points |
- update_JxW_values | update_normal_vectors)
+ const unsigned int quadrature_degree)
+ : fe_values(mapping,
+ fe,
+ QGauss<dim>(quadrature_degree),
+ update_values | update_gradients | update_quadrature_points |
+ update_JxW_values)
+ , fe_face_values(mapping,
+ fe,
+ QGauss<dim - 1>(quadrature_degree),
+ update_values | update_quadrature_points |
+ update_JxW_values | update_normal_vectors)
{}
- ScratchData(const ScratchData<dim> &scratch_data) :
- fe_values(scratch_data.fe_values.get_mapping(),
- scratch_data.fe_values.get_fe(),
- scratch_data.fe_values.get_quadrature(),
- update_values | update_gradients | update_quadrature_points |
- update_JxW_values),
- fe_face_values(scratch_data.fe_face_values.get_mapping(),
- scratch_data.fe_face_values.get_fe(),
- scratch_data.fe_face_values.get_quadrature(),
- update_values | update_quadrature_points |
- update_JxW_values | update_normal_vectors)
+ ScratchData(const ScratchData<dim> &scratch_data)
+ : fe_values(scratch_data.fe_values.get_mapping(),
+ scratch_data.fe_values.get_fe(),
+ scratch_data.fe_values.get_quadrature(),
+ update_values | update_gradients | update_quadrature_points |
+ update_JxW_values)
+ , fe_face_values(scratch_data.fe_face_values.get_mapping(),
+ scratch_data.fe_face_values.get_fe(),
+ scratch_data.fe_face_values.get_quadrature(),
+ update_values | update_quadrature_points |
+ update_JxW_values | update_normal_vectors)
{}
FEValues<dim> fe_values;
system_rhs);
};
- const unsigned int gauss_degree = std::max(
- static_cast<unsigned int>(std::ceil(1. * (mapping.get_degree() + 1) / 2)),
- 2U);
+ const unsigned int gauss_degree =
+ std::max(static_cast<unsigned int>(
+ std::ceil(1. * (mapping.get_degree() + 1) / 2)),
+ 2U);
MeshWorker::mesh_loop(dof_handler.begin_active(),
dof_handler.end(),
// Then, the function just called returns its results as a vector of
// values each of which denotes the norm on one cell. To get the global
// norm, we do the following:
- const double norm = VectorTools::compute_global_error(
- triangulation, norm_per_cell, VectorTools::H1_seminorm);
+ const double norm =
+ VectorTools::compute_global_error(triangulation,
+ norm_per_cell,
+ VectorTools::H1_seminorm);
// Last task -- generate output:
output_table.add_value("cells", triangulation.n_active_cells());
struct ScratchData
{
ScratchData(const FiniteElement<dim> &fe,
- const unsigned int quadrature_degree) :
- fe_values(fe,
- QGauss<dim>(quadrature_degree),
- update_values | update_gradients | update_quadrature_points |
- update_JxW_values)
+ const unsigned int quadrature_degree)
+ : fe_values(fe,
+ QGauss<dim>(quadrature_degree),
+ update_values | update_gradients | update_quadrature_points |
+ update_JxW_values)
{}
- ScratchData(const ScratchData<dim> &scratch_data) :
- fe_values(scratch_data.fe_values.get_fe(),
- scratch_data.fe_values.get_quadrature(),
- update_values | update_gradients | update_quadrature_points |
- update_JxW_values)
+ ScratchData(const ScratchData<dim> &scratch_data)
+ : fe_values(scratch_data.fe_values.get_fe(),
+ scratch_data.fe_values.get_quadrature(),
+ update_values | update_gradients | update_quadrature_points |
+ update_JxW_values)
{}
FEValues<dim> fe_values;
class Coefficient : public Function<dim>
{
public:
- Coefficient() : Function<dim>()
+ Coefficient()
+ : Function<dim>()
{}
virtual double
template <int dim>
- LaplaceProblem<dim>::LaplaceProblem(const unsigned int degree) :
- triangulation(
- MPI_COMM_WORLD,
- Triangulation<dim>::limit_level_difference_at_vertices,
- parallel::distributed::Triangulation<dim>::construct_multigrid_hierarchy),
- fe(degree),
- mg_dof_handler(triangulation),
- degree(degree)
+ LaplaceProblem<dim>::LaplaceProblem(const unsigned int degree)
+ : triangulation(MPI_COMM_WORLD,
+ Triangulation<dim>::limit_level_difference_at_vertices,
+ parallel::distributed::Triangulation<
+ dim>::construct_multigrid_hierarchy)
+ , fe(degree)
+ , mg_dof_handler(triangulation)
+ , degree(degree)
{}
Functions::ConstantFunction<dim> homogeneous_dirichlet_bc(1.0);
dirichlet_boundary_ids.insert(0);
dirichlet_boundary[0] = &homogeneous_dirichlet_bc;
- VectorTools::interpolate_boundary_values(
- mg_dof_handler, dirichlet_boundary, constraints);
+ VectorTools::interpolate_boundary_values(mg_dof_handler,
+ dirichlet_boundary,
+ constraints);
constraints.close();
DynamicSparsityPattern dsp(mg_dof_handler.n_dofs(),
mg_dof_handler.n_dofs());
DoFTools::make_sparsity_pattern(mg_dof_handler, dsp, constraints);
- system_matrix.reinit(
- mg_dof_handler.locally_owned_dofs(), dsp, MPI_COMM_WORLD, true);
+ system_matrix.reinit(mg_dof_handler.locally_owned_dofs(),
+ dsp,
+ MPI_COMM_WORLD,
+ true);
mg_constrained_dofs.clear();
{
DynamicSparsityPattern dsp(mg_dof_handler.n_dofs(level),
mg_dof_handler.n_dofs(level));
- MGTools::make_interface_sparsity_pattern(
- mg_dof_handler, mg_constrained_dofs, dsp, level);
+ MGTools::make_interface_sparsity_pattern(mg_dof_handler,
+ mg_constrained_dofs,
+ dsp,
+ level);
mg_interface_matrices[level].reinit(
mg_dof_handler.locally_owned_mg_dofs(level),
++level)
{
IndexSet dofset;
- DoFTools::extract_locally_relevant_level_dofs(
- mg_dof_handler, level, dofset);
+ DoFTools::extract_locally_relevant_level_dofs(mg_dof_handler,
+ level,
+ dofset);
boundary_constraints[level].reinit(dofset);
boundary_constraints[level].add_lines(
mg_constrained_dofs.get_refinement_edge_indices(level));
// repartition the mesh as described above, first in some arbitrary
// way, and then with all equal weights
- tr.signals.cell_weight.connect(std::bind(
- &cell_weight_1<dim>, std::placeholders::_1, std::placeholders::_2));
+ tr.signals.cell_weight.connect(std::bind(&cell_weight_1<dim>,
+ std::placeholders::_1,
+ std::placeholders::_2));
tr.repartition();
tr.signals.cell_weight.disconnect_all_slots();
- tr.signals.cell_weight.connect(std::bind(
- &cell_weight_2<dim>, std::placeholders::_1, std::placeholders::_2));
+ tr.signals.cell_weight.connect(std::bind(&cell_weight_2<dim>,
+ std::placeholders::_1,
+ std::placeholders::_2));
tr.repartition();
// repartition the mesh as described above, first in some arbitrary
// way, and then with no weights
- tr.signals.cell_weight.connect(std::bind(
- &cell_weight_1<dim>, std::placeholders::_1, std::placeholders::_2));
+ tr.signals.cell_weight.connect(std::bind(&cell_weight_1<dim>,
+ std::placeholders::_1,
+ std::placeholders::_2));
tr.repartition();
tr.signals.cell_weight.disconnect_all_slots();
DoFTools::extract_locally_relevant_dofs(dof_handler, locally_relevant_dofs);
PETScWrappers::MPI::Vector vec(locally_owned_dofs, MPI_COMM_WORLD);
- PETScWrappers::MPI::Vector vec_ghosted(
- locally_owned_dofs, locally_relevant_dofs, MPI_COMM_WORLD);
+ PETScWrappers::MPI::Vector vec_ghosted(locally_owned_dofs,
+ locally_relevant_dofs,
+ MPI_COMM_WORLD);
vec = 1;
vec_ghosted = vec;
vec = -1;
constraints.clear();
{
IndexSet boundary_dofs(dof_handler.n_dofs());
- DoFTools::extract_boundary_dofs(
- dof_handler, std::vector<bool>(1, true), boundary_dofs);
+ DoFTools::extract_boundary_dofs(dof_handler,
+ std::vector<bool>(1, true),
+ boundary_dofs);
unsigned int first_nboundary_dof = 0;
while (boundary_dofs.is_element(first_nboundary_dof))
local_active[1].add_range(myid * 2, myid * 2 + 2);
LinearAlgebra::distributed::BlockVector<double> v(2);
- v.block(0).reinit(
- local_active[0], complete_index_set(numproc), MPI_COMM_WORLD);
- v.block(1).reinit(
- local_active[1], complete_index_set(2 * numproc), MPI_COMM_WORLD);
+ v.block(0).reinit(local_active[0],
+ complete_index_set(numproc),
+ MPI_COMM_WORLD);
+ v.block(1).reinit(local_active[1],
+ complete_index_set(2 * numproc),
+ MPI_COMM_WORLD);
v.collect_sizes();
for (unsigned int i = 0; i < v.size(); ++i)
ConstantFunction<dim>(static_cast<double>(id) + 42.0, dim),
constraints);
- VectorTools::compute_no_normal_flux_constraints(
- dof_handler,
- 0, /*first component*/
- std::set<types::boundary_id>{2},
- constraints);
+ VectorTools::compute_no_normal_flux_constraints(dof_handler,
+ 0, /*first component*/
+ std::set<types::boundary_id>{
+ 2},
+ constraints);
constraints.close();
deallog << "LocallyOwned = " << std::flush;
// The constructor and destructor of the class
template <int dim>
- PDDProblem<dim>::PDDProblem() :
- mpi_communicator(MPI_COMM_WORLD),
- triangulation(mpi_communicator),
- dof_handler(triangulation),
- fe(1)
+ PDDProblem<dim>::PDDProblem()
+ : mpi_communicator(MPI_COMM_WORLD)
+ , triangulation(mpi_communicator)
+ , dof_handler(triangulation)
+ , fe(1)
{}
// First generate an output for the cells
const unsigned int cycle = 1;
- PETScWrappers::MPI::Vector solution(
- locally_owned_dofs, locally_relevant_dofs, mpi_communicator);
+ PETScWrappers::MPI::Vector solution(locally_owned_dofs,
+ locally_relevant_dofs,
+ mpi_communicator);
solution = locally_relevant_solution;
DataOut<dim> data_out;
locally_owned_dofs = dof_handler.locally_owned_dofs();
DoFTools::extract_locally_relevant_dofs(dof_handler, locally_relevant_dofs);
- locally_relevant_sol.reinit(
- locally_owned_dofs, locally_relevant_dofs, mpi_communicator);
+ locally_relevant_sol.reinit(locally_owned_dofs,
+ locally_relevant_dofs,
+ mpi_communicator);
DataOutFaces<dim> data_out_face(false);
std::string output_basename = std::to_string(dim) + std::to_string(spacedim);
- DataOutBase::write_hdf5_parallel(
- patches, data_filter, output_basename + ".h5", MPI_COMM_WORLD);
+ DataOutBase::write_hdf5_parallel(patches,
+ data_filter,
+ output_basename + ".h5",
+ MPI_COMM_WORLD);
const double current_time = 0.0;
XDMFEntry entry(output_basename + ".h5",
MappingQGeneric<dim> mapping(1);
Vector<float> indicators(tr.n_active_cells());
- DerivativeApproximation::approximate_gradient(
- mapping, dofh, vec_rel, indicators);
+ DerivativeApproximation::approximate_gradient(mapping,
+ dofh,
+ vec_rel,
+ indicators);
// we got here, so no exception.
if (myid == 0)
template <int dim>
- AdvectionProblem<dim>::AdvectionProblem() :
- triangulation(MPI_COMM_WORLD),
- fe(1),
- dof_handler(triangulation)
+ AdvectionProblem<dim>::AdvectionProblem()
+ : triangulation(MPI_COMM_WORLD)
+ , fe(1)
+ , dof_handler(triangulation)
{
std::vector<unsigned int> repetitions(2);
repetitions[0] = 2;
const Point<2> p0(0.0, 0.0);
const Point<2> p1(2.0, 1.0);
- GridGenerator::subdivided_hyper_rectangle(
- triangulation, repetitions, p0, p1);
+ GridGenerator::subdivided_hyper_rectangle(triangulation,
+ repetitions,
+ p0,
+ p1);
}
template <int dim>
const UpdateFlags update_flags =
update_values | update_quadrature_points | update_JxW_values;
- FEFaceValues<dim> current_face_values(
- fe, face_quadrature, update_flags | update_normal_vectors);
+ FEFaceValues<dim> current_face_values(fe,
+ face_quadrature,
+ update_flags | update_normal_vectors);
FEFaceValues<dim> neighbor_face_values(fe, face_quadrature, update_flags);
- FESubfaceValues<dim> neighbor_subface_values(
- fe, face_quadrature, update_flags);
+ FESubfaceValues<dim> neighbor_subface_values(fe,
+ face_quadrature,
+ update_flags);
typename DoFHandler<dim>::active_cell_iterator current_cell =
dof_handler.begin_active(),
for (unsigned int i = 0; i < n; ++i)
csp.add(i, myid);
- SparsityTools::distribute_sparsity_pattern(
- csp, rows_per_cpu, MPI_COMM_WORLD, locally_rel);
+ SparsityTools::distribute_sparsity_pattern(csp,
+ rows_per_cpu,
+ MPI_COMM_WORLD,
+ locally_rel);
/* {
std::ofstream
f((std::string("after")+Utilities::int_to_string(myid)).c_str());
deallog << "size: " << csp.n_rows() << "x" << csp.n_cols() << std::endl;
}
- SparsityTools::distribute_sparsity_pattern(
- csp, locally_owned_dofs_per_cpu, MPI_COMM_WORLD, locally_rel);
+ SparsityTools::distribute_sparsity_pattern(csp,
+ locally_owned_dofs_per_cpu,
+ MPI_COMM_WORLD,
+ locally_rel);
/* {
std::ofstream
f((std::string("after")+Utilities::int_to_string(myid)).c_str());
(i + 1) * num_local);
- SparsityTools::distribute_sparsity_pattern(
- csp, locally_owned_dofs_per_cpu2, MPI_COMM_WORLD, locally_rel);
+ SparsityTools::distribute_sparsity_pattern(csp,
+ locally_owned_dofs_per_cpu2,
+ MPI_COMM_WORLD,
+ locally_rel);
if (myid == 0)
{
dofh.distribute_dofs(fe);
IndexSet relevant_set, boundary_dofs;
- DoFTools::extract_boundary_dofs(
- dofh, std::vector<bool>(1, true), boundary_dofs);
+ DoFTools::extract_boundary_dofs(dofh,
+ std::vector<bool>(1, true),
+ boundary_dofs);
if (Utilities::MPI::this_mpi_process(MPI_COMM_WORLD) == 0)
boundary_dofs.write(deallog.get_file_stream());
{
parallel::distributed::Triangulation<dim> tr(MPI_COMM_WORLD);
- GridGenerator::hyper_cube_with_cylindrical_hole(
- tr, 0.05 /* cylinder radius */, 0.4 / 2.0 /* box radius */);
+ GridGenerator::hyper_cube_with_cylindrical_hole(tr,
+ 0.05 /* cylinder radius */,
+ 0.4 / 2.0 /* box radius */);
tr.refine_global(1);
const FE_Q<dim> fe(1);
class TestFunction : public Function<dim>
{
public:
- TestFunction(unsigned int deg) : Function<dim>(), degree(deg)
+ TestFunction(unsigned int deg)
+ : Function<dim>()
+ , degree(deg)
{}
virtual double
{
std::vector<IndexSet> owned_indices_vector(1, owned_indices);
std::vector<IndexSet> ghosted_indices_vector(1, ghosted_indices);
- return VectorType(
- owned_indices_vector, ghosted_indices_vector, MPI_COMM_WORLD);
+ return VectorType(owned_indices_vector,
+ ghosted_indices_vector,
+ MPI_COMM_WORLD);
}
template <int dim>
InteriorPenaltyProblem<dim>::InteriorPenaltyProblem(
- const FiniteElement<dim> &fe) :
- triangulation(
- MPI_COMM_WORLD,
- Triangulation<dim>::limit_level_difference_at_vertices,
- parallel::distributed::Triangulation<dim>::construct_multigrid_hierarchy),
- mapping(1),
- fe(fe),
- dof_handler(triangulation)
+ const FiniteElement<dim> &fe)
+ : triangulation(MPI_COMM_WORLD,
+ Triangulation<dim>::limit_level_difference_at_vertices,
+ parallel::distributed::Triangulation<
+ dim>::construct_multigrid_hierarchy)
+ , mapping(1)
+ , fe(fe)
+ , dof_handler(triangulation)
{
GridGenerator::hyper_cube_slit(triangulation, -1, 1);
}
DynamicSparsityPattern c_sparsity(dof_handler.n_dofs(),
dof_handler.n_dofs());
DoFTools::make_flux_sparsity_pattern(dof_handler, c_sparsity);
- matrix.reinit(
- dof_handler.locally_owned_dofs(), c_sparsity, MPI_COMM_WORLD, true);
+ matrix.reinit(dof_handler.locally_owned_dofs(),
+ c_sparsity,
+ MPI_COMM_WORLD,
+ true);
const unsigned int n_levels = triangulation.n_global_levels();
mg_matrix.resize(0, n_levels - 1);
DynamicSparsityPattern ci_sparsity;
ci_sparsity.reinit(dof_handler.n_dofs(level - 1),
dof_handler.n_dofs(level));
- MGTools::make_flux_sparsity_pattern_edge(
- dof_handler, ci_sparsity, level);
+ MGTools::make_flux_sparsity_pattern_edge(dof_handler,
+ ci_sparsity,
+ level);
mg_matrix_dg_up[level].reinit(
dof_handler.locally_owned_mg_dofs(level - 1),
// let each of the processors report whether they own
// cells or now by setting a bit mask that we then add up.
// output which processor owns something and which don't
- const int cells_owned = Utilities::MPI::sum(
- tr.n_locally_owned_active_cells() > 0 ?
- 1 << Utilities::MPI::this_mpi_process(MPI_COMM_WORLD) :
- 0,
- MPI_COMM_WORLD);
+ const int cells_owned =
+ Utilities::MPI::sum(tr.n_locally_owned_active_cells() > 0 ?
+ 1 << Utilities::MPI::this_mpi_process(
+ MPI_COMM_WORLD) :
+ 0,
+ MPI_COMM_WORLD);
if (Utilities::MPI::this_mpi_process(MPI_COMM_WORLD) == 0)
{
for (unsigned int i = 0;
}
// now check how many processors own DoFs using the same procedure
- const int dofs_owned = Utilities::MPI::sum(
- dof_handler.has_active_dofs() ?
- 1 << Utilities::MPI::this_mpi_process(MPI_COMM_WORLD) :
- 0,
- MPI_COMM_WORLD);
+ const int dofs_owned =
+ Utilities::MPI::sum(dof_handler.has_active_dofs() ?
+ 1 << Utilities::MPI::this_mpi_process(
+ MPI_COMM_WORLD) :
+ 0,
+ MPI_COMM_WORLD);
if (Utilities::MPI::this_mpi_process(MPI_COMM_WORLD) == 0)
{
for (unsigned int i = 0;
// let each of the processors report whether they own
// cells or now by setting a bit mask that we then add up.
// output which processor owns something and which don't
- const int cells_owned = Utilities::MPI::sum(
- tr.n_locally_owned_active_cells() > 0 ?
- 1 << Utilities::MPI::this_mpi_process(MPI_COMM_WORLD) :
- 0,
- MPI_COMM_WORLD);
+ const int cells_owned =
+ Utilities::MPI::sum(tr.n_locally_owned_active_cells() > 0 ?
+ 1 << Utilities::MPI::this_mpi_process(
+ MPI_COMM_WORLD) :
+ 0,
+ MPI_COMM_WORLD);
if (Utilities::MPI::this_mpi_process(MPI_COMM_WORLD) == 0)
{
for (unsigned int i = 0;
}
// now check how many processors own DoFs using the same procedure
- const int dofs_owned = Utilities::MPI::sum(
- dof_handler.has_active_dofs() ?
- 1 << Utilities::MPI::this_mpi_process(MPI_COMM_WORLD) :
- 0,
- MPI_COMM_WORLD);
+ const int dofs_owned =
+ Utilities::MPI::sum(dof_handler.has_active_dofs() ?
+ 1 << Utilities::MPI::this_mpi_process(
+ MPI_COMM_WORLD) :
+ 0,
+ MPI_COMM_WORLD);
if (Utilities::MPI::this_mpi_process(MPI_COMM_WORLD) == 0)
{
for (unsigned int i = 0;
{
Triangulation<dim> triangulation1;
Triangulation<dim> triangulation2;
- GridGenerator::hyper_cube(
- triangulation1, -1, 0); // create a square [-1,0]^d domain
- GridGenerator::hyper_cube(
- triangulation2, -1, 0); // create a square [-1,0]^d domain
+ GridGenerator::hyper_cube(triangulation1,
+ -1,
+ 0); // create a square [-1,0]^d domain
+ GridGenerator::hyper_cube(triangulation2,
+ -1,
+ 0); // create a square [-1,0]^d domain
Point<dim> shift_vector;
shift_vector[0] = 1.0;
GridTools::shift(shift_vector, triangulation2);
- GridGenerator::merge_triangulations(
- triangulation1, triangulation2, tria_distrib);
- GridGenerator::merge_triangulations(
- triangulation1, triangulation2, tria_sequential);
+ GridGenerator::merge_triangulations(triangulation1,
+ triangulation2,
+ tria_distrib);
+ GridGenerator::merge_triangulations(triangulation1,
+ triangulation2,
+ tria_sequential);
}
tria_distrib.refine_global(n_global);
template <int dim>
- LaplaceProblem<dim>::LaplaceProblem() :
- mpi_communicator(MPI_COMM_WORLD),
- triangulation(mpi_communicator,
- typename Triangulation<dim>::MeshSmoothing(
- Triangulation<dim>::smoothing_on_refinement |
- Triangulation<dim>::smoothing_on_coarsening)),
- dof_handler(triangulation),
- fe(FE_Q<dim>(2)),
- pcout(Utilities::MPI::this_mpi_process(mpi_communicator) == 0 ?
- deallog.get_file_stream() :
- std::cout,
- (Utilities::MPI::this_mpi_process(mpi_communicator) == 0))
+ LaplaceProblem<dim>::LaplaceProblem()
+ : mpi_communicator(MPI_COMM_WORLD)
+ , triangulation(mpi_communicator,
+ typename Triangulation<dim>::MeshSmoothing(
+ Triangulation<dim>::smoothing_on_refinement |
+ Triangulation<dim>::smoothing_on_coarsening))
+ , dof_handler(triangulation)
+ , fe(FE_Q<dim>(2))
+ , pcout(Utilities::MPI::this_mpi_process(mpi_communicator) == 0 ?
+ deallog.get_file_stream() :
+ std::cout,
+ (Utilities::MPI::this_mpi_process(mpi_communicator) == 0))
{}
locally_owned_dofs = dof_handler.locally_owned_dofs();
DoFTools::extract_locally_relevant_dofs(dof_handler, locally_relevant_dofs);
- locally_relevant_solution.reinit(
- locally_owned_dofs, locally_relevant_dofs, mpi_communicator);
+ locally_relevant_solution.reinit(locally_owned_dofs,
+ locally_relevant_dofs,
+ mpi_communicator);
system_rhs.reinit(locally_owned_dofs, mpi_communicator);
system_rhs = PetscScalar();
constraints.clear();
constraints.reinit(locally_relevant_dofs);
DoFTools::make_hanging_node_constraints(dof_handler, constraints);
- VectorTools::interpolate_boundary_values(
- dof_handler, 0, Functions::ZeroFunction<dim>(), constraints);
+ VectorTools::interpolate_boundary_values(dof_handler,
+ 0,
+ Functions::ZeroFunction<dim>(),
+ constraints);
constraints.close();
- DynamicSparsityPattern csp(
- dof_handler.n_dofs(), dof_handler.n_dofs(), locally_relevant_dofs);
+ DynamicSparsityPattern csp(dof_handler.n_dofs(),
+ dof_handler.n_dofs(),
+ locally_relevant_dofs);
DoFTools::make_sparsity_pattern(dof_handler, csp, constraints, false);
SparsityTools::distribute_sparsity_pattern(
csp,
10,
10);
#else
- check_solver_within_range(
- solver.solve(system_matrix,
- completely_distributed_solution,
- system_rhs,
- PETScWrappers::PreconditionJacobi(system_matrix)),
- solver_control.last_step(),
- 120,
- 260);
+ check_solver_within_range(solver.solve(system_matrix,
+ completely_distributed_solution,
+ system_rhs,
+ PETScWrappers::PreconditionJacobi(
+ system_matrix)),
+ solver_control.last_step(),
+ 120,
+ 260);
#endif
pcout << " Solved in " << solver_control.last_step() << " iterations."
Point<dim> top_right;
for (unsigned int d = 0; d < dim; ++d)
top_right[d] = (d == 0 ? 2 : 1);
- GridGenerator::subdivided_hyper_rectangle(
- triangulation, reps, Point<dim>(), top_right);
+ GridGenerator::subdivided_hyper_rectangle(triangulation,
+ reps,
+ Point<dim>(),
+ top_right);
Assert(triangulation.n_global_active_cells() == 2, ExcInternalError());
Assert(triangulation.n_active_cells() == 2, ExcInternalError());
dofh.distribute_dofs(fe);
IndexSet owned_set = dofh.locally_owned_dofs();
- PETScWrappers::MPI::Vector x(
- MPI_COMM_WORLD, dofh.n_dofs(), owned_set.n_elements());
+ PETScWrappers::MPI::Vector x(MPI_COMM_WORLD,
+ dofh.n_dofs(),
+ owned_set.n_elements());
- VectorTools::interpolate(
- dofh, Functions::ConstantFunction<dim, PetscScalar>(1), x);
+ VectorTools::interpolate(dofh,
+ Functions::ConstantFunction<dim, PetscScalar>(1),
+ x);
const double norm = x.l2_norm();
if (myid == 0)
deallog << dofh.n_locally_owned_dofs() << ' ' << dofh.n_dofs() << std::endl
DoFTools::extract_locally_relevant_dofs(dofh2, dof2_locally_relevant_dofs);
DoFTools::extract_locally_relevant_dofs(dofh1, dof1_locally_relevant_dofs);
- PETScWrappers::MPI::Vector u1(
- dof1_locally_owned_dofs, dof1_locally_relevant_dofs, MPI_COMM_WORLD);
+ PETScWrappers::MPI::Vector u1(dof1_locally_owned_dofs,
+ dof1_locally_relevant_dofs,
+ MPI_COMM_WORLD);
PETScWrappers::MPI::Vector out(dof1_locally_owned_dofs, MPI_COMM_WORLD);
// This failed before this test was introduced.
// Interpolate onto the first component only.
- VectorTools::interpolate(
- dofh, Functions::ConstantFunction<dim>(1, 2), x, ComponentMask(components));
+ VectorTools::interpolate(dofh,
+ Functions::ConstantFunction<dim>(1, 2),
+ x,
+ ComponentMask(components));
// Integrate the difference in the first component, if everything went
// well, this should be zero.
local_errors,
QGauss<dim>(3),
VectorTools::L2_norm);
- double total_local_error = local_errors.l2_norm();
- const double total_global_error = std::sqrt(Utilities::MPI::sum(
- total_local_error * total_local_error, MPI_COMM_WORLD));
+ double total_local_error = local_errors.l2_norm();
+ const double total_global_error =
+ std::sqrt(Utilities::MPI::sum(total_local_error * total_local_error,
+ MPI_COMM_WORLD));
if (myid == 0)
deallog << "err: " << total_global_error << std::endl;
}
unsigned int prob_number;
};
template <int dim>
-SeventhProblem<dim>::SeventhProblem(unsigned int prob_number) :
- mpi_communicator(MPI_COMM_WORLD),
- settings(
- parallel::distributed::Triangulation<2, 2>::no_automatic_repartitioning),
- triangulation(mpi_communicator,
- typename Triangulation<dim>::MeshSmoothing(
- Triangulation<dim>::smoothing_on_refinement |
- Triangulation<dim>::smoothing_on_coarsening),
- settings),
- dof_handler(triangulation),
- fe(2),
- second_triangulation(mpi_communicator,
- typename Triangulation<dim>::MeshSmoothing(
- Triangulation<dim>::smoothing_on_refinement |
- Triangulation<dim>::smoothing_on_coarsening),
- settings),
- second_dof_handler(second_triangulation),
- second_fe(2),
- pcout(deallog.get_file_stream(),
- (Utilities::MPI::this_mpi_process(mpi_communicator) == 0)),
- prob_number(prob_number)
+SeventhProblem<dim>::SeventhProblem(unsigned int prob_number)
+ : mpi_communicator(MPI_COMM_WORLD)
+ , settings(
+ parallel::distributed::Triangulation<2, 2>::no_automatic_repartitioning)
+ , triangulation(mpi_communicator,
+ typename Triangulation<dim>::MeshSmoothing(
+ Triangulation<dim>::smoothing_on_refinement |
+ Triangulation<dim>::smoothing_on_coarsening),
+ settings)
+ , dof_handler(triangulation)
+ , fe(2)
+ , second_triangulation(mpi_communicator,
+ typename Triangulation<dim>::MeshSmoothing(
+ Triangulation<dim>::smoothing_on_refinement |
+ Triangulation<dim>::smoothing_on_coarsening),
+ settings)
+ , second_dof_handler(second_triangulation)
+ , second_fe(2)
+ , pcout(deallog.get_file_stream(),
+ (Utilities::MPI::this_mpi_process(mpi_communicator) == 0))
+ , prob_number(prob_number)
{}
template <int dim>
dof_handler.distribute_dofs(fe);
locally_owned_dofs = dof_handler.locally_owned_dofs();
DoFTools::extract_locally_relevant_dofs(dof_handler, locally_relevant_dofs);
- locally_relevant_solution.reinit(
- locally_owned_dofs, locally_relevant_dofs, mpi_communicator);
+ locally_relevant_solution.reinit(locally_owned_dofs,
+ locally_relevant_dofs,
+ mpi_communicator);
system_rhs.reinit(locally_owned_dofs, mpi_communicator);
system_rhs = 0;
constraints.clear();
constraints.reinit(locally_relevant_dofs);
DoFTools::make_hanging_node_constraints(dof_handler, constraints);
- VectorTools::interpolate_boundary_values(
- dof_handler, 0, Functions::ZeroFunction<dim>(), constraints);
+ VectorTools::interpolate_boundary_values(dof_handler,
+ 0,
+ Functions::ZeroFunction<dim>(),
+ constraints);
constraints.close();
DynamicSparsityPattern csp(locally_relevant_dofs);
DoFTools::make_sparsity_pattern(dof_handler, csp, constraints, false);
dof_handler.n_locally_owned_dofs_per_processor(),
mpi_communicator,
locally_relevant_dofs);
- system_matrix.reinit(
- locally_owned_dofs, locally_owned_dofs, csp, mpi_communicator);
+ system_matrix.reinit(locally_owned_dofs,
+ locally_owned_dofs,
+ csp,
+ mpi_communicator);
}
template <int dim>
second_locally_owned_dofs = second_dof_handler.locally_owned_dofs();
DoFTools::extract_locally_relevant_dofs(second_dof_handler,
second_locally_relevant_dofs);
- second_locally_relevant_solution.reinit(
- second_locally_owned_dofs, second_locally_relevant_dofs, mpi_communicator);
- interpolated_locally_relevant_solution.reinit(
- second_locally_owned_dofs, second_locally_relevant_dofs, mpi_communicator);
+ second_locally_relevant_solution.reinit(second_locally_owned_dofs,
+ second_locally_relevant_dofs,
+ mpi_communicator);
+ interpolated_locally_relevant_solution.reinit(second_locally_owned_dofs,
+ second_locally_relevant_dofs,
+ mpi_communicator);
}
template <int dim>
TrilinosWrappers::PreconditionAMG preconditioner;
TrilinosWrappers::PreconditionAMG::AdditionalData data;
preconditioner.initialize(system_matrix, data);
- solver.solve(
- system_matrix, completely_distributed_solution, system_rhs, preconditioner);
+ solver.solve(system_matrix,
+ completely_distributed_solution,
+ system_rhs,
+ preconditioner);
pcout << " Solved in " << solver_control.last_step() << " iterations."
<< std::endl;
constraints.distribute(completely_distributed_solution);
void
seventh_grid()
{
- ConditionalOStream pcout(
- deallog.get_file_stream(),
- (Utilities::MPI::this_mpi_process(MPI_COMM_WORLD) == 0));
+ ConditionalOStream pcout(deallog.get_file_stream(),
+ (Utilities::MPI::this_mpi_process(MPI_COMM_WORLD) ==
+ 0));
pcout << "7th Starting" << std::endl;
SeventhProblem<2> lap(1);
std::vector<unsigned int> reps;
reps.push_back(2);
reps.push_back(1);
- GridGenerator::subdivided_hyper_rectangle(
- tr, reps, Point<dim>(), Point<dim>(2.0, 1.0));
+ GridGenerator::subdivided_hyper_rectangle(tr,
+ reps,
+ Point<dim>(),
+ Point<dim>(2.0, 1.0));
FE_DGP<dim> fe(0);
class BoundaryValues : public Function<dim>
{
public:
- BoundaryValues() : Function<dim>(dim + 1)
+ BoundaryValues()
+ : Function<dim>(dim + 1)
{}
virtual double
class RightHandSide : public Function<dim>
{
public:
- RightHandSide() : Function<dim>(dim + 1)
+ RightHandSide()
+ : Function<dim>(dim + 1)
{}
virtual double
const Matrix & m,
const Preconditioner &preconditioner,
const IndexSet & locally_owned,
- const MPI_Comm & mpi_communicator) :
- matrix(&m),
- preconditioner(&preconditioner),
- mpi_communicator(&mpi_communicator),
- tmp(locally_owned, mpi_communicator)
+ const MPI_Comm & mpi_communicator)
+ : matrix(&m)
+ , preconditioner(&preconditioner)
+ , mpi_communicator(&mpi_communicator)
+ , tmp(locally_owned, mpi_communicator)
{}
TrilinosWrappers::MPI::Vector & dst,
const TrilinosWrappers::MPI::Vector &src) const
{
- SolverControl solver_control(
- src.size(), 1e-6 * src.l2_norm(), false, false);
+ SolverControl solver_control(src.size(),
+ 1e-6 * src.l2_norm(),
+ false,
+ false);
TrilinosWrappers::SolverCG cg(solver_control,
TrilinosWrappers::SolverCG::AdditionalData());
& A_inverse,
const IndexSet &owned_vel,
const IndexSet &relevant_vel,
- const MPI_Comm &mpi_communicator) :
- system_matrix(&system_matrix),
- A_inverse(&A_inverse),
- tmp1(owned_vel, mpi_communicator),
- tmp2(tmp1)
+ const MPI_Comm &mpi_communicator)
+ : system_matrix(&system_matrix)
+ , A_inverse(&A_inverse)
+ , tmp1(owned_vel, mpi_communicator)
+ , tmp2(tmp1)
{}
DoFRenumbering::component_wise(dof_handler, block_component);
std::vector<types::global_dof_index> dofs_per_block(2);
- DoFTools::count_dofs_per_block(
- dof_handler, dofs_per_block, block_component);
+ DoFTools::count_dofs_per_block(dof_handler,
+ dofs_per_block,
+ block_component);
const unsigned int n_u = dofs_per_block[0], n_p = dofs_per_block[1];
{
relevant_partitioning,
mpi_communicator);
- DoFTools::make_sparsity_pattern(
- dof_handler,
- bsp,
- constraints,
- false,
- Utilities::MPI::this_mpi_process(mpi_communicator));
+ DoFTools::make_sparsity_pattern(dof_handler,
+ bsp,
+ constraints,
+ false,
+ Utilities::MPI::this_mpi_process(
+ mpi_communicator));
bsp.compress();
}
system_rhs.reinit(owned_partitioning, mpi_communicator);
- solution.reinit(
- owned_partitioning, relevant_partitioning, mpi_communicator);
+ solution.reinit(owned_partitioning,
+ relevant_partitioning,
+ mpi_communicator);
}
relevant_partitioning[0],
mpi_communicator);
- SolverControl solver_control(
- solution.block(1).size(), 1e-6 * schur_rhs.l2_norm(), false, false);
+ SolverControl solver_control(solution.block(1).size(),
+ 1e-6 * schur_rhs.l2_norm(),
+ false,
+ false);
SolverCG<TrilinosWrappers::MPI::Vector> cg(solver_control);
TrilinosWrappers::PreconditionAMGMueLu preconditioner;
data_out.build_patches(degree + 1);
std::ostringstream filename;
- filename << "solution-" << Utilities::int_to_string(refinement_cycle, 2)
- << "."
- << Utilities::int_to_string(
- triangulation.locally_owned_subdomain(), 2)
- << ".vtu";
+ filename
+ << "solution-" << Utilities::int_to_string(refinement_cycle, 2) << "."
+ << Utilities::int_to_string(triangulation.locally_owned_subdomain(), 2)
+ << ".vtu";
std::ofstream output(filename.str().c_str());
data_out.write_vtu(output);
class Coefficient : public Function<dim>
{
public:
- Coefficient() : Function<dim>()
+ Coefficient()
+ : Function<dim>()
{}
virtual double
}
template <int dim>
- LaplaceProblem<dim>::LaplaceProblem(const unsigned int degree) :
- triangulation(
- MPI_COMM_WORLD,
- Triangulation<dim>::limit_level_difference_at_vertices,
- parallel::distributed::Triangulation<dim>::construct_multigrid_hierarchy),
- fe(degree),
- mg_dof_handler(triangulation),
- degree(degree)
+ LaplaceProblem<dim>::LaplaceProblem(const unsigned int degree)
+ : triangulation(MPI_COMM_WORLD,
+ Triangulation<dim>::limit_level_difference_at_vertices,
+ parallel::distributed::Triangulation<
+ dim>::construct_multigrid_hierarchy)
+ , fe(degree)
+ , mg_dof_handler(triangulation)
+ , degree(degree)
{}
DynamicSparsityPattern csp(mg_dof_handler.n_dofs(),
mg_dof_handler.n_dofs());
DoFTools::make_sparsity_pattern(mg_dof_handler, csp, constraints);
- system_matrix.reinit(
- mg_dof_handler.locally_owned_dofs(), csp, MPI_COMM_WORLD, true);
+ system_matrix.reinit(mg_dof_handler.locally_owned_dofs(),
+ csp,
+ MPI_COMM_WORLD,
+ true);
mg_constrained_dofs.clear();
mg_constrained_dofs.initialize(mg_dof_handler, dirichlet_boundary);
temp_solution.reinit(idx, MPI_COMM_WORLD);
temp_solution = solution;
- KellyErrorEstimator<dim>::estimate(
- static_cast<DoFHandler<dim> &>(mg_dof_handler),
- QGauss<dim - 1>(3),
- typename FunctionMap<dim>::type(),
- temp_solution,
- estimated_error_per_cell);
- GridRefinement::refine_and_coarsen_fixed_number(
- triangulation, estimated_error_per_cell, 0.3, 0.03);
+ KellyErrorEstimator<dim>::estimate(static_cast<DoFHandler<dim> &>(
+ mg_dof_handler),
+ QGauss<dim - 1>(3),
+ typename FunctionMap<dim>::type(),
+ temp_solution,
+ estimated_error_per_cell);
+ GridRefinement::refine_and_coarsen_fixed_number(triangulation,
+ estimated_error_per_cell,
+ 0.3,
+ 0.03);
triangulation.execute_coarsening_and_refinement();
}
class Coefficient : public Function<dim>
{
public:
- Coefficient() : Function<dim>()
+ Coefficient()
+ : Function<dim>()
{}
virtual double
}
template <int dim>
- LaplaceProblem<dim>::LaplaceProblem(const unsigned int degree) :
- triangulation(
- MPI_COMM_WORLD,
- Triangulation<dim>::limit_level_difference_at_vertices,
- parallel::distributed::Triangulation<dim>::construct_multigrid_hierarchy),
- fe(degree),
- mg_dof_handler(triangulation),
- degree(degree)
+ LaplaceProblem<dim>::LaplaceProblem(const unsigned int degree)
+ : triangulation(MPI_COMM_WORLD,
+ Triangulation<dim>::limit_level_difference_at_vertices,
+ parallel::distributed::Triangulation<
+ dim>::construct_multigrid_hierarchy)
+ , fe(degree)
+ , mg_dof_handler(triangulation)
+ , degree(degree)
{}
DynamicSparsityPattern csp(mg_dof_handler.n_dofs(),
mg_dof_handler.n_dofs());
DoFTools::make_sparsity_pattern(mg_dof_handler, csp, constraints);
- system_matrix.reinit(
- mg_dof_handler.locally_owned_dofs(), csp, MPI_COMM_WORLD, true);
+ system_matrix.reinit(mg_dof_handler.locally_owned_dofs(),
+ csp,
+ MPI_COMM_WORLD,
+ true);
mg_constrained_dofs.clear();
mg_constrained_dofs.initialize(mg_dof_handler, dirichlet_boundary);
{
Vector<float> estimated_error_per_cell(triangulation.n_active_cells());
- KellyErrorEstimator<dim>::estimate(
- static_cast<DoFHandler<dim> &>(mg_dof_handler),
- QGauss<dim - 1>(3),
- typename FunctionMap<dim>::type(),
- solution,
- estimated_error_per_cell);
- GridRefinement::refine_and_coarsen_fixed_number(
- triangulation, estimated_error_per_cell, 0.3, 0.03);
+ KellyErrorEstimator<dim>::estimate(static_cast<DoFHandler<dim> &>(
+ mg_dof_handler),
+ QGauss<dim - 1>(3),
+ typename FunctionMap<dim>::type(),
+ solution,
+ estimated_error_per_cell);
+ GridRefinement::refine_and_coarsen_fixed_number(triangulation,
+ estimated_error_per_cell,
+ 0.3,
+ 0.03);
triangulation.execute_coarsening_and_refinement();
}
if (cell->subdomain_id() == triangulation.locally_owned_subdomain())
{
cell->get_dof_indices(local_dof_indices);
- constraints.distribute_local_to_global(
- local_vector, local_dof_indices, vector);
+ constraints.distribute_local_to_global(local_vector,
+ local_dof_indices,
+ vector);
}
vector.compress(VectorOperation::add);
}
if (cell->subdomain_id() == triangulation.locally_owned_subdomain())
{
cell->get_dof_indices(local_dof_indices);
- constraints.distribute_local_to_global(
- local_vector, local_dof_indices, vector);
+ constraints.distribute_local_to_global(local_vector,
+ local_dof_indices,
+ vector);
}
vector.compress(VectorOperation::add);
}
if (cell->subdomain_id() == triangulation.locally_owned_subdomain())
{
cell->get_dof_indices(local_dof_indices);
- constraints.distribute_local_to_global(
- local_vector, local_dof_indices, vector);
+ constraints.distribute_local_to_global(local_vector,
+ local_dof_indices,
+ vector);
}
vector.compress(VectorOperation::add);
}
if (cell->subdomain_id() == triangulation.locally_owned_subdomain())
{
cell->get_dof_indices(local_dof_indices);
- constraints.distribute_local_to_global(
- local_vector, local_dof_indices, vector);
+ constraints.distribute_local_to_global(local_vector,
+ local_dof_indices,
+ vector);
}
vector.compress(VectorOperation::add);
}
no_normal_flux_boundaries.insert(1);
- VectorTools::compute_no_normal_flux_constraints(
- dofh, 0, no_normal_flux_boundaries, cm);
+ VectorTools::compute_no_normal_flux_constraints(dofh,
+ 0,
+ no_normal_flux_boundaries,
+ cm);
cm.close();
class FilteredDataOut : public DataOut<dim>
{
public:
- FilteredDataOut(const unsigned int subdomain_id) : subdomain_id(subdomain_id)
+ FilteredDataOut(const unsigned int subdomain_id)
+ : subdomain_id(subdomain_id)
{}
virtual typename DataOut<dim>::cell_iterator
class TemperatureInitialValues : public Function<dim>
{
public:
- TemperatureInitialValues() : Function<dim>(1)
+ TemperatureInitialValues()
+ : Function<dim>(1)
{}
virtual double
class FilteredDataOut : public DataOut<dim>
{
public:
- FilteredDataOut(const unsigned int subdomain_id) : subdomain_id(subdomain_id)
+ FilteredDataOut(const unsigned int subdomain_id)
+ : subdomain_id(subdomain_id)
{}
virtual typename DataOut<dim>::cell_iterator
class TemperatureInitialValues : public Function<dim>
{
public:
- TemperatureInitialValues() : Function<dim>(1)
+ TemperatureInitialValues()
+ : Function<dim>(1)
{}
virtual double
DoFTools::extract_locally_relevant_dofs(dh, locally_relevant_dofs);
PETScWrappers::MPI::Vector x(locally_owned_dofs, MPI_COMM_WORLD);
- PETScWrappers::MPI::Vector solution(
- locally_owned_dofs, locally_relevant_dofs, MPI_COMM_WORLD);
+ PETScWrappers::MPI::Vector solution(locally_owned_dofs,
+ locally_relevant_dofs,
+ MPI_COMM_WORLD);
parallel::distributed::SolutionTransfer<dim, PETScWrappers::MPI::Vector>
soltrans(dh);
PETScWrappers::MPI::Vector x(locally_owned_dofs, MPI_COMM_WORLD);
PETScWrappers::MPI::Vector x2(locally_owned_dofs, MPI_COMM_WORLD);
- PETScWrappers::MPI::Vector solution(
- locally_owned_dofs, locally_relevant_dofs, MPI_COMM_WORLD);
- PETScWrappers::MPI::Vector solution2(
- locally_owned_dofs, locally_relevant_dofs, MPI_COMM_WORLD);
+ PETScWrappers::MPI::Vector solution(locally_owned_dofs,
+ locally_relevant_dofs,
+ MPI_COMM_WORLD);
+ PETScWrappers::MPI::Vector solution2(locally_owned_dofs,
+ locally_relevant_dofs,
+ MPI_COMM_WORLD);
parallel::distributed::SolutionTransfer<dim, PETScWrappers::MPI::Vector>
soltrans(dh);
DoFTools::extract_locally_relevant_dofs(dh, locally_relevant_dofs);
PETScWrappers::MPI::Vector x(locally_owned_dofs, com_small);
- PETScWrappers::MPI::Vector rel_x(
- locally_owned_dofs, locally_relevant_dofs, com_small);
+ PETScWrappers::MPI::Vector rel_x(locally_owned_dofs,
+ locally_relevant_dofs,
+ com_small);
parallel::distributed::SolutionTransfer<dim, PETScWrappers::MPI::Vector>
soltrans(dh);
local_relevant = local_owned;
local_relevant.add_range(1, 2);
- LinearAlgebra::distributed::Vector<double> v(
- local_owned, local_relevant, MPI_COMM_WORLD);
+ LinearAlgebra::distributed::Vector<double> v(local_owned,
+ local_relevant,
+ MPI_COMM_WORLD);
// set local values
if (myid < 8)
local_relevant = local_owned;
local_relevant.add_range(1, 2);
- LinearAlgebra::distributed::Vector<double> v(
- local_owned, local_relevant, MPI_COMM_WORLD);
+ LinearAlgebra::distributed::Vector<double> v(local_owned,
+ local_relevant,
+ MPI_COMM_WORLD);
// set local values
if (myid < 8)
local_relevant = local_owned;
local_relevant.add_range(1, 2);
- LinearAlgebra::distributed::Vector<double> v(
- local_owned, local_relevant, MPI_COMM_WORLD);
- std::vector<types::global_dof_index> indices;
- std::vector<double> values;
+ LinearAlgebra::distributed::Vector<double> v(local_owned,
+ local_relevant,
+ MPI_COMM_WORLD);
+ std::vector<types::global_dof_index> indices;
+ std::vector<double> values;
// set local values
if (myid < 8)
ConstraintMatrix constraints(relevant_set);
DoFTools::make_hanging_node_constraints(dof, constraints);
- VectorTools::interpolate_boundary_values(
- dof, 0, Functions::ZeroFunction<dim>(), constraints);
+ VectorTools::interpolate_boundary_values(dof,
+ 0,
+ Functions::ZeroFunction<dim>(),
+ constraints);
constraints.close();
std::shared_ptr<MatrixFree<dim, number>> mf_data(
ConstraintMatrix constraints(relevant_set);
DoFTools::make_hanging_node_constraints(dof, constraints);
- VectorTools::interpolate_boundary_values(
- dof, 0, Functions::ZeroFunction<dim>(), constraints);
+ VectorTools::interpolate_boundary_values(dof,
+ 0,
+ Functions::ZeroFunction<dim>(),
+ constraints);
constraints.close();
std::shared_ptr<MatrixFree<dim, number>> mf_data(
ConstraintMatrix constraints(relevant_set);
DoFTools::make_hanging_node_constraints(dof, constraints);
- VectorTools::interpolate_boundary_values(
- dof, 0, Functions::ZeroFunction<dim>(), constraints);
+ VectorTools::interpolate_boundary_values(dof,
+ 0,
+ Functions::ZeroFunction<dim>(),
+ constraints);
constraints.close();
std::shared_ptr<MatrixFree<dim, number>> mf_data(
ConstraintMatrix constraints(relevant_set);
DoFTools::make_hanging_node_constraints(dof, constraints);
- VectorTools::interpolate_boundary_values(
- dof, 0, Functions::ZeroFunction<dim>(), constraints);
+ VectorTools::interpolate_boundary_values(dof,
+ 0,
+ Functions::ZeroFunction<dim>(),
+ constraints);
constraints.close();
std::shared_ptr<MatrixFree<dim, number>> mf_data(
ConstraintMatrix constraints(relevant_set);
DoFTools::make_hanging_node_constraints(dof, constraints);
- VectorTools::interpolate_boundary_values(
- dof, 0, Functions::ZeroFunction<dim>(), constraints);
+ VectorTools::interpolate_boundary_values(dof,
+ 0,
+ Functions::ZeroFunction<dim>(),
+ constraints);
constraints.close();
std::shared_ptr<MatrixFree<dim, number>> mf_data(
ConstraintMatrix constraints(relevant_set);
DoFTools::make_hanging_node_constraints(dof, constraints);
- VectorTools::interpolate_boundary_values(
- dof, 0, Functions::ZeroFunction<dim>(), constraints);
+ VectorTools::interpolate_boundary_values(dof,
+ 0,
+ Functions::ZeroFunction<dim>(),
+ constraints);
constraints.close();
std::shared_ptr<MatrixFree<dim, number>> mf_data(
ConstraintMatrix constraints(relevant_set);
DoFTools::make_hanging_node_constraints(dof, constraints);
- VectorTools::interpolate_boundary_values(
- dof, 0, Functions::ZeroFunction<dim>(), constraints);
+ VectorTools::interpolate_boundary_values(dof,
+ 0,
+ Functions::ZeroFunction<dim>(),
+ constraints);
constraints.close();
std::shared_ptr<MatrixFree<dim, number>> mf_data(
ConstraintMatrix constraints(relevant_set);
DoFTools::make_hanging_node_constraints(dof, constraints);
- VectorTools::interpolate_boundary_values(
- dof, 0, Functions::ZeroFunction<dim>(), constraints);
+ VectorTools::interpolate_boundary_values(dof,
+ 0,
+ Functions::ZeroFunction<dim>(),
+ constraints);
constraints.close();
std::shared_ptr<MatrixFree<dim, number>> mf_data(
local_relevant = local_owned;
local_relevant.add_range(1, 2);
- LinearAlgebra::distributed::Vector<double> v(
- local_owned, local_relevant, MPI_COMM_WORLD);
+ LinearAlgebra::distributed::Vector<double> v(local_owned,
+ local_relevant,
+ MPI_COMM_WORLD);
// set local values
if (myid < 8)
IndexSet local_owned(numproc * 2);
local_owned.add_range(myid * 2, myid * 2 + 2);
- LinearAlgebra::distributed::Vector<double> v(
- local_owned, local_owned, MPI_COMM_WORLD);
+ LinearAlgebra::distributed::Vector<double> v(local_owned,
+ local_owned,
+ MPI_COMM_WORLD);
// set local values
v(myid * 2) = myid * 2.0;
local_relevant = local_owned;
local_relevant.add_range(1, 2);
- LinearAlgebra::distributed::Vector<double> v(
- local_owned, local_relevant, MPI_COMM_WORLD);
+ LinearAlgebra::distributed::Vector<double> v(local_owned,
+ local_relevant,
+ MPI_COMM_WORLD);
// set local values and check them
v(myid * 2) = myid * 2.0;
local_relevant = local_owned;
local_relevant.add_range(1, 2);
- LinearAlgebra::distributed::Vector<double> v(
- local_owned, local_relevant, MPI_COMM_WORLD);
+ LinearAlgebra::distributed::Vector<double> v(local_owned,
+ local_relevant,
+ MPI_COMM_WORLD);
// set local values and check them
v(myid * 2) = myid * 2.0;
local_relevant.add_range(4, 7);
}
- LinearAlgebra::distributed::Vector<double> v(
- local_owned, local_relevant, MPI_COMM_WORLD);
+ LinearAlgebra::distributed::Vector<double> v(local_owned,
+ local_relevant,
+ MPI_COMM_WORLD);
v = 0.;
// set local values
local_relevant = local_owned;
local_relevant.add_range(1, 2);
- LinearAlgebra::distributed::Vector<double> v(
- local_owned, local_relevant, MPI_COMM_WORLD);
+ LinearAlgebra::distributed::Vector<double> v(local_owned,
+ local_relevant,
+ MPI_COMM_WORLD);
// set local values and check them
v(myid * 2) = myid * 2.0;
local_relevant = local_owned;
local_relevant.add_range(1, 2);
- LinearAlgebra::distributed::Vector<double> v(
- local_owned, local_relevant, MPI_COMM_WORLD);
+ LinearAlgebra::distributed::Vector<double> v(local_owned,
+ local_relevant,
+ MPI_COMM_WORLD);
// set local values and check them
v(myid * 2) = myid * 2.0;
local_relevant = local_owned;
local_relevant.add_range(1, 2);
- LinearAlgebra::distributed::Vector<double> v(
- local_owned, local_owned, MPI_COMM_WORLD);
+ LinearAlgebra::distributed::Vector<double> v(local_owned,
+ local_owned,
+ MPI_COMM_WORLD);
// set local values
if (myid < 8)
2 * set + 3};
local_relevant.add_indices(&ghost_indices[0], &ghost_indices[0] + 10);
- LinearAlgebra::distributed::Vector<double> v(
- local_owned, local_relevant, MPI_COMM_WORLD);
+ LinearAlgebra::distributed::Vector<double> v(local_owned,
+ local_relevant,
+ MPI_COMM_WORLD);
// set a few of the local elements
for (unsigned i = 0; i < local_size; ++i)
// v has ghosts, w has none. set some entries
// on w, copy into v and check if they are
// there
- LinearAlgebra::distributed::Vector<double> v(
- local_owned, local_relevant, MPI_COMM_WORLD);
- LinearAlgebra::distributed::Vector<double> w(
- local_owned, local_owned, MPI_COMM_WORLD);
+ LinearAlgebra::distributed::Vector<double> v(local_owned,
+ local_relevant,
+ MPI_COMM_WORLD);
+ LinearAlgebra::distributed::Vector<double> w(local_owned,
+ local_owned,
+ MPI_COMM_WORLD);
// set a few of the local elements
for (unsigned i = 0; i < local_size; ++i)
2 * set + 3};
local_relevant.add_indices(&ghost_indices[0], &ghost_indices[0] + 10);
- LinearAlgebra::distributed::Vector<double> v(
- local_owned, local_relevant, MPI_COMM_WORLD);
+ LinearAlgebra::distributed::Vector<double> v(local_owned,
+ local_relevant,
+ MPI_COMM_WORLD);
// check number of ghosts everywhere (counted
// the above)
local_relevant = local_owned;
local_relevant.add_range(1, 2);
- LinearAlgebra::distributed::Vector<double> v(
- local_owned, local_relevant, MPI_COMM_WORLD);
+ LinearAlgebra::distributed::Vector<double> v(local_owned,
+ local_relevant,
+ MPI_COMM_WORLD);
LinearAlgebra::distributed::Vector<double> w(v);
// set local values and check them
local_relevant = local_owned;
local_relevant.add_index(2);
- LinearAlgebra::distributed::Vector<double> v(
- local_owned, local_relevant, MPI_COMM_WORLD);
+ LinearAlgebra::distributed::Vector<double> v(local_owned,
+ local_relevant,
+ MPI_COMM_WORLD);
AssertDimension(static_cast<unsigned int>(actual_local_size), v.local_size());
LinearAlgebra::distributed::Vector<double> w(v), x(v), y(v);
if (numproc > 2)
local_relevant0.add_index(8);
- LinearAlgebra::distributed::Vector<double> v0(
- local_owned0, local_relevant0, MPI_COMM_WORLD);
+ LinearAlgebra::distributed::Vector<double> v0(local_owned0,
+ local_relevant0,
+ MPI_COMM_WORLD);
// vector1: local size 4
const unsigned int local_size1 = 4;
local_relevant1.add_index(10);
}
- LinearAlgebra::distributed::Vector<double> v1(
- local_owned1, local_relevant1, MPI_COMM_WORLD);
+ LinearAlgebra::distributed::Vector<double> v1(local_owned1,
+ local_relevant1,
+ MPI_COMM_WORLD);
v0 = 1;
v1 = 2;
local_relevant.add_range(1, 2);
local_relevant.add_range(4, 5);
- LinearAlgebra::distributed::Vector<double> v(
- local_owned, local_relevant, MPI_COMM_WORLD);
+ LinearAlgebra::distributed::Vector<double> v(local_owned,
+ local_relevant,
+ MPI_COMM_WORLD);
// set local values and check them
v(myid * 2) = myid * 2.0;
// and once where they have not
for (unsigned int run = 0; run < 2; ++run)
{
- LinearAlgebra::distributed::Vector<double> v(
- local_owned, local_relevant, MPI_COMM_WORLD);
+ LinearAlgebra::distributed::Vector<double> v(local_owned,
+ local_relevant,
+ MPI_COMM_WORLD);
// set local values
if (myid < 2)
if (numproc > 1)
local_relevant.add_range(3, 4);
- LinearAlgebra::distributed::Vector<double> v(
- local_owned, local_relevant, MPI_COMM_WORLD);
+ LinearAlgebra::distributed::Vector<double> v(local_owned,
+ local_relevant,
+ MPI_COMM_WORLD);
// set local values
if (myid < 2)
local_relevant.add_range(min_index + 38, min_index + 40);
local_relevant.add_range(min_index + 41, min_index + 43);
- LinearAlgebra::distributed::Vector<double> v(
- local_owned, local_relevant, MPI_COMM_WORLD);
+ LinearAlgebra::distributed::Vector<double> v(local_owned,
+ local_relevant,
+ MPI_COMM_WORLD);
deallog << "Local range of proc 0: " << v.local_range().first << " "
<< v.local_range().second << std::endl;
local_relevant = local_owned;
local_relevant.add_range(1, 2);
- LinearAlgebra::distributed::Vector<double> v(
- local_owned, local_owned, MPI_COMM_WORLD);
+ LinearAlgebra::distributed::Vector<double> v(local_owned,
+ local_owned,
+ MPI_COMM_WORLD);
// set local values
if (myid < 8)
local_relevant = local_owned;
local_relevant.add_range(1, 2);
- LinearAlgebra::distributed::Vector<double> v(
- local_owned, local_owned, MPI_COMM_WORLD);
+ LinearAlgebra::distributed::Vector<double> v(local_owned,
+ local_owned,
+ MPI_COMM_WORLD);
// set local values
if (myid < 8)
ghost_set.add_index(0);
ghost_set.add_index(2);
- LinearAlgebra::distributed::Vector<double> v(
- locally_owned, ghost_set, MPI_COMM_WORLD);
+ LinearAlgebra::distributed::Vector<double> v(locally_owned,
+ ghost_set,
+ MPI_COMM_WORLD);
// create vector without actually setting the entries since they will be
// overwritten soon anyway
IndexSet locally_relevant_dofs2;
DoFTools::extract_locally_relevant_dofs(dof2, locally_relevant_dofs2);
- LinearAlgebra::distributed::Vector<double> v2(
- dof2.locally_owned_dofs(), locally_relevant_dofs2, MPI_COMM_WORLD),
+ LinearAlgebra::distributed::Vector<double> v2(dof2.locally_owned_dofs(),
+ locally_relevant_dofs2,
+ MPI_COMM_WORLD),
v2_interpolated(v2);
// set first vector to 1
DoFTools::extract_locally_relevant_dofs(dof1, locally_relevant_dofs1);
DoFTools::extract_locally_relevant_dofs(dof2, locally_relevant_dofs2);
- LinearAlgebra::distributed::Vector<double> v1(
- dof1.locally_owned_dofs(), locally_relevant_dofs1, MPI_COMM_WORLD),
+ LinearAlgebra::distributed::Vector<double> v1(dof1.locally_owned_dofs(),
+ locally_relevant_dofs1,
+ MPI_COMM_WORLD),
v2(dof2.locally_owned_dofs(), locally_relevant_dofs2, MPI_COMM_WORLD);
// set first vector to 1
};
template <int dim>
-periodicity_tests<dim>::periodicity_tests() :
- refn_cycle(0),
- mpi_comm(MPI_COMM_WORLD),
- the_grid(mpi_comm)
+periodicity_tests<dim>::periodicity_tests()
+ : refn_cycle(0)
+ , mpi_comm(MPI_COMM_WORLD)
+ , the_grid(mpi_comm)
{
Assert(dim == 2 || dim == 3,
ExcMessage("Only implemented for the 2D and 3D case!"));
};
template <int dim>
- LaplaceProblem<dim>::LaplaceProblem() :
- mpi_communicator(MPI_COMM_WORLD),
- triangulation(mpi_communicator),
- dof_handler(triangulation),
- fe(2),
- pcout(Utilities::MPI::this_mpi_process(mpi_communicator) == 0 ?
- deallog.get_file_stream() :
- std::cout,
- (Utilities::MPI::this_mpi_process(mpi_communicator) == 0))
+ LaplaceProblem<dim>::LaplaceProblem()
+ : mpi_communicator(MPI_COMM_WORLD)
+ , triangulation(mpi_communicator)
+ , dof_handler(triangulation)
+ , fe(2)
+ , pcout(Utilities::MPI::this_mpi_process(mpi_communicator) == 0 ?
+ deallog.get_file_stream() :
+ std::cout,
+ (Utilities::MPI::this_mpi_process(mpi_communicator) == 0))
{}
locally_owned_dofs = dof_handler.locally_owned_dofs();
DoFTools::extract_locally_relevant_dofs(dof_handler, locally_relevant_dofs);
- locally_relevant_solution.reinit(
- locally_owned_dofs, locally_relevant_dofs, mpi_communicator);
+ locally_relevant_solution.reinit(locally_owned_dofs,
+ locally_relevant_dofs,
+ mpi_communicator);
system_rhs.reinit(mpi_communicator,
dof_handler.n_dofs(),
dof_handler.n_locally_owned_dofs());
/*direction*/ i,
constraints);
- VectorTools::interpolate_boundary_values(
- dof_handler, 0, Functions::ZeroFunction<dim>(), constraints);
+ VectorTools::interpolate_boundary_values(dof_handler,
+ 0,
+ Functions::ZeroFunction<dim>(),
+ constraints);
constraints.close();
- DynamicSparsityPattern csp(
- dof_handler.n_dofs(), dof_handler.n_dofs(), locally_relevant_dofs);
+ DynamicSparsityPattern csp(dof_handler.n_dofs(),
+ dof_handler.n_dofs(),
+ locally_relevant_dofs);
DoFTools::make_sparsity_pattern(dof_handler, csp, constraints, false);
SparsityTools::distribute_sparsity_pattern(
csp,
GridTools::find_active_cell_around_point(dof_handler, point);
if (cell->is_locally_owned())
- VectorTools::point_value(
- dof_handler, locally_relevant_solution, point, value);
+ VectorTools::point_value(dof_handler,
+ locally_relevant_solution,
+ point,
+ value);
std::vector<double> tmp(value.size());
std::vector<double> tmp2(value.size());
class BoundaryValues : public Function<dim>
{
public:
- BoundaryValues() : Function<dim>(dim + 1)
+ BoundaryValues()
+ : Function<dim>(dim + 1)
{}
virtual double
class RightHandSide : public Function<dim>
{
public:
- RightHandSide() : Function<dim>(dim + 1)
+ RightHandSide()
+ : Function<dim>(dim + 1)
{}
virtual double
const Matrix & m,
const Preconditioner &preconditioner,
const IndexSet & locally_owned,
- const MPI_Comm & mpi_communicator) :
- matrix(&m),
- preconditioner(&preconditioner),
- mpi_communicator(&mpi_communicator),
- tmp(locally_owned, mpi_communicator)
+ const MPI_Comm & mpi_communicator)
+ : matrix(&m)
+ , preconditioner(&preconditioner)
+ , mpi_communicator(&mpi_communicator)
+ , tmp(locally_owned, mpi_communicator)
{}
TrilinosWrappers::MPI::Vector & dst,
const TrilinosWrappers::MPI::Vector &src) const
{
- SolverControl solver_control(
- src.size(), 1e-6 * src.l2_norm(), false, false);
+ SolverControl solver_control(src.size(),
+ 1e-6 * src.l2_norm(),
+ false,
+ false);
TrilinosWrappers::SolverCG cg(solver_control,
TrilinosWrappers::SolverCG::AdditionalData());
& A_inverse,
const IndexSet &owned_vel,
const IndexSet &relevant_vel,
- const MPI_Comm &mpi_communicator) :
- system_matrix(&system_matrix),
- A_inverse(&A_inverse),
- tmp1(owned_vel, mpi_communicator),
- tmp2(tmp1)
+ const MPI_Comm &mpi_communicator)
+ : system_matrix(&system_matrix)
+ , A_inverse(&A_inverse)
+ , tmp1(owned_vel, mpi_communicator)
+ , tmp2(tmp1)
{}
DoFRenumbering::component_wise(dof_handler, block_component);
std::vector<types::global_dof_index> dofs_per_block(2);
- DoFTools::count_dofs_per_block(
- dof_handler, dofs_per_block, block_component);
+ DoFTools::count_dofs_per_block(dof_handler,
+ dofs_per_block,
+ block_component);
const unsigned int n_u = dofs_per_block[0], n_p = dofs_per_block[1];
{
relevant_partitioning,
mpi_communicator);
- DoFTools::make_sparsity_pattern(
- dof_handler,
- bsp,
- constraints,
- false,
- Utilities::MPI::this_mpi_process(mpi_communicator));
+ DoFTools::make_sparsity_pattern(dof_handler,
+ bsp,
+ constraints,
+ false,
+ Utilities::MPI::this_mpi_process(
+ mpi_communicator));
bsp.compress();
}
system_rhs.reinit(owned_partitioning, mpi_communicator);
- solution.reinit(
- owned_partitioning, relevant_partitioning, mpi_communicator);
+ solution.reinit(owned_partitioning,
+ relevant_partitioning,
+ mpi_communicator);
}
relevant_partitioning[0],
mpi_communicator);
- SolverControl solver_control(
- solution.block(1).size(), 1e-6 * schur_rhs.l2_norm(), false, false);
+ SolverControl solver_control(solution.block(1).size(),
+ 1e-6 * schur_rhs.l2_norm(),
+ false,
+ false);
// TrilinosWrappers::SolverCG cg (solver_control,
// TrilinosWrappers::SolverCG::AdditionalData(true));
SolverCG<TrilinosWrappers::MPI::Vector> cg(solver_control);
data_out.build_patches(degree + 1);
std::ostringstream filename;
- filename << "solution-" << Utilities::int_to_string(refinement_cycle, 2)
- << "."
- << Utilities::int_to_string(
- triangulation.locally_owned_subdomain(), 2)
- << ".vtu";
+ filename
+ << "solution-" << Utilities::int_to_string(refinement_cycle, 2) << "."
+ << Utilities::int_to_string(triangulation.locally_owned_subdomain(), 2)
+ << ".vtu";
std::ofstream output(filename.str().c_str());
data_out.write_vtu(output);
const Matrix & m,
const Preconditioner &preconditioner,
const IndexSet & locally_owned,
- const MPI_Comm & mpi_communicator) :
- matrix(&m),
- preconditioner(&preconditioner),
- mpi_communicator(&mpi_communicator),
- tmp(locally_owned, mpi_communicator)
+ const MPI_Comm & mpi_communicator)
+ : matrix(&m)
+ , preconditioner(&preconditioner)
+ , mpi_communicator(&mpi_communicator)
+ , tmp(locally_owned, mpi_communicator)
{}
TrilinosWrappers::MPI::Vector & dst,
const TrilinosWrappers::MPI::Vector &src) const
{
- SolverControl solver_control(
- src.size(), 1e-6 * src.l2_norm(), false, false);
+ SolverControl solver_control(src.size(),
+ 1e-6 * src.l2_norm(),
+ false,
+ false);
SolverCG<TrilinosWrappers::MPI::Vector> cg(solver_control);
tmp = 0.;
const InverseMatrix<TrilinosWrappers::SparseMatrix, Preconditioner>
& A_inverse,
const IndexSet &owned_vel,
- const MPI_Comm &mpi_communicator) :
- system_matrix(&system_matrix),
- A_inverse(&A_inverse),
- tmp1(owned_vel, mpi_communicator),
- tmp2(tmp1)
+ const MPI_Comm &mpi_communicator)
+ : system_matrix(&system_matrix)
+ , A_inverse(&A_inverse)
+ , tmp1(owned_vel, mpi_communicator)
+ , tmp2(tmp1)
{}
DoFRenumbering::component_wise(dof_handler, block_component);
std::vector<types::global_dof_index> dofs_per_block(2);
- DoFTools::count_dofs_per_block(
- dof_handler, dofs_per_block, block_component);
+ DoFTools::count_dofs_per_block(dof_handler,
+ dofs_per_block,
+ block_component);
const unsigned int n_u = dofs_per_block[0], n_p = dofs_per_block[1];
{
fe.component_mask(velocities),
first_vector_components);
- VectorTools::interpolate_boundary_values(
- dof_handler,
- 1,
- Functions::ZeroFunction<dim>(dim + 1),
- constraints,
- fe.component_mask(velocities));
-
- VectorTools::interpolate_boundary_values(
- dof_handler,
- 2,
- Functions::ZeroFunction<dim>(dim + 1),
- constraints,
- fe.component_mask(velocities));
-
- VectorTools::interpolate_boundary_values(
- dof_handler,
- 3,
- Functions::ZeroFunction<dim>(dim + 1),
- constraints,
- fe.component_mask(velocities));
-
- VectorTools::interpolate_boundary_values(
- dof_handler,
- 5,
- Functions::ZeroFunction<dim>(dim + 1),
- constraints,
- fe.component_mask(velocities));
+ VectorTools::interpolate_boundary_values(dof_handler,
+ 1,
+ Functions::ZeroFunction<dim>(
+ dim + 1),
+ constraints,
+ fe.component_mask(velocities));
+
+ VectorTools::interpolate_boundary_values(dof_handler,
+ 2,
+ Functions::ZeroFunction<dim>(
+ dim + 1),
+ constraints,
+ fe.component_mask(velocities));
+
+ VectorTools::interpolate_boundary_values(dof_handler,
+ 3,
+ Functions::ZeroFunction<dim>(
+ dim + 1),
+ constraints,
+ fe.component_mask(velocities));
+
+ VectorTools::interpolate_boundary_values(dof_handler,
+ 5,
+ Functions::ZeroFunction<dim>(
+ dim + 1),
+ constraints,
+ fe.component_mask(velocities));
}
constraints.close();
relevant_partitioning,
mpi_communicator);
- DoFTools::make_sparsity_pattern(
- dof_handler,
- bsp,
- constraints,
- false,
- Utilities::MPI::this_mpi_process(mpi_communicator));
+ DoFTools::make_sparsity_pattern(dof_handler,
+ bsp,
+ constraints,
+ false,
+ Utilities::MPI::this_mpi_process(
+ mpi_communicator));
bsp.compress();
}
system_rhs.reinit(owned_partitioning, mpi_communicator);
- solution.reinit(
- owned_partitioning, relevant_partitioning, mpi_communicator);
+ solution.reinit(owned_partitioning,
+ relevant_partitioning,
+ mpi_communicator);
}
SchurComplement<TrilinosWrappers::PreconditionJacobi> schur_complement(
system_matrix, A_inverse, owned_partitioning[0], mpi_communicator);
- SolverControl solver_control(
- solution.block(1).size(), 1e-6 * schur_rhs.l2_norm(), false, false);
+ SolverControl solver_control(solution.block(1).size(),
+ 1e-6 * schur_rhs.l2_norm(),
+ false,
+ false);
SolverCG<TrilinosWrappers::MPI::Vector> cg(solver_control);
TrilinosWrappers::PreconditionAMG preconditioner;
data_out.build_patches(degree + 1);
std::ostringstream filename;
- filename << "solution-" << Utilities::int_to_string(refinement_cycle, 2)
- << "."
- << Utilities::int_to_string(
- triangulation.locally_owned_subdomain(), 2)
- << ".vtu";
+ filename
+ << "solution-" << Utilities::int_to_string(refinement_cycle, 2) << "."
+ << Utilities::int_to_string(triangulation.locally_owned_subdomain(), 2)
+ << ".vtu";
std::ofstream output(filename.str().c_str());
data_out.write_vtu(output);
unsigned int n_local_constraints = 0;
std::map<types::global_dof_index, Point<dim>> support_points;
- DoFTools::map_dofs_to_support_points(
- MappingQGeneric<dim>(1), dof_handler, support_points);
+ DoFTools::map_dofs_to_support_points(MappingQGeneric<dim>(1),
+ dof_handler,
+ support_points);
IndexSet constraints_lines = constraints.get_local_lines();
for (unsigned int i = 0; i < constraints_lines.n_elements(); ++i)
mat.add(2 * myid + 1, 2 * myid + 1, 1.0);
mat.add(1, 0, 42.0);
- mat.add(
- (2 * myid + 2) % (2 * numprocs), (2 * myid + 2) % (2 * numprocs), 0.1);
+ mat.add((2 * myid + 2) % (2 * numprocs),
+ (2 * myid + 2) % (2 * numprocs),
+ 0.1);
mat.compress(VectorOperation::add);
mat.add(2 * myid, 2 * myid, 1.0);
mat.add(2 * myid + 1, 2 * myid + 1, 1.0);
- mat.add(
- (2 * myid + 2) % (2 * numprocs), (2 * myid + 2) % (2 * numprocs), 0.1);
+ mat.add((2 * myid + 2) % (2 * numprocs),
+ (2 * myid + 2) % (2 * numprocs),
+ 0.1);
mat.compress(VectorOperation::add);
// mat.write_ascii();
for (unsigned int i = 0; i < v_space_cells; ++i)
step_sizes[1].push_back(cell_size_y);
- GridGenerator::subdivided_hyper_rectangle(
- tmp_rectangle,
- step_sizes,
- Point<2>(h_distance, 0),
- Point<2>(length + h_distance, v_distance),
- false);
+ GridGenerator::subdivided_hyper_rectangle(tmp_rectangle,
+ step_sizes,
+ Point<2>(h_distance, 0),
+ Point<2>(length + h_distance,
+ v_distance),
+ false);
tmp_tria_buffer.copy_triangulation(tmp_tria_fluid);
- GridGenerator::merge_triangulations(
- tmp_tria_buffer, tmp_rectangle, tmp_tria_fluid);
+ GridGenerator::merge_triangulations(tmp_tria_buffer,
+ tmp_rectangle,
+ tmp_tria_fluid);
tmp_tria_buffer.clear();
tmp_rectangle.clear();
for (unsigned int i = 0; i < (h_cells - v_space_cells - solid_cells_y); ++i)
step_sizes[1].push_back(cell_size_y);
- GridGenerator::subdivided_hyper_rectangle(
- tmp_rectangle,
- step_sizes,
- Point<2>(h_distance, solid_top),
- Point<2>(h_distance + length, height),
- false);
+ GridGenerator::subdivided_hyper_rectangle(tmp_rectangle,
+ step_sizes,
+ Point<2>(h_distance, solid_top),
+ Point<2>(h_distance + length,
+ height),
+ false);
tmp_tria_buffer.copy_triangulation(tmp_tria_fluid);
- GridGenerator::merge_triangulations(
- tmp_tria_buffer, tmp_rectangle, tmp_tria_fluid);
+ GridGenerator::merge_triangulations(tmp_tria_buffer,
+ tmp_rectangle,
+ tmp_tria_fluid);
tmp_tria_buffer.clear();
tmp_rectangle.clear();
//
false);
tmp_tria_buffer.copy_triangulation(tmp_tria_fluid);
- GridGenerator::merge_triangulations(
- tmp_tria_buffer, tmp_rectangle, tmp_tria_fluid);
+ GridGenerator::merge_triangulations(tmp_tria_buffer,
+ tmp_rectangle,
+ tmp_tria_fluid);
//-----------COPY to distributed
fluid_triangulation.copy_triangulation(tmp_tria_fluid);
Utilities::MPI::n_mpi_processes(MPI_COMM_WORLD);
// create a vector that consists of elements indexed from 0 to n
- PETScWrappers::MPI::BlockVector vec(
- 2, MPI_COMM_WORLD, 100 * n_processes, 100);
+ PETScWrappers::MPI::BlockVector vec(2,
+ MPI_COMM_WORLD,
+ 100 * n_processes,
+ 100);
vec.block(0).reinit(MPI_COMM_WORLD, 100 * n_processes, 100);
vec.block(1).reinit(MPI_COMM_WORLD, 100 * n_processes, 100);
vec.collect_sizes();
// verify correctness
if (myid != 0)
- AssertThrow(
- get_real_assert_zero_imag(vec(vec.block(0).local_range().first + 10)) ==
- vec.block(0).local_range().first - 25,
- ExcInternalError());
+ AssertThrow(get_real_assert_zero_imag(
+ vec(vec.block(0).local_range().first + 10)) ==
+ vec.block(0).local_range().first - 25,
+ ExcInternalError());
if (myid != n_processes - 1)
- AssertThrow(
- get_real_assert_zero_imag(vec(vec.block(0).local_range().first + 90)) ==
- vec.block(0).local_range().first + 105,
- ExcInternalError());
+ AssertThrow(get_real_assert_zero_imag(
+ vec(vec.block(0).local_range().first + 90)) ==
+ vec.block(0).local_range().first + 105,
+ ExcInternalError());
if (myid != 0)
AssertThrow(get_real_assert_zero_imag(
Utilities::MPI::n_mpi_processes(MPI_COMM_WORLD);
// create a vector that consists of elements indexed from 0 to n
- PETScWrappers::MPI::BlockVector vec(
- 2, MPI_COMM_WORLD, 100 * n_processes, 100);
+ PETScWrappers::MPI::BlockVector vec(2,
+ MPI_COMM_WORLD,
+ 100 * n_processes,
+ 100);
vec.block(0).reinit(MPI_COMM_WORLD, 100 * n_processes, 100);
vec.block(1).reinit(MPI_COMM_WORLD, 100 * n_processes, 100);
vec.collect_sizes();
{
try
{
- VectorTools::point_value(
- dof_handler, locally_owned_solution, *point_iterator, value);
+ VectorTools::point_value(dof_handler,
+ locally_owned_solution,
+ *point_iterator,
+ value);
if (std::abs(value[0] - 1.) > 1e-8)
ExcInternalError();
}
std::vector<unsigned int> sub(2);
sub[0] = 5 * Utilities::MPI::n_mpi_processes(MPI_COMM_WORLD);
sub[1] = 1;
- GridGenerator::subdivided_hyper_rectangle(
- static_cast<Triangulation<2> &>(tr), sub, Point<2>(0, 0), Point<2>(1, 1));
+ GridGenerator::subdivided_hyper_rectangle(static_cast<Triangulation<2> &>(tr),
+ sub,
+ Point<2>(0, 0),
+ Point<2>(1, 1));
tr.refine_global(1);
Vector<float> indicators(tr.n_active_cells());
std::vector<unsigned int> sub(2);
sub[0] = 5 * Utilities::MPI::n_mpi_processes(MPI_COMM_WORLD);
sub[1] = 1;
- GridGenerator::subdivided_hyper_rectangle(
- static_cast<Triangulation<2> &>(tr), sub, Point<2>(0, 0), Point<2>(1, 1));
+ GridGenerator::subdivided_hyper_rectangle(static_cast<Triangulation<2> &>(tr),
+ sub,
+ Point<2>(0, 0),
+ Point<2>(1, 1));
tr.refine_global(1);
Vector<float> indicators(tr.n_active_cells());
std::vector<unsigned int> sub(2);
sub[0] = 5 * Utilities::MPI::n_mpi_processes(MPI_COMM_WORLD);
sub[1] = 1;
- GridGenerator::subdivided_hyper_rectangle(
- static_cast<Triangulation<2> &>(tr), sub, Point<2>(0, 0), Point<2>(1, 1));
+ GridGenerator::subdivided_hyper_rectangle(static_cast<Triangulation<2> &>(tr),
+ sub,
+ Point<2>(0, 0),
+ Point<2>(1, 1));
tr.refine_global(1);
Vector<float> indicators(tr.n_active_cells());
// only works because we are
// working on only a single
// processor
- dealii::GridRefinement ::refine_and_coarsen_fixed_fraction(
- tr, indicators, 2. / 3, 1. / 6);
+ dealii::GridRefinement ::refine_and_coarsen_fixed_fraction(tr,
+ indicators,
+ 2. / 3,
+ 1. / 6);
{
float coarsen_indicator = min_indicator - 1,
refine_indicator = max_indicator + 1;
// only works because we are
// working on only a single
// processor
- dealii::GridRefinement ::refine_and_coarsen_fixed_fraction(
- tr, indicators, 2. / 3, 1. / 6);
+ dealii::GridRefinement ::refine_and_coarsen_fixed_fraction(tr,
+ indicators,
+ 2. / 3,
+ 1. / 6);
{
float coarsen_indicator = min_indicator - 1,
refine_indicator = max_indicator + 1;
// only works because we are
// working on only a single
// processor
- dealii::GridRefinement ::refine_and_coarsen_fixed_fraction(
- tr, indicators, 0.6, 0.2);
+ dealii::GridRefinement ::refine_and_coarsen_fixed_fraction(tr,
+ indicators,
+ 0.6,
+ 0.2);
{
float coarsen_indicator = min_indicator - 1,
refine_indicator = max_indicator + 1;
std::vector<unsigned int> subdivisions(2);
subdivisions[0] = 120;
subdivisions[1] = 1;
- GridGenerator::subdivided_hyper_rectangle(
- triangulation, subdivisions, Point<2>(), Point<2>(1, 1));
+ GridGenerator::subdivided_hyper_rectangle(triangulation,
+ subdivisions,
+ Point<2>(),
+ Point<2>(1, 1));
// initialize the refinement indicators with a set of particular values from
// the original testcase
const double values[] = {
std::vector<unsigned int> sub(2);
sub[0] = 5 * Utilities::MPI::n_mpi_processes(MPI_COMM_WORLD);
sub[1] = 1;
- GridGenerator::subdivided_hyper_rectangle(
- static_cast<Triangulation<2> &>(tr), sub, Point<2>(0, 0), Point<2>(1, 1));
+ GridGenerator::subdivided_hyper_rectangle(static_cast<Triangulation<2> &>(tr),
+ sub,
+ Point<2>(0, 0),
+ Point<2>(1, 1));
tr.refine_global(1);
Vector<float> indicators(tr.n_active_cells());
std::vector<unsigned int> sub(2);
sub[0] = 5 * Utilities::MPI::n_mpi_processes(MPI_COMM_WORLD);
sub[1] = 1;
- GridGenerator::subdivided_hyper_rectangle(
- static_cast<Triangulation<2> &>(tr), sub, Point<2>(0, 0), Point<2>(1, 1));
+ GridGenerator::subdivided_hyper_rectangle(static_cast<Triangulation<2> &>(tr),
+ sub,
+ Point<2>(0, 0),
+ Point<2>(1, 1));
tr.refine_global(1);
Vector<float> indicators(tr.n_active_cells());
std::vector<unsigned int> sub(2);
sub[0] = 5 * Utilities::MPI::n_mpi_processes(MPI_COMM_WORLD);
sub[1] = 1;
- GridGenerator::subdivided_hyper_rectangle(
- static_cast<Triangulation<2> &>(tr), sub, Point<2>(0, 0), Point<2>(1, 1));
+ GridGenerator::subdivided_hyper_rectangle(static_cast<Triangulation<2> &>(tr),
+ sub,
+ Point<2>(0, 0),
+ Point<2>(1, 1));
tr.refine_global(1);
Vector<float> indicators(tr.n_active_cells());
// only works because we are
// working on only a single
// processor
- dealii::GridRefinement ::refine_and_coarsen_fixed_number(
- tr, indicators, 2. / 3, 1. / 6);
+ dealii::GridRefinement ::refine_and_coarsen_fixed_number(tr,
+ indicators,
+ 2. / 3,
+ 1. / 6);
{
float coarsen_indicator = min_indicator - 1,
refine_indicator = max_indicator + 1;
// only works because we are
// working on only a single
// processor
- dealii::GridRefinement ::refine_and_coarsen_fixed_number(
- tr, indicators, 2. / 3, 1. / 6);
+ dealii::GridRefinement ::refine_and_coarsen_fixed_number(tr,
+ indicators,
+ 2. / 3,
+ 1. / 6);
{
float coarsen_indicator = min_indicator - 1,
refine_indicator = max_indicator + 1;
std::vector<unsigned int> sub(2);
sub[0] = 5 * Utilities::MPI::n_mpi_processes(MPI_COMM_WORLD);
sub[1] = 1;
- GridGenerator::subdivided_hyper_rectangle(
- static_cast<Triangulation<2> &>(tr), sub, Point<2>(0, 0), Point<2>(1, 1));
+ GridGenerator::subdivided_hyper_rectangle(static_cast<Triangulation<2> &>(tr),
+ sub,
+ Point<2>(0, 0),
+ Point<2>(1, 1));
tr.refine_global(3);
Vector<float> indicators(tr.n_active_cells());
// send everything to processor 0 for output
std::vector<types::global_dof_index> complete_renumbering(dofh.n_dofs());
- std::copy(
- renumbering.begin(), renumbering.end(), complete_renumbering.begin());
+ std::copy(renumbering.begin(),
+ renumbering.end(),
+ complete_renumbering.begin());
unsigned int offset = renumbering.size();
for (unsigned int i = 1; i < nprocs; ++i)
{
if (myid == i)
- MPI_Send(
- &renumbering[0],
- renumbering.size(),
- Utilities::MPI::internal::mpi_type_id(&complete_renumbering[0]),
- 0,
- i,
- MPI_COMM_WORLD);
+ MPI_Send(&renumbering[0],
+ renumbering.size(),
+ Utilities::MPI::internal::mpi_type_id(
+ &complete_renumbering[0]),
+ 0,
+ i,
+ MPI_COMM_WORLD);
else if (myid == 0)
- MPI_Recv(
- &complete_renumbering[offset],
- dofh.locally_owned_dofs_per_processor()[i].n_elements(),
- Utilities::MPI::internal::mpi_type_id(&complete_renumbering[0]),
- i,
- i,
- MPI_COMM_WORLD,
- MPI_STATUSES_IGNORE);
+ MPI_Recv(&complete_renumbering[offset],
+ dofh.locally_owned_dofs_per_processor()[i].n_elements(),
+ Utilities::MPI::internal::mpi_type_id(
+ &complete_renumbering[0]),
+ i,
+ i,
+ MPI_COMM_WORLD,
+ MPI_STATUSES_IGNORE);
offset += dofh.locally_owned_dofs_per_processor()[i].n_elements();
}
// send everything to processor 0 for output
std::vector<types::global_dof_index> complete_renumbering(dofh.n_dofs());
- std::copy(
- renumbering.begin(), renumbering.end(), complete_renumbering.begin());
+ std::copy(renumbering.begin(),
+ renumbering.end(),
+ complete_renumbering.begin());
unsigned int offset = renumbering.size();
for (unsigned int i = 1; i < nprocs; ++i)
{
if (myid == i)
- MPI_Send(
- &renumbering[0],
- renumbering.size(),
- Utilities::MPI::internal::mpi_type_id(&complete_renumbering[0]),
- 0,
- i,
- MPI_COMM_WORLD);
+ MPI_Send(&renumbering[0],
+ renumbering.size(),
+ Utilities::MPI::internal::mpi_type_id(
+ &complete_renumbering[0]),
+ 0,
+ i,
+ MPI_COMM_WORLD);
else if (myid == 0)
- MPI_Recv(
- &complete_renumbering[offset],
- dofh.locally_owned_dofs_per_processor()[i].n_elements(),
- Utilities::MPI::internal::mpi_type_id(&complete_renumbering[0]),
- i,
- i,
- MPI_COMM_WORLD,
- MPI_STATUSES_IGNORE);
+ MPI_Recv(&complete_renumbering[offset],
+ dofh.locally_owned_dofs_per_processor()[i].n_elements(),
+ Utilities::MPI::internal::mpi_type_id(
+ &complete_renumbering[0]),
+ i,
+ i,
+ MPI_COMM_WORLD,
+ MPI_STATUSES_IGNORE);
offset += dofh.locally_owned_dofs_per_processor()[i].n_elements();
}
fe_values.JxW(q);
}
}
- cm.distribute_local_to_global(
- local_vector, local_dof_indices, vector);
+ cm.distribute_local_to_global(local_vector,
+ local_dof_indices,
+ vector);
}
vector.compress(VectorOperation::add);
}
fe_values.JxW(q);
}
}
- cm.distribute_local_to_global(
- local_vector, local_dof_indices, vector);
+ cm.distribute_local_to_global(local_vector,
+ local_dof_indices,
+ vector);
}
vector.compress(VectorOperation::add);
}
unsigned int myid = Utilities::MPI::this_mpi_process(MPI_COMM_WORLD);
parallel::distributed::Triangulation<2> tr(MPI_COMM_WORLD);
- GridGenerator::subdivided_hyper_rectangle(
- tr, std::vector<unsigned int>{{2, 2}}, Point<2>(), Point<2>(2, 2));
+ GridGenerator::subdivided_hyper_rectangle(tr,
+ std::vector<unsigned int>{{2, 2}},
+ Point<2>(),
+ Point<2>(2, 2));
const FE_Q<2> fe(1);
DoFTools::extract_locally_relevant_dofs(dh, locally_relevant_dofs);
- PETScWrappers::MPI::Vector solution(
- locally_owned_dofs, locally_relevant_dofs, MPI_COMM_WORLD);
+ PETScWrappers::MPI::Vector solution(locally_owned_dofs,
+ locally_relevant_dofs,
+ MPI_COMM_WORLD);
parallel::distributed::SolutionTransfer<2, PETScWrappers::MPI::Vector>
soltrans(dh);
template <int dim>
- LaplaceProblem<dim>::LaplaceProblem() :
+ LaplaceProblem<dim>::LaplaceProblem()
+ :
#ifdef DEAL_II_WITH_P4EST
triangulation(
MPI_COMM_WORLD,
Triangulation<dim>::limit_level_difference_at_vertices,
- parallel::distributed::Triangulation<dim>::construct_multigrid_hierarchy),
+ parallel::distributed::Triangulation<dim>::construct_multigrid_hierarchy)
+ ,
#else
- triangulation(Triangulation<dim>::limit_level_difference_at_vertices),
+ triangulation(Triangulation<dim>::limit_level_difference_at_vertices)
+ ,
#endif
- fe(degree_finite_element),
- dof_handler(triangulation),
- fe_euler(degree_finite_element),
- fe_system(fe_euler, dim),
- dof_euler(triangulation),
- pcout(std::cout, Utilities::MPI::this_mpi_process(MPI_COMM_WORLD) == 0)
+ fe(degree_finite_element)
+ , dof_handler(triangulation)
+ , fe_euler(degree_finite_element)
+ , fe_system(fe_euler, dim)
+ , dof_euler(triangulation)
+ , pcout(std::cout, Utilities::MPI::this_mpi_process(MPI_COMM_WORLD) == 0)
{}
IndexSet locally_relevant_euler;
DoFTools::extract_locally_relevant_dofs(dof_euler,
locally_relevant_euler);
- euler_positions.reinit(
- dof_euler.locally_owned_dofs(), locally_relevant_euler, MPI_COMM_WORLD);
+ euler_positions.reinit(dof_euler.locally_owned_dofs(),
+ locally_relevant_euler,
+ MPI_COMM_WORLD);
}
// Set up a quadrature formula based on the support points of FE_Q and go
constraints.clear();
constraints.reinit(locally_relevant_dofs);
DoFTools::make_hanging_node_constraints(dof_handler, constraints);
- VectorTools::interpolate_boundary_values(
- dof_handler, 0, Functions::ZeroFunction<dim>(), constraints);
+ VectorTools::interpolate_boundary_values(dof_handler,
+ 0,
+ Functions::ZeroFunction<dim>(),
+ constraints);
constraints.close();
{
for (unsigned int level = 0; level < nlevels; ++level)
{
IndexSet relevant_dofs;
- DoFTools::extract_locally_relevant_level_dofs(
- dof_handler, level, relevant_dofs);
+ DoFTools::extract_locally_relevant_level_dofs(dof_handler,
+ level,
+ relevant_dofs);
ConstraintMatrix level_constraints;
level_constraints.reinit(relevant_dofs);
level_constraints.add_lines(
QGauss<1>(fe.degree + 1),
additional_data);
- mg_matrices[level].initialize(
- mg_mf_storage_level, mg_constrained_dofs, level);
+ mg_matrices[level].initialize(mg_mf_storage_level,
+ mg_constrained_dofs,
+ level);
mg_matrices[level].compute_diagonal();
}
}
class PotentialBCFunction : public Function<dim>
{
public:
- PotentialBCFunction(const double &charge, const Point<dim> &dipole) :
- Function<dim>(1),
- charge(charge),
- x0(std::abs(charge) < 1e-10 ? Point<dim>() : dipole / charge)
+ PotentialBCFunction(const double &charge, const Point<dim> &dipole)
+ : Function<dim>(1)
+ , charge(charge)
+ , x0(std::abs(charge) < 1e-10 ? Point<dim>() : dipole / charge)
{}
virtual ~PotentialBCFunction() = default;
{
std::map<types::global_dof_index, Point<dim>> support_points;
MappingQ<dim> mapping(degree_finite_element);
- DoFTools::map_dofs_to_support_points(
- mapping, dof_handler, support_points);
+ DoFTools::map_dofs_to_support_points(mapping,
+ dof_handler,
+ support_points);
const std::string base_filename =
"grid" + dealii::Utilities::int_to_string(dim) + "_" +
template <int dim>
InteriorPenaltyProblem<dim>::InteriorPenaltyProblem(
- const FiniteElement<dim> &fe) :
- triangulation(
- MPI_COMM_WORLD,
- Triangulation<dim>::limit_level_difference_at_vertices,
- parallel::distributed::Triangulation<dim>::construct_multigrid_hierarchy),
- mapping(1),
- fe(fe),
- dof_handler(triangulation),
- estimates(1)
+ const FiniteElement<dim> &fe)
+ : triangulation(MPI_COMM_WORLD,
+ Triangulation<dim>::limit_level_difference_at_vertices,
+ parallel::distributed::Triangulation<
+ dim>::construct_multigrid_hierarchy)
+ , mapping(1)
+ , fe(fe)
+ , dof_handler(triangulation)
+ , estimates(1)
{
GridGenerator::hyper_L(triangulation, -1, 1);
}
DynamicSparsityPattern c_sparsity(dof_handler.n_dofs(),
dof_handler.n_dofs());
DoFTools::make_flux_sparsity_pattern(dof_handler, c_sparsity);
- matrix.reinit(
- dof_handler.locally_owned_dofs(), c_sparsity, MPI_COMM_WORLD, true);
+ matrix.reinit(dof_handler.locally_owned_dofs(),
+ c_sparsity,
+ MPI_COMM_WORLD,
+ true);
const unsigned int n_levels = triangulation.n_global_levels();
mg_matrix.resize(0, n_levels - 1);
DynamicSparsityPattern ci_sparsity;
ci_sparsity.reinit(dof_handler.n_dofs(level - 1),
dof_handler.n_dofs(level));
- MGTools::make_flux_sparsity_pattern_edge(
- dof_handler, ci_sparsity, level);
+ MGTools::make_flux_sparsity_pattern_edge(dof_handler,
+ ci_sparsity,
+ level);
mg_matrix_dg_up[level].reinit(
dof_handler.locally_owned_mg_dofs(level - 1),
l <= smoother_data.max_level();
++l)
{
- DoFTools::make_cell_patches(
- smoother_data[l].block_list, this->dof_handler, l);
+ DoFTools::make_cell_patches(smoother_data[l].block_list,
+ this->dof_handler,
+ l);
if (smoother_data[l].block_list.n_rows() > 0)
smoother_data[l].block_list.compress();
smoother_data[l].relaxation = 0.7;
smoother_data[l].inversion = PreconditionBlockBase<double>::svd;
TrilinosWrappers::MPI::Vector *ghost = &(temp_vectors[l]);
IndexSet relevant_dofs;
- DoFTools::extract_locally_relevant_level_dofs(
- dof_handler, l, relevant_dofs);
- ghost->reinit(
- dof_handler.locally_owned_mg_dofs(l), relevant_dofs, MPI_COMM_WORLD);
+ DoFTools::extract_locally_relevant_level_dofs(dof_handler,
+ l,
+ relevant_dofs);
+ ghost->reinit(dof_handler.locally_owned_mg_dofs(l),
+ relevant_dofs,
+ MPI_COMM_WORLD);
smoother_data[l].temp_ghost_vector = ghost;
}
MeshWorker::IntegrationInfoBox<dim> info_box;
const unsigned int n_gauss_points =
dof_handler.get_fe().tensor_degree() + 1;
- info_box.initialize_gauss_quadrature(
- n_gauss_points, n_gauss_points + 1, n_gauss_points);
+ info_box.initialize_gauss_quadrature(n_gauss_points,
+ n_gauss_points + 1,
+ n_gauss_points);
AnyData solution_data;
solution_data.add<TrilinosWrappers::MPI::Vector *>(&ghost, "solution");
else
{
parallel::distributed::GridRefinement::
- refine_and_coarsen_fixed_fraction(
- triangulation, estimates.block(0), 0.5, 0.0);
+ refine_and_coarsen_fixed_fraction(triangulation,
+ estimates.block(0),
+ 0.5,
+ 0.0);
triangulation.execute_coarsening_and_refinement();
}
template <int dim>
InteriorPenaltyProblem<dim>::InteriorPenaltyProblem(
- const FiniteElement<dim> &fe) :
- triangulation(
- MPI_COMM_WORLD,
- Triangulation<dim>::limit_level_difference_at_vertices,
- parallel::distributed::Triangulation<dim>::construct_multigrid_hierarchy),
- mapping(1),
- fe(fe),
- dof_handler(triangulation),
- estimates(1)
+ const FiniteElement<dim> &fe)
+ : triangulation(MPI_COMM_WORLD,
+ Triangulation<dim>::limit_level_difference_at_vertices,
+ parallel::distributed::Triangulation<
+ dim>::construct_multigrid_hierarchy)
+ , mapping(1)
+ , fe(fe)
+ , dof_handler(triangulation)
+ , estimates(1)
{
GridGenerator::hyper_L(triangulation, -1, 1);
}
DynamicSparsityPattern c_sparsity(dof_handler.n_dofs(),
dof_handler.n_dofs());
DoFTools::make_flux_sparsity_pattern(dof_handler, c_sparsity);
- matrix.reinit(
- dof_handler.locally_owned_dofs(), c_sparsity, MPI_COMM_WORLD, true);
+ matrix.reinit(dof_handler.locally_owned_dofs(),
+ c_sparsity,
+ MPI_COMM_WORLD,
+ true);
const unsigned int n_levels = triangulation.n_global_levels();
mg_matrix.resize(0, n_levels - 1);
DynamicSparsityPattern ci_sparsity;
ci_sparsity.reinit(dof_handler.n_dofs(level - 1),
dof_handler.n_dofs(level));
- MGTools::make_flux_sparsity_pattern_edge(
- dof_handler, ci_sparsity, level);
+ MGTools::make_flux_sparsity_pattern_edge(dof_handler,
+ ci_sparsity,
+ level);
mg_matrix_dg_up[level].reinit(
dof_handler.locally_owned_mg_dofs(level - 1),
MeshWorker::IntegrationInfoBox<dim> info_box;
const unsigned int n_gauss_points =
dof_handler.get_fe().tensor_degree() + 1;
- info_box.initialize_gauss_quadrature(
- n_gauss_points, n_gauss_points + 1, n_gauss_points);
+ info_box.initialize_gauss_quadrature(n_gauss_points,
+ n_gauss_points + 1,
+ n_gauss_points);
AnyData solution_data;
solution_data.add<TrilinosWrappers::MPI::Vector *>(&ghost, "solution");
else
{
parallel::distributed::GridRefinement::
- refine_and_coarsen_fixed_fraction(
- triangulation, estimates.block(0), 0.5, 0.0);
+ refine_and_coarsen_fixed_fraction(triangulation,
+ estimates.block(0),
+ 0.5,
+ 0.0);
triangulation.execute_coarsening_and_refinement();
}
template <int dim>
- LaplaceProblem<dim>::LaplaceProblem() :
- mpi_communicator(MPI_COMM_WORLD),
- triangulation(mpi_communicator,
- typename Triangulation<dim>::MeshSmoothing(
- Triangulation<dim>::smoothing_on_refinement |
- Triangulation<dim>::smoothing_on_coarsening)),
- dof_handler(triangulation),
- fe(2),
- pcout(Utilities::MPI::this_mpi_process(mpi_communicator) == 0 ?
- deallog.get_file_stream() :
- std::cout,
- (Utilities::MPI::this_mpi_process(mpi_communicator) == 0))
+ LaplaceProblem<dim>::LaplaceProblem()
+ : mpi_communicator(MPI_COMM_WORLD)
+ , triangulation(mpi_communicator,
+ typename Triangulation<dim>::MeshSmoothing(
+ Triangulation<dim>::smoothing_on_refinement |
+ Triangulation<dim>::smoothing_on_coarsening))
+ , dof_handler(triangulation)
+ , fe(2)
+ , pcout(Utilities::MPI::this_mpi_process(mpi_communicator) == 0 ?
+ deallog.get_file_stream() :
+ std::cout,
+ (Utilities::MPI::this_mpi_process(mpi_communicator) == 0))
{}
locally_owned_dofs = dof_handler.locally_owned_dofs();
DoFTools::extract_locally_relevant_dofs(dof_handler, locally_relevant_dofs);
- locally_relevant_solution.reinit(
- locally_owned_dofs, locally_relevant_dofs, mpi_communicator);
+ locally_relevant_solution.reinit(locally_owned_dofs,
+ locally_relevant_dofs,
+ mpi_communicator);
system_rhs.reinit(locally_owned_dofs, mpi_communicator);
system_rhs = PetscScalar();
constraints.clear();
constraints.reinit(locally_relevant_dofs);
DoFTools::make_hanging_node_constraints(dof_handler, constraints);
- VectorTools::interpolate_boundary_values(
- dof_handler, 0, Functions::ZeroFunction<dim>(), constraints);
+ VectorTools::interpolate_boundary_values(dof_handler,
+ 0,
+ Functions::ZeroFunction<dim>(),
+ constraints);
constraints.close();
- DynamicSparsityPattern csp(
- dof_handler.n_dofs(), dof_handler.n_dofs(), locally_relevant_dofs);
+ DynamicSparsityPattern csp(dof_handler.n_dofs(),
+ dof_handler.n_dofs(),
+ locally_relevant_dofs);
DoFTools::make_sparsity_pattern(dof_handler, csp, constraints, false);
SparsityTools::distribute_sparsity_pattern(
csp,
10,
10);
#else
- check_solver_within_range(
- solver.solve(system_matrix,
- completely_distributed_solution,
- system_rhs,
- PETScWrappers::PreconditionJacobi(system_matrix)),
- solver_control.last_step(),
- 120,
- 260);
+ check_solver_within_range(solver.solve(system_matrix,
+ completely_distributed_solution,
+ system_rhs,
+ PETScWrappers::PreconditionJacobi(
+ system_matrix)),
+ solver_control.last_step(),
+ 120,
+ 260);
#endif
pcout << " Solved in " << solver_control.last_step() << " iterations."
template <int dim>
- LaplaceProblem<dim>::LaplaceProblem() :
- mpi_communicator(MPI_COMM_WORLD),
- triangulation(mpi_communicator,
- typename Triangulation<dim>::MeshSmoothing(
- Triangulation<dim>::smoothing_on_refinement |
- Triangulation<dim>::smoothing_on_coarsening)),
- dof_handler(triangulation),
- fe(2),
- pcout(Utilities::MPI::this_mpi_process(mpi_communicator) == 0 ?
- deallog.get_file_stream() :
- std::cout,
- (Utilities::MPI::this_mpi_process(mpi_communicator) == 0))
+ LaplaceProblem<dim>::LaplaceProblem()
+ : mpi_communicator(MPI_COMM_WORLD)
+ , triangulation(mpi_communicator,
+ typename Triangulation<dim>::MeshSmoothing(
+ Triangulation<dim>::smoothing_on_refinement |
+ Triangulation<dim>::smoothing_on_coarsening))
+ , dof_handler(triangulation)
+ , fe(2)
+ , pcout(Utilities::MPI::this_mpi_process(mpi_communicator) == 0 ?
+ deallog.get_file_stream() :
+ std::cout,
+ (Utilities::MPI::this_mpi_process(mpi_communicator) == 0))
{}
const QGauss<dim - 1> face_quadrature_formula(fe.degree + 1);
- FEFaceValues<dim> fe_face_values(
- fe,
- face_quadrature_formula,
- update_values | update_quadrature_points | update_normal_vectors |
- update_JxW_values);
+ FEFaceValues<dim> fe_face_values(fe,
+ face_quadrature_formula,
+ update_values |
+ update_quadrature_points |
+ update_normal_vectors |
+ update_JxW_values);
Tensor<1, dim> u;
Point<dim> down{0, -1};
locally_relevant_dofs);
}
- locally_relevant_solution.reinit(
- locally_owned_dofs, locally_relevant_dofs, mpi_communicator);
+ locally_relevant_solution.reinit(locally_owned_dofs,
+ locally_relevant_dofs,
+ mpi_communicator);
system_rhs.reinit(locally_owned_dofs, mpi_communicator);
system_rhs = PetscScalar();
constraints.clear();
constraints.reinit(locally_relevant_dofs);
DoFTools::make_hanging_node_constraints(dof_handler, constraints);
- VectorTools::interpolate_boundary_values(
- dof_handler, 0, Functions::ZeroFunction<dim>(), constraints);
+ VectorTools::interpolate_boundary_values(dof_handler,
+ 0,
+ Functions::ZeroFunction<dim>(),
+ constraints);
constraints.close();
- DynamicSparsityPattern csp(
- dof_handler.n_dofs(), dof_handler.n_dofs(), locally_relevant_dofs);
+ DynamicSparsityPattern csp(dof_handler.n_dofs(),
+ dof_handler.n_dofs(),
+ locally_relevant_dofs);
DoFTools::make_sparsity_pattern(dof_handler, csp, constraints, false);
SparsityTools::distribute_sparsity_pattern(
csp,
11,
11);
#else
- check_solver_within_range(
- solver.solve(system_matrix,
- completely_distributed_solution,
- system_rhs,
- PETScWrappers::PreconditionJacobi(system_matrix)),
- solver_control.last_step(),
- 120,
- 260);
+ check_solver_within_range(solver.solve(system_matrix,
+ completely_distributed_solution,
+ system_rhs,
+ PETScWrappers::PreconditionJacobi(
+ system_matrix)),
+ solver_control.last_step(),
+ 120,
+ 260);
#endif
pcout << " Solved in " << solver_control.last_step() << " iterations."
template <int dim>
- LaplaceProblem<dim>::LaplaceProblem(MPI_Comm comm) :
- mpi_communicator(comm),
- triangulation(mpi_communicator,
- typename Triangulation<dim>::MeshSmoothing(
- Triangulation<dim>::smoothing_on_refinement |
- Triangulation<dim>::smoothing_on_coarsening)),
- dof_handler(triangulation),
- fe(2),
- pcout(Utilities::MPI::this_mpi_process(mpi_communicator) == 0 ?
- deallog.get_file_stream() :
- std::cout,
- (Utilities::MPI::this_mpi_process(mpi_communicator) == 0))
+ LaplaceProblem<dim>::LaplaceProblem(MPI_Comm comm)
+ : mpi_communicator(comm)
+ , triangulation(mpi_communicator,
+ typename Triangulation<dim>::MeshSmoothing(
+ Triangulation<dim>::smoothing_on_refinement |
+ Triangulation<dim>::smoothing_on_coarsening))
+ , dof_handler(triangulation)
+ , fe(2)
+ , pcout(Utilities::MPI::this_mpi_process(mpi_communicator) == 0 ?
+ deallog.get_file_stream() :
+ std::cout,
+ (Utilities::MPI::this_mpi_process(mpi_communicator) == 0))
{}
const QGauss<dim - 1> face_quadrature_formula(fe.degree + 1);
- FEFaceValues<dim> fe_face_values(
- fe,
- face_quadrature_formula,
- update_values | update_quadrature_points | update_normal_vectors |
- update_JxW_values);
+ FEFaceValues<dim> fe_face_values(fe,
+ face_quadrature_formula,
+ update_values |
+ update_quadrature_points |
+ update_normal_vectors |
+ update_JxW_values);
Tensor<1, dim> u;
Point<dim> down{0, -1};
locally_relevant_dofs);
}
- locally_relevant_solution.reinit(
- locally_owned_dofs, locally_relevant_dofs, mpi_communicator);
+ locally_relevant_solution.reinit(locally_owned_dofs,
+ locally_relevant_dofs,
+ mpi_communicator);
system_rhs.reinit(locally_owned_dofs, mpi_communicator);
system_rhs = PetscScalar();
constraints.clear();
constraints.reinit(locally_relevant_dofs);
DoFTools::make_hanging_node_constraints(dof_handler, constraints);
- VectorTools::interpolate_boundary_values(
- dof_handler, 0, Functions::ZeroFunction<dim>(), constraints);
+ VectorTools::interpolate_boundary_values(dof_handler,
+ 0,
+ Functions::ZeroFunction<dim>(),
+ constraints);
constraints.close();
- DynamicSparsityPattern csp(
- dof_handler.n_dofs(), dof_handler.n_dofs(), locally_relevant_dofs);
+ DynamicSparsityPattern csp(dof_handler.n_dofs(),
+ dof_handler.n_dofs(),
+ locally_relevant_dofs);
DoFTools::make_sparsity_pattern(dof_handler, csp, constraints, false);
SparsityTools::distribute_sparsity_pattern(
csp,
11,
11);
#else
- check_solver_within_range(
- solver.solve(system_matrix,
- completely_distributed_solution,
- system_rhs,
- PETScWrappers::PreconditionJacobi(system_matrix)),
- solver_control.last_step(),
- 120,
- 260);
+ check_solver_within_range(solver.solve(system_matrix,
+ completely_distributed_solution,
+ system_rhs,
+ PETScWrappers::PreconditionJacobi(
+ system_matrix)),
+ solver_control.last_step(),
+ 120,
+ 260);
#endif
pcout << " Solved in " << solver_control.last_step() << " iterations."
template <int dim>
- LaplaceProblem<dim>::LaplaceProblem() :
- mpi_communicator(MPI_COMM_WORLD),
- triangulation(mpi_communicator,
- typename Triangulation<dim>::MeshSmoothing(
- Triangulation<dim>::smoothing_on_refinement |
- Triangulation<dim>::smoothing_on_coarsening)),
- dof_handler(triangulation),
- fe(2),
- pcout(Utilities::MPI::this_mpi_process(mpi_communicator) == 0 ?
- deallog.get_file_stream() :
- std::cout,
- (Utilities::MPI::this_mpi_process(mpi_communicator) == 0))
+ LaplaceProblem<dim>::LaplaceProblem()
+ : mpi_communicator(MPI_COMM_WORLD)
+ , triangulation(mpi_communicator,
+ typename Triangulation<dim>::MeshSmoothing(
+ Triangulation<dim>::smoothing_on_refinement |
+ Triangulation<dim>::smoothing_on_coarsening))
+ , dof_handler(triangulation)
+ , fe(2)
+ , pcout(Utilities::MPI::this_mpi_process(mpi_communicator) == 0 ?
+ deallog.get_file_stream() :
+ std::cout,
+ (Utilities::MPI::this_mpi_process(mpi_communicator) == 0))
{}
locally_owned_dofs = dof_handler.locally_owned_dofs();
DoFTools::extract_locally_relevant_dofs(dof_handler, locally_relevant_dofs);
- locally_relevant_solution.reinit(
- locally_owned_dofs, locally_relevant_dofs, mpi_communicator);
+ locally_relevant_solution.reinit(locally_owned_dofs,
+ locally_relevant_dofs,
+ mpi_communicator);
system_rhs.reinit(locally_owned_dofs, mpi_communicator);
system_rhs = PetscScalar();
constraints.clear();
constraints.reinit(locally_relevant_dofs);
DoFTools::make_hanging_node_constraints(dof_handler, constraints);
- VectorTools::interpolate_boundary_values(
- dof_handler, 0, Functions::ZeroFunction<dim>(), constraints);
+ VectorTools::interpolate_boundary_values(dof_handler,
+ 0,
+ Functions::ZeroFunction<dim>(),
+ constraints);
constraints.close();
- DynamicSparsityPattern csp(
- dof_handler.n_dofs(), dof_handler.n_dofs(), locally_relevant_dofs);
+ DynamicSparsityPattern csp(dof_handler.n_dofs(),
+ dof_handler.n_dofs(),
+ locally_relevant_dofs);
DoFTools::make_sparsity_pattern(dof_handler, csp, constraints, false);
SparsityTools::distribute_sparsity_pattern(
csp,
class SignalListener
{
public:
- SignalListener(Triangulation<dim, spacedim> &tria_in) :
- n_active_cells(tria_in.n_active_cells()),
- tria(tria_in)
+ SignalListener(Triangulation<dim, spacedim> &tria_in)
+ : n_active_cells(tria_in.n_active_cells())
+ , tria(tria_in)
{
tria_in.signals.post_refinement_on_cell.connect(
std::bind(&SignalListener<dim, spacedim>::count_on_refine,
class SignalListener
{
public:
- SignalListener(Triangulation<dim, spacedim> &tria_in) :
- n_active_cells(tria_in.n_active_cells()),
- tria(tria_in)
+ SignalListener(Triangulation<dim, spacedim> &tria_in)
+ : n_active_cells(tria_in.n_active_cells())
+ , tria(tria_in)
{
tria_in.signals.post_refinement_on_cell.connect(
std::bind(&SignalListener<dim, spacedim>::count_on_refine,
class SignalListener
{
public:
- SignalListener(Triangulation<dim, spacedim> &tria_in) :
- n_active_cells(tria_in.n_active_cells()),
- tria(tria_in)
+ SignalListener(Triangulation<dim, spacedim> &tria_in)
+ : n_active_cells(tria_in.n_active_cells())
+ , tria(tria_in)
{
tria_in.signals.post_refinement_on_cell.connect(
std::bind(&SignalListener<dim, spacedim>::count_on_refine,
class SignalListener
{
public:
- SignalListener(Triangulation<dim, spacedim> &tria_in) :
- n_active_cells(tria_in.n_active_cells()),
- tria(tria_in)
+ SignalListener(Triangulation<dim, spacedim> &tria_in)
+ : n_active_cells(tria_in.n_active_cells())
+ , tria(tria_in)
{
tria_in.signals.post_refinement_on_cell.connect(
std::bind(&SignalListener<dim, spacedim>::count_on_refine,
class SignalListener
{
public:
- SignalListener(Triangulation<dim, spacedim> &tria_in) :
- n_active_cells(tria_in.n_active_cells()),
- tria(tria_in)
+ SignalListener(Triangulation<dim, spacedim> &tria_in)
+ : n_active_cells(tria_in.n_active_cells())
+ , tria(tria_in)
{
// tria_in.signals.post_refinement_on_cell.connect
// (std::bind (&SignalListener<dim, spacedim>::count_on_refine,
else
Assert(false, ExcNotImplemented());
- TrilinosWrappers::SparsityPattern sp(
- row_partitioning, col_partitioning, MPI_COMM_WORLD);
+ TrilinosWrappers::SparsityPattern sp(row_partitioning,
+ col_partitioning,
+ MPI_COMM_WORLD);
if (my_id == 0)
{
sp.add(0, 0);
x.reinit(col_partitioning, MPI_COMM_WORLD);
y.reinit(row_partitioning, MPI_COMM_WORLD);
- LinearAlgebra::distributed::Vector<double> dx(
- col_partitioning, col_partitioning, MPI_COMM_WORLD),
+ LinearAlgebra::distributed::Vector<double> dx(col_partitioning,
+ col_partitioning,
+ MPI_COMM_WORLD),
dy(row_partitioning, row_partitioning, MPI_COMM_WORLD);
for (unsigned int i = 0; i < col_partitioning.n_elements(); ++i)
else
Assert(false, ExcNotImplemented());
- TrilinosWrappers::SparsityPattern sp(
- row_partitioning, col_partitioning, MPI_COMM_WORLD);
+ TrilinosWrappers::SparsityPattern sp(row_partitioning,
+ col_partitioning,
+ MPI_COMM_WORLD);
if (my_id == 0)
{
sp.add(0, 0);
x.reinit(col_partitioning, MPI_COMM_WORLD);
y.reinit(row_partitioning, MPI_COMM_WORLD);
- LinearAlgebra::distributed::Vector<double> dx(
- col_partitioning, col_partitioning, MPI_COMM_WORLD),
+ LinearAlgebra::distributed::Vector<double> dx(col_partitioning,
+ col_partitioning,
+ MPI_COMM_WORLD),
dy(row_partitioning, row_partitioning, MPI_COMM_WORLD);
for (unsigned int i = 0; i < row_partitioning.n_elements(); ++i)
else
Assert(false, ExcNotImplemented());
- TrilinosWrappers::SparsityPattern sp(
- row_partitioning, col_partitioning, MPI_COMM_WORLD);
+ TrilinosWrappers::SparsityPattern sp(row_partitioning,
+ col_partitioning,
+ MPI_COMM_WORLD);
if (my_id == 0)
{
sp.add(0, 0);
x.reinit(col_partitioning, MPI_COMM_WORLD);
y.reinit(row_partitioning, MPI_COMM_WORLD);
- LinearAlgebra::distributed::Vector<double> dx(
- col_partitioning, col_partitioning, MPI_COMM_WORLD),
+ LinearAlgebra::distributed::Vector<double> dx(col_partitioning,
+ col_partitioning,
+ MPI_COMM_WORLD),
dy(row_partitioning, row_partitioning, MPI_COMM_WORLD);
for (unsigned int i = 0; i < col_partitioning.n_elements(); ++i)
else
Assert(false, ExcNotImplemented());
- TrilinosWrappers::SparsityPattern sp(
- row_partitioning, col_partitioning, MPI_COMM_WORLD);
+ TrilinosWrappers::SparsityPattern sp(row_partitioning,
+ col_partitioning,
+ MPI_COMM_WORLD);
if (my_id == 0)
{
sp.add(0, 0);
else
Assert(false, ExcNotImplemented());
- TrilinosWrappers::SparsityPattern sp(
- locally_owned, locally_owned, MPI_COMM_WORLD);
+ TrilinosWrappers::SparsityPattern sp(locally_owned,
+ locally_owned,
+ MPI_COMM_WORLD);
if (my_id == 0)
{
sp.add(0, 0);
else
Assert(false, ExcNotImplemented());
- TrilinosWrappers::SparsityPattern sp(
- row_partitioning, col_partitioning, MPI_COMM_WORLD);
+ TrilinosWrappers::SparsityPattern sp(row_partitioning,
+ col_partitioning,
+ MPI_COMM_WORLD);
if (my_id == 0)
{
sp.add(0, 0);
else
Assert(false, ExcNotImplemented());
- TrilinosWrappers::SparsityPattern sp(
- row_partitioning, col_partitioning, MPI_COMM_WORLD);
+ TrilinosWrappers::SparsityPattern sp(row_partitioning,
+ col_partitioning,
+ MPI_COMM_WORLD);
if (my_id == 0)
{
sp.add(0, 0);
else
Assert(false, ExcNotImplemented());
- TrilinosWrappers::SparsityPattern sp(
- row_partitioning, col_partitioning, MPI_COMM_WORLD);
+ TrilinosWrappers::SparsityPattern sp(row_partitioning,
+ col_partitioning,
+ MPI_COMM_WORLD);
if (my_id == 0)
{
sp.add(0, 0);
const unsigned int local_index[n_entries] = {1, 1};
const double local_value[n_entries] = {1.0, 1.0};
- TrilinosWrappers::SparsityPattern sp(
- row_partitioning, col_partitioning, MPI_COMM_WORLD);
+ TrilinosWrappers::SparsityPattern sp(row_partitioning,
+ col_partitioning,
+ MPI_COMM_WORLD);
for (unsigned int i = 0; i < n_entries; ++i)
if (row_partitioning.is_element(line[i]))
sp.add(line[i], local_index[i]);
else
Assert(false, ExcNotImplemented());
- TrilinosWrappers::SparsityPattern sp(
- row_partitioning, col_partitioning, MPI_COMM_WORLD);
+ TrilinosWrappers::SparsityPattern sp(row_partitioning,
+ col_partitioning,
+ MPI_COMM_WORLD);
if ((n_procs == 1) || (my_id == 1))
sp.add(2, 3);
sp.compress();
boundary_indicators.insert(0);
mg_constrained_dofs.initialize(dofh);
- mg_constrained_dofs.make_zero_boundary_constraints(
- dofh, boundary_indicators, component_mask);
+ mg_constrained_dofs.make_zero_boundary_constraints(dofh,
+ boundary_indicators,
+ component_mask);
const unsigned int n_levels = tr.n_global_levels();
for (unsigned int level = 0; level < n_levels; ++level)
template <int dim>
- LaplaceProblem<dim>::LaplaceProblem(const unsigned int degree) :
- triangulation(
- MPI_COMM_WORLD,
- Triangulation<dim>::limit_level_difference_at_vertices,
- parallel::distributed::Triangulation<dim>::construct_multigrid_hierarchy),
- fe(degree),
- mg_dof_handler(triangulation),
- degree(degree)
+ LaplaceProblem<dim>::LaplaceProblem(const unsigned int degree)
+ : triangulation(MPI_COMM_WORLD,
+ Triangulation<dim>::limit_level_difference_at_vertices,
+ parallel::distributed::Triangulation<
+ dim>::construct_multigrid_hierarchy)
+ , fe(degree)
+ , mg_dof_handler(triangulation)
+ , degree(degree)
{}
typename FunctionMap<dim>::type dirichlet_boundary;
Functions::ConstantFunction<dim> homogeneous_dirichlet_bc(0.0);
dirichlet_boundary[0] = &homogeneous_dirichlet_bc;
- VectorTools::interpolate_boundary_values(
- mg_dof_handler, dirichlet_boundary, constraints);
+ VectorTools::interpolate_boundary_values(mg_dof_handler,
+ dirichlet_boundary,
+ constraints);
constraints.close();
DynamicSparsityPattern dsp(mg_dof_handler.n_dofs(),
mg_dof_handler.n_dofs());
DoFTools::make_sparsity_pattern(mg_dof_handler, dsp, constraints);
- system_matrix.reinit(
- mg_dof_handler.locally_owned_dofs(), dsp, MPI_COMM_WORLD, true);
+ system_matrix.reinit(mg_dof_handler.locally_owned_dofs(),
+ dsp,
+ MPI_COMM_WORLD,
+ true);
mg_constrained_dofs.clear();
++level)
{
IndexSet dofset;
- DoFTools::extract_locally_relevant_level_dofs(
- mg_dof_handler, level, dofset);
+ DoFTools::extract_locally_relevant_level_dofs(mg_dof_handler,
+ level,
+ dofset);
boundary_constraints[level].reinit(dofset);
boundary_constraints[level].add_lines(
mg_constrained_dofs.get_refinement_edge_indices(level));
class MGCoarseAMG : public MGCoarseGridBase<VECTOR>
{
public:
- MGCoarseAMG(
- const LA::MPI::SparseMatrix & coarse_matrix,
- const LA::MPI::PreconditionAMG::AdditionalData additional_data) :
- count(0)
+ MGCoarseAMG(const LA::MPI::SparseMatrix & coarse_matrix,
+ const LA::MPI::PreconditionAMG::AdditionalData additional_data)
+ : count(0)
{
precondition_amg.initialize(coarse_matrix, additional_data);
}
temp_solution.reinit(locally_relevant_set, MPI_COMM_WORLD);
temp_solution = solution;
- KellyErrorEstimator<dim>::estimate(
- static_cast<DoFHandler<dim> &>(mg_dof_handler),
- QGauss<dim - 1>(degree + 1),
- typename FunctionMap<dim>::type(),
- temp_solution,
- estimated_error_per_cell);
+ KellyErrorEstimator<dim>::estimate(static_cast<DoFHandler<dim> &>(
+ mg_dof_handler),
+ QGauss<dim - 1>(degree + 1),
+ typename FunctionMap<dim>::type(),
+ temp_solution,
+ estimated_error_per_cell);
parallel::distributed::GridRefinement::refine_and_coarsen_fixed_fraction(
triangulation, estimated_error_per_cell, 0.3, 0.0);
Functions::ConstantFunction<dim> homogeneous_dirichlet_bc(0.0);
dirichlet_boundary_ids.insert(0);
dirichlet_boundary[0] = &homogeneous_dirichlet_bc;
- VectorTools::interpolate_boundary_values(
- mg_dof_handler, dirichlet_boundary, constraints);
+ VectorTools::interpolate_boundary_values(mg_dof_handler,
+ dirichlet_boundary,
+ constraints);
constraints.close();
mg_constrained_dofs.clear();
{
DynamicSparsityPattern dsp(mg_dof_handler.n_dofs(level),
mg_dof_handler.n_dofs(level));
- MGTools::make_interface_sparsity_pattern(
- mg_dof_handler, mg_constrained_dofs, dsp, level);
+ MGTools::make_interface_sparsity_pattern(mg_dof_handler,
+ mg_constrained_dofs,
+ dsp,
+ level);
dsp.print(deallog.get_file_stream());
}
}
class Coefficient : public Function<dim>
{
public:
- Coefficient(int K) : Function<dim>(), K(K)
+ Coefficient(int K)
+ : Function<dim>()
+ , K(K)
{}
virtual double
template <int dim>
- LaplaceProblem<dim>::LaplaceProblem(const unsigned int degree) :
- triangulation(
- MPI_COMM_WORLD,
- Triangulation<dim>::limit_level_difference_at_vertices,
- parallel::distributed::Triangulation<dim>::construct_multigrid_hierarchy),
- fe(degree),
- mg_dof_handler(triangulation),
- degree(degree),
- K(3)
+ LaplaceProblem<dim>::LaplaceProblem(const unsigned int degree)
+ : triangulation(MPI_COMM_WORLD,
+ Triangulation<dim>::limit_level_difference_at_vertices,
+ parallel::distributed::Triangulation<
+ dim>::construct_multigrid_hierarchy)
+ , fe(degree)
+ , mg_dof_handler(triangulation)
+ , degree(degree)
+ , K(3)
{}
typename FunctionMap<dim>::type dirichlet_boundary;
Functions::ConstantFunction<dim> homogeneous_dirichlet_bc(0.0);
dirichlet_boundary[0] = &homogeneous_dirichlet_bc;
- VectorTools::interpolate_boundary_values(
- mg_dof_handler, dirichlet_boundary, constraints);
+ VectorTools::interpolate_boundary_values(mg_dof_handler,
+ dirichlet_boundary,
+ constraints);
constraints.close();
DynamicSparsityPattern dsp(mg_dof_handler.n_dofs(),
mg_dof_handler.n_dofs());
DoFTools::make_sparsity_pattern(mg_dof_handler, dsp, constraints);
- system_matrix.reinit(
- mg_dof_handler.locally_owned_dofs(), dsp, MPI_COMM_WORLD, true);
+ system_matrix.reinit(mg_dof_handler.locally_owned_dofs(),
+ dsp,
+ MPI_COMM_WORLD,
+ true);
mg_constrained_dofs.clear();
++level)
{
IndexSet dofset;
- DoFTools::extract_locally_relevant_level_dofs(
- mg_dof_handler, level, dofset);
+ DoFTools::extract_locally_relevant_level_dofs(mg_dof_handler,
+ level,
+ dofset);
boundary_constraints[level].reinit(dofset);
boundary_constraints[level].add_lines(
mg_constrained_dofs.get_refinement_edge_indices(level));
class MGCoarseAMG : public MGCoarseGridBase<VECTOR>
{
public:
- MGCoarseAMG(
- const LA::MPI::SparseMatrix & coarse_matrix,
- const LA::MPI::PreconditionAMG::AdditionalData additional_data) :
- count(0)
+ MGCoarseAMG(const LA::MPI::SparseMatrix & coarse_matrix,
+ const LA::MPI::PreconditionAMG::AdditionalData additional_data)
+ : count(0)
{
precondition_amg.initialize(coarse_matrix, additional_data);
}
temp_solution.reinit(locally_relevant_set, MPI_COMM_WORLD);
temp_solution = solution;
- KellyErrorEstimator<dim>::estimate(
- static_cast<DoFHandler<dim> &>(mg_dof_handler),
- QGauss<dim - 1>(degree + 1),
- typename FunctionMap<dim>::type(),
- temp_solution,
- estimated_error_per_cell);
+ KellyErrorEstimator<dim>::estimate(static_cast<DoFHandler<dim> &>(
+ mg_dof_handler),
+ QGauss<dim - 1>(degree + 1),
+ typename FunctionMap<dim>::type(),
+ temp_solution,
+ estimated_error_per_cell);
parallel::distributed::GridRefinement::refine_and_coarsen_fixed_fraction(
triangulation, estimated_error_per_cell, 0.3, 0.0);
template <int dim>
-LaplaceProblem<dim>::LaplaceProblem(const unsigned int deg) :
- triangulation(Triangulation<dim>::limit_level_difference_at_vertices),
- fe(FE_Q<dim>(deg), 2, FE_Q<dim>(deg), 2),
- mg_dof_handler(triangulation),
- mg_dof_handler_renumbered(triangulation),
- degree(deg)
+LaplaceProblem<dim>::LaplaceProblem(const unsigned int deg)
+ : triangulation(Triangulation<dim>::limit_level_difference_at_vertices)
+ , fe(FE_Q<dim>(deg), 2, FE_Q<dim>(deg), 2)
+ , mg_dof_handler(triangulation)
+ , mg_dof_handler_renumbered(triangulation)
+ , degree(deg)
{}
// DoFRenumbering::Cuthill_McKee (dof);
for (unsigned int level = 0; level < nlevels; ++level)
{
- DoFRenumbering::component_wise(
- mg_dof_handler_renumbered, level, block_component);
+ DoFRenumbering::component_wise(mg_dof_handler_renumbered,
+ level,
+ block_component);
// DoFRenumbering::Cuthill_McKee (mg_dof_handler_renumbered, level);
}
mg_dof_handler_renumbered.n_dofs(level),
mg_dof_handler_renumbered.max_couplings_between_dofs());
MGTools::make_sparsity_pattern(mg_dof_handler, mg_sparsity[level], level);
- MGTools::make_sparsity_pattern(
- mg_dof_handler_renumbered, mg_sparsity_renumbered[level], level);
+ MGTools::make_sparsity_pattern(mg_dof_handler_renumbered,
+ mg_sparsity_renumbered[level],
+ level);
mg_sparsity[level].compress();
mg_sparsity_renumbered[level].compress();
mg_matrices[level].reinit(mg_sparsity[level]);
boundary_interface_dofs.push_back(tmp);
}
- MGTools::extract_inner_interface_dofs(
- mg_dof_handler_renumbered, interface_dofs, boundary_interface_dofs);
+ MGTools::extract_inner_interface_dofs(mg_dof_handler_renumbered,
+ interface_dofs,
+ boundary_interface_dofs);
deallog << "1. Test" << std::endl;
print(mg_dof_handler_renumbered, interface_dofs);
deallog << std::endl;
- MGTools::extract_inner_interface_dofs(
- mg_dof_handler, interface_dofs, boundary_interface_dofs);
+ MGTools::extract_inner_interface_dofs(mg_dof_handler,
+ interface_dofs,
+ boundary_interface_dofs);
deallog << "2. Test" << std::endl;
print(mg_dof_handler, interface_dofs);
preconditioner(mg_dof_handler, mg, mg_transfer);
PreconditionMG<dim, Vector<double>, MGTransferPrebuilt<Vector<double>>>
- preconditioner_renumbered(
- mg_dof_handler_renumbered, mg_renumbered, mg_transfer_renumbered);
+ preconditioner_renumbered(mg_dof_handler_renumbered,
+ mg_renumbered,
+ mg_transfer_renumbered);
Vector<double> test, dst, dst_renumbered;
test.reinit(mg_dof_handler.n_dofs());
template <int dim>
-LaplaceProblem<dim>::LaplaceProblem(const unsigned int deg) :
- triangulation(Triangulation<dim>::limit_level_difference_at_vertices),
- mapping(1),
- fe(FE_Q<dim>(deg), 3),
- mg_dof_handler_renumbered(triangulation),
- degree(deg)
+LaplaceProblem<dim>::LaplaceProblem(const unsigned int deg)
+ : triangulation(Triangulation<dim>::limit_level_difference_at_vertices)
+ , mapping(1)
+ , fe(FE_Q<dim>(deg), 3)
+ , mg_dof_handler_renumbered(triangulation)
+ , degree(deg)
{}
typename FunctionMap<dim>::type dirichlet_boundary;
Functions::ZeroFunction<dim> dirichlet_bc(fe.n_components());
dirichlet_boundary[0] = &dirichlet_bc;
- MGTools::make_boundary_list(
- mg_dof_handler_renumbered, dirichlet_boundary, boundary_indices_renumbered);
+ MGTools::make_boundary_list(mg_dof_handler_renumbered,
+ dirichlet_boundary,
+ boundary_indices_renumbered);
MGLevelObject<Vector<double>> u(0, triangulation.n_levels() - 1);
MGLevelObject<Vector<double>> d(0, triangulation.n_levels() - 1);
template <int dim>
-LaplaceProblem<dim>::LaplaceProblem(const unsigned int deg) :
- triangulation(Triangulation<dim>::limit_level_difference_at_vertices),
- mapping(1),
- fe(FE_Q<dim>(deg), 3),
- mg_dof_handler(triangulation),
- mg_dof_handler_renumbered(triangulation),
- degree(deg)
+LaplaceProblem<dim>::LaplaceProblem(const unsigned int deg)
+ : triangulation(Triangulation<dim>::limit_level_difference_at_vertices)
+ , mapping(1)
+ , fe(FE_Q<dim>(deg), 3)
+ , mg_dof_handler(triangulation)
+ , mg_dof_handler_renumbered(triangulation)
+ , degree(deg)
{}
//----------------------------------------------------------------------//
template <typename number>
-ScalingMatrix<number>::ScalingMatrix(number factor) : factor(factor)
+ScalingMatrix<number>::ScalingMatrix(number factor)
+ : factor(factor)
{}
template <int dim>
-LaplaceMatrix<dim>::LaplaceMatrix() :
- MeshWorker::LocalIntegrator<dim>(true, false, false)
+LaplaceMatrix<dim>::LaplaceMatrix()
+ : MeshWorker::LocalIntegrator<dim>(true, false, false)
{}
class Coefficient : public Function<dim>
{
public:
- Coefficient() : Function<dim>()
+ Coefficient()
+ : Function<dim>()
{}
virtual double
template <int dim>
-LaplaceProblem<dim>::LaplaceProblem(const unsigned int degree) :
- triangulation(Triangulation<dim>::limit_level_difference_at_vertices),
- fe(degree),
- mg_dof_handler(triangulation),
- degree(degree),
- matrix_integrator()
+LaplaceProblem<dim>::LaplaceProblem(const unsigned int degree)
+ : triangulation(Triangulation<dim>::limit_level_difference_at_vertices)
+ , fe(degree)
+ , mg_dof_handler(triangulation)
+ , degree(degree)
+ , matrix_integrator()
{}
Functions::ZeroFunction<dim> homogeneous_dirichlet_bc(1);
dirichlet_boundary[0] = &homogeneous_dirichlet_bc;
MappingQGeneric<dim> mapping(1);
- VectorTools::interpolate_boundary_values(
- mapping, mg_dof_handler, dirichlet_boundary, constraints);
+ VectorTools::interpolate_boundary_values(mapping,
+ mg_dof_handler,
+ dirichlet_boundary,
+ constraints);
constraints.close();
constraints.condense(sparsity_pattern);
sparsity_pattern.compress();
cell_matrix(i, j) = 0;
boundary_interface_constraints[cell->level()]
- .distribute_local_to_global(
- cell_matrix, local_dof_indices, mg_interface_in[cell->level()]);
+ .distribute_local_to_global(cell_matrix,
+ local_dof_indices,
+ mg_interface_in[cell->level()]);
}
}
}
class Coefficient : public Function<dim>
{
public:
- Coefficient() : Function<dim>()
+ Coefficient()
+ : Function<dim>()
{}
virtual double
template <int dim>
-LaplaceProblem<dim>::LaplaceProblem(const unsigned int degree) :
- triangulation(Triangulation<dim>::limit_level_difference_at_vertices),
- fe(degree),
- mg_dof_handler(triangulation),
- degree(degree),
- min_level(2)
+LaplaceProblem<dim>::LaplaceProblem(const unsigned int degree)
+ : triangulation(Triangulation<dim>::limit_level_difference_at_vertices)
+ , fe(degree)
+ , mg_dof_handler(triangulation)
+ , degree(degree)
+ , min_level(2)
{}
Functions::ZeroFunction<dim> homogeneous_dirichlet_bc(1);
dirichlet_boundary[0] = &homogeneous_dirichlet_bc;
MappingQGeneric<dim> mapping(1);
- VectorTools::interpolate_boundary_values(
- mapping, mg_dof_handler, dirichlet_boundary, constraints);
+ VectorTools::interpolate_boundary_values(mapping,
+ mg_dof_handler,
+ dirichlet_boundary,
+ constraints);
constraints.close();
constraints.condense(sparsity_pattern);
sparsity_pattern.compress();
!mg_constrained_dofs.is_boundary_index(
lvl,
local_dof_indices[j])) // ( !boundary(i) && !boundary(j) )
- || (mg_constrained_dofs.is_boundary_index(
- lvl, local_dof_indices[i]) &&
- local_dof_indices[i] ==
- local_dof_indices[j]) // ( boundary(i) && boundary(j) &&
- // i==j )
+ ||
+ (mg_constrained_dofs.is_boundary_index(lvl,
+ local_dof_indices[i]) &&
+ local_dof_indices[i] ==
+ local_dof_indices[j]) // ( boundary(i) && boundary(j) &&
+ // i==j )
))
{
// do nothing, so add entries to interface matrix
{
Vector<float> estimated_error_per_cell(triangulation.n_active_cells());
- KellyErrorEstimator<dim>::estimate(
- static_cast<DoFHandler<dim> &>(mg_dof_handler),
- QGauss<dim - 1>(3),
- typename FunctionMap<dim>::type(),
- solution,
- estimated_error_per_cell);
- GridRefinement::refine_and_coarsen_fixed_number(
- triangulation, estimated_error_per_cell, 0.3, 0.03);
+ KellyErrorEstimator<dim>::estimate(static_cast<DoFHandler<dim> &>(
+ mg_dof_handler),
+ QGauss<dim - 1>(3),
+ typename FunctionMap<dim>::type(),
+ solution,
+ estimated_error_per_cell);
+ GridRefinement::refine_and_coarsen_fixed_number(triangulation,
+ estimated_error_per_cell,
+ 0.3,
+ 0.03);
triangulation.execute_coarsening_and_refinement();
}
class Coefficient : public Function<dim>
{
public:
- Coefficient() : Function<dim>()
+ Coefficient()
+ : Function<dim>()
{}
virtual double
template <int dim>
-LaplaceProblem<dim>::LaplaceProblem(const unsigned int degree) :
- triangulation(Triangulation<dim>::limit_level_difference_at_vertices),
- fe(degree),
- mg_dof_handler(triangulation),
- degree(degree),
- min_level(2)
+LaplaceProblem<dim>::LaplaceProblem(const unsigned int degree)
+ : triangulation(Triangulation<dim>::limit_level_difference_at_vertices)
+ , fe(degree)
+ , mg_dof_handler(triangulation)
+ , degree(degree)
+ , min_level(2)
{}
Functions::ZeroFunction<dim> homogeneous_dirichlet_bc(1);
dirichlet_boundary[0] = &homogeneous_dirichlet_bc;
MappingQGeneric<dim> mapping(1);
- VectorTools::interpolate_boundary_values(
- mapping, mg_dof_handler, dirichlet_boundary, constraints);
+ VectorTools::interpolate_boundary_values(mapping,
+ mg_dof_handler,
+ dirichlet_boundary,
+ constraints);
constraints.close();
constraints.condense(sparsity_pattern);
sparsity_pattern.compress();
!mg_constrained_dofs.is_boundary_index(
lvl,
local_dof_indices[j])) // ( !boundary(i) && !boundary(j) )
- || (mg_constrained_dofs.is_boundary_index(
- lvl, local_dof_indices[i]) &&
- local_dof_indices[i] ==
- local_dof_indices[j]) // ( boundary(i) && boundary(j) &&
- // i==j )
+ ||
+ (mg_constrained_dofs.is_boundary_index(lvl,
+ local_dof_indices[i]) &&
+ local_dof_indices[i] ==
+ local_dof_indices[j]) // ( boundary(i) && boundary(j) &&
+ // i==j )
))
{
// do nothing, so add entries to interface matrix
{
Vector<float> estimated_error_per_cell(triangulation.n_active_cells());
- KellyErrorEstimator<dim>::estimate(
- static_cast<DoFHandler<dim> &>(mg_dof_handler),
- QGauss<dim - 1>(3),
- typename FunctionMap<dim>::type(),
- solution,
- estimated_error_per_cell);
- GridRefinement::refine_and_coarsen_fixed_number(
- triangulation, estimated_error_per_cell, 0.3, 0.03);
+ KellyErrorEstimator<dim>::estimate(static_cast<DoFHandler<dim> &>(
+ mg_dof_handler),
+ QGauss<dim - 1>(3),
+ typename FunctionMap<dim>::type(),
+ solution,
+ estimated_error_per_cell);
+ GridRefinement::refine_and_coarsen_fixed_number(triangulation,
+ estimated_error_per_cell,
+ 0.3,
+ 0.03);
triangulation.execute_coarsening_and_refinement();
}
class Coefficient : public Function<dim>
{
public:
- Coefficient() : Function<dim>()
+ Coefficient()
+ : Function<dim>()
{}
virtual double
template <int dim>
-LaplaceProblem<dim>::LaplaceProblem(const unsigned int degree) :
- triangulation(Triangulation<dim>::limit_level_difference_at_vertices),
- fe(degree),
- mg_dof_handler(triangulation),
- degree(degree),
- min_level(2)
+LaplaceProblem<dim>::LaplaceProblem(const unsigned int degree)
+ : triangulation(Triangulation<dim>::limit_level_difference_at_vertices)
+ , fe(degree)
+ , mg_dof_handler(triangulation)
+ , degree(degree)
+ , min_level(2)
{}
Functions::ZeroFunction<dim> homogeneous_dirichlet_bc(1);
dirichlet_boundary[0] = &homogeneous_dirichlet_bc;
MappingQGeneric<dim> mapping(1);
- VectorTools::interpolate_boundary_values(
- mapping, mg_dof_handler, dirichlet_boundary, constraints);
+ VectorTools::interpolate_boundary_values(mapping,
+ mg_dof_handler,
+ dirichlet_boundary,
+ constraints);
constraints.close();
hanging_node_constraints.close();
constraints.condense(sparsity_pattern);
!mg_constrained_dofs.is_boundary_index(
lvl,
local_dof_indices[j])) // ( !boundary(i) && !boundary(j) )
- || (mg_constrained_dofs.is_boundary_index(
- lvl, local_dof_indices[i]) &&
- local_dof_indices[i] ==
- local_dof_indices[j]) // ( boundary(i) && boundary(j) &&
- // i==j )
+ ||
+ (mg_constrained_dofs.is_boundary_index(lvl,
+ local_dof_indices[i]) &&
+ local_dof_indices[i] ==
+ local_dof_indices[j]) // ( boundary(i) && boundary(j) &&
+ // i==j )
))
{
// do nothing, so add entries to interface matrix
class Coefficient : public Function<dim>
{
public:
- Coefficient() : Function<dim>()
+ Coefficient()
+ : Function<dim>()
{}
virtual double
template <int dim>
-LaplaceProblem<dim>::LaplaceProblem(const unsigned int degree) :
- triangulation(Triangulation<dim>::limit_level_difference_at_vertices),
- fe(degree),
- mg_dof_handler(triangulation),
- degree(degree),
- min_level(2)
+LaplaceProblem<dim>::LaplaceProblem(const unsigned int degree)
+ : triangulation(Triangulation<dim>::limit_level_difference_at_vertices)
+ , fe(degree)
+ , mg_dof_handler(triangulation)
+ , degree(degree)
+ , min_level(2)
{}
Functions::ZeroFunction<dim> homogeneous_dirichlet_bc(1);
dirichlet_boundary[0] = &homogeneous_dirichlet_bc;
MappingQGeneric<dim> mapping(1);
- VectorTools::interpolate_boundary_values(
- mapping, mg_dof_handler, dirichlet_boundary, constraints);
+ VectorTools::interpolate_boundary_values(mapping,
+ mg_dof_handler,
+ dirichlet_boundary,
+ constraints);
constraints.close();
hanging_node_constraints.close();
constraints.condense(sparsity_pattern);
!mg_constrained_dofs.is_boundary_index(
lvl,
local_dof_indices[j])) // ( !boundary(i) && !boundary(j) )
- || (mg_constrained_dofs.is_boundary_index(
- lvl, local_dof_indices[i]) &&
- local_dof_indices[i] ==
- local_dof_indices[j]) // ( boundary(i) && boundary(j) &&
- // i==j )
+ ||
+ (mg_constrained_dofs.is_boundary_index(lvl,
+ local_dof_indices[i]) &&
+ local_dof_indices[i] ==
+ local_dof_indices[j]) // ( boundary(i) && boundary(j) &&
+ // i==j )
))
{
// do nothing, so add entries to interface matrix
class Coefficient : public Function<dim>
{
public:
- Coefficient() : Function<dim>()
+ Coefficient()
+ : Function<dim>()
{}
virtual double
template <int dim>
-LaplaceProblem<dim>::LaplaceProblem(const unsigned int degree) :
- triangulation(Triangulation<dim>::limit_level_difference_at_vertices),
- fe(degree),
- mg_dof_handler(triangulation),
- degree(degree)
+LaplaceProblem<dim>::LaplaceProblem(const unsigned int degree)
+ : triangulation(Triangulation<dim>::limit_level_difference_at_vertices)
+ , fe(degree)
+ , mg_dof_handler(triangulation)
+ , degree(degree)
{}
Functions::ZeroFunction<dim> homogeneous_dirichlet_bc(1);
dirichlet_boundary[0] = &homogeneous_dirichlet_bc;
MappingQGeneric<dim> mapping(1);
- VectorTools::interpolate_boundary_values(
- mapping, mg_dof_handler, dirichlet_boundary, constraints);
+ VectorTools::interpolate_boundary_values(mapping,
+ mg_dof_handler,
+ dirichlet_boundary,
+ constraints);
constraints.close();
constraints.condense(sparsity_pattern);
sparsity_pattern.compress();
!mg_constrained_dofs.is_boundary_index(
lvl,
local_dof_indices[j])) // ( !boundary(i) && !boundary(j) )
- || (mg_constrained_dofs.is_boundary_index(
- lvl, local_dof_indices[i]) &&
- local_dof_indices[i] ==
- local_dof_indices[j]) // ( boundary(i) && boundary(j) &&
- // i==j )
+ ||
+ (mg_constrained_dofs.is_boundary_index(lvl,
+ local_dof_indices[i]) &&
+ local_dof_indices[i] ==
+ local_dof_indices[j]) // ( boundary(i) && boundary(j) &&
+ // i==j )
))
{
// do nothing, so add entries to interface matrix
{
Vector<float> estimated_error_per_cell(triangulation.n_active_cells());
- KellyErrorEstimator<dim>::estimate(
- static_cast<DoFHandler<dim> &>(mg_dof_handler),
- QGauss<dim - 1>(3),
- typename FunctionMap<dim>::type(),
- solution,
- estimated_error_per_cell);
- GridRefinement::refine_and_coarsen_fixed_number(
- triangulation, estimated_error_per_cell, 0.3, 0.03);
+ KellyErrorEstimator<dim>::estimate(static_cast<DoFHandler<dim> &>(
+ mg_dof_handler),
+ QGauss<dim - 1>(3),
+ typename FunctionMap<dim>::type(),
+ solution,
+ estimated_error_per_cell);
+ GridRefinement::refine_and_coarsen_fixed_number(triangulation,
+ estimated_error_per_cell,
+ 0.3,
+ 0.03);
triangulation.execute_coarsening_and_refinement();
}
class Coefficient : public Function<dim>
{
public:
- Coefficient() : Function<dim>()
+ Coefficient()
+ : Function<dim>()
{}
virtual double
template <int dim>
- LaplaceProblem<dim>::LaplaceProblem(const unsigned int degree) :
- triangulation(
- MPI_COMM_WORLD,
- Triangulation<dim>::limit_level_difference_at_vertices,
- parallel::distributed::Triangulation<dim>::construct_multigrid_hierarchy),
- fe(degree),
- mg_dof_handler(triangulation),
- degree(degree)
+ LaplaceProblem<dim>::LaplaceProblem(const unsigned int degree)
+ : triangulation(MPI_COMM_WORLD,
+ Triangulation<dim>::limit_level_difference_at_vertices,
+ parallel::distributed::Triangulation<
+ dim>::construct_multigrid_hierarchy)
+ , fe(degree)
+ , mg_dof_handler(triangulation)
+ , degree(degree)
{}
typename FunctionMap<dim>::type dirichlet_boundary;
Functions::ZeroFunction<dim> homogeneous_dirichlet_bc;
dirichlet_boundary[0] = &homogeneous_dirichlet_bc;
- VectorTools::interpolate_boundary_values(
- mg_dof_handler, dirichlet_boundary, constraints);
+ VectorTools::interpolate_boundary_values(mg_dof_handler,
+ dirichlet_boundary,
+ constraints);
constraints.close();
DynamicSparsityPattern dsp(mg_dof_handler.n_dofs(),
mg_dof_handler.n_dofs());
DoFTools::make_sparsity_pattern(mg_dof_handler, dsp, constraints);
- system_matrix.reinit(
- mg_dof_handler.locally_owned_dofs(), dsp, MPI_COMM_WORLD, true);
+ system_matrix.reinit(mg_dof_handler.locally_owned_dofs(),
+ dsp,
+ MPI_COMM_WORLD,
+ true);
mg_constrained_dofs.clear();
++level)
{
IndexSet dofset;
- DoFTools::extract_locally_relevant_level_dofs(
- mg_dof_handler, level, dofset);
+ DoFTools::extract_locally_relevant_level_dofs(mg_dof_handler,
+ level,
+ dofset);
boundary_constraints[level].reinit(dofset);
boundary_constraints[level].add_lines(
mg_constrained_dofs.get_refinement_edge_indices(level));
temp_solution.reinit(locally_relevant_set, MPI_COMM_WORLD);
temp_solution = solution;
- KellyErrorEstimator<dim>::estimate(
- static_cast<DoFHandler<dim> &>(mg_dof_handler),
- QGauss<dim - 1>(degree + 1),
- typename FunctionMap<dim>::type(),
- temp_solution,
- estimated_error_per_cell);
+ KellyErrorEstimator<dim>::estimate(static_cast<DoFHandler<dim> &>(
+ mg_dof_handler),
+ QGauss<dim - 1>(degree + 1),
+ typename FunctionMap<dim>::type(),
+ temp_solution,
+ estimated_error_per_cell);
const double threshold =
0.6 * Utilities::MPI::max(estimated_error_per_cell.linfty_norm(),
class Coefficient : public Function<dim>
{
public:
- Coefficient() : Function<dim>()
+ Coefficient()
+ : Function<dim>()
{}
virtual double
template <int dim>
- LaplaceProblem<dim>::LaplaceProblem(const unsigned int degree) :
- triangulation(
- MPI_COMM_WORLD,
- Triangulation<dim>::limit_level_difference_at_vertices,
- parallel::distributed::Triangulation<dim>::construct_multigrid_hierarchy),
- fe(degree),
- mg_dof_handler(triangulation),
- degree(degree)
+ LaplaceProblem<dim>::LaplaceProblem(const unsigned int degree)
+ : triangulation(MPI_COMM_WORLD,
+ Triangulation<dim>::limit_level_difference_at_vertices,
+ parallel::distributed::Triangulation<
+ dim>::construct_multigrid_hierarchy)
+ , fe(degree)
+ , mg_dof_handler(triangulation)
+ , degree(degree)
{}
typename FunctionMap<dim>::type dirichlet_boundary;
Functions::ZeroFunction<dim> homogeneous_dirichlet_bc;
dirichlet_boundary[0] = &homogeneous_dirichlet_bc;
- VectorTools::interpolate_boundary_values(
- mg_dof_handler, dirichlet_boundary, constraints);
+ VectorTools::interpolate_boundary_values(mg_dof_handler,
+ dirichlet_boundary,
+ constraints);
constraints.close();
DynamicSparsityPattern dsp(mg_dof_handler.n_dofs(),
mg_dof_handler.n_dofs());
DoFTools::make_sparsity_pattern(mg_dof_handler, dsp, constraints);
- system_matrix.reinit(
- mg_dof_handler.locally_owned_dofs(), dsp, MPI_COMM_WORLD, true);
+ system_matrix.reinit(mg_dof_handler.locally_owned_dofs(),
+ dsp,
+ MPI_COMM_WORLD,
+ true);
mg_constrained_dofs.clear();
++level)
{
IndexSet dofset;
- DoFTools::extract_locally_relevant_level_dofs(
- mg_dof_handler, level, dofset);
+ DoFTools::extract_locally_relevant_level_dofs(mg_dof_handler,
+ level,
+ dofset);
boundary_constraints[level].reinit(dofset);
boundary_constraints[level].add_lines(
mg_constrained_dofs.get_refinement_edge_indices(level));
temp_solution.reinit(locally_relevant_set, MPI_COMM_WORLD);
temp_solution = solution;
- KellyErrorEstimator<dim>::estimate(
- static_cast<DoFHandler<dim> &>(mg_dof_handler),
- QGauss<dim - 1>(degree + 1),
- typename FunctionMap<dim>::type(),
- temp_solution,
- estimated_error_per_cell);
+ KellyErrorEstimator<dim>::estimate(static_cast<DoFHandler<dim> &>(
+ mg_dof_handler),
+ QGauss<dim - 1>(degree + 1),
+ typename FunctionMap<dim>::type(),
+ temp_solution,
+ estimated_error_per_cell);
const double threshold =
0.6 * Utilities::MPI::max(estimated_error_per_cell.linfty_norm(),
class Coefficient : public Function<dim>
{
public:
- Coefficient() : Function<dim>()
+ Coefficient()
+ : Function<dim>()
{}
virtual double
template <int dim>
- LaplaceProblem<dim>::LaplaceProblem(const unsigned int degree) :
- triangulation(
- MPI_COMM_WORLD,
- Triangulation<dim>::limit_level_difference_at_vertices,
- parallel::distributed::Triangulation<dim>::construct_multigrid_hierarchy),
- fe(degree),
- mg_dof_handler(triangulation),
- degree(degree)
+ LaplaceProblem<dim>::LaplaceProblem(const unsigned int degree)
+ : triangulation(MPI_COMM_WORLD,
+ Triangulation<dim>::limit_level_difference_at_vertices,
+ parallel::distributed::Triangulation<
+ dim>::construct_multigrid_hierarchy)
+ , fe(degree)
+ , mg_dof_handler(triangulation)
+ , degree(degree)
{}
typename FunctionMap<dim>::type dirichlet_boundary;
Functions::ZeroFunction<dim> homogeneous_dirichlet_bc;
dirichlet_boundary[0] = &homogeneous_dirichlet_bc;
- VectorTools::interpolate_boundary_values(
- mg_dof_handler, dirichlet_boundary, constraints);
+ VectorTools::interpolate_boundary_values(mg_dof_handler,
+ dirichlet_boundary,
+ constraints);
constraints.close();
DynamicSparsityPattern dsp(mg_dof_handler.n_dofs(),
mg_dof_handler.n_dofs());
DoFTools::make_sparsity_pattern(mg_dof_handler, dsp, constraints);
- system_matrix.reinit(
- mg_dof_handler.locally_owned_dofs(), dsp, MPI_COMM_WORLD, true);
+ system_matrix.reinit(mg_dof_handler.locally_owned_dofs(),
+ dsp,
+ MPI_COMM_WORLD,
+ true);
mg_constrained_dofs.clear();
++level)
{
IndexSet dofset;
- DoFTools::extract_locally_relevant_level_dofs(
- mg_dof_handler, level, dofset);
+ DoFTools::extract_locally_relevant_level_dofs(mg_dof_handler,
+ level,
+ dofset);
boundary_constraints[level].reinit(dofset);
boundary_constraints[level].add_lines(
mg_constrained_dofs.get_refinement_edge_indices(level));
temp_solution.reinit(locally_relevant_set, MPI_COMM_WORLD);
temp_solution = solution;
- KellyErrorEstimator<dim>::estimate(
- static_cast<DoFHandler<dim> &>(mg_dof_handler),
- QGauss<dim - 1>(degree + 1),
- typename FunctionMap<dim>::type(),
- temp_solution,
- estimated_error_per_cell);
+ KellyErrorEstimator<dim>::estimate(static_cast<DoFHandler<dim> &>(
+ mg_dof_handler),
+ QGauss<dim - 1>(degree + 1),
+ typename FunctionMap<dim>::type(),
+ temp_solution,
+ estimated_error_per_cell);
const double threshold =
0.6 * Utilities::MPI::max(estimated_error_per_cell.linfty_norm(),
class Coefficient : public Function<dim>
{
public:
- Coefficient() : Function<dim>()
+ Coefficient()
+ : Function<dim>()
{}
virtual double
template <int dim>
-LaplaceProblem<dim>::LaplaceProblem(const unsigned int degree) :
- triangulation(Triangulation<dim>::limit_level_difference_at_vertices),
- fe(degree),
- mg_dof_handler(triangulation),
- degree(degree)
+LaplaceProblem<dim>::LaplaceProblem(const unsigned int degree)
+ : triangulation(Triangulation<dim>::limit_level_difference_at_vertices)
+ , fe(degree)
+ , mg_dof_handler(triangulation)
+ , degree(degree)
{}
Functions::ZeroFunction<dim> homogeneous_dirichlet_bc(1);
dirichlet_boundary[0] = &homogeneous_dirichlet_bc;
MappingQGeneric<dim> mapping(1);
- VectorTools::interpolate_boundary_values(
- mapping, mg_dof_handler, dirichlet_boundary, constraints);
+ VectorTools::interpolate_boundary_values(mapping,
+ mg_dof_handler,
+ dirichlet_boundary,
+ constraints);
constraints.close();
constraints.condense(sparsity_pattern);
sparsity_pattern.compress();
!mg_constrained_dofs.is_boundary_index(
lvl,
local_dof_indices[j])) // ( !boundary(i) && !boundary(j) )
- || (mg_constrained_dofs.is_boundary_index(
- lvl, local_dof_indices[i]) &&
- local_dof_indices[i] ==
- local_dof_indices[j]) // ( boundary(i) && boundary(j) &&
- // i==j )
+ ||
+ (mg_constrained_dofs.is_boundary_index(lvl,
+ local_dof_indices[i]) &&
+ local_dof_indices[i] ==
+ local_dof_indices[j]) // ( boundary(i) && boundary(j) &&
+ // i==j )
))
{
}
{
Vector<float> estimated_error_per_cell(triangulation.n_active_cells());
- KellyErrorEstimator<dim>::estimate(
- static_cast<DoFHandler<dim> &>(mg_dof_handler),
- QGauss<dim - 1>(degree + 1),
- typename FunctionMap<dim>::type(),
- solution,
- estimated_error_per_cell);
+ KellyErrorEstimator<dim>::estimate(static_cast<DoFHandler<dim> &>(
+ mg_dof_handler),
+ QGauss<dim - 1>(degree + 1),
+ typename FunctionMap<dim>::type(),
+ solution,
+ estimated_error_per_cell);
const double threshold = 0.6 * estimated_error_per_cell.linfty_norm();
GridRefinement::refine(triangulation, estimated_error_per_cell, threshold);
template <int dim>
-LaplaceMatrix<dim>::LaplaceMatrix() :
- MeshWorker::LocalIntegrator<dim>(true, false, false)
+LaplaceMatrix<dim>::LaplaceMatrix()
+ : MeshWorker::LocalIntegrator<dim>(true, false, false)
{}
class Coefficient : public Function<dim>
{
public:
- Coefficient() : Function<dim>()
+ Coefficient()
+ : Function<dim>()
{}
virtual double
template <int dim>
-LaplaceProblem<dim>::LaplaceProblem(const unsigned int degree) :
- triangulation(Triangulation<dim>::limit_level_difference_at_vertices),
- fe(degree),
- mg_dof_handler(triangulation),
- degree(degree),
- matrix_integrator()
+LaplaceProblem<dim>::LaplaceProblem(const unsigned int degree)
+ : triangulation(Triangulation<dim>::limit_level_difference_at_vertices)
+ , fe(degree)
+ , mg_dof_handler(triangulation)
+ , degree(degree)
+ , matrix_integrator()
{}
Functions::ZeroFunction<dim> homogeneous_dirichlet_bc(1);
dirichlet_boundary[0] = &homogeneous_dirichlet_bc;
MappingQGeneric<dim> mapping(1);
- VectorTools::interpolate_boundary_values(
- mapping, mg_dof_handler, dirichlet_boundary, constraints);
+ VectorTools::interpolate_boundary_values(mapping,
+ mg_dof_handler,
+ dirichlet_boundary,
+ constraints);
constraints.close();
constraints.condense(sparsity_pattern);
sparsity_pattern.compress();
class Coefficient : public Function<dim>
{
public:
- Coefficient() : Function<dim>()
+ Coefficient()
+ : Function<dim>()
{}
virtual double
template <int dim>
-LaplaceProblem<dim>::LaplaceProblem(const unsigned int degree) :
- triangulation(Triangulation<dim>::limit_level_difference_at_vertices),
- fe(degree),
- mg_dof_handler(triangulation),
- degree(degree)
+LaplaceProblem<dim>::LaplaceProblem(const unsigned int degree)
+ : triangulation(Triangulation<dim>::limit_level_difference_at_vertices)
+ , fe(degree)
+ , mg_dof_handler(triangulation)
+ , degree(degree)
{}
Functions::ZeroFunction<dim> homogeneous_dirichlet_bc(1);
dirichlet_boundary[0] = &homogeneous_dirichlet_bc;
MappingQGeneric<dim> mapping(1);
- VectorTools::interpolate_boundary_values(
- mapping, mg_dof_handler, dirichlet_boundary, constraints);
+ VectorTools::interpolate_boundary_values(mapping,
+ mg_dof_handler,
+ dirichlet_boundary,
+ constraints);
constraints.close();
constraints.condense(sparsity_pattern);
sparsity_pattern.compress();
!mg_constrained_dofs.is_boundary_index(
lvl,
local_dof_indices[j])) // ( !boundary(i) && !boundary(j) )
- || (mg_constrained_dofs.is_boundary_index(
- lvl, local_dof_indices[i]) &&
- local_dof_indices[i] ==
- local_dof_indices[j]) // ( boundary(i) && boundary(j) &&
- // i==j )
+ ||
+ (mg_constrained_dofs.is_boundary_index(lvl,
+ local_dof_indices[i]) &&
+ local_dof_indices[i] ==
+ local_dof_indices[j]) // ( boundary(i) && boundary(j) &&
+ // i==j )
))
{
// do nothing, so add entries to interface matrix
{
Vector<float> estimated_error_per_cell(triangulation.n_active_cells());
- KellyErrorEstimator<dim>::estimate(
- static_cast<DoFHandler<dim> &>(mg_dof_handler),
- QGauss<dim - 1>(3),
- typename FunctionMap<dim>::type(),
- solution,
- estimated_error_per_cell);
- GridRefinement::refine_and_coarsen_fixed_number(
- triangulation, estimated_error_per_cell, 0.3, 0.03);
+ KellyErrorEstimator<dim>::estimate(static_cast<DoFHandler<dim> &>(
+ mg_dof_handler),
+ QGauss<dim - 1>(3),
+ typename FunctionMap<dim>::type(),
+ solution,
+ estimated_error_per_cell);
+ GridRefinement::refine_and_coarsen_fixed_number(triangulation,
+ estimated_error_per_cell,
+ 0.3,
+ 0.03);
triangulation.execute_coarsening_and_refinement();
}
template <int dim>
InteriorPenaltyProblem<dim>::InteriorPenaltyProblem(
- const FiniteElement<dim> &fe) :
- triangulation(Triangulation<dim>::limit_level_difference_at_vertices),
- mapping(1),
- fe(fe),
- dof_handler(triangulation),
- estimates(1)
+ const FiniteElement<dim> &fe)
+ : triangulation(Triangulation<dim>::limit_level_difference_at_vertices)
+ , mapping(1)
+ , fe(fe)
+ , dof_handler(triangulation)
+ , estimates(1)
{
GridGenerator::hyper_cube_slit(triangulation, -1, 1);
}
MeshWorker::IntegrationInfoBox<dim> info_box;
const unsigned int n_gauss_points =
dof_handler.get_fe().tensor_degree() + 1;
- info_box.initialize_gauss_quadrature(
- n_gauss_points, n_gauss_points + 1, n_gauss_points);
+ info_box.initialize_gauss_quadrature(n_gauss_points,
+ n_gauss_points + 1,
+ n_gauss_points);
AnyData solution_data;
solution_data.add<const Vector<double> *>(&solution, "solution");
MeshWorker::IntegrationInfoBox<dim> info_box;
const unsigned int n_gauss_points =
dof_handler.get_fe().tensor_degree() + 1;
- info_box.initialize_gauss_quadrature(
- n_gauss_points, n_gauss_points + 1, n_gauss_points);
+ info_box.initialize_gauss_quadrature(n_gauss_points,
+ n_gauss_points + 1,
+ n_gauss_points);
AnyData solution_data;
solution_data.add<Vector<double> *>(&solution, "solution");
template <int dim>
InteriorPenaltyProblem<dim>::InteriorPenaltyProblem(
- const FiniteElement<dim> &fe) :
- triangulation(Triangulation<dim>::limit_level_difference_at_vertices),
- mapping(1),
- fe(fe),
- dof_handler(triangulation),
- estimates(1)
+ const FiniteElement<dim> &fe)
+ : triangulation(Triangulation<dim>::limit_level_difference_at_vertices)
+ , mapping(1)
+ , fe(fe)
+ , dof_handler(triangulation)
+ , estimates(1)
{
GridGenerator::hyper_cube_slit(triangulation, -1, 1);
}
MeshWorker::IntegrationInfoBox<dim> info_box;
const unsigned int n_gauss_points =
dof_handler.get_fe().tensor_degree() + 1;
- info_box.initialize_gauss_quadrature(
- n_gauss_points, n_gauss_points + 1, n_gauss_points);
+ info_box.initialize_gauss_quadrature(n_gauss_points,
+ n_gauss_points + 1,
+ n_gauss_points);
AnyData solution_data;
solution_data.add<const Vector<double> *>(&solution, "solution");
MeshWorker::IntegrationInfoBox<dim> info_box;
const unsigned int n_gauss_points =
dof_handler.get_fe().tensor_degree() + 1;
- info_box.initialize_gauss_quadrature(
- n_gauss_points, n_gauss_points + 1, n_gauss_points);
+ info_box.initialize_gauss_quadrature(n_gauss_points,
+ n_gauss_points + 1,
+ n_gauss_points);
AnyData solution_data;
solution_data.add<Vector<double> *>(&solution, "solution");
template <int dim>
InteriorPenaltyProblem<dim>::InteriorPenaltyProblem(
- const FiniteElement<dim> &fe) :
- triangulation(Triangulation<dim>::limit_level_difference_at_vertices),
- mapping(1),
- fe(fe),
- dof_handler(triangulation),
- estimates(1)
+ const FiniteElement<dim> &fe)
+ : triangulation(Triangulation<dim>::limit_level_difference_at_vertices)
+ , mapping(1)
+ , fe(fe)
+ , dof_handler(triangulation)
+ , estimates(1)
{
GridGenerator::hyper_cube_slit(triangulation, -1, 1);
}
MeshWorker::IntegrationInfoBox<dim> info_box;
const unsigned int n_gauss_points =
dof_handler.get_fe().tensor_degree() + 1;
- info_box.initialize_gauss_quadrature(
- n_gauss_points, n_gauss_points + 1, n_gauss_points);
+ info_box.initialize_gauss_quadrature(n_gauss_points,
+ n_gauss_points + 1,
+ n_gauss_points);
AnyData solution_data;
solution_data.add<const Vector<double> *>(&solution, "solution");
MeshWorker::IntegrationInfoBox<dim> info_box;
const unsigned int n_gauss_points =
dof_handler.get_fe().tensor_degree() + 1;
- info_box.initialize_gauss_quadrature(
- n_gauss_points, n_gauss_points + 1, n_gauss_points);
+ info_box.initialize_gauss_quadrature(n_gauss_points,
+ n_gauss_points + 1,
+ n_gauss_points);
AnyData solution_data;
solution_data.add<Vector<double> *>(&solution, "solution");
template <int dim>
InteriorPenaltyProblem<dim>::InteriorPenaltyProblem(
- const FiniteElement<dim> &fe) :
- triangulation(Triangulation<dim>::limit_level_difference_at_vertices),
- mapping(1),
- fe(fe),
- dof_handler(triangulation),
- estimates(1)
+ const FiniteElement<dim> &fe)
+ : triangulation(Triangulation<dim>::limit_level_difference_at_vertices)
+ , mapping(1)
+ , fe(fe)
+ , dof_handler(triangulation)
+ , estimates(1)
{
GridGenerator::hyper_cube_slit(triangulation, -1, 1);
}
MeshWorker::IntegrationInfoBox<dim> info_box;
const unsigned int n_gauss_points =
dof_handler.get_fe().tensor_degree() + 1;
- info_box.initialize_gauss_quadrature(
- n_gauss_points, n_gauss_points + 1, n_gauss_points);
+ info_box.initialize_gauss_quadrature(n_gauss_points,
+ n_gauss_points + 1,
+ n_gauss_points);
AnyData solution_data;
solution_data.add<const Vector<double> *>(&solution, "solution");
MeshWorker::IntegrationInfoBox<dim> info_box;
const unsigned int n_gauss_points =
dof_handler.get_fe().tensor_degree() + 1;
- info_box.initialize_gauss_quadrature(
- n_gauss_points, n_gauss_points + 1, n_gauss_points);
+ info_box.initialize_gauss_quadrature(n_gauss_points,
+ n_gauss_points + 1,
+ n_gauss_points);
AnyData solution_data;
solution_data.add<Vector<double> *>(&solution, "solution");
class Coefficient : public Function<dim>
{
public:
- Coefficient(int K) : Function<dim>(), K(K)
+ Coefficient(int K)
+ : Function<dim>()
+ , K(K)
{}
virtual double
template <int dim>
- LaplaceProblem<dim>::LaplaceProblem(const unsigned int degree) :
- triangulation(
- MPI_COMM_WORLD,
- Triangulation<dim>::limit_level_difference_at_vertices,
- parallel::distributed::Triangulation<dim>::construct_multigrid_hierarchy),
- fe(degree),
- mg_dof_handler(triangulation),
- degree(degree),
- K(4)
+ LaplaceProblem<dim>::LaplaceProblem(const unsigned int degree)
+ : triangulation(MPI_COMM_WORLD,
+ Triangulation<dim>::limit_level_difference_at_vertices,
+ parallel::distributed::Triangulation<
+ dim>::construct_multigrid_hierarchy)
+ , fe(degree)
+ , mg_dof_handler(triangulation)
+ , degree(degree)
+ , K(4)
{}
typename FunctionMap<dim>::type dirichlet_boundary;
Functions::ConstantFunction<dim> homogeneous_dirichlet_bc(0.0);
dirichlet_boundary[0] = &homogeneous_dirichlet_bc;
- VectorTools::interpolate_boundary_values(
- mg_dof_handler, dirichlet_boundary, constraints);
+ VectorTools::interpolate_boundary_values(mg_dof_handler,
+ dirichlet_boundary,
+ constraints);
constraints.close();
DynamicSparsityPattern dsp(mg_dof_handler.n_dofs(),
mg_dof_handler.n_dofs());
DoFTools::make_sparsity_pattern(mg_dof_handler, dsp, constraints);
- system_matrix.reinit(
- mg_dof_handler.locally_owned_dofs(), dsp, MPI_COMM_WORLD, true);
+ system_matrix.reinit(mg_dof_handler.locally_owned_dofs(),
+ dsp,
+ MPI_COMM_WORLD,
+ true);
mg_constrained_dofs.clear();
++level)
{
IndexSet dofset;
- DoFTools::extract_locally_relevant_level_dofs(
- mg_dof_handler, level, dofset);
+ DoFTools::extract_locally_relevant_level_dofs(mg_dof_handler,
+ level,
+ dofset);
boundary_constraints[level].reinit(dofset);
boundary_constraints[level].add_lines(
mg_constrained_dofs.get_refinement_edge_indices(level));
temp_solution.reinit(locally_relevant_set, MPI_COMM_WORLD);
temp_solution = solution;
- KellyErrorEstimator<dim>::estimate(
- static_cast<DoFHandler<dim> &>(mg_dof_handler),
- QGauss<dim - 1>(degree + 1),
- typename FunctionMap<dim>::type(),
- temp_solution,
- estimated_error_per_cell);
+ KellyErrorEstimator<dim>::estimate(static_cast<DoFHandler<dim> &>(
+ mg_dof_handler),
+ QGauss<dim - 1>(degree + 1),
+ typename FunctionMap<dim>::type(),
+ temp_solution,
+ estimated_error_per_cell);
parallel::distributed::GridRefinement::refine_and_coarsen_fixed_fraction(
triangulation, estimated_error_per_cell, 0.3, 0.0);
class Coefficient : public Function<dim>
{
public:
- Coefficient() : Function<dim>()
+ Coefficient()
+ : Function<dim>()
{}
virtual double
template <int dim>
- LaplaceProblem<dim>::LaplaceProblem(const unsigned int degree) :
- triangulation(
- MPI_COMM_WORLD,
- typename Triangulation<dim>::MeshSmoothing(
- Triangulation<dim>::limit_level_difference_at_vertices),
- true,
- // parallel::shared::Triangulation<dim>::Settings::partition_custom_signal),
- typename parallel::shared::Triangulation<dim>::Settings(
- parallel::shared::Triangulation<dim>::partition_zorder |
- parallel::shared::Triangulation<dim>::construct_multigrid_hierarchy)),
- fe(degree),
- mg_dof_handler(triangulation),
- degree(degree)
+ LaplaceProblem<dim>::LaplaceProblem(const unsigned int degree)
+ : triangulation(
+ MPI_COMM_WORLD,
+ typename Triangulation<dim>::MeshSmoothing(
+ Triangulation<dim>::limit_level_difference_at_vertices),
+ true,
+ // parallel::shared::Triangulation<dim>::Settings::partition_custom_signal),
+ typename parallel::shared::Triangulation<dim>::Settings(
+ parallel::shared::Triangulation<dim>::partition_zorder |
+ parallel::shared::Triangulation<dim>::construct_multigrid_hierarchy))
+ , fe(degree)
+ , mg_dof_handler(triangulation)
+ , degree(degree)
{}
Functions::ConstantFunction<dim> homogeneous_dirichlet_bc(1.0);
dirichlet_boundary_ids.insert(0);
dirichlet_boundary[0] = &homogeneous_dirichlet_bc;
- VectorTools::interpolate_boundary_values(
- mg_dof_handler, dirichlet_boundary, constraints);
+ VectorTools::interpolate_boundary_values(mg_dof_handler,
+ dirichlet_boundary,
+ constraints);
constraints.close();
DynamicSparsityPattern dsp(mg_dof_handler.n_dofs(),
mg_dof_handler.n_dofs());
DoFTools::make_sparsity_pattern(mg_dof_handler, dsp, constraints);
- system_matrix.reinit(
- mg_dof_handler.locally_owned_dofs(), dsp, MPI_COMM_WORLD, true);
+ system_matrix.reinit(mg_dof_handler.locally_owned_dofs(),
+ dsp,
+ MPI_COMM_WORLD,
+ true);
mg_constrained_dofs.clear();
++level)
{
IndexSet dofset;
- DoFTools::extract_locally_relevant_level_dofs(
- mg_dof_handler, level, dofset);
+ DoFTools::extract_locally_relevant_level_dofs(mg_dof_handler,
+ level,
+ dofset);
boundary_constraints[level].reinit(dofset);
boundary_constraints[level].add_lines(
mg_constrained_dofs.get_refinement_edge_indices(level));
exponents_monomial[d] = 1;
LinearAlgebra::distributed::Vector<double> vrefcoarse;
vrefcoarse.reinit(dofcoarse.n_dofs());
- VectorTools::interpolate(
- dofcoarse, Functions::Monomial<dim>(exponents_monomial), vrefcoarse);
+ VectorTools::interpolate(dofcoarse,
+ Functions::Monomial<dim>(exponents_monomial),
+ vrefcoarse);
deallog << "no. cells: " << tr.n_global_active_cells() << std::endl;
LinearAlgebra::distributed::Vector<Number> vref;
AssertDimension(mgdof.n_dofs(tr.n_global_levels() - 1), mgdof.n_dofs());
vrefdouble.reinit(mgdof.n_dofs());
- VectorTools::interpolate(
- mgdof, Functions::Monomial<dim>(exponents_monomial), vrefdouble);
+ VectorTools::interpolate(mgdof,
+ Functions::Monomial<dim>(exponents_monomial),
+ vrefdouble);
vref.reinit(mgdof.n_dofs());
vref = vrefdouble;
exponents_monomial[d] = 1;
LinearAlgebra::distributed::Vector<double> vref;
vref.reinit(mgdof.n_dofs());
- VectorTools::interpolate(
- mgdof, Functions::Monomial<dim>(exponents_monomial), vref);
+ VectorTools::interpolate(mgdof,
+ Functions::Monomial<dim>(exponents_monomial),
+ vref);
deallog << "no. cells: " << tr.n_global_active_cells() << std::endl;
for (unsigned int level = vectors.max_level(); level > 0; --level)
{
LinearAlgebra::distributed::Vector<Number> vec2(vectors[level - 1]);
- transfer_ref.restrict_and_add(
- level, vectors[level - 1], vectors[level]);
+ transfer_ref.restrict_and_add(level,
+ vectors[level - 1],
+ vectors[level]);
transfer.restrict_and_add(level, vec2, vectors[level]);
vec2 -= vectors[level - 1];
deallog << "Error in restriction: " << (double)vec2.linfty_norm()
for (unsigned int level = 1; level < vectors.max_level(); ++level)
{
LinearAlgebra::distributed::Vector<Number> vec2(vectors[level + 1]);
- transfer_ref.prolongate(
- level + 1, vectors[level + 1], vectors[level]);
+ transfer_ref.prolongate(level + 1,
+ vectors[level + 1],
+ vectors[level]);
transfer.prolongate(level + 1, vec2, vectors[level]);
vec2 -= vectors[level + 1];
deallog << "Error in prolongation: " << (double)vec2.linfty_norm()
exponents_monomial[d] = 1;
LinearAlgebra::distributed::Vector<double> vref;
vref.reinit(mgdof.n_dofs());
- VectorTools::interpolate(
- mgdof, Functions::Monomial<dim>(exponents_monomial), vref);
+ VectorTools::interpolate(mgdof,
+ Functions::Monomial<dim>(exponents_monomial),
+ vref);
deallog << "no. cells: " << tr.n_global_active_cells() << std::endl;
for (unsigned int level = vectors.max_level(); level > 0; --level)
{
LinearAlgebra::distributed::Vector<Number> vec2(vectors[level - 1]);
- transfer_ref.restrict_and_add(
- level, vectors[level - 1], vectors[level]);
+ transfer_ref.restrict_and_add(level,
+ vectors[level - 1],
+ vectors[level]);
transfer.restrict_and_add(level, vec2, vectors[level]);
vec2 -= vectors[level - 1];
deallog << "Error in restriction: " << (double)vec2.linfty_norm()
for (unsigned int level = 1; level < vectors.max_level(); ++level)
{
LinearAlgebra::distributed::Vector<Number> vec2(vectors[level + 1]);
- transfer_ref.prolongate(
- level + 1, vectors[level + 1], vectors[level]);
+ transfer_ref.prolongate(level + 1,
+ vectors[level + 1],
+ vectors[level]);
transfer.prolongate(level + 1, vec2, vectors[level]);
vec2 -= vectors[level + 1];
deallog << "Error in prolongation: " << (double)vec2.linfty_norm()
exponents_monomial[d] = 1;
LinearAlgebra::distributed::Vector<double> vrefcoarse;
vrefcoarse.reinit(dofcoarse.n_dofs());
- VectorTools::interpolate(
- dofcoarse, Functions::Monomial<dim>(exponents_monomial, dim), vrefcoarse);
+ VectorTools::interpolate(dofcoarse,
+ Functions::Monomial<dim>(exponents_monomial, dim),
+ vrefcoarse);
deallog << "no. cells: " << tr.n_global_active_cells() << std::endl;
LinearAlgebra::distributed::Vector<Number> vref;
AssertDimension(mgdof.n_dofs(tr.n_global_levels() - 1), mgdof.n_dofs());
vrefdouble.reinit(mgdof.n_dofs());
- VectorTools::interpolate(
- mgdof, Functions::Monomial<dim>(exponents_monomial, dim), vrefdouble);
+ VectorTools::interpolate(mgdof,
+ Functions::Monomial<dim>(exponents_monomial, dim),
+ vrefdouble);
vref.reinit(mgdof.n_dofs());
vref = vrefdouble;
std::vector<std::vector<types::global_dof_index>> dofs_per_block(
tr.n_levels(), std::vector<types::global_dof_index>(2));
- MGTools::count_dofs_per_block(
- mg_dof_handler, dofs_per_block, block_component);
+ MGTools::count_dofs_per_block(mg_dof_handler,
+ dofs_per_block,
+ block_component);
FullMatrix<double> prolong_0_1(dofs_per_block[1][0], dofs_per_block[0][0]);
FullMatrix<double> prolong_1_2(dofs_per_block[2][0], dofs_per_block[1][0]);
block_component);
std::vector<types::global_dof_index> dofs_per_block(3);
- DoFTools::count_dofs_per_block(
- mg_dof_handler, dofs_per_block, block_component);
+ DoFTools::count_dofs_per_block(mg_dof_handler,
+ dofs_per_block,
+ block_component);
std::vector<std::vector<types::global_dof_index>> mg_dofs_per_block(
tr.n_levels(), std::vector<types::global_dof_index>(3));
- MGTools::count_dofs_per_block(
- mg_dof_handler, mg_dofs_per_block, block_component);
+ MGTools::count_dofs_per_block(mg_dof_handler,
+ mg_dofs_per_block,
+ block_component);
deallog << "Global dofs:";
for (unsigned int i = 0; i < dofs_per_block.size(); ++i)
Functions::ZeroFunction<dim> dirichlet_bc(fe.n_components());
dirichlet_boundary[3] = &dirichlet_bc;
- MGTools::make_boundary_list(
- mg_dof_handler, dirichlet_boundary, boundary_indices);
+ MGTools::make_boundary_list(mg_dof_handler,
+ dirichlet_boundary,
+ boundary_indices);
std::vector<unsigned int> block_selected(2, 0U);
MGTransferSelect<double> transfer;
Functions::ZeroFunction<dim> dirichlet_bc(fe.n_components());
dirichlet_boundary[3] = &dirichlet_bc;
- MGTools::make_boundary_list(
- mg_dof_handler, dirichlet_boundary, boundary_indices);
+ MGTools::make_boundary_list(mg_dof_handler,
+ dirichlet_boundary,
+ boundary_indices);
std::vector<unsigned int> block_selected(2);
block_selected[0] = 0;
Functions::ZeroFunction<dim> dirichlet_bc(fe.n_components());
dirichlet_boundary[3] = &dirichlet_bc;
- MGTools::make_boundary_list(
- mg_dof_handler, dirichlet_boundary, boundary_indices);
+ MGTools::make_boundary_list(mg_dof_handler,
+ dirichlet_boundary,
+ boundary_indices);
MGTransferSelect<double> transfer;
transfer.build_matrices(mg_dof_handler,
block_component);
std::vector<types::global_dof_index> dofs_per_block(3);
- DoFTools::count_dofs_per_block(
- mg_dof_handler, dofs_per_block, block_component);
+ DoFTools::count_dofs_per_block(mg_dof_handler,
+ dofs_per_block,
+ block_component);
std::vector<std::vector<types::global_dof_index>> mg_dofs_per_block(
tr.n_levels(), std::vector<types::global_dof_index>(3));
- MGTools::count_dofs_per_block(
- mg_dof_handler, mg_dofs_per_block, block_component);
+ MGTools::count_dofs_per_block(mg_dof_handler,
+ mg_dofs_per_block,
+ block_component);
deallog << "Global dofs:";
for (unsigned int i = 0; i < dofs_per_block.size(); ++i)
Vector<double> squares(dh.n_dofs());
Vector<double> projected_squares(dh.n_dofs());
- VectorTools::interpolate(
- space_dh, Functions::SquareFunction<spacedim>(), space_square);
+ VectorTools::interpolate(space_dh,
+ Functions::SquareFunction<spacedim>(),
+ space_square);
VectorTools::interpolate(dh, Functions::SquareFunction<spacedim>(), squares);
coupling.Tvmult(projected_squares, space_square);
QGauss<dim> quad(3); // Quadrature for coupling
- TrilinosWrappers::SparsityPattern sparsity(
- space_locally_owned_dofs, locally_owned_dofs, comm);
+ TrilinosWrappers::SparsityPattern sparsity(space_locally_owned_dofs,
+ locally_owned_dofs,
+ comm);
NonMatching::create_coupling_sparsity_pattern(space_dh, dh, quad, sparsity);
sparsity.compress();
for (unsigned int q = 0; q < quad.size(); ++q)
cell_matrix(i, j) +=
fev.shape_value(i, q) * fev.shape_value(j, q) * fev.JxW(q);
- constraints.distribute_local_to_global(
- cell_matrix, dofs, mass_matrix);
+ constraints.distribute_local_to_global(cell_matrix,
+ dofs,
+ mass_matrix);
}
mass_matrix.compress(VectorOperation::add);
}
TrilinosWrappers::MPI::Vector Mprojected_squares(locally_owned_dofs, comm);
TrilinosWrappers::MPI::Vector projected_squares(locally_owned_dofs, comm);
- VectorTools::interpolate(
- space_dh, Functions::SquareFunction<spacedim>(), space_square);
+ VectorTools::interpolate(space_dh,
+ Functions::SquareFunction<spacedim>(),
+ space_square);
VectorTools::interpolate(dh, Functions::SquareFunction<spacedim>(), squares);
coupling.Tvmult(Mprojected_squares, space_square);
GridTools::Cache<spacedim, spacedim> cache(space_tria);
- TrilinosWrappers::SparsityPattern sparsity(
- space_locally_owned_dofs, locally_owned_dofs, comm);
+ TrilinosWrappers::SparsityPattern sparsity(space_locally_owned_dofs,
+ locally_owned_dofs,
+ comm);
NonMatching::create_coupling_sparsity_pattern(
cache, space_dh, dh, quad, sparsity);
sparsity.compress();
for (unsigned int q = 0; q < quad.size(); ++q)
cell_matrix(i, j) +=
fev.shape_value(i, q) * fev.shape_value(j, q) * fev.JxW(q);
- constraints.distribute_local_to_global(
- cell_matrix, dofs, mass_matrix);
+ constraints.distribute_local_to_global(cell_matrix,
+ dofs,
+ mass_matrix);
}
mass_matrix.compress(VectorOperation::add);
}
TrilinosWrappers::MPI::Vector Mprojected_squares(locally_owned_dofs, comm);
TrilinosWrappers::MPI::Vector projected_squares(locally_owned_dofs, comm);
- VectorTools::interpolate(
- space_dh, Functions::SquareFunction<spacedim>(), space_square);
+ VectorTools::interpolate(space_dh,
+ Functions::SquareFunction<spacedim>(),
+ space_square);
VectorTools::interpolate(dh, Functions::SquareFunction<spacedim>(), squares);
coupling.Tvmult(Mprojected_squares, space_square);
std::vector<double> weights(1, 1);
std::vector<Tensor<1, dim>> normals;
normals.push_back(Point<dim>::unit_vector(dim - 1));
- NonMatching::ImmersedSurfaceQuadrature<dim> quadrature(
- points, weights, normals);
+ NonMatching::ImmersedSurfaceQuadrature<dim> quadrature(points,
+ weights,
+ normals);
print_quadrature(quadrature);
}
struct Data
{
Data(const hp::FECollection<dim> &fe,
- const hp::QCollection<dim> & quadrature) :
- hp_fe_values(fe,
- quadrature,
- update_values | update_gradients |
- update_quadrature_points | update_JxW_values)
+ const hp::QCollection<dim> & quadrature)
+ : hp_fe_values(fe,
+ quadrature,
+ update_values | update_gradients |
+ update_quadrature_points | update_JxW_values)
{}
- Data(const Data &data) :
- hp_fe_values(data.hp_fe_values.get_mapping_collection(),
- data.hp_fe_values.get_fe_collection(),
- data.hp_fe_values.get_quadrature_collection(),
- data.hp_fe_values.get_update_flags())
+ Data(const Data &data)
+ : hp_fe_values(data.hp_fe_values.get_mapping_collection(),
+ data.hp_fe_values.get_fe_collection(),
+ data.hp_fe_values.get_quadrature_collection(),
+ data.hp_fe_values.get_update_flags())
{}
hp::FEValues<dim> hp_fe_values;
class BoundaryValues : public Function<dim>
{
public:
- BoundaryValues() : Function<dim>()
+ BoundaryValues()
+ : Function<dim>()
{}
virtual double
class RightHandSide : public Function<dim>
{
public:
- RightHandSide() : Function<dim>()
+ RightHandSide()
+ : Function<dim>()
{}
virtual double
template <int dim>
-LaplaceProblem<dim>::LaplaceProblem() :
- dof_handler(triangulation),
- max_degree(5)
+LaplaceProblem<dim>::LaplaceProblem()
+ : dof_handler(triangulation)
+ , max_degree(5)
{
if (dim == 2)
for (unsigned int degree = 2; degree <= max_degree; ++degree)
// having added the hanging node constraints in order to be consistent and
// skip dofs that are already constrained (i.e., are hanging nodes on the
// boundary in 3D). In contrast to step-27, we choose a sine function.
- VectorTools::interpolate_boundary_values(
- dof_handler, 0, BoundaryValues<dim>(), constraints);
+ VectorTools::interpolate_boundary_values(dof_handler,
+ 0,
+ BoundaryValues<dim>(),
+ constraints);
constraints.close();
graph = GraphColoring::make_graph_coloring(
test_matrix = 0;
test_rhs = 0;
- WorkStream::run(
- graph,
- std::bind(&LaplaceProblem<dim>::local_assemble,
- this,
- std::placeholders::_1,
- std::placeholders::_2,
- std::placeholders::_3),
- std::bind(
- &LaplaceProblem<dim>::copy_local_to_global, this, std::placeholders::_1),
- Assembly::Scratch::Data<dim>(fe_collection, quadrature_collection),
- Assembly::Copy::Data());
+ WorkStream::run(graph,
+ std::bind(&LaplaceProblem<dim>::local_assemble,
+ this,
+ std::placeholders::_1,
+ std::placeholders::_2,
+ std::placeholders::_3),
+ std::bind(&LaplaceProblem<dim>::copy_local_to_global,
+ this,
+ std::placeholders::_1),
+ Assembly::Scratch::Data<dim>(fe_collection,
+ quadrature_collection),
+ Assembly::Copy::Data());
test_matrix.add(-1, reference_matrix);
for (unsigned int i = 0; i < estimated_error_per_cell.size(); ++i)
estimated_error_per_cell(i) = i;
- GridRefinement::refine_and_coarsen_fixed_number(
- triangulation, estimated_error_per_cell, 0.3, 0.03);
+ GridRefinement::refine_and_coarsen_fixed_number(triangulation,
+ estimated_error_per_cell,
+ 0.3,
+ 0.03);
triangulation.execute_coarsening_and_refinement();
for (typename hp::DoFHandler<dim>::active_cell_iterator cell =
struct Data
{
Data(const hp::FECollection<dim> &fe,
- const hp::QCollection<dim> & quadrature) :
- hp_fe_values(fe,
- quadrature,
- update_values | update_gradients |
- update_quadrature_points | update_JxW_values)
+ const hp::QCollection<dim> & quadrature)
+ : hp_fe_values(fe,
+ quadrature,
+ update_values | update_gradients |
+ update_quadrature_points | update_JxW_values)
{}
- Data(const Data &data) :
- hp_fe_values(data.hp_fe_values.get_mapping_collection(),
- data.hp_fe_values.get_fe_collection(),
- data.hp_fe_values.get_quadrature_collection(),
- data.hp_fe_values.get_update_flags())
+ Data(const Data &data)
+ : hp_fe_values(data.hp_fe_values.get_mapping_collection(),
+ data.hp_fe_values.get_fe_collection(),
+ data.hp_fe_values.get_quadrature_collection(),
+ data.hp_fe_values.get_update_flags())
{}
hp::FEValues<dim> hp_fe_values;
{
struct Data
{
- Data(bool second_test = false) : second_test(second_test)
+ Data(bool second_test = false)
+ : second_test(second_test)
{}
- Data(const Data &data) : second_test(data.second_test)
+ Data(const Data &data)
+ : second_test(data.second_test)
{}
std::vector<types::global_dof_index> local_dof_indices;
class BoundaryValues : public Function<dim>
{
public:
- BoundaryValues() : Function<dim>()
+ BoundaryValues()
+ : Function<dim>()
{}
virtual double
class RightHandSide : public Function<dim>
{
public:
- RightHandSide() : Function<dim>()
+ RightHandSide()
+ : Function<dim>()
{}
virtual double
template <int dim>
-LaplaceProblem<dim>::LaplaceProblem() :
- dof_handler(triangulation),
- max_degree(5)
+LaplaceProblem<dim>::LaplaceProblem()
+ : dof_handler(triangulation)
+ , max_degree(5)
{
if (dim == 2)
for (unsigned int degree = 2; degree <= max_degree; ++degree)
// having added the hanging node constraints in order to be consistent and
// skip dofs that are already constrained (i.e., are hanging nodes on the
// boundary in 3D). In contrast to step-27, we choose a sine function.
- VectorTools::interpolate_boundary_values(
- dof_handler, 0, BoundaryValues<dim>(), constraints);
+ VectorTools::interpolate_boundary_values(dof_handler,
+ 0,
+ BoundaryValues<dim>(),
+ constraints);
constraints.close();
graph = GraphColoring::make_graph_coloring(
test_matrix = 0;
test_rhs = 0;
- WorkStream::run(
- graph,
- std::bind(&LaplaceProblem<dim>::local_assemble,
- this,
- std::placeholders::_1,
- std::placeholders::_2,
- std::placeholders::_3),
- std::bind(
- &LaplaceProblem<dim>::copy_local_to_global, this, std::placeholders::_1),
- Assembly::Scratch::Data<dim>(fe_collection, quadrature_collection),
- Assembly::Copy::Data(),
- MultithreadInfo::n_threads(),
- 1);
+ WorkStream::run(graph,
+ std::bind(&LaplaceProblem<dim>::local_assemble,
+ this,
+ std::placeholders::_1,
+ std::placeholders::_2,
+ std::placeholders::_3),
+ std::bind(&LaplaceProblem<dim>::copy_local_to_global,
+ this,
+ std::placeholders::_1),
+ Assembly::Scratch::Data<dim>(fe_collection,
+ quadrature_collection),
+ Assembly::Copy::Data(),
+ MultithreadInfo::n_threads(),
+ 1);
}
test_matrix_2 = 0;
test_rhs_2 = 0;
- WorkStream::run(
- graph,
- std::bind(&LaplaceProblem<dim>::local_assemble,
- this,
- std::placeholders::_1,
- std::placeholders::_2,
- std::placeholders::_3),
- std::bind(
- &LaplaceProblem<dim>::copy_local_to_global, this, std::placeholders::_1),
- Assembly::Scratch::Data<dim>(fe_collection, quadrature_collection),
- Assembly::Copy::Data(true),
- 2 * MultithreadInfo::n_threads(),
- 1);
+ WorkStream::run(graph,
+ std::bind(&LaplaceProblem<dim>::local_assemble,
+ this,
+ std::placeholders::_1,
+ std::placeholders::_2,
+ std::placeholders::_3),
+ std::bind(&LaplaceProblem<dim>::copy_local_to_global,
+ this,
+ std::placeholders::_1),
+ Assembly::Scratch::Data<dim>(fe_collection,
+ quadrature_collection),
+ Assembly::Copy::Data(true),
+ 2 * MultithreadInfo::n_threads(),
+ 1);
}
template <int dim>
for (unsigned int i = 0; i < estimated_error_per_cell.size(); ++i)
estimated_error_per_cell(i) = i;
- GridRefinement::refine_and_coarsen_fixed_number(
- triangulation, estimated_error_per_cell, 0.3, 0.03);
+ GridRefinement::refine_and_coarsen_fixed_number(triangulation,
+ estimated_error_per_cell,
+ 0.3,
+ 0.03);
triangulation.execute_coarsening_and_refinement();
for (typename hp::DoFHandler<dim>::active_cell_iterator cell =
struct Data
{
Data(const hp::FECollection<dim> &fe,
- const hp::QCollection<dim> & quadrature) :
- hp_fe_values(fe,
- quadrature,
- update_values | update_gradients |
- update_quadrature_points | update_JxW_values)
+ const hp::QCollection<dim> & quadrature)
+ : hp_fe_values(fe,
+ quadrature,
+ update_values | update_gradients |
+ update_quadrature_points | update_JxW_values)
{}
- Data(const Data &data) :
- hp_fe_values(data.hp_fe_values.get_mapping_collection(),
- data.hp_fe_values.get_fe_collection(),
- data.hp_fe_values.get_quadrature_collection(),
- data.hp_fe_values.get_update_flags())
+ Data(const Data &data)
+ : hp_fe_values(data.hp_fe_values.get_mapping_collection(),
+ data.hp_fe_values.get_fe_collection(),
+ data.hp_fe_values.get_quadrature_collection(),
+ data.hp_fe_values.get_update_flags())
{}
hp::FEValues<dim> hp_fe_values;
class BoundaryValues : public Function<dim>
{
public:
- BoundaryValues() : Function<dim>()
+ BoundaryValues()
+ : Function<dim>()
{}
virtual double
class RightHandSide : public Function<dim>
{
public:
- RightHandSide() : Function<dim>()
+ RightHandSide()
+ : Function<dim>()
{}
virtual double
template <int dim>
-LaplaceProblem<dim>::LaplaceProblem() :
- dof_handler(triangulation),
- max_degree(5)
+LaplaceProblem<dim>::LaplaceProblem()
+ : dof_handler(triangulation)
+ , max_degree(5)
{
if (dim == 2)
for (unsigned int degree = 2; degree <= max_degree; ++degree)
// having added the hanging node constraints in order to be consistent and
// skip dofs that are already constrained (i.e., are hanging nodes on the
// boundary in 3D). In contrast to step-27, we choose a sine function.
- VectorTools::interpolate_boundary_values(
- dof_handler, 0, BoundaryValues<dim>(), constraints);
+ VectorTools::interpolate_boundary_values(dof_handler,
+ 0,
+ BoundaryValues<dim>(),
+ constraints);
constraints.close();
graph = GraphColoring::make_graph_coloring(
test_matrix = 0;
test_rhs = 0;
- WorkStream::run(
- graph,
- std::bind(&LaplaceProblem<dim>::local_assemble,
- this,
- std::placeholders::_1,
- std::placeholders::_2,
- std::placeholders::_3),
- std::bind(
- &LaplaceProblem<dim>::copy_local_to_global, this, std::placeholders::_1),
- Assembly::Scratch::Data<dim>(fe_collection, quadrature_collection),
- Assembly::Copy::Data());
+ WorkStream::run(graph,
+ std::bind(&LaplaceProblem<dim>::local_assemble,
+ this,
+ std::placeholders::_1,
+ std::placeholders::_2,
+ std::placeholders::_3),
+ std::bind(&LaplaceProblem<dim>::copy_local_to_global,
+ this,
+ std::placeholders::_1),
+ Assembly::Scratch::Data<dim>(fe_collection,
+ quadrature_collection),
+ Assembly::Copy::Data());
test_matrix.add(-1, reference_matrix);
for (unsigned int i = 0; i < estimated_error_per_cell.size(); ++i)
estimated_error_per_cell(i) = i;
- GridRefinement::refine_and_coarsen_fixed_number(
- triangulation, estimated_error_per_cell, 0.3, 0.03);
+ GridRefinement::refine_and_coarsen_fixed_number(triangulation,
+ estimated_error_per_cell,
+ 0.3,
+ 0.03);
triangulation.execute_coarsening_and_refinement();
for (typename hp::DoFHandler<dim>::active_cell_iterator cell =
struct Data
{
Data(const hp::FECollection<dim> &fe,
- const hp::QCollection<dim> & quadrature) :
- hp_fe_values(fe,
- quadrature,
- update_values | update_gradients |
- update_quadrature_points | update_JxW_values)
+ const hp::QCollection<dim> & quadrature)
+ : hp_fe_values(fe,
+ quadrature,
+ update_values | update_gradients |
+ update_quadrature_points | update_JxW_values)
{}
- Data(const Data &data) :
- hp_fe_values(data.hp_fe_values.get_mapping_collection(),
- data.hp_fe_values.get_fe_collection(),
- data.hp_fe_values.get_quadrature_collection(),
- data.hp_fe_values.get_update_flags())
+ Data(const Data &data)
+ : hp_fe_values(data.hp_fe_values.get_mapping_collection(),
+ data.hp_fe_values.get_fe_collection(),
+ data.hp_fe_values.get_quadrature_collection(),
+ data.hp_fe_values.get_update_flags())
{}
hp::FEValues<dim> hp_fe_values;
{
struct Data
{
- Data(const unsigned int test_variant) : test_variant(test_variant)
+ Data(const unsigned int test_variant)
+ : test_variant(test_variant)
{}
- Data(const Data &data) : test_variant(data.test_variant)
+ Data(const Data &data)
+ : test_variant(data.test_variant)
{}
std::vector<types::global_dof_index> local_dof_indices;
class BoundaryValues : public Function<dim>
{
public:
- BoundaryValues() : Function<dim>()
+ BoundaryValues()
+ : Function<dim>()
{}
virtual double
class RightHandSide : public Function<dim>
{
public:
- RightHandSide() : Function<dim>()
+ RightHandSide()
+ : Function<dim>()
{}
virtual double
template <int dim>
-LaplaceProblem<dim>::LaplaceProblem() :
- dof_handler(triangulation),
- max_degree(5)
+LaplaceProblem<dim>::LaplaceProblem()
+ : dof_handler(triangulation)
+ , max_degree(5)
{
if (dim == 2)
for (unsigned int degree = 2; degree <= max_degree; ++degree)
// having added the hanging node constraints in order to be consistent and
// skip dofs that are already constrained (i.e., are hanging nodes on the
// boundary in 3D). In contrast to step-27, we choose a sine function.
- VectorTools::interpolate_boundary_values(
- dof_handler, 0, BoundaryValues<dim>(), constraints);
+ VectorTools::interpolate_boundary_values(dof_handler,
+ 0,
+ BoundaryValues<dim>(),
+ constraints);
constraints.close();
graph = GraphColoring::make_graph_coloring(
test_matrix = 0;
test_rhs = 0;
- WorkStream::run(
- graph,
- std::bind(&LaplaceProblem<dim>::local_assemble,
- this,
- std::placeholders::_1,
- std::placeholders::_2,
- std::placeholders::_3),
- std::bind(
- &LaplaceProblem<dim>::copy_local_to_global, this, std::placeholders::_1),
- Assembly::Scratch::Data<dim>(fe_collection, quadrature_collection),
- Assembly::Copy::Data(1),
- 2 * MultithreadInfo::n_threads(),
- 1);
+ WorkStream::run(graph,
+ std::bind(&LaplaceProblem<dim>::local_assemble,
+ this,
+ std::placeholders::_1,
+ std::placeholders::_2,
+ std::placeholders::_3),
+ std::bind(&LaplaceProblem<dim>::copy_local_to_global,
+ this,
+ std::placeholders::_1),
+ Assembly::Scratch::Data<dim>(fe_collection,
+ quadrature_collection),
+ Assembly::Copy::Data(1),
+ 2 * MultithreadInfo::n_threads(),
+ 1);
for (unsigned int i = 0; i < dof_handler.n_dofs(); ++i)
if (constraints.is_constrained(i))
{
test_matrix_2 = 0;
test_rhs_2 = 0;
- WorkStream::run(
- graph,
- std::bind(&LaplaceProblem<dim>::local_assemble,
- this,
- std::placeholders::_1,
- std::placeholders::_2,
- std::placeholders::_3),
- std::bind(
- &LaplaceProblem<dim>::copy_local_to_global, this, std::placeholders::_1),
- Assembly::Scratch::Data<dim>(fe_collection, quadrature_collection),
- Assembly::Copy::Data(2),
- 2 * MultithreadInfo::n_threads(),
- 1);
+ WorkStream::run(graph,
+ std::bind(&LaplaceProblem<dim>::local_assemble,
+ this,
+ std::placeholders::_1,
+ std::placeholders::_2,
+ std::placeholders::_3),
+ std::bind(&LaplaceProblem<dim>::copy_local_to_global,
+ this,
+ std::placeholders::_1),
+ Assembly::Scratch::Data<dim>(fe_collection,
+ quadrature_collection),
+ Assembly::Copy::Data(2),
+ 2 * MultithreadInfo::n_threads(),
+ 1);
for (unsigned int i = 0; i < dof_handler.n_dofs(); ++i)
if (constraints.is_constrained(i))
{
for (unsigned int i = 0; i < estimated_error_per_cell.size(); ++i)
estimated_error_per_cell(i) = i;
- GridRefinement::refine_and_coarsen_fixed_number(
- triangulation, estimated_error_per_cell, 0.3, 0.03);
+ GridRefinement::refine_and_coarsen_fixed_number(triangulation,
+ estimated_error_per_cell,
+ 0.3,
+ 0.03);
triangulation.execute_coarsening_and_refinement();
for (typename hp::DoFHandler<dim>::active_cell_iterator cell =
ConstraintMatrix constraints;
DoFTools::make_hanging_node_constraints(dof, constraints);
- VectorTools::interpolate_boundary_values(
- dof, 0, Functions::ZeroFunction<dim>(2), constraints);
+ VectorTools::interpolate_boundary_values(dof,
+ 0,
+ Functions::ZeroFunction<dim>(2),
+ constraints);
constraints.close();
// create sparsity pattern. note
ConstraintMatrix constraints;
DoFTools::make_hanging_node_constraints(dof, constraints);
- VectorTools::interpolate_boundary_values(
- dof, 0, Functions::ZeroFunction<dim>(2), constraints);
+ VectorTools::interpolate_boundary_values(dof,
+ 0,
+ Functions::ZeroFunction<dim>(2),
+ constraints);
constraints.close();
// create sparsity pattern. note
class MyFunction : public Function<dim>
{
public:
- MyFunction() : Function<dim>()
+ MyFunction()
+ : Function<dim>()
{}
virtual double
{
double x = p[0], y = p[1];
// array of function and its derivatives
- double dx[4] = {
- sin(a * x), a * cos(a * x), -a * a * sin(a * x), -a * a * a * cos(a * x)};
- double dy[4] = {
- cos(b * y), -b * sin(b * y), -b * b * cos(b * y), b * b * b * sin(b * y)};
+ double dx[4] = {sin(a * x),
+ a * cos(a * x),
+ -a * a * sin(a * x),
+ -a * a * a * cos(a * x)};
+ double dy[4] = {cos(b * y),
+ -b * sin(b * y),
+ -b * b * cos(b * y),
+ b * b * b * sin(b * y)};
for (int i = 0; i < dim; ++i)
for (int j = 0; j < dim; ++j)
class MyFunction : public Function<dim>
{
public:
- MyFunction() : Function<dim>()
+ MyFunction()
+ : Function<dim>()
{}
virtual double
{
double x = p[0], y = p[1];
// array of function and its derivatives
- double dx[4] = {
- sin(a * x), a * cos(a * x), -a * a * sin(a * x), -a * a * a * cos(a * x)};
- double dy[4] = {
- cos(b * y), -b * sin(b * y), -b * b * cos(b * y), b * b * b * sin(b * y)};
+ double dx[4] = {sin(a * x),
+ a * cos(a * x),
+ -a * a * sin(a * x),
+ -a * a * a * cos(a * x)};
+ double dy[4] = {cos(b * y),
+ -b * sin(b * y),
+ -b * b * cos(b * y),
+ b * b * b * sin(b * y)};
for (int i = 0; i < dim; ++i)
for (int j = 0; j < dim; ++j)
Vector<double> u(dof.n_dofs());
Vector<double> f(dof.n_dofs());
- SparsityPattern A_pattern(
- dof.n_dofs(), dof.n_dofs(), dof.max_couplings_between_dofs());
+ SparsityPattern A_pattern(dof.n_dofs(),
+ dof.n_dofs(),
+ dof.max_couplings_between_dofs());
DoFTools::make_sparsity_pattern(dof, A_pattern);
A_pattern.compress();
class MySquareFunction : public Function<dim>
{
public:
- MySquareFunction() : Function<dim>(2)
+ MySquareFunction()
+ : Function<dim>(2)
{}
virtual double
};
template <int dim>
-MyFunction<dim>::MyFunction(const double k) : dealii::Function<dim>(1), k(k)
+MyFunction<dim>::MyFunction(const double k)
+ : dealii::Function<dim>(1)
+ , k(k)
{}
template <int dim>
};
template <int dim>
-NeumanBC<dim>::NeumanBC(const double c) : dealii::Function<dim>(1), c(c)
+NeumanBC<dim>::NeumanBC(const double c)
+ : dealii::Function<dim>(1)
+ , c(c)
{}
template <int dim>
};
template <int dim>
-MySecondFunction<dim>::MySecondFunction() : dealii::Function<dim>(1)
+MySecondFunction<dim>::MySecondFunction()
+ : dealii::Function<dim>(1)
{}
template <int dim>
};
template <int dim>
-MyFunction<dim>::MyFunction(const double k) :
- dealii::Function<dim, std::complex<double>>(1),
- k(k)
+MyFunction<dim>::MyFunction(const double k)
+ : dealii::Function<dim, std::complex<double>>(1)
+ , k(k)
{}
template <int dim>
};
template <int dim>
-NeumanBC<dim>::NeumanBC(const double c) :
- dealii::Function<dim, std::complex<double>>(1),
- c(c)
+NeumanBC<dim>::NeumanBC(const double c)
+ : dealii::Function<dim, std::complex<double>>(1)
+ , c(c)
{}
template <int dim>
};
template <int dim>
-MySecondFunction<dim>::MySecondFunction() :
- dealii::Function<dim, std::complex<double>>(1)
+MySecondFunction<dim>::MySecondFunction()
+ : dealii::Function<dim, std::complex<double>>(1)
{}
template <int dim>
Assert(dim > 1, dealii::ExcNotImplemented());
const double &y = point[1];
- return std::complex<double>(
- 0, (1. - x) * (1. - y) * (1. - y) + std::pow(1.0 - y, 4) * std::exp(-x));
+ return std::complex<double>(0,
+ (1. - x) * (1. - y) * (1. - y) +
+ std::pow(1.0 - y, 4) * std::exp(-x));
}
template <int dim>
class F : public Function<dim>
{
public:
- F(const unsigned int n_comp, const unsigned int q) :
- Function<dim>(n_comp),
- q(q)
+ F(const unsigned int n_comp, const unsigned int q)
+ : Function<dim>(n_comp)
+ , q(q)
{}
virtual double
static const Point<3> vertices_1[] = {
// points on the lower surface
Point<dim>(0, 0, -4),
- Point<dim>(
- std::cos(0 * numbers::PI / 6), std::sin(0 * numbers::PI / 6), -4),
- Point<dim>(
- std::cos(2 * numbers::PI / 6), std::sin(2 * numbers::PI / 6), -4),
- Point<dim>(
- std::cos(4 * numbers::PI / 6), std::sin(4 * numbers::PI / 6), -4),
- Point<dim>(
- std::cos(6 * numbers::PI / 6), std::sin(6 * numbers::PI / 6), -4),
- Point<dim>(
- std::cos(8 * numbers::PI / 6), std::sin(8 * numbers::PI / 6), -4),
- Point<dim>(
- std::cos(10 * numbers::PI / 6), std::sin(10 * numbers::PI / 6), -4),
+ Point<dim>(std::cos(0 * numbers::PI / 6),
+ std::sin(0 * numbers::PI / 6),
+ -4),
+ Point<dim>(std::cos(2 * numbers::PI / 6),
+ std::sin(2 * numbers::PI / 6),
+ -4),
+ Point<dim>(std::cos(4 * numbers::PI / 6),
+ std::sin(4 * numbers::PI / 6),
+ -4),
+ Point<dim>(std::cos(6 * numbers::PI / 6),
+ std::sin(6 * numbers::PI / 6),
+ -4),
+ Point<dim>(std::cos(8 * numbers::PI / 6),
+ std::sin(8 * numbers::PI / 6),
+ -4),
+ Point<dim>(std::cos(10 * numbers::PI / 6),
+ std::sin(10 * numbers::PI / 6),
+ -4),
// same points on the top
// of the stem, with
Point<dim>(std::cos(4 * numbers::PI / 6), std::sin(4 * numbers::PI / 6), 4),
Point<dim>(std::cos(6 * numbers::PI / 6), std::sin(6 * numbers::PI / 6), 4),
Point<dim>(std::cos(8 * numbers::PI / 6), std::sin(8 * numbers::PI / 6), 4),
- Point<dim>(
- std::cos(10 * numbers::PI / 6), std::sin(10 * numbers::PI / 6), 4),
+ Point<dim>(std::cos(10 * numbers::PI / 6),
+ std::sin(10 * numbers::PI / 6),
+ 4),
// point at top of chevron
Point<dim>(0, 0, 4 + std::sqrt(2.) / 2),
std::sin(2 * numbers::PI / 6),
0) *
4.0,
- Point<dim>(
- std::cos(0 * numbers::PI / 6), std::sin(0 * numbers::PI / 6), 7) +
- Point<dim>(
- std::cos(2 * numbers::PI / 6), std::sin(2 * numbers::PI / 6), 0) *
+ Point<dim>(std::cos(0 * numbers::PI / 6),
+ std::sin(0 * numbers::PI / 6),
+ 7) +
+ Point<dim>(std::cos(2 * numbers::PI / 6),
+ std::sin(2 * numbers::PI / 6),
+ 0) *
4.0,
- Point<dim>(
- std::cos(2 * numbers::PI / 6), std::sin(2 * numbers::PI / 6), 7) +
- Point<dim>(
- std::cos(2 * numbers::PI / 6), std::sin(2 * numbers::PI / 6), 0) *
+ Point<dim>(std::cos(2 * numbers::PI / 6),
+ std::sin(2 * numbers::PI / 6),
+ 7) +
+ Point<dim>(std::cos(2 * numbers::PI / 6),
+ std::sin(2 * numbers::PI / 6),
+ 0) *
4.0,
- Point<dim>(
- std::cos(4 * numbers::PI / 6), std::sin(4 * numbers::PI / 6), 7) +
- Point<dim>(
- std::cos(2 * numbers::PI / 6), std::sin(2 * numbers::PI / 6), 0) *
+ Point<dim>(std::cos(4 * numbers::PI / 6),
+ std::sin(4 * numbers::PI / 6),
+ 7) +
+ Point<dim>(std::cos(2 * numbers::PI / 6),
+ std::sin(2 * numbers::PI / 6),
+ 0) *
4.0,
// points at the top of the
std::sin(6 * numbers::PI / 6),
0) *
4.0,
- Point<dim>(
- std::cos(4 * numbers::PI / 6), std::sin(4 * numbers::PI / 6), 7) +
- Point<dim>(
- std::cos(6 * numbers::PI / 6), std::sin(6 * numbers::PI / 6), 0) *
+ Point<dim>(std::cos(4 * numbers::PI / 6),
+ std::sin(4 * numbers::PI / 6),
+ 7) +
+ Point<dim>(std::cos(6 * numbers::PI / 6),
+ std::sin(6 * numbers::PI / 6),
+ 0) *
4.0,
- Point<dim>(
- std::cos(6 * numbers::PI / 6), std::sin(6 * numbers::PI / 6), 7) +
- Point<dim>(
- std::cos(6 * numbers::PI / 6), std::sin(6 * numbers::PI / 6), 0) *
+ Point<dim>(std::cos(6 * numbers::PI / 6),
+ std::sin(6 * numbers::PI / 6),
+ 7) +
+ Point<dim>(std::cos(6 * numbers::PI / 6),
+ std::sin(6 * numbers::PI / 6),
+ 0) *
4.0,
- Point<dim>(
- std::cos(8 * numbers::PI / 6), std::sin(8 * numbers::PI / 6), 7) +
- Point<dim>(
- std::cos(6 * numbers::PI / 6), std::sin(6 * numbers::PI / 6), 0) *
+ Point<dim>(std::cos(8 * numbers::PI / 6),
+ std::sin(8 * numbers::PI / 6),
+ 7) +
+ Point<dim>(std::cos(6 * numbers::PI / 6),
+ std::sin(6 * numbers::PI / 6),
+ 0) *
4.0,
// points at the top of the
std::sin(10 * numbers::PI / 6),
0) *
4.0,
- Point<dim>(
- std::cos(8 * numbers::PI / 6), std::sin(8 * numbers::PI / 6), 7) +
- Point<dim>(
- std::cos(10 * numbers::PI / 6), std::sin(10 * numbers::PI / 6), 0) *
+ Point<dim>(std::cos(8 * numbers::PI / 6),
+ std::sin(8 * numbers::PI / 6),
+ 7) +
+ Point<dim>(std::cos(10 * numbers::PI / 6),
+ std::sin(10 * numbers::PI / 6),
+ 0) *
4.0,
- Point<dim>(
- std::cos(10 * numbers::PI / 6), std::sin(10 * numbers::PI / 6), 7) +
- Point<dim>(
- std::cos(10 * numbers::PI / 6), std::sin(10 * numbers::PI / 6), 0) *
+ Point<dim>(std::cos(10 * numbers::PI / 6),
+ std::sin(10 * numbers::PI / 6),
+ 7) +
+ Point<dim>(std::cos(10 * numbers::PI / 6),
+ std::sin(10 * numbers::PI / 6),
+ 0) *
4.0,
- Point<dim>(
- std::cos(0 * numbers::PI / 6), std::sin(0 * numbers::PI / 6), 7) +
- Point<dim>(
- std::cos(10 * numbers::PI / 6), std::sin(10 * numbers::PI / 6), 0) *
+ Point<dim>(std::cos(0 * numbers::PI / 6),
+ std::sin(0 * numbers::PI / 6),
+ 7) +
+ Point<dim>(std::cos(10 * numbers::PI / 6),
+ std::sin(10 * numbers::PI / 6),
+ 0) *
4.0,
};
class RadialFunction : public Function<dim>
{
public:
- RadialFunction() : Function<dim>(dim)
+ RadialFunction()
+ : Function<dim>(dim)
{}
virtual void
data_component_interpretation(
dim, DataComponentInterpretation::component_is_part_of_vector);
- data_out.add_data_vector(
- v, "x", DataOut<dim>::type_dof_data, data_component_interpretation);
+ data_out.add_data_vector(v,
+ "x",
+ DataOut<dim>::type_dof_data,
+ data_component_interpretation);
data_out.build_patches(fe.degree);
data_out.write_vtk(deallog.get_file_stream());
cells[i].material_id = 0;
}
- tria.create_triangulation(
- vertices, cells, SubCellData()); // no boundary information
+ tria.create_triangulation(vertices,
+ cells,
+ SubCellData()); // no boundary information
colorize_sixty_deg_hyper_shell(tria, center, inner_radius, outer_radius);
}
std::set<types::boundary_id> no_normal_flux_boundaries;
no_normal_flux_boundaries.insert(0);
no_normal_flux_boundaries.insert(2);
- VectorTools::compute_no_normal_flux_constraints(
- dof_handler, 0, no_normal_flux_boundaries, constraints);
+ VectorTools::compute_no_normal_flux_constraints(dof_handler,
+ 0,
+ no_normal_flux_boundaries,
+ constraints);
constraints.print(deallog.get_file_stream());
ConstraintMatrix constraints;
std::set<types::boundary_id> no_normal_flux_boundaries;
no_normal_flux_boundaries.insert(6);
- VectorTools::compute_no_normal_flux_constraints(
- dof_handler, 0, no_normal_flux_boundaries, constraints);
+ VectorTools::compute_no_normal_flux_constraints(dof_handler,
+ 0,
+ no_normal_flux_boundaries,
+ constraints);
constraints.print(deallog.get_file_stream());
no_normal_flux_boundaries.insert(0); // x=0
no_normal_flux_boundaries.insert(5); // z=1
- VectorTools::compute_no_normal_flux_constraints(
- dof_handler, 0, no_normal_flux_boundaries, constraints);
+ VectorTools::compute_no_normal_flux_constraints(dof_handler,
+ 0,
+ no_normal_flux_boundaries,
+ constraints);
constraints.print(deallog.get_file_stream());
deal_II_exceptions::disable_abort_on_exception();
try
{
- VectorTools::compute_no_normal_flux_constraints(
- dof_handler, 0, no_normal_flux_boundaries, constraints);
+ VectorTools::compute_no_normal_flux_constraints(dof_handler,
+ 0,
+ no_normal_flux_boundaries,
+ constraints);
}
catch (ExceptionBase &e)
{
class RadialFunction : public Function<dim>
{
public:
- RadialFunction() : Function<dim>(dim)
+ RadialFunction()
+ : Function<dim>(dim)
{}
virtual void
const std::vector<Point<dim - 1>> & unit_support_points =
fe.get_unit_face_support_points();
Quadrature<dim - 1> quadrature(unit_support_points);
- FEFaceValues<dim, dim> fe_face_values(
- fe, quadrature, update_quadrature_points);
+ FEFaceValues<dim, dim> fe_face_values(fe,
+ quadrature,
+ update_quadrature_points);
typename DoFHandler<dim>::active_cell_iterator cell = dof.begin_active(),
endc = dof.end();
for (; cell != endc; ++cell)
template <int dim>
-TestPointValueHistory<dim>::TestPointValueHistory() :
- finite_element(FE_Q<dim>(1 + 1), dim, FE_Q<dim>(1), 1),
+TestPointValueHistory<dim>::TestPointValueHistory()
+ : finite_element(FE_Q<dim>(1 + 1), dim, FE_Q<dim>(1), 1)
+ ,
dof_handler(triangulation)
{}
template <int dim>
-TestPointValueHistory<dim>::TestPointValueHistory() :
- finite_element(FE_Q<dim>(1 + 1), dim, FE_Q<dim>(1), 1),
+TestPointValueHistory<dim>::TestPointValueHistory()
+ : finite_element(FE_Q<dim>(1 + 1), dim, FE_Q<dim>(1), 1)
+ ,
dof_handler(triangulation)
{}
std::vector<std::string> names;
names.emplace_back("Vector_out");
names.emplace_back("Scalar_out");
- node_monitor.evaluate_field(
- names, solution, postprocessor, postprocess_quadrature);
+ node_monitor.evaluate_field(names,
+ solution,
+ postprocessor,
+ postprocess_quadrature);
// output_results (step, solution);
step++;
template <int dim>
-TestPointValueHistory<dim>::TestPointValueHistory() :
- finite_element(2),
- dof_handler(triangulation)
+TestPointValueHistory<dim>::TestPointValueHistory()
+ : finite_element(2)
+ , dof_handler(triangulation)
{}
std::vector<std::string> names;
names.push_back("X_gradient");
names.push_back("X_hessian");
- node_monitor.evaluate_field(
- names, solution, postprocessor, postprocess_quadrature);
+ node_monitor.evaluate_field(names,
+ solution,
+ postprocessor,
+ postprocess_quadrature);
// output_results (step, solution);
step++;
class MySquareFunction : public Function<dim>
{
public:
- MySquareFunction(const unsigned int n_components) :
- Function<dim>(n_components),
- scaling(1)
+ MySquareFunction(const unsigned int n_components)
+ : Function<dim>(n_components)
+ , scaling(1)
{}
void
template <int dim>
-TestFunction<dim>::TestFunction(unsigned int p) : Function<dim>(dim), degree(p)
+TestFunction<dim>::TestFunction(unsigned int p)
+ : Function<dim>(dim)
+ , degree(p)
{}
};
template <int dim>
-BoundaryFunction<dim>::BoundaryFunction() : Function<dim>(dim)
+BoundaryFunction<dim>::BoundaryFunction()
+ : Function<dim>(dim)
{}
template <int dim>
};
template <int dim>
-BoundaryFunction<dim>::BoundaryFunction() : Function<dim>(dim)
+BoundaryFunction<dim>::BoundaryFunction()
+ : Function<dim>(dim)
{}
template <int dim>
};
template <int dim>
-BoundaryFunction<dim>::BoundaryFunction() : Function<dim>(dim)
+BoundaryFunction<dim>::BoundaryFunction()
+ : Function<dim>(dim)
{}
template <int dim>
class F : public Function<dim>
{
public:
- F(const unsigned int q, const unsigned int n_components) :
- Function<dim>(n_components),
- q(q)
+ F(const unsigned int q, const unsigned int n_components)
+ : Function<dim>(n_components)
+ , q(q)
{}
virtual double
class F : public Function<dim>
{
public:
- F(const unsigned int q, const unsigned int n_components) :
- Function<dim>(n_components),
- q(q)
+ F(const unsigned int q, const unsigned int n_components)
+ : Function<dim>(n_components)
+ , q(q)
{}
virtual double
DoFTools::make_hanging_node_constraints(dof_handler, constraints);
constraints.close();
- LinearAlgebra::distributed::Vector<double> projection(
- locally_owned_dofs, locally_relevant_dofs, mpi_communicator);
+ LinearAlgebra::distributed::Vector<double> projection(locally_owned_dofs,
+ locally_relevant_dofs,
+ mpi_communicator);
Vector<float> error(triangulation.n_active_cells());
for (unsigned int q = 0; q <= p + 2 - order_difference; ++q)
{
cell->set_refine_flag();
triangulation.execute_coarsening_and_refinement();
- do_project<dim, components, fe_degree>(
- triangulation, fe, order_difference);
+ do_project<dim, components, fe_degree>(triangulation,
+ fe,
+ order_difference);
}
}
}
triangulation.execute_coarsening_and_refinement();
- do_project<dim, components, fe_degree>(
- triangulation, fe, order_difference);
+ do_project<dim, components, fe_degree>(triangulation,
+ fe,
+ order_difference);
}
}
class F : public Function<dim>
{
public:
- F(const unsigned int q, const unsigned int n_components) :
- Function<dim>(n_components),
- q(q)
+ F(const unsigned int q, const unsigned int n_components)
+ : Function<dim>(n_components)
+ , q(q)
{}
virtual double
QData>
qp_manager;
{
- FEValues<dim> fe_values(
- fe, quadrature_formula, update_quadrature_points);
+ FEValues<dim> fe_values(fe,
+ quadrature_formula,
+ update_quadrature_points);
const unsigned int n_q_points = quadrature_formula.size();
class F : public Function<dim>
{
public:
- F(const unsigned int q, const unsigned int n_components) :
- Function<dim>(n_components),
- q(q)
+ F(const unsigned int q, const unsigned int n_components)
+ : Function<dim>(n_components)
+ , q(q)
{}
virtual double
additional_data.mapping_update_flags =
update_values | update_JxW_values | update_quadrature_points;
std::shared_ptr<MatrixFree<dim, double>> data(new MatrixFree<dim, double>());
- data->reinit(
- dof_handlers_mf, constraints_mf, quadrature_formula_1d, additional_data);
+ data->reinit(dof_handlers_mf,
+ constraints_mf,
+ quadrature_formula_1d,
+ additional_data);
for (unsigned int q = 0; q <= p; ++q)
{
class Rotate2d
{
public:
- Rotate2d(const double angle) : angle(angle)
+ Rotate2d(const double angle)
+ : angle(angle)
{}
template <int spacedim>
class Rotate2d
{
public:
- Rotate2d(const double angle) : angle(angle)
+ Rotate2d(const double angle)
+ : angle(angle)
{}
template <int spacedim>
IndexSet ghost_indices(10);
ghost_indices.add_range(3, 8);
{
- LinearAlgebra::distributed::Vector<double> v(
- local_range, ghost_indices, MPI_COMM_WORLD);
+ LinearAlgebra::distributed::Vector<double> v(local_range,
+ ghost_indices,
+ MPI_COMM_WORLD);
test(v);
}
{
- LinearAlgebra::distributed::Vector<float> v(
- local_range, ghost_indices, MPI_COMM_WORLD);
+ LinearAlgebra::distributed::Vector<float> v(local_range,
+ ghost_indices,
+ MPI_COMM_WORLD);
test(v);
}
const std::vector<Point<dim - 1>> & unit_support_points =
fe.get_unit_face_support_points();
Quadrature<dim - 1> quadrature(unit_support_points);
- FEFaceValues<dim, dim> fe_face_values(
- fe, quadrature, update_quadrature_points);
+ FEFaceValues<dim, dim> fe_face_values(fe,
+ quadrature,
+ update_quadrature_points);
typename DoFHandler<dim>::active_cell_iterator cell = dof.begin_active(),
endc = dof.end();
for (; cell != endc; ++cell)
class TimeStep : public TimeStepBase
{
public:
- TimeStep(const unsigned int time_step_number) :
- TimeStepBase(0),
- time_step_number(time_step_number)
+ TimeStep(const unsigned int time_step_number)
+ : TimeStepBase(0)
+ , time_step_number(time_step_number)
{}
virtual void
class MySquareFunction : public Function<dim>
{
public:
- MySquareFunction() : Function<dim>(2)
+ MySquareFunction()
+ : Function<dim>(2)
{}
virtual double
QGauss<dim - 1> quadrature(3);
Vector<double> rhs(dof.n_dofs());
- VectorTools::create_boundary_right_hand_side(
- dof, quadrature, MySquareFunction<dim>(), rhs);
+ VectorTools::create_boundary_right_hand_side(dof,
+ quadrature,
+ MySquareFunction<dim>(),
+ rhs);
for (unsigned int i = 0; i < rhs.size(); ++i)
deallog << rhs(i) << std::endl;
}
class MySquareFunction : public Function<dim>
{
public:
- MySquareFunction() : Function<dim>(dim)
+ MySquareFunction()
+ : Function<dim>(dim)
{}
virtual double
QGauss<dim - 1> quadrature(3);
Vector<double> rhs(dof.n_dofs());
- VectorTools::create_boundary_right_hand_side(
- dof, quadrature, MySquareFunction<dim>(), rhs);
+ VectorTools::create_boundary_right_hand_side(dof,
+ quadrature,
+ MySquareFunction<dim>(),
+ rhs);
for (unsigned int i = 0; i < rhs.size(); ++i)
deallog << rhs(i) << std::endl;
}
class MySquareFunction : public Function<dim>
{
public:
- MySquareFunction() : Function<dim>(1)
+ MySquareFunction()
+ : Function<dim>(1)
{}
virtual double
QGauss<dim - 1> quadrature(3);
Vector<double> rhs(dof.n_dofs());
- VectorTools::create_boundary_right_hand_side(
- dof, quadrature, MySquareFunction<dim>(), rhs);
+ VectorTools::create_boundary_right_hand_side(dof,
+ quadrature,
+ MySquareFunction<dim>(),
+ rhs);
for (unsigned int i = 0; i < rhs.size(); ++i)
deallog << rhs(i) << std::endl;
}
class MySquareFunction : public Function<dim>
{
public:
- MySquareFunction() : Function<dim>(1)
+ MySquareFunction()
+ : Function<dim>(1)
{}
virtual double
class MySquareFunction : public Function<dim>
{
public:
- MySquareFunction() : Function<dim>(2)
+ MySquareFunction()
+ : Function<dim>(2)
{}
virtual double
QGauss<dim> quadrature(3);
Vector<double> rhs(dof.n_dofs());
- VectorTools::create_right_hand_side(
- dof, quadrature, MySquareFunction<dim>(), rhs);
+ VectorTools::create_right_hand_side(dof,
+ quadrature,
+ MySquareFunction<dim>(),
+ rhs);
for (unsigned int i = 0; i < rhs.size(); ++i)
deallog << rhs(i) << std::endl;
}
class MySquareFunction : public Function<dim>
{
public:
- MySquareFunction() : Function<dim>(1)
+ MySquareFunction()
+ : Function<dim>(1)
{}
virtual double
QGauss<dim> quadrature(3);
Vector<double> rhs(dof.n_dofs());
- VectorTools::create_right_hand_side(
- dof, quadrature, MySquareFunction<dim>(), rhs);
+ VectorTools::create_right_hand_side(dof,
+ quadrature,
+ MySquareFunction<dim>(),
+ rhs);
for (unsigned int i = 0; i < rhs.size(); ++i)
deallog << rhs(i) << std::endl;
}
ps.push_back(Point<2>(0, 2));
auto edge = interpolation_curve(ps);
- BRepPrimAPI_MakeRevol revol(
- edge, gp_Ax1(gp_Pnt(0, 0, 0), gp_Dir(0, 0, 1)), -numbers::PI / 2);
+ BRepPrimAPI_MakeRevol revol(edge,
+ gp_Ax1(gp_Pnt(0, 0, 0), gp_Dir(0, 0, 1)),
+ -numbers::PI / 2);
revol.Build();
auto sh = revol.Shape();
DoFHandler<2, 3> dh(tria);
dh.distribute_dofs(fe);
std::vector<Point<3>> spoints(dh.n_dofs());
- DoFTools::map_dofs_to_support_points(
- StaticMappingQ1<2, 3>::mapping, dh, spoints);
+ DoFTools::map_dofs_to_support_points(StaticMappingQ1<2, 3>::mapping,
+ dh,
+ spoints);
std::sort(spoints.begin(),
spoints.end(),
class FirstClass : public ParameterAcceptor
{
public:
- FirstClass(const std::string &name = "First Class") : ParameterAcceptor(name)
+ FirstClass(const std::string &name = "First Class")
+ : ParameterAcceptor(name)
{
add_parameter("First int", f_i);
add_parameter("First double", f_d);
class SecondClass : public ParameterAcceptor
{
public:
- SecondClass(const std::string &name = "Second Class") :
- ParameterAcceptor(name)
+ SecondClass(const std::string &name = "Second Class")
+ : ParameterAcceptor(name)
{
add_parameter("Second int", s_i);
add_parameter("Second double", s_d);
class FirstClass : public ParameterAcceptor
{
public:
- FirstClass(const std::string &name = "First Class") : ParameterAcceptor(name)
+ FirstClass(const std::string &name = "First Class")
+ : ParameterAcceptor(name)
{
add_parameter("First int", f_i);
add_parameter("First double", f_d);
class SecondClass : public ParameterAcceptor
{
public:
- SecondClass(const std::string &name = "Second Class") :
- ParameterAcceptor(name)
+ SecondClass(const std::string &name = "Second Class")
+ : ParameterAcceptor(name)
{
add_parameter("Second int", s_i);
add_parameter("Second double", s_d);
class FirstClass : public ParameterAcceptor
{
public:
- FirstClass(const std::string &name = "First Class") : ParameterAcceptor(name)
+ FirstClass(const std::string &name = "First Class")
+ : ParameterAcceptor(name)
{
add_parameter("First int", f_i);
add_parameter("First double", f_d);
class SecondClass : public ParameterAcceptor
{
public:
- SecondClass(const std::string &name = "Second Class") :
- ParameterAcceptor(name)
+ SecondClass(const std::string &name = "Second Class")
+ : ParameterAcceptor(name)
{
add_parameter("Second int", s_i);
add_parameter("Second double", s_d);
class FirstClass : public ParameterAcceptor
{
public:
- FirstClass(const std::string &name = "First Class") : ParameterAcceptor(name)
+ FirstClass(const std::string &name = "First Class")
+ : ParameterAcceptor(name)
{
add_parameter("First int", f_i);
add_parameter("First double", f_d);
class SecondClass : public ParameterAcceptor
{
public:
- SecondClass(const std::string &name = "Second Class") :
- ParameterAcceptor(name)
+ SecondClass(const std::string &name = "Second Class")
+ : ParameterAcceptor(name)
{
add_parameter("Second int", s_i);
add_parameter("Second double", s_d);
public:
Test(const std::string &sec_name = "First Class",
const std::string &par_name = "Parameter name",
- const std::string &par_value = "Parameter value") :
- ParameterAcceptor(sec_name),
- par_name(par_name),
- par_value(par_value)
+ const std::string &par_value = "Parameter value")
+ : ParameterAcceptor(sec_name)
+ , par_name(par_name)
+ , par_value(par_value)
{
add_parameter(par_name, this->par_value);
check(const char *p)
{
ParameterHandler prm;
- prm.declare_entry(
- "test_1", "-1,0", Patterns::List(Patterns::Integer(-1, 1), 2, 3));
+ prm.declare_entry("test_1",
+ "-1,0",
+ Patterns::List(Patterns::Integer(-1, 1), 2, 3));
std::ifstream in(p);
prm.parse_input(in);
check(const char *p)
{
ParameterHandler prm;
- prm.declare_entry(
- "test_13",
- "-1:a, 0:b, 1:c",
- Patterns::Map(
- Patterns::Integer(-1, 1), Patterns::Selection("a|b|c"), 2, 3));
+ prm.declare_entry("test_13",
+ "-1:a, 0:b, 1:c",
+ Patterns::Map(Patterns::Integer(-1, 1),
+ Patterns::Selection("a|b|c"),
+ 2,
+ 3));
std::ifstream in(p);
prm.parse_input(in);
check(const char *p)
{
ParameterHandler prm;
- prm.declare_entry(
- "test_13",
- "-1:a xyz 0:b xyz 1:c",
- Patterns::Map(
- Patterns::Integer(-1, 1), Patterns::Selection("a|b|c"), 2, 3, "xyz"));
+ prm.declare_entry("test_13",
+ "-1:a xyz 0:b xyz 1:c",
+ Patterns::Map(Patterns::Integer(-1, 1),
+ Patterns::Selection("a|b|c"),
+ 2,
+ 3,
+ "xyz"));
std::ifstream in(p);
prm.parse_input(in);
ParameterHandler prm;
try
{
- prm.declare_entry(
- "test_1", "abc", Patterns::List(Patterns::Integer(-1, 1), 2, 3));
+ prm.declare_entry("test_1",
+ "abc",
+ Patterns::List(Patterns::Integer(-1, 1), 2, 3));
}
catch (const ParameterHandler::ExcValueDoesNotMatchPattern &)
{
check(const char *p)
{
ParameterHandler prm;
- prm.declare_entry(
- "test_1", "-1,0", Patterns::List(Patterns::Integer(-1, 1), 2, 3));
+ prm.declare_entry("test_1",
+ "-1,0",
+ Patterns::List(Patterns::Integer(-1, 1), 2, 3));
std::ifstream in(p);
prm.parse_input(in);
check(const char *p)
{
ParameterHandler prm;
- prm.declare_entry(
- "test_1", "-1,0", Patterns::List(Patterns::Integer(-1, 1), 2, 3));
+ prm.declare_entry("test_1",
+ "-1,0",
+ Patterns::List(Patterns::Integer(-1, 1), 2, 3));
std::ifstream in(p);
try
ParameterHandler prm;
prm.enter_subsection("Testing");
- prm.declare_entry(
- "Function", "a", Patterns::List(Patterns::Selection("a|b|c|d|e|f|g|h")));
+ prm.declare_entry("Function",
+ "a",
+ Patterns::List(Patterns::Selection("a|b|c|d|e|f|g|h")));
prm.leave_subsection();
prm.parse_input(SOURCE_DIR "/prm/parameter_handler_2.prm");
check("", "bla|bla 2|1", "set v=bla,bla,bla");
check("default,alsodefault", "default|nodefault|alsodefault", "");
- check(
- "default,alsodefault", "default|nodefault|alsodefault", "set v=nodefault");
+ check("default,alsodefault",
+ "default|nodefault|alsodefault",
+ "set v=nodefault");
check(" input 2 , have spaces ", "have spaces|input 2", "");
// check correct handling of space in input, default, and values:
- check(
- "input 2", "have spaces|input 2", "set v= input 2 , have spaces ");
+ check("input 2",
+ "have spaces|input 2",
+ "set v= input 2 , have spaces ");
- check(
- "", "double spaces|input 2", "set v = double spaces , double spaces");
+ check("",
+ "double spaces|input 2",
+ "set v = double spaces , double spaces");
}
ParameterHandler prm;
prm.enter_subsection("Testing");
- prm.declare_entry(
- "Function", "a", Patterns::List(Patterns::Selection("a|b|c|d|e|f|g|h")));
+ prm.declare_entry("Function",
+ "a",
+ Patterns::List(Patterns::Selection("a|b|c|d|e|f|g|h")));
prm.leave_subsection();
std::string input;
{
prm.enter_subsection("Testing 2");
{
- prm.declare_entry(
- "string list 2",
- "a",
- Patterns::List(Patterns::Selection("a|b|c|d|e|f|g|h")),
- "docs 1");
+ prm.declare_entry("string list 2",
+ "a",
+ Patterns::List(
+ Patterns::Selection("a|b|c|d|e|f|g|h")),
+ "docs 1");
prm.declare_entry("int 2", "1", Patterns::Integer());
- prm.declare_entry(
- "double 2", "3.1415926", Patterns::Double(), "docs 3");
+ prm.declare_entry("double 2",
+ "3.1415926",
+ Patterns::Double(),
+ "docs 3");
}
prm.leave_subsection();
- prm.declare_entry(
- "string list",
- "a",
- Patterns::List(Patterns::Selection("a|b|c|d|e|f|g|h")),
- "docs 1");
+ prm.declare_entry("string list",
+ "a",
+ Patterns::List(
+ Patterns::Selection("a|b|c|d|e|f|g|h")),
+ "docs 1");
prm.declare_entry("int", "1", Patterns::Integer());
prm.declare_entry("double", "3.1415926", Patterns::Double(), "docs 3");
}
{
prm.enter_subsection("Testing 2");
{
- prm.declare_entry(
- "string list 2",
- "a",
- Patterns::List(Patterns::Selection("a|b|c|d|e|f|g|h")),
- "docs 1");
+ prm.declare_entry("string list 2",
+ "a",
+ Patterns::List(
+ Patterns::Selection("a|b|c|d|e|f|g|h")),
+ "docs 1");
prm.declare_entry("int 2", "1", Patterns::Integer());
- prm.declare_entry(
- "double 2", "3.1415926", Patterns::Double(), "docs 3");
+ prm.declare_entry("double 2",
+ "3.1415926",
+ Patterns::Double(),
+ "docs 3");
}
prm.leave_subsection();
- prm.declare_entry(
- "string list",
- "a",
- Patterns::List(Patterns::Selection("a|b|c|d|e|f|g|h")),
- "docs 1");
+ prm.declare_entry("string list",
+ "a",
+ Patterns::List(
+ Patterns::Selection("a|b|c|d|e|f|g|h")),
+ "docs 1");
prm.declare_entry("int", "1", Patterns::Integer());
prm.declare_alias("int", "int_alias");
prm.declare_entry("double", "3.1415926", Patterns::Double(), "docs 3");
{
prm.enter_subsection("Testing 2");
{
- prm.declare_entry(
- "string list 2",
- "a",
- Patterns::List(Patterns::Selection("a|b|c|d|e|f|g|h")),
- "docs 1");
+ prm.declare_entry("string list 2",
+ "a",
+ Patterns::List(
+ Patterns::Selection("a|b|c|d|e|f|g|h")),
+ "docs 1");
prm.declare_entry("int 2", "1", Patterns::Integer());
- prm.declare_entry(
- "double 2", "3.1415926", Patterns::Double(), "docs 3");
+ prm.declare_entry("double 2",
+ "3.1415926",
+ Patterns::Double(),
+ "docs 3");
}
prm.leave_subsection();
- prm.declare_entry(
- "string list",
- "a",
- Patterns::List(Patterns::Selection("a|b|c|d|e|f|g|h")),
- "docs 1");
+ prm.declare_entry("string list",
+ "a",
+ Patterns::List(
+ Patterns::Selection("a|b|c|d|e|f|g|h")),
+ "docs 1");
prm.declare_entry("int", "1", Patterns::Integer());
prm.declare_alias("int", "int_alias");
prm.declare_entry("double", "3.1415926", Patterns::Double(), "docs 3");
ParameterHandler prm;
prm.enter_subsection("Testing testing");
{
- prm.declare_entry(
- "string list",
- "a",
- Patterns::List(Patterns::Selection("a|b|c|d|e|f|g|h")),
- "docs 1");
+ prm.declare_entry("string list",
+ "a",
+ Patterns::List(
+ Patterns::Selection("a|b|c|d|e|f|g|h")),
+ "docs 1");
prm.declare_entry("int/int", "1", Patterns::Integer());
- prm.declare_entry(
- "double_double", "3.1415926", Patterns::Double(), "docs 3");
+ prm.declare_entry("double_double",
+ "3.1415926",
+ Patterns::Double(),
+ "docs 3");
prm.enter_subsection("Testing%testing");
{
- prm.declare_entry(
- "string&list",
- "a,b,c",
- Patterns::List(Patterns::Selection("a|b|c|d|e|f|g|h")),
- "docs 1");
+ prm.declare_entry("string&list",
+ "a,b,c",
+ Patterns::List(
+ Patterns::Selection("a|b|c|d|e|f|g|h")),
+ "docs 1");
prm.declare_entry("int*int", "2", Patterns::Integer());
- prm.declare_entry(
- "double+double", "6.1415926", Patterns::Double(), "docs 3");
+ prm.declare_entry("double+double",
+ "6.1415926",
+ Patterns::Double(),
+ "docs 3");
}
prm.leave_subsection();
}
ParameterHandler prm;
prm.enter_subsection("Testing testing");
{
- prm.declare_entry(
- "string list",
- "a",
- Patterns::List(Patterns::Selection("a|b|c|d|e|f|g|h")),
- "docs 1");
+ prm.declare_entry("string list",
+ "a",
+ Patterns::List(
+ Patterns::Selection("a|b|c|d|e|f|g|h")),
+ "docs 1");
prm.declare_entry("int/int", "1", Patterns::Integer());
- prm.declare_entry(
- "double_double", "3.1415926", Patterns::Double(), "docs 3");
+ prm.declare_entry("double_double",
+ "3.1415926",
+ Patterns::Double(),
+ "docs 3");
prm.enter_subsection("Testing%testing");
{
- prm.declare_entry(
- "string&list",
- "a,b,c",
- Patterns::List(Patterns::Selection("a|b|c|d|e|f|g|h")),
- "docs 1");
+ prm.declare_entry("string&list",
+ "a,b,c",
+ Patterns::List(
+ Patterns::Selection("a|b|c|d|e|f|g|h")),
+ "docs 1");
prm.declare_entry("int*int", "2", Patterns::Integer());
- prm.declare_entry(
- "double+double", "6.1415926", Patterns::Double(), "docs 3");
+ prm.declare_entry("double+double",
+ "6.1415926",
+ Patterns::Double(),
+ "docs 3");
}
prm.leave_subsection();
}
std::string parameter_set_by_action;
ParameterHandler prm;
- prm.declare_entry(
- "test_1", "-1,0", Patterns::List(Patterns::Integer(-1, 1), 2, 3));
+ prm.declare_entry("test_1",
+ "-1,0",
+ Patterns::List(Patterns::Integer(-1, 1), 2, 3));
prm.add_action("test_1", [&](const std::string &s) {
deallog << "In action:" << s << std::endl;
parameter_set_by_action = s;
std::string parameter_set_by_action;
ParameterHandler prm;
- prm.declare_entry(
- "test_1", "-1,0", Patterns::List(Patterns::Integer(-1, 1), 2, 3));
+ prm.declare_entry("test_1",
+ "-1,0",
+ Patterns::List(Patterns::Integer(-1, 1), 2, 3));
prm.add_action("test_1", [&](const std::string &s) {
deallog << "In action 1:" << s << std::endl;
parameter_set_by_action = s;
{
ParameterHandler prm;
prm.enter_subsection("Testing");
- prm.declare_entry(
- "Function_1", "a", Patterns::List(Patterns::Selection("a|b|c")));
- prm.declare_entry(
- "Function_2", "d", Patterns::List(Patterns::Selection("d|e|f")));
+ prm.declare_entry("Function_1",
+ "a",
+ Patterns::List(Patterns::Selection("a|b|c")));
+ prm.declare_entry("Function_2",
+ "d",
+ Patterns::List(Patterns::Selection("d|e|f")));
prm.leave_subsection();
// things with strange characters
prm.enter_subsection("Testing%testing");
{
- prm.declare_entry(
- "string&list", "< & > ; /", Patterns::Anything(), "docs 1");
+ prm.declare_entry("string&list",
+ "< & > ; /",
+ Patterns::Anything(),
+ "docs 1");
prm.declare_entry("int*int", "2", Patterns::Integer());
- prm.declare_entry(
- "double+double", "6.1415926", Patterns::Double(), "docs 3");
+ prm.declare_entry("double+double",
+ "6.1415926",
+ Patterns::Double(),
+ "docs 3");
}
prm.leave_subsection();
// things with strange characters
prm.enter_subsection("Testing%testing");
{
- prm.declare_entry(
- "string&list", "< & > ; /", Patterns::Anything(), "docs 1");
+ prm.declare_entry("string&list",
+ "< & > ; /",
+ Patterns::Anything(),
+ "docs 1");
prm.declare_entry("int*int", "2", Patterns::Integer());
- prm.declare_entry(
- "double+double", "6.1415926", Patterns::Double(), "docs 3");
+ prm.declare_entry("double+double",
+ "6.1415926",
+ Patterns::Double(),
+ "docs 3");
}
prm.leave_subsection();
// things with strange characters
prm.enter_subsection("Testing%testing");
{
- prm.declare_entry(
- "string&list", "< & > ; /", Patterns::Anything(), "docs 1");
+ prm.declare_entry("string&list",
+ "< & > ; /",
+ Patterns::Anything(),
+ "docs 1");
prm.declare_entry("int*int", "2", Patterns::Integer());
- prm.declare_entry(
- "double+double", "6.1415926", Patterns::Double(), "docs 3");
+ prm.declare_entry("double+double",
+ "6.1415926",
+ Patterns::Double(),
+ "docs 3");
}
prm.leave_subsection();
// things with strange characters
prm.enter_subsection("Testing%testing");
{
- prm.declare_entry(
- "string&list", "< & > ; /", Patterns::Anything(), "docs 1");
+ prm.declare_entry("string&list",
+ "< & > ; /",
+ Patterns::Anything(),
+ "docs 1");
prm.declare_entry("int*int", "2", Patterns::Integer());
- prm.declare_entry(
- "double+double", "6.1415926", Patterns::Double(), "docs 3");
+ prm.declare_entry("double+double",
+ "6.1415926",
+ Patterns::Double(),
+ "docs 3");
}
prm.leave_subsection();
// things with strange characters
prm.enter_subsection("Testing%testing");
{
- prm.declare_entry(
- "string&list", "< & > ; /", Patterns::Anything(), "docs 1");
+ prm.declare_entry("string&list",
+ "< & > ; /",
+ Patterns::Anything(),
+ "docs 1");
prm.declare_entry("int*int", "2", Patterns::Integer());
- prm.declare_entry(
- "double+double", "6.1415926", Patterns::Double(), "docs 3");
+ prm.declare_entry("double+double",
+ "6.1415926",
+ Patterns::Double(),
+ "docs 3");
}
prm.leave_subsection();
// things with strange characters
prm.enter_subsection("Testing%testing");
{
- prm.declare_entry(
- "string&list", "< & > ; /", Patterns::Anything(), "docs 1");
+ prm.declare_entry("string&list",
+ "< & > ; /",
+ Patterns::Anything(),
+ "docs 1");
prm.declare_entry("int*int", "2", Patterns::Integer());
- prm.declare_entry(
- "double+double", "6.1415926", Patterns::Double(), "docs 3");
+ prm.declare_entry("double+double",
+ "6.1415926",
+ Patterns::Double(),
+ "docs 3");
}
prm.leave_subsection();
// things with strange characters
prm.enter_subsection("Testing%testing");
{
- prm.declare_entry(
- "string&list", "< & > ; /", Patterns::Anything(), "docs 1");
+ prm.declare_entry("string&list",
+ "< & > ; /",
+ Patterns::Anything(),
+ "docs 1");
prm.declare_entry("int*int", "2", Patterns::Integer());
- prm.declare_entry(
- "double+double", "6.1415926", Patterns::Double(), "docs 3");
+ prm.declare_entry("double+double",
+ "6.1415926",
+ Patterns::Double(),
+ "docs 3");
}
prm.leave_subsection();
prm.enter_subsection("Testing%testing");
{
prm.declare_entry("double 2", "4.321", Patterns::Double(), "doc 4");
- prm.declare_entry(
- "string&list", "< & > ; /", Patterns::Anything(), "docs 1");
+ prm.declare_entry("string&list",
+ "< & > ; /",
+ Patterns::Anything(),
+ "docs 1");
prm.declare_entry("int*int", "2", Patterns::Integer());
- prm.declare_entry(
- "double+double", "6.1415926", Patterns::Double(), "docs 3");
+ prm.declare_entry("double+double",
+ "6.1415926",
+ Patterns::Double(),
+ "docs 3");
}
prm.leave_subsection();
}
prm.enter_subsection("Testing%testing");
{
prm.declare_entry("double 2", "4.321", Patterns::Double(), "doc 4");
- prm.declare_entry(
- "string&list", "< & > ; /", Patterns::Anything(), "docs 1");
+ prm.declare_entry("string&list",
+ "< & > ; /",
+ Patterns::Anything(),
+ "docs 1");
prm.declare_entry("int*int", "2", Patterns::Integer());
- prm.declare_entry(
- "double+double", "6.1415926", Patterns::Double(), "docs 3");
+ prm.declare_entry("double+double",
+ "6.1415926",
+ Patterns::Double(),
+ "docs 3");
}
prm.leave_subsection();
}
prm.enter_subsection("Testing%testing");
{
prm.declare_entry("double 2", "4.321", Patterns::Double(), "doc 4");
- prm.declare_entry(
- "string&list", "< & > ; /", Patterns::Anything(), "docs 1");
+ prm.declare_entry("string&list",
+ "< & > ; /",
+ Patterns::Anything(),
+ "docs 1");
prm.declare_entry("int*int", "2", Patterns::Integer());
- prm.declare_entry(
- "double+double", "6.1415926", Patterns::Double(), "docs 3");
+ prm.declare_entry("double+double",
+ "6.1415926",
+ Patterns::Double(),
+ "docs 3");
}
prm.leave_subsection();
}
// things with strange characters
prm.enter_subsection("Testing%testing");
{
- prm.declare_entry(
- "string&list", "< & > ; /", Patterns::Anything(), "docs 1");
+ prm.declare_entry("string&list",
+ "< & > ; /",
+ Patterns::Anything(),
+ "docs 1");
prm.declare_entry("int*int", "2", Patterns::Integer());
- prm.declare_entry(
- "double+double", "6.1415926", Patterns::Double(), "docs 3");
+ prm.declare_entry("double+double",
+ "6.1415926",
+ Patterns::Double(),
+ "docs 3");
}
prm.leave_subsection();
{
// create one pattern and a copy of it
- Patterns::Map map(
- Patterns::Integer(-1, 42), Patterns::Double(-1e9, 1e9), 2, 3);
+ Patterns::Map map(Patterns::Integer(-1, 42),
+ Patterns::Double(-1e9, 1e9),
+ 2,
+ 3);
Patterns::Map map2(map);
// both now go out of scope -- ensure that their destruction does
initlog();
// create a pattern and match a string
- const auto &pattern = Patterns::Tuple(
- ";", Patterns::Integer(), Patterns::Double(), Patterns::Anything());
- const std::string desc = pattern.description();
+ const auto & pattern = Patterns::Tuple(";",
+ Patterns::Integer(),
+ Patterns::Double(),
+ Patterns::Anything());
+ const std::string desc = pattern.description();
deallog << desc << std::endl;
// three patterns
{
- const auto &pattern = Patterns::Tuple(
- Patterns::Double(), Patterns::Anything(), Patterns::Bool());
+ const auto &pattern = Patterns::Tuple(Patterns::Double(),
+ Patterns::Anything(),
+ Patterns::Bool());
deallog << pattern.description(Patterns::PatternBase::OutputStyle::Machine)
<< '\n'
// things with strange characters
prm.enter_subsection("Testing%testing");
{
- prm.declare_entry(
- "string&list", "< & > ; /", Patterns::Anything(), "docs 1");
+ prm.declare_entry("string&list",
+ "< & > ; /",
+ Patterns::Anything(),
+ "docs 1");
prm.declare_entry("int*int", "2", Patterns::Integer());
- prm.declare_entry(
- "double+double", "6.1415926", Patterns::Double(), "docs 3");
+ prm.declare_entry("double+double",
+ "6.1415926",
+ Patterns::Double(),
+ "docs 3");
}
prm.leave_subsection();
{
prm.enter_subsection("section_2&3");
{
- prm.declare_entry(
- "list",
- "default_1",
- Patterns::List(Patterns::Selection("default_1|b|c|d|e|f|g|h")),
- "docs 1");
+ prm.declare_entry("list",
+ "default_1",
+ Patterns::List(
+ Patterns::Selection("default_1|b|c|d|e|f|g|h")),
+ "docs 1");
prm.declare_entry("int_hello", "1", Patterns::Integer());
prm.declare_entry("text",
"default text with _ ~ \\ # & { }",
const types::particle_index index(7);
- Particles::Particle<dim, spacedim> particle(
- position, reference_position, index);
+ Particles::Particle<dim, spacedim> particle(position,
+ reference_position,
+ index);
deallog << "Particle location: " << particle.get_location() << std::endl
<< "Particle reference location: "
const types::particle_index index(7);
- Particles::Particle<dim, spacedim> particle(
- position, reference_position, index);
+ Particles::Particle<dim, spacedim> particle(position,
+ reference_position,
+ index);
deallog << "Particle location: " << particle.get_location() << std::endl
<< "Particle reference location: "
std::vector<double> properties = {0.15, 0.45, 0.75};
- Particles::Particle<dim, spacedim> particle(
- position, reference_position, index);
+ Particles::Particle<dim, spacedim> particle(position,
+ reference_position,
+ index);
particle.set_property_pool(pool);
particle.set_properties(
ArrayView<double>(&properties[0], properties.size()));
if (dim > 2)
reference_position(2) = 0.6;
- Particles::Particle<dim, spacedim> particle(
- position, reference_position, 7);
+ Particles::Particle<dim, spacedim> particle(position,
+ reference_position,
+ 7);
deallog << "Particle location: " << particle.get_location() << std::endl;
std::pair<typename parallel::distributed::Triangulation<dim, spacedim>::
active_cell_iterator,
Point<dim>>
- cell_position = GridTools::find_active_cell_around_point(
- mapping, tr, particle.get_location());
+ cell_position =
+ GridTools::find_active_cell_around_point(mapping,
+ tr,
+ particle.get_location());
particle_handler.insert_particle(particle, cell_position.first);
particle_handler.update_cached_numbers();
if (dim > 2)
reference_position(2) = 0.6;
- Particles::Particle<dim, spacedim> particle(
- position, reference_position, 7);
+ Particles::Particle<dim, spacedim> particle(position,
+ reference_position,
+ 7);
deallog << "Particle location: " << particle.get_location() << std::endl;
std::pair<typename parallel::distributed::Triangulation<dim, spacedim>::
active_cell_iterator,
Point<dim>>
- cell_position = GridTools::find_active_cell_around_point(
- mapping, tr, particle.get_location());
+ cell_position =
+ GridTools::find_active_cell_around_point(mapping,
+ tr,
+ particle.get_location());
particle_handler.insert_particle(particle, cell_position.first);
particle_handler.insert_particle(particle, cell_position.first);
position(0) = 0.7;
- Particles::Particle<dim, spacedim> particle2(
- position, reference_position, 9);
-
- cell_position = GridTools::find_active_cell_around_point(
- mapping, tr, particle2.get_location());
+ Particles::Particle<dim, spacedim> particle2(position,
+ reference_position,
+ 9);
+
+ cell_position =
+ GridTools::find_active_cell_around_point(mapping,
+ tr,
+ particle2.get_location());
particle_handler.insert_particle(particle2, cell_position.first);
particle_handler.update_cached_numbers();
position[1](i) = 0.75;
}
- Particles::Particle<dim, spacedim> particle1(
- position[0], reference_position[0], 0);
- Particles::Particle<dim, spacedim> particle2(
- position[1], reference_position[1], 1);
-
- typename Triangulation<dim, spacedim>::active_cell_iterator cell1(
- &tr, 1, 0);
- typename Triangulation<dim, spacedim>::active_cell_iterator cell2(
- &tr, 1, 0);
+ Particles::Particle<dim, spacedim> particle1(position[0],
+ reference_position[0],
+ 0);
+ Particles::Particle<dim, spacedim> particle2(position[1],
+ reference_position[1],
+ 1);
+
+ typename Triangulation<dim, spacedim>::active_cell_iterator cell1(&tr,
+ 1,
+ 0);
+ typename Triangulation<dim, spacedim>::active_cell_iterator cell2(&tr,
+ 1,
+ 0);
particle_handler.insert_particle(particle1, cell1);
particle_handler.insert_particle(particle2, cell2);
position[1](i) = 0.525;
}
- Particles::Particle<dim, spacedim> particle1(
- position[0], reference_position[0], 0);
- Particles::Particle<dim, spacedim> particle2(
- position[1], reference_position[1], 1);
-
- typename Triangulation<dim, spacedim>::active_cell_iterator cell1(
- &tr, 2, 0);
- typename Triangulation<dim, spacedim>::active_cell_iterator cell2(
- &tr, 2, 0);
+ Particles::Particle<dim, spacedim> particle1(position[0],
+ reference_position[0],
+ 0);
+ Particles::Particle<dim, spacedim> particle2(position[1],
+ reference_position[1],
+ 1);
+
+ typename Triangulation<dim, spacedim>::active_cell_iterator cell1(&tr,
+ 2,
+ 0);
+ typename Triangulation<dim, spacedim>::active_cell_iterator cell2(&tr,
+ 2,
+ 0);
particle_handler.insert_particle(particle1, cell1);
particle_handler.insert_particle(particle2, cell2);
static_cast<double>(particles_per_direction - 1);
id = i * particles_per_direction * particles_per_direction +
j * particles_per_direction + k;
- Particles::Particle<dim, spacedim> particle(
- position, reference_position, id);
+ Particles::Particle<dim, spacedim> particle(position,
+ reference_position,
+ id);
typename parallel::distributed::Triangulation<dim, spacedim>::
active_cell_iterator cell =
}
else
{
- Particles::Particle<dim, spacedim> particle(
- position, reference_position, id);
+ Particles::Particle<dim, spacedim> particle(position,
+ reference_position,
+ id);
typename parallel::distributed::Triangulation<dim, spacedim>::
active_cell_iterator cell =
deallog << "Check 5: " << (v1 == v2 ? "true" : "false") << std::endl;
// check std::transform
- std::transform(
- v1.begin(),
- v1.end(),
- v2.begin(),
- std::bind(std::multiplies<double>(), std::placeholders::_1, 2.0));
+ std::transform(v1.begin(),
+ v1.end(),
+ v2.begin(),
+ std::bind(std::multiplies<double>(),
+ std::placeholders::_1,
+ 2.0));
v2.compress(VectorOperation::insert);
v2 *= 1. / 2.;
deallog << "Check 6: " << (v1 == v2 ? "true" : "false") << std::endl;
PETScWrappers::MPI::Vector vb(local_active, MPI_COMM_WORLD);
PETScWrappers::MPI::Vector v(local_active, local_relevant, MPI_COMM_WORLD);
- LinearAlgebra::distributed::Vector<double> copied(
- local_active, local_relevant, MPI_COMM_WORLD);
+ LinearAlgebra::distributed::Vector<double> copied(local_active,
+ local_relevant,
+ MPI_COMM_WORLD);
// set local values
vb(myid * 2) = myid * 2.0;
local_relevant.add_range(1, 2);
PETScWrappers::MPI::Vector vb_one(local_active, MPI_COMM_WORLD);
- PETScWrappers::MPI::Vector v_one(
- local_active, local_relevant, MPI_COMM_WORLD);
+ PETScWrappers::MPI::Vector v_one(local_active,
+ local_relevant,
+ MPI_COMM_WORLD);
- LinearAlgebra::distributed::Vector<double> copied_one(
- local_active, local_relevant, MPI_COMM_WORLD);
+ LinearAlgebra::distributed::Vector<double> copied_one(local_active,
+ local_relevant,
+ MPI_COMM_WORLD);
// set local values
vb_one(myid * 2) = myid * 2.0;
PreconditionIdentity preconditioner;
deallog << "Solver type: " << typeid(solver).name() << std::endl;
- check_solver_within_range(
- solver.solve(A, u, f, preconditioner), control.last_step(), 42, 44);
+ check_solver_within_range(solver.solve(A, u, f, preconditioner),
+ control.last_step(),
+ 42,
+ 44);
}
GrowingVectorMemory<PETScWrappers::MPI::Vector>::release_unused_memory();
}
SolverBicgstab<PETScWrappers::MPI::Vector> solver(control, mem);
PreconditionIdentity preconditioner;
deallog << "Solver type: " << typeid(solver).name() << std::endl;
- check_solver_within_range(
- solver.solve(A, u, f, preconditioner), control.last_step(), 48, 51);
+ check_solver_within_range(solver.solve(A, u, f, preconditioner),
+ control.last_step(),
+ 48,
+ 51);
}
GrowingVectorMemory<PETScWrappers::MPI::Vector>::release_unused_memory();
}
SolverGMRES<PETScWrappers::MPI::Vector> solver(control, mem);
PreconditionIdentity preconditioner;
deallog << "Solver type: " << typeid(solver).name() << std::endl;
- check_solver_within_range(
- solver.solve(A, u, f, preconditioner), control.last_step(), 74, 76);
+ check_solver_within_range(solver.solve(A, u, f, preconditioner),
+ control.last_step(),
+ 74,
+ 76);
}
GrowingVectorMemory<PETScWrappers::MPI::Vector>::release_unused_memory();
}
SolverMinRes<PETScWrappers::MPI::Vector> solver(control, mem);
PreconditionIdentity preconditioner;
deallog << "Solver type: " << typeid(solver).name() << std::endl;
- check_solver_within_range(
- solver.solve(A, u, f, preconditioner), control.last_step(), 42, 44);
+ check_solver_within_range(solver.solve(A, u, f, preconditioner),
+ control.last_step(),
+ 42,
+ 44);
}
GrowingVectorMemory<PETScWrappers::MPI::Vector>::release_unused_memory();
}
SolverQMRS<PETScWrappers::MPI::Vector> solver(control, mem);
PreconditionIdentity preconditioner;
deallog << "Solver type: " << typeid(solver).name() << std::endl;
- check_solver_within_range(
- solver.solve(A, u, f, preconditioner), control.last_step(), 45, 47);
+ check_solver_within_range(solver.solve(A, u, f, preconditioner),
+ control.last_step(),
+ 45,
+ 47);
}
GrowingVectorMemory<PETScWrappers::MPI::Vector>::release_unused_memory();
}
sparse_matrix.compress(VectorOperation::insert);
MatrixOut matrix_out;
- matrix_out.build_patches(
- sparse_matrix, "sparse_matrix", MatrixOut::Options(true, 1, true));
+ matrix_out.build_patches(sparse_matrix,
+ "sparse_matrix",
+ MatrixOut::Options(true, 1, true));
matrix_out.write_gnuplot(logfile);
}
}
// --------------- inline and template functions -----------------
-inline PetscFDMatrix::PetscFDMatrix(unsigned int size, unsigned int dim) :
- PETScWrappers::MatrixFree(dim, dim, dim, dim),
- nx(size),
- ny(size)
+inline PetscFDMatrix::PetscFDMatrix(unsigned int size, unsigned int dim)
+ : PETScWrappers::MatrixFree(dim, dim, dim, dim)
+ , nx(size)
+ , ny(size)
{}
PETScWrappers::SolverRichardson solver(control);
PETScWrappers::PreconditionJacobi preconditioner(A);
- check_solver_within_range(
- solver.solve(A, u, f, preconditioner), control.last_step(), 2295, 2300);
+ check_solver_within_range(solver.solve(A, u, f, preconditioner),
+ control.last_step(),
+ 2295,
+ 2300);
}
}
PETScWrappers::SolverChebychev solver(control);
PETScWrappers::PreconditionJacobi preconditioner(A);
- check_solver_within_range(
- solver.solve(A, u, f, preconditioner), control.last_step(), 1050, 1150);
+ check_solver_within_range(solver.solve(A, u, f, preconditioner),
+ control.last_step(),
+ 1050,
+ 1150);
}
}
PETScWrappers::SolverCG solver(control);
PETScWrappers::PreconditionJacobi preconditioner(A);
deallog << "Solver type: " << typeid(solver).name() << std::endl;
- check_solver_within_range(
- solver.solve(A, u, f, preconditioner), control.last_step(), 40, 42);
+ check_solver_within_range(solver.solve(A, u, f, preconditioner),
+ control.last_step(),
+ 40,
+ 42);
}
}
PETScWrappers::SolverCG solver(control);
PETScWrappers::PreconditionNone preconditioner(A);
deallog << "Solver type: " << typeid(solver).name() << std::endl;
- check_solver_within_range(
- solver.solve(A, u, f, preconditioner), control.last_step(), 42, 44);
+ check_solver_within_range(solver.solve(A, u, f, preconditioner),
+ control.last_step(),
+ 42,
+ 44);
}
}
deallog << "Solver type: " << typeid(solver).name() << std::endl;
- check_solver_within_range(
- solver.solve(A, u, f, preconditioner), control.last_step(), 3, 5);
+ check_solver_within_range(solver.solve(A, u, f, preconditioner),
+ control.last_step(),
+ 3,
+ 5);
}
}
deallog << "Solver type: " << typeid(solver).name() << std::endl;
- check_solver_within_range(
- solver.solve(A, u, f, preconditioner), control.last_step(), 3, 5);
+ check_solver_within_range(solver.solve(A, u, f, preconditioner),
+ control.last_step(),
+ 3,
+ 5);
}
}
PETScWrappers::PreconditionEisenstat preconditioner(A);
deallog << "Solver type: " << typeid(solver).name() << std::endl;
- check_solver_within_range(
- solver.solve(A, u, f, preconditioner), control.last_step(), 19, 21);
+ check_solver_within_range(solver.solve(A, u, f, preconditioner),
+ control.last_step(),
+ 19,
+ 21);
}
}
PETScWrappers::PreconditionICC preconditioner(A);
deallog << "Solver type: " << typeid(solver).name() << std::endl;
- check_solver_within_range(
- solver.solve(A, u, f, preconditioner), control.last_step(), 16, 18);
+ check_solver_within_range(solver.solve(A, u, f, preconditioner),
+ control.last_step(),
+ 16,
+ 18);
}
}
PETScWrappers::SolverCG solver(control);
PETScWrappers::PreconditionILU preconditioner(A);
deallog << "Solver type: " << typeid(solver).name() << std::endl;
- check_solver_within_range(
- solver.solve(A, u, f, preconditioner), control.last_step(), 16, 18);
+ check_solver_within_range(solver.solve(A, u, f, preconditioner),
+ control.last_step(),
+ 16,
+ 18);
}
}
PETScWrappers::SolverCG solver(control);
PETScWrappers::PreconditionLU preconditioner(A);
deallog << "Solver type: " << typeid(solver).name() << std::endl;
- check_solver_within_range(
- solver.solve(A, u, f, preconditioner), control.last_step(), 1, 1);
+ check_solver_within_range(solver.solve(A, u, f, preconditioner),
+ control.last_step(),
+ 1,
+ 1);
}
}
PETScWrappers::SolverCG solver(control);
PETScWrappers::PreconditionParaSails preconditioner(A);
deallog << "Solver type: " << typeid(solver).name() << std::endl;
- check_solver_within_range(
- solver.solve(A, u, f, preconditioner), control.last_step(), 18, 20);
+ check_solver_within_range(solver.solve(A, u, f, preconditioner),
+ control.last_step(),
+ 18,
+ 20);
}
}
PETScWrappers::SolverCG solver(control);
PETScWrappers::PreconditionSOR preconditioner(A);
deallog << "Solver type: " << typeid(solver).name() << std::endl;
- check_solver_within_range(
- solver.solve(A, u, f, preconditioner), control.last_step(), 18, 20);
+ check_solver_within_range(solver.solve(A, u, f, preconditioner),
+ control.last_step(),
+ 18,
+ 20);
}
}
PETScWrappers::SolverCG solver(control);
PETScWrappers::PreconditionSSOR preconditioner(A);
deallog << "Solver type: " << typeid(solver).name() << std::endl;
- check_solver_within_range(
- solver.solve(A, u, f, preconditioner), control.last_step(), 18, 20);
+ check_solver_within_range(solver.solve(A, u, f, preconditioner),
+ control.last_step(),
+ 18,
+ 20);
}
}
PETScWrappers::SolverBiCG solver(control);
PETScWrappers::PreconditionJacobi preconditioner(A);
deallog << "Solver type: " << typeid(solver).name() << std::endl;
- check_solver_within_range(
- solver.solve(A, u, f, preconditioner), control.last_step(), 40, 42);
+ check_solver_within_range(solver.solve(A, u, f, preconditioner),
+ control.last_step(),
+ 40,
+ 42);
}
}
PETScWrappers::SolverGMRES solver(control);
PETScWrappers::PreconditionJacobi preconditioner(A);
deallog << "Solver type: " << typeid(solver).name() << std::endl;
- check_solver_within_range(
- solver.solve(A, u, f, preconditioner), control.last_step(), 47, 49);
+ check_solver_within_range(solver.solve(A, u, f, preconditioner),
+ control.last_step(),
+ 47,
+ 49);
}
}
PETScWrappers::SolverBicgstab solver(control);
PETScWrappers::PreconditionJacobi preconditioner(A);
deallog << "Solver type: " << typeid(solver).name() << std::endl;
- check_solver_within_range(
- solver.solve(A, u, f, preconditioner), control.last_step(), 32, 34);
+ check_solver_within_range(solver.solve(A, u, f, preconditioner),
+ control.last_step(),
+ 32,
+ 34);
}
}
PETScWrappers::SolverCGS solver(control);
PETScWrappers::PreconditionJacobi preconditioner(A);
deallog << "Solver type: " << typeid(solver).name() << std::endl;
- check_solver_within_range(
- solver.solve(A, u, f, preconditioner), control.last_step(), 39, 41);
+ check_solver_within_range(solver.solve(A, u, f, preconditioner),
+ control.last_step(),
+ 39,
+ 41);
}
}
PETScWrappers::SolverTFQMR solver(control);
PETScWrappers::PreconditionJacobi preconditioner(A);
deallog << "Solver type: " << typeid(solver).name() << std::endl;
- check_solver_within_range(
- solver.solve(A, u, f, preconditioner), control.last_step(), 39, 41);
+ check_solver_within_range(solver.solve(A, u, f, preconditioner),
+ control.last_step(),
+ 39,
+ 41);
}
}
PETScWrappers::SolverTCQMR solver(control);
PETScWrappers::PreconditionJacobi preconditioner(A);
deallog << "Solver type: " << typeid(solver).name() << std::endl;
- check_solver_within_range(
- solver.solve(A, u, f, preconditioner), control.last_step(), 43, 45);
+ check_solver_within_range(solver.solve(A, u, f, preconditioner),
+ control.last_step(),
+ 43,
+ 45);
}
}
PETScWrappers::SolverCR solver(control);
PETScWrappers::PreconditionJacobi preconditioner(A);
deallog << "Solver type: " << typeid(solver).name() << std::endl;
- check_solver_within_range(
- solver.solve(A, u, f, preconditioner), control.last_step(), 40, 42);
+ check_solver_within_range(solver.solve(A, u, f, preconditioner),
+ control.last_step(),
+ 40,
+ 42);
}
}
PETScWrappers::SolverLSQR solver(control);
PETScWrappers::PreconditionJacobi preconditioner(A);
- check_solver_within_range(
- solver.solve(A, u, f, preconditioner), control.last_step(), 171, 175);
+ check_solver_within_range(solver.solve(A, u, f, preconditioner),
+ control.last_step(),
+ 171,
+ 175);
}
}
PETScWrappers::PreconditionJacobi preconditioner(A);
deallog << "Solver type: " << typeid(solver).name() << std::endl;
- check_solver_within_range(
- solver.solve(A, u, f, preconditioner), control.last_step(), 1, 11);
+ check_solver_within_range(solver.solve(A, u, f, preconditioner),
+ control.last_step(),
+ 1,
+ 11);
// run twice because this errored out at some point
u = 0.;
deallog << "Solver type: " << typeid(solver).name() << std::endl;
- check_solver_within_range(
- solver.solve(A, u, f, preconditioner), control.last_step(), 1, 1);
+ check_solver_within_range(solver.solve(A, u, f, preconditioner),
+ control.last_step(),
+ 1,
+ 1);
}
}
PETScWrappers::PreconditionJacobi preconditioner(A);
deallog << "Solver type: " << typeid(solver).name() << std::endl;
- check_solver_within_range(
- solver.solve(A, u, f, preconditioner), control.last_step(), 1, 1);
+ check_solver_within_range(solver.solve(A, u, f, preconditioner),
+ control.last_step(),
+ 1,
+ 1);
deallog << u.l2_norm() << std::endl;
deallog << "Solver type: " << typeid(solver).name() << std::endl;
- check_solver_within_range(
- solver.solve(A, t, u, preconditioner), control.last_step(), 1, 1);
+ check_solver_within_range(solver.solve(A, t, u, preconditioner),
+ control.last_step(),
+ 1,
+ 1);
deallog << t.l2_norm() << std::endl;
u = 0;
AssertThrow(m(i, j) == std::complex<double>((i * j * .5 + .5) * 1.25,
i * j * .5 * 1.25),
ExcInternalError());
- AssertThrow(
- m.el(i, j) ==
- std::complex<double>((i * j * .5 + .5) * 1.25, i * j * .5 * 1.25),
- ExcInternalError());
+ AssertThrow(m.el(i, j) ==
+ std::complex<double>((i * j * .5 + .5) * 1.25,
+ i * j * .5 * 1.25),
+ ExcInternalError());
}
else
{
// check that is what we get by casting PetscScalar to std::real()
// and std::imag()
for (unsigned int k = 0; k < v.size(); ++k)
- AssertThrow(
- (static_cast<std::complex<double>>(v(k)).real() == k) &&
- (static_cast<std::complex<double>>(v(k)).imag() == v.size() - k),
- ExcInternalError());
+ AssertThrow((static_cast<std::complex<double>>(v(k)).real() == k) &&
+ (static_cast<std::complex<double>>(v(k)).imag() ==
+ v.size() - k),
+ ExcInternalError());
// check that is what we get by
// dealii::internal::VectorReference::real() and
LinearAlgebra::distributed::Vector<double> vector_Re,
vector_Re_locally_relevant, vector_Im, vector_Im_locally_relevant;
vector.reinit(locally_owned_dofs, mpi_communicator);
- vector_locally_relevant.reinit(
- locally_owned_dofs, locally_relevant_dofs, mpi_communicator);
+ vector_locally_relevant.reinit(locally_owned_dofs,
+ locally_relevant_dofs,
+ mpi_communicator);
vector_Re.reinit(locally_owned_dofs, mpi_communicator);
- vector_Re_locally_relevant.reinit(
- locally_owned_dofs, locally_relevant_dofs, mpi_communicator);
+ vector_Re_locally_relevant.reinit(locally_owned_dofs,
+ locally_relevant_dofs,
+ mpi_communicator);
vector_Im.reinit(locally_owned_dofs, mpi_communicator);
- vector_Im_locally_relevant.reinit(
- locally_owned_dofs, locally_relevant_dofs, mpi_communicator);
+ vector_Im_locally_relevant.reinit(locally_owned_dofs,
+ locally_relevant_dofs,
+ mpi_communicator);
const types::global_dof_index n_local_dofs = locally_owned_dofs.n_elements();
// a separate quadrature formula
// enough for mass and kinetic matrices assembly
QGauss<dim> quadrature_formula(poly_degree + 1);
- FEValues<dim> fe_values(
- fe, quadrature_formula, update_values | update_JxW_values);
+ FEValues<dim> fe_values(fe,
+ quadrature_formula,
+ update_values | update_JxW_values);
const unsigned int dofs_per_cell = fe.dofs_per_cell;
const unsigned int n_q_points = quadrature_formula.size();
mpi_communicator,
locally_relevant_dofs);
- mass_matrix.reinit(
- locally_owned_dofs, locally_owned_dofs, dsp, mpi_communicator);
+ mass_matrix.reinit(locally_owned_dofs,
+ locally_owned_dofs,
+ dsp,
+ mpi_communicator);
// assemble mass matrix:
mass_matrix = PetscScalar();
}
cell->get_dof_indices(local_dof_indices);
- constraints.distribute_local_to_global(
- cell_mass_matrix, local_dof_indices, mass_matrix);
+ constraints.distribute_local_to_global(cell_mass_matrix,
+ local_dof_indices,
+ mass_matrix);
}
mass_matrix.compress(VectorOperation::add);
PETScWrappers::SolverRichardson solver(control);
PETScWrappers::PreconditionJacobi preconditioner(A);
- check_solver_within_range(
- solver.solve(A, u, f, preconditioner), control.last_step(), 2295, 2300);
+ check_solver_within_range(solver.solve(A, u, f, preconditioner),
+ control.last_step(),
+ 2295,
+ 2300);
}
}
PETScWrappers::SolverChebychev solver(control);
PETScWrappers::PreconditionJacobi preconditioner(A);
- check_solver_within_range(
- solver.solve(A, u, f, preconditioner), control.last_step(), 1050, 1141);
+ check_solver_within_range(solver.solve(A, u, f, preconditioner),
+ control.last_step(),
+ 1050,
+ 1141);
}
}
Assert((F_t1 - unit_symmetric_tensor<dim>()).norm() < tol,
ExcMessage("Incorrect computation of F_t1"));
const Tensor<2, dim> F = Kinematics::F(Grad_u);
- Assert(
- (F - (static_cast<Tensor<2, dim>>(unit_symmetric_tensor<dim>()) +
- Grad_u))
- .norm() < tol,
- ExcMessage("Incorrect computation of F"));
+ Assert((F -
+ (static_cast<Tensor<2, dim>>(unit_symmetric_tensor<dim>()) +
+ Grad_u))
+ .norm() < tol,
+ ExcMessage("Incorrect computation of F"));
// Volumetric / isochoric split of deformation gradient
Assert(determinant(F) != 1.0,
ExcMessage("F_vol has no dilatating action"));
// Right Cauchy-Green tensor
- Assert(
- (static_cast<Tensor<2, dim>>(Kinematics::C(F)) - transpose(F) * F)
- .norm() < tol,
- ExcMessage("Incorrect computation of C"));
+ Assert((static_cast<Tensor<2, dim>>(Kinematics::C(F)) -
+ transpose(F) * F)
+ .norm() < tol,
+ ExcMessage("Incorrect computation of C"));
// Left Cauchy-Green tensor
- Assert(
- (static_cast<Tensor<2, dim>>(Kinematics::b(F)) - F * transpose(F))
- .norm() < tol,
- ExcMessage("Incorrect computation of b"));
+ Assert((static_cast<Tensor<2, dim>>(Kinematics::b(F)) -
+ F * transpose(F))
+ .norm() < tol,
+ ExcMessage("Incorrect computation of b"));
// Small strain tensor
Assert((static_cast<Tensor<2, dim>>(Kinematics::epsilon(Grad_u)) -
ExcMessage("Incorrect computation of epsilon"));
// Green-Lagrange strain tensor
- Assert(
- (static_cast<Tensor<2, dim>>(Kinematics::E(F)) -
- 0.5 * (Grad_u + transpose(Grad_u) + transpose(Grad_u) * Grad_u))
- .norm() < tol,
- ExcMessage("Incorrect computation of E"));
+ Assert((static_cast<Tensor<2, dim>>(Kinematics::E(F)) -
+ 0.5 *
+ (Grad_u + transpose(Grad_u) + transpose(Grad_u) * Grad_u))
+ .norm() < tol,
+ ExcMessage("Incorrect computation of E"));
// Almansi strain tensor
// Holzapfel 2.82
const Tensor<2, dim> &dot_grad_u = qp_dot_grad_u_t[q_point];
// Spatial velocity gradient
- Assert(
- (static_cast<Tensor<2, dim>>(Kinematics::l(F, F_dot)) - dot_grad_u)
- .norm() < tol,
- ExcMessage("Incorrect computation of l"));
+ Assert((static_cast<Tensor<2, dim>>(Kinematics::l(F, F_dot)) -
+ dot_grad_u)
+ .norm() < tol,
+ ExcMessage("Incorrect computation of l"));
// Rate of deformation tensor
Assert((static_cast<Tensor<2, dim>>(Kinematics::d(F, F_dot)) -
Tensor<3, dim, double> C;
initialize(A);
initialize(C);
- const Tensor<1, dim, double> B = double_contract<0, 0, 1, 1>(
- C, A); // This implies that a Tvmult is necessary
+ const Tensor<1, dim, double> B =
+ double_contract<0, 0, 1, 1>(C,
+ A); // This implies that a Tvmult is necessary
const Vector<double> vA = Notation::Kelvin::to_vector(A);
const FullMatrix<double> mC = Notation::Kelvin::to_matrix(C);
std::vector<Vector<double>> & value_list) const;
};
template <int dim>
- BodyForce<dim>::BodyForce() : Function<dim>(dim)
+ BodyForce<dim>::BodyForce()
+ : Function<dim>(dim)
{}
template <int dim>
inline void
template <int dim>
IncrementalBoundaryValues<dim>::IncrementalBoundaryValues(
const double present_time,
- const double present_timestep) :
- Function<dim>(dim),
- velocity(.1),
- present_time(present_time),
- present_timestep(present_timestep)
+ const double present_timestep)
+ : Function<dim>(dim)
+ , velocity(.1)
+ , present_time(present_time)
+ , present_timestep(present_timestep)
{}
template <int dim>
void
get_stress_strain_tensor<dim>(/*lambda = */ 9.695e10,
/*mu = */ 7.617e10);
template <int dim>
- TopLevel<dim>::TopLevel() :
- triangulation(MPI_COMM_WORLD,
- ::Triangulation<dim>::none,
- false,
- parallel::shared::Triangulation<dim>::partition_zorder),
- fe(FE_Q<dim>(1), dim),
- dof_handler(triangulation),
- quadrature_formula(2),
- mpi_communicator(MPI_COMM_WORLD),
- n_mpi_processes(Utilities::MPI::n_mpi_processes(mpi_communicator)),
- this_mpi_process(Utilities::MPI::this_mpi_process(mpi_communicator)),
- pcout(std::cout, this_mpi_process == 0),
- monitored_vertex_first_dof(0)
+ TopLevel<dim>::TopLevel()
+ : triangulation(MPI_COMM_WORLD,
+ ::Triangulation<dim>::none,
+ false,
+ parallel::shared::Triangulation<dim>::partition_zorder)
+ , fe(FE_Q<dim>(1), dim)
+ , dof_handler(triangulation)
+ , quadrature_formula(2)
+ , mpi_communicator(MPI_COMM_WORLD)
+ , n_mpi_processes(Utilities::MPI::n_mpi_processes(mpi_communicator))
+ , this_mpi_process(Utilities::MPI::this_mpi_process(mpi_communicator))
+ , pcout(std::cout, this_mpi_process == 0)
+ , monitored_vertex_first_dof(0)
{}
template <int dim>
TopLevel<dim>::~TopLevel()
for (unsigned int j = 0; j < dofs_per_cell; ++j)
for (unsigned int q_point = 0; q_point < n_q_points; ++q_point)
{
- const SymmetricTensor<2, dim> eps_phi_i = get_strain(
- fe_values, i, q_point),
- eps_phi_j = get_strain(
- fe_values, j, q_point);
+ const SymmetricTensor<2, dim>
+ eps_phi_i = get_strain(fe_values, i, q_point),
+ eps_phi_j = get_strain(fe_values, j, q_point);
cell_matrix(i, j) += (eps_phi_i * stress_strain_tensor *
eps_phi_j * fe_values.JxW(q_point));
}
system_rhs.compress(VectorOperation::add);
FEValuesExtractors::Scalar z_component(dim - 1);
std::map<types::global_dof_index, double> boundary_values;
- VectorTools::interpolate_boundary_values(
- dof_handler, 0, Functions::ZeroFunction<dim>(dim), boundary_values);
+ VectorTools::interpolate_boundary_values(dof_handler,
+ 0,
+ Functions::ZeroFunction<dim>(dim),
+ boundary_values);
VectorTools::interpolate_boundary_values(
dof_handler,
1,
PETScWrappers::MPI::Vector distributed_incremental_displacement(
locally_owned_dofs, mpi_communicator);
distributed_incremental_displacement = incremental_displacement;
- SolverControl solver_control(
- dof_handler.n_dofs(), 1e-16 * system_rhs.l2_norm(), false, false);
+ SolverControl solver_control(dof_handler.n_dofs(),
+ 1e-16 * system_rhs.l2_norm(),
+ false,
+ false);
PETScWrappers::SolverCG cg(solver_control, mpi_communicator);
PETScWrappers::PreconditionBlockJacobi preconditioner(system_matrix);
cg.solve(system_matrix,
distributed_error_per_cell(i) = error_per_cell(i);
distributed_error_per_cell.compress(VectorOperation::insert);
error_per_cell = distributed_error_per_cell;
- GridRefinement::refine_and_coarsen_fixed_number(
- triangulation, error_per_cell, 0.25, 0.03);
+ GridRefinement::refine_and_coarsen_fixed_number(triangulation,
+ error_per_cell,
+ 0.25,
+ 0.03);
triangulation.execute_coarsening_and_refinement();
setup_quadrature_point_history();
}
void
TopLevel<dim>::update_quadrature_point_history()
{
- FEValues<dim> fe_values(
- fe, quadrature_formula, update_values | update_gradients);
+ FEValues<dim> fe_values(fe,
+ quadrature_formula,
+ update_values | update_gradients);
std::vector<std::vector<Tensor<1, dim>>> displacement_increment_grads(
quadrature_formula.size(), std::vector<Tensor<1, dim>>(dim));
for (typename DoFHandler<dim>::active_cell_iterator cell =
std::vector<Vector<double>> & value_list) const;
};
template <int dim>
- BodyForce<dim>::BodyForce() : Function<dim>(dim)
+ BodyForce<dim>::BodyForce()
+ : Function<dim>(dim)
{}
template <int dim>
inline void
template <int dim>
IncrementalBoundaryValues<dim>::IncrementalBoundaryValues(
const double present_time,
- const double present_timestep) :
- Function<dim>(dim),
- velocity(.1),
- present_time(present_time),
- present_timestep(present_timestep)
+ const double present_timestep)
+ : Function<dim>(dim)
+ , velocity(.1)
+ , present_time(present_time)
+ , present_timestep(present_timestep)
{}
template <int dim>
void
get_stress_strain_tensor<dim>(/*lambda = */ 9.695e10,
/*mu = */ 7.617e10);
template <int dim>
- TopLevel<dim>::TopLevel() :
- triangulation(MPI_COMM_WORLD,
- ::Triangulation<dim>::none,
- false,
- parallel::shared::Triangulation<dim>::partition_zorder),
- fe(FE_Q<dim>(1), dim),
- dof_handler(triangulation),
- quadrature_formula(2),
- mpi_communicator(MPI_COMM_WORLD),
- n_mpi_processes(Utilities::MPI::n_mpi_processes(mpi_communicator)),
- this_mpi_process(Utilities::MPI::this_mpi_process(mpi_communicator)),
- pcout(std::cout, this_mpi_process == 0),
- monitored_vertex_first_dof(0)
+ TopLevel<dim>::TopLevel()
+ : triangulation(MPI_COMM_WORLD,
+ ::Triangulation<dim>::none,
+ false,
+ parallel::shared::Triangulation<dim>::partition_zorder)
+ , fe(FE_Q<dim>(1), dim)
+ , dof_handler(triangulation)
+ , quadrature_formula(2)
+ , mpi_communicator(MPI_COMM_WORLD)
+ , n_mpi_processes(Utilities::MPI::n_mpi_processes(mpi_communicator))
+ , this_mpi_process(Utilities::MPI::this_mpi_process(mpi_communicator))
+ , pcout(std::cout, this_mpi_process == 0)
+ , monitored_vertex_first_dof(0)
{}
template <int dim>
TopLevel<dim>::~TopLevel()
for (unsigned int j = 0; j < dofs_per_cell; ++j)
for (unsigned int q_point = 0; q_point < n_q_points; ++q_point)
{
- const SymmetricTensor<2, dim> eps_phi_i = get_strain(
- fe_values, i, q_point),
- eps_phi_j = get_strain(
- fe_values, j, q_point);
+ const SymmetricTensor<2, dim>
+ eps_phi_i = get_strain(fe_values, i, q_point),
+ eps_phi_j = get_strain(fe_values, j, q_point);
cell_matrix(i, j) += (eps_phi_i * stress_strain_tensor *
eps_phi_j * fe_values.JxW(q_point));
}
system_rhs.compress(VectorOperation::add);
FEValuesExtractors::Scalar z_component(dim - 1);
std::map<types::global_dof_index, double> boundary_values;
- VectorTools::interpolate_boundary_values(
- dof_handler, 0, Functions::ZeroFunction<dim>(dim), boundary_values);
+ VectorTools::interpolate_boundary_values(dof_handler,
+ 0,
+ Functions::ZeroFunction<dim>(dim),
+ boundary_values);
VectorTools::interpolate_boundary_values(
dof_handler,
1,
PETScWrappers::MPI::Vector distributed_incremental_displacement(
locally_owned_dofs, mpi_communicator);
distributed_incremental_displacement = incremental_displacement;
- SolverControl solver_control(
- dof_handler.n_dofs(), 1e-16 * system_rhs.l2_norm(), false, false);
+ SolverControl solver_control(dof_handler.n_dofs(),
+ 1e-16 * system_rhs.l2_norm(),
+ false,
+ false);
PETScWrappers::SolverCG cg(solver_control, mpi_communicator);
PETScWrappers::PreconditionBlockJacobi preconditioner(system_matrix);
cg.solve(system_matrix,
distributed_error_per_cell(i) = error_per_cell(i);
distributed_error_per_cell.compress(VectorOperation::insert);
error_per_cell = distributed_error_per_cell;
- GridRefinement::refine_and_coarsen_fixed_number(
- triangulation, error_per_cell, 0.25, 0.03);
+ GridRefinement::refine_and_coarsen_fixed_number(triangulation,
+ error_per_cell,
+ 0.25,
+ 0.03);
triangulation.execute_coarsening_and_refinement();
setup_quadrature_point_history();
}
void
TopLevel<dim>::update_quadrature_point_history()
{
- FEValues<dim> fe_values(
- fe, quadrature_formula, update_values | update_gradients);
+ FEValues<dim> fe_values(fe,
+ quadrature_formula,
+ update_values | update_gradients);
std::vector<std::vector<Tensor<1, dim>>> displacement_increment_grads(
quadrature_formula.size(), std::vector<Tensor<1, dim>>(dim));
for (typename DoFHandler<dim>::active_cell_iterator cell =
"0.4999",
Patterns::Double(-1.0, 0.5),
"Poisson's ratio");
- prm.declare_entry(
- "Shear modulus", "80.194e6", Patterns::Double(), "Shear modulus");
+ prm.declare_entry("Shear modulus",
+ "80.194e6",
+ Patterns::Double(),
+ "Shear modulus");
}
prm.leave_subsection();
}
prm.enter_subsection("Time");
{
prm.declare_entry("End time", "1", Patterns::Double(), "End time");
- prm.declare_entry(
- "Time step size", "0.1", Patterns::Double(), "Time step size");
+ prm.declare_entry("Time step size",
+ "0.1",
+ Patterns::Double(),
+ "Time step size");
}
prm.leave_subsection();
}
class Time
{
public:
- Time(const double time_end, const double delta_t) :
- timestep(0),
- time_current(0.0),
- time_end(time_end),
- delta_t(delta_t)
+ Time(const double time_end, const double delta_t)
+ : timestep(0)
+ , time_current(0.0)
+ , time_end(time_end)
+ , delta_t(delta_t)
{}
virtual ~Time()
{}
class Material_Compressible_Neo_Hook_Three_Field
{
public:
- Material_Compressible_Neo_Hook_Three_Field(const double mu,
- const double nu) :
- kappa((2.0 * mu * (1.0 + nu)) / (3.0 * (1.0 - 2.0 * nu))),
- c_1(mu / 2.0),
- p_tilde(0.0),
- J_tilde(1.0),
- det_F(1.0),
- F(Physics::Elasticity::StandardTensors<dim>::I),
- C_inv(Physics::Elasticity::StandardTensors<dim>::I)
+ Material_Compressible_Neo_Hook_Three_Field(const double mu, const double nu)
+ : kappa((2.0 * mu * (1.0 + nu)) / (3.0 * (1.0 - 2.0 * nu)))
+ , c_1(mu / 2.0)
+ , p_tilde(0.0)
+ , J_tilde(1.0)
+ , det_F(1.0)
+ , F(Physics::Elasticity::StandardTensors<dim>::I)
+ , C_inv(Physics::Elasticity::StandardTensors<dim>::I)
{
Assert(kappa > 0, ExcInternalError());
}
class PointHistory
{
public:
- PointHistory() :
- F_inv(Physics::Elasticity::StandardTensors<dim>::I),
- tau(SymmetricTensor<2, dim>()),
- d2Psi_vol_dJ2(0.0),
- dPsi_vol_dJ(0.0),
- Jc(SymmetricTensor<4, dim>())
+ PointHistory()
+ : F_inv(Physics::Elasticity::StandardTensors<dim>::I)
+ , tau(SymmetricTensor<2, dim>())
+ , d2Psi_vol_dJ2(0.0)
+ , dPsi_vol_dJ(0.0)
+ , Jc(SymmetricTensor<4, dim>())
{}
virtual ~PointHistory()
{}
void
setup_lqp(const Parameters::AllParameters ¶meters)
{
- material.reset(new Material_Compressible_Neo_Hook_Three_Field<dim>(
- parameters.mu, parameters.nu));
+ material.reset(
+ new Material_Compressible_Neo_Hook_Three_Field<dim>(parameters.mu,
+ parameters.nu));
update_values(Tensor<2, dim>(), 0.0, 1.0);
}
void
ConditionalOStream pcout;
struct Errors
{
- Errors() : norm(1.0), u(1.0), p(1.0), J(1.0)
+ Errors()
+ : norm(1.0)
+ , u(1.0)
+ , p(1.0)
+ , J(1.0)
{}
void
reset()
print_conv_footer();
};
template <int dim>
- Solid<dim>::Solid(const std::string &input_file) :
- parameters(input_file),
- triangulation(Triangulation<dim>::maximum_smoothing),
- time(parameters.end_time, parameters.delta_t),
- timer(std::cout, TimerOutput::never, TimerOutput::wall_times),
- degree(parameters.poly_degree),
- fe(FE_Q<dim>(parameters.poly_degree),
- dim, // displacement
- FE_DGPMonomial<dim>(parameters.poly_degree - 1),
- 1, // pressure
- FE_DGPMonomial<dim>(parameters.poly_degree - 1),
- 1), // dilatation
- dof_handler_ref(triangulation),
- dofs_per_cell(fe.dofs_per_cell),
- u_fe(first_u_component),
- p_fe(p_component),
- J_fe(J_component),
- dofs_per_block(n_blocks),
- qf_cell(parameters.quad_order),
- qf_face(parameters.quad_order),
- n_q_points(qf_cell.size()),
- n_q_points_f(qf_face.size()),
- pcout(std::cout)
+ Solid<dim>::Solid(const std::string &input_file)
+ : parameters(input_file)
+ , triangulation(Triangulation<dim>::maximum_smoothing)
+ , time(parameters.end_time, parameters.delta_t)
+ , timer(std::cout, TimerOutput::never, TimerOutput::wall_times)
+ , degree(parameters.poly_degree)
+ , fe(FE_Q<dim>(parameters.poly_degree),
+ dim, // displacement
+ FE_DGPMonomial<dim>(parameters.poly_degree - 1),
+ 1, // pressure
+ FE_DGPMonomial<dim>(parameters.poly_degree - 1),
+ 1)
+ , // dilatation
+ dof_handler_ref(triangulation)
+ , dofs_per_cell(fe.dofs_per_cell)
+ , u_fe(first_u_component)
+ , p_fe(p_component)
+ , J_fe(J_component)
+ , dofs_per_block(n_blocks)
+ , qf_cell(parameters.quad_order)
+ , qf_face(parameters.quad_order)
+ , n_q_points(qf_cell.size())
+ , n_q_points_f(qf_face.size())
+ , pcout(std::cout)
{
Assert(dim == 2 || dim == 3,
ExcMessage("This problem only works in 2 or 3 space dimensions."));
{
FullMatrix<double> cell_matrix;
std::vector<types::global_dof_index> local_dof_indices;
- PerTaskData_K(const unsigned int dofs_per_cell) :
- cell_matrix(dofs_per_cell, dofs_per_cell),
- local_dof_indices(dofs_per_cell)
+ PerTaskData_K(const unsigned int dofs_per_cell)
+ : cell_matrix(dofs_per_cell, dofs_per_cell)
+ , local_dof_indices(dofs_per_cell)
{}
void
reset()
std::vector<std::vector<SymmetricTensor<2, dim>>> symm_grad_Nx;
ScratchData_K(const FiniteElement<dim> &fe_cell,
const QGauss<dim> & qf_cell,
- const UpdateFlags uf_cell) :
- fe_values_ref(fe_cell, qf_cell, uf_cell),
- Nx(qf_cell.size(), std::vector<double>(fe_cell.dofs_per_cell)),
- grad_Nx(qf_cell.size(),
- std::vector<Tensor<2, dim>>(fe_cell.dofs_per_cell)),
- symm_grad_Nx(qf_cell.size(),
- std::vector<SymmetricTensor<2, dim>>(fe_cell.dofs_per_cell))
+ const UpdateFlags uf_cell)
+ : fe_values_ref(fe_cell, qf_cell, uf_cell)
+ , Nx(qf_cell.size(), std::vector<double>(fe_cell.dofs_per_cell))
+ , grad_Nx(qf_cell.size(),
+ std::vector<Tensor<2, dim>>(fe_cell.dofs_per_cell))
+ , symm_grad_Nx(qf_cell.size(),
+ std::vector<SymmetricTensor<2, dim>>(
+ fe_cell.dofs_per_cell))
{}
- ScratchData_K(const ScratchData_K &rhs) :
- fe_values_ref(rhs.fe_values_ref.get_fe(),
- rhs.fe_values_ref.get_quadrature(),
- rhs.fe_values_ref.get_update_flags()),
- Nx(rhs.Nx),
- grad_Nx(rhs.grad_Nx),
- symm_grad_Nx(rhs.symm_grad_Nx)
+ ScratchData_K(const ScratchData_K &rhs)
+ : fe_values_ref(rhs.fe_values_ref.get_fe(),
+ rhs.fe_values_ref.get_quadrature(),
+ rhs.fe_values_ref.get_update_flags())
+ , Nx(rhs.Nx)
+ , grad_Nx(rhs.grad_Nx)
+ , symm_grad_Nx(rhs.symm_grad_Nx)
{}
void
reset()
{
Vector<double> cell_rhs;
std::vector<types::global_dof_index> local_dof_indices;
- PerTaskData_RHS(const unsigned int dofs_per_cell) :
- cell_rhs(dofs_per_cell),
- local_dof_indices(dofs_per_cell)
+ PerTaskData_RHS(const unsigned int dofs_per_cell)
+ : cell_rhs(dofs_per_cell)
+ , local_dof_indices(dofs_per_cell)
{}
void
reset()
const QGauss<dim> & qf_cell,
const UpdateFlags uf_cell,
const QGauss<dim - 1> & qf_face,
- const UpdateFlags uf_face) :
- fe_values_ref(fe_cell, qf_cell, uf_cell),
- fe_face_values_ref(fe_cell, qf_face, uf_face),
- Nx(qf_cell.size(), std::vector<double>(fe_cell.dofs_per_cell)),
- symm_grad_Nx(qf_cell.size(),
- std::vector<SymmetricTensor<2, dim>>(fe_cell.dofs_per_cell))
+ const UpdateFlags uf_face)
+ : fe_values_ref(fe_cell, qf_cell, uf_cell)
+ , fe_face_values_ref(fe_cell, qf_face, uf_face)
+ , Nx(qf_cell.size(), std::vector<double>(fe_cell.dofs_per_cell))
+ , symm_grad_Nx(qf_cell.size(),
+ std::vector<SymmetricTensor<2, dim>>(
+ fe_cell.dofs_per_cell))
{}
- ScratchData_RHS(const ScratchData_RHS &rhs) :
- fe_values_ref(rhs.fe_values_ref.get_fe(),
- rhs.fe_values_ref.get_quadrature(),
- rhs.fe_values_ref.get_update_flags()),
- fe_face_values_ref(rhs.fe_face_values_ref.get_fe(),
- rhs.fe_face_values_ref.get_quadrature(),
- rhs.fe_face_values_ref.get_update_flags()),
- Nx(rhs.Nx),
- symm_grad_Nx(rhs.symm_grad_Nx)
+ ScratchData_RHS(const ScratchData_RHS &rhs)
+ : fe_values_ref(rhs.fe_values_ref.get_fe(),
+ rhs.fe_values_ref.get_quadrature(),
+ rhs.fe_values_ref.get_update_flags())
+ , fe_face_values_ref(rhs.fe_face_values_ref.get_fe(),
+ rhs.fe_face_values_ref.get_quadrature(),
+ rhs.fe_face_values_ref.get_update_flags())
+ , Nx(rhs.Nx)
+ , symm_grad_Nx(rhs.symm_grad_Nx)
{}
void
reset()
PerTaskData_SC(const unsigned int dofs_per_cell,
const unsigned int n_u,
const unsigned int n_p,
- const unsigned int n_J) :
- cell_matrix(dofs_per_cell, dofs_per_cell),
- local_dof_indices(dofs_per_cell),
- k_orig(dofs_per_cell, dofs_per_cell),
- k_pu(n_p, n_u),
- k_pJ(n_p, n_J),
- k_JJ(n_J, n_J),
- k_pJ_inv(n_p, n_J),
- k_bbar(n_u, n_u),
- A(n_J, n_u),
- B(n_J, n_u),
- C(n_p, n_u)
+ const unsigned int n_J)
+ : cell_matrix(dofs_per_cell, dofs_per_cell)
+ , local_dof_indices(dofs_per_cell)
+ , k_orig(dofs_per_cell, dofs_per_cell)
+ , k_pu(n_p, n_u)
+ , k_pJ(n_p, n_J)
+ , k_JJ(n_J, n_J)
+ , k_pJ_inv(n_p, n_J)
+ , k_bbar(n_u, n_u)
+ , A(n_J, n_u)
+ , B(n_J, n_u)
+ , C(n_p, n_u)
{}
void
reset()
ScratchData_UQPH(const FiniteElement<dim> & fe_cell,
const QGauss<dim> & qf_cell,
const UpdateFlags uf_cell,
- const BlockVector<double> &solution_total) :
- solution_total(solution_total),
- solution_grads_u_total(qf_cell.size()),
- solution_values_p_total(qf_cell.size()),
- solution_values_J_total(qf_cell.size()),
- fe_values_ref(fe_cell, qf_cell, uf_cell)
+ const BlockVector<double> &solution_total)
+ : solution_total(solution_total)
+ , solution_grads_u_total(qf_cell.size())
+ , solution_values_p_total(qf_cell.size())
+ , solution_values_J_total(qf_cell.size())
+ , fe_values_ref(fe_cell, qf_cell, uf_cell)
{}
- ScratchData_UQPH(const ScratchData_UQPH &rhs) :
- solution_total(rhs.solution_total),
- solution_grads_u_total(rhs.solution_grads_u_total),
- solution_values_p_total(rhs.solution_values_p_total),
- solution_values_J_total(rhs.solution_values_J_total),
- fe_values_ref(rhs.fe_values_ref.get_fe(),
- rhs.fe_values_ref.get_quadrature(),
- rhs.fe_values_ref.get_update_flags())
+ ScratchData_UQPH(const ScratchData_UQPH &rhs)
+ : solution_total(rhs.solution_total)
+ , solution_grads_u_total(rhs.solution_grads_u_total)
+ , solution_values_p_total(rhs.solution_values_p_total)
+ , solution_values_J_total(rhs.solution_values_J_total)
+ , fe_values_ref(rhs.fe_values_ref.get_fe(),
+ rhs.fe_values_ref.get_quadrature(),
+ rhs.fe_values_ref.get_update_flags())
{}
void
reset()
dof_handler_ref.distribute_dofs(fe);
DoFRenumbering::Cuthill_McKee(dof_handler_ref);
DoFRenumbering::component_wise(dof_handler_ref, block_component);
- DoFTools::count_dofs_per_block(
- dof_handler_ref, dofs_per_block, block_component);
+ DoFTools::count_dofs_per_block(dof_handler_ref,
+ dofs_per_block,
+ block_component);
pcout << "Triangulation:"
<< "\n\t Number of active cells: " << triangulation.n_active_cells()
<< "\n\t Number of degrees of freedom: " << dof_handler_ref.n_dofs()
Solid<dim>::setup_qph()
{
pcout << " Setting up quadrature point data..." << std::endl;
- quadrature_point_history.initialize(
- triangulation.begin_active(), triangulation.end(), n_q_points);
+ quadrature_point_history.initialize(triangulation.begin_active(),
+ triangulation.end(),
+ n_q_points);
for (typename Triangulation<dim>::active_cell_iterator cell =
triangulation.begin_active();
cell != triangulation.end();
data.reset();
scratch.reset();
cell->get_dof_indices(data.local_dof_indices);
- data.k_orig.extract_submatrix_from(
- tangent_matrix, data.local_dof_indices, data.local_dof_indices);
- data.k_pu.extract_submatrix_from(
- data.k_orig, element_indices_p, element_indices_u);
- data.k_pJ.extract_submatrix_from(
- data.k_orig, element_indices_p, element_indices_J);
- data.k_JJ.extract_submatrix_from(
- data.k_orig, element_indices_J, element_indices_J);
+ data.k_orig.extract_submatrix_from(tangent_matrix,
+ data.local_dof_indices,
+ data.local_dof_indices);
+ data.k_pu.extract_submatrix_from(data.k_orig,
+ element_indices_p,
+ element_indices_u);
+ data.k_pJ.extract_submatrix_from(data.k_orig,
+ element_indices_p,
+ element_indices_J);
+ data.k_JJ.extract_submatrix_from(data.k_orig,
+ element_indices_J,
+ element_indices_J);
data.k_pJ_inv.invert(data.k_pJ);
data.k_pJ_inv.mmult(data.A, data.k_pu);
data.k_JJ.mmult(data.B, data.A);
data.k_pJ_inv.Tmmult(data.C, data.B);
data.k_pu.Tmmult(data.k_bbar, data.C);
- data.k_bbar.scatter_matrix_to(
- element_indices_u, element_indices_u, data.cell_matrix);
+ data.k_bbar.scatter_matrix_to(element_indices_u,
+ element_indices_u,
+ data.cell_matrix);
data.k_pJ_inv.add(-1.0, data.k_pJ);
- data.k_pJ_inv.scatter_matrix_to(
- element_indices_p, element_indices_J, data.cell_matrix);
+ data.k_pJ_inv.scatter_matrix_to(element_indices_p,
+ element_indices_J,
+ data.cell_matrix);
}
template <int dim>
std::pair<unsigned int, double>
SolverSelector<Vector<double>> solver_K_con_inv;
solver_K_con_inv.select("cg");
solver_K_con_inv.set_control(solver_control_K_con_inv);
- const auto K_uu_con_inv = inverse_operator(
- K_uu_con, solver_K_con_inv, preconditioner_K_con_inv);
+ const auto K_uu_con_inv =
+ inverse_operator(K_uu_con,
+ solver_K_con_inv,
+ preconditioner_K_con_inv);
d_u =
K_uu_con_inv * (f_u - K_up * (K_Jp_inv * f_J - K_pp_bar * f_p));
timer.leave_subsection();
"0.4999",
Patterns::Double(-1.0, 0.5),
"Poisson's ratio");
- prm.declare_entry(
- "Shear modulus", "80.194e6", Patterns::Double(), "Shear modulus");
+ prm.declare_entry("Shear modulus",
+ "80.194e6",
+ Patterns::Double(),
+ "Shear modulus");
}
prm.leave_subsection();
}
prm.enter_subsection("Time");
{
prm.declare_entry("End time", "1", Patterns::Double(), "End time");
- prm.declare_entry(
- "Time step size", "0.1", Patterns::Double(), "Time step size");
+ prm.declare_entry("Time step size",
+ "0.1",
+ Patterns::Double(),
+ "Time step size");
}
prm.leave_subsection();
}
class Time
{
public:
- Time(const double time_end, const double delta_t) :
- timestep(0),
- time_current(0.0),
- time_end(time_end),
- delta_t(delta_t)
+ Time(const double time_end, const double delta_t)
+ : timestep(0)
+ , time_current(0.0)
+ , time_end(time_end)
+ , delta_t(delta_t)
{}
virtual ~Time()
{}
class Material_Compressible_Neo_Hook_Three_Field
{
public:
- Material_Compressible_Neo_Hook_Three_Field(const double mu,
- const double nu) :
- kappa((2.0 * mu * (1.0 + nu)) / (3.0 * (1.0 - 2.0 * nu))),
- c_1(mu / 2.0),
- det_F(1.0),
- p_tilde(0.0),
- J_tilde(1.0),
- b_bar(Physics::Elasticity::StandardTensors<dim>::I)
+ Material_Compressible_Neo_Hook_Three_Field(const double mu, const double nu)
+ : kappa((2.0 * mu * (1.0 + nu)) / (3.0 * (1.0 - 2.0 * nu)))
+ , c_1(mu / 2.0)
+ , det_F(1.0)
+ , p_tilde(0.0)
+ , J_tilde(1.0)
+ , b_bar(Physics::Elasticity::StandardTensors<dim>::I)
{
Assert(kappa > 0, ExcInternalError());
}
class PointHistory
{
public:
- PointHistory() :
- F_inv(Physics::Elasticity::StandardTensors<dim>::I),
- tau(SymmetricTensor<2, dim>()),
- d2Psi_vol_dJ2(0.0),
- dPsi_vol_dJ(0.0),
- Jc(SymmetricTensor<4, dim>())
+ PointHistory()
+ : F_inv(Physics::Elasticity::StandardTensors<dim>::I)
+ , tau(SymmetricTensor<2, dim>())
+ , d2Psi_vol_dJ2(0.0)
+ , dPsi_vol_dJ(0.0)
+ , Jc(SymmetricTensor<4, dim>())
{}
virtual ~PointHistory()
{}
void
setup_lqp(const Parameters::AllParameters ¶meters)
{
- material.reset(new Material_Compressible_Neo_Hook_Three_Field<dim>(
- parameters.mu, parameters.nu));
+ material.reset(
+ new Material_Compressible_Neo_Hook_Three_Field<dim>(parameters.mu,
+ parameters.nu));
update_values(Tensor<2, dim>(), 0.0, 1.0);
}
void
ConditionalOStream pcout;
struct Errors
{
- Errors() : norm(1.0), u(1.0), p(1.0), J(1.0)
+ Errors()
+ : norm(1.0)
+ , u(1.0)
+ , p(1.0)
+ , J(1.0)
{}
void
reset()
print_conv_footer();
};
template <int dim>
- Solid<dim>::Solid(const std::string &input_file) :
- parameters(input_file),
- triangulation(Triangulation<dim>::maximum_smoothing),
- time(parameters.end_time, parameters.delta_t),
- timer(std::cout, TimerOutput::never, TimerOutput::wall_times),
- degree(parameters.poly_degree),
- fe(FE_Q<dim>(parameters.poly_degree),
- dim, // displacement
- FE_DGPMonomial<dim>(parameters.poly_degree - 1),
- 1, // pressure
- FE_DGPMonomial<dim>(parameters.poly_degree - 1),
- 1), // dilatation
- dof_handler_ref(triangulation),
- dofs_per_cell(fe.dofs_per_cell),
- u_fe(first_u_component),
- p_fe(p_component),
- J_fe(J_component),
- dofs_per_block(n_blocks),
- qf_cell(parameters.quad_order),
- qf_face(parameters.quad_order),
- n_q_points(qf_cell.size()),
- n_q_points_f(qf_face.size()),
- pcout(std::cout)
+ Solid<dim>::Solid(const std::string &input_file)
+ : parameters(input_file)
+ , triangulation(Triangulation<dim>::maximum_smoothing)
+ , time(parameters.end_time, parameters.delta_t)
+ , timer(std::cout, TimerOutput::never, TimerOutput::wall_times)
+ , degree(parameters.poly_degree)
+ , fe(FE_Q<dim>(parameters.poly_degree),
+ dim, // displacement
+ FE_DGPMonomial<dim>(parameters.poly_degree - 1),
+ 1, // pressure
+ FE_DGPMonomial<dim>(parameters.poly_degree - 1),
+ 1)
+ , // dilatation
+ dof_handler_ref(triangulation)
+ , dofs_per_cell(fe.dofs_per_cell)
+ , u_fe(first_u_component)
+ , p_fe(p_component)
+ , J_fe(J_component)
+ , dofs_per_block(n_blocks)
+ , qf_cell(parameters.quad_order)
+ , qf_face(parameters.quad_order)
+ , n_q_points(qf_cell.size())
+ , n_q_points_f(qf_face.size())
+ , pcout(std::cout)
{
Assert(dim == 2 || dim == 3,
ExcMessage("This problem only works in 2 or 3 space dimensions."));
{
FullMatrix<double> cell_matrix;
std::vector<types::global_dof_index> local_dof_indices;
- PerTaskData_K(const unsigned int dofs_per_cell) :
- cell_matrix(dofs_per_cell, dofs_per_cell),
- local_dof_indices(dofs_per_cell)
+ PerTaskData_K(const unsigned int dofs_per_cell)
+ : cell_matrix(dofs_per_cell, dofs_per_cell)
+ , local_dof_indices(dofs_per_cell)
{}
void
reset()
std::vector<std::vector<SymmetricTensor<2, dim>>> symm_grad_Nx;
ScratchData_K(const FiniteElement<dim> &fe_cell,
const QGauss<dim> & qf_cell,
- const UpdateFlags uf_cell) :
- fe_values_ref(fe_cell, qf_cell, uf_cell),
- Nx(qf_cell.size(), std::vector<double>(fe_cell.dofs_per_cell)),
- grad_Nx(qf_cell.size(),
- std::vector<Tensor<2, dim>>(fe_cell.dofs_per_cell)),
- symm_grad_Nx(qf_cell.size(),
- std::vector<SymmetricTensor<2, dim>>(fe_cell.dofs_per_cell))
+ const UpdateFlags uf_cell)
+ : fe_values_ref(fe_cell, qf_cell, uf_cell)
+ , Nx(qf_cell.size(), std::vector<double>(fe_cell.dofs_per_cell))
+ , grad_Nx(qf_cell.size(),
+ std::vector<Tensor<2, dim>>(fe_cell.dofs_per_cell))
+ , symm_grad_Nx(qf_cell.size(),
+ std::vector<SymmetricTensor<2, dim>>(
+ fe_cell.dofs_per_cell))
{}
- ScratchData_K(const ScratchData_K &rhs) :
- fe_values_ref(rhs.fe_values_ref.get_fe(),
- rhs.fe_values_ref.get_quadrature(),
- rhs.fe_values_ref.get_update_flags()),
- Nx(rhs.Nx),
- grad_Nx(rhs.grad_Nx),
- symm_grad_Nx(rhs.symm_grad_Nx)
+ ScratchData_K(const ScratchData_K &rhs)
+ : fe_values_ref(rhs.fe_values_ref.get_fe(),
+ rhs.fe_values_ref.get_quadrature(),
+ rhs.fe_values_ref.get_update_flags())
+ , Nx(rhs.Nx)
+ , grad_Nx(rhs.grad_Nx)
+ , symm_grad_Nx(rhs.symm_grad_Nx)
{}
void
reset()
{
Vector<double> cell_rhs;
std::vector<types::global_dof_index> local_dof_indices;
- PerTaskData_RHS(const unsigned int dofs_per_cell) :
- cell_rhs(dofs_per_cell),
- local_dof_indices(dofs_per_cell)
+ PerTaskData_RHS(const unsigned int dofs_per_cell)
+ : cell_rhs(dofs_per_cell)
+ , local_dof_indices(dofs_per_cell)
{}
void
reset()
const QGauss<dim> & qf_cell,
const UpdateFlags uf_cell,
const QGauss<dim - 1> & qf_face,
- const UpdateFlags uf_face) :
- fe_values_ref(fe_cell, qf_cell, uf_cell),
- fe_face_values_ref(fe_cell, qf_face, uf_face),
- Nx(qf_cell.size(), std::vector<double>(fe_cell.dofs_per_cell)),
- symm_grad_Nx(qf_cell.size(),
- std::vector<SymmetricTensor<2, dim>>(fe_cell.dofs_per_cell))
+ const UpdateFlags uf_face)
+ : fe_values_ref(fe_cell, qf_cell, uf_cell)
+ , fe_face_values_ref(fe_cell, qf_face, uf_face)
+ , Nx(qf_cell.size(), std::vector<double>(fe_cell.dofs_per_cell))
+ , symm_grad_Nx(qf_cell.size(),
+ std::vector<SymmetricTensor<2, dim>>(
+ fe_cell.dofs_per_cell))
{}
- ScratchData_RHS(const ScratchData_RHS &rhs) :
- fe_values_ref(rhs.fe_values_ref.get_fe(),
- rhs.fe_values_ref.get_quadrature(),
- rhs.fe_values_ref.get_update_flags()),
- fe_face_values_ref(rhs.fe_face_values_ref.get_fe(),
- rhs.fe_face_values_ref.get_quadrature(),
- rhs.fe_face_values_ref.get_update_flags()),
- Nx(rhs.Nx),
- symm_grad_Nx(rhs.symm_grad_Nx)
+ ScratchData_RHS(const ScratchData_RHS &rhs)
+ : fe_values_ref(rhs.fe_values_ref.get_fe(),
+ rhs.fe_values_ref.get_quadrature(),
+ rhs.fe_values_ref.get_update_flags())
+ , fe_face_values_ref(rhs.fe_face_values_ref.get_fe(),
+ rhs.fe_face_values_ref.get_quadrature(),
+ rhs.fe_face_values_ref.get_update_flags())
+ , Nx(rhs.Nx)
+ , symm_grad_Nx(rhs.symm_grad_Nx)
{}
void
reset()
PerTaskData_SC(const unsigned int dofs_per_cell,
const unsigned int n_u,
const unsigned int n_p,
- const unsigned int n_J) :
- cell_matrix(dofs_per_cell, dofs_per_cell),
- local_dof_indices(dofs_per_cell),
- k_orig(dofs_per_cell, dofs_per_cell),
- k_pu(n_p, n_u),
- k_pJ(n_p, n_J),
- k_JJ(n_J, n_J),
- k_pJ_inv(n_p, n_J),
- k_bbar(n_u, n_u),
- A(n_J, n_u),
- B(n_J, n_u),
- C(n_p, n_u)
+ const unsigned int n_J)
+ : cell_matrix(dofs_per_cell, dofs_per_cell)
+ , local_dof_indices(dofs_per_cell)
+ , k_orig(dofs_per_cell, dofs_per_cell)
+ , k_pu(n_p, n_u)
+ , k_pJ(n_p, n_J)
+ , k_JJ(n_J, n_J)
+ , k_pJ_inv(n_p, n_J)
+ , k_bbar(n_u, n_u)
+ , A(n_J, n_u)
+ , B(n_J, n_u)
+ , C(n_p, n_u)
{}
void
reset()
ScratchData_UQPH(const FiniteElement<dim> & fe_cell,
const QGauss<dim> & qf_cell,
const UpdateFlags uf_cell,
- const BlockVector<double> &solution_total) :
- solution_total(solution_total),
- solution_grads_u_total(qf_cell.size()),
- solution_values_p_total(qf_cell.size()),
- solution_values_J_total(qf_cell.size()),
- fe_values_ref(fe_cell, qf_cell, uf_cell)
+ const BlockVector<double> &solution_total)
+ : solution_total(solution_total)
+ , solution_grads_u_total(qf_cell.size())
+ , solution_values_p_total(qf_cell.size())
+ , solution_values_J_total(qf_cell.size())
+ , fe_values_ref(fe_cell, qf_cell, uf_cell)
{}
- ScratchData_UQPH(const ScratchData_UQPH &rhs) :
- solution_total(rhs.solution_total),
- solution_grads_u_total(rhs.solution_grads_u_total),
- solution_values_p_total(rhs.solution_values_p_total),
- solution_values_J_total(rhs.solution_values_J_total),
- fe_values_ref(rhs.fe_values_ref.get_fe(),
- rhs.fe_values_ref.get_quadrature(),
- rhs.fe_values_ref.get_update_flags())
+ ScratchData_UQPH(const ScratchData_UQPH &rhs)
+ : solution_total(rhs.solution_total)
+ , solution_grads_u_total(rhs.solution_grads_u_total)
+ , solution_values_p_total(rhs.solution_values_p_total)
+ , solution_values_J_total(rhs.solution_values_J_total)
+ , fe_values_ref(rhs.fe_values_ref.get_fe(),
+ rhs.fe_values_ref.get_quadrature(),
+ rhs.fe_values_ref.get_update_flags())
{}
void
reset()
dof_handler_ref.distribute_dofs(fe);
DoFRenumbering::Cuthill_McKee(dof_handler_ref);
DoFRenumbering::component_wise(dof_handler_ref, block_component);
- DoFTools::count_dofs_per_block(
- dof_handler_ref, dofs_per_block, block_component);
+ DoFTools::count_dofs_per_block(dof_handler_ref,
+ dofs_per_block,
+ block_component);
pcout << "Triangulation:"
<< "\n\t Number of active cells: " << triangulation.n_active_cells()
<< "\n\t Number of degrees of freedom: " << dof_handler_ref.n_dofs()
Solid<dim>::setup_qph()
{
pcout << " Setting up quadrature point data..." << std::endl;
- quadrature_point_history.initialize(
- triangulation.begin_active(), triangulation.end(), n_q_points);
+ quadrature_point_history.initialize(triangulation.begin_active(),
+ triangulation.end(),
+ n_q_points);
for (typename Triangulation<dim>::active_cell_iterator cell =
triangulation.begin_active();
cell != triangulation.end();
data.reset();
scratch.reset();
cell->get_dof_indices(data.local_dof_indices);
- data.k_orig.extract_submatrix_from(
- tangent_matrix, data.local_dof_indices, data.local_dof_indices);
- data.k_pu.extract_submatrix_from(
- data.k_orig, element_indices_p, element_indices_u);
- data.k_pJ.extract_submatrix_from(
- data.k_orig, element_indices_p, element_indices_J);
- data.k_JJ.extract_submatrix_from(
- data.k_orig, element_indices_J, element_indices_J);
+ data.k_orig.extract_submatrix_from(tangent_matrix,
+ data.local_dof_indices,
+ data.local_dof_indices);
+ data.k_pu.extract_submatrix_from(data.k_orig,
+ element_indices_p,
+ element_indices_u);
+ data.k_pJ.extract_submatrix_from(data.k_orig,
+ element_indices_p,
+ element_indices_J);
+ data.k_JJ.extract_submatrix_from(data.k_orig,
+ element_indices_J,
+ element_indices_J);
data.k_pJ_inv.invert(data.k_pJ);
data.k_pJ_inv.mmult(data.A, data.k_pu);
data.k_JJ.mmult(data.B, data.A);
data.k_pJ_inv.Tmmult(data.C, data.B);
data.k_pu.Tmmult(data.k_bbar, data.C);
- data.k_bbar.scatter_matrix_to(
- element_indices_u, element_indices_u, data.cell_matrix);
+ data.k_bbar.scatter_matrix_to(element_indices_u,
+ element_indices_u,
+ data.cell_matrix);
data.k_pJ_inv.add(-1.0, data.k_pJ);
- data.k_pJ_inv.scatter_matrix_to(
- element_indices_p, element_indices_J, data.cell_matrix);
+ data.k_pJ_inv.scatter_matrix_to(element_indices_p,
+ element_indices_J,
+ data.cell_matrix);
}
template <int dim>
std::pair<unsigned int, double>
SolverSelector<Vector<double>> solver_K_con_inv;
solver_K_con_inv.select("cg");
solver_K_con_inv.set_control(solver_control_K_con_inv);
- const auto K_uu_con_inv = inverse_operator(
- K_uu_con, solver_K_con_inv, preconditioner_K_con_inv);
+ const auto K_uu_con_inv =
+ inverse_operator(K_uu_con,
+ solver_K_con_inv,
+ preconditioner_K_con_inv);
d_u =
K_uu_con_inv * (f_u - K_up * (K_Jp_inv * f_J - K_pp_bar * f_p));
timer.leave_subsection();
"0.4999",
Patterns::Double(-1.0, 0.5),
"Poisson's ratio");
- prm.declare_entry(
- "Shear modulus", "80.194e6", Patterns::Double(), "Shear modulus");
+ prm.declare_entry("Shear modulus",
+ "80.194e6",
+ Patterns::Double(),
+ "Shear modulus");
}
prm.leave_subsection();
}
prm.enter_subsection("Time");
{
prm.declare_entry("End time", "1", Patterns::Double(), "End time");
- prm.declare_entry(
- "Time step size", "0.1", Patterns::Double(), "Time step size");
+ prm.declare_entry("Time step size",
+ "0.1",
+ Patterns::Double(),
+ "Time step size");
}
prm.leave_subsection();
}
class Time
{
public:
- Time(const double time_end, const double delta_t) :
- timestep(0),
- time_current(0.0),
- time_end(time_end),
- delta_t(delta_t)
+ Time(const double time_end, const double delta_t)
+ : timestep(0)
+ , time_current(0.0)
+ , time_end(time_end)
+ , delta_t(delta_t)
{}
virtual ~Time()
{}
class Material_Compressible_Neo_Hook_Three_Field
{
public:
- Material_Compressible_Neo_Hook_Three_Field(const double mu,
- const double nu) :
- kappa((2.0 * mu * (1.0 + nu)) / (3.0 * (1.0 - 2.0 * nu))),
- c_1(mu / 2.0),
- det_F(1.0),
- p_tilde(0.0),
- J_tilde(1.0),
- b_bar(StandardTensors<dim>::I)
+ Material_Compressible_Neo_Hook_Three_Field(const double mu, const double nu)
+ : kappa((2.0 * mu * (1.0 + nu)) / (3.0 * (1.0 - 2.0 * nu)))
+ , c_1(mu / 2.0)
+ , det_F(1.0)
+ , p_tilde(0.0)
+ , J_tilde(1.0)
+ , b_bar(StandardTensors<dim>::I)
{
Assert(kappa > 0, ExcInternalError());
}
class PointHistory
{
public:
- PointHistory() :
- F_inv(StandardTensors<dim>::I),
- tau(SymmetricTensor<2, dim>()),
- d2Psi_vol_dJ2(0.0),
- dPsi_vol_dJ(0.0),
- Jc(SymmetricTensor<4, dim>())
+ PointHistory()
+ : F_inv(StandardTensors<dim>::I)
+ , tau(SymmetricTensor<2, dim>())
+ , d2Psi_vol_dJ2(0.0)
+ , dPsi_vol_dJ(0.0)
+ , Jc(SymmetricTensor<4, dim>())
{}
virtual ~PointHistory()
{}
void
setup_lqp(const Parameters::AllParameters ¶meters)
{
- material.reset(new Material_Compressible_Neo_Hook_Three_Field<dim>(
- parameters.mu, parameters.nu));
+ material.reset(
+ new Material_Compressible_Neo_Hook_Three_Field<dim>(parameters.mu,
+ parameters.nu));
update_values(Tensor<2, dim>(), 0.0, 1.0);
}
void
ConditionalOStream pcout;
struct Errors
{
- Errors() : norm(1.0), u(1.0), p(1.0), J(1.0)
+ Errors()
+ : norm(1.0)
+ , u(1.0)
+ , p(1.0)
+ , J(1.0)
{}
void
reset()
print_conv_footer();
};
template <int dim>
- Solid<dim>::Solid(const std::string &input_file) :
- parameters(input_file),
- triangulation(Triangulation<dim>::maximum_smoothing),
- time(parameters.end_time, parameters.delta_t),
- timer(std::cout, TimerOutput::never, TimerOutput::wall_times),
- degree(parameters.poly_degree),
- fe(FE_Q<dim>(parameters.poly_degree),
- dim, // displacement
- FE_DGPMonomial<dim>(parameters.poly_degree - 1),
- 1, // pressure
- FE_DGPMonomial<dim>(parameters.poly_degree - 1),
- 1), // dilatation
- dof_handler_ref(triangulation),
- dofs_per_cell(fe.dofs_per_cell),
- u_fe(first_u_component),
- p_fe(p_component),
- J_fe(J_component),
- dofs_per_block(n_blocks),
- qf_cell(parameters.quad_order),
- qf_face(parameters.quad_order),
- n_q_points(qf_cell.size()),
- n_q_points_f(qf_face.size()),
- pcout(std::cout)
+ Solid<dim>::Solid(const std::string &input_file)
+ : parameters(input_file)
+ , triangulation(Triangulation<dim>::maximum_smoothing)
+ , time(parameters.end_time, parameters.delta_t)
+ , timer(std::cout, TimerOutput::never, TimerOutput::wall_times)
+ , degree(parameters.poly_degree)
+ , fe(FE_Q<dim>(parameters.poly_degree),
+ dim, // displacement
+ FE_DGPMonomial<dim>(parameters.poly_degree - 1),
+ 1, // pressure
+ FE_DGPMonomial<dim>(parameters.poly_degree - 1),
+ 1)
+ , // dilatation
+ dof_handler_ref(triangulation)
+ , dofs_per_cell(fe.dofs_per_cell)
+ , u_fe(first_u_component)
+ , p_fe(p_component)
+ , J_fe(J_component)
+ , dofs_per_block(n_blocks)
+ , qf_cell(parameters.quad_order)
+ , qf_face(parameters.quad_order)
+ , n_q_points(qf_cell.size())
+ , n_q_points_f(qf_face.size())
+ , pcout(std::cout)
{
Assert(dim == 2 || dim == 3,
ExcMessage("This problem only works in 2 or 3 space dimensions."));
{
FullMatrix<double> cell_matrix;
std::vector<types::global_dof_index> local_dof_indices;
- PerTaskData_K(const unsigned int dofs_per_cell) :
- cell_matrix(dofs_per_cell, dofs_per_cell),
- local_dof_indices(dofs_per_cell)
+ PerTaskData_K(const unsigned int dofs_per_cell)
+ : cell_matrix(dofs_per_cell, dofs_per_cell)
+ , local_dof_indices(dofs_per_cell)
{}
void
reset()
std::vector<std::vector<SymmetricTensor<2, dim>>> symm_grad_Nx;
ScratchData_K(const FiniteElement<dim> &fe_cell,
const QGauss<dim> & qf_cell,
- const UpdateFlags uf_cell) :
- fe_values_ref(fe_cell, qf_cell, uf_cell),
- Nx(qf_cell.size(), std::vector<double>(fe_cell.dofs_per_cell)),
- grad_Nx(qf_cell.size(),
- std::vector<Tensor<2, dim>>(fe_cell.dofs_per_cell)),
- symm_grad_Nx(qf_cell.size(),
- std::vector<SymmetricTensor<2, dim>>(fe_cell.dofs_per_cell))
+ const UpdateFlags uf_cell)
+ : fe_values_ref(fe_cell, qf_cell, uf_cell)
+ , Nx(qf_cell.size(), std::vector<double>(fe_cell.dofs_per_cell))
+ , grad_Nx(qf_cell.size(),
+ std::vector<Tensor<2, dim>>(fe_cell.dofs_per_cell))
+ , symm_grad_Nx(qf_cell.size(),
+ std::vector<SymmetricTensor<2, dim>>(
+ fe_cell.dofs_per_cell))
{}
- ScratchData_K(const ScratchData_K &rhs) :
- fe_values_ref(rhs.fe_values_ref.get_fe(),
- rhs.fe_values_ref.get_quadrature(),
- rhs.fe_values_ref.get_update_flags()),
- Nx(rhs.Nx),
- grad_Nx(rhs.grad_Nx),
- symm_grad_Nx(rhs.symm_grad_Nx)
+ ScratchData_K(const ScratchData_K &rhs)
+ : fe_values_ref(rhs.fe_values_ref.get_fe(),
+ rhs.fe_values_ref.get_quadrature(),
+ rhs.fe_values_ref.get_update_flags())
+ , Nx(rhs.Nx)
+ , grad_Nx(rhs.grad_Nx)
+ , symm_grad_Nx(rhs.symm_grad_Nx)
{}
void
reset()
{
Vector<double> cell_rhs;
std::vector<types::global_dof_index> local_dof_indices;
- PerTaskData_RHS(const unsigned int dofs_per_cell) :
- cell_rhs(dofs_per_cell),
- local_dof_indices(dofs_per_cell)
+ PerTaskData_RHS(const unsigned int dofs_per_cell)
+ : cell_rhs(dofs_per_cell)
+ , local_dof_indices(dofs_per_cell)
{}
void
reset()
const QGauss<dim> & qf_cell,
const UpdateFlags uf_cell,
const QGauss<dim - 1> & qf_face,
- const UpdateFlags uf_face) :
- fe_values_ref(fe_cell, qf_cell, uf_cell),
- fe_face_values_ref(fe_cell, qf_face, uf_face),
- Nx(qf_cell.size(), std::vector<double>(fe_cell.dofs_per_cell)),
- symm_grad_Nx(qf_cell.size(),
- std::vector<SymmetricTensor<2, dim>>(fe_cell.dofs_per_cell))
+ const UpdateFlags uf_face)
+ : fe_values_ref(fe_cell, qf_cell, uf_cell)
+ , fe_face_values_ref(fe_cell, qf_face, uf_face)
+ , Nx(qf_cell.size(), std::vector<double>(fe_cell.dofs_per_cell))
+ , symm_grad_Nx(qf_cell.size(),
+ std::vector<SymmetricTensor<2, dim>>(
+ fe_cell.dofs_per_cell))
{}
- ScratchData_RHS(const ScratchData_RHS &rhs) :
- fe_values_ref(rhs.fe_values_ref.get_fe(),
- rhs.fe_values_ref.get_quadrature(),
- rhs.fe_values_ref.get_update_flags()),
- fe_face_values_ref(rhs.fe_face_values_ref.get_fe(),
- rhs.fe_face_values_ref.get_quadrature(),
- rhs.fe_face_values_ref.get_update_flags()),
- Nx(rhs.Nx),
- symm_grad_Nx(rhs.symm_grad_Nx)
+ ScratchData_RHS(const ScratchData_RHS &rhs)
+ : fe_values_ref(rhs.fe_values_ref.get_fe(),
+ rhs.fe_values_ref.get_quadrature(),
+ rhs.fe_values_ref.get_update_flags())
+ , fe_face_values_ref(rhs.fe_face_values_ref.get_fe(),
+ rhs.fe_face_values_ref.get_quadrature(),
+ rhs.fe_face_values_ref.get_update_flags())
+ , Nx(rhs.Nx)
+ , symm_grad_Nx(rhs.symm_grad_Nx)
{}
void
reset()
PerTaskData_SC(const unsigned int dofs_per_cell,
const unsigned int n_u,
const unsigned int n_p,
- const unsigned int n_J) :
- cell_matrix(dofs_per_cell, dofs_per_cell),
- local_dof_indices(dofs_per_cell),
- k_orig(dofs_per_cell, dofs_per_cell),
- k_pu(n_p, n_u),
- k_pJ(n_p, n_J),
- k_JJ(n_J, n_J),
- k_pJ_inv(n_p, n_J),
- k_bbar(n_u, n_u),
- A(n_J, n_u),
- B(n_J, n_u),
- C(n_p, n_u)
+ const unsigned int n_J)
+ : cell_matrix(dofs_per_cell, dofs_per_cell)
+ , local_dof_indices(dofs_per_cell)
+ , k_orig(dofs_per_cell, dofs_per_cell)
+ , k_pu(n_p, n_u)
+ , k_pJ(n_p, n_J)
+ , k_JJ(n_J, n_J)
+ , k_pJ_inv(n_p, n_J)
+ , k_bbar(n_u, n_u)
+ , A(n_J, n_u)
+ , B(n_J, n_u)
+ , C(n_p, n_u)
{}
void
reset()
ScratchData_UQPH(const FiniteElement<dim> & fe_cell,
const QGauss<dim> & qf_cell,
const UpdateFlags uf_cell,
- const BlockVector<double> &solution_total) :
- solution_total(solution_total),
- solution_grads_u_total(qf_cell.size()),
- solution_values_p_total(qf_cell.size()),
- solution_values_J_total(qf_cell.size()),
- fe_values_ref(fe_cell, qf_cell, uf_cell)
+ const BlockVector<double> &solution_total)
+ : solution_total(solution_total)
+ , solution_grads_u_total(qf_cell.size())
+ , solution_values_p_total(qf_cell.size())
+ , solution_values_J_total(qf_cell.size())
+ , fe_values_ref(fe_cell, qf_cell, uf_cell)
{}
- ScratchData_UQPH(const ScratchData_UQPH &rhs) :
- solution_total(rhs.solution_total),
- solution_grads_u_total(rhs.solution_grads_u_total),
- solution_values_p_total(rhs.solution_values_p_total),
- solution_values_J_total(rhs.solution_values_J_total),
- fe_values_ref(rhs.fe_values_ref.get_fe(),
- rhs.fe_values_ref.get_quadrature(),
- rhs.fe_values_ref.get_update_flags())
+ ScratchData_UQPH(const ScratchData_UQPH &rhs)
+ : solution_total(rhs.solution_total)
+ , solution_grads_u_total(rhs.solution_grads_u_total)
+ , solution_values_p_total(rhs.solution_values_p_total)
+ , solution_values_J_total(rhs.solution_values_J_total)
+ , fe_values_ref(rhs.fe_values_ref.get_fe(),
+ rhs.fe_values_ref.get_quadrature(),
+ rhs.fe_values_ref.get_update_flags())
{}
void
reset()
dof_handler_ref.distribute_dofs(fe);
DoFRenumbering::Cuthill_McKee(dof_handler_ref);
DoFRenumbering::component_wise(dof_handler_ref, block_component);
- DoFTools::count_dofs_per_block(
- dof_handler_ref, dofs_per_block, block_component);
+ DoFTools::count_dofs_per_block(dof_handler_ref,
+ dofs_per_block,
+ block_component);
pcout << "Triangulation:"
<< "\n\t Number of active cells: " << triangulation.n_active_cells()
<< "\n\t Number of degrees of freedom: " << dof_handler_ref.n_dofs()
Solid<dim>::setup_qph()
{
pcout << " Setting up quadrature point data..." << std::endl;
- quadrature_point_history.initialize(
- triangulation.begin_active(), triangulation.end(), n_q_points);
+ quadrature_point_history.initialize(triangulation.begin_active(),
+ triangulation.end(),
+ n_q_points);
for (typename Triangulation<dim>::active_cell_iterator cell =
triangulation.begin_active();
cell != triangulation.end();
data.reset();
scratch.reset();
cell->get_dof_indices(data.local_dof_indices);
- data.k_orig.extract_submatrix_from(
- tangent_matrix, data.local_dof_indices, data.local_dof_indices);
- data.k_pu.extract_submatrix_from(
- data.k_orig, element_indices_p, element_indices_u);
- data.k_pJ.extract_submatrix_from(
- data.k_orig, element_indices_p, element_indices_J);
- data.k_JJ.extract_submatrix_from(
- data.k_orig, element_indices_J, element_indices_J);
+ data.k_orig.extract_submatrix_from(tangent_matrix,
+ data.local_dof_indices,
+ data.local_dof_indices);
+ data.k_pu.extract_submatrix_from(data.k_orig,
+ element_indices_p,
+ element_indices_u);
+ data.k_pJ.extract_submatrix_from(data.k_orig,
+ element_indices_p,
+ element_indices_J);
+ data.k_JJ.extract_submatrix_from(data.k_orig,
+ element_indices_J,
+ element_indices_J);
data.k_pJ_inv.invert(data.k_pJ);
data.k_pJ_inv.mmult(data.A, data.k_pu);
data.k_JJ.mmult(data.B, data.A);
data.k_pJ_inv.Tmmult(data.C, data.B);
data.k_pu.Tmmult(data.k_bbar, data.C);
- data.k_bbar.scatter_matrix_to(
- element_indices_u, element_indices_u, data.cell_matrix);
+ data.k_bbar.scatter_matrix_to(element_indices_u,
+ element_indices_u,
+ data.cell_matrix);
data.k_pJ_inv.add(-1.0, data.k_pJ);
- data.k_pJ_inv.scatter_matrix_to(
- element_indices_p, element_indices_J, data.cell_matrix);
+ data.k_pJ_inv.scatter_matrix_to(element_indices_p,
+ element_indices_J,
+ data.cell_matrix);
}
template <int dim>
std::pair<unsigned int, double>
SolverSelector<Vector<double>> solver_K_con_inv;
solver_K_con_inv.select("cg");
solver_K_con_inv.set_control(solver_control_K_con_inv);
- const auto K_uu_con_inv = inverse_operator(
- K_uu_con, solver_K_con_inv, preconditioner_K_con_inv);
+ const auto K_uu_con_inv =
+ inverse_operator(K_uu_con,
+ solver_K_con_inv,
+ preconditioner_K_con_inv);
d_u =
K_uu_con_inv * (f_u - K_up * (K_Jp_inv * f_J - K_pp_bar * f_p));
timer.leave_subsection();
// NOTE: Angle in radians
const Tensor<1, 3> u = axis / axis.norm(); // Ensure unit vector
const Tensor<2, 3> u_dyad_u = outer_product(u, u);
- const double u_skew_array[3][3] = {
- {0.0, -u[2], u[1]}, {u[2], 0.0, -u[0]}, {-u[1], u[0], 0.0}};
+ const double u_skew_array[3][3] = {{0.0, -u[2], u[1]},
+ {u[2], 0.0, -u[0]},
+ {-u[1], u[0], 0.0}};
const Tensor<2, 3> R_rodrigues =
u_dyad_u +
SparseDirectUMFPACK inverse;
inverse.initialize(A);
const unsigned int num_arnoldi_vectors = 2 * eigenvalues.size() + 2;
- ArpackSolver::AdditionalData additional_data(
- num_arnoldi_vectors, ArpackSolver::largest_magnitude, true);
- ArpackSolver eigensolver(solver_control, additional_data);
+ ArpackSolver::AdditionalData additional_data(num_arnoldi_vectors,
+ ArpackSolver::largest_magnitude,
+ true);
+ ArpackSolver eigensolver(solver_control, additional_data);
eigensolver.solve(
A, B, inverse, eigenvalues, eigenvectors, eigenvalues.size());
AssertCuda(cuda_error);
cuda_error = cudaMalloc(&device_y, n * sizeof(double));
AssertCuda(cuda_error);
- cuda_error = cudaMemcpy(
- device_x, host_x.data(), n * sizeof(double), cudaMemcpyHostToDevice);
+ cuda_error = cudaMemcpy(device_x,
+ host_x.data(),
+ n * sizeof(double),
+ cudaMemcpyHostToDevice);
AssertCuda(cuda_error);
// Launch the kernel.
// Copy output data to host.
cuda_error = cudaDeviceSynchronize();
AssertCuda(cuda_error);
- cuda_error = cudaMemcpy(
- host_y.data(), device_y, n * sizeof(double), cudaMemcpyDeviceToHost);
+ cuda_error = cudaMemcpy(host_y.data(),
+ device_y,
+ n * sizeof(double),
+ cudaMemcpyDeviceToHost);
AssertCuda(cuda_error);
// Print the results and test
TableHandler output_table;
};
-LaplaceProblem::LaplaceProblem() : fe(1), dof_handler(triangulation)
+LaplaceProblem::LaplaceProblem()
+ : fe(1)
+ , dof_handler(triangulation)
{}
void
TableHandler output_table;
};
-LaplaceEigenspectrumProblem::LaplaceEigenspectrumProblem() :
- fe(1),
- dof_handler(triangulation)
+LaplaceEigenspectrumProblem::LaplaceEigenspectrumProblem()
+ : fe(1)
+ , dof_handler(triangulation)
{}
void
TableHandler output_table;
};
-LaplaceProblem::LaplaceProblem() : fe(1), dof_handler(triangulation)
+LaplaceProblem::LaplaceProblem()
+ : fe(1)
+ , dof_handler(triangulation)
{}
void
template <int dim>
-LaplaceProblem<dim>::LaplaceProblem(const unsigned int mapping_degree) :
- fe(1),
- dof_handler(triangulation),
- mapping(mapping_degree),
- last_error(std::numeric_limits<double>::max())
+LaplaceProblem<dim>::LaplaceProblem(const unsigned int mapping_degree)
+ : fe(1)
+ , dof_handler(triangulation)
+ , mapping(mapping_degree)
+ , last_error(std::numeric_limits<double>::max())
{
deallog << "Using mapping with degree " << mapping_degree << ":" << std::endl
<< "============================" << std::endl;
system_rhs.reinit(dof_handler.n_dofs());
std::vector<bool> boundary_dofs(dof_handler.n_dofs(), false);
- DoFTools::extract_boundary_dofs(
- dof_handler, std::vector<bool>(1, true), boundary_dofs);
+ DoFTools::extract_boundary_dofs(dof_handler,
+ std::vector<bool>(1, true),
+ boundary_dofs);
const unsigned int first_boundary_dof =
std::distance(boundary_dofs.begin(),
void
LaplaceProblem<dim>::assemble_and_solve()
{
- const unsigned int gauss_degree = std::max(
- static_cast<unsigned int>(std::ceil(1. * (mapping.get_degree() + 1) / 2)),
- 2U);
- MatrixTools::create_laplace_matrix(
- mapping, dof_handler, QGauss<dim>(gauss_degree), system_matrix);
+ const unsigned int gauss_degree =
+ std::max(static_cast<unsigned int>(
+ std::ceil(1. * (mapping.get_degree() + 1) / 2)),
+ 2U);
+ MatrixTools::create_laplace_matrix(mapping,
+ dof_handler,
+ QGauss<dim>(gauss_degree),
+ system_matrix);
VectorTools::create_right_hand_side(mapping,
dof_handler,
QGauss<dim>(gauss_degree),
Functions::ConstantFunction<dim>(-2),
system_rhs);
Vector<double> tmp(system_rhs.size());
- VectorTools::create_boundary_right_hand_side(
- mapping,
- dof_handler,
- QGauss<dim - 1>(gauss_degree),
- Functions::ConstantFunction<dim>(1),
- tmp);
+ VectorTools::create_boundary_right_hand_side(mapping,
+ dof_handler,
+ QGauss<dim - 1>(gauss_degree),
+ Functions::ConstantFunction<dim>(
+ 1),
+ tmp);
system_rhs += tmp;
mean_value_constraints.condense(system_matrix);
class HarmonicOscillator
{
public:
- HarmonicOscillator(double _kappa = 1.0) :
- y(2),
- y_dot(2),
- diff(2),
- J(2, 2),
- A(2, 2),
- Jinv(2, 2),
- kappa(_kappa)
+ HarmonicOscillator(double _kappa = 1.0)
+ : y(2)
+ , y_dot(2)
+ , diff(2)
+ , J(2, 2)
+ , A(2, 2)
+ , Jinv(2, 2)
+ , kappa(_kappa)
{
diff[0] = 1.0;
diff[1] = 1.0;
std::shared_ptr<Utilities::MPI::ProcessGrid> grid =
std::make_shared<Utilities::MPI::ProcessGrid>(
mpi_communicator, size, size, block_size, block_size);
- ScaLAPACKMatrix<NumberType> scalapack_A(
- size, grid, block_size, LAPACKSupport::Property::symmetric);
+ ScaLAPACKMatrix<NumberType> scalapack_A(size,
+ grid,
+ block_size,
+ LAPACKSupport::Property::symmetric);
pcout << size << " " << block_size << " " << grid->get_process_grid_rows()
<< " " << grid->get_process_grid_columns() << std::endl;
std::shared_ptr<Utilities::MPI::ProcessGrid> grid =
std::make_shared<Utilities::MPI::ProcessGrid>(
mpi_communicator, size, size, block_size, block_size);
- ScaLAPACKMatrix<NumberType> scalapack_A(
- size, grid, block_size, LAPACKSupport::Property::symmetric);
+ ScaLAPACKMatrix<NumberType> scalapack_A(size,
+ grid,
+ block_size,
+ LAPACKSupport::Property::symmetric);
pcout << size << " " << block_size << " " << grid->get_process_grid_rows()
<< " " << grid->get_process_grid_columns() << std::endl;
mpi_communicator, size, size, block_size_i, block_size_i);
// create 1d process grid
std::shared_ptr<Utilities::MPI::ProcessGrid> grid_1d =
- std::make_shared<Utilities::MPI::ProcessGrid>(
- mpi_communicator, n_mpi_processes, 1);
+ std::make_shared<Utilities::MPI::ProcessGrid>(mpi_communicator,
+ n_mpi_processes,
+ 1);
// create process grid containing one process
std::shared_ptr<Utilities::MPI::ProcessGrid> grid_single =
std::make_shared<Utilities::MPI::ProcessGrid>(mpi_communicator, 1, 1);
NumberType product_1 = eigenvector * l_singular_vector;
NumberType product_2 = eigenvector * r_singular_vector;
// the tolerance is reduced for the singular vectors
- AssertThrow(
- (std::abs(product_1) - 1) < tol * 10,
- ExcMessage("left singular vectors and eigenvectors do not coincide"));
- AssertThrow(
- (std::abs(product_2) - 1) < tol * 10,
- ExcMessage("right singular vectors and eigenvectors do not coincide"));
+ AssertThrow((std::abs(product_1) - 1) < tol * 10,
+ ExcMessage(
+ "left singular vectors and eigenvectors do not coincide"));
+ AssertThrow((std::abs(product_2) - 1) < tol * 10,
+ ExcMessage(
+ "right singular vectors and eigenvectors do not coincide"));
}
pcout
<< " with respect to the given tolerance the right and left singular vectors coincide with the eigenvectors"
grid,
block_size_j,
block_size_i);
- scalapack_matrix.copy_to(
- scalapack_matrix_dest, offset_A, offset_B, submatrix_size);
+ scalapack_matrix.copy_to(scalapack_matrix_dest,
+ offset_A,
+ offset_B,
+ submatrix_size);
FullMatrix<NumberType> dest(sub_size + offset_B.first,
sub_size + offset_B.second);
scalapack_matrix_dest.copy_to(dest);
const unsigned int proc_columns = std::floor(n_mpi_processes / proc_rows);
// create 2d process grid
std::shared_ptr<Utilities::MPI::ProcessGrid> grid =
- std::make_shared<Utilities::MPI::ProcessGrid>(
- mpi_communicator, proc_rows, proc_columns);
+ std::make_shared<Utilities::MPI::ProcessGrid>(mpi_communicator,
+ proc_rows,
+ proc_columns);
pcout << "2D process grid: " << grid->get_process_grid_rows() << "x"
<< grid->get_process_grid_columns() << std::endl
<< std::endl;
const unsigned int proc_columns = std::floor(n_mpi_processes / proc_rows);
// create 2d process grid
std::shared_ptr<Utilities::MPI::ProcessGrid> grid =
- std::make_shared<Utilities::MPI::ProcessGrid>(
- mpi_communicator, proc_rows, proc_columns);
+ std::make_shared<Utilities::MPI::ProcessGrid>(mpi_communicator,
+ proc_rows,
+ proc_columns);
pcout << "2D process grid: " << grid->get_process_grid_rows() << "x"
<< grid->get_process_grid_columns() << std::endl
<< std::endl;
const unsigned int proc_columns = std::floor(n_mpi_processes / proc_rows);
// create 2d process grid
std::shared_ptr<Utilities::MPI::ProcessGrid> grid =
- std::make_shared<Utilities::MPI::ProcessGrid>(
- mpi_communicator, proc_rows, proc_columns);
+ std::make_shared<Utilities::MPI::ProcessGrid>(mpi_communicator,
+ proc_rows,
+ proc_columns);
pcout << "2D process grid: " << grid->get_process_grid_rows() << "x"
<< grid->get_process_grid_columns() << std::endl
<< std::endl;
const unsigned int proc_columns = std::floor(n_mpi_processes / proc_rows);
// create 2d process grid
std::shared_ptr<Utilities::MPI::ProcessGrid> grid =
- std::make_shared<Utilities::MPI::ProcessGrid>(
- mpi_communicator, proc_rows, proc_columns);
+ std::make_shared<Utilities::MPI::ProcessGrid>(mpi_communicator,
+ proc_rows,
+ proc_columns);
pcout << "2D process grid: " << grid->get_process_grid_rows() << "x"
<< grid->get_process_grid_columns() << std::endl
<< std::endl;
const unsigned int proc_columns = std::floor(n_mpi_processes / proc_rows);
// create 2d process grid
std::shared_ptr<Utilities::MPI::ProcessGrid> grid =
- std::make_shared<Utilities::MPI::ProcessGrid>(
- mpi_communicator, proc_rows, proc_columns);
+ std::make_shared<Utilities::MPI::ProcessGrid>(mpi_communicator,
+ proc_rows,
+ proc_columns);
pcout << "2D process grid: " << grid->get_process_grid_rows() << "x"
<< grid->get_process_grid_columns() << std::endl
<< std::endl;
const unsigned int proc_columns = std::floor(n_mpi_processes / proc_rows);
// create 2d process grid
std::shared_ptr<Utilities::MPI::ProcessGrid> grid =
- std::make_shared<Utilities::MPI::ProcessGrid>(
- mpi_communicator, proc_rows, proc_columns);
+ std::make_shared<Utilities::MPI::ProcessGrid>(mpi_communicator,
+ proc_rows,
+ proc_columns);
pcout << "2D process grid: " << grid->get_process_grid_rows() << "x"
<< grid->get_process_grid_columns() << std::endl
<< std::endl;
<< " eigenvalues and eigenvectors computed using LAPACK and ScaLAPACK p_syevr:"
<< std::endl;
const std::vector<NumberType> eigenvalues_psyer =
- scalapack_syevr.eigenpairs_symmetric_by_index_MRRR(
- std::make_pair(0, size - 1), true);
+ scalapack_syevr.eigenpairs_symmetric_by_index_MRRR(std::make_pair(0,
+ size - 1),
+ true);
scalapack_syevr.copy_to(p_eigenvectors);
for (unsigned int i = 0; i < max_n_eigenvalues; ++i)
AssertThrow(std::abs(eigenvalues_psyer[n_eigenvalues - i - 1] -
<< " eigenvalues computed using LAPACK and ScaLAPACK p_syevr:"
<< std::endl;
const std::vector<NumberType> eigenvalues_psyer =
- scalapack_syevr.eigenpairs_symmetric_by_index_MRRR(
- std::make_pair(0, size - 1), false);
+ scalapack_syevr.eigenpairs_symmetric_by_index_MRRR(std::make_pair(0,
+ size - 1),
+ false);
scalapack_syevr.copy_to(p_eigenvectors);
for (unsigned int i = 0; i < max_n_eigenvalues; ++i)
AssertThrow(std::abs(eigenvalues_psyer[n_eigenvalues - i - 1] -
do_boundary(tria);
- FESystem<dim, spacedim> fe(
- FE_Q<dim, spacedim>(2), dim, FE_Q<dim, spacedim>(1), 1);
+ FESystem<dim, spacedim> fe(FE_Q<dim, spacedim>(2),
+ dim,
+ FE_Q<dim, spacedim>(1),
+ 1);
DoFHandler<dim, spacedim> dof_1(tria);
DoFHandler<dim, spacedim> dof_2(tria);
// things with strange characters
prm1.enter_subsection("Testing%testing");
{
- prm1.declare_entry(
- "string&list", "< & > ; /", Patterns::Anything(), "docs 1");
+ prm1.declare_entry("string&list",
+ "< & > ; /",
+ Patterns::Anything(),
+ "docs 1");
prm1.declare_entry("int*int", "2", Patterns::Integer());
- prm1.declare_entry(
- "double+double", "6.1415926", Patterns::Double(), "docs 3");
+ prm1.declare_entry("double+double",
+ "6.1415926",
+ Patterns::Double(),
+ "docs 3");
}
prm1.leave_subsection();
prm2.enter_subsection("Testing%testing");
{
prm2.declare_entry("int*int", "2", Patterns::Integer());
- prm2.declare_entry(
- "string&list", "< & > ; /", Patterns::Anything(), "docs 1");
+ prm2.declare_entry("string&list",
+ "< & > ; /",
+ Patterns::Anything(),
+ "docs 1");
}
prm2.leave_subsection();
static_cast<double>(particles_per_direction - 1);
id = i * particles_per_direction * particles_per_direction +
j * particles_per_direction + k;
- Particles::Particle<dim, spacedim> particle(
- position, reference_position, id);
+ Particles::Particle<dim, spacedim> particle(position,
+ reference_position,
+ id);
typename parallel::distributed::Triangulation<dim, spacedim>::
active_cell_iterator cell =
}
else
{
- Particles::Particle<dim, spacedim> particle(
- position, reference_position, id);
+ Particles::Particle<dim, spacedim> particle(position,
+ reference_position,
+ id);
typename parallel::distributed::Triangulation<dim, spacedim>::
active_cell_iterator cell =
it != p4est_map.end();
++it)
{
- AssertThrow(
- shared_map[it->first] == it->second,
- ExcMessage("Not all CellIds map to correct level subdomain_ids."))
+ AssertThrow(shared_map[it->first] == it->second,
+ ExcMessage(
+ "Not all CellIds map to correct level subdomain_ids."))
}
Utilities::MPI::MPI_InitFinalize mpi_initialization(argc, argv, 1);
{
- SolverControl control(
- 5000, 1e-11 /*1000*PETSC_MACHINE_EPSILON*/, false, false);
+ SolverControl control(5000,
+ 1e-11 /*1000*PETSC_MACHINE_EPSILON*/,
+ false,
+ false);
const unsigned int size = 46;
unsigned int dim = (size - 1) * (size - 1);
{
SLEPcWrappers::SolverGeneralizedDavidson::AdditionalData data(true);
- SLEPcWrappers::SolverGeneralizedDavidson solver(
- control, PETSC_COMM_SELF, data);
+ SLEPcWrappers::SolverGeneralizedDavidson solver(control,
+ PETSC_COMM_SELF,
+ data);
check_solve(solver, control, A, B, u, v);
}
check_solver_within_range((void)true, solver_control.last_step(), 5, 5);
break;
case 2:
- check_solver_within_range(
- (void)true, solver_control.last_step(), 24, 24);
+ check_solver_within_range((void)true,
+ solver_control.last_step(),
+ 24,
+ 24);
break;
case 3:
- check_solver_within_range(
- (void)true, solver_control.last_step(), 21, 21);
+ check_solver_within_range((void)true,
+ solver_control.last_step(),
+ 21,
+ 21);
break;
// below the spread is bigger since Slepc 3.8:
case 4:
- check_solver_within_range(
- (void)true, solver_control.last_step(), 119, 128);
+ check_solver_within_range((void)true,
+ solver_control.last_step(),
+ 119,
+ 128);
break;
case 5:
- check_solver_within_range(
- (void)true, solver_control.last_step(), 127, 138);
+ check_solver_within_range((void)true,
+ solver_control.last_step(),
+ 127,
+ 138);
break;
case 6:
- check_solver_within_range(
- (void)true, solver_control.last_step(), 44, 51);
+ check_solver_within_range((void)true,
+ solver_control.last_step(),
+ 44,
+ 51);
break;
default:
Assert(false, ExcNotImplemented());
Utilities::MPI::MPI_InitFinalize mpi_initialization(argc, argv, 1);
{
- SolverControl control(
- 500, 1e-12 /*1000*PETSC_MACHINE_EPSILON*/, false, false);
+ SolverControl control(500,
+ 1e-12 /*1000*PETSC_MACHINE_EPSILON*/,
+ false,
+ false);
const unsigned int size = 31;
{
SLEPcWrappers::SolverGeneralizedDavidson::AdditionalData data(true);
- SLEPcWrappers::SolverGeneralizedDavidson solver(
- control, PETSC_COMM_SELF, data);
+ SLEPcWrappers::SolverGeneralizedDavidson solver(control,
+ PETSC_COMM_SELF,
+ data);
check_solve(solver, 5, control, A, u, v);
}
for (unsigned int i = 0; i < n_mpi_processes; i++)
n_locally_owned_dofs[i] = locally_owned_dofs_per_processor[i].n_elements();
- dealii::SparsityTools::distribute_sparsity_pattern(
- csp, n_locally_owned_dofs, mpi_communicator, locally_relevant_dofs);
+ dealii::SparsityTools::distribute_sparsity_pattern(csp,
+ n_locally_owned_dofs,
+ mpi_communicator,
+ locally_relevant_dofs);
// initialize the stiffness and mass matrices
- stiffness_matrix.reinit(
- locally_owned_dofs, locally_owned_dofs, csp, mpi_communicator);
+ stiffness_matrix.reinit(locally_owned_dofs,
+ locally_owned_dofs,
+ csp,
+ mpi_communicator);
- mass_matrix.reinit(
- locally_owned_dofs, locally_owned_dofs, csp, mpi_communicator);
+ mass_matrix.reinit(locally_owned_dofs,
+ locally_owned_dofs,
+ csp,
+ mpi_communicator);
eigenfunctions.resize(5);
for (unsigned int i = 0; i < eigenfunctions.size(); ++i)
mass_matrix = 0;
dealii::QGauss<dim> quadrature_formula(2);
- dealii::FEValues<dim> fe_values(
- fe,
- quadrature_formula,
- dealii::update_values | dealii::update_gradients |
- dealii::update_quadrature_points | dealii::update_JxW_values);
+ dealii::FEValues<dim> fe_values(fe,
+ quadrature_formula,
+ dealii::update_values |
+ dealii::update_gradients |
+ dealii::update_quadrature_points |
+ dealii::update_JxW_values);
const unsigned int dofs_per_cell = fe.dofs_per_cell;
const unsigned int n_q_points = quadrature_formula.size();
cell->get_dof_indices(local_dof_indices);
- constraints.distribute_local_to_global(
- cell_stiffness_matrix, local_dof_indices, stiffness_matrix);
- constraints.distribute_local_to_global(
- cell_mass_matrix, local_dof_indices, mass_matrix);
+ constraints.distribute_local_to_global(cell_stiffness_matrix,
+ local_dof_indices,
+ stiffness_matrix);
+ constraints.distribute_local_to_global(cell_mass_matrix,
+ local_dof_indices,
+ mass_matrix);
}
stiffness_matrix.compress(dealii::VectorOperation::add);
mpi_communicator);
linear_solver.initialize(*preconditioner);
- dealii::SolverControl solver_control(
- 100, 1e-11, /*log_history*/ false, /*log_results*/ false);
+ dealii::SolverControl solver_control(100,
+ 1e-11,
+ /*log_history*/ false,
+ /*log_results*/ false);
dealii::SLEPcWrappers::SolverBase *eigensolver;
// Get a handle on the wanted eigenspectrum solver
if (solver_name == "KrylovSchur")
{
- eigensolver = new dealii::SLEPcWrappers::SolverKrylovSchur(
- solver_control, mpi_communicator);
+ eigensolver =
+ new dealii::SLEPcWrappers::SolverKrylovSchur(solver_control,
+ mpi_communicator);
}
else if (solver_name == "GeneralizedDavidson")
}
else if (solver_name == "JacobiDavidson")
{
- eigensolver = new dealii::SLEPcWrappers::SolverJacobiDavidson(
- solver_control, mpi_communicator);
+ eigensolver =
+ new dealii::SLEPcWrappers::SolverJacobiDavidson(solver_control,
+ mpi_communicator);
}
else if (solver_name == "Lanczos")
{
- eigensolver = new dealii::SLEPcWrappers::SolverLanczos(
- solver_control, mpi_communicator);
+ eigensolver =
+ new dealii::SLEPcWrappers::SolverLanczos(solver_control,
+ mpi_communicator);
}
else
{
// Make compiler happy and not complaining about non
// uninitialized variables
- eigensolver = new dealii::SLEPcWrappers::SolverKrylovSchur(
- solver_control, mpi_communicator);
+ eigensolver =
+ new dealii::SLEPcWrappers::SolverKrylovSchur(solver_control,
+ mpi_communicator);
}
SLEPcWrappers::TransformationShiftInvert::AdditionalData additional_data(
try
{
- dealii::Utilities::MPI::MPI_InitFinalize mpi_initialization(
- argc, argv, 1);
+ dealii::Utilities::MPI::MPI_InitFinalize mpi_initialization(argc,
+ argv,
+ 1);
{
test("KrylovSchur", "Jacobi");
test("KrylovSchur", "BlockJacobi");
for (unsigned int i = 0; i < n_mpi_processes; i++)
n_locally_owned_dofs[i] = locally_owned_dofs_per_processor[i].n_elements();
- dealii::SparsityTools::distribute_sparsity_pattern(
- csp, n_locally_owned_dofs, mpi_communicator, locally_relevant_dofs);
+ dealii::SparsityTools::distribute_sparsity_pattern(csp,
+ n_locally_owned_dofs,
+ mpi_communicator,
+ locally_relevant_dofs);
// initialize the stiffness and mass matrices
- stiffness_matrix.reinit(
- locally_owned_dofs, locally_owned_dofs, csp, mpi_communicator);
+ stiffness_matrix.reinit(locally_owned_dofs,
+ locally_owned_dofs,
+ csp,
+ mpi_communicator);
- mass_matrix.reinit(
- locally_owned_dofs, locally_owned_dofs, csp, mpi_communicator);
+ mass_matrix.reinit(locally_owned_dofs,
+ locally_owned_dofs,
+ csp,
+ mpi_communicator);
eigenfunctions.resize(5);
for (unsigned int i = 0; i < eigenfunctions.size(); ++i)
mass_matrix = 0;
dealii::QGauss<dim> quadrature_formula(2);
- dealii::FEValues<dim> fe_values(
- fe,
- quadrature_formula,
- dealii::update_values | dealii::update_gradients |
- dealii::update_quadrature_points | dealii::update_JxW_values);
+ dealii::FEValues<dim> fe_values(fe,
+ quadrature_formula,
+ dealii::update_values |
+ dealii::update_gradients |
+ dealii::update_quadrature_points |
+ dealii::update_JxW_values);
const unsigned int dofs_per_cell = fe.dofs_per_cell;
const unsigned int n_q_points = quadrature_formula.size();
cell->get_dof_indices(local_dof_indices);
- constraints.distribute_local_to_global(
- cell_stiffness_matrix, local_dof_indices, stiffness_matrix);
- constraints.distribute_local_to_global(
- cell_mass_matrix, local_dof_indices, mass_matrix);
+ constraints.distribute_local_to_global(cell_stiffness_matrix,
+ local_dof_indices,
+ stiffness_matrix);
+ constraints.distribute_local_to_global(cell_mass_matrix,
+ local_dof_indices,
+ mass_matrix);
}
stiffness_matrix.compress(dealii::VectorOperation::add);
mpi_communicator);
linear_solver.initialize(*preconditioner);
- dealii::SolverControl solver_control(
- 100, 1e-11, /*log_history*/ false, /*log_results*/ false);
+ dealii::SolverControl solver_control(100,
+ 1e-11,
+ /*log_history*/ false,
+ /*log_results*/ false);
dealii::SLEPcWrappers::SolverBase *eigensolver;
// Get a handle on the wanted eigenspectrum solver
if (solver_name == "KrylovSchur")
{
- eigensolver = new dealii::SLEPcWrappers::SolverKrylovSchur(
- solver_control, mpi_communicator);
+ eigensolver =
+ new dealii::SLEPcWrappers::SolverKrylovSchur(solver_control,
+ mpi_communicator);
}
else if (solver_name == "GeneralizedDavidson")
}
else if (solver_name == "JacobiDavidson")
{
- eigensolver = new dealii::SLEPcWrappers::SolverJacobiDavidson(
- solver_control, mpi_communicator);
+ eigensolver =
+ new dealii::SLEPcWrappers::SolverJacobiDavidson(solver_control,
+ mpi_communicator);
}
else if (solver_name == "Lanczos")
{
- eigensolver = new dealii::SLEPcWrappers::SolverLanczos(
- solver_control, mpi_communicator);
+ eigensolver =
+ new dealii::SLEPcWrappers::SolverLanczos(solver_control,
+ mpi_communicator);
}
else
{
// Make compiler happy and not complaining about non
// uninitialized variables
- eigensolver = new dealii::SLEPcWrappers::SolverKrylovSchur(
- solver_control, mpi_communicator);
+ eigensolver =
+ new dealii::SLEPcWrappers::SolverKrylovSchur(solver_control,
+ mpi_communicator);
}
PETScWrappers::set_option_value("-st_pc_factor_mat_solver_package",
try
{
- dealii::Utilities::MPI::MPI_InitFinalize mpi_initialization(
- argc, argv, 1);
+ dealii::Utilities::MPI::MPI_InitFinalize mpi_initialization(argc,
+ argv,
+ 1);
{
test("KrylovSchur", "Jacobi");
test("KrylovSchur", "BlockJacobi");
for (unsigned int i = 0; i < n_mpi_processes; i++)
n_locally_owned_dofs[i] = locally_owned_dofs_per_processor[i].n_elements();
- dealii::SparsityTools::distribute_sparsity_pattern(
- csp, n_locally_owned_dofs, mpi_communicator, locally_relevant_dofs);
+ dealii::SparsityTools::distribute_sparsity_pattern(csp,
+ n_locally_owned_dofs,
+ mpi_communicator,
+ locally_relevant_dofs);
// initialize the stiffness and mass matrices
- stiffness_matrix.reinit(
- locally_owned_dofs, locally_owned_dofs, csp, mpi_communicator);
+ stiffness_matrix.reinit(locally_owned_dofs,
+ locally_owned_dofs,
+ csp,
+ mpi_communicator);
- mass_matrix.reinit(
- locally_owned_dofs, locally_owned_dofs, csp, mpi_communicator);
+ mass_matrix.reinit(locally_owned_dofs,
+ locally_owned_dofs,
+ csp,
+ mpi_communicator);
eigenfunctions.resize(5);
for (unsigned int i = 0; i < eigenfunctions.size(); ++i)
mass_matrix = 0;
dealii::QGauss<dim> quadrature_formula(2);
- dealii::FEValues<dim> fe_values(
- fe,
- quadrature_formula,
- dealii::update_values | dealii::update_gradients |
- dealii::update_quadrature_points | dealii::update_JxW_values);
+ dealii::FEValues<dim> fe_values(fe,
+ quadrature_formula,
+ dealii::update_values |
+ dealii::update_gradients |
+ dealii::update_quadrature_points |
+ dealii::update_JxW_values);
const unsigned int dofs_per_cell = fe.dofs_per_cell;
const unsigned int n_q_points = quadrature_formula.size();
cell->get_dof_indices(local_dof_indices);
- constraints.distribute_local_to_global(
- cell_stiffness_matrix, local_dof_indices, stiffness_matrix);
- constraints.distribute_local_to_global(
- cell_mass_matrix, local_dof_indices, mass_matrix);
+ constraints.distribute_local_to_global(cell_stiffness_matrix,
+ local_dof_indices,
+ stiffness_matrix);
+ constraints.distribute_local_to_global(cell_mass_matrix,
+ local_dof_indices,
+ mass_matrix);
}
stiffness_matrix.compress(dealii::VectorOperation::add);
mpi_communicator);
linear_solver.initialize(*preconditioner);
- dealii::SolverControl solver_control(
- 100, 1e-12, /*log_history*/ false, /*log_results*/ false);
+ dealii::SolverControl solver_control(100,
+ 1e-12,
+ /*log_history*/ false,
+ /*log_results*/ false);
dealii::SLEPcWrappers::SolverBase *eigensolver;
// Get a handle on the wanted eigenspectrum solver
if (solver_name == "KrylovSchur")
{
- eigensolver = new dealii::SLEPcWrappers::SolverKrylovSchur(
- solver_control, mpi_communicator);
+ eigensolver =
+ new dealii::SLEPcWrappers::SolverKrylovSchur(solver_control,
+ mpi_communicator);
}
else if (solver_name == "GeneralizedDavidson")
}
else if (solver_name == "JacobiDavidson")
{
- eigensolver = new dealii::SLEPcWrappers::SolverJacobiDavidson(
- solver_control, mpi_communicator);
+ eigensolver =
+ new dealii::SLEPcWrappers::SolverJacobiDavidson(solver_control,
+ mpi_communicator);
}
else if (solver_name == "Lanczos")
{
- eigensolver = new dealii::SLEPcWrappers::SolverLanczos(
- solver_control, mpi_communicator);
+ eigensolver =
+ new dealii::SLEPcWrappers::SolverLanczos(solver_control,
+ mpi_communicator);
}
else
{
// Make compiler happy and not complaining about non
// uninitialized variables
- eigensolver = new dealii::SLEPcWrappers::SolverKrylovSchur(
- solver_control, mpi_communicator);
+ eigensolver =
+ new dealii::SLEPcWrappers::SolverKrylovSchur(solver_control,
+ mpi_communicator);
}
// Set the initial vector. This is optional, if not done the initial vector
eigensolver->set_which_eigenpairs(EPS_LARGEST_REAL);
eigensolver->set_problem_type(EPS_HEP);
- eigensolver->solve(
- stiffness_matrix, eigenvalues, eigenfunctions, eigenfunctions.size());
+ eigensolver->solve(stiffness_matrix,
+ eigenvalues,
+ eigenfunctions,
+ eigenfunctions.size());
// TODO make this robust on different platforms. Seems related to GHEP
// as solve_04 works ok.
try
{
- dealii::Utilities::MPI::MPI_InitFinalize mpi_initialization(
- argc, argv, 1);
+ dealii::Utilities::MPI::MPI_InitFinalize mpi_initialization(argc,
+ argv,
+ 1);
{
test("KrylovSchur", "Jacobi");
test("KrylovSchur", "BlockJacobi");
// --------------- inline and template functions -----------------
-inline FDDiagMatrix::FDDiagMatrix(unsigned int nx, unsigned int ny) :
- nx(nx),
- ny(ny)
+inline FDDiagMatrix::FDDiagMatrix(unsigned int nx, unsigned int ny)
+ : nx(nx)
+ , ny(ny)
{}
// --------------- inline and template functions -----------------
-inline FD1DLaplaceMatrix::FD1DLaplaceMatrix(unsigned int n) : n(n)
+inline FD1DLaplaceMatrix::FD1DLaplaceMatrix(unsigned int n)
+ : n(n)
{}
sparsity.back().insert(p->column());
};
SparsityPattern sp4;
- sp4.copy_from(
- (N - 1) * (N - 1), (N - 1) * (N - 1), sparsity.begin(), sparsity.end());
+ sp4.copy_from((N - 1) * (N - 1),
+ (N - 1) * (N - 1),
+ sparsity.begin(),
+ sparsity.end());
// now check for equivalence of sp3 and sp4
for (unsigned int row = 0; row < sp3.n_rows(); ++row)
const SparsityPattern &sp =
(loop == 1 ? sp1 : (loop == 2 ? sp2 : (loop == 3 ? sp3 : sp4)));
for (unsigned int i = 0; i < sp.n_nonzero_elements(); ++i)
- AssertThrow(
- sp(sp.matrix_position(i).first, sp.matrix_position(i).second) == i,
- ExcInternalError());
+ AssertThrow(sp(sp.matrix_position(i).first,
+ sp.matrix_position(i).second) == i,
+ ExcInternalError());
for (types::global_dof_index row = 0; row < sp.n_rows(); ++row)
for (types::global_dof_index col = 0; col < sp.n_cols(); ++col)
if (sp(row, col) != SparsityPattern::invalid_entry)
const std::list<std::set<unsigned int, std::greater<unsigned int>>> &sparsity,
SparsityPattern & sp4)
{
- sp4.copy_from(
- (N - 1) * (N - 1), (N - 1) * (N - 1), sparsity.begin(), sparsity.end());
+ sp4.copy_from((N - 1) * (N - 1),
+ (N - 1) * (N - 1),
+ sparsity.begin(),
+ sparsity.end());
}
// and copy
if (sp4.stores_only_added_elements() == true)
{
- AssertThrow(
- sp4.n_nonzero_elements() ==
- static_cast<unsigned int>(sparsity_pattern.frobenius_norm() *
- sparsity_pattern.frobenius_norm() +
- 0.5),
- ExcInternalError());
+ AssertThrow(sp4.n_nonzero_elements() ==
+ static_cast<unsigned int>(
+ sparsity_pattern.frobenius_norm() *
+ sparsity_pattern.frobenius_norm() +
+ 0.5),
+ ExcInternalError());
}
else
{
- AssertThrow(
- sp4.n_nonzero_elements() >=
- static_cast<unsigned int>(sparsity_pattern.frobenius_norm() *
- sparsity_pattern.frobenius_norm() +
- 0.5),
- ExcInternalError());
+ AssertThrow(sp4.n_nonzero_elements() >=
+ static_cast<unsigned int>(
+ sparsity_pattern.frobenius_norm() *
+ sparsity_pattern.frobenius_norm() +
+ 0.5),
+ ExcInternalError());
}
for (unsigned int i = 0; i < M; ++i)
PETScWrappers::MPI::Vector vec2(local_dofs, MPI_COMM_WORLD);
SUNDIALS::internal::copy(vec2, sundials_vector);
- AssertThrow(
- vec2 == vec,
- ExcMessage("The two PETSc vectors should be equal since they are "
- "copies (by means of an intermediate SUNDIALs vector)"));
+ AssertThrow(vec2 == vec,
+ ExcMessage(
+ "The two PETSc vectors should be equal since they are "
+ "copies (by means of an intermediate SUNDIALs vector)"));
deallog << "n_local_dofs: " << n_local_dofs << std::endl;
deallog << "OK" << std::endl;
public:
HarmonicOscillator(
double _kappa,
- const typename SUNDIALS::IDA<Vector<double>>::AdditionalData &data) :
- time_stepper(data),
- y(2),
- y_dot(2),
- J(2, 2),
- A(2, 2),
- Jinv(2, 2),
- kappa(_kappa),
- out("output")
+ const typename SUNDIALS::IDA<Vector<double>>::AdditionalData &data)
+ : time_stepper(data)
+ , y(2)
+ , y_dot(2)
+ , J(2, 2)
+ , A(2, 2)
+ , Jinv(2, 2)
+ , kappa(_kappa)
+ , out("output")
{
typedef Vector<double> VectorType;
AssertThrow(t == transpose(t), ExcInternalError());
// check norm of tensor
- AssertThrow(
- std::fabs(t.norm() - std::sqrt(1. * 1 + 2 * 2 + 3 * 3 + 2 * 14 * 14 +
- 2 * 5 * 5 + 2 * 6 * 6)) < 1e-14,
- ExcInternalError());
+ AssertThrow(std::fabs(t.norm() -
+ std::sqrt(1. * 1 + 2 * 2 + 3 * 3 + 2 * 14 * 14 +
+ 2 * 5 * 5 + 2 * 6 * 6)) < 1e-14,
+ ExcInternalError());
// make sure norm is induced by scalar
// product
// test 1: check trace-like operator
{
- const SymmetricTensor<4, dim> T = outer_product<dim>(
- unit_symmetric_tensor<dim>(), unit_symmetric_tensor<dim>());
+ const SymmetricTensor<4, dim> T =
+ outer_product<dim>(unit_symmetric_tensor<dim>(),
+ unit_symmetric_tensor<dim>());
// T*t should yield a diagonal tensor
// where the diagonal elements are the
// t_times_1 should be a multiple of the
// unit tensor, given the structure we have
// given to it
- AssertThrow(
- (t_times_1 - (dim * 10000 + 2 * 100) * unit_symmetric_tensor<dim>())
- .norm() < 1e-14 * t_times_1.norm(),
- ExcInternalError());
+ AssertThrow((t_times_1 -
+ (dim * 10000 + 2 * 100) * unit_symmetric_tensor<dim>())
+ .norm() < 1e-14 * t_times_1.norm(),
+ ExcInternalError());
}
SymmetricTensor<2, 1> t1;
t1[0][0] = 2.0;
deallog << invert(t1) << std::endl;
- Assert(
- (static_cast<Tensor<2, 1>>(invert(t1)) * static_cast<Tensor<2, 1>>(t1) -
- unit_symmetric_tensor<1>())
- .norm() < 1e-12,
- ExcMessage("Dim 1 inverse symmetric tensor definition is incorrect"));
+ Assert((static_cast<Tensor<2, 1>>(invert(t1)) *
+ static_cast<Tensor<2, 1>>(t1) -
+ unit_symmetric_tensor<1>())
+ .norm() < 1e-12,
+ ExcMessage("Dim 1 inverse symmetric tensor definition is incorrect"));
deallog << "Symmetric Tensor dim 2" << std::endl;
SymmetricTensor<2, 2> t2;
t2[0][1] = 1.0;
t2[1][1] = 1.5;
deallog << invert(t2) << std::endl;
- Assert(
- (static_cast<Tensor<2, 2>>(invert(t2)) * static_cast<Tensor<2, 2>>(t2) -
- unit_symmetric_tensor<2>())
- .norm() < 1e-12,
- ExcMessage("Dim 2 inverse symmetric tensor definition is incorrect"));
+ Assert((static_cast<Tensor<2, 2>>(invert(t2)) *
+ static_cast<Tensor<2, 2>>(t2) -
+ unit_symmetric_tensor<2>())
+ .norm() < 1e-12,
+ ExcMessage("Dim 2 inverse symmetric tensor definition is incorrect"));
deallog << "Symmetric Tensor dim 3" << std::endl;
SymmetricTensor<2, 3> t3;
t3[1][2] = 0.25;
t3[2][2] = 1.25;
deallog << invert(t3) << std::endl;
- Assert(
- (static_cast<Tensor<2, 3>>(invert(t3)) * static_cast<Tensor<2, 3>>(t3) -
- unit_symmetric_tensor<3>())
- .norm() < 1e-12,
- ExcMessage("Dim 3 inverse symmetric tensor definition is incorrect"));
+ Assert((static_cast<Tensor<2, 3>>(invert(t3)) *
+ static_cast<Tensor<2, 3>>(t3) -
+ unit_symmetric_tensor<3>())
+ .norm() < 1e-12,
+ ExcMessage("Dim 3 inverse symmetric tensor definition is incorrect"));
deallog << "OK" << std::endl;
}
const T3<rank3, dim, number> & r)
{
const double res1 = contract3(l, m, r);
- const double res2 = contract3(
- static_cast<Tensor<rank1, dim>>(l), m, static_cast<Tensor<rank3, dim>>(r));
+ const double res2 = contract3(static_cast<Tensor<rank1, dim>>(l),
+ m,
+ static_cast<Tensor<rank3, dim>>(r));
Assert(std::abs(res1 - res2) < 1e-12,
ExcMessage("Result from symmetric tensor contract3 is incorrect."));
}
for (unsigned int j = 0; j < dim; ++j)
for (unsigned int k = 0; k < dim; ++k)
{
- AssertThrow(
- TableIndices<3>(i, j, k) ==
- T::unrolled_to_component_indices(i * dim * dim + j * dim + k),
- ExcInternalError());
- AssertThrow(T::component_to_unrolled_index(TableIndices<3>(
- i, j, k)) == i * dim * dim + j * dim + k,
+ AssertThrow(TableIndices<3>(i, j, k) ==
+ T::unrolled_to_component_indices(i * dim * dim +
+ j * dim + k),
+ ExcInternalError());
+ AssertThrow(T::component_to_unrolled_index(
+ TableIndices<3>(i, j, k)) ==
+ i * dim * dim + j * dim + k,
ExcInternalError());
AssertThrow(t[TableIndices<3>(i, j, k)] == t[i][j][k],
ExcInternalError());
deallog << "middle: " << middle4 << std::endl;
deallog << "right: " << middle << std::endl;
deallog << "Result: "
- << TensorAccessors::contract3<2, 2, 5, long int>(
- left2, middle4, middle)
+ << TensorAccessors::contract3<2, 2, 5, long int>(left2,
+ middle4,
+ middle)
<< std::endl;
deallog << std::endl;
// manually verified to be equal to the old implementation
// --------------- inline and template functions -----------------
-inline FDMatrix::FDMatrix(unsigned int nx, unsigned int ny) : nx(nx), ny(ny)
+inline FDMatrix::FDMatrix(unsigned int nx, unsigned int ny)
+ : nx(nx)
+ , ny(ny)
{}
* steps.
*/
-#define check_solver_within_range( \
- SolverType_COMMAND, CONTROL_COMMAND, MIN_ALLOWED, MAX_ALLOWED) \
+#define check_solver_within_range(SolverType_COMMAND, \
+ CONTROL_COMMAND, \
+ MIN_ALLOWED, \
+ MAX_ALLOWED) \
{ \
const unsigned int previous_depth = deallog.depth_file(0); \
try \
Utilities::Trilinos::comm_world());
Assert(n_dofs % n_jobs == 0, ExcInternalError());
const unsigned int n_local_dofs = n_dofs / n_jobs;
- Epetra_Map map(
- static_cast<TrilinosWrappers::types::int_type>(n_dofs),
- static_cast<TrilinosWrappers::types::int_type>(n_local_dofs),
- Utilities::Trilinos::comm_world());
+ Epetra_Map map(static_cast<TrilinosWrappers::types::int_type>(n_dofs),
+ static_cast<TrilinosWrappers::types::int_type>(
+ n_local_dofs),
+ Utilities::Trilinos::comm_world());
TrilinosWrappers::SparseMatrix v2(map, 5);
test(v2);
}
struct Data
{
Data(const hp::FECollection<dim> &fe,
- const hp::QCollection<dim> & quadrature) :
- hp_fe_values(fe,
- quadrature,
- update_values | update_gradients |
- update_quadrature_points | update_JxW_values)
+ const hp::QCollection<dim> & quadrature)
+ : hp_fe_values(fe,
+ quadrature,
+ update_values | update_gradients |
+ update_quadrature_points | update_JxW_values)
{}
- Data(const Data &data) :
- hp_fe_values(data.hp_fe_values.get_mapping_collection(),
- data.hp_fe_values.get_fe_collection(),
- data.hp_fe_values.get_quadrature_collection(),
- data.hp_fe_values.get_update_flags())
+ Data(const Data &data)
+ : hp_fe_values(data.hp_fe_values.get_mapping_collection(),
+ data.hp_fe_values.get_fe_collection(),
+ data.hp_fe_values.get_quadrature_collection(),
+ data.hp_fe_values.get_update_flags())
{}
hp::FEValues<dim> hp_fe_values;
class BoundaryValues : public Function<dim>
{
public:
- BoundaryValues() : Function<dim>()
+ BoundaryValues()
+ : Function<dim>()
{}
virtual double
class RightHandSide : public Function<dim>
{
public:
- RightHandSide() : Function<dim>()
+ RightHandSide()
+ : Function<dim>()
{}
virtual double
template <int dim>
-LaplaceProblem<dim>::LaplaceProblem() :
- dof_handler(triangulation),
- max_degree(5)
+LaplaceProblem<dim>::LaplaceProblem()
+ : dof_handler(triangulation)
+ , max_degree(5)
{
if (dim == 2)
for (unsigned int degree = 2; degree <= max_degree; ++degree)
// having added the hanging node constraints in order to be consistent and
// skip dofs that are already constrained (i.e., are hanging nodes on the
// boundary in 3D). In contrast to step-27, we choose a sine function.
- VectorTools::interpolate_boundary_values(
- dof_handler, 0, BoundaryValues<dim>(), constraints);
+ VectorTools::interpolate_boundary_values(dof_handler,
+ 0,
+ BoundaryValues<dim>(),
+ constraints);
constraints.close();
graph = GraphColoring::make_graph_coloring(
DynamicSparsityPattern csp(dof_handler.n_dofs(), dof_handler.n_dofs());
DoFTools::make_sparsity_pattern(dof_handler, csp, constraints, false);
- reference_matrix.reinit(
- dof_handler.locally_owned_dofs(), csp, MPI_COMM_WORLD);
+ reference_matrix.reinit(dof_handler.locally_owned_dofs(),
+ csp,
+ MPI_COMM_WORLD);
test_matrix.reinit(reference_matrix);
}
test_matrix = 0;
test_rhs = 0;
- WorkStream::run(
- graph,
- std::bind(&LaplaceProblem<dim>::local_assemble,
- this,
- std::placeholders::_1,
- std::placeholders::_2,
- std::placeholders::_3),
- std::bind(
- &LaplaceProblem<dim>::copy_local_to_global, this, std::placeholders::_1),
- Assembly::Scratch::Data<dim>(fe_collection, quadrature_collection),
- Assembly::Copy::Data(),
- 2 * MultithreadInfo::n_threads(),
- 1);
+ WorkStream::run(graph,
+ std::bind(&LaplaceProblem<dim>::local_assemble,
+ this,
+ std::placeholders::_1,
+ std::placeholders::_2,
+ std::placeholders::_3),
+ std::bind(&LaplaceProblem<dim>::copy_local_to_global,
+ this,
+ std::placeholders::_1),
+ Assembly::Scratch::Data<dim>(fe_collection,
+ quadrature_collection),
+ Assembly::Copy::Data(),
+ 2 * MultithreadInfo::n_threads(),
+ 1);
test_matrix.compress(VectorOperation::add);
test_rhs.compress(VectorOperation::add);
for (unsigned int i = 0; i < estimated_error_per_cell.size(); ++i)
estimated_error_per_cell(i) = i;
- GridRefinement::refine_and_coarsen_fixed_number(
- triangulation, estimated_error_per_cell, 0.3, 0.03);
+ GridRefinement::refine_and_coarsen_fixed_number(triangulation,
+ estimated_error_per_cell,
+ 0.3,
+ 0.03);
triangulation.execute_coarsening_and_refinement();
for (typename hp::DoFHandler<dim>::active_cell_iterator cell =
template <int dim>
struct Data
{
- Data(const FiniteElement<dim> &fe, const Quadrature<dim> &quadrature) :
- fe_values(fe,
- quadrature,
- update_values | update_gradients | update_quadrature_points |
- update_JxW_values)
+ Data(const FiniteElement<dim> &fe, const Quadrature<dim> &quadrature)
+ : fe_values(fe,
+ quadrature,
+ update_values | update_gradients |
+ update_quadrature_points | update_JxW_values)
{}
- Data(const Data &data) :
- fe_values(data.fe_values.get_mapping(),
- data.fe_values.get_fe(),
- data.fe_values.get_quadrature(),
- data.fe_values.get_update_flags())
+ Data(const Data &data)
+ : fe_values(data.fe_values.get_mapping(),
+ data.fe_values.get_fe(),
+ data.fe_values.get_quadrature(),
+ data.fe_values.get_update_flags())
{}
FEValues<dim> fe_values;
{
struct Data
{
- Data(const bool assemble_reference) :
- assemble_reference(assemble_reference)
+ Data(const bool assemble_reference)
+ : assemble_reference(assemble_reference)
{}
std::vector<types::global_dof_index> local_dof_indices;
FullMatrix<double> local_matrix;
class BoundaryValues : public Function<dim>
{
public:
- BoundaryValues() : Function<dim>()
+ BoundaryValues()
+ : Function<dim>()
{}
virtual double
class RightHandSide : public Function<dim>
{
public:
- RightHandSide() : Function<dim>()
+ RightHandSide()
+ : Function<dim>()
{}
virtual double
template <int dim>
-LaplaceProblem<dim>::LaplaceProblem() :
- triangulation(MPI_COMM_WORLD),
- dof_handler(triangulation),
- fe(1),
- quadrature(fe.degree + 1)
+LaplaceProblem<dim>::LaplaceProblem()
+ : triangulation(MPI_COMM_WORLD)
+ , dof_handler(triangulation)
+ , fe(1)
+ , quadrature(fe.degree + 1)
{}
// having added the hanging node constraints in order to be consistent and
// skip dofs that are already constrained (i.e., are hanging nodes on the
// boundary in 3D). In contrast to step-27, we choose a sine function.
- VectorTools::interpolate_boundary_values(
- dof_handler, 0, BoundaryValues<dim>(), constraints);
+ VectorTools::interpolate_boundary_values(dof_handler,
+ 0,
+ BoundaryValues<dim>(),
+ constraints);
constraints.close();
typedef FilteredIterator<typename DoFHandler<dim>::active_cell_iterator>
for (unsigned int i = 0; i < estimated_error_per_cell.size(); ++i)
estimated_error_per_cell(i) = i;
- GridRefinement::refine_and_coarsen_fixed_number(
- triangulation, estimated_error_per_cell, 0.3, 0.03);
+ GridRefinement::refine_and_coarsen_fixed_number(triangulation,
+ estimated_error_per_cell,
+ 0.3,
+ 0.03);
triangulation.execute_coarsening_and_refinement();
}
template <int dim>
struct Data
{
- Data(const FiniteElement<dim> &fe, const Quadrature<dim> &quadrature) :
- fe_values(fe,
- quadrature,
- update_values | update_gradients | update_quadrature_points |
- update_JxW_values)
+ Data(const FiniteElement<dim> &fe, const Quadrature<dim> &quadrature)
+ : fe_values(fe,
+ quadrature,
+ update_values | update_gradients |
+ update_quadrature_points | update_JxW_values)
{}
- Data(const Data &data) :
- fe_values(data.fe_values.get_mapping(),
- data.fe_values.get_fe(),
- data.fe_values.get_quadrature(),
- data.fe_values.get_update_flags())
+ Data(const Data &data)
+ : fe_values(data.fe_values.get_mapping(),
+ data.fe_values.get_fe(),
+ data.fe_values.get_quadrature(),
+ data.fe_values.get_update_flags())
{}
FEValues<dim> fe_values;
{
struct Data
{
- Data(const bool assemble_reference) :
- assemble_reference(assemble_reference)
+ Data(const bool assemble_reference)
+ : assemble_reference(assemble_reference)
{}
std::vector<types::global_dof_index> local_dof_indices;
FullMatrix<double> local_matrix;
class BoundaryValues : public Function<dim>
{
public:
- BoundaryValues() : Function<dim>()
+ BoundaryValues()
+ : Function<dim>()
{}
virtual double
class RightHandSide : public Function<dim>
{
public:
- RightHandSide() : Function<dim>()
+ RightHandSide()
+ : Function<dim>()
{}
virtual double
template <int dim>
-LaplaceProblem<dim>::LaplaceProblem() :
- triangulation(MPI_COMM_WORLD),
- dof_handler(triangulation),
- fe(1),
- quadrature(fe.degree + 1)
+LaplaceProblem<dim>::LaplaceProblem()
+ : triangulation(MPI_COMM_WORLD)
+ , dof_handler(triangulation)
+ , fe(1)
+ , quadrature(fe.degree + 1)
{}
// having added the hanging node constraints in order to be consistent and
// skip dofs that are already constrained (i.e., are hanging nodes on the
// boundary in 3D). In contrast to step-27, we choose a sine function.
- VectorTools::interpolate_boundary_values(
- dof_handler, 0, BoundaryValues<dim>(), constraints);
+ VectorTools::interpolate_boundary_values(dof_handler,
+ 0,
+ BoundaryValues<dim>(),
+ constraints);
constraints.close();
typedef FilteredIterator<typename DoFHandler<dim>::active_cell_iterator>
for (unsigned int i = 0; i < estimated_error_per_cell.size(); ++i)
estimated_error_per_cell(i) = i;
- GridRefinement::refine_and_coarsen_fixed_number(
- triangulation, estimated_error_per_cell, 0.3, 0.03);
+ GridRefinement::refine_and_coarsen_fixed_number(triangulation,
+ estimated_error_per_cell,
+ 0.3,
+ 0.03);
triangulation.execute_coarsening_and_refinement();
}
template <int dim>
struct Data
{
- Data(const FiniteElement<dim> &fe, const Quadrature<dim> &quadrature) :
- fe_values(fe,
- quadrature,
- update_values | update_gradients | update_quadrature_points |
- update_JxW_values)
+ Data(const FiniteElement<dim> &fe, const Quadrature<dim> &quadrature)
+ : fe_values(fe,
+ quadrature,
+ update_values | update_gradients |
+ update_quadrature_points | update_JxW_values)
{}
- Data(const Data &data) :
- fe_values(data.fe_values.get_mapping(),
- data.fe_values.get_fe(),
- data.fe_values.get_quadrature(),
- data.fe_values.get_update_flags())
+ Data(const Data &data)
+ : fe_values(data.fe_values.get_mapping(),
+ data.fe_values.get_fe(),
+ data.fe_values.get_quadrature(),
+ data.fe_values.get_update_flags())
{}
FEValues<dim> fe_values;
{
struct Data
{
- Data(const bool assemble_reference) :
- assemble_reference(assemble_reference)
+ Data(const bool assemble_reference)
+ : assemble_reference(assemble_reference)
{}
std::vector<types::global_dof_index> local_dof_indices;
FullMatrix<double> local_matrix;
class BoundaryValues : public Function<dim>
{
public:
- BoundaryValues() : Function<dim>(2)
+ BoundaryValues()
+ : Function<dim>(2)
{}
virtual double
class RightHandSide : public Function<dim>
{
public:
- RightHandSide() : Function<dim>()
+ RightHandSide()
+ : Function<dim>()
{}
virtual double
template <int dim>
-LaplaceProblem<dim>::LaplaceProblem() :
- triangulation(MPI_COMM_WORLD),
- dof_handler(triangulation),
- fe(FE_Q<dim>(1), 1, FE_Q<dim>(2), 1),
- quadrature(3)
+LaplaceProblem<dim>::LaplaceProblem()
+ : triangulation(MPI_COMM_WORLD)
+ , dof_handler(triangulation)
+ , fe(FE_Q<dim>(1), 1, FE_Q<dim>(2), 1)
+ , quadrature(3)
{}
// having added the hanging node constraints in order to be consistent and
// skip dofs that are already constrained (i.e., are hanging nodes on the
// boundary in 3D). In contrast to step-27, we choose a sine function.
- VectorTools::interpolate_boundary_values(
- dof_handler, 0, BoundaryValues<dim>(), constraints);
+ VectorTools::interpolate_boundary_values(dof_handler,
+ 0,
+ BoundaryValues<dim>(),
+ constraints);
constraints.close();
typedef FilteredIterator<typename DoFHandler<dim>::active_cell_iterator>
for (unsigned int i = 0; i < estimated_error_per_cell.size(); ++i)
estimated_error_per_cell(i) = i;
- GridRefinement::refine_and_coarsen_fixed_number(
- triangulation, estimated_error_per_cell, 0.3, 0.03);
+ GridRefinement::refine_and_coarsen_fixed_number(triangulation,
+ estimated_error_per_cell,
+ 0.3,
+ 0.03);
triangulation.execute_coarsening_and_refinement();
}
template <int dim>
struct Data
{
- Data(const FiniteElement<dim> &fe, const Quadrature<dim> &quadrature) :
- fe_values(fe,
- quadrature,
- update_values | update_gradients | update_quadrature_points |
- update_JxW_values)
+ Data(const FiniteElement<dim> &fe, const Quadrature<dim> &quadrature)
+ : fe_values(fe,
+ quadrature,
+ update_values | update_gradients |
+ update_quadrature_points | update_JxW_values)
{}
- Data(const Data &data) :
- fe_values(data.fe_values.get_mapping(),
- data.fe_values.get_fe(),
- data.fe_values.get_quadrature(),
- data.fe_values.get_update_flags())
+ Data(const Data &data)
+ : fe_values(data.fe_values.get_mapping(),
+ data.fe_values.get_fe(),
+ data.fe_values.get_quadrature(),
+ data.fe_values.get_update_flags())
{}
FEValues<dim> fe_values;
{
struct Data
{
- Data(const bool assemble_reference) :
- assemble_reference(assemble_reference)
+ Data(const bool assemble_reference)
+ : assemble_reference(assemble_reference)
{}
std::vector<types::global_dof_index> local_dof_indices;
FullMatrix<double> local_matrix;
class BoundaryValues : public Function<dim>
{
public:
- BoundaryValues() : Function<dim>()
+ BoundaryValues()
+ : Function<dim>()
{}
virtual double
class RightHandSide : public Function<dim>
{
public:
- RightHandSide() : Function<dim>()
+ RightHandSide()
+ : Function<dim>()
{}
virtual double
template <int dim>
-LaplaceProblem<dim>::LaplaceProblem() :
- triangulation(MPI_COMM_WORLD),
- dof_handler(triangulation),
- fe(1),
- quadrature(fe.degree + 1)
+LaplaceProblem<dim>::LaplaceProblem()
+ : triangulation(MPI_COMM_WORLD)
+ , dof_handler(triangulation)
+ , fe(1)
+ , quadrature(fe.degree + 1)
{}
// having added the hanging node constraints in order to be consistent and
// skip dofs that are already constrained (i.e., are hanging nodes on the
// boundary in 3D). In contrast to step-27, we choose a sine function.
- VectorTools::interpolate_boundary_values(
- dof_handler, 0, BoundaryValues<dim>(), constraints);
+ VectorTools::interpolate_boundary_values(dof_handler,
+ 0,
+ BoundaryValues<dim>(),
+ constraints);
constraints.close();
typedef FilteredIterator<typename DoFHandler<dim>::active_cell_iterator>
{
IndexSet relevant_set;
DoFTools::extract_locally_relevant_dofs(dof_handler, relevant_set);
- DynamicSparsityPattern csp(
- dof_handler.n_dofs(), dof_handler.n_dofs(), relevant_set);
+ DynamicSparsityPattern csp(dof_handler.n_dofs(),
+ dof_handler.n_dofs(),
+ relevant_set);
DoFTools::make_sparsity_pattern(dof_handler, csp, constraints, false);
test_matrix.reinit(locally_owned, csp, MPI_COMM_WORLD, true);
test_rhs.reinit(locally_owned, relevant_set, MPI_COMM_WORLD, true);
for (unsigned int i = 0; i < estimated_error_per_cell.size(); ++i)
estimated_error_per_cell(i) = i;
- GridRefinement::refine_and_coarsen_fixed_number(
- triangulation, estimated_error_per_cell, 0.3, 0.03);
+ GridRefinement::refine_and_coarsen_fixed_number(triangulation,
+ estimated_error_per_cell,
+ 0.3,
+ 0.03);
triangulation.execute_coarsening_and_refinement();
}
template <int dim>
struct Data
{
- Data(const FiniteElement<dim> &fe, const Quadrature<dim> &quadrature) :
- fe_values(fe,
- quadrature,
- update_values | update_gradients | update_quadrature_points |
- update_JxW_values)
+ Data(const FiniteElement<dim> &fe, const Quadrature<dim> &quadrature)
+ : fe_values(fe,
+ quadrature,
+ update_values | update_gradients |
+ update_quadrature_points | update_JxW_values)
{}
- Data(const Data &data) :
- fe_values(data.fe_values.get_mapping(),
- data.fe_values.get_fe(),
- data.fe_values.get_quadrature(),
- data.fe_values.get_update_flags())
+ Data(const Data &data)
+ : fe_values(data.fe_values.get_mapping(),
+ data.fe_values.get_fe(),
+ data.fe_values.get_quadrature(),
+ data.fe_values.get_update_flags())
{}
FEValues<dim> fe_values;
{
struct Data
{
- Data(const bool assemble_reference) :
- assemble_reference(assemble_reference)
+ Data(const bool assemble_reference)
+ : assemble_reference(assemble_reference)
{}
std::vector<types::global_dof_index> local_dof_indices;
FullMatrix<double> local_matrix;
class BoundaryValues : public Function<dim>
{
public:
- BoundaryValues() : Function<dim>(2)
+ BoundaryValues()
+ : Function<dim>(2)
{}
virtual double
class RightHandSide : public Function<dim>
{
public:
- RightHandSide() : Function<dim>()
+ RightHandSide()
+ : Function<dim>()
{}
virtual double
template <int dim>
-LaplaceProblem<dim>::LaplaceProblem() :
- triangulation(MPI_COMM_WORLD),
- dof_handler(triangulation),
- fe(FE_Q<dim>(1), 1, FE_Q<dim>(2), 1),
- quadrature(3)
+LaplaceProblem<dim>::LaplaceProblem()
+ : triangulation(MPI_COMM_WORLD)
+ , dof_handler(triangulation)
+ , fe(FE_Q<dim>(1), 1, FE_Q<dim>(2), 1)
+ , quadrature(3)
{}
// having added the hanging node constraints in order to be consistent and
// skip dofs that are already constrained (i.e., are hanging nodes on the
// boundary in 3D). In contrast to step-27, we choose a sine function.
- VectorTools::interpolate_boundary_values(
- dof_handler, 0, BoundaryValues<dim>(), constraints);
+ VectorTools::interpolate_boundary_values(dof_handler,
+ 0,
+ BoundaryValues<dim>(),
+ constraints);
constraints.close();
typedef FilteredIterator<typename DoFHandler<dim>::active_cell_iterator>
for (unsigned int i = 0; i < estimated_error_per_cell.size(); ++i)
estimated_error_per_cell(i) = i;
- GridRefinement::refine_and_coarsen_fixed_number(
- triangulation, estimated_error_per_cell, 0.3, 0.03);
+ GridRefinement::refine_and_coarsen_fixed_number(triangulation,
+ estimated_error_per_cell,
+ 0.3,
+ 0.03);
triangulation.execute_coarsening_and_refinement();
}
template <int dim>
struct Data
{
- Data(const FiniteElement<dim> &fe, const Quadrature<dim> &quadrature) :
- fe_values(fe,
- quadrature,
- update_values | update_gradients | update_quadrature_points |
- update_JxW_values)
+ Data(const FiniteElement<dim> &fe, const Quadrature<dim> &quadrature)
+ : fe_values(fe,
+ quadrature,
+ update_values | update_gradients |
+ update_quadrature_points | update_JxW_values)
{}
- Data(const Data &data) :
- fe_values(data.fe_values.get_mapping(),
- data.fe_values.get_fe(),
- data.fe_values.get_quadrature(),
- data.fe_values.get_update_flags())
+ Data(const Data &data)
+ : fe_values(data.fe_values.get_mapping(),
+ data.fe_values.get_fe(),
+ data.fe_values.get_quadrature(),
+ data.fe_values.get_update_flags())
{}
FEValues<dim> fe_values;
{
struct Data
{
- Data(const bool assemble_reference) :
- assemble_reference(assemble_reference)
+ Data(const bool assemble_reference)
+ : assemble_reference(assemble_reference)
{}
std::vector<types::global_dof_index> local_dof_indices;
FullMatrix<double> local_matrix;
class BoundaryValues : public Function<dim>
{
public:
- BoundaryValues() : Function<dim>()
+ BoundaryValues()
+ : Function<dim>()
{}
virtual double
class RightHandSide : public Function<dim>
{
public:
- RightHandSide() : Function<dim>()
+ RightHandSide()
+ : Function<dim>()
{}
virtual double
template <int dim>
-LaplaceProblem<dim>::LaplaceProblem() :
- triangulation(MPI_COMM_WORLD),
- dof_handler(triangulation),
- fe(1),
- quadrature(fe.degree + 1)
+LaplaceProblem<dim>::LaplaceProblem()
+ : triangulation(MPI_COMM_WORLD)
+ , dof_handler(triangulation)
+ , fe(1)
+ , quadrature(fe.degree + 1)
{}
// having added the hanging node constraints in order to be consistent and
// skip dofs that are already constrained (i.e., are hanging nodes on the
// boundary in 3D). In contrast to step-27, we choose a sine function.
- VectorTools::interpolate_boundary_values(
- dof_handler, 0, BoundaryValues<dim>(), constraints);
+ VectorTools::interpolate_boundary_values(dof_handler,
+ 0,
+ BoundaryValues<dim>(),
+ constraints);
constraints.close();
typedef FilteredIterator<typename DoFHandler<dim>::active_cell_iterator>
for (unsigned int i = 0; i < estimated_error_per_cell.size(); ++i)
estimated_error_per_cell(i) = i;
- GridRefinement::refine_and_coarsen_fixed_number(
- triangulation, estimated_error_per_cell, 0.3, 0.03);
+ GridRefinement::refine_and_coarsen_fixed_number(triangulation,
+ estimated_error_per_cell,
+ 0.3,
+ 0.03);
triangulation.execute_coarsening_and_refinement();
}
deallog << "Check 6: " << (v1 == v2 ? "true" : "false") << std::endl;
// check std::transform
- std::transform(
- v1.begin(),
- v1.end(),
- v2.begin(),
- std::bind(std::multiplies<double>(), std::placeholders::_1, 2.0));
+ std::transform(v1.begin(),
+ v1.end(),
+ v2.begin(),
+ std::bind(std::multiplies<double>(),
+ std::placeholders::_1,
+ 2.0));
v2 *= 1. / 2.;
deallog << "Check 7: " << (v1 == v2 ? "true" : "false") << std::endl;
TrilinosWrappers::MPI::Vector vb(local_active, MPI_COMM_WORLD);
TrilinosWrappers::MPI::Vector v(local_active, local_relevant, MPI_COMM_WORLD);
- LinearAlgebra::distributed::Vector<double> copied(
- local_active, local_relevant, MPI_COMM_WORLD);
+ LinearAlgebra::distributed::Vector<double> copied(local_active,
+ local_relevant,
+ MPI_COMM_WORLD);
// set local values
vb(myid * 2) = myid * 2.0;
local_relevant.add_range(1, 2);
TrilinosWrappers::MPI::Vector vb_one(local_active, MPI_COMM_WORLD);
- TrilinosWrappers::MPI::Vector v_one(
- local_active, local_relevant, MPI_COMM_WORLD);
+ TrilinosWrappers::MPI::Vector v_one(local_active,
+ local_relevant,
+ MPI_COMM_WORLD);
- LinearAlgebra::distributed::Vector<double> copied_one(
- local_active, local_relevant, MPI_COMM_WORLD);
+ LinearAlgebra::distributed::Vector<double> copied_one(local_active,
+ local_relevant,
+ MPI_COMM_WORLD);
// set local values
vb_one(myid * 2) = myid * 2.0;
deallog << "Solver type: " << typeid(solver).name() << std::endl;
- check_solver_within_range(
- solver.solve(A, u, f, preconditioner), control.last_step(), 42, 44);
+ check_solver_within_range(solver.solve(A, u, f, preconditioner),
+ control.last_step(),
+ 42,
+ 44);
}
}
deallog << "Solver type: " << typeid(solver).name() << std::endl;
- check_solver_within_range(
- solver.solve(A, u, f, preconditioner), control.last_step(), 49, 51);
+ check_solver_within_range(solver.solve(A, u, f, preconditioner),
+ control.last_step(),
+ 49,
+ 51);
}
}
deallog << "Solver type: " << typeid(solver).name() << std::endl;
- check_solver_within_range(
- solver.solve(A, u, f, preconditioner), control.last_step(), 74, 76);
+ check_solver_within_range(solver.solve(A, u, f, preconditioner),
+ control.last_step(),
+ 74,
+ 76);
}
}
deallog << "Solver type: " << typeid(solver).name() << std::endl;
- check_solver_within_range(
- solver.solve(A, u, f, preconditioner), control.last_step(), 0, 42);
+ check_solver_within_range(solver.solve(A, u, f, preconditioner),
+ control.last_step(),
+ 0,
+ 42);
}
}
PreconditionIdentity preconditioner;
deallog << "Solver type: " << typeid(solver).name() << std::endl;
- check_solver_within_range(
- solver.solve(A, u, f, preconditioner), control.last_step(), 45, 47);
+ check_solver_within_range(solver.solve(A, u, f, preconditioner),
+ control.last_step(),
+ 45,
+ 47);
}
}
PreconditionIdentity preconditioner;
deallog << "Solver type: " << typeid(solver).name() << std::endl;
- check_solver_within_range(
- solver.solve(A, u, f, preconditioner), control.last_step(), 5269, 5271);
+ check_solver_within_range(solver.solve(A, u, f, preconditioner),
+ control.last_step(),
+ 5269,
+ 5271);
}
}
class RightHandSide : public Function<dim>
{
public:
- RightHandSide() : Function<dim>()
+ RightHandSide()
+ : Function<dim>()
{}
virtual double
class BoundaryValues : public Function<dim>
{
public:
- BoundaryValues() : Function<dim>()
+ BoundaryValues()
+ : Function<dim>()
{}
virtual double
template <int dim>
-Step4<dim>::Step4() : fe(1), dof_handler(triangulation)
+Step4<dim>::Step4()
+ : fe(1)
+ , dof_handler(triangulation)
{}
constraints.clear();
std::map<unsigned int, double> boundary_values;
- VectorTools::interpolate_boundary_values(
- dof_handler, 0, BoundaryValues<dim>(), constraints);
+ VectorTools::interpolate_boundary_values(dof_handler,
+ 0,
+ BoundaryValues<dim>(),
+ constraints);
constraints.close();
DynamicSparsityPattern c_sparsity(dof_handler.n_dofs());
class RightHandSide : public Function<dim>
{
public:
- RightHandSide() : Function<dim>()
+ RightHandSide()
+ : Function<dim>()
{}
virtual double
class RightHandSideTwo : public Function<dim>
{
public:
- RightHandSideTwo() : Function<dim>()
+ RightHandSideTwo()
+ : Function<dim>()
{}
virtual double
class BoundaryValues : public Function<dim>
{
public:
- BoundaryValues() : Function<dim>()
+ BoundaryValues()
+ : Function<dim>()
{}
virtual double
template <int dim>
-Step4<dim>::Step4() :
- triangulation(MPI_COMM_WORLD,
- typename Triangulation<dim>::MeshSmoothing(
- Triangulation<dim>::smoothing_on_refinement |
- Triangulation<dim>::smoothing_on_coarsening)),
- fe(1),
- dof_handler(triangulation)
+Step4<dim>::Step4()
+ : triangulation(MPI_COMM_WORLD,
+ typename Triangulation<dim>::MeshSmoothing(
+ Triangulation<dim>::smoothing_on_refinement |
+ Triangulation<dim>::smoothing_on_coarsening))
+ , fe(1)
+ , dof_handler(triangulation)
{}
constraints.clear();
std::map<unsigned int, double> boundary_values;
- VectorTools::interpolate_boundary_values(
- dof_handler, 0, BoundaryValues<dim>(), constraints);
+ VectorTools::interpolate_boundary_values(dof_handler,
+ 0,
+ BoundaryValues<dim>(),
+ constraints);
constraints.close();
IndexSet locally_owned_dofs = dof_handler.locally_owned_dofs();
MPI_COMM_WORLD,
locally_relevant_dofs);
- system_matrix.reinit(
- locally_owned_dofs, locally_owned_dofs, dsp, MPI_COMM_WORLD);
+ system_matrix.reinit(locally_owned_dofs,
+ locally_owned_dofs,
+ dsp,
+ MPI_COMM_WORLD);
solution.reinit(locally_relevant_dofs, MPI_COMM_WORLD);
- system_rhs.reinit(
- locally_owned_dofs, locally_relevant_dofs, MPI_COMM_WORLD, true);
+ system_rhs.reinit(locally_owned_dofs,
+ locally_relevant_dofs,
+ MPI_COMM_WORLD,
+ true);
- system_rhs_two.reinit(
- locally_owned_dofs, locally_relevant_dofs, MPI_COMM_WORLD, true);
+ system_rhs_two.reinit(locally_owned_dofs,
+ locally_relevant_dofs,
+ MPI_COMM_WORLD,
+ true);
}
system_matrix,
system_rhs);
- constraints.distribute_local_to_global(
- cell_rhs_two, local_dof_indices, system_rhs_two);
+ constraints.distribute_local_to_global(cell_rhs_two,
+ local_dof_indices,
+ system_rhs_two);
}
}
system_matrix.compress(VectorOperation::add);
class RightHandSide : public Function<dim>
{
public:
- RightHandSide() : Function<dim>()
+ RightHandSide()
+ : Function<dim>()
{}
virtual double
class BoundaryValues : public Function<dim>
{
public:
- BoundaryValues() : Function<dim>()
+ BoundaryValues()
+ : Function<dim>()
{}
virtual double
template <int dim>
-Step4<dim>::Step4() :
- triangulation(MPI_COMM_WORLD,
- typename Triangulation<dim>::MeshSmoothing(
- Triangulation<dim>::smoothing_on_refinement |
- Triangulation<dim>::smoothing_on_coarsening)),
- fe(1),
- dof_handler(triangulation)
+Step4<dim>::Step4()
+ : triangulation(MPI_COMM_WORLD,
+ typename Triangulation<dim>::MeshSmoothing(
+ Triangulation<dim>::smoothing_on_refinement |
+ Triangulation<dim>::smoothing_on_coarsening))
+ , fe(1)
+ , dof_handler(triangulation)
{}
constraints.clear();
std::map<unsigned int, double> boundary_values;
- VectorTools::interpolate_boundary_values(
- dof_handler, 0, BoundaryValues<dim>(), constraints);
+ VectorTools::interpolate_boundary_values(dof_handler,
+ 0,
+ BoundaryValues<dim>(),
+ constraints);
constraints.close();
IndexSet locally_owned_dofs = dof_handler.locally_owned_dofs();
MPI_COMM_WORLD,
locally_relevant_dofs);
- system_matrix.reinit(
- locally_owned_dofs, locally_owned_dofs, dsp, MPI_COMM_WORLD);
+ system_matrix.reinit(locally_owned_dofs,
+ locally_owned_dofs,
+ dsp,
+ MPI_COMM_WORLD);
solution.reinit(locally_owned_dofs, locally_relevant_dofs, MPI_COMM_WORLD);
system_rhs.reinit(locally_owned_dofs, locally_relevant_dofs, MPI_COMM_WORLD);
- system_rhs_two.reinit(
- locally_owned_dofs, locally_relevant_dofs, MPI_COMM_WORLD);
+ system_rhs_two.reinit(locally_owned_dofs,
+ locally_relevant_dofs,
+ MPI_COMM_WORLD);
}
}
cell->get_dof_indices(local_dof_indices);
- constraints.distribute_local_to_global(
- cell_matrix, local_dof_indices, system_matrix);
-
- constraints.distribute_local_to_global(
- cell_rhs, local_dof_indices, system_rhs, cell_matrix);
- constraints.distribute_local_to_global(
- cell_rhs_two, local_dof_indices, system_rhs_two, cell_matrix);
+ constraints.distribute_local_to_global(cell_matrix,
+ local_dof_indices,
+ system_matrix);
+
+ constraints.distribute_local_to_global(cell_rhs,
+ local_dof_indices,
+ system_rhs,
+ cell_matrix);
+ constraints.distribute_local_to_global(cell_rhs_two,
+ local_dof_indices,
+ system_rhs_two,
+ cell_matrix);
}
}
system_matrix.compress(VectorOperation::add);
QGauss<dim>(3),
VectorTools::L2_norm);
deallog << " L2 error: "
- << VectorTools::compute_global_error(
- triangulation, cellwise_error, VectorTools::L2_norm)
+ << VectorTools::compute_global_error(triangulation,
+ cellwise_error,
+ VectorTools::L2_norm)
<< std::endl;
// do solve 2 without refactorizing
template <int dim>
- AdvectionProblem<dim>::AdvectionProblem() :
- n_mpi_processes(Utilities::MPI::n_mpi_processes(MPI_COMM_WORLD)),
- this_mpi_process(Utilities::MPI::this_mpi_process(MPI_COMM_WORLD)),
- triangulation(MPI_COMM_WORLD),
- fe(1),
- dof_handler(triangulation)
+ AdvectionProblem<dim>::AdvectionProblem()
+ : n_mpi_processes(Utilities::MPI::n_mpi_processes(MPI_COMM_WORLD))
+ , this_mpi_process(Utilities::MPI::this_mpi_process(MPI_COMM_WORLD))
+ , triangulation(MPI_COMM_WORLD)
+ , fe(1)
+ , dof_handler(triangulation)
{
std::vector<unsigned int> repetitions(2);
repetitions[0] = 2;
const Point<2> p0(0.0, 0.0);
const Point<2> p1(2.0, 1.0);
- GridGenerator::subdivided_hyper_rectangle(
- triangulation, repetitions, p0, p1);
+ GridGenerator::subdivided_hyper_rectangle(triangulation,
+ repetitions,
+ p0,
+ p1);
}
template <int dim>
// create an empty sparsity pattern
TrilinosWrappers::SparsityPattern sparsity;
sparsity.reinit(dof_handler.n_dofs(), dof_handler.n_dofs());
- DoFTools::make_sparsity_pattern(
- dof_handler,
- coupling,
- sparsity,
- ConstraintMatrix(),
- false,
- Utilities::MPI::this_mpi_process(MPI_COMM_WORLD));
+ DoFTools::make_sparsity_pattern(dof_handler,
+ coupling,
+ sparsity,
+ ConstraintMatrix(),
+ false,
+ Utilities::MPI::this_mpi_process(
+ MPI_COMM_WORLD));
sparsity.compress();
// attach a sparse matrix to it
system_partitioning,
system_relevant_set,
MPI_COMM_WORLD);
- DoFTools::make_sparsity_pattern(
- dof_handler,
- coupling,
- sparsity,
- ConstraintMatrix(),
- false,
- Utilities::MPI::this_mpi_process(MPI_COMM_WORLD));
+ DoFTools::make_sparsity_pattern(dof_handler,
+ coupling,
+ sparsity,
+ ConstraintMatrix(),
+ false,
+ Utilities::MPI::this_mpi_process(
+ MPI_COMM_WORLD));
sparsity.compress();
// attach a sparse matrix to it
for (unsigned int b = 0; b < n_blocks; ++b)
{
locally_owned_partitioning[b].set_size(n_dofs_per_block);
- locally_owned_partitioning[b].add_range(
- this_mpi_process * (n_dofs_per_block / 2),
- (this_mpi_process + 1) * (n_dofs_per_block / 2));
+ locally_owned_partitioning[b].add_range(this_mpi_process *
+ (n_dofs_per_block / 2),
+ (this_mpi_process + 1) *
+ (n_dofs_per_block / 2));
}
BlockVector parallel_vector;
class RightHandSide : public Function<dim>
{
public:
- RightHandSide() : Function<dim>()
+ RightHandSide()
+ : Function<dim>()
{}
virtual double
class BoundaryValues : public Function<dim>
{
public:
- BoundaryValues() : Function<dim>()
+ BoundaryValues()
+ : Function<dim>()
{}
virtual double
template <int dim>
-Step4<dim>::Step4() : fe(1), dof_handler(triangulation)
+Step4<dim>::Step4()
+ : fe(1)
+ , dof_handler(triangulation)
{}
constraints.clear();
std::map<unsigned int, double> boundary_values;
- VectorTools::interpolate_boundary_values(
- dof_handler, 0, BoundaryValues<dim>(), constraints);
+ VectorTools::interpolate_boundary_values(dof_handler,
+ 0,
+ BoundaryValues<dim>(),
+ constraints);
constraints.close();
DynamicSparsityPattern c_sparsity(dof_handler.n_dofs());
template <int dim>
-Step4<dim>::Step4() : fe(1), dof_handler(triangulation)
+Step4<dim>::Step4()
+ : fe(1)
+ , dof_handler(triangulation)
{}
deallog.push(Utilities::int_to_string(dof_handler.n_dofs(), 5));
TrilinosWrappers::PreconditionAMG preconditioner;
TrilinosWrappers::PreconditionAMG::AdditionalData data;
- DoFTools::extract_constant_modes(
- dof_handler, std::vector<bool>(1, true), data.constant_modes);
+ DoFTools::extract_constant_modes(dof_handler,
+ std::vector<bool>(1, true),
+ data.constant_modes);
data.smoother_sweeps = 2;
{
solution = 0;
class RightHandSide : public Function<dim>
{
public:
- RightHandSide() : Function<dim>()
+ RightHandSide()
+ : Function<dim>()
{}
virtual double
class BoundaryValues : public Function<dim>
{
public:
- BoundaryValues() : Function<dim>()
+ BoundaryValues()
+ : Function<dim>()
{}
virtual double
template <int dim>
-Step4<dim>::Step4() : fe(1), dof_handler(triangulation)
+Step4<dim>::Step4()
+ : fe(1)
+ , dof_handler(triangulation)
{}
constraints.clear();
std::map<unsigned int, double> boundary_values;
- VectorTools::interpolate_boundary_values(
- dof_handler, 0, BoundaryValues<dim>(), constraints);
+ VectorTools::interpolate_boundary_values(dof_handler,
+ 0,
+ BoundaryValues<dim>(),
+ constraints);
constraints.close();
DynamicSparsityPattern c_sparsity(dof_handler.n_dofs());
template <int dim>
-Step4<dim>::Step4() : fe(1), dof_handler(triangulation)
+Step4<dim>::Step4()
+ : fe(1)
+ , dof_handler(triangulation)
{}
deallog.push(Utilities::int_to_string(dof_handler.n_dofs(), 5));
TrilinosWrappers::PreconditionAMGMueLu preconditioner;
TrilinosWrappers::PreconditionAMGMueLu::AdditionalData data;
- DoFTools::extract_constant_modes(
- dof_handler, std::vector<bool>(1, true), data.constant_modes);
+ DoFTools::extract_constant_modes(dof_handler,
+ std::vector<bool>(1, true),
+ data.constant_modes);
data.smoother_sweeps = 2;
{
solution = 0;
class RightHandSide : public Function<dim>
{
public:
- RightHandSide() : Function<dim>()
+ RightHandSide()
+ : Function<dim>()
{}
virtual double
class BoundaryValues : public Function<dim>
{
public:
- BoundaryValues() : Function<dim>()
+ BoundaryValues()
+ : Function<dim>()
{}
virtual double
template <int dim>
-Step4<dim>::Step4() :
- fe(3),
- dof_handler(triangulation),
- fe_precondition(3),
- dof_handler_precondition(triangulation)
+Step4<dim>::Step4()
+ : fe(3)
+ , dof_handler(triangulation)
+ , fe_precondition(3)
+ , dof_handler_precondition(triangulation)
{}
constraints.clear();
std::map<unsigned int, double> boundary_values;
- VectorTools::interpolate_boundary_values(
- dof_handler, 0, BoundaryValues<dim>(), constraints);
+ VectorTools::interpolate_boundary_values(dof_handler,
+ 0,
+ BoundaryValues<dim>(),
+ constraints);
constraints.close();
DynamicSparsityPattern c_sparsity(dof_handler.n_dofs());
}
cell->get_dof_indices(local_dof_indices);
- constraints.distribute_local_to_global(
- cell_matrix, local_dof_indices, preconditioner_matrix);
+ constraints.distribute_local_to_global(cell_matrix,
+ local_dof_indices,
+ preconditioner_matrix);
}
preconditioner_matrix.compress(VectorOperation::add);
}
class RightHandSide : public Function<dim>
{
public:
- RightHandSide() : Function<dim>()
+ RightHandSide()
+ : Function<dim>()
{}
virtual double
class BoundaryValues : public Function<dim>
{
public:
- BoundaryValues() : Function<dim>()
+ BoundaryValues()
+ : Function<dim>()
{}
virtual double
template <int dim>
-Step4<dim>::Step4() : fe(1), dof_handler(triangulation)
+Step4<dim>::Step4()
+ : fe(1)
+ , dof_handler(triangulation)
{}
constraints.clear();
std::map<unsigned int, double> boundary_values;
- VectorTools::interpolate_boundary_values(
- dof_handler, 0, BoundaryValues<dim>(), constraints);
+ VectorTools::interpolate_boundary_values(dof_handler,
+ 0,
+ BoundaryValues<dim>(),
+ constraints);
constraints.close();
DynamicSparsityPattern c_sparsity(dof_handler.n_dofs());
class RightHandSide : public Function<dim>
{
public:
- RightHandSide() : Function<dim>()
+ RightHandSide()
+ : Function<dim>()
{}
virtual double
class BoundaryValues : public Function<dim>
{
public:
- BoundaryValues() : Function<dim>()
+ BoundaryValues()
+ : Function<dim>()
{}
virtual double
template <int dim>
-Step4<dim>::Step4() :
- fe(3),
- dof_handler(triangulation),
- fe_precondition(3),
- dof_handler_precondition(triangulation)
+Step4<dim>::Step4()
+ : fe(3)
+ , dof_handler(triangulation)
+ , fe_precondition(3)
+ , dof_handler_precondition(triangulation)
{}
constraints.clear();
std::map<unsigned int, double> boundary_values;
- VectorTools::interpolate_boundary_values(
- dof_handler, 0, BoundaryValues<dim>(), constraints);
+ VectorTools::interpolate_boundary_values(dof_handler,
+ 0,
+ BoundaryValues<dim>(),
+ constraints);
constraints.close();
DynamicSparsityPattern c_sparsity(dof_handler.n_dofs());
}
cell->get_dof_indices(local_dof_indices);
- constraints.distribute_local_to_global(
- cell_matrix, local_dof_indices, preconditioner_matrix);
+ constraints.distribute_local_to_global(cell_matrix,
+ local_dof_indices,
+ preconditioner_matrix);
}
preconditioner_matrix.compress(VectorOperation::add);
}
TrilinosWrappers::SparseMatrix system_matrix;
public:
- Test(const bool do_renumber) :
- mpi_communicator(MPI_COMM_WORLD),
- rank(Utilities::MPI::this_mpi_process(mpi_communicator)),
- n_ranks(Utilities::MPI::n_mpi_processes(mpi_communicator)),
- triangulation(mpi_communicator),
- dof_handler(triangulation),
- fe(1)
+ Test(const bool do_renumber)
+ : mpi_communicator(MPI_COMM_WORLD)
+ , rank(Utilities::MPI::this_mpi_process(mpi_communicator))
+ , n_ranks(Utilities::MPI::n_mpi_processes(mpi_communicator))
+ , triangulation(mpi_communicator)
+ , dof_handler(triangulation)
+ , fe(1)
{
deallog << "Start";
MPI_COMM_WORLD,
locally_relevant_dofs);
- system_matrix.reinit(
- locally_owned_dofs, locally_owned_dofs, sparsity_pattern, MPI_COMM_WORLD);
+ system_matrix.reinit(locally_owned_dofs,
+ locally_owned_dofs,
+ sparsity_pattern,
+ MPI_COMM_WORLD);
deallog << "local_range: " << system_matrix.local_range().first << " - "
<< system_matrix.local_range().second << std::endl;
}
deallog << "Solver type: " << typeid(solver).name() << std::endl;
- check_solver_within_range(
- solver.solve(A, u, f, preconditioner), control.last_step(), 42, 44);
+ check_solver_within_range(solver.solve(A, u, f, preconditioner),
+ control.last_step(),
+ 42,
+ 44);
}
}
deallog << "Solver type: " << typeid(solver).name() << std::endl;
- check_solver_within_range(
- solver.solve(A, u, f, preconditioner), control.last_step(), 70, 72);
+ check_solver_within_range(solver.solve(A, u, f, preconditioner),
+ control.last_step(),
+ 70,
+ 72);
}
}
deallog << "Solver type: " << typeid(solver).name() << std::endl;
- check_solver_within_range(
- solver.solve(A, u, f, preconditioner), control.last_step(), 40, 42);
+ check_solver_within_range(solver.solve(A, u, f, preconditioner),
+ control.last_step(),
+ 40,
+ 42);
}
}
// Expects success
SolverControl control(2000, 1.e-3);
TrilinosWrappers::SolverCG solver(control);
- check_solver_within_range(
- solver.solve(A, u, f, preconditioner), control.last_step(), 42, 44);
+ check_solver_within_range(solver.solve(A, u, f, preconditioner),
+ control.last_step(),
+ 42,
+ 44);
}
deallog.pop();
// Expects failure
SolverControl control(20, 1.e-3);
TrilinosWrappers::SolverCG solver(control);
- check_solver_within_range(
- solver.solve(A, u, f, preconditioner), control.last_step(), 0, 19);
+ check_solver_within_range(solver.solve(A, u, f, preconditioner),
+ control.last_step(),
+ 0,
+ 19);
}
deallog.pop();
}
// Expects success
ReductionControl control(2000, 1.e-30, 1e-6);
TrilinosWrappers::SolverCG solver(control);
- check_solver_within_range(
- solver.solve(A, u, f, preconditioner), control.last_step(), 49, 51);
+ check_solver_within_range(solver.solve(A, u, f, preconditioner),
+ control.last_step(),
+ 49,
+ 51);
}
deallog.pop();
// Expects success
ReductionControl control(2000, 1.e-3, 1e-9);
TrilinosWrappers::SolverCG solver(control);
- check_solver_within_range(
- solver.solve(A, u, f, preconditioner), control.last_step(), 42, 44);
+ check_solver_within_range(solver.solve(A, u, f, preconditioner),
+ control.last_step(),
+ 42,
+ 44);
}
deallog.pop();
// Expects failure
ReductionControl control(20, 1.e-30, 1e-6);
TrilinosWrappers::SolverCG solver(control);
- check_solver_within_range(
- solver.solve(A, u, f, preconditioner), control.last_step(), 0, 19);
+ check_solver_within_range(solver.solve(A, u, f, preconditioner),
+ control.last_step(),
+ 0,
+ 19);
}
deallog.pop();
}
// Expects success
IterationNumberControl control(2000, 1.e-3);
TrilinosWrappers::SolverCG solver(control);
- check_solver_within_range(
- solver.solve(A, u, f, preconditioner), control.last_step(), 42, 44);
+ check_solver_within_range(solver.solve(A, u, f, preconditioner),
+ control.last_step(),
+ 42,
+ 44);
}
deallog.pop();
// Expects success
IterationNumberControl control(20, 1.e-3);
TrilinosWrappers::SolverCG solver(control);
- check_solver_within_range(
- solver.solve(A, u, f, preconditioner), control.last_step(), 19, 21);
+ check_solver_within_range(solver.solve(A, u, f, preconditioner),
+ control.last_step(),
+ 19,
+ 21);
}
deallog.pop();
}
TimerOutput timer;
};
-Test_Solver_Output::Test_Solver_Output() :
- mpi_comm(MPI_COMM_WORLD),
- n_mpi_proc(Utilities::MPI::n_mpi_processes(mpi_comm)),
- this_mpi_proc(Utilities::MPI::this_mpi_process(mpi_comm)),
- triangulation(mpi_comm,
- typename Triangulation<2>::MeshSmoothing(
- Triangulation<2>::smoothing_on_refinement |
- Triangulation<2>::smoothing_on_coarsening)),
- dof_handler(triangulation),
- fe(1),
- pcout(std::cout, (Utilities::MPI::this_mpi_process(mpi_comm) == 0)),
+Test_Solver_Output::Test_Solver_Output()
+ : mpi_comm(MPI_COMM_WORLD)
+ , n_mpi_proc(Utilities::MPI::n_mpi_processes(mpi_comm))
+ , this_mpi_proc(Utilities::MPI::this_mpi_process(mpi_comm))
+ , triangulation(mpi_comm,
+ typename Triangulation<2>::MeshSmoothing(
+ Triangulation<2>::smoothing_on_refinement |
+ Triangulation<2>::smoothing_on_coarsening))
+ , dof_handler(triangulation)
+ , fe(1)
+ , pcout(std::cout, (Utilities::MPI::this_mpi_process(mpi_comm) == 0))
+ ,
// pcout(deallog.get_file_stream(),
// (Utilities::MPI::this_mpi_process(mpi_comm) == 0)),
timer(mpi_comm, pcout, TimerOutput::never, TimerOutput::wall_times)
locally_owned_dofs = dof_handler.locally_owned_dofs();
DoFTools::extract_locally_relevant_dofs(dof_handler, locally_relevant_dofs);
- locally_relevant_solution.reinit(
- locally_owned_dofs, locally_relevant_dofs, mpi_comm);
+ locally_relevant_solution.reinit(locally_owned_dofs,
+ locally_relevant_dofs,
+ mpi_comm);
system_rhs.reinit(locally_owned_dofs, mpi_comm);
constraints.clear();
constraints.reinit(locally_relevant_dofs);
DoFTools::make_hanging_node_constraints(dof_handler, constraints);
- VectorTools::interpolate_boundary_values(
- dof_handler, 0, Functions::ZeroFunction<2>(), constraints);
+ VectorTools::interpolate_boundary_values(dof_handler,
+ 0,
+ Functions::ZeroFunction<2>(),
+ constraints);
constraints.close();
DynamicSparsityPattern dsp(locally_relevant_dofs);
SolverControl solver_control(100, 1e-12);
TrilinosWrappers::SolverBase::AdditionalData solver_data(true);
- TrilinosWrappers::SolverBase solver(
- TrilinosWrappers::SolverBase::cg, solver_control, solver_data);
- solver.solve(
- system_matrix, completely_distributed_solution, system_rhs, prec);
+ TrilinosWrappers::SolverBase solver(TrilinosWrappers::SolverBase::cg,
+ solver_control,
+ solver_data);
+ solver.solve(system_matrix,
+ completely_distributed_solution,
+ system_rhs,
+ prec);
pcout << " Solved in " << solver_control.last_step() << " iterations."
<< std::endl;
SolverControl solver_control(100, 1e-12);
LA::SolverCG::AdditionalData solver_data(true);
LA::SolverCG solver(solver_control, solver_data);
- solver.solve(
- system_matrix, completely_distributed_solution, system_rhs, prec);
+ solver.solve(system_matrix,
+ completely_distributed_solution,
+ system_rhs,
+ prec);
pcout << " Solved in " << solver_control.last_step() << " iterations."
<< std::endl;
SolverControl solver_control(100, 1e-12);
TrilinosWrappers::SolverCGS::AdditionalData solver_data(true);
TrilinosWrappers::SolverCGS solver(solver_control, solver_data);
- solver.solve(
- system_matrix, completely_distributed_solution, system_rhs, prec);
+ solver.solve(system_matrix,
+ completely_distributed_solution,
+ system_rhs,
+ prec);
pcout << " Solved in " << solver_control.last_step() << " iterations."
<< std::endl;
SolverControl solver_control(100, 1e-12);
LA::SolverGMRES::AdditionalData solver_data(true, 25);
LA::SolverGMRES solver(solver_control, solver_data);
- solver.solve(
- system_matrix, completely_distributed_solution, system_rhs, prec);
+ solver.solve(system_matrix,
+ completely_distributed_solution,
+ system_rhs,
+ prec);
pcout << " Solved in " << solver_control.last_step() << " iterations."
<< std::endl;
SolverControl solver_control(100, 1e-12);
TrilinosWrappers::SolverBicgstab::AdditionalData solver_data(true);
TrilinosWrappers::SolverBicgstab solver(solver_control, solver_data);
- solver.solve(
- system_matrix, completely_distributed_solution, system_rhs, prec);
+ solver.solve(system_matrix,
+ completely_distributed_solution,
+ system_rhs,
+ prec);
pcout << " Solved in " << solver_control.last_step() << " iterations."
<< std::endl;
SolverControl solver_control(100, 1e-12);
TrilinosWrappers::SolverTFQMR::AdditionalData solver_data(true);
TrilinosWrappers::SolverTFQMR solver(solver_control, solver_data);
- solver.solve(
- system_matrix, completely_distributed_solution, system_rhs, prec);
+ solver.solve(system_matrix,
+ completely_distributed_solution,
+ system_rhs,
+ prec);
pcout << " Solved in " << solver_control.last_step() << " iterations."
<< std::endl;
deallog << "OK" << std::endl;
}
{
- TrilinosWrappers::MPI::BlockVector v(
- std::vector<IndexSet>(1, local_range), MPI_COMM_WORLD);
+ TrilinosWrappers::MPI::BlockVector v(std::vector<IndexSet>(1,
+ local_range),
+ MPI_COMM_WORLD);
test(v);
}
}
DoFRenumbering::component_wise(dof_handler, block_component);
std::vector<types::global_dof_index> dofs_per_block(2);
- DoFTools::count_dofs_per_block(
- dof_handler, dofs_per_block, block_component);
+ DoFTools::count_dofs_per_block(dof_handler,
+ dofs_per_block,
+ block_component);
const unsigned int n_u = dofs_per_block[0], n_p = dofs_per_block[1];
{
owned_partitioning,
relevant_partitioning,
mpi_communicator);
- DoFTools::make_sparsity_pattern(
- dof_handler,
- bsp,
- new_constraints,
- false,
- Utilities::MPI::this_mpi_process(mpi_communicator));
+ DoFTools::make_sparsity_pattern(dof_handler,
+ bsp,
+ new_constraints,
+ false,
+ Utilities::MPI::this_mpi_process(
+ mpi_communicator));
bsp.compress();
}
relevant_partitioning,
MPI_COMM_WORLD);
- DoFTools::make_sparsity_pattern(
- dh,
- sp,
- constraints,
- true,
- Utilities::MPI::this_mpi_process(MPI_COMM_WORLD));
+ DoFTools::make_sparsity_pattern(dh,
+ sp,
+ constraints,
+ true,
+ Utilities::MPI::this_mpi_process(
+ MPI_COMM_WORLD));
sp.compress();
// output
// check that the entries are ok
for (unsigned int i = 0; i < v.size(); ++i)
- AssertThrow(
- ((pattern[i] == true) &&
- (v(i) - (-1. * i * std::complex<double>(i + 1., i + 2.) * 3. / 4.) ==
- std::complex<double>(0))) ||
- ((pattern[i] == false) && (v(i) == std::complex<double>(0))),
- ExcInternalError());
+ AssertThrow(((pattern[i] == true) &&
+ (v(i) - (-1. * i * std::complex<double>(i + 1., i + 2.) * 3. /
+ 4.) ==
+ std::complex<double>(0))) ||
+ ((pattern[i] == false) && (v(i) == std::complex<double>(0))),
+ ExcInternalError());
deallog << "OK" << std::endl;
}
class MySquareFunction : public Function<dim>
{
public:
- MySquareFunction() : Function<dim>(2)
+ MySquareFunction()
+ : Function<dim>(2)
{}
virtual double
class MySquareFunction : public Function<dim, std::complex<double>>
{
public:
- MySquareFunction() : Function<dim, std::complex<double>>(2)
+ MySquareFunction()
+ : Function<dim, std::complex<double>>(2)
{}
virtual std::complex<double>
value(const Point<dim> &p, const unsigned int component) const
{
- return std::complex<double>(
- 100 * (component + 1) * p.square() * std::sin(p.square()), 0);
+ return std::complex<double>(100 * (component + 1) * p.square() *
+ std::sin(p.square()),
+ 0);
}
virtual void
class MySquareFunction : public Function<dim, std::complex<double>>
{
public:
- MySquareFunction() : Function<dim, std::complex<double>>(2)
+ MySquareFunction()
+ : Function<dim, std::complex<double>>(2)
{}
virtual std::complex<double>
value(const Point<dim> &p, const unsigned int component) const
{
- return std::complex<double>(
- 100 * (component + 1) * p.square() * std::sin(p.square()), 0);
+ return std::complex<double>(100 * (component + 1) * p.square() *
+ std::sin(p.square()),
+ 0);
}
virtual void
class Ref : public Function<dim>
{
public:
- Ref() : Function<dim>(dim)
+ Ref()
+ : Function<dim>(dim)
{}
double
class Ref : public Function<dim, std::complex<double>>
{
public:
- Ref() : Function<dim, std::complex<double>>(dim)
+ Ref()
+ : Function<dim, std::complex<double>>(dim)
{}
std::complex<double>
class Ref : public Function<dim, std::complex<double>>
{
public:
- Ref() : Function<dim, std::complex<double>>(dim)
+ Ref()
+ : Function<dim, std::complex<double>>(dim)
{}
std::complex<double>
class Ref : public Function<dim, std::complex<double>>
{
public:
- Ref() : Function<dim, std::complex<double>>(dim)
+ Ref()
+ : Function<dim, std::complex<double>>(dim)
{}
std::complex<double>
class Ref : public Function<dim>
{
public:
- Ref() : Function<dim>(dim)
+ Ref()
+ : Function<dim>(dim)
{}
double
class Ref : public Function<dim>
{
public:
- Ref() : Function<dim>(dim)
+ Ref()
+ : Function<dim>(dim)
{}
double
class Ref : public Function<dim>
{
public:
- Ref() : Function<dim>(dim)
+ Ref()
+ : Function<dim>(dim)
{}
double
class Ref : public Function<dim>
{
public:
- Ref() : Function<dim>(dim)
+ Ref()
+ : Function<dim>(dim)
{}
double
class Ref : public Function<dim>
{
public:
- Ref() : Function<dim>(dim)
+ Ref()
+ : Function<dim>(dim)
{}
double
class Ref : public Function<dim>
{
public:
- Ref() : Function<dim>(2 * dim)
+ Ref()
+ : Function<dim>(2 * dim)
{}
void
// subdivides into 5 subdomains
deallog << "Partitioning" << std::endl;
- GridTools::partition_triangulation(
- 5, triangulation, SparsityTools::Partitioner::zoltan);
+ GridTools::partition_triangulation(5,
+ triangulation,
+ SparsityTools::Partitioner::zoltan);
for (typename Triangulation<dim>::active_cell_iterator cell =
triangulation.begin_active();
cell != triangulation.end();