Пример #1
0
    bool empty(id_type __id) const {
      if (__id == npos())
	return __root.empty();
      else
	return __nodes[__id].__map.empty();
    }
Пример #2
0
 bool is_root(id_type __id) const { return __id == npos(); }
Пример #3
0
 const_iterator begin(id_type __id) const { return (__id == npos() ? __root.begin() : __nodes[__id].__map.begin()); }
Пример #4
0
 const_iterator end(id_type __id) const { return (__id == npos() ? __root.end() : __nodes[__id].__map.end()); }
void CStdExplosionGraphics::Explosion(const float3 &pos, const DamageArray& damages, float radius, CUnit *owner,float gfxMod)
{
	PUSH_CODE_MODE;
	ENTER_MIXED;
	float h2=ground->GetHeight2(pos.x,pos.z);

	float height=pos.y-h2;
	if(height<0)
		height=0;

	bool waterExplosion=h2<-3;
	bool uwExplosion=pos.y<-15;
	bool airExplosion=pos.y-max(0,h2)>20;

	float damage=damages[0]/20;
	if(damage>radius*1.5) //limit the visual effects based on the radius
		damage=radius*1.5;
	damage*=gfxMod;
	for(int a=0;a<1;++a){
//		float3 speed((gs->randFloat()-0.5f)*(radius*0.04),0.05+(gs->randFloat())*(radius*0.007),(gs->randFloat()-0.5)*(radius*0.04));
		float3 speed(0,0.3f,0);
		float3 camVect=camera->pos-pos;
		float camLength=camVect.Length();
		camVect/=camLength;
		float moveLength=radius*0.03;
		if(camLength<moveLength+2)
			moveLength=camLength-2;
		float3 npos=pos+camVect*moveLength;
		float heatcloudsize = 7+damage*2.8;
		float heatcloudtemperature = 8+sqrt(damage)*0.5;
		CHeatCloudProjectile* p=new CHeatCloudProjectile(npos,speed,heatcloudtemperature,heatcloudsize,(-heatcloudsize/heatcloudtemperature)*0.5,owner);
		//p->Update();
		//p->maxheat=p->heat;
	}
	if(ph->particleSaturation<1){		//turn off lots of graphic only particles when we have more particles than we want
		float smokeDamage=damage;
		if(uwExplosion)
			smokeDamage*=0.3;
		if(airExplosion || waterExplosion)
			smokeDamage*=0.6;
		float invSqrtsmokeDamage=1/(sqrt(smokeDamage)*0.35);
		for(int a=0;a<smokeDamage*0.6;++a){
			float3 speed(-0.1f+gu->usRandFloat()*0.2,(0.1f+gu->usRandFloat()*0.3)*invSqrtsmokeDamage,-0.1f+gu->usRandFloat()*0.2);
			float3 npos(pos+gu->usRandVector()*(smokeDamage*1.0));
			float h=ground->GetApproximateHeight(npos.x,npos.z);
			if(npos.y<h)
				npos.y=h;
			float time=(40+sqrt(smokeDamage)*15)*(0.8+gu->usRandFloat()*0.7);
			new CSmokeProjectile2(pos,npos,speed,time,sqrt(smokeDamage)*4,0.4,owner,0.6);
		}
		if(!airExplosion && !uwExplosion){
			int numDirt=min(20,damage*0.8);
			float3 color(0.15,0.1,0.05);
			if(waterExplosion)
				color=float3(1,1,1);
			for(int a=0;a<numDirt;++a){
				float3 speed((0.5-gu->usRandFloat())*1.5,1.7f+gu->usRandFloat()*1.6,(0.5-gu->usRandFloat())*1.5);
				speed*=0.7+min(30,damage)/30;
				float3 npos(pos.x-(0.5-gu->usRandFloat())*(radius*0.6),pos.y-2.0-damage*0.2,pos.z-(0.5-gu->usRandFloat())*(radius*0.6));
				if(waterExplosion)
					npos=float3(pos.x-(0.5-gu->usRandFloat())*(radius*0.3),pos.y-2.0-damage*0.2,pos.z-(0.5-gu->usRandFloat())*(radius*0.3));
				CDirtProjectile* dp=new CDirtProjectile(npos,speed,90+damage*2,2.0+sqrt(damage)*1.5,0.4,0.999f,owner,color);
			}
		}
		if(damage>=20 && !uwExplosion && !airExplosion){
			int numDebris=gu->usRandInt()%6;
			if(numDebris>0)
				numDebris+=3+damage*0.04;
			for(int a=0;a<numDebris;++a){
				float3 speed;
				if(height<4)
					speed=float3((0.5f-gu->usRandFloat())*2.0,1.8f+gu->usRandFloat()*1.8,(0.5f-gu->usRandFloat())*2.0);
				else
					speed=float3(gu->usRandVector()*2);
				speed*=0.7+min(30,damage)/23;
				float3 npos(pos.x-(0.5-gu->usRandFloat())*(radius*1),pos.y,pos.z-(0.5-gu->usRandFloat())*(radius*1));
				new CWreckProjectile(npos,speed,90+damage*2,owner);
			}
		}
		if(uwExplosion){
			int numBubbles=damage*0.7;
			for(int a=0;a<numBubbles;++a){
				new CBubbleProjectile(pos+gu->usRandVector()*radius*0.5,gu->usRandVector()*0.2+float3(0,0.2,0),damage*2+gu->usRandFloat()*damage,1+gu->usRandFloat()*2,0.02,owner,0.5+gu->usRandFloat()*0.3);
			}
		}
		if(waterExplosion && !uwExplosion && !airExplosion){
			int numWake=damage*0.5;
			for(int a=0;a<numWake;++a){
				new CWakeProjectile(pos+gu->usRandVector()*radius*0.2,gu->usRandVector()*radius*0.003,sqrt(damage)*4,damage*0.03,owner,0.3+gu->usRandFloat()*0.2,0.8/(sqrt(damage)*3+50+gu->usRandFloat()*90),1);
			}
		}
		if(radius>10 && damage>4){
			int numSpike=sqrt(damage)+8;
			for(int a=0;a<numSpike;++a){
				float3 speed=gu->usRandVector();
				speed.Normalize();
				speed*=(8+damage*3.0)/(9+sqrt(damage)*0.7)*0.35;
				if(!airExplosion && !waterExplosion && speed.y<0)
					speed.y=-speed.y;
				new CExploSpikeProjectile(pos+speed,speed*(0.9f+gu->usRandFloat()*0.4f),radius*0.1,radius*0.1,0.6f,0.8/(8+sqrt(damage)),owner);
			}
		}
	}
	if(radius>20 && damage>6 && height<radius*0.7){
		float modSize=max(radius,damage*2);
		float circleAlpha=0;
		float circleGrowth=0;
		float ttl=8+sqrt(damage)*0.8;
		if(radius>40 && damage>12){
			circleAlpha=min(0.5,damage*0.01);
			circleGrowth=(8+damage*2.5)/(9+sqrt(damage)*0.7)*0.55;
		}
		float flashSize=modSize;
		float flashAlpha=min(0.8,damage*0.01);
		new CGroundFlash(pos,circleAlpha,flashAlpha,flashSize,circleGrowth,ttl);
	}

	if(radius>40 && damage>12){
		CSpherePartProjectile::CreateSphere(pos,min(0.7,damage*0.02),5+sqrt(damage)*0.7,(8+damage*2.5)/(9+sqrt(damage)*0.7)*0.5,owner);	
	}
	POP_CODE_MODE;
}
Пример #6
0
void create_task( const bool& GUI ){

    if( GUI == true ){

        // get the window size
        int maxX = getmaxx(stdscr);
        int maxY = getmaxy(stdscr);
        
        // generate an empty task
        Task newTask;
        bool exitLoop = false;
        int cursor = 0;
        int ncursor = 0;
        int cpos[3] = {0, 0, 0};
        vector<int> npos(1,0);

        // print the new task ui
        while( !exitLoop ){
            
            // clear the console
            clear();

            // print the header
            print_header("New Task", maxX);
            
            // print the requred fields
            if( cursor == 0 )
                attron( A_STANDOUT );
            mvaddstr( 4, 1, (string("Name:   ") + newTask.name).c_str() );
            if( cursor == 0 )
                attroff( A_STANDOUT );
            
            if( cursor == 1 )
                attron( A_STANDOUT );
            mvaddstr( 5, 1, string("Groups: ").c_str());
            if( cursor == 1 )
                attroff( A_STANDOUT );
            
            if( cursor == 2 )
                attron( A_STANDOUT );
            mvaddstr( 6, 1, string("Notes: ").c_str());
            if( cursor == 2 )
                attroff( A_STANDOUT );
            for( size_t i=0; i<newTask.notes.size(); i++ ){
                mvaddstr( 7+i, 2, newTask.notes[i].c_str());
            }

            // print the footer
            print_footer( ADD_TASK, maxX, maxY );

            // get user input
            int selection = getch();
            string tempS;

            /// Quit
            if( selection == 27 ){
                exitLoop = true;
            }
            else if( selection == KEY_UP ){
            
                // make sure we are not in a note
                if( cursor == 0 || cursor == 1 ){
                    cursor--;
                    if( cursor < 0 ){
                        cursor = 0;
                    }
                }
                else if( cursor == 2 ){
                    ncursor--;
                    if( ncursor < 0 ){
                        ncursor = 0;
                        cursor--;
                    }
                }
                else throw string("WHAT!");
            }
            else if( selection == KEY_DOWN ){
            
                // make sure we are not in a note
                if( cursor == 0 || cursor == 1 ){
                    cursor++;
                    if( cursor == 2 ){    
                        ncursor = 0;
                    }

                }
                else if( cursor == 2 ){
                    ncursor++;
                    if( ncursor >= newTask.notes.size() ){
                        ncursor = newTask.notes.size()-1;
                    }
                }
                else throw string("WHAT!");
            }

            /// User presses left/right arrow
            else if( selection == KEY_LEFT ){

                if( cursor == 0 ){
                    if( cpos[0] > 0 ) cpos[0]--;
                }

            }
            else if( selection == KEY_RIGHT ){
                if( cursor == 0 ){
                    if( cpos[0] < newTask.name.size()-1 ) cpos[0]++;
                }
            }
            
            /// User enters text
            else if( (selection >= 'a' && selection <= 'z') ||
                     (selection >= 'A' && selection <= 'Z') ||
                      selection == '.' || selection == ',' || selection == ' '){
                
                tempS = (char)selection;
                if( cursor == 0 ){ newTask.name.insert(cpos[0], tempS); cpos[0]++; }
                    
            }
            /// User presses backspace
            else if( selection == KEY_BACKSPACE ){
                if( cursor == 0 ){
                    if( cpos[0] > 0 ){
                        newTask.name.erase( cpos[0], 1 );
                        cpos[0]--;
                    }

                }
            }
            /// User presses delete
            else if( selection == KEY_DC ){
                if( cursor == 0 ){
                    if( cpos[0] > 0 && cpos[0] < newTask.name.size()-1 ){
                        newTask.name.erase( cpos[0]+1, 1);
                    }

                }
            }

            /// User Presses Enter
            else if( selection == KEY_ENTER ){
                
                if(cursor == 0 || cursor == 1){
                    cursor++;
                }

            }

        }
    }
    

}
Пример #7
0
 _islice(Iterable const& iterable, __builtin__::xrange const& xr) : iterator(iterable, xr), end_iter(npos(), iterable, xr) {
 }
Пример #8
0
 id_type root() const { return npos(); }
Пример #9
0
 _ifilter<ResultType, Operator, List0>::_ifilter(Operator _op, List0 _seq) :
     iterator(_op, _seq),
     seq(_seq),
     end_iter(npos(), _op, _seq)
 {}
Пример #10
0
    basic_piece(const std::string& str, size_type pos, size_type n = npos())
      : first_(str.c_str() + pos), last_(n == npos() ? str.c_str() + str.size() : std::min(str.c_str() + pos + n, str.c_str() + str.size()))
    {
      if (first_ > str.c_str() + str.size())
	throw std::out_of_range("basic_piece::basic_piece");
    }
Пример #11
0
    basic_piece(const basic_piece<_T>& str, size_type pos, size_type n = npos())
      : first_(str.begin() + pos), last_(n == npos() ? str.end() : std::min(str.begin() + pos + n, str.end()))
    {
      if (first_ > str.end())
	throw std::out_of_range("basic_piece::basic_piece");
    }
Пример #12
0
int DG_Prob::DG_EI_Interior(const EDGE border,
														double * mx,
														double * B,
														int    * indx)
{
	// *************************************************************************
#include "DG_EI_Header.h" // Inicia variaveis locais comuns a DG_EI
	// *************************************************************************
	
	
	// **************************************************************************
	// Interior Edges
	// **************************************************************************
	
	double difpw[qmax],difpc[qmax];
	for (int q=0;q<qmax;q++) {
		difpw[q]=pw[0][q]-pw[1][q];
		difpc[q]=pc[0][q]-pc[1][q];
	}
	
	// *************************************************************************
	
	int ns[2],np[2],nnparc[4];
	int ntot;
	ns[0]=e[0].show_ptr_stdel(sat)->nn_val();
	np[0]=e[0].show_ptr_stdel(pres)->nn_val();
	ns[1]=e[1].show_ptr_stdel(sat)->nn_val();
	np[1]=e[1].show_ptr_stdel(pres)->nn_val();
	
	nnparc[0]=0;
  nnparc[1]=          e[0].show_ptr_stdel(0)->nn_val();
  nnparc[2]=nnparc[1]+e[0].show_ptr_stdel(1)->nn_val();
  nnparc[3]=nnparc[2]+e[1].show_ptr_stdel(0)->nn_val();
  ntot     =nnparc[3]+e[1].show_ptr_stdel(1)->nn_val();
	/*
	nnparc[0]=0;
	nnparc[1]=ns[0];
	nnparc[2]=nnparc[1]+np[0];
	nnparc[3]=nnparc[2]+ns[1];
	ntot=nnparc[3]+np[1];
	*/
	int mi,mj;
	int iaux=ntot*ntot;
	
	for(int i=0; i<iaux; ++i) {
		mx[i]=0.0;
	}
	for(int i=0; i<ntot; ++i) {
		B[i]=0.0;
	}
	
	// **************************************************************************
	// Pressure Equation Vector
	// **************************************************************************
	double aux3,aux4,aux5,aux6;
	double res0[qmax],res1[qmax],res2[qmax];
	
	int temp;							        // PE V
	// PE V
	//integral (1)						        // PE V
	
	for(int i=0; i<qmax; i++)
		res0[i]=lambdat[0][i]*K_g_pw_n[0][i]+lambdat[1][i]*K_g_pw_n[1][i];
	// dobro de {lambdat K nabla pw . ne}
	temp=1;							        // PE V
	for(iEr=0;iEr<2;iEr++) {					        // PE V
		pos=0;							        // PE V
		int I0=(e[iEr].show_ptr_stdel(pres))->show_bmapi(a[iEr]);	        // PE V
		int I1=(e[iEr].show_ptr_stdel(pres))->show_bmapi(a[iEr]+1);	        // PE V
		for(int ip=I0;ip<I1;ip++) {					        // PE V
			int rp=(e[iEr].show_ptr_stdel(pres))->show_bmapv(ip);		        // PE V
			
			e[iEr].Traco_phi_1(a[iEr],pres,pos,phi_r);
			pos++;				       // PE V
			aux=0.0;
			for(int q=0;q<qmax;q++) aux+=w[q]*res0[q]*phi_r[q];// PE V
      //B[e[iEr].map(pres,rp)] -= 0.5*aux*temp;
      mi=indice_interior(nnparc,iEr,pres,rp);
      B[mi] -= 0.5*aux*temp;		        // PE V
		}								        // PE V
		temp*=-1;							        // PE V
	}								        // PE V
	// PE V
	// integral (2)						        // PE V
	// PE V
	for(int i=0; i<qmax; i++){
		res0[i]=0.0;
		for(int ndir=0;ndir<ndim;ndir++) {
			res0[i]+=lambdan[ndir][i]*K_g_pc_n[ndir][i];
		}
	}
	temp=1;							         // PE V
	for(iEr=0;iEr<2;iEr++) {					         // PE V
		pos=0; 						                 // PE V
		int I0=(e[iEr].show_ptr_stdel(pres))->show_bmapi(a[iEr]);		 // PE V
		int I1=(e[iEr].show_ptr_stdel(pres))->show_bmapi(a[iEr]+1);		 // PE V
		for(int ip=I0;ip<I1;ip++) {						 // PE V
			int rp=(e[iEr].show_ptr_stdel(pres))->show_bmapv(ip); 		 // PE V
			// PE V
			e[iEr].Traco_phi_1(a[iEr],pres,pos,phi_r);
			pos++;				                                 // PE V
			aux=0.0;
			for(int q=0;q<qmax;q++) aux+=w[q]*res0[q]*phi_r[q];
      // PE V
      //B[e[iEr].map(pres,rp)] -= 0.5*aux*temp;
      mi=indice_interior(nnparc,iEr,pres,rp);
      B[mi] -= 0.5*aux*temp;				 // PE V
		}									 // PE V
		temp*=-1;								 // PE V
	}									 // PE V
	// PE V
	// integrais (3) e (4)						 // PE V
	
	for(iEr=0;iEr<2;iEr++) {						 // PE V
		for(int rp=0;rp<np[iEr];rp++) {					 // PE V
			aux=0.0;
			for(int q=0;q<qmax;q++)
				aux+=w[q]*K_g_phi_n[iEr][pres][rp][q]*(lambdat[iEr][q]*difpw[q]+
																							 lambdan[iEr][q]*difpc[q]);// PE V
      //B[e[iEr].map(pres,rp)] += 0.5*aux;
      mi=indice_interior(nnparc,iEr,pres,rp);
      B[mi] += 0.5*aux;				 // PE V
		}									 // PE V
	}									 // PE V
	// PE V
	// integral (5)							 // PE V
	
	temp=1;								 // PE V
	for(iEr=0;iEr<2;iEr++) {
		pos=0;						                 // PE V
		int I0=(e[iEr].show_ptr_stdel(pres))->show_bmapi(a[iEr]);		 // PE V
		int I1=(e[iEr].show_ptr_stdel(pres))->show_bmapi(a[iEr]+1);		 // PE V
		for(int ip=I0;ip<I1;ip++) {						 // PE V
			int rp=(e[iEr].show_ptr_stdel(pres))->show_bmapv(ip);			 // PE V
			e[iEr].Traco_phi_1(a[iEr],pres,pos,phi_r);
			pos++;				                                 // PE V
			aux=0.0;
			for(int q=0;q<qmax;q++)aux+=w[q]*phi_r[q]*difpw[q]; 		 // PE V
      //B[e[iEr].map(pres,rp)] += klt*penalty*aux*temp;
      mi=indice_interior(nnparc,iEr,pres,rp);
      B[mi] += klt*penalty*aux*temp; 			 // PE V
		}									 // PE V
		temp*=-1;								 // PE V
	}									 // PE V
	// PE V
	// integral (6)							 // PE V
	// PE V
	temp=1;								 // PE V
	for(iEr=0;iEr<2;iEr++) {						 // PE V
		pos=0;								 // PE V
		int I0=(e[iEr].show_ptr_stdel(pres))->show_bmapi(a[iEr]);		 // PE V
		int I1=(e[iEr].show_ptr_stdel(pres))->show_bmapi(a[iEr]+1);		 // PE V
		for(int ip=I0;ip<I1;ip++) {						 // PE V
			int rp=(e[iEr].show_ptr_stdel(pres))->show_bmapv(ip);			 // PE V
			// PE V
			e[iEr].Traco_phi_1(a[iEr],pres,pos,phi_r);
			pos++;				                                 // PE V
			aux=0.0;
			for(int q=0;q<qmax;q++)aux+=w[q]*phi_r[q]*difpc[q];		 // PE V
      // B[e[iEr].map(pres,rp)] += kln*penalty1*aux*temp;// 07/08/08 	 // PE V
      mi=indice_interior(nnparc,iEr,pres,rp);
      B[mi]  += kln*penalty1*aux*temp;
		}									 // PE V
		temp*=-1;								 // PE V
	}                                                                      // PE V
	
	// ****************************                                        // SE V
	// Saturation Equation Vector *					 // SE V
	// ****************************					 // SE V
	// SE V
	// integral (1)							 // SE V
	// SE V
	for(int q=0;q<qmax;q++){
		res2[q]=0.0;
		for(int ndir=0;ndir<ndim;ndir++){
			res2[q]+=lambdaw[ndir][q]*K_g_pw_n[ndir][q];
		}
	}
	temp=1;								 // SE V
	for(iEr=0;iEr<2;iEr++) {						 // SE V
		pos=0;								 // SE V
		int I0=(e[iEr].show_ptr_stdel(sat))->show_bmapi(a[iEr]);		 // SE V
		int I1=(e[iEr].show_ptr_stdel(sat))->show_bmapi(a[iEr]+1);		 // SE V
		for(int ip=I0;ip<I1;ip++) {						 // SE V
			int rs=(e[iEr].show_ptr_stdel(sat))->show_bmapv(ip); 			 // SE V
			// SE V
			e[iEr].Traco_phi_1(a[iEr],sat,pos,phi_r);
			pos++;				                                 // SE V
			aux=0.0;
			for(int q=0;q<qmax;q++)aux+=w[q]*phi_r[q]*res2[q];
      //B[e[iEr].map(sat,rs)] -= 0.5*aux*temp;				 // SE V
      mi=indice_interior(nnparc,iEr,sat,rs);
      B[mi]  -= 0.5*aux*temp;
		}									 // SE V
		temp*=-1;								 // SE V
	}									 // SE V
	// SE V
	// integral (2)							 // SE V
	// SE V
	for(iEr=0;iEr<2;iEr++) {						 // SE V
		for(int rs=0;rs<ns[iEr];rs++) {					 // SE V
			aux=0.0;
			for(int q=0;q<qmax;q++)
				aux+=w[q]*lambdaw[iEr][q]*K_g_phi_n[iEr][sat][rs][q]*difpw[q];	 // SE V
      //B[e[iEr].map(sat,rs)] += 0.5*aux;
      mi=indice_interior(nnparc,iEr,sat,rs);
      B[mi]  += 0.5*aux;				 // SE V
		}									 // SE V
	}									 // SE V
	// SE V
	// integral (3)							 // SE V
	// SE V
	temp=1;								 // SE V
	for(iEr=0;iEr<2;iEr++) {						 // SE V
		pos=0;								 // SE V
		int I0=(e[iEr].show_ptr_stdel(sat))->show_bmapi(a[iEr]);		 // SE V
		int I1=(e[iEr].show_ptr_stdel(sat))->show_bmapi(a[iEr]+1);		 // SE V
		for(int ip=I0;ip<I1;ip++) {						 // SE V
			int rs=(e[iEr].show_ptr_stdel(sat))->show_bmapv(ip); 			 // SE V
			// SE V
			e[iEr].Traco_phi_1(a[iEr],sat,pos,phi_r);pos++;			 // SE V
			aux=0.0;
			for(int q=0;q<qmax;q++)
				aux+=w[q]*phi_r[q]*difpw[q];
      // B[e[iEr].map(sat,rs)] += klw*penalty*aux*temp;
      mi=indice_interior(nnparc,iEr,sat,rs);
      B[mi]  += klw*penalty*aux*temp;			 // SE V
		}									 // SE V
		temp*=-1;								 // SE V
	}                                                                      // SE V
	
	// **************************************************************************
	// ********
	// Matriz *
	// ********
	// **************************************************************************
	// Pressure equation
	// **************************************************************************
	
	// ***************************************************************************
	for(iEr=0;iEr<2;iEr++) {// iEr                                      // PE_IE_P
		int sr=Sinal(iEr);						      // PE_IE_P
		// PE_IE_P
		// Pressure							      // PE_IE_P
		// PE_IE_P
		for(int rp=0;rp<np[iEr];rp++) {// PE_IE  rp			      // PE_IE_P
			
			int rp_on_border=e[iEr].show_ptr_stdel(pres)->is_on_border(rp,a[iEr],pos);
			if(rp_on_border)
				e[iEr].Traco_phi_1(a[iEr],pres,pos,phi_r);
      
      for(iEl=0;iEl<2;iEl++) {//  iEl				      // PE_IE_P
				int sl=Sinal(iEl);					      // PE_IE_P
				// PE_IE_P
				// Pressure						      // PE_IE_P
				for(int lp=0;lp<np[iEl];lp++) { // PE_IE_P lp		      // PE_IE_P
					
					int lp_on_border=e[iEl].show_ptr_stdel(pres)->is_on_border(lp,a[iEl],pos);
					if(lp_on_border)
						e[iEl].Traco_phi_1(a[iEl],pres,pos,phi_l);
					
					// integral 1						      // PE_IE_P
					// PE_IE_P
					if(rp_on_border) {					      // PE_IE_P
						aux1=0.0;
						for(int q=0;q<qmax;q++)
							aux1+=w[q]*lambdat[iEl][q]*K_g_phi_n[iEl][pres][lp][q]*phi_r[q];
					}							      // PE_IE_P
					else aux1=0.0;					      // PE_IE_P
					// PE_IE_P
					// integral 3						      // PE_IE_P
					// PE_IE_P
					if(lp_on_border) {					      // PE_IE_P
						aux2=0.0;
						for(int q=0;q<qmax;q++)
							aux2+=w[q]*lambdat[iEr][q]*K_g_phi_n[iEr][pres][rp][q]*phi_l[q];
						// integral 5					      // PE_IE_P
						if(rp_on_border) {				              // PE_IE_P
							aux3=0.0;
							for(int q=0;q<qmax;q++)aux3+=w[q]*phi_l[q]*phi_r[q];    // PE_IE_P
						}							      // PE_IE_P
						else aux3=0.0;					      // PE_IE_P
					}							      // PE_IE_P
					else {						      // PE_IE_P
						aux2=0.0;						      // PE_IE_P
						aux3=0.0;						      // PE_IE_P
					}							      // PE_IE_P
					// PE_IE_P
					aux = -0.5*sr*aux1+0.5*sl*aux2+sl*sr*klt*penalty*aux3;      // PE_IE_P
					{
						mi=indice_interior(nnparc,iEr,pres,rp);
						mj=indice_interior(nnparc,iEl,pres,lp);
						mx[npos(ntot,mi,mj)]+=aux;			              // PE_IE_P
					}						              // PE_IE_P
				}                                                             // PE_IE_P
				
				// Saturation
				
				for(int ls=0;ls<ns[iEl];ls++) { // PE_IE_S ls                 // PE_IE_S
					// PE_IE_S
					int ls_on_border=e[iEl].show_ptr_stdel(sat)->is_on_border(ls,a[iEl],pos);
					if(ls_on_border)
						e[iEl].Traco_phi_1(a[iEl],sat,pos,phi_l);                 // PE_IE_S
					aux=0.0;						      // PE_IE_S
					// PE_IE_S
					if(rp_on_border) {					      // PE_IE_S
						// PE_IE_S
						if(ls_on_border) {					      // PE_IE_S
							// PE_IE_S
							// integrais 1,2,3 				      // PE_IE_S
							aux1=0.0;
							for(int q=0;q<qmax;q++) {
								aux1+=w[q]*phi_l[q]*phi_r[q]*
								(d_lambdat[iEl][q]*K_g_pw_n[iEl][q]-
								 d_lambdan[iEl][q]*K_g_pc_n[iEl][q]-
								 lambdan[iEl][q]*d2_pc[iEl][q]*K_g_sn_n[iEl][q]);
							}
							aux -= 0.5*sr*aux1;				      // PE_IE_S
						}							      // PE_IE_S
						// PE_IE_S
						// integral 4					      // PE_IE_S
						aux2=0.0;
						for(int q=0;q<qmax;q++) {
							aux2+=w[q]*lambdan[iEl][q]*d_pc[iEl][q]*K_g_phi_n[iEl][sat][ls][q]*phi_r[q];
						}
						aux -= 0.5*sr*aux2;					      // PE_IE_S
					}							      // PE_IE_S
					// PE_IE_S
					if(ls_on_border) {					      // PE_IE_S
						// PE_IE_S
						if(iEl==iEr) {					      // PE_IE_S
							// integral (7)					      // PE_IE_S
							aux3=0.0;
							for(int q=0;q<qmax;q++)
								aux3+=w[q]*d_lambdat[iEl][q]*phi_l[q]*
								K_g_phi_n[iEr][pres][rp][q]*difpw[q];		      // PE_IE_S
							aux += 0.5*aux3;					      // PE_IE_S
							// PE_IE_S
							// integral (9)					      // PE_IE_S
							aux4=0.0;
							for(int q=0;q<qmax;q++)
								aux4+=w[q]*d_lambdan[iEl][q]*phi_l[q]*K_g_phi_n[iEr][pres][rp][q]*difpc[q];
							aux += 0.5*aux4;					      // PE_IE_S
						}// Integrais que so existem quando iEl=iEr		      // PE_IE_S
						// PE_IE_S
						// integral (5)					      // PE_IE_S
						
						aux5=0.0;
						for(int q=0;q<qmax;q++)
							aux5+=w[q]*lambdan[iEr][q]*K_g_phi_n[iEr][pres][rp][q]*
							d_pc[iEl][q]*phi_l[q];
						aux += 0.5*aux5*sl;					      // PE_IE_S
						// PE_IE_S
						// integral (6)					      // PE_IE_S
						if(rp_on_border) {					      // PE_IE_S
							aux6=0.0;
							for(int q=0;q<qmax;q++)
								aux6+=w[q]*d_pc[iEl][q]*phi_l[q]*phi_r[q];	      // PE_IE_S
							aux += kln*penalty1*sl*sr*aux6;// 07/08/08	      // PE_IE_S
						}							      // PE_IE_S
					}							      // PE_IE_S
					/*if(aux!=0.0)*/
					{					                      // PE_IE_S
						mi=indice_interior(nnparc,iEr,pres,rp);
						mj=indice_interior(nnparc,iEl,sat,ls);
						mx[npos(ntot,mi,mj)]+=aux;						      // PE_IE_S
					}							      // PE_IE_S
				}							      // PE_IE_S
      }								      // PE_IE_S
		}								      // PE_IE_S
	}                                                                   // PE_IE_S
	
	// **************************************************************************
	// Saturation Equation
	// **************************************************************************
	// SE_IE_P
	for(iEr=0;iEr<2;iEr++) {					      // SE_IE_P
		int sr=Sinal(iEr);						      // SE_IE_P
		// SE_IE_P
		// Saturation						      // SE_IE_P
		// SE_IE_P
		for(int rs=0;rs<ns[iEr];rs++) {// SE_IE  rs			      // SE_IE_P
			// SE_IE_P
			int rs_on_border=e[iEr].show_ptr_stdel(sat)->is_on_border(rs,a[iEr],pos);
			if(rs_on_border)
				e[iEr].Traco_phi_1(a[iEr],sat,pos,phi_r);		      // SE_IE_P
      for(iEl=0;iEl<2;iEl++) {// <==================================  // SE_IE_P
				int sl=Sinal(iEr);					      // SE_IE_P
				// SE_IE_P
				// Derivative of Pressure				      // SE_IE_P
				// SE_IE_PS 						      // SE_IE_P
				// SE_IE_P
				for(int lp=0;lp<np[iEl];lp++) {				      // SE_IE_P
					// SE_IE_P
					int lp_on_border=e[iEl].show_ptr_stdel(pres)->is_on_border(lp,a[iEl],pos);
					if(lp_on_border)
						e[iEl].Traco_phi_1(a[iEl],pres,pos,phi_l);		      // SE_IE_P
					aux=0.0;						      // SE_IE_P
					// SE_IE_P
					if (rs_on_border) {					      // SE_IE_P
						//integral 1					      // SE_IE_P
						aux1=0.0;
						for(int q=0;q<qmax;q++)
							aux1+=w[q]*lambdaw[iEl][q]*K_g_phi_n[iEl][pres][lp][q]*phi_r[q];
						aux -= 0.5*sr*aux1;					      // SE_IE_P
					}							      // SE_IE_P
					// SE_IE_P
					if (lp_on_border) {					      // SE_IE_P
						// SE_IE_P
						// integral 2 					      // SE_IE_P
						aux1=0.0;
						for(int q=0;q<qmax;q++)
							aux1+=w[q]*lambdaw[iEr][q]*K_g_phi_n[iEr][sat][rs][q]*phi_l[q];
						aux += 0.5*sl*aux1;					      // SE_IE_P
						// SE_IE_P
						if (rs_on_border) {					      // SE_IE_P
							// SE_IE_P
							// integral 3					      // SE_IE_P
							aux1=0.0;
							for(int q=0;q<qmax;q++)
								aux1+=w[q]*phi_l[q]*phi_r[q];
							aux += klw*penalty*sl*sr*aux1;			      // SE_IE_P
						}							      // SE_IE_P
					}							      // SE_IE_P
					/*if(aux!=0.0)*/
					{
						mi=indice_interior(nnparc,iEr,sat,rs);
						mj=indice_interior(nnparc,iEl,pres,lp);
						mx[npos(ntot,mi,mj)]+=aux;						      // SE_IE_P
					}							      // SE_IE_P
				}                                                             // SE_IE_P
				
				// Derivative of Saturation
				
				// SE_IE_SS_00                                                // SE_IE_S
				pos=0; 							      // SE_IE_S
				int I0=(e[iEl].show_ptr_stdel(sat))->show_bmapi(a[iEl]);	      // SE_IE_S
				int I1=(e[iEl].show_ptr_stdel(sat))->show_bmapi(a[iEl]+1);	      // SE_IE_S
				for(int ip=I0;ip<I1;ip++) {				      // SE_IE_S
					int ls=(e[iEl].show_ptr_stdel(sat))->show_bmapv(ip); 	      // SE_IE_S
					// SE_IE_S
					e[iEl].Traco_phi_1(a[iEl],sat,pos,phi_l);
					pos++;		      // SE_IE_S
					
					for(int qtemp=0.0;qtemp<qmax;qtemp++) {
						res1[qtemp]=0.0;
						for(int ndir=0;ndir<ndim;ndir++){
							res1[qtemp]+=Kgpw[iEl][ndir][qtemp]*n_e[ndir];
						}
					}
					//prodgn(qmax,Kgpw[iEl][0],Kgpw[iEl][1],n_e,res1);	      // SE_IE_S
					// SE_IE_S
					aux=0.0;	  					      // SE_IE_S
					// SE_IE_S
					if (rs_on_border) {					      // SE_IE_S
						// SE_IE_S
						//integral 1 					      // SE_IE_S
						// SE_IE_S
						aux1=0.0;
						for(int q=0;q<qmax;q++)
							aux1+=w[q]*d_lambdaw[iEl][q]*K_g_pw_n[iEl][q]*phi_l[q]*phi_r[q];
						aux -= 0.5*sr*aux1;					      // SE_IE_S
					}							      // SE_IE_S
					// SE_IE_S
					if(iEl==iEr) {					      // SE_IE_S
						// integral 2					      // SE_IE_S
						aux1=0.0;
						for(int q=0;q<qmax;q++)
							aux1+=w[q]*d_lambdaw[iEl][q]*phi_l[q]*
							K_g_phi_n[iEr][sat][rs][q]*difpw[q];
						aux += 0.5*aux1;					      // SE_IE_S
					}							      // SE_IE_S
					/*if(aux!=0.0)*/
					{					                      // SE_IE_S
						mi=indice_interior(nnparc,iEr,sat,rs);
						mj=indice_interior(nnparc,iEl,sat,ls);
						mx[npos(ntot,mi,mj)]+=aux;						      // SE_IE_S
					}							      // SE_IE_S
				}							      // SE_IE_S
      }								      // SE_IE_S
		}								      // SE_IE_S
	}
	
	//printf(" Ate Aqui\n");                                                              // SE_IE_S
	// Ate aqui esta ok 22/05/2008
	// ******************************************
	// ******************************************
	for(iEr=0;iEr<2;iEr++) {
		for (int rp=0;rp<np[iEr];rp++) {
			mi = indice_interior(nnparc,iEr,pres,rp);
			indx[mi] = e[iEr].map(pres,rp);
		}
		for (int rs=0;rs<ns[iEr];rs++) {
			mi = indice_interior(nnparc,iEr,sat,rs);
			indx[mi] = e[iEr].map(sat,rs);
		}
	}
	return ntot;
}
Пример #13
0
 ifilter<Operator, List0>::ifilter(Operator _op, List0 const &_seq)
     : utils::iterator_reminder<false, List0>(_seq),
       iterator(_op, this->value), end_iter(npos(), _op, this->value)
 {
 }