Skip to content
Snippets Groups Projects
MeshedSurfaceIOAllocator.H 4.36 KiB
Newer Older
  • Learn to ignore specific revisions
  • Mark Olesen's avatar
    Mark Olesen committed
    /*---------------------------------------------------------------------------*\
      =========                 |
      \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
       \\    /   O peration     |
    
    OpenFOAM bot's avatar
    OpenFOAM bot committed
        \\  /    A nd           | www.openfoam.com
    
         \\/     M anipulation  |
    -------------------------------------------------------------------------------
    
    OpenFOAM bot's avatar
    OpenFOAM bot committed
        Copyright (C) 2011-2016 OpenFOAM Foundation
    
        Copyright (C) 2016-2020 OpenCFD Ltd.
    
    Mark Olesen's avatar
    Mark Olesen committed
    -------------------------------------------------------------------------------
    License
        This file is part of OpenFOAM.
    
    
        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
    
        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
    
        along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
    
    Mark Olesen's avatar
    Mark Olesen committed
    
    Class
    
        Foam::Detail::MeshedSurfaceIOAllocator
    
    Mark Olesen's avatar
    Mark Olesen committed
    
    Description
    
        A helper class for storing points and faces with IO capabilities.
    
    Mark Olesen's avatar
    Mark Olesen committed
    
    SourceFiles
        MeshedSurfaceIOAllocator.C
    
    \*---------------------------------------------------------------------------*/
    
    #ifndef MeshedSurfaceIOAllocator_H
    #define MeshedSurfaceIOAllocator_H
    
    #include "pointIOField.H"
    #include "faceIOList.H"
    
    // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
    
    namespace Foam
    {
    
    Mark Olesen's avatar
    Mark Olesen committed
    
    /*---------------------------------------------------------------------------*\
    
                  Class Detail::MeshedSurfaceIOAllocator Declaration
    
    Mark Olesen's avatar
    Mark Olesen committed
    \*---------------------------------------------------------------------------*/
    
    class MeshedSurfaceIOAllocator
    {
    
    Mark Olesen's avatar
    Mark Olesen committed
    
            //- Points
    
    Andrew Heather's avatar
    Andrew Heather committed
            pointIOField points_;
    
    Mark Olesen's avatar
    Mark Olesen committed
    
            //- Faces
    
            faceCompactIOList faces_;
    
    Mark Olesen's avatar
    Mark Olesen committed
    
    
    Andrew Heather's avatar
    Andrew Heather committed
    
    
    Mark Olesen's avatar
    Mark Olesen committed
        // Private Member Functions
    
    
            MeshedSurfaceIOAllocator(const MeshedSurfaceIOAllocator&) = delete;
    
    Mark Olesen's avatar
    Mark Olesen committed
    
    
            void operator=(const MeshedSurfaceIOAllocator&) = delete;
    
    Mark Olesen's avatar
    Mark Olesen committed
    
    
    Andrew Heather's avatar
    Andrew Heather committed
    
    
    Mark Olesen's avatar
    Mark Olesen committed
    public:
    
        // Constructors
    
            //- Read construct from IOobjects
            MeshedSurfaceIOAllocator
            (
                const IOobject& ioPoints,
    
                const IOobject& ioFaces
    
    Mark Olesen's avatar
    Mark Olesen committed
            );
    
            //- Construct from IOobjects, copying components
            MeshedSurfaceIOAllocator
            (
    
                const IOobject& ioPoints, const pointField& points,
    
                const IOobject& ioFaces,  const faceList& faces
    
    Mark Olesen's avatar
    Mark Olesen committed
            );
    
    
            //- Construct from IOobjects, moving components
    
    Mark Olesen's avatar
    Mark Olesen committed
            MeshedSurfaceIOAllocator
            (
    
                const IOobject& ioPoints, pointField&& points,
    
                const IOobject& ioFaces,  faceList&& faces
    
        //- Destructor
        virtual ~MeshedSurfaceIOAllocator();
    
    
    
    Mark Olesen's avatar
    Mark Olesen committed
        // Member Functions
    
    
        // Database
    
            //- Set the instance for mesh files
            void setInstance(const fileName& inst);
    
            //- Adjust the write option for all components
            void setWriteOption(IOobject::writeOption wOpt);
    
    
    
            //- Non-const access to the points
            pointIOField& storedIOPoints()
            {
                return points_;
            }
    
            //- Non-const access to the faces
            faceCompactIOList& storedIOFaces()
            {
                return faces_;
            }
    
            //- Const access to the points
            const pointIOField& storedIOPoints() const
            {
                return points_;
            }
    
            //- Const access to the faces
            const faceCompactIOList& storedIOFaces() const
            {
                return faces_;
            }
    
            //- Clear primitive data (points, faces)
    
        // Writing
    
            //- Write using stream options
            virtual bool writeObject
            (
                IOstreamOption streamOpt,
                const bool valid
            ) const;
    
    Mark Olesen's avatar
    Mark Olesen committed
    };
    
    
    // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
    
    
    } // End namespace Detail
    
    Mark Olesen's avatar
    Mark Olesen committed
    } // End namespace Foam
    
    // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
    
    #endif
    
    // ************************************************************************* //