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

PatchToPatchInterpolation_.C

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 Description
00025     Interpolation class dealing with transfer of data between two
00026     primitivePatches
00027 
00028 \*---------------------------------------------------------------------------*/
00029 
00030 #include "PatchToPatchInterpolation_.H"
00031 #include <OpenFOAM/demandDrivenData.H>
00032 
00033 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00034 
00035 namespace Foam
00036 {
00037 
00038 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
00039 
00040 template<class FromPatch, class ToPatch>
00041 const scalar
00042 PatchToPatchInterpolation<FromPatch, ToPatch>::directHitTol = 1e-5;
00043 
00044 // * * * * * * * * * * * * * Private Member Functions  * * * * * * * * * * * //
00045 
00046 template<class FromPatch, class ToPatch>
00047 const labelList&
00048 PatchToPatchInterpolation<FromPatch, ToPatch>::pointAddr() const
00049 {
00050     if (!pointAddressingPtr_)
00051     {
00052         calcPointAddressing();
00053     }
00054 
00055     return *pointAddressingPtr_;
00056 }
00057 
00058 
00059 template<class FromPatch, class ToPatch>
00060 const FieldField<Field, scalar>&
00061 PatchToPatchInterpolation<FromPatch, ToPatch>::pointWeights() const
00062 {
00063     if (!pointWeightsPtr_)
00064     {
00065         calcPointAddressing();
00066     }
00067 
00068     return *pointWeightsPtr_;
00069 }
00070 
00071 
00072 template<class FromPatch, class ToPatch>
00073 const labelList&
00074 PatchToPatchInterpolation<FromPatch, ToPatch>::faceAddr() const
00075 {
00076     if (!faceAddressingPtr_)
00077     {
00078         calcFaceAddressing();
00079     }
00080 
00081     return *faceAddressingPtr_;
00082 }
00083 
00084 
00085 template<class FromPatch, class ToPatch>
00086 const FieldField<Field, scalar>&
00087 PatchToPatchInterpolation<FromPatch, ToPatch>::faceWeights() const
00088 {
00089     if (!faceWeightsPtr_)
00090     {
00091         calcFaceAddressing();
00092     }
00093 
00094     return *faceWeightsPtr_;
00095 }
00096 
00097 
00098 template<class FromPatch, class ToPatch>
00099 void PatchToPatchInterpolation<FromPatch, ToPatch>::clearOut()
00100 {
00101     deleteDemandDrivenData(pointAddressingPtr_);
00102     deleteDemandDrivenData(pointWeightsPtr_);
00103     deleteDemandDrivenData(pointDistancePtr_);
00104     deleteDemandDrivenData(faceAddressingPtr_);
00105     deleteDemandDrivenData(faceWeightsPtr_);
00106     deleteDemandDrivenData(faceDistancePtr_);
00107 }
00108 
00109 
00110 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
00111 
00112 // Construct from components
00113 template<class FromPatch, class ToPatch>
00114 PatchToPatchInterpolation<FromPatch, ToPatch>::PatchToPatchInterpolation
00115 (
00116     const FromPatch& fromPatch,
00117     const ToPatch& toPatch,
00118     intersection::algorithm alg,
00119     const intersection::direction dir
00120 )
00121 :
00122     fromPatch_(fromPatch),
00123     toPatch_(toPatch),
00124     alg_(alg),
00125     dir_(dir),
00126     pointAddressingPtr_(NULL),
00127     pointWeightsPtr_(NULL),
00128     pointDistancePtr_(NULL),
00129     faceAddressingPtr_(NULL),
00130     faceWeightsPtr_(NULL),
00131     faceDistancePtr_(NULL)
00132 {}
00133 
00134 
00135 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
00136 
00137 template<class FromPatch, class ToPatch>
00138 PatchToPatchInterpolation<FromPatch, ToPatch>::~PatchToPatchInterpolation()
00139 {
00140     clearOut();
00141 }
00142 
00143 
00144 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
00145 
00146 template<class FromPatch, class ToPatch>
00147 const scalarField&
00148 PatchToPatchInterpolation<FromPatch, ToPatch>
00149 ::pointDistanceToIntersection() const
00150 {
00151     if (!pointDistancePtr_)
00152     {
00153         calcPointAddressing();
00154     }
00155 
00156     return *pointDistancePtr_;
00157 }
00158 
00159 
00160 template<class FromPatch, class ToPatch>
00161 const scalarField&
00162 PatchToPatchInterpolation<FromPatch, ToPatch>
00163 ::faceDistanceToIntersection() const
00164 {
00165     if (!faceDistancePtr_)
00166     {
00167         calcFaceAddressing();
00168     }
00169 
00170     return *faceDistancePtr_;
00171 }
00172 
00173 
00174 template<class FromPatch, class ToPatch>
00175 bool PatchToPatchInterpolation<FromPatch, ToPatch>::movePoints()
00176 {
00177     clearOut();
00178 
00179     return true;
00180 }
00181 
00182 
00183 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00184 
00185 } // End namespace Foam
00186 
00187 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00188 
00189 #   include <OpenFOAM/CalcPatchToPatchWeights.C>
00190 #   include <OpenFOAM/PatchToPatchInterpolate.C>
00191 
00192 // ************************ vim: set sw=4 sts=4 et: ************************ //
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines