# Contents of /branches/domexper/dudley/src/Assemble_PDE_System2_2D.c

Revision 3144 - (show annotations)
Fri Sep 3 00:49:02 2010 UTC (8 years, 10 months ago) by jfenwick
File MIME type: text/plain
File size: 19494 byte(s)
```row_node, col_node (Assemble params), node_selection
removed
```
 1 2 /******************************************************* 3 * 4 * Copyright (c) 2003-2010 by University of Queensland 5 * Earth Systems Science Computational Center (ESSCC) 6 * http://www.uq.edu.au/esscc 7 * 8 * Primary Business: Queensland, Australia 9 * Licensed under the Open Software License version 3.0 10 * http://www.opensource.org/licenses/osl-3.0.php 11 * 12 *******************************************************/ 13 14 15 /**************************************************************/ 16 17 /* assembles the system of numEq PDEs into the stiffness matrix S right hand side F */ 18 /* the shape functions for test and solution must be identical */ 19 20 21 /* -(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 */ 22 23 /* u has p.numComp components in a 2D domain. The shape functions for test and solution must be identical */ 24 /* and row_NS == row_NN */ 25 26 /* Shape of the coefficients: */ 27 28 /* A = p.numEqu x 2 x p.numComp x 2 */ 29 /* B = 2 x p.numEqu x p.numComp */ 30 /* C = p.numEqu x 2 x p.numComp */ 31 /* D = p.numEqu x p.numComp */ 32 /* X = p.numEqu x 2 */ 33 /* Y = p.numEqu */ 34 35 36 /**************************************************************/ 37 38 39 #include "Assemble.h" 40 #include "Util.h" 41 #ifdef _OPENMP 42 #include 43 #endif 44 45 46 /**************************************************************/ 47 48 void Dudley_Assemble_PDE_System2_2D(Assemble_Parameters p, Dudley_ElementFile* elements, 49 Paso_SystemMatrix* Mat, escriptDataC* F, 50 escriptDataC* A, escriptDataC* B, escriptDataC* C, escriptDataC* D, escriptDataC* X, escriptDataC* Y) { 51 52 #define DIM 2 53 index_t color; 54 dim_t e; 55 __const double *A_p, *B_p, *C_p, *D_p, *X_p, *Y_p, *A_q, *B_q, *C_q, *D_q, *X_q, *Y_q; 56 double *EM_S, *EM_F, *Vol, *DSDX; 57 index_t *row_index; 58 register dim_t q, s,r,k,m; 59 register double rtmp, rtmp0, rtmp1, rtmp00, rtmp10, rtmp01, rtmp11; 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=(requireWrite(F), getSampleDataRW(F,0)); /* use comma, to get around the mixed code and declarations thing */ 69 double *S=p.row_jac->BasisFunctions->S; 70 dim_t len_EM_S=p.row_numShapesTotal*p.col_numShapesTotal*p.numEqu*p.numComp; 71 dim_t len_EM_F=p.row_numShapesTotal*p.numEqu; 72 73 #pragma omp parallel private(color,EM_S, EM_F, Vol, DSDX, A_p, B_p, C_p, D_p, X_p, Y_p, A_q, B_q, C_q, D_q, X_q, Y_q,row_index,q, s,r,k,m,rtmp, rtmp0, rtmp1, rtmp00, rtmp10, rtmp01, rtmp11,add_EM_F, add_EM_S) 74 { 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_numShapesTotal,index_t); 79 80 if (!Dudley_checkPtr(EM_S) && !Dudley_checkPtr(EM_F) && !Dudley_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 88 A_p=getSampleDataRO(A,e); 89 B_p=getSampleDataRO(B,e); 90 C_p=getSampleDataRO(C,e); 91 D_p=getSampleDataRO(D,e); 92 X_p=getSampleDataRO(X,e); 93 Y_p=getSampleDataRO(Y,e); 94 95 Vol=&(p.row_jac->volume[INDEX3(0,0,e, p.numQuadTotal,1)]); 96 DSDX=&(p.row_jac->DSDX[INDEX5(0,0,0,0,e,p.row_numShapesTotal,DIM,p.numQuadTotal,1)]); 97 for (q=0;qNodes[INDEX2(q,e,p.NN)]]; 333 334 if (add_EM_F) Dudley_Util_AddScatter(p.row_numShapesTotal,row_index,p.numEqu,EM_F,F_p, p.row_DOF_UpperBound); 335 if (add_EM_S) Dudley_Assemble_addToSystemMatrix(Mat,p.row_numShapesTotal,row_index,p.numEqu,p.col_numShapesTotal,row_index,p.numComp,EM_S); 336 337 } /* end color check */ 338 } /* end element loop */ 339 } /* end color loop */ 340 341 THREAD_MEMFREE(EM_S); 342 THREAD_MEMFREE(EM_F); 343 THREAD_MEMFREE(row_index); 344 345 } /* end of pointer check */ 346 } /* end parallel region */ 347 } 348 /* 349 * \$Log\$ 350 */

 ViewVC Help Powered by ViewVC 1.1.26