Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions common/lib/share/interoff-lib.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@
#ifndef INTEROFF_LIB_C
#define INTEROFF_LIB_C "$Revision$"

#ifdef OPENACC // If on GPU map fprintf to printf
#define fprintf(stderr,...) printf(__VA_ARGS__)
#endif

#pragma acc routine
double off_F(double x, double y,double z,double A,double B,double C,double D) {
return ( A*x + B*y + C*z + D );
Expand Down Expand Up @@ -370,9 +374,7 @@ int off_clip_3D_mod(intersection* t, Coords a, Coords b,
#ifdef OFF_LEGACY
if (t_size>OFF_INTERSECT_MAX)
{
#ifndef OPENACC
fprintf(stderr, "Warning: number of intersection exceeded (%d) (interoff-lib/off_clip_3D_mod)\n", OFF_INTERSECT_MAX);
#endif
return (t_size);
}
#endif
Expand Down Expand Up @@ -454,9 +456,7 @@ int off_clip_3D_mod_grav(intersection* t, Coords pos, Coords vel, Coords acc,

if (t_size>CHAR_BUF_LENGTH)
{
#ifndef OPENACC
fprintf(stderr, "Warning: number of intersection exceeded (%d) (interoff-lib/off_clip_3D_mod)\n", CHAR_BUF_LENGTH);
#endif
return (t_size);
}
//both planes intersect the polygon, let's find the intersection point
Expand Down
12 changes: 8 additions & 4 deletions common/lib/share/r-interoff-lib.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@
#include "r-interoff-lib.h"
#endif

#ifdef OPENACC // If on GPU map fprintf to printf
#define fprintf(stderr,...) printf(__VA_ARGS__)
#endif

#pragma acc routine
double r_off_F(double x, double y,double z,double A,double B,double C,double D) {
return ( A*x + B*y + C*z + D );
Expand Down Expand Up @@ -366,9 +370,7 @@ int r_off_clip_3D_mod(r_intersection* t, Coords a, Coords b,
#ifdef OFF_LEGACY
if (t_size>OFF_INTERSECT_MAX)
{
#ifndef OPENACC
fprintf(stderr, "Warning: number of intersection exceeded (%d) (interoff-lib/off_clip_3D_mod)\n", OFF_INTERSECT_MAX);
#endif
return (t_size);
}
#endif
Expand Down Expand Up @@ -450,9 +452,7 @@ int r_off_clip_3D_mod_grav(r_intersection* t, Coords pos, Coords vel, Coords acc

if (t_size>CHAR_BUF_LENGTH)
{
#ifndef OPENACC
fprintf(stderr, "Warning: number of intersection exceeded (%d) (interoff-lib/off_clip_3D_mod)\n", CHAR_BUF_LENGTH);
#endif
return (t_size);
}
//both planes intersect the polygon, let's find the intersection point
Expand Down Expand Up @@ -891,6 +891,10 @@ int n2 = r - m;
r_intersection *L, *R;
L = (r_intersection *)malloc(sizeof(r_intersection) * n1);
R = (r_intersection *)malloc(sizeof(r_intersection) * n2);
if (!L||!R) {
fprintf(stderr,"Error allocating intersection arrays\n");
exit(-1);
}
/* Copy data to temp arrays L[] and R[] */
#pragma acc loop independent
for (i = 0; i < n1; i++)
Expand Down
Loading