1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43
|
int main()
{
// A bunch of other stuff up here//
.
.
.
int coordSize = coord.size();
double K_element[3][3];
vector< vector<double> > K(coordSize, vector<double>(coordSize));
double x1, x2, x3, y1, y2, y3;
int nodei,nodej,nodek;
//now, do the integral.
for(int i=boundarySize;i<elementSize;i++){
nodei = element[i].nodes[0]-1;
nodej = element[i].nodes[1]-1;
nodek = element[i].nodes[2]-1;
x1 = coord[nodei].x;
x2 = coord[nodej].x;
x3 = coord[nodek].x;
y1 = coord[nodei].y;
y2 = coord[nodej].y;
y3 = coord[nodek].y;
GQ_3NT(x1,x2,x3,y1,y2,y3,K_element);
elementToGlobal(K_element,K,nodei,nodej,nodek);
}
return 0;
}
void elementToGlobal(double K_element[3][3], vector< vector<double> > K, int nodei, int nodej, int nodek){
int arr[3] = {nodei, nodej, nodek};
for(int i=0;i<3;i++){
for(int j=0;j<3;j++){
K[arr[i]][arr[j]] = K_element[i][j];
}
}
}
|