NuSiF-Solver/EnhancedSolver/2D-seq/src/grid.h

39 lines
738 B
C
Raw Permalink Normal View History

2024-02-15 09:44:06 +01:00
/*
* Copyright (C) NHR@FAU, University Erlangen-Nuremberg.
* All rights reserved. This file is part of nusif-solver.
* Use of this source code is governed by a MIT style
* license that can be found in the LICENSE file.
*/
#ifndef __GRID_H_
#define __GRID_H_
2024-03-05 21:24:45 +01:00
#define S(i, j) s[(j) * (imax + 2) + (i)]
enum OBJECTBOUNDARY {
FLUID = 0,
TOP,
BOTTOM,
LEFT,
RIGHT,
TOPLEFT,
BOTTOMLEFT,
TOPRIGHT,
BOTTOMRIGHT,
OBSTACLE
};
enum SHAPE { NOSHAPE = 0, RECT, CIRCLE };
2024-02-15 09:44:06 +01:00
typedef struct {
double dx, dy;
int imax, jmax;
double xlength, ylength;
2024-03-05 21:24:45 +01:00
int* s;
2024-02-15 09:44:06 +01:00
} Grid;
2024-03-05 21:24:45 +01:00
static inline int gridIsFluid(Grid* g, int i, int j)
{
2024-03-06 06:02:40 +01:00
return g->s[j * (g->imax + 2) + i] == FLUID;
2024-03-05 21:24:45 +01:00
}
2024-02-15 09:44:06 +01:00
#endif // __GRID_H_