bool Foam::functionObjects::regionFunctionObject::store
(
    word& fieldName,
    const tmp<ObjectType>& tfield,
    bool cacheable
)
{
    if (cacheable && fieldName == tfield().name())
    {
        WarningInFunction
            << "Cannot store cache-able field with the named used in the cache."
            << nl
            << "    Either choose a different name or cache the field"
            << "    and use the 'writeObjects' functionObject."
            << endl;

        return false;
    }

    if
    (
        fieldName.size()
     && obr_.foundObject<ObjectType>(fieldName)
    )
    {
        const ObjectType& field =
        (
            obr_.lookupObject<ObjectType>(fieldName)
        );

        // If there is a result field already registered assign to the new
        // result field otherwise transfer ownership of the new result field to
        // the object registry
        if (&field != &tfield())
        {
            const_cast<ObjectType&>(field) = tfield;
        }
        else
        {
            obr_.objectRegistry::store(tfield.ptr());
        }
    }
    else
    {
        if (fieldName.size() && fieldName != tfield().name())
        {
            tfield.ref().rename(fieldName);
        }
        else
        {
            fieldName = tfield().name();
        }

        obr_.objectRegistry::store(tfield.ptr());
    }

    return true;
}
Example #2
0
tmp<GeometricField<Type, PatchField, GeoMesh> > transform
(
    const tmp<GeometricField<tensor, PatchField, GeoMesh> >& ttrf,
    const tmp<GeometricField<Type, PatchField, GeoMesh> >& ttf
)
{
    tmp<GeometricField<Type, PatchField, GeoMesh> > tranf =
        transform(ttrf(), ttf());
    ttf.clear();
    ttrf.clear();
    return tranf;
}
Example #3
0
tmp<GeometricField<Type, faPatchField, areaMesh> > laplacian
(
    const tmp<edgeScalarField>& tgamma,
    const tmp<GeometricField<Type, faPatchField, areaMesh> >& tvf
)
{
    tmp<GeometricField<Type, faPatchField, areaMesh> > Laplacian
    (
        fac::laplacian(tgamma(), tvf())
    );
    tgamma.clear();
    tvf.clear();
    return Laplacian;
}
Example #4
0
tmp<GeometricField<Type, fvPatchField, volMesh> > laplacian
(
    const tmp<GeometricField<GType, fvsPatchField, surfaceMesh> >& tgamma,
    const tmp<GeometricField<Type, fvPatchField, volMesh> >& tvf
)
{
    tmp<GeometricField<Type, fvPatchField, volMesh> > Laplacian
    (
        fvc::laplacian(tgamma(), tvf())
    );
    tgamma.clear();
    tvf.clear();
    return Laplacian;
}
tmp<GeometricField<Type, faPatchField, areaMesh> >
div
(
    const tmp<edgeScalarField>& tflux,
    const tmp<GeometricField<Type, faPatchField, areaMesh> >& tvf
)
{
    tmp<GeometricField<Type, faPatchField, areaMesh> > Div
    (
        fac::div(tflux(), tvf())
    );
    tflux.clear();
    tvf.clear();
    return Div;
}
tmp<GeometricField<Type, fvPatchField, volMesh> >
div
(
    const tmp<surfaceScalarField>& tflux,
    const tmp<GeometricField<Type, fvPatchField, volMesh> >& tvf
)
{
    tmp<GeometricField<Type, fvPatchField, volMesh> > Div
    (
        fvc::div(tflux(), tvf())
    );
    tflux.clear();
    tvf.clear();
    return Div;
}
Example #7
0
tmp<GeometricField<Type, fvsPatchField, surfaceMesh>>
flux
(
    const tmp<surfaceScalarField>& tphi,
    const tmp<GeometricField<Type, fvPatchField, volMesh>>& tvf
)
{
    tmp<GeometricField<Type, fvsPatchField, surfaceMesh>> Flux
    (
        fvc::flux(tphi(), tvf())
    );
    tphi.clear();
    tvf.clear();
    return Flux;
}
Example #8
0
Foam::tmp<Foam::gpuField<Type> >
Foam::lduMatrix::faceH(const tmp<gpuField<Type> >& tpsi) const
{
    tmp<gpuField<Type> > tfaceHpsi(faceH(tpsi()));
    tpsi.clear();
    return tfaceHpsi;
}
Example #9
0
tmp<gpuField<Type> >
volumeIntegrate(const tmp<DimensionedField<Type, volMesh> >& tdf)
{
    tmp<gpuField<Type> > tdidf = tdf().mesh().V()*tdf().field();
    tdf.clear();
    return tdidf;
}
Example #10
0
tmp<complexVectorField> fft::reverseTransform
(
    const tmp<complexVectorField>& tfield,
    const labelList& nn
)
{
    tmp<complexVectorField> tifftVectorField
    (
        new complexVectorField
        (
            tfield().size()
        )
    );

    for (direction cmpt=0; cmpt<vector::nComponents; cmpt++)
    {
        tifftVectorField().replace
        (
            cmpt,
            reverseTransform(tfield().component(cmpt), nn)
        );
    }

    tfield.clear();

    return tifftVectorField;
}
Example #11
0
tmp<GeometricField<Type, fvsPatchField, surfaceMesh> >
interpolate
(
    const tmp<GeometricField<Type, fvPatchField, volMesh> >& tvf,
    const tmp<surfaceScalarField>& tFaceFlux,
    const word& name
)
{
    tmp<GeometricField<Type, fvsPatchField, surfaceMesh> > tsf =
        interpolate(tvf(), tFaceFlux(), name);

    tvf.clear();
    tFaceFlux.clear();

    return tsf;
}
Example #12
0
tmp<GeometricField<Type, fvPatchField, volMesh> >
laplacian
(
    const tmp<GeometricField<GType, fvPatchField, volMesh> >& tgamma,
    const tmp<GeometricField<Type, fvPatchField, volMesh> >& tvf,
    const word& name
)
{
    tmp<GeometricField<Type, fvPatchField, volMesh> > Laplacian
    (
        fvc::laplacian(tgamma(), tvf(), name)
    );
    tgamma.clear();
    tvf.clear();
    return Laplacian;
}
Example #13
0
Foam::tmp<Foam::Field<Type> >
Foam::lduMatrix::H(const tmp<Field<Type> >& tpsi) const
{
    tmp<Field<Type> > tHpsi(H(tpsi()));
    tpsi.clear();
    return tHpsi;
}
Example #14
0
DimensionedField<Type, GeoMesh>::DimensionedField
(
    const tmp<DimensionedField<Type, GeoMesh> >& tdf
)
:
    regIOobject(tdf(), tdf.isTmp()),
    Field<Type>
    (
        const_cast<DimensionedField<Type, GeoMesh>&>(tdf()),
        tdf.isTmp()
    ),
    mesh_(tdf().mesh_),
    dimensions_(tdf().dimensions_)
{
    tdf.clear();
}
Example #15
0
tmp
<
    GeometricField
    <
        typename outerProduct<vector,Type>::type, faPatchField, areaMesh
    >
>
grad
(
    const tmp<GeometricField<Type, faPatchField, areaMesh> >& tvf,
    const word& name
)
{
    tmp
    <
        GeometricField
        <
            typename outerProduct<vector, Type>::type, faPatchField, areaMesh
        >
    > tGrad
    (
        fac::grad(tvf(), name)
    );
    tvf.clear();
    return tGrad;
}
Example #16
0
void Foam::lduMatrix::Amul
(
    scalarField& Apsi,
    const tmp<scalarField>& tpsi,
    const FieldField<Field, scalar>& interfaceBouCoeffs,
    const lduInterfaceFieldPtrsList& interfaces,
    const direction cmpt
) const
{
    scalar* __restrict__ ApsiPtr = Apsi.begin();

    const scalarField& psi = tpsi();
    const scalar* const __restrict__ psiPtr = psi.begin();

    const scalar* const __restrict__ diagPtr = diag().begin();

    const label* const __restrict__ uPtr = lduAddr().upperAddr().begin();
    const label* const __restrict__ lPtr = lduAddr().lowerAddr().begin();

    const scalar* const __restrict__ upperPtr = upper().begin();
    const scalar* const __restrict__ lowerPtr = lower().begin();

    // Initialise the update of interfaced interfaces
    initMatrixInterfaces
    (
        interfaceBouCoeffs,
        interfaces,
        psi,
        Apsi,
        cmpt
    );

    const label nCells = diag().size();
    for (label cell=0; cell<nCells; cell++)
    {
        ApsiPtr[cell] = diagPtr[cell]*psiPtr[cell];
    }


    const label nFaces = upper().size();

    for (label face=0; face<nFaces; face++)
    {
        ApsiPtr[uPtr[face]] += lowerPtr[face]*psiPtr[lPtr[face]];
        ApsiPtr[lPtr[face]] += upperPtr[face]*psiPtr[uPtr[face]];
    }

    // Update interface interfaces
    updateMatrixInterfaces
    (
        interfaceBouCoeffs,
        interfaces,
        psi,
        Apsi,
        cmpt
    );

    tpsi.clear();
}
Example #17
0
Foam::boundBox::boundBox(const tmp<pointField>& points, const bool doReduce)
:
    min_(Zero),
    max_(Zero)
{
    calculate(points(), doReduce);
    points.clear();
}
Example #18
0
dimensioned<Type> DimensionedField<Type, GeoMesh>::weightedAverage
(
    const tmp<DimensionedField<scalar, GeoMesh> >& tweightField
) const
{
    dimensioned<Type> wa = weightedAverage(tweightField());
    tweightField.clear();
    return wa;
}
Foam::tmp<Foam::Field<Type> > Foam::cuttingPlane::sample
(
    const tmp<Field<Type> >& tfld
) const
{
    tmp<Field<Type> > tsf = sample(tfld());
    tfld.clear();
    return tsf;
}
Example #20
0
dimensioned<Type> domainIntegrate
(
    const tmp<GeometricField<Type, fvPatchField, volMesh> >& tvf
)
{
    dimensioned<Type> integral = domainIntegrate(tvf());
    tvf.clear();
    return integral;
}
Foam::tmp<Foam::Field<Type> > Foam::cuttingPlane::sample
(
    const tmp<Field<Type> >& tsf
) const
{
    tmp<Field<Type> > tint = sample(tsf());
    tsf.clear();
    return tint;
}
Example #22
0
dimensioned<Type> domainIntegrate
(
    const tmp<DimensionedField<Type, volMesh> >& tdf
)
{
    dimensioned<Type> integral = domainIntegrate(tdf());
    tdf.clear();
    return integral;
}
Example #23
0
Foam::SolverPerformance<Type> Foam::solve(const tmp<fvMatrix<Type>>& tfvm)
{
    SolverPerformance<Type> solverPerf =
        const_cast<fvMatrix<Type>&>(tfvm()).solve();

    tfvm.clear();

    return solverPerf;
}
Example #24
0
tmp<GeometricField<Type, fvPatchField, volMesh> >
curl
(
    const tmp<GeometricField<Type, fvPatchField, volMesh> >& tvf
)
{
    tmp<GeometricField<Type, fvPatchField, volMesh> > Curl(fvc::curl(tvf()));
    tvf.clear();
    return Curl;
}
Example #25
0
tmp<GeometricField<Type, fvPatchField, volMesh> >
div
(
    const tmp<GeometricField<Type, fvsPatchField, surfaceMesh> >& tssf
)
{
    tmp<GeometricField<Type, fvPatchField, volMesh> > Div(fvc::div(tssf()));
    tssf.clear();
    return Div;
}
Example #26
0
tmp<GeometricField<Type, faPatchField, areaMesh> >
div
(
    const tmp<GeometricField<Type, faePatchField, edgeMesh> >& tssf
)
{
    tmp<GeometricField<Type, faPatchField, areaMesh> > Div(fac::div(tssf()));
    tssf.clear();
    return Div;
}
Example #27
0
Type projection
(
    const tmp<GeometricField<Type, fvPatchField, volMesh> >& ta,
    const GeometricField<Type, fvPatchField, volMesh>& b
)
{
    Type p = projection(ta(), b);
    ta.clear();
    return p;
}
Example #28
0
tmp<volScalarField>
magSqrGradGrad
(
    const tmp<GeometricField<Type, fvPatchField, volMesh> >& tvf
)
{
    tmp<volScalarField> tMagSqrGradGrad(fvc::magSqrGradGrad(tvf()));
    tvf.clear();
    return tMagSqrGradGrad;
}
Example #29
0
tmp<Field<sphericalTensor> > transformFieldMask<sphericalTensor>
(
    const tmp<symmTensorField>& tstf
)
{
    tmp<Field<sphericalTensor> > ret =
        transformFieldMask<sphericalTensor>(tstf());
    tstf.clear();
    return ret;
}
Example #30
0
tmp<gpuField<Type> >
volumeIntegrate
(
    const tmp<GeometricField<Type, fvPatchField, volMesh> >& tvf
)
{
    tmp<gpuField<Type> > tvivf = tvf().mesh().V()*tvf().internalField();
    tvf.clear();
    return tvivf;
}