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(&currentFrame, &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();
}
예제 #2
0
	void aADD_pESIoIMM_iIMM( int off, int imm ) { _writeBytes(0x81,0x86); _writeInt(off); _writeInt(imm); }
예제 #3
0
	void aADD_EAX_iIMM( int imm ) { _writeBytes(0x05); _writeInt(imm); }
예제 #4
0
	void aADD_EAX_pESIoIMM( int off ) { _writeBytes(0x03,0x86); _writeInt(off); }
예제 #5
0
	void aMOV_pESIoIMM_uIMM( int off, unsigned int imm ) { _writeBytes(0xC7,0x86); _writeInt(off); _writeUint(imm); }
예제 #6
0
	void aMOV_pESIoIMM_EAX( int off ) { _writeBytes(0x89,0x86); _writeInt(off); }
예제 #7
0
	void aMOV_ECX_pESIoIMM( int off ) { _writeBytes(0x8b,0x8e); _writeInt(off); }
예제 #8
0
	void aCALL_IMM( unsigned int imm ) { _writeBytes(0xE8); _writeInt((int)imm-(int)_cursor-4); }
예제 #9
0
	void aJMP_IMM( unsigned int imm ) { _writeBytes(0xE9); _writeInt((int)imm-(int)_cursor-4); }