/[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 471 - (show annotations)
Fri Jan 27 01:33:02 2006 UTC (13 years, 8 months ago) by jgs
File MIME type: text/plain
File size: 6344 byte(s)
reorganise finley src tree to remove inc dir and src/finley directory

1 /*
2 ******************************************************************************
3 * *
4 * COPYRIGHT ACcESS 2003,2004,2005 - All Rights Reserved *
5 * *
6 * This software is the property of ACcESS. No part of this code *
7 * may be copied in any form or by any means without the expressed written *
8 * consent of ACcESS. Copying, use or modification of this software *
9 * by any unauthorised person is illegal unless that person has a software *
10 * license agreement with ACcESS. *
11 * *
12 ******************************************************************************
13 */
14
15 /**************************************************************/
16
17 /* Updates the element matrices: */
18
19 /* assembles the system of numEq PDEs into the stiffness matrix S: */
20
21 /* -div(A*grad u)-div(B*u)+C*grad u + D*u */
22
23 /* -(A_{i,j} u_j)_i-(B_{i} u)_i+C_{j} u_j-D u */
24
25 /* u has numComp components. */
26
27 /* Shape of the coefficients: */
28
29 /* A = numDim x numDim */
30 /* B = numDim */
31 /* C = numDim */
32 /* D = 1 */
33
34
35 /**************************************************************/
36
37 /* Author: gross@access.edu.au */
38 /* Vresion: $Id$ */
39
40 /**************************************************************/
41
42 #include "Assemble.h"
43
44 /**************************************************************/
45 void Finley_Assemble_PDEMatrix_Single2(dim_t NS,dim_t numDim,dim_t numQuad,
46 double* S,double* DSDX, double* Vol,
47 dim_t NN, double* EM_S,
48 double* A, bool_t extendedA,
49 double* B, bool_t extendedB,
50 double* C, bool_t extendedC,
51 double* D, bool_t extendedD ) {
52 dim_t s,r,i,j,q;
53 double rtmp;
54
55 for (s=0;s<NS;s++) {
56 for (r=0;r<NS;r++) {
57 /**************************************************************/
58 /* process A: */
59 /**************************************************************/
60 if (NULL!=A) {
61 if (extendedA) {
62 for (i=0;i<numDim;i++) {
63 for (j=0;j<numDim;j++) {
64 for (q=0;q<numQuad;q++) {
65 EM_S[INDEX4(0,0,s,r,1,1,NN)]+=Vol[q]*DSDX[INDEX3(s,i,q,NS,numDim)]*
66 A[INDEX3(i,j,q,numDim,numDim)]*DSDX[INDEX3(r,j,q,NS,numDim)];
67
68 }
69 }
70 }
71 } else {
72 for (i=0;i<numDim;i++) {
73 for (j=0;j<numDim;j++) {
74 if (A[INDEX2(i,j,numDim)]!=0) {
75 rtmp=0;
76 for (q=0;q<numQuad;q++) rtmp+=Vol[q]*DSDX[INDEX3(s,i,q,NS,numDim)]*DSDX[INDEX3(r,j,q,NS,numDim)];
77 EM_S[INDEX4(0,0,s,r,1,1,NN)]+=rtmp*A[INDEX2(i,j,numDim)];
78 }
79 }
80 }
81 }
82 }
83 /**************************************************************/
84 /* process B: */
85 /**************************************************************/
86 if (NULL!=B) {
87 if (extendedB) {
88 for (i=0;i<numDim;i++) {
89 for (q=0;q<numQuad;q++) {
90 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)];
91 }
92 }
93 } else {
94 for (i=0;i<numDim;i++) {
95 if (B[i]!=0) {
96 rtmp=0;
97 for (q=0;q<numQuad;q++) rtmp+=Vol[q]*DSDX[INDEX3(s,i,q,NS,numDim)]*S[INDEX2(r,q,NS)];
98 EM_S[INDEX4(0,0,s,r,1,1,NN)]+=rtmp*B[i];
99 }
100 }
101 }
102 }
103 /**************************************************************/
104 /* process C: */
105 /**************************************************************/
106 if (NULL!=C) {
107 if (extendedC) {
108 for (j=0;j<numDim;j++) {
109 for (q=0;q<numQuad;q++) {
110 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)];
111 }
112 }
113 } else {
114 for (j=0;j<numDim;j++) {
115 if (C[j]!=0) {
116 rtmp=0;
117 for (q=0;q<numQuad;q++) rtmp+=Vol[q]*S[INDEX2(s,q,NS)]*DSDX[INDEX3(r,j,q,NS,numDim)];
118 EM_S[INDEX4(0,0,s,r,1,1,NN)]+=rtmp*C[j];
119 }
120 }
121 }
122 }
123 /************************************************************* */
124 /* process D */
125 /**************************************************************/
126 if (NULL!=D) {
127 if (extendedD) {
128 for (q=0;q<numQuad;q++) {
129 EM_S[INDEX4(0,0,s,r,1,1,NN)]+=Vol[q]*S[INDEX2(s,q,NS)]*D[q]*S[INDEX2(r,q,NS)];
130 }
131 } else {
132 if (D[0]!=0) {
133 rtmp=0;
134 for (q=0;q<numQuad;q++) rtmp+=Vol[q]*S[INDEX2(s,q,NS)]*S[INDEX2(r,q,NS)];
135 EM_S[INDEX4(0,0,s,r,1,1,NN)]+=rtmp*D[0];
136 }
137 }
138 }
139 }
140 }
141 }
142 /*
143 * $Log$
144 * Revision 1.3 2005/09/15 03:44:21 jgs
145 * Merge of development branch dev-02 back to main trunk on 2005-09-15
146 *
147 * Revision 1.2.2.1 2005/09/07 06:26:17 gross
148 * the solver from finley are put into the standalone package paso now
149 *
150 * Revision 1.2 2005/07/08 04:07:46 jgs
151 * Merge of development branch back to main trunk on 2005-07-08
152 *
153 * Revision 1.1.1.1.2.1 2005/06/29 02:34:47 gross
154 * some changes towards 64 integers in finley
155 *
156 * Revision 1.1.1.1 2004/10/26 06:53:57 jgs
157 * initial import of project esys2
158 *
159 * Revision 1.2 2004/07/30 04:37:06 gross
160 * escript and finley are linking now and RecMeshTest.py has been passed
161 *
162 * Revision 1.1 2004/07/02 04:21:13 gross
163 * Finley C code has been included
164 *
165 *
166 */

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26