|
[Sponsors] |
Multicore sequential sum and index extraction |
![]() |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
![]() |
![]() |
#1 |
New Member
Raoul
Join Date: Apr 2021
Posts: 17
Rep Power: 6 ![]() |
Hi everyone,
I am writing a routine in OpenFOAM that requires me to perform the following operations: - calculate a scalarField (volScalarField works fine as well, I do not need boundaries thought), let us call it myField. - perform the following operation on the field Code:
for (label i = 1; i < myField.size(); i++) { myField[i] += myField[i-1]; } Code:
forAllReverse (myField, i) { if (myScalar >= myField[i]) { myElement = i; break; } } Any suggestion on how to make it multicore-proof? Thanks! Edit: I forgot to say that I am using OpenFOAM v9, I am not sure it that makes any difference! |
|
![]() |
![]() |
![]() |
Thread Tools | Search this Thread |
Display Modes | |
|
|