vertical_segment.h 5 KB
 Ludovic Courtès committed Feb 06, 2015 1 2 /* ALTA --- Analysis of Bidirectional Reflectance Distribution Functions  Ludovic Courtès committed May 12, 2015 3  Copyright (C) 2013, 2014, 2015 Inria  Ludovic Courtès committed Feb 06, 2015 4 5 6 7 8 9 10  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/. */  Laurent Belcour committed Feb 11, 2013 11 12 13 14 15 #pragma once // Include STL #include #include  Ludovic Courtès committed May 12, 2015 16 #include  Laurent Belcour committed Feb 11, 2013 17 18  // Interface  Laurent Belcour committed Jun 14, 2013 19 #include "common.h"  Laurent Belcour committed Feb 11, 2013 20 21 22 23 24 #include "function.h" #include "data.h" #include "fitter.h" #include "args.h"  Laurent Belcour committed Mar 11, 2014 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 /*! \ingroup core * * \brief * A vertical segment data class * * This class implement a data representation of vertical segments in the * sens of Pacanowski et al. [2012]. Each data point is in fact composed * of a middle point \f$x \f$ and an upper \f$\overline{x} \f$ and lower * bound \f$\underline{x} \f$. * * To retreive the complete vertical segment data \f$[x, \underline{x}, * \overline{x}] \f$, a special function is provided. The functions * inherited from \a data will only return the middle point. * * It is possible to load regular ALTA file using a vertical segment data * loader. It will automatically generate vertical segments. You can * control the behaviour of the vertical segments using the following * option in the command line: *
• \-\-dt specify the size of the vertical segment. If the * option \-\-dt-relative is not set, this size is absolute: \f$[x, * x - dt, x + dt] \f$. If the \-\-dt-relative option is set, the * vertical segment size is relative to the middle point value \f$x \f$:  Laurent Belcour committed Mar 21, 2014 48 49 50  * \f$[x, x (1 - dt), x (1 + dt)] \f$. You can specify the vertical * segment to be equal to the max of the relative and absolute sizes * using the \-\-dt-max option.  Laurent Belcour committed Mar 11, 2014 51 52 53  *
 Laurent Belcour committed Apr 03, 2014 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71  * * The data of the vertical segment can be restricted to subpart of the * original data by specifying the bounding box of the input and output * domain: *
 Laurent Belcour committed Mar 11, 2014 72  */  Laurent Belcour committed Feb 11, 2013 73 74 75 76 class vertical_segment : public data { public: // methods  77 78 79 80 81 82 83 84 85 86 87 88 89 90 91  //! \brief Default constructor that does nothing at all. vertical_segment() { } vertical_segment(unsigned int dim_X, unsigned int dim_Y, unsigned int size); //! \brief Construct vertical segment data for a given size and where the size of each element //! is also given. All data are initialized to zero vertical_segment( params::input in_param, params::output out_param, unsigned int size );  Laurent Belcour committed Feb 11, 2013 92 93  // Load data from a file virtual void load(const std::string& filename) ;  Laurent Belcour committed Jul 11, 2013 94 95 96 97 98 99 100 101 102 103  //! \brief Load data from a file using the command line arguments //! //! \details //! Specific arguments for the vertical segment data //! --dt specify a value for the absolute/relative segment if not defined //! in the data //! --data-positive for the data to be positive //! --dt-relative use a relative segment intervale. The dt is used //! multipled by the data  Laurent Belcour committed Feb 11, 2013 104 105  virtual void load(const std::string& filename, const arguments& args) ;  Laurent Belcour committed May 29, 2013 106   Laurent Belcour committed Feb 11, 2013 107  // Acces to data  Laurent Belcour committed Feb 20, 2013 108  virtual vec get(int i) const ;  Laurent Belcour committed Feb 09, 2015 109 110  virtual vec operator[](int i) const;  PACANOWSKI Romain committed Mar 13, 2015 111 112 113 114  virtual vec value(const vec&) const { NOT_IMPLEMENTED(); }  Laurent Belcour committed May 31, 2013 115 116  //! \brief Put the sample inside the data  Laurent Belcour committed Feb 09, 2015 117 118  virtual void set(const vec& x); virtual void set(int i, const vec& x);  Laurent Belcour committed May 29, 2013 119 120 121 122 123 124 125 126 127  //! \brief Specific accessor to a vertical segment, this gives the //! complete vector, plus the ordinate segment virtual void get(int i, vec &x, vec &yl, vec &yu) const ; //! \brief Specific accessor to a vertical segment. Provides only the //! ordinate segment. virtual void get(int i, vec& yl, vec& yu) const ;  Laurent Belcour committed Feb 11, 2013 128 129 130 131  // Get data size virtual int size() const ;  132 133 134  private: // method void initializeToZero( unsigned int number_of_data_elements );  Ludovic Courtès committed May 12, 2015 135  static void load_data_from_text(std::istream& input,  Laurent Belcour committed May 28, 2015 136  const arguments& header,  Ludovic Courtès committed May 12, 2015 137  vertical_segment& result,  Ludovic Courtès committed May 12, 2015 138 139  const arguments& args);  Laurent Belcour committed Feb 11, 2013 140 141 142 143 144 145 146  private: // data // Store for each point of data, the upper // and lower value std::vector _data ; } ;  Ludovic Courtès committed May 12, 2015 147 /* -*- c++ -*- */