本文整理汇总了C++中Array2D::getCellArea方法的典型用法代码示例。如果您正苦于以下问题:C++ Array2D::getCellArea方法的具体用法?C++ Array2D::getCellArea怎么用?C++ Array2D::getCellArea使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Array2D
的用法示例。
在下文中一共展示了Array2D::getCellArea方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: TA_CTI
void TA_CTI(
const Array2D<T> &flow_accumulation,
const Array2D<U> &riserun_slope,
Array2D<V> &result
){
Timer timer;
RDLOG_ALG_NAME<<"d8_CTI";
if(flow_accumulation.width()!=riserun_slope.width() || flow_accumulation.height()!=riserun_slope.height())
throw std::runtime_error("Couldn't calculate CTI! The input matricies were of unequal dimensions!");
RDLOG_PROGRESS<<"Setting up the CTI matrix..."<<std::flush;
result.resize(flow_accumulation);
result.setNoData(-1); //Log(x) can't take this value of real inputs, so we're good
RDLOG_PROGRESS<<"succeeded.";
RDLOG_PROGRESS<<"Calculating CTI..."<<std::flush;
timer.start();
#pragma omp parallel for collapse(2)
for(int x=0;x<flow_accumulation.width();x++)
for(int y=0;y<flow_accumulation.height();y++)
if(flow_accumulation(x,y)==flow_accumulation.noData() || riserun_slope(x,y)==riserun_slope.noData())
result(x,y)=result.noData();
else
result(x,y)=log( (flow_accumulation(x,y)/flow_accumulation.getCellArea()) / (riserun_slope(x,y)+0.001) );
RDLOG_TIME_USE<<"succeeded in "<<timer.stop()<<"s.";
}