2
votes

I'm trying to make doxygen generates automatic links in method's arguments description to Fortran classes that are in another module of the code.

For instance

documentation for init_inner_products

is the html documentation for a class subroutine that takes its own class and another one defined in another module as arguments.

The link to the class InnerProducts is correctly and automatically created while the one for the class ModelConfiguration is not, and I have to add a link manually in the description.

Here is the header of the init_inner_products routine for which the html documentation is shown in the link above:

!> Initialization routine for the inner products functions.
!> @param[in,out] inner_products Inner products global object to initialize
!> @param[in] model_config Global model configuration (params::modelconfiguration) object to initialize the inner products with
SUBROUTINE init_inner_products(inner_products, model_config)
  CLASS(InnerProducts), INTENT(INOUT), TARGET :: inner_products
  CLASS(ModelConfiguration), INTENT(IN), TARGET :: model_config

I would prefer to avoid making manual links so how can I force/configure doxygen to try to link to class in external modules?

Edit

Finally, I've not found any name conflicts. I thought it was a possible explanation but it is not. What is even weirder is that all the other classes are well linked in the documentation. On the picture below showing the details of an object using various other classes, one can see that the problem happens only with the class ModelConfiguration, and I don't know why.

description


Here is the definition of the said class:

!> The general class holding the model configuration.
TYPE, PUBLIC :: ModelConfiguration
  TYPE(PhysicsConfiguration) :: physics
  TYPE(ModesConfiguration) :: modes
  TYPE(IntegrationParameters) :: integration
  LOGICAL :: initialized = .FALSE.
CONTAINS
  PROCEDURE :: init => init_model_config       !< Model   configuration initialization routine
  PROCEDURE :: clean => clean_model_config     !< Model configuration cleaning routine
END TYPE ModelConfiguration

which is quite basic.

2
what is the version of doxygen? Did you set OPTIMIZE_FOR_FORTRAN = YES? - Pierre de Buyl
Can you create a complete example? - albert
Yes it was optimized for fortran, but now I think it is a name conflict in my code rather than a Doxygen issue. I will try to confirm this. - Jonathan Demaeyer
@albert I'm gonna release this code soon on github in any case and add the link here if the problem is still there. - Jonathan Demaeyer
Problem with a github link will be that it might not be persistent (as the github code can change), furthermore the problem on github will be "large" and hard to debug (helpers have to invest a lot more time to pinpoint to the problem!). It is much better to distill a small example showing the problem. - albert

2 Answers

4
votes

I've investigated the problem in doxygen.

  • The problem is not caused by the ONLY keyword

In case we would have:

use Params

we would have the same problems.

As Fortran is not case sensitive doxygen converts all code (except characters strings) to lowercase, but in the case of a USE statement this had not been done. A proposed patch has been submitted on github: https://github.com/doxygen/doxygen/pull/7882

A workaround is to convert all names in a use statement to lowercase.

Edit the proposed patch has been integrated into the master version of doxygen (and is available in version 1.8.20 and newer)

1
votes

The problem concerned only the class ModelConfiguration of my code, and I realized that it was the only class imported with a only keyword. For instance, in the class Model of the second figure of my question, the class ModelConfiguration is imported as follow:

MODULE model_def
  USE params, only: ModelConfiguration
  ...

Removing the only keyword (importing the whole params module) makes doxygen links correctly in the doc:

works now

so I guess it is due to a bug in doxygen (I use the current stable version 1.8.13 of doxygen.). Since I'm ok with importing the whole module, I will leave it like that.