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


C++ TPZVec::Resize方法代码示例

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


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

示例1: Flux

void TPZEulerConsLawDEP::Flux(TPZVec<REAL> &x,TPZVec<REAL> &Sol,TPZFMatrix &DSol,
						   TPZFMatrix &axes,TPZVec<REAL> &flux) {
	TPZVec<REAL> Fx,Fy,Fz;
	Flux(Sol,Fx,Fy,Fz);
	int cap = Sol.NElements();
	int nstate = NStateVariables(),i;
	if(cap != nstate){
		PZError << "\nTPZEulerConsLawDEP::Flux data size error\n";
		flux.Resize(0);
		return;
	}
	if(nstate == 3){
		flux.Resize(3);
		for(i=0;i<3;i++) flux[i] = Fx[i];
		return;
	} else
		if(nstate == 4){
			flux.Resize(8);
			for(i=0;i<4;i++) flux[i] = Fx[i];
			for(i=4;i<8;i++) flux[i] = Fy[i];
			return;
		} else
			if(nstate == 5){
				flux.Resize(15);
				for(i=00;i<05;i++) flux[i] = Fx[i];
				for(i=05;i<10;i++) flux[i] = Fy[i];
				for(i=10;i<15;i++) flux[i] = Fz[i];
			}
}
开发者ID:JoaoFelipe,项目名称:oceano,代码行数:29,代码来源:TPZEulerConsLaw.cpp

示例2: RSNAMeshPoints

void RSNAMeshPoints(TPZVec< TPZVec<REAL> > & pt, TPZVec< TPZVec< int64_t> > &elms)
{
   REAL x1 = 0.,
        x2 = 4.12791,
	y1 = 0.,
	y2 = 1.;

   pt.Resize(6);
   TPZVec<REAL> coord(3);

   coord[0] = x1;
   coord[1] = y1;
   coord[2] = 0.;
   pt[0] = coord;

   coord[0] = x2/2.;
   coord[1] = y1;
   coord[2] = 0.;
   pt[1] = coord;

   coord[0] = x2;
   coord[1] = y1;
   coord[2] = 0.;
   pt[2] = coord;

   coord[0] = x1;
   coord[1] = y2;
   coord[2] = 0.;
   pt[3] = coord;

   coord[0] = x2/2;
   coord[1] = y2;
   coord[2] = 0.;
   pt[4] = coord;

   coord[0] = x2;
   coord[1] = y2;
   coord[2] = 0.;
   pt[5] = coord;

// quadrilateral data

   TPZVec< int64_t > nodes(4);

   elms.Resize(2);

   nodes[0] = 0;
   nodes[1] = 1;
   nodes[2] = 4;
   nodes[3] = 3;
   elms[0] = nodes;

   nodes[0] = 1;
   nodes[1] = 2;
   nodes[2] = 5;
   nodes[3] = 4;
   elms[1] = nodes;

}
开发者ID:labmec,项目名称:neopz,代码行数:59,代码来源:reflectedShock_nonalignedmesh.cpp

示例3: Solution

void TPZEuler::Solution(TPZVec<REAL> &Sol,TPZFMatrix<REAL> &DSol,TPZFMatrix<REAL> &axes,int var,
						TPZVec<REAL> &Solout){
	if(var == 1) {
		Solout.Resize(1);
		Solout[0] = gEul.Pressure(Sol);
	} else if(var ==2) {
		Solout.Resize(1);
		Solout[0] = Sol[0];
	} else if(var == 3) {
		Solout.Resize(2);
		Solout[0] = Sol[1];
		Solout[1] = Sol[2];
	} else TPZMaterial::Solution(Sol,DSol,axes,var,Solout);
}
开发者ID:JoaoFelipe,项目名称:oceano,代码行数:14,代码来源:TPZEuler.cpp

示例4: ReadSolution

void ReadSolution(ifstream &arq, TPZVec<REAL> &sol, TPZCompMesh *cmesh, int &nstate, TPZVec<int> &dimstate){

  int i,j,totaldim=0;
  for(i=0;i<nstate;i++) totaldim += dimstate[i];
  TPZVec<REAL> pt(3,0.);
  TPZVec<REAL> coord(3,0.);
  TPZVec<REAL> auxsol(totaldim,0.);

  int iter = 0;
  int nel = cmesh->NElements();
  int solsize = totaldim * nel;
  sol.Resize(solsize);
  sol.Fill(0.);

  for(i=0; i<nel; i++){
    TPZCompEl *el = cmesh->ElementVec()[i];
    if (!el) continue;
    el->Reference()->CenterPoint(el->Reference()->NSides()-1,pt);
    el->Reference()->X(pt,coord);
    EvaluateSolution(coord,auxsol);
    for (j=0;j<totaldim;j++){
      sol[iter] = auxsol[j];
      iter++;
    }
  }
}
开发者ID:labmec,项目名称:neopz,代码行数:26,代码来源:main.cpp

示例5: PrepareFastDiff

void TPZArtDiff::PrepareFastDiff(int dim, TPZFMatrix<REAL> &jacinv, TPZVec<STATE> &sol,
								 TPZFMatrix<STATE> &dsol, TPZFMatrix<REAL> & dphi,
								 TPZVec<TPZVec<STATE> > & TauDiv, TPZVec<TPZDiffMatrix<STATE> > * pTaudDiv)
{
	TPZVec<TPZDiffMatrix<STATE> > Ai;
	TPZVec<TPZDiffMatrix<STATE> > Tau;
	
	TPZEulerConsLaw::JacobFlux(fGamma, dim, sol, Ai);
	ComputeTau(dim, jacinv, sol, Ai, Tau);
	
	TPZVec<STATE> Div;
	
	TPZDiffMatrix<STATE> * pdDiv = NULL;
	TPZDiffMatrix<STATE> dDiv;
	if(pTaudDiv) pdDiv = & dDiv;
	
	//Computing the divergent
	Divergent(dsol, dphi, Ai, Div, pdDiv);
	TauDiv.Resize(dim);
	if(pTaudDiv)pTaudDiv->Resize(dim);
	
	// computing Tau.Div = {Tx.Div, Ty.Div, Tz.Div}
	// and Tau.dDiv = {Tx.dDiv, Ty.dDiv, Tz.dDiv}, if requested
	int k;
	for(k=0;k<dim;k++)
	{
		Tau[k].Multiply(Div, TauDiv[k]);
		if(pTaudDiv)Tau[k].Multiply(dDiv, pTaudDiv->operator[](k));
		
	}
}
开发者ID:labmec,项目名称:neopz,代码行数:31,代码来源:pzartdiff.cpp

示例6: CenterPoint

	void TPZPrism::CenterPoint(int side, TPZVec<REAL> &center) {
		center.Resize(Dimension);
		int i;
		for(i=0; i<Dimension; i++) {
			center[i] = MidSideNode[side][i];
		}
	}
开发者ID:labmec,项目名称:neopz,代码行数:7,代码来源:tpzprism.cpp

示例7: SideOrder

void TPZIntelGen<TSHAPE>::GetInterpolationOrder(TPZVec<int> &ord) {
	ord.Resize(TSHAPE::NSides-TSHAPE::NCornerNodes);
	int i;
	for(i=0; i<TSHAPE::NSides-TSHAPE::NCornerNodes; i++) {
		ord[i] = SideOrder(i+TSHAPE::NCornerNodes);
	}
}
开发者ID:JoaoFelipe,项目名称:oceano,代码行数:7,代码来源:pzelctemp.cpp

示例8: Subdivide

void TPZMetis::Subdivide(int nParts, TPZVec < int > & Domains)
{
	TPZManVector<int> Adjacency,AdjacencyIndex;
	TPZManVector<int> AdjacencyWeight;
	ConvertToElementoToElementGraph(fElementGraph,fElementGraphIndex,Adjacency,AdjacencyWeight,AdjacencyIndex);
	
#ifdef LOG4CXX
	{
		std::stringstream sout;
		TPZRenumbering::Print(Adjacency,AdjacencyIndex,"Element to element graph",sout);
		LOGPZ_DEBUG(logger,sout.str())
	}
#endif
	
#ifdef USING_METIS
	int nVertices = AdjacencyIndex.NElements() -1;

	Domains.Resize(nVertices);
	// Upon successful completion, nEdgesCutted stores the edge-cut or the total communication volume of the partitioning solution.
	int nEdgesCutted = 0;

	TPZVec<int> Options(METIS_NOPTIONS);
	METIS_SetDefaultOptions(&Options[0]);
	
    int ncon = 2;
	if(METIS_PartGraphRecursive(&nVertices, &ncon, &AdjacencyIndex[0], &Adjacency[0], NULL, NULL, NULL,   // &AdjacencyWeight[0],
					&nParts, NULL, NULL, &Options[0], &nEdgesCutted, &Domains[0]) != METIS_OK)
		DebugStop();
#else
    DebugStop();
#endif
	
}
开发者ID:JoaoFelipe,项目名称:oceano,代码行数:33,代码来源:pzmetis.cpp

示例9:

// metodo para computar erros
void TPZMatPoissonD3::Solution(TPZMaterialData &data, int var, TPZVec<STATE> &Solout){
    
    Solout.Resize( this->NSolutionVariables(var));

    
    if(var == 1){ //function (state variable Q)
        for (int ip = 0; ip<fDim; ip++)
        {
            Solout[ip] = data.sol[0][ip];
        }
        
        return;
    }
    
    if(var == 2){ //function (state variable p)
        
        TPZVec<STATE> SolP;
        SolP = data.sol[0];
        
        Solout[0] = SolP[0];
        return;
    }
    
    
}
开发者ID:labmec,项目名称:neopz,代码行数:26,代码来源:PZMatPoissonD3.cpp

示例10: Solution

void TPZMaterial::Solution(TPZVec<REAL> &Sol,TPZFMatrix<REAL> &/*DSol*/,TPZFMatrix<REAL> &/*axes*/,int var,
						   TPZVec<REAL> &Solout){
	if(var == 0) Solout = Sol;
	else if(var == 99 || var == 100 || var == 101 || var == 102) {
		//  	PZError << "TPZMaterial var = "<< var << " the element should treat this case\n";
		Solout[0] = Sol[0]; // = 0.;
	} else Solout.Resize(0);
}
开发者ID:JoaoFelipe,项目名称:oceano,代码行数:8,代码来源:pzmaterial.cpp

示例11: ParametricDomainNodeCoord

 void TPZPrism::ParametricDomainNodeCoord(int node, TPZVec<REAL> &nodeCoord)
 {
     if(node > NCornerNodes)
     {
         DebugStop();
     }
     nodeCoord.Resize(Dimension, 0.);
     switch (node) {
         case (0):
         {
             nodeCoord[0] =  0.;
             nodeCoord[1] =  0.;
             nodeCoord[2] = -1.;
             break;
         }
         case (1):
         {
             nodeCoord[0] =  1.;
             nodeCoord[1] =  0.;
             nodeCoord[2] = -1.;
             break;
         }
         case (2):
         {
             nodeCoord[0] =  0.;
             nodeCoord[1] =  1.;
             nodeCoord[2] = -1.;
             break;
         }
         case (3):
         {
             nodeCoord[0] = 0.;
             nodeCoord[1] = 0.;
             nodeCoord[2] = 1.;
             break;
         }
         case (4):
         {
             nodeCoord[0] = 1.;
             nodeCoord[1] = 0.;
             nodeCoord[2] = 1.;
             break;
         }
         case (5):
         {
             nodeCoord[0] = 0.;
             nodeCoord[1] = 1.;
             nodeCoord[2] = 1.;
             break;
         }
         default:
         {
             DebugStop();
             break;
         }
     }
 }
开发者ID:labmec,项目名称:neopz,代码行数:57,代码来源:tpzprism.cpp

示例12: InletScales

/// associate scale factors with the equations and state variables
void TPBrSteamFlux::InletScales(TPZVec<REAL> &eqscales, TPZVec<REAL> &statescales)
{
    eqscales.Resize(NumInletVars+NumFluxEq);
    statescales.Resize(NumInletVars+NumFluxEq);
    eqscales[EInletMassFlux] = 1.;
    eqscales[EInletEnergyFlux] = 1.;
    eqscales[EInletStateEqs] = 1.;
    statescales[EInletPressure] = TPBrScales::fReferencePressure;
    statescales[EInletSteamSaturation] = 1.;
    statescales[EInletTemperature] = 1.;
    TPZManVector<REAL> loceqscale,locstatescale;
    Scales(loceqscale, locstatescale);
    int ist;
    int nst = loceqscale.NElements();
    for (ist=0; ist<nst; ist++) {
        eqscales[NumInletVars+ist] = loceqscale[ist];
        statescales[NumInletVars+ist] = locstatescale[ist];
    }
}
开发者ID:labmec,项目名称:neopz,代码行数:20,代码来源:tpbrsteamflux.cpp

示例13: Scales

/// associate scale factors with the equations and state variables
void TPBrSteamFlux::Scales(TPZVec<REAL> &eqscales, TPZVec<REAL> &statescales)
{
    eqscales.Resize(NumFluxEq);
    statescales.Resize(NumFluxEq);
    eqscales[EMassFluxWaterEq] = 1.;
    eqscales[EMassFluxSteamEq] = 1.;
    eqscales[EMassFluxOilEq] = 1.;
    eqscales[EDarcyVelocityWaterEq] = 1.;
    eqscales[EDarcyVelocitySteamEq] = 1.;
    eqscales[EDarcyVelocityOilEq] = 1.;
    eqscales[EEnergyFluxEq] = 1.;
    statescales[EMassFluxWater] = 1.;
    statescales[EMassFluxSteam] = 1.;
    statescales[EMassFluxOil] = 1.;
    statescales[EDarcyVelocityWater] = 1.;
    statescales[EDarcyVelocitySteam] = 1.;
    statescales[EDarcyVelocityOil] = 1.;
    statescales[EEnergyFlux] = 1.;
}
开发者ID:labmec,项目名称:neopz,代码行数:20,代码来源:tpbrsteamflux.cpp

示例14: Solution

void TPZPrimalPoisson::Solution(TPZMaterialData &data, int var, TPZVec<STATE> &Solout){
    
    Solout.Resize( this->NSolutionVariables(var));
    TPZVec<STATE> p, q, f;
    
    if(var == 1){
        for (int i=0; i < this->Dimension(); i++)
        {
            Solout[i] = -data.dsol[0][i];
        }
        return;
    }
    
    if(var == 2){
            Solout[0] = data.sol[0][0];
        return;
    }
    
    if(var == 3){
        TPZManVector<STATE,1> f(1,0.0);
        TPZFNMatrix<4,STATE> df(4,1,0.0);
        if (this->HasForcingFunctionExact()) {
            this->fForcingFunctionExact->Execute(data.x, f, df);
        }
        
        for (int i=0; i < this->Dimension(); i++)
        {
            Solout[i] = df(i,0);
        }
        return;
    }
    
    if(var == 4){
        TPZManVector<STATE,1> f(1,0.0);
        TPZFNMatrix<4,STATE> df(4,1,0.0);
        if (this->HasForcingFunctionExact()) {
            this->fForcingFunctionExact->Execute(data.x, f, df);
        }
        Solout[0] = f[0];
        return;
    }
    
    if(var == 5){
        TPZManVector<STATE,1> f(1,0.0);
        TPZFNMatrix<4,STATE> df(4,1,0.0);
        if (this->HasForcingFunctionExact()) {
            this->fForcingFunctionExact->Execute(data.x, f, df);
        }
        Solout[0] = df(3,0);
        return;
    }
    
    DebugStop();
    
}
开发者ID:labmec,项目名称:neopz,代码行数:55,代码来源:TPZPrimalPoisson.cpp

示例15: Solution

void TPZBiharmonic::Solution(TPZVec<REAL> &Sol,TPZFMatrix<REAL> &DSol,TPZFMatrix<REAL> &/*axes*/,
							 int var,TPZVec<REAL> &Solout){
	if(var == 0 || var == 1) Solout[0] = Sol[0];//function
	if(var == 2) {
		Solout.Resize(DSol.Rows());
		int id;
		for(id=0 ; id  < DSol.Rows(); id++) {
			Solout[id] = DSol(id,0);//derivate
		}
	}
}
开发者ID:JoaoFelipe,项目名称:oceano,代码行数:11,代码来源:pzbiharmonic.cpp


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