29 #include "libmesh/xdr_cxx.h" 30 #include "libmesh/libmesh_logging.h" 31 #ifdef LIBMESH_HAVE_GZSTREAM 32 # include "gzstream.h" 34 #include "libmesh/utility.h" 36 #ifdef LIBMESH_HAVE_UNISTD_H 39 #ifdef LIBMESH_HAVE_PROCESS_H 47 void bzip_file (std::string_view unzipped_name)
49 #ifdef LIBMESH_HAVE_BZIP 50 LOG_SCOPE(
"system(bzip2)",
"XdrIO");
52 std::string system_string =
"bzip2 -f ";
53 system_string += unzipped_name;
54 if (std::system(system_string.c_str()))
55 libmesh_file_error(system_string);
57 libmesh_error_msg(
"ERROR: need bzip2/bunzip2 to create " << unzipped_name <<
".bz2");
61 void xzip_file (std::string_view unzipped_name)
63 #ifdef LIBMESH_HAVE_XZ 64 LOG_SCOPE(
"system(xz)",
"XdrIO");
66 std::string system_string =
"xz -f ";
67 system_string += unzipped_name;
68 if (std::system(system_string.c_str()))
69 libmesh_file_error(system_string);
71 libmesh_error_msg(
"ERROR: need xz to create " << unzipped_name <<
".xz");
77 void remove_unzipped_file (std::string_view
name)
79 std::ostringstream pid_suffix;
80 pid_suffix <<
'_' << getpid();
86 std::string new_name(
name.begin(),
name.end()-4);
87 new_name += pid_suffix.str();
88 std::remove(new_name.c_str());
92 std::string new_name(
name.begin(),
name.end()-3);
93 new_name += pid_suffix.str();
94 std::remove(new_name.c_str());
108 #ifdef LIBMESH_HAVE_XDR
117 version_number(LIBMESH_VERSION_ID(LIBMESH_MAJOR_VERSION, LIBMESH_MINOR_VERSION, LIBMESH_MICRO_VERSION))
127 #ifdef LIBMESH_HAVE_XDR
131 out(
std::make_unique<
std::ostream>(stream.rdbuf())),
136 version_number(LIBMESH_VERSION_ID(LIBMESH_MAJOR_VERSION, LIBMESH_MINOR_VERSION, LIBMESH_MICRO_VERSION))
145 #ifdef LIBMESH_HAVE_XDR
148 in(
std::make_unique<
std::istream>(stream.rdbuf())),
154 version_number(LIBMESH_VERSION_ID(LIBMESH_MAJOR_VERSION, LIBMESH_MINOR_VERSION, LIBMESH_MICRO_VERSION))
179 #ifdef LIBMESH_HAVE_XDR 184 xdrs = std::make_unique<XDR>();
185 xdrstdio_create (
xdrs.get(),
fp, (
mode ==
ENCODE) ? XDR_ENCODE : XDR_DECODE);
188 libmesh_error_msg(
"ERROR: Functionality is not available.\n" \
189 <<
"Make sure LIBMESH_HAVE_XDR is defined at build time\n" \
190 <<
"The XDR interface is not available in this installation");
205 #ifdef LIBMESH_HAVE_GZSTREAM 206 auto inf = std::make_unique<igzstream>();
208 inf->open(
file_name.c_str(), std::ios::in);
211 libmesh_error_msg(
"ERROR: need gzstream to handle .gz files!!!");
216 auto inf = std::make_unique<std::ifstream>();
221 inf->open(new_name.c_str(), std::ios::in);
240 #ifdef LIBMESH_HAVE_GZSTREAM 241 auto outf = std::make_unique<ogzstream>();
244 out = std::move(outf);
246 libmesh_error_msg(
"ERROR: need gzstream to handle .gz files!!!");
251 auto outf = std::make_unique<std::ofstream>();
257 new_name.erase(new_name.end() - 4, new_name.end());
260 new_name.erase(new_name.end() - 3, new_name.end());
263 out = std::move(outf);
272 libmesh_error_msg(
"Invalid mode = " <<
mode);
285 #ifdef LIBMESH_HAVE_XDR 289 xdr_destroy (
xdrs.get());
301 libmesh_error_msg(
"ERROR: Functionality is not available.\n" \
302 <<
"Make sure LIBMESH_HAVE_XDR is defined at build time\n" \
303 <<
"The XDR interface is not available in this installation");
312 if (
in.get() !=
nullptr)
325 if (
out.get() !=
nullptr)
340 libmesh_error_msg(
"Invalid mode = " <<
mode);
353 #ifdef LIBMESH_HAVE_XDR 363 libmesh_error_msg(
"ERROR: Functionality is not available.\n" \
364 <<
"Make sure LIBMESH_HAVE_XDR is defined at build time\n" \
365 <<
"The XDR interface is not available in this installation");
375 if (
in.get() !=
nullptr)
382 if (
out.get() !=
nullptr)
388 libmesh_error_msg(
"Invalid mode = " <<
mode);
403 #ifdef LIBMESH_HAVE_XDR 431 libmesh_error_msg(
"ERROR: Functionality is not available.\n" \
432 <<
"Make sure LIBMESH_HAVE_XDR is defined at build time\n" \
433 <<
"The XDR interface is not available in this installation");
474 #ifdef LIBMESH_HAVE_XDR 480 template <
typename T>
481 xdrproc_t xdr_translator();
483 template <
typename T>
484 bool xdr_translate(XDR * x, T & a)
486 return (xdr_translator<T>())(x, &a, 0);
490 bool xdr_translate(XDR * x,
494 std::copy(s.begin(), s.end(), sptr);
501 bool b = xdr_string(x, &begin, length);
504 length = cast_int<unsigned int>(std::strlen(sptr));
506 std::copy(sptr, sptr+length, s.begin());
511 template <
typename T>
512 bool xdr_translate(XDR * x, std::complex<T> & a)
514 T r = a.real(), i = a.imag();
515 bool b1 = xdr_translate(x, r);
516 bool b2 = xdr_translate(x, i);
517 a = std::complex<T>(r,i);
521 template <
typename T>
522 bool xdr_translate(XDR * x, std::vector<T> & a)
524 unsigned int length = cast_int<unsigned int>(a.size());
525 xdr_u_int(x, &length);
529 return xdr_vector(x, reinterpret_cast<char *>(a.data()), length,
sizeof(T),
530 xdr_translator<T>());
536 template <
typename T>
537 bool xdr_translate(XDR * x, std::vector<std::complex<T>> & a)
539 unsigned int length = cast_int<unsigned int>(a.size());
540 bool b = xdr_u_int(x, &length);
543 if (!xdr_translate(x, val))
549 bool xdr_translate(XDR * x, std::vector<std::string> & s)
551 unsigned int length = cast_int<unsigned int>(s.size());
552 bool b = xdr_u_int(x, &length);
555 if (!xdr_translate(x, val))
588 struct function_signature;
590 template<
typename returnval,
typename... Args>
591 struct function_signature<returnval (*)(Args...)>
593 template <std::
size_t N>
595 static_assert(N <
sizeof...(Args),
"Function argument index too high");
596 using type =
typename std::tuple_element<N, std::tuple<Args...>>::type;
600 #define libmesh_define_xdr(ourfunc, theirfunc, cxx_type) \ 601 bool_t libmesh_xdr_##ourfunc(XDR * x, cxx_type * v, unsigned int) { \ 603 std::remove_pointer<typename function_signature<decltype(&xdr_##theirfunc)>::template arg<1>::type>::type; \ 604 static_assert(sizeof(cxx_type) == \ 606 "Cannot safely cast data for use with XDR"); \ 607 return xdr_##theirfunc(x, reinterpret_cast<api_type *>(v)); \ 614 libmesh_define_xdr(
long, longlong_t,
long long)
615 libmesh_define_xdr(u_long, u_longlong_t,
unsigned long long)
617 libmesh_define_xdr(
long,
long,
long)
618 libmesh_define_xdr(u_long, u_long,
unsigned long)
622 #define libmesh_define_xdr(ourfunc, theirfunc, type) \ 623 const xdrproc_t libmesh_xdr_##ourfunc = (xdrproc_t)xdr_##theirfunc; 625 libmesh_define_xdr(
long,
long,
long)
626 libmesh_define_xdr(u_long, u_long,
unsigned long)
629 libmesh_define_xdr(
char,
char,
char)
630 libmesh_define_xdr(
short,
short,
short)
631 libmesh_define_xdr(
int,
int,
int)
632 libmesh_define_xdr(longlong_t, longlong_t,
long long)
633 libmesh_define_xdr(u_char, u_char,
unsigned char)
634 libmesh_define_xdr(u_short, u_short,
unsigned short)
635 libmesh_define_xdr(u_int, u_int,
unsigned int)
636 libmesh_define_xdr(u_longlong_t, u_longlong_t,
unsigned long long)
637 libmesh_define_xdr(
float,
float,
float)
638 libmesh_define_xdr(
double,
double,
double)
642 xdrproc_t xdr_translator<int>()
646 if (
sizeof(
int) <= 4)
647 return (xdrproc_t)(libmesh_xdr_int);
648 else if (
sizeof(
int) ==
sizeof(
long long))
649 return (xdrproc_t)(libmesh_xdr_longlong_t);
650 else if (
sizeof(
int) ==
sizeof(long))
651 return (xdrproc_t)(libmesh_xdr_long);
657 xdrproc_t xdr_translator<unsigned int>()
661 if (
sizeof(
unsigned int) <= 4)
662 return (xdrproc_t)(libmesh_xdr_u_int);
663 else if (
sizeof(
unsigned int) ==
sizeof(
unsigned long))
664 return (xdrproc_t)(libmesh_xdr_u_long);
665 else if (
sizeof(
unsigned int) ==
sizeof(
unsigned long long))
666 return (xdrproc_t)(libmesh_xdr_u_longlong_t);
672 xdrproc_t xdr_translator<long int>()
676 if (
sizeof(
long int) <= 4)
677 return (xdrproc_t)(libmesh_xdr_long);
678 else if (
sizeof(
long int) ==
sizeof(
long long))
679 return (xdrproc_t)(libmesh_xdr_longlong_t);
685 xdrproc_t xdr_translator<unsigned long int>()
689 if (
sizeof(
unsigned long int) <= 4)
690 return (xdrproc_t)(libmesh_xdr_u_long);
691 else if (
sizeof(
unsigned long int) ==
sizeof(
unsigned long long))
692 return (xdrproc_t)(libmesh_xdr_u_longlong_t);
706 xdrproc_t xdr_translator<long long>() {
return (xdrproc_t)(libmesh_xdr_longlong_t); }
709 xdrproc_t xdr_translator<unsigned long long>() {
return (xdrproc_t)(libmesh_xdr_u_longlong_t); }
712 xdrproc_t xdr_translator<short int>() {
return (xdrproc_t)(libmesh_xdr_short); }
715 xdrproc_t xdr_translator<unsigned short int>() {
return (xdrproc_t)(libmesh_xdr_u_short); }
718 xdrproc_t xdr_translator<char>() {
return (xdrproc_t)(libmesh_xdr_char); }
721 xdrproc_t xdr_translator<signed char>() {
return (xdrproc_t)(libmesh_xdr_char); }
724 xdrproc_t xdr_translator<unsigned char>() {
return (xdrproc_t)(libmesh_xdr_u_char); }
727 xdrproc_t xdr_translator<float>() {
return (xdrproc_t)(libmesh_xdr_float); }
730 xdrproc_t xdr_translator<double>() {
return (xdrproc_t)(libmesh_xdr_double); }
734 xdrproc_t xdr_translator<long double>() {
return (xdrproc_t)(libmesh_xdr_double); }
736 #ifdef LIBMESH_DEFAULT_QUADRUPLE_PRECISION 738 xdrproc_t xdr_translator<Real>() {
return (xdrproc_t)(libmesh_xdr_double); }
745 template <
typename T>
752 template <
typename T>
757 a = std::complex<T>(r,i);
768 for (
unsigned int c=0, sl=std::strlen(
comm); c!=sl; c++)
772 a.push_back(
comm[c]);
776 template <
typename T>
779 unsigned int length=0;
780 data(length,
"# vector length");
792 template <
typename T>
795 unsigned int length=0;
796 data(length,
"# vector length x 2 (complex)");
799 for (std::complex<T> & a_i : a)
805 a_i = std::complex<T>(r,im);
810 template <
typename T>
813 template <
typename T>
816 *
out << a.real() <<
"\t " << a.imag();
819 template <
typename T>
822 std::size_t length = a.size();
823 data(length,
"# vector length");
826 *
out << std::scientific
827 << std::setprecision(std::numeric_limits<T>::max_digits10);
838 template <
typename T>
841 std::size_t length=a.size();
842 data(length,
"# vector length x 2 (complex)");
845 *
out << std::scientific
846 << std::setprecision(std::numeric_limits<T>::max_digits10);
848 for (std::complex<T> & a_i : a)
859 template <
typename T>
867 #ifdef LIBMESH_HAVE_XDR 871 xdr_translate(
xdrs.get(), a);
875 libmesh_error_msg(
"ERROR: Functionality is not available.\n" \
876 <<
"Make sure LIBMESH_HAVE_XDR is defined at build time\n" \
877 <<
"The XDR interface is not available in this installation");
902 *
out << std::scientific
903 << std::setprecision(std::numeric_limits<T>::max_digits10);
909 if (comment_in !=
"")
910 *
out <<
"\t " << comment_in;
919 libmesh_error_msg(
"Invalid mode = " <<
mode);
924 template <
typename T>
931 #ifdef LIBMESH_HAVE_XDR 935 unsigned int size_of_type = cast_int<unsigned int>(
sizeof(T));
937 xdr_vector(
xdrs.get(),
941 xdr_translator<T>());
943 libmesh_error_msg(
"ERROR: Functionality is not available.\n" \
944 <<
"Make sure LIBMESH_HAVE_XDR is defined at build time\n" \
945 <<
"The XDR interface is not available in this installation");
953 #ifdef LIBMESH_HAVE_XDR 957 unsigned int size_of_type = cast_int<unsigned int>(
sizeof(T));
960 xdr_vector(
xdrs.get(),
964 xdr_translator<T>());
966 libmesh_error_msg(
"ERROR: Functionality is not available.\n" \
967 <<
"Make sure LIBMESH_HAVE_XDR is defined at build time\n" \
968 <<
"The XDR interface is not available in this installation");
979 for (
unsigned int i=0; i<len; i++)
998 *
out << std::scientific
999 << std::setprecision(std::numeric_limits<T>::max_digits10);
1002 for (
unsigned int i=0; i<len; i++)
1006 *
out << val[i] <<
" ";
1010 const unsigned imax = std::min(line_break, len);
1014 for (
unsigned int i=0; (i<imax && cnt<len); i++)
1034 libmesh_error_msg(
"Invalid mode = " <<
mode);
1045 #ifdef LIBMESH_HAVE_XDR
1046 (xdrproc_t)libmesh_xdr_double,
1050 line_break, std::numeric_limits<double>::max_digits10);
1060 #ifdef LIBMESH_HAVE_XDR
1061 (xdrproc_t)libmesh_xdr_float,
1065 line_break, std::numeric_limits<float>::max_digits10);
1071 void Xdr::data_stream (
long double * val,
const unsigned int len,
const unsigned int line_break)
1074 (val, len,
nullptr, line_break,
1075 std::numeric_limits<long double>::max_digits10);
1079 #ifdef LIBMESH_DEFAULT_QUADRUPLE_PRECISION 1085 #endif // LIBMESH_DEFAULT_QUADRUPLE_PRECISION 1089 template <
typename XFP>
1091 #ifdef LIBMESH_HAVE_XDR
1096 const unsigned int line_break,
1104 #ifdef LIBMESH_HAVE_XDR 1111 xdr_vector(
xdrs.get(),
1129 std::vector<double> io_buffer (len);
1133 for (
unsigned int i=0, cnt=0; i<len; i++)
1134 io_buffer[cnt++] =
double(val[i]);
1136 xdr_vector(
xdrs.get(),
1137 reinterpret_cast<char *
>(io_buffer.data()),
1140 (xdrproc_t) libmesh_xdr_double);
1144 for (
unsigned int i=0, cnt=0; i<len; i++)
1146 val[i] = io_buffer[cnt++];
1152 libmesh_error_msg(
"ERROR: Functionality is not available.\n" \
1153 <<
"Make sure LIBMESH_HAVE_XDR is defined at build time\n" \
1154 <<
"The XDR interface is not available in this installation");
1165 for (
unsigned int i=0; i<len; i++)
1181 std::ios_base::fmtflags out_flags =
out->flags();
1186 *
out << std::scientific
1187 << std::setprecision(n_digits);
1190 for (
unsigned int i=0; i<len; i++)
1194 *
out << val[i] <<
' ';
1198 const unsigned imax = std::min(line_break, len);
1202 for (
unsigned int i=0; (i<imax && cnt<len); i++)
1219 out->flags(out_flags);
1225 libmesh_error_msg(
"Invalid mode = " <<
mode);
1232 void Xdr::data_stream (std::complex<double> * val,
const unsigned int len,
const unsigned int line_break)
1240 void Xdr::data_stream (std::complex<long double> * val,
const unsigned int len,
const unsigned int line_break)
1247 template <
typename T>
1255 #ifdef LIBMESH_HAVE_XDR 1267 std::vector<double> io_buffer (2*len);
1271 for (
unsigned int i=0, cnt=0; i<len; i++)
1273 io_buffer[cnt++] = val[i].real();
1274 io_buffer[cnt++] = val[i].imag();
1277 xdr_vector(
xdrs.get(),
1278 reinterpret_cast<char *
>(io_buffer.data()),
1281 (xdrproc_t) libmesh_xdr_double);
1285 for (
unsigned int i=0, cnt=0; i<len; i++)
1287 double re = io_buffer[cnt++];
1288 double im = io_buffer[cnt++];
1289 val[i] = std::complex<T>(re, im);
1294 libmesh_error_msg(
"ERROR: Functionality is not available.\n" \
1295 <<
"Make sure LIBMESH_HAVE_XDR is defined at build time\n" \
1296 <<
"The XDR interface is not available in this installation");
1307 for (
unsigned int i=0; i<len; i++)
1313 val[i] = std::complex<T>(re,im);
1326 std::ios_base::fmtflags out_flags =
out->flags();
1334 *
out << std::scientific
1335 << std::setprecision(std::numeric_limits<T>::max_digits10);
1338 for (
unsigned int i=0; i<len; i++)
1342 *
out << val[i].real() <<
' ' << val[i].imag() <<
' ';
1346 const unsigned imax = std::min(line_break, len);
1350 for (
unsigned int i=0; (i<imax && cnt<len); i++)
1354 *
out << val[cnt].real() <<
' ' << val[cnt].imag();
1368 out->flags(out_flags);
1374 libmesh_error_msg(
"Invalid mode = " <<
mode);
1402 *
out <<
"\t " << comment_in <<
'\n';
1407 libmesh_error_msg(
"Invalid mode = " <<
mode);
1416 template LIBMESH_EXPORT
void Xdr::data<int> (
int &, std::string_view);
1417 template LIBMESH_EXPORT
void Xdr::data<unsigned int> (
unsigned int &, std::string_view);
1418 template LIBMESH_EXPORT
void Xdr::data<unsigned short int> (
unsigned short int &, std::string_view);
1419 template LIBMESH_EXPORT
void Xdr::data<short int> (
short int &, std::string_view);
1420 template LIBMESH_EXPORT
void Xdr::data<unsigned long int> (
unsigned long int &, std::string_view);
1421 template LIBMESH_EXPORT
void Xdr::data<unsigned long long> (
unsigned long long &, std::string_view);
1422 template LIBMESH_EXPORT
void Xdr::data<long int> (
long int &, std::string_view);
1423 template LIBMESH_EXPORT
void Xdr::data<long long> (
long long &, std::string_view);
1424 template LIBMESH_EXPORT
void Xdr::data<char> (
char &, std::string_view);
1425 template LIBMESH_EXPORT
void Xdr::data<signed char> (
signed char &, std::string_view);
1426 template LIBMESH_EXPORT
void Xdr::data<unsigned char> (
unsigned char &, std::string_view);
1427 template LIBMESH_EXPORT
void Xdr::data<float> (
float &, std::string_view);
1428 template LIBMESH_EXPORT
void Xdr::data<double> (
double &, std::string_view);
1429 template LIBMESH_EXPORT
void Xdr::data<long double> (
long double &, std::string_view);
1430 template LIBMESH_EXPORT
void Xdr::data<std::complex<float>> (std::complex<float> &, std::string_view);
1431 template LIBMESH_EXPORT
void Xdr::data<std::complex<double>> (std::complex<double> &, std::string_view);
1432 template LIBMESH_EXPORT
void Xdr::data<std::complex<long double>> (std::complex<long double> &, std::string_view);
1433 template LIBMESH_EXPORT
void Xdr::data<std::string> (std::string &, std::string_view);
1434 template LIBMESH_EXPORT
void Xdr::data<std::vector<int>> (std::vector<int> &, std::string_view);
1435 template LIBMESH_EXPORT
void Xdr::data<std::vector<unsigned int>> (std::vector<unsigned int> &, std::string_view);
1436 template LIBMESH_EXPORT
void Xdr::data<std::vector<short int>> (std::vector<short int> &, std::string_view);
1437 template LIBMESH_EXPORT
void Xdr::data<std::vector<unsigned short int>> (std::vector<unsigned short int> &, std::string_view);
1438 template LIBMESH_EXPORT
void Xdr::data<std::vector<long int>> (std::vector<long int> &, std::string_view);
1439 template LIBMESH_EXPORT
void Xdr::data<std::vector<long long>> (std::vector<long long> &, std::string_view);
1440 template LIBMESH_EXPORT
void Xdr::data<std::vector<unsigned long int>> (std::vector<unsigned long int> &, std::string_view);
1441 template LIBMESH_EXPORT
void Xdr::data<std::vector<unsigned long long>> (std::vector<unsigned long long> &, std::string_view);
1442 template LIBMESH_EXPORT
void Xdr::data<std::vector<char>> (std::vector<char> &, std::string_view);
1443 template LIBMESH_EXPORT
void Xdr::data<std::vector<signed char>> (std::vector<signed char> &, std::string_view);
1444 template LIBMESH_EXPORT
void Xdr::data<std::vector<unsigned char>> (std::vector<unsigned char> &, std::string_view);
1445 template LIBMESH_EXPORT
void Xdr::data<std::vector<float>> (std::vector<float> &, std::string_view);
1446 template LIBMESH_EXPORT
void Xdr::data<std::vector<double>> (std::vector<double> &, std::string_view);
1447 template LIBMESH_EXPORT
void Xdr::data<std::vector<long double>> (std::vector<long double> &, std::string_view);
1448 template LIBMESH_EXPORT
void Xdr::data<std::vector<std::complex<float>>> (std::vector<std::complex<float>> &, std::string_view);
1449 template LIBMESH_EXPORT
void Xdr::data<std::vector<std::complex<double>>> (std::vector<std::complex<double>> &, std::string_view);
1450 template LIBMESH_EXPORT
void Xdr::data<std::vector<std::complex<long double>>> (std::vector<std::complex<long double>> &, std::string_view);
1451 template LIBMESH_EXPORT
void Xdr::data<std::vector<std::string>> (std::vector<std::string> &, std::string_view);
1452 template LIBMESH_EXPORT
void Xdr::data_stream<unsigned char> (
unsigned char * val,
const unsigned int len,
const unsigned int line_break);
1453 template LIBMESH_EXPORT
void Xdr::data_stream<short int> (
short int * val,
const unsigned int len,
const unsigned int line_break);
1454 template LIBMESH_EXPORT
void Xdr::data_stream<int> (
int * val,
const unsigned int len,
const unsigned int line_break);
1455 template LIBMESH_EXPORT
void Xdr::data_stream<long long> (
long long * val,
const unsigned int len,
const unsigned int line_break);
1456 template LIBMESH_EXPORT
void Xdr::data_stream<unsigned short int> (
unsigned short int * val,
const unsigned int len,
const unsigned int line_break);
1457 template LIBMESH_EXPORT
void Xdr::data_stream<unsigned int> (
unsigned int * val,
const unsigned int len,
const unsigned int line_break);
1458 template LIBMESH_EXPORT
void Xdr::data_stream<unsigned long int> (
unsigned long int * val,
const unsigned int len,
const unsigned int line_break);
1459 template LIBMESH_EXPORT
void Xdr::data_stream<unsigned long long> (
unsigned long long * val,
const unsigned int len,
const unsigned int line_break);
1461 #ifdef LIBMESH_DEFAULT_QUADRUPLE_PRECISION 1462 template LIBMESH_EXPORT
void Xdr::data<Real> (
Real &, std::string_view);
1463 template LIBMESH_EXPORT
void Xdr::data<std::complex<Real>> (std::complex<Real> &, std::string_view);
1464 template LIBMESH_EXPORT
void Xdr::data<std::vector<Real>> (std::vector<Real> &, std::string_view);
1465 template LIBMESH_EXPORT
void Xdr::data<std::vector<std::complex<Real>>> (std::vector<std::complex<Real>> &, std::string_view);
std::string name(const ElemQuality q)
This function returns a string containing some name for q.
Xdr(std::string name="", const XdrMODE m=UNKNOWN)
File-based constructor.
const int comm_len
A buffer to put comment strings into.
std::string file_name
The file name.
const unsigned int xdr_MAX_STRING_LENGTH
void do_write(T &a)
Helper method for writing different data types.
const unsigned int invalid_uint
A number which is used quite often to represent an invalid or uninitialized value for an unsigned int...
bool ends_with(std::string_view superstring, std::string_view suffix)
Look for a substring at the very end of a string.
char comm[xdr_MAX_STRING_LENGTH]
void comment(std::string &)
Writes or reads (ignores) a comment line.
void close()
Closes the file if it is open.
The libMesh namespace provides an interface to certain functionality in the library.
const XdrMODE mode
The mode used for accessing the file.
void do_read(T &a)
Helper method for reading different data types.
bool gzipped_file
Are we reading/writing zipped files?
void _complex_data_stream(std::complex< T > *val, const unsigned int len, const unsigned int line_break)
Helper method for complex types.
XdrMODE
Defines an enum for read/write mode in Xdr format.
void data(T &a, std::string_view comment="")
Inputs or outputs a single value.
std::unique_ptr< std::istream > in
The input file stream.
std::unique_ptr< std::ostream > out
The output file stream.
std::string unzip_file(std::string_view name)
Create an unzipped copy of a bz2 or xz file, returning the name of the now-unzipped file that can be ...
std::unique_ptr< XDR > xdrs
Pointer to the standard XDR struct.
void _xfp_data_stream(XFP *val, const unsigned int len, #ifdef LIBMESH_HAVE_XDR xdrproc_t #else void *#endif xdr_proc, const unsigned int line_break, const int n_digits)
Helper method for extended FP types.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
void open(std::string name)
Opens the file.
void data_stream(T *val, const unsigned int len, const unsigned int line_break=libMesh::invalid_uint)
Inputs or outputs a raw data stream.