Commit c4ae6905 authored by mozul's avatar mozul
Browse files

Merge commit '6c30b9ae'

Getting 2015 release candidate
parents 4405c92a 6c30b9ae
......@@ -8,13 +8,49 @@ if( CMAKE_MAJOR_VERSION EQUAL 2 )
endif( CMAKE_MINOR_VERSION EQUAL 8 )
endif( CMAKE_MAJOR_VERSION EQUAL 2 )
project(LMGC90v2_dev Fortran C CXX)
project(LMGC90_dev Fortran C CXX)
SET(LMGC90_MAJOR_VERSION 2)
SET(LMGC90_MINOR_VERSION 0)
SET(LMGC90_PATCH_VERSION 0)
MESSAGE(STATUS "You try to build LMGC90_dev version 2")
MESSAGE(STATUS "You try to build LMGC90_dev")
find_package(Git)
# check if git branch changed between cmake calls
if(${GIT_FOUND})
execute_process( COMMAND ${GIT_EXECUTABLE} rev-parse --abbrev-ref HEAD
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
OUTPUT_VARIABLE GIT_CURRENT_BRANCH
OUTPUT_STRIP_TRAILING_WHITESPACE
)
if( NOT DEFINED GIT_BRANCH )
message(STATUS "Building ${GIT_BRANCH} git branch")
else( NOT DEFINED GIT_BRANCH )
if( GIT_BRANCH STREQUAL GIT_CURRENT_BRANCH )
message(STATUS "Building ${GIT_BRANCH} git branch")
else( GIT_BRANCH STREQUAL GIT_CURRENT_BRANCH )
message(STATUS "[WARNING] building git branch ${GIT_CURRENT_BRANCH},
but branch ${GIT_BRANCH} was previously used")
endif( GIT_BRANCH STREQUAL GIT_CURRENT_BRANCH)
endif( NOT DEFINED GIT_BRANCH )
set(GIT_BRANCH ${GIT_CURRENT_BRANCH} CACHE STRING "last gitbranch used" FORCE)
# check if git branch changed between cmake and make calls
configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/get_git_branch.cmake.in
${CMAKE_CURRENT_BINARY_DIR}/get_git_branch.cmake
@ONLY
)
add_custom_target( get_git_branch ALL
COMMAND ${CMAKE_COMMAND} -P
${CMAKE_CURRENT_BINARY_DIR}/get_git_branch.cmake
)
endif(${GIT_FOUND})
if(NOT DEFINED CMAKE_MACOSX_RPATH)
set(CMAKE_MACOSX_RPATH 0)
endif(NOT DEFINED CMAKE_MACOSX_RPATH)
# path to homemade/taken macros/finds
SET(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/tools/cmake/modules ${CMAKE_MODULE_PATH})
......
......@@ -62,6 +62,7 @@ module wrap_CLALp
trim_CLALp, &
get_nb_vCLALp, &
get_all_CLALp, &
get_all_internal_CLALp, &
! display_contact_energy_CLALp, &
! display_contact_internal_CLALp, &
! get_icdbdy_CLALp, &
......@@ -305,6 +306,27 @@ contains
end if
end subroutine GetAllCLALp
subroutine GetAllInternalCLALp(ptr, dim1, dim2) bind(c, name='CLALp_GetAllInternal')
implicit none
type(c_ptr) :: ptr
integer(c_int) :: dim1, dim2
real(kind=8), dimension(:,:), pointer :: all
all => get_all_internal_clalp()
if( associated(all) ) then
ptr = c_loc(all(1,1))
dim1 = size(all,1)
dim2 = size(all,2)
else
ptr = c_null_ptr
dim1 = 0
dim2 = 0
end if
end subroutine GetAllInternalCLALp
subroutine CleanMemory() bind(c, name='CLALp_CleanMemory')
implicit none
......
......@@ -242,6 +242,23 @@
* @endcond
*/
extern "C" void CLALp_GetAll(double ** matrix_out, int * dim1, int * dim2);
/**
* @fn void CLALp_GetAllInternal(double ** matrix_out, int * dim1, int * dim2)
* @brief return contact point internal variables
*
* @cond PYDOC
* python usage : array = CLALp_GetAllInternal()
* @return array (double 2D-array) : mechanical data
* @endcond
*
* @cond CDOC
* @param[in,out] matrix_out (double **) : xxx
* @param[in] dim1 (int *) i : matrix_out first dimension
* @param[in] dim2 (int *) : matrix_out second dimension
* @endcond
*/
extern "C" void CLALp_GetAllInternal(double ** matrix_out, int * dim1, int * dim2);
/**
* @fn void CLALp_CleanMemory(void)
......
......@@ -59,6 +59,7 @@ MODULE wrap_CSASx
skip_autocontact_CSASp, &
get_nb_vCSASp , &
get_all_CSASp , &
get_all_internal_CSASp, &
clean_memory_CSASp
USE utilities, ONLY : faterr
......@@ -227,6 +228,27 @@ CONTAINS
end if
end subroutine GetAllCSASp
subroutine GetAllInternalCSASp(ptr, dim1, dim2) bind(c, name='CSASp_GetAllInternal')
implicit none
type(c_ptr) :: ptr
integer(c_int) :: dim1, dim2
real(kind=8), dimension(:,:), pointer :: all
all => get_all_internal_csasp()
if( associated(all) ) then
ptr = c_loc(all(1,1))
dim1 = size(all,1)
dim2 = size(all,2)
else
ptr = c_null_ptr
dim1 = 0
dim2 = 0
end if
end subroutine GetAllInternalCSASp
subroutine CleanMemory() bind(c, name='CSASp_CleanMemory')
implicit none
......
......@@ -192,6 +192,23 @@
* @endcond
*/
extern "C" void CSASp_GetAll(double ** matrix_out, int * dim1, int * dim2);
/**
* @fn void CSASp_GetAllInternal(double ** matrix_out, int * dim1, int * dim2)
* @brief return contact point internal variables
*
* @cond PYDOC
* python usage : array = CSASp_GetAllInternal()
* @return array (double 2D-array) : mechanical data
* @endcond
*
* @cond CDOC
* @param[in,out] matrix_out (double **) : xxx
* @param[in] dim1 (int *) i : matrix_out first dimension
* @param[in] dim2 (int *) : matrix_out second dimension
* @endcond
*/
extern "C" void CSASp_GetAllInternal(double ** matrix_out, int * dim1, int * dim2);
/**
* @fn void CSASp_CleanMemory(void)
......
......@@ -45,7 +45,6 @@ MODULE wrap_NLGS_3D
USE NLGS_3D,ONLY:&
solve_nlgs, &
solve_nljacobi, &
comp_check_nlgs, &
write_norm_check_nlgs, &
scramble_nlgs, &
......@@ -62,7 +61,8 @@ MODULE wrap_NLGS_3D
active_diagonal_resolution, &
init_cohe_nlgs_3D, &
assume_is_initialized, &
display_tacinfo
display_tacinfo, &
use_jacobi_solver
logical :: with_quick_scramble = .FALSE.
......@@ -94,13 +94,15 @@ CONTAINS
!! Execute nb_iter NLGS iteration over the contact loop
integer(kind=4) :: ik
call use_jacobi_solver( .TRUE. )
do ik = 1, nb_iter
if (with_quick_scramble) CALL quick_scramble_nlgs
call solve_nljacobi(1)
call solve_nlgs(1)
nb_iter_in_module = nb_iter_in_module + 1
end do
call use_jacobi_solver( .FALSE. )
END SUBROUTINE
......@@ -145,7 +147,9 @@ CONTAINS
CALL prep_check_nlgs(iconv)
IF (iconv == 0 ) RETURN
CALL solve_nljacobi(i_check)
CALL use_jacobi_solver( .TRUE. )
CALL solve_nlgs(i_check)
CALL use_jacobi_solver( .FALSE. )
CALL comp_check_nlgs(iconv)
CALL write_norm_check_nlgs(2)
......@@ -258,7 +262,9 @@ CONTAINS
integer :: i_post = 3
!CALL LOGCHIC('NLGS_3D')
CALL RnodHRloc_nlgs
CALL solve_nlJacobi(i_post)
CALL use_jacobi_solver( .TRUE. )
CALL solve_nlgs(i_post)
CALL use_jacobi_solver( .FALSE. )
CALL Nullify_EntityList_nlgs
CALL write_norm_check_nlgs(3)
......@@ -471,6 +477,16 @@ CONTAINS
call display_tacinfo(ik)
END SUBROUTINE
SUBROUTINE UseJacobiSolver(jacobi) bind(C, name = 'nlgs_3D_UseJacobiSolver')
IMPLICIT NONE
LOGICAL(C_BOOL) ,INTENT(IN), VALUE :: jacobi
LOGICAL(KIND=4) :: jacobi_
jacobi_ = jacobi
call use_jacobi_solver( jacobi_ )
END SUBROUTINE
END MODULE wrap_NLGS_3D
......@@ -336,5 +336,19 @@
* @endcond
*/
extern "C" void nlgs_3D_DisplayTacInfo(int itac);
/**
* @fn void nlgs_3D_UseJacobiSolver(bool jacobi)
* @brief Use a Jacobi solver instead of Gauss Seidel solver
*
* @cond PYDOC
* usage : nlgs_3D_UseJacobiSolver(True) or nlgs_UseJacobiSolver(False)
* @endcond
*
* @cond CDOC
* @param[in] jacobi (boolean) : set to True to use a Jacobi solver
* @endcond
*/
extern "C" void nlgs_3D_UseJacobiSolver(bool jacobi);
#endif /* wrap_nlgs_3D_h */
......@@ -711,15 +711,16 @@ def ReadIniVlocRloc():
SPPLx_ReadIniVlocRloc()
SPSPx_ReadIniVlocRloc()
def ReadMpBehaviours(disper=0):
def ReadMpBehaviours(disper=0.,model='therm'):
"""Read and load multi-physics (for rigids) behaviours.
What is disper ?
"""
global DIMENSION
if DIMENSION == 2:
print 'here',model,disper
mp_solver_ReadMpBehaviour()
RBDY2_MP_LoadBehaviours(disper)
RBDY2_MP_LoadBehaviours(disper,model)
elif DIMENSION == 3:
mp_solver_3D_ReadMpBehaviour()
RBDY3_MP_LoadBehaviours(disper)
......@@ -1021,13 +1022,13 @@ def OpenDisplayFiles(ref_reac=0.):
global DIMENSION, is_vtk_display, fim, fin, fip, fiu, fit, fii, fir, tact_names, inter_names
if is_vtk_display :
wd = overall_GetWorkingDirectory()
fim = startCollection(os.path.join(wd,'mecafe.pvd'))
fin = startCollection(os.path.join(wd,'therfe.pvd'))
fip = startCollection(os.path.join(wd,'porofe.pvd'))
fiu = startCollection(os.path.join(wd,'multife.pvd'))
fit = startCollection(os.path.join(wd,'tacts.pvd'))
fii = startCollection(os.path.join(wd,'inter.pvd'))
fir = startCollection(os.path.join(wd,'rigids.pvd'))
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'))
if DIMENSION == 2:
tact_names = ['DISKx', 'DISKx', 'DISPx', 'JONCx', 'POLYG', 'PT2Dx', 'xKSID', 'xPSID']
inter_names = ['CLALp', 'CLJCx', 'DKALp', 'DKDKL', 'DKDKx', 'DKDPx', 'DKJCx', 'DKKDx',
......@@ -1082,11 +1083,11 @@ def WriteDisplayFiles(freq=1,ref_radius=1.,**kw):
elif v[0] == 'multiFE':
multi_opt[k] = v[1:]
elif v[0] == 'tactor':
tact_opt[k] = v[1:]
tact_opt[k] = v[1]
elif v[0] == 'rigid':
rigid_opt[k] = v[1:]
rigid_opt[k] = v[1]
elif v[0] == 'inter':
inter_opt[k] = v[1:]
inter_opt[k] = v[1]
writeMecafeToVTK(os.path.join(wd,'DISPLAY','mecafe_'+str(wdf)+'.vtu'),fim,DIMENSION,**meca_opt)
writeTherfeToVTK(os.path.join(wd,'DISPLAY','therfe_'+str(wdf)+'.vtu'),fin,DIMENSION,**ther_opt)
......
......@@ -33,7 +33,6 @@ def concatenate_OUTBOX():
working_dir = lmgc90.overall_GetWorkingDirectory()
nb_DOF=0
nb_SDM=0
# Calcul du nombre de sous-domaines pour lesquels des sorties
......@@ -49,82 +48,84 @@ def concatenate_OUTBOX():
continue
nb_SDM=max(nb_SDM,n)
# Calcul du nombre de pas de temps pour lesquels des sorties
# .OUT sont effectuees en parallele.
for root, dirs, files in os.walk(os.path.join(working_dir,"DDM_WD_00001","OUTBOX"), topdown=False):
for myfile in files:
if not myfile.startswith("DOF.OUT."):
continue
T=myfile.split(".")
try:
n=int(T[2])
except Exception:
continue
nb_DOF=max(nb_DOF,n)
# Concatenation des DOF.OUT par sous-domaines en un seul DOF.OUT
# (pour chaque pas de sortie) dans le dossier OUTBOX_CAT.
for i in range(nb_DOF):
my_inputs=[]
for j in range(nb_SDM):
my_inputs.append(os.path.join(working_dir,"DDM_WD_"+"%(#)05d" % {"#": j+1},"OUTBOX","DOF.OUT."+str(i+1)))
my_output=open(os.path.join(working_dir,"OUTBOX","DOF.OUT."+str(i+1)), "w")
for my_file in my_inputs:
my_input=open(my_file, "r")
for line in my_input:
my_output.write(line)
my_input.close()
my_output.close()
# Concatenation des DOF.LAST par sous-domaines en un seul DOF.LAST
# dans le dossier OUTBOX.
my_inputs=[]
for j in range(nb_SDM):
my_inputs.append(os.path.join(working_dir,"DDM_WD_"+"%(#)05d" % {"#": j+1},"OUTBOX","DOF.LAST"))
my_output=open(os.path.join(working_dir,"OUTBOX","DOF.LAST"),"w")
for my_file in my_inputs:
my_input=open(my_file, "r")
for line in my_input:
my_output.write(line)
my_input.close()
my_output.close()
# Concatenation des Vloc_Rloc.OUT par sous-domaines en un seul Vloc_Rloc.OUT
# (pour chaque pas de sortie) dans le dossier OUTBOX.
for i in range(nb_DOF):
import glob
list_file = glob.glob( os.path.join(working_dir,"DDM_WD_00001","OUTBOX","DOF.*" ) )
list_file += glob.glob( os.path.join(working_dir,"DDM_WD_00001","OUTBOX","Vloc_Rloc.*" ) )
list_file += glob.glob( os.path.join(working_dir,"DDM_WD_00001","OUTBOX","GPV.*" ) )
begin = len( os.path.join(working_dir,"DDM_WD_00001","OUTBOX") ) + 1
for f in list_file :
filename = f[begin:]
#Concatenation des filename par sous-domaines en un seul filename
my_inputs=[]
for j in range(nb_SDM):
my_inputs.append(os.path.join("DDM_WD_"+"%(#)05d" % {"#": j+1},"OUTBOX","Vloc_Rloc.OUT."+str(i+1)))
my_output=open(os.path.join(working_dir,"OUTBOX","Vloc_Rloc.OUT."+str(i+1)),"w")
my_inputs.append(os.path.join("DDM_WD_"+"%(#)05d" % {"#": j+1},"OUTBOX",filename))
my_output=open(os.path.join(working_dir,"OUTBOX",filename),"w")
for my_file in my_inputs:
my_input=open(my_file, "r")
for line in my_input:
my_output.write(line)
my_input.close()
my_output.close()
def concatenate_DISPLAY():
"""
Create a paraview pvd format file in /DISPLAY
from all vtu or vtp display files located in /DDM_WD_*/DISPLAY
"""
import glob
# Concatenation des Vloc_Rloc.LAST par sous-domaines en un seul Vloc_Rloc.LAST
# dans le dossier OUTBOX.
my_inputs=[]
for j in range(nb_SDM):
my_inputs.append(os.path.join(working_dir,"DDM_WD_"+"%(#)05d" % {"#": j+1},"OUTBOX","Vloc_Rloc.LAST"))
my_output=open(os.path.join(working_dir,"OUTBOX","Vloc_Rloc.LAST"),"w")
for my_file in my_inputs:
my_input=open(my_file, "r")
for line in my_input:
my_output.write(line)
my_input.close()
working_dir = lmgc90.overall_GetWorkingDirectory()
# Calcul du nombre de pas de temps pour lesquels des sorties
# .vtu/.vtp sont effectuees en parallele.
nb_DOF = len( glob.glob("DDM_WD_00001/DISPLAY/mecafe_*") )
my_output.close()
# Calcul du nombre de sous-domaines pour lesquels des sorties
# paraview sont effectuees en parallele.
nb_SDM = len( glob.glob("DDM_WD_*") )
#Recherche des differents fichiers a concatener : mecafe, inters, etc.
my_fics = []
pvd_list = glob.glob("DDM_WD_00001/DISPLAY/*.pvd")
for f in pvd_list :
my_fics.append( f.replace("DDM_WD_00001/DISPLAY/","").replace(".pvd","") )
for fic in my_fics :
# Calcul du nombre de pas de temps pour lesquels des sorties
# .vtu/.vtp sont effectuees en parallele.
nb_out = len( glob.glob("DDM_WD_00001/DISPLAY/"+fic+"_*") )
if nb_out > 0 :
my_inputs=[]
my_output=open(os.path.join(working_dir,"DISPLAY",fic+".pvd"),"w")
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")
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")
iline=0
for line in my_input:
iline += 1
if iline <=2:
#rien a faire
pass
elif iline ==3:
#on enleve les 12 premiers caracteres
line = line[12:]
line = line.replace("./","../DDM_WD_"+"%(#)05d" % {"#": j+1} + "/DISPLAY/")
my_output.write(line)
elif iline > nb_DOF+2:
#rien a faire
pass
else:
#on copie la ligne
line = line.replace("./","../DDM_WD_"+"%(#)05d" % {"#": j+1} + "/DISPLAY/")
my_output.write(line)
my_output.write("</Collection>")
my_output.write("</VTKFile>")
my_output.close()
\ No newline at end of file
......@@ -143,11 +143,11 @@ class TactorGenerator():
self.name=name
self.GetNb=eval(name+'_GetNb'+name)
if name in ['SPHER', 'POLYR', 'PLANx', 'CYLND', 'DNLYC', 'PT3Dx']:
self.GetTactor2Body=eval(name+'_Get'+name+'2RBDY3Ptr')
self.GetConnectivities=eval(name+'_GetAllConnectivitiesPtr')
self.GetTactor2Body=eval(name+'_GetPtr'+name+'2RBDY3')
self.GetConnectivities=eval(name+'_GetPtrAllConnectivities')
self.IsVisible=eval('RBDY3_IsVisible')
else:
self.GetTactor2Body=eval(name+'_Get'+name+'2RBDY2Ptr')
self.GetTactor2Body=eval(name+'_GetPtr'+name+'2RBDY2')
self.GetConnectivities=None
self.IsVisible=eval('RBDY2_IsVisible')
......@@ -497,7 +497,7 @@ def writeTactorsToVTK(fichier,fid,tacts_dict,**kw):
set_input_of_file(vtpFile, AppendAll)
vtpFile.Write()
time=TimeEvolution_GetTime()
impr='<DataSet timestep="%s" group="" part="0" file="%s"/>\n' % (time,'./DISPLAY/'+os.path.basename(fichier))
impr='<DataSet timestep="%s" group="" part="0" file="%s"/>\n' % (time,'./'+os.path.basename(fichier))
fid.write(impr)
......@@ -559,7 +559,7 @@ def pushInters2D(inters_dict,Append,lr,kw):
for name,dico in kw.items():
#print '-> ',name
if not key in dico:
print key,' not present in dictionary related to',name,' user field'
print key,' not present in dictionary related to ',name,' user field'
raise Exception
iinter=0
......@@ -1046,7 +1046,7 @@ def writeIntersToVTK(fichier,fid,inters_dict,lr,**kw):
vtpFile.Write()
time=TimeEvolution_GetTime()
impr='<DataSet timestep="%s" group="" part="0" file="%s"/>\n' % (time,'./DISPLAY/'+os.path.basename(fichier))
impr='<DataSet timestep="%s" group="" part="0" file="%s"/>\n' % (time,'./'+os.path.basename(fichier))
fid.write(impr)
def writeNewIntersToVTK(f_path,f_name,fid,lr,dim,**kw):
......@@ -1075,7 +1075,7 @@ def writeNewIntersToVTK(f_path,f_name,fid,lr,dim,**kw):
############################
# rigids
def pushRigid(Append,dim):
def pushRigid(Append,dim,kw):
#print 'managing: rigid'
......@@ -1197,20 +1197,33 @@ def pushRigid(Append,dim):
ug.GetPointData().AddArray(alpha)
ug.GetPointData().AddArray(beta)
ug.GetPointData().AddArray(gamma)
# les champs user
if len(kw) != 0:
for name,value in kw.items():
user= vtkFloatArray()
user.SetNumberOfComponents(1)
user.SetName(name)
#print itact,val[itact-1]
user.InsertNextTuple1(value[i-1])
ug.GetPointData().AddArray(user)
add_data_to_append(Append, ug)
return nbm
def writeRigidsToVTK(fichier,fid,dim):
def writeRigidsToVTK(fichier,fid,dim,**kw):
vtuFile = vtkXMLUnstructuredGridWriter()
vtuFile.SetFileName(fichier)
AppendAll=vtkAppendFilter()
nb = pushRigid(AppendAll,dim)
nb = pushRigid(AppendAll,dim,kw)
if nb > 0:
set_input_of_file(vtuFile, AppendAll)
......@@ -1218,7 +1231,7 @@ def writeRigidsToVTK(fichier,fid,dim):
vtuFile.Write()
time=TimeEvolution_GetTime()
impr='<DataSet timestep="%s" group="" part="0" file="%s"/>\n' % (time,'./DISPLAY/'+os.path.basename(fichier))
impr='<DataSet timestep="%s" group="" part="0" file="%s"/>\n' % (time,'./'+os.path.basename(fichier))
fid.write(impr)
############################
......@@ -1394,12 +1407,13 @@ def pushMecafe(Append,dim,kw):
if len(kw) != 0:
for name,value in kw.items():
if value[0] == 'element':
user= vtkFloatArray()
user.SetNumberOfComponents(1)
user.SetName(name)
field = value[1][i]
field = value[1][i-1]
for id_ele,val in enumerate(field):
user.InsertTuple1(id_ele,val)
......@@ -1410,7 +1424,7 @@ def pushMecafe(Append,dim,kw):
user.SetNumberOfComponents(1)
user.SetName(name)
field = value[1][i]
field = value[1][i-1]
for id_node,val in enumerate(field):
user.InsertTuple1(id_node,val)