void Foam::tetrahedron<Point, PointRef>::gradNiDotGradNj ( scalarField& buffer ) const { // Warning. Ordering of edges needs to be the same for a tetrahedron // class, a tetrahedron cell shape model and a tetCell // Warning: Added a mag to produce positive coefficients even if // the tetrahedron is twisted inside out. This is pretty // dangerous, but essential for mesh motion. // Double change of sign between face area vector and gradient scalar magVol = Foam::mag(mag()); vector sa = Sa(); vector sb = Sb(); vector sc = Sc(); vector sd = Sd(); buffer[0] = (1.0/9.0)*(sa & sb)/magVol; buffer[1] = (1.0/9.0)*(sa & sc)/magVol; buffer[2] = (1.0/9.0)*(sa & sd)/magVol; buffer[3] = (1.0/9.0)*(sd & sb)/magVol; buffer[4] = (1.0/9.0)*(sb & sc)/magVol; buffer[5] = (1.0/9.0)*(sd & sc)/magVol; }
void UnassembleCommand(void) { int count = 8; // Default instruction count to display Sb(); if (IsDwDebugNumeric(NextCh())) {Uaddr = ReadInstructionAddress("U"); Wl();} Sb(); if (IsDwDebugNumeric(NextCh())) {count = ReadNumber(0);} Sb(); if (!DwEoln()) {Wsl("Unrecognised parameters on unassemble command.");} int firstByte = Uaddr; int limitByte = min(firstByte + count*4, FlashSize()); // Allow for up to 2 words per instruction int length = limitByte - firstByte; if (length <= 0) {Fail("Nothing to disassemble.");} u8 buf[length+2]; DwReadFlash(firstByte, length, buf); buf[length] = 0; buf[length+1] = 0; while (1) { Uaddr += DisassembleInstruction(Uaddr, &buf[Uaddr-firstByte]); count--; if (count <= 0 || Uaddr >= FlashSize()) {return;} Wl(); } }
void Foam::tetrahedron<Point, PointRef>::gradNiGradNi ( tensorField& buffer ) const { // Change of sign between face area vector and gradient // does not matter because of square scalar magVol = Foam::mag(mag()); buffer[0] = (1.0/9.0)*sqr(Sa())/magVol; buffer[1] = (1.0/9.0)*sqr(Sb())/magVol; buffer[2] = (1.0/9.0)*sqr(Sc())/magVol; buffer[3] = (1.0/9.0)*sqr(Sd())/magVol; }
void Foam::tetrahedron<Point, PointRef>::gradNiSquared ( scalarField& buffer ) const { // Change of sign between face area vector and gradient // does not matter because of square // Warning: Added a mag to produce positive coefficients even if // the tetrahedron is twisted inside out. This is pretty // dangerous, but essential for mesh motion. scalar magVol = Foam::mag(mag()); buffer[0] = (1.0/9.0)*magSqr(Sa())/magVol; buffer[1] = (1.0/9.0)*magSqr(Sb())/magVol; buffer[2] = (1.0/9.0)*magSqr(Sc())/magVol; buffer[3] = (1.0/9.0)*magSqr(Sd())/magVol; }
CH_STYLE(ScrollBar, Style, StyleDefault) { arrowsize = ScrollBarArrowSize(); barsize = FrameButtonWidth(); thumbmin = 16; overthumb = 0; through = false; CtrlsImageLook(vupper, CtrlsImg::I_SBVU); CtrlsImageLook(vthumb, CtrlsImg::I_SBVT, CtrlsImg::SBVI()); CtrlsImageLook(vlower, CtrlsImg::I_SBVL); CtrlsImageLook(hupper, CtrlsImg::I_SBHU); CtrlsImageLook(hthumb, CtrlsImg::I_SBHT, CtrlsImg::SBHI()); CtrlsImageLook(hlower, CtrlsImg::I_SBHL); Sb(up, CtrlsImg::UA()); Sb(up2, CtrlsImg::UA()); Sb(down, CtrlsImg::DA()); Sb(down2, CtrlsImg::DA()); Sb(left, CtrlsImg::LA()); Sb(left2, CtrlsImg::LA()); Sb(right, CtrlsImg::RA()); Sb(right2, CtrlsImg::RA()); isup2 = isdown2 = isleft2 = isright2 = false; }
//---------------------------------------------------------------------------// bool OBBClosestPoints ( LTVector3f& a, LTVector3f& b, const LTCoordinateFrameQ& A, const LTVector3f& da, const LTCoordinateFrameQ& B, const LTVector3f& db ) { //if A and B intersect, then a and b cannot be found if( OBBIntersect(A,da,B,db) ) return false; //compute the closest points a and b LTBoxSupportMap Sa( A.m_O, A, da ); LTBoxSupportMap Sb( B.m_O, B, db ); GJK_ClosestPoints( a, b, Sa, Sb ); return true; }
void Foam::tetrahedron<Point, PointRef>::gradNiGradNj ( tensorField& buffer ) const { // Warning. Ordering of edges needs to be the same for a tetrahedron // class, a tetrahedron cell shape model and a tetCell // Double change of sign between face area vector and gradient scalar magVol = Foam::mag(mag()); vector sa = Sa(); vector sb = Sb(); vector sc = Sc(); vector sd = Sd(); buffer[0] = (1.0/9.0)*(sa * sb)/magVol; buffer[1] = (1.0/9.0)*(sa * sc)/magVol; buffer[2] = (1.0/9.0)*(sa * sd)/magVol; buffer[3] = (1.0/9.0)*(sd * sb)/magVol; buffer[4] = (1.0/9.0)*(sb * sc)/magVol; buffer[5] = (1.0/9.0)*(sd * sc)/magVol; }
void excute(){ if(stall){ extype = 0; EX = "NOP"; }else { extype = idtype; EX = ID; } if(strcmp(EX,"ADD") == 0){ if(Add(rs,rt,rd) < 0){ error_no = 1; } }else if(strcmp(EX,"SUB") == 0){ if(Sub(rs,rt,rd) < 0){ error_no = 1; } }else if(strcmp(EX,"ADDU") == 0){ Add(rs,rt,rd); }else if(strcmp(EX,"AND") == 0){ And(rs,rt,rd); }else if(strcmp(EX,"OR") == 0){ Or(rs,rt,rd); }else if(strcmp(EX,"XOR") == 0){ Xor(rs,rt,rd); }else if(strcmp(EX,"NOR") == 0){ Nor(rs,rt,rd); }else if(strcmp(EX,"NAND") == 0){ Nand(rs,rt,rd); }else if(strcmp(EX,"SLT") == 0){ Slt(rs,rt,rd); }else if(strcmp(EX,"SLL") == 0){ Sll(rt,rd,shamt); }else if(strcmp(EX,"SRL") == 0){ Srl(rt,rd,shamt); }else if(strcmp(EX,"SRA") == 0){ Sra(rt,rd,shamt); }else if(strcmp(EX,"JR") == 0){ PC = registers[rs]; }else if(strcmp(EX,"ADDI") == 0){ if(Addi(rs,rt,imm)<0){ error_no = 1; } }else if(strcmp(EX,"ADDIU") == 0){ Addiu(rs,rt,imm); }else if(strcmp(EX,"LW") == 0){ Lw(rs,rt,imm); }else if(strcmp(EX,"LH") == 0){ Lh(rs,rt,imm); }else if(strcmp(EX,"LHU") == 0){ Lhu(rs,rt,imm); }else if(strcmp(EX,"LB") == 0){ Lb(rs,rt,imm); }else if(strcmp(EX,"LBU") == 0){ Lbu(rs,rt,imm); }else if(strcmp(EX,"SW") == 0){ Sw(rs,rt,imm); }else if(strcmp(EX,"SH") == 0){ Sh(rs,rt,imm); }else if(strcmp(EX,"SB") == 0){ Sb(rs,rt,imm); }else if(strcmp(EX,"LUI") == 0){ Lui(rt,imm); }else if(strcmp(EX,"ANDI") == 0){ Andi(rs,rt,imm); }else if(strcmp(EX,"ORI") == 0){ Ori(rs,rt,imm); }else if(strcmp(EX,"NORI") == 0){ Nori(rs,rt,imm); }else if(strcmp(EX,"SLTI") == 0){ Slti(rs,rt,imm); }else if(strcmp(EX,"JAL") == 0){ registers[31] = PC; PC = (PC)/(int)(Pow(2,28)+0.01)*(int)(Pow(2,28)+0.01) + ads*4; }else if(strcmp(EX,"J") == 0){ PC = (PC)/(int)(Pow(2,28)+0.01)*(int)(Pow(2,28)+0.01) + ads*4; }/*else if(strcmp(EX,"BEQ") == 0 || strcmp(EX,"BNE") == 0 || strcmp(EX,"BGTZ") == 0){ PC = go; }*/ }