00001 #ifndef HDF5ParallelReader_H 00002 #define HDF5ParallelReader_H 00003 00004 #include <sys/times.h> 00005 #include <unistd.h> 00006 #include <string> 00007 00008 #include <iostream> 00009 #include <fstream> 00010 #include <stdexcept> 00011 #include "assert.h" 00012 #include "hdf5.h" 00013 #include "parmetis.h" 00014 #include "entity.h" 00015 #include "tetmeshbuilder.h" 00016 #include "pbedefs.h" 00017 00018 #define REALMEMTYPE H5T_NATIVE_DOUBLE 00019 #define INTMEMTYPE H5T_NATIVE_INT 00020 00021 using namespace std; 00022 00023 class HDF5ParallelReader { 00024 00025 public: 00026 00028 ~HDF5ParallelReader(); 00029 00034 HDF5ParallelReader(const char* inputFile, MeshBuilder* builder, MPI_Comm comm); 00035 00037 void read(); 00038 00040 void export_dist(char* file); 00041 00043 int main (int argc, char **argv); 00044 00045 private: 00046 00048 double seconds(); 00049 00051 void print_tet_global_id(); 00052 00054 void read_tets(); 00055 00057 void read_mats(); 00058 00060 void partition(); 00061 00067 void sort_buffer(int* sendcnts); 00068 00070 void distribute(); 00071 00077 void generate_point_global_id(int* slab_offsets, int* slab_lengths, int slab_count); 00078 00080 void read_points(); 00081 00083 void read_boundary(); 00084 00086 void open_file(); 00087 00089 void close_file(); 00090 00091 00092 private: // Private attributes 00093 00095 const char* _inputFile; 00096 00098 MeshBuilder* _builder; 00099 00101 MPI_Comm _comm; 00102 00104 MPI_Info _info; 00105 00107 int _mpi_size; 00108 00110 int _mpi_rank; 00111 00113 double* _point_coords; 00114 00116 int _numpoints_global; 00117 00119 int _numpoints_local; 00120 00122 int* _tetids; 00123 00125 int _numtets_global; 00126 00128 int _numtets_local; 00129 00131 int* _matids; 00132 00134 int* _faces; 00135 00137 int _numbfaces_global; 00138 00140 int _numbfaces_local; 00141 00143 int* _tet_partition; 00144 00146 int* _tet_global_id; 00147 00149 int* _point_global_id; 00150 00152 hid_t _file_id; 00153 00155 hid_t _plist_id; 00156 00157 }; 00158 00159 #endif