Skip to content
Snippets Groups Projects
Commit be54c25c authored by Jean-François Remacle's avatar Jean-François Remacle
Browse files

added a new directory "python" in the benchmarks

parent 42cebbc3
No related branches found
No related tags found
No related merge requests found
import math
from gmshpy import *
from Common import *
def Adaptation ( gm , gm_adapt) :
print "hello 1"
myMap = IntDoubleVectorMap ()
gf = gm.getFaceByTag(6)
print "hello 2"
for i in range(1, gf.getNumMeshElements()):
e = gf.getMeshElement(i)
for j in range (0, e.getNumVertices()):
v = e.getVertex(j)
x = v.x()
y = v.y()
myMap[v.getNum()] = [math.tanh(-100*(y-0.5-0.25*sin(2*3.14159*x))) + tanh(100*(y-x))];
# myMap[v.getNum()] = [math.exp(-100*((v.x()-0.5)*(v.x()-0.5)+(v.y()-0.5)*(v.y()-0.5)))]
print "hello 3", myMap.size()
pv = PView ('xcarre','NodeData', gm, myMap)
pve = PViewEvaluator (pv)
lcMin = 0.00001
lcMax = .1
eps = 1.e-2
nbIter = 4
allDim = 1
gm_adapt.adaptMesh([2], [pve], [[eps, lcMin, lcMax]], nbIter, allDim)
print "hello 4"
gm = GModel()
gm.load('square.geo')
gm.load('square.msh')
gm_adapt = GModel()
gm_adapt.load('square.geo')
gm_adapt2 = GModel()
gm_adapt2.load('square.geo')
Adaptation ( gm , gm_adapt2)
print "------------------------------------------------------------------------"
Adaptation ( gm_adapt2 , gm_adapt)
fact = 1;
lc = .01 * fact;
Point(1) = {0.0,0.0,0,lc};
Point(2) = {1* fact,0.0,0,lc};
Point(3) = {1* fact,1* fact,0,lc};
Point(4) = {0,1* fact,0,lc};
Line(1) = {3,2};
Line(2) = {2,1};
Line(3) = {1,4};
Line(4) = {4,3};
Line Loop(5) = {1,2,3,4};
Plane Surface(6) = {5};
This diff is collapsed.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment