| 1 | 
< | 
#include <cstdlib> | 
| 2 | 
< | 
#include <cstdio> | 
| 1 | 
> | 
#include <iostream> | 
| 2 | 
  | 
 | 
| 3 | 
+ | 
#include <stdlib.h> | 
| 4 | 
+ | 
#include <stdio.h> | 
| 5 | 
+ | 
 | 
| 6 | 
  | 
#include "simError.h" | 
| 7 | 
  | 
#include "SimState.hpp" | 
| 8 | 
  | 
 | 
| 19 | 
  | 
  Amat = NULL; | 
| 20 | 
  | 
  mu   = NULL; | 
| 21 | 
  | 
  ul   = NULL; | 
| 22 | 
+ | 
  rc   = NULL; | 
| 23 | 
+ | 
  massRatio = NULL; | 
| 24 | 
  | 
} | 
| 25 | 
  | 
 | 
| 26 | 
  | 
 | 
| 33 | 
  | 
  if(Amat != NULL) delete[] Amat; | 
| 34 | 
  | 
  if(mu   != NULL) delete[] mu; | 
| 35 | 
  | 
  if(ul   != NULL) delete[] ul;   | 
| 36 | 
+ | 
  if(rc   != NULL) delete[] rc;   | 
| 37 | 
+ | 
  if(massRatio != NULL) delete[] massRatio;   | 
| 38 | 
  | 
 | 
| 39 | 
  | 
} | 
| 40 | 
  | 
 | 
| 41 | 
  | 
 | 
| 42 | 
  | 
void SimState::createArrays (int the_nElements) { | 
| 43 | 
  | 
  int i, index3, index9; | 
| 44 | 
< | 
   | 
| 44 | 
> | 
 | 
| 45 | 
  | 
  if( arraysAllocated ){ | 
| 46 | 
  | 
 | 
| 47 | 
  | 
    sprintf( painCave.errMsg, | 
| 60 | 
  | 
  Amat = new double[nElements*9]; | 
| 61 | 
  | 
  mu   = new double[nElements]; | 
| 62 | 
  | 
  ul   = new double[nElements*3]; | 
| 63 | 
+ | 
  rc   = new double[nElements*3]; | 
| 64 | 
+ | 
  massRatio = new double[nElements]; | 
| 65 | 
  | 
   | 
| 66 | 
  | 
  // init directional values to zero | 
| 67 | 
  | 
   | 
| 104 | 
  | 
  if(Amat != NULL) delete[] Amat; | 
| 105 | 
  | 
  if(mu   != NULL) delete[] mu; | 
| 106 | 
  | 
  if(ul   != NULL) delete[] ul;   | 
| 107 | 
+ | 
  if(rc   != NULL) delete[] rc; | 
| 108 | 
+ | 
  if(massRatio != NULL) delete[] massRatio; | 
| 109 | 
  | 
 | 
| 110 | 
  | 
  pos  = NULL; | 
| 111 | 
  | 
  vel  = NULL; | 
| 114 | 
  | 
  Amat = NULL; | 
| 115 | 
  | 
  mu   = NULL; | 
| 116 | 
  | 
  ul   = NULL; | 
| 117 | 
+ | 
  rc   = NULL; | 
| 118 | 
+ | 
  massRatio = NULL; | 
| 119 | 
  | 
 | 
| 120 | 
  | 
  arraysAllocated = false; | 
| 121 | 
  | 
  nElements = 0; | 
| 128 | 
  | 
                                double** the_trq, | 
| 129 | 
  | 
                                double** the_Amat, | 
| 130 | 
  | 
                                double** the_mu,  | 
| 131 | 
< | 
                                double** the_ul ){ | 
| 131 | 
> | 
                                double** the_ul,  | 
| 132 | 
> | 
                                double** the_rc, | 
| 133 | 
> | 
                                double** the_massRatio){ | 
| 134 | 
  | 
  int index3, index9; | 
| 135 | 
  | 
 | 
| 136 | 
  | 
  if( arraysAllocated ){ | 
| 145 | 
  | 
    *the_Amat = &(Amat[index9]); | 
| 146 | 
  | 
    *the_mu   = &(mu[index]);  | 
| 147 | 
  | 
    *the_ul   = &(ul[index3]); | 
| 148 | 
+ | 
    *the_rc   = &(rc[index3]); | 
| 149 | 
+ | 
    *the_massRatio = &(massRatio[index]); | 
| 150 | 
  | 
  } | 
| 151 | 
  | 
  else{ | 
| 152 | 
  | 
 |