OpenFOAM logo
Open Source CFD Toolkit

polyAddPoint.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     polyAddPoint
00027 
00028 Description
00029     Class containing data for point addition.
00030 
00031 \*---------------------------------------------------------------------------*/
00032 
00033 #ifndef polyAddPoint_H
00034 #define polyAddPoint_H
00035 
00036 #include "label.H"
00037 #include "point.H"
00038 #include "topoAction.H"
00039 
00040 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00041 
00042 namespace Foam
00043 {
00044 
00045 /*---------------------------------------------------------------------------*\
00046                            Class polyAddPoint Declaration
00047 \*---------------------------------------------------------------------------*/
00048 
00049 class polyAddPoint
00050 :
00051     public topoAction
00052 {
00053     // Private data
00054 
00055         //- Point to add
00056         point p_;
00057 
00058         //- Master point
00059         label masterPointID_;
00060 
00061         //- Point zone ID
00062         label zoneID_;
00063 
00064         //- Does the point support a cell
00065         bool inCell_;
00066 
00067 
00068 public:
00069 
00070     // Static data members
00071 
00072         //- Runtime type information
00073         TypeName("addPoint");
00074 
00075 
00076     // Constructors
00077 
00078         //- Construct null.  Used only for list construction
00079         polyAddPoint()
00080         :
00081             p_(vector::zero),
00082             masterPointID_(-1),
00083             zoneID_(-1),
00084             inCell_(false)
00085         {}
00086 
00087         //- Construct from components
00088         polyAddPoint
00089         (
00090             const point& p,
00091             const label masterPointID,
00092             const label zoneID,
00093             const bool inCell
00094         )
00095         :
00096             p_(p),
00097             masterPointID_(masterPointID),
00098             zoneID_(zoneID),
00099             inCell_(inCell)
00100         {
00101             if (zoneID_ < 0 && !inCell)
00102             {
00103                 FatalErrorIn
00104                 (
00105                     "polyAddPoint\n"
00106                     "(\n"
00107                     "    const point& p,\n"
00108                     "    const label masterPointID,\n"
00109                     "    const label zoneID,\n"
00110                     "    const bool inCell\n"
00111                     ")"
00112                 )   << "Point is not in a cell and not in a zone.  "
00113                     << "This is not allowed.\n"
00114                     << "point: " << p
00115                     << " master: " << masterPointID_
00116                     << " zone: " << zoneID_
00117                     << abort(FatalError);
00118             }
00119 
00120         }
00121 
00122         //- Construct and return a clone
00123         virtual autoPtr<topoAction> clone() const
00124         {
00125             return autoPtr<topoAction>(new polyAddPoint(*this));
00126         }
00127 
00128 
00129     // Default Destructor
00130 
00131 
00132     // Member Functions
00133 
00134         //- Point location
00135         const point& newPoint() const
00136         {
00137             return p_;
00138         }
00139 
00140         //- Master point label
00141         label masterPointID() const
00142         {
00143             return masterPointID_;
00144         }
00145 
00146         //- Is the point appended with no master
00147         bool appended() const
00148         {
00149             return masterPointID_ < 0;
00150         }
00151 
00152         //- Does the point belong to a zone?
00153         bool isInZone() const
00154         {
00155             return zoneID_ >= 0;
00156         }
00157 
00158         //- Point zone ID
00159         label zoneID() const
00160         {
00161             return zoneID_;
00162         }
00163 
00164         //- Does the point support a cell
00165         bool inCell() const
00166         {
00167             return inCell_;
00168         }
00169 };
00170 
00171 
00172 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00173 
00174 } // End namespace Foam
00175 
00176 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00177 
00178 #endif
00179 
00180 // ************************************************************************* //
For further information go to www.openfoam.org