Program Listing for File CoordBase.h#
↰ Return to documentation for file (include/Karana/SOADyn/CoordBase.h)
/*
*Copyright(c)2024-2025KaranaDynamicsPtyLtd.Allrightsreserved.
*
*NOTICETOUSER:
*
*Thissourcecodeand/ordocumentation(the"LicensedMaterials")is
*theconfidentialandproprietaryinformationofKaranaDynamicsInc.
*UseoftheseLicensedMaterialsisgovernedbythetermsandconditions
*ofaseparatesoftwarelicenseagreementbetweenKaranaDynamicsandthe
*Licensee("LicenseAgreement").Unlessexpresslypermittedunderthat
*agreement,anyreproduction,modification,distribution,ordisclosure
*oftheLicensedMaterials,inwholeorinpart,toanythirdparty
*withoutthepriorwrittenconsentofKaranaDynamicsisstrictlyprohibited.
*
*THELICENSEDMATERIALSAREPROVIDED"ASIS"WITHOUTWARRANTYOFANYKIND.
*KARANADYNAMICSDISCLAIMSALLWARRANTIES,EXPRESSORIMPLIED,INCLUDING
*BUTNOTLIMITEDTOWARRANTIESOFMERCHANTABILITY,NON-INFRINGEMENT,AND
*FITNESSFORAPARTICULARPURPOSE.
*
*INNOEVENTSHALLKARANADYNAMICSBELIABLEFORANYDAMAGESWHATSOEVER,
*INCLUDINGBUTNOTLIMITEDTOLOSSOFPROFITS,DATA,ORUSE,EVENIF
*ADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGES,WHETHERINCONTRACT,TORT,
*OROTHERWISEARISINGOUTOFORINCONNECTIONWITHTHELICENSEDMATERIALS.
*
*U.S.GovernmentEndUsers:TheLicensedMaterialsarea"commercialitem"
*asdefinedat48C.F.R.2.101,andareprovidedtotheU.S.Government
*onlyasacommercialenditemunderthetermsofthislicense.
*
*AnyuseoftheLicensedMaterialsinindividualorcommercialsoftwaremust
*include,intheuserdocumentationandinternalsourcecodecomments,
*thisNotice,Disclaimer,andU.S.GovernmentUseProvision.
*/
#pragmaonce
#include"Karana/Frame/Frame.h"
#include"Karana/Frame/FrameToFrame.h"
#include"Karana/KCore/Base.h"
#include"Karana/KCore/DataCache.h"
#include"Karana/Math/Defs.h"
namespaceKarana::Dynamics{
classHingeOnode;
namespacekc=Karana::Core;
namespacekm=Karana::Math;
namespacekf=Karana::Frame;
classCoordBase{
//foraccessto_newtonian_frame
friendclassFrameToFrameJacobianGenerator;
friendclassFramePairHinge;
//foraccessto_pframe2otherPhiandrelatedmethods
friendclassSubTree;
//foraccessto_localChartGetQ,_localChartSetQ
friendclassCoordData;
friendclassCECompoundSubhinge;
friendclassLoopsCompoundBody;
public:
CoordBase(std::string_viewnm,kc::id_tid);
virtual~CoordBase();//=default;
std::stringdumpString(std::string_viewprefix,constkc::Base::DumpOptions*options)const;
virtualkc::ks_ptr<kf::FrameToFrame>f2f()const=0;
std::optional<bool>isOriented(constkf::FrameToFrame&f2f)const;
virtualstd::string_viewname()const{return_name;};
virtualconstkc::id_t&id()const{return_id;}
virtualstd::string_viewtypeString()constnoexcept=0;
virtualkm::Matjacobian(constkf::Frame&target,booloriented=true)const=0;
virtualkm::MatjacobianDot(constkf::Frame&target,booloriented=true)const=0;
virtualboolisFinalized()const;//override;
virtualkm::MatgetATBIMatPsi()const=0;
virtualkm::MatgetATBID()const=0;
virtualkm::MatgetATBIDinv()const=0;
virtualkm::MatgetATBIG()const=0;
virtualkm::MatgetATBITauper()const=0;
virtualkm::MatpframeCoordMapMatrix()const{
//defaultdefintion
returnatbiCoordMapMatrix();
}
virtualconstkm::MatatbiCoordMapMatrix()const{returnkm::Mat();}
virtualkm::MatgetUpsilonMatrix()=0;
public:
virtualvoidsetQ(constEigen::Ref<constkm::Vec>&val);
virtualvoidsetQ(doublefill_value);
virtualconstkm::Vec&getQ()const;
virtualvoidsetU(constEigen::Ref<constkm::Vec>&val);
virtualvoidsetU(doublefill_value);
virtualconstkm::Vec&getU()const;
virtualvoidsetT(constEigen::Ref<constkm::Vec>&val);
virtualvoidsetT(doublefill_value);
virtualconstkm::Vec&getT()const;
virtualvoidsetUdot(constEigen::Ref<constkm::Vec>&val);
virtualvoidsetUdot(doublefill_value);
virtualconstkm::Vec&getUdot()const;
virtualconstkm::Vec&getQdot()const{returngetU();}
size_tnQ()const{return_nQ;};
size_tnU()const{return_nU;};
km::MatjacobianNumDiff(constkf::FrameToFrame&f2f);
virtualkm::MatposeGradient(constkf::FrameToFrame&f_to_f,booloriented=true)const;
km::MatposeGradientNumDiff(constkf::FrameToFrame&f2f);
protected:
structATBIMatrices{
ATBIMatrices()=default;
ATBIMatrices(constATBIMatrices&)=default;
virtual~ATBIMatrices(){};
};
constATBIMatrices&_atbiMatrices()const{return*_atbi_matrices;}
structATBIFilterVectors{
ATBIFilterVectors()=default;
ATBIFilterVectors(constATBIFilterVectors&)=default;
virtual~ATBIFilterVectors(){};
};
constATBIFilterVectors&_atbiFilterVectors()const{return*_atbi_filter_vectors;}
protected:
virtualkm::Mat_oframe2pframePsi()const=0;
virtualkm::Mat_oframe2pframePhi()const=0;
virtualkm::Mat_pframe2otherPhi(constkf::Frame&other)const=0;
protected:
virtualvoid_localChartSetQ(constEigen::Ref<constkm::Vec>&val);
virtualconstkm::Vec&_localChartGetQ()const;
kc::ks_ptr<kf::Frame>_newtonian_frame=nullptr;
void_resizeCoordBuffers(size_tn_q,size_tn_u);
protected:
std::string_name;
kc::id_t_id;
kc::ks_ptr<kc::DataCache<km::Vec>>_cache_Q=nullptr;
kc::ks_ptr<kc::DataCache<km::Vec>>_cache_U=nullptr;
kc::ks_ptr<kc::DataCache<km::Vec>>_cache_Udot=nullptr;
kc::ks_ptr<kc::DataCache<km::Vec>>_cache_T=nullptr;
kc::ks_ptr<kc::DataCache<km::Vec>>_cache_Qdot=nullptr;
kc::ks_ptr<ATBIMatrices>_atbi_matrices=nullptr;
kc::ks_ptr<ATBIFilterVectors>_atbi_filter_vectors=nullptr;
size_t_nQ=0,_nU=0;
protected:
km::Vec_buf_Q;
km::Vec_buf_U;
km::Vec_buf_Udot;
km::Vec_buf_T;
};
}//namespaceKarana::Dynamics