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_EDGESETGEOMETRYALGORITHMS_H 00026 #define SOFA_COMPONENT_TOPOLOGY_EDGESETGEOMETRYALGORITHMS_H 00027 00028 #include <sofa/component/topology/PointSetGeometryAlgorithms.h> 00029 00030 namespace sofa 00031 { 00032 00033 namespace component 00034 { 00035 00036 namespace topology 00037 { 00041 template < class T> 00042 class BasicArrayInterface 00043 { 00044 public: 00045 // Access to i-th element. 00046 virtual T & operator[](int i)=0; 00047 virtual ~BasicArrayInterface(){} 00048 00049 }; 00050 00051 using core::componentmodel::topology::BaseMeshTopology; 00052 typedef BaseMeshTopology::EdgeID EdgeID; 00053 typedef BaseMeshTopology::Edge Edge; 00054 typedef BaseMeshTopology::SeqEdges SeqEdges; 00055 typedef BaseMeshTopology::VertexEdges VertexEdges; 00056 00060 template < class DataTypes > 00061 class EdgeSetGeometryAlgorithms : public PointSetGeometryAlgorithms<DataTypes> 00062 { 00063 public: 00064 typedef typename DataTypes::VecCoord VecCoord; 00065 typedef typename DataTypes::Real Real; 00066 typedef typename DataTypes::Coord Coord; 00067 00068 00069 EdgeSetGeometryAlgorithms() 00070 : PointSetGeometryAlgorithms<DataTypes>() 00071 {} 00072 00073 virtual ~EdgeSetGeometryAlgorithms() {} 00074 00076 virtual Real computeEdgeLength(const unsigned int i) const; 00077 00079 virtual void computeEdgeLength( BasicArrayInterface<Real> &ai) const; // TODO: clarify, why not to use a vector here 00080 00082 virtual Real computeRestEdgeLength(const unsigned int i) const; 00083 00085 virtual Real computeRestSquareEdgeLength(const unsigned int i) const; 00086 00087 void writeMSHfile(const char *filename); 00088 }; 00089 00090 } // namespace topology 00091 00092 } // namespace component 00093 00094 } // namespace sofa 00095 00096 #endif
1.5.7.1