DataAdaptor.h 1.73 KB
Newer Older
1 2 3
#ifndef PARALLEL3D_DATAADAPTOR_H
#define PARALLEL3D_DATAADAPTOR_H

4
#include <sensei/DataAdaptor.h>
5 6 7
#include "vtkSmartPointer.h"
#include <map>
#include <string>
Utkarsh Ayachit's avatar
Utkarsh Ayachit committed
8
#include <cstdint>
9 10

class vtkDoubleArray;
11
class vtkImageData;
12 13 14 15 16 17

namespace parallel3d
{
/// DataAdaptor is an adaptor for the parallel_3d simulation (miniapp).
/// Its purpose is to map the simulation datastructures to VTK
/// data model.
18
class DataAdaptor : public sensei::DataAdaptor
19 20 21
{
public:
  static DataAdaptor* New();
22
  vtkTypeMacro(DataAdaptor, sensei::DataAdaptor);
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37

  /// Initialize the data adaptor.
  void Initialize(
    int g_x, int g_y, int g_z,
    int l_x, int l_y, int l_z,
    uint64_t start_extents_x, uint64_t start_extents_y, uint64_t start_extents_z,
    int tot_blocks_x, int tot_blocks_y, int tot_blocks_z,
    int block_id_x, int block_id_y, int block_id_z);

  /// Set the pointers to simulation memory.
  void AddArray(const std::string& name, double* data);

  /// Clear all arrays.
  void ClearArrays();

38
  virtual vtkDataObject* GetMesh(bool structure_only=false);
39
  virtual bool AddArray(vtkDataObject* mesh, int association, const std::string& arrayname);
40
  virtual unsigned int GetNumberOfArrays(int association);
41
  virtual std::string GetArrayName(int association, unsigned int index);
42 43 44 45 46 47 48 49 50 51 52 53
  virtual void ReleaseData();

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

  typedef std::map<std::string, double*> VariablesType;
  VariablesType Variables;

  typedef std::map<std::string, vtkSmartPointer<vtkDoubleArray> > ArraysType;
  ArraysType Arrays;

54
  vtkSmartPointer<vtkImageData> Mesh;
55 56
  int CellExtent[6];
  int WholeExtent[6];
57 58 59 60 61 62 63 64
private:
  DataAdaptor(const DataAdaptor&); // not implemented.
  void operator=(const DataAdaptor&); // not implemented.
};

}

#endif