/*
 * 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 __DISCRETIZATION_H_
#define __DISCRETIZATION_H_

#include "grid.h"
#include "parameter.h"

enum OBJECTBOUNDARY {
    FLUID = 0,
    /* Front Corners */
    FRONTTOPLEFTCORNER,
    FRONTTOPRIGHTCORNER,
    FRONTBOTTOMLEFTCORNER,
    FRONTBOTTOMRIGHTCORNER,
    /* Back Corners */
    BACKTOPLEFTCORNER,
    BACKTOPRIGHTCORNER,
    BACKBOTTOMLEFTCORNER,
    BACKBOTTOMRIGHTCORNER,
    /* Faces */
    FRONTFACE,
    BACKFACE,
    LEFTFACE,
    RIGHTFACE,
    TOPFACE,
    BOTTOMFACE,
    /* Front Lines remaining after Corners and Faces */
    FRONTLEFTLINE,
    FRONTRIGHTLINE,
    FRONTTOPLINE,
    FRONTBOTTOMLINE,
    /* Bottom Lines remaining after Corners and Faces */
    BACKLEFTLINE,
    BACKRIGHTLINE,
    BACKTOPLINE,
    BACKBOTTOMLINE,
    /* Mid Lines remaining after Corners and Faces */
    MIDTOPLEFTLINE,
    MIDTOPRIGHTLINE,
    MIDBOTTOMLEFTLINE,
    MIDBOTTOMRIGHTLINE,
    /* Local where its an object but not a boundary */
    OBSTACLE,
    /*Ghost cells boundary */
    OUTSIDEBOUNDARY
};

enum BC { NOSLIP = 1, SLIP, OUTFLOW, PERIODIC };


enum SHAPE { NOSHAPE = 0, RECT, CIRCLE };

typedef struct {
    /* geometry and grid information */
    Grid grid;
    /* arrays */
    double *p, *rhs;
    double *f, *g, *h;
    double *u, *v, *w;
    double* s;
    /* parameters */
    double eps, omega;
    double re, tau, gamma;
    double gx, gy, gz;
    /* time stepping */
    double dt, te;
    double dtBound;
    char* problem;
    int bcLeft, bcRight, bcBottom, bcTop, bcFront, bcBack;
} Discretization;

extern void initDiscretization(Discretization*, Parameter*);
extern void computeRHS(Discretization*);
extern void normalizePressure(Discretization*);
extern void computeTimestep(Discretization*);
extern void setBoundaryConditions(Discretization*);
extern void setObjectBoundaryCondition(Discretization*);
extern void setSpecialBoundaryCondition(Discretization*);
extern void computeFG(Discretization*);
extern void adaptUV(Discretization*);
#endif
