faceAreaWeightAMI.H 6.4 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 9
    Copyright (C) 2013-2016 OpenFOAM Foundation
    Copyright (C) 2016 OpenCFD Ltd.
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
-------------------------------------------------------------------------------
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.

    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/>.

Class
    Foam::faceAreaWeightAMI

Description
    Face area weighted Arbitrary Mesh Interface (AMI) method

SourceFiles
    faceAreaWeightAMI.C

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

#ifndef faceAreaWeightAMI_H
#define faceAreaWeightAMI_H

Andrew Heather's avatar
Andrew Heather committed
41
#include "advancingFrontAMI.H"
42 43 44 45 46 47 48 49 50 51 52 53

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

namespace Foam
{

/*---------------------------------------------------------------------------*\
                      Class faceAreaWeightAMI Declaration
\*---------------------------------------------------------------------------*/

class faceAreaWeightAMI
:
Andrew Heather's avatar
Andrew Heather committed
54
    public advancingFrontAMI
55
{
56 57 58 59 60 61 62
private:

    // Private data

        //- Flag to restart uncovered source faces
        const bool restartUncoveredSourceFace_;

63

64

65
protected:
66

67
    // Protected Member Functions
68

69 70
        //- No copy assignment
        void operator=(const faceAreaWeightAMI&) = delete;
71

72 73 74
        //- Initialise the geometry
        void initGeom
        (
Andrew Heather's avatar
Andrew Heather committed
75 76
            const primitivePatch& srcPatch,
            const primitivePatch& tgtPatch,
77 78 79 80 81
            const globalIndex& globalTgtFaces,
            labelList& extendedTgtFaceIDs
        );


82 83
        // Marching front

Andrew Heather's avatar
Andrew Heather committed
84 85
            //- Calculate addressing, weights and centroids using temporary
            //- storage
86 87
            virtual void calcAddressing
            (
88 89
                List<DynamicList<label>>& srcAddress,
                List<DynamicList<scalar>>& srcWeights,
Andrew Heather's avatar
Andrew Heather committed
90
                List<DynamicList<point>>& srcCentroids,
91 92
                List<DynamicList<label>>& tgtAddress,
                List<DynamicList<scalar>>& tgtWeights,
93 94
                label srcFacei,
                label tgtFacei
95 96
            );

97
            //- Determine overlap contributions for source face srcFacei
98
            virtual bool processSourceFace
99
            (
100 101
                const label srcFacei,
                const label tgtStartFacei,
102 103
                DynamicList<label>& nbrFaces,
                DynamicList<label>& visitedFaces,
104 105
                List<DynamicList<label>>& srcAddr,
                List<DynamicList<scalar>>& srcWght,
Andrew Heather's avatar
Andrew Heather committed
106
                List<DynamicList<point>>& srcCtr,
107 108
                List<DynamicList<label>>& tgtAddr,
                List<DynamicList<scalar>>& tgtWght
109 110 111
            );

            //- Attempt to re-evaluate source faces that have not been included
112
            virtual void restartUncoveredSourceFace
113
            (
114 115
                List<DynamicList<label>>& srcAddr,
                List<DynamicList<scalar>>& srcWght,
Andrew Heather's avatar
Andrew Heather committed
116
                List<DynamicList<point>>& srcCtr,
117 118
                List<DynamicList<label>>& tgtAddr,
                List<DynamicList<scalar>>& tgtWght
119 120 121
            );

            //- Set the source and target seed faces
Andrew Heather's avatar
Andrew Heather committed
122
            virtual bool setNextFaces
123
            (
124
                label& startSeedi,
125 126
                label& srcFacei,
                label& tgtFacei,
Andrew Heather's avatar
Andrew Heather committed
127
                const bitSet& mapFlag,
128
                labelList& seedFaces,
129
                const DynamicList<label>& visitedFaces,
Andrew Heather's avatar
Andrew Heather committed
130
                const bool errorOnNotFound = true
131 132 133 134 135 136
            ) const;


        // Evaluation

            //- Area of intersection between source and target faces
Andrew Heather's avatar
Andrew Heather committed
137
            virtual void calcInterArea
138
            (
139
                const label srcFacei,
Andrew Heather's avatar
Andrew Heather committed
140 141 142
                const label tgtFacei,
                scalar& area,
                vector& centroid
143 144
            ) const;

145 146 147 148 149 150 151 152
            //- Return true if faces overlap
            virtual bool overlaps
            (
                const label srcFacei,
                const label tgtFacei,
                const scalar threshold
            ) const;

153 154 155 156

public:

    //- Runtime type information
157
    TypeName("faceAreaWeightAMI");
158 159 160 161


    // Constructors

Andrew Heather's avatar
Andrew Heather committed
162 163 164 165 166 167 168
        //- Construct from dictionary
        faceAreaWeightAMI
        (
            const dictionary& dict,
            const bool reverseTarget = false
        );

169 170 171
        //- Construct from components
        faceAreaWeightAMI
        (
Andrew Heather's avatar
Andrew Heather committed
172
            const bool requireMatch,
173
            const bool reverseTarget = false,
Andrew Heather's avatar
Andrew Heather committed
174 175 176
            const scalar lowWeightCorrection = -1,
            const faceAreaIntersect::triangulationMode triMode =
                faceAreaIntersect::tmMesh,
177
            const bool restartUncoveredSourceFace = true
178 179
        );

Andrew Heather's avatar
Andrew Heather committed
180 181 182 183 184 185 186 187 188
        //- Construct as copy
        faceAreaWeightAMI(const faceAreaWeightAMI& ami);

        //- Construct and return a clone
        virtual autoPtr<AMIInterpolation> clone() const
        {
            return autoPtr<AMIInterpolation>(new faceAreaWeightAMI(*this));
        }

189 190

    //- Destructor
Andrew Heather's avatar
Andrew Heather committed
191
    virtual ~faceAreaWeightAMI() = default;
192 193 194 195


    // Member Functions

Andrew Heather's avatar
Andrew Heather committed
196 197 198 199 200 201 202
        //- Update addressing, weights and (optional) centroids
        virtual bool calculate
        (
            const primitivePatch& srcPatch,
            const primitivePatch& tgtPatch,
            const autoPtr<searchableSurface>& surfPtr = nullptr
        );
203

Andrew Heather's avatar
Andrew Heather committed
204 205
        //- Write
        virtual void write(Ostream& os) const;
206 207 208 209 210 211 212 213 214 215 216 217
};


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

} // End namespace Foam

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

#endif

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