plt_loader.C
Go to the documentation of this file.
1 // Copyright (C) 2002-2007 Benjamin S. Kirk
2 
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
7 
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
12 
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16 
17 
18 
19 #include "libmesh/plt_loader.h"
20 
21 namespace libMesh
22 {
23 
24 
25 
26 //---------------------------------------------------------
27 // PltLoader static data
28 const unsigned int PltLoader::NNodes[4] = {3, 4, 4, 8};
29 
30 
31 
32 //-----------------------------------------------------------------------------
33 // PltLoader members
35 {
36  // clear vectors & strings. Using .erase() for strings instead of .clear()
37  // since GCC 2.95.3 does not support .clear().
38  _version.erase();
39  _title.erase();
40 
41  _var_names.clear();
42  _var_types.clear();
43  _zone_types.clear();
44  _zone_names.clear();
45  _zone_pack.clear();
46  _imax.clear();
47  _jmax.clear();
48  _kmax.clear();
49  _data.clear();
50  _conn.clear();
51 
52  // reinitialize
53  _is_foreign = false;
54  _n_vars = 0;
55  _n_zones = 0;
56 }
57 
58 
59 
60 void PltLoader::set_n_vars (const unsigned int nv)
61 {
62  _n_vars = nv;
63 
64  _var_types.resize (this->n_vars());
65  _var_names.resize (this->n_vars());
66 
67  // Default to float data
68  std::fill (_var_types.begin(), _var_types.end(), 1);
69 
70  // If the number of zones is set, resize the data.
71  if (this->n_zones())
72  {
73  _data.resize (this->n_zones());
74 
75  for (unsigned int z=0; z<this->n_zones(); z++)
76  _data[z].resize (this->n_vars());
77  }
78 }
79 
80 
81 
82 void PltLoader::set_n_zones (const unsigned int nz)
83 {
84  _n_zones = nz;
85 
86  _zone_types.resize (this->n_zones());
87  _zone_names.resize (this->n_zones());
88  _zone_pack.resize (this->n_zones());
89 
90  _imax.resize (this->n_zones());
91  _jmax.resize (this->n_zones());
92  _kmax.resize (this->n_zones());
93 
94  _data.resize (this->n_zones());
95  _conn.resize (this->n_zones());
96 
97  // If the number of variables are set, resize the data.
98  if (this->n_vars())
99  for (unsigned int z=0; z<this->n_zones(); z++)
100  _data[z].resize (this->n_vars());
101 }
102 
103 } // namespace libMesh

Site Created By: libMesh Developers
Last modified: February 07 2014 16:57:06 UTC

Hosted By:
SourceForge.net Logo