dune-istl  2.2.1
construction.hh
Go to the documentation of this file.
1 // $Id: construction.hh 1446 2011-01-24 11:55:06Z mblatt $
2 #ifndef DUNE_AMGCONSTRUCTION_HH
3 #define DUNE_AMGCONSTRUCTION_HH
4 
5 #include<dune/istl/bvector.hh>
9 #include"pinfo.hh"
10 
11 namespace Dune
12 {
13  namespace Amg
14  {
15 
34  template<typename T>
35  class ConstructionTraits
36  {
37  public:
42  typedef const void* Arguments;
43 
50  static inline T* construct(Arguments& args)
51  {
52  return new T();
53  }
54 
59  static inline void deconstruct(T* t)
60  {
61  delete t;
62  }
63 
64  };
65 
66  template<class T>
68  {
69  public:
70  typedef const int Arguments;
71  static inline BlockVector<T>* construct(Arguments& n)
72  {
73  return new BlockVector<T>(n);
74  }
75 
76  static inline void deconstruct(BlockVector<T>* t)
77  {
78  delete t;
79  }
80  };
81 
82  template<class M, class C>
84  {
85  OverlappingSchwarzOperatorArgs(M& matrix, C& comm)
86  : matrix_(&matrix), comm_(&comm)
87  {}
88 
89  M* matrix_;
90  C* comm_;
91  };
92 
93  template<class M, class C>
95  {
96  NonoverlappingOperatorArgs(M& matrix, C& comm)
97  : matrix_(&matrix), comm_(&comm)
98  {}
99 
101  C* comm_;
102  };
103 
104 #if HAVE_MPI
106  {
108  : comm_(comm), cat_(cat)
109  {}
110 
111  MPI_Comm comm_;
113  };
114 #endif
115 
117  {
118  SequentialCommunicationArgs(CollectiveCommunication<void*> comm, int cat)
119  : comm_(comm)
120  {}
121 
122  CollectiveCommunication<void*> comm_;
123  };
124 
125  }// end Amg namspace
126 
127  // foward declaration
128  template<class M, class X, class Y, class C>
130 
131  template<class M, class X, class Y, class C>
133 
134  namespace Amg
135  {
136  template<class M, class X, class Y, class C>
138  {
139  public:
141 
143  {
144  return new OverlappingSchwarzOperator<M,X,Y,C>(*args.matrix_, *args.comm_);
145  }
146 
148  {
149  delete t;
150  }
151  };
152 
153  template<class M, class X, class Y, class C>
155  {
156  public:
158 
160  {
161  return new NonoverlappingSchwarzOperator<M,X,Y,C>(*args.matrix_, *args.comm_);
162  }
163 
165  {
166  delete t;
167  }
168  };
169 
170  template<class M, class X, class Y>
172  {
174  : matrix_(&matrix)
175  {}
176 
178  };
179 
180  template<class M, class X, class Y>
182  {
183  public:
185 
187  {
188  return new MatrixAdapter<M,X,Y>(*args.matrix_);
189  }
190 
191  static inline void deconstruct(MatrixAdapter<M,X,Y>* m)
192  {
193  delete m;
194  }
195  };
196 
197  template<>
199  {
200  public:
203  {
204  return new SequentialInformation(args.comm_);
205  }
206 
207  static inline void deconstruct(SequentialInformation* si)
208  {
209  delete si;
210  }
211  };
212 
213 
214 #if HAVE_MPI
215 
216  template<class T1, class T2>
218  {
219  public:
221 
223  {
224  return new OwnerOverlapCopyCommunication<T1,T2>(args.comm_, args.cat_);
225  }
226 
228  {
229  delete com;
230  }
231  };
232 
233 #endif
234 
236 } // namespace Amg
237 } // namespace Dune
238 #endif