mbs_part.h 3.45 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14

#ifndef PART_h
#define PART_h

#include "mbs_data.h"
#include "MBSfun.h"

 /**
  * Structure defining the options of the coordinate
  * partitioning module
  *
  */
typedef struct MbsPartOptions
{
15
    int rowperm;       //!< 1 to allow line permutation; 0 otherwise, defaut = 0
16 17
    int visualise;     //!< In case of loop closure failing, set to 1 to plot the
                       //!< closing procedure iteration, default = 0.
18
    int drivers; // no = 0, yes = 1, defaut = 0
19
    int verbose;       //!< 1 to get print indications related partitioning module; 0 otherwise, defaut = 1
20
    int clearmbsglobal; // inout = 1, out = 2, none = 3, all = 4, defaut = 1
21 22
    double random_amplitude; //!< Amplitude of the random troubleshoot added to the initial value of generalized coordinates.
                             //!< This randomized value are only used to determine the rank of the Jacobian matrix, default = 1e-2.
23 24 25 26 27 28 29 30 31 32 33 34 35

} MbsPartOptions;


 /**
  * Main structure for the coordinate partitioning module.
  * This structure is allocated by the user and must be
  * passed to the mbs_run_part function.
  *
  */

typedef struct MbsPart
{
36
    MbsPartOptions *options; //!< Structure containing the options for coordinate partitioning module
37

38 39
    int n_qu;       //!< Number of independent variable needed
    int *ind_qu;    //!< Array with the indices of best choice for independent variables
40

41 42
    int n_qv;       //!< Number of dependent variable needed
    int *ind_qv;    //!< Array with the indices of best choice and order for dependent variables
43

44 45
    int n_hu;       //!< Number of independent constraint
    int *ind_hu;    //!< Array with the indices of best choice for independent constraints
46

47 48
    int n_hv;       //!< Number of redundant constraint
    int *ind_hv;    //!< Array with the indices of best choice for redundant constraints
49

50
    double *q_closed; //!< Array with the generalized coordinate in closed configuration (constraints solved)
51 52 53 54 55 56 57 58 59 60 61 62

} MbsPart;



#ifdef __cplusplus
extern "C" {
#endif
 /**
  * \brief Main function of the coordinate partitioning module.
  * It compute the coordinate partitioning for the given
  * MbsData structure.
63
  *
64 65 66 67 68
  * @param mbs_part the coord. part. structure
  * @param mbs_data the structure of the mbs for which the coord.
  *       part. must be performed
  *
  */
69
 void mbs_run_part(MbsPart*  mbs_part, MbsData* mbs_data);
70

71
 /**
72 73
  * \brief Allocate a new MbsPart structure for the given MbsData structure.
  * A new MbsPartOptions is also allocated and a pointer
Olivier Lantsoght's avatar
Olivier Lantsoght committed
74 75
  * to this structure is kept from the new MbsPart.
  *
76 77 78 79 80 81 82
  * \param mbs_data the structure of the mbs for which the coordinate part. will be performed.
  */
MbsPart* mbs_new_part(MbsData* mbs_data);

 /**
  * \brief Free the memory of the given MbsPart structure.
  * The memory of the associated options (mbs_part->options)
Olivier Lantsoght's avatar
Olivier Lantsoght committed
83 84
  * is also freed.
  *
85 86 87 88 89 90 91 92 93 94 95
  * \param mbs_part the structure to be freed.
  */
void mbs_delete_part(MbsPart* mbs_part);

 /**
  * \brief Allocate a new MbsPartOptions structure and intialize
  options with default values.
  */
MbsPartOptions* mbs_new_part_options(void);

 /**
Olivier Lantsoght's avatar
Olivier Lantsoght committed
96 97 98
  * \brief Free the memory of the given MbsPartOptions structure.
  * This function will be called by mbs_delete_part() and should never be called by the user.
  *
99 100 101 102 103 104 105 106 107 108 109 110 111 112
  * \param part_option_strct the structure to be freed.
  */
void mbs_delete_part_options(MbsPartOptions* part_option_strct);


/**
 * Utility function
 */
#ifdef __cplusplus
}
#endif
//void PART_get_options_from_user(MbsPartOptions *options);

#endif