Debian Codegraph @

include/deal.II/gmsh/utilities.h

raw
1 // ------------------------------------------------------------------------
2 //
3 // SPDX-License-Identifier: LGPL-2.1-or-later
4 // Copyright (C) 2018 - 2024 by the deal.II authors
5 //
6 // This file is part of the deal.II library.
7 //
8 // Part of the source code is dual licensed under Apache-2.0 WITH
9 // LLVM-exception OR LGPL-2.1-or-later. Detailed license information
10 // governing the source code and code contributions can be found in
11 // LICENSE.md and CONTRIBUTING.md at the top level directory of deal.II.
12 //
13 // ------------------------------------------------------------------------
14
15
16 #ifndef dealii_gmsh_parameters_h
17 #define dealii_gmsh_parameters_h
18
19 #include <deal.II/base/config.h>
20
21 #ifdef DEAL_II_WITH_GMSH
22
23 # ifdef DEAL_II_WITH_OPENCASCADE
24 # include <TopoDS_CompSolid.hxx>
25 # include <TopoDS_Compound.hxx>
26 # include <TopoDS_Edge.hxx>
27 # include <TopoDS_Face.hxx>
28 # include <TopoDS_Shape.hxx>
29 # include <TopoDS_Vertex.hxx>
30 # endif
31
32 # include <deal.II/grid/tria.h>
33
34 DEAL_II_NAMESPACE_OPEN
35
36 # ifndef DOXYGEN
37 class ParameterHandler;
38 # endif
39
40 /**
41 * A collection of %Gmsh related utilities and classes.
42 */
43 namespace Gmsh
44 {
45 /**
46 * A parameter class used to pass options to the %Gmsh executable.
47 */
48 class AdditionalParameters
49 {
50 public:
51 /**
52 * Set all additional parameters to their default values.
53 */
54 AdditionalParameters(const double characteristic_length = 1.0,
55 const std::string &output_base_name = "");
56
57 /**
58 * Call prm.add_parameter for each member of the AdditionalParameters class.
59 */
60 void
61 add_parameters(ParameterHandler &prm);
62
63 /**
64 * The characteristic length used for the definition of the %Gmsh grid.
65 *
66 * %Gmsh will try to make sure that the size of each edge is as close as
67 * possible to this value.
68 */
69 double characteristic_length = 1.0;
70
71 /**
72 * Base name for the output files. The base name may contain a directory
73 * (followed by a slash), and must contain the base of the names of files
74 * to be created.
75 *
76 * If this variable is left empty, then a temporary directory will be used,
77 * and both the files written into it as well as the temporary directory
78 * will be removed when not needed any more.
79 */
80 std::string output_base_name = {};
81 };
82
83 # ifdef DEAL_II_WITH_OPENCASCADE
84 /**
85 * Given a smooth closed curve, create a triangulation from it using
86 * %Gmsh.
87 *
88 * The input curve @p boundary should be closed.
89 */
90 template <int spacedim>
91 void
92 create_triangulation_from_boundary_curve(
93 const TopoDS_Edge &boundary,
94 Triangulation<2, spacedim> &tria,
95 const AdditionalParameters &prm = AdditionalParameters());
96 # endif
97 } // namespace Gmsh
98
99 DEAL_II_NAMESPACE_CLOSE
100
101 #else
102
103 // Make sure the scripts that create the C++20 module input files have
104 // something to latch on if the preprocessor #ifdef above would
105 // otherwise lead to an empty content of the file.
106 DEAL_II_NAMESPACE_OPEN
107 DEAL_II_NAMESPACE_CLOSE
108
109 #endif
110 #endif