PolyDiM
C++ library for POLYtopal DIscretization Methods
Loading...
Searching...
No Matches
TetgenInterface.hpp
Go to the documentation of this file.
1// _LICENSE_HEADER_
2//
3// Copyright (C) 2019 - 2025.
4// Terms register on the GPL-3.0 license.
5//
6// This file can be redistributed and/or modified under the license terms.
7//
8// See top level LICENSE file for more details.
9//
10// This file can be used citing references in CITATION.cff file.
11
12#ifndef __TetgenInterface_H
13#define __TetgenInterface_H
14
15#include "Gedim_Macro.hpp"
16#include "IMeshDAO.hpp"
17
18#if ENABLE_TETGEN == 1
19#include "tetgen.h"
20#endif
21
22#include "Eigen/Eigen"
23
24namespace Gedim
25{
29{
30 public:
31 struct Region
32 {
33 int id; // unique id of the region
34 Eigen::Vector3d centroid; // internal point of the region
35 double max_volume; // default -1.0
36 };
37
38 private:
39#if ENABLE_TETGEN == 1
40 void CreateTetgenInput(const Eigen::MatrixXd &polyhedronVertices,
41 const Eigen::MatrixXi &polyhedronEdges,
42 const std::vector<Eigen::MatrixXi> &polyhedronFaces,
44 const Eigen::MatrixXd &constrainedPoints = Eigen::MatrixXd(),
45 const std::vector<Eigen::VectorXi> &constrainedFaces = std::vector<Eigen::VectorXi>()) const;
46 void CreateTetgenInput(const Eigen::MatrixXd &points,
47 const std::vector<std::vector<unsigned int>> &facets,
48 const std::vector<TetgenInterface::Region> &regions,
49 tetgenio &tetgenInput) const;
50 void CreateDelaunayInput(const Eigen::MatrixXd &points, const std::vector<unsigned int> &points_marker, tetgenio &tetgenInput) const;
51 void CreateTetgenOutput(const double &maxTetrahedronArea,
54 const std::string &tetgenOptions = "Qpqfezna") const;
57
59 void ExportTetgenOutput(const std::string &nameFolder, const std::string &nameFile, tetgenio &tetgenOutput) const;
60#endif
61
62 public:
65
66 void CreateDelaunay(const Eigen::MatrixXd &points, const std::vector<unsigned int> &points_marker, Gedim::IMeshDAO &mesh) const;
67
68 void CreateMesh(const Eigen::MatrixXd &polyhedronVertices,
69 const Eigen::MatrixXi &polyhedronEdges,
70 const std::vector<Eigen::MatrixXi> &polyhedronFaces,
71 const double &maxTetrahedronVolume,
73 const std::string &tetgenOptions = "Qpqfezna") const;
74
75 void CreateMesh(const Eigen::MatrixXd &points,
76 const std::vector<std::vector<unsigned int>> &facets,
77 const double &maxTetrahedronVolume,
79 const std::string &tetgenOptions = "Qpqfezna") const;
80
81 void CreateMesh(const Eigen::MatrixXd &points,
82 const std::vector<std::vector<unsigned int>> &facets,
83 const std::vector<Region> &regions,
85 const std::string &tetgenOptions = "QpqfeznaA") const;
86};
87
88} // namespace Gedim
89
90#endif // __TetgenInterface_H
Eigen column vector.
Definition Eigen_Array.hpp:23
The IMeshDAO (mesh data access object) class to read and write mesh data.
Definition IMeshDAO.hpp:24
The Tetgen Interface.
Definition TetgenInterface.hpp:29
void CreateDelaunay(const Eigen::MatrixXd &points, const std::vector< unsigned int > &points_marker, Gedim::IMeshDAO &mesh) const
Definition TetgenInterface.cpp:29
TetgenInterface()
Definition TetgenInterface.cpp:22
~TetgenInterface()
Definition TetgenInterface.cpp:25
void CreateMesh(const Eigen::MatrixXd &points, const std::vector< std::vector< unsigned int > > &facets, const std::vector< Region > &regions, Gedim::IMeshDAO &mesh, const std::string &tetgenOptions="QpqfeznaA") const
void CreateMesh(const Eigen::MatrixXd &polyhedronVertices, const Eigen::MatrixXi &polyhedronEdges, const std::vector< Eigen::MatrixXi > &polyhedronFaces, const double &maxTetrahedronVolume, Gedim::IMeshDAO &mesh, const std::string &tetgenOptions="Qpqfezna") const
Definition TetgenInterface.cpp:50
Definition Eigen_Array.cpp:22
Definition TetgenInterface.hpp:32
double max_volume
Definition TetgenInterface.hpp:35
Eigen::Vector3d centroid
Definition TetgenInterface.hpp:34
int id
Definition TetgenInterface.hpp:33