diff --git a/include/main.h b/include/main.h index 0b4422d3b144efd4f14a5bd5433e770c0a030a85..e345aa02e8f990e8fe303f612ff71989bc1453cd 100644 --- a/include/main.h +++ b/include/main.h @@ -49,6 +49,7 @@ int computeRelativeError(void *sol, void *ref, double *eps) ; int computeVecNorm(void *ref, double *norm); int computeCoordCylinder(int i, double *coord) ; int initCylinder(int *argc, char ***argv) ; +void resetCylinder(); int getMeshStep(double *m) ; int main(int argc, char **argv) ; int computeRhs(void) ; diff --git a/src/cylinder.c b/src/cylinder.c index 605e1f82fde282fd8197ed25c4bd5f5415eff438..b1b455b3b2092d52d6cb1c278c168ef0d495b73a 100644 --- a/src/cylinder.c +++ b/src/cylinder.c @@ -9,10 +9,11 @@ double radius = 2.0 ; double height = 4.0 ; /*! \brief Mesh step (average distance between two points) */ -double meshStep ; +double meshStep; -/*! \brief Number of points per loops in the BEM mesh (main cylinder) */ -static int nbPtsLoop=0; +static double angleStep=0.; + +static double zStep=0.; /*! \brief Computes coordinates of point number 'i' @@ -24,8 +25,6 @@ static int nbPtsLoop=0; \return 0 for success */ int computeCoordCylinder(int i, double *coord) { - static double angleStep=0. ; - static double zStep=0. ; double theta ; if (i<0 || i>=nbPts) { @@ -39,8 +38,6 @@ int computeCoordCylinder(int i, double *coord) { zStep=height/(double)nbPts ; angleStep=sqrt(zStep*2.*M_PI/radius) ; meshStep=zStep*2.*M_PI/angleStep ; - - nbPtsLoop=floor(2.*M_PI/angleStep) ; // Used to write VTK file } theta = (double)i * angleStep ; @@ -75,6 +72,11 @@ int initCylinder(int *argc, char ***argv) { return 0 ; } +void resetCylinder() { + angleStep=0.; + zStep=0.; +} + int getMeshStep(double *m) { if (meshStep==0.) SETERRQ(1, "meshStep not yet initialized. Come back later.") ;