SCOREC / pumi-pic

support libraries for unstructured mesh particle in cell simulations on GPUs and CPUs
BSD 3-Clause "New" or "Revised" License
35 stars 14 forks source link

Using PS_PARALLEL_FOR_ELEMENTS macro #22

Closed kumargp closed 5 years ago

kumargp commented 5 years ago

Error when using PS_PARALLEL_FOR_ELEMENTS in here:

pumipic_adjacency.hpp:607:4: error: macro "PS_PARALLEL_FOR_ELEMENTS" passed 8 arguments, but takes just 4 });

I followed similar uses here

Note: I had to add #include to use Vector3d.

diamog commented 5 years ago

You have run into the unprotected comma problem with macros. @cwsmith had some ways to get around this issue that i can't remember now.

That being said, we have a more friendly method to perform particle loops using lambdas. You can see a simple example here. I believe we will want to move to using this method as it is easier to understand compilation errors on the device.

cwsmith commented 5 years ago

This macro was replaced with a lambda: https://github.com/SCOREC/particle_structures/blob/c6b14b15eb36891a7e851ff1640de32339ac1546/test/lambdaTest.cpp#L40-L45