regionModelFunctionObjectList.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) 2012-2017 OpenFOAM Foundation
9  Copyright (C) 2021 OpenCFD Ltd.
10 -------------------------------------------------------------------------------
11 License
12  This file is part of OpenFOAM.
13 
14  OpenFOAM is free software: you can redistribute it and/or modify it
15  under the terms of the GNU General Public License as published by
16  the Free Software Foundation, either version 3 of the License, or
17  (at your option) any later version.
18 
19  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22  for more details.
23 
24  You should have received a copy of the GNU General Public License
25  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26 
27 \*---------------------------------------------------------------------------*/
28 
30 
31 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
32 
34 (
35  regionModel& region
36 )
37 :
39  regionModel_(region),
40  dict_()
41 {}
42 
43 
45 (
46  regionModel& region,
47  const dictionary& dict,
48  const bool readFields
49 )
50 :
52  regionModel_(region),
53  dict_(dict)
54 {
55  if (readFields)
56  {
57  wordList modelNames(dict.toc());
58 
59  Info<< " Selecting region model functions" << endl;
60 
61  if (modelNames.size() > 0)
62  {
63  this->setSize(modelNames.size());
64 
65  forAll(modelNames, i)
66  {
67  const word& modelName = modelNames[i];
68 
69  this->set
70  (
71  i,
73  (
74  dict,
75  region,
76  modelName
77  )
78  );
79  }
80  }
81  else
82  {
83  Info<< " none" << endl;
84  }
85  }
86 }
87 
88 
90 (
91  const regionModelFunctionObjectList& cfol
92 )
93 :
94  PtrList<regionModelFunctionObject>(cfol),
95  regionModel_(cfol.regionModel_),
96  dict_(cfol.dict_)
97 {}
98 
99 
100 // * * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * //
101 
104 {}
105 
106 
107 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
108 
110 {
111  forAll(*this, i)
112  {
113  this->operator[](i).preEvolveRegion();
114  }
115 }
116 
117 
119 {
120  forAll(*this, i)
121  {
122  this->operator[](i).postEvolveRegion();
123  }
124 }
125 
126 
127 // ************************************************************************* //
dictionary dict
A list of keyword definitions, which are a keyword followed by a number of values (eg...
Definition: dictionary.H:129
const dictionary & dict() const
Return the forces dictionary.
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:531
wordList toc() const
Return the table of contents.
Definition: dictionary.C:587
#define forAll(list, i)
Loop across all elements in list.
Definition: stdFoam.H:421
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
Region model function object base class.
void setSize(const label newLen)
Same as resize()
Definition: PtrList.H:337
const regionModel & region() const
Return const access to the cloud region.
static autoPtr< regionModelFunctionObject > New(const dictionary &dict, regionModel &region, const word &modelType)
Selector.
A list of pointers to objects of type <T>, with allocation/deallocation management of the pointers...
Definition: List.H:55
messageStream Info
Information stream (stdout output on master, null elsewhere)
Base class for region models.
Definition: regionModel.H:56
regionModelFunctionObjectList(regionModel &region)
Null constructor.