PointSetTopologyChange.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_POINTSETTOPOLOGYCHANGE_H
00026 #define SOFA_COMPONENT_TOPOLOGY_POINTSETTOPOLOGYCHANGE_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 
00041     class PointsIndicesSwap : public core::componentmodel::topology::TopologyChange
00042     {
00043     public:
00044         PointsIndicesSwap(const unsigned int i1,const unsigned int i2)
00045         : core::componentmodel::topology::TopologyChange(core::componentmodel::topology::POINTSINDICESSWAP)
00046         {
00047             index[0]=i1;
00048             index[1]=i2;
00049         }
00050 
00051     public:
00052         unsigned int index[2];
00053     };
00054 
00056     class PointsAdded : public core::componentmodel::topology::TopologyChange
00057     {
00058     public:
00059 
00060         PointsAdded(const unsigned int nV)
00061         : core::componentmodel::topology::TopologyChange(core::componentmodel::topology::POINTSADDED)
00062         , nVertices(nV)
00063         { }
00064 
00065         PointsAdded(const unsigned int nV,
00066                     const sofa::helper::vector< sofa::helper::vector< unsigned int > >& ancestors,
00067                     const sofa::helper::vector< sofa::helper::vector< double       > >& baryCoefs)
00068         : core::componentmodel::topology::TopologyChange(core::componentmodel::topology::POINTSADDED)
00069         , nVertices(nV), ancestorsList(ancestors), coefs(baryCoefs)
00070         { }
00071 
00072         unsigned int getNbAddedVertices() const {return nVertices;}
00073 
00074     public:
00075         unsigned int nVertices;
00076         sofa::helper::vector< sofa::helper::vector< unsigned int > > ancestorsList;
00077         sofa::helper::vector< sofa::helper::vector< double       > > coefs;
00078     };
00079 
00081     class PointsRemoved : public core::componentmodel::topology::TopologyChange
00082     {
00083     public:
00084         PointsRemoved(const sofa::helper::vector<unsigned int>& _vArray)
00085         : core::componentmodel::topology::TopologyChange(core::componentmodel::topology::POINTSREMOVED),
00086         removedVertexArray(_vArray)
00087         { }
00088 
00089         const sofa::helper::vector<unsigned int> &getArray() const { return removedVertexArray; }
00090 
00091     public:
00092         sofa::helper::vector<unsigned int> removedVertexArray;
00093     };
00094 
00095 
00097     class PointsRenumbering : public core::componentmodel::topology::TopologyChange
00098     {
00099     public:
00100 
00101         PointsRenumbering()
00102             : core::componentmodel::topology::TopologyChange(core::componentmodel::topology::POINTSRENUMBERING)
00103         { }
00104 
00105         PointsRenumbering(const sofa::helper::vector< unsigned int >& indices,
00106                           const sofa::helper::vector< unsigned int >& inv_indices)
00107             : core::componentmodel::topology::TopologyChange(core::componentmodel::topology::POINTSRENUMBERING),
00108             indexArray(indices), inv_indexArray(inv_indices)
00109         { }
00110 
00111         const sofa::helper::vector<unsigned int> &getIndexArray() const { return indexArray; }
00112 
00113         const sofa::helper::vector<unsigned int> &getinv_IndexArray() const { return inv_indexArray; }
00114 
00115     public:
00116         sofa::helper::vector<unsigned int> indexArray;
00117         sofa::helper::vector<unsigned int> inv_indexArray;
00118     };
00119 
00120 
00121 } // namespace topology
00122 
00123 } // namespace component
00124 
00125 } // namespace sofa
00126 
00127 #endif // SOFA_COMPONENTS_POINTSETTOPOLOGYCHANGE_H

Generated on Sun Nov 23 03:45:05 2008 for Sofa by  doxygen 1.5.7.1