// output some indicators for a given vector
-template <class VECTOR>
+template <typename VectorType>
void
-output_vector (const VECTOR &v)
+output_vector (const VectorType &v)
{
deallog << v.l1_norm() << ' ' << v.l2_norm() << ' ' << v.linfty_norm()
<< std::endl;
// write out at most 20 equispaced
// elements of the vector
- for (unsigned int i=0; i<v.size(); i+=std::max(static_cast<typename VECTOR::size_type>(1),
- static_cast<typename VECTOR::size_type>(v.size()/20)))
+ for (unsigned int i=0; i<v.size(); i+=std::max(static_cast<typename VectorType::size_type>(1),
+ static_cast<typename VectorType::size_type>(v.size()/20)))
deallog << v(i) << ' ';
deallog << std::endl;
}
-// test the various VECTOR::extract_subvector_to functions for
+// test the various extract_subvector_to functions for
// parallel vectors and block vectors
#include "../tests.h"
#include <fstream>
-template<class VECTOR>
-void test (const FilteredMatrix<VECTOR> &M)
+template<typename VectorType>
+void test (const FilteredMatrix<VectorType> &M)
{
deallog << "Iterator";
unsigned int max = 0;
- for (typename FilteredMatrix<VECTOR>::const_iterator i= M.begin();
+ for (typename FilteredMatrix<VectorType>::const_iterator i= M.begin();
i != M.end(); ++i)
{
Assert(i->row() == i->column(), ExcInternalError());
deallog << ' ' << i->row() << ':' << i->value();
max = i->row();
}
- VECTOR v(max+1);
- VECTOR w(max+1);
+ VectorType v(max+1);
+ VectorType w(max+1);
for (unsigned int i=0; i<v.size(); ++i)
v(i) = 31+i;
using namespace dealii;
-template<class PRECONDITIONER, class MATRIX, class VECTOR,
+template<class PRECONDITIONER, class MATRIX, typename VectorType,
class ADDITIONAL_DATA = typename PRECONDITIONER::AdditionalData>
void
test_preconditioner (const MATRIX &A,
- const VECTOR &b,
+ const VectorType &b,
const ADDITIONAL_DATA &data = ADDITIONAL_DATA())
{
- const auto lo_A = linear_operator<VECTOR>(A);
+ const auto lo_A = linear_operator<VectorType>(A);
PRECONDITIONER preconditioner;
preconditioner.initialize(A, data);
SolverControl solver_control (100, 1.0e-10);
- SolverCG<VECTOR> solver (solver_control);
+ SolverCG<VectorType> solver (solver_control);
// Exact inverse
const auto lo_A_inv = inverse_operator(lo_A,
solver,
preconditioner);
- const VECTOR x = lo_A_inv*b;
+ const VectorType x = lo_A_inv*b;
// Approximate inverse
{
// Using exemplar matrix
- const auto lo_A_inv_approx = linear_operator<VECTOR>(A, preconditioner);
- const VECTOR x_approx = lo_A_inv_approx*b;
+ const auto lo_A_inv_approx = linear_operator<VectorType>(A, preconditioner);
+ const VectorType x_approx = lo_A_inv_approx*b;
}
{
// Stand-alone
- const auto lo_A_inv_approx = linear_operator<VECTOR>(preconditioner);
- const VECTOR x_approx = lo_A_inv_approx*b;
+ const auto lo_A_inv_approx = linear_operator<VectorType>(preconditioner);
+ const VectorType x_approx = lo_A_inv_approx*b;
}
}
matrix.n_block_cols());
}
- template<typename VECTOR>
+ template<typename VectorType>
void
- vmult(VECTOR &dst, const VECTOR &src) const
+ vmult(VectorType &dst, const VectorType &src) const
{
dst = src;
}
- template<class VECTOR>
+ template<typename VectorType>
void
- Tvmult(VECTOR &dst, const VECTOR &src) const
+ Tvmult(VectorType &dst, const VectorType &src) const
{
dst = src;
}
#include <deal.II/lac/solver_qmrs.h>
#include <deal.II/lac/precondition.h>
-template<class SOLVER, class MATRIX, class VECTOR, class PRECONDITION>
+template<class SOLVER, class MATRIX, typename VectorType, class PRECONDITION>
void
-check_solve( SOLVER &solver, const MATRIX &A,
- VECTOR &u, VECTOR &f, const PRECONDITION &P)
+check_solve (SOLVER &solver,
+ const MATRIX &A,
+ VectorType &u,
+ VectorType &f,
+ const PRECONDITION &P)
{
u = 0.;
f = 1.;
}
}
-template<class SOLVER, class MATRIX, class VECTOR, class PRECONDITION>
+template<class SOLVER, class MATRIX, typename VectorType, class PRECONDITION>
void
-check_Tsolve(SOLVER &solver, const MATRIX &A,
- VECTOR &u, VECTOR &f, const PRECONDITION &P)
+check_Tsolve (SOLVER &solver,
+ const MATRIX &A,
+ VectorType &u,
+ VectorType &f,
+ const PRECONDITION &P)
{
u = 0.;
f = 1.;
check_solve(rich,A,u,f,prec_psor);
}
}
-
#include <deal.II/lac/solver_qmrs.h>
#include <deal.II/lac/precondition.h>
-template<class SOLVER, class MATRIX, class VECTOR>
+template<class SOLVER, class MATRIX, typename VectorType>
void
-check_solve( const MATRIX &A, VECTOR &u, VECTOR &f,
- const typename SOLVER::AdditionalData &additional_data = typename SOLVER::AdditionalData() )
+check_solve (const MATRIX &A,
+ VectorType &u,
+ VectorType &f,
+ const typename SOLVER::AdditionalData &additional_data = typename SOLVER::AdditionalData())
{
GrowingVectorMemory<> mem;
SolverControl control(100, 1.e-3);
}
}
-
-template<class SOLVER, class MATRIX, class VECTOR, class PRECONDITION>
+template<class SOLVER, class MATRIX, typename VectorType, class PRECONDITION>
void
-check_solve( SOLVER &solver, const MATRIX &A,
- VECTOR &u, VECTOR &f, const PRECONDITION &P)
+check_solve (SOLVER &solver,
+ const MATRIX &A,
+ VectorType &u,
+ VectorType &f,
+ const PRECONDITION &P)
{
u = 0.;
f = 1.;
}
}
}
-
-template<class SOLVER, class MATRIX, class VECTOR, class PRECONDITION>
+template<class SOLVER, class MATRIX, typename VectorType, class PRECONDITION>
void
-check_solve( SOLVER &solver, const MATRIX &A,
- VECTOR &u, VECTOR &f, const PRECONDITION &P)
+check_solve (SOLVER &solver,
+ const MATRIX &A,
+ VectorType &u,
+ VectorType &f,
+ const PRECONDITION &P)
{
u = 0.;
f = 1.;
cg_c1.disconnect();
}
}
-
#include <deal.II/lac/solver_relaxation.h>
#include <deal.II/lac/precondition.h>
-template<class SOLVER, class MATRIX, class VECTOR, class PRECONDITION>
+template<class SOLVER, class MATRIX, typename VectorType, class PRECONDITION>
double
-check_solve( SOLVER &solver, const MATRIX &A,
- VECTOR &u, VECTOR &f, const PRECONDITION &P)
+check_solve (SOLVER &solver,
+ const MATRIX &A,
+ VectorType &u,
+ VectorType &f,
+ const PRECONDITION &P)
{
double result = 0.;
u = 0.;
check_solve(rich,A,u,f,prec_psor);
}
}
-
#include <deal.II/lac/precondition_block.h>
#include <deal.II/lac/relaxation_block.h>
-template<class SOLVER, class MATRIX, class VECTOR, class PRECONDITION>
+template<class SOLVER, class MATRIX, typename VectorType, class PRECONDITION>
double
-check_solve( SOLVER &solver, const MATRIX &A,
- VECTOR &u, VECTOR &f, const PRECONDITION &P)
+check_solve (SOLVER &solver,
+ const MATRIX &A,
+ VectorType &u,
+ VectorType &f,
+ const PRECONDITION &P)
{
double result = 0.;
u = 0.;
}
}
}
-
#include <deal.II/lac/precondition_block.h>
#include <deal.II/lac/relaxation_block.h>
-template<class SOLVER, class MATRIX, class VECTOR, class PRECONDITION>
+template<class SOLVER, class MATRIX, typename VectorType, class PRECONDITION>
double
-check_solve( SOLVER &solver, const MATRIX &A,
- VECTOR &u, VECTOR &f, const PRECONDITION &P)
+check_solve (SOLVER &solver,
+ const MATRIX &A,
+ VectorType &u,
+ VectorType &f,
+ const PRECONDITION &P)
{
double result = 0.;
u = 0.;
}
}
}
-
#include <fstream>
-template <class MATRIX, class VECTOR>
+template <class MATRIX, typename VectorType>
void
-check(const MATRIX &A, const VECTOR &f)
+check (const MATRIX &A, const VectorType &f)
{
std::vector<std::string> names;
names.push_back("cg");
ReductionControl cont1(100, 0., 1.e-4);
SolverControl cont2(100, 1.e-7);
- SolverSelector<VECTOR> solver;
+ SolverSelector<VectorType> solver;
PreconditionSSOR<SparseMatrix<double> > pre;
pre.initialize(A);
- VECTOR u;
+ VectorType u;
u.reinit(f);
std::vector<std::string>::const_iterator name;
-template <class MATRIX, class VECTOR>
+template <class MATRIX, typename VectorType>
void
-check(const MATRIX &A, const VECTOR &f)
+check(const MATRIX &A, const VectorType &f)
{
std::vector<std::string> names;
names.push_back("cg");
names.push_back("fgmres");
MySolverControl mycont;
- SolverSelector<VECTOR> solver;
+ SolverSelector<VectorType> solver;
PreconditionSSOR<SparseMatrix<double> > pre;
pre.initialize(A);
- VECTOR u;
+ VectorType u;
u.reinit(f);
std::vector<std::string>::const_iterator name;
deallog << std::endl;
}
-template<class SOLVER, class MATRIX, class VECTOR, class PRECONDITION>
+template<class SOLVER, class MATRIX, typename VectorType, class PRECONDITION>
void
-check_solve( SOLVER &solver, const MATRIX &A,
- VECTOR &u, VECTOR &f, const PRECONDITION &P)
+check_solve(SOLVER &solver,
+ const MATRIX &A,
+ VectorType &u,
+ VectorType &f,
+ const PRECONDITION &P)
{
u = 0.;
f = 1.;
}
}
-
using namespace dealii;
-template<class VECTOR>
+template<typename VectorType>
void
test_leak()
{
- GrowingVectorMemory<VECTOR> mem;
- VECTOR *v = mem.alloc();
+ GrowingVectorMemory<VectorType> mem;
+ VectorType *v = mem.alloc();
v->reinit(5);
}
-template<class VECTOR>
+template<typename VectorType>
void
test_stat()
{
- GrowingVectorMemory<VECTOR> mem(1, true);
- VECTOR *v1 = mem.alloc();
- VECTOR *v2 = mem.alloc();
- VECTOR *v3 = mem.alloc();
- VECTOR *v4 = mem.alloc();
- VECTOR *v5 = mem.alloc();
- VECTOR *v6 = mem.alloc();
+ GrowingVectorMemory<VectorType> mem(1, true);
+ VectorType *v1 = mem.alloc();
+ VectorType *v2 = mem.alloc();
+ VectorType *v3 = mem.alloc();
+ VectorType *v4 = mem.alloc();
+ VectorType *v5 = mem.alloc();
+ VectorType *v6 = mem.alloc();
v1->reinit(5);
v2->reinit(5);
v3->reinit(5);
#include <deal.II/lac/vector_memory.h>
#include <typeinfo>
-template<class SOLVER, class MATRIX, class VECTOR, class PRECONDITION>
+template<class SOLVER, class MATRIX, typename VectorType, class PRECONDITION>
void
-check_solve( SOLVER &solver,
+check_solve (SOLVER &solver,
const SolverControl &solver_control,
- const MATRIX &A,
- VECTOR &u, VECTOR &f, const PRECONDITION &P)
+ const MATRIX &A,
+ VectorType &u,
+ VectorType &f,
+ const PRECONDITION &P)
{
deallog << "Solver type: " << typeid(solver).name() << std::endl;
check_solve (solver, control, A,u,f, preconditioner);
}
}
-
#include <deal.II/lac/vector_memory.h>
#include <typeinfo>
-template<class SOLVER, class MATRIX, class VECTOR, class PRECONDITION>
+template<class SOLVER, class MATRIX, typename VectorType, class PRECONDITION>
void
-check_solve( SOLVER &solver,
+check_solve (SOLVER &solver,
const SolverControl &solver_control,
- const MATRIX &A,
- VECTOR &u, VECTOR &f, const PRECONDITION &P)
+ const MATRIX &A,
+ VectorType &u,
+ VectorType &f,
+ const PRECONDITION &P)
{
deallog << "Solver type: " << typeid(solver).name() << std::endl;
check_solve (solver, control, A,u,f, preconditioner);
}
}
-
#include <deal.II/lac/vector_memory.h>
#include <typeinfo>
-template<class SOLVER, class MATRIX, class VECTOR, class PRECONDITION>
+template<class SOLVER, class MATRIX, typename VectorType, class PRECONDITION>
void
-check_solve( SOLVER &solver,
+check_solve (SOLVER &solver,
const SolverControl &solver_control,
const MATRIX &A,
- VECTOR &u, VECTOR &f, const PRECONDITION &P)
+ VectorType &u,
+ VectorType &f,
+ const PRECONDITION &P)
{
deallog << "Solver type: " << typeid(solver).name() << std::endl;
check_solve (solver, control, A,u,f, preconditioner);
}
}
-
#include <deal.II/lac/vector_memory.h>
#include <typeinfo>
-template<class SOLVER, class MATRIX, class VECTOR, class PRECONDITION>
+template<class SOLVER, class MATRIX, typename VectorType, class PRECONDITION>
void
-check_solve( SOLVER &solver,
+check_solve (SOLVER &solver,
const SolverControl &solver_control,
- const MATRIX &A,
- VECTOR &u, VECTOR &f, const PRECONDITION &P)
+ const MATRIX &A,
+ VectorType &u,
+ VectorType &f,
+ const PRECONDITION &P)
{
deallog << "Solver type: " << typeid(solver).name() << std::endl;
check_solve (solver, control, A,u,f, preconditioner);
}
}
-
#include <deal.II/lac/vector_memory.h>
#include <typeinfo>
-template<class SOLVER, class MATRIX, class VECTOR, class PRECONDITION>
+template<class SOLVER, class MATRIX, typename VectorType, class PRECONDITION>
void
-check_solve( SOLVER &solver,
+check_solve (SOLVER &solver,
const SolverControl &solver_control,
- const MATRIX &A,
- VECTOR &u, VECTOR &f, const PRECONDITION &P)
+ const MATRIX &A,
+ VectorType &u,
+ VectorType &f,
+ const PRECONDITION &P)
{
deallog << "Solver type: " << typeid(solver).name() << std::endl;
check_solve (solver, control, A,u,f, preconditioner);
}
}
-
#include <deal.II/lac/vector_memory.h>
#include <typeinfo>
-template<class SOLVER, class MATRIX, class VECTOR, class PRECONDITION>
+template<class SOLVER, class MATRIX, typename VectorType, class PRECONDITION>
void
-check_solve( SOLVER &solver,
+check_solve (SOLVER &solver,
const SolverControl &solver_control,
- const MATRIX &A,
- VECTOR &u, VECTOR &f, const PRECONDITION &P)
+ const MATRIX &A,
+ VectorType &u,
+ VectorType &f,
+ const PRECONDITION &P)
{
deallog << "Solver type: " << typeid(solver).name() << std::endl;
check_solve (solver, control, A,u,f, preconditioner);
}
}
-
#include <deal.II/lac/vector_memory.h>
#include <typeinfo>
-template<class SOLVER, class MATRIX, class VECTOR, class PRECONDITION>
+template<class SOLVER, class MATRIX, typename VectorType, class PRECONDITION>
void
-check_solve( SOLVER &solver,
+check_solve (SOLVER &solver,
const SolverControl &solver_control,
- const MATRIX &A,
- VECTOR &u, VECTOR &f, const PRECONDITION &P)
+ const MATRIX &A,
+ VectorType &u,
+ VectorType &f,
+ const PRECONDITION &P)
{
deallog << "Solver type: " << typeid(solver).name() << std::endl;
check_solve (solver, control, A,u,f, preconditioner);
}
}
-
#include <deal.II/lac/vector_memory.h>
#include <typeinfo>
-template<class SOLVER, class MATRIX, class VECTOR, class PRECONDITION>
+template<class SOLVER, class MATRIX, typename VectorType, class PRECONDITION>
void
-check_solve( SOLVER &solver,
+check_solve (SOLVER &solver,
const SolverControl &solver_control,
- const MATRIX &A,
- VECTOR &u, VECTOR &f, const PRECONDITION &P)
+ const MATRIX &A,
+ VectorType &u,
+ VectorType &f,
+ const PRECONDITION &P)
{
deallog << "Solver type: " << typeid(solver).name() << std::endl;
check_solve (solver, control, A,u,f, preconditioner);
}
}
-
#include <deal.II/lac/vector_memory.h>
#include <typeinfo>
-template<class SOLVER, class MATRIX, class VECTOR, class PRECONDITION>
+template<class SOLVER, class MATRIX, typename VectorType, class PRECONDITION>
void
-check_solve( SOLVER &solver,
+check_solve (SOLVER &solver,
const SolverControl &solver_control,
- const MATRIX &A,
- VECTOR &u, VECTOR &f, const PRECONDITION &P)
+ const MATRIX &A,
+ VectorType &u,
+ VectorType &f,
+ const PRECONDITION &P)
{
deallog << "Solver type: " << typeid(solver).name() << std::endl;
}
}
-
#include <deal.II/numerics/vector_tools.h>
#include <deal.II/numerics/matrix_tools.h>
-template <int dim, typename MATRIX, typename VECTOR>
-void assemble_laplace (MATRIX &B, VECTOR &bb, DoFHandler<dim> &dof_handler, FiniteElement<dim> &fe)
+template <int dim, typename MATRIX, typename VectorType>
+void assemble_laplace (MATRIX &B, VectorType &bb, DoFHandler<dim> &dof_handler, FiniteElement<dim> &fe)
{
QGauss<dim> quadrature_formula(2);
FEValues<dim> fe_values (fe, quadrature_formula,