Beispiel #1
0
import numpy as np
import matplotlib.pyplot as plt
import mpl_toolkits.mplot3d as a3
import pylab as pl
import scipy.io as sio

from fealpy.mesh import simple_mesh_generator, TriangleMesh

mesh = simple_mesh_generator.unitcircledomainmesh(0.5)
node = mesh.entity('node')
cell = mesh.entity('cell')

print(node.shape)
fig = plt.figure()
axes = fig.gca()
mesh.add_plot(axes)
plt.show()
Beispiel #2
0
 def init_mesh(self, n=0):
     mesh = unitcircledomainmesh(self.h)
     mesh.uniform_refine(n)
     return mesh
Beispiel #3
0
    flag = isBDEdge[cell2edge[cellidx, 0]]
    idx1 = start[flag].reshape(-1, 1) + np.arange(1, n + 1)
    pcell[idx1] = idx0[idxmap[cell2edge[cellidx[flag], 0]], :]

    start[flag] += n + 1
    start[~flag] += 1
    pcell[start] = cell[cellidx, 2]

    flag = isBDEdge[cell2edge[cellidx, 1]]
    idx1 = start[flag].reshape(-1, 1) + np.arange(1, n + 1)
    pcell[idx1] = idx0[idxmap[cell2edge[cellidx[flag], 1]], :]

    pnode = np.r_[node, bc.reshape(-1, 2)]
    return PolygonMesh(pnode, pcell, pcellLocation)


mesh = unitcircledomainmesh(0.4, meshtype='tri')
pmesh = tri_to_polygonmesh(mesh, 2)

fig = plt.figure()
axes = fig.gca()
pmesh.add_plot(axes)
#mesh.add_plot(axes)
print(pmesh.ds.cell)
print(pmesh.ds.cellLocation)
pmesh.find_node(axes, showindex=True)
pmesh.find_edge(axes, showindex=True)
pmesh.find_cell(axes, showindex=True)
plt.show()
import sys
import matplotlib.pyplot as plt

from fealpy.mesh.simple_mesh_generator import unitcircledomainmesh
from fealpy.mesh.TriangleMesh import TriangleMeshWithInfinityPoint
from fealpy.mesh.PolygonMesh import PolygonMesh

h = 0.1
mesh0 = unitcircledomainmesh(h)

mesh1 = TriangleMeshWithInfinityPoint(mesh0)

point, cell, cellLocation = mesh1.to_polygonmesh()

pmesh = PolygonMesh(point, cell, cellLocation)

f0 = plt.figure()
axes0 = f0.gca()
mesh0.add_plot(axes0)

f1 = plt.figure()
axes1 = f1.gca()
pmesh.add_plot(axes1)
plt.show()
Beispiel #5
0
import sys

import numpy as np

import matplotlib.pyplot as plt

from fealpy.mesh.simple_mesh_generator import unitcircledomainmesh
from fealpy.mesh.coloring import coloring

fig = plt.figure()
axes = fig.gca()
mesh = unitcircledomainmesh(0.1)
c = coloring(mesh, method='random')
color=np.array(['b', 'g', 'r', 'c', 'm', 'y', 'k', 'w'])
mesh.add_plot(axes, nodecolor=color[c-1], cellcolor='w', markersize=100)
mesh.find_node(axes, color=color[c-1])
plt.show()