mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
signed distance
This commit is contained in:
@ -56,13 +56,36 @@ void Foam::distanceSurface::createGeometry() const
|
||||
scalarField(mesh().nCells(), GREAT),
|
||||
nearest
|
||||
);
|
||||
forAll(cellDistance, cellI)
|
||||
|
||||
if (signed_)
|
||||
{
|
||||
cellDistance[cellI] = Foam::mag
|
||||
(
|
||||
nearest[cellI].hitPoint()
|
||||
- mesh().cellCentres()[cellI]
|
||||
);
|
||||
vectorField normal;
|
||||
surfPtr_().getNormal(nearest, normal);
|
||||
|
||||
forAll(cellDistance, cellI)
|
||||
{
|
||||
vector d(mesh().cellCentres()[cellI]-nearest[cellI].hitPoint());
|
||||
|
||||
if ((d&normal[cellI]) > 0)
|
||||
{
|
||||
cellDistance[cellI] = Foam::mag(d);
|
||||
}
|
||||
else
|
||||
{
|
||||
cellDistance[cellI] = -Foam::mag(d);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
forAll(cellDistance, cellI)
|
||||
{
|
||||
cellDistance[cellI] = Foam::mag
|
||||
(
|
||||
nearest[cellI].hitPoint()
|
||||
- mesh().cellCentres()[cellI]
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -166,6 +189,7 @@ Foam::distanceSurface::distanceSurface
|
||||
)
|
||||
),
|
||||
distance_(readScalar(dict.lookup("distance"))),
|
||||
signed_(readBool(dict.lookup("signed"))),
|
||||
regularise_(dict.lookupOrDefault("regularise", true)),
|
||||
zoneName_(word::null),
|
||||
facesPtr_(NULL),
|
||||
|
||||
@ -62,6 +62,9 @@ class distanceSurface
|
||||
//- distance value
|
||||
const scalar distance_;
|
||||
|
||||
//- signed distance
|
||||
const bool signed_;
|
||||
|
||||
//- Whether to coarsen
|
||||
const Switch regularise_;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user