40 Foam::isoSurfacePoint::adaptPatchFields
59 auto& sliceFld = tslice.ref();
65 auto& sliceFldBf = sliceFld.boundaryFieldRef();
73 isA<emptyPolyPatch>(
pp)
74 &&
pp.size() != sliceFldBf[patchi].size()
80 sliceFldBf.release(patchi);
86 mesh.boundary()[patchi],
94 mesh.boundary()[patchi].patch().faceCells();
103 else if (isA<cyclicPolyPatch>(
pp))
107 else if (isA<processorPolyPatch>(
pp))
118 mesh.weights().boundaryField()[patchi]
123 collocatedFaces(refCast<const processorPolyPatch>(
pp))
128 if (!isCollocated[i])
140 Type Foam::isoSurfacePoint::generatePoint
153 const scalar d = s1-s0;
157 const scalar
s = (iso_-s0)/d;
159 if (hasSnap1 &&
s >= 0.5 &&
s <= 1)
163 else if (hasSnap0 &&
s >= 0.0 &&
s <= 0.5)
169 return s*p1 + (1.0-
s)*
p0;
174 constexpr scalar
s = 0.4999;
176 return s*p1 + (1.0-
s)*
p0;
182 void Foam::isoSurfacePoint::generateTriPoints
204 DynamicList<Type>&
pts 240 generatePoint(s0,
p0,hasSnap0,snapP0,s1,p1,hasSnap1,snapP1)
244 generatePoint(s0,
p0,hasSnap0,snapP0,s2,p2,hasSnap2,snapP2)
248 generatePoint(s0,
p0,hasSnap0,snapP0,s3,p3,hasSnap3,snapP3)
250 if (triIndex == 0x0E)
254 std::swap(
pts[sz-2],
pts[sz-1]);
264 generatePoint(s1,p1,hasSnap1,snapP1,s0,
p0,hasSnap0,snapP0)
268 generatePoint(s1,p1,hasSnap1,snapP1,s3,p3,hasSnap3,snapP3)
272 generatePoint(s1,p1,hasSnap1,snapP1,s2,p2,hasSnap2,snapP2)
274 if (triIndex == 0x0D)
278 std::swap(
pts[sz-2],
pts[sz-1]);
287 generatePoint(s0,
p0,hasSnap0,snapP0,s2,p2,hasSnap2,snapP2);
289 generatePoint(s1,p1,hasSnap1,snapP1,s3,p3,hasSnap3,snapP3);
293 generatePoint(s0,
p0,hasSnap0,snapP0,s3,p3,hasSnap3,snapP3)
301 generatePoint(s1,p1,hasSnap1,snapP1,s2,p2,hasSnap2,snapP2)
305 if (triIndex == 0x0C)
309 std::swap(
pts[sz-5],
pts[sz-4]);
310 std::swap(
pts[sz-2],
pts[sz-1]);
320 generatePoint(s2,p2,hasSnap2,snapP2,s0,
p0,hasSnap0,snapP0)
324 generatePoint(s2,p2,hasSnap2,snapP2,s1,p1,hasSnap1,snapP1)
328 generatePoint(s2,p2,hasSnap2,snapP2,s3,p3,hasSnap3,snapP3)
331 if (triIndex == 0x0B)
335 std::swap(
pts[sz-2],
pts[sz-1]);
344 generatePoint(s0,
p0,hasSnap0,snapP0,s1,p1,hasSnap1,snapP1);
346 generatePoint(s2,p2,hasSnap2,snapP2,s3,p3,hasSnap3,snapP3);
352 generatePoint(s0,
p0,hasSnap0,snapP0,s3,p3,hasSnap3,snapP3)
358 generatePoint(s1,p1,hasSnap1,snapP1,s2,p2,hasSnap2,snapP2)
362 if (triIndex == 0x0A)
366 std::swap(
pts[sz-5],
pts[sz-4]);
367 std::swap(
pts[sz-2],
pts[sz-1]);
376 generatePoint(s0,
p0,hasSnap0,snapP0,s1,p1,hasSnap1,snapP1);
378 generatePoint(s2,p2,hasSnap2,snapP2,s3,p3,hasSnap3,snapP3);
383 generatePoint(s1,p1,hasSnap1,snapP1,s3,p3,hasSnap3,snapP3)
391 generatePoint(s0,
p0,hasSnap0,snapP0,s2,p2,hasSnap2,snapP2)
394 if (triIndex == 0x09)
398 std::swap(
pts[sz-5],
pts[sz-4]);
399 std::swap(
pts[sz-2],
pts[sz-1]);
409 generatePoint(s3,p3,hasSnap3,snapP3,s0,
p0,hasSnap0,snapP0)
413 generatePoint(s3,p3,hasSnap3,snapP3,s2,p2,hasSnap2,snapP2)
417 generatePoint(s3,p3,hasSnap3,snapP3,s1,p1,hasSnap1,snapP1)
420 if (triIndex == 0x07)
424 std::swap(
pts[sz-2],
pts[sz-1]);
433 Foam::label Foam::isoSurfacePoint::generateFaceTriPoints
438 const VolumeField<Type>& cCoords,
439 const Field<Type>& pCoords,
441 const DynamicList<Type>& snappedPoints,
448 const bool hasNeiSnap,
449 const Type& neiSnapPt,
451 DynamicList<Type>& triPoints,
452 DynamicList<label>& triMeshCells
455 const label own = mesh_.faceOwner()[facei];
457 label oldNPoints = triPoints.
size();
459 const face&
f = mesh_.faces()[facei];
463 label pointi =
f[fp];
470 snappedPoint[pointi] != -1,
472 snappedPoint[pointi] != -1
473 ? snappedPoints[snappedPoint[pointi]]
479 snappedPoint[nextPointi] != -1,
481 snappedPoint[nextPointi] != -1
482 ? snappedPoints[snappedPoint[nextPointi]]
488 snappedCc[own] != -1,
491 ? snappedPoints[snappedCc[own]]
505 label nTris = (triPoints.size()-oldNPoints)/3;
506 for (label i = 0; i < nTris; i++)
508 triMeshCells.append(own);
516 void Foam::isoSurfacePoint::generateTriPoints
521 const VolumeField<Type>& cCoords,
522 const Field<Type>& pCoords,
524 const DynamicList<Type>& snappedPoints,
528 DynamicList<Type>& triPoints,
529 DynamicList<label>& triMeshCells
532 const polyBoundaryMesh&
patches = mesh_.boundaryMesh();
533 const labelList& own = mesh_.faceOwner();
534 const labelList& nei = mesh_.faceNeighbour();
538 (cVals.size() != mesh_.nCells())
539 || (pVals.size() != mesh_.nPoints())
540 || (cCoords.size() != mesh_.nCells())
541 || (pCoords.size() != mesh_.nPoints())
542 || (snappedCc.size() != mesh_.nCells())
543 || (snappedPoint.size() != mesh_.nPoints())
547 <<
"Incorrect size." <<
endl 548 <<
"mesh: nCells:" << mesh_.nCells()
549 <<
" points:" << mesh_.nPoints() <<
endl 550 <<
"cVals:" << cVals.size() <<
endl 551 <<
"cCoords:" << cCoords.size() <<
endl 552 <<
"snappedCc:" << snappedCc.size() <<
endl 553 <<
"pVals:" << pVals.size() <<
endl 554 <<
"pCoords:" << pCoords.size() <<
endl 555 <<
"snappedPoint:" << snappedPoint.size() <<
endl 563 triMeshCells.clear();
565 for (label facei = 0; facei < mesh_.nInternalFaces(); ++facei)
567 if ((faceCutType_[facei] & cutType::ANYCUT) != 0)
569 generateFaceTriPoints
584 snappedCc[nei[facei]] != -1,
586 snappedCc[nei[facei]] != -1
587 ? snappedPoints[snappedCc[nei[facei]]]
599 boolList neiSnapped(mesh_.nBoundaryFaces(),
false);
600 List<Type> neiSnappedPoint(neiSnapped.size(), Type(
Zero));
605 label facei =
pp.start();
608 label bFacei = facei-mesh_.nInternalFaces();
609 label snappedIndex = snappedCc[own[facei]];
611 if (snappedIndex != -1)
613 neiSnapped[bFacei] =
true;
614 neiSnappedPoint[bFacei] = snappedPoints[snappedIndex];
628 if (isA<processorPolyPatch>(
pp))
630 const processorPolyPatch& cpp =
631 refCast<const processorPolyPatch>(
pp);
633 bitSet isCollocated(collocatedFaces(cpp));
637 const label facei =
pp.start()+i;
639 if ((faceCutType_[facei] & cutType::ANYCUT) != 0)
643 generateFaceTriPoints
656 cVals.boundaryField()[patchi][i],
657 cCoords.boundaryField()[patchi][i],
658 neiSnapped[facei-mesh_.nInternalFaces()],
659 neiSnappedPoint[facei-mesh_.nInternalFaces()],
667 generateFaceTriPoints
680 cVals.boundaryField()[patchi][i],
681 cCoords.boundaryField()[patchi][i],
694 label facei =
pp.start();
698 if ((faceCutType_[facei] & cutType::ANYCUT) != 0)
700 generateFaceTriPoints
713 cVals.boundaryField()[patchi][i],
714 cCoords.boundaryField()[patchi][i],
728 triMeshCells.shrink();
734 Foam::isoSurfacePoint::interpolate
746 auto&
values = tvalues.ref();
755 label mergedPointi = triPointMergeMap[i];
757 if (mergedPointi >= 0)
759 values[mergedPointi] += unmergedValues[i];
760 nValues[mergedPointi]++;
768 values[i] /= scalar(nValues[i]);
776 forAll(interpolatedPoints, i)
778 label pointi = interpolatedPoints[i];
779 const FixedList<label, 3>& oldPoints = interpolatedOldPoints[i];
780 const FixedList<scalar, 3>& w = interpolationWeights[i];
787 values[pointi] = w[j]*unmergedValues[oldPoints[j]];
797 Foam::isoSurfacePoint::interpolateTemplate
813 labelList snappedPoint(mesh_.nPoints(), -1);
836 interpolatedOldPoints_,
837 interpolationWeights_,
void size(const label n)
Older name for setAddressableSize.
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
void append(const T &val)
Append an element at the end of the list.
bool interpolate(const vector &p1, const vector &p2, const vector &o, vector &n, scalar l)
const dimensionedScalar c2
Second radiation constant: default SI units: [m.K].
Ostream & endl(Ostream &os)
Add newline and flush stream.
tmp< DimensionedField< TypeR, GeoMesh > > New(const tmp< DimensionedField< TypeR, GeoMesh >> &tf1, const word &name, const dimensionSet &dimensions, const bool initCopy=false)
Global function forwards to reuseTmpDimensionedField::New.
Abstract base class with a fat-interface to all derived classes covering all possible ways in which t...
Generic GeometricField class.
Ignore writing from objectRegistry::writeObject()
Smooth ATC in cells next to a set of patches supplied by type.
Abstract base class for interpolating in 1D.
#define forAll(list, i)
Loop across all elements in list.
label fcIndex(const label i) const noexcept
The forward circular index. The next index in the list which returns to the first at the end of the l...
GeometricField< scalar, fvPatchField, volMesh > volScalarField
List< T > values(const HashTable< T, Key, Hash > &tbl, const bool doSort=false)
List of values from HashTable, optionally sorted.
void setSize(const label n)
Alias for resize()
Generic templated field type.
const polyBoundaryMesh & boundaryMesh() const noexcept
Return boundary mesh.
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
virtual tmp< Field< Type > > patchNeighbourField() const
Return patchField on the opposite patch of a coupled patch.
Triangle point storage. Default constructable (triangle is not)
This boundary condition is not designed to be evaluated; it is assumed that the value is assigned via...
const polyMesh & mesh() const noexcept
The mesh for which the iso-surface is associated.
errorManip< error > abort(error &err)
A polyBoundaryMesh is a polyPatch list with additional search methods and registered IO...
virtual tmp< Field< Type > > patchInternalField() const
Return internal field next to patch.
dimensioned< Type > lerp(const dimensioned< Type > &a, const dimensioned< Type > &b, const scalar t)
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;for(const word &name :lagrangianScalarNames){ IOField< scalar > fld(IOobject(name, runTime.timeName(), cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
A bitSet stores bits (elements with only two states) in packed internal format and supports a variety...
Mesh data needed to do the Finite Volume discretisation.
const polyBoundaryMesh & patches
List< label > labelList
A List of labels.
A class for managing temporary objects.
A patch is a list of labels that address the faces in the global face list.
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))
Defines the attributes of an object for which implicit objectRegistry management is supported...
List< bool > boolList
A List of bools.
Do not request registration (bool: false)
const volScalarField & p0
uindirectPrimitivePatch pp(UIndirectList< face >(mesh.faces(), faceLabels), mesh.points())
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.
static constexpr const zero Zero
Global zero (0)