void FluidSimulationSaveState::saveState(std::string filename, FluidSimulation *_fluidsim) { std::ofstream erasefile; erasefile.open(filename, std::ofstream::out | std::ofstream::trunc); erasefile.close(); std::ofstream state(filename.c_str(), std::ios::out | std::ios::binary); int i, j, k; _fluidsim->getGridDimensions(&i, &j, &k); double dx = _fluidsim->getCellSize(); _width = i; _height = j; _depth = k; // i, j, k, dx _writeInt(&i, &state); _writeInt(&j, &state); _writeInt(&k, &state); _writeDouble(&dx, &state); // number of marker particles int n = _fluidsim->getNumMarkerParticles(); _writeInt(&n, &state); // next frame to be processed int currentFrame = _fluidsim->getCurrentFrame(); _writeInt(¤tFrame, &state); // number of solid cell indices int numIndices = _getNumSolidCells(_fluidsim); _writeInt(&numIndices, &state); // floats: marker particle positions in form [x1, y1, z1, x2, y2, z2, ...] _writeBinaryMarkerParticlePositions(_fluidsim, &state); // floats: marker particle velocities in form [x1, y1, z1, x2, y2, z2, ...] _writeBinaryMarkerParticleVelocities(_fluidsim, &state); // ints: solid cell indicies in form [i1, j1, k1, i2, j2, k2, ...] _writeSolidCellIndices(_fluidsim, &state); state.close(); }
void aADD_pESIoIMM_iIMM( int off, int imm ) { _writeBytes(0x81,0x86); _writeInt(off); _writeInt(imm); }
void aADD_EAX_iIMM( int imm ) { _writeBytes(0x05); _writeInt(imm); }
void aADD_EAX_pESIoIMM( int off ) { _writeBytes(0x03,0x86); _writeInt(off); }
void aMOV_pESIoIMM_uIMM( int off, unsigned int imm ) { _writeBytes(0xC7,0x86); _writeInt(off); _writeUint(imm); }
void aMOV_pESIoIMM_EAX( int off ) { _writeBytes(0x89,0x86); _writeInt(off); }
void aMOV_ECX_pESIoIMM( int off ) { _writeBytes(0x8b,0x8e); _writeInt(off); }
void aCALL_IMM( unsigned int imm ) { _writeBytes(0xE8); _writeInt((int)imm-(int)_cursor-4); }
void aJMP_IMM( unsigned int imm ) { _writeBytes(0xE9); _writeInt((int)imm-(int)_cursor-4); }