PetaVision  Alpha
CheckpointEntryRandState.cpp
1 /*
2  * CheckpointEntryRandState.cpp
3  *
4  * Created on Oct 6, 2016
5  * Author: Pete Schultz
6  */
7 
8 #include "CheckpointEntryRandState.hpp"
9 #include "io/randomstateio.hpp"
10 
11 namespace PV {
12 
13 void CheckpointEntryRandState::write(
14  std::string const &checkpointDirectory,
15  double simTime,
16  bool verifyWritesFlag) const {
17  std::string path = generatePath(checkpointDirectory, "pvp");
18  writeRandState(
19  path, getMPIBlock(), mDataPointer, mLayerLoc, mExtendedFlag, simTime, verifyWritesFlag);
20 }
21 
22 void CheckpointEntryRandState::read(std::string const &checkpointDirectory, double *simTimePtr)
23  const {
24  std::string path = generatePath(checkpointDirectory, "pvp");
25  *simTimePtr = readRandState(path, getMPIBlock(), mDataPointer, mLayerLoc, mExtendedFlag);
26 }
27 
28 void CheckpointEntryRandState::remove(std::string const &checkpointDirectory) const {
29  deleteFile(checkpointDirectory, "bin");
30 }
31 
32 } // namespace PV