1 // -*- c++ -*- 2 /*========================================================================= 3 4 Program: Visualization Toolkit 5 Module: vtkPSLACReader.h 6 7 Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen 8 All rights reserved. 9 See Copyright.txt or http://www.kitware.com/Copyright.htm for details. 10 11 This software is distributed WITHOUT ANY WARRANTY; without even 12 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 13 PURPOSE. See the above copyright notice for more information. 14 15 =========================================================================*/ 16 17 /*------------------------------------------------------------------------- 18 Copyright 2008 Sandia Corporation. 19 Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, 20 the U.S. Government retains certain rights in this software. 21 -------------------------------------------------------------------------*/ 22 23 // .NAME vtkPSLACReader 24 // 25 // .SECTION Description 26 // 27 // Extends the vtkSLACReader to read in partitioned pieces. Due to the nature 28 // of the data layout, this reader only works in a data parallel mode where 29 // each process in a parallel job simultaneously attempts to read the piece 30 // corresponding to the local process id. 31 // 32 33 #ifndef vtkPSLACReader_h 34 #define vtkPSLACReader_h 35 36 #include "vtkIOParallelModule.h" // For export macro 37 #include "vtkSLACReader.h" 38 39 class vtkMultiProcessController; 40 41 class VTKIOPARALLEL_EXPORT vtkPSLACReader : public vtkSLACReader 42 { 43 public: 44 vtkTypeMacro(vtkPSLACReader, vtkSLACReader); 45 static vtkPSLACReader *New(); 46 virtual void PrintSelf(ostream &os, vtkIndent indent); 47 48 // Description: 49 // The controller used to communicate partition data. The number of pieces 50 // requested must agree with the number of processes, the piece requested must 51 // agree with the local process id, and all process must invoke 52 // ProcessRequests of this filter simultaneously. 53 vtkGetObjectMacro(Controller, vtkMultiProcessController); 54 virtual void SetController(vtkMultiProcessController *); 55 56 protected: 57 vtkPSLACReader(); 58 ~vtkPSLACReader(); 59 60 vtkMultiProcessController *Controller; 61 62 virtual int RequestInformation(vtkInformation *request, 63 vtkInformationVector **inputVector, 64 vtkInformationVector *outputVector); 65 66 virtual int RequestData(vtkInformation *request, 67 vtkInformationVector **inputVector, 68 vtkInformationVector *outputVector); 69 70 virtual int CheckTetrahedraWinding(int meshFD); 71 virtual int ReadConnectivity(int meshFD, vtkMultiBlockDataSet *surfaceOutput, 72 vtkMultiBlockDataSet *volumeOutput); 73 virtual int ReadCoordinates(int meshFD, vtkMultiBlockDataSet *output); 74 virtual int ReadMidpointCoordinates(int meshFD, vtkMultiBlockDataSet *output, 75 MidpointCoordinateMap &map); 76 virtual int ReadMidpointData(int meshFD, vtkMultiBlockDataSet *output, 77 MidpointIdMap &map); 78 virtual int RestoreMeshCache(vtkMultiBlockDataSet *surfaceOutput, 79 vtkMultiBlockDataSet *volumeOutput, 80 vtkMultiBlockDataSet *compositeOutput); 81 virtual int ReadFieldData(const int *modeFDArray, 82 int numModeFDs, 83 vtkMultiBlockDataSet *output); 84 85 virtual int ReadTetrahedronInteriorArray(int meshFD, 86 vtkIdTypeArray *connectivity); 87 virtual int ReadTetrahedronExteriorArray(int meshFD, 88 vtkIdTypeArray *connectivity); 89 90 virtual int MeshUpToDate(); 91 92 //BTX 93 // Description: 94 // Reads point data arrays. Called by ReadCoordinates and ReadFieldData. 95 virtual vtkSmartPointer<vtkDataArray> ReadPointDataArray(int ncFD, int varId); 96 //ETX 97 98 //BTX 99 class vtkInternal; 100 vtkInternal *Internal; 101 //ETX 102 103 // Description: 104 // The number of pieces and the requested piece to load. Synonymous with 105 // the number of processes and the local process id. 106 int NumberOfPieces; 107 int RequestedPiece; 108 109 // Description: 110 // The number of points defined in the mesh file. 111 vtkIdType NumberOfGlobalPoints; 112 113 // Description: 114 // The number of midpoints defined in the mesh file 115 vtkIdType NumberOfGlobalMidpoints; 116 117 // Description: 118 // The start/end points read by the given process. StartPointRead(int process)119 vtkIdType StartPointRead(int process) { 120 return process*(this->NumberOfGlobalPoints/this->NumberOfPieces + 1); 121 } EndPointRead(int process)122 vtkIdType EndPointRead(int process) { 123 vtkIdType result = this->StartPointRead(process+1); 124 if (result > this->NumberOfGlobalPoints) result=this->NumberOfGlobalPoints; 125 return result; 126 } 127 128 // Description: 129 // Piece information from the last call. 130 int NumberOfPiecesCache; 131 int RequestedPieceCache; 132 133 private: 134 vtkPSLACReader(const vtkPSLACReader &); // Not implemented 135 void operator=(const vtkPSLACReader &); // Not implemented 136 }; 137 138 #endif //vtkPSLACReader_h 139