GIT: Initial state after latest Foundation merge

This commit is contained in:
Andrew Heather
2016-09-20 14:49:08 +01:00
4571 changed files with 115696 additions and 74609 deletions

View File

@ -185,13 +185,13 @@ void Foam::AMIInterpolation<SourcePatch, TargetPatch>::normaliseWeights
wghtSum.setSize(wght.size(), 0.0);
label nLowWeight = 0;
forAll(wght, faceI)
forAll(wght, facei)
{
scalarList& w = wght[faceI];
scalarList& w = wght[facei];
if (w.size())
{
scalar denom = patchAreas[faceI];
scalar denom = patchAreas[facei];
scalar s = sum(w);
scalar t = s/denom;
@ -206,7 +206,7 @@ void Foam::AMIInterpolation<SourcePatch, TargetPatch>::normaliseWeights
w[i] /= denom;
}
wghtSum[faceI] = t;
wghtSum[facei] = t;
if (t < lowWeightTol)
{
@ -215,7 +215,7 @@ void Foam::AMIInterpolation<SourcePatch, TargetPatch>::normaliseWeights
}
else
{
wghtSum[faceI] = 0;
wghtSum[facei] = 0;
}
}
@ -283,10 +283,10 @@ void Foam::AMIInterpolation<SourcePatch, TargetPatch>::agglomerate
// Agglomerate face areas
{
srcMagSf.setSize(sourceRestrictAddressing.size(), 0.0);
forAll(sourceRestrictAddressing, faceI)
forAll(sourceRestrictAddressing, facei)
{
label coarseFaceI = sourceRestrictAddressing[faceI];
srcMagSf[coarseFaceI] += fineSrcMagSf[faceI];
label coarseFacei = sourceRestrictAddressing[facei];
srcMagSf[coarseFacei] += fineSrcMagSf[facei];
}
}
@ -333,9 +333,9 @@ void Foam::AMIInterpolation<SourcePatch, TargetPatch>::agglomerate
tgtSubMap[Pstream::myProcNo()] = identity(targetCoarseSize);
}
forAll(map.subMap(), procI)
forAll(map.subMap(), proci)
{
if (procI != Pstream::myProcNo())
if (proci != Pstream::myProcNo())
{
// Combine entries that point to the same coarse element.
// The important bit is to loop over the data (and hand out
@ -345,10 +345,10 @@ void Foam::AMIInterpolation<SourcePatch, TargetPatch>::agglomerate
// in the subMap is the fourth element received in the
// constructMap
const labelList& elems = map.subMap()[procI];
const labelList& elems = map.subMap()[proci];
const labelList& elemsMap =
map.constructMap()[Pstream::myProcNo()];
labelList& newSubMap = tgtSubMap[procI];
labelList& newSubMap = tgtSubMap[proci];
newSubMap.setSize(elems.size());
labelList oldToNew(targetCoarseSize, -1);
@ -361,7 +361,7 @@ void Foam::AMIInterpolation<SourcePatch, TargetPatch>::agglomerate
if (oldToNew[coarseElem] == -1)
{
oldToNew[coarseElem] = newI;
newSubMap[newI] = coarseElem;
newSubMap[newi] = coarseElem;
newI++;
}
}
@ -402,16 +402,16 @@ void Foam::AMIInterpolation<SourcePatch, TargetPatch>::agglomerate
label compactI = targetCoarseSize;
// Compact data from other processors
forAll(map.constructMap(), procI)
forAll(map.constructMap(), proci)
{
if (procI != Pstream::myProcNo())
if (proci != Pstream::myProcNo())
{
// Combine entries that point to the same coarse element. All
// elements now are remote data so we cannot use any local
// data here - use allRestrict instead.
const labelList& elems = map.constructMap()[procI];
const labelList& elems = map.constructMap()[proci];
labelList& newConstructMap = tgtConstructMap[procI];
labelList& newConstructMap = tgtConstructMap[proci];
newConstructMap.setSize(elems.size());
if (elems.size())
@ -429,27 +429,27 @@ void Foam::AMIInterpolation<SourcePatch, TargetPatch>::agglomerate
}
remoteTargetCoarseSize += 1;
// Combine locally data coming from procI
// Combine locally data coming from proci
labelList oldToNew(remoteTargetCoarseSize, -1);
label newI = 0;
forAll(elems, i)
{
label fineElem = elems[i];
// fineElem now points to section from procI
// fineElem now points to section from proci
label coarseElem = allRestrict[fineElem];
if (oldToNew[coarseElem] == -1)
{
oldToNew[coarseElem] = newI;
tgtCompactMap[fineElem] = compactI;
newConstructMap[newI] = compactI++;
newI++;
oldToNew[coarseElem] = newi;
tgtCompactMap[fineElem] = compacti;
newConstructMap[newi] = compacti++;
newi++;
}
else
{
// Get compact index
label compactI = oldToNew[coarseElem];
tgtCompactMap[fineElem] = newConstructMap[compactI];
label compacti = oldToNew[coarseElem];
tgtCompactMap[fineElem] = newConstructMap[compacti];
}
}
newConstructMap.setSize(newI);
@ -460,28 +460,28 @@ void Foam::AMIInterpolation<SourcePatch, TargetPatch>::agglomerate
srcAddress.setSize(sourceCoarseSize);
srcWeights.setSize(sourceCoarseSize);
forAll(fineSrcAddress, faceI)
forAll(fineSrcAddress, facei)
{
// All the elements contributing to faceI. Are slots in
// All the elements contributing to facei. Are slots in
// mapDistribute'd data.
const labelList& elems = fineSrcAddress[faceI];
const scalarList& weights = fineSrcWeights[faceI];
const scalar fineArea = fineSrcMagSf[faceI];
const labelList& elems = fineSrcAddress[facei];
const scalarList& weights = fineSrcWeights[facei];
const scalar fineArea = fineSrcMagSf[facei];
label coarseFaceI = sourceRestrictAddressing[faceI];
label coarseFacei = sourceRestrictAddressing[facei];
labelList& newElems = srcAddress[coarseFaceI];
scalarList& newWeights = srcWeights[coarseFaceI];
labelList& newElems = srcAddress[coarseFacei];
scalarList& newWeights = srcWeights[coarseFacei];
forAll(elems, i)
{
label elemI = elems[i];
label coarseElemI = tgtCompactMap[elemI];
label elemi = elems[i];
label coarseElemi = tgtCompactMap[elemi];
label index = findIndex(newElems, coarseElemI);
label index = findIndex(newElems, coarseElemi);
if (index == -1)
{
newElems.append(coarseElemI);
newElems.append(coarseElemi);
newWeights.append(fineArea*weights[i]);
}
else
@ -506,28 +506,28 @@ void Foam::AMIInterpolation<SourcePatch, TargetPatch>::agglomerate
srcAddress.setSize(sourceCoarseSize);
srcWeights.setSize(sourceCoarseSize);
forAll(fineSrcAddress, faceI)
forAll(fineSrcAddress, facei)
{
// All the elements contributing to faceI. Are slots in
// target data.
const labelList& elems = fineSrcAddress[faceI];
const scalarList& weights = fineSrcWeights[faceI];
const scalar fineArea = fineSrcMagSf[faceI];
// All the elements contributing to facei. Are slots in
// mapDistribute'd data.
const labelList& elems = fineSrcAddress[facei];
const scalarList& weights = fineSrcWeights[facei];
const scalar fineArea = fineSrcMagSf[facei];
label coarseFaceI = sourceRestrictAddressing[faceI];
label coarseFacei = sourceRestrictAddressing[facei];
labelList& newElems = srcAddress[coarseFaceI];
scalarList& newWeights = srcWeights[coarseFaceI];
labelList& newElems = srcAddress[coarseFacei];
scalarList& newWeights = srcWeights[coarseFacei];
forAll(elems, i)
{
label elemI = elems[i];
label coarseElemI = targetRestrictAddressing[elemI];
label elemi = elems[i];
label coarseElemi = targetRestrictAddressing[elemi];
label index = findIndex(newElems, coarseElemI);
label index = findIndex(newElems, coarseElemi);
if (index == -1)
{
newElems.append(coarseElemI);
newElems.append(coarseElemi);
newWeights.append(fineArea*weights[i]);
}
else
@ -538,7 +538,7 @@ void Foam::AMIInterpolation<SourcePatch, TargetPatch>::agglomerate
}
}
// weights normalisation
// Weights normalisation
normaliseWeights
(
srcMagSf,
@ -563,7 +563,7 @@ void Foam::AMIInterpolation<SourcePatch, TargetPatch>::constructFromSurface
{
if (surfPtr.valid())
{
// create new patches for source and target
// Create new patches for source and target
pointField srcPoints = srcPatch.points();
SourcePatch srcPatch0
(
@ -607,12 +607,12 @@ void Foam::AMIInterpolation<SourcePatch, TargetPatch>::constructFromSurface
}
// map source and target patches onto projection surface
// Map source and target patches onto projection surface
projectPointsToSurface(surfPtr(), srcPoints);
projectPointsToSurface(surfPtr(), tgtPoints);
// calculate AMI interpolation
// Calculate AMI interpolation
update(srcPatch0, tgtPatch0);
}
else
@ -621,6 +621,7 @@ void Foam::AMIInterpolation<SourcePatch, TargetPatch>::constructFromSurface
}
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class SourcePatch, class TargetPatch>
@ -647,8 +648,8 @@ Foam::AMIInterpolation<SourcePatch, TargetPatch>::AMIInterpolation
tgtWeights_(),
tgtWeightsSum_(),
triMode_(triMode),
srcMapPtr_(NULL),
tgtMapPtr_(NULL)
srcMapPtr_(nullptr),
tgtMapPtr_(nullptr)
{
update(srcPatch, tgtPatch);
}
@ -678,8 +679,8 @@ Foam::AMIInterpolation<SourcePatch, TargetPatch>::AMIInterpolation
tgtWeights_(),
tgtWeightsSum_(),
triMode_(triMode),
srcMapPtr_(NULL),
tgtMapPtr_(NULL)
srcMapPtr_(nullptr),
tgtMapPtr_(nullptr)
{
update(srcPatch, tgtPatch);
}
@ -710,8 +711,8 @@ Foam::AMIInterpolation<SourcePatch, TargetPatch>::AMIInterpolation
tgtWeights_(),
tgtWeightsSum_(),
triMode_(triMode),
srcMapPtr_(NULL),
tgtMapPtr_(NULL)
srcMapPtr_(nullptr),
tgtMapPtr_(nullptr)
{
constructFromSurface(srcPatch, tgtPatch, surfPtr);
}
@ -742,8 +743,8 @@ Foam::AMIInterpolation<SourcePatch, TargetPatch>::AMIInterpolation
tgtWeights_(),
tgtWeightsSum_(),
triMode_(triMode),
srcMapPtr_(NULL),
tgtMapPtr_(NULL)
srcMapPtr_(nullptr),
tgtMapPtr_(nullptr)
{
constructFromSurface(srcPatch, tgtPatch, surfPtr);
}
@ -769,8 +770,8 @@ Foam::AMIInterpolation<SourcePatch, TargetPatch>::AMIInterpolation
tgtWeights_(),
tgtWeightsSum_(),
triMode_(fineAMI.triMode_),
srcMapPtr_(NULL),
tgtMapPtr_(NULL)
srcMapPtr_(nullptr),
tgtMapPtr_(nullptr)
{
label sourceCoarseSize =
(
@ -833,15 +834,6 @@ Foam::AMIInterpolation<SourcePatch, TargetPatch>::AMIInterpolation
tgtMapPtr_
);
//if (tgtMapPtr_.valid())
//{
// Pout<< "tgtMap:" << endl;
// string oldPrefix = Pout.prefix();
// Pout.prefix() = oldPrefix + " ";
// tgtMapPtr_().printLayout(Pout);
// Pout.prefix() = oldPrefix;
//}
agglomerate
(
fineAMI.srcMapPtr_,
@ -858,15 +850,6 @@ Foam::AMIInterpolation<SourcePatch, TargetPatch>::AMIInterpolation
tgtWeightsSum_,
srcMapPtr_
);
//if (srcMapPtr_.valid())
//{
// Pout<< "srcMap:" << endl;
// string oldPrefix = Pout.prefix();
// Pout.prefix() = oldPrefix + " ";
// srcMapPtr_().printLayout(Pout);
// Pout.prefix() = oldPrefix;
//}
}
@ -908,14 +891,14 @@ void Foam::AMIInterpolation<SourcePatch, TargetPatch>::update
// Calculate face areas
srcMagSf_.setSize(srcPatch.size());
forAll(srcMagSf_, faceI)
forAll(srcMagSf_, facei)
{
srcMagSf_[faceI] = srcPatch[faceI].mag(srcPatch.points());
srcMagSf_[facei] = srcPatch[facei].mag(srcPatch.points());
}
tgtMagSf_.setSize(tgtPatch.size());
forAll(tgtMagSf_, faceI)
forAll(tgtMagSf_, facei)
{
tgtMagSf_[faceI] = tgtPatch[faceI].mag(tgtPatch.points());
tgtMagSf_[facei] = tgtPatch[facei].mag(tgtPatch.points());
}
// Calculate if patches present on multiple processors
@ -923,7 +906,7 @@ void Foam::AMIInterpolation<SourcePatch, TargetPatch>::update
if (singlePatchProc_ == -1)
{
// convert local addressing to global addressing
// Convert local addressing to global addressing
globalIndex globalSrcFaces(srcPatch.size());
globalIndex globalTgtFaces(tgtPatch.size());
@ -933,12 +916,13 @@ void Foam::AMIInterpolation<SourcePatch, TargetPatch>::update
autoPtr<mapDistribute> mapPtr = calcProcMap(srcPatch, tgtPatch);
const mapDistribute& map = mapPtr();
// create new target patch that fully encompasses source patch
// Create new target patch that fully encompasses source patch
// faces and points
// Faces and points
faceList newTgtFaces;
pointField newTgtPoints;
// original faces from tgtPatch (in globalIndexing since might be
// Original faces from tgtPatch (in globalIndexing since might be
// remote)
labelList tgtFaceIDs;
distributeAndMergePatches
@ -963,13 +947,13 @@ void Foam::AMIInterpolation<SourcePatch, TargetPatch>::update
);
scalarField newTgtMagSf(newTgtPatch.size());
forAll(newTgtPatch, faceI)
forAll(newTgtPatch, facei)
{
newTgtMagSf[faceI] = newTgtPatch[faceI].mag(newTgtPatch.points());
newTgtMagSf[facei] = newTgtPatch[facei].mag(newTgtPatch.points());
}
// calculate AMI interpolation
// Calculate AMI interpolation
autoPtr<AMIMethod<SourcePatch, TargetPatch>> AMIPtr
(
AMIMethod<SourcePatch, TargetPatch>::New
@ -1015,20 +999,20 @@ void Foam::AMIInterpolation<SourcePatch, TargetPatch>::update
labelList& addressing = srcAddress_[i];
forAll(addressing, addrI)
{
addressing[addrI] = tgtFaceIDs[addressing[addrI]];
addressing[addri] = tgtFaceIDs[addressing[addri]];
}
}
forAll(tgtAddress_, i)
{
labelList& addressing = tgtAddress_[i];
forAll(addressing, addrI)
forAll(addressing, addri)
{
addressing[addrI] = globalSrcFaces.toGlobal(addressing[addrI]);
addressing[addri] = globalSrcFaces.toGlobal(addressing[addri]);
}
}
// send data back to originating procs. Note that contributions
// Send data back to originating procs. Note that contributions
// from different processors get added (ListAppendEqOp)
mapDistributeBase::distribute
@ -1064,14 +1048,14 @@ void Foam::AMIInterpolation<SourcePatch, TargetPatch>::update
// weights normalisation
AMIPtr->normaliseWeights(true, *this);
// cache maps and reset addresses
// Cache maps and reset addresses
List<Map<label>> cMap;
srcMapPtr_.reset(new mapDistribute(globalSrcFaces, tgtAddress_, cMap));
tgtMapPtr_.reset(new mapDistribute(globalTgtFaces, srcAddress_, cMap));
}
else
{
// calculate AMI interpolation
// Calculate AMI interpolation
autoPtr<AMIMethod<SourcePatch, TargetPatch>> AMIPtr
(
AMIMethod<SourcePatch, TargetPatch>::New
@ -1151,53 +1135,53 @@ void Foam::AMIInterpolation<SourcePatch, TargetPatch>::append
// Re-calculate the source indices
{
labelList mapMap(0), newMapMap(0);
forAll(srcSubMap, procI)
forAll(srcSubMap, proci)
{
mapMap.append
(
identity(srcConstructMap[procI].size())
identity(srcConstructMap[proci].size())
+ mapMap.size() + newMapMap.size()
);
newMapMap.append
(
identity(newSrcConstructMap[procI].size())
identity(newSrcConstructMap[proci].size())
+ mapMap.size() + newMapMap.size()
);
}
forAll(srcSubMap, procI)
forAll(srcSubMap, proci)
{
forAll(srcConstructMap[procI], srcI)
forAll(srcConstructMap[proci], srci)
{
srcConstructMap[procI][srcI] =
mapMap[srcConstructMap[procI][srcI]];
srcConstructMap[proci][srci] =
mapMap[srcConstructMap[proci][srci]];
}
}
forAll(srcSubMap, procI)
forAll(srcSubMap, proci)
{
forAll(newSrcConstructMap[procI], srcI)
forAll(newSrcConstructMap[proci], srci)
{
newSrcConstructMap[procI][srcI] =
newMapMap[newSrcConstructMap[procI][srcI]];
newSrcConstructMap[proci][srci] =
newMapMap[newSrcConstructMap[proci][srci]];
}
}
forAll(tgtAddress_, tgtI)
forAll(tgtAddress_, tgti)
{
forAll(tgtAddress_[tgtI], tgtJ)
forAll(tgtAddress_[tgti], tgtj)
{
tgtAddress_[tgtI][tgtJ] =
mapMap[tgtAddress_[tgtI][tgtJ]];
tgtAddress_[tgti][tgtj] =
mapMap[tgtAddress_[tgti][tgtj]];
}
}
forAll(newPtr->tgtAddress_, tgtI)
forAll(newPtr->tgtAddress_, tgti)
{
forAll(newPtr->tgtAddress_[tgtI], tgtJ)
forAll(newPtr->tgtAddress_[tgti], tgtj)
{
newPtr->tgtAddress_[tgtI][tgtJ] =
newMapMap[newPtr->tgtAddress_[tgtI][tgtJ]];
newPtr->tgtAddress_[tgti][tgtj] =
newMapMap[newPtr->tgtAddress_[tgti][tgtj]];
}
}
}
@ -1205,53 +1189,53 @@ void Foam::AMIInterpolation<SourcePatch, TargetPatch>::append
// Re-calculate the target indices
{
labelList mapMap(0), newMapMap(0);
forAll(srcSubMap, procI)
forAll(srcSubMap, proci)
{
mapMap.append
(
identity(tgtConstructMap[procI].size())
identity(tgtConstructMap[proci].size())
+ mapMap.size() + newMapMap.size()
);
newMapMap.append
(
identity(newTgtConstructMap[procI].size())
identity(newTgtConstructMap[proci].size())
+ mapMap.size() + newMapMap.size()
);
}
forAll(srcSubMap, procI)
forAll(srcSubMap, proci)
{
forAll(tgtConstructMap[procI], tgtI)
forAll(tgtConstructMap[proci], tgti)
{
tgtConstructMap[procI][tgtI] =
mapMap[tgtConstructMap[procI][tgtI]];
tgtConstructMap[proci][tgti] =
mapMap[tgtConstructMap[proci][tgti]];
}
}
forAll(srcSubMap, procI)
forAll(srcSubMap, proci)
{
forAll(newTgtConstructMap[procI], tgtI)
forAll(newTgtConstructMap[proci], tgti)
{
newTgtConstructMap[procI][tgtI] =
newMapMap[newTgtConstructMap[procI][tgtI]];
newTgtConstructMap[proci][tgti] =
newMapMap[newTgtConstructMap[proci][tgti]];
}
}
forAll(srcAddress_, srcI)
forAll(srcAddress_, srci)
{
forAll(srcAddress_[srcI], srcJ)
forAll(srcAddress_[srci], srcj)
{
srcAddress_[srcI][srcJ] =
mapMap[srcAddress_[srcI][srcJ]];
srcAddress_[srci][srcj] =
mapMap[srcAddress_[srci][srcj]];
}
}
forAll(newPtr->srcAddress_, srcI)
forAll(newPtr->srcAddress_, srci)
{
forAll(newPtr->srcAddress_[srcI], srcJ)
forAll(newPtr->srcAddress_[srci], srcj)
{
newPtr->srcAddress_[srcI][srcJ] =
newMapMap[newPtr->srcAddress_[srcI][srcJ]];
newPtr->srcAddress_[srci][srcj] =
newMapMap[newPtr->srcAddress_[srci][srcj]];
}
}
}
@ -1261,30 +1245,30 @@ void Foam::AMIInterpolation<SourcePatch, TargetPatch>::append
tgtMapPtr_->constructSize() += newPtr->tgtMapPtr_->constructSize();
// Combine the maps
forAll(srcSubMap, procI)
forAll(srcSubMap, proci)
{
srcSubMap[procI].append(newSrcSubMap[procI]);
srcConstructMap[procI].append(newSrcConstructMap[procI]);
srcSubMap[proci].append(newSrcSubMap[proci]);
srcConstructMap[proci].append(newSrcConstructMap[proci]);
tgtSubMap[procI].append(newTgtSubMap[procI]);
tgtConstructMap[procI].append(newTgtConstructMap[procI]);
tgtSubMap[proci].append(newTgtSubMap[proci]);
tgtConstructMap[proci].append(newTgtConstructMap[proci]);
}
}
// Combine new and current source data
forAll(srcMagSf_, srcFaceI)
forAll(srcMagSf_, srcFacei)
{
srcAddress_[srcFaceI].append(newPtr->srcAddress()[srcFaceI]);
srcWeights_[srcFaceI].append(newPtr->srcWeights()[srcFaceI]);
srcWeightsSum_[srcFaceI] += newPtr->srcWeightsSum()[srcFaceI];
srcAddress_[srcFacei].append(newPtr->srcAddress()[srcFacei]);
srcWeights_[srcFacei].append(newPtr->srcWeights()[srcFacei]);
srcWeightsSum_[srcFacei] += newPtr->srcWeightsSum()[srcFacei];
}
// Combine new and current target data
forAll(tgtMagSf_, tgtFaceI)
forAll(tgtMagSf_, tgtFacei)
{
tgtAddress_[tgtFaceI].append(newPtr->tgtAddress()[tgtFaceI]);
tgtWeights_[tgtFaceI].append(newPtr->tgtWeights()[tgtFaceI]);
tgtWeightsSum_[tgtFaceI] += newPtr->tgtWeightsSum()[tgtFaceI];
tgtAddress_[tgtFacei].append(newPtr->tgtAddress()[tgtFacei]);
tgtWeights_[tgtFacei].append(newPtr->tgtWeights()[tgtFacei]);
tgtWeightsSum_[tgtFacei] += newPtr->tgtWeightsSum()[tgtFacei];
}
}
@ -1366,40 +1350,40 @@ void Foam::AMIInterpolation<SourcePatch, TargetPatch>::interpolateToTarget
List<Type> work(fld);
map.distribute(work);
forAll(result, faceI)
forAll(result, facei)
{
if (tgtWeightsSum_[faceI] < lowWeightCorrection_)
if (tgtWeightsSum_[facei] < lowWeightCorrection_)
{
result[faceI] = defaultValues[faceI];
result[facei] = defaultValues[facei];
}
else
{
const labelList& faces = tgtAddress_[faceI];
const scalarList& weights = tgtWeights_[faceI];
const labelList& faces = tgtAddress_[facei];
const scalarList& weights = tgtWeights_[facei];
forAll(faces, i)
{
cop(result[faceI], faceI, work[faces[i]], weights[i]);
cop(result[facei], facei, work[faces[i]], weights[i]);
}
}
}
}
else
{
forAll(result, faceI)
forAll(result, facei)
{
if (tgtWeightsSum_[faceI] < lowWeightCorrection_)
if (tgtWeightsSum_[facei] < lowWeightCorrection_)
{
result[faceI] = defaultValues[faceI];
result[facei] = defaultValues[facei];
}
else
{
const labelList& faces = tgtAddress_[faceI];
const scalarList& weights = tgtWeights_[faceI];
const labelList& faces = tgtAddress_[facei];
const scalarList& weights = tgtWeights_[facei];
forAll(faces, i)
{
cop(result[faceI], faceI, fld[faces[i]], weights[i]);
cop(result[facei], facei, fld[faces[i]], weights[i]);
}
}
}
@ -1451,40 +1435,40 @@ void Foam::AMIInterpolation<SourcePatch, TargetPatch>::interpolateToSource
List<Type> work(fld);
map.distribute(work);
forAll(result, faceI)
forAll(result, facei)
{
if (srcWeightsSum_[faceI] < lowWeightCorrection_)
if (srcWeightsSum_[facei] < lowWeightCorrection_)
{
result[faceI] = defaultValues[faceI];
result[facei] = defaultValues[facei];
}
else
{
const labelList& faces = srcAddress_[faceI];
const scalarList& weights = srcWeights_[faceI];
const labelList& faces = srcAddress_[facei];
const scalarList& weights = srcWeights_[facei];
forAll(faces, i)
{
cop(result[faceI], faceI, work[faces[i]], weights[i]);
cop(result[facei], facei, work[faces[i]], weights[i]);
}
}
}
}
else
{
forAll(result, faceI)
forAll(result, facei)
{
if (srcWeightsSum_[faceI] < lowWeightCorrection_)
if (srcWeightsSum_[facei] < lowWeightCorrection_)
{
result[faceI] = defaultValues[faceI];
result[facei] = defaultValues[facei];
}
else
{
const labelList& faces = srcAddress_[faceI];
const scalarList& weights = srcWeights_[faceI];
const labelList& faces = srcAddress_[facei];
const scalarList& weights = srcWeights_[facei];
forAll(faces, i)
{
cop(result[faceI], faceI, fld[faces[i]], weights[i]);
cop(result[facei], facei, fld[faces[i]], weights[i]);
}
}
}
@ -1640,48 +1624,43 @@ Foam::label Foam::AMIInterpolation<SourcePatch, TargetPatch>::srcPointFace
const SourcePatch& srcPatch,
const TargetPatch& tgtPatch,
const vector& n,
const label tgtFaceI,
const label tgtFacei,
point& tgtPoint
)
const
{
const pointField& srcPoints = srcPatch.points();
// source face addresses that intersect target face tgtFaceI
const labelList& addr = tgtAddress_[tgtFaceI];
// Source face addresses that intersect target face tgtFacei
const labelList& addr = tgtAddress_[tgtFacei];
pointHit nearest;
nearest.setDistance(GREAT);
label nearestFacei = -1;
forAll(addr, i)
{
label srcFaceI = addr[i];
const face& f = srcPatch[srcFaceI];
const label srcFacei = addr[i];
const face& f = srcPatch[srcFacei];
pointHit ray = f.ray(tgtPoint, n, srcPoints);
if (ray.hit())
{
tgtPoint = ray.rawPoint();
return srcFaceI;
// tgtPoint = ray.rawPoint();
return srcFacei;
}
else if (ray.distance() < nearest.distance())
{
nearest = ray;
nearestFacei = srcFacei;
}
}
// no hit registered - try with face normal instead of input normal
forAll(addr, i)
if (nearest.hit() || nearest.eligibleMiss())
{
label srcFaceI = addr[i];
const face& f = srcPatch[srcFaceI];
vector nFace(-srcPatch.faceNormals()[srcFaceI]);
nFace += tgtPatch.faceNormals()[tgtFaceI];
pointHit ray = f.ray(tgtPoint, nFace, srcPoints);
if (ray.hit())
{
tgtPoint = ray.rawPoint();
return srcFaceI;
}
// tgtPoint = nearest.rawPoint();
return nearestFacei;
}
return -1;
@ -1694,48 +1673,43 @@ Foam::label Foam::AMIInterpolation<SourcePatch, TargetPatch>::tgtPointFace
const SourcePatch& srcPatch,
const TargetPatch& tgtPatch,
const vector& n,
const label srcFaceI,
const label srcFacei,
point& srcPoint
)
const
{
const pointField& tgtPoints = tgtPatch.points();
// target face addresses that intersect source face srcFaceI
const labelList& addr = srcAddress_[srcFaceI];
pointHit nearest;
nearest.setDistance(GREAT);
label nearestFacei = -1;
// Target face addresses that intersect source face srcFacei
const labelList& addr = srcAddress_[srcFacei];
forAll(addr, i)
{
label tgtFaceI = addr[i];
const face& f = tgtPatch[tgtFaceI];
const label tgtFacei = addr[i];
const face& f = tgtPatch[tgtFacei];
pointHit ray = f.ray(srcPoint, n, tgtPoints);
if (ray.hit())
if (ray.hit() || ray.eligibleMiss())
{
srcPoint = ray.rawPoint();
return tgtFaceI;
// srcPoint = ray.rawPoint();
return tgtFacei;
}
else if (ray.distance() < nearest.distance())
{
nearest = ray;
nearestFacei = tgtFacei;
}
}
// no hit registered - try with face normal instead of input normal
forAll(addr, i)
if (nearest.hit() || nearest.eligibleMiss())
{
label tgtFaceI = addr[i];
const face& f = tgtPatch[tgtFaceI];
vector nFace(-srcPatch.faceNormals()[srcFaceI]);
nFace += tgtPatch.faceNormals()[tgtFaceI];
pointHit ray = f.ray(srcPoint, n, tgtPoints);
if (ray.hit())
{
srcPoint = ray.rawPoint();
return tgtFaceI;
}
// srcPoint = nearest.rawPoint();
return nearestFacei;
}
return -1;
@ -1753,23 +1727,24 @@ const
{
OFstream os("faceConnectivity" + Foam::name(Pstream::myProcNo()) + ".obj");
label ptI = 1;
label pti = 1;
forAll(srcAddress, i)
{
const labelList& addr = srcAddress[i];
const point& srcPt = srcPatch.faceCentres()[i];
forAll(addr, j)
{
label tgtPtI = addr[j];
const point& tgtPt = tgtPatch.faceCentres()[tgtPtI];
label tgtPti = addr[j];
const point& tgtPt = tgtPatch.faceCentres()[tgtPti];
meshTools::writeOBJ(os, srcPt);
meshTools::writeOBJ(os, tgtPt);
os << "l " << ptI << " " << ptI + 1 << endl;
os << "l " << pti << " " << pti + 1 << endl;
ptI += 2;
pti += 2;
}
}
}

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
-------------------------------------------------------------------------------
License

View File

@ -37,7 +37,7 @@ Foam::label Foam::AMIInterpolation<SourcePatch, TargetPatch>::calcDistribution
const TargetPatch& tgtPatch
) const
{
label procI = 0;
label proci = 0;
if (Pstream::parRun())
{
@ -58,7 +58,7 @@ Foam::label Foam::AMIInterpolation<SourcePatch, TargetPatch>::calcDistribution
if (nHaveFaces > 1)
{
procI = -1;
proci = -1;
if (debug)
{
InfoInFunction
@ -67,18 +67,18 @@ Foam::label Foam::AMIInterpolation<SourcePatch, TargetPatch>::calcDistribution
}
else if (nHaveFaces == 1)
{
procI = findIndex(facesPresentOnProc, 1);
proci = findIndex(facesPresentOnProc, 1);
if (debug)
{
InfoInFunction
<< "AMI local to processor" << procI << endl;
<< "AMI local to processor" << proci << endl;
}
}
}
// Either not parallel or no faces on any processor
return procI;
return proci;
}
@ -96,15 +96,15 @@ Foam::AMIInterpolation<SourcePatch, TargetPatch>::calcOverlappingProcs
label nOverlaps = 0;
forAll(procBb, procI)
forAll(procBb, proci)
{
const treeBoundBoxList& bbp = procBb[procI];
const treeBoundBoxList& bbp = procBb[proci];
forAll(bbp, bbI)
forAll(bbp, bbi)
{
if (bbp[bbI].overlaps(bb))
if (bbp[bbi].overlaps(bb))
{
overlaps[procI] = true;
overlaps[proci] = true;
nOverlaps++;
break;
}
@ -232,10 +232,10 @@ distributeAndMergePatches
// Renumber and flatten
label nFaces = 0;
label nPoints = 0;
forAll(allFaces, procI)
forAll(allFaces, proci)
{
nFaces += allFaces[procI].size();
nPoints += allPoints[procI].size();
nFaces += allFaces[proci].size();
nPoints += allPoints[proci].size();
}
tgtFaces.setSize(nFaces);
@ -271,14 +271,14 @@ distributeAndMergePatches
// Other proc data follows
forAll(allFaces, procI)
forAll(allFaces, proci)
{
if (procI != Pstream::myProcNo())
if (proci != Pstream::myProcNo())
{
const labelList& faceIDs = allTgtFaceIDs[procI];
const labelList& faceIDs = allTgtFaceIDs[proci];
SubList<label>(tgtFaceIDs, faceIDs.size(), nFaces) = faceIDs;
const faceList& fcs = allFaces[procI];
const faceList& fcs = allFaces[proci];
forAll(fcs, i)
{
const face& f = fcs[i];
@ -290,7 +290,7 @@ distributeAndMergePatches
}
}
const pointField& pts = allPoints[procI];
const pointField& pts = allPoints[proci];
forAll(pts, i)
{
tgtPoints[nPoints++] = pts[i];
@ -360,9 +360,9 @@ Foam::AMIInterpolation<SourcePatch, TargetPatch>::calcProcMap
{
Info<< "Determining extent of srcPatch per processor:" << nl
<< "\tproc\tbb" << endl;
forAll(procBb, procI)
forAll(procBb, proci)
{
Info<< '\t' << procI << '\t' << procBb[procI] << endl;
Info<< '\t' << proci << '\t' << procBb[proci] << endl;
}
}
@ -379,20 +379,20 @@ Foam::AMIInterpolation<SourcePatch, TargetPatch>::calcProcMap
// Work array - whether processor bb overlaps the face bounds
boolList procBbOverlaps(Pstream::nProcs());
forAll(faces, faceI)
forAll(faces, facei)
{
if (faces[faceI].size())
if (faces[facei].size())
{
treeBoundBox faceBb(points, faces[faceI]);
treeBoundBox faceBb(points, faces[facei]);
// Find the processor this face overlaps
calcOverlappingProcs(procBb, faceBb, procBbOverlaps);
forAll(procBbOverlaps, procI)
forAll(procBbOverlaps, proci)
{
if (procBbOverlaps[procI])
if (procBbOverlaps[proci])
{
dynSendMap[procI].append(faceI);
dynSendMap[proci].append(facei);
}
}
}
@ -400,9 +400,9 @@ Foam::AMIInterpolation<SourcePatch, TargetPatch>::calcProcMap
// Convert dynamicList to labelList
sendMap.setSize(Pstream::nProcs());
forAll(sendMap, procI)
forAll(sendMap, proci)
{
sendMap[procI].transfer(dynSendMap[procI]);
sendMap[proci].transfer(dynSendMap[proci]);
}
}
@ -411,9 +411,9 @@ Foam::AMIInterpolation<SourcePatch, TargetPatch>::calcProcMap
{
Pout<< "Of my " << faces.size() << " I need to send to:" << nl
<< "\tproc\tfaces" << endl;
forAll(sendMap, procI)
forAll(sendMap, proci)
{
Pout<< '\t' << procI << '\t' << sendMap[procI].size() << endl;
Pout<< '\t' << proci << '\t' << sendMap[proci].size() << endl;
}
}
@ -421,9 +421,9 @@ Foam::AMIInterpolation<SourcePatch, TargetPatch>::calcProcMap
// Send over how many faces I need to receive
labelListList sendSizes(Pstream::nProcs());
sendSizes[Pstream::myProcNo()].setSize(Pstream::nProcs());
forAll(sendMap, procI)
forAll(sendMap, proci)
{
sendSizes[Pstream::myProcNo()][procI] = sendMap[procI].size();
sendSizes[Pstream::myProcNo()][proci] = sendMap[proci].size();
}
Pstream::gatherList(sendSizes);
Pstream::scatterList(sendSizes);
@ -439,17 +439,17 @@ Foam::AMIInterpolation<SourcePatch, TargetPatch>::calcProcMap
);
label segmentI = constructMap[Pstream::myProcNo()].size();
forAll(constructMap, procI)
forAll(constructMap, proci)
{
if (procI != Pstream::myProcNo())
if (proci != Pstream::myProcNo())
{
// What I need to receive is what other processor is sending to me
label nRecv = sendSizes[procI][Pstream::myProcNo()];
constructMap[procI].setSize(nRecv);
label nRecv = sendSizes[proci][Pstream::myProcNo()];
constructMap[proci].setSize(nRecv);
for (label i = 0; i < nRecv; i++)
{
constructMap[procI][i] = segmentI++;
constructMap[proci][i] = segmentI++;
}
}
}

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2013-2015 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2013-2016 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
@ -74,8 +74,8 @@ bool Foam::AMIMethod<SourcePatch, TargetPatch>::initialise
scalarListList& srcWeights,
labelListList& tgtAddress,
scalarListList& tgtWeights,
label& srcFaceI,
label& tgtFaceI
label& srcFacei,
label& tgtFacei
)
{
checkPatches();
@ -104,17 +104,17 @@ bool Foam::AMIMethod<SourcePatch, TargetPatch>::initialise
resetTree();
// find initial face match using brute force/octree search
if ((srcFaceI == -1) || (tgtFaceI == -1))
if ((srcFacei == -1) || (tgtFacei == -1))
{
srcFaceI = 0;
tgtFaceI = 0;
srcFacei = 0;
tgtFacei = 0;
bool foundFace = false;
forAll(srcPatch_, faceI)
forAll(srcPatch_, facei)
{
tgtFaceI = findTargetFace(faceI);
if (tgtFaceI >= 0)
tgtFacei = findTargetFace(facei);
if (tgtFacei >= 0)
{
srcFaceI = faceI;
srcFacei = facei;
foundFace = true;
break;
}
@ -135,7 +135,7 @@ bool Foam::AMIMethod<SourcePatch, TargetPatch>::initialise
if (debug)
{
Pout<< "AMI: initial target face = " << tgtFaceI << endl;
Pout<< "AMI: initial target face = " << tgtFacei << endl;
}
return true;
@ -228,21 +228,21 @@ void Foam::AMIMethod<SourcePatch, TargetPatch>::resetTree()
template<class SourcePatch, class TargetPatch>
Foam::label Foam::AMIMethod<SourcePatch, TargetPatch>::findTargetFace
(
const label srcFaceI
const label srcFacei
) const
{
label targetFaceI = -1;
label targetFacei = -1;
const pointField& srcPts = srcPatch_.points();
const face& srcFace = srcPatch_[srcFaceI];
const face& srcFace = srcPatch_[srcFacei];
const point srcPt = srcFace.centre(srcPts);
const scalar srcFaceArea = srcMagSf_[srcFaceI];
const scalar srcFaceArea = srcMagSf_[srcFacei];
pointIndexHit sample = treePtr_->findNearest(srcPt, 10.0*srcFaceArea);
if (sample.hit())
{
targetFaceI = sample.index();
targetFacei = sample.index();
if (debug)
{
@ -252,29 +252,29 @@ Foam::label Foam::AMIMethod<SourcePatch, TargetPatch>::findTargetFace
}
}
return targetFaceI;
return targetFacei;
}
template<class SourcePatch, class TargetPatch>
void Foam::AMIMethod<SourcePatch, TargetPatch>::appendNbrFaces
(
const label faceI,
const label facei,
const TargetPatch& patch,
const DynamicList<label>& visitedFaces,
DynamicList<label>& faceIDs
) const
{
const labelList& nbrFaces = patch.faceFaces()[faceI];
const labelList& nbrFaces = patch.faceFaces()[facei];
// filter out faces already visited from face neighbours
forAll(nbrFaces, i)
{
label nbrFaceI = nbrFaces[i];
label nbrFacei = nbrFaces[i];
bool valid = true;
forAll(visitedFaces, j)
{
if (nbrFaceI == visitedFaces[j])
if (nbrFacei == visitedFaces[j])
{
valid = false;
break;
@ -285,7 +285,7 @@ void Foam::AMIMethod<SourcePatch, TargetPatch>::appendNbrFaces
{
forAll(faceIDs, j)
{
if (nbrFaceI == faceIDs[j])
if (nbrFacei == faceIDs[j])
{
valid = false;
break;
@ -296,14 +296,14 @@ void Foam::AMIMethod<SourcePatch, TargetPatch>::appendNbrFaces
// prevent addition of face if it is not on the same plane-ish
if (valid)
{
const vector& n1 = patch.faceNormals()[faceI];
const vector& n2 = patch.faceNormals()[nbrFaceI];
const vector& n1 = patch.faceNormals()[facei];
const vector& n2 = patch.faceNormals()[nbrFacei];
scalar cosI = n1 & n2;
if (cosI > Foam::cos(degToRad(89.0)))
{
faceIDs.append(nbrFaceI);
faceIDs.append(nbrFacei);
}
}
}

View File

@ -122,8 +122,8 @@ protected:
scalarListList& srcWeights,
labelListList& tgtAddress,
scalarListList& tgtWeights,
label& srcFaceI,
label& tgtFaceI
label& srcFacei,
label& tgtFacei
);
//- Write triangle intersection to OBJ file
@ -143,12 +143,12 @@ protected:
void resetTree();
//- Find face on target patch that overlaps source face
label findTargetFace(const label srcFaceI) const;
label findTargetFace(const label srcFacei) const;
//- Add faces neighbouring faceI to the ID list
//- Add faces neighbouring facei to the ID list
void appendNbrFaces
(
const label faceI,
const label facei,
const TargetPatch& patch,
const DynamicList<label>& visitedFaces,
DynamicList<label>& faceIDs
@ -237,8 +237,8 @@ public:
scalarListList& srcWeights,
labelListList& tgtAddress,
scalarListList& tgtWeights,
label srcFaceI = -1,
label tgtFaceI = -1
label srcFacei = -1,
label tgtFacei = -1
) = 0;
//- Normalise the weight. Can optionally subset addressing

View File

@ -34,12 +34,12 @@ void Foam::directAMI<SourcePatch, TargetPatch>::appendToDirectSeeds
labelList& srcTgtSeed,
DynamicList<label>& srcSeeds,
DynamicList<label>& nonOverlapFaces,
label& srcFaceI,
label& tgtFaceI
label& srcFacei,
label& tgtFacei
) const
{
const labelList& srcNbr = this->srcPatch_.faceFaces()[srcFaceI];
const labelList& tgtNbr = this->tgtPatch_.faceFaces()[tgtFaceI];
const labelList& srcNbr = this->srcPatch_.faceFaces()[srcFacei];
const labelList& tgtNbr = this->tgtPatch_.faceFaces()[tgtFacei];
const pointField& srcPoints = this->srcPatch_.points();
const pointField& tgtPoints = this->tgtPatch_.points();
@ -144,13 +144,13 @@ void Foam::directAMI<SourcePatch, TargetPatch>::appendToDirectSeeds
if (srcSeeds.size())
{
srcFaceI = srcSeeds.remove();
tgtFaceI = srcTgtSeed[srcFaceI];
srcFacei = srcSeeds.remove();
tgtFacei = srcTgtSeed[srcFacei];
}
else
{
srcFaceI = -1;
tgtFaceI = -1;
srcFacei = -1;
tgtFacei = -1;
}
}
@ -160,24 +160,24 @@ void Foam::directAMI<SourcePatch, TargetPatch>::restartAdvancingFront
(
labelList& mapFlag,
DynamicList<label>& nonOverlapFaces,
label& srcFaceI,
label& tgtFaceI
label& srcFacei,
label& tgtFacei
) const
{
forAll(mapFlag, faceI)
forAll(mapFlag, facei)
{
if (mapFlag[faceI] == 0)
if (mapFlag[facei] == 0)
{
tgtFaceI = this->findTargetFace(faceI);
tgtFacei = this->findTargetFace(facei);
if (tgtFaceI < 0)
if (tgtFacei < 0)
{
mapFlag[faceI] = -1;
nonOverlapFaces.append(faceI);
mapFlag[facei] = -1;
nonOverlapFaces.append(facei);
}
else
{
srcFaceI = faceI;
srcFacei = facei;
break;
}
}
@ -228,8 +228,8 @@ void Foam::directAMI<SourcePatch, TargetPatch>::calculate
scalarListList& srcWeights,
labelListList& tgtAddress,
scalarListList& tgtWeights,
label srcFaceI,
label tgtFaceI
label srcFacei,
label tgtFacei
)
{
bool ok =
@ -239,8 +239,8 @@ void Foam::directAMI<SourcePatch, TargetPatch>::calculate
srcWeights,
tgtAddress,
tgtWeights,
srcFaceI,
tgtFaceI
srcFacei,
tgtFacei
);
if (!ok)
@ -257,12 +257,12 @@ void Foam::directAMI<SourcePatch, TargetPatch>::calculate
// construct weights and addressing
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// list of faces currently visited for srcFaceI to avoid multiple hits
// list of faces currently visited for srcFacei to avoid multiple hits
DynamicList<label> srcSeeds(10);
// list to keep track of tgt faces used to seed src faces
labelList srcTgtSeed(srcAddr.size(), -1);
srcTgtSeed[srcFaceI] = tgtFaceI;
srcTgtSeed[srcFacei] = tgtFacei;
// list to keep track of whether src face can be mapped
// 1 = mapped, 0 = untested, -1 = cannot map
@ -272,30 +272,30 @@ void Foam::directAMI<SourcePatch, TargetPatch>::calculate
DynamicList<label> nonOverlapFaces;
do
{
srcAddr[srcFaceI].append(tgtFaceI);
tgtAddr[tgtFaceI].append(srcFaceI);
srcAddr[srcFacei].append(tgtFacei);
tgtAddr[tgtFacei].append(srcFacei);
mapFlag[srcFaceI] = 1;
mapFlag[srcFacei] = 1;
nTested++;
// Do advancing front starting from srcFaceI, tgtFaceI
// Do advancing front starting from srcFacei, tgtFacei
appendToDirectSeeds
(
mapFlag,
srcTgtSeed,
srcSeeds,
nonOverlapFaces,
srcFaceI,
tgtFaceI
srcFacei,
tgtFacei
);
if (srcFaceI < 0 && nTested < this->srcPatch_.size())
if (srcFacei < 0 && nTested < this->srcPatch_.size())
{
restartAdvancingFront(mapFlag, nonOverlapFaces, srcFaceI, tgtFaceI);
restartAdvancingFront(mapFlag, nonOverlapFaces, srcFacei, tgtFacei);
}
} while (srcFaceI >= 0);
} while (srcFacei >= 0);
if (nonOverlapFaces.size() != 0)
{

View File

@ -71,8 +71,8 @@ private:
labelList& srcTgtSeed,
DynamicList<label>& srcSeeds,
DynamicList<label>& nonOverlapFaces,
label& srcFaceI,
label& tgtFaceI
label& srcFacei,
label& tgtFacei
) const;
//- Restart the advancing front - typically happens for
@ -81,8 +81,8 @@ private:
(
labelList& mapFlag,
DynamicList<label>& nonOverlapFaces,
label& srcFaceI,
label& tgtFaceI
label& srcFacei,
label& tgtFacei
) const;
@ -91,8 +91,8 @@ private:
//- Area of intersection between source and target faces
scalar interArea
(
const label srcFaceI,
const label tgtFaceI
const label srcFacei,
const label tgtFacei
) const;
@ -132,8 +132,8 @@ public:
scalarListList& srcWeights,
labelListList& tgtAddress,
scalarListList& tgtWeights,
label srcFaceI = -1,
label tgtFaceI = -1
label srcFacei = -1,
label tgtFacei = -1
);
//- Normalise the weight. Can optionally subset addressing

View File

@ -34,8 +34,8 @@ void Foam::faceAreaWeightAMI<SourcePatch, TargetPatch>::calcAddressing
List<DynamicList<scalar>>& srcWght,
List<DynamicList<label>>& tgtAddr,
List<DynamicList<scalar>>& tgtWght,
label srcFaceI,
label tgtFaceI
label srcFacei,
label tgtFacei
)
{
// construct weights and addressing
@ -46,12 +46,12 @@ void Foam::faceAreaWeightAMI<SourcePatch, TargetPatch>::calcAddressing
// list of tgt face neighbour faces
DynamicList<label> nbrFaces(10);
// list of faces currently visited for srcFaceI to avoid multiple hits
// list of faces currently visited for srcFacei to avoid multiple hits
DynamicList<label> visitedFaces(10);
// list to keep track of tgt faces used to seed src faces
labelList seedFaces(nFacesRemaining, -1);
seedFaces[srcFaceI] = tgtFaceI;
seedFaces[srcFacei] = tgtFacei;
// list to keep track of whether src face can be mapped
boolList mapFlag(nFacesRemaining, true);
@ -62,11 +62,11 @@ void Foam::faceAreaWeightAMI<SourcePatch, TargetPatch>::calcAddressing
DynamicList<label> nonOverlapFaces;
do
{
// Do advancing front starting from srcFaceI,tgtFaceI
// Do advancing front starting from srcFacei,tgtFacei
bool faceProcessed = processSourceFace
(
srcFaceI,
tgtFaceI,
srcFacei,
tgtFacei,
nbrFaces,
visitedFaces,
@ -77,13 +77,13 @@ void Foam::faceAreaWeightAMI<SourcePatch, TargetPatch>::calcAddressing
tgtWght
);
mapFlag[srcFaceI] = false;
mapFlag[srcFacei] = false;
nFacesRemaining--;
if (!faceProcessed)
{
nonOverlapFaces.append(srcFaceI);
nonOverlapFaces.append(srcFacei);
}
// choose new src face from current src face neighbour
@ -92,8 +92,8 @@ void Foam::faceAreaWeightAMI<SourcePatch, TargetPatch>::calcAddressing
setNextFaces
(
startSeedI,
srcFaceI,
tgtFaceI,
srcFacei,
tgtFacei,
mapFlag,
seedFaces,
visitedFaces
@ -108,12 +108,12 @@ void Foam::faceAreaWeightAMI<SourcePatch, TargetPatch>::calcAddressing
template<class SourcePatch, class TargetPatch>
bool Foam::faceAreaWeightAMI<SourcePatch, TargetPatch>::processSourceFace
(
const label srcFaceI,
const label tgtStartFaceI,
const label srcFacei,
const label tgtStartFacei,
// list of tgt face neighbour faces
DynamicList<label>& nbrFaces,
// list of faces currently visited for srcFaceI to avoid multiple hits
// list of faces currently visited for srcFacei to avoid multiple hits
DynamicList<label>& visitedFaces,
// temporary storage for addressing and weights
@ -123,7 +123,7 @@ bool Foam::faceAreaWeightAMI<SourcePatch, TargetPatch>::processSourceFace
List<DynamicList<scalar>>& tgtWght
)
{
if (tgtStartFaceI == -1)
if (tgtStartFacei == -1)
{
return false;
}
@ -132,10 +132,10 @@ bool Foam::faceAreaWeightAMI<SourcePatch, TargetPatch>::processSourceFace
visitedFaces.clear();
// append initial target face and neighbours
nbrFaces.append(tgtStartFaceI);
nbrFaces.append(tgtStartFacei);
this->appendNbrFaces
(
tgtStartFaceI,
tgtStartFacei,
this->tgtPatch_,
visitedFaces,
nbrFaces
@ -146,22 +146,22 @@ bool Foam::faceAreaWeightAMI<SourcePatch, TargetPatch>::processSourceFace
do
{
// process new target face
label tgtFaceI = nbrFaces.remove();
visitedFaces.append(tgtFaceI);
scalar area = interArea(srcFaceI, tgtFaceI);
label tgtFacei = nbrFaces.remove();
visitedFaces.append(tgtFacei);
scalar area = interArea(srcFacei, tgtFacei);
// store when intersection fractional area > tolerance
if (area/this->srcMagSf_[srcFaceI] > faceAreaIntersect::tolerance())
if (area/this->srcMagSf_[srcFacei] > faceAreaIntersect::tolerance())
{
srcAddr[srcFaceI].append(tgtFaceI);
srcWght[srcFaceI].append(area);
srcAddr[srcFacei].append(tgtFacei);
srcWght[srcFacei].append(area);
tgtAddr[tgtFaceI].append(srcFaceI);
tgtWght[tgtFaceI].append(area);
tgtAddr[tgtFacei].append(srcFacei);
tgtWght[tgtFacei].append(area);
this->appendNbrFaces
(
tgtFaceI,
tgtFacei,
this->tgtPatch_,
visitedFaces,
nbrFaces
@ -180,18 +180,18 @@ template<class SourcePatch, class TargetPatch>
void Foam::faceAreaWeightAMI<SourcePatch, TargetPatch>::setNextFaces
(
label& startSeedI,
label& srcFaceI,
label& tgtFaceI,
label& srcFacei,
label& tgtFacei,
const boolList& mapFlag,
labelList& seedFaces,
const DynamicList<label>& visitedFaces,
bool errorOnNotFound
) const
{
const labelList& srcNbrFaces = this->srcPatch_.faceFaces()[srcFaceI];
const labelList& srcNbrFaces = this->srcPatch_.faceFaces()[srcFacei];
// initialise tgtFaceI
tgtFaceI = -1;
// initialise tgtFacei
tgtFacei = -1;
// set possible seeds for later use
bool valuesSet = false;
@ -205,7 +205,7 @@ void Foam::faceAreaWeightAMI<SourcePatch, TargetPatch>::setNextFaces
{
label faceT = visitedFaces[j];
scalar area = interArea(faceS, faceT);
scalar areaTotal = this->srcMagSf_[srcFaceI];
scalar areaTotal = this->srcMagSf_[srcFacei];
// Check that faces have enough overlap for robust walking
if (area/areaTotal > faceAreaIntersect::tolerance())
@ -216,8 +216,8 @@ void Foam::faceAreaWeightAMI<SourcePatch, TargetPatch>::setNextFaces
if (!valuesSet)
{
srcFaceI = faceS;
tgtFaceI = faceT;
srcFacei = faceS;
tgtFacei = faceT;
valuesSet = true;
}
}
@ -234,20 +234,20 @@ void Foam::faceAreaWeightAMI<SourcePatch, TargetPatch>::setNextFaces
{
// try to use existing seed
bool foundNextSeed = false;
for (label faceI = startSeedI; faceI < mapFlag.size(); faceI++)
for (label facei = startSeedI; facei < mapFlag.size(); facei++)
{
if (mapFlag[faceI])
if (mapFlag[facei])
{
if (!foundNextSeed)
{
startSeedI = faceI;
startSeedI = facei;
foundNextSeed = true;
}
if (seedFaces[faceI] != -1)
if (seedFaces[facei] != -1)
{
srcFaceI = faceI;
tgtFaceI = seedFaces[faceI];
srcFacei = facei;
tgtFacei = seedFaces[facei];
return;
}
@ -262,20 +262,20 @@ void Foam::faceAreaWeightAMI<SourcePatch, TargetPatch>::setNextFaces
}
foundNextSeed = false;
for (label faceI = startSeedI; faceI < mapFlag.size(); faceI++)
for (label facei = startSeedI; facei < mapFlag.size(); facei++)
{
if (mapFlag[faceI])
if (mapFlag[facei])
{
if (!foundNextSeed)
{
startSeedI = faceI + 1;
startSeedI = facei + 1;
foundNextSeed = true;
}
srcFaceI = faceI;
tgtFaceI = this->findTargetFace(srcFaceI);
srcFacei = facei;
tgtFacei = this->findTargetFace(srcFacei);
if (tgtFaceI >= 0)
if (tgtFacei >= 0)
{
return;
}
@ -294,8 +294,8 @@ void Foam::faceAreaWeightAMI<SourcePatch, TargetPatch>::setNextFaces
template<class SourcePatch, class TargetPatch>
Foam::scalar Foam::faceAreaWeightAMI<SourcePatch, TargetPatch>::interArea
(
const label srcFaceI,
const label tgtFaceI
const label srcFacei,
const label tgtFacei
) const
{
scalar area = 0;
@ -304,13 +304,13 @@ Foam::scalar Foam::faceAreaWeightAMI<SourcePatch, TargetPatch>::interArea
const pointField& tgtPoints = this->tgtPatch_.points();
// references to candidate faces
const face& src = this->srcPatch_[srcFaceI];
const face& tgt = this->tgtPatch_[tgtFaceI];
const face& src = this->srcPatch_[srcFacei];
const face& tgt = this->tgtPatch_[tgtFacei];
// quick reject if either face has zero area
// Note: do not use stored face areas for target patch
const scalar tgtMag = tgt.mag(tgtPoints);
if ((this->srcMagSf_[srcFaceI] < ROOTVSMALL) || (tgtMag < ROOTVSMALL))
if ((this->srcMagSf_[srcFacei] < ROOTVSMALL) || (tgtMag < ROOTVSMALL))
{
return area;
}
@ -319,14 +319,14 @@ Foam::scalar Foam::faceAreaWeightAMI<SourcePatch, TargetPatch>::interArea
faceAreaIntersect inter(srcPoints, tgtPoints, this->reverseTarget_);
// crude resultant norm
vector n(-this->srcPatch_.faceNormals()[srcFaceI]);
vector n(-this->srcPatch_.faceNormals()[srcFacei]);
if (this->reverseTarget_)
{
n -= this->tgtPatch_.faceNormals()[tgtFaceI];
n -= this->tgtPatch_.faceNormals()[tgtFacei];
}
else
{
n += this->tgtPatch_.faceNormals()[tgtFaceI];
n += this->tgtPatch_.faceNormals()[tgtFacei];
}
scalar magN = mag(n);
@ -337,9 +337,9 @@ Foam::scalar Foam::faceAreaWeightAMI<SourcePatch, TargetPatch>::interArea
else
{
WarningInFunction
<< "Invalid normal for source face " << srcFaceI
<< "Invalid normal for source face " << srcFacei
<< " points " << UIndirectList<point>(srcPoints, src)
<< " target face " << tgtFaceI
<< " target face " << tgtFacei
<< " points " << UIndirectList<point>(tgtPoints, tgt)
<< endl;
}
@ -368,14 +368,14 @@ restartUncoveredSourceFace
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
labelHashSet lowWeightFaces(100);
forAll(srcWght, srcFaceI)
forAll(srcWght, srcFacei)
{
scalar s = sum(srcWght[srcFaceI]);
scalar t = s/this->srcMagSf_[srcFaceI];
scalar s = sum(srcWght[srcFacei]);
scalar t = s/this->srcMagSf_[srcFacei];
if (t < 0.5)
{
lowWeightFaces.insert(srcFaceI);
lowWeightFaces.insert(srcFacei);
}
}
@ -393,12 +393,12 @@ restartUncoveredSourceFace
DynamicList<label> okSrcFaces(10);
DynamicList<scalar> okSrcWeights(10);
forAll(tgtAddr, tgtFaceI)
forAll(tgtAddr, tgtFacei)
{
okSrcFaces.clear();
okSrcWeights.clear();
DynamicList<label>& srcFaces = tgtAddr[tgtFaceI];
DynamicList<scalar>& srcWeights = tgtWght[tgtFaceI];
DynamicList<label>& srcFaces = tgtAddr[tgtFacei];
DynamicList<scalar>& srcWeights = tgtWght[tgtFacei];
forAll(srcFaces, i)
{
if (!lowWeightFaces.found(srcFaces[i]))
@ -422,20 +422,20 @@ restartUncoveredSourceFace
// list of tgt face neighbour faces
DynamicList<label> nbrFaces(10);
// list of faces currently visited for srcFaceI to avoid multiple hits
// list of faces currently visited for srcFacei to avoid multiple hits
DynamicList<label> visitedFaces(10);
forAllConstIter(labelHashSet, lowWeightFaces, iter)
{
label srcFaceI = iter.key();
label tgtFaceI = this->findTargetFace(srcFaceI);
if (tgtFaceI != -1)
label srcFacei = iter.key();
label tgtFacei = this->findTargetFace(srcFacei);
if (tgtFacei != -1)
{
//bool faceProcessed =
processSourceFace
(
srcFaceI,
tgtFaceI,
srcFacei,
tgtFacei,
nbrFaces,
visitedFaces,
@ -497,8 +497,8 @@ void Foam::faceAreaWeightAMI<SourcePatch, TargetPatch>::calculate
scalarListList& srcWeights,
labelListList& tgtAddress,
scalarListList& tgtWeights,
label srcFaceI,
label tgtFaceI
label srcFacei,
label tgtFacei
)
{
bool ok =
@ -508,8 +508,8 @@ void Foam::faceAreaWeightAMI<SourcePatch, TargetPatch>::calculate
srcWeights,
tgtAddress,
tgtWeights,
srcFaceI,
tgtFaceI
srcFacei,
tgtFacei
);
if (!ok)
@ -529,8 +529,8 @@ void Foam::faceAreaWeightAMI<SourcePatch, TargetPatch>::calculate
srcWght,
tgtAddr,
tgtWght,
srcFaceI,
tgtFaceI
srcFacei,
tgtFacei
);
if (debug && !this->srcNonOverlap_.empty())

View File

@ -78,15 +78,15 @@ protected:
List<DynamicList<scalar>>& srcWeights,
List<DynamicList<label>>& tgtAddress,
List<DynamicList<scalar>>& tgtWeights,
label srcFaceI,
label tgtFaceI
label srcFacei,
label tgtFacei
);
//- Determine overlap contributions for source face srcFaceI
//- Determine overlap contributions for source face srcFacei
virtual bool processSourceFace
(
const label srcFaceI,
const label tgtStartFaceI,
const label srcFacei,
const label tgtStartFacei,
DynamicList<label>& nbrFaces,
DynamicList<label>& visitedFaces,
List<DynamicList<label>>& srcAddr,
@ -108,8 +108,8 @@ protected:
virtual void setNextFaces
(
label& startSeedI,
label& srcFaceI,
label& tgtFaceI,
label& srcFacei,
label& tgtFacei,
const boolList& mapFlag,
labelList& seedFaces,
const DynamicList<label>& visitedFaces,
@ -122,8 +122,8 @@ protected:
//- Area of intersection between source and target faces
virtual scalar interArea
(
const label srcFaceI,
const label tgtFaceI
const label srcFacei,
const label tgtFacei
) const;
@ -164,8 +164,8 @@ public:
scalarListList& srcWeights,
labelListList& tgtAddress,
scalarListList& tgtWeights,
label srcFaceI = -1,
label tgtFaceI = -1
label srcFacei = -1,
label tgtFacei = -1
);
//- Normalise the weight. Can optionally subset addressing

View File

@ -32,17 +32,17 @@ void Foam::mapNearestAMI<SourcePatch, TargetPatch>::findNearestFace
(
const SourcePatch& srcPatch,
const TargetPatch& tgtPatch,
const label& srcFaceI,
label& tgtFaceI
const label& srcFacei,
label& tgtFacei
) const
{
const vectorField& srcCf = srcPatch.faceCentres();
const vectorField& tgtCf = tgtPatch.faceCentres();
const vector srcP = srcCf[srcFaceI];
const vector srcP = srcCf[srcFacei];
DynamicList<label> tgtFaces(10);
tgtFaces.append(tgtFaceI);
tgtFaces.append(tgtFacei);
DynamicList<label> visitedFaces(10);
@ -56,12 +56,12 @@ void Foam::mapNearestAMI<SourcePatch, TargetPatch>::findNearestFace
scalar dTest = magSqr(tgtCf[tgtI] - srcP);
if (dTest < d)
{
tgtFaceI = tgtI;
tgtFacei = tgtI;
d = dTest;
this->appendNbrFaces
(
tgtFaceI,
tgtFacei,
tgtPatch,
visitedFaces,
tgtFaces
@ -77,40 +77,40 @@ void Foam::mapNearestAMI<SourcePatch, TargetPatch>::setNextNearestFaces
(
boolList& mapFlag,
label& startSeedI,
label& srcFaceI,
label& tgtFaceI
label& srcFacei,
label& tgtFacei
) const
{
const labelList& srcNbr = this->srcPatch_.faceFaces()[srcFaceI];
const labelList& srcNbr = this->srcPatch_.faceFaces()[srcFacei];
srcFaceI = -1;
srcFacei = -1;
forAll(srcNbr, i)
{
label faceI = srcNbr[i];
if (mapFlag[faceI])
label facei = srcNbr[i];
if (mapFlag[facei])
{
srcFaceI = faceI;
startSeedI = faceI + 1;
srcFacei = facei;
startSeedI = facei + 1;
return;
}
}
forAll(mapFlag, faceI)
forAll(mapFlag, facei)
{
if (mapFlag[faceI])
if (mapFlag[facei])
{
srcFaceI = faceI;
tgtFaceI = this->findTargetFace(faceI);
srcFacei = facei;
tgtFacei = this->findTargetFace(facei);
if (tgtFaceI == -1)
if (tgtFacei == -1)
{
const vectorField& srcCf = this->srcPatch_.faceCentres();
FatalErrorInFunction
<< "Unable to find target face for source face "
<< srcFaceI << " with face centre " << srcCf[srcFaceI]
<< srcFacei << " with face centre " << srcCf[srcFacei]
<< abort(FatalError);
}
@ -123,18 +123,18 @@ void Foam::mapNearestAMI<SourcePatch, TargetPatch>::setNextNearestFaces
template<class SourcePatch, class TargetPatch>
Foam::label Foam::mapNearestAMI<SourcePatch, TargetPatch>::findMappedSrcFace
(
const label tgtFaceI,
const label tgtFacei,
const List<DynamicList<label>>& tgtToSrc
) const
{
DynamicList<label> testFaces(10);
DynamicList<label> visitedFaces(10);
testFaces.append(tgtFaceI);
testFaces.append(tgtFacei);
do
{
// search target tgtFaceI neighbours for match with source face
// search target tgtFacei neighbours for match with source face
label tgtI = testFaces.remove();
if (findIndex(visitedFaces, tgtI) == -1)
@ -208,8 +208,8 @@ void Foam::mapNearestAMI<SourcePatch, TargetPatch>::calculate
scalarListList& srcWeights,
labelListList& tgtAddress,
scalarListList& tgtWeights,
label srcFaceI,
label tgtFaceI
label srcFacei,
label tgtFacei
)
{
bool ok =
@ -219,8 +219,8 @@ void Foam::mapNearestAMI<SourcePatch, TargetPatch>::calculate
srcWeights,
tgtAddress,
tgtWeights,
srcFaceI,
tgtFaceI
srcFacei,
tgtFacei
);
if (!ok)
@ -246,22 +246,22 @@ void Foam::mapNearestAMI<SourcePatch, TargetPatch>::calculate
DynamicList<label> nonOverlapFaces;
do
{
findNearestFace(this->srcPatch_, this->tgtPatch_, srcFaceI, tgtFaceI);
findNearestFace(this->srcPatch_, this->tgtPatch_, srcFacei, tgtFacei);
srcAddr[srcFaceI].append(tgtFaceI);
tgtAddr[tgtFaceI].append(srcFaceI);
srcAddr[srcFacei].append(tgtFacei);
tgtAddr[tgtFacei].append(srcFacei);
mapFlag[srcFaceI] = false;
mapFlag[srcFacei] = false;
// Do advancing front starting from srcFaceI, tgtFaceI
// Do advancing front starting from srcFacei, tgtFacei
setNextNearestFaces
(
mapFlag,
startSeedI,
srcFaceI,
tgtFaceI
srcFacei,
tgtFacei
);
} while (srcFaceI >= 0);
} while (srcFacei >= 0);
// for the case of multiple source faces per target face, select the
@ -269,16 +269,16 @@ void Foam::mapNearestAMI<SourcePatch, TargetPatch>::calculate
const vectorField& srcCf = this->srcPatch_.faceCentres();
const vectorField& tgtCf = this->tgtPatch_.faceCentres();
forAll(tgtAddr, targetFaceI)
forAll(tgtAddr, targetFacei)
{
if (tgtAddr[targetFaceI].size() > 1)
if (tgtAddr[targetFacei].size() > 1)
{
const vector& tgtC = tgtCf[tgtFaceI];
const vector& tgtC = tgtCf[tgtFacei];
DynamicList<label>& srcFaces = tgtAddr[targetFaceI];
DynamicList<label>& srcFaces = tgtAddr[targetFacei];
label srcFaceI = srcFaces[0];
scalar d = magSqr(tgtC - srcCf[srcFaceI]);
label srcFacei = srcFaces[0];
scalar d = magSqr(tgtC - srcCf[srcFacei]);
for (label i = 1; i < srcFaces.size(); i++)
{
@ -287,35 +287,35 @@ void Foam::mapNearestAMI<SourcePatch, TargetPatch>::calculate
if (dNew < d)
{
d = dNew;
srcFaceI = srcI;
srcFacei = srcI;
}
}
srcFaces.clear();
srcFaces.append(srcFaceI);
srcFaces.append(srcFacei);
}
}
// If there are more target faces than source faces, some target faces
// might not yet be mapped
forAll(tgtAddr, tgtFaceI)
forAll(tgtAddr, tgtFacei)
{
if (tgtAddr[tgtFaceI].empty())
if (tgtAddr[tgtFacei].empty())
{
label srcFaceI = findMappedSrcFace(tgtFaceI, tgtAddr);
label srcFacei = findMappedSrcFace(tgtFacei, tgtAddr);
if (srcFaceI >= 0)
if (srcFacei >= 0)
{
// note - reversed search from src->tgt to tgt->src
findNearestFace
(
this->tgtPatch_,
this->srcPatch_,
tgtFaceI,
srcFaceI
tgtFacei,
srcFacei
);
tgtAddr[tgtFaceI].append(srcFaceI);
tgtAddr[tgtFacei].append(srcFacei);
}
}
}

View File

@ -64,13 +64,13 @@ private:
// Marching front
//- Find nearest target face for source face srcFaceI
//- Find nearest target face for source face srcFacei
void findNearestFace
(
const SourcePatch& srcPatch,
const TargetPatch& tgtPatch,
const label& srcFaceI,
label& tgtFaceI
const label& srcFacei,
label& tgtFacei
) const;
//- Determine next source-target face pair
@ -78,14 +78,14 @@ private:
(
boolList& mapFlag,
label& startSeedI,
label& srcFaceI,
label& tgtFaceI
label& srcFacei,
label& tgtFacei
) const;
//- Find mapped source face
label findMappedSrcFace
(
const label tgtFaceI,
const label tgtFacei,
const List<DynamicList<label>>& tgtToSrc
) const;
@ -95,8 +95,8 @@ private:
//- Area of intersection between source and target faces
scalar interArea
(
const label srcFaceI,
const label tgtFaceI
const label srcFacei,
const label tgtFacei
) const;
@ -136,8 +136,8 @@ public:
scalarListList& srcWeights,
labelListList& tgtAddress,
scalarListList& tgtWeights,
label srcFaceI = -1,
label tgtFaceI = -1
label srcFacei = -1,
label tgtFacei = -1
);
//- Normalise the weight. Can optionally subset addressing

View File

@ -31,8 +31,8 @@ template<class SourcePatch, class TargetPatch>
void Foam::partialFaceAreaWeightAMI<SourcePatch, TargetPatch>::setNextFaces
(
label& startSeedI,
label& srcFaceI,
label& tgtFaceI,
label& srcFacei,
label& tgtFacei,
const boolList& mapFlag,
labelList& seedFaces,
const DynamicList<label>& visitedFaces,
@ -42,8 +42,8 @@ void Foam::partialFaceAreaWeightAMI<SourcePatch, TargetPatch>::setNextFaces
faceAreaWeightAMI<SourcePatch, TargetPatch>::setNextFaces
(
startSeedI,
srcFaceI,
tgtFaceI,
srcFacei,
tgtFacei,
mapFlag,
seedFaces,
visitedFaces,
@ -104,8 +104,8 @@ void Foam::partialFaceAreaWeightAMI<SourcePatch, TargetPatch>::calculate
scalarListList& srcWeights,
labelListList& tgtAddress,
scalarListList& tgtWeights,
label srcFaceI,
label tgtFaceI
label srcFacei,
label tgtFacei
)
{
bool ok =
@ -115,8 +115,8 @@ void Foam::partialFaceAreaWeightAMI<SourcePatch, TargetPatch>::calculate
srcWeights,
tgtAddress,
tgtWeights,
srcFaceI,
tgtFaceI
srcFacei,
tgtFacei
);
if (!ok)
@ -136,8 +136,8 @@ void Foam::partialFaceAreaWeightAMI<SourcePatch, TargetPatch>::calculate
srcWght,
tgtAddr,
tgtWght,
srcFaceI,
tgtFaceI
srcFacei,
tgtFacei
);
// transfer data to persistent storage

View File

@ -68,8 +68,8 @@ private:
virtual void setNextFaces
(
label& startSeedI,
label& srcFaceI,
label& tgtFaceI,
label& srcFacei,
label& tgtFacei,
const boolList& mapFlag,
labelList& seedFaces,
const DynamicList<label>& visitedFaces,
@ -119,8 +119,8 @@ public:
scalarListList& srcWeights,
labelListList& tgtAddress,
scalarListList& tgtWeights,
label srcFaceI = -1,
label tgtFaceI = -1
label srcFacei = -1,
label tgtFacei = -1
);
};

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2013 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2013-2016 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -134,8 +134,8 @@ public:
//- Return neighbour point patch
const cyclicACMIPointPatch& neighbPatch() const
{
label patchI = cyclicACMIPolyPatch_.neighbPatchID();
const pointPatch& pp = this->boundaryMesh()[patchI];
label patchi = cyclicACMIPolyPatch_.neighbPatchID();
const pointPatch& pp = this->boundaryMesh()[patchi];
return refCast<const cyclicACMIPointPatch>(pp);
}

View File

@ -39,8 +39,8 @@ Foam::cyclicACMIPointPatchField<Type>::cyclicACMIPointPatchField
:
coupledPointPatchField<Type>(p, iF),
cyclicACMIPatch_(refCast<const cyclicACMIPointPatch>(p)),
ppiPtr_(NULL),
nbrPpiPtr_(NULL)
ppiPtr_(nullptr),
nbrPpiPtr_(nullptr)
{}
@ -54,8 +54,8 @@ Foam::cyclicACMIPointPatchField<Type>::cyclicACMIPointPatchField
:
coupledPointPatchField<Type>(p, iF, dict),
cyclicACMIPatch_(refCast<const cyclicACMIPointPatch>(p)),
ppiPtr_(NULL),
nbrPpiPtr_(NULL)
ppiPtr_(nullptr),
nbrPpiPtr_(nullptr)
{
if (!isType<cyclicACMIPointPatch>(p))
{
@ -80,8 +80,8 @@ Foam::cyclicACMIPointPatchField<Type>::cyclicACMIPointPatchField
:
coupledPointPatchField<Type>(ptf, p, iF, mapper),
cyclicACMIPatch_(refCast<const cyclicACMIPointPatch>(p)),
ppiPtr_(NULL),
nbrPpiPtr_(NULL)
ppiPtr_(nullptr),
nbrPpiPtr_(nullptr)
{
if (!isType<cyclicACMIPointPatch>(this->patch()))
{
@ -104,8 +104,8 @@ Foam::cyclicACMIPointPatchField<Type>::cyclicACMIPointPatchField
:
coupledPointPatchField<Type>(ptf, iF),
cyclicACMIPatch_(ptf.cyclicACMIPatch_),
ppiPtr_(NULL),
nbrPpiPtr_(NULL)
ppiPtr_(nullptr),
nbrPpiPtr_(nullptr)
{}
@ -131,7 +131,7 @@ void Foam::cyclicACMIPointPatchField<Type>::swapAddSeparated
const GeometricField<Type, pointPatchField, pointMesh>& fld =
refCast<const GeometricField<Type, pointPatchField, pointMesh>>
(
this->dimensionedInternalField()
this->internalField()
);
const cyclicACMIPointPatchField<Type>& nbr =

View File

@ -62,10 +62,19 @@ void Foam::cyclicACMIPolyPatch::resetAMI
{
if (debug)
{
Pout<< "cyclicACMIPolyPatch::resetAMI : detected cell centres."
<< " Clearing cell centres to guarantee closed volumes"
Pout<< "cyclicACMIPolyPatch::resetAMI : clearing cellCentres"
<< " for " << name() << " and " << nonOverlapPatch.name()
<< endl;
}
//WarningInFunction
// << "The mesh already has cellCentres calculated when"
// << " resetting ACMI " << name() << "." << endl
// << "This is a problem since ACMI adapts the face areas"
// << " (to close cells) so this has" << endl
// << "to be done before cell centre calculation." << endl
// << "This can happen if e.g. the cyclicACMI is after"
// << " any processor patches in the boundary." << endl;
const_cast<polyMesh&>
(
boundaryMesh().mesh()

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -127,8 +127,8 @@ public:
//- Return neighbour point patch
const cyclicAMIPointPatch& neighbPatch() const
{
label patchI = cyclicAMIPolyPatch_.neighbPatchID();
const pointPatch& pp = this->boundaryMesh()[patchI];
label patchi = cyclicAMIPolyPatch_.neighbPatchID();
const pointPatch& pp = this->boundaryMesh()[patchi];
return refCast<const cyclicAMIPointPatch>(pp);
}

View File

@ -39,8 +39,8 @@ Foam::cyclicAMIPointPatchField<Type>::cyclicAMIPointPatchField
:
coupledPointPatchField<Type>(p, iF),
cyclicAMIPatch_(refCast<const cyclicAMIPointPatch>(p)),
ppiPtr_(NULL),
nbrPpiPtr_(NULL)
ppiPtr_(nullptr),
nbrPpiPtr_(nullptr)
{}
@ -54,8 +54,8 @@ Foam::cyclicAMIPointPatchField<Type>::cyclicAMIPointPatchField
:
coupledPointPatchField<Type>(p, iF, dict),
cyclicAMIPatch_(refCast<const cyclicAMIPointPatch>(p)),
ppiPtr_(NULL),
nbrPpiPtr_(NULL)
ppiPtr_(nullptr),
nbrPpiPtr_(nullptr)
{
if (!isType<cyclicAMIPointPatch>(p))
{
@ -80,8 +80,8 @@ Foam::cyclicAMIPointPatchField<Type>::cyclicAMIPointPatchField
:
coupledPointPatchField<Type>(ptf, p, iF, mapper),
cyclicAMIPatch_(refCast<const cyclicAMIPointPatch>(p)),
ppiPtr_(NULL),
nbrPpiPtr_(NULL)
ppiPtr_(nullptr),
nbrPpiPtr_(nullptr)
{
if (!isType<cyclicAMIPointPatch>(this->patch()))
{
@ -104,8 +104,8 @@ Foam::cyclicAMIPointPatchField<Type>::cyclicAMIPointPatchField
:
coupledPointPatchField<Type>(ptf, iF),
cyclicAMIPatch_(ptf.cyclicAMIPatch_),
ppiPtr_(NULL),
nbrPpiPtr_(NULL)
ppiPtr_(nullptr),
nbrPpiPtr_(nullptr)
{}
@ -131,7 +131,7 @@ void Foam::cyclicAMIPointPatchField<Type>::swapAddSeparated
const GeometricField<Type, pointPatchField, pointMesh>& fld =
refCast<const GeometricField<Type, pointPatchField, pointMesh>>
(
this->dimensionedInternalField()
this->internalField()
);
const cyclicAMIPointPatchField<Type>& nbr =

View File

@ -56,18 +56,18 @@ Foam::vector Foam::cyclicAMIPolyPatch::findFaceNormalMaxRadius
const scalarField magRadSqr(magSqr(n));
label faceI = findMax(magRadSqr);
label facei = findMax(magRadSqr);
if (debug)
{
Info<< "findFaceMaxRadius(const pointField&) : patch: " << name() << nl
<< " rotFace = " << faceI << nl
<< " point = " << faceCentres[faceI] << nl
<< " distance = " << Foam::sqrt(magRadSqr[faceI])
<< " rotFace = " << facei << nl
<< " point = " << faceCentres[facei] << nl
<< " distance = " << Foam::sqrt(magRadSqr[facei])
<< endl;
}
return n[faceI];
return n[facei];
}
@ -494,12 +494,12 @@ Foam::cyclicAMIPolyPatch::cyclicAMIPolyPatch
rotationAngleDefined_(false),
rotationAngle_(0.0),
separationVector_(Zero),
AMIPtr_(NULL),
AMIPtr_(nullptr),
AMIMethod_(AMIPatchToPatchInterpolation::imFaceAreaWeight),
AMIReverse_(false),
AMIRequireMatch_(true),
AMILowWeightCorrection_(-1.0),
surfPtr_(NULL),
surfPtr_(nullptr),
surfDict_(fileName("surface"))
{
// Neighbour patch might not be valid yet so no transformation
@ -525,7 +525,7 @@ Foam::cyclicAMIPolyPatch::cyclicAMIPolyPatch
rotationAngleDefined_(false),
rotationAngle_(0.0),
separationVector_(Zero),
AMIPtr_(NULL),
AMIPtr_(nullptr),
AMIMethod_
(
AMIPatchToPatchInterpolation::wordTointerpolationMethod
@ -543,7 +543,7 @@ Foam::cyclicAMIPolyPatch::cyclicAMIPolyPatch
AMIReverse_(dict.lookupOrDefault<bool>("flipNormals", false)),
AMIRequireMatch_(true),
AMILowWeightCorrection_(dict.lookupOrDefault("lowWeightCorrection", -1.0)),
surfPtr_(NULL),
surfPtr_(nullptr),
surfDict_(dict.subOrEmptyDict("surface"))
{
if (nbrPatchName_ == word::null && !coupleGroup_.valid())
@ -628,12 +628,12 @@ Foam::cyclicAMIPolyPatch::cyclicAMIPolyPatch
rotationAngleDefined_(pp.rotationAngleDefined_),
rotationAngle_(pp.rotationAngle_),
separationVector_(pp.separationVector_),
AMIPtr_(NULL),
AMIPtr_(nullptr),
AMIMethod_(pp.AMIMethod_),
AMIReverse_(pp.AMIReverse_),
AMIRequireMatch_(pp.AMIRequireMatch_),
AMILowWeightCorrection_(pp.AMILowWeightCorrection_),
surfPtr_(NULL),
surfPtr_(nullptr),
surfDict_(pp.surfDict_)
{
// Neighbour patch might not be valid yet so no transformation
@ -660,12 +660,12 @@ Foam::cyclicAMIPolyPatch::cyclicAMIPolyPatch
rotationAngleDefined_(pp.rotationAngleDefined_),
rotationAngle_(pp.rotationAngle_),
separationVector_(pp.separationVector_),
AMIPtr_(NULL),
AMIPtr_(nullptr),
AMIMethod_(pp.AMIMethod_),
AMIReverse_(pp.AMIReverse_),
AMIRequireMatch_(pp.AMIRequireMatch_),
AMILowWeightCorrection_(pp.AMILowWeightCorrection_),
surfPtr_(NULL),
surfPtr_(nullptr),
surfDict_(pp.surfDict_)
{
if (nbrPatchName_ == name())
@ -699,12 +699,12 @@ Foam::cyclicAMIPolyPatch::cyclicAMIPolyPatch
rotationAngleDefined_(pp.rotationAngleDefined_),
rotationAngle_(pp.rotationAngle_),
separationVector_(pp.separationVector_),
AMIPtr_(NULL),
AMIPtr_(nullptr),
AMIMethod_(pp.AMIMethod_),
AMIReverse_(pp.AMIReverse_),
AMIRequireMatch_(pp.AMIRequireMatch_),
AMILowWeightCorrection_(pp.AMILowWeightCorrection_),
surfPtr_(NULL),
surfPtr_(nullptr),
surfDict_(pp.surfDict_)
{}
@ -867,7 +867,7 @@ void Foam::cyclicAMIPolyPatch::transformPosition(pointField& l) const
void Foam::cyclicAMIPolyPatch::transformPosition
(
point& l,
const label faceI
const label facei
) const
{
if (!parallel())
@ -876,7 +876,7 @@ void Foam::cyclicAMIPolyPatch::transformPosition
(
forwardT().size() == 1
? forwardT()[0]
: forwardT()[faceI]
: forwardT()[facei]
);
if (transform() == ROTATIONAL)
@ -894,7 +894,7 @@ void Foam::cyclicAMIPolyPatch::transformPosition
(
separation().size() == 1
? separation()[0]
: separation()[faceI]
: separation()[facei]
);
l -= s;
@ -905,7 +905,7 @@ void Foam::cyclicAMIPolyPatch::transformPosition
void Foam::cyclicAMIPolyPatch::reverseTransformPosition
(
point& l,
const label faceI
const label facei
) const
{
if (!parallel())
@ -914,7 +914,7 @@ void Foam::cyclicAMIPolyPatch::reverseTransformPosition
(
reverseT().size() == 1
? reverseT()[0]
: reverseT()[faceI]
: reverseT()[facei]
);
if (transform() == ROTATIONAL)
@ -932,7 +932,7 @@ void Foam::cyclicAMIPolyPatch::reverseTransformPosition
(
separation().size() == 1
? separation()[0]
: separation()[faceI]
: separation()[facei]
);
l += s;
@ -943,7 +943,7 @@ void Foam::cyclicAMIPolyPatch::reverseTransformPosition
void Foam::cyclicAMIPolyPatch::reverseTransformDirection
(
vector& d,
const label faceI
const label facei
) const
{
if (!parallel())
@ -952,7 +952,7 @@ void Foam::cyclicAMIPolyPatch::reverseTransformDirection
(
reverseT().size() == 1
? reverseT()[0]
: reverseT()[faceI]
: reverseT()[facei]
);
d = Foam::transform(T, d);
@ -1010,48 +1010,48 @@ bool Foam::cyclicAMIPolyPatch::order
Foam::label Foam::cyclicAMIPolyPatch::pointFace
(
const label faceI,
const label facei,
const vector& n,
point& p
) const
{
point prt(p);
reverseTransformPosition(prt, faceI);
reverseTransformPosition(prt, facei);
vector nrt(n);
reverseTransformDirection(nrt, faceI);
reverseTransformDirection(nrt, facei);
label nbrFaceI = -1;
label nbrFacei = -1;
if (owner())
{
nbrFaceI = AMI().tgtPointFace
nbrFacei = AMI().tgtPointFace
(
*this,
neighbPatch(),
nrt,
faceI,
facei,
prt
);
}
else
{
nbrFaceI = neighbPatch().AMI().srcPointFace
nbrFacei = neighbPatch().AMI().srcPointFace
(
neighbPatch(),
*this,
nrt,
faceI,
facei,
prt
);
}
if (nbrFaceI >= 0)
if (nbrFacei >= 0)
{
p = prt;
}
return nbrFaceI;
return nbrFacei;
}

View File

@ -329,21 +329,21 @@ public:
virtual void transformPosition
(
point& l,
const label faceI
const label facei
) const;
//- Transform a patch-based position from this side to nbr side
virtual void reverseTransformPosition
(
point& l,
const label faceI
const label facei
) const;
//- Transform a patch-based direction from this side to nbr side
virtual void reverseTransformDirection
(
vector& d,
const label faceI
const label facei
) const;
@ -413,7 +413,7 @@ public:
// following trajectory vector n
label pointFace
(
const label faceI,
const label facei,
const vector& n,
point& p
) const;

View File

@ -47,8 +47,8 @@ SourceFiles
#ifndef FaceCellWave_H
#define FaceCellWave_H
#include "boolList.H"
#include "labelList.H"
#include "PackedBoolList.H"
#include "DynamicList.H"
#include "primitiveFieldsFwd.H"
#include "labelPair.H"
@ -77,13 +77,26 @@ class FaceCellWave
:
public FaceCellWaveName
{
private:
// Private Member Functions
//- Disallow default bitwise copy construct
FaceCellWave(const FaceCellWave&);
//- Disallow default bitwise assignment
void operator=(const FaceCellWave&);
protected:
// Private data
//- Reference to mesh
const polyMesh& mesh_;
//- Optional boundary faces that information should travel through
const List<labelPair> explicitConnections_;
const labelPairList explicitConnections_;
//- Information for all faces
UList<Type>& allFaceInfo_;
@ -95,18 +108,17 @@ class FaceCellWave
TrackingData& td_;
//- Has face changed
boolList changedFace_;
PackedBoolList changedFace_;
//- List of changed faces
labelList changedFaces_;
DynamicList<label> changedFaces_;
//- Number of changed faces
label nChangedFaces_;
//- Has cell changed
PackedBoolList changedCell_;
// Cells that have changed
boolList changedCell_;
labelList changedCells_;
label nChangedCells_;
DynamicList<label> changedCells_;
//- Contains cyclics
const bool hasCyclicPatches_;
@ -122,21 +134,12 @@ class FaceCellWave
label nUnvisitedFaces_;
// Private Member Functions
//- Disallow default bitwise copy construct
FaceCellWave(const FaceCellWave&);
//- Disallow default bitwise assignment
void operator=(const FaceCellWave&);
//- Updates cellInfo with information from neighbour. Updates all
// statistics.
bool updateCell
(
const label cellI,
const label neighbourFaceI,
const label celli,
const label neighbourFacei,
const Type& neighbourInfo,
const scalar tol,
Type& cellInfo
@ -146,8 +149,8 @@ class FaceCellWave
// statistics.
bool updateFace
(
const label faceI,
const label neighbourCellI,
const label facei,
const label neighbourCelli,
const Type& neighbourInfo,
const scalar tol,
Type& faceInfo
@ -157,7 +160,7 @@ class FaceCellWave
// statistics.
bool updateFace
(
const label faceI,
const label facei,
const Type& neighbourInfo,
const scalar tol,
Type& faceInfo
@ -186,7 +189,7 @@ class FaceCellWave
label getChangedPatchFaces
(
const polyPatch& patch,
const label startFaceI,
const label startFacei,
const label nFaces,
labelList& changedPatchFaces,
List<Type>& changedPatchFacesInfo
@ -301,7 +304,7 @@ public:
FaceCellWave
(
const polyMesh&,
const List<labelPair>& explicitConnections,
const labelPairList& explicitConnections,
const bool handleCyclicAMI,
const labelList& initialChangedFaces,
const List<Type>& changedFacesInfo,
@ -312,6 +315,11 @@ public:
);
//- Destructor
virtual ~FaceCellWave()
{}
// Member Functions
// Access
@ -362,17 +370,16 @@ public:
//- Propagate from face to cell. Returns total number of cells
// (over all processors) changed.
label faceToCell();
virtual label faceToCell();
//- Propagate from cell to face. Returns total number of faces
// (over all processors) changed. (Faces on processorpatches are
// counted double)
label cellToFace();
virtual label cellToFace();
//- Iterate until no changes or maxIter reached. Returns actual
// number of iterations.
label iterate(const label maxIter);
virtual label iterate(const label maxIter);
};

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -67,7 +67,7 @@ bool Foam::PatchEdgeFaceWave<PrimitivePatchType, Type, TrackingData>::
updateEdge
(
const label edgeI,
const label neighbourFaceI,
const label neighbourFacei,
const Type& neighbourInfo,
Type& edgeInfo
)
@ -82,7 +82,7 @@ updateEdge
mesh_,
patch_,
edgeI,
neighbourFaceI,
neighbourFacei,
neighbourInfo,
propagationTol_,
td_
@ -106,7 +106,7 @@ updateEdge
}
// Update info for faceI, at position pt, with information from
// Update info for facei, at position pt, with information from
// neighbouring edge.
// Updates:
// - changedFace_, changedFaces_,
@ -120,7 +120,7 @@ template
bool Foam::PatchEdgeFaceWave<PrimitivePatchType, Type, TrackingData>::
updateFace
(
const label faceI,
const label facei,
const label neighbourEdgeI,
const Type& neighbourInfo,
Type& faceInfo
@ -135,7 +135,7 @@ updateFace
(
mesh_,
patch_,
faceI,
facei,
neighbourEdgeI,
neighbourInfo,
propagationTol_,
@ -144,10 +144,10 @@ updateFace
if (propagate)
{
if (!changedFace_[faceI])
if (!changedFace_[facei])
{
changedFace_[faceI] = true;
changedFaces_.append(faceI);
changedFace_[facei] = true;
changedFaces_.append(facei);
}
}
@ -493,23 +493,23 @@ faceToEdge()
changedEdges_.clear();
changedEdge_ = false;
forAll(changedFaces_, changedFaceI)
forAll(changedFaces_, changedFacei)
{
label faceI = changedFaces_[changedFaceI];
label facei = changedFaces_[changedFacei];
if (!changedFace_[faceI])
if (!changedFace_[facei])
{
FatalErrorInFunction
<< "face " << faceI
<< "face " << facei
<< " not marked as having been changed" << nl
<< "This might be caused by multiple occurences of the same"
<< " seed edge." << abort(FatalError);
}
const Type& neighbourWallInfo = allFaceInfo_[faceI];
const Type& neighbourWallInfo = allFaceInfo_[facei];
// Evaluate all connected edges
const labelList& fEdges = patch_.faceEdges()[faceI];
const labelList& fEdges = patch_.faceEdges()[facei];
forAll(fEdges, fEdgeI)
{
@ -522,7 +522,7 @@ faceToEdge()
updateEdge
(
edgeI,
faceI,
facei,
neighbourWallInfo,
currentWallInfo
);
@ -576,17 +576,17 @@ edgeToFace()
// Evaluate all connected faces
const labelList& eFaces = edgeFaces[edgeI];
forAll(eFaces, eFaceI)
forAll(eFaces, eFacei)
{
label faceI = eFaces[eFaceI];
label facei = eFaces[eFacei];
Type& currentWallInfo = allFaceInfo_[faceI];
Type& currentWallInfo = allFaceInfo_[facei];
if (!currentWallInfo.equal(neighbourWallInfo, td_))
{
updateFace
(
faceI,
facei,
edgeI,
neighbourWallInfo,
currentWallInfo

View File

@ -133,7 +133,7 @@ class PatchEdgeFaceWave
bool updateEdge
(
const label edgeI,
const label neighbourFaceI,
const label neighbourFacei,
const Type& neighbourInfo,
Type& edgeInfo
);
@ -142,7 +142,7 @@ class PatchEdgeFaceWave
// statistics.
bool updateFace
(
const label faceI,
const label facei,
const label neighbourEdgeI,
const Type& neighbourInfo,
Type& faceInfo

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -48,9 +48,19 @@ namespace Foam
{
// Forward declaration of classes
class polyPatch;
class polyMesh;
// Forward declaration of friend functions and operators
class patchEdgeFaceInfo;
Istream& operator>>(Istream&, patchEdgeFaceInfo&);
Ostream& operator<<(Ostream&, const patchEdgeFaceInfo&);
/*---------------------------------------------------------------------------*\
Class patchEdgeFaceInfo Declaration
\*---------------------------------------------------------------------------*/
@ -139,7 +149,7 @@ public:
const polyMesh& mesh,
const primitivePatch& patch,
const label edgeI,
const label faceI,
const label facei,
const patchEdgeFaceInfo& faceInfo,
const scalar tol,
TrackingData& td
@ -163,7 +173,7 @@ public:
(
const polyMesh& mesh,
const primitivePatch& patch,
const label faceI,
const label facei,
const label edgeI,
const patchEdgeFaceInfo& edgeInfo,
const scalar tol,

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -186,7 +186,7 @@ inline bool Foam::patchEdgeFaceInfo::updateEdge
const polyMesh& mesh,
const primitivePatch& patch,
const label edgeI,
const label faceI,
const label facei,
const patchEdgeFaceInfo& faceInfo,
const scalar tol,
TrackingData& td
@ -223,14 +223,14 @@ inline bool Foam::patchEdgeFaceInfo::updateFace
(
const polyMesh& mesh,
const primitivePatch& patch,
const label faceI,
const label facei,
const label edgeI,
const patchEdgeFaceInfo& edgeInfo,
const scalar tol,
TrackingData& td
)
{
return update(patch.faceCentres()[faceI], edgeInfo, tol, td);
return update(patch.faceCentres()[facei], edgeInfo, tol, td);
}

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2012-2013 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2012-2016 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -53,6 +53,15 @@ namespace Foam
class polyPatch;
class polyMesh;
// Forward declaration of friend functions and operators
class patchEdgeFaceRegion;
Istream& operator>>(Istream&, patchEdgeFaceRegion&);
Ostream& operator<<(Ostream&, const patchEdgeFaceRegion&);
/*---------------------------------------------------------------------------*\
Class patchEdgeFaceRegion Declaration
\*---------------------------------------------------------------------------*/
@ -120,7 +129,7 @@ public:
const polyMesh& mesh,
const indirectPrimitivePatch& patch,
const label edgeI,
const label faceI,
const label facei,
const patchEdgeFaceRegion& faceInfo,
const scalar tol,
TrackingData& td
@ -144,7 +153,7 @@ public:
(
const polyMesh& mesh,
const indirectPrimitivePatch& patch,
const label faceI,
const label facei,
const label edgeI,
const patchEdgeFaceRegion& edgeInfo,
const scalar tol,

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2012-2015 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2012-2016 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -122,7 +122,7 @@ inline bool Foam::patchEdgeFaceRegion::updateEdge
const polyMesh& mesh,
const indirectPrimitivePatch& patch,
const label edgeI,
const label faceI,
const label facei,
const patchEdgeFaceRegion& faceInfo,
const scalar tol,
TrackingData& td
@ -152,7 +152,7 @@ inline bool Foam::patchEdgeFaceRegion::updateFace
(
const polyMesh& mesh,
const indirectPrimitivePatch& patch,
const label faceI,
const label facei,
const label edgeI,
const patchEdgeFaceRegion& edgeInfo,
const scalar tol,

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2013-2015 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2013-2016 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -51,6 +51,15 @@ namespace Foam
// Forward declaration of classes
class polyMesh;
// Forward declaration of friend functions and operators
class patchEdgeFaceRegions;
Istream& operator>>(Istream&, patchEdgeFaceRegions&);
Ostream& operator<<(Ostream&, const patchEdgeFaceRegions&);
/*---------------------------------------------------------------------------*\
Class patchEdgeFaceRegions Declaration
\*---------------------------------------------------------------------------*/
@ -108,7 +117,7 @@ public:
const polyMesh& mesh,
const Patch& patch,
const label edgeI,
const label faceI,
const label facei,
const patchEdgeFaceRegions& faceInfo,
const scalar tol,
TrackingData& td
@ -132,7 +141,7 @@ public:
(
const polyMesh& mesh,
const Patch& patch,
const label faceI,
const label facei,
const label edgeI,
const patchEdgeFaceRegions& edgeInfo,
const scalar tol,

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2013-2015 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2013-2016 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -85,16 +85,16 @@ inline bool Foam::patchEdgeFaceRegions::updateEdge
const polyMesh& mesh,
const Patch& patch,
const label edgeI,
const label faceI,
const label facei,
const patchEdgeFaceRegions& faceInfo,
const scalar tol,
TrackingData& td
)
{
const face& f = patch.localFaces()[faceI];
const face& f = patch.localFaces()[facei];
const edge& e = patch.edges()[edgeI];
label index = findIndex(patch.faceEdges()[faceI], edgeI);
label index = findIndex(patch.faceEdges()[facei], edgeI);
bool sameOrientation = (f[index] == e.start());
// Get information in edge-order
@ -188,18 +188,18 @@ inline bool Foam::patchEdgeFaceRegions::updateFace
(
const polyMesh& mesh,
const Patch& patch,
const label faceI,
const label facei,
const label edgeI,
const patchEdgeFaceRegions& edgeInfo,
const scalar tol,
TrackingData& td
)
{
const face& f = patch.localFaces()[faceI];
const face& f = patch.localFaces()[facei];
const edge& e = patch.edges()[edgeI];
// Find starting point of edge on face.
label index0 = findIndex(patch.faceEdges()[faceI], edgeI);
label index0 = findIndex(patch.faceEdges()[facei], edgeI);
label index1 = f.fcIndex(index0);
bool sameOrientation = (f[index0] == e.start());

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -59,8 +59,8 @@ void Foam::patchPatchDist::correct()
label nBnd = 0;
forAllConstIter(labelHashSet, nbrPatchIDs_, iter)
{
label nbrPatchI = iter.key();
const polyPatch& nbrPatch = patch_.boundaryMesh()[nbrPatchI];
label nbrPatchi = iter.key();
const polyPatch& nbrPatch = patch_.boundaryMesh()[nbrPatchi];
nBnd += nbrPatch.nEdges()-nbrPatch.nInternalEdges();
}
@ -70,8 +70,8 @@ void Foam::patchPatchDist::correct()
forAllConstIter(labelHashSet, nbrPatchIDs_, iter)
{
label nbrPatchI = iter.key();
const polyPatch& nbrPatch = patch_.boundaryMesh()[nbrPatchI];
label nbrPatchi = iter.key();
const polyPatch& nbrPatch = patch_.boundaryMesh()[nbrPatchi];
const labelList& nbrMp = nbrPatch.meshPoints();
for
@ -83,7 +83,7 @@ void Foam::patchPatchDist::correct()
{
const edge& e = nbrPatch.edges()[edgeI];
const edge meshE = edge(nbrMp[e[0]], nbrMp[e[1]]);
nbrEdges.insert(meshE, nbrPatchI);
nbrEdges.insert(meshE, nbrPatchi);
}
}
@ -156,11 +156,11 @@ void Foam::patchPatchDist::correct()
// Extract into *this
setSize(patch_.size());
nUnset_ = 0;
forAll(allFaceInfo, faceI)
forAll(allFaceInfo, facei)
{
if (allFaceInfo[faceI].valid(calc.data()))
if (allFaceInfo[facei].valid(calc.data()))
{
operator[](faceI) = Foam::sqrt(allFaceInfo[faceI].distSqr());
operator[](facei) = Foam::sqrt(allFaceInfo[facei].distSqr());
}
else
{

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -83,11 +83,11 @@ void Foam::PointEdgeWave<Type, TrackingData>::leaveDomain
forAll(patchPointLabels, i)
{
label patchPointI = patchPointLabels[i];
label patchPointi = patchPointLabels[i];
const point& pt = patch.points()[meshPoints[patchPointI]];
const point& pt = patch.points()[meshPoints[patchPointi]];
pointInfo[i].leaveDomain(patch, patchPointI, pt, td_);
pointInfo[i].leaveDomain(patch, patchPointi, pt, td_);
}
}
@ -105,11 +105,11 @@ void Foam::PointEdgeWave<Type, TrackingData>::enterDomain
forAll(patchPointLabels, i)
{
label patchPointI = patchPointLabels[i];
label patchPointi = patchPointLabels[i];
const point& pt = patch.points()[meshPoints[patchPointI]];
const point& pt = patch.points()[meshPoints[patchPointi]];
pointInfo[i].enterDomain(patch, patchPointI, pt, td_);
pointInfo[i].enterDomain(patch, patchPointi, pt, td_);
}
}
@ -148,7 +148,7 @@ void Foam::PointEdgeWave<Type, TrackingData>::transform
}
// Update info for pointI, at position pt, with information from
// Update info for pointi, at position pt, with information from
// neighbouring edge.
// Updates:
// - changedPoint_, changedPoints_, nChangedPoints_,
@ -156,7 +156,7 @@ void Foam::PointEdgeWave<Type, TrackingData>::transform
template<class Type, class TrackingData>
bool Foam::PointEdgeWave<Type, TrackingData>::updatePoint
(
const label pointI,
const label pointi,
const label neighbourEdgeI,
const Type& neighbourInfo,
Type& pointInfo
@ -170,7 +170,7 @@ bool Foam::PointEdgeWave<Type, TrackingData>::updatePoint
pointInfo.updatePoint
(
mesh_,
pointI,
pointi,
neighbourEdgeI,
neighbourInfo,
propagationTol_,
@ -179,10 +179,10 @@ bool Foam::PointEdgeWave<Type, TrackingData>::updatePoint
if (propagate)
{
if (!changedPoint_[pointI])
if (!changedPoint_[pointi])
{
changedPoint_[pointI] = true;
changedPoints_[nChangedPoints_++] = pointI;
changedPoint_[pointi] = true;
changedPoints_[nChangedPoints_++] = pointi;
}
}
@ -195,7 +195,7 @@ bool Foam::PointEdgeWave<Type, TrackingData>::updatePoint
}
// Update info for pointI, at position pt, with information from
// Update info for pointi, at position pt, with information from
// same point.
// Updates:
// - changedPoint_, changedPoints_, nChangedPoints_,
@ -203,7 +203,7 @@ bool Foam::PointEdgeWave<Type, TrackingData>::updatePoint
template<class Type, class TrackingData>
bool Foam::PointEdgeWave<Type, TrackingData>::updatePoint
(
const label pointI,
const label pointi,
const Type& neighbourInfo,
Type& pointInfo
)
@ -216,7 +216,7 @@ bool Foam::PointEdgeWave<Type, TrackingData>::updatePoint
pointInfo.updatePoint
(
mesh_,
pointI,
pointi,
neighbourInfo,
propagationTol_,
td_
@ -224,10 +224,10 @@ bool Foam::PointEdgeWave<Type, TrackingData>::updatePoint
if (propagate)
{
if (!changedPoint_[pointI])
if (!changedPoint_[pointi])
{
changedPoint_[pointI] = true;
changedPoints_[nChangedPoints_++] = pointI;
changedPoint_[pointi] = true;
changedPoints_[nChangedPoints_++] = pointi;
}
}
@ -249,7 +249,7 @@ template<class Type, class TrackingData>
bool Foam::PointEdgeWave<Type, TrackingData>::updateEdge
(
const label edgeI,
const label neighbourPointI,
const label neighbourPointi,
const Type& neighbourInfo,
Type& edgeInfo
)
@ -263,7 +263,7 @@ bool Foam::PointEdgeWave<Type, TrackingData>::updateEdge
(
mesh_,
edgeI,
neighbourPointI,
neighbourPointi,
neighbourInfo,
propagationTol_,
td_
@ -294,9 +294,9 @@ Foam::label Foam::PointEdgeWave<Type, TrackingData>::countPatchType() const
{
label nPatches = 0;
forAll(mesh_.boundaryMesh(), patchI)
forAll(mesh_.boundaryMesh(), patchi)
{
if (isA<PatchType>(mesh_.boundaryMesh()[patchI]))
if (isA<PatchType>(mesh_.boundaryMesh()[patchi]))
{
nPatches++;
}
@ -319,9 +319,9 @@ void Foam::PointEdgeWave<Type, TrackingData>::handleProcPatches()
forAll(mesh_.globalData().processorPatches(), i)
{
label patchI = mesh_.globalData().processorPatches()[i];
label patchi = mesh_.globalData().processorPatches()[i];
const processorPolyPatch& procPatch =
refCast<const processorPolyPatch>(mesh_.boundaryMesh()[patchI]);
refCast<const processorPolyPatch>(mesh_.boundaryMesh()[patchi]);
patchInfo.clear();
patchInfo.reserve(procPatch.nPoints());
@ -332,14 +332,14 @@ void Foam::PointEdgeWave<Type, TrackingData>::handleProcPatches()
// Get all changed points in reverse order
const labelList& neighbPoints = procPatch.neighbPoints();
forAll(neighbPoints, thisPointI)
forAll(neighbPoints, thisPointi)
{
label meshPointI = procPatch.meshPoints()[thisPointI];
if (changedPoint_[meshPointI])
label meshPointi = procPatch.meshPoints()[thisPointi];
if (changedPoint_[meshPointi])
{
patchInfo.append(allPointInfo_[meshPointI]);
thisPoints.append(thisPointI);
nbrPoints.append(neighbPoints[thisPointI]);
patchInfo.append(allPointInfo_[meshPointi]);
thisPoints.append(thisPointi);
nbrPoints.append(neighbPoints[thisPointi]);
}
}
@ -348,7 +348,7 @@ void Foam::PointEdgeWave<Type, TrackingData>::handleProcPatches()
//if (debug)
//{
// Pout<< "Processor patch " << patchI << ' ' << procPatch.name()
// Pout<< "Processor patch " << patchi << ' ' << procPatch.name()
// << " communicating with " << procPatch.neighbProcNo()
// << " Sending:" << patchInfo.size() << endl;
//}
@ -366,9 +366,9 @@ void Foam::PointEdgeWave<Type, TrackingData>::handleProcPatches()
forAll(mesh_.globalData().processorPatches(), i)
{
label patchI = mesh_.globalData().processorPatches()[i];
label patchi = mesh_.globalData().processorPatches()[i];
const processorPolyPatch& procPatch =
refCast<const processorPolyPatch>(mesh_.boundaryMesh()[patchI]);
refCast<const processorPolyPatch>(mesh_.boundaryMesh()[patchi]);
List<Type> patchInfo;
labelList patchPoints;
@ -380,7 +380,7 @@ void Foam::PointEdgeWave<Type, TrackingData>::handleProcPatches()
//if (debug)
//{
// Pout<< "Processor patch " << patchI << ' ' << procPatch.name()
// Pout<< "Processor patch " << patchi << ' ' << procPatch.name()
// << " communicating with " << procPatch.neighbProcNo()
// << " Received:" << patchInfo.size() << endl;
//}
@ -398,15 +398,15 @@ void Foam::PointEdgeWave<Type, TrackingData>::handleProcPatches()
const labelList& meshPoints = procPatch.meshPoints();
forAll(patchInfo, i)
{
label meshPointI = meshPoints[patchPoints[i]];
label meshPointi = meshPoints[patchPoints[i]];
if (!allPointInfo_[meshPointI].equal(patchInfo[i], td_))
if (!allPointInfo_[meshPointi].equal(patchInfo[i], td_))
{
updatePoint
(
meshPointI,
meshPointi,
patchInfo[i],
allPointInfo_[meshPointI]
allPointInfo_[meshPointi]
);
}
}
@ -428,9 +428,9 @@ void Foam::PointEdgeWave<Type, TrackingData>::handleCyclicPatches()
DynamicList<label> nbrPoints;
DynamicList<label> thisPoints;
forAll(mesh_.boundaryMesh(), patchI)
forAll(mesh_.boundaryMesh(), patchi)
{
const polyPatch& patch = mesh_.boundaryMesh()[patchI];
const polyPatch& patch = mesh_.boundaryMesh()[patchi];
if (isA<cyclicPolyPatch>(patch))
{
@ -452,15 +452,15 @@ void Foam::PointEdgeWave<Type, TrackingData>::handleCyclicPatches()
forAll(pairs, pairI)
{
label thisPointI = pairs[pairI][0];
label nbrPointI = pairs[pairI][1];
label meshPointI = meshPoints[nbrPointI];
label thisPointi = pairs[pairI][0];
label nbrPointi = pairs[pairI][1];
label meshPointi = meshPoints[nbrPointi];
if (changedPoint_[meshPointI])
if (changedPoint_[meshPointi])
{
nbrInfo.append(allPointInfo_[meshPointI]);
nbrPoints.append(nbrPointI);
thisPoints.append(thisPointI);
nbrInfo.append(allPointInfo_[meshPointi]);
nbrPoints.append(nbrPointi);
thisPoints.append(thisPointi);
}
}
@ -479,7 +479,7 @@ void Foam::PointEdgeWave<Type, TrackingData>::handleCyclicPatches()
//if (debug)
//{
// Pout<< "Cyclic patch " << patchI << ' ' << patch.name()
// Pout<< "Cyclic patch " << patchi << ' ' << patch.name()
// << " Changed : " << nbrInfo.size()
// << endl;
//}
@ -491,15 +491,15 @@ void Foam::PointEdgeWave<Type, TrackingData>::handleCyclicPatches()
const labelList& meshPoints = cycPatch.meshPoints();
forAll(nbrInfo, i)
{
label meshPointI = meshPoints[thisPoints[i]];
label meshPointi = meshPoints[thisPoints[i]];
if (!allPointInfo_[meshPointI].equal(nbrInfo[i], td_))
if (!allPointInfo_[meshPointi].equal(nbrInfo[i], td_))
{
updatePoint
(
meshPointI,
meshPointi,
nbrInfo[i],
allPointInfo_[meshPointI]
allPointInfo_[meshPointi]
);
}
}
@ -522,9 +522,9 @@ Foam::label Foam::PointEdgeWave<Type, TrackingData>::handleCollocatedPoints()
const labelListList& slaves = gmd.globalPointSlaves();
List<Type> elems(slavesMap.constructSize());
forAll(meshPoints, pointI)
forAll(meshPoints, pointi)
{
elems[pointI] = allPointInfo_[meshPoints[pointI]];
elems[pointi] = allPointInfo_[meshPoints[pointi]];
}
// Pull slave data onto master (which might or might not have any
@ -534,11 +534,11 @@ Foam::label Foam::PointEdgeWave<Type, TrackingData>::handleCollocatedPoints()
// Combine master data with slave data
combineEqOp<Type, TrackingData> cop(td_);
forAll(slaves, pointI)
forAll(slaves, pointi)
{
Type& elem = elems[pointI];
Type& elem = elems[pointi];
const labelList& slavePoints = slaves[pointI];
const labelList& slavePoints = slaves[pointi];
// Combine master with untransformed slave data
forAll(slavePoints, j)
@ -557,23 +557,23 @@ Foam::label Foam::PointEdgeWave<Type, TrackingData>::handleCollocatedPoints()
slavesMap.reverseDistribute(elems.size(), elems, false);
// Extract back onto mesh
forAll(meshPoints, pointI)
forAll(meshPoints, pointi)
{
if (elems[pointI].valid(td_))
if (elems[pointi].valid(td_))
{
label meshPointI = meshPoints[pointI];
label meshPointi = meshPoints[pointi];
Type& elem = allPointInfo_[meshPointI];
Type& elem = allPointInfo_[meshPointi];
bool wasValid = elem.valid(td_);
// Like updatePoint but bypass Type::updatePoint with its tolerance
// checking
//if (!elem.valid(td_) || !elem.equal(elems[pointI], td_))
if (!elem.equal(elems[pointI], td_))
//if (!elem.valid(td_) || !elem.equal(elems[pointi], td_))
if (!elem.equal(elems[pointi], td_))
{
nEvals_++;
elem = elems[pointI];
elem = elems[pointi];
// See if element now valid
if (!wasValid && elem.valid(td_))
@ -582,10 +582,10 @@ Foam::label Foam::PointEdgeWave<Type, TrackingData>::handleCollocatedPoints()
}
// Update database of changed points
if (!changedPoint_[meshPointI])
if (!changedPoint_[meshPointi])
{
changedPoint_[meshPointI] = true;
changedPoints_[nChangedPoints_++] = meshPointI;
changedPoint_[meshPointi] = true;
changedPoints_[nChangedPoints_++] = meshPointi;
}
}
}
@ -735,27 +735,27 @@ void Foam::PointEdgeWave<Type, TrackingData>::setPointInfo
const List<Type>& changedPointsInfo
)
{
forAll(changedPoints, changedPointI)
forAll(changedPoints, changedPointi)
{
label pointI = changedPoints[changedPointI];
label pointi = changedPoints[changedPointi];
bool wasValid = allPointInfo_[pointI].valid(td_);
bool wasValid = allPointInfo_[pointi].valid(td_);
// Copy info for pointI
allPointInfo_[pointI] = changedPointsInfo[changedPointI];
// Copy info for pointi
allPointInfo_[pointi] = changedPointsInfo[changedPointi];
// Maintain count of unset points
if (!wasValid && allPointInfo_[pointI].valid(td_))
if (!wasValid && allPointInfo_[pointi].valid(td_))
{
--nUnvisitedPoints_;
}
// Mark pointI as changed, both on list and on point itself.
// Mark pointi as changed, both on list and on point itself.
if (!changedPoint_[pointI])
if (!changedPoint_[pointi])
{
changedPoint_[pointI] = true;
changedPoints_[nChangedPoints_++] = pointI;
changedPoint_[pointi] = true;
changedPoints_[nChangedPoints_++] = pointi;
}
}
@ -848,27 +848,27 @@ Foam::label Foam::PointEdgeWave<Type, TrackingData>::pointToEdge()
for
(
label changedPointI = 0;
changedPointI < nChangedPoints_;
changedPointI++
label changedPointi = 0;
changedPointi < nChangedPoints_;
changedPointi++
)
{
label pointI = changedPoints_[changedPointI];
label pointi = changedPoints_[changedPointi];
if (!changedPoint_[pointI])
if (!changedPoint_[pointi])
{
FatalErrorInFunction
<< "Point " << pointI
<< "Point " << pointi
<< " not marked as having been changed" << nl
<< "This might be caused by multiple occurences of the same"
<< " seed point." << abort(FatalError);
}
const Type& neighbourWallInfo = allPointInfo_[pointI];
const Type& neighbourWallInfo = allPointInfo_[pointi];
// Evaluate all connected edges
const labelList& edgeLabels = pointEdges[pointI];
const labelList& edgeLabels = pointEdges[pointi];
forAll(edgeLabels, edgeLabelI)
{
label edgeI = edgeLabels[edgeLabelI];
@ -880,7 +880,7 @@ Foam::label Foam::PointEdgeWave<Type, TrackingData>::pointToEdge()
updateEdge
(
edgeI,
pointI,
pointi,
neighbourWallInfo,
currentWallInfo
);
@ -888,7 +888,7 @@ Foam::label Foam::PointEdgeWave<Type, TrackingData>::pointToEdge()
}
// Reset status of point
changedPoint_[pointI] = false;
changedPoint_[pointi] = false;
}
// Handled all changed points by now

View File

@ -168,7 +168,7 @@ class PointEdgeWave
// statistics.
bool updatePoint
(
const label pointI,
const label pointi,
const label neighbourEdgeI,
const Type& neighbourInfo,
Type& pointInfo
@ -178,7 +178,7 @@ class PointEdgeWave
// statistics.
bool updatePoint
(
const label pointI,
const label pointi,
const Type& neighbourInfo,
Type& pointInfo
);
@ -188,7 +188,7 @@ class PointEdgeWave
bool updateEdge
(
const label edgeI,
const label neighbourPointI,
const label neighbourPointi,
const Type& neighbourInfo,
Type& edgeInfo
);

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -53,6 +53,15 @@ namespace Foam
class polyPatch;
class polyMesh;
// Forward declaration of friend functions and operators
class pointEdgePoint;
Istream& operator>>(Istream&, pointEdgePoint&);
Ostream& operator<<(Ostream&, const pointEdgePoint&);
/*---------------------------------------------------------------------------*\
Class pointEdgePoint Declaration
\*---------------------------------------------------------------------------*/
@ -138,7 +147,7 @@ public:
inline void leaveDomain
(
const polyPatch& patch,
const label patchPointI,
const label patchPointi,
const point& pos,
TrackingData& td
);
@ -148,7 +157,7 @@ public:
inline void enterDomain
(
const polyPatch& patch,
const label patchPointI,
const label patchPointi,
const point& pos,
TrackingData& td
);
@ -166,7 +175,7 @@ public:
inline bool updatePoint
(
const polyMesh& mesh,
const label pointI,
const label pointi,
const label edgeI,
const pointEdgePoint& edgeInfo,
const scalar tol,
@ -179,7 +188,7 @@ public:
inline bool updatePoint
(
const polyMesh& mesh,
const label pointI,
const label pointi,
const pointEdgePoint& newPointInfo,
const scalar tol,
TrackingData& td
@ -201,7 +210,7 @@ public:
(
const polyMesh& mesh,
const label edgeI,
const label pointI,
const label pointi,
const pointEdgePoint& pointInfo,
const scalar tol,
TrackingData& td

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -199,7 +199,7 @@ template<class TrackingData>
inline void Foam::pointEdgePoint::leaveDomain
(
const polyPatch& patch,
const label patchPointI,
const label patchPointi,
const point& coord,
TrackingData& td
)
@ -225,7 +225,7 @@ template<class TrackingData>
inline void Foam::pointEdgePoint::enterDomain
(
const polyPatch& patch,
const label patchPointI,
const label patchPointi,
const point& coord,
TrackingData& td
)
@ -240,14 +240,14 @@ template<class TrackingData>
inline bool Foam::pointEdgePoint::updatePoint
(
const polyMesh& mesh,
const label pointI,
const label pointi,
const label edgeI,
const pointEdgePoint& edgeInfo,
const scalar tol,
TrackingData& td
)
{
return update(mesh.points()[pointI], edgeInfo, tol, td);
return update(mesh.points()[pointi], edgeInfo, tol, td);
}
@ -256,13 +256,13 @@ template<class TrackingData>
inline bool Foam::pointEdgePoint::updatePoint
(
const polyMesh& mesh,
const label pointI,
const label pointi,
const pointEdgePoint& newPointInfo,
const scalar tol,
TrackingData& td
)
{
return update(mesh.points()[pointI], newPointInfo, tol, td);
return update(mesh.points()[pointi], newPointInfo, tol, td);
}
@ -285,7 +285,7 @@ inline bool Foam::pointEdgePoint::updateEdge
(
const polyMesh& mesh,
const label edgeI,
const label pointI,
const label pointi,
const pointEdgePoint& pointInfo,
const scalar tol,
TrackingData& td

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -105,13 +105,13 @@ Foam::boolList Foam::cellClassification::markFaces
{
const labelList& myFaces = mesh_.edgeFaces()[edgeI];
forAll(myFaces, myFaceI)
forAll(myFaces, myFacei)
{
label faceI = myFaces[myFaceI];
label facei = myFaces[myFacei];
if (!cutFace[faceI])
if (!cutFace[facei])
{
cutFace[faceI] = true;
cutFace[facei] = true;
nCutFaces++;
}
@ -131,19 +131,19 @@ Foam::boolList Foam::cellClassification::markFaces
labelList allFaces(mesh_.nFaces() - nCutFaces);
label allFaceI = 0;
label allFacei = 0;
forAll(cutFace, faceI)
forAll(cutFace, facei)
{
if (!cutFace[faceI])
if (!cutFace[facei])
{
allFaces[allFaceI++] = faceI;
allFaces[allFacei++] = facei;
}
}
if (debug)
{
Pout<< "Testing " << allFaceI << " faces for piercing by surface"
Pout<< "Testing " << allFacei << " faces for piercing by surface"
<< endl;
}
@ -208,11 +208,11 @@ Foam::boolList Foam::cellClassification::markFaces
}
else
{
label faceI = faceTree.shapes().faceLabels()[pHit.index()];
label facei = faceTree.shapes().faceLabels()[pHit.index()];
if (!cutFace[faceI])
if (!cutFace[facei])
{
cutFace[faceI] = true;
cutFace[facei] = true;
nAddFaces++;
}
@ -258,16 +258,16 @@ void Foam::cellClassification::markCells
List<cellInfo> cellInfoList(mesh_.nCells());
// Mark cut cells first
forAll(piercedFace, faceI)
forAll(piercedFace, facei)
{
if (piercedFace[faceI])
if (piercedFace[facei])
{
cellInfoList[mesh_.faceOwner()[faceI]] =
cellInfoList[mesh_.faceOwner()[facei]] =
cellInfo(cellClassification::CUT);
if (mesh_.isInternalFace(faceI))
if (mesh_.isInternalFace(facei))
{
cellInfoList[mesh_.faceNeighbour()[faceI]] =
cellInfoList[mesh_.faceNeighbour()[facei]] =
cellInfo(cellClassification::CUT);
}
}
@ -283,9 +283,9 @@ void Foam::cellClassification::markCells
forAll(outsidePts, outsidePtI)
{
// Use linear search for points.
label cellI = queryMesh.findCell(outsidePts[outsidePtI], -1, false);
label celli = queryMesh.findCell(outsidePts[outsidePtI], -1, false);
if (returnReduce(cellI, maxOp<label>()) == -1)
if (returnReduce(celli, maxOp<label>()) == -1)
{
FatalErrorInFunction
<< "outsidePoint " << outsidePts[outsidePtI]
@ -294,15 +294,15 @@ void Foam::cellClassification::markCells
<< exit(FatalError);
}
if (cellI >= 0)
if (celli >= 0)
{
cellInfoList[cellI] = cellInfo(cellClassification::OUTSIDE);
cellInfoList[celli] = cellInfo(cellClassification::OUTSIDE);
// Mark faces of cellI
const labelList& myFaces = mesh_.cells()[cellI];
forAll(myFaces, myFaceI)
// Mark faces of celli
const labelList& myFaces = mesh_.cells()[celli];
forAll(myFaces, myFacei)
{
outsideFacesMap.insert(myFaces[myFaceI]);
outsideFacesMap.insert(myFaces[myFacei]);
}
}
}
@ -332,15 +332,15 @@ void Foam::cellClassification::markCells
// Get information out of cellInfoList
const List<cellInfo>& allInfo = cellInfoCalc.allCellInfo();
forAll(allInfo, cellI)
forAll(allInfo, celli)
{
label t = allInfo[cellI].type();
label t = allInfo[celli].type();
if (t == cellClassification::NOTSET)
{
t = cellClassification::INSIDE;
}
operator[](cellI) = t;
operator[](celli) = t;
}
}
@ -354,11 +354,11 @@ void Foam::cellClassification::classifyPoints
{
pointSide.setSize(mesh_.nPoints());
forAll(mesh_.pointCells(), pointI)
forAll(mesh_.pointCells(), pointi)
{
const labelList& pCells = mesh_.pointCells()[pointI];
const labelList& pCells = mesh_.pointCells()[pointi];
pointSide[pointI] = UNSET;
pointSide[pointi] = UNSET;
forAll(pCells, i)
{
@ -366,26 +366,26 @@ void Foam::cellClassification::classifyPoints
if (type == meshType)
{
if (pointSide[pointI] == UNSET)
if (pointSide[pointi] == UNSET)
{
pointSide[pointI] = MESH;
pointSide[pointi] = MESH;
}
else if (pointSide[pointI] == NONMESH)
else if (pointSide[pointi] == NONMESH)
{
pointSide[pointI] = MIXED;
pointSide[pointi] = MIXED;
break;
}
}
else
{
if (pointSide[pointI] == UNSET)
if (pointSide[pointi] == UNSET)
{
pointSide[pointI] = NONMESH;
pointSide[pointi] = NONMESH;
}
else if (pointSide[pointI] == MESH)
else if (pointSide[pointi] == MESH)
{
pointSide[pointI] = MIXED;
pointSide[pointi] = MIXED;
break;
}
@ -398,16 +398,16 @@ void Foam::cellClassification::classifyPoints
bool Foam::cellClassification::usesMixedPointsOnly
(
const List<pointStatus>& pointSide,
const label cellI
const label celli
) const
{
const faceList& faces = mesh_.faces();
const cell& cFaces = mesh_.cells()[cellI];
const cell& cFaces = mesh_.cells()[celli];
forAll(cFaces, cFaceI)
forAll(cFaces, cFacei)
{
const face& f = faces[cFaces[cFaceI]];
const face& f = faces[cFaces[cFacei]];
forAll(f, fp)
{
@ -440,33 +440,33 @@ void Foam::cellClassification::getMeshOutside
// Get faces on interface between meshType and non-meshType
for (label faceI = 0; faceI < mesh_.nInternalFaces(); faceI++)
for (label facei = 0; facei < mesh_.nInternalFaces(); facei++)
{
label ownType = operator[](own[faceI]);
label nbrType = operator[](nbr[faceI]);
label ownType = operator[](own[facei]);
label nbrType = operator[](nbr[facei]);
if (ownType == meshType && nbrType != meshType)
{
outsideFaces[outsideI] = faces[faceI];
outsideOwner[outsideI] = own[faceI]; // meshType cell
outsideFaces[outsideI] = faces[facei];
outsideOwner[outsideI] = own[facei]; // meshType cell
outsideI++;
}
else if (ownType != meshType && nbrType == meshType)
{
outsideFaces[outsideI] = faces[faceI];
outsideOwner[outsideI] = nbr[faceI]; // meshType cell
outsideFaces[outsideI] = faces[facei];
outsideOwner[outsideI] = nbr[facei]; // meshType cell
outsideI++;
}
}
// Get faces on outside of real mesh with cells of meshType.
for (label faceI = mesh_.nInternalFaces(); faceI < mesh_.nFaces(); faceI++)
for (label facei = mesh_.nInternalFaces(); facei < mesh_.nFaces(); facei++)
{
if (operator[](own[faceI]) == meshType)
if (operator[](own[facei]) == meshType)
{
outsideFaces[outsideI] = faces[faceI];
outsideOwner[outsideI] = own[faceI]; // meshType cell
outsideFaces[outsideI] = faces[facei];
outsideOwner[outsideI] = own[facei]; // meshType cell
outsideI++;
}
}
@ -541,17 +541,17 @@ Foam::label Foam::cellClassification::trimCutCells
labelList newCellType(*this);
// // Split types into outside and rest
// forAll(*this, cellI)
// forAll(*this, celli)
// {
// label type = operator[](cellI);
// label type = operator[](celli);
//
// if (type == meshType)
// {
// newCellType[cellI] = type;
// newCellType[celli] = type;
// }
// else
// {
// newCellType[cellI] = fillType;
// newCellType[celli] = fillType;
// }
// }
@ -568,12 +568,12 @@ Foam::label Foam::cellClassification::trimCutCells
classifyPoints(meshType, newCellType, pointSide);
// Grow layer of outside cells
forAll(pointSide, pointI)
forAll(pointSide, pointi)
{
if (pointSide[pointI] == MIXED)
if (pointSide[pointi] == MIXED)
{
// Make cut
const labelList& pCells = mesh_.pointCells()[pointI];
const labelList& pCells = mesh_.pointCells()[pointi];
forAll(pCells, i)
{
@ -597,15 +597,15 @@ Foam::label Foam::cellClassification::trimCutCells
label nChanged = 0;
forAll(newCellType, cellI)
forAll(newCellType, celli)
{
if (operator[](cellI) == cellClassification::CUT)
if (operator[](celli) == cellClassification::CUT)
{
if (newCellType[cellI] != meshType)
if (newCellType[celli] != meshType)
{
// Cell was cutCell but further than nLayers away from
// meshType. Convert to fillType.
operator[](cellI) = fillType;
operator[](celli) = fillType;
nChanged++;
}
}
@ -626,18 +626,18 @@ Foam::label Foam::cellClassification::growSurface
// Mark points used by meshType cells
forAll(mesh_.pointCells(), pointI)
forAll(mesh_.pointCells(), pointi)
{
const labelList& myCells = mesh_.pointCells()[pointI];
const labelList& myCells = mesh_.pointCells()[pointi];
// Check if one of cells has meshType
forAll(myCells, myCellI)
forAll(myCells, myCelli)
{
label type = operator[](myCells[myCellI]);
label type = operator[](myCells[myCelli]);
if (type == meshType)
{
hasMeshType[pointI] = true;
hasMeshType[pointi] = true;
break;
}
@ -648,17 +648,17 @@ Foam::label Foam::cellClassification::growSurface
label nChanged = 0;
forAll(hasMeshType, pointI)
forAll(hasMeshType, pointi)
{
if (hasMeshType[pointI])
if (hasMeshType[pointi])
{
const labelList& myCells = mesh_.pointCells()[pointI];
const labelList& myCells = mesh_.pointCells()[pointi];
forAll(myCells, myCellI)
forAll(myCells, myCelli)
{
if (operator[](myCells[myCellI]) != meshType)
if (operator[](myCells[myCelli]) != meshType)
{
operator[](myCells[myCellI]) = fillType;
operator[](myCells[myCelli]) = fillType;
nChanged++;
}
@ -693,21 +693,21 @@ Foam::label Foam::cellClassification::fillHangingCells
// Check all cells using mixed point type for whether they use mixed
// points only. Note: could probably speed this up by counting number
// of mixed verts per face and mixed faces per cell or something?
forAll(pointSide, pointI)
forAll(pointSide, pointi)
{
if (pointSide[pointI] == MIXED)
if (pointSide[pointi] == MIXED)
{
const labelList& pCells = mesh_.pointCells()[pointI];
const labelList& pCells = mesh_.pointCells()[pointi];
forAll(pCells, i)
{
label cellI = pCells[i];
label celli = pCells[i];
if (operator[](cellI) == meshType)
if (operator[](celli) == meshType)
{
if (usesMixedPointsOnly(pointSide, cellI))
if (usesMixedPointsOnly(pointSide, celli))
{
operator[](cellI) = fillType;
operator[](celli) = fillType;
nChanged++;
}
@ -768,9 +768,9 @@ Foam::label Foam::cellClassification::fillRegionEdges
forAll(eFaces, i)
{
label patchFaceI = eFaces[i];
label patchFacei = eFaces[i];
label ownerCell = outsideOwner[patchFaceI];
label ownerCell = outsideOwner[patchFacei];
if (operator[](ownerCell) == meshType)
{
@ -832,17 +832,17 @@ Foam::label Foam::cellClassification::fillRegionPoints
forAllConstIter(labelHashSet, nonManifoldPoints, iter)
{
// Find a face on fp using point and remove it.
const label patchPointI = meshPointMap[iter.key()];
const label patchPointi = meshPointMap[iter.key()];
const labelList& pFaces = fp.pointFaces()[patchPointI];
const labelList& pFaces = fp.pointFaces()[patchPointi];
// Remove any face using conflicting point. Does first face which
// has not yet been done. Could be more intelligent and decide which
// one would be best to remove.
forAll(pFaces, i)
{
const label patchFaceI = pFaces[i];
const label ownerCell = outsideOwner[patchFaceI];
const label patchFacei = pFaces[i];
const label ownerCell = outsideOwner[patchFacei];
if (operator[](ownerCell) == meshType)
{

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -183,7 +183,7 @@ private:
bool usesMixedPointsOnly
(
const List<pointStatus>&,
const label cellI
const label celli
) const;
//- Get faces (and its 'owner') inbetween cells of differing type

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -48,6 +48,15 @@ namespace Foam
class polyPatch;
class polyMesh;
// Forward declaration of friend functions and operators
class cellInfo;
Istream& operator>>(Istream&, cellInfo&);
Ostream& operator<<(Ostream&, const cellInfo&);
/*---------------------------------------------------------------------------*\
Class cellInfo Declaration
\*---------------------------------------------------------------------------*/
@ -67,10 +76,10 @@ class cellInfo
inline bool update
(
const cellInfo& w2,
const label thisFaceI,
const label thisCellI,
const label neighbourFaceI,
const label neighbourCellI,
const label thisFacei,
const label thisCelli,
const label neighbourFacei,
const label neighbourCelli,
TrackingData& td
);
@ -122,7 +131,7 @@ public:
(
const polyMesh&,
const polyPatch& patch,
const label patchFaceI,
const label patchFacei,
const point& faceCentre,
TrackingData& td
);
@ -133,7 +142,7 @@ public:
(
const polyMesh&,
const polyPatch& patch,
const label patchFaceI,
const label patchFacei,
const point& faceCentre,
TrackingData& td
);
@ -152,8 +161,8 @@ public:
inline bool updateCell
(
const polyMesh&,
const label thisCellI,
const label neighbourFaceI,
const label thisCelli,
const label neighbourFacei,
const cellInfo& neighbourInfo,
const scalar tol,
TrackingData& td
@ -164,8 +173,8 @@ public:
inline bool updateFace
(
const polyMesh&,
const label thisFaceI,
const label neighbourCellI,
const label thisFacei,
const label neighbourCelli,
const cellInfo& neighbourInfo,
const scalar tol,
TrackingData& td
@ -176,7 +185,7 @@ public:
inline bool updateFace
(
const polyMesh&,
const label thisFaceI,
const label thisFacei,
const cellInfo& neighbourInfo,
const scalar tol,
TrackingData& td

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -33,10 +33,10 @@ template<class TrackingData>
inline bool Foam::cellInfo::update
(
const cellInfo& w2,
const label thisFaceI,
const label thisCellI,
const label neighbourFaceI,
const label neighbourCellI,
const label thisFacei,
const label thisCelli,
const label neighbourFacei,
const label neighbourCelli,
TrackingData& td
)
{
@ -49,10 +49,10 @@ inline bool Foam::cellInfo::update
FatalErrorInFunction
<< "Problem: trying to propagate NOTSET or CUT type:" << w2.type()
<< " into cell/face with type:" << type() << endl
<< "thisFaceI:" << thisFaceI
<< " thisCellI:" << thisCellI
<< " neighbourFaceI:" << neighbourFaceI
<< " neighbourCellI:" << neighbourCellI
<< "thisFacei:" << thisFacei
<< " thisCelli:" << thisCelli
<< " neighbourFacei:" << neighbourFacei
<< " neighbourCelli:" << neighbourCelli
<< abort(FatalError);
return false;
}
@ -80,10 +80,10 @@ inline bool Foam::cellInfo::update
FatalErrorInFunction
<< "Problem: trying to propagate conflicting types:" << w2.type()
<< " into cell/face with type:" << type() << endl
<< "thisFaceI:" << thisFaceI
<< " thisCellI:" << thisCellI
<< " neighbourFaceI:" << neighbourFaceI
<< " neighbourCellI:" << neighbourCellI
<< "thisFacei:" << thisFacei
<< " thisCelli:" << thisCelli
<< " neighbourFacei:" << neighbourFacei
<< " neighbourCelli:" << neighbourCelli
<< abort(FatalError);
return false;
@ -143,7 +143,7 @@ inline void Foam::cellInfo::leaveDomain
(
const polyMesh&,
const polyPatch& patch,
const label patchFaceI,
const label patchFacei,
const point& faceCentre,
TrackingData& td
)
@ -167,7 +167,7 @@ inline void Foam::cellInfo::enterDomain
(
const polyMesh&,
const polyPatch& patch,
const label patchFaceI,
const label patchFacei,
const point& faceCentre,
TrackingData& td
)
@ -179,8 +179,8 @@ template<class TrackingData>
inline bool Foam::cellInfo::updateCell
(
const polyMesh&,
const label thisCellI,
const label neighbourFaceI,
const label thisCelli,
const label neighbourFacei,
const cellInfo& neighbourInfo,
const scalar tol,
TrackingData& td
@ -190,8 +190,8 @@ inline bool Foam::cellInfo::updateCell
(
neighbourInfo,
-1,
thisCellI,
neighbourFaceI,
thisCelli,
neighbourFacei,
-1,
td
);
@ -203,8 +203,8 @@ template<class TrackingData>
inline bool Foam::cellInfo::updateFace
(
const polyMesh&,
const label thisFaceI,
const label neighbourCellI,
const label thisFacei,
const label neighbourCelli,
const cellInfo& neighbourInfo,
const scalar tol,
TrackingData& td
@ -213,10 +213,10 @@ inline bool Foam::cellInfo::updateFace
return update
(
neighbourInfo,
thisFaceI,
thisFacei,
-1,
-1,
neighbourCellI,
neighbourCelli,
td
);
}
@ -226,7 +226,7 @@ template<class TrackingData>
inline bool Foam::cellInfo::updateFace
(
const polyMesh&,
const label thisFaceI,
const label thisFacei,
const cellInfo& neighbourInfo,
const scalar tol,
TrackingData& td
@ -235,7 +235,7 @@ inline bool Foam::cellInfo::updateFace
return update
(
neighbourInfo,
thisFaceI,
thisFacei,
-1,
-1,
-1,

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -85,24 +85,24 @@ Foam::scalar Foam::cellDistFuncs::smallestDist
const polyPatch& patch,
const label nWallFaces,
const labelList& wallFaces,
label& minFaceI
label& minFacei
) const
{
const pointField& points = patch.points();
scalar minDist = GREAT;
minFaceI = -1;
minFacei = -1;
for (label wallFaceI = 0; wallFaceI < nWallFaces; wallFaceI++)
for (label wallFacei = 0; wallFacei < nWallFaces; wallFacei++)
{
label patchFaceI = wallFaces[wallFaceI];
label patchFacei = wallFaces[wallFacei];
pointHit curHit = patch[patchFaceI].nearestPoint(p, points);
pointHit curHit = patch[patchFacei].nearestPoint(p, points);
if (curHit.distance() < minDist)
{
minDist = curHit.distance();
minFaceI = patch.start() + patchFaceI;
minFacei = patch.start() + patchFacei;
}
}
@ -110,23 +110,23 @@ Foam::scalar Foam::cellDistFuncs::smallestDist
}
// Get point neighbours of faceI (including faceI). Returns number of faces.
// Get point neighbours of facei (including facei). Returns number of faces.
// Note: does not allocate storage but does use linear search to determine
// uniqueness. For polygonal faces this might be quite inefficient.
Foam::label Foam::cellDistFuncs::getPointNeighbours
(
const primitivePatch& patch,
const label patchFaceI,
const label patchFacei,
labelList& neighbours
) const
{
label nNeighbours = 0;
// Add myself
neighbours[nNeighbours++] = patchFaceI;
neighbours[nNeighbours++] = patchFacei;
// Add all face neighbours
const labelList& faceNeighbours = patch.faceFaces()[patchFaceI];
const labelList& faceNeighbours = patch.faceFaces()[patchFacei];
forAll(faceNeighbours, faceNeighbourI)
{
@ -141,22 +141,22 @@ Foam::label Foam::cellDistFuncs::getPointNeighbours
// Assumes that point-only neighbours are not using multiple points on
// face.
const face& f = patch.localFaces()[patchFaceI];
const face& f = patch.localFaces()[patchFacei];
forAll(f, fp)
{
label pointI = f[fp];
label pointi = f[fp];
const labelList& pointNbs = patch.pointFaces()[pointI];
const labelList& pointNbs = patch.pointFaces()[pointi];
forAll(pointNbs, nbI)
{
label faceI = pointNbs[nbI];
label facei = pointNbs[nbI];
// Check for faceI in edge-neighbours part of neighbours
if (findIndex(nEdgeNbs, neighbours, faceI) == -1)
// Check for facei in edge-neighbours part of neighbours
if (findIndex(nEdgeNbs, neighbours, facei) == -1)
{
neighbours[nNeighbours++] = faceI;
neighbours[nNeighbours++] = facei;
}
}
}
@ -187,7 +187,7 @@ Foam::label Foam::cellDistFuncs::getPointNeighbours
if (!nbs.found(nb))
{
SeriousErrorInFunction
<< "getPointNeighbours : patchFaceI:" << patchFaceI
<< "getPointNeighbours : patchFacei:" << patchFacei
<< " verts:" << f << endl;
forAll(f, fp)
@ -232,11 +232,11 @@ Foam::label Foam::cellDistFuncs::maxPatchSize
{
label maxSize = 0;
forAll(mesh().boundaryMesh(), patchI)
forAll(mesh().boundaryMesh(), patchi)
{
if (patchIDs.found(patchI))
if (patchIDs.found(patchi))
{
const polyPatch& patch = mesh().boundaryMesh()[patchI];
const polyPatch& patch = mesh().boundaryMesh()[patchi];
maxSize = Foam::max(maxSize, patch.size());
}
@ -254,11 +254,11 @@ const
{
label sum = 0;
forAll(mesh().boundaryMesh(), patchI)
forAll(mesh().boundaryMesh(), patchi)
{
if (patchIDs.found(patchI))
if (patchIDs.found(patchi))
{
const polyPatch& patch = mesh().boundaryMesh()[patchI];
const polyPatch& patch = mesh().boundaryMesh()[patchi];
sum += patch.size();
}
@ -285,37 +285,37 @@ void Foam::cellDistFuncs::correctBoundaryFaceCells
const vectorField& cellCentres = mesh().cellCentres();
const labelList& faceOwner = mesh().faceOwner();
forAll(mesh().boundaryMesh(), patchI)
forAll(mesh().boundaryMesh(), patchi)
{
if (patchIDs.found(patchI))
if (patchIDs.found(patchi))
{
const polyPatch& patch = mesh().boundaryMesh()[patchI];
const polyPatch& patch = mesh().boundaryMesh()[patchi];
// Check cells with face on wall
forAll(patch, patchFaceI)
forAll(patch, patchFacei)
{
label nNeighbours = getPointNeighbours
(
patch,
patchFaceI,
patchFacei,
neighbours
);
label cellI = faceOwner[patch.start() + patchFaceI];
label celli = faceOwner[patch.start() + patchFacei];
label minFaceI = -1;
label minFacei = -1;
wallDistCorrected[cellI] = smallestDist
wallDistCorrected[celli] = smallestDist
(
cellCentres[cellI],
cellCentres[celli],
patch,
nNeighbours,
neighbours,
minFaceI
minFacei
);
// Store wallCell and its nearest neighbour
nearestFace.insert(cellI, minFaceI);
nearestFace.insert(celli, minFacei);
}
}
}
@ -335,42 +335,42 @@ void Foam::cellDistFuncs::correctBoundaryPointCells
const vectorField& cellCentres = mesh().cellCentres();
forAll(mesh().boundaryMesh(), patchI)
forAll(mesh().boundaryMesh(), patchi)
{
if (patchIDs.found(patchI))
if (patchIDs.found(patchi))
{
const polyPatch& patch = mesh().boundaryMesh()[patchI];
const polyPatch& patch = mesh().boundaryMesh()[patchi];
const labelList& meshPoints = patch.meshPoints();
const labelListList& pointFaces = patch.pointFaces();
forAll(meshPoints, meshPointI)
forAll(meshPoints, meshPointi)
{
label vertI = meshPoints[meshPointI];
label vertI = meshPoints[meshPointi];
const labelList& neighbours = mesh().pointCells(vertI);
forAll(neighbours, neighbourI)
{
label cellI = neighbours[neighbourI];
label celli = neighbours[neighbourI];
if (!nearestFace.found(cellI))
if (!nearestFace.found(celli))
{
const labelList& wallFaces = pointFaces[meshPointI];
const labelList& wallFaces = pointFaces[meshPointi];
label minFaceI = -1;
label minFacei = -1;
wallDistCorrected[cellI] = smallestDist
wallDistCorrected[celli] = smallestDist
(
cellCentres[cellI],
cellCentres[celli],
patch,
wallFaces.size(),
wallFaces,
minFaceI
minFacei
);
// Store wallCell and its nearest neighbour
nearestFace.insert(cellI, minFaceI);
nearestFace.insert(celli, minFacei);
}
}
}

View File

@ -116,14 +116,14 @@ public:
const polyPatch& patch,
const label nWallFaces,
const labelList& wallFaces,
label& meshFaceI
label& meshFacei
) const;
//- Get faces sharing point with face on patch
label getPointNeighbours
(
const primitivePatch&,
const label patchFaceI,
const label patchFacei,
labelList&
) const;

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -37,11 +37,11 @@ Foam::labelHashSet Foam::cellDistFuncs::getPatchIDs() const
labelHashSet patchIDs(bMesh.size());
forAll(bMesh, patchI)
forAll(bMesh, patchi)
{
if (isA<Type>(bMesh[patchI]))
if (isA<Type>(bMesh[patchi]))
{
patchIDs.insert(patchI);
patchIDs.insert(patchi);
}
}
return patchIDs;

View File

@ -40,25 +40,25 @@ void Foam::patchDataWave<TransferType>::setChangedFaces
label nChangedFaces = 0;
forAll(mesh.boundaryMesh(), patchI)
forAll(mesh.boundaryMesh(), patchi)
{
if (patchIDs.found(patchI))
if (patchIDs.found(patchi))
{
const polyPatch& patch = mesh.boundaryMesh()[patchI];
const polyPatch& patch = mesh.boundaryMesh()[patchi];
const Field<Type>& patchField = initialPatchValuePtrs_[patchI];
const Field<Type>& patchField = initialPatchValuePtrs_[patchi];
forAll(patch.faceCentres(), patchFaceI)
forAll(patch.faceCentres(), patchFacei)
{
label meshFaceI = patch.start() + patchFaceI;
label meshFacei = patch.start() + patchFacei;
changedFaces[nChangedFaces] = meshFaceI;
changedFaces[nChangedFaces] = meshFacei;
faceDist[nChangedFaces] =
TransferType
(
patch.faceCentres()[patchFaceI],
patchField[patchFaceI],
patch.faceCentres()[patchFacei],
patchField[patchFacei],
0.0
);
@ -86,74 +86,74 @@ Foam::label Foam::patchDataWave<TransferType>::getValues
// Copy cell values
distance_.setSize(cellInfo.size());
forAll(cellInfo, cellI)
forAll(cellInfo, celli)
{
const TransferType & wpn = cellInfo[cellI];
const TransferType & wpn = cellInfo[celli];
scalar dist = wpn.distSqr();
if (cellInfo[cellI].valid(waveInfo.data()))
if (cellInfo[celli].valid(waveInfo.data()))
{
distance_[cellI] = Foam::sqrt(dist);
distance_[celli] = Foam::sqrt(dist);
cellData_[cellI] = cellInfo[cellI].data();
cellData_[celli] = cellInfo[celli].data();
}
else
{
// Illegal/unset value. What to do with data?
// Note: mag for now. Should maybe be member of TransferType?
distance_[cellI] = mag(dist);
distance_[celli] = mag(dist);
//cellData_[cellI] = point::max;
cellData_[cellI] = cellInfo[cellI].data();
//cellData_[celli] = point::max;
cellData_[celli] = cellInfo[celli].data();
nIllegal++;
}
}
// Copy boundary values
forAll(patchDistance_, patchI)
forAll(patchDistance_, patchi)
{
const polyPatch& patch = mesh.boundaryMesh()[patchI];
const polyPatch& patch = mesh.boundaryMesh()[patchi];
// Allocate storage for patchDistance
scalarField* patchFieldPtr = new scalarField(patch.size());
patchDistance_.set(patchI, patchFieldPtr);
patchDistance_.set(patchi, patchFieldPtr);
scalarField& patchField = *patchFieldPtr;
// Allocate storage for patchData
Field<Type>* patchDataFieldPtr = new Field<Type>(patch.size());
patchData_.set(patchI, patchDataFieldPtr);
patchData_.set(patchi, patchDataFieldPtr);
Field<Type>& patchDataField = *patchDataFieldPtr;
// Copy distance and data
forAll(patchField, patchFaceI)
forAll(patchField, patchFacei)
{
label meshFaceI = patch.start() + patchFaceI;
label meshFacei = patch.start() + patchFacei;
scalar dist = faceInfo[meshFaceI].distSqr();
scalar dist = faceInfo[meshFacei].distSqr();
if (faceInfo[meshFaceI].valid(waveInfo.data()))
if (faceInfo[meshFacei].valid(waveInfo.data()))
{
// Adding SMALL to avoid problems with /0 in the turbulence
// models
patchField[patchFaceI] = Foam::sqrt(dist) + SMALL;
patchField[patchFacei] = Foam::sqrt(dist) + SMALL;
patchDataField[patchFaceI] = faceInfo[meshFaceI].data();
patchDataField[patchFacei] = faceInfo[meshFacei].data();
}
else
{
// Illegal/unset value. What to do with data?
patchField[patchFaceI] = mag(dist);
patchField[patchFacei] = mag(dist);
//patchDataField[patchFaceI] = point::max;
patchDataField[patchFaceI] = faceInfo[meshFaceI].data();
//patchDataField[patchFacei] = point::max;
patchDataField[patchFacei] = faceInfo[meshFacei].data();
nIllegal++;
}
@ -263,13 +263,13 @@ void Foam::patchDataWave<TransferType>::correct()
const labelList wallCells(nearestFace.toc());
forAll(wallCells, wallCellI)
forAll(wallCells, wallCelli)
{
label cellI = wallCells[wallCellI];
label celli = wallCells[wallCelli];
label faceI = nearestFace[cellI];
label facei = nearestFace[celli];
cellData_[cellI] = faceInfo[faceI].data();
cellData_[celli] = faceInfo[facei].data();
}
}
}

View File

@ -31,7 +31,7 @@ Description
(like patchWave), but also additional transported data.
It is used, for example, in the y+ calculation.
See Also
See also
The patchWave class.
SourceFiles

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -41,22 +41,22 @@ void Foam::patchWave::setChangedFaces
label nChangedFaces = 0;
forAll(mesh.boundaryMesh(), patchI)
forAll(mesh.boundaryMesh(), patchi)
{
if (patchIDs.found(patchI))
if (patchIDs.found(patchi))
{
const polyPatch& patch = mesh.boundaryMesh()[patchI];
const polyPatch& patch = mesh.boundaryMesh()[patchi];
forAll(patch.faceCentres(), patchFaceI)
forAll(patch.faceCentres(), patchFacei)
{
label meshFaceI = patch.start() + patchFaceI;
label meshFacei = patch.start() + patchFacei;
changedFaces[nChangedFaces] = meshFaceI;
changedFaces[nChangedFaces] = meshFacei;
faceDist[nChangedFaces] =
wallPoint
(
patch.faceCentres()[patchFaceI],
patch.faceCentres()[patchFacei],
0.0
);
@ -77,49 +77,49 @@ Foam::label Foam::patchWave::getValues(const MeshWave<wallPoint>& waveInfo)
// Copy cell values
distance_.setSize(cellInfo.size());
forAll(cellInfo, cellI)
forAll(cellInfo, celli)
{
scalar dist = cellInfo[cellI].distSqr();
scalar dist = cellInfo[celli].distSqr();
if (cellInfo[cellI].valid(waveInfo.data()))
if (cellInfo[celli].valid(waveInfo.data()))
{
distance_[cellI] = Foam::sqrt(dist);
distance_[celli] = Foam::sqrt(dist);
}
else
{
distance_[cellI] = dist;
distance_[celli] = dist;
nIllegal++;
}
}
// Copy boundary values
forAll(patchDistance_, patchI)
forAll(patchDistance_, patchi)
{
const polyPatch& patch = mesh().boundaryMesh()[patchI];
const polyPatch& patch = mesh().boundaryMesh()[patchi];
// Allocate storage for patchDistance
scalarField* patchDistPtr = new scalarField(patch.size());
patchDistance_.set(patchI, patchDistPtr);
patchDistance_.set(patchi, patchDistPtr);
scalarField& patchField = *patchDistPtr;
forAll(patchField, patchFaceI)
forAll(patchField, patchFacei)
{
label meshFaceI = patch.start() + patchFaceI;
label meshFacei = patch.start() + patchFacei;
scalar dist = faceInfo[meshFaceI].distSqr();
scalar dist = faceInfo[meshFacei].distSqr();
if (faceInfo[meshFaceI].valid(waveInfo.data()))
if (faceInfo[meshFacei].valid(waveInfo.data()))
{
// Adding SMALL to avoid problems with /0 in the turbulence
// models
patchField[patchFaceI] = Foam::sqrt(dist) + SMALL;
patchField[patchFacei] = Foam::sqrt(dist) + SMALL;
}
else
{
patchField[patchFaceI] = dist;
patchField[patchFacei] = dist;
nIllegal++;
}

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -138,7 +138,7 @@ public:
(
const polyMesh&,
const polyPatch&,
const label patchFaceI,
const label patchFacei,
const point& faceCentre,
TrackingData& td
);
@ -149,7 +149,7 @@ public:
(
const polyMesh&,
const polyPatch&,
const label patchFaceI,
const label patchFacei,
const point& faceCentre,
TrackingData& td
);
@ -168,8 +168,8 @@ public:
inline bool updateCell
(
const polyMesh&,
const label thisCellI,
const label neighbourFaceI,
const label thisCelli,
const label neighbourFacei,
const wallPoint& neighbourInfo,
const scalar tol,
TrackingData& td
@ -180,8 +180,8 @@ public:
inline bool updateFace
(
const polyMesh&,
const label thisFaceI,
const label neighbourCellI,
const label thisFacei,
const label neighbourCelli,
const wallPoint& neighbourInfo,
const scalar tol,
TrackingData& td
@ -192,7 +192,7 @@ public:
inline bool updateFace
(
const polyMesh&,
const label thisFaceI,
const label thisFacei,
const wallPoint& neighbourInfo,
const scalar tol,
TrackingData& td

View File

@ -113,26 +113,26 @@ public:
// Needed by meshWave
//- Influence of neighbouring face.
// Calls update(...) with cellCentre of cellI
// Calls update(...) with cellCentre of celli
template<class TrackingData>
inline bool updateCell
(
const polyMesh& mesh,
const label thisCellI,
const label neighbourFaceI,
const label thisCelli,
const label neighbourFacei,
const wallPointData<Type>& neighbourWallInfo,
const scalar tol,
TrackingData& td
);
//- Influence of neighbouring cell.
// Calls update(...) with faceCentre of faceI
// Calls update(...) with faceCentre of facei
template<class TrackingData>
inline bool updateFace
(
const polyMesh& mesh,
const label thisFaceI,
const label neighbourCellI,
const label thisFacei,
const label neighbourCelli,
const wallPointData<Type>& neighbourWallInfo,
const scalar tol,
TrackingData& td
@ -140,12 +140,12 @@ public:
//- Influence of different value on same face.
// Merge new and old info.
// Calls update(...) with faceCentre of faceI
// Calls update(...) with faceCentre of facei
template<class TrackingData>
inline bool updateFace
(
const polyMesh& mesh,
const label thisFaceI,
const label thisFacei,
const wallPointData<Type>& neighbourWallInfo,
const scalar tol,
TrackingData& td

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -119,7 +119,7 @@ template<class TrackingData>
inline bool wallPointData<Type>::updateCell
(
const polyMesh& mesh,
const label thisCellI,
const label thisCelli,
const label,
const wallPointData<Type>& neighbourWallInfo,
const scalar tol,
@ -130,7 +130,7 @@ inline bool wallPointData<Type>::updateCell
return update
(
cellCentres[thisCellI],
cellCentres[thisCelli],
neighbourWallInfo,
tol,
td
@ -144,7 +144,7 @@ template<class TrackingData>
inline bool wallPointData<Type>::updateFace
(
const polyMesh& mesh,
const label thisFaceI,
const label thisFacei,
const label,
const wallPointData<Type>& neighbourWallInfo,
const scalar tol,
@ -155,7 +155,7 @@ inline bool wallPointData<Type>::updateFace
return update
(
faceCentres[thisFaceI],
faceCentres[thisFacei],
neighbourWallInfo,
tol,
td
@ -169,7 +169,7 @@ template<class TrackingData>
inline bool wallPointData<Type>::updateFace
(
const polyMesh& mesh,
const label thisFaceI,
const label thisFacei,
const wallPointData<Type>& neighbourWallInfo,
const scalar tol,
TrackingData& td
@ -179,7 +179,7 @@ inline bool wallPointData<Type>::updateFace
return update
(
faceCentres[thisFaceI],
faceCentres[thisFacei],
neighbourWallInfo,
tol,
td

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -214,8 +214,8 @@ template<class TrackingData>
inline bool Foam::wallPoint::updateCell
(
const polyMesh& mesh,
const label thisCellI,
const label neighbourFaceI,
const label thisCelli,
const label neighbourFacei,
const wallPoint& neighbourWallInfo,
const scalar tol,
TrackingData& td
@ -224,7 +224,7 @@ inline bool Foam::wallPoint::updateCell
return
update
(
mesh.cellCentres()[thisCellI],
mesh.cellCentres()[thisCelli],
neighbourWallInfo,
tol,
td
@ -237,8 +237,8 @@ template<class TrackingData>
inline bool Foam::wallPoint::updateFace
(
const polyMesh& mesh,
const label thisFaceI,
const label neighbourCellI,
const label thisFacei,
const label neighbourCelli,
const wallPoint& neighbourWallInfo,
const scalar tol,
TrackingData& td
@ -247,7 +247,7 @@ inline bool Foam::wallPoint::updateFace
return
update
(
mesh.faceCentres()[thisFaceI],
mesh.faceCentres()[thisFacei],
neighbourWallInfo,
tol,
td
@ -259,7 +259,7 @@ template<class TrackingData>
inline bool Foam::wallPoint::updateFace
(
const polyMesh& mesh,
const label thisFaceI,
const label thisFacei,
const wallPoint& neighbourWallInfo,
const scalar tol,
TrackingData& td
@ -268,7 +268,7 @@ inline bool Foam::wallPoint::updateFace
return
update
(
mesh.faceCentres()[thisFaceI],
mesh.faceCentres()[thisFacei],
neighbourWallInfo,
tol,
td

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -36,12 +36,12 @@ License
// Return true if edge start and end are on increasing face vertices. (edge is
// guaranteed to be on face)
bool Foam::cellFeatures::faceAlignedEdge(const label faceI, const label edgeI)
bool Foam::cellFeatures::faceAlignedEdge(const label facei, const label edgeI)
const
{
const edge& e = mesh_.edges()[edgeI];
const face& f = mesh_.faces()[faceI];
const face& f = mesh_.faces()[facei];
forAll(f, fp)
{
@ -55,7 +55,7 @@ bool Foam::cellFeatures::faceAlignedEdge(const label faceI, const label edgeI)
FatalErrorInFunction
<< "Can not find edge " << mesh_.edges()[edgeI]
<< " on face " << faceI << abort(FatalError);
<< " on face " << facei << abort(FatalError);
return false;
}
@ -66,7 +66,7 @@ bool Foam::cellFeatures::faceAlignedEdge(const label faceI, const label edgeI)
Foam::label Foam::cellFeatures::nextEdge
(
const Map<label>& toSuperFace,
const label superFaceI,
const label superFacei,
const label thisEdgeI,
const label thisVertI
) const
@ -83,14 +83,14 @@ Foam::label Foam::cellFeatures::nextEdge
const labelList& eFaces = mesh_.edgeFaces()[edgeI];
forAll(eFaces, eFaceI)
forAll(eFaces, eFacei)
{
label faceI = eFaces[eFaceI];
label facei = eFaces[eFacei];
if
(
meshTools::faceOnCell(mesh_, cellI_, faceI)
&& (toSuperFace[faceI] == superFaceI)
meshTools::faceOnCell(mesh_, celli_, facei)
&& (toSuperFace[facei] == superFacei)
)
{
return edgeI;
@ -120,7 +120,7 @@ bool Foam::cellFeatures::isCellFeatureEdge
label face0;
label face1;
meshTools::getEdgeFaces(mesh_, cellI_, edgeI, face0, face1);
meshTools::getEdgeFaces(mesh_, celli_, edgeI, face0, face1);
// Check the angle between them by comparing the face normals.
@ -178,16 +178,16 @@ bool Foam::cellFeatures::isCellFeatureEdge
// edges.
void Foam::cellFeatures::walkSuperFace
(
const label faceI,
const label superFaceI,
const label facei,
const label superFacei,
Map<label>& toSuperFace
) const
{
if (!toSuperFace.found(faceI))
if (!toSuperFace.found(facei))
{
toSuperFace.insert(faceI, superFaceI);
toSuperFace.insert(facei, superFacei);
const labelList& fEdges = mesh_.faceEdges()[faceI];
const labelList& fEdges = mesh_.faceEdges()[facei];
forAll(fEdges, fEdgeI)
{
@ -197,9 +197,9 @@ void Foam::cellFeatures::walkSuperFace
{
label face0;
label face1;
meshTools::getEdgeFaces(mesh_, cellI_, edgeI, face0, face1);
meshTools::getEdgeFaces(mesh_, celli_, edgeI, face0, face1);
if (face0 == faceI)
if (face0 == facei)
{
face0 = face1;
}
@ -207,7 +207,7 @@ void Foam::cellFeatures::walkSuperFace
walkSuperFace
(
face0,
superFaceI,
superFacei,
toSuperFace
);
}
@ -220,40 +220,40 @@ void Foam::cellFeatures::calcSuperFaces() const
{
// Determine superfaces by edge walking across non-feature edges
const labelList& cFaces = mesh_.cells()[cellI_];
const labelList& cFaces = mesh_.cells()[celli_];
// Mapping from old to super face:
// <not found> : not visited
// >=0 : superFace
Map<label> toSuperFace(10*cFaces.size());
label superFaceI = 0;
label superFacei = 0;
forAll(cFaces, cFaceI)
forAll(cFaces, cFacei)
{
label faceI = cFaces[cFaceI];
label facei = cFaces[cFacei];
if (!toSuperFace.found(faceI))
if (!toSuperFace.found(facei))
{
walkSuperFace
(
faceI,
superFaceI,
facei,
superFacei,
toSuperFace
);
superFaceI++;
superFacei++;
}
}
// Construct superFace-to-oldface mapping.
faceMap_.setSize(superFaceI);
faceMap_.setSize(superFacei);
forAll(cFaces, cFaceI)
forAll(cFaces, cFacei)
{
label faceI = cFaces[cFaceI];
label facei = cFaces[cFacei];
faceMap_[toSuperFace[faceI]].append(faceI);
faceMap_[toSuperFace[facei]].append(facei);
}
forAll(faceMap_, superI)
@ -264,24 +264,24 @@ void Foam::cellFeatures::calcSuperFaces() const
// Construct superFaces
facesPtr_ = new faceList(superFaceI);
facesPtr_ = new faceList(superFacei);
faceList& faces = *facesPtr_;
forAll(cFaces, cFaceI)
forAll(cFaces, cFacei)
{
label faceI = cFaces[cFaceI];
label facei = cFaces[cFacei];
label superFaceI = toSuperFace[faceI];
label superFacei = toSuperFace[facei];
if (faces[superFaceI].empty())
if (faces[superFacei].empty())
{
// Superface not yet constructed.
// Find starting feature edge on face.
label startEdgeI = -1;
const labelList& fEdges = mesh_.faceEdges()[faceI];
const labelList& fEdges = mesh_.faceEdges()[facei];
forAll(fEdges, fEdgeI)
{
@ -300,15 +300,15 @@ void Foam::cellFeatures::calcSuperFaces() const
{
// Walk point-edge-point along feature edges
DynamicList<label> superFace(10*mesh_.faces()[faceI].size());
DynamicList<label> superFace(10*mesh_.faces()[facei].size());
const edge& e = mesh_.edges()[startEdgeI];
// Walk either start-end or end-start depending on orientation
// of face. SuperFace will have cellI as owner.
// of face. SuperFace will have celli as owner.
bool flipOrientation =
(mesh_.faceOwner()[faceI] == cellI_)
^ (faceAlignedEdge(faceI, startEdgeI));
(mesh_.faceOwner()[facei] == celli_)
^ (faceAlignedEdge(facei, startEdgeI));
label startVertI = -1;
@ -330,7 +330,7 @@ void Foam::cellFeatures::calcSuperFaces() const
label newEdgeI = nextEdge
(
toSuperFace,
superFaceI,
superFacei,
edgeI,
vertI
);
@ -355,13 +355,13 @@ void Foam::cellFeatures::calcSuperFaces() const
if (superFace.size() <= 2)
{
WarningInFunction
<< " Can not collapse faces " << faceMap_[superFaceI]
<< " into one big face on cell " << cellI_ << endl
<< " Can not collapse faces " << faceMap_[superFacei]
<< " into one big face on cell " << celli_ << endl
<< "Try decreasing minCos:" << minCos_ << endl;
}
else
{
faces[superFaceI].transfer(superFace);
faces[superFacei].transfer(superFace);
}
}
}
@ -376,17 +376,17 @@ Foam::cellFeatures::cellFeatures
(
const primitiveMesh& mesh,
const scalar minCos,
const label cellI
const label celli
)
:
mesh_(mesh),
minCos_(minCos),
cellI_(cellI),
featureEdge_(10*mesh.cellEdges()[cellI].size()),
facesPtr_(NULL),
celli_(celli),
featureEdge_(10*mesh.cellEdges()[celli].size()),
facesPtr_(nullptr),
faceMap_(0)
{
const labelList& cEdges = mesh_.cellEdges()[cellI_];
const labelList& cEdges = mesh_.cellEdges()[celli_];
forAll(cEdges, cEdgeI)
{
@ -478,19 +478,19 @@ bool Foam::cellFeatures::isFeaturePoint(const label edge0, const label edge1)
}
bool Foam::cellFeatures::isFeatureVertex(const label faceI, const label vertI)
bool Foam::cellFeatures::isFeatureVertex(const label facei, const label vertI)
const
{
if
(
(faceI < 0)
|| (faceI >= mesh_.nFaces())
(facei < 0)
|| (facei >= mesh_.nFaces())
|| (vertI < 0)
|| (vertI >= mesh_.nPoints())
)
{
FatalErrorInFunction
<< "Illegal face " << faceI << " or vertex " << vertI
<< "Illegal face " << facei << " or vertex " << vertI
<< abort(FatalError);
}
@ -503,7 +503,7 @@ bool Foam::cellFeatures::isFeatureVertex(const label faceI, const label vertI)
{
label edgeI = pEdges[pEdgeI];
if (meshTools::edgeOnFace(mesh_, faceI, edgeI))
if (meshTools::edgeOnFace(mesh_, facei, edgeI))
{
if (edge0 == -1)
{
@ -523,7 +523,7 @@ bool Foam::cellFeatures::isFeatureVertex(const label faceI, const label vertI)
{
FatalErrorInFunction
<< "Did not find two edges sharing vertex " << vertI
<< " on face " << faceI << " vertices:" << mesh_.faces()[faceI]
<< " on face " << facei << " vertices:" << mesh_.faces()[facei]
<< abort(FatalError);
}

View File

@ -69,7 +69,7 @@ class cellFeatures
// same face before edge/point is 'feature'.
scalar minCos_;
label cellI_;
label celli_;
//- Feature edges
labelHashSet featureEdge_;
@ -88,7 +88,7 @@ class cellFeatures
label nextEdge
(
const Map<label>& toSuperFace,
const label superFaceI,
const label superFacei,
const label thisEdgeI,
const label thisVertI
) const;
@ -97,8 +97,8 @@ class cellFeatures
void walkSuperFace
(
const label faceI,
const label superFaceI,
const label facei,
const label superFacei,
Map<label>& toSuperFace
) const;
@ -120,7 +120,7 @@ public:
(
const primitiveMesh&,
const scalar minCos, // angle to use for feature recognition.
const label cellI
const label celli
);
@ -171,9 +171,9 @@ public:
// from one face but not from another.
bool isFeaturePoint(const label edge0, const label edge1) const;
//- Is vertexI on faceI used by two edges that form feature
//- Is vertexI on facei used by two edges that form feature
// point
bool isFeatureVertex(const label faceI, const label vertI) const;
bool isFeatureVertex(const label facei, const label vertI) const;
};

View File

@ -57,41 +57,41 @@ Foam::tmp<Foam::scalarField> Foam::cellQuality::nonOrthogonality() const
const labelList& own = mesh_.faceOwner();
const labelList& nei = mesh_.faceNeighbour();
forAll(nei, faceI)
forAll(nei, facei)
{
vector d = centres[nei[faceI]] - centres[own[faceI]];
vector s = areas[faceI];
vector d = centres[nei[facei]] - centres[own[facei]];
vector s = areas[facei];
scalar magS = mag(s);
scalar cosDDotS =
radToDeg(Foam::acos(min(1.0, (d & s)/(mag(d)*magS + VSMALL))));
result[own[faceI]] = max(cosDDotS, result[own[faceI]]);
result[own[facei]] = max(cosDDotS, result[own[facei]]);
result[nei[faceI]] = max(cosDDotS, result[nei[faceI]]);
result[nei[facei]] = max(cosDDotS, result[nei[facei]]);
}
forAll(mesh_.boundaryMesh(), patchI)
forAll(mesh_.boundaryMesh(), patchi)
{
const labelUList& faceCells =
mesh_.boundaryMesh()[patchI].faceCells();
mesh_.boundaryMesh()[patchi].faceCells();
const vectorField::subField faceCentres =
mesh_.boundaryMesh()[patchI].faceCentres();
mesh_.boundaryMesh()[patchi].faceCentres();
const vectorField::subField faceAreas =
mesh_.boundaryMesh()[patchI].faceAreas();
mesh_.boundaryMesh()[patchi].faceAreas();
forAll(faceCentres, faceI)
forAll(faceCentres, facei)
{
vector d = faceCentres[faceI] - centres[faceCells[faceI]];
vector s = faceAreas[faceI];
vector d = faceCentres[facei] - centres[faceCells[facei]];
vector s = faceAreas[facei];
scalar magS = mag(s);
scalar cosDDotS =
radToDeg(Foam::acos(min(1.0, (d & s)/(mag(d)*magS + VSMALL))));
result[faceCells[faceI]] = max(cosDDotS, result[faceCells[faceI]]);
result[faceCells[facei]] = max(cosDDotS, result[faceCells[facei]]);
}
}
@ -119,58 +119,58 @@ Foam::tmp<Foam::scalarField> Foam::cellQuality::skewness() const
const labelList& own = mesh_.faceOwner();
const labelList& nei = mesh_.faceNeighbour();
forAll(nei, faceI)
forAll(nei, facei)
{
scalar dOwn = mag
(
(faceCtrs[faceI] - cellCtrs[own[faceI]]) & areas[faceI]
)/mag(areas[faceI]);
(faceCtrs[facei] - cellCtrs[own[facei]]) & areas[facei]
)/mag(areas[facei]);
scalar dNei = mag
(
(cellCtrs[nei[faceI]] - faceCtrs[faceI]) & areas[faceI]
)/mag(areas[faceI]);
(cellCtrs[nei[facei]] - faceCtrs[facei]) & areas[facei]
)/mag(areas[facei]);
point faceIntersection =
cellCtrs[own[faceI]]
+ (dOwn/(dOwn+dNei))*(cellCtrs[nei[faceI]] - cellCtrs[own[faceI]]);
cellCtrs[own[facei]]
+ (dOwn/(dOwn+dNei))*(cellCtrs[nei[facei]] - cellCtrs[own[facei]]);
scalar skewness =
mag(faceCtrs[faceI] - faceIntersection)
/(mag(cellCtrs[nei[faceI]] - cellCtrs[own[faceI]]) + VSMALL);
mag(faceCtrs[facei] - faceIntersection)
/(mag(cellCtrs[nei[facei]] - cellCtrs[own[facei]]) + VSMALL);
result[own[faceI]] = max(skewness, result[own[faceI]]);
result[own[facei]] = max(skewness, result[own[facei]]);
result[nei[faceI]] = max(skewness, result[nei[faceI]]);
result[nei[facei]] = max(skewness, result[nei[facei]]);
}
forAll(mesh_.boundaryMesh(), patchI)
forAll(mesh_.boundaryMesh(), patchi)
{
const labelUList& faceCells =
mesh_.boundaryMesh()[patchI].faceCells();
mesh_.boundaryMesh()[patchi].faceCells();
const vectorField::subField faceCentres =
mesh_.boundaryMesh()[patchI].faceCentres();
mesh_.boundaryMesh()[patchi].faceCentres();
const vectorField::subField faceAreas =
mesh_.boundaryMesh()[patchI].faceAreas();
mesh_.boundaryMesh()[patchi].faceAreas();
forAll(faceCentres, faceI)
forAll(faceCentres, facei)
{
vector n = faceAreas[faceI]/mag(faceAreas[faceI]);
vector n = faceAreas[facei]/mag(faceAreas[facei]);
point faceIntersection =
cellCtrs[faceCells[faceI]]
+ ((faceCentres[faceI] - cellCtrs[faceCells[faceI]])&n)*n;
cellCtrs[faceCells[facei]]
+ ((faceCentres[facei] - cellCtrs[faceCells[facei]])&n)*n;
scalar skewness =
mag(faceCentres[faceI] - faceIntersection)
mag(faceCentres[facei] - faceIntersection)
/(
mag(faceCentres[faceI] - cellCtrs[faceCells[faceI]])
mag(faceCentres[facei] - cellCtrs[faceCells[facei]])
+ VSMALL
);
result[faceCells[faceI]] = max(skewness, result[faceCells[faceI]]);
result[faceCells[facei]] = max(skewness, result[faceCells[facei]]);
}
}
@ -196,41 +196,41 @@ Foam::tmp<Foam::scalarField> Foam::cellQuality::faceNonOrthogonality() const
const labelList& own = mesh_.faceOwner();
const labelList& nei = mesh_.faceNeighbour();
forAll(nei, faceI)
forAll(nei, facei)
{
vector d = centres[nei[faceI]] - centres[own[faceI]];
vector s = areas[faceI];
vector d = centres[nei[facei]] - centres[own[facei]];
vector s = areas[facei];
scalar magS = mag(s);
scalar cosDDotS =
radToDeg(Foam::acos(min(1.0, (d & s)/(mag(d)*magS + VSMALL))));
result[faceI] = cosDDotS;
result[facei] = cosDDotS;
}
label globalFaceI = mesh_.nInternalFaces();
label globalFacei = mesh_.nInternalFaces();
forAll(mesh_.boundaryMesh(), patchI)
forAll(mesh_.boundaryMesh(), patchi)
{
const labelUList& faceCells =
mesh_.boundaryMesh()[patchI].faceCells();
mesh_.boundaryMesh()[patchi].faceCells();
const vectorField::subField faceCentres =
mesh_.boundaryMesh()[patchI].faceCentres();
mesh_.boundaryMesh()[patchi].faceCentres();
const vectorField::subField faceAreas =
mesh_.boundaryMesh()[patchI].faceAreas();
mesh_.boundaryMesh()[patchi].faceAreas();
forAll(faceCentres, faceI)
forAll(faceCentres, facei)
{
vector d = faceCentres[faceI] - centres[faceCells[faceI]];
vector s = faceAreas[faceI];
vector d = faceCentres[facei] - centres[faceCells[facei]];
vector s = faceAreas[facei];
scalar magS = mag(s);
scalar cosDDotS =
radToDeg(Foam::acos(min(1.0, (d & s)/(mag(d)*magS + VSMALL))));
result[globalFaceI++] = cosDDotS;
result[globalFacei++] = cosDDotS;
}
}
@ -257,53 +257,53 @@ Foam::tmp<Foam::scalarField> Foam::cellQuality::faceSkewness() const
const labelList& own = mesh_.faceOwner();
const labelList& nei = mesh_.faceNeighbour();
forAll(nei, faceI)
forAll(nei, facei)
{
scalar dOwn = mag
(
(faceCtrs[faceI] - cellCtrs[own[faceI]]) & areas[faceI]
)/mag(areas[faceI]);
(faceCtrs[facei] - cellCtrs[own[facei]]) & areas[facei]
)/mag(areas[facei]);
scalar dNei = mag
(
(cellCtrs[nei[faceI]] - faceCtrs[faceI]) & areas[faceI]
)/mag(areas[faceI]);
(cellCtrs[nei[facei]] - faceCtrs[facei]) & areas[facei]
)/mag(areas[facei]);
point faceIntersection =
cellCtrs[own[faceI]]
+ (dOwn/(dOwn+dNei))*(cellCtrs[nei[faceI]] - cellCtrs[own[faceI]]);
cellCtrs[own[facei]]
+ (dOwn/(dOwn+dNei))*(cellCtrs[nei[facei]] - cellCtrs[own[facei]]);
result[faceI] =
mag(faceCtrs[faceI] - faceIntersection)
/(mag(cellCtrs[nei[faceI]] - cellCtrs[own[faceI]]) + VSMALL);
result[facei] =
mag(faceCtrs[facei] - faceIntersection)
/(mag(cellCtrs[nei[facei]] - cellCtrs[own[facei]]) + VSMALL);
}
label globalFaceI = mesh_.nInternalFaces();
label globalFacei = mesh_.nInternalFaces();
forAll(mesh_.boundaryMesh(), patchI)
forAll(mesh_.boundaryMesh(), patchi)
{
const labelUList& faceCells =
mesh_.boundaryMesh()[patchI].faceCells();
mesh_.boundaryMesh()[patchi].faceCells();
const vectorField::subField faceCentres =
mesh_.boundaryMesh()[patchI].faceCentres();
mesh_.boundaryMesh()[patchi].faceCentres();
const vectorField::subField faceAreas =
mesh_.boundaryMesh()[patchI].faceAreas();
mesh_.boundaryMesh()[patchi].faceAreas();
forAll(faceCentres, faceI)
forAll(faceCentres, facei)
{
vector n = faceAreas[faceI]/mag(faceAreas[faceI]);
vector n = faceAreas[facei]/mag(faceAreas[facei]);
point faceIntersection =
cellCtrs[faceCells[faceI]]
+ ((faceCentres[faceI] - cellCtrs[faceCells[faceI]])&n)*n;
cellCtrs[faceCells[facei]]
+ ((faceCentres[facei] - cellCtrs[faceCells[facei]])&n)*n;
result[globalFaceI++] =
mag(faceCentres[faceI] - faceIntersection)
result[globalFacei++] =
mag(faceCentres[facei] - faceIntersection)
/(
mag(faceCentres[faceI] - cellCtrs[faceCells[faceI]])
mag(faceCentres[facei] - cellCtrs[faceCells[facei]])
+ VSMALL
);
}

View File

@ -70,7 +70,7 @@ Foam::tmp<Foam::vectorField> Foam::EulerCoordinateRotation::transform
) const
{
NotImplemented;
return tmp<vectorField>(NULL);
return tmp<vectorField>(nullptr);
}
@ -80,7 +80,7 @@ Foam::tmp<Foam::vectorField> Foam::EulerCoordinateRotation::invTransform
) const
{
NotImplemented;
return tmp<vectorField>(NULL);
return tmp<vectorField>(nullptr);
}
@ -97,7 +97,7 @@ Foam::tmp<Foam::tensorField> Foam::EulerCoordinateRotation::transformTensor
) const
{
NotImplemented;
return tmp<tensorField>(NULL);
return tmp<tensorField>(nullptr);
}
@ -117,7 +117,7 @@ Foam::tmp<Foam::tensorField> Foam::EulerCoordinateRotation::transformTensor
) const
{
NotImplemented;
return tmp<tensorField>(NULL);
return tmp<tensorField>(nullptr);
}

View File

@ -39,7 +39,7 @@ Description
Note, however, that it is the reverse transformation
(local->global) that is defined here.
- the rotation angles are in degrees, unless otherwise explictly specified:
- the rotation angles are in degrees, unless otherwise explicitly specified:
\verbatim
coordinateRotation

View File

@ -71,7 +71,7 @@ Foam::tmp<Foam::vectorField> Foam::STARCDCoordinateRotation::transform
) const
{
NotImplemented;
return tmp<vectorField>(NULL);
return tmp<vectorField>(nullptr);
}
@ -81,7 +81,7 @@ Foam::tmp<Foam::vectorField> Foam::STARCDCoordinateRotation::invTransform
) const
{
NotImplemented;
return tmp<vectorField>(NULL);
return tmp<vectorField>(nullptr);
}
@ -98,7 +98,7 @@ Foam::tmp<Foam::tensorField> Foam::STARCDCoordinateRotation::transformTensor
) const
{
NotImplemented;
return tmp<tensorField>(NULL);
return tmp<tensorField>(nullptr);
}
@ -118,7 +118,7 @@ Foam::tmp<Foam::tensorField> Foam::STARCDCoordinateRotation::transformTensor
) const
{
NotImplemented;
return tmp<tensorField>(NULL);
return tmp<tensorField>(nullptr);
}

View File

@ -31,7 +31,7 @@ Description
(around Z, around X' and around Y'').
The order of the parameter arguments matches this rotation order.
- the rotation angles are in degrees, unless otherwise explictly specified:
- the rotation angles are in degrees, unless otherwise explicitly specified:
\verbatim
coordinateRotation

View File

@ -210,7 +210,7 @@ Foam::tmp<Foam::tensorField> Foam::axesRotation::transformTensor
) const
{
NotImplemented;
return tmp<tensorField>(NULL);
return tmp<tensorField>(nullptr);
}
@ -230,7 +230,7 @@ Foam::tmp<Foam::tensorField> Foam::axesRotation::transformTensor
) const
{
NotImplemented;
return tmp<tensorField>(NULL);
return tmp<tensorField>(nullptr);
}

View File

@ -37,11 +37,10 @@ Description
\endverbatim
Types of coordinateRotation:
\li 1. axesRotation
\li 2. STARCDRotation
\li 3. cylindrical
\li 4. EulerCoordinateRotation
-# axesRotation
-# STARCDRotation
-# cylindrical
-# EulerCoordinateRotation
SourceFiles
coordinateRotation.C

View File

@ -67,8 +67,8 @@ void Foam::cylindrical::init
tensorField& R = Rptr_();
forAll(cells, i)
{
label cellI = cells[i];
vector dir = cc[cellI] - origin_;
label celli = cells[i];
vector dir = cc[celli] - origin_;
dir /= mag(dir) + VSMALL;
R[i] = axesRotation(e3_, dir).R();
@ -79,12 +79,12 @@ void Foam::cylindrical::init
Rptr_.reset(new tensorField(mesh.nCells()));
tensorField& R = Rptr_();
forAll(cc, cellI)
forAll(cc, celli)
{
vector dir = cc[cellI] - origin_;
vector dir = cc[celli] - origin_;
dir /= mag(dir) + VSMALL;
R[cellI] = axesRotation(e3_, dir).R();
R[celli] = axesRotation(e3_, dir).R();
}
}
}
@ -203,11 +203,11 @@ void Foam::cylindrical::updateCells
forAll(cells, i)
{
label cellI = cells[i];
vector dir = cc[cellI] - origin_;
label celli = cells[i];
vector dir = cc[celli] - origin_;
dir /= mag(dir) + VSMALL;
R[cellI] = axesRotation(e3_, dir).R();
R[celli] = axesRotation(e3_, dir).R();
}
}
@ -316,8 +316,8 @@ Foam::tmp<Foam::tensorField> Foam::cylindrical::transformTensor
tensorField& t = tt.ref();
forAll(cellMap, i)
{
const label cellI = cellMap[i];
t[i] = R[cellI] & tf[i] & Rtr[cellI];
const label celli = cellMap[i];
t[i] = R[celli] & tf[i] & Rtr[celli];
}
return tt;

View File

@ -26,21 +26,21 @@ Class
Description
A local coordinate rotation.
The cell based rotational field can be created in two ways:
-# Each rotational tensor is defined with two vectors (\c dir and \c e3)
where <tt>dir = cellC - origin</tt> and \c e3 is the rotation axis.
Per each cell an axesRotation type of rotation is created
(cylindrical coordinates). For example:
\verbatim
cylindrical
{
type localAxes;
e3 (0 0 1);
}
\endverbatim
\li 1. Each rotational tensor is defined with two vectors (\c dir and \c e3)
where <tt>dir = cellC - origin</tt> and \c e3 is the rotation axis.
Per each cell an axesRotation type of rotation is created
(cylindrical coordinates). For example:
\verbatim
cylindrical
{
type localAxes;
e3 (0 0 1);
}
\endverbatim
\li 2. The rotational tensor field is provided at construction.
-# The rotational tensor field is provided at construction.
SourceFiles
cylindrical.C

View File

@ -43,15 +43,13 @@ Description
\endverbatim
Types of coordinateRotation:
\li 1. axesRotation
\li 2. STARCDRotation
\li 3. cylindrical
\li 4. EulerCoordinateRotation
-# axesRotation
-# \link STARCDCoordinateRotation STARCDRotation \endlink
-# cylindricalCS cylindrical
-# EulerCoordinateRotation
Type of co-ordinates:
\li 1. cartesian
-# \link cartesianCS cartesian \endlink
SourceFiles
@ -78,6 +76,14 @@ SourceFiles
namespace Foam
{
// Forward declaration of friend functions and operators
class coordinateSystem;
bool operator!=(const coordinateSystem&, const coordinateSystem&);
Ostream& operator<<(Ostream&, const coordinateSystem&);
/*---------------------------------------------------------------------------*\
Class coordinateSystem Declaration
\*---------------------------------------------------------------------------*/
@ -280,7 +286,7 @@ public:
}
//- Return as dictionary of entries
// \param [in] ignoreType drop type (cartesian, cylindrical, etc)
// \param[in] ignoreType drop type (cartesian, cylindrical, etc)
// when generating the dictionary
virtual dictionary dict(bool ignoreType=false) const;

View File

@ -98,12 +98,6 @@ const Foam::coordinateSystems& Foam::coordinateSystems::New
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
Foam::label Foam::coordinateSystems::find(const keyType& key) const
{
return findIndex(key);
}
Foam::labelList Foam::coordinateSystems::findIndices(const keyType& key) const
{
labelList indices;

View File

@ -122,10 +122,6 @@ public:
//- Find and return index for the first match, return -1 if not found
label findIndex(const keyType& key) const;
//- Find and return index for the first match, returns -1 if not found
// \deprecated use findIndex() instead (deprecated Jul 2010)
label find(const keyType& key) const;
//- Search for given key
bool found(const keyType& key) const;

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -120,11 +120,11 @@ class edgeFaceCirculator
inline void setEnd();
//- Check and set faceLabel_ and ownerSide_
inline void setFace(const label faceI, const label cellI);
inline void setFace(const label facei, const label celli);
//- Set faceLabel_ to be the other face on the cell that uses the
// edge.
inline void otherFace(const label cellI);
inline void otherFace(const label celli);
public:

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -36,29 +36,29 @@ void Foam::edgeFaceCirculator::setEnd()
void Foam::edgeFaceCirculator::setFace
(
const label faceI,
const label cellI
const label facei,
const label celli
)
{
faceLabel_ = faceI;
faceLabel_ = facei;
if (!isBoundaryEdge_ && !mesh_.isInternalFace(faceI))
if (!isBoundaryEdge_ && !mesh_.isInternalFace(facei))
{
FatalErrorInFunction
<< "Edge is not defined as boundary edge but still walked to"
<< " boundary face:" << faceI << " on cell:" << cellI
<< " boundary face:" << facei << " on cell:" << celli
<< abort(FatalError);
}
}
void Foam::edgeFaceCirculator::otherFace(const label cellI)
void Foam::edgeFaceCirculator::otherFace(const label celli)
{
const face& f = mesh_.faces()[faceLabel_];
label v0 = f[index_];
label v1 = f.nextLabel(index_);
const cell& cFaces = mesh_.cells()[cellI];
const cell& cFaces = mesh_.cells()[celli];
forAll(cFaces, i)
{
@ -71,7 +71,7 @@ void Foam::edgeFaceCirculator::otherFace(const label cellI)
if (fp >= 0)
{
index_ = fp;
setFace(faceB, cellI);
setFace(faceB, celli);
return;
}
}
@ -220,17 +220,17 @@ void Foam::edgeFaceCirculator::setCanonical()
{
if (ownerSide_)
{
label cellI = mesh_.faceNeighbour()[faceLabel_];
otherFace(cellI);
label celli = mesh_.faceNeighbour()[faceLabel_];
otherFace(celli);
// Maintain reverse direction of walking
ownerSide_ = (mesh_.faceOwner()[faceLabel_] == cellI);
ownerSide_ = (mesh_.faceOwner()[faceLabel_] == celli);
}
else
{
label cellI = mesh_.faceOwner()[faceLabel_];
otherFace(cellI);
label celli = mesh_.faceOwner()[faceLabel_];
otherFace(celli);
// Maintain reverse direction of walking
ownerSide_ = (mesh_.faceOwner()[faceLabel_] == cellI);
ownerSide_ = (mesh_.faceOwner()[faceLabel_] == celli);
}
}
else if (ownerSide_)
@ -239,10 +239,10 @@ void Foam::edgeFaceCirculator::setCanonical()
}
else
{
label cellI = mesh_.faceOwner()[faceLabel_];
otherFace(cellI);
label celli = mesh_.faceOwner()[faceLabel_];
otherFace(celli);
// Maintain reverse direction of walking
ownerSide_ = (mesh_.faceOwner()[faceLabel_] == cellI);
ownerSide_ = (mesh_.faceOwner()[faceLabel_] == celli);
}
i++;
@ -268,7 +268,7 @@ void Foam::edgeFaceCirculator::setCanonical()
else
{
// Internal edge. Walk until we hit minimum face label.
label minFaceI = faceLabel_;
label minFacei = faceLabel_;
bool minOwnerSide = ownerSide_;
label minIndex = index_;
@ -295,15 +295,15 @@ void Foam::edgeFaceCirculator::setCanonical()
<< abort(FatalError);
}
if (faceLabel_ < minFaceI)
if (faceLabel_ < minFacei)
{
minFaceI = faceLabel_;
minFacei = faceLabel_;
minOwnerSide = ownerSide_;
minIndex = index_;
}
}
faceLabel_ = minFaceI;
faceLabel_ = minFacei;
ownerSide_ = minOwnerSide;
index_ = minIndex;
startFaceLabel_ = faceLabel_;
@ -360,10 +360,10 @@ Foam::edgeFaceCirculator::operator++()
else if (ownerSide_)
{
// Step to owner
label cellI = mesh_.faceOwner()[faceLabel_];
otherFace(cellI);
label celli = mesh_.faceOwner()[faceLabel_];
otherFace(celli);
// Maintain direction of walking
ownerSide_ = (mesh_.faceOwner()[faceLabel_] != cellI);
ownerSide_ = (mesh_.faceOwner()[faceLabel_] != celli);
// Check for internal edge : ends on starting face.
if (!isBoundaryEdge_ && faceLabel_ == startFaceLabel_)
@ -374,10 +374,10 @@ Foam::edgeFaceCirculator::operator++()
else if (mesh_.isInternalFace(faceLabel_))
{
// Step to neighbour
label cellI = mesh_.faceNeighbour()[faceLabel_];
otherFace(cellI);
label celli = mesh_.faceNeighbour()[faceLabel_];
otherFace(celli);
// Maintain direction of walking
ownerSide_ = (mesh_.faceOwner()[faceLabel_] != cellI);
ownerSide_ = (mesh_.faceOwner()[faceLabel_] != celli);
// Check for internal edge : ends on starting face.
if (!isBoundaryEdge_ && faceLabel_ == startFaceLabel_)

View File

@ -39,11 +39,11 @@ namespace Foam
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
Foam::treeBoundBox Foam::treeDataFace::calcBb(const label faceI) const
Foam::treeBoundBox Foam::treeDataFace::calcBb(const label facei) const
{
const pointField& points = mesh_.points();
const face& f = mesh_.faces()[faceI];
const face& f = mesh_.faces()[facei];
treeBoundBox bb(points[f[0]], points[f[0]]);
@ -207,12 +207,12 @@ Foam::volumeType Foam::treeDataFace::getVolumeType
// Get actual intersection point on face
label faceI = faceLabels_[info.index()];
label facei = faceLabels_[info.index()];
if (debug & 2)
{
Pout<< "getSampleType : sample:" << sample
<< " nearest face:" << faceI;
<< " nearest face:" << facei;
}
const pointField& points = mesh_.points();
@ -220,9 +220,9 @@ Foam::volumeType Foam::treeDataFace::getVolumeType
// Retest to classify where on face info is. Note: could be improved. We
// already have point.
const face& f = mesh_.faces()[faceI];
const vector& area = mesh_.faceAreas()[faceI];
const point& fc = mesh_.faceCentres()[faceI];
const face& f = mesh_.faces()[facei];
const vector& area = mesh_.faceAreas()[facei];
const point& fc = mesh_.faceCentres()[facei];
pointHit curHit = f.nearestPoint(sample, points);
const point& curPt = curHit.rawPoint();
@ -312,7 +312,7 @@ Foam::volumeType Foam::treeDataFace::getVolumeType
// 3] Get the 'real' edge the face intersection is on
//
const labelList& myEdges = mesh_.faceEdges()[faceI];
const labelList& myEdges = mesh_.faceEdges()[facei];
forAll(myEdges, myEdgeI)
{
@ -413,7 +413,7 @@ Foam::volumeType Foam::treeDataFace::getVolumeType
if (debug & 2)
{
Pout<< "Did not find sample " << sample
<< " anywhere related to nearest face " << faceI << endl
<< " anywhere related to nearest face " << facei << endl
<< "Face:";
forAll(f, fp)
@ -459,9 +459,9 @@ bool Foam::treeDataFace::overlaps
// 2. Check if one or more face points inside
label faceI = faceLabels_[index];
label facei = faceLabels_[index];
const face& f = mesh_.faces()[faceI];
const face& f = mesh_.faces()[facei];
if (cubeBb.containsAny(points, f))
{
return true;
@ -469,7 +469,7 @@ bool Foam::treeDataFace::overlaps
// 3. Difficult case: all points are outside but connecting edges might
// go through cube. Use triangle-bounding box intersection.
const point& fc = mesh_.faceCentres()[faceI];
const point& fc = mesh_.faceCentres()[facei];
forAll(f, fp)
{
@ -558,15 +558,15 @@ bool Foam::treeDataFace::findIntersectOp::operator()
}
}
const label faceI = shape.faceLabels_[index];
const label facei = shape.faceLabels_[index];
const vector dir(end - start);
pointHit inter = shape.mesh_.faces()[faceI].intersection
pointHit inter = shape.mesh_.faces()[facei].intersection
(
start,
dir,
shape.mesh_.faceCentres()[faceI],
shape.mesh_.faceCentres()[facei],
shape.mesh_.points(),
intersection::HALF_RAY
);

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -85,7 +85,7 @@ class treeDataFace
// Private Member Functions
//- Calculate face bounding box
treeBoundBox calcBb(const label cellI) const;
treeBoundBox calcBb(const label celli) const;
//- Initialise all member data
void update();

View File

@ -104,8 +104,8 @@ bool Foam::treeDataPoint::overlaps
const treeBoundBox& cubeBb
) const
{
label pointI = (useSubset_ ? pointLabels_[index] : index);
return cubeBb.contains(points_[pointI]);
label pointi = (useSubset_ ? pointLabels_[index] : index);
return cubeBb.contains(points_[pointi]);
}
@ -116,9 +116,9 @@ bool Foam::treeDataPoint::overlaps
const scalar radiusSqr
) const
{
label pointI = (useSubset_ ? pointLabels_[index] : index);
label pointi = (useSubset_ ? pointLabels_[index] : index);
if (magSqr(points_[pointI] - centre) <= radiusSqr)
if (magSqr(points_[pointi] - centre) <= radiusSqr)
{
return true;
}
@ -142,14 +142,14 @@ void Foam::treeDataPoint::findNearestOp::operator()
forAll(indices, i)
{
const label index = indices[i];
label pointI =
label pointi =
(
shape.useSubset()
? shape.pointLabels()[index]
: index
);
const point& pt = shape.points()[pointI];
const point& pt = shape.points()[pointi];
scalar distSqr = magSqr(pt - sample);
@ -186,14 +186,14 @@ void Foam::treeDataPoint::findNearestOp::operator()
forAll(indices, i)
{
const label index = indices[i];
label pointI =
label pointi =
(
shape.useSubset()
? shape.pointLabels()[index]
: index
);
const point& shapePt = shape.points()[pointI];
const point& shapePt = shape.points()[pointi];
if (tightest.contains(shapePt))
{

View File

@ -175,12 +175,12 @@ Foam::volumeType Foam::treeDataPrimitivePatch<PatchType>::getVolumeType
}
// Get actual intersection point on face
label faceI = info.index();
label facei = info.index();
if (debug & 2)
{
Pout<< "getSampleType : sample:" << sample
<< " nearest face:" << faceI;
<< " nearest face:" << facei;
}
const typename PatchType::FaceType& localF = patch_.localFaces()[faceI];
@ -271,7 +271,7 @@ Foam::volumeType Foam::treeDataPrimitivePatch<PatchType>::getVolumeType
// 3] Get the 'real' edge the face intersection is on
//
const labelList& fEdges = patch_.faceEdges()[faceI];
const labelList& fEdges = patch_.faceEdges()[facei];
forAll(fEdges, fEdgeI)
{
@ -357,7 +357,7 @@ Foam::volumeType Foam::treeDataPrimitivePatch<PatchType>::getVolumeType
if (debug & 2)
{
Pout<< "Did not find sample " << sample
<< " anywhere related to nearest face " << faceI << endl
<< " anywhere related to nearest face " << facei << endl
<< "Face:";
forAll(f, fp)

View File

@ -46,13 +46,13 @@ Foam::volumeType Foam::treeDataPrimitivePatch<Foam::triSurface>::getVolumeType
}
// Get actual intersection point on face
label faceI = info.index();
label facei = info.index();
triSurfaceTools::sideType t = triSurfaceTools::surfaceSide
(
patch_,
sample,
faceI
facei
);
if (t == triSurfaceTools::UNKNOWN)

View File

@ -101,12 +101,12 @@ Foam::tmp<Foam::pointField> Foam::mappedPatchBase::facePoints
tmp<pointField> tfacePoints(new pointField(patch_.size()));
pointField& facePoints = tfacePoints.ref();
forAll(pp, faceI)
forAll(pp, facei)
{
facePoints[faceI] = facePoint
facePoints[facei] = facePoint
(
mesh,
pp.start()+faceI,
pp.start()+facei,
polyMesh::FACE_DIAG_TRIS
).rawPoint();
}
@ -174,11 +174,11 @@ void Foam::mappedPatchBase::collectSamples
patchFaceProcs.setSize(patchFaces.size());
label sampleI = 0;
forAll(nPerProc, procI)
forAll(nPerProc, proci)
{
for (label i = 0; i < nPerProc[procI]; i++)
for (label i = 0; i < nPerProc[proci]; i++)
{
patchFaceProcs[sampleI++] = procI;
patchFaceProcs[sampleI++] = proci;
}
}
}
@ -220,22 +220,22 @@ void Foam::mappedPatchBase::findSamples
{
const point& sample = samples[sampleI];
label cellI = tree.findInside(sample);
label celli = tree.findInside(sample);
if (cellI == -1)
if (celli == -1)
{
nearest[sampleI].second().first() = Foam::sqr(GREAT);
nearest[sampleI].second().second() = Pstream::myProcNo();
}
else
{
const point& cc = mesh.cellCentres()[cellI];
const point& cc = mesh.cellCentres()[celli];
nearest[sampleI].first() = pointIndexHit
(
true,
cc,
cellI
celli
);
nearest[sampleI].second().first() = magSqr(cc-sample);
nearest[sampleI].second().second() = Pstream::myProcNo();
@ -433,22 +433,22 @@ void Foam::mappedPatchBase::findSamples
{
const point& sample = samples[sampleI];
label faceI = meshSearchEngine.findNearestFace(sample);
label facei = meshSearchEngine.findNearestFace(sample);
if (faceI == -1)
if (facei == -1)
{
nearest[sampleI].second().first() = Foam::sqr(GREAT);
nearest[sampleI].second().second() = Pstream::myProcNo();
}
else
{
const point& fc = mesh.faceCentres()[faceI];
const point& fc = mesh.faceCentres()[facei];
nearest[sampleI].first() = pointIndexHit
(
true,
fc,
faceI
facei
);
nearest[sampleI].second().first() = magSqr(fc-sample);
nearest[sampleI].second().second() = Pstream::myProcNo();
@ -483,11 +483,11 @@ void Foam::mappedPatchBase::findSamples
forAll(nearest, sampleI)
{
label procI = nearest[sampleI].second().second();
label proci = nearest[sampleI].second().second();
label localI = nearest[sampleI].first().index();
Info<< " " << sampleI << " coord:"<< samples[sampleI]
<< " found on processor:" << procI
<< " found on processor:" << proci
<< " in local cell/face/point:" << localI
<< " with location:" << nearest[sampleI].first().rawPoint()
<< endl;
@ -702,26 +702,26 @@ void Foam::mappedPatchBase::calcMapping() const
labelListList& subMap = mapPtr_().subMap();
labelListList& constructMap = mapPtr_().constructMap();
forAll(subMap, procI)
forAll(subMap, proci)
{
subMap[procI] = UIndirectList<label>
subMap[proci] = UIndirectList<label>
(
sampleIndices,
subMap[procI]
subMap[proci]
);
constructMap[procI] = UIndirectList<label>
constructMap[proci] = UIndirectList<label>
(
patchFaces,
constructMap[procI]
constructMap[proci]
);
//if (debug)
//{
// Pout<< "To proc:" << procI << " sending values of cells/faces:"
// << subMap[procI] << endl;
// Pout<< "From proc:" << procI
// Pout<< "To proc:" << proci << " sending values of cells/faces:"
// << subMap[proci] << endl;
// Pout<< "From proc:" << proci
// << " receiving values of patch faces:"
// << constructMap[procI] << endl;
// << constructMap[proci] << endl;
//}
}
@ -732,35 +732,35 @@ void Foam::mappedPatchBase::calcMapping() const
{
// Check that all elements get a value.
PackedBoolList used(patch_.size());
forAll(constructMap, procI)
forAll(constructMap, proci)
{
const labelList& map = constructMap[procI];
const labelList& map = constructMap[proci];
forAll(map, i)
{
label faceI = map[i];
label facei = map[i];
if (used[faceI] == 0)
if (used[facei] == 0)
{
used[faceI] = 1;
used[facei] = 1;
}
else
{
FatalErrorInFunction
<< "On patch " << patch_.name()
<< " patchface " << faceI
<< " patchface " << facei
<< " is assigned to more than once."
<< abort(FatalError);
}
}
}
forAll(used, faceI)
forAll(used, facei)
{
if (used[faceI] == 0)
if (used[facei] == 0)
{
FatalErrorInFunction
<< "On patch " << patch_.name()
<< " patchface " << faceI
<< " patchface " << facei
<< " is never assigned to."
<< abort(FatalError);
}
@ -945,10 +945,10 @@ Foam::mappedPatchBase::mappedPatchBase
offsets_(pp.size(), offset_),
distance_(0),
sameRegion_(sampleRegion_ == patch_.boundaryMesh().mesh().name()),
mapPtr_(NULL),
AMIPtr_(NULL),
mapPtr_(nullptr),
AMIPtr_(nullptr),
AMIReverse_(false),
surfPtr_(NULL),
surfPtr_(nullptr),
surfDict_(fileName("surface"))
{}
@ -972,10 +972,10 @@ Foam::mappedPatchBase::mappedPatchBase
offsets_(offsets),
distance_(0),
sameRegion_(sampleRegion_ == patch_.boundaryMesh().mesh().name()),
mapPtr_(NULL),
AMIPtr_(NULL),
mapPtr_(nullptr),
AMIPtr_(nullptr),
AMIReverse_(false),
surfPtr_(NULL),
surfPtr_(nullptr),
surfDict_(fileName("surface"))
{}
@ -999,10 +999,10 @@ Foam::mappedPatchBase::mappedPatchBase
offsets_(0),
distance_(0),
sameRegion_(sampleRegion_ == patch_.boundaryMesh().mesh().name()),
mapPtr_(NULL),
AMIPtr_(NULL),
mapPtr_(nullptr),
AMIPtr_(nullptr),
AMIReverse_(false),
surfPtr_(NULL),
surfPtr_(nullptr),
surfDict_(fileName("surface"))
{}
@ -1026,10 +1026,10 @@ Foam::mappedPatchBase::mappedPatchBase
offsets_(0),
distance_(distance),
sameRegion_(sampleRegion_ == patch_.boundaryMesh().mesh().name()),
mapPtr_(NULL),
AMIPtr_(NULL),
mapPtr_(nullptr),
AMIPtr_(nullptr),
AMIReverse_(false),
surfPtr_(NULL),
surfPtr_(nullptr),
surfDict_(fileName("surface"))
{}
@ -1050,10 +1050,10 @@ Foam::mappedPatchBase::mappedPatchBase
offsets_(0),
distance_(0.0),
sameRegion_(sampleRegion_ == patch_.boundaryMesh().mesh().name()),
mapPtr_(NULL),
AMIPtr_(NULL),
mapPtr_(nullptr),
AMIPtr_(nullptr),
AMIReverse_(dict.lookupOrDefault<bool>("flipNormals", false)),
surfPtr_(NULL),
surfPtr_(nullptr),
surfDict_(dict.subOrEmptyDict("surface"))
{
if (!coupleGroup_.valid())
@ -1132,10 +1132,10 @@ Foam::mappedPatchBase::mappedPatchBase
offsets_(0),
distance_(0.0),
sameRegion_(sampleRegion_ == patch_.boundaryMesh().mesh().name()),
mapPtr_(NULL),
AMIPtr_(NULL),
mapPtr_(nullptr),
AMIPtr_(nullptr),
AMIReverse_(dict.lookupOrDefault<bool>("flipNormals", false)),
surfPtr_(NULL),
surfPtr_(nullptr),
surfDict_(dict.subOrEmptyDict("surface"))
{
if (mode != NEARESTPATCHFACE && mode != NEARESTPATCHFACEAMI)
@ -1179,10 +1179,10 @@ Foam::mappedPatchBase::mappedPatchBase
offsets_(mpb.offsets_),
distance_(mpb.distance_),
sameRegion_(mpb.sameRegion_),
mapPtr_(NULL),
AMIPtr_(NULL),
mapPtr_(nullptr),
AMIPtr_(nullptr),
AMIReverse_(mpb.AMIReverse_),
surfPtr_(NULL),
surfPtr_(nullptr),
surfDict_(mpb.surfDict_)
{}
@ -1209,10 +1209,10 @@ Foam::mappedPatchBase::mappedPatchBase
),
distance_(mpb.distance_),
sameRegion_(mpb.sameRegion_),
mapPtr_(NULL),
AMIPtr_(NULL),
mapPtr_(nullptr),
AMIPtr_(nullptr),
AMIReverse_(mpb.AMIReverse_),
surfPtr_(NULL),
surfPtr_(nullptr),
surfDict_(mpb.surfDict_)
{}
@ -1248,9 +1248,9 @@ const Foam::polyPatch& Foam::mappedPatchBase::samplePolyPatch() const
{
const polyMesh& nbrMesh = sampleMesh();
const label patchI = nbrMesh.boundaryMesh().findPatchID(samplePatch());
const label patchi = nbrMesh.boundaryMesh().findPatchID(samplePatch());
if (patchI == -1)
if (patchi == -1)
{
FatalErrorInFunction
<< "Cannot find patch " << samplePatch()
@ -1259,7 +1259,7 @@ const Foam::polyPatch& Foam::mappedPatchBase::samplePolyPatch() const
<< exit(FatalError);
}
return nbrMesh.boundaryMesh()[patchI];
return nbrMesh.boundaryMesh()[patchi];
}
@ -1307,11 +1307,11 @@ Foam::tmp<Foam::pointField> Foam::mappedPatchBase::samplePoints() const
Foam::pointIndexHit Foam::mappedPatchBase::facePoint
(
const polyMesh& mesh,
const label faceI,
const label facei,
const polyMesh::cellDecomposition decompMode
)
{
const point& fc = mesh.faceCentres()[faceI];
const point& fc = mesh.faceCentres()[facei];
switch (decompMode)
{
@ -1320,7 +1320,7 @@ Foam::pointIndexHit Foam::mappedPatchBase::facePoint
{
// For both decompositions the face centre is guaranteed to be
// on the face
return pointIndexHit(true, fc, faceI);
return pointIndexHit(true, fc, facei);
}
break;
@ -1332,7 +1332,7 @@ Foam::pointIndexHit Foam::mappedPatchBase::facePoint
// cell-centre with face-diagonal-decomposition triangles.
const pointField& p = mesh.points();
const face& f = mesh.faces()[faceI];
const face& f = mesh.faces()[facei];
if (f.size() <= 3)
{
@ -1340,11 +1340,11 @@ Foam::pointIndexHit Foam::mappedPatchBase::facePoint
return pointIndexHit(true, fc, 0);
}
label cellI = mesh.faceOwner()[faceI];
const point& cc = mesh.cellCentres()[cellI];
label celli = mesh.faceOwner()[facei];
const point& cc = mesh.cellCentres()[celli];
vector d = fc-cc;
const label fp0 = mesh.tetBasePtIs()[faceI];
const label fp0 = mesh.tetBasePtIs()[facei];
const point& basePoint = p[f[fp0]];
label fp = f.fcIndex(fp0);

View File

@ -414,7 +414,7 @@ public:
static pointIndexHit facePoint
(
const polyMesh&,
const label faceI,
const label facei,
const polyMesh::cellDecomposition
);

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation | Copyright 2015 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
@ -53,14 +53,14 @@ bool Foam::meshSearch::findNearer
{
bool nearer = false;
forAll(points, pointI)
forAll(points, pointi)
{
scalar distSqr = magSqr(points[pointI] - sample);
scalar distSqr = magSqr(points[pointi] - sample);
if (distSqr < nearestDistSqr)
{
nearestDistSqr = distSqr;
nearestI = pointI;
nearestI = pointi;
nearer = true;
}
}
@ -82,14 +82,14 @@ bool Foam::meshSearch::findNearer
forAll(indices, i)
{
label pointI = indices[i];
label pointi = indices[i];
scalar distSqr = magSqr(points[pointI] - sample);
scalar distSqr = magSqr(points[pointi] - sample);
if (distSqr < nearestDistSqr)
{
nearestDistSqr = distSqr;
nearestI = pointI;
nearestI = pointi;
nearer = true;
}
}
@ -141,36 +141,36 @@ Foam::label Foam::meshSearch::findNearestCellLinear(const point& location) const
Foam::label Foam::meshSearch::findNearestCellWalk
(
const point& location,
const label seedCellI
const label seedCelli
) const
{
if (seedCellI < 0)
if (seedCelli < 0)
{
FatalErrorInFunction
<< "illegal seedCell:" << seedCellI << exit(FatalError);
<< "illegal seedCell:" << seedCelli << exit(FatalError);
}
// Walk in direction of face that decreases distance
label curCellI = seedCellI;
scalar distanceSqr = magSqr(mesh_.cellCentres()[curCellI] - location);
label curCelli = seedCelli;
scalar distanceSqr = magSqr(mesh_.cellCentres()[curCelli] - location);
bool closer;
do
{
// Try neighbours of curCellI
// Try neighbours of curCelli
closer = findNearer
(
location,
mesh_.cellCentres(),
mesh_.cellCells()[curCellI],
curCellI,
mesh_.cellCells()[curCelli],
curCelli,
distanceSqr
);
} while (closer);
return curCellI;
return curCelli;
}
@ -198,19 +198,19 @@ Foam::label Foam::meshSearch::findNearestFaceTree(const point& location) const
const vectorField& centres = mesh_.faceCentres();
const cell& ownFaces = mesh_.cells()[info.index()];
label nearestFaceI = ownFaces[0];
scalar minProximity = magSqr(centres[nearestFaceI] - location);
label nearestFacei = ownFaces[0];
scalar minProximity = magSqr(centres[nearestFacei] - location);
findNearer
(
location,
centres,
ownFaces,
nearestFaceI,
nearestFacei,
minProximity
);
return nearestFaceI;
return nearestFacei;
}
@ -219,18 +219,18 @@ Foam::label Foam::meshSearch::findNearestFaceLinear(const point& location) const
{
const vectorField& centres = mesh_.faceCentres();
label nearestFaceI = 0;
scalar minProximity = magSqr(centres[nearestFaceI] - location);
label nearestFacei = 0;
scalar minProximity = magSqr(centres[nearestFacei] - location);
findNearer
(
location,
centres,
nearestFaceI,
nearestFacei,
minProximity
);
return nearestFaceI;
return nearestFacei;
}
@ -238,13 +238,13 @@ Foam::label Foam::meshSearch::findNearestFaceLinear(const point& location) const
Foam::label Foam::meshSearch::findNearestFaceWalk
(
const point& location,
const label seedFaceI
const label seedFacei
) const
{
if (seedFaceI < 0)
if (seedFacei < 0)
{
FatalErrorInFunction
<< "illegal seedFace:" << seedFaceI << exit(FatalError);
<< "illegal seedFace:" << seedFacei << exit(FatalError);
}
const vectorField& centres = mesh_.faceCentres();
@ -252,43 +252,43 @@ Foam::label Foam::meshSearch::findNearestFaceWalk
// Walk in direction of face that decreases distance
label curFaceI = seedFaceI;
scalar distanceSqr = magSqr(centres[curFaceI] - location);
label curFacei = seedFacei;
scalar distanceSqr = magSqr(centres[curFacei] - location);
while (true)
{
label betterFaceI = curFaceI;
label betterFacei = curFacei;
findNearer
(
location,
centres,
mesh_.cells()[mesh_.faceOwner()[curFaceI]],
betterFaceI,
mesh_.cells()[mesh_.faceOwner()[curFacei]],
betterFacei,
distanceSqr
);
if (mesh_.isInternalFace(curFaceI))
if (mesh_.isInternalFace(curFacei))
{
findNearer
(
location,
centres,
mesh_.cells()[mesh_.faceNeighbour()[curFaceI]],
betterFaceI,
mesh_.cells()[mesh_.faceNeighbour()[curFacei]],
betterFacei,
distanceSqr
);
}
if (betterFaceI == curFaceI)
if (betterFacei == curFacei)
{
break;
}
curFaceI = betterFaceI;
curFacei = betterFacei;
}
return curFaceI;
return curFacei;
}
@ -297,14 +297,14 @@ Foam::label Foam::meshSearch::findCellLinear(const point& location) const
bool cellFound = false;
label n = 0;
label cellI = -1;
label celli = -1;
while ((!cellFound) && (n < mesh_.nCells()))
{
if (mesh_.pointInCell(location, n, cellDecompMode_))
{
cellFound = true;
cellI = n;
celli = n;
}
else
{
@ -313,7 +313,7 @@ Foam::label Foam::meshSearch::findCellLinear(const point& location) const
}
if (cellFound)
{
return cellI;
return celli;
}
else
{
@ -326,68 +326,68 @@ Foam::label Foam::meshSearch::findCellLinear(const point& location) const
Foam::label Foam::meshSearch::findCellWalk
(
const point& location,
const label seedCellI
const label seedCelli
) const
{
if (seedCellI < 0)
if (seedCelli < 0)
{
FatalErrorInFunction
<< "illegal seedCell:" << seedCellI << exit(FatalError);
<< "illegal seedCell:" << seedCelli << exit(FatalError);
}
if (mesh_.pointInCell(location, seedCellI, cellDecompMode_))
if (mesh_.pointInCell(location, seedCelli, cellDecompMode_))
{
return seedCellI;
return seedCelli;
}
// Walk in direction of face that decreases distance
label curCellI = seedCellI;
scalar nearestDistSqr = magSqr(mesh_.cellCentres()[curCellI] - location);
label curCelli = seedCelli;
scalar nearestDistSqr = magSqr(mesh_.cellCentres()[curCelli] - location);
while(true)
{
// Try neighbours of curCellI
// Try neighbours of curCelli
const cell& cFaces = mesh_.cells()[curCellI];
const cell& cFaces = mesh_.cells()[curCelli];
label nearestCellI = -1;
label nearestCelli = -1;
forAll(cFaces, i)
{
label faceI = cFaces[i];
label facei = cFaces[i];
if (mesh_.isInternalFace(faceI))
if (mesh_.isInternalFace(facei))
{
label cellI = mesh_.faceOwner()[faceI];
if (cellI == curCellI)
label celli = mesh_.faceOwner()[facei];
if (celli == curCelli)
{
cellI = mesh_.faceNeighbour()[faceI];
celli = mesh_.faceNeighbour()[facei];
}
// Check if this is the correct cell
if (mesh_.pointInCell(location, cellI, cellDecompMode_))
if (mesh_.pointInCell(location, celli, cellDecompMode_))
{
return cellI;
return celli;
}
// Also calculate the nearest cell
scalar distSqr = magSqr(mesh_.cellCentres()[cellI] - location);
scalar distSqr = magSqr(mesh_.cellCentres()[celli] - location);
if (distSqr < nearestDistSqr)
{
nearestDistSqr = distSqr;
nearestCellI = cellI;
nearestCelli = celli;
}
}
}
if (nearestCellI == -1)
if (nearestCelli == -1)
{
return -1;
}
// Continue with the nearest cell
curCellI = nearestCellI;
curCelli = nearestCelli;
}
return -1;
@ -397,20 +397,20 @@ Foam::label Foam::meshSearch::findCellWalk
Foam::label Foam::meshSearch::findNearestBoundaryFaceWalk
(
const point& location,
const label seedFaceI
const label seedFacei
) const
{
if (seedFaceI < 0)
if (seedFacei < 0)
{
FatalErrorInFunction
<< "illegal seedFace:" << seedFaceI << exit(FatalError);
<< "illegal seedFace:" << seedFacei << exit(FatalError);
}
// Start off from seedFaceI
// Start off from seedFacei
label curFaceI = seedFaceI;
label curFacei = seedFacei;
const face& f = mesh_.faces()[curFaceI];
const face& f = mesh_.faces()[curFacei];
scalar minDist = f.nearestPoint
(
@ -427,28 +427,28 @@ Foam::label Foam::meshSearch::findNearestBoundaryFaceWalk
// Search through all neighbouring boundary faces by going
// across edges
label lastFaceI = curFaceI;
label lastFacei = curFacei;
const labelList& myEdges = mesh_.faceEdges()[curFaceI];
const labelList& myEdges = mesh_.faceEdges()[curFacei];
forAll(myEdges, myEdgeI)
{
const labelList& neighbours = mesh_.edgeFaces()[myEdges[myEdgeI]];
// Check any face which uses edge, is boundary face and
// is not curFaceI itself.
// is not curFacei itself.
forAll(neighbours, nI)
{
label faceI = neighbours[nI];
label facei = neighbours[nI];
if
(
(faceI >= mesh_.nInternalFaces())
&& (faceI != lastFaceI)
(facei >= mesh_.nInternalFaces())
&& (facei != lastFacei)
)
{
const face& f = mesh_.faces()[faceI];
const face& f = mesh_.faces()[facei];
pointHit curHit = f.nearestPoint
(
@ -460,7 +460,7 @@ Foam::label Foam::meshSearch::findNearestBoundaryFaceWalk
if (curHit.distance() < minDist)
{
minDist = curHit.distance();
curFaceI = faceI;
curFacei = facei;
closer = true; // a closer neighbour has been found
}
}
@ -468,21 +468,21 @@ Foam::label Foam::meshSearch::findNearestBoundaryFaceWalk
}
} while (closer);
return curFaceI;
return curFacei;
}
Foam::vector Foam::meshSearch::offset
(
const point& bPoint,
const label bFaceI,
const label bFacei,
const vector& dir
) const
{
// Get the neighbouring cell
label ownerCellI = mesh_.faceOwner()[bFaceI];
label ownerCelli = mesh_.faceOwner()[bFacei];
const point& c = mesh_.cellCentres()[ownerCellI];
const point& c = mesh_.cellCentres()[ownerCelli];
// Typical dimension: distance from point on face to cell centre
scalar typDim = mag(c - bPoint);
@ -652,18 +652,18 @@ const
//// Works by checking if there is a face inbetween the point and the cell
//// centre.
//// Check for internal uses proper face decomposition or just average normal.
//bool Foam::meshSearch::pointInCell(const point& p, label cellI) const
//bool Foam::meshSearch::pointInCell(const point& p, label celli) const
//{
// if (faceDecomp_)
// {
// const point& ctr = mesh_.cellCentres()[cellI];
// const point& ctr = mesh_.cellCentres()[celli];
//
// vector dir(p - ctr);
// scalar magDir = mag(dir);
//
// // Check if any faces are hit by ray from cell centre to p.
// // If none -> p is in cell.
// const labelList& cFaces = mesh_.cells()[cellI];
// const labelList& cFaces = mesh_.cells()[celli];
//
// // Make sure half_ray does not pick up any faces on the wrong
// // side of the ray.
@ -671,9 +671,9 @@ const
//
// forAll(cFaces, i)
// {
// label faceI = cFaces[i];
// label facei = cFaces[i];
//
// pointHit inter = mesh_.faces()[faceI].ray
// pointHit inter = mesh_.faces()[facei].ray
// (
// ctr,
// dir,
@ -703,7 +703,7 @@ const
// }
// else
// {
// const labelList& f = mesh_.cells()[cellI];
// const labelList& f = mesh_.cells()[celli];
// const labelList& owner = mesh_.faceOwner();
// const vectorField& cf = mesh_.faceCentres();
// const vectorField& Sf = mesh_.faceAreas();
@ -713,7 +713,7 @@ const
// label nFace = f[facei];
// vector proj = p - cf[nFace];
// vector normal = Sf[nFace];
// if (owner[nFace] == cellI)
// if (owner[nFace] == celli)
// {
// if ((normal & proj) > 0)
// {
@ -737,11 +737,11 @@ const
Foam::label Foam::meshSearch::findNearestCell
(
const point& location,
const label seedCellI,
const label seedCelli,
const bool useTreeSearch
) const
{
if (seedCellI == -1)
if (seedCelli == -1)
{
if (useTreeSearch)
{
@ -754,7 +754,7 @@ Foam::label Foam::meshSearch::findNearestCell
}
else
{
return findNearestCellWalk(location, seedCellI);
return findNearestCellWalk(location, seedCelli);
}
}
@ -762,11 +762,11 @@ Foam::label Foam::meshSearch::findNearestCell
Foam::label Foam::meshSearch::findNearestFace
(
const point& location,
const label seedFaceI,
const label seedFacei,
const bool useTreeSearch
) const
{
if (seedFaceI == -1)
if (seedFacei == -1)
{
if (useTreeSearch)
{
@ -779,7 +779,7 @@ Foam::label Foam::meshSearch::findNearestFace
}
else
{
return findNearestFaceWalk(location, seedFaceI);
return findNearestFaceWalk(location, seedFacei);
}
}
@ -787,12 +787,12 @@ Foam::label Foam::meshSearch::findNearestFace
Foam::label Foam::meshSearch::findCell
(
const point& location,
const label seedCellI,
const label seedCelli,
const bool useTreeSearch
) const
{
// Find the nearest cell centre to this location
if (seedCellI == -1)
if (seedCelli == -1)
{
if (useTreeSearch)
{
@ -805,7 +805,7 @@ Foam::label Foam::meshSearch::findCell
}
else
{
return findCellWalk(location, seedCellI);
return findCellWalk(location, seedCelli);
}
}
@ -813,11 +813,11 @@ Foam::label Foam::meshSearch::findCell
Foam::label Foam::meshSearch::findNearestBoundaryFace
(
const point& location,
const label seedFaceI,
const label seedFacei,
const bool useTreeSearch
) const
{
if (seedFaceI == -1)
if (seedFacei == -1)
{
if (useTreeSearch)
{
@ -844,16 +844,16 @@ Foam::label Foam::meshSearch::findNearestBoundaryFace
{
scalar minDist = GREAT;
label minFaceI = -1;
label minFacei = -1;
for
(
label faceI = mesh_.nInternalFaces();
faceI < mesh_.nFaces();
faceI++
label facei = mesh_.nInternalFaces();
facei < mesh_.nFaces();
facei++
)
{
const face& f = mesh_.faces()[faceI];
const face& f = mesh_.faces()[facei];
pointHit curHit =
f.nearestPoint
@ -865,15 +865,15 @@ Foam::label Foam::meshSearch::findNearestBoundaryFace
if (curHit.distance() < minDist)
{
minDist = curHit.distance();
minFaceI = faceI;
minFacei = facei;
}
}
return minFaceI;
return minFacei;
}
}
else
{
return findNearestBoundaryFaceWalk(location, seedFaceI);
return findNearestBoundaryFaceWalk(location, seedFacei);
}
}

View File

@ -132,7 +132,7 @@ class meshSearch
label findNearestBoundaryFaceWalk
(
const point& location,
const label seedFaceI
const label seedFacei
) const;
//- Calculate offset vector in direction dir with as length a
@ -140,7 +140,7 @@ class meshSearch
vector offset
(
const point& bPoint,
const label bFaceI,
const label bFacei,
const vector& dir
) const;
@ -221,14 +221,14 @@ public:
label findNearestCell
(
const point& location,
const label seedCellI = -1,
const label seedCelli = -1,
const bool useTreeSearch = true
) const;
label findNearestFace
(
const point& location,
const label seedFaceI = -1,
const label seedFacei = -1,
const bool useTreeSearch = true
) const;
@ -239,7 +239,7 @@ public:
label findCell
(
const point& location,
const label seedCellI = -1,
const label seedCelli = -1,
const bool useTreeSearch = true
) const;
@ -250,7 +250,7 @@ public:
label findNearestBoundaryFace
(
const point& location,
const label seedFaceI = -1,
const label seedFacei = -1,
const bool useTreeSearch = true
) const;

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2013 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2013-2016 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -43,10 +43,10 @@ bool Foam::meshStructure::isStructuredCell
(
const polyMesh& mesh,
const label layerI,
const label cellI
const label celli
) const
{
const cell& cFaces = mesh.cells()[cellI];
const cell& cFaces = mesh.cells()[celli];
// Count number of side faces
label nSide = 0;
@ -74,12 +74,12 @@ bool Foam::meshStructure::isStructuredCell
label nLayerPlus1 = 0;
forAll(f, fp)
{
label pointI = f[fp];
if (pointLayer_[pointI] == layerI)
label pointi = f[fp];
if (pointLayer_[pointi] == layerI)
{
nLayer++;
}
else if (pointLayer_[pointI] == layerI+1)
else if (pointLayer_[pointi] == layerI+1)
{
nLayerPlus1++;
}
@ -118,10 +118,10 @@ void Foam::meshStructure::correct
// Start of changes
labelList patchFaces(pp.size());
List<topoDistanceData> patchData(pp.size());
forAll(pp, patchFaceI)
forAll(pp, patchFacei)
{
patchFaces[patchFaceI] = pp.addressing()[patchFaceI];
patchData[patchFaceI] = topoDistanceData(patchFaceI, 0);
patchFaces[patchFacei] = pp.addressing()[patchFacei];
patchData[patchFacei] = topoDistanceData(patchFacei, 0);
}
@ -142,10 +142,10 @@ void Foam::meshStructure::correct
cellToPatchFaceAddressing_.setSize(mesh.nCells());
cellLayer_.setSize(mesh.nCells());
forAll(cellToPatchFaceAddressing_, cellI)
forAll(cellToPatchFaceAddressing_, celli)
{
cellToPatchFaceAddressing_[cellI] = cellData[cellI].data();
cellLayer_[cellI] = cellData[cellI].distance();
cellToPatchFaceAddressing_[celli] = cellData[celli].data();
cellLayer_[celli] = cellData[celli].distance();
}
@ -158,43 +158,43 @@ void Foam::meshStructure::correct
faceToPatchEdgeAddressing_ = labelMin;
faceLayer_.setSize(mesh.nFaces());
forAll(faceToPatchFaceAddressing_, faceI)
forAll(faceToPatchFaceAddressing_, facei)
{
label own = mesh.faceOwner()[faceI];
label patchFaceI = faceData[faceI].data();
label patchDist = faceData[faceI].distance();
label own = mesh.faceOwner()[facei];
label patchFacei = faceData[facei].data();
label patchDist = faceData[facei].distance();
if (mesh.isInternalFace(faceI))
if (mesh.isInternalFace(facei))
{
label nei = mesh.faceNeighbour()[faceI];
label nei = mesh.faceNeighbour()[facei];
if (cellData[own].distance() == cellData[nei].distance())
{
// side face
faceToPatchFaceAddressing_[faceI] = 0;
faceLayer_[faceI] = cellData[own].distance();
faceToPatchFaceAddressing_[facei] = 0;
faceLayer_[facei] = cellData[own].distance();
}
else if (cellData[own].distance() < cellData[nei].distance())
{
// unturned face
faceToPatchFaceAddressing_[faceI] = patchFaceI+1;
faceToPatchEdgeAddressing_[faceI] = -1;
faceLayer_[faceI] = patchDist;
faceToPatchFaceAddressing_[facei] = patchFacei+1;
faceToPatchEdgeAddressing_[facei] = -1;
faceLayer_[facei] = patchDist;
}
else
{
// turned face
faceToPatchFaceAddressing_[faceI] = -(patchFaceI+1);
faceToPatchEdgeAddressing_[faceI] = -1;
faceLayer_[faceI] = patchDist;
faceToPatchFaceAddressing_[facei] = -(patchFacei+1);
faceToPatchEdgeAddressing_[facei] = -1;
faceLayer_[facei] = patchDist;
}
}
else if (patchDist == cellData[own].distance())
{
// starting face
faceToPatchFaceAddressing_[faceI] = -(patchFaceI+1);
faceToPatchEdgeAddressing_[faceI] = -1;
faceLayer_[faceI] = patchDist;
faceToPatchFaceAddressing_[facei] = -(patchFacei+1);
faceToPatchEdgeAddressing_[facei] = -1;
faceLayer_[facei] = patchDist;
}
else
{
@ -227,10 +227,10 @@ void Foam::meshStructure::correct
// Start of changes
labelList patchPoints(pp.nPoints());
List<pointTopoDistanceData> patchData(pp.nPoints());
forAll(pp.meshPoints(), patchPointI)
forAll(pp.meshPoints(), patchPointi)
{
patchPoints[patchPointI] = pp.meshPoints()[patchPointI];
patchData[patchPointI] = pointTopoDistanceData(patchPointI, 0);
patchPoints[patchPointi] = pp.meshPoints()[patchPointi];
patchData[patchPointi] = pointTopoDistanceData(patchPointi, 0);
}
@ -246,10 +246,10 @@ void Foam::meshStructure::correct
mesh.globalData().nTotalPoints() // max iterations
);
forAll(pointData, pointI)
forAll(pointData, pointi)
{
pointToPatchPointAddressing_[pointI] = pointData[pointI].data();
pointLayer_[pointI] = pointData[pointI].distance();
pointToPatchPointAddressing_[pointi] = pointData[pointi].data();
pointLayer_[pointi] = pointData[pointi].distance();
}
@ -261,14 +261,14 @@ void Foam::meshStructure::correct
}
// Look up on faces
forAll(faceToPatchEdgeAddressing_, faceI)
forAll(faceToPatchEdgeAddressing_, facei)
{
if (faceToPatchEdgeAddressing_[faceI] == labelMin)
if (faceToPatchEdgeAddressing_[facei] == labelMin)
{
// Face not yet done. Check if all points on same level
// or if not see what edge it originates from
const face& f = mesh.faces()[faceI];
const face& f = mesh.faces()[facei];
label levelI = pointLayer_[f[0]];
for (label fp = 1; fp < f.size(); fp++)
@ -283,19 +283,19 @@ void Foam::meshStructure::correct
if (levelI != -1)
{
// All same level
//Pout<< "Horizontal boundary face " << faceI
// << " at:" << mesh.faceCentres()[faceI]
// << " data:" << faceData[faceI]
//Pout<< "Horizontal boundary face " << facei
// << " at:" << mesh.faceCentres()[facei]
// << " data:" << faceData[facei]
// << " pointDatas:"
// << UIndirectList<pointTopoDistanceData>(pointData, f)
// << endl;
label patchFaceI = faceData[faceI].data();
label patchDist = faceData[faceI].distance();
label patchFacei = faceData[facei].data();
label patchDist = faceData[facei].distance();
faceToPatchEdgeAddressing_[faceI] = -1;
faceToPatchFaceAddressing_[faceI] = patchFaceI+1;
faceLayer_[faceI] = patchDist;
faceToPatchEdgeAddressing_[facei] = -1;
faceToPatchFaceAddressing_[facei] = patchFacei+1;
faceLayer_[facei] = patchDist;
}
else
{
@ -304,23 +304,23 @@ void Foam::meshStructure::correct
// See if there is any edge
forAll(f, fp)
{
label pointI = f[fp];
label nextPointI = f.nextLabel(fp);
label pointi = f[fp];
label nextPointi = f.nextLabel(fp);
EdgeMap<label>::const_iterator fnd = pointsToEdge.find
(
edge
(
pointData[pointI].data(),
pointData[nextPointI].data()
pointData[pointi].data(),
pointData[nextPointi].data()
)
);
if (fnd != pointsToEdge.end())
{
faceToPatchEdgeAddressing_[faceI] = fnd();
faceToPatchFaceAddressing_[faceI] = 0;
label own = mesh.faceOwner()[faceI];
faceLayer_[faceI] = cellData[own].distance();
faceToPatchEdgeAddressing_[facei] = fnd();
faceToPatchFaceAddressing_[facei] = 0;
label own = mesh.faceOwner()[facei];
faceLayer_[facei] = cellData[own].distance();
// Note: could test whether the other edges on the
// face are consistent
@ -344,15 +344,15 @@ void Foam::meshStructure::correct
{
const labelList& lCells = layerToCells[layerI];
forAll(lCells, lCellI)
forAll(lCells, lCelli)
{
label cellI = lCells[lCellI];
label celli = lCells[lCelli];
structured_ = isStructuredCell
(
mesh,
layerI,
cellI
celli
);
if (!structured_)

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2013 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2013-2016 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -88,7 +88,7 @@ class meshStructure
(
const polyMesh& mesh,
const label layerI,
const label cellI
const label celli
) const;
//- Calculate all maps.

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2013 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2013-2016 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -48,6 +48,15 @@ namespace Foam
class polyPatch;
class polyMesh;
// Forward declaration of friend functions and operators
class pointTopoDistanceData;
Istream& operator>>(Istream&, pointTopoDistanceData&);
Ostream& operator<<(Ostream&, const pointTopoDistanceData&);
/*---------------------------------------------------------------------------*\
Class pointTopoDistanceData Declaration
\*---------------------------------------------------------------------------*/
@ -116,7 +125,7 @@ public:
inline void leaveDomain
(
const polyPatch& patch,
const label patchPointI,
const label patchPointi,
const point& pos,
TrackingData& td
);
@ -126,7 +135,7 @@ public:
inline void enterDomain
(
const polyPatch& patch,
const label patchPointI,
const label patchPointi,
const point& pos,
TrackingData& td
);
@ -144,7 +153,7 @@ public:
inline bool updatePoint
(
const polyMesh& mesh,
const label pointI,
const label pointi,
const label edgeI,
const pointTopoDistanceData& edgeInfo,
const scalar tol,
@ -157,7 +166,7 @@ public:
inline bool updatePoint
(
const polyMesh& mesh,
const label pointI,
const label pointi,
const pointTopoDistanceData& newPointInfo,
const scalar tol,
TrackingData& td
@ -179,7 +188,7 @@ public:
(
const polyMesh& mesh,
const label edgeI,
const label pointI,
const label pointi,
const pointTopoDistanceData& pointInfo,
const scalar tol,
TrackingData& td

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2013 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2013-2016 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -77,7 +77,7 @@ template<class TrackingData>
inline void Foam::pointTopoDistanceData::leaveDomain
(
const polyPatch& patch,
const label patchPointI,
const label patchPointi,
const point& coord,
TrackingData& td
)
@ -99,7 +99,7 @@ template<class TrackingData>
inline void Foam::pointTopoDistanceData::enterDomain
(
const polyPatch& patch,
const label patchPointI,
const label patchPointi,
const point& coord,
TrackingData& td
)
@ -111,7 +111,7 @@ template<class TrackingData>
inline bool Foam::pointTopoDistanceData::updatePoint
(
const polyMesh& mesh,
const label pointI,
const label pointi,
const label edgeI,
const pointTopoDistanceData& edgeInfo,
const scalar tol,
@ -136,7 +136,7 @@ template<class TrackingData>
inline bool Foam::pointTopoDistanceData::updatePoint
(
const polyMesh& mesh,
const label pointI,
const label pointi,
const pointTopoDistanceData& newPointInfo,
const scalar tol,
TrackingData& td
@ -181,7 +181,7 @@ inline bool Foam::pointTopoDistanceData::updateEdge
(
const polyMesh& mesh,
const label edgeI,
const label pointI,
const label pointi,
const pointTopoDistanceData& pointInfo,
const scalar tol,
TrackingData& td

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -47,6 +47,15 @@ namespace Foam
class polyPatch;
class polyMesh;
// Forward declaration of friend functions and operators
class topoDistanceData;
Istream& operator>>(Istream&, topoDistanceData&);
Ostream& operator<<(Ostream&, const topoDistanceData&);
/*---------------------------------------------------------------------------*\
Class topoDistanceData Declaration
\*---------------------------------------------------------------------------*/
@ -116,7 +125,7 @@ public:
(
const polyMesh&,
const polyPatch&,
const label patchFaceI,
const label patchFacei,
const point& faceCentre,
TrackingData& td
);
@ -127,7 +136,7 @@ public:
(
const polyMesh&,
const polyPatch&,
const label patchFaceI,
const label patchFacei,
const point& faceCentre,
TrackingData& td
);
@ -146,8 +155,8 @@ public:
inline bool updateCell
(
const polyMesh&,
const label thisCellI,
const label neighbourFaceI,
const label thisCelli,
const label neighbourFacei,
const topoDistanceData& neighbourInfo,
const scalar tol,
TrackingData& td
@ -158,8 +167,8 @@ public:
inline bool updateFace
(
const polyMesh&,
const label thisFaceI,
const label neighbourCellI,
const label thisFacei,
const label neighbourCelli,
const topoDistanceData& neighbourInfo,
const scalar tol,
TrackingData& td
@ -170,7 +179,7 @@ public:
inline bool updateFace
(
const polyMesh&,
const label thisFaceI,
const label thisFacei,
const topoDistanceData& neighbourInfo,
const scalar tol,
TrackingData& td

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -79,7 +79,7 @@ inline void Foam::topoDistanceData::leaveDomain
(
const polyMesh&,
const polyPatch& patch,
const label patchFaceI,
const label patchFacei,
const point& faceCentre,
TrackingData&
)
@ -103,7 +103,7 @@ inline void Foam::topoDistanceData::enterDomain
(
const polyMesh&,
const polyPatch& patch,
const label patchFaceI,
const label patchFacei,
const point& faceCentre,
TrackingData&
)
@ -115,8 +115,8 @@ template<class TrackingData>
inline bool Foam::topoDistanceData::updateCell
(
const polyMesh&,
const label thisCellI,
const label neighbourFaceI,
const label thisCelli,
const label neighbourFacei,
const topoDistanceData& neighbourInfo,
const scalar tol,
TrackingData&
@ -139,8 +139,8 @@ template<class TrackingData>
inline bool Foam::topoDistanceData::updateFace
(
const polyMesh& mesh,
const label thisFaceI,
const label neighbourCellI,
const label thisFacei,
const label neighbourCelli,
const topoDistanceData& neighbourInfo,
const scalar tol,
TrackingData&
@ -166,7 +166,7 @@ template<class TrackingData>
inline bool Foam::topoDistanceData::updateFace
(
const polyMesh&,
const label thisFaceI,
const label thisFacei,
const topoDistanceData& neighbourInfo,
const scalar tol,
TrackingData&

View File

@ -71,19 +71,19 @@ Foam::vectorField Foam::meshTools::calcBoxPointNormals(const primitivePatch& pp)
const vectorField& pointNormals = pp.pointNormals();
const labelListList& pointFaces = pp.pointFaces();
forAll(pointFaces, pointI)
forAll(pointFaces, pointi)
{
const labelList& pFaces = pointFaces[pointI];
const labelList& pFaces = pointFaces[pointi];
if (visNormal(pointNormals[pointI], faceNormals, pFaces))
if (visNormal(pointNormals[pointi], faceNormals, pFaces))
{
pn[pointI] = pointNormals[pointI];
pn[pointi] = pointNormals[pointi];
}
else
{
WarningInFunction
<< "Average point normal not visible for point:"
<< pp.meshPoints()[pointI] << endl;
<< pp.meshPoints()[pointi] << endl;
label visOctant =
mXmYmZMask
@ -167,16 +167,16 @@ Foam::vectorField Foam::meshTools::calcBoxPointNormals(const primitivePatch& pp)
if (visI != -1)
{
// Take a vector in this octant.
pn[pointI] = octantNormal[visI];
pn[pointi] = octantNormal[visI];
}
else
{
pn[pointI] = Zero;
pn[pointi] = Zero;
WarningInFunction
<< "No visible octant for point:" << pp.meshPoints()[pointI]
<< " cooord:" << pp.points()[pp.meshPoints()[pointI]] << nl
<< "Normal set to " << pn[pointI] << endl;
<< "No visible octant for point:" << pp.meshPoints()[pointi]
<< " cooord:" << pp.points()[pp.meshPoints()[pointi]] << nl
<< "Normal set to " << pn[pointi] << endl;
}
}
}
@ -284,38 +284,38 @@ void Foam::meshTools::writeOBJ
bool Foam::meshTools::edgeOnCell
(
const primitiveMesh& mesh,
const label cellI,
const label celli,
const label edgeI
)
{
return findIndex(mesh.edgeCells(edgeI), cellI) != -1;
return findIndex(mesh.edgeCells(edgeI), celli) != -1;
}
bool Foam::meshTools::edgeOnFace
(
const primitiveMesh& mesh,
const label faceI,
const label facei,
const label edgeI
)
{
return findIndex(mesh.faceEdges(faceI), edgeI) != -1;
return findIndex(mesh.faceEdges(facei), edgeI) != -1;
}
bool Foam::meshTools::faceOnCell
(
const primitiveMesh& mesh,
const label cellI,
const label faceI
const label celli,
const label facei
)
{
if (mesh.isInternalFace(faceI))
if (mesh.isInternalFace(facei))
{
if
(
(mesh.faceOwner()[faceI] == cellI)
|| (mesh.faceNeighbour()[faceI] == cellI)
(mesh.faceOwner()[facei] == celli)
|| (mesh.faceNeighbour()[facei] == celli)
)
{
return true;
@ -323,7 +323,7 @@ bool Foam::meshTools::faceOnCell
}
else
{
if (mesh.faceOwner()[faceI] == cellI)
if (mesh.faceOwner()[facei] == celli)
{
return true;
}
@ -423,20 +423,20 @@ Foam::label Foam::meshTools::getSharedFace
{
const cell& cFaces = mesh.cells()[cell0I];
forAll(cFaces, cFaceI)
forAll(cFaces, cFacei)
{
label faceI = cFaces[cFaceI];
label facei = cFaces[cFacei];
if
(
mesh.isInternalFace(faceI)
mesh.isInternalFace(facei)
&& (
mesh.faceOwner()[faceI] == cell1I
|| mesh.faceNeighbour()[faceI] == cell1I
mesh.faceOwner()[facei] == cell1I
|| mesh.faceNeighbour()[facei] == cell1I
)
)
{
return faceI;
return facei;
}
}
@ -455,7 +455,7 @@ Foam::label Foam::meshTools::getSharedFace
void Foam::meshTools::getEdgeFaces
(
const primitiveMesh& mesh,
const label cellI,
const label celli,
const label edgeI,
label& face0,
label& face1
@ -466,19 +466,19 @@ void Foam::meshTools::getEdgeFaces
face0 = -1;
face1 = -1;
forAll(eFaces, eFaceI)
forAll(eFaces, eFacei)
{
label faceI = eFaces[eFaceI];
label facei = eFaces[eFacei];
if (faceOnCell(mesh, cellI, faceI))
if (faceOnCell(mesh, celli, facei))
{
if (face0 == -1)
{
face0 = faceI;
face0 = facei;
}
else
{
face1 = faceI;
face1 = facei;
return;
}
@ -489,7 +489,7 @@ void Foam::meshTools::getEdgeFaces
{
FatalErrorInFunction
<< "Can not find faces using edge " << mesh.edges()[edgeI]
<< " on cell " << cellI << abort(FatalError);
<< " on cell " << celli << abort(FatalError);
}
}
@ -531,17 +531,17 @@ Foam::label Foam::meshTools::otherEdge
Foam::label Foam::meshTools::otherFace
(
const primitiveMesh& mesh,
const label cellI,
const label faceI,
const label celli,
const label facei,
const label edgeI
)
{
label face0;
label face1;
getEdgeFaces(mesh, cellI, edgeI, face0, face1);
getEdgeFaces(mesh, celli, edgeI, face0, face1);
if (face0 == faceI)
if (face0 == facei)
{
return face1;
}
@ -555,37 +555,37 @@ Foam::label Foam::meshTools::otherFace
Foam::label Foam::meshTools::otherCell
(
const primitiveMesh& mesh,
const label otherCellI,
const label faceI
const label otherCelli,
const label facei
)
{
if (!mesh.isInternalFace(faceI))
if (!mesh.isInternalFace(facei))
{
FatalErrorInFunction
<< "Face " << faceI << " is not internal"
<< "Face " << facei << " is not internal"
<< abort(FatalError);
}
label newCellI = mesh.faceOwner()[faceI];
label newCelli = mesh.faceOwner()[facei];
if (newCellI == otherCellI)
if (newCelli == otherCelli)
{
newCellI = mesh.faceNeighbour()[faceI];
newCelli = mesh.faceNeighbour()[facei];
}
return newCellI;
return newCelli;
}
Foam::label Foam::meshTools::walkFace
(
const primitiveMesh& mesh,
const label faceI,
const label facei,
const label startEdgeI,
const label startVertI,
const label nEdges
)
{
const labelList& fEdges = mesh.faceEdges(faceI);
const labelList& fEdges = mesh.faceEdges(facei);
label edgeI = startEdgeI;
@ -713,7 +713,7 @@ void Foam::meshTools::constrainDirection
void Foam::meshTools::getParallelEdges
(
const primitiveMesh& mesh,
const label cellI,
const label celli,
const label e0,
label& e1,
label& e2,
@ -721,32 +721,32 @@ void Foam::meshTools::getParallelEdges
)
{
// Go to any face using e0
label faceI = meshTools::otherFace(mesh, cellI, -1, e0);
label facei = meshTools::otherFace(mesh, celli, -1, e0);
// Opposite edge on face
e1 = meshTools::walkFace(mesh, faceI, e0, mesh.edges()[e0].end(), 2);
e1 = meshTools::walkFace(mesh, facei, e0, mesh.edges()[e0].end(), 2);
faceI = meshTools::otherFace(mesh, cellI, faceI, e1);
facei = meshTools::otherFace(mesh, celli, facei, e1);
e2 = meshTools::walkFace(mesh, faceI, e1, mesh.edges()[e1].end(), 2);
e2 = meshTools::walkFace(mesh, facei, e1, mesh.edges()[e1].end(), 2);
faceI = meshTools::otherFace(mesh, cellI, faceI, e2);
facei = meshTools::otherFace(mesh, celli, facei, e2);
e3 = meshTools::walkFace(mesh, faceI, e2, mesh.edges()[e2].end(), 2);
e3 = meshTools::walkFace(mesh, facei, e2, mesh.edges()[e2].end(), 2);
}
Foam::vector Foam::meshTools::edgeToCutDir
(
const primitiveMesh& mesh,
const label cellI,
const label celli,
const label startEdgeI
)
{
if (!hexMatcher().isA(mesh, cellI))
if (!hexMatcher().isA(mesh, celli))
{
FatalErrorInFunction
<< "Not a hex : cell:" << cellI << abort(FatalError);
<< "Not a hex : cell:" << celli << abort(FatalError);
}
@ -754,12 +754,12 @@ Foam::vector Foam::meshTools::edgeToCutDir
label edgeI = startEdgeI;
label faceI = -1;
label facei = -1;
for (label i = 0; i < 3; i++)
{
// Step to next face, next edge
faceI = meshTools::otherFace(mesh, cellI, faceI, edgeI);
facei = meshTools::otherFace(mesh, celli, facei, edgeI);
vector eVec(normEdgeVec(mesh, edgeI));
@ -774,7 +774,7 @@ Foam::vector Foam::meshTools::edgeToCutDir
label vertI = mesh.edges()[edgeI].end();
edgeI = meshTools::walkFace(mesh, faceI, edgeI, vertI, 2);
edgeI = meshTools::walkFace(mesh, facei, edgeI, vertI, 2);
}
avgVec /= mag(avgVec) + VSMALL;
@ -786,17 +786,17 @@ Foam::vector Foam::meshTools::edgeToCutDir
Foam::label Foam::meshTools::cutDirToEdge
(
const primitiveMesh& mesh,
const label cellI,
const label celli,
const vector& cutDir
)
{
if (!hexMatcher().isA(mesh, cellI))
if (!hexMatcher().isA(mesh, celli))
{
FatalErrorInFunction
<< "Not a hex : cell:" << cellI << abort(FatalError);
<< "Not a hex : cell:" << celli << abort(FatalError);
}
const labelList& cEdges = mesh.cellEdges()[cellI];
const labelList& cEdges = mesh.cellEdges()[celli];
labelHashSet doneEdges(2*cEdges.size());
@ -811,7 +811,7 @@ Foam::label Foam::meshTools::cutDirToEdge
if (!doneEdges.found(e0))
{
vector avgDir(edgeToCutDir(mesh, cellI, e0));
vector avgDir(edgeToCutDir(mesh, celli, e0));
scalar cosAngle = mag(avgDir & cutDir);
@ -823,7 +823,7 @@ Foam::label Foam::meshTools::cutDirToEdge
// Mark off edges in cEdges.
label e1, e2, e3;
getParallelEdges(mesh, cellI, e0, e1, e2, e3);
getParallelEdges(mesh, celli, e0, e1, e2, e3);
doneEdges.insert(e0);
doneEdges.insert(e1);
@ -838,7 +838,7 @@ Foam::label Foam::meshTools::cutDirToEdge
if (!doneEdges.found(cEdges[cEdgeI]))
{
FatalErrorInFunction
<< "Cell:" << cellI << " edges:" << cEdges << endl
<< "Cell:" << celli << " edges:" << cEdges << endl
<< "Edge:" << cEdges[cEdgeI] << " not yet handled"
<< abort(FatalError);
}
@ -848,7 +848,7 @@ Foam::label Foam::meshTools::cutDirToEdge
{
FatalErrorInFunction
<< "Problem : did not find edge aligned with " << cutDir
<< " on cell " << cellI << abort(FatalError);
<< " on cell " << celli << abort(FatalError);
}
return maxEdgeI;

View File

@ -171,7 +171,7 @@ namespace meshTools
bool edgeOnCell
(
const primitiveMesh&,
const label cellI,
const label celli,
const label edgeI
);
@ -179,7 +179,7 @@ namespace meshTools
bool edgeOnFace
(
const primitiveMesh&,
const label faceI,
const label facei,
const label edgeI
);
@ -187,8 +187,8 @@ namespace meshTools
bool faceOnCell
(
const primitiveMesh&,
const label cellI,
const label faceI
const label celli,
const label facei
);
//- Return edge among candidates that uses the two vertices.
@ -228,7 +228,7 @@ namespace meshTools
void getEdgeFaces
(
const primitiveMesh&,
const label cellI,
const label celli,
const label edgeI,
label& face0,
label& face1
@ -244,13 +244,13 @@ namespace meshTools
const label vertI
);
//- Return face on cell using edgeI but not faceI. Throws error
//- Return face on cell using edgeI but not facei. Throws error
// if none found.
label otherFace
(
const primitiveMesh&,
const label cellI,
const label faceI,
const label celli,
const label facei,
const label edgeI
);
@ -259,8 +259,8 @@ namespace meshTools
label otherCell
(
const primitiveMesh&,
const label cellI,
const label faceI
const label celli,
const label facei
);
//- Returns label of edge nEdges away from startEdge (in the direction
@ -268,7 +268,7 @@ namespace meshTools
label walkFace
(
const primitiveMesh&,
const label faceI,
const label facei,
const label startEdgeI,
const label startVertI,
const label nEdges
@ -310,7 +310,7 @@ namespace meshTools
void getParallelEdges
(
const primitiveMesh&,
const label cellI,
const label celli,
const label e0,
label&,
label&,
@ -322,7 +322,7 @@ namespace meshTools
vector edgeToCutDir
(
const primitiveMesh&,
const label cellI,
const label celli,
const label edgeI
);
@ -331,7 +331,7 @@ namespace meshTools
label cutDirToEdge
(
const primitiveMesh&,
const label cellI,
const label celli,
const vector& cutDir
);

View File

@ -367,13 +367,13 @@ Foam::tmp<Foam::tensorField> Foam::momentOfInertia::meshInertia
Foam::tensor Foam::momentOfInertia::meshInertia
(
const polyMesh& mesh,
label cellI
label celli
)
{
List<tetIndices> cellTets = polyMeshTetDecomposition::cellTetIndices
(
mesh,
cellI
celli
);
triFaceList faces(cellTets.size());

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -123,7 +123,7 @@ public:
static tensor meshInertia
(
const polyMesh& mesh,
label cellI
label celli
);
};

View File

@ -76,19 +76,19 @@ bool Foam::polyMeshZipUpCells(polyMesh& mesh)
const faceList& oldFaces = mesh.faces();
const labelListList& pFaces = mesh.pointFaces();
forAll(Cells, cellI)
forAll(Cells, celli)
{
const labelList& curFaces = Cells[cellI];
const edgeList cellEdges = Cells[cellI].edges(oldFaces);
const labelList cellPoints = Cells[cellI].labels(oldFaces);
const labelList& curFaces = Cells[celli];
const edgeList cellEdges = Cells[celli].edges(oldFaces);
const labelList cellPoints = Cells[celli].labels(oldFaces);
// Find the edges used only once in the cell
labelList edgeUsage(cellEdges.size(), 0);
forAll(curFaces, faceI)
forAll(curFaces, facei)
{
edgeList curFaceEdges = oldFaces[curFaces[faceI]].edges();
edgeList curFaceEdges = oldFaces[curFaces[facei]].edges();
forAll(curFaceEdges, faceEdgeI)
{
@ -118,15 +118,15 @@ bool Foam::polyMeshZipUpCells(polyMesh& mesh)
else if (edgeUsage[edgeI] != 2)
{
WarningInFunction
<< "edge " << cellEdges[edgeI] << " in cell " << cellI
<< "edge " << cellEdges[edgeI] << " in cell " << celli
<< " used " << edgeUsage[edgeI] << " times. " << nl
<< "Should be 1 or 2 - serious error "
<< "in mesh structure. " << endl;
#ifdef DEBUG_ZIPUP
forAll(curFaces, faceI)
forAll(curFaces, facei)
{
Info<< "face: " << oldFaces[curFaces[faceI]]
Info<< "face: " << oldFaces[curFaces[facei]]
<< endl;
}
@ -143,7 +143,7 @@ bool Foam::polyMeshZipUpCells(polyMesh& mesh)
#endif
// Gather the problem cell
problemCells.insert(cellI);
problemCells.insert(celli);
}
}
@ -153,11 +153,11 @@ bool Foam::polyMeshZipUpCells(polyMesh& mesh)
singleEdges.setSize(nSingleEdges);
#ifdef DEBUG_ZIPUP
Info<< "Cell " << cellI << endl;
Info<< "Cell " << celli << endl;
forAll(curFaces, faceI)
forAll(curFaces, facei)
{
Info<< "face: " << oldFaces[curFaces[faceI]] << endl;
Info<< "face: " << oldFaces[curFaces[facei]] << endl;
}
Info<< "Cell edges: " << cellEdges << nl
@ -183,15 +183,15 @@ bool Foam::polyMeshZipUpCells(polyMesh& mesh)
{
const edge& curEdge = singleEdges[edgeI];
forAll(cellPoints, pointI)
forAll(cellPoints, pointi)
{
if
(
cellPoints[pointI] == curEdge.start()
|| cellPoints[pointI] == curEdge.end()
cellPoints[pointi] == curEdge.start()
|| cellPoints[pointi] == curEdge.end()
)
{
pointUsage[pointI]++;
pointUsage[pointi]++;
}
}
}
@ -209,18 +209,18 @@ bool Foam::polyMeshZipUpCells(polyMesh& mesh)
label newEdgeEnd = singleEdges[edgeI].end();
// check that the edge has not got all ends blocked
forAll(cellPoints, pointI)
forAll(cellPoints, pointi)
{
if (cellPoints[pointI] == newEdgeStart)
if (cellPoints[pointi] == newEdgeStart)
{
if (pointUsage[pointI] > 2)
if (pointUsage[pointi] > 2)
{
blockedHead = true;
}
}
else if (cellPoints[pointI] == newEdgeEnd)
else if (cellPoints[pointi] == newEdgeEnd)
{
if (pointUsage[pointI] > 2)
if (pointUsage[pointi] > 2)
{
blockedTail = true;
}
@ -266,11 +266,11 @@ bool Foam::polyMeshZipUpCells(polyMesh& mesh)
#endif
// Check if head or tail are blocked
forAll(cellPoints, pointI)
forAll(cellPoints, pointi)
{
if (cellPoints[pointI] == newEdgeStart)
if (cellPoints[pointi] == newEdgeStart)
{
if (pointUsage[pointI] > 2)
if (pointUsage[pointi] > 2)
{
#ifdef DEBUG_CHAIN
Info<< "start head blocked" << endl;
@ -279,9 +279,9 @@ bool Foam::polyMeshZipUpCells(polyMesh& mesh)
blockHead = true;
}
}
else if (cellPoints[pointI] == newEdgeEnd)
else if (cellPoints[pointi] == newEdgeEnd)
{
if (pointUsage[pointI] > 2)
if (pointUsage[pointi] > 2)
{
#ifdef DEBUG_CHAIN
Info<< "start tail blocked" << endl;
@ -361,11 +361,11 @@ bool Foam::polyMeshZipUpCells(polyMesh& mesh)
<< " curEdgeEnd: " << curEdgeEnd << endl;
#endif
forAll(cellPoints, pointI)
forAll(cellPoints, pointi)
{
if (cellPoints[pointI] == curEdgeStart)
if (cellPoints[pointi] == curEdgeStart)
{
if (pointUsage[pointI] > 2)
if (pointUsage[pointi] > 2)
{
#ifdef DEBUG_CHAIN
Info<< "head blocked" << endl;
@ -374,9 +374,9 @@ bool Foam::polyMeshZipUpCells(polyMesh& mesh)
blockHead = true;
}
}
else if (cellPoints[pointI] == curEdgeEnd)
else if (cellPoints[pointi] == curEdgeEnd)
{
if (pointUsage[pointI] > 2)
if (pointUsage[pointi] > 2)
{
#ifdef DEBUG_CHAIN
Info<< "tail blocked" << endl;
@ -499,7 +499,7 @@ bool Foam::polyMeshZipUpCells(polyMesh& mesh)
<< nl << "Point: " << orderedEdge[checkI]
<< " edge: " << orderedEdge << endl;
problemCells.insert(cellI);
problemCells.insert(celli);
}
}
}
@ -527,12 +527,12 @@ bool Foam::polyMeshZipUpCells(polyMesh& mesh)
facesSharingEdge[nfse++] = endPF[pfI];
}
forAll(facesSharingEdge, faceI)
forAll(facesSharingEdge, facei)
{
bool faceChanges = false;
// Label of the face being analysed
const label currentFaceIndex = facesSharingEdge[faceI];
const label currentFaceIndex = facesSharingEdge[facei];
const edgeList curFaceEdges =
oldFaces[currentFaceIndex].edges();
@ -696,7 +696,7 @@ bool Foam::polyMeshZipUpCells(polyMesh& mesh)
<< " face: "
<< newFace << endl;
problemCells.insert(cellI);
problemCells.insert(celli);
}
}
}
@ -743,10 +743,10 @@ bool Foam::polyMeshZipUpCells(polyMesh& mesh)
labelList patchSizes(bMesh.size(), 0);
labelList patchStarts(bMesh.size(), 0);
forAll(bMesh, patchI)
forAll(bMesh, patchi)
{
patchSizes[patchI] = bMesh[patchI].size();
patchStarts[patchI] = bMesh[patchI].start();
patchSizes[patchi] = bMesh[patchi].size();
patchStarts[patchi] = bMesh[patchi].start();
}
// Reset the mesh. Number of active faces is one beyond the last patch

View File

@ -116,71 +116,71 @@ void Foam::primitiveMeshGeometry::updateCellCentresAndVols
forAll(changedFaces, i)
{
label faceI = changedFaces[i];
cEst[own[faceI]] += faceCentres_[faceI];
nCellFaces[own[faceI]] += 1;
label facei = changedFaces[i];
cEst[own[facei]] += faceCentres_[facei];
nCellFaces[own[facei]] += 1;
if (mesh_.isInternalFace(faceI))
if (mesh_.isInternalFace(facei))
{
cEst[nei[faceI]] += faceCentres_[faceI];
nCellFaces[nei[faceI]] += 1;
cEst[nei[facei]] += faceCentres_[facei];
nCellFaces[nei[facei]] += 1;
}
}
forAll(changedCells, i)
{
label cellI = changedCells[i];
cEst[cellI] /= nCellFaces[cellI];
label celli = changedCells[i];
cEst[celli] /= nCellFaces[celli];
}
forAll(changedFaces, i)
{
label faceI = changedFaces[i];
label facei = changedFaces[i];
// Calculate 3*face-pyramid volume
scalar pyr3Vol = max
(
faceAreas_[faceI] & (faceCentres_[faceI] - cEst[own[faceI]]),
faceAreas_[facei] & (faceCentres_[facei] - cEst[own[facei]]),
VSMALL
);
// Calculate face-pyramid centre
vector pc = (3.0/4.0)*faceCentres_[faceI] + (1.0/4.0)*cEst[own[faceI]];
vector pc = (3.0/4.0)*faceCentres_[facei] + (1.0/4.0)*cEst[own[facei]];
// Accumulate volume-weighted face-pyramid centre
cellCentres_[own[faceI]] += pyr3Vol*pc;
cellCentres_[own[facei]] += pyr3Vol*pc;
// Accumulate face-pyramid volume
cellVolumes_[own[faceI]] += pyr3Vol;
cellVolumes_[own[facei]] += pyr3Vol;
if (mesh_.isInternalFace(faceI))
if (mesh_.isInternalFace(facei))
{
// Calculate 3*face-pyramid volume
scalar pyr3Vol = max
(
faceAreas_[faceI] & (cEst[nei[faceI]] - faceCentres_[faceI]),
faceAreas_[facei] & (cEst[nei[facei]] - faceCentres_[facei]),
VSMALL
);
// Calculate face-pyramid centre
vector pc =
(3.0/4.0)*faceCentres_[faceI]
+ (1.0/4.0)*cEst[nei[faceI]];
(3.0/4.0)*faceCentres_[facei]
+ (1.0/4.0)*cEst[nei[facei]];
// Accumulate volume-weighted face-pyramid centre
cellCentres_[nei[faceI]] += pyr3Vol*pc;
cellCentres_[nei[facei]] += pyr3Vol*pc;
// Accumulate face-pyramid volume
cellVolumes_[nei[faceI]] += pyr3Vol;
cellVolumes_[nei[facei]] += pyr3Vol;
}
}
forAll(changedCells, i)
{
label cellI = changedCells[i];
label celli = changedCells[i];
cellCentres_[cellI] /= cellVolumes_[cellI];
cellVolumes_[cellI] *= (1.0/3.0);
cellCentres_[celli] /= cellVolumes_[celli];
cellVolumes_[celli] *= (1.0/3.0);
}
}
@ -197,13 +197,13 @@ Foam::labelList Foam::primitiveMeshGeometry::affectedCells
forAll(changedFaces, i)
{
label faceI = changedFaces[i];
label facei = changedFaces[i];
affectedCells.insert(own[faceI]);
affectedCells.insert(own[facei]);
if (mesh_.isInternalFace(faceI))
if (mesh_.isInternalFace(facei))
{
affectedCells.insert(nei[faceI]);
affectedCells.insert(nei[facei]);
}
}
return affectedCells.toc();
@ -281,12 +281,12 @@ bool Foam::primitiveMeshGeometry::checkFaceDotProduct
forAll(checkFaces, i)
{
label faceI = checkFaces[i];
label facei = checkFaces[i];
if (mesh.isInternalFace(faceI))
if (mesh.isInternalFace(facei))
{
vector d = cellCentres[nei[faceI]] - cellCentres[own[faceI]];
const vector& s = faceAreas[faceI];
vector d = cellCentres[nei[facei]] - cellCentres[own[facei]];
const vector& s = faceAreas[facei];
scalar dDotS = (d & s)/(mag(d)*mag(s) + VSMALL);
@ -297,16 +297,16 @@ bool Foam::primitiveMeshGeometry::checkFaceDotProduct
if (report)
{
// Severe non-orthogonality but mesh still OK
Pout<< "Severe non-orthogonality for face " << faceI
<< " between cells " << own[faceI]
<< " and " << nei[faceI]
Pout<< "Severe non-orthogonality for face " << facei
<< " between cells " << own[facei]
<< " and " << nei[facei]
<< ": Angle = " << radToDeg(::acos(dDotS))
<< " deg." << endl;
}
if (setPtr)
{
setPtr->insert(faceI);
setPtr->insert(facei);
}
severeNonOrth++;
@ -318,9 +318,9 @@ bool Foam::primitiveMeshGeometry::checkFaceDotProduct
{
WarningInFunction
<< "Severe non-orthogonality detected for face "
<< faceI
<< " between cells " << own[faceI] << " and "
<< nei[faceI]
<< facei
<< " between cells " << own[facei] << " and "
<< nei[facei]
<< ": Angle = " << radToDeg(::acos(dDotS))
<< " deg." << endl;
}
@ -329,7 +329,7 @@ bool Foam::primitiveMeshGeometry::checkFaceDotProduct
if (setPtr)
{
setPtr->insert(faceI);
setPtr->insert(facei);
}
}
}
@ -416,13 +416,13 @@ bool Foam::primitiveMeshGeometry::checkFacePyramids
forAll(checkFaces, i)
{
label faceI = checkFaces[i];
label facei = checkFaces[i];
// Create the owner pyramid - it will have negative volume
scalar pyrVol = pyramidPointFaceRef
(
f[faceI],
cellCentres[own[faceI]]
f[facei],
cellCentres[own[facei]]
).mag(p);
if (pyrVol > -minPyrVol)
@ -432,29 +432,29 @@ bool Foam::primitiveMeshGeometry::checkFacePyramids
Pout<< "bool primitiveMeshGeometry::checkFacePyramids("
<< "const bool, const scalar, const pointField&"
<< ", const labelList&, labelHashSet*): "
<< "face " << faceI << " points the wrong way. " << endl
<< "face " << facei << " points the wrong way. " << endl
<< "Pyramid volume: " << -pyrVol
<< " Face " << f[faceI] << " area: " << f[faceI].mag(p)
<< " Owner cell: " << own[faceI] << endl
<< " Face " << f[facei] << " area: " << f[facei].mag(p)
<< " Owner cell: " << own[facei] << endl
<< "Owner cell vertex labels: "
<< mesh.cells()[own[faceI]].labels(f)
<< mesh.cells()[own[facei]].labels(f)
<< endl;
}
if (setPtr)
{
setPtr->insert(faceI);
setPtr->insert(facei);
}
nErrorPyrs++;
}
if (mesh.isInternalFace(faceI))
if (mesh.isInternalFace(facei))
{
// Create the neighbour pyramid - it will have positive volume
scalar pyrVol =
pyramidPointFaceRef(f[faceI], cellCentres[nei[faceI]]).mag(p);
pyramidPointFaceRef(f[facei], cellCentres[nei[facei]]).mag(p);
if (pyrVol < minPyrVol)
{
@ -463,18 +463,18 @@ bool Foam::primitiveMeshGeometry::checkFacePyramids
Pout<< "bool primitiveMeshGeometry::checkFacePyramids("
<< "const bool, const scalar, const pointField&"
<< ", const labelList&, labelHashSet*): "
<< "face " << faceI << " points the wrong way. " << endl
<< "face " << facei << " points the wrong way. " << endl
<< "Pyramid volume: " << -pyrVol
<< " Face " << f[faceI] << " area: " << f[faceI].mag(p)
<< " Neighbour cell: " << nei[faceI] << endl
<< " Face " << f[facei] << " area: " << f[facei].mag(p)
<< " Neighbour cell: " << nei[facei] << endl
<< "Neighbour cell vertex labels: "
<< mesh.cells()[nei[faceI]].labels(f)
<< mesh.cells()[nei[facei]].labels(f)
<< endl;
}
if (setPtr)
{
setPtr->insert(faceI);
setPtr->insert(facei);
}
nErrorPyrs++;
@ -532,21 +532,21 @@ bool Foam::primitiveMeshGeometry::checkFaceSkewness
forAll(checkFaces, i)
{
label faceI = checkFaces[i];
label facei = checkFaces[i];
if (mesh.isInternalFace(faceI))
if (mesh.isInternalFace(facei))
{
scalar dOwn = mag(faceCentres[faceI] - cellCentres[own[faceI]]);
scalar dNei = mag(faceCentres[faceI] - cellCentres[nei[faceI]]);
scalar dOwn = mag(faceCentres[facei] - cellCentres[own[facei]]);
scalar dNei = mag(faceCentres[facei] - cellCentres[nei[facei]]);
point faceIntersection =
cellCentres[own[faceI]]*dNei/(dOwn+dNei)
+ cellCentres[nei[faceI]]*dOwn/(dOwn+dNei);
cellCentres[own[facei]]*dNei/(dOwn+dNei)
+ cellCentres[nei[facei]]*dOwn/(dOwn+dNei);
scalar skewness =
mag(faceCentres[faceI] - faceIntersection)
mag(faceCentres[facei] - faceIntersection)
/ (
mag(cellCentres[nei[faceI]]-cellCentres[own[faceI]])
mag(cellCentres[nei[facei]]-cellCentres[own[facei]])
+ VSMALL
);
@ -557,13 +557,13 @@ bool Foam::primitiveMeshGeometry::checkFaceSkewness
{
if (report)
{
Pout<< "Severe skewness for face " << faceI
Pout<< "Severe skewness for face " << facei
<< " skewness = " << skewness << endl;
}
if (setPtr)
{
setPtr->insert(faceI);
setPtr->insert(facei);
}
nWarnSkew++;
@ -579,17 +579,17 @@ bool Foam::primitiveMeshGeometry::checkFaceSkewness
// Boundary faces: consider them to have only skewness error.
// (i.e. treat as if mirror cell on other side)
vector faceNormal = faceAreas[faceI];
vector faceNormal = faceAreas[facei];
faceNormal /= mag(faceNormal) + VSMALL;
vector dOwn = faceCentres[faceI] - cellCentres[own[faceI]];
vector dOwn = faceCentres[facei] - cellCentres[own[facei]];
vector dWall = faceNormal*(faceNormal & dOwn);
point faceIntersection = cellCentres[own[faceI]] + dWall;
point faceIntersection = cellCentres[own[facei]] + dWall;
scalar skewness =
mag(faceCentres[faceI] - faceIntersection)
mag(faceCentres[facei] - faceIntersection)
/(2*mag(dWall) + VSMALL);
// Check if the skewness vector is greater than the PN vector.
@ -599,13 +599,13 @@ bool Foam::primitiveMeshGeometry::checkFaceSkewness
{
if (report)
{
Pout<< "Severe skewness for boundary face " << faceI
Pout<< "Severe skewness for boundary face " << facei
<< " skewness = " << skewness << endl;
}
if (setPtr)
{
setPtr->insert(faceI);
setPtr->insert(facei);
}
nWarnSkew++;
@ -670,14 +670,14 @@ bool Foam::primitiveMeshGeometry::checkFaceWeights
forAll(checkFaces, i)
{
label faceI = checkFaces[i];
label facei = checkFaces[i];
if (mesh.isInternalFace(faceI))
if (mesh.isInternalFace(facei))
{
const point& fc = faceCentres[faceI];
const point& fc = faceCentres[facei];
scalar dOwn = mag(faceAreas[faceI] & (fc-cellCentres[own[faceI]]));
scalar dNei = mag(faceAreas[faceI] & (cellCentres[nei[faceI]]-fc));
scalar dOwn = mag(faceAreas[facei] & (fc-cellCentres[own[facei]]));
scalar dNei = mag(faceAreas[facei] & (cellCentres[nei[facei]]-fc));
scalar weight = min(dNei,dOwn)/(dNei+dOwn);
@ -685,13 +685,13 @@ bool Foam::primitiveMeshGeometry::checkFaceWeights
{
if (report)
{
Pout<< "Small weighting factor for face " << faceI
Pout<< "Small weighting factor for face " << facei
<< " weight = " << weight << endl;
}
if (setPtr)
{
setPtr->insert(faceI);
setPtr->insert(facei);
}
nWarnWeight++;
@ -759,15 +759,15 @@ bool Foam::primitiveMeshGeometry::checkFaceAngles
label nConcave = 0;
label errorFaceI = -1;
label errorFacei = -1;
forAll(checkFaces, i)
{
label faceI = checkFaces[i];
label facei = checkFaces[i];
const face& f = fcs[faceI];
const face& f = fcs[facei];
vector faceNormal = faceAreas[faceI];
vector faceNormal = faceAreas[facei];
faceNormal /= mag(faceNormal) + VSMALL;
// Get edge from f[0] to f[size-1];
@ -801,16 +801,16 @@ bool Foam::primitiveMeshGeometry::checkFaceAngles
if ((edgeNormal & faceNormal) < SMALL)
{
if (faceI != errorFaceI)
if (facei != errorFacei)
{
// Count only one error per face.
errorFaceI = faceI;
errorFacei = facei;
nConcave++;
}
if (setPtr)
{
setPtr->insert(faceI);
setPtr->insert(facei);
}
maxEdgeSin = max(maxEdgeSin, magEdgeNormal);
@ -900,15 +900,15 @@ bool Foam::primitiveMeshGeometry::checkFaceAngles
//
// forAll(checkFaces, i)
// {
// label faceI = checkFaces[i];
// label facei = checkFaces[i];
//
// const face& f = fcs[faceI];
// const face& f = fcs[facei];
//
// scalar magArea = mag(faceAreas[faceI]);
// scalar magArea = mag(faceAreas[facei]);
//
// if (f.size() > 3 && magArea > VSMALL)
// {
// const point& fc = faceCentres[faceI];
// const point& fc = faceCentres[facei];
//
// // Calculate the sum of magnitude of areas and compare to
// // magnitude of sum of areas.
@ -938,7 +938,7 @@ bool Foam::primitiveMeshGeometry::checkFaceAngles
//
// if (setPtr)
// {
// setPtr->insert(faceI);
// setPtr->insert(facei);
// }
// }
// }
@ -1025,17 +1025,17 @@ bool Foam::primitiveMeshGeometry::checkFaceTwist
forAll(checkFaces, i)
{
label faceI = checkFaces[i];
label facei = checkFaces[i];
const face& f = fcs[faceI];
const face& f = fcs[facei];
scalar magArea = mag(faceAreas[faceI]);
scalar magArea = mag(faceAreas[facei]);
if (f.size() > 3 && magArea > VSMALL)
{
const vector nf = faceAreas[faceI] / magArea;
const vector nf = faceAreas[facei] / magArea;
const point& fc = faceCentres[faceI];
const point& fc = faceCentres[facei];
forAll(f, fpI)
{
@ -1057,7 +1057,7 @@ bool Foam::primitiveMeshGeometry::checkFaceTwist
if (setPtr)
{
setPtr->insert(faceI);
setPtr->insert(facei);
}
}
}
@ -1118,13 +1118,13 @@ bool Foam::primitiveMeshGeometry::checkFaceArea
forAll(checkFaces, i)
{
label faceI = checkFaces[i];
label facei = checkFaces[i];
if (mag(faceAreas[faceI]) < minArea)
if (mag(faceAreas[facei]) < minArea)
{
if (setPtr)
{
setPtr->insert(faceI);
setPtr->insert(facei);
}
nZeroArea++;
}
@ -1190,14 +1190,14 @@ bool Foam::primitiveMeshGeometry::checkCellDeterminant
tensor areaSum(Zero);
scalar magAreaSum = 0;
forAll(cFaces, cFaceI)
forAll(cFaces, cFacei)
{
label faceI = cFaces[cFaceI];
label facei = cFaces[cFacei];
scalar magArea = mag(faceAreas[faceI]);
scalar magArea = mag(faceAreas[facei]);
magAreaSum += magArea;
areaSum += faceAreas[faceI]*(faceAreas[faceI]/magArea);
areaSum += faceAreas[facei]*(faceAreas[facei]/magArea);
}
scalar scaledDet = det(areaSum/magAreaSum)/0.037037037037037;
@ -1211,10 +1211,10 @@ bool Foam::primitiveMeshGeometry::checkCellDeterminant
if (setPtr)
{
// Insert all faces of the cell.
forAll(cFaces, cFaceI)
forAll(cFaces, cFacei)
{
label faceI = cFaces[cFaceI];
setPtr->insert(faceI);
label facei = cFaces[cFacei];
setPtr->insert(facei);
}
}
nWarnDet++;

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -132,9 +132,9 @@ Foam::regionCoupledBase::regionCoupledBase
nbrPatchID_(-1),
nbrRegionName_(word::null),
sameRegion_(false),
AMIPtr_(NULL),
AMIPtr_(nullptr),
AMIReverse_(false),
surfPtr_(NULL),
surfPtr_(nullptr),
surfDict_(fileName("surface"))
{}
@ -150,9 +150,9 @@ Foam::regionCoupledBase::regionCoupledBase
nbrPatchID_(-1),
nbrRegionName_(dict.lookup("neighbourRegion")),
sameRegion_(nbrRegionName_ == patch_.boundaryMesh().mesh().name()),
AMIPtr_(NULL),
AMIPtr_(nullptr),
AMIReverse_(dict.lookupOrDefault<bool>("flipNormals", false)),
surfPtr_(NULL),
surfPtr_(nullptr),
surfDict_(dict.subOrEmptyDict("surface"))
{}
@ -168,7 +168,7 @@ Foam::regionCoupledBase::regionCoupledBase
nbrPatchID_(mpb.nbrPatchID_),
nbrRegionName_(mpb.nbrRegionName_),
sameRegion_(mpb.sameRegion_),
AMIPtr_(NULL),
AMIPtr_(nullptr),
AMIReverse_(mpb.AMIReverse_),
surfPtr_(mpb.surfPtr_),
surfDict_(mpb.surfDict_)

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
@ -124,39 +124,39 @@ void Foam::localPointRegion::countPointRegions
forAllConstIter(Map<label>, candidateFace, iter)
{
label faceI = iter.key();
label facei = iter.key();
if (!mesh.isInternalFace(faceI))
if (!mesh.isInternalFace(facei))
{
const face& f = mesh.faces()[faceI];
const face& f = mesh.faces()[facei];
if (minRegion[faceI].empty())
if (minRegion[facei].empty())
{
FatalErrorInFunction
<< "Face from candidateFace without minRegion set." << endl
<< "Face:" << faceI << " fc:" << mesh.faceCentres()[faceI]
<< "Face:" << facei << " fc:" << mesh.faceCentres()[facei]
<< " verts:" << f << abort(FatalError);
}
forAll(f, fp)
{
label pointI = f[fp];
label pointi = f[fp];
// Even points which were not candidates for splitting might
// be on multiple baffles that are being split so check.
if (candidatePoint[pointI])
if (candidatePoint[pointi])
{
label region = minRegion[faceI][fp];
label region = minRegion[facei][fp];
if (minPointRegion[pointI] == -1)
if (minPointRegion[pointi] == -1)
{
minPointRegion[pointI] = region;
minPointRegion[pointi] = region;
}
else if (minPointRegion[pointI] != region)
else if (minPointRegion[pointi] != region)
{
// Multiple regions for this point. Add.
Map<label>::iterator iter = meshPointMap_.find(pointI);
Map<label>::iterator iter = meshPointMap_.find(pointi);
if (iter != meshPointMap_.end())
{
labelList& regions = pointRegions[iter()];
@ -169,16 +169,16 @@ void Foam::localPointRegion::countPointRegions
}
else
{
label localPointI = meshPointMap_.size();
meshPointMap_.insert(pointI, localPointI);
label localPointi = meshPointMap_.size();
meshPointMap_.insert(pointi, localPointi);
labelList regions(2);
regions[0] = minPointRegion[pointI];
regions[0] = minPointRegion[pointi];
regions[1] = region;
pointRegions.append(regions);
}
label meshFaceMapI = meshFaceMap_.size();
meshFaceMap_.insert(faceI, meshFaceMapI);
meshFaceMap_.insert(facei, meshFaceMapI);
}
}
}
@ -190,11 +190,11 @@ void Foam::localPointRegion::countPointRegions
// region!
forAllConstIter(Map<label>, candidateFace, iter)
{
label faceI = iter.key();
label facei = iter.key();
if (mesh.isInternalFace(faceI))
if (mesh.isInternalFace(facei))
{
const face& f = mesh.faces()[faceI];
const face& f = mesh.faces()[facei];
forAll(f, fp)
{
@ -203,7 +203,7 @@ void Foam::localPointRegion::countPointRegions
if (candidatePoint[f[fp]] && meshPointMap_.found(f[fp]))
{
label meshFaceMapI = meshFaceMap_.size();
meshFaceMap_.insert(faceI, meshFaceMapI);
meshFaceMap_.insert(facei, meshFaceMapI);
}
}
}
@ -226,9 +226,9 @@ void Foam::localPointRegion::countPointRegions
//// Print a bit
//{
// label faceI = iter.key();
// const face& f = mesh.faces()[faceI];
// Pout<< "Face:" << faceI << " fc:" << mesh.faceCentres()[faceI]
// label facei = iter.key();
// const face& f = mesh.faces()[facei];
// Pout<< "Face:" << facei << " fc:" << mesh.faceCentres()[facei]
// << " verts:" << f << endl;
// forAll(f, fp)
// {
@ -269,37 +269,37 @@ void Foam::localPointRegion::calcPointRegions
// - candidateFace does not necessary have to be a baffle!
// - candidateFace is synchronised (since candidatePoint is)
Map<label> candidateFace(2*nBnd);
label candidateFaceI = 0;
label candidateFacei = 0;
Map<label> candidateCell(nBnd);
label candidateCellI = 0;
label candidateCelli = 0;
forAll(mesh.faces(), faceI)
forAll(mesh.faces(), facei)
{
const face& f = mesh.faces()[faceI];
const face& f = mesh.faces()[facei];
forAll(f, fp)
{
if (candidatePoint[f[fp]])
{
// Mark face
if (candidateFace.insert(faceI, candidateFaceI))
if (candidateFace.insert(facei, candidateFacei))
{
candidateFaceI++;
candidateFacei++;
}
// Mark cells
if (candidateCell.insert(faceOwner[faceI], candidateCellI))
if (candidateCell.insert(faceOwner[facei], candidateCelli))
{
candidateCellI++;
candidateCelli++;
}
if (mesh.isInternalFace(faceI))
if (mesh.isInternalFace(facei))
{
label nei = faceNeighbour[faceI];
if (candidateCell.insert(nei, candidateCellI))
label nei = faceNeighbour[facei];
if (candidateCell.insert(nei, candidateCelli))
{
candidateCellI++;
candidateCelli++;
}
}
@ -321,19 +321,19 @@ void Foam::localPointRegion::calcPointRegions
faceList minRegion(mesh.nFaces());
forAllConstIter(Map<label>, candidateFace, iter)
{
label faceI = iter.key();
const face& f = mesh.faces()[faceI];
label facei = iter.key();
const face& f = mesh.faces()[facei];
if (mesh.isInternalFace(faceI))
if (mesh.isInternalFace(facei))
{
label globOwn = globalCells.toGlobal(faceOwner[faceI]);
label globNei = globalCells.toGlobal(faceNeighbour[faceI]);
minRegion[faceI].setSize(f.size(), min(globOwn, globNei));
label globOwn = globalCells.toGlobal(faceOwner[facei]);
label globNei = globalCells.toGlobal(faceNeighbour[facei]);
minRegion[facei].setSize(f.size(), min(globOwn, globNei));
}
else
{
label globOwn = globalCells.toGlobal(faceOwner[faceI]);
minRegion[faceI].setSize(f.size(), globOwn);
label globOwn = globalCells.toGlobal(faceOwner[facei]);
minRegion[facei].setSize(f.size(), globOwn);
}
}
@ -352,52 +352,52 @@ void Foam::localPointRegion::calcPointRegions
{
minPointValue.clear();
label cellI = iter.key();
const cell& cFaces = mesh.cells()[cellI];
label celli = iter.key();
const cell& cFaces = mesh.cells()[celli];
// Determine minimum per point
forAll(cFaces, cFaceI)
forAll(cFaces, cFacei)
{
label faceI = cFaces[cFaceI];
label facei = cFaces[cFacei];
if (minRegion[faceI].size())
if (minRegion[facei].size())
{
const face& f = mesh.faces()[faceI];
const face& f = mesh.faces()[facei];
forAll(f, fp)
{
label pointI = f[fp];
Map<label>::iterator iter = minPointValue.find(pointI);
label pointi = f[fp];
Map<label>::iterator iter = minPointValue.find(pointi);
if (iter == minPointValue.end())
{
minPointValue.insert(pointI, minRegion[faceI][fp]);
minPointValue.insert(pointi, minRegion[facei][fp]);
}
else
{
label currentMin = iter();
iter() = min(currentMin, minRegion[faceI][fp]);
iter() = min(currentMin, minRegion[facei][fp]);
}
}
}
}
// Set face minimum from point minimum
forAll(cFaces, cFaceI)
forAll(cFaces, cFacei)
{
label faceI = cFaces[cFaceI];
label facei = cFaces[cFacei];
if (minRegion[faceI].size())
if (minRegion[facei].size())
{
const face& f = mesh.faces()[faceI];
const face& f = mesh.faces()[facei];
forAll(f, fp)
{
label minVal = minPointValue[f[fp]];
if (minVal != minRegion[faceI][fp])
if (minVal != minRegion[facei][fp])
{
minRegion[faceI][fp] = minVal;
minRegion[facei][fp] = minVal;
nChanged++;
}
}
@ -469,11 +469,11 @@ Foam::localPointRegion::localPointRegion(const polyMesh& mesh)
// Get any point on the outside which is on a non-coupled boundary
boolList candidatePoint(mesh.nPoints(), false);
forAll(patches, patchI)
forAll(patches, patchi)
{
if (!patches[patchI].coupled())
if (!patches[patchi].coupled())
{
const polyPatch& pp = patches[patchI];
const polyPatch& pp = patches[patchi];
forAll(pp.meshPoints(), i)
{
@ -554,9 +554,9 @@ Foam::labelList Foam::localPointRegion::findDuplicateFaces
label nDuplicateFaces = 0;
// Find all duplicate faces.
forAll(allPatch, bFaceI)
forAll(allPatch, bFacei)
{
const face& f = allPatch.localFaces()[bFaceI];
const face& f = allPatch.localFaces()[bFacei];
// Get faces connected to f[0].
// Check whether share all points with f.
@ -564,31 +564,31 @@ Foam::labelList Foam::localPointRegion::findDuplicateFaces
forAll(pFaces, i)
{
label otherFaceI = pFaces[i];
label otherFacei = pFaces[i];
if (otherFaceI > bFaceI)
if (otherFacei > bFacei)
{
const face& otherF = allPatch.localFaces()[otherFaceI];
const face& otherF = allPatch.localFaces()[otherFacei];
if (isDuplicate(f, otherF, true))
{
FatalErrorInFunction
<< "Face:" << bFaceI + mesh.nInternalFaces()
<< "Face:" << bFacei + mesh.nInternalFaces()
<< " has local points:" << f
<< " which are in same order as face:"
<< otherFaceI + mesh.nInternalFaces()
<< otherFacei + mesh.nInternalFaces()
<< " with local points:" << otherF
<< abort(FatalError);
}
else if (isDuplicate(f, otherF, false))
{
label meshFace0 = bFaceI + mesh.nInternalFaces();
label meshFace1 = otherFaceI + mesh.nInternalFaces();
label meshFace0 = bFacei + mesh.nInternalFaces();
label meshFace1 = otherFacei + mesh.nInternalFaces();
if
(
duplicateFace[bFaceI] != -1
|| duplicateFace[otherFaceI] != -1
duplicateFace[bFacei] != -1
|| duplicateFace[otherFacei] != -1
)
{
FatalErrorInFunction
@ -604,8 +604,8 @@ Foam::labelList Foam::localPointRegion::findDuplicateFaces
<< abort(FatalError);
}
duplicateFace[bFaceI] = otherFaceI;
duplicateFace[otherFaceI] = bFaceI;
duplicateFace[bFacei] = otherFacei;
duplicateFace[otherFacei] = bFacei;
nDuplicateFaces++;
}
}
@ -638,13 +638,13 @@ Foam::List<Foam::labelPair> Foam::localPointRegion::findDuplicateFacePairs
forAll(duplicateFace, i)
{
label otherFaceI = duplicateFace[i];
label otherFacei = duplicateFace[i];
if (otherFaceI != -1 && i < otherFaceI)
if (otherFacei != -1 && i < otherFacei)
{
label meshFace0 = testFaces[i];
label patch0 = patches.whichPatch(meshFace0);
label meshFace1 = testFaces[otherFaceI];
label meshFace1 = testFaces[otherFacei];
label patch1 = patches.whichPatch(meshFace1);
// Check for illegal topology. Should normally not happen!
@ -684,11 +684,11 @@ void Foam::localPointRegion::updateMesh(const mapPolyMesh& map)
forAllConstIter(Map<label>, meshFaceMap_, iter)
{
label newFaceI = map.reverseFaceMap()[iter.key()];
label newFacei = map.reverseFaceMap()[iter.key()];
if (newFaceI >= 0)
if (newFacei >= 0)
{
newMap.insert(newFaceI, iter());
newMap.insert(newFacei, iter());
}
}
meshFaceMap_.transfer(newMap);
@ -698,11 +698,11 @@ void Foam::localPointRegion::updateMesh(const mapPolyMesh& map)
forAllConstIter(Map<label>, meshPointMap_, iter)
{
label newPointI = map.reversePointMap()[iter.key()];
label newPointi = map.reversePointMap()[iter.key()];
if (newPointI >= 0)
if (newPointi >= 0)
{
newMap.insert(newPointI, iter());
newMap.insert(newPointi, iter());
}
}

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2014 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2014-2016 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
@ -46,6 +46,15 @@ namespace Foam
class polyPatch;
class polyMesh;
// Forward declaration of friend functions and operators
class minData;
Istream& operator>>(Istream&, minData&);
Ostream& operator<<(Ostream&, const minData&);
/*---------------------------------------------------------------------------*\
Class minData Declaration
\*---------------------------------------------------------------------------*/
@ -103,7 +112,7 @@ public:
(
const polyMesh&,
const polyPatch&,
const label patchFaceI,
const label patchFacei,
const point& faceCentre,
TrackingData& td
);
@ -114,7 +123,7 @@ public:
(
const polyMesh&,
const polyPatch&,
const label patchFaceI,
const label patchFacei,
const point& faceCentre,
TrackingData& td
);
@ -133,8 +142,8 @@ public:
inline bool updateCell
(
const polyMesh&,
const label thisCellI,
const label neighbourFaceI,
const label thisCelli,
const label neighbourFacei,
const minData& neighbourInfo,
const scalar tol,
TrackingData& td
@ -145,8 +154,8 @@ public:
inline bool updateFace
(
const polyMesh&,
const label thisFaceI,
const label neighbourCellI,
const label thisFacei,
const label neighbourCelli,
const minData& neighbourInfo,
const scalar tol,
TrackingData& td
@ -157,7 +166,7 @@ public:
inline bool updateFace
(
const polyMesh&,
const label thisFaceI,
const label thisFacei,
const minData& neighbourInfo,
const scalar tol,
TrackingData& td

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2014 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2014-2016 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
@ -66,7 +66,7 @@ inline void Foam::minData::leaveDomain
(
const polyMesh&,
const polyPatch& patch,
const label patchFaceI,
const label patchFacei,
const point& faceCentre,
TrackingData&
)
@ -88,7 +88,7 @@ inline void Foam::minData::enterDomain
(
const polyMesh&,
const polyPatch& patch,
const label patchFaceI,
const label patchFacei,
const point& faceCentre,
TrackingData&
)
@ -99,8 +99,8 @@ template<class TrackingData>
inline bool Foam::minData::updateCell
(
const polyMesh&,
const label thisCellI,
const label neighbourFaceI,
const label thisCelli,
const label neighbourFacei,
const minData& neighbourInfo,
const scalar tol,
TrackingData&
@ -122,8 +122,8 @@ template<class TrackingData>
inline bool Foam::minData::updateFace
(
const polyMesh& mesh,
const label thisFaceI,
const label neighbourCellI,
const label thisFacei,
const label neighbourCelli,
const minData& neighbourInfo,
const scalar tol,
TrackingData&
@ -147,7 +147,7 @@ template<class TrackingData>
inline bool Foam::minData::updateFace
(
const polyMesh&,
const label thisFaceI,
const label thisFacei,
const minData& neighbourInfo,
const scalar tol,
TrackingData&

View File

@ -24,6 +24,7 @@ License
\*---------------------------------------------------------------------------*/
#include "regionSplit.H"
#include "FaceCellWave.H"
#include "cyclicPolyPatch.H"
#include "processorPolyPatch.H"
#include "globalIndex.H"
@ -58,11 +59,11 @@ void Foam::regionSplit::calcNonCompactRegionSplit
// Take over blockedFaces by seeding a negative number
// (so is always less than the decomposition)
label nUnblocked = 0;
forAll(faceData, faceI)
forAll(faceData, facei)
{
if (blockedFace.size() && blockedFace[faceI])
if (blockedFace.size() && blockedFace[facei])
{
faceData[faceI] = minData(-2);
faceData[facei] = minData(-2);
}
else
{
@ -76,13 +77,13 @@ void Foam::regionSplit::calcNonCompactRegionSplit
nUnblocked = 0;
forAll(faceData, faceI)
forAll(faceData, facei)
{
if (blockedFace.empty() || !blockedFace[faceI])
if (blockedFace.empty() || !blockedFace[facei])
{
seedFaces[nUnblocked] = faceI;
seedFaces[nUnblocked] = facei;
// Seed face with globally unique number
seedData[nUnblocked] = minData(globalFaces.toGlobal(faceI));
seedData[nUnblocked] = minData(globalFaces.toGlobal(facei));
nUnblocked++;
}
}
@ -104,29 +105,29 @@ void Foam::regionSplit::calcNonCompactRegionSplit
// And extract
cellRegion.setSize(mesh().nCells());
forAll(cellRegion, cellI)
forAll(cellRegion, celli)
{
if (cellData[cellI].valid(deltaCalc.data()))
if (cellData[celli].valid(deltaCalc.data()))
{
cellRegion[cellI] = cellData[cellI].data();
cellRegion[celli] = cellData[celli].data();
}
else
{
// Unvisited cell -> only possible if surrounded by blocked faces.
// If so make up region from any of the faces
const cell& cFaces = mesh().cells()[cellI];
label faceI = cFaces[0];
const cell& cFaces = mesh().cells()[celli];
label facei = cFaces[0];
if (blockedFace.size() && !blockedFace[faceI])
if (blockedFace.size() && !blockedFace[facei])
{
FatalErrorInFunction
<< "Problem: unblocked face " << faceI
<< " at " << mesh().faceCentres()[faceI]
<< " on unassigned cell " << cellI
<< mesh().cellCentres()[faceI]
<< "Problem: unblocked face " << facei
<< " at " << mesh().faceCentres()[facei]
<< " on unassigned cell " << celli
<< mesh().cellCentres()[celli]
<< exit(FatalError);
}
cellRegion[cellI] = globalFaces.toGlobal(faceI);
cellRegion[celli] = globalFaces.toGlobal(facei);
}
}
}
@ -152,15 +153,15 @@ Foam::autoPtr<Foam::globalIndex> Foam::regionSplit::calcRegionSplit
if (coupledOrBlockedFace.size())
{
forAll(pbm, patchI)
forAll(pbm, patchi)
{
const polyPatch& pp = pbm[patchI];
const polyPatch& pp = pbm[patchi];
if (isA<processorPolyPatch>(pp))
{
label faceI = pp.start();
label facei = pp.start();
forAll(pp, i)
{
coupledOrBlockedFace[faceI++] = true;
coupledOrBlockedFace[facei++] = true;
}
}
}
@ -188,9 +189,9 @@ Foam::autoPtr<Foam::globalIndex> Foam::regionSplit::calcRegionSplit
// Compact
Map<label> globalToCompact(mesh().nCells()/8);
forAll(cellRegion, cellI)
forAll(cellRegion, celli)
{
label region = cellRegion[cellI];
label region = cellRegion[celli];
label globalRegion;
@ -204,7 +205,7 @@ Foam::autoPtr<Foam::globalIndex> Foam::regionSplit::calcRegionSplit
{
globalRegion = fnd();
}
cellRegion[cellI] = globalRegion;
cellRegion[celli] = globalRegion;
}
@ -243,9 +244,9 @@ Foam::autoPtr<Foam::globalIndex> Foam::regionSplit::calcRegionSplit
{
labelHashSet haveRegion(mesh().nCells()/8);
forAll(cellRegion, cellI)
forAll(cellRegion, celli)
{
label region = cellRegion[cellI];
label region = cellRegion[celli];
// Count originating processor. Use isLocal as efficiency since
// most cells are locally originating.
@ -258,10 +259,10 @@ Foam::autoPtr<Foam::globalIndex> Foam::regionSplit::calcRegionSplit
}
else
{
label procI = globalRegions.whichProcID(region);
label proci = globalRegions.whichProcID(region);
if (haveRegion.insert(region))
{
nOriginating[procI]++;
nOriginating[proci]++;
}
}
}
@ -292,17 +293,17 @@ Foam::autoPtr<Foam::globalIndex> Foam::regionSplit::calcRegionSplit
Map<label> globalToCompact(2*nOriginating[Pstream::myProcNo()]);
// Remote regions we want the compact number for
List<labelHashSet> nonLocal(Pstream::nProcs());
forAll(nonLocal, procI)
forAll(nonLocal, proci)
{
if (procI != Pstream::myProcNo())
if (proci != Pstream::myProcNo())
{
nonLocal[procI].resize(2*nOriginating[procI]);
nonLocal[proci].resize(2*nOriginating[proci]);
}
}
forAll(cellRegion, cellI)
forAll(cellRegion, celli)
{
label region = cellRegion[cellI];
label region = cellRegion[celli];
if (globalRegions.isLocal(region))
{
// Insert new compact region (if not yet present)
@ -324,17 +325,17 @@ Foam::autoPtr<Foam::globalIndex> Foam::regionSplit::calcRegionSplit
// Convert the nonLocal (labelHashSets) to labelLists.
labelListList sendNonLocal(Pstream::nProcs());
forAll(sendNonLocal, procI)
forAll(sendNonLocal, proci)
{
sendNonLocal[procI] = nonLocal[procI].toc();
sendNonLocal[proci] = nonLocal[proci].toc();
}
if (debug)
{
forAll(sendNonLocal, procI)
forAll(sendNonLocal, proci)
{
Pout<< " from processor " << procI
<< " want " << sendNonLocal[procI].size()
Pout<< " from processor " << proci
<< " want " << sendNonLocal[proci].size()
<< " region numbers."
<< endl;
}
@ -346,19 +347,19 @@ Foam::autoPtr<Foam::globalIndex> Foam::regionSplit::calcRegionSplit
labelListList recvNonLocal(Pstream::nProcs());
Pstream::exchange<labelList, label>(sendNonLocal, recvNonLocal);
// Now we have the wanted compact region labels that procI wants in
// recvNonLocal[procI]. Construct corresponding list of compact
// Now we have the wanted compact region labels that proci wants in
// recvNonLocal[proci]. Construct corresponding list of compact
// region labels to send back.
labelListList sendWantedLocal(Pstream::nProcs());
forAll(recvNonLocal, procI)
forAll(recvNonLocal, proci)
{
const labelList& nonLocal = recvNonLocal[procI];
sendWantedLocal[procI].setSize(nonLocal.size());
const labelList& nonLocal = recvNonLocal[proci];
sendWantedLocal[proci].setSize(nonLocal.size());
forAll(nonLocal, i)
{
sendWantedLocal[procI][i] = globalToCompact[nonLocal[i]];
sendWantedLocal[proci][i] = globalToCompact[nonLocal[i]];
}
}
@ -372,10 +373,10 @@ Foam::autoPtr<Foam::globalIndex> Foam::regionSplit::calcRegionSplit
// corresponding compact number. Insert these into the local compaction
// map.
forAll(recvNonLocal, procI)
forAll(recvNonLocal, proci)
{
const labelList& wantedRegions = sendNonLocal[procI];
const labelList& compactRegions = recvNonLocal[procI];
const labelList& wantedRegions = sendNonLocal[proci];
const labelList& compactRegions = recvNonLocal[proci];
forAll(wantedRegions, i)
{
@ -384,9 +385,9 @@ Foam::autoPtr<Foam::globalIndex> Foam::regionSplit::calcRegionSplit
}
// Finally renumber the regions
forAll(cellRegion, cellI)
forAll(cellRegion, celli)
{
cellRegion[cellI] = globalToCompact[cellRegion[cellI]];
cellRegion[celli] = globalToCompact[cellRegion[celli]];
}
return globalCompactPtr;

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License

View File

@ -519,22 +519,22 @@ void Foam::searchableBox::findLineAll
+ vector(ROOTVSMALL,ROOTVSMALL,ROOTVSMALL)
);
forAll(start, pointI)
forAll(start, pointi)
{
// See if any intersection between pt and end
pointIndexHit inter = findLine(start[pointI], end[pointI]);
pointIndexHit inter = findLine(start[pointi], end[pointi]);
if (inter.hit())
{
hits.clear();
hits.append(inter);
point pt = inter.hitPoint() + smallVec[pointI];
point pt = inter.hitPoint() + smallVec[pointi];
while (((pt-start[pointI])&dirVec[pointI]) <= magSqrDirVec[pointI])
while (((pt-start[pointi])&dirVec[pointi]) <= magSqrDirVec[pointi])
{
// See if any intersection between pt and end
pointIndexHit inter = findLine(pt, end[pointI]);
pointIndexHit inter = findLine(pt, end[pointi]);
// Check for not hit or hit same face as before (can happen
// if vector along surface of face)
@ -548,14 +548,14 @@ void Foam::searchableBox::findLineAll
}
hits.append(inter);
pt = inter.hitPoint() + smallVec[pointI];
pt = inter.hitPoint() + smallVec[pointi];
}
info[pointI].transfer(hits);
info[pointi].transfer(hits);
}
else
{
info[pointI].clear();
info[pointi].clear();
}
}
}
@ -604,15 +604,15 @@ void Foam::searchableBox::getVolumeType
volType.setSize(points.size());
volType = volumeType::INSIDE;
forAll(points, pointI)
forAll(points, pointi)
{
const point& pt = points[pointI];
const point& pt = points[pointi];
for (direction dir = 0; dir < vector::nComponents; dir++)
{
if (pt[dir] < min()[dir] || pt[dir] > max()[dir])
{
volType[pointI] = volumeType::OUTSIDE;
volType[pointi] = volumeType::OUTSIDE;
break;
}
}

View File

@ -730,9 +730,9 @@ void Foam::searchableCylinder::getVolumeType
volType.setSize(points.size());
volType = volumeType::INSIDE;
forAll(points, pointI)
forAll(points, pointi)
{
const point& pt = points[pointI];
const point& pt = points[pointi];
vector v(pt - point1_);
@ -742,12 +742,12 @@ void Foam::searchableCylinder::getVolumeType
if (parallel < 0)
{
// left of point1 endcap
volType[pointI] = volumeType::OUTSIDE;
volType[pointi] = volumeType::OUTSIDE;
}
else if (parallel > magDir_)
{
// right of point2 endcap
volType[pointI] = volumeType::OUTSIDE;
volType[pointi] = volumeType::OUTSIDE;
}
else
{
@ -756,11 +756,11 @@ void Foam::searchableCylinder::getVolumeType
if (mag(v) > radius_)
{
volType[pointI] = volumeType::OUTSIDE;
volType[pointi] = volumeType::OUTSIDE;
}
else
{
volType[pointI] = volumeType::INSIDE;
volType[pointi] = volumeType::INSIDE;
}
}
}

View File

@ -213,16 +213,16 @@ void Foam::searchablePlane::findLineAll
findLine(start, end, nearestInfo);
info.setSize(start.size());
forAll(info, pointI)
forAll(info, pointi)
{
if (nearestInfo[pointI].hit())
if (nearestInfo[pointi].hit())
{
info[pointI].setSize(1);
info[pointI][0] = nearestInfo[pointI];
info[pointi].setSize(1);
info[pointi][0] = nearestInfo[pointi];
}
else
{
info[pointI].clear();
info[pointi].clear();
}
}
}

View File

@ -391,16 +391,16 @@ void Foam::searchablePlate::findLineAll
findLine(start, end, nearestInfo);
info.setSize(start.size());
forAll(info, pointI)
forAll(info, pointi)
{
if (nearestInfo[pointI].hit())
if (nearestInfo[pointi].hit())
{
info[pointI].setSize(1);
info[pointI][0] = nearestInfo[pointI];
info[pointi].setSize(1);
info[pointi][0] = nearestInfo[pointi];
}
else
{
info[pointI].clear();
info[pointi].clear();
}
}
}

View File

@ -353,17 +353,17 @@ void Foam::searchableSphere::getVolumeType
volType.setSize(points.size());
volType = volumeType::INSIDE;
forAll(points, pointI)
forAll(points, pointi)
{
const point& pt = points[pointI];
const point& pt = points[pointi];
if (magSqr(pt - centre_) <= sqr(radius_))
{
volType[pointI] = volumeType::INSIDE;
volType[pointi] = volumeType::INSIDE;
}
else
{
volType[pointI] = volumeType::OUTSIDE;
volType[pointi] = volumeType::OUTSIDE;
}
}
}

View File

@ -138,7 +138,7 @@ public:
virtual autoPtr<searchableSurface> clone() const
{
NotImplemented;
return autoPtr<searchableSurface>(NULL);
return autoPtr<searchableSurface>(nullptr);
}

View File

@ -78,9 +78,9 @@ void Foam::searchableSurfaceCollection::findNearest
hitInfo
);
forAll(hitInfo, pointI)
forAll(hitInfo, pointi)
{
if (hitInfo[pointI].hit())
if (hitInfo[pointi].hit())
{
// Rework back into global coordinate sys. Multiply then
// transform
@ -88,24 +88,24 @@ void Foam::searchableSurfaceCollection::findNearest
(
cmptMultiply
(
hitInfo[pointI].rawPoint(),
hitInfo[pointi].rawPoint(),
scale_[surfI]
)
);
scalar distSqr = magSqr(globalPt - samples[pointI]);
scalar distSqr = magSqr(globalPt - samples[pointi]);
if (distSqr < minDistSqr[pointI])
if (distSqr < minDistSqr[pointi])
{
minDistSqr[pointI] = distSqr;
nearestInfo[pointI].setPoint(globalPt);
nearestInfo[pointI].setHit();
nearestInfo[pointI].setIndex
minDistSqr[pointi] = distSqr;
nearestInfo[pointi].setPoint(globalPt);
nearestInfo[pointi].setHit();
nearestInfo[pointi].setIndex
(
hitInfo[pointI].index()
hitInfo[pointi].index()
+ indexOffset_[surfI]
);
nearestSurf[pointI] = surfI;
nearestSurf[pointi] = surfI;
}
}
}
@ -125,11 +125,11 @@ void Foam::searchableSurfaceCollection::sortHits
// Count hits per surface.
labelList nHits(subGeom_.size(), 0);
forAll(info, pointI)
forAll(info, pointi)
{
if (info[pointI].hit())
if (info[pointi].hit())
{
label index = info[pointI].index();
label index = info[pointi].index();
label surfI = findLower(indexOffset_, index+1);
nHits[surfI]++;
}
@ -147,11 +147,11 @@ void Foam::searchableSurfaceCollection::sortHits
}
nHits = 0;
forAll(info, pointI)
forAll(info, pointi)
{
if (info[pointI].hit())
if (info[pointi].hit())
{
label index = info[pointI].index();
label index = info[pointi].index();
label surfI = findLower(indexOffset_, index+1);
// Store for correct surface and adapt indices back to local
@ -159,11 +159,11 @@ void Foam::searchableSurfaceCollection::sortHits
label localI = nHits[surfI]++;
surfInfo[surfI][localI] = pointIndexHit
(
info[pointI].hit(),
info[pointI].rawPoint(),
info[pointi].hit(),
info[pointi].rawPoint(),
index-indexOffset_[surfI]
);
infoMap[surfI][localI] = pointI;
infoMap[surfI][localI] = pointi;
}
}
}
@ -486,24 +486,24 @@ void Foam::searchableSurfaceCollection::findLine
subGeom_[surfI].findLine(e0, e1, hitInfo);
forAll(hitInfo, pointI)
forAll(hitInfo, pointi)
{
if (hitInfo[pointI].hit())
if (hitInfo[pointi].hit())
{
// Transform back to global coordinate sys.
nearest[pointI] = transform_[surfI].globalPosition
nearest[pointi] = transform_[surfI].globalPosition
(
cmptMultiply
(
hitInfo[pointI].rawPoint(),
hitInfo[pointi].rawPoint(),
scale_[surfI]
)
);
info[pointI] = hitInfo[pointI];
info[pointI].rawPoint() = nearest[pointI];
info[pointI].setIndex
info[pointi] = hitInfo[pointi];
info[pointi].rawPoint() = nearest[pointi];
info[pointi].setIndex
(
hitInfo[pointI].index()
hitInfo[pointi].index()
+ indexOffset_[surfI]
);
}
@ -514,27 +514,27 @@ void Foam::searchableSurfaceCollection::findLine
// Debug check
if (false)
{
forAll(info, pointI)
forAll(info, pointi)
{
if (info[pointI].hit())
if (info[pointi].hit())
{
vector n(end[pointI] - start[pointI]);
vector n(end[pointi] - start[pointi]);
scalar magN = mag(n);
if (magN > SMALL)
{
n /= mag(n);
scalar s = ((info[pointI].rawPoint()-start[pointI])&n);
scalar s = ((info[pointi].rawPoint()-start[pointi])&n);
if (s < 0 || s > 1)
{
FatalErrorInFunction
<< "point:" << info[pointI]
<< "point:" << info[pointi]
<< " s:" << s
<< " outside vector "
<< " start:" << start[pointI]
<< " end:" << end[pointI]
<< " start:" << start[pointi]
<< " end:" << end[pointi]
<< abort(FatalError);
}
}
@ -568,16 +568,16 @@ void Foam::searchableSurfaceCollection::findLineAll
findLine(start, end, nearestInfo);
info.setSize(start.size());
forAll(info, pointI)
forAll(info, pointi)
{
if (nearestInfo[pointI].hit())
if (nearestInfo[pointi].hit())
{
info[pointI].setSize(1);
info[pointI][0] = nearestInfo[pointI];
info[pointi].setSize(1);
info[pointi][0] = nearestInfo[pointi];
}
else
{
info[pointI].clear();
info[pointi].clear();
}
}
}

View File

@ -349,16 +349,16 @@ void Foam::searchableSurfaceWithGaps::findLineAll
findLine(start, end, nearestInfo);
info.setSize(start.size());
forAll(info, pointI)
forAll(info, pointi)
{
if (nearestInfo[pointI].hit())
if (nearestInfo[pointi].hit())
{
info[pointI].setSize(1);
info[pointI][0] = nearestInfo[pointI];
info[pointi].setSize(1);
info[pointi][0] = nearestInfo[pointi];
}
else
{
info[pointI].clear();
info[pointi].clear();
}
}
}

View File

@ -765,9 +765,9 @@ bool Foam::searchableSurfaces::checkQuality
);
label nBadTris = 0;
forAll(s, faceI)
forAll(s, facei)
{
const labelledTri& f = s[faceI];
const labelledTri& f = s[facei];
scalar q = triPointRef
(

Some files were not shown because too many files have changed in this diff Show More