本文整理汇总了C++中Domain函数的典型用法代码示例。如果您正苦于以下问题:C++ Domain函数的具体用法?C++ Domain怎么用?C++ Domain使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Domain函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetDomain
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: ClearEvalCacheHelper
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: Domain
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: Domain
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;
}
示例5: EntityPath
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;
}
示例6: Extents
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;
}
示例7: from_int
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);
}
}
示例8: while
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;
}
示例9: IsAtSeam
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;
}
示例10: GetUserGroups
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);
}
示例11: Domain
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;
}
示例12: Domain
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_
);
}
示例13: main
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;
}
示例14: Domain
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_
);
}
示例15: Domain
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;
}