mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: overrideCellCentres function.
This commit is contained in:
@ -489,6 +489,12 @@ public:
|
|||||||
const scalarField& cellVolumes() const;
|
const scalarField& cellVolumes() const;
|
||||||
const vectorField& faceAreas() const;
|
const vectorField& faceAreas() const;
|
||||||
|
|
||||||
|
// Override cell centres with supplied positions
|
||||||
|
void overrideCellCentres
|
||||||
|
(
|
||||||
|
const vectorField& cellCtrs
|
||||||
|
) const;
|
||||||
|
|
||||||
|
|
||||||
// Mesh motion
|
// Mesh motion
|
||||||
|
|
||||||
|
|||||||
@ -28,6 +28,7 @@ Description
|
|||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#include "primitiveMesh.H"
|
#include "primitiveMesh.H"
|
||||||
|
#include "demandDrivenData.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
// * * * * * * * * * * * * * 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;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|||||||
@ -134,7 +134,7 @@ Foam::treeBoundBox::treeBoundBox(const UList<point>& points)
|
|||||||
WarningIn
|
WarningIn
|
||||||
(
|
(
|
||||||
"treeBoundBox::treeBoundBox(const UList<point>&)"
|
"treeBoundBox::treeBoundBox(const UList<point>&)"
|
||||||
) << "cannot find bounding box for zero-sized pointField"
|
) << "cannot find bounding box for zero-sized pointField, "
|
||||||
<< "returning zero" << endl;
|
<< "returning zero" << endl;
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
|||||||
Reference in New Issue
Block a user