Changeset 2268 in Sophya for trunk/SophyaPI/PIext/basexecut.cc


Ignore:
Timestamp:
Nov 15, 2002, 10:37:01 AM (23 years ago)
Author:
ansari
Message:

Ajout commande arrtoascii - Reza 15/11/2002

File:
1 edited

Legend:

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

    r2265 r2268  
    804804  }
    805805}
     806else if (kw == "arrtoascii")  {
     807  if(tokens.size() < 2) {
     808    cout<<"Usage: arrtoascii array_name file_name "<<endl;
     809    return(0);
     810  }
     811 
     812  AnyDataObj* obj;
     813  obj = mObjMgr->GetObj(tokens[0]);
     814  if(obj == NULL) {
     815    cerr << "arrtoascii Error , No such object " << tokens[0] << endl;
     816    return(0);
     817  }
     818  BaseArray* ba = dynamic_cast<BaseArray *>(obj);
     819  if(ba == NULL) {
     820    cerr << "arrtoascii Error " << tokens[0] << " not a BaseArray ! " << endl;
     821    return(0);
     822  }
     823  ofstream os(tokens[1].c_str()); 
     824  ba->WriteASCII(os);
     825  cout << "arrtoascii: Array " << tokens[0] << " written to file " << tokens[1] << endl;
     826}
     827 
    806828#endif
    807829
     
    12351257usage = "Reads a matrix from an ASCII file (TMatrix<r_8>)";
    12361258usage += "\n Usage: mtxfrascii mtx_name file_name";
    1237 usage += "\n  Related commands: vecfrascii ntfrascii ";
     1259usage += "\n  Related commands: arrtoascii vecfrascii ntfrascii ";
    12381260mpiac->RegisterCommand(kw, usage, this, "FileIO");
    12391261kw = "vecfrascii";
    1240 usage = "Reads a vactor from an ASCII file (TVector<r_8>)";
     1262usage = "Reads a vector from an ASCII file (TVector<r_8>)";
    12411263usage += "\n Usage: vecfrascii vec_name file_name";
    1242 usage += "\n  Related commands: mtxfrascii ntfrascii ";
     1264usage += "\n  Related commands: arrtoascii mtxfrascii ntfrascii ";
     1265mpiac->RegisterCommand(kw, usage, this, "FileIO");
     1266kw = "arrtoascii";
     1267usage = "Writes an array (TArray<T>) to an ASCII file ";
     1268usage += "\n Usage: arrtoascii array_name file_name";
     1269usage += "\n  Related commands:  mtxfrascii vecfrascii ntfrascii ";
    12431270mpiac->RegisterCommand(kw, usage, this, "FileIO");
    12441271#endif
Note: See TracChangeset for help on using the changeset viewer.