LagrangianSubMeshTemplates.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 "LagrangianSubFieldsFwd.H"
27 #include "LagrangianSubMesh.H"
28 
29 // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
30 
31 template<class Type>
33 (
34  const List<Type>& list
35 ) const
36 {
37  return SubList<Type>(list, size(), start());
38 }
39 
40 
41 template<class Type>
43 (
44  const Field<Type>& field
45 ) const
46 {
47  return SubField<Type>(sub(static_cast<const List<Type>&>(field)));
48 }
49 
50 
51 template<class Type, template<class> class PrimitiveField>
54 (
56 ) const
57 {
58  const word subFieldName = field.name() + ':' + name(group());
59 
61  (
63  (
64  IOobject
65  (
66  subFieldName,
67  field.instance(),
68  field.local(),
69  field.db(),
72  field.db().cacheTemporaryObject(subFieldName)
73  ),
74  *this,
75  field.dimensions(),
76  sub(static_cast<const Field<Type>&>(field))
77  )
78  );
79 }
80 
81 
82 // ************************************************************************* //
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
const dimensionSet & dimensions() const
Return dimensions.
Pre-declare SubField and related Field type.
Definition: Field.H:83
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
Definition: IOobject.H:99
const fileName & local() const
Definition: IOobject.H:400
fileName & instance() const
Return the instance directory, constant, system, <time> etc.
Definition: IOobject.C:352
const objectRegistry & db() const
Return the local objectRegistry.
Definition: IOobject.C:309
const word & name() const
Return name.
Definition: IOobject.H:307
SubList< Type > sub(const List< Type > &list) const
Return a sub-list corresponding to this sub-mesh.
label size() const
Return size.
label start() const
Return start.
Pre-declare related SubField type.
Definition: SubField.H:63
bool cacheTemporaryObject(const word &name) const
Return true if given name is in the cacheTemporaryObjects set.
A class for managing temporary objects.
Definition: tmp.H:55
A class for handling words, derived from string.
Definition: word.H:62
const char *const group
Group name for atomic constants.
word name(const LagrangianState state)
Return a string representation of a Lagrangian state enumeration.