Commit 5df2b964 authored by Henry Weller's avatar Henry Weller
Browse files

GeometricField::internalField() -> GeometricField::internalFieldRef()

Non-const access to the internal field now obtained from a specifically
named access function consistent with the new names for non-canst access
to the boundary field boundaryFieldRef() and dimensioned internal field
dimensionedInternalFieldRef().

See also commit 22f4ad32
parent 67e2d028
......@@ -61,7 +61,7 @@ int main(int argc, char *argv[])
{
Info<< "Time = " << runTime.timeName() << nl << endl;
force.internalField() = ReImSum
force.internalFieldRef() = ReImSum
(
fft::reverseTransform
(
......
......@@ -105,7 +105,7 @@ Foam::tmp<Foam::volScalarField> Foam::XiEqModels::basicSubGrid::XiEq() const
mesh,
dimensionedScalar("zero", Nv.dimensions(), 0.0)
);
N.internalField() = Nv.internalField()*Cw;
N.internalFieldRef() = Nv.internalField()*Cw;
volSymmTensorField ns
(
......@@ -125,7 +125,7 @@ Foam::tmp<Foam::volScalarField> Foam::XiEqModels::basicSubGrid::XiEq() const
Zero
)
);
ns.internalField() = nsv.internalField()*Cw;
ns.internalFieldRef() = nsv.internalField()*Cw;
volScalarField n(max(N - (Uhat & ns & Uhat), scalar(1e-4)));
volScalarField b((Uhat & B_ & Uhat)/sqrt(n));
......
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
......@@ -74,7 +74,7 @@ Foam::tmp<Foam::volScalarField> Foam::XiEqModels::Gulder::XiEq() const
if (subGridSchelkin_)
{
up.internalField() += calculateSchelkinEffect(uPrimeCoef_);
up.internalFieldRef() += calculateSchelkinEffect(uPrimeCoef_);
}
volScalarField tauEta(sqrt(mag(thermo_.muu()/(thermo_.rhou()*epsilon))));
......
......@@ -82,7 +82,7 @@ Foam::tmp<Foam::volScalarField> Foam::XiEqModels::SCOPEXiEq::XiEq() const
volScalarField up(sqrt((2.0/3.0)*k));
if (subGridSchelkin_)
{
up.internalField() += calculateSchelkinEffect(uPrimeCoef_);
up.internalFieldRef() += calculateSchelkinEffect(uPrimeCoef_);
}
volScalarField l(lCoef_*sqrt(3.0/2.0)*up*k/epsilon);
......
......@@ -114,7 +114,7 @@ Foam::XiEqModel::calculateSchelkinEffect(const scalar uPrimeCoef) const
)
);
volScalarField& N = tN.ref();
N.internalField() = Nv.internalField()*pow(mesh.V(), 2.0/3.0);
N.internalFieldRef() = Nv.internalField()*pow(mesh.V(), 2.0/3.0);
volSymmTensorField ns
(
......@@ -134,7 +134,7 @@ Foam::XiEqModel::calculateSchelkinEffect(const scalar uPrimeCoef) const
Zero
)
);
ns.internalField() = nsv.internalField()*pow(mesh.V(), 2.0/3.0);
ns.internalFieldRef() = nsv.internalField()*pow(mesh.V(), 2.0/3.0);
const volVectorField Uhat
(
......@@ -150,7 +150,7 @@ Foam::XiEqModel::calculateSchelkinEffect(const scalar uPrimeCoef) const
const scalarField deltaUp(upLocal*(max(scalar(1.0), pow(nr, 0.5)) - 1.0));
// Re use tN
N.internalField() = upLocal*(max(scalar(1.0), pow(nr, 0.5)) - 1.0);
N.internalFieldRef() = upLocal*(max(scalar(1.0), pow(nr, 0.5)) - 1.0);
return tN;
}
......
......@@ -61,7 +61,7 @@
)
);
aniAlphas[i].internalField() =
aniAlphas[i].internalFieldRef() =
coordinates[i].R().transformVector(tkappaByCp());
aniAlphas[i].correctBoundaryConditions();
......
......@@ -14,7 +14,7 @@ if (!thermo.isotropic())
tmp<volVectorField> tkappaByCp = thermo.Kappa()/cp;
const coordinateSystem& coodSys = coordinates[i];
aniAlpha.internalField() =
aniAlpha.internalFieldRef() =
coodSys.R().transformVector(tkappaByCp());
aniAlpha.correctBoundaryConditions();
......
......@@ -107,7 +107,7 @@ int main(int argc, char *argv[])
zeroGradientFvPatchVectorField::typeName
);
cloudVolSUSu.internalField() = -cloudSU.source()/mesh.V();
cloudVolSUSu.internalFieldRef() = -cloudSU.source()/mesh.V();
cloudVolSUSu.correctBoundaryConditions();
cloudSU.source() = Zero;
......
......@@ -104,7 +104,7 @@ Foam::tmp<Foam::volScalarField> Foam::dragModels::segregated::K() const
dimensionedScalar("L", dimLength, 0),
zeroGradientFvPatchField<scalar>::typeName
);
L.internalField() = cbrt(mesh.V());
L.internalFieldRef() = cbrt(mesh.V());
L.correctBoundaryConditions();
volScalarField I
......
......@@ -104,7 +104,7 @@ Foam::tmp<Foam::volScalarField> Foam::dragModels::segregated::K() const
dimensionedScalar("L", dimLength, 0),
zeroGradientFvPatchField<scalar>::typeName
);
L.internalField() = cbrt(mesh.V());
L.internalFieldRef() = cbrt(mesh.V());
L.correctBoundaryConditions();
volScalarField I
......
......@@ -87,7 +87,7 @@ int main(int argc, char *argv[])
mesh,
dimensionedScalar("aggomeration", dimless, 0.0)
);
scalarField& fld = scalarAgglomeration.internalField();
scalarField& fld = scalarAgglomeration.internalFieldRef();
forAll(fld, celli)
{
fld[celli] = cellToCoarse[celli];
......@@ -166,7 +166,7 @@ int main(int argc, char *argv[])
mesh,
dimensionedScalar("aggomeration", dimless, 0.0)
);
scalarField& fld = scalarAgglomeration.internalField();
scalarField& fld = scalarAgglomeration.internalFieldRef();
forAll(fld, celli)
{
fld[celli] = cellToCoarse[celli];
......
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2013-2015 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2013-2016 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
......@@ -164,7 +164,7 @@ int main(int argc, char *argv[])
dimensionedScalar("one", dimless, 1.0),
calculatedPointPatchScalarField::typeName
);
pointX.internalField() = mesh.points().component(0);
pointX.internalFieldRef() = mesh.points().component(0);
pointX.correctBoundaryConditions();
Info<< "Writing x-component field "
<< pointX.name() << " in " << runTime.timeName() << endl;
......
......@@ -86,7 +86,7 @@ int main(int argc, char *argv[])
patchFieldTypes
);
cc.internalField() = mesh.C().internalField();
cc.internalFieldRef() = mesh.C().internalField();
cc.boundaryFieldRef().updateCoeffs();
forAll(cc.boundaryField(), patchi)
......
......@@ -1137,7 +1137,7 @@ void Foam::conformalVoronoiMesh::writeCellSizes
zeroGradientFvPatchScalarField::typeName
);
scalarField& cellSize = targetCellSize.internalField();
scalarField& cellSize = targetCellSize.internalFieldRef();
const vectorField& C = mesh.cellCentres();
......@@ -1163,7 +1163,7 @@ void Foam::conformalVoronoiMesh::writeCellSizes
// zeroGradientFvPatchScalarField::typeName
// );
// targetCellVolume.internalField() = pow3(cellSize);
// targetCellVolume.internalFieldRef() = pow3(cellSize);
// Info<< nl << "Create actualCellVolume volScalarField" << endl;
......@@ -1182,7 +1182,7 @@ void Foam::conformalVoronoiMesh::writeCellSizes
// zeroGradientFvPatchScalarField::typeName
// );
// actualCellVolume.internalField() = mesh.cellVolumes();
// actualCellVolume.internalFieldRef() = mesh.cellVolumes();
// Info<< nl << "Create equivalentCellSize volScalarField" << endl;
......@@ -1201,7 +1201,7 @@ void Foam::conformalVoronoiMesh::writeCellSizes
// zeroGradientFvPatchScalarField::typeName
// );
// equivalentCellSize.internalField() = pow
// equivalentCellSize.internalFieldRef() = pow
// (
// actualCellVolume.internalField(),
// 1.0/3.0
......@@ -1247,7 +1247,7 @@ void Foam::conformalVoronoiMesh::writeCellSizes
// pointPatchVectorField::calculatedType()
// );
// scalarField& cellSize = ptTargetCellSize.internalField();
// scalarField& cellSize = ptTargetCellSize.internalFieldRef();
// const vectorField& P = tetMesh.points();
......@@ -1283,7 +1283,7 @@ void Foam::conformalVoronoiMesh::writeCellAlignments
// zeroGradientFvPatchTensorField::typeName
// );
//
// tensorField& cellAlignment = cellAlignments.internalField();
// tensorField& cellAlignment = cellAlignments.internalFieldRef();
//
// const vectorField& C = mesh.cellCentres();
//
......
......@@ -117,16 +117,14 @@ bool Foam::conformalVoronoiMesh::distributeBackground(const Triangulation& mesh)
}
}
scalarField& cwi = cellWeights.internalFieldRef();
forAll(cellVertices, cI)
{
// Give a small but finite weight for empty cells. Some
// decomposition methods have difficulty with integer overflows in
// the sum of the normalised weight field.
cellWeights.internalField()[cI] = max
(
cellVertices[cI],
1e-2
);
cwi[cI] = max(cellVertices[cI], 1e-2);
}
autoPtr<mapDistributePolyMesh> mapDist = decomposition_().distribute
......
......@@ -636,7 +636,7 @@ int main(int argc, char *argv[])
{
// Internal field
cellDistance.internalField() = signedDistance
cellDistance.internalFieldRef() = signedDistance
(
distSqr,
fvm.C(),
......@@ -701,7 +701,7 @@ int main(int argc, char *argv[])
-sqr(GREAT) // null value
);
pointDistance.internalField() = signedDistance
pointDistance.internalFieldRef() = signedDistance
(
pointDistSqr,
fvm.points(),
......
......@@ -91,7 +91,7 @@ void ReadAndMapFields
)
);
Field<Type>& fld = tetFields[i].internalField();
Field<Type>& fld = tetFields[i].internalFieldRef();
// Map from read field. Set unmapped entries to nullValue.
fld.setSize(map.size(), nullValue);
......
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
......@@ -57,7 +57,7 @@ int main(int argc, char *argv[])
turbGen Ugen(K, Ea, k0);
U.internalField() = Ugen.U();
U.internalFieldRef() = Ugen.U();
U.correctBoundaryConditions();
Info<< "k("
......
......@@ -88,7 +88,7 @@ bool setCellFieldType
if (selectedCells.size() == field.size())
{
field.internalField() = value;
field.internalFieldRef() = value;
}
else
{
......
......@@ -50,7 +50,7 @@ void Foam::GeometricField<Type, PatchField, GeoMesh>::readFields
const dictionary& dict
)
{
DimensionedField<Type, GeoMesh>::readField(dict, "internalField");
Internal::readField(dict, "internalField");
boundaryField_.readField(*this, dict.subDict("boundaryField"));
......@@ -181,7 +181,7 @@ Foam::GeometricField<Type, PatchField, GeoMesh>::GeometricField
const word& patchFieldType
)
:
DimensionedField<Type, GeoMesh>(io, mesh, ds, false),
Internal(io, mesh, ds, false),
timeIndex_(this->time().timeIndex()),
field0Ptr_(NULL),
fieldPrevIterPtr_(NULL),
......@@ -206,7 +206,7 @@ Foam::GeometricField<Type, PatchField, GeoMesh>::GeometricField
const wordList& actualPatchTypes
)
:
DimensionedField<Type, GeoMesh>(io, mesh, ds, false),
Internal(io, mesh, ds, false),
timeIndex_(this->time().timeIndex()),
field0Ptr_(NULL),
fieldPrevIterPtr_(NULL),
......@@ -230,7 +230,7 @@ Foam::GeometricField<Type, PatchField, GeoMesh>::GeometricField
const word& patchFieldType
)
:
DimensionedField<Type, GeoMesh>(io, mesh, dt, false),
Internal(io, mesh, dt, false),
timeIndex_(this->time().timeIndex()),
field0Ptr_(NULL),
fieldPrevIterPtr_(NULL),
......@@ -257,7 +257,7 @@ Foam::GeometricField<Type, PatchField, GeoMesh>::GeometricField
const wordList& actualPatchTypes
)
:
DimensionedField<Type, GeoMesh>(io, mesh, dt, false),
Internal(io, mesh, dt, false),
timeIndex_(this->time().timeIndex()),
field0Ptr_(NULL),
fieldPrevIterPtr_(NULL),
......@@ -274,6 +274,30 @@ Foam::GeometricField<Type, PatchField, GeoMesh>::GeometricField
}
template<class Type, template<class> class PatchField, class GeoMesh>
Foam::GeometricField<Type, PatchField, GeoMesh>::GeometricField
(
const IOobject& io,
const Internal& diField,
const PtrList<PatchField<Type>>& ptfl
)
:
Internal(io, diField),
timeIndex_(this->time().timeIndex()),
field0Ptr_(NULL),
fieldPrevIterPtr_(NULL),
boundaryField_(this->mesh().boundary(), *this, ptfl)
{
if (debug)
{
InfoInFunction
<< "Constructing from components" << endl << this->info() << endl;
}
readIfPresent();
}
template<class Type, template<class> class PatchField, class GeoMesh>
Foam::GeometricField<Type, PatchField, GeoMesh>::GeometricField
(
......@@ -284,7 +308,7 @@ Foam::GeometricField<Type, PatchField, GeoMesh>::GeometricField
const PtrList<PatchField<Type>>& ptfl
)
:
DimensionedField<Type, GeoMesh>(io, mesh, ds, iField),
Internal(io, mesh, ds, iField),
timeIndex_(this->time().timeIndex()),
field0Ptr_(NULL),
fieldPrevIterPtr_(NULL),
......@@ -307,7 +331,7 @@ Foam::GeometricField<Type, PatchField, GeoMesh>::GeometricField
const Mesh& mesh
)
:
DimensionedField<Type, GeoMesh>(io, mesh, dimless, false),
Internal(io, mesh, dimless, false),
timeIndex_(this->time().timeIndex()),
field0Ptr_(NULL),
fieldPrevIterPtr_(NULL),
......@@ -343,7 +367,7 @@ Foam::GeometricField<Type, PatchField, GeoMesh>::GeometricField
const dictionary& dict
)
:
DimensionedField<Type, GeoMesh>(io, mesh, dimless, false),
Internal(io, mesh, dimless, false),
timeIndex_(this->time().timeIndex()),
field0Ptr_(NULL),
fieldPrevIterPtr_(NULL),
......@@ -378,7 +402,7 @@ Foam::GeometricField<Type, PatchField, GeoMesh>::GeometricField
const GeometricField<Type, PatchField, GeoMesh>& gf
)
:
DimensionedField<Type, GeoMesh>(gf),
Internal(gf),
timeIndex_(gf.timeIndex()),
field0Ptr_(NULL),
fieldPrevIterPtr_(NULL),
......@@ -409,7 +433,7 @@ Foam::GeometricField<Type, PatchField, GeoMesh>::GeometricField
const tmp<GeometricField<Type, PatchField, GeoMesh>>& tgf
)
:
DimensionedField<Type, GeoMesh>
Internal
(
const_cast<GeometricField<Type, PatchField, GeoMesh>&>(tgf()),
tgf.isTmp()
......@@ -439,7 +463,7 @@ Foam::GeometricField<Type, PatchField, GeoMesh>::GeometricField
const GeometricField<Type, PatchField, GeoMesh>& gf
)
:
DimensionedField<Type, GeoMesh>(io, gf),
Internal(io, gf),
timeIndex_(gf.timeIndex()),
field0Ptr_(NULL),
fieldPrevIterPtr_(NULL),
......@@ -471,7 +495,7 @@ Foam::GeometricField<Type, PatchField, GeoMesh>::GeometricField
const tmp<GeometricField<Type, PatchField, GeoMesh>>& tgf
)
:
DimensionedField<Type, GeoMesh>
Internal
(
io,
const_cast<GeometricField<Type, PatchField, GeoMesh>&>(tgf()),
......@@ -503,7 +527,7 @@ Foam::GeometricField<Type, PatchField, GeoMesh>::GeometricField
const GeometricField<Type, PatchField, GeoMesh>& gf
)
:
DimensionedField<Type, GeoMesh>(newName, gf),
Internal(newName, gf),
timeIndex_(gf.timeIndex()),
field0Ptr_(NULL),
fieldPrevIterPtr_(NULL),
......@@ -535,7 +559,7 @@ Foam::GeometricField<Type, PatchField, GeoMesh>::GeometricField
const tmp<GeometricField<Type, PatchField, GeoMesh>>& tgf
)
:
DimensionedField<Type, GeoMesh>
Internal
(
newName,
const_cast<GeometricField<Type, PatchField, GeoMesh>&>(tgf()),
......@@ -566,7 +590,7 @@ Foam::GeometricField<Type, PatchField, GeoMesh>::GeometricField
const word& patchFieldType
)
:
DimensionedField<Type, GeoMesh>(io, gf),
Internal(io, gf),
timeIndex_(gf.timeIndex()),
field0Ptr_(NULL),
fieldPrevIterPtr_(NULL),
......@@ -602,7 +626,7 @@ Foam::GeometricField<Type, PatchField, GeoMesh>::GeometricField
)
:
DimensionedField<Type, GeoMesh>(io, gf),
Internal(io, gf),
timeIndex_(gf.timeIndex()),
field0Ptr_(NULL),
fieldPrevIterPtr_(NULL),
......@@ -644,7 +668,7 @@ Foam::GeometricField<Type, PatchField, GeoMesh>::GeometricField
const wordList& actualPatchTypes
)
:
DimensionedField<Type, GeoMesh>
Internal
(
io,
const_cast<GeometricField<Type, PatchField, GeoMesh>&>(tgf()),
......@@ -701,7 +725,7 @@ Foam::GeometricField<Type, PatchField, GeoMesh>::dimensionedInternalFieldRef()
template<class Type, template<class> class PatchField, class GeoMesh>
typename
Foam::GeometricField<Type, PatchField, GeoMesh>::Internal::FieldType&
Foam::GeometricField<Type, PatchField, GeoMesh>::internalField()
Foam::GeometricField<Type, PatchField, GeoMesh>::internalFieldRef()
{
this->setUpToDate();
storeOldTimes();
......@@ -992,7 +1016,7 @@ Foam::GeometricField<Type, PatchField, GeoMesh>::T() const
)
);
Foam::T(result.ref().internalField(), internalField());
Foam::T(result.ref().internalFieldRef(), internalField());
Foam::T(result.ref().boundaryFieldRef(), boundaryField());
return result;
......@@ -1029,7 +1053,7 @@ Foam::GeometricField<Type, PatchField, GeoMesh>::component
)
);
Foam::component(Component.ref().internalField(), internalField(), d);
Foam::component(Component.ref().internalFieldRef(), internalField(), d);
Foam::component(Component.ref().boundaryFieldRef(), boundaryField(), d);
return Component;
......@@ -1048,7 +1072,7 @@ void Foam::GeometricField<Type, PatchField, GeoMesh>::replace
>& gcf
)
{
internalField().replace(d, gcf.internalField());
internalFieldRef().replace(d, gcf.internalField());
boundaryFieldRef().replace(d, gcf.boundaryField());
}
......@@ -1060,7 +1084,7 @@ void Foam::GeometricField<Type, PatchField, GeoMesh>::replace
const dimensioned<cmptType>& ds
)
{
internalField().replace(d, ds.value());
internalFieldRef().replace(d, ds.value());
boundaryFieldRef().replace(d, ds.value());
}
......@@ -1071,7 +1095,7 @@ void Foam::GeometricField<Type, PatchField, GeoMesh>::max
const dimensioned<Type>& dt
)
{
Foam::max(internalField(), internalField(), dt.value());
Foam::max(internalFieldRef(), internalField(), dt.value());
Foam::max(boundaryFieldRef(), boundaryField(), dt.value());
}
......@@ -1082,7 +1106,7 @@ void Foam::GeometricField<Type, PatchField, GeoMesh>::min
const dimensioned<Type>& dt
)
{
Foam::min(internalField(), internalField(), dt.value());
Foam::min(internalFieldRef(), internalField(), dt.value());
Foam::min(boundaryFieldRef(), boundaryField(), dt.value());
}
......@@ -1090,7 +1114,7 @@ void Foam::GeometricField<Type, PatchField, GeoMesh>::min
template<class Type, template<class> class PatchField, class GeoMesh>
void Foam::GeometricField<Type, PatchField, GeoMesh>::negate()
{
internalField().negate();
internalFieldRef().negate();
boundaryFieldRef().negate();
}
......@@ -1141,7 +1165,7 @@ void Foam::GeometricField<Type, PatchField, GeoMesh>::operator=
this->dimensions() = gf.dimensions();
// Transfer the storage from the tmp
internalField().transfer
internalFieldRef().transfer
(
const_cast<Field<Type>&>(gf.internalField())
);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment