Minsky: 3.17.0
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 RESTProcess (classdesc::RESTProcess_t &rp, const std::string &d) override
 
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
 
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 ()=default
 
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
 
ravelCAPI::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 =20
 
double m_height =20
 
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:55
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:242
Minsky & minsky()
global minsky object
Definition: addon.cc:545
virtual std::string const & detailedText() const
Definition: noteBase.h:34
ravelCAPI::Ravel wrappedRavel
Definition: ravelWrap.h:80
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:534
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 239 of file ravelWrap.cc.

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

Referenced by onKeyPress().

240  {
241  wrappedRavel.adjustSlicer(n);
244  }
void broadcastStateToLockGroup() const
Definition: ravelWrap.cc:569
void resortHandleIfDynamic()
Definition: ravelWrap.cc:371
ravelCAPI::Ravel wrappedRavel
Definition: ravelWrap.h:80
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 298 of file ravelWrap.cc.

References wrappedRavel.

299  {
300  return wrappedRavel.allSliceLabels(wrappedRavel.selectedHandle(),ravel::HandleSort::forward);
301  }
ravelCAPI::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 303 of file ravelWrap.cc.

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

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

◆ 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 534 of file ravelWrap.cc.

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

Referenced by collapseAllHandles(), and populateHypercube().

535  {
536  if (!wrappedRavel) {
537  initState=state;
538  return;
539  }
540  auto r=wrappedRavel.radius();
541  wrappedRavel.setRavelState(state);
542  if (state.radius!=r) // only need to update bounding box if radius changes
544  }
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:198
static constexpr float r
Definition: operationBase.h:53
ravelCAPI::Ravel wrappedRavel
Definition: ravelWrap.h:80
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 569 of file ravelWrap.cc.

References lockGroup.

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

570  {
571  if (lockGroup) lockGroup->broadcast(*this);
572  }
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 263 of file ravelWrap.cc.

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

264  {
265  auto state=getState();
266  for (auto& h: state.handleStates)
267  if (collapse && !h.collapsed)
268  {
269  h.reductionOp=m_nextReduction;
270  h.collapsed=true;
271  }
272  else if (!collapse && h.collapsed)
273  h.collapsed=false;
274  applyState(state);
275  minsky().requestReset();
276  }
void requestReset()
Definition: minsky.cc:466
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:534
static constexpr float h
Definition: operationBase.h:53
ravel::Op::ReductionOp m_nextReduction
Definition: ravelWrap.h:81
Minsky & minsky()
global minsky object
Definition: addon.cc:545
Here is the call graph for this function:

◆ description()

string minsky::Ravel::description ( ) const

Definition at line 424 of file ravelWrap.cc.

References handleDescription(), and wrappedRavel.

Referenced by setDescription().

425  {
426  return handleDescription(wrappedRavel.selectedHandle());
427  }
std::string handleDescription(int handle) const
return the description field for handle handle.
Definition: ravelWrap.h:189
ravelCAPI::Ravel wrappedRavel
Definition: ravelWrap.h:80
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 345 of file ravelWrap.cc.

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

Referenced by setHandleSortOrder().

346  {
347  Dimension dim;
348  auto dimitr=cminsky().dimensions.find(handleDescription(handle));
349  if (dimitr!=cminsky().dimensions.end())
350  dim=dimitr->second;
351  return dim;
352  }
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:538
std::string handleDescription(int handle) const
return the description field for handle handle.
Definition: ravelWrap.h:189
Dimensions dimensions
Definition: minsky.h:189
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 434 of file ravelWrap.cc.

References selectedHandle().

435  {
436  return dimensionType(selectedHandle());
437  }
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:434
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 439 of file ravelWrap.cc.

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

440  {
441  auto descr=handleDescription(handleIndex);
442 
443  if (auto i=axisDimensions.find(descr); i!=axisDimensions.end())
444  return i->second.type;
445 
446  if (auto i=cminsky().dimensions.find(descr); i!=cminsky().dimensions.end())
447  return i->second.type;
448 
449  return Dimension::string;
450  }
const Minsky & cminsky()
const version to help in const correctness
Definition: minsky.h:538
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:189
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 452 of file ravelWrap.cc.

References selectedHandle().

453  {
455  }
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:452
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 457 of file ravelWrap.cc.

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

458  {
459  auto descr=handleDescription(handleIndex);
460  if (descr.empty()) return "";
461  auto i=axisDimensions.find(descr);
462  if (i!=axisDimensions.end())
463  return i->second.units;
464  i=cminsky().dimensions.find(descr);
465  if (i!=cminsky().dimensions.end())
466  return i->second.units;
467  return "";
468  }
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:538
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:189
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 547 of file ravelWrap.cc.

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

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

◆ displayFilterCaliper()

bool minsky::Ravel::displayFilterCaliper ( ) const

enable/disable calipers on currently selected handle

Definition at line 279 of file ravelWrap.cc.

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

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

◆ 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, 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(), 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  svgRenderer.render(cairo,2*r,2*r);
134  }
135  }
136  if (selected) drawSelected(cairo);
137  }
#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
virtual std::string const & tooltip() const
Definition: noteBase.h:36
virtual float zoomFactor() const
Definition: item.cc:121
static void drawSelected(cairo_t *cairo)
Definition: item.cc:308
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:173
std::shared_ptr< RavelLockGroup > lockGroup
group of ravels that move syncronously
Definition: ravelWrap.h:103
ItemPortVector m_ports
Definition: item.h:154
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 drawTriangle(cairo_t *cairo, double x, double y, const ecolab::cairo::Colour &col, double angle=0)
static constexpr float r
Definition: operationBase.h:53
std::string explanation
Definition: ravelWrap.h:68
void drawResizeHandles(cairo_t *cairo) const override
Definition: item.cc:355
void render(cairo_t *, double width, double height) const
render SVG into region of size width height
Definition: SVGItem.cc:84
ravelCAPI::Ravel wrappedRavel
Definition: ravelWrap.h:80
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 497 of file ravelWrap.cc.

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

498  {
499  if (!m_ports.empty())
500  if (auto vv=m_ports[0]->getVariableValue())
501  {
502  vv->exportAsCSV(filename, wrappedRavel.description(), tabular);
503  return;
504  }
505 
506  // if no variable value attached, create one
507  VariableValue v(VariableType::flow); v.hypercube(hypercube());
508  const TensorsFromPort tp(make_shared<EvalCommon>());
511  // TODO: add some comment lines, such as source of data
512  v.exportAsCSV(filename, wrappedRavel.description(), tabular);
513  }
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...
Hypercube hypercube() const
return hypercube corresponding to the current Ravel state
Definition: ravelWrap.cc:181
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:154
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
ravelCAPI::Ravel wrappedRavel
Definition: ravelWrap.h:80
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::RavelState initState
used entirely to defer persisted state data until after first load from a variable ...
Definition: ravelWrap.h:73
ravelCAPI::Ravel wrappedRavel
Definition: ravelWrap.h:80
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);}
ravelCAPI::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  }
static constexpr float r
Definition: operationBase.h:53
ravelCAPI::Ravel wrappedRavel
Definition: ravelWrap.h:80

◆ 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);}
ravelCAPI::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 406 of file ravelWrap.cc.

References wrappedRavel.

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

◆ hypercube()

Hypercube minsky::Ravel::hypercube ( ) const

return hypercube corresponding to the current Ravel state

Definition at line 181 of file ravelWrap.cc.

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

Referenced by exportAsCSV().

182  {
183  auto outHandles=wrappedRavel.outputHandleIds();
184  Hypercube hc;
185  auto& xv=hc.xvectors;
186  for (auto h: outHandles)
187  {
188  auto labels=wrappedRavel.sliceLabels(h);
189  xv.emplace_back(handleDescription(h));
190  if (auto dim=axisDimensions.find(xv.back().name);
191  dim!=axisDimensions.end())
192  xv.back().dimension=dim->second;
193  else if (auto dim=cminsky().dimensions.find(xv.back().name);
194  dim!=cminsky().dimensions.end())
195  xv.back().dimension=dim->second;
196  // else otherwise dimension is a string (default type)
197  for (auto& i: labels)
198  xv.back().push_back(i);
199  }
200  return hc;
201  }
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
static constexpr float h
Definition: operationBase.h:53
const Minsky & cminsky()
const version to help in const correctness
Definition: minsky.h:538
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:189
ravelCAPI::Ravel wrappedRavel
Definition: ravelWrap.h:80
Here is the call graph for this function:
Here is the caller 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 146 of file ravelWrap.cc.

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

147  {
148  if (m_editorMode)
149  {
150  const float r=1.1*zoomFactor()*wrappedRavel.radius();
151  return std::abs(xx-x())<=r && std::abs(yy-y())<=r;
152  }
153  return false;
154  }
virtual float x() const
Definition: item.cc:107
virtual float y() const
Definition: item.cc:114
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:53
ravelCAPI::Ravel wrappedRavel
Definition: ravelWrap.h:80
Here is the call graph for this function:

◆ joinLockGroup()

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

Definition at line 585 of file ravelWrap.cc.

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

586  {
587  cminsky().model->recursiveDo(&GroupItems::items, [this,colour](Items&, Items::iterator i) {
588  if (auto ravel=(*i)->ravelCast(); ravel && ravel->lockGroup && ravel->lockGroup->colour()==colour)
589  {
590  leaveLockGroup();
591  auto ravelPtr=dynamic_pointer_cast<Ravel>(itemPtrFromThis());
592  if (ravelPtr)
593  {
594  lockGroup=ravel->lockGroup;
595  lockGroup->addRavel(ravelPtr);
596  return true;
597  }
598  }
599  return false;
600  });
601  }
void leaveLockGroup()
Definition: ravelWrap.cc:562
std::vector< ItemPtr > Items
Definition: item.h:360
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:538
std::shared_ptr< RavelLockGroup > lockGroup
group of ravels that move syncronously
Definition: ravelWrap.h:103
GroupPtr model
Definition: minsky.h:242
Here is the call graph for this function:

◆ leaveLockGroup()

void minsky::Ravel::leaveLockGroup ( )

Definition at line 562 of file ravelWrap.cc.

References lockGroup.

Referenced by joinLockGroup().

563  {
564  if (lockGroup)
565  lockGroup->removeFromGroup(*this);
566  lockGroup.reset();
567  }
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 574 of file ravelWrap.cc.

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

575  {
576  set<unsigned> r;
577  cminsky().model->recursiveDo(&GroupItems::items, [&r](Items&, Items::iterator i) {
578  if (auto ravel=(*i)->ravelCast(); ravel && ravel->lockGroup)
579  r.insert(ravel->lockGroup->colour());
580  return false;
581  });
582  return {r.begin(),r.end()};
583  }
std::vector< ItemPtr > Items
Definition: item.h:360
const Minsky & cminsky()
const version to help in const correctness
Definition: minsky.h:538
static constexpr float r
Definition: operationBase.h:53
GroupPtr model
Definition: minsky.h:242
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();}
ravelCAPI::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::Op::ReductionOp m_nextReduction
Definition: ravelWrap.h:81
ravelCAPI::Ravel wrappedRavel
Definition: ravelWrap.h:80

◆ numHandles()

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

Definition at line 120 of file ravelWrap.h.

Referenced by pickSliceLabels(), and units().

120 {return wrappedRavel.numHandles();}
ravelCAPI::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);}
std::string axis
axis selector in tensor operations
Definition: operationBase.h:90
ravelCAPI::Ravel wrappedRavel
Definition: ravelWrap.h:80
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 246 of file ravelWrap.cc.

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

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

247  {
248  switch (keySym)
249  {
250  case 0xff52: case 0xff53: //Right, Up
251  adjustSlicer(1);
252  break;
253  case 0xff51: case 0xff54: //Left, Down
254  adjustSlicer(-1);
255  break;
256  default:
257  return false;
258  }
259  minsky().requestReset();
260  return true;
261  }
void requestReset()
Definition: minsky.cc:466
void adjustSlicer(int)
adjust currently selected handle&#39;s slicer
Definition: ravelWrap.cc:239
Minsky & minsky()
global minsky object
Definition: addon.cc:545
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 156 of file ravelWrap.cc.

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

157  {
158  const double invZ=1/zoomFactor();
159  wrappedRavel.onMouseDown((xx-x())*invZ,(yy-y())*invZ);
160  }
virtual float x() const
Definition: item.cc:107
virtual float y() const
Definition: item.cc:114
virtual float zoomFactor() const
Definition: item.cc:121
ravelCAPI::Ravel wrappedRavel
Definition: ravelWrap.h:80
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();}
ravelCAPI::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 169 of file ravelWrap.cc.

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

170  {
171  const double invZ=1/zoomFactor();
172  return wrappedRavel.onMouseMotion((xx-x())*invZ,(yy-y())*invZ);
173  }
virtual float x() const
Definition: item.cc:107
virtual float y() const
Definition: item.cc:114
virtual float zoomFactor() const
Definition: item.cc:121
ravelCAPI::Ravel wrappedRavel
Definition: ravelWrap.h:80
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 175 of file ravelWrap.cc.

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

176  {
177  const double invZ=1/zoomFactor();
178  return wrappedRavel.onMouseOver((xx-x())*invZ,(yy-y())*invZ);
179  }
virtual float x() const
Definition: item.cc:107
virtual float y() const
Definition: item.cc:114
virtual float zoomFactor() const
Definition: item.cc:121
ravelCAPI::Ravel wrappedRavel
Definition: ravelWrap.h:80
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 162 of file ravelWrap.cc.

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

163  {
164  const double invZ=1/zoomFactor();
165  wrappedRavel.onMouseUp((xx-x())*invZ,(yy-y())*invZ);
168  }
virtual float x() const
Definition: item.cc:107
virtual float y() const
Definition: item.cc:114
void broadcastStateToLockGroup() const
Definition: ravelWrap.cc:569
virtual float zoomFactor() const
Definition: item.cc:121
void resortHandleIfDynamic()
Definition: ravelWrap.cc:371
ravelCAPI::Ravel wrappedRavel
Definition: ravelWrap.h:80
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 311 of file ravelWrap.cc.

References wrappedRavel.

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

◆ pickedSliceLabels() [2/2]

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

Definition at line 308 of file ravelWrap.cc.

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

309  {return wrappedRavel.sliceLabels(axis);}
std::string axis
axis selector in tensor operations
Definition: operationBase.h:90
ravelCAPI::Ravel wrappedRavel
Definition: ravelWrap.h:80

◆ pickSliceLabels()

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

pick (selected) pick labels

Definition at line 314 of file ravelWrap.cc.

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

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

◆ populateHypercube()

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

Definition at line 203 of file ravelWrap.cc.

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

204  {
205  if (!wrappedRavel) return;
206  auto state=initState.empty()? getState(): initState;
207  const bool redistribute=!initState.empty();
208  initState.clear();
209  wrappedRavel.populateFromHypercube(hc);
210  if (state.empty())
211  {
212  setRank(hc.rank());
213  }
214  else
215  {
216  applyState(state);
217  if (redistribute) wrappedRavel.redistributeHandles();
218  }
219 #ifndef NDEBUG
220  if (wrappedRavel && state.empty())
221  {
222  auto d=hc.dims();
223  assert(d.size()==wrappedRavel.rank());
224  auto outputHandles=wrappedRavel.outputHandleIds();
225  for (size_t i=0; i<d.size(); ++i)
226  assert(d[i]==numSliceLabels(outputHandles[i]));
227  }
228 #endif
229  }
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:534
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:232
ravelCAPI::Ravel wrappedRavel
Definition: ravelWrap.h:80
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();}
ravelCAPI::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();}
ravelCAPI::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 139 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().

140  {
141  wrappedRavel.rescale(0.5*std::max(fabs(b.x0-b.x1),fabs(b.y0-b.y1))/(1.21*zoomFactor()));
142  moveTo(0.5*(b.x0+b.x1), 0.5*(b.y0+b.y1));
143  bb.update(*this);
144  }
BoundingBox bb
canvas bounding box.
Definition: item.h:192
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
ravelCAPI::Ravel wrappedRavel
Definition: ravelWrap.h:80
Here is the call graph for this function:

◆ resortHandleIfDynamic()

void minsky::Ravel::resortHandleIfDynamic ( )

Definition at line 371 of file ravelWrap.cc.

References sortByValue(), and wrappedRavel.

Referenced by adjustSlicer(), and onMouseUp().

372  {
373  if (wrappedRavel.rank()==1)
374  {
375  const int outputHandleId=wrappedRavel.outputHandleIds()[0];
376  auto hs=wrappedRavel.getHandleState(outputHandleId);
377  switch (hs.order)
378  {
379  case ravel::HandleSort::dynamicForward:
380  case ravel::HandleSort::dynamicReverse:
381  {
382  auto calipers=wrappedRavel.getCaliperPositions(outputHandleId);
383  // sortByValue of the whole range of the dimension
384  wrappedRavel.displayFilterCaliper(outputHandleId,false);
385  sortByValue(hs.order);
386  wrappedRavel.displayFilterCaliper(outputHandleId,hs.displayFilterCaliper);
387  wrappedRavel.setCaliperPositions(outputHandleId,calipers.first,calipers.second);
388  }
389  break;
390  default:
391  break;
392  }
393  }
394  }
void sortByValue(ravel::HandleSort::Order dir)
Sort handle by value. Only applicable for rank 1 ravels.
Definition: ravelWrap.cc:413
ravelCAPI::Ravel wrappedRavel
Definition: ravelWrap.h:80
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();}
ravelCAPI::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 429 of file ravelWrap.cc.

References description(), and wrappedRavel.

430  {
431  wrappedRavel.setHandleDescription(wrappedRavel.selectedHandle(),description);
432  }
std::string description() const
Definition: ravelWrap.cc:424
ravelCAPI::Ravel wrappedRavel
Definition: ravelWrap.h:80
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 471 of file ravelWrap.cc.

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

472  {
474  }
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:471
Units units(bool) const override
compute the dimensional units
Definition: ravelWrap.cc:515
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 477 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().

478  {
479  auto descr=handleDescription(handleIndex);
480  if (descr.empty()) return;
481  auto i=cminsky().dimensions.find(descr);
482  const Dimension d{type,units};
483  if (i!=cminsky().dimensions.end())
484  {
485  if (type!=i->second.type)
486  throw error("type mismatch with global dimension");
487  }
488  else
489  {
490  minsky().dimensions[descr]=d;
492  }
493  axisDimensions[descr]=d;
494  }
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:538
std::string handleDescription(int handle) const
return the description field for handle handle.
Definition: ravelWrap.h:189
Minsky & minsky()
global minsky object
Definition: addon.cc:545
void imposeDimensions()
Definition: minsky.cc:364
Dimensions axisDimensions
local override of axis dimensionality
Definition: ravelWrap.h:100
Units units(bool) const override
compute the dimensional units
Definition: ravelWrap.cc:515
Dimensions dimensions
Definition: minsky.h:189
Here is the call graph for this function:

◆ setDisplayFilterCaliper()

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

Definition at line 290 of file ravelWrap.cc.

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

291  {
292  const int h=wrappedRavel.selectedHandle();
293  if (h>=0)
294  wrappedRavel.displayFilterCaliper(h,x);
295  return x;
296  }
virtual float x() const
Definition: item.cc:107
static constexpr float h
Definition: operationBase.h:53
ravelCAPI::Ravel wrappedRavel
Definition: ravelWrap.h:80
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);}
std::string description() const
Definition: ravelWrap.cc:424
ravelCAPI::Ravel wrappedRavel
Definition: ravelWrap.h:80

◆ setHandleSortOrder()

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

set a given handle sort order

Definition at line 396 of file ravelWrap.cc.

References dimension(), and wrappedRavel.

Referenced by setSortOrder().

397  {
398  if (handle>=0)
399  {
400  const Dimension dim=dimension(handle);
401  wrappedRavel.orderLabels(handle,order);
402  }
403  return order;
404  }
Dimension dimension(int handle) const
dimension details associated with handle
Definition: ravelWrap.cc:345
ravelCAPI::Ravel wrappedRavel
Definition: ravelWrap.h:80
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 232 of file ravelWrap.cc.

References wrappedRavel.

Referenced by populateHypercube().

233  {
234  vector<size_t> ids;
235  for (size_t i=0; i<rank; ++i) ids.push_back(i);
236  wrappedRavel.setOutputHandleIds(ids);
237  }
ravelCAPI::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 365 of file ravelWrap.cc.

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

366  {
367  setHandleSortOrder(x, wrappedRavel.selectedHandle());
368  return x;
369  }
virtual float x() const
Definition: item.cc:107
ravel::HandleSort::Order setHandleSortOrder(ravel::HandleSort::Order, int handle)
set a given handle sort order
Definition: ravelWrap.cc:396
ravelCAPI::Ravel wrappedRavel
Definition: ravelWrap.h:80
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 413 of file ravelWrap.cc.

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

Referenced by resortHandleIfDynamic().

414  {
415  if (wrappedRavel.rank()!=1) return;
416  try {minsky().requestReset();} catch (...) {throw runtime_error("Cannot sort handle at the moment");}
417  auto vv=m_ports[1]->getVariableValue();
418  if (!vv)
419  throw runtime_error("Cannot sort handle at the moment");
420  wrappedRavel.sortByValue(vv, dir);
421  }
void requestReset()
Definition: minsky.cc:466
ItemPortVector m_ports
Definition: item.h:154
Minsky & minsky()
global minsky object
Definition: addon.cc:545
ravelCAPI::Ravel wrappedRavel
Definition: ravelWrap.h:80
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 354 of file ravelWrap.cc.

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

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

◆ 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:279
bool setDisplayFilterCaliper(bool x)
Definition: ravelWrap.cc:290

◆ 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:198

◆ 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 515 of file ravelWrap.cc.

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

Referenced by setDimension().

516  {
517  Units inputUnits=m_ports[1]->units(check);
518  if (inputUnits.empty()) return inputUnits;
519  size_t multiplier=1;
520  // at this stage, gross up exponents by the handle size of each
521  // reduced by product handles
522  for (size_t h=0; h<numHandles(); ++h)
523  {
524  auto state=wrappedRavel.getHandleState(h);
525  if (state.collapsed && state.reductionOp==ravel::Op::prod)
526  multiplier*=numSliceLabels(h);
527  }
528  if (multiplier>1)
529  for (auto& u: inputUnits)
530  u.second*=multiplier;
531  return inputUnits;
532  }
static constexpr float h
Definition: operationBase.h:53
ItemPortVector m_ports
Definition: item.h:154
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
ravelCAPI::Ravel wrappedRavel
Definition: ravelWrap.h:80
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: