File: vtkExodusIIReaderVariableCheck.h

package info (click to toggle)
paraview 4.0.1-1~bpo70%2B1
  • links: PTS, VCS
  • area: main
  • in suites: wheezy-backports
  • size: 526,572 kB
  • sloc: cpp: 2,284,430; ansic: 816,374; python: 239,936; xml: 70,162; tcl: 48,295; fortran: 39,116; yacc: 5,466; java: 3,518; perl: 3,107; lex: 1,620; sh: 1,555; makefile: 932; asm: 471; pascal: 228
file content (122 lines) | stat: -rw-r--r-- 4,876 bytes parent folder | download | duplicates (4)
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
#ifndef __vtkExodusIIReaderVariableCheck_h
#define __vtkExodusIIReaderVariableCheck_h

#include "vtkExodusIIReaderPrivate.h" // for ArrayInfoType

#include <vtksys/RegularExpression.hxx> // for integration point names
#include <vtksys/String.hxx> // STL Header for Start/StartInternal/Add
#include <vector> // STL Header for glommed array names
#include <set> // STL Header for integration point names

/**\brief Abstract base class for glomming arrays of variable names.
  *
  * Subclasses check whether variable names listed in an array of names
  * are related to each other (and should thus be glommed into a single
  * VTK array).
  */
class vtkExodusIIReaderVariableCheck
{
public:
  /// Initialize a sequence of names. Returns true if any more names are acceptable.
  virtual bool Start( vtksys_stl::string name, const int* truth, int numTruth );
  /// Subclasses implement this and returns true if any more names are acceptable.
  virtual bool StartInternal( vtksys_stl::string name, const int* truth, int numTruth ) = 0;
  /// Add a name to the sequence. Returns true if any more names may be added.
  virtual bool Add( vtksys_stl::string name, const int* truth ) = 0;
  /// Returns the length of the sequence (or 0 if the match is incorrect or incomplete).
  virtual std::vector<vtksys_stl::string>::size_type Length();
  /// Accept this sequence. (Add an entry to the end of \a arr.) Must return Length().
  virtual int Accept(
    std::vector<vtkExodusIIReaderPrivate::ArrayInfoType>& arr,
    int startIndex, vtkExodusIIReaderPrivate* priv, int objtyp );

protected:
  vtkExodusIIReaderVariableCheck();
  virtual ~vtkExodusIIReaderVariableCheck();
  /** Utility that subclasses may call from within Add() to verify that
    * the new variable is defined on the same objects as other variables in the sequence.
    */
  bool CheckTruth( const int* truth );
  bool UniquifyName(
    vtkExodusIIReaderPrivate::ArrayInfoType& ainfo,
    std::vector<vtkExodusIIReaderPrivate::ArrayInfoType>& arrays );

  int GlomType;
  std::vector<int> SeqTruth;
  vtksys_stl::string Prefix;
  std::vector<vtksys_stl::string> OriginalNames;
};

/// This always accepts a single array name as a scalar. It is the fallback for all other checkers.
class vtkExodusIIReaderScalarCheck : public vtkExodusIIReaderVariableCheck
{
public:
  vtkExodusIIReaderScalarCheck();
  virtual bool StartInternal( vtksys_stl::string name, const int*, int );
  virtual bool Add( vtksys_stl::string, const int* );
};

/// This looks for n-D vectors whose names are identical except for a single final character.
class vtkExodusIIReaderVectorCheck : public vtkExodusIIReaderVariableCheck
{
public:
  vtkExodusIIReaderVectorCheck( const char* seq, int n );
  virtual bool StartInternal( vtksys_stl::string name, const int*, int );
  virtual bool Add( vtksys_stl::string name, const int* truth );
  virtual std::vector<vtksys_stl::string>::size_type Length();
protected:
  vtksys_stl::string Endings;
  bool StillAdding;
};

/**\brief This looks for symmetric tensors of a given rank and dimension.
  *
  * All array names must be identical except for the last \a rank characters
  * which must be taken from the \a dim -length character array \a seq, specified
  * as dimension indicators.
  */
class vtkExodusIIReaderTensorCheck : public vtkExodusIIReaderVariableCheck
{
public:
  vtkExodusIIReaderTensorCheck( const char* seq, int n, int rank, int dim );
  virtual bool StartInternal( vtksys_stl::string name, const int*, int );
  virtual bool Add( vtksys_stl::string name, const int* truth );
  virtual std::vector<vtksys_stl::string>::size_type Length();
protected:
  vtksys_stl::string Endings;
  vtkTypeUInt64 NumEndings;
  int Dimension;
  int Rank;
  bool StillAdding;
};

/// This looks for integration-point variables whose names contain an element shape and digits specifying an integration point.
class vtkExodusIIReaderIntPointCheck : public vtkExodusIIReaderVariableCheck
{
public:
  vtkExodusIIReaderIntPointCheck();
  virtual bool StartInternal( vtksys_stl::string name, const int*, int );
  virtual bool Add( vtksys_stl::string name, const int* );
  virtual std::vector<vtksys_stl::string>::size_type Length();
  /*
  virtual int Accept(
    std::vector<vtkExodusIIReaderPrivate::ArrayInfoType>& arr, int startIndex, vtkExodusIIReaderPrivate* priv, int objtyp )
    {
    }
    */
protected:
  bool StartIntegrationPoints( vtksys_stl::string cellType, vtksys_stl::string iptName );
  bool AddIntegrationPoint( vtksys_stl::string iptName );

  vtksys::RegularExpression RegExp;
  vtksys_stl::string VarName;
  vtksys_stl::string CellType;
  std::vector<int> IntPtMin;
  std::vector<int> IntPtMax;
  std::set<vtksys_stl::string> IntPtNames;
  vtkTypeUInt64 Rank;
  bool StillAdding;
};

#endif // __vtkExodusIIReaderVariableCheck_h
// VTK-HeaderTest-Exclude: vtkExodusIIReaderVariableCheck.h