VTK
dox/IO/Xdmf2/vtkXdmfWriter.h
Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    vtkXdmfWriter.h
00005 
00006   Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
00007   All rights reserved.
00008   See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
00009 
00010      This software is distributed WITHOUT ANY WARRANTY; without even
00011      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
00012      PURPOSE.  See the above copyright notice for more information.
00013 
00014 =========================================================================*/
00015 
00028 #ifndef _vtkXdmfWriter_h
00029 #define _vtkXdmfWriter_h
00030 
00031 #include "vtkIOXdmf2Module.h" // For export macro
00032 
00033 #include "vtkDataObjectAlgorithm.h"
00034 
00035 class vtkExecutive;
00036 
00037 class vtkCompositeDataSet;
00038 class vtkDataArray;
00039 class vtkDataSet;
00040 class vtkDataObject;
00041 class vtkFieldData;
00042 class vtkInformation;
00043 class vtkInformationVector;
00044 class vtkXdmfWriterDomainMemoryHandler;
00045 class XdmfArray;
00046 class XdmfDOM;
00047 class XdmfGrid;
00048 
00049 class VTKIOXDMF2_EXPORT vtkXdmfWriter : public vtkDataObjectAlgorithm
00050 {
00051 public:
00052   static vtkXdmfWriter *New();
00053   vtkTypeMacro(vtkXdmfWriter,vtkDataObjectAlgorithm);
00054   void PrintSelf(ostream& os, vtkIndent indent);
00055 
00057   virtual void SetInputData(vtkDataObject* dobj);
00058 
00060 
00061   vtkSetStringMacro(FileName);
00062   vtkGetStringMacro(FileName);
00064 
00066 
00068   vtkSetStringMacro(HeavyDataFileName);
00069   vtkGetStringMacro(HeavyDataFileName);
00071 
00073 
00075   vtkSetStringMacro(HeavyDataGroupName);
00076   vtkGetStringMacro(HeavyDataGroupName);
00078 
00082   virtual int Write();
00083 
00085 
00087   vtkSetMacro(LightDataLimit, int);
00088   vtkGetMacro(LightDataLimit, int);
00090 
00092 
00094   vtkSetMacro(WriteAllTimeSteps, int);
00095   vtkGetMacro(WriteAllTimeSteps, int);
00096   vtkBooleanMacro(WriteAllTimeSteps, int);
00098 
00100 
00102   vtkSetMacro(Piece, int);
00103   vtkSetMacro(NumberOfPieces, int);
00105 
00106   //TODO: control choice of heavy data format (xml, hdf5, sql, raw)
00107 
00108   //TODO: These controls are available in vtkXdmfWriter, but are not used here.
00109   //GridsOnly
00110   //Append to Domain
00111 
00112 protected:
00113   vtkXdmfWriter();
00114   ~vtkXdmfWriter();
00115 
00116   //Choose composite executive by default for time.
00117   virtual vtkExecutive* CreateDefaultExecutive();
00118 
00119   //Can take any one data object
00120   virtual int FillInputPortInformation(int port, vtkInformation *info);
00121 
00122   //Overridden to ...
00123   virtual int RequestInformation(vtkInformation*,
00124                                  vtkInformationVector**,
00125                                  vtkInformationVector*);
00126   //Overridden to ...
00127   virtual int RequestUpdateExtent(vtkInformation*,
00128                                   vtkInformationVector**,
00129                                   vtkInformationVector*);
00130   //Overridden to ...
00131   virtual int RequestData(vtkInformation*,
00132                           vtkInformationVector**,
00133                           vtkInformationVector*);
00134 
00135   //These do the work: recursively parse down input's structure all the way to arrays,
00136   //use XDMF lib to dump everything to file.
00137 
00138   virtual void CreateTopology(vtkDataSet *ds, XdmfGrid *grid, vtkIdType PDims[3], vtkIdType CDims[3], vtkIdType &PRank, vtkIdType &CRank, void *staticdata);
00139   virtual void CreateGeometry(vtkDataSet *ds, XdmfGrid *grid, void *staticdata);
00140 
00141   virtual void WriteDataSet(vtkDataObject *dobj, XdmfGrid *grid);
00142   virtual void WriteCompositeDataSet(vtkCompositeDataSet *dobj, XdmfGrid *grid);
00143   virtual void WriteAtomicDataSet(vtkDataObject *dobj, XdmfGrid *grid);
00144   virtual void WriteArrays(vtkFieldData* dsa, XdmfGrid *grid, int association,
00145                            vtkIdType rank, vtkIdType *dims, const char *name);
00146   virtual void ConvertVToXArray(vtkDataArray *vda, XdmfArray *xda,
00147                                 vtkIdType rank, vtkIdType *dims,
00148                                 int AllocStrategy, const char *heavyprefix);
00149 
00150   char *FileName;
00151   char *HeavyDataFileName;
00152   char *HeavyDataGroupName;
00153 
00154   int LightDataLimit;
00155 
00156   int WriteAllTimeSteps;
00157   int NumberOfTimeSteps;
00158   int CurrentTimeIndex;
00159 
00160   int Piece;
00161   int NumberOfPieces;
00162 
00163   XdmfDOM *DOM;
00164   XdmfGrid *TopTemporalGrid;
00165 
00166   vtkXdmfWriterDomainMemoryHandler *DomainMemoryHandler;
00167 
00168 private:
00169   vtkXdmfWriter(const vtkXdmfWriter&); // Not implemented
00170   void operator=(const vtkXdmfWriter&); // Not implemented
00171 };
00172 
00173 #endif /* _vtkXdmfWriter_h */