Commit 7cf9c651 authored by Kilian Lackhove's avatar Kilian Lackhove
Browse files

dont overwrite chk files

parent 3104922e
......@@ -109,6 +109,7 @@ namespace Nektar
string sessionname = "SessionName";
sessionname += boost::lexical_cast<std::string>(i);
m_fieldMetaDataMap[sessionname] = filenames[i];
m_fieldMetaDataMap["ChkFileNum"] = boost::lexical_cast<std::string>(0);
}
}
......@@ -661,7 +662,7 @@ namespace Nektar
m_session->LoadParameter("NumQuadPointsError",
m_NumQuadPointsError, 0);
m_nchk = 1;
m_nchk = 0;
// Zero all physical fields initially
ZeroPhysFields();
......@@ -1237,11 +1238,11 @@ namespace Nektar
if (dumpInitialConditions && m_checksteps)
{
Checkpoint_Output(0);
Checkpoint_Output(m_nchk);
m_nchk++;
}
}
void EquationSystem::v_EvaluateExactSolution(
unsigned int field,
Array<OneD, NekDouble> &outfield,
......@@ -1986,6 +1987,13 @@ namespace Nektar
{
std::string outname = m_sessionName + "_" +
boost::lexical_cast<std::string>(n);
int cnt = 0;
while (std::ifstream(std::string(outname + ".chk").c_str()))
{
outname = m_sessionName + "_" +
boost::lexical_cast<std::string>(n) + "_" +
boost::lexical_cast<std::string>(cnt);
}
WriteFld(outname + ".chk");
}
......@@ -2000,9 +2008,15 @@ namespace Nektar
std::vector<Array<OneD, NekDouble> > &fieldcoeffs,
std::vector<std::string> &variables)
{
char chkout[16] = "";
sprintf(chkout, "%d", n);
std::string outname = m_sessionName + "_" + chkout + ".chk";
std::string outname = m_sessionName + "_" +
boost::lexical_cast<std::string>(n);
int cnt = 0;
while (std::ifstream(std::string(outname + ".chk").c_str()))
{
outname = m_sessionName + "_" +
boost::lexical_cast<std::string>(n) + "_" +
boost::lexical_cast<std::string>(cnt);
}
WriteFld(outname, field, fieldcoeffs, variables);
}
......@@ -2086,6 +2100,12 @@ namespace Nektar
{
m_fieldMetaDataMap["Time"] = boost::lexical_cast<std::string>(m_time);
}
// Update step in field info if required
if(m_fieldMetaDataMap.find("ChkFileNum") != m_fieldMetaDataMap.end())
{
m_fieldMetaDataMap["ChkFileNum"] = boost::lexical_cast<std::string>(m_nchk);
}
// If necessary, add mapping information to metadata
// and output mapping coordinates
......
......@@ -376,7 +376,8 @@ namespace Nektar
transformed[i] = true;
}
}
Checkpoint_Output(m_nchk++);
Checkpoint_Output(m_nchk);
m_nchk++;
for(i = 0; i < nfields; i++)
{
if (transformed[i])
......@@ -391,7 +392,8 @@ namespace Nektar
}
else
{
Checkpoint_Output(m_nchk++);
Checkpoint_Output(m_nchk);
m_nchk++;
}
doCheckTime = false;
}
......@@ -456,7 +458,7 @@ namespace Nektar
*/
void UnsteadySystem::v_DoInitialise()
{
CheckForRestartTime(m_time);
CheckForRestartTime(m_time, m_nchk);
SetBoundaryConditions(m_time);
SetInitialConditions(m_time);
}
......@@ -695,7 +697,7 @@ namespace Nektar
}
}
void UnsteadySystem::CheckForRestartTime(NekDouble &time)
void UnsteadySystem::CheckForRestartTime(NekDouble &time, int &nchk)
{
if (m_session->DefinesFunction("InitialConditions"))
{
......@@ -738,6 +740,13 @@ namespace Nektar
time = boost::lexical_cast<NekDouble>(
iter->second);
}
iter = m_fieldMetaDataMap.find("ChkFileNum");
if (iter != m_fieldMetaDataMap.end())
{
nchk = boost::lexical_cast<NekDouble>(
iter->second);
}
}
break;
......
......@@ -142,7 +142,7 @@ namespace Nektar
return true;
}
SOLVER_UTILS_EXPORT void CheckForRestartTime(NekDouble &time);
SOLVER_UTILS_EXPORT void CheckForRestartTime(NekDouble &time, int &nchk);
/// \brief Evaluate the SVV diffusion coefficient
/// according to Moura's paper where it should
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment