当前位置: 首页>>代码示例>>C++>>正文


C++ dataset函数代码示例

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


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

示例1: timeToFrame

/******************************************************************************
* Timer callback used during animation playback.
******************************************************************************/
void AnimationSettings::onPlaybackTimer()
{
	// Check if the animation playback has been deactivated in the meantime.
	if(!_isPlaybackActive)
		return;

	// Add one frame to current time
	int newFrame = timeToFrame(time()) + 1;
	TimePoint newTime = frameToTime(newFrame);

	// Loop back to first frame if end has been reached.
	if(newTime > animationInterval().end())
		newTime = animationInterval().start();

	// Set new time.
	setTime(newTime);

	// Wait until the scene is ready. Then jump to the next frame.
	dataset()->runWhenSceneIsReady([this]() {
		if(_isPlaybackActive) {
			_isPlaybackActive = false;
			startAnimationPlayback();
		}
	});
}
开发者ID:bitzhuwei,项目名称:OVITO_sureface,代码行数:28,代码来源:AnimationSettings.cpp

示例2: TEST

TEST(HDF5IO, ReadWrite1D)
{
    const unsigned int nelements = 5;
    std::vector<float> a(nelements);
    for (unsigned int i=0; i < a.size(); i++)
        a[i] = 2 * i;

    // 1D array
    std::vector<unsigned int> rank(1);
    rank[0] = a.size();

    std::string filename("/tmp/sxmc_test_1d.hdf5");
    std::string dataset("/a");

    ASSERT_TRUE(write_float_vector_hdf5(filename, dataset, a, rank) >= 0);

    ///////

    std::vector<float> test_a;
    std::vector<unsigned int> test_rank;

    ASSERT_TRUE(read_float_vector_hdf5(filename, dataset, test_a, test_rank) >= 0);

    ASSERT_EQ((unsigned) 1, test_rank.size());
    EXPECT_EQ(nelements, test_rank[0]);

    ASSERT_EQ(nelements, test_a.size());
    for (unsigned int i=0; i < test_a.size(); i++)
        EXPECT_EQ(2*i, test_a[i]);
}
开发者ID:bonventre,项目名称:sxmc,代码行数:30,代码来源:test_hdf5.cpp

示例3: datasource

double terrama2::core::RiscoDeFogo::XYLinhaCol(double x, double y, const std::string& path, const std::string& filename) const
{

    //const auto& prec = *(precipitacao.rbegin()+i);
    std::shared_ptr<te::da::DataSource> datasource(te::da::DataSourceFactory::make("GDAL", "file://"+path+filename));

    //RAII for open/closing the datasource
    terrama2::core::OpenClose<std::shared_ptr<te::da::DataSource> > openClose(datasource);

    std::shared_ptr<te::da::DataSourceTransactor> transactor(datasource->getTransactor());
    std::shared_ptr<te::da::DataSet> dataset(transactor->getDataSet(filename));

    std::shared_ptr<te::rst::Raster> raster(dataset->getRaster(0));

    te::rst::Grid* grid = raster->getGrid();
    te::rst::Band* band = raster->getBand(0);

    double colD, rowD;
    grid->geoToGrid(x, y, colD, rowD);
    int col = std::round(colD);
    int row = std::round(rowD);


    double value;
    band->getValue(col, row, value);

    return value;
}
开发者ID:TerraMA2,项目名称:terrama2,代码行数:28,代码来源:RiscoDeFogo.cpp

示例4: hdf5_read

static unsigned hdf5_read(ndio_t file, nd_t dst)
{ ndio_hdf5_t self=(ndio_hdf5_t)ndioContext(file);
  HTRY(H5Dread(dataset(self),dtype(self),H5S_ALL,H5S_ALL,H5P_DEFAULT,nddata(dst)));
  return 1;
Error:
  return 0;
}
开发者ID:TeravoxelTwoPhotonTomography,项目名称:ndio-hdf5,代码行数:7,代码来源:ndio-hdf5.c

示例5: dataset

	void ANNWrapper::SetPoints(const std::vector <openMVG::Vec3f> &P)
	{

		dataset = openMVG::Matf(P.size(), dim);
		m_nnidx = Eigen::VectorXi(m_k);						// allocate near neigh indices
		m_dists = new KFLANN::DistanceType[m_k];		// allocate near neighbor m_dists

		for (unsigned int i = 0; i < P.size(); i++)
		{
			dataset(i, 0) = P.at(i).x();
			dataset(i, 1) = P.at(i).y();
			dataset(i, 2) = P.at(i).z();
		}

		matcher.Build(dataset.data(), P.size(), dim);
	}
开发者ID:caomw,项目名称:MvgSoft,代码行数:16,代码来源:ANNWrapper.cpp

示例6: QMainWindow

/******************************************************************************
* Is called when the user presses the "Open Inspector" button.
******************************************************************************/
void DislocationNetworkEditor::onOpenInspector()
{
	DislocationNetwork* dislocationsObj = static_object_cast<DislocationNetwork>(editObject());
	if(!dislocationsObj) return;

	QMainWindow* inspectorWindow = new QMainWindow(container()->window(), (Qt::WindowFlags)(Qt::Tool | Qt::CustomizeWindowHint | Qt::WindowMaximizeButtonHint | Qt::WindowCloseButtonHint));
	inspectorWindow->setWindowTitle(tr("Dislocation Inspector"));
	PropertiesPanel* propertiesPanel = new PropertiesPanel(inspectorWindow);
	propertiesPanel->hide();

	QWidget* mainPanel = new QWidget(inspectorWindow);
	QVBoxLayout* mainPanelLayout = new QVBoxLayout(mainPanel);
	mainPanelLayout->setStretch(0,1);
	mainPanelLayout->setContentsMargins(0,0,0,0);
	inspectorWindow->setCentralWidget(mainPanel);

	ObjectNode* node = dynamic_object_cast<ObjectNode>(dataset()->selection()->front());
	DislocationInspector* inspector = new DislocationInspector(node);
	connect(inspector, &QObject::destroyed, inspectorWindow, &QMainWindow::close);
	inspector->setParent(propertiesPanel);
	inspector->initialize(propertiesPanel, mainWindow(), RolloutInsertionParameters().insertInto(mainPanel));
	inspector->setEditObject(dislocationsObj);
	inspectorWindow->setAttribute(Qt::WA_DeleteOnClose);
	inspectorWindow->resize(1000, 350);
	inspectorWindow->show();
}
开发者ID:bitzhuwei,项目名称:OVITO_sureface,代码行数:29,代码来源:DislocationNetwork.cpp

示例7: buildIndex_

template<typename Distance, typename IndexType> void
buildIndex_(void*& index, const Mat& data, const IndexParams& params, const Distance& dist = Distance())
{
    typedef typename Distance::ElementType ElementType;
    if(DataType<ElementType>::type != data.type())
        CV_Error_(Error::StsUnsupportedFormat, ("type=%d\n", data.type()));
    if(!data.isContinuous())
        CV_Error(Error::StsBadArg, "Only continuous arrays are supported");

    ::cvflann::Matrix<ElementType> dataset((ElementType*)data.data, data.rows, data.cols);
    IndexType* _index = new IndexType(dataset, get_params(params), dist);

    try
    {
        _index->buildIndex();
    }
    catch (...)
    {
        delete _index;
        _index = NULL;

        throw;
    }

    index = _index;
}
开发者ID:AnnaPetrovicheva,项目名称:opencv,代码行数:26,代码来源:miniflann.cpp

示例8: dataset

/******************************************************************************
* Is called when the user has selected a certain frame in the frame list box.
******************************************************************************/
void FileSourceEditor::onFrameSelected(int index)
{
	FileSource* obj = static_object_cast<FileSource>(editObject());
	if(!obj) return;

	dataset()->animationSettings()->setTime(obj->inputFrameToAnimationTime(index));
}
开发者ID:taohonker,项目名称:Ovito,代码行数:10,代码来源:FileSourceEditor.cpp

示例9: SearchResult

/**
 * @brief TestAlgorithm::run start the search
 * @return a list of data packets containing results
 */
QList<DataPacket*> TestAlgorithm::run() {
    QList<DataPacket*> list;
    SearchResult* result = new SearchResult();
    list.append(dynamic_cast<DataPacket*>(result));

    for (QString& datasetPath : mQuery->getDatasets()) {
        Dataset dataset(datasetPath);

        for (Medium* medium : dataset.getMediaList()) {
            if (mCancel == true) {
                return list;
            }

            SearchObject* object = new SearchObject();
            object->setMedium(medium->getPath());
            object->setSourceDataset(dataset.getPath());

            //new result element
            SearchResultElement* resultElement = new SearchResultElement();
            resultElement->setSearchObject(*object);
            resultElement->setScore(std::rand() % 20);

            //add to result list
            result->addResultElement(*resultElement);
        }
    }
    QThread::msleep(1500);
    return list;
}
开发者ID:aschuman,项目名称:CoBaB,代码行数:33,代码来源:TestAlgorithm.cpp

示例10: main

// Calculates log-loss of a dataset using ffm-native-ops C++ library (without GPU).
//
// Arguments:
//  --datasetPath <path> (--binModelPath | --textModelPath) <path> [--samplingFactor <float>] 
int main(int argc, const char ** argv)
{
    Options const & options = parseOptions(argvToArgs(argc, argv));

    Dataset dataset(options.datasetPath);
    Model model(dataset.numFields);
    if (!options.binModelPath.empty()) {
        model.binaryDeserialize(options.binModelPath);
    } else {
        model.importModel(options.textModelPath);
    }

    LogLossCalculator logLossCalc(options.samplingFactor);

    for (int64_t sampleIdx = 0; dataset.hasNext(); ++sampleIdx) {
        Dataset::Sample const & sample = dataset.next();
        float t = ffmPredict(model.weights.data(), dataset.numFields, sample.data());
        int y = sample.back() > 0 ? 1 : -1;
        logLossCalc.update(t, y);
        std::cout << sampleIdx << " " << y << " " << t << std::endl;
    }

    std::cout << "Log-loss: " << logLossCalc.get() << std::endl;

    return 0;
}
开发者ID:RTBHOUSE,项目名称:cuda-ffm,代码行数:30,代码来源:predict.cpp

示例11: BOOST_ASSERT

hdf5_iprimitive::read_hdf5_dataset
(
    std::wstring* t,
    std::size_t data_count,
    std::size_t object_number
)
{
    BOOST_ASSERT(data_count == 1);
    std::string path = create_object_data_path(object_number);
    hdf5_dataset dataset(*file_, path);
    hdf5_datatype datatype(dataset);

    // If you can think of a better way to store wchar_t/wstring objects in HDF5, be my guest...
    size_t size = datatype.get_size();

	BOOST_ASSERT(size >= sizeof(wchar_t));
    std::size_t string_size = size / sizeof(wchar_t) - 1;

	t->resize(string_size);
	if(string_size) {
		std::vector<wchar_t> buffer(string_size + 1);
		dataset.read(datatype, &buffer[0]);

        t->replace(0, string_size, &buffer[0], string_size);
	}

    datatype.close();
    dataset.close();
}
开发者ID:warn-naught,项目名称:serialization,代码行数:29,代码来源:hdf5_iprimitive.cpp

示例12: main

int main(int argc, char* argv[]) { 

  if( argc != 4 && argc != 5 ) {
    std::cout << "USAGE: ./do2ndLevel_PhotonJet_batch [dataset] [inputFileList] [flags] [useGenJets=false]" << std::endl;
    exit(23);
  }


  std::string dataset(argv[1]);
  std::string inputFileList(argv[2]);
  std::string flags(argv[3]);
  bool useGenJets = false;

  if( argc == 5 ) {
    std::string useGenJets_str(argv[4]);
    if( useGenJets_str=="true" ) useGenJets = true;
  }

  TRegexp run2010("Run2010");
  TRegexp run2011("Run2011");
  TRegexp run2012("Run2012");
  TString dataset_str(dataset);
  
  if( dataset_str.Contains(run2010) || dataset_str.Contains(run2011) || dataset_str.Contains(run2012) ) { // then it's data
    doSingleLoop(inputFileList, dataset, flags, (bool)true, (bool)false);
  } else {
    doSingleLoop(inputFileList, dataset, flags, (bool)false, useGenJets);
  }


}
开发者ID:amarini,项目名称:pandolf,代码行数:31,代码来源:do2ndLevel_PhotonJet.cpp

示例13: project

bool Print::print(const QStringList &commands, State &state)
{
    if (commands.isEmpty()) {
        std::cout << QObject::tr("print requires a dataset to be named").toStdString() << std::endl;
        return true;
    }

    const QString datasetName = commands.first();

    QDir project(state.projectPath());
    Dataset dataset(datasetName, state);

    if (!dataset.isValid()) {
        std::cout << QObject::tr("The dataset %1 could not be loaded; try checking it with the check command").arg(datasetName).toStdString() << std::endl;
        return true;
    }

    QStringList cols;
    if (commands.size() > 1) {
        cols = commands;
        cols.removeFirst();
    }

    std::cout << dataset.tableHeaders(cols).toStdString() << std::endl;

    dataset.eachRow(
        [cols](const Dataset::Row &row) {
            std::cout << row.toString(cols).toStdString() << std::endl;
        });
    return true;
}
开发者ID:KDE,项目名称:sink,代码行数:31,代码来源:print.cpp

示例14: dataset

/******************************************************************************
* Replaces the particle selection.
******************************************************************************/
void ParticleSelectionSet::setParticleSelection(const PipelineFlowState& state, const QBitArray& selection, SelectionMode mode)
{
	// Make a backup of the old snapshot so it may be restored.
	if(dataset()->undoStack().isRecording())
		dataset()->undoStack().push(new ReplaceSelectionOperation(this));

	ParticlePropertyObject* identifierProperty = ParticlePropertyObject::findInState(state, ParticleProperty::IdentifierProperty);
	if(identifierProperty && useIdentifiers()) {
		OVITO_ASSERT(selection.size() == identifierProperty->size());
		_selection.clear();
		int index = 0;
		if(mode == SelectionReplace) {
			_selectedIdentifiers.clear();
			for(int id : identifierProperty->constIntRange()) {
				if(selection.testBit(index++))
					_selectedIdentifiers.insert(id);
			}
		}
		else if(mode == SelectionAdd) {
			for(int id : identifierProperty->constIntRange()) {
				if(selection.testBit(index++))
					_selectedIdentifiers.insert(id);
			}
		}
		else if(mode == SelectionSubtract) {
			for(int id : identifierProperty->constIntRange()) {
				if(selection.testBit(index++))
					_selectedIdentifiers.remove(id);
			}
		}
	}
	else {
		_selectedIdentifiers.clear();
		if(mode == SelectionReplace)
			_selection = selection;
		else if(mode == SelectionAdd) {
			_selection.resize(selection.size());
			_selection |= selection;
		}
		else if(mode == SelectionSubtract) {
			_selection.resize(selection.size());
			_selection &= ~selection;
		}
	}

	notifyDependents(ReferenceEvent::TargetChanged);
}
开发者ID:bitzhuwei,项目名称:OVITO_sureface,代码行数:50,代码来源:ParticleSelectionSet.cpp

示例15: annotate_paint

static void annotate_paint(SkPaint& paint, const char* key, SkData* value) {
    SkAutoTUnref<SkDataSet> dataset(SkNEW_ARGS(SkDataSet, (key, value)));
    SkAnnotation* ann = SkNEW_ARGS(SkAnnotation, (dataset,
                                                  SkAnnotation::kNoDraw_Flag));

    paint.setAnnotation(ann)->unref();
    SkASSERT(paint.isNoDrawAnnotation());
}
开发者ID:ConradIrwin,项目名称:gecko-dev,代码行数:8,代码来源:SkAnnotation.cpp


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