当前位置: 首页>>代码示例>>C++>>正文


C++ TPZFMatrix::Print方法代码示例

本文整理汇总了C++中TPZFMatrix::Print方法的典型用法代码示例。如果您正苦于以下问题:C++ TPZFMatrix::Print方法的具体用法?C++ TPZFMatrix::Print怎么用?C++ TPZFMatrix::Print使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TPZFMatrix的用法示例。


在下文中一共展示了TPZFMatrix::Print方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: CalcStiff

/// calcula a contribuicao para a matriz de rigidez
void TPBrSteamFlux::CalcStiff(TPZVec<REAL> &leftstate, TPZVec<REAL> &rightstate, TPZVec<REAL> &interfacestate, REAL delx, REAL area, REAL delt, 
			   TPZFMatrix<REAL> &ek, TPZFMatrix<REAL> &ef)
{
	const int totaleq = 2*TPBrCellConservation::NumCellEq+TPBrSteamFlux::NumFluxEq;
	TPZManVector<TFad<totaleq,REAL> , TPBrCellConservation::NumCellEq> leftcellfad(TPBrCellConservation::NumCellEq),rightcellfad(TPBrCellConservation::NumCellEq);
	TPZManVector<TFad<totaleq,REAL> , TPBrSteamFlux::NumFluxEq> interfacefad(TPBrSteamFlux::NumFluxEq);
	
	TPBrCellConservation::Initialize<totaleq>(leftstate,leftcellfad,0);
	TPBrSteamFlux::Initialize<totaleq>(interfacestate,interfacefad,TPBrCellConservation::NumCellEq);
	TPBrCellConservation::Initialize<totaleq>(rightstate,rightcellfad,TPBrCellConservation::NumCellEq+TPBrSteamFlux::NumFluxEq);
	
	TPZManVector<TFad<totaleq,REAL> , NumFluxEq> cellresidualfad(NumFluxEq); 
	
	FluxResidual(leftcellfad, rightcellfad, interfacefad, delx, area, delt, cellresidualfad );
	
	ek.Redim(NumFluxEq, totaleq);
	ef.Redim(NumFluxEq, 1);
	int i,j;
	for (i=0; i<NumFluxEq; i++) 
	{
		ef(i,0) = cellresidualfad[i].val();
		for (j=0; j<totaleq; j++) {
			ek(i,j) = cellresidualfad[i].d(j);
		}
	}
#ifdef LOG4CXX
	{
		std::stringstream sout;
		ek.Print("Flux stiffness",sout);
		LOGPZ_DEBUG(logger,sout.str())
	}
#endif
}
开发者ID:labmec,项目名称:neopz,代码行数:34,代码来源:tpbrsteamflux.cpp

示例2:

void TPZMatRed<TVar,TSideMatrix>::SetF(const TPZFMatrix<TVar> & F)
{
	
	int64_t FCols=F.Cols(),c,r,r1;
	
	fF0.Redim(fDim0,FCols);
	fF1.Redim(fDim1,FCols);
	
	for(c=0; c<FCols; c++){
		r1=0;
		for(r=0; r<fDim0; r++){
			fF0.PutVal( r,c,F.GetVal(r,c) ) ;
		}
		//aqui r=fDim0
		for( ;r<fDim0+fDim1; r++){
			fF1.PutVal( r1++,c,F.GetVal(r,c) );
		}
	}
#ifdef LOG4CXX
    if (logger->isDebugEnabled()) {
        std::stringstream sout;
        F.Print("F Input",sout);
        fF0.Print("fF0 Initialized",sout);
        fF1.Print("fF1 Initialized",sout);
        LOGPZ_DEBUG(logger, sout.str())
    }
开发者ID:labmec,项目名称:neopz,代码行数:26,代码来源:pzmatred.cpp

示例3: InletCalcStiff

/// calcula a contribuicao para a matriz de rigidez das equacoes de entrada
void TPBrSteamFlux::InletCalcStiff(TPZVec<REAL> &rightstate, TPZVec<REAL> &interfacestate, REAL delx, REAL area, REAL delt, 
					TPZFMatrix<REAL> &ek, TPZFMatrix<REAL> &ef)
{
	const int totaleq = NumInletVars+NumFluxEq+TPBrCellConservation::NumCellEq;
//	TPZManVector<TFad<totaleq,REAL> , NumInletVars> inletfad(NumInletVars);
	TPZManVector<TFad<totaleq,REAL> , TPBrSteamFlux::NumFluxEq+TPBrSteamFlux::NumInletVars> interfacefad(TPBrSteamFlux::NumFluxEq+TPBrSteamFlux::NumInletVars);
	TPZManVector<TFad<totaleq,REAL> , TPBrCellConservation::NumCellEq> rightcellfad(TPBrCellConservation::NumCellEq);
	
	//TPBrSteamFlux::InitializeInlet<totaleq>(inletstate,inletfad,0);
	TPBrSteamFlux::InitializeInlet<totaleq>(interfacestate,interfacefad,0);
	TPBrCellConservation::Initialize<totaleq>(rightstate,rightcellfad,NumInletVars+TPBrSteamFlux::NumFluxEq);
#ifdef LOG4CXX
	{
		std::stringstream sout;
        sout << "before calling inlet flux residual\n";
//		sout << "inletfad " << inletfad << std::endl;
		sout << "interfacefad " << interfacefad << std::endl;
        sout << "rightcellfad " << rightcellfad << std::endl;
		LOGPZ_DEBUG(logger,sout.str())
	}
#endif
	
	TPZManVector<TFad<totaleq,REAL> , NumFluxEq+NumInletVars> cellresidualfad(NumFluxEq+NumInletVars); 
	
	InletFluxResidual(rightcellfad, interfacefad, delx, area, delt, cellresidualfad );
	
#ifdef LOG4CXX
    {
        std::stringstream sout;
        sout << "cellresidual " << cellresidualfad;
        LOGPZ_DEBUG(logger, sout.str())
    }
#endif
	ek.Redim(NumFluxEq+NumInletVars, totaleq);
	ef.Redim(NumFluxEq+NumInletVars, 1);
	int i,j;
	for (i=0; i<NumFluxEq+NumInletVars; i++) 
	{
		ef(i,0) = cellresidualfad[i].val();
		for (j=0; j<totaleq; j++) {
			ek(i,j) = cellresidualfad[i].d(j);
		}
	}
#ifdef LOG4CXX
	{
		std::stringstream sout;
		ek.Print("Inlet stiffness",sout);
		LOGPZ_DEBUG(logger,sout.str())
	}
#endif
}
开发者ID:labmec,项目名称:neopz,代码行数:52,代码来源:tpbrsteamflux.cpp

示例4: PrintLS

void TPZDarcyAnalysis::PrintLS(TPZAnalysis *an)
{
    TPZAutoPointer< TPZMatrix<REAL> > KGlobal;
    TPZFMatrix<STATE> FGlobal;
    KGlobal =   an->Solver().Matrix();
    FGlobal =   an->Rhs();
    
#ifdef PZDEBUG
    #ifdef LOG4CXX
        if(logger->isDebugEnabled())
        {
            std::stringstream sout;
            KGlobal->Print("KGlobal = ", sout,EMathematicaInput);
            FGlobal.Print("FGlobal = ", sout,EMathematicaInput);
            LOGPZ_DEBUG(logger,sout.str())
        }
开发者ID:labmec,项目名称:neopz,代码行数:16,代码来源:TPZDarcyAnalysis.cpp

示例5: 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");
	
	
	
}
开发者ID:JoaoFelipe,项目名称:oceano,代码行数:91,代码来源:TPZFrontNonSym.cpp

示例6: Hdiv

void TPZMaterialCoupling::ContributeInterface2(TPZMaterialData &data, TPZMaterialData &dataleft, TPZMaterialData &dataright, 
                                              REAL weight,TPZFMatrix<REAL> &ek,TPZFMatrix<REAL> &ef){
		
		
		
		
//    TPZFMatrix<REAL>  &dphixL = dataleft.dphix;
		TPZFMatrix<REAL>  &phixL = dataleft.phi;
		
		TPZFMatrix<REAL>  &phixR = dataright.phi;
		
		
		
		int numvec=dataright.fVecShapeIndex.NElements();
		int nrowR=phixR.Rows();//funcao a direita Hdiv
		int nrowL=phixL.Rows();//Funcao a esquerda H1
		int numdual = dataright.numberdualfunctions;

		std::cout << "numero de funcoes de Hdiv( direita ) " << nrowR<<std::endl;
		std::cout << "numero de funcoes de de pressao(direita) " << numdual<<std::endl;
		std::cout << "numero de funcoes de H1 (esquerda ) " << nrowL<<std::endl;
#ifdef LOG4CXX
		{
				std::stringstream sout;
				sout << "numero de funcoes de Hdiv( direita ) " << nrowR<<std::endl;
				sout << "numero de funcoes de de pressao(direita) " << numdual<<std::endl;
				sout << "numero de funcoes de H1 (esquerda ) " << nrowL<<std::endl;
				LOGPZ_DEBUG(logger, sout.str().c_str());
		}
#endif
		
		/*
		for(int ir=0; ir<nrowL; ir++) {
				
				for(int jl=0; jl<nrowL; jl++) {
						REAL prod1 =	phixL(ir)* phixL(jl);
				}
		}
         */
		
		
		
		
		for(int ir=0; ir<nrowR-1; ir++) {
//				int ivecind = dataright.fVecShapeIndex[ir].first;
				int ishapeind = dataright.fVecShapeIndex[ir].second;
				for(int jl=0; jl<nrowL; jl++) {
						REAL prod1 =	phixR(ishapeind,0)* phixL(jl);
#ifdef LOG4CXX
						{
								std::stringstream sout;
								sout << "produto das phis " << prod1<<std::endl;
								LOGPZ_DEBUG(logger, sout.str().c_str());
						}
#endif
						ek(ir,numvec+jl) += weight  * prod1;
						ek(numvec+jl,ir) += weight  *(-prod1);
				}
    }
		
		
#ifdef LOG4CXX
		{
				std::stringstream sout;
				ek.Print("Matriz de Acoplamento",sout);
				LOGPZ_DEBUG(logger, sout.str().c_str());
		}
#endif
		
		
		
		
}
开发者ID:JoaoFelipe,项目名称:oceano,代码行数:73,代码来源:pzmaterialcoupling.cpp

示例7: VecHdiv


//.........这里部分代码省略.........
    for(int j=0; j<3; j++) //v4
    {
        fNormalVec(4,j) = coord(j,2)- coord(j,0);
    }
    fVectorSide[count]=2;
    count++;
    //v5
    ComputeNormal(p2,p3,p1,result);
    fNormalVec(5,0) = -result[0];
    fNormalVec(5,1) = -result[1];
    fNormalVec(5,2) = -result[2];
    fVectorSide[count]=4;
    count++;
    //terceira face
    for(int j=0; j<3; j++) //v6
    {
        fNormalVec(6,j) = coord(j,2)- coord(j,1);
    }
    fVectorSide[count]=2;
    count++;
    for(int j=0; j<3; j++) //v7
    {
        fNormalVec(7,j) = coord(j,0)- coord(j,1);
    }
    fVectorSide[count]=0;
    count++;
    //v8
    ComputeNormal(p3,p1,p2,result);
    fNormalVec(8,0) = -result[0];
    fNormalVec(8,1) = -result[1];
    fNormalVec(8,2) = -result[2];
    fVectorSide[count]=5;
    count++;
    // internos tangentes
    for(int j=0; j<3; j++) //v9
    {
        fNormalVec(9,j) = coord(j,1)- coord(j,0);
    }
    fVectorSide[count]=3;
    count++;
    for(int j=0; j<3; j++) //v10
    {
        fNormalVec(10,j) = coord(j,2)- coord(j,1);
    }
    fVectorSide[count]=4;
    count++;

    for(int j=0; j<3; j++) //v11
    {
        fNormalVec(11,j) = coord(j,0)- coord(j,2);
    }
    fVectorSide[count]=5;
    count++;
    //internos meio
    TPZVec<REAL> midle(3,0.);
    midle[0]=(1./3.)*(coord(0,2)+coord(0,0)+coord(0,1));
    midle[1]=(1./3.)*(coord(1,2)+coord(1,0)+coord(1,1));
    midle[2]=(1./3.)*(coord(2,2)+coord(2,0)+coord(2,1));
    TPZFMatrix<REAL> jacobian;
    TPZFMatrix<REAL> axes;
    REAL detjac;
    TPZFMatrix<REAL> jacinv;
    Jacobian(coord,midle,jacobian,axes,detjac,jacinv);
    fNormalVec(12,0)=axes(0,0);
    fNormalVec(12,1)=axes(0,1);
    fNormalVec(12,2)=axes(0,2);
    fNormalVec(13,0)=axes(1,0);
    fNormalVec(13,1)=axes(1,1);
    fNormalVec(13,2)=axes(1,2);
    fVectorSide[count]=6;
    fVectorSide[count+1]=6;
    //normaliza��o
    for(int k=0; k<14; k++)
    {
        REAL temp=0.;
        temp=sqrt( fNormalVec(k,0)*fNormalVec(k,0) + fNormalVec(k,1)*fNormalVec(k,1) + fNormalVec(k,2)*fNormalVec(k,2));
        fNormalVec(k,0) *=1./temp;
        fNormalVec(k,1) *=1./temp;
    }
    // produto normal == 1
    for(int kk=0; kk<3; kk++)
    {
        REAL temp1=0.;
        REAL temp2=0.;
        temp1 =  fNormalVec(kk*3,0)*fNormalVec(kk*3+2,0) + fNormalVec(kk*3,1)*fNormalVec(kk*3+2,1);
        temp2 =  fNormalVec(kk*3+1,0)*fNormalVec(kk*3+2,0) + fNormalVec(kk*3+1,1)*fNormalVec(kk*3+2,1);
        fNormalVec(kk*3,0) *=1./temp1;
        fNormalVec(kk*3,1) *=1./temp1;
        fNormalVec(kk*3+1,0) *=1./temp2;
        fNormalVec(kk*3+1,1) *=1./temp2;
    }
#ifdef LOG4CXX
    {
        std::stringstream sout;
        fNormalVec.Print("fNormalVec", sout);
        LOGPZ_DEBUG(logger,sout.str())
    }
#endif

}
开发者ID:JoaoFelipe,项目名称:oceano,代码行数:101,代码来源:pzgeotriangle.cpp

示例8: Flux

void TPZMaterialTest::Flux(TPZVec<REAL> &x, TPZVec<STATE> &Sol, TPZFMatrix<STATE> &DSol, TPZFMatrix<REAL> &axes, TPZVec<STATE> &flux) {
	if(fabs(axes(2,0)) >= 1.e-6 || fabs(axes(2,1)) >= 1.e-6) {
		cout << "TPZMaterialTest::Flux only serves for xy configuration\n";
		axes.Print("axes");
	}
}
开发者ID:labmec,项目名称:neopz,代码行数:6,代码来源:pzmattest.cpp

示例9: main1


//.........这里部分代码省略.........
		//	TPZfTime timetosub; // init of timer
		//REAL height = Height(gmesh);
		//int nsubstruct = SubStructure(cmesh, height/2);
		
		dohrstruct.SubStructure(16);

		//	tempo.ft0sub = timetosub.ReturnTimeDouble();  // end of timer
		//	std::cout << tempo.ft0sub << std::endl;
		
		//	sub.SubStructure();
		
		
		 //Teste Skyline
        /*
		TPZSkylineStructMatrix skyl(cmesh);
		TPZFMatrix<REAL> rhsfake(cmesh->NEquations(),1,0);
		int numsubmesh = cmesh->NElements();
		TPZAutoPointer<TPZGuiInterface> fakegui = new TPZGuiInterface;
		int nel = cmesh->NElements();
		for (int iel = 0 ; iel < nel ; iel++)
		{
			TPZSubCompMesh *subcompmesh = dynamic_cast<TPZSubCompMesh*>(cmesh->ElementVec()[iel]);
			if(subcompmesh)
			{
				subcompmesh->SetAnalysisSkyline(0,0,fakegui);
			}
		}
		TPZMatrix<REAL> *stiff2 = skyl.CreateAssemble(rhsfake, fakegui,numthread_assemble,numthread_decompose);
		*/
		
#ifdef LOG4CXX
		{
			std::stringstream str;
			cmesh->Print(str);
			LOGPZ_DEBUG(logger,str.str());
		}
#endif

		
		dohrstruct.SetNumThreads(numthreads);
		
		TPZAutoPointer<TPZGuiInterface> gui;
		TPZFMatrix<STATE> rhs(cmesh->NEquations(),1,0.);
        
		TPZMatrix<STATE> *matptr = dohrstruct.Create();
		
		 
		dohrstruct.Assemble(*matptr,rhs,gui,numthread_assemble,numthread_decompose);

	
		TPZAutoPointer<TPZMatrix<STATE> > dohr = matptr;
		TPZAutoPointer<TPZMatrix<STATE> > precond = dohrstruct.Preconditioner();
		
		{
			std::ofstream out("DohrCerta2.txt");
			TPZFMatrix<REAL> Subtract(dohr->Rows(),dohr->Rows()), unitary(dohr->Rows(),dohr->Rows());
			unitary.Identity();
			TPZFMatrix<REAL> result;
			dohr->Multiply(unitary, result);
			result.Print("DohrCerta2", out);
			
		}

/*	
#ifdef LOG4CXX
		{  
开发者ID:labmec,项目名称:neopz,代码行数:67,代码来源:substruct.cpp

示例10: SolveSystemTransient

void SolveSystemTransient(REAL deltaT,REAL maxTime, TPZAnalysis *NonLinearAn, TPZCompMesh* CMesh)
{
    
    TPZFMatrix<STATE> Patn;
    TPZFMatrix<STATE> PatnMinusOne;    
//  {
//      TPZBFileStream load;
//      load.OpenRead("MultiphaseSaturationSol.bin");
//      SolutiontoLoad.Read(load,0);
//      meshvec[2]->LoadSolution(SolutiontoLoad);
//      TPZBuildMultiphysicsMesh::TransferFromMeshes(meshvec, mphysics);        
//  }

  
    std::string OutPutFile = "WaveSolution";
    TPZMaterial *mat1 = CMesh->FindMaterial(1);    
    
    TPZLinearWave * material1 = dynamic_cast<TPZLinearWave *>(mat1);  
    //    TPZMultiphase * material2 = dynamic_cast<TPZMultiphase *>(mat2);      
    material1->SetTimeStep(deltaT);
    
    //  Starting Newton Iterations
    TPZFMatrix<STATE> DeltaX = CMesh->Solution();
    TPZFMatrix<STATE> Uatn = CMesh->Solution();
    TPZFMatrix<STATE> Uatk = CMesh->Solution();      
    
    
    REAL TimeValue = 0.0;
    REAL Tolerance = 1.0e-7;
    int cent = 0;
    int MaxIterations = 50;
    TimeValue = cent*deltaT;
    REAL NormValue =1.0;
    bool StopCriteria = false;
    TPZFMatrix<STATE> RhsAtnMinusOne, RhsAtn, RhsAtnPlusOne, Residual;

    
    std::string outputfile;
    outputfile = OutPutFile;
    std::stringstream outputfiletemp;
    outputfiletemp << outputfile << ".vtk";
    std::string plotfile = outputfiletemp.str();
    PosProcess(material1->Dimension(),*NonLinearAn,outputfile,2);      

    std::cout << " Starting the time computations. " << std::endl;  
    while (TimeValue < maxTime)
    {
        
        material1->SetMinusOneState();
        CMesh->LoadSolution(PatnMinusOne);
        NonLinearAn->AssembleResidual();
        RhsAtnMinusOne = NonLinearAn->Rhs();

        material1->SetNState();
        CMesh->LoadSolution(Patn);        
        NonLinearAn->AssembleResidual();
        RhsAtn = NonLinearAn->Rhs();        
        
        material1->SetPlusOneState();
        CMesh->LoadSolution(Patn);        
        NonLinearAn->Assemble();
        RhsAtnPlusOne = NonLinearAn->Rhs();
        
        Residual= RhsAtnMinusOne + RhsAtn + RhsAtnPlusOne;       
        NormValue = Norm(Residual);
        


        
        int iterations= 0;      
        while (NormValue > Tolerance)
        {       
            
            Residual*=-1.0;
            NonLinearAn->Rhs()=Residual;
            NonLinearAn->Solve();           
            DeltaX = NonLinearAn->Solution();
            Uatk = (Uatn + DeltaX);
            
            
            CMesh->LoadSolution(Uatn + DeltaX);          
            
#ifdef LOG4CXX
            if(logdata->isDebugEnabled())
            {
                std::stringstream sout;
                sout.precision(20);
                Residual.Print(sout);
                Uatk.Print(sout);       
                LOGPZ_DEBUG(logdata,sout.str());
            }
#endif          


            material1->SetPlusOneState();
            NonLinearAn->Assemble();
            RhsAtnPlusOne = NonLinearAn->Rhs();
            Residual= RhsAtnMinusOne + RhsAtn + RhsAtnPlusOne;
            NormValue = Norm(Residual); 
                
//.........这里部分代码省略.........
开发者ID:labmec,项目名称:neopz,代码行数:101,代码来源:LinearWave.cpp


注:本文中的TPZFMatrix::Print方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。