本文整理汇总了C++中cells函数的典型用法代码示例。如果您正苦于以下问题:C++ cells函数的具体用法?C++ cells怎么用?C++ cells使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了cells函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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 ¶ms)
{
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
示例16: cells
template<class T> cv::Mat minchinton::filter2d(const cv::Mat &data, size_t w) {
cv::Mat cells(data.size(), CV_8U);
size_t u = w / 2;
for (size_t i = 0, m = data.rows; i < m; i++) {
for (size_t j = 0, n = data.cols; j < n; j++) {
size_t x = (j < u ? j : j - u);
size_t y = (i < u ? i : i - u);
size_t width = (x + w > n ? n - x : w);
size_t height = (y + w > m ? m - y : w);
cv::Rect roi(x, y, width, height);
cv::Mat patch(data, roi);
cv::Mat mean;
cv::Mat stdev;
cv::meanStdDev(patch, mean, stdev);
T val = data.at<T>(i, j);
T avg = mean.at<T>(0);
T std = stdev.at<T>(0);
cells.at<uchar>(i, j) = (fabs(val - avg) > std ? 255 : 0);
}
}
return cells;
}
开发者ID:lessc0de,项目名称:Clarus,代码行数:28,代码来源:minchinton.hpp
示例17: cells
int Grid::getNumLiveNeighbors(int x, int y) const
{
int numLiveNeighbors = 0;
// Copy of cells with padding so that we don't have to check
// if the cell is on one of the edges, just check (x-1,y-1) to (x+1,y+1),
// not including itself (x,y)
// Create a temp copy of the cells array
std::vector<std::vector<int>> cells(NUM_CELLS + 2, std::vector<int>(NUM_CELLS + 2, 0));
for (int i = 0; i < NUM_CELLS; ++i)
{
for (int j = 0; j < NUM_CELLS; ++j)
{
cells[i+1][j+1] = m_Cells[i][j];
}
}
int offsetX = x + 1;
int offsetY = y + 1;
if (cells[offsetX][offsetY-1] == 1) ++numLiveNeighbors; // North
if (cells[offsetX+1][offsetY-1] == 1) ++numLiveNeighbors; // North East
if (cells[offsetX+1][offsetY] == 1) ++numLiveNeighbors; // East
if (cells[offsetX+1][offsetY+1] == 1) ++numLiveNeighbors; // South East
if (cells[offsetX][offsetY+1] == 1) ++numLiveNeighbors; // South
if (cells[offsetX-1][offsetY+1] == 1) ++numLiveNeighbors; // South West
if (cells[offsetX-1][offsetY] == 1) ++numLiveNeighbors; // West
if (cells[offsetX-1][offsetY-1] == 1) ++numLiveNeighbors; // North West
return numLiveNeighbors;
}
开发者ID:jhpy1024,项目名称:GameOfLife,代码行数:32,代码来源:Grid.cpp
示例18: init_device
void init_device(DeviceType & device, double voltage)
{
typedef typename DeviceType::mesh_type MeshType;
// STEP 2: Set doping
std::cout << "* init_device(): Setting doping..." << std::endl;
device.set_doping_n(1e28);
device.set_doping_p(1e4);
device.set_material(viennashe::materials::si());
typedef typename viennagrid::result_of::const_cell_range<MeshType>::type CellContainer;
// STEP 3: Define contacts
double gnd = 0.0;
double vcc = voltage;// * 2.0;
CellContainer cells(device.mesh());
if (cells.size() < 3) throw std::runtime_error("The Mesh is too small. It contains less than 3 cells!");
device.set_contact_potential(gnd, cells[0]);
device.set_material(viennashe::materials::metal(), cells[0]);
device.set_contact_potential(vcc, cells[cells.size()-1]);
device.set_material(viennashe::materials::metal(), cells[cells.size()-1]);
}
开发者ID:viennashe,项目名称:viennashe-dev,代码行数:27,代码来源:simple_impurity_scattering.cpp
示例19: cells
void TransportSolverTwophaseReorder::solveGravity(const double* porevolume,
const double dt,
TwophaseState& state)
{
// Initialize mobilities.
const int nc = grid_.number_of_cells;
std::vector<int> cells(nc);
for (int c = 0; c < nc; ++c) {
cells[c] = c;
}
mob_.resize(2*nc);
props_.relperm(cells.size(), &state.saturation()[0], &cells[0], &mob_[0], 0);
const double* mu = props_.viscosity();
for (int c = 0; c < nc; ++c) {
mob_[2*c] /= mu[0];
mob_[2*c + 1] /= mu[1];
}
// Set up other variables.
porevolume_ = porevolume;
dt_ = dt;
toWaterSat(state.saturation(), saturation_);
// Solve on all columns.
int num_iters = 0;
for (std::vector<std::vector<int> >::size_type i = 0; i < columns_.size(); i++) {
// std::cout << "==== new column" << std::endl;
num_iters += solveGravityColumn(columns_[i]);
}
std::cout << "Gauss-Seidel column solver average iterations: "
<< double(num_iters)/double(columns_.size()) << std::endl;
toBothSat(saturation_, state.saturation());
}
开发者ID:GitPaean,项目名称:opm-core,代码行数:34,代码来源:TransportSolverTwophaseReorder.cpp
示例20: create_mapping
long create_mapping(LinPdeSysT & pde_system,
std::size_t pde_index,
DomainType const & domain,
QuantityContainerT & quantities,
long start_index = 0)
{
typedef typename viennagrid::result_of::cell<DomainType>::type CellTag;
typedef typename viennagrid::result_of::const_element_range<DomainType, CellTag>::type CellContainer;
typedef typename viennagrid::result_of::iterator<CellContainer>::type CellIterator;
typedef typename QuantityContainerT::value_type QuantityType;
long map_index = start_index;
long unknown_id = pde_system.unknown(pde_index)[0].id();
QuantityType & quan = quantities.at(unknown_id);
CellContainer cells(domain);
for (CellIterator cit = cells.begin(); cit != cells.end(); ++cit)
{
if (quan.get_unknown_mask(*cit)) // quantity is set to unknown here, so it gets an unknown index assigned
{
quan.set_unknown_index(*cit, map_index);
map_index += pde_system.unknown(pde_index).size();
}
else
quan.set_unknown_index(*cit, -1);
}
return map_index;
}
开发者ID:TrojanXu,项目名称:viennafvm-dev,代码行数:33,代码来源:mapping.hpp
注:本文中的cells函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论