#### Description:

This function searches the suppliedMapping (which may be a compound Mapping such as a CmpMap) for any component Mappings that are instances of the AST Region class. It then creates a new Mapping from which all Regions have been removed. If a Region cannot simply be removed (for instance, if it is a component of a parallel CmpMap), then it is replaced with an equivalent UnitMap in the returned Mapping.

#### Synopsis

AstMapping ∗astRemoveRegions( AstMapping ∗this )

#### Parameters:

##### this

Pointer to the original Mapping.

#### Applicability

##### CmpFrame

If the supplied Mapping is a CmpFrame, any component Frames that are instances of the Region class are replaced by the equivalent Frame.

##### FrameSet

If the supplied Mapping is a FrameSet, the returned Mapping will be a copy of the supplied FrameSet in which Regions have been removed from all the inter-Frame Mappings, and any Frames which are instances of the Region class are replaced by the equivalent Frame.

##### Mapping

This function applies to all Mappings.

##### Region

If the supplied Mapping is a Region, the returned Mapping will be the equivalent Frame.

#### Returned Value

##### astRemoveRegions()

A new pointer to the (possibly modified) Mapping.

#### Notes:

- This function can safely be applied even to Mappings which contain no Regions. If no Regions are found, it behaves exactly like astClone and returns a pointer to the original Mapping.

- The Mapping returned by this function may not be independent of the original (even if some Regions were removed), and modifying it may therefore result in indirect modification of the original. If a completely independent result is required, a copy should be made using astCopy.

- A null Object pointer (AST__NULL) will be returned if this function is invoked with the AST error status set, or if it should fail for any reason.

Copyright (C) 2021 East Asian Observatory