Program listing for file numerics/src/tools/SolverOptions.h#

  1#ifndef SolverOptions_H
  2#define SolverOptions_H
  3
  4
  5#include "NumericsFwd.h"
  6#include "SiconosConfig.h"
  7
  8#include <stdbool.h>
  9#include <stdio.h>
 10
 11
 12typedef struct {
 13  void *env;
 14  void (*collectStatsIteration)(
 15      void *env, int size, double *reaction, double *velocity, double error,
 16      void *extra_data);
 17} Callback;
 18
 19
 20#define OPTIONS_PARAM_SIZE 30
 21
 22
 23struct SolverOptions {
 24  int solverId;
 25  bool isSet;
 26  int iSize;
 27  int *iparam;
 28  int dSize;
 29  double *dparam;
 30  bool filterOn;
 31  size_t dWorkSize;
 32  double *dWork;
 33  size_t iWorkSize;
 34  int *iWork;
 35  size_t numberOfInternalSolvers;
 36  struct SolverOptions **internalSolvers;
 37  Callback *callback;
 38  void *solverParameters;
 39  void *solverData;
 40};
 41
 42
 43enum SICONOS_IPARAM {
 44  SICONOS_IPARAM_MAX_ITER = 0,
 45  SICONOS_IPARAM_ITER_DONE = 1,
 46  SICONOS_IPARAM_PREALLOC = 2,
 47  SICONOS_IPARAM_NSGS_SHUFFLE = 5,
 48  SICONOS_IPARAM_ERROR_EVALUATION =
 49      3,
 50  SICONOS_IPARAM_PATHSEARCH_STACKSIZE = 19
 51};
 52
 53
 54enum SICONOS_IPARAM_ERROR_EVALUATION_ENUM {
 55
 56  SICONOS_ERROR_FULL_EVALUATION = 0,
 57
 58  SICONOS_ERROR_LIGHT_EVALUATION = 1,
 59
 60  SICONOS_ERROR_LIGHT_EVALUATION_NO_UPDATE = 2
 61};
 62
 63
 64enum SICONOS_DPARAM {
 65  SICONOS_DPARAM_TOL = 0,
 66  SICONOS_DPARAM_RESIDU = 1,
 67};
 68
 69#if defined(__cplusplus) && !defined(BUILD_AS_CPP)
 70extern "C" {
 71#endif
 72
 73
 74void solver_options_print(SolverOptions *options);
 75
 76
 77void solver_options_delete(SolverOptions *options);
 78
 79
 80SolverOptions *solver_options_create(int solverId);
 81
 82
 83SolverOptions *solver_options_copy(SolverOptions *source);
 84
 85
 86void solver_options_update_internal(SolverOptions *parent,
 87                                    size_t internal_solver_number,
 88                                    int solver_id);
 89
 90
 91int solver_options_name_to_id(const char *pName);
 92
 93
 94const char *solver_options_id_to_name(int Id);
 95
 96
 97SolverOptions *solver_options_get_internal_solver(SolverOptions *options,
 98                                                  size_t n);
 99
100
101void solver_options_set_internal_solver(SolverOptions *options, size_t n,
102                                        SolverOptions *NSO);
103
104#if defined(__cplusplus) && !defined(BUILD_AS_CPP)
105}
106#endif
107
108#endif