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-2020 OpenCFD Ltd.
9 -------------------------------------------------------------------------------
10 License
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 
28 #include "lumpedPointIOMovement.H"
29 #include "Time.H"
30 
31 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
32 
33 namespace Foam
34 {
35  defineTypeName(lumpedPointIOMovement);
36 }
37 
38 
39 // * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
40 
43 {
45  (
47  );
48 }
49 
50 
53 (
54  const objectRegistry& obr,
55  label ownerId
56 )
57 {
59  (
60  IOobject
61  (
63  obr.time().caseSystem(),
64  obr,
67  true // register object
68  ),
69  ownerId // tag this patch as owner too
70  );
71 }
72 
73 
74 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
75 
76 Foam::lumpedPointIOMovement::lumpedPointIOMovement
77 (
78  const IOobject& io,
79  label ownerId
80 )
81 :
83  regIOobject(io)
84 {
85  bool ok =
86  (
87  readOpt() == IOobject::MUST_READ
88  || readOpt() == IOobject::MUST_READ_IF_MODIFIED
89  );
90 
91  if (ok)
92  {
93  ok = readData(readStream(typeName));
94  close();
95 
96  if (ok)
97  {
98  this->ownerId(ownerId);
99  }
100  }
101 }
102 
103 
104 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
105 
107 {
108  dictionary dict(is);
109 
110  readDict(dict);
111 
112  return is.check(FUNCTION_NAME);
113 }
114 
115 
117 {
118  os << *this;
119  return os.good();
120 }
121 
122 
123 // * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
124 
126 {
127  obj.writeDict(os);
128 
130  return os;
131 }
132 
133 
134 // ************************************************************************* //
Foam::IOobject::NO_WRITE
Definition: IOobject.H:195
Foam::autoPtr::New
static autoPtr< T > New(Args &&... args)
Construct autoPtr of T with forwarding arguments.
Foam::objectRegistry::getObjectPtr
Type * getObjectPtr(const word &name, const bool recursive=false) const
Definition: objectRegistryTemplates.C:423
Foam::IOobject
Defines the attributes of an object for which implicit objectRegistry management is supported,...
Definition: IOobject.H:169
Foam::lumpedPointMovement::writeDict
void writeDict(Ostream &os) const
Write axis, locations, division as a dictionary.
Definition: lumpedPointMovement.C:1127
Foam::lumpedPointIOMovement
IO-registered version of lumpedPointMovement.
Definition: lumpedPointIOMovement.H:52
Foam::TimePaths::caseSystem
fileName caseSystem() const
Definition: TimePathsI.H:119
Foam::IOstream::good
bool good() const noexcept
True if next operation might succeed.
Definition: IOstream.H:233
Foam::objectRegistry
Registry of regIOobjects.
Definition: objectRegistry.H:60
Foam::operator<<
Ostream & operator<<(Ostream &, const boundaryPatch &p)
Write boundaryPatch as dictionary entries (without surrounding braces)
Definition: boundaryPatch.C:83
Foam::Istream
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition: Istream.H:61
Foam::defineTypeName
defineTypeName(ensightPart)
Foam::lumpedPointIOMovement::writeData
bool writeData(Ostream &os) const
The writeData member function required by regIOobject.
Definition: lumpedPointIOMovement.C:116
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::IOstream::check
virtual bool check(const char *operation) const
Check IOstream status for given operation.
Definition: IOstream.C:58
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:123
Foam::lumpedPointMovement::canonicalName
static const word canonicalName
The canonical name ("lumpedPointMovement") for the dictionary.
Definition: lumpedPointMovement.H:385
os
OBJstream os(runTime.globalPath()/outputName)
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
lumpedPointIOMovement.H
Foam::lumpedPointIOMovement::getMovementObject
static lumpedPointIOMovement * getMovementObject(const objectRegistry &obr)
Find the movement object or nullptr if not found.
Definition: lumpedPointIOMovement.C:42
Time.H
Foam::autoPtr
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: HashPtrTable.H:53
Foam::regIOobject
regIOobject is an abstract class derived from IOobject to handle automatic object registration with t...
Definition: regIOobject.H:73
Foam::lumpedPointIOMovement::readData
bool readData(Istream &is)
The readData member function used by regIOobject.
Definition: lumpedPointIOMovement.C:106
Foam::lumpedPointMovement
The movement driver that describes initial point locations, the current state of the points/rotations...
Definition: lumpedPointMovement.H:269
Foam::IOobject::MUST_READ_IF_MODIFIED
Definition: IOobject.H:186
FUNCTION_NAME
#define FUNCTION_NAME
Definition: messageStream.H:295
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:56
Foam::objectRegistry::time
const Time & time() const noexcept
Return time registry.
Definition: objectRegistry.H:178
Foam::lumpedPointIOMovement::New
static autoPtr< lumpedPointIOMovement > New(const objectRegistry &obr, label ownerId=-1)
Definition: lumpedPointIOMovement.C:53
Foam::IOobject::MUST_READ
Definition: IOobject.H:185