{ "info": { "author": "Tristan de Lataillade", "author_email": "delataillade.tristan@gmail.com", "bugtrack_url": null, "classifiers": [ "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python :: 3" ], "description": "# py2gmsh\n\nPython wrappers to create gmsh files with object-oriented syntax.\n\nThe wrappers are made closest to actual gmsh syntax for .geo files, with the\naddition of convenience tools, object-oriented syntax for easy manipulation and\nextra functionalities.\n\n## Installation\n\nWhen pip is present in your python installation, simply:\n```\npip install py2gmsh\n```\n\n## Usage\n\n### Creating a simple geo file\n\nThe following example shows how a simple geometry can created using a syntax\nclose to the one used in .geo files\n\n```python\nfrom py2gmsh import (Mesh, Entity, Field)\n\n# create Mesh class instance\nmy_mesh = Mesh()\n\n# create points\np1 = Entity.Point([0., 0., 0.])\n# add point to mesh\nmy_mesh.addEntity(p1)\n#create more points\np2 = Entity.Point([1., 0., 0.])\nmy_mesh.addEntity(p2)\np3 = Entity.Point([1., 1., 0.])\nmy_mesh.addEntity(p3)\n# entities can also directly be added to a mesh:\np4 = Entity.Point([0., 1., 0.], mesh=my_mesh)\n\n# create curves\nl1 = Entity.Curve([p1, p2])\nl2 = Entity.Curve([p2, p3])\nl3 = Entity.Curve([p3, p4])\nl4 = Entity.Curve([p4, p1])\n# entities can also be added in a batch\nmy_mesh.addEntities([l1, l2, l3, l4])\n\n# create curveloop\nll1 = Entity.CurveLoop([l1, l2, l3, l4], mesh=my_mesh)\n\n# create surface\ns1 = Entity.PlaneSurface([ll1], mesh=my_mesh)\n\n# create fields\nf1 = Field.MathEval(mesh=my_mesh)\ngrading = 1.1\nhe = 0.005\nf1.F = '(abs(y-0.5)*({grading}-1)+{he})/{grading}'.format(grading=grading,\n he=he)\n# create minimum field\nfmin = Field.Min(mesh=my_mesh)\nfmin.FieldsList = [f1] # could add more fields in the list if necessary\n\n# set the background field as minimum field\nmy_mesh.setBackgroundField(fmin)\n\n# set max element size\nmy_mesh.Options.Mesh.CharacteristicLengthMax = 0.1\n\n# adding Coherence option\nmy_mesh.Coherence = True\n\n# write the geofile\nmy_mesh.writeGeo('my_mesh.geo')\n```\n\nThe .geo file `my_mesh.geo` can be opened directly in the gmsh GUI for visualisation and meshing. Alternatively, running gmsh to create a .msh file gives the following result for my_mesh.msh:\n\n```\n>> gmsh my_mesh.geo -2 -o my_mesh.msh\n```\n

\n\n

\n\n(!) for Fields using NodesList, VerticesList, EdgesList, FacesList,\nRegionsList, or FieldsList, the lists must be a list of Entity instances, not\nof the entity numbers, e.g. `f2.NodesList = [p1, p2, p3]`. Fields using IField,\nFieldX, FieldY, FieldZ must also point to a field instance, not its number,\ne.g. `f2.IField = f1`.\n\n### Using Physical Groups\n\nPhysical groups are used to tag certain entities with a group number and name\n(optional)\n\n```python\n# creating physical groups and associating them with a mesh instance\ng1 = Entity.PhysicalGroup(nb=1, name='group1')\ng2 = Entity.PhysicalGroup(nb=2, name='group2')\nmy_mesh.addEntites([g1, g2])\n\n# adding existing entities to different physical groups\ng1.addEntity(p1)\ng1.addEntity(p2)\ng1.addEntity(l1)\ng1.addEntity(l2)\ng2.addEntities([p3, p4, l3, l4])\n\n# write the geofile after changes\nmesh.writeGeo('my_mesh.geo')\n```\n\n### Modifying general mesh options\n\nAll gmsh options (General, Geometry, Mesh) can be written with the same syntax as writing directly in a geofile.\nThe full list of options available is in py2gmsh/Options.py\n\n```python\n# mesh options\nmy_mesh.options.Mesh.Algorithm = ...\nmy_mesh.options.Mesh.Format = ...\n# general options\nmy_mesh.options.General.Color = ...\nmy_mesh.options.Geometry.OffsetX = ...\n# geometry options\nmy_mesh.options.Geometry.Tolerance = ...\n\n# write the geofile after changes\nmesh.writeGeo('my_mesh.geo')\n```\n\n### Accessing entities from mesh instance\n\nEntities can be retrieved from the Mesh instance through their indexes\n```python\nmy_mesh.points[4] # <-- returns Point instance number 4\nmy_mesh.getPointsFromIndex(4) # <-- same as above\nmy_mesh.getPointsFromIndex([1, 2, 3, 4]) # <-- returns list of Point instances\n# other functions\nmy_mesh.getCurvesFromIndex(...)\nmy_mesh.getSurfacesFromIndex(...)\nmy_mesh.getSurfaceLoopsFromIndex(...)\nmy_mesh.getVolumesFromIndex(...)\nmy_mesh.getFieldsFromIndex(...)\nmy_mesh.getGroupsFromIndex(...)\n```\n\nThis can be used to create other entities, such as:\n```python\nll1 = Entity.CurveLoop(my_mesh.getCurvesFromIndex([1,2,3,4]))\nmy_mesh.addEntity(ll1)\n```\n\n### Converting a geometry object to a Mesh instance\n\nCertain objects can be directly converted to a `py2gmsh.Mesh.Mesh` instance. This has been used to convert geometries using the syntax of https://github.com/erdc/proteus domains for example.\n\n```python\nfrom py2gmsh import geometry2gmsh\n\nmy_mesh = geometry2mesh(my_geometry)\n```\n\nThe geometry variable `my_geometry` must be an object (e.g. class) containing the following attributes:\n\n| entity | shape | opt | type |\n|--------------|----------------|-----|----------------------------------------------------|\n| vertices | (np, 3) | no | array of point coordinates |\n| vertexFlags | (np) | yes | array of point physical group numbers |\n| segments | (ns, 2) | yes | array of curves |\n| segmentFlags | (ns) | yes | array of segment physical group numbers |\n| facets | (nf, nsf, npf) | yes | array of surfaces (loop of point numbers) |\n| facetFlags | (nf) | yes | array of facets physical groups |\n| volumes | (nv, nsv, nfv) | yes | array of volumes (list of facets) |\n| regionFlags | (nv) | yes | array of volume physical group numbers |\n| boundaryTags | dict | yes | dictionary of physical groups {'name': number} |\n| holes_ind | (nh) | yes | list of holes index (facets in 2D / volumes in 3D) |\n\nnp: number of points;\nns: number of segments;\nnf: number of facets;\nnsf: number of subfacets;\nnpf: number of points per facet;\nnv: number of volumes;\nnsv: number of subvolumes;\nnfv: number of facets per volume;\nnh: number of holes\n\nopt: optional. Optional argument can be empty (e.g. empty list) but must be present in the geometry object.\n\n\n", "description_content_type": "text/markdown", "docs_url": null, "download_url": "https://github.com/tridelat/py2gmsh/tarball/v4.2.3.1", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/tridelat/py2gmsh", "keywords": "gmsh,wrapper,mesh,python,api", "license": "", "maintainer": "", "maintainer_email": "", "name": "py2gmsh", "package_url": "https://pypi.org/project/py2gmsh/", "platform": "", "project_url": "https://pypi.org/project/py2gmsh/", "project_urls": { "Download": "https://github.com/tridelat/py2gmsh/tarball/v4.2.3.1", "Homepage": "https://github.com/tridelat/py2gmsh" }, "release_url": "https://pypi.org/project/py2gmsh/4.2.3.1/", "requires_dist": null, "requires_python": "", "summary": "Python wrappers to gmsh files with object-oriented syntax", "version": "4.2.3.1" }, "last_serial": 5303428, "releases": { "0.1": [ { "comment_text": "", "digests": { "md5": "aaa6532719e30e58751c0d371bde58ce", "sha256": "3de80731eb13659e089334cca5dcd694b5dcda8ccb9cec7c56828b3f25108d93" }, "downloads": -1, "filename": "py2gmsh-0.1.tar.gz", "has_sig": false, "md5_digest": "aaa6532719e30e58751c0d371bde58ce", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7076, "upload_time": "2017-01-30T19:55:07", "url": "https://files.pythonhosted.org/packages/6a/eb/d8c61638a8fb6bcac0482f872fe5a3eeccac0ef56987427fb724fc65d68c/py2gmsh-0.1.tar.gz" } ], "0.1.1": [ { "comment_text": "", "digests": { "md5": "27dc42dadde2923af4c35b430712aefe", "sha256": "d9c9c14aa301183c07555805e846e313e1d3f77d38805618c27c7262ecab0dae" }, "downloads": -1, "filename": "py2gmsh-0.1.1.tar.gz", "has_sig": false, "md5_digest": "27dc42dadde2923af4c35b430712aefe", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7145, "upload_time": "2017-03-03T09:42:45", "url": "https://files.pythonhosted.org/packages/10/1f/99a75c47aa0b7f8de5394797c6a299031803ca75a74ab121dfbab73a3473/py2gmsh-0.1.1.tar.gz" } ], "0.1.2": [ { "comment_text": "", "digests": { "md5": "2f545f7d2449ce0cad001b5215d8517d", "sha256": "665f75cdc4c76974fa66663b3b3666ddf9532fff3dc6e67432154128600319d5" }, "downloads": -1, "filename": "py2gmsh-0.1.2.tar.gz", "has_sig": false, "md5_digest": "2f545f7d2449ce0cad001b5215d8517d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8136, "upload_time": "2017-06-07T10:05:56", "url": "https://files.pythonhosted.org/packages/bf/ef/5f51254c3c80a30a9b6c38abedfb1e66e94bd854625f928d02598533a3e8/py2gmsh-0.1.2.tar.gz" } ], "3.0.6.0": [ { "comment_text": "", "digests": { "md5": "d495efe653b0063bffb465e8d1d764f0", "sha256": "544407449a42f142452f9c6387b78741fc4ed6bdfbcea2c70c7b54c2056fa00f" }, "downloads": -1, "filename": "py2gmsh-3.0.6.0.tar.gz", "has_sig": false, "md5_digest": "d495efe653b0063bffb465e8d1d764f0", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 13933, "upload_time": "2018-09-06T10:32:12", "url": "https://files.pythonhosted.org/packages/e4/df/63e2647196a182549e4816c4007379f6cb927a12b3a4ca18a1df46e421c3/py2gmsh-3.0.6.0.tar.gz" } ], "3.0.6.1": [ { "comment_text": "", "digests": { "md5": "9527f0d3ad074df198d05a909cdcb5a2", "sha256": "7bc21bc07f3e9d29faf063e42d85633519cdfb372989d1c353f703849fa22aaf" }, "downloads": -1, "filename": "py2gmsh-3.0.6.1.tar.gz", "has_sig": false, "md5_digest": "9527f0d3ad074df198d05a909cdcb5a2", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 13932, "upload_time": "2018-09-06T10:48:16", "url": "https://files.pythonhosted.org/packages/18/f3/4af2c9e4cb452df33162fb35f3b34ce7e549027129ed303e116420938a54/py2gmsh-3.0.6.1.tar.gz" } ], "3.0.6.2": [ { "comment_text": "", "digests": { "md5": "b90c9ad602b3273939609d40d09a8846", "sha256": "a7fa7cf93803de327ed7bc380c6385dbef77a3f0700e2832adc0c4d824beef86" }, "downloads": -1, "filename": "py2gmsh-3.0.6.2-py3-none-any.whl", "has_sig": false, "md5_digest": "b90c9ad602b3273939609d40d09a8846", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 13076, "upload_time": "2018-10-08T14:54:06", "url": "https://files.pythonhosted.org/packages/54/cc/f9d1fa6745f7c1926ca20cbf511ddce556ecbf9bf201c84a756c13747549/py2gmsh-3.0.6.2-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "690d963cb8eaa5653007287109a4de54", "sha256": "2441a3789787c6e544dee55e368f3e4e3646b7b203ec912ad3368d3184d4c224" }, "downloads": -1, "filename": "py2gmsh-3.0.6.2.tar.gz", "has_sig": false, "md5_digest": "690d963cb8eaa5653007287109a4de54", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 13940, "upload_time": "2018-10-08T14:54:07", "url": "https://files.pythonhosted.org/packages/a3/7c/aa295bef95e42cf81bb75c22d16cdab149ef967a47de954aa0219cfadb71/py2gmsh-3.0.6.2.tar.gz" } ], "3.0.6.3": [ { "comment_text": "", "digests": { "md5": "e596f556ab5902692355a2b21692b0d4", "sha256": "c76e30b693114c74388713c1fbf2d6e28c2603bb4ff471f0a549d55f5994dd8c" }, "downloads": -1, "filename": "py2gmsh-3.0.6.3-py3-none-any.whl", "has_sig": false, "md5_digest": "e596f556ab5902692355a2b21692b0d4", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 12244, "upload_time": "2019-04-10T22:15:41", "url": "https://files.pythonhosted.org/packages/c8/27/f30ee12b211569fcd9fb31324e4174e9767573515b94583e69e71466b672/py2gmsh-3.0.6.3-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "0c553bcdd090d90a2ed0dd1f449c42ca", "sha256": "c23951cc7e5dfc8496e4076b0698902438131c88cdb846511bfebf11f5de042c" }, "downloads": -1, "filename": "py2gmsh-3.0.6.3.tar.gz", "has_sig": false, "md5_digest": "0c553bcdd090d90a2ed0dd1f449c42ca", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 13926, "upload_time": "2019-04-10T22:15:42", "url": "https://files.pythonhosted.org/packages/09/67/c9e23d025c9a62c530f9cee4f45f5ef3b3fe44ae57bc3d4c9cdbb775b642/py2gmsh-3.0.6.3.tar.gz" } ], "4.2.3.0": [ { "comment_text": "", "digests": { "md5": "316f78b7aa42e9d10a82c7ded2db4ead", "sha256": "cb569cc43db2cb051bb28be9ad61eac1793deb741c1b70ded923f4750d29d9c1" }, "downloads": -1, "filename": "py2gmsh-4.2.3.0-py3-none-any.whl", "has_sig": false, "md5_digest": "316f78b7aa42e9d10a82c7ded2db4ead", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 12315, "upload_time": "2019-04-14T18:51:05", "url": "https://files.pythonhosted.org/packages/da/28/ad8bea2e8bc27e38c91a656655d636b0ddb30c9d79a3d29c0f7d4678d414/py2gmsh-4.2.3.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "1fbb914420d0c35217ee1a52dafc898b", "sha256": "f19dc1e281d000fdd4cd94ecb9f88b1a6323fc0234a4a14c135da0c1ef05f43c" }, "downloads": -1, "filename": "py2gmsh-4.2.3.0.tar.gz", "has_sig": false, "md5_digest": "1fbb914420d0c35217ee1a52dafc898b", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 14033, "upload_time": "2019-04-14T18:51:06", "url": "https://files.pythonhosted.org/packages/53/10/1eb102db2e836847a15794764f642c261ebde9a0f2bff896c6f3e8635148/py2gmsh-4.2.3.0.tar.gz" } ], "4.2.3.1": [ { "comment_text": "", "digests": { "md5": "341f420f1549345e5e7f20706d56b749", "sha256": "711348dd483712a9037c61fb93d4abf5cf0b7d7ed8f5929856ff7f42391c86d5" }, "downloads": -1, "filename": "py2gmsh-4.2.3.1-py3-none-any.whl", "has_sig": false, "md5_digest": "341f420f1549345e5e7f20706d56b749", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 12315, "upload_time": "2019-05-22T16:10:03", "url": "https://files.pythonhosted.org/packages/7d/21/b8c74b9ec9db3cbb6da908d85bf74c5af08ee9296f56bfc72f538adfd9a4/py2gmsh-4.2.3.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "dec672baef00bab5ab0000dc0fa18e69", "sha256": "a8e48419027f4477e8b0ed5cd0690bc0b286375b52163d7d3b34d3b8672ac83f" }, "downloads": -1, "filename": "py2gmsh-4.2.3.1.tar.gz", "has_sig": false, "md5_digest": "dec672baef00bab5ab0000dc0fa18e69", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 14001, "upload_time": "2019-05-22T16:10:05", "url": "https://files.pythonhosted.org/packages/41/b2/4b193ad78f78f6c6f37af160c7757b17c6dabb210227b5793b5a7f75154e/py2gmsh-4.2.3.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "341f420f1549345e5e7f20706d56b749", "sha256": "711348dd483712a9037c61fb93d4abf5cf0b7d7ed8f5929856ff7f42391c86d5" }, "downloads": -1, "filename": "py2gmsh-4.2.3.1-py3-none-any.whl", "has_sig": false, "md5_digest": "341f420f1549345e5e7f20706d56b749", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 12315, "upload_time": "2019-05-22T16:10:03", "url": "https://files.pythonhosted.org/packages/7d/21/b8c74b9ec9db3cbb6da908d85bf74c5af08ee9296f56bfc72f538adfd9a4/py2gmsh-4.2.3.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "dec672baef00bab5ab0000dc0fa18e69", "sha256": "a8e48419027f4477e8b0ed5cd0690bc0b286375b52163d7d3b34d3b8672ac83f" }, "downloads": -1, "filename": "py2gmsh-4.2.3.1.tar.gz", "has_sig": false, "md5_digest": "dec672baef00bab5ab0000dc0fa18e69", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 14001, "upload_time": "2019-05-22T16:10:05", "url": "https://files.pythonhosted.org/packages/41/b2/4b193ad78f78f6c6f37af160c7757b17c6dabb210227b5793b5a7f75154e/py2gmsh-4.2.3.1.tar.gz" } ] }