libMesh
Public Member Functions | Private Attributes | List of all members
libMesh::RBDataSerialization::RBSCMEvaluationSerialization Class Reference

This class serializes an RBSCMEvaluation object using the Cap'n Proto library. More...

#include <rb_data_serialization.h>

Public Member Functions

 RBSCMEvaluationSerialization (RBSCMEvaluation &rb_eval)
 Initialize a new buffer using the structure from the Cap'n'Proto schema described in rb_data.capnp. More...
 
virtual ~RBSCMEvaluationSerialization ()
 Destructor. More...
 
void write_to_file (const std::string &path)
 Write the Cap'n'Proto buffer to disk. More...
 

Private Attributes

RBSCMEvaluation_rb_scm_eval
 The RBEvaluation object that will be written to disk. More...
 

Detailed Description

This class serializes an RBSCMEvaluation object using the Cap'n Proto library.

Definition at line 161 of file rb_data_serialization.h.

Constructor & Destructor Documentation

libMesh::RBDataSerialization::RBSCMEvaluationSerialization::RBSCMEvaluationSerialization ( RBSCMEvaluation rb_eval)

Initialize a new buffer using the structure from the Cap'n'Proto schema described in rb_data.capnp.

Definition at line 220 of file rb_data_serialization.C.

221  :
222  _rb_scm_eval(rb_scm_eval)
223 {
224 }
RBSCMEvaluation & _rb_scm_eval
The RBEvaluation object that will be written to disk.
libMesh::RBDataSerialization::RBSCMEvaluationSerialization::~RBSCMEvaluationSerialization ( )
virtual

Destructor.

Definition at line 226 of file rb_data_serialization.C.

227 {
228 }

Member Function Documentation

void libMesh::RBDataSerialization::RBSCMEvaluationSerialization::write_to_file ( const std::string &  path)

Write the Cap'n'Proto buffer to disk.

Definition at line 230 of file rb_data_serialization.C.

References _rb_scm_eval, libMesh::RBDataSerialization::add_rb_scm_evaluation_data_to_builder(), libMesh::ParallelObject::comm(), and libMesh::Parallel::Communicator::rank().

Referenced by main().

231 {
232  LOG_SCOPE("write_to_file()", "RBSCMEvaluationSerialization");
233 
234  if (_rb_scm_eval.comm().rank() == 0)
235  {
236  capnp::MallocMessageBuilder message;
237 
238  RBData::RBSCMEvaluation::Builder rb_scm_eval_builder =
239  message.initRoot<RBData::RBSCMEvaluation>();
240 
242 
243  int fd = open(path.c_str(), O_WRONLY | O_CREAT | O_TRUNC, 0664);
244  if (!fd)
245  libmesh_error_msg("Error opening a write-only file descriptor to " + path);
246 
247  capnp::writeMessageToFd(fd, message);
248 
249  int error = close(fd);
250  if (error)
251  libmesh_error_msg("Error closing a write-only file descriptor to " + path);
252  }
253 }
RBSCMEvaluation & _rb_scm_eval
The RBEvaluation object that will be written to disk.
void add_rb_scm_evaluation_data_to_builder(RBSCMEvaluation &rb_scm_eval, RBData::RBSCMEvaluation::Builder &rb_scm_eval_builder)
Add data for an RBSCMEvaluation to the builder.
const Parallel::Communicator & comm() const
unsigned int rank() const
Definition: parallel.h:724

Member Data Documentation

RBSCMEvaluation& libMesh::RBDataSerialization::RBSCMEvaluationSerialization::_rb_scm_eval
private

The RBEvaluation object that will be written to disk.

Definition at line 186 of file rb_data_serialization.h.

Referenced by write_to_file().


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