Skip to content

Commit

Permalink
smarter object definitions
Browse files Browse the repository at this point in the history
  • Loading branch information
Nicolas Tessore committed May 26, 2015
1 parent 2cc23e9 commit 39c5a22
Show file tree
Hide file tree
Showing 24 changed files with 560 additions and 446 deletions.
64 changes: 0 additions & 64 deletions kernel/eplp.cl

This file was deleted.

71 changes: 0 additions & 71 deletions kernel/eplp_plus_shear.cl

This file was deleted.

40 changes: 0 additions & 40 deletions kernel/gauss.cl

This file was deleted.

12 changes: 0 additions & 12 deletions kernel/object.cl
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,3 @@ struct __attribute__ ((aligned(4))) param
char name[32];
int wrap;
};

// macro to specify type of object
#define OBJECT(x) constant int object_##x

// macro to simplify parameter definition for object
#define PARAMS(x) constant struct param parlst_##x[]

// macro to get number of parameters for object
#define NPARAMS(x) (sizeof(parlst_##x)/sizeof(struct param))

// macro to access specific parameter definition for object
#define PARAM(x, n) parlst_##x[n]
30 changes: 0 additions & 30 deletions kernel/point_mass.cl

This file was deleted.

44 changes: 0 additions & 44 deletions kernel/sersic.cl

This file was deleted.

39 changes: 0 additions & 39 deletions kernel/sis_plus_shear.cl

This file was deleted.

24 changes: 0 additions & 24 deletions kernel/sky.cl

This file was deleted.

25 changes: 13 additions & 12 deletions kernel/devauc.cl → objects/devauc.cl
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
// De Vaucouleurs b param
// de Vaucouleurs b param
#define DEVAUC_B 7.6692494425008039044f
// (DEVAUC_B^8)/(8!)
#define DEVAUC_C 296.826303766893f

OBJECT(devauc) = SOURCE;
type = SOURCE;

PARAMS(devauc) = {
params
{
{ "x" },
{ "y" },
{ "r" },
Expand All @@ -14,34 +15,34 @@ PARAMS(devauc) = {
{ "pa", true },
};

struct devauc
data
{
float2 x; // source position
mat22 t; // coordinate transformation matric
float rs; // scale length
float norm; // normalisation
};

static float devauc(constant struct devauc* data, float2 x)
static float brightness(constant data* this, float2 x)
{
// DeVaucouleur's profile for centered and rotated coordinate system
return data->norm*exp(-DEVAUC_B*sqrt(sqrt(length(mv22(data->t, x - data->x))/data->rs)));
// de Vaucouleurs profile for centered and rotated coordinate system
return this->norm*exp(-DEVAUC_B*sqrt(sqrt(length(mv22(this->t, x - this->x))/this->rs)));
}

static void set_devauc(global struct devauc* data, float x1, float x2, float r, float mag, float q, float pa)
static void set(global data* this, float x, float y, float r, float mag, float q, float pa)
{
float c = cos(pa*DEG2RAD);
float s = sin(pa*DEG2RAD);

// source position
data->x = (float2)(x1, x2);
this->x = (float2)(x, y);

// transformation matrix: rotate and scale
data->t = (mat22)(q*c, q*s, -s, c);
this->t = (mat22)(q*c, q*s, -s, c);

// scale length
data->rs = r;
this->rs = r;

// normalisation to total luminosity
data->norm = exp(-0.4f*mag*LOG_10)/PI/r/r/q*DEVAUC_C;
this->norm = exp(-0.4f*mag*LOG_10)/PI/r/r/q*DEVAUC_C;
}
Loading

0 comments on commit 39c5a22

Please sign in to comment.