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

Annotation of /trunk/finley/src/Assemble_CopyNodalData.c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 123 - (hide annotations)
Fri Jul 8 04:08:13 2005 UTC (14 years, 1 month ago) by jgs
Original Path: trunk/esys2/finley/src/finleyC/Assemble_CopyNodalData.c
File MIME type: text/plain
File size: 6265 byte(s)
Merge of development branch back to main trunk on 2005-07-08

1 jgs 82 /* $Id$ */
2    
3     /**************************************************************/
4    
5     /* assemblage routines: copies data between different types nodal representation */
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 "Finley.h"
17     #include "Util.h"
18     #include "Assemble.h"
19     #include "NodeFile.h"
20     #ifdef _OPENMP
21     #include <omp.h>
22     #endif
23    
24     /******************************************************************************************************/
25    
26    
27     void Finley_Assemble_CopyNodalData(Finley_NodeFile* nodes,escriptDataC* out,escriptDataC* in) {
28     if (nodes==NULL) return;
29 jgs 123 dim_t n,i;
30     dim_t numComps=getDataPointSize(out);
31     type_t in_data_type=getFunctionSpaceType(in);
32     type_t out_data_type=getFunctionSpaceType(out);
33 jgs 82
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 (!isExpanded(out)) {
39     Finley_ErrorCode=TYPE_ERROR;
40     sprintf(Finley_ErrorMsg,"expanded Data object is expected for output data.");
41     }
42    
43     if (in_data_type == FINLEY_NODES) {
44     if (! numSamplesEqual(in,1,nodes->numNodes)) {
45     Finley_ErrorCode=TYPE_ERROR;
46     sprintf(Finley_ErrorMsg,"illegal number of samples of input Data object");
47     }
48     } else if (in_data_type == FINLEY_DEGREES_OF_FREEDOM) {
49     if (! numSamplesEqual(in,1,nodes->numDegreesOfFreedom)) {
50     Finley_ErrorCode=TYPE_ERROR;
51     sprintf(Finley_ErrorMsg,"illegal number of samples of input Data object");
52     }
53     } else if (in_data_type == FINLEY_REDUCED_DEGREES_OF_FREEDOM) {
54     if (! numSamplesEqual(in,1,nodes->reducedNumDegreesOfFreedom)) {
55     Finley_ErrorCode=TYPE_ERROR;
56     sprintf(Finley_ErrorMsg,"illegal number of samples of input Data object");
57     }
58     } else {
59     Finley_ErrorCode=TYPE_ERROR;
60     sprintf(Finley_ErrorMsg,"illegal function space type for target object");
61     }
62    
63     if (out_data_type == FINLEY_NODES) {
64     if (! numSamplesEqual(out,1,nodes->numNodes)) {
65     Finley_ErrorCode=TYPE_ERROR;
66     sprintf(Finley_ErrorMsg,"illegal number of samples of output Data object");
67     }
68     } else if (out_data_type == FINLEY_DEGREES_OF_FREEDOM) {
69     if (! numSamplesEqual(out,1,nodes->numDegreesOfFreedom)) {
70     Finley_ErrorCode=TYPE_ERROR;
71     sprintf(Finley_ErrorMsg,"illegal number of samples of output Data object");
72     }
73     } else if (out_data_type == FINLEY_REDUCED_DEGREES_OF_FREEDOM) {
74     if (! numSamplesEqual(out,1,nodes->reducedNumDegreesOfFreedom)) {
75     Finley_ErrorCode=TYPE_ERROR;
76     sprintf(Finley_ErrorMsg,"illegal number of samples of output Data object");
77     }
78     } else {
79     Finley_ErrorCode=TYPE_ERROR;
80     sprintf(Finley_ErrorMsg,"illegal function space type for source object");
81     }
82    
83     /* now we can start */
84    
85     if (Finley_ErrorCode==NO_ERROR) {
86     if (in_data_type == FINLEY_NODES) {
87     if (out_data_type == FINLEY_NODES) {
88     #pragma omp parallel for private(n) schedule(static)
89     for (n=0;n<nodes->numNodes;n++)
90     Finley_copyDouble(numComps,getSampleData(in,n),getSampleData(out,n));
91     } else if (out_data_type == FINLEY_DEGREES_OF_FREEDOM) {
92     #pragma omp parallel for private(n) schedule(static)
93     for (n=0;n<nodes->numNodes;n++)
94     Finley_copyDouble(numComps,getSampleData(in,n),getSampleData(out,nodes->degreeOfFreedom[n]));
95     } else if (out_data_type == FINLEY_REDUCED_DEGREES_OF_FREEDOM) {
96     #pragma omp parallel for private(n,i) schedule(static)
97     for (i=0;i<nodes->numNodes;i++) {
98     n=nodes->reducedDegreeOfFreedom[i];
99     if (n>=0) Finley_copyDouble(numComps,getSampleData(in,i),getSampleData(out,n));
100     }
101     }
102     } else if (in_data_type == FINLEY_DEGREES_OF_FREEDOM) {
103     if (out_data_type == FINLEY_NODES) {
104     #pragma omp parallel for private(n) schedule(static)
105     for (n=0;n<nodes->numNodes;n++)
106     Finley_copyDouble(numComps,getSampleData(in,nodes->degreeOfFreedom[n]),getSampleData(out,n));
107     } else if (out_data_type == FINLEY_DEGREES_OF_FREEDOM) {
108     #pragma omp parallel for private(n) schedule(static)
109     for (n=0;n<nodes->numDegreesOfFreedom;n++)
110     Finley_copyDouble(numComps,getSampleData(in,n),getSampleData(out,n));
111     } else if (out_data_type == FINLEY_REDUCED_DEGREES_OF_FREEDOM) {
112     #pragma omp parallel for private(n,i) schedule(static)
113     for (i=0;i<nodes->numNodes;i++) {
114     n=nodes->reducedDegreeOfFreedom[i];
115     if (n>=0) Finley_copyDouble(numComps,getSampleData(in,nodes->degreeOfFreedom[i]),getSampleData(out,n));
116     }
117     }
118     } else if (in_data_type == FINLEY_REDUCED_DEGREES_OF_FREEDOM) {
119     if (out_data_type == FINLEY_REDUCED_DEGREES_OF_FREEDOM) {
120     #pragma omp parallel for private(n) schedule(static)
121     for (n=0;n<nodes->reducedNumDegreesOfFreedom;n++)
122     Finley_copyDouble(numComps,getSampleData(in,n),getSampleData(out,n));
123     } else {
124     Finley_ErrorCode=TYPE_ERROR;
125     sprintf(Finley_ErrorMsg,"cannot copy from data on reduced degrees of freedom");
126     }
127     }
128     }
129     return;
130     }
131     /*
132     * $Log$
133 jgs 123 * Revision 1.2 2005/07/08 04:07:45 jgs
134     * Merge of development branch back to main trunk on 2005-07-08
135 jgs 82 *
136 jgs 123 * Revision 1.1.1.1.2.1 2005/06/29 02:34:46 gross
137     * some changes towards 64 integers in finley
138     *
139     * Revision 1.1.1.1 2004/10/26 06:53:56 jgs
140     * initial import of project esys2
141     *
142 jgs 82 * Revision 1.2 2004/07/21 05:00:54 gross
143     * name changes in DataC
144     *
145     * Revision 1.1 2004/07/02 04:21:13 gross
146     * Finley C code has been included
147     *
148     *
149     */

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26