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 
00028 
00029 
00030 
00031 
00032 
00033 
00034 
00035 
00036 
00037 
00038 
00039 
00040 
00041 
00042 
00043 
00044 
00045 
00046 
00047 
00048 
00049 
00050 
00051 
00052 
00053 
00054 
00055 
00056 
00057 
00058 
00059 
00060 
00061 
00062 
00063 
00064 
00065 
00066 
00067 
00068 
00069 
00070 
00071 
00072 
00073 
00074 
00075 
00076 
00077 
00078 
00079 
00080 
00081 #ifndef basicSource_H
00082 #define basicSource_H
00083 
00084 #include <finiteVolume/fvMatrices.H>
00085 #include <meshTools/cellSet.H>
00086 #include <finiteVolume/volFieldsFwd.H>
00087 #include <OpenFOAM/DimensionedField.H>
00088 #include <OpenFOAM/autoPtr.H>
00089 #include <OpenFOAM/runTimeSelectionTables.H>
00090 
00091 
00092 
00093 namespace Foam
00094 {
00095 
00096 class fvMesh;
00097 
00098 
00099 
00100 
00101 
00102 class basicSource
00103 {
00104 public:
00105 
00106     
00107 
00108         
00109         enum selectionModeType
00110         {
00111             smPoints,
00112             smCellSet,
00113             smCellZone,
00114             smAll
00115         };
00116 
00117         
00118         static const wordList selectionModeTypeNames_;
00119 
00120 
00121 protected:
00122 
00123     
00124 
00125         
00126         word name_;
00127 
00128         
00129         const fvMesh& mesh_;
00130 
00131         
00132         const dictionary& dict_;
00133 
00134         
00135         bool active_;
00136 
00137         
00138         scalar timeStart_;
00139 
00140         
00141         scalar duration_;
00142 
00143         
00144         selectionModeType selectionMode_;
00145 
00146         
00147         word cellSetName_;
00148 
00149         
00150         labelList cells_;
00151 
00152         
00153         scalar V_;
00154 
00155 
00156     
00157 
00158         
00159         selectionModeType wordToSelectionModeType(const word& smtName) const;
00160 
00161         
00162         word selectionModeTypeToWord(const selectionModeType& smtType) const;
00163 
00164         
00165         void setSelection(const dictionary& dict);
00166 
00167         
00168         void setCellSet();
00169 
00170 
00171 public:
00172 
00173     
00174     TypeName("basicSource");
00175 
00176 
00177      
00178 
00179         declareRunTimeSelectionTable
00180         (
00181             autoPtr,
00182             basicSource,
00183             dictionary,
00184             (
00185                 const word& name,
00186                 const dictionary& dict,
00187                 const fvMesh& mesh
00188             ),
00189             (name, dict, mesh)
00190         );
00191 
00192 
00193     
00194 
00195         
00196         basicSource
00197         (
00198             const word& name,
00199             const dictionary& dict,
00200             const fvMesh& mesh
00201         );
00202 
00203         
00204         autoPtr<basicSource> clone() const
00205         {
00206             notImplemented
00207             (
00208                 "autoPtr<basicSource> clone() const"
00209             );
00210             return autoPtr<basicSource>(NULL);
00211         }
00212 
00213         
00214         
00215         class iNew
00216         {
00217             
00218             const fvMesh& mesh_;
00219             const word& name_;
00220 
00221         public:
00222 
00223             iNew
00224             (
00225                 const fvMesh& mesh,
00226                 const word& name
00227             )
00228             :
00229                 mesh_(mesh),
00230                 name_(name)
00231             {}
00232 
00233             autoPtr<basicSource> operator()(Istream& is) const
00234             {
00235                 
00236                 const dictionary dict(is);
00237 
00238                 return autoPtr<basicSource>
00239                 (
00240                     basicSource::New
00241                     (
00242                         name_,
00243                         dict,
00244                         mesh_
00245                     )
00246                 );
00247             }
00248         };
00249 
00250 
00251     
00252 
00253         
00254         static autoPtr<basicSource> New
00255         (
00256             const word& name,
00257             const dictionary& dict,
00258             const fvMesh& mesh
00259         );
00260 
00261 
00262     
00263     virtual ~basicSource()
00264     {}
00265 
00266 
00267     
00268 
00269         
00270 
00271             
00272             inline const word& name() const;
00273 
00274             
00275             inline const fvMesh& mesh() const;
00276 
00277             
00278             inline const dictionary& dictCoeffs() const;
00279 
00280             
00281             inline bool active() const;
00282 
00283             
00284             inline scalar timeStart() const;
00285 
00286             
00287             inline scalar duration() const;
00288 
00289             
00290             inline scalar timeEnd() const;
00291 
00292             
00293             inline const selectionModeType& selectionMode() const;
00294 
00295             
00296             
00297             inline const word& cellSetName() const;
00298 
00299             
00300             inline scalar V() const;
00301 
00302             
00303             inline const labelList& cells() const;
00304 
00305 
00306         
00307 
00308             
00309             inline word& name();
00310 
00311             
00312             inline bool& active();
00313 
00314             
00315             inline scalar& timeStart();
00316 
00317             
00318             inline scalar& duration();
00319 
00320             
00321             inline selectionModeType& selectionMode();
00322 
00323             
00324             inline List<point>& points();
00325 
00326             
00327             
00328             inline word& cellSetName();
00329 
00330             
00331             inline scalar& V();
00332 
00333             
00334             inline labelList& cells();
00335 
00336 
00337         
00338 
00339             
00340             bool isActive();
00341 
00342 
00343         
00344 
00345             
00346             virtual void addExplicitSources() = 0;
00347 
00348             
00349             virtual void addSu(DimensionedField<scalar, volMesh>& field) = 0;
00350 
00351             
00352             virtual void addSu(DimensionedField<vector, volMesh>& field) = 0;
00353 
00354             
00355             virtual void addSu(fvMatrix<vector>& Eqn) = 0;
00356 
00357             
00358             virtual void addSu(fvMatrix<scalar>& Eqn) = 0;
00359 
00360 
00361         
00362 
00363             
00364             virtual void writeData(Ostream&) const = 0;
00365 
00366             
00367             virtual bool read(const dictionary& dict) = 0;
00368 
00369 };
00370 
00371 
00372 
00373 
00374 } 
00375 
00376 
00377 
00378 #include "basicSourceI.H"
00379 
00380 
00381 
00382 #endif
00383 
00384