Example #1
0
static void
redraw_region (GdkRectangle *rect)
{
  int eleft, eright, etop, ebottom;
  BoxType region;
  render_priv *priv = gport->render_priv;

  if (!gport->pixmap)
    return;

  if (rect != NULL)
    {
      priv->clip_rect = *rect;
      priv->clip = true;
    }
  else
    {
      priv->clip_rect.x = 0;
      priv->clip_rect.y = 0;
      priv->clip_rect.width = gport->width;
      priv->clip_rect.height = gport->height;
      priv->clip = false;
    }

  set_clip (priv, priv->bg_gc);
  set_clip (priv, priv->offlimits_gc);
  set_clip (priv, priv->mask_gc);
  set_clip (priv, priv->grid_gc);

  region.X1 = MIN(Px(priv->clip_rect.x),
                  Px(priv->clip_rect.x + priv->clip_rect.width + 1));
  region.Y1 = MIN(Py(priv->clip_rect.y),
                  Py(priv->clip_rect.y + priv->clip_rect.height + 1));
  region.X2 = MAX(Px(priv->clip_rect.x),
                  Px(priv->clip_rect.x + priv->clip_rect.width + 1));
  region.Y2 = MAX(Py(priv->clip_rect.y),
                  Py(priv->clip_rect.y + priv->clip_rect.height + 1));

  region.X1 = MAX (0, MIN (PCB->MaxWidth,  region.X1));
  region.X2 = MAX (0, MIN (PCB->MaxWidth,  region.X2));
  region.Y1 = MAX (0, MIN (PCB->MaxHeight, region.Y1));
  region.Y2 = MAX (0, MIN (PCB->MaxHeight, region.Y2));

  eleft = Vx (0);
  eright = Vx (PCB->MaxWidth);
  etop = Vy (0);
  ebottom = Vy (PCB->MaxHeight);
  if (eleft > eright)
    {
      int tmp = eleft;
      eleft = eright;
      eright = tmp;
    }
  if (etop > ebottom)
    {
      int tmp = etop;
      etop = ebottom;
      ebottom = tmp;
    }

  if (eleft > 0)
    gdk_draw_rectangle (gport->drawable, priv->offlimits_gc,
                        1, 0, 0, eleft, gport->height);
  else
    eleft = 0;
  if (eright < gport->width)
    gdk_draw_rectangle (gport->drawable, priv->offlimits_gc,
                        1, eright, 0, gport->width - eright, gport->height);
  else
    eright = gport->width;
  if (etop > 0)
    gdk_draw_rectangle (gport->drawable, priv->offlimits_gc,
                        1, eleft, 0, eright - eleft + 1, etop);
  else
    etop = 0;
  if (ebottom < gport->height)
    gdk_draw_rectangle (gport->drawable, priv->offlimits_gc,
                        1, eleft, ebottom, eright - eleft + 1,
                        gport->height - ebottom);
  else
    ebottom = gport->height;

  gdk_draw_rectangle (gport->drawable, priv->bg_gc, 1,
                      eleft, etop, eright - eleft + 1, ebottom - etop + 1);

  ghid_draw_bg_image();

  hid_expose_callback (&ghid_hid, &region, 0);
  ghid_draw_grid ();

  /* In some cases we are called with the crosshair still off */
  if (priv->attached_invalidate_depth == 0)
    DrawAttached ();

  /* In some cases we are called with the mark still off */
  if (priv->mark_invalidate_depth == 0)
    DrawMark ();

  draw_lead_user (priv);

  priv->clip = false;

  /* Rest the clip for bg_gc, as it is used outside this function */
  gdk_gc_set_clip_mask (priv->bg_gc, NULL);
}
Example #2
0
int ct_stab_parse(const char *ofile, int option, ...)
{
  FILE *fp;

  if ( ! (fp = fopen(ofile, "rb")) ) {
#ifdef __CYGWIN32__
    const char *suffixes[] = { ".exe", ".com", 0 };
    int i;

    for ( i = 0; suffixes[i]; i ++ ) {
      char op[MAXPATHLEN + 1];

      strcpy(op, ofile);
      strcat(op, suffixes[i]);

      if ( (fp = fopen(op, "rb")) )
	break;
    }
    if ( ! suffixes[i] ) 
#endif
    {
      fprintf(stderr, "ct_stab_parse: cannot open '%s'\n", ofile);
      return -1;
    }
  }


#define Pm(x) fprintf(stderr, "%s\n", (char *) (x));
#define Pu(x) fprintf(stderr, "%s = %lu\n", #x, (unsigned long) (x))
#define Px(x) fprintf(stderr, "%s = %08lx\n", #x, (unsigned long) (x))
#define Ps(x) fprintf(stderr, "%s = \"%s\"\n", #x, (char *) (x))
#define Pss(x,s) fprintf(stderr, "%s = \"%*s\"\n", #x, (int) (s), (char *) (x))

#if 0 
  {
    struct external_filehdr fh;

    fseek(fp, 0, 0);
    fread(&fh, sizeof(fh), 1, fp);

    Pm("external_filehdr");
    Px(fh.f_magic);
    Px(fh.f_nscns);
    Px(fh.f_timdat);
    Px(fh.f_symptr);
    Px(fh.f_nsyms);
    Px(fh.f_opthdr);
    Px(fh.f_flags);

  }

  {
    AOUTHDR fh;

    fseek(fp, 0, 0);
    fread(&fh, sizeof(fh), 1, fp);

    Pm("AOUTHDR");
    Px(fh.magic);
    Px(fh.vstamp);
    Px(fh.tsize);
    Px(fh.dsize);
    Px(fh.bsize);
    Px(fh.entry);
    Px(fh.text_start);
    Px(fh.data_start);
  }
#endif
  
  {
    FILHDR fh;

    fseek(fp, 0, 0);
    fread(&fh, sizeof(fh), 1, fp);

    Pm("FILHDR");
    Px(fh.e_magic);
    Px(fh.e_cblp);
    Px(fh.e_cp);
    Px(fh.e_crlc);
    Px(fh.e_cparhdr);
    Px(fh.e_minalloc);
    Px(fh.e_maxalloc);
    Px(fh.e_ss);
    Px(fh.e_sp);
    Px(fh.e_csum);
    Px(fh.e_ip);
    Px(fh.e_cs);
    Px(fh.e_lfarlc);
    Px(fh.e_ovno);
    /* fh.e_res[4][2] */
    Px(fh.e_oemid);
    Px(fh.e_oeminfo);
    /* fh.e_res2[10][2] */
    Px(fh.e_lfanew);
    /* fh.dos_message[16][4] */
    Px(fh.nt_signature);

    Pm("From standard header");
    Px(fh.f_magic);
    Px(fh.f_nscns);
    Px(fh.f_timdat);
    Px(fh.f_symptr);
    Px(fh.f_nsyms);
    Px(fh.f_opthdr);
    Px(fh.f_flags);
    
    //   exit (1);

    fseek(fp, fh.f_opthdr, SEEK_CUR);

    {
      int i;

      Pm("Sections");
      for ( i = 0; i < fh.f_nscns; i ++ ) {
	SCNHDR sh;

	fread(&sh, sizeof(sh), 1, fp);
	Pm("");
	Pss(sh.s_name, sizeof(sh.s_name));
	Px(sh.s_paddr);
	Px(sh.s_vaddr);
	Pu(sh.s_size);
#if 0
	Px(sh.s_scnptr);
	Px(sh.s_relptr);
	Pu(sh.s_nreloc);
	Pu(sh.s_nlnno);
	Px(sh.s_flags);
#endif

      }
    }

    if ( fh.f_opthdr == sizeof(AOUTHDR) ) {
      AOUTHDR aoh;

      Pm("AOUTHDR");
      fread(&aoh, sizeof(aoh), 1, fp);
      Px(aoh.magic);
      Px(aoh.vstamp);
      Px(aoh.tsize);
      Px(aoh.dsize);
      Px(aoh.bsize);
      Px(aoh.entry);
      Px(aoh.text_start);
      Px(aoh.data_start);
    }

    exit(1);

    {
      int i;
      
      fseek(fp, fh.f_symptr, 0);
    
      Pm("Reading symbols");
      for ( i = 0; i < fh.f_nsyms; i ++ ) {
	SYMENT se;

	fread(&se, sizeof(se), 1, fp);
	// Ps(se.e.e_name);
	if ( se.e.e.e_zeroes ) {
	  Ps(se.e.e_name);
	} else {
	  Px(se.e.e.e_zeroes);
	  Px(se.e.e.e_offset);
	}
	Px(se.e_value);
	Px(se.e_scnum);
	Px(se.e_type);
	Px(se.e_sclass[0]);
	Px(se.e_numaux[1]);
      }
    }
  }
  
  fclose(fp);
  return 0;
}
void Basis_HGRAD_LINE_Hermite_FEM<Scalar, ArrayScalar>::getValues(ArrayScalar &        outputValues,
                                                                  const ArrayScalar &  inputPoints,
                                                                  const EOperator      operatorType) const {
  
  // Verify arguments
#ifdef HAVE_INTREPID_DEBUG
  Intrepid::getValues_HGRAD_Args<Scalar, ArrayScalar>(outputValues,
                                                      inputPoints,
                                                      operatorType,
                                                      this -> getBaseCellTopology(),
                                                      this -> getCardinality() );
#endif
  // Number of evaluation points = dim 0 of inputPoints
  int nPts = inputPoints.dimension(0);  
  int nBf  = this->getCardinality();  

  int n = nBf/2;

  // Legendre polynomials and their derivatives evaluated on inputPoints
  SerialDenseMatrix legendre(nBf,nPts); 

  // Hermite interpolants evaluated on inputPoints
  SerialDenseMatrix hermite(nBf,nPts);
    
  ArrayScalar P (nBf);
  ArrayScalar Px(nBf);
         
  int derivative_order;
  int derivative_case = static_cast<int>(operatorType);

  if( derivative_case == 0 ) {
    derivative_order = 0;
  }
  else if( derivative_case > 0 && derivative_case < 5 ) {
    derivative_order = 1;
  }
  else {
    derivative_order = derivative_case - 3;
  }
  
  try {
    // GRAD,CURL,DIV, and D1 are all the first derivative
    switch (operatorType) {
      case OPERATOR_VALUE: 
      { 
        for( int i=0; i<nPts; ++i ) { 
          recurrence( P, Px, inputPoints(i,0) );
          for( int j=0; j<nBf; ++j ) {
             legendre(j,i) = P(j);
          }
        }
        break; 
      }
      case OPERATOR_GRAD:
      case OPERATOR_DIV:
      case OPERATOR_CURL:
      case OPERATOR_D1:
      {
        for( int i=0; i<nPts; ++i ) { 
          recurrence( P, Px, inputPoints(i,0) );
          for( int j=0; j<nBf; ++j ) {
             legendre(j,i) = Px(j);
          }
        }
        break;
      }  
      case OPERATOR_D2:
      case OPERATOR_D3:
      case OPERATOR_D4:
      case OPERATOR_D5:
      case OPERATOR_D6:
      case OPERATOR_D7:
      case OPERATOR_D8:
      case OPERATOR_D9:
      case OPERATOR_D10:
      {
        for( int i=0; i<nPts; ++i ) {
          legendre_d( P, Px, derivative_order, inputPoints(i,0));
          for( int j=0; j<nBf; ++j ) {
            legendre(j,i) = Px(j); 
          }
        }
        break;
      }
      default:
        TEUCHOS_TEST_FOR_EXCEPTION( !( Intrepid::isValidOperator(operatorType) ), std::invalid_argument,
                            ">>> ERROR (Basis_HGRAD_LINE_Hermite_FEM): Invalid operator type");

    } // switch(operatorType)
  }
  catch (std::invalid_argument &exception){
    TEUCHOS_TEST_FOR_EXCEPTION( true , std::invalid_argument,
                        ">>> ERROR (Basis_HGRAD_LINE_Hermite_FEM): Operator failed");    
  }

  if( !isFactored_ ) {
    solver_.factorWithEquilibration(true);
    solver_.factor();
  }

  solver_.setVectors(Teuchos::rcpFromRef(hermite),Teuchos::rcpFromRef(legendre));
  solver_.solve();

  if(derivative_order > 0)
  {
    for( int i=0; i<n; ++i ) {
      for( int j=0; j<nPts; ++j ) {
        outputValues(2*i,  j,0)  = hermite(i,  j);
        outputValues(2*i+1,j,0)  = hermite(i+n,j);
      } 
    }
  }
  else {
    for( int i=0; i<n; ++i ) {
      for( int j=0; j<nPts; ++j ) {
        outputValues(2*i  ,j)   = hermite(i,  j);
        outputValues(2*i+1,j)   = hermite(i+n,j);
      } 
    }
  }
     
} // getValues()
Example #4
0
PreconditionerBlockMS<space_type>::PreconditionerBlockMS(space_ptrtype Xh,             // (u)x(p)
                                                         ModelProperties model,        // model
                                                         std::string const& p,         // prefix
                                                         sparse_matrix_ptrtype AA )    // The matrix
    :
        M_backend(backend()),           // the backend associated to the PC
        M_Xh( Xh ),
        M_Vh( Xh->template functionSpace<0>() ), // Potential
        M_Qh( Xh->template functionSpace<1>() ), // Lagrange
        M_Vh_indices( M_Vh->nLocalDofWithGhost() ),
        M_Qh_indices( M_Qh->nLocalDofWithGhost() ),
        M_uin( M_backend->newVector( M_Vh )  ),
        M_uout( M_backend->newVector( M_Vh )  ),
        M_pin( M_backend->newVector( M_Qh )  ),
        M_pout( M_backend->newVector( M_Qh )  ),
        U( M_Xh, "U" ),
        M_mass(M_backend->newMatrix(M_Vh,M_Vh)),
        M_L(M_backend->newMatrix(M_Qh,M_Qh)),
        M_er( 1. ),
        M_model( model ),
        M_prefix( p ),
        M_prefix_11( p+".11" ),
        M_prefix_22( p+".22" ),
        u(M_Vh, "u"),
        ozz(M_Vh, "ozz"),
        zoz(M_Vh, "zoz"),
        zzo(M_Vh, "zzo"),
        M_ozz(M_backend->newVector( M_Vh )),
        M_zoz(M_backend->newVector( M_Vh )),
        M_zzo(M_backend->newVector( M_Vh )),
        X(M_Qh, "X"),
        Y(M_Qh, "Y"),
        Z(M_Qh, "Z"),
        M_X(M_backend->newVector( M_Qh )),
        M_Y(M_backend->newVector( M_Qh )),
        M_Z(M_backend->newVector( M_Qh )),
        phi(M_Qh, "phi")
{
    tic();
    LOG(INFO) << "[PreconditionerBlockMS] setup starts";
    this->setMatrix( AA );
    this->setName(M_prefix);

    /* Indices are need to extract sub matrix */
    std::iota( M_Vh_indices.begin(), M_Vh_indices.end(), 0 );
    std::iota( M_Qh_indices.begin(), M_Qh_indices.end(), M_Vh->nLocalDofWithGhost() );

    M_11 = AA->createSubMatrix( M_Vh_indices, M_Vh_indices, true, true);

    /* Boundary conditions */
    BoundaryConditions M_bc = M_model.boundaryConditions();
    map_vector_field<FEELPP_DIM,1,2> m_dirichlet_u { M_bc.getVectorFields<FEELPP_DIM> ( "u", "Dirichlet" ) };
    map_scalar_field<2> m_dirichlet_p { M_bc.getScalarFields<2> ( "phi", "Dirichlet" ) };

    /* Compute the mass matrix (needed in first block, constant) */
    auto f2A = form2(_test=M_Vh, _trial=M_Vh, _matrix=M_mass);
    auto f1A = form1(_test=M_Vh);
    f2A = integrate(_range=elements(M_Vh->mesh()), _expr=inner(idt(u),id(u))); // M
    for(auto const & it : m_dirichlet_u )
    {
        LOG(INFO) << "Applying " << it.second << " on " << it.first << " for "<<M_prefix_11<<"\n";
        f2A += on(_range=markedfaces(M_Vh->mesh(),it.first), _expr=it.second,_rhs=f1A, _element=u, _type="elimination_symmetric");
    }
    
    /* Compute the L (= er * grad grad) matrix (the second block) */
    auto f2L = form2(_test=M_Qh,_trial=M_Qh, _matrix=M_L);
    for(auto it : M_model.materials() )
    { 
        f2L += integrate(_range=markedelements(M_Qh->mesh(),marker(it)), _expr=M_er*inner(gradt(phi), grad(phi)));
    }
    auto f1LQ = form1(_test=M_Qh);

    for(auto const & it : m_dirichlet_p)
    {
        LOG(INFO) << "Applying " << it.second << " on " << it.first << " for "<<M_prefix_22<<"\n";
        f2L += on(_range=markedfaces(M_Qh->mesh(),it.first),_element=phi, _expr=it.second, _rhs=f1LQ, _type="elimination_symmetric");
    }


    if(soption(_name="pc-type", _prefix=M_prefix_11) == "ams")
#if FEELPP_DIM == 3
    {
        M_grad  = Grad( _domainSpace=M_Qh, _imageSpace=M_Vh);

        // This preconditioner is linked to that backend : the backend will
        // automatically use the preconditioner.
        auto prec = preconditioner(_pc=pcTypeConvertStrToEnum(soption(M_prefix_11+".pc-type")),
                                   _backend=backend(_name=M_prefix_11),
                                   _prefix=M_prefix_11,
                                   _matrix=M_11
                                  );
        prec->setMatrix(M_11);
        prec->attachAuxiliarySparseMatrix("G",M_grad.matPtr());
        if(boption(M_prefix_11+".useEdge"))
        {
            LOG(INFO) << "[ AMS ] : using SetConstantEdgeVector \n";
            ozz.on(_range=elements(M_Vh->mesh()),_expr=vec(cst(1),cst(0),cst(0)));
            zoz.on(_range=elements(M_Vh->mesh()),_expr=vec(cst(0),cst(1),cst(0)));
            zzo.on(_range=elements(M_Vh->mesh()),_expr=vec(cst(0),cst(0),cst(1)));
            *M_ozz = ozz; M_ozz->close();
            *M_zoz = zoz; M_zoz->close();
            *M_zzo = zzo; M_zzo->close();

            prec->attachAuxiliaryVector("Px",M_ozz);
            prec->attachAuxiliaryVector("Py",M_zoz);
            prec->attachAuxiliaryVector("Pz",M_zzo);
        }
        else
        {
            LOG(INFO) << "[ AMS ] : using SetCoordinates \n";
            X.on(_range=elements(M_Vh->mesh()),_expr=Px());
            Y.on(_range=elements(M_Vh->mesh()),_expr=Py());
            Z.on(_range=elements(M_Vh->mesh()),_expr=Pz());
            *M_X = X; M_X->close();
            *M_Y = Y; M_Y->close();
            *M_Z = Z; M_Z->close();
            prec->attachAuxiliaryVector("X",M_X);
            prec->attachAuxiliaryVector("Y",M_Y);
            prec->attachAuxiliaryVector("Z",M_Z);
        }
    }
#else
    std::cerr << "ams preconditioner is not interfaced in two dimensions\n";
#endif
    toc( "[PreconditionerBlockMS] setup done ", FLAGS_v > 0 );
}
PfxBool pfxIntersectRayCapsule(const PfxRayInput &ray,PfxRayOutput &out,const PfxCapsule &capsule,const PfxTransform3 &transform)
{
	// レイをCapsuleのローカル座標へ変換
	PfxTransform3 transformCapsule = orthoInverse(transform);
	PfxVector3 startPosL = transformCapsule.getUpper3x3() * ray.m_startPosition + transformCapsule.getTranslation();
	PfxVector3 rayDirL = transformCapsule.getUpper3x3() * ray.m_direction;
	
	PfxFloat radSqr = capsule.m_radius * capsule.m_radius;

	// 始点がカプセルの内側にあるか判定
	{
		PfxFloat h = fabsf(startPosL[0]);
		if(h > capsule.m_halfLen) h = capsule.m_halfLen;
		PfxVector3 Px(out.m_variable,0,0);
		PfxFloat sqrLen = lengthSqr(startPosL-Px);
		if(sqrLen <= radSqr) return false;
	}

	// カプセルの胴体との交差判定
	do {
		PfxVector3 P(startPosL);
		PfxVector3 D(rayDirL);
		
		P[0] = 0.0f;
		D[0] = 0.0f;
		
		PfxFloat a = dot(D,D);
		PfxFloat b = dot(P,D);
		PfxFloat c = dot(P,P) - radSqr;
		
		PfxFloat d = b * b - a * c;
		
		if(d < 0.0f || fabs(a) < 0.00001f) return false;
		
		PfxFloat tt = ( -b - sqrtf(d) ) / a;
		
		if(tt < 0.0f)
			break;
		else if(tt > 1.0f)
			return false;
		
		if(tt < out.m_variable) {
			PfxVector3 cp = startPosL + tt * rayDirL;
			
			if(fabsf(cp[0]) <= capsule.m_halfLen) {
				out.m_contactFlag = true;
				out.m_variable = tt;
				out.m_contactPoint = PfxVector3(transform * PfxPoint3(cp));
				out.m_contactNormal = transform.getUpper3x3() * normalize(cp);
				out.m_subData.m_type = PfxSubData::NONE;
				return true;
			}
		}
	} while(0);
	
	// カプセルの両端にある球体との交差判定
	PfxFloat a = dot(rayDirL,rayDirL);
	if(fabs(a) < 0.00001f) return false;
	
	do {
		PfxVector3 center(capsule.m_halfLen,0.0f,0.0f);
		PfxVector3 v = startPosL - center;

		PfxFloat b = dot(v,rayDirL);
		PfxFloat c = dot(v,v) - radSqr;

		PfxFloat d = b * b - a * c;
		
		if(d < 0.0f) break;
		
		PfxFloat tt = ( -b - sqrtf(d) ) / a;
		
		if(tt < 0.0f || tt > 1.0f) break;
		
		if(tt < out.m_variable) {
			PfxVector3 cp = startPosL + tt * rayDirL;
			out.m_contactFlag = true;
			out.m_variable = tt;
			out.m_contactPoint = ray.m_startPosition + tt * ray.m_direction;
			out.m_contactNormal = transform.getUpper3x3() * normalize(cp-center);
			out.m_subData.m_type = PfxSubData::NONE;
			return true;
		}
	} while(0);
	
	{
		PfxVector3 center(-capsule.m_halfLen,0.0f,0.0f);
		PfxVector3 v = startPosL - center;

		PfxFloat b = dot(v,rayDirL);
		PfxFloat c = dot(v,v) - radSqr;

		PfxFloat d = b * b - a * c;
		
		if(d < 0.0f) return false;
		
		PfxFloat tt = ( -b - sqrtf(d) ) / a;
		
		if(tt < 0.0f || tt > 1.0f) return false;
		
		if(tt < out.m_variable) {
			PfxVector3 cp = startPosL + out.m_variable * rayDirL;
			out.m_contactFlag = true;
			out.m_variable = tt;
			out.m_contactPoint = ray.m_startPosition + tt * ray.m_direction;
			out.m_contactNormal = transform.getUpper3x3() * normalize(cp-center);
			out.m_subData.m_type = PfxSubData::NONE;
			return true;
		}
	}
	
	return false;
}
PfxBool pfxIntersectRayCylinder(const PfxRayInput &ray,PfxRayOutput &out,const PfxCylinder &cylinder,const PfxTransform3 &transform)
{
	// レイを円柱のローカル座標へ変換
	PfxTransform3 transformCapsule = orthoInverse(transform);
	PfxVector3 startPosL = transformCapsule.getUpper3x3() * ray.m_startPosition + transformCapsule.getTranslation();
	PfxVector3 rayDirL = transformCapsule.getUpper3x3() * ray.m_direction;
	
	PfxFloat radSqr = cylinder.m_radius * cylinder.m_radius;

	// 始点が円柱の内側にあるか判定
	{
		PfxFloat h = startPosL[0];
		if(-cylinder.m_halfLen <= h && h <= cylinder.m_halfLen) {
			PfxVector3 Px(h,0,0);
			PfxFloat sqrLen = lengthSqr(startPosL-Px);
			if(sqrLen <= radSqr) return false;
		}
	}

	// 円柱の胴体との交差判定
	do {
		PfxVector3 P(startPosL);
		PfxVector3 D(rayDirL);
		
		P[0] = 0.0f;
		D[0] = 0.0f;
		
		PfxFloat a = dot(D,D);
		PfxFloat b = dot(P,D);
		PfxFloat c = dot(P,P) - radSqr;
		
		PfxFloat d = b * b - a * c;
		
		if(d < 0.0f) return false; // レイは逸れている
		if(pfxAbsf(a) < 0.00001f) break; // レイがX軸に平行
		
		PfxFloat tt = ( -b - sqrtf(d) ) / a;
		
		if(tt < 0.0f || tt > 1.0f) break;
		
		if(tt < out.m_variable) {
			PfxVector3 cp = startPosL + tt * rayDirL;
			
			if(pfxAbsf(cp[0]) <= cylinder.m_halfLen) {
				out.m_contactFlag = true;
				out.m_variable = tt;
				out.m_contactPoint = PfxVector3(transform * PfxPoint3(cp));
				out.m_contactNormal = transform.getUpper3x3() * normalize(cp);
				out.m_subData.m_type = PfxSubData::NONE;
				return true;
			}
		}
	} while(0);
	
	// 円柱の両端にある平面との交差判定
	{
		if(pfxAbsf(rayDirL[0]) < 0.00001f) return false;
		
		PfxFloat t1 = ( cylinder.m_halfLen - startPosL[0] ) / rayDirL[0];
		PfxFloat t2 = ( - cylinder.m_halfLen - startPosL[0] ) / rayDirL[0];

		PfxFloat tt = SCE_PFX_MIN(t1,t2);
		
		if(tt < 0.0f || tt > 1.0f) return false;

		PfxVector3 p = startPosL + tt * rayDirL;
		p[0] = 0.0f;

		if(lengthSqr(p) < radSqr && tt < out.m_variable) {
			PfxVector3 cp = startPosL + tt * rayDirL;
			out.m_contactFlag = true;
			out.m_variable = tt;
			out.m_contactPoint = ray.m_startPosition + tt * ray.m_direction;
			out.m_contactNormal = transform.getUpper3x3() * ((cp[0]>0.0f)?PfxVector3(1.0,0.0,0.0):PfxVector3(-1.0,0.0,0.0));
			out.m_subData.m_type = PfxSubData::NONE;
			return true;
		}
	}
	
	return false;
}
    return about;

}




namespace Feel
{
using namespace vf;
template<int Dim>struct ExactSolution {};
template<>
struct ExactSolution<1>
{
    typedef __typeof__( sin( M_PI*Px() ) ) type;
    typedef __typeof__( M_PI*M_PI*sin( M_PI*Px() ) ) laplacian_type;
};

template<>
struct ExactSolution<2>
{
    typedef __typeof__( sin( M_PI*Px() )*cos( M_PI*Py() ) ) type;
    typedef __typeof__( 2*M_PI*M_PI*sin( M_PI*Px() )*cos( M_PI*Py() ) ) laplacian_type;
};

template<>
struct ExactSolution<3>
{
    typedef __typeof__( sin( M_PI*Px() )*cos( M_PI*Py() )*cos( M_PI*Pz() ) ) type;
    typedef __typeof__( 3*M_PI*M_PI*sin( M_PI*Px() )*cos( M_PI*Py() )*cos( M_PI*Pz() ) ) laplacian_type;
};