dune-istl  2.6-git
construction.hh
Go to the documentation of this file.
1 // -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
2 // vi: set et ts=4 sw=2 sts=2:
3 #ifndef DUNE_AMGCONSTRUCTION_HH
4 #define DUNE_AMGCONSTRUCTION_HH
5 
6 #include <dune/common/unused.hh>
7 #include <dune/istl/bvector.hh>
8 #include <dune/istl/operators.hh>
11 #include "pinfo.hh"
12 
13 namespace Dune
14 {
15  namespace Amg
16  {
17 
36  template<typename T>
37  class ConstructionTraits
38  {
39  public:
44  typedef const void* Arguments;
45 
52  static inline T* construct(Arguments& args)
53  {
54  return new T();
55  }
56 
61  static inline void deconstruct(T* t)
62  {
63  delete t;
64  }
65 
66  };
67 
68  template<class T, class A>
70  {
71  public:
72  typedef const int Arguments;
73  static inline BlockVector<T,A>* construct(Arguments& n)
74  {
75  return new BlockVector<T,A>(n);
76  }
77 
78  static inline void deconstruct(BlockVector<T,A>* t)
79  {
80  delete t;
81  }
82  };
83 
84  template<class M, class C>
86  {
87  OverlappingSchwarzOperatorArgs(M& matrix, C& comm)
88  : matrix_(&matrix), comm_(&comm)
89  {}
90 
91  M* matrix_;
92  C* comm_;
93  };
94 
95  template<class M, class C>
97  {
98  NonoverlappingOperatorArgs(M& matrix, C& comm)
99  : matrix_(&matrix), comm_(&comm)
100  {}
101 
103  C* comm_;
104  };
105 
106 #if HAVE_MPI
108  {
110  : comm_(comm), cat_(cat)
111  {}
112 
113  MPI_Comm comm_;
115  };
116 #endif
117 
119  {
120  SequentialCommunicationArgs(CollectiveCommunication<void*> comm, int cat)
121  : comm_(comm)
122  {
123  DUNE_UNUSED_PARAMETER(cat);
124  }
125 
126  CollectiveCommunication<void*> comm_;
127  };
128 
129  } // end Amg namspace
130 
131  // forward declaration
132  template<class M, class X, class Y, class C>
134 
135  template<class M, class X, class Y, class C>
137 
138  namespace Amg
139  {
140  template<class M, class X, class Y, class C>
142  {
143  public:
145 
146  static inline OverlappingSchwarzOperator<M,X,Y,C>* construct(const Arguments& args)
147  {
148  return new OverlappingSchwarzOperator<M,X,Y,C>(*args.matrix_, *args.comm_);
149  }
150 
152  {
153  delete t;
154  }
155  };
156 
157  template<class M, class X, class Y, class C>
159  {
160  public:
162 
163  static inline NonoverlappingSchwarzOperator<M,X,Y,C>* construct(const Arguments& args)
164  {
165  return new NonoverlappingSchwarzOperator<M,X,Y,C>(*args.matrix_, *args.comm_);
166  }
167 
169  {
170  delete t;
171  }
172  };
173 
174  template<class M, class X, class Y>
176  {
178  : matrix_(&matrix)
179  {}
180 
182  };
183 
184  template<class M, class X, class Y>
186  {
187  public:
189 
190  static inline MatrixAdapter<M,X,Y>* construct(Arguments& args)
191  {
192  return new MatrixAdapter<M,X,Y>(*args.matrix_);
193  }
194 
195  static inline void deconstruct(MatrixAdapter<M,X,Y>* m)
196  {
197  delete m;
198  }
199  };
200 
201  template<>
203  {
204  public:
206  static inline SequentialInformation* construct(Arguments& args)
207  {
208  return new SequentialInformation(args.comm_);
209  }
210 
211  static inline void deconstruct(SequentialInformation* si)
212  {
213  delete si;
214  }
215  };
216 
217 
218 #if HAVE_MPI
219 
220  template<class T1, class T2>
222  {
223  public:
225 
226  static inline OwnerOverlapCopyCommunication<T1,T2>* construct(Arguments& args)
227  {
228  return new OwnerOverlapCopyCommunication<T1,T2>(args.comm_, args.cat_);
229  }
230 
232  {
233  delete com;
234  }
235  };
236 
237 #endif
238 
240  } // namespace Amg
241 } // namespace Dune
242 #endif
OwnerOverlapCopyCommunicationArgs(MPI_Comm comm, SolverCategory::Category cat)
Definition: construction.hh:109
static void deconstruct(SequentialInformation *si)
Definition: construction.hh:211
const int Arguments
Definition: construction.hh:72
const void * Arguments
A type holding all the arguments needed to call the constructor.
Definition: construction.hh:44
static NonoverlappingSchwarzOperator< M, X, Y, C > * construct(const Arguments &args)
Definition: construction.hh:163
static T * construct(Arguments &args)
Construct an object with the specified arguments.
Definition: construction.hh:52
Definition: allocator.hh:7
MatrixAdapterArgs(M &matrix, const SequentialInformation &)
Definition: construction.hh:177
const SequentialCommunicationArgs Arguments
Definition: construction.hh:205
C * comm_
Definition: construction.hh:92
Traits class for generically constructing non default constructable types.
Definition: novlpschwarz.hh:247
static void deconstruct(OwnerOverlapCopyCommunication< T1, T2 > *com)
Definition: construction.hh:231
static void deconstruct(MatrixAdapter< M, X, Y > *m)
Definition: construction.hh:195
NonoverlappingOperatorArgs(M &matrix, C &comm)
Definition: construction.hh:98
M * matrix_
Definition: construction.hh:91
This file implements a vector space as a tensor product of a given vector space. The number of compon...
static MatrixAdapter< M, X, Y > * construct(Arguments &args)
Definition: construction.hh:190
Definition: construction.hh:118
static OwnerOverlapCopyCommunication< T1, T2 > * construct(Arguments &args)
Definition: construction.hh:226
Definition: construction.hh:85
M * matrix_
Definition: construction.hh:102
SolverCategory::Category cat_
Definition: construction.hh:114
C * comm_
Definition: construction.hh:103
static void deconstruct(OverlappingSchwarzOperator< M, X, Y, C > *t)
Definition: construction.hh:151
static BlockVector< T, A > * construct(Arguments &n)
Definition: construction.hh:73
static void deconstruct(BlockVector< T, A > *t)
Definition: construction.hh:78
const OwnerOverlapCopyCommunicationArgs Arguments
Definition: construction.hh:224
A nonoverlapping operator with communication object.
Definition: novlpschwarz.hh:59
NonoverlappingOperatorArgs< M, C > Arguments
Definition: construction.hh:161
Define general, extensible interface for operators. The available implementation wraps a matrix...
Adapter to turn a matrix into a linear operator.
Definition: operators.hh:133
Definition: construction.hh:107
Definition: pinfo.hh:25
Definition: construction.hh:175
CollectiveCommunication< void * > comm_
Definition: construction.hh:126
An overlapping schwarz operator.
Definition: construction.hh:133
M * matrix_
Definition: construction.hh:181
Category
Definition: solvercategory.hh:21
SequentialCommunicationArgs(CollectiveCommunication< void *> comm, int cat)
Definition: construction.hh:120
Definition: construction.hh:96
static SequentialInformation * construct(Arguments &args)
Definition: construction.hh:206
A class setting up standard communication for a two-valued attribute set with owner/overlap/copy sema...
Definition: owneroverlapcopy.hh:171
A vector of blocks with memory management.
Definition: bvector.hh:316
OverlappingSchwarzOperatorArgs< M, C > Arguments
Definition: construction.hh:144
static void deconstruct(NonoverlappingSchwarzOperator< M, X, Y, C > *t)
Definition: construction.hh:168
Classes providing communication interfaces for overlapping Schwarz methods.
OverlappingSchwarzOperatorArgs(M &matrix, C &comm)
Definition: construction.hh:87
static OverlappingSchwarzOperator< M, X, Y, C > * construct(const Arguments &args)
Definition: construction.hh:146
MPI_Comm comm_
Definition: construction.hh:113
static void deconstruct(T *t)
Destroys an object.
Definition: construction.hh:61
const MatrixAdapterArgs< M, X, Y > Arguments
Definition: construction.hh:188