| [2615] | 1 | #include "sopnamsp.h"
 | 
|---|
| [1315] | 2 | #include "machdefs.h"
 | 
|---|
 | 3 | #include <stdlib.h>
 | 
|---|
 | 4 | #include <typeinfo>
 | 
|---|
| [2322] | 5 | #include <iostream>
 | 
|---|
| [1315] | 6 | #include <string>
 | 
|---|
 | 7 | #include <complex>
 | 
|---|
 | 8 | 
 | 
|---|
 | 9 | #include "datatype.h"
 | 
|---|
 | 10 | 
 | 
|---|
 | 11 | #include "nomtarradapter.h"
 | 
|---|
| [1321] | 12 | #include "tvector.h"
 | 
|---|
 | 13 | #include "pitvmaad.h"
 | 
|---|
| [1905] | 14 | #include "piyfxdrw.h"
 | 
|---|
| [1315] | 15 | 
 | 
|---|
 | 16 | #include "fioarr.h"
 | 
|---|
 | 17 | 
 | 
|---|
| [2999] | 18 | #include "nobjmgr.h"
 | 
|---|
| [1315] | 19 | 
 | 
|---|
 | 20 | 
 | 
|---|
 | 21 | //----------------------------------------------------------------
 | 
|---|
 | 22 | // Class Adaptateur d'objet (Pour NamedObjMgr) d'objet TMatrix<T> 
 | 
|---|
 | 23 | //----------------------------------------------------------------
 | 
|---|
 | 24 | 
 | 
|---|
 | 25 | 
 | 
|---|
 | 26 | /* --Methode-- */
 | 
|---|
 | 27 | template <class T> 
 | 
|---|
 | 28 | NOMAdapter_TArray<T>::NOMAdapter_TArray(TArray<T>* o)
 | 
|---|
 | 29 |   : NObjMgrAdapter(o)
 | 
|---|
 | 30 | {
 | 
|---|
 | 31 | mArr = o;
 | 
|---|
 | 32 | }
 | 
|---|
 | 33 | 
 | 
|---|
 | 34 | /* --Methode-- */
 | 
|---|
 | 35 | template <class T> 
 | 
|---|
 | 36 | NOMAdapter_TArray<T>::~NOMAdapter_TArray()
 | 
|---|
 | 37 | {
 | 
|---|
 | 38 | }
 | 
|---|
 | 39 | 
 | 
|---|
 | 40 | /* --Methode-- */
 | 
|---|
 | 41 | template <class T> 
 | 
|---|
 | 42 | NObjMgrAdapter* NOMAdapter_TArray<T>::Clone(AnyDataObj* o)
 | 
|---|
 | 43 | {
 | 
|---|
 | 44 | TArray<T>* a = dynamic_cast<TArray<T> *>(o);
 | 
|---|
 | 45 | if (a) return ( new NOMAdapter_TArray<T>(a) );
 | 
|---|
 | 46 | return ( new NObjMgrAdapter(o) );
 | 
|---|
 | 47 | }
 | 
|---|
 | 48 | 
 | 
|---|
 | 49 | /* --Methode-- */
 | 
|---|
 | 50 | template <class T> 
 | 
|---|
 | 51 | string NOMAdapter_TArray<T>::GetDataObjType()
 | 
|---|
 | 52 | {
 | 
|---|
 | 53 | string type = "TArray< ";
 | 
|---|
 | 54 | 
 | 
|---|
 | 55 | // type +=  DecodeTypeIdName(typeid(T).name());
 | 
|---|
 | 56 | type += DataTypeInfo<T>::getTypeName();
 | 
|---|
 | 57 | type +=  " > ";
 | 
|---|
 | 58 | return(type);
 | 
|---|
 | 59 | }
 | 
|---|
 | 60 | 
 | 
|---|
 | 61 | /* --Methode-- */
 | 
|---|
 | 62 | template <class T> 
 | 
|---|
 | 63 | AnyDataObj* NOMAdapter_TArray<T>::CloneDataObj(bool share)
 | 
|---|
 | 64 | {
 | 
|---|
 | 65 | return ( new TArray<T>(*mArr, share) );
 | 
|---|
 | 66 | }
 | 
|---|
 | 67 | 
 | 
|---|
| [2999] | 68 | /* --Methode-- */
 | 
|---|
 | 69 | template <class T> 
 | 
|---|
 | 70 | string NOMAdapter_TArray<T>::GetInfoString(vector<string>& opts)
 | 
|---|
 | 71 | {
 | 
|---|
 | 72 |   if (opts.size() == 0) return mArr->InfoString();
 | 
|---|
 | 73 |   else {
 | 
|---|
 | 74 |     char buff[128];
 | 
|---|
 | 75 |     if (opts[0] == "rank") {
 | 
|---|
 | 76 |       sprintf(buff,"%d", (int)mArr->Rank());
 | 
|---|
 | 77 |       return string(buff);      
 | 
|---|
 | 78 |     }
 | 
|---|
 | 79 |     if (opts[0] == "sizes") {
 | 
|---|
| [3033] | 80 |       string rs;
 | 
|---|
 | 81 |       for(int_4 kd=0; kd<mArr->Rank(); kd++) {
 | 
|---|
 | 82 |         sprintf(buff, "%ld ", (long)mArr->Size(kd)); 
 | 
|---|
 | 83 |         rs += buff;
 | 
|---|
 | 84 |       }
 | 
|---|
 | 85 |       return rs;      
 | 
|---|
| [2999] | 86 |     }
 | 
|---|
 | 87 |     else if ((opts[0] == "size") || (opts[0] == "nelts")) {
 | 
|---|
 | 88 |       sprintf(buff, "%ld", (long)mArr->Size()); 
 | 
|---|
 | 89 |       return string(buff);
 | 
|---|
 | 90 |     }
 | 
|---|
 | 91 |     else if (opts[0] == "sum") {
 | 
|---|
 | 92 |       MuTyV mtv(mArr->Sum());
 | 
|---|
 | 93 |       string s;
 | 
|---|
 | 94 |       return mtv.Convert(s);
 | 
|---|
 | 95 |     }
 | 
|---|
| [3039] | 96 |     else return "TArray.Att: rank sizes size/nelts sum";
 | 
|---|
| [2999] | 97 |   }
 | 
|---|
 | 98 | }
 | 
|---|
| [1321] | 99 | 
 | 
|---|
 | 100 | /* --Methode-- */
 | 
|---|
 | 101 | template <class T> 
 | 
|---|
| [2999] | 102 | int NOMAdapter_TArray<T>::PerformOperation(vector<string>& opts)
 | 
|---|
 | 103 | {
 | 
|---|
 | 104 |   bool ok = false;
 | 
|---|
 | 105 |   if ((mArr->Rank() >= 3) && (opts.size() >= 2)) {
 | 
|---|
 | 106 |     int_4 ks = atoi(opts[1].c_str());
 | 
|---|
 | 107 |     TMatrix<T> * slice = new TMatrix<T>;
 | 
|---|
 | 108 |     char buff[40];
 | 
|---|
 | 109 |     if (opts[0] == "slicexy") {
 | 
|---|
 | 110 |       slice->Share(mArr->SubArray(Range::all(), Range::all(), Range(ks), 
 | 
|---|
 | 111 |                                   Range::first(), Range::first()) );  
 | 
|---|
 | 112 |       ok = true; 
 | 
|---|
 | 113 |       sprintf(buff,"slicexy_%ld",(long)ks);
 | 
|---|
 | 114 |       cout << "PerformOperation(): Extracting SliceXY(" << ks << ") from array" << endl;
 | 
|---|
 | 115 |     }
 | 
|---|
 | 116 |     else if (opts[0] == "sliceyz") {
 | 
|---|
| [3004] | 117 |       slice->Share(mArr->SubArray(Range(ks), Range::all(), Range::all(), Range::first(), 
 | 
|---|
 | 118 |                                   Range::first()).CompactAllDimensions() );  
 | 
|---|
| [2999] | 119 |       ok = true; 
 | 
|---|
 | 120 |       sprintf(buff,"sliceyz_%ld",(long)ks);
 | 
|---|
 | 121 |       cout << "PerformOperation(): Extracting SliceYZ(" << ks << ") from array" << endl;
 | 
|---|
 | 122 |     }
 | 
|---|
 | 123 |     else if (opts[0] == "slicexz") {
 | 
|---|
| [3004] | 124 |       slice->Share(mArr->SubArray(Range::all(), Range(ks), Range::all(), Range::first(), 
 | 
|---|
 | 125 |                                   Range::first()).CompactAllDimensions() );  
 | 
|---|
| [2999] | 126 |       ok = true; 
 | 
|---|
 | 127 |       sprintf(buff,"slicexz_%ld",(long)ks);
 | 
|---|
 | 128 |       cout << "PerformOperation(): Extracting SliceYZ(" << ks << ") from array" << endl;
 | 
|---|
 | 129 |     }
 | 
|---|
 | 130 |     if (ok) {
 | 
|---|
 | 131 |       string nslice;
 | 
|---|
 | 132 |       if (opts.size() > 2)  nslice = opts[2];
 | 
|---|
 | 133 |       else nslice = buff;
 | 
|---|
 | 134 |       NamedObjMgr omg;
 | 
|---|
 | 135 |       omg.AddObj(slice, nslice, true); 
 | 
|---|
 | 136 |       return 0;
 | 
|---|
 | 137 |     }
 | 
|---|
 | 138 |   }
 | 
|---|
 | 139 |   
 | 
|---|
 | 140 |   cout << "NOMAdapter_TArray<T>::PerformOperation(): Error operation/arguments !" << endl;
 | 
|---|
| [3039] | 141 |   cout << "...Valid args: slicexy idxZ [slicename], sliceyz idxX [nm] slicexz idxY [nm]" << endl;
 | 
|---|
| [2999] | 142 |   return 1; 
 | 
|---|
 | 143 | }
 | 
|---|
 | 144 | 
 | 
|---|
 | 145 | /* --Methode-- */
 | 
|---|
 | 146 | template <class T> 
 | 
|---|
| [1315] | 147 | void NOMAdapter_TArray<T>::SavePPF(POutPersist& pos, string const & nom)
 | 
|---|
 | 148 | {
 | 
|---|
 | 149 | FIO_TArray<T> fio(mArr);
 | 
|---|
 | 150 | fio.Write(pos, nom);
 | 
|---|
 | 151 | }
 | 
|---|
 | 152 | 
 | 
|---|
 | 153 | /* --Methode-- */
 | 
|---|
 | 154 | template <class T> 
 | 
|---|
| [2975] | 155 | void NOMAdapter_TArray<T>::Print(ostream& os, int lev)
 | 
|---|
| [1315] | 156 | {
 | 
|---|
| [2975] | 157 | if (lev < 3) mArr->Show(os, false);
 | 
|---|
 | 158 | else  mArr->Show(os, true);
 | 
|---|
 | 159 | if (lev > 0) mArr->Print(os, 10*lev);
 | 
|---|
| [1315] | 160 | }
 | 
|---|
 | 161 | 
 | 
|---|
| [1321] | 162 | /* --Methode-- */
 | 
|---|
 | 163 | template <class T> 
 | 
|---|
 | 164 | PIDrawer * NOMAdapter_TArray<T>::GetDrawer(string & dopt)
 | 
|---|
 | 165 | {
 | 
|---|
 | 166 | if (mArr->NbDimensions() == 1) {
 | 
|---|
 | 167 |   // On peut en faire un vecteur ...
 | 
|---|
 | 168 |   TVector<T>* v = new TVector<T>(*mArr, true);  // on partage les donnees
 | 
|---|
 | 169 |   dopt = "thinline," + dopt;
 | 
|---|
 | 170 |   return( new PIYfXDrawer( new POTVectorAdapter<T>(v, true), NULL, true) );
 | 
|---|
 | 171 | }
 | 
|---|
 | 172 |  else return(NULL);
 | 
|---|
 | 173 | }
 | 
|---|
| [1315] | 174 | 
 | 
|---|
 | 175 | /* --Methode-- */
 | 
|---|
 | 176 | template <class T> 
 | 
|---|
| [1321] | 177 | P2DArrayAdapter* NOMAdapter_TArray<T>::Get2DArray(string &)
 | 
|---|
 | 178 | {
 | 
|---|
 | 179 | if (mArr->NbDimensions() <= 2) {
 | 
|---|
 | 180 |   // On peut en faire un tableau 2-D ...
 | 
|---|
 | 181 |   TMatrix<T>* m = new TMatrix<T>(*mArr, true);  // on partage les donnees
 | 
|---|
 | 182 |   return ( new POTMatrixAdapter<T>(m, true) );
 | 
|---|
 | 183 | }
 | 
|---|
 | 184 | else return(NULL);
 | 
|---|
 | 185 | }
 | 
|---|
 | 186 | 
 | 
|---|
 | 187 | /* --Methode-- */
 | 
|---|
 | 188 | template <class T> 
 | 
|---|
| [1315] | 189 | NTupleInterface* NOMAdapter_TArray<T>::GetNTupleInterface(bool& adel)
 | 
|---|
 | 190 | {
 | 
|---|
 | 191 | adel = true;
 | 
|---|
 | 192 | return( new NTupInt_TArray<T>(mArr) );
 | 
|---|
 | 193 | }
 | 
|---|
 | 194 | 
 | 
|---|
 | 195 | 
 | 
|---|
 | 196 | 
 | 
|---|
 | 197 | 
 | 
|---|
 | 198 | // -------------------------------------------------------------
 | 
|---|
 | 199 | 
 | 
|---|
 | 200 | /* --Methode-- */
 | 
|---|
 | 201 | template <class T> 
 | 
|---|
 | 202 | NTupInt_TArray<T>::NTupInt_TArray(TArray<T>* a)
 | 
|---|
 | 203 | {
 | 
|---|
 | 204 | mArr = a;
 | 
|---|
 | 205 | }
 | 
|---|
 | 206 | 
 | 
|---|
 | 207 | /* --Methode-- */
 | 
|---|
 | 208 | template <class T> 
 | 
|---|
 | 209 | NTupInt_TArray<T>::~NTupInt_TArray()
 | 
|---|
 | 210 | {
 | 
|---|
 | 211 | }
 | 
|---|
 | 212 | 
 | 
|---|
 | 213 | /* --Methode-- */
 | 
|---|
 | 214 | template <class T> 
 | 
|---|
| [2683] | 215 | sa_size_t NTupInt_TArray<T>::NbLines() const
 | 
|---|
| [1315] | 216 | {
 | 
|---|
 | 217 | return( mArr->Size() );
 | 
|---|
 | 218 | }
 | 
|---|
 | 219 | 
 | 
|---|
 | 220 | /* --Methode-- */
 | 
|---|
 | 221 | template <class T> 
 | 
|---|
| [2683] | 222 | sa_size_t NTupInt_TArray<T>::NbColumns() const 
 | 
|---|
| [1315] | 223 | {
 | 
|---|
 | 224 | return(11);
 | 
|---|
 | 225 | }
 | 
|---|
 | 226 | 
 | 
|---|
 | 227 | /* --Methode-- */
 | 
|---|
 | 228 | template <class T> 
 | 
|---|
| [3004] | 229 | r_8 NTupInt_TArray<T>::GetCell(sa_size_t n, sa_size_t k) const
 | 
|---|
 | 230 | {
 | 
|---|
 | 231 |   if ((n < 0) || (n >= (int)(mArr->Size()) ) ) 
 | 
|---|
 | 232 |     return 0.;
 | 
|---|
 | 233 |   if ((k < 0) || (k > 10))  return 0.;
 | 
|---|
 | 234 |   GetLineD(n);
 | 
|---|
 | 235 |   return mRet[k];
 | 
|---|
 | 236 | }
 | 
|---|
 | 237 | 
 | 
|---|
 | 238 | /* --Methode-- */
 | 
|---|
 | 239 | template <class T> 
 | 
|---|
 | 240 | sa_size_t NTupInt_TArray<T>::ColumnIndex(string const & nom)  const 
 | 
|---|
 | 241 | {
 | 
|---|
 | 242 | string vardec = "double n,x,y,z,t,u,val,real,imag,mod,phas; \n";
 | 
|---|
 | 243 |  if (nom == "n") return 0;
 | 
|---|
 | 244 |  else if (nom == "x") return 1;
 | 
|---|
 | 245 |  else if (nom == "y") return 2;
 | 
|---|
 | 246 |  else if (nom == "z") return 3;
 | 
|---|
 | 247 |  else if (nom == "t") return 4;
 | 
|---|
 | 248 |  else if (nom == "u") return 5;
 | 
|---|
 | 249 |  else if (nom == "val") return 6;
 | 
|---|
 | 250 |  else if (nom == "real") return 7;
 | 
|---|
 | 251 |  else if (nom == "imag") return 8;
 | 
|---|
 | 252 |  else if (nom == "mod") return 9;
 | 
|---|
 | 253 |  else if (nom == "phase") return 10;
 | 
|---|
 | 254 |  else return -1;
 | 
|---|
 | 255 | }
 | 
|---|
 | 256 | 
 | 
|---|
 | 257 | /* --Methode-- */
 | 
|---|
 | 258 | template <class T> 
 | 
|---|
 | 259 | void NTupInt_TArray<T>::GetMinMax(sa_size_t k, double& min, double& max) const
 | 
|---|
 | 260 | {
 | 
|---|
 | 261 |   if (k == 0) {
 | 
|---|
 | 262 |     min = 0.; max = (r_8)(mArr->Size());  }
 | 
|---|
 | 263 |   else if (k == 1) {
 | 
|---|
 | 264 |     min = 0.; max = (r_8)(mArr->SizeX());  }
 | 
|---|
 | 265 |   else if (k == 2) {
 | 
|---|
 | 266 |     min = 0.; max = (r_8)(mArr->SizeY());  }
 | 
|---|
 | 267 |   else if (k == 3) {
 | 
|---|
 | 268 |     min = 0.; max = (r_8)(mArr->SizeZ());  }
 | 
|---|
 | 269 |   else if (k == 4) {
 | 
|---|
 | 270 |     min = 0.; max = (r_8)(mArr->Size(3));  }
 | 
|---|
 | 271 |   else if (k == 5) {
 | 
|---|
 | 272 |     min = 0.; max = (r_8)(mArr->Size(4));  }
 | 
|---|
 | 273 |   else if ((k == 6) || (k == 7) || (k == 9)) {
 | 
|---|
 | 274 |     T tmin, tmax;
 | 
|---|
 | 275 |     mArr->MinMax(tmin, tmax);
 | 
|---|
 | 276 |     min = (r_8)(tmin); 
 | 
|---|
 | 277 |     max = (r_8)(tmax); 
 | 
|---|
 | 278 |   }
 | 
|---|
 | 279 |   else { min = max = 0.; }
 | 
|---|
 | 280 |   return;
 | 
|---|
 | 281 | }
 | 
|---|
 | 282 | 
 | 
|---|
 | 283 | /* --Methode-- */
 | 
|---|
 | 284 | template <class T> 
 | 
|---|
| [2683] | 285 | r_8* NTupInt_TArray<T>::GetLineD(sa_size_t n) const 
 | 
|---|
| [1315] | 286 | {
 | 
|---|
 | 287 | if ((n < 0) || (n >= (int)(mArr->Size()) ) ) {
 | 
|---|
 | 288 |   mRet[0] = n;
 | 
|---|
 | 289 |   for(int i=1; i<11; i++)  mRet[i] = 0.;
 | 
|---|
 | 290 | }
 | 
|---|
 | 291 | else { 
 | 
|---|
 | 292 |   sa_size_t ix, iy, iz, it, iu;
 | 
|---|
 | 293 |   mArr->IndexAtPosition(n, ix, iy, iz, it, iu);
 | 
|---|
 | 294 |   mRet[0] = n;   mRet[1] = ix;  mRet[2] = iy;  
 | 
|---|
 | 295 |   mRet[3] = iz;  mRet[4] = it;  mRet[5] = iu;  
 | 
|---|
 | 296 |   mRet[6] = (*mArr)(ix,iy,iz,it,iu);
 | 
|---|
| [3004] | 297 |   mRet[7] = mRet[6];  mRet[8] = 0.;
 | 
|---|
 | 298 |   mRet[9] = mRet[6];  mRet[10] = 0.;
 | 
|---|
| [1315] | 299 |   }
 | 
|---|
 | 300 | return(mRet);
 | 
|---|
 | 301 | }
 | 
|---|
 | 302 | 
 | 
|---|
 | 303 | /* --Methode-- */
 | 
|---|
 | 304 | template <class T> 
 | 
|---|
 | 305 | string NTupInt_TArray<T>::VarList_C(const char* nx) const 
 | 
|---|
 | 306 | {
 | 
|---|
 | 307 | string nomx;
 | 
|---|
 | 308 | if (nx) nomx = nx;
 | 
|---|
 | 309 | else nomx = "_xh_";
 | 
|---|
 | 310 | string vardec = "double n,x,y,z,t,u,val,real,imag,mod,phas; \n";
 | 
|---|
 | 311 | vardec += "n = " + nomx + "[0];  x = " + nomx + "[1]; y = " + nomx + "[2]; \n"; 
 | 
|---|
 | 312 | vardec += "z = " + nomx + "[3];  t = " + nomx + "[4]; u = " + nomx + "[5]; \n"; 
 | 
|---|
 | 313 | vardec += "val = " + nomx + "[6]; \n";
 | 
|---|
 | 314 | vardec += "real = " + nomx + "[7];  imag = " + nomx + "[8]; \n";
 | 
|---|
 | 315 | vardec += "mod  = " + nomx + "[9];  phas = " + nomx + "[10]; \n";
 | 
|---|
 | 316 | return(vardec);
 | 
|---|
 | 317 | }
 | 
|---|
 | 318 | 
 | 
|---|
 | 319 | /* --Methode-- */
 | 
|---|
| [2343] | 320 | DECL_TEMP_SPEC  /* equivalent a template <> , pour SGI-CC en particulier */
 | 
|---|
| [2689] | 321 | r_8* NTupInt_TArray< complex<r_4> >::GetLineD(sa_size_t n) const 
 | 
|---|
| [1315] | 322 | {
 | 
|---|
 | 323 | if ((n < 0) || (n >= (int)(mArr->Size()) ) ) {
 | 
|---|
 | 324 |   mRet[0] = n;
 | 
|---|
 | 325 |   for(int i=1; i<11; i++)  mRet[i] = 0.;
 | 
|---|
 | 326 | }
 | 
|---|
 | 327 | else { 
 | 
|---|
 | 328 |   sa_size_t ix, iy, iz, it, iu;
 | 
|---|
 | 329 |   mArr->IndexAtPosition(n, ix, iy, iz, it, iu);
 | 
|---|
 | 330 |   mRet[0] = n;   mRet[1] = ix;  mRet[2] = iy;  
 | 
|---|
 | 331 |   mRet[3] = iz;  mRet[4] = it;  mRet[5] = iu;  
 | 
|---|
 | 332 |   mRet[7] = (*mArr)(ix,iy,iz,it,iu).real();
 | 
|---|
 | 333 |   mRet[8] = (*mArr)(ix,iy,iz,it,iu).imag();
 | 
|---|
| [3004] | 334 |   mRet[6] = mRet[9] = sqrt(mRet[7]*mRet[7]+mRet[8]*mRet[8]);
 | 
|---|
 | 335 |   mRet[10] = atan2(mRet[8], mRet[7]);
 | 
|---|
| [1315] | 336 | }
 | 
|---|
 | 337 | return(mRet);
 | 
|---|
 | 338 | }
 | 
|---|
 | 339 | 
 | 
|---|
| [2343] | 340 | DECL_TEMP_SPEC  /* equivalent a template <> , pour SGI-CC en particulier */
 | 
|---|
| [2689] | 341 | r_8* NTupInt_TArray< complex<r_8> >::GetLineD(sa_size_t n) const 
 | 
|---|
| [1315] | 342 | {
 | 
|---|
 | 343 | if ((n < 0) || (n >= (int)(mArr->Size()) ) ) {
 | 
|---|
 | 344 |   mRet[0] = n;
 | 
|---|
 | 345 |   for(int i=1; i<11; i++)  mRet[i] = 0.;
 | 
|---|
 | 346 | }
 | 
|---|
 | 347 | else { 
 | 
|---|
 | 348 |   sa_size_t ix, iy, iz, it, iu;
 | 
|---|
 | 349 |   mArr->IndexAtPosition(n, ix, iy, iz, it, iu);
 | 
|---|
 | 350 |   mRet[0] = n;   mRet[1] = ix;  mRet[2] = iy;  
 | 
|---|
 | 351 |   mRet[3] = iz;  mRet[4] = it;  mRet[5] = iu;  
 | 
|---|
 | 352 |   mRet[7] = (*mArr)(ix,iy,iz,it,iu).real();
 | 
|---|
 | 353 |   mRet[8] = (*mArr)(ix,iy,iz,it,iu).imag();
 | 
|---|
| [3004] | 354 |   mRet[6] = mRet[9] = sqrt(mRet[7]*mRet[7]+mRet[8]*mRet[8]);
 | 
|---|
 | 355 |   mRet[10] = atan2(mRet[8], mRet[7]);
 | 
|---|
| [1315] | 356 | }
 | 
|---|
 | 357 | return(mRet);
 | 
|---|
 | 358 | }
 | 
|---|
 | 359 | 
 | 
|---|
| [3004] | 360 | DECL_TEMP_SPEC  /* equivalent a template <> , pour SGI-CC en particulier */
 | 
|---|
 | 361 | void NTupInt_TArray< complex<r_4> >::GetMinMax(sa_size_t k, double& min, double& max) const
 | 
|---|
 | 362 | {
 | 
|---|
 | 363 |   if (k == 0) {
 | 
|---|
 | 364 |     min = 0.; max = (r_8)(mArr->Size());  }
 | 
|---|
 | 365 |   else if (k == 1) {
 | 
|---|
 | 366 |     min = 0.; max = (r_8)(mArr->SizeX());  }
 | 
|---|
 | 367 |   else if (k == 2) {
 | 
|---|
 | 368 |     min = 0.; max = (r_8)(mArr->SizeY());  }
 | 
|---|
 | 369 |   else if (k == 3) {
 | 
|---|
 | 370 |     min = 0.; max = (r_8)(mArr->SizeZ());  }
 | 
|---|
 | 371 |   else if (k == 4) {
 | 
|---|
 | 372 |     min = 0.; max = (r_8)(mArr->Size(3));  }
 | 
|---|
 | 373 |   else if (k == 5) {
 | 
|---|
 | 374 |     min = 0.; max = (r_8)(mArr->Size(4));  }
 | 
|---|
 | 375 |   else if ((k >= 6) || (k <= 9)) {
 | 
|---|
 | 376 |     r_8 tmin[3] = {9.e39,9.e39,9.e39};
 | 
|---|
 | 377 |     r_8 tmax[3] = {-9.e39,-9.e39,-9.e39};
 | 
|---|
 | 378 |     for(sa_size_t jj=0; jj<mArr->Size(); jj++) {
 | 
|---|
 | 379 |       sa_size_t ix, iy, iz, it, iu;
 | 
|---|
 | 380 |       mArr->IndexAtPosition(jj, ix, iy, iz, it, iu);
 | 
|---|
 | 381 |       r_8 cv[3];
 | 
|---|
 | 382 |       cv[0] = (*mArr)(ix,iy,iz,it,iu).real();
 | 
|---|
 | 383 |       cv[1] = (*mArr)(ix,iy,iz,it,iu).imag();
 | 
|---|
 | 384 |       cv[2] = sqrt(cv[0]*cv[0]+cv[1]*cv[1]);
 | 
|---|
 | 385 |       for(int i=0; i<3; i++) {
 | 
|---|
 | 386 |         if (cv[i] < tmin[i]) tmin[i] = cv[i];
 | 
|---|
 | 387 |         if (cv[i] > tmax[i]) tmax[i] = cv[i];
 | 
|---|
 | 388 |       }
 | 
|---|
 | 389 |     }
 | 
|---|
 | 390 |     if (k == 7) { min = tmin[0]; max = tmax[0]; }
 | 
|---|
 | 391 |     else if (k == 8) { min = tmin[0]; max = tmax[0]; }
 | 
|---|
 | 392 |     else { min = tmin[2]; max = tmax[2]; }
 | 
|---|
 | 393 |   }
 | 
|---|
 | 394 |   else { min = max = 0.; }
 | 
|---|
 | 395 |   return;
 | 
|---|
 | 396 | }
 | 
|---|
 | 397 | DECL_TEMP_SPEC  /* equivalent a template <> , pour SGI-CC en particulier */
 | 
|---|
 | 398 | void NTupInt_TArray< complex<r_8> >::GetMinMax(sa_size_t k, double& min, double& max) const
 | 
|---|
 | 399 | {
 | 
|---|
 | 400 |   if (k == 0) {
 | 
|---|
 | 401 |     min = 0.; max = (r_8)(mArr->Size());  }
 | 
|---|
 | 402 |   else if (k == 1) {
 | 
|---|
 | 403 |     min = 0.; max = (r_8)(mArr->SizeX());  }
 | 
|---|
 | 404 |   else if (k == 2) {
 | 
|---|
 | 405 |     min = 0.; max = (r_8)(mArr->SizeY());  }
 | 
|---|
 | 406 |   else if (k == 3) {
 | 
|---|
 | 407 |     min = 0.; max = (r_8)(mArr->SizeZ());  }
 | 
|---|
 | 408 |   else if (k == 4) {
 | 
|---|
 | 409 |     min = 0.; max = (r_8)(mArr->Size(3));  }
 | 
|---|
 | 410 |   else if (k == 5) {
 | 
|---|
 | 411 |     min = 0.; max = (r_8)(mArr->Size(4));  }
 | 
|---|
 | 412 |   else if ((k >= 6) || (k <= 9)) {
 | 
|---|
 | 413 |     r_8 tmin[3] = {9.e39,9.e39,9.e39};
 | 
|---|
 | 414 |     r_8 tmax[3] = {-9.e39,-9.e39,-9.e39};
 | 
|---|
 | 415 |     for(sa_size_t jj=0; jj<mArr->Size(); jj++) {
 | 
|---|
 | 416 |       sa_size_t ix, iy, iz, it, iu;
 | 
|---|
 | 417 |       mArr->IndexAtPosition(jj, ix, iy, iz, it, iu);
 | 
|---|
 | 418 |       r_8 cv[3];
 | 
|---|
 | 419 |       cv[0] = (*mArr)(ix,iy,iz,it,iu).real();
 | 
|---|
 | 420 |       cv[1] = (*mArr)(ix,iy,iz,it,iu).imag();
 | 
|---|
 | 421 |       cv[2] = sqrt(cv[0]*cv[0]+cv[1]*cv[1]);
 | 
|---|
 | 422 |       for(int i=0; i<3; i++) {
 | 
|---|
 | 423 |         if (cv[i] < tmin[i]) tmin[i] = cv[i];
 | 
|---|
 | 424 |         if (cv[i] > tmax[i]) tmax[i] = cv[i];
 | 
|---|
 | 425 |       }
 | 
|---|
 | 426 |     }
 | 
|---|
 | 427 |     if (k == 7) { min = tmin[0]; max = tmax[0]; }
 | 
|---|
 | 428 |     else if (k == 8) { min = tmin[0]; max = tmax[0]; }
 | 
|---|
 | 429 |     else { min = tmin[2]; max = tmax[2]; }
 | 
|---|
 | 430 |   }
 | 
|---|
 | 431 |   else { min = max = 0.; }
 | 
|---|
 | 432 |   return;
 | 
|---|
 | 433 | }
 | 
|---|
| [1315] | 434 | 
 | 
|---|
 | 435 | #ifdef __CXX_PRAGMA_TEMPLATES__
 | 
|---|
| [2930] | 436 | #pragma define_template NOMAdapter_TArray<uint_2>
 | 
|---|
 | 437 | #pragma define_template NOMAdapter_TArray<int_2>
 | 
|---|
| [1315] | 438 | #pragma define_template NOMAdapter_TArray<int_4>
 | 
|---|
| [2930] | 439 | #pragma define_template NOMAdapter_TArray<int_8>
 | 
|---|
| [1315] | 440 | #pragma define_template NOMAdapter_TArray<r_4>
 | 
|---|
 | 441 | #pragma define_template NOMAdapter_TArray<r_8>
 | 
|---|
 | 442 | #pragma define_template NOMAdapter_TArray< complex<r_4> >
 | 
|---|
 | 443 | #pragma define_template NOMAdapter_TArray< complex<r_8> >
 | 
|---|
| [2930] | 444 | #pragma define_template NTupInt_TArray<uint_2>
 | 
|---|
 | 445 | #pragma define_template NTupInt_TArray<int_2>
 | 
|---|
| [1315] | 446 | #pragma define_template NTupInt_TArray<int_4>
 | 
|---|
| [2930] | 447 | #pragma define_template NTupInt_TArray<int_8>
 | 
|---|
| [1315] | 448 | #pragma define_template NTupInt_TArray<r_4>
 | 
|---|
 | 449 | #pragma define_template NTupInt_TArray<r_8>
 | 
|---|
 | 450 | #pragma define_template NTupInt_TArray< complex<r_4> >
 | 
|---|
 | 451 | #pragma define_template NTupInt_TArray< complex<r_8> >
 | 
|---|
 | 452 | #endif
 | 
|---|
 | 453 | 
 | 
|---|
 | 454 | #if defined(ANSI_TEMPLATES) 
 | 
|---|
| [2930] | 455 | template class NOMAdapter_TArray<uint_2>;
 | 
|---|
 | 456 | template class NOMAdapter_TArray<int_2>;
 | 
|---|
| [1315] | 457 | template class NOMAdapter_TArray<int_4>;
 | 
|---|
| [2930] | 458 | template class NOMAdapter_TArray<int_8>;
 | 
|---|
| [1315] | 459 | template class NOMAdapter_TArray<r_4>;
 | 
|---|
 | 460 | template class NOMAdapter_TArray<r_8>;
 | 
|---|
 | 461 | template class NOMAdapter_TArray< complex<r_4> >;
 | 
|---|
 | 462 | template class NOMAdapter_TArray< complex<r_8> >;
 | 
|---|
| [2930] | 463 | template class NTupInt_TArray<uint_2>;
 | 
|---|
 | 464 | template class NTupInt_TArray<int_2>;
 | 
|---|
| [1315] | 465 | template class NTupInt_TArray<int_4>;
 | 
|---|
| [2930] | 466 | template class NTupInt_TArray<int_8>;
 | 
|---|
| [1315] | 467 | template class NTupInt_TArray<r_4>;
 | 
|---|
 | 468 | template class NTupInt_TArray<r_8>;
 | 
|---|
 | 469 | template class NTupInt_TArray< complex<r_4> >;
 | 
|---|
 | 470 | template class NTupInt_TArray< complex<r_8> >;
 | 
|---|
 | 471 | #endif
 | 
|---|