📄 mband.cpp
字号:
#include <iostream>
using namespace std;
#include "Plate.h"
//---------------------------------------------------------------------------
int TPlate::Count_MBAND(){
double temp_max = 0.0, temp_min = 0.0;
double max_node = 0.0, min_node = 0.0;
double temp = 0.0, temp_MBAND = 0.0;
double *IDmax, *IDmin;
int *d;
IDmax = Allocate_1D_Matrix(IDmax, Nodes);
IDmin = Allocate_1D_Matrix(IDmin, Nodes);
d = Allocate_1D_Matrix(d, Quad);
IDmax = SetZero_1D_Matrix(IDmax, Nodes);
IDmin = SetZero_1D_Matrix(IDmin, Nodes);
d = SetZero_1D_Matrix(d, Quad);
temp_max = 0;
temp_min = NEQ + 1;
for (int i = 0; i < Nodes; i++){
for (int j = 0; j < DOF; j++){
if (temp_max < ID[j][i]){
temp_max = ID[j][i];
IDmax[i] = temp_max;
}
if (ID[j][i] != 0){
if (temp_min > ID[j][i]){
temp_min = ID[j][i];
IDmin[i] = temp_min;
}
}
}
temp_max = 0;
temp_min = NEQ + 1;
}
temp_max = 0;
temp_min = NEQ + 1;
for (int i = 0; i < Elements; i++){
for (int j = 0; j < Quad; j++){
d[j] = Connect[i][j] - 1;
}
for (int i = 0; i < Quad; i++){
if (IDmax[d[i]] != 0 && IDmin[d[i]] != 0){
if (temp_max < IDmax[d[i]]){
temp_max = IDmax[d[i]];
max_node = temp_max;
}
if (temp_min > IDmin[d[i]]){
temp_min = IDmin[d[i]];
min_node = temp_min;
}
}
}
temp_max = 0;
temp_min = NEQ + 1;
temp_MBAND = max_node - min_node;
if (temp < temp_MBAND){
MBAND = temp_MBAND;
}
}
MBAND = MBAND + 1; // include the diagonal of the matrix
De_Allocate_1D_Matrix(IDmax);
De_Allocate_1D_Matrix(IDmin);
De_Allocate_1D_Matrix(d);
return MBAND;
}
//---------------------------------------------------------------------------
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -