Mesh Oriented datABase  (version 5.6.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  private:
25  //! Implementation of NCHelper::init_mesh_vals()
26  virtual ErrorCode init_mesh_vals();
27 
28  //! Implementation of NCHelper::create_mesh()
29  virtual ErrorCode create_mesh( Range& faces );
30  //! Implementation of NCHelper::get_mesh_type_name()
31  virtual std::string get_mesh_type_name()
32  {
33  return "ESMF";
34  }
35 
36 #ifdef MOAB_HAVE_MPI
37  //! Redistribute local cells after trivial partition (e.g. Zoltan partition, if applicable)
38  ErrorCode redistribute_local_cells( int start_cell_index, ParallelComm* pco );
39 #endif
40 
41  //! Create local vertices
42  ErrorCode create_local_vertices( const std::vector< int >& vertices_on_local_cells, EntityHandle& start_vertex );
43 
44  //! Create local cells without padding (cells are divided into groups based on the number of
45  //! edges)
46  ErrorCode create_local_cells( const std::vector< int >& vertices_on_local_cells,
47  const std::vector< int >& num_edges_on_local_cells,
48  EntityHandle start_vertex,
49  Range& faces );
50 
51  //! Create local cells with padding (padded cells will have the same number of edges)
52  ErrorCode create_padded_local_cells( const std::vector< int >& vertices_on_local_cells,
53  EntityHandle start_vertex,
54  Range& faces );
55 
57  {
58  return MB_SUCCESS;
59  }
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_ */