faunus
Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | List of all members
Faunus::Geometry::Chameleon Class Reference

Geometry class for spheres, cylinders, cuboids, hexagonal prism, truncated octahedron, slits. More...

#include <geometry.h>

Inheritance diagram for Faunus::Geometry::Chameleon:
Inheritance graph
[legend]
Collaboration diagram for Faunus::Geometry::Chameleon:
Collaboration graph
[legend]

Public Types

typedef std::pair< std::string, VariantVariantName
 

Public Member Functions

double getVolume (int dim=3) const override
 Get volume.
 
Point setVolume (double, VolumeMethod=VolumeMethod::ISOTROPIC) override
 Set volume.
 
Point getLength () const override
 A minimal containing cubic box.
 
void setLength (const Point &)
 Sets the box dimensions.
 
void boundary (Point &) const override
 Apply boundary conditions.
 
Point vdist (const Point &, const Point &) const override
 Minimum distance vector b->a.
 
double sqdist (const Point &, const Point &) const
 (Minimum) squared distance between two points
 
void randompos (Point &, Random &) const override
 Generate random position.
 
bool collision (const Point &) const override
 Overlap with boundaries.
 
void from_json (const json &) override
 
void to_json (json &j) const override
 
const BoundaryConditionboundaryConditions () const
 Get info on boundary conditions.
 
 Chameleon (const Variant type=Variant::CUBOID)
 
 Chameleon (const GeometryImplementation &geo, Variant type)
 
 Chameleon (const Chameleon &geo)
 Copy everything, but clone the geometry.
 
Chameleonoperator= (const Chameleon &geo)
 During the assignment copy everything, but clone the geometry.
 
std::shared_ptr< GeometryImplementationasSimpleGeometry () const
 
- Public Member Functions inherited from Faunus::Geometry::GeometryBase
BoundaryFunction getBoundaryFunc () const
 Lambda for applying boundary conditions on a point.
 
DistanceFunction getDistanceFunc () const
 Lambda for calculating the (minimum) distance vector between two positions.
 

Static Public Member Functions

static VariantName variantName (const std::string &name)
 
static VariantName variantName (const json &j)
 

Public Attributes

const Varianttype = _type
 Type of concrete geometry, read-only.
 
const std::string & name = _name
 Name of concrete geometry, e.g., for json, read-only.
 

Static Public Attributes

static const std::map< std::string, Variantnames
 Geometry names. More...
 

Additional Inherited Members

- Protected Member Functions inherited from Faunus::Geometry::GeometryBase
template<typename T = double>
int anint (T x) const
 Round to int.
 

Detailed Description

Geometry class for spheres, cylinders, cuboids, hexagonal prism, truncated octahedron, slits.

It is a wrapper of a concrete geometry implementation.

The class re-implements the time-critical functions vdist and boundary for the orthogonal periodic boundary conditions. Hence the call can be inlined by the compiler. That would not be possible otherwise due to the polymorphism of the concrete implementations. Other functions calls are delegated directly to the concrete implementation.

Note that the class implements a copy constructor and overloads the assignment operator.

Note
Todo:
Implement unit tests

Member Data Documentation

◆ names

const std::map< std::string, Variant > Faunus::Geometry::Chameleon::names
static
Initial value:
= {
{{"cuboid", Variant::CUBOID},
{"cylinder", Variant::CYLINDER},
{"slit", Variant::SLIT},
{"sphere", Variant::SPHERE},
{"hexagonal", Variant::HEXAGONAL},
{"octahedron", Variant::OCTAHEDRON},
{"hypersphere2d", Variant::HYPERSPHERE2D}}}

Geometry names.


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