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 01/12/10 10:38:06 by the version of   */
00004 /*   ADIC compiled on  08/30/00 16:47:46                              */
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, var_8;
00030 DERIV_TYPE  var_9;
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  loc_10;
00043     double  loc_11;
00044     double  adj_0;
00045     double  adj_1;
00046     double  adj_2;
00047     double  adj_3;
00048     double  adj_4;
00049 
00050         static int g_filenum = 0;
00051         if (g_filenum == 0) {
00052             adintr_ehsfid(&g_filenum, __FILE__, "adic_element_fill");
00053         }
00054             for (unsigned int  qp = 0;     qp < e->nqp;     )    {
00055         for (unsigned int  eqn = 0;         eqn < neqn;         )        {
00056             {
00057                 ad_grad_axpy_0(&(u[qp * neqn + eqn]));
00058                 DERIV_val(u[qp * neqn + eqn]) = 0.0;
00059             }
00060             {
00061                 ad_grad_axpy_0(&(du[qp * neqn + eqn]));
00062                 DERIV_val(du[qp * neqn + eqn]) = 0.0;
00063             }
00064             for (unsigned int  node = 0;             node < e->nnode;             )            {
00065                 {
00066                     loc_0 = DERIV_val(x[node * neqn + eqn]) * e->phi[qp][node];
00067                     loc_1 = DERIV_val(u[qp * neqn + eqn]) + loc_0;
00068                     ad_grad_axpy_2(&(u[qp * neqn + eqn]), 1.000000000000000e+00, &(u[qp * neqn + eqn]), e->phi[qp][node], &(x[node * neqn + eqn]));
00069                     DERIV_val(u[qp * neqn + eqn]) = loc_1;
00070                 }
00071                 {
00072                     loc_0 = DERIV_val(x[node * neqn + eqn]) * e->dphi[qp][node];
00073                     loc_1 = DERIV_val(du[qp * neqn + eqn]) + loc_0;
00074                     ad_grad_axpy_2(&(du[qp * neqn + eqn]), 1.000000000000000e+00, &(du[qp * neqn + eqn]), e->dphi[qp][node], &(x[node * neqn + eqn]));
00075                     DERIV_val(du[qp * neqn + eqn]) = loc_1;
00076                 }
00077                 var_2 = node++;
00078             }
00079             var_1 = eqn++;
00080         }
00081         var_0 = qp++;
00082     }
00083 DERIV_TYPE  *s = malloc((e->nqp * neqn) *  sizeof (DERIV_TYPE ));
00084     for (unsigned int  qp = 0;     qp < e->nqp;     )    {
00085         for (unsigned int  eqn = 0;         eqn < neqn;         )        {
00086             {
00087                 ad_grad_axpy_0(&(s[qp * neqn + eqn]));
00088                 DERIV_val(s[qp * neqn + eqn]) = 0.0;
00089             }
00090             for (unsigned int  j = 0;             j < neqn;             )            {
00091                 if (j != eqn)                 {
00092                     {
00093                         loc_0 = DERIV_val(s[qp * neqn + eqn]) + DERIV_val(u[qp * neqn + j]);
00094                         ad_grad_axpy_2(&(s[qp * neqn + eqn]), 1.000000000000000e+00, &(s[qp * neqn + eqn]), 1.000000000000000e+00, &(u[qp * neqn + j]));
00095                         DERIV_val(s[qp * neqn + eqn]) = loc_0;
00096                     }
00097                 }
00098                 var_5 = j++;
00099             }
00100             var_4 = eqn++;
00101         }
00102         var_3 = qp++;
00103     }
00104     for (unsigned int  node = 0;     node < e->nnode;     )    {
00105         for (unsigned int  eqn = 0;         eqn < neqn;         )        {
00106 unsigned int  row = node * neqn + eqn;
00107             {
00108                 ad_grad_axpy_0(&(f[row]));
00109                 DERIV_val(f[row]) = 0.0;
00110             }
00111             for (unsigned int  qp = 0;             qp < e->nqp;             )            {
00112      DERIV_val(var_9) = exp(( DERIV_val(u[qp * neqn + eqn])));  /*exp*/
00113       adji_0 = DERIV_val(var_9);
00114                 {
00115                     ad_grad_axpy_1(&(var_9), adji_0, &(u[qp * neqn + eqn]));
00116                 }
00117                 {
00118                     loc_0 = e->w[qp] * e->jac[qp];
00119                     loc_1 = e->jac[qp] * e->jac[qp];
00120                     loc_2 = 1.0 / loc_1;
00121                     loc_3 =  -loc_2;
00122                     loc_4 = loc_3 * DERIV_val(du[qp * neqn + eqn]);
00123                     loc_5 = loc_4 * e->dphi[qp][node];
00124                     loc_6 = DERIV_val(u[qp * neqn + eqn]) * DERIV_val(s[qp * neqn + eqn]);
00125                     loc_7 = DERIV_val(var_9) + loc_6;
00126                     loc_8 = e->phi[qp][node] * loc_7;
00127                     loc_9 = loc_5 + loc_8;
00128                     loc_10 = loc_0 * loc_9;
00129                     loc_11 = DERIV_val(f[row]) + loc_10;
00130                     adj_0 = e->phi[qp][node] * loc_0;
00131                     adj_1 = DERIV_val(u[qp * neqn + eqn]) * adj_0;
00132                     adj_2 = DERIV_val(s[qp * neqn + eqn]) * adj_0;
00133                     adj_3 = e->dphi[qp][node] * loc_0;
00134                     adj_4 = loc_3 * adj_3;
00135                     ad_grad_axpy_5(&(f[row]), 1.000000000000000e+00, &(f[row]), adj_4, &(du[qp * neqn + eqn]), adj_0, &(var_9), adj_2, &(u[qp * neqn + eqn]), adj_1, &(s[qp * neqn + eqn]));
00136                     DERIV_val(f[row]) = loc_11;
00137                 }
00138                 var_8 = qp++;
00139             }
00140             var_7 = eqn++;
00141         }
00142         var_6 = node++;
00143     }
00144     free(s);
00145 }
00146 void   AD_Init(int  arg0) {
00147     ad_AD_GradInit(arg0);
00148 
00149 }
00150 void   AD_Final() {
00151     ad_AD_GradFinal();
00152 
00153 }
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines