Ejemplo n.º 1
0
//.........................................................................................................................................
void TPZRefPatternDataBase::ReadRefPatternDBase(std::ifstream &filename)
{
    fElTypeRefPatterns.clear();
    fIdRefPatterns.clear();
    
	int nRefpatterns;
	filename >> nRefpatterns;
	for(int i = 0; i < nRefpatterns; i++)
	{
		TPZAutoPointer<TPZRefPattern> refP = new TPZRefPattern;
		refP->ReadPattern(filename);
		
        MElementType eltype = refP->Element(0)->Type();
        fElTypeRefPatterns[eltype].push_back(refP);
        fIdRefPatterns[refP->Id()] = refP;
	}
}
Ejemplo n.º 2
0
void TPZBndCond::Clone(std::map<int, TPZAutoPointer<TPZMaterial> > &matvec) {
    int matid = Id();

    TPZAutoPointer<TPZMaterial> refmaterial = Material();
    TPZAutoPointer<TPZMaterial> newrefmaterial;
    int refmatid = 0;
    if(refmaterial) {
        refmaterial->Clone(matvec);
        refmatid = refmaterial->Id();
        newrefmaterial = matvec[refmatid];
    }
    std::map<int, TPZAutoPointer<TPZMaterial> >::iterator matit;
    matit = matvec.find(matid);
    if(matit == matvec.end())
    {
        TPZAutoPointer<TPZMaterial> newmat = TPZAutoPointer<TPZMaterial>(new TPZBndCond(*this, newrefmaterial));
        matvec[matid] = newmat;
    }
}
Ejemplo n.º 3
0
void TPZMulticamadaOrthotropic::AddPlacaOrtho(TPZAutoPointer<TPZMaterial> material, REAL height){
	
	TPZAutoPointer<TPZMaterial> bcptr;
	fCompMesh->InsertMaterialObject(material);
	TPZFNMatrix<9> val1(3,3,0.),val2(3,1,0.);
	TPZBCTension *bc = new TPZBCTension(material,-material->Id()*4,4,val1,val2, 1., this,fPlacaOrth.NElements());
	bcptr = TPZAutoPointer<TPZMaterial>(bc);
	fCompMesh->InsertMaterialObject(bcptr);
	bc = new TPZBCTension(material,-material->Id()*4-1,4,val1,val2, 1., this,fPlacaOrth.NElements());
	bcptr = TPZAutoPointer<TPZMaterial>(bc);
	fCompMesh->InsertMaterialObject(bcptr);
	bc = new TPZBCTension(material,-material->Id()*4-2,4,val1,val2, -1., this,fPlacaOrth.NElements());
	bcptr = TPZAutoPointer<TPZMaterial>(bc);
	fCompMesh->InsertMaterialObject(bcptr);
	bc = new TPZBCTension(material,-material->Id()*4-3,4,val1,val2, -1.,this,fPlacaOrth.NElements());
	bcptr = TPZAutoPointer<TPZMaterial>(bc);
	fCompMesh->InsertMaterialObject(bcptr);
	
	//  fPlacaOrth.Push(placa);
	int nnodes = fGeoMesh->NodeVec().NElements();
	fGeoMesh->NodeVec().Resize(nnodes+(fNelx+1)*(fNely+1));
	int ix, iy;
	TPZManVector<REAL,3> coord(3,fZMax+height);
	fZMax += height;
	for(ix=0; ix<= fNelx; ix++) {
		for(iy=0; iy<= fNely; iy++) {
			coord[0] = ix*fDx-fDx*REAL(fNelx/2.);
			coord[1] = iy*fDy-fDy*REAL(fNely/2.);
			fGeoMesh->NodeVec()[nnodes+ix+iy*(fNelx+1)].Initialize(coord,*fGeoMesh);
		}
	}
	int nodebase1 = nnodes - (fNelx+1)*(fNely+1);
	int elx, ely;
	TPZManVector<int,8> nodeindexes(8,-1);
	for(elx=0; elx<fNelx; elx++) {
		for(ely=0; ely<fNely; ely++) {
			nodeindexes[0] = nodebase1+elx+ely*(fNelx+1);
			nodeindexes[1] = nodebase1+elx+1+ely*(fNelx+1);
			nodeindexes[2] = nodebase1+elx+1+(ely+1)*(fNelx+1);
			nodeindexes[3] = nodebase1+elx+(ely+1)*(fNelx+1);
			int i;
			for(i=0; i<4; i++) nodeindexes[i+4] = nodeindexes[i]+(fNelx+1)*(fNely+1);
			int index;
			TPZGeoEl *gel = fGeoMesh->CreateGeoElement (ECube, nodeindexes, material->Id(), index);
			if(ely == 0) TPZGeoElBC gbc1(gel,21,-material->Id()*4);
			if(elx == fNelx-1) TPZGeoElBC gbc2(gel,22,-material->Id()*4-1);
			if(ely == fNely-1) TPZGeoElBC gbc3(gel,23,-material->Id()*4-2);
			if(elx == 0) TPZGeoElBC gbc4(gel,24,-material->Id()*4-3);
			int nplaca = fPlacaOrth.NElements();
			if(nplaca == 0 && elx == 0 && ely == 0) {
				TPZBndCond *bc2 = new TPZBndCond(material,-100,0,val1,val2);
				bcptr = TPZAutoPointer<TPZMaterial>(bc2);
				fCompMesh->InsertMaterialObject(bcptr);
				TPZGeoElBC gbc5(gel,0,-100);
				val1(0,0) = 1.e12;
				val1(2,2) = 1.e12;
				TPZBndCond *bc3 = new TPZBndCond(material,-101,2,val1,val2);
				bcptr = TPZAutoPointer<TPZMaterial>(bc3);
				fCompMesh->InsertMaterialObject(bcptr);
				TPZGeoElBC gbc6(gel,3,-101);
				val1.Zero();
				val1(0,0) = 0.;
				val1(2,2) = 1.e12;
				TPZBndCond *bc4 = new TPZBndCond(material,-102,2,val1,val2);
				bcptr = TPZAutoPointer<TPZMaterial>(bc4);
				
				fCompMesh->InsertMaterialObject(bcptr);
				TPZGeoElBC gbc7(gel,2,-102);
			}
			if(elx == fNelx/2 && ely == fNely/2) {
				TPZPlacaOrthotropic placa(gel,fZMax-height,fZMax);
				fPlacaOrth.Push(placa);
			}
		}
	}
}