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 // Member Functions
//- Sum surface field contributions to create cell values //- Sum surface field contributions to create cell values
template<class Type> template<class Type, class WeightType>
static tmp<GeometricField<Type, fvPatchField, volMesh> > weightedSum static
tmp
<
GeometricField
<
typename outerProduct<WeightType, Type>::type,
fvPatchField,
volMesh
>
> weightedSum
( (
const mapDistribute& map, const mapDistribute& map,
const labelListList& stencil, const labelListList& stencil,
const GeometricField<Type, fvPatchField, volMesh>& fld, 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 * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class Type> template<class Type, class WeightType>
Foam::tmp<Foam::GeometricField<Type, Foam::fvPatchField, Foam::volMesh> > Foam::tmp
Foam::extendedCellToCellStencil::weightedSum <
Foam::GeometricField
<
typename Foam::outerProduct<WeightType, Type>::type,
Foam::fvPatchField,
Foam::volMesh
>
> Foam::extendedCellToCellStencil::weightedSum
( (
const mapDistribute& map, const mapDistribute& map,
const labelListList& stencil, const labelListList& stencil,
const GeometricField<Type, fvPatchField, volMesh>& fld, 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(); const fvMesh& mesh = fld.mesh();
// Collect internal and boundary values // Collect internal and boundary values
List<List<Type> > stencilFld; List<List<Type> > stencilFld;
collectData(map, stencil, fld, stencilFld); collectData(map, stencil, fld, stencilFld);
tmp<GeometricField<Type, fvPatchField, volMesh> > tsfCorr tmp<WeightedFieldType> twf
( (
new GeometricField<Type, fvPatchField, volMesh> new WeightedFieldType
( (
IOobject IOobject
( (
@ -62,23 +73,23 @@ Foam::extendedCellToCellStencil::weightedSum
) )
) )
); );
GeometricField<Type, fvPatchField, volMesh>& sf = tsfCorr(); WeightedFieldType& wf = twf();
// cells // cells
forAll(sf, cellI) forAll(wf, cellI)
{ {
const List<Type>& stField = stencilFld[cellI]; const List<Type>& stField = stencilFld[cellI];
const List<scalar>& stWeight = stencilWeights[cellI]; const List<WeightType>& stWeight = stencilWeights[cellI];
forAll(stField, i) forAll(stField, i)
{ {
sf[cellI] += stField[i]*stWeight[i]; wf[cellI] += stWeight[i]*stField[i];
} }
} }
// Boundaries values? // Boundaries values?
return tsfCorr; return twf;
} }

View File

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

View File

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