cellPointWeight.H 3.53 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-2017 OpenFOAM Foundation
9 10 11 12
-------------------------------------------------------------------------------
License
    This file is part of OpenFOAM.

13 14 15 16
    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.
17 18 19 20 21 22 23

    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
24
    along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40

Class
    Foam::cellPointWeight

Description
    Foam::cellPointWeight

SourceFiles
    cellPointWeight.C

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

#ifndef cellPointWeight_H
#define cellPointWeight_H

#include "vector.H"
41 42
#include "barycentric.H"
#include "triFace.H"
43 44 45 46 47 48 49 50 51 52 53 54 55 56

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

namespace Foam
{

class polyMesh;

/*---------------------------------------------------------------------------*\
                           Class cellPointWeight Declaration
\*---------------------------------------------------------------------------*/

class cellPointWeight
{
57 58 59
protected:

    // Protected data
60 61

       //- Cell index
62
       const label celli_;
63

64 65 66
       //- Weights applied to tet vertices. Equal to the barycentric coordinates
       //  of the interpolation position.
       barycentric weights_;
67 68

       //- Face vertex indices
69
       triFace faceVertices_;
70 71


72
    // Protected Member Functions
73 74 75 76 77

        void findTetrahedron
        (
            const polyMesh& mesh,
            const vector& position,
78
            const label celli
79 80 81 82 83 84
        );

        void findTriangle
        (
            const polyMesh& mesh,
            const vector& position,
85
            const label facei
86 87 88 89 90 91 92 93
        );


public:

    //- Debug switch
    static int debug;

94
    //- Tolerance used in calculating barycentric coordinates
mattijs's avatar
mattijs committed
95
    //  (applied to normalised values)
96 97 98 99 100 101 102 103 104 105
    static scalar tol;


    // Constructors

        //- Construct from components
        cellPointWeight
        (
            const polyMesh& mesh,
            const vector& position,
106 107
            const label celli,
            const label facei = -1
108 109 110 111 112 113 114 115
        );


    // Member Functions

        //- Cell index
        inline label cell() const
        {
116
            return celli_;
117 118
        }

119
        //- Interpolation weights
120
        inline const barycentric& weights() const
121 122 123 124
        {
            return weights_;
        }

125
        //- Interpolation addressing for points on face
126
        inline const triFace& faceVertices() const
127 128 129 130 131 132 133 134 135 136 137 138 139 140 141
        {
            return faceVertices_;
        }
};


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

} // End namespace Foam

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

#endif

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