Mesh Oriented datABase  (version 5.6.0)
An array-based unstructured mesh library
moab::UcdNCWriteHelper Class Reference

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

#include <NCWriteHelper.hpp>

+ Inheritance diagram for moab::UcdNCWriteHelper:
+ Collaboration diagram for moab::UcdNCWriteHelper:

Public Member Functions

 UcdNCWriteHelper (WriteNC *writeNC, int fileId, const FileOptions &opts, EntityHandle fileSet)
 
virtual ~UcdNCWriteHelper () override
 
- Public Member Functions inherited from moab::NCWriteHelper
 NCWriteHelper (WriteNC *writeNC, int fileId, const FileOptions &opts, EntityHandle fileSet)
 
virtual ~NCWriteHelper ()
 
virtual ErrorCode collect_mesh_info ()=0
 Collect necessary info about local mesh (implemented in child classes) More...
 
virtual ErrorCode collect_variable_data (std::vector< std::string > &var_names, std::vector< int > &tstep_nums)
 Collect data for specified variables (partially implemented in child classes) More...
 
virtual ErrorCode init_file (std::vector< std::string > &var_names, std::vector< std::string > &desired_names, bool _append)
 Initialize file: this is where all defines are done. Virtual so that grid-output writers (NCWriteScrip / NCWriteESMF / NCWriteDomain) can synthesize a fresh schema from mesh state instead of going through the climate var_names plumbing. More...
 
virtual ErrorCode write_values (std::vector< std::string > &var_names, std::vector< int > &tstep_nums)
 Take the info from VarData and write first non-set variables, then set variables. Virtual for the same reason as init_file. More...
 

Static Protected Member Functions

template<typename T >
static void jik_to_kji_stride (size_t, size_t nj, size_t nk, T *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 Attributes

int cDim
 Dimension numbers for nCells, nEdges and nVertices. More...
 
int eDim
 
int vDim
 
Range localGidCellsOwned
 Local global ID for owned cells, edges and vertices. More...
 
Range localGidEdgesOwned
 
Range localGidVertsOwned
 
- Protected Attributes inherited from moab::NCWriteHelper
WriteNC * _writeNC
 Allow NCWriteHelper to directly access members of WriteNC. More...
 
int _fileId
 Cache some information from WriteNC. More...
 
const FileOptions & _opts
 
EntityHandle _fileSet
 
int nTimeSteps
 Dimensions of time and level. More...
 
int nLevels
 
int tDim
 Dimension numbers for time and level. More...
 
int levDim
 
Range localCellsOwned
 Local owned cells, edges and vertices. More...
 
Range localEdgesOwned
 
Range localVertsOwned
 
std::vector< double > timeStepVals
 Time values of output timesteps. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from moab::NCWriteHelper
static NCWriteHelper * get_nc_helper (WriteNC *writeNC, int fileId, const FileOptions &opts, EntityHandle fileSet)
 Get appropriate helper instance for WriteNC class based on some info in the file set. More...
 
- Protected Member Functions inherited from moab::NCWriteHelper
virtual ErrorCode write_nonset_variables (std::vector< WriteNC::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 127 of file NCWriteHelper.hpp.

Constructor & Destructor Documentation

◆ UcdNCWriteHelper()

moab::UcdNCWriteHelper::UcdNCWriteHelper ( WriteNC *  writeNC,
int  fileId,
const FileOptions &  opts,
EntityHandle  fileSet 
)
inline

Definition at line 130 of file NCWriteHelper.hpp.

131  : NCWriteHelper( writeNC, fileId, opts, fileSet ), cDim( -1 ), eDim( -1 ), vDim( -1 )
132  {
133  }

◆ ~UcdNCWriteHelper()

virtual moab::UcdNCWriteHelper::~UcdNCWriteHelper ( )
inlineoverridevirtual

Definition at line 134 of file NCWriteHelper.hpp.

134 {}

Member Function Documentation

◆ jik_to_kji_stride()

template<typename T >
static void moab::UcdNCWriteHelper::jik_to_kji_stride ( size_t  ,
size_t  nj,
size_t  nk,
T *  dest,
T *  source,
Range &  localGid 
)
inlinestaticprotected

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 140 of file NCWriteHelper.hpp.

141  {
142  std::size_t idxInSource = 0; // Position of the start of the stride
143  // For each subrange, we will transpose a matrix of size
144  // subrange*nj*nk (subrange takes the role of ni)
145  for( Range::pair_iterator pair_iter = localGid.pair_begin(); pair_iter != localGid.pair_end(); ++pair_iter )
146  {
147  std::size_t size_range = pair_iter->second - pair_iter->first + 1;
148  std::size_t nik = size_range * nk, nij = size_range * nj;
149  for( std::size_t k = 0; k != nk; k++ )
150  for( std::size_t j = 0; j != nj; j++ )
151  for( std::size_t i = 0; i != size_range; i++ )
152  dest[idxInSource + k * nij + j * size_range + i] = source[idxInSource + j * nik + i * nk + k];
153  idxInSource += ( size_range * nj * nk );
154  }
155  }

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

Referenced by moab::NCWriteHOMME::write_nonset_variables().

Member Data Documentation

◆ cDim

int moab::UcdNCWriteHelper::cDim
protected

Dimension numbers for nCells, nEdges and nVertices.

Definition at line 158 of file NCWriteHelper.hpp.

◆ eDim

int moab::UcdNCWriteHelper::eDim
protected

Definition at line 158 of file NCWriteHelper.hpp.

◆ localGidCellsOwned

◆ localGidEdgesOwned

◆ localGidVertsOwned

◆ vDim

int moab::UcdNCWriteHelper::vDim
protected

Definition at line 158 of file NCWriteHelper.hpp.


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