Go to the documentation of this file.
57 Info<<
"NO MATCH for source face " << srcFacei <<
endl;
59 const auto& src = this->srcPatch();
60 const auto& tgt = this->tgtPatch();
70 const face& srcF = src[srcFacei];
72 for (
const label pointi : srcF)
74 const point&
p = srcPoints[pointi];
75 os <<
"v " <<
p.x() <<
" " <<
p.y() <<
" " <<
p.z() <<
nl;
79 os << faceStr.c_str() <<
" " << (np - srcF.size() + 1) <<
nl;
82 for (
const label tgtFacei : tgtFaceCandidates)
84 const face& tgtF = tgt[tgtFacei];
87 const point&
p = tgtPoints[tgtF[pointi]];
88 os <<
"v " <<
p.x() <<
" " <<
p.y() <<
" " <<
p.z() <<
nl;
92 os <<
"l " << np-1 <<
" " << np <<
nl;
95 os <<
"l " << (np - tgtF.size() + 1) <<
" " << np <<
nl;
105 os <<
"v " <<
p.x() <<
" " <<
p.y() <<
" " <<
p.z() <<
endl;
125 const label srcFacei,
126 const label tgtFacei,
134 addProfiling(ami,
"faceAreaWeightAMI2D::calcInterArea");
139 (srcMagSf_[srcFacei] < ROOTVSMALL)
140 || (tgtMagSf_[tgtFacei] < ROOTVSMALL)
146 const auto& srcPatch = this->srcPatch();
147 const auto& tgtPatch = this->tgtPatch();
152 const auto& srcTris = srcTris_[srcFacei];
153 const auto& tgtTris = tgtTris_[tgtFacei];
155 const auto& srcFaceNormals = srcPatch.
faceNormals();
162 for (
const auto& tris : srcTris)
164 const vector& origin = srcPoints[tris[0]];
165 const vector p10(srcPoints[tris[1]] - origin);
166 const vector p20(srcPoints[tris[2]] - origin);
167 const vector axis1(p10/(
mag(p10) + ROOTVSMALL));
168 const vector axis2(srcFaceNormals[srcFacei]^axis1);
177 for (
const auto& trit : tgtTris)
182 tgtPoints[trit[0]] - origin,
183 tgtPoints[trit[2]] - origin,
184 tgtPoints[trit[1]] - origin,
199 s.interArea(t,
c, da);
203 centroid += da*(origin +
c.x()*axis1 +
c.y()*axis2);
209 if (
area/srcMagSf_[srcFacei] > triangle2D::relTol)
211 centroid /=
area + ROOTVSMALL;
237 const auto& tbb = treeBb[boxi];
241 const auto& boxAddr = treeAddr[boxi];
243 for (
const auto& tgtFacei : boxAddr)
245 if (srcFaceBb.
overlaps(tgtFaceBbs[tgtFacei]))
253 return faceIds.toc();
262 const bool reverseTarget
266 Cbb_(
dict.getCheckOrDefault<scalar>(
"Cbb", 0.1, scalarMinMax::ge(SMALL)))
272 const bool requireMatch,
273 const bool reverseTarget,
274 const scalar lowWeightCorrection,
276 const bool restartUncoveredSourceFace
316 advancingFrontAMI::calculate(srcPatch, tgtPatch, surfPtr);
318 const auto& src = this->srcPatch();
319 const auto& tgt = this->tgtPatch();
321 bool validSize =
true;
328 else if (!tgt.size())
331 << src.size() <<
" source faces but no target faces" <<
endl;
336 srcCentroids_.setSize(srcAddress_.size());
346 const vector d(lf*vector::one);
351 const bool equalBinSize =
true;
352 const label maxLevel = 10;
353 const label minBinSize = 4;
363 const auto& tgtPoints = tgt.points();
367 tgtFaceBbs[facei] =
boundBox(tgtPoints, tgt[facei],
false);
372 const auto& srcPoints = src.points();
376 const face& srcFace = src[srcFacei];
379 srcFaceBb.
min() -= d;
380 srcFaceBb.
max() += d;
384 overlappingTgtFaces(tree, tgtFaceBbs, srcFaceBb)
391 for (
const label tgtFacei : tgtFaces)
405 if (mustMatchFaces() && srcAddr.empty())
407 if (
debug) writeNoMatch(srcFacei, tgtFaces, srcFaceBb);
414 srcAddress_[srcFacei].transfer(srcAddr);
415 srcWeights_[srcFacei].transfer(srcWght);
416 srcCentroids_[srcFacei].transfer(srcCtr);
419 srcNonOverlap_.transfer(nonOverlapFaces);
421 if (
debug && !srcNonOverlap_.empty())
423 Pout<<
" AMI: " << srcNonOverlap_.size()
424 <<
" non-overlap faces identified"
433 tgtAddress_[i].transfer(tgtAddr[i]);
434 tgtWeights_[i].transfer(tgtWght[i]);
446 for (
labelList& addressing : srcAddress_)
448 for (label& addr : addressing)
450 addr = extendedTgtFaceIDs_[addr];
454 for (
labelList& addressing : tgtAddress_)
462 mapDistributeBase::distribute
464 Pstream::commsTypes::nonBlocking,
467 extendedTgtMapPtr_->constructMap(),
469 extendedTgtMapPtr_->subMap(),
477 mapDistributeBase::distribute
479 Pstream::commsTypes::nonBlocking,
482 extendedTgtMapPtr_->constructMap(),
484 extendedTgtMapPtr_->subMap(),
493 extendedTgtMapPtr_->reverseDistribute(tgtPatch0.size(), tgtMagSf_);
510 normaliseWeights(requireMatch_,
true);
512 nonConformalCorrection();
int debug
Static debugging option.
const Field< point_type > & points() const noexcept
Return reference to global points.
addToRunTimeSelectionTable(decompositionMethod, kahipDecomp, dictionary)
List< label > labelList
A List of labels.
List< scalar > scalarList
A List of scalars.
void component(FieldField< Field, typename FieldField< Field, Type >::cmptType > &sf, const FieldField< Field, Type > &f, const direction d)
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))
static constexpr const zero Zero
Global zero (0)
Type gAverage(const FieldField< Field, Type > &f)
Standard boundBox with extra functionality for use in octree.
const List< treeBoundBox > & boundBoxes() const
Return the bounding boxes making up the tree.
void storeInterArea(const label srcFacei, const label tgtFacei, DynamicList< label > &srcAddr, DynamicList< scalar > &srcWght, DynamicList< vector > &srcCtr, DynamicList< label > &tgtAddr, DynamicList< scalar > &tgtWght) const
Face area weighted Arbitrary Mesh Interface (AMI) method that performs the intersection of src and tg...
Ostream & endl(Ostream &os)
Add newline and flush stream.
void inplaceToGlobal(labelList &labels) const
From local to global index (inplace)
const point & max() const
Maximum describing the bounding box.
prefixOSstream Pout
OSstream wrapped stdout (std::cout) with parallel prefix.
const point & min() const
Minimum describing the bounding box.
#define forAll(list, i)
Loop across all elements in list.
bool overlaps(const boundBox &bb) const
Overlaps/touches boundingBox?
faceAreaWeightAMI2D(const dictionary &dict, const bool reverseTarget=false)
Construct from dictionary.
void writeNoMatch(const label srcFacei, const labelList &tgtFaceCandidates, const boundBox &srcFaceBb) const
messageStream Info
Information stream (stdout output on master, null elsewhere)
DynamicList< T, SizeMin > & append(const T &val)
Append an element to the end of this list.
Class containing processor-to-processor mapping information.
virtual void write(Ostream &os) const
Write.
virtual bool calculate(const primitivePatch &srcPatch, const primitivePatch &tgtPatch, const autoPtr< searchableSurface > &surfPtr=nullptr)
Update addressing, weights and (optional) centroids.
#define addProfiling(name, descr)
Define profiling trigger with specified name and description string.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
OBJstream os(runTime.globalPath()/outputName)
Macros for easy insertion into run-time selection tables.
Calculates a unique integer (label so might not have enough room - 2G max) for processor + local inde...
Output to file stream, using an OSstream.
labelList overlappingTgtFaces(const AABBTree< face > &tree, const List< boundBox > &tgtFaceBbs, const boundBox &srcFaceBb) const
Return the set of tgt face IDs that overlap the src face bb.
List helper to append y elements onto the end of x.
scalar Cbb_
Face bounding box factor.
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
virtual void write(Ostream &os) const
Write.
const List< labelList > & addressing() const
Return the contents addressing.
Vector2D< scalar > vector2D
A 2D vector of scalars obtained from the generic Vector2D.
Templated tree of axis-aligned bounding boxes (AABB)
dimensionedScalar sqrt(const dimensionedScalar &ds)
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
bool insert(const Key &key)
Insert a new entry, not overwriting existing entries.
Base class for Arbitrary Mesh Interface (AMI) methods.
const Field< point_type > & faceNormals() const
Return face unit normals for patch.
label snapClosePoints(const triangle2D &triB)
const wordList area
Standard area field types (scalar, vector, tensor, etc)
A bounding box defined in terms of min/max extrema points.
const dimensionedScalar c
Speed of light in a vacuum.
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for INVALID.
A face is a list of labels corresponding to mesh vertices.
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
tmp< pointField > points() const
Corner points in an order corresponding to a 'hex' cell.
defineTypeNameAndDebug(combustionModel, 0)
#define WarningInFunction
Report a warning using Foam::Warning.
A list of faces which address into the list of points.
Functor to negate primitives. Dummy for most other types.