Loading...
Searching...
No Matches
lumpedPointIOMovement.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) 2016-2022 OpenCFD Ltd.
9-------------------------------------------------------------------------------
10License
11 This file is part of OpenFOAM.
12
13 OpenFOAM is free software: you can redistribute it and/or modify it
14 under the terms of the GNU General Public License as published by
15 the Free Software Foundation, either version 3 of the License, or
16 (at your option) any later version.
17
18 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21 for more details.
22
23 You should have received a copy of the GNU General Public License
24 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25
26\*---------------------------------------------------------------------------*/
27
29#include "Time.H"
30
31// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
32
33namespace Foam
34{
35 defineTypeName(lumpedPointIOMovement);
36}
37
38
39// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
40
43{
68 ),
69 ownerId // tag this patch as owner too
70 );
71}
72
73
74// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
75
76Foam::lumpedPointIOMovement::lumpedPointIOMovement
77(
78 const IOobject& io,
79 label ownerId
80)
81:
84{
85 if (isReadRequired())
86 {
87 bool ok = readData(readStream(typeName));
88 close();
89
90 if (ok)
91 {
92 this->ownerId(ownerId);
93 }
94 }
95}
96
97
98// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
99
101{
102 dictionary dict(is);
104 readDict(dict);
105
106 return is.check(FUNCTION_NAME);
107}
108
109
111{
112 os << *this;
113 return os.good();
114}
115
116
117// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
118
119Foam::Ostream& Foam::operator<<(Ostream& os, const lumpedPointIOMovement& obj)
120{
121 obj.writeDict(os);
122
123 os.check(FUNCTION_NAME);
124 return os;
125}
126
127
128// ************************************************************************* //
@ REGISTER
Request registration (bool: true).
bool isReadRequired() const noexcept
True if (MUST_READ | READ_MODIFIED) bits are set.
@ MUST_READ
Reading required.
@ NO_WRITE
Ignore writing from objectRegistry::writeObject().
Defines the attributes of an object for which implicit objectRegistry management is supported,...
Definition IOobject.H:191
virtual bool check(const char *operation) const
Check IOstream status for given operation.
Definition IOstream.C:45
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition Istream.H:60
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition Ostream.H:59
fileName caseSystem() const
Return the system name for the case, which is ../system() for parallel runs.
Definition TimePathsI.H:154
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition autoPtr.H:65
static autoPtr< T > New(Args &&... args)
Construct autoPtr with forwarding arguments.
Definition autoPtr.H:178
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition dictionary.H:133
IO-registered version of lumpedPointMovement.
static autoPtr< lumpedPointIOMovement > New(const objectRegistry &obr, label ownerId=-1)
Create a movement object in the registry by reading system dictionary.
bool writeData(Ostream &os) const
The writeData member function required by regIOobject.
static lumpedPointIOMovement * getMovementObject(const objectRegistry &obr)
Find the movement object or nullptr if not found.
bool readData(Istream &is)
The readData member function used by regIOobject.
The movement driver that describes initial point locations, the current state of the points/rotations...
static const word canonicalName
The canonical name ("lumpedPointMovement") for the dictionary.
void readDict(const dictionary &dict)
Update settings from dictionary.
label ownerId() const
An owner Id, if needed for bookkeeping purposes.
void writeDict(Ostream &os) const
Write axis, locations, division as a dictionary.
Registry of regIOobjects.
const Time & time() const noexcept
Return time registry.
Type * getObjectPtr(const word &name, const bool recursive=false) const
Return non-const pointer to the object of the given Type, using a const-cast to have it behave like a...
regIOobject is an abstract class derived from IOobject to handle automatic object registration with t...
Definition regIOobject.H:71
void close()
Close Istream.
regIOobject(const IOobject &io, const bool isTimeObject=false)
Construct from IOobject. The optional flag adds special handling if the object is the top-level regIO...
Definition regIOobject.C:43
#define defineTypeName(Type)
Define the typeName.
Definition className.H:113
OBJstream os(runTime.globalPath()/outputName)
const auto & io
#define FUNCTION_NAME
Namespace for OpenFOAM.
Ostream & operator<<(Ostream &, const boundaryPatch &p)
Write boundaryPatch as dictionary entries (without surrounding braces).
const word GlobalIOList< Tuple2< scalar, vector > >::typeName("scalarVectorTable")
dictionary dict