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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1811 - (hide annotations)
Thu Sep 25 23:11:13 2008 UTC (10 years, 9 months ago) by ksteube
File MIME type: text/plain
File size: 2821 byte(s)
Copyright updated in all files

1 jgs 82
2 ksteube 1312 /*******************************************************
3 ksteube 1811 *
4     * Copyright (c) 2003-2008 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 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     void Finley_Assemble_CopyElementData(Finley_ElementFile* elements,escriptDataC* out,escriptDataC* in) {
30 gross 1028 dim_t n,q, numElements, numQuad;
31 gross 1062 double *in_array,*out_array;
32 jgs 123 dim_t numComps=getDataPointSize(out);
33 ksteube 1312 size_t len_size;
34 phornby 1030
35 gross 1062 Finley_resetError();
36 phornby 1030 if( elements == NULL )
37     {
38     return;
39     }
40    
41     numElements=elements->numElements;
42 gross 1062 if (Finley_Assemble_reducedIntegrationOrder(in)) {
43     numQuad=elements->ReferenceElementReducedOrder->numQuadNodes;
44     } else {
45     numQuad=elements->ReferenceElement->numQuadNodes;
46     }
47 phornby 1030
48 jgs 82 /* check out and in */
49     if (numComps!=getDataPointSize(in)) {
50 gross 1062 Finley_setError(TYPE_ERROR,"Finley_Assemble_CopyElementData: number of components of input and output Data do not match.");
51 jgs 147 } else if (!numSamplesEqual(in,numQuad,numElements)) {
52 gross 1062 Finley_setError(TYPE_ERROR,"Finley_Assemble_CopyElementData: illegal number of samples of input Data object");
53 jgs 147 } else if (!numSamplesEqual(out,numQuad,numElements)) {
54 gross 1062 Finley_setError(TYPE_ERROR,"Finley_Assemble_CopyElementData: illegal number of samples of output Data object");
55 jgs 82 } else if (!isExpanded(out)) {
56 gross 1062 Finley_setError(TYPE_ERROR,"Finley_Assemble_CopyElementData: expanded Data object is expected for output data.");
57 jgs 82 }
58    
59     /* now we can start */
60    
61 jgs 150 if (Finley_noError()) {
62 jgs 82 if (isExpanded(in)) {
63 ksteube 1312 len_size=numComps*numQuad*sizeof(double);
64 jgs 82 # pragma omp parallel for private(n) schedule(static)
65     for (n=0;n<numElements;n++)
66 ksteube 1312 memcpy(getSampleData(out,n),getSampleData(in,n), len_size);
67 jgs 82 } else {
68 ksteube 1312 len_size=numComps*sizeof(double);
69 jgs 82 # pragma omp parallel for private(q,n,out_array,in_array) schedule(static)
70     for (n=0;n<numElements;n++) {
71     in_array=getSampleData(in,n);
72     out_array=getSampleData(out,n);
73 ksteube 1312 for (q=0;q<numQuad;q++) memcpy(out_array+q*numComps,in_array,len_size);
74 jgs 82 }
75     }
76     }
77     return;
78     }

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26