Biomechanical Joint Model
 Author: Anderson Maciel

comebiostructure.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 //  FILE........: comebiostructure.h
00027 //  DESCRIPTION.: 
00028 //                                 
00029 //
00030 //  AUTHOR......: Anderson Maciel
00031 //  DATE........: May/27/2002
00032 //  DESCRIPTION.: Class declaration.
00033 //
00035 
00036 #ifndef __COME_BIOSTRUCTURE_H   
00037 #define __COME_BIOSTRUCTURE_H   
00038 
00039 #include        <general/come.h>
00040 #include        <algebra/comemesh.h>
00041 #include        <algebra/comematrix.h>
00042 #include        <bio/comemoleculestissue.h>
00043 
00044 
00045 #ifndef __COME_SCENARIO_H
00046 class COME_Scenario;
00047 #endif
00048 
00049 typedef struct HashElement {
00050         
00051         COME_Face       *face;
00052         double          distance;
00053 } COME_HashElement;
00054 
00055 #define elem(i,j)       ((i*hashSize)+j)
00056 
00063 
00064 class COME_BioStructure : public COME {
00065 
00066 protected:
00067         int                     system;
00068         double                  volume;
00069         double                  collisionRadius; 
00070         COME_Mesh               *surface;
00071         bool                    fixed;
00072         int                             type;
00073         double                  globalHooke;
00074         COME_Matrix             localInstanceMatrix;
00075         COME_Matrix             globalInstanceMatrix;
00076         
00077 
00078 public:
00079 
00080         void    setSystem( int systemN );
00081         void    setSurface( COME_Mesh *surfaceN );
00082         void    setFixed( bool flag );
00083         void    setLIM( const COME_Matrix &limN );
00084         void    setGIM( const COME_Matrix &gimN );
00085         void    setGlobalHooke( double hookN ); 
00086         void    setCollisionRadius( double rad );
00087         void    setType( int nType );
00088         
00089         int             getSystem() const;
00090         COME_Mesh*      getSurface();
00091         COME_Mesh*      getPointerToSurface();
00092         double          getGlobalHooke() const;
00093         double          getCollisionRadius() const;
00094         double          getTopStress();
00095         void            scale( double factorx, double factory, double factorz );
00096         void            translate( double px, double py, double pz );
00097         void            translate( const COME_Vector3D &disp );
00098         void            rotate( double rx, double ry, double rz );
00099         void            scaleNominals( double factor );
00100 
00101         bool                    isFixed() const;
00102         double                  getMass() const;
00103         const COME_Matrix&      getLIM() const;
00104         const COME_Matrix&      getGIM() const;
00105 
00106         virtual bool    update( double timestep, double simClock ) = 0;
00107         virtual void    updateSkin() = 0;
00108         virtual void    updateSurface( bool regenerate ) = 0;
00109         //virtual void  initializeSkinning() = 0;
00110 
00111         virtual void    getEnvelop( COME_Point3D& mins, COME_Point3D& maxs ) = 0;
00112 
00113         virtual COME_MoleculesTissue    *getTissue() = 0;
00114         virtual void                    respondCollision() = 0;
00115         
00116         void                            initializeHashStructure();
00117         void                            initializeHashStructureRayCasting();
00118         COME_HashElement        getHashElement( COME_Point2D p );
00119         int                             fillHashHoles();
00120         
00121         int                                             hashSize;
00122         COME_HashElement                        *hashTable;
00123         vector<COME_BioStructure*>      internals;
00124         vector<string>                          internalsDesc;
00125         
00126         COME_Vector3D                   sUnit;
00127         COME_Point2D                            sSpherical;
00128 
00129         void    globalToLocal( COME_Matrix M, COME_Matrix MP );
00130 
00131 };
00132 
00133 #endif // __COME_BIOSTRUCTURE_H

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