Bachelor's degree final project  v1.0
Faculty of Mathematics, University of Barcelona
src/include/pic.h
Go to the documentation of this file.
00001 
00010 #ifndef PIC_H
00011 #define PIC_H
00012 
00013 #ifdef DEBUG
00014 #define _PIC_DEBUG
00015 #endif
00016 
00017 #include "newton.h"
00018 
00055 typedef struct pic {
00056   size_t n;
00057   size_t N;
00058   double *x;
00059   double *X;
00060   double **DF;
00061   double w;
00062   short unsigned int autonomous;
00063   void (*f)(size_t, size_t, double * const, double * const, double ** const, double, double);
00064   void * (*solve)(size_t, size_t, double ** const, double * const, double * const, double);
00065 } pic;
00066 
00072 #define PIC_AUTONOMOUS 1
00073 
00078 #define PIC_NAUTONOMOUS 0
00079 
00080 /***********************
00081  * Function prototypes
00082  ***********************/
00083 
00084 /* Get and Set global variables */
00085 unsigned int pic_get_max_iterations();
00086 unsigned int pic_set_max_iterations(unsigned int max_iter);
00087 
00088 size_t pic_get_n(struct pic * const);
00089 size_t pic_get_N(struct pic * const);
00090 double * pic_get_x(struct pic * const);
00091 double * pic_get_X(struct pic * const);
00092 double ** pic_get_DF(struct pic * const);
00093 double pic_get_w(struct pic * const);
00094 
00095 /* Get fields of a pic */
00096 size_t pic_get_mesh_size(struct pic * const);
00097 size_t pic_get_dimension_size(struct pic * const);
00098 
00099 /* Set fields of a pic */
00100 int pic_set_mesh_size(struct pic * const p, size_t N);
00101 int pic_set_dimension_size(struct pic * const p, size_t n);
00102 
00103 int pic_set_function_pointer(struct pic * const p, _FUNCTION_PROTOTYPE);
00104 
00105 int pic_set_function_solve(struct pic * const p, _SOLVE_PROTOTYPE);
00106 
00107 /* Create and initialize values */
00108 struct pic * pic_create(size_t n, size_t N, double w, double * const X, _FUNCTION_PROTOTYPE, _SOLVE_PROTOTYPE);
00109 // struct pic * pic_create(size_t n, size_t N, double w, double * const X, short unsigned int autonomous);
00110 
00111 /* Program execute */
00112 void * pic_execute(struct pic * const p, double tol);
00113 
00114 /* Differential of the process */
00115 double ** pic_differential(struct pic * const p, size_t * const m, size_t * const n);
00116 
00117 /* Load a Fourier serie */
00118 double * pic_load_fourier_coef(size_t n, size_t N, FILE * const f);
00119 double * pic_loadas_fourier_coef(size_t n, size_t N, char * const name);
00120 
00121 /* Save the results */
00122 int pic_save_fourier_coef(struct pic * const p, FILE * const f);
00123 int pic_saveas_fourier_coef(struct pic * const p, char * const name);
00124 
00125 int pic_save_curve(struct pic * const p, FILE * const f);
00126 int pic_saveas_curve(struct pic * const p, char * const name);
00127 
00128 int pic_saveas_differential(struct pic * const p, char * const name);
00129 int pic_save_differential(struct pic * const p, FILE * const f);
00130 
00131 int pic_saveas_differential_indexs(struct pic * const p, char * const name);
00132 int pic_save_differential_indexs(struct pic * const p, FILE * const f);
00133 
00134 /* Free memory */
00135 void pic_destroy(struct pic * const p);
00136 #endif