MeshedSurfaceIOAllocator.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) 2011-2016 OpenFOAM Foundation
9  Copyright (C) 2016-2021 OpenCFD Ltd.
10 -------------------------------------------------------------------------------
11 License
12  This file is part of OpenFOAM.
13 
14  OpenFOAM is free software: you can redistribute it and/or modify it
15  under the terms of the GNU General Public License as published by
16  the Free Software Foundation, either version 3 of the License, or
17  (at your option) any later version.
18 
19  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22  for more details.
23 
24  You should have received a copy of the GNU General Public License
25  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26 
27 \*---------------------------------------------------------------------------*/
28 
30 
31 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
32 
33 Foam::Detail::MeshedSurfaceIOAllocator::MeshedSurfaceIOAllocator
34 (
35  const IOobject& ioPoints,
36  const IOobject& ioFaces
37 )
38 :
39  points_(ioPoints),
40  faces_(ioFaces)
41 {}
42 
43 
44 Foam::Detail::MeshedSurfaceIOAllocator::MeshedSurfaceIOAllocator
45 (
46  const IOobject& ioPoints, const pointField& points,
47  const IOobject& ioFaces, const faceList& faces
48 )
49 :
50  points_(ioPoints, points),
51  faces_(ioFaces, faces)
52 {}
53 
54 
55 Foam::Detail::MeshedSurfaceIOAllocator::MeshedSurfaceIOAllocator
56 (
57  const IOobject& ioPoints, pointField&& points,
58  const IOobject& ioFaces, faceList&& faces
59 )
60 :
61  points_(ioPoints, std::move(points)),
62  faces_(ioFaces, std::move(faces))
63 {}
64 
65 
66 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
67 
69 {
70  clear();
71 }
72 
73 
74 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
75 
77 (
78  const fileName& inst
79 )
80 {
81  points_.instance() = inst;
82  faces_.instance() = inst;
83 }
84 
85 
87 (
89 )
90 {
91  points_.writeOpt(wOpt);
92  faces_.writeOpt(wOpt);
93 }
94 
95 
97 {
98  points_.clear();
99  faces_.clear();
100 }
101 
102 
104 (
105  IOstreamOption streamOpt,
106  const bool valid
107 ) const
108 {
109  return
110  (
111  points_.writeObject(streamOpt, valid)
112  && faces_.writeObject(streamOpt, valid)
113  );
114 }
115 
116 
117 // ************************************************************************* //
Foam::IOobject
Defines the attributes of an object for which implicit objectRegistry management is supported,...
Definition: IOobject.H:169
Foam::fileName
A class for handling file names.
Definition: fileName.H:73
Foam::Detail::MeshedSurfaceIOAllocator::~MeshedSurfaceIOAllocator
virtual ~MeshedSurfaceIOAllocator()
Destructor.
Definition: MeshedSurfaceIOAllocator.C:68
Foam::IOobject::writeOption
writeOption
Enumeration defining the write options.
Definition: IOobject.H:192
Foam::Field< vector >
Foam::IOstreamOption
The IOstreamOption is a simple container for options an IOstream can normally have.
Definition: IOstreamOption.H:63
Foam::Detail::MeshedSurfaceIOAllocator::setWriteOption
void setWriteOption(IOobject::writeOption wOpt)
Adjust the write option for all components.
Definition: MeshedSurfaceIOAllocator.C:87
Foam::Detail::MeshedSurfaceIOAllocator::clear
void clear()
Clear primitive data (points, faces)
Definition: MeshedSurfaceIOAllocator.C:96
Foam::List< face >
points
const pointField & points
Definition: gmvOutputHeader.H:1
Foam::Detail::MeshedSurfaceIOAllocator::writeObject
virtual bool writeObject(IOstreamOption streamOpt, const bool valid) const
Write using stream options.
Definition: MeshedSurfaceIOAllocator.C:104
MeshedSurfaceIOAllocator.H
Foam::Detail::MeshedSurfaceIOAllocator::setInstance
void setInstance(const fileName &inst)
Set the instance for mesh files.
Definition: MeshedSurfaceIOAllocator.C:77