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
Code for CVPR'2022 paper ✨ "Predict, Prevent, and Evaluate: Disentangled Text-Driven Image Manipulation Empowered by Pre-Trained Vision-Language Model"

PPE ✨ Repository for our CVPR'2022 paper: Predict, Prevent, and Evaluate: Disentangled Text-Driven Image Manipulation Empowered by Pre-Trained Vision-

Zipeng Xu 34 Nov 28, 2022
Qrcode Attendence System with Opencv and Pyzbar

Setup process Creates a virtual environment (Scripts that ensure executed Python code uses the Python interpreter and site packages installed inside t

Ganesh 5 Aug 01, 2022
A Tensorflow model for text recognition (CNN + seq2seq with visual attention) available as a Python package and compatible with Google Cloud ML Engine.

Attention-based OCR Visual attention-based OCR model for image recognition with additional tools for creating TFRecords datasets and exporting the tra

Ed Medvedev 933 Dec 29, 2022
Maze generator and solver with python

Procedural-Maze-Generator-Algorithms Check out my youtube channel : Auctux Ressources Thanks to Jamis Buck Book : Mazes for programmers Requirements P

Joseph 19 Dec 07, 2022
Code for paper "Role-based network embedding via structural features reconstruction with degree-regularized constraint"

Role-based network embedding via structural features reconstruction with degree-regularized constraint Train python main.py --dataset brazil-flights

wang zhang 1 Jun 28, 2022
Msos searcher - A half-hearted attempt at finding a magic square of squares

MSOS searcher A half-hearted attempt at finding (or rather searching) a MSOS (Magic Square of Squares) in the spirit of the Parker Square. Running I r

Niels Mündler 1 Jan 02, 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
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 07, 2023
Code release for our paper, "SimNet: Enabling Robust Unknown Object Manipulation from Pure Synthetic Data via Stereo"

SimNet: Enabling Robust Unknown Object Manipulation from Pure Synthetic Data via Stereo Thomas Kollar, Michael Laskey, Kevin Stone, Brijen Thananjeyan

68 Dec 14, 2022
Python rubik's cube solver

This program makes a 3D representation of a rubiks cube and solves it step by step.

Pablo QB 4 May 29, 2022
CTPN + DenseNet + CTC based end-to-end Chinese OCR implemented using tensorflow and keras

简介 基于Tensorflow和Keras实现端到端的不定长中文字符检测和识别 文本检测:CTPN 文本识别:DenseNet + CTC 环境部署 sh setup.sh 注:CPU环境执行前需注释掉for gpu部分,并解开for cpu部分的注释 Demo 将测试图片放入test_images

Yang Chenguang 2.6k Dec 29, 2022
Optical character recognition for Japanese text, with the main focus being Japanese manga

Manga OCR Optical character recognition for Japanese text, with the main focus being Japanese manga. It uses a custom end-to-end model built with Tran

Maciej Budyś 327 Jan 01, 2023
EQFace: An implementation of EQFace: A Simple Explicit Quality Network for Face Recognition

EQFace: A Simple Explicit Quality Network for Face Recognition The first face recognition network that generates explicit face quality online.

DeepCam Shenzhen 141 Dec 31, 2022
Steve Tu 71 Dec 30, 2022
PSENet - Shape Robust Text Detection with Progressive Scale Expansion Network.

News Python3 implementations of PSENet [1], PAN [2] and PAN++ [3] are released at https://github.com/whai362/pan_pp.pytorch. [1] W. Wang, E. Xie, X. L

1.1k Dec 24, 2022
Convert PDF/Image to TXT using EasyOcr - the best OCR engine available!

PDFImage2TXT - DOWNLOAD INSTALLER HERE What can you do with it? Convert scanned PDFs to TXT. Convert scanned Documents to TXT. No coding required!! In

Hans Alemão 2 Feb 22, 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
ocroseg - This is a deep learning model for page layout analysis / segmentation.

ocroseg This is a deep learning model for page layout analysis / segmentation. There are many different ways in which you can train and run it, but by

NVIDIA Research Projects 71 Dec 06, 2022
天池2021"全球人工智能技术创新大赛"【赛道一】:医学影像报告异常检测 - 第三名解决方案

天池2021"全球人工智能技术创新大赛"【赛道一】:医学影像报告异常检测 比赛链接 个人博客记录 目录结构 ├── final------------------------------------决赛方案PPT ├── preliminary_contest--------------------

19 Aug 17, 2022
Usando o Amazon Textract como OCR para Extração de Dados no DynamoDB

dio-live-textract2 Repositório de código para o live coding do dia 05/10/2021 sobre extração de dados estruturados e gravação em banco de dados a part

hugoportela 0 Jan 19, 2022