当前位置: 首页>>代码示例>>C++>>正文


C++ TPZAutoPointer类代码示例

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


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

示例1: InsertViscoElasticity

void InsertViscoElasticity(TPZAutoPointer<TPZCompMesh> mesh)
{
	mesh->SetDimModel(3);
	int nummat = 1;
	STATE Ela = 1.e6;
	STATE poisson = 0.2;
	TPZManVector<STATE> force(3,0.);
	force[2] = -20.;
	STATE ElaE = 1000000., poissonE = 0.2, ElaV = 950000., poissonV = 0.14; 
	
	STATE lambdaV = 0, muV = 0, alpha = 0, deltaT = 0;
	lambdaV = 11.3636;
	muV = 45.4545;
	alpha = 1.;	
	deltaT = 0.1;
	
	TPZViscoelastic *viscoelast = new TPZViscoelastic(nummat);
	viscoelast->SetMaterialDataHooke(ElaE, poissonE, ElaV, poissonV, alpha, deltaT, force);
	
	TPZMaterial * viscoelastauto(viscoelast);
	TPZFMatrix<STATE> val1(3,3,0.),val2(3,1,0.);
	TPZBndCond *bc = viscoelast->CreateBC(viscoelastauto, -1, 0, val1, val2);
	TPZFNMatrix<6> qsi(6,1,0.);
	viscoelast->SetDefaultMem(qsi); //elast
	int index = viscoelast->PushMemItem(); //elast
	TPZMaterial * bcauto(bc);
	mesh->InsertMaterialObject(viscoelastauto);
	mesh->InsertMaterialObject(bcauto);	
}
开发者ID:labmec,项目名称:neopz,代码行数:29,代码来源:substruct.cpp

示例2: RefinamentoUniforme

void RefinamentoUniforme(TPZAutoPointer<TPZGeoMesh> gmesh, int nref,TPZVec<int> dims)
{
    
    int ir, iel, k;
    int nel=0, dim=0;
    int ndims = dims.size();
	for(ir = 0; ir < nref; ir++ )
    {
		TPZVec<TPZGeoEl *> filhos;
        nel = gmesh->NElements();
        
		for (iel = 0; iel < nel; iel++ )
        {
			TPZGeoEl * gel = gmesh->ElementVec()[iel];
            if(!gel) DebugStop();
            
            dim = gel->Dimension();
            
            for(k = 0; k<ndims; k++)
            {
                if(dim == dims[k])
                {
                    gel->Divide (filhos);
                    break;
                }
            }
		}
	}
    
}
开发者ID:labmec,项目名称:neopz,代码行数:30,代码来源:main.cpp

示例3: Material

void TPZDXGraphMesh::DrawSolution(char * var)
{
	
    //int nmat = fCompMesh->MaterialVec().NElements();
    TPZAutoPointer<TPZMaterial> matp = Material();
    int i,varind;
    varind = matp->VariableIndex(var);
    TPZVec<int> vec(1);
    (fOutFile) << "object " << fNextDataField << " class array type float rank 1 shape " <<
	matp->NSolutionVariables(varind) << " items " << NPoints() << " data follows " << endl;
    vec[0] = varind;
    int nel = fCompMesh->ConnectVec().NElements();
    for(i=0;i<nel;i++) {
		TPZGraphNode n = fNodeMap[i];
		n.DrawSolution(vec,fStyle);
    }
    (fOutFile) << "attribute \"dep\" string \"positions\"" << endl;
    (fOutFile) << "#" << endl;
    (fOutFile) << "object " << (fNextDataField+1) << " class field" << endl;
    (fOutFile) << "component \"data\" value " << fNextDataField << endl;
	//    (fOutFile) << "component \"positions\" value " << fNodeCoField << endl;
	//    (fOutFile) << "component \"connections\" value " << fConnectField << endl;
    (fOutFile) << "attribute \"name\" string \"" << var << fNextDataField <<
	"\"" << endl;
    (fOutFile) << "#" << endl;
    fNextDataField += 2;
	
}
开发者ID:JoaoFelipe,项目名称:oceano,代码行数:28,代码来源:pzdxmesh.cpp

示例4: SAVEABLE_SKIP_NOTE

void TPZDohrMatrix<TVar, TSubStruct >::Read(TPZStream &buf, void *context )
{
    SAVEABLE_SKIP_NOTE(buf);
    TPZMatrix<TVar>::Read(buf, context);
    SAVEABLE_SKIP_NOTE(buf);
    fAssembly = TPZAutoPointerDynamicCast<TPZDohrAssembly<TVar>>(TPZPersistenceManager::GetAutoPointer(&buf));
    SAVEABLE_SKIP_NOTE(buf);
    buf.Read(&fNumCoarse);
    SAVEABLE_SKIP_NOTE(buf);
    buf.Read(&fNumThreads);
    int sz;
    SAVEABLE_SKIP_NOTE(buf);
    buf.Read(&sz);
    for (int i=0; i<sz; i++) {
        TPZAutoPointer<TSubStruct > sub = new TSubStruct;
        SAVEABLE_SKIP_NOTE(buf);
        sub->Read(buf,0);
        fGlobal.push_back(sub);
    }
    int classid;
    SAVEABLE_SKIP_NOTE(buf);
    buf.Read(&classid );
    if (classid != ClassId()) {
        DebugStop();
    }
}
开发者ID:labmec,项目名称:neopz,代码行数:26,代码来源:tpzdohrmatrix.cpp

示例5: BoxLinearTracerDual

void BoxLinearTracerDual()
{
    // Materials ids and boundary settings
    TPZAutoPointer<TRMRawData> RawData  = new TRMRawData;
    
    bool Is3DGeometry = true;
    
    //    On box reservoir
    //RawData->WaterReservoirBox(Is3DGeometry); // Single-phase flow
    RawData->WaterOilReservoirBox(Is3DGeometry); // Two-phase flow
    //    RawData->WaterOilGasReservoirBox(Is3DGeometry); // Three-phase flow
    
    //    On cricular reservoir
    //    RawData->WaterReservoirCircle(Is3DGeometry);  // Single-phase flow
    //    RawData->WaterOilReservoirCircular(Is3DGeometry); // Two-phase flow
    //    RawData->WaterOilGasReservoirCircular(Is3DGeometry); // Three-phase flow
    
    TRMSimulationData * SimData = new TRMSimulationData;
    SimData->SetRawData(RawData);
    
    TRMOrchestra  * SymphonyX           = new TRMOrchestra;
    SymphonyX->SetSimulationData(SimData);
//    SymphonyX->BuildGeometry(Is3DGeometry); // @omar:: This mesh must to be unique???
    
    SymphonyX->SetSegregatedQ(true);
    SymphonyX->CreateAnalysisDualonBox(true); //  Static Solution
    SymphonyX->RunStaticProblem();
    SymphonyX->CreateAnalysisDualonBox(false);  // Evolutionary Solution
    SymphonyX->RunEvolutionaryProblem();

    std::cout << "Dual complete normally." << std::endl;
    
}
开发者ID:labmec,项目名称:neopz,代码行数:33,代码来源:iRMS.cpp

示例6: Id

void TPZMaterial::Clone(std::map<int, TPZAutoPointer<TPZMaterial> >&matvec) {
	int matid = Id();
	std::map<int, TPZAutoPointer<TPZMaterial> >::iterator matit;
	matit = matvec.find(matid);
	if(matit != matvec.end()) return;
	TPZAutoPointer<TPZMaterial> newmat = NewMaterial();
	newmat->SetForcingFunction(TPZMaterial::fForcingFunction);
	matvec[matid] = newmat;
}
开发者ID:JoaoFelipe,项目名称:oceano,代码行数:9,代码来源:pzmaterial.cpp

示例7: operator

 /** @brief Computing operator for the parallel for. */
 void operator()(const blocked_range<size_t>& range) const
 {
     
     for(size_t i=range.begin(); i!=range.end(); ++i )
     {
         TPZDohrThreadMultData<TSubStruct> runner = mWorkItems[i];
         TPZFMatrix<TVar> xlocal;
         fAssembly->Extract(runner.fisub,*(fInput),xlocal);
         TPZAutoPointer<TPZDohrAssembleItem<TVar> > assembleItem = new TPZDohrAssembleItem<TVar>(runner.fisub,xlocal.Rows(),xlocal.Cols());
         runner.fSub->ContributeKULocal(fAlpha,xlocal,assembleItem->fAssembleData);
         fAssemblyStructure->AddItem(assembleItem);
     }
 }
开发者ID:labmec,项目名称:neopz,代码行数:14,代码来源:tpzdohrmatrix.cpp

示例8: RefinamentoSingular

void RefinamentoSingular(TPZAutoPointer<TPZGeoMesh> gmesh,int nref)
{
    int64_t nnodes = gmesh->NNodes();
    int64_t in;
    for (in=0; in<nnodes; in++) {
        TPZGeoNode *gno = &gmesh->NodeVec()[in];
        if (abs(gno->Coord(0))< 1.e-6 && abs(gno->Coord(1)) < 1.e-6) {
            break;
        }
    }
    if (in == nnodes) {
        DebugStop();
    }
    TPZGeoElSide gelside;
    int64_t nelem = gmesh->NElements();
    for (int64_t el = 0; el<nelem; el++) {
        TPZGeoEl *gel = gmesh->ElementVec()[el];
        int ncorner = gel->NCornerNodes();
        for (int ic=0; ic<ncorner; ic++) {
            int64_t nodeindex = gel->NodeIndex(ic);
            if (nodeindex == in) {
                gelside = TPZGeoElSide(gel, ic);
                break;
            }
        }
        if (gelside.Element()) {
            break;
        }
    }
    if (!gelside.Element()) {
        DebugStop();
    }
    for (int iref = 0; iref <nref; iref++) {
        TPZStack<TPZGeoElSide> gelstack;
        gelstack.Push(gelside);
        TPZGeoElSide neighbour = gelside.Neighbour();
        while (neighbour != gelside) {
            gelstack.Push(neighbour);
            neighbour = neighbour.Neighbour();
        }
        int64_t nstack = gelstack.size();
        for (int64_t ist=0; ist < nstack; ist++) {
            if (!gelstack[ist].Element()->HasSubElement()) {
                TPZVec<TPZGeoEl *> subel;
                gelstack[ist].Element()->Divide(subel);
            }
        }
    }
}
开发者ID:labmec,项目名称:neopz,代码行数:49,代码来源:main.cpp

示例9: InsertElasticity

void InsertElasticity(TPZAutoPointer<TPZCompMesh> mesh)
{
	mesh->SetDimModel(3);
	int nummat = 1;
	STATE E = 1.e6;
	STATE poisson = 0.3;
	TPZManVector<STATE> force(3,0.);
	force[1] = 20.;
	TPZElasticity3D *elast = new TPZElasticity3D(nummat,E,poisson,force);
	TPZMaterial * elastauto(elast);
	TPZFMatrix<STATE> val1(3,3,0.),val2(3,1,0.);
	TPZBndCond *bc = elast->CreateBC(elastauto, -1, 0, val1, val2);
	TPZMaterial * bcauto(bc);
	mesh->InsertMaterialObject(elastauto);
	mesh->InsertMaterialObject(bcauto);
}
开发者ID:labmec,项目名称:neopz,代码行数:16,代码来源:substruct.cpp

示例10: PrintLS

void TPZDarcyAnalysis::PrintLS(TPZAnalysis *an)
{
    TPZAutoPointer< TPZMatrix<REAL> > KGlobal;
    TPZFMatrix<STATE> FGlobal;
    KGlobal =   an->Solver().Matrix();
    FGlobal =   an->Rhs();
    
#ifdef PZDEBUG
    #ifdef LOG4CXX
        if(logger->isDebugEnabled())
        {
            std::stringstream sout;
            KGlobal->Print("KGlobal = ", sout,EMathematicaInput);
            FGlobal.Print("FGlobal = ", sout,EMathematicaInput);
            LOGPZ_DEBUG(logger,sout.str())
        }
开发者ID:labmec,项目名称:neopz,代码行数:16,代码来源:TPZDarcyAnalysis.cpp

示例11: IterativeProcess

void IterativeProcess(TPZAnalysis *an, std::ostream &out, int numiter)
{
    int iter = 0;
    REAL error = 1.e10, NormResLambdaLast = 1.e10;;
    const REAL tol = 1.e-5;
    
    int numeq = an->Mesh()->NEquations();
    
    TPZFMatrix<STATE> Uatk0(an->Solution());
    TPZFMatrix<STATE> Uatk(Uatk0),DeltaU(Uatk0);
    if(Uatk0.Rows() != numeq) Uatk0.Redim(numeq,1);
    
    an->Assemble();
    an->Rhs() *= -1.0; //- [R(U0)];
    
    TPZAutoPointer< TPZMatrix<STATE> > matK; // getting X(Uatn)
    
    bool converged = false;
    while(!converged && iter < numiter) {
        
#ifdef LOG4CXX
        if(logger->isDebugEnabled())
        {
            std::stringstream sout;
            matK=an->Solver().Matrix();
            matK->Print("matK = ", sout,EMathematicaInput);
            an->Rhs().Print("Rhs = ", sout, EMathematicaInput);
            LOGPZ_DEBUG(logger,sout.str())
        }
#endif
        
        // Computing Uatk = Uatn + DeltaU;
        an->Solve();
        DeltaU= an->Solution();
        Uatk = Uatk0 + DeltaU;
        
        //Computing ||DeltaU||
        REAL NormOfDeltaU = Norm(DeltaU);
        
#ifdef LOG4CXX
        if(logger->isDebugEnabled())
        {
            std::stringstream sout;
            DeltaU.Print("DeltaU = ", sout,EMathematicaInput);
            Uatk.Print("Uatk = ", sout,EMathematicaInput);
            LOGPZ_DEBUG(logger,sout.str())
        }
开发者ID:labmec,项目名称:neopz,代码行数:47,代码来源:Main.cpp

示例12: ReadRefPatternDBase

//.........................................................................................................................................
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;
	}
}
开发者ID:labmec,项目名称:neopz,代码行数:18,代码来源:TPZRefPatternDataBase.cpp

示例13: Id

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;
    }
}
开发者ID:JoaoFelipe,项目名称:oceano,代码行数:19,代码来源:pzbndcond.cpp

示例14: GetElIndexCoarseMesh

void GetElIndexCoarseMesh(TPZAutoPointer<TPZGeoMesh>  gmesh, std::set<int64_t> &coarseindex)
{
    int nel = gmesh->NElements();
    int iel;
    int hassubel=0;
    int dim = gmesh->Dimension();
    int eldim;
    for(iel = 0; iel<nel; iel++)
    {
        TPZGeoEl * gel = gmesh->ElementVec()[iel];
        if(!gel) DebugStop();
        
        hassubel = gel->HasSubElement();
        eldim = gel->Dimension();
        if(!hassubel && eldim ==dim)
        {
            coarseindex.insert(gel->Index());
        }
    }
    
}
开发者ID:labmec,项目名称:neopz,代码行数:21,代码来源:main.cpp

示例15: CreateTestMesh


//.........这里部分代码省略.........
    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;
}
开发者ID:labmec,项目名称:neopz,代码行数:101,代码来源:c08-Mixed.cpp


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