This file is indexed.

/usr/lib/python2.7/dist-packages/code_saturne/Pages/LagrangianBoundariesView.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
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
# -*- 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:
- ValueDelegate
- StandardItemModelBoundaries
- LagrangianBoundariesView
"""

#-------------------------------------------------------------------------------
# Standard modules
#-------------------------------------------------------------------------------
import 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 IntValidator, DoubleValidator, ComboModel
from code_saturne.Base.QtPage import to_qvariant, from_qvariant, to_text_string

from code_saturne.Pages.LagrangianBoundariesForm import Ui_LagrangianBoundariesForm
from code_saturne.Pages.LocalizationModel import LocalizationModel, Zone
from code_saturne.Pages.LagrangianBoundariesModel import LagrangianBoundariesModel
from code_saturne.Pages.LagrangianModel import LagrangianModel
from code_saturne.Pages.LagrangianStatisticsModel import LagrangianStatisticsModel
from code_saturne.Pages.CoalCombustionModel import CoalCombustionModel


#-------------------------------------------------------------------------------
# log config
#-------------------------------------------------------------------------------

logging.basicConfig()
log = logging.getLogger("LagrangianBoundariesView")
log.setLevel(GuiParam.DEBUG)

#-------------------------------------------------------------------------------
# Line edit delegate with an integere validator
#-------------------------------------------------------------------------------

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 = IntValidator(editor, min=0) # nb max classes
        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)


#-------------------------------------------------------------------------------
# QComboBox delegate for the particle-boundary interaction
#-------------------------------------------------------------------------------


class ParticleBoundaryInteractionDelegate(QItemDelegate):
    """
    Use of a combo box in the table.
    """
    def __init__(self, parent):
        super(ParticleBoundaryInteractionDelegate, self).__init__(parent)
        self.parent = parent


    def createEditor(self, parent, option, index):
        editor = QComboBox(parent)
        self.combo_mdl = ComboModel(editor,1,1)
        nature = index.model()._data[index.row()][1]
        self.dico = index.model().dicoM2V[nature]
        for k, v in list(self.dico.items()):
            self.combo_mdl.addItem(v, k)
        editor.installEventFilter(self)
        editor.setMinimumWidth(100)
        return editor


    def setEditorData(self, comboBox, index):
        row = index.row()
        col = index.column()
        str_model = index.model()._data[row][col]
        self.combo_mdl.setItem(str_model=str_model)


    def setModelData(self, comboBox, model, index):
        txt   = str(comboBox.currentText())
        value = self.combo_mdl.dicoV2M[txt]
        selectionModel = self.parent.selectionModel()
        for idx in selectionModel.selectedIndexes():
            if idx.column() == index.column():
                model.setData(idx, to_qvariant(value), Qt.DisplayRole)


    def tr(self, text):
        return text


#-------------------------------------------------------------------------------
# StandarItemModel class to display boundaries in a QTreeView
#-------------------------------------------------------------------------------


class StandardItemModelBoundaries(QStandardItemModel):
    def __init__(self, case, model):
        QStandardItemModel.__init__(self)
        self.headers = [self.tr("Label"), self.tr("Nature"),
                        self.tr("Particle-boundary\ninteraction"),
                        self.tr("Number of classes")]
        self.setColumnCount(len(self.headers))
        self.case = case
        self.model = model
        self._data = []

        # Corresponding dict for the nature of the boundary. used in combo delegate.
        if self.model.getFoulingStatus() == "on":
            self.dicoM2V = {
                "wall" : { "inlet" : self.tr("Particles inlet"),
                           "bounce" : self.tr("Particles rebound"),
                           "deposit1" : self.tr("Deposition and elimination"),
                           "deposit2" : self.tr("Deposition"),
                           "fouling" : self.tr("Fouling") },
                "inlet" : { "inlet" : self.tr("Particles inlet") },
                "outlet" : { "outlet" : self.tr("Particles outlet") },
                "free_inlet_outlet" : { "outlet" : self.tr("Particles outlet") },
                "symmetry" : { "part_symmetry" : self.tr("Particles zero-flux") }
                }
        else:
            self.dicoM2V = {
                "wall" : { "inlet" : self.tr("Particles inlet"),
                           "bounce" : self.tr("Particles rebound"),
                           "deposit1" : self.tr("Deposition and elimination"),
                           "deposit2" : self.tr("Deposition") },
                "inlet" : { "inlet" : self.tr("Particles inlet") },
                "outlet" : { "outlet" : self.tr("Particles outlet") },
                "free_inlet_outlet" : { "outlet" : self.tr("Particles outlet") },
                "symmetry" : { "part_symmetry" : self.tr("Particles zero-flux") }
                }

        self.dicoV2M = {}
        for key in list(self.dicoM2V.keys()):
            dico = self.dicoM2V[key]
            self.dicoV2M[key] = {}
            for k, v in list(dico.items()):
                self.dicoV2M[key][v] = k

        # Initialization
        for zone in LocalizationModel('BoundaryZone', self.case).getZones():
            label = zone.getLabel()
            nature = zone.getNature()
            interaction = self.model.getBoundaryChoice(nature, label)
            nclasses = self.model.getNumberOfClassesValue(label)
            line = [label, nature, interaction, nclasses]
            self._data.append(line)
            row = self.rowCount()
            self.setRowCount(row+1)


    def data(self, index, role):
        if not index.isValid():
            return to_qvariant()

        if role == Qt.DisplayRole:
            row = index.row()
            col = index.column()
            if col == 2:
                nature = self._data[row][1]
                dico = self.dicoM2V[nature]
                return to_qvariant(dico[self._data[row][col]])
            else:
                return to_qvariant(self._data[row][col])

        if role == Qt.ToolTipRole:
            if index.column() == 2:
                return to_qvariant(self.tr("Code_Saturne keyword: IUSCLB"))
            elif index.column() == 3:
                return to_qvariant(self.tr("Code_Saturne keyword: NBCLAS"))
        return to_qvariant()


    def flags(self, index):
        if not index.isValid():
            return Qt.ItemIsEnabled
        elif index.column() in [0,1]:
            return Qt.ItemIsEnabled | Qt.ItemIsSelectable
        elif index.column() == 2:
            return Qt.ItemIsEnabled | Qt.ItemIsSelectable | Qt.ItemIsEditable
        elif index.column() == 3:
            if self._data[index.row()][2] == "inlet":
                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 col == 2:
            interaction = from_qvariant(value, to_text_string)
            self._data[row][col] = interaction
            label = self._data[row][0]
            nature = self._data[row][1]
            self.model.setBoundaryChoice(nature, label, interaction)
            if nature != "inlet":
                self._data[row][3] = 0

        elif col == 3:
            nclasses = from_qvariant(value, int)
            self._data[row][col] = nclasses
            label = self._data[row][0]
            nn = self.model.getNumberOfClassesValue(label)
            label = self._data[row][0]
            self.model.setNumberOfClassesValue(label, nclasses)

        self.dataChanged.emit(index, index)
        return True


    def getItem(self, row):
        return self._data[row]


    def tr(self, text):
        return text


#-------------------------------------------------------------------------------
# Main class
#-------------------------------------------------------------------------------


class LagrangianBoundariesView(QWidget, Ui_LagrangianBoundariesForm):
    """
    """
    def __init__(self, parent, case):
        """
        Constructor
        """
        QWidget.__init__(self, parent)

        Ui_LagrangianBoundariesForm.__init__(self)
        self.setupUi(self)

        self.case = case
        self.case.undoStopGlobal()
        self.model = LagrangianBoundariesModel(self.case)

        self.modelBoundaries = StandardItemModelBoundaries(self.case, self.model)
        self.tableViewBoundaries.setModel(self.modelBoundaries)
        self.tableViewBoundaries.setAlternatingRowColors(True)
        if QT_API == "PYQT4":
            self.tableViewBoundaries.horizontalHeader().setResizeMode(QHeaderView.Stretch)
        elif QT_API == "PYQT5":
            self.tableViewBoundaries.horizontalHeader().setSectionResizeMode(QHeaderView.Stretch)

        delegateInteraction = ParticleBoundaryInteractionDelegate(self.tableViewBoundaries)
        delegateClassNumber = ValueDelegate(self.tableViewBoundaries)
        self.tableViewBoundaries.setItemDelegateForColumn(2,delegateInteraction)
        self.tableViewBoundaries.setItemDelegateForColumn(3,delegateClassNumber)

        self.modelIPOIT = ComboModel(self.comboBoxIPOIT,3,1)
        self.modelIPOIT.addItem(self.tr("Mass flow rate"), "rate")
        self.modelIPOIT.addItem(self.tr("Statistical weight set by values"), "prescribed")
        self.modelIPOIT.addItem(self.tr("User defined statistical weight"), "subroutine")

        self.modelIJUVW = ComboModel(self.comboBoxIJUVW,4,1)
        self.modelIJUVW.addItem(self.tr("Fluid velocity"), "fluid")
        self.modelIJUVW.addItem(self.tr("Normal direction velocity"), "norm")
        self.modelIJUVW.addItem(self.tr("Velocity given by values"), "components")
        self.modelIJUVW.addItem(self.tr("User defined velocity"), "subroutine")

        self.modelIJRTP = ComboModel(self.comboBoxIJRTP,2,1)
        self.modelIJRTP.addItem(self.tr("Temperature set by values"), "prescribed")
        self.modelIJRTP.addItem(self.tr("User defined temperature"), "subroutine")

        self.modelIJRDP = ComboModel(self.comboBoxIJRDP,2,1)
        self.modelIJRDP.addItem(self.tr("Diameter set by values"), "prescribed")
        self.modelIJRDP.addItem(self.tr("User defined diameter"), "subroutine")

        self.modelIRAWCL = ComboModel(self.comboBoxIRAWCL,2,1)
        self.modelIRAWCL.addItem(self.tr("Raw coal"), "raw_coal_as_received")
        self.modelIRAWCL.addItem(self.tr("User defined"), "subroutine")

        self.tableViewBoundaries.clicked[QModelIndex].connect(self.slotSelectBoundary)
        self.modelBoundaries.dataChanged.connect(self.dataChanged)
        self.spinBoxICLAS.valueChanged[int].connect(self.slotICLAS)

        self.lineEditIJNBP.textChanged[str].connect(self.slotIJNBP)
        self.lineEditIJFRE.textChanged[str].connect(self.slotIJFRE)
        self.lineEditICLST.textChanged[str].connect(self.slotICLST)
        self.lineEditIDEBT.textChanged[str].connect(self.slotIDEBT)
        self.comboBoxIPOIT.activated[str].connect(self.slotIPOITChoice)
        self.lineEditIPOIT.textChanged[str].connect(self.slotIPOIT)
        self.lineEditIROPT.textChanged[str].connect(self.slotIROPT)
        self.lineEditIRCOLM.textChanged[str].connect(self.slotIRCOLM)

        self.comboBoxIJUVW.activated[str].connect(self.slotIJUVW)
        self.lineEditIUNO.textChanged[str].connect(self.slotIUNO)
        self.lineEditIUPT.textChanged[str].connect(self.slotIUPT)
        self.lineEditIVPT.textChanged[str].connect(self.slotIVPT)
        self.lineEditIWPT.textChanged[str].connect(self.slotIWPT)

        self.comboBoxIJRTP.activated[str].connect(self.slotIJRTP)
        self.lineEditITPT.textChanged[str].connect(self.slotITPT)
        self.lineEditICPT.textChanged[str].connect(self.slotICPT)
        self.lineEditIEPSI.textChanged[str].connect(self.slotIEPSI)

        self.comboBoxIJRDP.activated[str].connect(self.slotIJRDP)
        self.lineEditIDPT.textChanged[str].connect(self.slotIDPT)
        self.lineEditIVDPT.textChanged[str].connect(self.slotIVDPT)

        self.lineEditINUCHL.textChanged[str].connect(self.slotINUCHL)
        self.lineEditIHPT.textChanged[str].connect(self.slotIHPT)
        self.comboBoxIRAWCL.activated[str].connect(self.slotIRAWCL)

        # Validators
        validatorIJNBP  = IntValidator(self.lineEditIJNBP, min=0)
        validatorIJFRE  = IntValidator(self.lineEditIJFRE, min=0)
        validatorICLST  = IntValidator(self.lineEditICLST, min=0)
        validatorIDEBT  = DoubleValidator(self.lineEditIDEBT, min=0.)
        validatorIPOIT  = DoubleValidator(self.lineEditIPOIT, min=0.)
        validatorIPOIT.setExclusiveMin(True)
        validatorIROPT  = DoubleValidator(self.lineEditIROPT, min=0.)
        validatorIROPT.setExclusiveMin(True)
        validatorIRCOLM = DoubleValidator(self.lineEditIRCOLM, min=0.)

        validatorIUNO = DoubleValidator(self.lineEditIUNO)
        validatorIUPT = DoubleValidator(self.lineEditIUPT)
        validatorIVPT = DoubleValidator(self.lineEditIVPT)
        validatorIWPT = DoubleValidator(self.lineEditIWPT)

        validatorITPT  = DoubleValidator(self.lineEditITPT)
        validatorICPT  = DoubleValidator(self.lineEditICPT)
        validatorIEPSI = DoubleValidator(self.lineEditIEPSI)

        validatorIDPT  = DoubleValidator(self.lineEditIDPT, min=0.)
        validatorIVDPT = DoubleValidator(self.lineEditIVDPT)

        validatorINUCHL = IntValidator(self.lineEditINUCHL, min=0)
        validatorIHPT   = DoubleValidator(self.lineEditIHPT)

        self.lineEditIJNBP.setValidator(validatorIJNBP)
        self.lineEditIJFRE.setValidator(validatorIJFRE)
        self.lineEditICLST.setValidator(validatorICLST)
        self.lineEditIDEBT.setValidator(validatorIDEBT)
        self.lineEditIPOIT.setValidator(validatorIPOIT)
        self.lineEditIROPT.setValidator(validatorIROPT)
        self.lineEditIRCOLM.setValidator(validatorIRCOLM)

        self.lineEditIUNO.setValidator(validatorIUNO)
        self.lineEditIUPT.setValidator(validatorIUPT)
        self.lineEditIVPT.setValidator(validatorIVPT)
        self.lineEditIWPT.setValidator(validatorIWPT)

        self.lineEditITPT.setValidator(validatorITPT)
        self.lineEditICPT.setValidator(validatorICPT)
        self.lineEditIEPSI.setValidator(validatorIEPSI)

        self.lineEditIDPT.setValidator(validatorIDPT)
        self.lineEditIVDPT.setValidator(validatorIVDPT)

        self.lineEditINUCHL.setValidator(validatorINUCHL)
        self.lineEditIHPT.setValidator(validatorIHPT)

        self._hideAllWidgets()

        self.case.undoStartGlobal()


    def _hideAllWidgets(self):
        self.groupBoxClassNumber.hide()
        self.groupBoxMain.hide()
        self.groupBoxRate.hide()
        self.groupBoxVelocity.hide()
        self.groupBoxTemperature.hide()
        self.groupBoxDiameter.hide()
        self.groupBoxCoal.hide()


    @pyqtSlot("QModelIndex")
    def slotSelectBoundary(self, index):
        """
        """
        self._hideAllWidgets()
        label, nature, interaction, nclasses = self.modelBoundaries.getItem(index.row())
        self.label = label
        if interaction != "inlet":
            return
        self.model.setCurrentBoundaryNode(nature, label)
        if nclasses > 0:
            self.groupBoxClassNumber.show()
            self.spinBoxICLAS.setMinimum(1)
            self.spinBoxICLAS.setMaximum(nclasses)
            self.spinBoxICLAS.setValue(1)
            self.slotICLAS(1)


    def dataChanged(self, topLeft, bottomRight):
        """
        """
        self.slotSelectBoundary(topLeft)


    @pyqtSlot(int)
    def slotICLAS(self, iclass):
        """
        Input ICLAS.
        """
        self.iclass = iclass
        index = self.tableViewBoundaries.currentIndex()
        label, nature, interaction, nclasses = self.modelBoundaries.getItem(index.row())
        if interaction == "inlet":
            self.model.setCurrentClassNode(self.label, iclass)

        self.LM = LagrangianModel(self.case)
        part_model = self.LM.getParticlesModel()

        # Main variables
        self.groupBoxMain.show()
        npart = self.model.getNumberOfParticulesInClassValue(self.label, self.iclass)
        self.lineEditIJNBP.setText(str(npart))
        freq = self.model.getInjectionFrequencyValue(self.label, self.iclass)
        self.lineEditIJFRE.setText(str(freq))

        self.LSM = LagrangianStatisticsModel(self.case)
        if self.LSM.getGroupOfParticlesValue() > 0:
            igroup = self.model.getParticleGroupNumberValue(self.label, self.iclass)
            self.lineEditICLST.setText(str(igroup))
        else:
            self.labelICLST.setDisabled(True)
            self.lineEditICLST.setDisabled(True)

        # Rate / stat. weight
        self.groupBoxRate.show()
        choice = self.model.getStatisticalWeightChoice(self.label, self.iclass)
        self.modelIPOIT.setItem(str_model=choice)
        text = self.modelIPOIT.dicoM2V[choice]
        self.slotIPOITChoice(text)

        # Velocity
        self.groupBoxVelocity.show()
        choice = self.model.getVelocityChoice(self.label, self.iclass)
        self.modelIJUVW.setItem(str_model=choice)
        text = self.modelIJUVW.dicoM2V[choice]
        self.slotIJUVW(text)

        # Fouling
        colm = self.model.getFoulingIndexValue(self.label, self.iclass)
        self.lineEditIRCOLM.setText(str(colm))

        # Temperature
        status = self.LM.getHeating()
        if part_model == "thermal" and status == "on":
            self.groupBoxTemperature.show()
            choice = self.model.getTemperatureChoice(self.label, self.iclass)
            self.modelIJRTP.setItem(str_model=choice)
            text = self.modelIJRTP.dicoM2V[choice]
            self.slotIJRTP(text)

            cp = self.model.getSpecificHeatValue(self.label, self.iclass)
            self.lineEditICPT.setText(str(cp))
            eps = self.model.getEmissivityValue(self.label, self.iclass)
            self.lineEditIEPSI.setText(str(eps))

        # Coals
        if CoalCombustionModel(self.case).getCoalCombustionModel("only") != 'off':
            self.groupBoxCoal.show()
            icoal = self.model.getCoalNumberValue(self.label, self.iclass)
            self.lineEditINUCHL.setText(str(icoal))
            temp  = self.model.getCoalTemperatureValue(self.label, self.iclass)
            self.lineEditIHPT.setText(str(temp))
            choice = self.model.getCoalCompositionChoice(self.label, self.iclass)
            self.modelIRAWCL.setItem(str_model=choice)

        # Diameter
        self.groupBoxDiameter.show()
        choice = self.model.getDiameterChoice(self.label, self.iclass)

        if part_model == "coal":
            self.modelIJRDP.setItem(str_model="prescribed")
        else:
            self.modelIJRDP.setItem(str_model=choice)
            text = self.modelIJRDP.dicoM2V[choice]
            self.slotIJRDP(text)

        if choice == "prescribed":
            self.frameDiameter.show()
            diam = self.model.getDiameterValue(self.label, self.iclass)
            vdiam = self.model.getDiameterVarianceValue(self.label, self.iclass)
            self.lineEditIDPT.setText(str(diam))
            self.lineEditIVDPT.setText(str(vdiam))
        elif choice == "subroutine":
            self.frameDiameter.hide()

        #Coal
        if CoalCombustionModel(self.case).getCoalCombustionModel("only") != 'off':
            self.labelIROPT.hide()
            self.labelUnitIROPT.hide()
            self.lineEditIROPT.hide()
        else:
            self.labelIROPT.show()
            self.labelUnitIROPT.show()
            self.lineEditIROPT.show()
            rho = self.model.getDensityValue(self.label, self.iclass)
            self.lineEditIROPT.setText(str(rho))


    @pyqtSlot(str)
    def slotIJNBP(self, text):
        """
        Input IJNBP.
        """
        if self.sender().validator().state == QValidator.Acceptable:
            value = from_qvariant(text, int)
            self.model.setNumberOfParticulesInClassValue(self.label, self.iclass, value)


    @pyqtSlot(str)
    def slotIJFRE(self, text):
        """
        Input IJFRE.
        """
        if self.sender().validator().state == QValidator.Acceptable:
            value = from_qvariant(text, int)
            self.model.setInjectionFrequencyValue(self.label, self.iclass, value)


    @pyqtSlot(str)
    def slotICLST(self, text):
        """
        Input ICLST.
        """
        if self.sender().validator().state == QValidator.Acceptable:
            value = from_qvariant(text, int)
            self.model.setParticleGroupNumberValue(self.label, self.iclass, value)


    @pyqtSlot(str)
    def slotIDEBT(self, text):
        """
        Input IDEBT.
        """
        if self.sender().validator().state == QValidator.Acceptable:
            value = from_qvariant(text, float)
            self.model.setMassFlowRateValue(self.label, self.iclass, value)


    @pyqtSlot(str)
    def slotIPOITChoice(self, text):
        """
        Input IPOIT.
        """
        choice = self.modelIPOIT.dicoV2M[str(text)]
        self.model.setStatisticalWeightChoice(self.label, self.iclass, choice)
        self.frameMassRate.hide()
        self.frameStatisticalWeight.hide()
        if choice == "rate":
            self.frameMassRate.show()
            rate = self.model.getMassFlowRateValue(self.label, self.iclass)
            self.lineEditIDEBT.setText(str(rate))
            self.model.setStatisticalWeightValue(self.label, self.iclass, 1)
        elif choice == "prescribed":
            self.frameStatisticalWeight.show()
            weight = self.model.getStatisticalWeightValue(self.label, self.iclass)
            self.lineEditIPOIT.setText(str(weight))
        elif choice == "subroutine":
            pass


    @pyqtSlot(str)
    def slotIPOIT(self, text):
        """
        Input IPOIT.
        """
        if self.sender().validator().state == QValidator.Acceptable:
            value = from_qvariant(text, float)
            self.model.setStatisticalWeightValue(self.label, self.iclass, value)


    @pyqtSlot(str)
    def slotIROPT(self, text):
        """
        Input IROPT.
        """
        if self.sender().validator().state == QValidator.Acceptable:
            value = from_qvariant(text, float)
            self.model.setDensityValue(self.label, self.iclass, value)

    @pyqtSlot(str)
    def slotIRCOLM(self, text):
        """
        Input IRCOLM.
        """
        if self.sender().validator().state == QValidator.Acceptable:
            value = from_qvariant(text, float)
            self.model.setFoulingIndexValue(self.label, self.iclass, value)


    @pyqtSlot(str)
    def slotIJUVW(self, text):
        """
        Input IJUVW.
        """
        choice = self.modelIJUVW.dicoV2M[str(text)]
        self.model.setVelocityChoice(self.label, self.iclass, choice)
        self.frameVelocityNorm.hide()
        self.frameVelocityValues.hide()
        if choice == "norm":
            self.frameVelocityNorm.show()
            norm = self.model.getVelocityNormValue(self.label, self.iclass)
            self.lineEditIUNO.setText(str(norm))
        elif choice == "components":
            self.frameVelocityValues.show()
            vu = self.model.getVelocityDirectionValue(self.label, self.iclass, "u")
            vv = self.model.getVelocityDirectionValue(self.label, self.iclass, "v")
            vw = self.model.getVelocityDirectionValue(self.label, self.iclass, "w")
            self.lineEditIUPT.setText(str(vu))
            self.lineEditIVPT.setText(str(vv))
            self.lineEditIWPT.setText(str(vw))


    @pyqtSlot(str)
    def slotIUNO(self, text):
        """
        Input IUNO.
        """
        if self.sender().validator().state == QValidator.Acceptable:
            value = from_qvariant(text, float)
            self.model.setVelocityNormValue(self.label, self.iclass, value)


    @pyqtSlot(str)
    def slotIUPT(self, text):
        """
        Input IUPT.
        """
        if self.sender().validator().state == QValidator.Acceptable:
            value = from_qvariant(text, float)
            self.model.setVelocityDirectionValue(self.label, self.iclass, "u", value)


    @pyqtSlot(str)
    def slotIVPT(self, text):
        """
        Input IVPT.
        """
        if self.sender().validator().state == QValidator.Acceptable:
            value = from_qvariant(text, float)
            self.model.setVelocityDirectionValue(self.label, self.iclass, "v", value)


    @pyqtSlot(str)
    def slotIWPT(self, text):
        """
        Input IWPT.
        """
        if self.sender().validator().state == QValidator.Acceptable:
            value = from_qvariant(text, float)
            self.model.setVelocityDirectionValue(self.label, self.iclass, "w", value)


    @pyqtSlot(str)
    def slotIJRTP(self, text):
        """
        Input IJRTP.
        """
        choice = self.modelIJRTP.dicoV2M[str(text)]
        self.model.setTemperatureChoice(self.label, self.iclass, choice)
        if choice == "prescribed":
            self.frameTemperature.show()
            temp = self.model.getTemperatureValue(self.label, self.iclass)
            self.lineEditITPT.setText(str(temp))
        elif choice == "subroutine":
            self.frameTemperature.hide()


    @pyqtSlot(str)
    def slotITPT(self, text):
        """
        Input ITPT.
        """
        if self.sender().validator().state == QValidator.Acceptable:
            value = from_qvariant(text, float)
            self.model.setTemperatureValue(self.label, self.iclass, value)


    @pyqtSlot(str)
    def slotICPT(self, text):
        """
        Input ICPT.
        """
        if self.sender().validator().state == QValidator.Acceptable:
            value = from_qvariant(text, float)
            self.model.setSpecificHeatValue(self.label, self.iclass, value)


    @pyqtSlot(str)
    def slotIEPSI(self, text):
        """
        Input IEPSI.
        """
        if self.sender().validator().state == QValidator.Acceptable:
            value = from_qvariant(text, float)
            self.model.setEmissivityValue(self.label, self.iclass, value)


    @pyqtSlot(str)
    def slotIJRDP(self, text):
        """
        Input IJRDP.
        """
        choice = self.modelIJRDP.dicoV2M[str(text)]
        self.model.setDiameterChoice(self.label, self.iclass, choice)
        if choice == "prescribed":
            self.frameDiameter.show()
            diam = self.model.getDiameterValue(self.label, self.iclass)
            vdiam = self.model.getDiameterVarianceValue(self.label, self.iclass)
            self.lineEditIDPT.setText(str(diam))
            self.lineEditIVDPT.setText(str(vdiam))
        elif choice == "subroutine":
            self.frameDiameter.hide()


    @pyqtSlot(str)
    def slotIDPT(self, text):
        """
        Input IDPT.
        """
        if self.sender().validator().state == QValidator.Acceptable:
            value = from_qvariant(text, float)
            self.model.setDiameterValue(self.label, self.iclass, value)


    @pyqtSlot(str)
    def slotIVDPT(self, text):
        """
        Input IVDPT.
        """
        if self.sender().validator().state == QValidator.Acceptable:
            value = from_qvariant(text, float)
            self.model.setDiameterVarianceValue(self.label, self.iclass, value)


    @pyqtSlot(str)
    def slotINUCHL(self, text):
        """
        Input IHPT.
        """
        if self.sender().validator().state == QValidator.Acceptable:
            value = from_qvariant(text, int)
            self.model.setCoalNumberValue(self.label, self.iclass, value)


    @pyqtSlot(str)
    def slotIHPT(self, text):
        """
        Input IHPT.
        """
        if self.sender().validator().state == QValidator.Acceptable:
            value = from_qvariant(text, float)
            self.model.setCoalTemperatureValue(self.label, self.iclass, value)


    @pyqtSlot(str)
    def slotIRAWCL(self, text):
        """
        Input IJRDP.
        """
        choice = self.modelIRAWCL.dicoV2M[str(text)]
        self.model.setCoalCompositionChoice(self.label, self.iclass, choice)


    def tr(self, text):
        """
        Translation
        """
        return text

#-------------------------------------------------------------------------------
# End
#-------------------------------------------------------------------------------