Reference documentation for deal.II version 9.1.0-pre
affine_constraints.cc
1 // ---------------------------------------------------------------------
2 //
3 // Copyright (C) 1998 - 2018 by the deal.II authors
4 //
5 // This file is part of the deal.II library.
6 //
7 // The deal.II library is free software; you can use it, redistribute
8 // it, and/or modify it under the terms of the GNU Lesser General
9 // Public License as published by the Free Software Foundation; either
10 // version 2.1 of the License, or (at your option) any later version.
11 // The full text of the license can be found in the file LICENSE.md at
12 // the top level directory of deal.II.
13 //
14 // ---------------------------------------------------------------------
15 
16 #include <deal.II/lac/affine_constraints.h>
17 #include <deal.II/lac/affine_constraints.templates.h>
18 
19 
20 DEAL_II_NAMESPACE_OPEN
21 
22 #include "affine_constraints.inst"
23 
24 /*
25  * Note: You probably do not want to add your custom instantiation down
26  * here but use affine_constraints.inst.in instead. We use the following
27  * three macros for PETSc and Trilinos types because we lack a mechanism
28  * for iterating over two "zipped" lists (we have to match trilinos/petsc
29  * matrix and vector types).
30  */
31 
32 #define INSTANTIATE_DLTG_VECTOR(VectorType) \
33  template void AffineConstraints<VectorType::value_type>::condense< \
34  VectorType>(const VectorType &, VectorType &) const; \
35  template void \
36  AffineConstraints<VectorType::value_type>::condense<VectorType>( \
37  VectorType &) const; \
38  template void \
39  AffineConstraints<VectorType::value_type>::distribute_local_to_global< \
40  VectorType>( \
41  const Vector<VectorType::value_type> &, \
42  const std::vector<AffineConstraints<VectorType::value_type>::size_type> &, \
43  VectorType &, \
44  const FullMatrix<VectorType::value_type> &) const; \
45  template void \
46  AffineConstraints<VectorType::value_type>::distribute_local_to_global< \
47  VectorType>( \
48  const Vector<VectorType::value_type> &, \
49  const std::vector<AffineConstraints<VectorType::value_type>::size_type> &, \
50  const std::vector<AffineConstraints<VectorType::value_type>::size_type> &, \
51  VectorType &, \
52  const FullMatrix<VectorType::value_type> &, \
53  bool) const
54 
55 #define INSTANTIATE_DLTG_VECTORMATRIX(MatrixType, VectorType) \
56  template void AffineConstraints<MatrixType::value_type>:: \
57  distribute_local_to_global<MatrixType, VectorType>( \
58  const FullMatrix<MatrixType::value_type> &, \
59  const Vector<VectorType::value_type> &, \
60  const std::vector<AffineConstraints::size_type> &, \
61  MatrixType &, \
62  VectorType &, \
63  bool, \
64  std::integral_constant<bool, false>) const
65 
66 #define INSTANTIATE_DLTG_BLOCK_VECTORMATRIX(MatrixType, VectorType) \
67  template void AffineConstraints<MatrixType::value_type>:: \
68  distribute_local_to_global<MatrixType, VectorType>( \
69  const FullMatrix<MatrixType::value_type> &, \
70  const Vector<VectorType::value_type> &, \
71  const std::vector<AffineConstraints::size_type> &, \
72  MatrixType &, \
73  VectorType &, \
74  bool, \
75  std::integral_constant<bool, true>) const
76 
77 #define INSTANTIATE_DLTG_MATRIX(MatrixType) \
78  template void \
79  AffineConstraints<MatrixType::value_type>::distribute_local_to_global< \
80  MatrixType>(const FullMatrix<MatrixType::value_type> &, \
81  const std::vector<AffineConstraints::size_type> &, \
82  const std::vector<AffineConstraints::size_type> &, \
83  MatrixType &) const; \
84  template void \
85  AffineConstraints<MatrixType::value_type>::distribute_local_to_global< \
86  MatrixType>(const FullMatrix<MatrixType::value_type> &, \
87  const std::vector<AffineConstraints::size_type> &, \
88  const AffineConstraints<MatrixType::value_type> &, \
89  const std::vector<AffineConstraints::size_type> &, \
90  MatrixType &) const
91 
92 #ifdef DEAL_II_WITH_PETSC
93 INSTANTIATE_DLTG_VECTOR(PETScWrappers::MPI::Vector);
94 INSTANTIATE_DLTG_VECTOR(PETScWrappers::MPI::BlockVector);
95 
96 INSTANTIATE_DLTG_VECTORMATRIX(PETScWrappers::SparseMatrix, Vector<PetscScalar>);
97 INSTANTIATE_DLTG_VECTORMATRIX(PETScWrappers::SparseMatrix,
99 INSTANTIATE_DLTG_VECTORMATRIX(PETScWrappers::MPI::SparseMatrix,
100  Vector<PetscScalar>);
101 INSTANTIATE_DLTG_VECTORMATRIX(PETScWrappers::MPI::SparseMatrix,
103 
104 INSTANTIATE_DLTG_BLOCK_VECTORMATRIX(PETScWrappers::MPI::BlockSparseMatrix,
105  Vector<PetscScalar>);
106 INSTANTIATE_DLTG_BLOCK_VECTORMATRIX(PETScWrappers::MPI::BlockSparseMatrix,
108 
109 INSTANTIATE_DLTG_MATRIX(PETScWrappers::SparseMatrix);
110 INSTANTIATE_DLTG_MATRIX(PETScWrappers::MPI::SparseMatrix);
111 INSTANTIATE_DLTG_MATRIX(PETScWrappers::MPI::BlockSparseMatrix);
112 #endif
113 
114 #ifdef DEAL_II_WITH_TRILINOS
115 INSTANTIATE_DLTG_VECTOR(TrilinosWrappers::MPI::Vector);
116 
117 INSTANTIATE_DLTG_VECTORMATRIX(TrilinosWrappers::SparseMatrix, Vector<double>);
118 INSTANTIATE_DLTG_VECTORMATRIX(TrilinosWrappers::SparseMatrix,
120 
121 INSTANTIATE_DLTG_BLOCK_VECTORMATRIX(TrilinosWrappers::BlockSparseMatrix,
123 INSTANTIATE_DLTG_BLOCK_VECTORMATRIX(TrilinosWrappers::BlockSparseMatrix,
125 
126 INSTANTIATE_DLTG_MATRIX(TrilinosWrappers::SparseMatrix);
127 INSTANTIATE_DLTG_MATRIX(TrilinosWrappers::BlockSparseMatrix);
128 #endif
129 
130 /*
131  * Allocate scratch data.
132  *
133  * We cannot use the generic template instantiation because we need to
134  * provide an initializer object of type
135  * internals::AffineConstraintsData<Number> that can be passed to the
136  * constructor of scratch_data (it won't allow one to be constructed in
137  * place).
138  */
139 
140 namespace internals
141 {
142 #define SCRATCH_INITIALIZER(number, Name) \
143  AffineConstraintsData<number>::ScratchData scratch_data_initializer_##Name; \
144  template <> \
145  Threads::ThreadLocalStorage<AffineConstraintsData<number>::ScratchData> \
146  AffineConstraintsData<number>::scratch_data( \
147  scratch_data_initializer_##Name)
148 
149  SCRATCH_INITIALIZER(double, d);
150  SCRATCH_INITIALIZER(float, f);
151  SCRATCH_INITIALIZER(std::complex<double>, cd);
152  SCRATCH_INITIALIZER(std::complex<float>, cf);
153 #undef SCRATCH_INITIALIZER
154 } // namespace internals
155 
156 DEAL_II_NAMESPACE_CLOSE