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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1387 - (hide annotations)
Fri Jan 11 07:45:26 2008 UTC (11 years, 8 months ago) by trankine
Original Path: temp/finley/src/Assemble_CopyElementData.c
File MIME type: text/plain
File size: 2856 byte(s)
Restore the trunk that existed before the windows changes were committed to the (now moved to branches) old trunk.
1 jgs 82
2 ksteube 1312 /* $Id$ */
3 jgs 82
4 ksteube 1312 /*******************************************************
5     *
6     * Copyright 2003-2007 by ACceSS MNRF
7     * Copyright 2007 by University of Queensland
8     *
9     * http://esscc.uq.edu.au
10     * Primary Business: Queensland, Australia
11     * Licensed under the Open Software License version 3.0
12     * http://www.opensource.org/licenses/osl-3.0.php
13     *
14     *******************************************************/
15    
16 jgs 82 /**************************************************************/
17    
18 ksteube 1312 /* assemblage routines: copies data between elements */
19 jgs 82
20     /**************************************************************/
21    
22 jgs 150 #include "Assemble.h"
23 jgs 82 #include "Util.h"
24     #ifdef _OPENMP
25     #include <omp.h>
26     #endif
27     /******************************************************************************************************/
28    
29    
30     void Finley_Assemble_CopyElementData(Finley_ElementFile* elements,escriptDataC* out,escriptDataC* in) {
31 gross 1028 dim_t n,q, numElements, numQuad;
32 gross 1062 double *in_array,*out_array;
33 jgs 123 dim_t numComps=getDataPointSize(out);
34 ksteube 1312 size_t len_size;
35 phornby 1030
36 gross 1062 Finley_resetError();
37 phornby 1030 if( elements == NULL )
38     {
39     return;
40     }
41    
42     numElements=elements->numElements;
43 gross 1062 if (Finley_Assemble_reducedIntegrationOrder(in)) {
44     numQuad=elements->ReferenceElementReducedOrder->numQuadNodes;
45     } else {
46     numQuad=elements->ReferenceElement->numQuadNodes;
47     }
48 phornby 1030
49 jgs 82 /* check out and in */
50     if (numComps!=getDataPointSize(in)) {
51 gross 1062 Finley_setError(TYPE_ERROR,"Finley_Assemble_CopyElementData: number of components of input and output Data do not match.");
52 jgs 147 } else if (!numSamplesEqual(in,numQuad,numElements)) {
53 gross 1062 Finley_setError(TYPE_ERROR,"Finley_Assemble_CopyElementData: illegal number of samples of input Data object");
54 jgs 147 } else if (!numSamplesEqual(out,numQuad,numElements)) {
55 gross 1062 Finley_setError(TYPE_ERROR,"Finley_Assemble_CopyElementData: illegal number of samples of output Data object");
56 jgs 82 } else if (!isExpanded(out)) {
57 gross 1062 Finley_setError(TYPE_ERROR,"Finley_Assemble_CopyElementData: expanded Data object is expected for output data.");
58 jgs 82 }
59    
60     /* now we can start */
61    
62 jgs 150 if (Finley_noError()) {
63 jgs 82 if (isExpanded(in)) {
64 ksteube 1312 len_size=numComps*numQuad*sizeof(double);
65 jgs 82 # pragma omp parallel for private(n) schedule(static)
66     for (n=0;n<numElements;n++)
67 ksteube 1312 memcpy(getSampleData(out,n),getSampleData(in,n), len_size);
68 jgs 82 } else {
69 ksteube 1312 len_size=numComps*sizeof(double);
70 jgs 82 # pragma omp parallel for private(q,n,out_array,in_array) schedule(static)
71     for (n=0;n<numElements;n++) {
72     in_array=getSampleData(in,n);
73     out_array=getSampleData(out,n);
74 ksteube 1312 for (q=0;q<numQuad;q++) memcpy(out_array+q*numComps,in_array,len_size);
75 jgs 82 }
76     }
77     }
78     return;
79     }

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26