CloudFunctionObject.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) 2011-2019 OpenFOAM Foundation
9  Copyright (C) 2020 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 "CloudFunctionObject.H"
30 #include "functionObject.H"
31 
32 // * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * * //
33 
34 template<class CloudType>
36 {
38 }
39 
40 
41 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
42 
43 template<class CloudType>
45 :
47  outputDir_()
48 {}
49 
50 
51 template<class CloudType>
53 (
54  const dictionary& dict,
55  CloudType& owner,
56  const word& modelName,
57  const word& objectType
58 )
59 :
60  CloudSubModelBase<CloudType>(modelName, owner, dict, typeName, objectType),
61  outputDir_()
62 {
63  // Put in undecomposed case
64  // (Note: gives problems for distributed data running)
65 
66  outputDir_ =
67  (
70  / this->localPath()
71  );
72 
73  outputDir_.clean(); // Remove unneeded ".."
74 }
75 
76 
77 template<class CloudType>
79 (
81 )
82 :
84  outputDir_(ppm.outputDir_)
85 {}
86 
87 
88 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
89 
90 template<class CloudType>
92 (
93  const typename parcelType::trackingData& td
94 )
95 {}
96 
97 
98 template<class CloudType>
100 (
101  const typename parcelType::trackingData& td
102 )
103 {
104  if (this->owner().time().writeTime())
105  {
106  this->write();
107  }
108 }
109 
110 
111 template<class CloudType>
113 (
114  parcelType&,
115  const scalar,
116  const point&,
117  const typename parcelType::trackingData& td
118 )
119 {
120  return true;
121 }
122 
123 
124 template<class CloudType>
126 (
127  const parcelType&,
128  const polyPatch&,
129  const typename parcelType::trackingData& td
130 )
131 {
132  return true;
133 }
134 
135 
136 template<class CloudType>
138 (
139  const parcelType&,
140  const typename parcelType::trackingData& td
141 )
142 {
143  return true;
144 }
145 
146 
147 template<class CloudType>
149 {
150  return outputDir_;
151 }
152 
153 
154 template<class CloudType>
156 {
157  return outputDir_/this->owner().time().timeName();
158 }
159 
160 
161 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
162 
163 #include "CloudFunctionObjectNew.C"
164 
165 // ************************************************************************* //
virtual void postEvolve(const typename parcelType::trackingData &td)
Post-evolve hook.
dictionary dict
virtual void preEvolve(const typename parcelType::trackingData &td)
Pre-evolve hook.
A class for handling file names.
Definition: fileName.H:72
A list of keyword definitions, which are a keyword followed by a number of values (eg...
Definition: dictionary.H:129
Base class for cloud sub-models.
const Time & time() const
Return the top-level database.
Definition: fvMesh.H:360
const CloudType & owner() const
Return const access to the owner cloud.
virtual bool postPatch(const parcelType &p, const polyPatch &pp, const typename parcelType::trackingData &td)
Post-patch hook.
void write(vtk::formatter &fmt, const Type &val, const label n=1)
Component-wise write of a value (N times)
fileName writeTimeDir() const
Return the output time path.
fileName globalPath() const
Return global path for the case = rootPath/globalCaseName. Same as TimePaths::globalPath() ...
Definition: Time.H:512
A class for handling words, derived from Foam::string.
Definition: word.H:63
const Time & time() const noexcept
Return time registry.
virtual fileName localPath() const
Output directory.
static word timeName(const scalar t, const int precision=precision_)
Return a time name for the given scalar time value formatted with the given precision.
Definition: Time.C:714
static bool clean(std::string &str)
Cleanup filename string, possibly applies other transformations such as changing the path separator e...
Definition: fileName.C:192
const fileName & outputDir() const
Return the output path.
const fvMesh & mesh() const
Return reference to the mesh.
Definition: DSMCCloudI.H:37
vector point
Point is a vector.
Definition: point.H:37
virtual bool postFace(const parcelType &p, const typename parcelType::trackingData &td)
Post-face hook.
static word outputPrefix
Directory prefix.
A patch is a list of labels that address the faces in the global face list.
Definition: polyPatch.H:69
virtual bool postMove(parcelType &p, const scalar dt, const point &position0, const typename parcelType::trackingData &td)
Post-move hook.
CloudFunctionObject(CloudType &owner)
Construct null from owner.
#define NotImplemented
Issue a FatalErrorIn for a function not currently implemented.
Definition: error.H:686
Templated base class for dsmc cloud.
Definition: DSMCCloud.H:67
Templated cloud function object base class.