This file is indexed.

/usr/include/palabos/finiteDifference/fdWrapper3D.hh is in libplb-dev 1.5~r1+repack1-2build2.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
/* This file is part of the Palabos library.
 *
 * Copyright (C) 2011-2015 FlowKit Sarl
 * Route d'Oron 2
 * 1010 Lausanne, Switzerland
 * E-mail contact: contact@flowkit.com
 *
 * The most recent release of Palabos can be downloaded at 
 * <http://www.palabos.org/>
 *
 * The library Palabos is free software: you can redistribute it and/or
 * modify it under the terms of the GNU Affero General Public License as
 * published by the Free Software Foundation, either version 3 of the
 * License, or (at your option) any later version.
 *
 * The library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/

/** \file
 * Helper functions for domain initialization -- header file.
 */
#ifndef FINITE_DIFFERENCE_WRAPPER_3D_HH
#define FINITE_DIFFERENCE_WRAPPER_3D_HH

#include "finiteDifference/fdWrapper3D.h"
#include "finiteDifference/fdFunctional3D.h"
#include "atomicBlock/reductiveDataProcessorWrapper3D.h"
#include "atomicBlock/dataProcessorWrapper3D.h"
#include "multiBlock/reductiveMultiDataProcessorWrapper3D.h"
#include "multiBlock/multiDataProcessorWrapper3D.h"



namespace plb {

template<typename T>
void computeXderivative(MultiScalarField3D<T>& value, MultiScalarField3D<T>& derivative, Box3D const& domain) {
    plint boundaryWidth = 1;
    applyProcessingFunctional (
            new BoxXderivativeFunctional3D<T>, domain, value, derivative, boundaryWidth );
}

template<typename T>
std::auto_ptr<MultiScalarField3D<T> > computeXderivative(MultiScalarField3D<T>& value, Box3D const& domain) {
    MultiScalarField3D<T>* derivative = new MultiScalarField3D<T>(value, domain);
    computeXderivative(value, *derivative, domain);
    return std::auto_ptr<MultiScalarField3D<T> >(derivative);
}

template<typename T>
std::auto_ptr<MultiScalarField3D<T> > computeXderivative(MultiScalarField3D<T>& value) {
    return computeXderivative(value, value.getBoundingBox());
}


template<typename T>
void computeYderivative(MultiScalarField3D<T>& value, MultiScalarField3D<T>& derivative, Box3D const& domain) {
    plint boundaryWidth = 1;
    applyProcessingFunctional (
            new BoxYderivativeFunctional3D<T>, domain, value, derivative, boundaryWidth );
}

template<typename T>
std::auto_ptr<MultiScalarField3D<T> > computeYderivative(MultiScalarField3D<T>& value, Box3D const& domain) {
    MultiScalarField3D<T>* derivative = new MultiScalarField3D<T>(value, domain);
    computeYderivative(value, *derivative, domain);
    return std::auto_ptr<MultiScalarField3D<T> >(derivative);
}

template<typename T>
std::auto_ptr<MultiScalarField3D<T> > computeYderivative(MultiScalarField3D<T>& value) {
    return computeYderivative(value, value.getBoundingBox());
}

template<typename T>
void computeZderivative(MultiScalarField3D<T>& value, MultiScalarField3D<T>& derivative, Box3D const& domain) {
    plint boundaryWidth = 1;
    applyProcessingFunctional (
            new BoxZderivativeFunctional3D<T>, domain, value, derivative, boundaryWidth );
}

template<typename T>
std::auto_ptr<MultiScalarField3D<T> > computeZderivative(MultiScalarField3D<T>& value, Box3D const& domain) {
    MultiScalarField3D<T>* derivative = new MultiScalarField3D<T>(value, domain);
    computeZderivative(value, *derivative, domain);
    return std::auto_ptr<MultiScalarField3D<T> >(derivative);
}

template<typename T>
std::auto_ptr<MultiScalarField3D<T> > computeZderivative(MultiScalarField3D<T>& value) {
    return computeZderivative(value, value.getBoundingBox());
}

template<typename T>
void computeGradientNorm(MultiScalarField3D<T>& value, MultiScalarField3D<T>& derivative, Box3D const& domain) {
    plint boundaryWidth = 1;
    applyProcessingFunctional (
            new BoxGradientNormFunctional3D<T>, domain, value, derivative, boundaryWidth );
}

template<typename T>
std::auto_ptr<MultiScalarField3D<T> > computeGradientNorm(MultiScalarField3D<T>& value, Box3D const& domain) {
    MultiScalarField3D<T>* derivative = new MultiScalarField3D<T>(value, domain);
    computeGradientNorm(value, *derivative, domain);
    return std::auto_ptr<MultiScalarField3D<T> >(derivative);
}

template<typename T>
std::auto_ptr<MultiScalarField3D<T> > computeGradientNorm(MultiScalarField3D<T>& value) {
    return computeGradientNorm(value, value.getBoundingBox());
}


template<typename T>
void computePeriodicGradient(MultiScalarField3D<T>& value, MultiTensorField3D<T,3>& derivative, Box3D const& domain) {
    applyProcessingFunctional (
            new BoxPeriodicGradientFunctional3D<T>, domain, value, derivative );
}

template<typename T>
std::auto_ptr<MultiTensorField3D<T,3> > computePeriodicGradient(MultiScalarField3D<T>& value, Box3D const& domain) {
    MultiTensorField3D<T,3>* derivative = new MultiTensorField3D<T,2>(value, domain);
    computePeriodicGradient(value, *derivative, domain);
    return std::auto_ptr<MultiTensorField3D<T,3> >(derivative);
}

template<typename T>
std::auto_ptr<MultiTensorField3D<T,3> > computePeriodicGradient(MultiScalarField3D<T>& value) {
    return computePeriodicGradient(value, value.getBoundingBox());
}

template<typename T>
std::auto_ptr<MultiScalarField3D<T> > computePoissonRHS(MultiTensorField3D<T,3>& velocity, Box3D const& domain)
{
    std::auto_ptr<MultiScalarField3D<T> > ux = extractComponent(velocity, domain, 0);
    std::auto_ptr<MultiScalarField3D<T> > uy = extractComponent(velocity, domain, 1);
    std::auto_ptr<MultiScalarField3D<T> > uz = extractComponent(velocity, domain, 2);

    std::auto_ptr<MultiScalarField3D<T> > dx_ux = computeXderivative(*ux, domain);
    std::auto_ptr<MultiScalarField3D<T> > dy_ux = computeYderivative(*ux, domain);
    std::auto_ptr<MultiScalarField3D<T> > dz_ux = computeZderivative(*ux, domain);
    std::auto_ptr<MultiScalarField3D<T> > dx_uy = computeXderivative(*uy, domain);
    std::auto_ptr<MultiScalarField3D<T> > dy_uy = computeYderivative(*uy, domain);
    std::auto_ptr<MultiScalarField3D<T> > dz_uy = computeZderivative(*uy, domain);
    std::auto_ptr<MultiScalarField3D<T> > dx_uz = computeXderivative(*uz, domain);
    std::auto_ptr<MultiScalarField3D<T> > dy_uz = computeYderivative(*uz, domain);
    std::auto_ptr<MultiScalarField3D<T> > dz_uz = computeZderivative(*uz, domain);

    std::auto_ptr<MultiScalarField3D<T> > term1 = multiply(*dx_ux, *dx_ux, domain);
    std::auto_ptr<MultiScalarField3D<T> > term2 = multiply(*dy_uy, *dy_uy, domain);
    std::auto_ptr<MultiScalarField3D<T> > term3 = multiply(*dz_uz, *dz_uz, domain);
    
    std::auto_ptr<MultiScalarField3D<T> > term4 = multiply((T)2, *multiply(*dx_uy, *dy_ux, domain), domain);
    std::auto_ptr<MultiScalarField3D<T> > term5 = multiply((T)2, *multiply(*dx_uz, *dz_ux, domain), domain);
    std::auto_ptr<MultiScalarField3D<T> > term6 = multiply((T)2, *multiply(*dy_uz, *dz_uy, domain), domain);

    std::auto_ptr<MultiScalarField3D<T> > rhs = add(*term6, *add(*term5, *add(*term4, *add(*term1, *add(*term2, *term3)))));
    return rhs;
}

template<typename T>
std::auto_ptr<MultiScalarField3D<T> > computePoissonRHS(MultiTensorField3D<T,3>& velocity) {
    return computePoissonRHS(velocity, velocity.getBoundingBox());
}

template<typename T>
void poissonIterate(MultiScalarField3D<T>& oldPressure, MultiScalarField3D<T>& newPressure,
                    MultiScalarField3D<T>& rhs, T beta, Box3D const& domain, plint boundaryWidth)
{
    std::vector<MultiScalarField3D<T>* > fields;
    fields.push_back(&oldPressure);
    fields.push_back(&newPressure);
    fields.push_back(&rhs);
    applyProcessingFunctional (
            new BoxPoissonIteration3D<T>(beta), domain, fields, boundaryWidth );
}

template<typename T>
T computePoissonResidue(MultiScalarField3D<T>& pressure, MultiScalarField3D<T>& rhs, Box3D const& domain) {
    BoxPoissonResidueFunctional3D<T> functional;
    applyProcessingFunctional(functional, domain, pressure, rhs);
    return functional.getMaxResidue();
}


// ========================================================================= //
// PERIODIC VERSIONS OF THE DERIVATIVES AND POISSON SCHEMES //
// ========================================================================= //


template<typename T>
void computeXperiodicDerivative(MultiScalarField3D<T>& value, MultiScalarField3D<T>& derivative, Box3D const& domain) {
    plint boundaryWidth = 1;
    applyProcessingFunctional (
            new BoxXperiodicDerivativeFunctional3D<T>, domain, value, derivative, boundaryWidth );
}

template<typename T>
std::auto_ptr<MultiScalarField3D<T> > computeXperiodicDerivative(MultiScalarField3D<T>& value, Box3D const& domain) {
    MultiScalarField3D<T>* derivative = new MultiScalarField3D<T>(value, domain);
    computeXperiodicDerivative(value, *derivative, domain);
    return std::auto_ptr<MultiScalarField3D<T> >(derivative);
}

template<typename T>
std::auto_ptr<MultiScalarField3D<T> > computeXperiodicDerivative(MultiScalarField3D<T>& value) {
    return computeXperiodicDerivative(value, value.getBoundingBox());
}


template<typename T>
void computeYperiodicDerivative(MultiScalarField3D<T>& value, MultiScalarField3D<T>& derivative, Box3D const& domain) {
    plint boundaryWidth = 1;
    applyProcessingFunctional (
            new BoxYperiodicDerivativeFunctional3D<T>, domain, value, derivative, boundaryWidth );
}

template<typename T>
std::auto_ptr<MultiScalarField3D<T> > computeYperiodicDerivative(MultiScalarField3D<T>& value, Box3D const& domain) {
    MultiScalarField3D<T>* derivative = new MultiScalarField3D<T>(value, domain);
    computeYperiodicDerivative(value, *derivative, domain);
    return std::auto_ptr<MultiScalarField3D<T> >(derivative);
}

template<typename T>
std::auto_ptr<MultiScalarField3D<T> > computeYperiodicDerivative(MultiScalarField3D<T>& value) {
    return computeYperiodicDerivative(value, value.getBoundingBox());
}

template<typename T>
void computeZperiodicDerivative(MultiScalarField3D<T>& value, MultiScalarField3D<T>& derivative, Box3D const& domain) {
    plint boundaryWidth = 1;
    applyProcessingFunctional (
            new BoxZperiodicDerivativeFunctional3D<T>, domain, value, derivative, boundaryWidth );
}

template<typename T>
std::auto_ptr<MultiScalarField3D<T> > computeZperiodicDerivative(MultiScalarField3D<T>& value, Box3D const& domain) {
    MultiScalarField3D<T>* derivative = new MultiScalarField3D<T>(value, domain);
    computeZperiodicDerivative(value, *derivative, domain);
    return std::auto_ptr<MultiScalarField3D<T> >(derivative);
}

template<typename T>
std::auto_ptr<MultiScalarField3D<T> > computeZperiodicDerivative(MultiScalarField3D<T>& value) {
    return computeZperiodicDerivative(value, value.getBoundingBox());
}

template<typename T>
void computePeriodicGradientNorm(MultiScalarField3D<T>& value, MultiScalarField3D<T>& derivative, Box3D const& domain) {
    plint boundaryWidth = 1;
    applyProcessingFunctional (
            new BoxGradientNormFunctional3D<T>, domain, value, derivative, boundaryWidth );
}

template<typename T>
std::auto_ptr<MultiScalarField3D<T> > computePeriodicGradientNorm(MultiScalarField3D<T>& value, Box3D const& domain) {
    MultiScalarField3D<T>* derivative = new MultiScalarField3D<T>(value, domain);
    computePeriodicGradientNorm(value, *derivative, domain);
    return std::auto_ptr<MultiScalarField3D<T> >(derivative);
}

template<typename T>
std::auto_ptr<MultiScalarField3D<T> > computePeriodicGradientNorm(MultiScalarField3D<T>& value) {
    return computePeriodicGradientNorm(value, value.getBoundingBox());
}

template<typename T>
std::auto_ptr<MultiScalarField3D<T> > computePeriodicPoissonRHS(MultiTensorField3D<T,3>& velocity, Box3D const& domain)
{
    std::auto_ptr<MultiScalarField3D<T> > ux = extractComponent(velocity, domain, 0);
    ux->periodicity().toggleAll(true);
    std::auto_ptr<MultiScalarField3D<T> > uy = extractComponent(velocity, domain, 1);
    uy->periodicity().toggleAll(true);
    std::auto_ptr<MultiScalarField3D<T> > uz = extractComponent(velocity, domain, 2);
    uz->periodicity().toggleAll(true);

    std::auto_ptr<MultiScalarField3D<T> > dx_ux = computeXperiodicDerivative(*ux, domain);
    std::auto_ptr<MultiScalarField3D<T> > dy_ux = computeYperiodicDerivative(*ux, domain);
    std::auto_ptr<MultiScalarField3D<T> > dz_ux = computeZperiodicDerivative(*ux, domain);
    std::auto_ptr<MultiScalarField3D<T> > dx_uy = computeXperiodicDerivative(*uy, domain);
    std::auto_ptr<MultiScalarField3D<T> > dy_uy = computeYperiodicDerivative(*uy, domain);
    std::auto_ptr<MultiScalarField3D<T> > dz_uy = computeZperiodicDerivative(*uy, domain);
    std::auto_ptr<MultiScalarField3D<T> > dx_uz = computeXperiodicDerivative(*uz, domain);
    std::auto_ptr<MultiScalarField3D<T> > dy_uz = computeYperiodicDerivative(*uz, domain);
    std::auto_ptr<MultiScalarField3D<T> > dz_uz = computeZperiodicDerivative(*uz, domain);

    std::auto_ptr<MultiScalarField3D<T> > term1 = multiply(*dx_ux, *dx_ux, domain);
    std::auto_ptr<MultiScalarField3D<T> > term2 = multiply(*dy_uy, *dy_uy, domain);
    std::auto_ptr<MultiScalarField3D<T> > term3 = multiply(*dz_uz, *dz_uz, domain);
    
    std::auto_ptr<MultiScalarField3D<T> > term4 = multiply((T)2, *multiply(*dx_uy, *dy_ux, domain), domain);
    std::auto_ptr<MultiScalarField3D<T> > term5 = multiply((T)2, *multiply(*dx_uz, *dz_ux, domain), domain);
    std::auto_ptr<MultiScalarField3D<T> > term6 = multiply((T)2, *multiply(*dy_uz, *dz_uy, domain), domain);

    std::auto_ptr<MultiScalarField3D<T> > rhs = add(*term6, *add(*term5, *add(*term4, *add(*term1, *add(*term2, *term3)))));
    return rhs;
}

template<typename T>
std::auto_ptr<MultiScalarField3D<T> > computePeriodicPoissonRHS(MultiTensorField3D<T,3>& velocity) {
    return computePeriodicPoissonRHS(velocity, velocity.getBoundingBox());
}

template<typename T>
void periodicPoissonIterate(MultiScalarField3D<T>& oldPressure, MultiScalarField3D<T>& newPressure,
                    MultiScalarField3D<T>& rhs, T beta, Box3D const& domain)
{
    std::vector<MultiScalarField3D<T>* > fields;
    fields.push_back(&oldPressure);
    fields.push_back(&newPressure);
    fields.push_back(&rhs);
    applyProcessingFunctional (
        new BoxPeriodicPoissonIteration3D<T>(beta), domain, fields );
}



}  // namespace plb

#endif  // FINITE_DIFFERENCE_WRAPPER_3D_HH