triSurfaceMesh.H 5.99 KB
Newer Older
mattijs's avatar
mattijs committed
1
2
3
4
/*---------------------------------------------------------------------------*\
  =========                 |
  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
   \\    /   O peration     |
5
    \\  /    A nd           | Copyright (C) 1991-2008 OpenCFD Ltd.
mattijs's avatar
mattijs committed
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
     \\/     M anipulation  |
-------------------------------------------------------------------------------
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 2 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, write to the Free Software Foundation,
    Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA

Class
26
    Foam::triSurfaceMesh
mattijs's avatar
mattijs committed
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

Description
    IOoject and searching on triSurface

SourceFiles
    triSurfaceMesh.C

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

#ifndef triSurfaceMesh_H
#define triSurfaceMesh_H

#include "searchableSurface.H"
#include "objectRegistry.H"
#include "indexedOctree.H"
#include "treeDataTriSurface.H"
#include "treeDataEdge.H"

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

namespace Foam
{

/*---------------------------------------------------------------------------*\
                           Class triSurfaceMesh Declaration
\*---------------------------------------------------------------------------*/

class triSurfaceMesh
:
    public searchableSurface,
57
    public objectRegistry,      // so we can store fields
mattijs's avatar
mattijs committed
58
59
60
61
62
63
64
65
66
67
68
69
    public triSurface
{
private:

    // Private member data

        //- Search tree (triangles)
        mutable autoPtr<indexedOctree<treeDataTriSurface> > tree_;

        //- Search tree for boundary edges.
        mutable autoPtr<indexedOctree<treeDataEdge> > edgeTree_;

70
71
72
73
74
75
        //- Names of regions
        mutable wordList regions_;

        //- Is surface closed
        mutable label surfaceClosed_;

mattijs's avatar
mattijs committed
76
77
78
79
80
81
82
83
84
    // Private Member Functions

        //- Check file existence
        static const fileName& checkFile
        (
            const fileName& fName,
            const fileName& objectName
        );

85
86
87
88
        //- Check whether surface is closed without calculating any permanent
        //  addressing.
        bool isSurfaceClosed() const;

mattijs's avatar
mattijs committed
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
        //- Disallow default bitwise copy construct
        triSurfaceMesh(const triSurfaceMesh&);

        //- Disallow default bitwise assignment
        void operator=(const triSurfaceMesh&);


public:

    //- Runtime type information
    TypeName("triSurfaceMesh");


    // Constructors

        //- Construct from triSurface
        triSurfaceMesh(const IOobject&, const triSurface&);

        //- Construct read
        triSurfaceMesh(const IOobject& io);

110
        //- Construct from dictionary (used by searchableSurface)
mattijs's avatar
mattijs committed
111
112
        triSurfaceMesh
        (
113
            const IOobject& io,
mattijs's avatar
mattijs committed
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
            const dictionary& dict
        );


    // Destructor

        virtual ~triSurfaceMesh();

        //- Clear storage
        void clearOut();


    // Member Functions

        //- Move points
        virtual void movePoints(const pointField&);

        //- Demand driven contruction of octree
        const indexedOctree<treeDataTriSurface>& tree() const;

        //- Demand driven contruction of octree for boundary edges
        const indexedOctree<treeDataEdge>& edgeTree() const;


        // searchableSurface implementation

140
141
142
143
144
145
146
147
148
            virtual const wordList& regions() const;

            //- Whether supports volume type below. I.e. whether is closed.
            virtual bool hasVolumeType() const;


        // Multiple point queries.

            virtual void findNearest
mattijs's avatar
mattijs committed
149
            (
150
151
152
                const pointField& sample,
                const scalarField& nearestDistSqr,
                List<pointIndexHit>&
mattijs's avatar
mattijs committed
153
154
            ) const;

155
            virtual void findLine
mattijs's avatar
mattijs committed
156
            (
157
158
159
                const pointField& start,
                const pointField& end,
                List<pointIndexHit>&
mattijs's avatar
mattijs committed
160
161
            ) const;

162
            virtual void findLineAny
mattijs's avatar
mattijs committed
163
            (
164
165
166
                const pointField& start,
                const pointField& end,
                List<pointIndexHit>&
mattijs's avatar
mattijs committed
167
168
            ) const;

169
170
            //- Get all intersections in order from start to end.
            virtual void findLineAll
mattijs's avatar
mattijs committed
171
            (
172
173
174
                const pointField& start,
                const pointField& end,
                List<List<pointIndexHit> >&
mattijs's avatar
mattijs committed
175
176
            ) const;

177
178
            //- From a set of points and indices get the region
            virtual void getRegion
mattijs's avatar
mattijs committed
179
            (
180
181
182
183
184
185
186
187
188
                const List<pointIndexHit>&,
                labelList& region
            ) const;

            //- From a set of points and indices get the normal
            virtual void getNormal
            (
                const List<pointIndexHit>&,
                vectorField& normal
mattijs's avatar
mattijs committed
189
190
191
192
            ) const;

            //- Determine type (inside/outside/mixed) for point. unknown if
            //  cannot be determined (e.g. non-manifold surface)
193
194
195
196
197
198
199
200
201
202
203
204
205
206
            virtual void getVolumeType
            (
                const pointField&,
                List<volumeType>&
            ) const;


        // regIOobject implementation

            bool writeData(Ostream&) const
            {
                notImplemented("triSurfaceMesh::writeData(Ostream&) const");
                return false;
            }
mattijs's avatar
mattijs committed
207
208
209
210
211
212
213
214
215
216
217
218
219

};


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

} // End namespace Foam

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

#endif

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