int main (int argc, char *argv[]) { //print usage cout << "\njemris " << VERSION; #ifdef GIT_COMMIT cout << " (" << GIT_COMMIT << ")"; #endif cout << "\n" << endl; if (argc==1) { usage(); return 0; } string input (argv[1]); //CASE 1: Dump list of modules in xml file if (input == "modlist") { SequenceTree* seqTree = SequenceTree::instance(); seqTree->SerializeModules("mod.xml"); //delete seqTree; return 0; } //CASE 2: try Dump of seq-diagram from Sequence xml-file SequenceTree* seqTree = SequenceTree::instance(); seqTree->Initialize(input); if (seqTree->GetStatus()) { seqTree->Populate(); ConcatSequence* seq = seqTree->GetRootConcatSequence(); seq->SeqDiag("seq.h5"); seq->DumpTree(); if (argc==3) seq->WriteStaticXML("jemris_seq.xml"); //delete seqTree; return 0; } //CASE 3: try simulation from Simulator xml-file Simulator sim (input); if (sim.GetStatus()) { static clock_t runtime = clock(); do_simu(&sim); runtime = clock() - runtime; printf ("Actual simulation took %.2f seconds.\n", runtime / 1000000.0); return 0; } //CASE 4: try Dump of sensitivities from CoilArray xml-file CoilArray* coils = new CoilArray(); cout << "dumping sensitivity maps to sensmaps.h5 ...\n"; coils->Initialize(input); if (coils->Populate() == OK) { coils->DumpSensMaps(true); cout << "done!\n"; return 0; } //OTHERWISE: not a valid input cout << input << " is not a valid input.\n"; return 0; }