Mesh object updates: mesh access

This commit is contained in:
Hrvoje Jasak 2011-08-03 09:20:46 +01:00
parent df400b9a7f
commit 011b3bad41
4 changed files with 47 additions and 49 deletions

View file

@ -223,7 +223,7 @@ const Foam::lduMesh& Foam::GAMGAgglomeration::meshLevel
{ {
if (i == 0) if (i == 0)
{ {
return mesh_; return mesh();
} }
else else
{ {

View file

@ -77,20 +77,18 @@ void Foam::extendedLeastSquaresVectors::makeLeastSquaresVectors() const
<< endl; << endl;
} }
const fvMesh& mesh = mesh_;
pVectorsPtr_ = new surfaceVectorField pVectorsPtr_ = new surfaceVectorField
( (
IOobject IOobject
( (
"LeastSquaresP", "LeastSquaresP",
mesh_.pointsInstance(), mesh().pointsInstance(),
mesh_, mesh(),
IOobject::NO_READ, IOobject::NO_READ,
IOobject::NO_WRITE, IOobject::NO_WRITE,
false false
), ),
mesh_, mesh(),
dimensionedVector("zero", dimless/dimLength, vector::zero) dimensionedVector("zero", dimless/dimLength, vector::zero)
); );
surfaceVectorField& lsP = *pVectorsPtr_; surfaceVectorField& lsP = *pVectorsPtr_;
@ -100,24 +98,24 @@ void Foam::extendedLeastSquaresVectors::makeLeastSquaresVectors() const
IOobject IOobject
( (
"LeastSquaresN", "LeastSquaresN",
mesh_.pointsInstance(), mesh().pointsInstance(),
mesh_, mesh(),
IOobject::NO_READ, IOobject::NO_READ,
IOobject::NO_WRITE, IOobject::NO_WRITE,
false false
), ),
mesh_, mesh(),
dimensionedVector("zero", dimless/dimLength, vector::zero) dimensionedVector("zero", dimless/dimLength, vector::zero)
); );
surfaceVectorField& lsN = *nVectorsPtr_; surfaceVectorField& lsN = *nVectorsPtr_;
// Set local references to mesh data // Set local references to mesh data
const unallocLabelList& owner = mesh_.owner(); const unallocLabelList& owner = mesh().owner();
const unallocLabelList& neighbour = mesh_.neighbour(); const unallocLabelList& neighbour = mesh().neighbour();
const volVectorField& C = mesh_.C(); const volVectorField& C = mesh().C();
// Set up temporary storage for the dd tensor (before inversion) // Set up temporary storage for the dd tensor (before inversion)
symmTensorField dd(mesh_.nCells(), symmTensor::zero); symmTensorField dd(mesh().nCells(), symmTensor::zero);
forAll(owner, faceI) forAll(owner, faceI)
{ {
@ -137,7 +135,7 @@ void Foam::extendedLeastSquaresVectors::makeLeastSquaresVectors() const
// in the construction of d vectors. // in the construction of d vectors.
forAll(lsP.boundaryField(), patchI) forAll(lsP.boundaryField(), patchI)
{ {
const fvPatch& p = mesh_.boundary()[patchI]; const fvPatch& p = mesh().boundary()[patchI];
const unallocLabelList& faceCells = p.faceCells(); const unallocLabelList& faceCells = p.faceCells();
// Better version of d-vectors: Zeljko Tukovic, 25/Apr/2010 // Better version of d-vectors: Zeljko Tukovic, 25/Apr/2010
@ -177,7 +175,7 @@ void Foam::extendedLeastSquaresVectors::makeLeastSquaresVectors() const
<< exit(FatalError); << exit(FatalError);
} }
labelList pointLabels = mesh.cells()[i].labels(mesh.faces()); labelList pointLabels = mesh().cells()[i].labels(mesh().faces());
scalar maxDetddij = 0.0; scalar maxDetddij = 0.0;
@ -185,15 +183,15 @@ void Foam::extendedLeastSquaresVectors::makeLeastSquaresVectors() const
forAll(pointLabels, j) forAll(pointLabels, j)
{ {
forAll(mesh.pointCells()[pointLabels[j]], k) forAll(mesh().pointCells()[pointLabels[j]], k)
{ {
label cellj = mesh.pointCells()[pointLabels[j]][k]; label cellj = mesh().pointCells()[pointLabels[j]][k];
if (cellj != i) if (cellj != i)
{ {
if (cellj != -1) if (cellj != -1)
{ {
vector dCij = (mesh.C()[cellj] - mesh.C()[i]); vector dCij = (C[cellj] - C[i]);
symmTensor ddij = symmTensor ddij =
dd[i] + (1.0/magSqr(dCij))*sqr(dCij); dd[i] + (1.0/magSqr(dCij))*sqr(dCij);
@ -214,7 +212,7 @@ void Foam::extendedLeastSquaresVectors::makeLeastSquaresVectors() const
{ {
additionalCells_[nAddCells][0] = i; additionalCells_[nAddCells][0] = i;
additionalCells_[nAddCells++][1] = addCell; additionalCells_[nAddCells++][1] = addCell;
vector dCij = mesh.C()[addCell] - mesh.C()[i]; vector dCij = C[addCell] - C[i];
dd[i] += (1.0/magSqr(dCij))*sqr(dCij); dd[i] += (1.0/magSqr(dCij))*sqr(dCij);
detdd[i] = det(dd[i]); detdd[i] = det(dd[i]);
} }
@ -226,7 +224,7 @@ void Foam::extendedLeastSquaresVectors::makeLeastSquaresVectors() const
Info<< "max(detdd) = " << max(detdd) << endl; Info<< "max(detdd) = " << max(detdd) << endl;
Info<< "min(detdd) = " << min(detdd) << endl; Info<< "min(detdd) = " << min(detdd) << endl;
Info<< "average(detdd) = " << average(detdd) << endl; Info<< "average(detdd) = " << average(detdd) << endl;
Info<< "nAddCells/nCells = " << scalar(nAddCells)/mesh.nCells() << endl; Info<< "nAddCells/nCells = " << scalar(nAddCells)/mesh().nCells() << endl;
// Invert the dd tensor // Invert the dd tensor
symmTensorField invDd = inv(dd); symmTensorField invDd = inv(dd);
@ -248,7 +246,7 @@ void Foam::extendedLeastSquaresVectors::makeLeastSquaresVectors() const
forAll(lsP.boundaryField(), patchI) forAll(lsP.boundaryField(), patchI)
{ {
vectorField pd = mesh_.boundary()[patchI].delta(); vectorField pd = mesh().boundary()[patchI].delta();
fvsPatchVectorField& patchLsP = lsP.boundaryField()[patchI]; fvsPatchVectorField& patchLsP = lsP.boundaryField()[patchI];
@ -269,8 +267,8 @@ void Foam::extendedLeastSquaresVectors::makeLeastSquaresVectors() const
forAll(additionalCells_, i) forAll(additionalCells_, i)
{ {
vector dCij = mesh.C()[additionalCells_[i][1]] vector dCij = C[additionalCells_[i][1]]
- mesh.C()[additionalCells_[i][0]]; - C[additionalCells_[i][0]];
additionalVectors_[i] = additionalVectors_[i] =
(1.0/magSqr(dCij))*(invDd[additionalCells_[i][0]] & dCij); (1.0/magSqr(dCij))*(invDd[additionalCells_[i][0]] & dCij);

View file

@ -72,13 +72,13 @@ void Foam::leastSquaresVectors::makeLeastSquaresVectors() const
IOobject IOobject
( (
"LeastSquaresP", "LeastSquaresP",
mesh_.pointsInstance(), mesh().pointsInstance(),
mesh_, mesh(),
IOobject::NO_READ, IOobject::NO_READ,
IOobject::NO_WRITE, IOobject::NO_WRITE,
false false
), ),
mesh_, mesh(),
dimensionedVector("zero", dimless/dimLength, vector::zero) dimensionedVector("zero", dimless/dimLength, vector::zero)
); );
surfaceVectorField& lsP = *pVectorsPtr_; surfaceVectorField& lsP = *pVectorsPtr_;
@ -88,28 +88,28 @@ void Foam::leastSquaresVectors::makeLeastSquaresVectors() const
IOobject IOobject
( (
"LeastSquaresN", "LeastSquaresN",
mesh_.pointsInstance(), mesh().pointsInstance(),
mesh_, mesh(),
IOobject::NO_READ, IOobject::NO_READ,
IOobject::NO_WRITE, IOobject::NO_WRITE,
false false
), ),
mesh_, mesh(),
dimensionedVector("zero", dimless/dimLength, vector::zero) dimensionedVector("zero", dimless/dimLength, vector::zero)
); );
surfaceVectorField& lsN = *nVectorsPtr_; surfaceVectorField& lsN = *nVectorsPtr_;
// Set local references to mesh data // Set local references to mesh data
const unallocLabelList& owner = mesh_.owner(); const unallocLabelList& owner = mesh().owner();
const unallocLabelList& neighbour = mesh_.neighbour(); const unallocLabelList& neighbour = mesh().neighbour();
const volVectorField& C = mesh_.C(); const volVectorField& C = mesh().C();
const surfaceScalarField& w = mesh_.weights(); const surfaceScalarField& w = mesh().weights();
// const surfaceScalarField& magSf = mesh_.magSf(); // const surfaceScalarField& magSf = mesh().magSf();
// Set up temporary storage for the dd tensor (before inversion) // Set up temporary storage for the dd tensor (before inversion)
symmTensorField dd(mesh_.nCells(), symmTensor::zero); symmTensorField dd(mesh().nCells(), symmTensor::zero);
forAll(owner, facei) forAll(owner, facei)
{ {
@ -138,16 +138,16 @@ void Foam::leastSquaresVectors::makeLeastSquaresVectors() const
// Original version: closest distance to boundary // Original version: closest distance to boundary
vectorField pd = vectorField pd =
mesh_.Sf().boundaryField()[patchi] mesh().Sf().boundaryField()[patchi]
/( /(
mesh_.magSf().boundaryField()[patchi] mesh().magSf().boundaryField()[patchi]
*mesh_.deltaCoeffs().boundaryField()[patchi] *mesh().deltaCoeffs().boundaryField()[patchi]
); );
if (!mesh_.orthogonal()) if (!mesh().orthogonal())
{ {
pd -= mesh_.correctionVectors().boundaryField()[patchi] pd -= mesh().correctionVectors().boundaryField()[patchi]
/mesh_.deltaCoeffs().boundaryField()[patchi]; /mesh().deltaCoeffs().boundaryField()[patchi];
} }
// Better version of d-vectors: Zeljko Tukovic, 25/Apr/2010 // Better version of d-vectors: Zeljko Tukovic, 25/Apr/2010

View file

@ -67,24 +67,24 @@ void Foam::skewCorrectionVectors::makeSkewCorrectionVectors() const
IOobject IOobject
( (
"skewCorrectionVectors", "skewCorrectionVectors",
mesh_.pointsInstance(), mesh().pointsInstance(),
mesh_, mesh(),
IOobject::NO_READ, IOobject::NO_READ,
IOobject::NO_WRITE, IOobject::NO_WRITE,
false false
), ),
mesh_, mesh(),
dimLength dimLength
); );
surfaceVectorField& SkewCorrVecs = *skewCorrectionVectors_; surfaceVectorField& SkewCorrVecs = *skewCorrectionVectors_;
// Set local references to mesh data // Set local references to mesh data
const volVectorField& C = mesh_.C(); const volVectorField& C = mesh().C();
const surfaceVectorField& Cf = mesh_.Cf(); const surfaceVectorField& Cf = mesh().Cf();
const surfaceVectorField& Sf = mesh_.Sf(); const surfaceVectorField& Sf = mesh().Sf();
const unallocLabelList& owner = mesh_.owner(); const unallocLabelList& owner = mesh().owner();
const unallocLabelList& neighbour = mesh_.neighbour(); const unallocLabelList& neighbour = mesh().neighbour();
// Build the d-vectors. Changed to exact vectors. HJ, 24/Apr/2010 // Build the d-vectors. Changed to exact vectors. HJ, 24/Apr/2010