您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ sources函数代码示例

51自学网 2021-06-03 08:07:52
  C++
这篇教程C++ sources函数代码示例写得很实用,希望能帮到您。

本文整理汇总了C++中sources函数的典型用法代码示例。如果您正苦于以下问题:C++ sources函数的具体用法?C++ sources怎么用?C++ sources使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。

在下文中一共展示了sources函数的29个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: config

void Hdd::configAccepted(){    KConfigGroup cg = config();    KConfigGroup cgGlobal = globalConfig();    QStandardItem *parentItem = m_hddModel.invisibleRootItem();    clear();    for (int i = 0; i < parentItem->rowCount(); ++i) {        QStandardItem *item = parentItem->child(i, 0);        if (item) {            QStandardItem *child = parentItem->child(i, 1);            if (child->text() != child->data().toString()) {                cgGlobal.writeEntry(item->data().toString(), child->text());            }            if (item->checkState() == Qt::Checked) {                appendSource(item->data().toString());            }        }    }    cg.writeEntry("uuids", sources());    uint interval = ui.intervalSpinBox->value();    cg.writeEntry("interval", interval);    emit configNeedsSaving();}
开发者ID:mgottschlag,项目名称:kwin-tiling,代码行数:27,


示例2: sources

int OpenCL::load_kernels(std::vector<std::string> source_paths) {	std::vector<std::string> sources(source_paths.size());	const char* source_ptr[source_paths.size()];	for (int i = 0; i < source_paths.size(); i++) {		std::ifstream file(source_paths[i]);		std::stringstream buffer;		buffer << file.rdbuf();		sources[i] = buffer.str();		source_ptr[i] = sources[i].c_str();		std::cout << "--- source code loaded for file " << source_paths[i] << " ---" << std::endl;	}	// Create the program from source and build it.	cl_program program;	SAFE_REF(program = clCreateProgramWithSource(context, source_paths.size(), source_ptr, NULL, &err));	SAFE_BUILD(clBuildProgram(program, 0, NULL, "-I../src/util", NULL, NULL));	cl_kernel kernel_pr, kernel_tr;	SAFE_REF(kernel_pr = clCreateKernel(program, "produceray", &err));	SAFE_REF(kernel_tr = clCreateKernel(program, "traceray", &err));	kernels.push_back(kernel_pr);	kernels.push_back(kernel_tr);	return CL_SUCCESS;}
开发者ID:gfokkema,项目名称:RT-Raytracing,代码行数:27,


示例3: propagate

GEODESIC_DLL_IMPORT void propagate(long algorithm_id,									double* source_points,										long num_sources,									double* stop_points,										long num_stop_points,									double max_propagation_distance){	std::vector<geodesic::SurfacePoint> sources(num_sources);	geodesic::Mesh* mesh = algorithms[algorithm_id]->mesh();	for(std::size_t i=0; i<num_sources; ++i)	{		geodesic::fill_surface_point_structure(&sources[i], 												source_points + 5*i, 												mesh);	}	std::vector<geodesic::SurfacePoint> stop(num_stop_points);	for(std::size_t i=0; i<num_stop_points; ++i)	{		geodesic::fill_surface_point_structure(&stop[i], 												stop_points + 5*i, 												mesh);	}	algorithms[algorithm_id]->propagate(sources, 										max_propagation_distance,										&stop);}
开发者ID:aldongqing,项目名称:jjcao_code,代码行数:29,


示例4: Java_com_example_LiveFeatureActivity_compileKernels

JNIEXPORT jboolean JNICALL Java_com_example_LiveFeatureActivity_compileKernels(JNIEnv *env, jclass clazz){    // Find OCL devices and compile kernels    cl_int err = CL_SUCCESS;    try {        std::vector<cl::Platform> platforms;        cl::Platform::get(&platforms);        if (platforms.size() == 0) {            return false;        }        cl_context_properties properties[] =        { CL_CONTEXT_PLATFORM, (cl_context_properties)(platforms[0])(), 0};        gContext = cl::Context(CL_DEVICE_TYPE_GPU, properties);        std::vector<cl::Device> devices = gContext.getInfo<CL_CONTEXT_DEVICES>();        gQueue = cl::CommandQueue(gContext, devices[0], 0, &err);        int src_length = 0;		const char* src  = file_contents("/data/data/com.example/app_execdir/kernels.cl",&src_length);        cl::Program::Sources sources(1,std::make_pair(src, src_length) );        cl::Program program(gContext, sources);        program.build(devices,NULL,cb);        while(program.getBuildInfo<CL_PROGRAM_BUILD_STATUS>(devices[0]) != CL_BUILD_SUCCESS);        gNV21Kernel = cl::Kernel(program, "nv21torgba", &err);        gLaplacianK = cl::Kernel(program, "laplacian", &err);        gNegative = cl::Kernel(program, "negative", &err);        return true;    }    catch (cl::Error e) {        if( !throwJavaException(env,"decode",e.what(),e.err()) )            LOGI("@decode: %s /n",e.what());        return false;    }}
开发者ID:khaled777b,项目名称:AndroidOpenCL-Filter,代码行数:32,


示例5: main

int main() {  typedef TempKernel kernel_type;  typedef kernel_type::source_type source_type;  typedef kernel_type::charge_type charge_type;  typedef kernel_type::target_type target_type;  typedef kernel_type::result_type result_type;  kernel_type K;  // init source  std::vector<source_type> sources(2);  // init charge  std::vector<charge_type> charges(sources.size());  // init target  std::vector<target_type> targets(2);  // init results vectors for exact  std::vector<result_type> exact(targets.size());  // test direct  fmmtl::direct(K, sources, charges, targets, exact);  std::cout << exact[0] << "/n";  fmmtl::direct(K, sources, charges, exact);  std::cout << exact[0] << "/n";}
开发者ID:ccecka,项目名称:fmmtl,代码行数:27,


示例6: debug_logs

std::vector<debug_log> debug_logs(GLuint count){  auto max_message_size = 0;  glGetIntegerv(GL_MAX_DEBUG_MESSAGE_LENGTH, &max_message_size);  std::vector<GLenum>  sources      (count);  std::vector<GLenum>  types        (count);  std::vector<GLuint>  ids          (count);  std::vector<GLenum>  severities   (count);  std::vector<GLsizei> message_sizes(count);  std::vector<GLchar>  message_data (count * max_message_size);  auto real_count = glGetDebugMessageLog(count, static_cast<GLsizei>(message_data.size()), &sources[0], &types[0], &ids[0], &severities[0], &message_sizes[0], &message_data[0]);  sources      .resize(real_count);  types        .resize(real_count);  ids          .resize(real_count);  severities   .resize(real_count);  message_sizes.resize(real_count);  std::vector<std::string> messages(real_count);  auto current_message = message_data.begin();  for (size_t i = 0; i < message_sizes.size(); ++i)  {    messages[i] = std::string(current_message, current_message + message_sizes[i] - 1);    current_message = current_message + message_sizes[i];  }  std::vector<debug_log> debug_logs(real_count);  for (unsigned i = 0; i < real_count; i++)    debug_logs[i] = debug_log{sources[i], types[i], ids[i], severities[i], messages[i], nullptr};  return debug_logs;}
开发者ID:juantresde,项目名称:gl,代码行数:31,


示例7: hybrid_fmm_stokes_solver

int hybrid_fmm_stokes_solver(int ac, char **av){    srand(0);    bool dump_tree_data = false;    vtkSmartPointer<vtkPolyData>   poly_data = vtkSmartPointer<vtkPolyData>::New();    vtkSmartPointer<vtkPoints>     points = vtkSmartPointer<vtkPoints>::New();    vtkSmartPointer<vtkFloatArray> data_points = vtkSmartPointer<vtkFloatArray>::New();    vtkSmartPointer<vtkCellArray>  cells = vtkSmartPointer<vtkCellArray>::New();    typedef float value_type;    size_t num_sources = 1 << 8;    size_t num_targets = 1 << 8;    size_t size_sources = 3 * num_sources;    size_t size_targets = 3 * num_targets;    std::vector<value_type> sources(size_sources), targets(size_targets), velocities(size_targets), forces(size_sources);    value_type delta = .0001;    HybridFmmStokesSolver<value_type> fmm(num_sources);    std::generate(sources.begin(), sources.end(), random_generator<value_type>());    std::generate(targets.begin(), targets.end(), random_generator<value_type>());    std::generate(forces.begin(), forces.end(), random_generator<value_type>());    std::cout << "sources = ["; std::copy(sources.begin(), sources.end(), std::ostream_iterator<value_type>(std::cout, " ")); std::cout << "];" << std::endl;    std::cout << "targets = ["; std::copy(targets.begin(), targets.end(), std::ostream_iterator<value_type>(std::cout, " ")); std::cout << "];" << std::endl;    std::cout << "forces = ["; std::copy(forces.begin(), forces.end(), std::ostream_iterator<value_type>(std::cout, " ")); std::cout << "];" << std::endl;    fmm.setDelta(delta);    fmm(0, &sources[0], &velocities[0], &forces[0]);    std::fill(velocities.begin(), velocities.end(), 0.0);    fmm.allPairs();    if (dump_tree_data)    {        IO::VtkWriter<vtkXMLPolyDataWriter> writer("data/points");        data_points->SetArray(&sources[0], sources.size(), 1);        data_points->SetNumberOfComponents(3);        data_points->SetName("positions");        points->SetData(data_points);        poly_data->SetPoints(points);        for (vtkIdType i = 0; i < num_sources; ++i)            cells->InsertNextCell(VTK_VERTEX, &i);        poly_data->SetVerts(cells);        writer.write(poly_data, 0, false);        write_vtk_octree();    }#ifdef USE_QT_GUI    QApplication app(ac, av);    if (!QGLFormat::hasOpenGL())    {        std::cerr << "This system has no OpenGL support" << std::endl;        return 1;    }    QGL::setPreferredPaintEngine(QPaintEngine::OpenGL);    OctreeRenderer tree_renderer;    tree_renderer.init(octree);    tree_renderer.setWindowTitle(QObject::tr("Quad Tree"));    tree_renderer.setMinimumSize(200, 200);    tree_renderer.resize(800, 600);    tree_renderer.show();    return app.exec();#else    return 0;#endif}
开发者ID:macundo,项目名称:moops,代码行数:60,


示例8: AddLogLineC

void CDownloadQueue::AddSearchToDownload(CSearchFile* toadd, uint8 category){	if ( IsFileExisting(toadd->GetFileHash()) ) {		return;	}	if (toadd->GetFileSize() > OLD_MAX_FILE_SIZE) {		if (!PlatformSpecific::CanFSHandleLargeFiles(thePrefs::GetTempDir())) {			AddLogLineC(_("Filesystem for Temp directory cannot handle large files."));			return;		} else if (!PlatformSpecific::CanFSHandleLargeFiles(theApp->glob_prefs->GetCatPath(category))) {			AddLogLineC(_("Filesystem for Incoming directory cannot handle large files."));			return;		}	}	CPartFile* newfile = NULL;	try {		newfile = new CPartFile(toadd);	} catch (const CInvalidPacket& WXUNUSED(e)) {		AddDebugLogLineC(logDownloadQueue, wxT("Search-result contained invalid tags, could not add"));	}		if ( newfile && newfile->GetStatus() != PS_ERROR ) {		AddDownload( newfile, thePrefs::AddNewFilesPaused(), category );		// Add any possible sources		if (toadd->GetClientID() && toadd->GetClientPort()) {			CMemFile sources(1+4+2);			sources.WriteUInt8(1);			sources.WriteUInt32(toadd->GetClientID());			sources.WriteUInt16(toadd->GetClientPort());			sources.Reset();			newfile->AddSources(sources, toadd->GetClientServerIP(), toadd->GetClientServerPort(), SF_SEARCH_RESULT, false);		}		for (std::list<CSearchFile::ClientStruct>::const_iterator it = toadd->GetClients().begin(); it != toadd->GetClients().end(); ++it) {			CMemFile sources(1+4+2);			sources.WriteUInt8(1);			sources.WriteUInt32(it->m_ip);			sources.WriteUInt16(it->m_port);			sources.Reset();			newfile->AddSources(sources, it->m_serverIP, it->m_serverPort, SF_SEARCH_RESULT, false);		}	} else {		delete newfile;	}}
开发者ID:windreamer,项目名称:amule-dlp,代码行数:46,


示例9: sources

void Netctl::initSources(){    if (debug) qDebug() << PDEBUG;    QStringList sourcesList = sources();    for (int i=0; i<sourcesList.count(); i++)        setData(sourcesList[i], QString("value"), QString("N//A"));}
开发者ID:nosada,项目名称:netctl-gui,代码行数:8,


示例10: LogMessages

void LogMessages(Settings settings){	LogSources sources(true);	sources.AddDBWinReader(false);	if (HasGlobalDBWinReaderRights())		sources.AddDBWinReader(true);	sources.SetAutoNewLine(settings.autonewline);	std::ofstream fs;	if (!settings.filename.empty())	{		OpenLogFile(fs, WStr(settings.filename));		fs.flush();	}	auto guard = make_guard([&fs, &settings]()	{		if (!settings.filename.empty())		{			fs.flush();			fs.close();			std::cout << "Log file closed./n";		}	});	std::string separator = settings.tabs ? "/t" : " ";	while (!g_quit)	{		auto lines = sources.GetLines();		int linenumber = 0;		for (auto it = lines.begin(); it != lines.end(); ++it)		{			if (settings.console)			{				if (settings.linenumber)				{					++linenumber;					std::cout << std::setw(5) << std::setfill('0') << linenumber << std::setfill(' ') << separator;				}				OutputDetails(settings, *it);				std::cout << separator << it->message.c_str() << "/n";			}			if (!settings.filename.empty())			{				WriteLogFileMessage(fs, it->time, it->systemTime, it->pid, it->processName, it->message);			}		}		if (settings.flush)		{			std::cout.flush();			fs.flush();		}		Sleep(250);	}	std::cout.flush();}
开发者ID:JayceM6,项目名称:DebugViewPP,代码行数:58,


示例11: getModelObjectSources

 std::vector<T> getModelObjectSources() const {   std::vector<T> result;   std::vector<WorkspaceObject> wos = sources();   for (const WorkspaceObject& wo : wos) {     boost::optional<T> oSource = wo.optionalCast<T>();     if (oSource) { result.push_back(*oSource); }   }   return result; }
开发者ID:pepsi7959,项目名称:OpenStudio,代码行数:9,


示例12: getSource

   Signal* NonlinearMatrix::getSource(int number) const   {      for(auto signal : sources())      {         if(signal->number() == number)            return signal;      }      return nullptr;   }
开发者ID:DouglasHeriot,项目名称:ember-plus,代码行数:10,


示例13: switch

/* * Processes a frame */void LinemodInterface::process(const cv::Mat &color, const cv::Mat &depth, std::vector<Result> &results, const float minResponse,                               const std::vector<std::string> &classes, const cv::Mat &mask){  cv::Mat _depth;  switch(depth.type())  {  case CV_32F:    depth.convertTo(_depth, CV_16U, 1000.0);    break;  case CV_16U:    _depth = depth;    break;  default:    return;  }  std::vector<cv::Mat>  sources(2),          masks;  sources[0] = color;  sources[1] = _depth;  if(!mask.empty())  {    masks.resize(2);    masks[0] = mask.clone();    masks[1] = mask.clone();  }  matches.clear();  detector->match(sources, minResponse, matches, classes, cv::noArray(), masks);  std::map<std::string, int> best;  std::map<std::string, int>::iterator it;  Result result;  results.clear();  for(int i = 0; i < (int)matches.size(); ++i)  {    cv::linemod::Match &match = matches[i];    setResult(match, result);    it = best.find(result.name);    if(it == best.end())    {      best[result.name] = i;      setResult(match, result);      results.push_back(result);    }  }}
开发者ID:yazdani,项目名称:robosherlock,代码行数:57,


示例14: sources

/*!  /reimp  */void QDependentEventsContext::setVisibleSources(const QSet<QPimSource> &set){    QSet<int> show;    QSet<int> hide;    QSet<QPimSource> list = sources();    foreach (QPimSource s, list) {        int context = QPimSqlIO::sourceContext(s);        if (set.contains(s)) {            show.insert(context);        } else {            hide.insert(context);        }    }
开发者ID:Camelek,项目名称:qtmoko,代码行数:16,


示例15: data_arrays

void nix::file::BlockFS::createSubFolders(const std::shared_ptr<base::IFile> &file) {    bfs::path data_arrays("data_arrays");    bfs::path tags("tags");    bfs::path multi_tags("multi_tags");    bfs::path sources("sources");    bfs::path p(location());    bfs::path groups("groups");    data_array_dir = Directory(p / data_arrays, file->fileMode());    tag_dir = Directory(p / tags, file->fileMode());    multi_tag_dir = Directory(p / multi_tags, file->fileMode());    source_dir = Directory(p / sources, file->fileMode());    group_dir = Directory(p / groups, file->fileMode());}
开发者ID:G-Node,项目名称:nix,代码行数:14,


示例16: lock

void CDownloadQueue::OnHostnameResolved(uint32 ip){	wxMutexLocker lock( m_mutex );	wxASSERT( m_toresolve.size() );		Hostname_Entry resolved = m_toresolve.front();	m_toresolve.pop_front();	if ( ip ) {		CPartFile* file = GetFileByID( resolved.fileid );		if ( file ) {			CMemFile sources(1+4+2);			sources.WriteUInt8(1); // No. Sources			sources.WriteUInt32(ip);			sources.WriteUInt16(resolved.port);			sources.WriteUInt8(resolved.cryptoptions);			if (resolved.cryptoptions & 0x80) {				wxASSERT(!resolved.hash.IsEmpty());				CMD4Hash sourcehash;				sourcehash.Decode(resolved.hash);				sources.WriteHash(sourcehash);			}			sources.Seek(0,wxFromStart);						file->AddSources(sources, 0, 0, SF_LINK, true);		}	}		while (m_toresolve.size()) {		Hostname_Entry entry = m_toresolve.front();		// Check if it is a simple dot address		uint32 tmpIP = StringIPtoUint32(entry.strHostname);		if (tmpIP) {			OnHostnameResolved(tmpIP);		} else {			CAsyncDNS* dns = new CAsyncDNS(entry.strHostname, DNS_SOURCE, theApp);			if ((dns->Create() != wxTHREAD_NO_ERROR) || (dns->Run() != wxTHREAD_NO_ERROR)) {				dns->Delete();				m_toresolve.pop_front();			} else {				break;			}		}	}}
开发者ID:windreamer,项目名称:amule-dlp,代码行数:49,


示例17: sources

CommPtr Comm::graph_adjacent(Read<I32> srcs, Read<I32> dsts) const {#ifdef OMEGA_H_USE_MPI  MPI_Comm impl2;  HostRead<I32> sources(srcs);  HostRead<I32> destinations(dsts);  int reorder = 0;  CALL(MPI_Dist_graph_create_adjacent(impl_, sources.size(), sources.data(),      OMEGA_H_MPI_UNWEIGHTED, destinations.size(), destinations.data(),      OMEGA_H_MPI_UNWEIGHTED, MPI_INFO_NULL, reorder, &impl2));  return CommPtr(new Comm(impl2));#else  CHECK(srcs == dsts);  return CommPtr(new Comm(true, dsts.size() == 1));#endif}
开发者ID:ibaned,项目名称:omega_h2,代码行数:15,


示例18: source

void source( char *file ) {    static char findpath[ _MAX_PATH ];    static char findname[ _MAX_PATH ];    fn_split( file );/*    _splitpath( file, disk, path, name, ext );*/    if ( strchr( file, '?' ) || strchr( file, '*' ) ) {  /* Check for '*' and '?' */        _makepath( findpath, fn_drive(), fn_dir(), NULL, NULL );        _makepath( findname, NULL, NULL, fn_name(), fn_ext() );        sources( findpath, findname );    }    else        one_source( file );}
开发者ID:doniexun,项目名称:OrangeC,代码行数:16,


示例19: throw

cl::ProgramClCmdQueue::createProgram(const std::string& source) throw(cl::Error) {    // Create the program from source    cl::Program::Sources sources(1, std::make_pair(source.c_str(), 0));    cl::Program program(context, sources);    // Build Open CL program for a given device    try {        program.build({ device });    } catch (cl::Error error) {        std::cout << "Build log:" << std::endl                  << program.getBuildInfo<CL_PROGRAM_BUILD_LOG>(device)                  << std::endl;        throw error;    }    return program;}
开发者ID:batesokr,项目名称:CSE620H,代码行数:16,


示例20: test_kernel

void test_kernel(const Kernel& K) {  typedef typename Kernel::source_type source_type;  typedef typename Kernel::charge_type charge_type;  typedef typename Kernel::target_type target_type;  typedef typename Kernel::result_type result_type;  std::vector<source_type> sources(1);  std::vector<charge_type> charges(1);  std::vector<target_type> targets(1);  std::vector<result_type> results(1);  Direct::matvec(K, sources, charges, targets, results);  std::cout << results[0] << std::endl;  std::cout << KernelTraits<Kernel>() << std::endl;  std::cout << typeid(Kernel).name() << " OK." << std::endl;}
开发者ID:kgourgou,项目名称:fmmtl,代码行数:17,


示例21: impl_

Comm::Comm(MPI_Comm impl) : impl_(impl) {  int topo_type;  CALL(MPI_Topo_test(impl, &topo_type));  if (topo_type == MPI_DIST_GRAPH) {    int nin, nout, is_weighted;    CALL(MPI_Dist_graph_neighbors_count(impl, &nin, &nout, &is_weighted));    HostWrite<I32> sources(nin);    HostWrite<I32> destinations(nout);    CALL(MPI_Dist_graph_neighbors(impl, nin, sources.data(),        OMEGA_H_MPI_UNWEIGHTED, nout, destinations.data(),        OMEGA_H_MPI_UNWEIGHTED));    srcs_ = sources.write();    dsts_ = destinations.write();    host_srcs_ = HostRead<I32>(srcs_);    host_dsts_ = HostRead<I32>(dsts_);  }}
开发者ID:ibaned,项目名称:omega_h2,代码行数:17,


示例22: file

// -------------------------------------------------------------------------cl::Program MorphOpenCL::createProgram(const char* progFile, const char* options){	if(error) return cl::Program();	QFile file(progFile);	if(!file.open(QIODevice::ReadOnly | QIODevice::Text))	{		clError("Can't read " + 			QString(progFile) + 			" file!", -1);		return cl::Program();	}	QTextStream in(&file);	QString contents = in.readAll();	QByteArray w = contents.toLocal8Bit();	const char* src = w.data();	size_t len = contents.length();	cl_int err;	cl::Program::Sources sources(1, std::make_pair(src, len));	cl::Program program = cl::Program(context, sources, &err);	clError("Failed to create compute program from" + QString(progFile), err);	if(error) return cl::Program();	std::vector<cl::Device> devs(1);	devs[0] = (dev);	printf("Building %s program...", progFile);	err = program.build(devs, options);	QString log(QString::fromStdString(		program.getBuildInfo<CL_PROGRAM_BUILD_LOG>(dev)));	if(err != CL_SUCCESS)		clError(log, err);	if(!error) printf("[OK]/n");	if(log.size() > 0)	{		std::string slog = log.toStdString();		printf("log: %s/n", slog.c_str());	}	return program;}
开发者ID:k0zmo,项目名称:morphology-opencl,代码行数:45,


示例23: kDebug

bool NetworkManagementEngine::sourceRequestEvent(const QString &name){    kDebug() << "Source requested:" << name << sources();    setData(name, DataEngine::Data());    //setData("networkStatus", "isConnected", true);    //scheduleSourcesUpdated();    if (name == "connections") {        connect(d->activatables, SIGNAL(activatableAdded(RemoteActivatable*)),                SLOT(activatableAdded(RemoteActivatable*)));        connect(d->activatables, SIGNAL(activatableRemoved(RemoteActivatable*)),                SLOT(activatableRemoved(RemoteActivatable*)));        connect(d->activatables, SIGNAL(appeared()), SLOT(listAppeared()));        connect(d->activatables, SIGNAL(disappeared()), SLOT(listDisappeared()));        kDebug() << "connected...";        listAppeared();        return true;    }
开发者ID:netrunner-debian-kde-extras,项目名称:networkmanagement,代码行数:19,


示例24: getKernel

cl::KernelgetKernel(std::vector<cl::Device>& deviceList, cl::Context& context,          const std::string& sourceCode, const std::string& entryFunc) {    // Create the program from source for given device        cl::Program::Sources sources(1, std::make_pair(sourceCode.c_str(), 0));    cl::Program program(context, sources);    // Build Open CL program for a given device    try {        program.build(deviceList);    } catch (cl::Error error) {        std::cout << "Build log:" << std::endl                  << program.getBuildInfo<CL_PROGRAM_BUILD_LOG>(deviceList[0])                  << std::endl;        throw error;    }    // Create and return a kernel    cl::Kernel kernel(program, entryFunc.c_str());    return kernel;}
开发者ID:haitzza,项目名称:classwork,代码行数:19,


示例25: compile

cl::Kernel * compile(const std::string & name, const std::string & code, const std::string & flags, cl::Context & clContext, cl::Device & clDevice) {  cl::Program * program = 0;  cl::Kernel * kernel = 0;  try {    cl::Program::Sources sources(1, std::make_pair(code.c_str(), code.length()));    program = new cl::Program(clContext, sources, NULL);    program->build(std::vector<cl::Device>(1, clDevice), flags.c_str(), NULL, NULL);  } catch ( cl::Error & err ) {    throw isa::OpenCL::OpenCLError("ERROR: OpenCL build error /"" + program->getBuildInfo<CL_PROGRAM_BUILD_LOG>(clDevice) + "/"");  }  try {    kernel = new cl::Kernel(*program, name.c_str(), NULL);    delete program;  } catch ( cl::Error &err ) {    throw isa::OpenCL::OpenCLError("ERROR: OpenCL kernel error /"" + isa::utils::toString<cl_int>(err.err()) + "/"");  }  return kernel;}
开发者ID:isazi,项目名称:OpenCL,代码行数:19,


示例26: kernelStream

cl::Program OCLSample::compileSource(const std::string& filename) {  cl_int result;  std::ifstream kernelStream(filename.c_str());  std::string source(std::istreambuf_iterator<char>(kernelStream),                     (std::istreambuf_iterator<char>()));  kernelStream.close();  cl::Program::Sources sources(1, std::make_pair(source.c_str(),                                                 source.size()));  cl::Program program(context_, sources, &result);  assert(result == CL_SUCCESS && "Failed to load program source");  std::vector<cl::Device> devices;  devices.push_back(device_);  result = program.build(devices);  if(result != CL_SUCCESS) {    std::cerr << "Source compilation failed./n";    std::cerr << program.getBuildInfo<CL_PROGRAM_BUILD_LOG>(device_);    assert(false && "Unable to continue");  }  return program;}
开发者ID:Quanteek,项目名称:llvm-ptx-samples,代码行数:22,


示例27: fmm_stokes_solver

int fmm_stokes_solver(int ,char **){    srand(0);    typedef double value_type;    size_t num_sources = 100;    size_t num_targets = 100;    size_t size_sources = 3*num_sources;    size_t size_targets = 3*num_targets;    std::vector<value_type> sources(size_sources), targets(size_targets), velocities(size_targets), forces(size_sources);    value_type delta = .01;    FmmStokesSolver<double,25,6> solver(num_sources);    solver.setDelta(delta);    std::generate(sources.begin(),sources.end(),random_generator<value_type>());    std::generate(targets.begin(),targets.end(),random_generator<value_type>());    std::generate(velocities.begin(),velocities.end(),random_generator<value_type>());    std::generate(forces.begin(),forces.end(),random_generator<value_type>());    solver(0,&targets[0],&velocities[0],&sources[0],&forces[0]);        return 0;}
开发者ID:macundo,项目名称:moops,代码行数:22,


示例28: QWidget

void Hdd::createConfigurationInterface(KConfigDialog *parent){    QWidget *widget = new QWidget();    ui.setupUi(widget);    m_hddModel.clear();    m_hddModel.setHorizontalHeaderLabels(QStringList() << i18n("Mount Point")                                                       << i18n("Name"));    QStandardItem *parentItem = m_hddModel.invisibleRootItem();    Plasma::DataEngine::Data data;    QString predicateString("IS StorageVolume");    foreach (const QString& uuid, engine()->query(predicateString)[predicateString].toStringList()) {        if (!isValidDevice(uuid, &data)) {            continue;        }        QStandardItem *item1 = new QStandardItem(filePath(data));        item1->setEditable(false);        item1->setCheckable(true);        item1->setData(uuid);        if (sources().contains(uuid)) {            item1->setCheckState(Qt::Checked);        }        QStandardItem *item2 = new QStandardItem(hddTitle(uuid, data));        item2->setData(guessHddTitle(data));        item2->setEditable(true);        parentItem->appendRow(QList<QStandardItem *>() << item1 << item2);    }    ui.treeView->setModel(&m_hddModel);    ui.treeView->resizeColumnToContents(0);    ui.intervalSpinBox->setValue(interval() / 60 / 1000);    ui.intervalSpinBox->setSuffix(ki18np(" minute", " minutes"));    parent->addPage(widget, i18n("Partitions"), "drive-harddisk");    connect(parent, SIGNAL(applyClicked()), this, SLOT(configAccepted()));    connect(parent, SIGNAL(okClicked()), this, SLOT(configAccepted()));    connect(ui.treeView, SIGNAL(clicked(QModelIndex)), parent, SLOT(settingsModified()));    connect(ui.intervalSpinBox, SIGNAL(valueChanged(QString)), parent, SLOT(settingsModified()));}
开发者ID:mgottschlag,项目名称:kwin-tiling,代码行数:38,


示例29: create_with_source_file

    /// Creates a new program with /p files in /p context.    ///    /// /see_opencl_ref{clCreateProgramWithSource}    static program create_with_source_file(const std::vector<std::string> &files,                                           const context &context)    {        std::vector<std::string> sources(files.size());        for(size_t i = 0; i < files.size(); ++i) {            // open file stream            std::ifstream stream(files[i].c_str());            if(stream.fail()){                BOOST_THROW_EXCEPTION(std::ios_base::failure("failed to create stream."));            }            // read source            sources[i] = std::string(                    (std::istreambuf_iterator<char>(stream)),                    std::istreambuf_iterator<char>()            );        }        // create program        return create_with_source(sources, context);    }
开发者ID:ASMlover,项目名称:study,代码行数:26,



注:本文中的sources函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


C++ sp函数代码示例
C++ sourceRect函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。