Skip to content
Snippets Groups Projects
Commit 75bf9103 authored by Nils-Arne Dreier's avatar Nils-Arne Dreier
Browse files

feat: use yac_cget_async

parent e66f6ee6
No related branches found
No related tags found
1 merge request!49Feat get async
......@@ -87,28 +87,36 @@ void Yac2Input::run()
}
}
std::vector<int> yac_infos(collections_.size());
chrono::Duration timestep_duration(timeStep_);
for (; timestep_end <= end_time; timestep_end += timestep_duration) {
for (std::size_t collectionIdx = 0; collectionIdx < collections_.size(); ++collectionIdx) {
std::vector<double*> buffers(collections_[collectionIdx].size(), nullptr);
for (std::size_t fieldIdx = 0; fieldIdx < collections_[collectionIdx].size(); ++fieldIdx) {
buffers[fieldIdx] = collections_[collectionIdx].at(fieldIdx).data();
}
std::vector<double*> buffers(collections_[collectionIdx].size(), nullptr);
for (std::size_t fieldIdx = 0; fieldIdx < collections_[collectionIdx].size(); ++fieldIdx) {
buffers[fieldIdx] = collections_[collectionIdx].at(fieldIdx).data();
}
int info = 0;
int ierror = 0;
yac_cget(collectionId[collectionIdx], static_cast<int>(collections_[collectionIdx].size()), buffers.data(), &info, &ierror);
int ierror = 0;
yac_cget_async(collectionId[collectionIdx], static_cast<int>(collections_[collectionIdx].size()), buffers.data(), &yac_infos[collectionIdx], &ierror);
if (ierror != 0) {
throw std::runtime_error("Error " + std::to_string(ierror) + " in yac_cget");
}
if (ierror != 0) {
throw std::runtime_error("Error " + std::to_string(ierror) + " in yac_cget");
}
}
for (std::size_t collectionIdx = 0; collectionIdx < collections_.size(); ++collectionIdx) {
yac_cwait(collectionId[collectionIdx]);
}
if (info != YAC_ACTION_NONE) {
handler_->handle(collections_[collectionIdx], timestep_begin[collectionIdx], timestep_end);
timestep_begin[collectionIdx] = timestep_end;
for (std::size_t collectionIdx = 0; collectionIdx < collections_.size(); ++collectionIdx) {
if (yac_infos[collectionIdx] != YAC_ACTION_NONE) {
{
handler_->handle(collections_[collectionIdx], timestep_begin[collectionIdx], timestep_end);
timestep_begin[collectionIdx] = timestep_end;
}
}
}
}
}
}
} // namespace yaco
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment