/** MWE showing that when OpenMP is enabled, copying scalar that are contained in lists fails when the ```foreach``` loop is not nested. Compile using qcc test.c -fopenmp -lm */ #define BGHOSTS 2 #include "grid/quadtree.h" #include "run.h" scalar f[]; scalar fold[]; /** Dummy lists */ scalar * lc = {f}; scalar * lo = {fold}; int main () { //domain size L0 = 4.0; //center computational domain origin( -0.5 * L0, -0.5 * L0 ); init_grid( 1<<7 ); run(); } event randomize (i++, first) { foreach() { f[] = (noise() +1.0); } } /** Updating proceduer. If the first choice is enabled, the updating of oldVar is not equal with ```curVar```. */ event update(i< 2; i++) { scalar curVar, oldVar; #if 0 foreach() { for (curVar, oldVar in lc, lo) { oldVar[] = curVar[]; } } #else for (curVar, oldVar in lc, lo) { foreach() { oldVar[] = curVar[]; } } #endif fields_stats(); }