Welcome, Guest
Username: Password: Remember me

TOPIC: Subroutine LIMWAC intent error

Subroutine LIMWAC intent error 8 years 7 months ago #20748

  • cyamin
  • cyamin's Avatar
  • OFFLINE
  • openTELEMAC Guru
  • Posts: 997
  • Thank you received: 234
Hello all,

I tried to adapt an older version of subroutine LIMWAC to the current trunk (revision 7352) and got the following error while writing to variables HM0L, FPICL and TETA1L that I was trying to modify:
dummy argument with intent(in) in variable definition context (assignment)
Setting HM0L, FPICL and TETA1L from INTENT(IN) to INTENT(OUT), solved the problem.

Is this and error with the default INTENTs or should I had followed a different approach?

Regards,
Costas
The administrator has disabled public write access.

Subroutine LIMWAC intent error 8 years 7 months ago #20749

  • c.coulet
  • c.coulet's Avatar
  • OFFLINE
  • Moderator
  • Posts: 3722
  • Thank you received: 1031
Hi Costas

In the trunk version, there is no modification to those parameters this is why there are "intent(in)".
To give you a full answer, we need to know exactly the content of limwac (or at least the version number if this is an old one).

In your adaptation, if you need to modify those variables you should change this declaration at least to "intent(inout)" or "intent(out) if you don't use the variable value before modifying.
So you're change seems to be logical.

Take care to change the declaration in the interface_tomawac.f.
Make a full clean compilation to avoid problems after this change

Regards
Christophe
The administrator has disabled public write access.
The following user(s) said Thank You: cyamin

Subroutine LIMWAC intent error 8 years 7 months ago #20751

  • cyamin
  • cyamin's Avatar
  • OFFLINE
  • openTELEMAC Guru
  • Posts: 997
  • Thank you received: 234
Hello Christophe,

Thank you for your explanation. My subroutine was last used with v7p0. It appears that the since v7p1 INTENTs have been introduced in all subroutines. However, my question is that since limawac is expected to be modified by the user, what is the risk of having the variables (expected to be modified) be given the INTENT(INOUT) and avoid the complications of having to change interface_tomawac and recompile?

Or will the INTENTs change in the official release?

Regards,
Costas
The administrator has disabled public write access.

Subroutine LIMWAC intent error 8 years 7 months ago #20752

  • c.coulet
  • c.coulet's Avatar
  • OFFLINE
  • Moderator
  • Posts: 3722
  • Thank you received: 1031
Costas

You're right!
The intent had been added for security reasons but in the case of limwac, this is more convenient to have an intent(inout) rather that intent(in).
We will fix this for the next release

best regards
Christophe
The administrator has disabled public write access.
The following user(s) said Thank You: cyamin

Subroutine LIMWAC intent error 8 years 7 months ago #20816

  • tfouquet
  • tfouquet's Avatar
  • OFFLINE
  • Moderator
  • Posts: 294
  • Thank you received: 112
hello

The variables HM0L FPICL and TETA1L are (most of the time) set in the steering file as they correspond to BOUNDARY SIGNIFICANT WAVE HEIGHT, BOUNDARY PEAK FREQUENCY and BOUNDARY MAIN DIRECTION 1. That is the reason they are set as intent(in), in order to avoid to modify them.

In your case, as you would like to have something variable, why don't you use a local variable like MYHM0
and then call the speini with MYHM0 instead of HM0L.

Let me know if there is a problem i haven't seen.

Regards

Thierry
The administrator has disabled public write access.
Moderators: tfouquet

The open TELEMAC-MASCARET template for Joomla!2.5, the HTML 4 version.