44 lines
1.1 KiB
C++
44 lines
1.1 KiB
C++
#include "api.hpp"
|
|
|
|
#include <cstddef>
|
|
#include <cstdint>
|
|
#include <iomanip>
|
|
#include <iostream>
|
|
|
|
PLUGIN_EXPORT std::uint32_t plugin_api_version(){
|
|
return PLUGIN_API_VERSION;
|
|
}
|
|
|
|
PLUGIN_EXPORT PluginType plugin_type(){
|
|
return PluginType::Output;
|
|
}
|
|
|
|
PLUGIN_EXPORT const char* plugin_name(){
|
|
return "Console output";
|
|
}
|
|
|
|
PLUGIN_EXPORT const char* plugin_description(){
|
|
return "Prints calculated solution points to the console";
|
|
}
|
|
|
|
PLUGIN_EXPORT int write_output(const OutputParameters* parameters){
|
|
|
|
std::cout << "\nSolver: " << parameters->solver_name << '\n'
|
|
<< std::setw(12) << "t"
|
|
<< std::setw(20) << "x1"
|
|
<< std::setw(20) << "x2"
|
|
<< std::setw(20) << "x3" << '\n';
|
|
|
|
std::cout << std::setprecision(10);
|
|
for (size_t index = 0; index < parameters->point_count; ++index){
|
|
const SolutionPoint& point = parameters->points[index];
|
|
std::cout << std::setw(12) << point.t
|
|
<< std::setw(20) << point.x1
|
|
<< std::setw(20) << point.x2
|
|
<< std::setw(20) << point.x3 << '\n';
|
|
}
|
|
|
|
std::cout.flush();
|
|
return std::cout ? 0 : 1;
|
|
}
|