Topology.h

Go to the documentation of this file.
00001 /******************************************************************************
00002 *       SOFA, Simulation Open-Framework Architecture, version 1.0 beta 3      *
00003 *                (c) 2006-2008 MGH, INRIA, USTL, UJF, CNRS                    *
00004 *                                                                             *
00005 * This library is free software; you can redistribute it and/or modify it     *
00006 * under the terms of the GNU Lesser General Public License as published by    *
00007 * the Free Software Foundation; either version 2.1 of the License, or (at     *
00008 * your option) any later version.                                             *
00009 *                                                                             *
00010 * This library is distributed in the hope that it will be useful, but WITHOUT *
00011 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or       *
00012 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License *
00013 * for more details.                                                           *
00014 *                                                                             *
00015 * You should have received a copy of the GNU Lesser General Public License    *
00016 * along with this library; if not, write to the Free Software Foundation,     *
00017 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 USA.          *
00018 *******************************************************************************
00019 *                              SOFA :: Framework                              *
00020 *                                                                             *
00021 * Authors: M. Adam, J. Allard, B. Andre, P-J. Bensoussan, S. Cotin, C. Duriez,*
00022 * H. Delingette, F. Falipou, F. Faure, S. Fonteneau, L. Heigeas, C. Mendoza,  *
00023 * M. Nesme, P. Neumann, J-P. de la Plata Alcade, F. Poyer and F. Roy          *
00024 *                                                                             *
00025 * Contact information: contact@sofa-framework.org                             *
00026 ******************************************************************************/
00027 #ifndef SOFA_CORE_COMPONENTMODEL_TOPOLOGY_TOPOLOGY_H
00028 #define SOFA_CORE_COMPONENTMODEL_TOPOLOGY_TOPOLOGY_H
00029 
00030 #include <stdlib.h>
00031 #include <string>
00032 #include <iostream>
00033 #include <sofa/core/objectmodel/BaseObject.h>
00034 
00035 #include <sofa/helper/vector.h>
00036 namespace sofa
00037 {
00038 
00039 namespace core
00040 {
00041 
00042 namespace componentmodel
00043 {
00044 
00045 namespace topology
00046 {
00047 
00049     enum TopologyChangeType 
00050     {
00051         BASE,               
00052         ENDING_EVENT,       
00053         POINTSINDICESSWAP,  
00054         POINTSADDED,        
00055         POINTSREMOVED,      
00056         POINTSRENUMBERING,  
00057         EDGESADDED,         
00058         EDGESREMOVED,       
00059         EDGESRENUMBERING,    
00060         TRIANGLESADDED,     
00061         TRIANGLESREMOVED,   
00062         TRIANGLESRENUMBERING, 
00063         TETRAHEDRAADDED,     
00064         TETRAHEDRAREMOVED,   
00065         TETRAHEDRARENUMBERING, 
00066 
00067         QUADSADDED,     
00068         QUADSREMOVED,   
00069         QUADSRENUMBERING, 
00070         HEXAHEDRAADDED,     
00071         HEXAHEDRAREMOVED,   
00072         HEXAHEDRARENUMBERING 
00073     };
00074 
00075 
00084     class TopologyChange 
00085     {
00086     public:
00091         virtual ~TopologyChange() {};
00092 
00094         TopologyChangeType getChangeType() const { return m_changeType;}
00095 
00096     protected:
00097         TopologyChange( TopologyChangeType changeType = BASE )
00098         : m_changeType(changeType) 
00099         {}
00100 
00101         TopologyChangeType m_changeType; 
00102     }; 
00103 
00105     class EndingEvent : public core::componentmodel::topology::TopologyChange  
00106     {
00107     public:
00108         EndingEvent() 
00109         : core::componentmodel::topology::TopologyChange(core::componentmodel::topology::ENDING_EVENT) 
00110         {}
00111     };
00112 
00113 
00114     class Topology : public virtual core::objectmodel::BaseObject
00115     {
00116     public:
00117         virtual ~Topology() 
00118         {}
00119 
00120         // Access to embedded position information (in case the topology is a regular grid for instance)
00121         // This is not very clean and is quit slow but it should only be used during initialization
00122 
00123         virtual bool hasPos() const { return false; }
00124         virtual int getNbPoints() const { return 0; }
00125         virtual void setNbPoints(int /*n*/){}
00126         virtual double getPX(int /*i*/) const { return 0.0; }
00127         virtual double getPY(int /*i*/) const { return 0.0; }
00128         virtual double getPZ(int /*i*/) const { return 0.0; }
00129     };
00130 
00131 } // namespace topology
00132 
00133 } // namespace componentmodel
00134 
00135 } // namespace core
00136 
00137 } // namespace sofa
00138 
00139 #endif

Generated on Sun Nov 23 02:29:24 2008 for Sofa by  doxygen 1.5.7.1