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

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