Overture
Version 25
Main Page
Namespaces
Classes
Files
File List
File Members
Overture.v25.d
include
intCompositeGridFunction.h
Go to the documentation of this file.
1
/* -*-Mode: c++; -*- */
2
#ifndef INTCOMPOSITEGRIDFUNCTION
3
#define INTCOMPOSITEGRIDFUNCTION
4
5
#include "
intGridCollectionFunction.h
"
6
#include "
ListOfIntCompositeGridFunction.h
"
7
8
class
CompositeGrid
;
// forward declaration
9
class
CompositeGridData
;
// forward declaration
10
class
Interpolant
;
// forward declaration
11
class
GridCollectionOperators
;
// forward declaration
12
class
CompositeGridOperators
;
13
class
intCompositeGridFunction
;
14
15
16
//===================================================================
17
// intCompositeGridFunction
18
//
19
// Define a grid function to be used with a composite grid.
20
// This class contains a list of intMappedGridFunction's
21
// and a CompositeGrid
22
//
23
// This is a reference counted class so that there is no need
24
// to keep a pointer to a grid function. Use the reference
25
// member function to make one grid function reference another.
26
//
27
// Usage:
28
// CompositeGrid cg(...); // here is a composite grid
29
// doubleCompositeGridFunction u(cg),v;
30
// u[0]=5.; // mapped grid function for grid 0
31
// Index I(0,10);
32
// u[1](I,I)=3.; // mapped grid function for grid 1
33
// v.reference(u); // v is referenced to u
34
// v[1]=7.; // changes u as well
35
// v.breakReference(); // v is no longer referenced to u
36
// ...
37
//
38
//==================================================================
39
40
class
intCompositeGridFunction
:
public
intGridCollectionFunction
41
{
42
public
:
43
44
intCompositeGridFunction
( );
45
// This constructor takes ranges, the first 3 "nullRange" values are taken to be the
46
// coordinate directions in the grid function.
47
intCompositeGridFunction
(
CompositeGrid
& grid,
48
const
Range &
R0
,
49
const
Range & R1=
nullRange
,
50
const
Range & R2=
nullRange
,
51
const
Range & R3=
nullRange
,
52
const
Range & R4=
nullRange
,
53
const
Range & R5=
nullRange
,
54
const
Range & R6=
nullRange
,
55
const
Range & R7=
nullRange
);
56
57
intCompositeGridFunction
(
CompositeGridData
& gcData,
58
const
Range & R0,
59
const
Range & R1=
nullRange
,
60
const
Range & R2=
nullRange
,
61
const
Range & R3=
nullRange
,
62
const
Range & R4=
nullRange
,
63
const
Range & R5=
nullRange
,
64
const
Range & R6=
nullRange
,
65
const
Range & R7=
nullRange
);
66
67
intCompositeGridFunction
(
CompositeGrid
& grid,
68
const
int
& i0,
69
const
Range & R1=
nullRange
,
70
const
Range & R2=
nullRange
,
71
const
Range & R3=
nullRange
,
72
const
Range & R4=
nullRange
,
73
const
Range & R5=
nullRange
,
74
const
Range & R6=
nullRange
,
75
const
Range & R7=
nullRange
);
76
77
intCompositeGridFunction
(
CompositeGridData
& gcData,
78
const
int
& i0,
79
const
Range & R1=
nullRange
,
80
const
Range & R2=
nullRange
,
81
const
Range & R3=
nullRange
,
82
const
Range & R4=
nullRange
,
83
const
Range & R5=
nullRange
,
84
const
Range & R6=
nullRange
,
85
const
Range & R7=
nullRange
);
86
87
//
88
// This constructor takes a GridFunctionType
89
//
90
intCompositeGridFunction
(
CompositeGrid
& grid,
91
const
GridFunctionParameters::GridFunctionType
& type,
92
const
Range & Component0=
nullRange
,
// defaults to Range(0,0)
93
const
Range & Component1=
nullRange
,
94
const
Range & Component2=
nullRange
,
95
const
Range & Component3=
nullRange
,
96
const
Range & Component4=
nullRange
);
97
98
intCompositeGridFunction
(
CompositeGrid
&
CompositeGrid
);
99
intCompositeGridFunction
(
CompositeGridData
& CompositeGrid);
100
101
intCompositeGridFunction
(
const
intCompositeGridFunction
& cgf,
const
CopyType
copyType=
DEEP
);
102
intCompositeGridFunction
(
const
intGridCollectionFunction
& cgf,
const
CopyType
copyType=
DEEP
);
103
104
virtual
~intCompositeGridFunction
();
105
106
// A derived class must define the = operators
107
intCompositeGridFunction
&
operator=
(
const
intCompositeGridFunction
& cgf );
108
intGridCollectionFunction
&
operator=
(
const
intGridCollectionFunction
& gcf );
109
110
// Return a link to some specfied components
111
intCompositeGridFunction
operator()
(
const
Range & component0,
112
const
Range & component1=
nullRange
,
113
const
Range & component2=
nullRange
,
114
const
Range & component3=
nullRange
,
115
const
Range & component4=
nullRange
);
116
117
118
CompositeGridOperators
*
getOperators
()
const
;
// return a pointer to the operators
119
void
setOperators
(
GenericCollectionOperators
&
operators
);
120
121
Interpolant
*
getInterpolant
(
const
bool
abortIfNull =
TRUE
)
const
;
// return a pointer to the Interpolant
122
123
virtual
aString
getClassName
()
const
;
124
125
CompositeGrid*
getCompositeGrid
(
const
bool
abortIfNull=
TRUE
)
const
;
// return a pointer to the CompositeGrid
126
127
void
link
(
const
intCompositeGridFunction
& gcf,
128
const
Range & R0,
129
const
Range & R1=
nullRange
,
130
const
Range & R2=
nullRange
,
131
const
Range & R3=
nullRange
,
132
const
Range & R4=
nullRange
);
133
134
void
link
(
const
intGridCollectionFunction
& gcf,
// *New*
135
const
Range & R0,
136
const
Range & R1=
nullRange
,
137
const
Range & R2=
nullRange
,
138
const
Range & R3=
nullRange
,
139
const
Range & R4=
nullRange
);
140
141
virtual
void
link
(
const
intCompositeGridFunction
& gcf,
142
const
int
componentToLinkTo=0,
143
const
int
numberOfComponents=1 );
144
145
virtual
void
link
(
const
intGridCollectionFunction
& gcf,
146
const
int
componentToLinkTo=0,
147
const
int
numberOfComponents=1 );
148
149
void
reference
(
const
intCompositeGridFunction
& cgf );
150
void
reference
(
const
intGridCollectionFunction
& cgf );
// *new*
151
152
virtual
void
setIsACoefficientMatrix
(
const
bool
trueOrFalse=
TRUE
,
153
const
int
stencilSize=
defaultValue
,
154
const
int
numberOfGhostLines=1,
155
const
int
numberOfComponentsForCoefficients=1,
156
const
int
offset=0 );
157
158
// return size of this object
159
virtual
real
sizeOf
(FILE *file =
NULL
)
const
;
160
161
// define all the update functions
162
updateReturnValue
updateToMatchGrid
();
163
updateReturnValue
updateToMatchGrid
(
CompositeGridData
& gridData,
164
const
Range & R0,
165
const
Range & R1=
nullRange
,
166
const
Range & R2=
nullRange
,
167
const
Range & R3=
nullRange
,
168
const
Range & R4=
nullRange
,
169
const
Range & R5=
nullRange
,
170
const
Range & R6=
nullRange
,
171
const
Range & R7=
nullRange
);
172
173
updateReturnValue
updateToMatchGrid
(CompositeGrid & grid,
174
const
Range & R0,
175
const
Range & R1=
nullRange
,
176
const
Range & R2=
nullRange
,
177
const
Range & R3=
nullRange
,
178
const
Range & R4=
nullRange
,
179
const
Range & R5=
nullRange
,
180
const
Range & R6=
nullRange
,
181
const
Range & R7=
nullRange
);
182
183
// define this version to avoid overloading ambiguities
184
updateReturnValue
updateToMatchGrid
(CompositeGrid & grid,
185
const
int
& i0,
186
const
Range & R1=
nullRange
,
187
const
Range & R2=
nullRange
,
188
const
Range & R3=
nullRange
,
189
const
Range & R4=
nullRange
,
190
const
Range & R5=
nullRange
,
191
const
Range & R6=
nullRange
,
192
const
Range & R7=
nullRange
);
193
194
updateReturnValue
updateToMatchGrid
(
const
Range & R0,
195
const
Range & R1=
nullRange
,
196
const
Range & R2=
nullRange
,
197
const
Range & R3=
nullRange
,
198
const
Range & R4=
nullRange
,
199
const
Range & R5=
nullRange
,
200
const
Range & R6=
nullRange
,
201
const
Range & R7=
nullRange
);
202
203
updateReturnValue
updateToMatchGrid
(CompositeGrid & grid,
204
const
GridFunctionParameters::GridFunctionType
& type,
205
const
Range & component0,
206
const
Range & component1=
nullRange
,
207
const
Range & component2=
nullRange
,
208
const
Range & component3=
nullRange
,
209
const
Range & component4=
nullRange
);
210
211
updateReturnValue
updateToMatchGrid
(
const
GridFunctionParameters::GridFunctionType
& type,
212
const
Range & component0,
213
const
Range & component1=
nullRange
,
214
const
Range & component2=
nullRange
,
215
const
Range & component3=
nullRange
,
216
const
Range & component4=
nullRange
);
217
updateReturnValue
updateToMatchGrid
(CompositeGrid & grid,
218
const
GridFunctionParameters::GridFunctionType
& type);
219
updateReturnValue
updateToMatchGrid
(
const
GridFunctionParameters::GridFunctionType
& type);
220
221
222
updateReturnValue
updateToMatchGrid
(CompositeGrid & grid);
223
updateReturnValue
updateToMatchGrid
(
CompositeGridData
& grid);
224
225
226
// update this grid function to match another grid function
227
updateReturnValue
updateToMatchGridFunction
(
const
intCompositeGridFunction
& cgf,
228
const
Range & R0,
229
const
Range & R1=
nullRange
,
230
const
Range & R2=
nullRange
,
231
const
Range & R3=
nullRange
,
232
const
Range & R4=
nullRange
,
233
const
Range & R5=
nullRange
,
234
const
Range & R6=
nullRange
,
235
const
Range & R7=
nullRange
);
236
237
updateReturnValue
updateToMatchGridFunction
(
const
intCompositeGridFunction
& gcf);
238
239
// make sure the number of mappedGridFunction's is correct
240
updateReturnValue
updateToMatchNumberOfGrids
(CompositeGrid& gc);
241
242
243
// Collections of grid functions having the same base grid.
244
ListOfIntCompositeGridFunction
baseGrid
;
// overloads one base class
245
246
// Collections of grid functions having the same multigrid level.
247
ListOfIntCompositeGridFunction
multigridLevel
;
// overloads one base class
248
249
// Collections of grid functions having the same refinement level.
250
ListOfIntCompositeGridFunction
refinementLevel
;
// overloads one base class
251
252
253
int
interpolate
(
Interpolant
& interpolant,
254
const
Range & C0 =
nullRange
,
255
const
Range & C1 =
nullRange
,
256
const
Range & C2 =
nullRange
);
257
int
interpolate
(
const
Range & C0 =
nullRange
,
258
const
Range & C1 =
nullRange
,
259
const
Range & C2 =
nullRange
);
260
261
friend
intCompositeGridFunction
&
abs
(
const
intCompositeGridFunction
& cgf );
262
263
// use this function to "evaulate and expression" when calling a function with an expression
264
// involving grid collection functions.
265
friend
intCompositeGridFunction
evaluate
(
intCompositeGridFunction
& u );
266
267
#define COLLECTION_FUNCTION intCompositeGridFunction
268
#define INT_COLLECTION_FUNCTION intCompositeGridFunction
269
#define COLLECTION CompositeGrid
270
#define INTEGRAL_TYPE int
271
#include "
derivativeDefinitions.h
"
272
#undef COLLECTION_FUNCTION
273
#undef INT_COLLECTION_FUNCTION
274
#undef COLLECTION
275
#undef INTEGRAL_TYPE
276
277
// These are needed to avoid compiler warnings
278
updateReturnValue
updateToMatchGrid
(
GridCollectionData
& gridData,
279
const
Range & R0,
280
const
Range & R1=
nullRange
,
281
const
Range & R2=
nullRange
,
282
const
Range & R3=
nullRange
,
283
const
Range & R4=
nullRange
,
284
const
Range & R5=
nullRange
,
285
const
Range & R6=
nullRange
,
286
const
Range & R7=
nullRange
);
287
288
updateReturnValue
updateToMatchGrid
(
GridCollection
& grid,
289
const
Range & R0,
290
const
Range & R1=
nullRange
,
291
const
Range & R2=
nullRange
,
292
const
Range & R3=
nullRange
,
293
const
Range & R4=
nullRange
,
294
const
Range & R5=
nullRange
,
295
const
Range & R6=
nullRange
,
296
const
Range & R7=
nullRange
);
297
298
updateReturnValue
updateToMatchGrid
(
GridCollection
& grid,
299
const
int
& i0,
300
const
Range & R1=
nullRange
,
301
const
Range & R2=
nullRange
,
302
const
Range & R3=
nullRange
,
303
const
Range & R4=
nullRange
,
304
const
Range & R5=
nullRange
,
305
const
Range & R6=
nullRange
,
306
const
Range & R7=
nullRange
);
307
308
309
updateReturnValue
updateToMatchGrid
(
GridCollection
& grid,
310
const
GridFunctionParameters::GridFunctionType
& type,
311
const
Range & component0,
312
const
Range & component1=
nullRange
,
313
const
Range & component2=
nullRange
,
314
const
Range & component3=
nullRange
,
315
const
Range & component4=
nullRange
);
316
317
updateReturnValue
updateToMatchGrid
(
GridCollection
& grid,
318
const
GridFunctionParameters::GridFunctionType
& type);
319
320
updateReturnValue
updateToMatchGrid
(
GridCollection
& grid);
321
updateReturnValue
updateToMatchGrid
(
GridCollectionData
& grid);
322
323
324
// update this grid function to match another grid function
325
updateReturnValue
updateToMatchGridFunction
(
const
intGridCollectionFunction
& cgf,
326
const
Range & R0,
327
const
Range & R1=
nullRange
,
328
const
Range & R2=
nullRange
,
329
const
Range & R3=
nullRange
,
330
const
Range & R4=
nullRange
,
331
const
Range & R5=
nullRange
,
332
const
Range & R6=
nullRange
,
333
const
Range & R7=
nullRange
);
334
335
336
updateReturnValue
updateToMatchGridFunction
(
const
intGridCollectionFunction
& gcf);
337
338
// make sure the number of mappedGridFunction's is correct
339
updateReturnValue
updateToMatchNumberOfGrids
(
GridCollection
& gc);
340
341
342
protected
:
343
void
updateReferences
();
344
int
updateCollections
();
// update refinementLevel etc.
345
346
private
:
347
348
// These are used by list's of ReferenceCounting objects
349
virtual
void
reference
(
const
ReferenceCounting
& mgf )
350
{
intCompositeGridFunction::reference
( (
intCompositeGridFunction
&) mgf ); }
351
virtual
ReferenceCounting
&
operator=
(
const
ReferenceCounting
& mgf )
352
{
return
intCompositeGridFunction::operator=
( (
intCompositeGridFunction
&) mgf ); }
353
virtual
ReferenceCounting
* virtualConstructor(
const
CopyType
ct =
DEEP
)
const
354
{ return ::new
intCompositeGridFunction
(*
this
,ct); }
355
356
aString
className;
357
358
};
359
360
361
362
#endif
Generated on Fri Jan 4 2013 10:17:53 for Overture by
1.8.3