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


C++ cells函数代码示例

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


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

示例1: qStableSort

bool ShiftManipulator::preProcessing()
{
    if (m_firstrun) {
        // If we have an NCS, create a child command for each element.
        if (cells().count() > 1) { // non-contiguous selection
            // Sort the elements by their top row.
            if (m_direction == ShiftBottom) {
                qStableSort(cells().begin(), cells().end(), topRowLessThan);
            } else { // ShiftRight
                qStableSort(cells().begin(), cells().end(), leftColumnLessThan);
            }
            // Create sub-commands.
            const KCRegion::ConstIterator end(constEnd());
            for (KCRegion::ConstIterator it = constBegin(); it != end; ++it) {
                ShiftManipulator *const command = new ShiftManipulator(this);
                command->setSheet(m_sheet);
                command->add(KCRegion((*it)->rect(), (*it)->sheet()));
                if (m_mode == Delete) {
                    command->setReverse(true);
                }
                command->setDirection(m_direction);
            }
        } else { // contiguous selection
            m_sheet->cellStorage()->startUndoRecording();
        }
    }
    return KCAbstractRegionCommand::preProcessing();
}
开发者ID:KDE,项目名称:koffice,代码行数:28,代码来源:DataManipulators.cpp

示例2: cells

Bitmap FCSVisualizer::visualizeDensity(const FCSFile &file, const FCSProcessor &processor, int axisA, int axisB, int imageSize, int clusterFilter, const QuartileRemap &params)
{
    Grid2f cells(imageSize, imageSize, 0.0f);
    const int borderSize = 1;

    for (const MathVectorf &sample : file.transformedSamples)
    {
        if (clusterFilter != -1 && processor.clustering.getClusterIndex(sample) != clusterFilter)
            continue;

        vec2f v;
        v.x = sample[axisA];
        v.y = 1.0f - sample[axisB];

        //if (v.x < 0.0f || v.y < 0.0f || v.x > 1.0f || v.y > 1.0f) cout << "bounds: " << v << endl;

        vec2i coord = math::round(v * (float)imageSize);
        if (cells.isValidCoordinate(coord) &&
                coord.x >= borderSize && coord.x < imageSize - borderSize &&
                coord.y >= borderSize && coord.y < imageSize - borderSize)
        {
            cells(coord)++;
        }
    }

    QuartileRemap paramsFinal = params;
    if (params.quartiles.size() == 0)
    {
        vector<float> nonzeroValues;
        for (auto &v : cells)
            if (v.value > 1.0f) nonzeroValues.push_back(v.value);
        std::sort(nonzeroValues.begin(), nonzeroValues.end());

        if (nonzeroValues.size() == 0)
            nonzeroValues.push_back(1.0f);

        paramsFinal.quartiles.resize(8);
        paramsFinal.quartiles[0] = 0.0f;
        paramsFinal.quartiles[1] = nonzeroValues[(int)(nonzeroValues.size() * 0.2f)];
        paramsFinal.quartiles[2] = nonzeroValues[(int)(nonzeroValues.size() * 0.4f)];
        paramsFinal.quartiles[3] = nonzeroValues[(int)(nonzeroValues.size() * 0.6f)];
        paramsFinal.quartiles[4] = nonzeroValues[(int)(nonzeroValues.size() * 0.7f)];
        paramsFinal.quartiles[5] = nonzeroValues[(int)(nonzeroValues.size() * 0.85f)];
        paramsFinal.quartiles[6] = nonzeroValues[(int)(nonzeroValues.size() * 0.98f)];
        paramsFinal.quartiles[7] = nonzeroValues.back();
        //params.quartiles = { 0.0f, 3.0f, 6.0f, 12.0f, 20.0f, 50.0f, 200.0f, 400.0f };
        //paramsFinal.print();
    }

    Bitmap result(imageSize, imageSize);
    for (auto &v : cells)
    {
        float intensity = paramsFinal.transform(v.value) * 255.0f;
        unsigned char c = util::boundToByte(intensity);
        result(v.x, v.y) = vec4uc(c, c, c, 255);
    }
    return result;
}
开发者ID:techmatt,项目名称:LucidFlow,代码行数:58,代码来源:FCSVisualizer.cpp

示例3: Error

void Maze::setWall(pointT p1, pointT p2, bool state)
{
	if (!pointInBounds(p1) || !pointInBounds(p2))
		Error("Point is not in bounds for maze");
	cells(p1.row, p1.col).walls[neighborDir(p1, p2)] = state;
	cells(p2.row, p2.col).walls[neighborDir(p2, p1)] = state;
	if (!configured) configureGraphics();
	drawWallsForCell(p1);
	UpdateDisplay();
}
开发者ID:roles,项目名称:toy_program,代码行数:10,代码来源:maze.cpp

示例4: MovePen

void Maze::drawWallsForCell(pointT p)
{
	MovePen(originX + p.col*cellSize, originY + p.row*cellSize);
	SetPenColor(cells(p.row, p.col).walls[South] ? "Black" : "White");
	DrawLine(cellSize, 0);
	SetPenColor(cells(p.row, p.col).walls[East] ? "Black" : "White");
	DrawLine(0, cellSize);
	SetPenColor(cells(p.row, p.col).walls[North] ? "Black" : "White");
	DrawLine(-cellSize, 0);
	SetPenColor(cells(p.row, p.col).walls[West] ? "Black" : "White");
	DrawLine(0, -cellSize);
}
开发者ID:roles,项目名称:toy_program,代码行数:12,代码来源:maze.cpp

示例5: density

Foam::List<Foam::FixedList<Foam::label, 8>> Foam::block::cells() const
{
    const label ni = density().x();
    const label nj = density().y();
    const label nk = density().z();

    List<FixedList<label, 8>> cells(nCells());

    label celli = 0;

    for (label k=0; k<nk; k++)
    {
        for (label j=0; j<nj; j++)
        {
            for (label i=0; i<ni; i++)
            {
                cells[celli][0] = pointLabel(i,   j,   k);
                cells[celli][1] = pointLabel(i+1, j,   k);
                cells[celli][2] = pointLabel(i+1, j+1, k);
                cells[celli][3] = pointLabel(i,   j+1, k);
                cells[celli][4] = pointLabel(i,   j,   k+1);
                cells[celli][5] = pointLabel(i+1, j,   k+1);
                cells[celli][6] = pointLabel(i+1, j+1, k+1);
                cells[celli][7] = pointLabel(i,   j+1, k+1);

                celli++;
            }
        }
    }

    return cells;
}
开发者ID:mattijsjanssens,项目名称:OpenFOAM-dev,代码行数:32,代码来源:blockCreate.C

示例6: cells

Eigen::MatrixXd
TargetField::as_cells() const {
  Eigen::MatrixXd cells(num_cells_, num_cells_);
  cells.setZero();

  return cells;
};
开发者ID:T-R0D,项目名称:Past-Courses,代码行数:7,代码来源:target_field.cpp

示例7: exception

	bool HyperBlockingAsyncResult::publishResult( ResultPtr& result, Common::AsyncResultSink* asyncResultSink ) {
		if( result->is_error() ) {
			future->cancel();
			int error;
			String error_msg;
			result->get_error( error, error_msg );
			Common::HypertableException exception( error, error_msg );
			asyncResultSink->failure( exception );
			throw exception;
		}
		else if( result->is_scan() ) {
			Hypertable::Cells _cells;
			result->get_cells( _cells );
			Common::Cells cells( &_cells );
			switch( asyncResultSink->scannedCells(reinterpret_cast<int64_t>(result->get_scanner()), cells) ) {
				case Common::ACR_Cancel:
						result->get_scanner()->cancel();
						break;
					case Common::ACR_Abort:
						future->cancel();
						return false;
					default:
						break;
			}
			return true;
		}
		return true;
	}
开发者ID:andysoftdev,项目名称:ht4c,代码行数:28,代码来源:HyperBlockingAsyncResult.cpp

示例8: max

Foam::labelList Foam::meshToMesh::maskCells
(
    const polyMesh& src,
    const polyMesh& tgt
) const
{
    boundBox intersectBb
    (
        max(src.bounds().min(), tgt.bounds().min()),
        min(src.bounds().max(), tgt.bounds().max())
    );

    intersectBb.inflate(0.01);

    const cellList& srcCells = src.cells();
    const faceList& srcFaces = src.faces();
    const pointField& srcPts = src.points();

    DynamicList<label> cells(src.size());
    forAll(srcCells, srcI)
    {
        boundBox cellBb(srcCells[srcI].points(srcFaces, srcPts), false);
        if (intersectBb.overlaps(cellBb))
        {
            cells.append(srcI);
        }
    }
开发者ID:mattijsjanssens,项目名称:mattijs-extensions,代码行数:27,代码来源:meshToMesh.C

示例9: extract_seed_points

  void extract_seed_points( MeshSegmentT const & mesh, SeedPointContainerT & seed_points )
  {
    typedef typename viennagrid::result_of::cell_id<MeshSegmentT>::type CellIDType;
    typedef typename viennagrid::result_of::const_cell_handle<MeshSegmentT>::type ConstCellHandleType;

    typedef typename viennagrid::result_of::const_cell_range<MeshSegmentT>::type CellRangeType;
    typedef typename viennagrid::result_of::iterator<CellRangeType>::type CellIteratorType;

    CellRangeType cells(mesh);

    if (!cells.empty())
    {
      typedef std::map<CellIDType, ConstCellHandleType> UnvisitedCellMapType;
      UnvisitedCellMapType unvisited_cells;

      for (CellIteratorType cit = cells.begin(); cit != cells.end(); ++cit)
        unvisited_cells[ cit->id() ] = cit.handle();

      while (!unvisited_cells.empty())
      {
        for (CellIteratorType cit = cells.begin(); cit != cells.end(); ++cit)
        {
          typename UnvisitedCellMapType::iterator ucit = unvisited_cells.find( cit->id() );
          if (ucit == unvisited_cells.end())
            continue;

          seed_points.push_back( viennagrid::centroid(*cit) );
          unvisited_cells.erase( ucit );

          neighbor_mark( mesh, unvisited_cells );
        }
      }
    }
  }
开发者ID:masteroftime,项目名称:viennagrid-dev,代码行数:34,代码来源:extract_seed_points.hpp

示例10: cells

Foam::tmp<Foam::Field<Type> > Foam::cuttingPlane::sample
(
    const Field<Type>& sf
) const
{
    return tmp<Field<Type> >(new Field<Type>(sf, cells()));
}
开发者ID:Unofficial-Extend-Project-Mirror,项目名称:openfoam-extend-Core-OpenFOAM-1.5-dev,代码行数:7,代码来源:cuttingPlaneSample.C

示例11: table

void PooledPointTable::reset()
{
    BinaryPointTable table(m_schema);
    pdal::PointRef pointRef(table, 0);

    assert(m_cellNodes.size() >= outstanding());
    Cell::PooledStack cells(m_cellNodes.pop(outstanding()));

    for (auto& cell : cells)
    {
        auto data(m_dataNodes.popOne());
        table.setPoint(*data);

        if (m_origin != invalidOrigin)
        {
            pointRef.setField(pdal::Dimension::Id::PointId, m_index);
            pointRef.setField(pdal::Dimension::Id::OriginId, m_origin);
            ++m_index;
        }

        cell.set(pointRef, std::move(data));
    }

    cells = m_process(std::move(cells));
    for (auto& cell : cells) m_dataNodes.push(cell.acquire());
    m_cellNodes.push(std::move(cells));

    allocate();
}
开发者ID:gadomski,项目名称:entwine,代码行数:29,代码来源:pooled-point-table.cpp

示例12: get_target

Cell_Target Targets::cell_target(const Label & label) const
{
    const Target & target = get_target(label);

    // check if target compatible with cells object
    if (target.type() != CELL_TARGET && target.type() != NESTED_TARGET)
    {
        throw Target_Not_Found(
            "Conversion of Target object to Cell_Target object failed. "
            "Target type incompatible with a Neurons object");
    }

    Cell_Target cells(label);
    
    // insert the cell ids of the cell target into cells object
    std::vector<Cell_GID> cell_members;
    target.get_all_gids( cell_members );
    
    for ( unsigned int cellIndex=0; 
        cellIndex < cell_members.size(); cellIndex++ )
    {
        cells.insert( cell_members[cellIndex] );
    }
    
    return cells;
}
开发者ID:yonggang985,项目名称:Touch,代码行数:26,代码来源:Targets.cpp

示例13: cells

int Picker::restoreOpenCategories(const std::list<std::list<std::string> >& idList) {
	int numRestored=0;
	PickerCell *selectedCell = NULL;
	for (std::list<std::list<std::string> >::const_iterator catIt = idList.begin();
		 catIt!=idList.end();
		 ++catIt) {
		PickerCells *celllist = cells();
		for (std::list<std::string>::const_iterator travIt = (*catIt).begin();
			 travIt!=(*catIt).end();
			 ++travIt) {
			PickerCell *cell = celllist->cellWithId((*travIt));
			if (!cell) {
				break;
			}
			celllist = cell->children();
			if (!celllist || celllist->count() == 0) {
				selectedCell = cell;
				break;
			}
			cell->setHideChildren(false);
		}
	}
	
	setMustRecalc();
	if (selectedCell) {
		selectCell(selectedCell, true);
	}
	return numRestored;
}
开发者ID:bsmr-games,项目名称:Privateer-Gemini-Gold,代码行数:29,代码来源:picker.cpp

示例14: create_mapping

  long create_mapping(DeviceType const & device,
                      viennashe::unknown_quantity<VertexT> & quantity,
                      long start_index = 0)
  {
    typedef typename DeviceType::mesh_type           MeshType;

    typedef typename viennagrid::result_of::const_cell_range<MeshType>::type      CellContainer;
    typedef typename viennagrid::result_of::iterator<CellContainer>::type         CellIterator;

    //
    // Run the mapping on allowed vertices
    //
    long mapping_index = start_index;

    CellContainer cells(device.mesh());
    for (CellIterator cit = cells.begin();
        cit != cells.end();
        ++cit)
    {
      if ( quantity.get_boundary_type(*cit) != BOUNDARY_DIRICHLET && quantity.get_unknown_mask(*cit) )  // Dirichlet boundary condition
        quantity.set_unknown_index(*cit, mapping_index++);
      else
        quantity.set_unknown_index(*cit, -1);
    }

    return mapping_index;
  } //create_mapping
开发者ID:viennashe,项目名称:viennashe-dev,代码行数:27,代码来源:mapping.hpp

示例15: call

        int call(std::vector<int> const& v) {
            if (amx && fn) {
                int rezult;
                std::vector<cell> cells(v.size() + 1);

                //precall
                cells[0] = v.size() * sizeof(cell);
                for (std::size_t param_id = 0, len = v.size(); param_id < len; ++param_id) {
                    cell* phys_addr;
                    amx_Allot(amx, 1, &cells[param_id + 1], &phys_addr);
                    *phys_addr = v[param_id];
                }
                //call
                rezult = fn(amx, &cells[0]);

                //postcall
                for (std::size_t param_id = 0, len = v.size(); param_id < len; ++param_id) {
                    amx_Release(amx, cells[param_id + 1]);
                }

                return rezult;
            }
            else {
                assert(false && "error call null amx");
                return -1;
            }
        }
开发者ID:streloksps,项目名称:gta-paradise-sa,代码行数:27,代码来源:pawn_marshaling.hpp


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