Commit 738c41fd authored by mozul's avatar mozul

Merge commit 'ad0f6767'

Merge lmgc90_dev for 2016 second release candidate
parents cb16fbfb ad0f6767
......@@ -7,17 +7,26 @@
#ENDIF( NOT OLD_MATLIB_VERSION STREQUAL MATLIB_VERSION )
if(${MATLIB_VERSION} STREQUAL "off")
message(STATUS "No external models library used")
set(LMGC90_BINDINGS_MODELS_SRCS ${CMAKE_CURRENT_SOURCE_DIR}/Std_ExternalModels.f90 PARENT_SCOPE)
set(LMGC90_BINDINGS_MODELS_TARGET_LIBS PARENT_SCOPE)
else()
set(LMGC90_BINDINGS_MODELS_SRCS ${CMAKE_CURRENT_SOURCE_DIR}/MatLib_ExternalModels.f90 PARENT_SCOPE)
if(MATLIB_LIBRARY)
message(STATUS "Matlib Library used : " ${MATLIB_LIBRARY})
set(LMGC90_BINDINGS_MODELS_TARGET_LIBS ${MATLIB_LIBRARY} PARENT_SCOPE)
else(MATLIB_LIBRARY)
set(LMGC90_BINDINGS_MODELS_TARGET_LIBS matlib PARENT_SCOPE)
endif(MATLIB_LIBRARY)
if(${MATLIB_VERSION} STREQUAL "v3")
set(LMGC90_BINDINGS_MODELS_SRCS ${CMAKE_CURRENT_SOURCE_DIR}/MatLib_ExternalModels_v3.f90 PARENT_SCOPE)
else()
set(LMGC90_BINDINGS_MODELS_SRCS ${CMAKE_CURRENT_SOURCE_DIR}/MatLib_ExternalModels_v4.f90 PARENT_SCOPE)
endif()
if(MATLIB_LIBRARY)
message(STATUS "Matlib Library used : " ${MATLIB_LIBRARY})
set(LMGC90_BINDINGS_MODELS_TARGET_LIBS ${MATLIB_LIBRARY} PARENT_SCOPE)
else(MATLIB_LIBRARY)
set(LMGC90_BINDINGS_MODELS_TARGET_LIBS matlib PARENT_SCOPE)
endif(MATLIB_LIBRARY)
endif()
#add_library(lmgc_bindings_models ${LMGC90_BINDINGS_MODELS_SRCS})
......
This diff is collapsed.
......@@ -55,7 +55,7 @@ module ExternalMBS
end subroutine
!> Set a reaction array
subroutine add_reac(i_mbs, i_node, reac, storage)
subroutine add_reac(i_mbs, i_node, reac, storage, frame)
implicit none
!> multi-body index
integer(kind=4), intent(in) :: i_mbs
......@@ -65,6 +65,8 @@ module ExternalMBS
real(kind=8) , dimension(6), intent(in) :: reac
!> array to work on
integer(kind=4), intent(in) :: storage
!> local frame in which to express torques
real(kind=8), dimension(3,3), intent(in) :: frame
end subroutine
......@@ -89,7 +91,7 @@ module ExternalMBS
end subroutine
!> Get a velocity array
subroutine get_vlocy(i_mbs, i_node, vlocy, storage)
subroutine get_vlocy(i_mbs, i_node, vlocy, storage, frame)
implicit none
!> multi-body index
integer(kind=4), intent(in) :: i_mbs
......@@ -99,6 +101,8 @@ module ExternalMBS
real(kind=8) , dimension(6), intent(inout) :: vlocy
!> array to work on
integer(kind=4), intent(in) :: storage
!> local frame in which to express rotation
real(kind=8), dimension(3,3), intent(in) :: frame
end subroutine
......
......@@ -70,7 +70,7 @@ set_property(CACHE OPT PROPERTY STRINGS
# if matlib is to be used and which one
set(MATLIB_VERSION "default" CACHE STRING "Type of matlib to use" )
set_property(CACHE MATLIB_VERSION PROPERTY STRINGS
"off" "default"
"off" "default" "v3"
)
set(EXT_FEM_VERSION "none" CACHE STRING "External FEM library to use")
......
......@@ -60,7 +60,8 @@ MODULE wrap_nlgs
Nullify_EntityList_nlgs,&
update_cohe_nlgs, &
get_all_this, &
use_jacobi_solver
use_jacobi_solver, &
use_regul
logical :: with_quick_scramble = .FALSE.
integer(kind=4) :: nb_iter_in_module
......@@ -357,6 +358,8 @@ CONTAINS
if( timer_id_check /= 0 ) call stop_itimer(timer_id_check)
call display_check_nlgs
IF (iconv == 0) EXIT
END DO
......@@ -415,4 +418,11 @@ CONTAINS
END SUBROUTINE
SUBROUTINE UseRegul() bind(C, name = 'nlgs_UseRegularization')
IMPLICIT NONE
call use_regul()
END SUBROUTINE
END MODULE wrap_nlgs
......@@ -310,4 +310,14 @@
*/
extern "C" void nlgs_UseJacobiSolver(bool jacobi);
/**
* @fn void nlgs_UseRegularization(void)
* @brief use some regularization heuristics on interaction laws
*
* @cond PYDOC
* python usage : nlgs_UseRegularization()
* @endcond
*/
extern "C" void nlgs_UseRegularization(void);
#endif /* wrap_nlgs */
......@@ -61,7 +61,8 @@ MODULE wrap_NLGS_3D
!!$ init_cohe_nlgs_3D, &
assume_is_initialized, &
display_tacinfo, &
use_jacobi_solver
use_jacobi_solver,&
use_regul
logical :: with_quick_scramble = .FALSE.
......@@ -459,7 +460,9 @@ CONTAINS
CALL comp_check_nlgs(iconv)
if( timer_id_check /= 0 ) call stop_itimer(timer_id_check)
call display_check_nlgs
IF (iconv == 0) EXIT
END DO
......@@ -502,5 +505,12 @@ CONTAINS
END SUBROUTINE
SUBROUTINE UseRegul() bind(C, name = 'nlgs_3D_UseRegularization')
IMPLICIT NONE
call use_regul()
END SUBROUTINE
END MODULE wrap_NLGS_3D
......@@ -373,5 +373,14 @@ extern "C" void nlgs_3D_SetWithReverseContactOrder(void);
// */
// extern "C" void nlgs_3D_InitCohesiveBehav(void);
/**
* @fn void nlgs_3D_UseRegularization(void)
* @brief use some regularization heuristics on interaction laws
*
* @cond PYDOC
* python usage : nlgs_3D_UseRegularization()
* @endcond
*/
extern "C" void nlgs_3D_UseRegularization(void);
#endif /* wrap_nlgs_3D_h */
......@@ -439,16 +439,6 @@ def DisplayProxTactors():
SPPLx_DisplayProxTactors()
SPSPx_DisplayProxTactors()
def FatalDamping(nb_step):
"""Compute fatal damping if the current step number is a multiple of nb_step.
"""
global DIMENSION
if DIMENSION == 2:
RBDY2_FatalDamping(nb_step)
elif DIMENSION == 3:
RBDY3_FatalDamping(nb_step)
mecaMAILx_FatalDamping(nb_step)
def FdSelectProxTactors():
"""Special way of computing sphere/sphere contacts.
"""
......@@ -456,6 +446,22 @@ def FdSelectProxTactors():
if DIMENSION == 3:
SPSPx_FdSelectProxTactors()
def FatalDamping(bodies=None):
"""Compute fatal damping for all bodies.
"""
global DIMENSION
if bodies != None:
print 'ERROR : Cannot use input list of bodies in macro function.'
print ' Please use specific function prefixed with either RBDY2_, RBDY3_ or mecaMAILx_ .'
raise Exception
if DIMENSION == 2:
RBDY2_FatalDamping()
elif DIMENSION == 3:
RBDY3_FatalDamping()
mecaMAILx_FatalDamping()
def IncrementStep():
"""Prepare a new time step computation.
"""
......@@ -625,11 +631,16 @@ def ReadModels():
models_InitModels()
ExternalModels_InitModels()
def ReadBodies():
def ReadBodies(version=None):
"""Read BODIES.DAT file in DATBOX directory.
"""
global DIMENSION
MAILx_ReadBodies()
if version :
MAILx_ReadBodies(version)
else :
MAILx_ReadBodies()
if DIMENSION == 2:
RBDY2_ReadBodies()
elif DIMENSION == 3:
......@@ -907,12 +918,17 @@ def WriteBehaviours():
bulk_behav_WriteBehaviours()
tact_behav_WriteBehaviours()
def WriteBodies():
def WriteBodies(version=None):
"""Write bodies in ascii file (OUTBOX/BODIES.OUT).
"""
global DIMENSION
overall_WriteBodies()
MAILx_WriteBodies()
if version :
MAILx_WriteBodies(version)
else :
MAILx_WriteBodies()
if DIMENSION == 2:
RBDY2_WriteBodies()
elif DIMENSION == 3:
......@@ -1026,19 +1042,22 @@ def WriteMpBehaviours():
elif DIMENSION == 3:
mp_solver_3D_WriteMpBehaviour()
def OpenDisplayFiles(ref_reac=0.):
def OpenDisplayFiles(restart=1,ref_reac=0.):
"""Initialize visualization file writing.
"""
global DIMENSION, is_vtk_display, fim, fin, fip, fiu, fit, fii, fir, tact_names, inter_names
global DIMENSION, is_vtk_display, wdf, fim, fin, fip, fiu, fit, fii, fir, tact_names, inter_names
wdf = restart-1
if is_vtk_display :
wd = overall_GetWorkingDirectory()
fim = startCollection(os.path.join(wd,'DISPLAY','mecafe.pvd'))
fin = startCollection(os.path.join(wd,'DISPLAY','therfe.pvd'))
fip = startCollection(os.path.join(wd,'DISPLAY','porofe.pvd'))
fiu = startCollection(os.path.join(wd,'DISPLAY','multife.pvd'))
fit = startCollection(os.path.join(wd,'DISPLAY','tacts.pvd'))
fii = startCollection(os.path.join(wd,'DISPLAY','inters.pvd'))
fir = startCollection(os.path.join(wd,'DISPLAY','rigids.pvd'))
fim = startCollection(wdf,os.path.join(wd,'DISPLAY','mecafe.pvd'))
fin = startCollection(wdf,os.path.join(wd,'DISPLAY','therfe.pvd'))
fip = startCollection(wdf,os.path.join(wd,'DISPLAY','porofe.pvd'))
fiu = startCollection(wdf,os.path.join(wd,'DISPLAY','multife.pvd'))
fit = startCollection(wdf,os.path.join(wd,'DISPLAY','tacts.pvd'))
fii = startCollection(wdf,os.path.join(wd,'DISPLAY','inters.pvd'))
fir = startCollection(wdf,os.path.join(wd,'DISPLAY','rigids.pvd'))
if DIMENSION == 2:
tact_names = ['DISKx', 'DISKx', 'DISPx', 'JONCx', 'POLYG', 'PT2Dx', 'xKSID', 'xPSID']
inter_names = ['CLALp', 'CLJCx', 'DKALp', 'DKDKL', 'DKDKx', 'DKDPx', 'DKJCx', 'DKKDx',
......@@ -1291,6 +1310,8 @@ def checkInteractiveCommand():
WriteLastVlocRloc()
WriteDisplayFiles()
CloseDisplayFiles()
WritePostproFiles()
ClosePostproFiles()
os.remove('stop')
sys.exit()
......@@ -1298,6 +1319,7 @@ def checkInteractiveCommand():
WriteLastDof()
WriteLastGPV()
WriteLastVlocRloc()
WritePostproFiles()
os.remove('save')
if( os.path.exists('display_now') ):
......
......@@ -4,6 +4,7 @@ import os
import subprocess
import shutil
import glob
import vtk
import lmgc90
......@@ -104,6 +105,7 @@ def concatenate_DISPLAY():
my_output.write("<?xml version=\"1.0\"?>\n")
my_output.write("<VTKFile type=\"Collection\" version=\"0.1\" byte_order=\"LittleEndian\">\n")
my_output.write("<Collection>\n")
extension = "." + glob.glob("DDM_WD_00001/DISPLAY/"+fic+"_*")[0].split(".")[1]
for j in range(nb_SDM):
my_file = os.path.join(working_dir,"DDM_WD_"+"%(#)05d" % {"#": j+1},'DISPLAY',fic+".pvd")
my_input=open(my_file, "r")
......@@ -125,6 +127,45 @@ def concatenate_DISPLAY():
#on copie la ligne
line = line.replace("./","../DDM_WD_"+"%(#)05d" % {"#": j+1} + "/DISPLAY/")
my_output.write(line)
# Pour concatener les fichiers meme si le calcul s'est arrete brutalement et que les fichier .pvd
# de chaque processeur ne sont pas generes.
if( iline < 2 ):
for k in range(nb_out) :
f = my_file.replace(".pvd", "")
line = '<DataSet timestep="' + "%(#)05d" % {"#": k} + '.0" group="" part="0" file=".' + f + '_' + str(k+1) + extension + '"/>\n'
my_output.write(line)
# Pour generer des fichiers .pvtu et .pvtp a partir des fichiers .vtu et .vtp
nb_step = len( glob.glob("DDM_WD_00001/DISPLAY/"+fic+"_*"+extension) )
for k in range(nb_step):
vtxFile = None
pvtxFile = None
if( extension == ".vtu" ) :
vtxFile = vtk.vtkXMLUnstructuredGridReader()
pvtxFile = vtk.vtkXMLPUnstructuredGridWriter()
elif( extension == ".vtp" ) :
vtxFile = vtk.vtkXMLPolyDataReader()
pvtxFile = vtk.vtkXMLPPolyDataWriter()
vtxFile.SetFileName("./DDM_WD_00001/DISPLAY/"+fic+"_"+str(k+1)+extension)
pvtxFile.SetNumberOfPieces(nb_SDM)
pvtxFile.SetFileName("./DISPLAY/TEMP.tmp")
pvtxFile.SetInputConnection( vtxFile.GetOutputPort() )
pvtxFile.Write()
orig = open("./DISPLAY/TEMP.tmp","r")
dest = open("./DISPLAY/"+fic+"_"+str(k+1)+extension.replace(".",".p"),'w')
text = orig.read()
for j in range(nb_SDM):
piece_orig = "TEMP_"+str(j)+extension
domain = int(piece_orig.split("_")[1].split(".")[0]) +1
piece_new = "../DDM_WD_"+"%(#)05d" % {"#": domain} + "/DISPLAY/"+fic+"_" + str(k+1) + extension
text = text.replace(piece_orig,piece_new)
dest.write(text)
orig.close()
dest.close()
os.remove( "./DISPLAY/TEMP_0"+extension)
os.remove( "./DISPLAY/TEMP.tmp" )
my_output.write("</Collection>")
my_output.write("</VTKFile>")
my_output.close()
......
......@@ -2298,10 +2298,25 @@ def writeMultifeToVTK(fichier,fid,dim,**kw):
#######################################
# ecriture collections
def startCollection(fichier):
header= '<?xml version="1.0"?>\n<VTKFile type="Collection" version="0.1" byte_order="LittleEndian">\n<Collection>'
fid = open(fichier,'w')
fid.write(header)
def startCollection(restart,fichier):
if restart > 0 :
# taken from stackoverflow :
# smart way to remove last ltd lines from a file
import collections, fileinput
q = collections.deque()
ltd = 2
for line in fileinput.input(fichier, inplace=True):
q.append(line)
if ltd == 0:
print q.popleft(),
else:
ltd -= 1
q.clear()
fid = open(fichier,'a')
else :
header= '<?xml version="1.0"?>\n<VTKFile type="Collection" version="0.1" byte_order="LittleEndian">\n<Collection>\n'
fid = open(fichier,'w')
fid.write(header)
return fid
def stopCollection(fid):
......
......@@ -43,6 +43,7 @@ MODULE wrap_ASpxx
USE iso_c_binding
USE ASpxx,ONLY: load_tactors_ASpxx, set_precon_node_ASpxx, clean_memory_ASpxx
USE a_BDARY_xSpxx,ONLY: set_explode_patch_ASpxx
CONTAINS
!!!----------------------------------------------------
......@@ -70,4 +71,11 @@ CONTAINS
end subroutine
subroutine ExplodePatch() bind(c, name='ASpxx_ExplodePatch')
implicit none
call set_Explode_Patch_ASpxx
end subroutine
END MODULE wrap_ASpxx
......@@ -72,4 +72,14 @@
*/
extern "C" void ASpxx_CleanMemory(void);
/**
* @fn void ASpxx_ExplodePatch(void)
* @brief Explode ASpxx patch in singleton
*
* @cond PYDOC
* python usage : ASpxx_ExplodePatch()
* @endcond
*/
extern "C" void ASpxx_ExplodePatch(void);
#endif /* wrap_ASpxx_h */
......@@ -41,15 +41,14 @@ MODULE wrap_CSxxx
USE iso_c_binding
USE CSxxx,ONLY: load_tactors_CSxxx, &
set_precon_node_CSxxx, &
flip_orientation_CSxxx, &
USE CSxxx,ONLY: load_tactors_CSxxx , &
set_precon_node_CSxxx , &
flip_orientation_CSxxx , &
flip_orientation_one_CSpxx, &
set_shrink_CSxxx, &
set_Quadrature_CSxxx, &
apply_pressure_CSpxx, &
add_reac_CSxxx, &
clean_memory_CSxxx, &
set_shrink_CSxxx , &
apply_pressure_CSpxx , &
add_reac_CSxxx , &
clean_memory_CSxxx , &
apply_surface_load_CSpxx
CONTAINS
......@@ -103,17 +102,17 @@ CONTAINS
END SUBROUTINE
SUBROUTINE SetQuadratureCSxxx(ivalue) bind(c, name='CSxxx_SetQuadrature')
IMPLICIT NONE
!! PURPOSE
!! set the number of CS nodes by face.
!! it helps to compute the length associated to a contact node
subroutine SetQuadratureCSxxx(ivalue) bind(c, name='CSxxx_SetQuadrature')
use utilities, only : logmes
implicit none
integer(c_int), value :: ivalue
integer(c_int), value :: ivalue
CALL set_Quadrature_CSxxx(ivalue)
call logmes('SetQuadratureCSxxx : Obsolete function please remove it in the future',.true.)
!call faterr('wrap::SetQuadratureCSxxx','Obsolete function')
!call set_Quadrature_CSxxx(ivalue)
END SUBROUTINE
end subroutine
SUBROUTINE ApplyPressureCSxxx(ivalue,rvalue) bind(c, name='CSpxx_ApplyPressure')
IMPLICIT NONE
......
......@@ -108,10 +108,10 @@ extern "C" void CSxxx_FlipOrientationOnePatch(int ibdyty,int icspxx);
*/
extern "C" void CSxxx_SetShrink(double shrink);
/**
/**
* @fn void CSxxx_SetQuadrature(int ivalue)
* @brief Set the contact quadrature rule of a CSxxx face.
* It helps to compute the surface associated to a contact node
* OBSOLETE FUNCTION !!!! To remove in the future
*
* @cond PYDOC
* python usage : CSxxx_SetQuadrature(ivalue)
......
......@@ -59,22 +59,66 @@ MODULE wrap_MAILx
set_nodal_field_MAILx, &
clean_memory_MAILx
use overall, only : faterr
CONTAINS
SUBROUTINE ReadBodies() bind(c, name='MAILx_ReadBodies')
IMPLICIT NONE
CALL read_in_bodies_MAILx
END SUBROUTINE
subroutine ReadBodies(version) bind(c, name='MAILx_ReadBodies')
implicit none
character(c_char), dimension(*) :: version
!
integer(kind=4) :: v_maj, v_min, i, j
if( version(1) == c_null_char ) then
v_maj = 2
v_min = 1
else
if( version(1) /= 'v' ) then
call faterr('MAILx::ReadBodies',"Input string must be of form 'vX.Y' (with X and Y major and minor version number)")
end if
i = 2
do while( version(i) /= '.' )
i = i+1
end do
read(version(2:i-1),*) v_maj
j = i + 1
do while( version(j) /= c_null_char )
j = j+1
end do
read(version(i+1:j-1),*) v_min
end if
call read_in_bodies_MAILx(v_maj,v_min)
SUBROUTINE WriteBodies() bind(c, name='MAILx_WriteBodies')
IMPLICIT NONE
end subroutine
CALL write_out_bodies_MAILx
subroutine WriteBodies(version) bind(c, name='MAILx_WriteBodies')
implicit none
character(c_char), dimension(*) :: version
!
integer(kind=4) :: v_maj, v_min, i, j
if( version(1) == c_null_char ) then
v_maj = 2
v_min = 1
else
if( version(1) /= 'v' ) then
call faterr('MAILx::ReadBodies',"Input string must be of form 'vX.Y' (with X and Y major and minor version number)")
end if
i = 2
do while( version(i) /= '.' )
i = i+1
end do
read(version(2:i-1),*) v_maj
j = i + 1
do while( version(j) /= c_null_char )
j = j+1
end do
read(version(i+1:j-1),*) v_min
end if
call write_out_bodies_MAILx(v_maj,v_min)
END SUBROUTINE
end subroutine
SUBROUTINE WriteLastGPV() bind(c, name='MAILx_WriteLastGPV')
IMPLICIT NONE
......
/*==========================================================================
*
* Copyright 2000-2004 CNRS.