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


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

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


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

示例1: main

int main(){
#define HUGE_DEBUG
  int i;
  TPZCompMesh *cmesh;
  TPZVec <REAL> solution;
  int nstate, nsteps;
  TPZVec<int> meshsize(3,0);
  TPZVec<int> dimstate(3,0);
  TPZVec<int> usestate(3,0);
  TPZVec<int> erind(3,0);
  TPZVec<int> erantype(3,0);
  TPZVec <REAL> maxerror;
  TPZVec <REAL> minerror;
  ifstream arq_control ("/compile/cesar/NeoPZ/Projects/Error/control.txt");
  ReadControl(arq_control,meshsize,nstate,dimstate,usestate,erind,erantype,maxerror,minerror,nsteps);
  //  cout << "Reading Mesh\n";
  ifstream arq_mesh ("/compile/cesar/NeoPZ/Projects/Error/Mesh.data");
  //cmesh = ReadMesh(arq_mesh,meshsize);
  //cmesh = ReadElementsMesh();
  cmesh = TetraMesh();
  cout << "Reading Solution\n";
  ifstream arq_solution ("/compile/cesar/NeoPZ/Projects/Error/Solution.data");
  TPZStack<char *> scalnames,vecnames;
  scalnames.Push("POrder");
  //cmesh->Print(cout);
  //cmesh->Reference()->Print(cout);
  for (i=0;i<nsteps;i++){
    cout << "\n\nEntering step...: " << i << endl;
    //Just for visualization purposes...
    TPZAnalysis an (cmesh);
    char buf [256];
    sprintf(buf,"htest%d.dx",i);
    //an.DefineGraphMesh(3,scalnames,vecnames,buf);
    //an.PostProcess(0,3);
    ofstream arq(buf);
    WriteMesh(cmesh->Reference(),arq);

    ReadSolution(arq_solution,solution,cmesh,nstate,dimstate);
    //  cout << solution << endl;
    TPZCompMesh *adaptmesh;
    TMBAdaptInterface adapt(cmesh,nstate,dimstate,usestate,solution);
    adapt.SetMaxMinError(maxerror,minerror);
    adaptmesh = adapt.GetAdaptedMesh(erind,erantype,true,1,1,0);
    //cmesh->Reference()->ResetReference();
    //   cmesh->LoadReferences();
    //delete cmesh;
    cmesh = adaptmesh;
    //cmesh->Reference()->Print(cout);
  }
  //Just for visualization purposes...
  TPZAnalysis an (cmesh);
  char buf [256];
  sprintf(buf,"htest%d.dx",i);
  ofstream arq (buf);
  WriteMesh(cmesh->Reference(),arq);
//  an.DefineGraphMesh(3,scalnames,vecnames,buf);
//  an.PostProcess(0,3);

//  WriteCompMesh(cmesh,cout);
  delete cmesh;
  cout << "End..." << endl;
  return 0;
}
开发者ID:labmec,项目名称:neopz,代码行数:63,代码来源:main.cpp

示例2: TPZCompMesh

TPZCompMesh *MalhaCompMultifisica(TPZGeoMesh * gmesh,TPZVec<TPZCompMesh *> meshvec, TPZMatUncoupledPoissonDisc* &mymaterial){
    
    
    // Creating computational mesh for multiphysic elements
    gmesh->ResetReference();
    TPZCompMesh *mphysics = new TPZCompMesh(gmesh);
    
    mphysics->SetAllCreateFunctionsMultiphysicElem();
    
    int dim = 2;
    mphysics->SetDimModel(dim);
    mymaterial = new TPZMatUncoupledPoissonDisc(matId, mphysics->Dimension());
    
    mymaterial->SetParameters(1., 1.);
    mymaterial->SetInternalFlux(-8.,0.);
    //mymaterial->SetInternalFlux(0.,0.);
    
    mymaterial->SetNonSymmetricOne();
    mymaterial->SetNonSymmetricTwo();
    mymaterial->SetPenaltyConstant(0., 0.);
    
    TPZMaterial * mat(mymaterial);
    mphysics->InsertMaterialObject(mat);
    
    TPZAutoPointer<TPZFunction<STATE> > forcef = new TPZDummyFunction<STATE>(ForcingF, 5);
    
    //
    //    TPZAutoPointer<TPZFunction<STATE> > forcef = new TPZDummyFunction<STATE>(ForcingF);
    mymaterial->SetForcingFunction(forcef);
    
    
    ///Inserir condicao de contorno
    TPZFMatrix<STATE> val1(2,2,0.), val2(2,1,0.);
    
    TPZMaterial * BCond0 = mymaterial->CreateBC(mat, bc0,neumann_dirichlet, val1, val2);
    TPZMaterial * BCond2 = mymaterial->CreateBC(mat, bc2,neumann_dirichlet, val1, val2);
    TPZMaterial * BCond1 = mymaterial->CreateBC(mat, bc1,dirichlet, val1, val2);
    TPZMaterial * BCond3 = mymaterial->CreateBC(mat, bc3,dirichlet, val1, val2);
    
    //    TPZMaterial * BCond0 = mymaterial->CreateBC(mat, bc0,dirichlet, val1, val2);
    //    TPZMaterial * BCond2 = mymaterial->CreateBC(mat, bc2,dirichlet, val1, val2);
    //    TPZMaterial * BCond1 = mymaterial->CreateBC(mat, bc1,dirichlet, val1, val2);
    //    TPZMaterial * BCond3 = mymaterial->CreateBC(mat, bc3,dirichlet, val1, val2);
    
    
    mphysics->InsertMaterialObject(BCond0);
    mphysics->InsertMaterialObject(BCond1);
    mphysics->InsertMaterialObject(BCond2);
    mphysics->InsertMaterialObject(BCond3);
    
    mphysics->AutoBuild();
    mphysics->AdjustBoundaryElements();
    mphysics->CleanUpUnconnectedNodes();
    
    //Creating multiphysic elements into mphysics computational mesh
    TPZBuildMultiphysicsMesh::AddElements(meshvec, mphysics);
    TPZBuildMultiphysicsMesh::AddConnects(meshvec,mphysics);
    TPZBuildMultiphysicsMesh::TransferFromMeshes(meshvec, mphysics);
    
    mphysics->Reference()->ResetReference();
    mphysics->LoadReferences();
    
    if (disc_functions==true){
        //criar elementos de interface
        int nel = mphysics->ElementVec().NElements();
        for(int el = 0; el < nel; el++)
        {
            TPZCompEl * compEl = mphysics->ElementVec()[el];
            if(!compEl) continue;
            int index = compEl ->Index();
            if(compEl->Dimension() == mphysics->Dimension())
            {
                TPZMultiphysicsElement * InterpEl = dynamic_cast<TPZMultiphysicsElement *>(mphysics->ElementVec()[index]);
                if(!InterpEl) continue;
                InterpEl->CreateInterfaces();
                
            }
        }
    }
    
    return mphysics;
    
}
开发者ID:labmec,项目名称:neopz,代码行数:83,代码来源:main.cpp


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