oomph::CircularPenetrator Class Reference

Penetrator – here implemented as a circle. More...

#include <contact_elements.h>

+ Inheritance diagram for oomph::CircularPenetrator:

Public Member Functions

 CircularPenetrator (Vector< double > *r_c_pt, const double &r)
 Constructor: Pass pointer to centre and radius. More...
 
virtual ~CircularPenetrator ()
 Destructor. More...
 
void penetration (const Vector< double > &x, const Vector< double > &n, double &d, bool &intersection) const
 Get penetration for given point x. More...
 
void output (std::ostream &outfile, const unsigned &nplot) const
 Output coordinates of penetrator at nplot plot points. More...
 
void position_from_zeta (const Vector< double > &zeta, Vector< double > &r) const
 Get position to surface, r, in terms of surface coordinate zeta. More...
 
void surface_coordinate (const Vector< double > &x, Vector< double > &zeta) const
 
Vector< doublerigid_body_displacement () const
 Get rigid body displacement of reference point in penetrator. More...
 
void set_original_centre (const Vector< double > &orig_centre)
 
- Public Member Functions inherited from oomph::Penetrator
 Penetrator ()
 Constructor. More...
 
virtual ~Penetrator ()
 Destructor. More...
 
virtual Vector< std::pair< Data *, unsigned > > equilibrium_data ()
 

Protected Attributes

Vector< double > * Centre_pt
 
Vector< doubleOrig_centre
 
double Radius
 Radius of penetrator. More...
 

Detailed Description

Penetrator – here implemented as a circle.

///////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////

Constructor & Destructor Documentation

◆ CircularPenetrator()

oomph::CircularPenetrator::CircularPenetrator ( Vector< double > *  r_c_pt,
const double r 
)
inline

Constructor: Pass pointer to centre and radius.

255  {
256  Centre_pt=r_c_pt;
257  Radius=r;
258 
259  // Back up original centre
260  unsigned n=r_c_pt->size();
261  Orig_centre.resize(n);
262  for (unsigned i=0;i<n;i++)
263  {
264  Orig_centre[i]=(*r_c_pt)[i];
265  }
266  }
int i
Definition: BiCGSTAB_step_by_step.cpp:9
const unsigned n
Definition: CG3DPackingUnitTest.cpp:11
Vector< double > Orig_centre
Definition: contact_elements.h:374
double Radius
Radius of penetrator.
Definition: contact_elements.h:377
Vector< double > * Centre_pt
Definition: contact_elements.h:369
r
Definition: UniformPSDSelfTest.py:20

References Centre_pt, i, n, Orig_centre, UniformPSDSelfTest::r, and Radius.

◆ ~CircularPenetrator()

virtual oomph::CircularPenetrator::~CircularPenetrator ( )
inlinevirtual

Destructor.

269 {}

Member Function Documentation

◆ output()

void oomph::CircularPenetrator::output ( std::ostream &  outfile,
const unsigned nplot 
) const
inlinevirtual

Output coordinates of penetrator at nplot plot points.

Implements oomph::Penetrator.

313  {
314  for (unsigned j=0;j<nplot;j++)
315  {
316  double phi=2.0*MathematicalConstants::Pi*double(j)/double(nplot-1);
317  outfile << (*Centre_pt)[0]+Radius*cos(phi) << " "
318  << (*Centre_pt)[1]+Radius*sin(phi)
319  << std::endl;
320  }
321  }
AnnoyingScalar cos(const AnnoyingScalar &x)
Definition: AnnoyingScalar.h:136
AnnoyingScalar sin(const AnnoyingScalar &x)
Definition: AnnoyingScalar.h:137
const double Pi
50 digits from maple
Definition: oomph_utilities.h:157
std::ptrdiff_t j
Definition: tut_arithmetic_redux_minmax.cpp:2

References cos(), j, oomph::MathematicalConstants::Pi, Radius, and sin().

◆ penetration()

void oomph::CircularPenetrator::penetration ( const Vector< double > &  x,
const Vector< double > &  n,
double d,
bool intersection 
) const
inlinevirtual

Get penetration for given point x.

Implements oomph::Penetrator.

276  {
277 
278  // Vector from potential contact point to centre of penetrator
279  Vector<double> l(2);
280  l[0]=(*Centre_pt)[0]-x[0];
281  l[1]=(*Centre_pt)[1]-x[1];
282 
283  // Distance from potential contact point to centre of penetrator
284  double ll=sqrt(l[0]*l[0]+l[1]*l[1]);
285 
286  // Projection of vector from potential contact point to centre of penetrator
287  // onto outer unit normal on potential contact point
288  double project=n[0]*l[0]+n[1]*l[1];
289  double project_squared=project*project;
290 
291  // Final term in square root
292  double b_squared=ll*ll-Radius*Radius;
293 
294  // Is square root negative? In this case we have no intersection
295  if (project_squared<b_squared)
296  {
297  d = 0.0;
298  intersection = false;
299  //return -10*std::numeric_limits<double>::min();
300  }
301  else
302  {
303  double sqr=sqrt(project_squared-b_squared);
304  d = -std::min(project-sqr,project+sqr);
305  intersection = true;
306  }
307  }
AnnoyingScalar sqrt(const AnnoyingScalar &x)
Definition: AnnoyingScalar.h:134
#define min(a, b)
Definition: datatypes.h:22
list x
Definition: plotDoE.py:28

References min, n, Radius, sqrt(), and plotDoE::x.

◆ position_from_zeta()

void oomph::CircularPenetrator::position_from_zeta ( const Vector< double > &  zeta,
Vector< double > &  r 
) const
inline

Get position to surface, r, in terms of surface coordinate zeta.

327  {
328  double phi=zeta[0];
329  r[0]=(*Centre_pt)[0]+Radius*cos(phi);
330  r[1]=(*Centre_pt)[1]+Radius*sin(phi);
331  }
EIGEN_STRONG_INLINE const Eigen::CwiseBinaryOp< Eigen::internal::scalar_zeta_op< typename DerivedX::Scalar >, const DerivedX, const DerivedQ > zeta(const Eigen::ArrayBase< DerivedX > &x, const Eigen::ArrayBase< DerivedQ > &q)
Definition: SpecialFunctionsArrayAPI.h:152

References cos(), UniformPSDSelfTest::r, Radius, sin(), and Eigen::zeta().

◆ rigid_body_displacement()

Vector<double> oomph::CircularPenetrator::rigid_body_displacement ( ) const
inlinevirtual

Get rigid body displacement of reference point in penetrator.

Reimplemented from oomph::Penetrator.

346  {
347  unsigned n=Orig_centre.size();
348  Vector<double> displ(n);
349  for (unsigned i=0;i<n;i++)
350  {
351  displ[i]=(*Centre_pt)[i]-Orig_centre[i];
352  }
353  return displ;
354  }

References i, n, and Orig_centre.

◆ set_original_centre()

void oomph::CircularPenetrator::set_original_centre ( const Vector< double > &  orig_centre)
inline

Set original centre of penetrator (for computation of rigid body displacement

360  {
361  Orig_centre=orig_centre;
362  }

References Orig_centre.

◆ surface_coordinate()

void oomph::CircularPenetrator::surface_coordinate ( const Vector< double > &  x,
Vector< double > &  zeta 
) const
inlinevirtual

Get surface coordinate along penetrator for given point x. We assume that point on the surface and given point share the same polar angle and return that polar angle

Reimplemented from oomph::Penetrator.

339  {
340  zeta[0]=atan2(x[1]-(*Centre_pt)[1],x[0]-(*Centre_pt)[0]);
341  }
AnnoyingScalar atan2(const AnnoyingScalar &y, const AnnoyingScalar &x)
Definition: AnnoyingScalar.h:139

References atan2(), Centre_pt, plotDoE::x, and Eigen::zeta().

Member Data Documentation

◆ Centre_pt

Vector<double>* oomph::CircularPenetrator::Centre_pt
protected

Pointer to centre of penetrator (origin for cylindrical polar coordinate system)

Referenced by CircularPenetrator(), surface_coordinate(), and oomph::HeatedCircularPenetrator::temperature().

◆ Orig_centre

Vector<double> oomph::CircularPenetrator::Orig_centre
protected

Original centre of penetrator (origin for cylindrical polar coordinate system)

Referenced by CircularPenetrator(), rigid_body_displacement(), and set_original_centre().

◆ Radius

double oomph::CircularPenetrator::Radius
protected

Radius of penetrator.

Referenced by CircularPenetrator(), output(), penetration(), and position_from_zeta().


The documentation for this class was generated from the following file: