Package hedge :: Module mesh
[hide private]
[frames] | no frames]

Module mesh

source code

Mesh topology representation.


Copyright: Copyright (C) 2007 Andreas Kloeckner

License: This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see U{http://www.gnu.org/licenses/}.

Classes [hide private]
  TAG_NONE
A boundary or volume tag representing an empty boundary or volume.
  TAG_ALL
A boundary or volume tag representing the entire boundary or volume.
  TAG_REALLY_ALL
A boundary tag representing the entire boundary.
  TAG_NO_BOUNDARY
A boundary tag indicating that this edge should not fall under TAG_ALL.
  TAG_RANK_BOUNDARY
A boundary tag indicating the boundary with a neighboring rank.
  Element
  SimplicialElement
  Interval
  Triangle
  Tetrahedron
  Mesh
Information about the geometry and connectivity of a finite element mesh.
  ConformalMesh
A mesh whose elements' faces exactly match up with one another.
  MeshPyFaceMarkerLookup
Functions [hide private]
 
make_element(class_, id, vertex_indices, all_vertices) source code
 
_build_mesh_data_dict(points, elements, boundary_tagger, periodicity, is_rankbdry_face) source code
 
make_conformal_mesh(points, elements, boundary_tagger=<function <lambda> at 0x9196a04>, element_tagger=<function <lambda> at 0x9196a3c>, periodicity=None, _is_rankbdry_face=<function <lambda> at 0x9196a74>)
Construct a simplical mesh.
source code
 
check_bc_coverage(mesh, bc_tags, incomplete_ok=False)
Verify boundary condition coverage.
source code
 
make_1d_mesh(points, left_tag=None, right_tag=None, periodic=False, boundary_tagger=None, element_tagger=None) source code
 
make_uniform_1d_mesh(a, b, el_count, left_tag=None, right_tag=None, periodic=False, boundary_tagger=None) source code
 
make_single_element_mesh(a=-0.5, b=0.5, boundary_tagger=<function <lambda> at 0x9196cdc>) source code
 
make_regular_rect_mesh(a=(0, 0), b=(1, 1), n=(5, 5), periodicity=None, boundary_tagger=<function <lambda> at 0x9196d4c>)
Create a semi-structured rectangular mesh.
source code
 
make_centered_regular_rect_mesh(a=(0, 0), b=(1, 1), n=(5, 5), periodicity=None, post_refine_factor=1, boundary_tagger=<function <lambda> at 0x9196dbc>)
Create a semi-structured rectangular mesh.
source code
 
make_regular_square_mesh(a=-0.5, b=0.5, n=5, periodicity=None, boundary_tagger=<function <lambda> at 0x9196e2c>)
Create a semi-structured square mesh.
source code
 
finish_2d_rect_mesh(points, facets, facet_markers, marker2tag, refine_func, periodicity, boundary_tagger)
Semi-internal bottom-half routine for generation of rectangular 2D meshes.
source code
 
_round_trip_connect(start, end) source code
 
make_rect_mesh(a=(0, 0), b=(1, 1), max_area=None, boundary_tagger=<function <lambda> at 0x9196f0c>, periodicity=None, subdivisions=None, refine_func=None)
Create an unstructured rectangular mesh.
source code
 
make_rect_mesh_with_corner(a=(0, 0), b=(1, 1), max_area=None, boundary_tagger=<function <lambda> at 0x9196fb4>, corner_fraction=(0.3, 0.3), refine_func=None)
Create an unstructured rectangular mesh with a reentrant corner at (-x, -y).
source code
 
make_square_mesh(a=-0.5, b=0.5, max_area=0.004, boundary_tagger=<function <lambda> at 0x9197064>)
Create an unstructured square mesh.
source code
 
make_disk_mesh(r=0.5, faces=50, max_area=0.004, boundary_tagger=<function <lambda> at 0x91970d4>) source code
 
make_ball_mesh(r=0.5, subdivisions=10, max_volume=None, boundary_tagger=<function <lambda> at 0x9197144>) source code
 
_make_z_periodic_mesh(points, facets, facet_holestarts, facet_markers, height, max_volume, boundary_tagger) source code
 
make_cylinder_mesh(radius=0.5, height=1, radial_subdivisions=10, height_subdivisions=1, max_volume=None, periodic=False, boundary_tagger=<function <lambda> at 0x91971ec>) source code
 
make_box_mesh(a=(0, 0, 0), b=(1, 1, 1), max_volume=None, periodicity=None, boundary_tagger=<function <lambda> at 0x9197294>, return_meshpy_mesh=False)
Return a mesh for a brick from the origin to `dimensions'.
source code
Function Details [hide private]

make_conformal_mesh(points, elements, boundary_tagger=<function <lambda> at 0x9196a04>, element_tagger=<function <lambda> at 0x9196a3c>, periodicity=None, _is_rankbdry_face=<function <lambda> at 0x9196a74>)

source code 

Construct a simplical mesh.

Face indices follow the convention for the respective element, such as Triangle or Tetrahedron, in this module.

Parameters:
  • points - an iterable of vertex coordinates, given as vectors.
  • elements - an iterable of tuples of indices into points, giving element endpoints.
  • boundary_tagger - a function that takes the arguments (set_of_face_vertex_indices, element, face_number, all_vertices) It returns a list of tags that apply to this surface.
  • element_tagger - a function that takes the arguments (element, all_vertices) and returns the a list of tags that apply to that element.
  • periodicity - either None or is a list of tuples just like the one documented for the periodicity member of class Mesh.
  • _is_rankbdry_face - an implementation detail, should not be used from user code. It is a function returning whether a given face identified by (element instance, face_nr) is cut by a parallel mesh partition.

check_bc_coverage(mesh, bc_tags, incomplete_ok=False)

source code 

Verify boundary condition coverage.

Given a list of boundary tags as bc_tags, this function verifies that

  1. the union of all these boundaries gives the complete boundary,
  2. all these boundaries are disjoint.
Parameters:
  • incomplete_ok - Do not report an error if some faces are not covered by the boundary conditions.

make_regular_rect_mesh(a=(0, 0), b=(1, 1), n=(5, 5), periodicity=None, boundary_tagger=<function <lambda> at 0x9196d4c>)

source code 

Create a semi-structured rectangular mesh.

Parameters:
  • a - the lower left hand point of the rectangle
  • b - the upper right hand point of the rectangle
  • n - a tuple of integers indicating the total number of points on [a,b].
  • periodicity - either None, or a tuple of bools specifying whether the mesh is to be periodic in x and y.

make_centered_regular_rect_mesh(a=(0, 0), b=(1, 1), n=(5, 5), periodicity=None, post_refine_factor=1, boundary_tagger=<function <lambda> at 0x9196dbc>)

source code 

Create a semi-structured rectangular mesh.

Parameters:
  • a - the lower left hand point of the rectangle
  • b - the upper right hand point of the rectangle
  • n - a tuple of integers indicating the total number of points on [a,b].
  • periodicity - either None, or a tuple of bools specifying whether the mesh is to be periodic in x and y.

make_regular_square_mesh(a=-0.5, b=0.5, n=5, periodicity=None, boundary_tagger=<function <lambda> at 0x9196e2c>)

source code 

Create a semi-structured square mesh.

Parameters:
  • a - the lower x and y coordinate of the square
  • b - the upper x and y coordinate of the square
  • n - integer indicating the total number of points on [a,b].
  • periodicity - either None, or a tuple of bools specifying whether the mesh is to be periodic in x and y.

make_rect_mesh(a=(0, 0), b=(1, 1), max_area=None, boundary_tagger=<function <lambda> at 0x9196f0c>, periodicity=None, subdivisions=None, refine_func=None)

source code 

Create an unstructured rectangular mesh.

Parameters:
  • a - the lower left hand point of the rectangle
  • b - the upper right hand point of the rectangle
  • max_area - maximum area of each triangle.
  • periodicity - either None, or a tuple of bools specifying whether the mesh is to be periodic in x and y.
  • subdivisions - If not None, this is a 2-tuple specifying the number of facet subdivisions in X and Y.
  • refine_func - A refinement function as taken by meshpy.triangle.build.

make_rect_mesh_with_corner(a=(0, 0), b=(1, 1), max_area=None, boundary_tagger=<function <lambda> at 0x9196fb4>, corner_fraction=(0.3, 0.3), refine_func=None)

source code 

Create an unstructured rectangular mesh with a reentrant corner at (-x, -y).

Parameters:
  • a - the lower left hand point of the rectangle
  • b - the upper right hand point of the rectangle
  • max_area - maximum area of each triangle.
  • refine_func - A refinement function as taken by meshpy.triangle.build.
  • corner_fraction - Tuple of fraction of the width taken up by the rentrant corner.

make_square_mesh(a=-0.5, b=0.5, max_area=0.004, boundary_tagger=<function <lambda> at 0x9197064>)

source code 

Create an unstructured square mesh.

Parameters:
  • a - the lower x and y coordinate of the square
  • b - the upper x and y coordinate of the square
  • max_area - maximum area of each triangle

make_box_mesh(a=(0, 0, 0), b=(1, 1, 1), max_volume=None, periodicity=None, boundary_tagger=<function <lambda> at 0x9197294>, return_meshpy_mesh=False)

source code 

Return a mesh for a brick from the origin to `dimensions'.

`max_volume' specifies the maximum volume for each tetrahedron. `periodicity' is either None, or a triple of bools, indicating whether periodic BCs are to be applied along that axis. See ConformalMesh.__init__ for the meaning of boundary_tagger.

A few stock boundary tags are provided for easy application of boundary conditions, namely plus_[xyz] and minus_[xyz] tag the appropriate faces of the brick.