MoReFEM
|
Define a SpatialPoint in a specific mesh. More...
#include <Coords.hpp>
Public Types | |
using | self = Coords |
Alias to the type of the class. | |
using | parent = SpatialPoint |
Alias to parent. | |
using | shared_ptr = std::shared_ptr<self> |
Smart pointers used to store objects in Mesh. | |
using | vector_shared_ptr = std::vector<shared_ptr> |
Vector of shared_ptr. | |
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 | |
CoordsNS::index_from_mesh_file | GetIndexFromMeshFile () const noexcept |
Index of the Coords as defined in the input mesh. | |
CoordsNS::processor_wise_position | GetProcessorWisePosition () const noexcept |
Get the position in the enclosing mesh list (should be in [0; Ncoords - 1] by design. | |
CoordsNS::program_wise_position | GetProgramWisePosition () const noexcept |
Get the program-wise position of a Coords. | |
template<CoordsNS::index_enum TypeT> | |
CoordsNS::index_type< TypeT > | GetIndex () const noexcept |
Returns the proper index related to the Coords such as mandated by the template parameter. | |
void | SetIndexFromMeshFile (::MoReFEM::CoordsNS::index_from_mesh_file index, bool do_allow_second_call=false) noexcept |
void | SetMeshLabel (const MeshLabel::const_shared_ptr &label) |
MeshLabel::const_shared_ptr | GetMeshLabelPtr () const |
Get the label. | |
void | ExtendedPrint (std::ostream &stream) const |
void | AddDomainContainingCoords (DomainNS::unique_id domain_unique_id) |
Add a new Domain that contains the Coords. | |
bool | IsInDomain (DomainNS::unique_id domain_unique_id) const |
Whether the given Coords belongs to the domain or not. | |
bool | IsInDomain (const Domain &domain) const |
Whether the given Coords belongs to the domain or not. | |
bool | IsLowestProcessorRank () const noexcept |
Whether the current processor is the lowest-ranked one to feature current Coords as a processor-wise one. | |
const std::set< DomainNS::unique_id > & | GetDomainList () const noexcept |
Get all Domain containing the current Coords. | |
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. | |
Static Public Member Functions | |
static void | SetCreateDomainListForCoords () |
Indicates we should keep track of the Domain to which the Coords belongs. | |
static create_domain_list_for_coords | GetCreateDomainListForCoords () |
Constant accessor on global variable create_domain_list_for_coords. | |
static std::size_t | Nobjects () |
Returns the number of Coords objects in existence. For debug purposes only. | |
Data Fields | |
friend | Mesh |
Friendship to Mesh so that it can update position index. | |
Private Member Functions | |
template<Internal::CoordsNS::DoCheckFirstCall DoCheckFirstCallT = Internal::CoordsNS::DoCheckFirstCall::yes> | |
void | SetProgramWisePosition (CoordsNS::program_wise_position position) noexcept |
Set the position in the enclosing mesh list. | |
template<Internal::CoordsNS::DoCheckFirstCall DoCheckFirstCallT = Internal::CoordsNS::DoCheckFirstCall::yes> | |
void | SetProcessorWisePosition (CoordsNS::processor_wise_position position) noexcept |
Set the processor-wise position in the enclosing mesh list. | |
const Internal::CoordsNS::CoordIndexes & | GetCoordIndexes () const noexcept |
Accessor to the object that stores the Coords indexes. | |
Internal::CoordsNS::CoordIndexes & | GetNonCstCoordIndexes () noexcept |
Non constant accessor to the object that stores the Coords indexes. | |
void | SetIsLowestProcessor (bool value) |
Static Private Member Functions | |
static create_domain_list_for_coords & | GetNonCstCreateDomainListForCoords () |
Non constant accessor on global variable create_domain_list_for_coords. | |
static std::size_t & | GetNonCstNobjects () |
Returns a reference to the number of Coords objects in existence. For debug purposes only. | |
Private Attributes | |
Internal::CoordsNS::CoordIndexes | coord_indexes_ |
Several indexes might be relevant for a given Coords; a struct has therefore been created to group them together and provide explanations about theirs differences. | |
MeshLabel::const_shared_ptr | mesh_label_ = nullptr |
Label to which the point belongs to. | |
std::set< DomainNS::unique_id > | domain_list_ |
List of all Domain containing the current Coords. | |
bool | is_lowest_processor_ = true |
Whether current processor is the lowest ranked one that features this Coords as processor-wise. | |
std::array< double, 3 > | coordinate_list_ |
List of coordinates. | |
Special member functions. | |
Coords () | |
Default constructor; all coordinates are set to 0. | |
Coords (double x, double y, double z, const double space_unit) | |
Constructor from components. | |
template<typename T > | |
Coords (T &&value, const double space_unit) | |
Constructor from an array. | |
Coords (std::size_t Ncoor, std::istream &stream, const double space_unit) | |
Constructor from a input stream. | |
Coords (const Coords &rhs)=delete | |
The copy constructor. | |
Coords (Coords &&rhs)=delete | |
The move constructor. | |
Coords & | operator= (const Coords &rhs)=delete |
The (copy) operator=. | |
Coords & | operator= (Coords &&rhs)=delete |
The (move) operator=. | |
~Coords () | |
Destructor. | |
Define a SpatialPoint in a specific mesh.
using MoReFEM::Coords::self = Coords |
Alias to the type of the class.
using MoReFEM::Coords::shared_ptr = std::shared_ptr<self> |
|
explicitprivate |
Constructor from components.
[in] | x | First component. |
[in] | y | Second component. |
[in] | z | Third component. |
[in] | space_unit | The unit of the mesh, in meters. |
|
explicitprivate |
Constructor from an array.
T | Must be std::array<Floating-point type, 3>. |
[in] | value | Value of the array to set. |
[in] | space_unit | The unit of the mesh, in meters. |
|
explicitprivate |
Constructor from a input stream.
[in] | Ncoor | Number of coordinates to be read. Expected to be at most 3. |
[in,out] | stream | Stream 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. |
[in] | space_unit | The unit of the mesh, in meters. |
|
privatedelete |
The copy constructor.
[in] | rhs | The object from which the construction occurs. |
|
privatedelete |
The move constructor.
[in] | rhs | The object from which the construction occurs. |
The (copy) operator=.
[in] | rhs | The object from which the affectation occurs. |
The (move) operator=.
[in] | rhs | The object from which the affectation occurs. |
|
noexcept |
Index of the Coords as defined in the input mesh.
This index:
It is fine to identify a Coords uniquely but should not be used for direct access to a Coords in a Coords list.
Remember anyway than MoReFEM strongly suggest to use objects (or pointers to objects) rather than such indexes; this functionality is there for internal use and for interface with output formats.
|
noexcept |
Get the position in the enclosing mesh list (should be in [0; Ncoords - 1] by design.
This method is what should be used to find a Coords in a Mesh container (or in the mesh methods Mesh::GetCoord()).
Remember anyway than MoReFEM strongly suggest to use objects (or pointers to objects) rather than such indexes; this functionality is mostly there for internal use.
|
noexcept |
Get the program-wise position of a Coords.
More precisely, this is the position the Coords had before we proceed to the reduction to processor-wise and ghost Coords.
This is probably not what you sought; most of the time you should use processor-wise one (or even better something that returns an object rather thamn an index).
|
noexcept |
|
noexcept |
Set the index used in the initial mesh file (the one from which Mesh object was built).
[in] | index | New value of the index. |
[in] | do_allow_second_call | False is the default value: the method is expected to be called once per Coords, and it's there checked through an assert. However, when reloading pre- partitioned data we need a second call; only for this specific call this argument should be set to true (this skips the assert). |
void MoReFEM::Coords::SetMeshLabel | ( | const MeshLabel::const_shared_ptr & | label | ) |
Set the label.
[in] | label | MeshLabel associated to the object. |
void MoReFEM::Coords::ExtendedPrint | ( | std::ostream & | stream | ) | const |
Extended Print function: display the coordinates and the index.
[in,out] | stream | Stream upon which object information are written. |
void MoReFEM::Coords::AddDomainContainingCoords | ( | DomainNS::unique_id | domain_unique_id | ) |
bool MoReFEM::Coords::IsInDomain | ( | DomainNS::unique_id | domain_unique_id | ) | const |
bool MoReFEM::Coords::IsInDomain | ( | const Domain & | domain | ) | const |
|
static |
|
noexcept |
Whether the current processor is the lowest-ranked one to feature current Coords as a processor-wise one.
Despite its public status, this should not be used as it is for low-level usage.
|
privatenoexcept |
Set the position in the enclosing mesh list.
DoCheckFirstCallT | Boolean value which is true by default - false is needed only in the specific case of loading from prepartitioned data. |
[in] | position | Position of the Coords in the mesh list before any partitioning occurred. |
|
privatenoexcept |
Set the processor-wise position in the enclosing mesh list.
DoCheckFirstCallT | Boolean value which is true by default - false is needed only in the specific case of loading from prepartitioned data. |
[in] | position | Position of the Coords in the mesh list processor-wise. |
By convention the method may also be called for a ghost - in this case the position in the dedicated Mesh::ghost_coords_list_ is the position given here minus the number of processor-wise Coords (said differently, the numbering is done so that the first ghost Coords is given the index immediately after the last processor-wise Coords.
|
private |
|
inherited |
Constant accessor to the i -th element of the object.
[in] | i | Index for of the sought value. |
i might be 0 (for 'x' component), 1 (for 'y') or 2 (for 'z').
|
inherited |
Non constant access to the value for component.
[in] | index | Index of the sought component: 0 for x, 1 for y and 2 for z. |
|
inherited |
Print function: display the coordinates.
[in,out] | stream | Stream upon which object information are written. |
|
private |
Label to which the point belongs to.
This is optional at the moment: only medit format provides this information. (and it's not entirely clear for me what happens to a point that belongs to two labels).
|
private |
Whether current processor is the lowest ranked one that features this Coords as processor-wise.
This is a purely internal quantity, very useful to make sure for instance Coords aren't counted twice if they are processor-wise on two different processors (might happen if for example related to both a P1 and a P0 shape function in two different NumberingSubset).
'Lowest' here refer to the integer rank; so if a Coords is both on processor 3 and 7, both of them should set this value to 3.