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