demo.py

来自「利用C」· Python 代码 · 共 30 行

PY
30
字号
"""This demo demonstrates how to move the vertex coordinatesof a boundary mesh and then updating the interior vertexcoordinates of the original mesh by suitably interpolatingthe vertex coordinates (useful for implementation of ALEmethods)."""__author__ = "Solveig Bruvoll (solveio@ifi.uio.no) and Anders Logg (logg@simula.no)"__date__ = "2008-05-02 -- 2008-05-28"__copyright__ = "Copyright (C) 2008 Solveig Bruvoll and Anders Logg"__license__  = "GNU LGPL Version 2.1"from dolfin import *# Create meshmesh = UnitSquare(20, 20)# Create boundary meshboundary = BoundaryMesh(mesh)# Move vertices in boundaryfor x in boundary.coordinates():    x[0] *= 3.0    x[1] += 0.1*sin(5.0*x[0])# Move meshmesh.move(boundary, hermite)# Plot meshplot(mesh, interactive=True)

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?