Skip to content

Commit

Permalink
merge develop
Browse files Browse the repository at this point in the history
  • Loading branch information
sgarnotel committed Feb 15, 2024
2 parents 5eff986 + 4fdeaa2 commit 7eb7b0d
Show file tree
Hide file tree
Showing 33 changed files with 1,336 additions and 235 deletions.
6 changes: 3 additions & 3 deletions 3rdparty/getall
Original file line number Diff line number Diff line change
Expand Up @@ -171,10 +171,10 @@ download('parmmg','https://github.com/prj-/ParMmg/archive/9cb2f7a22ef590d196d028
'https://github.com/prj-',
'parmmg.zip',
'32035de70272121137c0869e8c49e4bd');
download('PETSc','https://web.cels.anl.gov/projects/petsc/download/release-snapshots/petsc-3.20.2.tar.gz',
download('PETSc','https://web.cels.anl.gov/projects/petsc/download/release-snapshots/petsc-3.20.3.tar.gz',
'https://web.cels.anl.gov/projects/petsc/download/release-snapshots/',
'petsc-3.20.2.tar.gz',
'1e170a5f096433ca21aa643c80c749eb');
'petsc-3.20.3.tar.gz',
'6308a8c0811f8bfaf4b6c71577d3f2d4');

download('htool','https://github.com/htool-ddm/htool/archive/946875d79d0036afb4dc2c0c13c165a607d830df.zip',
'https://github.com/htool-ddm/',
Expand Down
2 changes: 1 addition & 1 deletion 3rdparty/mmg/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ FAIT.done:tag-tar
cd build && cmake ../mmg-sources \
-DCMAKE_C_COMPILER=$(CC) \
-DCMAKE_C_FLAGS="$(CFLAGS) -fPIC" \
-DCMAKE_CXX_COMPILER=$(CXX) \
-DCMAKE_CXX_COMPILER="$(CXX)" \
-DCMAKE_CXX_FLAGS="$(CXXFLAGS) $(CXX11FLAGS) -fPIC" \
-DM_LIB="-lm" -DUSE_ELAS=OFF -DUSE_VTK=OFF \
-DSCOTCH_DIR=$(scotch_dir) \
Expand Down
11 changes: 7 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ All notable changes to this project will be documented in this file.

### Added

-
- interface with functional interface with fgmres (Linear and affine) in real and complex case
see tutorial/algo.edp

### Changed

Expand All @@ -43,9 +44,11 @@ All notable changes to this project will be documented in this file.

### Fixed

- ***

---
- correct hidden faces on surface mesh (ffglut)
- remove optimisation flag ppm2rnm.cpp in macos (load trap)
- correct abcisse curviline on reparametrage function (setcurveabcisse) in load "Curvature"
- correct compilation on ARM sonoma xcode 15.2
- correct mpi essai.edp MPI_ANY_SOURCE Pb.

## [4.14]

Expand Down
665 changes: 665 additions & 0 deletions CHANGELOG.md1

Large diffs are not rendered by default.

13 changes: 7 additions & 6 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -285,15 +285,16 @@ install-exec-local:: bin/script/PostInstall.sh FreeFEM-documentation.pdf
tar cvf - $(FF_EXAMPLES_FILES)| (cd "$(DESTDIR)$(pkgdatadir)/$(VERSION)"; tar xvf -)
$(INSTALL_SCRIPT) examples/CheckAll examples/CheckAllEdp "$(DESTDIR)$(pkgdatadir)/$(VERSION)"
$(mkinstalldirs) -m 755 "$(DESTDIR)${bindir}"
test ! -s FreeFEM-documentation.pdf || $(INSTALL_DATA) FreeFEM-documentation.pdf "$(DESTDIR)$(pkgdatadir)"
test `uname` != Darwin || $(INSTALL_SCRIPT) FreeFem++-CoCoa "$(DESTDIR)${bindir}"
test `uname` != Darwin || echo "$(bindir)" > "$(DESTDIR)/etc/paths.d/FreeFem++"
test `uname` != Darwin || ( rm "$(DESTDIR)/usr/local/bin/FreeFem++-CoCoa"; $(INSTALL_SCRIPT) FreeFem++-CoCoa "$(DESTDIR)/usr/local/bin" )
test `uname` != Darwin || ( $(MAKE) FreeFem++.app.tgz; test -d "$(DESTDIR)/Applications" || mkdir -p "$(DESTDIR)/Applications"; tar zxf FreeFem++.app.tgz -C "$(DESTDIR)/Applications" )
test `uname` != Darwin || ( $(MAKE) bin/movefortranlib )
$(mkinstalldirs) -m 755 "$(DESTDIR)$(ff_prefix_dir)/idp"
cd idp; for i in *.idp; do \
if [ -f $$i ]; then $(INSTALL) -m 555 $$i "$(DESTDIR)$(ff_prefix_dir)/idp"; fi; done
test ! -s FreeFEM-documentation.pdf || $(INSTALL_DATA) FreeFEM-documentation.pdf "$(DESTDIR)$(pkgdatadir)"
test `uname` != Darwin || ( rm "$(DESTDIR)/usr/local/bin/FreeFem++-CoCoa"; $(INSTALL_SCRIPT) FreeFem++-CoCoa "$(DESTDIR)/usr/local/bin" )
test `uname` != Darwin || $(INSTALL_SCRIPT) FreeFem++-CoCoa "$(DESTDIR)${bindir}"
# need sudo ...
#winDssSSs test `uname` != Darwin || echo "$(bindir)" > "$(DESTDIR)/etc/paths.d/FreeFem++"
# test `uname` != Darwin || ( $(MAKE) FreeFem++.app.tgz; test -d "$(DESTDIR)/Applications" || mkdir -p "$(DESTDIR)/Applications"; tar zxf FreeFem++.app.tgz -C "$(DESTDIR)/Applications" )
# test `uname` != Darwin || ( $(MAKE) bin/movefortranlib )

bin/script/PostInstall.sh:./Makefile bin/script/PostInstall.m4
m4 "-DFF__FVER=$(PACKAGE_VERSION)" "-DFF_BINDIR=$(bindir)" "-DFF__DATADIR=$(pkgdatadir)" bin/script/PostInstall.m4 > bin/script/PostInstall.sh
Expand Down
4 changes: 2 additions & 2 deletions bin/Get-list-dylib-use
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
# egrep '.dylib$'| sort -u \
#|awk -F/ '{ if (f[$NF]!=1 ) print $0; f[$NF]=1;}'
(
(echo export DYLD_PRINT_LIBRARIES=1;ls plugin/seq/*.dylib|grep -v fflapack| awk '{print "src/nw/FreeFem++ -check_plugin ",$0}' )|sh 2>&1|awk '$1 ~ /dyld\[[0-9]*\]/ {print $3}'| sort -u
(echo export DYLD_PRINT_LIBRARIES=1;ls plugin/mpi/*.dylib|grep -v fflapack| awk '{print "src/mpi/FreeFem++-mpi -check_plugin ",$0}' )|sh 2>&1|awk '$1 ~ /dyld\[[0-9]*\]/ {print $3}'| sort -u
(echo export DYLD_PRINT_LIBRARIES=1;ls plugin/seq/*.dylib|grep -v fflapack| awk '{print "src/nw/FreeFem++ -check_plugin ",$0}' )|sh 2>&1|awk '$1 ~ /dyld:/ {print $4}'| sort -u
(echo export DYLD_PRINT_LIBRARIES=1;ls plugin/mpi/*.dylib|grep -v fflapack| awk '{print "src/mpi/FreeFem++-mpi -check_plugin ",$0}' )|sh 2>&1|awk '$1 ~ /dyld:/ {print $4}'| sort -u
)| sort -u | grep .dylib > etc/list-dylib

egrep -v '/usr/lib/|/System/|./plugin/' etc/list-dylib >etc/list-dylib-no-os
Expand Down
17 changes: 12 additions & 5 deletions bin/compile-version-MacOS
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,11 @@ nameopt=
export dirdmgpkg=
case $3 in
*generic*) optionconf+=--enable-generic;;
esac
case $3 in
*debug*) optionconf+=--enable-debug;nameopt+=-g;;
esac
case $3 in
*optim*) optionconf+=--enable-optim;nameopt+=-O;;
esac

Expand Down Expand Up @@ -74,6 +78,7 @@ rm -rf $fftmp
)
brewlibgfortran=`grep gfortran $prefix/gnu/list-dylib-gfortran`
brewlibquadmath=`grep libquadmath $prefix/gnu/list-dylib-gfortran`
brewlibgcc_s=`grep libgcc_s $prefix/gnu/list-dylib-gfortran`
(
cd $(dirname $brewlibgfortran)
cp -f libgfortran.5.dylib libquadmath.0.dylib libgcc_s.1.1.dylib $prefix/gnu/
Expand All @@ -91,6 +96,8 @@ dirlibgfortranold=$(dirname $brewlibgfortran)
dirlibgfortrannew=$prefix/gnu
libgfortrandylib=$(basename $brewlibgfortran)
libquadmathdylib=$(basename $brewlibquadmath)
libgccsdylib=$(basename $brewlibgcc_s)
echo2 dylibfort : $libgfortrandylib $libquadmathdylib $libgccsdylib
cd -
test -d pkg || mkdir -v pkg
(
Expand Down Expand Up @@ -174,9 +181,10 @@ echo2 ================================
tmpdylib=/tmp/dylib-ff-$$.txt
tmplst=/tmp/otool-ff-$$.txt
echo2 find $dirpkg/$prefix -name '*.dylib'
echo2 .. $changedylibgfortran $dirlibgfortranold $dirlibgfortrannew $libgfortrandylib $libquadmathdylib
echo2 ... $changedylibgfortran $dirlibgfortranold $dirlibgfortrannew $libgfortrandylib $libquadmathdylib $libgccsdylib
echo2 ... $libgccsdylib
find $dirpkg/$prefix -name '*.dylib' > $tmpdylib
$changedylibgfortran $dirlibgfortranold $dirlibgfortrannew $libgfortrandylib $libquadmathdylib `cat $tmpdylib`
$changedylibgfortran $dirlibgfortranold $dirlibgfortrannew $libgfortrandylib $libquadmathdylib $libgccsdylib `cat $tmpdylib`
## verification
echo2 dylib to brew in installation for debug !!!!
cat $tmpdylib| xargs otool -L | egrep -i 'brew|/opt/' ||echo2 OK
Expand All @@ -188,14 +196,13 @@ echo2 ================================


test -d /tmp/$dirdmgpkg || (
mkdir /tmp/$dirdmgpkg
mkdir /tmp/$dirdmgpkg )
cd /tmp/$dirdmgpkg
mv $dirpkg/Applications/FreeFem++.app /tmp/$dirdmgpkg
rsync -av $dirpkg/Applications/FreeFem++.app /tmp/$dirdmgpkg
cp $dirscript/script/Install-app.sh /tmp/$dirdmgpkg
fftestedp=`find . -name Laplace.edp`
sed -e "s/@VV@/$ver/" -e "s%@APPFF@%$dirdmgpkg%" -e s%@FFTEST@%$fftestedp% <$dirscript/script/README.md.in > README.md

)
cp $dirscript/script/Install-app.sh /tmp/$dirdmgpkg

exec 1>&3 # save log is closo $LOG
Expand Down
2 changes: 1 addition & 1 deletion bin/script/Install-app.sh
Original file line number Diff line number Diff line change
Expand Up @@ -95,5 +95,5 @@ vvv=`$dirff/FreeFem++ -nw| grep 'version'| wc -l`
if [ $vvv -eq 0 ]; then
echo Error missing install missing lib or quarantine ?
else
echo FreeFem++ work
echo FreeFem++ seems to work!
fi
4 changes: 3 additions & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -194,9 +194,11 @@ AM_MAINTAINER_MODE
echo >config_LIB_INFO

# Necessary compilers

# remove the flag -sdt=gnu++11 in the compileur CXX (FH jan 2024)
ac_cv_prog_cxx_cxx11=no
AC_PROG_CC
AC_PROG_CXX
# echo " #### $CXX"
AC_LANG(C++)
if test `uname` != Darwin; then
ff_ldeg="-Wl,--end-group"
Expand Down
1 change: 1 addition & 0 deletions etc/config/m4/WindowsPackage.m4
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ Name: "{app}\examples\eigen"; Permissions: everyone-full
Name: "{app}\idp"; Permissions: everyone-full
IFMPI Name: "{app}\examples\mpi"; Permissions: everyone-full
IFMPI Name: "{app}\examples\hpddm"; Permissions: everyone-full
IFMPI Name: "{app}\examples\ffddm"; Permissions: everyone-full

; PETSc
IFPETSC Name: "{app}\ff-petsc"; Permissions: everyone-full
Expand Down
2 changes: 2 additions & 0 deletions examples/examples/stokes_periodic_composite.edp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ fespace Ph(Th,P1);

fespace Vh=UhPerio*Uh*Ph; // definition of the composite FE space

cout << "ndof = " << Vh.ndof << endl;

UhPerio u1;
Uh u2;
Ph p;
Expand Down
3 changes: 2 additions & 1 deletion examples/mpi/essai.edp
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ else if (mpirank==0) Irecv(processor(1,mpiCommWorld,rr),B[3]);
mpiWait(rr);
if (mpirank==0) cout << " B3= " << B[3] << endl;
if (mpirank==1) cout << " A= " << A << endl;

}

// asyncronous send/recv messages....
Expand Down Expand Up @@ -128,7 +129,7 @@ if(mpirank==0)
{
for (int i=0;i<mpisize;++i)
{
processor(-1) >> ww;
processor(mpiAnySource) >> ww; // correction jan 2024 mpiAnySource==-2 in mpich
cout << " case " << i << " " << ww[0] << endl ;
}
}
Expand Down
2 changes: 2 additions & 0 deletions examples/plugin/splitmesh6.edp
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
load "splitmesh6"
mesh Th=square(5,5);
mesh Th6=splitmesh6(Th);
mesh Th6b=splitmesh6PowellSabin(Th);// Add for François Bouchut feb 2024
plot(Th6,wait=1);
plot(Th6b,wait=1);

fespace Vh(Th,P1);
fespace Nh(Th,P0);
Expand Down
46 changes: 43 additions & 3 deletions examples/tutorial/algo.edp
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
// cleanning version 07/2008 FH in Sevilla.
// VERSION 2024 avec FGMRES test ... FH
int nerr =0;
int debugJ =0;
int debugdJ =0;
real umax=0;
//load "fgmres"
{
func bool stop(int iter,real[int] u,real[int] g)
{
Expand All @@ -12,6 +14,7 @@ real umax=0;
// minimisation of $J(u) = \frac12\sum (i+1) u_i^2 - b_i $
// work array
real[int] b(10),u(10);
complex[int] cb(10),cu(10);

func real J(real[int] & u)
{
Expand All @@ -21,8 +24,16 @@ real umax=0;
if(debugJ) cout << "J ="<< s << " u =" << u[0] << " " << u[1] << "...\n" ;
return s;
}

// the grad of J (this is a affine version (the RHS is in )
func complex cJ(complex[int] & u)
{
complex s=0;
for (int i=0;i<u.n;i++)
s +=(i+1)*u[i]*u[i]*0.5 - b[i]*u[i];
if(debugJ) cout << "J ="<< s << " u =" << u[0] << " " << u[1] << "...\n" ;
return s;
}

// the grad of J (this is a affine version (the RHS is in )
func real[int] DJ(real[int] &u)
{
for (int i=0;i<u.n;i++)
Expand All @@ -32,6 +43,15 @@ real umax=0;
if(debugdJ) cout << "dJ-b ="<< " u =" << u[0] << " " << u[1] << " " << u[2] << "...\n" ;
return u; // return of global variable ok
};
func complex[int] cDJ(complex[int] &u)
{
for (int i=0;i<u.n;i++)
u[i]=(i+1)*u[i];
if(debugdJ) cout << "dJ0 ="<< " u =" << u[0] << " " << u[1] << " " << u[2] << "...\n" ;
u -= cb;
if(debugdJ) cout << "dJ-b ="<< " u =" << u[0] << " " << u[1] << " " << u[2] << "...\n" ;
return u; // return of global variable ok
};

// the grad of the bilinear part of J (the RHS in remove)
func real[int] DJ0(real[int] &u)
Expand All @@ -50,7 +70,15 @@ real umax=0;
s += abs((i+1)*u[i] - b[i]);
return s;
}
func real error(complex[int] & u,complex[int] & b)
{
real s=0;
for (int i=0;i<u.n;i++)
s += abs((i+1)*u[i] - b[i]);
return s;
}
func real[int] matId(real[int] &u) { return u;};
func complex[int] cmatId(complex[int] &u) { return u;};
int verb=5; // verbosity of algo ..
b=1. ; u=0.; // set right hand side and initial gest
LinearCG(DJ,u,eps=1.e-6,nbiter=20,precon=matId,verbosity=verb);
Expand All @@ -70,13 +98,25 @@ real umax=0;
nerr += !(error(u,b) < 1e-5);
if(nerr) cout << " sol: "<< " u =" << u[0] << " " << u[1] << " " << u[2] << "...\n" ;


b=1; u=0; // set right hand side and initial gest
AffineGMRES(DJ,u,eps=1.e-6,nbiter=20,precon=matId,verbosity=verb); // correct in version 3.11
cout << "LinearGMRES (Affine) : J(u) = " << J(u) << " err=" << error(u,b) << endl;
nerr += !(error(u,b) < 1e-5);
if(nerr) cout << " sol: "<< " u =" << u[0] << " " << u[1] << " " << u[2] << "...\n" ;


b=1; u=0; // set right hand side and initial gest
AffineFGMRES(DJ,u,eps=1.e-6,nbiter=20,precon=matId,verbosity=verb); // correct in version 3.11
cout << "LinearFGMRES (Affine) : J(u) = " << J(u) << " err=" << error(u,b) << endl;
nerr += !(error(u,b) < 1e-5);
if(nerr) cout << " sol: "<< " u =" << u[0] << " " << u[1] << " " << u[2] << "...\n" ;

cb=1; cu=0; // set right hand side and initial gest
AffineFGMRES(cDJ,cu,eps=1.e-6,nbiter=20,verbosity=verb); // correct in version 3.11
cout << "complex LinearFGMRES (Affine) : " << " err=" << error(cu,cb) << endl;
nerr += !(error(cu,cb) < 1e-5);
if(nerr) cout << " sol: "<< " cu =" << cu[0] << " " << cu[1] << " " << cu[2] << "...\n" ;

b=1; u=0; // set right hand side and initial gest
LinearGMRES(DJ0,u,b,eps=1.e-6,nbiter=20,precon=matId,verbosity=verb);
cout << "LinearGMRES (Linear) : J(u) = " << J(u) << " err=" << error(u,b) << endl;
Expand Down
32 changes: 16 additions & 16 deletions plugin/mpi/bem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -795,8 +795,8 @@ AnyType SetOpHMatrixUser(Stack stack,Expression emat, Expression eop)
ffassert(Vh);
ffassert(Uh);

int n=Uh->NbOfDF;
int m=Vh->NbOfDF;
int m=Uh->NbOfDF;
int n=Vh->NbOfDF;

HMatrixVirt<R>** Hmat =GetAny<HMatrixVirt<R>** >((*emat)(stack));

Expand Down Expand Up @@ -826,8 +826,8 @@ AnyType SetOpHMatrixUser(Stack stack,Expression emat, Expression eop)

*Hmat =0;

vector<double> p1(3*n);
vector<double> p2(3*m);
vector<double> pt(3*n);
vector<double> ps(3*m);
Fem2D::R3 pp;
bemtool::R3 p;
SRdHat pbs;
Expand All @@ -851,7 +851,7 @@ AnyType SetOpHMatrixUser(Stack stack,Expression emat, Expression eop)
bool TP0 = TRdHat::d == 1 ? (Tnbv == 0) && (Tnbe == 1) && (Tnbt == 0) : (Tnbv == 0) && (Tnbe == 0) && (Tnbt == 1);
bool TP1 = (Tnbv == 1) && (Tnbe == 0) && (Tnbt == 0);

for (int i=0; i<n; i++) {
for (int i=0; i<m; i++) {
if (SP1)
pp = ThU.vertices[i];
else if (SP0)
Expand All @@ -860,13 +860,13 @@ AnyType SetOpHMatrixUser(Stack stack,Expression emat, Expression eop)
if (mpirank == 0) std::cerr << "ff-Htool error: only P0 and P1 discretizations are available for now." << std::endl;
ffassert(0);
}
p1[3*i+0] = pp.x;
p1[3*i+1] = pp.y;
p1[3*i+2] = pp.z;
ps[3*i+0] = pp.x;
ps[3*i+1] = pp.y;
ps[3*i+2] = pp.z;
}

if(!samemesh) {
for (int i=0; i<m; i++) {
for (int i=0; i<n; i++) {
if (TP1)
pp = ThV.vertices[i];
else if (TP0)
Expand All @@ -875,22 +875,22 @@ AnyType SetOpHMatrixUser(Stack stack,Expression emat, Expression eop)
if (mpirank == 0) std::cerr << "ff-Htool error: only P0 and P1 discretizations are available for now." << std::endl;
ffassert(0);
}
p2[3*i+0] = pp.x;
p2[3*i+1] = pp.y;
p2[3*i+2] = pp.z;
pt[3*i+0] = pp.x;
pt[3*i+1] = pp.y;
pt[3*i+2] = pp.z;
}
}
else{
p2=p1;
pt=ps;
}

VirtualGenerator<R>** generator = GetAny<VirtualGenerator<R>**>((*op->g)(stack));

MPI_Comm comm = ds.commworld ? *(MPI_Comm*)ds.commworld : MPI_COMM_WORLD;
std::shared_ptr<VirtualCluster> t, s;
t = build_clustering(n, Uh, p1, ds, comm);
s = build_clustering(m, Vh, p2, ds, comm);
buildHmat(Hmat, *generator, ds, t, s, p1, p2, comm);
s = build_clustering(m, Uh, ps, ds, comm);
t = build_clustering(n, Vh, pt, ds, comm);
buildHmat(Hmat, *generator, ds, t, s, pt, ps, comm);

return Hmat;
}
Expand Down
Loading

0 comments on commit 7eb7b0d

Please sign in to comment.