Пример #1
0
 Vtkwritesol_Op(const basicAC_F0 &  args) :  what(0), nbfloat(0)
  {
   evct=0;
   evct2=0;
   int nbofsol;
   int ddim=2;
   //There's no named parameter
   args.SetNameParam();
   if(args.size()!=3)
    {
     CompileError("Vtkwritesol accepts only 4 parameters");
    }
   if (BCastTo<VtkWriter *>(args[0])) edx = CastTo<VtkWriter *>(args[0]);
   if (BCastTo<string *>(args[1])) ename = CastTo<string *>(args[1]);
   
   if ( args[2].left()==atype<double>() )
    {
     what=1;
     nbfloat=1;
     evct=to<double>( args[2] );
    }
   else if ( args[2].left()==atype<double *>() )
    {
     what=1;
     nbfloat=1;
     evct=to<double>( args[2] );
    }
   else if ( BCastTo<pfer>(args[2]) )
    {
     what=1;
     nbfloat=1;
     evct=to<double>( args[2] );
    }
   else if ( args[2].left()==atype<E_Array>() )
    {
     std::cout << "Until now only scalar solution" << std::endl;
     
     int i=2;
     const E_Array * a0  = dynamic_cast<const E_Array *>( args[i].LeftValue() );
         
     if( a0->size() == ddim){
      // vector solution
      what=2;
      nbfloat=a0->size();
      evct = to<double>( (*a0)[0]);
      evct2 = to<double>( (*a0)[1]);
      
     }
      cout << "Passed Until now only scalar solution" << std::endl;
    }
   else 
    {
     CompileError("savesol in 2D: Sorry no way to save this kind of data");
    }
   
  }
Пример #2
0
    E_newoa(const basicAC_F0 & args,int cc) :
      cas(cc)
    {
      int nbj= args.size()-1;
      Block::open(currentblock); // make a new block to 
      X = to<Kn*>(args[nbj]);
      C_F0 X_n(args[nbj],"n");
      //  the expression to init the theparam of all 
      inittheparam = currentblock->NewVar<LocalVariable>("the parameter",atype<KN<R> *>(),X_n);
      theparam = currentblock->Find("the parameter"); //  the expression for the parameter
      args.SetNameParam(n_name_param,name_param,nargs);
      const  Polymorphic * opJ=0;
      if (nbj>0)
	{
	  opJ=  dynamic_cast<const  Polymorphic *>(args[0].LeftValue());
	  assert(opJ);
	}      
      JJ= to<R>(C_F0(opJ,"(",theparam));
      closetheparam=currentblock->close(currentblock);   // the cleanning block expression 
    }
Пример #3
0
    E_LCG(const basicAC_F0 & args,int cc) :
      cas(cc)
    {
      int nbj= args.size()-1;
      Block::open(currentblock); // make a new block to 
      X = to<Kn*>(args[nbj]);
      C_F0 X_n(args[nbj],"n");
      //  the expression to init the theparam of all 
      inittheparam = currentblock->NewVar<LocalVariable>("the parameter",atype<KN<R> *>(),X_n);
      theparam = currentblock->Find("the parameter"); //  the expression for the parameter
      args.SetNameParam(n_name_param,name_param,nargs);
      const  Polymorphic * opJ=0;
      const  Polymorphic * opdJ=0;
      const  Polymorphic * ophJ=0;
      if (nbj>0)
	{  opJ=  dynamic_cast<const  Polymorphic *>(args[0].LeftValue());
	assert(opJ); }
      if (nbj>1)
	{   opdJ=  dynamic_cast<const  Polymorphic *>(args[1].LeftValue());
	assert(opdJ); }
      if (nbj>2)   
	{  ophJ=  dynamic_cast<const  Polymorphic *>(args[2].LeftValue());
	assert(ophJ); }
      J=dJ=hJ=0;
      
      J= to<R>(C_F0(opJ,"(",theparam));
      if(opdJ)
        dJ= to<Kn_>(C_F0(opdJ,"(",theparam));// mai2009 (bug????) Modif FH 17102005 (a verifier) to<Kn*> ->to<Kn>
      if(ophJ)
	hJ= to< Matrice_Creuse<R> *>(C_F0(ophJ,"(",theparam));
      
        closetheparam=C_F0((Expression) Block::snewclose(currentblock),atype<void>()) ;   // the cleanning block expression
      /*         
		 if (nargs[2]) 
		 {  const  Polymorphic * op=  dynamic_cast<const  Polymorphic *>(nargs[2]);
		 assert(op); 
		 C = op->Find("(",ArrayOfaType(atype<Kn* >(),false)); }
		 else  C =0; */
    }
Пример #4
0
 MatrixUpWind0(const basicAC_F0 & args) 
 {   
   
   args.SetNameParam();
   emat =args[0];
   expTh= to<pmesh>(args[1]);
   expc = CastTo<double>(args[2]);
   const E_Array * a= dynamic_cast<const E_Array*>((Expression) args[3]);
   if (a->size() != 2) CompileError("syntax:  MatrixUpWind0(Th,rhi,[u1,u2])");
   int err =0;
   expu1= CastTo<double>((*a)[0]);
   expu2= CastTo<double>((*a)[1]);
   
 }
Пример #5
0
  ISOLINE_P1_Op(const basicAC_F0 &  args,Expression tth, Expression fff) 
    : eTh(tth), filename(fff)
  {
    args.SetNameParam(n_name_param,name_param,nargs);
 
    if (  BCastTo<double>(args[2])  )
      {	 
	ff=to<double>( args[2] );  
      }
    else {ffassert(0);
      // ErrorCompile("no function to isolines \n");
    }    
    if( !nargs[0]) ffassert(0); 
      //   ErrorCompile("no isolines selected \n");
  } 
Пример #6
0
 MetricPk(const basicAC_F0 & args)
 {
   args.SetNameParam(n_name_param,name_param,nargs);// les arguments nommes
   expTh= to<pmesh>(args[0]);  // a the expression to get the mesh
   expu= to<double>(args[1]);  // a the expression to get the mesh
   /*
   exphmin= to<double>(args[2]);  // a the expression to get the mesh
   exphmax= to<double>(args[3]);  // a the expression to get the mesh
   experr= to<double>(args[4]);  // a the expression to get the mesh
   //  a array expression [ a, b]
   const E_Array * ma= dynamic_cast<const E_Array*>((Expression) args[5]);
   const E_Array * mp= dynamic_cast<const E_Array*>((Expression) args[6]);
   if (ma->size() != 3) CompileError("syntax: MetricKuate(Th,np,o,err,[m11,m12,m22],[xx,yy])");
   if (mp->size() != 2) CompileError("syntax: MetricKuate(Th,np,o,err,[m11,m12,m22],[xx,yy])");
   int err =0;
   m11= CastTo<KN<double> * >((*ma)[0]); // fist exp of the array (must be a  double)
   m12= CastTo<KN<double> * >((*ma)[1]); // second exp of the array (must be a  double)
   m22= CastTo<KN<double> * >((*ma)[2]); // second exp of the array (must be a  double)
   px= CastTo<double * >((*mp)[0]); // fist exp of the array (must be a  double)
   py= CastTo<double * >((*mp)[1]); // second exp of the array (must be a  double)
    */
 }
Пример #7
0
		Netgen_LoadMesh_Op (const basicAC_F0 &args, Expression ffname)
			: filename(ffname) {
			if (verbosity) {cout << "Load mesh given by Netgen " << endl;}

			args.SetNameParam(n_name_param, name_param, nargs);
		}
Пример #8
0
		Netgen_STL_Op (const basicAC_F0 &args, Expression ffname)
			: filename(ffname) {
			if (verbosity) {cout << "construction par RemplissageNetgen_Op" << endl;}

			args.SetNameParam(n_name_param, name_param, nargs);
		}
Пример #9
0
		RemplissageNetgen_Op (const basicAC_F0 &args, Expression tth)
			: eTh(tth) {
			if (verbosity) {cout << "construction par RemplissageNetgen_Op" << endl;}

			args.SetNameParam(n_name_param, name_param, nargs);
		}
Пример #10
0
 distributedDot_Op<K>(const basicAC_F0& args, Expression param1, Expression param2, Expression param3) : A(param1), in(param2), out(param3) {
     args.SetNameParam(n_name_param, name_param, nargs);
 }
Пример #11
0
 exchangeInOut_Op<Type, K>(const basicAC_F0& args, Expression param1, Expression param2, Expression param3) : A(param1), in(param2), out(param3) {
     args.SetNameParam(n_name_param, name_param, nargs);
 }
Пример #12
0
 ParMETIS_Op(const basicAC_F0& args, Expression param1, Expression param2, Expression param3) : part(param1), pTh(param2), lparts(param3) {
     args.SetNameParam(n_name_param, name_param, nargs);
 }
Пример #13
0
 removeDOF_Op(const basicAC_F0&  args, Expression param1, Expression param2, Expression param3, Expression param4) : A(param1), R(param2), x(param3), out(param4) {
     args.SetNameParam(n_name_param, name_param, nargs);
 }
Пример #14
0
		yams_Op (const basicAC_F0 &args): sol(args.size() - 1) {
			cout << "yams" << endl;
			args.SetNameParam(n_name_param, name_param, nargs);
			eTh = to<pmesh3>(args[0]);
			dim = 3;
			nbsol = args.size() - 1;
			if (nbsol > 1) {
				CompileError(" yams accept only one solution ");
			}

			int ksol = 0;

			if (nbsol == 1) {
				int i = 1;
				if (args[i].left() == atype<E_Array>()) {
					const E_Array *a = dynamic_cast<const E_Array *>(args[i].LeftValue());
					ffassert(a);
					ksol += a->size();
				} else {
					ksol++;
				}

				sol.resize(ksol);

				// type :: 1 sca, 2 vector, 3 symtensor

				ksol = 0;
				nbsolsize = 0;
				type = 0;

				if (args[i].left() == atype<E_Array>()) {
					const E_Array *a = dynamic_cast<const E_Array *>(args[i].LeftValue());
					ffassert(a);
					int N = a->size();
					nbsolsize = nbsolsize + N;

					switch (N) {
					/*
					 * case 3 :
					 *  type[i-1]=2;
					 *  for (int j=0;j<N;j++)
					 *  sol[ksol++]=to<double>((*a)[j]);
					 *  break;
					 */
					case 6:
						type = 3;

						for (int j = 0; j < N; j++) {
							sol[ksol++] = to<double>((*a)[j]);
						}

						break;
					default:
						CompileError(" 3D solution for yams is a scalar (1 comp) or a symetric tensor (6 comp)");
						break;
					}
				} else {
					type = 1;
					nbsolsize = nbsolsize + 1;
					sol[ksol++] = to<double>(args[i]);
				}

				if (nargs[2]) {
					CompileError(" we give two metric for yams ");
				}
			}
		}