PolyDiM
C++ library for POLYtopal DIscretization Methods
Loading...
Searching...
No Matches
MEDIT_Utilities.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 __MEDIT_Utilities_H
13#define __MEDIT_Utilities_H
14
15#include "Eigen/Eigen"
16#include <list>
17#include <string>
18
19namespace Gedim
20{
22{
23 public:
24 enum struct Types
25 {
26 Unknown = -1,
27 Vertex = 0,
28 Edge = 1,
29 Triangle = 2,
30 Quadrilateral = 3,
31 Tetrahedron = 4,
32 Hexahedron = 5
33 };
34
35 const Types Type;
36 const std::vector<unsigned int> Points_id;
37 const unsigned int Reference_id;
38
39 MEDIT_Cell(const Types type, const std::vector<unsigned int> &points_id, const unsigned int reference_id)
41 {
42 }
43
44 static std::string CellLabel(const MEDIT_Cell::Types type);
45};
46
52{
53 public:
55 {
56 Ascii = 0
57 };
58
59 private:
60 std::vector<MEDIT_Cell> CreateVertexCells(const Eigen::MatrixXd &points, const std::vector<unsigned int> &reference_ids) const;
61 std::vector<MEDIT_Cell> CreateEdgeCells(const Eigen::MatrixXi &edges, const std::vector<unsigned int> &reference_ids) const;
62
63 std::vector<MEDIT_Cell> CreatePolygonCells(const std::vector<std::vector<unsigned int>> &polygons_vertices,
64 const std::vector<unsigned int> &reference_ids,
65 const unsigned int &order) const;
66
67 std::vector<MEDIT_Cell> CreatePolyhedraCells(const std::vector<std::vector<unsigned int>> &polyhedra_vertices,
68 const std::vector<unsigned int> &reference_ids,
69 const unsigned int &order) const;
70
71 void ExportMEDIT_Ascii(const Eigen::MatrixXd &points,
72 const std::vector<unsigned int> &points_reference_ids,
73 const std::vector<MEDIT_Cell> &faces,
74 const std::vector<MEDIT_Cell> &cells,
75 const std::string &filePath) const;
76
77 public:
79 {
80 }
82 {
83 }
84
85 void ExportPoints(const std::string &filePath, const Eigen::MatrixXd &points, const std::vector<unsigned int> &points_reference_ids) const;
86
87 void ExportSegments(const std::string &filePath,
88 const Eigen::MatrixXd &points,
89 const Eigen::MatrixXi &cells,
90 const std::vector<unsigned int> &points_reference_ids,
91 const std::vector<unsigned int> &cells_reference_ids) const;
92
93 void ExportPolygons(const std::string &filePath,
94 const Eigen::MatrixXd &points,
95 const std::vector<std::vector<unsigned int>> &cells_vertices,
96 const std::vector<unsigned int> &points_reference_ids,
97 const std::vector<unsigned int> &cells_reference_ids,
98 const unsigned int &order = 1) const;
99
100 void ExportPolyhedra(const std::string &filePath,
101 const Eigen::MatrixXd &points,
102 const std::vector<std::vector<unsigned int>> &faces_vertices,
103 const std::vector<std::vector<unsigned int>> &cells_vertices,
104 const std::vector<unsigned int> &points_reference_ids,
105 const std::vector<unsigned int> &faces_reference_ids,
106 const std::vector<unsigned int> &cells_reference_ids,
107 const unsigned int &order = 1) const;
108};
109} // namespace Gedim
110
111#endif // __MEDIT_Utilities_H
Eigen column vector.
Definition Eigen_Array.hpp:23
Definition MEDIT_Utilities.hpp:22
static std::string CellLabel(const MEDIT_Cell::Types type)
Definition MEDIT_Utilities.cpp:251
const unsigned int Reference_id
Definition MEDIT_Utilities.hpp:37
const Types Type
Definition MEDIT_Utilities.hpp:35
Types
Definition MEDIT_Utilities.hpp:25
const std::vector< unsigned int > Points_id
Definition MEDIT_Utilities.hpp:36
MEDIT_Cell(const Types type, const std::vector< unsigned int > &points_id, const unsigned int reference_id)
Definition MEDIT_Utilities.hpp:39
The MEDIT_Utilities class for interface with MEDIT.
Definition MEDIT_Utilities.hpp:52
virtual ~MEDIT_Utilities()
Definition MEDIT_Utilities.hpp:81
ExportFormats
Definition MEDIT_Utilities.hpp:55
@ Ascii
Definition MEDIT_Utilities.hpp:56
void ExportPolyhedra(const std::string &filePath, const Eigen::MatrixXd &points, const std::vector< std::vector< unsigned int > > &faces_vertices, const std::vector< std::vector< unsigned int > > &cells_vertices, const std::vector< unsigned int > &points_reference_ids, const std::vector< unsigned int > &faces_reference_ids, const std::vector< unsigned int > &cells_reference_ids, const unsigned int &order=1) const
Definition MEDIT_Utilities.cpp:73
void ExportPolygons(const std::string &filePath, const Eigen::MatrixXd &points, const std::vector< std::vector< unsigned int > > &cells_vertices, const std::vector< unsigned int > &points_reference_ids, const std::vector< unsigned int > &cells_reference_ids, const unsigned int &order=1) const
Definition MEDIT_Utilities.cpp:54
void ExportPoints(const std::string &filePath, const Eigen::MatrixXd &points, const std::vector< unsigned int > &points_reference_ids) const
Definition MEDIT_Utilities.cpp:20
MEDIT_Utilities()
Definition MEDIT_Utilities.hpp:78
void ExportSegments(const std::string &filePath, const Eigen::MatrixXd &points, const Eigen::MatrixXi &cells, const std::vector< unsigned int > &points_reference_ids, const std::vector< unsigned int > &cells_reference_ids) const
Definition MEDIT_Utilities.cpp:36
Definition Eigen_Array.cpp:22