src/viz/Ensight_Stream.cc
void Ensight_Stream::open(const std::string &file_name, const bool binary, const bool geom_file,
                          const bool decomposed) {
  Require(!file_name.empty());

  d_binary = binary;

  // Open the stream.
  if (decomposed) {
    if (binary)
      d_decomposed_stream = std::make_unique<rtt_c4::ofpstream>(file_name, std::ios::binary);
    else
      d_decomposed_stream = std::make_unique<rtt_c4::ofpstream>(file_name);
    // set to a generic ostream
    d_stream = &*d_decomposed_stream;
  } else {
    Insist(rtt_c4::node() == 0, "Ensight_Stream, called by nonzero rank without "
                                "the domain decomposed flag");
    if (binary)
      d_serial_stream = std::make_unique<std::ofstream>(file_name, std::ios::binary);
    else
      d_serial_stream = std::make_unique<std::ofstream>(file_name);
    // set to a generic ostream
    d_stream = &*d_serial_stream;
  }
  Check(d_stream);

  // Set up the file.

  if (binary) {
    if (geom_file)
      *this << "C Binary";
  } else {
    // set precision for ascii mode
    d_stream->precision(5);
    d_stream->setf(std::ios::scientific, std::ios::floatfield);
  }

  Ensure(d_stream->good());
}
//------------------------------------------------------------------------------------------------//
/*!
 * \brief Opens the stream.
 *
 * \a geom_file is used only so that the "C Binary" header may be dumped when \a binary is true.  If
 * the geometry file is binary, Ensight assumes that all data files are also binary.  This class
 * does NOT check whether \a binary is consistent across all geometry and data files.
 *
 * \param file_name  Name of output file.
 * \param binary     If true, output binary.  Otherwise, output ascii.
 * \param geom_file  If true, then a geometry file will be dumped.
 * \param decomposed If true, input is domain decomposed. Otherwise domain replicated.
 */
\brief Opens the stream.
\a geom_file is used only so that the "C Binary" header may be dumped when \a binary is true.  If
the geometry file is binary, Ensight assumes that all data files are also binary.  This class
does NOT check whether \a binary is consistent across all geometry and data files.

\param file_name  Name of output file.
\param binary     If true, output binary.  Otherwise, output ascii.
\param geom_file  If true, then a geometry file will be dumped.
\param decomposed If true, input is domain decomposed. Otherwise domain replicated.
\ brief Opens the stream . \ a geom_file is used only so that the " C Binary " header may be dumped when \ a binary is true . If the geometry file is binary Ensight assumes that all data files are also binary . This class does NOT check whether \ a binary is consistent across all geometry and data files . \ param file_name Name of output file . \ param binary If true output binary . Otherwise output ascii . \ param geom_file If true then a geometry file will be dumped . \ param decomposed If true input is domain decomposed . Otherwise domain replicated .
void Ensight_Stream::open(const std::string &file_name, const bool binary, const bool geom_file,
                          const bool decomposed) {
  Require(!file_name.empty());
  d_binary = binary;
  if (decomposed) {
    if (binary)
      d_decomposed_stream = std::make_unique<rtt_c4::ofpstream>(file_name, std::ios::binary);
    else
      d_decomposed_stream = std::make_unique<rtt_c4::ofpstream>(file_name);
    d_stream = &*d_decomposed_stream;
  } else {
    Insist(rtt_c4::node() == 0, "Ensight_Stream, called by nonzero rank without "
                                "the domain decomposed flag");
    if (binary)
      d_serial_stream = std::make_unique<std::ofstream>(file_name, std::ios::binary);
    else
      d_serial_stream = std::make_unique<std::ofstream>(file_name);
    d_stream = &*d_serial_stream;
  }
  Check(d_stream);
  if (binary) {
    if (geom_file)
      *this << "C Binary";
  } else {
    d_stream->precision(5);
    d_stream->setf(std::ios::scientific, std::ios::floatfield);
  }
  Ensure(d_stream->good());
}
void Ensight_Stream :: open ( const std :: string & file_name , const bool binary , const bool geom_file , const bool decomposed ) { Require ( ! file_name . empty ( ) ) ; d_binary = binary ; if ( decomposed ) { if ( binary ) d_decomposed_stream = std :: make_unique < rtt_c4 :: ofpstream > ( file_name , std :: ios :: binary ) ; else d_decomposed_stream = std :: make_unique < rtt_c4 :: ofpstream > ( file_name ) ; d_stream = & * d_decomposed_stream ; } else { Insist ( rtt_c4 :: node ( ) == 0 , " " " " ) ; if ( binary ) d_serial_stream = std :: make_unique < std :: ofstream > ( file_name , std :: ios :: binary ) ; else d_serial_stream = std :: make_unique < std :: ofstream > ( file_name ) ; d_stream = & * d_serial_stream ; } Check ( d_stream ) ; if ( binary ) { if ( geom_file ) * this << " " ; } else { d_stream -> precision ( 5 ) ; d_stream -> setf ( std :: ios :: scientific , std :: ios :: floatfield ) ; } Ensure ( d_stream -> good ( ) ) ; }
\brief Opens the stream.
\ brief Opens the stream .
// Open the stream. // set to a generic ostream // set to a generic ostream // Set up the file. // set precision for ascii mode