GeMA
The GeMA main application
Cell Group Set object methods

Cell group set objects are an abstraction that allows for creating a new cell group composed by the cells defined in a set of mesh cell groups. They can be used, for example, by global interpolation functions to restrict the set of elements over which the interapolation will be applied. Currenty, cell group set objects are always created in the orchestration through a call to the CellGroupSet() function.

Example:

local gs1 = CellGroupSet(mesh) -- A group set with all mesh cells.
local gs2 = CellGroupSet(mesh, {'group1', 'group2'}) -- A group set with cells from mesh cell groups 1 and 2.
local gs3 = CellGroupSet(mesh, {'group1', 'group2'}, true) -- A group set with cells from disjoint mesh cell groups 1 and 2.

Index:

Creating a cell group set object

CellGroupSet(mesh, groups, disjoint)
Description: Creates a new cell group set to represent the set of cells formed by the intersection of the given group sets, all of them belonging to the given mesh.
Parameters: mesh The mesh object containing the set of cells that will be included in the new cell group set.
groups An optional table storing the list of cell group names defining which cells will be included in the new group. If the group list is empty, or was not given at all (nil), all mesh cells are going to be included in the new set. The names of the available cell groups for the given mesh can be queried through the mesh:cellGroupIds() method.
disjoint An optional flag that when set to true informs the new object that the groups given by the previous table are disjoint (the intersection between all the given groups is empty). When this is true, some optimizations can be done to avoid creating an additional cell index. Keep in mind that no check is done to validate the given information. Default = false.
Returns: Returns a new cell group set object.

Example:

local gs1 = CellGroupSet(mesh) -- A group set with all mesh cells.
local gs2 = CellGroupSet(mesh, {'group1', 'group2'}) -- A group set with cells from mesh cell groups 1 and 2.
local gs3 = CellGroupSet(mesh, {'group1', 'group2'}, true) -- A group set with cells from disjoint mesh cell groups 1 and 2.


Metadata methods

groupSet:cellGroups()
Description: Returns the names of the mesh cell groups used to create this cell group set object.
Parameters: None.
Returns: Returns a table with the cell group names (might be empty for goups storing all mesh cells).

Example:

-- Print the names of the cell groups combined in this cell group set
local groupNames = gs:cellGroups()
for i = 1, #groupNames do
print(groupNames[i])
end


groupSet:mesh()
Description: Returns the support mesh object, owning the cells included on this cell group set.
Parameters: None.
Returns: Returns the associated mesh object.

Example:

local mesh = gs:mesh()


Cell and node query methods

groupSet:numCells()
Description: Returns the number of distinct cells in the cell group set.
Parameters: None.
Returns: Returns the number of cells in the group.

Example:

local ncells = gs:numCells()


groupSet:cell(index)
Description: Returns the i'th cell belonging to the group set given an 'i' index parameter.
Parameters: index - The cell index inside the group set (a value between 1 and groupSet:numCells()).
Returns: Returns the cell object.

Example:

-- Prints the id of each cell in this cell group set
for i = 1, gs:numCells() do
local c = gs:cell(i)
print(c:id())
end


groupSet:numNodes()
Description: Returns the number of distinct nodes referenced by the set of cells in the group.
Parameters: None.
Returns: Returns the number of nodes in the group.

Example:

local nnodes = gs:numNodes()


groupSet:node(index)
Description: Returns the i'th node belonging to the group set given an 'i' index parameter. Nodes are returned in no particular order.
Parameters: index - The node index inside the group set (a value between 1 and groupSet:numNodes()).
Returns: Returns the mesh node index.

Example:

-- Prints the index of each node in this cell group set
for i = 1, gs:numNodes() do
local nodeIndex = gs:node(i)
print(nodeIndex)
end