MBDyn-1.7.3
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups
StreamOutEcho Class Reference

#include <streamoutelem.h>

Collaboration diagram for StreamOutEcho:

Public Member Functions

 StreamOutEcho (std::string &sOutFileName, int iPrecision, doublereal dShift)
 
 ~StreamOutEcho (void)
 
bool Init (const std::string &msg, unsigned uLabel, unsigned nChannels)
 
void Echo (const doublereal *pbuf, unsigned nChannels)
 

Private Attributes

std::string sOutFileName
 
std::ofstream outFile
 
int iPrecision
 
doublereal dShift
 

Detailed Description

Definition at line 184 of file streamoutelem.h.

Constructor & Destructor Documentation

StreamOutEcho::StreamOutEcho ( std::string &  sOutFileName,
int  iPrecision,
doublereal  dShift 
)

Definition at line 462 of file streamoutelem.cc.

References NO_OP.

464 iPrecision(iPrecision),
465 dShift(dShift)
466 {
467  NO_OP;
468 }
doublereal dShift
#define NO_OP
Definition: myassert.h:74
std::string sOutFileName
StreamOutEcho::~StreamOutEcho ( void  )

Definition at line 470 of file streamoutelem.cc.

References NO_OP.

471 {
472  NO_OP;
473 }
#define NO_OP
Definition: myassert.h:74

Member Function Documentation

void StreamOutEcho::Echo ( const doublereal pbuf,
unsigned  nChannels 
)

Definition at line 508 of file streamoutelem.cc.

References outFile.

Referenced by BufferStreamElem_base::AfterConvergence().

509 {
510  outFile << pbuf[0];
511  for (unsigned i = 1; i < size; i++) {
512  outFile << " " << pbuf[i];
513  }
514  outFile << std::endl;
515 }
std::ofstream outFile
bool StreamOutEcho::Init ( const std::string &  msg,
unsigned  uLabel,
unsigned  nChannels 
)

Definition at line 476 of file streamoutelem.cc.

References iPrecision, MBDYN_EXCEPT_ARGS, outFile, and sOutFileName.

Referenced by BufferStreamElem_base::BufferStreamElem_base().

477 {
478  outFile.open(sOutFileName.c_str());
479  if (!outFile) {
480  silent_cerr(msg << "(" << uLabel << "): "
481  "unable to open echo file \"" << sOutFileName << "\"" << std::endl);
483  }
484 
485  if (iPrecision > 0) {
486  outFile.precision(iPrecision);
487  }
488  outFile.setf(std::ios::scientific);
489 
490  outFile
491  << "# generated by " << msg << "(" << uLabel << ")"
492  << std::endl;
493  if (nChannels == 1) {
494  outFile
495  << "# Channel #1"
496  << std::endl;
497 
498  } else {
499  outFile
500  << "# Channels #1-" << nChannels
501  << std::endl;
502  }
503 
504  return true;
505 }
#define MBDYN_EXCEPT_ARGS
Definition: except.h:63
std::ofstream outFile
struct mbrtai_msg_t msg
std::string sOutFileName

Member Data Documentation

doublereal StreamOutEcho::dShift
private

Definition at line 189 of file streamoutelem.h.

int StreamOutEcho::iPrecision
private

Definition at line 188 of file streamoutelem.h.

Referenced by Init().

std::ofstream StreamOutEcho::outFile
private

Definition at line 187 of file streamoutelem.h.

Referenced by Echo(), and Init().

std::string StreamOutEcho::sOutFileName
private

Definition at line 186 of file streamoutelem.h.

Referenced by Init().


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