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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1064 - (hide annotations)
Tue Mar 27 06:21:02 2007 UTC (14 years, 4 months ago) by gross
File MIME type: text/plain
File size: 4518 byte(s)
test for reduced integration order for grad, interpolate and integrate added.
Bug shown by the tests have been fixed.


1 jgs 150 /*
2 elspeth 616 ************************************************************
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 jgs 150 */
12 jgs 82
13     /**************************************************************/
14    
15     /* assemblage routines: integrates data on quadrature points */
16    
17     /**************************************************************/
18    
19 jgs 150 /* Copyrights by ACcESS Australia 2003,2004,2005 */
20     /* Author: gross@access.edu.au */
21     /* version: $Id$ */
22 jgs 82
23     /**************************************************************/
24    
25     #include "Assemble.h"
26     #include "Util.h"
27     #ifdef _OPENMP
28     #include <omp.h>
29     #endif
30    
31     /**************************************************************/
32    
33     void Finley_Assemble_integrate(Finley_NodeFile* nodes, Finley_ElementFile* elements,escriptDataC* data,double* out) {
34 jgs 123 type_t datacase;
35     index_t node_offset;
36 gross 777 bool_t reducedIntegrationOrder;
37 jgs 123 type_t data_type=getFunctionSpaceType(data);
38     dim_t numComps=getDataPointSize(data);
39 gross 1028 Finley_ElementFile_Jacobeans* jac=NULL;
40 jgs 150 Finley_resetError();
41 gross 1028 if (nodes==NULL || elements==NULL) return;
42 jgs 82 /* set some parameter */
43 gross 1064 jac=Finley_ElementFile_borrowJacobeans(elements,nodes,FALSE,Finley_Assemble_reducedIntegrationOrder(data));
44 gross 777 if (Finley_noError()) {
45 jgs 82
46 gross 777 /* check the shape of the data */
47     if (! numSamplesEqual(data,jac->ReferenceElement->numQuadNodes,elements->numElements)) {
48     Finley_setError(TYPE_ERROR,"Finley_Assemble_integrate: illegal number of samples of integrant kernel Data object");
49     }
50     /* now we can start */
51 jgs 82
52 gross 777 if (Finley_noError()) {
53 gross 853 dim_t q,e,i;
54     double *out_local=NULL, rtmp,*data_array=NULL;
55 gross 777 for (q=0;q<numComps;q++) out[q]=0;
56 gross 853 #pragma omp parallel private(q,i,rtmp,data_array,out_local)
57 gross 777 {
58 gross 853 out_local=THREAD_MEMALLOC(numComps,double);
59     if (! Finley_checkPtr(out_local) ) {
60     /* initialize local result */
61 jgs 82
62 gross 853 for (i=0;i<numComps;i++) out_local[i]=0;
63 jgs 82
64 gross 853 /* open the element loop */
65    
66     if (isExpanded(data)) {
67     #pragma omp for private(e) schedule(static)
68     for(e=0;e<elements->numElements;e++) {
69     data_array=getSampleData(data,e);
70     for (q=0;q<jac->ReferenceElement->numQuadNodes;q++) {
71     for (i=0;i<numComps;i++) out_local[i]+=data_array[INDEX2(i,q,numComps)]*jac->volume[INDEX2(q,e,jac->ReferenceElement->numQuadNodes)];
72     }
73     }
74     } else {
75     #pragma omp for private(e) schedule(static)
76     for(e=0;e<elements->numElements;e++) {
77     data_array=getSampleData(data,e);
78     rtmp=0.;
79     for (q=0;q<jac->ReferenceElement->numQuadNodes;q++) rtmp+=jac->volume[INDEX2(q,e,jac->ReferenceElement->numQuadNodes)];
80     for (i=0;i<numComps;i++) out_local[i]+=data_array[i]*rtmp;
81     }
82 gross 777 }
83 gross 853 /* add local results to global result */
84     #pragma omp critical
85     for (i=0;i<numComps;i++) out[i]+=out_local[i];
86 gross 777 }
87 gross 853 THREAD_MEMFREE(out_local);
88 gross 777 }
89 jgs 82 }
90 gross 777 }
91 jgs 82 }
92    
93     /*
94     * $Log$
95 jgs 150 * Revision 1.6 2005/09/15 03:44:21 jgs
96     * Merge of development branch dev-02 back to main trunk on 2005-09-15
97     *
98     * Revision 1.5.2.1 2005/09/07 06:26:18 gross
99     * the solver from finley are put into the standalone package paso now
100     *
101 jgs 123 * Revision 1.5 2005/07/08 04:07:48 jgs
102     * Merge of development branch back to main trunk on 2005-07-08
103     *
104 jgs 102 * Revision 1.4 2004/12/15 07:08:32 jgs
105 jgs 97 * *** empty log message ***
106 jgs 123 * Revision 1.1.1.1.2.2 2005/06/29 02:34:48 gross
107     * some changes towards 64 integers in finley
108 jgs 82 *
109 jgs 123 * Revision 1.1.1.1.2.1 2004/11/24 01:37:12 gross
110     * some changes dealing with the integer overflow in memory allocation. Finley solves 4M unknowns now
111 jgs 97 *
112 jgs 82 *
113 jgs 123 *
114 jgs 82 */

Properties

Name Value
svn:eol-style native
svn:keywords Author Date Id Revision

  ViewVC Help
Powered by ViewVC 1.1.26