10 #error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!"
15 #include "../classes.h"
16 #include "../../shared/shared.h"
40 _error_(
"Two input element matrices are NULL");
52 P=xNew<int>(pe2->
nrows);
56 for(i=0;i<pe2->
nrows;i++){
58 for(j=0;j<pe1->
nrows;j++){
60 found=
true; P[i]=j;
break;
74 for(i=0;i<pe1->
nrows;i++){
78 for(i=0;i<pe2->
nrows;i++){
85 for(i=0;i<pe2->
fsize;i++){
92 for(i=0;i<pe1->
fsize;i++){
97 for(i=0;i<pe2->
fsize;i++){
134 this->
values=xNewZeroInit<IssmDouble>(this->
nrows);
147 xDelete<IssmDouble>(this->
values);
165 localvalues=xNew<IssmDouble>(this->
fsize);
166 for(i=0;i<this->
fsize;i++){
173 xDelete<IssmDouble>(localvalues);
181 for (
int i=0;i<this->
nrows;i++){
182 if (xIsNan<IssmDouble>(this->
values[i]))
_error_(
"NaN found in Element Vector");
183 if (xIsInf<IssmDouble>(this->
values[i]))
_error_(
"Inf found in Element Vector");
184 if (fabs( this->
values[i])>1.e+50)
_error_(
"Element Vector values exceeds 1.e+50");
196 for(i=0;i<
nrows;i++){
197 _printf_(setw(4) << right << i <<
": " << setw(10) <<
values[i] <<
"\n");
220 xMemCpy<IssmDouble>(this->
values,pe->
values,this->nrows);
245 localvalues=xNew<IssmDouble>(this->
fsize);
246 for(i=0;i<this->
fsize;i++){
253 xDelete<IssmDouble>(localvalues);
288 int counter,i,j,isize;
295 int *iindices = NULL;
299 isize = this->
nrows - bsize;
300 iindices = xNew<int>(isize);
302 for(i=0;i<this->
nrows;i++){
304 for(j=0;j<bsize;j++){
312 iindices[counter++] = i;
318 Kib = xNew<IssmDouble>(isize*bsize);
319 Kbb = xNew<IssmDouble>(bsize*bsize);
320 Fb = xNew<IssmDouble>(bsize);
321 Fi = xNew<IssmDouble>(isize);
322 for(i=0;i<isize;i++)
for(j=0;j<bsize;j++) Kib[i*bsize+j] = Ke->
values[iindices[i]*Ke->
ncols + bindices[j]];
323 for(i=0;i<bsize;i++)
for(j=0;j<bsize;j++) Kbb[i*bsize+j] = Ke->
values[bindices[i]*Ke->
ncols + bindices[j]];
324 for(i=0;i<bsize;i++) Fb[i] = this->
values[bindices[i]];
325 for(i=0;i<isize;i++) Fi[i] = this->
values[iindices[i]];
328 Kbbinv = xNew<IssmDouble>(bsize*bsize);
331 Kbbinv[0] = 1./Kbb[0];
345 Ftemp = xNew<IssmDouble>(isize);
346 TripleMultiply(Kib,isize,bsize,0, Kbbinv,bsize,bsize,0, Fb,bsize,1,0, Ftemp,0);
349 for(i=0;i<isize;i++) Ftemp[i] = Fi[i] - Ftemp[i];
353 for(i=0;i<isize;i++){
354 this->
values[iindices[i]] = Ftemp[i];
358 xDelete<IssmDouble>(Kib);
359 xDelete<IssmDouble>(Kbb);
360 xDelete<IssmDouble>(Kbbinv);
361 xDelete<IssmDouble>(Fb);
362 xDelete<IssmDouble>(Fi);
363 xDelete<IssmDouble>(Ftemp);
364 xDelete<int>(iindices);