Sacado Package Browser (Single Doxygen Collection) Version of the Day
adic_element_fill.ad.c
Go to the documentation of this file.
00001 /************************** DISCLAIMER ********************************/
00002 /*                                                                    */
00003 /*   This file was generated on 04/13/12 11:10:49 by the version of   */
00004 /*   ADIC 1.2.3 compiled on  04/14/09 12:39:01                        */
00005 /*                                                                    */
00006 /*   ADIC was prepared as an account of work sponsored by an          */
00007 /*   agency of the United States Government and the University of     */
00008 /*   Chicago.  NEITHER THE AUTHOR(S), THE UNITED STATES GOVERNMENT    */
00009 /*   NOR ANY AGENCY THEREOF, NOR THE UNIVERSITY OF CHICAGO, INCLUDING */
00010 /*   ANY OF THEIR EMPLOYEES OR OFFICERS, MAKES ANY WARRANTY, EXPRESS  */
00011 /*   OR IMPLIED, OR ASSUMES ANY LEGAL LIABILITY OR RESPONSIBILITY FOR */
00012 /*   THE ACCURACY, COMPLETENESS, OR USEFULNESS OF ANY INFORMATION OR  */
00013 /*   PROCESS DISCLOSED, OR REPRESENTS THAT ITS USE WOULD NOT INFRINGE */
00014 /*   PRIVATELY OWNED RIGHTS.                                          */
00015 /*                                                                    */
00016 /**********************************************************************/
00017 #include "ad_deriv.h"
00018 #include <math.h>
00019 #include "adintrinsics.h"
00020 #include <stdlib.h>
00021 typedef struct  {
00022 int  nqp;
00023 int  nnode;
00024 InactiveDouble  *w, *jac, **phi, **dphi;
00025 int  *gid;
00026 }
00027 ElemData;
00028 void   adic_element_fill(ElemData  *e,unsigned int  neqn,const DERIV_TYPE  *x,DERIV_TYPE  *u,DERIV_TYPE  *du,DERIV_TYPE  *f) {
00029 unsigned int  var_0, var_1, var_2, var_3, var_4, var_5, var_6, var_7;
00030 DERIV_TYPE  var_8;
00031 double  adji_0;
00032     double  loc_0;
00033     double  loc_1;
00034     double  loc_2;
00035     double  loc_3;
00036     double  loc_4;
00037     double  loc_5;
00038     double  loc_6;
00039     double  loc_7;
00040     double  loc_8;
00041     double  loc_9;
00042     double  adj_0;
00043     double  adj_1;
00044     double  adj_2;
00045     double  adj_3;
00046 
00047         static int g_filenum = 0;
00048         if (g_filenum == 0) {
00049             adintr_ehsfid(&g_filenum, __FILE__, "adic_element_fill");
00050         }
00051             for (unsigned int  qp = 0;     qp < e->nqp;     )    {
00052         for (unsigned int  eqn = 0;         eqn < neqn;         )        {
00053             {
00054                 ad_grad_axpy_0(&(u[qp * neqn + eqn]));
00055                 DERIV_val(u[qp * neqn + eqn]) = 0.0;
00056             }
00057             {
00058                 ad_grad_axpy_0(&(du[qp * neqn + eqn]));
00059                 DERIV_val(du[qp * neqn + eqn]) = 0.0;
00060             }
00061             for (unsigned int  node = 0;             node < e->nnode;             )            {
00062                 {
00063                     loc_0 = DERIV_val(x[node * neqn + eqn]) * e->phi[qp][node];
00064                     loc_1 = DERIV_val(u[qp * neqn + eqn]) + loc_0;
00065                     ad_grad_axpy_2(&(u[qp * neqn + eqn]), 1.000000000000000e+00, &(u[qp * neqn + eqn]), e->phi[qp][node], &(x[node * neqn + eqn]));
00066                     DERIV_val(u[qp * neqn + eqn]) = loc_1;
00067                 }
00068                 {
00069                     loc_0 = DERIV_val(x[node * neqn + eqn]) * e->dphi[qp][node];
00070                     loc_1 = DERIV_val(du[qp * neqn + eqn]) + loc_0;
00071                     ad_grad_axpy_2(&(du[qp * neqn + eqn]), 1.000000000000000e+00, &(du[qp * neqn + eqn]), e->dphi[qp][node], &(x[node * neqn + eqn]));
00072                     DERIV_val(du[qp * neqn + eqn]) = loc_1;
00073                 }
00074                 var_2 = node++;
00075             }
00076             var_1 = eqn++;
00077         }
00078         var_0 = qp++;
00079     }
00080 DERIV_TYPE  *s = malloc(e->nqp *  sizeof (DERIV_TYPE ));
00081     for (unsigned int  qp = 0;     qp < e->nqp;     )    {
00082         {
00083             ad_grad_axpy_0(&(s[qp]));
00084             DERIV_val(s[qp]) = 0.0;
00085         }
00086         for (unsigned int  eqn = 0;         eqn < neqn;         )        {
00087             {
00088                 loc_0 = DERIV_val(u[qp * neqn + eqn]) * DERIV_val(u[qp * neqn + eqn]);
00089                 loc_1 = DERIV_val(s[qp]) + loc_0;
00090                 ad_grad_axpy_3(&(s[qp]), 1.000000000000000e+00, &(s[qp]), DERIV_val(u[qp * neqn + eqn]), &(u[qp * neqn + eqn]), DERIV_val(u[qp * neqn + eqn]), &(u[qp * neqn + eqn]));
00091                 DERIV_val(s[qp]) = loc_1;
00092             }
00093             var_4 = eqn++;
00094         }
00095         var_3 = qp++;
00096     }
00097     for (unsigned int  node = 0;     node < e->nnode;     )    {
00098         for (unsigned int  eqn = 0;         eqn < neqn;         )        {
00099 unsigned int  row = node * neqn + eqn;
00100             {
00101                 ad_grad_axpy_0(&(f[row]));
00102                 DERIV_val(f[row]) = 0.0;
00103             }
00104             for (unsigned int  qp = 0;             qp < e->nqp;             )            {
00105      DERIV_val(var_8) = exp(( DERIV_val(u[qp * neqn + eqn])));
00106       adji_0 = DERIV_val(var_8);
00107                 {
00108                     ad_grad_axpy_1(&(var_8), adji_0, &(u[qp * neqn + eqn]));
00109                 }
00110                 {
00111                     loc_0 = e->w[qp] * e->jac[qp];
00112                     loc_1 =  -e->dphi[qp][node];
00113                     loc_2 = e->jac[qp] * e->jac[qp];
00114                     loc_3 = loc_1 / loc_2;
00115                     loc_4 = loc_3 * DERIV_val(du[qp * neqn + eqn]);
00116                     loc_5 = e->phi[qp][node] * DERIV_val(s[qp]);
00117                     loc_6 = loc_5 * DERIV_val(var_8);
00118                     loc_7 = loc_4 + loc_6;
00119                     loc_8 = loc_0 * loc_7;
00120                     loc_9 = DERIV_val(f[row]) + loc_8;
00121                     adj_0 = loc_5 * loc_0;
00122                     adj_1 = DERIV_val(var_8) * loc_0;
00123                     adj_2 = e->phi[qp][node] * adj_1;
00124                     adj_3 = loc_3 * loc_0;
00125                     ad_grad_axpy_4(&(f[row]), 1.000000000000000e+00, &(f[row]), adj_3, &(du[qp * neqn + eqn]), adj_2, &(s[qp]), adj_0, &(var_8));
00126                     DERIV_val(f[row]) = loc_9;
00127                 }
00128                 var_7 = qp++;
00129             }
00130             var_6 = eqn++;
00131         }
00132         var_5 = node++;
00133     }
00134     free(s);
00135 }
00136 void   AD_Init(int  arg0) {
00137     ad_AD_GradInit(arg0);
00138 
00139 }
00140 void   AD_Final() {
00141     ad_AD_GradFinal();
00142 
00143 }
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines