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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 155 - (hide annotations)
Wed Nov 9 02:02:19 2005 UTC (14 years, 3 months ago) by jgs
Original Path: trunk/finley/src/finleyC/Assemble_PDEMatrix_Single2.c
File MIME type: text/plain
File size: 6344 byte(s)
move all directories from trunk/esys2 into trunk and remove esys2

1 jgs 150 /*
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 jgs 82
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 jgs 150 /* Author: gross@access.edu.au */
38     /* Vresion: $Id$ */
39 jgs 82
40     /**************************************************************/
41    
42     #include "Assemble.h"
43    
44     /**************************************************************/
45 jgs 123 void Finley_Assemble_PDEMatrix_Single2(dim_t NS,dim_t numDim,dim_t numQuad,
46 jgs 82 double* S,double* DSDX, double* Vol,
47 jgs 123 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 jgs 82 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 jgs 150 * 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 jgs 123 * Revision 1.2 2005/07/08 04:07:46 jgs
151     * Merge of development branch back to main trunk on 2005-07-08
152 jgs 82 *
153 jgs 123 * 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 jgs 82 * 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