LSST Applications  21.0.0+04719a4bac,21.0.0-1-ga51b5d4+f5e6047307,21.0.0-11-g2b59f77+a9c1acf22d,21.0.0-11-ga42c5b2+86977b0b17,21.0.0-12-gf4ce030+76814010d2,21.0.0-13-g1721dae+760e7a6536,21.0.0-13-g3a573fe+768d78a30a,21.0.0-15-g5a7caf0+f21cbc5713,21.0.0-16-g0fb55c1+b60e2d390c,21.0.0-19-g4cded4ca+71a93a33c0,21.0.0-2-g103fe59+bb20972958,21.0.0-2-g45278ab+04719a4bac,21.0.0-2-g5242d73+3ad5d60fb1,21.0.0-2-g7f82c8f+8babb168e8,21.0.0-2-g8f08a60+06509c8b61,21.0.0-2-g8faa9b5+616205b9df,21.0.0-2-ga326454+8babb168e8,21.0.0-2-gde069b7+5e4aea9c2f,21.0.0-2-gecfae73+1d3a86e577,21.0.0-2-gfc62afb+3ad5d60fb1,21.0.0-25-g1d57be3cd+e73869a214,21.0.0-3-g357aad2+ed88757d29,21.0.0-3-g4a4ce7f+3ad5d60fb1,21.0.0-3-g4be5c26+3ad5d60fb1,21.0.0-3-g65f322c+e0b24896a3,21.0.0-3-g7d9da8d+616205b9df,21.0.0-3-ge02ed75+a9c1acf22d,21.0.0-4-g591bb35+a9c1acf22d,21.0.0-4-g65b4814+b60e2d390c,21.0.0-4-gccdca77+0de219a2bc,21.0.0-4-ge8a399c+6c55c39e83,21.0.0-5-gd00fb1e+05fce91b99,21.0.0-6-gc675373+3ad5d60fb1,21.0.0-64-g1122c245+4fb2b8f86e,21.0.0-7-g04766d7+cd19d05db2,21.0.0-7-gdf92d54+04719a4bac,21.0.0-8-g5674e7b+d1bd76f71f,master-gac4afde19b+a9c1acf22d,w.2021.13
LSST Data Management Base Package
Public Member Functions | Public Attributes | List of all members
ast::MapSplit Class Reference

A Mapping split off as a subset of another Mapping. More...

#include <MapSplit.h>

Public Member Functions

 MapSplit (Mapping const &map, std::vector< int > const &in)
 Construct a MapSplit. More...
 
 MapSplit (MapSplit const &)=default
 
 MapSplit (MapSplit &&)=default
 
MapSplitoperator= (MapSplit const &)=default
 
MapSplitoperator= (MapSplit &&)=default
 

Public Attributes

std::shared_ptr< MappingsplitMap
 The Mapping that was split off. More...
 
std::vector< int > origIn
 Indices of the inputs of the original mapping were picked for the split mapping. More...
 
std::vector< int > origOut
 Indices of the outputs of the original mapping which are fed by the picked inputs. More...
 

Detailed Description

A Mapping split off as a subset of another Mapping.

Definition at line 38 of file MapSplit.h.

Constructor & Destructor Documentation

◆ MapSplit() [1/3]

ast::MapSplit::MapSplit ( Mapping const &  map,
std::vector< int > const &  in 
)
explicit

Construct a MapSplit.

The subset is specified by choosing a subset of inputs from an existing Mapping. Such a split is only possible if the specified inputs correspond to some subset of the original Mapping's outputs. That is, there must exist a subset of the Mapping outputs for which each output depends only on the selected Mapping inputs, and not on any of the inputs which have not been selected. Also, any output which is not in this subset must not depend on any of the selected inputs.

Parameters
[in]mapMapping to split.
[in]inIndices of inputs of map to pick. Each element should have a value in the range [1, map.getNIn()].
Exceptions
std::runtime_errorif map cannot be split as specified.

Definition at line 35 of file MapSplit.cc.

35  {
36  std::vector<int> locOut;
37  locOut.reserve(map.getNOut()); // the max # of elements astMapSplit may set
38  AstMapping *rawSplitMap;
39  astMapSplit(map.getRawPtr(), in.size(), in.data(), locOut.data(), &rawSplitMap);
40  assertOK();
41  if (!rawSplitMap) {
42  throw std::runtime_error("Could not split the map");
43  }
44  splitMap = Object::fromAstObject<Mapping>(reinterpret_cast<AstObject *>(rawSplitMap), false);
45  origIn = in;
46  // copy the splitMap->getNOut() elements of `locOut` that contain data to `origOut`
47  const int newNOut = splitMap->getNOut();
48  for (int i = 0; i < newNOut; ++i) {
49  origOut.push_back(locOut[i]);
50  }
51 }
std::shared_ptr< Mapping > splitMap
The Mapping that was split off.
Definition: MapSplit.h:67
std::vector< int > origIn
Indices of the inputs of the original mapping were picked for the split mapping.
Definition: MapSplit.h:73
std::vector< int > origOut
Indices of the outputs of the original mapping which are fed by the picked inputs.
Definition: MapSplit.h:83
T data(T... args)
void assertOK(AstObject *rawPtr1=nullptr, AstObject *rawPtr2=nullptr)
Throw std::runtime_error if AST's state is bad.
Definition: base.cc:49
T push_back(T... args)
T reserve(T... args)
T size(T... args)

◆ MapSplit() [2/3]

ast::MapSplit::MapSplit ( MapSplit const &  )
default

◆ MapSplit() [3/3]

ast::MapSplit::MapSplit ( MapSplit &&  )
default

Member Function Documentation

◆ operator=() [1/2]

MapSplit& ast::MapSplit::operator= ( MapSplit &&  )
default

◆ operator=() [2/2]

MapSplit& ast::MapSplit::operator= ( MapSplit const &  )
default

Member Data Documentation

◆ origIn

std::vector<int> ast::MapSplit::origIn

Indices of the inputs of the original mapping were picked for the split mapping.

This is a copy of the in argument of the constructor.

Definition at line 73 of file MapSplit.h.

◆ origOut

std::vector<int> ast::MapSplit::origOut

Indices of the outputs of the original mapping which are fed by the picked inputs.

This will contain splitMap->getNOut() elements, each in the range [1, nout of the original mapping]. The ith element holds the index within the original mapping which corresponds to the ith output of the split mapping. For example if the 1st output of the split mapping came from the 5th output of the original mapping, then origOut[0] = 5 (0 because vectors use 0-based indexing, and 5 because AST index values are 1-based).

Definition at line 83 of file MapSplit.h.

◆ splitMap

std::shared_ptr<Mapping> ast::MapSplit::splitMap

The Mapping that was split off.

Definition at line 67 of file MapSplit.h.


The documentation for this class was generated from the following files: