47 bool Foam::searchableSurfaces::connected
54 const triFace& localFace = s.localFaces()[hit.index()];
55 const edge& e = s.
edges()[edgeI];
59 if (e.otherVertex(localFace[i]) != -1)
72 Foam::searchableSurfaces::searchableSurfaces(
const label size)
175 Foam::searchableSurfaces::searchableSurfaces
179 const bool singleRegionName
183 names_(topDict.
size()),
184 regionNames_(topDict.
size()),
190 const word& key = iter().keyword();
196 "searchableSurfaces::searchableSurfaces" 197 "( const IOobject&, const dictionary&)" 198 ) <<
"Found non-dictionary entry " << iter()
199 <<
" in top-level dictionary " << topDict
215 namedIO().rename(key);
234 wordList& rNames = regionNames_[surfI];
237 if (singleRegionName && localNames.
size() == 1)
239 rNames[0] = names_[surfI];
243 forAll(localNames, regionI)
245 rNames[regionI] = names_[surfI] +
'_' + localNames[regionI];
250 if (dict.
found(
"regions"))
256 const word& key = iter().keyword();
258 if (regionsDict.
isDict(key))
269 "searchableSurfaces::searchableSurfaces" 270 "( const IOobject&, const dictionary&)" 271 ) <<
"Unknown region name " << key
272 <<
" for surface " << s.
name() <<
endl 273 <<
"Valid region names are " << localNames
277 rNames[index] =
word(regionDict.
lookup(
"name"));
288 regionNames_.setSize(surfI);
297 const word& wantedName
306 const word& surfaceName,
307 const word& regionName
312 return findIndex(this->
operator[](surfaceIndex).regions(), regionName);
441 const scalar initDistSqr,
442 const scalar convergenceDistSqr,
461 Info<<
"Checking for closedness." <<
endl;
464 bool hasError =
false;
468 if (!
operator[](surfI).hasVolumeType())
475 <<
" : not closed" <<
endl;
478 if (isA<triSurface>(
operator[](surfI)))
486 label nSingleEdges = 0;
489 if (edgeFaces[edgeI].
size() == 1)
495 label nMultEdges = 0;
498 if (edgeFaces[edgeI].
size() > 2)
504 if (report && (nSingleEdges != 0 || nMultEdges != 0))
506 Info<<
" connected to one face : " 507 << nSingleEdges <<
nl 508 <<
" connected to >2 faces : " 509 << nMultEdges <<
endl;
528 Info<<
"Checking for normal orientation." <<
endl;
531 bool hasError =
false;
535 if (isA<triSurface>(
operator[](surfI)))
554 <<
" : has multiple orientation zones (" 555 << nZones <<
")" <<
endl;
572 const scalar maxRatio,
578 Info<<
"Checking for size." <<
endl;
581 bool hasError =
false;
591 if (ratio > maxRatio || ratio < 1.0/maxRatio)
598 <<
" bounds differ from " <<
names()[j]
599 <<
" by more than a factor 100:" <<
nl 600 <<
" bounding box : " << bb <<
nl 620 const scalar tolerance,
627 Info<<
"Checking for intersection." <<
endl;
632 bool hasError =
false;
636 if (isA<triSurfaceMesh>(
operator[](i)))
650 const edge& e = edges0[edgeI];
651 start[edgeI] = localPoints0[e[0]];
652 end[edgeI] = localPoints0[e[1]];
686 && (i != j || !connected(s0, edgeI, hits[edgeI]))
689 intersections.append(hits[edgeI].hitPoint());
690 intersectionEdge.append(1.0*edgeI);
700 <<
" intersects " <<
names()[j]
706 if (setWriter.valid())
713 intersections.
xfer(),
716 wordList valueSetNames(1,
"edgeIndex");
725 setWriter().getFileName(track, valueSetNames)
727 Info<<
" Writing intersection locations to " 731 s0.searchableSurface::time().
path()
762 const scalar minQuality,
768 Info<<
"Checking for triangle quality." <<
endl;
771 bool hasError =
false;
775 if (isA<triSurface>(
operator[](surfI)))
807 <<
" : has " << nBadTris <<
" bad quality triangles " 808 <<
" (quality < " << minQuality <<
")" <<
endl;
830 label noFailedChecks = 0;
841 return noFailedChecks;
847 const scalar maxRatio,
850 const scalar minQuality,
854 label noFailedChecks = 0;
856 if (maxRatio > 0 &&
checkSizes(maxRatio, report))
871 return noFailedChecks;
888 Info<<
" type : " << s.type() <<
nl 890 if (isA<triSurfaceMesh>(s))
899 if (patchTypes.
size() && patchTypes[surfI].
size() >= 1)
902 Info<<
" patches : ";
906 if (i < unique.size()-1)
931 "searchableSurfaces::operator[](const word&) const" 932 ) <<
"Surface named " << surfName <<
" not found." <<
nl 933 <<
"Available surface names: " << names_ <<
endl 952 "searchableSurfaces::operator[](const word&)" 953 ) <<
"Surface named " << surfName <<
" not found." <<
nl 954 <<
"Available surface names: " << names_ <<
endl void findNearest(const pointField &, const scalarField &nearestDistSqr, labelList &surfaces, List< pointIndexHit > &) const
Find nearest. Return -1 (and a miss()) or surface and nearest.
label findSurfaceID(const word &name) const
Find index of surface. Return -1 if not found.
bool found(const word &, bool recursive=false, bool patternMatch=true) const
Search dictionary for given keyword.
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 setSize(const label)
Reset size of PtrList. If extending the PtrList, new entries are.
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 size() const
Return the number of elements in the PtrList.
Foam::autoPtr< IOobject > clone() const
Clone.
T returnReduce(const T &Value, const BinaryOp &bop, const int tag=Pstream::msgType(), const label comm=UPstream::worldComm)
This class describes the interaction of (usually) a face and a point. It carries the info of a succes...
label findIndex(const ListType &, typename ListType::const_reference, const label start=0)
Find first occurence of given element and return index,.
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 ))
A templated 1D list of pointers to objects of type <T>, where the size of the array is known and used...
Base class of (analytical or triangulated) surface. Encapsulates all the search routines. WIP.
dimensioned< scalar > mag(const dimensioned< Type > &)
Holds list of sampling positions.
virtual bool hasVolumeType() const =0
Whether supports volume type below.
scalar mag() const
The magnitude of the bounding box span.
const labelListList & edgeFaces() const
Return edge-face addressing.
static boundBox bounds(const PtrList< searchableSurface > &allSurfaces, const labelList &surfacesToTest)
Find the boundBox of the selected surfaces.
Xfer< List< T > > xfer()
Transfer contents to the Xfer container.
Triangulated surface description with patch information.
A class for handling words, derived from string.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
void size(const label)
Override size to be inconsistent with allocated storage.
errorManipArg< error, int > exit(error &err, const int errNo=1)
const boundBox & bounds() const
Return const reference to boundBox.
Various functions to operate on Lists.
PointIndexHit< point > pointIndexHit
edgeList edges() const
Return edges in face point ordering,.
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.
pointIndexHit facesIntersection(const scalar initialDistSqr, const scalar convergenceDistSqr, const point &start) const
Calculate point which is on a set of surfaces.
iterator end()
Return an iterator to end traversing the PtrList.
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.
A list of keyword definitions, which are a keyword followed by any number of values (e...
friend Ostream & operator(Ostream &, const PtrList< searchableSurface > &)
static label markZones(const PrimitivePatch< Face, FaceList, PointField, PointType > &, const BoolListType &borderEdge, labelList &faceZone)
Size and fills faceZone with zone of face.
const dictionary & subDict(const word &) const
Find and return a sub-dictionary.
label size() const
Return number of elements in list.
An edge is a list of two point labels. The functionality it provides supports the discretisation on a...
const searchableSurface & operator[](const word &) const
Return const reference to searchableSurface by name.
bool checkNormalOrientation(const bool report) const
Are all (triangulated) surfaces consistent normal orientation.
triangle< point, const point & > triPointRef
virtual void findLineAny(const pointField &start, const pointField &end, List< pointIndexHit > &) const =0
Return any intersection on segment from start to end.
bool checkIntersection(const scalar tol, const autoPtr< writer< scalar > > &, const bool report) const
Do surfaces self-intersect or intersect others.
forAllConstIter(PtrDictionary< phaseModel >, mixture.phases(), phase)
static bool checkOrientation(const PrimitivePatch< Face, FaceList, PointField, PointType > &, const bool report=false, labelHashSet *marked=0)
Check for orientation issues.
fileName path() const
Return complete path.
const Field< PointType > & localPoints() const
Return pointField of points in patch.
scalar tolerance() const
Return tolerance to use in searches.
Triangle with additional region number.
static autoPtr< searchableSurface > New(const word &surfaceType, const IOobject &io, const dictionary &dict)
Return a reference to the selected searchableSurface.
void setSize(const label)
Reset size of List.
Ostream & endl(Ostream &os)
Add newline and flush stream.
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...
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)
dimensioned< Type > max(const dimensioned< Type > &, const dimensioned< Type > &)
const edgeList & edges() const
Return list of edges, address into LOCAL point list.
virtual Ostream & write(const token &)=0
Write next token to stream.
virtual tmp< pointField > points() const
Get the points that define the surface.
labelList identity(const label len)
Create identity map (map[i] == i) of given length.
errorManip< error > abort(error &err)
const word & name() const
Return name.
#define FatalErrorIn(functionName)
Report an error message using Foam::FatalError.
A bounding box defined in terms of the points at its extremities.
void findNearestIntersection(const pointField &start, const pointField &end, labelList &surface1, List< pointIndexHit > &hit1, labelList &surface2, List< pointIndexHit > &hit2) const
bool isDict(const word &) const
Check if entry is a sub-dictionary.
bool checkClosed(const bool report) const
Are all surfaces closed and manifold.
ITstream & lookup(const word &, bool recursive=false, bool patternMatch=true) const
Find and return an entry data stream.
virtual label globalSize() const
Range of global indices that can be returned.
label checkTopology(const bool report) const
All topological checks. Return number of failed checks.
void writeStats(const List< wordList > &, Ostream &) const
Write some stats.
A class for handling file names.
bool readIfPresent(const word &, T &, bool recursive=false, bool patternMatch=true) const
Find an entry if present, and assign to T.
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.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
boundBox bounds() const
Calculate bounding box.
bool checkSizes(const scalar maxRatio, const bool report) const
Are all bounding boxes of similar size.
const wordList & names() const
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 nEdges() const
Return number of edges in patch.
virtual const wordList & regions() const =0
Names of regions.
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.
label findSurfaceRegionID(const word &surfaceName, const word ®ionName) const
IOoject and searching on triSurface.
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
const Field< PointType > & points() const
Return reference to global points.
void findAnyIntersection(const pointField &start, const pointField &end, labelList &surfaces, List< pointIndexHit > &) const
Find any intersection. Return hit point information and.
defineTypeNameAndDebug(combustionModel, 0)