{"id":25456838,"url":"https://github.com/szaghi/mortif","last_synced_at":"2026-02-14T00:32:00.390Z","repository":{"id":146096549,"uuid":"70124259","full_name":"szaghi/MORTIF","owner":"szaghi","description":"MORTon Indexer (Z-order) Fortran environment","archived":false,"fork":false,"pushed_at":"2020-09-22T12:43:12.000Z","size":1103,"stargazers_count":12,"open_issues_count":2,"forks_count":2,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-05-13T14:52:16.449Z","etag":null,"topics":["fortran","morton-indexer","morton-order","oop"],"latest_commit_sha":null,"homepage":"","language":"Fortran","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/szaghi.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.bsd-2.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2016-10-06T05:01:43.000Z","updated_at":"2025-02-28T11:55:19.000Z","dependencies_parsed_at":"2023-04-17T22:16:12.532Z","dependency_job_id":null,"html_url":"https://github.com/szaghi/MORTIF","commit_stats":{"total_commits":12,"total_committers":2,"mean_commits":6.0,"dds":0.08333333333333337,"last_synced_commit":"bb454697a64cf828c79ae8129ceed22f34883663"},"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/szaghi/MORTIF","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/szaghi%2FMORTIF","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/szaghi%2FMORTIF/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/szaghi%2FMORTIF/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/szaghi%2FMORTIF/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/szaghi","download_url":"https://codeload.github.com/szaghi/MORTIF/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/szaghi%2FMORTIF/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":276072476,"owners_count":25580509,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-09-20T02:00:10.207Z","response_time":63,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["fortran","morton-indexer","morton-order","oop"],"created_at":"2025-02-18T01:51:27.350Z","updated_at":"2025-09-20T09:19:26.975Z","avatar_url":"https://github.com/szaghi.png","language":"Fortran","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003ca name=\"top\"\u003e\u003c/a\u003e\n\n# MORTIF [![GitHub tag](https://img.shields.io/github/tag/szaghi/MORTIF.svg)]() [![Join the chat at https://gitter.im/szaghi/MORTIF](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/szaghi/MORTIF?utm_source=badge\u0026utm_medium=badge\u0026utm_campaign=pr-badge\u0026utm_content=badge)\n\n[![License](https://img.shields.io/badge/license-GNU%20GeneraL%20Public%20License%20v3,%20GPLv3-blue.svg)]()\n[![License](https://img.shields.io/badge/license-BSD2-red.svg)]()\n[![License](https://img.shields.io/badge/license-BSD3-red.svg)]()\n[![License](https://img.shields.io/badge/license-MIT-red.svg)]()\n\n[![Status](https://img.shields.io/badge/status-stable-brightgreen.svg)]()\n[![Build Status](https://travis-ci.org/szaghi/MORTIF.svg?branch=master)](https://travis-ci.org/szaghi/MORTIF)\n[![Coverage Status](https://img.shields.io/codecov/c/github/szaghi/MORTIF.svg)](http://codecov.io/github/szaghi/MORTIF?branch=master)\n\n### MORTIF, MORTon Indexer (Z-order) Fortran environment\n\nA KISS pure Fortran Library to encode/decode, namely *to map*, multidimensional (integer) indexes into the Morton's index (Z-order)\n\n- MORTIF is a pure Fortran (KISS) library for Morton's ordering;\n- MORTIF is Fortran 2003+ standard compliant;\n- MORTIF is OOP designed;\n- MORTIF is a Free, Open Source Project.\n\n#### Issues\n\n[![GitHub issues](https://img.shields.io/github/issues/szaghi/MORTIF.svg)]()\n[![Ready in backlog](https://badge.waffle.io/szaghi/MORTIF.png?label=ready\u0026title=Ready)](https://waffle.io/szaghi/MORTIF)\n[![In Progress](https://badge.waffle.io/szaghi/MORTIF.png?label=in%20progress\u0026title=In%20Progress)](https://waffle.io/szaghi/MORTIF)\n[![Open bugs](https://badge.waffle.io/szaghi/MORTIF.png?label=bug\u0026title=Open%20Bugs)](https://waffle.io/szaghi/MORTIF)\n\n#### Compiler Support\n\n[![Compiler](https://img.shields.io/badge/GNU-v6.1.x+-brightgreen.svg)]()\n[![Compiler](https://img.shields.io/badge/Intel-v16.x+-brightgreen.svg)]()\n[![Compiler](https://img.shields.io/badge/IBM%20XL-not%20tested-yellow.svg)]()\n[![Compiler](https://img.shields.io/badge/g95-not%20tested-yellow.svg)]()\n[![Compiler](https://img.shields.io/badge/NAG-not%20tested-yellow.svg)]()\n[![Compiler](https://img.shields.io/badge/PGI-not%20tested-yellow.svg)]()\n\n---\n\n| [What is MORTIF?](#what-is-mortif) | [Main features](#main-features) | [Copyrights](#copyrights) | [Documentation](#documentation) | [Install](#install) | [References](#references) |\n\n---\n\n## What is MORTIF?\n\nIn mathematical analysis and computer science, Z-order, Morton order, or Morton code is a function which maps multidimensional data to one dimension while preserving locality of the data points. It was introduced in 1966 by G. M. Morton [[1]](#morton-1966). The z-value of a point in multidimensions is simply calculated by interleaving the binary representations of its coordinate values, see [wikipedia](https://en.m.wikipedia.org/wiki/Z-order_curve).\n\n\u003e Morton's code (Z-order) is a scheme to map multi-dimensional arrays onto to a linear one with a great deal of spatial locality.\n\nMORTIF is a pure Fortran library to encode/decode multidimensional indexes to/from Morton's order. For the implementation details see [[2]](#stocco-2009) and [[3]](#baert-2013).\n\nGo to [Top](#top)\n\n## Main features\n\nHere the main features are listed.\n\n* [x] User-friendly methods to encode/decode multidimensional indexes;\n* [x] Test Driven Developed (TDD);\n* [x] collaborative developed;\n* [x] well documented;\n* [x] free!\n\nAny feature request is welcome.\n\nGo to [Top](#top)\n\n## Copyrights\n\nMORTIF is a Free and Open Source Software (FOSS), it is distributed under a **very permissive** multi-licensing system: selectable licenses are [GPLv3](http://www.gnu.org/licenses/gpl-3.0.html), [BSD2-Clause](http://opensource.org/licenses/BSD-2-Clause), [BSD3-Clause](http://opensource.org/licenses/BSD-3-Clause) and [MIT](http://opensource.org/licenses/MIT), feel free to select the license that best matches your workflow.\n\n\u003e Anyone is interest to use, to develop or to contribute to MORTIF is welcome.\n\nMore details can be found on [wiki](https://github.com/szaghi/MORTIF/wiki/Copyrights).\n\nGo to [Top](#top)\n\n## Documentation\n\nBesides this README file the MORTIF documentation is contained into its own [wiki](https://github.com/szaghi/MORTIF/wiki). Detailed documentation of the API is contained into the [GitHub Pages](http://szaghi.github.io/MORTIF/index.html) that can also be created locally by means of [ford tool](https://github.com/cmacmackin/ford).\n\n### MORTIF in action\n\nMORTIF is a damn simple library, it exposes only 4 (elemental) procedures:\n\n+ `morton2D/demorton2D` to encode/decode 2D indexes;\n+ `morton3D/demorton3D` to encode/decode 3D indexes.\n\nThe encoding procedure are *function* returning the 64 bits Morton's code, while the decoding procedures are *subroutine* returning 2 or 3 32 bits decoded indexes.\n\n#### Encoding limitations\n\nMORTIF assumes that that the Morton's code are stored into a 64 bits integer, thus the following limitations hold for encoding indexes:\n\n+ 2D indexes can have **at most 32 significant bits**, namely you can encode at most 2 `2^32-1` indexes;\n+ 3D indexes can have **at most 21 significant bits**, namely you can encode at most 3 `2^21-1` indexes.\n\n\u003e All the procedures accept 32 bits indexes and 64 bits Morton's code, is up to the user to check **to not overcome** the limit of `2^21-1` for the 3D encoder, no check is performed (for not introduce computational overhead).\n\n#### Encode example\n\nEncode a tuple of indexes is a simple as\n\n```fortran\nuse, intrinsic :: iso_fortran_env, only : int32\nuse mortif\nprint '(A,I20)', \"Morton's code of {0,1,0}: \", morton3D(i=0_int32, j=1_int32, k=0_int32)\n! output: Morton's code of {0,1,0}: 2\n```\n\n\u003e Similarly for 2D encoding.\n\n#### Decode example\n\nDecode a Morton's code is a simple as\n\n```fortran\nuse, intrinsic :: iso_fortran_env, only : int32, int64\nuse mortif\ninteger(int32):: indexes(3) ! Indexes generated by decoding.\ncall demorton3D(code=2_int32, i=indexes(1), j=indexes(2), k=indexes(3))\nprint '(A,3(I11,1X))', \"Decode indexes of Morton's code {2}: \", indexes\n! output: Decode indexes of Morton's code {2}: 0, 1, 0\n```\n\n\u003e Similarly for 2D decoding.\n\nGo to [Top](#top)\n\n## Install\n\nMORTIF is a Fortran library composed by several modules.\n\n\u003e Before download and compile the library you must check the [requirements](https://github.com/szaghi/MORTIF/wiki/Requirements).\n\nTo download and build the project two main ways are available:\n\n+ exploit the [install script](#install-script) that can be downloaded [here](https://github.com/szaghi/MORTIF/releases/latest)\n+ [manually download and build](#manually-download-and-build):\n  + [download](#download)\n  + [build](#build)\n\n---\n\n### install script\n\nMORTIF ships a bash script (downloadable from [here](https://github.com/szaghi/MORTIF/releases/latest)) that is able to automatize the download and build steps. The script `install.sh` has the following usage:\n\n```shell\n→ ./install.sh\nInstall script of MORTIF\nUsage:\n\ninstall.sh --help|-?\n    Print this usage output and exit\n\ninstall.sh --download|-d \u003carg\u003e [--verbose|-v]\n    Download the project\n\n    --download|-d [arg]  Download the project, arg=git|wget to download with git or wget respectively\n    --verbose|-v         Output verbose mode activation\n\ninstall.sh --build|-b \u003carg\u003e [--verbose|-v]\n    Build the project\n\n    --build|-b [arg]  Build the project, arg=fobis|make|cmake to build with FoBiS.py, GNU Make or CMake respectively\n    --verbose|-v      Output verbose mode activation\n\nExamples:\n\ninstall.sh --download git\ninstall.sh --build make\ninstall.sh --download wget --build cmake\n```\n\n\u003e The script does not cover all possibilities.\n\nThe script operation modes are 2 (*collapsible* into one-single-mode):\n\n+ download a new fresh-clone of the latest master-release by means of:\n  + [git](https://git-scm.com/);\n  + [wget](https://www.gnu.org/software/wget/) (also [curl](https://curl.haxx.se/) is necessary);\n+ build a fresh-clone project as static-linked library by means of:\n  + [FoBiS.py](https://github.com/szaghi/FoBiS);\n  + [GNU Make](https://www.gnu.org/software/make/);\n  + [CMake](https://cmake.org/);\n\n\u003e you can mix any of the above combinations accordingly to the tools available.\n\nTypical usages are:\n\n```shell\n# download and prepare the project by means of git and build with GNU Make\ninstall.sh --dowload git --build make\n# download and prepare the project by means of wget (curl) and build with CMake\ninstall.sh --dowload wget --build cmake\n# download and prepare the project by means of git and build with FoBiS.py\ninstall.sh --dowload git --build fobis\n```\n\n---\n\n### manually download and build\n\n#### download\n\nTo download all the available releases and utilities (fobos, license, readme, etc...), it can be convenient to _clone_ whole the project:\n\n```shell\ngit clone --recursive https://github.com/szaghi/MORTIF\ncd MORTIF\ngit submodule update --init --recursive\n```\n\nAlternatively, you can directly download a release from GitHub server, see the [ChangeLog](https://github.com/szaghi/MORTIF/wiki/ChangeLog).\n\n#### build\n\nThe most easy way to compile MORTIF is to use [FoBiS.py](https://github.com/szaghi/FoBiS) within the provided fobos file.\n\nConsequently, it is strongly encouraged to install [FoBiS.py](https://github.com/szaghi/FoBiS#install).\n\n| [Build by means of FoBiS](#build-by-means-of-fobis) | [Build by means of GNU Make](#build-by-means-of-gnu-make) | [Build by means of CMake](#build-by-means-of-cmake) |\n\n---\n\n#### build by means of FoBiS\n\nFoBiS.py is a KISS tool for automatic building of modern Fortran projects. Providing very few options, FoBiS.py is able to build almost automatically complex Fortran projects with cumbersome inter-modules dependency. This removes the necessity to write complex makefile. Moreover, providing a very simple options file (in the FoBiS.py nomenclature indicated as `fobos` file) FoBiS.py can substitute the (ab)use of makefile for other project stuffs (build documentations, make project archive, etc...). MORTIF is shipped with a fobos file that can build the library in both _static_ and _shared_ forms and also build the `Test_Driver` program. The provided fobos file has several building modes.\n\n##### listing fobos building modes\nTyping:\n```bash\nFoBiS.py build -lmodes\n```\nthe following message should be printed:\n```bash\nThe fobos file defines the following modes:\n - \"shared-gnu\"\n  - \"static-gnu\"\n  - \"test-driver-gnu\"\n  - \"shared-gnu-debug\"\n  - \"static-gnu-debug\"\n  - \"test-driver-gnu-debug\"\n  - \"shared-intel\"\n  - \"static-intel\"\n  - \"test-driver-intel\"\n  - \"shared-intel-debug\"\n  - \"static-intel-debug\"\n  - \"test-driver-intel-debug\"\n```\nThe modes should be self-explicative: `shared`, `static` and `test-driver` are the modes for building (in release, optimized form) the shared and static versions of the library and the Test Driver program, respectively. The other 3 modes are the same, but in debug form instead of release one. `-gnu` use the `GNU gfortran` compiler while `-intel` the Intel one.\n\n##### building the library\nThe `shared` or `static` directories are created accordingly to the form of the library built. The compiled objects and mod files are placed inside this directory, as well as the linked library.\n###### release shared library\n```bash\nFoBiS.py build -mode shared-gnu\n```\n###### release static library\n```bash\nFoBiS.py build -mode static-gnu\n```\n###### debug shared library\n```bash\nFoBiS.py build -mode shared-gnu-debug\n```\n###### debug static library\n```bash\nFoBiS.py build -mode static-gnu-debug\n```\n\n##### building the Test Driver program\nThe `Test_Driver` directory is created. The compiled objects and mod files are placed inside this directory, as well as the linked program.\n###### release test driver program\n```bash\nFoBiS.py build -mode test-driver-gnu\n```\n###### debug test driver program\n```bash\nFoBiS.py build -mode test-driver-gnu-debug\n```\n\n##### listing fobos rules\nTyping:\n```bash\nFoBiS.py rule -ls\n```\nthe following message should be printed:\n```bash\nThe fobos file defines the following rules:\n  - \"makedoc\" Rule for building documentation from source files\n       Command =\u003e rm -rf doc/html/*\n       Command =\u003e ford doc/main_page.md\n       Command =\u003e cp -r doc/html/publish/* doc/html/\n  - \"deldoc\" Rule for deleting documentation\n       Command =\u003e rm -rf doc/html/*\n  - \"maketar\" Rule for making tar archive of the project\n       Command =\u003e tar -czf MORTIF.tar.gz *\n  - \"makecoverage\" Rule for performing coverage analysis\n       Command =\u003e FoBiS.py clean -mode test-driver-gnu\n       Command =\u003e FoBiS.py build -mode test-driver-gnu -coverage\n       Command =\u003e ./Test_Driver/Test_Driver\n       Command =\u003e ./Test_Driver/Test_Driver -v\n       Command =\u003e ./Test_Driver/Test_Driver -s 'Hello MORTIF' -i 2\n       Command =\u003e ./Test_Driver/Test_Driver 33.0 -s 'Hello MORTIF' --integer_list 10 -3 87 -i 3 -r 64.123d0  --boolean --boolean_val .false.\n  - \"coverage-analysis\" Rule for performing coverage analysis and saving reports in markdown\n       Command =\u003e FoBiS.py clean -mode test-driver-gnu\n       Command =\u003e FoBiS.py build -mode test-driver-gnu -coverage\n       Command =\u003e ./Test_Driver/Test_Driver\n       Command =\u003e ./Test_Driver/Test_Driver -v\n       Command =\u003e ./Test_Driver/Test_Driver -s 'Hello MORTIF' -i 2\n       Command =\u003e ./Test_Driver/Test_Driver 33.0 -s 'Hello MORTIF' --integer_list 10 -3 87 -i 3 -r 64.123d0  --boolean --boolean_val .false.\n       Command =\u003e gcov -o Test_Driver/obj/ src/*\n       Command =\u003e FoBiS.py rule -gcov_analyzer wiki/ Coverage-Analysis\n       Command =\u003e rm -f *.gcov\n```\nThe rules should be self-explicative.\n\n---\n\n#### build by means of GNU Make\n\nBad choice :-)\n\nHowever, a makefile (generated by FoBiS.py...) to be used with a compatible GNU Make tool is [provided](https://github.com/szaghi/MORTIF/blob/master/makefile).\n\nIt is convenient to clone the whole MORTIF repository and run a *standard* make:\n\n```shell\ngit clone --recursive https://github.com/szaghi/MORTIF\ncd MORTIF\nmake -j 1\n```\n\nThis commands build all tests (executables are in `exe/` directory). To build only the library (statically linked) type:\n\n```shell\ngit clone --recursive https://github.com/szaghi/MORTIF\ncd MORTIF\nmake -j 1 STATIC=yes\n```\n\n#### Build by means of CMake\n\nBad choice :-)\n\nHowever, a CMake setup (kindly developed by [victorsndvg](https://github.com/victorsndvg)) is provided.\n\nIt is convenient to clone the whole MORTIF repository and run a *standard* CMake configure/build commands:\n\n```shell\ngit clone --recursive https://github.com/szaghi/MORTIF $YOUR_MORTIF_PATH\nmkdir build\ncd build\ncmake $YOUR_MORTIF_PATH\ncmake --build .\n```\n\nIf you want to run the tests suite type:\n\n```shell\ngit clone --recursive https://github.com/szaghi/MORTIF $YOUR_MORTIF_PATH\nmkdir build\ncd build\ncmake -DMORTIF_ENABLE_TESTS=ON $YOUR_MORTIF_PATH\ncmake --build .\nctest\n```\n\nGo to [Top](#top)\n\n### References\n\n\u003ca name=\"morton-1966\"\u003e\u003c/a\u003e[[1]](#morton-1966) *A Computer Oriented Geodetic Data Base and a New Technique in File Sequencing*, Morton G.M., technical report, IBM, 1966.\n\n\u003ca name=\"stocco-2009\"\u003e\u003c/a\u003e[[2]](#stocco-2009) *On Spatial Orders and Location Codes*, Stocco, LJ and Schrack, G, IEEE Transaction on Computers, vol 58, n 3, March 2009.\n\n\u003ca name=\"baert-2013\"\u003e\u003c/a\u003e[[3]](#baert-2013) *Out-of-Core Construction of Sparse Voxel Octrees*, J. Baert, A. Lagae and Ph. Dutré, Proceedings of the Fifth ACM SIGGRAPH/Eurographics conference on High-Performance Graphics, 2013.\n\nGo to [Top](#top)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fszaghi%2Fmortif","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fszaghi%2Fmortif","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fszaghi%2Fmortif/lists"}