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; }
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; }