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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3199 - (show annotations)
Thu Sep 23 06:08:56 2010 UTC (8 years, 11 months ago) by jfenwick
Original Path: branches/domexper/dudley/src/Assemble_CopyElementData.c
File MIME type: text/plain
File size: 3164 byte(s)
Some more changed moved over

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

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26