44 bool Foam::searchableSurfaces::connected
51 const triFace& localFace = s.localFaces()[hit.index()];
52 const edge& e = s.
edges()[edgeI];
56 if (e.otherVertex(localFace[i]) != -1)
69 Foam::searchableSurfaces::searchableSurfaces(
const label size)
169 Foam::searchableSurfaces::searchableSurfaces
173 const bool singleRegionName
177 names_(topDict.
size()),
178 regionNames_(topDict.
size()),
184 const word& key = iter().keyword();
189 <<
"Found non-dictionary entry " << iter()
190 <<
" in top-level dictionary " << topDict
206 namedIO().rename(key);
225 wordList& rNames = regionNames_[surfI];
228 if (singleRegionName && localNames.
size() == 1)
230 rNames[0] = names_[surfI];
234 forAll(localNames, regionI)
236 rNames[regionI] = names_[surfI] +
'_' + localNames[regionI];
241 if (dict.
found(
"regions"))
247 const word& key = iter().keyword();
249 if (regionsDict.
isDict(key))
259 <<
"Unknown region name " << key
260 <<
" for surface " << s.
name() <<
endl 261 <<
"Valid region names are " << localNames
265 rNames[index] =
word(regionDict.
lookup(
"name"));
276 regionNames_.setSize(surfI);
285 const word& wantedName
294 const word& surfaceName,
295 const word& regionName
300 return findIndex(this->
operator[](surfaceIndex).regions(), regionName);
424 const scalar initDistSqr,
425 const scalar convergenceDistSqr,
444 Info<<
"Checking for closedness." <<
endl;
447 bool hasError =
false;
451 if (!
operator[](surfI).hasVolumeType())
458 <<
" : not closed" <<
endl;
461 if (isA<triSurface>(
operator[](surfI)))
469 label nSingleEdges = 0;
472 if (edgeFaces[edgeI].
size() == 1)
478 label nMultEdges = 0;
481 if (edgeFaces[edgeI].
size() > 2)
487 if (report && (nSingleEdges != 0 || nMultEdges != 0))
489 Info<<
" connected to one face : " 490 << nSingleEdges <<
nl 491 <<
" connected to >2 faces : " 492 << nMultEdges <<
endl;
511 Info<<
"Checking for normal orientation." <<
endl;
514 bool hasError =
false;
518 if (isA<triSurface>(
operator[](surfI)))
537 <<
" : has multiple orientation zones (" 538 << nZones <<
")" <<
endl;
555 const scalar maxRatio,
561 Info<<
"Checking for size." <<
endl;
564 bool hasError =
false;
574 if (ratio > maxRatio || ratio < 1.0/maxRatio)
581 <<
" bounds differ from " <<
names()[j]
582 <<
" by more than a factor 100:" <<
nl 583 <<
" bounding box : " << bb <<
nl 603 const scalar tolerance,
610 Info<<
"Checking for intersection." <<
endl;
615 bool hasError =
false;
619 if (isA<triSurfaceMesh>(
operator[](i)))
633 const edge& e = edges0[edgeI];
634 start[edgeI] = localPoints0[e[0]];
635 end[edgeI] = localPoints0[e[1]];
669 && (i != j || !connected(s0, edgeI, hits[edgeI]))
672 intersections.append(hits[edgeI].hitPoint());
673 intersectionEdge.append(1.0*edgeI);
683 <<
" intersects " <<
names()[j]
689 if (setWriter.valid())
696 intersections.
xfer(),
699 wordList valueSetNames(1,
"edgeIndex");
708 setWriter().getFileName(track, valueSetNames)
710 Info<<
" Writing intersection locations to " 714 s0.searchableSurface::time().
path()
745 const scalar minQuality,
751 Info<<
"Checking for triangle quality." <<
endl;
754 bool hasError =
false;
758 if (isA<triSurface>(
operator[](surfI)))
790 <<
" : has " << nBadTris <<
" bad quality triangles " 791 <<
" (quality < " << minQuality <<
")" <<
endl;
813 label noFailedChecks = 0;
824 return noFailedChecks;
830 const scalar maxRatio,
833 const scalar minQuality,
837 label noFailedChecks = 0;
839 if (maxRatio > 0 &&
checkSizes(maxRatio, report))
854 return noFailedChecks;
871 Info<<
" type : " << s.type() <<
nl 873 if (isA<triSurfaceMesh>(s))
882 if (patchTypes.
size() && patchTypes[surfI].
size() >= 1)
885 Info<<
" patches : ";
889 if (i < unique.size()-1)
913 <<
"Surface named " << surfName <<
" not found." <<
nl 914 <<
"Available surface names: " << names_ <<
endl 932 <<
"Surface named " << surfName <<
" not found." <<
nl 933 <<
"Available surface names: " << names_ <<
endl bool checkSizes(const scalar maxRatio, const bool report) const
Are all bounding boxes of similar size.
#define forAll(list, i)
Loop across all elements in list.
bool checkIntersection(const scalar tol, const autoPtr< writer< scalar >> &, const bool report) const
Do surfaces self-intersect or intersect others.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
A class for handling file names.
const boundBox & bounds() const
Return const reference to boundBox.
virtual const wordList & regions() const =0
Names of regions.
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...
dimensioned< Type > max(const dimensioned< Type > &, const dimensioned< Type > &)
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Xfer< List< T > > xfer()
Transfer contents to the Xfer container.
static void findNearest(const PtrList< searchableSurface > &, const labelList &surfacesToTest, const pointField &, const scalarField &nearestDistSqr, labelList &surfaces, List< pointIndexHit > &)
Find nearest. Return -1 (and a miss()) or surface and nearest.
bool checkNormalOrientation(const bool report) const
Are all (triangulated) surfaces consistent normal orientation.
void size(const label)
Override size to be inconsistent with allocated storage.
virtual tmp< pointField > points() const
Get the points that define the surface.
const dictionary & subDict(const word &) const
Find and return a sub-dictionary.
bool isDict(const word &) const
Check if entry is a sub-dictionary.
Ostream & endl(Ostream &os)
Add newline and flush stream.
const Field< PointType > & points() const
Return reference to global points.
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.
labelList identity(const label len)
Create identity map (map[i] == i) of given length.
label findSurfaceID(const word &name) const
Find index of surface. Return -1 if not found.
A bounding box defined in terms of the points at its extremities.
This class describes the interaction of (usually) a face and a point. It carries the info of a succes...
PointIndexHit< point > pointIndexHit
iterator end()
Return an iterator to end traversing the UPtrList.
Base class of (analytical or triangulated) surface. Encapsulates all the search routines. WIP.
static void findAllIntersections(const PtrList< searchableSurface > &, const labelList &surfacesToTest, const pointField &start, const pointField &end, labelListList &surfaces, List< List< pointIndexHit >> &surfaceHits)
Find all intersections in order from start to end. Returns for.
virtual void findLineAny(const pointField &start, const pointField &end, List< pointIndexHit > &) const =0
Return any intersection on segment from start to end.
label size() const
Return number of elements in list.
boundBox bounds() const
Calculate bounding box.
pointIndexHit facesIntersection(const scalar initialDistSqr, const scalar convergenceDistSqr, const point &start) const
Calculate point which is on a set of surfaces.
Various functions to operate on Lists.
IOoject and searching on triSurface.
friend Ostream & operator(Ostream &, const UPtrList< T > &)
Write UPtrList to Ostream.
fileName path() const
Return complete path.
scalar mag() const
The magnitude of the bounding box span.
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){word name=lagrangianScalarNames[i];IOField< scalar > s(IOobject(name, runTime.timeName(), cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
scalar tolerance() const
Return tolerance to use in searches.
Holds list of sampling positions.
void findNearest(const pointField &, const scalarField &nearestDistSqr, labelList &surfaces, List< pointIndexHit > &) const
Find nearest. Return -1 (and a miss()) or surface and nearest.
static void findNearestIntersection(const PtrList< searchableSurface > &allSurfaces, const labelList &surfacesToTest, const pointField &start, const pointField &end, labelList &surface1, List< pointIndexHit > &hit1, labelList &surface2, List< pointIndexHit > &hit2)
An edge is a list of two point labels. The functionality it provides supports the discretisation on a...
A class for handling words, derived from string.
bool readIfPresent(const word &, T &, bool recursive=false, bool patternMatch=true) const
Find an entry if present, and assign to T.
const edgeList & edges() const
Return list of edges, address into LOCAL point list.
Foam::autoPtr< IOobject > clone() const
Clone.
bool found(const word &, bool recursive=false, bool patternMatch=true) const
Search dictionary for given keyword.
void findAllIntersections(const pointField &start, const pointField &end, labelListList &surfaces, List< List< pointIndexHit >> &) const
Find all intersections in order from start to end. Returns for.
void findNearestIntersection(const pointField &start, const pointField &end, labelList &surface1, List< pointIndexHit > &hit1, labelList &surface2, List< pointIndexHit > &hit2) const
Triangle with additional region number.
static void findAnyIntersection(const PtrList< searchableSurface > &, const labelList &surfacesToTest, const pointField &start, const pointField &end, labelList &surfaces, List< pointIndexHit > &)
Find any intersection. Return hit point information and.
forAllConstIter(PtrDictionary< phaseModel >, mixture.phases(), phase)
errorManip< error > abort(error &err)
edgeList edges() const
Return edges in face point ordering,.
void setSize(const label)
Reset size of PtrList. If extending the PtrList, new entries are.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
label findSurfaceRegionID(const word &surfaceName, const word ®ionName) const
void findAnyIntersection(const pointField &start, const pointField &end, labelList &surfaces, List< pointIndexHit > &) const
Find any intersection. Return hit point information and.
defineTypeNameAndDebug(combustionModel, 0)
static pointIndexHit facesIntersection(const PtrList< searchableSurface > &allSurfaces, const labelList &surfacesToTest, const scalar initDistSqr, const scalar convergenceDistSqr, const point &start)
Calculate point which is on a set of surfaces. WIP.
label findIndex(const ListType &, typename ListType::const_reference, const label start=0)
Find first occurence of given element and return index,.
bool checkClosed(const bool report) const
Are all surfaces closed and manifold.
label nEdges() const
Return number of edges in patch.
label checkGeometry(const scalar maxRatio, const scalar tolerance, const autoPtr< writer< scalar >> &setWriter, const scalar minQuality, const bool report) const
All geometric checks. Return number of failed checks.
label checkTopology(const bool report) const
All topological checks. Return number of failed checks.
const wordList & names() const
void setSize(const label)
Reset size of List.
A templated 1D list of pointers to objects of type <T>, where the size of the array is known and used...
static autoPtr< searchableSurface > New(const word &surfaceType, const IOobject &io, const dictionary &dict)
Return a reference to the selected searchableSurface.
triangle< point, const point & > triPointRef
dimensioned< scalar > mag(const dimensioned< Type > &)
virtual label globalSize() const
Range of global indices that can be returned.
const labelListList & edgeFaces() const
Return edge-face addressing.
T returnReduce(const T &Value, const BinaryOp &bop, const int tag=Pstream::msgType(), const label comm=UPstream::worldComm)
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
virtual Ostream & write(const token &)=0
Write next token to stream.
Triangulated surface description with patch information.
bool checkQuality(const scalar minQuality, const bool report) const
Check triangle quality.
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
const searchableSurface & operator[](const word &) const
Return const reference to searchableSurface by name.
virtual bool hasVolumeType() const =0
Whether supports volume type below.
const Field< PointType > & localPoints() const
Return pointField of points in patch.
const word & name() const
Return name.
static boundBox bounds(const PtrList< searchableSurface > &allSurfaces, const labelList &surfacesToTest)
Find the boundBox of the selected surfaces.
void writeStats(const List< wordList > &, Ostream &) const
Write some stats.
label size() const
Return the number of elements in the UPtrList.
ITstream & lookup(const word &, bool recursive=false, bool patternMatch=true) const
Find and return an entry data stream.