This file is indexed.

/usr/include/sofa/component/mass/DiagonalMass.h is in libsofa1-dev 1.0~beta4-9.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
/******************************************************************************
*       SOFA, Simulation Open-Framework Architecture, version 1.0 beta 4      *
*                (c) 2006-2009 MGH, INRIA, USTL, UJF, CNRS                    *
*                                                                             *
* This library is free software; you can redistribute it and/or modify it     *
* under the terms of the GNU Lesser General Public License as published by    *
* the Free Software Foundation; either version 2.1 of the License, or (at     *
* your option) any later version.                                             *
*                                                                             *
* This library is distributed in the hope that it will be useful, but WITHOUT *
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or       *
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License *
* for more details.                                                           *
*                                                                             *
* You should have received a copy of the GNU Lesser General Public License    *
* along with this library; if not, write to the Free Software Foundation,     *
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 USA.          *
*******************************************************************************
*                               SOFA :: Modules                               *
*                                                                             *
* Authors: The SOFA Team and external contributors (see Authors.txt)          *
*                                                                             *
* Contact information: contact@sofa-framework.org                             *
******************************************************************************/
#ifndef SOFA_COMPONENT_MASS_DIAGONALMASS_H
#define SOFA_COMPONENT_MASS_DIAGONALMASS_H

#if !defined(__GNUC__) || (__GNUC__ > 3 || (_GNUC__ == 3 && __GNUC_MINOR__ > 3))
#pragma once
#endif

#include <sofa/defaulttype/VecTypes.h>
#include <sofa/core/componentmodel/behavior/Mass.h>
#include <sofa/core/componentmodel/behavior/MechanicalState.h>
#include <sofa/core/objectmodel/Event.h>
#include <sofa/component/topology/PointData.h>
#include <sofa/helper/vector.h>
#include <sofa/defaulttype/VecTypes.h>
#include <sofa/defaulttype/RigidTypes.h>

#include <sofa/component/topology/EdgeSetGeometryAlgorithms.h>
#include <sofa/component/topology/TriangleSetGeometryAlgorithms.h>
#include <sofa/component/topology/TetrahedronSetGeometryAlgorithms.h>
#include <sofa/component/topology/QuadSetGeometryAlgorithms.h>
#include <sofa/component/topology/HexahedronSetGeometryAlgorithms.h>

namespace sofa
{

namespace component
{

namespace mass
{

// template<class Vec> void readVec1(Vec& vec, const char* str);

template <class DataTypes, class MassType>
class DiagonalMass : public core::componentmodel::behavior::Mass<DataTypes>, public virtual core::objectmodel::BaseObject
{
public:
    typedef core::componentmodel::behavior::Mass<DataTypes> Inherited;
    typedef typename DataTypes::VecCoord VecCoord;
    typedef typename DataTypes::VecDeriv VecDeriv;
    typedef typename DataTypes::Coord Coord;
    typedef typename DataTypes::Deriv Deriv;
    typedef typename DataTypes::Real Real;

	typedef sofa::component::topology::PointData<MassType> VecMass;
	typedef helper::vector<MassType> MassVector;


	typedef enum {
		TOPOLOGY_UNKNOWN=0,
		TOPOLOGY_EDGESET=1,
		TOPOLOGY_TRIANGLESET=2,
		TOPOLOGY_TETRAHEDRONSET=3,
		TOPOLOGY_QUADSET=4,
		TOPOLOGY_HEXAHEDRONSET=5
	} TopologyType;

    VecMass f_mass;
    /// the mass density used to compute the mass from a mesh topology and geometry
    Data< Real > m_massDensity;

	/// to display the center of gravity of the system
	Data< bool > showCenterOfGravity;
	Data< float > showAxisSize;

protected:
    //VecMass masses;

    class Loader;
	/// The type of topology to build the mass from the topology
	TopologyType topologyType;	

public:

	sofa::core::componentmodel::topology::BaseMeshTopology* _topology;

	sofa::component::topology::EdgeSetGeometryAlgorithms<DataTypes>* edgeGeo; 	
	sofa::component::topology::TriangleSetGeometryAlgorithms<DataTypes>* triangleGeo; 
	sofa::component::topology::QuadSetGeometryAlgorithms<DataTypes>* quadGeo; 
	sofa::component::topology::TetrahedronSetGeometryAlgorithms<DataTypes>* tetraGeo; 
	sofa::component::topology::HexahedronSetGeometryAlgorithms<DataTypes>* hexaGeo; 

    DiagonalMass();

    ~DiagonalMass();

    //virtual const char* getTypeName() const { return "DiagonalMass"; }
    
    bool load(const char *filename);

    void clear();

    virtual void reinit();
    virtual void init();
    virtual void parse(core::objectmodel::BaseObjectDescription* arg);

    TopologyType getMassTopologyType() const {
        return topologyType;
    }
     Real getMassDensity() const {
         return m_massDensity.getValue();
     }


   // handle topological changes
   virtual void handleTopologyChange();

   void setMassDensity(Real m) {
	   m_massDensity.setValue(m);
   }


    void addMass(const MassType& mass);

    void resize(int vsize);

    // -- Mass interface
    void addMDx(VecDeriv& f, const VecDeriv& dx, double factor = 1.0);

    void accFromF(VecDeriv& a, const VecDeriv& f);

    void addForce(VecDeriv& f, const VecCoord& x, const VecDeriv& v);

    double getKineticEnergy(const VecDeriv& v);  ///< vMv/2 using dof->getV()

    double getPotentialEnergy(const VecCoord& x);   ///< Mgx potential in a uniform gravity field, null at origin

    void addGravityToV(double dt/*, defaulttype::BaseVector& v*/);

    /// Add Mass contribution to global Matrix assembling
    void addMToMatrix(defaulttype::BaseMatrix * mat, double mFact, unsigned int &offset);

    double getElementMass(unsigned int index);

    void draw();

    bool addBBox(double* minBBox, double* maxBBox);
};

#if defined(WIN32) && !defined(SOFA_COMPONENT_MASS_DIAGONALMASS_CPP)
#pragma warning(disable : 4231)
#ifndef SOFA_FLOAT
extern template class SOFA_COMPONENT_MASS_API DiagonalMass<defaulttype::Vec3dTypes,double>;
extern template class SOFA_COMPONENT_MASS_API DiagonalMass<defaulttype::Vec2dTypes,double>;
extern template class SOFA_COMPONENT_MASS_API DiagonalMass<defaulttype::Vec1dTypes,double>;
extern template class SOFA_COMPONENT_MASS_API DiagonalMass<defaulttype::Rigid3dTypes,defaulttype::Rigid3dMass>;
extern template class SOFA_COMPONENT_MASS_API DiagonalMass<defaulttype::Rigid2dTypes,defaulttype::Rigid2dMass>;
#endif
#ifndef SOFA_DOUBLE
extern template class SOFA_COMPONENT_MASS_API DiagonalMass<defaulttype::Vec3fTypes,float>;
extern template class SOFA_COMPONENT_MASS_API DiagonalMass<defaulttype::Vec2fTypes,float>;
extern template class SOFA_COMPONENT_MASS_API DiagonalMass<defaulttype::Vec1fTypes,float>;
extern template class SOFA_COMPONENT_MASS_API DiagonalMass<defaulttype::Rigid3fTypes,defaulttype::Rigid3fMass>;
extern template class SOFA_COMPONENT_MASS_API DiagonalMass<defaulttype::Rigid2fTypes,defaulttype::Rigid2fMass>;
#endif
#endif

} // namespace mass

} // namespace component

} // namespace sofa

#endif