FEI  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
FEData.cpp
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;
66  dbgOStreamPtr_ = dbgFStreamPtr_;
67  }
68 
69  return(0);
70 }
71 
int parameters(int numParams, char **params)
Definition: FEData.cpp:20