/* Copyright (C) 2007 Alexander Shirokov This file is part of WSHAPE. WSHAPE is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. WSHAPE is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ #ifndef _WSHAPE_H_ #define _WSHAPE_H_ /* Reference laws */ /* Specifies the smoothing scale */ typedef struct wshape_smscale_t { float eps; } wshape_smscale_t; /* Newtonian potential/force law */ float wshape_law_newton (int law, float r); /* Plummer potential/force law */ float wshape_law_plummer(int law, wshape_smscale_t *S, float r); /* Spline (traditional) potential/force law */ float wshape_law_spline(int law, wshape_smscale_t *S, float r); /* Parameter 'law' takes one of the following values. */ enum { /* The return value will be interaction potential law. */ WSHAPE_LAW_POTEN, /* The return value will be interparticle force law. */ WSHAPE_LAW_FORCE, }; /* W-shape particles */ /* Specifies the smoothing scales in a generic pair */ typedef struct wshape_smscales_t { wshape_smscale_t particle1, particle2; } wshape_smscales_t; /* W-shape density profile, as function of radial position */ float wshape_density (int scaling, wshape_smscale_t *smscale , float r, int n); /* potential/force law for a pair of two general W-shape particles */ float wshape_law_gener (int law, int scaling, wshape_smscales_t *smscales , float r, int n); /* potential/force law for a pair of two identical W-shape particles */ float wshape_law_ident (int law, int scaling, wshape_smscale_t *smscale , float r, int n); /* Poential/force law for a pair including one W-shape and one point particle */ float wshape_law_point (int law, int scaling, wshape_smscale_t *smscale , float r, int n); /* Parameter 'scaling' takes one of the following values. */ enum { /* no scaling: the diameter og W-shapes equals epsilon by definition. */ WSHAPE_SCALING_NONE, /* use potential-based scaling of W-shapes: the diameter and normalization of W-shape are scaled yo match the plummer potential asymptotics at zero separation */ WSHAPE_SCALING_BY_POTEN, /* use force-based scaling of W-shapes: the diameter and normalization of W-shape are scaled yo match the plummer force asymptotics at zero separation */ WSHAPE_SCALING_BY_FORCE, }; /* Maximum allowed value of parameter 'n' */ #define WSHAPE_NMAX 4 /* Raw Hockney-Eastwood window functions */ float wshape_hockney_eastwood(int n, float s); /* Symmetric combination \sqrt( (eps1^2+eps2^2)/2 ) motivated by gaussian */ float eps_sym(float eps1, float eps2); /* The following routines are only available with GSL linked */ #ifdef WITH_GSL #include "gsl_sf_bessel.h" #include "gsl_sf_erf.h" /* Potential/force law in a pair of gaussian clouds of general smoothing */ float wshape_gaussian_law_ident(int law, wshape_smscale_t *S, float r); /* Plummer density cloud */ float wshape_plummer_density(wshape_smscale_t *S, float r); /* Potential/force law in a pair of plummer clouds of general smoothing */ float wshape_plummer_law_gener(int law, wshape_smscales_t *S, float r); /* Poential/force law for a pair including one Plummer cloud and one point particle */ float wshape_plummer_law_point(int law, wshape_smscale_t *S, float r); #endif #endif