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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 82 - (show annotations)
Tue Oct 26 06:53:54 2004 UTC (15 years, 4 months ago) by jgs
Original Path: trunk/esys2/finley/src/finleyC/Assemble_PDEMatrix_Single2.c
File MIME type: text/plain
File size: 5047 byte(s)
Initial revision

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(int NS,int numDim,int numQuad,
36 double* S,double* DSDX, double* Vol,
37 int NN, double* EM_S,
38 double* A, int extendedA,
39 double* B, int extendedB,
40 double* C, int extendedC,
41 double* D, int extendedD ) {
42 int 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.1 2004/10/26 06:53:57 jgs
135 * Initial revision
136 *
137 * Revision 1.2 2004/07/30 04:37:06 gross
138 * escript and finley are linking now and RecMeshTest.py has been passed
139 *
140 * Revision 1.1 2004/07/02 04:21:13 gross
141 * Finley C code has been included
142 *
143 *
144 */

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26