/usr/lib/python2.7/dist-packages/code_saturne/Pages/BoundaryConditionsCoalInletView.py is in code-saturne-data 4.3.3+repack-1build1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 | # -*- coding: utf-8 -*-
#-------------------------------------------------------------------------------
# This file is part of Code_Saturne, a general-purpose CFD tool.
#
# Copyright (C) 1998-2016 EDF S.A.
#
# This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation; either version 2 of the License, or (at your option) any later
# version.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
# details.
#
# You should have received a copy of the GNU General Public License along with
# this program; if not, write to the Free Software Foundation, Inc., 51 Franklin
# Street, Fifth Floor, Boston, MA 02110-1301, USA.
#-------------------------------------------------------------------------------
"""
This module contains the following classes:
- BoundaryConditionsCoalInletView
- ValueDelegate
- StandardItemModelCoal
- StandardItemModelCoalMass
"""
#-------------------------------------------------------------------------------
# Standard modules
#-------------------------------------------------------------------------------
import string, logging
#-------------------------------------------------------------------------------
# Third-party modules
#-------------------------------------------------------------------------------
from code_saturne.Base.QtCore import *
from code_saturne.Base.QtGui import *
from code_saturne.Base.QtWidgets import *
#-------------------------------------------------------------------------------
# Application modules import
#-------------------------------------------------------------------------------
from code_saturne.Base.Toolbox import GuiParam
from code_saturne.Base.QtPage import DoubleValidator, ComboModel
from code_saturne.Base.QtPage import to_qvariant, from_qvariant, to_text_string
from code_saturne.Pages.BoundaryConditionsCoalInletForm import Ui_BoundaryConditionsCoalInletForm
import code_saturne.Pages.CoalCombustionModel as CoalCombustion
from code_saturne.Pages.LocalizationModel import LocalizationModel, Zone
from code_saturne.Pages.Boundary import Boundary
from code_saturne.Pages.QMeiEditorView import QMeiEditorView
#-------------------------------------------------------------------------------
# log config
#-------------------------------------------------------------------------------
logging.basicConfig()
log = logging.getLogger("BoundaryConditionsCoalInletView")
log.setLevel(GuiParam.DEBUG)
#-------------------------------------------------------------------------------
# Line edit delegate with a Double validator (positive value)
#-------------------------------------------------------------------------------
class ValueDelegate(QItemDelegate):
def __init__(self, parent=None):
super(ValueDelegate, self).__init__(parent)
self.parent = parent
def createEditor(self, parent, option, index):
editor = QLineEdit(parent)
validator = DoubleValidator(editor, min=0.)
editor.setValidator(validator)
return editor
def setEditorData(self, editor, index):
value = from_qvariant(index.model().data(index, Qt.DisplayRole), to_text_string)
editor.setText(value)
def setModelData(self, editor, model, index):
if editor.validator().state == QValidator.Acceptable:
value = from_qvariant(editor.text(), float)
model.setData(index, to_qvariant(value), Qt.DisplayRole)
#-------------------------------------------------------------------------------
# StandarItemModel class to display Coals in a QTableView
#-------------------------------------------------------------------------------
class StandardItemModelCoal(QStandardItemModel):
def __init__(self, case):
QStandardItemModel.__init__(self)
self.headers = [self.tr("Coal number"),
self.tr("Flow (kg/s)"),
self.tr("Temperature \n(K)")]
self.setColumnCount(len(self.headers))
self.dataCoal = []
self.__case = case
def setBoundaryFromLabel(self, label):
self.modelBoundary = Boundary('coal_inlet', label, self.__case)
def data(self, index, role):
if not index.isValid():
return to_qvariant()
if role == Qt.DisplayRole:
return to_qvariant(self.dataCoal[index.row()][index.column()])
return to_qvariant()
def flags(self, index):
if not index.isValid():
return Qt.ItemIsEnabled
elif index.column() in [1,2]:
return Qt.ItemIsEnabled | Qt.ItemIsSelectable | Qt.ItemIsEditable
else:
return Qt.ItemIsEnabled | Qt.ItemIsSelectable
def headerData(self, section, orientation, role):
if orientation == Qt.Horizontal and role == Qt.DisplayRole:
return to_qvariant(self.headers[section])
return to_qvariant()
def setData(self, index, value, role):
row = index.row()
col = index.column()
if not hasattr(self, "modelBoundary"):
log.debug("ERROR in setData (StandardItemModelCoal) : no Boundary model defined")
return
v = from_qvariant(value, float)
self.dataCoal[row][col] = v
if col == 1:
self.modelBoundary.setCoalFlow(v, row)
elif col == 2:
self.modelBoundary.setCoalTemperature(v, row)
self.dataChanged.emit(index, index)
return True
def insertItem(self, nameCoal, valCoal, valCoalTemp):
line = [nameCoal, valCoal, valCoalTemp]
self.dataCoal.append(line)
row = self.rowCount()
self.setRowCount(row+1)
def deleteAll(self):
self.dataCoal = []
self.setRowCount(0)
#-------------------------------------------------------------------------------
# StandarItemModel class to display Coal masses in a QTableView
#-------------------------------------------------------------------------------
class StandardItemModelCoalMass(QStandardItemModel):
def __init__(self, case, coalNumber, coalClassesNumber):
QStandardItemModel.__init__(self)
self.__case = case
self.coalNumber = coalNumber
self.coalClassesNumber = coalClassesNumber
def setRatio(self, ratio):
cols = len(ratio)
if type(ratio[0]) == type([]):
rows = max([len(c) for c in ratio])
else:
rows = 1
self.setColumnCount(cols)
self.setRowCount(rows)
self.ratio = ratio
def setBoundaryFromLabel(self, label):
log.debug("setBoundaryFromLabel")
self.modelBoundary = Boundary('coal_inlet', label, self.__case)
def data(self, index, role):
if not index.isValid():
return to_qvariant()
if role == Qt.DisplayRole:
classe = index.row()
coal = index.column()
if classe < self.coalClassesNumber[coal]:
try:
return to_qvariant(self.ratio[coal][classe])
except:
log.debug("ERROR no data for self.ratio[%i][%i] "%(coal, classe))
return to_qvariant()
def flags(self, index):
if not index.isValid():
return Qt.ItemIsEnabled
elif index.row() >= self.coalClassesNumber[index.column()]:
return Qt.ItemIsEnabled | Qt.ItemIsSelectable
else:
return Qt.ItemIsEnabled | Qt.ItemIsSelectable | Qt.ItemIsEditable
def headerData(self, section, orientation, role):
if orientation == Qt.Horizontal and role == Qt.DisplayRole:
return to_qvariant("Coal" + " " + str(section+1))
if orientation == Qt.Vertical and role == Qt.DisplayRole:
return to_qvariant("Class" + " " + str(section+1))
return to_qvariant()
def setData(self, index, value, role):
if not hasattr(self, "modelBoundary"):
log.debug("ERROR in setData (StandardItemModelCoalMass): no Boundary model defined")
return
classe = index.row()
coal = index.column()
v = from_qvariant(value, float)
self.ratio[coal][classe] = v
log.debug("setData v = %f "%v)
lst = self.modelBoundary.getCoalRatios(coal)
lastValue = 0
for iclasse in range(0, self.coalClassesNumber[coal]-1):
lastValue += self.ratio[coal][iclasse]
if lastValue < 100.+ 1e-6 :
lst[classe] = self.ratio[coal][classe]
lastValue = 100 - lastValue
self.ratio[coal][self.coalClassesNumber[coal]-1] = lastValue
lst[self.coalClassesNumber[coal]-1] = lastValue
self.modelBoundary.setCoalRatios(coal, lst)
else :
self.ratio[coal][classe] = lst[classe]
self.dataChanged.emit(index, index)
return True
def deleteAll(self):
self.ratio = []
self.setRowCount(0)
#-------------------------------------------------------------------------------
# Main class
#-------------------------------------------------------------------------------
class BoundaryConditionsCoalInletView(QWidget, Ui_BoundaryConditionsCoalInletForm):
def __init__(self, parent):
"""
Constructor
"""
QWidget.__init__(self, parent)
Ui_BoundaryConditionsCoalInletForm.__init__(self)
self.setupUi(self)
def setup(self, case):
"""
Setup the widget
"""
self.__case = case
self.__boundary = None
self.__case.undoStopGlobal()
# Connections
self.comboBoxTypeInlet.activated[str].connect(self.__slotInletType)
self.comboBoxVelocity.activated[str].connect(self.__slotChoiceVelocity)
self.lineEditVelocity.textChanged[str].connect(self.__slotVelocityValue)
self.lineEditTemperature.textChanged[str].connect(self.__slotTemperature)
self.spinBoxOxydantNumber.valueChanged[int].connect(self.__slotOxydantNumber)
self.comboBoxDirection.activated[str].connect(self.__slotChoiceDirection)
self.lineEditDirectionX.textChanged[str].connect(self.__slotDirX)
self.lineEditDirectionY.textChanged[str].connect(self.__slotDirY)
self.lineEditDirectionZ.textChanged[str].connect(self.__slotDirZ)
# Combo models
self.modelTypeInlet = ComboModel(self.comboBoxTypeInlet, 2, 1)
self.modelTypeInlet.addItem(self.tr("only oxydant"), 'oxydantFlow')
self.modelTypeInlet.addItem(self.tr("oxydant and coal"), 'coalFlow')
self.modelVelocity = ComboModel(self.comboBoxVelocity, 4, 1)
self.modelVelocity.addItem(self.tr("norm"), 'norm')
self.modelVelocity.addItem(self.tr("mass flow rate"), 'flow1')
self.modelVelocity.addItem(self.tr("norm (user law)"), 'norm_formula')
self.modelVelocity.addItem(self.tr("mass flow rate (user law)"), 'flow1_formula')
self.modelDirection = ComboModel(self.comboBoxDirection, 3, 1)
self.modelDirection.addItem(self.tr("normal to the inlet"), 'normal')
self.modelDirection.addItem(self.tr("specified coordinates"), 'coordinates')
self.modelDirection.addItem(self.tr("user profile"), 'formula')
# Validators
validatorVelocity = DoubleValidator(self.lineEditVelocity)
validatorX = DoubleValidator(self.lineEditDirectionX)
validatorY = DoubleValidator(self.lineEditDirectionY)
validatorZ = DoubleValidator(self.lineEditDirectionZ)
validatorTemp = DoubleValidator(self.lineEditTemperature, min=0.)
# Apply validators
self.lineEditVelocity.setValidator(validatorVelocity)
self.lineEditDirectionX.setValidator(validatorX)
self.lineEditDirectionY.setValidator(validatorY)
self.lineEditDirectionZ.setValidator(validatorZ)
self.lineEditTemperature.setValidator(validatorTemp)
self.pushButtonVelocityFormula.clicked.connect(self.__slotVelocityFormula)
self.pushButtonDirectionFormula.clicked.connect(self.__slotDirectionFormula)
# Useful information about coals, classes, and ratios
mdl = CoalCombustion.CoalCombustionModel(self.__case)
if mdl.getCoalCombustionModel() != "off":
self.__coalNumber = mdl.getCoalNumber()
self.__coalClassesNumber = []
for coal in range(0, self.__coalNumber):
self.__coalClassesNumber.append(mdl.getClassNumber(str(coal+1)))
self.__maxOxydantNumber = mdl.getOxidantNumber()
else:
self.__coalNumber = 0
self.__coalClassesNumber = [0]
self.__maxOxydantNumber = 1
self.__ratio = self.__coalNumber*[0]
for i in range(0, self.__coalNumber):
self.__ratio[i] = self.__coalClassesNumber[i]*[0]
# Coal table
self.__modelCoal = StandardItemModelCoal(self.__case)
self.tableViewCoal.setModel(self.__modelCoal)
delegateValue = ValueDelegate(self.tableViewCoal)
self.tableViewCoal.setItemDelegateForColumn(1, delegateValue)
self.tableViewCoal.setItemDelegateForColumn(2, delegateValue)
# Coal mass ratio table
self.__modelCoalMass = StandardItemModelCoalMass(self.__case,
self.__coalNumber,
self.__coalClassesNumber)
self.tableViewCoalMass.setModel(self.__modelCoalMass)
delegateValueMass = ValueDelegate(self.tableViewCoalMass)
for c in range(self.__modelCoalMass.columnCount()):
self.tableViewCoalMass.setItemDelegateForColumn(c, delegateValueMass)
self.__case.undoStartGlobal()
def showWidget(self, b):
"""
Show the widget
"""
label = b.getLabel()
self.__boundary = Boundary('coal_inlet', label, self.__case)
# Initialize velocity
choice = self.__boundary.getVelocityChoice()
self.modelVelocity.setItem(str_model=choice)
self.__updateLabel()
if choice[-7:] == "formula":
self.pushButtonVelocityFormula.setEnabled(True)
self.lineEditVelocity.setEnabled(False)
else:
self.pushButtonVelocityFormula.setEnabled(False)
self.lineEditVelocity.setEnabled(True)
v = self.__boundary.getVelocity()
self.lineEditVelocity.setText(str(v))
# Initialize oxydant and temperature
self.spinBoxOxydantNumber.setMaximum(self.__maxOxydantNumber)
o = self.__boundary.getOxydantNumber()
self.spinBoxOxydantNumber.setValue(o)
t = self.__boundary.getOxydantTemperature()
self.lineEditTemperature.setText(str(t))
# Initialize direction
choice = self.__boundary.getDirectionChoice()
self.modelDirection.setItem(str_model=choice)
text = self.modelDirection.dicoM2V[choice]
if choice == "formula":
self.pushButtonDirectionFormula.setEnabled(True)
self.frameDirectionCoordinates.hide()
elif choice == "coordinates":
self.pushButtonDirectionFormula.setEnabled(False)
self.frameDirectionCoordinates.show()
v = self.__boundary.getDirection('direction_x')
self.lineEditDirectionX.setText(str(v))
v = self.__boundary.getDirection('direction_y')
self.lineEditDirectionY.setText(str(v))
v = self.__boundary.getDirection('direction_z')
self.lineEditDirectionZ.setText(str(v))
elif choice == "normal":
self.pushButtonDirectionFormula.setEnabled(False)
self.frameDirectionCoordinates.hide()
log.debug("showWidget:inlet type: %s " % self.__boundary.getInletType())
if self.__boundary.getInletType() == "coalFlow":
self.modelTypeInlet.setItem(str_model="coalFlow")
self.groupBoxCoal.show()
self.groupBoxCoalMass.show()
self.__updateTables()
self.__boundary.setInletType("coalFlow")
else:
self.__boundary.setInletType("oxydantFlow")
self.modelTypeInlet.setItem(str_model="oxydantFlow")
self.groupBoxCoal.hide()
self.groupBoxCoalMass.hide()
self.show()
def hideWidget(self):
"""
Hide all
"""
self.hide()
def __updateTables(self):
"""
Insert rows in the two QTableView.
"""
# clean the QTableView
self.__modelCoal.deleteAll()
self.__modelCoalMass.deleteAll()
label = self.__boundary.getLabel()
self.__modelCoalMass.setBoundaryFromLabel(label)
self.__modelCoal.setBoundaryFromLabel(label)
# fill the flow and temperature of the coal
for coal in range(0, self.__coalNumber):
self.__modelCoal.insertItem(self.tr("Coal ") + " " + str(coal+1),
self.__boundary.getCoalFlow(coal),
self.__boundary.getCoalTemperature(coal))
# fill the ratio of mass for each class for each coal
for coal in range(0, self.__coalNumber) :
lastValue = 0.
for coalClass in range(0, self.__coalClassesNumber[coal]-1):
lst = self.__boundary.getCoalRatios(coal)
lastValue += lst[coalClass]
self.__ratio[coal][coalClass] = lst[coalClass]
# last class is computed in order to assure that sum is egal to 100%
coalClass = self.__coalClassesNumber[coal]-1
lastValue = 100 - lastValue
self.__ratio[coal][coalClass] = lastValue
self.__modelCoalMass.setRatio(self.__ratio)
@pyqtSlot(str)
def __slotChoiceVelocity(self, text):
"""
Private slot.
Input the velocity boundary type choice (norm, ).
@type text: C{QString}
@param text: velocity boundary type choice.
"""
c = self.modelVelocity.dicoV2M[str(text)]
log.debug("slotChoiceVelocity: %s " % c)
self.__boundary.setVelocityChoice(c)
if c[-7:] == "formula":
self.pushButtonVelocityFormula.setEnabled(True)
exp = self.__boundary.getVelocity()
if exp:
self.pushButtonVelocityFormula.setStyleSheet("background-color: green")
self.pushButtonVelocityFormula.setToolTip(exp)
else:
self.pushButtonVelocityFormula.setStyleSheet("background-color: red")
self.lineEditVelocity.setEnabled(False)
self.lineEditVelocity.setText("")
else:
self.pushButtonVelocityFormula.setEnabled(False)
self.pushButtonVelocityFormula.setStyleSheet("background-color: None")
self.lineEditVelocity.setEnabled(True)
v = self.__boundary.getVelocity()
self.lineEditVelocity.setText(str(v))
self.__updateLabel()
def __updateLabel(self):
"""
Update the unit for the velocity specification.
"""
c = self.__boundary.getVelocityChoice()
if c in ('norm', 'norm_formula'):
self.labelUnitVelocity.setText(str('m/s'))
elif c in ('flow1', 'flow1_formula'):
self.labelUnitVelocity.setText(str('kg/s'))
elif c in ('flow2', 'flow2_formula'):
self.labelUnitVelocity.setText(str('m<sup>3</sup>/s'))
@pyqtSlot(str)
def __slotVelocityValue(self, text):
"""
Private slot.
New value associated to the velocity boundary type.
@type text: C{QString}
@param text: value
"""
if self.sender().validator().state == QValidator.Acceptable:
v = from_qvariant(text, float)
self.__boundary.setVelocity(v)
@pyqtSlot()
def __slotVelocityFormula(self):
"""
"""
exp = self.__boundary.getVelocity()
c = self.__boundary.getVelocityChoice()
if c == 'norm_formula':
exa = "u_norm = 1.0;"
req = [('u_norm', 'Norm of the velocity')]
elif c == 'flow1_formula':
exa = "q_m = 1.0;"
req = [('q_m', 'mass flow rate')]
elif c == 'flow2_formula':
exa = "q_v = 1.0;"
req = [('q_v', 'volumic flow rate')]
sym = [('x', "X face's gravity center"),
('y', "Y face's gravity center"),
('z', "Z face's gravity center"),
('dt', 'time step'),
('t', 'current time'),
('iter', 'number of iteration')]
dialog = QMeiEditorView(self,
check_syntax = self.__case['package'].get_check_syntax(),
expression = exp,
required = req,
symbols = sym,
examples = exa)
if dialog.exec_():
result = dialog.get_result()
log.debug("slotFormulaVelocity -> %s" % str(result))
self.__boundary.setVelocity(str(result))
self.pushButtonVelocityFormula.setToolTip(result)
self.pushButtonVelocityFormula.setStyleSheet("background-color: green")
@pyqtSlot(str)
def __slotChoiceDirection(self, text):
"""
Input the direction type choice.
"""
c = self.modelDirection.dicoV2M[str(text)]
log.debug("slotChoiceVelocity: %s " % c)
self.__boundary.setDirectionChoice(c)
if c == "formula":
self.pushButtonDirectionFormula.setEnabled(True)
exp = self.__boundary.getDirection('direction_formula')
if exp:
self.pushButtonDirectionFormula.setStyleSheet("background-color: green")
self.pushButtonDirectionFormula.setToolTip(exp)
else:
self.pushButtonDirectionFormula.setStyleSheet("background-color: red")
self.frameDirectionCoordinates.hide()
elif c == "coordinates":
self.pushButtonDirectionFormula.setEnabled(False)
self.pushButtonDirectionFormula.setStyleSheet("background-color: None")
self.frameDirectionCoordinates.show()
v = self.__boundary.getDirection('direction_x')
self.lineEditDirectionX.setText(str(v))
v = self.__boundary.getDirection('direction_y')
self.lineEditDirectionY.setText(str(v))
v = self.__boundary.getDirection('direction_z')
self.lineEditDirectionZ.setText(str(v))
elif c == "normal":
self.pushButtonDirectionFormula.setEnabled(False)
self.pushButtonDirectionFormula.setStyleSheet("background-color: None")
self.frameDirectionCoordinates.hide()
@pyqtSlot(str)
def __slotDirX(self, text):
"""
INPUT value into direction of inlet flow
"""
if self.sender().validator().state == QValidator.Acceptable:
value = from_qvariant(text, float)
self.__boundary.setDirection('direction_x', value)
@pyqtSlot(str)
def __slotDirY(self, text):
"""
INPUT value into direction of inlet flow
"""
if self.sender().validator().state == QValidator.Acceptable:
value = from_qvariant(text, float)
self.__boundary.setDirection('direction_y', value)
@pyqtSlot(str)
def __slotDirZ(self, text):
"""
INPUT value into direction of inlet flow
"""
if self.sender().validator().state == QValidator.Acceptable:
value = from_qvariant(text, float)
self.__boundary.setDirection('direction_z', value)
@pyqtSlot()
def __slotDirectionFormula(self):
"""
"""
exp = self.__boundary.getDirection('direction_formula')
req = [('dir_x', 'Direction of the flow along X'),
('dir_y', 'Direction of the flow along Y'),
('dir_z', 'Direction of the flow along Z')]
exa = "dir_x = 3.0;\ndir_y = 1.0;\ndir_z = 0.0;\n"
sym = [('x', "X face's gravity center"),
('y', "Y face's gravity center"),
('z', "Z face's gravity center"),
('dt', 'time step'),
('t', 'current time'),
('iter', 'number of iteration')]
dialog = QMeiEditorView(self,
check_syntax = self.__case['package'].get_check_syntax(),
expression = exp,
required = req,
symbols = sym,
examples = exa)
if dialog.exec_():
result = dialog.get_result()
log.debug("slotFormulaDirection -> %s" % str(result))
self.__boundary.setDirection('direction_formula', str(result))
self.pushButtonDirectionFormula.setToolTip(result)
self.pushButtonDirectionFormula.setStyleSheet("background-color: green")
@pyqtSlot(str)
def __slotInletType(self, text):
"""
INPUT inlet type : 'oxydant' or 'oxydant + coal'
"""
value = self.modelTypeInlet.dicoV2M[str(text)]
log.debug("__slotInletType value = %s " % value)
self.__boundary.setInletType(value)
if value == 'oxydantFlow':
self.groupBoxCoal.hide()
self.groupBoxCoalMass.hide()
else:
self.groupBoxCoal.show()
self.groupBoxCoalMass.show()
self.__updateTables()
@pyqtSlot(str)
def __slotTemperature(self, text):
if self.sender().validator().state == QValidator.Acceptable:
t = from_qvariant(text, float)
self.__boundary.setOxydantTemperature(t)
@pyqtSlot(int)
def __slotOxydantNumber(self, i):
self.__boundary.setOxydantNumber(i)
def getCoalNumber(self):
"""
Return the coal number
"""
return self.__coalNumber
def tr(self, text):
"""
Translation
"""
return text
#-------------------------------------------------------------------------------
# End
#-------------------------------------------------------------------------------
|