Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
O
ogs
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Özgür Ozan Sen
ogs
Commits
acadbd84
Commit
acadbd84
authored
1 year ago
by
Julian Heinze
Browse files
Options
Downloads
Patches
Plain Diff
extract updateExpectedVoxel() and remove getSelectedObjects()
parent
2e9c96af
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Applications/DataExplorer/DataView/Vtu2GridDialog.cpp
+43
-37
43 additions, 37 deletions
Applications/DataExplorer/DataView/Vtu2GridDialog.cpp
Applications/DataExplorer/DataView/Vtu2GridDialog.h
+6
-5
6 additions, 5 deletions
Applications/DataExplorer/DataView/Vtu2GridDialog.h
with
49 additions
and
42 deletions
Applications/DataExplorer/DataView/Vtu2GridDialog.cpp
+
43
−
37
View file @
acadbd84
...
@@ -17,6 +17,7 @@
...
@@ -17,6 +17,7 @@
#include
<QStringList>
#include
<QStringList>
#include
<QStringListModel>
#include
<QStringListModel>
#include
<optional>
#include
<string>
#include
<string>
#include
"Base/StrictDoubleValidator.h"
#include
"Base/StrictDoubleValidator.h"
...
@@ -53,37 +54,57 @@ Vtu2GridDialog::Vtu2GridDialog(MeshModel& mesh_model, QDialog* parent)
...
@@ -53,37 +54,57 @@ Vtu2GridDialog::Vtu2GridDialog(MeshModel& mesh_model, QDialog* parent)
this
->
xlineEdit
->
setFocus
();
this
->
xlineEdit
->
setFocus
();
}
}
void
Vtu2GridDialog
::
updateExpectedVoxel
()
std
::
optional
<
std
::
array
<
double
,
3
>>
fillXYZ
(
QString
xin
,
QString
yin
,
QString
zin
)
{
{
QString
const
xin
=
this
->
xlineEdit
->
text
();
QString
const
yin
=
this
->
ylineEdit
->
text
();
QString
const
zin
=
this
->
zlineEdit
->
text
();
bool
ok
;
bool
ok
;
if
(
!
xin
.
toDouble
(
&
ok
))
{
return
std
::
nullopt
;
}
double
const
xinput
=
xin
.
toDouble
();
double
const
xinput
=
xin
.
toDouble
();
double
const
yinput
=
(
yin
.
toDouble
(
&
ok
))
?
yin
.
toDouble
()
:
xin
.
toDouble
();
double
const
yinput
=
(
yin
.
toDouble
(
&
ok
))
?
yin
.
toDouble
()
:
xinput
;
double
const
zinput
=
(
zin
.
toDouble
(
&
ok
))
?
zin
.
toDouble
()
:
xin
.
toDouble
();
double
const
zinput
=
(
zin
.
toDouble
(
&
ok
))
?
zin
.
toDouble
()
:
xinput
;
if
(
xinput
<=
0
||
yinput
<=
0
||
zinput
<=
0
)
{
return
std
::
nullopt
;
}
return
std
::
optional
<
std
::
array
<
double
,
3
>>
{{
xinput
,
yinput
,
zinput
}};
}
Eigen
::
Vector3d
getMeshExtent
(
MeshLib
::
Mesh
const
*
_mesh
)
{
auto
const
&
nodes
=
_mesh
->
getNodes
();
GeoLib
::
AABB
const
aabb
(
nodes
.
cbegin
(),
nodes
.
cend
());
auto
const
&
min
=
aabb
.
getMinPoint
();
auto
const
&
max
=
aabb
.
getMaxPoint
();
return
max
-
min
;
}
void
Vtu2GridDialog
::
updateExpectedVoxel
()
{
if
(
_allMeshes
.
stringList
()[
0
]
==
"[No Mesh available.]"
)
if
(
_allMeshes
.
stringList
()[
0
]
==
"[No Mesh available.]"
)
{
{
this
->
expectedVoxelLabel
->
setText
(
"approximated Voxel: undefined"
);
this
->
expectedVoxelLabel
->
setText
(
"approximated Voxel: undefined"
);
return
;
return
;
}
}
if
(
xin
.
isEmpty
()
||
xinput
==
0
)
auto
const
opt_xyz
=
fillXYZ
(
this
->
xlineEdit
->
text
(),
this
->
ylineEdit
->
text
(),
this
->
zlineEdit
->
text
());
if
(
!
opt_xyz
)
{
{
this
->
expectedVoxelLabel
->
setText
(
"approximated Voxel: undefined"
);
this
->
expectedVoxelLabel
->
setText
(
"approximated Voxel: undefined"
);
return
;
return
;
}
}
auto
const
&
xyz
=
opt_xyz
.
value
();
auto
*
const
_mesh
(
auto
const
delta
=
getMeshExtent
(
_mesh_model
.
getMesh
(
this
->
meshListBox
->
currentText
().
toStdString
()));
_mesh_model
.
getMesh
(
this
->
meshListBox
->
currentText
().
toStdString
()));
auto
const
&
nodes
=
_mesh
->
getNodes
();
double
const
expectedVoxel
=
GeoLib
::
AABB
const
aabb
(
nodes
.
cbegin
(),
nodes
.
cend
());
(
delta
[
0
])
*
(
delta
[
1
])
*
(
delta
[
2
])
/
xyz
[
0
]
/
xyz
[
1
]
/
xyz
[
2
];
auto
const
min
=
aabb
.
getMinPoint
();
auto
const
max
=
aabb
.
getMaxPoint
();
double
const
expectedVoxel
=
(
max
[
0
]
-
min
[
0
])
*
(
max
[
1
]
-
min
[
1
])
*
(
max
[
2
]
-
min
[
2
])
/
xinput
/
yinput
/
zinput
;
int
const
exponent
=
std
::
floor
(
std
::
log10
(
abs
(
expectedVoxel
)));
int
const
exponent
=
std
::
floor
(
std
::
log10
(
abs
(
expectedVoxel
)));
this
->
expectedVoxelLabel
->
setText
(
this
->
expectedVoxelLabel
->
setText
(
...
@@ -118,26 +139,19 @@ void Vtu2GridDialog::accept()
...
@@ -118,26 +139,19 @@ void Vtu2GridDialog::accept()
return
;
return
;
}
}
QString
const
xin
=
this
->
xlineEdit
->
text
();
auto
opt_xyz
=
fillXYZ
(
this
->
xlineEdit
->
text
(),
this
->
ylineEdit
->
text
(),
QString
const
yin
=
this
->
ylineEdit
->
text
();
this
->
zlineEdit
->
text
());
QString
const
zin
=
this
->
zlineEdit
->
text
();
bool
ok
;
if
(
!
opt_xyz
)
if
(
!
xin
.
toDouble
(
&
ok
))
{
{
OGSError
::
box
(
OGSError
::
box
(
"At least the x-length of a voxel must be specified.
\n
If "
"At least the x-length of a voxel must be specified
and > 0
.
\n
If "
"y-/z-input "
"y-/z-input "
"are not specified, equal to 0, or not a real number, they are "
"are not specified, equal to 0, or not a real number, they are "
"treated as "
"treated as "
"the x-input."
);
"the x-input."
);
return
;
}
}
double
const
xinput
=
xin
.
toDouble
();
auto
const
&
cellsize
=
opt_xyz
.
value
();
double
const
yinput
=
(
yin
.
toDouble
(
&
ok
))
?
yin
.
toDouble
()
:
xin
.
toDouble
();
double
const
zinput
=
(
zin
.
toDouble
(
&
ok
))
?
zin
.
toDouble
()
:
xin
.
toDouble
();
std
::
array
<
double
,
3
>
const
cellsize
=
{
xinput
,
yinput
,
zinput
};
auto
_mesh
(
auto
_mesh
(
_mesh_model
.
getMesh
(
this
->
meshListBox
->
currentText
().
toStdString
()));
_mesh_model
.
getMesh
(
this
->
meshListBox
->
currentText
().
toStdString
()));
...
@@ -192,12 +206,4 @@ void Vtu2GridDialog::accept()
...
@@ -192,12 +206,4 @@ void Vtu2GridDialog::accept()
_mesh_model
.
addMesh
(
grid
.
release
());
_mesh_model
.
addMesh
(
grid
.
release
());
this
->
done
(
QDialog
::
Accepted
);
this
->
done
(
QDialog
::
Accepted
);
}
std
::
vector
<
std
::
string
>
Vtu2GridDialog
::
getSelectedObjects
(
QStringList
list
)
{
std
::
vector
<
std
::
string
>
indexList
;
std
::
transform
(
list
.
begin
(),
list
.
end
(),
std
::
back_inserter
(
indexList
),
[](
auto
const
&
index
)
{
return
index
.
toStdString
();
});
return
indexList
;
}
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Applications/DataExplorer/DataView/Vtu2GridDialog.h
+
6
−
5
View file @
acadbd84
...
@@ -31,11 +31,9 @@ class Vtu2GridDialog : public QDialog, private Ui_Vtu2Grid
...
@@ -31,11 +31,9 @@ class Vtu2GridDialog : public QDialog, private Ui_Vtu2Grid
Q_OBJECT
Q_OBJECT
public:
public:
explicit
Vtu2GridDialog
(
MeshModel
&
mesh_model
,
explicit
Vtu2GridDialog
(
MeshModel
&
mesh_model
,
QDialog
*
parent
=
nullptr
);
QDialog
*
parent
=
nullptr
);
private:
private:
std
::
vector
<
std
::
string
>
getSelectedObjects
(
QStringList
list
);
MeshModel
&
_mesh_model
;
MeshModel
&
_mesh_model
;
QStringListModel
_allMeshes
;
QStringListModel
_allMeshes
;
...
@@ -44,10 +42,13 @@ private slots:
...
@@ -44,10 +42,13 @@ private slots:
void
accept
()
override
;
void
accept
()
override
;
/// Instructions if the Cancel-Button has been pressed.
/// Instructions if the Cancel-Button has been pressed.
void
reject
()
override
{
this
->
done
(
QDialog
::
Rejected
);
};
void
reject
()
override
{
this
->
done
(
QDialog
::
Rejected
);
};
/// Instructions if the ">>-button" has been pressed.
/// As the x/y/z input changes an estimation of the expected Voxel is given.
/// Instructions if the ↑-button" has been pressed.
void
updateExpectedVoxel
();
void
updateExpectedVoxel
();
void
on_xlineEdit_textChanged
();
void
on_xlineEdit_textChanged
();
void
on_ylineEdit_textChanged
();
void
on_ylineEdit_textChanged
();
void
on_zlineEdit_textChanged
();
void
on_zlineEdit_textChanged
();
};
};
std
::
optional
<
std
::
array
<
double
,
3
>>
fillXYZ
(
QString
xin
,
QString
yin
,
QString
zin
);
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment