Changeset 17339


Ignore:
Timestamp:
11/21/13 17:31:58 (11 years ago)
Author:
tbretz
Message:
Use the new ReadGrid from Interpolator2D
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/FACT++/src/fscctrl.cc

    r17186 r17339  
    1111#include "Console.h"
    1212#include "Converter.h"
    13 #include "../externals/Interpolator2D.h"
     13#include "externals/Interpolator2D.h"
    1414
    1515#include "tools.h"
     
    3737
    3838protected:
    39     vector<pair<double,double>> fPositionsSensors;
    40     vector<pair<double,double>> fPositionsBias;
     39    vector<Interpolator2D::vec> fPositionsSensors;
     40    vector<Interpolator2D::vec> fPositionsBias;
    4141
    4242    virtual void UpdateTemp(float, const vector<float> &)
     
    631631    }
    632632
    633     void SetPositionsSensors(const vector<pair<double,double>> &vec)
     633    void SetPositionsSensors(const vector<Interpolator2D::vec> &vec)
    634634    {
    635635        fPositionsSensors = vec;
    636636    }
    637637
    638     void SetPositionsBias(const vector<pair<double,double>> &vec)
     638    void SetPositionsBias(const vector<Interpolator2D::vec> &vec)
    639639    {
    640640        fPositionsBias = vec;
     
    682682            {
    683683                T.emplace_back(temp[i]);
    684                 xy.emplace_back(fPositionsSensors[i].first, fPositionsSensors[i].second);
     684                xy.emplace_back(fPositionsSensors[i]);
    685685
    686686                avg += temp[i];
     
    913913        T::AddEvent("RECONNECT", "O", State::kDisconnected, State::kConnected)
    914914            (bind(&StateMachineFSC::Reconnect, this, placeholders::_1))
    915             ("(Re)connect ethernet connection to FTM, a new address can be given"
     915            ("(Re)connect ethernet connection to FSC, a new address can be given"
    916916             "|[host][string]:new ethernet address in the form <host:port>");
    917917
     
    924924    }
    925925
    926     vector<pair<double,double>> ReadVector(const string &filename) const
    927     {
    928         vector<pair<double,double>> vec;
    929 
    930         ifstream fin(filename);
    931         while (1)
    932         {
    933             double x, y;
    934             fin >> x;
    935             fin >> y;
    936             if (!fin)
    937                 break;
    938 
    939             vec.emplace_back(x, y);
    940         }
    941 
    942         return vec;
    943     }
    944 
    945926    int EvalOptions(Configuration &conf)
    946927    {
     
    948929
    949930        const string fname1 = conf.Get<string>("sensor-pos-file");
    950         const auto v1 = ReadVector(fname1);
     931        const auto v1 = Interpolator2D::ReadGrid(fname1);
    951932        if (v1.size() != 31)
    952933        {
    953             Error("Reading sensor positions from "+fname1+"failed ("+to_string(v1.size())+")");
     934            T::Error("Reading sensor positions from "+fname1+"failed ("+to_string(v1.size())+")");
    954935            return 1;
    955936        }
    956937
    957938        const string fname2 = conf.Get<string>("patch-pos-file");
    958         const auto v2 = ReadVector(fname2);
     939        const auto v2 = Interpolator2D::ReadGrid(fname2);
    959940        if (v2.size() != 320)
    960941        {
    961             Error("Reading bias patch positions from "+fname2+"failed ("+to_string(v2.size())+")");
     942            T::Error("Reading bias patch positions from "+fname2+"failed ("+to_string(v2.size())+")");
    962943            return 1;
    963944        }
Note: See TracChangeset for help on using the changeset viewer.