binField.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) 2022 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 "binField.H"
29 #include "binModel.H"
31 
32 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
33 
34 namespace Foam
35 {
36 namespace functionObjects
37 {
38  defineTypeNameAndDebug(binField, 0);
39  addToRunTimeSelectionTable(functionObject, binField, dictionary);
40 }
41 }
42 
43 
44 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
45 
47 (
48  const word& name,
49  const Time& runTime,
50  const dictionary& dict,
51  bool readFields
52 )
53 :
54  fvMeshFunctionObject(name, runTime, dict),
55  binModelPtr_(nullptr)
56 {
57  if (readFields)
58  {
59  read(dict);
60  }
61 }
62 
63 
65 (
66  const word& name,
67  const objectRegistry& obr,
68  const dictionary& dict,
69  bool readFields
70 )
71 :
72  fvMeshFunctionObject(name, obr, dict),
73  binModelPtr_(nullptr)
74 {
75  if (readFields)
76  {
78  }
79 }
80 
81 
82 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
83 
85 {
87  {
88  return false;
89  }
90 
91  Info<< type() << " " << name() << ":" << endl;
92 
93  binModelPtr_.reset(binModel::New(dict, mesh_, name()));
94 
95  return true;
96 }
97 
98 
100 {
101  Log << type() << " " << name() << ":" << nl
102  << " Calculating bins" << nl << endl;
104  binModelPtr_->apply();
105 
106  return true;
107 }
108 
111 {
112  return true;
113 }
114 
117 {
118  binModelPtr_->updateMesh(mpm);
119 }
120 
121 
123 {
124  binModelPtr_->movePoints(mesh);
125 }
126 
127 
128 // ************************************************************************* //
dictionary dict
defineTypeNameAndDebug(ObukhovLength, 0)
A list of keyword definitions, which are a keyword followed by a number of values (eg...
Definition: dictionary.H:129
constexpr char nl
The newline &#39;\n&#39; character (0x0a)
Definition: Ostream.H:50
engineTime & runTime
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:531
binField(const word &name, const Time &runTime, const dictionary &dict, const bool readFields=true)
Construct from Time and dictionary.
Definition: binField.C:40
virtual bool write()
Write to data files/fields and to streams.
Definition: binField.C:103
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Definition: Time.H:69
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
Definition: mapPolyMesh.H:157
Macros for easy insertion into run-time selection tables.
fileName::Type type(const fileName &name, const bool followLink=true)
Return the file type: DIRECTORY or FILE, normally following symbolic links.
Definition: POSIX.C:799
dynamicFvMesh & mesh
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for expressions::valueTypeCode::INVALID.
Definition: exprTraits.C:127
void readFields(const typename GeoFieldType::Mesh &mesh, const IOobjectList &objects, const NameMatchPredicate &selectedFields, DynamicList< regIOobject *> &storedObjects)
Read the selected GeometricFields of the templated type and store on the objectRegistry.
A class for handling words, derived from Foam::string.
Definition: word.H:63
virtual bool read(const dictionary &dict)
Read the dictionary.
Definition: binField.C:77
static autoPtr< binModel > New(const dictionary &dict, const fvMesh &mesh, const word &outputPrefix)
Return a reference to the selected bin model.
Definition: binModelNew.C:27
addToRunTimeSelectionTable(functionObject, ObukhovLength, dictionary)
virtual bool execute()
Execute the function object.
Definition: binField.C:92
#define Log
Definition: PDRblock.C:28
virtual void updateMesh(const mapPolyMesh &mpm)
Update for changes of mesh.
Definition: binField.C:109
messageStream Info
Information stream (stdout output on master, null elsewhere)
virtual bool read(const dictionary &dict)
Read optional controls.
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:74
Registry of regIOobjects.
Namespace for OpenFOAM.
virtual void movePoints(const polyMesh &mesh)
Update for changes of mesh.
Definition: binField.C:115