Mesh Oriented datABase  (version 5.5.1)
An array-based unstructured mesh library
NCHelperMPAS.hpp
Go to the documentation of this file.
1 //-------------------------------------------------------------------------
2 // Filename : NCHelperMPAS.hpp
3 //
4 // Purpose : Climate NC file helper for MPAS grid
5 //
6 // Creator : Danqing Wu
7 //-------------------------------------------------------------------------
8 
9 #ifndef NCHELPERMPAS_HPP
10 #define NCHELPERMPAS_HPP
11 
12 #include "NCHelper.hpp"
13 
14 namespace moab
15 {
16 #ifdef MOAB_HAVE_MPI
17 class ParallelComm;
18 #endif
19 //! Child helper class for MPAS grid
20 class NCHelperMPAS : public UcdNCHelper
21 {
22  public:
23  NCHelperMPAS( ReadNC* readNC, int fileId, const FileOptions& opts, EntityHandle fileSet );
24  static bool can_read_file( ReadNC* readNC );
25 
26  private:
27  //! Implementation of NCHelper::init_mesh_vals()
28  virtual ErrorCode init_mesh_vals();
29  //! Implementation of NCHelper::check_existing_mesh()
31  //! Implementation of NCHelper::create_mesh()
32  virtual ErrorCode create_mesh( Range& faces );
33  //! Implementation of NCHelper::get_mesh_type_name()
34  virtual std::string get_mesh_type_name()
35  {
36  return "MPAS";
37  }
38 
39  //! Implementation of UcdNCHelper::read_ucd_variables_to_nonset_allocate()
40  virtual ErrorCode read_ucd_variables_to_nonset_allocate( std::vector< ReadNC::VarData >& vdatas,
41  std::vector< int >& tstep_nums );
42 #ifdef MOAB_HAVE_PNETCDF
43  //! Implementation of UcdNCHelper::read_ucd_variables_to_nonset_async()
44  virtual ErrorCode read_ucd_variables_to_nonset_async( std::vector< ReadNC::VarData >& vdatas,
45  std::vector< int >& tstep_nums );
46 #else
47  //! Implementation of UcdNCHelper::read_ucd_variables_to_nonset()
48  virtual ErrorCode read_ucd_variables_to_nonset( std::vector< ReadNC::VarData >& vdatas,
49  std::vector< int >& tstep_nums );
50 #endif
51 
52 #ifdef MOAB_HAVE_MPI
53  //! Redistribute local cells after trivial partition (e.g. Zoltan partition, if applicable)
54  ErrorCode redistribute_local_cells( int start_cell_index, ParallelComm* pco );
55 #endif
56 
57  //! Create local vertices
58  ErrorCode create_local_vertices( const std::vector< int >& vertices_on_local_cells, EntityHandle& start_vertex );
59 
60  //! Create local edges (optional)
61  ErrorCode create_local_edges( EntityHandle start_vertex, const std::vector< int >& num_edges_on_local_cells );
62 
63  //! Create local cells without padding (cells are divided into groups based on the number of
64  //! edges)
65  ErrorCode create_local_cells( const std::vector< int >& vertices_on_local_cells,
66  const std::vector< int >& num_edges_on_local_cells,
67  EntityHandle start_vertex,
68  Range& faces );
69 
70  //! Create local cells with padding (padded cells will have the same number of edges)
71  ErrorCode create_padded_local_cells( const std::vector< int >& vertices_on_local_cells,
72  EntityHandle start_vertex,
73  Range& faces );
74 
75  //! Create gather set vertices
76  ErrorCode create_gather_set_vertices( EntityHandle gather_set, EntityHandle& gather_set_start_vertex );
77 
78  //! Create gather set edges (optional)
79  ErrorCode create_gather_set_edges( EntityHandle gather_set, EntityHandle gather_set_start_vertex );
80 
81  //! Create gather set cells without padding (cells are divided into groups based on the number
82  //! of edges)
83  ErrorCode create_gather_set_cells( EntityHandle gather_set, EntityHandle gather_set_start_vertex );
84 
85  //! Create gather set cells with padding (padded cells will have the same number of edges)
86  ErrorCode create_padded_gather_set_cells( EntityHandle gather_set, EntityHandle gather_set_start_vertex );
87 
88  private:
92  std::map< EntityHandle, int > cellHandleToGlobalID;
94 };
95 
96 } // namespace moab
97 
98 #endif