/[escript]/trunk/dudley/src/Assemble_CopyElementData.c
ViewVC logotype

Annotation of /trunk/dudley/src/Assemble_CopyElementData.c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3086 - (hide annotations)
Thu Aug 5 05:07:58 2010 UTC (9 years, 1 month ago) by jfenwick
Original Path: branches/domexper/dudley/src/Assemble_CopyElementData.c
File MIME type: text/plain
File size: 3058 byte(s)
Another pass at removing finley

1 jgs 82
2 ksteube 1312 /*******************************************************
3 ksteube 1811 *
4 jfenwick 2881 * Copyright (c) 2003-2010 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 jgs 82 /**************************************************************/
16    
17 ksteube 1312 /* assemblage routines: copies data between elements */
18 jgs 82
19     /**************************************************************/
20    
21 jgs 150 #include "Assemble.h"
22 jgs 82 #include "Util.h"
23     #ifdef _OPENMP
24     #include <omp.h>
25     #endif
26     /******************************************************************************************************/
27    
28    
29 jfenwick 3086 void Dudley_Assemble_CopyElementData(Dudley_ElementFile* elements,escriptDataC* out,escriptDataC* in) {
30 gross 1028 dim_t n,q, numElements, numQuad;
31 jfenwick 2271 __const double *in_array;
32     double *out_array;
33 jgs 123 dim_t numComps=getDataPointSize(out);
34 ksteube 1312 size_t len_size;
35 phornby 1030
36 jfenwick 3086 Dudley_resetError();
37 phornby 1030 if( elements == NULL )
38     {
39     return;
40     }
41    
42     numElements=elements->numElements;
43 jfenwick 3086 if (Dudley_Assemble_reducedIntegrationOrder(in)) {
44 gross 2748 numQuad=elements->referenceElementSet->referenceElementReducedQuadrature->Parametrization->numQuadNodes;
45 gross 1062 } else {
46 gross 2748 numQuad=elements->referenceElementSet->referenceElement->Parametrization->numQuadNodes;
47 gross 1062 }
48 phornby 1030
49 jgs 82 /* check out and in */
50     if (numComps!=getDataPointSize(in)) {
51 jfenwick 3086 Dudley_setError(TYPE_ERROR,"Dudley_Assemble_CopyElementData: number of components of input and output Data do not match.");
52 jgs 147 } else if (!numSamplesEqual(in,numQuad,numElements)) {
53 jfenwick 3086 Dudley_setError(TYPE_ERROR,"Dudley_Assemble_CopyElementData: illegal number of samples of input Data object");
54 jgs 147 } else if (!numSamplesEqual(out,numQuad,numElements)) {
55 jfenwick 3086 Dudley_setError(TYPE_ERROR,"Dudley_Assemble_CopyElementData: illegal number of samples of output Data object");
56 jgs 82 } else if (!isExpanded(out)) {
57 jfenwick 3086 Dudley_setError(TYPE_ERROR,"Dudley_Assemble_CopyElementData: expanded Data object is expected for output data.");
58 jgs 82 }
59    
60     /* now we can start */
61    
62 jfenwick 3086 if (Dudley_noError()) {
63 jgs 82 if (isExpanded(in)) {
64 ksteube 1312 len_size=numComps*numQuad*sizeof(double);
65 jfenwick 2271 requireWrite(out);
66     #pragma omp parallel private(n)
67     {
68     # pragma omp for schedule(static)
69     for (n=0;n<numElements;n++)
70 jfenwick 2770 memcpy(getSampleDataRW(out,n),getSampleDataRO(in,n), len_size);
71 jfenwick 2271 }
72 jgs 82 } else {
73 ksteube 1312 len_size=numComps*sizeof(double);
74 jfenwick 2271 requireWrite(out);
75     #pragma omp parallel private(q,n,out_array,in_array)
76     {
77     # pragma omp for schedule(static)
78     for (n=0;n<numElements;n++) {
79 jfenwick 2770 in_array=getSampleDataRO(in,n);
80 jfenwick 2271 out_array=getSampleDataRW(out,n);
81 ksteube 1312 for (q=0;q<numQuad;q++) memcpy(out_array+q*numComps,in_array,len_size);
82 jfenwick 2271 }
83     }
84 jgs 82 }
85     }
86     return;
87     }

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26