topoDistanceData.H 6.03 KB
Newer Older
1 2 3 4
/*---------------------------------------------------------------------------*\
  =========                 |
  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
   \\    /   O peration     |
5
    \\  /    A nd           | Copyright (C) 2011-2013 OpenFOAM Foundation
6 7 8 9 10
     \\/     M anipulation  |
-------------------------------------------------------------------------------
License
    This file is part of OpenFOAM.

Andrew Heather's avatar
Andrew Heather committed
11 12 13 14
    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.
15 16 17 18 19 20 21

    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
Andrew Heather's avatar
Andrew Heather committed
22
    along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98

Class
    Foam::topoDistanceData

Description
    For use with FaceCellWave. Determines topological distance to starting faces

SourceFiles
    topoDistanceDataI.H
    topoDistanceData.C

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

#ifndef topoDistanceData_H
#define topoDistanceData_H

#include "point.H"
#include "tensor.H"

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

namespace Foam
{

class polyPatch;
class polyMesh;

/*---------------------------------------------------------------------------*\
                           Class topoDistanceData Declaration
\*---------------------------------------------------------------------------*/

class topoDistanceData
{
    // Private data

        //- Starting data
        label data_;

        //- Distance
        label distance_;


public:

    // Constructors

        //- Construct null
        inline topoDistanceData();

        //- Construct from count
        inline topoDistanceData
        (
            const label data,
            const label distance
        );


    // Member Functions

        // Access


            inline label data() const
            {
                return data_;
            }
            inline label distance() const
            {
                return distance_;
            }


        // Needed by FaceCellWave

            //- Check whether origin has been changed at all or
            //  still contains original (invalid) value.
99 100
            template<class TrackingData>
            inline bool valid(TrackingData& td) const;
101 102

            //- Check for identical geometrical data. Used for cyclics checking.
103
            template<class TrackingData>
104 105 106 107
            inline bool sameGeometry
            (
                const polyMesh&,
                const topoDistanceData&,
108 109
                const scalar,
                TrackingData& td
110 111 112 113
            ) const;

            //- Convert any absolute coordinates into relative to (patch)face
            //  centre
114
            template<class TrackingData>
115 116 117 118 119
            inline void leaveDomain
            (
                const polyMesh&,
                const polyPatch&,
                const label patchFaceI,
120 121
                const point& faceCentre,
                TrackingData& td
122 123 124
            );

            //- Reverse of leaveDomain
125
            template<class TrackingData>
126 127 128 129 130
            inline void enterDomain
            (
                const polyMesh&,
                const polyPatch&,
                const label patchFaceI,
131 132
                const point& faceCentre,
                TrackingData& td
133 134 135
            );

            //- Apply rotation matrix to any coordinates
136
            template<class TrackingData>
137 138 139
            inline void transform
            (
                const polyMesh&,
140 141
                const tensor&,
                TrackingData& td
142 143 144
            );

            //- Influence of neighbouring face.
145
            template<class TrackingData>
146 147 148 149 150 151
            inline bool updateCell
            (
                const polyMesh&,
                const label thisCellI,
                const label neighbourFaceI,
                const topoDistanceData& neighbourInfo,
152 153
                const scalar tol,
                TrackingData& td
154 155 156
            );

            //- Influence of neighbouring cell.
157
            template<class TrackingData>
158 159 160 161 162 163
            inline bool updateFace
            (
                const polyMesh&,
                const label thisFaceI,
                const label neighbourCellI,
                const topoDistanceData& neighbourInfo,
164 165
                const scalar tol,
                TrackingData& td
166 167 168
            );

            //- Influence of different value on same face.
169
            template<class TrackingData>
170 171 172 173 174
            inline bool updateFace
            (
                const polyMesh&,
                const label thisFaceI,
                const topoDistanceData& neighbourInfo,
175 176
                const scalar tol,
                TrackingData& td
177 178
            );

179 180 181 182
            //- Same (like operator==)
            template<class TrackingData>
            inline bool equal(const topoDistanceData&, TrackingData& td) const;

183 184 185 186 187 188 189 190 191 192 193 194 195 196 197
    // Member Operators

        // Needed for List IO
        inline bool operator==(const topoDistanceData&) const;

        inline bool operator!=(const topoDistanceData&) const;


    // IOstream Operators

        friend Ostream& operator<<(Ostream&, const topoDistanceData&);
        friend Istream& operator>>(Istream&, topoDistanceData&);
};


198 199 200 201 202 203 204 205
//- Data associated with topoDistanceData type are contiguous
template<>
inline bool contiguous<topoDistanceData>()
{
    return true;
}


206 207 208 209 210 211 212 213 214 215 216 217 218
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

} // End namespace Foam

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

#include "topoDistanceDataI.H"

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

#endif

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