◆ save() [1/2]

template<typename T >
void syten::save ( T &  t,
std::string const &  where 

Save an object into a file.

tobject to save
wherefilename of the target file
First attempts to create a temporary file in the same directory as where. If this succeeds, data is serialised into the temporary file and the temporary file is then moved into where. If the temporary file creation fails, the file where is created and data serialised into it directly. The former has the advantage that where does not exist until it is ready to be read in by other tools. However, e.g. when serialising into /dev/null, this approach fails (we cannot create a file /dev/.null.syten_tmp_part).
SYTEN_ASSERT triggers if either file creation or renaming fails.

References std::string::c_str(), std::ofstream::open(), std::rename(), std::string::rfind(), serialise_configuration(), std::strerror(), and SYTEN_ASSERT_MSG.

Referenced by create_ring_repulsion(), do_apply_op(), syten::MPS::SwappableTEBD::exponentiate_and_multiply(), syten::Pyten::expose_syten_class(), orthogonalise_run(), projector(), syten::Krylov::StateWrapper< syten::MPS::State >::save(), syten::MPS::DMRG::LBOWorker::save(), save(), syten::MPS::DMRG::Worker::save(), syten::BTT::DMRG::Run::save(), syten::MPS::TEBD::save_state(), syten::MPS::DMRG::LBOPDMRG::saveState(), syten::MPS::DMRG::PDMRG::saveState(), syten::BTT::DMRG::Run::saveState(), and syten::DMRG::DMRGStage::serialize().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: