OGS
MathLib::TemplatePoint< T, DIM > Class Template Reference

Detailed Description

template<typename T, std::size_t DIM = 3>
class MathLib::TemplatePoint< T, DIM >

class-template for points can be instantiated by a numeric type.

Template Parameters
Tthe coordinate type

Definition at line 36 of file TemplatePoint.h.

#include <TemplatePoint.h>

Public Member Functions

 TemplatePoint ()
 
 TemplatePoint (std::array< T, DIM > x)
 
virtual ~TemplatePoint ()=default
 
 TemplatePoint (TemplatePoint const &)=default
 
TemplatePointoperator= (TemplatePoint const &)=default
 
const T & operator[] (std::size_t idx) const
 const access operator The access to the point coordinates is like the access to a field. Code example: More...
 
T & operator[] (std::size_t idx)
 access operator (see book Effektiv C++ programmieren - subsection 1.3.2 ). More...
 
const T * getCoords () const
 
T * getCoords ()
 
virtual void write (std::ostream &os) const
 
virtual void read (std::istream &is)
 

Private Attributes

std::array< T, DIM > x_
 

Constructor & Destructor Documentation

◆ TemplatePoint() [1/3]

template<typename T , std::size_t DIM>
MathLib::TemplatePoint< T, DIM >::TemplatePoint

default constructor with zero coordinates

Definition at line 99 of file TemplatePoint.h.

99  : x_({{0}})
100 {}
std::array< T, DIM > x_
Definition: TemplatePoint.h:95

◆ TemplatePoint() [2/3]

template<typename T , std::size_t DIM>
MathLib::TemplatePoint< T, DIM >::TemplatePoint ( std::array< T, DIM >  x)
explicit

constructor - constructs a TemplatePoint object

Parameters
xstd::array containing the coordinates of the point

Definition at line 103 of file TemplatePoint.h.

103  : x_(std::move(x))
104 {}

◆ ~TemplatePoint()

template<typename T , std::size_t DIM = 3>
virtual MathLib::TemplatePoint< T, DIM >::~TemplatePoint ( )
virtualdefault

virtual destructor

◆ TemplatePoint() [3/3]

template<typename T , std::size_t DIM = 3>
MathLib::TemplatePoint< T, DIM >::TemplatePoint ( TemplatePoint< T, DIM > const &  )
default

Member Function Documentation

◆ getCoords() [1/2]

template<typename T , std::size_t DIM = 3>
T* MathLib::TemplatePoint< T, DIM >::getCoords ( )
inline

Definition at line 77 of file TemplatePoint.h.

77 { return x_.data(); }

References MathLib::TemplatePoint< T, DIM >::x_.

◆ getCoords() [2/2]

template<typename T , std::size_t DIM = 3>
const T* MathLib::TemplatePoint< T, DIM >::getCoords ( ) const
inline

returns an array containing the coordinates of the point

Definition at line 75 of file TemplatePoint.h.

75 { return x_.data(); }

References MathLib::TemplatePoint< T, DIM >::x_.

Referenced by ProcessLib::HeatTransportBHE::HeatTransportBHELocalAssemblerBHE< ShapeFunction, IntegrationMethod, BHEType >::HeatTransportBHELocalAssemblerBHE(), GeoLib::MinimalBoundingSphere::MinimalBoundingSphere(), ProcessLib::NormalTractionBoundaryCondition::NormalTractionBoundaryConditionLocalAssembler< ShapeFunctionDisplacement, IntegrationMethod, GlobalDim >::NormalTractionBoundaryConditionLocalAssembler(), LayeredVolume::addLayerBoundaries(), MathLib::barycentricPointInTriangle(), MathLib::calcProjPntToLineAndDists(), MathLib::calcTetrahedronVolume(), MathLib::calcTriangleArea(), MeshLib::calculateNormalizedSurfaceNormal(), MathLib::gaussPointInTriangle(), MathLib::getAngle(), MeshLib::ProjectPointOnMesh::getElevation(), MeshLib::FaceRule::getFirstSurfaceVector(), ExactPredicates::getOrientation2d(), ExactPredicates::getOrientation2dFast(), MeshLib::FaceRule::getSecondSurfaceVector(), ProcessLib::SmallDeformationNonlocal::SmallDeformationNonlocalLocalAssembler< ShapeFunction, IntegrationMethod, DisplacementDim >::getSingleIntegrationPointCoordinates(), ProcessLib::LIE::HydroMechanics::HydroMechanicsProcess< GlobalDim >::initializeConcreteProcess(), ProcessLib::LIE::SmallDeformation::SmallDeformationProcess< DisplacementDim >::initializeConcreteProcess(), ProcessLib::SurfaceFluxLocalAssembler< ShapeFunction, IntegrationMethod, GlobalDim >::integrate(), MathLib::isCoplanar(), ProcessLib::DeactivatedSubdomain::isDeactivated(), GeoLib::lineSegmentIntersect(), MeshGeoToolsLib::mapPointOnSurfaceElement(), MathLib::orientation3d(), VtkPolylinesSource::RequestData(), ProcessLib::LIE::setFractureProperty(), MathLib::sqrDist(), MeshLib::CellRule::testElementNodeOrder(), testTriangleIntersectingAABB(), and GeoLib::triangleLineIntersection().

◆ operator=()

template<typename T , std::size_t DIM = 3>
TemplatePoint& MathLib::TemplatePoint< T, DIM >::operator= ( TemplatePoint< T, DIM > const &  )
default

◆ operator[]() [1/2]

template<typename T , std::size_t DIM = 3>
T& MathLib::TemplatePoint< T, DIM >::operator[] ( std::size_t  idx)
inline

access operator (see book Effektiv C++ programmieren - subsection 1.3.2 ).

See also
const T& operator[] (std::size_t idx) const

Definition at line 69 of file TemplatePoint.h.

70  {
71  return const_cast<T&> (static_cast<const TemplatePoint&> (*this)[idx]);
72  }

◆ operator[]() [2/2]

template<typename T , std::size_t DIM = 3>
const T& MathLib::TemplatePoint< T, DIM >::operator[] ( std::size_t  idx) const
inline

const access operator The access to the point coordinates is like the access to a field. Code example:

Point<double> point (1.0, 2.0, 3.0);
double sqrNrm2 = point[0] * point[0] + point[1] * point[1] + point[2] + point[2];

Definition at line 61 of file TemplatePoint.h.

62  {
63  assert (idx < DIM);
64  return x_[idx];
65  }

References MathLib::TemplatePoint< T, DIM >::x_.

◆ read()

template<typename T , std::size_t DIM = 3>
virtual void MathLib::TemplatePoint< T, DIM >::read ( std::istream &  is)
inlinevirtual

read point coordinates into stream (used from operator>>)

Definition at line 88 of file TemplatePoint.h.

89  {
90  std::copy(std::istream_iterator<T>(is), std::istream_iterator<T>(),
91  x_.begin());
92  }
void copy(PETScVector const &x, PETScVector &y)
Definition: LinAlg.cpp:37

References MathLib::LinAlg::copy(), and MathLib::TemplatePoint< T, DIM >::x_.

◆ write()

template<typename T , std::size_t DIM = 3>
virtual void MathLib::TemplatePoint< T, DIM >::write ( std::ostream &  os) const
inlinevirtual

write point coordinates into stream (used from operator<<)

Parameters
osa standard output stream

Reimplemented in FileIO::GMSH::GMSHPoint.

Definition at line 82 of file TemplatePoint.h.

83  {
84  std::copy(x_.cbegin(), x_.cend(), std::ostream_iterator<T>(os, " "));
85  }

References MathLib::LinAlg::copy(), and MathLib::TemplatePoint< T, DIM >::x_.

Member Data Documentation

◆ x_

template<typename T , std::size_t DIM = 3>
std::array<T, DIM> MathLib::TemplatePoint< T, DIM >::x_
private

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