Exemplo n.º 1
0
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D

from fealpy.mesh import MeshFactory

mf = MeshFactory()

# 2d mesh
box = [0, 1, 0, 1]
mesh = mf.boxmesh2d(box, nx=4, ny=4, meshtype='tri')

mesh = mf.boxmesh2d(box, nx=4, ny=4, meshtype='quad')

mesh = mf.boxmesh2d(box, nx=4, ny=4, meshtype='poly')

mesh = mf.triangle(box, h=0.1, meshtype='tri')

mesh = mf.triangle(box, h=0.1, meshtype='poly')

mesh = mf.special_boxmesh2d(box, n=10, meshtype='fishbone')

mesh = mf.special_boxmesh2d(box, n=10, meshtype='rice')

mesh = mf.special_boxmesh2d(box, n=10, meshtype='cross')

mesh = mf.special_boxmesh2d(box, n=10, meshtype='nonuniform')

mesh = mf.unitcirclemesh(0.1, meshtype='tri')

mesh = mf.unitcirclemesh(0.1, meshtype='poly')
Exemplo n.º 2
0
Arquivo: mf.py Projeto: mfkiwl/fealpy
Author 
------
Huayi Wei <*****@*****.**>

Date
----
2021.06.03 08:48:52
"""

import numpy as np
import matplotlib.pyplot as plt

from fealpy.mesh import MeshFactory as MF

box2d = [0, 1, 0, 1]
mesh = MF.boxmesh2d(box2d, nx=10, ny=10, meshtype='tri')
mesh = MF.boxmesh2d(box2d, nx=10, ny=10, meshtype='quad')
mesh = MF.boxmesh2d(box2d, nx=10, ny=10, meshtype='poly')
mesh = MF.special_boxmesh2d(box2d, n=10, meshtype='fishbone')
mesh = MF.special_boxmesh2d(box2d, n=10, meshtype='rice')
mesh = MF.special_boxmesh2d(box2d, n=10, meshtype='cross')
mesh = MF.special_boxmesh2d(box2d, n=10, meshtype='nonuniform')
mesh = MF.unitcirclemesh(0.1, meshtype='poly')
mesh = MF.triangle(box2d, 0.1, meshtype='poly')

fig = plt.figure()
axes = fig.gca()
mesh.add_plot(axes)
plt.show()