28 #if defined(HAVE_CONFIG_H)
31 #if defined(HAVE_GL_GL_H)
33 #elif defined(HAVE_OPENGL_GL_H)
34 #include <OpenGL/gl.h>
55 coef[0] = -0.5f * x * mx * mx;
56 coef[1] = mx * (mx*mx + 3.0f* x*mx + 0.5f* x* x);
57 coef[2] = x * ( x* x + 3.0f*mx* x + 0.5f*mx*mx);
58 coef[3] = -0.5f * x * x * mx;
68 int ib, i0, i1, i2, ii;
70 *
terminal << wxT(
" Interpolating ... ");
74 for (ib = 0; ib <
nb; ib++) {
75 for (i0 = 0; i0 <
ng[0]; i0++) {
76 for (i1 = 0; i1 <
ng[1]; i1++) {
77 for (i2 = 0; i2 <
ng[2]; i2++) {
78 delete[]
vf[ib][i0][i1][i2];
79 delete[]
mat[ib][i0][i1][i2];
81 delete[]
eig[ib][i0][i1];
82 delete[]
mat[ib][i0][i1];
83 delete[]
vf[ib][i0][i1];
95 for (ib = 0; ib <
nb; ib++) {
96 eig[ib] =
new GLfloat**[
ng[0]];
97 mat[ib] =
new GLfloat***[
ng[0]];
98 vf[ib] =
new GLfloat***[
ng[0]];
99 for (i0 = 0; i0 <
ng[0]; i0++) {
100 eig[ib][i0] =
new GLfloat*[
ng[1]];
101 mat[ib][i0] =
new GLfloat**[
ng[1]];
102 vf[ib][i0] =
new GLfloat**[
ng[1]];
103 for (i1 = 0; i1 <
ng[1]; i1++) {
104 eig[ib][i0][i1] =
new GLfloat[
ng[2]];
105 mat[ib][i0][i1] =
new GLfloat*[
ng[2]];
106 vf[ib][i0][i1] =
new GLfloat*[
ng[2]];
107 for (i2 = 0; i2 <
ng[2]; i2++) {
108 mat[ib][i0][i1][i2] =
new GLfloat[3];
109 vf[ib][i0][i1][i2] =
new GLfloat[3];
117 #pragma omp parallel default(none) \
118 shared(nb,ng0,ng,eig,eig0,mat,mat0,interpol) \
119 private (ib,i0,i1,i2,ii)
123 mat1[4][4][4][3], mat2[4][4][3], mat3[4][3],
124 eig1[4][4][4], eig2[4][4], eig3[4];
126 for (ib = 0; ib <
nb; ib++) {
127 # pragma omp for nowait
128 for (i0 = 0; i0 <
ng0[0]; i0++) {
130 for (i1 = 0; i1 <
ng0[1]; i1++) {
131 for (i2 = 0; i2 <
ng0[2]; i2++) {
132 for (j0 = 0; j0 < 4; j0++) {
133 for (j1 = 0; j1 < 4; j1++) {
134 for (j2 = 0; j2 < 4; j2++) {
138 for (jj = 0; jj < 3; jj++) {
148 for (j1 = 0; j1 < 4; j1++) {
149 for (j2 = 0; j2 < 4; j2++) {
151 for (jj = 0; jj < 3; jj++) mat2[j1][j2][jj] = 0.0;
152 for (ii = 0; ii < 4; ii++) {
153 eig2[j1][j2] += coef[ii] * eig1[ii][j1][j2];
154 for (jj = 0; jj < 3; jj++)
155 mat2[j1][j2][jj] += coef[ii] * mat1[ii][j1][j2][jj];
161 for (j2 = 0; j2 < 4; j2++) {
163 for (jj = 0; jj < 3; jj++) mat3[j2][jj] = 0.0;
164 for (ii = 0; ii < 4; ii++) {
165 eig3[j2] += coef[ii] * eig2[ii][j2];
166 for (jj = 0; jj < 3; jj++)
167 mat3[j2][jj] += coef[ii] * mat2[ii][j2][jj];
175 for (jj = 0; jj < 3; jj++)
179 for (ii = 0; ii < 4; ii++) {
182 [i2*
interpol + j2] += coef[ii] * eig3[ii];
183 for (jj = 0; jj < 3; jj++)
186 [i2*
interpol + j2][jj] += coef[ii] * mat3[ii][jj];
199 #pragma omp parallel default(none) \
200 shared(nb,ng,eig,vf,avec) \
201 private (ib,i0,i1,i2,ii)
203 int i0p, i0m, i1p, i1m, i2p, i2m;
206 for (ib = 0; ib <
nb; ib++) {
207 for (i0 = 0; i0 <
ng[0]; i0++) {
210 for (i1 = 0; i1 <
ng[1]; i1++) {
213 for (i2 = 0; i2 <
ng[2]; i2++) {
217 de[0] =
eig[ib][i0p][i1][i2] -
eig[ib][i0m][i1][i2];
218 de[1] =
eig[ib][i0][i1p][i2] -
eig[ib][i0][i1m][i2];
219 de[2] =
eig[ib][i0][i1][i2p] -
eig[ib][i0][i1][i2m];
220 for (ii = 0; ii < 3; ii++)de[ii] *= 0.5f * (GLfloat)
ng[ii];
221 for (ii = 0; ii < 3; ii++)
vf[ib][i0][i1][i2][ii] =
222 avec[0][ii] * de[0] +
avec[1][ii] * de[1] +
avec[2][ii] * de[2];