Loading...
Searching...
No Matches
exprDriverFields.C
Go to the documentation of this file.
1/*---------------------------------------------------------------------------*\
2 ========= |
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4 \\ / O peration |
5 \\ / A nd | www.openfoam.com
6 \\/ M anipulation |
7-------------------------------------------------------------------------------
8 Copyright (C) 2019-2023 OpenCFD Ltd.
9-------------------------------------------------------------------------------
10License
11 This file is part of OpenFOAM.
12
13 OpenFOAM is free software: you can redistribute it and/or modify it
14 under the terms of the GNU General Public License as published by
15 the Free Software Foundation, either version 3 of the License, or
16 (at your option) any later version.
17
18 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21 for more details.
22
23 You should have received a copy of the GNU General Public License
24 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25
26\*---------------------------------------------------------------------------*/
27
28#include "exprDriver.H"
29#include "FieldOps.H"
30#include "Random.H"
31#include "TimeState.H"
32
33// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
34
36(
38 label seed,
39 const bool gaussian
40) const
41{
42 if (seed <= 0)
43 {
44 const TimeState* ts = this->timeState();
45
46 if (ts)
47 {
48 seed = (ts->timeIndex() - seed);
49 }
50 else
51 {
52 seed = -seed;
53 }
54 }
55
56 if (gaussian)
57 {
60 }
61 else
70(
71 const scalarField& vals,
72 const pointField& locs
73)
74{
75 return FieldOps::findMinData(vals, locs).second();
76}
77
78
80(
81 const scalarField& vals,
82 const pointField& locs
83)
84{
85 return FieldOps::findMaxData(vals, locs).second();
86}
87
88
89// ************************************************************************* //
A generator class returning a gaussian distributed random number.
Definition Random.H:348
A generator class returning a uniformly distributed random number on the given interval.
Definition Random.H:259
The time value with time-stepping information, user-defined remapping, etc.
Definition TimeState.H:50
label timeIndex() const noexcept
Return the current time index.
Definition TimeStateI.H:43
void fill_random(scalarField &field, label seed=0, const bool gaussian=false) const
Fill a random field.
static point getPositionOfMaximum(const scalarField &vals, const pointField &locs)
Return the location of the max value.
const TimeState * timeState() const noexcept
Reference to the current time-state (can be nullptr).
Definition exprDriver.C:247
static point getPositionOfMinimum(const scalarField &vals, const pointField &locs)
Return the location of the min value.
rDeltaTY field()
void assign(Field< Tout > &result, const Field< T1 > &a, const UnaryOp &op)
Populate a field as the result of a unary operation on an input.
Definition FieldOps.C:28
Tuple2< T1, T2 > findMaxData(const Field< T1 > &vals, const Field< T2 > &data)
Locate the max value in a field and return it and associated data.
Tuple2< T1, T2 > findMinData(const Field< T1 > &vals, const Field< T2 > &data)
Locate the min value in a field and return it and associated data.
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
vector point
Point is a vector.
Definition point.H:37
vectorField pointField
pointField is a vectorField.