OpenFOAM logo
Open Source CFD Toolkit

processorFvPatchField.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     processorFvPatchField
00027 
00028 Description
00029 
00030 SourceFiles
00031     processorFvPatchField.C
00032 
00033 \*---------------------------------------------------------------------------*/
00034 
00035 #ifndef processorFvPatchField_H
00036 #define processorFvPatchField_H
00037 
00038 #include "coupledFvPatchField.H"
00039 #include "processorFvPatch.H"
00040 #include "processorLduCoupledInterface.H"
00041 
00042 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00043 
00044 namespace Foam
00045 {
00046 
00047 /*---------------------------------------------------------------------------*\
00048                       Class processorFvPatch Declaration
00049 \*---------------------------------------------------------------------------*/
00050 
00051 template<class Type>
00052 class processorFvPatchField
00053 :
00054     virtual public processorLduCoupledInterface,
00055     public coupledFvPatchField<Type>
00056 {
00057     // Private data
00058 
00059         //- Local reference cast into the processor patch
00060         const processorFvPatch& procPatch_;
00061 
00062 
00063 public:
00064 
00065     //- Runtime type information
00066     TypeName(processorFvPatch::typeName_());
00067 
00068 
00069     // Constructors
00070 
00071         //- Construct from patch and internal field
00072         processorFvPatchField
00073         (
00074             const fvPatch&,
00075             const Field<Type>&
00076         );
00077 
00078         //- Construct from patch and internal field and patch field
00079         processorFvPatchField
00080         (
00081             const fvPatch&,
00082             const Field<Type>&,
00083             const Field<Type>&
00084         );
00085 
00086         //- Construct from patch, internal field and dictionary
00087         processorFvPatchField
00088         (
00089             const fvPatch&,
00090             const Field<Type>&,
00091             const dictionary&
00092         );
00093 
00094         //- Construct by mapping given processorFvPatchField onto a new patch
00095         processorFvPatchField
00096         (
00097             const processorFvPatchField<Type>&,
00098             const fvPatch&,
00099             const Field<Type>&,
00100             const fvPatchFieldMapper&
00101         );
00102 
00103         //- Construct as copy
00104         processorFvPatchField(const processorFvPatchField<Type>&);
00105 
00106         //- Construct and return a clone
00107         virtual tmp<fvPatchField<Type> > clone() const
00108         {
00109             return tmp<fvPatchField<Type> >
00110             (
00111                 new processorFvPatchField<Type>(*this)
00112             );
00113         }
00114 
00115         //- Construct as copy setting internal field reference
00116         processorFvPatchField
00117         (
00118             const processorFvPatchField<Type>&,
00119             const Field<Type>&
00120         );
00121 
00122         //- Construct and return a clone setting internal field reference
00123         virtual tmp<fvPatchField<Type> > clone(const Field<Type>& iF) const
00124         {
00125             return tmp<fvPatchField<Type> >
00126             (
00127                 new processorFvPatchField<Type>(*this, iF)
00128             );
00129         }
00130 
00131 
00132     // Destructor
00133 
00134         ~processorFvPatchField();
00135 
00136 
00137     // Member functions
00138 
00139         // Access
00140 
00141             //- Return true if running parallel
00142             virtual bool coupled() const
00143             {
00144                 if (Pstream::parRun())
00145                 {
00146                     return true;
00147                 }
00148                 else
00149                 {
00150                     return false;
00151                 }
00152             }
00153 
00154             //- Return neighbour field given internal field
00155             tmp<Field<Type> > patchNeighbourField() const;
00156 
00157 
00158         // Evaluation functions
00159 
00160             //- Initialise the evaluation of the patch field
00161             virtual void initEvaluate(const bool bufferdTransfer);
00162 
00163             //- Evaluate the patch field
00164             virtual void evaluate();
00165 
00166             //- Initialise neighbour colouring transfer
00167             virtual void initNbrColour
00168             (
00169                 const labelField&,
00170                 const bool bufferdTransfer
00171             ) const;
00172 
00173             //- Return neighbour colouring
00174             virtual tmp<labelField> nbrColour(const labelField&) const;
00175 
00176             //- Initialise neighbour matrix update
00177             virtual void initInterfaceMatrixUpdate
00178             (
00179                 const scalarField& psiInternal,
00180                 scalarField& result,
00181                 const lduMatrix& m,
00182                 const scalarField& coeffs,
00183                 const direction cmpt,
00184                 const bool bufferdTransfer
00185             ) const;
00186 
00187             //- Update result field based on interface functionality
00188             virtual void updateInterfaceMatrix
00189             (
00190                 const scalarField& psiInternal,
00191                 scalarField& result,
00192                 const lduMatrix& m,
00193                 const scalarField& coeffs,
00194                 const direction cmpt
00195             ) const;
00196 
00197         //- Processor coupled interface functions
00198 
00199             //- Return processor number
00200             virtual int myProcNo() const
00201             {
00202                 return procPatch_.myProcNo();
00203             }
00204 
00205             //- Return neigbour processor number
00206             virtual int neighbProcNo() const
00207             {
00208                 return procPatch_.neighbProcNo();
00209             }
00210 
00211             //- Does the patch field perform the transfromation
00212             virtual bool doTransform() const
00213             {
00214                 return !(procPatch_.parallel() || pTraits<Type>::rank == 0);
00215             }
00216 
00217             //- Return face transformation tensor
00218             virtual const tensorField& forwardT() const
00219             {
00220                 return procPatch_.forwardT();
00221             }
00222 
00223             //- Return rank of component for transform
00224             virtual int rank() const
00225             {
00226                 return pTraits<Type>::rank;
00227             }
00228 };
00229 
00230 
00231 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00232 
00233 } // End namespace Foam
00234 
00235 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00236 
00237 #ifdef NoRepository
00238 #   include "processorFvPatchField.C"
00239 #endif
00240 
00241 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00242 
00243 #endif
00244 
00245 // ************************************************************************* //
For further information go to www.openfoam.org