patchExprDriverFields.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 "patchExprDriver.H"
29 #include "fvPatch.H"
30 #include "error.H"
31 
32 // * * * * * * * * * * * * Template Specializations * * * * * * * * * * * * //
33 
34 template<>
36 Foam::expressions::patchExpr::parseDriver::getSurfaceField<bool>
37 (
38  const word& name
39 )
40 {
41  return getVariable<bool>(name, this->size());
42 }
43 
44 
45 template<>
47 Foam::expressions::patchExpr::parseDriver::getPointField<bool>
48 (
49  const word& name
50 )
51 {
52  return getVariable<bool>(name, this->pointSize());
53 }
54 
55 
56 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
57 
60 {
61  return patch_.magSf();
62 }
63 
64 
67 {
68  return patch_.Cf();
69 }
70 
71 
74 {
75  return patch_.Sf();
76 }
77 
78 
81 {
82  return patch_.patch().localPoints();
83 }
84 
85 
88 (
89  label seed,
90  bool gaussian
91 ) const
92 {
93  auto tresult = tmp<scalarField>::New(this->size());
94  fill_random(tresult.ref(), seed, gaussian);
95 
96  return tresult;
97 }
98 
99 
100 // ************************************************************************* //
Foam::expressions::patchExpr::parseDriver::field_pointField
tmp< vectorField > field_pointField() const
The patch point locations - (swak = pts)
Definition: patchExprDriverFields.C:80
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:62
Foam::tmp
A class for managing temporary objects.
Definition: PtrList.H:61
patchExprDriver.H
Foam::expressions::patchExpr::parseDriver::field_faceArea
tmp< scalarField > field_faceArea() const
The face area magnitudes [magSf] - (swak = area)
Definition: patchExprDriverFields.C:59
error.H
Foam::name
word name(const complex &c)
Return string representation of complex.
Definition: complex.C:76
Foam::expressions::patchExpr::parseDriver::field_areaNormal
tmp< vectorField > field_areaNormal() const
The face areas with their vector direction [Sf] - (swak = face)
Definition: patchExprDriverFields.C:73
Foam::expressions::patchExpr::parseDriver::field_rand
tmp< scalarField > field_rand(label seed=0, bool gaussian=false) const
A uniform random field.
Definition: patchExprDriverFields.C:88
Foam::expressions::patchExpr::parseDriver::field_faceCentre
tmp< vectorField > field_faceCentre() const
The face centres - (swak = pos)
Definition: patchExprDriverFields.C:66
Foam::tmp::New
static tmp< T > New(Args &&... args)
Construct tmp of T with forwarding arguments.
fvPatch.H
Foam::fvPatch::magSf
const scalarField & magSf() const
Return face area magnitudes.
Definition: fvPatch.C:150
Foam::expressions::patchExpr::parseDriver::patch_
const fvPatch & patch_
The referenced patch.
Definition: patchExprDriver.H:159