Commit 0748f951 authored by Laurent Belcour's avatar Laurent Belcour

Adding BRDF to gnuplot soft

parent 09795a2a
CONFIG += qt
INCLUDEPATH += ../../
DESTDIR = ../../build
SOURCES += main.cpp
LIBS += -L../../build -lcore
#include <core/args.h>
#include <core/data.h>
#include <core/function.h>
#include <core/fitter.h>
#include <core/plugins_manager.h>
#include <QApplication>
#include <iostream>
#include <vector>
#include <iostream>
#include <fstream>
#include <limits>
#include <cstdlib>
int main(int argc, char** argv)
{
QApplication app(argc, argv, false);
arguments args(argc, argv) ;
plugins_manager manager(args) ;
if(args.is_defined("help")) {
std::cout << "<<HELP>> data2gnuplot --input data.file --output gnuplot.file" << std::endl ;
std::cout << " - input and output are mandatory parameters" << std::endl ;
return 0 ;
}
if(! args.is_defined("input")) {
std::cerr << "<<ERROR>> the input filename is not defined" << std::endl ;
return 1 ;
}
if(! args.is_defined("output")) {
std::cerr << "<<ERROR>> the output filename is not defined" << std::endl ;
return 1 ;
}
function* f = NULL;
if(args.is_defined("func"))
{
std::cout << "<<INFO>> Using plugin function \"" << args["func"] << "\"" << std::endl ;
f = manager.get_function(args["func"]) ;
}
else
{
f = manager.get_function() ;
}
data* d = NULL ;
d = manager.get_data() ;
d->load(args["input"]);
// Create output file
std::ofstream file(args["output"].c_str(), std::ios_base::trunc);
if(d != NULL)
{
for(int i=0; i<d->size(); ++i)
{
vec v = d->get(i) ;
for(int u=0; u<d->dimX()+d->dimY(); ++u)
file << v[u] << "\t" ;
file << std::endl ;
}
}
else
{
std::cerr << "<<ERROR>> cannot export data" << std::endl ;
}
return 0 ;
}
TEMPLATE = subdirs
SUBDIRS = generate_data \
plugin_loader \
brdf2gnuplot
brdf2gnuplot \
data2gnuplot
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment