# Contents of /trunk-mpi-branch/finley/src/Assemble_PDE_Single2_2D.c

Revision 968 - (show annotations)
Tue Feb 13 22:56:57 2007 UTC (13 years, 3 months ago) by ksteube
File MIME type: text/plain
File size: 14738 byte(s)
```Branch for MPI solution of implicit problems
```
 1 /* 2 ************************************************************ 3 * Copyright 2006 by ACcESS MNRF * 4 * * 5 * http://www.access.edu.au * 6 * Primary Business: Queensland, Australia * 7 * Licensed under the Open Software License version 3.0 * 8 * http://www.opensource.org/licenses/osl-3.0.php * 9 * * 10 ************************************************************ 11 */ 12 13 /**************************************************************/ 14 15 /* assembles the system of numEq PDEs into the stiffness matrix S right hand side F */ 16 /* the shape functions for test and solution must be identical */ 17 18 19 /* -(A_{i,j} u_,j)_i-(B_{i} u)_i+C_{j} u_,j-D u_m and -(X_,i)_i + Y */ 20 21 /* in a 2D domain. The shape functions for test and solution must be identical */ 22 /* and row_NS == row_NN */ 23 24 /* Shape of the coefficients: */ 25 26 /* A = 2 x 2 */ 27 /* B = 2 */ 28 /* C = 2 */ 29 /* D = scalar */ 30 /* X = 2 */ 31 /* Y = scalar */ 32 33 34 /**************************************************************/ 35 36 /* Author: gross@access.edu.au */ 37 /* Version: \$Id:\$ */ 38 39 /**************************************************************/ 40 41 42 #include "Assemble.h" 43 #include "Util.h" 44 #ifdef _OPENMP 45 #include 46 #endif 47 48 49 /**************************************************************/ 50 51 void Finley_Assemble_PDE_Single2_2D(Assemble_Parameters p, Finley_ElementFile* elements, 52 Paso_SystemMatrix* Mat, escriptDataC* F, 53 escriptDataC* A, escriptDataC* B, escriptDataC* C, escriptDataC* D, escriptDataC* X, escriptDataC* Y) { 54 55 #define DIM 2 56 index_t color; 57 dim_t e; 58 double *EM_S, *EM_F, *Vol, *DSDX, *A_p, *B_p, *C_p, *D_p, *X_p, *Y_p; 59 index_t *row_index; 60 register dim_t q, s,r; 61 register double rtmp00, rtmp01, rtmp10, rtmp11, rtmp, rtmp0, rtmp1; 62 bool_t add_EM_F, add_EM_S; 63 64 bool_t extendedA=isExpanded(A); 65 bool_t extendedB=isExpanded(B); 66 bool_t extendedC=isExpanded(C); 67 bool_t extendedD=isExpanded(D); 68 bool_t extendedX=isExpanded(X); 69 bool_t extendedY=isExpanded(Y); 70 double *F_p=getSampleData(F,0); 71 double *S=p.row_jac->ReferenceElement->S; 72 dim_t len_EM_S=p.row_NN*p.col_NN; 73 dim_t len_EM_F=p.row_NN; 74 75 76 #pragma omp parallel private(color,EM_S, EM_F, Vol, DSDX, A_p, B_p, C_p, D_p, X_p, Y_p,row_index,q, s,r,rtmp00, rtmp01, rtmp10, rtmp11, rtmp, rtmp0, rtmp1,add_EM_F, add_EM_S) 77 { 78 EM_S=THREAD_MEMALLOC(len_EM_S,double); 79 EM_F=THREAD_MEMALLOC(len_EM_F,double); 80 row_index=THREAD_MEMALLOC(p.row_NN,index_t); 81 82 if (!Finley_checkPtr(EM_S) && !Finley_checkPtr(EM_F) && !Finley_checkPtr(row_index) ) { 83 84 #ifndef PASO_MPI 85 for (color=elements->minColor;color<=elements->maxColor;color++) { 86 /* open loop over all elements: */ 87 #pragma omp for private(e) schedule(static) 88 for(e=0;enumElements;e++){ 89 if (elements->Color[e]==color) { 90 #else 91 { 92 for(e=0;enumElements;e++) { 93 { 94 #endif 95 Vol=&(p.row_jac->volume[INDEX2(0,e,p.numQuad)]); 96 DSDX=&(p.row_jac->DSDX[INDEX4(0,0,0,e,p.row_NN,DIM,p.numQuad)]); 97 for (q=0;qNodes[INDEX2(p.row_node[q],e,p.NN)]]; 282 if (add_EM_F) Finley_Util_AddScatter(p.row_NN,row_index,p.numEqu,EM_F,F_p, p.row_DOF_UpperBound); 283 if (add_EM_S) Finley_Assemble_addToSystemMatrix(Mat,p.row_NN,row_index,p.numEqu,p.col_NN,row_index,p.numComp,EM_S); 284 285 } /* end color check */ 286 } /* end element loop */ 287 } /* end color loop */ 288 289 THREAD_MEMFREE(EM_S); 290 THREAD_MEMFREE(EM_F); 291 THREAD_MEMFREE(row_index); 292 293 } /* end of pointer check */ 294 } /* end parallel region */ 295 } 296 /* 297 * \$Log\$ 298 */

 ViewVC Help Powered by ViewVC 1.1.26