meshOctreeCubeBasic.H 4.2 KB
Newer Older
Franjo's avatar
Franjo committed
1 2 3 4 5 6 7 8
/*---------------------------------------------------------------------------*\
  =========                 |
  \\      /  F ield         | cfMesh: A library for mesh generation
   \\    /   O peration     |
    \\  /    A nd           | Author: Franjo Juretic (franjo.juretic@c-fields.com)
     \\/     M anipulation  | Copyright (C) Creative Fields, Ltd.
-------------------------------------------------------------------------------
License
Andrew Heather's avatar
Andrew Heather committed
9
    This file is part of OpenFOAM.
Franjo's avatar
Franjo committed
10

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.
Franjo's avatar
Franjo committed
15

Andrew Heather's avatar
Andrew Heather committed
16
    OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
Franjo's avatar
Franjo committed
17 18 19 20 21
    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/>.
Franjo's avatar
Franjo committed
23 24

Class
25
    Foam::Module::meshOctreeCubeBasic
Franjo's avatar
Franjo committed
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44

Description
    A cube stores information needed for mesh generation

SourceFiles
    meshOctreeCubeBasic.C

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

#ifndef meshOctreeCubeBasic_H
#define meshOctreeCubeBasic_H

#include "meshOctreeCubeCoordinates.H"
#include "contiguous.H"

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

namespace Foam
{
45 46
namespace Module
{
47 48 49
class meshOctreeCubeBasic;
inline Ostream& operator<<(Ostream&, const meshOctreeCubeBasic&);
inline Istream& operator>>(Istream&, meshOctreeCubeBasic&);
Franjo's avatar
Franjo committed
50 51 52 53 54 55

/*---------------------------------------------------------------------------*\
                     Class meshOctreeCubeBasic Declaration
\*---------------------------------------------------------------------------*/

class meshOctreeCubeBasic
Andrew Heather's avatar
Andrew Heather committed
56 57
:
    public meshOctreeCubeCoordinates
Franjo's avatar
Franjo committed
58 59
{
    // Private data
Andrew Heather's avatar
Andrew Heather committed
60

Franjo's avatar
Franjo committed
61 62 63 64 65 66
        //- cube type
        direction cubeType_;

        //- processor to which the cube belongs to
        short procNo_;

Andrew Heather's avatar
Andrew Heather committed
67

Franjo's avatar
Franjo committed
68 69 70
public:

    // Constructors
Andrew Heather's avatar
Andrew Heather committed
71

Franjo's avatar
Franjo committed
72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89
        //- Null constructor
        inline meshOctreeCubeBasic();

        //- Construct from coordinates
        explicit inline meshOctreeCubeBasic
        (
            const meshOctreeCubeCoordinates&
        );

        //- Construct from coordinates and cube type
        inline meshOctreeCubeBasic
        (
            const meshOctreeCubeCoordinates& cc,
            const direction cubeType,
            const short procNo = ALLPROCS
        );


Andrew Heather's avatar
Andrew Heather committed
90
    //- Destructor
91
    ~meshOctreeCubeBasic() = default;
Andrew Heather's avatar
Andrew Heather committed
92

Franjo's avatar
Franjo committed
93 94 95 96 97 98 99 100 101 102 103 104 105

    // Enumerators

        enum typesOfCubes
        {
            UNKNOWN = 1,
            OUTSIDE = 2,
            DATA = 4,
            INSIDE = 8,
            ALLPROCS = -2,
            OTHERPROC = -3
        };

Andrew Heather's avatar
Andrew Heather committed
106

Franjo's avatar
Franjo committed
107
    // Member functions
Andrew Heather's avatar
Andrew Heather committed
108

Franjo's avatar
Franjo committed
109 110 111 112 113 114 115 116 117 118 119 120 121 122 123
        //- return type
        inline direction cubeType() const;

        //- set cube type
        inline void setCubeType(const direction);

        //- return processor number
        inline short procNo() const;

        //- set processor number
        inline void setProcNo(const short);

        //- return coordinates in the octree
        inline const meshOctreeCubeCoordinates& coordinates() const;

Andrew Heather's avatar
Andrew Heather committed
124 125

    // Member operators
Franjo's avatar
Franjo committed
126 127 128

        inline void operator=(const meshOctreeCubeBasic&);

Andrew Heather's avatar
Andrew Heather committed
129 130

    // Friend operators
Franjo's avatar
Franjo committed
131

132
        inline friend Ostream& operator<<
Franjo's avatar
Franjo committed
133 134 135 136 137
        (
            Ostream&,
            const meshOctreeCubeBasic&
        );

138
        inline friend Istream& operator>>
Franjo's avatar
Franjo committed
139 140 141 142 143 144
        (
            Istream&,
            meshOctreeCubeBasic&
        );
};

Andrew Heather's avatar
Andrew Heather committed
145

146 147 148 149 150
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

} // End namespace Module

//- Data for meshOctreeCubeBasic are contiguous
Franjo's avatar
Franjo committed
151
template<>
152
inline bool contiguous<Module::meshOctreeCubeBasic>()
Andrew Heather's avatar
Andrew Heather committed
153
{
Franjo's avatar
Franjo committed
154 155 156 157 158 159 160 161 162 163 164 165 166 167
    return true;
}

} // End namespace Foam

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

#include "meshOctreeCubeBasicI.H"

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

#endif

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