QuadSetTopologyChange.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_QUADSETTOPOLOGYCHANGE_H
00026 #define SOFA_COMPONENT_TOPOLOGY_QUADSETTOPOLOGYCHANGE_H
00027 
00028 #include <sofa/core/componentmodel/topology/Topology.h>     // TopologyChange
00029 #include <sofa/helper/vector.h>
00030 
00031 namespace sofa
00032 {
00033 namespace component
00034 {
00035 namespace topology
00036 {
00037     using core::componentmodel::topology::BaseMeshTopology;
00038     typedef BaseMeshTopology::Quad Quad;
00039     
00041     class QuadsAdded : public core::componentmodel::topology::TopologyChange  
00042     {
00043     public:
00044         QuadsAdded(const unsigned int nT) 
00045         : core::componentmodel::topology::TopologyChange(core::componentmodel::topology::QUADSADDED), 
00046         nQuads(nT)
00047         { }
00048 
00049         QuadsAdded(const unsigned int nT, 
00050                     const sofa::helper::vector< Quad >& _quadArray,
00051                     const sofa::helper::vector< unsigned int >& quadsIndex) 
00052         : core::componentmodel::topology::TopologyChange(core::componentmodel::topology::QUADSADDED), 
00053         nQuads(nT), 
00054         quadArray(_quadArray), 
00055         quadIndexArray(quadsIndex)
00056         { }
00057 
00058         QuadsAdded(const unsigned int nT, 
00059                     const sofa::helper::vector< Quad >& _quadArray,
00060                     const sofa::helper::vector< unsigned int >& quadsIndex,
00061                     const sofa::helper::vector< sofa::helper::vector< unsigned int > >& ancestors,
00062                     const sofa::helper::vector< sofa::helper::vector< double > >& baryCoefs) 
00063         : core::componentmodel::topology::TopologyChange(core::componentmodel::topology::QUADSADDED), 
00064         nQuads(nT), 
00065         quadArray(_quadArray), 
00066         quadIndexArray(quadsIndex),
00067         ancestorsList(ancestors), 
00068         coefs(baryCoefs) 
00069         { }
00070 
00071         unsigned int getNbAddedQuads() const 
00072         {
00073             return nQuads;
00074         }
00075 
00076         const sofa::helper::vector<unsigned int> &getArray() const 
00077         {
00078             return quadIndexArray;
00079         }   
00080 
00081         const Quad &getQuad(const unsigned int i)
00082         {
00083             return quadArray[i];
00084         }
00085 
00086     public:
00087         unsigned int nQuads;
00088         sofa::helper::vector< Quad > quadArray;
00089         sofa::helper::vector< unsigned int > quadIndexArray;
00090         sofa::helper::vector< sofa::helper::vector< unsigned int > > ancestorsList;
00091         sofa::helper::vector< sofa::helper::vector< double > > coefs;
00092     };
00093 
00095     class QuadsRemoved : public core::componentmodel::topology::TopologyChange  
00096     {
00097     public:
00098         QuadsRemoved(const sofa::helper::vector<unsigned int> _qArray)
00099         : core::componentmodel::topology::TopologyChange(core::componentmodel::topology::QUADSREMOVED), 
00100         removedQuadsArray(_qArray) 
00101         { }
00102 
00103         unsigned int getNbRemovedQuads() const 
00104         {
00105             return removedQuadsArray.size();
00106         }
00107 
00108         const sofa::helper::vector<unsigned int> &getArray() const 
00109         {
00110             return removedQuadsArray;
00111         }   
00112 
00113         unsigned int &getQuadIndices(const unsigned int i)
00114         {
00115             return removedQuadsArray[i];
00116         }
00117 
00118     protected:
00119         sofa::helper::vector<unsigned int> removedQuadsArray;   
00120     };
00121 
00122 } // namespace topology
00123 
00124 } // namespace component
00125 
00126 } // namespace sofa
00127 
00128 #endif

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