components.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) 2016 OpenFOAM Foundation
9  Copyright (C) 2019-2022 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 
29 #include "components.H"
31 
32 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
33 
34 namespace Foam
35 {
36 namespace functionObjects
37 {
38  defineTypeNameAndDebug(components, 0);
39  addToRunTimeSelectionTable(functionObject, components, dictionary);
40 }
41 }
42 
43 
44 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
45 
46 // Implementation
47 #include "componentsImpl.C"
48 
49 
50 // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
51 
52 bool Foam::functionObjects::components::calc()
53 {
54  return
55  (
56  calcComponents<vector>()
57  || calcComponents<sphericalTensor>()
58  || calcComponents<symmTensor>()
59  || calcComponents<tensor>()
60  );
61 }
62 
63 
64 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
65 
67 (
68  const word& name,
69  const Time& runTime,
70  const dictionary& dict
71 )
72 :
74 {}
75 
76 
77 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
78 
80 {
81  bool ok = true;
82 
83  for (const word& result : resultNames_)
84  {
85  ok = writeObject(result) && ok;
86  }
87 
88  return ok;
89 }
90 
91 
93 {
94  bool ok = true;
95 
96  for (const word& result : resultNames_)
97  {
98  ok = clearObject(result) && ok;
99  }
100 
101  return ok;
102 }
103 
104 
105 // ************************************************************************* //
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
engineTime & runTime
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Definition: Time.H:69
Macros for easy insertion into run-time selection tables.
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for expressions::valueTypeCode::INVALID.
Definition: exprTraits.C:127
A class for handling words, derived from Foam::string.
Definition: word.H:63
virtual bool write()
Write the component fields.
Definition: components.C:72
addToRunTimeSelectionTable(functionObject, ObukhovLength, dictionary)
components(const word &name, const Time &runTime, const dictionary &dict)
Construct from Time and dictionary.
Definition: components.C:60
Intermediate class for handling field expression function objects (e.g. blendingFactor etc...
virtual bool clear()
Clear the component fields from the objectRegistry.
Definition: components.C:85
Namespace for OpenFOAM.