Esempio n. 1
0
void node_t::do_calc_domain( const render::render_context_t& context)
{
    if( num_inputs() != 0)
    {
        if( input())
        {
	    set_domain( input()->domain());
	    return;
        }
    }

    // as a fallback set the domain to the default
    set_domain( Imath::Box2i( Imath::V2i( 0, 0), Imath::V2i( context.default_format.area().max.x - 1, context.default_format.area().max.y - 1)));
}
Esempio n. 2
0
/* 
 * This calls set_domain to set the default domain being monitored
 */
static int
set_default_domain( EventSetInfo_t * zero, int domain )
{
	hwd_control_state_t *current_state =
		( hwd_control_state_t * ) zero->machdep;
	return ( set_domain( current_state, domain ) );
}
Esempio n. 3
0
void node_t::calc_domain( const render::render_context_t& context)
{
    is_valid_ = is_valid();

    if( is_valid_ && !ignored())
    {
	do_calc_domain( context);
	return;
    }

    if( ignored() && ( num_inputs() != 0) && input())
    {
	set_domain( input()->domain());
	return;
    }

    set_domain( Imath::Box2i( Imath::V2i( 0, 0), Imath::V2i( context.default_format.area().max.x - 1, context.default_format.area().max.y - 1)));
}
Esempio n. 4
0
void crop_node_t::do_calc_domain( const render::render_context_t& context)
{
    Imath::Box2i box( input()->domain());
    int crop_t = get_absolute_value<float>( param( "top"));
    int crop_l = get_absolute_value<float>( param( "left"));
    int crop_b = get_absolute_value<float>( param( "bottom"));
    int crop_r = get_absolute_value<float>( param( "right"));
    set_domain( Imath::Box2i( Imath::V2i( box.min.x + crop_l, box.min.y + crop_t), Imath::V2i( box.max.x - crop_r, box.max.y - crop_b)));
}
Esempio n. 5
0
/*called when an EventSet is allocated */
int
_papi_hwd_init_control_state( hwd_control_state_t * ptr )
{
	int i = 0;
	for ( i = 0; i < _papi_hwi_system_info.sub_info.num_cntrs; i++ ) {
		ptr->control.cpu_control.pmc_map[i] = i;
	}
	ptr->control.cpu_control.tsc_on = 1;
	set_domain( ptr, _papi_hwi_system_info.sub_info.default_domain );
	return ( PAPI_OK );
}
Esempio n. 6
0
void glpk_wrapper::init_problem() {
    // use minimzation by default
    glp_set_obj_dir(lp, GLP_MIN);
    // create as many col as dimension in b
    glp_add_cols(lp, domain.size());
    // name the variables (helps debugging)
    if (DREAL_LOG_INFO_IS_ON) {
        for (unsigned int i = 0; i < domain.size(); i++) {
            glp_set_col_name(lp, i+1, domain.get_name(i).c_str());
        }
    }
    //
    set_domain(domain);
}
Esempio n. 7
0
Cookie::Cookie(const std::string& name, const std::string& value, const std::vector<std::string>& options)
  : Cookie{name, value}
{
  // Check that the vector has an even number of elements (key, value)
  if(options.size() % 2 not_eq 0)
    throw CookieException{"Invalid number of elements in cookie's options vector!"};

  // for-loop on vector - set input values from vector:
  for(size_t i = 0; i < options.size(); i += 2) {
    std::string nm = options[i];

    if(not valid_option_name(nm))
      throw CookieException{"Invalid name (" + nm + ") of cookie option!"};

    std::string val = options[i+1];

    if(caseInsCompare(nm, C_EXPIRES)) {
      set_expires(val);
    } else if(caseInsCompare(nm, C_MAX_AGE)) {
      try {
        int age = std::stoi(val);

        if(age < 0)
          throw CookieException{"Invalid max-age attribute (" + val + ") of cookie! Negative number of seconds not allowed."};

        set_max_age(age);
      } catch(std::exception& e){
        throw CookieException{"Invalid max-age attribute (" + val + ") of cookie! Invalid integer value."};
      }
    } else if(caseInsCompare(nm, C_DOMAIN)) {
      set_domain(val);
    } else if(caseInsCompare(nm, C_PATH)) {
      set_path(val);
    } else if(caseInsCompare(nm, C_SECURE)) {
      bool s = (caseInsCompare(val, "true")) ? true : false;
      set_secure(s);
    } else if(caseInsCompare(nm, C_HTTP_ONLY)) {
      bool s = (caseInsCompare(val, "true")) ? true : false;
      set_http_only(s);
    }
  }
}
Esempio n. 8
0
//int _papi_hwd_ctl(EventSetInfo_t *zero, int code, _papi_int_option_t *option)
int _papi_hwd_ctl(hwd_context_t *context, int code, _papi_int_option_t *option)
{
  switch (code)
    {
    case PAPI_SET_DEFDOM:
//      return(set_default_domain(zero, option->domain.domain));
    case PAPI_SET_DOMAIN:
      return(set_domain(&option->domain.ESI->machdep, option->domain.domain));
    case PAPI_SET_DEFGRN:
//      return(set_default_granularity(zero, option->granularity.granularity));
    case PAPI_SET_GRANUL:
      return(set_granularity(&option->granularity.ESI->machdep, option->granularity.granularity));
#if 0
    case PAPI_SET_INHERIT:
      return(set_inherit(option->inherit.inherit));
#endif
    default:
      return(PAPI_EINVAL);
    }
}
Esempio n. 9
0
/* This function sets various options in the substrate
 * The valid codes being passed in are PAPI_SET_DEFDOM,
 * PAPI_SET_DOMAIN, PAPI_SETDEFGRN, PAPI_SET_GRANUL
 * and PAPI_SET_INHERIT
 */
int
_papi_hwd_ctl( EventSetInfo_t * zero, int code, _papi_int_option_t * option )
{
	switch ( code ) {
	case PAPI_SET_DEFDOM:
		return ( set_default_domain( zero, option->domain.domain ) );
	case PAPI_SET_DOMAIN:
		return ( set_domain
				 ( option->domain.ESI->machdep, option->domain.domain ) );
	case PAPI_SET_DEFGRN:
		return ( set_default_granularity
				 ( zero, option->granularity.granularity ) );
	case PAPI_SET_GRANUL:
		return ( set_granularity
				 ( option->granularity.ESI->machdep,
				   option->granularity.g ranularity ) );
	case PAPI_SET_INHERIT:
		return ( set_inherit( option->inherit.inherit ) );
	default:
		return ( PAPI_EINVAL );
	}
}
Esempio n. 10
0
int
_papi_hwd_set_domain( hwd_control_state_t * cntrl, int domain )
{
	return set_domain( cntrl, domain );
}