Logo Search packages:      
Sourcecode: k3dsurf version File versions  Download package

void Model3D::parse_expression (  ) 

This function must be rewriten for more clarity..

Definition at line 3180 of file Model3D.cpp.

                                {
    double vals[] = { 0,0,0,0,0,0}; // arbitrary values


if(there_is_condition == 1) {
  myParser_condition.AddFunction("k", f1);
  myParser_condition.Parse(condition_expression, "u,v,t,x,y,z");                    
                      }

if ( supershape == 1){
    myParser.Parse(sm1, "u,v,t,x,y,z");
    m1 = myParser.Eval(vals); 
     
    myParser.Parse(sm2, "u,v,t,x,y,z");
    m2 = myParser.Eval(vals);     
     
    myParser.Parse(sa_1, "u,v,t,x,y,z");
    a_1 = myParser.Eval(vals);
    
    myParser.Parse(sa_2, "u,v,t,x,y,z");
    a_2 = myParser.Eval(vals);    
         
    myParser.Parse(sb_1, "u,v,t,x,y,z");
    b_1 = myParser.Eval(vals);
    
    myParser.Parse(sb_2, "u,v,t,x,y,z");
    b_2 = myParser.Eval(vals);

    myParser.Parse(sn1_1, "u,v,t,x,y,z");
    n1_1 = myParser.Eval(vals);
    
    myParser.Parse(sn1_2, "u,v,t,x,y,z");
    n1_2 = myParser.Eval(vals);
    
    myParser.Parse(sn2_1, "u,v,t,x,y,z");
    n2_1 = myParser.Eval(vals);
    
    myParser.Parse(sn2_2, "u,v,t,x,y,z");
    n2_2 = myParser.Eval(vals);    
    
    myParser.Parse(sn3_1, "u,v,t,x,y,z");
    n3_1 = myParser.Eval(vals);
    
    myParser.Parse(sn3_2, "u,v,t,x,y,z");
    n3_2 = myParser.Eval(vals);
    

    myParser.Parse(inf_u, "u,v,t,x,y");
    u_inf = myParser.Eval(vals);
    myParser.Parse(sup_u, "u,v,t,x,y");
    u_sup = myParser.Eval(vals);
    dif_u = u_sup - u_inf;

    myParser.Parse(inf_v, "u,v,t,x,y");
    v_inf = myParser.Eval(vals);
    myParser.Parse(sup_v, "u,v,t,x,y");
    v_sup = myParser.Eval(vals);
    dif_v = v_sup - v_inf;


    
    
    
         
     }
else
 if(  implicitdef != 1 ) {     
    if(DefineNewFct ==1){
    f1.Parse(newfct, "u,v,t,x,y");
    myParserX.AddFunction("k", f1);
    myParserY.AddFunction("k", f1);
    myParserZ.AddFunction("k", f1);
    
    myParserX_2.AddFunction("k", f1);
    myParserY_2.AddFunction("k", f1);
    myParserZ_2.AddFunction("k", f1);
    
    myParser_spherical.AddFunction("k", f1);
    myParser_cylindrical.AddFunction("k", f1);      
                        }      
    myParser.Parse(inf_u, "u,v,t,x,y");
    u_inf = myParser.Eval(vals);
    myParser.Parse(sup_u, "u,v,t,x,y");
    u_sup = myParser.Eval(vals);
    dif_u = u_sup - u_inf;

    myParser.Parse(inf_v, "u,v,t,x,y");
    v_inf = myParser.Eval(vals);
    myParser.Parse(sup_v, "u,v,t,x,y");
    v_sup = myParser.Eval(vals);
    dif_v = v_sup - v_inf;
     
 myParserX.Parse(expression_X, "u,v,t,x,y");
 myParserY.Parse(expression_Y, "u,v,t,x,y");
 myParserZ.Parse(expression_Z, "u,v,t,x,y");

 // if two system activated
 
 if(two_system == 1) {
    myParser.Parse(inf_u_2, "u,v,t,x,y");
    u_inf_2 = myParser.Eval(vals);
    myParser.Parse(sup_u_2, "u,v,t,x,y");
    u_sup_2 = myParser.Eval(vals);
    dif_u_2 = u_sup_2 - u_inf_2;

    myParser.Parse(inf_v_2, "u,v,t,x,y");
    v_inf_2 = myParser.Eval(vals);
    myParser.Parse(sup_v_2, "u,v,t,x,y");
    v_sup_2 = myParser.Eval(vals);
    dif_v_2 = v_sup_2 - v_inf_2;
  
 myParserX_2.Parse(expression_X_2, "u,v,t,x,y");
 myParserY_2.Parse(expression_Y_2, "u,v,t,x,y");
 myParserZ_2.Parse(expression_Z_2, "u,v,t,x,y");
 }
 
 
  // 6D shapes 
 if (sixdimshapes == 1 ) {     
    myParserW.AddFunction("k", f1);    
    myParserW.Parse(expression_W, "u,v,t,x,y"); 
    
    myParserT.AddFunction("k", f1);    
    myParserT.Parse(expression_T, "u,v,t,x,y");  
    
    myParserS.AddFunction("k", f1);    
    myParserS.Parse(expression_S, "u,v,t,x,y");              
     }
     
 // 5D shapes 
 if (fivedimshapes == 1 ) {     
    myParserW.AddFunction("k", f1);    
    myParserW.Parse(expression_W, "u,v,t,x,y"); 
    
    myParserT.AddFunction("k", f1);    
    myParserT.Parse(expression_T, "u,v,t,x,y");                
     }
 // 4D shapes 
 else if (fourdimshapes == 1 ) {     
    myParserW.AddFunction("k", f1);    
    myParserW.Parse(expression_W, "u,v,t,x,y");          
     }
 

 else if(sphericaldef == 1) // spherical equation  r^n = f(u,v,x,y,z)
    { 
     // we are looking for the parity of the coefficient n
    myParser.Parse(coefficient_n, "u,v,t,x,y");
    coefficent_fct_implicite = myParser.Eval(vals);
    coefficent_fct_implicite_parity = fmod(coefficent_fct_implicite, 2);       
    myParser_spherical.Parse(spherical_expression, "u,v,t,x,y,z"); // we have one more variable z    
    }
 else if(cylindricaldef == 1) // spherical equation  r^n = f(u,v,x,y,z)
    { 
     // we are looking for the parity of the coefficient n
    myParser.Parse(coefficient_n, "u,v,t,x,y");
    coefficent_fct_implicite = myParser.Eval(vals);
    coefficent_fct_implicite_parity = fmod(coefficent_fct_implicite, 2);       
    myParser_cylindrical.Parse(cylindrical_expression, "u,v,t,x,y,z"); // we have one more variable z    
    }

    
}


// this part is for the implicit equation...
else {

// We use the borders of the second system to delimite x and y
    myParser.Parse(inf_u, "u,v,t,x,y");
    u_inf = myParser.Eval(vals);
    myParser.Parse(sup_u, "u,v,t,x,y");
    u_sup = myParser.Eval(vals);
    dif_u = u_sup - u_inf;

    myParser.Parse(inf_v, "u,v,t,x,y");
    v_inf = myParser.Eval(vals);
    myParser.Parse(sup_v, "u,v,t,x,y");
    v_sup = myParser.Eval(vals);
    dif_v = v_sup - v_inf;
    
 // we are looking for the parity of the coefficient n
    myParser.Parse(coefficient_n, "u,v,t,x,y");
    coefficent_fct_implicite = myParser.Eval(vals);
    coefficent_fct_implicite_parity = fmod(coefficent_fct_implicite, 2);
 // we set the first and second equation to u and v    
    
    myParserX.Parse("u", "u,v,t,x,y");
    myParserY.Parse("v", "u,v,t,x,y"); 
 // Now we construct the third equation for Implicit equation z^n = f(x,y)...
    expression_Z = expression_implicite;
    myParserZ.Parse(expression_Z, "u,v,t,x,y");
                        

 // just for more security....
    two_system = -1;

}


 
 
 
} 


Generated by  Doxygen 1.6.0   Back to index