├── .github └── workflows │ └── setup.yml ├── .gitignore ├── LICENSE.md ├── MANIFEST.in ├── README.md ├── cache └── .keep ├── example.py ├── external └── jigsaw │ ├── .gitattributes │ ├── .github │ └── workflows │ │ └── cmake.yml │ ├── .gitignore │ ├── CMakeLists.txt │ ├── LICENSE.md │ ├── README.md │ ├── bin │ └── .keep │ ├── example.jig │ ├── geo │ ├── airfoil.jig │ ├── airfoil.msh │ ├── bunny.jig │ ├── bunny.msh │ ├── earth.jig │ ├── earth.msh │ ├── lakes.jig │ ├── lakes.msh │ ├── parts.jig │ └── parts.msh │ ├── img │ ├── bunny-TRIA3-1.png │ ├── bunny-TRIA3-2.png │ ├── bunny-TRIA3-3.png │ └── bunny-TRIA4-3.png │ ├── inc │ ├── jigsaw_const.h │ ├── jigsaw_jig_t.h │ ├── jigsaw_msh_t.h │ └── lib_jigsaw.h │ ├── lib │ └── .keep │ ├── out │ └── .keep │ ├── src │ ├── CMakeLists.txt │ ├── geo_load.hpp │ ├── hfn_init.hpp │ ├── hfn_load.hpp │ ├── hfn_save.inc │ ├── ini_load.hpp │ ├── jig_load.hpp │ ├── jig_read.hpp │ ├── jigsaw.cpp │ ├── jigsaw.hpp │ ├── libcpp │ │ ├── aabb_tree │ │ │ ├── aabb_mesh_k.hpp │ │ │ ├── aabb_pred_k.hpp │ │ │ ├── aabb_tree_k.hpp │ │ │ └── aabb_type_k.hpp │ │ ├── aabbtree.hpp │ │ ├── algorithms.hpp │ │ ├── algorithms │ │ │ ├── find.hpp │ │ │ └── sort.hpp │ │ ├── allocators.hpp │ │ ├── allocators │ │ │ ├── alloc_base.hpp │ │ │ ├── alloc_item.hpp │ │ │ ├── alloc_pool.hpp │ │ │ └── alloc_wrap.hpp │ │ ├── basebase.hpp │ │ ├── containers.hpp │ │ ├── containers │ │ │ ├── array.hpp │ │ │ ├── array_iter.hpp │ │ │ ├── arraylist.hpp │ │ │ ├── basic_stack.hpp │ │ │ ├── block_array.hpp │ │ │ ├── block_iter.hpp │ │ │ ├── double_list.hpp │ │ │ ├── doubleiter.hpp │ │ │ ├── fixed_array.hpp │ │ │ ├── hashtable.hpp │ │ │ ├── hashtwice.hpp │ │ │ ├── iter_base.hpp │ │ │ ├── priorityidx.hpp │ │ │ ├── prioritymap.hpp │ │ │ ├── priorityset.hpp │ │ │ ├── single_list.hpp │ │ │ └── singleiter.hpp │ │ ├── expansion │ │ │ ├── dd_float.hpp │ │ │ ├── ia_float.hpp │ │ │ ├── mp_basic.hpp │ │ │ ├── mp_float.hpp │ │ │ └── mp_utils.hpp │ │ ├── geom_base │ │ │ ├── cell_ball_k.hpp │ │ │ ├── cell_base_k.hpp │ │ │ ├── intersect_k.hpp │ │ │ └── vect_base_k.hpp │ │ ├── geom_reps │ │ │ ├── geom_base_2.hpp │ │ │ ├── geom_base_3.hpp │ │ │ ├── geom_mesh_ellipsoid_3.hpp │ │ │ ├── geom_mesh_euclidean_2.hpp │ │ │ └── geom_mesh_euclidean_3.hpp │ │ ├── geometry.hpp │ │ ├── geompred.hpp │ │ ├── geomreps.hpp │ │ ├── hashfunc.hpp │ │ ├── interpolate.hpp │ │ ├── interpolate │ │ │ ├── hfun_base_k.hpp │ │ │ ├── hfun_clip_k.hpp │ │ │ ├── hfun_constant_value_k.hpp │ │ │ ├── hfun_grid_ellipsoid_3.hpp │ │ │ ├── hfun_grid_euclidean_2.hpp │ │ │ ├── hfun_grid_euclidean_3.hpp │ │ │ ├── hfun_mesh_ellipsoid_3.hpp │ │ │ ├── hfun_mesh_euclidean_2.hpp │ │ │ └── hfun_mesh_euclidean_3.hpp │ │ ├── iter_mesh │ │ │ ├── _bfs_mesh_2.inc │ │ │ ├── _zip_mesh_2.inc │ │ │ ├── cost_mesh_2.inc │ │ │ ├── flip_mesh_2.inc │ │ │ ├── iter_divs_2.inc │ │ │ ├── iter_divs_3.inc │ │ │ ├── iter_dual_2.inc │ │ │ ├── iter_dual_3.inc │ │ │ ├── iter_flip_2.inc │ │ │ ├── iter_flip_3.inc │ │ │ ├── iter_mesh_2.hpp │ │ │ ├── iter_mesh_3.hpp │ │ │ ├── iter_mesh_euclidean_2.hpp │ │ │ ├── iter_mesh_euclidean_3.hpp │ │ │ ├── iter_node_1.inc │ │ │ ├── iter_node_2.inc │ │ │ ├── iter_node_3.inc │ │ │ ├── iter_pred_ellipsoid_3.hpp │ │ │ ├── iter_pred_euclidean_2.hpp │ │ │ ├── iter_timers.hpp │ │ │ ├── iter_zips_2.inc │ │ │ ├── iter_zips_3.inc │ │ │ ├── move_mesh_2.inc │ │ │ ├── part_mesh_2.inc │ │ │ └── sort_mesh_2.inc │ │ ├── itermesh.hpp │ │ ├── mathutil.hpp │ │ ├── mesh_reps │ │ │ ├── base_complex_k.hpp │ │ │ ├── hash_complex_k.hpp │ │ │ ├── mesh_complex_1.hpp │ │ │ ├── mesh_complex_2.hpp │ │ │ ├── mesh_complex_3.hpp │ │ │ ├── mesh_complex_type_k.hpp │ │ │ ├── tria_complex_1.hpp │ │ │ ├── tria_complex_2.hpp │ │ │ └── tria_complex_3.hpp │ │ ├── meshreps.hpp │ │ ├── mpfloats.hpp │ │ ├── parameters │ │ │ ├── iter_params.hpp │ │ │ └── mesh_params.hpp │ │ ├── predicate │ │ │ ├── bisect_k.hpp │ │ │ ├── inball_k.hpp │ │ │ ├── orient_k.hpp │ │ │ └── predicate_k.hpp │ │ ├── rdel_mesh │ │ │ ├── rdel_base_2.hpp │ │ │ ├── rdel_base_3.hpp │ │ │ ├── rdel_complex_2.hpp │ │ │ ├── rdel_complex_3.hpp │ │ │ ├── rdel_cost_delaunay_2.inc │ │ │ ├── rdel_cost_delaunay_3.inc │ │ │ ├── rdel_cost_delfront_2.inc │ │ │ ├── rdel_cost_delfront_3.inc │ │ │ ├── rdel_create_init_2.inc │ │ │ ├── rdel_create_init_3.inc │ │ │ ├── rdel_filt_k.hpp │ │ │ ├── rdel_make_2.hpp │ │ │ ├── rdel_make_3.hpp │ │ │ ├── rdel_mesh_2.hpp │ │ │ ├── rdel_mesh_3.hpp │ │ │ ├── rdel_offh_delfront_2.inc │ │ │ ├── rdel_offh_delfront_3.inc │ │ │ ├── rdel_pred_delaunay_2.hpp │ │ │ ├── rdel_pred_delaunay_3.hpp │ │ │ ├── rdel_pred_delfront_2.hpp │ │ │ ├── rdel_pred_delfront_3.hpp │ │ │ ├── rdel_refine_ball_2.inc │ │ │ ├── rdel_refine_ball_3.inc │ │ │ ├── rdel_refine_base_2.inc │ │ │ ├── rdel_refine_base_3.inc │ │ │ ├── rdel_refine_face_2.inc │ │ │ ├── rdel_refine_face_3.inc │ │ │ ├── rdel_refine_topo_2.inc │ │ │ ├── rdel_refine_topo_3.inc │ │ │ ├── rdel_sink_delfront_2.inc │ │ │ ├── rdel_sink_delfront_3.inc │ │ │ ├── rdel_test_bounds_2.inc │ │ │ ├── rdel_test_bounds_3.inc │ │ │ ├── rdel_timers.hpp │ │ │ ├── rdel_update_face_2.inc │ │ │ ├── rdel_update_face_3.inc │ │ │ ├── rdel_update_topo_2.inc │ │ │ └── rdel_update_topo_3.inc │ │ ├── rdelmesh.hpp │ │ ├── tessellate.hpp │ │ ├── tessellate │ │ │ ├── delaunay_scan_tria.inc │ │ │ ├── delaunay_star_void.inc │ │ │ ├── delaunay_tri_k.hpp │ │ │ ├── delaunay_tri_pred_2.hpp │ │ │ ├── delaunay_tri_pred_3.hpp │ │ │ ├── delaunay_tri_pred_4.hpp │ │ │ ├── delaunay_tri_type_2.hpp │ │ │ ├── delaunay_tri_type_3.hpp │ │ │ ├── delaunay_tri_type_4.hpp │ │ │ ├── delaunay_walk_mesh.inc │ │ │ ├── laguerre_tri_pred_2.hpp │ │ │ ├── laguerre_tri_pred_3.hpp │ │ │ └── laguerre_tri_pred_4.hpp │ │ ├── textutil.hpp │ │ └── useropts.hpp │ ├── liblib │ │ ├── init_jig_t.hpp │ │ ├── init_msh_t.hpp │ │ ├── load_jig_t.hpp │ │ ├── load_msh_t.hpp │ │ ├── save_jig_t.hpp │ │ └── save_msh_t.hpp │ ├── marche.hpp │ ├── msh_copy.hpp │ ├── msh_init.hpp │ ├── msh_read.hpp │ ├── msh_save.hpp │ ├── msh_save.inc │ ├── netcdf │ │ ├── COPYRIGHT.md │ │ ├── README.md │ │ ├── ncutil.h │ │ └── netcdf.h │ ├── offset.hpp │ ├── rdt_save.inc │ ├── tri_save.inc │ └── tripod.hpp │ ├── uni │ ├── CMakeLists.txt │ ├── README.md │ ├── print.h │ ├── test2d_a.c │ ├── test2d_b.c │ ├── test2d_c.c │ ├── test2d_d.c │ ├── test2d_e.c │ ├── test2d_f.c │ ├── test2d_g.c │ ├── test2d_h.c │ ├── test2d_i.c │ ├── test2s_a.c │ ├── test2s_b.c │ ├── test2s_c.c │ ├── test2s_e.c │ ├── test2s_f.c │ ├── test2s_g.c │ ├── test2s_h.c │ ├── test2s_i.c │ ├── test3d_a.c │ ├── test3d_b.c │ ├── test3d_c.c │ ├── test3d_d.c │ ├── test3d_e.c │ ├── test3d_f.c │ ├── test3d_g.c │ └── test_all.c │ └── version.txt ├── files ├── airfoil.msh ├── bunny.msh ├── eight.msh ├── lakes.msh ├── piece.msh └── wheel.msh ├── jigsawpy ├── __init__.py ├── bisect.py ├── certify.py ├── def_t.py ├── jig_l.py ├── jig_t.py ├── jigsaw.py ├── libsaw.py ├── loadjig.py ├── loadmsh.py ├── msh_l.py ├── msh_t.py ├── parse │ ├── __init__.py │ ├── saveoff.py │ ├── savevtk.py │ └── savewav.py ├── prj_t.py ├── project.py ├── savejig.py ├── savemsh.py └── tools │ ├── __init__.py │ ├── mathutils.py │ ├── meshutils.py │ ├── orthoball.py │ ├── predicate.py │ ├── projector.py │ └── scorecard.py ├── requirements.txt ├── setup.cfg ├── setup.py └── tests ├── __init__.py ├── case_0_.py ├── case_1_.py ├── case_2_.py ├── case_3_.py ├── case_4_.py ├── case_5_.py ├── case_6_.py ├── case_7_.py └── case_8_.py /.github/workflows/setup.yml: -------------------------------------------------------------------------------- 1 | name: jigsaw-python tester 2 | 3 | on: 4 | workflow_dispatch: 5 | pull_request: 6 | push: 7 | 8 | jobs: 9 | build: 10 | runs-on: ${{ matrix.os }} 11 | strategy: 12 | fail-fast: false 13 | matrix: 14 | os: [ubuntu-latest, macos-latest, windows-latest] 15 | python-version: ["3.10"] 16 | 17 | steps: 18 | - uses: actions/checkout@v3 19 | 20 | - name: Print environment 21 | run: | 22 | echo github.event.action: ${{ github.event.action }} 23 | echo github.event_name: ${{ github.event_name }} 24 | 25 | - name: Set up Python ${{ matrix.python-version }} 26 | uses: actions/setup-python@v4 27 | with: 28 | python-version: ${{ matrix.python-version }} 29 | 30 | - name: Install dependencies on win 31 | if: startsWith(matrix.os, 'windows') 32 | run: | 33 | choco install ninja cmake 34 | ninja --version 35 | cmake --version 36 | 37 | - name: Install dependencies on unx 38 | if: startsWith(matrix.os, 'ubuntu') 39 | run: | 40 | sudo apt-get update 41 | sudo apt-get install ninja-build cmake 42 | ninja --version 43 | cmake --version 44 | g++ --version 45 | 46 | - name: Install dependencies on osx 47 | if: startsWith(matrix.os, 'macos') 48 | run: | 49 | brew install ninja cmake llvm libomp 50 | ninja --version 51 | cmake --version 52 | clang++ --version 53 | 54 | - name: Install dependencies 55 | run: | 56 | python -m pip install --upgrade pip 57 | pip install -r requirements.txt 58 | 59 | - name: Build jigsaw-python 60 | run: python setup.py build_external install 61 | 62 | - name: Eval. jigsaw-python 63 | run: python example.py --IDnumber=-1 64 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # jigsaw things 2 | * 3 | !/**/ 4 | !*.* 5 | *.exe 6 | *.dll 7 | *.so 8 | *.dylib 9 | cache/*.log 10 | cache/*.jig 11 | cache/*.msh 12 | 13 | # python things 14 | __pycache__/ 15 | *.py[cod] 16 | 17 | jigsawpy/_bin/ 18 | jigsawpy/_lib/ 19 | 20 | build/ 21 | develop-eggs/ 22 | dist/ 23 | eggs/ 24 | parts/ 25 | sdist/ 26 | var/ 27 | *.egg-info/ 28 | .installed.cfg 29 | *.egg 30 | 31 | # data files, etc 32 | *.nc 33 | *.grd 34 | *.vtk 35 | *.off 36 | *.obj 37 | *.stl 38 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | `JIGSAW` is licensed under the following terms: 2 | 3 | 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.) 4 | 5 | `DISCLAIMER`: Neither I nor `THE CONTRIBUTORS` warrant this code in any way whatsoever. This code is provided "as-is" to be used at your own risk. 6 | 7 | `THE CONTRIBUTORS` include: 8 | (a) The University of Sydney 9 | (b) The Massachusetts Institute of Technology 10 | (c) Columbia University 11 | (d) The National Aeronautics & Space Administration 12 | (e) Los Alamos National Laboratory 13 | -------------------------------------------------------------------------------- /MANIFEST.in: -------------------------------------------------------------------------------- 1 | include MANIFEST.in 2 | include README.md 3 | include LICENSE.md 4 | include example.py 5 | recursive-include cache *.* 6 | recursive-include external *.* 7 | recursive-include files *.* 8 | recursive-include jigsawpy *.* 9 | recursive-include tests *.* 10 | -------------------------------------------------------------------------------- /cache/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dengwirda/jigsaw-python/5729a380039c4df5de484cb9ec331e14b16e7c55/cache/.keep -------------------------------------------------------------------------------- /example.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | import os 4 | import argparse 5 | 6 | from tests.case_0_ import case_0_ 7 | from tests.case_1_ import case_1_ 8 | from tests.case_2_ import case_2_ 9 | from tests.case_3_ import case_3_ 10 | from tests.case_4_ import case_4_ 11 | from tests.case_5_ import case_5_ 12 | from tests.case_6_ import case_6_ 13 | from tests.case_7_ import case_7_ 14 | from tests.case_8_ import case_8_ 15 | 16 | 17 | def example(IDnumber=0): 18 | 19 | #--------------- delegate to the individual example cases... 20 | 21 | src_path = os.path.join( 22 | os.path.abspath( 23 | os.path.dirname(__file__)), "files") 24 | 25 | dst_path = os.path.join( 26 | os.path.abspath( 27 | os.path.dirname(__file__)), "cache") 28 | 29 | if (IDnumber == +0): 30 | case_0_(src_path, dst_path) 31 | 32 | elif (IDnumber == +1): 33 | case_1_(src_path, dst_path) 34 | 35 | elif (IDnumber == +2): 36 | case_2_(src_path, dst_path) 37 | 38 | elif (IDnumber == +3): 39 | case_3_(src_path, dst_path) 40 | 41 | elif (IDnumber == +4): 42 | case_4_(src_path, dst_path) 43 | 44 | elif (IDnumber == +5): 45 | case_5_(src_path, dst_path) 46 | 47 | elif (IDnumber == +6): 48 | case_6_(src_path, dst_path) 49 | 50 | elif (IDnumber == +7): 51 | case_7_(src_path, dst_path) 52 | 53 | elif (IDnumber == +8): 54 | case_8_(src_path, dst_path) 55 | 56 | elif (IDnumber == -1): 57 | for i in range(9): example(i) 58 | 59 | return 60 | 61 | 62 | if __name__ == "__main__": 63 | parser = argparse.ArgumentParser( 64 | description=__doc__, formatter_class=argparse.RawTextHelpFormatter) 65 | 66 | parser.add_argument("--IDnumber", dest="IDnumber", type=int, 67 | required=True, help="Run example with ID = (0-8).") 68 | 69 | args = parser.parse_args() 70 | 71 | example(IDnumber=args.IDnumber) 72 | -------------------------------------------------------------------------------- /external/jigsaw/.gitattributes: -------------------------------------------------------------------------------- 1 | *.inc linguist-language=cpp 2 | -------------------------------------------------------------------------------- /external/jigsaw/.github/workflows/cmake.yml: -------------------------------------------------------------------------------- 1 | name: CMake Build Matrix 2 | 3 | on: 4 | workflow_dispatch: 5 | pull_request: 6 | push: 7 | 8 | env: 9 | BUILD_TYPE: Debug 10 | 11 | jobs: 12 | build: 13 | name: ${{ matrix.config.name }} 14 | runs-on: ${{ matrix.config.os }} 15 | strategy: 16 | fail-fast: false 17 | matrix: 18 | config: 19 | - { 20 | name: "Windows Latest MSVC", artifact: "Windows-MSVC.tar.xz", 21 | os: windows-latest, 22 | cc: "cl", cxx: "cl" 23 | } 24 | - { 25 | name: "Ubuntu Latest GCC", artifact: "Linux.tar.xz", 26 | os: ubuntu-latest, 27 | cc: "gcc", cxx: "g++" 28 | } 29 | - { 30 | name: "macOS Latest Clang", artifact: "macOS.tar.xz", 31 | os: macos-latest, 32 | cc: "clang", cxx: "clang++" 33 | } 34 | 35 | steps: 36 | - uses: actions/checkout@v3 37 | 38 | - name: Print environment 39 | run: | 40 | echo github.event.action: ${{ github.event.action }} 41 | echo github.event_name: ${{ github.event_name }} 42 | 43 | - name: Install dependencies on win 44 | if: startsWith(matrix.config.os, 'windows') 45 | run: | 46 | choco install ninja cmake 47 | ninja --version 48 | cmake --version 49 | 50 | - name: Install dependencies on unx 51 | if: startsWith(matrix.config.name, 'ubuntu') 52 | run: | 53 | sudo apt-get update 54 | sudo apt-get install ninja-build cmake 55 | ninja --version 56 | cmake --version 57 | g++ --version 58 | 59 | - name: Install dependencies on osx 60 | if: startsWith(matrix.config.os, 'macos') 61 | run: | 62 | brew install ninja cmake llvm libomp 63 | ninja --version 64 | cmake --version 65 | clang++ --version 66 | 67 | - name: Configure jigsaw 68 | run: | 69 | mkdir ${{github.workspace}}/build 70 | cd ${{github.workspace}}/build 71 | cmake .. -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} 72 | 73 | - name: Build jigsaw 74 | run: | 75 | cd ${{github.workspace}}/build 76 | cmake --build . --config ${{env.BUILD_TYPE}} --target install 77 | 78 | - name: Clean jigsaw 79 | run: rm -r ${{github.workspace}}/build 80 | 81 | - name: Configure tests for jigsaw 82 | run: | 83 | mkdir ${{github.workspace}}/uni/build 84 | cd ${{github.workspace}}/uni/build 85 | cmake .. -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} 86 | 87 | - name: Build tests for jigsaw 88 | run: | 89 | cd ${{github.workspace}}/uni/build 90 | cmake --build . --config ${{env.BUILD_TYPE}} --target install 91 | 92 | - name: Prep. tests for jigsaw 93 | if: startsWith(matrix.config.os, 'windows') 94 | run: | 95 | cd ${{github.workspace}}/uni 96 | cp ../lib/jigsaw.dll . 97 | 98 | - name: Eval. tests for jigsaw 99 | run: | 100 | cd ${{github.workspace}}/uni 101 | ./test_all 102 | 103 | - name: Extra tests for jigsaw 104 | run: | 105 | cd ${{github.workspace}} 106 | ./bin/jigsaw example.jig 107 | ./bin/jigsaw geo/airfoil.jig 108 | ./bin/jigsaw geo/bunny.jig 109 | ./bin/jigsaw geo/parts.jig 110 | ./bin/jigsaw geo/earth.jig 111 | ./bin/jigsaw geo/lakes.jig 112 | 113 | - name: Clean tests for jigsaw 114 | run: rm -r ${{github.workspace}}/uni/build 115 | -------------------------------------------------------------------------------- /external/jigsaw/.gitignore: -------------------------------------------------------------------------------- 1 | # cpp binaries 2 | * 3 | !/**/ 4 | !*.* 5 | *.exe 6 | *.dll 7 | *.so 8 | *.dylib 9 | 10 | -------------------------------------------------------------------------------- /external/jigsaw/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required (VERSION 3.9.4) 2 | project (JIGSAW) 3 | 4 | add_subdirectory ("${PROJECT_SOURCE_DIR}/src") 5 | -------------------------------------------------------------------------------- /external/jigsaw/LICENSE.md: -------------------------------------------------------------------------------- 1 | `JIGSAW` is licensed under the following terms: 2 | 3 | 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.) 4 | 5 | `DISCLAIMER`: Neither I nor `THE CONTRIBUTORS` warrant this code in any way whatsoever. This code is provided "as-is" to be used at your own risk. 6 | 7 | `THE CONTRIBUTORS` include: 8 | (a) The University of Sydney 9 | (b) The Massachusetts Institute of Technology 10 | (c) Columbia University 11 | (d) The National Aeronautics & Space Administration 12 | (e) Los Alamos National Laboratory 13 | -------------------------------------------------------------------------------- /external/jigsaw/bin/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dengwirda/jigsaw-python/5729a380039c4df5de484cb9ec331e14b16e7c55/external/jigsaw/bin/.keep -------------------------------------------------------------------------------- /external/jigsaw/geo/airfoil.jig: -------------------------------------------------------------------------------- 1 | 2 | # 3 | # AIRFOIL.JIG: simple airfoil 4 | # 5 | 6 | # To run on WIN platforms: 7 | # 8 | # bin\jigsaw.exe geo\airfoil.jig 9 | # 10 | # To run on LNX platforms: 11 | # 12 | # bin/jigsaw geo/airfoil.jig 13 | # 14 | # from jigsaw root folder. 15 | # 16 | 17 | GEOM_FILE = geo/airfoil.msh 18 | MESH_FILE = out/airfoil.msh 19 | VERBOSITY = 1 20 | GEOM_FEAT = TRUE 21 | MESH_TOP1 = TRUE 22 | MESH_DIMS = 2 23 | HFUN_HMAX = 0.02 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /external/jigsaw/geo/bunny.jig: -------------------------------------------------------------------------------- 1 | 2 | # 3 | # BUNNY.JIG: stanford bunny 4 | # 5 | 6 | # To run on WIN platforms: 7 | # 8 | # bin\jigsaw.exe geo\bunny.jig 9 | # 10 | # To run on LNX platforms: 11 | # 12 | # bin/jigsaw geo/bunny.jig 13 | # 14 | # from jigsaw root folder. 15 | # 16 | 17 | GEOM_FILE = geo/bunny.msh 18 | MESH_FILE = out/bunny.msh 19 | VERBOSITY = 1 20 | MESH_DIMS = 2 21 | HFUN_HMAX = 0.05 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /external/jigsaw/geo/earth.jig: -------------------------------------------------------------------------------- 1 | 2 | # 3 | # EARTH.JIG: mesh coastlines 4 | # 5 | 6 | # To run on WIN platforms: 7 | # 8 | # bin\jigsaw.exe geo\earth.jig 9 | # 10 | # To run on LNX platforms: 11 | # 12 | # bin/jigsaw geo/earth.jig 13 | # 14 | # from jigsaw root folder. 15 | # 16 | 17 | GEOM_FILE = geo/earth.msh 18 | MESH_FILE = out/earth.msh 19 | VERBOSITY = 1 20 | MESH_DIMS = 1 21 | GEOM_SEED = 160 22 | HFUN_HMAX = 0.01 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /external/jigsaw/geo/lakes.jig: -------------------------------------------------------------------------------- 1 | 2 | # 3 | # LAKES.JIG: lake superior 4 | # 5 | 6 | # To run on WIN platforms: 7 | # 8 | # bin\jigsaw.exe geo\lakes.jig 9 | # 10 | # To run on LNX platforms: 11 | # 12 | # bin/jigsaw geo/lakes.jig 13 | # 14 | # from jigsaw root folder. 15 | # 16 | 17 | GEOM_FILE = geo/lakes.msh 18 | MESH_FILE = out/lakes.msh 19 | VERBOSITY = 1 20 | GEOM_FEAT = TRUE 21 | MESH_TOP1 = TRUE 22 | MESH_DIMS = 2 23 | HFUN_HMAX = 0.05 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /external/jigsaw/geo/parts.jig: -------------------------------------------------------------------------------- 1 | 2 | # 3 | # PARTS.JIG: mechanical part 4 | # 5 | 6 | # To run on WIN platforms: 7 | # 8 | # bin\jigsaw.exe geo\parts.jig 9 | # 10 | # To run on LNX platforms: 11 | # 12 | # bin/jigsaw geo/parts.jig 13 | # 14 | # from jigsaw root folder. 15 | # 16 | 17 | GEOM_FILE = geo/parts.msh 18 | MESH_FILE = out/parts.msh 19 | VERBOSITY = 1 20 | GEOM_FEAT = TRUE 21 | MESH_TOP1 = TRUE 22 | MESH_DIMS = 2 23 | HFUN_HMAX = 0.05 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /external/jigsaw/img/bunny-TRIA3-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dengwirda/jigsaw-python/5729a380039c4df5de484cb9ec331e14b16e7c55/external/jigsaw/img/bunny-TRIA3-1.png -------------------------------------------------------------------------------- /external/jigsaw/img/bunny-TRIA3-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dengwirda/jigsaw-python/5729a380039c4df5de484cb9ec331e14b16e7c55/external/jigsaw/img/bunny-TRIA3-2.png -------------------------------------------------------------------------------- /external/jigsaw/img/bunny-TRIA3-3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dengwirda/jigsaw-python/5729a380039c4df5de484cb9ec331e14b16e7c55/external/jigsaw/img/bunny-TRIA3-3.png -------------------------------------------------------------------------------- /external/jigsaw/img/bunny-TRIA4-3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dengwirda/jigsaw-python/5729a380039c4df5de484cb9ec331e14b16e7c55/external/jigsaw/img/bunny-TRIA4-3.png -------------------------------------------------------------------------------- /external/jigsaw/inc/jigsaw_const.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | -------------------------------------------------------- 4 | * Constants for the JIGSAW meshing library. 5 | -------------------------------------------------------- 6 | * 7 | * This program may be freely redistributed under the 8 | * condition that the copyright notices (including this 9 | * entire header) are not removed, and no compensation 10 | * is received through use of the software. Private, 11 | * research, and institutional use is free. You may 12 | * distribute modified versions of this code UNDER THE 13 | * CONDITION THAT THIS CODE AND ANY MODIFICATIONS MADE 14 | * TO IT IN THE SAME FILE REMAIN UNDER COPYRIGHT OF THE 15 | * ORIGINAL AUTHOR, BOTH SOURCE AND OBJECT CODE ARE 16 | * MADE FREELY AVAILABLE WITHOUT CHARGE, AND CLEAR 17 | * NOTICE IS GIVEN OF THE MODIFICATIONS. Distribution 18 | * of this code as part of a commercial system is 19 | * permissible ONLY BY DIRECT ARRANGEMENT WITH THE 20 | * AUTHOR. (If you are not directly supplying this 21 | * code to a customer, and you are instead telling them 22 | * how they can obtain it for free, then you are not 23 | * required to make any arrangement with me.) 24 | * 25 | * Disclaimer: Neither I nor THE CONTRIBUTORS warrant 26 | * this code in any way whatsoever. This code is 27 | * provided "as-is" to be used at your own risk. 28 | * 29 | * THE CONTRIBUTORS include: 30 | * (a) The University of Sydney 31 | * (b) The Massachusetts Institute of Technology 32 | * (c) Columbia University 33 | * (d) The National Aeronautics & Space Administration 34 | * (e) Los Alamos National Laboratory 35 | * 36 | -------------------------------------------------------- 37 | * 38 | * Last updated: 29 May, 2022 39 | * 40 | * Copyright 2013-2022 41 | * Darren Engwirda 42 | * d.engwirda@gmail.com 43 | * https://github.com/dengwirda 44 | * 45 | -------------------------------------------------------- 46 | */ 47 | 48 | /* 49 | -------------------------------------------------------- 50 | * return codes for JIGSAW. 51 | -------------------------------------------------------- 52 | */ 53 | 54 | # define JIGSAW_UNKNOWN_ERROR -1 55 | 56 | # define JIGSAW_NO_ERROR +0 57 | 58 | # define JIGSAW_FILE_NOT_LOCATED +2 59 | # define JIGSAW_FILE_NOT_CREATED +3 60 | # define JIGSAW_NETCDF_NOT_FOUND +9 61 | 62 | # define JIGSAW_INVALID_ARGUMENT +4 63 | # define JIGSAW_INVALID_INDEXING +5 64 | # define JIGSAW_INVALID_USEROPTS +6 65 | # define JIGSAW_INVALID_ARRAYDIM +7 66 | 67 | /* 68 | -------------------------------------------------------- 69 | * constants for JIGSAW. 70 | -------------------------------------------------------- 71 | */ 72 | 73 | # define JIGSAW_NULL_FLAG -100 74 | 75 | # define JIGSAW_EUCLIDEAN_MESH +100 76 | # define JIGSAW_EUCLIDEAN_GRID +101 77 | # define JIGSAW_EUCLIDEAN_DUAL +102 78 | 79 | # define JIGSAW_ELLIPSOID_MESH +200 80 | # define JIGSAW_ELLIPSOID_GRID +201 81 | # define JIGSAW_ELLIPSOID_DUAL +202 82 | 83 | # define JIGSAW_POINT_TAG +10 84 | # define JIGSAW_EDGE2_TAG +20 85 | # define JIGSAW_TRIA3_TAG +30 86 | # define JIGSAW_QUAD4_TAG +40 87 | # define JIGSAW_TRIA4_TAG +50 88 | # define JIGSAW_HEXA8_TAG +60 89 | # define JIGSAW_WEDG6_TAG +70 90 | # define JIGSAW_PYRA5_TAG +80 91 | 92 | # define JIGSAW_HFUN_RELATIVE +300 93 | # define JIGSAW_HFUN_ABSOLUTE +301 94 | 95 | # define JIGSAW_KERN_DELFRONT +400 96 | # define JIGSAW_KERN_DELAUNAY +401 97 | # define JIGSAW_KERN_BISECTOR +402 98 | 99 | # define JIGSAW_BNDS_TRIACELL +402 100 | # define JIGSAW_BNDS_DUALCELL +403 101 | 102 | # define JIGSAW_KERN_ODT_DQDX +404 103 | # define JIGSAW_KERN_CVT_DQDX +405 104 | # define JIGSAW_KERN_H95_DQDX +406 105 | 106 | # define JIGSAW_KERN_AREA_LEN +410 107 | # define JIGSAW_KERN_SKEW_COS +411 108 | 109 | 110 | -------------------------------------------------------------------------------- /external/jigsaw/lib/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dengwirda/jigsaw-python/5729a380039c4df5de484cb9ec331e14b16e7c55/external/jigsaw/lib/.keep -------------------------------------------------------------------------------- /external/jigsaw/out/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dengwirda/jigsaw-python/5729a380039c4df5de484cb9ec331e14b16e7c55/external/jigsaw/out/.keep -------------------------------------------------------------------------------- /external/jigsaw/src/libcpp/aabbtree.hpp: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | ------------------------------------------------------------ 4 | * algorithms for aabb-tree construction in R^d. 5 | ------------------------------------------------------------ 6 | * 7 | * This program may be freely redistributed under the 8 | * condition that the copyright notices (including this 9 | * entire header) are not removed, and no compensation 10 | * is received through use of the software. Private, 11 | * research, and institutional use is free. You may 12 | * distribute modified versions of this code UNDER THE 13 | * CONDITION THAT THIS CODE AND ANY MODIFICATIONS MADE 14 | * TO IT IN THE SAME FILE REMAIN UNDER COPYRIGHT OF THE 15 | * ORIGINAL AUTHOR, BOTH SOURCE AND OBJECT CODE ARE 16 | * MADE FREELY AVAILABLE WITHOUT CHARGE, AND CLEAR 17 | * NOTICE IS GIVEN OF THE MODIFICATIONS. Distribution 18 | * of this code as part of a commercial system is 19 | * permissible ONLY BY DIRECT ARRANGEMENT WITH THE 20 | * AUTHOR. (If you are not directly supplying this 21 | * code to a customer, and you are instead telling them 22 | * how they can obtain it for free, then you are not 23 | * required to make any arrangement with me.) 24 | * 25 | * Disclaimer: Neither I nor THE CONTRIBUTORS warrant 26 | * this code in any way whatsoever. This code is 27 | * provided "as-is" to be used at your own risk. 28 | * 29 | * THE CONTRIBUTORS include: 30 | * (a) The University of Sydney 31 | * (b) The Massachusetts Institute of Technology 32 | * (c) Columbia University 33 | * (d) The National Aeronautics & Space Administration 34 | * (e) Los Alamos National Laboratory 35 | * 36 | ------------------------------------------------------------ 37 | * 38 | * Last updated: 13 Aug., 2018 39 | * 40 | * Copyright 2013-2018 41 | * Darren Engwirda 42 | * d.engwirda@gmail.com 43 | * https://github.com/dengwirda/ 44 | * 45 | ------------------------------------------------------------ 46 | */ 47 | 48 | # pragma once 49 | 50 | # ifndef __AABBTREE__ 51 | # define __AABBTREE__ 52 | 53 | # include "containers.hpp" 54 | 55 | # include "aabb_tree/aabb_type_k.hpp" 56 | # include "aabb_tree/aabb_tree_k.hpp" 57 | 58 | # include "aabb_tree/aabb_pred_k.hpp" 59 | 60 | # include "aabb_tree/aabb_mesh_k.hpp" 61 | 62 | # endif//__AABBTREE__ 63 | 64 | 65 | 66 | -------------------------------------------------------------------------------- /external/jigsaw/src/libcpp/algorithms.hpp: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | ------------------------------------------------------------ 4 | * algorithms/operators for container types. 5 | ------------------------------------------------------------ 6 | * 7 | * This program may be freely redistributed under the 8 | * condition that the copyright notices (including this 9 | * entire header) are not removed, and no compensation 10 | * is received through use of the software. Private, 11 | * research, and institutional use is free. You may 12 | * distribute modified versions of this code UNDER THE 13 | * CONDITION THAT THIS CODE AND ANY MODIFICATIONS MADE 14 | * TO IT IN THE SAME FILE REMAIN UNDER COPYRIGHT OF THE 15 | * ORIGINAL AUTHOR, BOTH SOURCE AND OBJECT CODE ARE 16 | * MADE FREELY AVAILABLE WITHOUT CHARGE, AND CLEAR 17 | * NOTICE IS GIVEN OF THE MODIFICATIONS. Distribution 18 | * of this code as part of a commercial system is 19 | * permissible ONLY BY DIRECT ARRANGEMENT WITH THE 20 | * AUTHOR. (If you are not directly supplying this 21 | * code to a customer, and you are instead telling them 22 | * how they can obtain it for free, then you are not 23 | * required to make any arrangement with me.) 24 | * 25 | * Disclaimer: Neither I nor THE CONTRIBUTORS warrant 26 | * this code in any way whatsoever. This code is 27 | * provided "as-is" to be used at your own risk. 28 | * 29 | * THE CONTRIBUTORS include: 30 | * (a) The University of Sydney 31 | * (b) The Massachusetts Institute of Technology 32 | * (c) Columbia University 33 | * (d) The National Aeronautics & Space Administration 34 | * (e) Los Alamos National Laboratory 35 | * 36 | ------------------------------------------------------------ 37 | * 38 | * Last updated: 01 Sept., 2017 39 | * 40 | * Copyright 2013-2017 41 | * Darren Engwirda 42 | * d.engwirda@gmail.com 43 | * https://github.com/dengwirda/ 44 | * 45 | ------------------------------------------------------------ 46 | */ 47 | 48 | # pragma once 49 | 50 | # ifndef __ALGORITHMS__ 51 | # define __ALGORITHMS__ 52 | 53 | # include "basebase.hpp" 54 | 55 | # include "algorithms/sort.hpp" 56 | # include "algorithms/find.hpp" 57 | 58 | 59 | # endif//__ALGORITHMS__ 60 | 61 | 62 | 63 | -------------------------------------------------------------------------------- /external/jigsaw/src/libcpp/allocators.hpp: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | ------------------------------------------------------------ 4 | * basic allocators, a bit different from std::lib... 5 | ------------------------------------------------------------ 6 | * 7 | * This program may be freely redistributed under the 8 | * condition that the copyright notices (including this 9 | * entire header) are not removed, and no compensation 10 | * is received through use of the software. Private, 11 | * research, and institutional use is free. You may 12 | * distribute modified versions of this code UNDER THE 13 | * CONDITION THAT THIS CODE AND ANY MODIFICATIONS MADE 14 | * TO IT IN THE SAME FILE REMAIN UNDER COPYRIGHT OF THE 15 | * ORIGINAL AUTHOR, BOTH SOURCE AND OBJECT CODE ARE 16 | * MADE FREELY AVAILABLE WITHOUT CHARGE, AND CLEAR 17 | * NOTICE IS GIVEN OF THE MODIFICATIONS. Distribution 18 | * of this code as part of a commercial system is 19 | * permissible ONLY BY DIRECT ARRANGEMENT WITH THE 20 | * AUTHOR. (If you are not directly supplying this 21 | * code to a customer, and you are instead telling them 22 | * how they can obtain it for free, then you are not 23 | * required to make any arrangement with me.) 24 | * 25 | * Disclaimer: Neither I nor THE CONTRIBUTORS warrant 26 | * this code in any way whatsoever. This code is 27 | * provided "as-is" to be used at your own risk. 28 | * 29 | * THE CONTRIBUTORS include: 30 | * (a) The University of Sydney 31 | * (b) The Massachusetts Institute of Technology 32 | * (c) Columbia University 33 | * (d) The National Aeronautics & Space Administration 34 | * (e) Los Alamos National Laboratory 35 | * 36 | ------------------------------------------------------------ 37 | * 38 | * Last updated: 02 May, 2017 39 | * 40 | * Copyright 2013-2017 41 | * Darren Engwirda 42 | * d.engwirda@gmail.com 43 | * https://github.com/dengwirda/ 44 | * 45 | ------------------------------------------------------------ 46 | */ 47 | 48 | # pragma once 49 | 50 | # ifndef __ALLOCATORS__ 51 | # define __ALLOCATORS__ 52 | 53 | # include "basebase.hpp" 54 | 55 | # include "allocators/alloc_base.hpp" 56 | # include "allocators/alloc_pool.hpp" 57 | # include "allocators/alloc_wrap.hpp" 58 | 59 | # include "allocators/alloc_item.hpp" 60 | 61 | 62 | # endif//__ALLOCATORS__ 63 | 64 | 65 | 66 | -------------------------------------------------------------------------------- /external/jigsaw/src/libcpp/containers.hpp: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | ------------------------------------------------------------ 4 | * std::library-like containers, but not quite... 5 | ------------------------------------------------------------ 6 | * 7 | * This program may be freely redistributed under the 8 | * condition that the copyright notices (including this 9 | * entire header) are not removed, and no compensation 10 | * is received through use of the software. Private, 11 | * research, and institutional use is free. You may 12 | * distribute modified versions of this code UNDER THE 13 | * CONDITION THAT THIS CODE AND ANY MODIFICATIONS MADE 14 | * TO IT IN THE SAME FILE REMAIN UNDER COPYRIGHT OF THE 15 | * ORIGINAL AUTHOR, BOTH SOURCE AND OBJECT CODE ARE 16 | * MADE FREELY AVAILABLE WITHOUT CHARGE, AND CLEAR 17 | * NOTICE IS GIVEN OF THE MODIFICATIONS. Distribution 18 | * of this code as part of a commercial system is 19 | * permissible ONLY BY DIRECT ARRANGEMENT WITH THE 20 | * AUTHOR. (If you are not directly supplying this 21 | * code to a customer, and you are instead telling them 22 | * how they can obtain it for free, then you are not 23 | * required to make any arrangement with me.) 24 | * 25 | * Disclaimer: Neither I nor THE CONTRIBUTORS warrant 26 | * this code in any way whatsoever. This code is 27 | * provided "as-is" to be used at your own risk. 28 | * 29 | * THE CONTRIBUTORS include: 30 | * (a) The University of Sydney 31 | * (b) The Massachusetts Institute of Technology 32 | * (c) Columbia University 33 | * (d) The National Aeronautics & Space Administration 34 | * (e) Los Alamos National Laboratory 35 | * 36 | ------------------------------------------------------------ 37 | * 38 | * Last updated: 21 Dec., 2018 39 | * 40 | * Copyright 2013-2018 41 | * Darren Engwirda 42 | * d.engwirda@gmail.com 43 | * https://github.com/dengwirda/ 44 | * 45 | ------------------------------------------------------------ 46 | */ 47 | 48 | # pragma once 49 | 50 | # ifndef __CONTAINERS__ 51 | # define __CONTAINERS__ 52 | 53 | # include "allocators.hpp" 54 | 55 | namespace containers 56 | { 57 | /*----- buffer reallocation options */ 58 | enum alloc_types 59 | { loose_alloc, // zero manip. 60 | tight_alloc // full manip. 61 | } ; 62 | } // containers 63 | 64 | # include "containers/fixed_array.hpp" 65 | # include "containers/array.hpp" 66 | # include "containers/block_array.hpp" 67 | 68 | # include "containers/single_list.hpp" 69 | # include "containers/double_list.hpp" 70 | # include "containers/basic_stack.hpp" 71 | 72 | # include "containers/arraylist.hpp" 73 | 74 | # include "containers/hashtable.hpp" 75 | # include "containers/hashtwice.hpp" 76 | 77 | # include "containers/priorityset.hpp" 78 | # include "containers/prioritymap.hpp" 79 | # include "containers/priorityidx.hpp" 80 | 81 | 82 | # endif//__CONTAINERS__ 83 | 84 | 85 | 86 | -------------------------------------------------------------------------------- /external/jigsaw/src/libcpp/geometry.hpp: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | ------------------------------------------------------------ 4 | * general operations/algorithms on geometry. 5 | ------------------------------------------------------------ 6 | * 7 | * This program may be freely redistributed under the 8 | * condition that the copyright notices (including this 9 | * entire header) are not removed, and no compensation 10 | * is received through use of the software. Private, 11 | * research, and institutional use is free. You may 12 | * distribute modified versions of this code UNDER THE 13 | * CONDITION THAT THIS CODE AND ANY MODIFICATIONS MADE 14 | * TO IT IN THE SAME FILE REMAIN UNDER COPYRIGHT OF THE 15 | * ORIGINAL AUTHOR, BOTH SOURCE AND OBJECT CODE ARE 16 | * MADE FREELY AVAILABLE WITHOUT CHARGE, AND CLEAR 17 | * NOTICE IS GIVEN OF THE MODIFICATIONS. Distribution 18 | * of this code as part of a commercial system is 19 | * permissible ONLY BY DIRECT ARRANGEMENT WITH THE 20 | * AUTHOR. (If you are not directly supplying this 21 | * code to a customer, and you are instead telling them 22 | * how they can obtain it for free, then you are not 23 | * required to make any arrangement with me.) 24 | * 25 | * Disclaimer: Neither I nor THE CONTRIBUTORS warrant 26 | * this code in any way whatsoever. This code is 27 | * provided "as-is" to be used at your own risk. 28 | * 29 | * THE CONTRIBUTORS include: 30 | * (a) The University of Sydney 31 | * (b) The Massachusetts Institute of Technology 32 | * (c) Columbia University 33 | * (d) The National Aeronautics & Space Administration 34 | * (e) Los Alamos National Laboratory 35 | * 36 | ------------------------------------------------------------ 37 | * 38 | * Last updated: 01 Nov., 2017 39 | * 40 | * Copyright 2013-2017 41 | * Darren Engwirda 42 | * d.engwirda@gmail.com 43 | * https://github.com/dengwirda/ 44 | * 45 | ------------------------------------------------------------ 46 | */ 47 | 48 | # pragma once 49 | 50 | # ifndef __GEOMETRY__ 51 | # define __GEOMETRY__ 52 | 53 | # include "basebase.hpp" 54 | 55 | # include "mpfloats.hpp" 56 | # include "geompred.hpp" 57 | 58 | # include "mathutil.hpp" 59 | 60 | # include "geom_base/vect_base_k.hpp" 61 | 62 | # include "geom_base/intersect_k.hpp" 63 | 64 | # include "geom_base/cell_ball_k.hpp" 65 | # include "geom_base/cell_base_k.hpp" 66 | 67 | # endif//__GEOMETRY__ 68 | 69 | 70 | 71 | -------------------------------------------------------------------------------- /external/jigsaw/src/libcpp/geompred.hpp: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | ------------------------------------------------------------ 4 | * robust geometric predicates, a'la shewchuk 5 | ------------------------------------------------------------ 6 | * 7 | * This program may be freely redistributed under the 8 | * condition that the copyright notices (including this 9 | * entire header) are not removed, and no compensation 10 | * is received through use of the software. Private, 11 | * research, and institutional use is free. You may 12 | * distribute modified versions of this code UNDER THE 13 | * CONDITION THAT THIS CODE AND ANY MODIFICATIONS MADE 14 | * TO IT IN THE SAME FILE REMAIN UNDER COPYRIGHT OF THE 15 | * ORIGINAL AUTHOR, BOTH SOURCE AND OBJECT CODE ARE 16 | * MADE FREELY AVAILABLE WITHOUT CHARGE, AND CLEAR 17 | * NOTICE IS GIVEN OF THE MODIFICATIONS. Distribution 18 | * of this code as part of a commercial system is 19 | * permissible ONLY BY DIRECT ARRANGEMENT WITH THE 20 | * AUTHOR. (If you are not directly supplying this 21 | * code to a customer, and you are instead telling them 22 | * how they can obtain it for free, then you are not 23 | * required to make any arrangement with me.) 24 | * 25 | * Disclaimer: Neither I nor THE CONTRIBUTORS warrant 26 | * this code in any way whatsoever. This code is 27 | * provided "as-is" to be used at your own risk. 28 | * 29 | * THE CONTRIBUTORS include: 30 | * (a) The University of Sydney 31 | * (b) The Massachusetts Institute of Technology 32 | * (c) Columbia University 33 | * (d) The National Aeronautics & Space Administration 34 | * (e) Los Alamos National Laboratory 35 | * 36 | ------------------------------------------------------------ 37 | * 38 | * Last updated: 01 Mar., 2020 39 | * 40 | * Copyright 2020-- 41 | * Darren Engwirda 42 | * d.engwirda@gmail.com 43 | * https://github.com/dengwirda/ 44 | * 45 | ------------------------------------------------------------ 46 | */ 47 | 48 | # pragma once 49 | 50 | # ifndef __PREDICATES__ 51 | # define __PREDICATES__ 52 | 53 | # include "basebase.hpp" 54 | # include "mpfloats.hpp" 55 | 56 | # include 57 | 58 | # include "predicate/predicate_k.hpp" 59 | 60 | # endif//__PREDICATES__ 61 | 62 | 63 | 64 | -------------------------------------------------------------------------------- /external/jigsaw/src/libcpp/geomreps.hpp: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | ------------------------------------------------------------ 4 | * data-structures for geometry rep. in R^d. 5 | ------------------------------------------------------------ 6 | * 7 | * This program may be freely redistributed under the 8 | * condition that the copyright notices (including this 9 | * entire header) are not removed, and no compensation 10 | * is received through use of the software. Private, 11 | * research, and institutional use is free. You may 12 | * distribute modified versions of this code UNDER THE 13 | * CONDITION THAT THIS CODE AND ANY MODIFICATIONS MADE 14 | * TO IT IN THE SAME FILE REMAIN UNDER COPYRIGHT OF THE 15 | * ORIGINAL AUTHOR, BOTH SOURCE AND OBJECT CODE ARE 16 | * MADE FREELY AVAILABLE WITHOUT CHARGE, AND CLEAR 17 | * NOTICE IS GIVEN OF THE MODIFICATIONS. Distribution 18 | * of this code as part of a commercial system is 19 | * permissible ONLY BY DIRECT ARRANGEMENT WITH THE 20 | * AUTHOR. (If you are not directly supplying this 21 | * code to a customer, and you are instead telling them 22 | * how they can obtain it for free, then you are not 23 | * required to make any arrangement with me.) 24 | * 25 | * Disclaimer: Neither I nor THE CONTRIBUTORS warrant 26 | * this code in any way whatsoever. This code is 27 | * provided "as-is" to be used at your own risk. 28 | * 29 | * THE CONTRIBUTORS include: 30 | * (a) The University of Sydney 31 | * (b) The Massachusetts Institute of Technology 32 | * (c) Columbia University 33 | * (d) The National Aeronautics & Space Administration 34 | * (e) Los Alamos National Laboratory 35 | * 36 | ------------------------------------------------------------ 37 | * 38 | * Last updated: 20 Feb., 2020 39 | * 40 | * Copyright 2013-2020 41 | * Darren Engwirda 42 | * d.engwirda@gmail.com 43 | * https://github.com/dengwirda/ 44 | * 45 | ------------------------------------------------------------ 46 | */ 47 | 48 | # pragma once 49 | 50 | # ifndef __GEOMREPS__ 51 | # define __GEOMREPS__ 52 | 53 | namespace mesh 54 | { 55 | /*-------------------------- classification of mesh feat. */ 56 | char_type constexpr null_feat = 0 ; 57 | char_type constexpr user_feat = 1 ; 58 | char_type constexpr soft_feat = 2 ; 59 | char_type constexpr hard_feat = 3 ; 60 | } 61 | 62 | # include "containers.hpp" 63 | 64 | # include "geometry.hpp" 65 | 66 | # include "aabbtree.hpp" 67 | # include "meshreps.hpp" 68 | 69 | # include "rdel_mesh/rdel_filt_k.hpp" 70 | 71 | # include "geom_reps/geom_base_2.hpp" 72 | # include "geom_reps/geom_base_3.hpp" 73 | 74 | # include "geom_reps/geom_mesh_euclidean_2.hpp" 75 | # include "geom_reps/geom_mesh_euclidean_3.hpp" 76 | 77 | # include "geom_reps/geom_mesh_ellipsoid_3.hpp" 78 | 79 | # endif//__GEOMREPS__ 80 | 81 | 82 | 83 | -------------------------------------------------------------------------------- /external/jigsaw/src/libcpp/interpolate.hpp: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | ------------------------------------------------------------ 4 | * data-structures for discrete interpolation in R^d. 5 | ------------------------------------------------------------ 6 | * 7 | * This program may be freely redistributed under the 8 | * condition that the copyright notices (including this 9 | * entire header) are not removed, and no compensation 10 | * is received through use of the software. Private, 11 | * research, and institutional use is free. You may 12 | * distribute modified versions of this code UNDER THE 13 | * CONDITION THAT THIS CODE AND ANY MODIFICATIONS MADE 14 | * TO IT IN THE SAME FILE REMAIN UNDER COPYRIGHT OF THE 15 | * ORIGINAL AUTHOR, BOTH SOURCE AND OBJECT CODE ARE 16 | * MADE FREELY AVAILABLE WITHOUT CHARGE, AND CLEAR 17 | * NOTICE IS GIVEN OF THE MODIFICATIONS. Distribution 18 | * of this code as part of a commercial system is 19 | * permissible ONLY BY DIRECT ARRANGEMENT WITH THE 20 | * AUTHOR. (If you are not directly supplying this 21 | * code to a customer, and you are instead telling them 22 | * how they can obtain it for free, then you are not 23 | * required to make any arrangement with me.) 24 | * 25 | * Disclaimer: Neither I nor THE CONTRIBUTORS warrant 26 | * this code in any way whatsoever. This code is 27 | * provided "as-is" to be used at your own risk. 28 | * 29 | * THE CONTRIBUTORS include: 30 | * (a) The University of Sydney 31 | * (b) The Massachusetts Institute of Technology 32 | * (c) Columbia University 33 | * (d) The National Aeronautics & Space Administration 34 | * (e) Los Alamos National Laboratory 35 | * 36 | ------------------------------------------------------------ 37 | * 38 | * Last updated: 30 Jun., 2019 39 | * 40 | * Copyright 2013-2019 41 | * Darren Engwirda 42 | * d.engwirda@gmail.com 43 | * https://github.com/dengwirda/ 44 | * 45 | ------------------------------------------------------------ 46 | */ 47 | 48 | # pragma once 49 | 50 | # ifndef __INTERPOLATE__ 51 | # define __INTERPOLATE__ 52 | 53 | # include "containers.hpp" 54 | # include "algorithms.hpp" 55 | 56 | # include "mathutil.hpp" 57 | # include "geometry.hpp" 58 | 59 | # include "aabbtree.hpp" 60 | # include "meshreps.hpp" 61 | 62 | # include "interpolate/hfun_base_k.hpp" 63 | # include "interpolate/hfun_clip_k.hpp" 64 | 65 | # include "interpolate/hfun_constant_value_k.hpp" 66 | 67 | # include "interpolate/hfun_mesh_euclidean_2.hpp" 68 | # include "interpolate/hfun_mesh_euclidean_3.hpp" 69 | 70 | # include "interpolate/hfun_mesh_ellipsoid_3.hpp" 71 | 72 | # include "interpolate/hfun_grid_euclidean_2.hpp" 73 | # include "interpolate/hfun_grid_euclidean_3.hpp" 74 | 75 | # include "interpolate/hfun_grid_ellipsoid_3.hpp" 76 | 77 | 78 | # endif//__INTERPOLATE__ 79 | 80 | 81 | 82 | -------------------------------------------------------------------------------- /external/jigsaw/src/libcpp/interpolate/hfun_base_k.hpp: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | -------------------------------------------------------- 4 | * HFUN-BASE-K: base class for H(x) functions. 5 | -------------------------------------------------------- 6 | * 7 | * This program may be freely redistributed under the 8 | * condition that the copyright notices (including this 9 | * entire header) are not removed, and no compensation 10 | * is received through use of the software. Private, 11 | * research, and institutional use is free. You may 12 | * distribute modified versions of this code UNDER THE 13 | * CONDITION THAT THIS CODE AND ANY MODIFICATIONS MADE 14 | * TO IT IN THE SAME FILE REMAIN UNDER COPYRIGHT OF THE 15 | * ORIGINAL AUTHOR, BOTH SOURCE AND OBJECT CODE ARE 16 | * MADE FREELY AVAILABLE WITHOUT CHARGE, AND CLEAR 17 | * NOTICE IS GIVEN OF THE MODIFICATIONS. Distribution 18 | * of this code as part of a commercial system is 19 | * permissible ONLY BY DIRECT ARRANGEMENT WITH THE 20 | * AUTHOR. (If you are not directly supplying this 21 | * code to a customer, and you are instead telling them 22 | * how they can obtain it for free, then you are not 23 | * required to make any arrangement with me.) 24 | * 25 | * Disclaimer: Neither I nor THE CONTRIBUTORS warrant 26 | * this code in any way whatsoever. This code is 27 | * provided "as-is" to be used at your own risk. 28 | * 29 | * THE CONTRIBUTORS include: 30 | * (a) The University of Sydney 31 | * (b) The Massachusetts Institute of Technology 32 | * (c) Columbia University 33 | * (d) The National Aeronautics & Space Administration 34 | * (e) Los Alamos National Laboratory 35 | * 36 | -------------------------------------------------------- 37 | * 38 | * Last updated: 30 Jun., 2019 39 | * 40 | * Copyright 2013-2019 41 | * Darren Engwirda 42 | * d.engwirda@gmail.com 43 | * https://github.com/dengwirda/ 44 | * 45 | -------------------------------------------------------- 46 | */ 47 | 48 | # pragma once 49 | 50 | # ifndef __HFUN_BASE_K__ 51 | # define __HFUN_BASE_K__ 52 | 53 | namespace mesh { 54 | 55 | template < 56 | typename I , 57 | typename R 58 | > 59 | class hfun_base_kd 60 | { 61 | public : 62 | 63 | /*-------------------- base class for size-fun in R^k */ 64 | 65 | typedef R real_type ; 66 | typedef I iptr_type ; 67 | 68 | typedef iptr_type hint_type ; 69 | 70 | __static_call 71 | __inline_call hint_type null_hint ( 72 | ) 73 | { return ( (hint_type) -1 ); 74 | } 75 | 76 | public : 77 | 78 | /*-------------------- forward dec.'s for sub-classes */ 79 | 80 | __normal_call void_type init ( 81 | ) {} 82 | 83 | __normal_call void_type clip ( 84 | ) {} 85 | 86 | __normal_call void_type eval ( 87 | real_type/*_ppos*/ , 88 | hint_type/*_hint*/ 89 | ) {} 90 | 91 | __inline_call real_type eval ( 92 | real_type *_ppos , 93 | hint_type&&_hint = null_hint () 94 | ) 95 | { return eval(_ppos, _hint); 96 | } 97 | 98 | } ; 99 | 100 | 101 | } 102 | 103 | # endif //__HFUN_BASE_K__ 104 | 105 | 106 | 107 | -------------------------------------------------------------------------------- /external/jigsaw/src/libcpp/interpolate/hfun_constant_value_k.hpp: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | -------------------------------------------------------- 4 | * HFUN-CONSTANT-VALUE-KD: uniform H(x) in R^k. 5 | -------------------------------------------------------- 6 | * 7 | * This program may be freely redistributed under the 8 | * condition that the copyright notices (including this 9 | * entire header) are not removed, and no compensation 10 | * is received through use of the software. Private, 11 | * research, and institutional use is free. You may 12 | * distribute modified versions of this code UNDER THE 13 | * CONDITION THAT THIS CODE AND ANY MODIFICATIONS MADE 14 | * TO IT IN THE SAME FILE REMAIN UNDER COPYRIGHT OF THE 15 | * ORIGINAL AUTHOR, BOTH SOURCE AND OBJECT CODE ARE 16 | * MADE FREELY AVAILABLE WITHOUT CHARGE, AND CLEAR 17 | * NOTICE IS GIVEN OF THE MODIFICATIONS. Distribution 18 | * of this code as part of a commercial system is 19 | * permissible ONLY BY DIRECT ARRANGEMENT WITH THE 20 | * AUTHOR. (If you are not directly supplying this 21 | * code to a customer, and you are instead telling them 22 | * how they can obtain it for free, then you are not 23 | * required to make any arrangement with me.) 24 | * 25 | * Disclaimer: Neither I nor THE CONTRIBUTORS warrant 26 | * this code in any way whatsoever. This code is 27 | * provided "as-is" to be used at your own risk. 28 | * 29 | * THE CONTRIBUTORS include: 30 | * (a) The University of Sydney 31 | * (b) The Massachusetts Institute of Technology 32 | * (c) Columbia University 33 | * (d) The National Aeronautics & Space Administration 34 | * (e) Los Alamos National Laboratory 35 | * 36 | -------------------------------------------------------- 37 | * 38 | * Last updated: 21 Aug., 2017 39 | * 40 | * Copyright 2013-2017 41 | * Darren Engwirda 42 | * d.engwirda@gmail.com 43 | * https://github.com/dengwirda/ 44 | * 45 | -------------------------------------------------------- 46 | */ 47 | 48 | # pragma once 49 | 50 | # ifndef __HFUN_CONSTANT_VALUE_K__ 51 | # define __HFUN_CONSTANT_VALUE_K__ 52 | 53 | namespace mesh { 54 | 55 | template < 56 | typename I , 57 | typename R 58 | > 59 | class hfun_constant_value_kd 60 | : public hfun_base_kd 61 | { 62 | public : 63 | 64 | /*--------------------------- uniform size-fun in R^k */ 65 | 66 | typedef R real_type ; 67 | typedef I iptr_type ; 68 | 69 | typedef hfun_constant_value_kd < 70 | iptr_type , 71 | real_type > hfun_type ; 72 | 73 | typedef typename hfun_base_kd < 74 | iptr_type , 75 | real_type >::hint_type hint_type ; 76 | 77 | public : 78 | 79 | real_type _hval ; 80 | 81 | public : 82 | 83 | /*--------------------------- simply return the value */ 84 | 85 | __inline_call real_type eval ( 86 | real_type *_ppos, 87 | hint_type &_hint 88 | ) 89 | { 90 | __unreferenced(_ppos) ; 91 | __unreferenced(_hint) ; 92 | 93 | return this-> _hval ; 94 | } 95 | 96 | } ; 97 | 98 | 99 | } 100 | 101 | # endif //__HFUN_CONSTANT_VALUE_K__ 102 | 103 | 104 | 105 | -------------------------------------------------------------------------------- /external/jigsaw/src/libcpp/iter_mesh/iter_divs_3.inc: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | -------------------------------------------------------- 4 | * ITER-DIVS-3: optim. schemes to split edges. 5 | -------------------------------------------------------- 6 | * 7 | * This program may be freely redistributed under the 8 | * condition that the copyright notices (including this 9 | * entire header) are not removed, and no compensation 10 | * is received through use of the software. Private, 11 | * research, and institutional use is free. You may 12 | * distribute modified versions of this code UNDER THE 13 | * CONDITION THAT THIS CODE AND ANY MODIFICATIONS MADE 14 | * TO IT IN THE SAME FILE REMAIN UNDER COPYRIGHT OF THE 15 | * ORIGINAL AUTHOR, BOTH SOURCE AND OBJECT CODE ARE 16 | * MADE FREELY AVAILABLE WITHOUT CHARGE, AND CLEAR 17 | * NOTICE IS GIVEN OF THE MODIFICATIONS. Distribution 18 | * of this code as part of a commercial system is 19 | * permissible ONLY BY DIRECT ARRANGEMENT WITH THE 20 | * AUTHOR. (If you are not directly supplying this 21 | * code to a customer, and you are instead telling them 22 | * how they can obtain it for free, then you are not 23 | * required to make any arrangement with me.) 24 | * 25 | * Disclaimer: Neither I nor THE CONTRIBUTORS warrant 26 | * this code in any way whatsoever. This code is 27 | * provided "as-is" to be used at your own risk. 28 | * 29 | * THE CONTRIBUTORS include: 30 | * (a) The University of Sydney 31 | * (b) The Massachusetts Institute of Technology 32 | * (c) Columbia University 33 | * (d) The National Aeronautics & Space Administration 34 | * (e) Los Alamos National Laboratory 35 | * 36 | -------------------------------------------------------- 37 | * 38 | * Last updated: 12 Aug., 2018 39 | * 40 | * Copyright 2013-2018 41 | * Darren Engwirda 42 | * d.engwirda@gmail.com 43 | * https://github.com/dengwirda/ 44 | * 45 | -------------------------------------------------------- 46 | */ 47 | 48 | // from iter_mesh_3.hpp 49 | 50 | 51 | /* 52 | -------------------------------------------------------- 53 | * _DIV-EDGE: try edge split to improve adj. cost-fun. 54 | -------------------------------------------------------- 55 | */ 56 | 57 | 58 | -------------------------------------------------------------------------------- /external/jigsaw/src/libcpp/iter_mesh/iter_dual_3.inc: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | -------------------------------------------------------- 4 | * ITER-DUAL-3: optim. schemes to reposition dual. 5 | -------------------------------------------------------- 6 | * 7 | * This program may be freely redistributed under the 8 | * condition that the copyright notices (including this 9 | * entire header) are not removed, and no compensation 10 | * is received through use of the software. Private, 11 | * research, and institutional use is free. You may 12 | * distribute modified versions of this code UNDER THE 13 | * CONDITION THAT THIS CODE AND ANY MODIFICATIONS MADE 14 | * TO IT IN THE SAME FILE REMAIN UNDER COPYRIGHT OF THE 15 | * ORIGINAL AUTHOR, BOTH SOURCE AND OBJECT CODE ARE 16 | * MADE FREELY AVAILABLE WITHOUT CHARGE, AND CLEAR 17 | * NOTICE IS GIVEN OF THE MODIFICATIONS. Distribution 18 | * of this code as part of a commercial system is 19 | * permissible ONLY BY DIRECT ARRANGEMENT WITH THE 20 | * AUTHOR. (If you are not directly supplying this 21 | * code to a customer, and you are instead telling them 22 | * how they can obtain it for free, then you are not 23 | * required to make any arrangement with me.) 24 | * 25 | * Disclaimer: Neither I nor THE CONTRIBUTORS warrant 26 | * this code in any way whatsoever. This code is 27 | * provided "as-is" to be used at your own risk. 28 | * 29 | * THE CONTRIBUTORS include: 30 | * (a) The University of Sydney 31 | * (b) The Massachusetts Institute of Technology 32 | * (c) Columbia University 33 | * (d) The National Aeronautics & Space Administration 34 | * (e) Los Alamos National Laboratory 35 | * 36 | -------------------------------------------------------- 37 | * 38 | * Last updated: 12 Aug., 2018 39 | * 40 | * Copyright 2013-2018 41 | * Darren Engwirda 42 | * d.engwirda@gmail.com 43 | * https://github.com/dengwirda/ 44 | * 45 | -------------------------------------------------------- 46 | */ 47 | 48 | // from iter_mesh_k.hpp 49 | 50 | 51 | 52 | -------------------------------------------------------------------------------- /external/jigsaw/src/libcpp/iter_mesh/iter_mesh_3.hpp: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | -------------------------------------------------------- 4 | * ITER-MESH-3: mesh-optimisation for 3-complexes. 5 | -------------------------------------------------------- 6 | * 7 | * This program may be freely redistributed under the 8 | * condition that the copyright notices (including this 9 | * entire header) are not removed, and no compensation 10 | * is received through use of the software. Private, 11 | * research, and institutional use is free. You may 12 | * distribute modified versions of this code UNDER THE 13 | * CONDITION THAT THIS CODE AND ANY MODIFICATIONS MADE 14 | * TO IT IN THE SAME FILE REMAIN UNDER COPYRIGHT OF THE 15 | * ORIGINAL AUTHOR, BOTH SOURCE AND OBJECT CODE ARE 16 | * MADE FREELY AVAILABLE WITHOUT CHARGE, AND CLEAR 17 | * NOTICE IS GIVEN OF THE MODIFICATIONS. Distribution 18 | * of this code as part of a commercial system is 19 | * permissible ONLY BY DIRECT ARRANGEMENT WITH THE 20 | * AUTHOR. (If you are not directly supplying this 21 | * code to a customer, and you are instead telling them 22 | * how they can obtain it for free, then you are not 23 | * required to make any arrangement with me.) 24 | * 25 | * Disclaimer: Neither I nor THE CONTRIBUTORS warrant 26 | * this code in any way whatsoever. This code is 27 | * provided "as-is" to be used at your own risk. 28 | * 29 | * THE CONTRIBUTORS include: 30 | * (a) The University of Sydney 31 | * (b) The Massachusetts Institute of Technology 32 | * (c) Columbia University 33 | * (d) The National Aeronautics & Space Administration 34 | * (e) Los Alamos National Laboratory 35 | * 36 | -------------------------------------------------------- 37 | * 38 | * Last updated: 9 Aug., 2018 39 | * 40 | * Copyright 2013-2018 41 | * Darren Engwirda 42 | * d.engwirda@gmail.com 43 | * https://github.com/dengwirda/ 44 | * 45 | -------------------------------------------------------- 46 | */ 47 | 48 | # pragma once 49 | 50 | # ifndef __ITER_MESH_3__ 51 | # define __ITER_MESH_3__ 52 | 53 | namespace mesh { 54 | 55 | /* 56 | -------------------------------------------------------- 57 | * ITER-MESH-3: hill-climbing surf. iter. 58 | -------------------------------------------------------- 59 | */ 60 | 61 | 62 | } 63 | 64 | # endif //__ITER_MESH_3__ 65 | 66 | 67 | 68 | -------------------------------------------------------------------------------- /external/jigsaw/src/libcpp/iter_mesh/iter_node_3.inc: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | -------------------------------------------------------- 4 | * ITER-NODE-3: optim. schemes to reposition nodes. 5 | -------------------------------------------------------- 6 | * 7 | * This program may be freely redistributed under the 8 | * condition that the copyright notices (including this 9 | * entire header) are not removed, and no compensation 10 | * is received through use of the software. Private, 11 | * research, and institutional use is free. You may 12 | * distribute modified versions of this code UNDER THE 13 | * CONDITION THAT THIS CODE AND ANY MODIFICATIONS MADE 14 | * TO IT IN THE SAME FILE REMAIN UNDER COPYRIGHT OF THE 15 | * ORIGINAL AUTHOR, BOTH SOURCE AND OBJECT CODE ARE 16 | * MADE FREELY AVAILABLE WITHOUT CHARGE, AND CLEAR 17 | * NOTICE IS GIVEN OF THE MODIFICATIONS. Distribution 18 | * of this code as part of a commercial system is 19 | * permissible ONLY BY DIRECT ARRANGEMENT WITH THE 20 | * AUTHOR. (If you are not directly supplying this 21 | * code to a customer, and you are instead telling them 22 | * how they can obtain it for free, then you are not 23 | * required to make any arrangement with me.) 24 | * 25 | * Disclaimer: Neither I nor THE CONTRIBUTORS warrant 26 | * this code in any way whatsoever. This code is 27 | * provided "as-is" to be used at your own risk. 28 | * 29 | * THE CONTRIBUTORS include: 30 | * (a) The University of Sydney 31 | * (b) The Massachusetts Institute of Technology 32 | * (c) Columbia University 33 | * (d) The National Aeronautics & Space Administration 34 | * (e) Los Alamos National Laboratory 35 | * 36 | -------------------------------------------------------- 37 | * 38 | * Last updated: 12 Aug., 2018 39 | * 40 | * Copyright 2013-2018 41 | * Darren Engwirda 42 | * d.engwirda@gmail.com 43 | * https://github.com/dengwirda/ 44 | * 45 | -------------------------------------------------------- 46 | */ 47 | 48 | // from iter_mesh_k.hpp 49 | 50 | 51 | 52 | -------------------------------------------------------------------------------- /external/jigsaw/src/libcpp/iter_mesh/iter_zips_3.inc: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | -------------------------------------------------------- 4 | * ITER-ZIPS-3: optim. schemes to merge nodes. 5 | -------------------------------------------------------- 6 | * 7 | * This program may be freely redistributed under the 8 | * condition that the copyright notices (including this 9 | * entire header) are not removed, and no compensation 10 | * is received through use of the software. Private, 11 | * research, and institutional use is free. You may 12 | * distribute modified versions of this code UNDER THE 13 | * CONDITION THAT THIS CODE AND ANY MODIFICATIONS MADE 14 | * TO IT IN THE SAME FILE REMAIN UNDER COPYRIGHT OF THE 15 | * ORIGINAL AUTHOR, BOTH SOURCE AND OBJECT CODE ARE 16 | * MADE FREELY AVAILABLE WITHOUT CHARGE, AND CLEAR 17 | * NOTICE IS GIVEN OF THE MODIFICATIONS. Distribution 18 | * of this code as part of a commercial system is 19 | * permissible ONLY BY DIRECT ARRANGEMENT WITH THE 20 | * AUTHOR. (If you are not directly supplying this 21 | * code to a customer, and you are instead telling them 22 | * how they can obtain it for free, then you are not 23 | * required to make any arrangement with me.) 24 | * 25 | * Disclaimer: Neither I nor THE CONTRIBUTORS warrant 26 | * this code in any way whatsoever. This code is 27 | * provided "as-is" to be used at your own risk. 28 | * 29 | * THE CONTRIBUTORS include: 30 | * (a) The University of Sydney 31 | * (b) The Massachusetts Institute of Technology 32 | * (c) Columbia University 33 | * (d) The National Aeronautics & Space Administration 34 | * (e) Los Alamos National Laboratory 35 | * 36 | -------------------------------------------------------- 37 | * 38 | * Last updated: 12 Aug., 2018 39 | * 40 | * Copyright 2013-2018 41 | * Darren Engwirda 42 | * d.engwirda@gmail.com 43 | * https://github.com/dengwirda/ 44 | * 45 | -------------------------------------------------------- 46 | */ 47 | 48 | // from iter_mesh_3.hpp 49 | 50 | 51 | 52 | 53 | -------------------------------------------------------------------------------- /external/jigsaw/src/libcpp/itermesh.hpp: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | ------------------------------------------------------------ 4 | * methods for iterative mesh optimisation in R^d. 5 | ------------------------------------------------------------ 6 | * 7 | * This program may be freely redistributed under the 8 | * condition that the copyright notices (including this 9 | * entire header) are not removed, and no compensation 10 | * is received through use of the software. Private, 11 | * research, and institutional use is free. You may 12 | * distribute modified versions of this code UNDER THE 13 | * CONDITION THAT THIS CODE AND ANY MODIFICATIONS MADE 14 | * TO IT IN THE SAME FILE REMAIN UNDER COPYRIGHT OF THE 15 | * ORIGINAL AUTHOR, BOTH SOURCE AND OBJECT CODE ARE 16 | * MADE FREELY AVAILABLE WITHOUT CHARGE, AND CLEAR 17 | * NOTICE IS GIVEN OF THE MODIFICATIONS. Distribution 18 | * of this code as part of a commercial system is 19 | * permissible ONLY BY DIRECT ARRANGEMENT WITH THE 20 | * AUTHOR. (If you are not directly supplying this 21 | * code to a customer, and you are instead telling them 22 | * how they can obtain it for free, then you are not 23 | * required to make any arrangement with me.) 24 | * 25 | * Disclaimer: Neither I nor THE CONTRIBUTORS warrant 26 | * this code in any way whatsoever. This code is 27 | * provided "as-is" to be used at your own risk. 28 | * 29 | * THE CONTRIBUTORS include: 30 | * (a) The University of Sydney 31 | * (b) The Massachusetts Institute of Technology 32 | * (c) Columbia University 33 | * (d) The National Aeronautics & Space Administration 34 | * (e) Los Alamos National Laboratory 35 | * 36 | ------------------------------------------------------------ 37 | * 38 | * Last updated: 02 Mar., 2019 39 | * 40 | * Copyright 2013-2019 41 | * Darren Engwirda 42 | * d.engwirda@gmail.com 43 | * https://github.com/dengwirda/ 44 | * 45 | ------------------------------------------------------------ 46 | */ 47 | 48 | # pragma once 49 | 50 | # ifndef __ITERMESH__ 51 | # define __ITERMESH__ 52 | 53 | # include "containers.hpp" 54 | # include "algorithms.hpp" 55 | 56 | # include "geometry.hpp" 57 | 58 | # include "geomreps.hpp" 59 | # include "meshreps.hpp" 60 | 61 | # include "interpolate.hpp" 62 | 63 | # include "iter_mesh/iter_timers.hpp" 64 | 65 | # include "iter_mesh/iter_mesh_euclidean_2.hpp" 66 | # include "iter_mesh/iter_mesh_euclidean_3.hpp" 67 | 68 | # include "iter_mesh/iter_pred_euclidean_2.hpp" 69 | // include "iter_mesh/iter_pred_euclidean_3.hpp" 70 | # include "iter_mesh/iter_pred_ellipsoid_3.hpp" 71 | 72 | # include "iter_mesh/iter_mesh_2.hpp" 73 | # include "iter_mesh/iter_mesh_3.hpp" 74 | 75 | # endif//__ITERMESH__ 76 | 77 | 78 | 79 | -------------------------------------------------------------------------------- /external/jigsaw/src/libcpp/meshreps.hpp: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | ------------------------------------------------------------ 4 | * data-structures for discrete complexes in R^d. 5 | ------------------------------------------------------------ 6 | * 7 | * This program may be freely redistributed under the 8 | * condition that the copyright notices (including this 9 | * entire header) are not removed, and no compensation 10 | * is received through use of the software. Private, 11 | * research, and institutional use is free. You may 12 | * distribute modified versions of this code UNDER THE 13 | * CONDITION THAT THIS CODE AND ANY MODIFICATIONS MADE 14 | * TO IT IN THE SAME FILE REMAIN UNDER COPYRIGHT OF THE 15 | * ORIGINAL AUTHOR, BOTH SOURCE AND OBJECT CODE ARE 16 | * MADE FREELY AVAILABLE WITHOUT CHARGE, AND CLEAR 17 | * NOTICE IS GIVEN OF THE MODIFICATIONS. Distribution 18 | * of this code as part of a commercial system is 19 | * permissible ONLY BY DIRECT ARRANGEMENT WITH THE 20 | * AUTHOR. (If you are not directly supplying this 21 | * code to a customer, and you are instead telling them 22 | * how they can obtain it for free, then you are not 23 | * required to make any arrangement with me.) 24 | * 25 | * Disclaimer: Neither I nor THE CONTRIBUTORS warrant 26 | * this code in any way whatsoever. This code is 27 | * provided "as-is" to be used at your own risk. 28 | * 29 | * THE CONTRIBUTORS include: 30 | * (a) The University of Sydney 31 | * (b) The Massachusetts Institute of Technology 32 | * (c) Columbia University 33 | * (d) The National Aeronautics & Space Administration 34 | * (e) Los Alamos National Laboratory 35 | * 36 | ------------------------------------------------------------ 37 | * 38 | * Last updated: 01 Sept., 2021 39 | * 40 | * Copyright 2013-2021 41 | * Darren Engwirda 42 | * d.engwirda@gmail.com 43 | * https://github.com/dengwirda/ 44 | * 45 | ------------------------------------------------------------ 46 | */ 47 | 48 | # pragma once 49 | 50 | # ifndef __MESHREPS__ 51 | # define __MESHREPS__ 52 | 53 | namespace mesh 54 | { 55 | /*-------------------------- classification of mesh cells */ 56 | char_type constexpr EMPTY_tag = +0 ; 57 | char_type constexpr 58 | POINT_tag = JIGSAW_POINT_TAG ; 59 | char_type constexpr 60 | EDGE2_tag = JIGSAW_EDGE2_TAG ; 61 | char_type constexpr 62 | TRIA3_tag = JIGSAW_TRIA3_TAG ; 63 | char_type constexpr 64 | QUAD4_tag = JIGSAW_QUAD4_TAG ; 65 | char_type constexpr 66 | TRIA4_tag = JIGSAW_TRIA4_TAG ; 67 | char_type constexpr 68 | HEXA8_tag = JIGSAW_HEXA8_TAG ; 69 | char_type constexpr 70 | WEDG6_tag = JIGSAW_WEDG6_TAG ; 71 | char_type constexpr 72 | PYRA5_tag = JIGSAW_PYRA5_TAG ; 73 | } 74 | 75 | # include "containers.hpp" 76 | 77 | # include "hashfunc.hpp" 78 | 79 | # include "mesh_reps/mesh_complex_type_k.hpp" 80 | 81 | # include "mesh_reps/hash_complex_k.hpp" 82 | # include "mesh_reps/base_complex_k.hpp" 83 | 84 | # include "mesh_reps/tria_complex_1.hpp" 85 | # include "mesh_reps/tria_complex_2.hpp" 86 | # include "mesh_reps/tria_complex_3.hpp" 87 | 88 | # include "mesh_reps/mesh_complex_1.hpp" 89 | # include "mesh_reps/mesh_complex_2.hpp" 90 | # include "mesh_reps/mesh_complex_3.hpp" 91 | 92 | # endif//__MESHREPS__ 93 | 94 | 95 | 96 | -------------------------------------------------------------------------------- /external/jigsaw/src/libcpp/mpfloats.hpp: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | ------------------------------------------------------------ 4 | * robust multi-precision floating-point expansions... 5 | ------------------------------------------------------------ 6 | * 7 | * This program may be freely redistributed under the 8 | * condition that the copyright notices (including this 9 | * entire header) are not removed, and no compensation 10 | * is received through use of the software. Private, 11 | * research, and institutional use is free. You may 12 | * distribute modified versions of this code UNDER THE 13 | * CONDITION THAT THIS CODE AND ANY MODIFICATIONS MADE 14 | * TO IT IN THE SAME FILE REMAIN UNDER COPYRIGHT OF THE 15 | * ORIGINAL AUTHOR, BOTH SOURCE AND OBJECT CODE ARE 16 | * MADE FREELY AVAILABLE WITHOUT CHARGE, AND CLEAR 17 | * NOTICE IS GIVEN OF THE MODIFICATIONS. Distribution 18 | * of this code as part of a commercial system is 19 | * permissible ONLY BY DIRECT ARRANGEMENT WITH THE 20 | * AUTHOR. (If you are not directly supplying this 21 | * code to a customer, and you are instead telling them 22 | * how they can obtain it for free, then you are not 23 | * required to make any arrangement with me.) 24 | * 25 | * Disclaimer: Neither I nor THE CONTRIBUTORS warrant 26 | * this code in any way whatsoever. This code is 27 | * provided "as-is" to be used at your own risk. 28 | * 29 | * THE CONTRIBUTORS include: 30 | * (a) The University of Sydney 31 | * (b) The Massachusetts Institute of Technology 32 | * (c) Columbia University 33 | * (d) The National Aeronautics & Space Administration 34 | * (e) Los Alamos National Laboratory 35 | * 36 | ------------------------------------------------------------ 37 | * 38 | * Last updated: 11 Apr., 2020 39 | * 40 | * Copyright 2020-- 41 | * Darren Engwirda 42 | * d.engwirda@gmail.com 43 | * https://github.com/dengwirda/ 44 | * 45 | ------------------------------------------------------------ 46 | */ 47 | 48 | # pragma once 49 | 50 | # ifndef __MP_FLOATS__ 51 | # define __MP_FLOATS__ 52 | 53 | # include "basebase.hpp" 54 | 55 | namespace mp_float 56 | { 57 | typedef double real_type; 58 | typedef int indx_type; 59 | } 60 | 61 | # include 62 | # include 63 | # include 64 | 65 | // pragma STDC FENV_ACCESS ON 66 | 67 | # include "expansion/dd_float.hpp" 68 | # include "expansion/ia_float.hpp" 69 | # include "expansion/mp_float.hpp" 70 | 71 | # include "expansion/mp_utils.hpp" 72 | 73 | # endif//__MP_FLOATS__ 74 | 75 | 76 | 77 | -------------------------------------------------------------------------------- /external/jigsaw/src/libcpp/rdel_mesh/rdel_pred_delfront_2.hpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dengwirda/jigsaw-python/5729a380039c4df5de484cb9ec331e14b16e7c55/external/jigsaw/src/libcpp/rdel_mesh/rdel_pred_delfront_2.hpp -------------------------------------------------------------------------------- /external/jigsaw/src/libcpp/rdel_mesh/rdel_pred_delfront_3.hpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dengwirda/jigsaw-python/5729a380039c4df5de484cb9ec331e14b16e7c55/external/jigsaw/src/libcpp/rdel_mesh/rdel_pred_delfront_3.hpp -------------------------------------------------------------------------------- /external/jigsaw/src/libcpp/rdel_mesh/rdel_timers.hpp: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | -------------------------------------------------------- 4 | * RDEL-TIMERS: CPU timers for RDEL-MESH-K. 5 | -------------------------------------------------------- 6 | * 7 | * This program may be freely redistributed under the 8 | * condition that the copyright notices (including this 9 | * entire header) are not removed, and no compensation 10 | * is received through use of the software. Private, 11 | * research, and institutional use is free. You may 12 | * distribute modified versions of this code UNDER THE 13 | * CONDITION THAT THIS CODE AND ANY MODIFICATIONS MADE 14 | * TO IT IN THE SAME FILE REMAIN UNDER COPYRIGHT OF THE 15 | * ORIGINAL AUTHOR, BOTH SOURCE AND OBJECT CODE ARE 16 | * MADE FREELY AVAILABLE WITHOUT CHARGE, AND CLEAR 17 | * NOTICE IS GIVEN OF THE MODIFICATIONS. Distribution 18 | * of this code as part of a commercial system is 19 | * permissible ONLY BY DIRECT ARRANGEMENT WITH THE 20 | * AUTHOR. (If you are not directly supplying this 21 | * code to a customer, and you are instead telling them 22 | * how they can obtain it for free, then you are not 23 | * required to make any arrangement with me.) 24 | * 25 | * Disclaimer: Neither I nor THE CONTRIBUTORS warrant 26 | * this code in any way whatsoever. This code is 27 | * provided "as-is" to be used at your own risk. 28 | * 29 | * THE CONTRIBUTORS include: 30 | * (a) The University of Sydney 31 | * (b) The Massachusetts Institute of Technology 32 | * (c) Columbia University 33 | * (d) The National Aeronautics & Space Administration 34 | * (e) Los Alamos National Laboratory 35 | * 36 | -------------------------------------------------------- 37 | * 38 | * Last updated: 20 Jul., 2022 39 | * 40 | * Copyright 2013-2022 41 | * Darren Engwirda 42 | * d.engwirda@gmail.com 43 | * https://github.com/dengwirda/ 44 | * 45 | -------------------------------------------------------- 46 | */ 47 | 48 | # pragma once 49 | 50 | # ifndef __RDEL_TIMERS__ 51 | # define __RDEL_TIMERS__ 52 | 53 | namespace mesh { 54 | 55 | /* 56 | -------------------------------------------------------- 57 | * RDEL-TIMERS: cpu timers for RDEL-MESH-K 58 | -------------------------------------------------------- 59 | */ 60 | 61 | class rdel_timers 62 | { 63 | public : 64 | double _mesh_seed = (double ) +0. ; 65 | 66 | double _node_init = (double ) +0. ; 67 | double _node_rule = (double ) +0. ; 68 | double _edge_init = (double ) +0. ; 69 | double _edge_rule = (double ) +0. ; 70 | double _face_init = (double ) +0. ; 71 | double _face_rule = (double ) +0. ; 72 | double _tria_init = (double ) +0. ; 73 | double _tria_rule = (double ) +0. ; 74 | 75 | double _list_trim = (double ) +0. ; 76 | 77 | double _topo_init = (double ) +0. ; 78 | 79 | public : 80 | 81 | /*-------------------------------------- elapsed time */ 82 | 83 | # ifdef __use_timers 84 | 85 | __static_call 86 | __inline_call double time_span ( 87 | typename std:: 88 | chrono::high_resolution_clock 89 | ::time_point const& _ttic, 90 | typename std:: 91 | chrono::high_resolution_clock 92 | ::time_point const& _ttoc 93 | ) 94 | { 95 | return (double)( 96 | std::chrono::duration_cast< 97 | std::chrono::microseconds > 98 | (_ttoc-_ttic).count()) / +1.0E+06 ; 99 | } 100 | 101 | __static_call 102 | __inline_call double nano_span ( 103 | typename std:: 104 | chrono::high_resolution_clock 105 | ::time_point const& _ttic, 106 | typename std:: 107 | chrono::high_resolution_clock 108 | ::time_point const& _ttoc 109 | ) 110 | { 111 | return (double)( 112 | std::chrono::duration_cast< 113 | std::chrono:: nanoseconds > 114 | (_ttoc-_ttic).count()) / +1.0E+09 ; 115 | } 116 | 117 | # endif//__use_timers 118 | 119 | } ; 120 | 121 | } 122 | 123 | # endif // __RDEL_TIMERS__ 124 | 125 | 126 | 127 | -------------------------------------------------------------------------------- /external/jigsaw/src/libcpp/rdelmesh.hpp: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | ------------------------------------------------------------ 4 | * restricted delaunay mesh generation in R^d. 5 | ------------------------------------------------------------ 6 | * 7 | * This program may be freely redistributed under the 8 | * condition that the copyright notices (including this 9 | * entire header) are not removed, and no compensation 10 | * is received through use of the software. Private, 11 | * research, and institutional use is free. You may 12 | * distribute modified versions of this code UNDER THE 13 | * CONDITION THAT THIS CODE AND ANY MODIFICATIONS MADE 14 | * TO IT IN THE SAME FILE REMAIN UNDER COPYRIGHT OF THE 15 | * ORIGINAL AUTHOR, BOTH SOURCE AND OBJECT CODE ARE 16 | * MADE FREELY AVAILABLE WITHOUT CHARGE, AND CLEAR 17 | * NOTICE IS GIVEN OF THE MODIFICATIONS. Distribution 18 | * of this code as part of a commercial system is 19 | * permissible ONLY BY DIRECT ARRANGEMENT WITH THE 20 | * AUTHOR. (If you are not directly supplying this 21 | * code to a customer, and you are instead telling them 22 | * how they can obtain it for free, then you are not 23 | * required to make any arrangement with me.) 24 | * 25 | * Disclaimer: Neither I nor THE CONTRIBUTORS warrant 26 | * this code in any way whatsoever. This code is 27 | * provided "as-is" to be used at your own risk. 28 | * 29 | * THE CONTRIBUTORS include: 30 | * (a) The University of Sydney 31 | * (b) The Massachusetts Institute of Technology 32 | * (c) Columbia University 33 | * (d) The National Aeronautics & Space Administration 34 | * (e) Los Alamos National Laboratory 35 | * 36 | ------------------------------------------------------------ 37 | * 38 | * Last updated: 18 Aug., 2021 39 | * 40 | * Copyright 2013-2021 41 | * Darren Engwirda 42 | * d.engwirda@gmail.com 43 | * https://github.com/dengwirda/ 44 | * 45 | ------------------------------------------------------------ 46 | */ 47 | 48 | # pragma once 49 | 50 | # ifndef __RDELMESH__ 51 | # define __RDELMESH__ 52 | 53 | namespace mesh 54 | { 55 | /*-------------------------- classification of mesh cells */ 56 | char_type constexpr null_item = 0 ; 57 | char_type constexpr void_item = 1 ; 58 | char_type constexpr ring_item = 2 ; 59 | char_type constexpr good_item = 3 ; 60 | 61 | char_type constexpr null_ball = 0 ; 62 | char_type constexpr feat_ball = 1 ; 63 | 64 | char_type constexpr filt_topo = 0 ; 65 | char_type constexpr full_topo = 1 ; 66 | } 67 | 68 | # include "containers.hpp" 69 | # include "algorithms.hpp" 70 | 71 | # include "geometry.hpp" 72 | # include "hashfunc.hpp" 73 | 74 | # include "tessellate.hpp" 75 | 76 | # include "geomreps.hpp" 77 | # include "meshreps.hpp" 78 | 79 | # include "interpolate.hpp" 80 | 81 | # include "rdel_mesh/rdel_complex_2.hpp" 82 | # include "rdel_mesh/rdel_complex_3.hpp" 83 | 84 | # include "rdel_mesh/rdel_timers.hpp" 85 | 86 | # include "rdel_mesh/rdel_filt_k.hpp" 87 | 88 | # include "rdel_mesh/rdel_base_2.hpp" 89 | # include "rdel_mesh/rdel_base_3.hpp" 90 | 91 | # include "rdel_mesh/rdel_pred_delaunay_2.hpp" 92 | # include "rdel_mesh/rdel_pred_delaunay_3.hpp" 93 | 94 | # include "rdel_mesh/rdel_pred_delfront_2.hpp" 95 | # include "rdel_mesh/rdel_pred_delfront_3.hpp" 96 | 97 | # include "rdel_mesh/rdel_mesh_2.hpp" 98 | # include "rdel_mesh/rdel_mesh_3.hpp" 99 | 100 | # include "rdel_mesh/rdel_make_2.hpp" 101 | # include "rdel_mesh/rdel_make_3.hpp" 102 | 103 | // include "rdel_mesh/rvor_mesh_2.hpp" 104 | // include "rdel_mesh/rvor_mesh_3.hpp" 105 | 106 | # endif//__RDELMESH__ 107 | 108 | 109 | 110 | -------------------------------------------------------------------------------- /external/jigsaw/src/libcpp/tessellate.hpp: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | ------------------------------------------------------------ 4 | * algorithms for delaunay tessellation in R^d. 5 | ------------------------------------------------------------ 6 | * 7 | * This program may be freely redistributed under the 8 | * condition that the copyright notices (including this 9 | * entire header) are not removed, and no compensation 10 | * is received through use of the software. Private, 11 | * research, and institutional use is free. You may 12 | * distribute modified versions of this code UNDER THE 13 | * CONDITION THAT THIS CODE AND ANY MODIFICATIONS MADE 14 | * TO IT IN THE SAME FILE REMAIN UNDER COPYRIGHT OF THE 15 | * ORIGINAL AUTHOR, BOTH SOURCE AND OBJECT CODE ARE 16 | * MADE FREELY AVAILABLE WITHOUT CHARGE, AND CLEAR 17 | * NOTICE IS GIVEN OF THE MODIFICATIONS. Distribution 18 | * of this code as part of a commercial system is 19 | * permissible ONLY BY DIRECT ARRANGEMENT WITH THE 20 | * AUTHOR. (If you are not directly supplying this 21 | * code to a customer, and you are instead telling them 22 | * how they can obtain it for free, then you are not 23 | * required to make any arrangement with me.) 24 | * 25 | * Disclaimer: Neither I nor THE CONTRIBUTORS warrant 26 | * this code in any way whatsoever. This code is 27 | * provided "as-is" to be used at your own risk. 28 | * 29 | * THE CONTRIBUTORS include: 30 | * (a) The University of Sydney 31 | * (b) The Massachusetts Institute of Technology 32 | * (c) Columbia University 33 | * (d) The National Aeronautics & Space Administration 34 | * (e) Los Alamos National Laboratory 35 | * 36 | ------------------------------------------------------------ 37 | * 38 | * Last updated: 21 Apr., 2021 39 | * 40 | * Copyright 2013-2021 41 | * Darren Engwirda 42 | * d.engwirda@gmail.com 43 | * https://github.com/dengwirda/ 44 | * 45 | ------------------------------------------------------------ 46 | */ 47 | 48 | # pragma once 49 | 50 | # ifndef __TESSELLATE__ 51 | # define __TESSELLATE__ 52 | 53 | # include "containers.hpp" 54 | # include "algorithms.hpp" 55 | 56 | # include "hashfunc.hpp" 57 | # include "geometry.hpp" 58 | 59 | # include "tessellate/delaunay_tri_type_2.hpp" 60 | # include "tessellate/delaunay_tri_type_3.hpp" 61 | // include "tessellate/delaunay_tri_type_4.hpp" 62 | 63 | # include "tessellate/delaunay_tri_k.hpp" 64 | 65 | # include "tessellate/delaunay_tri_pred_2.hpp" 66 | # include "tessellate/delaunay_tri_pred_3.hpp" 67 | // include "tessellate/delaunay_tri_pred_4.hpp" 68 | 69 | # include "tessellate/laguerre_tri_pred_2.hpp" 70 | # include "tessellate/laguerre_tri_pred_3.hpp" 71 | // include "tessellate/laguerre_tri_pred_4.hpp" 72 | 73 | # endif//__TESSELLATE__ 74 | 75 | 76 | 77 | -------------------------------------------------------------------------------- /external/jigsaw/src/libcpp/tessellate/delaunay_scan_tria.inc: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | -------------------------------------------------------- 4 | * SCAN-TRIA-LIST: breadth-first-search about tria. 5 | -------------------------------------------------------- 6 | * 7 | * This program may be freely redistributed under the 8 | * condition that the copyright notices (including this 9 | * entire header) are not removed, and no compensation 10 | * is received through use of the software. Private, 11 | * research, and institutional use is free. You may 12 | * distribute modified versions of this code UNDER THE 13 | * CONDITION THAT THIS CODE AND ANY MODIFICATIONS MADE 14 | * TO IT IN THE SAME FILE REMAIN UNDER COPYRIGHT OF THE 15 | * ORIGINAL AUTHOR, BOTH SOURCE AND OBJECT CODE ARE 16 | * MADE FREELY AVAILABLE WITHOUT CHARGE, AND CLEAR 17 | * NOTICE IS GIVEN OF THE MODIFICATIONS. Distribution 18 | * of this code as part of a commercial system is 19 | * permissible ONLY BY DIRECT ARRANGEMENT WITH THE 20 | * AUTHOR. (If you are not directly supplying this 21 | * code to a customer, and you are instead telling them 22 | * how they can obtain it for free, then you are not 23 | * required to make any arrangement with me.) 24 | * 25 | * Disclaimer: Neither I nor THE CONTRIBUTORS warrant 26 | * this code in any way whatsoever. This code is 27 | * provided "as-is" to be used at your own risk. 28 | * 29 | * THE CONTRIBUTORS include: 30 | * (a) The University of Sydney 31 | * (b) The Massachusetts Institute of Technology 32 | * (c) Columbia University 33 | * (d) The National Aeronautics & Space Administration 34 | * (e) Los Alamos National Laboratory 35 | * 36 | -------------------------------------------------------- 37 | * 38 | * Last updated: 17 Mar., 2018 39 | * 40 | * Copyright 2013-2018 41 | * Darren Engwirda 42 | * d.engwirda@gmail.com 43 | * https://github.com/dengwirda/ 44 | * 45 | -------------------------------------------------------- 46 | */ 47 | 48 | // from delaunay_tri_k.hpp 49 | 50 | 51 | /* 52 | -------------------------------------------------------- 53 | * SCAN-TRIA-LIST: breadth-first-search about tria. 54 | -------------------------------------------------------- 55 | */ 56 | 57 | template < 58 | typename func_type 59 | > 60 | __normal_call void_type scan_tria_list ( 61 | iptr_type _elem, 62 | char_type _flag, 63 | func_type &_pred, 64 | iptr_list &_list 65 | ) 66 | { 67 | _list.push_tail(_elem); 68 | 69 | __mark(_elem)+= _flag ; 70 | 71 | /*--------- traversal about _elem while _pred is true */ 72 | for (typename iptr_list:: 73 | size_type _iter = +0 ; 74 | _iter != _list.count(); ++_iter) 75 | { 76 | /*--------- scan all faces within current element */ 77 | for(iptr_type _fpos = tria_pred::topo_dims + 1; 78 | _fpos-- != +0 ; ) 79 | { 80 | /*--------- find neighbour about current edge */ 81 | iptr_type _tadj, _fadj , _fmrk; 82 | find_pair( _list[ _iter], _tadj, 83 | _fpos, _fadj, _fmrk); 84 | 85 | /*---------------------- skip if null or seen */ 86 | if (_tadj == this->null_flag()) 87 | continue ; 88 | if (__mark(_tadj) >= _flag ) 89 | continue ; 90 | 91 | /*--------- push neighbour when _pred is true */ 92 | if (_pred(*this, _tadj, _fadj)) 93 | { 94 | __mark(_tadj)+= _flag ; 95 | _list.push_tail(_tadj); 96 | } 97 | } 98 | } 99 | 100 | /*------------------------------ need for degeneracy? */ 101 | algorithms::qsort(_list.head(), 102 | _list.tend(), 103 | std::less()) ; 104 | 105 | /*------------------------------ unmark list of trias */ 106 | for (typename iptr_list:: 107 | size_type _iter = +0 ; 108 | _iter != _list.count(); ++_iter) 109 | { 110 | __mark( _list[_iter]) -=_flag ; 111 | } 112 | } 113 | 114 | 115 | 116 | -------------------------------------------------------------------------------- /external/jigsaw/src/libcpp/useropts.hpp: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | ------------------------------------------------------------ 4 | * user-defined options for back-end kernels. 5 | ------------------------------------------------------------ 6 | * 7 | * This program may be freely redistributed under the 8 | * condition that the copyright notices (including this 9 | * entire header) are not removed, and no compensation 10 | * is received through use of the software. Private, 11 | * research, and institutional use is free. You may 12 | * distribute modified versions of this code UNDER THE 13 | * CONDITION THAT THIS CODE AND ANY MODIFICATIONS MADE 14 | * TO IT IN THE SAME FILE REMAIN UNDER COPYRIGHT OF THE 15 | * ORIGINAL AUTHOR, BOTH SOURCE AND OBJECT CODE ARE 16 | * MADE FREELY AVAILABLE WITHOUT CHARGE, AND CLEAR 17 | * NOTICE IS GIVEN OF THE MODIFICATIONS. Distribution 18 | * of this code as part of a commercial system is 19 | * permissible ONLY BY DIRECT ARRANGEMENT WITH THE 20 | * AUTHOR. (If you are not directly supplying this 21 | * code to a customer, and you are instead telling them 22 | * how they can obtain it for free, then you are not 23 | * required to make any arrangement with me.) 24 | * 25 | * Disclaimer: Neither I nor THE CONTRIBUTORS warrant 26 | * this code in any way whatsoever. This code is 27 | * provided "as-is" to be used at your own risk. 28 | * 29 | * THE CONTRIBUTORS include: 30 | * (a) The University of Sydney 31 | * (b) The Massachusetts Institute of Technology 32 | * (c) Columbia University 33 | * (d) The National Aeronautics & Space Administration 34 | * (e) Los Alamos National Laboratory 35 | * 36 | ------------------------------------------------------------ 37 | * 38 | * Last updated: 27 Nov., 2019 39 | * 40 | * Copyright 2013-2019 41 | * Darren Engwirda 42 | * d.engwirda@gmail.com 43 | * https://github.com/dengwirda/ 44 | * 45 | ------------------------------------------------------------ 46 | */ 47 | 48 | # pragma once 49 | 50 | # ifndef __PARAMETERS__ 51 | # define __PARAMETERS__ 52 | 53 | # include "parameters/mesh_params.hpp" 54 | # include "parameters/iter_params.hpp" 55 | 56 | # endif//__PARAMETERS__ 57 | 58 | 59 | 60 | -------------------------------------------------------------------------------- /external/jigsaw/src/liblib/save_msh_t.hpp: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | -------------------------------------------------------- 4 | * SAVE-MSH_T: save msh_t for lib_jigsaw. 5 | -------------------------------------------------------- 6 | * 7 | * This program may be freely redistributed under the 8 | * condition that the copyright notices (including this 9 | * entire header) are not removed, and no compensation 10 | * is received through use of the software. Private, 11 | * research, and institutional use is free. You may 12 | * distribute modified versions of this code UNDER THE 13 | * CONDITION THAT THIS CODE AND ANY MODIFICATIONS MADE 14 | * TO IT IN THE SAME FILE REMAIN UNDER COPYRIGHT OF THE 15 | * ORIGINAL AUTHOR, BOTH SOURCE AND OBJECT CODE ARE 16 | * MADE FREELY AVAILABLE WITHOUT CHARGE, AND CLEAR 17 | * NOTICE IS GIVEN OF THE MODIFICATIONS. Distribution 18 | * of this code as part of a commercial system is 19 | * permissible ONLY BY DIRECT ARRANGEMENT WITH THE 20 | * AUTHOR. (If you are not directly supplying this 21 | * code to a customer, and you are instead telling them 22 | * how they can obtain it for free, then you are not 23 | * required to make any arrangement with me.) 24 | * 25 | * Disclaimer: Neither I nor THE CONTRIBUTORS warrant 26 | * this code in any way whatsoever. This code is 27 | * provided "as-is" to be used at your own risk. 28 | * 29 | * THE CONTRIBUTORS include: 30 | * (a) The University of Sydney 31 | * (b) The Massachusetts Institute of Technology 32 | * (c) Columbia University 33 | * (d) The National Aeronautics & Space Administration 34 | * (e) Los Alamos National Laboratory 35 | * 36 | -------------------------------------------------------- 37 | * 38 | * Last updated: 06 Jun., 2018 39 | * 40 | * Copyright 2013-2018 41 | * Darren Engwirda 42 | * d.engwirda@gmail.com 43 | * https://github.com/dengwirda/ 44 | * 45 | -------------------------------------------------------- 46 | */ 47 | 48 | # pragma once 49 | 50 | # ifndef __SAVE_MSH_T__ 51 | # define __SAVE_MSH_T__ 52 | 53 | /* 54 | -------------------------------------------------------- 55 | * SAVE-MSH_T: save msh_t for lib_jigsaw. 56 | -------------------------------------------------------- 57 | */ 58 | 59 | # ifdef __lib_jigsaw 60 | 61 | indx_t jigsaw_save_msh_t ( // save msh_t 62 | char *_fchr, 63 | jigsaw_msh_t *_jmsh 64 | ) 65 | { 66 | iptr_type _errv = __no_error ; 67 | 68 | __unreferenced(_fchr) ; 69 | __unreferenced(_jmsh) ; 70 | 71 | //!! TODO 72 | 73 | 74 | return _errv ; 75 | } 76 | 77 | # endif//__lib_jigsaw 78 | 79 | # endif 80 | 81 | 82 | 83 | -------------------------------------------------------------------------------- /external/jigsaw/src/msh_save.hpp: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | -------------------------------------------------------- 4 | * MSH-SAVE: parse MESH data into *.MSH / MSH_t. 5 | -------------------------------------------------------- 6 | * 7 | * This program may be freely redistributed under the 8 | * condition that the copyright notices (including this 9 | * entire header) are not removed, and no compensation 10 | * is received through use of the software. Private, 11 | * research, and institutional use is free. You may 12 | * distribute modified versions of this code UNDER THE 13 | * CONDITION THAT THIS CODE AND ANY MODIFICATIONS MADE 14 | * TO IT IN THE SAME FILE REMAIN UNDER COPYRIGHT OF THE 15 | * ORIGINAL AUTHOR, BOTH SOURCE AND OBJECT CODE ARE 16 | * MADE FREELY AVAILABLE WITHOUT CHARGE, AND CLEAR 17 | * NOTICE IS GIVEN OF THE MODIFICATIONS. Distribution 18 | * of this code as part of a commercial system is 19 | * permissible ONLY BY DIRECT ARRANGEMENT WITH THE 20 | * AUTHOR. (If you are not directly supplying this 21 | * code to a customer, and you are instead telling them 22 | * how they can obtain it for free, then you are not 23 | * required to make any arrangement with me.) 24 | * 25 | * Disclaimer: Neither I nor THE CONTRIBUTORS warrant 26 | * this code in any way whatsoever. This code is 27 | * provided "as-is" to be used at your own risk. 28 | * 29 | * THE CONTRIBUTORS include: 30 | * (a) The University of Sydney 31 | * (b) The Massachusetts Institute of Technology 32 | * (c) Columbia University 33 | * (d) The National Aeronautics & Space Administration 34 | * (e) Los Alamos National Laboratory 35 | * 36 | -------------------------------------------------------- 37 | * 38 | * Last updated: 28 May, 2022 39 | * 40 | * Copyright 2013-2022 41 | * Darren Engwirda 42 | * d.engwirda@gmail.com 43 | * https://github.com/dengwirda/ 44 | * 45 | -------------------------------------------------------- 46 | */ 47 | 48 | # pragma once 49 | 50 | # ifndef __MSH_SAVE__ 51 | # define __MSH_SAVE__ 52 | 53 | class mshfile_tag {} ; 54 | class _netcdf_tag {} ; 55 | 56 | /* 57 | -------------------------------------------------------- 58 | * for C-style sprintf to C++ stream. 59 | -------------------------------------------------------- 60 | */ 61 | 62 | # define PRINTCHUNK (+32768) 63 | 64 | # define VERT2CHUNK (+ 512 ) 65 | # define VERT3CHUNK (+ 320 ) 66 | 67 | # define VALUECHUNK (+1024 ) 68 | 69 | # define EDGE2CHUNK (+ 832 ) 70 | # define TRIA3CHUNK (+ 640 ) 71 | # define QUAD4CHUNK (+ 512 ) 72 | # define TRIA4CHUNK (+ 512 ) 73 | # define HEXA8CHUNK (+ 288 ) 74 | # define WEDG6CHUNK (+ 352 ) 75 | # define PYRA5CHUNK (+ 416 ) 76 | 77 | # define BOUNDCHUNK (+ 832 ) 78 | 79 | # define PRINTFINAL \ 80 | { \ 81 | _fbuf[_next] ='\0'; \ 82 | _file << _fbuf; \ 83 | _roll = _next = 0 ; \ 84 | } 85 | 86 | # define PRINTCHARS(_char, _size) \ 87 | { \ 88 | _next += _char; \ 89 | \ 90 | if ((_roll++) >= _size) \ 91 | { \ 92 | PRINTFINAL ; \ 93 | } \ 94 | } 95 | 96 | /* 97 | -------------------------------------------------------- 98 | * inc. low-level file write kernels. 99 | -------------------------------------------------------- 100 | */ 101 | 102 | # include "rdt_save.inc" 103 | # include "tri_save.inc" 104 | # include "msh_save.inc" 105 | # include "hfn_save.inc" 106 | 107 | 108 | # endif //__MSH_SAVE__ 109 | 110 | 111 | 112 | -------------------------------------------------------------------------------- /external/jigsaw/src/netcdf/COPYRIGHT.md: -------------------------------------------------------------------------------- 1 | Copyright 2018 Unidata 2 | 3 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 4 | 5 | 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 6 | 7 | 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 8 | 9 | 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. 10 | 11 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 12 | -------------------------------------------------------------------------------- /external/jigsaw/src/netcdf/README.md: -------------------------------------------------------------------------------- 1 | # Unidata NetCDF 2 | 3 | [![Build Status](https://travis-ci.org/Unidata/netcdf-c.svg?branch=master)](https://travis-ci.org/Unidata/netcdf-c) 4 | [![Coverity Scan Build Status](https://scan.coverity.com/projects/157/badge.svg)](https://scan.coverity.com/projects/157) 5 | 6 | ### About 7 | The Unidata network Common Data Form (**netCDF**) is an interface for 8 | scientific data access and a freely-distributed software library that 9 | provides an implementation of the interface. The netCDF library also 10 | defines a machine-independent format for representing scientific data. 11 | Together, the interface, library, and format support the creation, 12 | access, and sharing of scientific data. The current netCDF software 13 | provides C interfaces for applications and data. Separate software 14 | distributions available from Unidata provide Java, Fortran, Python, 15 | and C++ interfaces. They have been tested on various common 16 | platforms. 17 | 18 | #### Properties 19 | NetCDF files are self-describing, network-transparent, directly 20 | accessible, and extendible. `Self-describing` means that a netCDF file 21 | includes information about the data it contains. `Network-transparent` 22 | means that a netCDF file is represented in a form that can be accessed 23 | by computers with different ways of storing integers, characters, and 24 | floating-point numbers. `Direct-access` means that a small subset of a 25 | large dataset may be accessed efficiently, without first reading through 26 | all the preceding data. `Extendible` means that data can be appended to 27 | a netCDF dataset without copying it or redefining its structure. 28 | 29 | #### Use 30 | NetCDF is useful for supporting access to diverse kinds of scientific 31 | data in heterogeneous networking environments and for writing 32 | application software that does not depend on application-specific 33 | formats. For information about a variety of analysis and display 34 | packages that have been developed to analyze and display data in 35 | netCDF form, see 36 | 37 | * [Software for Manipulating or Displaying NetCDF Data](http://www.unidata.ucar.edu/netcdf/software.html) 38 | 39 | ##### More information 40 | For more information about netCDF, see 41 | 42 | * [Unidata Network Common Data Form (NetCDF)](http://www.unidata.ucar.edu/netcdf/) 43 | 44 | ### Latest releases 45 | You can obtain a copy of the latest released version of netCDF 46 | software for various languages: 47 | 48 | * [C library and utilities](http://github.com/Unidata/netcdf-c) 49 | * [Fortran](http://github.com/Unidata/netcdf-fortran) 50 | * [Java](http://www.unidata.ucar.edu/downloads/netcdf/netcdf-java-4/) 51 | * [Python](http://github.com/Unidata/netcdf4-python) 52 | * [C++](http://github.com/Unidata/netcdf-cxx4) 53 | 54 | ### Copyright 55 | Copyright and licensing information can be found [here](http://www.unidata.ucar.edu/software/netcdf/copyright.html), as well as in the COPYRIGHT file accompanying the software 56 | 57 | ### Installation 58 | To install the netCDF-C software, please see the file INSTALL in the 59 | netCDF-C distribution, or the (usually more up-to-date) document: 60 | 61 | * [Building NetCDF](https://www.unidata.ucar.edu/software/netcdf/docs/winbin.html) 62 | 63 | ### Documentation 64 | A language-independent User's Guide for netCDF, and some other 65 | language-specific user-level documents are available from: 66 | 67 | * [Language-independent User's Guide](http://www.unidata.ucar.edu/software/netcdf/docs/user_guide.html) 68 | * [NetCDF-C Tutorial](http://www.unidata.ucar.edu/software/netcdf/docs/tutorial_8dox.html) 69 | * [Fortran-90 User's Guide](http://www.unidata.ucar.edu/software/netcdf/documentation/historic/netcdf-f90/index.html#Top) 70 | * [Fortran-77 User's Guide](http://www.unidata.ucar.edu/software/netcdf/documentation/historic/netcdf-f77/index.html#Top) 71 | * [netCDF-Java/Common Data Model library](http://www.unidata.ucar.edu/software/thredds/current/netcdf-java/) 72 | * [netCDF4-python](http://unidata.github.io/netcdf4-python/) 73 | 74 | A mailing list, netcdfgroup@unidata.ucar.edu, exists for discussion of 75 | the netCDF interface and announcements about netCDF bugs, fixes, and 76 | enhancements. For information about how to subscribe, see the URL 77 | 78 | * [Unidata netCDF Mailing-Lists](http://www.unidata.ucar.edu/netcdf/mailing-lists.html) 79 | 80 | ### Feedback 81 | We appreciate feedback from users of this package. Please send comments, suggestions, and bug reports to . 82 | -------------------------------------------------------------------------------- /external/jigsaw/uni/README.md: -------------------------------------------------------------------------------- 1 | ## `UNIT-TESTS: various benchmarks for JIGSAW` 2 | 3 | A set of unit tests designed to exercise various `JIGSAW`, `TRIPOD` and `MARCHE` functionality: 4 | 5 | * TEST2D_X.c: 2D Cartesian test cases, with X = {A, B, ..., etc}. 6 | * TEST3D_X.c: 3D Cartesian test cases, with X = {A, B, ..., etc}. 7 | * TEST2S_X.c: 2D Spherical test cases, with X = {A, B, ..., etc}. 8 | 9 | * TESTKZ_A.c: Mesh a simple domain. 10 | * TESTKZ_B.c: Mesh with user-defined h(x) input (a structured 'grid'). 11 | * TESTKZ_C.c: Mesh with user-defined h(x) input (unstructured 'mesh'). 12 | * TESTKZ_D.c: Mesh 'multi-part' geometry with tags. 13 | * TESTKZ_E.c: Mesh with imposed initial conditions. 14 | * TESTKZ_F.c: Build 'restricted' DTs, using TRIPOD. 15 | * TESTKZ_G.c: Build conventional DTs, using TRIPOD. 16 | * TESTKZ_H.c: Solve: |dh/dx| <= G, using MARCHE (a structured 'grid'). 17 | * TESTKZ_I.c: Solve: |dh/dx| <= G, using MARCHE (unstructured 'mesh'). 18 | 19 | See `JIGSAW`'s base `README` for build information via `cmake`. 20 | 21 | 22 | -------------------------------------------------------------------------------- /external/jigsaw/uni/print.h: -------------------------------------------------------------------------------- 1 | 2 | # pragma once 3 | 4 | # ifndef __JIGSAW_PRINT__ 5 | # define __JIGSAW_PRINT__ 6 | 7 | # include "stdio.h" 8 | 9 | void output_msh_data_2 ( 10 | jigsaw_msh_t *_mesh 11 | ) 12 | { 13 | /*-------------------------------- helper: print msh. */ 14 | if (_mesh->_vert2._size > 0) 15 | printf("\n VERT2: \n\n") ; 16 | 17 | for (size_t _ipos = +0; 18 | _ipos != _mesh->_vert2._size ; 19 | ++_ipos ) 20 | { 21 | printf("%1.4f, %1.4f\n" , 22 | _mesh->_vert2. 23 | _data[_ipos]._ppos[0], 24 | _mesh->_vert2. 25 | _data[_ipos]._ppos[1] 26 | ) ; 27 | } 28 | 29 | if (_mesh->_edge2._size > 0) 30 | printf("\n EDGE2: \n\n") ; 31 | 32 | for (size_t _ipos = +0; 33 | _ipos != _mesh->_edge2._size ; 34 | ++_ipos ) 35 | { 36 | printf("%d, %d, %d\n", 37 | _mesh->_edge2. 38 | _data[_ipos]._node[0], 39 | _mesh->_edge2. 40 | _data[_ipos]._node[1], 41 | _mesh->_edge2. 42 | _data[_ipos]._itag 43 | ) ; 44 | } 45 | 46 | if (_mesh->_tria3._size > 0) 47 | printf("\n TRIA3: \n\n") ; 48 | 49 | for (size_t _ipos = +0; 50 | _ipos != _mesh->_tria3._size ; 51 | ++_ipos ) 52 | { 53 | printf("%d, %d, %d, %d\n", 54 | _mesh->_tria3. 55 | _data[_ipos]._node[0], 56 | _mesh->_tria3. 57 | _data[_ipos]._node[1], 58 | _mesh->_tria3. 59 | _data[_ipos]._node[2], 60 | _mesh->_tria3. 61 | _data[_ipos]._itag 62 | ) ; 63 | } 64 | } 65 | 66 | void output_msh_data_3 ( 67 | jigsaw_msh_t *_mesh 68 | ) 69 | { 70 | /*-------------------------------- helper: print msh. */ 71 | if (_mesh->_vert3._size > 0) 72 | printf("\n VERT3: \n\n") ; 73 | 74 | for (size_t _ipos = +0; 75 | _ipos != _mesh->_vert3._size ; 76 | ++_ipos ) 77 | { 78 | printf("%1.4f, %1.4f, %1.4f\n" , 79 | _mesh->_vert3. 80 | _data[_ipos]._ppos[0], 81 | _mesh->_vert3. 82 | _data[_ipos]._ppos[1], 83 | _mesh->_vert3. 84 | _data[_ipos]._ppos[2] 85 | ) ; 86 | } 87 | 88 | if (_mesh->_edge2._size > 0) 89 | printf("\n EDGE2: \n\n") ; 90 | 91 | for (size_t _ipos = +0; 92 | _ipos != _mesh->_edge2._size ; 93 | ++_ipos ) 94 | { 95 | printf("%d, %d, %d\n", 96 | _mesh->_edge2. 97 | _data[_ipos]._node[0], 98 | _mesh->_edge2. 99 | _data[_ipos]._node[1], 100 | _mesh->_edge2. 101 | _data[_ipos]._itag 102 | ) ; 103 | } 104 | 105 | if (_mesh->_tria3._size > 0) 106 | printf("\n TRIA3: \n\n") ; 107 | 108 | for (size_t _ipos = +0; 109 | _ipos != _mesh->_tria3._size ; 110 | ++_ipos ) 111 | { 112 | printf("%d, %d, %d, %d\n", 113 | _mesh->_tria3. 114 | _data[_ipos]._node[0], 115 | _mesh->_tria3. 116 | _data[_ipos]._node[1], 117 | _mesh->_tria3. 118 | _data[_ipos]._node[2], 119 | _mesh->_tria3. 120 | _data[_ipos]._itag 121 | ) ; 122 | } 123 | 124 | if (_mesh->_tria4._size > 0) 125 | printf("\n TRIA4: \n\n") ; 126 | 127 | for (size_t _ipos = +0; 128 | _ipos != _mesh->_tria4._size ; 129 | ++_ipos ) 130 | { 131 | printf("%d, %d, %d, %d, %d \n" , 132 | _mesh->_tria4. 133 | _data[_ipos]._node[0], 134 | _mesh->_tria4. 135 | _data[_ipos]._node[1], 136 | _mesh->_tria4. 137 | _data[_ipos]._node[2], 138 | _mesh->_tria4. 139 | _data[_ipos]._node[3], 140 | _mesh->_tria4. 141 | _data[_ipos]._itag 142 | ) ; 143 | } 144 | } 145 | 146 | # endif //__JIGSAW_PRINT__ 147 | 148 | 149 | 150 | -------------------------------------------------------------------------------- /external/jigsaw/uni/test2d_a.c: -------------------------------------------------------------------------------- 1 | 2 | // gcc -Wall -Wextra test2d_a.c -Xlinker -rpath=../lib 3 | // -L ../lib -ljigsaw -o test2d_a 4 | 5 | // A simple example to start: use JIGSAW to mesh a plain 6 | // domain in E^2. 7 | 8 | # include "../inc/lib_jigsaw.h" 9 | 10 | # include "print.h" 11 | # include "stdio.h" 12 | 13 | int test2d_a (int _verb) 14 | { 15 | int _retv = 0; 16 | 17 | /*-------------------------------- setup JIGSAW types */ 18 | jigsaw_jig_t _jjig ; 19 | jigsaw_init_jig_t(&_jjig) ; 20 | 21 | jigsaw_msh_t _geom ; 22 | jigsaw_init_msh_t(&_geom) ; 23 | 24 | jigsaw_msh_t _mesh ; 25 | jigsaw_init_msh_t(&_mesh) ; 26 | 27 | /* 28 | -------------------------------------------------------- 29 | * JIGSAW's "mesh" is a piecewise linear complex: 30 | -------------------------------------------------------- 31 | * 32 | * e:2 33 | * v:3 o---------------o v:2 34 | * | | 35 | * | | 36 | * | | 37 | * e:3 | | e:1 38 | * | | 39 | * | | 40 | * | | 41 | * v:0 o---------------o v:1 42 | * e:0 43 | * 44 | -------------------------------------------------------- 45 | */ 46 | 47 | jigsaw_VERT2_t _vert2[4] = { // setup geom. 48 | { {0., 0.}, +0 } , 49 | { {1., 0.}, +0 } , 50 | { {1., 1.}, +0 } , 51 | { {0., 1.}, +0 } 52 | } ; 53 | 54 | jigsaw_EDGE2_t _edge2[4] = { 55 | { {+0, +1}, +0 } , 56 | { {+1, +2}, +0 } , 57 | { {+2, +3}, +0 } , 58 | { {+3, +0}, +0 } 59 | } ; 60 | 61 | _geom._flags 62 | = JIGSAW_EUCLIDEAN_MESH; 63 | 64 | _geom._vert2._data = &_vert2[0] ; 65 | _geom._vert2._size = +4 ; 66 | 67 | _geom._edge2._data = &_edge2[0] ; 68 | _geom._edge2._size = +4 ; 69 | 70 | /*-------------------------------- build JIGSAW tria. */ 71 | 72 | _jjig._verbosity = _verb; 73 | 74 | _jjig._hfun_hmax = 0.25 ; 75 | _jjig._hfun_scal = 76 | JIGSAW_HFUN_RELATIVE; 77 | 78 | _jjig._mesh_dims = +2 ; 79 | 80 | _retv = jigsaw ( 81 | & _jjig , // the config. opt. 82 | & _geom , // geom. data 83 | NULL , // empty init. obj. 84 | NULL , // empty hfun. obj. 85 | & _mesh ) ; 86 | 87 | /*-------------------------------- print JIGSAW tria. */ 88 | 89 | if (_verb > 0 ) 90 | output_msh_data_2(&_mesh); 91 | 92 | jigsaw_free_msh_t(&_mesh); 93 | 94 | printf ( 95 | "[2d_a] JIGSAW returned code : %d \n", _retv) ; 96 | 97 | 98 | return _retv ; 99 | } 100 | 101 | # ifndef __SKIP_MAIN__ 102 | int main () { return test2d_a(1) ; } 103 | # endif//__SKIP_MAIN__ 104 | 105 | 106 | 107 | -------------------------------------------------------------------------------- /external/jigsaw/uni/test2d_b.c: -------------------------------------------------------------------------------- 1 | 2 | // gcc -Wall -Wextra test2d_b.c -Xlinker -rpath=../lib 3 | // -L ../lib -ljigsaw -o test2d_b 4 | 5 | // Use JIGSAW to mesh a simple geometry with user-defined 6 | // mesh-spacing data defined on a "grid" in E^2. 7 | 8 | # include "../inc/lib_jigsaw.h" 9 | 10 | # include "print.h" 11 | # include "stdio.h" 12 | 13 | int test2d_b (int _verb) 14 | { 15 | int _retv = 0; 16 | 17 | /*-------------------------------- setup JIGSAW types */ 18 | jigsaw_jig_t _jjig ; 19 | jigsaw_init_jig_t(&_jjig) ; 20 | 21 | jigsaw_msh_t _geom ; 22 | jigsaw_init_msh_t(&_geom) ; 23 | 24 | jigsaw_msh_t _hfun ; 25 | jigsaw_init_msh_t(&_hfun) ; 26 | 27 | jigsaw_msh_t _mesh ; 28 | jigsaw_init_msh_t(&_mesh) ; 29 | 30 | /* 31 | -------------------------------------------------------- 32 | * JIGSAW's "mesh" is a piecewise linear complex: 33 | -------------------------------------------------------- 34 | * 35 | * e:2 36 | * v:3 o---------------o v:2 37 | * | | 38 | * | | 39 | * | | 40 | * e:3 | | e:1 41 | * | | 42 | * | | 43 | * | | 44 | * v:0 o---------------o v:1 45 | * e:0 46 | * 47 | -------------------------------------------------------- 48 | */ 49 | 50 | jigsaw_VERT2_t _geom_vert2[4] = { // setup geom. 51 | { {0., 0.}, +0 } , 52 | { {1., 0.}, +0 } , 53 | { {1., 1.}, +0 } , 54 | { {0., 1.}, +0 } 55 | } ; 56 | 57 | jigsaw_EDGE2_t _geom_edge2[4] = { 58 | { {+0, +1}, +0 } , 59 | { {+1, +2}, +0 } , 60 | { {+2, +3}, +0 } , 61 | { {+3, +0}, +0 } 62 | } ; 63 | 64 | _geom._flags 65 | = JIGSAW_EUCLIDEAN_MESH; 66 | 67 | _geom._vert2._data = &_geom_vert2[0] ; 68 | _geom._vert2._size = +4 ; 69 | 70 | _geom._edge2._data = &_geom_edge2[0] ; 71 | _geom._edge2._size = +4 ; 72 | 73 | /* 74 | -------------------------------------------------------- 75 | * JIGSAW's "grid" uses a column-major numbering: 76 | -------------------------------------------------------- 77 | * 78 | * v:5 79 | * v:2 o-------o-------o v:8 80 | * | | | 81 | * | | | 82 | * | v:4 | 83 | * v:1 o-------o-------o v:7 84 | * | | | 85 | * | | | 86 | * | | | 87 | * v:0 o-------o-------o v:6 88 | * v:3 89 | * 90 | -------------------------------------------------------- 91 | */ 92 | 93 | real_t _hfun_xgrid[3] = { // setup hfun. 94 | 0., .5, 1. 95 | } ; 96 | 97 | real_t _hfun_ygrid[3] = { 98 | 0., .5, 1. 99 | } ; 100 | 101 | fp32_t _hfun_value[9] = { 102 | .3f, .2f, .3f, .2f, .1f, .2f, .3f, 103 | .2f, .3f 104 | } ; 105 | 106 | _hfun._flags 107 | = JIGSAW_EUCLIDEAN_GRID; 108 | 109 | _hfun._xgrid._data = &_hfun_xgrid[0] ; 110 | _hfun._xgrid._size = +3 ; 111 | 112 | _hfun._ygrid._data = &_hfun_ygrid[0] ; 113 | _hfun._ygrid._size = +3 ; 114 | 115 | _hfun._value._data = &_hfun_value[0] ; 116 | _hfun._value._size = +9 ; 117 | 118 | /*-------------------------------- build JIGSAW tria. */ 119 | 120 | _jjig._verbosity = _verb; 121 | 122 | _jjig._hfun_scal = 123 | JIGSAW_HFUN_ABSOLUTE; 124 | 125 | _jjig._hfun_hmax = 1. ; 126 | _jjig._hfun_hmin = 0. ; 127 | 128 | _jjig._geom_feat = +1 ; // do "sharp" geom. 129 | _jjig._mesh_top1 = +1 ; 130 | 131 | _jjig._mesh_dims = +2 ; 132 | 133 | _retv = jigsaw ( 134 | & _jjig , // the config. opt. 135 | & _geom , // geom. data 136 | NULL , // empty init. obj. 137 | & _hfun , // hfun. data 138 | & _mesh ) ; 139 | 140 | /*-------------------------------- print JIGSAW tria. */ 141 | 142 | if (_verb > 0 ) 143 | output_msh_data_2(&_mesh); 144 | 145 | jigsaw_free_msh_t(&_mesh); 146 | 147 | printf ( 148 | "[2d_b] JIGSAW returned code : %d \n", _retv) ; 149 | 150 | 151 | return _retv ; 152 | } 153 | 154 | # ifndef __SKIP_MAIN__ 155 | int main () { return test2d_b(1) ; } 156 | # endif//__SKIP_MAIN__ 157 | 158 | 159 | 160 | -------------------------------------------------------------------------------- /external/jigsaw/uni/test2d_d.c: -------------------------------------------------------------------------------- 1 | 2 | // gcc -Wall -Wextra test2d_d.c -Xlinker -rpath=../lib 3 | // -L ../lib -ljigsaw -o test2d_d 4 | 5 | // Use JIGSAW to mesh "multi-part" geometry defined in 6 | // E^2. Cells inherit part information via ID-tags. 7 | 8 | # include "../inc/lib_jigsaw.h" 9 | 10 | # include "print.h" 11 | # include "stdio.h" 12 | 13 | int test2d_d (int _verb) 14 | { 15 | int _retv = 0; 16 | 17 | /*-------------------------------- setup JIGSAW types */ 18 | jigsaw_jig_t _jjig ; 19 | jigsaw_init_jig_t(&_jjig) ; 20 | 21 | jigsaw_msh_t _geom ; 22 | jigsaw_init_msh_t(&_geom) ; 23 | 24 | jigsaw_msh_t _mesh ; 25 | jigsaw_init_msh_t(&_mesh) ; 26 | 27 | /* 28 | -------------------------------------------------------- 29 | * A domain with "interior" constraints 30 | -------------------------------------------------------- 31 | * 32 | * e:2 33 | * v:3 o---------------o v:2 34 | * | | 35 | * | e:6 | 36 | * | o---o | 37 | * e:3 | e:7 | | e:5 | e:1 38 | * | o---o | 39 | * | e:4 | 40 | * | | 41 | * v:0 o---------------o v:1 42 | * e:0 43 | * 44 | -------------------------------------------------------- 45 | */ 46 | 47 | indx_t _ITAG 48 | = JIGSAW_EDGE2_TAG ; 49 | 50 | jigsaw_VERT2_t _vert2[8] = { // setup geom. 51 | { {0., 0.}, +0 } , 52 | { {3., 0.}, +0 } , 53 | { {3., 3.}, +0 } , 54 | { {0., 3.}, +0 } , 55 | { {1., 1.}, +0 } , 56 | { {2., 1.}, +0 } , 57 | { {2., 2.}, +0 } , 58 | { {1., 2.}, +0 } 59 | } ; 60 | 61 | jigsaw_EDGE2_t _edge2[8] = { 62 | { {+0, +1}, +0 } , // outer geom. 63 | { {+1, +2}, +0 } , 64 | { {+2, +3}, +0 } , 65 | { {+3, +0}, +0 } , 66 | { {+4, +5}, +0 } , // inner geom. 67 | { {+5, +6}, +0 } , 68 | { {+6, +7}, +0 } , 69 | { {+7, +4}, +0 } 70 | } ; 71 | 72 | jigsaw_BOUND_t _bound[12]= { 73 | { +1, +0, _ITAG}, 74 | { +1, +1, _ITAG}, 75 | { +1, +2, _ITAG}, 76 | { +1, +3, _ITAG}, 77 | { +1, +4, _ITAG}, 78 | { +1, +5, _ITAG}, 79 | { +1, +6, _ITAG}, 80 | { +1, +7, _ITAG}, 81 | { +2, +4, _ITAG}, // inner geom. 82 | { +2, +5, _ITAG}, 83 | { +2, +6, _ITAG}, 84 | { +2, +7, _ITAG}, 85 | } ; 86 | 87 | _geom._flags 88 | = JIGSAW_EUCLIDEAN_MESH ; 89 | 90 | _geom._vert2._data = &_vert2[0] ; 91 | _geom._vert2._size = +8 ; 92 | 93 | _geom._edge2._data = &_edge2[0] ; 94 | _geom._edge2._size = +8 ; 95 | 96 | _geom._bound._data = &_bound[0] ; 97 | _geom._bound._size = +12; 98 | 99 | /*-------------------------------- build JIGSAW tria. */ 100 | 101 | _jjig._verbosity = _verb; 102 | 103 | _jjig._hfun_hmax = 0.25 ; 104 | _jjig._hfun_scal = 105 | JIGSAW_HFUN_RELATIVE; 106 | 107 | _jjig._mesh_dims = +2 ; 108 | 109 | _retv = jigsaw ( 110 | & _jjig , // the config. opts 111 | & _geom , // geom. data 112 | NULL , // empty init. data 113 | NULL , // empty hfun. data 114 | & _mesh ) ; 115 | 116 | /*-------------------------------- print JIGSAW tria. */ 117 | 118 | if (_verb > 0 ) 119 | output_msh_data_2(&_mesh); 120 | 121 | jigsaw_free_msh_t(&_mesh); 122 | 123 | printf ( 124 | "[2d_d] JIGSAW returned code : %d \n", _retv) ; 125 | 126 | 127 | return _retv ; 128 | } 129 | 130 | # ifndef __SKIP_MAIN__ 131 | int main () { return test2d_d(1) ; } 132 | # endif//__SKIP_MAIN__ 133 | 134 | 135 | 136 | -------------------------------------------------------------------------------- /external/jigsaw/uni/test2d_e.c: -------------------------------------------------------------------------------- 1 | 2 | // gcc -Wall -Wextra test2d_e.c -Xlinker -rpath=../lib 3 | // -L ../lib -ljigsaw -o test2d_e 4 | 5 | // Use JIGSAW to mesh a simple domain in E^2, starting 6 | // from user-defined initial-conditions. 7 | 8 | # include "../inc/lib_jigsaw.h" 9 | 10 | # include "print.h" 11 | # include "stdio.h" 12 | 13 | int test2d_e (int _verb) 14 | { 15 | int _retv = 0; 16 | 17 | /*-------------------------------- setup JIGSAW types */ 18 | jigsaw_jig_t _jjig ; 19 | jigsaw_init_jig_t(&_jjig) ; 20 | 21 | jigsaw_msh_t _geom ; 22 | jigsaw_init_msh_t(&_geom) ; 23 | 24 | jigsaw_msh_t _init ; 25 | jigsaw_init_msh_t(&_init) ; 26 | 27 | jigsaw_msh_t _mesh ; 28 | jigsaw_init_msh_t(&_mesh) ; 29 | 30 | /* 31 | -------------------------------------------------------- 32 | * JIGSAW's "mesh" is a piecewise linear complex: 33 | -------------------------------------------------------- 34 | * 35 | * e:2 36 | * v:3 o---------------o v:2 37 | * | | 38 | * | | 39 | * | | 40 | * e:3 | | e:1 41 | * | | 42 | * | | 43 | * | | 44 | * v:0 o---------------o v:1 45 | * e:0 46 | * 47 | -------------------------------------------------------- 48 | */ 49 | 50 | jigsaw_VERT2_t _geom_vert2[4] = { // setup geom. 51 | { {0., 0.}, +0 } , 52 | { {1., 0.}, +0 } , 53 | { {1., 1.}, +0 } , 54 | { {0., 1.}, +0 } 55 | } ; 56 | 57 | jigsaw_EDGE2_t _geom_edge2[4] = { 58 | { {+0, +1}, +0 } , 59 | { {+1, +2}, +0 } , 60 | { {+2, +3}, +0 } , 61 | { {+3, +0}, +0 } 62 | } ; 63 | 64 | _geom._flags 65 | = JIGSAW_EUCLIDEAN_MESH; 66 | 67 | _geom._vert2._data = &_geom_vert2[0] ; 68 | _geom._vert2._size = +4 ; 69 | 70 | _geom._edge2._data = &_geom_edge2[0] ; 71 | _geom._edge2._size = +4 ; 72 | 73 | /*-------------------------------- form init. config. */ 74 | 75 | jigsaw_VERT2_t _init_vert2[4] = { 76 | { {0., 0.}, +0 } , 77 | { {0., .5}, +0 } , 78 | { {0., 1.}, +0 } , 79 | { {.5, .5}, +0 } 80 | } ; 81 | 82 | jigsaw_EDGE2_t _init_edge2[2] = { 83 | { {+0, +1}, -1 } , // -1 => "un-refinable" 84 | { {+1, +2}, -1 } 85 | } ; 86 | 87 | _init._flags 88 | = JIGSAW_EUCLIDEAN_MESH; 89 | 90 | _init._vert2._data = &_init_vert2[0] ; 91 | _init._vert2._size = +4 ; 92 | 93 | _init._edge2._data = &_init_edge2[0] ; 94 | _init._edge2._size = +2 ; 95 | 96 | /*-------------------------------- build JIGSAW tria. */ 97 | 98 | _jjig._verbosity = _verb; 99 | 100 | _jjig._hfun_hmax = 1./3.; 101 | _jjig._hfun_scal = 102 | JIGSAW_HFUN_RELATIVE; 103 | 104 | _jjig._mesh_dims = +2 ; 105 | _jjig._geom_feat = +1 ; 106 | _jjig._mesh_top1 = +1 ; 107 | 108 | _retv = jigsaw ( 109 | & _jjig , // the config. opts 110 | & _geom , // geom. data 111 | & _init , // init. data 112 | NULL , // empty hfun. data 113 | & _mesh ) ; 114 | 115 | /*-------------------------------- print JIGSAW tria. */ 116 | 117 | if (_verb > 0 ) 118 | output_msh_data_2(&_mesh); 119 | 120 | jigsaw_free_msh_t(&_mesh); 121 | 122 | printf ( 123 | "[2d_e] JIGSAW returned code : %d \n", _retv) ; 124 | 125 | 126 | return _retv ; 127 | } 128 | 129 | # ifndef __SKIP_MAIN__ 130 | int main () { return test2d_e(1) ; } 131 | # endif//__SKIP_MAIN__ 132 | 133 | 134 | 135 | -------------------------------------------------------------------------------- /external/jigsaw/uni/test2d_f.c: -------------------------------------------------------------------------------- 1 | 2 | // gcc -Wall -Wextra test2d_f.c -Xlinker -rpath=../lib 3 | // -L ../lib -ljigsaw -o test2d_f 4 | 5 | // Uses TRIPOD to build a "restricted" DT, given a set 6 | // points and a geometry in E^2. Compared to JIGSAW, 7 | // TRIPOD computes a "restricted" triangulation (given 8 | // a set of points a priori), rather than generating a 9 | // mesh dynamically. 10 | 11 | # include "../inc/lib_jigsaw.h" 12 | 13 | # include "print.h" 14 | # include "stdio.h" 15 | 16 | int test2d_f (int _verb) 17 | { 18 | int _retv = 0; 19 | 20 | /*-------------------------------- setup JIGSAW types */ 21 | jigsaw_jig_t _jjig ; 22 | jigsaw_init_jig_t(&_jjig) ; 23 | 24 | jigsaw_msh_t _geom ; 25 | jigsaw_init_msh_t(&_geom) ; 26 | 27 | jigsaw_msh_t _init ; 28 | jigsaw_init_msh_t(&_init) ; 29 | 30 | jigsaw_msh_t _tria ; 31 | jigsaw_init_msh_t(&_tria) ; 32 | 33 | /* 34 | -------------------------------------------------------- 35 | * JIGSAW's "mesh" is a piecewise linear complex: 36 | -------------------------------------------------------- 37 | * 38 | * e:2 39 | * v:3 o---------------o v:2 40 | * | | 41 | * | | 42 | * | | 43 | * e:3 | | e:1 44 | * | | 45 | * | | 46 | * | | 47 | * v:0 o---------------o v:1 48 | * e:0 49 | * 50 | -------------------------------------------------------- 51 | */ 52 | 53 | jigsaw_VERT2_t _geom_vert2[4] = { // setup geom. 54 | { {0., 0.}, +0 } , 55 | { {1., 0.}, +0 } , 56 | { {1., 1.}, +0 } , 57 | { {0., 1.}, +0 } 58 | } ; 59 | 60 | jigsaw_EDGE2_t _geom_edge2[4] = { 61 | { {+0, +1}, +1 } , 62 | { {+1, +2}, +2 } , 63 | { {+2, +3}, +3 } , 64 | { {+3, +0}, +4 } 65 | } ; 66 | 67 | _geom._flags 68 | = JIGSAW_EUCLIDEAN_MESH; 69 | 70 | _geom._vert2._data = &_geom_vert2[0] ; 71 | _geom._vert2._size = +4 ; 72 | 73 | _geom._edge2._data = &_geom_edge2[0] ; 74 | _geom._edge2._size = +4 ; 75 | 76 | /*-------------------------------- pts to triangulate */ 77 | 78 | jigsaw_VERT2_t _init_vert2[9] = { 79 | { {0., 0.}, +0 } , 80 | { {1., 0.}, +0 } , 81 | { {1., 1.}, +0 } , 82 | { {0., 1.}, +0 } , 83 | { {.5, .0}, +0 } , 84 | { {1., .5}, +0 } , 85 | { {.5, 1.}, +0 } , 86 | { {.0, .5}, +0 } , 87 | { {.3, .3}, +0 } 88 | } ; 89 | 90 | _init._flags 91 | = JIGSAW_EUCLIDEAN_MESH; 92 | 93 | _init._vert2._data = &_init_vert2[0] ; 94 | _init._vert2._size = +9 ; 95 | 96 | /*-------------------------------- build TRIPOD r-DT. */ 97 | 98 | _jjig._verbosity = _verb; 99 | 100 | _jjig._mesh_dims = +2 ; 101 | 102 | _retv = tripod ( 103 | & _jjig , // the config. opts 104 | & _init , // init. data 105 | & _geom , // geom. data 106 | & _tria ) ; 107 | 108 | /*-------------------------------- print TRIPOD r-DT. */ 109 | 110 | if (_verb > 0 ) 111 | output_msh_data_2(&_tria); 112 | 113 | jigsaw_free_msh_t(&_tria); 114 | 115 | printf ( 116 | "[2d_f] TRIPOD returned code : %d \n", _retv) ; 117 | 118 | 119 | return _retv ; 120 | } 121 | 122 | # ifndef __SKIP_MAIN__ 123 | int main () { return test2d_f(1) ; } 124 | # endif//__SKIP_MAIN__ 125 | 126 | 127 | 128 | -------------------------------------------------------------------------------- /external/jigsaw/uni/test2d_g.c: -------------------------------------------------------------------------------- 1 | 2 | // gcc -Wall -Wextra test2d_g.c -Xlinker -rpath=../lib 3 | // -L ../lib -ljigsaw -o test2d_g 4 | 5 | // Uses TRIPOD to build an (unconstrained) DT in E^2, 6 | // comparable to more conventional Delaunay tessellation 7 | // approaches. 8 | 9 | # include "../inc/lib_jigsaw.h" 10 | 11 | # include "print.h" 12 | # include "stdio.h" 13 | 14 | int test2d_g (int _verb) 15 | { 16 | int _retv = 0; 17 | 18 | /*-------------------------------- setup JIGSAW types */ 19 | jigsaw_jig_t _jjig ; 20 | jigsaw_init_jig_t(&_jjig) ; 21 | 22 | jigsaw_msh_t _init ; 23 | jigsaw_init_msh_t(&_init) ; 24 | 25 | jigsaw_msh_t _tria ; 26 | jigsaw_init_msh_t(&_tria) ; 27 | 28 | /*-------------------------------- pts to triangulate */ 29 | 30 | jigsaw_VERT2_t _init_vert2[9] = { 31 | { {0., 0.}, +0 } , 32 | { {2., 0.}, +0 } , 33 | { {1., 2.}, +0 } , 34 | { {0., 1.}, +0 } , 35 | { {.5, .0}, +0 } , 36 | { {1., .7}, +0 } , 37 | { {.6, 1.}, +0 } , 38 | { {.0, .4}, +0 } , 39 | { {.3, .3}, +0 } 40 | } ; 41 | 42 | _init._flags 43 | = JIGSAW_EUCLIDEAN_MESH; 44 | 45 | _init._vert2._data = &_init_vert2[0] ; 46 | _init._vert2._size = +9 ; 47 | 48 | /*-------------------------------- build TRIPOD r-DT. */ 49 | 50 | _jjig._verbosity = _verb; 51 | 52 | _jjig._mesh_dims = +2 ; 53 | 54 | _retv = tripod ( 55 | & _jjig , // the config. opts 56 | & _init , // init. data 57 | NULL , // empty geom. data 58 | & _tria ) ; 59 | 60 | /*-------------------------------- print TRIPOD r-DT. */ 61 | 62 | if (_verb > 0 ) 63 | output_msh_data_2(&_tria); 64 | 65 | jigsaw_free_msh_t(&_tria); 66 | 67 | printf ( 68 | "[2d_g] TRIPOD returned code : %d \n", _retv) ; 69 | 70 | 71 | return _retv ; 72 | } 73 | 74 | # ifndef __SKIP_MAIN__ 75 | int main () { return test2d_g(1) ; } 76 | # endif//__SKIP_MAIN__ 77 | 78 | 79 | 80 | -------------------------------------------------------------------------------- /external/jigsaw/uni/test2d_h.c: -------------------------------------------------------------------------------- 1 | 2 | // gcc -Wall -Wextra test2d_h.c -Xlinker -rpath=../lib 3 | // -L ../lib -ljigsaw -o test2d_h 4 | 5 | // Use MARCHE to set "gradient-limits" on mesh-spacing data 6 | // 7 | // ensures: |GRAD(h)| <= slope_limit(x), 8 | // 9 | // via a "fast-marching" solver for the Hamilton-Jacobi eq. 10 | 11 | # include "../inc/lib_jigsaw.h" 12 | 13 | # include "print.h" 14 | # include "stdio.h" 15 | 16 | int test2d_h (int _verb) 17 | { 18 | int _retv = 0; 19 | 20 | /*-------------------------------- setup JIGSAW types */ 21 | jigsaw_jig_t _jjig ; 22 | jigsaw_init_jig_t(&_jjig) ; 23 | 24 | jigsaw_msh_t _hfun ; 25 | jigsaw_init_msh_t(&_hfun) ; 26 | 27 | /* 28 | -------------------------------------------------------- 29 | * JIGSAW's "grid" uses a column-major numbering: 30 | -------------------------------------------------------- 31 | * 32 | * v:5 33 | * v:2 o-------o-------o v:8 34 | * | | | 35 | * | | | 36 | * | v:4 | 37 | * v:1 o-------o-------o v:7 38 | * | | | 39 | * | | | 40 | * | | | 41 | * v:0 o-------o-------o v:6 42 | * v:3 43 | * 44 | -------------------------------------------------------- 45 | */ 46 | 47 | real_t _hfun_xgrid[3] = { // setup hfun. 48 | 0., .5, 1. 49 | } ; 50 | 51 | real_t _hfun_ygrid[3] = { 52 | 0., .5, 1. 53 | } ; 54 | 55 | fp32_t _hfun_value[9] = { 56 | 2.f, 2.f, 2.f, 2.f, 1.f, 2.f, 2.f, 57 | 2.f, 2.f 58 | } ; 59 | 60 | fp32_t _hfun_slope[9] = { 61 | .4f, .4f, .4f, .4f, .1f, .4f, .4f, 62 | .4f, .4f 63 | } ; 64 | 65 | _hfun._flags 66 | = JIGSAW_EUCLIDEAN_GRID; 67 | 68 | _hfun._xgrid._data = &_hfun_xgrid[0] ; 69 | _hfun._xgrid._size = +3 ; 70 | 71 | _hfun._ygrid._data = &_hfun_ygrid[0] ; 72 | _hfun._ygrid._size = +3 ; 73 | 74 | _hfun._value._data = &_hfun_value[0] ; 75 | _hfun._value._size = +9 ; 76 | 77 | _hfun._slope._data = &_hfun_slope[0] ; 78 | _hfun._slope._size = +9 ; 79 | 80 | /*-------------------------------- build MARCHE hfun. */ 81 | 82 | _jjig._verbosity = _verb; 83 | 84 | _retv = marche ( 85 | & _jjig , // the config. opts 86 | & _hfun ) ; // the spacing h(x) 87 | 88 | /*-------------------------------- print MARCHE hfun. */ 89 | 90 | if (_verb > 0 ) 91 | { 92 | printf("\n VALUE: \n\n") ; 93 | 94 | for (size_t _ipos = +0; 95 | _ipos != _hfun._value._size ; 96 | ++_ipos ) 97 | { 98 | printf("%1.4f\n", 99 | _hfun._value._data[_ipos] 100 | ) ; 101 | } 102 | } 103 | 104 | printf ( 105 | "[2d_h] MARCHE returned code : %d \n", _retv) ; 106 | 107 | 108 | return _retv ; 109 | } 110 | 111 | # ifndef __SKIP_MAIN__ 112 | int main () { return test2d_h(1) ; } 113 | # endif//__SKIP_MAIN__ 114 | 115 | 116 | 117 | -------------------------------------------------------------------------------- /external/jigsaw/uni/test2d_i.c: -------------------------------------------------------------------------------- 1 | 2 | // gcc -Wall -Wextra test2d_i.c -Xlinker -rpath=../lib 3 | // -L ../lib -ljigsaw -o test2d_i 4 | 5 | // Use MARCHE to set "gradient-limits" on mesh-spacing data 6 | // 7 | // ensures: |GRAD(h)| <= slope_limit(x), 8 | // 9 | // via a "fast-marching" solver for the Hamilton-Jacobi eq. 10 | 11 | # include "../inc/lib_jigsaw.h" 12 | 13 | # include "print.h" 14 | # include "stdio.h" 15 | 16 | int test2d_i (int _verb) 17 | { 18 | int _retv = 0; 19 | 20 | /*-------------------------------- setup JIGSAW types */ 21 | jigsaw_jig_t _jjig ; 22 | jigsaw_init_jig_t(&_jjig) ; 23 | 24 | jigsaw_msh_t _hfun ; 25 | jigsaw_init_msh_t(&_hfun) ; 26 | 27 | /* 28 | -------------------------------------------------------- 29 | * JIGSAW's "mesh" is a piecewise linear complex: 30 | -------------------------------------------------------- 31 | * 32 | * v:3 o---------------o v:2 33 | * | \ t:2 / | 34 | * | \ / | 35 | * | \ 4 / | 36 | * | t:3 o t:1 | 37 | * | / \ | 38 | * | / \ | 39 | * | / t:0 \ | 40 | * v:0 o---------------o v:1 41 | * 42 | -------------------------------------------------------- 43 | */ 44 | 45 | jigsaw_VERT2_t _hfun_vert2[5] = { // setup hfun. 46 | { {0., 0.}, +0 } , 47 | { {1., 0.}, +0 } , 48 | { {1., 1.}, +0 } , 49 | { {0., 1.}, +0 } , 50 | { {.5, .5}, +0 } 51 | } ; 52 | 53 | jigsaw_TRIA3_t _hfun_tria3[4] = { 54 | { {+0, +1, +4}, +0 } , 55 | { {+1, +2, +4}, +0 } , 56 | { {+2, +3, +4}, +0 } , 57 | { {+3, +0, +4}, +0 } 58 | } ; 59 | 60 | fp32_t _hfun_value[5] = { 61 | 2.f, 2.f, 2.f, 2.f, 1.f 62 | } ; 63 | 64 | fp32_t _hfun_slope[1] = { 65 | .1f 66 | } ; 67 | 68 | _hfun._flags 69 | = JIGSAW_EUCLIDEAN_MESH; 70 | 71 | _hfun._vert2._data = &_hfun_vert2[0] ; 72 | _hfun._vert2._size = +5 ; 73 | 74 | _hfun._tria3._data = &_hfun_tria3[0] ; 75 | _hfun._tria3._size = +4 ; 76 | 77 | _hfun._value._data = &_hfun_value[0] ; 78 | _hfun._value._size = +5 ; 79 | 80 | _hfun._slope._data = &_hfun_slope[0] ; 81 | _hfun._slope._size = +1 ; 82 | 83 | /*-------------------------------- build MARCHE hfun. */ 84 | 85 | _jjig._verbosity = _verb; 86 | 87 | _retv = marche ( 88 | & _jjig , // the config. opts 89 | & _hfun ) ; // the spacing h(x) 90 | 91 | /*-------------------------------- print MARCHE hfun. */ 92 | 93 | if (_verb > 0 ) 94 | { 95 | printf("\n VALUE: \n\n") ; 96 | 97 | for (size_t _ipos = +0; 98 | _ipos != _hfun._value._size ; 99 | ++_ipos ) 100 | { 101 | printf("%1.4f\n", 102 | _hfun._value._data[_ipos] 103 | ) ; 104 | } 105 | } 106 | 107 | printf ( 108 | "[2d_i] MARCHE returned code : %d \n", _retv) ; 109 | 110 | 111 | return _retv ; 112 | } 113 | 114 | # ifndef __SKIP_MAIN__ 115 | int main () { return test2d_i(1) ; } 116 | # endif//__SKIP_MAIN__ 117 | 118 | 119 | 120 | -------------------------------------------------------------------------------- /external/jigsaw/uni/test2s_a.c: -------------------------------------------------------------------------------- 1 | 2 | // gcc -Wall -Wextra test2s_a.c -Xlinker -rpath=../lib 3 | // -L ../lib -ljigsaw -o test2s_a 4 | 5 | // A simple example to start: use JIGSAW to mesh a plain 6 | // domain in S^2. 7 | 8 | # include "../inc/lib_jigsaw.h" 9 | 10 | # include "print.h" 11 | # include "stdio.h" 12 | 13 | int test2s_a (int _verb) 14 | { 15 | int _retv = 0; 16 | 17 | /*-------------------------------- setup JIGSAW types */ 18 | jigsaw_jig_t _jjig ; 19 | jigsaw_init_jig_t(&_jjig) ; 20 | 21 | jigsaw_msh_t _geom ; 22 | jigsaw_init_msh_t(&_geom) ; 23 | 24 | jigsaw_msh_t _mesh ; 25 | jigsaw_init_msh_t(&_mesh) ; 26 | 27 | /*-------------------------------- setup JIGSAW geom. */ 28 | 29 | real_t _radii[3] = {+1., +1., +1. 30 | } ; 31 | 32 | _geom._flags = 33 | JIGSAW_ELLIPSOID_MESH ; 34 | 35 | _geom._radii._data = &_radii[0] ; 36 | _geom._radii._size = +3 ; 37 | 38 | /*-------------------------------- build JIGSAW tria. */ 39 | 40 | _jjig._verbosity = _verb; 41 | 42 | _jjig._hfun_hmax = 0.80 ; 43 | _jjig._hfun_scal = 44 | JIGSAW_HFUN_ABSOLUTE; 45 | 46 | _jjig._mesh_dims = +2 ; 47 | 48 | _retv = jigsaw ( 49 | & _jjig , // the config. opt. 50 | & _geom , // geom. data 51 | NULL , // empty init. obj. 52 | NULL , // empty hfun. obj. 53 | & _mesh ) ; 54 | 55 | /*-------------------------------- print JIGSAW tria. */ 56 | 57 | if (_verb > 0 ) 58 | output_msh_data_3(&_mesh); 59 | 60 | jigsaw_free_msh_t(&_mesh); 61 | 62 | printf ( 63 | "[2s_a] JIGSAW returned code : %d \n", _retv) ; 64 | 65 | 66 | return _retv ; 67 | } 68 | 69 | # ifndef __SKIP_MAIN__ 70 | int main () { return test2s_a(1) ; } 71 | # endif//__SKIP_MAIN__ 72 | 73 | 74 | 75 | -------------------------------------------------------------------------------- /external/jigsaw/uni/test2s_b.c: -------------------------------------------------------------------------------- 1 | 2 | // gcc -Wall -Wextra test2s_b.c -Xlinker -rpath=../lib 3 | // -L ../lib -ljigsaw -o test2s_b 4 | 5 | // Use JIGSAW to mesh a simple geometry with user-defined 6 | // mesh-spacing data defined on a "grid" in S^2. 7 | 8 | # include "../inc/lib_jigsaw.h" 9 | 10 | # include "print.h" 11 | # include "stdio.h" 12 | 13 | int test2s_b (int _verb) 14 | { 15 | int _retv = 0; 16 | 17 | /*-------------------------------- setup JIGSAW types */ 18 | jigsaw_jig_t _jjig ; 19 | jigsaw_init_jig_t(&_jjig) ; 20 | 21 | jigsaw_msh_t _geom ; 22 | jigsaw_init_msh_t(&_geom) ; 23 | 24 | jigsaw_msh_t _hfun ; 25 | jigsaw_init_msh_t(&_hfun) ; 26 | 27 | jigsaw_msh_t _mesh ; 28 | jigsaw_init_msh_t(&_mesh) ; 29 | 30 | /*-------------------------------- setup JIGSAW geom. */ 31 | 32 | real_t _radii[3] = {+1., +1., +1. 33 | } ; 34 | 35 | _geom._flags = 36 | JIGSAW_ELLIPSOID_MESH ; 37 | 38 | _geom._radii._data = &_radii[0] ; 39 | _geom._radii._size = +3 ; 40 | 41 | /* 42 | -------------------------------------------------------- 43 | * JIGSAW's "grid" uses a column-major numbering: 44 | -------------------------------------------------------- 45 | * 46 | * v:5 47 | * v:2 o-------o-------o v:8 48 | * | | | 49 | * | | | 50 | * | v:4 | 51 | * v:1 o-------o-------o v:7 52 | * | | | 53 | * | | | 54 | * | | | 55 | * v:0 o-------o-------o v:6 56 | * v:3 57 | * 58 | -------------------------------------------------------- 59 | */ 60 | 61 | real_t PI = 3.14159265358979323846 ; 62 | 63 | real_t _hfun_xgrid[3] = { // setup hfun. 64 | -1.0 * PI, 0.0, +1.0 * PI 65 | } ; 66 | 67 | real_t _hfun_ygrid[3] = { 68 | -0.5 * PI, 0.0, +0.5 * PI 69 | } ; 70 | 71 | fp32_t _hfun_value[9] = { 72 | .5f, 1.f, .5f, .5f, 1.f, .5f, .5f, 73 | 1.f, .5f 74 | } ; 75 | 76 | _hfun._flags 77 | = JIGSAW_ELLIPSOID_GRID; 78 | 79 | _hfun._xgrid._data = &_hfun_xgrid[0] ; 80 | _hfun._xgrid._size = +3 ; 81 | 82 | _hfun._ygrid._data = &_hfun_ygrid[0] ; 83 | _hfun._ygrid._size = +3 ; 84 | 85 | _hfun._value._data = &_hfun_value[0] ; 86 | _hfun._value._size = +9 ; 87 | 88 | /*-------------------------------- build JIGSAW tria. */ 89 | 90 | _jjig._verbosity = _verb; 91 | 92 | _jjig._hfun_scal = 93 | JIGSAW_HFUN_ABSOLUTE; 94 | 95 | _jjig._hfun_hmax = 1. ; 96 | _jjig._hfun_hmin = 0. ; 97 | 98 | _jjig._mesh_dims = +2 ; 99 | 100 | _jjig._mesh_kern = // non-default opts 101 | JIGSAW_KERN_DELAUNAY; 102 | _jjig._optm_kern = 103 | JIGSAW_KERN_CVT_DQDX; 104 | _jjig._optm_cost = 105 | JIGSAW_KERN_SKEW_COS; 106 | 107 | _retv = jigsaw ( 108 | & _jjig , // the config. opt. 109 | & _geom , // geom. data 110 | NULL , // empty init. obj. 111 | & _hfun , // hfun. data 112 | & _mesh ) ; 113 | 114 | /*-------------------------------- print JIGSAW tria. */ 115 | 116 | if (_verb > 0 ) 117 | output_msh_data_3(&_mesh); 118 | 119 | jigsaw_free_msh_t(&_mesh); 120 | 121 | printf ( 122 | "[2s_b] JIGSAW returned code : %d \n", _retv) ; 123 | 124 | 125 | return _retv ; 126 | } 127 | 128 | # ifndef __SKIP_MAIN__ 129 | int main () { return test2s_b(1) ; } 130 | # endif//__SKIP_MAIN__ 131 | 132 | 133 | 134 | -------------------------------------------------------------------------------- /external/jigsaw/uni/test2s_c.c: -------------------------------------------------------------------------------- 1 | 2 | // gcc -Wall -Wextra test2s_c.c -Xlinker -rpath=../lib 3 | // -L ../lib -ljigsaw -o test2s_c 4 | 5 | // Use JIGSAW to mesh a simple geometry with user-defined 6 | // mesh-spacing data defined on a "mesh" in S^2. 7 | 8 | # include "../inc/lib_jigsaw.h" 9 | 10 | # include "print.h" 11 | # include "stdio.h" 12 | 13 | int test2s_c (int _verb) 14 | { 15 | int _retv = 0; 16 | 17 | /*-------------------------------- setup JIGSAW types */ 18 | jigsaw_jig_t _jjig ; 19 | jigsaw_init_jig_t(&_jjig) ; 20 | 21 | jigsaw_msh_t _geom ; 22 | jigsaw_init_msh_t(&_geom) ; 23 | 24 | jigsaw_msh_t _hfun ; 25 | jigsaw_init_msh_t(&_hfun) ; 26 | 27 | jigsaw_msh_t _mesh ; 28 | jigsaw_init_msh_t(&_mesh) ; 29 | 30 | /*-------------------------------- setup JIGSAW geom. */ 31 | 32 | real_t _radii[3] = {+1., +1., +1. 33 | } ; 34 | 35 | _geom._flags = 36 | JIGSAW_ELLIPSOID_MESH ; 37 | 38 | _geom._radii._data = &_radii[0] ; 39 | _geom._radii._size = +3 ; 40 | 41 | /*-------------------------------- setup JIGSAW hfun. */ 42 | 43 | real_t PI = 3.14159265358979323846 ; 44 | 45 | jigsaw_VERT2_t _hfun_vert2[9] = { // setup hfun. 46 | { {-1. * PI, -0.5 * PI}, +0 } , 47 | { {+0. * PI, -0.5 * PI}, +0 } , 48 | { {+1. * PI, -0.5 * PI}, +0 } , 49 | { {-1. * PI, +0.0 * PI}, +0 } , 50 | { {+0. * PI, +0.0 * PI}, +0 } , 51 | { {+1. * PI, +0.0 * PI}, +0 } , 52 | { {-1. * PI, +0.5 * PI}, +0 } , 53 | { {+0. * PI, +0.5 * PI}, +0 } , 54 | { {+1. * PI, +0.5 * PI}, +0 } 55 | } ; 56 | 57 | jigsaw_TRIA3_t _hfun_tria3[8] = { 58 | { {+0, +1, +3}, +0 } , 59 | { {+3, +1, +4}, +0 } , 60 | { {+1, +2, +4}, +0 } , 61 | { {+4, +2, +5}, +0 } , 62 | { {+3, +4, +6}, +0 } , 63 | { {+6, +4, +7}, +0 } , 64 | { {+4, +5, +7}, +0 } , 65 | { {+7, +5, +8}, +0 } 66 | } ; 67 | 68 | fp32_t _hfun_value[9] = { 69 | 1.f, 1.f, 1.f, 1.f, 1.f, 1.f, .5f, 70 | .5f, .5f 71 | } ; 72 | 73 | _hfun._flags 74 | = JIGSAW_ELLIPSOID_MESH; 75 | 76 | _hfun._vert2._data = &_hfun_vert2[0] ; 77 | _hfun._vert2._size = +9 ; 78 | 79 | _hfun._tria3._data = &_hfun_tria3[0] ; 80 | _hfun._tria3._size = +8 ; 81 | 82 | _hfun._value._data = &_hfun_value[0] ; 83 | _hfun._value._size = +9 ; 84 | 85 | /*-------------------------------- build JIGSAW tria. */ 86 | 87 | _jjig._verbosity = _verb; 88 | 89 | _jjig._hfun_scal = 90 | JIGSAW_HFUN_ABSOLUTE; 91 | 92 | _jjig._hfun_hmax = 1. ; 93 | _jjig._hfun_hmin = 0. ; 94 | 95 | _jjig._mesh_dims = +2 ; 96 | 97 | _jjig._mesh_kern = 98 | JIGSAW_KERN_DELAUNAY; 99 | 100 | _retv = jigsaw ( 101 | & _jjig , // the config. opt. 102 | & _geom , // geom. data 103 | NULL , // empty init. obj. 104 | & _hfun , // hfun. data 105 | & _mesh ) ; 106 | 107 | /*-------------------------------- print JIGSAW tria. */ 108 | 109 | if (_verb > 0 ) 110 | output_msh_data_3(&_mesh); 111 | 112 | jigsaw_free_msh_t(&_mesh); 113 | 114 | printf ( 115 | "[2s_c] JIGSAW returned code : %d \n", _retv) ; 116 | 117 | 118 | return _retv ; 119 | } 120 | 121 | # ifndef __SKIP_MAIN__ 122 | int main () { return test2s_c(1) ; } 123 | # endif//__SKIP_MAIN__ 124 | 125 | 126 | 127 | -------------------------------------------------------------------------------- /external/jigsaw/uni/test2s_e.c: -------------------------------------------------------------------------------- 1 | 2 | // gcc -Wall -Wextra test2s_e.c -Xlinker -rpath=../lib 3 | // -L ../lib -ljigsaw -o test2s_e 4 | 5 | // Use JIGSAW to mesh a simple domain in S^2, starting 6 | // from user-defined initial-conditions. 7 | 8 | # include "../inc/lib_jigsaw.h" 9 | 10 | # include "print.h" 11 | # include "stdio.h" 12 | 13 | int test2s_e (int _verb) 14 | { 15 | int _retv = 0; 16 | 17 | /*-------------------------------- setup JIGSAW types */ 18 | jigsaw_jig_t _jjig ; 19 | jigsaw_init_jig_t(&_jjig) ; 20 | 21 | jigsaw_msh_t _geom ; 22 | jigsaw_init_msh_t(&_geom) ; 23 | 24 | jigsaw_msh_t _init ; 25 | jigsaw_init_msh_t(&_init) ; 26 | 27 | jigsaw_msh_t _mesh ; 28 | jigsaw_init_msh_t(&_mesh) ; 29 | 30 | /*-------------------------------- setup JIGSAW geom. */ 31 | 32 | real_t PI = 3.14159265358979323846 ; 33 | 34 | real_t _radii[3] = {+1., +1., +1. 35 | } ; 36 | 37 | _geom._flags = 38 | JIGSAW_ELLIPSOID_MESH ; 39 | 40 | _geom._radii._data = &_radii[0] ; 41 | _geom._radii._size = +3 ; 42 | 43 | /*-------------------------------- setup JIGSAW init. */ 44 | 45 | jigsaw_VERT2_t _init_vert2[8] = { 46 | { {-1.0 * PI, +0.0 * PI}, +0 } , 47 | { {-.33 * PI, +0.0 * PI}, +0 } , 48 | { {+.33 * PI, +0.0 * PI}, +0 } , 49 | { {+1.0 * PI, +0.0 * PI}, +0 } , 50 | { {+0.0 * PI, +0.5 * PI}, +0 } , 51 | { {+0.0 * PI, -0.5 * PI}, +0 } , 52 | { {+0.0 * PI, +.25 * PI}, +0 } , 53 | { {+0.0 * PI, -.25 * PI}, +0 } , 54 | } ; 55 | 56 | jigsaw_EDGE2_t _init_edge2[1] = { 57 | { {+6, +7}, -1 } , // -1 => "un-refinable" 58 | } ; 59 | 60 | _init._flags 61 | = JIGSAW_ELLIPSOID_MESH ; 62 | 63 | _init._radii._data = &_radii[0] ; 64 | _init._radii._size = +3 ; 65 | 66 | _init._vert2._data = &_init_vert2[0] ; 67 | _init._vert2._size = +8 ; 68 | 69 | _init._edge2._data = &_init_edge2[0] ; 70 | _init._edge2._size = +1 ; 71 | 72 | /*-------------------------------- build JIGSAW tria. */ 73 | 74 | _jjig._verbosity = _verb; 75 | 76 | _jjig._hfun_hmax = 1./3.; 77 | _jjig._hfun_scal = 78 | JIGSAW_HFUN_RELATIVE; 79 | 80 | _jjig._mesh_dims = +2 ; 81 | 82 | _retv = jigsaw ( 83 | & _jjig , // the config. opts 84 | & _geom , // geom. data 85 | & _init , // init. data 86 | NULL , // empty hfun. data 87 | & _mesh ) ; 88 | 89 | /*-------------------------------- print JIGSAW tria. */ 90 | 91 | if (_verb > 0 ) 92 | output_msh_data_3(&_mesh); 93 | 94 | jigsaw_free_msh_t(&_mesh); 95 | 96 | printf ( 97 | "[2s_e] JIGSAW returned code : %d \n", _retv) ; 98 | 99 | 100 | return _retv ; 101 | } 102 | 103 | # ifndef __SKIP_MAIN__ 104 | int main () { return test2s_e(1) ; } 105 | # endif//__SKIP_MAIN__ 106 | 107 | 108 | 109 | -------------------------------------------------------------------------------- /external/jigsaw/uni/test2s_f.c: -------------------------------------------------------------------------------- 1 | 2 | // gcc -Wall -Wextra test2s_f.c -Xlinker -rpath=../lib 3 | // -L ../lib -ljigsaw -o test2s_f 4 | 5 | // Uses TRIPOD to build a "restricted" DT, given a set 6 | // points and a geometry in S^2. Compared to JIGSAW, 7 | // TRIPOD computes a "restricted" triangulation (given 8 | // a set of points a priori), rather than generating a 9 | // mesh dynamically. 10 | 11 | # include "../inc/lib_jigsaw.h" 12 | 13 | # include "print.h" 14 | # include "stdio.h" 15 | 16 | int test2s_f (int _verb) 17 | { 18 | int _retv = 0; 19 | 20 | /*-------------------------------- setup JIGSAW types */ 21 | jigsaw_jig_t _jjig ; 22 | jigsaw_init_jig_t(&_jjig) ; 23 | 24 | jigsaw_msh_t _geom ; 25 | jigsaw_init_msh_t(&_geom) ; 26 | 27 | jigsaw_msh_t _init ; 28 | jigsaw_init_msh_t(&_init) ; 29 | 30 | jigsaw_msh_t _tria ; 31 | jigsaw_init_msh_t(&_tria) ; 32 | 33 | /*-------------------------------- setup JIGSAW geom. */ 34 | 35 | real_t PI = 3.14159265358979323846 ; 36 | 37 | jigsaw_VERT2_t _point[6] = { 38 | { {0., -0.5 * PI}, +0 } , 39 | { {0., +0.5 * PI}, +0 } , 40 | { {-1.0 * PI, 0.}, +0 } , 41 | { {-0.5 * PI, 0.}, +0 } , 42 | { {+0.0 * PI, 0.}, +0 } , 43 | { {+0.5 * PI, 0.}, +0 } , 44 | } ; 45 | 46 | jigsaw_EDGE2_t _edges[4] = { 47 | { {2, 3}, +1} , 48 | { {3, 4}, +2} , 49 | { {4, 5}, +3} , 50 | { {5, 2}, +4} , 51 | } ; 52 | 53 | real_t _radii[3] = {+1., +1., +1. 54 | } ; 55 | 56 | _geom._flags = 57 | JIGSAW_ELLIPSOID_MESH ; 58 | 59 | _geom._radii._data = &_radii[0] ; 60 | _geom._radii._size = +3 ; 61 | 62 | _geom._vert2._data = &_point[0] ; 63 | _geom._vert2._size = +6 ; 64 | 65 | _geom._edge2._data = &_edges[0] ; 66 | _geom._edge2._size = +4 ; 67 | 68 | /*-------------------------------- form init. config. */ 69 | 70 | _init._flags 71 | = JIGSAW_ELLIPSOID_MESH; 72 | 73 | _init._radii._data = &_radii[0] ; 74 | _init._radii._size = +3 ; 75 | 76 | _init._vert2._data = &_point[0] ; 77 | _init._vert2._size = +6 ; 78 | 79 | /*-------------------------------- build TRIPOD r-DT. */ 80 | 81 | _jjig._verbosity = _verb; 82 | 83 | _jjig._mesh_dims = +2 ; 84 | 85 | _retv = tripod ( 86 | & _jjig , // the config. opts 87 | & _init , // init. data 88 | & _geom , // geom. data 89 | & _tria ) ; 90 | 91 | /*-------------------------------- print TRIPOD r-DT. */ 92 | 93 | if (_verb > 0 ) 94 | output_msh_data_3(&_tria); 95 | 96 | jigsaw_free_msh_t(&_tria); 97 | 98 | printf ( 99 | "[2s_f] TRIPOD returned code : %d \n", _retv) ; 100 | 101 | 102 | return _retv ; 103 | } 104 | 105 | # ifndef __SKIP_MAIN__ 106 | int main () { return test2s_f(1) ; } 107 | # endif//__SKIP_MAIN__ 108 | 109 | 110 | 111 | -------------------------------------------------------------------------------- /external/jigsaw/uni/test2s_g.c: -------------------------------------------------------------------------------- 1 | 2 | // gcc -Wall -Wextra test2s_g.c -Xlinker -rpath=../lib 3 | // -L ../lib -ljigsaw -o test2s_g 4 | 5 | // Uses TRIPOD to build an (unconstrained) DT in S^2, 6 | // comparable to more conventional Delaunay tessellation 7 | // approaches. 8 | 9 | # include "../inc/lib_jigsaw.h" 10 | 11 | # include "print.h" 12 | # include "stdio.h" 13 | 14 | int test2s_g (int _verb) 15 | { 16 | int _retv = 0; 17 | 18 | /*-------------------------------- setup JIGSAW types */ 19 | jigsaw_jig_t _jjig ; 20 | jigsaw_init_jig_t(&_jjig) ; 21 | 22 | jigsaw_msh_t _geom ; 23 | jigsaw_init_msh_t(&_geom) ; 24 | 25 | jigsaw_msh_t _init ; 26 | jigsaw_init_msh_t(&_init) ; 27 | 28 | jigsaw_msh_t _tria ; 29 | jigsaw_init_msh_t(&_tria) ; 30 | 31 | /*-------------------------------- setup JIGSAW geom. */ 32 | 33 | real_t _radii[3] = {+1., +1., +1. 34 | } ; 35 | 36 | _geom._flags = 37 | JIGSAW_ELLIPSOID_MESH ; 38 | 39 | _geom._radii._data = &_radii[0] ; 40 | _geom._radii._size = +3 ; 41 | 42 | /*-------------------------------- pts to triangulate */ 43 | 44 | real_t PI = 3.14159265358979323846 ; 45 | indx_t _next = 0; 46 | 47 | jigsaw_VERT2_t _point[45] ; 48 | 49 | for (size_t _ipos = 0; _ipos < 9; ++_ipos) 50 | for (size_t _jpos = 0; _jpos < 5; ++_jpos) 51 | { 52 | _point[_next]._ppos[0] = 53 | -0.80 * PI + _ipos * 0.20 * PI ; 54 | _point[_next]._ppos[1] = 55 | -0.40 * PI + _jpos * 0.20 * PI ; 56 | 57 | _point[_next]._itag = +0 ; 58 | 59 | _next += +1; 60 | } 61 | 62 | _init._flags 63 | = JIGSAW_ELLIPSOID_MESH; 64 | 65 | _init._radii._data = &_radii[0] ; 66 | _init._radii._size = +3 ; 67 | 68 | _init._vert2._data = &_point[0] ; 69 | _init._vert2._size = +45; 70 | 71 | /*-------------------------------- build TRIPOD r-DT. */ 72 | 73 | _jjig._verbosity = _verb; 74 | 75 | _jjig._mesh_dims = +2 ; 76 | 77 | _retv = tripod ( 78 | & _jjig , // the config. opts 79 | & _init , // init. data 80 | & _geom , // geom. data 81 | & _tria ) ; 82 | 83 | /*-------------------------------- print TRIPOD r-DT. */ 84 | 85 | if (_verb > 0 ) 86 | output_msh_data_3(&_tria); 87 | 88 | jigsaw_free_msh_t(&_tria); 89 | 90 | printf ( 91 | "[2s_g] TRIPOD returned code : %d \n", _retv) ; 92 | 93 | 94 | return _retv ; 95 | } 96 | 97 | # ifndef __SKIP_MAIN__ 98 | int main () { return test2s_g(1) ; } 99 | # endif//__SKIP_MAIN__ 100 | 101 | 102 | 103 | -------------------------------------------------------------------------------- /external/jigsaw/uni/test2s_h.c: -------------------------------------------------------------------------------- 1 | 2 | // gcc -Wall -Wextra test2s_h.c -Xlinker -rpath=../lib 3 | // -L ../lib -ljigsaw -o test2s_h 4 | 5 | // Use MARCHE to set "gradient-limits" on mesh-spacing data 6 | // 7 | // ensures: |GRAD(h)| <= slope_limit(x), 8 | // 9 | // via a "fast-marching" solver for the Hamilton-Jacobi eq. 10 | 11 | # include "../inc/lib_jigsaw.h" 12 | 13 | # include "print.h" 14 | # include "stdio.h" 15 | 16 | int test2s_h (int _verb) 17 | { 18 | int _retv = 0; 19 | 20 | /*-------------------------------- setup JIGSAW types */ 21 | jigsaw_jig_t _jjig ; 22 | jigsaw_init_jig_t(&_jjig) ; 23 | 24 | jigsaw_msh_t _hfun ; 25 | jigsaw_init_msh_t(&_hfun) ; 26 | 27 | /*-------------------------------- setup JIGSAW hfun. */ 28 | 29 | real_t PI = 3.14159265358979323846 ; 30 | 31 | real_t _radii[3] = {+1., +1., +1. 32 | } ; 33 | 34 | real_t _hfun_xgrid[3] = { 35 | -1.0 * PI, 0.0 * PI, +1.0 * PI 36 | } ; 37 | 38 | real_t _hfun_ygrid[3] = { 39 | -0.5 * PI, 0.0 * PI, +0.5 * PI 40 | } ; 41 | 42 | fp32_t _hfun_value[9] = { 43 | 2.f, 2.f, 2.f, 2.f, 1.f, 2.f, 2.f, 44 | 2.f, 2.f 45 | } ; 46 | 47 | fp32_t _hfun_slope[9] = { 48 | .4f, .4f, .4f, .4f, .1f, .4f, .4f, 49 | .4f, .4f 50 | } ; 51 | 52 | _hfun._flags = 53 | JIGSAW_ELLIPSOID_GRID ; 54 | 55 | _hfun._radii._data = &_radii[0] ; 56 | _hfun._radii._size = +3 ; 57 | 58 | _hfun._xgrid._data = &_hfun_xgrid[0] ; 59 | _hfun._xgrid._size = +3 ; 60 | 61 | _hfun._ygrid._data = &_hfun_ygrid[0] ; 62 | _hfun._ygrid._size = +3 ; 63 | 64 | _hfun._value._data = &_hfun_value[0] ; 65 | _hfun._value._size = +9 ; 66 | 67 | _hfun._slope._data = &_hfun_slope[0] ; 68 | _hfun._slope._size = +9 ; 69 | 70 | /*-------------------------------- build MARCHE hfun. */ 71 | 72 | _jjig._verbosity = _verb; 73 | 74 | _retv = marche ( 75 | & _jjig , // the config. opts 76 | & _hfun ) ; // the spacing h(x) 77 | 78 | /*-------------------------------- print MARCHE hfun. */ 79 | 80 | if (_verb > 0 ) 81 | { 82 | printf("\n VALUE: \n\n") ; 83 | 84 | for (size_t _ipos = +0; 85 | _ipos != _hfun._value._size ; 86 | ++_ipos ) 87 | { 88 | printf("%1.4f\n", 89 | _hfun._value._data[_ipos] 90 | ) ; 91 | } 92 | } 93 | 94 | printf ( 95 | "[2s_h] MARCHE returned code : %d \n", _retv) ; 96 | 97 | 98 | return _retv ; 99 | } 100 | 101 | # ifndef __SKIP_MAIN__ 102 | int main () { return test2s_h(1) ; } 103 | # endif//__SKIP_MAIN__ 104 | 105 | 106 | 107 | -------------------------------------------------------------------------------- /external/jigsaw/uni/test2s_i.c: -------------------------------------------------------------------------------- 1 | 2 | // gcc -Wall -Wextra test2s_i.c -Xlinker -rpath=../lib 3 | // -L ../lib -ljigsaw -o test2s_i 4 | 5 | // Use MARCHE to set "gradient-limits" on mesh-spacing data 6 | // 7 | // ensures: |GRAD(h)| <= slope_limit(x), 8 | // 9 | // via a "fast-marching" solver for the Hamilton-Jacobi eq. 10 | 11 | # include "../inc/lib_jigsaw.h" 12 | 13 | # include "print.h" 14 | # include "stdio.h" 15 | 16 | int test2s_i (int _verb) 17 | { 18 | int _retv = 0; 19 | 20 | /*-------------------------------- setup JIGSAW types */ 21 | jigsaw_jig_t _jjig ; 22 | jigsaw_init_jig_t(&_jjig) ; 23 | 24 | jigsaw_msh_t _hfun ; 25 | jigsaw_init_msh_t(&_hfun) ; 26 | 27 | /*-------------------------------- setup JIGSAW hfun. */ 28 | 29 | real_t PI = 3.14159265358979323846 ; 30 | 31 | real_t _radii[3] = {+1., +1., +1. 32 | } ; 33 | 34 | jigsaw_VERT2_t _hfun_vert2[6] = { 35 | { {-1.0 * PI, +0.0 * PI}, +0 } , 36 | { {-.33 * PI, +0.0 * PI}, +0 } , 37 | { {+.33 * PI, +0.0 * PI}, +0 } , 38 | { {+1.0 * PI, +0.0 * PI}, +0 } , 39 | { {+0.0 * PI, +0.5 * PI}, +0 } , 40 | { {+0.0 * PI, -0.5 * PI}, +0 } , 41 | } ; 42 | 43 | jigsaw_TRIA3_t _hfun_tria3[6] = { 44 | { {+0, +1, +4}, +0 } , 45 | { {+1, +2, +4}, +0 } , 46 | { {+2, +3, +4}, +0 } , 47 | { {+1, +0, +5}, +0 } , 48 | { {+2, +1, +5}, +0 } , 49 | { {+3, +2, +5}, +0 } , 50 | } ; 51 | 52 | fp32_t _hfun_value[6] = { 53 | 2.f, 2.f, 2.f, 2.f, 1.f, 2.f 54 | } ; 55 | 56 | fp32_t _hfun_slope[1] = { 57 | .1f 58 | } ; 59 | 60 | _hfun._flags 61 | = JIGSAW_ELLIPSOID_MESH; 62 | 63 | _hfun._radii._data = &_radii[0] ; 64 | _hfun._radii._size = +3 ; 65 | 66 | _hfun._vert2._data = &_hfun_vert2[0] ; 67 | _hfun._vert2._size = +6 ; 68 | 69 | _hfun._tria3._data = &_hfun_tria3[0] ; 70 | _hfun._tria3._size = +6 ; 71 | 72 | _hfun._value._data = &_hfun_value[0] ; 73 | _hfun._value._size = +6 ; 74 | 75 | _hfun._slope._data = &_hfun_slope[0] ; 76 | _hfun._slope._size = +1 ; 77 | 78 | 79 | /*-------------------------------- build MARCHE hfun. */ 80 | 81 | _jjig._verbosity = _verb; 82 | 83 | _retv = marche ( 84 | & _jjig , // the config. opts 85 | & _hfun ) ; // the spacing h(x) 86 | 87 | /*-------------------------------- print MARCHE hfun. */ 88 | 89 | if (_verb > 0 ) 90 | { 91 | printf("\n VALUE: \n\n") ; 92 | 93 | for (size_t _ipos = +0; 94 | _ipos != _hfun._value._size ; 95 | ++_ipos ) 96 | { 97 | printf("%1.4f\n", 98 | _hfun._value._data[_ipos] 99 | ) ; 100 | } 101 | } 102 | 103 | printf ( 104 | "[2s_i] MARCHE returned code : %d \n", _retv) ; 105 | 106 | 107 | return _retv ; 108 | } 109 | 110 | # ifndef __SKIP_MAIN__ 111 | int main () { return test2s_i(1) ; } 112 | # endif//__SKIP_MAIN__ 113 | 114 | 115 | 116 | -------------------------------------------------------------------------------- /external/jigsaw/uni/test3d_a.c: -------------------------------------------------------------------------------- 1 | 2 | // gcc -Wall -Wextra test3d_a.c -Xlinker -rpath=../lib 3 | // -L ../lib -ljigsaw -o test3d_a 4 | 5 | // A simple example to start: use JIGSAW to mesh a plain 6 | // domain in E^3. 7 | 8 | # include "../inc/lib_jigsaw.h" 9 | 10 | # include "print.h" 11 | # include "stdio.h" 12 | 13 | int test3d_a (int _verb) 14 | { 15 | int _retv = 0; 16 | 17 | /*-------------------------------- setup JIGSAW types */ 18 | jigsaw_jig_t _jjig ; 19 | jigsaw_init_jig_t(&_jjig) ; 20 | 21 | jigsaw_msh_t _geom ; 22 | jigsaw_init_msh_t(&_geom) ; 23 | 24 | jigsaw_msh_t _mesh ; 25 | jigsaw_init_msh_t(&_mesh) ; 26 | 27 | /*-------------------------------- setup JIGSAW geom. */ 28 | 29 | jigsaw_VERT3_t _vert3[8] = { // setup geom. 30 | { {0., 0., 0.}, +0 } , 31 | { {1., 0., 0.}, +0 } , 32 | { {1., 1., 0.}, +0 } , 33 | { {0., 1., 0.}, +0 } , 34 | { {0., 0., 1.}, +0 } , 35 | { {1., 0., 1.}, +0 } , 36 | { {1., 1., 1.}, +0 } , 37 | { {0., 1., 1.}, +0 } 38 | } ; 39 | 40 | jigsaw_TRIA3_t _tria3[12] = { 41 | { {+0, +1, +2}, +0 } , 42 | { {+0, +2, +3}, +0 } , 43 | { {+4, +5, +6}, +0 } , 44 | { {+4, +6, +7}, +0 } , 45 | { {+0, +1, +5}, +0 } , 46 | { {+0, +5, +4}, +0 } , 47 | { {+1, +2, +6}, +0 } , 48 | { {+1, +6, +5}, +0 } , 49 | { {+2, +3, +7}, +0 } , 50 | { {+2, +7, +6}, +0 } , 51 | { {+3, +7, +4}, +0 } , 52 | { {+3, +4, +0}, +0 } 53 | } ; 54 | 55 | _geom._flags 56 | = JIGSAW_EUCLIDEAN_MESH; 57 | 58 | _geom._vert3._data = &_vert3[0] ; 59 | _geom._vert3._size = +8 ; 60 | 61 | _geom._tria3._data = &_tria3[0] ; 62 | _geom._tria3._size = +12; 63 | 64 | /*-------------------------------- build JIGSAW tria. */ 65 | 66 | _jjig._verbosity = _verb; 67 | 68 | _jjig._hfun_hmax = .675 ; // uniform spacing 69 | _jjig._hfun_scal = 70 | JIGSAW_HFUN_RELATIVE; 71 | 72 | _jjig._geom_feat = +1 ; // do "sharp" geom. 73 | _jjig._mesh_top1 = +1 ; 74 | 75 | _jjig._mesh_dims = +3 ; // make 3-dim cell 76 | 77 | _retv = jigsaw ( 78 | & _jjig , // the config. opt. 79 | & _geom , // geom. data 80 | NULL , // empty init. obj. 81 | NULL , // empty hfun. obj. 82 | & _mesh ) ; 83 | 84 | /*-------------------------------- print JIGSAW tria. */ 85 | 86 | if (_verb > 0 ) 87 | output_msh_data_3(&_mesh); 88 | 89 | jigsaw_free_msh_t(&_mesh); 90 | 91 | printf ( 92 | "[3d_a] JIGSAW returned code : %d \n", _retv) ; 93 | 94 | 95 | return _retv ; 96 | } 97 | 98 | # ifndef __SKIP_MAIN__ 99 | int main () { return test3d_a(1) ; } 100 | # endif//__SKIP_MAIN__ 101 | 102 | 103 | 104 | -------------------------------------------------------------------------------- /external/jigsaw/uni/test3d_b.c: -------------------------------------------------------------------------------- 1 | 2 | // gcc -Wall -Wextra test3d_b.c -Xlinker -rpath=../lib 3 | // -L ../lib -ljigsaw -o test3d_b 4 | 5 | // Use JIGSAW to mesh a simple geometry with user-defined 6 | // mesh-spacing data defined on a "grid" in E^3. 7 | 8 | # include "../inc/lib_jigsaw.h" 9 | 10 | # include "print.h" 11 | # include "stdio.h" 12 | 13 | int test3d_b (int _verb) 14 | { 15 | int _retv = 0; 16 | 17 | /*-------------------------------- setup JIGSAW types */ 18 | jigsaw_jig_t _jjig ; 19 | jigsaw_init_jig_t(&_jjig) ; 20 | 21 | jigsaw_msh_t _geom ; 22 | jigsaw_init_msh_t(&_geom) ; 23 | 24 | jigsaw_msh_t _hfun ; 25 | jigsaw_init_msh_t(&_hfun) ; 26 | 27 | jigsaw_msh_t _mesh ; 28 | jigsaw_init_msh_t(&_mesh) ; 29 | 30 | /*-------------------------------- setup JIGSAW geom. */ 31 | 32 | jigsaw_VERT3_t _vert3[8] = { // setup geom. 33 | { {0., 0., 0.}, +0 } , 34 | { {1., 0., 0.}, +0 } , 35 | { {1., 1., 0.}, +0 } , 36 | { {0., 1., 0.}, +0 } , 37 | { {0., 0., 1.}, +0 } , 38 | { {1., 0., 1.}, +0 } , 39 | { {1., 1., 1.}, +0 } , 40 | { {0., 1., 1.}, +0 } 41 | } ; 42 | 43 | jigsaw_TRIA3_t _tria3[12] = { 44 | { {+0, +1, +2}, +0 } , 45 | { {+0, +2, +3}, +0 } , 46 | { {+4, +5, +6}, +0 } , 47 | { {+4, +6, +7}, +0 } , 48 | { {+0, +1, +5}, +0 } , 49 | { {+0, +5, +4}, +0 } , 50 | { {+1, +2, +6}, +0 } , 51 | { {+1, +6, +5}, +0 } , 52 | { {+2, +3, +7}, +0 } , 53 | { {+2, +7, +6}, +0 } , 54 | { {+3, +7, +4}, +0 } , 55 | { {+3, +4, +0}, +0 } 56 | } ; 57 | 58 | _geom._flags 59 | = JIGSAW_EUCLIDEAN_MESH; 60 | 61 | _geom._vert3._data = &_vert3[0] ; 62 | _geom._vert3._size = +8 ; 63 | 64 | _geom._tria3._data = &_tria3[0] ; 65 | _geom._tria3._size = +12; 66 | 67 | /*-------------------------------- setup JIGSAW hfun. */ 68 | 69 | real_t _hfun_xgrid[2] = { // setup hfun. 70 | 0., 1. 71 | } ; 72 | 73 | real_t _hfun_ygrid[2] = { 74 | 0., 1. 75 | } ; 76 | 77 | real_t _hfun_zgrid[2] = { 78 | 0., 1. 79 | } ; 80 | 81 | fp32_t _hfun_value[8] = { 82 | .6f, .6f, .6f, .6f, 83 | .3f, .3f, .3f, .3f 84 | } ; 85 | 86 | _hfun._flags 87 | = JIGSAW_EUCLIDEAN_GRID; 88 | 89 | _hfun._xgrid._data = &_hfun_xgrid[0] ; 90 | _hfun._xgrid._size = +2 ; 91 | 92 | _hfun._ygrid._data = &_hfun_ygrid[0] ; 93 | _hfun._ygrid._size = +2 ; 94 | 95 | _hfun._zgrid._data = &_hfun_zgrid[0] ; 96 | _hfun._zgrid._size = +2 ; 97 | 98 | _hfun._value._data = &_hfun_value[0] ; 99 | _hfun._value._size = +8 ; 100 | 101 | /*-------------------------------- build JIGSAW tria. */ 102 | 103 | _jjig._verbosity = _verb; 104 | 105 | _jjig._hfun_scal = 106 | JIGSAW_HFUN_ABSOLUTE; 107 | 108 | _jjig._hfun_hmax = 1. ; 109 | _jjig._hfun_hmin = 0. ; 110 | 111 | _jjig._geom_feat = +1 ; // do "sharp" geom. 112 | _jjig._mesh_top1 = +1 ; 113 | 114 | _jjig._mesh_dims = +3 ; // make 3-dim cell 115 | 116 | _retv = jigsaw ( 117 | & _jjig , // the config. opt. 118 | & _geom , // geom. data 119 | NULL , // empty init. obj. 120 | & _hfun , // hfun. data 121 | & _mesh ) ; 122 | 123 | /*-------------------------------- print JIGSAW tria. */ 124 | 125 | if (_verb > 0 ) 126 | output_msh_data_3(&_mesh); 127 | 128 | jigsaw_free_msh_t(&_mesh); 129 | 130 | printf ( 131 | "[3d_b] JIGSAW returned code : %d \n", _retv) ; 132 | 133 | 134 | return _retv ; 135 | } 136 | 137 | # ifndef __SKIP_MAIN__ 138 | int main () { return test3d_b(1) ; } 139 | # endif//__SKIP_MAIN__ 140 | 141 | 142 | 143 | -------------------------------------------------------------------------------- /external/jigsaw/uni/test3d_c.c: -------------------------------------------------------------------------------- 1 | 2 | // gcc -Wall -Wextra test3d_c.c -Xlinker -rpath=../lib 3 | // -L ../lib -ljigsaw -o test3d_c 4 | 5 | // Use JIGSAW to mesh a simple geometry with user-defined 6 | // mesh-spacing data defined on a "mesh" in E^3. 7 | 8 | # include "../inc/lib_jigsaw.h" 9 | 10 | # include "print.h" 11 | # include "stdio.h" 12 | 13 | int test3d_c (int _verb) 14 | { 15 | int _retv = 0; 16 | 17 | /*-------------------------------- setup JIGSAW types */ 18 | jigsaw_jig_t _jjig ; 19 | jigsaw_init_jig_t(&_jjig) ; 20 | 21 | jigsaw_msh_t _geom ; 22 | jigsaw_init_msh_t(&_geom) ; 23 | 24 | jigsaw_msh_t _hfun ; 25 | jigsaw_init_msh_t(&_hfun) ; 26 | 27 | jigsaw_msh_t _mesh ; 28 | jigsaw_init_msh_t(&_mesh) ; 29 | 30 | /*-------------------------------- setup JIGSAW geom. */ 31 | 32 | jigsaw_VERT3_t _geom_vert3[8] = { // setup geom. 33 | { {0., 0., 0.}, +0 } , 34 | { {1., 0., 0.}, +0 } , 35 | { {1., 1., 0.}, +0 } , 36 | { {0., 1., 0.}, +0 } , 37 | { {0., 0., 1.}, +0 } , 38 | { {1., 0., 1.}, +0 } , 39 | { {1., 1., 1.}, +0 } , 40 | { {0., 1., 1.}, +0 } 41 | } ; 42 | 43 | jigsaw_TRIA3_t _geom_tria3[12] = { 44 | { {+0, +1, +2}, +0 } , 45 | { {+0, +2, +3}, +0 } , 46 | { {+4, +5, +6}, +0 } , 47 | { {+4, +6, +7}, +0 } , 48 | { {+0, +1, +5}, +0 } , 49 | { {+0, +5, +4}, +0 } , 50 | { {+1, +2, +6}, +0 } , 51 | { {+1, +6, +5}, +0 } , 52 | { {+2, +3, +7}, +0 } , 53 | { {+2, +7, +6}, +0 } , 54 | { {+3, +7, +4}, +0 } , 55 | { {+3, +4, +0}, +0 } 56 | } ; 57 | 58 | _geom._flags 59 | = JIGSAW_EUCLIDEAN_MESH; 60 | 61 | _geom._vert3._data = &_geom_vert3[0] ; 62 | _geom._vert3._size = +8 ; 63 | 64 | _geom._tria3._data = &_geom_tria3[0] ; 65 | _geom._tria3._size = +12; 66 | 67 | /*-------------------------------- setup JIGSAW hfun. */ 68 | 69 | jigsaw_VERT3_t _hfun_vert3[9] = { // setup hfun. 70 | { {.5, .5, 0.}, +0 } , 71 | { {0., 0., 0.}, +0 } , 72 | { {1., 0., 0.}, +0 } , 73 | { {1., 1., 0.}, +0 } , 74 | { {0., 1., 0.}, +0 } , 75 | { {0., 0., 1.}, +0 } , 76 | { {1., 0., 1.}, +0 } , 77 | { {1., 1., 1.}, +0 } , 78 | { {0., 1., 1.}, +0 } , 79 | } ; 80 | 81 | jigsaw_TRIA4_t _hfun_tria4[10] = { 82 | { {0, 5, 2, 1}, +0 } , 83 | { {0, 6, 5, 2}, +0 } , 84 | { {7, 0, 6, 2}, +0 } , 85 | { {7, 0, 3, 2}, +0 } , 86 | { {8, 0, 5, 1}, +0 } , 87 | { {8, 0, 4, 1}, +0 } , 88 | { {8, 0, 6, 5}, +0 } , 89 | { {8, 7, 0, 6}, +0 } , 90 | { {8, 0, 4, 3}, +0 } , 91 | { {8, 7, 0, 3}, +0 } , 92 | } ; 93 | 94 | fp32_t _hfun_value[9]= { 95 | .5f, .5f, .5f, .5f, .5f, 96 | 1.f, 1.f, 1.f, 1.f 97 | } ; 98 | 99 | _hfun._flags 100 | = JIGSAW_EUCLIDEAN_MESH; 101 | 102 | _hfun._vert3._data = &_hfun_vert3[0] ; 103 | _hfun._vert3._size = +9 ; 104 | 105 | _hfun._tria4._data = &_hfun_tria4[0] ; 106 | _hfun._tria4._size = +10; 107 | 108 | _hfun._value._data = &_hfun_value[0] ; 109 | _hfun._value._size = +9 ; 110 | 111 | /*-------------------------------- build JIGSAW tria. */ 112 | 113 | _jjig._verbosity = _verb; 114 | 115 | _jjig._hfun_scal = 116 | JIGSAW_HFUN_ABSOLUTE; 117 | 118 | _jjig._hfun_hmax = 1. ; 119 | _jjig._hfun_hmin = 0. ; 120 | 121 | _jjig._geom_feat = +1 ; // do "sharp" geom. 122 | _jjig._mesh_top1 = +1 ; 123 | 124 | _jjig._mesh_dims = +3 ; // make 3-dim cell 125 | 126 | _jjig._mesh_kern = // non-default opts 127 | JIGSAW_KERN_DELAUNAY; 128 | _jjig._optm_kern = 129 | JIGSAW_KERN_CVT_DQDX; 130 | _jjig._optm_cost = 131 | JIGSAW_KERN_SKEW_COS; 132 | 133 | _retv = jigsaw ( 134 | & _jjig , // the config. opt. 135 | & _geom , // geom. data 136 | NULL , // empty init. obj. 137 | & _hfun , // hfun. data 138 | & _mesh ) ; 139 | 140 | /*-------------------------------- print JIGSAW tria. */ 141 | 142 | if (_verb > 0 ) 143 | output_msh_data_3(&_mesh); 144 | 145 | jigsaw_free_msh_t(&_mesh); 146 | 147 | printf ( 148 | "[3d_c] JIGSAW returned code : %d \n", _retv) ; 149 | 150 | 151 | return _retv ; 152 | } 153 | 154 | # ifndef __SKIP_MAIN__ 155 | int main () { return test3d_c(1) ; } 156 | # endif//__SKIP_MAIN__ 157 | 158 | 159 | 160 | -------------------------------------------------------------------------------- /external/jigsaw/uni/test3d_e.c: -------------------------------------------------------------------------------- 1 | 2 | // gcc -Wall -Wextra test3d_e.c -Xlinker -rpath=../lib 3 | // -L ../lib -ljigsaw -o test3d_e 4 | 5 | // Use JIGSAW to mesh a simple domain in E^3, starting 6 | // from user-defined initial-conditions. 7 | 8 | # include "../inc/lib_jigsaw.h" 9 | 10 | # include "print.h" 11 | # include "stdio.h" 12 | 13 | int test3d_e (int _verb) 14 | { 15 | int _retv = 0; 16 | 17 | /*-------------------------------- setup JIGSAW types */ 18 | jigsaw_jig_t _jjig ; 19 | jigsaw_init_jig_t(&_jjig) ; 20 | 21 | jigsaw_msh_t _geom ; 22 | jigsaw_init_msh_t(&_geom) ; 23 | 24 | jigsaw_msh_t _init ; 25 | jigsaw_init_msh_t(&_init) ; 26 | 27 | jigsaw_msh_t _mesh ; 28 | jigsaw_init_msh_t(&_mesh) ; 29 | 30 | /*-------------------------------- setup JIGSAW geom. */ 31 | 32 | jigsaw_VERT3_t _geom_vert3[8] = { // setup geom. 33 | { {0., 0., 0.}, +0 } , 34 | { {3., 0., 0.}, +0 } , 35 | { {3., 3., 0.}, +0 } , 36 | { {0., 3., 0.}, +0 } , 37 | { {0., 0., 3.}, +0 } , 38 | { {3., 0., 3.}, +0 } , 39 | { {3., 3., 3.}, +0 } , 40 | { {0., 3., 3.}, +0 } , 41 | } ; 42 | 43 | jigsaw_TRIA3_t _geom_tria3[12] = { 44 | { { 0, 1, 2}, +0 } , 45 | { { 0, 2, 3}, +0 } , 46 | { { 4, 5, 6}, +0 } , 47 | { { 4, 6, 7}, +0 } , 48 | { { 0, 1, 5}, +0 } , 49 | { { 0, 5, 4}, +0 } , 50 | { { 1, 2, 6}, +0 } , 51 | { { 1, 6, 5}, +0 } , 52 | { { 2, 3, 7}, +0 } , 53 | { { 2, 7, 6}, +0 } , 54 | { { 3, 7, 4}, +0 } , 55 | { { 3, 4, 0}, +0 } , 56 | } ; 57 | 58 | _geom._flags 59 | = JIGSAW_EUCLIDEAN_MESH; 60 | 61 | _geom._vert3._data = &_geom_vert3[0] ; 62 | _geom._vert3._size = +8 ; 63 | 64 | _geom._tria3._data = &_geom_tria3[0] ; 65 | _geom._tria3._size = +12; 66 | 67 | /*-------------------------------- form init. config. */ 68 | 69 | jigsaw_VERT3_t _init_vert3[2] = { 70 | { {0., 1.5, 1.25}, +0 } , 71 | { {0., 1.5, 1.75}, +0 } , 72 | } ; 73 | 74 | jigsaw_EDGE2_t _init_edge2[1] = { 75 | { {+0, +1}, -1 } , // -1 => "un-refinable" 76 | } ; 77 | 78 | _init._flags 79 | = JIGSAW_EUCLIDEAN_MESH; 80 | 81 | _init._vert3._data = &_init_vert3[0] ; 82 | _init._vert3._size = +2 ; 83 | 84 | _init._edge2._data = &_init_edge2[0] ; 85 | _init._edge2._size = +1 ; 86 | 87 | /*-------------------------------- build JIGSAW tria. */ 88 | 89 | _jjig._verbosity = _verb; 90 | 91 | _jjig._hfun_hmax = 1./1.; 92 | _jjig._hfun_scal = 93 | JIGSAW_HFUN_RELATIVE; 94 | 95 | _jjig._mesh_rad2 = 1.50 ; 96 | _jjig._mesh_rad3 = 2.50 ; 97 | 98 | _jjig._geom_feat = +1 ; // do "sharp" geom. 99 | _jjig._mesh_top1 = +1 ; 100 | 101 | _jjig._mesh_dims = +3 ; // make 3-dim cell 102 | 103 | _retv = jigsaw ( 104 | & _jjig , // the config. opt. 105 | & _geom , // geom. data 106 | & _init , // init. data 107 | NULL , // empty hfun. obj. 108 | & _mesh ) ; 109 | 110 | /*-------------------------------- print JIGSAW tria. */ 111 | 112 | if (_verb > 0 ) 113 | output_msh_data_3(&_mesh); 114 | 115 | jigsaw_free_msh_t(&_mesh); 116 | 117 | printf ( 118 | "[3d_e] JIGSAW returned code : %d \n", _retv) ; 119 | 120 | 121 | return _retv ; 122 | } 123 | 124 | # ifndef __SKIP_MAIN__ 125 | int main () { return test3d_e(1) ; } 126 | # endif//__SKIP_MAIN__ 127 | 128 | 129 | 130 | -------------------------------------------------------------------------------- /external/jigsaw/uni/test3d_f.c: -------------------------------------------------------------------------------- 1 | 2 | // gcc -Wall -Wextra test3d_f.c -Xlinker -rpath=../lib 3 | // -L ../lib -ljigsaw -o test3d_f 4 | 5 | // Uses TRIPOD to build a "restricted" DT, given a set 6 | // points and a geometry in E^3. Compared to JIGSAW, 7 | // TRIPOD computes a "restricted" triangulation (given 8 | // a set of points a priori), rather than generating a 9 | // mesh dynamically. 10 | 11 | # include "../inc/lib_jigsaw.h" 12 | 13 | # include "print.h" 14 | # include "stdio.h" 15 | 16 | int test3d_f (int _verb) 17 | { 18 | int _retv = 0; 19 | 20 | /*-------------------------------- setup JIGSAW types */ 21 | jigsaw_jig_t _jjig ; 22 | jigsaw_init_jig_t(&_jjig) ; 23 | 24 | jigsaw_msh_t _geom ; 25 | jigsaw_init_msh_t(&_geom) ; 26 | 27 | jigsaw_msh_t _init ; 28 | jigsaw_init_msh_t(&_init) ; 29 | 30 | jigsaw_msh_t _tria ; 31 | jigsaw_init_msh_t(&_tria) ; 32 | 33 | /*-------------------------------- setup JIGSAW geom. */ 34 | 35 | jigsaw_VERT3_t _geom_vert3[8] = { // setup geom. 36 | { {0., 0., 0.}, +0 } , 37 | { {5., 0., 0.}, +0 } , 38 | { {5., 5., 0.}, +0 } , 39 | { {0., 5., 0.}, +0 } , 40 | { {0., 0., 5.}, +0 } , 41 | { {5., 0., 5.}, +0 } , 42 | { {5., 5., 5.}, +0 } , 43 | { {0., 5., 5.}, +0 } , 44 | } ; 45 | 46 | jigsaw_TRIA3_t _geom_tria3[12] = { 47 | { { 0, 1, 2}, +0 } , 48 | { { 0, 2, 3}, +0 } , 49 | { { 4, 5, 6}, +0 } , 50 | { { 4, 6, 7}, +0 } , 51 | { { 0, 1, 5}, +0 } , 52 | { { 0, 5, 4}, +0 } , 53 | { { 1, 2, 6}, +0 } , 54 | { { 1, 6, 5}, +0 } , 55 | { { 2, 3, 7}, +0 } , 56 | { { 2, 7, 6}, +0 } , 57 | { { 3, 7, 4}, +0 } , 58 | { { 3, 4, 0}, +0 } , 59 | } ; 60 | 61 | _geom._flags 62 | = JIGSAW_EUCLIDEAN_MESH; 63 | 64 | _geom._vert3._data = &_geom_vert3[0] ; 65 | _geom._vert3._size = +8 ; 66 | 67 | _geom._tria3._data = &_geom_tria3[0] ; 68 | _geom._tria3._size = +12; 69 | 70 | /*-------------------------------- form init. config. */ 71 | 72 | jigsaw_VERT3_t _init_vert3[9] = { 73 | { {0., 0., 0.}, +0 } , 74 | { {5., 0., 0.}, +0 } , 75 | { {5., 5., 0.}, +0 } , 76 | { {0., 5., 0.}, +0 } , 77 | { {0., 0., 5.}, +0 } , 78 | { {5., 0., 5.}, +0 } , 79 | { {5., 5., 5.}, +0 } , 80 | { {0., 5., 5.}, +0 } , 81 | { {0., 0., 3.}, +0 } , 82 | } ; 83 | 84 | _init._flags 85 | = JIGSAW_EUCLIDEAN_MESH; 86 | 87 | _init._vert3._data = &_init_vert3[0] ; 88 | _init._vert3._size = +9 ; 89 | 90 | /*-------------------------------- build TRIPOD r-DT. */ 91 | 92 | _jjig._verbosity = _verb; 93 | 94 | _jjig._mesh_dims = +3 ; 95 | 96 | _retv = tripod ( 97 | & _jjig , // the config. opts 98 | & _init , // init. data 99 | & _geom , // geom. data 100 | & _tria ) ; 101 | 102 | /*-------------------------------- print TRIPOD r-DT. */ 103 | 104 | if (_verb > 0 ) 105 | output_msh_data_3(&_tria); 106 | 107 | jigsaw_free_msh_t(&_tria); 108 | 109 | printf ( 110 | "[3d_f] TRIPOD returned code : %d \n", _retv) ; 111 | 112 | 113 | return _retv ; 114 | } 115 | 116 | # ifndef __SKIP_MAIN__ 117 | int main () { return test3d_f(1) ; } 118 | # endif//__SKIP_MAIN__ 119 | 120 | 121 | 122 | -------------------------------------------------------------------------------- /external/jigsaw/uni/test3d_g.c: -------------------------------------------------------------------------------- 1 | 2 | // gcc -Wall -Wextra test3d_g.c -Xlinker -rpath=../lib 3 | // -L ../lib -ljigsaw -o test3d_g 4 | 5 | // Uses TRIPOD to build an (unconstrained) DT in E^3, 6 | // comparable to more conventional Delaunay tessellation 7 | // approaches. 8 | 9 | # include "../inc/lib_jigsaw.h" 10 | 11 | # include "print.h" 12 | # include "stdio.h" 13 | 14 | int test3d_g (int _verb) 15 | { 16 | int _retv = 0; 17 | 18 | /*-------------------------------- setup JIGSAW types */ 19 | jigsaw_jig_t _jjig ; 20 | jigsaw_init_jig_t(&_jjig) ; 21 | 22 | jigsaw_msh_t _init ; 23 | jigsaw_init_msh_t(&_init) ; 24 | 25 | jigsaw_msh_t _tria ; 26 | jigsaw_init_msh_t(&_tria) ; 27 | 28 | /*-------------------------------- pts to triangulate */ 29 | 30 | jigsaw_VERT3_t _init_vert3[9] = { 31 | { {0., 0., 0.}, +0 } , 32 | { {5., 1., 0.}, +0 } , 33 | { {5., 5., 1.}, +0 } , 34 | { {2., 5., 0.}, +0 } , 35 | { {0., 2., 5.}, +0 } , 36 | { {5., 1., 5.}, +0 } , 37 | { {5., 6., 5.}, +0 } , 38 | { {0., 5., 5.}, +0 } , 39 | { {1., 0., 3.}, +0 } , 40 | } ; 41 | 42 | _init._flags 43 | = JIGSAW_EUCLIDEAN_MESH; 44 | 45 | _init._vert3._data = &_init_vert3[0] ; 46 | _init._vert3._size = +9 ; 47 | 48 | /*-------------------------------- build TRIPOD r-DT. */ 49 | 50 | _jjig._verbosity = _verb; 51 | 52 | _jjig._mesh_dims = +3 ; 53 | 54 | _retv = tripod ( 55 | & _jjig , // the config. opts 56 | & _init , // init. data 57 | NULL , // empty geom. data 58 | & _tria ) ; 59 | 60 | /*-------------------------------- print TRIPOD r-DT. */ 61 | 62 | if (_verb > 0 ) 63 | output_msh_data_3(&_tria); 64 | 65 | jigsaw_free_msh_t(&_tria); 66 | 67 | printf ( 68 | "[3d_g] TRIPOD returned code : %d \n", _retv) ; 69 | 70 | 71 | return _retv ; 72 | } 73 | 74 | # ifndef __SKIP_MAIN__ 75 | int main () { return test3d_g(1) ; } 76 | # endif//__SKIP_MAIN__ 77 | 78 | 79 | 80 | -------------------------------------------------------------------------------- /external/jigsaw/uni/test_all.c: -------------------------------------------------------------------------------- 1 | 2 | // gcc -Wall -Wextra test_all.c -Xlinker -rpath=../lib 3 | // -L ../lib -ljigsaw -o test_all 4 | 5 | // Call all unit tests and bail-out on any failed runs 6 | 7 | # define __SKIP_MAIN__ 8 | 9 | # include "test2d_a.c" 10 | # include "test2d_b.c" 11 | # include "test2d_c.c" 12 | # include "test2d_d.c" 13 | # include "test2d_e.c" 14 | # include "test2d_f.c" 15 | # include "test2d_g.c" 16 | # include "test2d_h.c" 17 | # include "test2d_i.c" 18 | 19 | # include "test2s_a.c" 20 | # include "test2s_b.c" 21 | # include "test2s_c.c" 22 | // include "test2s_d.c" 23 | # include "test2s_e.c" 24 | # include "test2s_f.c" 25 | # include "test2s_g.c" 26 | # include "test2s_h.c" 27 | # include "test2s_i.c" 28 | 29 | # include "test3d_a.c" 30 | # include "test3d_b.c" 31 | # include "test3d_c.c" 32 | # include "test3d_d.c" 33 | # include "test3d_e.c" 34 | # include "test3d_f.c" 35 | # include "test3d_g.c" 36 | // include "test3d_h.c" 37 | // include "test3d_i.c" 38 | 39 | int main () 40 | { 41 | int _retv = 0; 42 | int _verb =-1; // verbosity 43 | 44 | /*---------------------------------- run all 2d tests */ 45 | if ((_retv = test2d_a(_verb)) != 0) 46 | return _retv ; 47 | if ((_retv = test2d_b(_verb)) != 0) 48 | return _retv ; 49 | if ((_retv = test2d_c(_verb)) != 0) 50 | return _retv ; 51 | if ((_retv = test2d_d(_verb)) != 0) 52 | return _retv ; 53 | if ((_retv = test2d_e(_verb)) != 0) 54 | return _retv ; 55 | if ((_retv = test2d_f(_verb)) != 0) 56 | return _retv ; 57 | if ((_retv = test2d_g(_verb)) != 0) 58 | return _retv ; 59 | if ((_retv = test2d_h(_verb)) != 0) 60 | return _retv ; 61 | if ((_retv = test2d_i(_verb)) != 0) 62 | return _retv ; 63 | 64 | /*---------------------------------- run all 2s tests */ 65 | if ((_retv = test2s_a(_verb)) != 0) 66 | return _retv ; 67 | if ((_retv = test2s_b(_verb)) != 0) 68 | return _retv ; 69 | if ((_retv = test2s_c(_verb)) != 0) 70 | return _retv ; 71 | // if ((_retv = test2s_d(_verb)) != 0) 72 | // return _retv ; 73 | if ((_retv = test2s_e(_verb)) != 0) 74 | return _retv ; 75 | if ((_retv = test2s_f(_verb)) != 0) 76 | return _retv ; 77 | if ((_retv = test2s_g(_verb)) != 0) 78 | return _retv ; 79 | if ((_retv = test2s_h(_verb)) != 0) 80 | return _retv ; 81 | if ((_retv = test2s_i(_verb)) != 0) 82 | return _retv ; 83 | 84 | /*---------------------------------- run all 3d tests */ 85 | if ((_retv = test3d_a(_verb)) != 0) 86 | return _retv ; 87 | if ((_retv = test3d_b(_verb)) != 0) 88 | return _retv ; 89 | if ((_retv = test3d_c(_verb)) != 0) 90 | return _retv ; 91 | if ((_retv = test3d_d(_verb)) != 0) 92 | return _retv ; 93 | if ((_retv = test3d_e(_verb)) != 0) 94 | return _retv ; 95 | if ((_retv = test3d_f(_verb)) != 0) 96 | return _retv ; 97 | if ((_retv = test3d_g(_verb)) != 0) 98 | return _retv ; 99 | // if ((_retv = test3d_h(_verb)) != 0) 100 | // return _retv ; 101 | // if ((_retv = test3d_i(_verb)) != 0) 102 | // return _retv ; 103 | 104 | return _retv ; 105 | } 106 | 107 | 108 | 109 | -------------------------------------------------------------------------------- /jigsawpy/def_t.py: -------------------------------------------------------------------------------- 1 | 2 | import ctypes as ct 3 | 4 | indx_t = ct.c_int32 5 | fp32_t = ct.c_float 6 | real_t = ct.c_double 7 | 8 | 9 | class jigsaw_def_t: 10 | #--------------------------------- return codes for JIGSAW . 11 | 12 | JIGSAW_UNKNOWN_ERROR = -1 13 | 14 | JIGSAW_NO_ERROR = +0 15 | 16 | JIGSAW_FILE_NOT_LOCATED = +2 17 | JIGSAW_FILE_NOT_CREATED = +3 18 | 19 | JIGSAW_NETCDF_NOT_FOUND = +9 20 | 21 | JIGSAW_INVALID_ARGUMENT = +4 22 | JIGSAW_INVALID_INDEXING = +5 23 | JIGSAW_INVALID_USEROPTS = +6 24 | JIGSAW_INVALID_ARRAYDIM = +7 25 | 26 | #--------------------------------- constants for libJIGSAW . 27 | 28 | JIGSAW_NULL_FLAG = -100 29 | 30 | JIGSAW_EUCLIDEAN_MESH = +100 31 | JIGSAW_EUCLIDEAN_GRID = +101 32 | JIGSAW_EUCLIDEAN_DUAL = +102 33 | 34 | JIGSAW_ELLIPSOID_MESH = +200 35 | JIGSAW_ELLIPSOID_GRID = +201 36 | JIGSAW_ELLIPSOID_DUAL = +202 37 | 38 | JIGSAW_POINT_TAG = +10 39 | JIGSAW_EDGE2_TAG = +20 40 | JIGSAW_TRIA3_TAG = +30 41 | JIGSAW_QUAD4_TAG = +40 42 | JIGSAW_TRIA4_TAG = +50 43 | JIGSAW_HEXA8_TAG = +60 44 | JIGSAW_WEDG6_TAG = +70 45 | JIGSAW_PYRA5_TAG = +80 46 | 47 | JIGSAW_HFUN_RELATIVE = +300 48 | JIGSAW_HFUN_ABSOLUTE = +301 49 | 50 | JIGSAW_KERN_DELFRONT = +400 51 | JIGSAW_KERN_DELAUNAY = +401 52 | 53 | JIGSAW_BNDS_TRIACELL = +402 54 | JIGSAW_BNDS_DUALCELL = +403 55 | 56 | JIGSAW_KERN_ODT_DQDX = +404 57 | JIGSAW_KERN_CVT_DQDX = +405 58 | JIGSAW_KERN_H95_DQDX = +406 59 | 60 | JIGSAW_KERN_AREA_LEN = +410 61 | JIGSAW_KERN_SKEW_COS = +411 62 | -------------------------------------------------------------------------------- /jigsawpy/parse/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dengwirda/jigsaw-python/5729a380039c4df5de484cb9ec331e14b16e7c55/jigsawpy/parse/__init__.py -------------------------------------------------------------------------------- /jigsawpy/parse/savewav.py: -------------------------------------------------------------------------------- 1 | 2 | import warnings 3 | from pathlib import Path 4 | import numpy as np 5 | 6 | from jigsawpy.msh_t import jigsaw_msh_t 7 | from jigsawpy.certify import certify 8 | 9 | 10 | def savepoint(data, fptr, ndim, ctag): 11 | """ 12 | SAVEPOINT: save the POINT data structure to *.obj file. 13 | 14 | """ 15 | rmax = 2 ** 19; next = 0 16 | 17 | while (next < data.shape[0]): 18 | 19 | nrow = min(rmax, data.shape[0] - next) 20 | nend = next + nrow 21 | 22 | sfmt = " ".join(["%.17g"] * ndim) 23 | 24 | if (ndim < 3): sfmt = sfmt + " 0" 25 | 26 | sfmt = ctag + sfmt 27 | sfmt = sfmt + "\n" 28 | sfmt = sfmt * nrow 29 | 30 | fdat = sfmt % tuple(data[next:nend, :].ravel()) 31 | 32 | fptr.write(fdat) 33 | 34 | next = next + nrow 35 | 36 | return 37 | 38 | 39 | def savecells(data, fptr, nnod, ctag): 40 | """ 41 | SAVECELLS: save the CELLS data structure to *.obj file. 42 | 43 | """ 44 | rmax = 2 ** 19; next = 0 45 | 46 | indx = np.array(data[:, :]) + 1 47 | 48 | while (next < data.shape[0]): 49 | 50 | nrow = min(rmax, data.shape[0] - next) 51 | nend = next + nrow 52 | 53 | sfmt = " ".join(["%d"] * nnod) + "\n" 54 | sfmt = ctag + sfmt 55 | sfmt = sfmt * nrow 56 | 57 | fdat = sfmt % tuple(indx[next:nend, :].ravel()) 58 | 59 | fptr.write(fdat) 60 | 61 | next = next + nrow 62 | 63 | return 64 | 65 | 66 | def save_mesh_file(mesh, fptr): 67 | """ 68 | SAVE-MESH-FILE: save a JIGSAW mesh object to *.OBJ file. 69 | 70 | """ 71 | fptr.write( 72 | "# " + Path(fptr.name).name 73 | + "; created by JIGSAW's Python interface \n") 74 | 75 | if (mesh.vert2 is not None): 76 | savepoint( 77 | mesh.vert2["coord"], fptr, 2, "v ") 78 | 79 | if (mesh.vert3 is not None): 80 | savepoint( 81 | mesh.vert3["coord"], fptr, 3, "v ") 82 | 83 | if (mesh.edge2 is not None): 84 | savecells( 85 | mesh.edge2["index"], fptr, 2, "l ") 86 | 87 | if (mesh.tria3 is not None): 88 | savecells( 89 | mesh.tria3["index"], fptr, 3, "f ") 90 | 91 | if (mesh.quad4 is not None): 92 | savecells( 93 | mesh.quad4["index"], fptr, 4, "f ") 94 | 95 | if (mesh.tria4 is not None and 96 | mesh.tria4.size != +0): 97 | warnings.warn( 98 | "TRIA4 elements not supported", Warning) 99 | 100 | if (mesh.hexa8 is not None and 101 | mesh.hexa8.size != +0): 102 | warnings.warn( 103 | "HEXA8 elements not supported", Warning) 104 | 105 | if (mesh.wedg6 is not None and 106 | mesh.wedg6.size != +0): 107 | warnings.warn( 108 | "WEDG6 elements not supported", Warning) 109 | 110 | if (mesh.pyra5 is not None and 111 | mesh.pyra5.size != +0): 112 | warnings.warn( 113 | "PYRA5 elements not supported", Warning) 114 | 115 | return 116 | 117 | 118 | def savewav(name, mesh): 119 | """ 120 | SAVEWAV: save a JIGSAW MSH object to file. 121 | 122 | SAVEWAV(NAME, MESH) 123 | 124 | MESH is JIGSAW's primary mesh/grid/geom class. See MSH_t 125 | for details. 126 | 127 | Data in MESH is written as-needed -- any objects defined 128 | will be saved to file. 129 | 130 | """ 131 | 132 | if (not isinstance(name, str)): 133 | raise TypeError("Incorrect type: NAME.") 134 | 135 | if (not isinstance(mesh, jigsaw_msh_t)): 136 | raise TypeError("Incorrect type: MESH.") 137 | 138 | certify(mesh) 139 | 140 | fext = Path(name).suffix 141 | 142 | if (fext.strip() != ".obj"): name += ".obj" 143 | 144 | kind = mesh.mshID.lower() 145 | 146 | with Path(name).open("w") as fptr: 147 | #----------------------------------- write JIGSAW object 148 | if (kind == "euclidean-mesh"): 149 | 150 | save_mesh_file(mesh, fptr) 151 | 152 | elif (kind == "ellipsoid-mesh"): 153 | 154 | save_mesh_file(mesh, fptr) 155 | 156 | else: 157 | raise ValueError( 158 | "MESH.mshID is not supported!!") 159 | 160 | return 161 | -------------------------------------------------------------------------------- /jigsawpy/prj_t.py: -------------------------------------------------------------------------------- 1 | 2 | class jigsaw_prj_t(object): 3 | #------------------------------ obj. to hold projection data 4 | def __init__(self): 5 | 6 | self.radii = +1.E+00 7 | 8 | self.prjID = "" 9 | 10 | self.xbase = +0.E+00 11 | self.ybase = +0.E+00 12 | -------------------------------------------------------------------------------- /jigsawpy/tools/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dengwirda/jigsaw-python/5729a380039c4df5de484cb9ec331e14b16e7c55/jigsawpy/tools/__init__.py -------------------------------------------------------------------------------- /jigsawpy/tools/mathutils.py: -------------------------------------------------------------------------------- 1 | 2 | import numpy as np 3 | 4 | 5 | def S2toR3(radii, S2): 6 | 7 | # S2toR3: convert from spheroidal into cartesian coordinates 8 | 9 | E3 = np.empty( 10 | (S2.shape[0], 3), dtype=S2.dtype) 11 | 12 | C0 = np.cos(S2[:, 0]) 13 | C1 = np.cos(S2[:, 1]) 14 | 15 | S0 = np.sin(S2[:, 0]) 16 | S1 = np.sin(S2[:, 1]) 17 | 18 | E3[:, 0] = radii[0] * C0 * C1 19 | E3[:, 1] = radii[1] * S0 * C1 20 | 21 | E3[:, 2] = radii[2] * S1 22 | 23 | return E3 24 | 25 | 26 | def R3toS2(radii, E3): 27 | 28 | # R3toS2: convert from cartesian into spheroidal coordinates 29 | 30 | S2 = np.empty( 31 | (E3.shape[0], 2), dtype=E3.dtype) 32 | 33 | xm = E3[:, 0] * radii[1] 34 | ym = E3[:, 1] * radii[0] 35 | zr = E3[:, 2] / radii[2] 36 | 37 | zr = np.maximum(np.minimum(zr, +1.), -1.) 38 | 39 | S2[:, 1] = np.arcsin(zr) 40 | S2[:, 0] = np.arctan2(ym, xm) 41 | 42 | return S2 43 | 44 | 45 | def det_2x2(amat): 46 | 47 | # DET-2x2: compute determinants for a set of 2 x 2 matrices. 48 | 49 | return \ 50 | amat[0, 0, :] * amat[1, 1, :] - \ 51 | amat[0, 1, :] * amat[1, 0, :] 52 | 53 | 54 | def det_3x3(amat): 55 | 56 | # DET-3x3: compute determinants for a set of 3 x 3 matrices. 57 | 58 | detA = \ 59 | amat[1, 1, :] * amat[2, 2, :] - \ 60 | amat[1, 2, :] * amat[2, 1, :] 61 | 62 | detB = \ 63 | amat[1, 0, :] * amat[2, 2, :] - \ 64 | amat[1, 2, :] * amat[2, 0, :] 65 | 66 | detC = \ 67 | amat[1, 0, :] * amat[2, 1, :] - \ 68 | amat[1, 1, :] * amat[2, 0, :] 69 | 70 | return \ 71 | amat[0, 0, :] * detA - \ 72 | amat[0, 1, :] * detB + \ 73 | amat[0, 2, :] * detC 74 | 75 | 76 | def inv_2x2(amat): 77 | 78 | # INV-2x2: calculate inverse(s) for a set of 2 x 2 matrices. 79 | 80 | adet = det_2x2(amat) 81 | 82 | ainv = np.empty((2, 2, amat.shape[2])) 83 | 84 | ainv[0, 0, :] = +amat[1, 1, :] 85 | ainv[1, 1, :] = +amat[0, 0, :] 86 | ainv[0, 1, :] = -amat[0, 1, :] 87 | ainv[1, 0, :] = -amat[1, 0, :] 88 | 89 | return ainv, adet 90 | 91 | 92 | def inv_3x3(amat): 93 | 94 | # INV-3x3: calculate inverse(s) for a set of 3 x 3 matrices. 95 | 96 | adet = det_3x3(amat) 97 | 98 | ainv = np.empty((3, 3, amat.shape[2])) 99 | 100 | ainv[0, 0, :] = \ 101 | amat[2, 2, :] * amat[1, 1, :] - \ 102 | amat[2, 1, :] * amat[1, 2, :] 103 | 104 | ainv[0, 1, :] = \ 105 | amat[2, 1, :] * amat[0, 2, :] - \ 106 | amat[2, 2, :] * amat[0, 1, :] 107 | 108 | ainv[0, 2, :] = \ 109 | amat[1, 2, :] * amat[0, 1, :] - \ 110 | amat[1, 1, :] * amat[0, 2, :] 111 | 112 | ainv[1, 0, :] = \ 113 | amat[2, 0, :] * amat[1, 2, :] - \ 114 | amat[2, 2, :] * amat[1, 0, :] 115 | 116 | ainv[1, 1, :] = \ 117 | amat[2, 2, :] * amat[0, 0, :] - \ 118 | amat[2, 0, :] * amat[0, 2, :] 119 | 120 | ainv[1, 2, :] = \ 121 | amat[1, 0, :] * amat[0, 2, :] - \ 122 | amat[1, 2, :] * amat[0, 0, :] 123 | 124 | ainv[2, 0, :] = \ 125 | amat[2, 1, :] * amat[1, 0, :] - \ 126 | amat[2, 0, :] * amat[1, 1, :] 127 | 128 | ainv[2, 1, :] = \ 129 | amat[2, 0, :] * amat[0, 1, :] - \ 130 | amat[2, 1, :] * amat[0, 0, :] 131 | 132 | ainv[2, 2, :] = \ 133 | amat[1, 1, :] * amat[0, 0, :] - \ 134 | amat[1, 0, :] * amat[0, 1, :] 135 | 136 | return ainv, adet 137 | -------------------------------------------------------------------------------- /jigsawpy/tools/meshutils.py: -------------------------------------------------------------------------------- 1 | 2 | import numpy as np 3 | from scipy.sparse import csr_matrix 4 | 5 | from jigsawpy.tools.predicate import trivol2, trivol3 6 | from jigsawpy.tools.orthoball import tribal2, tribal3 7 | from jigsawpy.tools.scorecard import triscr2, triscr3 8 | 9 | from jigsawpy.jig_t import jigsaw_jig_t 10 | from jigsawpy.msh_t import jigsaw_msh_t 11 | 12 | 13 | def metric(mesh): 14 | """ 15 | METRIC assemble combined "cost" metric for a given mesh. 16 | 17 | """ 18 | 19 | cost = np.empty((+0), dtype=mesh.REALS_t) 20 | 21 | if (mesh.tria3 is not None and 22 | mesh.tria3.size > +0): 23 | 24 | #--------------------------------------- append TRIA3 scores 25 | COST = triscr2( 26 | mesh.point["coord"], mesh.tria3["index"] 27 | ) 28 | 29 | cost = np.append(cost, COST) 30 | 31 | if (mesh.tria4 is not None and 32 | mesh.tria4.size > +0): 33 | 34 | #--------------------------------------- append TRIA4 scores 35 | COST = triscr3( 36 | mesh.point["coord"], mesh.tria4["index"] 37 | ) 38 | 39 | cost = np.append(cost, COST) 40 | 41 | if (cost.size == 0): return +0.0 42 | 43 | norm = np.sum((1.0 / cost) ** 3) 44 | 45 | return np.cbrt(cost.size / norm) 46 | 47 | 48 | def jumble(mesh, frac): 49 | """ 50 | JUMBLE (randomly) perturb a given mesh by fraction FRAC. 51 | 52 | """ 53 | 54 | if (mesh.tria3 is not None and 55 | mesh.tria3.size > +0): 56 | 57 | #-------------------------- quasi-random vert-tria match 58 | mass = trivol2( 59 | mesh.point["coord"], mesh.tria3["index"]) 60 | 61 | ipos = mesh.tria3["index"].T.ravel() 62 | jpos = np.arange(0, mesh.tria3.size) 63 | have = np.unique(ipos) 64 | jpos = np.tile(jpos, 3) 65 | xdat = np.tile(mass, 3) 66 | 67 | xdat = np.random.rand(xdat.size) * xdat 68 | 69 | next = np.squeeze(np.asarray(csr_matrix( 70 | (xdat, (ipos, jpos))).argmax(axis=1))) 71 | 72 | #-------------------------- push toward "matched" centre 73 | tria = mesh.tria3["index"][next, :] 74 | 75 | pmid = tribal2(mesh.point["coord"], tria) 76 | pmid = pmid[:, :-1] 77 | 78 | pert = np.random.rand(pmid.shape[0], 1) 79 | pert = 0.50 * (0.50 + pert) * frac 80 | pert = np.tile(pert, (+1, pmid.shape[1])) 81 | 82 | mesh.point["coord"][have] += \ 83 | pert * (pmid - mesh.point["coord"][have]) 84 | 85 | if (mesh.tria4 is not None and 86 | mesh.tria4.size > +0): 87 | 88 | #-------------------------- quasi-random vert-tria match 89 | mass = trivol3( 90 | mesh.point["coord"], mesh.tria4["index"]) 91 | 92 | ipos = mesh.tria4["index"].T.ravel() 93 | jpos = np.arange(0, mesh.tria4.size) 94 | have = np.unique(ipos) 95 | jpos = np.tile(jpos, 4) 96 | xdat = np.tile(mass, 4) 97 | 98 | xdat = np.random.rand(xdat.size) * xdat 99 | 100 | next = np.squeeze(np.asarray(csr_matrix( 101 | (xdat, (ipos, jpos))).argmax(axis=1))) 102 | 103 | #-------------------------- push toward "matched" centre 104 | tria = mesh.tria4["index"][next, :] 105 | 106 | pmid = tribal3(mesh.point["coord"], tria) 107 | pmid = pmid[:, :-1] 108 | 109 | pert = np.random.rand(pmid.shape[0], 1) 110 | pert = 0.50 * (0.50 + pert) * frac 111 | pert = np.tile(pert, (+1, pmid.shape[1])) 112 | 113 | mesh.point["coord"][have] += \ 114 | pert * (pmid - mesh.point["coord"][have]) 115 | 116 | attach(mesh) 117 | 118 | return 119 | 120 | 121 | def attach(mesh): 122 | """ 123 | ATTACH mark points attached to the underlying geom. rep. 124 | 125 | """ 126 | 127 | if (mesh.tria4 is not None and 128 | mesh.tria4.size != +0): 129 | 130 | mesh.point["IDtag"][mesh.tria4["index"]] = 3 131 | 132 | if (mesh.hexa8 is not None and 133 | mesh.hexa8.size != +0): 134 | 135 | mesh.point["IDtag"][mesh.hexa8["index"]] = 3 136 | 137 | if (mesh.pyra5 is not None and 138 | mesh.pyra5.size != +0): 139 | 140 | mesh.point["IDtag"][mesh.pyra5["index"]] = 3 141 | 142 | if (mesh.wedg6 is not None and 143 | mesh.wedg6.size != +0): 144 | 145 | mesh.point["IDtag"][mesh.wedg6["index"]] = 3 146 | 147 | if (mesh.tria3 is not None and 148 | mesh.tria3.size != +0): 149 | 150 | mesh.point["IDtag"][mesh.tria3["index"]] = 2 151 | 152 | if (mesh.quad4 is not None and 153 | mesh.quad4.size != +0): 154 | 155 | mesh.point["IDtag"][mesh.quad4["index"]] = 2 156 | 157 | if (mesh.edge2 is not None and 158 | mesh.edge2.size != +0): 159 | 160 | mesh.point["IDtag"][mesh.edge2["index"]] = 1 161 | 162 | return 163 | -------------------------------------------------------------------------------- /jigsawpy/tools/projector.py: -------------------------------------------------------------------------------- 1 | 2 | import numpy as np 3 | 4 | 5 | def stereo3_f(rrad, xpos, ypos, xmid, ymid): 6 | """ 7 | STEREO3_f: compute the forward stereographic projection. 8 | 9 | """ 10 | 11 | #------------------------------------ do forward mapping 12 | 13 | ccxd = np.cos(xpos - xmid) 14 | 15 | ccym = np.cos(ymid) 16 | ccyp = np.cos(ypos) 17 | 18 | ssxd = np.sin(xpos - xmid) 19 | 20 | ssym = np.sin(ymid) 21 | ssyp = np.sin(ypos) 22 | 23 | kden = \ 24 | +1.0 + ssym * ssyp + ccym * ccyp * ccxd 25 | 26 | kval = +2.0 * rrad / kden ** 1 27 | 28 | dval = -2.0 * rrad / kden ** 2 29 | 30 | xnew = \ 31 | kval * ccyp * ssxd 32 | ynew = \ 33 | kval * ccym * ssyp - \ 34 | kval * ssym * ccyp * ccxd 35 | 36 | #------------------------------------ compute indicatrix 37 | 38 | dkdy = \ 39 | dval * ssym * ccyp - \ 40 | dval * ccym * ssyp * ccxd 41 | 42 | dxdy = \ 43 | dkdy * ccyp * ssxd - kval * ssyp * ssxd 44 | 45 | dydy = \ 46 | dkdy * ccym * ssyp - \ 47 | dkdy * ssym * ccyp * ccxd + \ 48 | kval * ccym * ccyp + \ 49 | kval * ssym * ssyp * ccxd 50 | 51 | scal = \ 52 | +1.0 / rrad * np.sqrt(dxdy**2 + dydy**2) 53 | 54 | return xnew, ynew, scal 55 | 56 | 57 | def stereo3_i(rrad, xpos, ypos, xmid, ymid): 58 | """ 59 | STEREO3_i: compute the inverse stereographic projection. 60 | 61 | """ 62 | 63 | #------------------------------------ do inverse mapping 64 | 65 | rval = np.sqrt(xpos**2 + ypos**2) 66 | 67 | rval = np.maximum( 68 | 1.0E-16 * np.max(rval), rval) 69 | 70 | cval = +2.0 * np.arctan2(rval, +2.0 * rrad) 71 | 72 | ccym = np.cos(ymid) 73 | cccv = np.cos(cval) 74 | 75 | ssym = np.sin(ymid) 76 | sscv = np.sin(cval) 77 | 78 | xtmp = rval * ccym * cccv - ypos * ssym * sscv 79 | 80 | xnew = xmid + np.arctan2(xpos * sscv, xtmp) 81 | 82 | ytmp = ypos * ccym * sscv 83 | 84 | ynew = np.arcsin(cccv * ssym + ytmp / rval) 85 | 86 | #------------------------------------ compute indicatrix 87 | 88 | ccxd = np.cos(xnew - xmid) 89 | ssxd = np.sin(xnew - xmid) 90 | 91 | ccyn = np.cos(ynew) 92 | ssyn = np.sin(ynew) 93 | 94 | kden = \ 95 | +1.0 + ssym * ssyn + ccym * ccyn * ccxd 96 | 97 | dval = -2.0 * rrad / kden ** 2 98 | 99 | kval = +2.0 * rrad / kden ** 1 100 | 101 | dkdy = \ 102 | dval * ssym * ccyn - \ 103 | dval * ccym * ssyn * ccxd 104 | 105 | dxdy = \ 106 | dkdy * ccyn * ssxd - kval * ssyn * ssxd 107 | 108 | dydy = \ 109 | dkdy * ccym * ssyn - \ 110 | dkdy * ssym * ccyn * ccxd + \ 111 | kval * ccym * ccyn + \ 112 | kval * ssym * ssyn * ccxd 113 | 114 | scal = \ 115 | rrad * +1.0 / np.sqrt(dxdy**2 + dydy**2) 116 | 117 | return xnew, ynew, scal 118 | 119 | 120 | def stereo3(rrad, xpos, ypos, xmid, ymid, kind): 121 | """ 122 | STEREO3: calculate a "rotated" stereographic projection. 123 | 124 | XNEW,YNEW,SCAL = STEREO3(RRAD,XPOS,YPOS,XMID,YMID,KIND) 125 | returns the stereographic projection [XNEW,YNEW] of the 126 | lon-lat points [RRAD,XPOS,YPOS], where RRAD is the 127 | radius of the sphere, and [XPOS,YPOS] are arrays of lon- 128 | gitude and latitude, respectively. Angles are measured 129 | in radians. [XMID,YMID] are the lon-lat coordinates that 130 | the mapping is 'centred' about. The stereographic proje- 131 | ction is a conformal mapping; preserving angles. 132 | 133 | XNEW,YNEW,SCAL = STEREO3(..., KIND) specifies the direc- 134 | tion of the mapping. KIND = "FWD" defines a forward map- 135 | ping, and KIND = "INV" defines an inverse mapping. Here, 136 | the role of [XNEW,YNEW] and [XPOS,YPOS] are exchanged, 137 | with [XPOS,YPOS] the stereographic coordinates, and 138 | [XNEW,YNEW] the resulting lon-lat spherical angles. 139 | 140 | SCAL is the scale-factor associated with the forward ma- 141 | pping. This array stores the relative length distortion 142 | induced by the projection for all points in [XNEW,YNEW]. 143 | 144 | """ 145 | 146 | if (kind.lower() == "fwd"): 147 | 148 | xnew, ynew, scal = \ 149 | stereo3_f(rrad, xpos, ypos, xmid, ymid) 150 | 151 | elif (kind.lower() == "inv"): 152 | 153 | xnew, ynew, scal = \ 154 | stereo3_i(rrad, xpos, ypos, xmid, ymid) 155 | 156 | return xnew, ynew, scal 157 | -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | numpy 2 | scipy 3 | packaging 4 | -------------------------------------------------------------------------------- /setup.cfg: -------------------------------------------------------------------------------- 1 | [flake8] 2 | ignore = W503,W504,E115,E265,E271,E701,E702,E704,F401 3 | exclude = jigsawpy/msh_l.py, 4 | jigsawpy/jig_l.py 5 | -------------------------------------------------------------------------------- /setup.py: -------------------------------------------------------------------------------- 1 | 2 | import io 3 | import os 4 | import subprocess 5 | import shutil 6 | 7 | from setuptools import setup, find_packages, Command 8 | from packaging import version 9 | 10 | NAME = "jigsawpy" 11 | DESCRIPTION = \ 12 | "Python interface for the JIGSAW meshing library." 13 | AUTHOR = "Darren Engwirda" 14 | AUTHOR_EMAIL = "d.engwirda@gmail.com" 15 | URL = "https://github.com/dengwirda/" 16 | VERSION = "1.0.0" 17 | REQUIRES_PYTHON = ">=3.6.0" 18 | KEYWORDS = "Mesh-generation Delaunay Voronoi" 19 | 20 | REQUIRED = [ 21 | "numpy", "scipy" 22 | ] 23 | 24 | CLASSIFY = [ 25 | "Development Status :: 5 - Production/Stable", 26 | "Operating System :: OS Independent", 27 | "Intended Audience :: Science/Research", 28 | "Programming Language :: Python", 29 | "Programming Language :: Python :: 3", 30 | "Programming Language :: C++", 31 | "Topic :: Scientific/Engineering", 32 | "Topic :: Scientific/Engineering :: Mathematics", 33 | "Topic :: Scientific/Engineering :: Physics", 34 | "Topic :: Scientific/Engineering :: Visualization" 35 | ] 36 | 37 | HERE = os.path.abspath(os.path.dirname(__file__)) 38 | 39 | try: 40 | with io.open(os.path.join( 41 | HERE, "README.md"), encoding="utf-8") as f: 42 | LONG_DESCRIPTION = "\n" + f.read() 43 | 44 | except FileNotFoundError: 45 | LONG_DESCRIPTION = DESCRIPTION 46 | 47 | 48 | def get_cmake_version(): 49 | try: 50 | out = subprocess.check_output( 51 | ["cmake", "--version"]).decode("utf-8") 52 | sln = out.splitlines()[0] 53 | ver = sln.split()[2] 54 | return ver 55 | 56 | except: 57 | print("cmake not found!") 58 | 59 | 60 | class build_external(Command): 61 | 62 | description = "build external JIGSAW dependencies" 63 | 64 | user_options = [] 65 | 66 | def initialize_options(self): pass 67 | 68 | def finalize_options(self): pass 69 | 70 | def run(self): 71 | """ 72 | The actual cmake-based build steps for JIGSAW 73 | 74 | """ 75 | if (self.dry_run): return 76 | 77 | cwd_pointer = os.getcwd() 78 | 79 | try: 80 | self.announce("cmake config.", level=3) 81 | 82 | source_path = os.path.join( 83 | HERE, "external", "jigsaw") 84 | 85 | builds_path = \ 86 | os.path.join(source_path, "tmp") 87 | 88 | os.makedirs(builds_path, exist_ok=True) 89 | 90 | exesrc_path = \ 91 | os.path.join(source_path, "bin") 92 | 93 | libsrc_path = \ 94 | os.path.join(source_path, "lib") 95 | 96 | exedst_path = os.path.join( 97 | HERE, "jigsawpy", "_bin") 98 | 99 | libdst_path = os.path.join( 100 | HERE, "jigsawpy", "_lib") 101 | 102 | shutil.rmtree( 103 | exedst_path, ignore_errors=True) 104 | shutil.rmtree( 105 | libdst_path, ignore_errors=True) 106 | 107 | os.chdir(builds_path) 108 | 109 | config_call = [ 110 | "cmake", 111 | "..", "-DCMAKE_BUILD_TYPE=Release"] 112 | 113 | subprocess.run(config_call, check=True) 114 | 115 | self.announce("cmake complie", level=3) 116 | 117 | ver = get_cmake_version() 118 | if version.parse(ver) < version.parse("3.12"): 119 | compilecall = [ 120 | "cmake", "--build", ".", 121 | "--config", "Release", 122 | "--target", "install" 123 | ] 124 | else: 125 | compilecall = [ 126 | "cmake", "--build", ".", 127 | "--config", "Release", 128 | "--target", "install", 129 | "--parallel", "4" 130 | ] 131 | 132 | subprocess.run(compilecall, check=True) 133 | 134 | self.announce("cmake cleanup", level=3) 135 | 136 | shutil.copytree(exesrc_path, exedst_path) 137 | shutil.copytree(libsrc_path, libdst_path) 138 | 139 | finally: 140 | os.chdir(cwd_pointer) 141 | 142 | shutil.rmtree(builds_path) 143 | 144 | 145 | setup( 146 | name=NAME, 147 | version=VERSION, 148 | description=DESCRIPTION, 149 | long_description=LONG_DESCRIPTION, 150 | long_description_content_type="text/markdown", 151 | license="custom", 152 | author=AUTHOR, 153 | author_email=AUTHOR_EMAIL, 154 | python_requires=REQUIRES_PYTHON, 155 | keywords=KEYWORDS, 156 | url=URL, 157 | packages=find_packages(exclude=["tests",]), 158 | cmdclass={"build_external": build_external}, 159 | package_data={"jigsawpy": ["_bin/*", "_lib/*"]}, 160 | install_requires=REQUIRED, 161 | classifiers=CLASSIFY 162 | ) 163 | -------------------------------------------------------------------------------- /tests/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dengwirda/jigsaw-python/5729a380039c4df5de484cb9ec331e14b16e7c55/tests/__init__.py -------------------------------------------------------------------------------- /tests/case_2_.py: -------------------------------------------------------------------------------- 1 | """ 2 | * DEMO-2 --- Build planar meshes for the "lakes" geometry. 3 | % Compare performance of "delaunay" + "delfront" algorithms. 4 | * 5 | * These examples call to JIGSAW via its cmd.-line interface. 6 | * 7 | * Writes "case_2x.vtk" files on output for vis. in PARAVIEW. 8 | * 9 | """ 10 | 11 | import os 12 | 13 | import jigsawpy 14 | 15 | 16 | def case_2_(src_path, dst_path): 17 | 18 | opts = jigsawpy.jigsaw_jig_t() 19 | 20 | mesh = jigsawpy.jigsaw_msh_t() 21 | 22 | #------------------------------------ setup files for JIGSAW 23 | 24 | opts.geom_file = \ 25 | os.path.join(src_path, "lakes.msh") 26 | 27 | opts.jcfg_file = \ 28 | os.path.join(dst_path, "lakes.jig") 29 | 30 | opts.mesh_file = \ 31 | os.path.join(dst_path, "lakes.msh") 32 | 33 | #------------------------------------ make mesh using JIGSAW 34 | 35 | opts.mesh_kern = "delaunay" # DELAUNAY kernel 36 | opts.mesh_dims = +2 37 | 38 | opts.mesh_top1 = True # mesh sharp feat. 39 | opts.geom_feat = True 40 | 41 | opts.optm_iter = +0 42 | 43 | opts.hfun_hmax = 0.02 44 | 45 | jigsawpy.cmd.jigsaw(opts, mesh) 46 | 47 | print("Saving case_2a.vtk file.") 48 | 49 | jigsawpy.savevtk(os.path.join( 50 | dst_path, "case_2a.vtk"), mesh) 51 | 52 | #------------------------------------ make mesh using JIGSAW 53 | 54 | opts.mesh_kern = "delfront" # DELFRONT kernel 55 | opts.mesh_dims = +2 56 | 57 | opts.mesh_top1 = True # mesh sharp feat. 58 | opts.geom_feat = True 59 | 60 | opts.optm_iter = +0 61 | 62 | opts.hfun_hmax = 0.02 63 | 64 | jigsawpy.cmd.jigsaw(opts, mesh) 65 | 66 | print("Saving case_2b.vtk file.") 67 | 68 | jigsawpy.savevtk(os.path.join( 69 | dst_path, "case_2b.vtk"), mesh) 70 | 71 | return 72 | -------------------------------------------------------------------------------- /tests/case_3_.py: -------------------------------------------------------------------------------- 1 | """ 2 | * DEMO-3 --- Build surface meshes for the "bunny" geometry. 3 | % Compare performance of "delaunay" + "delfront" algorithms. 4 | * 5 | * These examples call to JIGSAW via its cmd.-line interface. 6 | * 7 | * Writes "case_3x.vtk" files on output for vis. in PARAVIEW. 8 | * 9 | """ 10 | 11 | import os 12 | 13 | import jigsawpy 14 | 15 | 16 | def case_3_(src_path, dst_path): 17 | 18 | opts = jigsawpy.jigsaw_jig_t() 19 | 20 | geom = jigsawpy.jigsaw_msh_t() 21 | mesh = jigsawpy.jigsaw_msh_t() 22 | 23 | #------------------------------------ setup files for JIGSAW 24 | 25 | opts.geom_file = \ 26 | os.path.join(src_path, "bunny.msh") 27 | 28 | opts.jcfg_file = \ 29 | os.path.join(dst_path, "bunny.jig") 30 | 31 | opts.mesh_file = \ 32 | os.path.join(dst_path, "bunny.msh") 33 | 34 | #------------------------------------ make mesh using JIGSAW 35 | 36 | jigsawpy.loadmsh( 37 | opts.geom_file, geom) 38 | 39 | print("Saving case_3a.vtk file.") 40 | 41 | jigsawpy.savevtk(os.path.join( 42 | dst_path, "case_3a.vtk"), geom) 43 | 44 | opts.mesh_kern = "delaunay" # DELAUNAY kernel 45 | opts.mesh_dims = +2 46 | 47 | opts.optm_iter = +0 48 | 49 | opts.hfun_hmax = 0.03 50 | 51 | jigsawpy.cmd.jigsaw(opts, mesh) 52 | 53 | scr2 = jigsawpy.triscr2( # "quality" metric 54 | mesh.point["coord"], 55 | mesh.tria3["index"]) 56 | 57 | print("Saving case_3b.vtk file.") 58 | 59 | jigsawpy.savevtk(os.path.join( 60 | dst_path, "case_3b.vtk"), mesh) 61 | 62 | #------------------------------------ make mesh using JIGSAW 63 | 64 | opts.mesh_kern = "delfront" # DELFRONT kernel 65 | opts.mesh_dims = +2 66 | 67 | opts.optm_iter = +0 68 | 69 | opts.hfun_hmax = 0.03 70 | 71 | jigsawpy.cmd.jigsaw(opts, mesh) 72 | 73 | scr2 = jigsawpy.triscr2( # "quality" metric 74 | mesh.point["coord"], 75 | mesh.tria3["index"]) 76 | 77 | print("Saving case_3c.vtk file.") 78 | 79 | jigsawpy.savevtk(os.path.join( 80 | dst_path, "case_3c.vtk"), mesh) 81 | 82 | return 83 | -------------------------------------------------------------------------------- /tests/case_4_.py: -------------------------------------------------------------------------------- 1 | """ 2 | * DEMO-4 --- Build volume meshes for the "bunny" geometry. 3 | % Compare performance of "delaunay" + "delfront" algorithms. 4 | * 5 | * These examples call to JIGSAW via its cmd.-line interface. 6 | * 7 | * Writes "case_4x.vtk" files on output for vis. in PARAVIEW. 8 | * 9 | """ 10 | 11 | import os 12 | 13 | import jigsawpy 14 | 15 | 16 | def case_4_(src_path, dst_path): 17 | 18 | opts = jigsawpy.jigsaw_jig_t() 19 | 20 | mesh = jigsawpy.jigsaw_msh_t() 21 | 22 | #------------------------------------ setup files for JIGSAW 23 | 24 | opts.geom_file = \ 25 | os.path.join(src_path, "bunny.msh") 26 | 27 | opts.jcfg_file = \ 28 | os.path.join(dst_path, "bunny.jig") 29 | 30 | opts.mesh_file = \ 31 | os.path.join(dst_path, "bunny.msh") 32 | 33 | #------------------------------------ make mesh using JIGSAW 34 | 35 | opts.mesh_kern = "delaunay" # DELAUNAY kernel 36 | opts.mesh_dims = +3 37 | 38 | opts.optm_iter = +0 39 | 40 | opts.hfun_hmax = 0.03 41 | 42 | jigsawpy.cmd.jigsaw(opts, mesh) 43 | 44 | print("Saving case_4a.vtk file.") 45 | 46 | jigsawpy.savevtk(os.path.join( 47 | dst_path, "case_4a.vtk"), mesh) 48 | 49 | #------------------------------------ make mesh using JIGSAW 50 | 51 | opts.mesh_kern = "delfront" # DELFRONT kernel 52 | opts.mesh_dims = +3 53 | 54 | opts.optm_iter = +0 55 | 56 | opts.hfun_hmax = 0.03 57 | 58 | jigsawpy.cmd.jigsaw(opts, mesh) 59 | 60 | print("Saving case_4b.vtk file.") 61 | 62 | jigsawpy.savevtk(os.path.join( 63 | dst_path, "case_4b.vtk"), mesh) 64 | 65 | return 66 | -------------------------------------------------------------------------------- /tests/case_5_.py: -------------------------------------------------------------------------------- 1 | """ 2 | * DEMO-5 --- Build planar meshes for the "airfoil" problem. 3 | * Impose non-uniform mesh-spacing constraints. 4 | * 5 | * These examples call to JIGSAW via its cmd.-line interface. 6 | * 7 | * Writes "case_5x.vtk" files on output for vis. in PARAVIEW. 8 | * 9 | """ 10 | 11 | import os 12 | import numpy as np 13 | 14 | import jigsawpy 15 | 16 | 17 | def case_5_(src_path, dst_path): 18 | 19 | opts = jigsawpy.jigsaw_jig_t() 20 | 21 | geom = jigsawpy.jigsaw_msh_t() 22 | mesh = jigsawpy.jigsaw_msh_t() 23 | hmat = jigsawpy.jigsaw_msh_t() 24 | 25 | #------------------------------------ setup files for JIGSAW 26 | 27 | opts.geom_file = \ 28 | os.path.join(src_path, "airfoil.msh") 29 | 30 | opts.jcfg_file = \ 31 | os.path.join(dst_path, "airfoil.jig") 32 | 33 | opts.mesh_file = \ 34 | os.path.join(dst_path, "airfoil.msh") 35 | 36 | opts.hfun_file = \ 37 | os.path.join(dst_path, "spacing.msh") 38 | 39 | #------------------------------------ compute HFUN over GEOM 40 | 41 | jigsawpy.loadmsh( 42 | opts.geom_file, geom) 43 | 44 | xgeo = geom.vert2["coord"][:, 0] 45 | ygeo = geom.vert2["coord"][:, 1] 46 | 47 | xpos = np.linspace( 48 | xgeo.min(), xgeo.max(), 80) 49 | 50 | ypos = np.linspace( 51 | ygeo.min(), ygeo.max(), 40) 52 | 53 | xmat, ymat = np.meshgrid(xpos, ypos) 54 | 55 | fun1 = \ 56 | +0.1 * (xmat - .40) ** 2 + \ 57 | +2.0 * (ymat - .55) ** 2 58 | 59 | fun2 = \ 60 | +0.7 * (xmat - .75) ** 2 + \ 61 | +0.7 * (ymat - .45) ** 2 62 | 63 | hfun = np.minimum(fun1, fun2) 64 | 65 | hmin = 0.01; hmax = 0.10 66 | 67 | hfun = 0.4 * np.maximum( 68 | np.minimum(hfun, hmax), hmin) 69 | 70 | hmat.mshID = "euclidean-grid" 71 | hmat.ndims = +2 72 | hmat.xgrid = np.array( 73 | xpos, dtype=hmat.REALS_t) 74 | hmat.ygrid = np.array( 75 | ypos, dtype=hmat.REALS_t) 76 | hmat.value = np.array( 77 | hfun, dtype=hmat.REALS_t) 78 | 79 | jigsawpy.savemsh( 80 | opts.hfun_file, hmat) 81 | 82 | #------------------------------------ make mesh using JIGSAW 83 | 84 | opts.hfun_scal = "absolute" 85 | opts.hfun_hmax = float("inf") # null HFUN limits 86 | opts.hfun_hmin = float(+0.00) 87 | 88 | opts.mesh_kern = "delfront" # DELFRONT kernel 89 | opts.mesh_dims = +2 90 | 91 | opts.geom_feat = True 92 | opts.mesh_top1 = True 93 | 94 | jigsawpy.cmd.jigsaw(opts, mesh) 95 | 96 | print("Saving case_5a.vtk file.") 97 | 98 | jigsawpy.savevtk(os.path.join( 99 | dst_path, "case_5a.vtk"), hmat) 100 | 101 | print("Saving case_5b.vtk file.") 102 | 103 | jigsawpy.savevtk(os.path.join( 104 | dst_path, "case_5b.vtk"), mesh) 105 | 106 | return 107 | -------------------------------------------------------------------------------- /tests/case_6_.py: -------------------------------------------------------------------------------- 1 | """ 2 | * DEMO-6 --- Build surface meshes for a mechanical bracket. 3 | * Detect and preserve sharp-features in the input geometry. 4 | * 5 | * These examples call to JIGSAW via its cmd.-line interface. 6 | * 7 | * Writes "case_6x.vtk" files on output for vis. in PARAVIEW. 8 | * 9 | """ 10 | 11 | import os 12 | 13 | import jigsawpy 14 | 15 | 16 | def case_6_(src_path, dst_path): 17 | 18 | opts = jigsawpy.jigsaw_jig_t() 19 | 20 | geom = jigsawpy.jigsaw_msh_t() 21 | mesh = jigsawpy.jigsaw_msh_t() 22 | 23 | #------------------------------------ setup files for JIGSAW 24 | 25 | opts.geom_file = \ 26 | os.path.join(src_path, "piece.msh") 27 | 28 | opts.jcfg_file = \ 29 | os.path.join(dst_path, "piece.jig") 30 | 31 | opts.mesh_file = \ 32 | os.path.join(dst_path, "piece.msh") 33 | 34 | #------------------------------------ make mesh using JIGSAW 35 | 36 | jigsawpy.loadmsh( 37 | opts.geom_file, geom) 38 | 39 | print("Saving case_6a.vtk file.") 40 | 41 | jigsawpy.savevtk(os.path.join( 42 | dst_path, "case_6a.vtk"), geom) 43 | 44 | opts.hfun_hmax = 0.03 # set HFUN limits 45 | 46 | opts.mesh_kern = "delfront" # DELFRONT kernel 47 | opts.mesh_dims = +2 48 | 49 | jigsawpy.cmd.jigsaw(opts, mesh) 50 | 51 | print("Saving case_6b.vtk file.") 52 | 53 | jigsawpy.savevtk(os.path.join( 54 | dst_path, "case_6b.vtk"), mesh) 55 | 56 | #------------------------------------ make mesh using JIGSAW 57 | 58 | opts.hfun_hmax = 0.03 # set HFUN limits 59 | 60 | opts.mesh_kern = "delfront" # DELFRONT kernel 61 | opts.mesh_dims = +2 62 | 63 | opts.geom_feat = True 64 | opts.mesh_top1 = True 65 | 66 | jigsawpy.cmd.jigsaw(opts, mesh) 67 | 68 | print("Saving case_6c.vtk file.") 69 | 70 | jigsawpy.savevtk(os.path.join( 71 | dst_path, "case_6c.vtk"), mesh) 72 | 73 | return 74 | -------------------------------------------------------------------------------- /tests/case_7_.py: -------------------------------------------------------------------------------- 1 | """ 2 | * DEMO-7 --- Build surface meshes for the "wheel" geometry; 3 | * defined as a collection of open surfaces. 4 | * 5 | * These examples call to JIGSAW via its api.-lib. interface. 6 | * 7 | * Writes "case_7x.vtk" files on output for vis. in PARAVIEW. 8 | * 9 | """ 10 | 11 | import os 12 | 13 | import jigsawpy 14 | 15 | 16 | def case_7_(src_path, dst_path): 17 | 18 | opts = jigsawpy.jigsaw_jig_t() 19 | 20 | geom = jigsawpy.jigsaw_msh_t() 21 | mesh = jigsawpy.jigsaw_msh_t() 22 | 23 | #------------------------------------ make mesh using JIGSAW 24 | 25 | print("Call libJIGSAW: case 7a.") 26 | 27 | jigsawpy.loadmsh(os.path.join( 28 | src_path, "wheel.msh"), geom) 29 | 30 | opts.hfun_hmax = 0.03 # set HFUN limits 31 | 32 | opts.mesh_kern = "delfront" # DELFRONT kernel 33 | opts.mesh_dims = +2 34 | 35 | opts.geom_feat = True 36 | opts.mesh_top1 = True 37 | opts.mesh_top2 = True 38 | 39 | jigsawpy.lib.jigsaw(opts, geom, mesh) 40 | 41 | print("Saving case_7a.vtk file.") 42 | 43 | jigsawpy.savevtk(os.path.join( 44 | dst_path, "case_7a.vtk"), geom) 45 | 46 | print("Saving case_7b.vtk file.") 47 | 48 | jigsawpy.savevtk(os.path.join( 49 | dst_path, "case_7b.vtk"), mesh) 50 | 51 | return 52 | -------------------------------------------------------------------------------- /tests/case_8_.py: -------------------------------------------------------------------------------- 1 | """ 2 | * DEMO-8 --- re-mesh geometry generated using marching-cubes 3 | * reconstruction. 4 | * 5 | * These examples call to JIGSAW via its api.-lib. interface. 6 | * 7 | * Writes "case_8x.vtk" files on output for vis. in PARAVIEW. 8 | * 9 | """ 10 | 11 | import os 12 | 13 | import jigsawpy 14 | 15 | 16 | def case_8_(src_path, dst_path): 17 | 18 | opts = jigsawpy.jigsaw_jig_t() 19 | 20 | geom = jigsawpy.jigsaw_msh_t() 21 | mesh = jigsawpy.jigsaw_msh_t() 22 | 23 | #------------------------------------ make mesh using JIGSAW 24 | 25 | print("Call libJIGSAW: case 8a.") 26 | 27 | jigsawpy.loadmsh(os.path.join( 28 | src_path, "eight.msh"), geom) 29 | 30 | opts.hfun_hmax = 0.04 # set HFUN limits 31 | 32 | opts.mesh_kern = "delfront" # DELFRONT kernel 33 | opts.mesh_dims = +3 34 | 35 | jigsawpy.lib.jigsaw(opts, geom, mesh) 36 | 37 | print("Saving case_8a.vtk file.") 38 | 39 | jigsawpy.savevtk(os.path.join( 40 | dst_path, "case_8a.vtk"), geom) 41 | 42 | print("Saving case_8b.vtk file.") 43 | 44 | jigsawpy.savevtk(os.path.join( 45 | dst_path, "case_8b.vtk"), mesh) 46 | 47 | return 48 | --------------------------------------------------------------------------------