Mesh Oriented datABase  (version 5.5.1)
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 ()
 
- 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...
 
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 The VarData dimension ids are filled up after define. More...
 
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. More...
 

Protected Member Functions

template<typename T >
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 Member Functions inherited from moab::NCWriteHelper
virtual ErrorCode write_nonset_variables (std::vector< WriteNC::VarData > &vdatas, std::vector< int > &tstep_nums)=0
 

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 NCWriteHelperget_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...
 

Detailed Description

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

Definition at line 124 of file NCWriteHelper.hpp.

Constructor & Destructor Documentation

◆ UcdNCWriteHelper()

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

Definition at line 127 of file NCWriteHelper.hpp.

128  : NCWriteHelper( writeNC, fileId, opts, fileSet ), cDim( -1 ), eDim( -1 ), vDim( -1 )
129  {
130  }

◆ ~UcdNCWriteHelper()

virtual moab::UcdNCWriteHelper::~UcdNCWriteHelper ( )
inlinevirtual

Definition at line 131 of file NCWriteHelper.hpp.

131 {}

Member Function Documentation

◆ jik_to_kji_stride()

template<typename T >
void moab::UcdNCWriteHelper::jik_to_kji_stride ( size_t  ,
size_t  nj,
size_t  nk,
T *  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 137 of file NCWriteHelper.hpp.

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

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

◆ eDim

int moab::UcdNCWriteHelper::eDim
protected

Definition at line 155 of file NCWriteHelper.hpp.

◆ localGidCellsOwned

◆ localGidEdgesOwned

◆ localGidVertsOwned

◆ vDim

int moab::UcdNCWriteHelper::vDim
protected

Definition at line 155 of file NCWriteHelper.hpp.


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