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

This class serializes a TransientRBEvaluation object using the Cap'n Proto library. More...

#include <rb_data_serialization.h>

Public Member Functions

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

Private Attributes

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

Detailed Description

This class serializes a TransientRBEvaluation object using the Cap'n Proto library.

Definition at line 91 of file rb_data_serialization.h.

Constructor & Destructor Documentation

libMesh::RBDataSerialization::TransientRBEvaluationSerialization::TransientRBEvaluationSerialization ( TransientRBEvaluation rb_eval)

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

Definition at line 117 of file rb_data_serialization.C.

Referenced by libMesh::RBDataSerialization::RBEvaluationSerialization::write_to_file().

117  :
118  _trans_rb_eval(trans_rb_eval)
119 {
120 }
TransientRBEvaluation & _trans_rb_eval
The RBEvaluation object that will be written to disk.
libMesh::RBDataSerialization::TransientRBEvaluationSerialization::~TransientRBEvaluationSerialization ( )
virtual

Destructor.

Definition at line 122 of file rb_data_serialization.C.

123 {
124 }

Member Function Documentation

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

Write the Cap'n'Proto buffer to disk.

Definition at line 126 of file rb_data_serialization.C.

References _trans_rb_eval, libMesh::RBDataSerialization::add_transient_rb_evaluation_data_to_builder(), libMesh::ParallelObject::comm(), and libMesh::Parallel::Communicator::rank().

Referenced by main().

127 {
128  LOG_SCOPE("write_to_file()", "TransientRBEvaluationSerialization");
129 
130  if (_trans_rb_eval.comm().rank() == 0)
131  {
132  capnp::MallocMessageBuilder message;
133 
134 #ifndef LIBMESH_USE_COMPLEX_NUMBERS
135  RBData::TransientRBEvaluationReal::Builder trans_rb_eval_builder =
136  message.initRoot<RBData::TransientRBEvaluationReal>();
137  RBData::RBEvaluationReal::Builder rb_eval_builder =
138  trans_rb_eval_builder.initRbEvaluation();
139 #else
140  RBData::TransientRBEvaluationComplex::Builder trans_rb_eval_builder =
141  message.initRoot<RBData::TransientRBEvaluationComplex>();
142  RBData::RBEvaluationComplex::Builder rb_eval_builder =
143  trans_rb_eval_builder.initRbEvaluation();
144 #endif
145 
147  rb_eval_builder,
148  trans_rb_eval_builder);
149 
150  int fd = open(path.c_str(), O_WRONLY | O_CREAT | O_TRUNC, 0664);
151  if (!fd)
152  libmesh_error_msg("Error opening a write-only file descriptor to " + path);
153 
154  capnp::writeMessageToFd(fd, message);
155 
156  int error = close(fd);
157  if (error)
158  libmesh_error_msg("Error closing a write-only file descriptor to " + path);
159  }
160 }
void add_transient_rb_evaluation_data_to_builder(TransientRBEvaluation &trans_rb_eval, RBEvaluationBuilderNumber &rb_eval_builder, TransRBEvaluationBuilderNumber &trans_rb_eval_builder)
Add data for a TransientRBEvaluation to the builder.
const Parallel::Communicator & comm() const
TransientRBEvaluation & _trans_rb_eval
The RBEvaluation object that will be written to disk.
unsigned int rank() const
Definition: parallel.h:724

Member Data Documentation

TransientRBEvaluation& libMesh::RBDataSerialization::TransientRBEvaluationSerialization::_trans_rb_eval
private

The RBEvaluation object that will be written to disk.

Definition at line 116 of file rb_data_serialization.h.

Referenced by write_to_file().


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