# Contents of /trunk/finley/src/Assemble_PDE_System2_1D.c

Revision 1312 - (show annotations)
Mon Sep 24 06:18:44 2007 UTC (12 years ago) by ksteube
File MIME type: text/plain
File size: 14220 byte(s)
```The MPI branch is hereby closed. All future work should be in trunk.

Previously in revision 1295 I merged the latest changes to trunk into trunk-mpi-branch.
In this revision I copied all files from trunk-mpi-branch over the corresponding
trunk files. I did not use 'svn merge', it was a copy.

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

 ViewVC Help Powered by ViewVC 1.1.26