OGS
Location.h
Go to the documentation of this file.
1
13#include <cstddef>
14#include <iosfwd>
15
16#pragma once
17
18namespace MeshLib
19{
20
22
24static constexpr char const* mesh_item_type_strings[] = {
25 "node", "edge", "face", "cell", "integration_point"};
26
28static constexpr char const* toString(const MeshItemType t)
29{
30 return mesh_item_type_strings[static_cast<int>(t)];
31}
32
33std::ostream& operator<<(std::ostream& os, MeshItemType const& t);
34
40{
41 std::size_t mesh_id;
43 std::size_t item_id;
44
45 Location(std::size_t meshid, MeshItemType itemtype, std::size_t itemid)
46 : mesh_id(meshid), item_type(itemtype), item_id(itemid){}
47};
48
50inline
51bool operator<(const Location& left, const Location& right)
52{
53 if (left.mesh_id != right.mesh_id)
54 {
55 return left.mesh_id < right.mesh_id;
56 }
57 if (left.item_type != right.item_type)
58 {
59 return left.item_type < right.item_type;
60 }
61 return left.item_id < right.item_id;
62}
63
64
65std::ostream& operator<<(std::ostream& os, Location const& l);
66
67} // namespace MeshLib
static constexpr char const * mesh_item_type_strings[]
Char array names for all of MeshItemType values.
Definition Location.h:24
MeshItemType
Definition Location.h:21
bool operator<(const Location &left, const Location &right)
Lexicographic order of Location.
Definition Location.h:51
std::ostream & operator<<(std::ostream &os, Element const &e)
Definition Element.cpp:88
static constexpr char const * toString(const MeshItemType t)
Returns a char array for a specific MeshItemType.
Definition Location.h:28
std::size_t item_id
Definition Location.h:43
std::size_t mesh_id
Definition Location.h:41
Location(std::size_t meshid, MeshItemType itemtype, std::size_t itemid)
Definition Location.h:45
MeshItemType item_type
Definition Location.h:42