8#include "QHyodaToolCell.h"
9#include "QHyodaGLCell.h"
15static double rawStringToDouble(QString qStr);
16static unsigned long long rawStringToULongLong(QString qStr);
24QHyodaToolCell::QHyodaToolCell(
QHyodaJob *_job,
28 qDebug() <<
"QHyodaToolCell::QHyodaToolCell";
30 groupBox->layout()->addWidget(cell);
31 vLayout->setStretch(1,1);
32 connect(targetCellNumLineEdit, SIGNAL(returnPressed()),
this, SLOT(targetCellUidLineEditSlot()));
33 connect(cellHSlider,SIGNAL(valueChanged(
int)),
this, SLOT(targetCellUidSliderSlot(
int)));
34 targetCellNumLineEdit->setEnabled(
true);
35 cellHSlider->setEnabled(
true);
36 qDebug() <<
"QHyodaToolCell::QHyodaToolCell done";
43QHyodaToolCell::~QHyodaToolCell(){
44 qDebug() <<
"QHyodaToolCell::~QHyodaToolCell";
49void QHyodaToolCell::close(){
50 qDebug() <<
"QHyodaToolCell::cell";
57void QHyodaToolCell::setRange(quint64 mesh_total_nb_cell){
59 cellHSlider->setMaximum(mesh_total_nb_cell-1);
60 cellHSlider->setTickInterval(mesh_total_nb_cell>>2);
61 cellHSlider->setPageStep(mesh_total_nb_cell>>3);
62 cellHSlider->setSingleStep(mesh_total_nb_cell>>8);
63 cellHSlider->setValue((mesh_total_nb_cell>>1)-1);
67static unsigned int l2g(
unsigned int i){
76 qFatal(
"l2g INVALID code!");
82void QHyodaToolCell::refresh(
const QStringList &splitted_output){
86 unsigned long long got_target_cell_rank=rawStringToULongLong(splitted_output.at(29));
87 uidRankLabel->setText(QString(
"%1").arg(got_target_cell_rank));
89 cell->cell_nb_nodes=rawStringToULongLong(splitted_output.at(31));
95 for(
unsigned int i=0;i<cell->cell_nb_nodes; ++i)
96 coords[i][0]=coords[i][1]=coords[i][2]=0.0;
102 coords[0][0]=rawStringToDouble(splitted_output.at(offset+0));
103 coords[0][1]=rawStringToDouble(splitted_output.at(offset+2));
104 coords[0][2]=rawStringToDouble(splitted_output.at(offset+4));
106 cell->add_node(QVector3D(0.0,0.0,0.0), QColor(Qt::blue));
108 for(
unsigned int iNode=1, iAt=offset+6; iNode<cell->cell_nb_nodes; ++iNode,iAt+=6){
109 coords[iNode][0]=rawStringToDouble(splitted_output.at(iAt))-coords[0][0];
110 coords[iNode][1]=rawStringToDouble(splitted_output.at(iAt+2))-coords[0][1];
111 coords[iNode][2]=rawStringToDouble(splitted_output.at(iAt+4))-coords[0][2];
113 cell->add_node(QVector3D(coords[iNode][0],coords[iNode][1],coords[iNode][2]), QColor(Qt::cyan));
122void QHyodaToolCell::targetCellUidLineEditSlot(
void){
124 unsigned long long text2ull=targetCellNumLineEdit->text().toULongLong(&ok,10);
125 if ((!ok) || (text2ull>=job->data->mesh_total_nb_cell)){
126 qDebug()<<
"QHyodaToolCell::targetCellUidLineEditSlot ERROR while converting targetCellUid";
129 job->data->target_cell_uid=text2ull;
130 cellHSlider->setValue(text2ull);
131 job->gdb->state=QHyodaGdb::TargetCell;
138void QHyodaToolCell::targetCellUidSliderSlot(
int value){
140 targetCellNumLineEdit->setText(QString(
"%1").arg(value));
141 job->data->target_cell_uid=value;
142 job->gdb->state=QHyodaGdb::TargetCell;
150static double rawStringToDouble(QString qStr){
151 const char *s=qStr.toLocal8Bit().constData();
153 sscanf(s,
"%llx", (
unsigned long long *)&ret);
157static unsigned long long rawStringToULongLong(QString qStr){
158 const char *s=qStr.toLocal8Bit().constData();
159 unsigned long long ret=0;
160 sscanf(s,
"%llx", &ret);