OpenFOAM logo
Open Source CFD Toolkit

sortLabelledTri.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-2005 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 the
00013     Free Software Foundation; either version 2 of the License, or (at your
00014     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, write to the Free Software Foundation,
00023     Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
00024 
00025 Class
00026     sortLabelledTri
00027 
00028 Description
00029     Helper class which when constructed with a triSurface
00030     sorts the faces according to region number. (or rather constructs a
00031     mapping)
00032 
00033 SourceFiles
00034     sortLabelledTri.C
00035 
00036 \*---------------------------------------------------------------------------*/
00037 
00038 #ifndef sortLabelledTri_H
00039 #define sortLabelledTri_H
00040 
00041 #include "labelList.H"
00042 
00043 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00044 
00045 namespace Foam
00046 {
00047 
00048 class sortLabelledTri;
00049 class triSurface;
00050 
00051 /*---------------------------------------------------------------------------*\
00052                          Class surfAndLabel Declaration
00053 \*---------------------------------------------------------------------------*/
00054 
00055 class surfAndLabel
00056 {
00057     const triSurface* surfPtr_;
00058 
00059     label index_;
00060 
00061     // Private Classes
00062 
00063         //- scalar comparison function used for sorting
00064         class less
00065         {
00066         public:
00067 
00068             inline bool operator()
00069             (
00070                 const surfAndLabel& one,
00071                 const surfAndLabel& two
00072             ) const;
00073         };
00074 
00075 
00076 public:
00077 
00078     friend class sortLabelledTri;
00079 
00080     // Constructors
00081 
00082         //- Construct null
00083         surfAndLabel()
00084         :
00085             surfPtr_(NULL),
00086             index_(-1)
00087         {}
00088 
00089         //- Construct from surface and index
00090         surfAndLabel(const triSurface& surf, const label index)
00091         :
00092             surfPtr_(&surf),
00093             index_(index)
00094         {}
00095 };
00096 
00097 
00098 /*---------------------------------------------------------------------------*\
00099                            Class sortLabelledTri Declaration
00100 \*---------------------------------------------------------------------------*/
00101 
00102 class sortLabelledTri
00103 :
00104     public List<surfAndLabel>
00105 {
00106 
00107 public:
00108 
00109     // Constructors
00110 
00111         //- Construct from surface, sorting the faces according to patch
00112         sortLabelledTri(const triSurface&);
00113 
00114 
00115     // Member Functions
00116 
00117         // Access
00118 
00119             //- Set the labelList to those of sorted point indices
00120             void indices(labelList&) const;
00121 
00122             //- Return the list of sorted point indices
00123             labelList indices() const;
00124 };
00125 
00126 
00127 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00128 
00129 } // End namespace Foam
00130 
00131 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00132 
00133 #endif
00134 
00135 // ************************************************************************* //
For further information go to www.openfoam.org