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
This is a implementation of CRAFT OCR method

This is a implementation of CRAFT OCR method

Esaka 0 Nov 01, 2021
Using python libraries to track hands

Python-HandTracking Using python libraries to track hands on a camera Uses cv2 and mediapipe libraries custom hand tracking module PyCharm IDE Final E

Martin Matsudaira 1 Dec 17, 2021
3点クリックで円を指定し、極座標変換を行うサンプルプログラム

click-warpPolar 3点クリックで円を指定し、極座標変換を行うサンプルプログラムです。 Requirements OpenCV 3.4.2 or Later Usage 実行方法は以下です。 起動後、マウスで3点をクリックし円を指定してください。 python click-warpPol

KazuhitoTakahashi 17 Dec 30, 2022
Deep LearningImage Captcha 2

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

Python3WebSpider 117 Dec 28, 2022
list all open dataset about ocr.

ocr-open-dataset list all open dataset about ocr. printed dataset year Born-Digital Images (Web and Email) 2011-2015 COCO-Text 2017 Text Extraction fr

hongbomin 95 Nov 24, 2022
Creating a virtual tv using opencv in python3.

Virtual-TV Creating a virtual tv using opencv in python3. In order to run the code follow the below given steps: Make sure the desired videos which ar

Vamsi 1 Jan 01, 2022
End-to-end pipeline for real-time scene text detection and recognition.

Real-time-Scene-Text-Detection-and-Recognition-System End-to-end pipeline for real-time scene text detection and recognition. The detection model use

Fangneng Zhan 89 Aug 04, 2022
Demo processor to illustrate OCR-D Python API

ocrd_vandalize/ Demo processor to illustrate the OCR-D/core Python API Description :TODO: write docs :) Installation From PyPI pip3 install ocrd_vanda

Konstantin Baierer 5 May 05, 2022
Implementation of EAST scene text detector in Keras

EAST: An Efficient and Accurate Scene Text Detector This is a Keras implementation of EAST based on a Tensorflow implementation made by argman. The or

Jan Zdenek 208 Nov 15, 2022
This repo contains several opencv projects done while learning opencv in python.

opencv-projects-python This repo contains both several opencv projects done while learning opencv by python and opencv learning resources [Basic conce

Fatin Shadab 2 Nov 03, 2022
(CVPR 2021) Back-tracing Representative Points for Voting-based 3D Object Detection in Point Clouds

BRNet Introduction This is a release of the code of our paper Back-tracing Representative Points for Voting-based 3D Object Detection in Point Clouds,

86 Oct 05, 2022
Genalog is an open source, cross-platform python package allowing generation of synthetic document images with custom degradations and text alignment capabilities.

Genalog is an open source, cross-platform python package allowing generation of synthetic document images with custom degradations and text alignment capabilities.

Microsoft 235 Dec 22, 2022
nofacedb/faceprocessor is a face recognition engine for NoFaceDB program complex.

faceprocessor nofacedb/faceprocessor is a face recognition engine for NoFaceDB program complex. Tech faceprocessor uses a number of open source projec

NoFaceDB 3 Sep 06, 2021
[EMNLP 2021] Improving and Simplifying Pattern Exploiting Training

ADAPET This repository contains the official code for the paper: "Improving and Simplifying Pattern Exploiting Training". The model improves and simpl

Rakesh R Menon 138 Dec 26, 2022
Contextual speed detection for python

Speed Prediction using Optical Flow and 2D CNN About the challenge: Comma.AI Speed Challenge This challenge was developed by Comma.AI to predict the s

Mahimana Bhatt 2 Dec 16, 2021
零样本学习测评基准,中文版

ZeroCLUE 零样本学习测评基准,中文版 零样本学习是AI识别方法之一。 简单来说就是识别从未见过的数据类别,即训练的分类器不仅仅能够识别出训练集中已有的数据类别, 还可以对于来自未见过的类别的数据进行区分。 这是一个很有用的功能,使得计算机能够具有知识迁移的能力,并无需任何训练数据, 很符合现

CLUE benchmark 27 Dec 10, 2022
Comparison-of-OCR (KerasOCR, PyTesseract,EasyOCR)

Optical Character Recognition OCR (Optical Character Recognition) is a technology that enables the conversion of document types such as scanned paper

21 Dec 25, 2022
A python programusing Tkinter graphics library to randomize questions and answers contained in text files

RaffleOfQuestions Um programa simples em python, utilizando a biblioteca gráfica Tkinter para randomizar perguntas e respostas contidas em arquivos de

Gabriel Ferreira Rodrigues 1 Dec 16, 2021
A Joint Video and Image Encoder for End-to-End Retrieval

Frozen️ in Time ❄️ ️️️️ ⏳ A Joint Video and Image Encoder for End-to-End Retrieval (arXiv) Repository to contain the code, models, data for end-to-end

225 Dec 25, 2022
Brief idea about our project is mentioned in project presentation file.

Brief idea about our project is mentioned in project presentation file. You just have to run attendance.py file in your suitable IDE but we prefer jupyter lab.

Dhruv ;-) 3 Mar 20, 2022