|
[Sponsors] |
August 26, 2010, 05:13 |
label/scalar mixup in hierarchGeomDecomp.C
|
#1 |
Member
Michael Wild
Join Date: Mar 2009
Location: Bern, Switzerland
Posts: 79
Rep Power: 17 |
The bug is in src/decompositionMethods/decompositionMethods/hierarchGeomDecomp/hierarchGeomDecomp.C:
Code:
279 label weightedSize = returnReduce 280 ( 281 sortedWeightedSizes[mid] - sortedWeightedSizes[minIndex], 282 sumOp<label>() 283 ); Code:
--- a/src/decompositionMethods/decompositionMethods/hierarchGeomDecomp/hierarchGeomDecomp.C +++ b/src/decompositionMethods/decompositionMethods/hierarchGeomDecomp/hierarchGeomDecomp.C @@ -276,10 +276,10 @@ void Foam::hierarchGeomDecomp::findBinary while (true) { - label weightedSize = returnReduce + scalar weightedSize = returnReduce ( sortedWeightedSizes[mid] - sortedWeightedSizes[minIndex], - sumOp<label>() + sumOp<scalar>() ); if (debug) |
|
August 26, 2010, 06:31 |
|
#2 |
Member
Michael Wild
Join Date: Mar 2009
Location: Bern, Switzerland
Posts: 79
Rep Power: 17 |
Similarly for src/dynamicMesh/slidingInterface/slidingInterface.C:
Code:
--- a/src/dynamicMesh/slidingInterface/slidingInterface.C +++ b/src/dynamicMesh/slidingInterface/slidingInterface.C @@ -706,12 +706,12 @@ void Foam::slidingInterface::setTolerances(const dictionary&dict, bool report) "edgeMergeTol", edgeMergeTol_ ); - nFacesPerSlaveEdge_ = dict.lookupOrDefault<scalar> + nFacesPerSlaveEdge_ = dict.lookupOrDefault<label> ( "nFacesPerSlaveEdge", nFacesPerSlaveEdge_ ); - edgeFaceEscapeLimit_ = dict.lookupOrDefault<scalar> + edgeFaceEscapeLimit_ = dict.lookupOrDefault<label> ( "edgeFaceEscapeLimit", edgeFaceEscapeLimit_ |
|
August 27, 2010, 07:28 |
|
#3 |
Senior Member
Mattijs Janssens
Join Date: Mar 2009
Posts: 1,419
Rep Power: 26 |
Thanks, I've pushed them into 1.7.x. By the way, how did you find these - gcc4.4 does not seem to warn about them.
We've finally got a proper bug reporting system :-) Please report any future bugs on http://www.openfoam.com/bugs. |
|
August 27, 2010, 09:53 |
|
#4 |
Member
Michael Wild
Join Date: Mar 2009
Location: Bern, Switzerland
Posts: 79
Rep Power: 17 |
gcc4.1.2 does ;-) probably 4.4 would too with proper warning flags.
Kudos for the Mantis bug tracker! At last, I'd say :-) |
|
February 16, 2012, 12:33 |
|
#5 |
New Member
Naveed Iqbal
Join Date: Oct 2009
Location: Germany
Posts: 19
Rep Power: 16 |
Hi Michael,
It would be very nice if you might explain a little bit about this function call returnReduce(. ,. ). I have find its definition "PstreamReduceOps.H" but could not understand what this will return. Your short description about this function would help me a lot. Thanks in Advance |
|
February 16, 2012, 15:18 |
|
#6 |
Member
Michael Wild
Join Date: Mar 2009
Location: Bern, Switzerland
Posts: 79
Rep Power: 17 |
returnReduce() is a reduction operation (e.g. sum, min, max, cumulative sum, product, cumulative product, etc) across all processors for parallel runs. The first argument is the value on the local processor and the second argument is the binary operator performing the reduction operation between two arguments. This can be a functor or a function pointer.
The problem in the reported issue is that the functor objects where created for label type (i.e. int), while the value argument was a scalar (i.e. double or float). HTH Michael |
|
February 17, 2012, 04:43 |
|
#7 |
New Member
Naveed Iqbal
Join Date: Oct 2009
Location: Germany
Posts: 19
Rep Power: 16 |
Hi Michael,
Thanks for the prompt reply. It clarifies the things I am looking at. |
|
Thread Tools | Search this Thread |
Display Modes | |
|
|