Revision 1589
trunk/src/linad99/sgradclc.cpp (revision 1589)  

74  74 
long _cdecl _farptr_tolong(void _far *); 
75  75 
#endif 
76  76  
77 
//void KLUDGEX(void * p); 

78  
79  77 
/** 
80  78 
Compute the gradient from the data stored in the global \ref gradient_structure. 
81  79 
\param nvar Number of variables in the gradient. 
...  ...  
99  97 
gradient_structure::TOTAL_BYTES = 0; 
100  98 
gradient_structure::PREVIOUS_TOTAL_BYTES=0; 
101  99 
unsigned int i; 
102 
long int lpos; 

103  100 
if(!gradient_structure::instances) 
104  101 
{ 
105  102 
g.initialize(); 
...  ...  
113  110 
} 
114  111  
115  112 
gradient_structure::GRAD_STACK1>_GRADFILE_PTR = 
116 
gradient_structure::GRAD_STACK1>gradfile_handle();


113 
gradient_structure::GRAD_STACK1>gradfile_handle(); 

117  114  
118  115 
int& _GRADFILE_PTR=gradient_structure::GRAD_STACK1>_GRADFILE_PTR; 
119  116  
120 
lpos = lseek(_GRADFILE_PTR,0L,SEEK_CUR); 

117 
long int lpos = lseek(_GRADFILE_PTR,0L,SEEK_CUR);


121  118  
122 
if(gradient_structure::GRAD_STACK1>ptr


123 
<= gradient_structure::GRAD_STACK1>ptr_first)


119 
if (gradient_structure::GRAD_STACK1>ptr <=


120 
gradient_structure::GRAD_STACK1>ptr_first) 

124  121 
{ 
125  122 
/* 
126 
#ifdef SAFE_ARRAYS


127 
cerr << "warning  calling gradcalc when no calculations generating"


128 
<< endl << "derivative information have occurred" << endl;


129 
#endif


123 
#ifdef SAFE_ARRAYS 

124 
cerr << "warning  calling gradcalc when no calculations generating" 

125 
<< endl << "derivative information have occurred" << endl;


126 
#endif 

130  127 
*/ 
131  128 
g.initialize(); 
132  129 
return; 
...  ...  
140  137  
141  138 
gradient_structure::GRAD_STACK1>ptr; 
142  139  
143 
for (i=0; i<gradient_structure::GRAD_LIST>nlinks; i++)


140 
for (i = 0; i < gradient_structure::GRAD_LIST>nlinks; i++)


144  141 
{ 
145 
* (double*) (gradient_structure::GRAD_LIST>dlink_addresses[i]) = 0;


142 
*(double*)(gradient_structure::GRAD_LIST>dlink_addresses[i]) = 0;


146  143 
} 
147  144  
148 
#if defined (__BORLANDC__) && !defined(DOS386) 

149 
double_and_int huge * tmp; 

150 
#else 

151 
double_and_int * tmp; 

152 
#endif 

145 
#if defined (__BORLANDC__) && !defined(DOS386) 

146 
double_and_int huge* tmp = 

147 
(double_and_int huge *) gradient_structure::ARRAY_MEMBLOCK_BASE; 

148 
#else 

149 
double_and_int* tmp = 

150 
(double_and_int*)gradient_structure::ARRAY_MEMBLOCK_BASE; 

151 
#endif 

153  152  
154 
#if defined (__BORLANDC__) && !defined(DOS386) 

155 
tmp = (double_and_int huge *) gradient_structure::ARRAY_MEMBLOCK_BASE; 

156 
#else 

157 
tmp = (double_and_int *) gradient_structure::ARRAY_MEMBLOCK_BASE; 

158 
#endif 

159  
160 
unsigned long int max_last_offset = gradient_structure::ARR_LIST1>get_max_last_offset(); 

161  
162 
unsigned int size = sizeof(double_and_int ); 

163  
164 
double * zptr; 

165  
166 
for (i=0 ; i< (max_last_offset/size) ; i++ ) 

167 
{ 

153 
unsigned long int max_last_offset = gradient_structure::ARR_LIST1>get_max_last_offset(); 

154 
unsigned int size = sizeof(double_and_int); 

155 
for (i = 0; i < (max_last_offset/size); i++) 

156 
{ 

168  157 
tmp>x = 0; 
169 
#if defined (__ZTC__) 

170 
#if defined(DOS386) 

171 
tmp++; 

172 
#else 

173 
tmp = (double_and_int *) _farptr_norm( (void*) (++tmp) ); 

174 
#endif 

175 
#endif 

176 
#if defined (__BORLANDC__) 
Also available in: Unified diff