From: kronbichler Date: Mon, 11 Mar 2013 07:11:30 +0000 (+0000) Subject: Use the generic instantiation scheme instead of manually listing the desired vector... X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d70a9ebd6bf77094f983a1fbe6645a6337997449;p=dealii-svn.git Use the generic instantiation scheme instead of manually listing the desired vector types. git-svn-id: https://svn.dealii.org/trunk@28848 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/source/numerics/derivative_approximation.cc b/deal.II/source/numerics/derivative_approximation.cc index 66fb66d830..59929690ba 100644 --- a/deal.II/source/numerics/derivative_approximation.cc +++ b/deal.II/source/numerics/derivative_approximation.cc @@ -17,6 +17,8 @@ #include #include #include +#include +#include #include #include #include diff --git a/deal.II/source/numerics/derivative_approximation.inst.in b/deal.II/source/numerics/derivative_approximation.inst.in index 39dcf37124..8abdb2bde7 100644 --- a/deal.II/source/numerics/derivative_approximation.inst.in +++ b/deal.II/source/numerics/derivative_approximation.inst.in @@ -11,140 +11,114 @@ // //--------------------------------------------------------------------------- -for (deal_II_dimension : DIMENSIONS) +for (deal_II_dimension : DIMENSIONS ; VEC : SERIAL_VECTORS ; DH : DOFHANDLER_TEMPLATES) { -#define INSTANTIATE(InputVector,DH) \ -template \ -void \ -DerivativeApproximation:: \ -approximate_gradient \ -(const Mapping &mapping, \ - const DH &dof_handler, \ - const InputVector &solution, \ - Vector &derivative_norm, \ - const unsigned int component); \ - \ -template \ -void \ -DerivativeApproximation:: \ -approximate_gradient \ -(const DH &dof_handler, \ - const InputVector &solution, \ - Vector &derivative_norm, \ - const unsigned int component); \ - \ -template \ -void \ -DerivativeApproximation:: \ -approximate_second_derivative \ -(const Mapping &mapping, \ - const DH &dof_handler, \ - const InputVector &solution, \ - Vector &derivative_norm, \ - const unsigned int component); \ - \ -template \ -void \ -DerivativeApproximation:: \ -approximate_second_derivative \ -(const DH &dof_handler, \ - const InputVector &solution, \ - Vector &derivative_norm, \ - const unsigned int component); \ - \ -template \ -void \ -DerivativeApproximation:: \ -approximate_derivative_tensor \ -(const Mapping & mapping, \ - const DH &dof_handler, \ - const InputVector &solution, \ - const DH::active_cell_iterator &cell,\ - Tensor<1,deal_II_dimension> &derivative, \ - const unsigned int component); \ - \ -template \ -void \ -DerivativeApproximation:: \ -approximate_derivative_tensor \ -(const Mapping & mapping, \ - const DH &dof_handler, \ - const InputVector &solution, \ - const DH::active_cell_iterator &cell,\ - Tensor<2,deal_II_dimension> &derivative, \ - const unsigned int component); \ - \ -template \ -void \ -DerivativeApproximation:: \ -approximate_derivative_tensor \ -(const Mapping & mapping, \ - const DH &dof_handler, \ - const InputVector &solution, \ - const DH::active_cell_iterator &cell,\ - Tensor<3,deal_II_dimension> &derivative, \ - const unsigned int component); \ - \ -template \ -void \ -DerivativeApproximation:: \ -approximate_derivative_tensor \ -(const DH &dof_handler, \ - const InputVector &solution, \ - const DH::active_cell_iterator &cell,\ - Tensor<1,deal_II_dimension> &derivative, \ - const unsigned int component); \ - \ -template \ -void \ -DerivativeApproximation:: \ -approximate_derivative_tensor \ -(const DH &dof_handler, \ - const InputVector &solution, \ - const DH::active_cell_iterator &cell,\ - Tensor<2,deal_II_dimension> &derivative, \ - const unsigned int component); \ - \ -template \ -void \ -DerivativeApproximation:: \ -approximate_derivative_tensor \ -(const DH &dof_handler, \ - const InputVector &solution, \ - const DH::active_cell_iterator &cell,\ - Tensor<3,deal_II_dimension> &derivative, \ - const unsigned int component) - - -INSTANTIATE(Vector, DoFHandler); -INSTANTIATE(Vector, DoFHandler); -INSTANTIATE(BlockVector, DoFHandler); -INSTANTIATE(BlockVector, DoFHandler); - -INSTANTIATE(Vector, hp::DoFHandler); -INSTANTIATE(Vector, hp::DoFHandler); -INSTANTIATE(BlockVector, hp::DoFHandler); -INSTANTIATE(BlockVector, hp::DoFHandler); - -#ifdef DEAL_II_WITH_PETSC -INSTANTIATE(PETScWrappers::Vector, DoFHandler); -INSTANTIATE(PETScWrappers::BlockVector, DoFHandler); - -INSTANTIATE(PETScWrappers::Vector, hp::DoFHandler); -INSTANTIATE(PETScWrappers::BlockVector, hp::DoFHandler); -#endif - -#ifdef DEAL_II_WITH_TRILINOS -INSTANTIATE(TrilinosWrappers::Vector, DoFHandler); -INSTANTIATE(TrilinosWrappers::BlockVector, DoFHandler); -INSTANTIATE(TrilinosWrappers::MPI::Vector, DoFHandler); -INSTANTIATE(TrilinosWrappers::MPI::BlockVector, DoFHandler); - -//TODO: test hp before instantiating -#endif - -#undef INSTANTIATE +template +void +DerivativeApproximation:: +approximate_gradient +(const Mapping &mapping, + const DH &dof_handler, + const VEC &solution, + Vector &derivative_norm, + const unsigned int component); + +template +void +DerivativeApproximation:: +approximate_gradient +(const DH &dof_handler, + const VEC &solution, + Vector &derivative_norm, + const unsigned int component); + +template +void +DerivativeApproximation:: +approximate_second_derivative +(const Mapping &mapping, + const DH &dof_handler, + const VEC &solution, + Vector &derivative_norm, + const unsigned int component); + +template +void +DerivativeApproximation:: +approximate_second_derivative +(const DH &dof_handler, + const VEC &solution, + Vector &derivative_norm, + const unsigned int component); + +template +void +DerivativeApproximation:: +approximate_derivative_tensor +(const Mapping & mapping, + const DH &dof_handler, + const VEC &solution, + const DH::active_cell_iterator &cell, + Tensor<1,deal_II_dimension> &derivative, + const unsigned int component); + +template +void +DerivativeApproximation:: +approximate_derivative_tensor +(const Mapping & mapping, + const DH &dof_handler, + const VEC &solution, + const DH::active_cell_iterator &cell, + Tensor<2,deal_II_dimension> &derivative, + const unsigned int component); +template +void +DerivativeApproximation:: +approximate_derivative_tensor +(const Mapping & mapping, + const DH &dof_handler, + const VEC &solution, + const DH::active_cell_iterator &cell, + Tensor<3,deal_II_dimension> &derivative, + const unsigned int component); + +template +void +DerivativeApproximation:: +approximate_derivative_tensor +(const DH &dof_handler, + const VEC &solution, + const DH::active_cell_iterator &cell, + Tensor<1,deal_II_dimension> &derivative, + const unsigned int component); + +template +void +DerivativeApproximation:: +approximate_derivative_tensor +(const DH &dof_handler, + const VEC &solution, + const DH::active_cell_iterator &cell, + Tensor<2,deal_II_dimension> &derivative, + const unsigned int component); + +template +void +DerivativeApproximation:: +approximate_derivative_tensor +(const DH &dof_handler, + const VEC &solution, + const DH::active_cell_iterator &cell, + Tensor<3,deal_II_dimension> &derivative, + const unsigned int component); + +} + + +for (deal_II_dimension : DIMENSIONS) +{ template double DerivativeApproximation:: diff --git a/deal.II/source/numerics/error_estimator.inst.in b/deal.II/source/numerics/error_estimator.inst.in index 1b84c651f1..7b701a6992 100644 --- a/deal.II/source/numerics/error_estimator.inst.in +++ b/deal.II/source/numerics/error_estimator.inst.in @@ -11,200 +11,136 @@ // //--------------------------------------------------------------------------- -for (deal_II_dimension : DIMENSIONS) +for (deal_II_dimension : DIMENSIONS ; deal_II_space_dimension : SPACE_DIMENSIONS) { -#if deal_II_dimension != 1 -template class KellyErrorEstimator; +#if deal_II_dimension != 1 && deal_II_dimension <= deal_II_space_dimension +template class KellyErrorEstimator; #endif +} +for (VEC : SERIAL_VECTORS ; deal_II_dimension : DIMENSIONS; deal_II_space_dimension : SPACE_DIMENSIONS; DH : DOFHANDLER_TEMPLATES ) +{ +#if deal_II_dimension <= deal_II_space_dimension + +template +void +KellyErrorEstimator:: +estimate > (const Mapping &, + const DH &, + const Quadrature &, + const FunctionMap::type &, + const VEC &, + Vector &, + const ComponentMask &, + const Function *, + const unsigned int , + const unsigned int , + const types::material_id); + +template +void +KellyErrorEstimator:: +estimate > ( + const DH &, + const Quadrature &, + const FunctionMap::type &, + const VEC &, + Vector &, + const ComponentMask &, + const Function *, + const unsigned int , + const unsigned int , + const types::material_id); + +template +void +KellyErrorEstimator:: +estimate > (const Mapping &, + const DH &, + const Quadrature &, + const FunctionMap::type &, + const std::vector &, + std::vector *> &, + const ComponentMask &, + const Function *, + const unsigned int , + const unsigned int , + const types::material_id); + +template +void +KellyErrorEstimator:: +estimate > ( + const DH &, + const Quadrature &, + const FunctionMap::type &, + const std::vector &, + std::vector *> &, + const ComponentMask &, + const Function *, + const unsigned int , + const unsigned int , + const types::material_id); + +template +void +KellyErrorEstimator:: +estimate > (const Mapping &, + const DH &, + const hp::QCollection &, + const FunctionMap::type &, + const VEC &, + Vector &, + const ComponentMask &, + const Function *, + const unsigned int , + const unsigned int , + const types::material_id); + +template +void +KellyErrorEstimator:: +estimate > ( + const DH &, + const hp::QCollection &, + const FunctionMap::type &, + const VEC &, + Vector &, + const ComponentMask &, + const Function *, + const unsigned int , + const unsigned int , + const types::material_id); + +template +void +KellyErrorEstimator:: +estimate > (const Mapping &, + const DH &, + const hp::QCollection &, + const FunctionMap::type &, + const std::vector &, + std::vector *> &, + const ComponentMask &, + const Function *, + const unsigned int , + const unsigned int , + const types::material_id); + +template +void +KellyErrorEstimator:: +estimate > ( + const DH &, + const hp::QCollection &, + const FunctionMap::type &, + const std::vector &, + std::vector *> &, + const ComponentMask &, + const Function *, + const unsigned int , + const unsigned int , + const types::material_id); -#if deal_II_dimension == 2 -template class KellyErrorEstimator; -#endif - -// instantiate the externally visible functions. define a list of functions -// for vectors, where the vector/matrix can be replaced using a preprocessor -// variable VectorType/MatrixType -#define INSTANTIATE_1(InputVector,DH,Q) \ -template \ -void \ -KellyErrorEstimator:: \ -estimate > (const Mapping &, \ - const DH &, \ - const Q &, \ - const FunctionMap::type &, \ - const InputVector &, \ - Vector &, \ - const ComponentMask &, \ - const Function *, \ - const unsigned int , \ - const unsigned int , \ - const types::material_id); \ - \ -template \ -void \ -KellyErrorEstimator:: \ -estimate > (const DH &, \ - const Q &, \ - const FunctionMap::type &, \ - const InputVector &, \ - Vector &, \ - const ComponentMask &, \ - const Function *, \ - const unsigned int , \ - const unsigned int , \ - const types::material_id); \ - \ -template \ -void \ -KellyErrorEstimator:: \ -estimate > (const Mapping &, \ - const DH &, \ - const Q &, \ - const FunctionMap::type &, \ - const std::vector &, \ - std::vector*> &, \ - const ComponentMask &, \ - const Function *, \ - const unsigned int , \ - const unsigned int , \ - const types::material_id); \ - \ -template \ -void \ -KellyErrorEstimator:: \ -estimate > (const DH &, \ - const Q &, \ - const FunctionMap::type &, \ - const std::vector &, \ - std::vector*> &, \ - const ComponentMask &, \ - const Function *, \ - const unsigned int , \ - const unsigned int , \ - const types::material_id);\ - -#if deal_II_dimension == 2 || deal_II_dimension == 1 - -#define INSTANTIATE_CODIM(InputVector,DH,Q) \ -template \ -void \ -KellyErrorEstimator:: \ -estimate > (const Mapping &, \ - const DH &, \ - const Q &, \ - const FunctionMap::type &, \ - const InputVector &, \ - Vector &, \ - const ComponentMask &, \ - const Function *, \ - const unsigned int , \ - const unsigned int , \ - const types::material_id); \ - \ -template \ -void \ -KellyErrorEstimator:: \ -estimate > (const DH &, \ - const Q &, \ - const FunctionMap::type &, \ - const InputVector &, \ - Vector &, \ - const ComponentMask &, \ - const Function *, \ - const unsigned int , \ - const unsigned int , \ - const types::material_id); \ - \ -template \ -void \ -KellyErrorEstimator:: \ -estimate > (const Mapping &, \ - const DH &, \ - const Q &, \ - const FunctionMap::type &, \ - const std::vector &, \ - std::vector*> &, \ - const ComponentMask &, \ - const Function *, \ - const unsigned int , \ - const unsigned int , \ - const types::material_id); \ - \ -template \ -void \ -KellyErrorEstimator:: \ -estimate > (const DH &, \ - const Q &, \ - const FunctionMap::type &, \ - const std::vector &, \ - std::vector*> &, \ - const ComponentMask &, \ - const Function *, \ - const unsigned int , \ - const unsigned int , \ - const types::material_id);\ - -#else -#define INSTANTIATE_CODIM(InputVector,DH,Q) -#endif - - -#define INSTANTIATE(InputVector,DH) \ - INSTANTIATE_1(InputVector,DH,Quadrature) \ - INSTANTIATE_1(InputVector,DH,hp::QCollection) \ - INSTANTIATE_CODIM(InputVector, DH, Quadrature) \ - INSTANTIATE_CODIM(InputVector, DH, hp::QCollection) - - - -INSTANTIATE(Vector,DoFHandler) -INSTANTIATE(Vector,DoFHandler) -INSTANTIATE(BlockVector,DoFHandler) -INSTANTIATE(BlockVector,DoFHandler) - -INSTANTIATE(Vector,hp::DoFHandler) -INSTANTIATE(Vector,hp::DoFHandler) -INSTANTIATE(BlockVector,hp::DoFHandler) -INSTANTIATE(BlockVector,hp::DoFHandler) - -INSTANTIATE(parallel::distributed::Vector,DoFHandler) -INSTANTIATE(parallel::distributed::Vector,DoFHandler) -INSTANTIATE(parallel::distributed::BlockVector,DoFHandler) -INSTANTIATE(parallel::distributed::BlockVector,DoFHandler) - -INSTANTIATE(parallel::distributed::Vector,hp::DoFHandler) -INSTANTIATE(parallel::distributed::Vector,hp::DoFHandler) -INSTANTIATE(parallel::distributed::BlockVector,hp::DoFHandler) -INSTANTIATE(parallel::distributed::BlockVector,hp::DoFHandler) - -#ifdef DEAL_II_WITH_PETSC -INSTANTIATE(PETScWrappers::Vector,DoFHandler) -INSTANTIATE(PETScWrappers::BlockVector,DoFHandler) - -INSTANTIATE(PETScWrappers::Vector,hp::DoFHandler) -INSTANTIATE(PETScWrappers::BlockVector,hp::DoFHandler) - -INSTANTIATE(PETScWrappers::MPI::Vector,DoFHandler) -INSTANTIATE(PETScWrappers::MPI::BlockVector,DoFHandler) - -#endif - -#ifdef DEAL_II_WITH_TRILINOS -INSTANTIATE(TrilinosWrappers::Vector,DoFHandler) -INSTANTIATE(TrilinosWrappers::BlockVector,DoFHandler) - -INSTANTIATE(TrilinosWrappers::Vector,hp::DoFHandler) -INSTANTIATE(TrilinosWrappers::BlockVector,hp::DoFHandler) - -INSTANTIATE(TrilinosWrappers::MPI::Vector,DoFHandler) -INSTANTIATE(TrilinosWrappers::MPI::BlockVector,DoFHandler) - -INSTANTIATE(TrilinosWrappers::MPI::Vector,hp::DoFHandler) -INSTANTIATE(TrilinosWrappers::MPI::BlockVector,hp::DoFHandler) #endif - -#undef INSTANTIATE -#undef INSTANTIATE_1 -#undef INSTANTIATE_CODIM }