CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Bugs

label/scalar mixup in hierarchGeomDecomp.C

Register Blogs Members List Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   August 26, 2010, 05:13
Default label/scalar mixup in hierarchGeomDecomp.C
  #1
Member
 
Michael Wild
Join Date: Mar 2009
Location: Bern, Switzerland
Posts: 79
Rep Power: 17
mwild is on a distinguished road
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         );
where sortedWeightedSizes is a List<scalar>. It probably should be fixed by

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)
Michael
mwild is offline   Reply With Quote

Old   August 26, 2010, 06:31
Default
  #2
Member
 
Michael Wild
Join Date: Mar 2009
Location: Bern, Switzerland
Posts: 79
Rep Power: 17
mwild is on a distinguished road
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_
mwild is offline   Reply With Quote

Old   August 27, 2010, 07:28
Default
  #3
Senior Member
 
Mattijs Janssens
Join Date: Mar 2009
Posts: 1,419
Rep Power: 26
mattijs is on a distinguished road
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.
mattijs is offline   Reply With Quote

Old   August 27, 2010, 09:53
Default
  #4
Member
 
Michael Wild
Join Date: Mar 2009
Location: Bern, Switzerland
Posts: 79
Rep Power: 17
mwild is on a distinguished road
gcc4.1.2 does ;-) probably 4.4 would too with proper warning flags.

Kudos for the Mantis bug tracker! At last, I'd say :-)
mwild is offline   Reply With Quote

Old   February 16, 2012, 12:33
Default
  #5
New Member
 
Naveed Iqbal
Join Date: Oct 2009
Location: Germany
Posts: 19
Rep Power: 16
niqbal is on a distinguished road
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

niqbal is offline   Reply With Quote

Old   February 16, 2012, 15:18
Default
  #6
Member
 
Michael Wild
Join Date: Mar 2009
Location: Bern, Switzerland
Posts: 79
Rep Power: 17
mwild is on a distinguished road
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
mwild is offline   Reply With Quote

Old   February 17, 2012, 04:43
Default
  #7
New Member
 
Naveed Iqbal
Join Date: Oct 2009
Location: Germany
Posts: 19
Rep Power: 16
niqbal is on a distinguished road
Hi Michael,
Thanks for the prompt reply. It clarifies the things I am looking at.
niqbal is offline   Reply With Quote

Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On



All times are GMT -4. The time now is 08:58.