Skip to content
Snippets Groups Projects
Select Git revision
  • master
  • dof-renumbering
  • gdemesy-master-patch-30528
  • eval-space-time
  • oscillating_multiharm
  • MH_movement
  • axisqu
  • write_vtu_and_ensight_formats
  • movingband
  • CP_1972_add_vtu_file_writing
  • mortar
  • fast_freq_sweep_Resolution
  • applyresolvent_again
  • marteaua-master-patch-54323
  • patch-1
  • binde-master-patch-08072
  • binde-master-patch-52461
  • BCGSL
  • resolvent
  • TreeElementsOf
  • getdp_3_5_0
  • getdp_3_4_0
  • getdp_3_3_0
  • getdp_3_2_0
  • getdp_3_1_0
  • getdp_3_0_4
  • getdp_3_0_3
  • getdp_3_0_2
  • getdp_3_0_1
  • getdp_3_0_0
  • onelab_mobile_2.1.0
  • getdp_2_11_3 protected
  • getdp_2_11_2 protected
  • getdp_2_11_1 protected
  • getdp_2_11_0 protected
  • getdp_2_10_0 protected
  • getdp_2_9_2 protected
  • getdp_2_9_1 protected
  • getdp_2_9_0 protected
  • getdp_2_8_0 protected
40 results

README.txt

Blame
  • To learn more about this project, read the wiki.
    OnelabParser.cpp 52.18 KiB
    #include "OnelabClients.h"
    #include <algorithm>
    #include "mathex.h"
    
    // reserved keywords for the onelab parser
    
    namespace olkey{ 
      static std::string deflabel("onelab.tags");
      static std::string label("OL."), comment("#"), separator(";");
      static std::string line(label+"line");
      static std::string begin(label+"block");
      static std::string end(label+"endblock");
      static std::string include(label+"include");
      static std::string message(label+"msg");
      static std::string showParam(label+"show");
      static std::string showGmsh(label+"merge");
      static std::string dump(label+"dump");
      static std::string ifcond(label+"if");
      static std::string iftrue(label+"iftrue"), ifntrue(label+"ifntrue");
      static std::string olelse(label+"else"), olendif(label+"endif");
      static std::string getValue(label+"get");
      static std::string mathex(label+"eval");
      static std::string getRegion(label+"region");
    }
    
    // Client member functions defined here because they use parser commands 
    
    bool MetaModel::findCommandLine(const std::string &client, const std::string &host){
      std::string fileName;
      size_t pos;
    
      //std::cout << "FHF search cmdl: " << client << " , " << host << std::endl; 
    
      fileName = getWorkingDir() + genericNameFromArgs + onelabExtension + ".save";
    
      std::ifstream infile(fileName.c_str());
      if(infile.is_open()){
        while(infile.good()){
          std::string line;
          getline(infile,line);
          if( (pos=line.find(olkey::separator)) != std::string::npos){
    	std::string name, action;
    	std::vector<std::string> args;
    	extract(line.substr(0,pos),name,action,args);
    	// (name, action, args) = client.commandLine(cmdl{,rhost{,rdir}})
    	std::string cmdl="", rhost="localhost", rdir="";
    	cmdl = args[0];
    	if(args.size() > 1) rhost= args[1]; 
    	if(args.size() > 2) rdir = args[2];
    
    	if(name == client){
    	  if( (host.empty() && (rhost != "localhost" )) ||
    	      (host.size() && (rhost == host)) ) {
    	    OLMsg::SetOnelabString(name + "/CommandLine", cmdl, false);
    	    if(rhost.compare("localhost")){
    	      OLMsg::SetOnelabString(name + "/HostName", rhost, false);
    	      if(rdir.size())
    		OLMsg::SetOnelabString(name + "/RemoteDir", rdir, false);
    	    }
    	    //std::cout << "FHF found cmdl: " << cmdl << "," << rhost << std::endl;
    	    return true;
    	  }
    	}
          }
        }
      }
      infile.close();
      return false;
    }