Skip to content

Commit

Permalink
Merge pull request #41 from ysimillides/master
Browse files Browse the repository at this point in the history
mshr dependency removed
  • Loading branch information
ysimillides authored Feb 15, 2018
2 parents 2c4aa86 + d11e26d commit 7488f4d
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 27 deletions.
6 changes: 6 additions & 0 deletions src/FEniCS.jl
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,10 @@ include("jmesh.jl") #this file contains the mesh functions
include("jfem.jl") #this file contains the fem functions
include("jmisc.jl") #this file contains various miscallaneous functions to assist with solving etc
include("jsolve.jl") #this file contains the solver functions/routines
try
pyimport("mshr")
include("fmshr.jl")
catch ee
print("mshr has not been included")
end
end #module
21 changes: 21 additions & 0 deletions src/fmshr.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
@pyimport mshr
@fenicsclass Geometry

#functions necessary for creating meshes from geometrical objects.
#2D objects below
Circle(centre,radius) = Geometry(mshr.Circle(centre,radius))
Rectangle(corner1,corner2)=Geometry(mshr.Rectangle(corner1,corner2))
Ellipse(centre,horizontal_semi_axis,vertical_semi_axis,fragments)=Geometry(mshr.Ellipse(centre,horizontal_semi_axis,vertical_semi_axis,fragments))

#3d objects below
Box(corner1,corner2) = Geometry(mshr.Box(corner1,corner2))
Cone(top,bottom,bottom_radius,slices::Int)=Geometry(mshr.Cone(top,bottom,bottom_radius,slices))
Sphere(centre,radius) = Geometry(mshr.Sphere(centre,radius))

generate_mesh(geom_object::Geometry,size::Int)=Mesh(mshr.generate_mesh(geom_object.pyobject,size))

+(geom_object1::Geometry, geom_object2::Geometry) = Geometry(geom_object1.pyobject[:__add__](geom_object2.pyobject))
-(geom_object1::Geometry, geom_object2::Geometry) = Geometry(geom_object1.pyobject[:__sub__](geom_object2.pyobject))
*(geom_object1::Geometry, geom_object2::Geometry) = Geometry(geom_object1.pyobject[:__mul__](geom_object2.pyobject))

export Circle,Rectangle,Ellipse,Box,Cone,Sphere,generate_mesh
2 changes: 1 addition & 1 deletion src/jfem.jl
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ please refer to http://matplotlib.org/api/pyplot_api.html
not all kwargs have been imported. Should you require any that are not imported
open as issue, and I will attempt to add them.
"""
Plot(in_plot::Union{Mesh,FunctionSpace,Function,Geometry};alpha=1,animated=false,antialiased=true,color="grey"
Plot(in_plot::Union{Mesh,FunctionSpace,Function};alpha=1,animated=false,antialiased=true,color="grey"
,dash_capstyle="butt",dash_joinstyle="miter",dashes="",drawstyle="default",fillstyle="full",label="s",linestyle="solid",linewidth=1
,marker="",markeredgecolor="grey",markeredgewidth="",markerfacecolor="grey"
,markerfacecoloralt="grey",markersize=1,markevery="none",visible=true,title="") =fenics.common[:plotting][:plot](in_plot.pyobject,
Expand Down
26 changes: 0 additions & 26 deletions src/jmesh.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
#These are the commands to define the Mesh class in Julia.
#Tests for these can be found in the test_create.jl and test_pycreate.jl

#necessary imports for some specific mesh operations.
@pyimport mshr

@fenicsclass Mesh #https://fenicsproject.org/olddocs/dolfin/1.5.0/python/programmers-reference/cpp/mesh/Mesh.html
#are converted automatically by PyCall
Expand Down Expand Up @@ -78,33 +76,9 @@ BoxMesh(p0, p1, nx::Int, ny::Int, nz::Int)= Mesh(fenics.BoxMesh(p0,p1,nx,ny,nz))

RectangleMesh(p0,p1,nx::Int,ny::Int,diagdir::Union{String,Symbol}="right") = Mesh(fenics.RectangleMesh(p0,p1,nx,ny))




export UnitTriangleMesh, UnitTetrahedronMesh, UnitSquareMesh, UnitQuadMesh,
UnitIntervalMesh, UnitCubeMesh, BoxMesh, RectangleMesh, Mesh

@fenicsclass Geometry

#functions necessary for creating meshes from geometrical objects.
#2D objects below
Circle(centre,radius) = Geometry(mshr.Circle(centre,radius))
Rectangle(corner1,corner2)=Geometry(mshr.Rectangle(corner1,corner2))
Ellipse(centre,horizontal_semi_axis,vertical_semi_axis,fragments)=Geometry(mshr.Ellipse(centre,horizontal_semi_axis,vertical_semi_axis,fragments))

#3d objects below
Box(corner1,corner2) = Geometry(mshr.Box(corner1,corner2))
Cone(top,bottom,bottom_radius,slices::Int)=Geometry(mshr.Cone(top,bottom,bottom_radius,slices))
Sphere(centre,radius) = Geometry(mshr.Sphere(centre,radius))

generate_mesh(geom_object::Geometry,size::Int)=Mesh(mshr.generate_mesh(geom_object.pyobject,size))

+(geom_object1::Geometry, geom_object2::Geometry) = Geometry(geom_object1.pyobject[:__add__](geom_object2.pyobject))
-(geom_object1::Geometry, geom_object2::Geometry) = Geometry(geom_object1.pyobject[:__sub__](geom_object2.pyobject))
*(geom_object1::Geometry, geom_object2::Geometry) = Geometry(geom_object1.pyobject[:__mul__](geom_object2.pyobject))

export Circle,Rectangle,Ellipse,Box,Cone,Sphere,generate_mesh

function pyUnitTriangleMesh()
pycall(fenics.UnitTriangleMesh::PyObject,PyObject::Type)
end
Expand Down

0 comments on commit 7488f4d

Please sign in to comment.