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 OpenCFD Ltd.
9 -------------------------------------------------------------------------------
10 License
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 
32 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
33 
35 (
37  label seed,
38  const bool gaussian
39 ) const
40 {
41  if (gaussian)
42  {
45  }
46  else
47  {
50  }
51 }
52 
53 
55 (
56  const scalarField& vals,
57  const pointField& locs
58 )
59 {
60  return FieldOps::findMinData(vals, locs).second();
61 }
62 
63 
65 (
66  const scalarField& vals,
67  const pointField& locs
68 )
69 {
70  return FieldOps::findMaxData(vals, locs).second();
71 }
72 
73 
74 // ************************************************************************* //
FieldOps.H
Foam::Random::uniformGeneratorOp
Definition: Random.H:88
Foam::Random::gaussianGeneratorOp
A generator class returning a gaussian distributed random number.
Definition: Random.H:89
Foam::expressions::exprDriver::getPositionOfMaximum
static point getPositionOfMaximum(const scalarField &vals, const pointField &locs)
Return the location of the max value.
Definition: exprDriverFields.C:65
exprDriver.H
Foam::expressions::exprDriver::getPositionOfMinimum
static point getPositionOfMinimum(const scalarField &vals, const pointField &locs)
Return the location of the min value.
Definition: exprDriverFields.C:55
Foam::Field< scalar >
Foam::FieldOps::findMinData
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
rDeltaTY field()
Foam::expressions::exprDriver::fill_random
void fill_random(scalarField &field, label seed=0, const bool gaussian=false) const
Fill a random field.
Definition: exprDriverFields.C:35
Random.H
Foam::Vector< scalar >
Foam::FieldOps::assign
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:35
Foam::FieldOps::findMaxData
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.