44 if (debug && (!srcPatch_.size() || !tgtPatch_.size()))
46 Pout<<
"AMI: Patches not on processor: Source faces = " 47 << srcPatch_.size() <<
", target faces = " << tgtPatch_.size()
54 const scalar maxBoundsError = 0.05;
57 boundBox bbSrc(srcPatch_.points(), srcPatch_.meshPoints(),
true);
58 boundBox bbTgt(tgtPatch_.points(), tgtPatch_.meshPoints(),
true);
61 bbTgtInf.inflate(maxBoundsError);
63 if (!bbTgtInf.contains(bbSrc))
66 <<
"Source and target patch bounding boxes are not similar" 68 <<
" source box span : " << bbSrc.span() <<
nl 69 <<
" target box span : " << bbTgt.span() <<
nl 70 <<
" source box : " << bbSrc <<
nl 71 <<
" target box : " << bbTgt <<
nl 72 <<
" inflated target box : " << bbTgtInf <<
endl;
92 srcAddress.
setSize(srcPatch_.size());
93 srcWeights.
setSize(srcPatch_.size());
94 tgtAddress.
setSize(tgtPatch_.size());
95 tgtWeights.
setSize(tgtPatch_.size());
98 if (!srcPatch_.size())
102 else if (!tgtPatch_.size())
105 << srcPatch_.size() <<
" source faces but no target faces" <<
endl;
114 if ((srcFacei == -1) || (tgtFacei == -1))
118 bool foundFace =
false;
121 tgtFacei = findTargetFace(facei);
135 <<
"Unable to find initial target face" 145 Pout<<
"AMI: initial target face = " << tgtFacei <<
endl;
166 Pout<<
"Face intersection area (" << count <<
"):" <<
nl 167 <<
" f1 face = " << f1 <<
nl 168 <<
" f1 pts = " << f1pts <<
nl 169 <<
" f2 face = " << f2 <<
nl 170 <<
" f2 pts = " << f2pts <<
nl 171 <<
" area = " << area
195 os<<
" " << f1pts.
size() + i + 1;
197 os<<
" " << f1pts.
size() + 1 <<
endl;
208 treeBoundBox bb(tgtPatch_.points(), tgtPatch_.meshPoints());
211 if (!treePtr_.valid())
238 label targetFacei = -1;
240 const pointField& srcPts = srcPatch_.points();
241 const face& srcFace = srcPatch_[srcFacei];
243 const scalar srcFaceArea = srcMagSf_[srcFacei];
245 pointIndexHit sample = treePtr_->findNearest(srcPt, 10.0*srcFaceArea);
249 targetFacei = sample.
index();
253 Pout<<
"Source point = " << srcPt <<
", Sample point = " 254 << sample.
hitPoint() <<
", Sample index = " << sample.
index()
276 label nbrFacei = nbrFaces[i];
280 if (nbrFacei == visitedFaces[j])
291 if (nbrFacei == faceIDs[j])
305 scalar cosI = n1 & n2;
307 if (cosI >
cos(maxWalkAngle()))
331 const bool reverseTarget,
332 const bool requireMatch
337 reverseTarget_(reverseTarget),
338 requireMatch_(requireMatch),
#define forAll(list, i)
Loop across all elements in list.
A face is a list of labels corresponding to mesh vertices.
virtual ~AMIMethod()
Destructor.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Unit conversion functions.
AMIMethod(const primitivePatch &srcPatch, const primitivePatch &tgtPatch, const scalarField &srcMagSf, const scalarField &tgtMagSf, const faceAreaIntersect::triangulationMode &triMode, const bool reverseTarget, const bool requireMatch)
Construct from components.
void size(const label)
Override size to be inconsistent with allocated storage.
Ostream & endl(Ostream &os)
Add newline and flush stream.
label count(const ListType &l, typename ListType::const_reference x)
Count the number of occurrences of a value in a list.
A bounding box defined in terms of the points at its extremities.
This class describes the interaction of (usually) a face and a point. It carries the info of a succes...
label findTargetFace(const label srcFacei) const
Find face on target patch that overlaps source face.
scalar degToRad(const scalar deg)
Conversion from degrees to radians.
A list of faces which address into the list of points.
const Point & hitPoint() const
Return hit point.
const labelListList & faceFaces() const
Return face-face addressing.
dimensionedScalar cos(const dimensionedScalar &ds)
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects...
Encapsulation of data needed to search on PrimitivePatches.
virtual bool conformal() const
Flag to indicate that interpolation patches are conformal.
DynamicList< T, SizeInc, SizeMult, SizeDiv > & append(const T &)
Append an element at the end of the list.
bool hit() const
Is there a hit.
void resetTree()
Reset the octree for the target patch face search.
pointField points(const pointField &) const
Return the points corresponding to this face.
const Field< PointType > & faceNormals() const
Return face normals for patch.
errorManip< error > abort(error &err)
void checkPatches() const
Check AMI patch coupling.
void inflate(const scalar s)
Inflate box by factor*mag(span) in all dimensions.
defineRunTimeSelectionTable(reactionRateFlameArea, dictionary)
static vector centre(const PointField &ps)
Return centre point given face points.
defineTypeNameAndDebug(combustionModel, 0)
word name(const complex &)
Return a string representation of a complex.
void setSize(const label)
Reset size of List.
Non-pointer based hierarchical recursive searching.
void appendNbrFaces(const label facei, const primitivePatch &patch, const DynamicList< label > &visitedFaces, DynamicList< label > &faceIDs) const
Add faces neighbouring facei to the ID list.
#define WarningInFunction
Report a warning using Foam::Warning.
bool initialise(labelListList &srcAddress, scalarListList &srcWeights, labelListList &tgtAddress, scalarListList &tgtWeights, label &srcFacei, label &tgtFacei)
Initialise and return true if all ok.
prefixOSstream Pout(cout, "Pout")
Standard boundBox + extra functionality for use in octree.
virtual scalar maxWalkAngle() const
The maximum edge angle that the walk will cross.
label index() const
Return index.
void writeIntersectionOBJ(const scalar area, const face &f1, const face &f2, const pointField &f1Points, const pointField &f2Points) const
Write triangle intersection to OBJ file.