Skip to content

Commit

Permalink
enqueue the job flucoma#1 (comment)
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesb93 committed Aug 26, 2020
1 parent 176c2c5 commit e5ea3e7
Showing 1 changed file with 18 additions and 7 deletions.
25 changes: 18 additions & 7 deletions include/FluidCLIWrapper.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -390,23 +390,32 @@ class CLIWrapper
params.constrainParameterValues();

// Create client after all parameters are set
FluidContext context;
// Create client after all parameters are set
ClientType client(params);
Result result;
using namespace std::chrono_literals;

client.process();
ProcessState state = client.checkProgress(result);
client.enqueue(params);
result = client.process();

double progress = 0.0; // Variable to store progress

while(true)
while(result.ok())
{
ProcessState state = client.checkProgress(result);

if (state == ProcessState::kDone || state == ProcessState::kDoneStillProcessing) {
std::cout << '\n';
break;
}
if (state != ProcessState::kDone) {
if (client.progress() - progress >=1) std::cout << client.progress() << "\n";
progress = client.progress();
double newProgress = client.progress();
if (newProgress - progress >=0.01)
{
std::cout << newProgress << '\r' << std::flush;

progress = newProgress;
}
using namespace std::chrono_literals;
std::this_thread::sleep_for(20ms);
continue;
}
Expand All @@ -430,3 +439,5 @@ class CLIWrapper

} // namespace client
} // namespace fluid


0 comments on commit e5ea3e7

Please sign in to comment.