From: Matthias Maier Date: Thu, 9 Apr 2015 22:50:12 +0000 (+0200) Subject: Restructure Factory class into internal namespace X-Git-Tag: v8.3.0-rc1~242^2~11 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1fbca2c33a8168fda967228fa7ebe74634ef7920;p=dealii.git Restructure Factory class into internal namespace --- diff --git a/include/deal.II/lac/block_vector.h b/include/deal.II/lac/block_vector.h index d8cad92014..387645e4b9 100644 --- a/include/deal.II/lac/block_vector.h +++ b/include/deal.II/lac/block_vector.h @@ -36,10 +36,6 @@ namespace TrilinosWrappers } #endif -// forward declaration -template class ReinitRangeFactory; -template class ReinitDomainFactory; - /*! @addtogroup Vectors *@{ @@ -464,44 +460,49 @@ void swap (BlockVector &u, } -/** - * Specialization for BlockVector. - */ -template -class ReinitRangeFactory > +namespace internal { -public: + template class ReinitRangeFactory; + template class ReinitDomainFactory; - template - std::function &, bool)> - operator()(const Matrix &matrix) + /* + * A factory class internally used in linear_operator.h. + * Specialization for BlockVector. + */ + template + class ReinitRangeFactory > { - return [&matrix](BlockVector &v, bool fast) + public: + template + std::function &, bool)> + operator()(const Matrix &matrix) { - v.reinit(matrix.get_row_indices(), fast); - }; - } -}; - - -/** - * Specialization for BlockVector. - */ -template -class ReinitDomainFactory > -{ -public: - - template - std::function &, bool)> - operator()(const Matrix &matrix) + return [&matrix](BlockVector &v, bool fast) + { + v.reinit(matrix.get_row_indices(), fast); + }; + } + }; + + /* + * A factory class internally used in linear_operator.h. + * Specialization for BlockVector. + */ + template + class ReinitDomainFactory > { - return [&matrix](BlockVector &v, bool fast) + public: + template + std::function &, bool)> + operator()(const Matrix &matrix) { - v.reinit(matrix.get_column_indices(), fast); - }; - } -}; + return [&matrix](BlockVector &v, bool fast) + { + v.reinit(matrix.get_column_indices(), fast); + }; + } + }; +} DEAL_II_NAMESPACE_CLOSE diff --git a/include/deal.II/lac/linear_operator.h b/include/deal.II/lac/linear_operator.h index e25adfde10..f0a517fc33 100644 --- a/include/deal.II/lac/linear_operator.h +++ b/include/deal.II/lac/linear_operator.h @@ -718,62 +718,59 @@ block_linop(const std::arrayRange::reinit() with the result of - * Matrix::m(). This class is specialized for more complicated - * data structures, such as TrilinosWrappers::MPI::Vector, etc. - */ -template -class ReinitRangeFactory +namespace internal { -public: - - template - std::function - operator()(const Matrix &matrix) + /* + * A factory class that is responsible for the creation of a + * reinit_range_vector object for a given pair of vector type Range and matrix + * type Matrix. + * + * The generic version of this class just calls + * Range::reinit() with the result of + * Matrix::m(). This class is specialized for more complicated + * data structures, such as TrilinosWrappers::MPI::Vector, etc. + */ + template + class ReinitRangeFactory { - return [&matrix](Range &v, bool fast) + public: + template + std::function + operator()(const Matrix &matrix) { - v.reinit(matrix.m(), fast); - }; - } -}; + return [&matrix](Range &v, bool fast) + { + v.reinit(matrix.m(), fast); + }; + } + }; -/** - * \relates LinearOperator - * - * A factory class that is responsible for the creation of a - * reinit_domain_vector object for a given pair of vector type Domain and - * matrix type Matrix. - * - * The generic version of this class just calls - * Domain::reinit() with the result of - * Matrix::n(). This class is specialized for more complicated - * data structures, such as TrilinosWrappers::MPI::Vector, etc. - */ -template -class ReinitDomainFactory -{ -public: - - template - std::function - operator()(const Matrix &matrix) + /* + * A factory class that is responsible for the creation of a + * reinit_domain_vector object for a given pair of vector type Domain and + * matrix type Matrix. + * + * The generic version of this class just calls + * Domain::reinit() with the result of + * Matrix::n(). This class is specialized for more complicated + * data structures, such as TrilinosWrappers::MPI::Vector, etc. + */ + template + class ReinitDomainFactory { - return [&matrix](Domain &v, bool fast) + public: + template + std::function + operator()(const Matrix &matrix) { - v.reinit(matrix.n(), fast); - }; - } -}; + return [&matrix](Domain &v, bool fast) + { + v.reinit(matrix.n(), fast); + }; + } + }; +} /* namespace internal */ namespace @@ -813,7 +810,6 @@ namespace class MatrixInterfaceWithVmultAdd { public: - template void operator()(LinearOperator &op, const Matrix &matrix) { @@ -847,7 +843,6 @@ namespace class MatrixInterfaceWithoutVmultAdd { public: - template void operator()(LinearOperator &op, const Matrix &matrix) { @@ -985,10 +980,10 @@ LinearOperator linop(const Exemplar &exemplar, // or an exemplar cannot usually be copied... return_op.reinit_range_vector = - ReinitRangeFactory().operator()(exemplar); + internal::ReinitRangeFactory().operator()(exemplar); return_op.reinit_domain_vector = - ReinitDomainFactory().operator()(exemplar); + internal::ReinitDomainFactory().operator()(exemplar); typename std::conditional< has_vmult_add::type::value, diff --git a/include/deal.II/lac/trilinos_block_vector.h b/include/deal.II/lac/trilinos_block_vector.h index 4b3e2d610b..be7f29cc35 100644 --- a/include/deal.II/lac/trilinos_block_vector.h +++ b/include/deal.II/lac/trilinos_block_vector.h @@ -449,87 +449,52 @@ namespace TrilinosWrappers } /* namespace TrilinosWrappers */ - -/** - * Specialization for TrilinosWrappers::MPI::BlockVector. - */ -template<> -class ReinitRangeFactory -{ -public: - - template - std::function - operator()(const Matrix &matrix) - { - return [&matrix](TrilinosWrappers::MPI::BlockVector &v, bool fast) - { - v.reinit(matrix.range_partitioner(), fast); - }; - } -}; - - -/** - * Specialization for TrilinosWrappers::MPI::BlockVector. - */ -template<> -class ReinitDomainFactory -{ -public: - - template - std::function - operator()(const Matrix &matrix) - { - return [&matrix](TrilinosWrappers::MPI::BlockVector &v, bool fast) - { - v.reinit(matrix.domain_partitioner(), fast); - }; - } -}; +/*@}*/ -/** - * Specialization for TrilinosWrappers::BlockVector. - */ -template<> -class ReinitRangeFactory +namespace internal { -public: + template class ReinitRangeFactory; + template class ReinitDomainFactory; - template - std::function - operator()(const Matrix &matrix) + /* + * A factory class internally used in linear_operator.h. + * Specialization for TrilinosWrappers::BlockVector. + */ + template<> + class ReinitRangeFactory { - return [&matrix](TrilinosWrappers::BlockVector &v, bool fast) + public: + template + std::function + operator()(const Matrix &matrix) { - v.reinit(matrix.range_partitioner(), fast); - }; - } -}; - - -/** - * Specialization for TrilinosWrappers::BlockVector. - */ -template<> -class ReinitDomainFactory -{ -public: + return [&matrix](TrilinosWrappers::BlockVector &v, bool fast) + { + v.reinit(matrix.range_partitioner(), fast); + }; + } + }; - template - std::function - operator()(const Matrix &matrix) + /* + * A factory class internally used in linear_operator.h. + * Specialization for TrilinosWrappers::BlockVector. + */ + template<> + class ReinitDomainFactory { - return [&matrix](TrilinosWrappers::BlockVector &v, bool fast) + public: + template + std::function + operator()(const Matrix &matrix) { - v.reinit(matrix.domain_partitioner(), fast); - }; - } -}; - -/*@}*/ + return [&matrix](TrilinosWrappers::BlockVector &v, bool fast) + { + v.reinit(matrix.domain_partitioner(), fast); + }; + } + }; +} /* namespace internal */ DEAL_II_NAMESPACE_CLOSE diff --git a/include/deal.II/lac/trilinos_parallel_block_vector.h b/include/deal.II/lac/trilinos_parallel_block_vector.h index dc3ac1ca75..b2fe52a8f9 100644 --- a/include/deal.II/lac/trilinos_parallel_block_vector.h +++ b/include/deal.II/lac/trilinos_parallel_block_vector.h @@ -460,12 +460,58 @@ namespace TrilinosWrappers u.swap (v); } - } /* end of namespace MPI */ + } /* namespace MPI */ -} +} /* namespace TrilinosWrappers */ /*@}*/ +namespace internal +{ + template class ReinitRangeFactory; + template class ReinitDomainFactory; + + /* + * A factory class internally used in linear_operator.h. + * Specialization for TrilinosWrappers::MPI::BlockVector. + */ + template<> + class ReinitRangeFactory + { + public: + template + std::function + operator()(const Matrix &matrix) + { + return [&matrix](TrilinosWrappers::MPI::BlockVector &v, bool fast) + { + v.reinit(matrix.range_partitioner(), fast); + }; + } + }; + + /* + * A factory class internally used in linear_operator.h. + * Specialization for TrilinosWrappers::MPI::BlockVector. + */ + template<> + class ReinitDomainFactory + { + public: + template + std::function + operator()(const Matrix &matrix) + { + return [&matrix](TrilinosWrappers::MPI::BlockVector &v, bool fast) + { + v.reinit(matrix.domain_partitioner(), fast); + }; + } + }; +} /* namespace internal */ + + + DEAL_II_NAMESPACE_CLOSE #endif // DEAL_II_WITH_TRILINOS diff --git a/include/deal.II/lac/trilinos_vector.h b/include/deal.II/lac/trilinos_vector.h index f4d252ed41..8868c1df11 100644 --- a/include/deal.II/lac/trilinos_vector.h +++ b/include/deal.II/lac/trilinos_vector.h @@ -40,9 +40,6 @@ DEAL_II_NAMESPACE_OPEN // forward declaration template class Vector; -template class ReinitRangeFactory; -template class ReinitDomainFactory; - /** * @addtogroup TrilinosWrappers * @{ @@ -938,91 +935,93 @@ namespace TrilinosWrappers #endif - } /* namespace TrilinosWrappers */ +/*@}*/ -/** - * Specialization for TrilinosWrappers::MPI::Vector. - */ -template<> -class ReinitRangeFactory + +namespace internal { -public: + template class ReinitRangeFactory; + template class ReinitDomainFactory; - template - std::function - operator()(const Matrix &matrix) + /* + * A factory class internally used in linear_operator.h. + * Specialization for TrilinosWrappers::MPI::Vector. + */ + template<> + class ReinitRangeFactory { - return [&matrix](TrilinosWrappers::MPI::Vector &v, bool fast) + public: + template + std::function + operator()(const Matrix &matrix) { - v.reinit(matrix.range_partitioner(), fast); - }; - } -}; - - -/** - * Specialization for TrilinosWrappers::MPI::Vector. - */ -template<> -class ReinitDomainFactory -{ -public: + return [&matrix](TrilinosWrappers::MPI::Vector &v, bool fast) + { + v.reinit(matrix.range_partitioner(), fast); + }; + } + }; - template - std::function - operator()(const Matrix &matrix) + /* + * A factory class internally used in linear_operator.h. + * Specialization for TrilinosWrappers::MPI::Vector. + */ + template<> + class ReinitDomainFactory { - return [&matrix](TrilinosWrappers::MPI::Vector &v, bool fast) + public: + template + std::function + operator()(const Matrix &matrix) { - v.reinit(matrix.domain_partitioner(), fast); - }; - } -}; - - -/** - * Specialization for TrilinosWrappers::MPI::Vector. - */ -template<> -class ReinitRangeFactory -{ -public: + return [&matrix](TrilinosWrappers::MPI::Vector &v, bool fast) + { + v.reinit(matrix.domain_partitioner(), fast); + }; + } + }; - template - std::function - operator()(const Matrix &matrix) + /* + * A factory class internally used in linear_operator.h. + * Specialization for TrilinosWrappers::MPI::Vector. + */ + template<> + class ReinitRangeFactory { - return [&matrix](TrilinosWrappers::Vector &v, bool fast) + public: + template + std::function + operator()(const Matrix &matrix) { - v.reinit(matrix.range_partitioner(), fast); - }; - } -}; - - -/** - * Specialization for TrilinosWrappers::MPI::Vector. - */ -template<> -class ReinitDomainFactory -{ -public: + return [&matrix](TrilinosWrappers::Vector &v, bool fast) + { + v.reinit(matrix.range_partitioner(), fast); + }; + } + }; - template - std::function - operator()(const Matrix &matrix) + /* + * A factory class internally used in linear_operator.h. + * Specialization for TrilinosWrappers::MPI::Vector. + */ + template<> + class ReinitDomainFactory { - return [&matrix](TrilinosWrappers::Vector &v, bool fast) + public: + template + std::function + operator()(const Matrix &matrix) { - v.reinit(matrix.domain_partitioner(), fast); - }; - } -}; - + return [&matrix](TrilinosWrappers::Vector &v, bool fast) + { + v.reinit(matrix.domain_partitioner(), fast); + }; + } + }; +} /* namespace internal */ -/*@}*/ DEAL_II_NAMESPACE_CLOSE