38 #if defined(CHECK_COUNT)
39 if (
ncount >= ncount_check)
45 +(2*nvar+11)*
sizeof(
double);
50 size_t slen=strlen(ids);
68 size_t sizeofdouble =
sizeof(double);
82 memcpy(
list,px->get_u_dot(),nvar*sizeofdouble);
83 memcpy(
list,py->get_u_dot(),nvar*sizeofdouble);
114 cerr <<
"illegal value for df1b2variable::pass = "
143 #if defined(SAFE_ALL)
156 double df1=*(
double*) bptr;
157 bptr+=
sizeof(double);
159 double df2=*(
double*) bptr;
160 bptr+=
sizeof(double);
162 double d2f11=*(
double*) bptr;
163 bptr+=
sizeof(double);
165 double d2f12=*(
double*) bptr;
166 bptr+=
sizeof(double);
168 double d2f22=*(
double*) bptr;
169 bptr+=
sizeof(double);
171 #if defined(PRINT_DERS)
172 double d3f111=*(
double*) bptr;
174 bptr+=
sizeof(double);
176 #if defined(PRINT_DERS)
177 double d3f112=*(
double*) bptr;
179 bptr+=
sizeof(double);
181 #if defined(PRINT_DERS)
182 double d3f122=*(
double*) bptr;
184 bptr+=
sizeof(double);
186 #if defined(PRINT_DERS)
187 double d3f222=*(
double*) bptr;
189 bptr+=
sizeof(double);
191 memcpy(&xu,bptr,
sizeof(
double));
192 bptr+=
sizeof(double);
193 memcpy(&yu,bptr,
sizeof(
double));
194 bptr+=
sizeof(double);
195 double * xdot=(
double*)bptr;
196 bptr+=nvar*
sizeof(double);
197 double * ydot=(
double*)bptr;
209 size_t total_bytes=2*nvar*
sizeof(double);
211 #if defined(SAFE_ALL)
213 size_t slen=strlen(ids);
218 void * tmpptr=list2.
bptr;
219 #if defined(SAFE_ALL)
224 size_t sizeofdouble =
sizeof(double);
232 #if defined(PRINT_DERS)
234 (df2),(d2f11),(d2f12),(d2f22),
235 (d3f111),(d3f112),(d3f122),
241 #if defined(__DERCHECK__)
243 if (derchecker->node_number)
245 if (derchecker->counter == derchecker->node_number)
247 switch (derchecker->pass_number)
250 switch(derchecker->vartype)
253 if (!derchecker->dotflag)
254 px->
u_bar[derchecker->index-1]+=derchecker->delta;
256 px->
u_dot_bar[derchecker->index-1]+=derchecker->delta;
259 if (!derchecker->dotflag)
260 py->
u_bar[derchecker->index-1]+=derchecker->delta;
262 py->
u_dot_bar[derchecker->index-1]+=derchecker->delta;
265 if (!derchecker->dotflag)
266 pz->
u_bar[derchecker->index-1]+=derchecker->delta;
268 pz->
u_dot_bar[derchecker->index-1]+=derchecker->delta;
271 cerr <<
"Invalid index value for dercheck_index was "
272 << derchecker->index <<
endl;
277 switch(derchecker->vartype)
280 if (!derchecker->dotflag)
281 px->
u_bar[derchecker->index-1]-=derchecker->delta;
283 px->
u_dot_bar[derchecker->index-1]-=derchecker->delta;
286 if (!derchecker->dotflag)
287 py->
u_bar[derchecker->index-1]-=derchecker->delta;
289 py->
u_dot_bar[derchecker->index-1]-=derchecker->delta;
292 if (!derchecker->dotflag)
293 pz->
u_bar[derchecker->index-1]-=derchecker->delta;
295 pz->
u_dot_bar[derchecker->index-1]-=derchecker->delta;
298 cerr <<
"Invalid index value for dercheck_index was "
299 << derchecker->index <<
endl;
310 double* px_u_bari = px->
u_bar;
311 double* pz_u_bari = pz->
u_bar;
314 *px_u_bari += df1 * *pz_u_bari;
319 double* py_u_bari = py->
u_bar;
320 pz_u_bari = pz->
u_bar;
323 *py_u_bari += df2 * *pz_u_bari;
328 px_u_bari = px->
u_bar;
330 double* xdoti = xdot;
331 double* ydoti = ydot;
334 *px_u_bari += d2f11 * *xdoti * *pz_u_dot_bari;
335 *px_u_bari += d2f12 * *ydoti * *pz_u_dot_bari;
342 #if defined(ADDEBUG_PRINT)
343 cout << px->
u_bar[i] <<
" " << pz->
u_dot_bar[i] <<
" " << addebug_count
347 py_u_bari = py->
u_bar;
355 *py_u_bari += d2f22 * *ydoti * *pz_u_dot_bari;
356 *py_u_bari += d2f12 * *xdoti * *pz_u_dot_bari;
363 #if defined(ADDEBUG_PRINT)
364 cout << py->
u_bar[i] <<
" " << pz->
u_dot_bar[i] <<
" " << addebug_count
373 *px_u_dot_bari += df1 * *pz_u_dot_bari;
377 #if defined(ADDEBUG_PRINT)
386 *py_u_dot_bari += df2 * *pz_u_dot_bari;
390 #if defined(ADDEBUG_PRINT)
397 memset(pz->
u_dot_bar, 0, nvar * sizeofdouble);
398 memset(pz->
u_bar, 0, nvar * sizeofdouble);
400 #if defined(PRINT_DERS)
422 +(2*nvar+11)*
sizeof(
double);
426 #if defined(SAFE_ALL)
428 size_t slen=strlen(ids);
448 int num_bytes2=*nlist2.
bptr;
462 #if defined(SAFE_ALL)
493 constexpr
size_t sizeofdouble =
sizeof(double);
494 double df1=*(
double*) list.
bptr;
495 list.
bptr+=
sizeof(
double);
497 double df2=*(
double*) list.
bptr;
498 list.
bptr+=sizeofdouble;
500 double d2f11=*(
double*) list.
bptr;
501 list.
bptr+=sizeofdouble;
503 double d2f12=*(
double*) list.
bptr;
504 list.
bptr+=sizeofdouble;
506 double d2f22=*(
double*) list.
bptr;
507 list.
bptr+=sizeofdouble;
509 double d3f111=*(
double*) list.
bptr;
510 list.
bptr+=sizeofdouble;
512 double d3f112=*(
double*) list.
bptr;
513 list.
bptr+=sizeofdouble;
515 double d3f122=*(
double*) list.
bptr;
516 list.
bptr+=sizeofdouble;
518 double d3f222=*(
double*) list.
bptr;
519 list.
bptr+=sizeofdouble;
522 list.
bptr+=sizeofdouble;
524 list.
bptr+=sizeofdouble;
525 double * xdot=(
double*)list.
bptr;
526 list.
bptr+=nvar*sizeofdouble;
527 double * ydot=(
double*)list.
bptr;
534 zbar=(
double*)list2.
bptr;
535 zdotbar=(
double*)(list2.
bptr+nvar*sizeofdouble);
549 #if defined(PRINT_DERS)
551 (df2),(d2f11),(d2f12),(d2f22),
552 (d3f111),(d3f112),(d3f122),
559 memset(z_bar_tilde, 0, nvar * sizeofdouble);
560 memset(z_dot_bar_tilde, 0, nvar * sizeofdouble);
564 double* x_bar_tildei = x_bar_tilde;
565 double* zbari = zbar;
566 double* z_bar_tildei = z_bar_tilde;
567 for (
size_t i=0;i<nvar;i++)
569 *x_tilde += d2f11 * *zbari * *x_bar_tildei;
570 *z_bar_tildei += df1 * *x_bar_tildei;
571 *y_tilde += d2f12 * *zbari * *x_bar_tildei;
578 double* x_dot_bar_tildei = x_dot_bar_tilde;
579 double* zdotbari = zdotbar;
580 double* z_dot_bar_tildei = z_dot_bar_tilde;
581 for (
size_t i=0;i<nvar;i++)
583 *x_tilde += d2f11 * *zdotbari * *x_dot_bar_tildei;
584 *y_tilde += d2f12 * *zdotbari * *x_dot_bar_tildei;
585 *z_dot_bar_tildei += df1 * *x_dot_bar_tildei;
591 x_bar_tildei = x_bar_tilde;
593 double* xdoti = xdot;
594 double* x_dot_tildei = x_dot_tilde;
595 z_dot_bar_tildei = z_dot_bar_tilde;
596 for (
size_t i=0;i<nvar;i++)
598 *x_dot_tildei += d2f11 * *zdotbari * *x_bar_tildei;
599 *z_dot_bar_tildei += d2f11 * *xdoti * *x_bar_tildei;
600 *x_tilde += d3f111 * *xdoti * *zdotbari * *x_bar_tildei;
601 *y_tilde += d3f112 * *xdoti * *zdotbari * *x_bar_tildei;
610 double* y_bar_tildei = y_bar_tilde;
612 z_bar_tildei = z_bar_tilde;
613 for (
size_t i=0;i<nvar;i++)
615 *y_tilde += d2f22 * *zbari * *y_bar_tildei;
616 *x_tilde += d2f12 * *zbari * *y_bar_tildei;
617 *z_bar_tildei += df2 * *y_bar_tildei;
623 double* y_dot_bar_tildei = y_dot_bar_tilde;
625 z_dot_bar_tildei = z_dot_bar_tilde;
626 for (
size_t i=0;i<nvar;i++)
628 *y_tilde += d2f22 * *zdotbari * *y_dot_bar_tildei;
629 *x_tilde += d2f12 * *zdotbari * *y_dot_bar_tildei;
630 *z_dot_bar_tildei += df2 * *y_dot_bar_tildei;
636 y_bar_tildei = y_bar_tilde;
638 double* ydoti = ydot;
639 double* y_dot_tildei = y_dot_tilde;
640 z_dot_bar_tildei = z_dot_bar_tilde;
641 for (
size_t i=0;i<nvar;i++)
643 *y_dot_tildei += d2f22 * *zdotbari * *y_bar_tildei;
644 *z_dot_bar_tildei += d2f22 * *ydoti * *y_bar_tildei;
645 *y_tilde += d3f222 * *ydoti * *zdotbari * *y_bar_tildei;
646 *x_tilde += d3f122 * *ydoti * *zdotbari * *y_bar_tildei;
654 x_bar_tildei = x_bar_tilde;
657 y_dot_tildei = y_dot_tilde;
658 z_dot_bar_tildei = z_dot_bar_tilde;
659 for (
size_t i=0;i<nvar;i++)
661 *x_tilde += d3f112 * *ydoti * *zdotbari * *x_bar_tildei;
662 *y_tilde += d3f122 * *ydoti * *zdotbari * *x_bar_tildei;
663 *y_dot_tildei += d2f12 * *zdotbari * *x_bar_tildei;
664 *z_dot_bar_tildei += d2f12 * *ydoti * *x_bar_tildei;
673 y_bar_tildei = y_bar_tilde;
675 x_dot_tildei = x_dot_tilde;
676 z_dot_bar_tildei = z_dot_bar_tilde;
677 for (
size_t i=0;i<nvar;i++)
679 *x_tilde+= d3f112 * *xdoti * *zdotbari * *y_bar_tildei;
680 *y_tilde+= d3f122 * *xdoti * *zdotbari * *y_bar_tildei;
681 *x_dot_tildei += d2f12 * *zdotbari * *y_bar_tildei;
682 *z_dot_bar_tildei += d2f12 * *xdoti * *y_bar_tildei;
690 #if defined(__DERCHECK__)
691 if (derchecker->node_number)
693 if (derchecker->counter == derchecker->node_number)
695 if (derchecker->pass_number==1)
697 switch(derchecker->vartype)
700 if (!derchecker->dotflag)
701 derchecker->der_value=
704 derchecker->der_value=
708 if (!derchecker->dotflag)
709 derchecker->der_value=
712 derchecker->der_value=
716 if (!derchecker->dotflag)
717 derchecker->der_value=
720 derchecker->der_value=
724 cerr <<
"Invalid index value for dercheck_index was "
725 << derchecker->index <<
endl;
731 #if defined(PRINT_DERS)
764 #if defined(SAFE_ALL)
784 constexpr
size_t sizeofdouble =
sizeof(double);
794 double df1=*(
double*) list.
bptr;
795 list.
bptr+=sizeofdouble;
797 double df2=*(
double*) list.
bptr;
798 list.
bptr+=sizeofdouble;
800 double d2f11=*(
double*) list.
bptr;
801 list.
bptr+=sizeofdouble;
803 double d2f12=*(
double*) list.
bptr;
804 list.
bptr+=sizeofdouble;
806 double d2f22=*(
double*) list.
bptr;
807 list.
bptr+=sizeofdouble;
809 #
if defined(PRINT_DERS)
810 double d3f111=*(
double*) list.
bptr;
812 list.
bptr+=sizeofdouble;
814 #
if defined(PRINT_DERS)
815 double d3f112=*(
double*) list.
bptr;
817 list.
bptr+=sizeofdouble;
819 #
if defined(PRINT_DERS)
820 double d3f122=*(
double*) list.
bptr;
822 list.
bptr+=sizeofdouble;
824 #
if defined(PRINT_DERS)
825 double d3f222=*(
double*) list.
bptr;
827 list.
bptr+=sizeofdouble;
830 list.
bptr+=sizeofdouble;
832 list.
bptr+=sizeofdouble;
833 double * xdot=(
double*)list.
bptr;
834 list.
bptr+=nvar*sizeofdouble;
835 double * ydot=(
double*)list.
bptr;
838 #if defined(PRINT_DERS)
840 (df2),(d2f11),(d2f12),(d2f22),
841 (d3f111),(d3f112),(d3f122),
852 double* xdoti = xdot;
853 double* ydoti = ydot;
854 for (
size_t i=0;i<nvar;i++)
856 *(px->
u_tilde) += d2f11 * *xdoti * *pz_u_dot_tildei;
857 *(py->
u_tilde) += d2f12 * *xdoti * *pz_u_dot_tildei;
858 *(py->
u_tilde) += d2f22 * *ydoti * *pz_u_dot_tildei;
859 *(px->
u_tilde) += d2f12 * *ydoti * *pz_u_dot_tildei;
869 for (
size_t i=0;i<nvar;i++)
871 *px_u_dot_tildei += df1 * *pz_u_dot_tildei;
872 *py_u_dot_tildei += df2 * *pz_u_dot_tildei;
880 #if defined(PRINT_DERS)
void check_buffer_size(const size_t)
Description not yet available.
df1b2_gradlist * f1b2gradlist
void memcpy(test_smartlist &dest, void *source, const size_t nsize)
memcpy for test_smartlist
void read_pass2_2_dvdv(void)
Description not yet available.
#define ADUNCONST(type, obj)
Creates a shallow copy of obj that is not CONST.
int adptr_diff(void *x, void *y)
void ncount_checker(int ncount, int ncount_check)
void restoreposition(void)
Description not yet available.
Description not yet available.
Description not yet available.
prnstream & endl(prnstream &)
void print_derivatives(const adstring &s, double f, double df, double d2f, double d3f, int bflag)
Description not yet available.
void read_pass2_3_dvdv(void)
Description not yet available.
void read_pass2_1_dvdv(void)
Description not yet available.
Description not yet available.
int write_pass1(const df1b2variable *px, const df1b2variable *py, df1b2variable *pz, df1b2function2 *pf)
Description not yet available.
void ad_read_pass2_dvdv(void)
Description not yet available.
Description not yet available.
void checkidentiferstring(const char *ids, test_smartlist &list)
Description not yet available.