# Annotation of /trunk/finley/src/Assemble_PDE_Single2_1D.c

Revision 2770 - (hide annotations)
Wed Nov 25 01:24:51 2009 UTC (10 years, 2 months ago) by jfenwick
File MIME type: text/plain
File size: 13481 byte(s)
```Removed buffer implementation of Lazy.
Removed supporting Alloc/Free Sample buffer calls.
```
 1 gross 798 2 ksteube 1312 /******************************************************* 3 ksteube 1811 * 4 jfenwick 2548 * Copyright (c) 2003-2009 by University of Queensland 5 ksteube 1811 * 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 ksteube 1312 14 ksteube 1811 15 gross 798 /**************************************************************/ 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_{i,j} u_,j)_i-(B_{i} u)_i+C_{j} u_,j-D u_m and -(X_,i)_i + Y */ 22 23 /* in a 1D 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 = 1 x 1 */ 29 /* B = 1 */ 30 /* C = 1 */ 31 /* D = scalar */ 32 /* X = 1 */ 33 /* Y = scalar */ 34 35 36 /**************************************************************/ 37 38 39 #include "Assemble.h" 40 #include "Util.h" 41 gross 853 #ifdef _OPENMP 42 #include 43 #endif 44 gross 798 45 gross 853 46 gross 798 /**************************************************************/ 47 48 void Finley_Assemble_PDE_Single2_1D(Assemble_Parameters p, Finley_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 1 53 index_t color; 54 gross 2748 dim_t e, isub; 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 jfenwick 2271 double *EM_S, *EM_F, *Vol, *DSDX; 57 gross 853 index_t *row_index; 58 register dim_t q, s,r; 59 register double rtmp; 60 bool_t add_EM_F, add_EM_S; 61 62 gross 798 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 jfenwick 2271 double *F_p=(requireWrite(F), getSampleDataRW(F,0)); /* use comma, to get around the mixed code and declarations thing */ 69 gross 2748 double *S=p.row_jac->BasisFunctions->S; 70 dim_t len_EM_S=p.row_numShapesTotal*p.col_numShapesTotal; 71 dim_t len_EM_F=p.row_numShapesTotal; 72 gross 798 73 gross 2748 #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,rtmp,add_EM_F, add_EM_S, isub) 74 gross 798 { 75 gross 853 EM_S=THREAD_MEMALLOC(len_EM_S,double); 76 EM_F=THREAD_MEMALLOC(len_EM_F,double); 77 gross 2748 row_index=THREAD_MEMALLOC(p.row_numShapesTotal,index_t); 78 gross 853 79 jfenwick 2271 80 gross 853 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 gross 2748 88 jfenwick 2770 A_p=getSampleDataRO(A,e); 89 C_p=getSampleDataRO(C,e); 90 B_p=getSampleDataRO(B,e); 91 D_p=getSampleDataRO(D,e); 92 X_p=getSampleDataRO(X,e); 93 Y_p=getSampleDataRO(Y,e); 94 gross 2748 95 for (isub=0; isubvolume[INDEX3(0,isub,e, p.numQuadSub,p.numSub)]); 97 DSDX=&(p.row_jac->DSDX[INDEX5(0,0,0,isub,e, p.row_numShapesTotal,DIM,p.numQuadSub,p.numSub)]); 98 for (q=0;qNodes[INDEX2(p.row_node[INDEX2(q,isub,p.row_numShapesTotal)],e,p.NN)]]; 250 251 if (add_EM_F) Finley_Util_AddScatter(p.row_numShapesTotal,row_index,p.numEqu,EM_F,F_p, p.row_DOF_UpperBound); 252 if (add_EM_S) Finley_Assemble_addToSystemMatrix(Mat,p.row_numShapesTotal,row_index,p.numEqu,p.col_numShapesTotal,row_index,p.numComp,EM_S); 253 } /* end of isub */ 254 gross 853 255 } /* end color check */ 256 } /* end element loop */ 257 } /* end color loop */ 258 259 jfenwick 2271 THREAD_MEMFREE(EM_S); /* these FREEs appear to be inside the if because if any of the allocs */ 260 THREAD_MEMFREE(EM_F); /* failed it means an out of memory (which is not recoverable anyway) */ 261 gross 853 THREAD_MEMFREE(row_index); 262 gross 798 263 gross 853 } /* end of pointer check */ 264 gross 798 } /* end parallel region */ 265 } 266 /* 267 * \$Log\$ 268 */

 ViewVC Help Powered by ViewVC 1.1.26