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
7th place solution

SIIM-FISABIO-RSNA-COVID-19-Detection 7th place solution Validation: We used iterative-stratification with 5 folds (https://github.com/trent-b/iterativ

11 Jul 17, 2022
A curated list of resources dedicated to scene text localization and recognition

Scene Text Localization & Recognition Resources A curated list of resources dedicated to scene text localization and recognition. Any suggestions and

CarlosTao 1.6k Dec 22, 2022
Fast image augmentation library and easy to use wrapper around other libraries. Documentation: https://albumentations.ai/docs/ Paper about library: https://www.mdpi.com/2078-2489/11/2/125

Albumentations Albumentations is a Python library for image augmentation. Image augmentation is used in deep learning and computer vision tasks to inc

11.4k Jan 02, 2023
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
Use Youdao OCR API to covert your clipboard image to text.

Alfred Clipboard OCR 注:本仓库基于 oott123/alfred-clipboard-ocr 的逻辑用 Python 重写,换用了有道 AI 的 API,准确率更高,有效防止百度导致隐私泄露等问题,并且有道 AI 初始提供的 50 元体验金对于其资费而言个人用户基本可以永久使用

Junlin Liu 6 Sep 19, 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
A toolbox of scene text detection and recognition

FudanOCR This toolbox contains the implementations of the following papers: Scene Text Telescope: Text-Focused Scene Image Super-Resolution [Chen et a

FudanVIC Team 170 Dec 26, 2022
An unofficial implementation of the paper "AutoVC: Zero-Shot Voice Style Transfer with Only Autoencoder Loss".

AutoVC: Zero-Shot Voice Style Transfer with Only Autoencoder Loss This is an unofficial implementation of AutoVC based on the official one. The reposi

Chien-yu Huang 27 Jun 16, 2022
This project modify tensorflow object detection api code to predict oriented bounding boxes. It can be used for scene text detection.

This is an oriented object detector based on tensorflow object detection API. Most of the code is not changed except for those related to the need of

Dafang He 30 Oct 22, 2022
Toolbox for OCR post-correction

Ochre Ochre is a toolbox for OCR post-correction. Please note that this software is experimental and very much a work in progress! Overview of OCR pos

National Library of the Netherlands / Research 117 Nov 10, 2022
ISI's Optical Character Recognition (OCR) software for machine-print and handwriting data

VistaOCR ISI's Optical Character Recognition (OCR) software for machine-print and handwriting data Publications "How to Efficiently Increase Resolutio

ISI Center for Vision, Image, Speech, and Text Analytics 21 Dec 08, 2021
A simple OCR API server, seriously easy to be deployed by Docker, on Heroku as well

ocrserver Simple OCR server, as a small working sample for gosseract. Try now here https://ocr-example.herokuapp.com/, and deploy your own now. Deploy

Hiromu OCHIAI 541 Dec 28, 2022
Sign Language Recognition service utilizing a deep learning model with Long Short-Term Memory to perform sign language recognition.

Sign Language Recognition Service This is a Sign Language Recognition service utilizing a deep learning model with Long Short-Term Memory to perform s

Martin Lønne 1 Jan 08, 2022
Hiiii this is the Spanish for Linux and win 10 and in the near future the english version of PortScan my new tool on which you can see what ports are Open only with the IP adress.

PortScanner-by-IIT PortScanner es una herramienta programada en Python3. Como su nombre indica esta herramienta escanea los primeros 150 puertos de re

5 Sep 19, 2022
Deep LearningImage Captcha 2

滑动验证码深度学习识别 本项目使用深度学习 YOLOV3 模型来识别滑动验证码缺口,基于 https://github.com/eriklindernoren/PyTorch-YOLOv3 修改。 只需要几百张缺口标注图片即可训练出精度高的识别模型,识别效果样例: 克隆项目 运行命令: git cl

Python3WebSpider 117 Dec 28, 2022
FastOCR is a desktop application for OCR API.

FastOCR FastOCR is a desktop application for OCR API. Installation Arch Linux fastocr-git @ AUR Build from AUR or install with your favorite AUR helpe

Bruce Zhang 58 Jan 07, 2023
Motion Detection Squid Game with OpenCV Python

*Motion Detection Squid Game with OpenCV Python i am newbie in python. In this project I made a simple game to follow the trend about the red light gr

Nayan 17 Nov 22, 2022
"Very simple but works well" Computer Vision based ID verification solution provided by LibraX.

ID Verification by LibraX.ai This is the first free Identity verification in the market. LibraX.ai is an identity verification platform for developers

LibraX.ai 46 Dec 06, 2022
Random maze generator and solver

Maze Generator and Solver I wrote a maze generator that works with two commonly known algorithms: Depth First Search and Randomized Prims. Both of the

Daniel Pérez 10 Sep 23, 2022
Recognizing cropped text in natural images.

ASTER: Attentional Scene Text Recognizer with Flexible Rectification ASTER is an accurate scene text recognizer with flexible rectification mechanism.

Baoguang Shi 681 Jan 02, 2023