本文整理汇总了C++中std::array::addCellData方法的典型用法代码示例。如果您正苦于以下问题:C++ array::addCellData方法的具体用法?C++ array::addCellData怎么用?C++ array::addCellData使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类std::array
的用法示例。
在下文中一共展示了array::addCellData方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: condWriteIntegerField
void condWriteIntegerField(std::vector<double>& fieldvector,
const std::string& fieldname,
const OpmDeck& deck,
const std::vector<int>& global_cell,
const std::array<size_t, 3>& dims,
VTKWriter<CpGrid::LeafGridView>& vtkwriter) {
if (deck.hasKeyword(fieldname)) {
std::cout << "Found " << fieldname << "..." << std::endl;
std::vector<int> eclVector = deck.getKeyword(fieldname).getIntData();
fieldvector.resize(global_cell.size());
int num_global_cells = dims[0]*dims[1]*dims[2];
if (int(eclVector.size()) != num_global_cells) {
OPM_THROW(std::runtime_error, fieldname << " field must have the same size as the "
"logical cartesian size of the grid: "
<< eclVector.size() << " != " << num_global_cells);
}
for (size_t i = 0; i < global_cell.size(); ++i) {
fieldvector[i] = (double)eclVector[global_cell[i]];
}
vtkwriter.addCellData(fieldvector, fieldname);
}
}