OSGeneral.cpp
Go to the documentation of this file.
1 /* $Id: OSGeneral.cpp 3186 2010-02-06 23:38:35Z Gassmann $ */
15 #include "OSGeneral.h"
16 #include "OSParameters.h"
17 #include "OSErrorClass.h"
18 #include "OSMathUtil.h"
19 #include "OSBase64.h"
20 #include "OSOutput.h"
21 #include "OSgLWriter.h"
22 
23 #include <iostream>
24 #include <sstream>
25 
26 
27 using namespace std;
28 using std::endl;
29 
31  name(""),
32  source(""),
33  description(""),
34  fileCreator(""),
35  licence("")
36 {
37 }// end GeneralFileHeader constructor
38 
40 {
41 #ifndef NDEBUG
42  osoutput->OSPrint(ENUM_OUTPUT_AREA_OSGeneral, ENUM_OUTPUT_LEVEL_trace, "inside file header destructor");
43 #endif
44 }// end GeneralFileHeader destructor
45 
47 {
48  std::ostringstream outStr;
49 
50 #ifndef NDEBUG
51  osoutput->OSPrint(ENUM_OUTPUT_AREA_OSGeneral, ENUM_OUTPUT_LEVEL_debug, "Start comparing in GeneralFileHeader");
52 #endif
53  if (this == NULL)
54  {
55  if (that == NULL)
56  return true;
57  else
58  {
59 #ifndef NDEBUG
60  osoutput->OSPrint(ENUM_OUTPUT_AREA_OSGeneral, ENUM_OUTPUT_LEVEL_debug, "First object is NULL, second is not");
61 #endif
62  return false;
63  }
64  }
65  else
66  {
67  if (that == NULL)
68  {
69 #ifndef NDEBUG
70  osoutput->OSPrint(ENUM_OUTPUT_AREA_OSGeneral, ENUM_OUTPUT_LEVEL_debug, "Second object is NULL, first is not");
71 #endif
72  return false;
73  }
74  else
75  {
76  if ((this->name != that->name) ||
77  (this->source != that->source) ||
78  (this->description != that->description) ||
79  (this->fileCreator != that->fileCreator) ||
80  (this->licence != that->licence))
81  {
82 #ifndef NDEBUG
83  outStr.str("");
84  outStr.clear();
85  outStr << "name: " << this->name << " vs. " << that->name << endl;
86  outStr << "source: " << this->source << " vs. " << that->source << endl;
87  outStr << "description: " << this->description << " vs. " << that->description << endl;
88  outStr << "fileCreator: " << this->fileCreator << " vs. " << that->fileCreator << endl;
89  outStr << "licence: " << this->licence << " vs. " << that->licence << endl;
91 
92 #endif
93  return false;
94  }
95  return true;
96  }
97  }
98 }// end of GeneralFileHeader::IsEqual
99 
100 bool GeneralFileHeader::setRandom(double density, bool conformant)
101 {
102  if (OSRand() <= density) this->name = "random string";
103  if (OSRand() <= density) this->source = "random string";
104  if (OSRand() <= density) this->description = "random string";
105  if (OSRand() <= density) this->fileCreator = "random string";
106  if (OSRand() <= density) this->licence = "random string";
107  return true;
108 }// end of GeneralFileHeader::setRandom
109 
111 {
112 #ifndef NDEBUG
113  osoutput->OSPrint(ENUM_OUTPUT_AREA_OSGeneral, ENUM_OUTPUT_LEVEL_trace, "Make deep copy of GeneralFileHeader");
114 #endif
115  this->name = that->name;
116  this->source = that->source;
117  this->description = that->description;
118  this->fileCreator = that->fileCreator;
119  this->licence = that->licence;
120  return true;
121 }// end of GeneralFileHeader::deepCopyFrom
122 
123 std::string GeneralFileHeader::getHeaderItem(std::string item)
124 {
125  if (item == "name") return name;
126  if (item == "source") return source;
127  if (item == "description") return description;
128  if (item == "fileCreator") return fileCreator;
129  if (item == "licence") return licence;
130  throw ErrorClass("Attempting to access undefined header item in getHeaderItem");
131 }//end of GeneralFileHeader::getHeaderItem
132 
133 bool GeneralFileHeader::setHeader(std::string name, std::string source,
134  std::string description, std::string fileCreator, std::string licence)
135 {
136  this->name = name;
137  this->source = source;
138  this->description = description;
139  this->fileCreator = fileCreator;
140  this->licence = licence;
141  return true;
142 }// end of GeneralFileHeader::setHeader
143 
145  number( number_)
146 {
147 // if (number > 0)
148  {
149  indexes = new int[ number];
150  values = new double[ number];
151  }
152  bDeleteArrays = true;
153 }// end SparseVector constructor
154 
155 
157  bDeleteArrays(true),
158  indexes( NULL),
159  values( NULL)
160 {
161 }// end SparseVector constructor
162 
164 {
165 #ifndef NDEBUG
166  osoutput->OSPrint(ENUM_OUTPUT_AREA_OSGeneral, ENUM_OUTPUT_LEVEL_trace, "inside sparseVector destructor");
167 #endif
168  if( bDeleteArrays == true)
169  {
170 #ifndef NDEBUG
171  osoutput->OSPrint(ENUM_OUTPUT_AREA_OSGeneral, ENUM_OUTPUT_LEVEL_trace, "delete[] indexes and arrays");
172 #endif
173  if (indexes != NULL) delete[] indexes;
174  if (values != NULL) delete[] values;
175  indexes = NULL;
176  values = NULL;
177  }
178 }// end SparseVector destructor
179 
180 
182  number( number_)
183 {
184  indexes = new int[ number];
185  values = new int[ number];
186  bDeleteArrays = true;
187 }// end SparseIntVector constructor
188 
189 
191  bDeleteArrays(true),
192  indexes( NULL),
193  values( NULL)
194 {
195 }// end SparseIntVector constructor
196 
198 {
199 #ifndef NDEBUG
200  osoutput->OSPrint(ENUM_OUTPUT_AREA_OSGeneral, ENUM_OUTPUT_LEVEL_trace, "inside sparseIntVector destructor");
201 #endif
202  if( bDeleteArrays == true)
203  {
204 #ifndef NDEBUG
205  osoutput->OSPrint(ENUM_OUTPUT_AREA_OSGeneral, ENUM_OUTPUT_LEVEL_trace, "delete[] indexes and arrays");
206 #endif
207  if (indexes != NULL) delete[] indexes;
208  if (values != NULL) delete[] values;
209  indexes = NULL;
210  values = NULL;
211  }
212 }// end SparseIntVector destructor
213 
214 
216  bDeleteArrays( true),
217  isColumnMajor(true),
218  startSize(0),
219  valueSize(0),
220  starts(NULL),
221  indexes(NULL),
222  values(NULL)
223 {
224 }// end SparseMatrix Constructor
225 
226 
227 
228 SparseMatrix::SparseMatrix(bool isColumnMajor_, int startSize_, int valueSize_):
229  isColumnMajor(isColumnMajor_),
230  startSize(startSize_),
231  valueSize(valueSize_)
232 {
233  bDeleteArrays = true;
234  starts = new int[startSize];
235  indexes = new int[valueSize];
236  values = new double[valueSize];
237 
238 }//end SparseMatrix constructor
239 
240 
242 {
243 #ifndef NDEBUG
244  osoutput->OSPrint(ENUM_OUTPUT_AREA_OSGeneral, ENUM_OUTPUT_LEVEL_trace, "inside SparseMatrix destructor");
245 #endif
246  if( bDeleteArrays == true)
247  {
248  if (starts != NULL) delete[] starts;
249  if (indexes != NULL) delete[] indexes;
250  if (values != NULL) delete[] values;
251  starts = NULL;
252  indexes = NULL;
253  values = NULL;
254  }
255 }// end SparseMatrix Destructor
256 
257 
258 bool SparseMatrix::display(int secondaryDim)
259 {
260  int i, j, k;
261  for ( i = 0; i < startSize - 1; i++)
262  {
263  if (starts[i] == starts[i + 1])
264  {
265  for ( k = 0; k < secondaryDim; k++)
266  {
267  //System.out.print("0,");
268  }
269  }
270  else
271  {
272  for ( j = 0; j < indexes[starts[i]]; j ++)
273  {
274  //System.out.print("0,");
275  }
276 
277  for ( j = starts[ i ]; j < starts[i + 1]; j++)
278  {
279  //System.out.print (values[j] + ",");
280 
281  if ( j < starts[i + 1] - 1)
282  {
283  for ( k = indexes [j] + 1; k < indexes[j + 1]; k++)
284  {
285  //System.out.print("0,");
286  }
287  }
288  else
289  {
290  for ( k = indexes [j] + 1; k < secondaryDim; k++)
291  {
292  //System.out.print("0,");
293  }
294  }
295  }
296  }
297  //System.out.println();
298  }
299 
300  return true;
301 
302 }//display
303 
305  bDeleteArrays( true),
306  startSize(0),
307  valueSize(0),
308  starts(NULL),
309  conVals(NULL),
310  indexes(NULL),
311  values(NULL)
312 {
313 }// end SparseJaccobianMatrix Constructor
314 
315 
316 SparseJacobianMatrix::SparseJacobianMatrix(int startSize_, int valueSize_):
317  bDeleteArrays( true),
318  startSize(startSize_),
319  valueSize(valueSize_)
320 {
321  starts = new int[startSize];
322  conVals = new int[startSize];
323  indexes = new int[valueSize];
324  values = new double[valueSize];
325 }//end SparseJacobianMatrix constructor
326 
327 
329 {
330 #ifndef NDEBUG
331  osoutput->OSPrint(ENUM_OUTPUT_AREA_OSGeneral, ENUM_OUTPUT_LEVEL_trace, "inside SparseJacobianMatrix destructor");
332 #endif
333  if(bDeleteArrays == true)
334  {
335 #ifndef NDEBUG
336  osoutput->OSPrint(ENUM_OUTPUT_AREA_OSGeneral, ENUM_OUTPUT_LEVEL_trace, "delete SparseJacobianArrays");
337 #endif
338  if (starts != NULL) delete[] starts;
339  if (conVals != NULL) delete[] conVals;
340  if (indexes != NULL) delete[] indexes;
341  if (values != NULL) delete[] values;
342  starts = NULL;
343  conVals = NULL;
344  indexes = NULL;
345  values = NULL;
346  }
347 }// end SparseJacobianMatrix Destructor
348 
349 
351  bDeleteArrays( true),
352  hessDimension(0),
353  hessRowIdx( NULL),
354  hessColIdx( NULL),
355  hessValues( NULL)
356 {
357 }// end SparseHessianMatrix Constructor
358 
359 
360 
362 {
363 #ifndef NDEBUG
364  osoutput->OSPrint(ENUM_OUTPUT_AREA_OSGeneral, ENUM_OUTPUT_LEVEL_trace, "inside SparseHessianMatrix destructor");
365 #endif
366  if(bDeleteArrays == true)
367  {
368  if (hessRowIdx != NULL) delete[] hessRowIdx;
369  if (hessColIdx != NULL) delete[] hessColIdx;
370  if (hessValues != NULL) delete[] hessValues;
371  hessRowIdx = NULL;
372  hessColIdx = NULL;
373  hessValues = NULL;
374  }
375 }// end SparseHessianMatrix Destructor
376 
377 
378 
380  rowIndexes(NULL),
381  varOneIndexes(NULL),
382  varTwoIndexes(NULL),
383  coefficients(NULL)
384 {
385 }
386 
388 {
389 #ifndef NDEBUG
390  osoutput->OSPrint(ENUM_OUTPUT_AREA_OSGeneral, ENUM_OUTPUT_LEVEL_trace, "inside QuadraticTerms destructor");
391 #endif
392  if (rowIndexes != NULL) delete[] rowIndexes;
393  if (varOneIndexes != NULL) delete[] varOneIndexes;
394  if (varTwoIndexes != NULL) delete[] varTwoIndexes;
395  if (coefficients != NULL) delete[] coefficients;
396  rowIndexes = NULL;
397  varOneIndexes = NULL;
398  varTwoIndexes = NULL;
399  coefficients = NULL;
400 }
401 
402 
404  bDeleteArrays(true),
405  numberOfEl(0),
406  el(NULL)
407 {
408 #ifndef NDEBUG
409  osoutput->OSPrint(ENUM_OUTPUT_AREA_OSGeneral, ENUM_OUTPUT_LEVEL_trace, "inside IntVector Constructor");
410 #endif
411 }
412 
413 
415  bDeleteArrays(true)
416 {
417 #ifndef NDEBUG
418  osoutput->OSPrint(ENUM_OUTPUT_AREA_OSGeneral, ENUM_OUTPUT_LEVEL_trace, "inside alternate IntVector Constructor");
419 #endif
420 
421  numberOfEl = n;
422  el = new int[n];
423 }
424 
426 {
427 #ifndef NDEBUG
428  osoutput->OSPrint(ENUM_OUTPUT_AREA_OSGeneral, ENUM_OUTPUT_LEVEL_trace, "inside IntVector destructor");
429 #endif
430  if( bDeleteArrays == true)
431  {
432  if (el != NULL) delete[] el;
433  el = NULL;
434  }
435 }
436 
437 bool IntVector::setIntVector(int *i, int ni)
438 {
439  if (this->numberOfEl != 0)
440  delete[] this->el;
441 
442  this->numberOfEl = ni;
443 
444  this->el = new int[ni];
445  for (int j=0; j<ni; j++)
446  this->el[j] = i[j];
447 
448  return true;
449 }//setIntVector
450 
452 {
453  int ni;
454 // if (this == NULL)
455 // this = new IntVector();
456 
457  if (this->el == NULL)
458  ni = 0;
459  else
460  ni = this->numberOfEl;
461 
462  int* temp = new int[ni+1];
463  for (int j = 0; j < ni; ++j)
464  temp[j] = this->el[j];
465 
466  delete[] this->el;
467 
468  temp[ni] = i;
469 
470  this->el = temp;
471  this->numberOfEl = ++ni;
472 
473  return true;
474 }//extendIntVector
475 
477 {
478  return this->numberOfEl;
479 }
480 
482 {
483  if (j < 0 || j >= this->numberOfEl)
484  throw ErrorClass("Attempting to access undefined memory in IntVector::getEl(j)");
485  return this->el[j];
486 }
487 
488 bool IntVector::getEl(int* i)
489 {
490  for (int j=0; j < this->numberOfEl; ++j)
491  i[j] = this->el[j];
492  return true;
493 }
494 
496 {
497  std::ostringstream outStr;
498 
499 #ifndef NDEBUG
500  osoutput->OSPrint(ENUM_OUTPUT_AREA_OSGeneral, ENUM_OUTPUT_LEVEL_debug, "Start comparing in IntVector");
501 #endif
502  if (this == NULL || this->numberOfEl == 0)
503  {
504  if (that == NULL || that->numberOfEl == 0)
505  return true;
506  else
507  {
508 #ifndef NDEBUG
509  osoutput->OSPrint(ENUM_OUTPUT_AREA_OSGeneral, ENUM_OUTPUT_LEVEL_debug, "First object is NULL, second is not");
510 #endif
511  return false;
512  }
513  }
514  else
515  {
516  if (that == NULL || that->numberOfEl == 0)
517  {
518 #ifndef NDEBUG
519  osoutput->OSPrint(ENUM_OUTPUT_AREA_OSGeneral, ENUM_OUTPUT_LEVEL_debug, "Second object is NULL, first is not");
520 #endif
521  return false;
522  }
523  else
524  {
525  if (this->numberOfEl != that->numberOfEl)
526  {
527 #ifndef NDEBUG
528  outStr.str("");
529  outStr.clear();
530  outStr << "numberOfEl: " << this->numberOfEl << " vs. " << that->numberOfEl << endl;
532 #endif
533  return false;
534  }
535  for (int i=0; i<this->numberOfEl; i++)
536  {
537  if (this->el[i] != that->el[i])
538  {
539 
540 #ifndef NDEBUG
541  outStr.str("");
542  outStr.clear();
543  outStr << "El[" << i << "]: " << this->el[i] << " vs. " << that->el[i] << endl;
545 #endif
546  return false;
547  }
548  }
549  return true;
550  }
551  }
552 }//IntVector::IsEqual
553 
554 bool IntVector::setRandom(double density, bool conformant, int iMin, int iMax)
555 {
556 #ifndef NDEBUG
557  osoutput->OSPrint(ENUM_OUTPUT_AREA_OSGeneral, ENUM_OUTPUT_LEVEL_trace, "Set random IntVector");
558 #endif
559  this->numberOfEl = (int)(4*OSRand());
560 
561  int n;
562 
563  if (conformant) n = this->numberOfEl;
564  else n = (int)(4*OSRand());
565 
566  el = new int[n];
567  for (int i = 0; i < n; i++)
568  el[i] = (int)OSiRand(iMin, iMax);
569 
570  return true;
571 }//IntVector::setRandom
572 
574 {
575 #ifndef NDEBUG
576  osoutput->OSPrint(ENUM_OUTPUT_AREA_OSGeneral, ENUM_OUTPUT_LEVEL_trace, "Make deep copy of IntVector");
577 #endif
578  this->numberOfEl = that->numberOfEl;
579  int n = this->numberOfEl;
580 
581  if (n < 0) return false;
582  if (n == 0) return true;
583 
584  this->el = new int[n];
585  for (int i = 0; i < n; i++)
586  this->el[i] = that->el[i];
587 
588  return true;
589 }//IntVector::deepCopyFrom
590 
592  IntVector(),
593  value(""),
594  description("")
595 {
596 #ifndef NDEBUG
598  "Inside the OtherOptionOrResultEnumeration Constructor");
599 #endif
600 }
601 
603  IntVector(n),
604  value(""),
605  description("")
606 {
607 #ifndef NDEBUG
609  "Inside the alternate OtherOptionOrResultEnumeration Constructor");
610 #endif
611 }
612 
614 {
615 #ifndef NDEBUG
617  "Inside the OtherOptionOrResultEnumeration Destructor");
618 #endif
619 }
620 
621 bool OtherOptionOrResultEnumeration::setOtherOptionOrResultEnumeration(std::string value, std::string description, int *i, int ni)
622 {
623  this->value = value;
624  this->description = description;
625  return this->IntVector::setIntVector(i, ni);
626 }
627 
629 {
630  return this->value;
631 }
632 
634 {
635  return this->description;
636 }
637 
638 
640 {
641  std::ostringstream outStr;
642 
643 #ifndef NDEBUG
644  osoutput->OSPrint(ENUM_OUTPUT_AREA_OSGeneral, ENUM_OUTPUT_LEVEL_debug, "Start comparing in OtherOptionOrResultEnumeration");
645 #endif
646  if (this == NULL)
647  {
648  if (that == NULL)
649  return true;
650  else
651  {
652 #ifndef NDEBUG
653  osoutput->OSPrint(ENUM_OUTPUT_AREA_OSGeneral, ENUM_OUTPUT_LEVEL_trace, "First object is NULL, second is not");
654 #endif
655  return false;
656  }
657  }
658  else
659  {
660  if (that == NULL)
661  {
662 #ifndef NDEBUG
663  osoutput->OSPrint(ENUM_OUTPUT_AREA_OSGeneral, ENUM_OUTPUT_LEVEL_debug, "Second object is NULL, first is not");
664 #endif
665  return false;
666  }
667  else
668  {
669  if (this->value != that->value || this->description != that->description)
670  {
671 #ifndef NDEBUG
672  outStr.str("");
673  outStr.clear();
674  outStr << "value: " << this->value << " vs. " << that->value << endl;
675  outStr << "description: " << this->description << " vs. " << that->description << endl;
677 #endif
678  return false;
679  }
680 
681  return this->IntVector::IsEqual(that);
682  }
683  }
684 }//OtherOptionOrResultEnumeration::IsEqual
685 
686 bool OtherOptionOrResultEnumeration::setRandom(double density, bool conformant, int iMin, int iMax)
687 {
688 #ifndef NDEBUG
689  osoutput->OSPrint(ENUM_OUTPUT_AREA_OSGeneral, ENUM_OUTPUT_LEVEL_trace, "Set random OtherOptionOrResultEnumeration");
690 #endif
691  if (OSRand() <= density) this->value = "random string";
692  if (OSRand() <= density) this->description = "random string";
693 
694  if (OSRand() <= density) this->IntVector::setRandom(density,conformant,iMin,iMax);
695  return true;
696 }//OtherOptionOrResultEnumeration::setRandom
697 
699 {
700 #ifndef NDEBUG
701  osoutput->OSPrint(ENUM_OUTPUT_AREA_OSGeneral, ENUM_OUTPUT_LEVEL_trace, "Make deep copy of OtherOptionOrResultEnumeration");
702 #endif
703  this->value = that->value;
704  this->description = that->description;
705 
706  if (!this->IntVector::deepCopyFrom(that))
707  return false;
708 
709  return true;
710 }//OtherOptionOrResultEnumeration::deepCopyFrom
711 
712 
714  bDeleteArrays(true),
715  el(NULL)
716 {
717 #ifndef NDEBUG
718  osoutput->OSPrint(ENUM_OUTPUT_AREA_OSGeneral, ENUM_OUTPUT_LEVEL_trace, "Inside the DoubleVector Constructor");
719 #endif
720 }
721 
722 
724 {
725 #ifndef NDEBUG
726  osoutput->OSPrint(ENUM_OUTPUT_AREA_OSGeneral, ENUM_OUTPUT_LEVEL_trace, "Inside the DoubleVector Destructor");
727 #endif
728  if( bDeleteArrays == true)
729  {
730  if (el != NULL) delete[] el;
731  el = NULL;
732  }
733 }
734 
735 
737 {
738  std::ostringstream outStr;
739 
740 #ifndef NDEBUG
741  osoutput->OSPrint(ENUM_OUTPUT_AREA_OSGeneral, ENUM_OUTPUT_LEVEL_debug, "Start comparing in DoubleVector");
742 #endif
743  if (this == NULL || this-numberOfEl == 0)
744  {
745  if (that == NULL || that-numberOfEl == 0)
746  return true;
747  else
748  {
749 #ifndef NDEBUG
750  osoutput->OSPrint(ENUM_OUTPUT_AREA_OSGeneral, ENUM_OUTPUT_LEVEL_debug, "First object is NULL, second is not");
751 #endif
752  return false;
753  }
754  }
755  else
756  {
757  if (that == NULL || that-numberOfEl == 0)
758  {
759 #ifndef NDEBUG
760  osoutput->OSPrint(ENUM_OUTPUT_AREA_OSGeneral, ENUM_OUTPUT_LEVEL_debug, "Second object is NULL, first is not");
761 #endif
762  return false;
763  }
764  else
765  {
766  if (this->numberOfEl != that->numberOfEl)
767  {
768 #ifndef NDEBUG
769  outStr.str("");
770  outStr.clear();
771  outStr << "numberOfEl: " << this->numberOfEl << " vs. " << that->numberOfEl << endl;
773 #endif
774  return false;
775  }
776  for (int i=0; i<this->numberOfEl; i++)
777  {
778  if (!OSIsEqual(this->el[i], that->el[i]))
779  {
780 
781 #ifndef NDEBUG
782  outStr.str("");
783  outStr.clear();
784  outStr << "El[" << i << "]: " << this->el[i] << " vs. " << that->el[i] << endl;
786 #endif
787  return false;
788  }
789  }
790  return true;
791  }
792  }
793 }//DoubleVector::IsEqual
794 
795 
797  basic(NULL),
798  atLower(NULL),
799  atUpper(NULL),
800  atEquality(NULL),
801  isFree(NULL),
802  superbasic(NULL),
803  unknown(NULL)
804 {
805 #ifndef NDEBUG
806  osoutput->OSPrint(ENUM_OUTPUT_AREA_OSGeneral, ENUM_OUTPUT_LEVEL_trace, "Inside the BasisStatus Constructor");
807 #endif
808 }//end BasisStatus constructor
809 
810 
812 {
813 #ifndef NDEBUG
814  osoutput->OSPrint(ENUM_OUTPUT_AREA_OSGeneral, ENUM_OUTPUT_LEVEL_trace, "Inside the BasisStatus Destructor");
815 #endif
816  if (basic != NULL)
817  {
818  delete basic;
819  basic = NULL;
820  }
821  if (atLower != NULL)
822  {
823  delete atLower;
824  atLower = NULL;
825  }
826  if (atUpper != NULL)
827  {
828  delete atUpper;
829  atUpper = NULL;
830  }
831  if (atEquality != NULL)
832  {
833  delete atEquality;
834  atEquality = NULL;
835  }
836  if (isFree != NULL)
837  {
838  delete isFree;
839  isFree = NULL;
840  }
841  if (superbasic != NULL)
842  {
843  delete superbasic;
844  superbasic = NULL;
845  }
846  if (unknown != NULL)
847  {
848  delete unknown;
849  unknown = NULL;
850  }
851 }// end BasisStatus destructor
852 
853 
854 bool BasisStatus::setIntVector(int status, int *i, int ni)
855 {
856  switch (status)
857  {
859  {
860  if (this->basic == NULL) this->basic = new IntVector();
861 // else delete[] this->basic;
862  return this->basic->setIntVector(i, ni);
863  }
865  {
866  if (this->atLower == NULL) this->atLower = new IntVector(ni);
867 // else delete[] this->atLower;
868  return this->atLower->setIntVector(i, ni);
869  }
871  {
872  if (this->atUpper == NULL) this->atUpper = new IntVector(ni);
873 // else delete[] this->atUpper;
874  return this->atUpper->setIntVector(i, ni);
875  }
877  {
878  if (this->atEquality == NULL) this->atEquality = new IntVector(ni);
879 // else delete[] this->atEquality;
880  return this->atEquality->setIntVector(i, ni);
881  }
883  {
884  if (this->isFree == NULL) this->isFree = new IntVector(ni);
885 // else delete[] this->isFree;
886  return this->isFree->setIntVector(i, ni);
887  }
889  {
890  if (this->superbasic == NULL) this->superbasic = new IntVector(ni);
891 // else delete[] this->superbasic;
892  return this->superbasic->setIntVector(i, ni);
893  }
895  {
896  if (this->unknown == NULL) this->unknown = new IntVector(ni);
897 // else delete[] this->unknown;
898  return this->unknown->setIntVector(i, ni);
899  }
900  default:
901  throw ErrorClass("Unknown basis status encountered in BasisStatus::setIntVector");
902  }
903 }//BasisStatus::setIntVector
904 
905 bool BasisStatus::addIdx(int status, int idx)
906 {
907  switch (status)
908  {
910  {
911  if (this->basic == NULL) this->basic = new IntVector();
912  return this->basic->extendIntVector(idx);
913  }
915  {
916  if (this->atLower == NULL) this->atLower = new IntVector();
917  return this->atLower->extendIntVector(idx);
918  }
920  {
921  if (this->atUpper == NULL) this->atUpper = new IntVector();
922  return this->atUpper->extendIntVector(idx);
923  }
925  {
926  if (this->atEquality == NULL) this->atEquality = new IntVector();
927  return this->atEquality->extendIntVector(idx);
928  }
930  {
931  if (this->isFree == NULL) this->isFree = new IntVector();
932  return this->isFree->extendIntVector(idx);
933  }
935  {
936  if (this->superbasic == NULL) this->superbasic = new IntVector();
937  return this->superbasic->extendIntVector(idx);
938  }
940  {
941  if (this->unknown == NULL) this->unknown = new IntVector();
942  return this->unknown->extendIntVector(idx);
943  }
944  default:
945  throw ErrorClass("Unknown basis status encountered in BasisStatus::addIdx");
946  }
947 }//BasisStatus::addIdx
948 
949 
950 bool BasisStatus::getIntVector(int status, int *i)
951 {
952  switch (status)
953  {
955  {
956  if (this->basic == NULL) return false;
957  return this->basic->getEl(i);
958  }
960  {
961  if (this->atLower == NULL) return false;
962  return this->atLower->getEl(i);
963  }
965  {
966  if (this->atUpper == NULL) return false;
967  return this->atUpper->getEl(i);
968  }
970  {
971  if (this->atEquality == NULL) return false;
972  return this->atEquality->getEl(i);
973  }
975  {
976  if (this->isFree == NULL) return false;
977  return this->isFree->getEl(i);
978  }
980  {
981  if (this->superbasic == NULL) return false;
982  return this->superbasic->getEl(i);
983  }
985  {
986  if (this->unknown == NULL) return false;
987  return this->unknown->getEl(i);
988  }
989  default:
990  throw ErrorClass("Unknown basis status encountered in setIntVector");
991  }
992 }//BasisStatus::getIntVector
993 
994 
996 {
997  switch (status)
998  {
1000  {
1001  if (this->basic == NULL) return -1;
1002  else return this->basic->numberOfEl;
1003  }
1005  {
1006  if (this->atLower == NULL) return -1;
1007  else return this->atLower->numberOfEl;
1008  }
1010  {
1011  if (this->atUpper == NULL) return -1;
1012  else return this->atUpper->numberOfEl;
1013  }
1015  {
1016  if (this->atEquality == NULL) return -1;
1017  else return this->atEquality->numberOfEl;
1018  }
1020  {
1021  if (this->isFree == NULL) return -1;
1022  else return this->isFree->numberOfEl;
1023  }
1025  {
1026  if (this->superbasic == NULL) return -1;
1027  else return this->superbasic->numberOfEl;
1028  }
1030  {
1031  if (this->unknown == NULL) return -1;
1032  else return this->unknown->numberOfEl;
1033  }
1034  default:
1035  throw ErrorClass("Unknown basis status encountered in getBasisStatusNumberOfEl");
1036  }
1037 }//getNumberOfEl
1038 
1039 
1040 int BasisStatus::getEl(int status, int j)
1041 {
1042  switch (status)
1043  {
1045  {
1046  if (this->basic == NULL)
1047  throw ErrorClass("\"basic\" index array never defined in routine BasisStatus::getEl()");
1048  else return this->basic->el[j];
1049  }
1051  {
1052  if (this->atLower == NULL)
1053  throw ErrorClass("\"atLower\" index array never defined in routine BasisStatus::getEl()");
1054  else return this->atLower->el[j];
1055  }
1057  {
1058  if (this->atUpper == NULL)
1059  throw ErrorClass("\"atUpper\" index array never defined in routine BasisStatus::getEl()");
1060  else return this->atUpper->el[j];
1061  }
1063  {
1064  if (this->atEquality == NULL)
1065  throw ErrorClass("\"atEquality\" index array never defined in routine BasisStatus::getEl()");
1066  else return this->atEquality->el[j];
1067  }
1069  {
1070  if (this->isFree == NULL)
1071  throw ErrorClass("\"isFree\" index array never defined in routine BasisStatus::getEl()");
1072  else return this->isFree->el[j];
1073  }
1075  {
1076  if (this->superbasic == NULL)
1077  throw ErrorClass("\"superbasic\" index array never defined in routine BasisStatus::getEl()");
1078  else return this->superbasic->el[j];
1079  }
1081  {
1082  if (this->unknown == NULL)
1083  throw ErrorClass("\"unknown\" index array never defined in routine BasisStatus::getEl()");
1084  else return this->unknown->el[j];
1085  }
1086  default:
1087  throw ErrorClass("Unknown basis status encountered in getBasisStatusNumberOfEl");
1088  }
1089 }//getEl
1090 
1091 int BasisStatus::getBasisDense(int *resultArray, int dim, bool flipIdx)
1092 {
1093  int i, n, nCopied;
1094  int* statusArray = NULL;
1095 
1096  nCopied = 0;
1097 
1098  if (this->basic != NULL)
1099  {
1100  n = this->basic->getNumberOfEl();
1101  statusArray = new int[n];
1102  this->basic->getEl(statusArray);
1103  for (i=0; i < n; i++)
1104  {
1105  if (!flipIdx)
1106  resultArray[statusArray[i]] = ENUM_BASIS_STATUS_basic;
1107  else
1108  resultArray[-1 - statusArray[i]] = ENUM_BASIS_STATUS_basic;
1109  }
1110  delete [] statusArray;
1111  statusArray = NULL;
1112  nCopied += n;
1113  }
1114 
1115  if (this->atLower != NULL)
1116  {
1117  n = this->atLower->getNumberOfEl();
1118  statusArray = new int[n];
1119  this->atLower->getEl(statusArray);
1120  for (i=0; i < n; i++)
1121  {
1122  if (!flipIdx)
1123  resultArray[statusArray[i]] = ENUM_BASIS_STATUS_atLower;
1124  else
1125  resultArray[-1 - statusArray[i]] = ENUM_BASIS_STATUS_atLower;
1126  }
1127  delete [] statusArray;
1128  nCopied += n;
1129  }
1130 
1131  if (this->atUpper != NULL)
1132  {
1133  n = this->atUpper->getNumberOfEl();
1134  statusArray = new int[n];
1135  this->atUpper->getEl(statusArray);
1136  for (i=0; i < n; i++)
1137  {
1138  if (!flipIdx)
1139  resultArray[statusArray[i]] = ENUM_BASIS_STATUS_atUpper;
1140  else
1141  resultArray[-1 - statusArray[i]] = ENUM_BASIS_STATUS_atUpper;
1142  }
1143  delete [] statusArray;
1144  nCopied += n;
1145  }
1146 
1147  if (this->atEquality != NULL)
1148  {
1149  n = this->atEquality->getNumberOfEl();
1150  statusArray = new int[n];
1151  this->atEquality->getEl(statusArray);
1152  for (i=0; i < n; i++)
1153  {
1154  if (!flipIdx)
1155  resultArray[statusArray[i]] = ENUM_BASIS_STATUS_atEquality;
1156  else
1157  resultArray[-1 - statusArray[i]] = ENUM_BASIS_STATUS_atEquality;
1158  }
1159  delete [] statusArray;
1160  nCopied += n;
1161  }
1162 
1163  if (this->isFree != NULL)
1164  {
1165  n = this->isFree->getNumberOfEl();
1166  statusArray = new int[n];
1167  this->isFree->getEl(statusArray);
1168  for (i=0; i < n; i++)
1169  {
1170  if (!flipIdx)
1171  resultArray[statusArray[i]] = ENUM_BASIS_STATUS_isFree;
1172  else
1173  resultArray[-1 - statusArray[i]] = ENUM_BASIS_STATUS_isFree;
1174  }
1175  delete [] statusArray;
1176  nCopied += n;
1177  }
1178 
1179  if (this->superbasic != NULL)
1180  {
1181  n = this->superbasic->getNumberOfEl();
1182  statusArray = new int[n];
1183  this->superbasic->getEl(statusArray);
1184  for (i=0; i < n; i++)
1185  {
1186  if (!flipIdx)
1187  resultArray[statusArray[i]] = ENUM_BASIS_STATUS_superbasic;
1188  else
1189  resultArray[-1 - statusArray[i]] = ENUM_BASIS_STATUS_superbasic;
1190  }
1191  delete [] statusArray;
1192  nCopied += n;
1193  }
1194 
1195  if (this->unknown != NULL)
1196  {
1197  n = this->unknown->getNumberOfEl();
1198  statusArray = new int[n];
1199  this->unknown->getEl(statusArray);
1200  for (i=0; i < n; i++)
1201  {
1202  if (!flipIdx)
1203  resultArray[statusArray[i]] = ENUM_BASIS_STATUS_unknown;
1204  else
1205  resultArray[-1 - statusArray[i]] = ENUM_BASIS_STATUS_unknown;
1206  }
1207  delete [] statusArray;
1208  nCopied += n;
1209  }
1210  return nCopied;
1211 }//getBasisDense
1212 
1214 {
1215  std::ostringstream outStr;
1216 
1217 #ifndef NDEBUG
1218  osoutput->OSPrint(ENUM_OUTPUT_AREA_OSGeneral, ENUM_OUTPUT_LEVEL_debug, "Start comparing in BasisStatus");
1219 #endif
1220  if (this == NULL)
1221  {
1222  if (that == NULL)
1223  return true;
1224  else
1225  {
1226 #ifndef NDEBUG
1227  osoutput->OSPrint(ENUM_OUTPUT_AREA_OSGeneral, ENUM_OUTPUT_LEVEL_debug, "First object is NULL, second is not");
1228 #endif
1229  return false;
1230  }
1231  }
1232  else
1233  {
1234  if (that == NULL)
1235  {
1236 
1237 #ifndef NDEBUG
1238  osoutput->OSPrint(ENUM_OUTPUT_AREA_OSGeneral, ENUM_OUTPUT_LEVEL_debug, "Second object is NULL, first is not");
1239 #endif
1240  return false;
1241  }
1242  else
1243  {
1244  if ( !this->basic->IsEqual(that->basic) ) return false;
1245  if ( !this->atLower->IsEqual(that->atLower) ) return false;
1246  if ( !this->atUpper->IsEqual(that->atUpper) ) return false;
1247  if ( !this->atEquality->IsEqual(that->atEquality) ) return false;
1248  if ( !this->isFree->IsEqual(that->isFree) ) return false;
1249  if ( !this->superbasic->IsEqual(that->superbasic) ) return false;
1250  if ( !this->unknown->IsEqual(that->unknown) ) return false;
1251 
1252  return true;
1253  }
1254  }
1255 }//BasisStatus::IsEqual
1256 
1257 bool BasisStatus::setRandom(double density, bool conformant, int iMin, int iMax)
1258 {
1259 #ifndef NDEBUG
1260  osoutput->OSPrint(ENUM_OUTPUT_AREA_OSGeneral, ENUM_OUTPUT_LEVEL_trace, "Set random BasisStatus");
1261 #endif
1262  if (OSRand() <= density)
1263  {
1264  this->basic = new IntVector();
1265  this->basic->setRandom(density, conformant, iMin, iMax);
1266  }
1267  if (OSRand() <= density)
1268  {
1269  this->atLower = new IntVector();
1270  this->atLower->setRandom(density, conformant, iMin, iMax);
1271  }
1272  if (OSRand() <= density)
1273  {
1274  this->atUpper = new IntVector();
1275  this->atUpper->setRandom(density, conformant, iMin, iMax);
1276  }
1277  if (OSRand() <= density)
1278  {
1279  this->atEquality = new IntVector();
1280  this->atEquality->setRandom(density, conformant, iMin, iMax);
1281  }
1282  if (OSRand() <= density)
1283  {
1284  this->isFree = new IntVector();
1285  this->isFree->setRandom(density, conformant, iMin, iMax);
1286  }
1287  if (OSRand() <= density)
1288  {
1289  this->superbasic = new IntVector();
1290  this->superbasic->setRandom(density, conformant, iMin, iMax);
1291  }
1292  if (OSRand() <= density)
1293  {
1294  this->unknown = new IntVector();
1295  this->unknown->setRandom(density, conformant, iMin, iMax);
1296  }
1297 
1298  return true;
1299 }//BasisStatus::setRandom
1300 
1302 {
1303 #ifndef NDEBUG
1304  osoutput->OSPrint(ENUM_OUTPUT_AREA_OSGeneral, ENUM_OUTPUT_LEVEL_trace, "Make deep copy of BasisStatus");
1305 #endif
1306  if (that->basic != NULL)
1307  {
1308  this->basic = new IntVector();
1309  if (!this->basic->deepCopyFrom(that->basic))
1310  return false;
1311  }
1312  if (that->atLower != NULL)
1313  {
1314  this->atLower = new IntVector();
1315  if (!this->atLower->deepCopyFrom(that->atLower))
1316  return false;
1317  }
1318  if (that->atUpper != NULL)
1319  {
1320  this->atUpper = new IntVector();
1321  if (!this->atUpper->deepCopyFrom(that->atUpper))
1322  return false;
1323  }
1324  if (that->atEquality != NULL)
1325  {
1326  this->atEquality = new IntVector();
1327  if (!this->atEquality->deepCopyFrom(that->atEquality))
1328  return false;
1329  }
1330  if (that->isFree != NULL)
1331  {
1332  this->isFree = new IntVector();
1333  if (!this->isFree->deepCopyFrom(that->isFree))
1334  return false;
1335  }
1336  if (that->superbasic != NULL)
1337  {
1338  this->superbasic = new IntVector();
1339  if (!this->superbasic->deepCopyFrom(that->superbasic))
1340  return false;
1341  }
1342  if (that->unknown != NULL)
1343  {
1344  this->unknown = new IntVector();
1345  if (!this->unknown->deepCopyFrom(that->unknown))
1346  return false;
1347  }
1348 
1349  return true;
1350 }//BasisStatus::deepCopyFrom
1351 
1353  unit("byte"),
1354  description(""),
1355  value(0.0)
1356 {
1357 }// end StorageCapacity constructor
1358 
1360 {
1361 #ifndef NDEBUG
1362  osoutput->OSPrint(ENUM_OUTPUT_AREA_OSGeneral, ENUM_OUTPUT_LEVEL_trace, "inside StorageCapacity destructor");
1363 #endif
1364 }// end StorageCapacity destructor
1365 
1367 {
1368  std::ostringstream outStr;
1369 
1370 #ifndef NDEBUG
1371  osoutput->OSPrint(ENUM_OUTPUT_AREA_OSGeneral, ENUM_OUTPUT_LEVEL_debug, "Start comparing in StorageCapacity");
1372 #endif
1373  if (this == NULL)
1374  {
1375  if (that == NULL)
1376  return true;
1377  else
1378  {
1379 #ifndef NDEBUG
1380  osoutput->OSPrint(ENUM_OUTPUT_AREA_OSGeneral, ENUM_OUTPUT_LEVEL_debug, "First object is NULL, second is not");
1381 #endif
1382  return false;
1383  }
1384  }
1385  else
1386  {
1387  if (that == NULL)
1388  {
1389 #ifndef NDEBUG
1390  osoutput->OSPrint(ENUM_OUTPUT_AREA_OSGeneral, ENUM_OUTPUT_LEVEL_debug, "Second object is NULL, first is not");
1391 #endif
1392  return false;
1393  }
1394  else
1395  {
1396  if ( (this->unit != that->unit) ||
1397  (this->description != that->description) ||
1398  !OSIsEqual(this->value, that->value))
1399  {
1400 #ifndef NDEBUG
1401  outStr.str("");
1402  outStr.clear();
1403  outStr << "unit: " << this->unit << " vs. " << that->unit << endl;
1404  outStr << "description: " << this->description << " vs. " << that->description << endl;
1405  outStr << "value: " << this->value << " vs. " << that->value << endl;
1407 #endif
1408  return false;
1409  }
1410  return true;
1411  }
1412  }
1413 }// end of StorageCapacity::IsEqual
1414 
1415 bool StorageCapacity::setRandom(double density, bool conformant)
1416 {
1417  if (OSRand() <= density)
1418  {
1419 
1420  double temp = OSRand();
1421  if (conformant) temp = 0.5*temp;
1422 
1423  if (temp <= 0.25) this->unit = "byte";
1424  else if (temp <= 0.50) this->unit = "megabyte";
1425  else if (temp <= 0.75) this->unit = "";
1426  else this->unit = "overbyte";
1427  }
1428  if (OSRand() <= density) this->description = "random string";
1429  if (OSRand() <= density)
1430  {
1431  if (OSRand() <= 0.5) this->value = 3.14156;
1432  else this->value = 2.71828;
1433  }
1434  return true;
1435 }// end of StorageCapacity::setRandom
1436 
1438 {
1439 #ifndef NDEBUG
1440  osoutput->OSPrint(ENUM_OUTPUT_AREA_OSGeneral, ENUM_OUTPUT_LEVEL_trace, "Make deep copy of StorageCapacity");
1441 #endif
1442  this->unit = that->unit;
1443  this->description = that->description;
1444  this->value = that->value;
1445  return true;
1446 }// end of StorageCapacity::deepCopyFrom
1447 
1449  unit("hertz"),
1450  description(""),
1451  value(0.0)
1452 {
1453 }// end CPUSpeed constructor
1454 
1456 {
1457 #ifndef NDEBUG
1458  osoutput->OSPrint(ENUM_OUTPUT_AREA_OSGeneral, ENUM_OUTPUT_LEVEL_trace, "inside CPUSpeed destructor");
1459 #endif
1460 }// end CPUSpeed destructor
1461 
1463 {
1464  std::ostringstream outStr;
1465 
1466 #ifndef NDEBUG
1467  osoutput->OSPrint(ENUM_OUTPUT_AREA_OSGeneral, ENUM_OUTPUT_LEVEL_debug, "Start comparing in CPUSpeed");
1468 #endif
1469  if (this == NULL)
1470  {
1471  if (that == NULL)
1472  return true;
1473  else
1474  {
1475 #ifndef NDEBUG
1476  osoutput->OSPrint(ENUM_OUTPUT_AREA_OSGeneral, ENUM_OUTPUT_LEVEL_debug, "First object is NULL, second is not");
1477 #endif
1478  return false;
1479  }
1480  }
1481  else
1482  {
1483  if (that == NULL)
1484  {
1485 #ifndef NDEBUG
1486  osoutput->OSPrint(ENUM_OUTPUT_AREA_OSGeneral, ENUM_OUTPUT_LEVEL_trace, "Second object is NULL, first is not");
1487 #endif
1488  return false;
1489  }
1490  else
1491  {
1492  if ((this->unit != that->unit) ||
1493  (this->description != that->description) ||
1494  !OSIsEqual(this->value, that->value))
1495  {
1496 #ifndef NDEBUG
1497  outStr.str("");
1498  outStr.clear();
1499  outStr << "unit: " << this->unit << " vs. " << that->unit << endl;
1500  outStr << "description: " << this->description << " vs. " << that->description << endl;
1501  outStr << "value: " << this->value << " vs. " << that->value << endl;
1503 #endif
1504  return false;
1505  }
1506  return true;
1507  }
1508  }
1509 }// end of CPUSpeed::IsEqual
1510 
1511 bool CPUSpeed::setRandom(double density, bool conformant)
1512 {
1513  if (OSRand() <= density)
1514  {
1515  double temp = OSRand();
1516  if (conformant) temp = 0.5*temp;
1517 
1518  if (temp <= 0.25) this->unit = "hertz";
1519  else if (temp <= 0.50) this->unit = "gigaflops";
1520  else if (temp <= 0.75) this->unit = "";
1521  else this->unit = "bellyflops";
1522  }
1523  if (OSRand() <= density) this->description = "random string";
1524  if (OSRand() <= density)
1525  {
1526  if (OSRand() <= 0.5) this->value = 3.14156;
1527  else this->value = 2.71828;
1528  }
1529  return true;
1530 }// end of CPUSpeed::setRandom
1531 
1533 {
1534 #ifndef NDEBUG
1535  osoutput->OSPrint(ENUM_OUTPUT_AREA_OSGeneral, ENUM_OUTPUT_LEVEL_trace, "Make deep copy of CPUSpeed");
1536 #endif
1537  this->unit = that->unit;
1538  this->description = that->description;
1539  this->value = that->value;
1540  return true;
1541 }// end of CPUSpeed::deepCopyFrom
1542 
1544  description(""),
1545  value(0)
1546 {
1547 }// end CPUNumber constructor
1548 
1550 {
1551 #ifndef NDEBUG
1552  osoutput->OSPrint(ENUM_OUTPUT_AREA_OSGeneral, ENUM_OUTPUT_LEVEL_trace, "inside CPUNumber destructor");
1553 #endif
1554 }// end CPUNumber destructor
1555 
1557 {
1558  std::ostringstream outStr;
1559 
1560 #ifndef NDEBUG
1561  osoutput->OSPrint(ENUM_OUTPUT_AREA_OSGeneral, ENUM_OUTPUT_LEVEL_debug, "Start comparing in CPUNumber");
1562 #endif
1563  if (this == NULL)
1564  {
1565  if (that == NULL)
1566  return true;
1567  else
1568  {
1569 #ifndef NDEBUG
1570  osoutput->OSPrint(ENUM_OUTPUT_AREA_OSGeneral, ENUM_OUTPUT_LEVEL_trace, "First object is NULL, second is not");
1571 #endif
1572  return false;
1573  }
1574  }
1575  else
1576  {
1577  if (that == NULL)
1578  {
1579 #ifndef NDEBUG
1580  osoutput->OSPrint(ENUM_OUTPUT_AREA_OSGeneral, ENUM_OUTPUT_LEVEL_trace, "Second object is NULL, first is not");
1581 #endif
1582  return false;
1583  }
1584  else
1585 
1586  {
1587  if ((this->description != that->description) ||
1588  (this->value != that->value))
1589  {
1590 #ifndef NDEBUG
1591  outStr.str("");
1592  outStr.clear();
1593  outStr << "description: " << this->description << " vs. " << that->description << endl;
1594  outStr << "value: " << this->value << " vs. " << that->value << endl;
1596 #endif
1597  return false;
1598  }
1599  return true;
1600  }
1601  }
1602 }// end of CPUNumber::IsEqual
1603 
1604 bool CPUNumber::setRandom(double density, bool conformant)
1605 {
1606  if (OSRand() <= density) this->description = "random string";
1607  if (OSRand() <= density) this->value = (int)(4*OSRand());
1608  return true;
1609 }// end of CPUNumber::setRandom
1610 
1612 {
1613 #ifndef NDEBUG
1614  osoutput->OSPrint(ENUM_OUTPUT_AREA_OSGeneral, ENUM_OUTPUT_LEVEL_trace, "Make deep copy of CPUNumber");
1615 #endif
1616  this->description = that->description;
1617  this->value = that->value;
1618  return true;
1619 }// end of CPUNumber::deepCopyFrom
1620 
1621 
1623  unit("second"),
1624  value(0.0)
1625 {
1626 }// end TimeSpan constructor
1627 
1629 {
1630 #ifndef NDEBUG
1631  osoutput->OSPrint(ENUM_OUTPUT_AREA_OSGeneral, ENUM_OUTPUT_LEVEL_trace, "inside TimeSpan destructor");
1632 #endif
1633 }// end TimeSpan destructor
1634 
1636 {
1637  std::ostringstream outStr;
1638 
1639 #ifndef NDEBUG
1640  osoutput->OSPrint(ENUM_OUTPUT_AREA_OSGeneral, ENUM_OUTPUT_LEVEL_debug, "Start comparing in TimeSpan");
1641 #endif
1642  if (this == NULL)
1643  {
1644  if (that == NULL)
1645  return true;
1646  else
1647  {
1648 #ifndef NDEBUG
1649  osoutput->OSPrint(ENUM_OUTPUT_AREA_OSGeneral, ENUM_OUTPUT_LEVEL_trace, "First object is NULL, second is not");
1650 #endif
1651  return false;
1652  }
1653  }
1654  else
1655  {
1656  if (that == NULL)
1657  {
1658 #ifndef NDEBUG
1659  osoutput->OSPrint(ENUM_OUTPUT_AREA_OSGeneral, ENUM_OUTPUT_LEVEL_trace, "Second object is NULL, first is not");
1660 #endif
1661  return false;
1662  }
1663  else
1664  {
1665  if (!OSIsEqual(this->value, that->value) ||
1666  this->unit != that->unit )
1667 
1668  {
1669 #ifndef NDEBUG
1670  outStr.str("");
1671  outStr.clear();
1672  outStr << "unit: " << this->unit << " vs. " << that->unit << endl;
1673  outStr << "value: " << this->value << " vs. " << that->value << endl;
1675 #endif
1676  return false;
1677  }
1678  return true;
1679  }
1680  }
1681 }// end of TimeSpan::IsEqual
1682 
1683 bool TimeSpan::setRandom(double density, bool conformant)
1684 {
1685  if (OSRand() <= density)
1686  {
1687  double temp = OSRand();
1688  if (conformant) temp = 0.5*temp;
1689 
1690  if (temp <= 0.25) this->unit = "second";
1691  else if (temp <= 0.50) this->unit = "tick";
1692  else if (temp <= 0.75) this->unit = "";
1693 
1694  else this->unit = "flea";
1695  }
1696  if (OSRand() <= density)
1697  {
1698  if (OSRand() <= 0.5) this->value = 3.14156;
1699  else this->value = 2.71828;
1700  }
1701  return true;
1702 }// end of TimeSpan::setRandom
1703 
1705 {
1706 #ifndef NDEBUG
1707  osoutput->OSPrint(ENUM_OUTPUT_AREA_OSGeneral, ENUM_OUTPUT_LEVEL_trace, "Make deep copy of TimeSpan");
1708 #endif
1709  this->unit = that->unit;
1710  this->value = that->value;
1711  return true;
1712 }// end of TimeSpan::deepCopyFrom
1713 
std::string unit
the unit in which CPU speed is measured
Definition: OSGeneral.h:817
double * values
IntVector * atUpper
Definition: OSGeneral.h:650
~SparseJacobianMatrix()
Default destructor.
Definition: OSGeneral.cpp:328
std::string description
additional description about the storage
Definition: OSGeneral.h:762
bool deepCopyFrom(BasisStatus *that)
A function to make a deep copy of an instance of this class.
Definition: OSGeneral.cpp:1301
const OSSmartPtr< OSOutput > osoutput
Definition: OSOutput.cpp:39
bool setRandom(double density, bool conformant)
A function to make a random instance of this class.
Definition: OSGeneral.cpp:1511
std::string getDescription()
Get the description for a particular level in an enumeration.
Definition: OSGeneral.cpp:633
double * values
values holds a double array of nonzero partial derivatives
Definition: OSGeneral.h:340
bool IsEqual(OtherOptionOrResultEnumeration *that)
A function to check for the equality of two objects.
Definition: OSGeneral.cpp:639
bool display(int secondaryDim)
This method displays data structure in the matrix format.
Definition: OSGeneral.cpp:258
bool setIntVector(int *i, int ni)
set values into an IntVector
Definition: OSGeneral.cpp:437
bool IsEqual(CPUSpeed *that)
A function to check for the equality of two objects.
Definition: OSGeneral.cpp:1462
bool IsEqual(GeneralFileHeader *that)
A function to check for the equality of two objects.
Definition: OSGeneral.cpp:46
IntVector * superbasic
Definition: OSGeneral.h:653
bool setRandom(double density, bool conformant)
A function to make a random instance of this class.
Definition: OSGeneral.cpp:1415
bool bDeleteArrays
bDeleteArrays is true if we delete the arrays in garbage collection set to true by default ...
Definition: OSGeneral.h:619
IntVector * basic
Definition: OSGeneral.h:648
bool bDeleteArrays
bDeleteArrays is true if we delete the arrays in garbage collection set to true by default ...
Definition: OSGeneral.h:482
int numberOfEl
Definition: OSGeneral.h:483
bool bDeleteArrays
bDeleteArrays is true if we delete the arrays in garbage collection set to true by default ...
Definition: OSGeneral.h:198
std::string description
further information about the file or the problem contained within it
Definition: OSGeneral.h:50
bool deepCopyFrom(OtherOptionOrResultEnumeration *that)
A function to make a deep copy of an instance of this class.
Definition: OSGeneral.cpp:698
std::string fileCreator
name(s) of author(s) who created this file
Definition: OSGeneral.h:55
bool deepCopyFrom(CPUNumber *that)
A function to make a deep copy of an instance of this class.
Definition: OSGeneral.cpp:1611
std::string getHeaderItem(std::string item)
A function to retrieve a data item contained in this class.
Definition: OSGeneral.cpp:123
bool IsEqual(BasisStatus *that)
A function to check for the equality of two objects.
Definition: OSGeneral.cpp:1213
double value
the number of units
Definition: OSGeneral.h:932
int startSize
startSize is the dimension of the starts array – should equal number of rows + 1
Definition: OSGeneral.h:313
~GeneralFileHeader()
Default destructor.
Definition: OSGeneral.cpp:39
int value
the number of CPUs
Definition: OSGeneral.h:879
~CPUSpeed()
Class destructor.
Definition: OSGeneral.cpp:1455
bool getIntVector(int status, int *i)
Get the entire array of indices for a particular status.
Definition: OSGeneral.cpp:950
IntVector * isFree
Definition: OSGeneral.h:652
std::string name
used to give a name to the file or the problem contained within it
Definition: OSGeneral.h:39
IntVector * atLower
Definition: OSGeneral.h:649
std::string description
additional description about the CPU speed
Definition: OSGeneral.h:820
IntVector * atEquality
Definition: OSGeneral.h:651
int * hessColIdx
hessColIdx is an integer array of column indices in the range 0, ..., n - 1.
Definition: OSGeneral.h:399
double OSRand()
OSRand()
Definition: OSMathUtil.cpp:262
int getBasisDense(int *resultArray, int dim, bool flipIdx)
Get the entire array of basis status in dense form.
Definition: OSGeneral.cpp:1091
SparseHessianMatrix()
Default constructor.
Definition: OSGeneral.cpp:350
CPUSpeed()
Default constructor.
Definition: OSGeneral.cpp:1448
int * hessRowIdx
hessRowIdx is an integer array of row indices in the range 0, ..., n - 1.
Definition: OSGeneral.h:394
bool setRandom(double density, bool conformant, int iMin, int iMax)
A function to make a random instance of this class.
Definition: OSGeneral.cpp:554
bool IsEqual(DoubleVector *that)
Definition: OSGeneral.cpp:736
a data structure that holds general information about files that conform to one of the OSxL schemas ...
Definition: OSGeneral.h:32
SparseVector()
Default Constructor.
Definition: OSGeneral.cpp:156
int startSize
startSize is the dimension of the starts array
Definition: OSGeneral.h:241
static char * j
Definition: OSdtoa.cpp:3622
int numberOfEl
Definition: OSGeneral.h:620
bool setHeader(std::string name, std::string source, std::string description, std::string fileCreator, std::string licence)
A function to populate an instance of this class.
Definition: OSGeneral.cpp:133
int * indexes
indexes holds an integer array of indexes whose corresponding values are listed in the same order in ...
Definition: OSGeneral.h:210
bool setRandom(double density, bool conformant)
A function to make a random instance of this class.
Definition: OSGeneral.cpp:100
int * indexes
indexes holds an integer array of rowIdx (or colIdx) elements in coefMatrix (AMatrix).
Definition: OSGeneral.h:258
bool deepCopyFrom(GeneralFileHeader *that)
A function to make a deep copy of an instance of this class.
Definition: OSGeneral.cpp:110
bool IsEqual(CPUNumber *that)
A function to check for the equality of two objects.
Definition: OSGeneral.cpp:1556
int getNumberOfEl()
get the dimension of an IntVector
Definition: OSGeneral.cpp:476
bool setIntVector(int status, int *i, int ni)
Set the indices for a particular status.
Definition: OSGeneral.cpp:854
double OSiRand(int iMin, int iMax)
OSiRand(int iMin, int iMax)
Definition: OSMathUtil.cpp:279
int getEl(int status, int j)
Get one entry in the array of indices for a particular status.
Definition: OSGeneral.cpp:1040
std::string description
additional description about the CPU
Definition: OSGeneral.h:876
int valueSize
valueSize is the dimension of the values array
Definition: OSGeneral.h:318
a double vector data structure
Definition: OSGeneral.h:609
bool bDeleteArrays
bDeleteArrays is true if we delete the arrays in garbage collection set to true by default ...
Definition: OSGeneral.h:384
int valueSize
valueSize is the dimension of the indexes and values arrays
Definition: OSGeneral.h:246
~SparseMatrix()
Default destructor.
Definition: OSGeneral.cpp:241
int * indexes
indexes holds an integer array of variable indices.
Definition: OSGeneral.h:335
bool bDeleteArrays
bDeleteArrays is true if we delete the arrays in garbage collection set to true by default ...
Definition: OSGeneral.h:149
IntVector * unknown
Definition: OSGeneral.h:654
~SparseHessianMatrix()
Default destructor.
Definition: OSGeneral.cpp:361
the CPUSpeed class.
Definition: OSGeneral.h:812
int * values
values holds an integer array of nonzero values.
Definition: OSGeneral.h:215
int * varOneIndexes
varOneIndexes holds an integer array of the first variable indexes of all the quadratic terms...
Definition: OSGeneral.h:445
bool extendIntVector(int i)
append a value to an IntVector
Definition: OSGeneral.cpp:451
~SparseIntVector()
Default destructor.
Definition: OSGeneral.cpp:197
void fint fint * k
int getNumberOfEl(int status)
Get the number of indices for a particular status.
Definition: OSGeneral.cpp:995
double * hessValues
hessValues is a double array of the Hessian values.
Definition: OSGeneral.h:404
std::string unit
the unit in which storage capacity is measured
Definition: OSGeneral.h:759
bool deepCopyFrom(CPUSpeed *that)
A function to make a deep copy of an instance of this class.
Definition: OSGeneral.cpp:1532
bool addIdx(int status, int idx)
Add one index to a particular status.
Definition: OSGeneral.cpp:905
TimeSpan()
Default constructor.
Definition: OSGeneral.cpp:1622
static int
Definition: OSdtoa.cpp:2173
double * values
values holds a double array of value elements in coefMatrix (AMatrix), which contains nonzero element...
Definition: OSGeneral.h:264
bool setRandom(double density, bool conformant)
A function to make a random instance of this class.
Definition: OSGeneral.cpp:1604
the CPUNumber class.
Definition: OSGeneral.h:871
~TimeSpan()
Class destructor.
Definition: OSGeneral.cpp:1628
SparseIntVector()
Default Constructor.
Definition: OSGeneral.cpp:190
bool bDeleteArrays
bDeleteArrays is true if we delete the arrays in garbage collection set to true by default ...
Definition: OSGeneral.h:308
SparseJacobianMatrix()
Default constructor.
Definition: OSGeneral.cpp:304
an integer Vector data structure
Definition: OSGeneral.h:469
int number
number is the number of elements in the indexes and values arrays.
Definition: OSGeneral.h:154
int * starts
starts holds an integer array of start elements, each start element points to the start of partials f...
Definition: OSGeneral.h:324
double value
the CPU speed (expressed in multiples of unit)
Definition: OSGeneral.h:823
std::string source
used when the file or problem appeared in the literature (could be in BiBTeX format or similar) ...
Definition: OSGeneral.h:45
bool deepCopyFrom(TimeSpan *that)
A function to make a deep copy of an instance of this class.
Definition: OSGeneral.cpp:1704
bool IsEqual(IntVector *that)
A method to compare two invectors.
Definition: OSGeneral.cpp:495
bool setOtherOptionOrResultEnumeration(std::string value, std::string description, int *i, int ni)
Set the indices for a particular level in an enumeration.
Definition: OSGeneral.cpp:621
bool OSIsEqual(double x, double y)
Definition: OSGeneral.h:985
int * rowIndexes
rowIndexes holds an integer array of row indexes of all the quadratic terms.
Definition: OSGeneral.h:440
int * starts
starts holds an integer array of start elements in coefMatrix (AMatrix), which points to the start of...
Definition: OSGeneral.h:252
bool setRandom(double density, bool conformant, int iMin, int iMax)
A function to make a random instance of this class.
Definition: OSGeneral.cpp:1257
double * values
values holds a double array of nonzero values.
Definition: OSGeneral.h:164
the TimeSpan class.
Definition: OSGeneral.h:924
bool deepCopyFrom(StorageCapacity *that)
A function to make a deep copy of an instance of this class.
Definition: OSGeneral.cpp:1437
double * el
Definition: OSGeneral.h:621
int getEl(int j)
get an entry in the data array of an IntVector
Definition: OSGeneral.cpp:481
CPUNumber()
Default constructor.
Definition: OSGeneral.cpp:1543
std::string getValue()
Get the value for a particular level in an enumeration.
Definition: OSGeneral.cpp:628
int * indexes
indexes holds an integer array of indexes whose corresponding values are nonzero. ...
Definition: OSGeneral.h:159
bool IsEqual(TimeSpan *that)
A function to check for the equality of two objects.
Definition: OSGeneral.cpp:1635
bool bDeleteArrays
bDeleteArrays is true if we delete the arrays in garbage collection set to true by default ...
Definition: OSGeneral.h:230
int number
number is the number of elements in the indexes and values arrays.
Definition: OSGeneral.h:203
SparseMatrix()
Default constructor.
Definition: OSGeneral.cpp:215
bool IsEqual(StorageCapacity *that)
A function to check for the equality of two objects.
Definition: OSGeneral.cpp:1366
int * conVals
conVals holds an integer array of integers, conVals[i] is the number of constant terms in the gradien...
Definition: OSGeneral.h:330
double * coefficients
coefficients holds a double array all the quadratic term coefficients.
Definition: OSGeneral.h:455
int * varTwoIndexes
varTwoIndexes holds an integer array of the second variable indexes of all the quadratic terms...
Definition: OSGeneral.h:450
bool setRandom(double density, bool conformant, int iMin, int iMax)
A function to make a random instance of this class.
Definition: OSGeneral.cpp:686
used for throwing exceptions.
Definition: OSErrorClass.h:31
void fint * n
~StorageCapacity()
Class destructor.
Definition: OSGeneral.cpp:1359
int * el
Definition: OSGeneral.h:484
a data structure to represent an LP basis on both input and output
Definition: OSGeneral.h:645
the StorageCapacity class.
Definition: OSGeneral.h:754
~CPUNumber()
Class destructor.
Definition: OSGeneral.cpp:1549
GeneralFileHeader()
Constructor.
Definition: OSGeneral.cpp:30
std::string unit
the unit in which time is measured
Definition: OSGeneral.h:929
double value
the number of units of storage capacity
Definition: OSGeneral.h:765
StorageCapacity()
Default constructor.
Definition: OSGeneral.cpp:1352
~SparseVector()
Default destructor.
Definition: OSGeneral.cpp:163
QuadraticTerms()
Default constructor.
Definition: OSGeneral.cpp:379
bool deepCopyFrom(IntVector *that)
A function to make a deep copy of an instance of this class.
Definition: OSGeneral.cpp:573
bool setRandom(double density, bool conformant)
A function to make a random instance of this class.
Definition: OSGeneral.cpp:1683
std::string licence
licensing information if applicable
Definition: OSGeneral.h:60