PeriDEM 0.3.0
PeriDEM -- Peridynamics-based high-fidelity model for granular media
Loading...
Searching...
No Matches
gmshOccCompat.h
Go to the documentation of this file.
1/*
2 * -------------------------------------------
3 * Copyright (c) 2021 - 2026 Prashant K. Jha
4 * -------------------------------------------
5 * PeriDEM https://github.com/prashjha/PeriDEM
6 *
7 * Distributed under the Boost Software License, Version 1.0. (See accompanying
8 * file LICENSE)
9 */
10
11#pragma once
12
13#include <cmath>
14#include <gmsh.h>
15#include <vector>
16
17namespace mesh_gen {
18
26inline int addDiskOcc(double xc, double yc, double zc, double rx, double ry,
27 double theta = 0.) {
28#if (GMSH_API_VERSION_MAJOR > 4) || \
29 (GMSH_API_VERSION_MAJOR == 4 && GMSH_API_VERSION_MINOR >= 11)
30 const std::vector<double> zAxis = {0., 0., 1.};
31 const std::vector<double> xAxis = {std::cos(theta), std::sin(theta), 0.};
32 return gmsh::model::occ::addDisk(xc, yc, zc, rx, ry, -1, zAxis, xAxis);
33#else
34 const int tag = gmsh::model::occ::addDisk(xc, yc, zc, rx, ry, -1);
35 if (std::abs(theta) > 1.0e-15)
36 gmsh::model::occ::rotate({{2, tag}}, xc, yc, zc, 0., 0., 1., theta);
37 return tag;
38#endif
39}
40
41} // namespace mesh_gen
int addDiskOcc(double xc, double yc, double zc, double rx, double ry, double theta=0.)
OCC disk compatible with older Gmsh (no zAxis/xAxis) and newer APIs.