Merge branch 'master' of /home/dm4/OpenFOAM/OpenFOAM-dev

This commit is contained in:
mattijs
2013-02-20 09:53:06 +00:00
4 changed files with 54 additions and 25 deletions

View File

@ -69,13 +69,22 @@ public:
// Member Functions
//- Sum surface field contributions to create cell values
template<class Type>
static tmp<GeometricField<Type, fvPatchField, volMesh> > weightedSum
template<class Type, class WeightType>
static
tmp
<
GeometricField
<
typename outerProduct<WeightType, Type>::type,
fvPatchField,
volMesh
>
> weightedSum
(
const mapDistribute& map,
const labelListList& stencil,
const GeometricField<Type, fvPatchField, volMesh>& fld,
const List<List<scalar> >& stencilWeights
const List<List<WeightType> >& stencilWeights
);
};

View File

@ -27,25 +27,36 @@ License
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class Type>
Foam::tmp<Foam::GeometricField<Type, Foam::fvPatchField, Foam::volMesh> >
Foam::extendedCellToCellStencil::weightedSum
template<class Type, class WeightType>
Foam::tmp
<
Foam::GeometricField
<
typename Foam::outerProduct<WeightType, Type>::type,
Foam::fvPatchField,
Foam::volMesh
>
> Foam::extendedCellToCellStencil::weightedSum
(
const mapDistribute& map,
const labelListList& stencil,
const GeometricField<Type, fvPatchField, volMesh>& fld,
const List<List<scalar> >& stencilWeights
const List<List<WeightType> >& stencilWeights
)
{
typedef typename outerProduct<WeightType, Type>::type WeightedType;
typedef GeometricField<WeightedType, fvPatchField, volMesh>
WeightedFieldType;
const fvMesh& mesh = fld.mesh();
// Collect internal and boundary values
List<List<Type> > stencilFld;
collectData(map, stencil, fld, stencilFld);
tmp<GeometricField<Type, fvPatchField, volMesh> > tsfCorr
tmp<WeightedFieldType> twf
(
new GeometricField<Type, fvPatchField, volMesh>
new WeightedFieldType
(
IOobject
(
@ -62,23 +73,23 @@ Foam::extendedCellToCellStencil::weightedSum
)
)
);
GeometricField<Type, fvPatchField, volMesh>& sf = tsfCorr();
WeightedFieldType& wf = twf();
// cells
forAll(sf, cellI)
forAll(wf, cellI)
{
const List<Type>& stField = stencilFld[cellI];
const List<scalar>& stWeight = stencilWeights[cellI];
const List<WeightType>& stWeight = stencilWeights[cellI];
forAll(stField, i)
{
sf[cellI] += stField[i]*stWeight[i];
wf[cellI] += stWeight[i]*stField[i];
}
}
// Boundaries values?
return tsfCorr;
return twf;
}

View File

@ -116,11 +116,19 @@ public:
}
//- Sum vol field contributions to create cell values
template<class Type>
tmp<GeometricField<Type, fvPatchField, volMesh> > weightedSum
template<class Type, class WeightType>
tmp
<
GeometricField
<
typename outerProduct<WeightType, Type>::type,
fvPatchField,
volMesh
>
> weightedSum
(
const GeometricField<Type, fvPatchField, volMesh>& fld,
const List<List<scalar> >& stencilWeights
const List<List<WeightType> >& stencilWeights
) const
{
return weightedSum
@ -131,7 +139,6 @@ public:
stencilWeights
);
}
};

View File

@ -26,6 +26,7 @@ License
#include "fieldValueDelta.H"
#include "ListOps.H"
#include "Time.H"
#include "volFields.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
@ -38,16 +39,15 @@ namespace Foam
template<>
const char*
NamedEnum<fieldValues::fieldValueDelta::operationType, 5>::names[] =
NamedEnum<fieldValues::fieldValueDelta::operationType, 4>::names[] =
{
"add",
"subtract",
"min",
"max",
"average"
"max"
};
const NamedEnum<fieldValues::fieldValueDelta::operationType, 5>
const NamedEnum<fieldValues::fieldValueDelta::operationType, 4>
fieldValues::fieldValueDelta::operationTypeNames_;
}
@ -159,7 +159,7 @@ void Foam::fieldValues::fieldValueDelta::write()
if (log_)
{
Info<< type() << " " << name_ << " output:" << endl;
Info<< type() << " output:" << endl;
}
bool found = false;
@ -180,8 +180,10 @@ void Foam::fieldValues::fieldValueDelta::write()
{
Info<< " none" << endl;
}
Info<< endl;
else
{
Info<< endl;
}
}
}