Program Listing for File CECompoundBody.h

Program Listing for File CECompoundBody.h#

Return to documentation for file (include/Karana/SOADyn/CECompoundBody.h)

/*
*Copyright(c)2024-2026KaranaDynamicsPtyLtd.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/SOADyn/CompoundBody.h"
#include<vector>

namespaceKarana::Dynamics{

namespacekc=Karana::Core;

classCoordData;
classSubGraph;
classConstraintKinematicsSolver;
classMultiJacobianGenerator;
classPhysicalSubhinge;
classCoordinateConstraint;

classCECompoundBody:publicCompoundBody{

/*togetaccessto_toDependentQ()etc*/
friendclassCECompoundSubhinge;

public:
std::vector<unsignedint>independentIndicesU()const{return_indep_indices_U;}

std::vector<unsignedint>independentIndicesQ()const{return_indep_indices_Q;}

public:
statickc::ks_ptr<CECompoundBody>
create(std::string_viewname,
kc::ks_ptr<SubGraph>parent_subtree,
kc::ks_ptr<SubGraph>component_bodies,
conststd::vector<kc::ks_ptr<PhysicalBody>>&indep_bodies);

statickc::ks_ptr<CECompoundBody>
create(std::string_viewname,
kc::ks_ptr<SubGraph>parent_subtree,
kc::ks_ptr<SubGraph>component_bodies,
conststd::vector<unsignedint>
&indep_indices_U,//NOLINT(readability-identifier-naming)
conststd::vector<unsignedint>
&indep_indices_Q//NOLINT(readability-identifier-naming)
={});

virtual~CECompoundBody();

CECompoundBody(std::string_viewname,
kc::ks_ptr<SubGraph>parent_sg,
kc::ks_ptr<SubGraph>bodies_sg,
conststd::vector<unsignedint>
&indep_indices_U,//NOLINT(readability-identifier-naming)
conststd::vector<unsignedint>
&indep_indices_Q//NOLINT(readability-identifier-naming)
={});

CECompoundBody(std::string_viewname,
kc::ks_ptr<SubGraph>parent_sg,
kc::ks_ptr<SubGraph>bodies_sg,
conststd::vector<kc::ks_ptr<PhysicalBody>>&indep_bodies);

protected:
void_discard(kc::ks_ptr<Base>&base)override;

protected:
kc::ks_ptr<CompoundSubhinge>_createSubhinge(kc::ks_ptr<CompoundHinge>hinge)override;

void

_updateDependentQ(constkm::Vec&min_Q,//NOLINT(readability-identifier-naming)
boolglobal)const;

constkm::Mat&_constraintX()const;

km::Mat_matX()const;

constkm::Vec&_constraintXdotU()const;

void_computeConstraintX(km::Mat&val)const;

void_computeXdotU(km::Vec&val)const;

km::Vec_getFprimeTreeFwdDyn()constoverride;

protected:
kc::ks_ptr<kc::DataCache<km::Mat>>_cache_constraintX=nullptr;

kc::ks_ptr<kc::DataCache<km::Vec>>_cache_XdotU=nullptr;

std::vector<unsignedint>_indep_indices_U;

std::vector<unsignedint>_indep_indices_Q;

std::vector<std::pair<kc::ks_ptr<PhysicalSubhinge>,size_t>>_indep_cbs_U;
std::vector<std::pair<kc::ks_ptr<PhysicalSubhinge>,size_t>>_indep_cbs_Q;

kc::ks_ptr<ConstraintKinematicsSolver>_cks=nullptr;

std::vector<unsignedint>_rows_Y;

std::vector<unsignedint>_rows_Ydot;

std::vector<unsignedint>_dep_indices_U;
};

}//namespaceKarana::Dynamics