Class CoordData#
Defined in File CoordData.h
Nested Relationships#
Nested Types#
Inheritance Relationships#
Base Type#
public Karana::Core::LockingBase(Class LockingBase)
Class Documentation#
-
class CoordData : public Karana::Core::LockingBase#
Class for managing coordinates for managing a set of CoordBase coordinate provider objects. See the.
The CoordData container section for more information on this class.
Public Functions
-
CoordData(std::string_view name, const std::vector<kc::ks_ptr<CoordBase>> &coordobjs_list)#
Constructor.
- Parameters:
name – instance name
coordobjs_list – list of CoordBase objects to manage
-
~CoordData()#
Destructor.
-
km::Vec getQ() const#
Return the Q coordinates as an array.
See Generalized Q, U etc coordinates section for discussion on Q, U etc coordinates.
- Returns:
Array of values
-
km::Vec getU() const#
Return the U velocity coordinates as an array.
See Generalized Q, U etc coordinates section for discussion on Q, U etc coordinates.
- Returns:
Array of values
-
km::Vec getUdot() const#
Return the Udot acceleration coordinates as an array.
See Generalized Q, U etc coordinates section for discussion on Q, U etc coordinates.
- Returns:
Array of values
-
km::Vec getT() const#
Return the T generalized forces as an array.
See Generalized Q, U etc coordinates section for discussion on Q, U etc coordinates.
- Returns:
Array of values
-
km::Vec getQdot() const#
Return the Qdot rate coordinates as an array.
See Generalized Q, U etc coordinates section for discussion on Q, U etc coordinates.
- Returns:
Array of values
-
void setQ(const Eigen::Ref<const km::Vec> &vals)#
Set the Q coordinates.
See Generalized Q, U etc coordinates section for discussion on Q, U etc coordinates.
- Parameters:
vals – Array of values.
-
void setQ(double fill_value)#
Set the Q coordinates to a constant value.
See Generalized Q, U etc coordinates section for discussion on Q, U etc coordinates.
- Parameters:
fill_value – Fill value.
-
void setU(const Eigen::Ref<const km::Vec> &vals)#
Set the U velocity coordinates.
See Generalized Q, U etc coordinates section for discussion on Q, U etc coordinates.
- Parameters:
vals – Array of values.
-
void setU(double fill_value)#
Set the U velocity coordinates to a constant value.
See Generalized Q, U etc coordinates section for discussion on Q, U etc coordinates.
- Parameters:
fill_value – Fill value.
-
void setT(const Eigen::Ref<const km::Vec> &vals)#
Set the T generalized forces.
See Generalized Q, U etc coordinates section for discussion on Q, U etc coordinates.
- Parameters:
vals – Array of values.
-
void setT(double fill_value)#
Set the T generalized forces to a constant value.
See Generalized Q, U etc coordinates section for discussion on Q, U etc coordinates.
- Parameters:
fill_value – Fill value.
-
void setUdot(const Eigen::Ref<const km::Vec> &vals)#
Set the Udot acceleration coordinates.
See Generalized Q, U etc coordinates section for discussion on Q, U etc coordinates.
- Parameters:
vals – Array of values.
-
void setUdot(double fill_value)#
Set the Udot acceleration coordinates to a constant value.
See Generalized Q, U etc coordinates section for discussion on Q, U etc coordinates.
- Parameters:
fill_value – Fill value.
-
size_t nQ() const#
The number of Q generalized coords for the CoordBase.
See Generalized Q, U etc coordinates section for discussion on Q, U etc coordinates.
- Returns:
the number of coordinates
-
size_t nU() const#
The number of U velocity coords for the CoordBase.
See Generalized Q, U etc coordinates section for discussion on Q, U etc coordinates.
- Returns:
the number of velocity coordinates
-
virtual bool isReady() const override#
Checks is the params for the object have been initialized.
- Returns:
True if the params have set up.
-
void dumpState(std::string_view prefix, std::vector<std::string> filter = {"ALL"}) const#
Print out the coordinate values for all the coordinates.
The filter values for controlling output are any combination of: ‘Q’, ‘U’, ‘Udot’, ‘T’, ‘ALL’
- Parameters:
prefix – The prefix to add to each output line
filter – Filter output to the specified coordinate types.
-
virtual std::string dumpString(std::string_view prefix = "", const Karana::Core::Base::DumpOptions *options = nullptr) const override#
Return information about the object.
- Parameters:
prefix – A string to use as prefix for each output line
options – Struct with options to tailor the output
- Returns:
String with the information about the object.
-
bool contains(kc::id_t id) const#
Check if a obj with specified id instance belongs to this CoordData.
-
const CoordOffset &coordOffsets(const CoordBase &c) const#
Returns the packing offset for the specified CoordBase.
The CoordData has get/set methods to pack and unpack the coordinate values for its set of CoordBase instances. This method returns the offsets for the Q and U values for the specified CoordBase in these arrays.
- Parameters:
c – The CoordBase to check for
- Returns:
A CoordOffset struct with the Q and U offsets
-
const std::pair<kc::ks_ptr<CoordBase>, size_t> coordAt(size_t u_offset) const#
Returns coord obj and its coord offset corresponding to overall U offset.
The CoordData has get/set methods to pack and unpack the coordinate values for its set of CoordBase instances. This method returns the CoordBase and its local coordinate offset corresponding to the specified overall U offset value.
- Parameters:
u_offset – the input overall U offset value
- Returns:
The CoordBase instance and its local U coord offset
-
inline std::vector<kc::ks_ptr<CoordBase>> coordBases()#
Get a vector of the CoordBase instances for this CoordData.
- Returns:
A vector of CoordBase instances.
Protected Functions
-
std::vector<kc::ks_ptr<CoordBase>> _children(const CoordBase &cb) const#
Return the list of CoordBase children.
-
bool _isAncestorOf(const CoordBase &anc, const CoordBase &desc, bool strict) const#
Check whether a CoordBase is an ancestor of another.
-
kc::ks_ptr<CoordBase> _getAncestor(const CoordBase &first, const CoordBase &second) const#
Return the common ancestor CoordBase.
-
const CoordOffset &_coordOffsets(kc::id_t id) const#
Return a CoordOffset with the packing offsets for the CoordBase with the specified id.
- Parameters:
id – the CoordBase id
- Returns:
the CoordOffset struct with the offset
-
void _makeTree() const#
Create the structure tree if it has not been created yet
-
void _localChartSetQ(const Eigen::Ref<const km::Vec> &val)#
Set the local chart Q coordinates.
See Generalized Q, U etc coordinates section for discussion on Q, U etc coordinates.
- Parameters:
val – Array of values.
-
km::Vec _localChartGetQ() const#
Return the local chart Q coordinates - without sanitizing coordinates.
See Generalized Q, U etc coordinates section for discussion on Q, U etc coordinates.
- Returns:
Array of values.
Protected Attributes
-
std::map<kc::id_t, CoordOffset> _coord_offsets#
map of the coord offset for subhinges and body coordinates
Protected Static Functions
-
struct CoordOffset#
struct for tracking the offset for the generalized coordinates in the uber list for a collection of bodies and subhinges
-
CoordData(std::string_view name, const std::vector<kc::ks_ptr<CoordBase>> &coordobjs_list)#