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] Annotation of /trunk/paramin-beta/dataconverter.cc
[mareframe] / trunk / paramin-beta / dataconverter.cc Repository:
ViewVC logotype

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1 - (view) (download)

1 : agomez 1 #include "dataconverter.h"
2 :    
3 :     DataConverter::DataConverter() {
4 :     // xind = NULL;
5 :     numVarTotal = -1;
6 :     }
7 :    
8 :     void DataConverter::setInitialData(const IntVector& xi, const DoubleVector& xr) {
9 :     assert(xr.Size() > 0);
10 :     xind = xi;
11 :     xfullraw = xr;
12 :     numVarTotal = xr.Size();
13 :     xConverted.resize(numVarTotal, 0.0);
14 :     }
15 :    
16 :     DataConverter::~DataConverter() {
17 :     }
18 :    
19 :     const DoubleVector& DataConverter::convertX(const DoubleVector& v1) {
20 :     assert(numVarTotal > 0);
21 :     int i, j = 0;
22 :     int numVar = v1.Size();
23 :     // DoubleVector vec(numVarTotal);
24 :     for (i = 0; i < numVarTotal; i++) {
25 :     if (xind[i] == 1) {
26 :     if (j >= numVar) {
27 :     cerr << "Error in dataconverter - trying to access invalid parameter\n";
28 :     exit(EXIT_FAILURE);
29 :     }
30 :     xConverted[i] = v1[j];
31 :     j++;
32 :     } else
33 :     xConverted[i] = xfullraw[i];
34 :     }
35 :     return xConverted;
36 :     }
37 :    
38 :     int DataConverter::getNumVarTotal() {
39 :     return numVarTotal;
40 :     }
41 :    
42 :     const DoubleVector& DataConverter::getXFull() {
43 :     return xfullraw;
44 :     }
45 :     // AJ **********
46 :     // Changing from doublevector to intvector
47 :     const IntVector& DataConverter::getOptInfo() {
48 :     return xind;
49 :     /*
50 :     int i;
51 :     DoubleVector vec(numVarTotal);
52 :     if (numVarTotal > 0) {
53 :     for (i = 0; i < numVarTotal; i++)
54 :     vec[i] = xind[i];
55 :    
56 :     }
57 :     return vec;
58 :     */
59 :     }

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

Powered By FusionForge