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