Ejemplo n.º 1
0
int main() {
  int i;
  int j;
  
  int currentProcess;
  
  heavyLine();
  printf("filesystem self test\n");
  heavyLine();
  printf("\n");
  
  // initialize the filesystem and the pagetable
  fs_initialize();
  pt_initialize();
  
  // import programs
  fs_import("./programs.cpu/prog1out.cpu", "prog1");
  fs_nodeList();
  fs_dump();
  
  pt_dump();

  // set current program (global)
  currentProgramId = 1;
  currentProcess = 0;
  
  for (i = 0; i < fs_getProcessSize(currentProgramId, currentProcess); i++) {
    printf("instruction: %d \n", pt_getInstruction(currentProcess, i));
  }
  
  starLine();
  currentProcess = 1;
  for (i = 0; i < fs_getProcessSize(currentProgramId, currentProcess); i++) {
    printf("instruction: %d \n", pt_getInstruction(currentProcess, i));
  }
  
  starLine();
  currentProcess = 2;
  for (i = 0; i < fs_getProcessSize(currentProgramId, currentProcess); i++) {
    printf("instruction: %d \n", pt_getInstruction(currentProcess, i));
  }
  
  pt_dump();
  
  return 0;
}
  //! Output formatted description of stopping test to output stream.
  void print(std::ostream& os, int indent = 0) const {
    std::string ind(indent,' ');
    std::string starLine(55,'*');
    std::string starFront(5,'*');

    os.setf(std::ios::scientific, std::ios::floatfield);
    os.precision(6);
    
    // Print header if this is the first call to this output status test.
    if (!headerPrinted_) {
      os << std::endl << ind << starLine << std::endl;
      os << ind << starFront << " Belos Iterative Solver: " << solverDesc_ << std::endl;
      if (precondDesc_ != "")
        os << ind << starFront << " Preconditioner: " << precondDesc_ << std::endl;
      os << ind << starFront << " Maximum Iterations: " << iterTest_->getMaxIters() << std::endl;
      os << ind << starFront << " Block Size: " << blockSize_ << std::endl;
      if (numResTests_ > 1) {
        os << ind << starFront << " Residual Tests (" 
           << ((comboType_ == StatusTestCombo_t::OR) ? "OR" : (comboType_ == StatusTestCombo_t::AND) ? "AND" :"SEQ")
           << "): " << std::endl;
      } else {
        os << ind << starFront << " Residual Test: " << std::endl;
      } 
      for (int i=0; i<numResTests_; ++i) {
        os << ind << starFront << "   Test " << i+1 << " : " << resTestVec_[i]->description() << std::endl;
      }
      os << ind << starLine << std::endl;
      headerPrinted_ = true;
    }

    // Print out residuals for each residual test.
    os.setf(std::ios_base::right, std::ios_base::adjustfield);
    std::string ind2( 7 + numIterDgts_, ' ' );
    os << ind << "Iter " << std::setw(numIterDgts_) << iterTest_->getNumIters() << ", ";
    for (int i=0; i<currNumRHS_; ++i) {
      if ( i > 0 && currIdx_[i]!=-1 ) {
        // Put in space where 'Iter :' is in the previous lines
        os << ind << ind2;
      }
      os << "[" << std::setw(numLSDgts_) << currIdx_[i]+1 << "] : ";
      for (int j=0; j<numResTests_; ++j) {
        if ( resTestVec_[j]->getStatus() != Undefined && currIdx_[i]!=-1 ) {
          os << std::setw(15) << (*resTestVec_[j]->getTestValue())[currIdx_[i]];
        } else {
          os << std::setw(15) << "---"; 
        }
      }
      os << std::endl;
    }
  }