Skip to content
Snippets Groups Projects
Commit 1d55d03d authored by Christophe Geuzaine's avatar Christophe Geuzaine
Browse files

cleanup

parent ec180db5
No related branches found
No related tags found
No related merge requests found
......@@ -218,7 +218,8 @@ void TransferTetgenMesh(GRegion *gr, tetgenio &in, tetgenio &out,
}
else{
v1b = new MVertex(v[j]->x(), v[j]->y(), v[j]->z(),gf);
Msg::Warning("The point was not projected back to the surface (%g %g %g)", v[j]->x(), v[j]->y(), v[j]->z());
Msg::Warning("The point was not projected back to the surface (%g %g %g)",
v[j]->x(), v[j]->y(), v[j]->z());
}
}
else{
......@@ -320,7 +321,6 @@ void MeshDelaunayVolume(std::vector<GRegion*> &regions)
// now do insertion of points
insertVerticesInRegion(gr);
Msg::Info("Gmsh 3D Delaunay has generated %d tets", gr->tetrahedra.size());
#endif
}
......
......@@ -787,7 +787,7 @@ void insertVerticesInRegion (GRegion *gr)
if(worst->isDeleted()){
myFactory.Free(worst);
allTets.erase(allTets.begin());
Msg::Info("Worst tet is deleted");
//Msg::Info("Worst tet is deleted");
}
else{
if(ITER++ %5000 == 0)
......
......@@ -179,12 +179,16 @@ void tetgenmesh::repairencsegs()
void tetgenmesh::enforcequality()
{
face shloop;
REAL bakeps;
long bakptcount;
if (!b->quiet) {
printf("Conforming Delaunay meshing.\n");
}
bakeps = b->epsilon; // Bakup the epsilon.
b->epsilon = 0;
// Initialize the pool for storing encroched segments.
badsegpool = new memorypool(sizeof(badface), SUBPERBLOCK, POINTER, 0);
......@@ -238,6 +242,8 @@ void tetgenmesh::enforcequality()
delete tg_botshells;
delete badsegpool;
b->epsilon = bakeps; // Restore the epsilon.
}
#endif // #ifndef refineCXX
#
# how to build a standalone 64 bit gmsh lib on OSX:
# how to build a standalone 64 bit gmsh graphics lib on OSX:
#
# export CC="gcc -m64"
# export CXX="g++ -m64"
......@@ -10,13 +10,16 @@
#
mainAntTweakBar: mainAntTweakBar.cpp
g++ -m64 -o mainAntTweakBar -Iinclude mainAntTweakBar.cpp -Llib\
-lGmsh -lAntTweakBar\
-framework OpenGL -framework GLUT -framework Cocoa -framework ApplicationServices\
-llapack -lblas -lz -lm
g++ -g -m64 -o mainAntTweakBar -Iinclude mainAntTweakBar.cpp -Llib\
-lGmsh -lAntTweakBar -framework OpenGL -framework GLUT -framework Cocoa\
-framework ApplicationServices -llapack -lblas -lz -lm
mainGlut: mainGlut.cpp
g++ -m64 -o mainGlut -Iinclude mainGlut.cpp -Llib -lGmsh\
-framework OpenGL -framework GLUT -framework Cocoa -framework ApplicationServices\
-llapack -lblas -lz -lm
g++ -g -m64 -o mainGlut -Iinclude mainGlut.cpp -Llib -lGmsh\
-framework OpenGL -framework GLUT -framework Cocoa\
-framework ApplicationServices -llapack -lblas -lz -lm
mainPost: mainPost.cpp
g++ -g -m64 -o mainPost -Iinclude mainPost.cpp -Llib -lGmsh\
-framework ApplicationServices -llapack -lblas -lz -lm
......@@ -70,38 +70,50 @@ void keyboard(unsigned char key, int x, int y)
glutPostRedisplay();
}
static int xprev = 0, yprev = 0, specialkey = 0;
static mousePosition clickPos, prevPos;
static int specialKey = 0;
void mouseMotion(int x, int y)
{
if(TwEventMouseMotionGLUT(x, y)) return;
int w = ctx->viewport[2];
int h = ctx->viewport[3];
if(specialkey == GLUT_ACTIVE_SHIFT){
double dx = x - xprev;
double dy = y - yprev;
mousePosition currPos;
currPos.set(ctx, x, y);
if(specialKey == GLUT_ACTIVE_SHIFT){
double dx = currPos.win[0] - prevPos.win[0];
double dy = currPos.win[1] - prevPos.win[1];
if(fabs(dy) > fabs(dx)) {
double fact = (4. * fabs(dy) + h) / (double)h;
ctx->s[0] *= ((dy > 0) ? fact : 1. / fact);
ctx->s[1] = ctx->s[0];
ctx->s[2] = ctx->s[0];
clickPos.recenter(ctx);
}
}
else if(specialKey == GLUT_ACTIVE_ALT){
ctx->t[0] += (currPos.wnr[0] - clickPos.wnr[0]);
ctx->t[1] += (currPos.wnr[1] - clickPos.wnr[1]);
ctx->t[2] = 0.;
}
else{
ctx->addQuaternion((2. * xprev - w) / w, (h - 2. * yprev) / h,
(2. * x - w) / w, (h - 2. * y) / h);
ctx->addQuaternion
((2. * prevPos.win[0] - w) / w, (h - 2. * prevPos.win[1]) / h,
(2. * currPos.win[0] - w) / w, (h - 2. * currPos.win[1]) / h);
}
xprev = x;
yprev = y;
prevPos.set(ctx, x, y);
glutPostRedisplay();
}
void mouseButton(int button, int state, int x, int y)
{
if(TwEventMouseButtonGLUT(button, state, x, y)) return;
specialkey = glutGetModifiers();
xprev = x;
yprev = y;
specialKey = glutGetModifiers();
clickPos.set(ctx, x, y);
prevPos.set(ctx, x, y);
}
// AntTweakBar callbacks
......@@ -207,7 +219,7 @@ int main(int argc, char **argv)
TwGLUTModifiersFunc(glutGetModifiers);
TwBar *bar = TwNewBar("Options");
TwDefine(" Options size='200 400' "); // color='0 0 0' alpha=128");
TwDefine(" Options size='200 400' color='50 50 50' alpha=128");
{
TwEnumVal axesEV[6] = { {0, "None"}, {1, "Simple axes"}, {2, "Box"},
{3, "Full grid"}, {4, "Open grid"}, {5, "Ruler"} };
......
......@@ -97,9 +97,9 @@ void mouse(int button, int state, int x, int y)
int main(int argc, char **argv)
{
GmshInitialize(argc, argv);
GmshSetOption("General", "Terminal", 1);
GmshSetOption("View", "IntervalsType", 1);
GmshSetOption("View", "AdaptVisualizationGrid", 1);
GmshSetOption("General", "Terminal", 1.);
GmshSetOption("View", "IntervalsType", 1.);
GmshSetOption("View", "AdaptVisualizationGrid", 1.);
GmshSetOption("View", "TargetError", 0.00001);
GmshSetOption("View", "MaxRecursionLevel", 3.);
......
// g++ -I/usr/local/opencascade/inc driverOCC.cpp -lGmsh -L/usr/local/opencascade/lib -lTKSTEP -lTKSTEP209 -lTKSTEPAttr -lTKSTEPBase -lTKIGES -lTKXSBase -lTKOffset -lTKFeat -lTKFillet -lTKBool -lTKShHealing -lTKMesh -lTKHLR -lTKBO -lTKPrim -lTKTopAlgo -lTKGeomAlgo -lTKBRep -lTKGeomBase -lTKG3d -lTKG2d -lTKAdvTools -lTKMath -lTKernel -lm
#if !defined(HAVE_NO_OCC_CONFIG_H)
#include "config.h"
#endif
#include "TopoDS_Shape.hxx"
#include "BRep_Tool.hxx"
#include "BRep_Builder.hxx"
#include "BRepTools.hxx"
#include <stdio.h>
#include <gmsh/Gmsh.h>
#include <gmsh/GmshConfig.h>
#include <gmsh/GModel.h>
#include <gmsh/MElement.h>
#if !defined(HAVE_NO_OCC_CONFIG_H)
#include "config.h"
#endif
#include <TopoDS_Shape.hxx>
#include <BRep_Tool.hxx>
#include <BRep_Builder.hxx>
#include <BRepTools.hxx>
class mymsg : public GmshMessage{
private:
GModel *_model;
......
// configure, compile and install Gmsh as a library with
//
// ./configure --disable-gui
// make install-lib
//
// Then compile this driver with "g++ driver.cpp -lGmsh -llapack -lblas"
#include <stdio.h>
#include <gmsh/Gmsh.h>
#include <gmsh/GModel.h>
#include <gmsh/MElement.h>
#include <gmsh/MVertex.h>
#include <gmsh/PView.h>
#include <gmsh/PViewData.h>
#include <gmsh/PluginManager.h>
int main(int argc, char **argv)
{
GmshInitialize(argc, argv);
GmshSetOption("General", "Terminal", 1.);
// load a geometry and mesh it
GModel *m = new GModel();
m->readGEO("../../tutorial/t1.geo");
m->mesh(2);
// create a node-based post-processing dataset
std::vector<GEntity*> entities;
GModel::current()->getEntities(entities);
m->getEntities(entities);
std::map<int, std::vector<double> > d;
for(unsigned int i = 0; i < entities.size(); i++){
for(unsigned int j = 0; j < entities[i]->getNumMeshElements(); j++){
MElement *e = entities[i]->getMeshElement(j);
d[e->getNum()].push_back(e->gammaShapeMeasure());
for(unsigned int j = 0; j < entities[i]->getNumMeshVertices(); j++){
MVertex *v = entities[i]->getMeshVertex(j);
d[v->getNum()].push_back(v->x());
}
}
new PView(name, "ElementData", GModel::current(), d);
PluginManager::instance()->setPluginOption("CutPlane", "A", 1.);
PluginManager::instance()->setPluginOption("CutPlane", "B", 0.);
PView *p = new PView("f(x,y,z) = x", "NodeData", m, d);
p->getData()->writeMSH("f.msh");
// use a plugin on the dataset
PluginManager::instance()->setPluginOption("CutPlane", "A", 0.);
PluginManager::instance()->setPluginOption("CutPlane", "B", 1.);
PluginManager::instance()->setPluginOption("CutPlane", "C", 0.);
PluginManager::instance()->setPluginOption("CutPlane", "D", -0.05);
PluginManager::instance()->setPluginOption("CutPlane", "iView", 0.);
PluginManager::instance()->action("CutPlane", "Run", 0);
PView::list.back()->getData()->writeMSH("fcut.msh");
int main(int argc, char **argv)
{
GmshInitialize(argc, argv);
GmshSetOption("Mesh", "Algorithm", 5);
GModel *m = new GModel();
m->readGEO("../../tutorial/t5.geo");
m->mesh(3);
for(GModel::riter it = m->firstRegion(); it != m->lastRegion(); ++it){
GRegion *r = *it;
printf("volume %d contains %d elements:\n", r->tag(), r->getNumMeshElements());
for(unsigned int i = 0; i < r->getNumMeshElements(); i++)
printf(" %d", r->getMeshElement(i)->getNum());
printf("\n");
}
m->writeMSH("test.msh");
m->writeUNV("test.unv");
delete m;
GmshFinalize();
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment