Mesh Oriented datABase  (version 5.5.1)
An array-based unstructured mesh library
moab::UcdNCHelper Class Referenceabstract

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 ()
 
- Public Member Functions inherited from moab::NCHelper
 NCHelper (ReadNC *readNC, int fileId, const FileOptions &opts, EntityHandle fileSet)
 
virtual ~NCHelper ()
 
virtual ErrorCode init_mesh_vals ()=0
 Interfaces to be implemented in child classes. More...
 
virtual ErrorCode check_existing_mesh ()=0
 
virtual ErrorCode create_mesh (Range &faces)=0
 
virtual std::string get_mesh_type_name ()=0
 
ErrorCode create_conventional_tags (const std::vector< int > &tstep_nums)
 Create NC conventional tags. More...
 
ErrorCode update_time_tag_vals ()
 Update time tag values if timesteps spread across files. More...
 

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. More...
 
- Protected Member Functions inherited from moab::NCHelper
ErrorCode read_variables_setup (std::vector< std::string > &var_names, std::vector< int > &tstep_nums, std::vector< ReadNC::VarData > &vdatas, std::vector< ReadNC::VarData > &vsetdatas)
 Separate set and non-set variables (common to scd mesh and ucd mesh) More...
 
ErrorCode read_variables_to_set (std::vector< ReadNC::VarData > &vdatas, std::vector< int > &tstep_nums)
 Read set variables (common to scd mesh and ucd mesh) More...
 
ErrorCode read_coordinate (const char *var_name, int lmin, int lmax, std::vector< double > &cvals)
 
ErrorCode get_tag_to_set (ReadNC::VarData &var_data, int tstep_num, Tag &tagh)
 
ErrorCode get_tag_to_nonset (ReadNC::VarData &var_data, int tstep_num, Tag &tagh, int num_lev)
 
ErrorCode create_attrib_string (const std::map< std::string, ReadNC::AttData > &attMap, std::string &attString, std::vector< int > &attLen)
 Create a character string attString of attMap. with '\0' terminating each attribute name, ';' separating the data type and value, and ';' separating one name/data type/value from the next'. attLen stores the end position for each name/data type/ value. More...
 
ErrorCode create_dummy_variables ()
 For a dimension that does not have a corresponding coordinate variable (e.g. ncol for HOMME), create a dummy variable with a sparse tag to store the dimension length. More...
 

Protected Attributes

int nCells
 Dimensions of global grid in file. More...
 
int nEdges
 
int nVertices
 
int nLocalCells
 Dimensions of my local part of grid. More...
 
int nLocalEdges
 
int nLocalVertices
 
std::vector< double > xVertVals
 Coordinate values for vertices. More...
 
std::vector< double > yVertVals
 
std::vector< double > zVertVals
 
int cDim
 Dimension numbers for nCells, nEdges and nVertices. More...
 
int eDim
 
int vDim
 
Range localGidCells
 Local global ID for cells, edges and vertices. More...
 
Range localGidEdges
 
Range localGidVerts
 
- Protected Attributes inherited from moab::NCHelper
ReadNC_readNC
 Allow NCHelper to directly access members of ReadNC. More...
 
int _fileId
 Cache some information from ReadNC. More...
 
const FileOptions_opts
 
EntityHandle _fileSet
 
int nTimeSteps
 Dimensions of time and level. More...
 
int nLevels
 
std::vector< double > tVals
 Values for time and level. More...
 
std::vector< double > levVals
 
int tDim
 Dimension numbers for time and level. More...
 
int levDim
 
std::set< std::string > ignoredVarNames
 Ignored variables. More...
 
std::set< std::string > dummyVarNames
 Dummy variables. More...
 

Private Member Functions

virtual ErrorCode read_variables (std::vector< std::string > &var_names, std::vector< int > &tstep_nums)
 Implementation of NCHelper::read_variables() More...
 
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) More...
 
virtual ErrorCode read_ucd_variables_to_nonset (std::vector< ReadNC::VarData > &vdatas, std::vector< int > &tstep_nums)=0
 

Additional Inherited Members

- Static Public Member Functions inherited from moab::NCHelper
static ReadNC::NCFormatType get_nc_format (ReadNC *readNC, int fileId)
 Get appropriate format to read the file. More...
 
static std::string get_default_ncformat_options (ReadNC::NCFormatType format)
 Get appropriate format to read the file. More...
 
static NCHelperget_nc_helper (ReadNC *readNC, int fileId, const FileOptions &opts, EntityHandle fileSet)
 Get appropriate helper instance for ReadNC class. More...
 

Detailed Description

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

Definition at line 209 of file NCHelper.hpp.

Constructor & Destructor Documentation

◆ UcdNCHelper()

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

Definition at line 212 of file NCHelper.hpp.

213  : NCHelper( readNC, fileId, opts, fileSet ), nCells( 0 ), nEdges( 0 ), nVertices( 0 ), nLocalCells( 0 ),
214  nLocalEdges( 0 ), nLocalVertices( 0 ), cDim( -1 ), eDim( -1 ), vDim( -1 )
215  {
216  }

◆ ~UcdNCHelper()

virtual moab::UcdNCHelper::~UcdNCHelper ( )
inlinevirtual

Definition at line 217 of file NCHelper.hpp.

217 {}

Member Function Documentation

◆ kji_to_jik_stride()

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

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

239  {
240  std::size_t idxInSource = 0; // Position of the start of the stride
241  // For each subrange, we will transpose a matrix of size
242  // subrange*nj*nk (subrange takes the role of ni)
243  T* tmp_data = reinterpret_cast< T* >( dest );
244  for( Range::pair_iterator pair_iter = localGid.pair_begin(); pair_iter != localGid.pair_end(); ++pair_iter )
245  {
246  std::size_t size_range = pair_iter->second - pair_iter->first + 1;
247  std::size_t nik = size_range * nk, nij = size_range * nj;
248  for( std::size_t j = 0; j != nj; j++ )
249  for( std::size_t i = 0; i != size_range; i++ )
250  for( std::size_t k = 0; k != nk; k++ )
251  tmp_data[idxInSource + j * nik + i * nk + k] =
252  source[idxInSource + k * nij + j * size_range + i];
253  idxInSource += ( size_range * nj * nk );
254  }
255  }

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

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

◆ read_ucd_variables_to_nonset()

virtual ErrorCode moab::UcdNCHelper::read_ucd_variables_to_nonset ( std::vector< ReadNC::VarData > &  vdatas,
std::vector< int > &  tstep_nums 
)
privatepure virtual

◆ read_ucd_variables_to_nonset_allocate()

virtual ErrorCode moab::UcdNCHelper::read_ucd_variables_to_nonset_allocate ( std::vector< ReadNC::VarData > &  vdatas,
std::vector< int > &  tstep_nums 
)
privatepure virtual

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

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

◆ read_variables()

ErrorCode moab::UcdNCHelper::read_variables ( std::vector< std::string > &  var_names,
std::vector< int > &  tstep_nums 
)
privatevirtual

Implementation of NCHelper::read_variables()

Implements moab::NCHelper.

Definition at line 1411 of file NCHelper.cpp.

1412 {
1413  std::vector< ReadNC::VarData > vdatas;
1414  std::vector< ReadNC::VarData > vsetdatas;
1415 
1416  ErrorCode rval = read_variables_setup( var_names, tstep_nums, vdatas, vsetdatas );MB_CHK_SET_ERR( rval, "Trouble setting up to read variables" );
1417 
1418  if( !vsetdatas.empty() )
1419  {
1420  rval = read_variables_to_set( vsetdatas, tstep_nums );MB_CHK_SET_ERR( rval, "Trouble reading variables to set" );
1421  }
1422 
1423  if( !vdatas.empty() )
1424  {
1425 #ifdef MOAB_HAVE_PNETCDF
1426  // With pnetcdf support, we will use async read
1427  rval = read_ucd_variables_to_nonset_async( vdatas, tstep_nums );MB_CHK_SET_ERR( rval, "Trouble reading variables to verts/edges/faces" );
1428 #else
1429  // Without pnetcdf support, we will use old read
1430  rval = read_ucd_variables_to_nonset( vdatas, tstep_nums );MB_CHK_SET_ERR( rval, "Trouble reading variables to verts/edges/faces" );
1431 #endif
1432  }
1433 
1434  return MB_SUCCESS;
1435 }

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().

Member Data Documentation

◆ cDim

int moab::UcdNCHelper::cDim
protected

Dimension numbers for nCells, nEdges and nVertices.

Definition at line 271 of file NCHelper.hpp.

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

◆ eDim

int moab::UcdNCHelper::eDim
protected

◆ localGidCells

◆ localGidEdges

◆ localGidVerts

◆ nCells

◆ nEdges

◆ nLocalCells

◆ nLocalEdges

◆ nLocalVertices

◆ nVertices

◆ vDim

◆ xVertVals

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

Coordinate values for vertices.

Definition at line 268 of file NCHelper.hpp.

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

◆ yVertVals

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

◆ zVertVals

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

Definition at line 268 of file NCHelper.hpp.


The documentation for this class was generated from the following files: