|
Reference documentation for deal.II version 9.2.0
|
\(\newcommand{\dealvcentcolon}{\mathrel{\mathop{:}}}\)
\(\newcommand{\dealcoloneq}{\dealvcentcolon\mathrel{\mkern-1.2mu}=}\)
\(\newcommand{\jump}[1]{\left[\!\left[ #1 \right]\!\right]}\)
\(\newcommand{\average}[1]{\left\{\!\left\{ #1 \right\}\!\right\}}\)
Go to the documentation of this file.
16 #ifndef dealii_mg_smoother_h
17 #define dealii_mg_smoother_h
49 template <
typename VectorType>
141 template <
typename VectorType>
189 template <
class RelaxationType,
typename VectorType>
210 template <
typename MatrixType2>
213 const typename RelaxationType::AdditionalData &additional_data =
214 typename RelaxationType::AdditionalData());
223 template <
typename MatrixType2,
class DATA>
302 template <
typename MatrixType,
class RelaxationType,
typename VectorType>
322 template <
typename MatrixType2>
325 const typename RelaxationType::AdditionalData &additional_data =
326 typename RelaxationType::AdditionalData());
336 template <
typename MatrixType2,
class DATA>
350 template <
typename MatrixType2,
class DATA>
353 const DATA & additional_data,
354 const unsigned int block_row,
355 const unsigned int block_col);
366 template <
typename MatrixType2,
class DATA>
370 const unsigned int block_row,
371 const unsigned int block_col);
454 template <
typename MatrixType,
typename PreconditionerType,
typename VectorType>
475 template <
typename MatrixType2>
478 const typename PreconditionerType::AdditionalData &
479 additional_data =
typename PreconditionerType::AdditionalData());
490 template <
typename MatrixType2,
class DATA>
505 template <
typename MatrixType2,
class DATA>
508 const DATA & additional_data,
509 const unsigned int block_row,
510 const unsigned int block_col);
522 template <
typename MatrixType2,
class DATA>
526 const unsigned int block_row,
527 const unsigned int block_col);
589 template <
typename VectorType>
596 template <
typename VectorType>
603 template <
typename VectorType>
616 template <
typename VectorType>
624 template <
typename VectorType>
632 template <
typename VectorType>
640 template <
typename VectorType>
648 template <
typename VectorType>
659 template <
class RelaxationType,
typename VectorType>
661 const unsigned int steps,
669 template <
class RelaxationType,
typename VectorType>
671 SmootherRelaxation<RelaxationType, VectorType>::clear()
677 template <
class RelaxationType,
typename VectorType>
678 template <
typename MatrixType2>
680 SmootherRelaxation<RelaxationType, VectorType>::initialize(
682 const typename RelaxationType::AdditionalData &data)
689 for (
unsigned int i =
min; i <=
max; ++i)
690 (*
this)[i].initialize(m[i], data);
694 template <
class RelaxationType,
typename VectorType>
695 template <
typename MatrixType2,
class DATA>
697 SmootherRelaxation<RelaxationType, VectorType>::initialize(
706 for (
unsigned int i =
min; i <=
max; ++i)
707 (*
this)[i].initialize(m[i], data[i]);
711 template <
class RelaxationType,
typename VectorType>
713 SmootherRelaxation<RelaxationType, VectorType>::smooth(
714 const unsigned int level,
718 unsigned int maxlevel = this->max_level();
719 unsigned int steps2 = this->steps;
722 steps2 *= (1 << (maxlevel -
level));
725 if (this->
symmetric && (steps2 % 2 == 0))
730 for (
unsigned int i = 0; i < steps2; ++i)
733 (*this)[
level].Tstep(u, rhs);
735 (*
this)[
level].step(u, rhs);
742 template <
class RelaxationType,
typename VectorType>
745 const unsigned int level,
749 unsigned int maxlevel = this->max_level();
750 unsigned int steps2 = this->steps;
753 steps2 *= (1 << (maxlevel -
level));
756 if (this->
symmetric && (steps2 % 2 == 0))
762 (*this)[
level].Tvmult(u, rhs);
764 (*
this)[
level].vmult(u, rhs);
767 for (
unsigned int i = 1; i < steps2; ++i)
770 (*this)[
level].Tstep(u, rhs);
772 (*
this)[
level].step(u, rhs);
779 template <
class RelaxationType,
typename VectorType>
792 template <
typename MatrixType,
class RelaxationType,
typename VectorType>
803 template <
typename MatrixType,
class RelaxationType,
typename VectorType>
807 smoothers.clear_elements();
809 unsigned int i = matrices.min_level(), max_level = matrices.max_level();
810 for (; i <= max_level; ++i)
815 template <
typename MatrixType,
class RelaxationType,
typename VectorType>
816 template <
typename MatrixType2>
820 const typename RelaxationType::AdditionalData &data)
825 matrices.resize(
min,
max);
826 smoothers.resize(
min,
max);
828 for (
unsigned int i =
min; i <=
max; ++i)
835 smoothers[i].initialize(m[i], data);
839 template <
typename MatrixType,
class RelaxationType,
typename VectorType>
840 template <
typename MatrixType2,
class DATA>
852 matrices.resize(
min,
max);
853 smoothers.resize(
min,
max);
855 for (
unsigned int i =
min; i <=
max; ++i)
862 smoothers[i].initialize(m[i], data[i]);
866 template <
typename MatrixType,
class RelaxationType,
typename VectorType>
867 template <
typename MatrixType2,
class DATA>
872 const unsigned int row,
873 const unsigned int col)
878 matrices.resize(
min,
max);
879 smoothers.resize(
min,
max);
881 for (
unsigned int i =
min; i <=
max; ++i)
887 m[i].block(row, col));
888 smoothers[i].initialize(m[i].block(row, col), data);
892 template <
typename MatrixType,
class RelaxationType,
typename VectorType>
893 template <
typename MatrixType2,
class DATA>
898 const unsigned int row,
899 const unsigned int col)
907 matrices.resize(
min,
max);
908 smoothers.resize(
min,
max);
910 for (
unsigned int i =
min; i <=
max; ++i)
916 m[i].block(row, col));
917 smoothers[i].initialize(m[i].block(row, col), data[i]);
922 template <
typename MatrixType,
class RelaxationType,
typename VectorType>
925 const unsigned int level,
929 unsigned int maxlevel = smoothers.max_level();
930 unsigned int steps2 = this->steps;
933 steps2 *= (1 << (maxlevel -
level));
936 if (this->
symmetric && (steps2 % 2 == 0))
941 for (
unsigned int i = 0; i < steps2; ++i)
944 smoothers[
level].Tstep(u, rhs);
946 smoothers[
level].step(u, rhs);
953 template <
typename MatrixType,
class RelaxationType,
typename VectorType>
956 const unsigned int level,
960 unsigned int maxlevel = smoothers.max_level();
961 unsigned int steps2 = this->steps;
964 steps2 *= (1 << (maxlevel -
level));
967 if (this->
symmetric && (steps2 % 2 == 0))
973 smoothers[
level].Tvmult(u, rhs);
975 smoothers[
level].vmult(u, rhs);
978 for (
unsigned int i = 1; i < steps2; ++i)
981 smoothers[
level].Tstep(u, rhs);
983 smoothers[
level].step(u, rhs);
991 template <
typename MatrixType,
class RelaxationType,
typename VectorType>
996 return sizeof(*this) + matrices.memory_consumption() +
997 smoothers.memory_consumption() +
998 this->vector_memory.memory_consumption();
1004 template <
typename MatrixType,
typename PreconditionerType,
typename VectorType>
1007 const bool variable,
1015 template <
typename MatrixType,
typename PreconditionerType,
typename VectorType>
1019 smoothers.clear_elements();
1021 unsigned int i = matrices.min_level(), max_level = matrices.max_level();
1022 for (; i <= max_level; ++i)
1028 template <
typename MatrixType,
typename PreconditionerType,
typename VectorType>
1029 template <
typename MatrixType2>
1033 const typename PreconditionerType::AdditionalData &data)
1038 matrices.resize(
min,
max);
1039 smoothers.resize(
min,
max);
1041 for (
unsigned int i =
min; i <=
max; ++i)
1048 smoothers[i].initialize(m[i], data);
1054 template <
typename MatrixType,
typename PreconditionerType,
typename VectorType>
1055 template <
typename MatrixType2,
class DATA>
1067 matrices.resize(
min,
max);
1068 smoothers.resize(
min,
max);
1070 for (
unsigned int i =
min; i <=
max; ++i)
1077 smoothers[i].initialize(m[i], data[i]);
1083 template <
typename MatrixType,
typename PreconditionerType,
typename VectorType>
1084 template <
typename MatrixType2,
class DATA>
1089 const unsigned int row,
1090 const unsigned int col)
1095 matrices.resize(
min,
max);
1096 smoothers.resize(
min,
max);
1098 for (
unsigned int i =
min; i <=
max; ++i)
1100 matrices[i] = &(m[i].block(row, col));
1101 smoothers[i].initialize(m[i].block(row, col), data);
1107 template <
typename MatrixType,
typename PreconditionerType,
typename VectorType>
1108 template <
typename MatrixType2,
class DATA>
1113 const unsigned int row,
1114 const unsigned int col)
1122 matrices.resize(
min,
max);
1123 smoothers.resize(
min,
max);
1125 for (
unsigned int i =
min; i <=
max; ++i)
1127 matrices[i] = &(m[i].block(row, col));
1128 smoothers[i].initialize(m[i].block(row, col), data[i]);
1134 template <
typename MatrixType,
typename PreconditionerType,
typename VectorType>
1137 const unsigned int level,
1141 unsigned int maxlevel = matrices.max_level();
1142 unsigned int steps2 = this->steps;
1145 steps2 *= (1 << (maxlevel -
level));
1154 if (this->
symmetric && (steps2 % 2 == 0))
1156 if (this->debug > 0)
1159 for (
unsigned int i = 0; i < steps2; ++i)
1163 if (this->debug > 0)
1165 matrices[
level].Tvmult(*r, u);
1166 r->sadd(-1., 1., rhs);
1167 if (this->debug > 2)
1168 deallog <<
' ' << r->l2_norm() <<
' ';
1169 smoothers[
level].Tvmult(*
d, *r);
1170 if (this->debug > 1)
1171 deallog <<
' ' <<
d->l2_norm() <<
' ';
1175 if (this->debug > 0)
1177 matrices[
level].vmult(*r, u);
1179 if (this->debug > 2)
1180 deallog <<
' ' << r->l2_norm() <<
' ';
1181 smoothers[
level].vmult(*
d, *r);
1182 if (this->debug > 1)
1183 deallog <<
' ' <<
d->l2_norm() <<
' ';
1189 if (this->debug > 0)
1195 template <
typename MatrixType,
typename PreconditionerType,
typename VectorType>
1198 const unsigned int level,
1202 unsigned int maxlevel = matrices.max_level();
1203 unsigned int steps2 = this->steps;
1206 steps2 *= (1 << (maxlevel -
level));
1209 if (this->
symmetric && (steps2 % 2 == 0))
1211 if (this->debug > 0)
1215 if (this->debug > 2)
1216 deallog <<
' ' << rhs.l2_norm() <<
' ';
1217 if (this->debug > 0)
1220 smoothers[
level].Tvmult(u, rhs);
1222 smoothers[
level].vmult(u, rhs);
1223 if (this->debug > 1)
1224 deallog <<
' ' << u.l2_norm() <<
' ';
1237 for (
unsigned int i = 1; i < steps2; ++i)
1241 if (this->debug > 0)
1243 matrices[
level].Tvmult(*r, u);
1244 r->sadd(-1., 1., rhs);
1245 if (this->debug > 2)
1246 deallog <<
' ' << r->l2_norm() <<
' ';
1247 smoothers[
level].Tvmult(*
d, *r);
1248 if (this->debug > 1)
1249 deallog <<
' ' <<
d->l2_norm() <<
' ';
1253 if (this->debug > 0)
1255 matrices[
level].vmult(*r, u);
1257 if (this->debug > 2)
1258 deallog <<
' ' << r->l2_norm() <<
' ';
1259 smoothers[
level].vmult(*
d, *r);
1260 if (this->debug > 1)
1261 deallog <<
' ' <<
d->l2_norm() <<
' ';
1267 if (this->debug > 0)
1273 template <
typename MatrixType,
typename PreconditionerType,
typename VectorType>
1278 return sizeof(*this) + matrices.memory_consumption() +
1279 smoothers.memory_consumption() +
1280 this->vector_memory.memory_consumption();
virtual void smooth(const unsigned int level, VectorType &u, const VectorType &rhs) const override
MGSmootherPrecondition(const unsigned int steps=1, const bool variable=false, const bool symmetric=false, const bool transpose=false)
unsigned int max_level() const
unsigned int min_level() const
VectorizedArray< Number, width > max(const ::VectorizedArray< Number, width > &x, const ::VectorizedArray< Number, width > &y)
VectorizedArray< Number, width > min(const ::VectorizedArray< Number, width > &x, const ::VectorizedArray< Number, width > &y)
std::size_t memory_consumption() const
MGLevelObject< LinearOperator< VectorType > > matrices
virtual void apply(const unsigned int level, VectorType &u, const VectorType &rhs) const
SymmetricTensor< 2, dim, Number > d(const Tensor< 2, dim, Number > &F, const Tensor< 2, dim, Number > &dF_dt)
void set_variable(const bool)
void set_debug(const unsigned int level)
MGLevelObject< LinearOperator< VectorType > > matrices
GrowingVectorMemory< VectorType > vector_memory
void set_symmetric(const bool)
void initialize(const MGLevelObject< MatrixType2 > &matrices, const typename PreconditionerType::AdditionalData &additional_data=typename PreconditionerType::AdditionalData())
void initialize(const MGLevelObject< MatrixType2 > &matrices, const typename RelaxationType::AdditionalData &additional_data=typename RelaxationType::AdditionalData())
@ symmetric
Matrix is symmetric.
virtual void smooth(const unsigned int level, VectorType &u, const VectorType &rhs) const
void set_steps(const unsigned int)
#define DEAL_II_NAMESPACE_OPEN
std::size_t memory_consumption() const
std::enable_if< std::is_fundamental< T >::value, std::size_t >::type memory_consumption(const T &t)
auto apply(F &&fn, Tuple &&t) -> decltype(apply_impl(std::forward< F >(fn), std::forward< Tuple >(t), std_cxx14::make_index_sequence< std::tuple_size< typename std::remove_reference< Tuple >::type >::value >()))
MGLevelObject< PreconditionerType > smoothers
void initialize(const MGLevelObject< MatrixType2 > &matrices, const typename RelaxationType::AdditionalData &additional_data=typename RelaxationType::AdditionalData())
MGLevelObject< RelaxationType > smoothers
virtual void smooth(const unsigned int level, VectorType &u, const VectorType &rhs) const
#define Assert(cond, exc)
void set_transpose(const bool)
std::size_t memory_consumption() const
std::size_t memory_consumption() const
virtual void apply(const unsigned int level, VectorType &u, const VectorType &rhs) const override
T min(const T &t, const MPI_Comm &mpi_communicator)
static ::ExceptionBase & ExcDimensionMismatch(std::size_t arg1, std::size_t arg2)
virtual void apply(const unsigned int level, VectorType &u, const VectorType &rhs) const override
MGSmoother(const unsigned int steps=1, const bool variable=false, const bool symmetric=false, const bool transpose=false)
MGSmootherRelaxation(const unsigned int steps=1, const bool variable=false, const bool symmetric=false, const bool transpose=false)
SmootherRelaxation(const unsigned int steps=1, const bool variable=false, const bool symmetric=false, const bool transpose=false)
#define DEAL_II_NAMESPACE_CLOSE
virtual void smooth(const unsigned int level, VectorType &u, const VectorType &rhs) const override
T max(const T &t, const MPI_Comm &mpi_communicator)