{ "cells": [ { "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ "# Topological transformations" ] }, { "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ "The library supports utilities to perform topological transformations. The functions can be found in the namespace `sigmaepsilon.mesh.utils.topology.tr`." ] }, { "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ "Create a grid of VTK compliant bilinear quadrilaterals (Q4):" ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "from sigmaepsilon.mesh.grid import grid\n", "\n", "gridparams = {\n", " \"size\": (1200, 600),\n", " \"shape\": (30, 15),\n", " \"eshape\": (2, 2),\n", " \"path\": [0, 2, 3, 1]\n", "}\n", "coords, topo = grid(**gridparams)" ] }, { "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ "Transform the topology of the resulting mesh to 6-noded triangles:" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [], "source": [ "from sigmaepsilon.mesh.utils.topology.tr import Q4_to_Q9, Q9_to_T6\n", "\n", "coords, topo = Q9_to_T6(*Q4_to_Q9(coords, topo))" ] }, { "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ "To get the full list of transformation functions:" ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "['transform_topology',\n", " 'compose_trmap',\n", " 'L2_to_L3',\n", " 'T3_to_T6',\n", " 'T3_to_L2',\n", " 'T6_to_T3',\n", " 'Q4_to_Q8',\n", " 'Q4_to_Q9',\n", " 'Q9_to_Q4',\n", " 'Q8_to_T3',\n", " 'Q9_to_T6',\n", " 'Q4_to_T3',\n", " 'H8_to_L2',\n", " 'H8_to_Q4',\n", " 'H8_to_H27',\n", " 'H8_to_TET4',\n", " 'H27_to_H8',\n", " 'H27_to_TET10',\n", " 'TET4_to_L2',\n", " 'TET4_to_TET10',\n", " 'W6_to_W18',\n", " 'W6_to_TET4',\n", " 'W18_to_W6']" ] }, "execution_count": 3, "metadata": {}, "output_type": "execute_result" } ], "source": [ "import sigmaepsilon.mesh.utils.topology.tr as topo_tr\n", "\n", "topo_tr.__all__" ] } ], "metadata": { "kernelspec": { "display_name": ".sigmaepsilon.mesh", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.8.10" }, "orig_nbformat": 4 }, "nbformat": 4, "nbformat_minor": 2 }