mirror of
https://github.com/YutaItoh/3D-Eye-Tracker.git
synced 2025-11-04 14:49:48 +08:00
36 lines
568 B
C++
36 lines
568 B
C++
// Petter Strandmark 2014.
|
|
#ifndef SPII_SOLVER_CALLBACKS_H
|
|
#define SPII_SOLVER_CALLBACKS_H
|
|
|
|
#include <fstream>
|
|
|
|
#include <spii/solver.h>
|
|
|
|
namespace spii {
|
|
|
|
// Saves the current point to a file at
|
|
// every iteration.
|
|
class FileCallback
|
|
{
|
|
public:
|
|
FileCallback(std::ofstream& file_)
|
|
: file(file_)
|
|
{ }
|
|
|
|
bool operator()(const CallbackInformation& information) const
|
|
{
|
|
for (int i = 0; i < information.x->size(); ++i) {
|
|
file << (*information.x)[i] << " ";
|
|
}
|
|
file << std::endl;
|
|
return true;
|
|
}
|
|
|
|
private:
|
|
std::ofstream& file;
|
|
};
|
|
|
|
} // namespace spii
|
|
|
|
#endif
|