MoReFEM
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Private Attributes | Friends
MoReFEM::SpatialPoint Class Reference

Define a spatial three-dimensional point. More...

#include <SpatialPoint.hpp>

Inheritance diagram for MoReFEM::SpatialPoint:
Collaboration diagram for MoReFEM::SpatialPoint:

Public Types

using self = SpatialPoint
 Alias to the type of the class.
 
using unique_ptr = std::unique_ptr<self>
 Convenient smart pointer.
 
using vector_unique_ptr = std::vector<unique_ptr>
 Vector of unique_ptr.
 

Public Member Functions

double x () const
 Return the first component of the point.
 
double y () const
 Return the second component of the point (if relevant; if not an exception is thrown).
 
double z () const
 Return the third component of the point (if relevant; if not an exception is thrown).
 
double operator[] (std::size_t i) const
 Constant accessor to the i -th element of the object.
 
double & GetNonCstValue (std::size_t index)
 Non constant access to the value for component.
 
void Print (std::ostream &stream) const
 
const std::array< double, 3 > & GetCoordinateList () const noexcept
 Get the position as a std::array.
 
void Reset ()
 Reset the coords to 0.
 
Special member functions.
 SpatialPoint ()
 Default constructor; all coordinates are set to 0.
 
 SpatialPoint (double x, double y, double z, const double space_unit)
 Constructor from three scalars.
 
template<typename T >
 SpatialPoint (T &&value, const double space_unit)
 Constructor from an array.
 
 SpatialPoint (std::size_t Ncoor, std::istream &stream, const double space_unit)
 Constructor from a input stream.
 
 SpatialPoint (const SpatialPoint &rhs)=delete
 The copy constructor.
 
 SpatialPoint (SpatialPoint &&rhs)=delete
 The move constructor.
 
 ~SpatialPoint ()
 Destructor.
 
SpatialPointoperator= (const SpatialPoint &rhs)=delete
 The (copy) operator=.
 
SpatialPointoperator= (SpatialPoint &&rhs)=delete
 The (move) operator=.
 

Private Attributes

std::array< double, 3 > coordinate_list_
 List of coordinates.
 

Friends

double Distance (const SpatialPoint &lhs, const SpatialPoint &rhs)
 Friendship.
 

Detailed Description

Define a spatial three-dimensional point.

If the point is actually part of a mesh, you should look for derived class Coords.

Todo
#887 Should probably be advanced, but currently FindSpatialPointOfGlobalVector requires public and casual access to it. However this class was avoided in Poromechanics; I'll have to check whether the new mechanism would work in CardiacMechanics where FindSpatialPointOfGlobalVector is applied (the priority of this task is not very high, and I have to retrieve what I did in Poromechanics.

Member Typedef Documentation

◆ self

Alias to the type of the class.

Constructor & Destructor Documentation

◆ SpatialPoint() [1/5]

MoReFEM::SpatialPoint::SpatialPoint ( double x,
double y,
double z,
const double space_unit )
explicit

Constructor from three scalars.

Parameters
[in]xValue for first component.
[in]yValue for second component.
[in]zValue for third component.
Parameters
[in]space_unitThe unit of the mesh, in meters.

◆ SpatialPoint() [2/5]

template<typename T >
MoReFEM::SpatialPoint::SpatialPoint ( T && value,
const double space_unit )
explicit

Constructor from an array.

Template Parameters
TMust be std::array<Floating-point type, 3>.
Parameters
[in]valueValue of the array to set.
Parameters
[in]space_unitThe unit of the mesh, in meters.

◆ SpatialPoint() [3/5]

MoReFEM::SpatialPoint::SpatialPoint ( std::size_t Ncoor,
std::istream & stream,
const double space_unit )
explicit

Constructor from a input stream.

Parameters
[in]NcoorNumber of coordinates to be read. Expected to be at most 3.
[in,out]streamStream from which the point is read. Coordinates are expected to be separated by tabs or spaces. Stream is read until failbit is met; then it is put back at the position just before that failure.
Parameters
[in]space_unitThe unit of the mesh, in meters.

◆ SpatialPoint() [4/5]

MoReFEM::SpatialPoint::SpatialPoint ( const SpatialPoint & rhs)
delete

The copy constructor.

Parameters
[in]rhsThe object from which the construction occurs.

◆ SpatialPoint() [5/5]

MoReFEM::SpatialPoint::SpatialPoint ( SpatialPoint && rhs)
delete

The move constructor.

Parameters
[in]rhsThe object from which the construction occurs.

◆ ~SpatialPoint()

MoReFEM::SpatialPoint::~SpatialPoint ( )

Destructor.

Virtual status is avoided as Coords objects are not supposed to be used through a SpatialPoint pointer, and at the time being no other child class is expected.

Member Function Documentation

◆ operator=() [1/2]

SpatialPoint & MoReFEM::SpatialPoint::operator= ( const SpatialPoint & rhs)
delete

The (copy) operator=.

Parameters
[in]rhsThe object from which the affectation occurs.
Returns
Reference to the object (to enable chained affectation).

◆ operator=() [2/2]

SpatialPoint & MoReFEM::SpatialPoint::operator= ( SpatialPoint && rhs)
delete

The (move) operator=.

Parameters
[in]rhsThe object from which the affectation occurs.
Returns
Reference to the object (to enable chained affectation).

◆ operator[]()

double MoReFEM::SpatialPoint::operator[] ( std::size_t i) const

Constant accessor to the i -th element of the object.

Parameters
[in]iIndex for of the sought value.
Returns
Value of the i -th element of the object.

i might be 0 (for 'x' component), 1 (for 'y') or 2 (for 'z').

◆ GetNonCstValue()

double & MoReFEM::SpatialPoint::GetNonCstValue ( std::size_t index)

Non constant access to the value for component.

Parameters
[in]indexIndex of the sought component: 0 for x, 1 for y and 2 for z.

◆ Print()

void MoReFEM::SpatialPoint::Print ( std::ostream & stream) const

Print function: display the coordinates.

Parameters
[in,out]streamStream upon which object information are written.

Friends And Related Symbol Documentation

◆ Distance

double Distance ( const SpatialPoint & lhs,
const SpatialPoint & rhs )
friend

Friendship.

Parameters
[in]lhsLeft-hand side.
[in]rhsRight-hand side.
Returns
Distance between two points following L2 norm.

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