Go to the documentation of this file.
33 template<
class SourcePatch,
class TargetPatch>
36 if (debug && (!srcPatch_.size() || !tgtPatch_.size()))
38 Pout<<
"AMI: Patches not on processor: Source faces = "
39 << srcPatch_.size() <<
", target faces = " << tgtPatch_.size()
46 const scalar maxBoundsError = 0.05;
49 boundBox bbSrc(srcPatch_.points(), srcPatch_.meshPoints(),
true);
50 boundBox bbTgt(tgtPatch_.points(), tgtPatch_.meshPoints(),
true);
53 bbTgtInf.
inflate(maxBoundsError);
58 <<
"Source and target patch bounding boxes are not similar"
60 <<
" source box span : " << bbSrc.
span() <<
nl
61 <<
" target box span : " << bbTgt.
span() <<
nl
62 <<
" source box : " << bbSrc <<
nl
63 <<
" target box : " << bbTgt <<
nl
64 <<
" inflated target box : " << bbTgtInf <<
endl;
70 template<
class SourcePatch,
class TargetPatch>
85 srcAddress.
setSize(srcPatch_.size());
86 srcWeights.
setSize(srcPatch_.size());
87 tgtAddress.
setSize(tgtPatch_.size());
88 tgtWeights.
setSize(tgtPatch_.size());
91 if (!srcPatch_.size())
95 else if (!tgtPatch_.size())
98 << srcPatch_.size() <<
" source faces but no target faces" <<
endl;
107 if ((srcFaceI == -1) || (tgtFaceI == -1))
111 bool foundFace =
false;
114 tgtFaceI = findTargetFace(faceI);
128 <<
"Unable to find initial target face"
138 Pout<<
"AMI: initial target face = " << tgtFaceI <<
endl;
145 template<
class SourcePatch,
class TargetPatch>
155 static label count = 1;
160 Pout<<
"Face intersection area (" << count <<
"):" <<
nl
161 <<
" f1 face = " <<
f1 <<
nl
162 <<
" f1 pts = " << f1pts <<
nl
163 <<
" f2 face = " << f2 <<
nl
164 <<
" f2 pts = " << f2pts <<
nl
165 <<
" area = " << area
189 os<<
" " << f1pts.size() + i + 1;
191 os<<
" " << f1pts.size() + 1 <<
endl;
197 template<
class SourcePatch,
class TargetPatch>
203 treeBoundBox bb(tgtPatch_.points(), tgtPatch_.meshPoints());
206 if (!treePtr_.valid())
228 template<
class SourcePatch,
class TargetPatch>
234 label targetFaceI = -1;
236 const pointField& srcPts = srcPatch_.points();
237 const face& srcFace = srcPatch_[srcFaceI];
239 const scalar srcFaceArea = srcMagSf_[srcFaceI];
241 pointIndexHit sample = treePtr_->findNearest(srcPt, 10.0*srcFaceArea);
245 targetFaceI = sample.
index();
249 Pout<<
"Source point = " << srcPt <<
", Sample point = "
250 << sample.
hitPoint() <<
", Sample index = " << sample.
index()
259 template<
class SourcePatch,
class TargetPatch>
263 const TargetPatch& patch,
268 const labelList& nbrFaces = patch.faceFaces()[faceI];
273 label nbrFaceI = nbrFaces[i];
277 if (nbrFaceI == visitedFaces[j])
288 if (nbrFaceI == faceIDs[j])
299 const vector& n1 = patch.faceNormals()[faceI];
300 const vector& n2 = patch.faceNormals()[nbrFaceI];
302 scalar cosI = n1 & n2;
315 template<
class SourcePatch,
class TargetPatch>
318 const SourcePatch& srcPatch,
319 const TargetPatch& tgtPatch,
323 const bool reverseTarget,
324 const bool requireMatch
329 reverseTarget_(reverseTarget),
330 requireMatch_(requireMatch),
340 template<
class SourcePatch,
class TargetPatch>
347 template<
class SourcePatch,
class TargetPatch>
label index() const
Return index.
#define forAll(list, i)
Loop across all elements in list.
void writeOBJ(Ostream &os, label &vertI, const tetPoints &tet)
void inflate(const scalar s)
Inflate box by factor*mag(span) in all dimensions.
Standard boundBox + extra functionality for use in octree.
point centre(const pointField &) const
Centre point of face.
bool hit() const
Is there a hit.
Unit conversion functions.
void writeIntersectionOBJ(const scalar area, const face &f1, const face &f2, const pointField &f1Points, const pointField &f2Points) const
Write triangle intersection to OBJ file.
Ostream & endl(Ostream &os)
Add newline and flush stream.
virtual bool conformal() const
Flag to indicate that interpolation patches are conformal.
AMIMethod(const AMIMethod &)
Disallow default bitwise copy construct.
void checkPatches() const
Check AMI patch coupling.
vector span() const
The bounding box span (from minimum to maximum)
This class describes the interaction of (usually) a face and a point. It carries the info of a succes...
void appendNbrFaces(const label faceI, const TargetPatch &patch, const DynamicList< label > &visitedFaces, DynamicList< label > &faceIDs) const
Add faces neighbouring faceI to the ID list.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Pre-declare SubField and related Field type.
bool initialise(labelListList &srcAddress, scalarListList &srcWeights, labelListList &tgtAddress, scalarListList &tgtWeights, label &srcFaceI, label &tgtFaceI)
Initialise and return true if all ok.
const Point & hitPoint() const
Return hit point.
Non-pointer based hierarchical recursive searching.
errorManip< error > abort(error &err)
pointField points(const pointField &) const
Return the points corresponding to this face.
DynamicList< T, SizeInc, SizeMult, SizeDiv > & append(const T &)
Append an element at the end of the list.
void setSize(const label)
Reset size of List.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
prefixOSstream Pout(cout, "Pout")
label findTargetFace(const label srcFaceI) const
Find face on target patch that overlaps source face.
bool contains(const point &) const
Contains point? (inside or on edge)
Encapsulation of data needed to search on PrimitivePatches.
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
void resetTree()
Reset the octree for the target patch face search.
A bounding box defined in terms of the points at its extremities.
A face is a list of labels corresponding to mesh vertices.
virtual ~AMIMethod()
Destructor.
#define WarningInFunction
Report a warning using Foam::Warning.
word name(const complex &)
Return a string representation of a complex.
scalar degToRad(const scalar deg)
Conversion from degrees to radians.
dimensionedScalar cos(const dimensionedScalar &ds)