Commit 7ab1dd08 authored by Dave Moxey's avatar Dave Moxey
Browse files

Merge branch 'fix/session-name-prepartitioned' into 'master'

Fix/session name prepartitioned

This MR includes the following:
* Fixes the determination of the session name from pre-partitioned mesh directories.
* Remove code duplication of the determination of the session name into a separate function.
* Removes the m_filename parameter (since it no longer makes sense when we can load multiple files) from the session reader.
* Improves the error messages in parsing parameters and solver info to show the erroneous XML element.
* Fixes a segfault if a parameter such as "Test = 1 2" is given.
* Detect when boundary conditions with same ID appears multiple times.

This fixes tickets #148 and #122.

See merge request !426
parents dd9c2912 3f683c7e
......@@ -16,8 +16,6 @@ int main(int argc, char *argv[])
LibUtilities::CommSharedPtr vComm = vSession->GetComm();
string meshfile(vSession->GetFilename());
MultiRegions::ContField3DHomogeneous1DSharedPtr Exp_u, Exp_v, Exp_w;
StdRegions::ConstFactorMap factors;
......
......@@ -15,8 +15,6 @@ int main(int argc, char *argv[])
LibUtilities::CommSharedPtr vComm = vSession->GetComm();
string meshfile(vSession->GetFilename());
MultiRegions::ContField3DHomogeneous1DSharedPtr Exp_u, Exp_v, Exp_w;
StdRegions::ConstFactorMap factors;
......
......@@ -16,8 +16,6 @@ int main(int argc, char *argv[])
LibUtilities::CommSharedPtr vComm = vSession->GetComm();
string meshfile(vSession->GetFilename());
MultiRegions::ContField3DHomogeneous2DSharedPtr Exp_u, Exp_v, Exp_w;
StdRegions::ConstFactorMap factors;
......
......@@ -25,7 +25,6 @@ int main(int argc, char *argv[])
int coordim;
Array<OneD,NekDouble> sol;
Array<OneD,NekDouble> xc0,xc1,xc2;
std::string meshfile(vSession->GetFilename());
if(argc != 2)
{
......
......@@ -20,7 +20,6 @@ int main(int argc, char *argv[])
int i, j, nq, coordim;
Array<OneD,NekDouble> fce;
Array<OneD,NekDouble> xc0,xc1,xc2;
std::string meshfile(vSession->GetFilename());
if(argc != 2)
{
......
......@@ -21,7 +21,6 @@ int main(int argc, char *argv[])
int i, j, nq, coordim;
Array<OneD,NekDouble> fce;
Array<OneD,NekDouble> xc0,xc1,xc2;
std::string meshfile(vSession->GetFilename());
if(argc != 2)
{
......
......@@ -22,7 +22,6 @@ int main(int argc, char *argv[])
int nq, coordim;
Array<OneD,NekDouble> fce;
Array<OneD,NekDouble> xc0,xc1,xc2;
std::string meshfile(vSession->GetFilename());
if(argc != 3)
{
......
......@@ -15,7 +15,6 @@ int main(int argc, char *argv[])
{
LibUtilities::SessionReaderSharedPtr vSession
= LibUtilities::SessionReader::CreateInstance(argc, argv);
string meshfile(vSession->GetFilename());
MultiRegions::ExpList1DSharedPtr Exp,Sol;
int i,j;
......
......@@ -16,7 +16,6 @@ int main(int argc, char *argv[])
{
LibUtilities::SessionReaderSharedPtr vSession
= LibUtilities::SessionReader::CreateInstance(argc, argv);
string meshfile(vSession->GetFilename());
MultiRegions::ExpList2DSharedPtr Exp,Fce;
int i, j, nq, coordim;
......
......@@ -17,8 +17,6 @@ int main(int argc, char *argv[])
LibUtilities::SessionReaderSharedPtr vSession
= LibUtilities::SessionReader::CreateInstance(argc, argv);
string meshfile(vSession->GetFilename());
MultiRegions::ExpList3DSharedPtr Exp,Fce;
int i, j, nq, coordim;
Array<OneD,NekDouble> fce, tmp, tmp2;
......
......@@ -25,8 +25,6 @@ int main(int argc, char *argv[])
LibUtilities::SessionReaderSharedPtr vSession
= LibUtilities::SessionReader::CreateInstance(argc, argv);
string meshfile(vSession->GetFilename());
MultiRegions::ContField2DSharedPtr Exp,Fce;
int nq, coordim;
Array<OneD,NekDouble> fce;
......
......@@ -15,7 +15,6 @@ int main(int argc, char *argv[])
= LibUtilities::SessionReader::CreateInstance(argc, argv);
LibUtilities::CommSharedPtr vComm = vSession->GetComm();
string meshfile(vSession->GetFilename());
MultiRegions::DisContField1DSharedPtr Exp,Fce;
int i, nq, coordim;
......
......@@ -23,7 +23,6 @@ int main(int argc, char *argv[])
Array<OneD,NekDouble> fce;
Array<OneD,NekDouble> xc0,xc1,xc2;
StdRegions::ConstFactorMap factors;
string meshfile(vSession->GetFilename());
if( (argc != 2) && (argc != 3) && (argc != 4))
{
......
......@@ -17,7 +17,6 @@ int main(int argc, char *argv[])
= LibUtilities::SessionReader::CreateInstance(argc, argv);
LibUtilities::CommSharedPtr vComm = vSession->GetComm();
string meshfile(vSession->GetFilename());
MultiRegions::ContField3DHomogeneous2DSharedPtr Exp, Fce;
int nq;
......
......@@ -26,7 +26,6 @@ int main(int argc, char *argv[])
= LibUtilities::SessionReader::CreateInstance(argc, argv);
LibUtilities::CommSharedPtr vComm = vSession->GetComm();
string meshfile(vSession->GetFilename());
MultiRegions::ContField2DSharedPtr Exp,Fce;
int i, nq, coordim;
......
......@@ -80,14 +80,16 @@ namespace Nektar
{
m_expr_id = -1;
std::string msg(std::string("Equation::Equation() fails on expression [") + m_expr + std::string("]\n"));
ASSERTL0(false, msg + std::string("ERROR: ") + e.what());
ASSERTL1(false, msg);
throw e;
return;
}
catch (const std::string& e)
{
m_expr_id = -1;
std::string msg(std::string("Equation::Equation() fails on expression [") + m_expr + std::string("]\n"));
ASSERTL0(false, msg + std::string("ERROR: ") + e);
ASSERTL1(false, msg);
throw e;
return;
}
}
......
......@@ -187,7 +187,8 @@ namespace Nektar
LIB_UTILITIES_EXPORT bool DefinesElement(
const std::string& pPath) const;
/// Returns the filename of the loaded XML document.
LIB_UTILITIES_EXPORT const std::string &GetFilename() const;
LIB_UTILITIES_EXPORT const std::vector<std::string>
&GetFilenames() const;
/// Returns the session name of the loaded XML document.
LIB_UTILITIES_EXPORT const std::string &GetSessionName() const;
/// Returns the session name with process rank
......@@ -432,8 +433,6 @@ namespace Nektar
CommSharedPtr m_comm;
/// Filenames
std::vector<std::string> m_filenames;
/// Filename of the loaded XML document.
std::string m_filename;
/// Session name of the loaded XML document (filename minus ext).
std::string m_sessionName;
/// Pointer to the loaded XML document.
......@@ -486,6 +485,9 @@ namespace Nektar
std::vector<std::string> ParseCommandLineArguments(
int argc, char *argv[]);
/// Parse the session name.
std::string ParseSessionName(std::vector<std::string> &filenames);
/// Loads an xml file into a tinyxml doc and decompresses if needed
LIB_UTILITIES_EXPORT void LoadDoc(
const std::string &pFilename,
......@@ -513,8 +515,6 @@ namespace Nektar
/// Reads the GLOBALSYSSOLNINFO section of the XML document.
LIB_UTILITIES_EXPORT void ReadGlobalSysSolnInfo(
TiXmlElement *conditions);
/// Reads the GEOMETRICINFO section of the XML document.
LIB_UTILITIES_EXPORT void ReadGeometricInfo(TiXmlElement *geometry);
/// Reads the EXPRESSIONS section of the XML document.
LIB_UTILITIES_EXPORT void ReadExpressions(TiXmlElement *conditions);
/// Reads the VARIABLES section of the XML document.
......
......@@ -439,6 +439,12 @@ namespace Nektar
ASSERTL1(parseInfo.full != false, "Unable to fully parse function. Stopped just before: "
+ std::string(parseInfo.stop, parseInfo.stop + 15));
if (!parseInfo.full)
{
throw std::runtime_error("Unable to fully parse function at: "
+ std::string(parseInfo.stop, parseInfo.stop + 15));
}
// ----------------------------------------------
// Data parsed, start setting up internal data structures.
......
......@@ -172,8 +172,8 @@ namespace Nektar
int cycle = 0;
const char* problem = ArpackProblemTypeTrans[m_session->GetSolverInfoAsEnum<int>("ArpackProblemType")].c_str();
std::string name = m_session->GetFilename().substr(0,m_session->GetFilename().find_last_of('.'))+".evl";
std::string name = m_session->GetSessionName() + ".evl";
ofstream pFile(name.c_str());
ido = 0; //At the first call must be initialisedat 0
......@@ -286,9 +286,9 @@ namespace Nektar
{
WriteEvs(out,i,dr[i],di[i]);
WriteEvs(pFile,i,dr[i],di[i]);
std::string file = m_session->GetFilename().substr(0,m_session->GetFilename().find_last_of('.')) + "_eig_" + boost::lexical_cast<std::string>(i);
std::string file = m_session->GetSessionName() + "_eig_"
+ boost::lexical_cast<std::string>(i);
WriteFld(file,z + i*nq);
}
......
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