FreeFOAM The Cross-Platform CFD Toolkit
Hosted by SourceForge:
Get FreeFOAM at SourceForge.net.
            Fast, secure and Free Open Source software downloads

searchableSurfaceCollection.H

Go to the documentation of this file.
00001 /*---------------------------------------------------------------------------*\
00002   =========                 |
00003   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
00004    \\    /   O peration     |
00005     \\  /    A nd           | Copyright (C) 1991-2010 OpenCFD Ltd.
00006      \\/     M anipulation  |
00007 -------------------------------------------------------------------------------
00008 License
00009     This file is part of OpenFOAM.
00010 
00011     OpenFOAM is free software: you can redistribute it and/or modify it
00012     under the terms of the GNU General Public License as published by
00013     the Free Software Foundation, either version 3 of the License, or
00014     (at your option) any later version.
00015 
00016     OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
00017     ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00018     FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
00019     for more details.
00020 
00021     You should have received a copy of the GNU General Public License
00022     along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
00023 
00024 Class
00025     Foam::searchableSurfaceCollection
00026 
00027 Description
00028     Set of transformed searchableSurfaces. Does not do boolean operations.
00029     So when meshing might find parts 'inside'.
00030 
00031 SourceFiles
00032     searchableSurfaceCollection.C
00033 
00034 \*---------------------------------------------------------------------------*/
00035 
00036 #ifndef searchableSurfaceCollection_H
00037 #define searchableSurfaceCollection_H
00038 
00039 #include "searchableSurface.H"
00040 #include <meshTools/treeBoundBox.H>
00041 #include <meshTools/coordinateSystem.H>
00042 #include <OpenFOAM/UPtrList.H>
00043 #include <OpenFOAM/Switch.H>
00044 
00045 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00046 
00047 namespace Foam
00048 {
00049 
00050 // Forward declaration of classes
00051 
00052 /*---------------------------------------------------------------------------*\
00053                  Class searchableSurfaceCollection Declaration
00054 \*---------------------------------------------------------------------------*/
00055 
00056 class searchableSurfaceCollection
00057 :
00058     public searchableSurface
00059 {
00060 private:
00061 
00062     // Private Member Data
00063 
00064         // Per instance data
00065 
00066             //- instance name
00067             wordList instance_;
00068 
00069             //- scaling vector
00070             vectorField scale_;
00071 
00072             //- transformation
00073             PtrList<coordinateSystem> transform_;
00074 
00075             UPtrList<searchableSurface> subGeom_;
00076 
00077             Switch mergeSubRegions_;
00078 
00079             //- offsets for indices coming from different surfaces
00080             //  (sized with size() of each surface)
00081             labelList indexOffset_;
00082 
00083         //- Region names
00084         mutable wordList regions_;
00085         //- From individual regions to collection regions
00086         mutable labelList regionOffset_;
00087 
00088 
00089     // Private Member Functions
00090 
00091         //- Find point nearest to sample. Updates minDistSqr. Sets nearestInfo
00092         //  and surface index
00093         void findNearest
00094         (
00095             const pointField& samples,
00096             scalarField& minDistSqr,
00097             List<pointIndexHit>& nearestInfo,
00098             labelList& nearestSurf
00099         ) const;
00100 
00101         //- Sort hits into per-surface bins. Misses are rejected.
00102         //  Maintains map back to position
00103         void sortHits
00104         (
00105             const List<pointIndexHit>& info,
00106             List<List<pointIndexHit> >& surfInfo,
00107             labelListList& infoMap
00108         ) const;
00109 
00110 
00111         //- Disallow default bitwise copy construct
00112         searchableSurfaceCollection(const searchableSurfaceCollection&);
00113 
00114         //- Disallow default bitwise assignment
00115         void operator=(const searchableSurfaceCollection&);
00116 
00117 
00118 public:
00119 
00120     //- Runtime type information
00121     TypeName("searchableSurfaceCollection");
00122 
00123 
00124     // Constructors
00125 
00126         //- Construct from dictionary (used by searchableSurface)
00127         searchableSurfaceCollection
00128         (
00129             const IOobject& io,
00130             const dictionary& dict
00131         );
00132 
00133     // Destructor
00134 
00135         virtual ~searchableSurfaceCollection();
00136 
00137 
00138     // Member Functions
00139 
00140         virtual const wordList& regions() const;
00141 
00142         //- Whether supports volume type below
00143         virtual bool hasVolumeType() const
00144         {
00145             return false;
00146         }
00147 
00148         //- Range of local indices that can be returned.
00149         virtual label size() const;
00150 
00151         //- Get representative set of element coordinates
00152         //  Usually the element centres (should be of length size()).
00153         virtual pointField coordinates() const;
00154 
00155 
00156         // Multiple point queries.
00157 
00158             virtual void findNearest
00159             (
00160                 const pointField& sample,
00161                 const scalarField& nearestDistSqr,
00162                 List<pointIndexHit>&
00163             ) const;
00164 
00165             virtual void findLine
00166             (
00167                 const pointField& start,
00168                 const pointField& end,
00169                 List<pointIndexHit>&
00170             ) const;
00171 
00172             virtual void findLineAny
00173             (
00174                 const pointField& start,
00175                 const pointField& end,
00176                 List<pointIndexHit>&
00177             ) const;
00178 
00179             //- Get all intersections in order from start to end.
00180             virtual void findLineAll
00181             (
00182                 const pointField& start,
00183                 const pointField& end,
00184                 List<List<pointIndexHit> >&
00185             ) const;
00186 
00187             //- From a set of points and indices get the region
00188             virtual void getRegion
00189             (
00190                 const List<pointIndexHit>&,
00191                 labelList& region
00192             ) const;
00193 
00194             //- From a set of points and indices get the normal
00195             virtual void getNormal
00196             (
00197                 const List<pointIndexHit>&,
00198                 vectorField& normal
00199             ) const;
00200 
00201             //- Determine type (inside/outside/mixed) for point. unknown if
00202             //  cannot be determined (e.g. non-manifold surface)
00203             virtual void getVolumeType
00204             (
00205                 const pointField&,
00206                 List<volumeType>&
00207             ) const;
00208 
00209         // Other
00210 
00211             //- Set bounds of surface. Bounds currently set as list of
00212             //  bounding boxes. The bounds are hints to the surface as for
00213             //  the range of queries it can expect. faceMap/pointMap can be
00214             //  set if the surface has done any redistribution.
00215             virtual void distribute
00216             (
00217                 const List<treeBoundBox>&,
00218                 const bool keepNonLocal,
00219                 autoPtr<mapDistribute>& faceMap,
00220                 autoPtr<mapDistribute>& pointMap
00221             );
00222 
00223             //- WIP. Store element-wise field.
00224             virtual void setField(const labelList& values);
00225 
00226             //- WIP. From a set of hits (points and
00227             //  indices) get the specified field. Misses do not get set. Return
00228             //  empty field if not supported.
00229             virtual void getField(const List<pointIndexHit>&, labelList&) const;
00230 
00231         // regIOobject implementation
00232 
00233             bool writeData(Ostream&) const
00234             {
00235                 notImplemented
00236                 (
00237                     "searchableSurfaceCollection::writeData(Ostream&) const"
00238                 );
00239                 return false;
00240             }
00241 
00242 };
00243 
00244 
00245 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00246 
00247 } // End namespace Foam
00248 
00249 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00250 
00251 #endif
00252 
00253 // ************************ vim: set sw=4 sts=4 et: ************************ //
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines