Commit ecd04320 by Christophe Geuzaine

don't dump files on disk by default

parent f6066aef
Pipeline #1226 passed with stage
in 50 minutes 13 seconds
......@@ -813,7 +813,7 @@ void HighOrderMeshOptimizerNew(std::vector<GEntity*> &entities, OptHomParameters
HOPatchDefParameters patchDef(p);
par.patchDef = &patchDef;
par.displayInterv = 30;
par.verbose = 4;
par.verbose = 3;
par.logFileName = "";
par.nCurses = false;
......
......@@ -44,23 +44,18 @@
#include "linalg.h"
#include "optimization.h"
namespace {
void evalObjGradFunc(const alglib::real_1d_array &x, double &Obj,
alglib::real_1d_array &gradObj, void *MOInst)
{
(static_cast<MeshOpt*>(MOInst))->evalObjGrad(x, Obj, gradObj);
}
void evalObjGradFunc(const alglib::real_1d_array &x, double &Obj,
alglib::real_1d_array &gradObj, void *MOInst)
{
(static_cast<MeshOpt*>(MOInst))->evalObjGrad(x, Obj, gradObj);
}
void printProgressFunc(const alglib::real_1d_array &x, double Obj, void *MOInst)
{
(static_cast<MeshOpt*>(MOInst))->printProgress(x,Obj);
}
void printProgressFunc(const alglib::real_1d_array &x, double Obj, void *MOInst)
{
(static_cast<MeshOpt*>(MOInst))->printProgress(x,Obj);
}
}
......@@ -68,8 +63,8 @@ MeshOpt::MeshOpt(const std::map<MElement*,GEntity*> &element2entity,
const std::map<MElement*, GEntity*> &bndEl2Ent,
const std::set<MElement*> &els, std::set<MVertex*> &toFix,
const std::set<MElement*> &bndEls, const MeshOptParameters &par) :
patch(element2entity, bndEl2Ent, els, toFix, bndEls, par.fixBndNodes), _verbose(0), _nCurses(1),
_iPass(0), _iter(0), _intervDisplay(0), _initObj(0)
patch(element2entity, bndEl2Ent, els, toFix, bndEls, par.fixBndNodes),
_verbose(0), _nCurses(1), _iPass(0), _iter(0), _intervDisplay(0), _initObj(0)
{
_allObjFunc.resize(par.pass.size());
for (int iPass=0; iPass<par.pass.size(); iPass++) {
......
......@@ -44,10 +44,8 @@
#include "ap.h"
class MeshOptParameters;
class MeshOpt
{
public:
......@@ -69,16 +67,19 @@ public:
bool _nCurses;
std::list<char*> _iterHistory, _optHistory;
int _iPass;
std::vector<ObjectiveFunction> _allObjFunc; // Contributions to objective function for current pass
ObjectiveFunction *_objFunc; // Contributions to objective function for current pass
int _iter, _intervDisplay; // Current iteration, interval of iterations for reporting
double _initObj; // Values for reporting
// Contributions to objective function for current pass
std::vector<ObjectiveFunction> _allObjFunc;
// Contributions to objective function for current pass
ObjectiveFunction *_objFunc;
// Current iteration, interval of iterations for reporting
int _iter, _intervDisplay;
// Values for reporting
double _initObj;
void calcScale(alglib::real_1d_array &scale);
void runOptim(alglib::real_1d_array &x,
const alglib::real_1d_array &initGradObj, int itMax, int iBar);
};
#endif
#endif
......@@ -30,7 +30,6 @@
#ifndef _MESHOPTCOMMON_H_
#define _MESHOPTCOMMON_H_
#include <vector>
#include "GmshMessage.h"
#include "MeshOptimizerConfig.h"
......@@ -40,7 +39,7 @@ class GEntity;
class SPoint3;
class ObjContrib;
//ncurses shortcuts
// ncurses shortcuts
void mvinit();
void mvterminate();
void mvpause();
......@@ -49,14 +48,13 @@ void mvprintCenter(int row, const char* fmt, ...);
void mvprintLeft(int row, const char* fmt, ...);
void mvprintRight(int row, const char* fmt, ...);
void mvprintXY(int row, int col, const char* fmt, ...);
//color scheme: 0=default, 1=last in yellow back, others in white back, 2=even numbers in white back
// color scheme: 0=default, 1=last in yellow back, others in white back, 2=even
// numbers in white back
void mvprintList(int row, int maxSize, std::list<char*> listStr, int colorScheme=0);
void mvfillRow(int row, char fillWith=' ');
void mvbold(bool on);
void mvcolor(int colorScheme, bool on);
class redirectMessage : public GmshMessage
{
private:
......@@ -120,5 +118,4 @@ class MeshOptParameters { // Parameters controlling
double CPU; // Time for optimization
};
#endif
......@@ -553,9 +553,10 @@ void optimizeOneByOne(const vertElVecMap &vertex2elements,
const int initNumBadElts = badElts.size();
if (par.nCurses)
displayResultTable(nbPatchSuccess, initNumBadElts);
if (par.verbose > 0) Msg::Info("%d bad elements, starting to iterate...", initNumBadElts);
if (par.verbose > 0)
Msg::Info("%d bad elements, starting to iterate...", initNumBadElts);
elElSetMap element2elements; // Element to element connectivity, built progressively
elElSetMap element2elements; // Element to element connectivity, built progressively
// Loop over bad elements
for (int iBadEl=0; iBadEl<initNumBadElts; iBadEl++) {
......@@ -645,12 +646,13 @@ void optimizeOneByOne(const vertElVecMap &vertex2elements,
distanceFactor *= par.patchDef->distanceAdaptFact;
maxLayers *= par.patchDef->maxLayersAdaptFact;
if (par.verbose > 1)
Msg::Info("Patch %i failed (adapt #%i), adapting with increased size", iBadEl, iAdapt);
Msg::Info("Patch %i failed (adapt #%i), adapting with increased size",
iBadEl, iAdapt);
}
}
} // End of adaptation loop
} // End of adaptation loop
nbPatchSuccess[success+1]++;
if (par.nCurses){
......@@ -714,7 +716,8 @@ void meshOptimizer(std::vector<GEntity*> &entities, MeshOptParameters &par)
if (entity->dim() != par.dim ||
(par.onlyVisible && !entity->getVisibility())) continue;
if (par.nCurses) {
mvprintCenter(15, "Computing connectivity and bad elements for entity %3d...", entity->tag());
mvprintCenter(15, "Computing connectivity and bad elements for entity %3d...",
entity->tag());
}
Msg::Info("Computing connectivity and bad elements for entity %d...",
entity->tag());
......@@ -722,7 +725,7 @@ void meshOptimizer(std::vector<GEntity*> &entities, MeshOptParameters &par)
if ((par.useGeomForPatches) || (par.useGeomForOpt))
calcElement2Entity(entity, element2entity);
if (par.useBoundaries) calcBndInfo(entity, el2BndEl, bndEl2Ent);
for (int iEl = 0; iEl < entity->getNumMeshElements(); iEl++) { // Detect bad elements
for (int iEl = 0; iEl < entity->getNumMeshElements(); iEl++) { // Detect bad elements
MElement *el = entity->getMeshElement(iEl);
if (el->getDim() == par.dim) {
if (par.patchDef->elBadness(el, entity) < 0.) badElts.insert(el);
......
......@@ -30,12 +30,9 @@
#ifndef _MESHOPTIMIZER_H_
#define _MESHOPTIMIZER_H_
class GEntity;
class MeshOptParameters;
void meshOptimizer(std::vector<GEntity*> &entities, MeshOptParameters &par);
#endif
......@@ -132,11 +132,11 @@ void MeshQualityOptimizer(std::vector<GEntity*> &entities, MeshQualOptParameters
QualPatchDefParameters patchDef(p);
par.patchDef = &patchDef;
par.displayInterv = 20;
par.verbose = 4;
par.verbose = 3;
par.nCurses = p.nCurses;
par.logFileName = p.logFileName;
ObjContribScaledNodeDispSq<ObjContribFuncSimple> nodeDistFunc(p.weight,
Patch::LS_MINEDGELENGTH);
ObjContribIdealJac<ObjContribFuncBarrierMovMin> minIdealJacBarFunc(1.);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment