oomph::GeneralCircle Class Reference

#include <circle.h>

+ Inheritance diagram for oomph::GeneralCircle:

Public Member Functions

 GeneralCircle (const double &x_c, const double &y_c, const double &r)
 Constructor: Pass x and y-coords of centre and radius (all pinned) More...
 
 GeneralCircle (Data *geom_data_pt)
 
virtual ~GeneralCircle ()
 Destructor: Clean up if necessary. More...
 
void position (const Vector< double > &zeta, Vector< double > &r) const
 Position Vector at Lagrangian coordinate zeta. More...
 
void position (const unsigned &t, const Vector< double > &zeta, Vector< double > &r) const
 
doublex_c ()
 Access function to x-coordinate of centre of circle. More...
 
doubley_c ()
 Access function to y-coordinate of centre of circle. More...
 
doubleR ()
 Access function to radius of circle. More...
 
unsigned ngeom_data () const
 How many items of Data does the shape of the object depend on? More...
 
Datageom_data_pt (const unsigned &j)
 
- Public Member Functions inherited from oomph::GeomObject
 GeomObject ()
 Default constructor. More...
 
 GeomObject (const unsigned &ndim)
 
 GeomObject (const unsigned &nlagrangian, const unsigned &ndim)
 
 GeomObject (const unsigned &nlagrangian, const unsigned &ndim, TimeStepper *time_stepper_pt)
 
 GeomObject (const GeomObject &dummy)=delete
 Broken copy constructor. More...
 
void operator= (const GeomObject &)=delete
 Broken assignment operator. More...
 
virtual ~GeomObject ()
 (Empty) destructor More...
 
unsigned nlagrangian () const
 Access function to # of Lagrangian coordinates. More...
 
unsigned ndim () const
 Access function to # of Eulerian coordinates. More...
 
void set_nlagrangian_and_ndim (const unsigned &n_lagrangian, const unsigned &n_dim)
 Set # of Lagrangian and Eulerian coordinates. More...
 
TimeStepper *& time_stepper_pt ()
 
TimeSteppertime_stepper_pt () const
 
virtual void position (const double &t, const Vector< double > &zeta, Vector< double > &r) const
 
virtual void dposition_dt (const Vector< double > &zeta, const unsigned &j, Vector< double > &drdt)
 
virtual void dposition (const Vector< double > &zeta, DenseMatrix< double > &drdzeta) const
 
virtual void d2position (const Vector< double > &zeta, RankThreeTensor< double > &ddrdzeta) const
 
virtual void d2position (const Vector< double > &zeta, Vector< double > &r, DenseMatrix< double > &drdzeta, RankThreeTensor< double > &ddrdzeta) const
 
virtual void locate_zeta (const Vector< double > &zeta, GeomObject *&sub_geom_object_pt, Vector< double > &s, const bool &use_coordinate_as_initial_guess=false)
 
virtual void interpolated_zeta (const Vector< double > &s, Vector< double > &zeta) const
 

Protected Attributes

Vector< Data * > Geom_data_pt
 Vector of pointers to Data items that affects the object's shape. More...
 
bool Must_clean_up
 Do I need to clean up? More...
 
- Protected Attributes inherited from oomph::GeomObject
unsigned NLagrangian
 Number of Lagrangian (intrinsic) coordinates. More...
 
unsigned Ndim
 Number of Eulerian coordinates. More...
 
TimeStepperGeom_object_time_stepper_pt
 

Detailed Description

//////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////// GeneralCircle in 2D space.

\[ x = X_c + R \cos(\zeta) \]

\[ y = Y_c + R \sin(\zeta) \]

The three parameters \( X_c, Y_c \) and \( R \) are represented by Data and can therefore be unknowns in the problem.

Constructor & Destructor Documentation

◆ GeneralCircle() [1/2]

oomph::GeneralCircle::GeneralCircle ( const double x_c,
const double y_c,
const double r 
)
inline

Constructor: Pass x and y-coords of centre and radius (all pinned)

102  : GeomObject(1,2)
103  {
104  // Create Data: We have one Data item with 3 values. The Data object
105  // stores the x position of the circle's centre as value 0,
106  // the y position of the circle's centre as value 1, and the
107  // circle's radius as value 2.
108  Geom_data_pt.resize(1);
109  Geom_data_pt[0] = new Data(3);
110 
111  // Assign data: X_c -- the value is free by default: Need to pin it.
112 
113  // Pin the data
114  Geom_data_pt[0]->pin(0);
115  // Give it a value:
116  Geom_data_pt[0]->set_value(0,x_c);
117 
118  // Assign data: Y_c -- the value is free by default: Need to pin it.
119 
120  // Pin the data
121  Geom_data_pt[0]->pin(1);
122  // Give it a value:
123  Geom_data_pt[0]->set_value(1,y_c);
124 
125  // Assign data: R -- the value is free by default: Need to pin it.
126 
127  // Pin the data
128  Geom_data_pt[0]->pin(2);
129  // Give it a value:
130  Geom_data_pt[0]->set_value(2,r);
131 
132  // I've created the data, I need to clean up
133  Must_clean_up=true;
134  }
Vector< Data * > Geom_data_pt
Vector of pointers to Data items that affects the object's shape.
Definition: circle.h:224
bool Must_clean_up
Do I need to clean up?
Definition: circle.h:227
double & x_c()
Access function to x-coordinate of centre of circle.
Definition: circle.h:205
double & y_c()
Access function to y-coordinate of centre of circle.
Definition: circle.h:208
GeomObject()
Default constructor.
Definition: geom_objects.h:104
r
Definition: UniformPSDSelfTest.py:20

References Geom_data_pt, Must_clean_up, UniformPSDSelfTest::r, x_c(), and y_c().

◆ GeneralCircle() [2/2]

oomph::GeneralCircle::GeneralCircle ( Data geom_data_pt)
inline

Alternative constructor: Pass x and y-coords of centre and radius (all as part of Data)

Geom_data_pt[0]->value(0) = X_c;
Geom_data_pt[0]->value(1) = Y_c;
Geom_data_pt[0]->value(2) = R;
double & R()
Access function to radius of circle.
Definition: circle.h:211
double Y_c
... OR THESE...
Definition: heated_linear_solid_contact_with_gravity.cc:2846
143  : GeomObject(1,2)
144  {
145 #ifdef PARANOID
146  if (geom_data_pt->nvalue()!=3)
147  {
148  std::ostringstream error_stream;
149  error_stream << "Geometric Data must have 3 values, not "
150  << geom_data_pt->nvalue() << std::endl;
151 
152  throw OomphLibError(error_stream.str(),
155  }
156 #endif
157  Geom_data_pt.resize(1);
159 
160  // Data has been created externally: Must not clean up
161  Must_clean_up=false;
162 
163  } //end of alternative constructor
unsigned nvalue() const
Return number of values stored in data object (incl pinned ones).
Definition: nodes.h:483
Data * geom_data_pt(const unsigned &j)
Definition: circle.h:218
#define OOMPH_EXCEPTION_LOCATION
Definition: oomph_definitions.h:61
#define OOMPH_CURRENT_FUNCTION
Definition: oomph_definitions.h:86

References geom_data_pt(), Geom_data_pt, Must_clean_up, oomph::Data::nvalue(), OOMPH_CURRENT_FUNCTION, and OOMPH_EXCEPTION_LOCATION.

◆ ~GeneralCircle()

virtual oomph::GeneralCircle::~GeneralCircle ( )
inlinevirtual

Destructor: Clean up if necessary.

168  {
169  // Do I need to clean up?
170  if (Must_clean_up)
171  {
172  unsigned ngeom_data=Geom_data_pt.size();
173  for (unsigned i=0;i<ngeom_data;i++)
174  {
175  delete Geom_data_pt[i];
176  Geom_data_pt[i]=0;
177  }
178  }
179  } // end of destructor
int i
Definition: BiCGSTAB_step_by_step.cpp:9
unsigned ngeom_data() const
How many items of Data does the shape of the object depend on?
Definition: circle.h:214

References Geom_data_pt, i, Must_clean_up, and ngeom_data().

Member Function Documentation

◆ geom_data_pt()

Data* oomph::GeneralCircle::geom_data_pt ( const unsigned j)
inlinevirtual

Return pointer to the j-th Data item that the object's shape depends on

Reimplemented from oomph::GeomObject.

218 {return Geom_data_pt[j];}
std::ptrdiff_t j
Definition: tut_arithmetic_redux_minmax.cpp:2

References Geom_data_pt, and j.

Referenced by GeneralCircle().

◆ ngeom_data()

unsigned oomph::GeneralCircle::ngeom_data ( ) const
inlinevirtual

How many items of Data does the shape of the object depend on?

Reimplemented from oomph::GeomObject.

214 {return Geom_data_pt.size();}

References Geom_data_pt.

Referenced by ~GeneralCircle().

◆ position() [1/2]

void oomph::GeneralCircle::position ( const unsigned t,
const Vector< double > &  zeta,
Vector< double > &  r 
) const
inlinevirtual

Position Vector at Lagrangian coordinate zeta at time level t (t=0: present; t>0: previous level). Steady object, so we simply forward the call to the steady version.

Reimplemented from oomph::GeomObject.

202  {position(zeta,r);}
void position(const Vector< double > &zeta, Vector< double > &r) const
Position Vector at Lagrangian coordinate zeta.
Definition: circle.h:183
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 position(), UniformPSDSelfTest::r, and Eigen::zeta().

◆ position() [2/2]

void oomph::GeneralCircle::position ( const Vector< double > &  zeta,
Vector< double > &  r 
) const
inlinevirtual

Position Vector at Lagrangian coordinate zeta.

Implements oomph::GeomObject.

184  {
185  // Extract data
186  double X_c= Geom_data_pt[0]->value(0);
187  double Y_c= Geom_data_pt[0]->value(1);
188  double R= Geom_data_pt[0]->value(2);
189 
190  // Position vector
191  r[0] = X_c+R*cos(zeta[0]);
192  r[1] = Y_c+R*sin(zeta[0]);
193 
194  } // end of position(...)
AnnoyingScalar cos(const AnnoyingScalar &x)
Definition: AnnoyingScalar.h:136
AnnoyingScalar sin(const AnnoyingScalar &x)
Definition: AnnoyingScalar.h:137

References cos(), Geom_data_pt, UniformPSDSelfTest::r, R(), sin(), ProblemParameters::Y_c, and Eigen::zeta().

Referenced by main(), and position().

◆ R()

double& oomph::GeneralCircle::R ( )
inline

Access function to radius of circle.

211 {return *Geom_data_pt[0]->value_pt(2);}

References Geom_data_pt.

Referenced by position().

◆ x_c()

double& oomph::GeneralCircle::x_c ( )
inline

Access function to x-coordinate of centre of circle.

205 {return *Geom_data_pt[0]->value_pt(0);}

References Geom_data_pt.

Referenced by GeneralCircle().

◆ y_c()

double& oomph::GeneralCircle::y_c ( )
inline

Access function to y-coordinate of centre of circle.

208 {return *Geom_data_pt[0]->value_pt(1);}

References Geom_data_pt.

Referenced by oomph::ElasticallySupportedRingElement::fill_in_generic_residual_contribution(), GeneralCircle(), and main().

Member Data Documentation

◆ Geom_data_pt

Vector<Data*> oomph::GeneralCircle::Geom_data_pt
protected

Vector of pointers to Data items that affects the object's shape.

Referenced by oomph::ElasticallySupportedRingElement::ElasticallySupportedRingElement(), GeneralCircle(), geom_data_pt(), ngeom_data(), position(), R(), x_c(), y_c(), and ~GeneralCircle().

◆ Must_clean_up

bool oomph::GeneralCircle::Must_clean_up
protected

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