void NeiVertex::Print(){ SetCounters(); for(int v=0;v<NVert;v++){ printf("---- (%d) ----\n",Vertex[v].v); for(SetCounters(v);IfItCell(v);IncrCurr(v)){ printf("%d - ",VertCurr(v)); } printf("\n"); } SetCounters(); }
OpenSMOKEVector<T, IndexPolicy>::OpenSMOKEVector(const int n) { SetCounters(); Initialize(n); if(dimensions_ != 0) memset(vector_+this->index_, 0, dimensions_*sizeof(T)); }
OpenSMOKEVector<T, IndexPolicy>::OpenSMOKEVector(const int n, const T* values) { SetCounters(); Initialize(n); if(dimensions_ != 0) { T* w = vector_; w+=this->index_; memcpy(w, values, n*sizeof(T)); } }
OpenSMOKEVector<T, IndexPolicy>::OpenSMOKEVector(const int n, const T v1, ...) { SetCounters(); Initialize(n); T *w = vector_ + this->index_; va_list pointerList; va_start(pointerList, v1); *w = v1; for(int i=1+this->index_;i<n+this->index_;i++) *++w = va_arg(pointerList, T); va_end(pointerList); }
OpenSMOKEVector<T, IndexPolicy>::OpenSMOKEVector(const std::vector<T> values) { SetCounters(); Initialize(values.size()); if(dimensions_ != 0) { T* w = this->vector_; w+=this->index_; for (typename std::vector<T>::const_iterator it = values.begin(); it!=values.end(); ++it) { *w = *it; w++; } } }
OpenSMOKEVector<T, IndexPolicy>::OpenSMOKEVector(const int n, const int i, OpenSMOKEVector<T, IndexPolicy> const& rhs) { SetCounters(); Initialize(n); if(n > rhs.dimensions_-i+1) ErrorMessage("OpenSMOKEVector(const int n, const int i, OpenSMOKEVector<T, IndexPolicy> const& rhs) requires n<=rhs.dimensions-i+1"); if(dimensions_ != 0) { T* w = vector_; T* v = rhs.vector_; w+=this->index_; v += i; memcpy(w, v, n*sizeof(T)); } }
OpenSMOKEVector<T, IndexPolicy>::OpenSMOKEVector(OpenSMOKEVector<T, IndexPolicy> const& rval) { SetCounters(); Initialize(rval.dimensions_); Copy(rval); /* if(rval.shadow_ == false) { Initialize(rval.dimensions_); if(dimensions_ != 0) memcpy(vector_, rval.vector_, (dimensions_+this->index_)*sizeof(T)); } else { Initialize(0); OpenSMOKEVector<T, IndexPolicy> aux; aux = rval; Swap(this, &aux); count_--; whoAmI_ = aux.whoAmI_; } */ }
PerformanceCounterSelection::PerformanceCounterSelection(ICaptureContext &ctx, const QList<GPUCounter> &selectedCounters, QWidget *parent) : QDialog(parent), ui(new Ui::PerformanceCounterSelection), m_Ctx(ctx) { ui->setupUi(this); setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint); ui->counterTree->setColumns({QString()}); ui->counterTree->setHeaderHidden(true); connect(ui->counterTree, &RDTreeWidget::currentItemChanged, [this](RDTreeWidgetItem *item, RDTreeWidgetItem *) -> void { const QVariant d = item->data(0, CounterDescriptionRole); if(d.isValid()) { ui->counterDescription->setText( QString(lit("<b>%1</b><hr>%2")).arg(item->text(0)).arg(d.toString())); } }); connect(ui->save, &QPushButton::pressed, this, &PerformanceCounterSelection::Save); connect(ui->load, &QPushButton::pressed, this, &PerformanceCounterSelection::Load); connect(ui->sampleCounters, &QPushButton::pressed, this, &PerformanceCounterSelection::accept); connect(ui->cancel, &QPushButton::pressed, this, &PerformanceCounterSelection::reject); connect(ui->counterTree, &RDTreeWidget::itemChanged, [this](RDTreeWidgetItem *item, int) -> void { const QVariant d = item->data(0, CounterIdRole); static bool recurse = false; if(d.isValid()) { if(item->checkState(0) == Qt::Checked) { // Add QListWidgetItem *listItem = new QListWidgetItem(ui->enabledCounters); listItem->setText(item->text(0)); listItem->setData(CounterIdRole, d); m_SelectedCounters.insert((GPUCounter)d.toUInt(), listItem); } else { // Remove QListWidgetItem *listItem = m_SelectedCounters.take((GPUCounter)d.toUInt()); delete listItem; } if(!recurse) { recurse = true; updateParentCheckState(item->parent()); recurse = false; } } else if(!recurse) { Qt::CheckState prev = item->data(0, PreviousCheckStateRole).value<Qt::CheckState>(); if(item->checkState(0) != prev) { recurse = true; if(item->checkState(0) == Qt::Checked) { checkAllChildren(item); } else { uncheckAllChildren(item); } item->setData(0, PreviousCheckStateRole, item->checkState(0)); updateParentCheckState(item); recurse = false; } } }); ui->counterTree->setMouseTracking(true); ctx.Replay().AsyncInvoke([this, selectedCounters](IReplayController *controller) -> void { QVector<CounterDescription> counterDescriptions; for(const GPUCounter counter : controller->EnumerateCounters()) { counterDescriptions.append(controller->DescribeCounter(counter)); } GUIInvoke::call([counterDescriptions, selectedCounters, this]() -> void { SetCounters(counterDescriptions); SetSelectedCounters(selectedCounters); }); }); ui->counterTree->setContextMenuPolicy(Qt::CustomContextMenu); QObject::connect(ui->counterTree, &RDTreeWidget::customContextMenuRequested, this, &PerformanceCounterSelection::counterTree_contextMenu); }
/** Print the content of the cell */ void DdDoubleLoop::PrintCell(const int c){ for(SetCounters(c);IfItCell(c);IncrCurr(c)){ int p = ItCell(c); printf("%d) # %d %d_%d_%d %x\n",c,Cella[c].NPart,Pc[p].Prev,ItCell(c),Pc[p].Next,Pc[p].Coord); } }
void DdFixedSize::PrintCell(const int c){ for(SetCounters(c);IfItCell(c);IncrCurr(c)){ int p = ItCell(c); printf("%d) # %d %d\n",c,Cella[c].NPart,ItCell(c)); } }
void DdArray::PrintCell(const int c){ for(SetCounters(c);IfItCell(c);IncrCurr(c)){ int p = ItCell(c); printf("%d) # %d %d\n",c,Cella[c].Part.size(),ItCell(c)); } }
OpenSMOKEVector<T, IndexPolicy>::OpenSMOKEVector(void) { SetCounters(); Initialize(0); }
OpenSMOKEVector<T, IndexPolicy>::OpenSMOKEVector(std::istream& fInput, const OpenSMOKE_File_Format fileFormat) { SetCounters(); Load(fInput, fileFormat); }
OpenSMOKEVector<T, IndexPolicy>::OpenSMOKEVector(const std::string fileName, const OpenSMOKE_File_Format fileFormat) { SetCounters(); Load(fileName, fileFormat); }