1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
//! Interface to the low-level `gmsh_sys` crate.

use std::ffi::CString;

use crate::err::{GmshError, GmshResult};

#[doc(hidden)]
// make a new CString from a string slice
pub fn get_cstring(istr: &str) -> GmshResult<CString> {
    let c_str = CString::new(String::from(istr));
    match c_str {
        Ok(c_str) => Ok(c_str),
        Err(_) => Err(GmshError::CInterface),
    }
}

/// The set of `OpenCASCADE` kernel functions.
pub mod occ {

    // unique functions
    pub use gmsh_sys::gmshModelOccAddBox as add_box;
    pub use gmsh_sys::gmshModelOccAddSphere as add_sphere;
    pub use gmsh_sys::gmshModelOccAddTorus as add_torus;

    // shared functions
    pub use gmsh_sys::gmshModelOccAddCurveLoop as add_curve_loop;
    pub use gmsh_sys::gmshModelOccAddLine as add_line;
    pub use gmsh_sys::gmshModelOccAddPlaneSurface as add_plane_surface;
    pub use gmsh_sys::gmshModelOccAddPoint as add_point;
    pub use gmsh_sys::gmshModelOccRemove as remove_point;
    pub use gmsh_sys::gmshModelOccSynchronize as synchronize;
}

/// The set of built-in kernel functions.
pub mod geo {

    // unique functions

    // shared functions
    pub use gmsh_sys::gmshModelGeoAddCurveLoop as add_curve_loop;
    pub use gmsh_sys::gmshModelGeoAddLine as add_line;
    pub use gmsh_sys::gmshModelGeoAddPlaneSurface as add_plane_surface;
    pub use gmsh_sys::gmshModelGeoAddPoint as add_point;
    pub use gmsh_sys::gmshModelGeoRemove as remove_point;
    pub use gmsh_sys::gmshModelGeoSynchronize as synchronize;
}