コード例 #1
0
 virtual void VisitFunction( const SymbolicFunction &v)  
  {
    bool _hasfrac = hasfrac;
    std::string op = v.GetOp();
    if (op == "pow" && v.last_arg() < 0) {
        _hasfrac = true;
        if (frp != 0) *frp = v;  
    }
    else {
        SymbolicFunction::const_iterator p = v.args_begin();
        for (  ; p != v.args_end(); ++p) {
           if (operator()(*p, inp, frp)) {
               _hasfrac = true;
                break;  
           }
        }
        if (p == v.args_end()) {
           if (inp != 0) *inp = v;
        }
        else {
           if (inp == 0 && frp == 0)
                return;
           SymbolicFunction::Arguments inargs, frargs;
           SymbolicFunction::const_iterator q = v.args_begin(); 
           for ( ; q != p ; ++q) {
              if (inp != 0)
                 inargs.push_back(*q);
              if (frp != 0)
                 frargs.push_back(*q);
           }
           if (inp != 0)
              inargs.push_back(*inp);
           if (frp != 0)
              frargs.push_back(*frp);
           for (++q; q != v.args_end(); ++q) {
             SymbolicVal cur = *q;
             if (operator()(v, inp, frp)) {
               if (inp != 0)
                  inargs.push_back(*inp);
               if (frp != 0)
                  frargs.push_back(*frp);
             }
             else {
               if (inp != 0)
                  inargs.push_back(cur);
               if (frp != 0)
                  frargs.push_back(cur);
             }
           }   
           if (inp != 0) 
               *inp = v.cloneFunction(inargs);
           if (frp != 0)
               *frp = v.cloneFunction(frargs);
        }
    }
    hasfrac = _hasfrac;
  }
コード例 #2
0
ファイル: SymbolicFind.C プロジェクト: alexjohn1362/rose
 void VisitFunction( const SymbolicFunction &v)
 {
     if (target.GetValType() == VAL_FUNCTION && cur == target)
         result = true;
     else {
         for (SymbolicFunction::const_iterator p = v.args_begin();
                 p != v.args_end(); ++p) {
             SymbolicVal tmp = *p;
             cur = tmp;
             cur.Visit(this);
             if ( result)
                 break;
         }
     }
 }