Log In | Get Help   
Home My Page Projects Code Snippets Project Openings Mareframe
Summary Activity Forums Tracker Lists Tasks Docs Surveys News SCM Files
[mareframe] View of /trunk/paramin-beta/dataconverter.cc
[mareframe] / trunk / paramin-beta / dataconverter.cc Repository:
ViewVC logotype

View of /trunk/paramin-beta/dataconverter.cc

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1 - (download) (annotate)
Mon Feb 10 17:09:07 2014 UTC (10 years, 3 months ago) by agomez
File size: 1262 byte(s)
Initial version based on Gadget 2.2.00
#include "dataconverter.h"

DataConverter::DataConverter() {
    // xind = NULL;
  numVarTotal = -1;
}

void DataConverter::setInitialData(const IntVector& xi, const DoubleVector& xr) {
  assert(xr.Size() > 0);
  xind = xi;
  xfullraw = xr;
  numVarTotal = xr.Size();
  xConverted.resize(numVarTotal, 0.0);
}

DataConverter::~DataConverter() {
}

const DoubleVector& DataConverter::convertX(const DoubleVector& v1) {
  assert(numVarTotal > 0);
  int i, j = 0;
  int numVar = v1.Size();
  // DoubleVector vec(numVarTotal);
  for (i = 0; i < numVarTotal; i++) {
    if (xind[i] == 1) {
      if (j >= numVar) {
        cerr << "Error in dataconverter - trying to access invalid parameter\n";
        exit(EXIT_FAILURE);
      }
      xConverted[i] = v1[j];
      j++;
    } else
      xConverted[i] = xfullraw[i];
  }
  return xConverted;
}

int DataConverter::getNumVarTotal() {
  return numVarTotal;
}

const DoubleVector& DataConverter::getXFull() {
  return xfullraw;
}
// AJ **********
// Changing from doublevector to intvector
const IntVector& DataConverter::getOptInfo() {
    return xind;
    /*
    int i;
  DoubleVector vec(numVarTotal);
  if (numVarTotal > 0) {
    for (i = 0; i < numVarTotal; i++)
      vec[i] = xind[i];

  }
  return vec;
    */
}

root@forge.cesga.es
ViewVC Help
Powered by ViewVC 1.0.0  

Powered By FusionForge