EdgeSetTopologyChange.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 :: Modules                               *
00020 *                                                                             *
00021 * Authors: The SOFA Team and external contributors (see Authors.txt)          *
00022 *                                                                             *
00023 * Contact information: contact@sofa-framework.org                             *
00024 ******************************************************************************/
00025 #ifndef SOFA_COMPONENT_TOPOLOGY_EDGESETTOPOLOGYCHANGE_H
00026 #define SOFA_COMPONENT_TOPOLOGY_EDGESETTOPOLOGYCHANGE_H
00027 
00028 #include <sofa/core/componentmodel/topology/Topology.h>     // TopologyChange
00029 #include <sofa/helper/vector.h>
00030 
00031 namespace sofa
00032 {
00033 
00034 namespace component
00035 {
00036 
00037 namespace topology
00038 {
00039     using core::componentmodel::topology::BaseMeshTopology;
00040     typedef BaseMeshTopology::Edge Edge;
00041 
00043     class EdgesAdded : public core::componentmodel::topology::TopologyChange  
00044     {
00045     public:
00046         EdgesAdded(const unsigned int nE) 
00047             : core::componentmodel::topology::TopologyChange(core::componentmodel::topology::EDGESADDED), 
00048             nEdges(nE)
00049         { }
00050 
00051         EdgesAdded(const unsigned int nE, 
00052             const sofa::helper::vector< Edge >& edgesList,
00053             const sofa::helper::vector< unsigned int >& edgesIndex) 
00054             : core::componentmodel::topology::TopologyChange(core::componentmodel::topology::EDGESADDED), 
00055             nEdges(nE), 
00056             edgeArray(edgesList), 
00057             edgeIndexArray(edgesIndex)
00058         { }
00059 
00060         EdgesAdded(const unsigned int nE, 
00061             const sofa::helper::vector< Edge >& edgesList,
00062             const sofa::helper::vector< unsigned int >& edgesIndex,
00063             const sofa::helper::vector< sofa::helper::vector< unsigned int > >& ancestors) 
00064             : core::componentmodel::topology::TopologyChange(core::componentmodel::topology::EDGESADDED), 
00065             nEdges(nE), 
00066             edgeArray(edgesList), 
00067             edgeIndexArray(edgesIndex), 
00068             ancestorsList(ancestors)
00069         { }
00070 
00071         EdgesAdded(const unsigned int nE, 
00072             const sofa::helper::vector< Edge >& edgesList,
00073             const sofa::helper::vector< unsigned int >& edgesIndex,
00074             const sofa::helper::vector< sofa::helper::vector< unsigned int > >& ancestors,
00075             const sofa::helper::vector< sofa::helper::vector< double > >& baryCoefs) 
00076             : core::componentmodel::topology::TopologyChange(core::componentmodel::topology::EDGESADDED), 
00077             nEdges(nE), 
00078             edgeArray(edgesList), 
00079             edgeIndexArray(edgesIndex), 
00080             ancestorsList(ancestors), 
00081             coefs(baryCoefs) 
00082         { }
00083 
00084         virtual ~EdgesAdded() {}
00085 
00086         unsigned int getNbAddedEdges() const { return nEdges;}
00087 
00088     public:
00089         unsigned int nEdges;
00090         sofa::helper::vector< Edge > edgeArray;
00091         sofa::helper::vector< unsigned int > edgeIndexArray;
00092         sofa::helper::vector< sofa::helper::vector< unsigned int > > ancestorsList;
00093         sofa::helper::vector< sofa::helper::vector< double > > coefs;
00094     };
00095 
00096 
00098     class EdgesRemoved : public core::componentmodel::topology::TopologyChange  
00099     {
00100     public:
00101         EdgesRemoved(const sofa::helper::vector<unsigned int> _eArray)
00102         : core::componentmodel::topology::TopologyChange(core::componentmodel::topology::EDGESREMOVED), 
00103         removedEdgesArray(_eArray) 
00104         {}
00105 
00106         ~EdgesRemoved() {}
00107 
00108         virtual const sofa::helper::vector<unsigned int> &getArray() const 
00109         { 
00110             return removedEdgesArray; 
00111         }
00112 
00113         virtual unsigned int getNbRemovedEdges() const 
00114         { 
00115             return removedEdgesArray.size(); 
00116         }
00117 
00118     public:
00119         sofa::helper::vector<unsigned int> removedEdgesArray;
00120     };
00121 
00122 } // namespace topology
00123 
00124 } // namespace component
00125 
00126 } // namespace sofa
00127 
00128 #endif

Generated on Sun Nov 23 03:43:31 2008 for Sofa by  doxygen 1.5.7.1