oomph::Circle Class Reference

#include <geom_objects.h>

+ Inheritance diagram for oomph::Circle:

Public Member Functions

 Circle (const double &x_c, const double &y_c, const double &r)
 Constructor: Pass x and y-coords of centre and radius (all pinned) More...
 
 Circle (const double &x_c, const double &y_c, const double &r, TimeStepper *time_stepper_pt)
 
 Circle (const Vector< Data * > &geom_data_pt)
 
 Circle (const Circle &dummy)=delete
 Broken copy constructor. More...
 
void operator= (const Circle &)=delete
 Broken assignment operator. More...
 
virtual ~Circle ()
 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...
 
bool Is_time_dependent
 Genuine time-dependence? 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

//////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////// Circle in 2D space.

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

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

Constructor & Destructor Documentation

◆ Circle() [1/4]

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

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

877  : GeomObject(1, 2)
878  {
879  // Create Data:
880  Geom_data_pt.resize(1);
881  Geom_data_pt[0] = new Data(3);
882 
883  // No time-dependence
884  Is_time_dependent = false;
885 
886  // Assign data: X_c; no timedependence, free by default
887 
888  // Pin the data
889  Geom_data_pt[0]->pin(0);
890  // Give it a value:
891  Geom_data_pt[0]->set_value(0, x_c);
892 
893  // Assign data: Y_c; no timedependence, free by default
894 
895  // Pin the data
896  Geom_data_pt[0]->pin(1);
897  // Give it a value:
898  Geom_data_pt[0]->set_value(1, y_c);
899 
900  // Assign data: R; no timedependence, free by default
901 
902  // Pin the data
903  Geom_data_pt[0]->pin(2);
904  // Give it a value:
905  Geom_data_pt[0]->set_value(2, r);
906 
907  // I've created the data, I need to clean up
908  Must_clean_up = true;
909  }
double & y_c()
Access function to y-coordinate of centre of circle.
Definition: geom_objects.h:1083
Vector< Data * > Geom_data_pt
Vector of pointers to Data items that affects the object's shape.
Definition: geom_objects.h:1109
bool Must_clean_up
Do I need to clean up?
Definition: geom_objects.h:1112
double & x_c()
Access function to x-coordinate of centre of circle.
Definition: geom_objects.h:1077
bool Is_time_dependent
Genuine time-dependence?
Definition: geom_objects.h:1115
GeomObject()
Default constructor.
Definition: geom_objects.h:104
r
Definition: UniformPSDSelfTest.py:20

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

◆ Circle() [2/4]

oomph::Circle::Circle ( const double x_c,
const double y_c,
const double r,
TimeStepper time_stepper_pt 
)
inline

Constructor: Pass x and y-coords of centre and radius (all pinned) Circle is static but can be used in time-dependent runs with specified timestepper.

919  : GeomObject(1, 2, time_stepper_pt)
920  {
921  // Create Data:
922  Geom_data_pt.resize(1);
923  Geom_data_pt[0] = new Data(time_stepper_pt, 3);
924 
925  // We have time-dependence
926  Is_time_dependent = true;
927 
928  // Assign data: X_c; no timedependence, free by default
929 
930  // Pin the data
931  Geom_data_pt[0]->pin(0);
932  // Give it a value:
933  Geom_data_pt[0]->set_value(0, x_c);
934 
935  // Assign data: Y_c; no timedependence, free by default
936 
937  // Pin the data
938  Geom_data_pt[0]->pin(1);
939  // Give it a value:
940  Geom_data_pt[0]->set_value(1, y_c);
941 
942  // Assign data: R; no timedependence, free by default
943 
944  // Pin the data
945  Geom_data_pt[0]->pin(2);
946  // Give it a value:
947  Geom_data_pt[0]->set_value(2, r);
948 
949  // "Impulsive" start because there isn't any time-dependence
951 
952  // I've created the data, I need to clean up
953  Must_clean_up = true;
954  }
TimeStepper *& time_stepper_pt()
Definition: geom_objects.h:192
virtual void assign_initial_values_impulsive(Data *const &data_pt)=0

References oomph::TimeStepper::assign_initial_values_impulsive(), Geom_data_pt, Is_time_dependent, Must_clean_up, UniformPSDSelfTest::r, oomph::GeomObject::time_stepper_pt(), x_c(), and y_c().

◆ Circle() [3/4]

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

Constructor: Pass x and y-coords of centre and radius (all as 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: geom_objects.h:1089
double Y_c
... OR THESE...
Definition: heated_linear_solid_contact_with_gravity.cc:2846
964  : GeomObject(1, 2)
965  {
966 #ifdef PARANOID
967  if (geom_data_pt.size() != 1)
968  {
969  std::ostringstream error_message;
970  error_message << "geom_data_pt should have size 1, not "
971  << geom_data_pt.size() << std::endl;
972 
973  if (geom_data_pt[0]->nvalue() != 3)
974  {
975  error_message << "geom_data_pt[0] should have 3 values, not "
976  << geom_data_pt[0]->nvalue() << std::endl;
977  }
978 
979  throw OomphLibError(error_message.str(),
982  }
983 #endif
984 
985  // We have time-dependence
986  if (geom_data_pt[0]->time_stepper_pt()->nprev_values() > 0)
987  {
988  Is_time_dependent = true;
989  }
990  else
991  {
992  Is_time_dependent = false;
993  }
994 
995  Geom_data_pt.resize(1);
996  Geom_data_pt[0] = geom_data_pt[0];
997 
998  // Data has been created externally: Must not clean up
999  Must_clean_up = false;
1000  }
Data * geom_data_pt(const unsigned &j)
Definition: geom_objects.h:1102
unsigned nvalue() const
Return number of values stored in data object (incl pinned ones).
Definition: nodes.h:483
#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, Is_time_dependent, Must_clean_up, oomph::Data::nvalue(), OOMPH_CURRENT_FUNCTION, OOMPH_EXCEPTION_LOCATION, and oomph::GeomObject::time_stepper_pt().

◆ Circle() [4/4]

oomph::Circle::Circle ( const Circle dummy)
delete

Broken copy constructor.

◆ ~Circle()

virtual oomph::Circle::~Circle ( )
inlinevirtual

Destructor: Clean up if necessary.

1010  {
1011  // Do I need to clean up?
1012  if (Must_clean_up)
1013  {
1014  unsigned ngeom_data = Geom_data_pt.size();
1015  for (unsigned i = 0; i < ngeom_data; i++)
1016  {
1017  delete Geom_data_pt[i];
1018  Geom_data_pt[i] = 0;
1019  }
1020  }
1021  }
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: geom_objects.h:1095

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

Member Function Documentation

◆ geom_data_pt()

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

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

References Geom_data_pt, and j.

Referenced by Circle().

◆ ngeom_data()

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

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

Reimplemented from oomph::GeomObject.

1096  {
1097  return Geom_data_pt.size();
1098  }

References Geom_data_pt.

Referenced by ~Circle().

◆ operator=()

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

Broken assignment operator.

◆ position() [1/2]

void oomph::Circle::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.

1043  {
1044  // Genuine time-dependence?
1045  if (!Is_time_dependent)
1046  {
1047  position(zeta, r);
1048  }
1049  else
1050  {
1051 #ifdef PARANOID
1052  if (t > Geom_data_pt[0]->time_stepper_pt()->nprev_values())
1053  {
1054  std::ostringstream error_message;
1055  error_message << "t > nprev_values() " << t << " "
1056  << Geom_data_pt[0]->time_stepper_pt()->nprev_values()
1057  << std::endl;
1058 
1059  throw OomphLibError(error_message.str(),
1062  }
1063 #endif
1064 
1065  // Extract data
1066  double X_c = Geom_data_pt[0]->value(t, 0);
1067  double Y_c = Geom_data_pt[0]->value(t, 1);
1068  double R = Geom_data_pt[0]->value(t, 2);
1069 
1070  // Position Vector
1071  r[0] = X_c + R * cos(zeta[0]);
1072  r[1] = Y_c + R * sin(zeta[0]);
1073  }
1074  }
AnnoyingScalar cos(const AnnoyingScalar &x)
Definition: AnnoyingScalar.h:136
AnnoyingScalar sin(const AnnoyingScalar &x)
Definition: AnnoyingScalar.h:137
void position(const Vector< double > &zeta, Vector< double > &r) const
Position Vector at Lagrangian coordinate zeta.
Definition: geom_objects.h:1024
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
t
Definition: plotPSD.py:36

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

◆ position() [2/2]

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

Position Vector at Lagrangian coordinate zeta.

Implements oomph::GeomObject.

1025  {
1026  // Extract data
1027  double X_c = Geom_data_pt[0]->value(0);
1028  double Y_c = Geom_data_pt[0]->value(1);
1029  double R = Geom_data_pt[0]->value(2);
1030 
1031  // Position Vector
1032  r[0] = X_c + R * cos(zeta[0]);
1033  r[1] = Y_c + R * sin(zeta[0]);
1034  }

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

Referenced by oomph::CylinderWithFlagDomain::macro_element_boundary(), and position().

◆ R()

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

Access function to radius of circle.

1090  {
1091  return *Geom_data_pt[0]->value_pt(2);
1092  }

References Geom_data_pt.

Referenced by position().

◆ x_c()

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

Access function to x-coordinate of centre of circle.

1078  {
1079  return *Geom_data_pt[0]->value_pt(0);
1080  }

References Geom_data_pt.

Referenced by Circle().

◆ y_c()

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

Access function to y-coordinate of centre of circle.

1084  {
1085  return *Geom_data_pt[0]->value_pt(1);
1086  }

References Geom_data_pt.

Referenced by Circle().

Member Data Documentation

◆ Geom_data_pt

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

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

Referenced by Circle(), geom_data_pt(), ngeom_data(), position(), R(), x_c(), y_c(), and ~Circle().

◆ Is_time_dependent

bool oomph::Circle::Is_time_dependent
protected

Genuine time-dependence?

Referenced by Circle(), and position().

◆ Must_clean_up

bool oomph::Circle::Must_clean_up
protected

Do I need to clean up?

Referenced by Circle(), and ~Circle().


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