vtkXdmf3LightDataHandler.h 3.8 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
/*=========================================================================

  Program:   Visualization Toolkit
  Module:    vtkXdmf3LightDataHandler.h
  Language:  C++

  Copyright (c) 1993-2002 Ken Martin, Will Schroeder, Bill Lorensen
  All rights reserved.
  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.

     This software is distributed WITHOUT ANY WARRANTY; without even
     the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
     PURPOSE.  See the above copyright notice for more information.

=========================================================================*/
16 17 18 19 20 21 22 23 24 25 26
/**
 * @class   vtkXdmf3LightDataHandler
 * @brief   internal helper for vtkXdmf3Reader
 *
 * vtkXdmf3Reader uses this class to inspect the light data in the XDMF
 * file(s) and determine meta-information about the vtkDataObjects it
 * needs to produce.
 *
 * This file is a helper for the vtkXdmf3Reader and not intended to be
 * part of VTK public API
*/
27

28 29
#ifndef vtkXdmf3LightDataHandler_h
#define vtkXdmf3LightDataHandler_h
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44

#include "vtkIOXdmf3Module.h" // For export macro
#include <set>
#include "XdmfItem.hpp"
#include "vtkType.h"

class vtkXdmf3SILBuilder;
class vtkXdmf3ArraySelection;
class XdmfItem;
class XdmfGraph;
class XdmfGrid;

class VTKIOXDMF3_EXPORT vtkXdmf3LightDataHandler
{
public:
45 46 47
  /**
   * factory constructor
   */
48 49 50 51 52 53 54 55 56 57
  static shared_ptr<vtkXdmf3LightDataHandler> New(
      vtkXdmf3SILBuilder *sb,
      vtkXdmf3ArraySelection* f,
      vtkXdmf3ArraySelection* ce,
      vtkXdmf3ArraySelection* pn,
      vtkXdmf3ArraySelection* gc,
      vtkXdmf3ArraySelection* sc,
      unsigned int processor,
      unsigned int nprocessors);

58 59 60
  /**
   * destructor
   */
61 62
  ~vtkXdmf3LightDataHandler();

63 64 65 66 67 68
  /**
   * recursively inspect XDMF data hierarchy to determine
   * times that we can provide data at
   * name of arrays to select from
   * name and hierarchical relationship of blocks to select from
   */
69 70 71
  void InspectXDMF(shared_ptr<XdmfItem> item, vtkIdType parentVertex,
                   unsigned int depth=0);

72 73 74
  /**
   * called to make sure overflown SIL doesn't give nonsensical results
   */
75 76
  void ClearGridsIfNeeded(shared_ptr<XdmfItem> domain);

77 78 79 80
  /**
   * return the list of times that the xdmf file can provide data at
   * only valid after InspectXDMF
   */
81 82 83
  std::set<double> getTimes();

private:
84 85 86
  /**
   * constructor
   */
87 88
  vtkXdmf3LightDataHandler();

89 90 91
  /**
   * remembers array names from the item
   */
92 93
  void InspectArrays(shared_ptr<XdmfItem> item);

94 95 96
  /**
   * Used in SIL creation.
   */
97 98
  bool TooDeep(unsigned int depth);

99 100 101
  /**
   * Used in SIL creation.
   */
102 103
  std::string UniqueName(std::string name, bool ForGrid);

104 105 106
  /**
   * Used in SIL creation.
   */
107 108 109
  void AddNamedBlock(vtkIdType parentVertex,
                     std::string originalName, std::string uniqueName);

110 111 112
  /**
   * Used in SIL creation.
   */
113
  void AddNamedSet(std::string uniqueName);
114

115 116 117 118 119
  //@{
  /**
   * records times that xdmf grids supply data at
   * if timespecs are only implied we add them to make things simpler later on
   */
120 121 122
  void InspectTime(shared_ptr<XdmfItem> item);
  void GetSetTime(shared_ptr<XdmfGrid> child, unsigned int &cnt);
  void GetSetTime(shared_ptr<XdmfGraph> child, unsigned int &cnt);
123
  //@}
124

125 126 127
  /**
   * for parallel partitioning
   */
128 129 130 131 132 133 134 135 136 137 138 139 140 141
  bool ShouldRead(unsigned int piece, unsigned int npieces);

  vtkXdmf3SILBuilder *SILBuilder;
  vtkXdmf3ArraySelection *FieldArrays;
  vtkXdmf3ArraySelection *CellArrays; //ie EdgeArrays for Graphs
  vtkXdmf3ArraySelection *PointArrays; //ie NodeArrays for Graphs
  vtkXdmf3ArraySelection *GridsCache;
  vtkXdmf3ArraySelection *SetsCache;
  unsigned int MaxDepth;
  unsigned int Rank;
  unsigned int NumProcs;
  std::set<double> times; //relying on implicit sort from set<double>
};

142
#endif //vtkXdmf3LightDataHandler_h
143
// VTK-HeaderTest-Exclude: vtkXdmf3LightDataHandler.h