Grating. A grating is any regularly spaced collection of essentially identical, parallel, elongated elements. Gratings usually consist of a single set of elongated elements, but can consist of two sets, in which case the second set is usually perpendicular to the first (as illustrated). When the two sets are perpendicular, this is also known as a grid (as in grid paper) or a mesh.

As filters 
A grating covering a drain (as illustrated) can be a collection of iron bars (the identical, elongated elements) held together (to ensure the bars are parallel and regularly spaced) by a lighter iron frame. Gratings over drains and air vents are used as filters, to block movement of large solids (e.g. people) and to allow movement of liquids. A register is a type of grating used in heating, ventilation, and air conditioning, which transmits air, while stopping solid objects.

As decking 

Grating can also come in panels that are often used for decks on bridges, footbridges and catwalks. Grating can be made of materials such as steel, aluminum, fiberglass. Fiberglass grating is also known as FRP grating. They are used to optimize bending stiffness while minimizing weight.

Optical grating

As optical elements, optical gratings are images having the characteristic pattern of alternating, parallel lines. The lines alternate between high and low reflectance (black-white gratings) or high and low transmittance (transparent-opaque gratings). The grating profile is the function of the reflectance or transmittance perpendicular to the lines. This function is generally a square wave, in that every transition between lines is abrupt. 

A grating can be defined by six parameters:
 Spatial frequency is the number of cycles occupying a particular distance (e.g. 10 line pairs per millimeter). The period of the grating is the inverse of the spatial frequency, measured in distance (e.g. 0.1 mm).
 Duty Cycle is the relative thickness of high and low lines. The duty cycle is the ratio of the width of the low line (black or opaque) to one whole grating period.
 Profile is the shape of the repeating pattern, which is typically a square wave but can also be any periodic pattern (sine wave, triangle wave, sawtooth wave, etc.).
 Contrast is a measure of the difference in luminance between the high lines of the grating and the low lines. It is usually expressed as Michelson contrast: the difference between maximum and minimum luminance divided by their sum.
 Orientation is the angle the grating makes with some reference orientation (such as the y-axis in a picture or of another grating). It is usually measured in degree or in radians.
 Phase is the position of the grating profile relative to some reference position. It is usually measured in degrees (from 0 to 360 for one complete cycle) or in radians (2π for one complete cycle). For example, two identical transparent gratings of 50% duty cycle and the same orientation will appear fully opaque only if the relative phase is π (180 degrees).

Gratings with sine wave profiles are used extensively in optics to determine the transfer functions of lenses. A lens will form an image of a sine wave grating that is still sinusoidal, but with some reduction in its contrast depending on the spatial frequency and possibly some change in phase. The branch of mathematics dealing with this part of optics is Fourier analysis while the associated branch of study is Fourier optics. Gratings are also used extensively in research into visual perception. Campbell and Robson  promoted using sine-wave gratings by arguing that the human visual performs a Fourier analysis on retinal images.

Diffraction gratings

Grating can also refer to a diffraction grating: a reflecting or transparent optical component on which there are many fine, parallel, equally spaced grooves. They disperse light, so are one of the main functional components in many kinds of spectrometers, which decompose a light source into its constituent wavelength components.

See also
 Grate (disambiguation)
 Grille (architecture)
 Manhole cover
 Pedestrian infrastructure

References
 Palmer, Christopher, Diffraction Grating Handbook, 8th edition, MKS Newport (2020). 

Drainage
Road infrastructure
Pedestrian infrastructure
Garden features
Building stone
Pavements
Street furniture