/** @brief first lamé parameter $\lambda$ */ void TRMSpatialPropertiesMap::lambda(TPZManVector<STATE,3> &x, TPZManVector<STATE,10> &lambda, TPZManVector<STATE,10> &state_vars){ switch (this->MapModel()) { case 0: { this->lambda_c(x, lambda, state_vars); } break; case 1: { DebugStop(); } break; case 2: { DebugStop(); } break; default: { std::cout << "Error: Model not implemented." << std::endl; DebugStop(); } break; } }
void DumpBall() { DebugStop("Dump Ball"); while (1) { Lookdown(); if (iSight == iMe) { DebugStop("Dumping"); fBallRelease = 1; Gate(0); Hard(-70); msleep(1000L); if (fBlocked) Unbind(); Move(-200,-200); Move(50, 50); Hard(-90); fBallRelease = 0; fBall = 0; break; } Move(300, 300); if (fBlocked) { if (rgfBlock[3]) Hard(-10); else Hard(10); } } }
/** @brief Absolute Permeability m2 $\kappa$ */ void TRMSpatialPropertiesMap::Kappa(TPZManVector<STATE,3> &x, TPZFMatrix<STATE> &kappa, TPZFMatrix<STATE> &inv_kappa, TPZManVector<STATE,10> &state_vars){ switch (this->MapModel()) { case 0: { this->Kappa_c(x, kappa, inv_kappa, state_vars); } break; case 1: { DebugStop(); } break; case 2: { DebugStop(); } break; default: { std::cout << "Error: Model not implemented." << std::endl; DebugStop(); } break; } }
TPZHierarquicalGrid::TPZHierarquicalGrid(TPZGeoMesh *Geomesh) { if(Geomesh->NElements() == 0) { if(fBase) std::cout << "Number of elements" << fBase->NElements() << std::endl; DebugStop(); } if(Geomesh->NNodes() == 0) { std::cout << "Number of nodes" << fBase->NElements() << std::endl; DebugStop(); } fFileName = "untitled"; fNonAffineQ = false; fIsQuad = true; fIsPrism = false; fIsTetrahedron = false; fComputedGeomesh = NULL; ffrontMatID = -999; fbackMatID = -1000; fBase = Geomesh; fSubBases.Resize(0); }
void LoadingRamp(REAL pseudo_t, TPZCompMesh * cmesh){ if (!cmesh) { DebugStop(); } TPZMaterial *mat = cmesh->FindMaterial(ERock); if (!mat) { DebugStop(); } /// Compute the footing lenght REAL footing_lenght = 0; { TPZGeoMesh * gmesh = cmesh->Reference(); if (!gmesh) { DebugStop(); } int n_el = gmesh ->NElements(); for (int iel = 0; iel < n_el; iel++) { TPZGeoEl * gel = gmesh->Element(iel); if (!gel) { DebugStop(); } if (gel->MaterialId() != ETopBC) { continue; } REAL gel_length = gel->SideArea(gel->NSides() - 1); footing_lenght += gel_length; } } /// Apply loading REAL max_uy = 100.0; REAL min_uy = 0.0; /// Compute current displacement // REAL uy = (footing_lenght*(max_uy - min_uy)*pseudo_t)/100.0; REAL uy = (footing_lenght*(max_uy - min_uy)*pseudo_t); /// Apply current displacement TPZFMatrix<STATE> val2(2,1,0.); val2(1,0) = -uy; TPZBndCond * bc_top = NULL; bc_top = dynamic_cast<TPZBndCond *> (cmesh->FindMaterial(ETopBC)); if (!bc_top || bc_top->Material() != mat) { DebugStop(); } else { bc_top->Val2() = val2; } }
/// verify the data structure consistency void TPZFracSet::CheckPointMapConsistency() { int64_t nnodes = fNodeVec.NElements(); for (int64_t in=0; in<nnodes; in++) { uint64_t locnode = GetLoc(fNodeVec[in]); if (fPointMap.find(locnode) == fPointMap.end()) { DebugStop(); } int64_t nodeindex = fPointMap[locnode]; if (nodeindex != in) { DebugStop(); } } }
void TPZDiscontinuousGalerkin::BCInterfaceJump(TPZVec<REAL> &x, TPZSolVec &leftu, TPZBndCond &bc, TPZSolVec & jump){ PZError << __PRETTY_FUNCTION__ << " - method not implemented in derived class" << std::endl; DebugStop(); }
//Contribution of skeletal elements. void TPZLagrangeMultiplier::Contribute(TPZVec<TPZMaterialData> &datavec, REAL weight, TPZFMatrix<STATE> &ek, TPZFMatrix<STATE> &ef) { int nmesh = datavec.size(); if (nmesh!=2) DebugStop(); TPZFMatrix<REAL> &phiQ = datavec[0].phi; TPZFMatrix<REAL> &phiP = datavec[1].phi; int phrq = phiQ.Rows(); int phrp = phiP.Rows(); //------- Block of matrix B ------ int iq, jp; for(iq = 0; iq<phrq; iq++) { for(jp=0; jp<phrp; jp++) { ek(iq, phrq+jp) += fMultiplier*weight*phiQ(iq,0)*phiP(jp,0); } } //------- Block of matrix B^T ------ int ip, jq; for(ip=0; ip<phrp; ip++) { for(jq=0; jq<phrq; jq++) { ek(ip + phrq,jq) += fMultiplier*weight*phiP(ip,0)*phiQ(jq,0); } } }
void AdjustBoundary(TPZGeoMesh *gmesh) { int64_t nel = gmesh->NElements(); for (int64_t el = 0; el<nel; el++) { TPZGeoEl *gel = gmesh->Element(el); if (gel->Dimension() == 3 || gel->HasSubElement()) { continue; } TPZGeoElSide gelside(gel,gel->NSides()-1); TPZGeoElSide neighbour = gelside.Neighbour(); bool should_refine = false; int nsub = -1; int numneigh = 0; while (gelside != neighbour) { nsub = neighbour.Element()->NSideSubElements(neighbour.Side()); if (neighbour.Element()->HasSubElement() && nsub > 1) { should_refine = true; } numneigh++; neighbour = neighbour.Neighbour(); } if (should_refine == true) { TPZAutoPointer<TPZRefPattern> match = TPZRefPatternTools::PerfectMatchRefPattern(gel); if (!match) { DebugStop(); } gel->SetRefPattern(match); TPZStack<TPZGeoEl *> subels; gel->Divide(subels); } } }
static void NodeSequence(TPZFracSet &fracset, TPZVec<int64_t> &nodes, TPZVec<int64_t> &orderedNodes) { TPZManVector<REAL, 3> a(3,0.); TPZManVector<TPZManVector<REAL,3>, 4> X(4,a); for (int i=0; i<4; i++) { for (int j=0; j<3; j++) { X[i][j] = fracset.fNodeVec[nodes[i]].Coord(j); } } std::map<REAL,int64_t> indices; indices[0.] = nodes[0]; indices[1.] = nodes[1]; double denom = sqrt((X[1][0]-X[0][0])*(X[1][0]-X[0][0])+(X[1][1]-X[0][1])*(X[1][1]-X[0][1])); double x0=X[0][0],x1=X[1][0],y0=X[0][1],y1=X[1][1],a0=X[2][0],a1=X[3][0],b0=X[2][1],b1=X[3][1]; double alphaa0 = ((a0-x0)*(x1-x0)+(b0-y0)*(y1-y0))/(denom*denom); double alphaa1 = ((a1-x0)*(x1-x0)+(b1-y0)*(y1-y0))/(denom*denom); indices[alphaa0] = nodes[2]; indices[alphaa1] = nodes[3]; int count = 0; for (auto it = indices.begin(); it != indices.end(); it++) { orderedNodes[count++] = it->second; } if (count != 4) { DebugStop(); } }
TPZNonDarcyAnalysis::TPZNonDarcyAnalysis(TPZCompMesh *cmesh, std::ostream &out) : TPZNonLinearAnalysis(cmesh,out), fResLastState(0.) { if(!cmesh) DebugStop(); }
void TPZBndCond::InterfaceJump(TPZVec<REAL> &x, TPZSolVec &leftu,TPZSolVec &rightu,TPZSolVec &jump) { TPZDiscontinuousGalerkin *mat = dynamic_cast<TPZDiscontinuousGalerkin *>(this->fMaterial.operator ->()); if(!mat) return; if(fForcingFunction) { TPZManVector<REAL> result(fBCVal2.Rows()); fForcingFunction->Execute(x,result); int i; for(i=0; i<fBCVal2.Rows(); i++) { fBCVal2(i,0) = result[i]; } } if(leftu.NElements() == 0) { mat->BCInterfaceJump(x, rightu, *this, jump); return; } if(rightu.NElements() == 0) { mat->BCInterfaceJump(x, leftu, *this, jump); return; } PZError << __PRETTY_FUNCTION__ << " - Huge problem. Both leftu and rightu contain elements. Wich one is the actual element neighbour to the Dirichlet boundary ?" << std::endl; DebugStop(); }//InterfaceJump
void TPZNullMaterial::Solution(TPZMaterialData &data, int var, TPZVec<STATE> &Solout){ int numbersol = data.dsol.size(); if (numbersol != 1) { DebugStop(); } this->Solution(data.sol[0], data.dsol[0], data.axes, var, Solout); }
void FindLine() { int iCur; int iProc; int wInit; DebugStop("Find Line Start"); Lookdown(); iCur = iSight; wInit = wLD; iProc = start_process(Move(1000,1000)); while (iSight == iCur && !fBlocked && !fStalled && !fBall) { printf("FindLine: %d\n", iSight); defer(); Lookdown(); } printf("I:%d, B:%d S:%d\n", iSight, fBlocked, fStalled); kill_process(iProc); SetMotors(0,0); if (fBlocked || fStalled) Unbind(); }
/* Saves the element data to a stream */ void TPZNullMaterial::Write(TPZStream &buf, int withclassid) const { TPZMaterial::Write(buf,withclassid); if (fDim < 1 || fDim >3) { DebugStop(); } buf.Write(&fDim); }
/** * @brief Computes a contribution to the stiffness matrix and load vector at one integration point to multiphysics simulation * @param data [in] * @param dataleft [in] * @param dataright [in] * @param weight [in] * @param ek [out] is the stiffness matrix * @param ef [out] is the load vector * @since June 5, 2012 */ void TPZLagrangeMultiplier::ContributeInterface(TPZMaterialData &data, TPZVec<TPZMaterialData> &dataleft, TPZVec<TPZMaterialData> &dataright, REAL weight, TPZFMatrix<STATE> &ek, TPZFMatrix<STATE> &ef) { TPZFMatrix<REAL> *phiLPtr = 0, *phiRPtr = 0; for (int i=0; i<dataleft.size(); i++) { if (dataleft[i].phi.Rows() != 0) { phiLPtr = &dataleft[i].phi; break; } } for (int i=0; i<dataright.size(); i++) { if (dataright[i].phi.Rows() != 0) { phiRPtr = &dataright[i].phi; break; } } if(!phiLPtr || !phiRPtr) { DebugStop(); } TPZFMatrix<REAL> &phiL = *phiLPtr; TPZFMatrix<REAL> &phiR = *phiRPtr; int nrowl = phiL.Rows(); int nrowr = phiR.Rows(); static int count = 0; if((nrowl+nrowr)*fNStateVariables != ek.Rows() && count < 20) { std::cout<<"ek.Rows() "<< ek.Rows()<< " nrowl " << nrowl << " nrowr " << nrowr << " may give wrong result " << std::endl; count++; } int secondblock = ek.Rows()-phiR.Rows()*fNStateVariables; int il,jl,ir,jr; // 3) phi_I_left, phi_J_right for(il=0; il<nrowl; il++) { for(jr=0; jr<nrowr; jr++) { for (int ist=0; ist<fNStateVariables; ist++) { ek(fNStateVariables*il+ist,fNStateVariables*jr+ist+secondblock) += weight * fMultiplier * (phiL(il) * phiR(jr)); } } } // // 4) phi_I_right, phi_J_left for(ir=0; ir<nrowr; ir++) { for(jl=0; jl<nrowl; jl++) { for (int ist=0; ist<fNStateVariables; ist++) { ek(ir*fNStateVariables+ist+secondblock,jl*fNStateVariables+ist) += weight * fMultiplier * (phiR(ir) * phiL(jl)); } } } }
/* Reads the element data from a stream */ void TPZNullMaterial::Read(TPZStream &buf, void *context) { TPZMaterial::Read(buf,context); buf.Read(&fDim); #ifdef PZDEBUG if (fDim < 1 || fDim >3) { DebugStop(); } #endif }
void TPZNonDarcyFlow::ContributeBC(TPZMaterialData &data, REAL weight, TPZFMatrix<STATE> &ek, TPZFMatrix<STATE> &ef, TPZBndCond &bc) { TPZFMatrix<STATE> &phi = data.phi; const int nphi = phi.Rows(); if(bc.Val2().Rows() != 1 || bc.Val2().Cols() != 1){ PZError << "Val2 must be of size (1,1)!\n"; DebugStop(); } if (globData.fState == ELastState) return; REAL v2 = bc.Val2()(0,0); if (bc.HasForcingFunction()){ TPZManVector <REAL,1> Pbc(1,0.); bc.ForcingFunction()->Execute(data.x,Pbc); // here, data.x is useless v2 = Pbc[0]; } const REAL p = data.sol[0][0]; const REAL DdirValue = p - v2; switch(bc.Type()){ case 0: //Dirichlet for (int i = 0 ; i < nphi ; i++){ ef(i,0) += -1.*phi(i,0)*gBigNumber*DdirValue*weight; for (int j = 0 ; j < nphi ; j++){ ek(i,j) += phi(i,0)*phi(j,0)*gBigNumber*weight; } } break; case 1: // Neumann - vazao massica for (int i = 0 ; i < nphi ; i++){ ef(i,0) += -1.*phi(i,0)*weight*v2; } break; default: PZError << __PRETTY_FUNCTION__ << "bc type not implemented\n"; DebugStop(); } }
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(); }
void TPZMixedDarcyFlow::ContributeBC(TPZVec<TPZMaterialData> &datavec,REAL weight,TPZFMatrix<STATE> &ek,TPZFMatrix<STATE> &ef,TPZBndCond &bc){ int qb = 0; TPZFNMatrix<100,REAL> phi_qs = datavec[qb].phi; int nphi_q = phi_qs.Rows(); int first_q = 0; TPZManVector<STATE,3> q = datavec[qb].sol[0]; TPZManVector<STATE,1> bc_data(1,0.0); bc_data[0] = bc.Val2()(0,0); switch (bc.Type()) { case 0 : // Dirichlet BC PD { STATE p_D = bc_data[0]; for (int iq = 0; iq < nphi_q; iq++) { ef(iq + first_q) += -1.0 * weight * p_D * phi_qs(iq,0); } } break; case 1 : // Neumann BC QN { for (int iq = 0; iq < nphi_q; iq++) { REAL qn_N = bc_data[0], qn = q[0]; ef(iq + first_q) += -1.0 * weight * gBigNumber * (qn - qn_N) * phi_qs(iq,0); for (int jq = 0; jq < nphi_q; jq++) { ek(iq + first_q,jq + first_q) += -1.0 * weight * gBigNumber * phi_qs(jq,0) * phi_qs(iq,0); } } } break; default: std::cout << "This BC doesn't exist." << std::endl; { DebugStop(); } break; } return; }
REAL TPZAUSMFlux::Pressure(TPZVec<REAL> &sol){ if(fabs(sol[0]) < 1.e-6){ PZError << "TPZEulerEquation::Pressure - Negative or too small density" << sol[0] << std::endl; DebugStop(); } REAL press = 0.0; //sol = (rho , rho u , rho v , rho w , rho e) const REAL rho_velocity2 = ( sol[1]*sol[1] + sol[2]*sol[2] + sol[3]*sol[3] )/sol[0]; press = ((this->fGamma-1.)*( sol[4] - 0.5 * rho_velocity2 )); if(press < 0){ REAL temp = (this->fGamma-1.)*sol[4]; PZError << "TPZEulerEquation::Pressure Negative pressure: " << press << " (gama-1)*E = " << temp << std::endl; DebugStop(); } return press; }//method
void TPZIntelGen<TSHAPE>::SetSideOrder(int side, int order) { if(side<0 || side >= TSHAPE::NSides || (side >= TSHAPE::NCornerNodes && order <1)) { PZError << "TPZIntelGen::SetSideOrder. Bad paramenter side " << side << " order " << order << std::endl; DebugStop(); #ifdef LOG4CXX std::stringstream sout; sout << __PRETTY_FUNCTION__ << " Bad side or order " << side << " order " << order; LOGPZ_DEBUG(logger,sout.str()) #endif return; }
void TPZPoint::ParametricDomainNodeCoord(int node, TPZVec<REAL> &nodeCoord) { if(node > NCornerNodes) { DebugStop(); } nodeCoord.Resize(Dimension, 0.); switch (node) { case (0): { return; break; } default: { DebugStop(); break; } } }
static void Test() { BaseArrayBasics(); if (BaseArrayBasicsWithErrorChecks() == false) DebugStop(); if (ProperErrorHandling() == false) DebugStop(); ArrayIterators(); maxon::BaseArray<Int> sampleBaseArray; maxon::BlockArray<Int> sampleBlockArray; maxon::PointerArray<Int> samplePointerArray; ArrayIterators(sampleBaseArray, 21, 42); ArrayIterators(sampleBlockArray, 21, 42); ArrayIterators(samplePointerArray, 21, 42); if (CopyFromExample() == false) DebugStop(); }
void OutputDataStruct::InsertTposP(int time, std::map<REAL,REAL> & posPmap) { std::map<int,posP>::iterator it = fTposP.find(time); if(it == fTposP.end()) { posP newposP; newposP.fposP = posPmap; fTposP[time] = newposP; } else{ DebugStop(); } }
void TPZContBufferedStream::ConstReadFromBuffer(char *dest, const size_t &nBytes) const { if (nBytes > fSize) { std::string msg("TPZContBufferedStream: Cannot read "); msg.append(std::to_string(nBytes)); msg.append(" bytes; there are only "); msg.append(std::to_string(fSize)); msg.append(" available."); PZError << msg << std::endl; DebugStop(); } char *endBuffer = fBuffer + fNAllocatedBytes; memcpy(dest, fFirst, nBytes); }
void TPZContBufferedStream::ReadFromBuffer(char *dest, const size_t &nBytes) { if (nBytes > fSize) { std::string msg("TPZContBufferedStream: Cannot read "); msg.append(std::to_string(nBytes)); msg.append(" bytes; there are only "); msg.append(std::to_string(fSize)); msg.append(" available."); PZError << msg << std::endl; DebugStop(); } memcpy(dest, fFirst, nBytes); fFirst += nBytes; fSize -= nBytes; }
int InputDataStruct::ElastId(int bcId) { std::map< int,std::pair<int,int> >::iterator it = fPressureMatIds_StripeId_ElastId.find(bcId); if(it != fPressureMatIds_StripeId_ElastId.end()) { return it->second.second; } else { DebugStop(); } return -7456; }
void TPZBndCond::ContributeInterface(TPZMaterialData &data, TPZMaterialData &dataleft, TPZMaterialData &dataright, REAL weight, TPZFMatrix<REAL> &ef) { TPZDiscontinuousGalerkin *mat = dynamic_cast<TPZDiscontinuousGalerkin *>(fMaterial.operator ->()); if(!mat) DebugStop();//return; this->UpdataBCValues(data); if(dataleft.phi.Rows() == 0) { //it meanst right data has been filled //left data should be filled instead of right data for(int i=0; i<3; i++) data.normal[i] *= -1.; mat->ContributeBCInterface(data,dataright,weight,ef,*this); // data.InvertLeftRightData(); } else { mat->ContributeBCInterface(data,dataleft,weight,ef,*this); } }
REAL TPZAUSMFlux::SoundSpeed(TPZVec<REAL> &sol,REAL press){ const REAL rho = sol[0]; if(rho < 1e-10){ PZError << "TPZEulerEquation(::cSpeed Too small or negative density\n"; DebugStop(); } // const REAL temp = this->fGamma * press; // if(temp < 1e-10){ // too low or negative // PZError << "TPZEulerEquation::cSpeed Too low or negative numerator\n"; // } const REAL c = sqrt(this->fGamma * press/ sol[0]); return c; }//method