45 bool Foam::searchableSurfaceList::connected
52 const triFace& localFace =
s.localFaces()[hit.index()];
53 const edge&
e =
s.edges()[edgeI];
57 if (
e.otherVertex(localFace[i]) != -1)
81 const bool singleRegionName
85 names_(topDict.size()),
86 regionNames_(topDict.size()),
92 const word& key = iter().keyword();
97 <<
"Found non-dictionary entry " << iter()
98 <<
" in top-level dictionary " << topDict
105 dict.readIfPresent(
"name", names_[surfI]);
114 namedIO().rename(key);
131 const wordList& localNames =
s.regions();
133 wordList& rNames = regionNames_[surfI];
136 if (singleRegionName && localNames.
size() == 1)
138 rNames[0] = names_[surfI];
142 forAll(localNames, regionI)
144 rNames[regionI] = names_[surfI] +
'_' + localNames[regionI];
149 if (
dict.found(
"regions"))
155 const word& key = iter().keyword();
157 if (regionsDict.
isDict(key))
167 <<
"Unknown region name " << key
168 <<
" for surface " <<
s.name() <<
endl
169 <<
"Valid region names are " << localNames
173 rNames[index] =
word(regionDict.
lookup(
"name"));
184 regionNames_.setSize(surfI);
193 const word& wantedName
202 const word& surfaceName,
206 label surfaceIndex = findSurfaceID(surfaceName);
334 Info<<
"Checking for closedness." <<
endl;
337 bool hasError =
false;
341 if (!
operator[](surfI).hasVolumeType())
347 Info<<
" " << names()[surfI]
348 <<
" : not closed" <<
endl;
351 if (isA<triSurface>(
operator[](surfI)))
359 label nSingleEdges = 0;
362 if (edgeFaces[edgeI].size() == 1)
368 label nMultEdges = 0;
371 if (edgeFaces[edgeI].size() > 2)
377 if (report && (nSingleEdges != 0 || nMultEdges != 0))
379 Info<<
" connected to one face : "
380 << nSingleEdges <<
nl
381 <<
" connected to >2 faces : "
382 << nMultEdges <<
endl;
404 Info<<
"Checking for normal orientation." <<
endl;
407 bool hasError =
false;
411 if (isA<triSurface>(
operator[](surfI)))
429 Info<<
" " << names()[surfI]
430 <<
" : has multiple orientation zones ("
431 << nZones <<
")" <<
endl;
448 const scalar maxRatio,
454 Info<<
"Checking for size." <<
endl;
457 bool hasError =
false;
461 const boundBox& bb = operator[](i).bounds();
463 for (
label j = i+1; j < size(); j++)
465 scalar ratio = bb.
mag()/operator[](j).bounds().mag();
467 if (ratio > maxRatio || ratio < 1.0/maxRatio)
473 Info<<
" " << names()[i]
474 <<
" bounds differ from " << names()[j]
475 <<
" by more than a factor 100:" <<
nl
476 <<
" bounding box : " << bb <<
nl
477 <<
" bounding box : " << operator[](j).bounds()
496 const scalar tolerance,
502 Info<<
"Checking for intersection." <<
endl;
507 bool hasError =
false;
511 if (isA<searchableSurfaces::triSurface>(
operator[](i)))
526 const edge&
e = edges0[edgeI];
527 start[edgeI] = localPoints0[
e[0]];
528 end[edgeI] = localPoints0[
e[1]];
551 operator[](j).findLineAny(start, end, hits);
562 && (i != j || !connected(s0, edgeI, hits[edgeI]))
565 intersections.
append(hits[edgeI].hitPoint());
566 intersectionEdge.
append(1.0*edgeI);
575 Info<<
" " << names()[i]
576 <<
" intersects " << names()[j]
583 names()[i] +
'_' + names()[j] +
"_edgeIndex.vtk"
586 Info<<
" Writing intersection locations to "
592 names()[i] +
'_' + names()[j],
622 const scalar minQuality,
628 Info<<
"Checking for triangle quality." <<
endl;
631 bool hasError =
false;
635 if (isA<triSurface>(
operator[](surfI)))
666 Info<<
" " << names()[surfI]
667 <<
" : has " << nBadTris <<
" bad quality triangles "
668 <<
" (quality < " << minQuality <<
")" <<
endl;
690 label noFailedChecks = 0;
692 if (checkClosed(report))
697 if (checkNormalOrientation(report))
701 return noFailedChecks;
707 const scalar maxRatio,
709 const scalar minQuality,
713 label noFailedChecks = 0;
715 if (maxRatio > 0 && checkSizes(maxRatio, report))
720 if (checkIntersection(tol, report))
725 if (checkQuality(minQuality, report))
730 return noFailedChecks;
743 Info<<
" " << names()[surfI] <<
':' <<
endl;
747 Info<<
" type : " <<
s.type() <<
nl
748 <<
" size : " <<
s.globalSize() <<
nl;
749 if (isA<searchableSurfaces::triSurface>(
s))
754 <<
" points : " << ts.
points()().size() <<
nl;
756 Info<<
" bounds : " <<
s.bounds() <<
nl
757 <<
" closed : " <<
Switch(
s.hasVolumeType()) <<
endl;
762 Info<<
" patches : ";
766 if (i < unique.size()-1)
785 const label surfI = findSurfaceID(surfName);
790 <<
"Surface named " << surfName <<
" not found." <<
nl
791 <<
"Available surface names: " << names_ <<
endl
795 return operator[](surfI);
804 const label surfI = findSurfaceID(surfName);
809 <<
"Surface named " << surfName <<
" not found." <<
nl
810 <<
"Available surface names: " << names_ <<
endl
814 return operator[](surfI);
Various functions to operate on Lists.
#define forAll(list, i)
Loop across all elements in list.
#define forAllConstIter(Container, container, iter)
Iterate across all elements in the container object of type.
DynamicField< T, SizeInc, SizeMult, SizeDiv > & append(const T &)
Append an element at the end of the list.
label capacity() const
Size of the underlying storage.
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
autoPtr< IOobject > clone() const
Clone.
void size(const label)
Override size to be inconsistent with allocated storage.
void setSize(const label)
Reset size of List.
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
label nEdges() const
Return number of edges in patch.
const edgeList & edges() const
Return list of edges, address into LOCAL point list.
const Field< PointType > & localPoints() const
Return pointField of points in patch.
A templated 1D list of pointers to objects of type <T>, where the size of the array is known and used...
bool set(const label) const
Is element set.
void setSize(const label)
Reset size of PtrList. If extending the PtrList, new entries are.
A simple wrapper around bool so that it can be read as a word: true/false, on/off,...
friend Ostream & operator(Ostream &, const UPtrList< T > &)
Write UPtrList to Ostream.
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
A bounding box defined in terms of the points at its extremities.
scalar mag() const
The magnitude of the bounding box span.
A list of keywords followed by any number of values (e.g. words and numbers) or sub-dictionaries.
ITstream & lookup(const word &, bool recursive=false, bool patternMatch=true) const
Find and return an entry data stream.
bool isDict(const word &) const
Check if entry is a sub-dictionary.
const dictionary & subDict(const word &) const
Find and return a sub-dictionary.
An edge is a list of two point labels. The functionality it provides supports the discretisation on a...
A class for handling file names.
Triangle with additional region number.
Container for searchableSurfaces.
bool checkQuality(const scalar minQuality, const bool report) const
Check triangle quality.
label checkGeometry(const scalar maxRatio, const scalar tolerance, const scalar minQuality, const bool report) const
All geometric checks. Return number of failed checks.
boundBox bounds() const
Calculate bounding box.
label findSurfaceRegionID(const word &surfaceName, const word ®ionName) const
bool checkClosed(const bool report) const
Are all surfaces closed and manifold.
bool checkSizes(const scalar maxRatio, const bool report) const
Are all bounding boxes of similar size.
const searchableSurface & operator[](const word &) const
Return const reference to searchableSurface by name.
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 checkTopology(const bool report) const
All topological checks. Return number of failed checks.
void findAnyIntersection(const pointField &start, const pointField &end, labelList &surfaces, List< pointIndexHit > &) const
Find any intersection. Return hit point information and.
void writeStats(const List< wordList > &, Ostream &) const
Write some stats.
bool checkNormalOrientation(const bool report) const
Are all (triangulated) surfaces consistent normal orientation.
bool checkIntersection(const scalar tol, const bool report) const
Do surfaces self-intersect or intersect others.
searchableSurfaceList(const label)
Construct with length specified. Fill later.
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.
void findNearestIntersection(const pointField &start, const pointField &end, labelList &surface1, List< pointIndexHit > &hit1, labelList &surface2, List< pointIndexHit > &hit2) const
Base class of (analytical or triangulated) surface. Encapsulates all the search routines....
static autoPtr< searchableSurface > New(const word &surfaceType, const IOobject &io, const dictionary &dict)
Return a reference to the selected searchableSurface.
static boundBox bounds(const PtrList< searchableSurface > &allSurfaces, const labelList &surfacesToTest)
Find the boundBox of the selected surfaces.
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.
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.
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.
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.
A surface geometry formed of discrete facets, e.g. triangles and/or quadrilaterals,...
virtual tmp< pointField > points() const
Get the points that define the surface.
scalar tolerance() const
Return tolerance to use in searches.
Triangulated surface description with patch information.
A class for handling words, derived from string.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
gmvFile<< "tracers "<< particles.size()<< nl;forAllConstIter(lagrangian::Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().x()<< " ";}gmvFile<< nl;forAllConstIter(lagrangian::Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().y()<< " ";}gmvFile<< nl;forAllConstIter(lagrangian::Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().z()<< " ";}gmvFile<< nl;forAll(lagrangianScalarNames, i){ word name=lagrangianScalarNames[i];IOField< scalar > s(IOobject(name, runTime.name(), lagrangian::cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
void write(const fileName &file, const word &title, const bool binary, const PointField &points, const VertexList &vertices, const LineList &lines, const FaceList &faces, const wordList &fieldNames, const boolList &fieldIsPointValues, const UPtrList< const Field< label >> &fieldLabelValues #define FieldTypeValuesConstArg(Type, nullArg))
Write VTK polygonal data to a file. Takes a PtrList of fields of labels and.
errorManipArg< error, int > exit(error &err, const int errNo=1)
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
PointIndexHit< point > pointIndexHit
Ostream & endl(Ostream &os)
Add newline and flush stream.
errorManip< error > abort(error &err)
const word & regionName(const solver ®ion)
T returnReduce(const T &Value, const BinaryOp &bop, const int tag=Pstream::msgType(), const label comm=UPstream::worldComm)
defineTypeNameAndDebug(combustionModel, 0)
layerAndWeight max(const layerAndWeight &a, const layerAndWeight &b)
triangle< point, const point & > triPointRef
label findIndex(const ListType &, typename ListType::const_reference, const label start=0)
Find first occurrence of given element and return index,.
labelList identityMap(const label len)
Create identity map (map[i] == i) of given length.
wordList patchTypes(nPatches)
scalarField samples(nIntervals, 0)