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

1 /* $Id$ */
2
3 /**************************************************************/
4
5 /* assemblage routines: */
6
7 /* these routines handel cases where there ia a miss match in the number of nodes and the number of shape funtion: */
8
9 /* _in: V[N,numNodes0,numNodes1] is reduced into V[N,numShapes0,numShapes1] */
10 /* _out: V[N,numShapes0,numShapes1] is expanded into V[N,numNodes0,numNodes1] */
11 /* in both cases the leading dimenisons are unchanged */
12
13
14 /**************************************************************/
15
16 /* Copyrights by ACcESS Australia, 2003,2004 */
17 /* author: gross@access.edu.au */
18 /* Version: $Id$ */
19
20 /**************************************************************/
21
22 #include "Common.h"
23 #include "Assemble.h"
24
25
26 /**************************************************************/
27
28 /* this takes the mean value: */
29
30 void Finley_Assemble_handelShapeMissMatch_Mean_in(int N, int numNodes0,int numNodes1, double* V,int numShapes0, int numShapes1) {
31 int l0=MIN(numShapes0,numNodes0-numShapes0);
32 int l1=MIN(numShapes1,numNodes1-numShapes1);
33 int i,k0,k1;
34 if (MAX(l0,l1)>0) {
35 if (numNodes1==numShapes1) {
36 for (k0=0;k0<l0;k0++) {
37 for (i=0;i<N;i++) V[INDEX2(i,k0,N)]= ( V[INDEX2(i,k0,N)]+V[INDEX2(i,k0+numShapes0,N)])/2.;
38 }
39 } else {
40 for (k0=0;k0<l0;k0++) {
41 for (k1=0;k1<l1;k1++) {
42 for (i=0;i<N;i++) {
43 V[INDEX3(i,k0,k1,N,numNodes0)]=
44 ( V[INDEX3(i,k0 ,k1 ,N,numNodes0)]+
45 V[INDEX3(i,k0+numShapes0,k1 ,N,numNodes0)]+
46 V[INDEX3(i,k0 ,k1+numShapes1,N,numNodes0)]+
47 V[INDEX3(i,k0+numShapes0,k1+numShapes1,N,numNodes0)])/4.;
48 }
49 }
50 }
51 }
52 }
53 }
54
55 void Finley_Assemble_handelShapeMissMatch_Mean_out(int N, int numNodes0,int numNodes1, double* V,int numShapes0, int numShapes1) {
56 double RTMP;
57 int i,k0,k1;
58 int l0=MIN(numShapes0,numNodes0-numShapes0);
59 int l1=MIN(numShapes1,numNodes1-numShapes1);
60 if (MAX(l0,l1)>0) {
61 if (numNodes1==numShapes1) {
62 for (k0=0;k0<l0;k0++) {
63 for (i=0;i<N;i++) {
64 RTMP=V[INDEX2(i,k0,N)];
65 V[INDEX2(i,k0 ,N)]=0.;
66 V[INDEX2(i,k0+numShapes0,N)]=0.;
67
68 V[INDEX2(i,k0 ,N)]+=RTMP/2.;
69 V[INDEX2(i,k0+numShapes0,N)]+=RTMP/2.;
70 }
71 }
72 } else {
73 for (k0=0;k0<l0;k0++) {
74 for (k1=0;k1<l1;k1++) {
75 for (i=0;i<N;i++) {
76 RTMP=V[INDEX3(i,k0,k1,N,numNodes0)];
77 V[INDEX3(i,k0 ,k1 ,N,numNodes0)]=0.;
78 V[INDEX3(i,k0+numShapes0,k1 ,N,numNodes0)]=0.;
79 V[INDEX3(i,k0 ,k1+numShapes1,N,numNodes0)]=0.;
80 V[INDEX3(i,k0+numShapes0,k1+numShapes1,N,numNodes0)]=0.;
81
82 V[INDEX3(i,k0 ,k1 ,N,numNodes0)]+=RTMP/4.;
83 V[INDEX3(i,k0+numShapes0,k1 ,N,numNodes0)]+=RTMP/4.;
84 V[INDEX3(i,k0 ,k1+numShapes1,N,numNodes0)]+=RTMP/4.;
85 V[INDEX3(i,k0+numShapes0,k1+numShapes1,N,numNodes0)]+=RTMP/4.;
86 }
87 }
88 }
89 }
90 }
91 }
92
93 void Finley_Assemble_handelShapeMissMatch_Step_in(int N, int numNodes0,int numNodes1, double* V,int numShapes0, int numShapes1) {
94 int l0=MIN(numShapes0,numNodes0-numShapes0);
95 int l1=MIN(numShapes1,numNodes1-numShapes1);
96 int i,k0,k1;
97 if (MAX(l0,l1)>0) {
98 if (numNodes1==numShapes1) {
99 for (k0=0;k0<l0;k0++) {
100 for (i=0;i<N;i++) {
101 V[INDEX2(i,k0,N)]= -V[INDEX2(i,k0,N)]+V[INDEX2(i,k0+numShapes0,N)];
102 }
103 }
104 } else {
105 for (k0=0;k0<l0;k0++) {
106 for (k1=0;k1<l1;k1++) {
107 for (i=0;i<N;i++) {
108 V[INDEX3(i,k0,k1,N,numNodes0)]=
109 V[INDEX3(i,k0 ,k1 ,N,numNodes0)]+
110 V[INDEX3(i,k0+numShapes0,k1 ,N,numNodes0)]-
111 V[INDEX3(i,k0 ,k1+numShapes1,N,numNodes0)]-
112 V[INDEX3(i,k0+numShapes0,k1+numShapes1,N,numNodes0)];
113 }
114 }
115 }
116 }
117 }
118 }
119
120 void Finley_Assemble_handelShapeMissMatch_Step_out(int N, int numNodes0,int numNodes1, double* V,int numShapes0, int numShapes1) {
121 double RTMP;
122 int i,k0,k1;
123 int l0=MIN(numShapes0,numNodes0-numShapes0);
124 int l1=MIN(numShapes1,numNodes1-numShapes1);
125 if (MAX(l0,l1)>0) {
126 if (numNodes1==numShapes1) {
127 for (k0=0;k0<l0;k0++) {
128 for (i=0;i<N;i++) {
129 RTMP=V[INDEX2(i,k0,N)];
130 V[INDEX2(i,k0 ,N)]=0.;
131 V[INDEX2(i,k0+numShapes0,N)]=0.;
132
133 V[INDEX2(i,k0 ,N)]-=RTMP;
134 V[INDEX2(i,k0+numShapes0,N)]+=RTMP;
135 }
136 }
137 } else {
138 for (k0=0;k0<l0;k0++) {
139 for (k1=0;k1<l1;k1++) {
140 for (i=0;i<N;i++) {
141 RTMP=V[INDEX3(i,k0,k1,N,numNodes0)];
142 V[INDEX3(i,k0 ,k1 ,N,numNodes0)]=0.;
143 V[INDEX3(i,k0+numShapes0,k1 ,N,numNodes0)]=0.;
144 V[INDEX3(i,k0 ,k1+numShapes1,N,numNodes0)]=0.;
145 V[INDEX3(i,k0+numShapes0,k1+numShapes1,N,numNodes0)]=0.;
146
147 V[INDEX3(i,k0 ,k1 ,N,numNodes0)]+=RTMP;
148 V[INDEX3(i,k0+numShapes0,k1 ,N,numNodes0)]-=RTMP;
149 V[INDEX3(i,k0 ,k1+numShapes1,N,numNodes0)]-=RTMP;
150 V[INDEX3(i,k0+numShapes0,k1+numShapes1,N,numNodes0)]+=RTMP;
151 }
152 }
153 }
154 }
155 }
156 }
157
158 /*
159 * $Log$
160 * Revision 1.1 2004/10/26 06:53:57 jgs
161 * Initial revision
162 *
163 * Revision 1.1 2004/07/02 04:21:13 gross
164 * Finley C code has been included
165 *
166 *
167 */

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26