   # Cell Filters

A weak PDE problem is stated in terms of integrals over subsets of a geometric domain. Typically, there will be an integral over the interior plus surface terms for the boundary conditions. In other cases such as fluid-structure interactions we may apply different weak equations on distinct maximal-dimension subsets of the entire domain. There may be point forces applied, or in the case of inverse problems, measurements taken at some subset of points. In contact problems, the subdomains on which constraints are to be applied will be determined as part of the solution. It is thus necessary to have a very flexible system for specification of geometric regions.

Any specification of a domain of integration must be able to identify on a mesh the set of cells on which a particular integration is to be done. In general, then, a specification of a subregion is a specification of a filter that can extract from a mesh the subset of cells which satisfies some condition, i.e., those cells that "pass through" the filter. The Sundance CellFilter object does this job, acting on a Mesh to produce a set of cells. Internally, a set of cells will be represented in a number of ways depending on the properties of the set; the important thing to understand is that the interface to a cell set is an abstract iterator. Thus a CellFilter is utlimately an operator, acting on a Mesh, which produces an iterator that can sequence through those cells that pass through the filter. Looping over cells in system assembly is done using iterators returned by CellFilter operations.

## CellFilter Derived Classes

• MaximalCellFilter passes all cells of maximal dimension.
• BoundaryCellFilter passes all cells of dimension on the boundary. The boundary cells can be identified topologically as those cells of dimension having only one cofacet.
• DimensionalCellFilter passes all cells of a specified dimension.

## CellFilter Operations

Once we have a CellFilter, we can produce new CellFilters by performing certain operations on it.

### Finding subsets

The CellFilter::subset() and CellFilter::labeledSubset() operators produce new CellFilters that pick out a subset of the cells satisfying an additional condition given in the argument to the subset methods.

The subset() method of CellFilter takes as an argument a CellPredicate object. A CellPredicate is an operator that acts on a cell and returns a boolean variable. It is described further in the section on CellFilter Predicates below.

The labeledSubset() method of CellFilter takes as an argument an integer. Each cell in a Mesh has an optional integer label field, and labeledSubset() identifies those cells having a given label. Most mesh generation programs have the ability to associate labels with regions of a solid model. In practice, identifying regions by label is the most common method of filtering cells.

### Binary operations

Binary operations between filters can also produce new filters. Suppose a and b are CellFilters whose getCells() methods produce CellSets and , respectively. There exist operators for the following binary operations:
• The union operator a+b. The result of a union operation is a filter that will produce the union of the two operand's cell sets, i.e., all cells that are in either or • The intersection operator a.intersection(b) The result of an intersection operation is a filter that will produce the intersection of the two operand's cell sets, i.e., all cells that are in both and • The exclusion operator a-b. The result of an exclusion operation is a filter that will produce the exclusion (or set difference) of the two operand's cell sets, i.e., all cells that are in but not in CellFilter elements = new MaximalCellFilter();
CellFilter leftHalf = elements.subset( x <= 0.0 );
CellFilter topHalf = elements.subset( x >= 0.0 );
CellFilter topLeftQuarter = leftHalf.intersection(topHalf);
CellFilter


## CellFilter Predicates

• Position-based predicates
• Label-based predicates
• User-defined predicates