$extrastylesheet
00001 // Copyright (C) 2002-2007 Benjamin S. Kirk 00002 00003 // This library is free software; you can redistribute it and/or 00004 // modify it under the terms of the GNU Lesser General Public 00005 // License as published by the Free Software Foundation; either 00006 // version 2.1 of the License, or (at your option) any later version. 00007 00008 // This library is distributed in the hope that it will be useful, 00009 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00010 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00011 // Lesser General Public License for more details. 00012 00013 // You should have received a copy of the GNU Lesser General Public 00014 // License along with this library; if not, write to the Free Software 00015 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00016 00017 00018 00019 #include "libmesh/plt_loader.h" 00020 00021 namespace libMesh 00022 { 00023 00024 00025 00026 //--------------------------------------------------------- 00027 // PltLoader static data 00028 const unsigned int PltLoader::NNodes[4] = {3, 4, 4, 8}; 00029 00030 00031 00032 //----------------------------------------------------------------------------- 00033 // PltLoader members 00034 void PltLoader::clear () 00035 { 00036 // clear vectors & strings. Using .erase() for strings instead of .clear() 00037 // since GCC 2.95.3 does not support .clear(). 00038 _version.erase(); 00039 _title.erase(); 00040 00041 _var_names.clear(); 00042 _var_types.clear(); 00043 _zone_types.clear(); 00044 _zone_names.clear(); 00045 _zone_pack.clear(); 00046 _imax.clear(); 00047 _jmax.clear(); 00048 _kmax.clear(); 00049 _data.clear(); 00050 _conn.clear(); 00051 00052 // reinitialize 00053 _is_foreign = false; 00054 _n_vars = 0; 00055 _n_zones = 0; 00056 } 00057 00058 00059 00060 void PltLoader::set_n_vars (const unsigned int nv) 00061 { 00062 _n_vars = nv; 00063 00064 _var_types.resize (this->n_vars()); 00065 _var_names.resize (this->n_vars()); 00066 00067 // Default to float data 00068 std::fill (_var_types.begin(), _var_types.end(), 1); 00069 00070 // If the number of zones is set, resize the data. 00071 if (this->n_zones()) 00072 { 00073 _data.resize (this->n_zones()); 00074 00075 for (unsigned int z=0; z<this->n_zones(); z++) 00076 _data[z].resize (this->n_vars()); 00077 } 00078 } 00079 00080 00081 00082 void PltLoader::set_n_zones (const unsigned int nz) 00083 { 00084 _n_zones = nz; 00085 00086 _zone_types.resize (this->n_zones()); 00087 _zone_names.resize (this->n_zones()); 00088 _zone_pack.resize (this->n_zones()); 00089 00090 _imax.resize (this->n_zones()); 00091 _jmax.resize (this->n_zones()); 00092 _kmax.resize (this->n_zones()); 00093 00094 _data.resize (this->n_zones()); 00095 _conn.resize (this->n_zones()); 00096 00097 // If the number of variables are set, resize the data. 00098 if (this->n_vars()) 00099 for (unsigned int z=0; z<this->n_zones(); z++) 00100 _data[z].resize (this->n_vars()); 00101 } 00102 00103 } // namespace libMesh