cloud.H 5.32 KB
Newer Older
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-2019 OpenCFD Ltd.
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.
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/>.
26 27 28 29 30

Class
    Foam::cloud

Description
31
    A cloud is a registry collection of lagrangian particles.
32 33 34 35 36 37 38 39 40 41

SourceFiles
    cloud.C

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

#ifndef cloud_H
#define cloud_H

#include "objectRegistry.H"
42
#include "Enum.H"
43
#include "point.H"
44
#include "IOField.H"
45 46 47 48 49 50

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

namespace Foam
{

51
// Forward Declarations
52 53 54
class mapPolyMesh;

/*---------------------------------------------------------------------------*\
Mark Olesen's avatar
Mark Olesen committed
55
                            Class cloud Declaration
56 57 58 59 60 61 62 63 64
\*---------------------------------------------------------------------------*/

class cloud
:
    public objectRegistry
{

    // Private Member Functions

65
        //- No copy construct
66
        cloud(const cloud&) = delete;
67

68
        //- No copy assignment
69
        void operator=(const cloud&) = delete;
70 71 72 73


public:

74 75 76 77 78 79 80 81 82 83
    //- Cloud geometry type (internal or IO representations)
    enum class geometryType
    {
        COORDINATES,    //!< barycentric coordinates
        POSITIONS       //!< positions
    };

    static const Enum<geometryType> geometryTypeNames;


84 85 86
    //- Runtime type information
    TypeName("cloud");

87 88
        //- The prefix to local: %lagrangian
        static const word prefix;
Mark Olesen's avatar
Mark Olesen committed
89 90 91

        //- The default cloud name: %defaultCloud
        static word defaultName;
92

Andrew Heather's avatar
Andrew Heather committed
93

94 95
    // Constructors

96 97 98 99 100
        //- Construct for given objectRegistry and default cloud name
        explicit cloud(const objectRegistry& obr);

        //- Construct for given objectRegistry and named cloud instance
        cloud(const objectRegistry& obr, const word& cloudName);
101 102


Andrew Heather's avatar
Andrew Heather committed
103
    //- Destructor
104
    virtual ~cloud() = default;
105 106 107 108


    // Member Functions

109 110 111 112 113 114
        // Sizes

            //- Number of parcels for the hosting cloud
            virtual label nParcels() const;


115 116 117
        // Edit

            //- Remap the cells of particles corresponding to the
118
            //- mesh topology change
119
            virtual void autoMap(const mapPolyMesh&);
120 121 122 123 124


        // I-O

            //- Read particle fields from objects in the obr registry
125
            virtual void readObjects(const objectRegistry& obr);
126 127 128 129 130 131 132 133 134 135 136 137

            //- Write particle fields as objects into the obr registry
            virtual void writeObjects(objectRegistry& obr) const;

            //- Helper to construct IOField on a supplied object registry
            template<class Type>
            static IOField<Type>& createIOField
            (
                const word& fieldName,
                const label nParticle,
                objectRegistry& obr
            );
138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171

            //- Locate an IOField within object registry
            //  \return nullptr if not found or wrong type
            template<class Type>
            inline static const IOField<Type>* findIOField
            (
                const word& fieldName,
                const objectRegistry& obr
            )
            {
                return obr.cfindObject<IOField<Type>>(fieldName);
            }

            //- Locate the "position" IOField within object registry
            //  \return nullptr if not found or wrong type
            inline static const IOField<point>* findIOPosition
            (
                const objectRegistry& obr
            )
            {
                return obr.cfindObject<IOField<point>>("position");
            }

            //- Lookup an IOField within object registry
            //  Fatal if not found or wrong type
            template<class Type>
            inline static const IOField<Type>& lookupIOField
            (
                const word& fieldName,
                const objectRegistry& obr
            )
            {
                return obr.lookupObject<IOField<Type>>(fieldName);
            }
172 173 174 175 176 177 178 179 180
};


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

} // End namespace Foam

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

181 182 183 184 185 186
#ifdef NoRepository
    #include "cloudTemplates.C"
#endif

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

187 188 189
#endif

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