Selections
This section contains information about the selection methods that are available for handling selections on the finalized geometry.
Syntax
This  section describes the general syntax for selections on the finalized geometry. For selections in the geometry sequence, see Geometry Object Selection Methods under model.geom()and Selections under Editing a Geometry Feature. Many objects use selections, but most of them only support a subset of the assignment methods described here. The methods supported by the named selections in model.selection() are listed in model.selection(). Other objects that use a selection support the methods relevant for the type of feature they represent. For example, a physics boundary condition feature requires a boundary selection. Therefore is does not support selection.global(), which makes the selection global, or selection.allGeom(), which makes the selection apply to the whole geometry at all levels. Using an unsupported assignment method results in an error.
There can also be a filtering of the entities assigned to a selection. Again, take a physics boundary condition as an example. Some boundary conditions only apply to the boundaries exterior to the domains where the physics interface is active, other boundary conditions only to boundaries interior to where the physics interface is active, and so on. Therefore selection.entities(dim) can sometimes return less entities than have been assigned using selection.set(<entlist>). On the other hand selection.inputEntities() always returns all entities used in the assignment selection.set(<entlist>). selection.inputEntities() returns the domains used as input to the selection. If the selection is of the type interior, exterior, or meshinterior, this method returns the unfiltered list of domains at the higher dimension that are used as the input. If the selection is not a selection of domains at a certain level, or the selection is not of the types Explicit or FromGeom (derived from a geometry feature), this method returns null.
Some selections only allow a single geometric entity, a single domain, a single boundary, edge, or point. Such selections are called single selections. Single selections cannot be defined by another selection and therefore do not support selection.named(<stag>).
selection.global() sets the selection to be the global selection.
selection.geom(<gtag>) sets the selection to be all domains in the geometry <gtag>.
selection.geom(<gtag>,dim) specifies that subsequent calls to all, set, add, and remove refer to domains at the dimension dim on the geometry <gtag>. If there is only one possible geometry, using selection.geom(dim) is equivalent. Also, if there is only one allowed dimension dim, then all, set and remove can be used directly as it is then unambiguous to which geometry and dimension their arguments apply to.
selection.geom(<gtag>,highdim,lowdim,typelist) specifies that subsequent calls to all, set, add, and remove refer to domains of dimension highdim on the geometry <gtag>. The domains that are obtained are those that are both of dimension lowdim and of any of the types listed in <typelist>. It is required that highdim > lowdim. The available types are:
exterior: All domains of dimension lowdim that lie on the exterior of the domains at dimension highdim.
interior: All domains of dimension lowdim that lie in the interior of the domains at dimension highdim.
meshinterior: All mesh boundaries of dimension lowdim that lie in the interior of the domains at dimension highdim.
selection.allGeom() sets the selection to a whole geometry. Can be used instead of selection.geom(<gtag>) when the geometry tag is unambiguous.
selection.geom(dim) specifies that subsequent calls to all, set, add, and remove refer to domains at the dimension dim. Can be used instead of selection.geom(<gtag>,dim) when the geometry tag is unambiguous.
selection.all() sets the selection to use all geometric entities in the geometry at the dimension where the selection applies.
selection.set(<entlist>) sets the selection to use the geometric entities in <entlist>. Note that the list of domain numbers is always sorted in ascending order and duplicates are removed before storing the numbers in the selection object.
selection.add(<entlist>) adds the geometric entities in <entlist> in the geometry to the set of geometric entities that the selection uses to obtain the selection. The list can be vectorized, as the following example shows:
selection.add(new String[]{"arr1(2,1,1)", "arr1(3,1,1)"}, new int[][]{{1, 2, 3, 4, 5, 6}, {1, 2, 3, 4});
In the Java history, such a vectorized method is replaced by the following code if there are at most 5 objects, to improve readability:
selection.add("arr1(2,1,1)", new int[]{1, 2, 3, 4, 5, 6});
selection.add("arr1(3,1,1)", new int[]{1, 2, 3, 4});
selection.remove(<entlist>) removes the geometric entities in <entlist> in the geometry from the set of geometric entities that the selection uses.
selection.inherit(boolean) indicates whether the selection should include all geometric entities that are specified by any of the other methods and all geometric entities at lower dimensions that are adjacent to the ones already specified.
selection.named(<stag>) specifies that the selection is defined by the selection model.selection(<stag>).
selection.isGlobal() returns true if the selection is global.
selection.isGeom() returns true if the selection is a whole geometry.
selection.geom() returns the geometry tag of the selection as a string. If the selection is global, null is returned.
selection.dimension() returns the dimensions on a geometry where the selection applies as an integer array.
selection.entities(dim) returns the geometric entities of the selection on the given geometry at the given dimension as an integer array.
selection.interiorEntities(dim) returns the interior mesh domains as an integer array.
selection.isInheriting() returns true if the selection is inherited to lower dimension levels.
selection.inputDimension() returns the dimension of the domains used as input to the selection.
selection.inputEntities() returns the entities used as input to the selection.
If the selection is defined by another selection, selection.named() returns the tag of that selection. Otherwise selection.named() returns an empty string.
Selections of the class XDLocalSelection have the following additional methods:
selection.extraDim() returns the tag of a feature of type AttachDimension in model.extraDim(), or an empty string if no extra dimension attachment is used.
selection.extraDim(<attachdimtag>) sets the extra dimension attachment feature. <attachdimtag> must be the tag of a feature of type AttachDimension in model.extraDim() or an empty string to indicate no extra dimension attachment.
selection.extraDimSel(<xdgeomtag>) returns the selection in extra dimension geometry <xdgeomtag>. <xdgeomtag> should be the tag of the geometry in one of the extra dimensions attached by the extra dimension attachment feature defined by selection.extraDim().
extraDimSel() returns all extra dimension geometry tags that are valid arguments of extraDimSel(<xdgeomtag>) as a string array.
Notes
The methods global(), geom(<gtag>), geom(<gtag>,dim), geom(<gtag>,highdim,lowdim,typelist), and geom(dim) clear the data set by other methods.
Not all assignment methods are supported by all model entities. The list of supported methods also serves as a guide for the restriction to those named selections that can be used by that entity. All access methods are always supported.
See Also
model.geom()