IODynamicField.H
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 Class
25  Foam::IODynamicField
26 
27 Description
28  A dynamic field of type <Type> with automated input and output.
29 
30 \*---------------------------------------------------------------------------*/
31 
32 #ifndef IODynamicField_H
33 #define IODynamicField_H
34 
35 #include "IOList.H"
36 #include "DynamicField.H"
37 #include "OldTimeField.H"
38 
39 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
40 
41 namespace Foam
42 {
43 
44 template<class Type>
46 
47 template<class Type>
48 class IODynamicField;
49 
50 template<class Type>
52 {
53  typedef IODynamicField<Type> type;
54 };
55 
56 template<class Type>
58 {
59  template<template<class> class OtherPrimitiveField>
60  using type = IODynamicField<Type>;
61 };
62 
63 /*---------------------------------------------------------------------------*\
64  Class IODynamicField Declaration
65 \*---------------------------------------------------------------------------*/
66 
67 template<class Type>
68 class IODynamicField
69 :
70  public IOListBase<IODynamicFieldContainer, IODynamicField, Type>,
71  public OldTimeField<IODynamicField<Type>>
72 {
73  // Private Type Definitions
74 
75  //- The base IO list class
77 
78 
79 public:
80 
81  //- Runtime type information
82  TypeName("DynamicField");
83 
84 
85  // Constructors
86 
87  //- Forward construction
88  template<class ... Args>
89  IODynamicField(Args ... args)
90  :
91  Base(args ...),
92  OldTimeField<IODynamicField<Type>>(this->time().timeIndex())
93  {}
94 
95  //- Copy construct
96  IODynamicField(const IODynamicField& iodf)
97  :
98  Base(iodf),
99  OldTimeField<IODynamicField<Type>>(iodf)
100  {}
101 
102  //- Move construct
104  :
105  Base(std::move(iodf)),
106  OldTimeField<IODynamicField<Type>>(std::move(iodf))
107  {}
108 
109 
110  // Member Operators
111 
112  //- Copy-assign
113  void operator=(const IODynamicField<Type>& iodf)
114  {
115  Base::operator=(iodf);
116  }
117 
118  //- Move-assign
119  void operator=(IODynamicField<Type>&& iodf)
120  {
121  Base::operator=(std::move(iodf));
122  }
123 };
124 
125 
126 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
127 
128 } // End namespace Foam
129 
130 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
131 
132 #endif
133 
134 // ************************************************************************* //
Dynamically sized Field.
Definition: DynamicField.H:72
A dynamic field of type <Type> with automated input and output.
void operator=(const IODynamicField< Type > &iodf)
Copy-assign.
IODynamicField(Args ... args)
Forward construction.
TypeName("DynamicField")
Runtime type information.
void operator=(const IOListBase< IODynamicFieldContainer, IODynamicField, Type > &)
Assign to another IOList.
Definition: IOList.C:326
const Time & time() const
Return time.
Definition: IOobject.C:315
Class to add into field types to provide old-time storage and retrieval.
Definition: OldTimeField.H:113
label timeIndex() const
Return the time index of the field.
Definition: OldTimeFieldI.H:31
Namespace for OpenFOAM.
fileType type(const fileName &, const bool checkVariants=true, const bool followLink=true)
Return the file type: directory or file.
Definition: POSIX.C:488
Foam::argList args(argc, argv)