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

Contents of /trunk-mpi-branch/finley/src/Assemble_CopyElementData.c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1223 - (show annotations)
Fri Aug 3 02:40:39 2007 UTC (11 years, 8 months ago) by gross
File MIME type: text/plain
File size: 3105 byte(s)
first attemt towards an improved MPI version.  

1 /*
2 ************************************************************
3 * Copyright 2006 by ACcESS MNRF *
4 * *
5 * http://www.access.edu.au *
6 * Primary Business: Queensland, Australia *
7 * Licensed under the Open Software License version 3.0 *
8 * http://www.opensource.org/licenses/osl-3.0.php *
9 * *
10 ************************************************************
11 */
12 /**************************************************************/
13
14 /* assemblage routines: copies data between elements */
15
16 /**************************************************************/
17
18 /* author: gross@access.edu.au */
19 /* Version: $Id$ */
20
21 /**************************************************************/
22
23 #include "Assemble.h"
24 #include "Util.h"
25 #ifdef _OPENMP
26 #include <omp.h>
27 #endif
28 /******************************************************************************************************/
29
30
31 void Finley_Assemble_CopyElementData(Finley_ElementFile* elements,escriptDataC* out,escriptDataC* in) {
32 dim_t n,q, numElements, numQuad;
33 double *in_array,*out_array;
34 dim_t numComps=getDataPointSize(out);
35 size_t len_size;
36
37 Finley_resetError();
38 if( elements == NULL )
39 {
40 return;
41 }
42
43 numElements=elements->numElements;
44 if (Finley_Assemble_reducedIntegrationOrder(in)) {
45 numQuad=elements->ReferenceElementReducedOrder->numQuadNodes;
46 } else {
47 numQuad=elements->ReferenceElement->numQuadNodes;
48 }
49
50 /* check out and in */
51 if (numComps!=getDataPointSize(in)) {
52 Finley_setError(TYPE_ERROR,"Finley_Assemble_CopyElementData: number of components of input and output Data do not match.");
53 } else if (!numSamplesEqual(in,numQuad,numElements)) {
54 Finley_setError(TYPE_ERROR,"Finley_Assemble_CopyElementData: illegal number of samples of input Data object");
55 } else if (!numSamplesEqual(out,numQuad,numElements)) {
56 Finley_setError(TYPE_ERROR,"Finley_Assemble_CopyElementData: illegal number of samples of output Data object");
57 } else if (!isExpanded(out)) {
58 Finley_setError(TYPE_ERROR,"Finley_Assemble_CopyElementData: expanded Data object is expected for output data.");
59 }
60
61 /* now we can start */
62
63 if (Finley_noError()) {
64 if (isExpanded(in)) {
65 len_size=numComps*numQuad*sizeof(double);
66 # pragma omp parallel for private(n) schedule(static)
67 for (n=0;n<numElements;n++)
68 memcpy(getSampleData(out,n),getSampleData(in,n), len_size);
69 } else {
70 len_size=numComps*sizeof(double);
71 # pragma omp parallel for private(q,n,out_array,in_array) schedule(static)
72 for (n=0;n<numElements;n++) {
73 in_array=getSampleData(in,n);
74 out_array=getSampleData(out,n);
75 for (q=0;q<numQuad;q++) memcpy(out_array+q*numComps,in_array,len_size);
76 }
77 }
78 }
79 return;
80 }

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26