Ejemplo n.º 1
0
int main( void )
{
	printf( "From standard headers:\n" );
	printsh( "char", SCHAR_MIN, UCHAR_MAX );
	printsh( "short", SHRT_MIN, USHRT_MAX );
	printsh( "int", INT_MIN, UINT_MAX );
	printsh( "long", LONG_MIN, ULONG_MAX );

	printf( "\nBy direct computation:\n" );
	char_range();
	short_range();
	int_range();
	long_range();

	return 0;
}
Ejemplo n.º 2
0
void SodController::read_positions(f_parameter& par)
{
  QString error;
  QTextStream qts(&error);
  QString filename;
  QString pos_name;
  unsigned int grid_points = 0;
  if(!par.param("file", filename))
    qts << "read_positions: no position file specified (file=..)\n";
  if(!par.param("pos", pos_name) || pos_name.isEmpty())
    qts << "specify a name for the position set (pos=..)\n";
  if(error.length()){
    warn(error);
    return;
  }
  par.param("grid", grid_points);
  node_set ns = read_node_set(filename);
  if(!ns.n_size()){
    warn("read_positions obtained empty node_set");
    return;
  }
  positions[pos_name] = ns;
  
  bool set_mapper = true;
  par.param("set_mapper", set_mapper);
  if(set_mapper && !distanceViewers.count(pos_name)){
    distances[pos_name] = positions[pos_name].distances();
    std::vector<int> memberInts = int_range(distances[pos_name].n_size());
    bool trackCoordinates = true;
    par.param("coords", trackCoordinates);
    if(!par.defined("gpu")){
      distanceViewers[ pos_name ] = new DistanceViewer(memberInts, distances[pos_name].Nodes(), pos_name, trackCoordinates);
      distanceViewers[ pos_name ]->show();
      distanceViewers[ pos_name ]->raise();
    }else{     // set up a gpu
      if(ocl_mappers.count(pos_name))
	delete(ocl_mappers[pos_name]);
      ocl_mappers[pos_name] = new OCL_DistanceMapperManager(&positions[pos_name], &distances[pos_name]);
      ocl_mappers[pos_name]->print_pointers();
    }
  }
  if(set_mapper && distanceViewers.count(pos_name)){
    distanceViewers[pos_name]->set_starting_dimensionality(ns.n_dim());
    distanceViewers[pos_name]->setPositions(ns.Nodes(), grid_points);
  }
}