class FunctionBase
{
public:
- ~FunctionBase()
+ virtual ~FunctionBase()
{}
virtual void
do_test() = 0;
};
-class Function
+class Function : public FunctionBase
{
public:
Function() : size_(2)
deallog << "Copy construct object" << std::endl;
}
- ~Function()
+ virtual ~Function() override
{
deallog << "Destruct with size " << vec.size() << std::endl;
}
virtual void
- do_test()
+ do_test() override
{
vec.resize(size_++);
deallog << "Resize vector to " << vec.size() << std::endl;
class FunctionBase
{
public:
- ~FunctionBase()
+ virtual ~FunctionBase()
{}
virtual void
do_test() = 0;
};
-class Function
+class Function : public FunctionBase
{
public:
Function() : size_(2)
deallog << "Copy construct object" << std::endl;
}
- ~Function()
+ virtual ~Function() override
{
deallog << "Destruct with size " << vec.size() << std::endl;
}
virtual void
- do_test()
+ do_test() override
{
vec.resize(size_++);
deallog << "Resize vector to " << vec.size() << std::endl;
dof_handler2.distribute_dofs(fe);
try
{
- (dof_handler.begin_active() != dof_handler2.begin_active());
+ bool is_same =
+ (dof_handler.begin_active() != dof_handler2.begin_active());
+ (void)is_same;
}
catch (ExceptionBase &e)
{
virtual Point<dim>
get_new_point_on_line(
- const typename Triangulation<dim>::line_iterator &line) const
+ const typename Triangulation<dim>::line_iterator &line) const override
{
deallog << "Finding point between " << line->vertex(0) << " and "
<< line->vertex(1) << std::endl;
virtual Point<dim>
get_new_point_on_quad(
- const typename Triangulation<dim>::quad_iterator &) const
+ const typename Triangulation<dim>::quad_iterator &) const override
{
Assert(false, ExcInternalError());
return Point<dim>(0, 0, 1.25);
double
newton_binomial(unsigned int a, unsigned int b)
{
- double c;
+ double c = 0.;
if (a >= b)
- c = factorial(a) / factorial(b) / factorial(a - b);
- else
- deallog
- << "Error: in Newton binomial the first integer must be greater or equal to the second.";
+ return factorial(a) / factorial(b) / factorial(a - b);
- return c;
+ // we should not get here
+ deallog << "Error: in Newton binomial the first integer "
+ "must be greater or equal to the second.";
+
+ return 0.;
}
int
// ---------------------------------------------------------------------
/*
-/* Author: Wolfgang Bangerth, University of Heidelberg, 2000
-/*
+ * Author: Wolfgang Bangerth, University of Heidelberg, 2000
+ *
* Purpose: check some things with the intergrid map
*/
auto op_b11 = linear_operator(a.block(1, 1));
std::array<std::array<decltype(op_b00), 2>, 2> temp{
- {op_b00, op_b01, op_b10, op_b11}};
+ {{op_b00, op_b01}, {op_b10, op_b11}}};
auto op_b = block_operator<2, 2, BlockVector<double>>(temp);
{
// And finally complicated block structures:
std::array<std::array<decltype(op_b00), 3>, 3> temp2{
- {op_b00, op_b01, op_b00, op_b10, op_b11, op_b10, op_b10, op_b11, op_b10}};
+ {{op_b00, op_b01, op_b00},
+ {op_b10, op_b11, op_b10},
+ {op_b10, op_b11, op_b10}}};
auto op_upp_x_upu = block_operator<3, 3, BlockVector<double>>(temp2);
op_upp_x_upu.reinit_domain_vector(u, false);
PRINTME("v", v);
std::array<std::array<decltype(op_b01), 1>, 3> temp3{
- {op_b01, op_b11, op_b11}};
+ {{op_b01}, {op_b11}, {op_b11}}};
auto op_upp_x_p = block_operator<3, 1, BlockVector<double>>(temp3);
std::array<std::array<decltype(op_b01), 3>, 1> temp4{
- {op_b00, op_b01, op_b00}};
+ {{op_b00, op_b01, op_b00}}};
auto op_u_x_upu = block_operator<1, 3, BlockVector<double>>(temp4);
auto op_long = op_u_x_upu * transpose_operator(op_upp_x_upu) * op_upp_x_p;
deallog << std::setprecision(4);
deallog.attach(logfile);
- char *name = "Matrix A";
+ char name[] = "Matrix A";
checkConstructor3<double>(name);
}
FullMatrix<double> A(2, 2);
A.fill(Adata);
- char *name = "Matrix A";
+ char name[] = "Matrix A";
checkConstructor4<double>(A, name);
}
template <typename number>
void
-checkVmult(FullMatrix<number> &A, Vector<number> &V, char *name = "Test Matrix")
+checkVmult(FullMatrix<number> &A,
+ Vector<number> & V,
+ const std::string & name = "Test Matrix")
{
deallog << "vmult" << std::endl;
- PointerMatrix<FullMatrix<number>, Vector<number>> P(&A, name);
+ PointerMatrix<FullMatrix<number>, Vector<number>> P(&A, name.c_str());
Vector<number> O(A.m());
P.vmult(O, V);
void
checkTvmult(FullMatrix<number> &A,
Vector<number> & V,
- char * name = "Test Matrix")
+ const std::string & name = "Test Matrix")
{
deallog << "Tvmult" << std::endl;
- PointerMatrix<FullMatrix<number>, Vector<number>> P(&A, name);
+ PointerMatrix<FullMatrix<number>, Vector<number>> P(&A, name.c_str());
Vector<number> O(A.m());
P.Tvmult(O, V);
void
checkTvmult_add(FullMatrix<number> &A,
Vector<number> & V,
- char * name = "Test Matrix")
+ const std::string & name = "Test Matrix")
{
deallog << "Tvmult_add" << std::endl;
- PointerMatrix<FullMatrix<number>, Vector<number>> P(&A, name);
+ PointerMatrix<FullMatrix<number>, Vector<number>> P(&A, name.c_str());
deallog << "Result vector set to all ones and to be added with result"
<< std::endl;
void
checkVmult_add(FullMatrix<number> &A,
Vector<number> & V,
- char * name = "Test Matrix")
+ const std::string & name = "Test Matrix")
{
deallog << "vmult_add" << std::endl;
- PointerMatrix<FullMatrix<number>, Vector<number>> P(&A, name);
+ PointerMatrix<FullMatrix<number>, Vector<number>> P(&A, name.c_str());
deallog << "Result vector set to all ones and to be added with result"
<< std::endl;
}
-SparseMatrix<double>
-graph_laplacian_move_return(const SparsityPattern &sparsity)
-{
- SparseMatrix<double> A(sparsity);
- graph_laplacian(sparsity, A);
-
- return std::move(A);
-}
-
int
main()
}
{
- // Return a sparse matrix using the move constructor
- SparseMatrix<double> A = graph_laplacian_move_return(sparsity);
+ // Return a sparse matrix using the move constructoir
+ SparseMatrix<double> B = graph_laplacian(sparsity);
+ SparseMatrix<double> A = std::move(B);
deallog << A.n_nonzero_elements() << std::endl;
+ deallog << B.empty() << std::endl;
y = 1.0;
A.vmult(y, x);
deallog << y.l2_norm() << std::endl;
// Explicitly move a sparse matrix
- SparseMatrix<double> B;
B = std::move(A);
deallog << B.m() << std::endl;
deallog << A.empty() << std::endl;
DEAL::64
DEAL::0.00
DEAL::64
+DEAL::1
DEAL::0.00
DEAL::16
DEAL::1
virtual Point<spacedim>
- pull_back(const Point<spacedim> &space_point) const
+ pull_back(const Point<spacedim> &space_point) const override
{
return space_point;
}
virtual Point<spacedim>
- push_forward(const Point<spacedim> &chart_point) const
+ push_forward(const Point<spacedim> &chart_point) const override
{
return chart_point;
}
virtual DerivativeForm<1, spacedim, spacedim>
- push_forward_gradient(const Point<spacedim> &chart_point) const
+ push_forward_gradient(const Point<spacedim> &chart_point) const override
{
DerivativeForm<1, spacedim, spacedim> x;
for (unsigned int d = 0; d < spacedim; ++d)
fe_list.push_back(new FE_Q<dim>(1));
function_list.push_back(new MySquareFunction<dim>(1));
- // test four different cases for the parameter: 1, 1e-20, 1e-170, 1e-800 (= 0)
- double factors[] = {1., 1e-40, 1e-170, 1e-800};
+ // test four different cases for the parameter: 1, 1e-20, 1e-170, 0.
+ double factors[] = {1., 1e-40, 1e-170, 0.};
for (unsigned int it = 0; it < 4; ++it)
{
deallog.push(Utilities::int_to_string(it, 1));
TopoDS_Edge edge = BRepBuilderAPI_MakeEdge(circle);
NormalProjectionBoundary<2, 3> manifold_b(edge);
- std::unique_ptr<Manifold<2, 3>> clone_b = manifold_b.clone();
+ std::unique_ptr<Manifold<2, 3>> clone_b = manifold_b.clone();
+ const auto & deref_clone_b = *clone_b;
deallog << "typeid of NormalProjectionBoundary<2, 3> is "
- << boost::core::demangle(typeid(*clone_b).name()) << std::endl;
+ << boost::core::demangle(typeid(deref_clone_b).name()) << std::endl;
NormalProjectionManifold<2, 3> manifold_m(edge);
- std::unique_ptr<Manifold<2, 3>> clone_m = manifold_m.clone();
+ std::unique_ptr<Manifold<2, 3>> clone_m = manifold_m.clone();
+ const auto & deref_clone_m = *clone_m;
deallog << "typeid of NormalProjectionManifold<2, 3> is "
- << boost::core::demangle(typeid(*clone_m).name()) << std::endl;
+ << boost::core::demangle(typeid(deref_clone_m).name()) << std::endl;
}
{
DirectionalProjectionBoundary<2, 3> manifold_b(face, Point<3>(0, 0, 1));
- std::unique_ptr<Manifold<2, 3>> clone_b = manifold_b.clone();
+ std::unique_ptr<Manifold<2, 3>> clone_b = manifold_b.clone();
+ const auto & deref_clone_b = *clone_b;
deallog << "typeid of DirectionalProjectionBoundary<2, 3> is "
- << boost::core::demangle(typeid(*clone_b).name()) << std::endl;
+ << boost::core::demangle(typeid(deref_clone_b).name()) << std::endl;
DirectionalProjectionManifold<2, 3> manifold_m(face, Point<3>(0, 0, 1));
- std::unique_ptr<Manifold<2, 3>> clone_m = manifold_m.clone();
+ std::unique_ptr<Manifold<2, 3>> clone_m = manifold_m.clone();
+ const auto & deref_clone_m = *clone_m;
deallog << "typeid of DirectionalProjectionManifold<2, 3> is "
- << boost::core::demangle(typeid(*clone_m).name()) << std::endl;
+ << boost::core::demangle(typeid(deref_clone_m).name()) << std::endl;
}
// Create a bspline passing through the points
NormalToMeshProjectionBoundary<1, 3> manifold_b(face);
- std::unique_ptr<Manifold<1, 3>> clone_b = manifold_b.clone();
+ std::unique_ptr<Manifold<1, 3>> clone_b = manifold_b.clone();
+ const auto & deref_clone_b = *clone_b;
deallog << "typeid of NormalProjectionBoundary<2, 3> is "
- << boost::core::demangle(typeid(*clone_b).name()) << std::endl;
+ << boost::core::demangle(typeid(deref_clone_b).name()) << std::endl;
NormalToMeshProjectionManifold<1, 3> manifold_m(face);
- std::unique_ptr<Manifold<1, 3>> clone_m = manifold_m.clone();
+ std::unique_ptr<Manifold<1, 3>> clone_m = manifold_m.clone();
+ const auto & deref_clone_m = *clone_m;
deallog << "typeid of NormalProjectionManifold<2, 3> is "
- << boost::core::demangle(typeid(*clone_m).name()) << std::endl;
+ << boost::core::demangle(typeid(deref_clone_m).name()) << std::endl;
}
deallog << "OK" << std::endl;