Beispiel #1
0
std::string get_platform_info(cl_platform_id platform, cl_platform_info param_name)
{
	size_t paramLen;
	::clGetPlatformInfo(platform, param_name, 0, NULL, &paramLen);
	std::vector<char> tmpArray(paramLen);
	::clGetPlatformInfo(platform, param_name, paramLen, &tmpArray[0], NULL);

	return std::string(&tmpArray[0]);
}
void IsoSurfacePolygonizer::dumpEdgeMap() const {
  debugLog(_T("EdgeMap\n"));
  Array<SortedCubeEdge> tmpArray(m_edgeMap.size());
  for(Iterator<EdgeMapEntry> it = m_edgeMap.getEntryIterator(); it.hasNext();) {
    tmpArray.add(it.next());
  }
  tmpArray.sort(sortedCubeEdgeCmp);
  const size_t n = tmpArray.size();
  for(size_t i = 0; i < n; i++) {
    const SortedCubeEdge &e = tmpArray[i];
    debugLog(_T("%s:%6d\n"), e.toString().cstr(), e.m_index);
  }
}
void IsoSurfacePolygonizer::dumpCornerMap() const {
  debugLog(_T("CornerMap\n"));
  CompactArray<const HashedCubeCorner*> tmpArray(m_cornerMap.size());
  for(Iterator<CornerMapEntry> it = m_cornerMap.getEntryIterator(); it.hasNext();) {
    const CornerMapEntry &e = it.next();
    tmpArray.add(&e.getValue());
  }
  tmpArray.sort(cubeCornerCmp);

  const size_t n = tmpArray.size();
  for(size_t i = 0; i < n; i++) {
    debugLog(_T("%s\n"), tmpArray[i]->toString().cstr());
  }
}
Beispiel #4
0
std::string get_device_info<std::string>(cl_device_id device, cl_device_info param_name)
{
	size_t paramLen;
	cl_int rerror = ::clGetDeviceInfo(device, param_name, 0, NULL, &paramLen);
	if(rerror != CL_SUCCESS)
	{
		std::cout << "::clGetDeviceInfo error." << std::endl;
	}
	std::vector<char> tmpArray(paramLen);
	rerror = ::clGetDeviceInfo(device, param_name, paramLen, &tmpArray[0], NULL);
	if(rerror != CL_SUCCESS)
	{
		std::cout << "::clGetDeviceInfo error." << std::endl;
	}

	return std::string(&tmpArray[0]);
}
Beispiel #5
0
//template <typename Comparable>
void mergesort( std::vector<short int> & a){
	/*
	for(unsigned int i = 0; i< (a.size() -1); i++){
	  printf(", %d ", a[i]);
	}*/
	if(a.size() > 0){
	std::vector<short int> tmpArray( a.size( ));
	merge_sort( a, tmpArray, 0, a.size() - 1);
	}
	/*
	try{
	  
	}catch(const std::bad_alloc & e){
	    printf("Out of memory: exiting \n");
	    exit(EXIT_FAILURE);
	}*/
	
	
}
Beispiel #6
0
void mergeSort( vector<Comparable> & a, int size )
{
    vector<Comparable> tmpArray( size + 1 );

    mergeSort( a, tmpArray, 0, size );
}
Beispiel #7
0
void mergeSort(vector<Comparable> & a)
{
	// allocate a temporary array 
	vector<Comparable> tmpArray(a.size());
	mergeSort(a, tmpArray, 0, a.size() - 1);
}