Exemplo n.º 1
0
 def showMesh(self, markCell=True, markEdge=True, markNode=True):
     mesh = self.mesh
     fig = plt.figure()
     axes = fig.gca()
     mesh.add_plot(axes, cellcolor='w')
     if markCell:
         find_entity(axes,
                     mesh,
                     entity='cell',
                     showindex=True,
                     color='b',
                     markersize=10,
                     fontsize=8)
     if markEdge:
         find_entity(axes,
                     mesh,
                     entity='edge',
                     showindex=True,
                     color='r',
                     markersize=10,
                     fontsize=8)
     if markNode:
         find_entity(axes,
                     mesh,
                     entity='node',
                     showindex=True,
                     color='y',
                     markersize=10,
                     fontsize=8)
     plt.show()
     plt.close()
Exemplo n.º 2
0
# --- quad-tree mesh ---
# cell = np.array([(0, 1, 2, 3)], dtype=np.int)  # quad mesh
# qtree = Quadtree(node, cell)
# qtree.uniform_refine(n)
# pmesh = qtree.to_pmesh()  # Excuse me?! It has this operator!
# -----------------------

# ---- plot poly mesh ----
fig2 = plt.figure()
axes = fig2.gca()
pmesh.add_plot(axes, cellcolor='w')
find_entity(axes,
            pmesh,
            entity='cell',
            index=None,
            showindex=True,
            color='b',
            markersize=10,
            fontsize=8)
find_entity(axes,
            pmesh,
            entity='edge',
            index=None,
            showindex=True,
            color='r',
            markersize=10,
            fontsize=8)
find_entity(axes,
            pmesh,
            entity='node',
            index=None,
# ------------------

# # ---- quad mesh ----
# cell = np.array([(0, 1, 2, 3)], dtype=np.int)  # quad mesh
# # mesh = Quadtree(node, cell)
# mesh = QuadrangleMesh(node, cell)
# mesh.uniform_refine(n)
# # -------------------

fig = plt.figure()
axes = fig.gca()
mesh.add_plot(axes, cellcolor='w')
find_entity(axes,
            mesh,
            entity='cell',
            index='all',
            showindex=True,
            color='b',
            markersize=16,
            fontsize=9)
find_entity(axes,
            mesh,
            entity='edge',
            index='all',
            showindex=True,
            color='r',
            markersize=16,
            fontsize=9)
# find_entity(axes, mesh, entity='node', index='all', showindex=True, color='r', markersize=16, fontsize=9)
# find_node(axes, mesh.node, showindex=True, fontsize=12, markersize=25)
plt.show()