本文整理汇总了C++中TPZCompMesh::Dimension方法的典型用法代码示例。如果您正苦于以下问题:C++ TPZCompMesh::Dimension方法的具体用法?C++ TPZCompMesh::Dimension怎么用?C++ TPZCompMesh::Dimension使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TPZCompMesh
的用法示例。
在下文中一共展示了TPZCompMesh::Dimension方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: InsertMaterialObjects
void InsertMaterialObjects(TPZCompMesh &cmesh)
{
/// criar materiais
int dim = cmesh.Dimension();
TPZMatLaplacianLagrange *materialcoarse = new TPZMatLaplacianLagrange(matcoarsemesh,dim);
// TPZAutoPointer<TPZFunction<REAL> > forcef = new TPZDummyFunction<REAL>(ForceSuave);
// materialcoarse->SetForcingFunction(forcef);
TPZMaterial * mat1(materialcoarse);
cmesh.InsertMaterialObject(mat1);
///Inserir condicao de contorno
TPZFMatrix<STATE> val1(2,2,1.), val2(2,1,0.);
//BC -1
TPZMaterial * BCondD1 = materialcoarse->CreateBC(mat1, bc1,dirichlet, val1, val2);
TPZAutoPointer<TPZFunction<REAL> > bcmatDirichlet1 = new TPZDummyFunction<REAL>(DirichletSuave);
BCondD1->SetForcingFunction(bcmatDirichlet1);
cmesh.InsertMaterialObject(BCondD1);
//BC -2
TPZMaterial * BCondD2 = materialcoarse->CreateBC(mat1, bc2,dirichlet, val1, val2);
TPZAutoPointer<TPZFunction<REAL> > bcmatDirichlet2 = new TPZDummyFunction<REAL>(DirichletSuave);
BCondD2->SetForcingFunction(bcmatDirichlet2);
cmesh.InsertMaterialObject(BCondD2);
//BC -3
TPZMaterial * BCondD3 = materialcoarse->CreateBC(mat1, bc3,dirichlet, val1, val2);
TPZAutoPointer<TPZFunction<REAL> > bcmatDirichlet3 = new TPZDummyFunction<REAL>(DirichletSuave);
BCondD3->SetForcingFunction(bcmatDirichlet3);
cmesh.InsertMaterialObject(BCondD3);
//BC -4
TPZMaterial * BCondD4 = materialcoarse->CreateBC(mat1, bc4,dirichlet, val1, val2);
TPZAutoPointer<TPZFunction<REAL> > bcmatDirichlet4 = new TPZDummyFunction<REAL>(DirichletSuave);
BCondD4->SetForcingFunction(bcmatDirichlet4);
cmesh.InsertMaterialObject(BCondD4);
}
示例2: 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;
//.........这里部分代码省略.........
示例3: InsertMaterialObjectsMHM
void InsertMaterialObjectsMHM(TPZCompMesh &cmesh, bool useDPGPhil, bool useDPG)
{
/// criar materiais
int dim = cmesh.Dimension();
TPZMatLaplacianLagrange *materialFiner = new TPZMatLaplacianLagrange(matfinermesh,dim);
// TPZAutoPointer<TPZFunction<REAL> > forcef = new TPZDummyFunction<REAL>(ForceSuave);
// materialFiner->SetForcingFunction(forcef);
TPZAutoPointer<TPZFunction<STATE> > solExata= new TPZDummyFunction<STATE>(SolSuave);
materialFiner->SetForcingFunctionExact(solExata);
TPZAutoPointer<TPZFunction<STATE> > forcef;
TPZDummyFunction<STATE> *dum;
dum = new TPZDummyFunction<STATE>(ForceSuave);
dum->SetPolynomialOrder(20);
forcef = dum;
materialFiner->SetForcingFunction(forcef);
if(useDPGPhil==true){
materialFiner->SetDPGPhil();
useDPG=false;
}
if(useDPG==true){
materialFiner->SetMDP();
useDPGPhil=false;
}
TPZMaterial * mat1(materialFiner);
TPZMat1dLin *materialSkeleton = new TPZMat1dLin(matskeletonmesh);
TPZFNMatrix<1,STATE> xk(1,1,0.),xb(1,1,0.),xc(1,1,0.),xf(1,1,0.);
materialSkeleton->SetMaterial(xk, xc, xb, xf);
cmesh.InsertMaterialObject(mat1);
cmesh.InsertMaterialObject(materialSkeleton);
///Inserir condicao de contorno
TPZFMatrix<STATE> val1(2,2,1.), val2(2,1,0.);
int boundcond = dirichlet;
if(useDPG) boundcond = neumanndirichlet;
//BC -1
TPZMaterial * BCondD1 = materialFiner->CreateBC(mat1, bc1,boundcond, val1, val2);
TPZAutoPointer<TPZFunction<REAL> > bcmatDirichlet1 = new TPZDummyFunction<REAL>(DirichletSuave);
BCondD1->SetForcingFunction(bcmatDirichlet1);
cmesh.InsertMaterialObject(BCondD1);
//BC -2
TPZMaterial * BCondD2 = materialFiner->CreateBC(mat1, bc2,boundcond, val1, val2);
TPZAutoPointer<TPZFunction<REAL> > bcmatDirichlet2 = new TPZDummyFunction<REAL>(DirichletSuave);
BCondD2->SetForcingFunction(bcmatDirichlet2);
cmesh.InsertMaterialObject(BCondD2);
//BC -3
TPZMaterial * BCondD3 = materialFiner->CreateBC(mat1, bc3,boundcond, val1, val2);
TPZAutoPointer<TPZFunction<REAL> > bcmatDirichlet3 = new TPZDummyFunction<REAL>(DirichletSuave);
BCondD3->SetForcingFunction(bcmatDirichlet3);
cmesh.InsertMaterialObject(BCondD3);
//BC -4
TPZMaterial * BCondD4 = materialFiner->CreateBC(mat1, bc4,boundcond, val1, val2);
TPZAutoPointer<TPZFunction<REAL> > bcmatDirichlet4 = new TPZDummyFunction<REAL>(DirichletSuave);
BCondD4->SetForcingFunction(bcmatDirichlet4);
cmesh.InsertMaterialObject(BCondD4);
}
示例4: 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;
}