dune-istl  2.3beta2
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>
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