FEData.cpp

00001 /*--------------------------------------------------------------------*/
00002 /*    Copyright 2005 Sandia Corporation.                              */
00003 /*    Under the terms of Contract DE-AC04-94AL85000, there is a       */
00004 /*    non-exclusive license for use of this work by or on behalf      */
00005 /*    of the U.S. Government.  Export of this program may require     */
00006 /*    a license from the United States Government.                    */
00007 /*--------------------------------------------------------------------*/
00008 
00009 #include <cstring>
00010 
00011 #include <fei_sstream.hpp>
00012 
00013 #include <test_utils/FEData.hpp>
00014 
00015 #undef fei_file
00016 #define fei_file "FEData.cpp"
00017 
00018 #include <fei_ErrMacros.hpp>
00019 
00020 int FEData::parameters(int numParams, char** params)
00021 {
00022   const char* param = snl_fei::getParamValue("debugOutput",
00023                 numParams,params);
00024   if (param != NULL){
00025     setDebugLog(1, param);
00026   }
00027 
00028   dbgOut() << "parameters" << FEI_ENDL
00029      << "   numParams: " << numParams << FEI_ENDL;
00030   for(int i=0; i<numParams; i++) {
00031     dbgOut() << "      param "<<i<<": '" << params[i] << "'" << FEI_ENDL;
00032   }
00033 
00034   return(0);
00035 }
00036 
00037 int FEData::setDebugLog(int debugOutputLevel, const char* path)
00038 {
00039   delete [] dbgPath_;
00040   dbgPath_ = NULL;
00041 
00042   if (dbgFileOpened_ == true) return(0);
00043 
00044   if (path != NULL) {
00045     dbgPath_ = new char[strlen(path)+1];
00046     std::strcpy(dbgPath_, path);
00047   }
00048   else {
00049     dbgPath_ = new char[2];
00050     std::strcpy(dbgPath_, ".");
00051   }
00052 
00053   debugOutputLevel_ = debugOutputLevel;
00054 
00055   if (debugOutputLevel_ <= 0) {
00056     dbgOStreamPtr_ = NULL;
00057   }
00058   else {
00059     if (dbgOStreamPtr_ != NULL) delete dbgOStreamPtr_;
00060     dbgOStreamPtr_ = NULL;
00061 
00062     FEI_OSTRINGSTREAM fname;
00063     fname << dbgPath_<<"/FEData."<<numProcs_<<"."<<localProc_;
00064     dbgFStreamPtr_ = new FEI_OFSTREAM(fname.str().c_str());
00065     dbgFileOpened_ = true;
00066     dbgOStreamPtr_ = dbgFStreamPtr_;
00067   }
00068 
00069   return(0);
00070 }
00071 

Generated on Wed May 12 21:30:40 2010 for FEI by  doxygen 1.4.7