Commit a280cd2b by Jean-François Remacle

hop

Merge branch 'master' of http://gitlab.onelab.info/gmsh/gmsh
parents b4934cff f1e868fe
...@@ -4,4 +4,6 @@ build* ...@@ -4,4 +4,6 @@ build*
contrib/mobile/frameworks_* contrib/mobile/frameworks_*
contrib/3M contrib/3M
contrib/Parasolid contrib/Parasolid
*.db
.DS_Store
*~ *~
...@@ -93,7 +93,7 @@ opt(ZIPPER "Enable Zip file compression/decompression" OFF) ...@@ -93,7 +93,7 @@ opt(ZIPPER "Enable Zip file compression/decompression" OFF)
set(GMSH_MAJOR_VERSION 3) set(GMSH_MAJOR_VERSION 3)
set(GMSH_MINOR_VERSION 0) set(GMSH_MINOR_VERSION 0)
set(GMSH_PATCH_VERSION 3) set(GMSH_PATCH_VERSION 4)
set(GMSH_EXTRA_VERSION "" CACHE STRING "Gmsh extra version string") set(GMSH_EXTRA_VERSION "" CACHE STRING "Gmsh extra version string")
set(GMSH_VERSION "${GMSH_MAJOR_VERSION}.${GMSH_MINOR_VERSION}") set(GMSH_VERSION "${GMSH_MAJOR_VERSION}.${GMSH_MINOR_VERSION}")
......
...@@ -45,10 +45,6 @@ ...@@ -45,10 +45,6 @@
#include "PView.h" #include "PView.h"
#endif #endif
#if defined(HAVE_MESH)
#include "periodical.h"
#endif
#if defined(HAVE_PARSER) #if defined(HAVE_PARSER)
#include "Parser.h" #include "Parser.h"
#endif #endif
...@@ -541,16 +537,6 @@ void GetOptions(int argc, char *argv[]) ...@@ -541,16 +537,6 @@ void GetOptions(int argc, char *argv[])
else else
Msg::Fatal("Missing number of lloyd iterations"); Msg::Fatal("Missing number of lloyd iterations");
} }
#if defined(HAVE_MESH)
else if(!strcmp(argv[i] + 1, "microstructure")) {
i++;
if(argv[i]) microstructure(argv[i++]);
}
else if(!strcmp(argv[i] + 1, "computeBestSeeds")) {
i++;
if(argv[i]) computeBestSeeds(argv[i++]);
}
#endif
else if(!strcmp(argv[i] + 1, "nopopup")) { else if(!strcmp(argv[i] + 1, "nopopup")) {
CTX::instance()->noPopup = 1; CTX::instance()->noPopup = 1;
i++; i++;
......
...@@ -1559,45 +1559,47 @@ int Msg::GetThreadNum(){ return 0; } ...@@ -1559,45 +1559,47 @@ int Msg::GetThreadNum(){ return 0; }
#endif #endif
MsgProgressStatus::MsgProgressStatus(int num) MsgProgressStatus::MsgProgressStatus(int num)
: totalElementToTreat_(num), currentI_(0), nextIToCheck_(0), : _totalElementToTreat(num), _currentI(0), _nextIToCheck(0),
initialTime_(Cpu()), lastTime_(initialTime_), lastPercentage_(0), _initialTime(Cpu()), _lastTime(_initialTime), _lastPercentage(0),
progressMeterStep_(Msg::GetProgressMeterStep()) _progressMeterStep(Msg::GetProgressMeterStep())
{ {
Msg::SetProgressMeterStep(1); Msg::SetProgressMeterStep(1);
Msg::ResetProgressMeter(); Msg::ResetProgressMeter();
} }
MsgProgressStatus::~MsgProgressStatus() MsgProgressStatus::~MsgProgressStatus()
{ {
Msg::ProgressMeter(totalElementToTreat_, totalElementToTreat_, true, "done"); Msg::ProgressMeter(_totalElementToTreat, _totalElementToTreat, true, "done");
Msg::SetProgressMeterStep(progressMeterStep_); Msg::SetProgressMeterStep(_progressMeterStep);
} }
void MsgProgressStatus::next() void MsgProgressStatus::next()
{ {
++currentI_; ++_currentI;
if (currentI_ < nextIToCheck_) return; if (_currentI < _nextIToCheck) return;
unsigned int currentPercentage = currentI_*100/totalElementToTreat_; int currentPercentage = _currentI * 100 / _totalElementToTreat;
// check every percentage only // check every percentage only
nextIToCheck_ = (currentPercentage+1) * totalElementToTreat_ / 100 + 1; _nextIToCheck = (currentPercentage + 1) * _totalElementToTreat / 100 + 1;
double currentTime = Cpu(); double currentTime = Cpu();
if ((currentPercentage < 5 && currentTime - lastTime_ > 15.) || if ((currentPercentage < 5 && currentTime - _lastTime > 15.) ||
(currentPercentage > lastPercentage_ + 4 && currentTime - lastTime_ > 10.)) { (currentPercentage > _lastPercentage + 4 && currentTime - _lastTime > 10.)) {
lastPercentage_ = currentPercentage; _lastPercentage = currentPercentage;
lastTime_ = currentTime; _lastTime = currentTime;
const double remaining = (currentTime-initialTime_) / (currentI_+1) * const double remaining = (currentTime - _initialTime) / (_currentI + 1) *
(totalElementToTreat_ - currentI_-1); (_totalElementToTreat - _currentI - 1);
if (remaining < 60*2) if (remaining < 60*2)
Msg::ProgressMeter(currentI_-1, totalElementToTreat_, true, "%d%% (remaining time ~%g seconds)", Msg::ProgressMeter(_currentI - 1, _totalElementToTreat, true,
currentPercentage, remaining); "%d%% (remaining time ~%g seconds)",
currentPercentage, remaining);
else if (remaining < 60*60*2) else if (remaining < 60*60*2)
Msg::ProgressMeter(currentI_-1, totalElementToTreat_, true, "%d%% (remaining time ~%g minutes)", Msg::ProgressMeter(_currentI - 1, _totalElementToTreat, true,
currentPercentage, remaining/60); "%d%% (remaining time ~%g minutes)",
currentPercentage, remaining / 60);
else else
Msg::ProgressMeter(currentI_-1, totalElementToTreat_, true, "%d%% (remaining time ~%g hours)", Msg::ProgressMeter(_currentI - 1, _totalElementToTreat, true,
currentPercentage, remaining/3600); "%d%% (remaining time ~%g hours)",
currentPercentage, remaining / 3600);
} }
} }
...@@ -156,15 +156,14 @@ class Msg { ...@@ -156,15 +156,14 @@ class Msg {
class MsgProgressStatus class MsgProgressStatus
{ {
private: private:
int totalElementToTreat_, currentI_, nextIToCheck_; int _totalElementToTreat, _currentI, _nextIToCheck;
double initialTime_, lastTime_; double _initialTime, _lastTime;
int lastPercentage_; int _lastPercentage;
int progressMeterStep_; int _progressMeterStep;
public: public:
MsgProgressStatus(int numElementToTreat); MsgProgressStatus(int numElementToTreat);
~MsgProgressStatus(); ~MsgProgressStatus();
void setInitialTime(double time) { _initialTime = time; }
void setInitialTime(double time) {initialTime_ = time;}
void next(); void next();
}; };
......
...@@ -43,7 +43,6 @@ set(SRC ...@@ -43,7 +43,6 @@ set(SRC
DivideAndConquer.cpp DivideAndConquer.cpp
Voronoi3D.cpp Voronoi3D.cpp
Levy3D.cpp Levy3D.cpp
periodical.cpp
directions3D.cpp directions3D.cpp
filterElements.cpp filterElements.cpp
yamakawa.cpp yamakawa.cpp
......
...@@ -38,6 +38,7 @@ set(SRC ...@@ -38,6 +38,7 @@ set(SRC
CVTRemesh.cpp CVTRemesh.cpp
ShowNeighborElements.cpp ShowNeighborElements.cpp
GaussPoints.cpp GaussPoints.cpp
VoroMetal.cpp
) )
file(GLOB HDR RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.h) file(GLOB HDR RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.h)
......
...@@ -67,6 +67,7 @@ ...@@ -67,6 +67,7 @@
#include "CVTRemesh.h" #include "CVTRemesh.h"
#include "ShowNeighborElements.h" #include "ShowNeighborElements.h"
#include "GaussPoints.h" #include "GaussPoints.h"
#include "VoroMetal.h"
// for testing purposes only :-) // for testing purposes only :-)
#undef HAVE_DLOPEN #undef HAVE_DLOPEN
...@@ -272,6 +273,8 @@ void PluginManager::registerDefaultPlugins() ...@@ -272,6 +273,8 @@ void PluginManager::registerDefaultPlugins()
#if defined(HAVE_MESH) #if defined(HAVE_MESH)
allPlugins.insert(std::pair<std::string, GMSH_Plugin*> allPlugins.insert(std::pair<std::string, GMSH_Plugin*>
("AnalyseCurvedMesh", GMSH_RegisterAnalyseCurvedMeshPlugin())); ("AnalyseCurvedMesh", GMSH_RegisterAnalyseCurvedMeshPlugin()));
allPlugins.insert(std::pair<std::string, GMSH_Plugin*>
("VoroMetal", GMSH_RegisterVoroMetalPlugin()));
#endif #endif
#if defined(HAVE_REVOROPT) #if defined(HAVE_REVOROPT)
allPlugins.insert(std::pair<std::string, GMSH_Plugin*> allPlugins.insert(std::pair<std::string, GMSH_Plugin*>
......
...@@ -152,7 +152,7 @@ PView *GMSH_TetrahedralizePlugin::execute(PView *v) ...@@ -152,7 +152,7 @@ PView *GMSH_TetrahedralizePlugin::execute(PView *v)
PView *GMSH_TetrahedralizePlugin::execute(PView *v) PView *GMSH_TetrahedralizePlugin::execute(PView *v)
{ {
Msg::Error("Plugin(Tetrahedralize requires mesh module"); Msg::Error("Plugin(Tetrahedralize) requires mesh module");
return v; return v;
} }
......
...@@ -2,18 +2,42 @@ ...@@ -2,18 +2,42 @@
// //
// See the LICENSE.txt file for license information. Please report all // See the LICENSE.txt file for license information. Please report all
// bugs and problems to the public mailing list <gmsh@onelab.info>. // bugs and problems to the public mailing list <gmsh@onelab.info>.
//
// Contributor(s):
// Tristan Carrier Maxime Melchior
#include "GRegion.h" #ifndef _VOROMETAL_H_
#define _VOROMETAL_H_
#include <vector>
#include "Plugin.h"
class geo_cell{
public:
std::vector<std::pair<int,int> > lines;
std::vector<std::vector<int> > line_loops;
std::vector<std::vector<int> > orientations;
std::vector<int> points2;
std::vector<int> lines2;
std::vector<int> line_loops2;
std::vector<int> faces2;
int face_loops2;
geo_cell(){}
~geo_cell(){}
int search_line(std::pair<int,int> line)
{
unsigned int i;
for(i=0;i<lines.size();i++){
if(lines[i].first==line.first && lines[i].second==line.second) return i;
if(lines[i].first==line.second && lines[i].second==line.first) return i;
}
return -1;
}
};
class voroMetal3D{ class voroMetal3D{
private: private:
int counter; int counter;
public: public:
voroMetal3D(); voroMetal3D(){}
~voroMetal3D(); ~voroMetal3D(){}
void execute(double); void execute(double);
void execute(GRegion*,double); void execute(GRegion*,double);
void execute(std::vector<SPoint3>&,std::vector<double>&,int,double,double,double,double); void execute(std::vector<SPoint3>&,std::vector<double>&,int,double,double,double,double);
...@@ -36,8 +60,27 @@ class voroMetal3D{ ...@@ -36,8 +60,27 @@ class voroMetal3D{
bool equal(double,double,double); bool equal(double,double,double);
}; };
extern "C"
{
GMSH_Plugin *GMSH_RegisterVoroMetalPlugin();
}
void microstructure(const char *filename); class GMSH_VoroMetalPlugin : public GMSH_PostPlugin
void computeBestSeeds(const char *filename); {
public:
GMSH_VoroMetalPlugin(){}
std::string getName() const { return "VoroMetal"; }
std::string getShortHelp() const
{
return "Voronoi microstructures";
}
std::string getHelp() const;
std::string getAuthor() const { return "Tristan Carrier & Maxime Melchior"; }
int getNbOptions() const;
StringXNumber* getOption(int iopt);
int getNbOptionsStr() const;
StringXString *getOptionStr(int iopt);
PView *execute(PView *);
};
#endif
68 0 1. 1. 1.
0.5602 0.5768 0.4357 1
0.5713 0.5688 0.4418 1
0.5491 0.5848 0.4296 1
0.5379 0.6113 0.6941 1
0.5261 0.6204 0.6959 1
0.5497 0.6022 0.6923 1
0.6873 0.7394 0.5293 1
0.6133 0.3627 0.5324 1
0.1458 0.1328 0.3812 1
0.7003 0.5497 0.8256 1
0.5373 0.6623 0.0532 1
0.1715 0.6187 0.7587 1
0.9101 0.7140 0.7400 1
0.3567 0.8219 0.5521 1
0.6508 0.1876 0.8183 1
0.0224 0.6572 0.1196 1
0.3854 0.2426 0.9653 1
0.4853 0.9923 0.2813 1
0.9784 0.9529 0.2431 1
0.1387 0.4549 0.9844 1
0.4249 0.7048 0.3654 1
0.2004 0.4096 0.2392 1
0.7050 0.0791 0.2038 1
0.2546 0.8227 0.2816 1
0.6248 0.7458 0.8739 1
0.0452 0.1465 0.8069 1
0.0928 0.6517 0.3952 1
0.6199 0.8252 0.3391 1
0.2802 0.9931 0.7612 1
0.5263 0.9937 0.7263 1
0.8715 0.5572 0.3972 1
0.5489 0.3050 0.1544 1
0.0010 0.4132 0.8038 1
0.8779 0.1408 0.0431 1
0.6007 0.0963 0.5492 1
0.3143 0.0031 0.9996 1
0.8804 0.2438 0.5439 1
0.9771 0.0028 0.4942 1
0.9610 0.2860 0.2800 1
0.1864 0.0621 0.1669 1
0.3355 0.0698 0.4926 1
0.8340 0.9321 0.7665 1
0.4538 0.2884 0.7151 1
0.1844 0.4269 0.6276 1
0.1173 0.8548 0.5805 1
0.7669 0.8185 0.0563 1
0.7686 0.3834 0.0918 1
0.7193 0.9982 0.9369 1
0.4796 0.1995 0.3542 1
0.9097 0.7816 0.4809 1
0.6418 0.6288 0.2492 1
0.3331 0.5907 0.0614 1
0.5100 0.8816 0.0027 1
0.1555 0.7684 0.9837 1
0.7948 0.5999 0.0487 1
0.3215 0.3967 0.4377 1
0.4659 0.4677 0.9396 1
0.2469 0.2219 0.7829 1
0.0729 0.3849 0.4411 1
0.9547 0.5321 0.6121 1
0.3699 0.7445 0.8400 1
0.9925 0.9447 0.9161 1
0.7929 0.4079 0.6849 1
0.1046 0.2266 0.0321 1
0.7516 0.2727 0.3346 1
0.1198 0.2221 0.6062 1
0.3474 0.2320 0.1859 1
0.5263 0.1019 0.0603 1
Plugin(VoroMetal).SeedsFile = "seeds64doubletw.txt";
Plugin(VoroMetal).ComputeBestSeeds = 0;
Plugin(VoroMetal).ComputeMicrostructure = 1;
Plugin(VoroMetal).Run;
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