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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 147 - (show annotations)
Fri Aug 12 01:45:47 2005 UTC (14 years ago) by jgs
Original Path: trunk/esys2/finley/src/finleyC/Assemble_CopyNodalData.c
File MIME type: text/plain
File size: 7388 byte(s)
erge of development branch dev-02 back to main trunk on 2005-08-12

1 /* $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 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
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 if (out_data_type == FINLEY_DEGREES_OF_FREEDOM && numSamplesEqual(out,1,nodes->reducedNumDegreesOfFreedom)) {
124 #pragma omp parallel for private(n) schedule(static)
125 for (i=0;i<nodes->numNodes;i++) {
126 n=nodes->reducedDegreeOfFreedom[i];
127 if (n>=0) Finley_copyDouble(numComps,getSampleData(in,n),getSampleData(out,nodes->degreeOfFreedom[i]));
128 }
129 } else if (out_data_type == FINLEY_NODES && numSamplesEqual(out,1,nodes->reducedNumDegreesOfFreedom)) {
130 #pragma omp parallel for private(n) schedule(static)
131 for (i=0;i<nodes->numNodes;i++) {
132 n=nodes->reducedDegreeOfFreedom[i];
133 if (n>=0) Finley_copyDouble(numComps,getSampleData(in,n),getSampleData(out,i));
134 }
135 } else {
136 Finley_ErrorCode=TYPE_ERROR;
137 sprintf(Finley_ErrorMsg,"cannot copy from data on reduced degrees of freedom");
138 }
139 }
140 }
141 return;
142 }
143 /*
144 * $Log$
145 * Revision 1.3 2005/08/12 01:45:42 jgs
146 * erge of development branch dev-02 back to main trunk on 2005-08-12
147 *
148 * Revision 1.2.2.2 2005/08/09 02:23:12 gross
149 * print statement removed
150 *
151 * Revision 1.2.2.1 2005/08/03 09:55:33 gross
152 * ContactTest is passing now./mk install!
153 *
154 * Revision 1.2 2005/07/08 04:07:45 jgs
155 * Merge of development branch back to main trunk on 2005-07-08
156 *
157 * Revision 1.1.1.1.2.1 2005/06/29 02:34:46 gross
158 * some changes towards 64 integers in finley
159 *
160 * Revision 1.1.1.1 2004/10/26 06:53:56 jgs
161 * initial import of project esys2
162 *
163 * Revision 1.2 2004/07/21 05:00:54 gross
164 * name changes in DataC
165 *
166 * Revision 1.1 2004/07/02 04:21:13 gross
167 * Finley C code has been included
168 *
169 *
170 */

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26