Counting non-zero values in a volScalarField
Hi all,
I'm running a custom pisoFoam solver in parallel (16 processors) and I'm having some issues with what I think should be a simple task. I have a mesh of about 460k cells, and have a volScalarField with lots of zeros. I would like to use an if statement inside of a for loop that loops through all the cells in the mesh, and checks to see if the ith value in the volScalarField is zero. If its zero, than it should increment a counter; if its not than do nothing. However, every time I've tried it I only manage to loop through one processor. If I remove the if statement and just have it increase the counter, I get back the total number of cells after I use reduce(counter, sumOp<int>()). Any ideas on how to make the if statement work? The relevant part of code is below Code:
forAll(mesh.cells(),celli) Thanks, Javier |
That title should read counting zero values in volScalarField, my apologies for the confusion
|
All times are GMT -4. The time now is 04:02. |