/[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 82 - (hide annotations)
Tue Oct 26 06:53:54 2004 UTC (15 years ago) by jgs
Original Path: trunk/esys2/finley/src/finleyC/Assemble_CopyElementData.c
File MIME type: text/plain
File size: 2625 byte(s)
Initial revision

1 jgs 82 /* $Id$ */
2    
3     /**************************************************************/
4    
5     /* assemblage routines: copies data between elements */
6    
7     /**************************************************************/
8    
9     /* Copyrights by ACcESS Australia, 2003,2004 */
10     /* author: gross@access.edu.au */
11     /* Version: $Id$ */
12    
13     /**************************************************************/
14    
15     #include "escript/Data/DataC.h"
16     #include "Util.h"
17     #include "Finley.h"
18     #include "Assemble.h"
19     #include "ElementFile.h"
20     #ifdef _OPENMP
21     #include <omp.h>
22     #endif
23     /******************************************************************************************************/
24    
25    
26     void Finley_Assemble_CopyElementData(Finley_ElementFile* elements,escriptDataC* out,escriptDataC* in) {
27     if (elements==NULL) return;
28     maybelong n,q;
29     int numElements=elements->numElements;
30     int numQuad=elements->ReferenceElement->numQuadNodes;
31     int numComps=getDataPointSize(out);
32     double *in_array,*out_array;
33    
34     /* check out and in */
35     if (numComps!=getDataPointSize(in)) {
36     Finley_ErrorCode=TYPE_ERROR;
37     sprintf(Finley_ErrorMsg,"number of components of input and output Data do not match.");
38     } else if (numSamplesEqual(out,numQuad,numElements)) {
39     Finley_ErrorCode=TYPE_ERROR;
40     sprintf(Finley_ErrorMsg,"illegal number of samples of output Data object");
41     } else if (numSamplesEqual(in,numQuad,numElements)) {
42     Finley_ErrorCode=TYPE_ERROR;
43     sprintf(Finley_ErrorMsg,"illegal number of samples of input Data object");
44     } else if (!isExpanded(out)) {
45     Finley_ErrorCode=TYPE_ERROR;
46     sprintf(Finley_ErrorMsg,"expanded Data object is expected for output data.");
47     }
48    
49     /* now we can start */
50    
51     if (Finley_ErrorCode==NO_ERROR) {
52     if (isExpanded(in)) {
53     # pragma omp parallel for private(n) schedule(static)
54     for (n=0;n<numElements;n++)
55     Finley_copyDouble(numComps*numQuad,getSampleData(in,n),getSampleData(out,n));
56     } else {
57     # pragma omp parallel for private(q,n,out_array,in_array) schedule(static)
58     for (n=0;n<numElements;n++) {
59     in_array=getSampleData(in,n);
60     out_array=getSampleData(out,n);
61     for (q=0;q<numQuad;q++) Finley_copyDouble(numComps,in_array,out_array+q*numComps);
62     }
63     }
64     }
65     return;
66     }
67     /*
68     * $Log$
69     * Revision 1.1 2004/10/26 06:53:56 jgs
70     * Initial revision
71     *
72     * Revision 1.2 2004/07/21 05:00:54 gross
73     * name changes in DataC
74     *
75     * Revision 1.1 2004/07/02 04:21:13 gross
76     * Finley C code has been included
77     *
78     *
79     */

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26