FEI Package Browser (Single Doxygen Collection)  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
FEData.cpp
Go to the documentation of this file.
1 /*--------------------------------------------------------------------*/
2 /* Copyright 2005 Sandia Corporation. */
3 /* Under the terms of Contract DE-AC04-94AL85000, there is a */
4 /* non-exclusive license for use of this work by or on behalf */
5 /* of the U.S. Government. Export of this program may require */
6 /* a license from the United States Government. */
7 /*--------------------------------------------------------------------*/
8 
9 #include <cstring>
10 
11 #include <fei_sstream.hpp>
12 
13 #include <test_utils/FEData.hpp>
14 
15 #undef fei_file
16 #define fei_file "FEData.cpp"
17 
18 #include <fei_ErrMacros.hpp>
19 
20 int FEData::parameters(int numParams, char** params)
21 {
22  const char* param = snl_fei::getParamValue("debugOutput",
23  numParams,params);
24  if (param != NULL){
25  setDebugLog(1, param);
26  }
27 
28  dbgOut() << "parameters" << FEI_ENDL
29  << " numParams: " << numParams << FEI_ENDL;
30  for(int i=0; i<numParams; i++) {
31  dbgOut() << " param "<<i<<": '" << params[i] << "'" << FEI_ENDL;
32  }
33 
34  return(0);
35 }
36 
37 int FEData::setDebugLog(int debugOutputLevel, const char* path)
38 {
39  delete [] dbgPath_;
40  dbgPath_ = NULL;
41 
42  if (dbgFileOpened_ == true) return(0);
43 
44  if (path != NULL) {
45  dbgPath_ = new char[strlen(path)+1];
46  std::strcpy(dbgPath_, path);
47  }
48  else {
49  dbgPath_ = new char[2];
50  std::strcpy(dbgPath_, ".");
51  }
52 
53  debugOutputLevel_ = debugOutputLevel;
54 
55  if (debugOutputLevel_ <= 0) {
56  dbgOStreamPtr_ = NULL;
57  }
58  else {
59  if (dbgOStreamPtr_ != NULL) delete dbgOStreamPtr_;
60  dbgOStreamPtr_ = NULL;
61 
62  FEI_OSTRINGSTREAM fname;
63  fname << dbgPath_<<"/FEData."<<numProcs_<<"."<<localProc_;
64  dbgFStreamPtr_ = new FEI_OFSTREAM(fname.str().c_str());
65  dbgFileOpened_ = true;
67  }
68 
69  return(0);
70 }
71 
int setDebugLog(int debugOutputLevel, const char *path)
Definition: FEData.cpp:37
int debugOutputLevel_
Definition: FEData.hpp:401
int localProc_
Definition: FEData.hpp:399
int parameters(int numParams, char **params)
Definition: FEData.cpp:20
char * dbgPath_
Definition: FEData.hpp:402
#define dbgOut()
Definition: FEData.hpp:17
#define FEI_OFSTREAM
Definition: fei_fstream.hpp:14
FEI_OFSTREAM * dbgFStreamPtr_
Definition: FEData.hpp:405
#define FEI_ENDL
FEI_OSTREAM * dbgOStreamPtr_
Definition: FEData.hpp:403
bool dbgFileOpened_
Definition: FEData.hpp:404
#define FEI_OSTRINGSTREAM
Definition: fei_sstream.hpp:32
const char * getParamValue(const char *key, int numParams, const char *const *paramStrings, char separator=' ')
int numProcs_
Definition: FEData.hpp:399