37 std::ifstream in (
name.c_str(), std::ios::in|std::ios::binary);
40 libmesh_error_msg(
"Error reading input file " <<
name);
45 <<
"Reading input file " <<
name 47 <<
"-------------------------------------------------------------------------" 55 <<
"-------------------------------------------------------------------------" 64 libmesh_assert (in.good());
75 for (
unsigned int i=0; i<8; i++)
96 in.read (
buf, LIBMESH_SIZEOF_INT);
97 std::memcpy (&one,
buf, LIBMESH_SIZEOF_INT);
108 libmesh_assert_equal_to (rb(one), 1);
119 this->
title().clear();
123 in.read (
buf, LIBMESH_SIZEOF_INT);
124 std::memcpy (&i,
buf, LIBMESH_SIZEOF_INT);
129 this->
title() +=
static_cast<char>(i);
137 in.read (
buf, LIBMESH_SIZEOF_INT);
138 std::memcpy (&nv,
buf, LIBMESH_SIZEOF_INT);
145 for (
unsigned int v=0; v<this->
n_vars(); v++)
153 in.read (
buf, LIBMESH_SIZEOF_INT);
154 std::memcpy (&i,
buf, LIBMESH_SIZEOF_INT);
159 this->
var_name(v) +=
static_cast<char>(i);
170 std::vector<std::string> zname;
171 std::vector<int> ztype, zimax, zjmax, zkmax;
182 in.read (
buf, LIBMESH_SIZEOF_FLOAT);
183 std::memcpy (&f,
buf, LIBMESH_SIZEOF_FLOAT);
186 while ((f != 299.) &&
193 libmesh_error_msg(
"ERROR: Unexpected end-of-file!");
208 in.read (
buf, LIBMESH_SIZEOF_INT);
209 std::memcpy (&i,
buf, LIBMESH_SIZEOF_INT);
214 name +=
static_cast<char>(i);
218 zname.push_back(
name);
224 in.read (
buf, LIBMESH_SIZEOF_INT);
225 std::memcpy (&zt,
buf, LIBMESH_SIZEOF_INT);
236 in.read (
buf, LIBMESH_SIZEOF_INT);
237 std::memcpy (&zc,
buf, LIBMESH_SIZEOF_INT);
250 in.read (
buf, LIBMESH_SIZEOF_INT);
251 std::memcpy (&i_max,
buf, LIBMESH_SIZEOF_INT);
254 in.read (
buf, LIBMESH_SIZEOF_INT);
255 std::memcpy (&j_max,
buf, LIBMESH_SIZEOF_INT);
258 in.read (
buf, LIBMESH_SIZEOF_INT);
259 std::memcpy (&k_max,
buf, LIBMESH_SIZEOF_INT);
262 zimax.push_back (i_max);
263 zjmax.push_back (j_max);
264 zkmax.push_back (k_max);
268 while ((f != 357.) && in.good());
274 for (
unsigned int z=0; z<this->
n_zones(); z++)
278 this->
imax(z) = zimax[z];
279 this->
jmax(z) = zjmax[z];
280 this->
kmax(z) = zkmax[z];
297 in.read (
buf, LIBMESH_SIZEOF_INT);
298 std::memcpy (&one,
buf, LIBMESH_SIZEOF_INT);
309 libmesh_assert_equal_to (rb(one), 1);
320 this->
title().clear();
323 in.read (
buf, LIBMESH_SIZEOF_INT);
324 std::memcpy (&i,
buf, LIBMESH_SIZEOF_INT);
329 this->
title() +=
static_cast<char>(i);
337 in.read (
buf, LIBMESH_SIZEOF_INT);
338 std::memcpy (&nv,
buf, LIBMESH_SIZEOF_INT);
345 for (
unsigned int v=0; v<this->
n_vars(); v++)
353 in.read (
buf, LIBMESH_SIZEOF_INT);
354 std::memcpy (&i,
buf, LIBMESH_SIZEOF_INT);
359 this->
var_name(v) +=
static_cast<char>(i);
370 std::vector<std::string> zname;
371 std::vector<int> zpack, ztype, zimax, zjmax, zkmax;
382 in.read (
buf, LIBMESH_SIZEOF_FLOAT);
383 std::memcpy (&f,
buf, LIBMESH_SIZEOF_FLOAT);
386 while ((f != 299.) &&
393 libmesh_error_msg(
"ERROR: Unexpected end-of-file!");
408 in.read (
buf, LIBMESH_SIZEOF_INT);
409 std::memcpy (&i,
buf, LIBMESH_SIZEOF_INT);
414 name +=
static_cast<char>(i);
418 zname.push_back(
name);
424 in.read (
buf, LIBMESH_SIZEOF_INT);
425 std::memcpy (&zc,
buf, LIBMESH_SIZEOF_INT);
432 in.read (
buf, LIBMESH_SIZEOF_INT);
433 std::memcpy (&zt,
buf, LIBMESH_SIZEOF_INT);
442 in.read (
buf, LIBMESH_SIZEOF_INT);
443 std::memcpy (&dp,
buf, LIBMESH_SIZEOF_INT);
446 zpack.push_back (dp);
453 in.read (
buf, LIBMESH_SIZEOF_INT);
454 std::memcpy (&svl,
buf, LIBMESH_SIZEOF_INT);
458 for (
unsigned int v=0; v<this->
n_vars(); v++)
460 in.read (
buf, LIBMESH_SIZEOF_INT);
461 std::memcpy (&vl,
buf, LIBMESH_SIZEOF_INT);
463 libmesh_assert_equal_to (vl, 0);
472 in.read (
buf, LIBMESH_SIZEOF_INT);
473 std::memcpy (&fn,
buf, LIBMESH_SIZEOF_INT);
483 in.read (
buf, LIBMESH_SIZEOF_INT);
484 std::memcpy (&np,
buf, LIBMESH_SIZEOF_INT);
487 in.read (
buf, LIBMESH_SIZEOF_INT);
488 std::memcpy (&ne,
buf, LIBMESH_SIZEOF_INT);
491 zimax.push_back (np);
492 zjmax.push_back (ne);
501 in.read (
buf, LIBMESH_SIZEOF_INT);
502 std::memcpy (&i_max,
buf, LIBMESH_SIZEOF_INT);
505 in.read (
buf, LIBMESH_SIZEOF_INT);
506 std::memcpy (&j_max,
buf, LIBMESH_SIZEOF_INT);
509 in.read (
buf, LIBMESH_SIZEOF_INT);
510 std::memcpy (&k_max,
buf, LIBMESH_SIZEOF_INT);
517 zimax.push_back (i_max);
518 zjmax.push_back (j_max);
519 zkmax.push_back (k_max);
524 while ((f != 357.) && in.good());
530 for (
unsigned int z=0; z<this->
n_zones(); z++)
535 this->
imax(z) = zimax[z];
536 this->
jmax(z) = zjmax[z];
537 this->
kmax(z) = zkmax[z];
546 libmesh_error_msg(
"ERROR: This plot file was written by an unrecognized version of Tecplot!:\n" << this->
version());
559 << this->
title() << std::endl;
562 for (
unsigned int v=0; v<this->
n_vars(); v++)
567 for (
unsigned int v=0; v<this->
n_vars(); v++)
572 for (
unsigned int z=0; z<this->
n_zones(); z++)
577 for (
unsigned int z=0; z<this->
n_zones(); z++)
587 for (
unsigned int z=0; z<this->
n_zones(); z++)
589 << this->
imax(z) <<
"," 590 << this->
jmax(z) <<
"," 591 << this->
kmax(z) <<
")" 600 libmesh_assert (in.good());
614 for (
unsigned int zone=0; zone<this->
n_zones(); zone++)
633 in.read (
buf, LIBMESH_SIZEOF_FLOAT);
634 std::memcpy (&f,
buf, LIBMESH_SIZEOF_FLOAT);
637 while ((f != 299.) && in.good());
641 libmesh_error_msg(
"ERROR: Unexpected end-of-file!");
644 unsigned int n_rep_vars=0;
645 std::vector<int> rep_vars;
648 in.read (
buf, LIBMESH_SIZEOF_INT);
649 std::memcpy (&n_rep_vars,
buf, LIBMESH_SIZEOF_INT);
652 rep_vars.resize (n_rep_vars);
655 for (
unsigned int v=0; v<n_rep_vars; v++)
657 libmesh_error_msg(
"ERROR: I don't understand repeated variables yet!");
659 in.read (
buf, LIBMESH_SIZEOF_INT);
660 std::memcpy (&rep_vars[v],
buf, LIBMESH_SIZEOF_INT);
667 for (
unsigned int v=0; v<this->
n_vars(); v++)
669 in.read (
buf, LIBMESH_SIZEOF_INT);
670 std::memcpy (&this->
var_type(v),
buf, LIBMESH_SIZEOF_INT);
704 <<
" nnodes =" << this->
imax(zone) << std::endl
705 <<
" nelem =" << this->
jmax(zone) << std::endl
706 <<
" elem_type=" << this->
kmax(zone) << std::endl
719 libmesh_error_msg(
"ERROR: Unsupported Zone type: " << this->
zone_type(zone));
734 in.read (
buf, LIBMESH_SIZEOF_FLOAT);
735 std::memcpy (&f,
buf, LIBMESH_SIZEOF_FLOAT);
738 while ((f != 299.) && in.good());
742 libmesh_error_msg(
"ERROR: Unexpected end-of-file!");
745 for (
unsigned int v=0; v<this->
n_vars(); v++)
747 in.read (
buf, LIBMESH_SIZEOF_INT);
748 std::memcpy (&this->
var_type(v),
buf, LIBMESH_SIZEOF_INT);
759 in.read (
buf, LIBMESH_SIZEOF_INT);
760 std::memcpy (&vs,
buf, LIBMESH_SIZEOF_INT);
765 for (
unsigned int v=0; v<this->
n_vars(); v++)
767 in.read (
buf, LIBMESH_SIZEOF_INT);
768 std::memcpy (&sv,
buf, LIBMESH_SIZEOF_INT);
772 libmesh_error_msg(
"ERROR: I don't understand variable sharing!");
780 in.read (
buf, LIBMESH_SIZEOF_INT);
781 std::memcpy (&sc,
buf, LIBMESH_SIZEOF_INT);
784 libmesh_assert_equal_to (sc, -1);
800 libmesh_error_msg(
"Unrecognized zone_pack(zone) = " << this->
zone_pack(zone));
813 libmesh_error_msg(
"Unrecognized zone_pack(zone) = " << this->
zone_pack(zone));
822 libmesh_error_msg(
"ERROR: This plot file was written by an unrecognized version of Tecplot!:\n" << this->
version());
831 libmesh_assert (in.good());
838 for (
unsigned int var=0; var<this->
n_vars(); var++)
847 std::vector<float> &
data =
_data[zone][var];
854 in.read (reinterpret_cast<char *>(
data.data()), LIBMESH_SIZEOF_FLOAT*
data.size());
856 for (std::size_t i=0; i<
data.size(); i++)
865 std::vector<double> ddata;
866 std::vector<float> &
data =
_data[zone][var];
873 ddata.resize (this->
imax(zone)*
877 in.read (reinterpret_cast<char *>(ddata.data()), LIBMESH_SIZEOF_DOUBLE*ddata.size());
879 for (std::size_t i=0; i<
data.size(); i++)
880 data[i] =
float(rb(ddata[i]));
886 libmesh_error_msg(
"ERROR: Unsupported data type: " << this->
var_type(var));
895 libmesh_assert (in.good());
901 for (
unsigned int var=0; var<this->
n_vars(); var++)
903 std::vector<float> &
data =
_data[zone][var];
912 for (
unsigned int k=0; k<this->
kmax(zone); k++)
913 for (
unsigned int j=0; j<this->
jmax(zone); j++)
914 for (
unsigned int i=0; i<this->
imax(zone); i++)
915 for (
unsigned int var=0; var<this->
n_vars(); var++)
920 libmesh_assert (in.good());
922 in.read (
buf, LIBMESH_SIZEOF_FLOAT);
923 std::memcpy (&f,
buf, LIBMESH_SIZEOF_FLOAT);
926 _data[zone][var].push_back(f);
932 libmesh_assert (in.good());
934 in.read (
buf, LIBMESH_SIZEOF_DOUBLE);
935 std::memcpy (&d,
buf, LIBMESH_SIZEOF_DOUBLE);
938 _data[zone][var].push_back(
float(d));
941 libmesh_error_msg(
"ERROR: unsupported data type: " << this->
var_type(var));
948 libmesh_assert (in.good());
954 for (
unsigned int var=0; var<this->
n_vars(); var++)
962 std::vector<float> &
data =
_data[zone][var];
967 in.read (reinterpret_cast<char *>(
data.data()), LIBMESH_SIZEOF_FLOAT*
data.size());
969 for (std::size_t i=0; i<
data.size(); i++)
978 std::vector<double> ddata;
979 std::vector<float> &
data =
_data[zone][var];
983 ddata.resize (this->
imax(zone));
985 in.read (reinterpret_cast<char *>(ddata.data()), LIBMESH_SIZEOF_DOUBLE*ddata.size());
987 for (std::size_t i=0; i<
data.size(); i++)
988 data[i] =
float(rb(ddata[i]));
994 libmesh_error_msg(
"ERROR: Unsupported data type: " << this->
var_type(var));
1002 in.read ((
char *) &rep, LIBMESH_SIZEOF_INT);
1005 if (rep == 1 && this->
n_zones() > 1)
1006 libmesh_error_msg(
"ERROR: Repeated connectivity not supported!");
1011 libmesh_assert_less (zone,
_conn.size());
1012 libmesh_assert_less (this->
kmax(zone), 4);
1016 in.read (reinterpret_cast<char *>(
_conn[zone].
data()), LIBMESH_SIZEOF_INT*
_conn[zone].size());
1018 for (std::size_t i=0; i<
_conn[zone].size(); i++)
1028 libmesh_assert (in.good());
1034 for (
unsigned int var=0; var<this->
n_vars(); var++)
1036 std::vector<float> &
data =
_data[zone][var];
1043 for (
unsigned int i=0; i<this->
imax(zone); i++)
1044 for (
unsigned int var=0; var<this->
n_vars(); var++)
1049 libmesh_assert (in.good());
1051 in.read (
buf, LIBMESH_SIZEOF_FLOAT);
1052 std::memcpy (&f,
buf, LIBMESH_SIZEOF_FLOAT);
1055 _data[zone][var].push_back(f);
1061 libmesh_assert (in.good());
1063 in.read (
buf, LIBMESH_SIZEOF_DOUBLE);
1064 std::memcpy (&d,
buf, LIBMESH_SIZEOF_DOUBLE);
1067 _data[zone][var].push_back(
float(d));
1070 libmesh_error_msg(
"ERROR: unsupported data type: " << this->
var_type(var));
1077 in.read ((
char *) &rep, LIBMESH_SIZEOF_INT);
1081 libmesh_error_msg(
"ERROR: Repeated connectivity not supported!");
1086 libmesh_assert_less (zone,
_conn.size());
1087 libmesh_assert_less (this->
kmax(zone), 4);
1091 in.read (reinterpret_cast<char *>(
_conn[zone].
data()), LIBMESH_SIZEOF_INT*
_conn[zone].size());
1093 for (std::size_t i=0; i<
_conn[zone].size(); i++)
std::string name(const ElemQuality q)
void set_n_zones(const unsigned int nz)
unsigned int n_vars() const
std::vector< std::vector< int > > _conn
std::vector< std::vector< std::vector< float > > > _data
void read_point_data(std::istream &in, const unsigned int zn)
void set_n_vars(const unsigned int nv)
const std::string & var_name(const unsigned int v) const
void read(const std::string &name)
static const unsigned int NNodes[4]
unsigned int imax(const unsigned int z) const
const std::string & zone_name(const unsigned int z) const
unsigned int jmax(const unsigned int z) const
unsigned int zone_pack(const unsigned int z) const
OStreamProxy err(std::cerr)
void read_fepoint_data(std::istream &in, const unsigned int zn)
unsigned int n_nodes(const unsigned int z) const
BasicOStreamProxy & flush()
unsigned int var_type(const unsigned int v) const
const std::string & title() const
unsigned int n_zones() const
unsigned int kmax(const unsigned int z) const
void read_header(std::istream &in)
OStreamProxy out(std::cout)
void read_block_data(std::istream &in, const unsigned int zn)
const std::string & version() const
unsigned int n_elem(const unsigned int z) const
void read_data(std::istream &in)
void read_feblock_data(std::istream &in, const unsigned int zn)
unsigned int zone_type(const unsigned int z) const