Python bindings for JIGSAW: a Delaunay-based unstructured mesh generator.

Overview

JIGSAW: An unstructured mesh generator

JIGSAW is an unstructured mesh generator and tessellation library; designed to generate high-quality triangulations and polyhedral decompositions of general planar, surface and volumetric domains. JIGSAW includes refinement-based algorithms for the construction of new meshes, optimisation-driven techniques for the improvement of existing grids, as well as routines to assemble (restricted) Delaunay tessellations, Voronoi complexes and Power diagrams.

This package provides a Python based scripting interface to the underlying JIGSAW mesh generator, including a range of additional facilities for file I/O, mesh visualisation and post-processing operations.

JIGSAW has been compiled and tested on various 64-bit Linux , Windows and Mac based platforms.

Quickstart

Ensure you have a c++ compiler and the cmake utility installed.
Clone/download + unpack this repository.
python3 setup.py build_external
python3 setup.py install
python3 example.py --IDnumber=0

Note: installation of JIGSAW requires a c++ compiler and the cmake utility. JIGSAW may also be installed as a conda package. See here for details.

Function Listing

See jigsawpy for a description of the various functions available.

setup.py    - compile and install JIGSAW's c++ backend using cmake.
example.py  - a list of demo programs. 

jigsaw.py   - cmd-line interface to JIGSAW's backend
libsaw.py   - api-lib. interface to JIGSAW's backend

loadmsh.py  - load *.msh files.
savemsh.py  - save *.msh files.
loadjig.py  - load *.jig files.
savejig.py  - save *.jig files.

project.py  - apply cartographic projection operators to mesh obj.

bisect.py   - refine a mesh obj. via bisection.
extrude.py  - create a mesh obj. via extrusion.

Example Problems

The following set of example problems are available in example.py:

example: 0; # simple 2-dim. examples to get started
example: 1; # simple 3-dim. examples to get started
example: 2; # frontal-delaunay methods in the plane
example: 3; # frontal-delaunay methods for surfaces
example: 4; # frontal-delaunay methods for volumes
example: 5; # user-defined mesh-spacing constraints
example: 6; # dealing with sharp-features in piecewise smooth domains
example: 7; # dealing with sharp-features in piecewise smooth domains
example: 8; # (re)mesh marching-cubes style outputs
example: 9; # creating prismatic volumes via extrusion

Run python3 example.py --IDnumber=N to call the N-th example. *.vtk output is saved to ../cache and can be visualised with, for example, Paraview.

License

This program may be freely redistributed under the condition that the copyright notices (including this entire header) are not removed, and no compensation is received through use of the software. Private, research, and institutional use is free. You may distribute modified versions of this code UNDER THE CONDITION THAT THIS CODE AND ANY MODIFICATIONS MADE TO IT IN THE SAME FILE REMAIN UNDER COPYRIGHT OF THE ORIGINAL AUTHOR, BOTH SOURCE AND OBJECT CODE ARE MADE FREELY AVAILABLE WITHOUT CHARGE, AND CLEAR NOTICE IS GIVEN OF THE MODIFICATIONS. Distribution of this code as part of a commercial system is permissible ONLY BY DIRECT ARRANGEMENT WITH THE AUTHOR. (If you are not directly supplying this code to a customer, and you are instead telling them how they can obtain it for free, then you are not required to make any arrangement with me.)

DISCLAIMER: Neither I nor: Columbia University, the Massachusetts Institute of Technology, the University of Sydney, nor the National Aeronautics and Space Administration warrant this code in any way whatsoever. This code is provided "as-is" to be used at your own risk.

References

There are a number of publications that describe the algorithms used in JIGSAW in detail. If you make use of JIGSAW in your work, please consider including a reference to the following:

[1] - Darren Engwirda: Generalised primal-dual grids for unstructured co-volume schemes, J. Comp. Phys., 375, pp. 155-176, https://doi.org/10.1016/j.jcp.2018.07.025, 2018.

[2] - Darren Engwirda, Conforming Restricted Delaunay Mesh Generation for Piecewise Smooth Complexes, Procedia Engineering, 163, pp. 84-96, https://doi.org/10.1016/j.proeng.2016.11.024, 2016.

[3] - Darren Engwirda, Voronoi-based Point-placement for Three-dimensional Delaunay-refinement, Procedia Engineering, 124, pp. 330-342, http://dx.doi.org/10.1016/j.proeng.2015.10.143, 2015.

[4] - Darren Engwirda, David Ivers, Off-centre Steiner points for Delaunay-refinement on curved surfaces, Computer-Aided Design, 72, pp. 157-171, http://dx.doi.org/10.1016/j.cad.2015.10.007, 2016.

[5] - Darren Engwirda, Locally-optimal Delaunay-refinement and optimisation-based mesh generation, Ph.D. Thesis, School of Mathematics and Statistics, The University of Sydney, http://hdl.handle.net/2123/13148, 2014.

Comments
  • pathlib requirement

    pathlib requirement

    pathlib is listed as a requirement for all python versions, but it is part of the system in python >=3.4 (i.e. all currently supported version of python). Because of this dependency, pip check fails when jigsawpy is installed for python 3.x. I would request that it either be removed as a dependency in the next release or that it be constrained to python versions before 3.4.

    https://docs.python.org/3/library/pathlib.html

    enhancement 
    opened by xylar 9
  • The python package includes the `tests` directory

    The python package includes the `tests` directory

    Because of the line: https://github.com/dengwirda/jigsaw-python/blob/b6e455c22696568f90a7428a49e03c980892c923/setup.py#L135 the tests directory is being included in the conda-forge (and presumably the pypi) package. This directory should be excluded, or better yet only jigsawpy should be included:

    packages=find_packages(include=['jigsawypy', 'jigsawpy.*'])
    
    for-next-release 
    opened by xylar 5
  • Add call to find_library

    Add call to find_library

    This helps Windows find jigsaw.dll without a full path name.

    A similar call seems not to be needed for Linux and not to work for OSX.

    I created a patch identical to this in the conda-forge recipe: https://github.com/conda-forge/staged-recipes/pull/10842/commits/b8d1bc4d9cffadf1c8ca62069d5f6e676cc271e4

    opened by xylar 1
  • Update to jigsaw-0.9.15.x

    Update to jigsaw-0.9.15.x

    • Update to jigsaw-0.9.15.x.
    • Fix an i/o bug in handling of jig_t objects.
    • Fix an array-size bug in orthoball routines.
    • Add support for "jumbled" meshes.
    • Remove pathlib from REQUIRED in setup.py.
    • Support ellipsoidal-type initial conditions.
    • BREAKING: encode h(x) values as 32-bit floating point data to support "very-large" h(x) types.
    opened by dengwirda 0
  • Accelerating rDT mesh and optm iter.

    Accelerating rDT mesh and optm iter.

    Hello, I was wondering if there is any way to speed up the rDT mesh and Mesh optm parts of the jigsaw-python subtree source. Currently, I am compiling with gcc-11, using the standard CMake approach (maybe there's an optimization switch I haven't enabled?). I tried compiling it with intel 2018 and 2019 but I wasn't successful with the compilation. Any ideas on achieving some speed-ups will be greatly appreciated. Thanks, -J.

    opened by jreniel 0
  • Consider using specific exceptions rather than generic `Exception`

    Consider using specific exceptions rather than generic `Exception`

    I don't find the exceptions raised by jigsawpy to be very intuitive, and I think that might be true for most python users.

    As an example: https://github.com/dengwirda/jigsaw-python/blob/f87571945975b4882d8c27bdfff9275f6e46baa8/jigsawpy/savemsh.py#L613

    I would expect something like:

        if (not isinstance(name, str)):
            raise TypeError("Argument 'name' to savemsh should be of type str")
    

    As I understand it, the generic Exception class is only intended as a base class for exceptions and shouldn't be used directly.

    Python is case sensitive so the use of NAME here also led to some confusion for me.

    for-next-release 
    opened by xylar 6
  • Still getting output to the terminal with `opts.verbosity = -1`

    Still getting output to the terminal with `opts.verbosity = -1`

    I was told that opts.verbosity = -1 should mean that no output went to the terminal window, just to the log file. But I am finding that I still get terminal output when I have this option set. I verified that the .jig file does, indeed have:

      VERBOSITY=-1
    

    but I still see something like this to the terminal:

    #------------------------------------------------------------
    #
    #   ,o, ,o,       /                                 
    #    `   `  e88~88e  d88~\   /~~~8e Y88b    e    / 
    #   888 888 88   88 C888         88b Y88b  d8b  /   
    #   888 888 "8b_d8"  Y88b   e88~-888  Y888/Y88b/  
    #   888 888  /        888D C88   888   Y8/  Y8/     
    #   88P 888 Cb      \_88P   "8b_-888    Y    Y    
    # \_8"       Y8""8D                             
    #
    #------------------------------------------------------------
    # JIGSAW: an unstructured mesh generation library.  
    #------------------------------------------------------------
    ...
    
    bug for-next-release 
    opened by xylar 2
  • Cannot create an icosahedral mesh without providing a mesh argument

    Cannot create an icosahedral mesh without providing a mesh argument

    It seems the intention is that one can create an icosahedral mesh without passing a mesh object: https://github.com/dengwirda/jigsaw-python/blob/b6e455c22696568f90a7428a49e03c980892c923/jigsawpy/init.py#L105 but when I try this:

            jigsawpy.cmd.icosahedron(opts, subdivisions)
    

    I get:

    Traceback (most recent call last):
      File "/home/xylar/miniconda3/envs/compass_jigsaw_mesh/bin/compass", line 33, in <module>
        sys.exit(load_entry_point('compass', 'console_scripts', 'compass')())
      File "/home/xylar/code/compass/separate_mesh_steps/compass/__main__.py", line 63, in main
        commands[args.command]()
      File "/home/xylar/code/compass/separate_mesh_steps/compass/run/serial.py", line 281, in main
        run_step()
      File "/home/xylar/code/compass/separate_mesh_steps/compass/run/serial.py", line 249, in run_step
        test_case.run()
      File "/home/xylar/code/compass/separate_mesh_steps/compass/ocean/tests/global_ocean/mesh/__init__.py", line 109, in run
        super().run()
      File "/home/xylar/code/compass/separate_mesh_steps/compass/testcase.py", line 190, in run
        self._run_step(step, self.new_step_log_file)
      File "/home/xylar/code/compass/separate_mesh_steps/compass/testcase.py", line 306, in _run_step
        step.run()
      File "/home/xylar/code/compass/separate_mesh_steps/compass/mesh/spherical.py", line 350, in run
        self.make_jigsaw_mesh(subdivisions)
      File "/home/xylar/code/compass/separate_mesh_steps/compass/mesh/spherical.py", line 376, in make_jigsaw_mesh
        jigsawpy.cmd.icosahedron(opts, subdivisions)
      File "/home/xylar/miniconda3/envs/compass_jigsaw_mesh/lib/python3.9/site-packages/jigsawpy/__init__.py", line 106, in icosahedron
        return jigsaw.icosahedron(
      File "/home/xylar/miniconda3/envs/compass_jigsaw_mesh/lib/python3.9/site-packages/jigsawpy/jigsaw.py", line 597, in icosahedron
        raise Exception("Incorrect type: MESH.")
    Exception: Incorrect type: MESH.
    

    It seems that this check: https://github.com/dengwirda/jigsaw-python/blob/b6e455c22696568f90a7428a49e03c980892c923/jigsawpy/jigsaw.py#L519-L520 should check for None:

        if (mesh is not None and not isinstance(mesh, jigsaw_msh_t)):
            raise Exception("Incorrect type: MESH.")
    
    bug for-next-release 
    opened by xylar 2
  • pip, setup, build_external, etc

    pip, setup, build_external, etc

    Are the method(s) used to install binaries sufficient? Currently, two options are supported:

    1. setup.py build_external, etc builds and installs the jigsaw-cpp binaries within jigsawpy itself.
    2. If no local binaries are found, a global search of the machine path is done to pick them up in, e.g. usr/local/bin, etc --- used by the conda-based workflow.

    @jreniel has suggested installing to the python environment directory, either as a 3rd option, or, perhaps(?) a replacement for 1.

    Should also work out what's needed to make jigsawpy available for direct install via pip.

    enhancement 
    opened by dengwirda 6
Releases(v0.3.3)
Owner
Darren Engwirda
Computational scientist at LANL --- climate modelling, unstructured grids, numerical methods.
Darren Engwirda
MeshToGeotiff - A fast Python algorithm to convert a 3D mesh into a GeoTIFF

MeshToGeotiff - A fast Python algorithm to convert a 3D mesh into a GeoTIFF Python class for converting (very fast) 3D Meshes/Surfaces to Raster DEMs

null 8 Sep 10, 2022
Run tesseract with the tesserocr bindings with @OCR-D's interfaces

ocrd_tesserocr Crop, deskew, segment into regions / tables / lines / words, or recognize with tesserocr Introduction This package offers OCR-D complia

OCR-D 38 Oct 14, 2022
This is the open source implementation of the ICLR2022 paper "StyleNeRF: A Style-based 3D-Aware Generator for High-resolution Image Synthesis"

StyleNeRF: A Style-based 3D-Aware Generator for High-resolution Image Synthesis StyleNeRF: A Style-based 3D-Aware Generator for High-resolution Image

Meta Research 840 Dec 26, 2022
A synthetic data generator for text recognition

TextRecognitionDataGenerator A synthetic data generator for text recognition What is it for? Generating text image samples to train an OCR software. N

Edouard Belval 2.5k Jan 4, 2023
Discord QR Scam Code Generator + Token grab mobile device.

A Python script that automatically generates a Nitro scam QR code and grabs the Discord token when scanned.

Visual 9 Nov 22, 2022
Image Recognition Model Generator

Takes a user-inputted query and generates a machine learning image recognition model that determines if an inputted image is or isn't their query

Christopher Oka 1 Jan 13, 2022
Line based ATR Engine based on OCRopy

OCR Engine based on OCRopy and Kraken using python3. It is designed to both be easy to use from the command line but also be modular to be integrated

null 948 Dec 23, 2022
Python-based tools for document analysis and OCR

ocropy OCRopus is a collection of document analysis programs, not a turn-key OCR system. In order to apply it to your documents, you may need to do so

OCRopus 3.2k Dec 31, 2022
Developed an AI-based system to control the mouse cursor using Python and OpenCV with the real-time camera.

Developed an AI-based system to control the mouse cursor using Python and OpenCV with the real-time camera. Fingertip location is mapped to RGB images to control the mouse cursor.

Ravi Sharma 71 Dec 20, 2022
pulse2percept: A Python-based simulation framework for bionic vision

pulse2percept: A Python-based simulation framework for bionic vision Retinal degenerative diseases such as retinitis pigmentosa and macular degenerati

null 67 Dec 29, 2022
Python-based tools for document analysis and OCR

ocropy OCRopus is a collection of document analysis programs, not a turn-key OCR system. In order to apply it to your documents, you may need to do so

OCRopus 3.2k Dec 31, 2022
A webcam-based 3x3x3 rubik's cube solver written in Python 3 and OpenCV.

Qbr Qbr, pronounced as Cuber, is a webcam-based 3x3x3 rubik's cube solver written in Python 3 and OpenCV. ?? Accurate color detection ?? Accurate 3x3x

Kim 金可明 502 Dec 29, 2022
A python script based on opencv and paddleocr, which can automatically pick up tasks, make cookies, and receive rewards in the Destiny 2 Dawning Oven

A python script based on opencv and paddleocr, which can automatically pick up tasks, make cookies, and receive rewards in the Destiny 2 Dawning Oven

null 1 Dec 22, 2021
A python scripts that uses 3 different feature extraction methods such as SIFT, SURF and ORB to find a book in a video clip and project trailer of a movie based on that book, on to it.

A python scripts that uses 3 different feature extraction methods such as SIFT, SURF and ORB to find a book in a video clip and project trailer of a movie based on that book, on to it.

tooraj taraz 3 Feb 10, 2022
Deep learning based page layout analysis

Deep Learning Based Page Layout Analyze This is a Python implementaion of page layout analyze tool. The goal of page layout analyze is to segment page

null 186 Dec 29, 2022
Handwriting Recognition System based on a deep Convolutional Recurrent Neural Network architecture

Handwriting Recognition System This repository is the Tensorflow implementation of the Handwriting Recognition System described in Handwriting Recogni

Edgard Chammas 346 Jan 7, 2023
Corner-based Region Proposal Network

Corner-based Region Proposal Network CRPN is a two-stage detection framework for multi-oriented scene text. It employs corners to estimate the possibl

xhzdeng 140 Nov 4, 2022
Scene text detection and recognition based on Extremal Region(ER)

Scene text recognition A real-time scene text recognition algorithm. Our system is able to recognize text in unconstrain background. This algorithm is

HSIEH, YI CHIA 155 Dec 6, 2022
Rotational region detection based on Faster-RCNN.

R2CNN_Faster_RCNN_Tensorflow Abstract This is a tensorflow re-implementation of R2CNN: Rotational Region CNN for Orientation Robust Scene Text Detecti

UCAS-Det 581 Nov 22, 2022