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 |
|
|
37 |
|
|
38 |
|
void SimState::createArrays (int the_nElements) { |
39 |
|
int i, index3, index9; |
40 |
< |
|
40 |
> |
|
41 |
|
if( arraysAllocated ){ |
42 |
|
|
43 |
|
sprintf( painCave.errMsg, |
56 |
|
Amat = new double[nElements*9]; |
57 |
|
mu = new double[nElements]; |
58 |
|
ul = new double[nElements*3]; |
59 |
+ |
quat = new double[nElements*4]; |
60 |
|
|
61 |
|
// init directional values to zero |
62 |
|
|
85 |
|
ul[index3+0] = 1.0; |
86 |
|
ul[index3+1] = 0.0; |
87 |
|
ul[index3+2] = 0.0; |
88 |
+ |
|
89 |
+ |
quat[i*4] = 1.0; |
90 |
+ |
quat[i*4+1] = 0.0; |
91 |
+ |
quat[i*4+2] = 0.0; |
92 |
+ |
quat[i*4+3] = 0.0; |
93 |
+ |
|
94 |
|
} |
95 |
|
|
96 |
|
arraysAllocated = true; |
113 |
|
Amat = NULL; |
114 |
|
mu = NULL; |
115 |
|
ul = NULL; |
116 |
+ |
quat = NULL; |
117 |
|
|
118 |
+ |
|
119 |
|
arraysAllocated = false; |
120 |
|
nElements = 0; |
121 |
|
} |
127 |
|
double** the_trq, |
128 |
|
double** the_Amat, |
129 |
|
double** the_mu, |
130 |
< |
double** the_ul ){ |
130 |
> |
double** the_ul, |
131 |
> |
double** the_quat){ |
132 |
|
int index3, index9; |
133 |
|
|
134 |
|
if( arraysAllocated ){ |
143 |
|
*the_Amat = &(Amat[index9]); |
144 |
|
*the_mu = &(mu[index]); |
145 |
|
*the_ul = &(ul[index3]); |
146 |
+ |
*the_quat = &(quat[index*4]); |
147 |
|
} |
148 |
|
else{ |
149 |
|
|