
/* ===purpose=== */

/**********************************************************************************************************************************/
/********************************  COLLOCATION BEM for 3D LAPLACE EQUATION: SINGULAR FORMULATION  *********************************/
/***************************************  3-NODED TRIANGULAR ELEMENT: ANALYTIC INTEGRATION  ***************************************/
/*****************************  Definitions of wide range variables, arrays, functions and parameters  ****************************/
/**********************************************************************************************************************************/

/* Developer: Sylvain Nintcheu Fata */
/* Version:   V.1.3                 */
/* Released:  Jun 14, 2012          */


#ifndef _CBEM_LAP_GLOBAL_VAR_H_
#define _CBEM_LAP_GLOBAL_VAR_H_

#include <time.h>


/* Parameters
 *----gm_eps---= Tolerance on the geometry
 *----f_eps----= Tolerance on the argument of a function
 *-----pi------= pi = 3.1415926535897932
 *----pix2-----= pix2 = 2*pi
 *-----fac-----= Factor of the Green's function: fac = 1/(4*pi)
 */
double pi,pix2,fac;
double gm_eps,f_eps;


/* Potential and Flux
 *-----pbv-----= Vector containing Prescribed Boundary Values
 *-------------- pbv is allocated and initialized in function "cbem_lap_input" (see cbem_lap_input.c) 
 *-----phi-----= Vector containing boundary potentials
 *-------------- phi is allocated and initialized in function "cbem_lap_lrhs" (see cbem_lap_lrhs.c)
 *-----flx-----= Vector containing boundary fluxes
 *-------------- flx is allocated and initialized in function "cbem_lap_lrhs" (see cbem_lap_lrhs.c)
 */
double *pbv;
double *phi, *flx;


/* Boundary Conditions
 *----eltbc----= Array specifying boundary condition at an element: 0 for Dirichlet and 1 for Neumann
 *-------------- eltbc[k] = 0 ==> Dirichlet boundary condition is prescribed on belt[k][0:2]
                 eltbc[k] = 1 ==> Neumann boundary condition is prescribed on belt[k][0:2]
 *-------------- Array eltbc is allocated and initialized in function "cbem_lap_input" (see cbem_lap_input.c)
 */
int *eltbc;


/* Discretized BIE
 *----h-----= Potential influence matrix <==> Coefficient matrix multiplying the vector of boundary potentials
 *----g-----= Flux influence matrix <==> Coefficient matrix multiplying the vector of boundary fluxes
 *----------- Arrays h and g are allocated and initialized in function "cbem_lap_assem" (see cbem_lap_assem.c)

 *---rhs----= Right-hand side of the Discretized BIE
 *----------- Array rhs is allocated and initialized in function "cbem_lap_lrhs" (see cbem_lap_lrhs.c)
 */
double *h, *g;
double *rhs;


/* Surface Geometry
 *--mx_nd_elt--= Maximum number of nodes per element
 *----nbnd-----= Total number of boundary nodes
 *----nbelt----= Total number of boundary elements

 *----belt-----= Array defining boundary element connectivity
 *-------------- belt[k][i] == Global index of the i-th node on the boundary element k, i=0,1,2
 *-------------- Array belt is allocated and initialized in function "cbem_lap_input" (see cbem_lap_input.c)

 *----bnd------= Cartesian coordinates of all boundary nodes
 *-------------- Array bnd is allocated and initialized in function "cbem_lap_input" (see cbem_lap_input.c)

 *----repnd----= Cartesian coordinates of the centroids (representative nodes) of all boundary elements
 *-------------- Array repnd is allocated and initialized in function "cbem_lap_init" (see cbem_lap_init.c)
 */
const int mx_nd_elt=3;
int nbnd, nbelt;
int **belt;
double **bnd;
double **repnd;


void cbem_lap_srf_eval(const char *InfParams,const char *InfData,clock_t tm0); /* Solve the Singular BIE for the Laplace equation */
void cbem_lap_fld_eval(int nip,double **ipts,double *fldvl);       /* Compute the potential at interior points */

#endif /* _CBEM_LAP_GLOBAL_VAR_H_ */
