本文整理汇总了C++中TPZFMatrix::SolveDirect方法的典型用法代码示例。如果您正苦于以下问题:C++ TPZFMatrix::SolveDirect方法的具体用法?C++ TPZFMatrix::SolveDirect怎么用?C++ TPZFMatrix::SolveDirect使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TPZFMatrix
的用法示例。
在下文中一共展示了TPZFMatrix::SolveDirect方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
void TPZFrontNonSym::main()
{
int i, j;
/**
* Populates data structure
*/
int matsize=6;
TPZFMatrix<REAL> TestMatrix(matsize,matsize);
for(i=0;i<matsize;i++) {
for(j=i;j<matsize;j++) {
int random = rand();
double rnd = (random*matsize)/0x7fff;
TestMatrix(i,j)=rnd;
TestMatrix(j,i)=TestMatrix(i,j);
if(i==j) TestMatrix(i,j)=6000.;
}
}
TPZFMatrix<REAL> Prova;
Prova=TestMatrix;
// Prova.Decompose_Cholesky();
Prova.Print("TPZFMatrix<REAL> Cholesky");
TPZFrontNonSym TestFront(matsize);
TPZVec<int> DestIndex(matsize);
for(i=0;i<matsize;i++) DestIndex[i]=i;
TestFront.SymbolicAddKel(DestIndex);
TestFront.SymbolicDecomposeEquations(0,matsize-1);
std::string OutFile;
OutFile = "TPZFrontNonSymTest.txt";
ofstream output(OutFile.c_str(),ios::app);
TestFront.Compress();
TestFront.AllocData();
TestFront.AddKel(TestMatrix, DestIndex);
TPZEqnArray Result;
/*TestFront.DecomposeEquations(0,0,Result);
TestFront.Print(OutFile, output);
ofstream outeqn("TestEQNArray.txt",ios::app);
Result.Print("TestEQNArray.txt",outeqn);
TestFront.Compress();
TestFront.Print(OutFile, output);
*/
TestFront.DecomposeEquations(0,matsize-1,Result);
ofstream outeqn("TestEQNArray.txt",ios::app);
Result.Print("TestEQNArray.txt",outeqn);
TPZFMatrix<REAL> Load(matsize);
for(i=0;i<matsize;i++) {
int random = rand();
double rnd = (random*matsize)/0x7fff;
Load(i,0)=rnd;
}
TPZFMatrix<REAL> Load_2(matsize);
Load_2=Load;
// Prova.Subst_Forward(&Load);
// Prova.Subst_Backward(&Load);
DecomposeType decType = ECholesky;
Prova.SolveDirect(Load, decType);
Load.Print();
//TestFront.Print(OutFile, output);
Result.EqnForward(Load_2, decType);
Result.EqnBackward(Load_2, decType);
Load_2.Print("Eqn");
}