本文整理匯總了C++中TPZAutoPointer::CreateBC方法的典型用法代碼示例。如果您正苦於以下問題:C++ TPZAutoPointer::CreateBC方法的具體用法?C++ TPZAutoPointer::CreateBC怎麽用?C++ TPZAutoPointer::CreateBC使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類TPZAutoPointer
的用法示例。
在下文中一共展示了TPZAutoPointer::CreateBC方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C++代碼示例。
示例1: mp
//.........這裏部分代碼省略.........
int in;
nodeindex.Resize(numnos[nel]);
for(in=0; in<numnos[nel]; in++) {
nodeindex[in] = nodind[nel][in];
}
int index;
switch(nel) {
case 0:
// elvec[el] = gmesh->CreateGeoElement(ECube,nodeindex,1,index);
// gelvec[nel]=new TPZGeoElC3d(nodeindex,matid,*gmesh);
break;
case 1:
gelvec[nel] = gmesh->CreateGeoElement(EPiramide,nodeindex,matid,index);
// gelvec[nel]=new TPZGeoElPi3d(nodeindex,matid,*gmesh);
break;
case 2:
gelvec[nel] = gmesh->CreateGeoElement(ETetraedro,nodeindex,matid,index);
// gelvec[nel]=new TPZGeoElT3d(nodeindex,matid,*gmesh);
break;
case 3:
// gelvec[nel]=new TPZGeoElPr3d(nodeindex,matid,*gmesh);
// gelvec[nel] = gmesh->CreateGeoElement(EPrisma,nodeindex,matid,index);
break;
case 4:
// gelvec[nel]=new TPZGeoEl1d(nodeindex,2,*gmesh);
break;
case 5:
// gelvec[nel]=new TPZGeoElQ2d(nodeindex,3,*gmesh);
break;
case 6:
// gelvec[nel]=new TPZGeoElT2d(nodeindex,3,*gmesh);
break;
default:
break;
}
}
gmesh->BuildConnectivity2();
//TPZVec<TPZGeoEl *> sub;
//elvec[0]->Divide(sub);
// elvec[1]->Divide(sub);
// elvec[2]->Divide(sub);
// TPZGeoElBC gbc;
// bc -1 -> Dirichlet
// TPZGeoElBC gbc1(gelvec[0],20,-1,*gmesh);
TPZGeoElBC gbc11(gelvec[1],14,-1,*gmesh);
// TPZGeoElBC gbc12(gelvec[3],15,-1,*gmesh);
// bc -2 -> Neumann at the right x==1
// TPZGeoElBC gbc2(gelvec[0],25,-2,*gmesh);
// TPZGeoElBC gbc21(gelvec[3],19,-2,*gmesh);
TPZGeoElBC gbc22(gelvec[2],10,-2,*gmesh);
TPZCompMesh *cmesh = new TPZCompMesh(gmesh);
TPZAutoPointer<TPZMaterial> mat;
// if(nstate == 3) {
mat = new TPZMaterialTest3D(1);
TPZFMatrix mp (3,1,0.);
TPZMaterialTest3D * mataux = dynamic_cast<TPZMaterialTest3D *> (mat.operator ->());
TPZMaterialTest3D::geq3=1;
mataux->SetMaterial(mp);
/* } else {
TPZMat2dLin *mat2d = new TPZMat2dLin(1);
int ist,jst;
TPZFMatrix xk(nstate,nstate,1.),xc(nstate,nstate,0.),xf(nstate,1,0.);
for(ist=0; ist<nstate; ist++) {
if(nstate != 1) xf(ist,0) = 1.;
for(jst=0; jst<nstate; jst++) {
if(ist != jst) xk(ist,jst) = 0.;
}
}
mat2d->SetMaterial(xk,xc,xf);
mat = mat2d;
}*/
TPZFMatrix val1(3,3,0.),val2(3,1,0.);
TPZAutoPointer<TPZMaterial> bc[2];
bc[0] = mat->CreateBC(mat,-1,0,val1,val2);
val2(0,0) = 1.;
bc[1] = mat->CreateBC(mat,-2,1,val1,val2);
cmesh->InsertMaterialObject(mat);
int i;
for(i=0; i<2; i++) cmesh->InsertMaterialObject(bc[i]);
gmesh->Print(cout);
cmesh->AutoBuild();
cmesh->AdjustBoundaryElements();
cmesh->CleanUpUnconnectedNodes();
gmesh->Print(cout);
return cmesh;
}