Changeset 142 for trunk/SRC/ToBeReviewed/MATRICE/colle.pro
- Timestamp:
- 07/21/06 14:47:49 (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SRC/ToBeReviewed/MATRICE/colle.pro
r134 r142 2 2 ; @file_comments 3 3 ; This concatenation function exist in IDL so long 4 ; as we do not try to stick with a dimension superior or equal at 4.4 ; as we do not try to stick with a dimension superior or equal at 4. 5 5 ; 6 6 ; @categories utilities … … 48 48 ; @param a20 {in}{required} 49 49 ; 50 ; @param CAS 1 {in}{required}51 ; table_of_pointer: It is a table of pointers, where each52 ; element point on a table to stick53 ;54 ; For exemple, in a program, we want to stick n table ones with others.55 ;56 ; tab=ptrarr(n,/allocate_heap)57 ; for i=0,n-1 do begin58 ; *tab[n]=replicate(n,2,3)59 ; endfor60 ; res=colle(tab,1)61 ;62 ; @param CAS 2 {in}{required}63 ; we directly give tables to stick64 ; Comment: In this case, the plus we can give is 20 tables.65 ;66 ; BEWARE: whitout the keyword /SAUVE entry arguments are67 ; delete when, we build res. In the first case,we68 ; delete the table of pointers and variables on which we point.69 ;70 ; @param direc {in}{required} The direction on which stick them, 1,2,3...71 ;72 50 ; @keyword SAUVE mot cle qui force a sauvegarder le tableau de 73 51 ; pointeur et les tableaux a coller. … … 98 76 res = -1 99 77 ;------------------------------------------------------------ 100 ; on met en place ptrtab et direc en fonction des arguments en entree78 ; We put in place ptrtab and direc in function of input arguments 101 79 ;------------------------------------------------------------ 102 80 case 1 of 103 n_params() EQ 2:BEGIN ; cas ou l'on donne directement le tableau de pointeurs81 n_params() EQ 2:BEGIN ; case where we directly give the pointer array 104 82 ptrtab = a0 105 83 direc = a1 106 84 if NOT keyword_set(sauve) then undefine, a0 107 ; on recuper e le nombre de tableaux a coller85 ; on recuperate the number of array to be pasted. 108 86 nbretab = (size(ptrtab))[1] 109 87 end 110 88 n_params() GT 2:BEGIN 111 ; on recuper e le nombre de tableaux a coller89 ; on recuperate the number of array to be pasted. 112 90 nbretab = n_params()-1 113 91 bidon = execute('direc = a'+strtrim(n_params()-1, 2)) 114 ; on ecrit le tableau de pointeur dont chaque element pointe sur un tableau92 ; We write the pointer array whose each element point on an array. 115 93 ptrtab=ptrarr(nbretab,/allocate_heap) 116 94 for n = 0,nbretab-1 do begin … … 123 101 endcase 124 102 ;------------------------------------------------------------ 125 ; case sur la valeure de direc103 ; case on the direct's value. 126 104 ;------------------------------------------------------------ 127 105 case direc of 128 1:BEGIN ; on colle suivant ladimension 1106 1:BEGIN ; we paste following the dimension 1 129 107 res = *ptrtab[0] 130 108 if NOT keyword_set(sauve) then ptr_free, ptrtab[0] … … 134 112 ENDFOR 135 113 END 136 2:BEGIN ; on colle suivant ladimension 2114 2:BEGIN ; we paste following the dimension 2 137 115 res = *ptrtab[0] 138 116 if NOT keyword_set(sauve) then ptr_free, ptrtab[0] … … 142 120 ENDFOR 143 121 END 144 3:BEGIN ; on colle suivant ladimension 3122 3:BEGIN ; we paste following the dimension 3 145 123 res = *ptrtab[0] 146 124 if NOT keyword_set(sauve) then ptr_free, ptrtab[0] … … 151 129 END 152 130 ELSE:BEGIN 153 ; on transpose res de facon a mettre la dimension a coller numero 1.154 ; pour cela on contient le vecteur permute qui donne la place que155 ; doivent prendre les dimensions ds la matrice transposee131 ; We transpose res in order to put the dimension to be pasted number 1 132 ; To this, we contain the permuter vector which give the place that dimension 133 ; in the transposed matrix must take. 156 134 siz = (size(*ptrtab[0]))[0] 157 135 if siz LT direc then $ … … 162 140 res = transpose(*ptrtab[0], permute) 163 141 if NOT keyword_set(sauve) then ptr_free, ptrtab[0] 164 FOR n = 1,nbretab-1 DO BEGIN ; on colle suivant la dimension 1142 FOR n = 1,nbretab-1 DO BEGIN ; we paste following the dimension 1on colle suivant la dimension 1 165 143 if (size(*ptrtab[n]))[0] LT direc then $ 166 144 *ptrtab[n] = reform(*ptrtab[n], [(size(*ptrtab[n]))[1:siz], replicate(1, direc-siz)])
Note: See TracChangeset
for help on using the changeset viewer.