CloudFunctionObject.C
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
11  OpenFOAM is free software: you can redistribute it and/or modify it
12  under the terms of the GNU General Public License as published by
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
16  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19  for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 \*---------------------------------------------------------------------------*/
25 
26 #include "CloudFunctionObject.H"
27 
28 // * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * * //
29 
30 template<class CloudType>
32 {
34 }
35 
36 
37 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
38 
39 template<class CloudType>
41 :
43  outputDir_()
44 {}
45 
46 
47 template<class CloudType>
49 (
50  const dictionary& dict,
51  CloudType& owner,
52  const word& modelName,
53  const word& objectType
54 )
55 :
56  CloudSubModelBase<CloudType>(modelName, owner, dict, typeName, objectType),
57  outputDir_(owner.mesh().time().path())
58 {
59  const fileName relPath =
60  "postProcessing"/cloud::prefix/owner.name()/this->modelName();
61 
62 
63  if (Pstream::parRun())
64  {
65  // Put in undecomposed case (Note: gives problems for
66  // distributed data running)
67  outputDir_ = outputDir_/".."/relPath;
68  }
69  else
70  {
71  outputDir_ = outputDir_/relPath;
72  }
73  outputDir_.clean();
74 }
75 
76 
77 template<class CloudType>
79 (
81 )
82 :
84  outputDir_(ppm.outputDir_)
85 {}
86 
87 
88 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
89 
90 template<class CloudType>
92 {}
93 
94 
95 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
96 
97 template<class CloudType>
99 {}
100 
101 
102 template<class CloudType>
104 {
105  if (this->owner().time().writeTime())
106  {
107  this->write();
108  }
109 }
110 
111 
112 template<class CloudType>
114 (
115  typename CloudType::parcelType&,
116  const scalar,
117  const point&,
118  bool&
119 )
120 {}
121 
122 
123 template<class CloudType>
125 (
126  const typename CloudType::parcelType&,
127  const polyPatch&,
128  bool&
129 )
130 {}
131 
132 
133 template<class CloudType>
135 (
136  const typename CloudType::parcelType&,
137  bool&
138 )
139 {}
140 
141 
142 template<class CloudType>
144 {
145  return outputDir_;
146 }
147 
148 
149 template<class CloudType>
151 {
152  return outputDir_/this->owner().time().timeName();
153 }
154 
155 
156 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
157 
158 #include "CloudFunctionObjectNew.C"
159 
160 // ************************************************************************* //
A class for handling file names.
Definition: fileName.H:69
virtual void postMove(typename CloudType::parcelType &p, const scalar dt, const point &position0, bool &keepParticle)
Post-move hook.
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:137
bool clean()
Cleanup file name.
Definition: fileName.C:77
Base class for cloud sub-models.
static word timeName(const scalar, const int precision=precision_)
Return time name of given scalar time.
Definition: Time.C:626
virtual void preEvolve()
Pre-evolve hook.
virtual bool writeTime() const
Flag to indicate when to write a property.
const word & modelName() const
Return const access to the name of the sub-model.
Definition: subModelBase.C:104
const dictionary & dict() const
Return const access to the cloud dictionary.
Definition: subModelBase.C:110
const CloudType & owner() const
Return const access to the owner cloud.
fileName writeTimeDir() const
Return the output time path.
A class for handling words, derived from string.
Definition: word.H:59
virtual void postEvolve()
Post-evolve hook.
virtual void postPatch(const typename CloudType::parcelType &p, const polyPatch &pp, bool &keepParticle)
Post-patch hook.
ParcelType parcelType
Type of parcel the cloud was instantiated for.
Definition: DSMCCloud.H:218
const Time & time() const
Return time.
static const word prefix
The prefix to local: lagrangian.
Definition: cloud.H:71
virtual void postFace(const typename CloudType::parcelType &p, bool &keepParticle)
Post-face hook.
const fileName & outputDir() const
Return the output path.
static bool & parRun()
Is this a parallel run?
Definition: UPstream.H:397
A patch is a list of labels that address the faces in the global face list.
Definition: polyPatch.H:66
CloudFunctionObject(CloudType &owner)
Construct null from owner.
#define NotImplemented
Issue a FatalErrorIn for a function not currently implemented.
Definition: error.H:366
Templated base class for dsmc cloud.
Definition: DSMCCloud.H:69
Templated cloud function object base class.
virtual ~CloudFunctionObject()
Destructor.