MemStream::MemStream(const MemStream &s) { _pos = 0; _len = s.len(); _maxLen = _len; _data = new unsigned char[_len]; memcpy(_data, s.data(), _len); }
void avtStateRecorderIntegralCurve::Serialize(MemStream::Mode mode, MemStream &buff, avtIVPSolver *solver, SerializeFlags serializeFlags) { // Have the base class serialize its part avtIntegralCurve::Serialize(mode, buff, solver, serializeFlags); buff.io(mode, distance); buff.io(mode, historyMask); unsigned long saveSerializeFlags = serializeFlags | _serializeFlags; buff.io(mode, saveSerializeFlags); if (DebugStream::Level5()) { debug5<<" avtStateRecorderIntegralCurve::Serialize "<<(mode==MemStream::READ?"READ":"WRITE")<<" saveSerializeFlags= "<<saveSerializeFlags<<endl; } // R/W the steps. if (saveSerializeFlags & SERIALIZE_STEPS) buff.io(mode, history); if (saveSerializeFlags & SERIALIZE_INC_SEQ) { if (mode == MemStream::WRITE) { long seqCnt = sequenceCnt+1; buff.io(mode, seqCnt); } else buff.io(mode, sequenceCnt); } else buff.io(mode, sequenceCnt); if (DebugStream::Level5()) { debug5 << "DONE: avtStateRecorderIntegralCurve::Serialize. sz= "<<buff.len() << endl; } }
void avtIntegralCurve::Serialize(MemStream::Mode mode, MemStream &buff, avtIVPSolver *solver, SerializeFlags serializeFlags) { if (DebugStream::Level5()) { debug5 << " avtIntegralCurve::Serialize " << (mode==MemStream::READ?"READ":"WRITE")<<endl; } buff.io(mode, id); buff.io(mode, direction); buff.io(mode, blockList); buff.io(mode, status); buff.io(mode, counter); buff.io(mode, originatingRank); if (solver) { if (mode == MemStream::WRITE) { avtIVPState solverState; ivp->GetState(solverState); solverState.Serialize(mode, buff); } else { // TODO: //ivp->Serialize( mode, buff ); avtIVPState solverState; solverState.Serialize(mode, buff); if (ivp) delete ivp; ivp = solver->Clone(); ivp->PutState(solverState); } } #ifdef USE_IC_STATE_TRACKING if (mode == MemStream::WRITE) { trk<<"Serialize"<<endl; trk.close(); } else { trk<<flush; trk.close(); char tmp[64]; sprintf(tmp, "IC_%d.txt", (int)id); trk.open(tmp, ofstream::app); trk<<"De-serialize"<<endl; } #endif if (DebugStream::Level5()) { debug5 << "avtIntegralCurve::Serialize() size is " << buff.len() << endl; } }