Program Listing for File PhysicalHinge.h#
↰ Return to documentation for file (include/Karana/SOADyn/PhysicalHinge.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/OrientedChainedFrame2Frame.h"
#include"Karana/SOADyn/FramePairHinge.h"
#include<unordered_map>
#include<vector>
namespaceKarana::Dynamics{
namespacekc=Karana::Core;
namespacekf=Karana::Frame;
classHingeOnode;
classHingePnode;
classPinSubhinge;
classPhysicalBody;
classPhysicalHinge:publicFramePairHinge{
/*foraccessto_oneTimeTeardownand_oneTimeSetupmethods*/
friendclassPhysicalBody;
/*foraccessto_setupATBIDataCaches*/
friendclassMultibody;
/*foraccessto_invdyn_cache*/
friendclassHingePnode;
/*foraccesstoacorPrime*/
friendclassCompoundSubhinge;
public:
staticconstkc::ks_ptr<PhysicalHinge>
create(PhysicalBody&parent,
PhysicalBody&child,
HingeBase::HINGE_TYPEhtype,
conststd::vector<SubhingeBase::SUBHINGE_TYPE>&subhinge_types=
std::vector<SubhingeBase::SUBHINGE_TYPE>());
virtual~PhysicalHinge();
PhysicalHinge(PhysicalBody&parent_body,
PhysicalBody&child_body,
conststd::string&name,
HingeBase::HINGE_TYPEhtype,
conststd::vector<SubhingeBase::SUBHINGE_TYPE>&subhinge_types=
std::vector<SubhingeBase::SUBHINGE_TYPE>());
virtualconststd::string&typeString()constnoexceptoverride{
staticstd::stringtype_string="Karana::Dynamics::PhysicalHinge";
returntype_string;
}
public:
constkc::ks_ptr<HingePnode>&pnode()const;
constkc::ks_ptr<HingeOnode>&onode()const;
std::stringdumpString(conststd::string&prefix,
constKarana::Core::Base::dumpOptions*options)constoverride;
protected:
structInterBodyForce{
/*per
*https://stackoverflow.com/questions/41552966/getting-new-delete-type-mismatch-from-asan
*/
virtual~InterBodyForce()=default;
public:
bool_enable_interbody_force=false;
km::SpatialVector_interbody_spforce;
};
protected:
void_discard(kc::ks_ptr<Base>&base)override;
void_setupATBIDataCaches();
void_teardownATBIDataCaches();
void_setupInvDynDataCaches();
void_teardownInvDynDataCaches();
void_oneTimeTeardown();
/*carryoutsideeffectofthethegeneralizedforcechangingfor
thesubhinge.AnexamplesideeffectistomarktheATBIfilter
datacacheforthehingeonodeasstaleforaphysicalhinge.*/
void_TChangeAction()override;
km::SpatialVector_acorPrime()const;
private:
kc::ks_ptr<HingeOnode>_onode;
kc::ks_ptr<HingePnode>_pnode;
};
}//namespaceKarana::Dynamics