1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
//-------------------------------------------------------------------------
// Filename      : NCHelperMPAS.hpp
//
// Purpose       : Climate NC file helper for MPAS grid
//
// Creator       : Danqing Wu
//-------------------------------------------------------------------------

#ifndef NCHELPERMPAS_HPP
#define NCHELPERMPAS_HPP

#include "NCHelper.hpp"

namespace moab
{

//! Child helper class for MPAS grid
class NCHelperMPAS : public UcdNCHelper
{
  public:
    NCHelperMPAS( ReadNC* readNC, int fileId, const FileOptions& opts, EntityHandle fileSet );
    static bool can_read_file( ReadNC* readNC );

  private:
    //! Implementation of NCHelper::init_mesh_vals()
    virtual ErrorCode init_mesh_vals();<--- Function in derived class<--- Function in derived class
    //! Implementation of NCHelper::check_existing_mesh()
    virtual ErrorCode check_existing_mesh();<--- Function in derived class<--- Function in derived class
    //! Implementation of NCHelper::create_mesh()
    virtual ErrorCode create_mesh( Range& faces );<--- Function in derived class<--- Function in derived class
    //! Implementation of NCHelper::get_mesh_type_name()
    virtual std::string get_mesh_type_name()<--- Function in derived class<--- Function in derived class
    {
        return "MPAS";
    }

    //! Implementation of UcdNCHelper::read_ucd_variables_to_nonset_allocate()
    virtual ErrorCode read_ucd_variables_to_nonset_allocate( std::vector< ReadNC::VarData >& vdatas,<--- Function in derived class<--- Function in derived class
                                                             std::vector< int >& tstep_nums );
#ifdef MOAB_HAVE_PNETCDF
    //! Implementation of UcdNCHelper::read_ucd_variables_to_nonset_async()
    virtual ErrorCode read_ucd_variables_to_nonset_async( std::vector< ReadNC::VarData >& vdatas,
                                                          std::vector< int >& tstep_nums );
#else
    //! Implementation of UcdNCHelper::read_ucd_variables_to_nonset()
    virtual ErrorCode read_ucd_variables_to_nonset( std::vector< ReadNC::VarData >& vdatas,<--- Function in derived class<--- Function in derived class
                                                    std::vector< int >& tstep_nums );
#endif

#ifdef MOAB_HAVE_MPI
    //! Redistribute local cells after trivial partition (e.g. Zoltan partition, if applicable)
    ErrorCode redistribute_local_cells( int start_cell_index );
#endif

    //! Create local vertices
    ErrorCode create_local_vertices( const std::vector< int >& vertices_on_local_cells, EntityHandle& start_vertex );

    //! Create local edges (optional)
    ErrorCode create_local_edges( EntityHandle start_vertex, const std::vector< int >& num_edges_on_local_cells );

    //! Create local cells without padding (cells are divided into groups based on the number of
    //! edges)
    ErrorCode create_local_cells( const std::vector< int >& vertices_on_local_cells,
                                  const std::vector< int >& num_edges_on_local_cells,
                                  EntityHandle start_vertex,
                                  Range& faces );

    //! Create local cells with padding (padded cells will have the same number of edges)
    ErrorCode create_padded_local_cells( const std::vector< int >& vertices_on_local_cells,
                                         EntityHandle start_vertex,
                                         Range& faces );

    //! Create gather set vertices
    ErrorCode create_gather_set_vertices( EntityHandle gather_set, EntityHandle& gather_set_start_vertex );

    //! Create gather set edges (optional)
    ErrorCode create_gather_set_edges( EntityHandle gather_set, EntityHandle gather_set_start_vertex );

    //! Create gather set cells without padding (cells are divided into groups based on the number
    //! of edges)
    ErrorCode create_gather_set_cells( EntityHandle gather_set, EntityHandle gather_set_start_vertex );

    //! Create gather set cells with padding (padded cells will have the same number of edges)
    ErrorCode create_padded_gather_set_cells( EntityHandle gather_set, EntityHandle gather_set_start_vertex );

  private:
    int maxEdgesPerCell;
    int numCellGroups;
    bool createGatherSet;
    std::map< EntityHandle, int > cellHandleToGlobalID;
    Range facesOwned;
};

}  // namespace moab

#endif