void ProbingPreconditionerFactory::initializeFromParameterList(const Teuchos::ParameterList & pl)
{
   RCP<const InverseLibrary> invLib = getInverseLibrary();

   const std::string inverse_type = "Inverse Type";
   const std::string probing_graph_operator = "Probing Graph Operator";
   const std::string probing_graph = "Probing Graph";
   const std::string user_graph = "User Will Set Probing Graph";

   // get string specifying default inverse
   std::string invStr ="Amesos"; 
   if(pl.isParameter(inverse_type))
      invStr = pl.get<std::string>(inverse_type);

   if(pl.isParameter(probing_graph_operator))
      setGraphOperator(pl.get<Teko::LinearOp>(probing_graph_operator));
   else if(pl.isParameter(probing_graph))
      setGraph(pl.get<RCP<const Epetra_CrsGraph> >(probing_graph));
   else if(pl.isParameter(user_graph) && pl.get<bool>("User Will Set Probing Graph")){
     //noop
   }	  
   else {
      Teuchos::RCP<Teko::RequestHandler> rh = getRequestHandler();
      rh->preRequest<RCP<const Epetra_CrsGraph> >(Teko::RequestMesg("Probing Graph"));
      setGraph(rh->request<RCP<const Epetra_CrsGraph> >(Teko::RequestMesg("Probing Graph")));
   }

   setInverseFactory(invLib->getInverseFactory(invStr));
}
Пример #2
0
CLogGraph::CLogGraph()
{
	m_bCreated = false;
//	m_hQue  = 0;
	m_bNav = false;
	m_tLastNav = time(NULL);
	m_nScaleIndex = -1;
	m_nLastCursorPos = -1;
	m_aTmp = NULL;

	m_bDragSel = false;
	m_bLdown = false;

	m_tStart = time(NULL);
	m_tEnd = time(NULL);
	
	m_nHeaderHeight = 40;
	m_nScaleWidth  = 34;
	m_bAutoZoom = false;

	setZoom(1.0);
	setGrid(20, RGB(70, 70, 70));
	setHeader("Segoe UI", 13, RGB(200, 200, 200), RGB(120, 120, 120));
	setScale("Segoe UI", 13, RGB(200, 200, 0), RGB(100, 100, 100));
	setGraph("Segoe UI", 13, RGB(200, 200, 200), RGB(0, 0, 0));
	setScaleIndex(-1, -1);

	clearGraph();

	m_bLoad = false;
//	uMSH_MOUSEWHEEL = RegisterWindowMessage("MSWHEEL_ROLLMSG");
}
Пример #3
0
void QGraphWidget::loadGraph(const QString &filename) {
    clear();
    LayoutGraph *lg = new LayoutGraph(filename, this);
    setGraph(lg);
    for(auto v : lg->getVertices())
        v->setPosition(QVector2D(Random::randDouble(-0.25, 0.25)*width(), Random::randDouble(-0.25, 0.25)*height()));
    lg->start(15);
}
Пример #4
0
AssociationsDialog::AssociationsDialog(Graph *g, Qt::WFlags fl)
    : QDialog(g, fl) {
  setObjectName("AssociationsDialog");
  setWindowTitle(tr("MantidPlot - Plot Associations"));
  setModal(true);
  setSizeGripEnabled(true);
  setFocus();

  QVBoxLayout *vl = new QVBoxLayout();

  QHBoxLayout *hbox1 = new QHBoxLayout();
  hbox1->addWidget(new QLabel(tr("Spreadsheet: ")));

  tableCaptionLabel = new QLabel();
  hbox1->addWidget(tableCaptionLabel);
  vl->addLayout(hbox1);

  table = new QTableWidget(3, 5);
  table->horizontalHeader()->setClickable(false);
  table->horizontalHeader()->setResizeMode(QHeaderView::Stretch);
  table->verticalHeader()->hide();
  table->verticalHeader()->setResizeMode(QHeaderView::ResizeToContents);
  table->setMaximumHeight(8 * table->rowHeight(0));
  table->setHorizontalHeaderLabels(
      {tr("Column"), tr("X"), tr("Y"), tr("xErr"), tr("yErr")});
  vl->addWidget(table);

  connect(table, SIGNAL(itemClicked(QTableWidgetItem *)), this,
          SLOT(processStateChange(QTableWidgetItem *)));

  associations = new QListWidget();
  associations->setSelectionMode(QListWidget::SingleSelection);
  vl->addWidget(associations);

  btnApply = new QPushButton(tr("&Update curves"));
  btnOK = new QPushButton(tr("&OK"));
  btnOK->setDefault(true);
  btnCancel = new QPushButton(tr("&Cancel"));

  QHBoxLayout *hbox2 = new QHBoxLayout();
  hbox2->addStretch();
  hbox2->addWidget(btnApply);
  hbox2->addWidget(btnOK);
  hbox2->addWidget(btnCancel);
  vl->addStretch();
  vl->addLayout(hbox2);
  setLayout(vl);

  active_table = 0;

  connect(associations, SIGNAL(currentRowChanged(int)), this,
          SLOT(updateTable(int)));
  connect(btnOK, SIGNAL(clicked()), this, SLOT(accept()));
  connect(btnCancel, SIGNAL(clicked()), this, SLOT(close()));
  connect(btnApply, SIGNAL(clicked()), this, SLOT(updateCurves()));

  setGraph(g);
}
Пример #5
0
  /* Requires that the node is a latent variable.
   * Sets the following properties:
   *    - parent graph (from parameter)
   *    - joint distribution (from parameter)
   *    - variable (deduced from parameters)
   *    - position (deduced from parameters)
   *    - level (deduced from parameters).
   *
   * Requires Label2Index which maps the label of a variable to its index.
   */
  Node& setupProperties(Graph* graph,
                        JointDistribution& jointDist,
                        Label2Index& label2Index ) {
    plComputableObjectList objectList = jointDist.get_computable_object_list();

    setGraph(graph);
    setDistribution(jointDist);
    setVariable(objectList);
    setLabel(label2Index);
    setPosition(label2Index, objectList);
    setLevel(label2Index, objectList);
    return (*this);
    /**
    return setGraph(graph).setDistribution(jointDist)
            .setVariable(objectList).setLabel(label2Index)
            .setPosition(label2Index, objectList).setLevel(label2Index, objectList);
    */
  }
Пример #6
0
void Node::removeFromParent()
{
  if (m_parent || m_graph)
  {
    if (m_parent)
    {
      auto& siblings = m_parent->m_children;
      siblings.erase(std::find(siblings.begin(), siblings.end(), this));

      m_parent->invalidateBounds();
      m_parent = nullptr;

      invalidateWorldTransform();
    }
    else
    {
      auto& roots = m_graph->m_roots;
      roots.erase(std::find(roots.begin(), roots.end(), this));
    }

    setGraph(nullptr);
  }
}
void ProbingPreconditionerFactory::setGraphOperator(const Teko::LinearOp & graphOp)
{
   RCP<const Epetra_CrsMatrix> crsMatrix = rcp_dynamic_cast<const Epetra_CrsMatrix>(Thyra::get_Epetra_Operator(*graphOp));
   setGraph(Teuchos::rcpFromRef(crsMatrix->Graph()));
}
Пример #8
0
CurvesDialog::CurvesDialog( ApplicationWindow* app, Graph* g, Qt::WFlags fl )
  : QDialog( g, fl ),
    d_app(app),
    d_graph(g)
{
  setName( "CurvesDialog" );
  setWindowTitle( tr( "MantidPlot - Add/Remove curves" ) );
  setSizeGripEnabled(true);
  setFocus();

  QHBoxLayout *hl = new QHBoxLayout();

  hl->addWidget(new QLabel(tr("New curves style")));
  boxStyle = new QComboBox();
  boxStyle->addItem( getQPixmap("lPlot_xpm"), tr( " Line" ) );
  boxStyle->addItem( getQPixmap("pPlot_xpm"), tr( " Scatter" ) );
  boxStyle->addItem( getQPixmap("lpPlot_xpm"), tr( " Line + Symbol" ) );
  boxStyle->addItem( getQPixmap("dropLines_xpm"), tr( " Vertical drop lines" ) );
  boxStyle->addItem( getQPixmap("spline_xpm"), tr( " Spline" ) );
  boxStyle->addItem( getQPixmap("hor_steps_xpm"), tr( " Horizontal steps" ) );
  boxStyle->addItem( getQPixmap("vert_steps_xpm"), tr( " Vertical steps" ) );
  boxStyle->addItem( getQPixmap("area_xpm"), tr( " Area" ) );
  boxStyle->addItem( getQPixmap("vertBars_xpm"), tr( " Vertical Bars" ) );
  boxStyle->addItem( getQPixmap("hBars_xpm"), tr( " Horizontal Bars" ) );
  hl->addWidget(boxStyle);

  boxMatrixStyle = new QComboBox();
  boxMatrixStyle->addItem( getQPixmap("color_map_xpm"), tr("Contour - Color Fill"));
  boxMatrixStyle->addItem( getQPixmap("contour_map_xpm"), tr("Contour Lines"));
  boxMatrixStyle->addItem( getQPixmap("gray_map_xpm"), tr("Gray Scale Map"));
  boxMatrixStyle->addItem( getQPixmap("histogram_xpm"), tr("Histogram"));
  boxMatrixStyle->hide();
  hl->addWidget(boxMatrixStyle);
  hl->addStretch();

  QGridLayout *gl = new QGridLayout();
  gl->addWidget(new QLabel( tr( "Available data" )), 0, 0);
  gl->addWidget(new QLabel( tr( "Graph contents" )), 0, 2);

  available = new QListWidget();
  available->setSelectionMode (QAbstractItemView::ExtendedSelection);
  gl->addWidget(available, 1, 0);

  QVBoxLayout* vl1 = new QVBoxLayout();
  btnAdd = new QPushButton();
  btnAdd->setPixmap( getQPixmap("next_xpm") );
  btnAdd->setFixedWidth (35);
  btnAdd->setFixedHeight (30);
  vl1->addWidget(btnAdd);

  btnRemove = new QPushButton();
  btnRemove->setPixmap( getQPixmap("prev_xpm") );
  btnRemove->setFixedWidth (35);
  btnRemove->setFixedHeight(30);
  vl1->addWidget(btnRemove);
  vl1->addStretch();

  gl->addLayout(vl1, 1, 1);
  contents = new QListWidget();
  contents->setSelectionMode (QAbstractItemView::ExtendedSelection);
  gl->addWidget(contents, 1, 2);

  QVBoxLayout* vl2 = new QVBoxLayout();
  btnAssociations = new QPushButton(tr( "&Plot Associations..." ));
  btnAssociations->setEnabled(false);
  vl2->addWidget(btnAssociations);

  btnRange = new QPushButton(tr( "Edit &Range..." ));
  btnRange->setEnabled(false);
  vl2->addWidget(btnRange);

  btnEditFunction = new QPushButton(tr( "&Edit Function..." ));
  btnEditFunction->setEnabled(false);
  vl2->addWidget(btnEditFunction);

  btnOK = new QPushButton(tr( "OK" ));
  btnOK->setDefault( true );
  vl2->addWidget(btnOK);

  btnCancel = new QPushButton(tr( "Close" ));
  vl2->addWidget(btnCancel);

  boxShowRange = new QCheckBox(tr( "&Show Range" ));
  vl2->addWidget(boxShowRange);

  vl2->addStretch();
  gl->addLayout(vl2, 1, 3);

  QVBoxLayout* vl3 = new QVBoxLayout(this);
  vl3->addLayout(hl);
  vl3->addLayout(gl);

  boxShowCurrentFolder = new QCheckBox(tr("Show current &folder only" ));
  vl3->addWidget(boxShowCurrentFolder);

  init();

  connect(boxShowCurrentFolder, SIGNAL(toggled(bool)), this, SLOT(showCurrentFolder(bool)));
  connect(boxShowRange, SIGNAL(toggled(bool)), this, SLOT(showCurveRange(bool)));
  connect(btnRange, SIGNAL(clicked()),this, SLOT(showCurveRangeDialog()));
  connect(btnAssociations, SIGNAL(clicked()),this, SLOT(showPlotAssociations()));
  connect(btnEditFunction, SIGNAL(clicked()),this, SLOT(showFunctionDialog()));
  connect(btnAdd, SIGNAL(clicked()),this, SLOT(addCurves()));
  connect(btnRemove, SIGNAL(clicked()),this, SLOT(removeCurves()));
  connect(btnOK, SIGNAL(clicked()),this, SLOT(close()));
  connect(btnCancel, SIGNAL(clicked()),this, SLOT(close()));
  connect(contents, SIGNAL(currentRowChanged(int)), this, SLOT(showCurveBtn(int)));
  connect(contents, SIGNAL(itemSelectionChanged()), this, SLOT(enableRemoveBtn()));
  connect(available, SIGNAL(itemSelectionChanged()), this, SLOT(enableAddBtn()));

  QShortcut *shortcut = new QShortcut(QKeySequence(Qt::Key_Delete), this);
  connect(shortcut, SIGNAL(activated()), this, SLOT(removeCurves()));
  shortcut = new QShortcut(QKeySequence("-"), this);
  connect(shortcut, SIGNAL(activated()), this, SLOT(removeCurves()));
  shortcut = new QShortcut(QKeySequence("+"), this);
  connect(shortcut, SIGNAL(activated()), this, SLOT(addCurves()));

  setGraph(g);
}