40 void Foam::directAMI::appendToDirectSeeds
44 DynamicList<label>& srcSeeds,
45 DynamicList<label>& nonOverlapFaces,
50 const labelList& srcNbr = this->srcPatch_.faceFaces()[srcFacei];
51 const labelList& tgtNbr = this->tgtPatch_.faceFaces()[tgtFacei];
53 const pointField& srcPoints = this->srcPatch_.points();
54 const pointField& tgtPoints = this->tgtPatch_.points();
56 const vectorField& srcCf = this->srcPatch_.faceCentres();
60 label srcI = srcNbr[i];
62 if ((mapFlag[srcI] == 0) && (srcTgtSeed[srcI] == -1))
65 const face& srcF = this->srcPatch_[srcI];
66 const point& srcC = srcCf[srcI];
71 const point& p = srcPoints[srcF[fpI]];
72 scalar d2 =
magSqr(p - srcC);
78 tol =
max(small, 0.0001*
sqrt(tol));
83 label tgtI = tgtNbr[j];
84 const face& tgtF = this->tgtPatch_[tgtI];
87 if (
mag(srcC - tgtC) < tol)
92 srcTgtSeed[srcI] = tgtI;
93 srcSeeds.append(srcI);
102 const vector srcN = srcF.area(srcPoints);
106 label tgtI = tgtNbr[j];
107 const face& tgtF = this->tgtPatch_[tgtI];
108 pointHit ray = tgtF.ray(srcCf[srcI], srcN, tgtPoints);
115 srcTgtSeed[srcI] = tgtI;
116 srcSeeds.append(srcI);
127 nonOverlapFaces.append(srcI);
131 Pout<<
"source face not found: id=" << srcI
132 <<
" centre=" << srcCf[srcI]
133 <<
" area=" << srcF.area(srcPoints)
134 <<
" points=" << srcF.points(srcPoints)
137 Pout<<
"target neighbours:" <<
nl;
140 label tgtI = tgtNbr[j];
141 const face& tgtF = this->tgtPatch_[tgtI];
143 Pout<<
"face id: " << tgtI
144 <<
" centre=" << tgtF.centre(tgtPoints)
145 <<
" area=" << tgtF.area(tgtPoints)
146 <<
" points=" << tgtF.points(tgtPoints)
156 srcFacei = srcSeeds.remove();
157 tgtFacei = srcTgtSeed[srcFacei];
167 void Foam::directAMI::restartAdvancingFront
170 DynamicList<label>& nonOverlapFaces,
177 if (mapFlag[facei] == 0)
179 tgtFacei = this->findTargetFace(facei);
184 nonOverlapFaces.append(facei);
205 const bool reverseTarget,
206 const bool requireMatch
269 labelList srcTgtSeed(srcAddr.size(), -1);
270 srcTgtSeed[srcFacei] = tgtFacei;
280 srcAddr[srcFacei].
append(tgtFacei);
281 tgtAddr[tgtFacei].append(srcFacei);
283 mapFlag[srcFacei] = 1;
298 if (srcFacei < 0 && nTested < this->srcPatch_.size())
300 restartAdvancingFront(mapFlag, nonOverlapFaces, srcFacei, tgtFacei);
303 }
while (srcFacei >= 0);
305 if (nonOverlapFaces.
size() != 0)
307 Pout<<
" AMI: " << nonOverlapFaces.
size()
308 <<
" non-overlap faces identified" 311 this->srcNonOverlap_.transfer(nonOverlapFaces);
#define forAll(list, i)
Loop across all elements in list.
layerAndWeight max(const layerAndWeight &a, const layerAndWeight &b)
FvWallInfoData< WallInfo, label > label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
void size(const label)
Override size to be inconsistent with allocated storage.
dimensionedScalar sqrt(const dimensionedScalar &ds)
Ostream & endl(Ostream &os)
Add newline and flush stream.
Vector< scalar > vector
A scalar version of the templated Vector.
Macros for easy insertion into run-time selection tables.
directAMI(const primitivePatch &srcPatch, const primitivePatch &tgtPatch, const scalarField &srcMagSf, const scalarField &tgtMagSf, const faceAreaIntersect::triangulationMode &triMode, const bool reverseTarget=false, const bool requireMatch=true)
Construct from components.
const Vector< Cmpt > & centre(const Foam::List< Vector< Cmpt >> &) const
Return *this (used for point which is a typedef to Vector<scalar>.
A list of faces which address into the list of points.
vectorField pointField
pointField is a vectorField.
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects...
List< scalar > scalarList
A List of scalars.
DynamicList< T, SizeInc, SizeMult, SizeDiv > & append(const T &)
Append an element at the end of the list.
List< label > labelList
A List of labels.
virtual void calculate(labelListList &srcAddress, scalarListList &srcWeights, labelListList &tgtAddress, scalarListList &tgtWeights, label srcFacei=-1, label tgtFacei=-1)
Update addressing and weights.
Base class for Arbitrary Mesh Interface (AMI) methods.
dimensioned< scalar > magSqr(const dimensioned< Type > &)
virtual ~directAMI()
Destructor.
addToRunTimeSelectionTable(ensightPart, ensightPartCells, istream)
defineTypeNameAndDebug(combustionModel, 0)
vector point
Point is a vector.
prefixOSstream Pout(cout, "Pout")
dimensioned< scalar > mag(const dimensioned< Type > &)
Field< vector > vectorField
Specialisation of Field<T> for vector.
PointHit< point > pointHit
void transfer(List< T > &)
Transfer the contents of the argument List into this list.