OGS
GMSHPoint.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 "GMSHPoint.h"
5
6#include <cmath>
7#include <limits>
8
9namespace FileIO
10{
11namespace GMSH
12{
13GMSHPoint::GMSHPoint(GeoLib::Point const& pnt, std::size_t id,
14 double mesh_density)
15 : GeoLib::Point(pnt, id), _mesh_density(mesh_density)
16{
17}
18
19void GMSHPoint::write(std::ostream& os) const
20{
21 os << "Point(" << getID() << ") = {" << (*this)[0] << ", " << (*this)[1]
22 << ", " << (*this)[2];
23 if (fabs(_mesh_density) > std::numeric_limits<double>::epsilon())
24 {
25 os << ", " << _mesh_density << "};";
26 }
27 else
28 {
29 os << "};";
30 }
31}
32
33std::ostream& operator<<(std::ostream& os, GMSHPoint const& p)
34{
35 p.write(os);
36 return os;
37}
38
39} // end namespace GMSH
40} // end namespace FileIO
GMSHPoint(GeoLib::Point const &pnt, std::size_t id, double mesh_density)
Definition GMSHPoint.cpp:13
void write(std::ostream &os) const
Definition GMSHPoint.cpp:19
Point()=default
std::size_t getID() const
static std::ostream & operator<<(std::ostream &os, std::vector< GMSHPoint * > const &points)