Biomechanical Joint Model
 Author: Anderson Maciel

comemoleculestissue.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........: October/24/2002
00028 //  DESCRIPTION.: Class declaration.
00029 //
00031 
00032 #ifndef __COME_MOLECULESTISSUE_H        
00033 #define __COME_MOLECULESTISSUE_H        
00034 
00035 
00036 #include <general/come.h>
00037 #include <bio/comemolecule.h>
00038 #include <bio/comemoleculeschain.h>
00039 
00044 
00045 class COME_MoleculesTissue : public COME {
00046 
00047 protected:
00048         list<COME_Molecule*>    shape;
00049         double                          radiusAverage;
00050         double                          mass;
00051         int                                     averageNumConnectionsPerMolecule;
00052         float                                   accu;
00053         double                          simTime;
00054         
00055         //void  updateSurface( double skinSphere, double stiff, double resolution );
00056         COME_Vector3D *dymv, *dyma, *dytv, *dyta, *ytp, *ytv, *gpuForces;
00057 
00058 
00059 public:
00060         COME_MoleculesTissue();
00061         virtual ~COME_MoleculesTissue();
00062 
00063         list<COME_Molecule*>*   getShape();
00064 
00065         void    setRadiusAverage( double radiusN );
00066         void    setMass( double massN );
00067         void    updateAverageNumConnections();
00068 
00069         void    addMolecule( COME_Molecule *moleculeN );
00070         void    addMolecule( COME_Molecule *moleculeN, double minDdist );
00071         bool    updateEuler( double timestep, double simClock, string fileNameToSaveDeformation );
00072         bool    update( double timestep, double simClock, string fileNameToSaveDeformation );
00073         //void  updateSurface( bool regenerate );
00074         void    initForSimulation();
00075         void    makeAllLocalFrames();
00076         /* visco */ void        flow( double timestep );
00077 
00078         COME_Molecule*  nearestTo( COME_Point3D point );
00079         void            getEnvelop( COME_Point3D& mins, COME_Point3D& maxs );
00080         double          getMass();
00081         int                     getAverageNumConnections();
00082         double          getRadiusAverage();
00083         COME_Point3D    getMassCenter();
00084         COME_Force      getGPUForce( int i );
00085         void            recalculateAllSpringConstants( int mode, double currTime ); 
00086         void            setSurfaceMolecules();
00087         bool            isTooClose( COME_Point3D currentPoint, double distance );
00088 
00089         void    setMoleculesMaterial( COME_Material* newMaterial );
00090         void    setMoleculesDensity( double densityN );
00091         void    setMoleculesElasticity( double elasticityN );
00092         void    setMoleculesFrictionConst( double frictionN );
00093         
00094         COME_Material* getMoleculesMaterial();
00095 
00096         double  getDensity();
00097         double  getElasticity();
00098         double  getFrictionConst();
00099         double  getTopStress();
00100         void    checkInitialPositions();
00101         void    resetInitialPositions();
00102 
00103         // Auxiliary to test numerical method to configure spring k's.
00104         COME_MoleculesChain chain;
00105 
00106         
00107         // for offline simulation
00108         vector<COME_Point3D*>   deformation;
00109         vector<double*>         deformationStresses;
00110         vector<double*>         deformationStrains;
00111         void                    loadDeformationFile( string fileName );
00112         void                    saveDeformationFile( int fileMode  );
00113         
00114         // transforms
00115         void    scale( double factorx, double factory, double factorz );
00116         void    translate( double dx, double dy, double dz );
00117         void    rotate( double rx, double ry, double rz );
00118         void    transform( COME_Matrix M );
00119         void    transform( COME_Matrix M, COME_Matrix MP );
00120         
00121         void    scaleNominals( double factor );
00122 };
00123 
00124 #endif // __COME_MOLECULESTISSUE_H

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