OpenCAEPoro  v0.5.0
A simulator for multicomponent porous media flow
Public Member Functions | List of all members
Summary Class Reference

The Summary class manages the output in the summary file. More...

#include <OCPOutput.hpp>

Public Member Functions

void InputParam (const OutputSummary &summary_param)
 TODO: Add Doxygen.
 
void Setup (const Reservoir &reservoir, const OCP_DBL &totalTime)
 TODO: Add Doxygen.
 
void SetVal (const Reservoir &reservoir, const OCPControl &ctrl)
 TODO: Add Doxygen.
 
void PrintInfo (const string &dir) const
 Write output information to a file. More...
 

Detailed Description

The Summary class manages the output in the summary file.

Definition at line 103 of file OCPOutput.hpp.

Member Function Documentation

◆ PrintInfo()

void Summary::PrintInfo ( const string &  dir) const

Write output information to a file.

Write output information in the dir/SUMMARY.out file.

Definition at line 506 of file OCPOutput.cpp.

507 {
508  string FileOut = dir + "SUMMARY.out";
509  ofstream outF(FileOut);
510  if (!outF.is_open()) {
511  OCP_ABORT("Can not open " + FileOut);
512  }
513 
514  const USI ns = 12;
515  const USI col = 10;
516  const USI num = Sumdata.size();
517  const USI len = Sumdata[0].val.size();
518 
519  USI row = 0;
520  USI id = 0;
521  USI ID = 1;
522 
523  while (id != num) {
524 
525  outF << "Row " << ++row << "\n";
526 
527  // Item
528  outF << "\t" << setw(ns) << Sumdata[0].Item;
529 
530  id = ID;
531  for (USI i = 1; i < col; i++) {
532  outF << "\t" << setw(ns) << Sumdata[id++].Item;
533  if (id == num) break;
534  }
535  outF << "\n";
536 
537  // Unit
538  outF << "\t" << setw(ns) << Sumdata[0].Unit;
539 
540  id = ID;
541  for (USI i = 1; i < col; i++) {
542  outF << "\t" << setw(ns) << Sumdata[id++].Unit;
543  if (id == num) break;
544  }
545  outF << "\n";
546 
547  // Obj Name
548  outF << "\t" << setw(ns) << Sumdata[0].Obj;
549 
550  id = ID;
551  for (USI i = 1; i < col; i++) {
552  outF << "\t" << setw(ns) << Sumdata[id++].Obj;
553  if (id == num) break;
554  }
555  outF << "\n";
556 
557  // Data
558  for (USI l = 0; l < len; l++) {
559 
560  // Time
561  outF << "\t" << setw(ns) << fixed << setprecision(3) << Sumdata[0].val[l];
562 
563  id = ID;
564  for (USI i = 1; i < col; i++) {
565  if (Sumdata[id].Type == "int") {
566  outF << fixed << setprecision(0);
567  } else if (Sumdata[id].Type == "fixed") {
568  outF << fixed << setprecision(3);
569  } else if (Sumdata[id].Type == "float") {
570  outF << scientific << setprecision(5);
571  }
572  outF << "\t" << setw(ns) << Sumdata[id++].val[l];
573  if (id == num) break;
574  }
575  outF << "\n";
576  }
577 
578  ID += (col - 1);
579 
580  outF << "\n";
581  }
582 
583  outF.close();
584 }
unsigned int USI
Generic unsigned integer.
Definition: OCPConst.hpp:23
#define OCP_ABORT(msg)
Abort if critical error happens.
Definition: UtilError.hpp:47

References OCP_ABORT.


The documentation for this class was generated from the following files: