Biomechanical Joint Model
 Author: Anderson Maciel

comemolecule.h

Go to the documentation of this file.
00001 /***************************************************************************
00002  *   Copyright (C) 2002 by Anderson Maciel                                 *
00003  *   andi.maciel@gmail.com                                                 *
00004  *                                                                         *
00005  *   This program is free software; you can redistribute it and/or modify  *
00006  *   it under the terms of the GNU General Public License as published by  *
00007  *   the Free Software Foundation; either version 2 of the License, or     *
00008  *   (at your option) any later version.                                   *
00009  *                                                                         *
00010  *   This program is distributed in the hope that it will be useful,       *
00011  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00012  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
00013  *   GNU General Public License for more details.                          *
00014  *                                                                         *
00015  *   You should have received a copy of the GNU General Public License     *
00016  *   along with this program; if not, write to the                         *
00017  *   Free Software Foundation, Inc.,                                       *
00018  *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
00019  **************************************************************************/
00020 
00022 //
00023 //  PROJECT.....: CO-ME
00024 //  RESPONSIBLE.: 
00025 //
00026 //  AUTHOR......: Anderson Maciel
00027 //  DATE........: July/30/2002
00028 //  DESCRIPTION.: Class declaration.
00029 //
00030 //  AUTHOR......: Anderson Maciel
00031 //  DATE........: August/23/2002
00032 //  DESCRIPTION.: Remove links when molecules are too distant.
00033 //
00035 
00036 #ifndef __COME_MOLECULE_H       
00037 #define __COME_MOLECULE_H       
00038 
00039 #ifndef __COME_BIOSTRUCTURE_H
00040 class COME_BioStructure;
00041 #endif
00042 
00043 #include <algebra/comesubspaceelement.h>
00044 #include <bio/comemoleculelink.h>
00045 #include <physics/comeforce.h>
00046 #include <physics/cometimeforce.h>
00047 
00048 
00049 
00057 class COME_Molecule : public COME_SubSpaceElement  {
00058 
00059 protected:
00060         double                          radius;
00061         double                          nominalRadius;
00062         double                          frictionConst;
00063         list<COME_MoleculeLink*>        *connectionList;
00064         vector<COME_Molecule*>  orthogonalNeighbors;
00065         vector<COME_Vertex3D*>  buois;
00066         vector<int>                             buoisIndices;
00067         COME_Matrix*                    localFrame;
00068         vector<COME_Vector3D>   originalLocalFrame;
00069         COME_Point3D                    initPosition;
00070 
00071         bool                                    onSurface;
00072         bool                                    collide;
00073         bool                                    updated;
00074         vector<COME_TimeForce*> externalForces;
00075         COME_Force                      collisionForce;
00076         COME_Vector3D           lastDisplacement;
00077         double                          liquidFraction;
00078         double                          permeability;
00079         
00080         int                                     intersecClamp;
00081 
00082         COME_Force      calculateForce( double currTime, COME_Point3D *positionsIN, COME_Vector3D *velocitiesIN, int currIndex );
00083         void            removeLink( COME_Molecule *moleculeN );
00084 
00085 public:
00086         COME_Molecule();
00087         COME_Molecule( COME_Point3D positionN, double radiusN, double frictionConstN,
00088                                    COME_Material *materialN, COME_Vector3D velocityN, COME_BioStructure *parentN );
00089         COME_Molecule( COME_Point3D &positionN, double &radiusN, double &frictionConstN,
00090                                    COME_Material *materialN, COME_Vector3D &velocityN, COME_BioStructure *parentN );
00091 
00092         ~COME_Molecule();
00093 
00094         void    setRadius( double radiusN );
00095         void    setFrictionConst( double frictionConstN );
00096         void    setConnectionList( list<COME_MoleculeLink*> *listN );
00097         void    setExternalForces( vector<COME_TimeForce*> listN );
00098         void    setOnSurface( bool flag );
00099         void    setCollisionForce( COME_Force forceN );
00100         void    setIfGreaterCollisionForce( COME_Force forceN );
00101         void    setPosition( COME_Point3D &positionN );
00102         void    setIntersectClamp( int type );
00103         void    setCollide( bool yesno );
00104         void    setUpdated( bool yesno );
00105         
00106         void    addCollisionForce( COME_Force forceN );
00107 
00108         double                          getRadius() const;
00109         double                          getFrictionConst() const;
00110         list<COME_MoleculeLink*>        *getConnectionList() const;
00111         vector<COME_Molecule*>          &getOrthogonalNeighbors();
00112         vector<COME_TimeForce*>         getExternalForces() const;
00113         vector<COME_Vertex3D*>          *getBuois();
00114         vector<int>                                     *getBuoisIndices();
00115         bool                            isOnSurface() const;
00116         COME_Force                      getCollisionForce() const;
00117         COME_Vector3D                   getLastDisplacement() const;
00118         COME_Matrix*                    getLocalFrame();
00119         double                          getVolume() const;
00120         double                          getLiquidLevel() const;
00121         double                          getLiquidFraction() const;
00122         double                          getNominalRadius() const;
00123         double                          getPermeability() const;
00124         double                          getPressureArea() const;
00125         bool                            intersectClamp() const;
00126         bool                            intersectClampFix() const;
00127         bool                            intersectClampMobile() const;
00128         bool                            isCollide() const;
00129         bool                            isUpdated() const;
00130         
00131         void    addLink( COME_MoleculeLink *linkN );
00132         void    addBuoy( COME_Vertex3D *buoyN, int index );
00133         void    addOrthogonalNeighbor( COME_Molecule *newNeighbor );
00134         void    addExternalForce( COME_TimeForce *forceN );
00135         void    clearExternalForces();
00136         void    createLink( COME_Molecule *moleculeN );
00137         void    createLink( COME_Molecule *moleculeN, double globalHooke );
00138         void    makeLocalFrame();
00139         void    makeOriginalFrame();
00140         void    initializeOrthogonalNeighbors();
00141         void    resetPosition();
00142         void    checkPosition();
00143         
00144         void            setINITPosition( COME_Point3D &newPos ); //TEMP for testing RESPONSE
00145         COME_Point3D    getINITPositionGlobal(); //TEMP for testing RESPONSE
00146                 
00147         void            derivs( double currTime, double timestep, COME_Point3D *positionsIN, COME_Vector3D *velocitiesIN, COME_Vector3D *velocitiesOUT, COME_Vector3D *accelerationsOUT, int currIndex );
00148         int             updateLinks();
00149         COME_Force      externalForceTo( double currTime );
00150 
00151         // To be used in chart plotting
00152         COME_Force      fOriginal, fDamping, fFriction, fLocal, fGravity, fExternal, fCollision;
00153 
00154         double  *liquidSharingArray;
00155 };
00156 
00157 #endif // __COME_MOLECULE_H     

Generated on Thu Dec 1 10:13:34 2005 for COME - Biomechanical Joint Model by  doxygen 1.4.5