ENH: overrideCellCentres function.

This commit is contained in:
graham
2010-10-11 17:38:51 +01:00
parent aa12a2ab24
commit 6608c7c57b
3 changed files with 45 additions and 1 deletions

View File

@ -489,6 +489,12 @@ public:
const scalarField& cellVolumes() const;
const vectorField& faceAreas() const;
// Override cell centres with supplied positions
void overrideCellCentres
(
const vectorField& cellCtrs
) const;
// Mesh motion

View File

@ -28,6 +28,7 @@ Description
\*---------------------------------------------------------------------------*/
#include "primitiveMesh.H"
#include "demandDrivenData.H"
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
@ -168,4 +169,41 @@ const Foam::scalarField& Foam::primitiveMesh::cellVolumes() const
}
void Foam::primitiveMesh::overrideCellCentres
(
const vectorField& newCellCtrs
) const
{
if (newCellCtrs.size() != nCells())
{
FatalErrorIn
(
"void Foam::primitiveMesh::overrideCellCentres"
"("
"const vectorField& newCellCtrs"
") const"
)
<< "Size of new cell centres for override not equal to the "
<< "number of cells in the mesh."
<< abort(FatalError);
}
if (debug)
{
Pout<< "void Foam::primitiveMesh::overrideCellCentres"
<< "(const vectorField& newCellCtrs) const : "
<< "overriding cell centres." << endl;
}
deleteDemandDrivenData(cellCentresPtr_);
deleteDemandDrivenData(cellVolumesPtr_);
// Calculate the cell volumes - these are invariant with respect
// to the centre.
calcCellCentresAndVols();
*cellCentresPtr_ = newCellCtrs;
}
// ************************************************************************* //

View File

@ -134,7 +134,7 @@ Foam::treeBoundBox::treeBoundBox(const UList<point>& points)
WarningIn
(
"treeBoundBox::treeBoundBox(const UList<point>&)"
) << "cannot find bounding box for zero-sized pointField"
) << "cannot find bounding box for zero-sized pointField, "
<< "returning zero" << endl;
return;