/[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 4154 - (hide annotations)
Tue Jan 22 09:30:23 2013 UTC (6 years, 7 months ago) by jfenwick
File MIME type: text/plain
File size: 3061 byte(s)
Round 1 of copyright fixes
1 jgs 82
2 jfenwick 3981 /*****************************************************************************
3 ksteube 1811 *
4 jfenwick 4154 * Copyright (c) 2003-2013 by University of Queensland
5 jfenwick 3981 * http://www.uq.edu.au
6 ksteube 1811 *
7     * Primary Business: Queensland, Australia
8     * Licensed under the Open Software License version 3.0
9     * http://www.opensource.org/licenses/osl-3.0.php
10     *
11 jfenwick 3981 * Development until 2012 by Earth Systems Science Computational Center (ESSCC)
12     * Development since 2012 by School of Earth Sciences
13     *
14     *****************************************************************************/
15 ksteube 1312
16 jfenwick 3981 /************************************************************************************/
17 jgs 82
18 ksteube 1312 /* assemblage routines: copies data between elements */
19 jgs 82
20 jfenwick 3981 /************************************************************************************/
21 jgs 82
22 jgs 150 #include "Assemble.h"
23 jgs 82 #include "Util.h"
24     #ifdef _OPENMP
25     #include <omp.h>
26     #endif
27 jfenwick 3981 /****************************************************************************************************************************/
28 jfenwick 3199 #include "ShapeTable.h"
29 jgs 82
30 jfenwick 3224 void Dudley_Assemble_CopyElementData(Dudley_ElementFile * elements, escriptDataC * out, escriptDataC * in)
31     {
32     dim_t n, q, numElements, numQuad;
33 jfenwick 2271 __const double *in_array;
34     double *out_array;
35 jfenwick 3224 dim_t numComps = getDataPointSize(out);
36 ksteube 1312 size_t len_size;
37 phornby 1030
38 jfenwick 3086 Dudley_resetError();
39 jfenwick 3224 if (elements == NULL)
40 phornby 1030 {
41 jfenwick 3224 return;
42 phornby 1030 }
43    
44 jfenwick 3224 numElements = elements->numElements;
45     if (Dudley_Assemble_reducedIntegrationOrder(in))
46     {
47     numQuad = QuadNums[elements->numDim][0];
48     }
49     else
50     {
51     numQuad = QuadNums[elements->numDim][1];
52 jfenwick 3199
53 gross 1062 }
54 phornby 1030
55 jgs 82 /* check out and in */
56 jfenwick 3224 if (numComps != getDataPointSize(in))
57     {
58     Dudley_setError(TYPE_ERROR,
59     "Dudley_Assemble_CopyElementData: number of components of input and output Data do not match.");
60 jgs 82 }
61 jfenwick 3224 else if (!numSamplesEqual(in, numQuad, numElements))
62     {
63     Dudley_setError(TYPE_ERROR, "Dudley_Assemble_CopyElementData: illegal number of samples of input Data object");
64     }
65     else if (!numSamplesEqual(out, numQuad, numElements))
66     {
67     Dudley_setError(TYPE_ERROR, "Dudley_Assemble_CopyElementData: illegal number of samples of output Data object");
68     }
69     else if (!isExpanded(out))
70     {
71     Dudley_setError(TYPE_ERROR,
72     "Dudley_Assemble_CopyElementData: expanded Data object is expected for output data.");
73     }
74 jgs 82
75     /* now we can start */
76    
77 jfenwick 3224 if (Dudley_noError())
78     {
79     if (isExpanded(in))
80     {
81     len_size = numComps * numQuad * sizeof(double);
82     requireWrite(out);
83     #pragma omp parallel private(n)
84     {
85     # pragma omp for schedule(static)
86     for (n = 0; n < numElements; n++)
87     memcpy(getSampleDataRW(out, n), getSampleDataRO(in, n), len_size);
88     }
89     }
90     else
91     {
92     len_size = numComps * sizeof(double);
93     requireWrite(out);
94     #pragma omp parallel private(q,n,out_array,in_array)
95     {
96     # pragma omp for schedule(static)
97     for (n = 0; n < numElements; n++)
98     {
99     in_array = getSampleDataRO(in, n);
100     out_array = getSampleDataRW(out, n);
101     for (q = 0; q < numQuad; q++)
102     memcpy(out_array + q * numComps, in_array, len_size);
103     }
104     }
105     }
106 jgs 82 }
107     return;
108     }

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26