From 9367c3209f5f721960448534faf8f82ea08ef28d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?FEL=C5=A0=C3=96CI=20Marek?= <marek.felsoci@inria.fr> Date: Mon, 6 Nov 2023 00:37:31 +0100 Subject: [PATCH] Add function for resetting cylinder --- include/main.h | 1 + src/cylinder.c | 16 +++++++++------- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/include/main.h b/include/main.h index 0b4422d..e345aa0 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 605e1f8..b1b455b 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.") ; -- GitLab