Go to the documentation of this file.00001 #ifndef OPENTISSUE_DYNAMICS_FEM_FEM_INITIALIZE_STIFFNESS_ELEMENTS_H
00002 #define OPENTISSUE_DYNAMICS_FEM_FEM_INITIALIZE_STIFFNESS_ELEMENTS_H
00003
00004
00005
00006
00007
00008
00009
00010 #include <OpenTissue/configuration.h>
00011
00012 #include <OpenTissue/dynamics/fem/fem_compute_ke.h>
00013 #include <OpenTissue/dynamics/fem/fem_compute_volume.h>
00014
00015 namespace OpenTissue
00016 {
00017 namespace fem
00018 {
00019 namespace detail
00020 {
00030 template < typename tetrahedron_iterator >
00031 inline void initialize_stiffness_elements(tetrahedron_iterator begin, tetrahedron_iterator end)
00032 {
00033 for (tetrahedron_iterator T = begin; T != end; ++T)
00034 {
00035 T->m_e10 = T->j()->m_model_coord - T->i()->m_model_coord;
00036 T->m_e20 = T->k()->m_model_coord - T->i()->m_model_coord;
00037 T->m_e30 = T->m()->m_model_coord - T->i()->m_model_coord;
00038
00039 T->m_V = compute_volume(T->m_e10, T->m_e20, T->m_e30);
00040
00041
00042
00043
00044
00045
00046
00047
00048 assert(T->m_V>0 || !"initialize_stiffness_elements(): Element with negative volume is encountered! Maybe you got a bad mesh?");
00049
00050 T->m_Re = math::diag(1.0);
00051
00052
00053 compute_Ke(
00054 T->i()->m_model_coord,
00055 T->j()->m_model_coord,
00056 T->k()->m_model_coord,
00057 T->m()->m_model_coord,
00058 T->m_young, T->m_poisson,
00059 T->m_Ke
00060 );
00061 }
00062 }
00063
00064 }
00065 }
00066 }
00067
00068
00069 #endif