Mesh Oriented datABase  (version 5.4.1)
Array-based unstructured mesh datastructure
moab::UcdNCHelper Class Reference

Child helper class for ucd mesh, e.g. CAM_SE (HOMME) or MPAS. More...

#include <NCHelper.hpp>

+ Inheritance diagram for moab::UcdNCHelper:
+ Collaboration diagram for moab::UcdNCHelper:

Public Member Functions

 UcdNCHelper (ReadNC *readNC, int fileId, const FileOptions &opts, EntityHandle fileSet)
virtual ~UcdNCHelper ()

Protected Member Functions

template<typename T >
void kji_to_jik_stride (size_t, size_t nj, size_t nk, void *dest, T *source, Range &localGid)
 This version takes as input the moab range, from which we actually need just the size of each sequence, for a proper transpose of the data.

Protected Attributes

int nCells
 Dimensions of global grid in file.
int nEdges
int nVertices
int nLocalCells
 Dimensions of my local part of grid.
int nLocalEdges
int nLocalVertices
std::vector< double > xVertVals
 Coordinate values for vertices.
std::vector< double > yVertVals
std::vector< double > zVertVals
int cDim
 Dimension numbers for nCells, nEdges and nVertices.
int eDim
int vDim
Range localGidCells
 Local global ID for cells, edges and vertices.
Range localGidEdges
Range localGidVerts

Private Member Functions

virtual ErrorCode read_variables (std::vector< std::string > &var_names, std::vector< int > &tstep_nums)
 Implementation of NCHelper::read_variables()
virtual ErrorCode read_ucd_variables_to_nonset_allocate (std::vector< ReadNC::VarData > &vdatas, std::vector< int > &tstep_nums)=0
 Read non-set variables for ucd mesh (implemented differently in child classes)
virtual ErrorCode read_ucd_variables_to_nonset (std::vector< ReadNC::VarData > &vdatas, std::vector< int > &tstep_nums)=0

Detailed Description

Child helper class for ucd mesh, e.g. CAM_SE (HOMME) or MPAS.

Definition at line 203 of file NCHelper.hpp.


Constructor & Destructor Documentation

moab::UcdNCHelper::UcdNCHelper ( ReadNC readNC,
int  fileId,
const FileOptions opts,
EntityHandle  fileSet 
) [inline]

Definition at line 206 of file NCHelper.hpp.

        : NCHelper( readNC, fileId, opts, fileSet ), nCells( 0 ), nEdges( 0 ), nVertices( 0 ), nLocalCells( 0 ),
          nLocalEdges( 0 ), nLocalVertices( 0 ), cDim( -1 ), eDim( -1 ), vDim( -1 )
    {
    }
virtual moab::UcdNCHelper::~UcdNCHelper ( ) [inline, virtual]

Definition at line 211 of file NCHelper.hpp.

{}

Member Function Documentation

template<typename T >
void moab::UcdNCHelper::kji_to_jik_stride ( size_t  ,
size_t  nj,
size_t  nk,
void *  dest,
T source,
Range localGid 
) [inline, protected]

This version takes as input the moab range, from which we actually need just the size of each sequence, for a proper transpose of the data.

Definition at line 232 of file NCHelper.hpp.

References moab::Range::pair_begin(), moab::Range::pair_end(), and T.

Referenced by moab::NCHelperHOMME::read_ucd_variables_to_nonset().

    {
        std::size_t idxInSource = 0;  // Position of the start of the stride
        // For each subrange, we will transpose a matrix of size
        // subrange*nj*nk (subrange takes the role of ni)
        T* tmp_data = reinterpret_cast< T* >( dest );
        for( Range::pair_iterator pair_iter = localGid.pair_begin(); pair_iter != localGid.pair_end(); ++pair_iter )
        {
            std::size_t size_range = pair_iter->second - pair_iter->first + 1;
            std::size_t nik = size_range * nk, nij = size_range * nj;
            for( std::size_t j = 0; j != nj; j++ )
                for( std::size_t i = 0; i != size_range; i++ )
                    for( std::size_t k = 0; k != nk; k++ )
                        tmp_data[idxInSource + j * nik + i * nk + k] =
                            source[idxInSource + k * nij + j * size_range + i];
            idxInSource += ( size_range * nj * nk );
        }
    }
virtual ErrorCode moab::UcdNCHelper::read_ucd_variables_to_nonset ( std::vector< ReadNC::VarData > &  vdatas,
std::vector< int > &  tstep_nums 
) [private, pure virtual]
virtual ErrorCode moab::UcdNCHelper::read_ucd_variables_to_nonset_allocate ( std::vector< ReadNC::VarData > &  vdatas,
std::vector< int > &  tstep_nums 
) [private, pure virtual]

Read non-set variables for ucd mesh (implemented differently in child classes)

Implemented in moab::NCHelperGCRM, moab::NCHelperMPAS, and moab::NCHelperHOMME.

ErrorCode moab::UcdNCHelper::read_variables ( std::vector< std::string > &  var_names,
std::vector< int > &  tstep_nums 
) [private, virtual]

Implementation of NCHelper::read_variables()

Implements moab::NCHelper.

Definition at line 1325 of file NCHelper.cpp.

References ErrorCode, MB_CHK_SET_ERR, MB_SUCCESS, read_ucd_variables_to_nonset(), moab::NCHelper::read_variables_setup(), and moab::NCHelper::read_variables_to_set().

{
    std::vector< ReadNC::VarData > vdatas;
    std::vector< ReadNC::VarData > vsetdatas;

    ErrorCode rval = read_variables_setup( var_names, tstep_nums, vdatas, vsetdatas );MB_CHK_SET_ERR( rval, "Trouble setting up to read variables" );

    if( !vsetdatas.empty() )
    {
        rval = read_variables_to_set( vsetdatas, tstep_nums );MB_CHK_SET_ERR( rval, "Trouble reading variables to set" );
    }

    if( !vdatas.empty() )
    {
#ifdef MOAB_HAVE_PNETCDF
        // With pnetcdf support, we will use async read
        rval = read_ucd_variables_to_nonset_async( vdatas, tstep_nums );MB_CHK_SET_ERR( rval, "Trouble reading variables to verts/edges/faces" );
#else
        // Without pnetcdf support, we will use old read
        rval = read_ucd_variables_to_nonset( vdatas, tstep_nums );MB_CHK_SET_ERR( rval, "Trouble reading variables to verts/edges/faces" );
#endif
    }

    return MB_SUCCESS;
}

Member Data Documentation

int moab::UcdNCHelper::cDim [protected]

Dimension numbers for nCells, nEdges and nVertices.

Definition at line 265 of file NCHelper.hpp.

Referenced by moab::NCHelperGCRM::init_mesh_vals(), and moab::NCHelperMPAS::init_mesh_vals().

Local global ID for cells, edges and vertices.

Definition at line 268 of file NCHelper.hpp.

Definition at line 268 of file NCHelper.hpp.

Dimensions of my local part of grid.

Definition at line 257 of file NCHelper.hpp.

Definition at line 258 of file NCHelper.hpp.

std::vector< double > moab::UcdNCHelper::xVertVals [protected]

Coordinate values for vertices.

Definition at line 262 of file NCHelper.hpp.

Referenced by moab::NCHelperHOMME::create_mesh(), and moab::NCHelperHOMME::init_mesh_vals().

std::vector< double > moab::UcdNCHelper::yVertVals [protected]
std::vector< double > moab::UcdNCHelper::zVertVals [protected]

Definition at line 262 of file NCHelper.hpp.

List of all members.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines