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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 616 - (show annotations)
Wed Mar 22 02:46:56 2006 UTC (13 years, 7 months ago) by elspeth
File MIME type: text/plain
File size: 6178 byte(s)
Copyright added to more source files.

1 /*
2 ************************************************************
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 */
12
13 /**************************************************************/
14
15 /* assemblage routines: */
16
17 /* these routines handel cases where there ia a miss match in the number of nodes and the number of shape funtion: */
18
19 /* _in: V[N,numNodes0,numNodes1] is reduced into V[N,numShapes0,numShapes1] */
20 /* _out: V[N,numShapes0,numShapes1] is expanded into V[N,numNodes0,numNodes1] */
21 /* in both cases the leading dimenisons are unchanged */
22
23
24 /**************************************************************/
25
26 /* Copyrights by ACcESS Australia 2003,2004,2005 */
27 /* Author: gross@access.edu.au */
28 /* version: $Id$ */
29
30 /**************************************************************/
31
32 #include "Assemble.h"
33
34 /**************************************************************/
35
36 /* this takes the mean value: */
37
38 void Finley_Assemble_handelShapeMissMatch_Mean_in(dim_t N, dim_t numNodes0,dim_t numNodes1, double* V,dim_t numShapes0, dim_t numShapes1) {
39 dim_t l0=MIN(numShapes0,numNodes0-numShapes0);
40 dim_t l1=MIN(numShapes1,numNodes1-numShapes1);
41 dim_t i,k0,k1;
42 if (MAX(l0,l1)>0) {
43 if (numNodes1==numShapes1) {
44 for (k0=0;k0<l0;k0++) {
45 for (i=0;i<N;i++) V[INDEX2(i,k0,N)]= ( V[INDEX2(i,k0,N)]+V[INDEX2(i,k0+numShapes0,N)])/2.;
46 }
47 } else {
48 for (k0=0;k0<l0;k0++) {
49 for (k1=0;k1<l1;k1++) {
50 for (i=0;i<N;i++) {
51 V[INDEX3(i,k0,k1,N,numNodes0)]=
52 ( V[INDEX3(i,k0 ,k1 ,N,numNodes0)]+
53 V[INDEX3(i,k0+numShapes0,k1 ,N,numNodes0)]+
54 V[INDEX3(i,k0 ,k1+numShapes1,N,numNodes0)]+
55 V[INDEX3(i,k0+numShapes0,k1+numShapes1,N,numNodes0)])/4.;
56 }
57 }
58 }
59 }
60 }
61 }
62
63 void Finley_Assemble_handelShapeMissMatch_Mean_out(dim_t N, dim_t numNodes0,dim_t numNodes1, double* V,dim_t numShapes0, dim_t numShapes1) {
64 double RTMP;
65 dim_t i,k0,k1;
66 dim_t l0=MIN(numShapes0,numNodes0-numShapes0);
67 dim_t l1=MIN(numShapes1,numNodes1-numShapes1);
68 if (MAX(l0,l1)>0) {
69 if (numNodes1==numShapes1) {
70 for (k0=0;k0<l0;k0++) {
71 for (i=0;i<N;i++) {
72 RTMP=V[INDEX2(i,k0,N)];
73 V[INDEX2(i,k0 ,N)]=0.;
74 V[INDEX2(i,k0+numShapes0,N)]=0.;
75
76 V[INDEX2(i,k0 ,N)]+=RTMP/2.;
77 V[INDEX2(i,k0+numShapes0,N)]+=RTMP/2.;
78 }
79 }
80 } else {
81 for (k0=0;k0<l0;k0++) {
82 for (k1=0;k1<l1;k1++) {
83 for (i=0;i<N;i++) {
84 RTMP=V[INDEX3(i,k0,k1,N,numNodes0)];
85 V[INDEX3(i,k0 ,k1 ,N,numNodes0)]=0.;
86 V[INDEX3(i,k0+numShapes0,k1 ,N,numNodes0)]=0.;
87 V[INDEX3(i,k0 ,k1+numShapes1,N,numNodes0)]=0.;
88 V[INDEX3(i,k0+numShapes0,k1+numShapes1,N,numNodes0)]=0.;
89
90 V[INDEX3(i,k0 ,k1 ,N,numNodes0)]+=RTMP/4.;
91 V[INDEX3(i,k0+numShapes0,k1 ,N,numNodes0)]+=RTMP/4.;
92 V[INDEX3(i,k0 ,k1+numShapes1,N,numNodes0)]+=RTMP/4.;
93 V[INDEX3(i,k0+numShapes0,k1+numShapes1,N,numNodes0)]+=RTMP/4.;
94 }
95 }
96 }
97 }
98 }
99 }
100
101 void Finley_Assemble_handelShapeMissMatch_Step_in(dim_t N, dim_t numNodes0,dim_t numNodes1, double* V,dim_t numShapes0, dim_t numShapes1) {
102 dim_t l0=MIN(numShapes0,numNodes0-numShapes0);
103 dim_t l1=MIN(numShapes1,numNodes1-numShapes1);
104 dim_t i,k0,k1;
105 if (MAX(l0,l1)>0) {
106 if (numNodes1==numShapes1) {
107 for (k0=0;k0<l0;k0++) {
108 for (i=0;i<N;i++) {
109 V[INDEX2(i,k0,N)]= -V[INDEX2(i,k0,N)]+V[INDEX2(i,k0+numShapes0,N)];
110 }
111 }
112 } else {
113 for (k0=0;k0<l0;k0++) {
114 for (k1=0;k1<l1;k1++) {
115 for (i=0;i<N;i++) {
116 V[INDEX3(i,k0,k1,N,numNodes0)]=
117 V[INDEX3(i,k0 ,k1 ,N,numNodes0)]+
118 V[INDEX3(i,k0+numShapes0,k1 ,N,numNodes0)]-
119 V[INDEX3(i,k0 ,k1+numShapes1,N,numNodes0)]-
120 V[INDEX3(i,k0+numShapes0,k1+numShapes1,N,numNodes0)];
121 }
122 }
123 }
124 }
125 }
126 }
127
128 void Finley_Assemble_handelShapeMissMatch_Step_out(dim_t N, dim_t numNodes0,dim_t numNodes1, double* V,dim_t numShapes0, dim_t numShapes1) {
129 double RTMP;
130 dim_t i,k0,k1;
131 dim_t l0=MIN(numShapes0,numNodes0-numShapes0);
132 dim_t l1=MIN(numShapes1,numNodes1-numShapes1);
133 if (MAX(l0,l1)>0) {
134 if (numNodes1==numShapes1) {
135 for (k0=0;k0<l0;k0++) {
136 for (i=0;i<N;i++) {
137 RTMP=V[INDEX2(i,k0,N)];
138 V[INDEX2(i,k0 ,N)]=0.;
139 V[INDEX2(i,k0+numShapes0,N)]=0.;
140
141 V[INDEX2(i,k0 ,N)]-=RTMP;
142 V[INDEX2(i,k0+numShapes0,N)]+=RTMP;
143 }
144 }
145 } else {
146 for (k0=0;k0<l0;k0++) {
147 for (k1=0;k1<l1;k1++) {
148 for (i=0;i<N;i++) {
149 RTMP=V[INDEX3(i,k0,k1,N,numNodes0)];
150 V[INDEX3(i,k0 ,k1 ,N,numNodes0)]=0.;
151 V[INDEX3(i,k0+numShapes0,k1 ,N,numNodes0)]=0.;
152 V[INDEX3(i,k0 ,k1+numShapes1,N,numNodes0)]=0.;
153 V[INDEX3(i,k0+numShapes0,k1+numShapes1,N,numNodes0)]=0.;
154
155 V[INDEX3(i,k0 ,k1 ,N,numNodes0)]+=RTMP;
156 V[INDEX3(i,k0+numShapes0,k1 ,N,numNodes0)]-=RTMP;
157 V[INDEX3(i,k0 ,k1+numShapes1,N,numNodes0)]-=RTMP;
158 V[INDEX3(i,k0+numShapes0,k1+numShapes1,N,numNodes0)]+=RTMP;
159 }
160 }
161 }
162 }
163 }
164 }
165
166 /*
167 * $Log$
168 * Revision 1.3 2005/09/15 03:44:21 jgs
169 * Merge of development branch dev-02 back to main trunk on 2005-09-15
170 *
171 * Revision 1.2.2.1 2005/09/07 06:26:18 gross
172 * the solver from finley are put into the standalone package paso now
173 *
174 * Revision 1.2 2005/07/08 04:07:47 jgs
175 * Merge of development branch back to main trunk on 2005-07-08
176 *
177 * Revision 1.1.1.1.2.1 2005/06/29 02:34:48 gross
178 * some changes towards 64 integers in finley
179 *
180 * Revision 1.1.1.1 2004/10/26 06:53:57 jgs
181 * initial import of project esys2
182 *
183 * Revision 1.1 2004/07/02 04:21:13 gross
184 * Finley C code has been included
185 *
186 *
187 */

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26