dataadaptor.h 1.34 KB
Newer Older
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
#ifndef OSCILLATORS_DATAADAPTOR_H
#define OSCILLATORS_DATAADAPTOR_H

#include <vtkInsituDataAdaptor.h>

namespace oscillators
{
class DataAdaptor : public vtkInsituDataAdaptor
{
public:
  static DataAdaptor* New();
  vtkTypeMacro(DataAdaptor, vtkInsituDataAdaptor);

  /// @brief Initialize the data adaptor.
  ///
  /// This initializes the data adaptor. This must be called once per simulation run.
  /// @param nblocks is the total number of blocks in the simulation run.
  void Initialize(size_t nblocks);

  /// @brief Set the extents for local blocks.
  void SetBlockExtent(int gid,
    int xmin, int xmax, int ymin, int ymax, int zmin, int zmax);

  /// Set data for a specific block.
  void SetBlockData(int gid, float* data);

  virtual vtkDataObject* GetMesh(bool structure_only=false);
  virtual bool AddArray(vtkDataObject* mesh, int association, const char* arrayname);
  virtual unsigned int GetNumberOfArrays(int association) { return 1; }
  virtual const char* GetArrayName(int association, unsigned int index)
    { return index==0? "data" : NULL; }
  virtual void ReleaseData();

protected:
  DataAdaptor();
  virtual ~DataAdaptor();

  vtkDataObject* GetBlockMesh(int gid);

private:
  DataAdaptor(const DataAdaptor&); // not implemented.
  void operator=(const DataAdaptor&); // not implemented.

  class DInternals;
  DInternals* Internals;
};

}
#endif