40Foam::isoSurfacePoint::adaptPatchFields
59 auto& sliceFld = tslice.ref();
65 auto& sliceFldBf = sliceFld.boundaryFieldRef();
73 isA<emptyPolyPatch>(pp)
74 && pp.size() != sliceFldBf[patchi].size()
78 sliceFldBf.
set(patchi,
nullptr);
86 mesh.boundary()[patchi],
94 mesh.boundary()[patchi].patch().faceCells();
103 else if (isA<cyclicPolyPatch>(pp))
107 else if (isA<processorPolyPatch>(pp))
122 collocatedFaces(refCast<const processorPolyPatch>(pp))
127 if (!isCollocated[i])
139Type Foam::isoSurfacePoint::generatePoint
152 const scalar d = s1-s0;
156 const scalar
s = (iso_-s0)/d;
158 if (hasSnap1 &&
s >= 0.5 &&
s <= 1)
162 else if (hasSnap0 &&
s >= 0.0 &&
s <= 0.5)
168 return s*p1 + (1.0-
s)*
p0;
173 constexpr scalar
s = 0.4999;
175 return s*p1 + (1.0-
s)*
p0;
181void Foam::isoSurfacePoint::generateTriPoints
203 DynamicList<Type>& pts
239 generatePoint(s0,
p0,hasSnap0,snapP0,s1,p1,hasSnap1,snapP1)
243 generatePoint(s0,
p0,hasSnap0,snapP0,s2,p2,hasSnap2,snapP2)
247 generatePoint(s0,
p0,hasSnap0,snapP0,s3,p3,hasSnap3,snapP3)
249 if (triIndex == 0x0E)
252 const label sz = pts.size();
253 std::swap(pts[sz-2], pts[sz-1]);
263 generatePoint(s1,p1,hasSnap1,snapP1,s0,
p0,hasSnap0,snapP0)
267 generatePoint(s1,p1,hasSnap1,snapP1,s3,p3,hasSnap3,snapP3)
271 generatePoint(s1,p1,hasSnap1,snapP1,s2,p2,hasSnap2,snapP2)
273 if (triIndex == 0x0D)
276 const label sz = pts.size();
277 std::swap(pts[sz-2], pts[sz-1]);
286 generatePoint(s0,
p0,hasSnap0,snapP0,s2,p2,hasSnap2,snapP2);
288 generatePoint(s1,p1,hasSnap1,snapP1,s3,p3,hasSnap3,snapP3);
292 generatePoint(s0,
p0,hasSnap0,snapP0,s3,p3,hasSnap3,snapP3)
300 generatePoint(s1,p1,hasSnap1,snapP1,s2,p2,hasSnap2,snapP2)
304 if (triIndex == 0x0C)
307 const label sz = pts.size();
308 std::swap(pts[sz-5], pts[sz-4]);
309 std::swap(pts[sz-2], pts[sz-1]);
319 generatePoint(s2,p2,hasSnap2,snapP2,s0,
p0,hasSnap0,snapP0)
323 generatePoint(s2,p2,hasSnap2,snapP2,s1,p1,hasSnap1,snapP1)
327 generatePoint(s2,p2,hasSnap2,snapP2,s3,p3,hasSnap3,snapP3)
330 if (triIndex == 0x0B)
333 const label sz = pts.size();
334 std::swap(pts[sz-2], pts[sz-1]);
343 generatePoint(s0,
p0,hasSnap0,snapP0,s1,p1,hasSnap1,snapP1);
345 generatePoint(s2,p2,hasSnap2,snapP2,s3,p3,hasSnap3,snapP3);
351 generatePoint(s0,
p0,hasSnap0,snapP0,s3,p3,hasSnap3,snapP3)
357 generatePoint(s1,p1,hasSnap1,snapP1,s2,p2,hasSnap2,snapP2)
361 if (triIndex == 0x0A)
364 const label sz = pts.size();
365 std::swap(pts[sz-5], pts[sz-4]);
366 std::swap(pts[sz-2], pts[sz-1]);
375 generatePoint(s0,
p0,hasSnap0,snapP0,s1,p1,hasSnap1,snapP1);
377 generatePoint(s2,p2,hasSnap2,snapP2,s3,p3,hasSnap3,snapP3);
382 generatePoint(s1,p1,hasSnap1,snapP1,s3,p3,hasSnap3,snapP3)
390 generatePoint(s0,
p0,hasSnap0,snapP0,s2,p2,hasSnap2,snapP2)
393 if (triIndex == 0x09)
396 const label sz = pts.size();
397 std::swap(pts[sz-5], pts[sz-4]);
398 std::swap(pts[sz-2], pts[sz-1]);
408 generatePoint(s3,p3,hasSnap3,snapP3,s0,
p0,hasSnap0,snapP0)
412 generatePoint(s3,p3,hasSnap3,snapP3,s2,p2,hasSnap2,snapP2)
416 generatePoint(s3,p3,hasSnap3,snapP3,s1,p1,hasSnap1,snapP1)
419 if (triIndex == 0x07)
422 const label sz = pts.size();
423 std::swap(pts[sz-2], pts[sz-1]);
432Foam::label Foam::isoSurfacePoint::generateFaceTriPoints
447 const bool hasNeiSnap,
448 const Type& neiSnapPt,
454 const label own = mesh_.faceOwner()[facei];
458 const face&
f = mesh_.faces()[facei];
462 label pointi =
f[fp];
469 snappedPoint[pointi] != -1,
471 snappedPoint[pointi] != -1
472 ? snappedPoints[snappedPoint[pointi]]
478 snappedPoint[nextPointi] != -1,
480 snappedPoint[nextPointi] != -1
481 ? snappedPoints[snappedPoint[nextPointi]]
487 snappedCc[own] != -1,
490 ? snappedPoints[snappedCc[own]]
505 for (label i = 0; i < nTris; i++)
515void Foam::isoSurfacePoint::generateTriPoints
532 const labelList& own = mesh_.faceOwner();
533 const labelList& nei = mesh_.faceNeighbour();
537 (cVals.
size() != mesh_.nCells())
538 || (pVals.
size() != mesh_.nPoints())
539 || (cCoords.
size() != mesh_.nCells())
540 || (pCoords.
size() != mesh_.nPoints())
541 || (snappedCc.
size() != mesh_.nCells())
542 || (snappedPoint.
size() != mesh_.nPoints())
546 <<
"Incorrect size." <<
endl
547 <<
"mesh: nCells:" << mesh_.nCells()
548 <<
" points:" << mesh_.nPoints() <<
endl
550 <<
"cCoords:" << cCoords.
size() <<
endl
551 <<
"snappedCc:" << snappedCc.
size() <<
endl
553 <<
"pCoords:" << pCoords.
size() <<
endl
554 <<
"snappedPoint:" << snappedPoint.
size() <<
endl
562 triMeshCells.
clear();
564 for (label facei = 0; facei < mesh_.nInternalFaces(); ++facei)
566 if ((faceCutType_[facei] & cutType::ANYCUT) != 0)
568 generateFaceTriPoints
583 snappedCc[nei[facei]] != -1,
585 snappedCc[nei[facei]] != -1
586 ? snappedPoints[snappedCc[nei[facei]]]
598 boolList neiSnapped(mesh_.nBoundaryFaces(),
false);
599 List<Type> neiSnappedPoint(neiSnapped.size(), Type(
Zero));
600 for (
const polyPatch& pp :
patches)
604 label facei = pp.start();
607 label bFacei = facei-mesh_.nInternalFaces();
608 label snappedIndex = snappedCc[own[facei]];
610 if (snappedIndex != -1)
612 neiSnapped[bFacei] =
true;
613 neiSnappedPoint[bFacei] = snappedPoints[snappedIndex];
625 const polyPatch& pp =
patches[patchi];
627 if (isA<processorPolyPatch>(pp))
629 const processorPolyPatch& cpp =
630 refCast<const processorPolyPatch>(pp);
632 bitSet isCollocated(collocatedFaces(cpp));
636 const label facei = pp.start()+i;
638 if ((faceCutType_[facei] & cutType::ANYCUT) != 0)
642 generateFaceTriPoints
657 neiSnapped[facei-mesh_.nInternalFaces()],
658 neiSnappedPoint[facei-mesh_.nInternalFaces()],
666 generateFaceTriPoints
693 label facei = pp.start();
697 if ((faceCutType_[facei] & cutType::ANYCUT) != 0)
699 generateFaceTriPoints
745 auto& values = tvalues.ref();
754 label mergedPointi = triPointMergeMap[i];
756 if (mergedPointi >= 0)
758 values[mergedPointi] += unmergedValues[i];
759 nValues[mergedPointi]++;
767 values[i] /= scalar(nValues[i]);
775 forAll(interpolatedPoints, i)
777 label pointi = interpolatedPoints[i];
783 values[pointi] = Type(
Zero);
786 values[pointi] = w[j]*unmergedValues[oldPoints[j]];
796Foam::isoSurfacePoint::interpolateTemplate
812 labelList snappedPoint(mesh_.nPoints(), -1);
835 interpolatedOldPoints_,
836 interpolationWeights_,
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))
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects.
void clear() noexcept
Clear the addressed list, i.e. set the size to zero.
DynamicList< T, SizeMin > & shrink()
Shrink the allocated space to the number of elements used.
void append(const T &val)
Copy append an element to the end of this list.
Generic templated field type.
A 1D vector of objects of type <T> with a fixed length <N>.
static constexpr label size() noexcept
Return the number of elements in the FixedList.
Generic GeometricField class.
const Boundary & boundaryField() const
Return const-reference to the boundary field.
Defines the attributes of an object for which implicit objectRegistry management is supported,...
void setSize(const label n)
Alias for resize()
const T * set(const label i) const
void size(const label n)
Older name for setAddressableSize.
label fcIndex(const label i) const noexcept
A bitSet stores bits (elements with only two states) in packed internal format and supports a variety...
This boundary condition is not designed to be evaluated; it is assmued that the value is assigned via...
Smooth ATC in cells next to a set of patches supplied by type.
A face is a list of labels corresponding to mesh vertices.
Mesh data needed to do the Finite Volume discretisation.
Abstract base class with a fat-interface to all derived classes covering all possible ways in which t...
virtual tmp< Field< Type > > patchNeighbourField() const
Return patchField on the opposite patch of a coupled patch.
virtual tmp< Field< Type > > patchInternalField() const
Return internal field next to patch as patch field.
Abstract base class for interpolating in 1D.
static autoPtr< isoSurfaceBase > New(const isoSurfaceParams ¶ms, const volScalarField &cellValues, const scalarField &pointValues, const scalar iso, const bitSet &ignoreCells=bitSet())
Create for specified algorithm type.
const polyMesh & mesh() const noexcept
The mesh for which the iso-surface is associated.
A polyBoundaryMesh is a polyPatch list with additional search methods and registered IO.
const polyBoundaryMesh & boundaryMesh() const
Return boundary mesh.
A patch is a list of labels that address the faces in the global face list.
bool interpolate() const noexcept
Same as isPointData()
A class for managing temporary objects.
Triangle storage. Null constructable (unfortunately triangle<point, point> is not)
const volScalarField & p0
const polyBoundaryMesh & patches
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
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))
Ostream & endl(Ostream &os)
Add newline and flush stream.
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
errorManip< error > abort(error &err)
List< bool > boolList
A List of bools.
static constexpr const zero Zero
Global zero (0)
bool interpolate(const vector &p1, const vector &p2, const vector &o, vector &n, scalar l)
tmp< DimensionedField< TypeR, GeoMesh > > New(const tmp< DimensionedField< TypeR, GeoMesh > > &tdf1, const word &name, const dimensionSet &dimensions)
Global function forwards to reuseTmpDimensionedField::New.
#define forAll(list, i)
Loop across all elements in list.