本文整理汇总了C++中cv函数的典型用法代码示例。如果您正苦于以下问题:C++ cv函数的具体用法?C++ cv怎么用?C++ cv使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了cv函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: createCompleteDocument
void KisKraSaveXmlVisitorTest::testCreateDomDocument()
{
KisDocument* doc = createCompleteDocument();
quint32 count = 0;
QDomDocument dom;
QDomElement image = dom.createElement("IMAGE"); // Legacy!
KisSaveXmlVisitor visitor(dom, image, count, "", true);
Q_ASSERT(doc->image());
QStringList list;
doc->image()->lock();
KisCountVisitor cv(list, KoProperties());
doc->image()->rootLayer()->accept(cv);
doc->image()->rootLayer()->accept(visitor);
QCOMPARE((int)visitor.m_count, (int)cv.count());
//delete doc;
}
示例2: cv
/**
* Get the number of vertices emanating from this vertex.
* Get a count of laths representing the vertices emanating from the vertex
* this lath represents.
*
* @return Count of laths.
*/
TqInt CqLath::cQvv() const
{
TqInt c = 1; // Start with this
// Laths representing the edges that radiate from the associated vertex are obtained by
// following the clockwise vertex links around the vertex.
CqLath* pNext = cv();
const CqLath* pLast = this;
while(NULL != pNext && this != pNext)
{
c++;
pLast = pNext;
pNext = pNext->cv();
}
// If we hit a boundary, add the ec of this boundary edge and start again going backwards.
// @warning Adding ccf for the boundary edge means that the lath represents a different vertex.
if(NULL == pNext)
{
pLast = this;
pNext = ccv();
// We know we are going to hit a boundary in this direction as well so we can just look for that
// case as a terminator.
while(NULL != pNext)
{
assert( pNext != this );
c++;
pLast = pNext;
pNext = pNext->ccv();
}
// We have hit the boundary going the other way, so add the ccf of this boundary edge.
c++;
}
return( c );
}
示例3: cQvf
/**
* Get the facets which share this vertex.
* Get a list of laths which represent the facets which share the vertex this
* lath represents.
*
* @return Pointer to an array of lath pointers.
*/
void CqLath::Qvf(std::vector<const CqLath*>& Result) const
{
TqInt len = cQvf();
const CqLath* pNext = cv();
Result.resize(len);
TqInt index = 0;
// Laths representing the edges that radiate from the associated vertex are obtained by
// following the clockwise vertex links around the vertex.
const CqLath *pTmpLath = this;
Result[index++] = pTmpLath;
while(NULL != pNext && this != pNext)
{
Result[index++] = pNext;
pNext = pNext->cv();
}
// If we hit a boundary, start again going backwards.
if(NULL == pNext)
{
pNext = ccv();
// We know we are going to hit a boundary in this direction as well so we can just look for that
// case as a terminator.
while(NULL != pNext)
{
Result[index++] = pNext;
pNext = pNext->ccv();
}
}
}
示例4: setCoveragesByName
void SurfPhase::
setCoveragesByName(std::string cov) {
int kk = nSpecies();
int k;
compositionMap cc;
for (k = 0; k < kk; k++) {
cc[speciesName(k)] = -1.0;
}
parseCompString(cov, cc);
doublereal c;
vector_fp cv(kk, 0.0);
bool ifound = false;
for (k = 0; k < kk; k++) {
c = cc[speciesName(k)];
if (c > 0.0) {
ifound = true;
cv[k] = c;
}
}
if (!ifound) {
throw CanteraError("SurfPhase::setCoveragesByName",
"Input coverages are all zero or negative");
}
setCoverages(DATA_PTR(cv));
}
示例5: max_fs_arity
int max_fs_arity(const Constraint_Handle &c) {
int max_arity=0;
for(Constr_Vars_Iter cv(c); cv; cv++)
if((*cv).var->kind() == Global_Var)
max_arity = omega::max(max_arity,(*cv).var->get_global_var()->arity());
return max_arity;
}
示例6: TEST
TEST(CLConditionVariable, Multi_process_for_Shared_Cond)
{
CLSharedMemory *psm = new CLSharedMemory("test_for_multi_process_for_shared_cond", 16);
long *p = (long *)(psm->GetAddress());
*p = 0;
long *flag = (long *)(((char *)p) + 8);
*flag = 0;
CLEvent event("test_for_event_auto");
CLProcess *process = new CLProcess(new CLProcessFunctionForExec);
EXPECT_TRUE(process->Run((void *)"../test_for_exec/test_for_CLConditionVariable/main").IsSuccess());
CLMutex mutex("mutex_for_test_for_multi_process_for_shared_cond", MUTEX_USE_SHARED_PTHREAD);
CLConditionVariable cv("test_conditoin_variable_for_multiprocess");
{
CLCriticalSection cs(&mutex);
while(*flag == 0)
EXPECT_TRUE((cv.Wait(&mutex)).IsSuccess());
}
EXPECT_EQ(*p, 5);
EXPECT_TRUE(event.Wait().IsSuccess());
delete psm;
}
示例7: mark_cells_on_vertices
void mark_cells_on_vertices(VertexIt seed,
CellSeq& cell_seq,
EltMarker& visited,
int level,
CellPred inside)
{
typedef typename VertexIt::grid_type grid_type;
typedef GT gt;
typedef typename gt::Cell Cell;
typedef typename gt::Vertex Vertex;
typedef typename gt::CellOnVertexIterator CellOnVertexIterator;
while(! seed.IsDone()) {
Vertex V = *seed;
for(CellOnVertexIterator cv(V); ! cv.IsDone(); ++cv)
if( inside(*cv)) {
Cell C(*cv);
if(visited(C) == 0) {
visited[C] = level;
cell_seq.append(C);
}
}
++seed;
}
}
示例8: main
int main()
{
Vector3DFast av(4,-2,5);
Vector3DFast bv(2,5,-3);
Vector3DFast cv(0,0,0);
cv=av+bv;
}
示例9: xr
ExecStatus
Distinct<View0,View1>::post(Home home, View0 x, View1 y) {
if (x.assigned()) {
GlbRanges<View0> xr(x);
IntSet xs(xr);
ConstSetView cv(home, xs);
GECODE_ES_CHECK((DistinctDoit<View1>::post(home,y,cv)));
}
if (y.assigned()) {
GlbRanges<View1> yr(y);
IntSet ys(yr);
ConstSetView cv(home, ys);
GECODE_ES_CHECK((DistinctDoit<View0>::post(home,x,cv)));
}
(void) new (home) Distinct<View0,View1>(home,x,y);
return ES_OK;
}
示例10: Square
float CGameHelper::GuiTraceRay(const float3 &start, const float3 &dir, float length, CUnit*& hit, bool useRadar, CUnit* exclude)
{
if (dir == ZeroVector) {
return -1.0f;
}
// distance from start to ground intersection point + fudge
float groundLen = ground->LineGroundCol(start, start + dir * length);
float returnLenSq = Square( (groundLen > 0.0f)? groundLen + 200.0f: length );
hit = NULL;
CollisionQuery cq;
GML_RECMUTEX_LOCK(quad); // GuiTraceRay
vector<int> quads = qf->GetQuadsOnRay(start, dir, length);
vector<int>::iterator qi;
for (qi = quads.begin(); qi != quads.end(); ++qi) {
const CQuadField::Quad& quad = qf->GetQuad(*qi);
std::list<CUnit*>::const_iterator ui;
for (ui = quad.units.begin(); ui != quad.units.end(); ++ui) {
CUnit* unit = *ui;
if (unit == exclude) {
continue;
}
if ((unit->allyteam == gu->myAllyTeam) || gu->spectatingFullView ||
(unit->losStatus[gu->myAllyTeam] & (LOS_INLOS | LOS_CONTRADAR)) ||
(useRadar && radarhandler->InRadar(unit, gu->myAllyTeam))) {
CollisionVolume cv(unit->collisionVolume);
if (unit->isIcon) {
// for iconified units, just pretend the collision
// volume is a sphere of radius <unit->IconRadius>
cv.SetDefaultScale(unit->iconRadius);
}
if (CCollisionHandler::MouseHit(unit, start, start + dir * length, &cv, &cq)) {
// get the distance to the ray-volume egress point
// so we can still select stuff inside factories
const float len = (cq.p1 - start).SqLength();
if (len < returnLenSq) {
returnLenSq = len;
hit = unit;
}
}
}
}
}
return ((hit)? math::sqrt(returnLenSq): (math::sqrt(returnLenSq) - 200.0f));
}
示例11: compute_covariance
table< T > compute_covariance( const storage< T, L >& sto )
{
auto nchannels = sto.channel_size();
auto nframes = sto.frame_size();
auto means = compute_channel_means( sto );
table< T, L > cv( nchannels, nchannels );
for ( size_t row = 0; row < nchannels; ++row )
{
for ( size_t col = 0; col < nchannels; ++col )
{
T v = T( 0 );
for ( index_t i = 0; i < sto.frame_size(); ++i )
v += ( sto( i, row ) - means[ row ] ) * ( sto( i, col ) - means[ col ] );
cv( row, col ) = v / nframes;
}
}
return cv;
}
示例12: m_tree
clRowEntry::clRowEntry(clTreeCtrl* tree, const wxString& label, int bitmapIndex, int bitmapSelectedIndex)
: m_tree(tree)
, m_model(tree ? &tree->GetModel() : nullptr)
{
// Fill the verctor with items constructed using the _non_ default constructor
// to makes sure that IsOk() returns TRUE
m_cells.resize(m_tree->GetHeader()->empty() ? 1 : m_tree->GetHeader()->size(),
clCellValue("", -1, -1)); // at least one column
clCellValue cv(label, bitmapIndex, bitmapSelectedIndex);
m_cells[0] = cv;
}
示例13: cv
nsPagePrintTimer::~nsPagePrintTimer()
{
// "Destroy" the document viewer; this normally doesn't actually
// destroy it because of the IncrementDestroyRefCount call below
// XXX This is messy; the document viewer should use a single approach
// to keep itself alive during printing
nsCOMPtr<nsIContentViewer> cv(do_QueryInterface(mDocViewerPrint));
if (cv) {
cv->Destroy();
}
}
示例14: LOG_FATAL
void AgeLength::DoExecute() {
auto age_length = model_->managers().age_length()->FindAgeLength(age_length_label_);
if (!age_length)
LOG_FATAL() << "Could not find age_length " << age_length_label_ << " for the report";
unsigned min_age = model_->min_age();
unsigned max_age = model_->max_age();
unsigned year = model_->current_year();
unsigned time_steps = model_->time_steps().size();
// Print the header
cache_ << "*"<< type_ << "[" << label_ << "]" << "\n";
cache_ << "year: " << model_->current_year() << "\n";
cache_ << "time_step: " << time_step_ << "\n";
cache_ << "year time_step ";
for (unsigned age = min_age; age <= max_age; ++age)
cache_ << age << " ";
cache_ << "\n";
for (unsigned time_step = 0; time_step < time_steps; ++time_step) {
cache_ << year << " " << time_step << " ";
for (unsigned age = min_age; age <= max_age; ++age)
cache_ << age_length->cv(year, time_step, age) << " ";
cache_ << "\n";
}
cache_ << "\n\n";
cache_ << "year time_step ";
cache_ << "age ";
for (auto length : model_->length_bins())
cache_ << "L(" << length << ") ";
cache_ << "\n";
unsigned start_year = model_->start_year();
auto age_lengths = model_->partition().age_length_proportions(category_); // map<category, vector<year, time_step, age, length, proportion>>;
for (unsigned i = 0; i < age_lengths.size(); ++i) {
if (std::find(years_.begin(), years_.end(), i + start_year) != years_.end()) {
for (unsigned j = 0; j < age_lengths[i].size(); ++j) {
for (unsigned k = 0; k < age_lengths[i][j].size(); ++k) {
cache_ << (start_year + i) << " " << j << " " << (min_age + k) << " ";
for (unsigned l = 0; l < age_lengths[i][j][k].size(); ++l) {
cache_ << age_lengths[i][j][k][l] << " ";
}
cache_ << "\n";
}
}
}
}
ready_for_writing_ = true;
}
示例15: qData
vector<ContourIndex::ContourPointIdx> ContourIndex::kNearestNeighbors(int k, Contour::ContourPart contourPoint) {
vector<double> qData(numDimensions);
qData.push_back(contourPoint->x);
qData.push_back(contourPoint->y);
qData.push_back(contourPoint->gradientAngleSmooth.normalize().degree());
qData.push_back(contourPoint->curvature.normalize().degree());
SpatialIndex::Point query(&qData[0], numDimensions);
CollectIndicesVisitor cv(this);
tree->nearestNeighborQuery(k, query, cv);
return cv.result;
}