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

pairPotentialList.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::pairPotentialList
00026 
00027 Description
00028 
00029 SourceFiles
00030     pairPotentialListI.H
00031     pairPotentialList.C
00032 
00033 \*---------------------------------------------------------------------------*/
00034 
00035 #ifndef pairPotentialList_H
00036 #define pairPotentialList_H
00037 
00038 #include <OpenFOAM/PtrList.H>
00039 #include <OpenFOAM/word.H>
00040 #include <potential/pairPotential.H>
00041 #include <OpenFOAM/polyMesh.H>
00042 
00043 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00044 
00045 namespace Foam
00046 {
00047 
00048 /*---------------------------------------------------------------------------*\
00049                       Class pairPotentialList Declaration
00050 \*---------------------------------------------------------------------------*/
00051 
00052 class pairPotentialList
00053 :
00054     public PtrList<pairPotential>
00055 {
00056     // Private data
00057 
00058         label nIds_;
00059 
00060         scalar rCutMax_;
00061 
00062         scalar rCutMaxSqr_;
00063 
00064         autoPtr<pairPotential> electrostaticPotential_;
00065 
00066 
00067     // Private Member Functions
00068 
00069         inline label pairPotentialIndex
00070         (
00071             const label a,
00072             const label b
00073         ) const;
00074 
00075         void readPairPotentialDict
00076         (
00077             const List<word>& idList,
00078             const dictionary& pairPotentialDict,
00079             const polyMesh& mesh
00080         );
00081 
00082         //- Disallow default bitwise assignment
00083         void operator=(const pairPotentialList&);
00084 
00085         //- Disallow default bitwise copy construct
00086         pairPotentialList(const pairPotentialList&);
00087 
00088 
00089 public:
00090 
00091     // Constructors
00092 
00093         pairPotentialList();
00094 
00095         //- Construct from idList and potental dictionaries
00096         pairPotentialList
00097         (
00098             const List<word>& idList,
00099             const dictionary& pairPotentialDict,
00100             const polyMesh& mesh
00101         );
00102 
00103 
00104     // Destructor
00105 
00106         ~pairPotentialList();
00107 
00108 
00109     // Member Functions
00110 
00111         void buildPotentials
00112         (
00113             const List<word>& idList,
00114             const dictionary& pairPotentialDict,
00115             const polyMesh& mesh
00116         );
00117 
00118 
00119         // Access
00120 
00121             inline scalar rCutMax() const;
00122 
00123             inline scalar rCutMaxSqr() const;
00124 
00125             bool rCutMaxSqr(scalar rIJMagSqr) const;
00126 
00127             const pairPotential& pairPotentialFunction
00128             (
00129                 const label a,
00130                 const label b
00131             ) const;
00132 
00133             // Return true if rIJ is within rCut for this pair.
00134             bool rCutSqr
00135             (
00136                 const label a,
00137                 const label b,
00138                 const scalar rIJMagSqr
00139             ) const;
00140 
00141             scalar rMin(const label a, const label b) const;
00142 
00143             scalar dr(const label a, const label b) const;
00144 
00145             scalar rCutSqr(const label a, const label b) const;
00146 
00147             scalar rCut(const label a, const label b) const;
00148 
00149             scalar force
00150             (
00151                 const label a,
00152                 const label b,
00153                 const scalar rIJMag
00154             ) const;
00155 
00156             scalar energy
00157             (
00158                 const label a,
00159                 const label b,
00160                 const scalar rIJMag
00161             ) const;
00162 
00163             inline const pairPotential& electrostatic() const;
00164 };
00165 
00166 
00167 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00168 
00169 } // End namespace Foam
00170 
00171 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00172 
00173 #include <potential/pairPotentialListI.H>
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