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 #include "basicSourceList.H"
00027 
00028 
00029 
00030 Foam::basicSourceList::basicSourceList
00031 (
00032     const fvMesh& mesh,
00033     const dictionary& dict
00034 )
00035 :
00036     PtrList<basicSource>(),
00037     mesh_(mesh)
00038 {
00039     label count = 0;
00040     forAllConstIter(dictionary, dict, iter)
00041     {
00042         
00043         if (iter().isDict())
00044         {
00045             count ++;
00046         }
00047     }
00048 
00049     this->setSize(count);
00050     label i = 0;
00051     forAllConstIter(dictionary, dict, iter)
00052     {
00053         const word& name = iter().keyword();
00054         const dictionary& dict = iter().dict();
00055 
00056         this->set
00057         (
00058             i++,
00059             basicSource::New(name, dict, mesh)
00060         );
00061     }
00062 }
00063 
00064 
00065 
00066 
00067 
00068 void Foam::basicSourceList::addSu(fvMatrix<scalar>& Eqn)
00069 {
00070     forAll(*this, i)
00071     {
00072         if (this->operator[](i).isActive())
00073         {
00074             this->operator[](i).addSu(Eqn);
00075         }
00076     }
00077 }
00078 
00079 
00080 void Foam::basicSourceList::addSu(fvMatrix<vector>& Eqn)
00081 {
00082 
00083     forAll(*this, i)
00084     {
00085         if (this->operator[](i).isActive())
00086         {
00087             this->operator[](i).addSu(Eqn);
00088         }
00089     }
00090 }
00091 
00092 
00093 void Foam::basicSourceList::addExplicitSources()
00094 {
00095 
00096     forAll(*this, i)
00097     {
00098         if (this->operator[](i).isActive())
00099         {
00100             this->operator[](i).addExplicitSources();
00101         }
00102     }
00103 }
00104 
00105 
00106 void Foam::basicSourceList::addSu
00107 (
00108     DimensionedField<scalar, volMesh>& field
00109 )
00110 {
00111     forAll(*this, i)
00112     {
00113         if (this->operator[](i).isActive())
00114         {
00115             this->operator[](i).addSu(field);
00116         }
00117     }
00118 }
00119 
00120 
00121 void Foam::basicSourceList::addSu
00122 (
00123     DimensionedField<vector, volMesh>& field
00124 )
00125 {
00126     forAll(*this, i)
00127     {
00128         if (this->operator[](i).isActive())
00129         {
00130             this->operator[](i).addSu(field);
00131         }
00132     }
00133 }
00134 
00135 
00136 bool Foam::basicSourceList::read(const dictionary& dict)
00137 {
00138     forAll(*this, i)
00139     {
00140         this->operator[](i).read(dict);
00141     }
00142     return true;
00143 }
00144 
00145 
00146 bool Foam::basicSourceList::writeData(Ostream& os) const
00147 {
00148     
00149     os << nl << this->size();
00150 
00151     
00152     os << nl << token::BEGIN_LIST;
00153 
00154     
00155     forAll(*this, i)
00156     {
00157         os << nl;
00158         this->operator[](i).writeData(os);
00159     }
00160 
00161     
00162     os << token::END_LIST << token::END_STATEMENT << nl;
00163 
00164     
00165      return os.good();
00166 }
00167 
00168 
00169 
00170 
00171 Foam::Ostream& Foam::operator<<
00172 (
00173     Ostream& os,
00174     const basicSourceList& sources
00175 )
00176 {
00177     sources.writeData(os);
00178     return os;
00179 }
00180 
00181 
00182