topoDistanceData.H 6.51 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
6
     \\/     M anipulation  |
OpenFOAM bot's avatar
OpenFOAM bot committed
7
-------------------------------------------------------------------------------
OpenFOAM bot's avatar
OpenFOAM bot committed
8
    Copyright (C) 2011-2016 OpenFOAM Foundation
9
    Copyright (C) 2019-2020 OpenCFD Ltd.
10 11 12 13
-------------------------------------------------------------------------------
License
    This file is part of OpenFOAM.

Andrew Heather's avatar
Andrew Heather committed
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
Andrew Heather's avatar
Andrew Heather committed
25
    along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49

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
{

50
// Forward Declarations
51 52
class polyPatch;
class polyMesh;
53 54 55 56 57
class topoDistanceData;

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

58
/*---------------------------------------------------------------------------*\
59
                      Class topoDistanceData Declaration
60 61 62 63
\*---------------------------------------------------------------------------*/

class topoDistanceData
{
64
    // Private Data
65 66 67 68 69 70 71 72 73 74 75 76

        //- Starting data
        label data_;

        //- Distance
        label distance_;


public:

    // Constructors

77
        //- Default construct, with invalid (-1) for data and distance
78 79
        inline topoDistanceData();

80
        //- Construct from components
81 82 83 84 85 86 87 88 89 90 91
        inline topoDistanceData
        (
            const label data,
            const label distance
        );


    // Member Functions

        // Access

92
            label data() const
93 94 95
            {
                return data_;
            }
96 97

            label distance() const
98 99 100 101 102 103 104
            {
                return distance_;
            }


        // Needed by FaceCellWave

105
            //- Changed or contains original (invalid) value
106 107
            template<class TrackingData>
            inline bool valid(TrackingData& td) const;
108

109
            //- Check for identical geometrical data (eg, cyclics checking)
110
            template<class TrackingData>
111 112 113 114
            inline bool sameGeometry
            (
                const polyMesh&,
                const topoDistanceData&,
115 116
                const scalar,
                TrackingData& td
117 118 119 120
            ) const;

            //- Convert any absolute coordinates into relative to (patch)face
            //  centre
121
            template<class TrackingData>
122 123 124 125
            inline void leaveDomain
            (
                const polyMesh&,
                const polyPatch&,
126
                const label patchFacei,
127 128
                const point& faceCentre,
                TrackingData& td
129 130 131
            );

            //- Reverse of leaveDomain
132
            template<class TrackingData>
133 134 135 136
            inline void enterDomain
            (
                const polyMesh&,
                const polyPatch&,
137
                const label patchFacei,
138 139
                const point& faceCentre,
                TrackingData& td
140 141 142
            );

            //- Apply rotation matrix to any coordinates
143
            template<class TrackingData>
144 145 146
            inline void transform
            (
                const polyMesh&,
147 148
                const tensor&,
                TrackingData& td
149 150 151
            );

            //- Influence of neighbouring face.
152
            template<class TrackingData>
153 154 155
            inline bool updateCell
            (
                const polyMesh&,
156 157
                const label thisCelli,
                const label neighbourFacei,
158
                const topoDistanceData& neighbourInfo,
159 160
                const scalar tol,
                TrackingData& td
161 162 163
            );

            //- Influence of neighbouring cell.
164
            template<class TrackingData>
165 166 167
            inline bool updateFace
            (
                const polyMesh&,
168 169
                const label thisFacei,
                const label neighbourCelli,
170
                const topoDistanceData& neighbourInfo,
171 172
                const scalar tol,
                TrackingData& td
173 174 175
            );

            //- Influence of different value on same face.
176
            template<class TrackingData>
177 178 179
            inline bool updateFace
            (
                const polyMesh&,
180
                const label thisFacei,
181
                const topoDistanceData& neighbourInfo,
182 183
                const scalar tol,
                TrackingData& td
184 185
            );

186
            //- Test for equality, with TrackingData
187 188 189
            template<class TrackingData>
            inline bool equal(const topoDistanceData&, TrackingData& td) const;

190

191 192
    // Member Operators

193
        //- Test for equality
194 195
        inline bool operator==(const topoDistanceData&) const;

196
        //- Test for inequality
197 198 199 200 201 202 203 204 205 206
        inline bool operator!=(const topoDistanceData&) const;


    // IOstream Operators

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


207 208 209 210 211 212 213
// * * * * * * * * * * * * * * * * * Traits  * * * * * * * * * * * * * * * * //

//- Contiguous data for topoDistanceData
template<> struct is_contiguous<topoDistanceData> : std::true_type {};

//- Contiguous label data for topoDistanceData
template<> struct is_contiguous_label<topoDistanceData> : std::true_type {};
214 215


216 217 218 219 220 221 222 223 224 225 226 227 228
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

} // End namespace Foam

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

#include "topoDistanceDataI.H"

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

#endif

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