Ejemplo n.º 1
0
int main(void)
{
  NumericsOptions NO;
  setDefaultNumericsOptions(&NO);
  NO.verboseMode = 1; // turn verbose mode to off by default

  int total_info = 0;

  double q[] = { -1, 1, 3, -1, 1, 3, -1, 1, 3};
  double mu[] = {0.1, 0.1, 0.1};

  double Wdata[81] = {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1};

  NumericsMatrix* tmpM = createNumericsMatrixFromData(NM_DENSE, 9, 9, Wdata);
  NumericsMatrix* W = createNumericsMatrix(NM_SPARSE, 9, 9);
  NM_copy_to_sparse(tmpM, W);

  int solvers_to_test[] = {SICONOS_FRICTION_3D_NSGS,
                           SICONOS_FRICTION_3D_NSN_AC,
                           SICONOS_FRICTION_3D_NSN_FB,
                           SICONOS_FRICTION_3D_NSN_NM,
                           SICONOS_FRICTION_3D_SOCLCP,
                           SICONOS_FRICTION_3D_PROX};

  for (size_t s = 0; s < sizeof(solvers_to_test); ++s)
  {
    int solver_id = solvers_to_test[s];

    FrictionContactProblem* FC = frictionContactProblem_new(3, 3, W, q, mu);
    double r[9] = {0.};
    double u[9] = {0.};

    SolverOptions SO;;
    fc3d_setDefaultSolverOptions(&SO, solver_id);
    int info = fc3d_driver(FC, r, u, &SO, &NO);

    if (info)
    {
      fprintf(stderr, "Solver %s failed with error %d\n", idToName(solver_id), info);
      total_info = 1;
    }
    FC->M = NULL;
    FC->q = NULL;
    FC->mu = NULL;
    deleteSolverOptions(&SO);
    freeFrictionContactProblem(FC);
    free(FC);
  }

  freeNumericsMatrix(W);
  tmpM->matrix0 = NULL;
  freeNumericsMatrix(tmpM);
  free(W);
  free(tmpM);

  return total_info;
}
Ejemplo n.º 2
0
int main(void)
{
  int info = 0 ;

  char filename[50] = "./data/Confeti-ex13-Fc3D-SBM.dat";
  printf("Test on %s\n", filename);

  FILE * finput  =  fopen(filename, "r");
  SolverOptions * options = (SolverOptions *) malloc(sizeof(SolverOptions));
  info = fc3d_setDefaultSolverOptions(options, SICONOS_FRICTION_3D_EG);
  options->dparam[3] = -3e3; // optimal guessed value
  options->dparam[0] = 1e-8; //

  info = frictionContact_test_function(finput, options);

  deleteSolverOptions(options);
  free(options);
  fclose(finput);
  printf("\nEnd of test on %s\n", filename);
  return info;
}
Ejemplo n.º 3
0
int main(void)
{
  int info = 0 ;
  printf("Test on ./data/Example1_Fc3D_SBM.dat\n");

  FILE * finput  =  fopen("./data/Example1_Fc3D_SBM.dat", "r");
  SolverOptions * options = (SolverOptions *) malloc(sizeof(SolverOptions));
  info = fc3d_setDefaultSolverOptions(options, SICONOS_FRICTION_3D_NSGS);
  options->dparam[0] = 1e-16;
  options->internalSolvers->solverId = SICONOS_FRICTION_3D_ONECONTACT_ProjectionOnCone;
  options->internalSolvers->iparam[0] = 0;
  options->internalSolvers->dparam[0] = 0.0;

  info = frictionContact_test_function(finput, options);

  deleteSolverOptions(options);
  free(options);
  fclose(finput);
  printf("\nEnd of test on ./data/Example1_Fc3D_SBM.dat\n");
  return info;
}
Ejemplo n.º 4
0
int main(void)
{
  int info = 0 ;

  char filename[50] = "./data/BoxesStack1-i100000-32.hdf5.dat";
  printf("Test on %s\n", filename);

  FILE * finput  =  fopen(filename, "r");
  SolverOptions * options = (SolverOptions *) malloc(sizeof(SolverOptions));
  info = fc3d_setDefaultSolverOptions(options, SICONOS_FRICTION_3D_FPP);
  options->dparam[0] = 1e-8; //
  options->iparam[0] = 100000; //

  info = frictionContact_test_function(finput, options);

  deleteSolverOptions(options);
  free(options);
  fclose(finput);
  printf("\nEnd of test on %s\n", filename);
  return info;
}
int main(void)
{
  printf("\n Start of test on Default SolverOptions\n");
  int info = 0 ;
  SolverOptions * options = (SolverOptions *)malloc(sizeof(SolverOptions));



  info = fc3d_setDefaultSolverOptions(options, SICONOS_FRICTION_3D_NSGS);
  solver_options_print(options);
  solver_options_delete(options);

  info = fc3d_setDefaultSolverOptions(options, SICONOS_FRICTION_3D_NSGSV);
  solver_options_print(options);
  solver_options_delete(options);

  info = fc3d_setDefaultSolverOptions(options, SICONOS_FRICTION_3D_PROX);
  solver_options_print(options);
  solver_options_delete(options);

  info = fc3d_setDefaultSolverOptions(options, SICONOS_FRICTION_3D_TFP);
  solver_options_print(options);
  solver_options_delete(options);

  info = fc3d_setDefaultSolverOptions(options, SICONOS_FRICTION_3D_DSFP);
  solver_options_print(options);
  solver_options_delete(options);

  info = fc3d_setDefaultSolverOptions(options, SICONOS_FRICTION_3D_EG);
  solver_options_print(options);
  solver_options_delete(options);

  info = fc3d_setDefaultSolverOptions(options, SICONOS_FRICTION_3D_HP);
  solver_options_print(options);
  solver_options_delete(options);

  free(options);

  printf("\n End of test on Default SolverOptions\n");
  return info;
}
Ejemplo n.º 6
0
int main(void)
{
    int info = 0 ;

    char filename[50] = "./data/Confeti-ex13-4contact-Fc3D-SBM.dat";
    printf("Test on %s\n", filename);

    FILE * finput  =  fopen(filename, "r");
    SolverOptions * options = (SolverOptions *) malloc(sizeof(SolverOptions));
    info = fc3d_setDefaultSolverOptions(options, SICONOS_FRICTION_3D_NSGS);
    options->dparam[0] = 1e-12;
    options->iparam[0] = 10000;
    options->internalSolvers->solverId = SICONOS_FRICTION_3D_ONECONTACT_ProjectionOnConeWithRegularization;
    options->internalSolvers->iparam[0] = 10;
    options->internalSolvers->dparam[0] = 1e-8;

    info = frictionContact_test_function(finput, options);

    deleteSolverOptions(options);
    free(options);
    fclose(finput);
    printf("\nEnd of test on %s\n", filename);
    return info;
}