Пример #1
0
bool PlanLayer::init(){

    bool sRet=false;
    
    do {
        
        CC_BREAK_IF(!ParentClass::init());
        
        setupViews();
        
        sRet=true;
    } while (0);
    
    return sRet;
}
Пример #2
0
ReportView::ReportView(QAbstractItemModel *model)
    : database_manager_(0)
    , row_count_(0)
    , total_value_(0)
    , is_valid_(true)
    , data_model_(model)
{
    model_ = model;
    model_view_ = model;
    report_info_.report_type_ = ReportInfo::PROGRAM;
    setWindowTitle(tr("Загруженный отчет"));
    resize(870, 550);

    setupViews();

}
Пример #3
0
void
LOCA::Hopf::MinimallyAugmented::ExtendedGroup::
copy(const NOX::Abstract::Group& src) 
{

  const LOCA::Hopf::MinimallyAugmented::ExtendedGroup& source = 
    dynamic_cast<const LOCA::Hopf::MinimallyAugmented::ExtendedGroup&>(src);

  // Protect against A = A
  if (this != &source) {
    globalData = source.globalData;
    parsedParams = source.parsedParams;
    hopfParams = source.hopfParams;
    grpPtr->copy(*source.grpPtr);
    constraintsPtr->copy(*source.constraintsPtr);
    xMultiVec = source.xMultiVec;
    fMultiVec = source.fMultiVec;
    newtonMultiVec = source.newtonMultiVec;
    gradientMultiVec = source.gradientMultiVec;
    index_f = source.index_f;
    index_dfdp = source.index_dfdp;
    bifParamID = source.bifParamID;
    isValidF = source.isValidF;
    isValidJacobian = source.isValidJacobian;
    isValidNewton = source.isValidNewton;
    isValidGradient = source.isValidGradient;

    // set up views again just to be safe
    setupViews();

    // Instantiate bordered solver
    borderedSolver = 
      globalData->locaFactory->createBorderedSolverStrategy(parsedParams,
							    hopfParams);

    // Set blocks in bordered solver
    if (isValidJacobian) {
      borderedSolver->setMatrixBlocks(jacOp, 
				      dfdpMultiVec->getXMultiVec(),
				      constraintsPtr,
				      dfdpMultiVec->getScalars());
      NOX::Abstract::Group::ReturnType status = borderedSolver->initForSolve();
      globalData->locaErrorCheck->checkReturnType(status, 
						  "LOCA::Hopf::MinimallyAugmented::copy()");
  }
  }
}
Пример #4
0
bool OptionLayer::init(){
    
    bool sRect = false;
    
    do {
        
        CC_BREAK_IF( !BasicLayer::init());
        
        setupViews();
        
        sRect = true;
    } while (0 );

   
    return sRect;
    
}
LOCA::TurningPoint::MooreSpence::ExtendedGroup::ExtendedGroup(
		const LOCA::TurningPoint::MooreSpence::ExtendedGroup& source, 
		NOX::CopyType type)
  : globalData(source.globalData),
    parsedParams(source.parsedParams),
    turningPointParams(source.turningPointParams),
    grpPtr(Teuchos::rcp_dynamic_cast<LOCA::TurningPoint::MooreSpence::AbstractGroup>(source.grpPtr->clone(type))),
    xMultiVec(source.xMultiVec, type),
    fMultiVec(source.fMultiVec, type),
    newtonMultiVec(source.newtonMultiVec, type),
    lengthMultiVec(source.lengthMultiVec->clone(type)),
    xVec(),
    fVec(),
    ffMultiVec(),
    dfdpMultiVec(),
    newtonVec(),
    lengthVec(),
    solverStrategy(source.solverStrategy),
    index_f(1),
    index_dfdp(1),
    bifParamID(source.bifParamID),
    isValidF(source.isValidF),
    isValidJacobian(source.isValidJacobian),
    isValidNewton(source.isValidNewton),
    updateVectorsEveryContinuationStep(source.updateVectorsEveryContinuationStep),
    nullVecScaling(source.nullVecScaling),
    multiplyMass(source.multiplyMass),
    tdGrp(source.tdGrp),
    tmp_mass(source.tmp_mass->clone(type))
{

  // Instantiate solver strategy
  solverStrategy = 
    globalData->locaFactory->createMooreSpenceTurningPointSolverStrategy(
						           parsedParams,
						           turningPointParams);

  // Set up multi-vector views
  setupViews();

  if (type == NOX::ShapeCopy) {
    isValidF = false;
    isValidJacobian = false;
    isValidNewton = false;
  }
}
Пример #6
0
LOCA::Pitchfork::MooreSpence::ExtendedGroup::ExtendedGroup(
		const LOCA::Pitchfork::MooreSpence::ExtendedGroup& source, 
		NOX::CopyType type)
  : globalData(source.globalData),
    parsedParams(source.parsedParams),
    pitchforkParams(source.pitchforkParams),
    grpPtr(Teuchos::rcp_dynamic_cast<LOCA::Pitchfork::MooreSpence::AbstractGroup>(source.grpPtr->clone(type))),
    xMultiVec(source.xMultiVec, type),
    fMultiVec(source.fMultiVec, type),
    newtonMultiVec(source.newtonMultiVec, type),
    asymMultiVec(source.asymMultiVec->clone(type)),
    lengthMultiVec(source.lengthMultiVec->clone(type)),
    xVec(),
    fVec(),
    ffMultiVec(),
    dfdpMultiVec(),
    newtonVec(),
    asymVec(),
    lengthVec(),
    solverStrategy(source.solverStrategy),
    index_f(1),
    index_dfdp(1),
    bifParamID(source.bifParamID),
    isValidF(source.isValidF),
    isValidJacobian(source.isValidJacobian),
    isValidNewton(source.isValidNewton) 
{

  // Instantiate solver strategy
  solverStrategy = 
    globalData->locaFactory->createMooreSpencePitchforkSolverStrategy(
						             parsedParams,
							     pitchforkParams);

  // Set up multi-vector views
  setupViews();

  if (type == NOX::ShapeCopy) {
    isValidF = false;
    isValidJacobian = false;
    isValidNewton = false;
  }
}
void
LOCA::TurningPoint::MooreSpence::ExtendedGroup::copy(
					    const NOX::Abstract::Group& src)
{
  const LOCA::TurningPoint::MooreSpence::ExtendedGroup& source = 
    dynamic_cast<const LOCA::TurningPoint::MooreSpence::ExtendedGroup&>(src);

  // Protect against A = A
  if (this != &source) {
    
    // Copy values
    globalData = source.globalData;
    parsedParams = source.parsedParams;
    turningPointParams = source.turningPointParams;
    grpPtr->copy(*(source.grpPtr));
    xMultiVec = source.xMultiVec;
    fMultiVec = source.fMultiVec;
    newtonMultiVec = source.newtonMultiVec;
    *lengthMultiVec = *source.lengthMultiVec;
    index_f = source.index_f;
    index_dfdp = source.index_dfdp;
    bifParamID = source.bifParamID;
    isValidF = source.isValidF;
    isValidJacobian = source.isValidJacobian;
    isValidNewton = source.isValidNewton;
    updateVectorsEveryContinuationStep = 
      source.updateVectorsEveryContinuationStep;
    nullVecScaling = source.nullVecScaling;
    multiplyMass = source.multiplyMass;

    // set up views again just to be safe
    setupViews();

    // Instantiate solver strategy
    solverStrategy = 
      globalData->locaFactory->createMooreSpenceTurningPointSolverStrategy(
				                           parsedParams,
				                           turningPointParams);
  }
}
Пример #8
0
void
LOCA::Pitchfork::MooreSpence::ExtendedGroup::copy(
					    const NOX::Abstract::Group& src)
{
  const LOCA::Pitchfork::MooreSpence::ExtendedGroup& source = 
    dynamic_cast<const LOCA::Pitchfork::MooreSpence::ExtendedGroup&>(src);

  // Protect against A = A
  if (this != &source) {
    
    // Copy values
    globalData = source.globalData;
    parsedParams = source.parsedParams;
    pitchforkParams = source.pitchforkParams;
    grpPtr->copy(*(source.grpPtr));
    xMultiVec = source.xMultiVec;
    fMultiVec = source.fMultiVec;
    newtonMultiVec = source.newtonMultiVec;
    *asymMultiVec = *source.asymMultiVec;
    *lengthMultiVec = *source.lengthMultiVec;
    index_f = source.index_f;
    index_dfdp = source.index_dfdp;
    bifParamID = source.bifParamID;
    isValidF = source.isValidF;
    isValidJacobian = source.isValidJacobian;
    isValidNewton = source.isValidNewton;

    // set up views again just to be safe
    setupViews();

    // Instantiate solver strategy
    solverStrategy = 
      globalData->locaFactory->createMooreSpencePitchforkSolverStrategy(
							     parsedParams,
				                             pitchforkParams);
  }
}
Пример #9
0
DwarfClipboard::DwarfClipboard()
{

    setupUi(this);
    createActions();
    createTrayIcon();
    trayIcon->setIcon(QIcon(":/icons/images/DwarfClipboard.png"));
    trayIcon->show();
    setWindowTitle(tr("DwarfClipboard"));
    inputDelay = 100;
    thumbnailSize = 64;
    prevCursor.x = -30000;
    createShortcuts();
    heartbeatTimer = new QTimer(this);
    connectedLabel = new QLabel();
    createConnections();
    recentModel = new DwarfClipboardModel();
    tableViewRecent->setModel(recentModel);
    libraryModel = new DwarfClipboardModel();
    treeViewLibrary->setModel(libraryModel);

    DFMgr = NULL;
    DF = NULL;
    Pos = NULL;

    connected = connectToDF();
    loadConfig();
    thumbnailSizeLineEdit->setText(QString("%1").arg(thumbnailSize));
    inputDelayMsLineEdit->setText(QString("%1").arg(inputDelay));

    tilesetPathButton->setText(DwarfClipboardPng::getTileSetPath());
    colorPathButton->setText(DwarfClipboardPng::getColorPath());

    copyShortcutButton->setText(copyShortcut->shortcut());
    pasteDesignationShortcutButton->setText(pasteDesignationShortcut->shortcut());
    pasteBuildingShortcutButton->setText(pasteBuildingShortcut->shortcut());
    setCursorToPreviousPasteShortcutButton->setText(setCursorToPreviousPasteShortcut->shortcut());
    
    heartbeatTimer->start(1000);

    Ui_MainWindow::statusBar->addPermanentWidget(connectedLabel);
    
    connectedIcon = QPixmap(":/icons/images/connect.png");
    
    //This mess just converts the disconnected icon to look the same as a disabled one
    //It is the same code used in the icon object
    disconnectedIcon = QPixmap(":/icons/images/disconnect.png");
    QStyleOption opt(0);
    opt.palette = QApplication::palette();
    QPixmap generated = QApplication::style()->generatedIconPixmap(QIcon::Disabled, disconnectedIcon, &opt);
    disconnectedIcon = generated;
    loadDirectory();
    loadBuildCommands();
    if(connected){
        connected = false; //this is ugly, but just ensures everything will be set proprly
        setConnected();
    }
    else{
        connected = true;
        setDisconnected();
    }
    setupViews();   
}
Пример #10
0
ReportView::ReportView(ReportInfo& info, DataBaseManager* db_man, QWidget* parent)
    : QMainWindow(parent)
    , report_info_(info)
    , database_manager_(db_man)
    , data_model_(0)
    , row_count_(0)
    , total_value_(0)
    , is_valid_(true)
{

    database_manager_->analizeSessions();

    UsefulInfo useful_info;

    if(info.report_type_ == ReportInfo::USEFUL) {

    data_model_ = database_manager_->getModel(report_info_, useful_info);
    useful_info.row_count_ = data_model_->rowCount();
    model_ = new QStandardItemModel(0, 2, this);
    }
    else if (info.report_type_ == ReportInfo::PROGRAM) {
         data_model_ = database_manager_->getModel(report_info_);
    }

    model_view_ = new ColorProxyDataModel(data_model_, info.report_type_, this);
    model_view_->setHeaderData(0, Qt::Horizontal, tr("Программа"));
    model_view_->setHeaderData(1, Qt::Horizontal, tr("Процент %"));
    if( model_view_->rowCount() == 0) {
        QMessageBox::information(0, "No Data",
            "No information on this period",
                              QMessageBox::Cancel);
        is_valid_ = false;
    }
    if(report_info_.report_type_ == ReportInfo::PROGRAM)
        processProgramReport();


    setupViews();

    if(report_info_.report_type_ == ReportInfo::USEFUL)
        processUsefulReport(useful_info);





    QMenu *fileMenu = new QMenu(tr("&File"), this);
    QAction *openAction = fileMenu->addAction(tr("Открыть..."));
    openAction->setShortcuts(QKeySequence::Open);
    QAction *saveAction = fileMenu->addAction(tr("Сохранить как..."));
    saveAction->setShortcuts(QKeySequence::SaveAs);
    QAction *quitAction = fileMenu->addAction(tr("Выход"));
    quitAction->setShortcuts(QKeySequence::Quit);

    connect(openAction, SIGNAL(triggered()), this, SLOT(openFile()));
    connect(saveAction, SIGNAL(triggered()), this, SLOT(saveFile()));
    connect(quitAction, SIGNAL(triggered()), qApp, SLOT(quit()));

    menuBar()->addMenu(fileMenu);
    statusBar();



    setWindowTitle(tr("Отчет"));
    resize(870, 550);
}
LOCA::MultiContinuation::ConstrainedGroup::ConstrainedGroup(
		     const LOCA::MultiContinuation::ConstrainedGroup& source,
		     NOX::CopyType type)
  : LOCA::Abstract::Group(source),
    globalData(source.globalData),
    parsedParams(source.parsedParams),
    constraintParams(source.constraintParams),
    grpPtr(Teuchos::rcp_dynamic_cast<LOCA::MultiContinuation::AbstractGroup>(source.grpPtr->clone(type))),
    bordered_grp(),
    constraintsPtr(source.constraintsPtr->clone(type)),
    numParams(source.numParams),
    xMultiVec(source.xMultiVec, type),
    fMultiVec(source.fMultiVec, type),
    newtonMultiVec(source.newtonMultiVec, type),
    gradientMultiVec(source.gradientMultiVec, type),
    xVec(),
    fVec(),
    ffMultiVec(),
    dfdpMultiVec(),
    newtonVec(),
    gradientVec(),
    jacOp(),
    borderedSolver(source.borderedSolver),
    index_f(1),
    index_dfdp(numParams),
    constraintParamIDs(source.constraintParamIDs),
    isValidF(source.isValidF),
    isValidJacobian(source.isValidJacobian),
    isValidNewton(source.isValidNewton),
    isValidGradient(source.isValidGradient),
    isBordered(false),
    skipDfDp(source.skipDfDp)
{
  // Set up multi-vector views
  setupViews();

  // Instantiate bordered solver
  borderedSolver = globalData->locaFactory->createBorderedSolverStrategy(
				   parsedParams,
				   constraintParams);

  if (type == NOX::ShapeCopy) {
    isValidF = false;
    isValidJacobian = false;
    isValidNewton = false;
    isValidGradient = false;
  }

  // Determine if underlying group is bordered
  bordered_grp = 
    Teuchos::rcp_dynamic_cast<LOCA::BorderedSystem::AbstractGroup>(grpPtr);
  isBordered = (bordered_grp != Teuchos::null);

  // Create Jacobian operator for bordered solver
  jacOp = Teuchos::rcp(new LOCA::BorderedSolver::JacobianOperator(grpPtr));

  // Set blocks in bordered solver
  if (isValidJacobian) {
    if (skipDfDp) 
      borderedSolver->setMatrixBlocks(jacOp, 
				      Teuchos::null, 
				      constraintsPtr,
				      dfdpMultiVec->getScalars());
    else
      borderedSolver->setMatrixBlocks(jacOp, 
				      dfdpMultiVec->getXMultiVec(),
				      constraintsPtr,
				      dfdpMultiVec->getScalars());
    NOX::Abstract::Group::ReturnType status = borderedSolver->initForSolve();
    globalData->locaErrorCheck->checkReturnType(status, 
						"LOCA::MultiContinuation::ConstrainedGroup::ConstrainedGroup()");
  }
}
LOCA::TurningPoint::MooreSpence::ExtendedGroup::ExtendedGroup(
	 const Teuchos::RCP<LOCA::GlobalData>& global_data,
         const Teuchos::RCP<LOCA::Parameter::SublistParser>& topParams,
	 const Teuchos::RCP<Teuchos::ParameterList>& tpParams,
	 const Teuchos::RCP<LOCA::TurningPoint::MooreSpence::AbstractGroup>& g)
  : LOCA::Extended::MultiAbstractGroup(),
    LOCA::MultiContinuation::AbstractGroup(),
    globalData(global_data),
    parsedParams(topParams),
    turningPointParams(tpParams),
    grpPtr(g),
    xMultiVec(globalData, g->getX(), 1),
    fMultiVec(globalData, g->getX(), 2),
    newtonMultiVec(globalData, g->getX(), 1),
    lengthMultiVec(),
    xVec(),
    fVec(),
    ffMultiVec(),
    dfdpMultiVec(),
    newtonVec(),
    lengthVec(),
    solverStrategy(),
    index_f(1),
    index_dfdp(1),
    bifParamID(1), 
    isValidF(false),
    isValidJacobian(false),
    isValidNewton(false),
    updateVectorsEveryContinuationStep(false),
    nullVecScaling(NVS_OrderN),
    multiplyMass(false),
    tdGrp(),
    tmp_mass()
{
  const char *func = "LOCA::TurningPoint::MooreSpence::ExtendedGroup()";

  // Set x
  *(xMultiVec.getColumn(0)->getXVec()) = g->getX();

  if (!turningPointParams->isParameter("Bifurcation Parameter")) {
    globalData->locaErrorCheck->throwError(func,
				 "\"Bifurcation Parameter\" name is not set!");
  }
  string bifParamName = turningPointParams->get(
						  "Bifurcation Parameter",
						  "None");
  const ParameterVector& p = grpPtr->getParams();
  bifParamID[0] = p.getIndex(bifParamName);

  if (!turningPointParams->isParameter("Length Normalization Vector")) {
    globalData->locaErrorCheck->throwError(func,
			   "\"Length Normalization Vector\" is not set!");
  }
  Teuchos::RCP<NOX::Abstract::Vector> lenVecPtr = 
    (*turningPointParams).INVALID_TEMPLATE_QUALIFIER 
    get< Teuchos::RCP<NOX::Abstract::Vector> >("Length Normalization Vector");

  if (!turningPointParams->isParameter("Initial Null Vector")) {
    globalData->locaErrorCheck->throwError(func,
				 "\"Initial Null Vector\" is not set!");
  }
  Teuchos::RCP<NOX::Abstract::Vector> nullVecPtr = 
    (*turningPointParams).INVALID_TEMPLATE_QUALIFIER 
    get<Teuchos::RCP<NOX::Abstract::Vector> >("Initial Null Vector");

  bool perturbSoln = turningPointParams->get(
					       "Perturb Initial Solution", 
					       false);
  double perturbSize = turningPointParams->get(
						 "Relative Perturbation Size", 
						 1.0e-3);
  
  updateVectorsEveryContinuationStep = 
    turningPointParams->get("Update Null Vectors Every Continuation Step", 
			    false);
  std::string nullVecScalingMethod = 
    turningPointParams->get("Null Vector Scaling", "Order N");
  if (nullVecScalingMethod == "None")
    nullVecScaling = NVS_None;
  else if (nullVecScalingMethod == "Order 1")
    nullVecScaling = NVS_OrderOne;
  else if (nullVecScalingMethod == "Order N")
    nullVecScaling = NVS_OrderN;
  else
    globalData->locaErrorCheck->throwError(
       "LOCA::TurningPoint::MooreSpence::ExtendedGroup::ExtendedGroup()",
       string("Unknown null vector scaling method:  ") + nullVecScalingMethod);
   multiplyMass = 
    turningPointParams->get("Multiply Null Vectors by Mass Matrix", false);
  if (multiplyMass && tdGrp == Teuchos::null) {
    globalData->locaErrorCheck->throwError(
       "LOCA::TurningPoint::MooreSpence::ExtendedGroup::ExtendedGroup()",
       "Group must be derived from LOCA::TimeDependent::AbstractGroup to multiply null vectors by mass matrix");
  }

  lengthMultiVec = 
    lenVecPtr->createMultiVector(1, NOX::DeepCopy);
  *(xMultiVec.getColumn(0)->getNullVec()) = *nullVecPtr;

  tdGrp = Teuchos::rcp_dynamic_cast<LOCA::TimeDependent::AbstractGroup>(grpPtr);
  tmp_mass = grpPtr->getX().clone(NOX::ShapeCopy);

  // Instantiate solver strategy
  solverStrategy = 
    globalData->locaFactory->createMooreSpenceTurningPointSolverStrategy(
							  parsedParams,
							  turningPointParams);

  // Set up multi-vector views
  setupViews(); 

  init(perturbSoln, perturbSize);
}
LOCA::MultiContinuation::ConstrainedGroup::ConstrainedGroup(
       const Teuchos::RCP<LOCA::GlobalData>& global_data,
       const Teuchos::RCP<LOCA::Parameter::SublistParser>& topParams,
       const Teuchos::RCP<Teuchos::ParameterList>& conParams,
       const Teuchos::RCP<LOCA::MultiContinuation::AbstractGroup>& g,
       const Teuchos::RCP<LOCA::MultiContinuation::ConstraintInterface>& constraints,
       const std::vector<int>& paramIDs,
       bool skip_dfdp)
  : LOCA::Abstract::Group(global_data),
    globalData(global_data),
    parsedParams(topParams),
    constraintParams(conParams),
    grpPtr(g),
    bordered_grp(),
    constraintsPtr(constraints),
    numParams(paramIDs.size()),
    xMultiVec(globalData, g->getX(), 1, numParams, NOX::DeepCopy),
    fMultiVec(globalData, g->getX(), numParams+1, numParams, NOX::ShapeCopy),
    newtonMultiVec(globalData, g->getX(), 1, numParams, NOX::ShapeCopy),
    gradientMultiVec(globalData, g->getX(), 1, numParams, NOX::ShapeCopy),
    xVec(),
    fVec(),
    ffMultiVec(),
    dfdpMultiVec(),
    newtonVec(),
    gradientVec(),
    jacOp(),
    borderedSolver(),
    index_f(1),
    index_dfdp(numParams),
    constraintParamIDs(paramIDs),
    isValidF(false),
    isValidJacobian(false),
    isValidNewton(false),
    isValidGradient(false),
    isBordered(false),
    skipDfDp(skip_dfdp)
{
  // Set up multi-vector views
  setupViews(); 

  // Set parameters in solution vector
  for (int i=0; i<numParams; i++)
    xVec->getScalar(i) = grpPtr->getParam(constraintParamIDs[i]);

  // Set parameters and solution vector in constraints
  constraintsPtr->setParams(constraintParamIDs, *xVec->getScalars());
  constraintsPtr->setX(*(xVec->getXVec()));

  // Instantiate bordered solver
  borderedSolver = globalData->locaFactory->createBorderedSolverStrategy(
				   parsedParams,
				   constraintParams);

  // Determine if underlying group is bordered
  bordered_grp = 
    Teuchos::rcp_dynamic_cast<LOCA::BorderedSystem::AbstractGroup>(grpPtr);
  isBordered = (bordered_grp != Teuchos::null);

  // Create Jacobian operator for bordered solver
  jacOp = Teuchos::rcp(new LOCA::BorderedSolver::JacobianOperator(grpPtr));
}
Пример #14
0
LOCA::Pitchfork::MooreSpence::ExtendedGroup::ExtendedGroup(
	 const Teuchos::RCP<LOCA::GlobalData>& global_data,
         const Teuchos::RCP<LOCA::Parameter::SublistParser>& topParams,
	 const Teuchos::RCP<Teuchos::ParameterList>& tpParams,
	 const Teuchos::RCP<LOCA::Pitchfork::MooreSpence::AbstractGroup>& g)
  : LOCA::Extended::MultiAbstractGroup(),
    LOCA::MultiContinuation::AbstractGroup(),
    globalData(global_data),
    parsedParams(topParams),
    pitchforkParams(tpParams),
    grpPtr(g),
    xMultiVec(globalData, g->getX(), 1),
    fMultiVec(globalData, g->getX(), 2),
    newtonMultiVec(globalData, g->getX(), 1),
    asymMultiVec(),
    lengthMultiVec(),
    xVec(),
    fVec(),
    ffMultiVec(),
    dfdpMultiVec(),
    newtonVec(),
    asymVec(),
    lengthVec(),
    solverStrategy(),
    index_f(1),
    index_dfdp(1),
    bifParamID(1), 
    isValidF(false),
    isValidJacobian(false),
    isValidNewton(false)
{
  const char *func = "LOCA::Pitchfork::MooreSpence::ExtendedGroup()";

  // Set x
  *(xMultiVec.getColumn(0)->getXVec()) = g->getX();

  if (!pitchforkParams->isParameter("Bifurcation Parameter")) {
    globalData->locaErrorCheck->throwError(func,
				 "\"Bifurcation Parameter\" name is not set!");
  }
  string bifParamName = pitchforkParams->get(
						  "Bifurcation Parameter",
						  "None");
  const ParameterVector& p = grpPtr->getParams();
  bifParamID[0] = p.getIndex(bifParamName);

  if (!pitchforkParams->isParameter("Antisymmetric Vector")) {
    globalData->locaErrorCheck->throwError(func,
			   "\"Antisymmetric Vector\" is not set!");
  }
  Teuchos::RCP<NOX::Abstract::Vector> asymVecPtr = 
    (*pitchforkParams).INVALID_TEMPLATE_QUALIFIER 
    get< Teuchos::RCP<NOX::Abstract::Vector> >("Antisymmetric Vector");

  if (!pitchforkParams->isParameter("Length Normalization Vector")) {
    globalData->locaErrorCheck->throwError(func,
			   "\"Length Normalization Vector\" is not set!");
  }
  Teuchos::RCP<NOX::Abstract::Vector> lenVecPtr = 
    (*pitchforkParams).INVALID_TEMPLATE_QUALIFIER 
    get< Teuchos::RCP<NOX::Abstract::Vector> >("Length Normalization Vector");

  if (!pitchforkParams->isParameter("Initial Null Vector")) {
    globalData->locaErrorCheck->throwError(func,
				 "\"Initial Null Vector\" is not set!");
  }
  Teuchos::RCP<NOX::Abstract::Vector> nullVecPtr = 
    (*pitchforkParams).INVALID_TEMPLATE_QUALIFIER 
    get< Teuchos::RCP<NOX::Abstract::Vector> >("Initial Null Vector");

  bool perturbSoln = pitchforkParams->get(
					       "Perturb Initial Solution", 
					       false);
  double perturbSize = pitchforkParams->get(
						 "Relative Perturbation Size", 
						 1.0e-3);
  asymMultiVec = 
    asymVecPtr->createMultiVector(1, NOX::DeepCopy);
  lengthMultiVec = 
    lenVecPtr->createMultiVector(1, NOX::DeepCopy);
  *(xMultiVec.getColumn(0)->getNullVec()) = *nullVecPtr;

  // Instantiate solver strategy
  solverStrategy = 
    globalData->locaFactory->createMooreSpencePitchforkSolverStrategy(
							      parsedParams,
							      pitchforkParams);

  // Set up multi-vector views
  setupViews(); 

  init(perturbSoln, perturbSize);
}
Пример #15
0
LOCA::Hopf::MinimallyAugmented::ExtendedGroup::
ExtendedGroup(
       const Teuchos::RCP<LOCA::GlobalData>& global_data,
       const Teuchos::RCP<LOCA::Parameter::SublistParser>& topParams,
       const Teuchos::RCP<Teuchos::ParameterList>& hpfParams,
       const Teuchos::RCP<LOCA::Hopf::MinimallyAugmented::AbstractGroup>& g)
  : globalData(global_data),
    parsedParams(topParams),
    hopfParams(hpfParams),
    grpPtr(g),
    bordered_grp(),
    constraintsPtr(),
    xMultiVec(globalData, g->getX(), 1, 2, NOX::DeepCopy),
    fMultiVec(globalData, g->getX(), 3, 2, NOX::ShapeCopy),
    newtonMultiVec(globalData, g->getX(), 1, 2, NOX::ShapeCopy),
    gradientMultiVec(globalData, g->getX(), 1, 2, NOX::ShapeCopy),
    xVec(),
    fVec(),
    ffMultiVec(),
    dfdpMultiVec(),
    fBifMultiVec(),
    newtonVec(),
    gradientVec(),
    jacOp(),
    borderedSolver(),
    index_f(1),
    index_dfdp(2),
    bifParamID(-1),
    isValidF(false),
    isValidJacobian(false),
    isValidNewton(false),
    isValidGradient(false),
    isBordered(false)
{
  const char *func = "LOCA::Hopf::MinimallyAugmented::ExtendedGroup()";

  // Set up multi-vector views
  setupViews(); 

  // Get bifurcation parameter name
  if (!hopfParams->isParameter("Bifurcation Parameter")) {
    globalData->locaErrorCheck->throwError(func,
				 "\"Bifurcation Parameter\" name is not set!");
  }
  string bifParamName = hopfParams->get("Bifurcation Parameter", "None");
  const ParameterVector& p = grpPtr->getParams();
  bifParamID = p.getIndex(bifParamName);

  // Get Hopf frequency
  if (!hopfParams->isParameter("Initial Frequency")) {
    globalData->locaErrorCheck->throwError(func,
					 "\"Initial Frequency\" is not set!");
  }
  double omega = 
    hopfParams->get("Initial Frequency", 1.0);

  // Get symmetric flag
  bool isSymmetric = hopfParams->get("Symmetric Jacobian", false);

  // Compute/get initial "a" & "b" vectors
  Teuchos::RCP<NOX::Abstract::Vector> aVecPtr_real;
  Teuchos::RCP<NOX::Abstract::Vector> aVecPtr_imag;
  Teuchos::RCP<NOX::Abstract::Vector> bVecPtr_real;
  Teuchos::RCP<NOX::Abstract::Vector> bVecPtr_imag;
  getInitialVectors(aVecPtr_real, aVecPtr_imag, bVecPtr_real, bVecPtr_imag,
		    isSymmetric);

  // Create constraint equation
  constraintsPtr = 
    Teuchos::rcp(new LOCA::Hopf::MinimallyAugmented::Constraint(
							   globalData,
							   parsedParams,
							   hopfParams,
							   grpPtr,
							   isSymmetric,
							   *aVecPtr_real,
							   *aVecPtr_imag,
							   bVecPtr_real.get(),
							   bVecPtr_imag.get(),
							   bifParamID,
							   omega));

  // Set parameters in solution vector
  xVec->getScalar(0) = grpPtr->getParam(bifParamID);
  xVec->getScalar(1) = omega;

  // Set parameters and solution vector in constraints
  constraintsPtr->setParam(bifParamID, xVec->getScalar(0));
  constraintsPtr->setX(*(xVec->getXVec()));

  // Instantiate bordered solver
  borderedSolver = 
    globalData->locaFactory->createBorderedSolverStrategy(parsedParams,
							  hopfParams);

  // Determine if underlying group is bordered
  bordered_grp = 
    Teuchos::rcp_dynamic_cast<LOCA::BorderedSystem::AbstractGroup>(grpPtr);
  isBordered = (bordered_grp != Teuchos::null);

  // Create Jacobian operator for bordered solver
  jacOp = Teuchos::rcp(new LOCA::BorderedSolver::JacobianOperator(grpPtr));
}
Пример #16
0
LOCA::Homotopy::DeflatedGroup::
DeflatedGroup(
       const Teuchos::RCP<LOCA::GlobalData>& global_data,
       const Teuchos::RCP<Teuchos::ParameterList>& topParams,
       const Teuchos::RCP<Teuchos::ParameterList>& hParams,
       const Teuchos::RCP<LOCA::Homotopy::AbstractGroup>& g,
       const Teuchos::RCP<const NOX::Abstract::Vector>& start_vec,
       const std::vector< Teuchos::RCP<const NOX::Abstract::Vector> >& prev_solns,
       const double identity_sign)
  : globalData(global_data),
    parsedParams(),
    homotopyParams(hParams),
    grpPtr(g),
    bordered_grp(),
    xMultiVec(globalData, g->getX(), 1, 1, NOX::DeepCopy),
    fMultiVec(globalData, g->getX(), 1, 1, NOX::ShapeCopy),
    newtonMultiVec(globalData, g->getX(), 1, 1, NOX::ShapeCopy),
    gradientMultiVec(globalData, g->getX(), 1, 1, NOX::ShapeCopy),
    xVec(),
    fVec(),
    newtonVec(),
    gradientVec(),
    startVec(start_vec),
    identitySign(identity_sign),
    solns(prev_solns),
    distVec(startVec->clone(NOX::ShapeCopy)),
    totalDistMultiVec(startVec->createMultiVector(1, NOX::ShapeCopy)),
    underlyingF(startVec->createMultiVector(1, NOX::ShapeCopy)),
    jacOp(),
    borderedSolver(),
    minusOne(),
    numSolns(solns.size()),
    distances(numSolns),
    distProd(0.0),
    index_f(1),
    paramVec(grpPtr->getParams()),
    conParam(0.0),
    conParamID(-1),
    conParamLabel("Homotopy Continuation Parameter"),
    augmentJacForHomotopyNotImplemented(false),
    isValidF(false),
    isValidJacobian(false),
    isValidNewton(false),
    isValidGradient(false),
    isBordered(false)
{
  // Set up multi-vector views
  setupViews(); 

  // Set the homotopy parameter as a parameter in the ParameterVector.
  // This will allow us to do an invasive homotopy since the app can now 
  // get access to the homotopy continuation parameter.
  paramVec.addParameter(conParamLabel, conParam);
  grpPtr->setParams(paramVec);

  // Set up paramID
  conParamID = paramVec.getIndex(conParamLabel);

  setStepperParameters(*topParams);

  // Parse parameter list
  parsedParams = Teuchos::rcp(new LOCA::Parameter::SublistParser(globalData));
  parsedParams->parseSublists(topParams);

  // Set initial solution and parameters in solution vector
  grpPtr->setX(*startVec);
  *(xVec->getXVec()) = *startVec;
  xVec->getScalar(0) = conParam;

  // Create "C" block in bordered solver
  minusOne = Teuchos::rcp(new NOX::Abstract::MultiVector::DenseMatrix(1, 1));
  (*minusOne)(0,0) = -1.0;

  // Instantiate bordered solver
  borderedSolver = globalData->locaFactory->createBorderedSolverStrategy(
				   parsedParams,
				   homotopyParams);

  // Determine if underlying group is bordered
  bordered_grp = 
    Teuchos::rcp_dynamic_cast<LOCA::BorderedSystem::AbstractGroup>(grpPtr);
  isBordered = (bordered_grp != Teuchos::null);

  // Create Jacobian operator for bordered solver
  jacOp = Teuchos::rcp(new LOCA::BorderedSolver::JacobianOperator(grpPtr));
}
Пример #17
0
LOCA::Homotopy::DeflatedGroup::
DeflatedGroup(const LOCA::Homotopy::DeflatedGroup& source,
	      NOX::CopyType type)
  : globalData(source.globalData),
    parsedParams(source.parsedParams),
    homotopyParams(source.homotopyParams),
    grpPtr(Teuchos::rcp_dynamic_cast<LOCA::Homotopy::AbstractGroup>(source.grpPtr->clone(type))),
    bordered_grp(),
    xMultiVec(source.xMultiVec, type),
    fMultiVec(source.fMultiVec, type),
    newtonMultiVec(source.newtonMultiVec, type),
    gradientMultiVec(source.gradientMultiVec, type),
    xVec(),
    fVec(),
    newtonVec(),
    gradientVec(),
    startVec(source.startVec),
    identitySign(source.identitySign),
    solns(source.solns),
    distVec(source.distVec->clone(type)),
    totalDistMultiVec(source.totalDistMultiVec->clone(type)),
    underlyingF(source.underlyingF->clone(type)),
    jacOp(),
    borderedSolver(source.borderedSolver),
    minusOne(Teuchos::rcp(new NOX::Abstract::MultiVector::DenseMatrix(*source.minusOne))),
    numSolns(source.numSolns),
    distances(source.distances),
    distProd(source.distProd),
    index_f(1),
    paramVec(source.paramVec),
    conParam(source.conParam),
    conParamID(source.conParamID),
    conParamLabel(source.conParamLabel),
    augmentJacForHomotopyNotImplemented(source.augmentJacForHomotopyNotImplemented),
    isValidF(source.isValidF),
    isValidJacobian(source.isValidJacobian),
    isValidNewton(source.isValidNewton),
    isValidGradient(source.isValidGradient),
    isBordered(false)
{
  // Set up multi-vector views
  setupViews();

  // Instantiate bordered solver
  borderedSolver = globalData->locaFactory->createBorderedSolverStrategy(
				   parsedParams,
				   homotopyParams);

  if (type == NOX::ShapeCopy) {
    isValidF = false;
    isValidJacobian = false;
    isValidNewton = false;
    isValidGradient = false;
  }

  // Determine if underlying group is bordered
  bordered_grp = 
    Teuchos::rcp_dynamic_cast<LOCA::BorderedSystem::AbstractGroup>(grpPtr);
  isBordered = (bordered_grp != Teuchos::null);

  // Create Jacobian operator for bordered solver
  jacOp = Teuchos::rcp(new LOCA::BorderedSolver::JacobianOperator(grpPtr));

  // Set blocks in bordered solver
  if (isValidJacobian) {
    borderedSolver->setMatrixBlocksMultiVecConstraint(jacOp, 
						      underlyingF,
						      totalDistMultiVec,
						      minusOne);
    NOX::Abstract::Group::ReturnType status = borderedSolver->initForSolve();
    globalData->locaErrorCheck->checkReturnType(status, 
						"LOCA::Homotopy::DeflatedGroup()");
  }
}
Пример #18
0
MainWindow::MainWindow(QWidget *parent, Qt::WindowFlags flags)
  : QMainWindow(parent, flags), m_activityCompleter(NULL),
    m_tagCompleter(NULL), m_activityCompleterModel(NULL),
    m_tagCompleterModel(NULL), m_trayIconAvailable(false),
    m_showTrayIcon(false), m_trayIconMenu(NULL), m_trayIcon(NULL)
{
  m_ui.setupUi(this);
  setWindowIcon(QIcon(":/icons/hourglass.png"));
  m_ui.actionAbout_Qt->setIcon(QIcon(":/trolltech/qmessagebox/images/qtlogo-64.png"));

  m_trayIconAvailable = QSystemTrayIcon::isSystemTrayAvailable();
  if (m_trayIconAvailable) {
    m_showTrayIcon = m_settings.value("showTrayIcon", true).toBool();
    if (m_showTrayIcon) {
      createTrayIcon();
    }
  }
  else {
    qDebug() << "Couldn't display tray icon";
  }

  /* Set background of week tab to white */
  QPalette weekPal(m_ui.saContentsWeek->palette());
  weekPal.setColor(QPalette::Background, Qt::white);
  m_ui.saContentsWeek->setPalette(weekPal);

  /* Set background of current activity table to transparent */
  QPalette currentPal(m_ui.tblCurrent->palette());
  currentPal.setColor(QPalette::Base, Qt::transparent);
  m_ui.tblCurrent->setPalette(currentPal);

  /* Setup activity completer */
  m_activityCompleter = new QCompleter(this);
  m_activityCompleterModel = new ActivityNamesListModel(this);
  m_activityCompleter->setModel(m_activityCompleterModel);
  m_activityCompleter->setCompletionMode(QCompleter::PopupCompletion);
  m_activityCompleter->setCaseSensitivity(Qt::CaseInsensitive);

  QAbstractItemView *activityPopup = m_activityCompleter->popup();
  activityPopup->setItemDelegate(new NamesDelegate(activityPopup));
  activityPopup->setFrameShadow(QFrame::Plain);

  m_ui.leActivity->setCompleter(m_activityCompleter);

  /* Setup tag completer */
  m_tagCompleter = new QCompleter(this);
  m_tagCompleterModel = new TagNamesListModel(this);
  m_tagCompleter->setModel(m_tagCompleterModel);
  m_tagCompleter->setCompletionMode(QCompleter::PopupCompletion);
  m_tagCompleter->setCaseSensitivity(Qt::CaseInsensitive);

  QAbstractItemView *tagPopup = m_tagCompleter->popup();
  tagPopup->setItemDelegate(new NamesDelegate(tagPopup));
  tagPopup->setFrameShadow(QFrame::Plain);

  m_ui.leTags->setCompleter(m_tagCompleter);

  /* Set up activity tables */
  m_recordManager = new RecordManager<Activity>;

  m_ui.tblCurrent->setModel(new CurrentActivityTableModel(m_recordManager, this));
  m_ui.tblCurrent->setItemDelegate(new CurrentActivityDelegate(m_ui.tblCurrent));
  connect(this, SIGNAL(activityCreated(QSharedPointer<Activity>)),
      m_ui.tblCurrent->model(), SLOT(created(QSharedPointer<Activity>)));

  setupViews();

  /* Set a timer to go off hourly to check if we should switch days */
  m_dayTimer = new QTimer(this);
  m_dayTimer->setInterval(3600000);
  connect(m_dayTimer, SIGNAL(timeout()), this, SLOT(setupViews()));

  QTime nowTime = QTime::currentTime();
  int msecsToHour = 3600000 - (nowTime.minute() * 60000) -
    (nowTime.second() * 1000) - nowTime.msec();
  QTimer::singleShot(msecsToHour, this, SLOT(setupViews()));
  QTimer::singleShot(msecsToHour, m_dayTimer, SLOT(start()));
}