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


C++ TPZCompMesh::CleanUp方法代码示例

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


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

示例1: main

int main(int argc, char *argv[])
{
    
    InitializePZLOG();
    gRefDBase.InitializeUniformRefPattern(EOned);
    gRefDBase.InitializeUniformRefPattern(EQuadrilateral);
    gRefDBase.InitializeUniformRefPattern(ETriangle);
    
    ofstream saidaerros("ErroMDP.txt");
    saidaerros << "\nCalculo do Erro\n";
    int h= 0;
    int p=0, pr;
    
    int dim = 1;
    fc = 0.1;
    fk = 0.0001;
    saidaerros.precision(8);
    
    for(p=1; p<2; p++)
    {
        pr = p+3;
        saidaerros << "\n";
        saidaerros << "Ordens p = " << p << " and Ordens pr = " << pr <<"\n";
        for(h=7; h<8; h++)
        {
            saidaerros << "\nRefinamento: h = "<< h <<"\n";
            
            //if(dim>1){
            //TPZAutoPointer<TPZGeoMesh> gmesh;
             TPZGeoMesh *gmesh;
            if(dim>1){
                gmesh = MalhaGeom(1.,1.,false);
                TPZVec<int> dims(dim,dim);
                if(dim>1) dims[0]=1;
                int nref = h;
                RefinamentoUniforme(gmesh, nref, dims);
            }else
                gmesh = MalhaGeom1D(3.,h);
            
            ofstream arg("gmesh.txt");
            gmesh->Print(arg);
            
            TPZCompMesh * cmesh1;
            TPZCompMesh * cmesh2;
            if(dim>1){
                cmesh1 = CompMesh(gmesh,pr);
                cmesh2 = CompMesh(gmesh,p);
            }else{
                cmesh1 = CompMesh1D(gmesh,pr);
                cmesh2 = CompMesh1D(gmesh,p);
            }
            
            // Criando a malha computacional multifísica
            //malha multifisica
            TPZVec<TPZCompMesh *> meshvec(2);
            meshvec[0] = cmesh1;
            meshvec[1] = cmesh2;
            TPZCompMesh * mphysics;
            if(dim>1){
                mphysics = MalhaMDP(meshvec,gmesh);
            }else
                mphysics = MalhaMDP1D(meshvec,gmesh);

            //analysis
            TPZAnalysis an(mphysics,false);
            TPZStepSolver<STATE> step;
            //TPZBandStructMatrix bst(mphysics);
            //TPZFStructMatrix bst(mphysics);
            TPZSkylineNSymStructMatrix bst(mphysics);
            an.SetStructuralMatrix(bst);
            //bst.SetNumThreads(8);
            step.SetDirect(ELU);
            an.SetSolver(step);
            an.Assemble();
            an.Solve();
            
            TPZBuildMultiphysicsMesh::TransferFromMultiPhysics(meshvec, mphysics);
            
            std::string plotfile("result.vtk");
            TPZStack<std::string> scalnames,vecnames;
            scalnames.Push("Solution");
            scalnames.Push("ExactSolution");
            scalnames.Push("OptimalTestFunction");
            an.DefineGraphMesh(mphysics->Dimension(), scalnames, vecnames, plotfile);
            an.PostProcess(0,dim);
            
            saidaerros<<"\n\nErro da simulacao MDP  para a pressao";
//            TPZVec<REAL> erros(3);
//            TPZAnalysis an2(cmesh2);
//            an2.SetExact(*SolSuave);
//            an2.PostProcessError(erros, saidaerros);
            ErrorH1(cmesh2, saidaerros);
            
            mphysics->CleanUp();
            gmesh->CleanUp();
            delete mphysics;
        }
    }
    
    return EXIT_SUCCESS;
//.........这里部分代码省略.........
开发者ID:labmec,项目名称:neopz,代码行数:101,代码来源:main.cpp

示例2: mainfem

int mainfem(int argc, char *argv[])
{
    //InitializePZLOG();
    gRefDBase.InitializeUniformRefPattern(EOned);
    gRefDBase.InitializeUniformRefPattern(EQuadrilateral);
    gRefDBase.InitializeUniformRefPattern(ETriangle);
    
    ofstream saidaerros("ErroProjecaoSemiH1.txt");
    saidaerros << "\nCalculo do Erro\n";
    int h= 0;
    int p=0;
    
    saidaerros.precision(16);
    
    for(p=1; p<5; p++)
    {
        saidaerros << "\n";
        saidaerros << "Ordens p = " << p <<"\n";
        for(h=0; h<6; h++)
        {
            saidaerros << "\nRefinamento: h = "<< h <<"\n";
            
            //TPZGeoMesh * gmesh = MalhaGeom(1.,1.,false);
            TPZAutoPointer<TPZGeoMesh> gmesh = MalhaGeom(1.,1.,false);
            TPZVec<int> dims(2,0);
            dims[0]=1; dims[1]=2;
            int nref = h;
            RefinamentoUniforme(gmesh, nref, dims);
            
            
            TPZCompMesh * cmesh = CompMesh(gmesh.operator->(),p);
            
            //analysis
            TPZAnalysis an(cmesh,false);
            TPZSkylineStructMatrix skyl(cmesh);
            an.SetStructuralMatrix(skyl);
            TPZStepSolver<STATE> step;
            step.SetDirect(ELDLt);
            an.SetSolver(step);
            an.Assemble();
            an.Solve();
            
//            std::string plotfile("result.vtk");
//            TPZStack<std::string> scalnames,vecnames;
//            scalnames.Push("Solution");
//            scalnames.Push("ExactPressure");
//            an.DefineGraphMesh(cmesh->Dimension(), scalnames, vecnames, plotfile);
//            an.PostProcess(0,2);
            
 //           TPZVec<REAL> erros(3);
//            an.SetExact(*SolSuave);
//            an.PostProcessError(erros,saidaerros);
            ErrorH1(cmesh, saidaerros);
            
            cmesh->CleanUp();
            gmesh->CleanUp();
            delete cmesh;
        }
    }
    
    return EXIT_SUCCESS;
}
开发者ID:labmec,项目名称:neopz,代码行数:62,代码来源:main.cpp


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