Mise à jour terminée. Pour connaître les apports de la version 13.8.4 par rapport à notre ancienne version vous pouvez lire les "Release Notes" suivantes :
https://about.gitlab.com/releases/2021/02/11/security-release-gitlab-13-8-4-released/
https://about.gitlab.com/releases/2021/02/05/gitlab-13-8-3-released/

data.cpp 1.93 KB
Newer Older
1 2 3 4 5 6 7 8 9 10
/* ALTA --- Analysis of Bidirectional Reflectance Distribution Functions

   Copyright (C) 2013, 2014 Inria

   This file is part of ALTA.

   This Source Code Form is subject to the terms of the Mozilla Public
   License, v. 2.0.  If a copy of the MPL was not distributed with this
   file, You can obtain one at http://mozilla.org/MPL/2.0/.  */

11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68
#include "data.h"

#include <string>
#include <sstream>
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>


// Load data from a file
void data_astm::load(const std::string& filename) 
{
	std::ifstream file(filename.c_str());
	std::string line;
	
	// Parse the header
	for(int i=0; i<22; ++i)
	{
		std::getline(file, line);
	}

	while(file.good())
	{
		std::getline(file, line);
		
		size_t s = 0; // start
		size_t t;     // end
		bool sample_wrong = false;
		vec x(7); 
		for(int i=0; i<7; ++i)
		{
			t = line.find_first_of(',', s);
			if(t == s || t == std::string::npos)
			{
				sample_wrong = true;
			}

			x[i] = atof(line.substr(s, t-s).c_str());

			s = t+1;
		}

		if(!sample_wrong)
		{
			_data.push_back(x);
		}
	}

	file.close();
}
void data_astm::load(const std::string& filename, const arguments& args)
{
	this->load(filename);
}

// Acces to data
69
vec& data_astm::get(int i) 
70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109
{
	return _data[i];
}
vec data_astm::operator[](int i) const 
{
	return _data[i];
}
vec data_astm::value(vec in, vec out) const
{
	std::cout << "<<ERROR>> not implemented" << std::endl;
	vec res(4);
	return res;
}

// Get data size, e.g. the number of samples to fit
int data_astm::size() const 
{
	return _data.size() ;
}

// Get min and max input space values
vec data_astm::min() const 
{
	vec res(4);
	res[0] = 0.0 ;
	res[1] = 0.0 ;
	res[2] = 0.0 ;
	res[3] = 0.0 ;
	return res ;
}
vec data_astm::max() const
{
	vec res(4);
	res[0] = M_PI / 2 ;
	res[1] = 0.0 ;
	res[2] = M_PI / 2 ;
	res[3] = M_PI ;
	return res ;
}

110
ALTA_DLL_EXPORT data* provide_data()
111 112 113 114
{
    return new data_astm();
}