MeshedSurfaceIOAllocator.H 4.36 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

Class
28
    Foam::Detail::MeshedSurfaceIOAllocator
Mark Olesen's avatar
Mark Olesen committed
29 30

Description
31
    A helper class for storing points and faces with IO capabilities.
Mark Olesen's avatar
Mark Olesen committed
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47

SourceFiles
    MeshedSurfaceIOAllocator.C

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

#ifndef MeshedSurfaceIOAllocator_H
#define MeshedSurfaceIOAllocator_H

#include "pointIOField.H"
#include "faceIOList.H"

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

namespace Foam
{
48 49
namespace Detail
{
Mark Olesen's avatar
Mark Olesen committed
50 51

/*---------------------------------------------------------------------------*\
52
              Class Detail::MeshedSurfaceIOAllocator Declaration
Mark Olesen's avatar
Mark Olesen committed
53 54 55 56
\*---------------------------------------------------------------------------*/

class MeshedSurfaceIOAllocator
{
57
    // Private Data
Mark Olesen's avatar
Mark Olesen committed
58 59

        //- Points
Andrew Heather's avatar
Andrew Heather committed
60
        pointIOField points_;
Mark Olesen's avatar
Mark Olesen committed
61 62

        //- Faces
63
        faceCompactIOList faces_;
Mark Olesen's avatar
Mark Olesen committed
64

Andrew Heather's avatar
Andrew Heather committed
65

Mark Olesen's avatar
Mark Olesen committed
66 67
    // Private Member Functions

68
        //- No copy construct
69
        MeshedSurfaceIOAllocator(const MeshedSurfaceIOAllocator&) = delete;
Mark Olesen's avatar
Mark Olesen committed
70

71
        //- No copy assignment
72
        void operator=(const MeshedSurfaceIOAllocator&) = delete;
Mark Olesen's avatar
Mark Olesen committed
73

Andrew Heather's avatar
Andrew Heather committed
74

Mark Olesen's avatar
Mark Olesen committed
75 76 77 78 79 80 81 82
public:

    // Constructors

        //- Read construct from IOobjects
        MeshedSurfaceIOAllocator
        (
            const IOobject& ioPoints,
83
            const IOobject& ioFaces
Mark Olesen's avatar
Mark Olesen committed
84 85 86 87 88
        );

        //- Construct from IOobjects, copying components
        MeshedSurfaceIOAllocator
        (
89
            const IOobject& ioPoints, const pointField& points,
90
            const IOobject& ioFaces,  const faceList& faces
Mark Olesen's avatar
Mark Olesen committed
91 92
        );

93
        //- Construct from IOobjects, moving components
Mark Olesen's avatar
Mark Olesen committed
94 95
        MeshedSurfaceIOAllocator
        (
96
            const IOobject& ioPoints, pointField&& points,
97
            const IOobject& ioFaces,  faceList&& faces
Mark Olesen's avatar
Mark Olesen committed
98 99 100
        );


101 102 103 104
    //- Destructor
    virtual ~MeshedSurfaceIOAllocator();


Mark Olesen's avatar
Mark Olesen committed
105 106
    // Member Functions

107 108 109 110 111 112 113 114 115
    // Database

        //- Set the instance for mesh files
        void setInstance(const fileName& inst);

        //- Adjust the write option for all components
        void setWriteOption(IOobject::writeOption wOpt);


116
    // Access
117

118 119 120 121 122
        //- Non-const access to the points
        pointIOField& storedIOPoints()
        {
            return points_;
        }
123

124 125 126 127 128
        //- Non-const access to the faces
        faceCompactIOList& storedIOFaces()
        {
            return faces_;
        }
129

130 131 132 133 134
        //- Const access to the points
        const pointIOField& storedIOPoints() const
        {
            return points_;
        }
135

136 137 138 139 140
        //- Const access to the faces
        const faceCompactIOList& storedIOFaces() const
        {
            return faces_;
        }
141 142


143
    // Storage Management
144

145
        //- Clear primitive data (points, faces)
146
        void clear();
147 148


149 150 151 152 153 154 155 156
    // Writing

        //- Write using stream options
        virtual bool writeObject
        (
            IOstreamOption streamOpt,
            const bool valid
        ) const;
Mark Olesen's avatar
Mark Olesen committed
157 158 159 160 161
};


// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

162
} // End namespace Detail
Mark Olesen's avatar
Mark Olesen committed
163 164 165 166 167 168 169
} // End namespace Foam

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

#endif

// ************************************************************************* //