Beispiel #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");
    }
   
  }
Beispiel #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 
    }
    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; */
    }
		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 ");
				}
			}
		}