TheBoussinesqModel  3.2.1
 All Data Structures Files Functions Variables Typedefs Macros Pages
boussinesq_matrix.c
Go to the documentation of this file.
1 /*
2  * boussinesq_matrix.c
3  *
4  * Created on: Jan 18, 2010
5  * Author: ecor
6  */
7 
8 
9 
10 #include "turtle.h"
11 #include "t_utilities.h"
12 #include "doublevector_utilities.h"
13 #include "geometry.h"
14 #include "geometry_attribute.h"
16 #include "boussinesq_matrix.h"
17 #define NULL_VALUE_bm -9999.0
18 
33  LONGVECTOR *index;
34  long i,r,j,kp;
35  DOUBLEBIN *dbin;
36  DOUBLEVECTOR *x_test;
37 
38  index=new_longvector(pca->nh);
39 
40 
41  for (i=index->nl;i<=index->nh;i++) {
42  index->element[i]=1+pca->element[i]->connections->nh;
43  }
44 
45  x_test=new_doublevector(pca->nh);
46 
47  for (i=x_test->nl;i<=x_test->nh;i++) {
48  x_test->element[i]=0.0;
49  }
50 
51  dbin=new_doublebin(index);
52 
53  for (r=dbin->index->nl;r<=dbin->index->nh;r++) {
54  x_test->element[r]=1.0;
55  dbin->element[r][1]=(*operator)(r,x_test);
56  x_test->element[r]=0.0;
57  for (j=2;j<=dbin->index->element[r];j++) {
58  if (pca->element[r]->connections->element[j-1]==boundary) {
59  dbin->element[r][j]=NULL_VALUE_bm;
60  } else {
61  kp=pca->element[r]->connections->element[j-1];
62  x_test->element[kp]=1.0;
63  dbin->element[r][j]=(*operator)(r,x_test);
64  x_test->element[kp]=0.0;
65  }
66  }
67 
68  }
69 
70  free_doublevector(x_test);
71  free_longvector(index);
72 
73  return dbin;
74 }