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/nomtmatvecadapter.cc

    r2975 r2999  
    1717#include "fioarr.h"
    1818
     19#include "nobjmgr.h"
    1920
    2021//----------------------------------------------------------------
     
    7172}
    7273
     74/* --Methode-- */
     75template <class T>
     76string NOMAdapter_TMatrix<T>::GetInfoString(vector<string>& opts)
     77{
     78  if (opts.size() == 0) return mMtx->InfoString();
     79  else {
     80    if (opts[0] == "rank") return string("2");
     81    else if (opts[0] == "sizes") {
     82      char buff[64];
     83      TVector<T>* v = dynamic_cast<TVector<T> *>(mMtx);
     84      if (v != NULL) sprintf(buff, "%ld", (long)mMtx->Size());
     85      else sprintf(buff, "%ld %ld", (long)mMtx->NRows(), (long)mMtx->NCols());
     86      return string(buff);
     87    }
     88    else if ((opts[0] == "size") || (opts[0] == "nelts")) {
     89      char buff[32];
     90      sprintf(buff, "%ld", (long)mMtx->Size());
     91      return string(buff);
     92    }
     93    else if (opts[0] == "sum") {
     94      MuTyV mtv(mMtx->Sum());
     95      string s;
     96      return mtv.Convert(s);
     97    }
     98    else return mMtx->InfoString();
     99  }
     100}
     101
     102/* --Methode-- */
     103template <class T>
     104int NOMAdapter_TMatrix<T>::PerformOperation(vector<string>& opts)
     105{
     106  bool ok = false;
     107  if (opts.size() >= 2) {
     108    int_4 kk = atoi(opts[1].c_str());
     109    TVector<T> * vrc = new TVector<T>;
     110    char buff[40];
     111    if ((opts[0] == "row") || (opts[0] == "line")) {
     112      vrc->Share(mMtx->Row((sa_size_t)kk)); 
     113      ok = true;
     114      sprintf(buff,"row_%ld",(long)kk);
     115      cout << "PerformOperation(): Extracting Row(" << kk << ") from matrix" << endl;
     116    }
     117    else if ((opts[0] == "col") || (opts[0] == "column")) {
     118      vrc->Share(mMtx->Column((sa_size_t)kk)); 
     119      ok = true;
     120      sprintf(buff,"col_%ld",(long)kk);
     121      cout << "PerformOperation(): Extracting Column(" << kk << ") from matrix" << endl;
     122    }
     123    if (ok) {
     124      string nvrc;
     125      if (opts.size() > 2)  nvrc = opts[2];
     126      else nvrc = buff;
     127      NamedObjMgr omg;
     128      omg.AddObj(vrc, nvrc, true);
     129      return 0;
     130    }
     131  }
     132 
     133  cout << "NOMAdapter_TMatrix<T>::PerformOperation(): Error operation/arguments !" << endl;
     134  return 1;
     135}
    73136
    74137/* --Methode-- */
Note: See TracChangeset for help on using the changeset viewer.