libMesh
Loading...
Searching...
No Matches
xdr_cxx.C
Go to the documentation of this file.
1// The libMesh Finite Element Library.
2// Copyright (C) 2002-2026 Benjamin S. Kirk, John W. Peterson, Roy H. Stogner
3
4// This library is free software; you can redistribute it and/or
5// modify it under the terms of the GNU Lesser General Public
6// License as published by the Free Software Foundation; either
7// version 2.1 of the License, or (at your option) any later version.
8
9// This library is distributed in the hope that it will be useful,
10// but WITHOUT ANY WARRANTY; without even the implied warranty of
11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12// Lesser General Public License for more details.
13
14// You should have received a copy of the GNU Lesser General Public
15// License along with this library; if not, write to the Free Software
16// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17
18
19// C/C++ includes
20#include <cstring>
21#include <limits>
22#include <iomanip>
23#include <memory>
24#include <sstream>
25#include <fstream>
26#include <tuple> // For XDR API probing trick
27
28// Local includes
29#include "libmesh/xdr_cxx.h"
30#include "libmesh/libmesh_logging.h"
31#ifdef LIBMESH_HAVE_GZSTREAM
32# include "gzstream.h" // For reading/writing compressed streams
33#endif
34#include "libmesh/utility.h" // unzip_file
35
36#ifdef LIBMESH_HAVE_UNISTD_H
37#include <unistd.h> // for getpid() on Unix
38#endif
39#ifdef LIBMESH_HAVE_PROCESS_H
40#include <process.h> // for getpid() on Windows
41#endif
42
43// Anonymous namespace for implementation details.
44namespace {
45
46// Nasty hacks for reading/writing zipped files
47void bzip_file (std::string_view unzipped_name)
48{
49#ifdef LIBMESH_HAVE_BZIP
50 LOG_SCOPE("system(bzip2)", "XdrIO");
51
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);
56#else
57 libmesh_error_msg("ERROR: need bzip2/bunzip2 to create " << unzipped_name << ".bz2");
58#endif
59}
60
61void xzip_file (std::string_view unzipped_name)
62{
63#ifdef LIBMESH_HAVE_XZ
64 LOG_SCOPE("system(xz)", "XdrIO");
65
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);
70#else
71 libmesh_error_msg("ERROR: need xz to create " << unzipped_name << ".xz");
72#endif
73}
74
75
76// remove an unzipped file
77void remove_unzipped_file (std::string_view name)
78{
79 std::ostringstream pid_suffix;
80 pid_suffix << '_' << getpid();
81
82 // If we temporarily decompressed a file, remove the
83 // uncompressed version
84 if (libMesh::Utility::ends_with(name, ".bz2"))
85 {
86 std::string new_name(name.begin(), name.end()-4);
87 new_name += pid_suffix.str();
88 std::remove(new_name.c_str());
89 }
90 if (libMesh::Utility::ends_with(name, ".xz"))
91 {
92 std::string new_name(name.begin(), name.end()-3);
93 new_name += pid_suffix.str();
94 std::remove(new_name.c_str());
95 }
96}
97}
98
99namespace libMesh
100{
101
102//-------------------------------------------------------------
103// Xdr class implementation
104Xdr::Xdr (std::string name,
105 const XdrMODE m) :
106 mode(m),
107 file_name(std::move(name)),
108#ifdef LIBMESH_HAVE_XDR
109 fp(nullptr),
110#endif
111 in(),
112 out(),
113 comm_len(xdr_MAX_STRING_LENGTH),
114 gzipped_file(false),
115 bzipped_file(false),
116 xzipped_file(false),
117 version_number(LIBMESH_VERSION_ID(LIBMESH_MAJOR_VERSION, LIBMESH_MINOR_VERSION, LIBMESH_MICRO_VERSION))
118{
119 this->open(file_name);
120}
121
122
123
124Xdr::Xdr (std::ostream & stream) :
125 mode(WRITE),
126 file_name(),
127#ifdef LIBMESH_HAVE_XDR
128 fp(nullptr),
129#endif
130 in(),
131 out(std::make_unique<std::ostream>(stream.rdbuf())),
132 comm_len(xdr_MAX_STRING_LENGTH),
133 gzipped_file(false),
134 bzipped_file(false),
135 xzipped_file(false),
136 version_number(LIBMESH_VERSION_ID(LIBMESH_MAJOR_VERSION, LIBMESH_MINOR_VERSION, LIBMESH_MICRO_VERSION))
137{
138}
139
140
141
142Xdr::Xdr (std::istream & stream) :
143 mode(READ),
144 file_name(),
145#ifdef LIBMESH_HAVE_XDR
146 fp(nullptr),
147#endif
148 in(std::make_unique<std::istream>(stream.rdbuf())),
149 out(),
150 comm_len(xdr_MAX_STRING_LENGTH),
151 gzipped_file(false),
152 bzipped_file(false),
153 xzipped_file(false),
154 version_number(LIBMESH_VERSION_ID(LIBMESH_MAJOR_VERSION, LIBMESH_MINOR_VERSION, LIBMESH_MICRO_VERSION))
155{
156}
157
158
159
161{
162 this->close();
163}
164
165
166
167void Xdr::open (std::string name)
168{
169 file_name = std::move(name);
170
171 if (file_name == "")
172 return;
173
174 switch (mode)
175 {
176 case ENCODE:
177 case DECODE:
178 {
179#ifdef LIBMESH_HAVE_XDR
180
181 fp = fopen(file_name.c_str(), (mode == ENCODE) ? "w" : "r");
182 if (!fp)
183 libmesh_file_error(file_name.c_str());
184 xdrs = std::make_unique<XDR>();
185 xdrstdio_create (xdrs.get(), fp, (mode == ENCODE) ? XDR_ENCODE : XDR_DECODE);
186#else
187
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");
191
192#endif
193 return;
194
195 }
196
197 case READ:
198 {
202
203 if (gzipped_file)
204 {
205#ifdef LIBMESH_HAVE_GZSTREAM
206 auto inf = std::make_unique<igzstream>();
207 libmesh_assert(inf);
208 inf->open(file_name.c_str(), std::ios::in);
209 in = std::move(inf);
210#else
211 libmesh_error_msg("ERROR: need gzstream to handle .gz files!!!");
212#endif
213 }
214 else
215 {
216 auto inf = std::make_unique<std::ifstream>();
217 libmesh_assert(inf);
218
219 std::string new_name = Utility::unzip_file(file_name);
220
221 inf->open(new_name.c_str(), std::ios::in);
222 in = std::move(inf);
223 }
224
225 libmesh_assert(in.get());
226
227 if (!in->good())
228 libmesh_file_error(file_name);
229 return;
230 }
231
232 case WRITE:
233 {
234 gzipped_file = (file_name.rfind(".gz") == file_name.size() - 3);
235 bzipped_file = (file_name.rfind(".bz2") == file_name.size() - 4);
236 xzipped_file = (file_name.rfind(".xz") == file_name.size() - 3);
237
238 if (gzipped_file)
239 {
240#ifdef LIBMESH_HAVE_GZSTREAM
241 auto outf = std::make_unique<ogzstream>();
242 libmesh_assert(outf);
243 outf->open(file_name.c_str(), std::ios::out);
244 out = std::move(outf);
245#else
246 libmesh_error_msg("ERROR: need gzstream to handle .gz files!!!");
247#endif
248 }
249 else
250 {
251 auto outf = std::make_unique<std::ofstream>();
252 libmesh_assert(outf);
253
254 std::string new_name = file_name;
255
256 if (bzipped_file)
257 new_name.erase(new_name.end() - 4, new_name.end());
258
259 if (xzipped_file)
260 new_name.erase(new_name.end() - 3, new_name.end());
261
262 outf->open(new_name.c_str(), std::ios::out);
263 out = std::move(outf);
264 }
265
266 libmesh_assert(out.get());
267 libmesh_assert (out->good());
268 return;
269 }
270
271 default:
272 libmesh_error_msg("Invalid mode = " << mode);
273 }
274}
275
276
277
279{
280 switch (mode)
281 {
282 case ENCODE:
283 case DECODE:
284 {
285#ifdef LIBMESH_HAVE_XDR
286
287 if (xdrs)
288 {
289 xdr_destroy (xdrs.get());
290 xdrs.reset();
291 }
292
293 if (fp)
294 {
295 fflush(fp);
296 fclose(fp);
297 fp = nullptr;
298 }
299#else
300
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");
304
305#endif
306 file_name = "";
307 return;
308 }
309
310 case READ:
311 {
312 if (in.get() != nullptr)
313 {
314 in.reset();
315
317 remove_unzipped_file(file_name);
318 }
319 file_name = "";
320 return;
321 }
322
323 case WRITE:
324 {
325 if (out.get() != nullptr)
326 {
327 out.reset();
328
329 if (bzipped_file)
330 bzip_file(std::string(file_name.begin(), file_name.end()-4));
331
332 else if (xzipped_file)
333 xzip_file(std::string(file_name.begin(), file_name.end()-3));
334 }
335 file_name = "";
336 return;
337 }
338
339 default:
340 libmesh_error_msg("Invalid mode = " << mode);
341 }
342}
343
344
345
346bool Xdr::is_open() const
347{
348 switch (mode)
349 {
350 case ENCODE:
351 case DECODE:
352 {
353#ifdef LIBMESH_HAVE_XDR
354
355 if (fp)
356 if (xdrs)
357 return true;
358
359 return false;
360
361#else
362
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");
366
367 return false;
368
369#endif
370
371 }
372
373 case READ:
374 {
375 if (in.get() != nullptr)
376 return in->good();
377 return false;
378 }
379
380 case WRITE:
381 {
382 if (out.get() != nullptr)
383 return out->good();
384 return false;
385 }
386
387 default:
388 libmesh_error_msg("Invalid mode = " << mode);
389 }
390
391 return false;
392}
393
394
395
397{
398 switch (mode)
399 {
400 case ENCODE:
401 case DECODE:
402 {
403#ifdef LIBMESH_HAVE_XDR
405
406 // Are we already at eof?
407 if (feof(fp))
408 return true;
409
410 // Or about to reach eof?
411 int next = fgetc(fp);
412 if (next == EOF)
413 {
414 // We should *only* be at EOF, not otherwise broken
415 libmesh_assert(feof(fp));
416 libmesh_assert(!ferror(fp));
417
418 // Reset the EOF indicator
419 clearerr(fp);
420 libmesh_assert(!ferror(fp));
421
422 // We saw EOF
423 return true;
424 }
425
426 // We didn't see EOF; restore whatever we did see.
427 ungetc(next, fp);
428 break;
429#else
430
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");
434
435 return false;
436
437#endif
438
439 }
440 case READ:
441 {
442 libmesh_assert(in.get());
443
444 // Are we already at eof?
445 if (in->eof())
446 return true;
447
448 // Or about to reach eof?
449 int next = in->peek();
450 if (next == EOF)
451 {
452 // We should *only* be at EOF, not otherwise broken
453 libmesh_assert(in->eof());
454 libmesh_assert(!in->fail());
455
456 // Reset the EOF indicator
457 in->clear();
458 libmesh_assert(in->good());
459
460 // We saw EOF
461 return true;
462 }
463 break;
464 }
465 default:
466 libmesh_error();
467 }
468
469 return false;
470}
471
472
473
474#ifdef LIBMESH_HAVE_XDR
475
476// Anonymous namespace for Xdr::data helper functions
477namespace
478{
479
480template <typename T>
481xdrproc_t xdr_translator();
482
483template <typename T>
484bool xdr_translate(XDR * x, T & a)
485{
486 return (xdr_translator<T>())(x, &a, 0);
487}
488
489template <>
490bool xdr_translate(XDR * x,
491 std::string & s)
492{
493 char sptr[xdr_MAX_STRING_LENGTH+1];
494 std::copy(s.begin(), s.end(), sptr);
495 sptr[s.size()] = 0;
496 unsigned int length = xdr_MAX_STRING_LENGTH;
497
498 // Get a pointer to the beginning of the buffer. We need to pass
499 // its address to the xdr API.
500 char * begin = sptr;
501 bool b = xdr_string(x, &begin, length);
502
503 // This is necessary when reading, but inefficient when writing...
504 length = cast_int<unsigned int>(std::strlen(sptr));
505 s.resize(length);
506 std::copy(sptr, sptr+length, s.begin());
507
508 return b;
509}
510
511template <typename T>
512bool xdr_translate(XDR * x, std::complex<T> & a)
513{
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);
518 return (b1 && b2);
519}
520
521template <typename T>
522bool xdr_translate(XDR * x, std::vector<T> & a)
523{
524 unsigned int length = cast_int<unsigned int>(a.size());
525 xdr_u_int(x, &length);
526 if (length > 0)
527 {
528 a.resize(length);
529 return xdr_vector(x, reinterpret_cast<char *>(a.data()), length, sizeof(T),
530 xdr_translator<T>());
531 }
532 else
533 return true;
534}
535
536template <typename T>
537bool xdr_translate(XDR * x, std::vector<std::complex<T>> & a)
538{
539 unsigned int length = cast_int<unsigned int>(a.size());
540 bool b = xdr_u_int(x, &length);
541 a.resize(length);
542 for (auto & val : a)
543 if (!xdr_translate(x, val))
544 b = false;
545 return b;
546}
547
548template <>
549bool xdr_translate(XDR * x, std::vector<std::string> & s)
550{
551 unsigned int length = cast_int<unsigned int>(s.size());
552 bool b = xdr_u_int(x, &length);
553 s.resize(length);
554 for (auto & val : s)
555 if (!xdr_translate(x, val))
556 b = false;
557 return b;
558}
559
560
561// https://lists.libguestfs.org/archives/list/guestfs@lists.libguestfs.org/message/JNRVVA5VOIDBBQHTF7QYRSWZ2AQG4P7U/
562//
563// With Mac OS X 10.9, xdrproc_t is no longer defined as:
564// typedef bool_t (*xdrproc_t)(XDR *, ...);
565// but instead as:
566// typdef bool_t (*xdrproc_t)(XDR *, void *, unsigned int);
567// For reference, Linux systems typically define it as:
568// typedef bool_t (*xdrproc_t)(XDR *, void *, ...);
569//
570// I'm not sure why it took over a decade later, but we're starting to
571// get "converts to incompatible function type" errors on some OSX
572// builds when trying to pass XDR's own functions to xdrproc_t
573// arguments - apparently because the xdr_foo functions now only take
574// two arguments? We'll add some shims to convert them.
575
576#ifdef __APPLE__
577
578// We want these shims to be as robust as possible, and it turns out
579// that *every* XDR implementation sucks in its own way: in TIRPC,
580// xdr_longlong_t does not actually take a long long *, it takes a
581// quad_t *, which my system defines as long *. My long and long long
582// are the same size, but a pointer to one can't be implicitly
583// converted into a pointer to the other. So, we'll do crazy template
584// tricks to make sure that, even when we reinterpret_cast that
585// pointer, we're not changing the underlying meaning.
586
587template<typename F>
588struct function_signature;
589
590template<typename returnval, typename... Args>
591struct function_signature<returnval (*)(Args...)>
592{
593 template <std::size_t N>
594 struct arg {
595 static_assert(N < sizeof...(Args), "Function argument index too high");
596 using type = typename std::tuple_element<N, std::tuple<Args...>>::type;
597 };
598};
599
600#define libmesh_define_xdr(ourfunc, theirfunc, cxx_type) \
601 bool_t libmesh_xdr_##ourfunc(XDR * x, cxx_type * v, unsigned int) { \
602 using api_type = \
603 std::remove_pointer<typename function_signature<decltype(&xdr_##theirfunc)>::template arg<1>::type>::type; \
604 static_assert(sizeof(cxx_type) == \
605 sizeof(api_type), \
606 "Cannot safely cast data for use with XDR"); \
607 return xdr_##theirfunc(x, reinterpret_cast<api_type *>(v)); \
608 }
609
610// In my OSX SDK, xdr_long is defined to take int*, not long*, despite
611// their sizes not matching. We'll use the long long* functions to be
612// safe while we wait for Apple programmers to repent of their sins.
613#ifdef __LP64__
614libmesh_define_xdr(long, longlong_t, long long)
615libmesh_define_xdr(u_long, u_longlong_t, unsigned long long)
616#else
617libmesh_define_xdr(long, long, long)
618libmesh_define_xdr(u_long, u_long, unsigned long)
619#endif
620
621#else
622 #define libmesh_define_xdr(ourfunc, theirfunc, type) \
623 const xdrproc_t libmesh_xdr_##ourfunc = (xdrproc_t)xdr_##theirfunc;
624
625libmesh_define_xdr(long, long, long)
626libmesh_define_xdr(u_long, u_long, unsigned long)
627#endif
628
629libmesh_define_xdr(char, char, char)
630libmesh_define_xdr(short, short, short)
631libmesh_define_xdr(int, int, int)
632libmesh_define_xdr(longlong_t, longlong_t, long long)
633libmesh_define_xdr(u_char, u_char, unsigned char)
634libmesh_define_xdr(u_short, u_short, unsigned short)
635libmesh_define_xdr(u_int, u_int, unsigned int)
636libmesh_define_xdr(u_longlong_t, u_longlong_t, unsigned long long)
637libmesh_define_xdr(float, float, float)
638libmesh_define_xdr(double, double, double)
639
640
641template <>
642xdrproc_t xdr_translator<int>()
643{
644 // Don't let XDR truncate anything on systems where int is 64-bit;
645 // xdr_int is hard-coded to write 32 bits.
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);
652 else
653 libmesh_error();
654}
655
656template <>
657xdrproc_t xdr_translator<unsigned int>()
658{
659 // Don't let XDR truncate anything on systems where int is 64-bit;
660 // xdr_u_int is hard-coded to write 32 bits.
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);
667 else
668 libmesh_error();
669}
670
671template <>
672xdrproc_t xdr_translator<long int>()
673{
674 // Don't let XDR truncate anything on systems where long is 64-bit;
675 // xdr_long is hard-coded to write 32 bits.
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);
680 else
681 libmesh_error();
682}
683
684template <>
685xdrproc_t xdr_translator<unsigned long int>()
686{
687 // Don't let XDR truncate anything on systems where long is 64-bit;
688 // xdr_u_long is hard-coded to write 32 bits. This bit us HARD.
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);
693 else
694 libmesh_error();
695}
696
697// All the other XDR routines should be safe, unless
698// 1. You're on a system with sizeof(short)==8 and you want to store
699// n>2^32 in a short; this will never happen since we assume
700// sizeof(short) may be as small as 2 bytes and we use at least int
701// for anything larger.
702// 2. You're on a system with sizeof(long long) > 8, and you want to
703// store n>2^64 in one. Welcome, 22nd century programmers; sorry we
704// couldn't accommodate you.
705template <>
706xdrproc_t xdr_translator<long long>() { return (xdrproc_t)(libmesh_xdr_longlong_t); }
707
708template <>
709xdrproc_t xdr_translator<unsigned long long>() { return (xdrproc_t)(libmesh_xdr_u_longlong_t); }
710
711template <>
712xdrproc_t xdr_translator<short int>() { return (xdrproc_t)(libmesh_xdr_short); }
713
714template <>
715xdrproc_t xdr_translator<unsigned short int>() { return (xdrproc_t)(libmesh_xdr_u_short); }
716
717template <>
718xdrproc_t xdr_translator<char>() { return (xdrproc_t)(libmesh_xdr_char); }
719
720template <>
721xdrproc_t xdr_translator<signed char>() { return (xdrproc_t)(libmesh_xdr_char); }
722
723template <>
724xdrproc_t xdr_translator<unsigned char>() { return (xdrproc_t)(libmesh_xdr_u_char); }
725
726template <>
727xdrproc_t xdr_translator<float>() { return (xdrproc_t)(libmesh_xdr_float); }
728
729template <>
730xdrproc_t xdr_translator<double>() { return (xdrproc_t)(libmesh_xdr_double); }
731
732// FIXME - no XDR love for quadruple precision; not even for long double?
733template <>
734xdrproc_t xdr_translator<long double>() { return (xdrproc_t)(libmesh_xdr_double); }
735
736#ifdef LIBMESH_DEFAULT_QUADRUPLE_PRECISION
737template <>
738xdrproc_t xdr_translator<Real>() { return (xdrproc_t)(libmesh_xdr_double); }
739#endif
740
741} // end anonymous namespace
742
743#endif
744
745template <typename T>
746void Xdr::do_read(T & a)
747{
748 *in >> a;
749 in->getline(comm, comm_len);
750}
751
752template <typename T>
753void Xdr::do_read(std::complex<T> & a)
754{
755 T r, i;
756 *in >> r >> i;
757 a = std::complex<T>(r,i);
758 in->getline(comm, comm_len);
759}
760
761template <>
762void Xdr::do_read(std::string & a)
763{
764 in->getline(comm, comm_len);
765
766 a = "";
767
768 for (unsigned int c=0, sl=std::strlen(comm); c!=sl; c++)
769 {
770 if (comm[c] == '\t')
771 break;
772 a.push_back(comm[c]);
773 }
774}
775
776template <typename T>
777void Xdr::do_read(std::vector<T> & a)
778{
779 unsigned int length=0;
780 data(length, "# vector length");
781 a.resize(length);
782
783 for (T & a_i : a)
784 {
785 libmesh_assert(in.get());
786 libmesh_assert (in->good());
787 *in >> a_i;
788 }
789 in->getline(comm, comm_len);
790}
791
792template <typename T>
793void Xdr::do_read(std::vector<std::complex<T>> & a)
794{
795 unsigned int length=0;
796 data(length, "# vector length x 2 (complex)");
797 a.resize(length);
798
799 for (std::complex<T> & a_i : a)
800 {
801 T r, im;
802 libmesh_assert(in.get());
803 libmesh_assert (in->good());
804 *in >> r >> im;
805 a_i = std::complex<T>(r,im);
806 }
807 in->getline(comm, comm_len);
808}
809
810template <typename T>
811void Xdr::do_write(T & a) { *out << a; }
812
813template <typename T>
814void Xdr::do_write(std::complex<T> & a)
815{
816 *out << a.real() << "\t " << a.imag();
817}
818
819template <typename T>
820void Xdr::do_write(std::vector<T> & a)
821{
822 std::size_t length = a.size();
823 data(length, "# vector length");
824
825 // Use scientific precision with lots of digits for the original type T.
826 *out << std::scientific
827 << std::setprecision(std::numeric_limits<T>::max_digits10);
828
829 for (T & a_i : a)
830 {
831 libmesh_assert(out.get());
832 libmesh_assert (out->good());
833 this->do_write(a_i);
834 *out << "\t ";
835 }
836}
837
838template <typename T>
839void Xdr::do_write(std::vector<std::complex<T>> & a)
840{
841 std::size_t length=a.size();
842 data(length, "# vector length x 2 (complex)");
843
844 // Use scientific precision with lots of digits for the original type T.
845 *out << std::scientific
846 << std::setprecision(std::numeric_limits<T>::max_digits10);
847
848 for (std::complex<T> & a_i : a)
849 {
850 libmesh_assert(out.get());
851 libmesh_assert (out->good());
852 this->do_write(a_i);
853 *out << "\t ";
854 }
855}
856
857
858
859template <typename T>
860void Xdr::data (T & a, std::string_view comment_in)
861{
862 switch (mode)
863 {
864 case ENCODE:
865 case DECODE:
866 {
867#ifdef LIBMESH_HAVE_XDR
868
870
871 xdr_translate(xdrs.get(), a);
872
873#else
874
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");
878
879#endif
880 return;
881 }
882
883 case READ:
884 {
885 libmesh_assert(in.get());
886 libmesh_assert (in->good());
887
888 this->do_read(a);
889
890 return;
891 }
892
893 case WRITE:
894 {
895 libmesh_assert(out.get());
896 libmesh_assert (out->good());
897
898 // We will use scientific notation sufficient to exactly
899 // represent our floating point precision in the following
900 // output. The desired precision and format will
901 // automatically determine the width.
902 *out << std::scientific
903 << std::setprecision(std::numeric_limits<T>::max_digits10);
904
905 this->do_write(a);
906
907 // If there's a comment provided, write a tab character and
908 // then the comment.
909 if (comment_in != "")
910 *out << "\t " << comment_in;
911
912 // Go to the next line.
913 *out << '\n';
914
915 return;
916 }
917
918 default:
919 libmesh_error_msg("Invalid mode = " << mode);
920 }
921}
922
923
924template <typename T>
925void Xdr::data_stream (T * val, const unsigned int len, const unsigned int line_break)
926{
927 switch (mode)
928 {
929 case ENCODE:
930 {
931#ifdef LIBMESH_HAVE_XDR
932
933 libmesh_assert (this->is_open());
934
935 unsigned int size_of_type = cast_int<unsigned int>(sizeof(T));
936
937 xdr_vector(xdrs.get(),
938 (char *) val,
939 len,
940 size_of_type,
941 xdr_translator<T>());
942#else
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");
946
947#endif
948 return;
949 }
950
951 case DECODE:
952 {
953#ifdef LIBMESH_HAVE_XDR
954
955 libmesh_assert (this->is_open());
956
957 unsigned int size_of_type = cast_int<unsigned int>(sizeof(T));
958
959 if (len > 0)
960 xdr_vector(xdrs.get(),
961 (char *) val,
962 len,
963 size_of_type,
964 xdr_translator<T>());
965#else
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");
969
970#endif
971 return;
972 }
973
974 case READ:
975 {
976 libmesh_assert(in.get());
977 libmesh_assert (in->good());
978
979 for (unsigned int i=0; i<len; i++)
980 {
981 libmesh_assert(in.get());
982 libmesh_assert (in->good());
983 *in >> val[i];
984 }
985
986 return;
987 }
988
989 case WRITE:
990 {
991 libmesh_assert(out.get());
992 libmesh_assert (out->good());
993
994 // We will use scientific notation sufficient to exactly
995 // represent our floating point precision in the following
996 // output. The desired precision and format will
997 // automatically determine the width.
998 *out << std::scientific
999 << std::setprecision(std::numeric_limits<T>::max_digits10);
1000
1001 if (line_break == libMesh::invalid_uint)
1002 for (unsigned int i=0; i<len; i++)
1003 {
1004 libmesh_assert(out.get());
1005 libmesh_assert (out->good());
1006 *out << val[i] << " ";
1007 }
1008 else
1009 {
1010 const unsigned imax = std::min(line_break, len);
1011 unsigned int cnt=0;
1012 while (cnt < len)
1013 {
1014 for (unsigned int i=0; (i<imax && cnt<len); i++)
1015 {
1016 libmesh_assert(out.get());
1017 libmesh_assert (out->good());
1018 *out << val[cnt++];
1019
1020 // Write a space unless this is the last character on the current line.
1021 if (i+1 != imax)
1022 *out << " ";
1023 }
1024 libmesh_assert(out.get());
1025 libmesh_assert (out->good());
1026 *out << '\n';
1027 }
1028 }
1029
1030 return;
1031 }
1032
1033 default:
1034 libmesh_error_msg("Invalid mode = " << mode);
1035 }
1036}
1037
1038
1039
1040template <>
1041void Xdr::data_stream (double * val, const unsigned int len, const unsigned int line_break)
1042{
1043 this->_xfp_data_stream
1044 (val, len,
1045#ifdef LIBMESH_HAVE_XDR
1046 (xdrproc_t)libmesh_xdr_double,
1047#else
1048 nullptr,
1049#endif
1050 line_break, std::numeric_limits<double>::max_digits10);
1051}
1052
1053
1054
1055template <>
1056void Xdr::data_stream (float * val, const unsigned int len, const unsigned int line_break)
1057{
1058 this->_xfp_data_stream
1059 (val, len,
1060#ifdef LIBMESH_HAVE_XDR
1061 (xdrproc_t)libmesh_xdr_float,
1062#else
1063 nullptr,
1064#endif
1065 line_break, std::numeric_limits<float>::max_digits10);
1066}
1067
1068
1069
1070template <>
1071void Xdr::data_stream (long double * val, const unsigned int len, const unsigned int line_break)
1072{
1073 this->_xfp_data_stream
1074 (val, len, nullptr, line_break,
1075 std::numeric_limits<long double>::max_digits10);
1076}
1077
1078
1079#ifdef LIBMESH_DEFAULT_QUADRUPLE_PRECISION
1080template <>
1081void Xdr::data_stream (Real * val, const unsigned int len, const unsigned int line_break)
1082{
1083 this->_xfp_data_stream(val, len, nullptr, line_break, 36);
1084}
1085#endif // LIBMESH_DEFAULT_QUADRUPLE_PRECISION
1086
1087
1088
1089template <typename XFP>
1090void Xdr::_xfp_data_stream (XFP * val, const unsigned int len,
1091#ifdef LIBMESH_HAVE_XDR
1092 xdrproc_t xdr_proc,
1093#else
1094 void *,
1095#endif
1096 const unsigned int line_break,
1097 const int n_digits)
1098{
1099 switch (mode)
1100 {
1101 case ENCODE:
1102 case DECODE:
1103 {
1104#ifdef LIBMESH_HAVE_XDR
1105 libmesh_assert (this->is_open());
1106
1107 if (len > 0)
1108 {
1109 if (xdr_proc)
1110 {
1111 xdr_vector(xdrs.get(),
1112 (char *) val,
1113 len,
1114 sizeof(XFP),
1115 xdr_proc);
1116 return;
1117 }
1118
1119 // FIXME[JWP]: How to implement this for long double? Mac
1120 // OS X defines 'xdr_quadruple' but AFAICT, it does not
1121 // exist for Linux... for now, reading/writing XDR files
1122 // with long doubles drops back to double precision, but
1123 // you can still write long double ASCII files of course.
1124
1125 // FIXME[RHS]: 128 bit FP has the same problem as long
1126 // double, only much worse since even _Quad/__float128
1127 // aren't standard either.
1128
1129 std::vector<double> io_buffer (len);
1130
1131 // Fill io_buffer if we are writing.
1132 if (mode == ENCODE)
1133 for (unsigned int i=0, cnt=0; i<len; i++)
1134 io_buffer[cnt++] = double(val[i]);
1135
1136 xdr_vector(xdrs.get(),
1137 reinterpret_cast<char *>(io_buffer.data()),
1138 len,
1139 sizeof(double),
1140 (xdrproc_t) libmesh_xdr_double);
1141
1142 // Fill val array if we are reading.
1143 if (mode == DECODE)
1144 for (unsigned int i=0, cnt=0; i<len; i++)
1145 {
1146 val[i] = io_buffer[cnt++];
1147 }
1148 }
1149
1150#else
1151
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");
1155
1156#endif
1157 return;
1158 }
1159
1160 case READ:
1161 {
1162 libmesh_assert(in.get());
1163 libmesh_assert (in->good());
1164
1165 for (unsigned int i=0; i<len; i++)
1166 {
1167 libmesh_assert(in.get());
1168 libmesh_assert (in->good());
1169 *in >> val[i];
1170 }
1171
1172 return;
1173 }
1174
1175 case WRITE:
1176 {
1177 libmesh_assert(out.get());
1178 libmesh_assert (out->good());
1179
1180 // Save stream flags
1181 std::ios_base::fmtflags out_flags = out->flags();
1182
1183 // We will use scientific notation with specified digit
1184 // count in the following output. The desired precision and
1185 // format will automatically determine the width.
1186 *out << std::scientific
1187 << std::setprecision(n_digits);
1188
1189 if (line_break == libMesh::invalid_uint)
1190 for (unsigned int i=0; i<len; i++)
1191 {
1192 libmesh_assert(out.get());
1193 libmesh_assert (out->good());
1194 *out << val[i] << ' ';
1195 }
1196 else
1197 {
1198 const unsigned imax = std::min(line_break, len);
1199 unsigned int cnt=0;
1200 while (cnt < len)
1201 {
1202 for (unsigned int i=0; (i<imax && cnt<len); i++)
1203 {
1204 libmesh_assert(out.get());
1205 libmesh_assert (out->good());
1206 *out << val[cnt++];
1207
1208 // Write a space unless this is the last character on the current line.
1209 if (i+1 != imax)
1210 *out << " ";
1211 }
1212 libmesh_assert(out.get());
1213 libmesh_assert (out->good());
1214 *out << '\n';
1215 }
1216 }
1217
1218 // Restore stream flags
1219 out->flags(out_flags);
1220
1221 return;
1222 }
1223
1224 default:
1225 libmesh_error_msg("Invalid mode = " << mode);
1226 }
1227}
1228
1229
1230
1231template <>
1232void Xdr::data_stream (std::complex<double> * val, const unsigned int len, const unsigned int line_break)
1233{
1234 this->_complex_data_stream(val, len, line_break);
1235}
1236
1237
1238
1239template <>
1240void Xdr::data_stream (std::complex<long double> * val, const unsigned int len, const unsigned int line_break)
1241{
1242 this->_complex_data_stream(val, len, line_break);
1243}
1244
1245
1246
1247template <typename T>
1248void Xdr::_complex_data_stream (std::complex<T> * val, const unsigned int len, const unsigned int line_break)
1249{
1250 switch (mode)
1251 {
1252 case ENCODE:
1253 case DECODE:
1254 {
1255#ifdef LIBMESH_HAVE_XDR
1256
1257 libmesh_assert (this->is_open());
1258
1259 // FIXME[JWP]: How to implement this for long double? Mac OS
1260 // X defines 'xdr_quadruple' but AFAICT, it does not exist for
1261 // Linux... for now, reading/writing XDR files with long
1262 // doubles drops back to double precision, but you can still
1263 // write long double ASCII files of course.
1264
1265 if (len > 0)
1266 {
1267 std::vector<double> io_buffer (2*len);
1268
1269 // Fill io_buffer if we are writing.
1270 if (mode == ENCODE)
1271 for (unsigned int i=0, cnt=0; i<len; i++)
1272 {
1273 io_buffer[cnt++] = val[i].real();
1274 io_buffer[cnt++] = val[i].imag();
1275 }
1276
1277 xdr_vector(xdrs.get(),
1278 reinterpret_cast<char *>(io_buffer.data()),
1279 2*len,
1280 sizeof(double),
1281 (xdrproc_t) libmesh_xdr_double);
1282
1283 // Fill val array if we are reading.
1284 if (mode == DECODE)
1285 for (unsigned int i=0, cnt=0; i<len; i++)
1286 {
1287 double re = io_buffer[cnt++];
1288 double im = io_buffer[cnt++];
1289 val[i] = std::complex<T>(re, im);
1290 }
1291 }
1292#else
1293
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");
1297
1298#endif
1299 return;
1300 }
1301
1302 case READ:
1303 {
1304 libmesh_assert(in.get());
1305 libmesh_assert (in->good());
1306
1307 for (unsigned int i=0; i<len; i++)
1308 {
1309 libmesh_assert(in.get());
1310 libmesh_assert (in->good());
1311 T re, im;
1312 *in >> re >> im;
1313 val[i] = std::complex<T>(re,im);
1314 }
1315
1316 return;
1317 }
1318
1319 case WRITE:
1320 {
1321 libmesh_assert(out.get());
1322 libmesh_assert (out->good());
1323
1324
1325 // Save stream flags
1326 std::ios_base::fmtflags out_flags = out->flags();
1327
1328 // We will use scientific notation with a precision of
1329 // 'max_digits10' digits in the following output. The desired
1330 // precision and format will automatically determine the
1331 // width. Note: digit10 is the number of digits (in decimal
1332 // base) that can be represented without change. Equivalent
1333 // to FLT_DIG, DBL_DIG or LDBL_DIG for floating types.
1334 *out << std::scientific
1335 << std::setprecision(std::numeric_limits<T>::max_digits10);
1336
1337 if (line_break == libMesh::invalid_uint)
1338 for (unsigned int i=0; i<len; i++)
1339 {
1340 libmesh_assert(out.get());
1341 libmesh_assert (out->good());
1342 *out << val[i].real() << ' ' << val[i].imag() << ' ';
1343 }
1344 else
1345 {
1346 const unsigned imax = std::min(line_break, len);
1347 unsigned int cnt=0;
1348 while (cnt < len)
1349 {
1350 for (unsigned int i=0; (i<imax && cnt<len); i++)
1351 {
1352 libmesh_assert(out.get());
1353 libmesh_assert (out->good());
1354 *out << val[cnt].real() << ' ' << val[cnt].imag();
1355 cnt++;
1356
1357 // Write a space unless this is the last character on the current line.
1358 if (i+1 != imax)
1359 *out << " ";
1360 }
1361 libmesh_assert(out.get());
1362 libmesh_assert (out->good());
1363 *out << '\n';
1364 }
1365 }
1366
1367 // Restore stream flags
1368 out->flags(out_flags);
1369
1370 return;
1371 }
1372
1373 default:
1374 libmesh_error_msg("Invalid mode = " << mode);
1375 }
1376}
1377
1378
1379
1380void Xdr::comment (std::string & comment_in)
1381{
1382 switch (mode)
1383 {
1384 case ENCODE:
1385 case DECODE:
1386 {
1387 return;
1388 }
1389
1390 case READ:
1391 {
1392 libmesh_assert(in.get());
1393 libmesh_assert (in->good());
1394 in->getline(comm, comm_len);
1395 return;
1396 }
1397
1398 case WRITE:
1399 {
1400 libmesh_assert(out.get());
1401 libmesh_assert (out->good());
1402 *out << "\t " << comment_in << '\n';
1403 return;
1404 }
1405
1406 default:
1407 libmesh_error_msg("Invalid mode = " << mode);
1408 }
1409}
1410
1411
1412#undef xdr_REAL
1413
1414
1415//
1416template LIBMESH_EXPORT void Xdr::data<int> (int &, std::string_view);
1417template LIBMESH_EXPORT void Xdr::data<unsigned int> (unsigned int &, std::string_view);
1418template LIBMESH_EXPORT void Xdr::data<unsigned short int> (unsigned short int &, std::string_view);
1419template LIBMESH_EXPORT void Xdr::data<short int> (short int &, std::string_view);
1420template LIBMESH_EXPORT void Xdr::data<unsigned long int> (unsigned long int &, std::string_view);
1421template LIBMESH_EXPORT void Xdr::data<unsigned long long> (unsigned long long &, std::string_view);
1422template LIBMESH_EXPORT void Xdr::data<long int> (long int &, std::string_view);
1423template LIBMESH_EXPORT void Xdr::data<long long> (long long &, std::string_view);
1424template LIBMESH_EXPORT void Xdr::data<char> (char &, std::string_view);
1425template LIBMESH_EXPORT void Xdr::data<signed char> (signed char &, std::string_view);
1426template LIBMESH_EXPORT void Xdr::data<unsigned char> (unsigned char &, std::string_view);
1427template LIBMESH_EXPORT void Xdr::data<float> (float &, std::string_view);
1428template LIBMESH_EXPORT void Xdr::data<double> (double &, std::string_view);
1429template LIBMESH_EXPORT void Xdr::data<long double> (long double &, std::string_view);
1430template LIBMESH_EXPORT void Xdr::data<std::complex<float>> (std::complex<float> &, std::string_view);
1431template LIBMESH_EXPORT void Xdr::data<std::complex<double>> (std::complex<double> &, std::string_view);
1432template LIBMESH_EXPORT void Xdr::data<std::complex<long double>> (std::complex<long double> &, std::string_view);
1433template LIBMESH_EXPORT void Xdr::data<std::string> (std::string &, std::string_view);
1434template LIBMESH_EXPORT void Xdr::data<std::vector<int>> (std::vector<int> &, std::string_view);
1435template LIBMESH_EXPORT void Xdr::data<std::vector<unsigned int>> (std::vector<unsigned int> &, std::string_view);
1436template LIBMESH_EXPORT void Xdr::data<std::vector<short int>> (std::vector<short int> &, std::string_view);
1437template LIBMESH_EXPORT void Xdr::data<std::vector<unsigned short int>> (std::vector<unsigned short int> &, std::string_view);
1438template LIBMESH_EXPORT void Xdr::data<std::vector<long int>> (std::vector<long int> &, std::string_view);
1439template LIBMESH_EXPORT void Xdr::data<std::vector<long long>> (std::vector<long long> &, std::string_view);
1440template LIBMESH_EXPORT void Xdr::data<std::vector<unsigned long int>> (std::vector<unsigned long int> &, std::string_view);
1441template LIBMESH_EXPORT void Xdr::data<std::vector<unsigned long long>> (std::vector<unsigned long long> &, std::string_view);
1442template LIBMESH_EXPORT void Xdr::data<std::vector<char>> (std::vector<char> &, std::string_view);
1443template LIBMESH_EXPORT void Xdr::data<std::vector<signed char>> (std::vector<signed char> &, std::string_view);
1444template LIBMESH_EXPORT void Xdr::data<std::vector<unsigned char>> (std::vector<unsigned char> &, std::string_view);
1445template LIBMESH_EXPORT void Xdr::data<std::vector<float>> (std::vector<float> &, std::string_view);
1446template LIBMESH_EXPORT void Xdr::data<std::vector<double>> (std::vector<double> &, std::string_view);
1447template LIBMESH_EXPORT void Xdr::data<std::vector<long double>> (std::vector<long double> &, std::string_view);
1448template LIBMESH_EXPORT void Xdr::data<std::vector<std::complex<float>>> (std::vector<std::complex<float>> &, std::string_view);
1449template LIBMESH_EXPORT void Xdr::data<std::vector<std::complex<double>>> (std::vector<std::complex<double>> &, std::string_view);
1450template LIBMESH_EXPORT void Xdr::data<std::vector<std::complex<long double>>> (std::vector<std::complex<long double>> &, std::string_view);
1451template LIBMESH_EXPORT void Xdr::data<std::vector<std::string>> (std::vector<std::string> &, std::string_view);
1452template LIBMESH_EXPORT void Xdr::data_stream<unsigned char> (unsigned char * val, const unsigned int len, const unsigned int line_break);
1453template LIBMESH_EXPORT void Xdr::data_stream<short int> (short int * val, const unsigned int len, const unsigned int line_break);
1454template LIBMESH_EXPORT void Xdr::data_stream<int> (int * val, const unsigned int len, const unsigned int line_break);
1455template LIBMESH_EXPORT void Xdr::data_stream<long long> (long long * val, const unsigned int len, const unsigned int line_break);
1456template LIBMESH_EXPORT void Xdr::data_stream<unsigned short int> (unsigned short int * val, const unsigned int len, const unsigned int line_break);
1457template LIBMESH_EXPORT void Xdr::data_stream<unsigned int> (unsigned int * val, const unsigned int len, const unsigned int line_break);
1458template LIBMESH_EXPORT void Xdr::data_stream<unsigned long int> (unsigned long int * val, const unsigned int len, const unsigned int line_break);
1459template LIBMESH_EXPORT void Xdr::data_stream<unsigned long long> (unsigned long long * val, const unsigned int len, const unsigned int line_break);
1460
1461#ifdef LIBMESH_DEFAULT_QUADRUPLE_PRECISION
1462template LIBMESH_EXPORT void Xdr::data<Real> (Real &, std::string_view);
1463template LIBMESH_EXPORT void Xdr::data<std::complex<Real>> (std::complex<Real> &, std::string_view);
1464template LIBMESH_EXPORT void Xdr::data<std::vector<Real>> (std::vector<Real> &, std::string_view);
1465template LIBMESH_EXPORT void Xdr::data<std::vector<std::complex<Real>>> (std::vector<std::complex<Real>> &, std::string_view);
1466#endif
1467
1468} // namespace libMesh
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.
std::string file_name
The file name.
Definition xdr_cxx.h:239
bool bzipped_file
Definition xdr_cxx.h:275
bool is_open() const
Definition xdr_cxx.C:346
void _complex_data_stream(std::complex< T > *val, const unsigned int len, const unsigned int line_break)
Helper method for complex types.
Definition xdr_cxx.C:1248
void data_stream(T *val, const unsigned int len, const unsigned int line_break=libMesh::invalid_uint)
Inputs or outputs a raw data stream.
Definition xdr_cxx.C:925
const int comm_len
A buffer to put comment strings into.
Definition xdr_cxx.h:269
Xdr(std::string name="", const XdrMODE m=UNKNOWN)
File-based constructor.
Definition xdr_cxx.C:104
char comm[xdr_MAX_STRING_LENGTH]
Definition xdr_cxx.h:270
const XdrMODE mode
The mode used for accessing the file.
Definition xdr_cxx.h:234
FILE * fp
File pointer.
Definition xdr_cxx.h:252
void do_write(T &a)
Helper method for writing different data types.
Definition xdr_cxx.C:811
~Xdr()
Destructor.
Definition xdr_cxx.C:160
void comment(std::string &)
Writes or reads (ignores) a comment line.
Definition xdr_cxx.C:1380
std::unique_ptr< XDR > xdrs
Pointer to the standard XDR struct.
Definition xdr_cxx.h:247
bool gzipped_file
Are we reading/writing zipped files?
Definition xdr_cxx.h:275
std::unique_ptr< std::istream > in
The input file stream.
Definition xdr_cxx.h:259
std::unique_ptr< std::ostream > out
The output file stream.
Definition xdr_cxx.h:264
bool xzipped_file
Definition xdr_cxx.h:275
bool is_eof()
Definition xdr_cxx.C:396
void do_read(T &a)
Helper method for reading different data types.
Definition xdr_cxx.C:746
void open(std::string name)
Opens the file.
Definition xdr_cxx.C:167
void close()
Closes the file if it is open.
Definition xdr_cxx.C:278
void data(T &a, std::string_view comment="")
Inputs or outputs a single value.
Definition xdr_cxx.C:860
static const Real b
std::string name(const ElemQuality q)
This function returns a string containing some name for q.
bool ends_with(std::string_view superstring, std::string_view suffix)
Look for a substring at the very end of a string.
Definition utility.C:213
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 ...
Definition utility.C:164
The libMesh namespace provides an interface to certain functionality in the library.
libmesh_assert(ctx)
const unsigned int invalid_uint
A number which is used quite often to represent an invalid or uninitialized value for an unsigned int...
Definition libmesh.h:303
OStreamProxy out
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
XdrMODE
Defines an enum for read/write mode in Xdr format.
const unsigned int xdr_MAX_STRING_LENGTH
Definition xdr_cxx.h:45