#include "machine.h"#include <string.h>Include dependency graph for BasicAlgos.h:

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.
Functions | |
| double | sciFindStPosMin (double x[], int n) |
| void | MaxiInd (double vect[], integer n, integer *ind, double maxi) |
| int C2F() | entier2d (integer *n, double *dx, integer *s) |
| int | checkMonotony (double vector[], int nbElement) |
| void | doubleArrayCopy (double dest[], const double src[], int nbElement) |
| void | intArrayCopy (int dest[], const int src[], int nbElement) |
| void | stringArrayCopy (char *dest[], char *src[], int nbElement) |
| void | setDoubleArraySingleValue (double dest[], double value, int nbElement) |
| double * | createNewArrayFromSource (int destSize, const double src[], int srcSize) |
| void | destroyStringArray (char *src[], int nbStrings) |
| double * | createDoubleArrayCopy (const double src[], int nbElement) |
| int * | createIntArrayCopy (const int src[], int nbElement) |
| char ** | createStringArrayCopy (char *src[], int nbElement) |
check the strict monotony of a vector
| nbElement | must be greater than 2. |
Definition at line 61 of file BasicAlgos.c.
References i.
Referenced by Objplot3d(), and set3ddata().
00062 { 00063 int i ; 00064 if( vector[1] >= vector[0] ) 00065 { 00066 /* might be incresing */ 00067 for ( i = 1 ; i < nbElement - 1 ; i++ ) 00068 { 00069 if ( vector[i+1] < vector[i] ) 00070 { 00071 /* not increasing */ 00072 return 0 ; 00073 } 00074 } 00075 return 1 ; 00076 } 00077 else 00078 { 00079 /* might be decreasing */ 00080 for ( i = 1 ; i < nbElement - 1 ; i++ ) 00081 { 00082 if ( vector[i+1] > vector[i] ) 00083 { 00084 /* not decreasing */ 00085 return 0 ; 00086 } 00087 } 00088 return -1 ; 00089 00090 } 00091 return 0 ; 00092 00093 }
Here is the caller graph for this function:

| double* createDoubleArrayCopy | ( | const double | src[], | |
| int | nbElement | |||
| ) |
allocate a copy of a double array
Definition at line 169 of file BasicAlgos.c.
References MALLOC, memcpy(), NULL, and res.
Referenced by drawGrayplotEntity(), and drawSegsEntity().
00170 { 00171 double * res = MALLOC( nbElement * sizeof(double) ) ; 00172 00173 if ( res == NULL ) 00174 { 00175 return NULL ; 00176 } 00177 00178 memcpy( res, src, nbElement * sizeof(double) ) ; 00179 00180 return res ; 00181 }
Here is the call graph for this function:

Here is the caller graph for this function:

allocate a copy of a int array.
Definition at line 183 of file BasicAlgos.c.
References MALLOC, memcpy(), NULL, and res.
Referenced by set_user_data_property().
00184 { 00185 int * res = MALLOC( nbElement * sizeof(int) ) ; 00186 00187 if ( res == NULL ) 00188 { 00189 return NULL ; 00190 } 00191 00192 memcpy( res, src, nbElement * sizeof(int) ) ; 00193 00194 return res ; 00195 }
Here is the call graph for this function:

Here is the caller graph for this function:

create a new array which is kind of copy of another the elements are copied beginning with the first if the array is longer than the other, then the last values are set to 0.0
| destSize | the wanted size for the new array |
Definition at line 134 of file BasicAlgos.c.
References i, MALLOC, memcpy(), Min, and NULL.
Referenced by CheckAndUpdate_x_shift(), CheckAndUpdate_y_shift(), and CheckAndUpdate_z_shift().
00135 { 00136 int i ; 00137 int endCopy = Min( destSize, srcSize ) ; 00138 /* create new array */ 00139 double * dest = MALLOC( destSize * sizeof(double) ) ; 00140 00141 if ( dest == NULL ) 00142 { 00143 return NULL ; 00144 } 00145 00146 /* copy the element which needs to be copied */ 00147 memcpy( dest, src, endCopy * sizeof( double ) ) ; 00148 00149 for ( i = endCopy ; i < destSize ; i++ ) 00150 { 00151 dest[i] = 0.0 ; 00152 } 00153 00154 return dest ; 00155 00156 }
Here is the call graph for this function:

Here is the caller graph for this function:

| char** createStringArrayCopy | ( | char * | src[], | |
| int | nbElement | |||
| ) |
allocate a copy of a string array
Definition at line 197 of file BasicAlgos.c.
References i, MALLOC, NULL, res, and stringArrayCopy().
Referenced by createCopyStringMatrixFromList().
00198 { 00199 int i ; 00200 char ** res = MALLOC( nbElement * sizeof(char *) ) ; 00201 00202 if ( res == NULL ) 00203 { 00204 return NULL ; 00205 } 00206 00207 for ( i = 0 ; i < nbElement; i++ ) 00208 { 00209 res[i] = NULL ; 00210 } 00211 00212 stringArrayCopy( res, src, nbElement ) ; 00213 00214 return res ; 00215 00216 }
Here is the call graph for this function:

Here is the caller graph for this function:

| void destroyStringArray | ( | char * | src[], | |
| int | nbStrings | |||
| ) |
free an array of strings
Definition at line 158 of file BasicAlgos.c.
Referenced by get_x_ticks_property(), get_y_ticks_property(), get_z_ticks_property(), set_tics_labels_property(), set_x_ticks_property(), set_xtics_coord_property(), set_y_ticks_property(), set_ytics_coord_property(), set_z_ticks_property(), and stringArrayCopy().
00159 { 00160 int i ; 00161 for ( i = 0 ; i < nbStrings ; i++ ) 00162 { 00163 FREE( src[i] ) ; 00164 src[i] = NULL ; 00165 } 00166 FREE( src ) ; 00167 }
Here is the caller graph for this function:

| void doubleArrayCopy | ( | double | dest[], | |
| const double | src[], | |||
| int | nbElement | |||
| ) |
copy an array into an other
Definition at line 95 of file BasicAlgos.c.
References memcpy().
Referenced by copyDoubleVectorFromStack(), createCopyDoubleMatrixFromList(), set3ddata(), set_cdata_mapping_property(), set_color_flag_property(), and set_color_mode_property().
00096 { 00097 memcpy( dest, src, nbElement * sizeof(double) ) ; 00098 }
Here is the call graph for this function:

Here is the caller graph for this function:

convertion d'entier vers double d et s peuvent en fait pointer sur le meme tableau car la recopie est fait de n,1,-1 implicit undefined (a-z)
Definition at line 54 of file BasicAlgos.c.
00055 { 00056 integer ix; 00057 for (ix = *n -1 ; ix >= 0; --ix) { dx[ix] = (double) s[ix]; } 00058 return 0; 00059 }
copy an int array into an other
Definition at line 100 of file BasicAlgos.c.
References memcpy().
Referenced by set_user_data_property().
00101 { 00102 memcpy( dest, src, nbElement * sizeof(int) ) ; 00103 }
Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 38 of file BasicAlgos.c.
References i.
Referenced by Convex_Box(), and sciAxesVerticesIndices().
00039 { 00040 integer i ; 00041 if ( *ind+1 < n ) 00042 { 00043 for ( i = *ind+1 ; i < n ; i++ ) 00044 { 00045 if ( vect[i] >= maxi) 00046 { 00047 *ind=i; 00048 return ; 00049 } 00050 } 00051 } 00052 }
Here is the caller graph for this function:

| double sciFindStPosMin | ( | double | x[], | |
| int | n | |||
| ) |
Find the striclty positive minimum value of an array of double.
| [in] | x | array of size n. |
Definition at line 14 of file BasicAlgos.c.
Referenced by compute_data_bounds2(), and sci_plot2d().
00015 { 00016 double min ; 00017 int i ; 00018 00019 if ( n <= 0 ) 00020 { 00021 return -1.0 ; 00022 } 00023 00024 min = x[0] ; 00025 00026 for ( i = 1 ; i < n ; i++ ) 00027 { 00028 if ( x[i] > 0.0 && x[i] < min ) 00029 { 00030 min = x[i] ; 00031 } 00032 } 00033 00034 /* if we have found at least one positive value in x, min strictly positive */ 00035 return min ; 00036 }
Here is the caller graph for this function:

| void setDoubleArraySingleValue | ( | double | dest[], | |
| double | value, | |||
| int | nbElement | |||
| ) |
set each element of an array to a certain value
Definition at line 125 of file BasicAlgos.c.
References i.
00126 { 00127 int i ; 00128 for ( i = 0 ; i < nbElement ; i++ ) 00129 { 00130 dest[i] = value ; 00131 } 00132 }
| void stringArrayCopy | ( | char * | dest[], | |
| char * | src[], | |||
| int | nbElement | |||
| ) |
copy a char * array into an other
Definition at line 105 of file BasicAlgos.c.
References destroyStringArray(), FREE, i, MALLOC, and NULL.
Referenced by createStringArrayCopy().
00106 { 00107 int i ; 00108 for ( i = 0 ; i < nbElement ; i++ ) 00109 { 00110 int elemSize = strlen( src[i] ) + 1 ; 00111 FREE( dest[i] ) ; 00112 00113 dest[i] = MALLOC( elemSize * sizeof(char) ) ; 00114 00115 if ( dest[i] == NULL ) 00116 { 00117 destroyStringArray( dest, nbElement ) ; 00118 return ; 00119 } 00120 00121 strcpy( dest[i], src[i] ) ; 00122 } 00123 }
Here is the call graph for this function:

Here is the caller graph for this function:

1.5.1