TetrahedronSetTopologyChange.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_TETRAHEDRONSETTOPOLOGYCHANGE_H     
00026 #define SOFA_COMPONENT_TOPOLOGY_TETRAHEDRONSETTOPOLOGYCHANGE_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::Tetra Tetra;
00041     typedef Tetra Tetrahedron;
00042 
00044     class TetrahedraAdded : public core::componentmodel::topology::TopologyChange  
00045     {
00046     public:
00047         TetrahedraAdded(const unsigned int nT) 
00048         : core::componentmodel::topology::TopologyChange(core::componentmodel::topology::TETRAHEDRAADDED), 
00049         nTetrahedra(nT)
00050         { }
00051 
00052         TetrahedraAdded(const unsigned int nT, 
00053                         const sofa::helper::vector< Tetrahedron >& _tetrahedronArray,
00054                         const sofa::helper::vector< unsigned int >& tetrahedraIndex) 
00055         : core::componentmodel::topology::TopologyChange(core::componentmodel::topology::TETRAHEDRAADDED), 
00056         nTetrahedra(nT), 
00057         tetrahedronArray(_tetrahedronArray), 
00058         tetrahedronIndexArray(tetrahedraIndex)
00059         { }
00060 
00061         TetrahedraAdded(const unsigned int nT, 
00062                         const sofa::helper::vector< Tetrahedron >& _tetrahedronArray,
00063                         const sofa::helper::vector< unsigned int >& tetrahedraIndex,
00064                         const sofa::helper::vector< sofa::helper::vector< unsigned int > >& ancestors,
00065                         const sofa::helper::vector< sofa::helper::vector< double > >& baryCoefs) 
00066         : core::componentmodel::topology::TopologyChange(core::componentmodel::topology::TETRAHEDRAADDED), 
00067         nTetrahedra(nT), 
00068         tetrahedronArray(_tetrahedronArray), 
00069         tetrahedronIndexArray(tetrahedraIndex),
00070         ancestorsList(ancestors), 
00071         coefs(baryCoefs) 
00072         { }
00073 
00074         unsigned int getNbAddedTetrahedra() const 
00075         {
00076             return nTetrahedra;
00077         }
00078 
00079     public:
00080         unsigned int nTetrahedra;
00081         sofa::helper::vector< Tetrahedron > tetrahedronArray;
00082         sofa::helper::vector< unsigned int > tetrahedronIndexArray;
00083         sofa::helper::vector< sofa::helper::vector< unsigned int > > ancestorsList;
00084         sofa::helper::vector< sofa::helper::vector< double > > coefs;
00085     };
00086 
00088     class TetrahedraRemoved : public core::componentmodel::topology::TopologyChange  
00089     {
00090     public:
00091         TetrahedraRemoved(const sofa::helper::vector<unsigned int> _tArray) 
00092         : core::componentmodel::topology::TopologyChange(core::componentmodel::topology::TETRAHEDRAREMOVED), 
00093         removedTetrahedraArray(_tArray) 
00094         { }
00095 
00096         const sofa::helper::vector<unsigned int> &getArray() const 
00097         {
00098             return removedTetrahedraArray;
00099         }
00100 
00101         unsigned int getNbRemovedTetrahedra() const 
00102         {
00103             return removedTetrahedraArray.size();
00104         }
00105 
00106     public:
00107         sofa::helper::vector<unsigned int> removedTetrahedraArray;
00108     };
00109 
00110 } // namespace topology
00111 
00112 } // namespace component
00113 
00114 } // namespace sofa
00115 
00116 #endif

Generated on Sun Nov 23 03:46:35 2008 for Sofa by  doxygen 1.5.7.1