dune-istl  2.9.0
construction.hh
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (C) DUNE Project contributors, see file LICENSE.md in module root
2 // SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception
3 // -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
4 // vi: set et ts=4 sw=2 sts=2:
5 #ifndef DUNE_AMGCONSTRUCTION_HH
6 #define DUNE_AMGCONSTRUCTION_HH
7 
8 #include <dune/istl/bvector.hh>
9 #include <dune/istl/operators.hh>
12 #include "pinfo.hh"
13 
14 namespace Dune
15 {
16  namespace Amg
17  {
18 
37  template<typename T>
39  {
44  typedef const void* Arguments;
45 
52  static inline std::shared_ptr<T> construct(Arguments& args)
53  {
54  return std::make_shared<T>();
55  }
56  };
57 
58  template<class T, class A>
60  {
61  typedef const int Arguments;
62  static inline std::shared_ptr<BlockVector<T,A>> construct(Arguments& n)
63  {
64  return std::make_shared<BlockVector<T,A>>(n);
65  }
66  };
67 
68  template<class M, class C>
70  {
71  ParallelOperatorArgs(std::shared_ptr<M> matrix, const C& comm)
72  : matrix_(matrix), comm_(comm)
73  {}
74 
75  std::shared_ptr<M> matrix_;
76  const C& comm_;
77  };
78 
79 #if HAVE_MPI
81  {
83  : comm_(comm), cat_(cat)
84  {}
85 
86  MPI_Comm comm_;
88  };
89 #endif
90 
92  {
93  SequentialCommunicationArgs(Communication<void*> comm, [[maybe_unused]] int cat)
94  : comm_(comm)
95  {}
96 
97  Communication<void*> comm_;
98  };
99 
100  } // end Amg namspace
101 
102  // forward declaration
103  template<class M, class X, class Y, class C>
105 
106  template<class M, class X, class Y, class C>
108 
109  namespace Amg
110  {
111  template<class M, class X, class Y, class C>
113  {
115 
116  static inline std::shared_ptr<OverlappingSchwarzOperator<M,X,Y,C>> construct(const Arguments& args)
117  {
118  return std::make_shared<OverlappingSchwarzOperator<M,X,Y,C>>
119  (args.matrix_, args.comm_);
120  }
121  };
122 
123  template<class M, class X, class Y, class C>
125  {
127 
128  static inline std::shared_ptr<NonoverlappingSchwarzOperator<M,X,Y,C>> construct(const Arguments& args)
129  {
130  return std::make_shared<NonoverlappingSchwarzOperator<M,X,Y,C>>
131  (args.matrix_, args.comm_);
132  }
133  };
134 
135  template<class M, class X, class Y>
137  {
138  MatrixAdapterArgs(std::shared_ptr<M> matrix, const SequentialInformation)
139  : matrix_(matrix)
140  {}
141 
142  std::shared_ptr<M> matrix_;
143  };
144 
145  template<class M, class X, class Y>
147  {
149 
150  static inline std::shared_ptr<MatrixAdapter<M,X,Y>> construct(Arguments& args)
151  {
152  return std::make_shared<MatrixAdapter<M,X,Y>>(args.matrix_);
153  }
154  };
155 
156  template<>
158  {
160  static inline std::shared_ptr<SequentialInformation> construct(Arguments& args)
161  {
162  return std::make_shared<SequentialInformation>(args.comm_);
163  }
164  };
165 
166 
167 #if HAVE_MPI
168 
169  template<class T1, class T2>
171  {
173 
174  static inline std::shared_ptr<OwnerOverlapCopyCommunication<T1,T2>> construct(Arguments& args)
175  {
176  return std::make_shared<OwnerOverlapCopyCommunication<T1,T2>>(args.comm_, args.cat_);
177  }
178  };
179 
180 #endif
181 
183  } // namespace Amg
184 } // namespace Dune
185 #endif
This file implements a vector space as a tensor product of a given vector space. The number of compon...
Define general, extensible interface for operators. The available implementation wraps a matrix.
Classes providing communication interfaces for overlapping Schwarz methods.
const int Arguments
Definition: construction.hh:61
SequentialCommunicationArgs(Communication< void * > comm, [[maybe_unused]] int cat)
Definition: construction.hh:93
OwnerOverlapCopyCommunicationArgs(MPI_Comm comm, SolverCategory::Category cat)
Definition: construction.hh:82
MPI_Comm comm_
Definition: construction.hh:86
SolverCategory::Category cat_
Definition: construction.hh:87
const C & comm_
Definition: construction.hh:76
ParallelOperatorArgs(std::shared_ptr< M > matrix, const C &comm)
Definition: construction.hh:71
std::shared_ptr< M > matrix_
Definition: construction.hh:75
static std::shared_ptr< BlockVector< T, A > > construct(Arguments &n)
Definition: construction.hh:62
const void * Arguments
A type holding all the arguments needed to call the constructor.
Definition: construction.hh:44
static std::shared_ptr< T > construct(Arguments &args)
Construct an object with the specified arguments.
Definition: construction.hh:52
Communication< void * > comm_
Definition: construction.hh:97
Definition: allocator.hh:11
A vector of blocks with memory management.
Definition: bvector.hh:395
A nonoverlapping operator with communication object.
Definition: novlpschwarz.hh:61
Traits class for generically constructing non default constructable types.
Definition: construction.hh:39
Adapter to turn a matrix into a linear operator.
Definition: operators.hh:137
A class setting up standard communication for a two-valued attribute set with owner/overlap/copy sema...
Definition: owneroverlapcopy.hh:174
Definition: construction.hh:70
Definition: construction.hh:81
Definition: construction.hh:92
An overlapping Schwarz operator.
Definition: schwarz.hh:75
ParallelOperatorArgs< M, C > Arguments
Definition: construction.hh:114
static std::shared_ptr< OverlappingSchwarzOperator< M, X, Y, C > > construct(const Arguments &args)
Definition: construction.hh:116
ParallelOperatorArgs< M, C > Arguments
Definition: construction.hh:126
static std::shared_ptr< NonoverlappingSchwarzOperator< M, X, Y, C > > construct(const Arguments &args)
Definition: construction.hh:128
Definition: construction.hh:137
MatrixAdapterArgs(std::shared_ptr< M > matrix, const SequentialInformation)
Definition: construction.hh:138
std::shared_ptr< M > matrix_
Definition: construction.hh:142
static std::shared_ptr< MatrixAdapter< M, X, Y > > construct(Arguments &args)
Definition: construction.hh:150
const MatrixAdapterArgs< M, X, Y > Arguments
Definition: construction.hh:148
static std::shared_ptr< SequentialInformation > construct(Arguments &args)
Definition: construction.hh:160
const SequentialCommunicationArgs Arguments
Definition: construction.hh:159
static std::shared_ptr< OwnerOverlapCopyCommunication< T1, T2 > > construct(Arguments &args)
Definition: construction.hh:174
const OwnerOverlapCopyCommunicationArgs Arguments
Definition: construction.hh:172
Definition: pinfo.hh:28
Category
Definition: solvercategory.hh:23