halbux / sparselizard

C++ FEM library | user-friendly | multi-physics | hp-adaptive | HPC
http://www.sparselizard.org
Other
332 stars 62 forks source link

Latest release: Not compatible with petsc 3.17 #61

Closed Drinausaur closed 2 years ago

Drinausaur commented 2 years ago

This is not valid for petsc 3.17 which is now released, and is the default in the AUR. 3.16.3 cannot be easily installed on Arch anymore.

( in src/mesh/petscmesh.cpp )

    if (isvalidext)
    {
        #if PETSC_VERSION_GE(3, 16, 3)
            DMPlexCreateFromFile(PETSC_COMM_SELF, filename.c_str(), gentools::getfilename(filename).c_str(), PETSC_TRUE, &mypetscmesh);
        #else
            DMPlexCreateFromFile(PETSC_COMM_SELF, filename.c_str(), PETSC_TRUE, &mypetscmesh);
        #endif
        DMGetDimension(mypetscmesh, &meshdim);
        return;
    }

Apparently petsc 3.17 should use the same line as 3.16.3

halbux commented 2 years ago

It compiles with the newest petsc from theur main branch, I tested today. What's not correct?

Drinausaur commented 2 years ago

This is the error I get when building the sparselizard AUR package:

https://aur.archlinux.org/packages/sparselizard

/home/fabien/.cache/yay/sparselizard/src/sparselizard-v.2021.11/src/mesh/petscmesh.cpp: In constructor ‘petscmesh::petscmesh(std::string)’:
/home/fabien/.cache/yay/sparselizard/src/sparselizard-v.2021.11/src/mesh/petscmesh.cpp:40:65: error: cannot convert ‘PetscBool’ to ‘const char*’
   40 |         DMPlexCreateFromFile(PETSC_COMM_SELF, filename.c_str(), PETSC_TRUE, &mypetscmesh);
      |                                                                 ^~~~~~~~~~
      |                                                                 |
      |                                                                 PetscBool
In file included from /home/fabien/.cache/yay/sparselizard/src/sparselizard-v.2021.11/src/mesh/petscmesh.h:17,
                 from /home/fabien/.cache/yay/sparselizard/src/sparselizard-v.2021.11/src/mesh/petscmesh.cpp:1:
/opt/petsc/linux-c-opt/include/petscdmplex.h:191:74: note:   initializing argument 3 of ‘PetscErrorCode DMPlexCreateFromFile(MPI_Comm, const char*, const char*, PetscBool, _p_DM**)’
  191 | PETSC_EXTERN PetscErrorCode DMPlexCreateFromFile(MPI_Comm, const char[], const char[], PetscBool, DM *);
      |                                                                          ^~~~~~~~~~~~

The 3.17 version uses the plexname[] argument : https://gitlab.com/petsc/petsc/-/blob/v3.17.0/src/dm/impls/plex/plexcreate.c#L4671

So I suppose the #if PETSC_VERSION_GE(3, 16, 3) line should be replaced with #if PETSC_VERSION_GE(3, 16, 3) or 3.17

EDIT:

I realized that _GE certainly stands for "greater or equal"... So I don't know, why this does not work, I'm using 3.17.1-1

halbux commented 2 years ago

I ll check on Monday. Or merge your PR before that if you can check until then

Drinausaur commented 2 years ago

Ok, I think I understand what happened.

sparselizard master does certainly work. But not the latest release ( 2021.11-1 ). ( It does not contain the #if PETSC_VERSION_GE line )

The AUR package is set for the latest release. In order to repair the AUR package, I think we would need a new tag ( so a new sparselizard version ? ) You just created a new subversion, maybe you could tag it, so we can use it ? ( it is literally the last commit right now )

@pointhi certainly knows what would be the best option.

( On our side we'll check If sparselizard master still works with our code, as we only tested the release )

Until we repair it, sparselizard cannot be installed using the package.

halbux commented 2 years ago

Indeed! And we discussed with @pointhi a new release is needed. Let me know if it works for you as it is now. If yes I ll make a new release. If no I'll fix it then make a release.

pointhi commented 2 years ago

@halbux I'm pretty sure we need a new git tag, which then allows me to bump the AUR package version

halbux commented 2 years ago

Ok. Will do this week.

halbux commented 2 years ago

@pointhi @Drinausaur New relase done.

pointhi commented 2 years ago

I updated the AUR package: https://aur.archlinux.org/packages/sparselizard