move command line processing into class openEMS
parent
686cb3f4cb
commit
79574aa3e6
17
main.cpp
17
main.cpp
|
@ -42,22 +42,7 @@ int main(int argc, char *argv[])
|
|||
{
|
||||
for (int n=2;n<argc;++n)
|
||||
{
|
||||
if (strcmp(argv[n],"--disable-dumps")==0)
|
||||
{
|
||||
cout << "openEMS - disabling all field dumps" << endl;
|
||||
FDTD.SetEnableDumps(false);
|
||||
}
|
||||
else if (strcmp(argv[n],"--debug-material")==0)
|
||||
{
|
||||
cout << "openEMS - dumping material to 'material_dump.vtk'" << endl;
|
||||
FDTD.DebugMaterial();
|
||||
}
|
||||
else if (strcmp(argv[n],"--debug-operator")==0)
|
||||
{
|
||||
cout << "openEMS - dumping operator to 'operator_dump.vtk'" << endl;
|
||||
FDTD.DebugOperator();
|
||||
}
|
||||
else
|
||||
if (!FDTD.parseCommandLineArgument(argv[n]))
|
||||
cout << "openEMS - unknown argument: " << argv[n] << endl;
|
||||
}
|
||||
}
|
||||
|
|
30
openems.cpp
30
openems.cpp
|
@ -69,6 +69,36 @@ void openEMS::Reset()
|
|||
PA=NULL;
|
||||
}
|
||||
|
||||
//! \brief processes a command line argument
|
||||
//! returns true if argument is known
|
||||
//! returns false if argument is unknown
|
||||
bool openEMS::parseCommandLineArgument( const char *argv )
|
||||
{
|
||||
if (!argv)
|
||||
return false;
|
||||
|
||||
if (strcmp(argv,"--disable-dumps")==0)
|
||||
{
|
||||
cout << "openEMS - disabling all field dumps" << endl;
|
||||
SetEnableDumps(false);
|
||||
return true;
|
||||
}
|
||||
else if (strcmp(argv,"--debug-material")==0)
|
||||
{
|
||||
cout << "openEMS - dumping material to 'material_dump.vtk'" << endl;
|
||||
DebugMaterial();
|
||||
return true;
|
||||
}
|
||||
else if (strcmp(argv,"--debug-operator")==0)
|
||||
{
|
||||
cout << "openEMS - dumping operator to 'operator_dump.vtk'" << endl;
|
||||
DebugOperator();
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
int openEMS::SetupFDTD(const char* file)
|
||||
{
|
||||
if (file==NULL) return -1;
|
||||
|
|
Loading…
Reference in New Issue