Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
LoicMarechal committed Nov 29, 2024
2 parents e367873 + de4568d commit 952a157
Show file tree
Hide file tree
Showing 18 changed files with 1,502 additions and 356 deletions.
3 changes: 2 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# GLOBAL CONFIGURATION VARIABLES
################################

cmake_minimum_required (VERSION 3.7.2)
cmake_minimum_required (VERSION 3.10)
set (libMeshb_VERSION_MAJOR 7)
set (libMeshb_VERSION_MINOR 80)
project(libMeshb VERSION ${libMeshb_VERSION_MAJOR}.${libMeshb_VERSION_MINOR} LANGUAGES C)
Expand Down Expand Up @@ -94,6 +94,7 @@ file(WRITE ${PROJECT_BINARY_DIR}/${PROJECT_NAME}Config.cmake
"include(\${CMAKE_CURRENT_LIST_DIR}/meshb-target.cmake)
include(\${CMAKE_CURRENT_LIST_DIR}/libMeshb-target.cmake)
set(libMeshb_INCLUDE_DIRS ${CMAKE_INSTALL_PREFIX}/include)
set(libMeshb_HELPERS_DIRS ${CMAKE_INSTALL_PREFIX}/helpers)
set(libMeshb_LINK_DIRS ${CMAKE_INSTALL_PREFIX}/lib)
set(libMeshb_LIBRARIES Meshb.7 ${AIO_LIBRARIES})
set(libMeshb_Fortran_LIBRARIES Meshbf.7 ${AIO_LIBRARIES})
Expand Down
2 changes: 1 addition & 1 deletion 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.80
## libMeshb version 7.84
A library to handle the *.meshb file format.

## Overview
Expand Down
10 changes: 7 additions & 3 deletions examples/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,13 @@ if (CMAKE_Fortran_COMPILER)
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_block01_f90 test_libmeshb_block01.f90)
target_link_libraries(test_libmeshb_block01_f90 Meshb.7 ${AIO_LIBRARIES})
install (TARGETS test_libmeshb_block01_f90 DESTINATION share/libMeshb/examples COMPONENT examples)

add_executable(test_libmeshb_block02_f90 test_libmeshb_block02.f90)
target_link_libraries(test_libmeshb_block02_f90 Meshb.7 ${AIO_LIBRARIES})
install (TARGETS test_libmeshb_block02_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})
Expand Down
8 changes: 8 additions & 0 deletions examples/test_libmeshb.f
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,14 @@
if(OutMsh.eq.0) STOP ' OutMsh = 0'
print*, 'output IDX: ',OutMsh

res = gmfsetkwdf77(OutMsh, GmfReferenceStrings, 3, 0, t, 0, ho)
res = gmfsetreferencestringf77(OutMsh, GmfSolAtVertices,
+1, 'first scalar')
res = gmfsetreferencestringf77(OutMsh, GmfSolAtVertices,
+2, 'a vector')
res = gmfsetreferencestringf77(OutMsh, GmfSolAtVertices,
+3, 'second scalar')

c Set the solution kinds
t(1) = GmfSca;
t(2) = GmfVec;
Expand Down
120 changes: 86 additions & 34 deletions examples/test_libmeshb.f90
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,61 @@
!> A FAIRE ajouter iteration
!> A FAIRE ajouter nom des champs


function equal_int32(x,y) result(test)
!>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
use iso_fortran_env
integer(int32) , intent(in) :: x(:)
integer(int32) , intent(in) :: y(:)
logical :: test
!>
integer(int32) :: i,nx,ny
!<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
!>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
nx=size(x) ; ny=size(y)
if( .not.nx==ny )stop 'dimensions non compatibles'
!<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
!>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
do i=1,nx
if( .not.x(i)==y(i) )then
test=.false.
return
endif
enddo
test=.true.
!<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
return
end function equal_int32

function equal_real64(x,y) result(test)
!>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
use iso_fortran_env
real(real64) , intent(in) :: x(:)
real(real64) , intent(in) :: y(:)
logical :: test
!>
integer(int32) :: i,nx,ny
!<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
!>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
nx=size(x) ; ny=size(y)
if( .not.nx==ny )stop 'dimensions non compatibles'
!<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
!>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
do i=1,nx
if( .not.x(i)==y(i) )then
test=.false.
return
endif
enddo
test=.true.
!<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
return
end function equal_real64


program test_libmeshb_f90
!>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
use iso_fortran_env
use iso_c_binding, only: C_NULL_CHAR
use libmeshb7
!<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
!>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Expand All @@ -21,9 +72,9 @@ program test_libmeshb_f90
character(80) :: SolFile
integer(int32) :: i
integer(int32) :: NmbVer,NmbQad,NmbTri,ver,dim,res,kwd
integer(int32) :: NmbField,ho,s,d
integer(int32) :: NmbFields,ho,s,d
integer(int32), pointer :: fields(:)
character(32) , pointer :: fieldsName(:)=>null()
character(32) , pointer :: fieldNames(:)=>null()
real(real64) , pointer :: sol(:)
real(real64) , pointer :: VerTab(:,:)
integer(int32), pointer :: VerRef( :)
Expand All @@ -37,8 +88,8 @@ program test_libmeshb_f90

!>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
InpFile='../sample_meshes/quad.mesh'
OutFile='./tri.mesh'
SolFile='./tri.sol'
OutFile='./tri.meshb'
SolFile='./tri.solb'
!<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

!>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Expand Down Expand Up @@ -129,66 +180,67 @@ program test_libmeshb_f90
print '(/"Output Solu Open : ",a )',trim(SolFile)

OutSol=GmfOpenMeshF90(name=trim(SolFile),GmfKey=GmfWrite,ver=ver,dim=dim)

print '( "Output Solu Idx : ",i0)',OutSol
print '( "Output Solu ver : ",i0)',ver
print '( "Output Solu dim : ",i0)',dim
if( OutSol==0 ) STOP ' OutSol = 0'

! Write iteration number in file
res=GmfSetKwdF90 (unit=OutSol, GmfKey=GmfIterations, Nmb=1 )
res=GmfSetLineF90(unit=OutSol, GmfKey=GmfIterations, Tab=int(10,kind=int32)) ! number of iteration (example 10)

! Write Time in solution file
res=GmfSetKwdF90 (unit=OutSol, GmfKey=GmfTime, Nmb=1)
res=GmfSetLineF90(unit=OutSol, GmfKey=GmfTime, Tab=real(60,kind=real64))

! Set the solution kinds
NmbField=3
allocate( fields (1:NmbField))
allocate( fieldsName(1:NmbField))
fields(1:NmbField) = [GmfSca,GmfVec,GmfSca]
fieldsName(1:NmbField)=['sca_1','vec_1','sca_2']

!nomDesChamps : block
! integer :: iField,nChar
! character(:), pointer :: fieldName=>null()
! res=GmfSetKwdF90(unit=OutSol, GmfKey=GmfReferenceStrings, Nmb=NmbField)
! do iField=1,NmbField
! nChar=len_trim(fieldsName(iField)) ! print '("nChar: ",i0)',nChar
! allocate(character(len=nChar+3) :: fieldName)
! write(fieldName,'(a,1x,i0,a)')trim(fieldsName(iField)),iField,C_NULL_CHAR
! print '("fieldName: ",a)',fieldName
!
! !ress=GmfSetLin(unit=OutSol, GmfKey=GmfReferenceStrings, GmfSolAtVertices, 1, fieldName)
!
! deallocate(fieldName)
! enddo
!end block nomDesChamps
NmbFields=3
allocate( fields (1:NmbFields))
allocate( fieldNames(1:NmbFields))
fields(1:NmbFields) = [GmfSca,GmfVec,GmfSca]
fieldNames(1:NmbFields)=['sca_1','vec_1','sca_2']

allocate(sol(1:5)) ! 1+ dim+ 1
print '( "Output Solu NmbVer : ",i0)',NmbVer
print '( "Output Solu nFields : ",i0)',NmbField
print '( "Output Solu fields : ", *(i0,1x))',fields(1:NmbField)
print '( "Output Solu nFields : ",i0)',NmbFields
print '( "Output Solu fields : ", *(i0,1x))',fields(1:NmbFields)

! Set the number of solutions (one per vertex)
res=GmfSetKwdF90(unit=OutSol, GmfKey=GmfSolAtVertices, Nmb=NmbVer, d=NmbField, t=fields(1:NmbField), s=0, ho=ho)
res=GmfSetKwdF90( &
& unit=OutSol ,&
& GmfKey=GmfSolAtVertices ,&
& Nmb=NmbVer ,&
& NmbFields=NmbFields ,&
& fields=fields(1:NmbFields) ,&
& fieldNames=fieldNames(1:NmbFields),& ! <= optional
& iter=10 ,& ! <= optional
& time=60d0 ) ! <= optional

! Write the dummy solution fields
do i=1,NmbVer
sol( 1)=VerTab(1,i)
sol(2:4)=[VerTab(1,i),VerTab(2,i),0d0]
sol( 5)=VerTab(2,i)
res=GmfSetLineF90(unit=OutMsh, GmfKey=GmfSolAtVertices, dTab=sol(:))
res=GmfSetLineF90(unit=OutSol, GmfKey=GmfSolAtVertices, Tab=sol(:))
enddo

! Don't forget to close the file
res=GmfCloseMeshF90(unit=OutSol)
print '("Output Solu Close : ",a)',trim(SolFile)
print '("Output Solu Close : ",a)',trim(SolFile)

deallocate(fields,fieldNames,sol)
!<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

!>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
!> Cleanning Memory
deallocate(VerTab,VerRef)
deallocate(QadTab,QadRef)
deallocate(fields,fieldsName,sol)
!<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

!>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
!> User Control
print '(/"Control:"/"vizir4 -in ",a," -sol ",a/)',trim(OutFile),trim(SolFile)
!<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

end program test_libmeshb_f90
Loading

0 comments on commit 952a157

Please sign in to comment.