oomph::Ellipse Class Reference

#include <geom_objects.h>

+ Inheritance diagram for oomph::Ellipse:

Public Member Functions

 Ellipse (const Vector< Data * > &geom_data_pt)
 
 Ellipse (const double &A, const double &B)
 
 Ellipse (const Ellipse &dummy)=delete
 Broken copy constructor. More...
 
void operator= (const Ellipse &)=delete
 Broken assignment operator. More...
 
 ~Ellipse ()
 Destructor: Clean up if necessary. More...
 
void set_A_ellips (const double &a)
 Set horizontal half axis. More...
 
void set_B_ellips (const double &b)
 Set vertical half axis. More...
 
double a_ellips ()
 Access function for horizontal half axis. More...
 
double b_ellips ()
 Access function for vertical half axis. 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
 
void dposition (const Vector< double > &zeta, DenseMatrix< double > &drdzeta) const
 
void d2position (const Vector< double > &zeta, RankThreeTensor< double > &ddrdzeta) const
 
void d2position (const Vector< double > &zeta, Vector< double > &r, DenseMatrix< double > &drdzeta, RankThreeTensor< double > &ddrdzeta) const
 
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 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
 

Private 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...
 

Additional Inherited Members

- 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

//////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////// Steady ellipse with half axes A and B as geometric object:

\[ x = A \cos(\zeta) \]

\[ y = B \sin(\zeta) \]

Constructor & Destructor Documentation

◆ Ellipse() [1/3]

oomph::Ellipse::Ellipse ( const Vector< Data * > &  geom_data_pt)
inline

Constructor: 1 Lagrangian coordinate, 2 Eulerian coords. Pass half axes as Data:

Geom_data_pt[0]->value(0) = A
Geom_data_pt[0]->value(1) = B
Matrix< SCALARA, Dynamic, Dynamic, opt_A > A
Definition: bench_gemm.cpp:47
Vector< Data * > Geom_data_pt
Vector of pointers to Data items that affects the object's shape.
Definition: geom_objects.h:853
Definition: matrices.h:74
652  : GeomObject(1, 2)
653  {
654 #ifdef PARANOID
655  if (geom_data_pt.size() != 1)
656  {
657  std::ostringstream error_message;
658  error_message << "geom_data_pt should have size 1, not "
659  << geom_data_pt.size() << std::endl;
660 
661  if (geom_data_pt[0]->nvalue() != 2)
662  {
663  error_message << "geom_data_pt[0] should have 2 values, not "
664  << geom_data_pt[0]->nvalue() << std::endl;
665  }
666 
667  throw OomphLibError(error_message.str(),
670  }
671 #endif
672  Geom_data_pt.resize(1);
673  Geom_data_pt[0] = geom_data_pt[0];
674 
675  // Data has been created externally: Must not clean up
676  Must_clean_up = false;
677  }
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: geom_objects.h:846
bool Must_clean_up
Do I need to clean up?
Definition: geom_objects.h:856
GeomObject()
Default constructor.
Definition: geom_objects.h:104
#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.

◆ Ellipse() [2/3]

oomph::Ellipse::Ellipse ( const double A,
const double B 
)
inline

Constructor: 1 Lagrangian coordinate, 2 Eulerian coords. Pass half axes A and B; both pinned.

682  : GeomObject(1, 2)
683  {
684  // Resize Data for ellipse object:
685  Geom_data_pt.resize(1);
686 
687  // Create data: Two values, no timedependence, free by default
688  Geom_data_pt[0] = new Data(2);
689 
690  // I've created the data, I need to clean up
691  Must_clean_up = true;
692 
693  // Pin the data
694  Geom_data_pt[0]->pin(0);
695  Geom_data_pt[0]->pin(1);
696 
697  // Set half axes
698  Geom_data_pt[0]->set_value(0, A);
699  Geom_data_pt[0]->set_value(1, B);
700  }

References Geom_data_pt, and Must_clean_up.

◆ Ellipse() [3/3]

oomph::Ellipse::Ellipse ( const Ellipse dummy)
delete

Broken copy constructor.

◆ ~Ellipse()

oomph::Ellipse::~Ellipse ( )
inline

Destructor: Clean up if necessary.

710  {
711  // Do I need to clean up?
712  if (Must_clean_up)
713  {
714  delete Geom_data_pt[0];
715  Geom_data_pt[0] = 0;
716  }
717  }

References Geom_data_pt, and Must_clean_up.

Member Function Documentation

◆ a_ellips()

double oomph::Ellipse::a_ellips ( )
inline

Access function for horizontal half axis.

733  {
734  return Geom_data_pt[0]->value(0);
735  }

References Geom_data_pt.

◆ b_ellips()

double oomph::Ellipse::b_ellips ( )
inline

Access function for vertical half axis.

739  {
740  return Geom_data_pt[0]->value(1);
741  }

References Geom_data_pt.

◆ d2position() [1/2]

void oomph::Ellipse::d2position ( const Vector< double > &  zeta,
RankThreeTensor< double > &  ddrdzeta 
) const
inlinevirtual

2nd derivative of position Vector w.r.t. to coordinates: \( \frac{d^2R_i}{d \zeta_\alpha d \zeta_\beta}\) = ddrdzeta(alpha,beta,i). Evaluated at current time.

Reimplemented from oomph::GeomObject.

806  {
807  // Components of the derivative of the tangent Vector
808  ddrdzeta(0, 0, 0) = -Geom_data_pt[0]->value(0) * cos(zeta[0]);
809  ddrdzeta(0, 0, 1) = -Geom_data_pt[0]->value(1) * sin(zeta[0]);
810  }
AnnoyingScalar cos(const AnnoyingScalar &x)
Definition: AnnoyingScalar.h:136
AnnoyingScalar sin(const AnnoyingScalar &x)
Definition: AnnoyingScalar.h:137
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(), Geom_data_pt, sin(), and Eigen::zeta().

◆ d2position() [2/2]

void oomph::Ellipse::d2position ( const Vector< double > &  zeta,
Vector< double > &  r,
DenseMatrix< double > &  drdzeta,
RankThreeTensor< double > &  ddrdzeta 
) const
inlinevirtual

Position Vector and 1st and 2nd derivs to coordinates: \( \frac{dR_i}{d \zeta_\alpha}\) = drdzeta(alpha,i). \( \frac{d^2R_i}{d \zeta_\alpha d \zeta_\beta}\) = ddrdzeta(alpha,beta,i). Evaluated at current time.

Reimplemented from oomph::GeomObject.

821  {
822  double a = Geom_data_pt[0]->value(0);
823  double b = Geom_data_pt[0]->value(1);
824  // Position Vector
825  r[0] = a * cos(zeta[0]);
826  r[1] = b * sin(zeta[0]);
827 
828  // Components of the single tangent Vector
829  drdzeta(0, 0) = -a * sin(zeta[0]);
830  drdzeta(0, 1) = b * cos(zeta[0]);
831 
832  // Components of the derivative of the tangent Vector
833  ddrdzeta(0, 0, 0) = -a * cos(zeta[0]);
834  ddrdzeta(0, 0, 1) = -b * sin(zeta[0]);
835  }
Scalar * b
Definition: benchVecAdd.cpp:17
const Scalar * a
Definition: level2_cplx_impl.h:32
r
Definition: UniformPSDSelfTest.py:20

References a, b, cos(), Geom_data_pt, UniformPSDSelfTest::r, sin(), and Eigen::zeta().

◆ dposition()

void oomph::Ellipse::dposition ( const Vector< double > &  zeta,
DenseMatrix< double > &  drdzeta 
) const
inlinevirtual

Derivative of position Vector w.r.t. to coordinates: \( \frac{dR_i}{d \zeta_\alpha}\) = drdzeta(alpha,i).

Reimplemented from oomph::GeomObject.

793  {
794  // Components of the single tangent Vector
795  drdzeta(0, 0) = -Geom_data_pt[0]->value(0) * sin(zeta[0]);
796  drdzeta(0, 1) = Geom_data_pt[0]->value(1) * cos(zeta[0]);
797  }

References cos(), Geom_data_pt, sin(), and Eigen::zeta().

◆ geom_data_pt()

Data* oomph::Ellipse::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.

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

References Geom_data_pt, and j.

Referenced by Ellipse().

◆ ngeom_data()

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

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

Reimplemented from oomph::GeomObject.

840  {
841  return Geom_data_pt.size();
842  }

References Geom_data_pt.

◆ operator=()

void oomph::Ellipse::operator= ( const Ellipse )
delete

Broken assignment operator.

◆ position() [1/2]

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

Parametrised position on object: r(zeta). Evaluated at previous timestep. t=0: current time; t>0: previous timestep.

Reimplemented from oomph::GeomObject.

759  {
760  // If we have done the construction, it's a Steady Ellipse,
761  // so all time-history values of the position are equal to the position
762  if (Must_clean_up)
763  {
764  position(zeta, r);
765  return;
766  }
767 
768  // Otherwise check that the value of t is within range
769 #ifdef PARANOID
770  if (t > Geom_data_pt[0]->time_stepper_pt()->nprev_values())
771  {
772  std::ostringstream error_message;
773  error_message << "t > nprev_values() " << t << " "
774  << Geom_data_pt[0]->time_stepper_pt()->nprev_values()
775  << std::endl;
776 
777  throw OomphLibError(error_message.str(),
780  }
781 #endif
782 
783  // Position Vector
784  r[0] = Geom_data_pt[0]->value(t, 0) * cos(zeta[0]);
785  r[1] = Geom_data_pt[0]->value(t, 1) * sin(zeta[0]);
786  }
void position(const Vector< double > &zeta, Vector< double > &r) const
Position Vector at Lagrangian coordinate zeta.
Definition: geom_objects.h:745
TimeStepper *& time_stepper_pt()
Definition: geom_objects.h:192
t
Definition: plotPSD.py:36

References cos(), Geom_data_pt, Must_clean_up, OOMPH_CURRENT_FUNCTION, OOMPH_EXCEPTION_LOCATION, position(), UniformPSDSelfTest::r, sin(), plotPSD::t, oomph::GeomObject::time_stepper_pt(), and Eigen::zeta().

◆ position() [2/2]

◆ set_A_ellips()

void oomph::Ellipse::set_A_ellips ( const double a)
inline

Set horizontal half axis.

721  {
722  Geom_data_pt[0]->set_value(0, a);
723  }

References a, and Geom_data_pt.

◆ set_B_ellips()

void oomph::Ellipse::set_B_ellips ( const double b)
inline

Set vertical half axis.

727  {
728  Geom_data_pt[0]->set_value(1, b);
729  }

References b, and Geom_data_pt.

Member Data Documentation

◆ Geom_data_pt

Vector<Data*> oomph::Ellipse::Geom_data_pt
private

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

Referenced by a_ellips(), b_ellips(), d2position(), dposition(), Ellipse(), geom_data_pt(), ngeom_data(), position(), set_A_ellips(), set_B_ellips(), and ~Ellipse().

◆ Must_clean_up

bool oomph::Ellipse::Must_clean_up
private

Do I need to clean up?

Referenced by Ellipse(), position(), and ~Ellipse().


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