00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00068 #ifndef __vtkExodusIIWriter_h
00069 #define __vtkExodusIIWriter_h
00070
00071
00072 #include "vtkWriter.h"
00073
00074 #include <vtkstd/map>
00075
00076 class vtkUnstructuredGrid;
00077 class vtkFloatArray;
00078 class vtkDoubleArray;
00079 class vtkDataArray;
00080 class vtkUnsignedCharArray;
00081 class vtkIntArray;
00082 class vtkModelMetadata;
00083
00084 class VTK_PARALLEL_EXPORT vtkExodusIIWriter : public vtkWriter
00085 {
00086 public:
00087 static vtkExodusIIWriter *New();
00088 vtkTypeRevisionMacro(vtkExodusIIWriter,vtkWriter);
00089 void PrintSelf(ostream& os, vtkIndent indent);
00090
00093 void SetInput(vtkUnstructuredGrid *ug);
00094 vtkUnstructuredGrid *GetInput();
00095
00104 virtual void SetModelMetadata(vtkModelMetadata*);
00105 vtkGetObjectMacro(ModelMetadata, vtkModelMetadata);
00106
00116 vtkModelMetadata* GetOrCreateModelMetadata();
00117
00123 vtkSetStringMacro(FileName);
00124 vtkGetStringMacro(FileName);
00125
00131 vtkSetMacro(StoreDoubles, int);
00132 vtkGetMacro(StoreDoubles, int);
00133
00137 vtkSetMacro(GhostLevel, int);
00138 vtkGetMacro(GhostLevel, int);
00139
00148 vtkSetStringMacro(BlockIdArrayName);
00149 vtkGetStringMacro(BlockIdArrayName);
00150
00155 vtkSetMacro(WriteOutBlockIdArray, int);
00156 vtkGetMacro(WriteOutBlockIdArray, int);
00157 vtkBooleanMacro(WriteOutBlockIdArray, int);
00158
00164 vtkSetStringMacro(GlobalNodeIdArrayName);
00165 vtkGetStringMacro(GlobalNodeIdArrayName);
00166
00171 vtkSetMacro(WriteOutGlobalNodeIdArray, int);
00172 vtkGetMacro(WriteOutGlobalNodeIdArray, int);
00173 vtkBooleanMacro(WriteOutGlobalNodeIdArray, int);
00174
00180 vtkSetStringMacro(GlobalElementIdArrayName);
00181 vtkGetStringMacro(GlobalElementIdArrayName);
00182
00187 vtkSetMacro(WriteOutGlobalElementIdArray, int);
00188 vtkGetMacro(WriteOutGlobalElementIdArray, int);
00189 vtkBooleanMacro(WriteOutGlobalElementIdArray, int);
00190
00197 void SetTimeStepValues(int NumberOfTimeSteps, float *v);
00198 float *GetTimeStepValues(){return this->InputTimeStepValues;}
00199 int GetNumberOfTimeSteps(){return this->InputNumberOfTimeSteps;}
00200
00210 void SetCurrentTimeStep(int ts);
00211 int GetCurrentTimeStep(){return this->InputCurrentTimeStep;}
00212
00218 void SetAllBlockIds(int numEntries, int *blockIds);
00219
00225 vtkSetMacro(ErrorStatus, int);
00226 vtkGetMacro(ErrorStatus, int);
00227
00228 protected:
00229
00230 vtkExodusIIWriter();
00231 ~vtkExodusIIWriter();
00232
00233 virtual int FillInputPortInformation(int port, vtkInformation* info);
00234
00235 void WriteData();
00236
00237 vtkExodusIIWriter(const vtkExodusIIWriter&);
00238 void operator=(const vtkExodusIIWriter&);
00239
00240 vtkSetStringMacro(MyFileName);
00241 vtkGetStringMacro(MyFileName);
00242
00244
00247 vtkSetMacro(MyRank, int);
00248 vtkGetMacro(MyRank, int);
00250
00251 private:
00252 static char *StrDupWithNew(const char *s);
00253
00254 void RemoveGhostCells();
00255
00256 void SetPassDoubles();
00257
00258 int CheckParameters();
00259 int CreateExodusModel();
00260 int CreateBlockIdInformationFromCellTypes(vtkModelMetadata *em);
00261 int CreateBlockIdInformation(vtkModelMetadata *em);
00262
00263 static char **FlattenOutVariableNames(int narrays, int nScalarArrays,
00264 char **nms, int *numComponents);
00265 static void CreateNamesForScalarArrays(const char *root, char **nms,
00266 int numComponents);
00267 static char *GetCellTypeName(int t);
00268 static int FindCellType(int blockId, int *blockIdList, unsigned char *cellTypeList,
00269 int nCells);
00270
00271 int CreateNewExodusFile();
00272 int OpenExodusFile();
00273 void CloseExodusFile();
00274
00275 void InitializeVariableArrayNames();
00276 void ClearVariableArrayNames();
00277 void SetNewNodeVariableNames(vtkDataArray *da, char **nm);
00278 void SetNewElementVariableNames(vtkDataArray *da, char **nm);
00279
00280 void InitializeBlockLists();
00281 void ClearBlockLists();
00282 int WriteBlockVariables();
00283
00284 vtkstd::map<int, int> *BuildBlockElementSearchStructure(int block);
00285
00286
00287 int WriteInitializationParameters();
00288 int WriteQARecords();
00289 int WriteInformationRecords();
00290 int WritePoints();
00291 int WriteCoordinateNames();
00292 int WriteGlobalPointIds();
00293 int WriteGlobalElementIds();
00294 int WriteBlockInformation();
00295 int WriteVariableArrayNames();
00296 int WriteNodeSetInformation();
00297 int WriteSideSetInformation();
00298 int WriteProperties();
00299
00300 int GetTimeStepIndex();
00301 float GetTimeStepValue(int timeStepIndex);
00302 int WriteNextTimeStep();
00303 float *ExtractComponentF(vtkDataArray *da, int comp, int *idx);
00304 double *ExtractComponentD(vtkDataArray *da, int comp, int *idx);
00305
00306 vtkModelMetadata *ModelMetadata;
00307
00308 int PassDoubles;
00309
00310 int StoreDoubles;
00311
00312 int fid;
00313
00314 char *FileName;
00315 char *MyFileName;
00316
00317
00318
00319
00320
00321
00322 int *InputBlockIds;
00323 int InputBlockIdsLength;
00324
00325 int InputNumberOfTimeSteps;
00326 float *InputTimeStepValues;
00327 int InputCurrentTimeStep;
00328 int LastTimeStepWritten;
00329
00330
00331
00332 char *GlobalElementIdArrayName;
00333 int *GlobalElementIdList;
00334
00335 vtkstd::map<int, int> *LocalElementIdMap;
00336
00337 int GetElementLocalId(int i);
00338 int WriteOutGlobalElementIdArray;
00339
00340
00341
00342 char *GlobalNodeIdArrayName;
00343 int *GlobalNodeIdList;
00344
00345 vtkstd::map<int, int> *LocalNodeIdMap;
00346
00347 int GetNodeLocalId(int i);
00348 int WriteOutGlobalNodeIdArray;
00349
00350
00351
00352 char *BlockIdArrayName;
00353 int *BlockIdList;
00354 int WriteOutBlockIdArray;
00355
00356 int NumberOfElementBlocks;
00357 int *BlockIds;
00358
00359 vtkstd::map<int, int> *LocalBlockIndexMap;
00360
00361 int GetBlockLocalIndex(int i);
00362 int *BlockElementStart;
00363 int *ElementIndex;
00364
00365 char **BlockElementType;
00366 int *NumberOfElementsPerBlock;
00367 int *NumberOfNodesPerElementInBlock;
00368 int *NumberOfAttributesPerElementInBlock;
00369 float **BlockElementAttributesF;
00370 double **BlockElementAttributesD;
00371 int **BlockElementConnectivity;
00372
00373
00374
00375
00376 int *BlockElementVariableTruthTable;
00377 int AllVariablesDefinedInAllBlocks;
00378
00379 int BlockVariableTruthValue(int blockIdx, int varIdx);
00380
00381
00382
00383 int NumberOfScalarElementArrays;
00384 char **InputElementArrayNames;
00385 char **OutputElementArrayNames;
00386 int *InputElementArrayComponent;
00387
00388
00389
00390 int NumberOfScalarNodeArrays;
00391 char **InputNodeArrayNames;
00392 char **OutputNodeArrayNames;
00393 int *InputNodeArrayComponent;
00394
00395
00396
00397 int NumberOfProcesses;
00398 int MyRank;
00399
00400
00401
00402 vtkUnstructuredGrid *MyInput;
00403
00404
00405
00406 int GhostLevel;
00407
00408 int ErrorStatus;
00409 };
00410
00411 #endif