/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see .
\*---------------------------------------------------------------------------*/
#include "volRegion.H"
#include "fvMesh.H"
#include "volFields.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
namespace functionObjects
{
namespace fieldValues
{
defineTypeNameAndDebug(volRegion, 0);
addToRunTimeSelectionTable(fieldValue, volRegion, dictionary);
addToRunTimeSelectionTable(functionObject, volRegion, dictionary);
}
}
}
template<>
const char*
Foam::NamedEnum
<
Foam::functionObjects::fieldValues::volRegion::regionTypes,
2
>::names[] = {"cellZone", "all"};
template<>
const char*
Foam::NamedEnum
<
Foam::functionObjects::fieldValues::volRegion::operationType,
11
>::names[] =
{
"none",
"sum",
"sumMag",
"average",
"weightedAverage",
"volAverage",
"weightedVolAverage",
"volIntegrate",
"min",
"max",
"CoV"
};
const Foam::NamedEnum
<
Foam::functionObjects::fieldValues::volRegion::regionTypes,
2
> Foam::functionObjects::fieldValues::volRegion::regionTypeNames_;
const Foam::NamedEnum
<
Foam::functionObjects::fieldValues::volRegion::operationType,
11
> Foam::functionObjects::fieldValues::volRegion::operationTypeNames_;
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
void Foam::functionObjects::fieldValues::volRegion::setCellZoneCells()
{
switch (regionType_)
{
case stCellZone:
{
dict().lookup("name") >> name_;
label zoneId = mesh().cellZones().findZoneID(name_);
if (zoneId < 0)
{
FatalErrorInFunction
<< "Unknown cell zone name: " << name_
<< ". Valid cell zones are: " << mesh().cellZones().names()
<< nl << exit(FatalError);
}
cellId_ = mesh().cellZones()[zoneId];
nCells_ = returnReduce(cellId_.size(), sumOp