Go to the documentation of this file.
62 return voxel.
x()+voxel.
y()*nDivs.
x()+voxel.
z()*nDivs.
x()*nDivs.
y();
72 const label nxy = nDivs.
x()*nDivs.
y();
75 voxel.
z() = voxeli/nxy;
76 voxeli = voxeli % nxy;
77 voxel.
y() = voxeli/nDivs.
x();
78 voxel.
x() = voxeli%nDivs.
x();
95 floor((pt.
x()-bb.
min().
x())/
s.x()),
96 floor((pt.
y()-bb.
min().
y())/
s.y()),
97 floor((pt.
z()-bb.
min().
z())/
s.z())
116 floor((pt.
x()-bb.
min().
x())/
s.x()),
117 floor((pt.
y()-bb.
min().
y())/
s.y()),
118 floor((pt.
z()-bb.
min().
z())/
s.z())
123 v[0] =
max(0,
min(
g[0]-1, v[0]));
124 v[1] =
max(0,
min(
g[1]-1, v[1]));
125 v[2] =
max(0,
min(
g[2]-1, v[2]));
153 return bb.min()+0.5*
s+
point(voxel[0]*
s[0], voxel[1]*
s[1], voxel[2]*
s[2]);
166 for (label i = 1; i <
g[0]; i++)
168 for (label j = 0; j <
g[1]; j++)
170 for (label
k = 0;
k <
g[2];
k++)
178 for (label i = 0; i <
g[0]; i++)
180 for (label j = 1; j <
g[1]; j++)
182 for (label
k = 0;
k <
g[2];
k++)
190 for (label i = 0; i <
g[0]; i++)
192 for (label j = 0; j <
g[1]; j++)
194 for (label
k = 1;
k <
g[2];
k++)
205 Foam::label Foam::voxelMeshSearch::searchProcPatch
208 const point& searchPoint
211 const pointField& cellCentres = mesh_.cellCentres();
212 const polyBoundaryMesh& bMeshes = mesh_.boundaryMesh();
214 label patchi = bMeshes.
patchID()[faceID-mesh_.nInternalFaces()];
215 const polyPatch& bMeshPatch = bMeshes[patchi];
217 if (!isA<processorPolyPatch>(bMeshPatch))
225 const labelUList& faceCells = bMeshPatch.faceCells();
226 scalar minProximity = GREAT;
228 label nearestCellI = -1;
231 const point& cc = cellCentres[faceCells[i]];
232 scalar proximity =
magSqr(cc-searchPoint);
233 if (proximity < minProximity)
235 minProximity = proximity;
236 nearestCellI = faceCells[i];
244 Foam::label Foam::voxelMeshSearch::findIntersectedFace
253 const faceList& faces = mesh_.faces();
254 const pointField& faceCentres = mesh_.faceCentres();
257 const point& cc = mesh_.cellCentres()[cellI];
258 const labelList& cFaces = mesh_.cells()[cellI];
264 label facei = cFaces[cFacei];
266 pointHit hitInfo = faces[facei].intersection
275 if (hitInfo.hit() && (hitInfo.distance() < 1))
324 localBb_ = boundBox(mesh_.
points(),
false);
326 const point eps(1
e-10, 1
e-10, 1
e-10);
328 localBb_.
min() = localBb_.
min()-eps;
329 localBb_.
max() = localBb_.
max()+eps;
333 Pout<<
"voxelMeshSearch : mesh:" << mesh_.
name()
334 <<
" nDivs:" << nDivs_ <<
endl;
346 const polyMesh&
mesh,
347 const boundBox& localBb,
379 const labelList& cPoints = cellPoints[celli];
382 boundBox bb(
points, cPoints,
false);
384 fill(seedCell_, localBb_, nDivs_, bb, celli);
390 Pout<<
"voxelMeshSearch : mesh:" << mesh_.
name()
391 <<
" nDivs:" << nDivs_
392 <<
" localBb:" << localBb_ <<
endl;
412 if (!localBb_.contains(
p))
419 label voxeli = index(localBb_, nDivs_,
p,
false);
429 label celli = seedCell_[voxeli];
445 if (track_.size() < 5)
447 track_.append(celli);
451 label facei = findIntersectedFace(celli,
p);
458 const label startOfTrack(
max(0, track_.size()-5));
461 if (mesh_.isInternalFace(facei))
463 label own = mesh_.faceOwner()[facei];
464 label nei = mesh_.faceNeighbour()[facei];
465 nextCell = (own == celli ? nei : own);
467 if (track_.found(nextCell, startOfTrack))
474 nextCell = searchProcPatch(facei,
p);
476 if (nextCell == -1 || nextCell == celli)
480 else if (track_.found(nextCell, startOfTrack))
524 faceList faces(
b.boundaryPatches()[patchi].size());
527 faces[facei] = face(
b.boundaryPatches()[patchi][facei]);
547 patchDict.add(
"type", emptyPolyPatch::typeName);
569 emptyPolyPatch::typeName,
static autoPtr< T > New(Args &&... args)
List< label > labelList
A List of labels.
vectorField pointField
pointField is a vectorField.
virtual const pointField & points() const
Defines the attributes of an object for which implicit objectRegistry management is supported,...
Creates a single block of cells from point coordinates, numbers of cells in each direction and an exp...
virtual bool write(const bool valid=true) const
const point & max() const
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))
OFstream that keeps track of vertices.
A polyBoundaryMesh is a polyPatch list with additional search methods and registered IO.
voxelMeshSearch(const polyMesh &, const bool doUpdate=true)
const labelVector & nDivs() const
label nGeometricD() const
static label index(const labelVector &nDivs, const labelVector &voxel)
label findCell(const point &) const
List< cellShape > cellShapeList
List of cellShapes and PtrList of List of cellShape.
Cmpt cmptProduct(const VectorSpace< Form, Cmpt, Ncmpts > &vs)
const polyBoundaryMesh & boundaryMesh() const
Ostream & endl(Ostream &os)
static void writeGrid(OBJstream &, const boundBox &, const labelVector &)
virtual Ostream & write(const char c)
const Vector< label > & geometricD() const
label min(const labelHashSet &set, label minValue=labelMax)
Mesh consisting of general polyhedral cells.
dimensioned< typename typeOfMag< Type >::type > magSqr(const dimensioned< Type > &dt)
Vector< label > labelVector
Vector of labels.
List< word > wordList
A List of words.
PtrList< blockEdge > blockEdgeList
A PtrList of blockEdges.
const labelList & patchID() const
label nCells() const noexcept
pointField points(const UList< point > &meshPoints) const
const dimensionedScalar b
Generic templated field type.
A patch is a list of labels that address the faces in the global face list.
virtual const fileName & name() const
void setSize(const label n)
void transfer(List< T > &list)
A list of pointers to objects of type <T>, with allocation/deallocation management of the pointers....
wordList patchNames(nPatches)
const point & min() const
static const cellModel & ref(const modelType model)
label max(const labelHashSet &set, label maxValue=labelMin)
Info<< "Creating cells"<< endl;cellShapes=b.shapes();Info<< "Creating boundary faces"<< endl;boundary.setSize(b.boundaryPatches().size());forAll(boundary, patchi) { faceList faces(b.boundaryPatches()[patchi].size());forAll(faces, facei) { faces[facei]=face(b.boundaryPatches()[patchi][facei]);} boundary[patchi].transfer(faces);} points.transfer(const_cast< pointField & >b.points()));}Info<< "Creating patch dictionaries"<< endl;wordList patchNames(boundary.size());forAll(patchNames, patchi){ patchNames[patchi]=polyPatch::defaultName(patchi);}PtrList< dictionary > boundaryDicts(boundary.size())
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
PointHit< point > pointHit
A PointIndexHit for 3D points.
OBJstream os(runTime.globalPath()/outputName)
An analytical geometric cellShape.
const uniformDimensionedVectorField & g
const labelUList & faceCells() const
Vector< scalar > vector
A scalar version of the templated Vector.
autoPtr< fvMesh > makeMesh(const IOobject &) const
IOstream & hex(IOstream &io)
readOption readOpt() const noexcept
dimensioned< Type > cmptDivide(const dimensioned< Type > &, const dimensioned< Type > &)
PtrList< blockFace > blockFaceList
A PtrList of blockFaces.
const word & name() const noexcept
List< labelList > labelListList
A List of labelList.
const vectorField & cellCentres() const
line< point, const point & > linePointRef
A line using referred points.
Fast, non-parallel searching in mesh without use of octree.
List< faceList > faceListList
A List of faceList.
dimensionSet clip(const dimensionSet &ds1, const dimensionSet &ds2)
List< face > faceList
A List of faces.
label nInternalFaces() const noexcept
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
dimensionedScalar sqrt(const dimensionedScalar &ds)
static labelVector offset(const labelVector &nDivs)
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
const dimensionedScalar e
labelList identity(const label len, label start=0)
A bounding box defined in terms of min/max extrema points.
entry * add(entry *entryPtr, bool mergeEntry=false)
A face is a list of labels corresponding to mesh vertices.
Maps a geometry to a set of cell primitives.
vector point
Point is a vector.
static const UList< T > & null()
UList< label > labelUList
A UList of labels.
static point centre(const boundBox &bb, const labelVector &nDivs, const labelVector &voxel)
static word defaultName(const label n=-1)
dimensionedScalar cbrt(const dimensionedScalar &ds)
static labelVector index3(const labelVector &nDivs, const label voxeli)
defineTypeNameAndDebug(combustionModel, 0)
const objectRegistry & db() const noexcept