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)
173 const bool singleRegionName
177 names_(topDict.size()),
178 regionNames_(topDict.size()),
179 allSurfaces_(
identity(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);
426 Info<<
"Checking for closedness." <<
endl;
429 bool hasError =
false;
433 if (!
operator[](surfI).hasVolumeType())
440 <<
" : not closed" <<
endl;
443 if (isA<triSurface>(
operator[](surfI)))
451 label nSingleEdges = 0;
454 if (edgeFaces[edgeI].
size() == 1)
460 label nMultEdges = 0;
463 if (edgeFaces[edgeI].
size() > 2)
469 if (report && (nSingleEdges != 0 || nMultEdges != 0))
471 Info<<
" connected to one face : " 472 << nSingleEdges <<
nl 473 <<
" connected to >2 faces : " 474 << nMultEdges <<
endl;
493 Info<<
"Checking for normal orientation." <<
endl;
496 bool hasError =
false;
500 if (isA<triSurface>(
operator[](surfI)))
519 <<
" : has multiple orientation zones (" 520 << nZones <<
")" <<
endl;
537 const scalar maxRatio,
543 Info<<
"Checking for size." <<
endl;
546 bool hasError =
false;
556 if (ratio > maxRatio || ratio < 1.0/maxRatio)
563 <<
" bounds differ from " <<
names()[j]
564 <<
" by more than a factor 100:" <<
nl 565 <<
" bounding box : " << bb <<
nl 585 const scalar tolerance,
592 Info<<
"Checking for intersection." <<
endl;
597 bool hasError =
false;
601 if (isA<triSurfaceMesh>(
operator[](i)))
615 const edge& e = edges0[edgeI];
616 start[edgeI] = localPoints0[e[0]];
617 end[edgeI] = localPoints0[e[1]];
651 && (i != j || !connected(s0, edgeI, hits[edgeI]))
654 intersections.append(hits[edgeI].hitPoint());
655 intersectionEdge.append(1.0*edgeI);
665 <<
" intersects " <<
names()[j]
671 if (setWriter.valid())
681 wordList valueSetNames(1,
"edgeIndex");
690 setWriter().getFileName(track, valueSetNames)
692 Info<<
" Writing intersection locations to " 696 s0.searchableSurface::time().
path()
727 const scalar minQuality,
733 Info<<
"Checking for triangle quality." <<
endl;
736 bool hasError =
false;
740 if (isA<triSurface>(
operator[](surfI)))
772 <<
" : has " << nBadTris <<
" bad quality triangles " 773 <<
" (quality < " << minQuality <<
")" <<
endl;
795 label noFailedChecks = 0;
806 return noFailedChecks;
812 const scalar maxRatio,
815 const scalar minQuality,
819 label noFailedChecks = 0;
821 if (maxRatio > 0 &&
checkSizes(maxRatio, report))
836 return noFailedChecks;
853 Info<<
" type : " << s.type() <<
nl 855 if (isA<triSurfaceMesh>(s))
864 if (patchTypes.
size() && patchTypes[surfI].
size() >= 1)
867 Info<<
" patches : ";
871 if (i < unique.size()-1)
895 <<
"Surface named " << surfName <<
" not found." <<
nl 896 <<
"Available surface names: " << names_ <<
endl 914 <<
"Surface named " << surfName <<
" not found." <<
nl 915 <<
"Available surface names: " << names_ <<
endl
autoPtr< IOobject > clone() const
Clone.
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.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
const word & name() const
Return name.
A class for handling file names.
virtual const wordList & regions() const =0
Names of regions.
label checkTopology(const bool report) const
All topological checks. Return number of failed checks.
errorManipArg< error, int > exit(error &err, const int errNo=1)
edgeList edges() const
Return edges in face point ordering,.
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.
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.
void findAnyIntersection(const pointField &start, const pointField &end, labelList &surfaces, List< pointIndexHit > &) const
Find any intersection. Return hit point information and.
virtual tmp< pointField > points() const
Get the points that define the surface.
void size(const label)
Override size to be inconsistent with allocated storage.
Ostream & endl(Ostream &os)
Add newline and flush stream.
label findSurfaceID(const word &name) const
Find index of surface. Return -1 if not found.
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/any.
labelList identity(const label len)
Create identity map (map[i] == i) of given length.
A bounding box defined in terms of the points at its extremities.
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.
const Field< PointType > & localPoints() const
Return pointField of points in patch.
virtual void findLineAny(const pointField &start, const pointField &end, List< pointIndexHit > &) const =0
Return any intersection on segment from start to end.
boundBox bounds() const
Calculate bounding box.
void findNearestIntersection(const pointField &start, const pointField &end, labelList &surface1, List< pointIndexHit > &hit1, labelList &surface2, List< pointIndexHit > &hit2) const
label findSurfaceRegionID(const word &surfaceName, const word ®ionName) const
bool isDict(const word &) const
Check if entry is a sub-dictionary.
fileName path() const
Return complete path.
bool checkNormalOrientation(const bool report) const
Are all (triangulated) surfaces consistent normal orientation.
Various functions to operate on Lists.
const dictionary & subDict(const word &) const
Find and return a sub-dictionary.
IOoject and searching on triSurface.
friend Ostream & operator(Ostream &, const UPtrList< T > &)
Write UPtrList to Ostream.
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))
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)
Find intersections of edge nearest to both endpoints.
bool checkIntersection(const scalar tol, const autoPtr< writer< scalar >> &, const bool report) const
Do surfaces self-intersect or intersect others.
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.
scalar mag() const
The magnitude of the bounding box span.
bool readIfPresent(const word &, T &, bool recursive=false, bool patternMatch=true) const
Find an entry if present, and assign to T.
const Field< PointType > & points() const
Return reference to global points.
const labelListList & edgeFaces() const
Return edge-face addressing.
const edgeList & edges() const
Return list of edges, address into LOCAL point list.
searchableSurfaces(const label)
Construct with length specified. Fill later.
virtual label globalSize() const
Range of global indices that can be returned.
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)
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 nEdges() const
Return number of edges in patch.
defineTypeNameAndDebug(combustionModel, 0)
label findIndex(const ListType &, typename ListType::const_reference, const label start=0)
Find first occurrence of given element and return index,.
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.
label size() const
Return the number of elements in the UPtrList.
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.
void setSize(const label)
Reset size of List.
const searchableSurface & operator[](const word &) const
Return const reference to searchableSurface by name.
A templated 1D list of pointers to objects of type <T>, where the size of the array is known and used...
const wordList & names() const
static autoPtr< searchableSurface > New(const word &surfaceType, const IOobject &io, const dictionary &dict)
Return a reference to the selected searchableSurface.
scalar tolerance() const
Return tolerance to use in searches.
triangle< point, const point & > triPointRef
dimensioned< scalar > mag(const dimensioned< Type > &)
bool checkQuality(const scalar minQuality, const bool report) const
Check triangle quality.
T returnReduce(const T &Value, const BinaryOp &bop, const int tag=Pstream::msgType(), const label comm=UPstream::worldComm)
const boundBox & bounds() const
Return const reference to boundBox.
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.
bool checkClosed(const bool report) const
Are all surfaces closed and manifold.
Triangulated surface description with patch information.
void writeStats(const List< wordList > &, Ostream &) const
Write some stats.
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
bool checkSizes(const scalar maxRatio, const bool report) const
Are all bounding boxes of similar size.
virtual bool hasVolumeType() const =0
Whether supports volume type below.
static boundBox bounds(const PtrList< searchableSurface > &allSurfaces, const labelList &surfacesToTest)
Find the boundBox of the selected surfaces.
ITstream & lookup(const word &, bool recursive=false, bool patternMatch=true) const
Find and return an entry data stream.