OpenFOAM logo
The Open Source CFD Toolbox
  Source Guide OpenCFD Solutions Contact OpenFOAM

genericFvPatchField.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-2009 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 \*---------------------------------------------------------------------------*/
00026 
00027 #include "genericFvPatchField.H"
00028 #include "fvPatchFieldMapper.H"
00029 
00030 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
00031 
00032 template<class Type>
00033 Foam::genericFvPatchField<Type>::genericFvPatchField
00034 (
00035     const fvPatch& p,
00036     const DimensionedField<Type, volMesh>& iF
00037 )
00038 :
00039     calculatedFvPatchField<Type>(p, iF)
00040 {
00041     FatalErrorIn
00042     (
00043         "genericFvPatchField<Type>::genericFvPatchField"
00044         "(const fvPatch& p, const DimensionedField<Type, volMesh>& iF)"
00045     )   << "Not Implemented\n    "
00046         << "Trying to construct an genericFvPatchField on patch "
00047         << this->patch().name()
00048         << " of field " << this->dimensionedInternalField().name()
00049         << abort(FatalError);
00050 }
00051 
00052 
00053 template<class Type>
00054 Foam::genericFvPatchField<Type>::genericFvPatchField
00055 (
00056     const fvPatch& p,
00057     const DimensionedField<Type, volMesh>& iF,
00058     const dictionary& dict
00059 )
00060 :
00061     calculatedFvPatchField<Type>(p, iF, dict, false),
00062     actualTypeName_(dict.lookup("type")),
00063     dict_(dict)
00064 {
00065     if (!dict.found("value"))
00066     {
00067         FatalIOErrorIn
00068         (
00069             "genericFvPatchField<Type>::genericFvPatchField"
00070             "(const fvPatch&, const Field<Type>&, const dictionary&)",
00071             dict
00072         )   << "\n    Cannot find 'value' entry"
00073             << " on patch " << this->patch().name()
00074             << " of field " << this->dimensionedInternalField().name()
00075             << " in file " << this->dimensionedInternalField().objectPath()
00076             << nl
00077             << "    which is required to set the"
00078                " values of the generic patch field." << nl
00079             << "    (Actual type " << actualTypeName_ << ")" << nl
00080             << "\n    Please add the 'value' entry to the write function "
00081                "of the user-defined boundary-condition\n"
00082                "    or link the boundary-condition into libfoamUtil.so"
00083             << exit(FatalIOError);
00084     }
00085 
00086     for
00087     (
00088         dictionary::const_iterator iter = dict_.begin();
00089         iter != dict_.end();
00090         ++iter
00091     )
00092     {
00093         if (iter().keyword() != "type" && iter().keyword() != "value")
00094         {
00095             if
00096             (
00097                 iter().isStream()
00098              && iter().stream().size()
00099             )
00100             {
00101                 ITstream& is = iter().stream();
00102 
00103                 // Read first token
00104                 token firstToken(is);
00105 
00106                 if
00107                 (
00108                     firstToken.isWord()
00109                  && firstToken.wordToken() == "nonuniform"
00110                 )
00111                 {
00112                     token fieldToken(is);
00113 
00114                     if (!fieldToken.isCompound())
00115                     {
00116                         if
00117                         (
00118                             fieldToken.isLabel()
00119                          && fieldToken.labelToken() == 0
00120                         )
00121                         {
00122                             scalarFields_.insert
00123                             (
00124                                 iter().keyword(),
00125                                 new scalarField(0)
00126                             );
00127                         }
00128                         else
00129                         {
00130                             FatalIOErrorIn
00131                             (
00132                                 "genericFvPatchField<Type>::genericFvPatchField"
00133                                 "(const fvPatch&, const Field<Type>&, "
00134                                 "const dictionary&)",
00135                                 dict
00136                             )   << "\n    token following 'nonuniform' "
00137                                   "is not a compound"
00138                                 << "\n    on patch " << this->patch().name()
00139                                 << " of field "
00140                                 << this->dimensionedInternalField().name()
00141                                 << " in file "
00142                                 << this->dimensionedInternalField().objectPath()
00143                             << exit(FatalIOError);
00144                         }
00145                     }
00146                     else if
00147                     (
00148                         fieldToken.compoundToken().type()
00149                      == token::Compound<List<scalar> >::typeName
00150                     )
00151                     {
00152                         scalarField* fPtr = new scalarField;
00153                         fPtr->transfer
00154                         (
00155                             dynamicCast<token::Compound<List<scalar> > >
00156                             (
00157                                 fieldToken.transferCompoundToken()
00158                             )
00159                         );
00160 
00161                         if (fPtr->size() != this->size())
00162                         {
00163                             FatalIOErrorIn
00164                             (
00165                                 "genericFvPatchField<Type>::genericFvPatchField"
00166                                 "(const fvPatch&, const Field<Type>&, "
00167                                 "const dictionary&)",
00168                                 dict
00169                             )   << "\n    size of field " << iter().keyword()
00170                                 << " (" << fPtr->size() << ')'
00171                                 << " is not the same size as the patch ("
00172                                 << this->size() << ')'
00173                                 << "\n    on patch " << this->patch().name()
00174                                 << " of field "
00175                                 << this->dimensionedInternalField().name()
00176                                 << " in file "
00177                                 << this->dimensionedInternalField().objectPath()
00178                                 << exit(FatalIOError);
00179                         }
00180 
00181                         scalarFields_.insert(iter().keyword(), fPtr);
00182                     }
00183                     else if
00184                     (
00185                         fieldToken.compoundToken().type()
00186                      == token::Compound<List<vector> >::typeName
00187                     )
00188                     {
00189                         vectorField* fPtr = new vectorField;
00190                         fPtr->transfer
00191                         (
00192                             dynamicCast<token::Compound<List<vector> > >
00193                             (
00194                                 fieldToken.transferCompoundToken()
00195                             )
00196                         );
00197 
00198                         if (fPtr->size() != this->size())
00199                         {
00200                             FatalIOErrorIn
00201                             (
00202                                 "genericFvPatchField<Type>::genericFvPatchField"
00203                                 "(const fvPatch&, const Field<Type>&, "
00204                                 "const dictionary&)",
00205                                 dict
00206                             )   << "\n    size of field " << iter().keyword()
00207                                 << " (" << fPtr->size() << ')'
00208                                 << " is not the same size as the patch ("
00209                                 << this->size() << ')'
00210                                 << "\n    on patch " << this->patch().name()
00211                                 << " of field "
00212                                 << this->dimensionedInternalField().name()
00213                                 << " in file "
00214                                 << this->dimensionedInternalField().objectPath()
00215                                 << exit(FatalIOError);
00216                         }
00217 
00218                         vectorFields_.insert(iter().keyword(), fPtr);
00219                     }
00220                     else if
00221                     (
00222                         fieldToken.compoundToken().type()
00223                      == token::Compound<List<sphericalTensor> >::typeName
00224                     )
00225                     {
00226                         sphericalTensorField* fPtr = new sphericalTensorField;
00227                         fPtr->transfer
00228                         (
00229                             dynamicCast
00230                             <
00231                                 token::Compound<List<sphericalTensor> >
00232                             >
00233                             (
00234                                 fieldToken.transferCompoundToken()
00235                             )
00236                         );
00237 
00238                         if (fPtr->size() != this->size())
00239                         {
00240                             FatalIOErrorIn
00241                             (
00242                                 "genericFvPatchField<Type>::genericFvPatchField"
00243                                 "(const fvPatch&, const Field<Type>&, "
00244                                 "const dictionary&)",
00245                                 dict
00246                             )   << "\n    size of field " << iter().keyword()
00247                                 << " (" << fPtr->size() << ')'
00248                                 << " is not the same size as the patch ("
00249                                 << this->size() << ')'
00250                                 << "\n    on patch " << this->patch().name()
00251                                 << " of field "
00252                                 << this->dimensionedInternalField().name()
00253                                 << " in file "
00254                                 << this->dimensionedInternalField().objectPath()
00255                                 << exit(FatalIOError);
00256                         }
00257 
00258                         sphericalTensorFields_.insert(iter().keyword(), fPtr);
00259                     }
00260                     else if
00261                     (
00262                         fieldToken.compoundToken().type()
00263                      == token::Compound<List<symmTensor> >::typeName
00264                     )
00265                     {
00266                         symmTensorField* fPtr = new symmTensorField;
00267                         fPtr->transfer
00268                         (
00269                             dynamicCast
00270                             <
00271                                 token::Compound<List<symmTensor> >
00272                             >
00273                             (
00274                                 fieldToken.transferCompoundToken()
00275                             )
00276                         );
00277 
00278                         if (fPtr->size() != this->size())
00279                         {
00280                             FatalIOErrorIn
00281                             (
00282                                 "genericFvPatchField<Type>::genericFvPatchField"
00283                                 "(const fvPatch&, const Field<Type>&, "
00284                                 "const dictionary&)",
00285                                 dict
00286                             )   << "\n    size of field " << iter().keyword()
00287                                 << " (" << fPtr->size() << ')'
00288                                 << " is not the same size as the patch ("
00289                                 << this->size() << ')'
00290                                 << "\n    on patch " << this->patch().name()
00291                                 << " of field "
00292                                 << this->dimensionedInternalField().name()
00293                                 << " in file "
00294                                 << this->dimensionedInternalField().objectPath()
00295                                 << exit(FatalIOError);
00296                         }
00297 
00298                         symmTensorFields_.insert(iter().keyword(), fPtr);
00299                     }
00300                     else if
00301                     (
00302                         fieldToken.compoundToken().type()
00303                      == token::Compound<List<tensor> >::typeName
00304                     )
00305                     {
00306                         tensorField* fPtr = new tensorField;
00307                         fPtr->transfer
00308                         (
00309                             dynamicCast<token::Compound<List<tensor> > >
00310                             (
00311                                 fieldToken.transferCompoundToken()
00312                             )
00313                         );
00314 
00315                         if (fPtr->size() != this->size())
00316                         {
00317                             FatalIOErrorIn
00318                             (
00319                                 "genericFvPatchField<Type>::genericFvPatchField"
00320                                 "(const fvPatch&, const Field<Type>&, "
00321                                 "const dictionary&)",
00322                                 dict
00323                             )   << "\n    size of field " << iter().keyword()
00324                                 << " (" << fPtr->size() << ')'
00325                                 << " is not the same size as the patch ("
00326                                 << this->size() << ')'
00327                                 << "\n    on patch " << this->patch().name()
00328                                 << " of field "
00329                                 << this->dimensionedInternalField().name()
00330                                 << " in file "
00331                                 << this->dimensionedInternalField().objectPath()
00332                                 << exit(FatalIOError);
00333                         }
00334 
00335                         tensorFields_.insert(iter().keyword(), fPtr);
00336                     }
00337                     else
00338                     {
00339                         FatalIOErrorIn
00340                         (
00341                             "genericFvPatchField<Type>::genericFvPatchField"
00342                             "(const fvPatch&, const Field<Type>&, "
00343                             "const dictionary&)",
00344                             dict
00345                         )   << "\n    compound " << fieldToken.compoundToken()
00346                             << " not supported"
00347                             << "\n    on patch " << this->patch().name()
00348                             << " of field "
00349                             << this->dimensionedInternalField().name()
00350                             << " in file "
00351                             << this->dimensionedInternalField().objectPath()
00352                             << exit(FatalIOError);
00353                     }
00354                 }
00355                 else if
00356                 (
00357                     firstToken.isWord()
00358                  && firstToken.wordToken() == "uniform"
00359                 )
00360                 {
00361                     token fieldToken(is);
00362 
00363                     if (!fieldToken.isPunctuation())
00364                     {
00365                         scalarFields_.insert
00366                         (
00367                             iter().keyword(),
00368                             new scalarField
00369                             (
00370                                 this->size(),
00371                                 fieldToken.scalarToken()
00372                             )
00373                         );
00374                     }
00375                     else
00376                     {
00377                         // Read as scalarList.
00378                         is.putBack(fieldToken);
00379 
00380                         scalarList l(is);
00381 
00382                         if (l.size() == vector::nComponents)
00383                         {
00384                             vector vs(l[0], l[1], l[2]);
00385 
00386                             vectorFields_.insert
00387                             (
00388                                 iter().keyword(),
00389                                 new vectorField(this->size(), vs)
00390                             );
00391                         }
00392                         else if (l.size() == sphericalTensor::nComponents)
00393                         {
00394                             sphericalTensor vs(l[0]);
00395 
00396                             sphericalTensorFields_.insert
00397                             (
00398                                 iter().keyword(),
00399                                 new sphericalTensorField(this->size(), vs)
00400                             );
00401                         }
00402                         else if (l.size() == symmTensor::nComponents)
00403                         {
00404                             symmTensor vs(l[0], l[1], l[2], l[3], l[4], l[5]);
00405 
00406                             symmTensorFields_.insert
00407                             (
00408                                 iter().keyword(),
00409                                 new symmTensorField(this->size(), vs)
00410                             );
00411                         }
00412                         else if (l.size() == tensor::nComponents)
00413                         {
00414                             tensor vs
00415                             (
00416                                 l[0], l[1], l[2],
00417                                 l[3], l[4], l[5],
00418                                 l[6], l[7], l[8]
00419                             );
00420 
00421                             tensorFields_.insert
00422                             (
00423                                 iter().keyword(),
00424                                 new tensorField(this->size(), vs)
00425                             );
00426                         }
00427                         else
00428                         {
00429                             FatalIOErrorIn
00430                             (
00431                                 "genericFvPatchField<Type>::genericFvPatchField"
00432                                 "(const fvPatch&, const Field<Type>&, "
00433                                 "const dictionary&)",
00434                                 dict
00435                             )   << "\n    unrecognised native type " << l
00436                                 << "\n    on patch " << this->patch().name()
00437                                 << " of field "
00438                                 << this->dimensionedInternalField().name()
00439                                 << " in file "
00440                                 << this->dimensionedInternalField().objectPath()
00441                                 << exit(FatalIOError);
00442                         }
00443                     }
00444                 }
00445             }
00446         }
00447     }
00448 }
00449 
00450 
00451 template<class Type>
00452 Foam::genericFvPatchField<Type>::genericFvPatchField
00453 (
00454     const genericFvPatchField<Type>& ptf,
00455     const fvPatch& p,
00456     const DimensionedField<Type, volMesh>& iF,
00457     const fvPatchFieldMapper& mapper
00458 )
00459 :
00460     calculatedFvPatchField<Type>(ptf, p, iF, mapper),
00461     actualTypeName_(ptf.actualTypeName_),
00462     dict_(ptf.dict_)
00463 {
00464     for
00465     (
00466         HashPtrTable<scalarField>::const_iterator iter =
00467             ptf.scalarFields_.begin();
00468         iter != ptf.scalarFields_.end();
00469         ++iter
00470     )
00471     {
00472         scalarFields_.insert(iter.key(), new scalarField(*iter(), mapper));
00473     }
00474 
00475     for
00476     (
00477         HashPtrTable<vectorField>::const_iterator iter =
00478             ptf.vectorFields_.begin();
00479         iter != ptf.vectorFields_.end();
00480         ++iter
00481     )
00482     {
00483         vectorFields_.insert(iter.key(), new vectorField(*iter(), mapper));
00484     }
00485 
00486     for
00487     (
00488         HashPtrTable<sphericalTensorField>::const_iterator iter =
00489             ptf.sphericalTensorFields_.begin();
00490         iter != ptf.sphericalTensorFields_.end();
00491         ++iter
00492     )
00493     {
00494         sphericalTensorFields_.insert
00495         (
00496             iter.key(),
00497             new sphericalTensorField(*iter(), mapper)
00498         );
00499     }
00500 
00501     for
00502     (
00503         HashPtrTable<symmTensorField>::const_iterator iter =
00504             ptf.symmTensorFields_.begin();
00505         iter != ptf.symmTensorFields_.end();
00506         ++iter
00507     )
00508     {
00509         symmTensorFields_.insert
00510         (
00511             iter.key(),
00512             new symmTensorField(*iter(), mapper)
00513         );
00514     }
00515 
00516     for
00517     (
00518         HashPtrTable<tensorField>::const_iterator iter =
00519             ptf.tensorFields_.begin();
00520         iter != ptf.tensorFields_.end();
00521         ++iter
00522     )
00523     {
00524         tensorFields_.insert(iter.key(), new tensorField(*iter(), mapper));
00525     }
00526 }
00527 
00528 
00529 template<class Type>
00530 Foam::genericFvPatchField<Type>::genericFvPatchField
00531 (
00532     const genericFvPatchField<Type>& ptf
00533 )
00534 :
00535     calculatedFvPatchField<Type>(ptf),
00536     actualTypeName_(ptf.actualTypeName_),
00537     dict_(ptf.dict_),
00538     scalarFields_(ptf.scalarFields_),
00539     vectorFields_(ptf.vectorFields_),
00540     sphericalTensorFields_(ptf.sphericalTensorFields_),
00541     symmTensorFields_(ptf.symmTensorFields_),
00542     tensorFields_(ptf.tensorFields_)
00543 {}
00544 
00545 
00546 template<class Type>
00547 Foam::genericFvPatchField<Type>::genericFvPatchField
00548 (
00549     const genericFvPatchField<Type>& ptf,
00550     const DimensionedField<Type, volMesh>& iF
00551 )
00552 :
00553     calculatedFvPatchField<Type>(ptf, iF),
00554     actualTypeName_(ptf.actualTypeName_),
00555     dict_(ptf.dict_),
00556     scalarFields_(ptf.scalarFields_),
00557     vectorFields_(ptf.vectorFields_),
00558     sphericalTensorFields_(ptf.sphericalTensorFields_),
00559     symmTensorFields_(ptf.symmTensorFields_),
00560     tensorFields_(ptf.tensorFields_)
00561 {}
00562 
00563 
00564 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
00565 
00566 template<class Type>
00567 void Foam::genericFvPatchField<Type>::autoMap
00568 (
00569     const fvPatchFieldMapper& m
00570 )
00571 {
00572     calculatedFvPatchField<Type>::autoMap(m);
00573 
00574     for
00575     (
00576         HashPtrTable<scalarField>::iterator iter = scalarFields_.begin();
00577         iter != scalarFields_.end();
00578         ++iter
00579     )
00580     {
00581         iter()->autoMap(m);
00582     }
00583 
00584     for
00585     (
00586         HashPtrTable<vectorField>::iterator iter = vectorFields_.begin();
00587         iter != vectorFields_.end();
00588         ++iter
00589     )
00590     {
00591         iter()->autoMap(m);
00592     }
00593 
00594     for
00595     (
00596         HashPtrTable<sphericalTensorField>::iterator iter =
00597             sphericalTensorFields_.begin();
00598         iter != sphericalTensorFields_.end();
00599         ++iter
00600     )
00601     {
00602         iter()->autoMap(m);
00603     }
00604 
00605     for
00606     (
00607         HashPtrTable<symmTensorField>::iterator iter =
00608             symmTensorFields_.begin();
00609         iter != symmTensorFields_.end();
00610         ++iter
00611     )
00612     {
00613         iter()->autoMap(m);
00614     }
00615 
00616     for
00617     (
00618         HashPtrTable<tensorField>::iterator iter = tensorFields_.begin();
00619         iter != tensorFields_.end();
00620         ++iter
00621     )
00622     {
00623         iter()->autoMap(m);
00624     }
00625 }
00626 
00627 
00628 template<class Type>
00629 void Foam::genericFvPatchField<Type>::rmap
00630 (
00631     const fvPatchField<Type>& ptf,
00632     const labelList& addr
00633 )
00634 {
00635     calculatedFvPatchField<Type>::rmap(ptf, addr);
00636 
00637     const genericFvPatchField<Type>& dptf =
00638         refCast<const genericFvPatchField<Type> >(ptf);
00639 
00640     for
00641     (
00642         HashPtrTable<scalarField>::iterator iter = scalarFields_.begin();
00643         iter != scalarFields_.end();
00644         ++iter
00645     )
00646     {
00647         HashPtrTable<scalarField>::const_iterator dptfIter =
00648             dptf.scalarFields_.find(iter.key());
00649 
00650         if (dptfIter != dptf.scalarFields_.end())
00651         {
00652             iter()->rmap(*dptfIter(), addr);
00653         }
00654     }
00655 
00656     for
00657     (
00658         HashPtrTable<vectorField>::iterator iter = vectorFields_.begin();
00659         iter != vectorFields_.end();
00660         ++iter
00661     )
00662     {
00663         HashPtrTable<vectorField>::const_iterator dptfIter =
00664             dptf.vectorFields_.find(iter.key());
00665 
00666         if (dptfIter != dptf.vectorFields_.end())
00667         {
00668             iter()->rmap(*dptfIter(), addr);
00669         }
00670     }
00671 
00672     for
00673     (
00674         HashPtrTable<sphericalTensorField>::iterator iter =
00675             sphericalTensorFields_.begin();
00676         iter != sphericalTensorFields_.end();
00677         ++iter
00678     )
00679     {
00680         HashPtrTable<sphericalTensorField>::const_iterator dptfIter =
00681             dptf.sphericalTensorFields_.find(iter.key());
00682 
00683         if (dptfIter != dptf.sphericalTensorFields_.end())
00684         {
00685             iter()->rmap(*dptfIter(), addr);
00686         }
00687     }
00688 
00689     for
00690     (
00691         HashPtrTable<symmTensorField>::iterator iter =
00692             symmTensorFields_.begin();
00693         iter != symmTensorFields_.end();
00694         ++iter
00695     )
00696     {
00697         HashPtrTable<symmTensorField>::const_iterator dptfIter =
00698             dptf.symmTensorFields_.find(iter.key());
00699 
00700         if (dptfIter != dptf.symmTensorFields_.end())
00701         {
00702             iter()->rmap(*dptfIter(), addr);
00703         }
00704     }
00705 
00706     for
00707     (
00708         HashPtrTable<tensorField>::iterator iter = tensorFields_.begin();
00709         iter != tensorFields_.end();
00710         ++iter
00711     )
00712     {
00713         HashPtrTable<tensorField>::const_iterator dptfIter =
00714             dptf.tensorFields_.find(iter.key());
00715 
00716         if (dptfIter != dptf.tensorFields_.end())
00717         {
00718             iter()->rmap(*dptfIter(), addr);
00719         }
00720     }
00721 }
00722 
00723 
00724 template<class Type>
00725 Foam::tmp<Foam::Field<Type> >
00726 Foam::genericFvPatchField<Type>::valueInternalCoeffs
00727 (
00728     const tmp<scalarField>&
00729 ) const
00730 {
00731     FatalErrorIn
00732     (
00733         "genericFvPatchField<Type>::"
00734         "valueInternalCoeffs(const tmp<scalarField>&) const"
00735     )   << "\n    "
00736            "valueInternalCoeffs cannot be called for a genericFvPatchField"
00737            " (actual type " << actualTypeName_ << ")"
00738         << "\n    on patch " << this->patch().name()
00739         << " of field " << this->dimensionedInternalField().name()
00740         << " in file " << this->dimensionedInternalField().objectPath()
00741         << "\n    You are probably trying to solve for a field with a "
00742            "generic boundary condition."
00743         << exit(FatalError);
00744 
00745     return *this;
00746 }
00747 
00748 
00749 template<class Type>
00750 Foam::tmp<Foam::Field<Type> >
00751 Foam::genericFvPatchField<Type>::valueBoundaryCoeffs
00752 (
00753     const tmp<scalarField>&
00754 ) const
00755 {
00756     FatalErrorIn
00757     (
00758         "genericFvPatchField<Type>::"
00759         "valueBoundaryCoeffs(const tmp<scalarField>&) const"
00760     )   << "\n    "
00761            "valueBoundaryCoeffs cannot be called for a genericFvPatchField"
00762            " (actual type " << actualTypeName_ << ")"
00763         << "\n    on patch " << this->patch().name()
00764         << " of field " << this->dimensionedInternalField().name()
00765         << " in file " << this->dimensionedInternalField().objectPath()
00766         << "\n    You are probably trying to solve for a field with a "
00767            "generic boundary condition."
00768         << exit(FatalError);
00769 
00770     return *this;
00771 }
00772 
00773 
00774 template<class Type>
00775 Foam::tmp<Foam::Field<Type> >
00776 Foam::genericFvPatchField<Type>::gradientInternalCoeffs() const
00777 {
00778     FatalErrorIn
00779     (
00780         "genericFvPatchField<Type>::"
00781         "gradientInternalCoeffs() const"
00782     )   << "\n    "
00783            "gradientInternalCoeffs cannot be called for a genericFvPatchField"
00784            " (actual type " << actualTypeName_ << ")"
00785         << "\n    on patch " << this->patch().name()
00786         << " of field " << this->dimensionedInternalField().name()
00787         << " in file " << this->dimensionedInternalField().objectPath()
00788         << "\n    You are probably trying to solve for a field with a "
00789            "generic boundary condition."
00790         << exit(FatalError);
00791 
00792     return *this;
00793 }
00794 
00795 template<class Type>
00796 Foam::tmp<Foam::Field<Type> >
00797 Foam::genericFvPatchField<Type>::gradientBoundaryCoeffs() const
00798 {
00799     FatalErrorIn
00800     (
00801         "genericFvPatchField<Type>::"
00802         "gradientBoundaryCoeffs() const"
00803     )   << "\n    "
00804            "gradientBoundaryCoeffs cannot be called for a genericFvPatchField"
00805            " (actual type " << actualTypeName_ << ")"
00806         << "\n    on patch " << this->patch().name()
00807         << " of field " << this->dimensionedInternalField().name()
00808         << " in file " << this->dimensionedInternalField().objectPath()
00809         << "\n    You are probably trying to solve for a field with a "
00810            "generic boundary condition."
00811         << exit(FatalError);
00812 
00813     return *this;
00814 }
00815 
00816 
00817 template<class Type>
00818 void Foam::genericFvPatchField<Type>::write(Ostream& os) const
00819 {
00820     os.writeKeyword("type") << actualTypeName_ << token::END_STATEMENT << nl;
00821 
00822     for
00823     (
00824         dictionary::const_iterator iter = dict_.begin();
00825         iter != dict_.end();
00826         ++iter
00827     )
00828     {
00829         if (iter().keyword() != "type" && iter().keyword() != "value")
00830         {
00831             if
00832             (
00833                 iter().isStream()
00834              && iter().stream().size()
00835              && iter().stream()[0].isWord()
00836              && iter().stream()[0].wordToken() == "nonuniform"
00837             )
00838             {
00839                 if (scalarFields_.found(iter().keyword()))
00840                 {
00841                     scalarFields_.find(iter().keyword())()
00842                         ->writeEntry(iter().keyword(), os);
00843                 }
00844                 else if (vectorFields_.found(iter().keyword()))
00845                 {
00846                     vectorFields_.find(iter().keyword())()
00847                         ->writeEntry(iter().keyword(), os);
00848                 }
00849                 else if (sphericalTensorFields_.found(iter().keyword()))
00850                 {
00851                     sphericalTensorFields_.find(iter().keyword())()
00852                         ->writeEntry(iter().keyword(), os);
00853                 }
00854                 else if (symmTensorFields_.found(iter().keyword()))
00855                 {
00856                     symmTensorFields_.find(iter().keyword())()
00857                         ->writeEntry(iter().keyword(), os);
00858                 }
00859                 else if (tensorFields_.found(iter().keyword()))
00860                 {
00861                     tensorFields_.find(iter().keyword())()
00862                         ->writeEntry(iter().keyword(), os);
00863                 }
00864             }
00865             else
00866             {
00867                iter().write(os);
00868             }
00869         }
00870     }
00871 
00872     this->writeEntry("value", os);
00873 }
00874 
00875 
00876 // ************************************************************************* //
Copyright © 2000-2009 OpenCFD Ltd