diff options
author | George Hazan <george.hazan@gmail.com> | 2012-06-02 20:55:18 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2012-06-02 20:55:18 +0000 |
commit | 78c0815c4118fe24ab78cce2dc48a6232dcd824a (patch) | |
tree | 8512c50df70b8dd80c919e88ade3419207c95956 /plugins/FreeImage/Source/FreeImageToolkit/MultigridPoissonSolver.cpp | |
parent | ce816d83a8c75808e0eb06832592bffefe4a8dc4 (diff) |
- code cleaning
git-svn-id: http://svn.miranda-ng.org/main/trunk@270 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/FreeImage/Source/FreeImageToolkit/MultigridPoissonSolver.cpp')
-rw-r--r-- | plugins/FreeImage/Source/FreeImageToolkit/MultigridPoissonSolver.cpp | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/plugins/FreeImage/Source/FreeImageToolkit/MultigridPoissonSolver.cpp b/plugins/FreeImage/Source/FreeImageToolkit/MultigridPoissonSolver.cpp index 3b577cbd0a..6d17d45319 100644 --- a/plugins/FreeImage/Source/FreeImageToolkit/MultigridPoissonSolver.cpp +++ b/plugins/FreeImage/Source/FreeImageToolkit/MultigridPoissonSolver.cpp @@ -311,7 +311,7 @@ static BOOL fmg_mglin(FIBITMAP *U, int n, int ncycle) { #define _CREATE_ARRAY_GRID_(array, array_size) \ array = (FIBITMAP**)malloc(array_size * sizeof(FIBITMAP*));\ - if(!array) throw(1);\ + if (!array) throw(1);\ memset(array, 0, array_size * sizeof(FIBITMAP*)) #define _FREE_ARRAY_GRID_(array, array_size) \ @@ -351,7 +351,7 @@ static BOOL fmg_mglin(FIBITMAP *U, int n, int ncycle) { // allocate storage for r.h.s. on grid (ng - 2) ... IRHO[ngrid] = FreeImage_AllocateT(FIT_FLOAT, nn, nn); - if(!IRHO[ngrid]) throw(1); + if (!IRHO[ngrid]) throw(1); // ... and fill it by restricting from the fine grid fmg_restrict(IRHO[ngrid], U, nn); @@ -361,16 +361,16 @@ static BOOL fmg_mglin(FIBITMAP *U, int n, int ncycle) { nn = nn/2 + 1; ngrid--; IRHO[ngrid] = FreeImage_AllocateT(FIT_FLOAT, nn, nn); - if(!IRHO[ngrid]) throw(1); + if (!IRHO[ngrid]) throw(1); fmg_restrict(IRHO[ngrid], IRHO[ngrid+1], nn); } nn = 3; IU[0] = FreeImage_AllocateT(FIT_FLOAT, nn, nn); - if(!IU[0]) throw(1); + if (!IU[0]) throw(1); IRHS[0] = FreeImage_AllocateT(FIT_FLOAT, nn, nn); - if(!IRHS[0]) throw(1); + if (!IRHS[0]) throw(1); // initial solution on coarsest grid fmg_solve(IU[0], IRHO[0]); @@ -384,11 +384,11 @@ static BOOL fmg_mglin(FIBITMAP *U, int n, int ncycle) { nn = 2*nn - 1; IU[j] = FreeImage_AllocateT(FIT_FLOAT, nn, nn); - if(!IU[j]) throw(1); + if (!IU[j]) throw(1); IRHS[j] = FreeImage_AllocateT(FIT_FLOAT, nn, nn); - if(!IRHS[j]) throw(1); + if (!IRHS[j]) throw(1); IRES[j] = FreeImage_AllocateT(FIT_FLOAT, nn, nn); - if(!IRES[j]) throw(1); + if (!IRES[j]) throw(1); fmg_prolongate(IU[j], IU[j-1], nn); @@ -464,7 +464,7 @@ where j is such that 2^j is the nearest larger dimension corresponding to MAX(im */ FIBITMAP* DLL_CALLCONV FreeImage_MultigridPoissonSolver(FIBITMAP *Laplacian, int ncycle) { - if(!FreeImage_HasPixels(Laplacian)) return NULL; + if (!FreeImage_HasPixels(Laplacian)) return NULL; int width = FreeImage_GetWidth(Laplacian); int height = FreeImage_GetHeight(Laplacian); @@ -473,7 +473,7 @@ FreeImage_MultigridPoissonSolver(FIBITMAP *Laplacian, int ncycle) { int n = MAX(width, height); int size = 0; while((n >>= 1) > 0) size++; - if((1 << size) < MAX(width, height)) { + if ((1 << size) < MAX(width, height)) { size++; } // size must be of the form 2^j + 1 for some integer j @@ -481,7 +481,7 @@ FreeImage_MultigridPoissonSolver(FIBITMAP *Laplacian, int ncycle) { // allocate a temporary square image I FIBITMAP *I = FreeImage_AllocateT(FIT_FLOAT, size, size); - if(!I) return NULL; + if (!I) return NULL; // copy Laplacian into I and shift pixels to create a boundary FreeImage_Paste(I, Laplacian, 1, 1, 255); |