diff --git a/AMDiS/src/Parameters.cc b/AMDiS/src/Parameters.cc index 9acb78f9c6644ea85440fc6959dd91d259009352..5a407658b26608fb1ee2323383074a7b606d140b 100644 --- a/AMDiS/src/Parameters.cc +++ b/AMDiS/src/Parameters.cc @@ -507,73 +507,16 @@ namespace AMDiS { singlett->read(fn); } else { singlett->inputFile.open(fn.data(), std::ios::in); - if (!(singlett->inputFile.rdstate())) { + if (!(singlett->inputFile.rdstate())) { ERROR("can not read from file %s\n", fn.data()); return; } singlett->inputFile.close(); - time(&act_time); - if (sys_test("test -w", "/tmp")) { /* you may write to /tmp */ - file = fn.substr(fn.find_last_of("/\\")); - tmp_file << "/tmp/"<<file<< ".cpp"; - if (sys_test("test -f", tmp_file.str())) { /* file exists :-( */ - tmp_file.freeze(false); - tmp_file<< "."<< static_cast<int>( act_time); - if (sys_test("test -f", tmp_file.str())) /* file exists :-( */ - *(tmp_file.str()) = '\0'; - } - } - - if (*(tmp_file.str()) == '\0') - if (sys_test("test -f", tmp_file.str()+5)) - *(tmp_file.str()) = '\0'; - - if (*(tmp_file.str())!='\0' && (outFile.open(tmp_file.str()))) { - outFile.close(); - } else { - ERROR("could not open temporary file for CPP\n"); - ERROR("can not write to /tmp and files %s.cpp and\n", fn); - ERROR_EXIT("%s.cpp.%d either exist or are not writable\n", - fn, act_time); - } - - tmp_file.freeze(false); - - cpp_flags<< "-DDIM="<<DIM<<" -DDIM_OF_WORLD="<<Global::getGeo(WORLD); - if (flags) - cpp_flags << flags; - - call_cpp << CPP <<" "<<cpp_flags<<" "<<fn<< " > "<<tmp_file; - - /****************************************************************************/ - /* invoke cpp: */ - /****************************************************************************/ - - val = system(call_cpp.str()); - if (val) { - MSG("val = %d\n", val); - ERROR("error during cpp call; reading file %s without help of cpp\n", fn); - WAIT; - init(p, fn); - return; - } - - /**********************************************************************/ - /* read parameters from temp file */ - /**********************************************************************/ - - cpp_read = true; - singlett->read(tmp_file); - cpp_read = false; - /**********************************************************************/ - /* remove temp file */ - /**********************************************************************/ - - sprintf(call_cpp.str(), "/bin/rm %s", tmp_file.str()); - val = system(call_cpp.str()); - call_cpp.freeze(false); - tmp_file.freeze(false); + ERROR("no cpp available; reading file %s without help of cpp\n", fn.c_str()); + init(p, fn); + + return; } val = 10; // default for level of information @@ -591,7 +534,7 @@ namespace AMDiS { if (!singlett->msgInfo) singlett->paramInfo = 0; - if (p && singlett->msgInfo) + if (p && singlett->msgInfo) printParameters(); Global::init(); @@ -644,8 +587,6 @@ namespace AMDiS { { FUNCNAME("Parameters::addGlobalParameter()"); - int val; - initIntern(); if (key.size() == 0 || par.size() == 0) @@ -653,7 +594,7 @@ namespace AMDiS { singlett->addParam(key, par, std::string(file), line, fname); - val = 10; // defualt for level of information + int val = 10; // defualt for level of information getGlobalParameter(0, "level of information", "%d", &val); singlett->msgInfo = val; @@ -683,13 +624,12 @@ namespace AMDiS { return NULL; int wb2 = s->find_first_of(" "); - if (wb2 == static_cast<int>(std::string::npos)) { + if (wb2 == static_cast<int>(std::string::npos)) wb2 = s->length(); - } - - s->copy(Val, wb2-wb1, wb1); + + s->copy(Val, wb2 - wb1, wb1); - Val[wb2-wb1] = '\0'; + Val[wb2 - wb1] = '\0'; return Val; } @@ -702,7 +642,7 @@ namespace AMDiS { initIntern(); fp.open(file.data(), std::ios::out); - if (0 != fp.rdstate()) + if (0 != fp.rdstate()) return; for (it = singlett->allParam.begin(); it !=singlett->allParam.end(); it++) {