void cow_dfield_sampleexecute(cow_dfield *f) // ----------------------------------------------------------------------------- // Samples `N` points on the global domain. `N` may vary between processes, or // be equal to zero. Points are output permuted relative to the input // coordinates, so take care to use `xout` as the coordinates associated with // samples in `P`. // // f: IN data field instance to sample // x: IN list of input coordinates at which to sample f's data (N x 3) // N: IN number of points to sample // xout: OUT locations of returned samples, permutation of x (N x 3) // P: OUT list of filled samples (N x Q) where Q = f->n_members // ----------------------------------------------------------------------------- { double *xout = (double*) malloc(f->samplecoordslen * 3 * sizeof(double)); double *xin = f->samplecoords; int N = f->samplecoordslen; double *P = f->sampleresult; int mode = f->samplemode; if (cow_mpirunning()) { _rem(f, xin, N, xout, P, mode); } else { _loc(f, xin, N, xout, P, mode); } memcpy(f->samplecoords, xout, f->samplecoordslen * 3 * sizeof(double)); free(xout); }
void VMDriver::execute(){ if( this->m_state == STATE_IDLE ){ printf( "Error: state is idle. \n"); return; } assert( this->currentAssembly() ); while( this->isActive() ){ if( this->isBreak() ){ break; } unsigned char content = this->getByte( m_funcAddr , m_pc ); m_pc++; switch( content ){ case EMnemonic::MovPtr : _mov_ptr(); break; case EMnemonic::Mov : _mov(); break; case EMnemonic::Add : _add(); break; case EMnemonic::Sub : _sub(); break; case EMnemonic::Mul : _mul(); break; case EMnemonic::Div : _div(); break; case EMnemonic::Rem : _rem(); break; case EMnemonic::Inc : _inc(); break; case EMnemonic::Dec : _dec(); break; case EMnemonic::Push : _push(); break; case EMnemonic::PushPtr : _push_ptr(); break; case EMnemonic::Pop : _pop(); break; case EMnemonic::Call : _call(); break; case EMnemonic::ST : _st(); break; case EMnemonic::LD : _ld(); break; case EMnemonic::EndFunc : _endFunc(); break; case EMnemonic::CmpGeq : case EMnemonic::CmpG : case EMnemonic::CmpLeq : case EMnemonic::CmpL : case EMnemonic::CmpEq : case EMnemonic::CmpNEq : _cmp( content ); break; case EMnemonic::Not : _not(); break; case EMnemonic::Minus : _minus(); break; case EMnemonic::LogOr : case EMnemonic::LogAnd : _log( content ); break; case EMnemonic::Jmp : _jmp(); break; case EMnemonic::JumpZero : _jumpzero(); break; case EMnemonic::JumpNotZero : _jumpnotzero(); break; case EMnemonic::RET : _ret(); break; } } }