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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1388 - (show annotations)
Fri Jan 11 07:45:58 2008 UTC (11 years, 10 months ago) by trankine
File MIME type: text/plain
File size: 2856 byte(s)
And get the *(&(*&(* name right
1
2 /* $Id$ */
3
4 /*******************************************************
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 /**************************************************************/
17
18 /* assemblage routines: copies data between elements */
19
20 /**************************************************************/
21
22 #include "Assemble.h"
23 #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 dim_t n,q, numElements, numQuad;
32 double *in_array,*out_array;
33 dim_t numComps=getDataPointSize(out);
34 size_t len_size;
35
36 Finley_resetError();
37 if( elements == NULL )
38 {
39 return;
40 }
41
42 numElements=elements->numElements;
43 if (Finley_Assemble_reducedIntegrationOrder(in)) {
44 numQuad=elements->ReferenceElementReducedOrder->numQuadNodes;
45 } else {
46 numQuad=elements->ReferenceElement->numQuadNodes;
47 }
48
49 /* check out and in */
50 if (numComps!=getDataPointSize(in)) {
51 Finley_setError(TYPE_ERROR,"Finley_Assemble_CopyElementData: number of components of input and output Data do not match.");
52 } else if (!numSamplesEqual(in,numQuad,numElements)) {
53 Finley_setError(TYPE_ERROR,"Finley_Assemble_CopyElementData: illegal number of samples of input Data object");
54 } else if (!numSamplesEqual(out,numQuad,numElements)) {
55 Finley_setError(TYPE_ERROR,"Finley_Assemble_CopyElementData: illegal number of samples of output Data object");
56 } else if (!isExpanded(out)) {
57 Finley_setError(TYPE_ERROR,"Finley_Assemble_CopyElementData: expanded Data object is expected for output data.");
58 }
59
60 /* now we can start */
61
62 if (Finley_noError()) {
63 if (isExpanded(in)) {
64 len_size=numComps*numQuad*sizeof(double);
65 # pragma omp parallel for private(n) schedule(static)
66 for (n=0;n<numElements;n++)
67 memcpy(getSampleData(out,n),getSampleData(in,n), len_size);
68 } else {
69 len_size=numComps*sizeof(double);
70 # 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 for (q=0;q<numQuad;q++) memcpy(out_array+q*numComps,in_array,len_size);
75 }
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