MeshedSurfaceIOAllocator.C 3.01 KB
Newer Older
Mark Olesen's avatar
Mark Olesen committed
1 2 3 4
/*---------------------------------------------------------------------------*\
  =========                 |
  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
   \\    /   O peration     |
OpenFOAM bot's avatar
OpenFOAM bot committed
5
    \\  /    A nd           | www.openfoam.com
OpenFOAM bot's avatar
OpenFOAM bot committed
6 7
     \\/     M anipulation  |
-------------------------------------------------------------------------------
OpenFOAM bot's avatar
OpenFOAM bot committed
8
    Copyright (C) 2011-2016 OpenFOAM Foundation
9
    Copyright (C) 2016-2020 OpenCFD Ltd.
Mark Olesen's avatar
Mark Olesen committed
10 11 12 13
-------------------------------------------------------------------------------
License
    This file is part of OpenFOAM.

14 15 16 17
    OpenFOAM is free software: you can redistribute it and/or modify it
    under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.
Mark Olesen's avatar
Mark Olesen committed
18 19 20 21 22 23 24

    OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    for more details.

    You should have received a copy of the GNU General Public License
25
    along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
Mark Olesen's avatar
Mark Olesen committed
26 27 28 29 30 31 32

\*---------------------------------------------------------------------------*/

#include "MeshedSurfaceIOAllocator.H"

// * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //

33
Foam::Detail::MeshedSurfaceIOAllocator::MeshedSurfaceIOAllocator
Mark Olesen's avatar
Mark Olesen committed
34 35
(
    const IOobject& ioPoints,
36
    const IOobject& ioFaces
Mark Olesen's avatar
Mark Olesen committed
37 38 39
)
:
    points_(ioPoints),
40
    faces_(ioFaces)
Mark Olesen's avatar
Mark Olesen committed
41 42 43
{}


44
Foam::Detail::MeshedSurfaceIOAllocator::MeshedSurfaceIOAllocator
Mark Olesen's avatar
Mark Olesen committed
45
(
46
    const IOobject& ioPoints, const pointField& points,
47
    const IOobject& ioFaces,  const faceList& faces
Mark Olesen's avatar
Mark Olesen committed
48 49 50
)
:
    points_(ioPoints, points),
51
    faces_(ioFaces, faces)
Mark Olesen's avatar
Mark Olesen committed
52 53 54
{}


55
Foam::Detail::MeshedSurfaceIOAllocator::MeshedSurfaceIOAllocator
Mark Olesen's avatar
Mark Olesen committed
56
(
57
    const IOobject& ioPoints, pointField&& points,
58
    const IOobject& ioFaces,  faceList&& faces
Mark Olesen's avatar
Mark Olesen committed
59 60
)
:
61
    points_(ioPoints, std::move(points)),
62
    faces_(ioFaces, std::move(faces))
Mark Olesen's avatar
Mark Olesen committed
63 64 65
{}


66 67
// * * * * * * * * * * * * * * * * Destructor  * * * * * * * * * * * * * * * //

68
Foam::Detail::MeshedSurfaceIOAllocator::~MeshedSurfaceIOAllocator()
69 70 71 72 73
{
    clear();
}


Mark Olesen's avatar
Mark Olesen committed
74 75
// * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //

76 77 78 79
void Foam::Detail::MeshedSurfaceIOAllocator::setInstance
(
    const fileName& inst
)
80 81 82 83 84 85
{
    points_.instance() = inst;
    faces_.instance()  = inst;
}


86 87 88 89
void Foam::Detail::MeshedSurfaceIOAllocator::setWriteOption
(
    IOobject::writeOption wOpt
)
90
{
91 92
    points_.writeOpt() = wOpt;
    faces_.writeOpt()  = wOpt;
93 94 95
}


96
void Foam::Detail::MeshedSurfaceIOAllocator::clear()
Mark Olesen's avatar
Mark Olesen committed
97 98 99 100 101 102
{
    points_.clear();
    faces_.clear();
}


103
bool Foam::Detail::MeshedSurfaceIOAllocator::writeObject
104
(
105
    IOstreamOption streamOpt,
106
    const bool valid
107 108 109 110
) const
{
    return
    (
111 112
        points_.writeObject(streamOpt, valid)
     && faces_.writeObject(streamOpt, valid)
113 114 115 116
    );
}


Mark Olesen's avatar
Mark Olesen committed
117
// ************************************************************************* //