A little framework for insertion of new fiber/contraction models in FEBio. It implements in all materials with active_contraction the new models. Feel free to discuss.
Cheers!
- Get the new attribute values in FEBioImport.cpp (line ~760)
Code:else if (tag == "active_contraction") { const char* szlc = tag.AttributeValue("lc", true); int lc = 0; if (szlc) lc = atoi(szlc); pm->m_fib.m_lcna = lc; tag.value(pm->m_fib.m_ascl); [B]pm->m_fib.m_model = 1;[/B] ... } else if [B](tag == "active_contraction_new")[/B] { const char* szlc = tag.AttributeValue("lc", true); int lc = 0; if (szlc) lc = atoi(szlc); pm->m_fib.m_lcna = lc; tag.value(pm->m_fib.m_ascl); [B]pm->m_fib.m_model = 2;[/B] ... [B]new tag values[/B] ... }
- Define the new parameters in FEMaterial.h:
Code:class FEFiberMaterial : public FEMaterial { public: FEFiberMaterial() { m_plc = 0; m_lcna = -1; m_ascl = 0; [B]m_model = 0; [/B] ... double m_ascl; //!< activation scale factor [B] int m_model; //!< model[/B] // Model 1 double m_ca0; //!< intracellular calcium concentration double m_beta; //!< shape of peak isometric tension-sarcomere length relation double m_l0; //!< unloaded length double m_refl; //!< sarcomere length // Model 2 ... [B]new attributes[/B] ... // we need load curve data for active contraction FELoadCurve* m_plc; //!< pointer to current load curve values };
- Work with the new model in FEFibermaterial.cpp
Code:mat3ds FEFiberMaterial::Stress(FEMaterialPoint &mp) { FEElasticMaterialPoint& pt = *mp.ExtractData<FEElasticMaterialPoint>(); ... mat3ds s; if [B](m_model == 1)[/B] { ... } else if [B](m_model == 2)[/B] { ... [B]the new model[/B] ... } else { s.zero (); } return s; }
Cheers!
Comment