3.14下午三点
1 mian文件
#include <gismo.h>
#include <Eigen/Dense>
using namespace Eigen;
using namespace gismo;
using namespace std;
#include<iostream>
#include <vector>
#include "nurbs_uniformRefine.h"
#include "IGA_Plate.h"
#include "Gauss.h"
double IGA_Plate::E = 1e6;
double IGA_Plate::mu = 0.3;
double IGA_Plate::t = 0.01;
MatrixXd Node_Matrix()
{
MatrixXd Node(12, 2);
Node << 0, 0,
0.5, 0,
1.5, 0,
2, 0,
0, 1,
0.5, 1,
1.5, 1,
2, 1,
0, 2,
0.5, 2,
1.5, 2,
2, 2;
return Node;
}
MatrixXd ele_Matrix()
{
MatrixXd ele(2, 9);
ele << 1, 2, 3, 5, 6, 7, 9, 10, 11,
2, 3, 4, 6, 7, 8, 10, 11, 12;
return ele;
}
MatrixXd k_Refine::pre_Node = Node_Matrix();
MatrixXd k_Refine::pre_ele = ele_Matrix();
gsKnotVector<> k_Refine::pre_U(0, 1, 1, 3);
gsKnotVector<> k_Refine::pre_V(0, 1, 0, 3);
void Print(MatrixXd K)
{
for (int j = 0; j < K.rows(); j++)
{
for (int i = 0; i < K.cols(); i++)
{
cout << K(j, i) << " ";
}
cout << endl;
}
}
void Print_Vector(vector<double> U)
{
cout << " 向量值 " << " = " << endl;
for (int i = 0; i < U.size(); i++)
{
cout << " " << U[i] << " ";
}
cout << endl;
}
k_Refine span_2_3;
MatrixXd IGA_Plate::Node = span_2_3.Node;
MatrixXd IGA_Plate::ele = span_2_3.ele;
vector<double> IGA_Plate::U = span_2_3.U;
vector<double> IGA_Plate::V = span_2_3.V;
MatrixXd IGA_Plate::BC = span_2_3.return_BC();
int k_Refine::k = 0;
int main()
{
IGA_Plate iga_2d;
Gauss gauss;
k_Refine k_refine;
MatrixXd Node = iga_2d.Node;
MatrixXd Node1 = k_refine.Node;
cout << "\n 节点位移不变量 disp = \n" << Node.row(0) << endl;
cout << "---------分割线1----------" << endl;
cout << "\n Node = \n" << Node.row(0) << endl;
Print(Node);
vector<double> U1 = k_refine.U;
cout << "\n U1 = " << endl;
Print_Vector(U1);
vector<double> U2 = k_refine.V;
cout << "\n U2 = " << endl;
Print_Vector(U2);
MatrixXd ele1 = k_refine.ele;
cout << "\n ele1 = \n" << ele1 << endl;
MatrixXd BC(8, 2);
BC.setZero();
BC = k_refine.return_BC();
cout << "\n BC = \n" << BC << endl;
VectorXd disp1 = iga_2d.return_disp();
cout << "\n disp = " << endl;
Print(disp1);
gsInfo << "here1" << endl;;
cout << "---------分割线1----------" << endl;
cout << "---------分割线2----------" << endl;
}
2 Gauss.h文件
#pragma once
#include<iostream>
#include <Eigen/Dense>
using namespace Eigen;
using namespace std;
#include <vector>
class Gauss
{
public:
int n;
MatrixXd gp;
MatrixXd wgt;
public:
double jacobian_gauss_mapping(vector<double> elDoma)
{
double jacobian;
if (elDoma.size() == 2)
{
jacobian = (elDoma[0, 1] - elDoma[0, 0]) / 2;
}
if (elDoma.size() == 4)
{
double Jxi = (elDoma[0, 1] - elDoma[0, 0]) / 2;
double Jeta = (elDoma[0, 3] - elDoma[0, 2]) / 2;
jacobian = Jxi * Jeta;
}
if (elDoma.size() == 6)
{
double Jxi = (elDoma[0, 1] - elDoma[0, 0]) / 2;
double Jeta = (elDoma[0, 3] - elDoma[0, 2]) / 2;
double Jzeta = (elDoma[0, 5] - elDoma[0, 4]) / 2;
jacobian = Jxi * Jeta * Jzeta;
}
return jacobian;
}
void gauss_quadrature(vector<double> Gauss_num)
{
if (Gauss_num.size() == 1)