This file is indexed.

/usr/include/sofa/component/mapping/TubularMapping.inl is in libsofa1-dev 1.0~beta4-10ubuntu2.

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
/******************************************************************************
*       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_MAPPING_TUBULARMAPPING_INL
#define SOFA_COMPONENT_MAPPING_TUBULARMAPPING_INL

#include <sofa/component/mapping/TubularMapping.h>
#include <sofa/defaulttype/VecTypes.h>
#include <sofa/defaulttype/RigidTypes.h>
#include <sofa/core/componentmodel/behavior/MechanicalMapping.inl>
#include <sofa/core/componentmodel/behavior/MechanicalState.h>


namespace sofa
{

namespace component
{

namespace mapping
{

template <class BasicMapping>
void TubularMapping<BasicMapping>::init()
{	
	this->BasicMapping::init();
	
}



template <class BasicMapping>
void TubularMapping<BasicMapping>::apply ( typename Out::VecCoord& out, const typename In::VecCoord& in )
{
	// Propagation of positions from the input DOFs to the output DOFs

	//sout << "TubularMapping<BasicMapping>::apply"<<sendl;

	if(out.size() != rotatedPoints.size()){
		rotatedPoints.resize(out.size());
	}

	unsigned int N = m_nbPointsOnEachCircle.getValue();
	double rho = m_radius.getValue();
 	
	out.resize(in.size() * N);
	rotatedPoints.resize(in.size() * N);

	Vec Y0;
	Vec Z0;
	Y0[0] = (Real) (0.0); Y0[1] = (Real) (1.0); Y0[2] = (Real) (0.0);
	Z0[0] = (Real) (0.0); Z0[1] = (Real) (0.0); Z0[2] = (Real) (1.0);

	for (unsigned int i=0; i<in.size(); i++)
	{		
		Vec curPos = in[i].getCenter();
		
		Mat rotation;
		in[i].writeRotationMatrix(rotation);

		Vec Y; 
		Vec Z;

		Y = rotation * Y0;
		Z = rotation * Z0;		

		for(unsigned int j=0; j<N; ++j){

			rotatedPoints[i*N+j] = (Y*cos((Real) (2.0*j*M_PI/N)) + Z*sin((Real) (2.0*j*M_PI/N)))*((Real) rho);
			Vec x = curPos + rotatedPoints[i*N+j];
			//sout << "INFO_print : TubularMapping  DO move point - j = " << j << " , curPos = " << curPos <<  " , x = " << x << sendl;

			out[i*N+j] = x;			
		}	
	}
}



template <class BasicMapping>
void TubularMapping<BasicMapping>::applyJ( typename Out::VecDeriv& out, const typename In::VecDeriv& in )
{
	
	// Propagation of velocities from the input DOFs to the output DOFs

	if(out.size() != rotatedPoints.size()){
		rotatedPoints.resize(out.size());
	}

	unsigned int N = m_nbPointsOnEachCircle.getValue();
 	
	out.resize(in.size() * N);
	Deriv v,omega;

	for (unsigned int i=0; i<in.size(); i++)
	{
		v = in[i].getVCenter();
		omega = in[i].getVOrientation();		

		for(unsigned int j=0; j<N; ++j){

			out[i*N+j] = v - cross(rotatedPoints[i*N+j],omega);		
			//sout << "INFO_print : TubularMapping  DO moveJ point - j = " << j << " , curPos = " << v <<  " , x = " << out[i*N+j] << sendl;
		}	
	}
}


template <class BasicMapping>
void TubularMapping<BasicMapping>::applyJT( typename In::VecDeriv& out, const typename Out::VecDeriv& in )
{	
	// usefull for a Mechanical Mapping that propagates forces from the output DOFs to the input DOFs

	//sout << "INFO_print : pass HERE applyJT !!!" << sendl;
	
	if(in.size() != rotatedPoints.size()){
		rotatedPoints.resize(in.size());
	}
	
	unsigned int N = m_nbPointsOnEachCircle.getValue();

	Deriv v,omega;	

	for (unsigned int i=0; i<out.size(); i++)
	{
		for(unsigned int j=0; j<N; j++){

			Deriv f = in[i*N+j];
			v += f;
			omega += cross(rotatedPoints[i*N+j],f);
		}

			out[i].getVCenter() += v;	
			out[i].getVOrientation() += omega;	
			//sout << "INFO_print : TubularMapping  DO moveJT point - i = " << i << sendl;			
	}
	
}

/*
template <class BasicMapping>
void TubularMapping<BasicMapping>::applyJT( typename In::VecConst& out, const typename Out::VecConst& in )
{	
	sout << "INFO_print : pass HERE applyJT CONST !!!" << sendl;

	Deriv v0;
	v0[0] = (Real) (0.0); v0[1] = (Real) (0.0); v0[2] = (Real) (0.0);

	for (unsigned int i=0; i<out.size(); i++)
	{
			out[i].getVCenter() = v0;	
			out[i].getVOrientation() = v0;	
			sout << "INFO_print : TubularMapping  DO moveJT point - i = " << i << sendl;			
	}
}
*/

} // namespace mapping

} // namespace component

} // namespace sofa

#endif // SOFA_COMPONENT_MAPPING_TUBULARMAPPING_INL