From d01b1f44e041e5b1100903c801692b5b004f18b7 Mon Sep 17 00:00:00 2001 From: mattijs Date: Tue, 2 Dec 2008 15:34:55 +0000 Subject: [PATCH 1/4] zero-size mapping --- .../timeVaryingMappedFixedValueFvPatchField.C | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/finiteVolume/fields/fvPatchFields/derived/timeVaryingMappedFixedValue/timeVaryingMappedFixedValueFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/derived/timeVaryingMappedFixedValue/timeVaryingMappedFixedValueFvPatchField.C index 91473124c0..ba46223e81 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/timeVaryingMappedFixedValue/timeVaryingMappedFixedValueFvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/timeVaryingMappedFixedValue/timeVaryingMappedFixedValueFvPatchField.C @@ -207,8 +207,11 @@ void timeVaryingMappedFixedValueFvPatchField::autoMap ) { fixedValueFvPatchField::autoMap(m); - startSampledValues_.autoMap(m); - endSampledValues_.autoMap(m); + if (startSampledValues_.size() > 0) + { + startSampledValues_.autoMap(m); + endSampledValues_.autoMap(m); + } } From 5722298f645133d02f0ebc07af40f725ff4f865c Mon Sep 17 00:00:00 2001 From: mattijs Date: Tue, 2 Dec 2008 15:36:52 +0000 Subject: [PATCH 2/4] no local segments --- .../distributedTriSurfaceMesh.C | 23 ++++++++++--------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/src/meshTools/searchableSurface/distributedTriSurfaceMesh.C b/src/meshTools/searchableSurface/distributedTriSurfaceMesh.C index a3e499bd65..6c3c4ef1ad 100644 --- a/src/meshTools/searchableSurface/distributedTriSurfaceMesh.C +++ b/src/meshTools/searchableSurface/distributedTriSurfaceMesh.C @@ -97,7 +97,11 @@ void Foam::distributedTriSurfaceMesh::splitSegment point clipPt0, clipPt1; - // 1. Fully local already handled outside + // 1. Fully local already handled outside. Note: retest is cheap. + if (isLocal(procBb_[Pstream::myProcNo()], start, end)) + { + return; + } // 2. Check if fully inside other processor. Rare occurrence @@ -109,17 +113,14 @@ void Foam::distributedTriSurfaceMesh::splitSegment { const List& bbs = procBb_[procI]; - forAll(bbs, bbI) + if (isLocal(bbs, start, end)) { - if (bbs[bbI].contains(start) && bbs[bbI].contains(end)) - { - //Pout<< " Completely remote segment:" - // << start << end << " on proc:" << procI << endl; - sendMap[procI].append(allSegments.size()); - allSegmentMap.append(segmentI); - allSegments.append(segment(start, end)); - return; - } + //Pout<< " Completely remote segment:" + // << start << end << " on proc:" << procI << endl; + sendMap[procI].append(allSegments.size()); + allSegmentMap.append(segmentI); + allSegments.append(segment(start, end)); + return; } } } From 881c6451a5dcf9ffd2f7ecbaad01e23a4ad68478 Mon Sep 17 00:00:00 2001 From: mattijs Date: Wed, 3 Dec 2008 11:19:26 +0000 Subject: [PATCH 3/4] latestTime handlind --- src/OpenFOAM/db/Time/timeSelector.C | 65 ++++++++++++++++++----------- 1 file changed, 41 insertions(+), 24 deletions(-) diff --git a/src/OpenFOAM/db/Time/timeSelector.C b/src/OpenFOAM/db/Time/timeSelector.C index cfb2354d79..002a0b5beb 100644 --- a/src/OpenFOAM/db/Time/timeSelector.C +++ b/src/OpenFOAM/db/Time/timeSelector.C @@ -56,22 +56,12 @@ Foam::List Foam::timeSelector::selected(const List& Times) const { List lst(Times.size(), false); - // check ranges - forAll(Times, i) + // check ranges, avoid false positive on constant/ + forAll(Times, timeI) { - if (selected(Times[i])) + if (Times[timeI].name() != "constant" && selected(Times[timeI])) { - lst[i] = true; - } - } - - // avoid false positive on "constant" - forAll(Times, i) - { - if (Times[i].name() == "constant") - { - lst[i] = false; - break; + lst[timeI] = true; } } @@ -85,15 +75,15 @@ Foam::List Foam::timeSelector::selected(const List& Times) const int nearestIndex = -1; scalar nearestDiff = Foam::GREAT; - forAll(Times, timeIndex) + forAll(Times, timeI) { - if (Times[timeIndex].name() == "constant") continue; + if (Times[timeI].name() == "constant") continue; - scalar diff = fabs(Times[timeIndex].value() - target); + scalar diff = fabs(Times[timeI].value() - target); if (diff < nearestDiff) { nearestDiff = diff; - nearestIndex = timeIndex; + nearestIndex = timeI; } } @@ -156,6 +146,27 @@ Foam::List Foam::timeSelector::select { List selectTimes(timeDirs.size(), true); + // determine locations of constant/ and 0/ directories + label constantIdx = -1; + label zeroIdx = -1; + + forAll(timeDirs, timeI) + { + if (timeDirs[timeI].name() == "constant") + { + constantIdx = timeI; + } + else if (timeDirs[timeI].value() == 0) + { + zeroIdx = timeI; + } + + if (constantIdx >= 0 && zeroIdx >= 0) + { + break; + } + } + if (args.options().found("time")) { selectTimes = timeSelector @@ -166,25 +177,31 @@ Foam::List Foam::timeSelector::select else if (args.options().found("latestTime")) { selectTimes = false; + const label latestIdx = timeDirs.size() - 1; // avoid false match on constant/ or 0/ - if (timeDirs.size() > 2) + if (latestIdx != constantIdx && latestIdx != zeroIdx) { - selectTimes[timeDirs.size() - 1] = true; + selectTimes[latestIdx] = true; } } - if (timeDirs.size() > 1) + // special treatment for constant/ + if (constantIdx >= 0) { - selectTimes[0] = args.options().found("constant"); + selectTimes[constantIdx] = args.options().found("constant"); + } + // special treatment for 0/ + if (zeroIdx >= 0) + { if (args.options().found("noZero")) { - selectTimes[1] = false; + selectTimes[zeroIdx] = false; } else if (argList::validOptions.found("zeroTime")) { - selectTimes[1] = args.options().found("zeroTime"); + selectTimes[zeroIdx] = args.options().found("zeroTime"); } } From f5b23d50654e1714d6e6304320d00680477662b0 Mon Sep 17 00:00:00 2001 From: mattijs Date: Wed, 3 Dec 2008 11:19:40 +0000 Subject: [PATCH 4/4] missing patch selection --- .../utilities/postProcessing/wall/wallHeatFlux/wallHeatFlux.C | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/applications/utilities/postProcessing/wall/wallHeatFlux/wallHeatFlux.C b/applications/utilities/postProcessing/wall/wallHeatFlux/wallHeatFlux.C index 1eb405cf29..49ac7d7431 100644 --- a/applications/utilities/postProcessing/wall/wallHeatFlux/wallHeatFlux.C +++ b/applications/utilities/postProcessing/wall/wallHeatFlux/wallHeatFlux.C @@ -64,7 +64,7 @@ int main(int argc, char *argv[]) Info<< "\nWall heat fluxes [W]" << endl; forAll(patchHeatFlux, patchi) { - if (typeid(mesh.boundary()) == typeid(wallFvPatch)) + if (typeid(mesh.boundary()[patchi]) == typeid(wallFvPatch)) { Info<< mesh.boundary()[patchi].name() << " "