|
| template<typename ReadLambda , typename WriteLambda > |
| void | test_read_write (ReadLambda &act_read, WriteLambda &act_write) |
| |
Definition at line 17 of file xdr_test.C.
◆ CPPUNIT_TEST() [1/2]
◆ CPPUNIT_TEST() [2/2]
◆ CPPUNIT_TEST_SUITE_END()
| XdrTest::CPPUNIT_TEST_SUITE_END |
( |
| ) |
|
◆ LIBMESH_CPPUNIT_TEST_SUITE()
| XdrTest::LIBMESH_CPPUNIT_TEST_SUITE |
( |
XdrTest |
| ) |
|
◆ setUp()
◆ tearDown()
| void XdrTest::tearDown |
( |
| ) |
|
|
inline |
◆ test_read_write()
template<typename ReadLambda , typename WriteLambda >
| void XdrTest::test_read_write |
( |
ReadLambda & |
act_read, |
|
|
WriteLambda & |
act_write |
|
) |
| |
|
inlineprivate |
Definition at line 28 of file xdr_test.C.
29 {
30
31
32
35
36
38 {
39
40 {
42 act_write(xdr);
43 }
44
45
46 {
48 act_read(xdr);
49 }
50 }
51
52
53 {
54 std::stringstream stream;
55
56
57 {
58 std::ostream ostream(stream.rdbuf());
60 act_write(xdr);
61 }
62
63
64 stream.seekp(0);
65
66
67 {
68 std::istream istream(stream.rdbuf());
70 act_read(xdr);
71 }
72 }
73 }
This class implements a C++ interface to the XDR (eXternal Data Representation) format.
Communicator * TestCommWorld
processor_id_type global_processor_id()
References libMesh::global_processor_id(), libMesh::READ, TestCommWorld, and libMesh::WRITE.
Referenced by testDataStream(), and testDataVec().
◆ testDataStream()
| void XdrTest::testDataStream |
( |
| ) |
|
|
inline |
Definition at line 103 of file xdr_test.C.
104 {
105 LOG_UNIT_TEST;
106
107 std::vector<Real> vec(100);
109 vec[i] = static_cast<
Real>(i+1) / vec.size();
110
111
112
113 auto act_write = [&vec](
Xdr & xdr) {
114 xdr.data_stream(vec.data(), vec.size(), 16); };
115
116
117 auto act_read = [&vec](
Xdr & xdr) {
118 std::vector<Real> vec_in(100);
119 xdr.data_stream(vec_in.data(), vec_in.size());
120
121
123 LIBMESH_ASSERT_FP_EQUAL(vec[i], vec_in[i],
TOLERANCE); };
124
126 }
void test_read_write(ReadLambda &act_read, WriteLambda &act_write)
auto index_range(const T &sizable)
Helper function that returns an IntRange<std::size_t> representing all the indices of the passed-in v...
static constexpr Real TOLERANCE
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
References libMesh::index_range(), libMesh::Real, test_read_write(), and libMesh::TOLERANCE.
◆ testDataVec()
| void XdrTest::testDataVec |
( |
| ) |
|
|
inline |
The documentation for this class was generated from the following file: