summaryrefslogtreecommitdiff
path: root/plugins/FreeImage/Source/FreeImageToolkit/MultigridPoissonSolver.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/FreeImage/Source/FreeImageToolkit/MultigridPoissonSolver.cpp')
-rw-r--r--plugins/FreeImage/Source/FreeImageToolkit/MultigridPoissonSolver.cpp22
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);