# Mesh

## Entity

`Bcube.Node`

— TypeA `Node`

is a point in space of dimension `dim`

.

`Bcube.topology_style`

— Method```
topology_style(::AbstractEntityType{topoDim}, ::Node{spaceDim, T}) where {topoDim, spaceDim, T}
topology_style(::AbstractEntityType{topoDim}, ::AbstractArray{Node{spaceDim, T}, N}) where {spaceDim, T, N, topoDim}
```

Indicate the `TopologyStyle`

of an entity of topology `topoDim`

living in space of dimension `spaceDim`

.

## Connectivity

`Bcube.AbstractConnectivity`

— Type`AbstractConnectivity{T}`

Supertype for connectivity with indices of type `T`

.

`Bcube.Connectivity`

— Type`Connectivity{T}`

Type for connectivity with elements of type `T`

.

`Bcube.inverse_connectivity`

— Method`inverse_connectivity(c::Connectivity{T}) where {T}`

Returns the "inverse" of the connectivity 'c' and the corresponding 'keys'. 'keys' are provided because indices in 'c' could be sparse in the general case.

**Example**

```
mesh = basic_mesh()
c2n = connectivities_indices(mesh,:c2n)
n2c, keys = inverse_connectivity(c2n)
```

Here, 'n2c' is the node->cell graph of connectivity and, 'n2c[i]' contains the indices of the cells connected to the node of index 'keys[i]'. If 'c2n' is dense, 'keys' is not necessary (because keys[i]==i, ∀i)

## Mesh

`Bcube.AbstractMesh`

— Type**Implementation**

All subtypes should implement the following functions:

`Base.parent(AbstractMesh)`

(default should be`Base.parent(m::MyMesh) = m`

)

`Bcube.Mesh`

— Type`bc_names`

: <boundary tag> => <boundary names> `bc_nodes`

: <boundary tag> => <boundary nodes tags> `bc_faces`

: <boundary tag> => <boundary faces tags>

`Bcube.connectivity_cell2cell_by_faces`

— Method`connectivity_cell2cell_by_faces(mesh)`

Build the cell -> cell connectivity by looking at neighbors by faces.

`Bcube.connectivity_cell2cell_by_nodes`

— Method`connectivity_cell2cell_by_nodes(mesh)`

Build the cell -> cell connectivity by looking at neighbors by nodes.

`Bcube.inner_faces`

— Method`inner_faces(mesh)`

Return the indices of the inner faces.

`Bcube.oriented_cell_side`

— Method`oriented_cell_side(mesh::Mesh,icell::Int,iface::Int)`

Return the side number to which the face 'iface' belongs in the cell 'icell' of the mesh. A negative side number is returned if the face is inverted. Returns '0' if the face does not belongs the cell.

`Bcube.outer_faces`

— Method`outer_faces(mesh)`

Return the indices of the outer (=boundary) faces.

## Domain

`Bcube.AbstractDomain`

— TypeAn `AbstractDomain`

designates any set of entities from a mesh. For instance a set of cells, a set of faces etc.

`Bcube.AbstractDomainIndex`

— Type`abstract type AbstractDomainIndex`

**Devs notes**

All subtypes should implement the following functions:

- get
*element*type(::AbstractDomainIndex)

`Bcube.BoundaryFaceDomain`

— Method```
BoundaryFaceDomain(mesh)
BoundaryFaceDomain(mesh, label::String)
BoundaryFaceDomain(mesh, labels::Tuple{String, Vararg{String}})
```

Build a `BoundaryFaceDomain`

corresponding to the boundaries designated by one or several labels (=names).

If no label is provided, all the `BoundaryFaceDomain`

corresponds to all the boundary faces.

`Bcube.CellDomain`

— TypeA `CellDomain`

is a representation of the cells of a mesh. It's primary purpose is to represent a domain to integrate over.

**Examples**

```
julia> mesh = rectangle_mesh(10, 10)
julia> Ω_all = CellDomain(mesh)
julia> selectedCells = [1,3,5,6]
julia> Ω_selected = CellDomain(mesh, selectedCells)
```

`Bcube.CellInfo`

— MethodLegacy constructor for CellInfo : no information about node indices

`Bcube.CellInfo`

— Method`CellInfo(mesh, icell)`

DEBUG constructor for `icell`

-th cell of `mesh`

. For performance issues, don't use this version in production.

`Bcube.FaceInfo`

— Type`FaceInfo{CN<:CellInfo,CP<:CellInfo,FT,FN,F2N,I}`

Type describing a face as the common side of two adjacent cells. `CellInfo`

of cells from both sides is stored with the local side index of the face relative to each adjacent cell.

`iface`

is the mesh-face-index (and not the domain-face-index).

**Remark:**

- For boundary face with no periodic condition, positive cell side info

are duplicate from the negative ones.

- For performance reason (type stability), nodes and type of the face

is stored explicitely in `FaceInfo`

even if it could have been computed by collecting info from the side of the negative or positive cells.

`Bcube.FaceInfo`

— MethodFaceInfo constructor

Cell sides are computed automatically.

`Bcube.FaceInfo`

— MethodDEBUG `FaceInfo`

constructor for `kface`

-th cell of `mesh`

. For performance issues, don't use this version in production.

`Bcube._compute_periodicity`

— Function```
Find periodic face connectivities sush as :
(faces of `labels2`) = A(faces of `labels1`)
```

`Bcube.get_face_normals`

— MethodReturn a LazyOperator representing a face normal

`Bcube.opposite_side`

— MethodReturn the opposite side of the `FaceInfo`

: cellside "n" because cellside "p"