$extrastylesheet
libMesh::PltLoader Class Reference

#include <plt_loader.h>

List of all members.

Public Types

enum  OldZoneType { BLOCK = 0, POINT, FEBLOCK, FEPOINT }
enum  NewZoneType {
  ORDERED = 0, FELINESEG, FETRIANGLE, FEQUADRILATERAL,
  FETETRAHEDRON, FEBRICK
}
enum  DataType {
  FLOAT = 1, DOUBLE, LONGINT, SHORTINT,
  BYTE, BIT
}
enum  FEType { TRI = 0, QUAD, TET, HEX }

Public Member Functions

 PltLoader (const bool v=false)
 PltLoader (const std::string &name, const bool v=false)
 ~PltLoader ()
void clear ()
bool verbose () const
void read (const std::string &name)
void write_dat (const std::string &name, const unsigned int version=10) const
const std::string & version () const
bool is_foreign () const
const std::string & title () const
unsigned int n_vars () const
const std::string & var_name (const unsigned int v) const
unsigned int var_type (const unsigned int v) const
unsigned int n_zones () const
unsigned int zone_type (const unsigned int z) const
const std::string & zone_name (const unsigned int z) const
unsigned int zone_pack (const unsigned int z) const
unsigned int imax (const unsigned int z) const
unsigned int jmax (const unsigned int z) const
unsigned int kmax (const unsigned int z) const
unsigned int n_nodes (const unsigned int z) const
unsigned int n_elem (const unsigned int z) const
FEType elem_type (const unsigned int z) const
const std::vector< std::vector
< std::vector< float > > > & 
get_data () const

Static Public Attributes

static const unsigned int NNodes [4] = {3, 4, 4, 8}

Private Member Functions

void read_header (std::istream &in)
void read_data (std::istream &in)
void read_block_data (std::istream &in, const unsigned int zn)
void read_point_data (std::istream &in, const unsigned int zn)
void read_feblock_data (std::istream &in, const unsigned int zn)
void read_fepoint_data (std::istream &in, const unsigned int zn)
std::string & version ()
bool & is_foreign ()
std::string & title ()
void set_n_vars (const unsigned int nv)
std::string & var_name (const unsigned int v)
unsigned int & var_type (const unsigned int v)
void set_n_zones (const unsigned int nz)
unsigned int & zone_type (const unsigned int z)
std::string & zone_name (const unsigned int z)
unsigned int & zone_pack (const unsigned int z)
unsigned int & imax (const unsigned int z)
unsigned int & jmax (const unsigned int z)
unsigned int & kmax (const unsigned int z)

Private Attributes

const bool _verbose
std::string _version
bool _is_foreign
std::string _title
unsigned int _n_vars
std::vector< std::string > _var_names
std::vector< unsigned int > _var_types
unsigned int _n_zones
std::vector< unsigned int > _zone_types
std::vector< std::string > _zone_names
std::vector< unsigned int > _zone_pack
std::vector< unsigned int > _imax
std::vector< unsigned int > _jmax
std::vector< unsigned int > _kmax
std::vector< std::vector
< std::vector< float > > > 
_data
std::vector< std::vector< int > > _conn
char buf [512]

Detailed Description

This class will read a binary .plt file. These types of files are for use with Amtec's Tecplot visualization package.

Author:
Benjamin S. Kirk, 2004.

Definition at line 41 of file plt_loader.h.


Member Enumeration Documentation

Enum defining the data type of each variable.

Enumerator:
FLOAT 
DOUBLE 
LONGINT 
SHORTINT 
BYTE 
BIT 

Definition at line 134 of file plt_loader.h.

Enum defining the finite element types

Enumerator:
TRI 
QUAD 
TET 
HEX 

Definition at line 144 of file plt_loader.h.

              { TRI=0,
                QUAD,
                TET,
                HEX };

Enum defining the zone type in the Tecplot binary file, for use with the new .plt format.

Enumerator:
ORDERED 
FELINESEG 
FETRIANGLE 
FEQUADRILATERAL 
FETETRAHEDRON 
FEBRICK 

Definition at line 124 of file plt_loader.h.

Writes a plot3d files. The grid will be in basename.g and the solution will be in basename.q. It is assumed that the first three variables from the .plt file are the (x,y,z) locations of the grid points. The optional parameter reverse specifies if the output file will have reversed byte ordering. Writes a Cart3D .tri component file. The number of components will be the number of zones in the .plt file. Enum defining the zone type in the Tecplot binary file, for use with the old .plt format.

Enumerator:
BLOCK 
POINT 
FEBLOCK 
FEPOINT 

Definition at line 115 of file plt_loader.h.


Constructor & Destructor Documentation

libMesh::PltLoader::PltLoader ( const bool  v = false) [inline]

Constructor. Initializes data.

Definition at line 447 of file plt_loader.h.

                                  :
  _verbose      (v),
  _is_foreign   (false),
  _n_vars       (0),
  _n_zones      (0)
{
}
libMesh::PltLoader::PltLoader ( const std::string &  name,
const bool  v = false 
) [inline]

Constructor. Reads the file specified by name.

Definition at line 458 of file plt_loader.h.

References read().

                                                         :
  _verbose      (v),
  _is_foreign   (false),
  _n_vars       (0),
  _n_zones      (0)
{
  this->read (name);
}

Destructor.

Definition at line 470 of file plt_loader.h.

{
}

Member Function Documentation

Clear all data and return to a pristine state.

Definition at line 34 of file plt_loader.C.

References _conn, _data, _imax, _is_foreign, _jmax, _kmax, _n_vars, _n_zones, _title, _var_names, _var_types, _version, _zone_names, _zone_pack, and _zone_types.

{
  // clear vectors & strings.  Using .erase() for strings instead of .clear()
  // since GCC 2.95.3 does not support .clear().
  _version.erase();
  _title.erase();

  _var_names.clear();
  _var_types.clear();
  _zone_types.clear();
  _zone_names.clear();
  _zone_pack.clear();
  _imax.clear();
  _jmax.clear();
  _kmax.clear();
  _data.clear();
  _conn.clear();

  // reinitialize
  _is_foreign = false;
  _n_vars     = 0;
  _n_zones    = 0;
}
PltLoader::FEType libMesh::PltLoader::elem_type ( const unsigned int  z) const [inline]
Returns:
the element type for the zth zone (for unstructured meshes).

Definition at line 689 of file plt_loader.h.

References kmax(), n_zones(), and zone_type().

{
  libmesh_assert_less (z, this->n_zones());

  // Only for unstructured zones!
  libmesh_assert_greater (this->zone_type(z), 1);

  return static_cast<FEType>(this->kmax(z));
}
const std::vector< std::vector< std::vector< float > > > & libMesh::PltLoader::get_data ( ) const [inline]
Returns:
a reference to the data read from the file

Definition at line 702 of file plt_loader.h.

References _data.

{
  return _data;
}
unsigned int libMesh::PltLoader::imax ( const unsigned int  z) const [inline]
Returns:
imax for zone z.

Definition at line 597 of file plt_loader.h.

References _imax, and n_zones().

Referenced by n_nodes(), read_block_data(), read_data(), read_feblock_data(), read_fepoint_data(), read_header(), read_point_data(), and write_dat().

{
  libmesh_assert_less (z, this->n_zones());
  libmesh_assert_equal_to (_imax.size(), this->n_zones());

  return _imax[z];
}
unsigned int & libMesh::PltLoader::imax ( const unsigned int  z) [inline, private]
Returns:
imax for zone z.

Definition at line 608 of file plt_loader.h.

References _imax, and n_zones().

{
  libmesh_assert_less (z, this->n_zones());
  libmesh_assert_equal_to (_imax.size(), this->n_zones());

  return _imax[z];
}
bool libMesh::PltLoader::is_foreign ( ) const [inline]
Returns:
true if the binary type of the file is different than the machine that is reading it. If this is the case we must perform an endian-swap on all input data.

Definition at line 168 of file plt_loader.h.

References _is_foreign.

Referenced by read_block_data(), read_data(), read_feblock_data(), read_fepoint_data(), read_header(), and read_point_data().

{ return _is_foreign; }
bool& libMesh::PltLoader::is_foreign ( ) [inline, private]
Returns:
true if the binary type of the file is different than the machine that is reading it. If this is the case we must perform an endian-swap on all input data.

Definition at line 300 of file plt_loader.h.

References _is_foreign.

{ return _is_foreign; }
unsigned int libMesh::PltLoader::jmax ( const unsigned int  z) const [inline]
Returns:
jmax for zone z.

Definition at line 619 of file plt_loader.h.

References _jmax, and n_zones().

Referenced by n_elem(), read_block_data(), read_data(), read_feblock_data(), read_fepoint_data(), read_header(), read_point_data(), and write_dat().

{
  libmesh_assert_less (z, this->n_zones());
  libmesh_assert_equal_to (_jmax.size(), this->n_zones());

  return _jmax[z];
}
unsigned int & libMesh::PltLoader::jmax ( const unsigned int  z) [inline, private]
Returns:
jmax for zone z.

Definition at line 630 of file plt_loader.h.

References _jmax, and n_zones().

{
  libmesh_assert_less (z, this->n_zones());
  libmesh_assert_equal_to (_jmax.size(), this->n_zones());

  return _jmax[z];
}
unsigned int libMesh::PltLoader::kmax ( const unsigned int  z) const [inline]
Returns:
kmax for zone z.

Definition at line 641 of file plt_loader.h.

References _kmax, and n_zones().

Referenced by elem_type(), read_block_data(), read_data(), read_feblock_data(), read_fepoint_data(), read_header(), read_point_data(), and write_dat().

{
  libmesh_assert_less (z, this->n_zones());
  libmesh_assert_equal_to (_kmax.size(), this->n_zones());

  return _kmax[z];
}
unsigned int & libMesh::PltLoader::kmax ( const unsigned int  z) [inline, private]
Returns:
kmax for zone z.

Definition at line 652 of file plt_loader.h.

References _kmax, and n_zones().

{
  libmesh_assert_less (z, this->n_zones());
  libmesh_assert_equal_to (_kmax.size(), this->n_zones());

  return _kmax[z];
}
unsigned int libMesh::PltLoader::n_elem ( const unsigned int  z) const [inline]
Returns:
the number of elements in the mesh (for unstructured meshes).

Definition at line 676 of file plt_loader.h.

References jmax(), n_zones(), and zone_type().

Referenced by read_header().

{
  libmesh_assert_less (z, this->n_zones());

  // Only for unstructured zones!
  libmesh_assert_greater (this->zone_type(z), 1);

  return this->jmax(z);
}
unsigned int libMesh::PltLoader::n_nodes ( const unsigned int  z) const [inline]
Returns:
the number of nodes in the mesh (for unstructured meshes).

Definition at line 663 of file plt_loader.h.

References imax(), n_zones(), and zone_type().

Referenced by read_header().

{
  libmesh_assert_less (z, this->n_zones());

  // Only for unstructured zones!
  libmesh_assert_greater (this->zone_type(z), 1);

  return this->imax(z);
}
unsigned int libMesh::PltLoader::n_vars ( ) const [inline]
Returns:
the number of variables in the data set.

Definition at line 178 of file plt_loader.h.

References _n_vars.

Referenced by read_block_data(), read_data(), read_feblock_data(), read_fepoint_data(), read_header(), read_point_data(), set_n_vars(), set_n_zones(), var_name(), var_type(), and write_dat().

{ return _n_vars; }
unsigned int libMesh::PltLoader::n_zones ( ) const [inline]
Returns:
the number of zones.

Definition at line 193 of file plt_loader.h.

References _n_zones.

Referenced by elem_type(), imax(), jmax(), kmax(), n_elem(), n_nodes(), read_data(), read_feblock_data(), read_header(), set_n_vars(), set_n_zones(), write_dat(), zone_name(), zone_pack(), and zone_type().

{ return _n_zones; }
void libMesh::PltLoader::read ( const std::string &  name)

Reads the .plt file specified by name.

Definition at line 34 of file plt_loader_read.C.

References libMesh::out, read_data(), read_header(), and verbose().

Referenced by PltLoader().

{
  std::ifstream in (name.c_str(), std::ios::in|std::ios::binary);

  if (!in.good())
    libmesh_error_msg("Error reading input file " << name);


  if (this->verbose())
    libMesh::out << std::endl
                 << "Reading input file " << name
                 << std::endl
                 << "-------------------------------------------------------------------------"
                 << std::endl;

  this->read_header (in);
  this->read_data   (in);

  if (this->verbose())
    libMesh::out << std::endl
                 << "-------------------------------------------------------------------------"
                 << std::endl;

}
void libMesh::PltLoader::read_block_data ( std::istream &  in,
const unsigned int  zn 
) [private]

Read data for the zth zone in BLOCK structured format.

Definition at line 833 of file plt_loader_read.C.

References _data, data, DOUBLE, FLOAT, imax(), is_foreign(), jmax(), kmax(), libMesh::libmesh_assert(), n_vars(), and var_type().

Referenced by read_data().

{
  libmesh_assert (in.good());


  // A byte-reverser in case the data is foreign
  Utility::ReverseBytes rb(this->is_foreign());


  for (unsigned int var=0; var<this->n_vars(); var++)
    {

      switch (this->var_type(var))
        {

          // Read a single-precision variable
        case FLOAT:
          {
            std::vector<float> & data = _data[zone][var];

            data.clear();
            data.resize (this->imax(zone)*
                         this->jmax(zone)*
                         this->kmax(zone));

            in.read ((char*) &data[0], LIBMESH_SIZEOF_FLOAT*data.size());

            for (unsigned int i=0; i<data.size(); i++)
              rb(data[i]);

            break;
          }

          // Read a double-precision variable
        case DOUBLE:
          {
            std::vector<double> ddata;
            std::vector<float> & data = _data[zone][var];

            data.clear();
            data.resize (this->imax(zone)*
                         this->jmax(zone)*
                         this->kmax(zone));

            ddata.resize (this->imax(zone)*
                          this->jmax(zone)*
                          this->kmax(zone));

            in.read ((char*) &ddata[0], LIBMESH_SIZEOF_DOUBLE*ddata.size());

            for (unsigned int i=0; i<data.size(); i++)
              data[i] = rb(ddata[i]);

            break;
          }

        default:
          libmesh_error_msg("ERROR: Unsupported data type: " << this->var_type(var));
        }
    }
}
void libMesh::PltLoader::read_data ( std::istream &  in) [private]

Read data from the binary file.

Definition at line 602 of file plt_loader_read.C.

References BLOCK, buf, FEBLOCK, FEPOINT, libMesh::BasicOStreamProxy< charT, traits >::flush(), imax(), is_foreign(), jmax(), kmax(), libMesh::libmesh_assert(), n_vars(), n_zones(), ORDERED, libMesh::out, POINT, read_block_data(), read_feblock_data(), read_fepoint_data(), read_point_data(), var_type(), verbose(), version(), zone_pack(), and zone_type().

Referenced by read().

{
  libmesh_assert (in.good());

  // A byte-reverser in case the data is foreign
  Utility::ReverseBytes rb(this->is_foreign());

  //----------------------------------------------------
  // Read the TECPLOT data for each zone
  if (this->verbose())
    {
      libMesh::out << "Reading Zones";
      libMesh::out.flush();
    }


  for (unsigned int zone=0; zone<this->n_zones(); zone++)
    {
      if (this->verbose())
        {
          libMesh::out << ".";
          libMesh::out.flush();
        }


      //----------------------------------------------------
      // Read plt files written by older versions of Tecplot
      if (this->version().rfind("V7") < this->version().size())
        {
          float f = 0.;

          // Find the next Zone marker.
          do
            {
              f = 0.;
              in.read (buf, LIBMESH_SIZEOF_FLOAT);
              std::memcpy  (&f, buf, LIBMESH_SIZEOF_FLOAT);
              rb(f);
            }
          while ((f != 299.) && in.good());

          // Did we overrun the file?
          if (!in.good())
            libmesh_error_msg("ERROR: Unexpected end-of-file!");

          // Get the number of repeated vars.
          unsigned int n_rep_vars=0;
          std::vector<int> rep_vars;

          {
            in.read (buf, LIBMESH_SIZEOF_INT);
            std::memcpy  (&n_rep_vars, buf, LIBMESH_SIZEOF_INT);
            rb(n_rep_vars);

            rep_vars.resize (n_rep_vars);

            // Get the repeated variables number.
            for (unsigned int v=0; v<n_rep_vars; v++)
              {
                libmesh_error_msg("ERROR:  I don't understand repeated variables yet!");

                in.read (buf, LIBMESH_SIZEOF_INT);
                std::memcpy  (&rep_vars[v], buf, LIBMESH_SIZEOF_INT);
                rb(rep_vars[v]);
              }
          }

          // Get the variable data type
          //libMesh::out << "var_types=";
          for (unsigned int v=0; v<this->n_vars(); v++)
            {
              in.read (buf, LIBMESH_SIZEOF_INT);
              std::memcpy  (&this->var_type(v), buf, LIBMESH_SIZEOF_INT);
              rb(this->var_type(v));

              //libMesh::out << this->var_type(v) << " ";
            }
          //libMesh::out << std::endl;



          // Read the data.
          switch (this->zone_type(zone) )
            {
              // Block-based data.  Structured meshes.
            case BLOCK:
              {
                this->read_block_data (in, zone);
                break;
              }

              // Point-based data.  Structured meshes.
            case POINT:
              {
                this->read_point_data (in, zone);
                break;
              }

              // FE block data.  Unstructured meshes.
            case FEBLOCK:
              {
                this->read_feblock_data (in, zone);

                if (this->verbose())

                  libMesh::out << "Zone " << zone << ":" << std::endl
                               << "  nnodes   =" << this->imax(zone) << std::endl
                               << "  nelem    =" << this->jmax(zone) << std::endl
                               << "  elem_type=" << this->kmax(zone) << std::endl
                               << std::endl;
                break;
              }

              // FE point data.  Unstructured meshes.
            case FEPOINT:
              {
                this->read_fepoint_data (in, zone);
                break;
              }

            default:
              libmesh_error_msg("ERROR: Unsupported Zone type: " << this->zone_type(zone));
            } // end switch on zone type
        }


      //----------------------------------------------------
      // Read plt files written by newer versions of Tecplot
      else if (this->version().rfind("V1") < this->version().size())
        {
          float f = 0.;

          // Find the next Zone marker.
          do
            {
              f = 0.;
              in.read (buf, LIBMESH_SIZEOF_FLOAT);
              std::memcpy  (&f, buf, LIBMESH_SIZEOF_FLOAT);
              rb(f);
            }
          while ((f != 299.) && in.good());

          // Did we overrun the file?
          if (!in.good())
            libmesh_error_msg("ERROR: Unexpected end-of-file!");

          // Get the variable data type
          for (unsigned int v=0; v<this->n_vars(); v++)
            {
              in.read (buf, LIBMESH_SIZEOF_INT);
              std::memcpy  (&this->var_type(v), buf, LIBMESH_SIZEOF_INT);
              rb(this->var_type(v));

              //libMesh::out << this->var_type(v) << " ";
            }

          // Get the variable sharing flag
          {
            int vs=0;
            int sv=0;

            in.read (buf, LIBMESH_SIZEOF_INT);
            std::memcpy  (&vs, buf, LIBMESH_SIZEOF_INT);
            rb(vs);

            if (vs)
              {
                for (unsigned int v=0; v<this->n_vars(); v++)
                  {
                    in.read (buf, LIBMESH_SIZEOF_INT);
                    std::memcpy  (&sv, buf, LIBMESH_SIZEOF_INT);
                    rb(sv);

                    if (sv != -1)
                      libmesh_error_msg("ERROR:  I don't understand variable sharing!");
                  }
              }
          }

          // Get zone to share connectivity with
          {
            int sc=0;
            in.read (buf, LIBMESH_SIZEOF_INT);
            std::memcpy  (&sc, buf, LIBMESH_SIZEOF_INT);
            rb(sc);

            libmesh_assert_equal_to (sc, -1);
          }


          // Read the data.
          if (this->zone_type(zone) == ORDERED)
            {
              // Block-based data.  Structured meshes.
              if (this->zone_pack(zone) == 0)
                this->read_block_data (in, zone);

              // Point-based data.  Structured meshes.
              else if (this->zone_pack(zone) == 1)
                this->read_point_data (in, zone);

              else
                libmesh_error_msg("Unrecognized zone_pack(zone) = " << this->zone_pack(zone));
            }
          else
            {
              // Block-based data.  Unstructured meshes.
              if (this->zone_pack(zone) == 0)
                this->read_feblock_data (in, zone);

              // Point-based data.  Unstructured meshes.
              else if (this->zone_pack(zone) == 1)
                this->read_fepoint_data (in, zone);

              else
                libmesh_error_msg("Unrecognized zone_pack(zone) = " << this->zone_pack(zone));
            }
        }



      //----------------------------------------------------
      // Unrecognized Tecplot Version!
      else
        libmesh_error_msg("ERROR:  This plot file was written by an unrecognized version of Tecplot!:\n" << this->version());

    } // end loop on zones
}
void libMesh::PltLoader::read_feblock_data ( std::istream &  in,
const unsigned int  zn 
) [private]

Read data for the zth zone in FEBLOCK unstructured format.

Definition at line 950 of file plt_loader_read.C.

References _conn, _data, data, DOUBLE, FLOAT, imax(), is_foreign(), jmax(), kmax(), libMesh::libmesh_assert(), n_vars(), n_zones(), NNodes, and var_type().

Referenced by read_data().

{
  libmesh_assert (in.good());

  // A byte-reverser in case the data is foreign
  Utility::ReverseBytes rb(this->is_foreign());

  // Read the variable values at each node.
  for (unsigned int var=0; var<this->n_vars(); var++)
    {
      switch (this->var_type(var))
        {

          // Read a single-precision variable
        case FLOAT:
          {
            std::vector<float> & data = _data[zone][var];

            data.clear();
            data.resize (this->imax(zone));

            in.read ((char*) &data[0], LIBMESH_SIZEOF_FLOAT*data.size());

            for (unsigned int i=0; i<data.size(); i++)
              rb(data[i]);

            break;
          }

          // Read a double-precision variable
        case DOUBLE:
          {
            std::vector<double> ddata;
            std::vector<float> & data = _data[zone][var];

            data.clear();
            data.resize (this->imax(zone));
            ddata.resize (this->imax(zone));

            in.read ((char*) &ddata[0], LIBMESH_SIZEOF_DOUBLE*ddata.size());

            for (unsigned int i=0; i<data.size(); i++)
              data[i] = rb(ddata[i]);

            break;
          }

        default:
          libmesh_error_msg("ERROR: Unsupported data type: " << this->var_type(var));
        }
    }

  // Read the connectivity
  {
    // Get the connectivity repetition flag
    int rep=0;
    in.read ((char*) &rep, LIBMESH_SIZEOF_INT);
    rb(rep);

    if (rep == 1 && this->n_zones() > 1)
      libmesh_error_msg("ERROR:  Repeated connectivity not supported!");

    // Read the connectivity
    else
      {
        libmesh_assert_less (zone, _conn.size());
        libmesh_assert_less (this->kmax(zone), 4);

        _conn[zone].resize (this->jmax(zone)*NNodes[this->kmax(zone)]);

        in.read ((char*) &_conn[zone][0], LIBMESH_SIZEOF_INT*_conn[zone].size());

        for (unsigned int i=0; i<_conn[zone].size(); i++)
          rb(_conn[zone][i]);
      }
  }
}
void libMesh::PltLoader::read_fepoint_data ( std::istream &  in,
const unsigned int  zn 
) [private]

Read data for the zth zone in FEPOINT unstructured format.

Definition at line 1030 of file plt_loader_read.C.

References _conn, _data, buf, data, DOUBLE, FLOAT, imax(), is_foreign(), jmax(), kmax(), libMesh::libmesh_assert(), n_vars(), NNodes, and var_type().

Referenced by read_data().

{
  libmesh_assert (in.good());

  // A byte-reverser in case the data is foreign
  Utility::ReverseBytes rb(this->is_foreign());

  // First allocate space
  for (unsigned int var=0; var<this->n_vars(); var++)
    {
      std::vector<float> & data = _data[zone][var];

      data.clear();
      data.reserve (this->imax(zone));
    }


  for (unsigned int i=0; i<this->imax(zone); i++)
    for (unsigned int var=0; var<this->n_vars(); var++)
      if (this->var_type(var) == FLOAT)
        {
          float f = 0.;

          libmesh_assert (in.good());

          in.read (buf, LIBMESH_SIZEOF_FLOAT);
          std::memcpy  (&f, buf, LIBMESH_SIZEOF_FLOAT);
          rb(f);

          _data[zone][var].push_back(f);
        }
      else if (this->var_type(var) == DOUBLE)
        {
          double d = 0.;

          libmesh_assert (in.good());

          in.read (buf, LIBMESH_SIZEOF_DOUBLE);
          std::memcpy  (&d, buf, LIBMESH_SIZEOF_DOUBLE);
          rb(d);

          _data[zone][var].push_back(d);
        }
      else
        libmesh_error_msg("ERROR: unsupported data type: " << this->var_type(var));

  // Read the connectivity
  {
    // Get the connectivity repetition flag
    int rep=0;

    in.read ((char*) &rep, LIBMESH_SIZEOF_INT);
    rb(rep);

    if (rep == 1)
      libmesh_error_msg("ERROR:  Repeated connectivity not supported!");

    // Read the connectivity
    else
      {
        libmesh_assert_less (zone, _conn.size());
        libmesh_assert_less (this->kmax(zone), 4);

        _conn[zone].resize (this->jmax(zone)*NNodes[this->kmax(zone)]);

        in.read ((char*) &_conn[zone][0], LIBMESH_SIZEOF_INT*_conn[zone].size());

        for (unsigned int i=0; i<_conn[zone].size(); i++)
          rb(_conn[zone][i]);
      }
  }
}
void libMesh::PltLoader::read_header ( std::istream &  in) [private]

Read the header of the binary file.

Definition at line 61 of file plt_loader_read.C.

References buf, libMesh::err, imax(), is_foreign(), jmax(), kmax(), libMesh::libmesh_assert(), n_elem(), n_nodes(), n_vars(), n_zones(), libMesh::Quality::name(), ORDERED, libMesh::out, set_n_vars(), set_n_zones(), title(), var_name(), var_type(), verbose(), version(), zone_name(), zone_pack(), and zone_type().

Referenced by read().

{
  libmesh_assert (in.good());

  //----------------------------------------------------
  // Read the TECPLOT header

  // Read the version number
  {
    in.read (buf, 8);

    // Using erase for GCC 2.95.3
    this->version().erase();

    for (unsigned int i=0; i<8; i++)
      this->version() += buf[i];

    if (this->verbose())
      libMesh::out << "Tecplot Version: "
                   << this->version()
                   << std::endl;
  }


  //----------------------------------------------------
  // Read plt files written by older versions of Tecplot
  if (this->version().rfind("V7") < this->version().size())
    {
      if (this->verbose())
        libMesh::out << "Reading legacy .plt format (<= v9) ..."
                     << std::endl;

      // Read the value of 1 to determine byte ordering
      {
        int one = 0;
        in.read (buf, LIBMESH_SIZEOF_INT);
        std::memcpy  (&one, buf, LIBMESH_SIZEOF_INT);

        if (one != 1)
          {
            if (this->verbose())
              libMesh::out << "Tecplot data is Foreign!"
                           << std::endl;
            this->is_foreign() = true;

            // Make sure one reversed is one
            Utility::ReverseBytes rb(this->is_foreign());
            libmesh_assert_equal_to (rb(one), 1);
          }
      }

      // A byte-reverser in case the data is foreign
      Utility::ReverseBytes rb(this->is_foreign());

      // Read the title
      {
        int i=0;

        // Using erase for GCC 2.95.3
        this->title().erase();

        do
          {
            in.read (buf, LIBMESH_SIZEOF_INT);
            std::memcpy  (&i, buf, LIBMESH_SIZEOF_INT);
            rb(i);

            // Don't add trailing \0
            if (i)
              this->title() += static_cast<char>(i);
          }
        while (i);
      }

      // Read the number of variables in the data set
      {
        int nv;
        in.read (buf, LIBMESH_SIZEOF_INT);
        std::memcpy  (&nv, buf, LIBMESH_SIZEOF_INT);
        rb(nv);

        this->set_n_vars (nv);
      }

      // Read the variable names
      for (unsigned int v=0; v<this->n_vars(); v++)
        {
          int i=0;

          // Using erase for GCC 2.95.3
          this->var_name(v).erase();

          do
            {
              in.read (buf, LIBMESH_SIZEOF_INT);
              std::memcpy  (&i, buf, LIBMESH_SIZEOF_INT);
              rb(i);

              // Don't add trailing \0
              if (i)
                this->var_name(v) += static_cast<char>(i);
            }
          while (i);
        }



      // Read zones from the header.
      // Continue reading until the end-of-header
      // marker (357.) is found.
      int nz=0;
      std::vector<std::string> zname;
      std::vector<int>         ztype, zimax, zjmax, zkmax;

      {
        float f=0.;

        do
          {
            // find the next Zone marker
            do
              {
                f = 0.;
                in.read (buf, LIBMESH_SIZEOF_FLOAT);
                std::memcpy  (&f, buf, LIBMESH_SIZEOF_FLOAT);
                rb(f);
              }
            while ((f != 299.) &&
                   (f != 357.) &&
                   in.good());


            // Did we overrun the file?
            if (!in.good())
              libmesh_error_msg("ERROR: Unexpected end-of-file!");

            // Found a Zone marker
            else if (f == 299.)
              {
                // Incriment the Zone counter
                nz++;

                // Read the zone name
                {
                  int i=0;
                  std::string name;

                  do
                    {
                      in.read (buf, LIBMESH_SIZEOF_INT);
                      std::memcpy  (&i, buf, LIBMESH_SIZEOF_INT);
                      rb(i);

                      // Don't add trailing \0
                      if (i)
                        name += static_cast<char>(i);
                    }
                  while (i);

                  zname.push_back(name);
                }

                // Read the zone format
                {
                  int zt;
                  in.read (buf, LIBMESH_SIZEOF_INT);
                  std::memcpy  (&zt, buf, LIBMESH_SIZEOF_INT);
                  rb(zt);

                  ztype.push_back(zt);
                  //libMesh::out << "zone type=" << ztype.back() << std::endl;
                }

                // Read the zone color
                {
                  int zc=0;

                  in.read (buf, LIBMESH_SIZEOF_INT);
                  std::memcpy  (&zc, buf, LIBMESH_SIZEOF_INT);
                  rb(zc);

                  //libMesh::out << "zone color=" << zc << std::endl;
                }

                // Read in the block dimensions
                {
                  int
                    i_max=0,
                    j_max=0,
                    k_max=0;

                  in.read (buf, LIBMESH_SIZEOF_INT);
                  std::memcpy  (&i_max, buf, LIBMESH_SIZEOF_INT);
                  rb(i_max);

                  in.read (buf, LIBMESH_SIZEOF_INT);
                  std::memcpy  (&j_max, buf, LIBMESH_SIZEOF_INT);
                  rb(j_max);

                  in.read (buf, LIBMESH_SIZEOF_INT);
                  std::memcpy  (&k_max, buf, LIBMESH_SIZEOF_INT);
                  rb(k_max);

                  zimax.push_back (i_max);
                  zjmax.push_back (j_max);
                  zkmax.push_back (k_max);
                }
              } // else if (f == 299.)
          }
        while ((f != 357.) && in.good());
      }

      // Set the header data
      this->set_n_zones (nz);

      for (unsigned int z=0; z<this->n_zones(); z++)
        {
          this->zone_type(z) = ztype[z];
          this->zone_name(z) = zname[z];
          this->imax(z)      = zimax[z];
          this->jmax(z)      = zjmax[z];
          this->kmax(z)      = zkmax[z];
        }
    }


  //----------------------------------------------------
  // Read plt files written by newer versions of Tecplot
  else if (this->version().rfind("V1") < this->version().size())
    {
      if (this->verbose())
        libMesh::out << "Reading new .plt format (>= v10)..."
                     << std::endl;

      // Read the value of 1 to determine byte ordering
      {
        int one = 0;

        in.read (buf, LIBMESH_SIZEOF_INT);
        std::memcpy  (&one, buf, LIBMESH_SIZEOF_INT);

        if (one != 1)
          {
            if (this->verbose())
              libMesh::err << "Tecplot data is Foreign!"
                           << std::endl;
            this->is_foreign() = true;

            // Make sure one reversed is one
            Utility::ReverseBytes rb(this->is_foreign());
            libmesh_assert_equal_to (rb(one), 1);
          }
      }

      // A byte-reverser in case the data is foreign
      Utility::ReverseBytes rb(this->is_foreign());

      // Read the title
      {
        int i=0;

        // Using erase() for GCC 2.95.3
        this->title().erase();
        do
          {
            in.read (buf, LIBMESH_SIZEOF_INT);
            std::memcpy  (&i, buf, LIBMESH_SIZEOF_INT);
            rb(i);

            // Don't add trailing \0
            if (i)
              this->title() += static_cast<char>(i);
          }
        while (i);
      }

      // Read the number of variables in the data set
      {
        int nv;
        in.read (buf, LIBMESH_SIZEOF_INT);
        std::memcpy  (&nv, buf, LIBMESH_SIZEOF_INT);
        rb(nv);

        this->set_n_vars (nv);
      }

      // Read the variable names
      for (unsigned int v=0; v<this->n_vars(); v++)
        {
          int i=0;

          // Using erase() for GCC 2.95.3
          this->var_name(v).erase();

          do
            {
              in.read (buf, LIBMESH_SIZEOF_INT);
              std::memcpy  (&i, buf, LIBMESH_SIZEOF_INT);
              rb(i);

              // Don't add trailing \0
              if (i)
                this->var_name(v) += static_cast<char>(i);
            }
          while (i);
        }



      // Read zones from the header.
      // Continue reading until the end-of-header
      // marker (357.) is found.
      int nz=0;
      std::vector<std::string> zname;
      std::vector<int>         zpack, ztype, zimax, zjmax, zkmax;

      {
        float f=0.;

        do
          {
            // find the next Zone marker
            do
              {
                f = 0.;
                in.read (buf, LIBMESH_SIZEOF_FLOAT);
                std::memcpy  (&f, buf, LIBMESH_SIZEOF_FLOAT);
                rb(f);
              }
            while ((f != 299.) &&
                   (f != 357.) &&
                   in.good());


            // Did we overrun the file?
            if (!in.good())
              libmesh_error_msg("ERROR: Unexpected end-of-file!");

            // Found a Zone marker
            else if (f == 299.)
              {
                // Incriment the Zone counter
                nz++;

                // Read the zone name
                {
                  int i=0;
                  std::string name;

                  do
                    {
                      in.read (buf, LIBMESH_SIZEOF_INT);
                      std::memcpy  (&i, buf, LIBMESH_SIZEOF_INT);
                      rb(i);

                      // Don't add trailing \0
                      if (i)
                        name += static_cast<char>(i);
                    }
                  while (i);

                  zname.push_back(name);
                }

                // Read the zone color
                {
                  int zc=0;
                  in.read (buf, LIBMESH_SIZEOF_INT);
                  std::memcpy  (&zc, buf, LIBMESH_SIZEOF_INT);
                  rb(zc);
                }

                // Read the zone format
                {
                  int zt;
                  in.read (buf, LIBMESH_SIZEOF_INT);
                  std::memcpy  (&zt, buf, LIBMESH_SIZEOF_INT);
                  rb(zt);

                  ztype.push_back(zt);
                }

                // Read the data packing flag
                {
                  int dp=0;
                  in.read (buf, LIBMESH_SIZEOF_INT);
                  std::memcpy (&dp, buf, LIBMESH_SIZEOF_INT);
                  rb(dp);

                  zpack.push_back (dp);
                }

                // Will we specify the variable location?
                {
                  int svl=0;
                  int  vl=0;
                  in.read (buf, LIBMESH_SIZEOF_INT);
                  std::memcpy  (&svl, buf, LIBMESH_SIZEOF_INT);
                  rb(svl);

                  if (svl)
                    for (unsigned int v=0; v<this->n_vars(); v++)
                      {
                        in.read (buf, LIBMESH_SIZEOF_INT);
                        std::memcpy  (&vl, buf, LIBMESH_SIZEOF_INT);
                        rb(vl);
                        libmesh_assert_equal_to (vl, 0); // Only know about node-based data
                        // right now
                      }

                }

                // Get the number of user-defined face-neighbors
                {
                  int fn=0;
                  in.read (buf, LIBMESH_SIZEOF_INT);
                  std::memcpy  (&fn, buf, LIBMESH_SIZEOF_INT);
                  rb(fn);
                }

                // Read in the block dimensions
                {
                  if (ztype.back() != ORDERED)
                    {
                      int np=0, ne=0;

                      in.read (buf, LIBMESH_SIZEOF_INT);
                      std::memcpy  (&np, buf, LIBMESH_SIZEOF_INT);
                      rb(np);

                      in.read (buf, LIBMESH_SIZEOF_INT);
                      std::memcpy  (&ne, buf, LIBMESH_SIZEOF_INT);
                      rb(ne);

                      zimax.push_back (np);
                      zjmax.push_back (ne);
                      zjmax.push_back (0);
                    }

                  int
                    i_max=0,
                    j_max=0,
                    k_max=0;

                  in.read (buf, LIBMESH_SIZEOF_INT);
                  std::memcpy  (&i_max, buf, LIBMESH_SIZEOF_INT);
                  rb(i_max);

                  in.read (buf, LIBMESH_SIZEOF_INT);
                  std::memcpy  (&j_max, buf, LIBMESH_SIZEOF_INT);
                  rb(j_max);

                  in.read (buf, LIBMESH_SIZEOF_INT);
                  std::memcpy  (&k_max, buf, LIBMESH_SIZEOF_INT);
                  rb(k_max);

                  // These are only useful for orderd data.  Otherwise
                  // we grabbed the relevant values above.
                  if (ztype.back() != ORDERED)
                    {
                      zimax.push_back (i_max);
                      zjmax.push_back (j_max);
                      zkmax.push_back (k_max);
                    }
                }
              } // else if (f == 299.)
          }
        while ((f != 357.) && in.good());
      }

      // Set the header data
      this->set_n_zones (nz);

      for (unsigned int z=0; z<this->n_zones(); z++)
        {
          this->zone_type(z) = ztype[z];
          this->zone_name(z) = zname[z];
          this->zone_pack(z) = zpack[z];
          this->imax(z)      = zimax[z];
          this->jmax(z)      = zjmax[z];
          this->kmax(z)      = zkmax[z];
        }
    }



  //----------------------------------------------------
  // Unrecognized Tecplot Version!
  else
    libmesh_error_msg("ERROR:  This plot file was written by an unrecognized version of Tecplot!:\n" << this->version());








  // Print the data to the screen.
  if (this->verbose())
    {
      libMesh::out << "Tecplot Header: "
                   << this->title() << std::endl;

      libMesh::out << "Variables: ";
      for (unsigned int v=0; v<this->n_vars(); v++)
        libMesh::out << "\"" << this->var_name (v) << "\"" << " ";
      libMesh::out << std::endl;

      libMesh::out << "Variable Types: ";
      for (unsigned int v=0; v<this->n_vars(); v++)
        libMesh::out << this->var_type (v) << " ";
      libMesh::out << std::endl;

      libMesh::out << "Zone Names: ";
      for (unsigned int z=0; z<this->n_zones(); z++)
        libMesh::out << "\"" << this->zone_name (z) << "\"" << " ";
      libMesh::out << std::endl;

      libMesh::out << "Zone Types: ";
      for (unsigned int z=0; z<this->n_zones(); z++)
        {
          libMesh::out << this->zone_type (z) << " ";

          if (this->zone_type (z) != ORDERED)
            libMesh::out << "(" << this->n_nodes(z) << "," << this->n_elem(z) << ") ";
        }
      libMesh::out << std::endl;

      libMesh::out << "Zone Dimensions: " << std::endl;
      for (unsigned int z=0; z<this->n_zones(); z++)
        libMesh::out << "  ("
                     << this->imax(z) << ","
                     << this->jmax(z) << ","
                     << this->kmax(z) << ")"
                     << std::endl;
    }
}
void libMesh::PltLoader::read_point_data ( std::istream &  in,
const unsigned int  zn 
) [private]

Read data for the zth zone in POINT structured format.

Definition at line 897 of file plt_loader_read.C.

References _data, buf, data, DOUBLE, FLOAT, imax(), is_foreign(), jmax(), kmax(), libMesh::libmesh_assert(), n_vars(), and var_type().

Referenced by read_data().

{
  libmesh_assert (in.good());

  // A byte-reverser in case the data is foreign
  Utility::ReverseBytes rb(this->is_foreign());

  // First allocate space
  for (unsigned int var=0; var<this->n_vars(); var++)
    {
      std::vector<float> & data = _data[zone][var];

      data.clear();
      data.reserve (this->imax(zone)*
                    this->jmax(zone)*
                    this->kmax(zone));
    }


  for (unsigned int k=0; k<this->kmax(zone); k++)
    for (unsigned int j=0; j<this->jmax(zone); j++)
      for (unsigned int i=0; i<this->imax(zone); i++)
        for (unsigned int var=0; var<this->n_vars(); var++)
          if (this->var_type(var) == FLOAT)
            {
              float f = 0.;

              libmesh_assert (in.good());

              in.read (buf, LIBMESH_SIZEOF_FLOAT);
              std::memcpy  (&f, buf, LIBMESH_SIZEOF_FLOAT);
              rb(f);

              _data[zone][var].push_back(f);
            }
          else if (this->var_type(var) == DOUBLE)
            {
              double d = 0.;

              libmesh_assert (in.good());

              in.read (buf, LIBMESH_SIZEOF_DOUBLE);
              std::memcpy  (&d, buf, LIBMESH_SIZEOF_DOUBLE);
              rb(d);

              _data[zone][var].push_back(d);
            }
          else
            libmesh_error_msg("ERROR: unsupported data type: " << this->var_type(var));
}
void libMesh::PltLoader::set_n_vars ( const unsigned int  nv) [private]
Returns:
the number of variables in the data set.

Definition at line 60 of file plt_loader.C.

References _data, _n_vars, _var_names, _var_types, n_vars(), and n_zones().

Referenced by read_header().

{
  _n_vars = nv;

  _var_types.resize (this->n_vars());
  _var_names.resize (this->n_vars());

  // Default to float data
  std::fill (_var_types.begin(), _var_types.end(), 1);

  // If the number of zones is set, resize the data.
  if (this->n_zones())
    {
      _data.resize  (this->n_zones());

      for (unsigned int z=0; z<this->n_zones(); z++)
        _data[z].resize  (this->n_vars());
    }
}
void libMesh::PltLoader::set_n_zones ( const unsigned int  nz) [private]
Returns:
the number of zones.

Definition at line 82 of file plt_loader.C.

References _conn, _data, _imax, _jmax, _kmax, _n_zones, _zone_names, _zone_pack, _zone_types, n_vars(), and n_zones().

Referenced by read_header().

{
  _n_zones = nz;

  _zone_types.resize (this->n_zones());
  _zone_names.resize (this->n_zones());
  _zone_pack.resize  (this->n_zones());

  _imax.resize (this->n_zones());
  _jmax.resize (this->n_zones());
  _kmax.resize (this->n_zones());

  _data.resize (this->n_zones());
  _conn.resize        (this->n_zones());

  // If the number of variables are set, resize the data.
  if (this->n_vars())
    for (unsigned int z=0; z<this->n_zones(); z++)
      _data[z].resize (this->n_vars());
}
const std::string& libMesh::PltLoader::title ( ) const [inline]
Returns:
the data set title

Definition at line 173 of file plt_loader.h.

References _title.

Referenced by read_header(), and write_dat().

{ return _title; }
std::string& libMesh::PltLoader::title ( ) [inline, private]
Returns:
the data set title

Definition at line 305 of file plt_loader.h.

References _title.

{ return _title; }
const std::string & libMesh::PltLoader::var_name ( const unsigned int  v) const [inline]
Returns:
the name of variable v.

Definition at line 477 of file plt_loader.h.

References _var_names, and n_vars().

Referenced by read_header(), and write_dat().

{
  libmesh_assert_less (v, this->n_vars());
  libmesh_assert_less (v, _var_names.size());
  libmesh_assert_equal_to (this->n_vars(), _var_names.size());

  return _var_names[v];
}
std::string & libMesh::PltLoader::var_name ( const unsigned int  v) [inline, private]
Returns:
the name of variable v.

Definition at line 489 of file plt_loader.h.

References _var_names, and n_vars().

{
  libmesh_assert_less (v, this->n_vars());
  libmesh_assert_less (v, _var_names.size());
  libmesh_assert_equal_to (this->n_vars(), _var_names.size());

  return _var_names[v];
}
unsigned int libMesh::PltLoader::var_type ( const unsigned int  v) const [inline]
Returns:
the type of variable v

Definition at line 501 of file plt_loader.h.

References _var_types, and n_vars().

Referenced by read_block_data(), read_data(), read_feblock_data(), read_fepoint_data(), read_header(), and read_point_data().

{
  libmesh_assert_less (v, this->n_vars());
  libmesh_assert_less (v, _var_types.size());
  libmesh_assert_equal_to (this->n_vars(), _var_types.size());

  return _var_types[v];
}
unsigned int & libMesh::PltLoader::var_type ( const unsigned int  v) [inline, private]
Returns:
the type of variable v

Definition at line 513 of file plt_loader.h.

References _var_types, and n_vars().

{
  libmesh_assert_less (v, this->n_vars());
  libmesh_assert_less (v, _var_types.size());
  libmesh_assert_equal_to (this->n_vars(), _var_types.size());

  return _var_types[v];
}
bool libMesh::PltLoader::verbose ( ) const [inline]

Returns the verbosity.

Definition at line 68 of file plt_loader.h.

References _verbose.

Referenced by read(), read_data(), and read_header().

{ return _verbose; }
const std::string& libMesh::PltLoader::version ( ) const [inline]
Returns:
the Tecplot version number string. This identifies the version of Tecplot (or preplot) that wrote the binary file. Currently, PltLoader understands versions "#!TDV7X " and "#!TDV1XX"

Definition at line 161 of file plt_loader.h.

References _version.

Referenced by read_data(), and read_header().

{ return _version; }
std::string& libMesh::PltLoader::version ( ) [inline, private]
Returns:
the Tecplot version number string.

Definition at line 293 of file plt_loader.h.

References _version.

{ return _version; }
void libMesh::PltLoader::write_dat ( const std::string &  name,
const unsigned int  version = 10 
) const

Writes an ASCII Tecplot file. The optional parameter version specifies the version format to write.

Definition at line 450 of file plt_loader_write.C.

References _data, BLOCK, imax(), jmax(), kmax(), n_vars(), n_zones(), POINT, title(), var_name(), zone_name(), and zone_type().

{
  std::ofstream out_stream (name.c_str());

  out_stream << "TITLE=\""
             << this->title()
             << "\""
             << '\n';

  out_stream << "VARIABLES = ";

  for (unsigned int v=0; v<this->n_vars(); v++)
    out_stream << "\"" << this->var_name(v) << "\"\n";

  for (unsigned int z=0; z<this->n_zones(); z++)
    {
      out_stream << "ZONE T=\"" << this->zone_name(z) << "\"\n";
      out_stream << " I="  << this->imax(z)
                 << ", J=" << this->jmax(z)
                 << ", K=" << this->kmax(z);

      // Write BLOCK data for this zone
      if (this->zone_type(z) == BLOCK)
        {
          if (version_in < 10)
            {
              out_stream << ", F=BLOCK\n";
            }
          else
            {
              out_stream << ", ZONETYPE=Ordered\n"
                         << "DATAPACKING=BLOCK\n";
            }

          out_stream << "DT=(";
          for (unsigned int v=0; v<this->n_vars(); v++)
            out_stream << "SINGLE ";
          out_stream << ")\n";

          out_stream.precision(9);

          for (unsigned int v=0; v<this->n_vars(); v++)
            {
              unsigned int l=0;

              for (unsigned int k=0; k<this->kmax(z); k++)
                for (unsigned int j=0; j<this->jmax(z); j++)
                  for (unsigned int i=0; i<this->imax(z); i++)
                    {
                      // GCC 2.95.3 has scientific in the ios class instead
                      // of in namespace std::
#ifndef LIBMESH_BROKEN_IOSTREAM
                      out_stream << std::scientific
                                 << _data[z][v][l++] << " ";
#else
                      out_stream << std::ios::scientific
                                 << _data[z][v][l++] << " ";
#endif
                      // Throw in a newline every 5 entries to
                      // avoid really long lines.
                      if (l%5 == 0)
                        out_stream << '\n';
                    }

              if (l%5 != 0)
                out_stream << '\n';
            }
        } // end if (this->zone_type(z) == BLOCK)

      // Write POINT data for this zone
      else if (this->zone_type(z) == POINT)
        {
          if (version_in < 10)
            {
              out_stream << ", F=POINT\n";
            }
          else
            {
              out_stream << ", ZONETYPE=Ordered\n"
                         << "DATAPACKING=POINT\n";
            }

          out_stream << "DT=(";
          for (unsigned int v=0; v<this->n_vars(); v++)
            out_stream << "SINGLE ";
          out_stream << ")\n";

          out_stream.precision(9);

          {
            unsigned int l=0;

            for (unsigned int k=0; k<this->kmax(z); k++)
              for (unsigned int j=0; j<this->jmax(z); j++)
                for (unsigned int i=0; i<this->imax(z); i++)
                  {
                    for (unsigned int v=0; v<this->n_vars(); v++)

                      // GCC 2.95.3 has scientific in the ios class instead
                      // of in namespace std::
#ifndef LIBMESH_BROKEN_IOSTREAM
                      out_stream << std::scientific
                                 << _data[z][v][l] << " ";
#else
                    out_stream << std::ios::scientific
                               << _data[z][v][l] << " ";
#endif
                    out_stream << '\n';

                    l++;
                  }
          }
        } // end else if (this->zone_type(z) == POINT)

      // Otherwise, unrecognized zone type
      else
        libmesh_error_msg("Unrecognized zone type: this->zone_type(z)==" << this->zone_type(z));
    }
}
const std::string & libMesh::PltLoader::zone_name ( const unsigned int  z) const [inline]
Returns:
the name of zone z.

Definition at line 549 of file plt_loader.h.

References _zone_names, and n_zones().

Referenced by read_header(), and write_dat().

{
  libmesh_assert_less (z, this->n_zones());
  libmesh_assert_less (z, _zone_names.size());
  libmesh_assert_equal_to (this->n_zones(), _zone_names.size());

  return _zone_names[z];
}
std::string & libMesh::PltLoader::zone_name ( const unsigned int  z) [inline, private]
Returns:
the name of zone z.

Definition at line 561 of file plt_loader.h.

References _zone_names, and n_zones().

{
  libmesh_assert_less (z, this->n_zones());
  libmesh_assert_less (z, _zone_names.size());
  libmesh_assert_equal_to (this->n_zones(), _zone_names.size());

  return _zone_names[z];
}
unsigned int libMesh::PltLoader::zone_pack ( const unsigned int  z) const [inline]
Returns:
the data packing flag for zone z.

Definition at line 573 of file plt_loader.h.

References _zone_pack, and n_zones().

Referenced by read_data(), and read_header().

{
  libmesh_assert_less (z, this->n_zones());
  libmesh_assert_less (z, _zone_pack.size());
  libmesh_assert_equal_to (this->n_zones(), _zone_pack.size());

  return _zone_pack[z];
}
unsigned int & libMesh::PltLoader::zone_pack ( const unsigned int  z) [inline, private]
Returns:
the data pack flag for zone z.

Definition at line 585 of file plt_loader.h.

References _zone_pack, and n_zones().

{
  libmesh_assert_less (z, this->n_zones());
  libmesh_assert_less (z, _zone_pack.size());
  libmesh_assert_equal_to (this->n_zones(), _zone_pack.size());

  return _zone_pack[z];
}
unsigned int libMesh::PltLoader::zone_type ( const unsigned int  z) const [inline]
Returns:
the type of zone z

Definition at line 525 of file plt_loader.h.

References _zone_types, and n_zones().

Referenced by elem_type(), n_elem(), n_nodes(), read_data(), read_header(), and write_dat().

{
  libmesh_assert_less (z, this->n_zones());
  libmesh_assert_less (z, _zone_types.size());
  libmesh_assert_equal_to (this->n_zones(), _zone_types.size());

  return _zone_types[z];
}
unsigned int & libMesh::PltLoader::zone_type ( const unsigned int  z) [inline, private]
Returns:
the type of zone z

Definition at line 537 of file plt_loader.h.

References _zone_types, and n_zones().

{
  libmesh_assert_less (z, this->n_zones());
  libmesh_assert_less (z, _zone_types.size());
  libmesh_assert_equal_to (this->n_zones(), _zone_types.size());

  return _zone_types[z];
}

Member Data Documentation

std::vector<std::vector<int> > libMesh::PltLoader::_conn [private]

Vectors to hold the connectivity for each zone (only for unstructured files).

Definition at line 434 of file plt_loader.h.

Referenced by clear(), read_feblock_data(), read_fepoint_data(), and set_n_zones().

std::vector<std::vector<std::vector<float> > > libMesh::PltLoader::_data [private]
std::vector<unsigned int> libMesh::PltLoader::_imax [private]

The (imax,jmax,kmax) value for each zone.

Definition at line 421 of file plt_loader.h.

Referenced by clear(), imax(), and set_n_zones().

Is the data foreign?

Definition at line 375 of file plt_loader.h.

Referenced by clear(), and is_foreign().

std::vector<unsigned int> libMesh::PltLoader::_jmax [private]

Definition at line 422 of file plt_loader.h.

Referenced by clear(), jmax(), and set_n_zones().

std::vector<unsigned int> libMesh::PltLoader::_kmax [private]

Definition at line 423 of file plt_loader.h.

Referenced by clear(), kmax(), and set_n_zones().

unsigned int libMesh::PltLoader::_n_vars [private]

The number of variables in the data set.

Definition at line 385 of file plt_loader.h.

Referenced by clear(), n_vars(), and set_n_vars().

unsigned int libMesh::PltLoader::_n_zones [private]

The number of zones.

Definition at line 401 of file plt_loader.h.

Referenced by clear(), n_zones(), and set_n_zones().

std::string libMesh::PltLoader::_title [private]

The Tecplot data set title.

Definition at line 380 of file plt_loader.h.

Referenced by clear(), and title().

std::vector<std::string> libMesh::PltLoader::_var_names [private]

The name for each variable.

Definition at line 390 of file plt_loader.h.

Referenced by clear(), set_n_vars(), and var_name().

std::vector<unsigned int> libMesh::PltLoader::_var_types [private]

The type of each variable. Must be one of the enumerated DataType types.

Definition at line 396 of file plt_loader.h.

Referenced by clear(), set_n_vars(), and var_type().

const bool libMesh::PltLoader::_verbose [private]

Verbosity

Definition at line 365 of file plt_loader.h.

Referenced by verbose().

std::string libMesh::PltLoader::_version [private]

The Tecplot Version number string.

Definition at line 370 of file plt_loader.h.

Referenced by clear(), and version().

std::vector<std::string> libMesh::PltLoader::_zone_names [private]

The name of each zone.

Definition at line 411 of file plt_loader.h.

Referenced by clear(), set_n_zones(), and zone_name().

std::vector<unsigned int> libMesh::PltLoader::_zone_pack [private]

The data packing for each zone (new version only)

Definition at line 416 of file plt_loader.h.

Referenced by clear(), set_n_zones(), and zone_pack().

std::vector<unsigned int> libMesh::PltLoader::_zone_types [private]

The type of each zone.

Definition at line 406 of file plt_loader.h.

Referenced by clear(), set_n_zones(), and zone_type().

char libMesh::PltLoader::buf[512] [mutable, private]

Scratch data & relevant sizes.

Definition at line 439 of file plt_loader.h.

Referenced by read_data(), read_fepoint_data(), read_header(), and read_point_data().

const unsigned int libMesh::PltLoader::NNodes = {3, 4, 4, 8} [static]

Enum defining the number of nodes for each element type.

Definition at line 248 of file plt_loader.h.

Referenced by read_feblock_data(), and read_fepoint_data().


The documentation for this class was generated from the following files: