moab
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:
moab::NCHelper moab::NCHelperHOMME moab::NCHelperMPAS

List of all members.

Public Member Functions

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

Protected Member Functions

template<typename T >
ErrorCode kji_to_jik_stride (size_t, size_t nj, size_t nk, void *dest, T *source, Range &localGid)

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_variable_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_variable_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 181 of file NCHelper.hpp.


Constructor & Destructor Documentation

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

Definition at line 184 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 189 of file NCHelper.hpp.

{}

Member Function Documentation

template<typename T >
ErrorCode 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 210 of file NCHelper.hpp.

  {
    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);
    }
    return MB_SUCCESS;
  }
virtual ErrorCode moab::UcdNCHelper::read_ucd_variable_to_nonset ( std::vector< ReadNC::VarData > &  vdatas,
std::vector< int > &  tstep_nums 
) [private, pure virtual]
virtual ErrorCode moab::UcdNCHelper::read_ucd_variable_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::NCHelperHOMME, and moab::NCHelperMPAS.

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 1348 of file NCHelper.cpp.

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

  ErrorCode rval = read_variable_setup(var_names, tstep_nums, vdatas, vsetdatas);
  ERRORR(rval, "Trouble setting up read variable.");

  if (!vsetdatas.empty()) {
    rval = read_variable_to_set(vsetdatas, tstep_nums);
    ERRORR(rval, "Trouble read variables to set.");
  }

  if (!vdatas.empty()) {
#ifdef PNETCDF_FILE
    // With pnetcdf support, we will use async read
    rval = read_ucd_variable_to_nonset_async(vdatas, tstep_nums);
#else
    // Without pnetcdf support, we will use old read
    rval = read_ucd_variable_to_nonset(vdatas, tstep_nums);
#endif
    ERRORR(rval, "Trouble read variables to entities verts/edges/faces.");
  }

  return MB_SUCCESS;
}

Member Data Documentation

int moab::UcdNCHelper::cDim [protected]

Dimension numbers for nCells, nEdges and nVertices.

Definition at line 243 of file NCHelper.hpp.

int moab::UcdNCHelper::eDim [protected]

Definition at line 243 of file NCHelper.hpp.

Local global ID for cells, edges and vertices.

Definition at line 246 of file NCHelper.hpp.

Definition at line 246 of file NCHelper.hpp.

Definition at line 246 of file NCHelper.hpp.

int moab::UcdNCHelper::nCells [protected]

Dimensions of global grid in file.

Definition at line 230 of file NCHelper.hpp.

int moab::UcdNCHelper::nEdges [protected]

Definition at line 231 of file NCHelper.hpp.

Dimensions of my local part of grid.

Definition at line 235 of file NCHelper.hpp.

Definition at line 236 of file NCHelper.hpp.

Definition at line 237 of file NCHelper.hpp.

Definition at line 232 of file NCHelper.hpp.

int moab::UcdNCHelper::vDim [protected]

Definition at line 243 of file NCHelper.hpp.

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

Coordinate values for vertices.

Definition at line 240 of file NCHelper.hpp.

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

Definition at line 240 of file NCHelper.hpp.

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

Definition at line 240 of file NCHelper.hpp.


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