本文整理汇总了C++中Patch::accessNeighbourIndex方法的典型用法代码示例。如果您正苦于以下问题:C++ Patch::accessNeighbourIndex方法的具体用法?C++ Patch::accessNeighbourIndex怎么用?C++ Patch::accessNeighbourIndex使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Patch
的用法示例。
在下文中一共展示了Patch::accessNeighbourIndex方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: writeDependenciesLog
void PatchGrid::writeDependenciesLog(string dependencies_log)
{
QFile log_file(dependencies_log.c_str());
log_file.open(QIODevice::WriteOnly);
QTextStream log(&log_file);
log.setFieldWidth(0);
// Number of patches
log << "Number patches: " << m_Patches.size() << endl;
// Transfer type
log << "Transfer type: " << m_TransferType.c_str() << endl;
log << endl;
// averaging loop over patches
real total_stride = 0;
size_t num_total = 0;
size_t max_exchange = 0;
size_t min_exchange = 10000000;
size_t num_exchange = 0;
for (size_t i_p = 0; i_p < m_Patches.size(); i_p++) {
Patch* patch = m_Patches[i_p];
for (size_t ii_n = 0; ii_n < patch->accessNumNeighbours(); ii_n++) {
Patch* neighbour = patch->accessNeighbour(ii_n);
//.. Number of cells to receive and serve (vice versa)
bool vice_exists;
size_t num_receiving;
size_t receive_stride;
bool versa_exists;
size_t num_serving;
size_t serve_stride;
if (m_TransferType == "padded_direct") {
patch->diagnoseViceVersaDependencies(neighbour,
vice_exists, num_receiving, receive_stride,
versa_exists, num_serving, serve_stride,
true);
total_stride += num_receiving*receive_stride;
num_total += num_receiving;
min_exchange = min(min_exchange, num_receiving);
max_exchange = max(max_exchange, num_receiving);
++num_exchange;
}
}
}
log << "total number of cell transfers : " << num_total << endl;
log << "average strid : " << total_stride/num_total << endl;
log << "smallest exchange list : " << min_exchange << endl;
log << "longest exchange list : " << max_exchange << endl;
log << "average exchange list length : " << num_total/max(size_t(1), num_exchange) << endl << endl;
// output loop over patches
for (size_t i_p = 0; i_p < m_Patches.size(); i_p++) {
Patch* patch = m_Patches[i_p];
log.setFieldWidth(0);
log << "Patch " << i_p << ", type: " << patch->accessPatchType() << endl;
log << " Number of neighbours: " << patch->accessNumNeighbours() << endl;
log.setFieldWidth(10);
log << "Neighbour"
<< "ID"
<< "type"
<< "receiving"
<< "stride"
<< "serving"
<< "stride"
<< endl;
for (size_t ii_n = 0; ii_n < patch->accessNumNeighbours(); ii_n++) {
Patch* neighbour = patch->accessNeighbour(ii_n);
size_t n_id = patch->accessNeighbourIndex(ii_n);
//.. Number of cells to receive and serve (vice versa)
bool vice_exists;
size_t num_receiving;
size_t receive_stride;
bool versa_exists;
size_t num_seving;
size_t serve_stride;
if (m_TransferType == "padded_direct") {
patch->diagnoseViceVersaDependencies(neighbour,
vice_exists, num_receiving, receive_stride,
versa_exists, num_seving, serve_stride,
true);
}
log << ii_n
<< n_id
<< neighbour->accessPatchType()
<< num_receiving
<< receive_stride
<< num_seving
<< serve_stride
<< endl;
}
log << endl;
}
}