64 auto fnd = facesPerEdge.
find(
e);
67 label&
count = fnd.val();
77 <<
"Incorrect matched edge " << fnd.key()
103 Pout<<
"triSurfaceMesh::isSurfaceClosed:"
104 <<
" determining closedness for surface with "
214 for (
const auto&
f : ts)
219 const bool okFace = addFaceToEdge(
f.edge(fp), facesPerEdge);
225 Pout<<
"triSurfaceMesh::isSurfaceClosed :"
226 <<
" surface is non-manifold" <<
endl;
235 bool haveWarned =
false;
238 if (iter.val() != 2 && iter.val() != -1)
242 Pout<<
"triSurfaceMesh::isSurfaceClosed :"
243 <<
" surface is open" <<
endl;
252 if (iter.val() == -1)
259 <<
" is closed but has inconsistent face orientation"
261 <<
" at edge " << pts[iter.key().first()]
262 << pts[iter.key().second()]
264 <<
" This means it probably cannot be used"
265 <<
" for inside/outside queries."
266 <<
" Suppressing further messages." <<
endl;
276 Pout<<
"triSurfaceMesh::isSurfaceClosed :"
277 <<
" surface is closed" <<
endl;
383 scalar scaleFactor{0};
387 <<
" : using scale " << scaleFactor <<
endl;
398 <<
" : ignoring triangles with quality < "
442 Pout<<
"triSurfaceMesh(const IOobject& io) :"
445 <<
" from:" << actualFile <<
endl;
453 if (r ==
masterOnly && (actualFile != localFile))
464 Pout<<
"triSurfaceMesh(const IOobject& io) :"
475 Pout<<
"triSurfaceMesh(const IOobject& io) :"
487 Pout<<
"triSurfaceMesh(const IOobject& io) :"
557 Pout<<
"triSurfaceMesh(const IOobject& io, const dictionary&) :"
560 <<
" from:" << actualFile <<
endl;
569 if (r ==
masterOnly && (actualFile != localFile))
575 triSurface s2(actualFile, surfType, scaleFactor);
581 Pout<<
"triSurfaceMesh(const IOobject& io) :"
588 triSurface s2(actualFile, surfType, scaleFactor);
592 Pout<<
"triSurfaceMesh(const IOobject& io) :"
600 triSurface s2(actualFile, surfType, scaleFactor);
604 Pout<<
"triSurfaceMesh(const IOobject& io) :"
615 <<
" : using scale " << scaleFactor <<
endl;
627 <<
" : ignoring triangles with quality < "
655 auto& pts = tpts.ref();
694 const point& fc = centres[facei];
695 for (
const label pointi :
f)
697 const point& pt = pts[pointi];
719 return !indices.
empty();
727 Pout<<
"triSurfaceMesh::movePoints :"
738 const label
event = getEvent();
750 Pout<<
"triSurfaceMesh::movePoints: finished moving points" <<
endl;
762 Pout<<
"triSurfaceMesh::edgeTree :"
763 <<
" constructing tree for " <<
nEdges() - nInternalEdges()
764 <<
" boundary edges" <<
endl;
778 PatchTools::calcBounds
799 Pout<<
"triSurfaceMesh::edgeTree : "
800 <<
"calculating edge tree for bb:" << bb <<
endl;
828 Pout<<
"triSurfaceMesh::edgeTree :"
829 <<
" finished constructing tree for "
830 <<
nEdges() - nInternalEdges()
831 <<
" boundary edges" <<
endl;
841 if (regions_.empty())
855 if (surfaceClosed_ == -1)
857 if (isSurfaceClosed())
867 return surfaceClosed_ == 1;
876 const point outsidePt(bounds().
max() + 0.5*bounds().span());
880 Pout<<
"triSurfaceMesh::outsideVolumeType :"
881 <<
" triggering outsidePoint:" << outsidePt
882 <<
" orientation" <<
endl;
889 getVolumeType(
pointField(1, outsidePt), outsideVolTypes);
890 outsideVolType_ = outsideVolTypes[0];
894 Pout<<
"triSurfaceMesh::outsideVolumeType :"
895 <<
" finished outsidePoint:" << outsidePt
901 return outsideVolType_;
914 Pout<<
"triSurfaceMesh::findNearest :"
915 <<
" trying to find nearest for " <<
samples.
size()
916 <<
" samples with max sphere "
923 Pout<<
"triSurfaceMesh::findNearest :"
924 <<
" finished trying to find nearest for " <<
samples.
size()
925 <<
" samples" <<
endl;
940 Pout<<
"triSurfaceMesh::findNearest :"
941 <<
" trying to find nearest and region for " <<
samples.
size()
942 <<
" samples with max sphere "
955 Pout<<
"triSurfaceMesh::findNearest :"
956 <<
" finished trying to find nearest and region for "
971 Pout<<
"triSurfaceMesh::findLine :"
972 <<
" intersecting with "
978 Pout<<
"triSurfaceMesh::findLine :"
979 <<
" finished intersecting with "
994 Pout<<
"triSurfaceMesh::findLineAny :"
995 <<
" intersecting with "
1001 Pout<<
"triSurfaceMesh::findLineAny :"
1002 <<
" finished intersecting with "
1003 << start.
size() <<
" rays" <<
endl;
1017 Pout<<
"triSurfaceMesh::findLineAll :"
1018 <<
" intersecting with "
1019 << start.
size() <<
" rays" <<
endl;
1024 Pout<<
"triSurfaceMesh::findLineAll :"
1025 <<
" finished intersecting with "
1026 << start.
size() <<
" rays" <<
endl;
1039 Pout<<
"triSurfaceMesh::getRegion :"
1040 <<
" getting region for "
1041 << info.
size() <<
" triangles" <<
endl;
1057 Pout<<
"triSurfaceMesh::getRegion :"
1058 <<
" finished getting region for "
1059 << info.
size() <<
" triangles" <<
endl;
1072 Pout<<
"triSurfaceMesh::getNormal :"
1073 <<
" getting normal for "
1074 << info.
size() <<
" triangles" <<
endl;
1082 if (minQuality_ >= 0)
1093 const label facei = info[i].index();
1094 normal[i] =
s[facei].unitNormal(pts);
1096 scalar qual =
s[facei].tri(pts).quality();
1098 if (qual < minQuality_)
1101 const labelList& fFaces = faceFaces[facei];
1103 for (
const label nbri : fFaces)
1105 scalar nbrQual =
s[nbri].tri(pts).quality();
1109 normal[i] =
s[nbri].unitNormal(pts);
1127 const label facei = info[i].index();
1130 normal[i] =
s[facei].unitNormal(pts);
1141 Pout<<
"triSurfaceMesh::getNormal :"
1142 <<
" finished getting normal for "
1143 << info.
size() <<
" triangles" <<
endl;
1150 auto* fldPtr = getObjectPtr<triSurfaceLabelField>(
"values");
1154 (*fldPtr).field() = values;
1179 Pout<<
"triSurfaceMesh::setField :"
1180 <<
" finished setting field for "
1181 << values.size() <<
" triangles" <<
endl;
1192 const auto* fldPtr = getObjectPtr<triSurfaceLabelField>(
"values");
1196 const auto&
fld = *fldPtr;
1198 values.setSize(info.
size());
1204 values[i] =
fld[info[i].index()];
1210 Pout<<
"triSurfaceMesh::setField :"
1211 <<
" finished getting field for "
1212 << info.
size() <<
" triangles" <<
endl;
1228 Pout<<
"triSurfaceMesh::getVolumeType :"
1229 <<
" finding orientation for " <<
points.
size()
1230 <<
" samples" <<
endl;
1239 if (tree().bb().contains(pt))
1242 volType[pointi] = tree().getVolumeType(pt);
1244 else if (hasVolumeType())
1249 outsideVolType_ = tree().shapes().getVolumeType(tree(), pt);
1251 volType[pointi] = outsideVolType_;
1256 volType[pointi] = tree().shapes().getVolumeType(tree(), pt);
1263 Pout<<
"triSurfaceMesh::getVolumeType :"
1264 <<
" finished finding orientation for " <<
points.
size()
1265 <<
" samples" <<
endl;
1288 const_cast<triSurfaceMesh&
>(*this).searchableSurface::instance() =
Macros for easy insertion into run-time selection tables.
#define addToRunTimeSelectionTable(baseType, thisType, argNames)
Add to construction table with typeName as the key.
Info<< nl<< "Wrote faMesh in vtk format: "<< writer.output().name()<< nl;}{ vtk::lineWriter writer(aMesh.points(), aMesh.edges(), fileName(aMesh.mesh().time().globalPath()/"finiteArea-edges"));writer.writeGeometry();writer.beginCellData(4);writer.writeProcIDs();{ Field< scalar > fld(faMeshTools::flattenEdgeField(aMesh.magLe(), true))
Map from edge (expressed as its endpoints) to value. For easier forward declaration it is currently i...
bool insert(const Key &key, const T &obj)
Copy insert a new entry, not overwriting existing entries.
iterator find(const Key &key)
Find and return an iterator set at the hashed entry.
Defines the attributes of an object for which implicit objectRegistry management is supported,...
const word & name() const noexcept
Return the object name.
readOption readOpt() const noexcept
The read option.
fileName globalFilePath(const word &typeName, const bool search=true) const
Helper for filePath that searches up if in parallel.
fileName localFilePath(const word &typeName, const bool search=true) const
Helper for filePath that searches locally.
const fileName & instance() const noexcept
Read access to instance path component.
fileName objectPath() const
The complete path + object name.
The IOstreamOption is a simple container for options an IOstream can normally have.
void setSize(const label n)
Alias for resize()
int overlaps
Flag to control which overlap calculations are performed.
A list of faces which address into the list of points.
const Field< point_type > & faceCentres() const
Return face centres for patch.
static void scatter(const List< commsStruct > &comms, T &value, const int tag, const label comm)
Broadcast data: Distribute without modification.
A List obtained as a section of another List.
const word & system() const
Return system name.
fileName caseConstant() const
fileName caseSystem() const
const word & constant() const
Return constant name.
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
static autoPtr< Time > New()
Construct (dummy) Time - no functionObjects or libraries.
static word timeName(const scalar t, const int precision=precision_)
bool empty() const noexcept
True if the UList is empty (ie, size() is zero)
void size(const label n)
Older name for setAddressableSize.
static bool & parRun() noexcept
Test if this a parallel run.
A bounding box defined in terms of min/max extrema points.
const point & min() const
Minimum describing the bounding box.
const point & max() const
Maximum describing the bounding box.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
T getOrDefault(const word &keyword, const T &deflt, enum keyType::option matchOpt=keyType::REGEX) const
bool readIfPresent(const word &keyword, T &val, enum keyType::option matchOpt=keyType::REGEX) const
An edge is a list of two point labels. The functionality it provides supports the discretisation on a...
static int compare(const edge &a, const edge &b)
Compare edges.
label operator[](const label i) const
Processor-local element id from linear-list of addresses.
A class for handling file names.
static std::string path(const std::string &str)
Return directory path name (part before last /)
static bool isAbsolute(const std::string &str)
virtual bool write()
Write the output fields.
scalar time
Injection time - set at collection [s].
Non-pointer based hierarchical recursive searching.
static scalar & perturbTol()
Get the perturbation tolerance.
A triFace with additional (region) index.
void movePoints()
Update for new mesh geometry.
Registry of regIOobjects.
const Time & time() const noexcept
Return time registry.
label count(const char *clsName) const
The number of objects of the given class name.
const vectorField & faceCentres() const
bool hasFaceCentres() const noexcept
label eventNo() const noexcept
Event number at last update.
transferModelList & transfer()
Transfer.
Base class of (analytical or triangulated) surface. Encapsulates all the search routines....
virtual const boundBox & bounds() const
Return const reference to boundBox.
splitCell * master() const
string & expand(const bool allowEmpty=false)
A class for managing temporary objects.
Standard boundBox with extra functionality for use in octree.
treeBoundBox extend(Random &rndGen, const scalar s) const
Return slightly wider bounding box.
Holds data for octree to work on an edges subset.
IOoject and searching on triSurface.
virtual ~triSurfaceMesh()
Destructor.
virtual void findLine(const pointField &start, const pointField &end, List< pointIndexHit > &) const
Find first intersection on segment from start to end.
virtual void findLineAll(const pointField &start, const pointField &end, List< List< pointIndexHit > > &) const
Get all intersections in order from start to end.
const indexedOctree< treeDataEdge > & edgeTree() const
Demand driven construction of octree for boundary edges.
virtual void findLineAny(const pointField &start, const pointField &end, List< pointIndexHit > &) const
Return any intersection on segment from start to end.
virtual void boundingSpheres(pointField ¢res, scalarField &radiusSqr) const
Get bounding spheres (centre and radius squared). Any point.
virtual void getVolumeType(const pointField &points, List< volumeType > &volType) const
Determine type (inside/outside/mixed) for point.
scalar minQuality_
Optional min triangle quality. Triangles below this get.
virtual void setField(const labelList &values)
WIP. Store element-wise field.
virtual void getField(const List< pointIndexHit > &, labelList &) const
WIP. From a set of hits (points and.
virtual bool writeObject(IOstreamOption streamOpt, const bool valid) const
Write using stream options.
virtual void getNormal(const List< pointIndexHit > &, vectorField &normal) const
From a set of points and indices get the normal.
fileName fName_
Supplied fileName override.
virtual void getRegion(const List< pointIndexHit > &, labelList ®ion) const
From a set of points and indices get the region.
virtual const wordList & regions() const
Names of regions.
virtual bool hasVolumeType() const
Whether supports volume type (below) - i.e. whether is closed.
bool isSurfaceClosed() const
Check whether surface is closed without calculating any permanent.
virtual void findNearest(const pointField &sample, const scalarField &nearestDistSqr, List< pointIndexHit > &) const
virtual tmp< pointField > coordinates() const
Get representative set of element coordinates.
static word meshSubDir
Return the mesh sub-directory name (usually "triSurface")
virtual volumeType outsideVolumeType() const
If surface is closed, what is type of points outside bounds.
static bool addFaceToEdge(const edge &, EdgeMap< label > &)
Helper function for isSurfaceClosed.
void clearOut()
Clear storage.
virtual tmp< pointField > points() const
Get the points that define the surface.
Helper class to search on triSurface. Creates an octree for each region of the surface and only searc...
void findNearest(const pointField &samples, const scalarField &nearestDistSqr, const labelList ®ionIndices, List< pointIndexHit > &info) const
Find the nearest point on the surface out of the regions.
void clearOut()
Clear storage.
void findLineAll(const pointField &start, const pointField &end, List< List< pointIndexHit > > &info) const
Calculate all intersections from start to end.
void findLine(const pointField &start, const pointField &end, List< pointIndexHit > &info) const
void findLineAny(const pointField &start, const pointField &end, List< pointIndexHit > &info) const
void findNearest(const pointField &samples, const scalarField &nearestDistSqr, List< pointIndexHit > &info) const
Triangulated surface description with patch information.
const geometricSurfacePatchList & patches() const noexcept
static fileName relativeFilePath(const IOobject &io, const fileName &f, const bool isGlobal=true)
Return fileName.
An enumeration wrapper for classification of a location as being inside/outside of a volume.
static const Enum< volumeType::type > names
Names for the classification enumeration.
A class for handling words, derived from Foam::string.
#define defineTypeNameAndDebug(Type, DebugSwitch)
Define the typeName and debug information.
const polyBoundaryMesh & patches
PtrList< coordinateSystem > coordinates(solidRegions.size())
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
const labelList nEdges(UPstream::listGatherValues< label >(aMesh.nEdges()))
gmvFile<< "tracers "<< particles.size()<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().x()<< " ";}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().y()<< " ";}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.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))
IOobject io("surfaceFilmProperties", mesh.time().constant(), mesh, IOobject::READ_IF_PRESENT, IOobject::NO_WRITE, false)
#define WarningInFunction
Report a warning using Foam::Warning.
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
Foam::DimensionedField< label, triSurfaceGeoMesh > triSurfaceLabelField
const dimensionSet dimless
Dimensionless.
labelList identity(const label len, label start=0)
Return an identity map of the given length with (map[i] == i)
dimensionedSymmTensor sqr(const dimensionedVector &dv)
bool mkDir(const fileName &pathName, mode_t mode=0777)
Make a directory and return an error if it could not be created.
messageStream Info
Information stream (stdout output on master, null elsewhere)
vectorField pointField
pointField is a vectorField.
Ostream & endl(Ostream &os)
Add newline and flush stream.
dimensionedScalar sqrt(const dimensionedScalar &ds)
Field< label > labelField
Specialisation of Field<T> for label.
static constexpr const zero Zero
Global zero (0)
bool isFile(const fileName &name, const bool checkGzip=true, const bool followLink=true)
Does the name exist as a FILE in the file system?
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for INVALID.
prefixOSstream Pout
OSstream wrapped stdout (std::cout) with parallel prefix.
errorManipArg< error, int > exit(error &err, const int errNo=1)
dimensioned< typename typeOfMag< Type >::type > magSqr(const dimensioned< Type > &dt)
constexpr char nl
The newline '\n' character (0x0a)
#define forAll(list, i)
Loop across all elements in list.
#define forAllConstIters(container, iter)
Iterate across all elements of the container object with const access.
scalarField samples(nIntervals, Zero)