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
Get a long length string from the .sif (length>128)
-
- 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)
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
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
Re: Get a long length string from the .sif (length>128)
Ok good to know, thanks Peter!