cloudTemplates.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) 2025 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 "cloud.H"
27 #include "CloudDerivedField.H"
28 #include "CloudAverageField.H"
29 
30 // * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * //
31 
32 template<class Type>
34 (
35  const polyMesh& pMesh,
36  const word& name,
37  const contextType context,
38  const dictionary& dict,
41 )
42 {
43  return
45  (
46  new Type
47  (
48  mesh(pMesh, name, readOption, writeOption),
49  context,
50  dict
51  )
52  );
53 }
54 
55 
56 // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
57 
58 template<class Type, class ... Args>
60 (
61  const Args& ... args
62 ) const
63 {
65  derivedFields<Type>().append(ptr);
66  return *ptr;
67 }
68 
69 
70 template<class Type, class ... Args>
72 (
73  const Args& ... args
74 ) const
75 {
77  averageFields<Type>().append(ptr);
78  return *ptr;
79 }
80 
81 
82 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
A cloud field that is averaged and then interpolated back to the cloud. Uses CloudDerivedField to pro...
A field derived from other state fields of the cloud. Stores and virtualises a function or a method w...
readOption
Enumeration defining the read options.
Definition: IOobject.H:117
const word & name() const
Return name.
Definition: IOobject.H:307
writeOption
Enumeration defining the write options.
Definition: IOobject.H:126
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: autoPtr.H:51
contextType
Context in which this cloud is used.
Definition: cloud.H:203
static autoPtr< cloud > New(const polyMesh &mesh, const word &name, const contextType context, const dictionary &dict, const word &type, const IOobject::readOption readOption=IOobject::READ_IF_PRESENT, const IOobject::writeOption writeOption=IOobject::AUTO_WRITE)
Selectors.
Definition: cloud.C:524
const CloudDerivedField< Type > & derivedField(const Args &... args) const
Add/get a derived field to/from the cache.
const CloudAverageField< Type > & averageField(const Args &... args) const
Add/get an average field to/from the cache.
enum Foam::cloud::contextType context
const LagrangianMesh & mesh() const
Access the mesh.
Definition: cloud.H:280
A list of keywords followed by any number of values (e.g. words and numbers) or sub-dictionaries.
Definition: dictionary.H:162
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:78
A class for handling words, derived from string.
Definition: word.H:63
word name(const LagrangianState state)
Return a string representation of a Lagrangian state enumeration.
dictionary dict
Foam::argList args(argc, argv)