33 namespace sampledSurfaces
42 void Foam::sampledSurfaces::distanceSurface::createGeometry()
46 Pout<<
"distanceSurface::createGeometry :updating geometry." <<
endl;
56 if (zoneKey_.size() && !subMeshPtr_.valid())
67 subMeshPtr_().setLargeCellSubset
74 <<
"Allocating subset of size " << subMeshPtr_().subMesh().nCells()
75 <<
" with exposed faces into patch " 76 << patches[exposedPatchi].
name() <<
endl;
83 ? subMeshPtr_().subMesh()
91 cellDistancePtr_.
reset 116 surfPtr_().findNearest
127 surfPtr_().getVolumeType(cc, volType);
135 fld[i] =
Foam::mag(cc[i] - nearest[i].hitPoint());
139 fld[i] = -
Foam::mag(cc[i] - nearest[i].hitPoint());
144 <<
"getVolumeType failure, neither INSIDE or OUTSIDE" 153 fld[i] =
Foam::mag(cc[i] - nearest[i].hitPoint());
169 surfPtr_().findNearest
180 surfPtr_().getVolumeType(cc, volType);
188 fld[i] =
Foam::mag(cc[i] - nearest[i].hitPoint());
192 fld[i] = -
Foam::mag(cc[i] - nearest[i].hitPoint());
197 <<
"getVolumeType failure, " 198 <<
"neither INSIDE or OUTSIDE" 207 fld[i] =
Foam::mag(cc[i] - nearest[i].hitPoint());
219 pointDistance_.setSize(mesh.
nPoints());
224 surfPtr_().findNearest
235 surfPtr_().getVolumeType(pts, volType);
244 Foam::mag(pts[i] - nearest[i].hitPoint());
249 -
Foam::mag(pts[i] - nearest[i].hitPoint());
254 <<
"getVolumeType failure, neither INSIDE or OUTSIDE" 263 pointDistance_[i] =
Foam::mag(pts[i]-nearest[i].hitPoint());
272 cellDistance.
write();
289 Pout<<
"Writing point distance:" << pDist.objectPath() <<
endl;
329 dict.
lookup(
"surfaceType"),
342 distance_(dict.
lookup<scalar>(
"distance")),
346 dict.
found(
"filtering")
353 subMeshPtr_(
nullptr),
358 dict.
lookup(
"exposedPatchName") >> exposedPatchName_;
363 <<
"Cannot find patch " << exposedPatchName_
364 <<
" in which to put exposed faces." <<
endl 371 Info<<
"Restricting to cellZone " << zoneKey_
372 <<
" with exposed internal faces into patch " 373 << exposedPatchName_ <<
endl;
379 <<
"cellZone " << zoneKey_
380 <<
" not found - using entire mesh" <<
endl;
404 Pout<<
"distanceSurface::expire :" 405 <<
" needsUpdate_:" << needsUpdate_ <<
endl;
426 Pout<<
"distanceSurface::update :" 427 <<
" needsUpdate_:" << needsUpdate_ <<
endl;
437 needsUpdate_ =
false;
448 return sampleField(vField);
458 return sampleField(vField);
468 return sampleField(vField);
478 return sampleField(vField);
488 return sampleField(vField);
498 return interpolateField(interpolator);
508 return interpolateField(interpolator);
517 return interpolateField(interpolator);
527 return interpolateField(interpolator);
537 return interpolateField(interpolator);
543 os <<
"distanceSurface: " <<
name() <<
" :" 544 <<
" surface:" << surfPtr_().name()
545 <<
" distance:" << distance_
546 <<
" faces:" << faces().size()
547 <<
" points:" <<
points().size();
virtual ~distanceSurface()
Destructor.
const fvPatchList & patches
const polyBoundaryMesh & boundaryMesh() const
Return boundary mesh.
bool found(const word &, bool recursive=false, bool patternMatch=true) const
Search dictionary for given keyword.
#define forAll(list, i)
Loop across all elements in list.
virtual Ostream & write(const char)=0
Write character.
const word & name() const
Return name.
errorManipArg< error, int > exit(error &err, const int errNo=1)
const meshCellZones & cellZones() const
Return cell zones.
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.
defineTypeNameAndDebug(distanceSurface, 0)
const Boundary & boundaryField() const
Return const-reference to the boundary field.
static const NamedEnum< filterType, 4 > filterTypeNames_
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
virtual bool update()
Update the surface as required.
void size(const label)
Override size to be inconsistent with allocated storage.
bool interpolate() const
Interpolation requested for surface.
void reset(const polyMesh &)
Reset mesh.
Ostream & endl(Ostream &os)
Add newline and flush stream.
fileName objectPath() const
Return complete path + object name.
Abstract base class with a fat-interface to all derived classes covering all possible ways in which t...
label findPatchID(const word &patchName) const
Find patch index given a name.
const Time & time() const
Return the top-level database.
A sampledSurface defined by a distance to a surface.
Macros for easy insertion into run-time selection tables.
const dimensionSet dimLength
virtual const pointField & points() const
Return raw points.
virtual void print(Ostream &) const
Write.
HashSet< label, Hash< label > > labelHashSet
A HashSet with label keys.
gmvFile<< "tracers "<< particles.size()<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().x()<< ' ';}gmvFile<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().y()<< ' ';}gmvFile<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().z()<< ' ';}gmvFile<< nl;forAll(lagrangianScalarNames, i){ const word &name=lagrangianScalarNames[i];IOField< scalar > fld(IOobject(name, runTime.timeName(), cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
static word timeName(const scalar, const int precision=curPrecision_)
Return time name of given scalar time.
static const word & geometryDir()
Return the geometry directory name.
A class for handling words, derived from string.
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
wordList names() const
Return a list of patch names.
const word & constant() const
Return constant name.
virtual bool needsUpdate() const
Does the surface need an update?
virtual bool expire()
Mark the surface as needing an update.
A sampledSurface defined by a surface of iso value.
#define DebugInfo
Report an information message using Foam::Info.
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.
const Time & time() const
Return time.
static pointMesh & New(polyMesh &mesh)
Post-processing mesh subset tool. Given the original mesh and the list of selected cells...
addToRunTimeSelectionTable(sampledSurface, distanceSurface, word)
word name(const complex &)
Return a string representation of a complex.
distanceSurface(const word &name, const polyMesh &mesh, const dictionary &dict)
Construct from dictionary.
T lookupOrDefault(const word &, const T &, bool recursive=false, bool patternMatch=true) const
Find and return a T,.
#define WarningInFunction
Report a warning using Foam::Warning.
Boundary & boundaryFieldRef()
Return a reference to the boundary field.
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
prefixOSstream Pout(cout, "Pout")
Mesh data needed to do the Finite Volume discretisation.
virtual tmp< scalarField > sample(const volScalarField &) const
Sample field on surface.
static autoPtr< searchableSurface > New(const word &surfaceType, const IOobject &io, const dictionary &dict)
Return a reference to the selected searchableSurface.
label findIndex(const wordRe &) const
Return zone index for the first match, return -1 if not found.
dimensioned< scalar > mag(const dimensioned< Type > &)
Enum read(Istream &) const
Read a word from Istream and return the corresponding.
Mesh consisting of general polyhedral cells.
const volVectorField & C() const
Return cell centres.
virtual bool write(const bool write=true) const
Write using setting from DB.
A class for managing temporary objects.
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
static const wordRe null
An empty wordRe.
ITstream & lookup(const word &, bool recursive=false, bool patternMatch=true) const
Find and return an entry data stream.