57 Info<<
"NO MATCH for source face " << srcFacei <<
endl;
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");
137 if (!isCandidate(srcFacei, tgtFacei))
142 const auto& srcPatch = this->srcPatch();
143 const auto& tgtPatch = this->tgtPatch();
145 const pointField& srcPoints = srcPatch.points();
146 const pointField& tgtPoints = tgtPatch.points();
148 const auto& srcTris = srcTris_[srcFacei];
149 const auto& tgtTris = tgtTris_[tgtFacei];
151 const auto& srcFaceNormals = srcPatch.faceNormals();
158 for (
const auto& tris : srcTris)
160 const vector& origin = srcPoints[tris[0]];
161 const vector p10(srcPoints[tris[1]] - origin);
162 const vector p20(srcPoints[tris[2]] - origin);
163 const vector axis1(p10/(
mag(p10) + ROOTVSMALL));
164 const vector axis2(srcFaceNormals[srcFacei]^axis1);
173 for (
const auto& trit : tgtTris)
178 tgtPoints[trit[0]] - origin,
179 tgtPoints[trit[2]] - origin,
180 tgtPoints[trit[1]] - origin,
195 s.interArea(t, c, da);
199 centroid += da*(origin + c.x()*axis1 + c.y()*axis2);
207 centroid /= area + ROOTVSMALL;
233 const auto& tbb = treeBb[boxi];
237 const auto& boxAddr = treeAddr[boxi];
239 for (
const auto& tgtFacei : boxAddr)
241 if (srcFaceBb.
overlaps(tgtFaceBbs[tgtFacei]))
249 return faceIds.
toc();
258 const bool reverseTarget
268 const bool requireMatch,
269 const bool reverseTarget,
270 const scalar lowWeightCorrection,
272 const bool restartUncoveredSourceFace
312 advancingFrontAMI::calculate(srcPatch, tgtPatch, surfPtr);
314 const auto& src = this->srcPatch();
315 const auto& tgt = this->tgtPatch();
317 bool validSize =
true;
324 else if (!tgt.size())
327 << src.size() <<
" source faces but no target faces" <<
endl;
332 srcCentroids_.setSize(srcAddress_.size());
347 const bool equalBinSize =
true;
348 const label maxLevel = 10;
349 const label minBinSize = 4;
359 const auto& tgtPoints = tgt.points();
363 tgtFaceBbs[facei] =
boundBox(tgtPoints, tgt[facei],
false);
368 const auto& srcPoints = src.points();
372 const face& srcFace = src[srcFacei];
375 srcFaceBb.
min() -= d;
376 srcFaceBb.
max() += d;
380 overlappingTgtFaces(tree, tgtFaceBbs, srcFaceBb)
387 for (
const label tgtFacei : tgtFaces)
401 if (mustMatchFaces() && srcAddr.
empty())
403 if (debug) writeNoMatch(srcFacei, tgtFaces, srcFaceBb);
410 srcAddress_[srcFacei].transfer(srcAddr);
411 srcWeights_[srcFacei].transfer(srcWght);
412 srcCentroids_[srcFacei].transfer(srcCtr);
415 srcNonOverlap_.transfer(nonOverlapFaces);
417 if (debug && !srcNonOverlap_.empty())
419 Pout<<
" AMI: " << srcNonOverlap_.size()
420 <<
" non-overlap faces identified"
429 tgtAddress_[i].transfer(tgtAddr[i]);
430 tgtWeights_[i].transfer(tgtWght[i]);
442 for (
labelList& addressing : srcAddress_)
444 for (label& addr : addressing)
446 addr = extendedTgtFaceIDs_[addr];
450 for (
labelList& addressing : tgtAddress_)
458 mapDistributeBase::distribute
463 extendedTgtMapPtr_->constructMap(),
465 extendedTgtMapPtr_->subMap(),
473 mapDistributeBase::distribute
478 extendedTgtMapPtr_->constructMap(),
480 extendedTgtMapPtr_->subMap(),
489 extendedTgtMapPtr_->reverseDistribute(tgtPatch0.size(), tgtMagSf_);
506 normaliseWeights(requireMatch_,
true);
508 nonConformalCorrection();
Macros for easy insertion into run-time selection tables.
#define addToRunTimeSelectionTable(baseType, thisType, argNames)
Add to construction table with typeName as the key.
Templated tree of axis-aligned bounding boxes (AABB)
const List< labelList > & addressing() const
Return the contents addressing.
const List< treeBoundBox > & boundBoxes() const
Return the bounding boxes making up the tree.
Interpolation class dealing with transfer of data between two primitive patches with an arbitrary mes...
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects.
void append(const T &val)
Copy append an element to the end of this list.
bool insert(const Key &key)
Insert a new entry, not overwriting existing entries.
List< Key > toc() const
The table of contents (the keys) in unsorted order.
Output to file stream, using an OSstream.
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Ostream & writeEntryIfDifferent(const word &key, const T &value1, const T &value2)
Write a keyword/value entry only when the two values differ.
A list of faces which address into the list of points.
bool empty() const noexcept
True if the UList is empty (ie, size() is zero)
void size(const label n)
Older name for setAddressableSize.
@ nonBlocking
"nonBlocking"
Base class for Arbitrary Mesh Interface (AMI) methods.
const primitivePatch & tgtPatch() const
Return const access to the target patch.
const primitivePatch & srcPatch() const
Return const access to the source patch.
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
A bounding box defined in terms of min/max extrema points.
bool overlaps(const boundBox &bb) const
Overlaps/touches boundingBox?
const point & min() const
Minimum describing the bounding box.
const point & max() const
Maximum describing the bounding box.
tmp< pointField > points() const
Corner points in an order corresponding to a 'hex' cell.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Face area weighted Arbitrary Mesh Interface (AMI) method that performs the intersection of src and tg...
void storeInterArea(const label srcFacei, const label tgtFacei, DynamicList< label > &srcAddr, DynamicList< scalar > &srcWght, DynamicList< vector > &srcCtr, DynamicList< label > &tgtAddr, DynamicList< scalar > &tgtWght) const
virtual bool calculate(const primitivePatch &srcPatch, const primitivePatch &tgtPatch, const autoPtr< searchableSurface > &surfPtr=nullptr)
Update addressing, weights and (optional) centroids.
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.
void writeNoMatch(const label srcFacei, const labelList &tgtFaceCandidates, const boundBox &srcFaceBb) const
A face is a list of labels corresponding to mesh vertices.
virtual bool write()
Write the output fields.
Calculates a unique integer (label so might not have enough room - 2G max) for processor + local inde...
void inplaceToGlobal(labelUList &labels) const
From local to global index (inplace)
Class containing processor-to-processor mapping information.
A class representing the concept of 1 (one) that can be used to avoid manipulating objects known to b...
Standard boundBox with extra functionality for use in octree.
label snapClosePoints(const triangle2D &triB)
static scalar relTol
Relative tolerance.
#define defineTypeNameAndDebug(Type, DebugSwitch)
Define the typeName and debug information.
OBJstream os(runTime.globalPath()/outputName)
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))
#define WarningInFunction
Report a warning using Foam::Warning.
Vector2D< scalar > vector2D
A 2D vector of scalars obtained from the generic Vector2D.
void component(FieldField< Field, typename FieldField< Field, Type >::cmptType > &sf, const FieldField< Field, Type > &f, const direction d)
messageStream Info
Information stream (stdout output on master, null elsewhere)
Ostream & endl(Ostream &os)
Add newline and flush stream.
dimensionedScalar sqrt(const dimensionedScalar &ds)
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
Type gAverage(const FieldField< Field, Type > &f)
static constexpr const zero Zero
Global zero (0)
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.
constexpr char nl
The newline '\n' character (0x0a)
#define addProfiling(name, descr)
Define profiling trigger with specified name and description string.
#define forAll(list, i)
Loop across all elements in list.
List helper to append y elements onto the end of x.
Functor to negate primitives. Dummy for most other types.