This file is indexed.

/usr/include/libmesh/plt_loader.h is in libmesh-dev 0.7.1-2ubuntu1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
// $Id: plt_loader.h 3874 2010-07-02 21:57:26Z roystgnr $

// Copyright (C) 2002-2007  Benjamin S. Kirk
  
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
  
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
// Lesser General Public License for more details.
  
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA



#ifndef __plt_loader_h__
#define __plt_loader_h__

// C++ includes
#include <string>
#include <vector>

// Local includes
#include "libmesh_common.h"

namespace libMesh
{



/**
 * This class will read a binary \p .plt file.  These types of files
 * are for use with Amtec's <a href="http://www.tecplot.com">Tecplot</a>
 * visualization package.
 *
 * @author Benjamin S. Kirk, 2004.
 */
class PltLoader
{
public:

  /**
   * Constructor.  Initializes data.
   */
  PltLoader  (const bool v=false);

  /**
   * Constructor.  Reads the file specified by \p name.
   */
  PltLoader  (const std::string& name, const bool v=false);

  /**
   * Destructor.
   */ 
  ~PltLoader ();

  /**
   * Clear all data and return to a pristine state.
   */
  void clear ();
  
  /**
   * Returns the verbosity.
   */
  bool verbose () const { return _verbose; }
  
  /**
   * Reads the .plt file specified by \p name.  
   */
  void read (const std::string& name);

  /**
   * Writes an ASCII Tecplot file.  The optional parameter \p version
   * specifies the version format to write.
   */
  void write_dat (const std::string& name,
		  const unsigned int version=10) const;

// BSK - this functionality requires FORTRAN subrouitine calls,
//       and there is no need to "dirty up" \p libMesh with FORTRAN
//       just to enable these methods.
//   /**
//    * 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 \p reverse
//    * specifies if the output file will have reversed byte ordering.
//    */
//   void write_plot3d (const std::string& basename,
// 		     const bool reverse=false,
// 		     const bool gridonly=false) const;

//   /**
//    * Writes a Cart3D .tri component file.  The number of components
//    * will be the number of zones in the .plt file.
//    */
//   void write_tri (const std::string& name,
// 		  const bool reverse=false,
// 		  const bool gridonly=false) const;


   
  //--------------------------------------------------------------
  // Data access


  
  /**
   * Enum defining the zone type in the Tecplot binary file,
   * for use with the old .plt format.
   */  
  enum OldZoneType { BLOCK=0,
		     POINT,
		     FEBLOCK,
		     FEPOINT };

  /**
   * Enum defining the zone type in the Tecplot binary file,
   * for use with the new .plt format.
   */  
  enum NewZoneType { ORDERED=0,
		     FELINESEG,
		     FETRIANGLE,
		     FEQUADRILATERAL,
		     FETETRAHEDRON,
		     FEBRICK };

  /**
   * Enum defining the data type of each variable.
   */
  enum DataType { FLOAT=1,
		  DOUBLE,
		  LONGINT,
		  SHORTINT,
		  BYTE,
		  BIT};

  /**
   * Enum defining the finite element types
   */
  enum FEType { TRI=0,
		QUAD,
		TET,
		HEX };

  
  
  //--------------------------------------------------------------
  // Public Data Access



  /**
   * @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"
   */
  const std::string & version () const { return _version; }

  /**
   * @returns \p 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.
   */
  bool is_foreign () const { return _is_foreign; }
  
  /**
   * @returns the data set title
   */
  const std::string & title () const { return _title; }

  /**
   * @returns the number of variables in the data set.
   */
  unsigned int n_vars () const { return _n_vars; }

  /**
   * @returns the name of variable \p v.
   */
  const std::string & var_name (const unsigned int v) const;

  /**
   * @returns the type of variable \p v
   */
  unsigned int var_type (const unsigned int v) const;

  /**
   * @returns the number of zones.
   */
  unsigned int n_zones () const { return _n_zones; }

  /**
   * @returns the type of zone \p z
   */
  unsigned int zone_type (const unsigned int z) const;

  /**
   * @returns the name of zone \p z.
   */
  const std::string & zone_name (const unsigned int z) const;

  /**
   * @returns the data packing flag for zone \p z.
   */
  unsigned int zone_pack (const unsigned int z) const;

  /**
   * @returns \p imax for zone \p z.
   */
  unsigned int imax (const unsigned int z) const;

  /**
   * @returns \p jmax for zone \p z.
   */
  unsigned int jmax (const unsigned int z) const;

  /**
   * @returns \p kmax for zone \p z.
   */
  unsigned int kmax (const unsigned int z) const;

  /**
   * @returns the number of nodes in the mesh (for unstructured meshes).
   */
  unsigned int n_nodes (const unsigned int z) const;

  /**
   * @returns the number of elements in the mesh (for unstructured meshes).
   */
  unsigned int n_elem (const unsigned int z) const;

  /**
   * @returns the element type for the \p zth zone (for unstructured meshes).
   */
  FEType elem_type (const unsigned int z) const;

  /**
   * @returns a reference to the data read from the file
   */
  const std::vector<std::vector<std::vector<float> > > & get_data () const;
  
  /**
   * Enum defining the number of nodes for each element type.
   */
  static const unsigned int NNodes[4];

  
private:


  /**
   * Read the header of the binary file.
   */
  void read_header (std::istream& in);

  /**
   * Read data from the binary file.
   */
  void read_data (std::istream& in);
 
  /**
   * Read data for the zth zone in BLOCK structured format.
   */
  void read_block_data (std::istream& in, const unsigned int zn);
 
  /**
   * Read data for the zth zone in POINT structured format.
   */
  void read_point_data (std::istream& in, const unsigned int zn);
 
  /**
   * Read data for the zth zone in FEBLOCK unstructured format.
   */
  void read_feblock_data (std::istream& in, const unsigned int zn);
 
  /**
   * Read data for the zth zone in FEPOINT unstructured format.
   */
  void read_fepoint_data (std::istream& in, const unsigned int zn);


  //--------------------------------------------------------------
  // Private Data Access



  /**
   * @returns the Tecplot version number string.
   */
  std::string & version () { return _version; }
  
  /**
   * @returns \p 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.
   */
  bool & is_foreign () { return _is_foreign; }

  /**
   * @returns the data set title
   */
  std::string & title () { return _title; }

  /**
   * @returns the number of variables in the data set.
   */
  void set_n_vars (const unsigned int nv);

  /**
   * @returns the name of variable \p v.
   */
  std::string & var_name (const unsigned int v);

  /**
   * @returns the type of variable \p v
   */
  unsigned int & var_type (const unsigned int v);

  /**
   * @returns the number of zones.
   */
  void set_n_zones (const unsigned int nz);

  /**
   * @returns the type of zone \p z
   */
  unsigned int & zone_type (const unsigned int z);

  /**
   * @returns the name of zone \p z.
   */
  std::string & zone_name (const unsigned int z);

  /**
   * @returns the data pack flag for zone \p z.
   */
  unsigned int & zone_pack (const unsigned int z);

  /**
   * @returns \p imax for zone \p z.
   */
  unsigned int & imax (const unsigned int z);

  /**
   * @returns \p jmax for zone \p z.
   */
  unsigned int & jmax (const unsigned int z);

  /**
   * @returns \p kmax for zone \p z.
   */
  unsigned int & kmax (const unsigned int z);


  //--------------------------------------------------------------
  // Private Data

  
  /**
   * Verbosity
   */
  const bool _verbose;

  /**
   * The Tecplot Version number string.
   */
  std::string _version;

  /**
   * Is the data foreign?
   */
  bool _is_foreign;
  
  /**
   * The Tecplot data set title.
   */
  std::string _title;

  /**
   * The number of variables in the data set.
   */
  unsigned int _n_vars;

  /**
   * The name for each variable.
   */
  std::vector<std::string> _var_names;

  /**
   * The type of each variable.  Must be one of the
   * enumerated \p DataType types.
   */
  std::vector<unsigned int> _var_types;

  /**
   * The number of zones.
   */
  unsigned int _n_zones;

  /**
   * The type of each zone.
   */
  std::vector<unsigned int> _zone_types;

  /**
   * The name of each zone.
   */
  std::vector<std::string> _zone_names;

  /**
   * The data packing for each zone (new version only)
   */
  std::vector<unsigned int> _zone_pack;

  /**
   * The (imax,jmax,kmax) value for each zone.
   */
  std::vector<unsigned int> _imax;
  std::vector<unsigned int> _jmax;
  std::vector<unsigned int> _kmax;

  /**
   * Vector to hold the data.
   */
  std::vector<std::vector<std::vector<float> > >  _data;

  /**
   * Vectors to hold the connectivity for each zone
   * (only for unstructured files).
   */
  std::vector<std::vector<int> > _conn;

  /**
   * Scratch data & relevant sizes.
   */
  mutable char buf[512];
};



//---------------------------------------------------------
// PltLoader inline members
inline
PltLoader::PltLoader (const bool v) :
  _verbose      (v),
  _is_foreign   (false),
  _n_vars       (0),
  _n_zones      (0)
{
}



inline
PltLoader::PltLoader (const std::string& name, const bool v) :
  _verbose      (v),
  _is_foreign   (false),
  _n_vars       (0),
  _n_zones      (0)
{ 
  this->read (name);
}



inline
PltLoader::~PltLoader()
{
}



inline
const std::string & PltLoader::var_name (const unsigned int v) const
{
  libmesh_assert (v < this->n_vars());
  libmesh_assert (v < _var_names.size());
  libmesh_assert (this->n_vars() == _var_names.size());

  return _var_names[v];
}



inline
std::string & PltLoader::var_name (const unsigned int v)
{
  libmesh_assert (v < this->n_vars());
  libmesh_assert (v < _var_names.size());
  libmesh_assert (this->n_vars() == _var_names.size());

  return _var_names[v];
}



inline
unsigned int PltLoader::var_type (const unsigned int v) const
{
  libmesh_assert (v < this->n_vars());
  libmesh_assert (v < _var_types.size());
  libmesh_assert (this->n_vars() == _var_types.size());

  return _var_types[v];
}



inline
unsigned int & PltLoader::var_type (const unsigned int v)
{
  libmesh_assert (v < this->n_vars());
  libmesh_assert (v < _var_types.size());
  libmesh_assert (this->n_vars() == _var_types.size());

  return _var_types[v];
}



inline
unsigned int PltLoader::zone_type (const unsigned int z) const
{
  libmesh_assert (z < this->n_zones());
  libmesh_assert (z < _zone_types.size());
  libmesh_assert (this->n_zones() == _zone_types.size());

  return _zone_types[z];
}



inline
unsigned int & PltLoader::zone_type (const unsigned int z)
{
  libmesh_assert (z < this->n_zones());
  libmesh_assert (z < _zone_types.size());
  libmesh_assert (this->n_zones() == _zone_types.size());

  return _zone_types[z];
}



inline
const std::string & PltLoader::zone_name (const unsigned int z) const
{
  libmesh_assert (z < this->n_zones());
  libmesh_assert (z < _zone_names.size());
  libmesh_assert (this->n_zones() == _zone_names.size());

  return _zone_names[z];
}



inline
std::string & PltLoader::zone_name (const unsigned int z)
{
  libmesh_assert (z < this->n_zones());
  libmesh_assert (z < _zone_names.size());
  libmesh_assert (this->n_zones() == _zone_names.size());

  return _zone_names[z];
}



inline
unsigned int PltLoader::zone_pack (const unsigned int z) const
{
  libmesh_assert (z < this->n_zones());
  libmesh_assert (z < _zone_pack.size());
  libmesh_assert (this->n_zones() == _zone_pack.size());

  return _zone_pack[z];
}



inline
unsigned int & PltLoader::zone_pack (const unsigned int z)
{
  libmesh_assert (z < this->n_zones());
  libmesh_assert (z < _zone_pack.size());
  libmesh_assert (this->n_zones() == _zone_pack.size());

  return _zone_pack[z];
}



inline
unsigned int PltLoader::imax (const unsigned int z) const
{
  libmesh_assert (z < this->n_zones());
  libmesh_assert (_imax.size() == this->n_zones());

  return _imax[z];
}



inline
unsigned int & PltLoader::imax (const unsigned int z)
{
  libmesh_assert (z < this->n_zones());
  libmesh_assert (_imax.size() == this->n_zones());

  return _imax[z];
}



inline
unsigned int PltLoader::jmax (const unsigned int z) const
{
  libmesh_assert (z < this->n_zones());
  libmesh_assert (_jmax.size() == this->n_zones());

  return _jmax[z];
}



inline
unsigned int & PltLoader::jmax (const unsigned int z)
{
  libmesh_assert (z < this->n_zones());
  libmesh_assert (_jmax.size() == this->n_zones());

  return _jmax[z];
}



inline
unsigned int PltLoader::kmax (const unsigned int z) const
{
  libmesh_assert (z < this->n_zones());
  libmesh_assert (_kmax.size() == this->n_zones());

  return _kmax[z];
}



inline
unsigned int & PltLoader::kmax (const unsigned int z)
{
  libmesh_assert (z < this->n_zones());
  libmesh_assert (_kmax.size() == this->n_zones());

  return _kmax[z];
}



inline
unsigned int PltLoader::n_nodes (const unsigned int z) const
{
  libmesh_assert (z < this->n_zones());
  
  // Only for unstructured zones!
  libmesh_assert (this->zone_type(z) > 1);
  
  return this->imax(z);
}



inline
unsigned int PltLoader::n_elem (const unsigned int z) const
{
  libmesh_assert (z < this->n_zones());
  
  // Only for unstructured zones!
  libmesh_assert (this->zone_type(z) > 1);
  
  return this->jmax(z);
}



inline
PltLoader::FEType PltLoader::elem_type (const unsigned int z) const
{
  libmesh_assert (z < this->n_zones());
  
  // Only for unstructured zones!
  libmesh_assert (this->zone_type(z) > 1);
  
  return static_cast<FEType>(this->kmax(z));
}


inline
const std::vector<std::vector<std::vector<float> > > &
PltLoader::get_data () const
{
  return _data;
}




} // namespace libMesh


#endif // #ifndef __plt_loader_h__