SyTen

◆ save() [2/2]

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

Save an object into a file.

Parameters
tobject to save
wherefilename of the target file
Remarks
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 do_apply_op(), syten::T3N::TDVP::Worker::do_step(), syten::Pyten::expose_syten_class(), orthogonalise_run(), syten::MPS::DMRG::PDMRG::run(), syten::T3N::DMRG::Run::run(), syten::T3N::TDVP::Worker::run(), syten::MPS::TDVP::LBOWorker::run(), syten::MPS::TDVP::PTDVP< enable >::run(), syten::MPS::QcLatticeGenerator::save(), syten::T3N::QcLatticeGenerator::save(), syten::Krylov::StateWrapper< StateT, TruncT >::save(), save(), syten::MPS::TEBD::save_state(), syten::MPS::DMRG::LBOPDMRG::saveState(), syten::T3N::DMRG::Run::saveState(), syten::MPS::TDVP::PTDVP< enable >::saveState(), and syten::MPS::DMRG::PDMRG::saveState().

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