dune-istl
2.2.0
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
dune
istl
paamg
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
>
6
#include<
dune/istl/operators.hh
>
7
#include<
dune/istl/owneroverlapcopy.hh
>
8
#include<
dune/istl/solvercategory.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>
67
class
ConstructionTraits
<
BlockVector
<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>
83
struct
OverlappingSchwarzOperatorArgs
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>
94
struct
NonoverlappingOperatorArgs
95
{
96
NonoverlappingOperatorArgs
(M& matrix, C& comm)
97
:
matrix_
(&matrix),
comm_
(&comm)
98
{}
99
100
M*
matrix_
;
101
C*
comm_
;
102
};
103
104
#if HAVE_MPI
105
struct
OwnerOverlapCopyCommunicationArgs
106
{
107
OwnerOverlapCopyCommunicationArgs
(MPI_Comm comm,
SolverCategory::Category
cat)
108
:
comm_
(comm),
cat_
(cat)
109
{}
110
111
MPI_Comm
comm_
;
112
SolverCategory::Category
cat_
;
113
};
114
#endif
115
116
struct
SequentialCommunicationArgs
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>
129
class
OverlappingSchwarzOperator
;
130
131
template
<
class
M,
class
X,
class
Y,
class
C>
132
class
NonoverlappingSchwarzOperator
;
133
134
namespace
Amg
135
{
136
template
<
class
M,
class
X,
class
Y,
class
C>
137
class
ConstructionTraits
<
OverlappingSchwarzOperator
<M,X,Y,C> >
138
{
139
public
:
140
typedef
OverlappingSchwarzOperatorArgs<M,C>
Arguments
;
141
142
static
inline
OverlappingSchwarzOperator<M,X,Y,C>
*
construct
(
const
Arguments
& args)
143
{
144
return
new
OverlappingSchwarzOperator<M,X,Y,C>
(*args.
matrix_
, *args.
comm_
);
145
}
146
147
static
inline
void
deconstruct
(
OverlappingSchwarzOperator<M,X,Y,C>
* t)
148
{
149
delete
t;
150
}
151
};
152
153
template
<
class
M,
class
X,
class
Y,
class
C>
154
class
ConstructionTraits
<
NonoverlappingSchwarzOperator
<M,X,Y,C> >
155
{
156
public
:
157
typedef
NonoverlappingOperatorArgs<M,C>
Arguments
;
158
159
static
inline
NonoverlappingSchwarzOperator<M,X,Y,C>
*
construct
(
const
Arguments
& args)
160
{
161
return
new
NonoverlappingSchwarzOperator<M,X,Y,C>
(*args.
matrix_
, *args.
comm_
);
162
}
163
164
static
inline
void
deconstruct
(
NonoverlappingSchwarzOperator<M,X,Y,C>
* t)
165
{
166
delete
t;
167
}
168
};
169
170
template
<
class
M,
class
X,
class
Y>
171
struct
MatrixAdapterArgs
172
{
173
MatrixAdapterArgs
(M& matrix,
const
SequentialInformation
&)
174
:
matrix_
(&matrix)
175
{}
176
177
M*
matrix_
;
178
};
179
180
template
<
class
M,
class
X,
class
Y>
181
class
ConstructionTraits
<
MatrixAdapter
<M,X,Y> >
182
{
183
public
:
184
typedef
const
MatrixAdapterArgs<M,X,Y>
Arguments
;
185
186
static
inline
MatrixAdapter<M,X,Y>
*
construct
(
Arguments
& args)
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
<>
198
class
ConstructionTraits
<
SequentialInformation
>
199
{
200
public
:
201
typedef
const
SequentialCommunicationArgs
Arguments
;
202
static
inline
SequentialInformation
*
construct
(
Arguments
& args)
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>
217
class
ConstructionTraits
<
OwnerOverlapCopyCommunication
<T1,T2> >
218
{
219
public
:
220
typedef
const
OwnerOverlapCopyCommunicationArgs
Arguments
;
221
222
static
inline
OwnerOverlapCopyCommunication<T1,T2>
*
construct
(
Arguments
& args)
223
{
224
return
new
OwnerOverlapCopyCommunication<T1,T2>
(args.
comm_
, args.
cat_
);
225
}
226
227
static
inline
void
deconstruct
(
OwnerOverlapCopyCommunication<T1,T2>
* com)
228
{
229
delete
com;
230
}
231
};
232
233
#endif
234
236
}
// namespace Amg
237
}
// namespace Dune
238
#endif
Generated on Tue Jun 5 2012 08:35:28 for dune-istl by
1.8.1