This class serializes an RBEvaluation object using the Cap'n Proto library.
More...
#include <rb_data_serialization.h>
This class serializes an RBEvaluation object using the Cap'n Proto library.
- Author
- David Knezevic
- Date
- 2015 Serializes RBEvaluation objects using Cap'n Proto.
Definition at line 58 of file rb_data_serialization.h.
◆ RBEvaluationSerialization() [1/3]
libMesh::RBDataSerialization::RBEvaluationSerialization::RBEvaluationSerialization |
( |
RBEvaluation & |
rb_eval | ) |
|
Initialize a new buffer using the structure from the Cap'n'Proto schema described in rb_data.capnp.
Definition at line 77 of file rb_data_serialization.C.
RBEvaluation & _rb_eval
The RBEvaluation object that will be written to disk.
◆ RBEvaluationSerialization() [2/3]
Special functions.
- This class contains a reference, so it can't be default copy/move-assigned.
- The destructor is defaulted out of line.
◆ RBEvaluationSerialization() [3/3]
◆ ~RBEvaluationSerialization()
libMesh::RBDataSerialization::RBEvaluationSerialization::~RBEvaluationSerialization |
( |
| ) |
|
|
virtualdefault |
◆ operator=() [1/2]
◆ operator=() [2/2]
◆ write_to_file()
void libMesh::RBDataSerialization::RBEvaluationSerialization::write_to_file |
( |
const std::string & |
path, |
|
|
bool |
use_packing = false |
|
) |
| |
Write the Cap'n'Proto buffer to disk.
If use_packing
is true, the file is written using the "packed" scheme, which can reduce the filesize on disk.
Definition at line 85 of file rb_data_serialization.C.
References _rb_eval, libMesh::RBDataSerialization::add_rb_evaluation_data_to_builder(), libMesh::ParallelObject::comm(), and TIMPI::Communicator::rank().
Referenced by main().
87 LOG_SCOPE(
"write_to_file()",
"RBEvaluationSerialization");
91 capnp::MallocMessageBuilder message;
93 #ifndef LIBMESH_USE_COMPLEX_NUMBERS 94 RBData::RBEvaluationReal::Builder rb_eval_builder =
95 message.initRoot<RBData::RBEvaluationReal>();
97 RBData::RBEvaluationComplex::Builder rb_eval_builder =
98 message.initRoot<RBData::RBEvaluationComplex>();
103 int fd = open(path.c_str(), O_WRONLY | O_CREAT | O_TRUNC, 0664);
104 libmesh_error_msg_if(!fd,
"Error opening a write-only file descriptor to " + path);
107 capnp::writePackedMessageToFd(fd, message);
109 capnp::writeMessageToFd(fd, message);
111 int error = close(fd);
112 libmesh_error_msg_if(error,
"Error closing a write-only file descriptor to " + path);
processor_id_type rank() const
const Parallel::Communicator & comm() const
void add_rb_evaluation_data_to_builder(RBEvaluation &rb_eval, RBEvaluationBuilderNumber &rb_eval_builder)
Add data for an RBEvaluation to the builder.
RBEvaluation & _rb_eval
The RBEvaluation object that will be written to disk.
◆ _rb_eval
RBEvaluation& libMesh::RBDataSerialization::RBEvaluationSerialization::_rb_eval |
|
private |
The documentation for this class was generated from the following files: