void G_parser::rewrite(rule& r, vector<int>& seq_t){
    
    cout << "rewriting_Rule:";
    //for (int i=0; i<r.left_str.size(); i++) cout << r.left_str[i] << ", ";
    cout << endl;
    
    vector<elem_ID> production;
    int choice = rewrite_choice(r);
    
    //produce from rule
    for (int i=0; i<r.right_side[choice].right_str.size(); i++){
        
        production.push_back(elem_ID());
        production[i].name = r.right_side[choice].right_str[i];
        //else (generals.leftmost_time == {0 ,0})
        
        vector<int> t_aux(2);
        
        t_aux[0] = r.leftmost_time[0] % t_sign;
        t_aux[1] = ((r.leftmost_time[1]+i / harm_rh) + form_length) % form_length;
        
        production[i].time = t_aux;
    }
    
    update_cycle(production, r, seq_t);
    
    //production.clear();
    
    /*
     for (int i=0; i<production.size(); i++){
     cout << "name" << i << ": " << production[i].name << ", time: " << production[i].time[0] << " & " << production[i].time[1] << endl;
     }
     */
}
Пример #2
0
void ReadFile(std::string filename, Eigen::Vector3d &t, double &qw, double &qx,double &qy,double &qz){
	
	t<<0.0,0.0,0.0;
	double dummy;
	
	double qw_aux,qx_aux,qy_aux,qz_aux;
	Eigen::Vector3d t_aux(0.0,0.0,0.0);
	qw=qx=qy=qz=0.0;
	
	int npoint=0;
	
	std::ifstream file(filename.data());
	
	while(!file.eof()){
		file >> dummy;
		file >> t_aux(0);
		file >> t_aux(1);
		file >> t_aux(2);
		file >> dummy; file >> dummy; file >> dummy;
		file >> qw_aux;
		file >> qx_aux;
		file >> qy_aux;
		file >> qz_aux;
		
		t+=t_aux;
		qw+=qw_aux;
		qx+=qx_aux;
		qy+=qy_aux;
		qz+=qz_aux;
			
		npoint++;
	}		
	file.close();
	
	qw=qw/npoint;
	qx=qx/npoint;
	qy=qy/npoint;
	qz=qz/npoint;
	t=t/npoint;
	
}