Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
LoicMarechal committed Feb 27, 2024
2 parents b4a9151 + 8993274 commit e367873
Show file tree
Hide file tree
Showing 25 changed files with 2,667 additions and 1,461 deletions.
17 changes: 10 additions & 7 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,18 @@

cmake_minimum_required (VERSION 3.7.2)
set (libMeshb_VERSION_MAJOR 7)
set (libMeshb_VERSION_MINOR 54)
set (libMeshb_VERSION_MINOR 80)
project(libMeshb VERSION ${libMeshb_VERSION_MAJOR}.${libMeshb_VERSION_MINOR} LANGUAGES C)

option(WITH_GMF_AIO "Use Unix low-level and asynchronous I/O for higher speed" OFF)
option(WITH_GMF_CPACK "Enable cpack target to generate a zip file containing binaries" OFF)
option(WITH_GMF_FORTRAN "Build the Fortran API" ON )
option(WITH_GMF_CTEST "Enable ctest ti run basic validation tests" OFF)

include (CheckLanguage)
check_language (Fortran)
if(CMAKE_Fortran_COMPILER AND WITH_GMF_FORTRAN)
if(CMAKE_Fortran_COMPILER)
enable_language(Fortran)
set(CMAKE_Fortran_MODULE_DIRECTORY ${CMAKE_BINARY_DIR}/modules)
if (CMAKE_Fortran_COMPILER_ID STREQUAL GNU)
set (CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -std=legacy")
endif ()
endif()

if (NOT CMAKE_BUILD_TYPE)
Expand Down Expand Up @@ -71,6 +68,12 @@ install (DIRECTORY sample_meshes DESTINATION share/libMeshb)
# SET PACKAGE AND DEPLOYMENT VARIABLES
######################################

if(WITH_GMF_CTEST)
enable_testing()
include_directories(${PROJECT_SOURCE_DIR}/testing)
add_subdirectory(testing)
endif()

if (WITH_GMF_CPACK)
include (InstallRequiredSystemLibraries)
set (CPACK_GENERATOR TXZ)
Expand Down Expand Up @@ -112,6 +115,6 @@ install(FILES

message("-- Build mode : " ${CMAKE_BUILD_TYPE})
message("-- cpack target enabled : " ${WITH_GMF_CPACK})
message("-- ctest target enabled : " ${WITH_GMF_CTEST})
message("-- Asynchronous IO : " ${WITH_GMF_AIO})
message("-- Fortran API : " ${WITH_GMF_FORTRAN})
message("-- Install directory : " ${CMAKE_INSTALL_PREFIX})
105 changes: 105 additions & 0 deletions Documentation/fortran_api.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
## GENERAL COMMENTS

Default datatypes throughout the API are 4-byte integers and 8-byte reals except for the library's index, which is an 8-byte integer.

All procedures' arguments are fixed and no more variable arguments are used.

The API is provided to access vertices and some elements. Adding new elements if straightforward but other arbitrary keywords need a dedicated API.

See corresponding C procedures in the main documentation for further information about what these procedures are doing. This readme file is only intended for argument’s description.


## GENERAL PURPOSE PROCEDURES

### gmfopenmeshf77( "filename", mode, version, dimension)

Calls C GmfOpenMesh() with the same arguments.

### gmfclosemeshf77(lib)

Calls C GmfCloseMesh() with the same arguments.


### gmfgotokwdf77(lib, kwd)

Calls C GmfGotoKwd() with the same arguments.

### gmfstatkwdf77(lib, kwd, NmbTyp, SolSiz, TypTab, HOdeg, HOsiz)

Calls C GmfStatKwd with the right arguments depending on whether the keyword is regular, HO or a solution.

From Fortran you need to provide all arguments even if they are not needed.

### gmfsetkwdf77(lib, kwd, NmbTyp, SolSiz, TypTab, HOdeg, HOsiz)

Calls C GmfSetKwd with the right arguments depending on whether the keyword is regular, HO or a solution.

From Fortran you need to provide all arguments even if they are not needed.

### gmfsethonodesorderingf77(lib, kwd, source-ordering, destination-ordering)

Calls C GmfSetHONodesOrdering() with the same arguments.

### gmfgetlinef77(lib, kwd, IntTab, RealTab, Ref)

Reads a full line of a giver keyword's data.
Right now, the default data kinds are integer*4 and real*8.

Integer fields are stored in IntTab(), floating point values are stored in DblTab() and if the keyword includes a reference (GmfVertices and all elements), it is stored in Ref.

Note that even though some keywords don't need all the parameters, you need to provide them all to the function call, use dummy parameters if needed.

### gmfsetlinef77(lib, kwd, IntTab, RealTab, Ref)

Writes a full line of a giver keyword's data.
Right now, the default data kinds are integer*4 and real*8.

Integer fields are stored in IntTab(), floating point values are stored in DblTab() and if the keyword includes a reference (GmfVertices and all elements), it is stored in Ref.

Note that even though some keywords don't need all the parameters, you need to provide them all to the function call, use dummy parameters if needed.


### gmfget blockf77(lib, kwd, BegIdx, EndIdx, MapTyp, MapTab, BegInt, EndInt, BegReal, EndReal, BegRef, EndRef)

Reads multiple data lines in a row.

You need to provide tables big enough to store all the data in one huge memory area.

BegIdx and EndIdx are the first and last line number to be read (1 .. NbElements reads the whole mesh).

BegInt points to the first entity integer's data.

EndInt points to the last entity integer's data.

BegReal points to the first entity REAL*8's data.

EndReal points to the last entity REAL*8's data.

BegRef points to the first entity's reference

EndRef points to the last entity's reference

Like with gmgetlinef77(), some arguments may be useless depending on the keyword but you need to provide some dummy argument instead.


### gmfset blockf77(lib, kwd, BegIdx, EndIdx, MapTyp, MapTab, BegInt, EndInt, BegReal, EndReal, BegRef, EndRef)

Writes multiple data lines in a row.

You need to provide tables big enough to store all the data in one huge memory area.

BegIdx and EndIdx are the first and last line number to be read (1 .. NbElements reads the whole mesh).

BegInt points to the first entity integer's data.

EndInt points to the last entity integer's data.

BegReal points to the first entity REAL*8's data.

EndReal points to the last entity REAL*8's data.

BegRef points to the first entity's reference

EndRef points to the last entity's reference

Like with gmsetlinef77(), some arguments may be useless depending on the keyword but you need to provide some dummy argument instead.
Binary file modified Documentation/libMeshb7.pdf
Binary file not shown.
12 changes: 7 additions & 5 deletions Documentation/libMeshb7.tex
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@

\begin{flushright}
\Large Lo\"ic MAR\'ECHAL / INRIA, Gamma Project\\
\Large March 2019 \\
\normalsize Document v1.92 \\
\normalsize Library v7.60
\Large February 2024 \\
\normalsize Document v1.93 \\
\normalsize Library v7.79
\end{flushright}

\end{titlepage}
Expand Down Expand Up @@ -80,7 +80,7 @@ \subsection{A comprehensive C library}

Reading, writing and querying files is easily done by calling a couple of commands which are provided in an ANSI C file ``libmeshb7.c'' and a header file ``libmeshb7.h''. All is needed is compiling those files along with the calling software.

Fortran APIs are also available: ``libmeshb7.ins'' for F77 and F90.
A partial Fortran API is also available: ``libmeshb7.ins'' for F77 and F90. Refer to fortran\_api.md for more information.


\subsection{ASCII vs. Binary}
Expand All @@ -101,6 +101,8 @@ \subsubsection{About performance}

The \emph{libMeshb} performs very poorly in ASCII mode, which is more processor bound rather than hard-drive bound. Don't expect more than 5 or 10 MB/s throughput.

Higher performance can be achieved through \emph{asynchronous} and \emph{low-level} I/O. This mode is enabled by setting a flag while compiling: (-DWITH\_GMF\_AIO) and linking with an additional library (-lrt).

\subsubsection{Compatibility issue: little vs. big endian}
When it comes to binary storage, the compatibility problem posed by endianness always comes to mind.

Expand Down Expand Up @@ -467,7 +469,7 @@ \subsubsection{Writing mode}
\normalfont

\paragraph{Asynchronous Input Output:}
to get best performance out of flash storage SSD (more than a GB/s), the library needs to access the filesystem through low-level functions and perform the reading and processing tasks in parallel using asynchronous I/O. To do so, you need to compile the library with the {\tt -DWITH\_GMF\_AIO} option and link the final executable with the {\tt -lrt} library under Linux.
to get best performance out of flash storage SSD (more than a GB/s), the library needs to access the filesystem through low-level functions and perform the reading and processing tasks in parallel using asynchronous I/O. To do so, you need to compile the library with the {\tt -DWITH\_AIO} option and link the final executable with the {\tt -lrt} library under Linux.


\subsection{GmfCloseMesh}
Expand Down
2 changes: 1 addition & 1 deletion LICENSE.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2001-2022 Loïc Maréchal / INRIA
Copyright (c) 2001-2024 Loïc Maréchal / INRIA

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
10 changes: 6 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)

## libMeshb version 7.62
## libMeshb version 7.80
A library to handle the *.meshb file format.

## Overview
Expand Down Expand Up @@ -33,14 +33,16 @@ Can call user's own pre and post processing routines in a separate thread while
## Usage
The **libMeshb** library is written in *ANSI C*.
It is made of a single C file and a header file to be compiled and linked alongside the calling program.
It may be used in C, C++, F77 and F90 programs (Fortran 77 and 90 APIs are provided).
It may be used in C and C++ programs (a partial Fortran77 API is provided).
Tested on *Linux*, *macOS*, and *Windows 7->10*.

Reading a mesh file is fairly easy:

("triangles.meshb" should be in version 1 with single precision floating points numbers)

```C++
int64_t LibIdx;
int ver, dim, NmbVer, NmbTri, (*Nodes)[4], *Domains;
int i, ver, dim, NmbVer, NmbTri, (*Nodes)[4], *Domains;
float (*Coords)[3];

// Open the mesh file for reading
Expand All @@ -67,7 +69,7 @@ GmfGotoKwd( LibIdx, GmfTriangles );

// Read each line of triangle data into your own data structures
for(i=0;i<NmbTri;i++)
GmfGetLin( LibIdx, GmfTriangles, &Nodes[i][0], &Nodes[i][1], &tNodest[i][2], &Nodes[i][3] );
GmfGetLin( LibIdx, GmfTriangles, &Nodes[i][0], &Nodes[i][1], &Nodes[i][2], &Nodes[i][3] );

// Close the mesh file !
GmfCloseMesh( LibIdx );
Expand Down
2 changes: 1 addition & 1 deletion copyright.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
All libMeshb code is Copyright 2001-2022 - by Loïc Maréchal / INRIA.
All libMeshb code is Copyright 2001-2024 - by Loïc Maréchal / INRIA.
This program is a free software.
You can redistribute it and/or modify it under the terms of the MIT License
as published by the Open Source Initiative.
Expand Down
28 changes: 21 additions & 7 deletions examples/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -37,16 +37,30 @@ install (TARGETS mesh2poly DESTINATION share/libMeshb/examples COMPONENT example
########################


if (CMAKE_Fortran_COMPILER AND WITH_GMF_FORTRAN)
if (CMAKE_Fortran_COMPILER)
add_executable(test_libmeshb_f77 test_libmeshb.f)
target_link_libraries(test_libmeshb_f77 Meshbf.7 ${AIO_LIBRARIES})
target_link_libraries(test_libmeshb_f77 Meshb.7 ${AIO_LIBRARIES})
install (TARGETS test_libmeshb_f77 DESTINATION share/libMeshb/examples COMPONENT examples)


add_executable(test_libmeshb_f90 test_libmeshb.f90)
target_link_libraries(test_libmeshb_f90 Meshb.7 ${AIO_LIBRARIES})
install (TARGETS test_libmeshb_f90 DESTINATION share/libMeshb/examples COMPONENT examples)

add_executable(test_libmeshb_block_f77 test_libmeshb_block.f)
target_link_libraries(test_libmeshb_block_f77 Meshbf.7 ${AIO_LIBRARIES})
target_link_libraries(test_libmeshb_block_f77 Meshb.7 ${AIO_LIBRARIES})
install (TARGETS test_libmeshb_block_f77 DESTINATION share/libMeshb/examples COMPONENT examples)

add_executable(test_libmeshb_block_f90 test_libmeshb_block.f90)
target_link_libraries(test_libmeshb_block_f90 Meshb.7 ${AIO_LIBRARIES})
install (TARGETS test_libmeshb_block_f90 DESTINATION share/libMeshb/examples COMPONENT examples)

add_executable(test_libmeshb_HO_f90 test_libmeshb_HO.f90)
target_link_libraries(test_libmeshb_HO_f90 Meshb.7 ${AIO_LIBRARIES})
install (TARGETS test_libmeshb_HO_f90 DESTINATION share/libMeshb/examples COMPONENT examples)


#add_executable(test_libmeshb_block_bindC test_libmeshb_block_bindC.f90)
#target_link_libraries(test_libmeshb_block_bindC Meshb.7 ${AIO_LIBRARIES})
#install (TARGETS test_libmeshb_block_bindC DESTINATION share/libMeshb/examples COMPONENT examples)

add_executable(test_libmeshb_block_pipeline test_libmeshb_block_pipeline.f)
target_link_libraries(test_libmeshb_block_pipeline Meshbf.7 ${AIO_LIBRARIES})
install (TARGETS test_libmeshb_block_pipeline DESTINATION share/libMeshb/examples COMPONENT examples)
endif ()
Loading

0 comments on commit e367873

Please sign in to comment.