Minsky
minsky::Ravel Class Reference

#include <ravelWrap.h>

Inheritance diagram for minsky::Ravel:
Inheritance graph
Collaboration diagram for minsky::Ravel:
Collaboration graph

Public Member Functions

 CLASSDESC_ACCESS (Ravel)
 
 Ravel ()
 
void operator= (const Ravel &)
 
 Ravel (const Ravel &x)
 
const RavelravelCast () const override
 
RavelravelCast () override
 
double radius () const
 
void leaveLockGroup ()
 
void broadcastStateToLockGroup () const
 
void draw (cairo_t *cairo) const override
 draw this item into a cairo context More...
 
void resize (const LassoBox &) override
 resize this item on the canvas More...
 
bool inItem (float x, float y) const override
 
void onMouseDown (float x, float y) override
 respond to mouse down events More...
 
void onMouseUp (float x, float y) override
 respond to mouse up events More...
 
bool onMouseMotion (float x, float y) override
 respond to mouse motion events with button pressed More...
 
bool onMouseOver (float x, float y) override
 respond to mouse motion events (hover) without button pressed More...
 
void onMouseLeave () override
 respond to mouse leave events (when mouse leaves item) More...
 
Hypercube hypercube () const
 return hypercube corresponding to the current Ravel state More...
 
void populateHypercube (const Hypercube &)
 
unsigned maxRank () const
 
unsigned numHandles () const
 
size_t numSliceLabels (size_t axis) const
 number of slice labels along axis axis More...
 
void setRank (unsigned r)
 adjust output dimensions to first r handles More...
 
void adjustSlicer (int)
 adjust currently selected handle's slicer More...
 
bool onKeyPress (int, const std::string &, int) override
 respond to key press events More...
 
void redistributeHandles ()
 redistribute handles according to current state More...
 
void nextReduction (ravel::Op::ReductionOp op)
 sets the type of the next reduction operation More...
 
void handleSetReduction (int handle, ravel::Op::ReductionOp op)
 set the reduction type for handle More...
 
int selectedHandle () const
 current handle mouse is over, or -1 if none More...
 
void collapseAllHandles (bool collapse=true)
 collapse all handles (applying nextReduction op where appropriate) More...
 
bool displayFilterCaliper () const
 enable/disable calipers on currently selected handle More...
 
bool setDisplayFilterCaliper (bool x)
 
bool toggleDisplayFilterCaliper ()
 
std::vector< std::string > allSliceLabels () const
 returns all slice labels along the selected handle, in specified order More...
 
std::vector< std::string > allSliceLabelsAxis (int axis) const
 returns all slice labels along an axis(dimension) identified by its number More...
 
std::vector< std::string > pickedSliceLabels () const
 returns just the picked slice labels along the handle More...
 
std::vector< std::string > pickedSliceLabels (int axis) const
 
void pickSliceLabels (int axis, const std::vector< std::string > &pick)
 pick (selected) pick labels More...
 
std::vector< std::string > handleNames () const
 return all handle names More...
 
Dimension dimension (int handle) const
 dimension details associated with handle More...
 
void resortHandleIfDynamic ()
 
ravel::HandleSort::Order setHandleSortOrder (ravel::HandleSort::Order, int handle)
 set a given handle sort order More...
 
bool handleSortableByValue () const
 
void sortByValue (ravel::HandleSort::Order dir)
 Sort handle by value. Only applicable for rank 1 ravels. More...
 
std::string description () const
 
void setDescription (const std::string &)
 
std::string handleDescription (int handle) const
 return the description field for handle handle. More...
 
void setHandleDescription (int handle, const std::string &description)
 set the description field for handle More...
 
ravel::RavelState getState () const
 get the current state of the Ravel More...
 
void applyState (const ravel::RavelState &state)
 apply the state to the Ravel, leaving data, slicelabels etc unchanged More...
 
void displayDelayedTooltip (float x, float y) override
 enable extended tooltip help message appropriate for mouse at (x,y) More...
 
void exportAsCSV (const std::string &filename, bool tabular) const
 export the plotted data as a CSV file More...
 
Units units (bool) const override
 compute the dimensional units More...
 
bool editorMode () const override
 indicate whether icon is in editor mode or icon mode More...
 
void toggleEditorMode () override
 
void joinLockGroup (unsigned)
 
ravel::HandleSort::Order sortOrder () const
 the handle sorting order for currently selected handle More...
 
ravel::HandleSort::Order setSortOrder (ravel::HandleSort::Order)
 the handle sorting order for currently selected handle More...
 
Dimension::Type dimensionType () const
 get/set dimension attributes of selected handle, or handle at given index More...
 
Dimension::Type dimensionType (int) const
 get/set dimension attributes of selected handle, or handle at given index More...
 
std::string dimensionUnitsFormat () const
 get/set dimension attributes of selected handle, or handle at given index More...
 
std::string dimensionUnitsFormat (int) const
 get/set dimension attributes of selected handle, or handle at given index More...
 
void setDimension (Dimension::Type type, const std::string &units)
 
void setDimension (int handleIndex, Dimension::Type type, const std::string &units)
 
- Public Member Functions inherited from minsky::ItemT< Ravel, Operation< OperationType::ravel > >
std::string classType () const override
 
ItemTclone () const override
 
void TCL_obj (classdesc::TCL_obj_t &t, const std::string &d) override
 
void RESTProcess (classdesc::RESTProcess_t &rp, const std::string &d) override
 dummy template definition for use with gui executable More...
 
void RESTProcess (classdesc::RESTProcess_t &rp, const std::string &d) const override
 
void json_pack (classdesc::json_pack_t &j) const override
 
 ItemT ()=default
 
 ItemT (const ItemT &)=default
 
 ItemT (ItemT &&)=delete
 
ItemToperator= (const ItemT &)=default
 
ItemToperator= (ItemT &&)=delete
 
- Public Member Functions inherited from minsky::Operation< OperationType::ravel >
Type type () const override
 
void iconDraw (cairo_t *) const override
 visual representation of operation on the canvas More...
 
void iconDraw (cairo_t *cairo) const
 visual representation of operation on the canvas More...
 
void iconDraw (cairo_t *cairo) const
 visual representation of operation on the canvas More...
 
void iconDraw (cairo_t *cairo) const
 visual representation of operation on the canvas More...
 
void iconDraw (cairo_t *cairo) const
 visual representation of operation on the canvas More...
 
void iconDraw (cairo_t *cairo) const
 visual representation of operation on the canvas More...
 
void iconDraw (cairo_t *cairo) const
 visual representation of operation on the canvas More...
 
void iconDraw (cairo_t *cairo) const
 visual representation of operation on the canvas More...
 
void iconDraw (cairo_t *cairo) const
 visual representation of operation on the canvas More...
 
void iconDraw (cairo_t *cairo) const
 visual representation of operation on the canvas More...
 
void iconDraw (cairo_t *cairo) const
 visual representation of operation on the canvas More...
 
void iconDraw (cairo_t *cairo) const
 visual representation of operation on the canvas More...
 
void iconDraw (cairo_t *cairo) const
 visual representation of operation on the canvas More...
 
void iconDraw (cairo_t *cairo) const
 visual representation of operation on the canvas More...
 
void iconDraw (cairo_t *cairo) const
 visual representation of operation on the canvas More...
 
void iconDraw (cairo_t *cairo) const
 visual representation of operation on the canvas More...
 
void iconDraw (cairo_t *cairo) const
 visual representation of operation on the canvas More...
 
void iconDraw (cairo_t *cairo) const
 visual representation of operation on the canvas More...
 
void iconDraw (cairo_t *cairo) const
 visual representation of operation on the canvas More...
 
void iconDraw (cairo_t *cairo) const
 visual representation of operation on the canvas More...
 
void iconDraw (cairo_t *cairo) const
 visual representation of operation on the canvas More...
 
void iconDraw (cairo_t *cairo) const
 visual representation of operation on the canvas More...
 
void iconDraw (cairo_t *cairo) const
 visual representation of operation on the canvas More...
 
void iconDraw (cairo_t *cairo) const
 visual representation of operation on the canvas More...
 
void iconDraw (cairo_t *cairo) const
 visual representation of operation on the canvas More...
 
void iconDraw (cairo_t *cairo) const
 visual representation of operation on the canvas More...
 
void iconDraw (cairo_t *cairo) const
 visual representation of operation on the canvas More...
 
void iconDraw (cairo_t *cairo) const
 visual representation of operation on the canvas More...
 
void iconDraw (cairo_t *cairo) const
 visual representation of operation on the canvas More...
 
void iconDraw (cairo_t *cairo) const
 visual representation of operation on the canvas More...
 
void iconDraw (cairo_t *cairo) const
 visual representation of operation on the canvas More...
 
void iconDraw (cairo_t *cairo) const
 visual representation of operation on the canvas More...
 
void iconDraw (cairo_t *cairo) const
 visual representation of operation on the canvas More...
 
void iconDraw (cairo_t *cairo) const
 visual representation of operation on the canvas More...
 
void iconDraw (cairo_t *cairo) const
 visual representation of operation on the canvas More...
 
void iconDraw (cairo_t *cairo) const
 visual representation of operation on the canvas More...
 
void iconDraw (cairo_t *cairo) const
 visual representation of operation on the canvas More...
 
void iconDraw (cairo_t *cairo) const
 visual representation of operation on the canvas More...
 
void iconDraw (cairo_t *cairo) const
 visual representation of operation on the canvas More...
 
void iconDraw (cairo_t *cairo) const
 visual representation of operation on the canvas More...
 
void iconDraw (cairo_t *cairo) const
 visual representation of operation on the canvas More...
 
void iconDraw (cairo_t *cairo) const
 visual representation of operation on the canvas More...
 
void iconDraw (cairo_t *cairo) const
 visual representation of operation on the canvas More...
 
void iconDraw (cairo_t *cairo) const
 visual representation of operation on the canvas More...
 
void iconDraw (cairo_t *cairo) const
 visual representation of operation on the canvas More...
 
void iconDraw (cairo_t *cairo) const
 visual representation of operation on the canvas More...
 
void iconDraw (cairo_t *cairo) const
 visual representation of operation on the canvas More...
 
void iconDraw (cairo_t *cairo) const
 visual representation of operation on the canvas More...
 
void iconDraw (cairo_t *cairo) const
 visual representation of operation on the canvas More...
 
void iconDraw (cairo_t *cairo) const
 visual representation of operation on the canvas More...
 
void iconDraw (cairo_t *cairo) const
 visual representation of operation on the canvas More...
 
void iconDraw (cairo_t *cairo) const
 visual representation of operation on the canvas More...
 
void iconDraw (cairo_t *cairo) const
 visual representation of operation on the canvas More...
 
void iconDraw (cairo_t *cairo) const
 visual representation of operation on the canvas More...
 
void iconDraw (cairo_t *cairo) const
 visual representation of operation on the canvas More...
 
void iconDraw (cairo_t *cairo) const
 visual representation of operation on the canvas More...
 
void iconDraw (cairo_t *cairo) const
 visual representation of operation on the canvas More...
 
void iconDraw (cairo_t *cairo) const
 visual representation of operation on the canvas More...
 
void iconDraw (cairo_t *cairo) const
 visual representation of operation on the canvas More...
 
void iconDraw (cairo_t *cairo) const
 visual representation of operation on the canvas More...
 
void iconDraw (cairo_t *cairo) const
 visual representation of operation on the canvas More...
 
void iconDraw (cairo_t *cairo) const
 visual representation of operation on the canvas More...
 
void iconDraw (cairo_t *cairo) const
 visual representation of operation on the canvas More...
 
void iconDraw (cairo_t *cairo) const
 visual representation of operation on the canvas More...
 
void iconDraw (cairo_t *cairo) const
 visual representation of operation on the canvas More...
 
void iconDraw (cairo_t *cairo) const
 visual representation of operation on the canvas More...
 
void iconDraw (cairo_t *cairo) const
 visual representation of operation on the canvas More...
 
void iconDraw (cairo_t *cairo) const
 visual representation of operation on the canvas More...
 
void iconDraw (cairo_t *cairo) const
 visual representation of operation on the canvas More...
 
void iconDraw (cairo_t *cairo) const
 visual representation of operation on the canvas More...
 
void iconDraw (cairo_t *cairo) const
 visual representation of operation on the canvas More...
 
void iconDraw (cairo_t *cairo) const
 visual representation of operation on the canvas More...
 
void iconDraw (cairo_t *cairo) const
 visual representation of operation on the canvas More...
 
void iconDraw (cairo_t *cairo) const
 visual representation of operation on the canvas More...
 
void iconDraw (cairo_t *cairo) const
 visual representation of operation on the canvas More...
 
void iconDraw (cairo_t *cairo) const
 visual representation of operation on the canvas More...
 
void iconDraw (cairo_t *) const
 visual representation of operation on the canvas More...
 
std::size_t numPorts () const override
 
 Operation ()
 
 Operation (const Operation &x)
 
 Operation (Operation &&x)
 
Operationoperator= (const Operation &x)
 
Operationoperator= (Operation &&x)
 
std::string classType () const override
 
- Public Member Functions inherited from minsky::ItemT< Operation< T >, OperationBase >
void RESTProcess (classdesc::RESTProcess_t &rp, const std::string &d) override
 dummy template definition for use with gui executable More...
 
void RESTProcess (classdesc::RESTProcess_t &rp, const std::string &d) const override
 
 ItemT ()=default
 
 ItemT (const ItemT &)=default
 
 ItemT (ItemT &&)=delete
 
ItemToperator= (const ItemT &)=default
 
ItemToperator= (ItemT &&)=delete
 
- Public Member Functions inherited from minsky::OperationBase
const OperationBaseoperationCast () const override
 
OperationBaseoperationCast () override
 
std::string portValues () const
 returns a list of values the ports currently have More...
 
bool multiWire () const
 
virtual void addPorts ()
 
void drawUserFunction (cairo_t *cairo) const
 
float scaleFactor () const override
 factor by which item has been resized More...
 
double value () const override
 current value of output port More...
 
std::vector< std::string > dimensions () const
 return dimension names of tensor object attached to input if binary op, then the union of dimension names is returned More...
 
- Public Member Functions inherited from minsky::BottomRightResizerItem
bool onResizeHandle (float x, float y) const override
 
void drawResizeHandles (cairo_t *cairo) const override
 
virtual Point resizeHandleCoords () const
 returns coordinates of the resizer handle More...
 
- Public Member Functions inherited from minsky::Item
 Item ()
 
virtual std::weak_ptr< Portports (std::size_t i) const
 callback to be run when item deleted from group More...
 
std::size_t portsSize () const
 number of ports More...
 
float portX (std::size_t i)
 
float portY (std::size_t i)
 
virtual bool contains (float xx, float yy) const
 
bool contains (const Point &p) const
 
void updateBoundingBox () override
 
void throw_error (const std::string &) const
 mark item on canvas, then throw More...
 
virtual bool ioVar () const
 indicates this is a group I/O variable More...
 
double rotation () const
 
double rotation (const double &r)
 
std::pair< double, bool > rotationAsRadians () const
 return the rotation as radians, and whether rotation should have additional straight angle added for text that stays upright. More...
 
float iWidth () const
 
float iWidth (const float &w)
 
float iHeight () const
 
float iHeight (const float &h)
 
virtual void flip ()
 rotate icon though 180∘ More...
 
std::string id () const
 return an id uniquely identifying this item More...
 
virtual float x () const
 
virtual float y () const
 
virtual float zoomFactor () const
 
void ensureBBValid () const
 
float width () const
 
float height () const
 
virtual std::vector< Pointcorners () const
 
float left () const
 
float right () const
 
float top () const
 
float bottom () const
 
std::string bookmarkId () const
 Id of bookmark associated with this. More...
 
void adjustBookmark () const override
 adjust bookmark list to reflect current configuration More...
 
float resizeHandleSize () const
 resize handles should be at least a percentage if the icon size (#1025) More...
 
virtual bool onItem (float x, float y) const
 returns true if (x,y) is on the icon More...
 
virtual void deleteAttachedWires ()
 delete all attached wires More...
 
virtual bool visible () const
 whether this item is visible on the canvas. More...
 
void moveTo (float x, float y)
 
virtual float scaleFactor (const float &sf)
 
void dummyDraw () const
 draw into a dummy cairo context, for purposes of calculating port positions More...
 
virtual void displayTooltip (cairo_t *, const std::string &) const
 display tooltip text, eg on mouseover More...
 
virtual void updateIcon (double t)
 update display after a step() More...
 
 Item (const Item &)=default
 
Itemoperator= (const Item &)=default
 
virtual ~Item ()
 
void drawPorts (cairo_t *cairo) const
 
virtual ClickType::Type clickType (float x, float y) const
 returns the clicktype given a mouse click at x, y. More...
 
virtual std::shared_ptr< PortclosestOutPort (float x, float y) const
 returns closest output port to x,y More...
 
virtual std::shared_ptr< PortclosestInPort (float x, float y) const
 
virtual std::shared_ptr< Itemselect (float x, float y) const
 returns the variable if point (x,y) is within a visible variable icon, null otherwise. More...
 
void RESTProcess (classdesc::RESTProcess_t &rp, const std::string &d) override
 runs the RESTProcess descriptor suitable for this type More...
 
void RESTProcess (classdesc::RESTProcess_t &rp, const std::string &d) const override
 
virtual void disableDelayedTooltip ()
 
Units checkUnits () const
 perform units consistency checks More...
 
ItemPtr itemPtrFromThis () const
 return a shared_ptr to this More...
 
virtual void destroyFrame ()
 destroy any popup windows associated with this More...
 
- Public Member Functions inherited from minsky::NoteBase
virtual std::string const & detailedText () const
 
virtual std::string const & detailedText (const std::string &x)
 
virtual std::string const & tooltip () const
 
virtual std::string const & tooltip (const std::string &x)
 
virtual ~NoteBase ()=default
 

Static Public Member Functions

static std::vector< unsigned > lockGroupColours ()
 
- Static Public Member Functions inherited from minsky::OperationBase
static OperationBasecreate (Type type)
 factory method. More...
 
- Static Public Member Functions inherited from minsky::Item
static void drawSelected (cairo_t *cairo)
 
- Static Public Member Functions inherited from minsky::OperationType
static std::string typeName (int type)
 return the symbolic name of type More...
 
static Group classify (Type t)
 

Public Attributes

RavelPopup popup
 popup Ravel control window More...
 
bool flipped =false
 
Dimensions axisDimensions
 local override of axis dimensionality More...
 
std::shared_ptr< RavelLockGrouplockGroup
 group of ravels that move syncronously More...
 
- Public Attributes inherited from minsky::OperationBase
double arg =1
 operation argument. For example, the offset used in a difference operator, or binsize in a binning op More...
 
std::string axis
 axis selector in tensor operations More...
 
- Public Attributes inherited from minsky::Item
float m_x =0
 
float m_y =0
 position in canvas, or within group More...
 
float m_sf =1
 scale factor of item on canvas, or within group More...
 
bool onResizeHandles =false
 set to true to indicate mouse is ovcaler resize handles More...
 
bool onBorder =false
 true to indicate mouse hovering over border More...
 
std::string deleteCallback
 
BoundingBox bb
 canvas bounding box. More...
 
- Public Attributes inherited from minsky::NoteBase
bool mouseFocus =false
 true if target of a mouseover More...
 
bool selected =false
 true if selected for cut, copy or group operation More...
 
bool bookmark =false
 Is this item also a bookmark? More...
 

Static Public Attributes

static SVGRenderer svgRenderer
 SVG icon to display when not in editor mode. More...
 
- Static Public Attributes inherited from minsky::OperationBase
static constexpr float l =-8
 
static constexpr float h =12
 
static constexpr float r =12
 

Private Types

using HandleState = ravel::HandleState
 

Private Member Functions

std::vector< std::string > allSliceLabelsImpl (int axis, ravel::HandleSort::Order) const
 

Private Attributes

const double moveX =0.5
 position of the "move" handle, as a proportion of radius More...
 
const double moveY =0.5
 
const double moveSz =0.1
 
bool m_editorMode =false
 indicate whether icon is in editor mode or icon mode More...
 
std::string explanation
 
ravel::HandleSort::Order previousOrder =ravel::HandleSort::forward
 
ravel::RavelState initState
 used entirely to defer persisted state data until after first load from a variable More...
 
friend RavelPopup
 
ravel::Ravel wrappedRavel
 
ravel::Op::ReductionOp m_nextReduction =ravel::Op::sum
 

Friends

struct SchemaHelper
 

Additional Inherited Members

- Public Types inherited from minsky::Operation< OperationType::ravel >
typedef OperationType::Type Type
 
- Public Types inherited from minsky::OperationBase
typedef OperationType::Type Type
 
- Public Types inherited from minsky::OperationType
enum  Type {
  constant, time, integrate, differentiate,
  data, ravel, euler, pi,
  zero, one, inf, percent,
  add, subtract, multiply, divide,
  min, max, and_, or_,
  log, pow, polygamma, lt,
  le, eq, userFunction, copy,
  sqrt, exp, ln, sin,
  cos, tan, asin, acos,
  atan, sinh, cosh, tanh,
  abs, floor, frac, not_,
  Gamma, fact, sum, product,
  infimum, supremum, any, all,
  infIndex, supIndex, runningSum, runningProduct,
  difference, differencePlus, innerProduct, outerProduct,
  index, gather, meld, merge,
  slice, size, shape, mean,
  median, stdDev, moment, histogram,
  covariance, correlation, linearRegression, numOps
}
 
enum  Group {
  general, constop, binop, function,
  reduction, scan, tensor, statistics
}
 
- Protected Member Functions inherited from minsky::OperationBase
void setCachedText (cairo_t *, const std::string &, double) const
 check if cachedPango is up to date, and if not recreate More...
 
- Static Protected Member Functions inherited from minsky::Item
static void drawResizeHandle (cairo_t *cairo, double x, double y, double sf, double angle)
 
- Protected Attributes inherited from minsky::OperationBase
classdesc::Exclude< std::shared_ptr< ecolab::Pango > > cachedPango
 
- Protected Attributes inherited from minsky::Item
double m_width =10
 
double m_height =10
 
ItemPortVector m_ports
 
minsky::Item::MemoisedRotator memoisedRotator
 

Detailed Description

Definition at line 55 of file ravelWrap.h.

Member Typedef Documentation

◆ HandleState

using minsky::Ravel::HandleState = ravel::HandleState
private

Definition at line 61 of file ravelWrap.h.

Constructor & Destructor Documentation

◆ Ravel() [1/2]

minsky::Ravel::Ravel ( )

Definition at line 63 of file ravelWrap.cc.

References minsky::NoteBase::detailedText(), minsky::GroupItems::items, m_editorMode, minsky::minsky(), minsky::Minsky::model, minsky::NoteBase::tooltip(), and wrappedRavel.

63  : popup(*this)
64  {
65  if (!wrappedRavel)
66  {
67  tooltip("https://ravelation.net");
68  detailedText(wrappedRavel.lastError());
69  }
70  if (minsky().model->findAny(&GroupItems::items, [](const ItemPtr& i){return i->ravelCast();}))
71  return; // early return if at least 1 ravel already present
72  m_editorMode=true; // first ravel is in editor mode
73  // set an intial 3 axis ravel to give an indication of what it is about
74  wrappedRavel.addHandle("Year",{"1990","1991","1992"});
75  wrappedRavel.addHandle("Gender",{"Male","Female"});
76  wrappedRavel.addHandle("Country",{"Australia","UK","USA"});
77  wrappedRavel.setOutputHandleIds({0,2});
78  }
std::shared_ptr< Item > ItemPtr
Definition: item.h:57
ravel::Ravel wrappedRavel
Definition: ravelWrap.h:80
virtual std::string const & tooltip() const
Definition: noteBase.h:36
bool m_editorMode
indicate whether icon is in editor mode or icon mode
Definition: ravelWrap.h:66
RavelPopup popup
popup Ravel control window
Definition: ravelWrap.h:84
GroupPtr model
Definition: minsky.h:255
Minsky & minsky()
global minsky object
Definition: minskyTCL.cc:51
virtual std::string const & detailedText() const
Definition: noteBase.h:34
Here is the call graph for this function:

◆ Ravel() [2/2]

minsky::Ravel::Ravel ( const Ravel x)
inline

Definition at line 90 of file ravelWrap.h.

References getState().

90  : ItemT<Ravel, Operation<OperationType::ravel>>(x), popup(*this) {
91  applyState(x.getState());
92  }
virtual float x() const
Definition: item.cc:107
void applyState(const ravel::RavelState &state)
apply the state to the Ravel, leaving data, slicelabels etc unchanged
Definition: ravelWrap.cc:535
RavelPopup popup
popup Ravel control window
Definition: ravelWrap.h:84
Here is the call graph for this function:

Member Function Documentation

◆ adjustSlicer()

void minsky::Ravel::adjustSlicer ( int  n)

adjust currently selected handle's slicer

Definition at line 240 of file ravelWrap.cc.

References broadcastStateToLockGroup(), resortHandleIfDynamic(), and wrappedRavel.

Referenced by onKeyPress().

241  {
242  wrappedRavel.adjustSlicer(n);
245  }
void broadcastStateToLockGroup() const
Definition: ravelWrap.cc:570
ravel::Ravel wrappedRavel
Definition: ravelWrap.h:80
void resortHandleIfDynamic()
Definition: ravelWrap.cc:372
Here is the call graph for this function:
Here is the caller graph for this function:

◆ allSliceLabels()

vector< string > minsky::Ravel::allSliceLabels ( ) const

returns all slice labels along the selected handle, in specified order

Definition at line 299 of file ravelWrap.cc.

References wrappedRavel.

300  {
301  return wrappedRavel.allSliceLabels(wrappedRavel.selectedHandle(),ravel::HandleSort::forward);
302  }
ravel::Ravel wrappedRavel
Definition: ravelWrap.h:80

◆ allSliceLabelsAxis()

vector< string > minsky::Ravel::allSliceLabelsAxis ( int  axis) const

returns all slice labels along an axis(dimension) identified by its number

Definition at line 304 of file ravelWrap.cc.

References minsky::OperationBase::axis, and wrappedRavel.

305  {
306  return wrappedRavel.allSliceLabels(axis,ravel::HandleSort::forward);
307  }
ravel::Ravel wrappedRavel
Definition: ravelWrap.h:80
std::string axis
axis selector in tensor operations
Definition: operationBase.h:95

◆ allSliceLabelsImpl()

std::vector<std::string> minsky::Ravel::allSliceLabelsImpl ( int  axis,
ravel::HandleSort::Order   
) const
private

◆ applyState()

void minsky::Ravel::applyState ( const ravel::RavelState &  state)

apply the state to the Ravel, leaving data, slicelabels etc unchanged

Parameters
preservePositionsif true, do not rotate handles

Definition at line 535 of file ravelWrap.cc.

References initState, minsky::OperationBase::r, minsky::Item::updateBoundingBox(), and wrappedRavel.

Referenced by collapseAllHandles(), and populateHypercube().

536  {
537  if (!wrappedRavel) {
538  initState=state;
539  return;
540  }
541  auto r=wrappedRavel.radius();
542  wrappedRavel.setRavelState(state);
543  if (state.radius!=r) // only need to update bounding box if radius changes
545  }
ravel::Ravel wrappedRavel
Definition: ravelWrap.h:80
ravel::RavelState initState
used entirely to defer persisted state data until after first load from a variable ...
Definition: ravelWrap.h:73
void updateBoundingBox() override
Definition: item.h:201
static constexpr float r
Definition: operationBase.h:58
Here is the call graph for this function:
Here is the caller graph for this function:

◆ broadcastStateToLockGroup()

void minsky::Ravel::broadcastStateToLockGroup ( ) const

Definition at line 570 of file ravelWrap.cc.

References lockGroup.

Referenced by adjustSlicer(), minsky::RavelPopup::mouseOver(), onMouseUp(), and pickSliceLabels().

571  {
572  if (lockGroup) lockGroup->broadcast(*this);
573  }
std::shared_ptr< RavelLockGroup > lockGroup
group of ravels that move syncronously
Definition: ravelWrap.h:103
Here is the caller graph for this function:

◆ CLASSDESC_ACCESS()

minsky::Ravel::CLASSDESC_ACCESS ( Ravel  )

◆ collapseAllHandles()

void minsky::Ravel::collapseAllHandles ( bool  collapse = true)

collapse all handles (applying nextReduction op where appropriate)

Parameters
collapseif true, uncollapse if false

Definition at line 264 of file ravelWrap.cc.

References applyState(), getState(), minsky::OperationBase::h, m_nextReduction, minsky::minsky(), and minsky::Minsky::requestReset().

265  {
266  auto state=getState();
267  for (auto& h: state.handleStates)
268  if (collapse && !h.collapsed)
269  {
270  h.reductionOp=m_nextReduction;
271  h.collapsed=true;
272  }
273  else if (!collapse && h.collapsed)
274  h.collapsed=false;
275  applyState(state);
276  minsky().requestReset();
277  }
void requestReset()
Definition: minsky.cc:467
ravel::RavelState getState() const
get the current state of the Ravel
Definition: ravelWrap.h:206
void applyState(const ravel::RavelState &state)
apply the state to the Ravel, leaving data, slicelabels etc unchanged
Definition: ravelWrap.cc:535
static constexpr float h
Definition: operationBase.h:58
ravel::Op::ReductionOp m_nextReduction
Definition: ravelWrap.h:81
Minsky & minsky()
global minsky object
Definition: minskyTCL.cc:51
Here is the call graph for this function:

◆ description()

string minsky::Ravel::description ( ) const

Definition at line 425 of file ravelWrap.cc.

References handleDescription(), and wrappedRavel.

Referenced by setDescription().

426  {
427  return handleDescription(wrappedRavel.selectedHandle());
428  }
ravel::Ravel wrappedRavel
Definition: ravelWrap.h:80
std::string handleDescription(int handle) const
return the description field for handle handle.
Definition: ravelWrap.h:189
Here is the call graph for this function:
Here is the caller graph for this function:

◆ dimension()

Dimension minsky::Ravel::dimension ( int  handle) const

dimension details associated with handle

Definition at line 346 of file ravelWrap.cc.

References minsky::cminsky(), minsky::OperationBase::dimensions(), minsky::Minsky::dimensions, and handleDescription().

Referenced by setHandleSortOrder().

347  {
348  Dimension dim;
349  auto dimitr=cminsky().dimensions.find(handleDescription(handle));
350  if (dimitr!=cminsky().dimensions.end())
351  dim=dimitr->second;
352  return dim;
353  }
std::vector< std::string > dimensions() const
return dimension names of tensor object attached to input if binary op, then the union of dimension n...
Definition: operation.cc:348
const Minsky & cminsky()
const version to help in const correctness
Definition: minsky.h:549
std::string handleDescription(int handle) const
return the description field for handle handle.
Definition: ravelWrap.h:189
Dimensions dimensions
Definition: minsky.h:201
Here is the call graph for this function:
Here is the caller graph for this function:

◆ dimensionType() [1/2]

Dimension::Type minsky::Ravel::dimensionType ( ) const

get/set dimension attributes of selected handle, or handle at given index

Definition at line 435 of file ravelWrap.cc.

References selectedHandle().

436  {
437  return dimensionType(selectedHandle());
438  }
int selectedHandle() const
current handle mouse is over, or -1 if none
Definition: ravelWrap.h:134
Dimension::Type dimensionType() const
get/set dimension attributes of selected handle, or handle at given index
Definition: ravelWrap.cc:435
Here is the call graph for this function:

◆ dimensionType() [2/2]

Dimension::Type minsky::Ravel::dimensionType ( int  handleIndex) const

get/set dimension attributes of selected handle, or handle at given index

Definition at line 440 of file ravelWrap.cc.

References axisDimensions, minsky::cminsky(), minsky::Minsky::dimensions, and handleDescription().

441  {
442  auto descr=handleDescription(handleIndex);
443 
444  if (auto i=axisDimensions.find(descr); i!=axisDimensions.end())
445  return i->second.type;
446 
447  if (auto i=cminsky().dimensions.find(descr); i!=cminsky().dimensions.end())
448  return i->second.type;
449 
450  return Dimension::string;
451  }
const Minsky & cminsky()
const version to help in const correctness
Definition: minsky.h:549
std::string handleDescription(int handle) const
return the description field for handle handle.
Definition: ravelWrap.h:189
Dimensions axisDimensions
local override of axis dimensionality
Definition: ravelWrap.h:100
Dimensions dimensions
Definition: minsky.h:201
Here is the call graph for this function:

◆ dimensionUnitsFormat() [1/2]

std::string minsky::Ravel::dimensionUnitsFormat ( ) const

get/set dimension attributes of selected handle, or handle at given index

Definition at line 453 of file ravelWrap.cc.

References selectedHandle().

454  {
456  }
int selectedHandle() const
current handle mouse is over, or -1 if none
Definition: ravelWrap.h:134
std::string dimensionUnitsFormat() const
get/set dimension attributes of selected handle, or handle at given index
Definition: ravelWrap.cc:453
Here is the call graph for this function:

◆ dimensionUnitsFormat() [2/2]

std::string minsky::Ravel::dimensionUnitsFormat ( int  handleIndex) const

get/set dimension attributes of selected handle, or handle at given index

Definition at line 458 of file ravelWrap.cc.

References axisDimensions, minsky::cminsky(), minsky::OperationBase::dimensions(), minsky::Minsky::dimensions, and handleDescription().

459  {
460  auto descr=handleDescription(handleIndex);
461  if (descr.empty()) return "";
462  auto i=axisDimensions.find(descr);
463  if (i!=axisDimensions.end())
464  return i->second.units;
465  i=cminsky().dimensions.find(descr);
466  if (i!=cminsky().dimensions.end())
467  return i->second.units;
468  return "";
469  }
std::vector< std::string > dimensions() const
return dimension names of tensor object attached to input if binary op, then the union of dimension n...
Definition: operation.cc:348
const Minsky & cminsky()
const version to help in const correctness
Definition: minsky.h:549
std::string handleDescription(int handle) const
return the description field for handle handle.
Definition: ravelWrap.h:189
Dimensions axisDimensions
local override of axis dimensionality
Definition: ravelWrap.h:100
Dimensions dimensions
Definition: minsky.h:201
Here is the call graph for this function:

◆ displayDelayedTooltip()

void minsky::Ravel::displayDelayedTooltip ( float  x,
float  y 
)
overridevirtual

enable extended tooltip help message appropriate for mouse at (x,y)

Reimplemented from minsky::Item.

Definition at line 548 of file ravelWrap.cc.

References explanation, wrappedRavel, minsky::Item::x(), and minsky::Item::y().

549  {
550  if (wrappedRavel.rank()==0)
551  explanation="load CSV data from\ncontext menu";
552  else
553  {
554  explanation=wrappedRavel.explain(xx-x(),yy-y());
555  // line break every 5 words
556  int spCnt=0;
557  for (auto& c: explanation)
558  if (isspace(c) && ++spCnt % 5 == 0)
559  c='\n';
560  }
561  }
virtual float x() const
Definition: item.cc:107
virtual float y() const
Definition: item.cc:114
ravel::Ravel wrappedRavel
Definition: ravelWrap.h:80
std::string explanation
Definition: ravelWrap.h:68
Here is the call graph for this function:

◆ displayFilterCaliper()

bool minsky::Ravel::displayFilterCaliper ( ) const

enable/disable calipers on currently selected handle

Definition at line 280 of file ravelWrap.cc.

References minsky::OperationBase::h, and wrappedRavel.

281  {
282  const int h=wrappedRavel.selectedHandle();
283  if (h>=0)
284  {
285  auto state=wrappedRavel.getHandleState(h);
286  return state.displayFilterCaliper;
287  }
288  return false;
289  }
ravel::Ravel wrappedRavel
Definition: ravelWrap.h:80
static constexpr float h
Definition: operationBase.h:58

◆ draw()

void minsky::Ravel::draw ( cairo_t *  cairo) const
overridevirtual

draw this item into a cairo context

Reimplemented from minsky::OperationBase.

Definition at line 80 of file ravelWrap.cc.

References minsky::Item::displayTooltip(), minsky::Item::drawPorts(), minsky::BottomRightResizerItem::drawResizeHandles(), minsky::Item::drawSelected(), minsky::drawTriangle(), explanation, flipped, minsky::SVGRenderer::height(), lockGroup, m_editorMode, M_PI, minsky::Item::m_ports, minsky::NoteBase::mouseFocus, minsky::Item::onBorder, minsky::OperationBase::r, minsky::SVGRenderer::render(), minsky::NoteBase::selected, svgRenderer, minsky::NoteBase::tooltip(), minsky::SVGRenderer::width(), wrappedRavel, minsky::Item::x(), minsky::Item::y(), and minsky::Item::zoomFactor().

81  {
82  const double z=zoomFactor(), r=m_editorMode? 1.1*z*wrappedRavel.radius(): 30*z;
83  if (flipped)
84  {
85  m_ports[0]->moveTo(x()-1.1*r, y());
86  m_ports[1]->moveTo(x()+1.1*r, y());
87  drawTriangle(cairo,m_ports[1]->x()-x(),m_ports[1]->y()-y(),{0,0,0,1},M_PI);
88  }
89  else
90  {
91  m_ports[0]->moveTo(x()+1.1*r, y());
92  m_ports[1]->moveTo(x()-1.1*r, y());
93  drawTriangle(cairo,m_ports[1]->x()-x(),m_ports[1]->y()-y(),{0,0,0,1},0);
94  }
95  if (mouseFocus)
96  {
97  drawPorts(cairo);
98  displayTooltip(cairo,tooltip().empty()? explanation: tooltip());
99  // Resize handles always visible on mousefocus. For ticket 92.
100  if (m_editorMode) drawResizeHandles(cairo);
101  }
102  cairo_rectangle(cairo,-r,-r,2*r,2*r);
103  cairo_rectangle(cairo,-1.1*r,-1.1*r,2.2*r,2.2*r);
104  cairo_stroke_preserve(cairo);
105  if (onBorder || lockGroup)
106  { // shadow the border when mouse is over it
107  const cairo::CairoSave cs(cairo);
108  cairo::Colour c{1,1,1,0};
109  if (lockGroup)
110  c=palette[ lockGroup->colour() % paletteSz ];
111  c.r*=0.5; c.g*=0.5; c.b*=0.5;
112  c.a=onBorder? 0.5:0.3;
113  cairo_set_source_rgba(cairo,c.r,c.g,c.b,c.a);
114  cairo_set_fill_rule(cairo,CAIRO_FILL_RULE_EVEN_ODD);
115  cairo_fill_preserve(cairo);
116  }
117 
118  cairo_clip(cairo);
119 
120  {
121  const cairo::CairoSave cs(cairo);
122  cairo_rectangle(cairo,-r,-r,2*r,2*r);
123  cairo_clip(cairo);
124  if (m_editorMode)
125  {
126  cairo_scale(cairo,z,z);
127  CairoRenderer cr(cairo);
128  wrappedRavel.render(cr);
129  }
130  else
131  {
132  cairo_translate(cairo,-r,-r);
133  cairo_scale(cairo,2*r/svgRenderer.width(), 2*r/svgRenderer.height());
134  svgRenderer.render(cairo);
135  }
136  }
137  if (selected) drawSelected(cairo);
138  }
#define M_PI
some useful geometry types, defined from boost::geometry
Definition: geometry.h:29
void drawPorts(cairo_t *cairo) const
Definition: item.cc:294
virtual void displayTooltip(cairo_t *, const std::string &) const
display tooltip text, eg on mouseover
Definition: item.cc:398
bool flipped
Definition: ravelWrap.h:85
virtual float x() const
Definition: item.cc:107
virtual float y() const
Definition: item.cc:114
static SVGRenderer svgRenderer
SVG icon to display when not in editor mode.
Definition: ravelWrap.h:83
ravel::Ravel wrappedRavel
Definition: ravelWrap.h:80
virtual std::string const & tooltip() const
Definition: noteBase.h:36
virtual float zoomFactor() const
Definition: item.cc:121
double width() const
Definition: SVGItem.h:44
static void drawSelected(cairo_t *cairo)
Definition: item.cc:308
double height() const
Definition: SVGItem.h:45
bool m_editorMode
indicate whether icon is in editor mode or icon mode
Definition: ravelWrap.h:66
bool onBorder
true to indicate mouse hovering over border
Definition: item.h:176
std::shared_ptr< RavelLockGroup > lockGroup
group of ravels that move syncronously
Definition: ravelWrap.h:103
ItemPortVector m_ports
Definition: item.h:156
bool selected
true if selected for cut, copy or group operation
Definition: noteBase.h:32
bool mouseFocus
true if target of a mouseover
Definition: noteBase.h:31
void render(cairo_t *) const
Definition: SVGItem.cc:82
void drawTriangle(cairo_t *cairo, double x, double y, const ecolab::cairo::Colour &col, double angle=0)
static constexpr float r
Definition: operationBase.h:58
std::string explanation
Definition: ravelWrap.h:68
void drawResizeHandles(cairo_t *cairo) const override
Definition: item.cc:355
Here is the call graph for this function:

◆ editorMode()

bool minsky::Ravel::editorMode ( ) const
inlineoverridevirtual

indicate whether icon is in editor mode or icon mode

Reimplemented from minsky::Item.

Definition at line 218 of file ravelWrap.h.

218 {return m_editorMode;}
bool m_editorMode
indicate whether icon is in editor mode or icon mode
Definition: ravelWrap.h:66

◆ exportAsCSV()

void minsky::Ravel::exportAsCSV ( const std::string &  filename,
bool  tabular 
) const

export the plotted data as a CSV file

Parameters
tabular- if true, the longest dimension is split across columns as a horizontal dimension

Definition at line 498 of file ravelWrap.cc.

References minsky::TensorOpFactory::create(), minsky::OperationType::data, minsky::TensorsFromPort::ev, minsky::VariableValue::exportAsCSV(), minsky::VariableType::flow, minsky::ValueVector::flowVars, minsky::Item::itemPtrFromThis(), minsky::Item::m_ports, minsky::OperationType::size, minsky::ValueVector::stockVars, minsky::tensorOpFactory, and wrappedRavel.

499  {
500  if (!m_ports.empty())
501  if (auto vv=m_ports[0]->getVariableValue())
502  {
503  vv->exportAsCSV(filename, wrappedRavel.description(), tabular);
504  return;
505  }
506 
507  // if no variable value attached, create one
508  VariableValue v(VariableType::flow);
509  const TensorsFromPort tp(make_shared<EvalCommon>());
512  // TODO: add some comment lines, such as source of data
513  v.exportAsCSV(filename, wrappedRavel.description(), tabular);
514  }
static std::vector< double, CIVITA_ALLOCATOR< double > > stockVars
vector of variables that are integrated via Runge-Kutta. These variables label the columns of the God...
ravel::Ravel wrappedRavel
Definition: ravelWrap.h:80
std::shared_ptr< ITensor > create(const ItemPtr &, const TensorsFromPort &tp={})
create a tensor representation of the expression rooted at op. If expression doesn&#39;t contain any refe...
ItemPtr itemPtrFromThis() const
return a shared_ptr to this
Definition: item.cc:447
ItemPortVector m_ports
Definition: item.h:156
static std::vector< double, CIVITA_ALLOCATOR< double > > flowVars
variables defined as a simple function of the stock variables, also known as lhs variables. These variables appear in the body of the Godley table
TensorOpFactory tensorOpFactory
Here is the call graph for this function:

◆ getState()

ravel::RavelState minsky::Ravel::getState ( ) const
inline

get the current state of the Ravel

Definition at line 206 of file ravelWrap.h.

Referenced by minsky::RavelLockGroup::broadcast(), collapseAllHandles(), minsky::RavelTensor::operator[](), populateHypercube(), Ravel(), and minsky::RavelTensor::setArgument().

206 {return wrappedRavel? wrappedRavel.getRavelState(): initState;}
ravel::Ravel wrappedRavel
Definition: ravelWrap.h:80
ravel::RavelState initState
used entirely to defer persisted state data until after first load from a variable ...
Definition: ravelWrap.h:73
Here is the caller graph for this function:

◆ handleDescription()

std::string minsky::Ravel::handleDescription ( int  handle) const
inline

return the description field for handle handle.

Definition at line 189 of file ravelWrap.h.

Referenced by description(), dimension(), dimensionType(), dimensionUnitsFormat(), hypercube(), and setDimension().

189 {return wrappedRavel.handleDescription(handle);}
ravel::Ravel wrappedRavel
Definition: ravelWrap.h:80
Here is the caller graph for this function:

◆ handleNames()

std::vector<std::string> minsky::Ravel::handleNames ( ) const
inline

return all handle names

Definition at line 157 of file ravelWrap.h.

157  {
158  std::vector<std::string> r;
159  for (size_t i=0; i<wrappedRavel.numHandles(); ++i)
160  r.push_back(wrappedRavel.handleDescription(i));
161  return r;
162  }
ravel::Ravel wrappedRavel
Definition: ravelWrap.h:80
static constexpr float r
Definition: operationBase.h:58

◆ handleSetReduction()

void minsky::Ravel::handleSetReduction ( int  handle,
ravel::Op::ReductionOp  op 
)
inline

set the reduction type for handle

Definition at line 132 of file ravelWrap.h.

References minsky::op.

132 {wrappedRavel.handleSetReduction(handle, op);}
ravel::Ravel wrappedRavel
Definition: ravelWrap.h:80

◆ handleSortableByValue()

bool minsky::Ravel::handleSortableByValue ( ) const
Returns
true if currently selected handle is sortable by value

Definition at line 407 of file ravelWrap.cc.

References wrappedRavel.

408  {
409  if (wrappedRavel.rank()!=1) return false;
410  auto ids=wrappedRavel.outputHandleIds();
411  return size_t(wrappedRavel.selectedHandle())==ids[0];
412  }
ravel::Ravel wrappedRavel
Definition: ravelWrap.h:80

◆ hypercube()

Hypercube minsky::Ravel::hypercube ( ) const

return hypercube corresponding to the current Ravel state

Definition at line 182 of file ravelWrap.cc.

References axisDimensions, minsky::cminsky(), minsky::OperationBase::dimensions(), minsky::Minsky::dimensions, minsky::OperationBase::h, handleDescription(), and wrappedRavel.

183  {
184  auto outHandles=wrappedRavel.outputHandleIds();
185  Hypercube hc;
186  auto& xv=hc.xvectors;
187  for (auto h: outHandles)
188  {
189  auto labels=wrappedRavel.sliceLabels(h);
190  xv.emplace_back(handleDescription(h));
191  if (auto dim=axisDimensions.find(xv.back().name);
192  dim!=axisDimensions.end())
193  xv.back().dimension=dim->second;
194  else if (auto dim=cminsky().dimensions.find(xv.back().name);
195  dim!=cminsky().dimensions.end())
196  xv.back().dimension=dim->second;
197  // else otherwise dimension is a string (default type)
198  for (auto& i: labels)
199  xv.back().push_back(i);
200  }
201  return hc;
202  }
std::vector< std::string > dimensions() const
return dimension names of tensor object attached to input if binary op, then the union of dimension n...
Definition: operation.cc:348
ravel::Ravel wrappedRavel
Definition: ravelWrap.h:80
static constexpr float h
Definition: operationBase.h:58
const Minsky & cminsky()
const version to help in const correctness
Definition: minsky.h:549
std::string handleDescription(int handle) const
return the description field for handle handle.
Definition: ravelWrap.h:189
Dimensions axisDimensions
local override of axis dimensionality
Definition: ravelWrap.h:100
Dimensions dimensions
Definition: minsky.h:201
Here is the call graph for this function:

◆ inItem()

bool minsky::Ravel::inItem ( float  x,
float  y 
) const
overridevirtual
Returns
true if item internally responds to the mouse, and (x,y) is within editable area

Reimplemented from minsky::Item.

Definition at line 147 of file ravelWrap.cc.

References m_editorMode, minsky::OperationBase::r, wrappedRavel, minsky::Item::x(), minsky::Item::y(), and minsky::Item::zoomFactor().

148  {
149  if (m_editorMode)
150  {
151  const float r=1.1*zoomFactor()*wrappedRavel.radius();
152  return std::abs(xx-x())<=r && std::abs(yy-y())<=r;
153  }
154  return false;
155  }
virtual float x() const
Definition: item.cc:107
virtual float y() const
Definition: item.cc:114
ravel::Ravel wrappedRavel
Definition: ravelWrap.h:80
virtual float zoomFactor() const
Definition: item.cc:121
bool m_editorMode
indicate whether icon is in editor mode or icon mode
Definition: ravelWrap.h:66
static constexpr float r
Definition: operationBase.h:58
Here is the call graph for this function:

◆ joinLockGroup()

void minsky::Ravel::joinLockGroup ( unsigned  colour)

Definition at line 586 of file ravelWrap.cc.

References minsky::cminsky(), minsky::Item::itemPtrFromThis(), minsky::GroupItems::items, leaveLockGroup(), lockGroup, minsky::Minsky::model, and minsky::OperationType::ravel.

587  {
588  cminsky().model->recursiveDo(&GroupItems::items, [this,colour](Items&, Items::iterator i) {
589  if (auto ravel=(*i)->ravelCast(); ravel && ravel->lockGroup && ravel->lockGroup->colour()==colour)
590  {
591  leaveLockGroup();
592  auto ravelPtr=dynamic_pointer_cast<Ravel>(itemPtrFromThis());
593  if (ravelPtr)
594  {
595  lockGroup=ravel->lockGroup;
596  lockGroup->addRavel(ravelPtr);
597  return true;
598  }
599  }
600  return false;
601  });
602  }
void leaveLockGroup()
Definition: ravelWrap.cc:563
std::vector< ItemPtr > Items
Definition: item.h:366
ItemPtr itemPtrFromThis() const
return a shared_ptr to this
Definition: item.cc:447
const Minsky & cminsky()
const version to help in const correctness
Definition: minsky.h:549
std::shared_ptr< RavelLockGroup > lockGroup
group of ravels that move syncronously
Definition: ravelWrap.h:103
GroupPtr model
Definition: minsky.h:255
Here is the call graph for this function:

◆ leaveLockGroup()

void minsky::Ravel::leaveLockGroup ( )

Definition at line 563 of file ravelWrap.cc.

References lockGroup.

Referenced by joinLockGroup().

564  {
565  if (lockGroup)
566  lockGroup->removeFromGroup(*this);
567  lockGroup.reset();
568  }
std::shared_ptr< RavelLockGroup > lockGroup
group of ravels that move syncronously
Definition: ravelWrap.h:103
Here is the caller graph for this function:

◆ lockGroupColours()

vector< unsigned > minsky::Ravel::lockGroupColours ( )
static

Definition at line 575 of file ravelWrap.cc.

References minsky::cminsky(), minsky::GroupItems::items, minsky::Minsky::model, minsky::OperationBase::r, and minsky::OperationType::ravel.

576  {
577  set<unsigned> r;
578  cminsky().model->recursiveDo(&GroupItems::items, [&r](Items&, Items::iterator i) {
579  if (auto ravel=(*i)->ravelCast(); ravel && ravel->lockGroup)
580  r.insert(ravel->lockGroup->colour());
581  return false;
582  });
583  return {r.begin(),r.end()};
584  }
std::vector< ItemPtr > Items
Definition: item.h:366
const Minsky & cminsky()
const version to help in const correctness
Definition: minsky.h:549
static constexpr float r
Definition: operationBase.h:58
GroupPtr model
Definition: minsky.h:255
Here is the call graph for this function:

◆ maxRank()

unsigned minsky::Ravel::maxRank ( ) const
inline
Returns
input rank (aka numHandles)

Definition at line 119 of file ravelWrap.h.

119 {return wrappedRavel.numHandles();}
ravel::Ravel wrappedRavel
Definition: ravelWrap.h:80

◆ nextReduction()

void minsky::Ravel::nextReduction ( ravel::Op::ReductionOp  op)
inline

sets the type of the next reduction operation

Definition at line 130 of file ravelWrap.h.

References minsky::op.

130 {m_nextReduction=op; wrappedRavel.nextReduction(op);}
ravel::Ravel wrappedRavel
Definition: ravelWrap.h:80
ravel::Op::ReductionOp m_nextReduction
Definition: ravelWrap.h:81

◆ numHandles()

unsigned minsky::Ravel::numHandles ( ) const
inline

Definition at line 120 of file ravelWrap.h.

Referenced by pickSliceLabels(), and units().

120 {return wrappedRavel.numHandles();}
ravel::Ravel wrappedRavel
Definition: ravelWrap.h:80
Here is the caller graph for this function:

◆ numSliceLabels()

size_t minsky::Ravel::numSliceLabels ( size_t  axis) const
inline

number of slice labels along axis axis

Definition at line 122 of file ravelWrap.h.

Referenced by populateHypercube(), and units().

122 {return wrappedRavel.numSliceLabels(axis);}
ravel::Ravel wrappedRavel
Definition: ravelWrap.h:80
std::string axis
axis selector in tensor operations
Definition: operationBase.h:95
Here is the caller graph for this function:

◆ onKeyPress()

bool minsky::Ravel::onKeyPress ( int  keySym,
const std::string &  utf8,
int  state 
)
overridevirtual

respond to key press events

Returns
true if it needs to be rerendered

Reimplemented from minsky::Item.

Definition at line 247 of file ravelWrap.cc.

References adjustSlicer(), minsky::minsky(), and minsky::Minsky::requestReset().

Referenced by minsky::RavelPopup::keyPress().

248  {
249  switch (keySym)
250  {
251  case 0xff52: case 0xff53: //Right, Up
252  adjustSlicer(1);
253  break;
254  case 0xff51: case 0xff54: //Left, Down
255  adjustSlicer(-1);
256  break;
257  default:
258  return false;
259  }
260  minsky().requestReset();
261  return true;
262  }
void requestReset()
Definition: minsky.cc:467
void adjustSlicer(int)
adjust currently selected handle&#39;s slicer
Definition: ravelWrap.cc:240
Minsky & minsky()
global minsky object
Definition: minskyTCL.cc:51
Here is the call graph for this function:
Here is the caller graph for this function:

◆ onMouseDown()

void minsky::Ravel::onMouseDown ( float  x,
float  y 
)
overridevirtual

respond to mouse down events

Reimplemented from minsky::Item.

Definition at line 157 of file ravelWrap.cc.

References wrappedRavel, minsky::Item::x(), minsky::Item::y(), and minsky::Item::zoomFactor().

158  {
159  const double invZ=1/zoomFactor();
160  wrappedRavel.onMouseDown((xx-x())*invZ,(yy-y())*invZ);
161  }
virtual float x() const
Definition: item.cc:107
virtual float y() const
Definition: item.cc:114
ravel::Ravel wrappedRavel
Definition: ravelWrap.h:80
virtual float zoomFactor() const
Definition: item.cc:121
Here is the call graph for this function:

◆ onMouseLeave()

void minsky::Ravel::onMouseLeave ( )
inlineoverridevirtual

respond to mouse leave events (when mouse leaves item)

Reimplemented from minsky::Item.

Definition at line 114 of file ravelWrap.h.

114 {wrappedRavel.onMouseLeave();}
ravel::Ravel wrappedRavel
Definition: ravelWrap.h:80

◆ onMouseMotion()

bool minsky::Ravel::onMouseMotion ( float  x,
float  y 
)
overridevirtual

respond to mouse motion events with button pressed

Returns
true if it needs to be rerendered

Reimplemented from minsky::Item.

Definition at line 170 of file ravelWrap.cc.

References wrappedRavel, minsky::Item::x(), minsky::Item::y(), and minsky::Item::zoomFactor().

171  {
172  const double invZ=1/zoomFactor();
173  return wrappedRavel.onMouseMotion((xx-x())*invZ,(yy-y())*invZ);
174  }
virtual float x() const
Definition: item.cc:107
virtual float y() const
Definition: item.cc:114
ravel::Ravel wrappedRavel
Definition: ravelWrap.h:80
virtual float zoomFactor() const
Definition: item.cc:121
Here is the call graph for this function:

◆ onMouseOver()

bool minsky::Ravel::onMouseOver ( float  x,
float  y 
)
overridevirtual

respond to mouse motion events (hover) without button pressed

Returns
true if it needs to be rerendered

Reimplemented from minsky::Item.

Definition at line 176 of file ravelWrap.cc.

References wrappedRavel, minsky::Item::x(), minsky::Item::y(), and minsky::Item::zoomFactor().

177  {
178  const double invZ=1/zoomFactor();
179  return wrappedRavel.onMouseOver((xx-x())*invZ,(yy-y())*invZ);
180  }
virtual float x() const
Definition: item.cc:107
virtual float y() const
Definition: item.cc:114
ravel::Ravel wrappedRavel
Definition: ravelWrap.h:80
virtual float zoomFactor() const
Definition: item.cc:121
Here is the call graph for this function:

◆ onMouseUp()

void minsky::Ravel::onMouseUp ( float  x,
float  y 
)
overridevirtual

respond to mouse up events

Reimplemented from minsky::Item.

Definition at line 163 of file ravelWrap.cc.

References broadcastStateToLockGroup(), resortHandleIfDynamic(), wrappedRavel, minsky::Item::x(), minsky::Item::y(), and minsky::Item::zoomFactor().

164  {
165  const double invZ=1/zoomFactor();
166  wrappedRavel.onMouseUp((xx-x())*invZ,(yy-y())*invZ);
169  }
virtual float x() const
Definition: item.cc:107
virtual float y() const
Definition: item.cc:114
void broadcastStateToLockGroup() const
Definition: ravelWrap.cc:570
ravel::Ravel wrappedRavel
Definition: ravelWrap.h:80
virtual float zoomFactor() const
Definition: item.cc:121
void resortHandleIfDynamic()
Definition: ravelWrap.cc:372
Here is the call graph for this function:

◆ operator=()

void minsky::Ravel::operator= ( const Ravel )
inline

Definition at line 89 of file ravelWrap.h.

89 {}

◆ pickedSliceLabels() [1/2]

vector< string > minsky::Ravel::pickedSliceLabels ( ) const

returns just the picked slice labels along the handle

Definition at line 312 of file ravelWrap.cc.

References wrappedRavel.

313  {return pickedSliceLabels(wrappedRavel.selectedHandle());}
ravel::Ravel wrappedRavel
Definition: ravelWrap.h:80
std::vector< std::string > pickedSliceLabels() const
returns just the picked slice labels along the handle
Definition: ravelWrap.cc:312

◆ pickedSliceLabels() [2/2]

vector< string > minsky::Ravel::pickedSliceLabels ( int  axis) const

Definition at line 309 of file ravelWrap.cc.

References minsky::OperationBase::axis, and wrappedRavel.

310  {return wrappedRavel.sliceLabels(axis);}
ravel::Ravel wrappedRavel
Definition: ravelWrap.h:80
std::string axis
axis selector in tensor operations
Definition: operationBase.h:95

◆ pickSliceLabels()

void minsky::Ravel::pickSliceLabels ( int  axis,
const std::vector< std::string > &  pick 
)

pick (selected) pick labels

Definition at line 315 of file ravelWrap.cc.

References minsky::OperationBase::axis, broadcastStateToLockGroup(), minsky::minsky(), numHandles(), minsky::Minsky::requestReset(), and wrappedRavel.

316  {
317  if (axis>=0 && axis<int(numHandles()))
318  {
319  vector<size_t> customOrder, currentOrder=wrappedRavel.currentPermutation(axis);
320  auto allLabels=wrappedRavel.allSliceLabels(axis, ravel::HandleSort::none);
321  map<string,size_t> idxMap; // map index positions
322  for (size_t i=0; i<allLabels.size(); ++i)
323  idxMap[allLabels[i]]=i;
324  set<string> picked(pick.begin(), pick.end());
325  for (auto i: currentOrder)
326  {
327  auto pickedIter=picked.find(allLabels[i]);
328  if (pickedIter==picked.end()) continue;
329  picked.erase(pickedIter);
330  customOrder.push_back(i);
331  }
332  // add remaining picked labels to end of permutation
333  for (auto& i: picked)
334  {
335  auto j=idxMap.find(i);
336  if (j!=idxMap.end())
337  customOrder.push_back(j->second);
338  }
339  assert(!customOrder.empty());
340  wrappedRavel.applyCustomPermutation(axis,customOrder);
342  minsky().requestReset();
343  }
344  }
void requestReset()
Definition: minsky.cc:467
void broadcastStateToLockGroup() const
Definition: ravelWrap.cc:570
ravel::Ravel wrappedRavel
Definition: ravelWrap.h:80
std::string axis
axis selector in tensor operations
Definition: operationBase.h:95
Minsky & minsky()
global minsky object
Definition: minskyTCL.cc:51
unsigned numHandles() const
Definition: ravelWrap.h:120
Here is the call graph for this function:

◆ populateHypercube()

void minsky::Ravel::populateHypercube ( const Hypercube &  hc)

Definition at line 204 of file ravelWrap.cc.

References applyState(), getState(), initState, numSliceLabels(), setRank(), and wrappedRavel.

205  {
206  if (!wrappedRavel) return;
207  auto state=initState.empty()? getState(): initState;
208  const bool redistribute=!initState.empty();
209  initState.clear();
210  wrappedRavel.populateFromHypercube(hc);
211  if (state.empty())
212  {
213  setRank(hc.rank());
214  }
215  else
216  {
217  applyState(state);
218  if (redistribute) wrappedRavel.redistributeHandles();
219  }
220 #ifndef NDEBUG
221  if (static_cast<ravel::Ravel&>(wrappedRavel) && state.empty())
222  {
223  auto d=hc.dims();
224  assert(d.size()==wrappedRavel.rank());
225  auto outputHandles=wrappedRavel.outputHandleIds();
226  for (size_t i=0; i<d.size(); ++i)
227  assert(d[i]==numSliceLabels(outputHandles[i]));
228  }
229 #endif
230  }
ravel::RavelState getState() const
get the current state of the Ravel
Definition: ravelWrap.h:206
void applyState(const ravel::RavelState &state)
apply the state to the Ravel, leaving data, slicelabels etc unchanged
Definition: ravelWrap.cc:535
ravel::Ravel wrappedRavel
Definition: ravelWrap.h:80
ravel::RavelState initState
used entirely to defer persisted state data until after first load from a variable ...
Definition: ravelWrap.h:73
size_t numSliceLabels(size_t axis) const
number of slice labels along axis axis
Definition: ravelWrap.h:122
void setRank(unsigned r)
adjust output dimensions to first r handles
Definition: ravelWrap.cc:233
Here is the call graph for this function:

◆ radius()

double minsky::Ravel::radius ( ) const
inline

Definition at line 97 of file ravelWrap.h.

97 {return wrappedRavel.radius();}
ravel::Ravel wrappedRavel
Definition: ravelWrap.h:80

◆ ravelCast() [1/2]

const Ravel* minsky::Ravel::ravelCast ( ) const
inlineoverride

Definition at line 94 of file ravelWrap.h.

94 {return this;}

◆ ravelCast() [2/2]

Ravel* minsky::Ravel::ravelCast ( )
inlineoverride

Definition at line 95 of file ravelWrap.h.

95 {return this;}

◆ redistributeHandles()

void minsky::Ravel::redistributeHandles ( )
inline

redistribute handles according to current state

Definition at line 128 of file ravelWrap.h.

128 {wrappedRavel.redistributeHandles();}
ravel::Ravel wrappedRavel
Definition: ravelWrap.h:80

◆ resize()

void minsky::Ravel::resize ( const LassoBox b)
overridevirtual

resize this item on the canvas

Reimplemented from minsky::OperationBase.

Definition at line 140 of file ravelWrap.cc.

References minsky::Item::bb, minsky::Item::moveTo(), minsky::BoundingBox::update(), wrappedRavel, minsky::LassoBox::x0, minsky::LassoBox::x1, minsky::LassoBox::y0, minsky::LassoBox::y1, and minsky::Item::zoomFactor().

141  {
142  wrappedRavel.rescale(0.5*std::max(fabs(b.x0-b.x1),fabs(b.y0-b.y1))/(1.21*zoomFactor()));
143  moveTo(0.5*(b.x0+b.x1), 0.5*(b.y0+b.y1));
144  bb.update(*this);
145  }
ravel::Ravel wrappedRavel
Definition: ravelWrap.h:80
BoundingBox bb
canvas bounding box.
Definition: item.h:195
virtual float zoomFactor() const
Definition: item.cc:121
void update(const Item &x)
Definition: item.cc:46
void moveTo(float x, float y)
Definition: item.cc:256
Here is the call graph for this function:

◆ resortHandleIfDynamic()

void minsky::Ravel::resortHandleIfDynamic ( )

Definition at line 372 of file ravelWrap.cc.

References sortByValue(), and wrappedRavel.

Referenced by adjustSlicer(), and onMouseUp().

373  {
374  if (wrappedRavel.rank()==1)
375  {
376  const int outputHandleId=wrappedRavel.outputHandleIds()[0];
377  auto hs=wrappedRavel.getHandleState(outputHandleId);
378  switch (hs.order)
379  {
380  case ravel::HandleSort::dynamicForward:
381  case ravel::HandleSort::dynamicReverse:
382  {
383  auto calipers=wrappedRavel.getCaliperPositions(outputHandleId);
384  // sortByValue of the whole range of the dimension
385  wrappedRavel.displayFilterCaliper(outputHandleId,false);
386  sortByValue(hs.order);
387  wrappedRavel.displayFilterCaliper(outputHandleId,hs.displayFilterCaliper);
388  wrappedRavel.setCaliperPositions(outputHandleId,calipers.first,calipers.second);
389  }
390  break;
391  default:
392  break;
393  }
394  }
395  }
ravel::Ravel wrappedRavel
Definition: ravelWrap.h:80
void sortByValue(ravel::HandleSort::Order dir)
Sort handle by value. Only applicable for rank 1 ravels.
Definition: ravelWrap.cc:414
Here is the call graph for this function:
Here is the caller graph for this function:

◆ selectedHandle()

int minsky::Ravel::selectedHandle ( ) const
inline

current handle mouse is over, or -1 if none

Definition at line 134 of file ravelWrap.h.

Referenced by dimensionType(), dimensionUnitsFormat(), and setDimension().

134 {return wrappedRavel.selectedHandle();}
ravel::Ravel wrappedRavel
Definition: ravelWrap.h:80
Here is the caller graph for this function:

◆ setDescription()

void minsky::Ravel::setDescription ( const std::string &  description)

Definition at line 430 of file ravelWrap.cc.

References description(), and wrappedRavel.

431  {
432  wrappedRavel.setHandleDescription(wrappedRavel.selectedHandle(),description);
433  }
ravel::Ravel wrappedRavel
Definition: ravelWrap.h:80
std::string description() const
Definition: ravelWrap.cc:425
Here is the call graph for this function:

◆ setDimension() [1/2]

void minsky::Ravel::setDimension ( Dimension::Type  type,
const std::string &  units 
)
Exceptions
iftype does not match global dimension type

Definition at line 472 of file ravelWrap.cc.

References selectedHandle(), minsky::Operation< OperationType::ravel >::type(), and units().

473  {
475  }
int selectedHandle() const
current handle mouse is over, or -1 if none
Definition: ravelWrap.h:134
void setDimension(Dimension::Type type, const std::string &units)
Definition: ravelWrap.cc:472
Units units(bool) const override
compute the dimensional units
Definition: ravelWrap.cc:516
Here is the call graph for this function:

◆ setDimension() [2/2]

void minsky::Ravel::setDimension ( int  handleIndex,
Dimension::Type  type,
const std::string &  units 
)
Exceptions
iftype does not match global dimension type

Definition at line 478 of file ravelWrap.cc.

References axisDimensions, minsky::cminsky(), minsky::OperationBase::dimensions(), minsky::Minsky::dimensions, handleDescription(), minsky::Minsky::imposeDimensions(), minsky::minsky(), minsky::Operation< OperationType::ravel >::type(), and units().

479  {
480  auto descr=handleDescription(handleIndex);
481  if (descr.empty()) return;
482  auto i=cminsky().dimensions.find(descr);
483  const Dimension d{type,units};
484  if (i!=cminsky().dimensions.end())
485  {
486  if (type!=i->second.type)
487  throw error("type mismatch with global dimension");
488  }
489  else
490  {
491  minsky().dimensions[descr]=d;
493  }
494  axisDimensions[descr]=d;
495  }
std::vector< std::string > dimensions() const
return dimension names of tensor object attached to input if binary op, then the union of dimension n...
Definition: operation.cc:348
const Minsky & cminsky()
const version to help in const correctness
Definition: minsky.h:549
std::string handleDescription(int handle) const
return the description field for handle handle.
Definition: ravelWrap.h:189
Minsky & minsky()
global minsky object
Definition: minskyTCL.cc:51
void imposeDimensions()
Definition: minsky.cc:365
Dimensions axisDimensions
local override of axis dimensionality
Definition: ravelWrap.h:100
Units units(bool) const override
compute the dimensional units
Definition: ravelWrap.cc:516
Dimensions dimensions
Definition: minsky.h:201
Here is the call graph for this function:

◆ setDisplayFilterCaliper()

bool minsky::Ravel::setDisplayFilterCaliper ( bool  x)

Definition at line 291 of file ravelWrap.cc.

References minsky::OperationBase::h, wrappedRavel, and minsky::Item::x().

292  {
293  const int h=wrappedRavel.selectedHandle();
294  if (h>=0)
295  wrappedRavel.displayFilterCaliper(h,x);
296  return x;
297  }
virtual float x() const
Definition: item.cc:107
ravel::Ravel wrappedRavel
Definition: ravelWrap.h:80
static constexpr float h
Definition: operationBase.h:58
Here is the call graph for this function:

◆ setHandleDescription()

void minsky::Ravel::setHandleDescription ( int  handle,
const std::string &  description 
)
inline

set the description field for handle

Definition at line 191 of file ravelWrap.h.

192  {wrappedRavel.setHandleDescription(handle,description);}
ravel::Ravel wrappedRavel
Definition: ravelWrap.h:80
std::string description() const
Definition: ravelWrap.cc:425

◆ setHandleSortOrder()

ravel::HandleSort::Order minsky::Ravel::setHandleSortOrder ( ravel::HandleSort::Order  order,
int  handle 
)

set a given handle sort order

Definition at line 397 of file ravelWrap.cc.

References dimension(), and wrappedRavel.

Referenced by setSortOrder().

398  {
399  if (handle>=0)
400  {
401  const Dimension dim=dimension(handle);
402  wrappedRavel.orderLabels(handle,order);
403  }
404  return order;
405  }
ravel::Ravel wrappedRavel
Definition: ravelWrap.h:80
Dimension dimension(int handle) const
dimension details associated with handle
Definition: ravelWrap.cc:346
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setRank()

void minsky::Ravel::setRank ( unsigned  r)

adjust output dimensions to first r handles

Definition at line 233 of file ravelWrap.cc.

References wrappedRavel.

Referenced by populateHypercube().

234  {
235  vector<size_t> ids;
236  for (size_t i=0; i<rank; ++i) ids.push_back(i);
237  wrappedRavel.setOutputHandleIds(ids);
238  }
ravel::Ravel wrappedRavel
Definition: ravelWrap.h:80
Here is the caller graph for this function:

◆ setSortOrder()

ravel::HandleSort::Order minsky::Ravel::setSortOrder ( ravel::HandleSort::Order  x)

the handle sorting order for currently selected handle

Definition at line 366 of file ravelWrap.cc.

References setHandleSortOrder(), wrappedRavel, and minsky::Item::x().

367  {
368  setHandleSortOrder(x, wrappedRavel.selectedHandle());
369  return x;
370  }
virtual float x() const
Definition: item.cc:107
ravel::Ravel wrappedRavel
Definition: ravelWrap.h:80
ravel::HandleSort::Order setHandleSortOrder(ravel::HandleSort::Order, int handle)
set a given handle sort order
Definition: ravelWrap.cc:397
Here is the call graph for this function:

◆ sortByValue()

void minsky::Ravel::sortByValue ( ravel::HandleSort::Order  dir)

Sort handle by value. Only applicable for rank 1 ravels.

Parameters
dirdirection to sort (forward/reverse, all other cases ignored)

Definition at line 414 of file ravelWrap.cc.

References minsky::Item::m_ports, minsky::minsky(), minsky::Minsky::requestReset(), and wrappedRavel.

Referenced by resortHandleIfDynamic().

415  {
416  if (wrappedRavel.rank()!=1) return;
417  try {minsky().requestReset();} catch (...) {throw runtime_error("Cannot sort handle at the moment");}
418  auto vv=m_ports[1]->getVariableValue();
419  if (!vv)
420  throw runtime_error("Cannot sort handle at the moment");
421  wrappedRavel.sortByValue(vv, dir);
422  }
void requestReset()
Definition: minsky.cc:467
ravel::Ravel wrappedRavel
Definition: ravelWrap.h:80
ItemPortVector m_ports
Definition: item.h:156
Minsky & minsky()
global minsky object
Definition: minskyTCL.cc:51
Here is the call graph for this function:
Here is the caller graph for this function:

◆ sortOrder()

ravel::HandleSort::Order minsky::Ravel::sortOrder ( ) const

the handle sorting order for currently selected handle

Definition at line 355 of file ravelWrap.cc.

References minsky::OperationBase::h, and wrappedRavel.

356  {
357  const int h=wrappedRavel.selectedHandle();
358  if (h>=0)
359  {
360  auto state=wrappedRavel.getHandleState(h);
361  return state.order;
362  }
363  return ravel::HandleSort::none;
364  }
ravel::Ravel wrappedRavel
Definition: ravelWrap.h:80
static constexpr float h
Definition: operationBase.h:58

◆ toggleDisplayFilterCaliper()

bool minsky::Ravel::toggleDisplayFilterCaliper ( )
inline

Definition at line 142 of file ravelWrap.h.

bool displayFilterCaliper() const
enable/disable calipers on currently selected handle
Definition: ravelWrap.cc:280
bool setDisplayFilterCaliper(bool x)
Definition: ravelWrap.cc:291

◆ toggleEditorMode()

void minsky::Ravel::toggleEditorMode ( )
inlineoverridevirtual

Reimplemented from minsky::Item.

Definition at line 219 of file ravelWrap.h.

bool m_editorMode
indicate whether icon is in editor mode or icon mode
Definition: ravelWrap.h:66
void updateBoundingBox() override
Definition: item.h:201

◆ units()

Units minsky::Ravel::units ( bool  check) const
overridevirtual

compute the dimensional units

Parameters
check- if true, then perform consistency checks
Exceptions
ifcheck=true and dimensions inconsistent

Reimplemented from minsky::OperationBase.

Definition at line 516 of file ravelWrap.cc.

References minsky::OperationBase::h, minsky::Item::m_ports, numHandles(), numSliceLabels(), and wrappedRavel.

Referenced by setDimension().

517  {
518  Units inputUnits=m_ports[1]->units(check);
519  if (inputUnits.empty()) return inputUnits;
520  size_t multiplier=1;
521  // at this stage, gross up exponents by the handle size of each
522  // reduced by product handles
523  for (size_t h=0; h<numHandles(); ++h)
524  {
525  auto state=wrappedRavel.getHandleState(h);
526  if (state.collapsed && state.reductionOp==ravel::Op::prod)
527  multiplier*=numSliceLabels(h);
528  }
529  if (multiplier>1)
530  for (auto& u: inputUnits)
531  u.second*=multiplier;
532  return inputUnits;
533  }
ravel::Ravel wrappedRavel
Definition: ravelWrap.h:80
static constexpr float h
Definition: operationBase.h:58
ItemPortVector m_ports
Definition: item.h:156
size_t numSliceLabels(size_t axis) const
number of slice labels along axis axis
Definition: ravelWrap.h:122
unsigned numHandles() const
Definition: ravelWrap.h:120
Here is the call graph for this function:
Here is the caller graph for this function:

Friends And Related Function Documentation

◆ SchemaHelper

friend struct SchemaHelper
friend

Definition at line 75 of file ravelWrap.h.

Member Data Documentation

◆ axisDimensions

Dimensions minsky::Ravel::axisDimensions

local override of axis dimensionality

Definition at line 100 of file ravelWrap.h.

Referenced by dimensionType(), dimensionUnitsFormat(), hypercube(), and setDimension().

◆ explanation

std::string minsky::Ravel::explanation
private

Definition at line 68 of file ravelWrap.h.

Referenced by displayDelayedTooltip(), and draw().

◆ flipped

bool minsky::Ravel::flipped =false

Definition at line 85 of file ravelWrap.h.

Referenced by draw().

◆ initState

ravel::RavelState minsky::Ravel::initState
private

used entirely to defer persisted state data until after first load from a variable

Definition at line 73 of file ravelWrap.h.

Referenced by applyState(), minsky::SchemaHelper::initHandleState(), and populateHypercube().

◆ lockGroup

std::shared_ptr<RavelLockGroup> minsky::Ravel::lockGroup

group of ravels that move syncronously

Definition at line 103 of file ravelWrap.h.

Referenced by broadcastStateToLockGroup(), draw(), joinLockGroup(), and leaveLockGroup().

◆ m_editorMode

bool minsky::Ravel::m_editorMode =false
private

indicate whether icon is in editor mode or icon mode

Definition at line 66 of file ravelWrap.h.

Referenced by draw(), inItem(), and Ravel().

◆ m_nextReduction

ravel::Op::ReductionOp minsky::Ravel::m_nextReduction =ravel::Op::sum
private

Definition at line 81 of file ravelWrap.h.

Referenced by collapseAllHandles().

◆ moveSz

const double minsky::Ravel::moveSz =0.1
private

Definition at line 63 of file ravelWrap.h.

◆ moveX

const double minsky::Ravel::moveX =0.5
private

position of the "move" handle, as a proportion of radius

Definition at line 63 of file ravelWrap.h.

◆ moveY

const double minsky::Ravel::moveY =0.5
private

Definition at line 63 of file ravelWrap.h.

◆ popup

RavelPopup minsky::Ravel::popup

popup Ravel control window

Definition at line 84 of file ravelWrap.h.

◆ previousOrder

ravel::HandleSort::Order minsky::Ravel::previousOrder =ravel::HandleSort::forward
private

Definition at line 69 of file ravelWrap.h.

◆ RavelPopup

friend minsky::Ravel::RavelPopup
private

Definition at line 76 of file ravelWrap.h.

◆ svgRenderer

SVGRenderer minsky::Ravel::svgRenderer
static

SVG icon to display when not in editor mode.

Definition at line 83 of file ravelWrap.h.

Referenced by draw(), and minsky::Minsky::setRavelIconResource().

◆ wrappedRavel


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