/[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 616 - (hide annotations)
Wed Mar 22 02:46:56 2006 UTC (13 years, 5 months ago) by elspeth
File MIME type: text/plain
File size: 7762 byte(s)
Copyright added to more source files.

1 jgs 150 /*
2 elspeth 616 ************************************************************
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 jgs 150 */
12 jgs 82 /**************************************************************/
13    
14     /* assemblage routines: copies data between different types nodal representation */
15    
16     /**************************************************************/
17    
18     /* author: gross@access.edu.au */
19     /* Version: $Id$ */
20    
21     /**************************************************************/
22    
23     #include "Util.h"
24     #include "Assemble.h"
25     #ifdef _OPENMP
26     #include <omp.h>
27     #endif
28    
29     /******************************************************************************************************/
30    
31    
32     void Finley_Assemble_CopyNodalData(Finley_NodeFile* nodes,escriptDataC* out,escriptDataC* in) {
33     if (nodes==NULL) return;
34 jgs 123 dim_t n,i;
35     dim_t numComps=getDataPointSize(out);
36     type_t in_data_type=getFunctionSpaceType(in);
37     type_t out_data_type=getFunctionSpaceType(out);
38 jgs 150 Finley_resetError();
39 jgs 82
40     /* check out and in */
41     if (numComps!=getDataPointSize(in)) {
42 jgs 150 Finley_setError(TYPE_ERROR,"__FILE__: number of components of input and output Data do not match.");
43 jgs 82 } else if (!isExpanded(out)) {
44 jgs 150 Finley_setError(TYPE_ERROR,"__FILE__: expanded Data object is expected for output data.");
45 jgs 82 }
46    
47     if (in_data_type == FINLEY_NODES) {
48     if (! numSamplesEqual(in,1,nodes->numNodes)) {
49 jgs 150 Finley_setError(TYPE_ERROR,"__FILE__: illegal number of samples of input Data object");
50 jgs 82 }
51     } else if (in_data_type == FINLEY_DEGREES_OF_FREEDOM) {
52     if (! numSamplesEqual(in,1,nodes->numDegreesOfFreedom)) {
53 jgs 150 Finley_setError(TYPE_ERROR,"__FILE__: illegal number of samples of input Data object");
54 jgs 82 }
55     } else if (in_data_type == FINLEY_REDUCED_DEGREES_OF_FREEDOM) {
56     if (! numSamplesEqual(in,1,nodes->reducedNumDegreesOfFreedom)) {
57 jgs 150 Finley_setError(TYPE_ERROR,"__FILE__: illegal number of samples of input Data object");
58 jgs 82 }
59     } else {
60 jgs 150 Finley_setError(TYPE_ERROR,"__FILE__: illegal function space type for target object");
61 jgs 82 }
62    
63     if (out_data_type == FINLEY_NODES) {
64     if (! numSamplesEqual(out,1,nodes->numNodes)) {
65 jgs 150 Finley_setError(TYPE_ERROR,"__FILE__: illegal number of samples of output Data object");
66 jgs 82 }
67     } else if (out_data_type == FINLEY_DEGREES_OF_FREEDOM) {
68     if (! numSamplesEqual(out,1,nodes->numDegreesOfFreedom)) {
69 jgs 150 Finley_setError(TYPE_ERROR,"__FILE__: illegal number of samples of output Data object");
70 jgs 82 }
71     } else if (out_data_type == FINLEY_REDUCED_DEGREES_OF_FREEDOM) {
72     if (! numSamplesEqual(out,1,nodes->reducedNumDegreesOfFreedom)) {
73 jgs 150 Finley_setError(TYPE_ERROR,"__FILE__: illegal number of samples of output Data object");
74 jgs 82 }
75     } else {
76 jgs 150 Finley_setError(TYPE_ERROR,"__FILE__: illegal function space type for source object");
77 jgs 82 }
78    
79     /* now we can start */
80    
81 jgs 150 if (Finley_noError()) {
82 jgs 82 if (in_data_type == FINLEY_NODES) {
83     if (out_data_type == FINLEY_NODES) {
84     #pragma omp parallel for private(n) schedule(static)
85     for (n=0;n<nodes->numNodes;n++)
86     Finley_copyDouble(numComps,getSampleData(in,n),getSampleData(out,n));
87     } else if (out_data_type == FINLEY_DEGREES_OF_FREEDOM) {
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,nodes->degreeOfFreedom[n]));
91     } else if (out_data_type == FINLEY_REDUCED_DEGREES_OF_FREEDOM) {
92     #pragma omp parallel for private(n,i) schedule(static)
93     for (i=0;i<nodes->numNodes;i++) {
94     n=nodes->reducedDegreeOfFreedom[i];
95     if (n>=0) Finley_copyDouble(numComps,getSampleData(in,i),getSampleData(out,n));
96     }
97     }
98     } else if (in_data_type == FINLEY_DEGREES_OF_FREEDOM) {
99     if (out_data_type == FINLEY_NODES) {
100     #pragma omp parallel for private(n) schedule(static)
101     for (n=0;n<nodes->numNodes;n++)
102     Finley_copyDouble(numComps,getSampleData(in,nodes->degreeOfFreedom[n]),getSampleData(out,n));
103     } else if (out_data_type == FINLEY_DEGREES_OF_FREEDOM) {
104     #pragma omp parallel for private(n) schedule(static)
105     for (n=0;n<nodes->numDegreesOfFreedom;n++)
106     Finley_copyDouble(numComps,getSampleData(in,n),getSampleData(out,n));
107     } else if (out_data_type == FINLEY_REDUCED_DEGREES_OF_FREEDOM) {
108     #pragma omp parallel for private(n,i) schedule(static)
109     for (i=0;i<nodes->numNodes;i++) {
110     n=nodes->reducedDegreeOfFreedom[i];
111     if (n>=0) Finley_copyDouble(numComps,getSampleData(in,nodes->degreeOfFreedom[i]),getSampleData(out,n));
112     }
113     }
114 jgs 147 } else if (in_data_type == FINLEY_REDUCED_DEGREES_OF_FREEDOM) {
115 jgs 82 if (out_data_type == FINLEY_REDUCED_DEGREES_OF_FREEDOM) {
116     #pragma omp parallel for private(n) schedule(static)
117     for (n=0;n<nodes->reducedNumDegreesOfFreedom;n++)
118     Finley_copyDouble(numComps,getSampleData(in,n),getSampleData(out,n));
119 jgs 147 } else if (out_data_type == FINLEY_DEGREES_OF_FREEDOM && numSamplesEqual(out,1,nodes->reducedNumDegreesOfFreedom)) {
120     #pragma omp parallel for private(n) schedule(static)
121     for (i=0;i<nodes->numNodes;i++) {
122     n=nodes->reducedDegreeOfFreedom[i];
123     if (n>=0) Finley_copyDouble(numComps,getSampleData(in,n),getSampleData(out,nodes->degreeOfFreedom[i]));
124     }
125     } else if (out_data_type == FINLEY_NODES && numSamplesEqual(out,1,nodes->reducedNumDegreesOfFreedom)) {
126     #pragma omp parallel for private(n) schedule(static)
127     for (i=0;i<nodes->numNodes;i++) {
128     n=nodes->reducedDegreeOfFreedom[i];
129     if (n>=0) Finley_copyDouble(numComps,getSampleData(in,n),getSampleData(out,i));
130     }
131 jgs 82 } else {
132 jgs 150 Finley_setError(TYPE_ERROR,"__FILE__: cannot copy from data on reduced degrees of freedom");
133 jgs 82 }
134 jgs 147 }
135 jgs 82 }
136     return;
137     }
138     /*
139     * $Log$
140 jgs 150 * Revision 1.4 2005/09/15 03:44:21 jgs
141     * Merge of development branch dev-02 back to main trunk on 2005-09-15
142     *
143 jgs 147 * Revision 1.3 2005/08/12 01:45:42 jgs
144     * erge of development branch dev-02 back to main trunk on 2005-08-12
145     *
146 jgs 150 * Revision 1.2.2.3 2005/09/07 06:26:17 gross
147     * the solver from finley are put into the standalone package paso now
148     *
149 jgs 147 * Revision 1.2.2.2 2005/08/09 02:23:12 gross
150     * print statement removed
151     *
152     * Revision 1.2.2.1 2005/08/03 09:55:33 gross
153     * ContactTest is passing now./mk install!
154     *
155 jgs 123 * Revision 1.2 2005/07/08 04:07:45 jgs
156     * Merge of development branch back to main trunk on 2005-07-08
157 jgs 82 *
158 jgs 123 * Revision 1.1.1.1.2.1 2005/06/29 02:34:46 gross
159     * some changes towards 64 integers in finley
160     *
161     * Revision 1.1.1.1 2004/10/26 06:53:56 jgs
162     * initial import of project esys2
163     *
164 jgs 82 * Revision 1.2 2004/07/21 05:00:54 gross
165     * name changes in DataC
166     *
167     * Revision 1.1 2004/07/02 04:21:13 gross
168     * Finley C code has been included
169     *
170     *
171     */

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26