File: vtkExodusIIReaderVariableCheck.h

package info (click to toggle)
paraview 5.11.0%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 497,236 kB
  • sloc: cpp: 3,171,290; ansic: 1,315,072; python: 134,290; xml: 103,324; sql: 65,887; sh: 5,286; javascript: 4,901; yacc: 4,383; java: 3,977; perl: 2,363; lex: 1,909; f90: 1,255; objc: 143; makefile: 119; tcl: 59; pascal: 50; fortran: 29
file content (126 lines) | stat: -rw-r--r-- 4,762 bytes parent folder | download
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
#ifndef vtkExodusIIReaderVariableCheck_h
#define vtkExodusIIReaderVariableCheck_h

#include "vtkExodusIIReaderPrivate.h" // for ArrayInfoType

#include <set>                          // STL Header for integration point names
#include <string>                       // STL Header for Start/StartInternal/Add
#include <vector>                       // STL Header for glommed array names
#include <vtksys/RegularExpression.hxx> // 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).
 */
VTK_ABI_NAMESPACE_BEGIN
class vtkExodusIIReaderVariableCheck
{
public:
  /// Initialize a sequence of names. Returns true if any more names are acceptable.
  virtual bool Start(std::string name, const int* truth, int numTruth);
  /// Subclasses implement this and returns true if any more names are acceptable.
  virtual bool StartInternal(std::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(std::string name, const int* truth) = 0;
  /// Returns the length of the sequence (or 0 if the match is incorrect or incomplete).
  virtual std::vector<std::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;
  std::string Prefix;
  std::vector<std::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();
  bool StartInternal(std::string name, const int*, int) override;
  bool Add(std::string, const int*) override;
};

/// 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);
  bool StartInternal(std::string name, const int*, int) override;
  bool Add(std::string name, const int* truth) override;
  std::vector<std::string>::size_type Length() override;

protected:
  std::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);
  bool StartInternal(std::string name, const int*, int) override;
  bool Add(std::string name, const int* truth) override;
  std::vector<std::string>::size_type Length() override;

protected:
  std::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();
  bool StartInternal(std::string name, const int*, int) override;
  bool Add(std::string name, const int*) override;
  std::vector<std::string>::size_type Length() override;
  /*
  virtual int Accept(
    std::vector<vtkExodusIIReaderPrivate::ArrayInfoType>& arr, int startIndex,
  vtkExodusIIReaderPrivate* priv, int objtyp )
    {
    }
    */
protected:
  bool StartIntegrationPoints(std::string cellType, std::string iptName);
  bool AddIntegrationPoint(std::string iptName);

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

VTK_ABI_NAMESPACE_END
#endif // vtkExodusIIReaderVariableCheck_h
// VTK-HeaderTest-Exclude: vtkExodusIIReaderVariableCheck.h