Sacado Package Browser (Single Doxygen Collection)  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
adic_element_fill.ad.c
Go to the documentation of this file.
1 /************************** DISCLAIMER ********************************/
2 /* */
3 /* This file was generated on 04/13/12 11:10:49 by the version of */
4 /* ADIC 1.2.3 compiled on 04/14/09 12:39:01 */
5 /* */
6 /* ADIC was prepared as an account of work sponsored by an */
7 /* agency of the United States Government and the University of */
8 /* Chicago. NEITHER THE AUTHOR(S), THE UNITED STATES GOVERNMENT */
9 /* NOR ANY AGENCY THEREOF, NOR THE UNIVERSITY OF CHICAGO, INCLUDING */
10 /* ANY OF THEIR EMPLOYEES OR OFFICERS, MAKES ANY WARRANTY, EXPRESS */
11 /* OR IMPLIED, OR ASSUMES ANY LEGAL LIABILITY OR RESPONSIBILITY FOR */
12 /* THE ACCURACY, COMPLETENESS, OR USEFULNESS OF ANY INFORMATION OR */
13 /* PROCESS DISCLOSED, OR REPRESENTS THAT ITS USE WOULD NOT INFRINGE */
14 /* PRIVATELY OWNED RIGHTS. */
15 /* */
16 /**********************************************************************/
17 #include "ad_deriv.h"
18 #include <math.h>
19 #include "adintrinsics.h"
20 #include <stdlib.h>
21 typedef struct {
22 int nqp;
23 int nnode;
24 InactiveDouble *w, *jac, **phi, **dphi;
25 int *gid;
26 }
27 ElemData;
28 void adic_element_fill(ElemData *e,unsigned int neqn,const DERIV_TYPE *x,DERIV_TYPE *u,DERIV_TYPE *du,DERIV_TYPE *f) {
29 unsigned int var_0, var_1, var_2, var_3, var_4, var_5, var_6, var_7;
30 DERIV_TYPE var_8;
31 double adji_0;
32  double loc_0;
33  double loc_1;
34  double loc_2;
35  double loc_3;
36  double loc_4;
37  double loc_5;
38  double loc_6;
39  double loc_7;
40  double loc_8;
41  double loc_9;
42  double adj_0;
43  double adj_1;
44  double adj_2;
45  double adj_3;
46 
47  static int g_filenum = 0;
48  if (g_filenum == 0) {
49  adintr_ehsfid(&g_filenum, __FILE__, "adic_element_fill");
50  }
51  for (unsigned int qp = 0; qp < e->nqp; ) {
52  for (unsigned int eqn = 0; eqn < neqn; ) {
53  {
54  ad_grad_axpy_0(&(u[qp * neqn + eqn]));
55  DERIV_val(u[qp * neqn + eqn]) = 0.0;
56  }
57  {
58  ad_grad_axpy_0(&(du[qp * neqn + eqn]));
59  DERIV_val(du[qp * neqn + eqn]) = 0.0;
60  }
61  for (unsigned int node = 0; node < e->nnode; ) {
62  {
63  loc_0 = DERIV_val(x[node * neqn + eqn]) * e->phi[qp][node];
64  loc_1 = DERIV_val(u[qp * neqn + eqn]) + loc_0;
65  ad_grad_axpy_2(&(u[qp * neqn + eqn]), 1.000000000000000e+00, &(u[qp * neqn + eqn]), e->phi[qp][node], &(x[node * neqn + eqn]));
66  DERIV_val(u[qp * neqn + eqn]) = loc_1;
67  }
68  {
69  loc_0 = DERIV_val(x[node * neqn + eqn]) * e->dphi[qp][node];
70  loc_1 = DERIV_val(du[qp * neqn + eqn]) + loc_0;
71  ad_grad_axpy_2(&(du[qp * neqn + eqn]), 1.000000000000000e+00, &(du[qp * neqn + eqn]), e->dphi[qp][node], &(x[node * neqn + eqn]));
72  DERIV_val(du[qp * neqn + eqn]) = loc_1;
73  }
74  var_2 = node++;
75  }
76  var_1 = eqn++;
77  }
78  var_0 = qp++;
79  }
80 DERIV_TYPE *s = malloc(e->nqp * sizeof (DERIV_TYPE ));
81  for (unsigned int qp = 0; qp < e->nqp; ) {
82  {
83  ad_grad_axpy_0(&(s[qp]));
84  DERIV_val(s[qp]) = 0.0;
85  }
86  for (unsigned int eqn = 0; eqn < neqn; ) {
87  {
88  loc_0 = DERIV_val(u[qp * neqn + eqn]) * DERIV_val(u[qp * neqn + eqn]);
89  loc_1 = DERIV_val(s[qp]) + loc_0;
90  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]));
91  DERIV_val(s[qp]) = loc_1;
92  }
93  var_4 = eqn++;
94  }
95  var_3 = qp++;
96  }
97  for (unsigned int node = 0; node < e->nnode; ) {
98  for (unsigned int eqn = 0; eqn < neqn; ) {
99 unsigned int row = node * neqn + eqn;
100  {
101  ad_grad_axpy_0(&(f[row]));
102  DERIV_val(f[row]) = 0.0;
103  }
104  for (unsigned int qp = 0; qp < e->nqp; ) {
105  DERIV_val(var_8) = exp(( DERIV_val(u[qp * neqn + eqn])));
106  adji_0 = DERIV_val(var_8);
107  {
108  ad_grad_axpy_1(&(var_8), adji_0, &(u[qp * neqn + eqn]));
109  }
110  {
111  loc_0 = e->w[qp] * e->jac[qp];
112  loc_1 = -e->dphi[qp][node];
113  loc_2 = e->jac[qp] * e->jac[qp];
114  loc_3 = loc_1 / loc_2;
115  loc_4 = loc_3 * DERIV_val(du[qp * neqn + eqn]);
116  loc_5 = e->phi[qp][node] * DERIV_val(s[qp]);
117  loc_6 = loc_5 * DERIV_val(var_8);
118  loc_7 = loc_4 + loc_6;
119  loc_8 = loc_0 * loc_7;
120  loc_9 = DERIV_val(f[row]) + loc_8;
121  adj_0 = loc_5 * loc_0;
122  adj_1 = DERIV_val(var_8) * loc_0;
123  adj_2 = e->phi[qp][node] * adj_1;
124  adj_3 = loc_3 * loc_0;
125  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));
126  DERIV_val(f[row]) = loc_9;
127  }
128  var_7 = qp++;
129  }
130  var_6 = eqn++;
131  }
132  var_5 = node++;
133  }
134  free(s);
135 }
136 void AD_Init(int arg0) {
137  ad_AD_GradInit(arg0);
138 
139 }
140 void AD_Final() {
141  ad_AD_GradFinal();
142 
143 }
void AD_Init(int)
InactiveDouble * jac
InactiveDouble * w
#define DERIV_val(a)
Definition: ad_deriv.h:40
void AD_Final()
void adic_element_fill(ElemData *e, unsigned int neqn, const DERIV_TYPE *x, DERIV_TYPE *u, DERIV_TYPE *du, DERIV_TYPE *f)
double InactiveDouble
Definition: ad_deriv.h:20
InactiveDouble ** phi
InactiveDouble ** dphi
exp(expr.val())