tetherPotentialList.C
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027 #include "tetherPotentialList.H"
00028
00029
00030
00031 void Foam::tetherPotentialList::readTetherPotentialDict
00032 (
00033 const List<word>& siteIdList,
00034 const dictionary& tetherPotentialDict,
00035 const List<word>& tetherSiteIdList
00036 )
00037 {
00038
00039 Info<< nl << "Building tether potentials." << endl;
00040
00041 idMap_ = List<label>(siteIdList.size(), -1);
00042
00043 label tetherMapIndex = 0;
00044
00045 forAll(tetherSiteIdList, t)
00046 {
00047 word tetherPotentialName = tetherSiteIdList[t];
00048
00049 label tetherId = findIndex(siteIdList, tetherPotentialName);
00050
00051 if (tetherId == -1)
00052 {
00053 FatalErrorIn("tetherPotentialList::readTetherPotentialDict")
00054 << nl << "No matching entry found in siteIdList for tether name "
00055 << tetherPotentialName
00056 << abort(FatalError);
00057 }
00058 else if (!tetherPotentialDict.found(tetherPotentialName))
00059 {
00060 FatalErrorIn("tetherPotentialList::readTetherPotentialDict")
00061 << nl << "tether potential specification subDict "
00062 << tetherPotentialName << " not found"
00063 << abort(FatalError);
00064 }
00065 else
00066 {
00067 this->set
00068 (
00069 tetherMapIndex,
00070 tetherPotential::New
00071 (
00072 tetherPotentialName,
00073 tetherPotentialDict.subDict(tetherPotentialName)
00074 )
00075 );
00076 }
00077
00078 idMap_[tetherId] = tetherMapIndex;
00079
00080 tetherMapIndex++;
00081 }
00082 }
00083
00084
00085
00086
00087 Foam::tetherPotentialList::tetherPotentialList()
00088 :
00089 PtrList<tetherPotential>(),
00090 idMap_()
00091 {}
00092
00093
00094 Foam::tetherPotentialList::tetherPotentialList
00095 (
00096 const List<word>& siteIdList,
00097 const dictionary& tetherPotentialDict,
00098 const List<word>& tetherSiteIdList
00099 )
00100 :
00101 PtrList<tetherPotential>(),
00102 idMap_()
00103 {
00104 buildPotentials(siteIdList, tetherPotentialDict, tetherSiteIdList);
00105 }
00106
00107
00108
00109
00110 Foam::tetherPotentialList::~tetherPotentialList()
00111 {}
00112
00113
00114
00115
00116 void Foam::tetherPotentialList::buildPotentials
00117 (
00118 const List<word>& siteIdList,
00119 const dictionary& tetherPotentialDict,
00120 const List<word>& tetherSiteIdList
00121 )
00122 {
00123 setSize(tetherSiteIdList.size());
00124
00125 readTetherPotentialDict(siteIdList, tetherPotentialDict, tetherSiteIdList);
00126 }
00127
00128
00129 const Foam::tetherPotential& Foam::tetherPotentialList::tetherPotentialFunction
00130 (
00131 const label a
00132 ) const
00133 {
00134 return (*this)[tetherPotentialIndex(a)];
00135 }
00136
00137
00138 Foam::vector Foam::tetherPotentialList::force
00139 (
00140 const label a,
00141 const vector rIT
00142 ) const
00143 {
00144 return (*this)[tetherPotentialIndex(a)].force(rIT);
00145 }
00146
00147
00148 Foam::scalar Foam::tetherPotentialList::energy
00149 (
00150 const label a,
00151 const vector rIT
00152 ) const
00153 {
00154 return (*this)[tetherPotentialIndex(a)].energy(rIT);
00155 }
00156
00157
00158
Copyright © 2000-2009 OpenCFD Ltd