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

referredCell.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) 2008-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::referredCell
00026 
00027 Description
00028 
00029 SourceFiles
00030     referredCellI.H
00031     referredCell.C
00032 
00033 \*---------------------------------------------------------------------------*/
00034 
00035 #ifndef referredCell_H
00036 #define referredCell_H
00037 
00038 #include <OpenFOAM/vector.H>
00039 #include <OpenFOAM/vectorList.H>
00040 #include <OpenFOAM/tensor.H>
00041 #include <OpenFOAM/transform.H>
00042 #include <OpenFOAM/DynamicList.H>
00043 #include <OpenFOAM/labelList.H>
00044 #include <OpenFOAM/edgeList.H>
00045 #include <OpenFOAM/polyMesh.H>
00046 
00047 #include <molecule/referredMolecule.H>
00048 
00049 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00050 
00051 namespace Foam
00052 {
00053 
00054 /*---------------------------------------------------------------------------*\
00055                           Class referredCell Declaration
00056 \*---------------------------------------------------------------------------*/
00057 
00058 class referredCell
00059 :
00060     public DynamicList<referredMolecule>
00061 {
00062     // Private data
00063 
00064         label sourceProc_;
00065 
00066         label sourceCell_;
00067 
00068         //- Referred vertex positions
00069         vectorList vertexPositions_;
00070 
00071         edgeList edges_;
00072 
00073         labelListList faces_;
00074 
00075         vectorList faceCentres_;
00076 
00077         vectorList faceAreas_;
00078 
00079         labelList realCellsForInteraction_;
00080 
00081         vector offset_;
00082 
00083         tensor rotation_;
00084 
00085 
00086     // Private Member Functions
00087 
00088         void setConstructionData
00089         (
00090             const polyMesh& mesh,
00091             const label sourceCell
00092         );
00093 
00094         void locallyMapEdgeList
00095         (
00096             const labelList& points,
00097             const edgeList& sourceCellEdges
00098         );
00099 
00100         void locallyMapFaceList
00101         (
00102             const labelList& points,
00103             const labelListList& sourceCellFaces
00104         );
00105 
00106         vector referPosition(const vector& positionToRefer);
00107 
00108         vectorList referPositions(const vectorList& positionsToRefer);
00109 
00110         vector rotateVector(const vector& vectorToRotate);
00111 
00112         vectorList rotateVectors(const vectorList& vectorsToRotate);
00113 
00114 
00115 public:
00116 
00117     // Constructors
00118 
00119         //- Construct null
00120 
00121         referredCell();
00122 
00123         //- Construct from components with external edge information
00124         referredCell
00125         (
00126             const polyMesh& mesh,
00127             const label sourceProc,
00128             const label sourceCell,
00129             const vector& offset,
00130             const tensor& rotation
00131         );
00132 
00133         //- Construct from components with existing local edge information
00134         referredCell
00135         (
00136             const label sourceProc,
00137             const label sourceCell,
00138             const vectorList& vertexPositions,
00139             const edgeList& localEdges,
00140             const labelListList& localFaces,
00141             const vectorList& faceCentres,
00142             const vectorList& faceAreas,
00143             const vector& offset,
00144             const tensor& rotation
00145         );
00146 
00147         //- Construct from pair of face centers (c) and plain
00148         //  face normals (n) (no need to make unit vectors or
00149         //  reverse one direction)
00150         //  Order of vectors important (S = source, D = Destination).
00151         //  External edge information.
00152 
00153         referredCell
00154         (
00155             const polyMesh& mesh,
00156             const label sourceProc,
00157             const label sourceCell,
00158             const vector& cS,
00159             const vector& cD,
00160             const vector& nS,
00161             const vector& nD
00162         );
00163 
00164 
00165     // Destructor
00166 
00167         virtual ~referredCell();
00168 
00169 
00170     // Member Functions
00171 
00172         //- Take this referredCell object that has already had it's transform
00173         //  calculated and refer it on again, retaining same source info.
00174         referredCell reRefer
00175         (
00176             const vector& cS,
00177             const vector& cD,
00178             const vector& nS,
00179             const vector& nD
00180         );
00181 
00182         //- Use internal transformatation values to transform the given
00183         //  postion to its new location.
00184         vector referPosition(const vector& positionToRefer) const;
00185 
00186         //- Use internal transformatation values to transform the given
00187         //  list of postions to their new locations.
00188         vectorList referPosition(const vectorList& positionsToRefer) const;
00189 
00190         //- Use internal transformatation values to rotate the given vector
00191         vector rotateVector(const vector& vectorToRotate) const;
00192 
00193         //- Use internal transformatation values to rotate the given
00194         // list of vectors
00195         vectorList rotateVectors(const vectorList& vectorsToRotate) const;
00196 
00197         //- referInMols clears, the stored list of referred mols and takes
00198         //  in a list of referred mols coming from a source processor,
00199         //  transformingtheir positions
00200         void referInMols(const List<referredMolecule>& incomingMols);
00201 
00202         //- duplicate() function to test whether a referred or real cell
00203         //  supplied by arguement is a duplicate of this referredCell.
00204         //  Can be used bi-directionally - i.e. can be called on an existing
00205         //  referred cell with a proposed referredCell as argument,
00206         //  or vice versa.  Can only be called by a proposed referredCell with
00207         //  a real cell index as arguement to test to see if the proposed
00208         //  referredCell is a duplicate.
00209         //  A duplicate cell is defined as one which has the same source
00210         //  processor, source cell, and an equal offset. Real cells have zero
00211         //  offset by definition.
00212         bool duplicate(const referredCell& refCellDupl) const;
00213 
00214         bool duplicate(const label procNo, const label nCells) const;
00215 
00216 
00217         // Access
00218 
00219             inline label sourceProc() const;
00220 
00221             inline label sourceCell() const;
00222 
00223             inline const vector& offset() const;
00224 
00225             inline const tensor& rotation() const;
00226 
00227             inline const vectorList& vertexPositions() const;
00228 
00229             inline const edgeList& edges() const;
00230 
00231             inline const labelListList& faces() const;
00232 
00233             inline const vectorList& faceCentres() const;
00234 
00235             inline const vectorList& faceAreas() const;
00236 
00237             inline labelList& realCells();
00238 
00239             inline const labelList& realCellsForInteraction() const;
00240 
00241 
00242     // Friend Operators
00243 
00244         inline friend bool operator==
00245         (
00246             const referredCell& a,
00247             const referredCell& b
00248         );
00249 
00250         inline friend bool operator!=
00251         (
00252             const referredCell& a,
00253             const referredCell& b
00254         );
00255 
00256 
00257     // IOstream Operators
00258 
00259         friend Istream& operator>>(Istream&, referredCell&);
00260         friend Ostream& operator<<(Ostream&, const referredCell&);
00261 };
00262 
00263 
00264 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00265 
00266 } // End namespace Foam
00267 
00268 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00269 
00270 #include <molecule/referredCellI.H>
00271 
00272 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00273 
00274 #endif
00275 
00276 // ************************ vim: set sw=4 sts=4 et: ************************ //
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines