/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2013-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 "Basic.H"
#include "zeroGradientFvPatchField.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template
Foam::AveragingMethods::Basic::Basic
(
const IOobject& io,
const dictionary& dict,
const fvMesh& mesh
)
:
AveragingMethod(io, dict, mesh, labelList(1, mesh.nCells())),
data_(FieldField::operator[](0)),
dataGrad_(mesh.nCells())
{}
template
Foam::AveragingMethods::Basic::Basic
(
const Basic& am
)
:
AveragingMethod(am),
data_(FieldField::operator[](0)),
dataGrad_(am.dataGrad_)
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
template
Foam::AveragingMethods::Basic::~Basic()
{}
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
template
void Foam::AveragingMethods::Basic::updateGrad()
{
GeometricField tempData
(
IOobject
(
"BasicAverage::Data",
this->mesh_,
IOobject::NO_READ,
IOobject::NO_WRITE,
false
),
this->mesh_,
dimensioned("zero", dimless, Zero),
zeroGradientFvPatchField::typeName
);
tempData.internalField() = data_;
tempData.correctBoundaryConditions();
dataGrad_ = fvc::grad(tempData)->internalField();
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template
void Foam::AveragingMethods::Basic::add
(
const point position,
const tetIndices& tetIs,
const Type& value
)
{
data_[tetIs.cell()] += value/this->mesh_.V()[tetIs.cell()];
}
template
Type Foam::AveragingMethods::Basic::interpolate
(
const point position,
const tetIndices& tetIs
) const
{
return data_[tetIs.cell()];
}
template
typename Foam::AveragingMethods::Basic::TypeGrad
Foam::AveragingMethods::Basic::interpolateGrad
(
const point position,
const tetIndices& tetIs
) const
{
return dataGrad_[tetIs.cell()];
}
template
Foam::tmp>
Foam::AveragingMethods::Basic::internalField() const
{
return tmp>(data_);
}
// ************************************************************************* //