Ignore:
Timestamp:
Jul 2, 2006, 7:20:56 PM (19 years ago)
Author:
ansari
Message:

1/ Ajout methode Services2NObjMgr::DisplayPoints3DW() et commande plot3dw
2/ Ajout et utilisation methode de verification de nom NamedObjMgr::CheckName()
3/ Changement methode NObjMgrAdapter::GetInfoString() et son utilisation
a travers la methdoe PIACmd::GetVarApp() pour acces de type $objname
4/ Ajout methode NObjMgrAdapter::PerformOperation() , implemente pour
adaptateur TMatrix<T> et TArray<T> pour extraction de ligne/colonne
(des matrices) et plan (slice) des TArray pour Rank()>3 Et mise en place
de la commande objaoper pour appel a PerformOperation()
5/ Petites corrections pour ntline2var vec2var

Reza 2 Juillet 2006

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/SophyaPI/PIext/nomtarradapter.cc

    r2975 r2999  
    1616#include "fioarr.h"
    1717
     18#include "nobjmgr.h"
    1819
    1920
     
    6566}
    6667
     68/* --Methode-- */
     69template <class T>
     70string 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") {
     80      for(int_4 kd=0; kd<mArr->Rank(); kd++)
     81        sprintf(buff,"%ld ", (long)mArr->Size(kd));
     82      return string(buff);     
     83    }
     84    else if ((opts[0] == "size") || (opts[0] == "nelts")) {
     85      sprintf(buff, "%ld", (long)mArr->Size());
     86      return string(buff);
     87    }
     88    else if (opts[0] == "sum") {
     89      MuTyV mtv(mArr->Sum());
     90      string s;
     91      return mtv.Convert(s);
     92    }
     93    else return mArr->InfoString();
     94  }
     95}
     96
     97/* --Methode-- */
     98template <class T>
     99int NOMAdapter_TArray<T>::PerformOperation(vector<string>& opts)
     100{
     101  bool ok = false;
     102  if ((mArr->Rank() >= 3) && (opts.size() >= 2)) {
     103    int_4 ks = atoi(opts[1].c_str());
     104    TMatrix<T> * slice = new TMatrix<T>;
     105    char buff[40];
     106    if (opts[0] == "slicexy") {
     107      slice->Share(mArr->SubArray(Range::all(), Range::all(), Range(ks),
     108                                  Range::first(), Range::first()) ); 
     109      ok = true;
     110      sprintf(buff,"slicexy_%ld",(long)ks);
     111      cout << "PerformOperation(): Extracting SliceXY(" << ks << ") from array" << endl;
     112    }
     113    else if (opts[0] == "sliceyz") {
     114      slice->Share(mArr->SubArray(Range(ks), Range::all(), Range::all(),
     115                                  Range::first(), Range::first()) ); 
     116      ok = true;
     117      sprintf(buff,"sliceyz_%ld",(long)ks);
     118      cout << "PerformOperation(): Extracting SliceYZ(" << ks << ") from array" << endl;
     119    }
     120    else if (opts[0] == "slicexz") {
     121      slice->Share(mArr->SubArray(Range::all(), Range(ks), Range::all(),
     122                                  Range::first(), Range::first()) ); 
     123      ok = true;
     124      sprintf(buff,"slicexz_%ld",(long)ks);
     125      cout << "PerformOperation(): Extracting SliceYZ(" << ks << ") from array" << endl;
     126    }
     127    if (ok) {
     128      string nslice;
     129      if (opts.size() > 2)  nslice = opts[2];
     130      else nslice = buff;
     131      NamedObjMgr omg;
     132      omg.AddObj(slice, nslice, true);
     133      return 0;
     134    }
     135  }
     136 
     137  cout << "NOMAdapter_TArray<T>::PerformOperation(): Error operation/arguments !" << endl;
     138  return 1;
     139}
    67140
    68141/* --Methode-- */
Note: See TracChangeset for help on using the changeset viewer.