Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
gmsh
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Larry Price
gmsh
Commits
ab86ce83
Commit
ab86ce83
authored
9 years ago
by
Sebastien Blaise
Browse files
Options
Downloads
Patches
Plain Diff
Mesh Optimizer: modified ncurses gui to allow resizing
parent
ee690f3c
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
contrib/MeshOptimizer/MeshOpt.cpp
+20
-9
20 additions, 9 deletions
contrib/MeshOptimizer/MeshOpt.cpp
with
20 additions
and
9 deletions
contrib/MeshOptimizer/MeshOpt.cpp
+
20
−
9
View file @
ab86ce83
...
@@ -80,8 +80,6 @@ MeshOpt::MeshOpt(const std::map<MElement*,GEntity*> &element2entity,
...
@@ -80,8 +80,6 @@ MeshOpt::MeshOpt(const std::map<MElement*,GEntity*> &element2entity,
}
}
_objFunc
=
&
_allObjFunc
[
0
];
_objFunc
=
&
_allObjFunc
[
0
];
if
(
par
.
nCurses
){
if
(
par
.
nCurses
){
int
nbRow
,
nbCol
;
mvgetScreenSize
(
nbRow
,
nbCol
);
int
minCol
=
0
;
int
minCol
=
0
;
for
(
int
i
=
0
;
i
<
_objFunc
->
names
().
size
();
i
++
){
for
(
int
i
=
0
;
i
<
_objFunc
->
names
().
size
();
i
++
){
if
(
i
>
0
)
if
(
i
>
0
)
...
@@ -91,7 +89,9 @@ MeshOpt::MeshOpt(const std::map<MElement*,GEntity*> &element2entity,
...
@@ -91,7 +89,9 @@ MeshOpt::MeshOpt(const std::map<MElement*,GEntity*> &element2entity,
}
}
minCol
=
std
::
max
(
minCol
,
96
);
minCol
=
std
::
max
(
minCol
,
96
);
int
minRow
=
std
::
max
(
34
,
34
+
(
int
)
_objFunc
->
names
().
size
()
-
5
);
int
minRow
=
std
::
max
(
34
,
34
+
(
int
)
_objFunc
->
names
().
size
()
-
5
);
if
(
nbRow
<
minRow
||
nbCol
<
minCol
){
int
nbRow
,
nbCol
;
mvgetScreenSize
(
nbRow
,
nbCol
);
while
(
nbRow
<
minRow
||
nbCol
<
minCol
){
for
(
int
i
=
0
;
i
<
nbRow
;
i
++
){
for
(
int
i
=
0
;
i
<
nbRow
;
i
++
){
mvfillRow
(
i
,
' '
);
mvfillRow
(
i
,
' '
);
}
}
...
@@ -99,11 +99,19 @@ MeshOpt::MeshOpt(const std::map<MElement*,GEntity*> &element2entity,
...
@@ -99,11 +99,19 @@ MeshOpt::MeshOpt(const std::map<MElement*,GEntity*> &element2entity,
mvprintCenter
(
firstRow
,
"Given the number of contributions to the objective function, ncurses"
);
mvprintCenter
(
firstRow
,
"Given the number of contributions to the objective function, ncurses"
);
mvprintCenter
(
firstRow
+
1
,
"enhanced interface requires a terminal window of minimal size"
);
mvprintCenter
(
firstRow
+
1
,
"enhanced interface requires a terminal window of minimal size"
);
mvprintCenter
(
firstRow
+
2
,
"%4ix%4i characters. Yours is %4ix%4i, try resizing the window"
,
minRow
,
minCol
,
nbRow
,
nbCol
);
mvprintCenter
(
firstRow
+
2
,
"%4ix%4i characters. Yours is %4ix%4i, try resizing the window"
,
minRow
,
minCol
,
nbRow
,
nbCol
);
mvprintCenter
(
firstRow
+
3
,
"
or disabling the ncurses interface
."
);
mvprintCenter
(
firstRow
+
3
,
"
then press SPACE
."
);
mvpause
();
mvpause
();
mvterminate
();
for
(
int
i
=
0
;
i
<
nbRow
;
i
++
){
Msg
::
SetCallback
(
NULL
);
mvfillRow
(
i
,
' '
);
Msg
::
Exit
(
EXIT_FAILURE
);
}
mvbold
(
true
);
mvprintCenter
(
0
,
"OPTIMIZING MESH"
);
mvfillRow
(
1
,
'-'
);
mvfillRow
(
10
,
'-'
);
mvfillRow
(
20
,
'-'
);
mvfillRow
(
27
,
'-'
);
mvbold
(
false
);
mvgetScreenSize
(
nbRow
,
nbCol
);
}
}
}
}
}
}
...
@@ -157,7 +165,7 @@ void MeshOpt::printProgress(const alglib::real_1d_array &x, double Obj)
...
@@ -157,7 +165,7 @@ void MeshOpt::printProgress(const alglib::real_1d_array &x, double Obj)
sprintf
(
_iterHistory
.
back
(),
_objFunc
->
minMaxStr
().
c_str
());
sprintf
(
_iterHistory
.
back
(),
_objFunc
->
minMaxStr
().
c_str
());
mvprintList
(
22
,
5
,
_iterHistory
,
1
);
mvprintList
(
22
,
5
,
_iterHistory
,
1
);
}
}
if
((
_verbose
>
2
)
&&
(
_iter
%
_intervDisplay
==
0
))
if
((
_verbose
>
2
)
&&
(
_iter
%
_intervDisplay
==
0
||
_nCurses
))
Msg
::
Info
((
"--> Iteration %3d --- OBJ %12.5E (relative decrease = %12.5E)"
+
Msg
::
Info
((
"--> Iteration %3d --- OBJ %12.5E (relative decrease = %12.5E)"
+
_objFunc
->
minMaxStr
()).
c_str
(),
_iter
,
Obj
,
Obj
/
_initObj
);
_objFunc
->
minMaxStr
()).
c_str
(),
_iter
,
Obj
,
Obj
/
_initObj
);
}
}
...
@@ -309,7 +317,10 @@ int MeshOpt::optimize(const MeshOptParameters &par)
...
@@ -309,7 +317,10 @@ int MeshOpt::optimize(const MeshOptParameters &par)
}
}
mvprintList
(
19
,
-
8
,
_optHistory
,
2
);
mvprintList
(
19
,
-
8
,
_optHistory
,
2
);
}
}
if
(
_verbose
>
2
)
Msg
::
Info
(
"--- Optimization run %d"
,
iBar
);
if
(
_verbose
>
2
){
Msg
::
Info
(
"--- Optimization run %d"
,
iBar
);
Msg
::
Info
(
"%s"
,
_objFunc
->
minMaxStr
().
c_str
());
}
_objFunc
->
updateParameters
();
_objFunc
->
updateParameters
();
runOptim
(
x
,
gradObj
,
par
.
pass
[
_iPass
].
maxOptIter
,
iBar
);
runOptim
(
x
,
gradObj
,
par
.
pass
[
_iPass
].
maxOptIter
,
iBar
);
_objFunc
->
updateMinMax
();
_objFunc
->
updateMinMax
();
...
...
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