Get a long length string from the .sif (length>128)

Numerical methods and mathematical models of Elmer
Post Reply
jeremie
Posts: 28
Joined: 11 Jul 2019, 11:31
Antispam: Yes

Get a long length string from the .sif (length>128)

Post by jeremie »

Hello,

With a user-defined function, I would like to get a file path written in the Material section of the .sif by using the GetString() function.

However, GetString() returns a value with a maximum length of 128 whereas my filepath is greater than 128:

DefUtils.f90:
FUNCTION GetString( List, Name, Found ) RESULT(str)
[...]
CHARACTER(LEN=MAX_NAME_LEN) :: str
str = ListGetString( List, Name, Found )
END FUNCTION GetString

Types.f90:

INTEGER, PARAMETER :: MAX_NAME_LEN = 128

Is there another function instead of GetString to get a string from the sif with a length > 128 ?
Or is it possible to increase MAX_NAME_LEN up to 2048 like MAX_STRING_LEN?

Thanks

Jeremie
raback
Site Admin
Posts: 4812
Joined: 22 Aug 2009, 11:57
Antispam: Yes
Location: Espoo, Finland
Contact:

Re: Get a long length string from the .sif (length>128)

Post by raback »

Hi Jeremie,

Since maybe week or two the ElmerSolver codebase at "devel" branch is using allocatable strings in most places including this function. So I think in that light your problem may have been resolved in the current codebase.

Now this is not completely without problems. It seems that some compilers have issue with this, like gcc suite <7. But that is already quite old. We considered the change already some years ago but then this was even a more severe problem.

-Peter
jeremie
Posts: 28
Joined: 11 Jul 2019, 11:31
Antispam: Yes

Re: Get a long length string from the .sif (length>128)

Post by jeremie »

Ok good to know, thanks Peter!
Post Reply