Initial commit for version 2.0.x patch release
[OpenFOAM-2.0.x.git] / src / lagrangian / intermediate / submodels / SubModelBase.C
blob5f8b988276da6180a4d8266aafd79b6c87ca67dd
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
4    \\    /   O peration     |
5     \\  /    A nd           | Copyright (C) 2010-2011 OpenCFD Ltd.
6      \\/     M anipulation  |
7 -------------------------------------------------------------------------------
8 License
9     This file is part of OpenFOAM.
11     OpenFOAM is free software: you can redistribute it and/or modify it
12     under the terms of the GNU General Public License as published by
13     the Free Software Foundation, either version 3 of the License, or
14     (at your option) any later version.
16     OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17     ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18     FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
19     for more details.
21     You should have received a copy of the GNU General Public License
22     along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
24 \*---------------------------------------------------------------------------*/
26 #include "SubModelBase.H"
28 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
30 template<class CloudType>
31 Foam::SubModelBase<CloudType>::SubModelBase(CloudType& owner)
33     owner_(owner),
34     dict_(dictionary::null),
35     coeffDict_(dictionary::null)
39 template<class CloudType>
40 Foam::SubModelBase<CloudType>::SubModelBase
42     CloudType& owner,
43     const dictionary& dict,
44     const word& name,
45     const word& dictExt
48     owner_(owner),
49     dict_(dict),
50     coeffDict_(dict.subDict(name + dictExt))
54 template<class CloudType>
55 Foam::SubModelBase<CloudType>::SubModelBase(const SubModelBase<CloudType>& smb)
57     owner_(smb.owner_),
58     dict_(smb.dict_),
59     coeffDict_(smb.coeffDict_)
63 // * * * * * * * * * * * * * * * * Destructor  * * * * * * * * * * * * * * * //
65 template<class CloudType>
66 Foam::SubModelBase<CloudType>::~SubModelBase()
70 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
72 template<class CloudType>
73 const CloudType& Foam::SubModelBase<CloudType>::owner() const
75     return owner_;
79 template<class CloudType>
80 const Foam::dictionary& Foam::SubModelBase<CloudType>::dict() const
82     return dict_;
86 template<class CloudType>
87 const Foam::dictionary& Foam::SubModelBase<CloudType>::coeffDict() const
89     return coeffDict_;
93 template<class CloudType>
94 bool Foam::SubModelBase<CloudType>::defaultCoeffs(const bool printMsg) const
96     bool def = coeffDict_.lookupOrDefault<bool>("defaultCoeffs", false);
97     if (printMsg && def)
98     {
99         Info<< incrIndent;
100         Info<< indent << "Employing default coefficients" << endl;
101         Info<< decrIndent;
102     }
104     return def;
108 template<class CloudType>
109 CloudType& Foam::SubModelBase<CloudType>::owner()
111     return owner_;
115 template<class CloudType>
116 bool Foam::SubModelBase<CloudType>::active() const
118     return true;
122 template<class CloudType>
123 void Foam::SubModelBase<CloudType>::cacheFields(const bool)
125     // do nothing
129 template<class CloudType>
130 void Foam::SubModelBase<CloudType>::write(Ostream& os) const
132     os.writeKeyword("owner") << owner_.name() << token::END_STATEMENT << nl;
134     // not writing complete cloud dictionary, only coeffs
135 //    os  << dict_;
136     os  << coeffDict_;
140 // ************************************************************************* //