Example #1
0
YARPLpFirstOrderFlow::YARPLpFirstOrderFlow(int necc,int nang,double rfmin,int size)
	: YARPLogPolar(necc, nang, rfmin, size)
{
    dxy=(nEcc*nAng);

	// alloc kernels
	_alloc_kernels();

	// alloc temporary images
	_alloc_temp_images();

	// flow components vector: U,V,D,R,S1,S2
	flowComp.Resize (6);

	// matrices for least square solution
	A_flow.Resize(dxy,6);
	A_flow=0;
	A_trans.Resize(6,dxy);
	A_trans=0;
	sqA.Resize(6,6);
	b_flow.Resize(dxy);
	b_flow=0;
	sqB.Resize(6);

	// lut vectors.
	rho.Resize(nEcc);
	co.Resize(nAng);
	si.Resize(nAng);
	co2.Resize(nAng);
	si2.Resize(nAng);

	// init co, si, co2, si2 data structures for LSQ sol.
	double delta = 2.0 * pi / ((double)nAng); // 1/q ??
	double tmp=0.0; //delta/2.0; LATER: check this change!

	// delta/2 would be done to sample exactly the center of the
	// corresponding RF?
	for(int aa=1; aa<=nAng; aa++)
	{
		co(aa)=cos(tmp);
		co2(aa)=cos(2.0*tmp);
		si(aa)=sin(tmp);
		si2(aa)=sin(2.0*tmp);
		tmp+=delta;
	}

	// void init_rho data structure for LSQ sol
	for(int r = 1; r <= necc; r++)
		rho(r) = ro0 * pow(a, (r-1) / kxi);

 
	for(int r = 1; r <= necc; r++)
		rho(r) = 1 / rho(r);

	// init inv_klog par.
	inv_klog = kxi / log(a);
}
Example #2
0
/// Split fractures by the MHM grid
void TPZFracSet::SplitFracturesByMHM()
{
    int64_t nfrac = fFractureVec.NElements();
    for (int64_t ifr=0; ifr<nfrac; ifr++) {
        std::pair<uint32_t,uint32_t> p1,p2;
        TPZManVector<REAL,3> co1(3),co2(3);
        int64_t no1 = fFractureVec[ifr].fNodes[0];
        int64_t no2 = fFractureVec[ifr].fNodes[1];
        fNodeVec[no1].GetCoordinates(co1);
        fNodeVec[no2].GetCoordinates(co2);
        p1 = NodeKey(fFractureVec[ifr].fNodes[0]);
        p2 = NodeKey(fFractureVec[ifr].fNodes[1]);
        int64_t domain1 = p1.first/fMHMSpacingInt[0];
        int64_t domain2 = p2.first/fMHMSpacingInt[0];
        if(p2.first > p1.first && p2.first % fMHMSpacingInt[0] == 0) domain2--;
        if (domain2<domain1) {
            DebugStop();
        }
        while (domain2 > domain1) {
            REAL frac = ((domain2)*fMHMSpacing[0]-co1[0])/(co2[0]-co1[0]);
            SplitFractures(ifr, frac, -1, -1.);
            fNodeVec[fFractureVec[ifr].fNodes[1]].GetCoordinates(co2);
            std::pair<uint32_t, uint32_t> pc = NodeKey(co2);
            if (pc.first%fMHMSpacingInt[0] != 0) {
                DebugStop();
            }
            domain2--;
        }
    }
    nfrac = fFractureVec.NElements();
    for (int64_t ifr=0; ifr<nfrac; ifr++) {
        std::pair<uint32_t,uint32_t> p1,p2;
        TPZManVector<REAL,3> co1(3),co2(3);
        fNodeVec[fFractureVec[ifr].fNodes[0]].GetCoordinates(co1);
        fNodeVec[fFractureVec[ifr].fNodes[1]].GetCoordinates(co2);
        p1 = NodeKey(fFractureVec[ifr].fNodes[0]);
        p2 = NodeKey(fFractureVec[ifr].fNodes[1]);
        int64_t domain1 = p1.second/fMHMSpacingInt[1];
        int64_t domain2 = p2.second/fMHMSpacingInt[1];
        if (domain1 < domain2)
        {
            if(p2.second % fMHMSpacingInt[1] == 0) domain2--;
            if (domain2<domain1) {
                DebugStop();
            }
            while (domain2 > domain1) {
                fNodeVec[fFractureVec[ifr].fNodes[1]].GetCoordinates(co2);
                REAL frac = ((domain2)*fMHMSpacing[1]-co1[1])/(co2[1]-co1[1]);
                SplitFractures(ifr, frac, -1, -1.);
                fNodeVec[fFractureVec[ifr].fNodes[1]].GetCoordinates(co2);
                std::pair<uint32_t, uint32_t> pc = NodeKey(co2);
                if (pc.second%fMHMSpacingInt[1] != 0) {
                    DebugStop();
                }
                domain2--;
            }
        
        }
        else if(domain1 > domain2)
        {
            if(p1.second % fMHMSpacingInt[1] == 0) domain1--;
            while (domain1 > domain2) {
                REAL frac = ((domain2+1)*fMHMSpacing[0]-co1[1])/(co2[1]-co1[1]);
                SplitFractures(ifr, frac, -1, -1.);
                fNodeVec[fFractureVec[ifr].fNodes[1]].GetCoordinates(co2);
                std::pair<uint32_t, uint32_t> pc = NodeKey(co2);
                if (pc.second%fMHMSpacingInt[1] != 0) {
                    DebugStop();
                }                
                domain2++;

            }
        }
    }
}