Dear All,
I have two questions I hope someone could help me.
If I want to use parameter attribute for data type declaration there would be some problems, please look at the below example:
TYPE PEOPLE ! Defining derived type PEOPLE
INTEGER AGE
CHARACTER*20 NAME
END TYPE PEOPLE
TYPE(PEOPLE), Parameter :: SMITH = PEOPLE(25,'John Smith')
TYPE triplet
REAL, DIMENSION(3) :: vertex
END TYPE triplet
TYPE(triplet), PARAMETER :: t = triplet(1.0)
In this example there is no problem but if I want to give different value to the data type variable what should I do??
TYPE triplet
REAL, DIMENSION(3) :: vertex
END TYPE triplet
TYPE(triplet), PARAMETER :: t = triplet(1.0, 2.0, 3.0)
I mean how should I give different value to the data type above :
t%vertex(1)=1.0
t%vertex(2)=2.0
t%vertex(3)=3.0
Second question:::
There are some papers in which there are some comparisons between FORTRAN and c++ speed. In all of them they stated that FORTRAN is faster than C++.
There it comes my question, if FORTRAN is faster why all the big software and open source projects like big MD (Molecular Dynamics) codes are changing toward c++, in these numerical codes speed is very important, but they gradually changing toward c++.
I am wondering should we change toward that!!!!!
Thank you very much.
I am really looking forward to hearing from you.
Regards,
I have two questions I hope someone could help me.
If I want to use parameter attribute for data type declaration there would be some problems, please look at the below example:
TYPE PEOPLE ! Defining derived type PEOPLE
INTEGER AGE
CHARACTER*20 NAME
END TYPE PEOPLE
TYPE(PEOPLE), Parameter :: SMITH = PEOPLE(25,'John Smith')
TYPE triplet
REAL, DIMENSION(3) :: vertex
END TYPE triplet
TYPE(triplet), PARAMETER :: t = triplet(1.0)
In this example there is no problem but if I want to give different value to the data type variable what should I do??
TYPE triplet
REAL, DIMENSION(3) :: vertex
END TYPE triplet
TYPE(triplet), PARAMETER :: t = triplet(1.0, 2.0, 3.0)
I mean how should I give different value to the data type above :
t%vertex(1)=1.0
t%vertex(2)=2.0
t%vertex(3)=3.0
Second question:::
There are some papers in which there are some comparisons between FORTRAN and c++ speed. In all of them they stated that FORTRAN is faster than C++.
There it comes my question, if FORTRAN is faster why all the big software and open source projects like big MD (Molecular Dynamics) codes are changing toward c++, in these numerical codes speed is very important, but they gradually changing toward c++.
I am wondering should we change toward that!!!!!
Thank you very much.
I am really looking forward to hearing from you.
Regards,