• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ TPZCompMesh类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: CreateMidSideConnect

TPZIntelGen<TSHAPE>::TPZIntelGen(TPZCompMesh &mesh, TPZGeoEl *gel, int &index) :
TPZInterpolatedElement(mesh,gel,index) {
	int i;
	fPreferredOrder = mesh.GetDefaultOrder();
	for(i=0;i<TSHAPE::NSides-TSHAPE::NCornerNodes;i++) {
		//    fSideOrder[i] = gOrder;
	}
	for(i=0; i<TSHAPE::NSides; i++) fConnectIndexes[i]=-1;
	//  RemoveSideRestraintsII(EInsert);
	gel->SetReference(this);
	for(i=0;i<TSHAPE::NCornerNodes;i++) {
		fConnectIndexes[i] = CreateMidSideConnect(i);
		mesh.ConnectVec()[fConnectIndexes[i]].IncrementElConnected();
	}
	for(;i<TSHAPE::NSides;i++) {
		fConnectIndexes[i] = CreateMidSideConnect(i);
		mesh.ConnectVec()[fConnectIndexes[i]].IncrementElConnected();
		IdentifySideOrder(i);
	}
	
	int sideorder = SideOrder(TSHAPE::NSides-1);
	sideorder = 2*sideorder;
	if (sideorder > fIntRule.GetMaxOrder()) sideorder = fIntRule.GetMaxOrder();
	//  TPZManVector<int,3> order(3,2*sideorder+2);
	TPZManVector<int,3> order(3,sideorder);
	//TPZManVector<int,3> order(3,20);
	fIntRule.SetOrder(order);
	
}
开发者ID:JoaoFelipe,项目名称:oceano,代码行数:29,代码来源:pzelctemp.cpp


示例2: main

///Funcao principal do programa
int main(int argc, char *argv[])
{
    int dim = 2;//dimensao do problema
    int uNDiv=3,
    vNDiv=4;//numero de divisoes feitas no dominio
	int nel = uNDiv*vNDiv; //numero de elementos a serem utilizados
    int pOrder = 4; //ordem polinomial de aproximacao
	TPZGeoMesh *gmesh = CreateGMesh(nel, uNDiv, vNDiv); //funcao para criar a malha geometrica
	
	TPZCompMesh *cmesh = CMesh(gmesh, pOrder); //funcao para criar a malha computacional

	// Resolvendo o Sistema
    bool optimizeBandwidth = false; //impede a renumeracao das equacoes do problema(para obter o mesmo resultado do Oden)
	TPZAnalysis an(cmesh, optimizeBandwidth); //cria objeto de analise que gerenciaria a analise do problema
	an.Run();//assembla a matriz de rigidez (e o vetor de carga) global e inverte o sistema de equacoes
    
	TPZFMatrix<STATE> solucao=cmesh->Solution();//Pegando o vetor de solucao, alphaj
	solucao.Print("Sol",cout,EMathematicaInput);//imprime na formatacao do Mathematica
	
    //fazendo pos processamento para paraview
    TPZStack<string> scalnames, vecnames;
    scalnames.Push("State");//setando para imprimir u
    string plotfile = "ModelProblemSol.vtk";//arquivo de saida que estara na pasta debug
    an.DefineGraphMesh(dim, scalnames, vecnames, plotfile);//define malha grafica
	int postProcessResolution = 3;//define resolucao do pos processamento
    an.PostProcess(postProcessResolution);//realiza pos processamento
    
	std::cout << "FINISHED!" << std::endl;
	
	return 0;
}
开发者ID:labmec,项目名称:neopz,代码行数:32,代码来源:ExemploSimples2D.cpp


示例3: TPZGeoMesh

TPZCompMesh *TetraMesh(){
  REAL Coord [8][3] = {
    {0.,0.,0.},{1.,0.,0.},{1.,1.,0.},{0.,1.,0.},
    {0.,0.,1.},{1.,0.,1.},{1.,1.,1.},{0.,1.,1.}
  };

  int Connects [5][4] = {
    {0,1,3,4},
    {1,2,3,6},
    {5,6,4,1},
    {7,6,4,3},
    {1,3,4,6}
  };

  int i,j;
  TPZGeoMesh *gmesh = new TPZGeoMesh();
  TPZGeoEl * elvec[5];
  TPZVec <REAL> coord (3,0.);
  int index;
  //Nodes initialization
  for(i = 0; i < 8; i++){
    for(j=0;j<3;j++){
      coord[j] = Coord[i][j];
    }
    index = gmesh->NodeVec().AllocateNewElement();
    gmesh->NodeVec()[index] = TPZGeoNode(i,coord,*gmesh);
  }

  TPZVec<TPZRefPattern *> refinement_Patterns(6,0);
//  refinement_Patterns.Resize(6);
  refinement_Patterns[0] = new TPZRefPattern("/home/pos/cesar/RefPattern/Tetra_Rib_Side_4.rpt");
  refinement_Patterns[1] = new TPZRefPattern("/home/pos/cesar/RefPattern/Tetra_Rib_Side_5.rpt");
  refinement_Patterns[2] = new TPZRefPattern("/home/pos/cesar/RefPattern/Tetra_Rib_Side_6.rpt");
  refinement_Patterns[3] = new TPZRefPattern("/home/pos/cesar/RefPattern/Tetra_Rib_Side_7.rpt");
  refinement_Patterns[4] = new TPZRefPattern("/home/pos/cesar/RefPattern/Tetra_Rib_Side_8.rpt");
  refinement_Patterns[5] = new TPZRefPattern("/home/pos/cesar/RefPattern/Tetra_Rib_Side_9.rpt");

  for (i=0;i<6;i++) gmesh->InsertRefPattern(refinement_Patterns[i]);

  for (i=0;i<5;i++){
    int ncon = 4;
    TPZVec <int> connect(ncon,0);
    for(j=0; j<ncon;j++){
      connect[j] = Connects[i][j];
    }
    elvec[i] = GeoElementRefPattern(gmesh,7,connect,1,i,refinement_Patterns);
  }
  //Generate neighborhod information
//  gmesh->Print(cout);
  gmesh->BuildConnectivity();
//  gmesh->Print(cout);
  //Create computational mesh
  TPZCompMesh *cmesh = new TPZCompMesh(gmesh);
  TPZMaterial *mat;
  mat = new TPZMaterialTest3D (1);
  cmesh->InsertMaterialObject(mat);

  cmesh->AutoBuild();
  return cmesh;
}
开发者ID:labmec,项目名称:neopz,代码行数:60,代码来源:main.cpp


示例4: UndoMakeRaviartTomas

/**
 * @brief transform in low order Raviar Tomas
 */
void TPZCreateApproximationSpace::UndoMakeRaviartTomas(TPZCompMesh &cmesh)
{
    int numcell = cmesh.NElements();
    int el;
    for (el = 0; el<numcell ; el++) {
        TPZCompEl *cel = cmesh.ElementVec()[el];
        TPZInterpolatedElement *intel = dynamic_cast<TPZInterpolatedElement *>(cel);
        if (!intel) {
            continue;
        }
        TPZGeoEl *gel = intel->Reference();
        int geldim = gel->Dimension();
        int is;
        int nsides = gel->NSides();
        for (is=0; is<nsides; is++) {
            if (gel->SideDimension(is) != geldim-1) {
                continue;
            }
            int nsconnects = intel->NSideConnects(is);
            // only interested in HDiv elements
            if (nsconnects != 1) {
                continue;
            }
//            int cindex = intel->SideConnectIndex(0, is);
            TPZConnect &c = intel->Connect(intel->SideConnectLocId(0,is));
            if (c.HasDependency()) {
                c.RemoveDepend();
            }
        }
    }
    cmesh.ExpandSolution();
    cmesh.CleanUpUnconnectedNodes();
}
开发者ID:JoaoFelipe,项目名称:oceano,代码行数:36,代码来源:pzcreateapproxspace.cpp


示例5: ComputationalMesh

TPZCompMesh * ComputationalMesh(TPZGeoMesh * gmesh, int p)
{
    int matid = 1;
    int dim = 2;
    REAL wavespeed = 1.0;

    ///Computational Mesh
    TPZCompEl::SetgOrder(p);
    TPZCompMesh * cmesh = new TPZCompMesh(gmesh);
    cmesh->SetDimModel(dim);    
    cmesh->SetAllCreateFunctionsContinuous();
    
    TPZMaterial * Air = new TPZLinearWave(matid,dim);
    cmesh->InsertMaterialObject(Air);
    
    {
        //Boundary Conditions
        TPZFMatrix<STATE> k1(dim,dim,0.), k2(dim,dim,0.);
        TPZMaterial * BCD = Air->CreateBC(Air, 2, 0, k1, k2);
        cmesh->InsertMaterialObject(BCD);
        
        TPZMaterial * BCN = Air->CreateBC(Air, 3, 1, k1, k2);
        cmesh->InsertMaterialObject(BCN);
    }   
        
    cmesh->AutoBuild();
    cmesh->AdjustBoundaryElements();
    cmesh->CleanUpUnconnectedNodes();    
    
    return cmesh;
}
开发者ID:labmec,项目名称:neopz,代码行数:31,代码来源:LinearWave.cpp


示例6: mat

TPZCompMesh *CompMesh1D(TPZGeoMesh *gmesh,int p, TPZMaterial *material,TPZVec<int> &bc,TPZVec<int> &bcType) {
	if(!material || bc.NElements()<2 || bcType.NElements() != bc.NElements()) return NULL;
	int dim = 1;
	
	
	TPZAutoPointer<TPZMaterial> mat(material);
	
	// related to interpolation space
	TPZCompEl::SetgOrder(p);
	TPZCompMesh *cmesh = new TPZCompMesh(gmesh);
	cmesh->SetDimModel(dim);
	cmesh->SetAllCreateFunctionsContinuous();
	cmesh->InsertMaterialObject(mat);
	
	// Related to boundary conditions
	//	REAL uN=1-cosh(1.)/sinh(1.);
	TPZFMatrix<STATE> val1(1,1,0.), val2(1,1,0.);
	if(!bcType[0])  // dirichlet
		val2.PutVal(0,0,0.0);
	TPZAutoPointer<TPZMaterial> BCond1 = material->CreateBC(mat, bc[0],bcType[0], val1, val2);
	cmesh->InsertMaterialObject(BCond1);
	
	if(!bcType[1])  // dirichlet
		val2.PutVal(0,0,0.0);
	TPZAutoPointer<TPZMaterial> BCond2 = material->CreateBC(mat, bc[1],bcType[1], val1, val2);
	cmesh->InsertMaterialObject(BCond2);
	
	//Adjusting data
	cmesh->AutoBuild();
	cmesh->AdjustBoundaryElements(); 
	cmesh->CleanUpUnconnectedNodes();
	
	return cmesh;
}
开发者ID:labmec,项目名称:neopz,代码行数:34,代码来源:PZ_Process.cpp


示例7: UndoCondenseLocalEquations

/**
 * @brief Undo the encapsulate elements
 */
void TPZCreateApproximationSpace::UndoCondenseLocalEquations(TPZCompMesh &cmesh)
{
    int nel = cmesh.NElements();
    int iel;
    for (iel=0; iel<nel; iel++) {
        TPZCompEl *cel = cmesh.ElementVec()[iel];
        TPZCondensedCompEl *condel = dynamic_cast<TPZCondensedCompEl *>(cel);
        if(!condel) {
            continue;
        }
        condel->Unwrap();
    }    
}
开发者ID:JoaoFelipe,项目名称:oceano,代码行数:16,代码来源:pzcreateapproxspace.cpp


示例8: CondenseLocalEquations

/**
 * @brief Encapsulate the elements in condensed computational elements
 */
void TPZCreateApproximationSpace::CondenseLocalEquations(TPZCompMesh &cmesh)
{
    int nel = cmesh.NElements();
    int iel;
    for (iel=0; iel<nel; iel++) {
        TPZCompEl *cel = cmesh.ElementVec()[iel];
        if(!cel) {
            continue;
        }
        new TPZCondensedCompEl(cel);
    }

}
开发者ID:JoaoFelipe,项目名称:oceano,代码行数:16,代码来源:pzcreateapproxspace.cpp


示例9: TPZMatPoisson3d

TPZCompMesh *MeshH1(TPZGeoMesh *gmesh, int pOrder, int dim,bool hasbc)
{
    /// criar materiais
    dim = 2;
    TPZMatPoisson3d *material = new TPZMatPoisson3d( MatId,  dim);
    material->NStateVariables();
	
    TPZCompMesh * cmesh = new TPZCompMesh(gmesh);
    cmesh->SetDimModel(dim);
    TPZMaterial * mat(material);
    cmesh->InsertMaterialObject(mat);
	
    ///Inserir condicao de contorno
    if(hasbc){
    TPZFMatrix<STATE> val1(2,2,0.), val2(2,1,0.);
	
        TPZMaterial * BCond0 = material->CreateBC(mat, bc0,dirichlet, val1, val2);
        TPZMaterial * BCond1 = material->CreateBC(mat, bc1,dirichlet, val1, val2);
        TPZMaterial * BCond2 = material->CreateBC(mat, bc2,dirichlet, val1, val2);
        TPZMaterial * BCond3 = material->CreateBC(mat, bc3,dirichlet, val1, val2);
	
        cmesh->InsertMaterialObject(BCond0);
        cmesh->InsertMaterialObject(BCond1);
        cmesh->InsertMaterialObject(BCond2);
        cmesh->InsertMaterialObject(BCond3);
    }
    
    //solucao exata
//    TPZAutoPointer<TPZFunction<STATE> > solexata;
//    solexata = new TPZDummyFunction<STATE>(EstadoAd);
//    material->SetForcingFunctionExact(solexata);
//
//    //funcao do lado direito da equacao do problema
//    TPZAutoPointer<TPZFunction<STATE> > force;
//    TPZDummyFunction<STATE> *dum;
//    
//    dum = new TPZDummyFunction<STATE>(ForcingOpt);
//    dum->SetPolynomialOrder(20);
//    force = dum;
//    material->SetForcingFunction(force);
	
    
    cmesh->SetDefaultOrder(pOrder);
    cmesh->SetDimModel(dim);
	
	
    cmesh->SetAllCreateFunctionsContinuous();
    
    //Ajuste da estrutura de dados computacional
    cmesh->AutoBuild();
    
    
    return cmesh;
    
}
开发者ID:labmec,项目名称:neopz,代码行数:55,代码来源:MainOptimalControl.cpp


示例10:

TPZCompElHDivFull<TSHAPE>::TPZCompElHDivFull(TPZCompMesh &mesh, TPZGeoEl *gel, int64_t &index) :
TPZRegisterClassId(&TPZCompElHDivFull::ClassId),
TPZCompElHDiv<TSHAPE>(mesh,gel,index) {
	
	int i;
	int nconflux= TPZCompElHDiv<TSHAPE>::NConnects();
    this->fConnectIndexes.Resize(nconflux);
	gel->SetReference(this);
	
	for(i=0;i< nconflux;i++)
	{
        int sideaux= i + TSHAPE::NCornerNodes;
		this->fConnectIndexes[i] = this->CreateMidSideConnect(sideaux);
#ifdef LOG4CXX
        if (logger->isDebugEnabled())
        {
            std::stringstream sout;
            sout << "After creating last flux connect " << i << std::endl;
            //	this->Print(sout);
            LOGPZ_DEBUG(logger,sout.str())
        }
#endif
        
		mesh.ConnectVec()[this->fConnectIndexes[i]].IncrementElConnected();
		this->IdentifySideOrder(sideaux);
    }	
开发者ID:labmec,项目名称:neopz,代码行数:26,代码来源:pzhdivfull.cpp


示例11: Read

void TPZBndCond::Read(TPZStream &buf, void *context)
{
    TPZMaterial::Read(buf, context);
    buf.Read(&fType, 1);
    fBCVal1.Read(buf, 0);
    fBCVal2.Read(buf, 0);
    int MatId;
    buf.Read(&MatId,1);
    TPZCompMesh * pCM = (TPZCompMesh * )/*dynamic_cast<TPZCompMesh *>*/(context);
    fMaterial = pCM->FindMaterial(MatId);
    if(!fMaterial)
    {
        std::cout << " reading a boundary condition without material object!!\n";
#ifdef LOG4CXX
        LOGPZ_FATAL(logger,"reading a boundary condition without material object!!");
#endif
    }
}
开发者ID:JoaoFelipe,项目名称:oceano,代码行数:18,代码来源:pzbndcond.cpp


示例12: TPZCompMesh

TPZCompMesh *CMesh(TPZGeoMesh *gmesh, int pOrder)
{
	const int dim = 2; //dimensao do problema
	const int matId = 1, bc0 = -1, bc1 = -2, bc2=-3, bc3=-4; //MESMOS ids da malha geometrica
    const int dirichlet = 0, neumann = 1;
//    const int mixed = 2; //tipo da condicao de contorno do problema ->default dirichlet na esquerda e na direita
	
    
	///criar malha computacional
	TPZCompMesh * cmesh = new TPZCompMesh(gmesh);
	cmesh->SetDefaultOrder(pOrder);//seta ordem polimonial de aproximacao
	cmesh->SetDimModel(dim);//seta dimensao do modelo
	
    // Criando material
    TPZMatExSimples2D *material = new TPZMatExSimples2D(matId);//criando material que implementa a formulacao fraca do problema modelo
    
	// Inserindo material na malha
	cmesh->InsertMaterialObject(material);
		
	///Inserir condicao de contorno esquerda
	TPZFMatrix<STATE> val1(1,1,0.), val2(1,1,0.);
	TPZMaterial * BCond0 = material->CreateBC(material, bc0, neumann, val1, val2);//cria material que implementa a condicao de contorno da esquerda
	
    cmesh->InsertMaterialObject(BCond0);//insere material na malha
    
	// Condicao de contorno da direita
	TPZMaterial * BCond1 = material->CreateBC(material, bc1, neumann, val1, val2);//cria material que implementa a condicao de contorno da direita
    
    cmesh->InsertMaterialObject(BCond1);//insere material na malha
    
    val2(0,0) = 1.0;//potencial na placa inferior
    // Condicao de contorno da placa inferior
    TPZMaterial * BCond2 = material->CreateBC(material, bc2, dirichlet, val1, val2);//cria material que implementa a condicao de contorno da placa inferior
    
    cmesh->InsertMaterialObject(BCond2);//insere material na malha
    
    val2(0,0) = 1.5;//potencial na placa superior
    // Condicao de contorno da placa superior
    TPZMaterial * BCond3 = material->CreateBC(material, bc3, dirichlet, val1, val2);//cria material que implementa a condicao de contorno da placa superior
	
    cmesh->InsertMaterialObject(BCond3);//insere material na malha
	
	//Cria elementos computacionais que gerenciarao o espaco de aproximacao da malha
	cmesh->AutoBuild();
	
	return cmesh;
	
}
开发者ID:labmec,项目名称:neopz,代码行数:48,代码来源:ExemploSimples2D.cpp


示例13: TPZCompMesh

TPZCompMesh  *TPZMGAnalysis::UniformlyRefineMesh(TPZCompMesh *mesh, bool withP) {
	
	TPZGeoMesh *gmesh = mesh->Reference();
	if(!gmesh) {
		cout << "TPZMGAnalysis::UniformlyRefineMesh encountered no geometric mesh\n";
		return 0;
	}
	gmesh->ResetReference();
	TPZCompMesh *cmesh = new TPZCompMesh(gmesh);
	mesh->CopyMaterials(*cmesh);
	TPZAdmChunkVector<TPZCompEl *> &elementvec = mesh->ElementVec();
	int el,nelem = elementvec.NElements();
	for(el=0; el<nelem; el++) {
		TPZCompEl *cel = elementvec[el];
		if(!cel) continue;
		TPZInterpolatedElement *cint = dynamic_cast<TPZInterpolatedElement *> (cel);
		if(!cint) {
			cout << "TPZMGAnalysis::UniformlyRefineMesh encountered a non interpolated element\n";
			continue;
		}
		int ncon = cint->NConnects();
		int porder = cint->PreferredSideOrder(ncon-1);
		
		TPZGeoEl *gel = cint->Reference();
		if(!gel) {
			cout << "TPZMGAnalysis::UniformlyRefineMesh encountered an element without geometric reference\n";
			continue;
		}
		TPZVec<TPZGeoEl *> sub;
		gel->Divide(sub);
		int nsub = sub.NElements();
		int isub;
		int celindex;
		for(isub=0; isub<nsub; isub++) {
			TPZInterpolatedElement *csint;
			csint = (TPZInterpolatedElement *) cmesh->CreateCompEl(sub[isub],celindex);
			if(withP) csint->PRefine(porder+1);
			else csint->PRefine(porder);
		}
	}
	return cmesh;
}
开发者ID:JoaoFelipe,项目名称:oceano,代码行数:42,代码来源:pzmganalysis.cpp


示例14: MakeRaviartTomas

/**
 * @brief transform in low order Raviar Tomas
 */
void TPZCreateApproximationSpace::MakeRaviartTomas(TPZCompMesh &cmesh)
{
    int numcell = cmesh.NElements();
    int el;
    for (el = 0; el<numcell ; el++) {
        TPZCompEl *cel = cmesh.ElementVec()[el];
        TPZInterpolationSpace *intel = dynamic_cast<TPZInterpolationSpace *>(cel);
        if (!intel) {
            continue;
        }
        intel->SetPreferredOrder(1);
    }
    cmesh.ExpandSolution();
    for (el = 0; el<numcell ; el++) {
        TPZCompEl *cel = cmesh.ElementVec()[el];
        TPZInterpolatedElement *intel = dynamic_cast<TPZInterpolatedElement *>(cel);
        if (!intel) {
            continue;
        }
        TPZGeoEl *gel = intel->Reference();
        int geldim = gel->Dimension();
        int is;
        int nsides = gel->NSides();
        for (is=0; is<nsides; is++) {
            if (gel->SideDimension(is) != geldim-1) {
                continue;
            }
            int nsconnects = intel->NSideConnects(is);
            // only interested in HDiv elements
            if (nsconnects != 1) {
                continue;
            }
            int cindex = intel->SideConnectIndex(0, is);
            TPZConnect &c = intel->Connect(intel->SideConnectLocId(0,is));
            if (c.HasDependency()) {
                continue;
            }
            int nshape = 1;
            int nstate = 1;
            int order = 0;
            int cindex2 = cmesh.AllocateNewConnect(nshape, nstate, order);
//            TPZConnect &c2 = cmesh.ConnectVec()[cindex];
            TPZFNMatrix<2> depmat(2,1,1.);
            c.AddDependency(cindex, cindex2, depmat, 0, 0, 2, 1);
        }
    }
    cmesh.ExpandSolution();
}
开发者ID:JoaoFelipe,项目名称:oceano,代码行数:51,代码来源:pzcreateapproxspace.cpp


示例15: TPZL2Projection

TPZCompMesh *L2ProjectionP(TPZGeoMesh *gmesh, int pOrder, TPZVec<STATE> &solini)
{
    /// criar materiais
    int dim = 2;
    TPZL2Projection *material;
    material = new TPZL2Projection(1, dim, 1, solini, pOrder);
    
    TPZCompMesh * cmesh = new TPZCompMesh(gmesh);
    cmesh->SetDimModel(dim);
    TPZMaterial * mat(material);
    cmesh->InsertMaterialObject(mat);
    TPZAutoPointer<TPZFunction<STATE> > forcef = new TPZDummyFunction<STATE>(InitialPressure);
    material->SetForcingFunction(forcef);
    cmesh->SetAllCreateFunctionsContinuous();
    cmesh->SetDefaultOrder(pOrder);
    cmesh->SetDimModel(dim);
    cmesh->AutoBuild();
    
    
    return cmesh;
    
}
开发者ID:labmec,项目名称:neopz,代码行数:22,代码来源:LinearWave.cpp


示例16: 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);
}
开发者ID:labmec,项目名称:neopz,代码行数:40,代码来源:main.cpp


示例17: ComputationalElasticityMesh3D

TPZCompMesh * ComputationalElasticityMesh3D(TPZGeoMesh *gmesh,int pOrder)
{
    // Getting mesh dimension
    const int dim = 3;
    TPZCompMesh * cmesh = new TPZCompMesh(gmesh);
    cmesh->SetDefaultOrder(pOrder);
    cmesh->SetDimModel(dim);
    
    {//material da chapa
        const REAL Ey = 205000.;
        const REAL poisson = 0.3;
        const int matid = matchapa;
        TPZManVector<STATE,3> fx(3,0.);
        TPZElasticity3D * mat = new TPZElasticity3D(matid,Ey,poisson,fx);
        mat->SetVonMises(300.);
        cmesh->InsertMaterialObject(mat);
    }
    
    {//material da trilho1
        const REAL Ey = 205000.;
        const REAL poisson = 0.3;
        const int matid = mattrilho1;
        TPZManVector<STATE,3> fx(3,0.);
        TPZElasticity3D * mat = new TPZElasticity3D(matid,Ey,poisson,fx);
        mat->SetVonMises(690.);
        cmesh->InsertMaterialObject(mat);
        //int bcsidex = 9;
        TPZFNMatrix<9,STATE> val1(3,3,0.), val2(3,1,0.);
        val2(0,0) = 1.;
        cmesh->InsertMaterialObject(mat->CreateBC(mat, bctrilho1, 3, val1, val2));
    }
    
    if(1)
    {//material da trilho2
        const REAL Ey = 205000.;
        const REAL poisson = 0.3;
        const int matid = mattrilho2;
        TPZManVector<STATE,3> fx(3,0.);
        TPZElasticity3D * mat = new TPZElasticity3D(matid,Ey,poisson,fx);
        mat->SetVonMises(690.);
        cmesh->InsertMaterialObject(mat);
        
        //int bcsidex = 9;
        TPZFNMatrix<9,STATE> val1(3,3,0.), val2(3,1,0.);
        val2(0,0) = 1.;
        cmesh->InsertMaterialObject(mat->CreateBC(mat, bctrilho2, 3, val1, val2));
    }
    
    REAL percTracao = 0.1;
    {//material do concreto de 40 MPa
        const REAL Ey = 35417.;
        const REAL poisson = 0.2;
        const int matid = matgraut;
        TPZManVector<STATE,3> fx(3,0.);
        TPZElasticity3D * mat = new TPZElasticity3D(matid,Ey,poisson,fx);
        mat->SetMohrCoulomb(40.,percTracao*40.);
        cmesh->InsertMaterialObject(mat);
    }
    
    {//material do concreto de 30 MPa
        const REAL Ey = 27000;
        const REAL poisson = 0.2;
        const int matid = matenchimento;
        TPZManVector<STATE,3> fx(3,0.);
        TPZElasticity3D * mat = new TPZElasticity3D(matid,Ey,poisson,fx);
        mat->SetMohrCoulomb(30.,percTracao*30.);
        cmesh->InsertMaterialObject(mat);
        
        //c.c.
        //int bcbottom = 8;
        TPZFNMatrix<9,STATE> val1(3,3,0.), val2(3,1,0.);
//        val1(0,0) = 1.e-3;
//        val1(1,1) = 1.e-3;
//        val1(2,2) = 1.e12;
        val2(2) = 1.;
        cmesh->InsertMaterialObject(mat->CreateBC(mat, bcbottom, 3, val1, val2));
        val1.Zero();
        val2.Zero();
        
        //int bcsidex = 9;
        val2.Zero();
        val2(0,0) = 1.;
        cmesh->InsertMaterialObject(mat->CreateBC(mat, bcsidex, 3, val1, val2));
        
        //int bcsidey = 10;
        val1.Zero();
        val2.Zero();
        val2(1,0) = 1.;
        cmesh->InsertMaterialObject(mat->CreateBC(mat, bcsidey, 3, val1, val2));
        
        //int bcloadtop = 11;
        val2.Zero();
        val2(2,0) = -800000./120.;
        cmesh->InsertMaterialObject(mat->CreateBC(mat, bcloadtop, 1, val1, val2));
        
//        somente para teste de tensao uniforme
//        cmesh->InsertMaterialObject(mat->CreateBC(mat, bcloadtopTESTE, 1, val1, val2));//toto
        
        
    }
//.........这里部分代码省略.........
开发者ID:labmec,项目名称:neopz,代码行数:101,代码来源:Main.cpp


示例18: gelside

TPZCompMesh *ComputationalElasticityMesh2D(TPZAutoPointer<TPZGeoMesh>  gmesh,int pOrder)
{
    
    // remove some connectivities 3, 5
    TPZGeoEl *gel = gmesh->Element(0);
    TPZGeoElSide gelside(gel,3);
    gelside.RemoveConnectivity();
    gelside.SetSide(5);
    gelside.RemoveConnectivity();
    gelside.SetSide(4);
    TPZGeoElSide neighbour = gelside.NNeighbours();
    int matid = neighbour.Element()->MaterialId();
    gel->SetMaterialId(matid);
    neighbour.Element()->RemoveConnectivities();
    int64_t index = neighbour.Element()->Index();
    delete neighbour.Element();
    gmesh->ElementVec()[index] = 0;
    
    
    // Plane strain assumption
    int planestress = 0;
    
    // Getting mesh dimension
    int dim = 2;
    
    TPZMatElasticity2D *materialConcrete;
    materialConcrete = new TPZMatElasticity2D(EMatConcrete);
    
    TPZMatElasticity2D *materialSteel;
    materialSteel = new TPZMatElasticity2D(EMatSteel);
    
    
    // Setting up paremeters
    materialConcrete->SetfPlaneProblem(planestress);
    materialConcrete->SetElasticity(25.e6, 0.25);
    materialSteel->SetElasticity(205.e6, 0.25);
    
    //material->SetBiotAlpha(Alpha);cade o metodo?
    
    
    TPZCompMesh * cmesh = new TPZCompMesh(gmesh);
    cmesh->SetDefaultOrder(pOrder);
    cmesh->SetDimModel(dim);
    
    TPZFMatrix<STATE> val1(2,2,0.), val2(2,1,0.);
    
    val2(0,0) = 0.0;
    val2(1,0) = 0.0;
    val1(1,1) = 1.e12;
    TPZMaterial * BCond2 = materialConcrete->CreateBC(materialConcrete,EBottom,3, val1, val2);
    
    val2(0,0) = 0.0;
    val2(1,0) = 0.0;
    val1.Zero();
    val1(0,0) = 1.e12;
    TPZMaterial * BCond3 = materialConcrete->CreateBC(materialConcrete,ELateral,3, val1, val2);
    
    val2(0,0) = 0.0;
    val2(1,0) = -1000.0;
    val1.Zero();
    TPZMaterial * BCond4 = materialSteel->CreateBC(materialSteel,EBeam,1, val1, val2);
    
    cmesh->SetAllCreateFunctionsContinuous();
    cmesh->InsertMaterialObject(materialConcrete);
    cmesh->InsertMaterialObject(materialSteel);
    cmesh->InsertMaterialObject(BCond2);
    cmesh->InsertMaterialObject(BCond3);
    cmesh->InsertMaterialObject(BCond4);
    cmesh->AutoBuild();
    return cmesh;
    
}
开发者ID:labmec,项目名称:neopz,代码行数:72,代码来源:Main.cpp


示例19: main

int main(int argc, char *argv[])
{
    
    std::string dirname = PZSOURCEDIR;
#ifdef LOG4CXX
    InitializePZLOG();
#endif
    
    gRefDBase.InitializeRefPatterns();
    
    TPZReadGIDGrid readGid;
    
    TPZGeoMesh *gmesh =  readGid.GeometricGIDMesh("../rail.dump");
    
    {
        std::ofstream out("../GmeshOrig.vtk");
        TPZVTKGeoMesh::PrintGMeshVTK(gmesh, out);
    }
    InsertBoundaryElements(gmesh);
    // CASO NAO TEM TRILHO 2
    SwitchBCTrilho2(gmesh);
    
    AddZZeroFaces(gmesh);

    RefineGMesh(gmesh);
    
    {
        std::ofstream out("../GmeshRef.vtk");
        TPZVTKGeoMesh::PrintGMeshVTK(gmesh, out);
    }
    
    const int porder = 2;
    TPZCompMesh * cmesh = ComputationalElasticityMesh3D(gmesh,porder);
    
    AdaptPOrders(cmesh, -400., 2);

    // toto
//    {
//        std::set<int> mats;
//        mats.insert(bcbottom);
//        TPZManVector<STATE> force(1,0.);
//        force = cmesh->Integrate("StressZ", mats);
//        std::cout << "force = " << force << std::endl;
//    }
    
    {
        std::ofstream out("../CmeshRef.vtk");
        TPZVTKGeoMesh::PrintCMeshVTK(cmesh, out);
    }
    {
        TPZFMatrix<STATE> visualf;
        cmesh->ComputeFillIn(150, visualf);
        VisualMatrix(visualf,"../VisualMatrixBefore.vtk");
    }

    
    TPZAnalysis an;
    TPZAutoPointer<TPZRenumbering> renumber;
//    renumber = new TPZSloan;
//    renumber = new TPZCutHillMcKee;
    renumber = new TPZMetis;
    an.SetRenumber(renumber);
    an.SetCompMesh(cmesh, true);
    
#ifdef PZDEBUG
    {
        std::ofstream out("../gmesh.txt");
        gmesh->Print(out);
    }
    
    {
        std::ofstream out("../cmesh.txt");
        cmesh->Print(out);
    }
    
#endif
    {
        TPZFMatrix<STATE> visualf;
        cmesh->ComputeFillIn(150, visualf);
        VisualMatrix(visualf,"../MatrixMetis.vtk");
    }

    std::cout << "NEquations " << an.Solution().Rows() << std::endl;
    
    SolveSist(&an,cmesh);
    
    std::set<int> mats;
    mats.insert(bcbottom);
    TPZManVector<STATE> Force(1,0.);
    Force = cmesh->Integrate("StressZ", mats);
    std::cout << "Integrated sigma_Z " << Force << std::endl;
    
    std::cout << "Post processing" << std::endl;
    
    PostProcessElasticity(an, "../postProc.vtk");
    
    std::cout << "Finished\n";
//    delete cmesh;
//    delete gmesh;
    return EXIT_SUCCESS;
//.........这里部分代码省略.........
开发者ID:labmec,项目名称:neopz,代码行数:101,代码来源:Main.cpp


示例20: 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);
}
开发者ID:labmec,项目名称:neopz,代码行数:68,代码来源:main.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ TPZFMatrix类代码示例发布时间:2022-05-31
下一篇:
C++ TPZCompEl类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap