I have a number of variables declared in a module such as
module test
use othermod, only: n
integer, dimension(n) :: var0
real, dimension(n) :: var1
real, dimension(n) :: var2
.....
real, dimension(n) :: var1000
end module test
Then I have a subroutine that fills these variables with values. At this point I would like to create an array of arrays with all the variables declared in module test so that I can easily copy or print all variables of a particular (n) at the same time, like dimension(n,allvariablesin module test). For example I would like to do something like array(3,:)=array(2,:). Because this code is part of a very large program I cannot really modify too much, but rather I need to create an array of arrays from all the variables in this module without typing all the variables. How can I easily integrate this change in the current code?
saveattribute. If you want different instances ofvar0, var1, var2, ..., var1000arrays for different values ofnyou must enclose the variables as type-components inside a derived data type.saveattribute, such an approach is not thread-safe, i.e., you're note allowed you to create multiple instances ofvar0, var1, ..,var1000in the same code.