Line data Source code
1 : // The libMesh Finite Element Library. 2 : // Copyright (C) 2002-2025 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 : 20 : #include "libmesh/plt_loader.h" 21 : 22 : #include "libmesh/int_range.h" 23 : 24 : namespace libMesh 25 : { 26 : 27 : 28 : 29 : //--------------------------------------------------------- 30 : // PltLoader static data 31 : const unsigned int PltLoader::NNodes[4] = {3, 4, 4, 8}; 32 : 33 : 34 : 35 : //----------------------------------------------------------------------------- 36 : // PltLoader members 37 0 : void PltLoader::clear () 38 : { 39 : // clear vectors & strings. Using .erase() for strings instead of .clear() 40 : // since GCC 2.95.3 does not support .clear(). 41 0 : _version.erase(); 42 0 : _title.erase(); 43 : 44 0 : _var_names.clear(); 45 0 : _var_types.clear(); 46 0 : _zone_types.clear(); 47 0 : _zone_names.clear(); 48 0 : _zone_pack.clear(); 49 0 : _imax.clear(); 50 0 : _jmax.clear(); 51 0 : _kmax.clear(); 52 0 : _data.clear(); 53 0 : _conn.clear(); 54 : 55 : // reinitialize 56 0 : _is_foreign = false; 57 0 : _n_vars = 0; 58 0 : _n_zones = 0; 59 0 : } 60 : 61 : 62 : 63 0 : void PltLoader::set_n_vars (const unsigned int nv) 64 : { 65 0 : _n_vars = nv; 66 : 67 0 : _var_types.resize (this->n_vars()); 68 0 : _var_names.resize (this->n_vars()); 69 : 70 : // Default to float data 71 0 : std::fill (_var_types.begin(), _var_types.end(), 1); 72 : 73 : // If the number of zones is set, resize the data. 74 0 : if (this->n_zones()) 75 : { 76 0 : _data.resize (this->n_zones()); 77 : 78 0 : for (auto z : make_range(this->n_zones())) 79 0 : _data[z].resize (this->n_vars()); 80 : } 81 0 : } 82 : 83 : 84 : 85 0 : void PltLoader::set_n_zones (const unsigned int nz) 86 : { 87 0 : _n_zones = nz; 88 : 89 0 : _zone_types.resize (this->n_zones()); 90 0 : _zone_names.resize (this->n_zones()); 91 0 : _zone_pack.resize (this->n_zones()); 92 : 93 0 : _imax.resize (this->n_zones()); 94 0 : _jmax.resize (this->n_zones()); 95 0 : _kmax.resize (this->n_zones()); 96 : 97 0 : _data.resize (this->n_zones()); 98 0 : _conn.resize (this->n_zones()); 99 : 100 : // If the number of variables are set, resize the data. 101 0 : if (this->n_vars()) 102 0 : for (auto z : make_range(this->n_zones())) 103 0 : _data[z].resize (this->n_vars()); 104 0 : } 105 : 106 : } // namespace libMesh