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_BASETOPOLOGY_H 00028 #define SOFA_CORE_COMPONENTMODEL_TOPOLOGY_BASETOPOLOGY_H 00029 00030 #include <sofa/core/componentmodel/topology/BaseMeshTopology.h> 00031 #include <sofa/core/componentmodel/topology/BaseTopologyObject.h> 00032 00033 #include <sofa/helper/vector.h> 00034 #include <list> 00035 #include <string> 00036 00037 00038 namespace sofa 00039 { 00040 00041 namespace core 00042 { 00043 00044 namespace componentmodel 00045 { 00046 00047 namespace topology 00048 { 00049 using core::componentmodel::topology::BaseMeshTopology; 00050 00051 // forward declarations: 00052 00054 class TopologyAlgorithms; 00055 00057 class GeometryAlgorithms; 00058 00060 class TopologyModifier; 00061 00063 class TopologyContainer; 00064 00066 class TopologicalMapping; 00067 00068 00070 class TopologyAlgorithms : public sofa::core::componentmodel::topology::BaseTopologyObject 00071 { 00072 protected: 00076 TopologyAlgorithms() 00077 {} 00078 00079 public: 00081 virtual ~TopologyAlgorithms() 00082 {} 00083 00084 virtual void init(); 00085 00086 protected: 00089 void addTopologyChange(const TopologyChange *topologyChange); 00090 00091 protected: 00093 TopologyContainer *m_topologyContainer; 00094 }; 00095 00097 class GeometryAlgorithms : public sofa::core::componentmodel::topology::BaseTopologyObject 00098 { 00099 protected: 00103 GeometryAlgorithms() 00104 {} 00105 00106 public: 00108 virtual ~GeometryAlgorithms() 00109 {} 00110 00111 virtual void init(); 00112 }; 00113 00115 class TopologyModifier : public sofa::core::componentmodel::topology::BaseTopologyObject 00116 { 00117 protected: 00121 TopologyModifier() 00122 : m_topologyContainer(NULL) 00123 { } 00124 00125 public: 00127 virtual ~TopologyModifier() 00128 { } 00129 00130 virtual void init(); 00131 00141 virtual void propagateStateChanges(); 00142 00152 virtual void propagateTopologicalChanges(); 00153 00156 virtual void notifyEndingEvent(); 00157 00160 virtual void removeItems(sofa::helper::vector< unsigned int >& /*items*/); 00161 00162 protected: 00165 void addTopologyChange(const TopologyChange *topologyChange); 00166 00169 void addStateChange(const TopologyChange *topologyChange); 00170 00171 protected: 00173 TopologyContainer *m_topologyContainer; 00174 }; 00175 00177 class TopologyContainer : public sofa::core::componentmodel::topology::BaseTopologyObject, 00178 public core::componentmodel::topology::BaseMeshTopology 00179 { 00180 protected: 00184 TopologyContainer() 00185 {} 00186 00187 public: 00189 virtual ~TopologyContainer() 00190 {} 00191 00192 virtual void init(); 00193 00196 virtual const SeqEdges& getEdges() { static SeqEdges empty; return empty; } 00197 virtual const SeqTriangles& getTriangles() { static SeqTriangles empty; return empty; } 00198 virtual const SeqQuads& getQuads() { static SeqQuads empty; return empty; } 00199 virtual const SeqTetras& getTetras() { static SeqTetras empty; return empty; } 00200 virtual const SeqHexas& getHexas() { static SeqHexas empty; return empty; } 00202 00203 00204 const std::list<const TopologyChange *> &getChangeList() const { return m_changeList; } 00205 00206 const std::list<const TopologyChange *> &getStateChangeList() const { return m_stateChangeList; } 00207 00213 void addTopologyChange(const TopologyChange *topologyChange) 00214 { 00215 m_changeList.push_back(topologyChange); 00216 } 00217 00223 void addStateChange(const TopologyChange *topologyChange) 00224 { 00225 m_stateChangeList.push_back(topologyChange); 00226 } 00227 00230 std::list<const TopologyChange *>::const_iterator firstChange() const; 00231 00234 std::list<const TopologyChange *>::const_iterator lastChange() const; 00235 00238 std::list<const TopologyChange *>::const_iterator firstStateChange() const; 00239 00242 std::list<const TopologyChange *>::const_iterator lastStateChange() const; 00243 00244 00248 void resetTopologyChangeList(); 00249 00253 void resetStateChangeList(); 00254 00255 private: 00257 std::list<const TopologyChange *> m_changeList; 00258 00260 std::list<const TopologyChange *> m_stateChangeList; 00261 }; 00262 00263 } // namespace topology 00264 00265 } // namespace componentmodel 00266 00267 } // namespace core 00268 00269 } // namespace sofa 00270 00271 #endif // SOFA_CORE_BASICTOPOLOGY_H
1.5.7.1