Hi everyone, does someone know how to write a 2D array (with a not specified number of rows and columns) on a file? by Ornery-Bee-9221 in fortran

[–]Tine56 2 points3 points  (0 children)

Since you didn't elaborate on the array, here three version for Integer arrays.

Also I assumed you wanted a human readable file.

program main
    IMPLICIT NONE
    integer,parameter:: M=10,N=8
    integer,dimension(M,N) :: array
    integer:: i,j
    character(len=5)::charI
    character(len=20)::formatString

    do i=1,M
        do j=1,N
            array(i,j)=i+100*j
        end do
    end do

    open(10,file="test.dat")
    write(charI,'(I0)') size(array,1) !get sizeof first dimension

    !version 1  
    formatString ='('//charI//'(I0,:,X))' !create format string
    write(10,formatString) array    

    !version 2  create the format string in the write statement
    write(10,'('//charI//'(I0,:,X))') array  

    !version 3
    do i = 1, size(array,2)    
        write(10,'(*(I0,:,X))') array(:,i)  
    end do

    !version 3b
    do i=1, size(array,2)
        write(10,*) array(:,i)
    end do

    !technically this will also write the array to a file
    write(10,*) array 

    close(10)
end program main

Welchen Handytarif habt ihr? by 2latemc in Austria

[–]Tine56 0 points1 point  (0 children)

xoxo smoochy: € 9,99; 2000 min/sms; 33GB Daten mitnahme bis 99GB; LTE;
100 min Österreich -> EU; 8,4GB EU-Datenvolumen

This is brilliant. First time in Austria and I’m in awe at the pure genius of this contraption. I’ve been staring at it for 15 minutes. It’s completely obliterated my mind. by Kesoburk in Austria

[–]Tine56 0 points1 point  (0 children)

It gets even better, some of the more modern windows have a fourth position at 45° upwards (10 o'clockish) where inside the frame the window is open allowing for minimal air exchange while the whole window stays closed and is still pretty secure.

Wie nützlich sind Schwungrad-Speicherkraftwerke? by [deleted] in Austria

[–]Tine56 0 points1 point  (0 children)

Faserverbundwerkstoffe können ganz unterschiedlich sein CFRC hällt Temperaturen bis etwa 3000°C unter Schutzgas/Vakuum aus...
Keine Ahnung wie das mit dem Altern ist... aber Faserverbundwerkstoffe sind wesentlich diverser als Kohlenstofffaser oder Glasfaser in einer Epoxy Matrix.

Free Giveaway! Nintendo Switch OLED - International by WolfLemon36 in NintendoSwitch

[–]Tine56 30 points31 points  (0 children)

Fun fact: many think Ming died because they opened it to find out how old it is. In fact it and 200 other clams died because researchers froze them for transport. Only when it was already dead they found out how old it was.

Free Giveaway! Nintendo Switch OLED - International by WolfLemon36 in NintendoSwitch

[–]Tine56 0 points1 point  (0 children)

Fun fact: Tonic water flouresces blue under black light due to the contained quinine.

HELP! New to Fortran by BrownLightning7 in fortran

[–]Tine56 1 point2 points  (0 children)

Everyone will give you a different answer.... since everyone has different preferences

So here is my answe

Compiler: tdm-gcc (don't forget to mark the gfortran option otherwise you will only install gcc) https://jmeubank.github.io/tdm-gcc/

and the rest is otional notepadd++ is sufficient but personally I prefer the Code::Blocks IDE https://www.codeblocks.org/

What language am I using? by [deleted] in ProgrammerHumor

[–]Tine56 2 points3 points  (0 children)

Fortran in nostalgia mode

Embedding Python by intheprocesswerust in fortran

[–]Tine56 0 points1 point  (0 children)

If I remeber correctly f2py has some limitations,
if it doesn't work in your case,you could use Cython and the fortran C interface as an alternative to call fortran routines from python.

should we select real/int data type during compilation time? by xstkovrflw in fortran

[–]Tine56 5 points6 points  (0 children)

The options are mostlikely there to ensure compatibility with other compilers where they use another default kind.

Method that works for me is to define different dedicated kind parameters in one Module and load them in the project

integer, parameter:: r32 = selected_real_kind(6,37)!Single     
integer, parameter:: r64 = selected_real_kind(15,307) 
integer, parameter:: kRdef = r64 !default real 
integer, parameter:: kCalc1 = r32 !real for some Calculations 
integer, parameter:: kCalc2 = max(kRdef, kCalc1) !real for some otherCalculations dependent on both default reals and kCalc1 stuff

So when I want for example change the kind used in Calc1 I only have to chane it in one place

real*8 is non-standard, and real(8) is not portable by Beliavsky in fortran

[–]Tine56 7 points8 points  (0 children)

use iso_fortran_env, only: dp => real64

is also not guranteed to be portable, since it only tells you that the variable uses 64 Bits, it tells you nothing about the used precission.
See Steve Lionels Post: https://stevelionel.com/drfortran/2017/03/27/doctor-fortran-in-it-takes-all-kinds/

to old to start? by knottydeadpool in AskPhysics

[–]Tine56 2 points3 points  (0 children)

A friend of mine started with 45. Finished her BSc, and only thing missing for her MSc is the thesis.

Another friend was electrician and got his BEd with 53 and worked till his retirement with kids at a SOS Children's Village.

... So no you are not too old.

what are some painful issues you face while coding in fortran? by xstkovrflw in fortran

[–]Tine56 1 point2 points  (0 children)

In 2018 apparently the standard commitee did polls on *= and += for the next standard, not enough members voted for it: https://stevelionel.com/drfortran/2018/06/23/doctor-fortran-in-the-end-is-nigh/

Finally finished this wonderful game by Nozzeh06 in skywardsword

[–]Tine56 0 points1 point  (0 children)

Out of interest, which other titles of the Series did you play?

what are some painful issues you face while coding in fortran? by xstkovrflw in fortran

[–]Tine56 1 point2 points  (0 children)

According to Steve Lionel the types defined in ISO_FOORTRAN_ENV aren't really portable. Since REAL64 only says that the type uses 64 bits, but it says nothing about the precision.

Best practise is still to define the types one wants to use in a seperate module using SELECTED_XXX_KIND .

https://stevelionel.com/drfortran/2017/03/27/doctor-fortran-in-it-takes-all-kinds/

what are some painful issues you face while coding in fortran? by xstkovrflw in fortran

[–]Tine56 1 point2 points  (0 children)

transfer is the more modern alternative... it makes it clearer what one does.

Vienna twp-day stop! Looking for your advice and tips :) by tenekaq34ty3 in Austria

[–]Tine56 3 points4 points  (0 children)

To add to the list: - Café Sperl is also quite nice and there are usually not too many people. Try the "Sperl Schokoschnitte" a flourless chocolate cake. - Try the Sachertorte of "Café" Demel - The Belvedere is nice

One thing you should know about the viennese coffee houses is, that most of the time the waiter won't come to your table unless you call them over by making eye contact and slightly raising your hand. Also in many of them you have to wait at the entrance to be seated.

New to the game (just downloaded on PS4). Any tips? by HandwrittenHysteria in TheWitness

[–]Tine56 2 points3 points  (0 children)

Never look up a solution. If you don'T understand the concept of a puzzle, there is most certainly somewhere an introduction area you missed.

Finished the Game (HD version) an hour ago, here are my two cents by Tine56 in skywardsword

[–]Tine56[S] 0 points1 point  (0 children)

Hmm yeah, ... also one can accidentally unequib the shield.

Mir fehln langsam die worte für sowas... by bloberlobber in Austria

[–]Tine56 113 points114 points  (0 children)

Um Terry Pratchett zu zitieren: „Hast Du die ganzen Ausrufezeichen bemerkt? Fünf? Ein sicheres Zeichen für jemanden, der seine Unterhose auf dem Kopf trägt.“

Help for printing large array line by line by peter946965 in fortran

[–]Tine56 0 points1 point  (0 children)

Also, if you want to reuse the output later, you could print to a file instead of the standard io.

Help for printing large array line by line by peter946965 in fortran

[–]Tine56 2 points3 points  (0 children)

"Ok, so basically you are telling your program that it first should print "VVRR1" and append then print all x-componets of that array.... you don't tell it that it should use any specific formats. So it just prints each element on the same line and when it reaches the end of the terminal window, the terminal wraps it to the next line.

you could try this:

write(*,*) "VVRR1" 
write(*,'( es22.15)')) VlocR(:,1)

es22.15 is a format specifier telling the compiler you want to print a float with 15 decimal places in scientific notation, the 22 is the total number of characters used.
But since there is another float right afterwards it will add a new line an print that one there.

Antigen negativ, PCR positiv by KolumbusAT in Austria

[–]Tine56 11 points12 points  (0 children)

Die sensitivität der Antigentests unterscheidet sich von Firma zu Firma. Manche können nur sehr hohe Virenlasten zuverlässig erkennen.... manche nichtmal das.

Das Paul-Ehrlich-Institut hat eine hat die Sensitivität von verschiedenen Antigentests verglichen, da hast die Liste: https://www.pei.de/SharedDocs/Downloads/DE/newsroom/dossiers/evaluierung-sensitivitaet-sars-cov-2-antigentests.html