コード例 #1
0
ファイル: opennurbs_arccurve.cpp プロジェクト: Bardo91/pcl
bool ON_ArcCurve::Extend(
  const ON_Interval& domain
  )

{
  if (IsClosed()) return false;

  double s0, s1;
  bool changed = false;
  GetDomain(&s0, &s1);
  if (domain[0] < s0){
    s0 = domain[0];
    changed = true;
  }
  if (domain[1] > s1){
    s1 = domain[1];
    changed = true;
  }
  if (!changed) return false;

  double a0 = m_arc.Domain().ParameterAt(Domain().NormalizedParameterAt(s0));
  double a1 = m_arc.Domain().ParameterAt(Domain().NormalizedParameterAt(s1));
  if (a1 > a0+2.0*ON_PI) {
    a1 = a0+2.0*ON_PI;
    s1 = Domain().ParameterAt(m_arc.Domain().NormalizedParameterAt(a1));
  }
  m_arc.Trim(ON_Interval(a0, a1));
  SetDomain(s0, s1);
  return true;
}
コード例 #2
0
ON_BOOL32 ON_PolyEdgeSegment::Trim( const ON_Interval& domain )
{
  ClearEvalCacheHelper();
  ON_Interval old_domain = Domain();
  ON_BOOL32 rc = ON_CurveProxy::Trim(domain);
  if ( rc && m_edge )
  {
    ON_Interval new_domain = Domain();
    if ( old_domain != new_domain )
    {
      ON_Interval old_edge_domain = m_edge_domain;
      if ( old_domain == m_edge_domain && !ReversedEdgeDir() )
      {
        m_edge_domain = new_domain;
      }
      else
      {
        double s0 = old_domain.NormalizedParameterAt(new_domain[0]);
        double s1 = old_domain.NormalizedParameterAt(new_domain[1]);
        if ( ReversedEdgeDir() )
        {
          double x = 1.0-s0;
          s0 = 1.0-s1;
          s1 = x;
        }
        double r0 = m_edge_domain.ParameterAt(s0);
        double r1 = m_edge_domain.ParameterAt(s1);
        m_edge_domain.Set(r0,r1);
      }
      if ( old_edge_domain != m_edge_domain )
        SetTrimDomainFromEdgeDomain();
    }
  }
  return rc;
}
コード例 #3
0
ファイル: opennurbs_planesurface.cpp プロジェクト: 2php/pcl
ON_BOOL32 ON_PlaneSurface::Trim(
       int dir,
       const ON_Interval& domain
       )
{
  if ( dir < 0 || dir > 1 )
    return false;
  ON_Interval current_domain = Domain(dir);
  if ( current_domain[0] == ON_UNSET_VALUE && current_domain[1] == ON_UNSET_VALUE )
    current_domain = domain;
  ON_Interval trim_domain, trim_extents = m_extents[dir];
  trim_domain.Intersection(domain, Domain(dir) );
  if ( !trim_domain.IsIncreasing() )
    return false;
  if ( m_domain[dir] == m_extents[dir] )
    trim_extents = trim_domain;
  else
  {
    double x0 = m_extents[dir].ParameterAt( m_domain[dir].NormalizedParameterAt( trim_domain[0] ) );
    double x1 = m_extents[dir].ParameterAt( m_domain[dir].NormalizedParameterAt( trim_domain[1] ) );
    trim_extents.Set(x0,x1);
  }
  if ( !trim_extents.IsIncreasing() )
    return false;
  m_extents[dir] = trim_extents;
  m_domain[dir] = trim_domain;
  return true;
}
コード例 #4
0
ファイル: opennurbs_planesurface.cpp プロジェクト: 2php/pcl
bool ON_PlaneSurface::Extend(
      int dir,
      const ON_Interval& domain
      )
{
  if ( dir < 0 || dir > 1 ) return false;
  bool changed = false;
  ON_Interval tdom = Domain(dir);
  ON_Interval xdom = m_extents[dir];

  if (domain[0] < Domain(dir)[0]){
    changed = true;
    tdom[0] = domain[0];
    xdom[0] = m_extents[dir].ParameterAt( m_domain[dir].NormalizedParameterAt(domain[0]));
  }
  if (domain[1] > Domain(dir)[1]){
    changed = true;
    tdom[1] = domain[1];
    xdom[1] = m_extents[dir].ParameterAt( m_domain[dir].NormalizedParameterAt(domain[1]));
  }
  if (!changed) return false;
  DestroySurfaceTree();

  m_domain[dir] = tdom;
  m_extents[dir] = xdom;
  return true;
}
コード例 #5
0
ファイル: opennurbs_arccurve.cpp プロジェクト: Bardo91/pcl
ON_BOOL32 ON_ArcCurve::SetEndPoint(ON_3dPoint end_point)
{
  if (IsCircle())
    return false;
  ON_BOOL32 rc = false;
  if ( m_dim == 3 || end_point.z == 0.0 )
  {
    ON_3dPoint P;
    ON_3dVector T;
    double t = Domain()[0];
    Ev1Der( t, P, T );
    ON_Arc a;
    rc = a.Create( P, T, end_point );
    if ( rc )
    {
      m_arc = a;
    }
    else {
      ON_3dPoint start_point = PointAt(Domain()[0]);
      if (end_point.DistanceTo(start_point) < ON_ZERO_TOLERANCE*m_arc.Radius()){
        //make arc into circle
        m_arc.plane.xaxis = start_point - m_arc.Center();
        m_arc.plane.xaxis.Unitize();
        m_arc.plane.yaxis = ON_CrossProduct(m_arc.Normal(), m_arc.plane.xaxis);
        m_arc.plane.yaxis.Unitize();
        m_arc.SetAngleRadians(2.0*ON_PI);
        rc = true;
      }
    }
  }
  return rc;  
}
コード例 #6
0
ファイル: ipmi_resource.cpp プロジェクト: openhpi1/testrepo
bool
cIpmiResource::Populate()
{
  if ( m_populate == false )
     {
       // create rpt entry
       stdlog << "populate resource: " << EntityPath() << ".\n";

       struct oh_event *e = (struct oh_event *)g_malloc0( sizeof( struct oh_event ) );

       if ( !e )
          {
            stdlog << "out of space !\n";
            return false;
          }

       memset( e, 0, sizeof( struct oh_event ) );
       e->type = OH_ET_RESOURCE;

       if ( Create( e->u.res_event.entry ) == false )
          {
            g_free( e );
            return false;
          }

       // assign the hpi resource id to ent, so we can find
       // the resource for a given entity
       m_resource_id = e->u.res_event.entry.ResourceId;

       // add the resource to the resource cache
       int rv = oh_add_resource( Domain()->GetHandler()->rptcache,
                                 &(e->u.res_event.entry), this, 1 );

       if ( rv != 0 )
       {
            stdlog << "Can't add resource to plugin cache !\n";
            g_free( e );
            return false;
       }

       stdlog << "cIpmiResource::Populate OH_ET_RESOURCE Event resource " << m_resource_id << "\n";
       Domain()->AddHpiEvent( e );
  
       if ( m_sel )
            PopulateSel();

       m_populate = true;
     }

  for( int i = 0; i < NumRdr(); i++ )
     {
       cIpmiRdr *rdr = GetRdr( i );

       if ( rdr->Populate() == false )
	    return false;
     }

  return true;
}
コード例 #7
0
ファイル: opennurbs_planesurface.cpp プロジェクト: 2php/pcl
ON_BOOL32 ON_PlaneSurface::Split(
       int dir,
       double c,
       ON_Surface*& west_or_south_side,
       ON_Surface*& east_or_north_side
       ) const
{
  ON_PlaneSurface* ws_side = 0;
  ON_PlaneSurface* en_side = 0;

  if ( dir < 0 || dir > 1 )
    return false;
  if ( !Domain(dir).Includes(c,true) )
    return false;

  double t;
  if ( Domain(dir) == Extents(dir) )
    t = c;
  else
  {
    t = Extents(dir).ParameterAt( Domain(dir).NormalizedParameterAt(c) );
    if ( !Extents(dir).Includes(t,true) )
      return false;
  }

  if ( west_or_south_side )
  {
    if ( west_or_south_side == east_or_north_side )
      return false;
    ws_side = ON_PlaneSurface::Cast(west_or_south_side);
    if ( !ws_side )
      return false;
  }

  if ( east_or_north_side )
  {
    en_side = ON_PlaneSurface::Cast(east_or_north_side);
    if ( !en_side )
      return false;
  }

  if ( !ws_side )
    ws_side = new ON_PlaneSurface();
  if ( !en_side )
    en_side = new ON_PlaneSurface();

  *ws_side = *this;
  *en_side = *this;
  ws_side->m_domain[dir].m_t[1] = c;
  en_side->m_domain[dir].m_t[0] = c;
  ws_side->m_extents[dir].m_t[1] = t;
  en_side->m_extents[dir].m_t[0] = t;

  west_or_south_side = ws_side;
  east_or_north_side = en_side;

  return true;
}
コード例 #8
0
ファイル: SignDomain.cpp プロジェクト: JoelMarcey/redex
Domain from_int(int64_t v) {
  if (v == 0) {
    return Domain(Interval::EQZ);
  } else if (v > 0) {
    return Domain(Interval::GTZ);
  } else /* v < 0 */ {
    return Domain(Interval::LTZ);
  }
}
コード例 #9
0
Domain DomainDialog::retrieveDomain() const
{
	if(!ui->buttonBox->button(QDialogButtonBox::Ok)->isEnabled())
		return Domain();
	else
		return Domain(ui->nameEdit->text(),
					  ui->displayNameEdit->text(),
					  ui->iconButton->toolTip(),
					  ui->descriptionPlainTextEdit->document()->toPlainText(),
					  ui->confidentialitySlider->value(),
					  ui->reliabilitySlider->value());
}
コード例 #10
0
ファイル: ipmi_resource.cpp プロジェクト: openhpi1/testrepo
bool
cIpmiResource::Destroy()
{
  SaHpiRptEntryT *rptentry;
  stdlog << "removing resource: " << m_entity_path << ").\n";

  // remove sensors
  while( Num() )
     {
       cIpmiRdr *rdr = GetRdr( 0 );
       RemRdr( rdr );
       delete rdr;
     }

  // create remove event
  oh_event *e = (oh_event *)g_malloc0( sizeof( oh_event ) );

  if ( !e )
     {
       stdlog << "out of space !\n";
       return false;
     }

  memset( e, 0, sizeof( struct oh_event ) );
  e->type = OH_ET_RESOURCE_DEL;
  rptentry = oh_get_resource_by_id( Domain()->GetHandler()->rptcache, m_resource_id );
  if ( !rptentry )
  {
      stdlog << "Can't find resource in plugin cache !\n";
      g_free( e );
      return false;
  }

  e->u.res_event.entry = *rptentry;
  stdlog << "cIpmiResource::Destroy OH_ET_RESOURCE_DEL Event resource " << m_resource_id << "\n";
  Domain()->AddHpiEvent( e );

  // remove resource from local cache
  int rv = oh_remove_resource( Domain()->GetHandler()->rptcache, m_resource_id );

  if ( rv != 0 )
  {
      stdlog << "Can't remove resource from plugin cache !\n";
      return false;
  }

  m_mc->RemResource( this );

  delete this;

  return true;
}
コード例 #11
0
ファイル: opennurbs_planesurface.cpp プロジェクト: 2php/pcl
bool ON_PlaneSurface::GetClosestPoint( const ON_3dPoint& test_point,
        double* s,double* t,  // parameters of local closest point returned here
        double maximum_distance,
        const ON_Interval* sdomain, // first parameter sub_domain
        const ON_Interval* tdomain  // second parameter sub_domain
        ) const
{
  double u = 0.0, v=0.0;

	ON_Interval sdom = Domain(0);
	ON_Interval tdom = Domain(1);
	if(sdomain==NULL)
		sdomain = &sdom;
	if(tdomain==NULL)
		tdomain = &tdom;

  bool rc = m_plane.ClosestPointTo( test_point, &u, &v );
  if ( rc ) 
  {
    // convert m_plane coordinates to ON_Surface coordinates
    if ( m_domain[0] != m_extents[0] )
    {
      u = m_domain[0].ParameterAt( m_extents[0].NormalizedParameterAt(u) );
    }
    if ( m_domain[1] != m_extents[1] )
    {
      v = m_domain[1].ParameterAt( m_extents[1].NormalizedParameterAt(v) );
    }

    if ( u < sdomain->Min() )
      u = sdomain->Min();
    else if ( u > sdomain->Max() )
      u = sdomain->Max();

    if ( v < tdomain->Min() )
      v = tdomain->Min();
    else if ( v > tdomain->Max() )
      v = tdomain->Max();

    if ( s )
      *s = u;
    if ( t )
      *t = v;
    if (maximum_distance > 0.0) 
    {
      ON_3dPoint pt = PointAt(u,v);
      if ( test_point.DistanceTo(pt) > maximum_distance )
        rc = false;
    }
  }
  return rc;
}
コード例 #12
0
ファイル: opennurbs_surface.cpp プロジェクト: Bastl34/PCL
int ON_Surface::IsAtSeam(double s, double t) const

{
  int rc = 0;
  int i;
  for (i=0; i<2; i++){
    if (!IsClosed(i))
      continue;
    double p = (i) ? t : s;
    if (p == Domain(i)[0] || p == Domain(i)[1])
      rc += (i+1);
  }

  return rc;
}
コード例 #13
0
    virtual void GetUserGroups(const std::wstring& sDomainName, const std::wstring& name, OBJ_LIST& groups)
	{
		CNetDomain Domain(sDomainName.c_str());
		CNetUsers Users(Domain);

		Users.GetUserGroups(name.c_str(), groups);
	}
コード例 #14
0
ファイル: opennurbs_planesurface.cpp プロジェクト: 2php/pcl
ON_BOOL32 ON_PlaneSurface::GetSpanVector( int dir, double* s ) const
{
  ON_Interval d = Domain(dir);
  s[0] = d.Min();
  s[1] = d.Max();
  return d.IsIncreasing();
}
コード例 #15
0
ファイル: jacobian.hpp プロジェクト: iagomosqueira/FLasher
Vector ADFun<Base>::Jacobian(const Vector &x)
{	size_t i;
	size_t n = Domain();
	size_t m = Range();

	CPPAD_ASSERT_KNOWN(
		size_t(x.size()) == n,
		"Jacobian: length of x not equal domain dimension for F"
	);

	// point at which we are evaluating the Jacobian
	Forward(0, x);

	// work factor for forward mode
	size_t workForward = n;

	// work factor for reverse mode
	size_t workReverse = 0;
	for(i = 0; i < m; i++)
	{	if( ! Parameter(i) )
			++workReverse;
	}

	// choose the method with the least work
	Vector jac( n * m );
	if( workForward <= workReverse )
		JacobianFor(*this, x, jac);
	else	JacobianRev(*this, x, jac);

	return jac;
}
コード例 #16
0
ファイル: rev_sparse_hes.hpp プロジェクト: GodinA/adcomp
void ADFun<Base>::RevSparseHesCase(
	const std::set<size_t>&   set_type         ,
	bool                      transpose        ,  
	size_t                    q                ,  
	const VectorSet&          s                ,
	VectorSet&                h                )
{	size_t n = Domain();
	if( transpose )
		h.resize(n);
	else	h.resize(q);

	CPPAD_ASSERT_KNOWN( 
		for_jac_sparse_set_.n_set() > 0,
		"RevSparseHes: previous stored call to ForSparseJac did not "
		"use std::set<size_t> for the elements of r."
	);
	CPPAD_ASSERT_UNKNOWN( for_jac_sparse_pack_.n_set() == 0 );
	CPPAD_ASSERT_UNKNOWN( for_jac_sparse_set_.n_set() == num_var_tape_  );
	
	// use sparse_pack for the calculation
	CppAD::RevSparseHesSet( 
		transpose                ,
		q                        ,
		s                        ,
		h                        ,
		num_var_tape_            ,
		dep_taddr_               ,
		ind_taddr_               ,
		play_                    ,
		for_jac_sparse_set_ 
	);
}
コード例 #17
0
ファイル: main.cpp プロジェクト: nivarti/cmtp
int main(){  
  
  int MeshX = 200, MeshY = 80;                                      // Set Initial Mesh Size
  clock_t ti, tf, RunTime;			                   // Set clock variables
  
  setprecision(15);
  setw(15);   
  
  while(MeshX <= 200){
    ti = clock();			                                   // Start clock
   
    Grid Domain(MeshX, MeshY, 1);          	                   // Define Grid of required size  
    
    cout<<"\nEvaluating solution for Mesh Size: "<<MeshX<<" by "<<MeshY; 
    
    //EvaluateGridParameters(Domain);				   // Set Grid Values for problem 1, 2
    SolveEnergyEquation(Domain);         			   // Solve energy equation for problem 5            
    
    MeshX *= 2;							   // Double mesh size
    MeshY *= 2;
    
    tf = clock();
    RunTime = (double)(tf - ti)/CLOCKS_PER_SEC*1000;                      // Calculate Run Time in Seconds 
    
    cout<<"\nSolver Run-Time: "<<RunTime<<" ms\n";     
    
  }
  
  //CalculateErrorBound();
  //CalculateOrder();
  
  return 0;
}
コード例 #18
0
ファイル: rev_sparse_jac.hpp プロジェクト: CSCsw/CppAD
void ADFun<Base>::RevSparseJacCase(
	const std::set<size_t>&      set_type          ,
	bool                         transpose         ,
	bool                         dependency        ,
	size_t                       q                 ,
	const VectorSet&             r                 ,
	VectorSet&                   s                 )
{	// dimension of the result vector
	if( transpose )
		s.resize( Domain() );
	else	s.resize( q );

	// store results in r
	RevSparseJacSet(
		transpose      ,
		dependency     ,
		q              ,
		r              ,
		s              ,
		num_var_tape_  ,
		dep_taddr_     ,
		ind_taddr_     ,
		play_
	);
}
コード例 #19
0
ファイル: rev_one.hpp プロジェクト: cran/RMC
Vector ADFun<Base>::RevOne(const Vector  &x, size_t i)
{	size_t i1;

	size_t n = Domain();
	size_t m = Range();

	// check Vector is Simple Vector class with Base type elements
	CheckSimpleVector<Base, Vector>();

	CppADUsageError(
		x.size() == n,
		"RevOne: Length of x not equal domain dimension for f"
	); 
	CppADUsageError(
		i < m,
		"RevOne: the index i is not less than range dimension for f"
	);

	// point at which we are evaluating the derivative
	Forward(0, x);

	// component which are are taking the derivative of
	Vector w(m);
	for(i1 = 0; i1 < m; i1++)
		w[i1] = 0.;
	w[i] = Base(1);

	// dimension the return value
	Vector dw(n);

	// compute the return value
	dw = Reverse(1, w);

	return dw;
}
コード例 #20
0
ファイル: NDScalars.hpp プロジェクト: ALaDyn/picongpu
    void operator()(ThreadParams& params,
                const std::string& name, T_Scalar* value,
                const std::string& attrName = "", T_Attribute* attribute = nullptr)
    {
        log<picLog::INPUT_OUTPUT>("HDF5: read %1%D scalars: %2%") % simDim % name;

        Dimensions domain_offset(0, 0, 0);
        for (uint32_t d = 0; d < simDim; ++d)
            domain_offset[d] = Environment<simDim>::get().GridController().getPosition()[d];

        // avoid deadlock between not finished pmacc tasks and mpi calls in adios
        __getTransactionEvent().waitForFinished();

        DomainCollector::DomDataClass data_class;
        DataContainer *dataContainer =
            params.dataCollector->readDomain(params.currentStep,
                                               name.c_str(),
                                               Domain(domain_offset, Dimensions(1, 1, 1)),
                                               &data_class);

        typename traits::PICToSplash<T_Scalar>::type splashType;
        *value = *static_cast<T_Scalar*>(dataContainer->getIndex(0)->getData());
        __delete(dataContainer);

        if(!attrName.empty())
        {
            log<picLog::INPUT_OUTPUT>("HDF5: read attribute %1% for scalars: %2%") % attrName % name;
            params.dataCollector->readAttributeInfo(params.currentStep, name.c_str(), attrName.c_str()).read(attribute, sizeof(T_Attribute));
            log<picLog::INPUT_OUTPUT>("HDF5: attribute %1% = %2%") % attrName % *attribute;
        }
    }
コード例 #21
0
void ADFun<Base>::RevSparseHesCase(
	bool              set_type         ,
	bool              transpose        ,  
	size_t            q                ,  
	const VectorSet&  s                ,
	VectorSet&        h                )
{	size_t n = Domain(); 	
	h.resize(q * n );

	CPPAD_ASSERT_KNOWN( 
		for_jac_sparse_pack_.n_set() > 0,
		"RevSparseHes: previous stored call to ForSparseJac did not "
		"use bool for the elements of r."
	);
	CPPAD_ASSERT_UNKNOWN( for_jac_sparse_set_.n_set() == 0 );
	CPPAD_ASSERT_UNKNOWN( for_jac_sparse_pack_.n_set() == total_num_var_ );
	
	// use sparse_pack for the calculation
	CppAD::RevSparseHesBool( 
		transpose                ,
		q                        ,
		s                        ,
		h                        ,
		total_num_var_           ,
		dep_taddr_               ,
		ind_taddr_               ,
		play_                    ,
		for_jac_sparse_pack_ 
	);
}
コード例 #22
0
void FXmppPresenceJingle::OnSignalPresenceUpdate(const buzz::PresenceStatus& InStatus)
{	
	// ignore muc presence
	FString Domain(UTF8_TO_TCHAR(InStatus.jid().domain().c_str()));
	if (!Domain.Equals(Connection.GetMucDomain(), ESearchCase::IgnoreCase))
	{
		FXmppUserJid UserJid;
		FXmppJingle::ConvertToJid(UserJid, InStatus.jid());
		// Don't keep presence entries missing a resource, this comes in when a new friend is added but will never get updated when user logs off
		if (UserJid.IsValid() && !UserJid.Resource.IsEmpty())
		{
			FScopeLock Lock(&RosterLock);
		
			FXmppUserPresenceJingle& RosterEntry = RosterPresence.FindOrAdd(UserJid.GetFullPath());
			ConvertToPresence(*RosterEntry.Presence, InStatus, UserJid);
			FXmppJingle::ConvertToJid(RosterEntry.UserJid, InStatus.jid());

			UE_LOG(LogXmpp, Verbose, TEXT("Received presence for user [%s]"), *UserJid.GetFullPath());
			DebugPrintPresence(*RosterEntry.Presence);

			RosterUpdates.Enqueue(UserJid.GetFullPath());
		}
		else if (UserJid.IsValid() && UserJid.Resource.IsEmpty())
		{
			UE_LOG(LogXmpp, Warning, TEXT("Ignoring presence update with empty resource. StatusJid = %s, JidFullPath = %s"), UTF8_TO_TCHAR(InStatus.jid().Str().c_str()), *UserJid.GetFullPath());
		}
	}
}
コード例 #23
0
/** 
 * HPI function saHpiWatchdogTimerReset
 * 
 * See also the description of the function inside the specification or header file.
 * Starting or resetting a watchdog timer if it is allowed
 * 
 * @return HPI return code
 **/
SaErrorT NewSimulatorWatchdog::ResetWatchdog() {

   if ( m_start.IsSet() ) {
      cTime now( cTime::Now() );
      now -= m_start;
      
      if ( now.GetMsec() > m_wdt_data.InitialCount - m_wdt_data.PreTimeoutInterval ) {
         
         stdlog << "DBG: ResetWatchdog not allowed: num " << m_wdt_rec.WatchdogNum << ":\n";
         stdlog << "DBG: Time expire in ms: " << now.GetMsec() << " > " 
                << (m_wdt_data.InitialCount - m_wdt_data.PreTimeoutInterval) << "\n";

         return SA_ERR_HPI_INVALID_REQUEST;
      }
      
      // Reset the Timer
      Reset( m_wdt_data.InitialCount - m_wdt_data.PreTimeoutInterval );
      m_start = cTime::Now();

   } else {
   	
      m_start = cTime::Now();
      // Reset the Timer
      Reset( m_wdt_data.InitialCount - m_wdt_data.PreTimeoutInterval );
      if (!m_running)
         Start();

   }

   m_wdt_data.Running = SAHPI_TRUE;  
   Domain()->SetRunningWdt( true );
   stdlog << "DBG: ResetWatchdog successfully: num " << m_wdt_rec.WatchdogNum << "\n";
   
   return SA_OK;
}
コード例 #24
0
double ON_PolyEdgeSegment::EdgeParameter(double t) const
{
  double edge_t = ON_UNSET_VALUE;
  if ( m_edge )
  {
    if ( m_t == t && m_edge_t != ON_UNSET_VALUE )
      edge_t = m_edge_t;
    else
    {
      ON_PolyEdgeSegment* p = const_cast<ON_PolyEdgeSegment*>(this);
      if ( t != m_t )
      {
        p->m_t = t;
        p->m_trim_t = ON_UNSET_VALUE;
        p->m_srf_uv[0] = ON_UNSET_VALUE;
        p->m_srf_uv[1] = ON_UNSET_VALUE;
      }
      ON_Interval d = Domain();
      bool bReversedEdgeDir = ReversedEdgeDir();
      if ( bReversedEdgeDir || m_edge_domain != d )
      {
        double s = d.NormalizedParameterAt(t);
        if ( bReversedEdgeDir )
          s = 1.0 - s;
        edge_t = m_edge_domain.ParameterAt(s);
      }
      else
        edge_t = t;
      p->m_edge_t = edge_t;
    }
  }
  return edge_t;
}
コード例 #25
0
    virtual void GetUserInfo(const std::wstring& sDomainName, const std::wstring& name, UserInfo& info)
	{
		CNetDomain Domain(sDomainName.c_str());
		CNetUsers Users(Domain);

		CNetUserInfo ui;
		Users.GetUserInfo(name.c_str(), &ui);

		info.domain = sDomainName;
		info.name = name;
		
		switch(ui.priv) {
			case USER_PRIV_GUEST:
				info.pLevel = PL_GUEST;
			break;
			case USER_PRIV_ADMIN:
				info.pLevel = PL_ADMINISTRATOR;
			break;
			case USER_PRIV_USER:
				info.pLevel = PL_USER;
			break;
			default:
				info.pLevel = PL_GUEST;
		}

		info.lastLogon = ui.last_logon;
		info.lastLogoff = ui.last_logoff;
	}
コード例 #26
0
ファイル: rev_sparse_jac.hpp プロジェクト: CSCsw/CppAD
void ADFun<Base>::RevSparseJacCase(
	bool                set_type          ,
	bool                transpose         ,
	bool                dependency        ,
	size_t              q                 ,
	const VectorSet&    r                 ,
	VectorSet&          s                 )
{	size_t n = Domain();

	// dimension of the result vector
	s.resize( q * n );

	// store results in s
	RevSparseJacBool(
		transpose      ,
		dependency     ,
		q              ,
		r              ,
		s              ,
		num_var_tape_  ,
		dep_taddr_     ,
		ind_taddr_     ,
		play_
	);
}
コード例 #27
0
DomainSet consensusDomains(WeightedDomainEnsemble& dEnsemble) {
    using PersistenceMap = map<Domain, double>;
    PersistenceMap pmap;

    for (auto dSetIdx : boost::irange(size_t{0}, dEnsemble.domainSets.size())) {
        auto& dSet = dEnsemble.domainSets[dSetIdx];
        auto weight = dEnsemble.weights[dSetIdx];
        for (auto& domain : dSet) {
            if ( pmap.find(domain) == pmap.end() ) pmap[domain] = 0;
            pmap[domain] += weight;
        }
    }

    Intervals ivals;

    for (auto domainPersistence : pmap) {
        auto domain = domainPersistence.first;
        auto persistence = domainPersistence.second;
        ivals.push_back(WeightedInterval(domain.start, domain.end, persistence));      
    }

    IntervalScheduler scheduler(ivals);
    scheduler.computeSchedule();

    DomainSet dSet;
    for (auto ival : scheduler.extractIntervals()) {
        dSet.push_back(Domain(ival.start, ival.end));
    }

    sort(dSet.begin(), dSet.end());

    return dSet;
}
コード例 #28
0
ファイル: opennurbs_surface.cpp プロジェクト: Bastl34/PCL
ON_BOOL32 ON_Surface::GetDomain( int dir, double* t0, double* t1 ) const
{
  ON_Interval d = Domain(dir);
  if ( t0 ) *t0 = d[0];
  if ( t1 ) *t1 = d[1];
  return d.IsIncreasing();
}
コード例 #29
0
ファイル: ParallelPlane.cpp プロジェクト: Jerdak/MassHeatMap
bool ParallelPlane::InFilter(const int& row){
    return InFilterNew(row);
    if(filter_radius_ < 0)return true;  //hacky way to avoid having another flag

    osg::Vec3f tmp = Domain(row) - filter_position_;
    return tmp.length() <= filter_radius_;
}
コード例 #30
0
ファイル: for_one.hpp プロジェクト: iagomosqueira/FLasher
Vector ADFun<Base>::ForOne(const Vector &x, size_t j)
{	size_t j1;

	size_t n = Domain();
	size_t m = Range();

	// check Vector is Simple Vector class with Base type elements
	CheckSimpleVector<Base, Vector>();

	CPPAD_ASSERT_KNOWN(
		x.size() == n,
		"ForOne: Length of x not equal domain dimension for f"
	);
	CPPAD_ASSERT_KNOWN(
		j < n,
		"ForOne: the index j is not less than domain dimension for f"
	);

	// point at which we are evaluating the second partials
	Forward(0, x);

	// direction in which are are taking the derivative
	Vector dx(n);
	for(j1 = 0; j1 < n; j1++)
		dx[j1] = Base(0);
	dx[j] = Base(1);

	// dimension the return value
	Vector dy(m);

	// compute the return value
	dy = Forward(1, dx);

	return dy;
}