/[escript]/trunk/esys2/finley/src/finleyC/Assemble_PDEMatrix_Single2.c
ViewVC logotype

Contents of /trunk/esys2/finley/src/finleyC/Assemble_PDEMatrix_Single2.c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 123 - (show annotations)
Fri Jul 8 04:08:13 2005 UTC (14 years, 8 months ago) by jgs
File MIME type: text/plain
File size: 5298 byte(s)
Merge of development branch back to main trunk on 2005-07-08

1 /* $Id$ */
2
3 /**************************************************************/
4
5 /* Updates the element matrices: */
6
7 /* assembles the system of numEq PDEs into the stiffness matrix S: */
8
9 /* -div(A*grad u)-div(B*u)+C*grad u + D*u */
10
11 /* -(A_{i,j} u_j)_i-(B_{i} u)_i+C_{j} u_j-D u */
12
13 /* u has numComp components. */
14
15 /* Shape of the coefficients: */
16
17 /* A = numDim x numDim */
18 /* B = numDim */
19 /* C = numDim */
20 /* D = 1 */
21
22
23 /**************************************************************/
24
25 /* Copyrights by ACcESS Australia, 2003 */
26 /* author: gross@access.edu.au */
27 /* Version: $Id$ */
28
29 /**************************************************************/
30
31 #include "Common.h"
32 #include "Assemble.h"
33
34 /**************************************************************/
35 void Finley_Assemble_PDEMatrix_Single2(dim_t NS,dim_t numDim,dim_t numQuad,
36 double* S,double* DSDX, double* Vol,
37 dim_t NN, double* EM_S,
38 double* A, bool_t extendedA,
39 double* B, bool_t extendedB,
40 double* C, bool_t extendedC,
41 double* D, bool_t extendedD ) {
42 dim_t s,r,i,j,q;
43 double rtmp;
44
45 for (s=0;s<NS;s++) {
46 for (r=0;r<NS;r++) {
47 /**************************************************************/
48 /* process A: */
49 /**************************************************************/
50 if (NULL!=A) {
51 if (extendedA) {
52 for (i=0;i<numDim;i++) {
53 for (j=0;j<numDim;j++) {
54 for (q=0;q<numQuad;q++) {
55 EM_S[INDEX4(0,0,s,r,1,1,NN)]+=Vol[q]*DSDX[INDEX3(s,i,q,NS,numDim)]*
56 A[INDEX3(i,j,q,numDim,numDim)]*DSDX[INDEX3(r,j,q,NS,numDim)];
57
58 }
59 }
60 }
61 } else {
62 for (i=0;i<numDim;i++) {
63 for (j=0;j<numDim;j++) {
64 if (A[INDEX2(i,j,numDim)]!=0) {
65 rtmp=0;
66 for (q=0;q<numQuad;q++) rtmp+=Vol[q]*DSDX[INDEX3(s,i,q,NS,numDim)]*DSDX[INDEX3(r,j,q,NS,numDim)];
67 EM_S[INDEX4(0,0,s,r,1,1,NN)]+=rtmp*A[INDEX2(i,j,numDim)];
68 }
69 }
70 }
71 }
72 }
73 /**************************************************************/
74 /* process B: */
75 /**************************************************************/
76 if (NULL!=B) {
77 if (extendedB) {
78 for (i=0;i<numDim;i++) {
79 for (q=0;q<numQuad;q++) {
80 EM_S[INDEX4(0,0,s,r,1,1,NN)]+=Vol[q]*DSDX[INDEX3(s,i,q,NS,numDim)]*B[INDEX2(i,q,numDim)]*S[INDEX2(r,q,NS)];
81 }
82 }
83 } else {
84 for (i=0;i<numDim;i++) {
85 if (B[i]!=0) {
86 rtmp=0;
87 for (q=0;q<numQuad;q++) rtmp+=Vol[q]*DSDX[INDEX3(s,i,q,NS,numDim)]*S[INDEX2(r,q,NS)];
88 EM_S[INDEX4(0,0,s,r,1,1,NN)]+=rtmp*B[i];
89 }
90 }
91 }
92 }
93 /**************************************************************/
94 /* process C: */
95 /**************************************************************/
96 if (NULL!=C) {
97 if (extendedC) {
98 for (j=0;j<numDim;j++) {
99 for (q=0;q<numQuad;q++) {
100 EM_S[INDEX4(0,0,s,r,1,1,NN)]+=Vol[q]*S[INDEX2(s,q,NS)]*C[INDEX2(j,q,numDim)]*DSDX[INDEX3(r,j,q,NS,numDim)];
101 }
102 }
103 } else {
104 for (j=0;j<numDim;j++) {
105 if (C[j]!=0) {
106 rtmp=0;
107 for (q=0;q<numQuad;q++) rtmp+=Vol[q]*S[INDEX2(s,q,NS)]*DSDX[INDEX3(r,j,q,NS,numDim)];
108 EM_S[INDEX4(0,0,s,r,1,1,NN)]+=rtmp*C[j];
109 }
110 }
111 }
112 }
113 /************************************************************* */
114 /* process D */
115 /**************************************************************/
116 if (NULL!=D) {
117 if (extendedD) {
118 for (q=0;q<numQuad;q++) {
119 EM_S[INDEX4(0,0,s,r,1,1,NN)]+=Vol[q]*S[INDEX2(s,q,NS)]*D[q]*S[INDEX2(r,q,NS)];
120 }
121 } else {
122 if (D[0]!=0) {
123 rtmp=0;
124 for (q=0;q<numQuad;q++) rtmp+=Vol[q]*S[INDEX2(s,q,NS)]*S[INDEX2(r,q,NS)];
125 EM_S[INDEX4(0,0,s,r,1,1,NN)]+=rtmp*D[0];
126 }
127 }
128 }
129 }
130 }
131 }
132 /*
133 * $Log$
134 * Revision 1.2 2005/07/08 04:07:46 jgs
135 * Merge of development branch back to main trunk on 2005-07-08
136 *
137 * Revision 1.1.1.1.2.1 2005/06/29 02:34:47 gross
138 * some changes towards 64 integers in finley
139 *
140 * Revision 1.1.1.1 2004/10/26 06:53:57 jgs
141 * initial import of project esys2
142 *
143 * Revision 1.2 2004/07/30 04:37:06 gross
144 * escript and finley are linking now and RecMeshTest.py has been passed
145 *
146 * Revision 1.1 2004/07/02 04:21:13 gross
147 * Finley C code has been included
148 *
149 *
150 */

Properties

Name Value
svn:eol-style native
svn:keywords Author Date Id Revision

  ViewVC Help
Powered by ViewVC 1.1.26