Page MenuHomec4science

cylinder.hh
No OneTemporary

File Metadata

Created
Mon, Oct 21, 00:39

cylinder.hh

/**
* @file cylinder.hh
* @author Till Junge <junge@lsmspc42.epfl.ch>
* @date Wed Apr 4 15:28:40 2012
*
* @brief Cylinder geometry class
*
* @section LICENSE
*
* <insert lisence here>
*
*/
/* -------------------------------------------------------------------------- */
#ifndef __cadd_mesh_CYLINDER_HH__
#define __cadd_mesh_CYLINDER_HH__
#include "common.hh"
#include "geometry.hh"
/*! \brief implementation of the Geometry for cylinders (Circle in 2D)
*/
template <Uint DIM>
class Cylinder:public Geometry<DIM> {
/* ------------------------------------------------------------------------ */
/* Constructors/Destructors */
/* ------------------------------------------------------------------------ */
public:
// python helper constructor 3D
Cylinder(const std::vector<Real> & centre, const Real & radius,
const std::vector<Real> & axis, std::string name = "");
// python helper constructor 2D
Cylinder(const std::vector<Real> & centre, const Real & radius,
std::string name = "");
// 3D constructor
Cylinder(const PointRef<DIM> & centre, const Real & radius,
const Real * axis = nullptr, std::string name = "");
Cylinder(const Cylinder & other);
virtual ~Cylinder();
/* ------------------------------------------------------------------------ */
/* Methods */
/* ------------------------------------------------------------------------ */
public:
virtual Geometry<DIM> * resolveType() const {return newGeom<DIM>(*this);}
/// function to print the content of the class
virtual void printself(std::ostream & stream, int indent = 0) const;
virtual void shift(const PointRef<DIM> & offset);
/* ------------------------------------------------------------------------ */
/* Accessors */
/* ------------------------------------------------------------------------ */
public:
virtual bool is_inside(const Real * point, Real tol) const {
return this->from_border(point, tol).is_inside;}
virtual InsideObject from_border(const Real * point, Real tol) const;
// for instance x_min of a geom in latticespacings
virtual Real min_in_direction(const Real * dir, const Real & unit = 1) const;
// idem
virtual Real max_in_direction(const Real * dir, const Real & unit = 1) const;
// idem
virtual Real size_in_direction(const Real * dir, const Real & unit = 1) const;
virtual void generate_surface_points(const Mesh<DIM> & auxiliary,
const std::vector<Real> & refinement,
const Real step_size[DIM],
const Real & repr_const,
const bool periodicity[DIM],
PointContainer<DIM> & points) const;
virtual void complement_periodically(const Mesh<DIM> & auxiliary,
const std::vector<Real> & refinement,
PointContainer<DIM> & points,
int direction,
Uint dim) const;
//std::vector<Real> bounds ();
/* ------------------------------------------------------------------------ */
/* Class Members */
/* ------------------------------------------------------------------------ */
private:
Real in_direction(const Real * dir, const Real & norm) const;
bool periodicity_check(const bool periodicity[DIM]) const;
PointRef<DIM> base;
Real axis[DIM];
Real length;
Real radius;
};
/* -------------------------------------------------------------------------- */
/* inline functions */
/* -------------------------------------------------------------------------- */
/// standard output stream operator
template <Uint DIM>
inline std::ostream & operator <<(std::ostream & stream,
const Cylinder<DIM> & _this)
{
_this.printself(stream);
return stream;
}
#endif /* __cadd_mesh_CYLINDER_HH__ */

Event Timeline