This module contains the definitions of meshes and
routines for mesh management. The meshes allowed in FEMLISP are more
general than those of most other software for solving PDEs. In FEMLISP,
both mesh, domain and problem definitions are defined over an underlying
abstraction, the so-called
captures the mathematical idea of a "cell complex" which builds a
topological space by mapping from standard cells
<cell>. Now, a
<skeleton> can be seen as mapping the cells of such a cell complex
to arbitrary values. Then, a
<domain> is a
where each cell (which we call "patch" in this case) is mapped to
geometric properties, and a
<mesh> is a
each cell is mapped to the patch to which it belongs.
The basic entities are the class
<cell>, the subclass
<simplex> which in turn contains subclasses for arbitrarily
dimensional simplices generated on demand, and the subclass
<product-cell> containing arbitrary products of simplices, e.g. square
Meshes can be refined either uniformly or locally using the Freudenthal algorithm as presented in JBey_2000a and generalized to product elements. When local refinement is used, hanging nodes may occur. In contrast to most other finite element software, in FEMLISP the difference of refinement levels of adjacent cells may be arbitrarily large. Up to now, anisotropic refinement of product cells has not yet been implemented.
The reference vertex.
This cell is only fuzzily defined. Its use is mostly
for defining domains by their boundary. The slot
midpoint can be
useful for the graphical output of the cell, the slot
a list of points lying inside holes. This is intended as help for
The basic cell class.
<domain> is a special
call its cells patches, and the properties of a patch carries
geometric information. Properties supported up to now are:
IDENTIFIED: list of identified patches
METRIC: metric tensor function
VOLUME: volume function
Metric and volume should be functions depending on keyword arguments like
:GLOBAL and allowing arbitrary other keys.
Superclasses: <SKELETON> PROPERTY-MIXIN
Hierarchical-meshes are those meshes which will be used most often, because they remember the refinement history and therefore allow for refinement and coarsening. The slot levels is an array of skeletons containing the cells for different levels.
A mixin which distinguishes cells which are mapped by a special mapping.
A <mesh> is a special <skeleton> mapping cells to property lists with properties of the cell. The most important property of a cell is its patch in the domain. Another one could be a list of possibly identified cells. The slot parametric determines which kind of cell mappings are used for approximating the domain. These can be the nonlinear mappings used in the domain definition, but also arbitrary approximations, to those mappings, e.g. isoparametric mappings. The special value NIL means that multilinear mappings are used for all cells outside the boundaries.
A mixin for simplex-product cells.
A mixin for simplicial cells.
A skeleton is a vector of hash-tables containing the cells of a certain dimension as keys. The information stored in the values is different depending on the subclass derived from skeleton.
The vertex class.
Returns an identification list for the boundaries of the cells in identifications.
Generates a box domain for the given dimensions. Here, dimensions is expected to be a list of 2-element lists denoting the interval along the respective axis. The algorithm works by copying the unit cube and modifying the coordinates of the vertices of the copy.
Computes the cartesian product of two skeletons.
Transforms a product-cell into a degenerated cube with the same vertices.
Returns cell’s identification in skel or NIL.
Return the mapping for mapped cells.
Returns the cells of skel of dimension dim in form of a list.
Returns the cells of skel of highest dimension in form of a list.
Checks the data structure of obj.
Reduces identifications to maximally connected sets.
Returns a function which compares two vectors lexicographically.
Copies a mesh. Properties copied are only patch and identification. If necessary, one might add further properties to be copied as a keyword argument.
Copies a skeleton. Properties is a list of properties to be copied.
Returns a list of corners of the cell, i.e. the global positions of the cell’s vertices.
Makes domain-cube —which should be a cube in a domain— extensible in the given direction.
Returns T iff CELL is a cube.
Returns the diameter of a cell.
Returns the dimension of the cell.
Parts of a skeleton can be named with the property
The boundary of the domain as a skeleton.
Returns a property list of characteristics. The property curved means that curved patches exist. The property exact is set to t if the domain mappings are exact. Otherwise, only the boundary of the domain should be assumed to be provided in an exact form.
Loop through a skeleton. If looping-var is an atom, it loops through all cells, otherwise it loops through cells and properties.
Dimension of the embedding space for object. If check is T, a test is performed if the dimension is well-defined for all parts of object. If not, NIL is returned.
If domain is an integer, return the corresponding n-cube-domain, if domain is a domain return it unchanged, otherwise signal an error.
Returns the reference product-cell for the given factor dimensions.
A table for cells of dimension dim in skel.
Extends a mesh on all extensible cells for which test —if provided— yields T.
Returns the factor-simplices.
Finds a cell from skel which contains the global position pos.
Returns a list of cells contained in skel and satisfying test.
Searches for a patch of domain having the given list classifiers.
Calls func for each cell on the hierarchical-mesh surface.
Computes the local position inside the cell for the given global position.
This function is not really used at the moment, in contrast to
Returns the value of the property.
Finds the refinement rule for cell defined by the id. This id can be a number (position of the rule, T (meaning 0), or some symbol which is contained in the names of some rule. Two values are returned: the rule and its position in the refinement-rule vector.
This computes a local coordinate which solves the Ausgleichsproblem of mapping to a point as near as possible to global-pos. It involves more computational work than global->local. As a second value, the distance to global-pos is returned.
Mainly useful for finite element evaluation: from the local position, the value of a fe function can be obtained by interpolation. This is done by a Newton iteration, which converges in one step for linear mappings. The result is NIL, if no local point could be determined.
Sorts the cells up to the given level (defaulting to the last level) hierarchically for use in something similar to the nested disection method. Returns a list of the sorted cells.
Returns a list of cells in skel which are identified with cell.
Returns cell’s identification in skel or NIL.
Identifies all cells in identified-cells within skel.
This routines identifies boundary cells in skel which correspond to boundary cells in the unit cube. Warning: exact arithmetic is used to recognize identified cells. This should work for skeletons derived from the unit cell, but may create problems in other situations.
Returns the children of refcell.
Inserts cell and if necessary also its boundary into skel. If properties are given those are used for cell.
Creates a cell of type cell-class with corners given by corners. corners->cell has to be an equalp hash-table mapping corners to the corresponding cell. It is updated by this function.
Inserts a list of cells into a skeleton.
Checks if global-pos is inside the interior of the
cell. It calls
global->local to obtain local coordinates
coordinates-inside? to check if those are inside the
cell. If threshold is a non-negative number, an additional check is
performed, if the local coordinates map to global-pos with accuracy
Generates all identifications of the skeleton from the identifications of some higher-dimensional cells.
Checks if key1 occurs as subcell of key2. The keys can be either cells or identifications.
Creates an L-domain by cutting out cubes from the uniform refinement of the unit cube.
Computes the gradient for a multilinear interpolation from the vertices.
Computes the global position by interpolation from the vertices.
Returns the level of cell in the hirearchical mesh h-mesh.
Transforms skel by transforming the vertex positions.
local->Dglobal checks if a mapping is given for the cell. If yes, then the gradient of this mapping is evaluated (if available). If no, then the function l2Dg is called which gives the gradient for a multilinear interpolation from the cell’s corners.
local->global checks if a mapping is given for the cell. If yes, then this mapping is evaluated. If no, then the function l2g is called which should do a multilinear interpolation from the cell’s corners.
Returns the local coordinates of the cell midpoint.
Creates a cell of class CELL-CLASS having the given CORNERS.
Creates a cell of class CELL-CLASS having the given VERTICES.
Returns a classifier for patches.
Changes a skeleton into a domain.
Creates a hierarchical-mesh from the given arguments. See
Construct a hierarchical-mesh from a domain.
Creates a line given its endpoints.
Makes a mesh from or for the given object.
Short form of creating a simplex given its boundary. An alternative is creating it from its vertices, see the functions MAKE-CELL-FROM-VERTICES and INSERT-CELL-FROM-CORNERS.
General vertex constructor.
Constructs a cell class with <mapped-cell> mixin.
Marks all cells of skel with the given prop/value pair.
Returns T if cell is in skel, NIL otherwise.
Computes a meshsize. Please refer to the method documentations for the exact definition.
Returns cell midpoint in global coordinates.
Applies LOCAL->DGLOBAL for several positions at once.
Applies LOCAL->GLOBAL for several positions at once.
Generates an n-dimensional ball domain with 2^n simplex patches.
Generates an n-dimensional cell domain which is a n-dimensional unit cube with its opposite sides identified.
Returns the reference cube of dimension dim.
Returns the reference simplex of the given dimension.
Returns number of cells in a skeleton.
Returns the number of boundary faces.
Returns the number of subcells.
Returns the number of vertices.
Returns cell origin in global coordinates.
Returns a list of classifications for patch in domain.
Returns the children for refcell and subcells.
Returns an LEVEL times refined skeleton of REFCELL. It is partially memoized, see the documentation of *REFCELL-REFINEMENT-MEMOIZE-DEPTH*.
Returns the cell’s or cell-classes reference-cell.
Tests if a cell is a reference cell.
Refines skel either locally or globally depending
Returns refinement information for the cell.
Returns the refinement of cell in skeleton as two values: the rule and the children.
Returns the refined boundary subcells of unrefined cells in a skeleton. Those cells are found as all refined cells which are not part of the domain boundary. At the moment, this is a global operation. Later on, it should probably be localized.
Returns the refinement rule of cell in skel.
Rule for refining reference cells. Those rules are stored in the refine-info slot of the cell class.
Returns a representative for this object.
Shifts skel by vec. vec has to be a vector of dimension (embedded-dimension skel).
Returns the n-simplex class.
Generates a product-cell domain for the given factor dimensions.
Adds skel-2 to skel-1 destructively for skel-1. Overlaying cells are identified. override is a list of properties which are copied from skel-2 on the overlap. active-skel-1 is used for hierarchical-meshes for selecting a level to which skel-2 is added. This function returns three values: the first is skel-1, the second is skel-2, the third is a hash-table mapping overlapping cells from skel-2 to their counterpart in skel-1.
Loops through a skeleton applying func. When direction is :down then loops with dimension of the cells decreasing, otherwise increasing.
Maps a skeleton with func to another skeleton having the same keys and mapped values. May be configured later on.
Returns the properties of cell in skel.
Returns a skeleton for the given cell or the given cells.
Returns a skeleton consisting of cells of skel of dimension n-1 which have only one neighbor.
Builds a disjoint union skeleton of all skeletons.
Removes a cell from a skeleton such that the rest remains a skeleton. Warning: does not handle identifications yet.
Sorts a cell list lexicographically by the coordinates of their midpoint.
Creates a uniform mesh consisting of N_1 x ... x N_dim cells on a box domain.
Extension function replacing an original-cell with a replacement.
Create a uniform box skeleton consisting of N_1 x ... x N_dim cubes of dimensions h_1 x ... x h_dim.
Returns a vector of all children of the subcells of cell in skeleton.
Returns a vector containing all subcells of a given cell. The code is
special to each class and often automatically generated by
Returns a minimal skeleton containing the cells satisfying the test.
This function returns the surface cells of a locally refined hierarchical-mesh structure.
This function returns the surface cells of highest dimension of a locally refined hierarchical-mesh structure.
Test if condition holds for classifications. condition should be a logical combination of the keyword symbols in the list classification.
Top-level of a mesh hierarchy.
Transforms skel by transforming the cell mappings resp. vertex positions.
Triangulate domain by successively building a mesh on the domain skeleton starting from the 0-dimensional patches.
Transforms a product-cell mesh into a simplex mesh.
Creates a uniform mesh consisting of N_1 x ... x N_dim cells on a box domain.
Generates a mesh by refining the domain partition uniformly.
Returns a list of all vertices of the cell.