moab
|
00001 //------------------------------------------------------------------------- 00002 // Filename : NCHelperMPAS.hpp 00003 // 00004 // Purpose : Climate NC file helper for MPAS grid 00005 // 00006 // Creator : Danqing Wu 00007 //------------------------------------------------------------------------- 00008 00009 #ifndef NCHELPERMPAS_HPP 00010 #define NCHELPERMPAS_HPP 00011 00012 #include "NCHelper.hpp" 00013 00014 namespace moab { 00015 00017 class NCHelperMPAS : public UcdNCHelper 00018 { 00019 public: 00020 NCHelperMPAS(ReadNC* readNC, int fileId, const FileOptions& opts, EntityHandle fileSet); 00021 static bool can_read_file(ReadNC* readNC); 00022 00023 private: 00025 virtual ErrorCode init_mesh_vals(); 00027 virtual ErrorCode check_existing_mesh(); 00029 virtual ErrorCode create_mesh(Range& faces); 00031 virtual std::string get_mesh_type_name() { return "MPAS"; } 00032 00034 virtual ErrorCode read_ucd_variable_to_nonset_allocate(std::vector<ReadNC::VarData>& vdatas, 00035 std::vector<int>& tstep_nums); 00036 #ifdef PNETCDF_FILE 00037 00038 virtual ErrorCode read_ucd_variable_to_nonset_async(std::vector<ReadNC::VarData>& vdatas, 00039 std::vector<int>& tstep_nums); 00040 #else 00041 00042 virtual ErrorCode read_ucd_variable_to_nonset(std::vector<ReadNC::VarData>& vdatas, 00043 std::vector<int>& tstep_nums); 00044 #endif 00045 00047 ErrorCode redistribute_local_cells(int start_cell_index); 00048 00050 ErrorCode create_local_vertices(const std::vector<int>& vertices_on_local_cells, EntityHandle& start_vertex); 00051 00053 ErrorCode create_local_edges(EntityHandle start_vertex, const std::vector<int>& num_edges_on_local_cells); 00054 00056 ErrorCode create_local_cells(const std::vector<int>& vertices_on_local_cells, 00057 const std::vector<int>& num_edges_on_local_cells, 00058 EntityHandle start_vertex, Range& faces); 00059 00061 ErrorCode create_padded_local_cells(const std::vector<int>& vertices_on_local_cells, 00062 EntityHandle start_vertex, Range& faces); 00063 00065 ErrorCode create_gather_set_vertices(EntityHandle gather_set, EntityHandle& gather_set_start_vertex); 00066 00068 ErrorCode create_gather_set_edges(EntityHandle gather_set, EntityHandle gather_set_start_vertex); 00069 00071 ErrorCode create_gather_set_cells(EntityHandle gather_set, EntityHandle gather_set_start_vertex); 00072 00074 ErrorCode create_padded_gather_set_cells(EntityHandle gather_set, EntityHandle gather_set_start_vertex); 00075 00076 private: 00077 int maxEdgesPerCell; 00078 int numCellGroups; 00079 bool createGatherSet; 00080 std::map<EntityHandle, int> cellHandleToGlobalID; 00081 Range facesOwned; 00082 }; 00083 00084 } // namespace moab 00085 00086 #endif