OGS
SpatialPosition.h
Go to the documentation of this file.
1
11#pragma once
12
13#include <optional>
14
15#include "MathLib/Point3d.h"
16
17namespace ParameterLib
18{
27{
28public:
29 SpatialPosition() = default;
30
31 SpatialPosition(std::optional<std::size_t> const& node_id,
32 std::optional<std::size_t> const& element_id,
33 std::optional<unsigned> const& integration_point,
34 std::optional<MathLib::Point3d> const& coordinates)
35 : _node_id(node_id),
36 _element_id(element_id),
37 _integration_point(integration_point),
38 _coordinates(coordinates)
39 {
40 }
41
42 std::optional<std::size_t> getNodeID() const { return _node_id; }
43 std::optional<std::size_t> getElementID() const { return _element_id; }
44 std::optional<unsigned> getIntegrationPoint() const
45 {
46 return _integration_point;
47 }
48 std::optional<MathLib::Point3d> const& getCoordinates() const
49 {
50 return _coordinates;
51 }
52
53 void setNodeID(std::size_t node_id)
54 {
55 clear();
56 _node_id = node_id;
57 }
58
59 void setElementID(std::size_t element_id)
60 {
61 clear();
62 _element_id = element_id;
63 }
64
65 void setIntegrationPoint(unsigned integration_point)
66 {
67 assert(_element_id);
68 _integration_point = integration_point;
69 }
70
71 void setCoordinates(MathLib::Point3d const& coordinates)
72 {
73 _coordinates = coordinates;
74 }
75
76 void setAll(std::optional<std::size_t> const& node_id,
77 std::optional<std::size_t> const& element_id,
78 std::optional<unsigned> const& integration_point,
79 std::optional<MathLib::Point3d> const& coordinates)
80 {
81 _node_id = node_id;
82 _element_id = element_id;
83 _integration_point = integration_point;
84 _coordinates = coordinates;
85 }
86
87 void clear()
88 {
89 _node_id = std::nullopt;
90 _element_id = std::nullopt;
91 _integration_point = std::nullopt;
92 _coordinates = std::nullopt;
93 }
94
95private:
96 std::optional<std::size_t> _node_id;
97 std::optional<std::size_t> _element_id;
98 std::optional<unsigned> _integration_point;
99 std::optional<MathLib::Point3d> _coordinates;
100};
101
102} // namespace ParameterLib
Definition of the Point3d class.
std::optional< std::size_t > getNodeID() const
std::optional< unsigned > _integration_point
std::optional< MathLib::Point3d > const & getCoordinates() const
SpatialPosition(std::optional< std::size_t > const &node_id, std::optional< std::size_t > const &element_id, std::optional< unsigned > const &integration_point, std::optional< MathLib::Point3d > const &coordinates)
void setNodeID(std::size_t node_id)
void setAll(std::optional< std::size_t > const &node_id, std::optional< std::size_t > const &element_id, std::optional< unsigned > const &integration_point, std::optional< MathLib::Point3d > const &coordinates)
std::optional< std::size_t > getElementID() const
void setCoordinates(MathLib::Point3d const &coordinates)
std::optional< MathLib::Point3d > _coordinates
void setElementID(std::size_t element_id)
std::optional< unsigned > getIntegrationPoint() const
std::optional< std::size_t > _node_id
std::optional< std::size_t > _element_id
void setIntegrationPoint(unsigned integration_point)