-
FELŠÖCI Marek authoredFELŠÖCI Marek authored
main.c 4.08 KiB
#define ___TEST_FEMBEM___ 1
#include "main.h"
// instantiation of globales defined in main.h
int nbRHS = 1;
int sparseRHS;
int nbPts = 16000;
void *rhs = NULL;
void *solFMMfar = NULL;
void *solCLAfar = NULL;
void *solFMMnear = NULL;
void *solCLAnear = NULL;
int nbPtsPerLeaf = 50;
int nbAlgoRuns = 1;
char *sTYPE_ELEMENT_ARRAY_test_fembem[] = {NULL};
int coupled = 0;
int simplePrec = 0;
int complexALGO = 1;
ScalarType stype = DOUBLE_COMPLEX;
double lambda;
int hmat_residual = 0;
int hmat_refine = 0;
int use_hmat_shuffle = 0;
int divider_min = 2;
int divider_max = 4;
int use_hodlr = 0;
size_t nnz_FEM = 0;
ZnonZero *z_matComp_FEM = NULL;
size_t *ptr_ordered_FEM = NULL;
/*! \brief Main routine
\return 0 for success
*/
int main(int argc, char **argv) {
int ierr ;
double step, max_error = DBL_MAX;
MpfArgGetDouble(&argc, argv, 1, "--max-error", &max_error);
if (MpfArgHasName(&argc, argv, 1, "-h") || MpfArgHasName(&argc, argv, 1, "--help") ) {
ierr=printHelp() ;
return ierr;
}
/* ------------------------------------------------------------------------- */
/* ---------------------- INITIATION DE MPF (PARALLELE) -------------------*/
/* ------------------------------------------------------------------------- */
ierr=SCAB_Init(&argc, &argv) ; CHKERRQ(ierr) ;
ierr=readFlagsTestHMAT(&argc, &argv) ; CHKERRQ(ierr) ;
ierr = init_hmat_interface(); CHKERRQ(ierr);
/* ------------------------------------------------------------------------- */
/* --------------------- DECODAGE DE LA LIGNE D'OPTIONS -------------------*/
/* ------------------------------------------------------------------------- */
double nbf;
if (MpfArgGetDouble(&argc, argv, 1, "-nbpts", &nbf)) {
if (nbf<0 || nbf>INT_MAX)
SETERRQ(1, "Incorrect value '-nbpts %.0f' (must be between 0 and %d)", nbf, INT_MAX);
nbPts = (int)nbf;
printf("Reading nbPts = %d\n", nbPts) ;
}
ierr=initCylinder(&argc, &argv) ; CHKERRQ(ierr) ;
if (MpfArgGetInt(&argc, argv, 1, "-nbrhs", &nbRHS)) {
printf("Reading nbRHS = %d\n", nbRHS) ;
}
/* Wavelength */
ierr = getMeshStep(&step) ;
lambda = 10.*step ;
printf(" Setting lambda = %f (with 10 points per wavelength)\n", lambda) ;
/* --- Choix de l'arithmetique de calcul (default is '-z') --- */
if (MpfArgHasName(&argc, argv, 1, "-s") > 0) {
simplePrec = 1 ;
stype=SIMPLE_PRECISION ; /* For the fmm, it will be changed below depending on the FMM algo selected */
complexALGO=0;
printf("Simple Precision\n");
}
if (MpfArgHasName(&argc, argv, 1, "-d") > 0) {
simplePrec = 0 ;
stype=DOUBLE_PRECISION ; /* For the fmm, it will be changed below depending on the FMM algo selected */
complexALGO=0;
printf("Double Precision\n");
}
if (MpfArgHasName(&argc, argv, 1, "-c") > 0) {
simplePrec = 1 ;
stype=SIMPLE_COMPLEX ; /* For the fmm, it will be changed below depending on the FMM algo selected */
complexALGO=1;
printf("Simple Complex\n");
}
if (MpfArgHasName(&argc, argv, 1, "-z") > 0) {
simplePrec = 0 ;
stype=DOUBLE_COMPLEX ; /* For the fmm, it will be changed below depending on the FMM algo selected */
complexALGO=1;
printf("Double Complex\n");
}
/* Setting remaining variables */
sparseRHS=(double)nbPts/80./log10((double)nbPts) ;
if (sparseRHS<1) sparseRHS = 1;
printf("Setting sparseRHS = %d\n", sparseRHS) ;
printf("<PERFTESTS> TEST_FEMBEM_Version = %s\n" , PACKAGE_VERSION);
#ifdef HAVE_HMAT
printf("<PERFTESTS> HMAT_Version = %s\n" , hmat_get_version() );
#endif
printf("<PERFTESTS> ScalarType = %s\n" , MPF_scalName[stype]);
/* Prepare the mesh and RHS used for the FMM/HMAT tests */
ierr = prepareTEST() ; CHKERRQ(ierr) ;
double relative_error;
/* Run the test */
ierr = testHMAT(&relative_error) ; CHKERRQ(ierr) ;
int error_exit = 0;
if(relative_error > max_error) {
error_exit = 1;
printf("Error is too high (%g > %g), exiting with error.", relative_error, max_error);
}
printf("\ntest_FEMBEM : end of computation\n");
if (rhs) {
MpfFree(rhs);
rhs = NULL;
}
ierr=SCAB_Exit(&argc, argv); CHKERRQ(ierr);
return error_exit;
}