1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | foam-extend: Open Source CFD
4 \\ / O peration | Version: 3.2
5 \\ / A nd | Web: http://www.foam-extend.org
6 \\/ M anipulation | For copyright notice see file Copyright
7 -------------------------------------------------------------------------------
9 This file is part of foam-extend.
11 foam-extend is free software: you can redistribute it and/or modify it
12 under the terms of the GNU General Public License as published by the
13 Free Software Foundation, either version 3 of the License, or (at your
14 option) any later version.
16 foam-extend is distributed in the hope that it will be useful, but
17 WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 General Public License for more details.
21 You should have received a copy of the GNU General Public License
22 along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
24 \*---------------------------------------------------------------------------*/
26 #include "scalarMult.H"
27 #include "addToRunTimeSelectionTable.H"
29 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
35 defineTypeNameAndDebug(scalarMult, 0);
36 addToRunTimeSelectionTable(calcType, scalarMult, dictionary);
41 // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
43 void Foam::calcTypes::scalarMult::writeScalarMultValues
47 const IOobject& baseFieldHeader
50 bool processed = false;
52 writeScalarMultValue<scalar>
59 writeScalarMultValue<vector>
66 writeScalarMultValue<sphericalTensor>
73 writeScalarMultValue<symmTensor>
80 writeScalarMultValue<tensor>
90 FatalErrorIn("calcTypes::scalarMult::writeScalarMultValue()")
91 << "Unable to process " << baseFieldName_
92 << " + " << scalarMultValueStr_ << nl
93 << "No call to scalarMult for fields of type "
94 << baseFieldHeader.headerClassName() << nl << nl
100 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
102 Foam::calcTypes::scalarMult::scalarMult()
106 scalarMultValueStr_(""),
111 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
113 Foam::calcTypes::scalarMult::~scalarMult()
117 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
119 void Foam::calcTypes::scalarMult::init()
121 argList::validArgs.append("scalarMult");
122 argList::validArgs.append("baseField");
123 argList::validOptions.insert("value", "valueString");
124 argList::validOptions.insert("resultName", "fieldName");
128 void Foam::calcTypes::scalarMult::preCalc
135 baseFieldName_ = args.additionalArgs()[1];
137 if (args.optionFound("value"))
139 scalarMultValueStr_ = args.option("value");
143 FatalErrorIn("calcTypes::scalarMult::preCalc")
144 << "scalarMult requires -value option"
145 << nl << exit(FatalError);
148 if (args.optionFound("resultName"))
150 resultName_ = args.option("resultName");
155 void Foam::calcTypes::scalarMult::calc
162 IOobject baseFieldHeader
170 if (baseFieldHeader.headerOk())
172 writeScalarMultValues(runTime, mesh, baseFieldHeader);
176 FatalErrorIn("calcTypes::scalarMult::calc")
177 << "Unable to read base field: " << baseFieldName_
178 << nl << exit(FatalError);
183 // ************************************************************************* //