Ejemplo n.º 1
0
int main(int argc, char* argv[]){

#ifdef _DEBUG
  //enable exceptions so we can trap NaNs, etc.
  feenableexcept(FE_INVALID | FE_OVERFLOW);
#endif

  Int rank, np;
  Int mode = 0;
  Int ndv = 0;
  Real* dObjdBeta = NULL;
  
  std::vector<Param<Real>* > paramList; 
  SolutionOrdering<Real> operations;
  TemporalControl<Real> temporalControl;

  string tempname;
  stringstream temposs;

  TimerList timers(5);
  timers.CreateTimer("MPI_InitTimer");
  timers.CreateTimer("SolveTimer");
  timers.CreateTimer("DesignTimer");
  timers.CreateTimer("MovementTimer");

  //create parallel object for comms
  timers.StartTimer("MPI_InitTimer");
  MPI_Init(&argc, &argv);
  MPI_Comm_rank(MPI_COMM_WORLD, &rank);
  MPI_Comm_size(MPI_COMM_WORLD, &np);
  timers.StopTimer("MPI_InitTimer");

  PObj<Real> pobj;
  rank = pobj.GetRank();
  //remove Abort.Log if its present
  if(rank == 0){
    remove("Abort.Log");
  }
  
  if(!((argc == 2) || (argc == 3))){
    cerr << "Invalid arguments!!!" << endl;
    cerr << "USE: " << argv[0] << " <casename>" << endl;
    cerr << "OR" << endl;
    cerr << "USE: " << argv[0] << " <casename> <design type>" << endl;
    cerr << "<design type> - none = 0" << endl;
    cerr << "<design type> - objective f-n evaluation = 1" << endl;
    cerr << "<design type> - direct = 2" << endl;
    cerr << "<design type> - adjoint = 3" << endl;
    cerr << "<design type> - CTSE = 4" << endl;
    cerr << "<design type> - GRID SMOOTHING = 5" << endl;
    cerr << "<design type> - Compute Mesh Sensitivity = 6" << endl;
    cerr << "<design type> - Finite Difference = 7" << endl;

    //dumps all options in param file to output
    Param<Real> tmp;
    tmp.PrintAllParams();

    MPI_Finalize();
    return (1);
  }

  std::string casestring = argv[1];
  size_t pos = casestring.rfind('/');
  std::string pathname;
  if(pos != std::string::npos){
    pathname = casestring.substr(0, pos+1);
    casestring = casestring.substr(pos);
  }
  else{
    pathname = "./";
  }

  //set pathname in abort class
  Abort.rootDirectory = pathname;

  if(argc == 3){
    temposs.clear();
    temposs.str("");
    temposs << argv[2];
    temposs >> mode;
  }