44 void Foam::distanceSurface::createGeometry()
48 Pout<<
"distanceSurface::createGeometry :updating geometry." <<
endl;
53 isoSurfCellPtr_.clear();
59 const fvMesh& fvm =
static_cast<const fvMesh&
>(
mesh());
64 cellDistancePtr_.reset
71 fvm.time().timeName(),
86 scalarField& fld = cellDistance.primitiveFieldRef();
88 List<pointIndexHit> nearest;
89 surfPtr_().findNearest
98 List<volumeType> volType;
100 surfPtr_().getVolumeType(cc, volType);
104 volumeType vT = volType[i];
108 fld[i] =
Foam::mag(cc[i] - nearest[i].hitPoint());
112 fld[i] = -
Foam::mag(cc[i] - nearest[i].hitPoint());
117 <<
"getVolumeType failure, neither INSIDE or OUTSIDE" 126 fld[i] =
Foam::mag(cc[i] - nearest[i].hitPoint());
131 volScalarField::Boundary& cellDistanceBf =
132 cellDistance.boundaryFieldRef();
141 List<pointIndexHit> nearest;
142 surfPtr_().findNearest
151 List<volumeType> volType;
153 surfPtr_().getVolumeType(cc, volType);
157 volumeType vT = volType[i];
161 fld[i] =
Foam::mag(cc[i] - nearest[i].hitPoint());
165 fld[i] = -
Foam::mag(cc[i] - nearest[i].hitPoint());
170 <<
"getVolumeType failure, " 171 <<
"neither INSIDE or OUTSIDE" 180 fld[i] =
Foam::mag(cc[i] - nearest[i].hitPoint());
192 pointDistance_.setSize(fvm.nPoints());
196 List<pointIndexHit> nearest;
197 surfPtr_().findNearest
206 List<volumeType> volType;
208 surfPtr_().getVolumeType(pts, volType);
212 volumeType vT = volType[i];
217 Foam::mag(pts[i] - nearest[i].hitPoint());
222 -
Foam::mag(pts[i] - nearest[i].hitPoint());
227 <<
"getVolumeType failure, neither INSIDE or OUTSIDE" 236 pointDistance_[i] =
Foam::mag(pts[i]-nearest[i].hitPoint());
244 Pout<<
"Writing cell distance:" << cellDistance.objectPath() <<
endl;
245 cellDistance.
write();
251 fvm.time().timeName(),
262 Pout<<
"Writing point distance:" << pDist.objectPath() <<
endl;
270 isoSurfCellPtr_.reset
318 dict.
lookup(
"surfaceType"),
338 isoSurfCellPtr_(
nullptr),
339 isoSurfPtr_(
nullptr),
357 const bool interpolate,
358 const word& surfaceType,
359 const word& surfaceName,
360 const scalar distance,
361 const bool signedDistance,
386 signed_(signedDistance),
388 regularise_(regularise),
392 isoSurfCellPtr_(
nullptr),
393 isoSurfPtr_(
nullptr),
416 Pout<<
"distanceSurface::expire :" 417 <<
" have-facesPtr_:" << facesPtr_.valid()
418 <<
" needsUpdate_:" << needsUpdate_ <<
endl;
442 Pout<<
"distanceSurface::update :" 443 <<
" have-facesPtr_:" << facesPtr_.valid()
444 <<
" needsUpdate_:" << needsUpdate_ <<
endl;
454 needsUpdate_ =
false;
464 return sampleField(vField);
473 return sampleField(vField);
482 return sampleField(vField);
491 return sampleField(vField);
500 return sampleField(vField);
509 return interpolateField(interpolator);
518 return interpolateField(interpolator);
526 return interpolateField(interpolator);
535 return interpolateField(interpolator);
544 return interpolateField(interpolator);
550 os <<
"distanceSurface: " <<
name() <<
" :" 551 <<
" surface:" << surfPtr_().name()
552 <<
" distance:" << distance_
553 <<
" faces:" << faces().size()
GeometricField< scalar, pointPatchField, pointMesh > pointScalarField
#define forAll(list, i)
Loop across all elements in list.
errorManipArg< error, int > exit(error &err, const int errNo=1)
A list of keyword definitions, which are a keyword followed by any number of values (e...
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
An abstract class for surfaces with sampling.
void size(const label)
Override size to be inconsistent with allocated storage.
bool interpolate() const
Interpolation requested for surface.
Ostream & endl(Ostream &os)
Add newline and flush stream.
A simple wrapper around bool so that it can be read as a word: true/false, on/off, yes/no, y/n, t/f, or none.
virtual ~distanceSurface()
Destructor.
virtual bool update()
Update the surface as required.
Macros for easy insertion into run-time selection tables.
static const pointMesh & New(const polyMesh &mesh)
GeometricField< scalar, fvPatchField, volMesh > volScalarField
virtual void print(Ostream &) const
Write.
vectorField pointField
pointField is a vectorField.
fvPatchField< scalar > fvPatchScalarField
A class for handling words, derived from string.
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
const word & constant() const
Return constant name.
bool readScalar(const char *buf, doubleScalar &s)
Read whole of buf as a scalar. Return true if succesful.
distanceSurface(const word &name, const polyMesh &mesh, const dictionary &dict)
Construct from dictionary.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Internal::FieldType & primitiveFieldRef()
Return a reference to the internal field.
addToRunTimeSelectionTable(ensightPart, ensightPartCells, istream)
virtual bool expire()
Mark the surface as needing an update.
const Time & time() const
Return time.
defineTypeNameAndDebug(combustionModel, 0)
word name(const complex &)
Return a string representation of a complex.
T lookupOrDefault(const word &, const T &, bool recursive=false, bool patternMatch=true) const
Find and return a T,.
const dimensionSet dimLength(0, 1, 0, 0, 0, 0, 0)
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
prefixOSstream Pout(cout, "Pout")
virtual bool needsUpdate() const
Does the surface need an update?
static autoPtr< searchableSurface > New(const word &surfaceType, const IOobject &io, const dictionary &dict)
Return a reference to the selected searchableSurface.
dimensioned< scalar > mag(const dimensioned< Type > &)
virtual Ostream & write(const token &)=0
Write next token to stream.
Mesh consisting of general polyhedral cells.
A class for managing temporary objects.
static const keyType null
An empty keyType.
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
ITstream & lookup(const word &, bool recursive=false, bool patternMatch=true) const
Find and return an entry data stream.
virtual tmp< scalarField > sample(const volScalarField &) const
Sample field on surface.