OGS
Node.cpp
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (c) OpenGeoSys Community (opengeosys.org)
2// SPDX-License-Identifier: BSD-3-Clause
3
4#include "MeshLib/Node.h"
5
6#include <iomanip>
7
8#include "Elements/Element.h"
9
10namespace MeshLib
11{
12Node::Node(const double coords[3], std::size_t id)
14 std::array<double, 3>{{coords[0], coords[1], coords[2]}}, id)
15{
16}
17
18Node::Node(std::array<double, 3> const& coords, std::size_t id)
19 : MathLib::Point3dWithID(coords, id)
20{
21}
22
23Node::Node(double x, double y, double z, std::size_t id)
24 : MathLib::Point3dWithID(std::array<double, 3>({{x, y, z}}), id)
25{
26}
27
28std::ostream& operator<<(std::ostream& os, MeshLib::Node const& n)
29{
30 auto const default_precision = os.precision();
31 os << "node #" << n.getID() << " { "
32 << std::setprecision(std::numeric_limits<double>::digits10 + 1)
33 << static_cast<MathLib::Point3d const&>(n) << "}";
34 os << std::setprecision(default_precision);
35 return os;
36}
37} // namespace MeshLib
std::size_t getID() const
Point3dWithID(double x0, double x1, double x2, std::size_t id=std::numeric_limits< std::size_t >::max())
Node(const double coords[3], std::size_t id=std::numeric_limits< std::size_t >::max())
Constructor using a coordinate array.
Definition Node.cpp:12
std::ostream & operator<<(std::ostream &os, Element const &e)
Definition Element.cpp:97