FortranCISM.html 167 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133
  1. <!DOCTYPE html><html lang="en-US"><head><title>Introduction to structured programming with Fortran</title><meta property="og:title" content="Introduction to structured programming with Fortran"><meta name="author" content="P.Y. Barriat"><meta property="article:author" content="P.Y. Barriat"><meta name="description" content="https://dev.to/nikolab/complete-list-of-github-markdown-emoji-markup-5aia"><meta property="og:description" content="https://dev.to/nikolab/complete-list-of-github-markdown-emoji-markup-5aia"><meta charset="UTF-8"><meta name="viewport" content="width=device-width,height=device-height,initial-scale=1.0"><meta name="apple-mobile-web-app-capable" content="yes"><meta http-equiv="X-UA-Compatible" content="ie=edge"><meta property="og:type" content="website"><meta name="twitter:card" content="summary"><style>@media screen{body[data-bespoke-view=""] .bespoke-marp-parent>.bespoke-marp-osc>button,body[data-bespoke-view=next] .bespoke-marp-parent>.bespoke-marp-osc>button,body[data-bespoke-view=presenter] .bespoke-marp-presenter-container .bespoke-marp-presenter-info-container button,body[data-bespoke-view=presenter] .bespoke-marp-presenter-container .bespoke-marp-presenter-note-container button{-webkit-tap-highlight-color:transparent;-webkit-appearance:none;-moz-appearance:none;appearance:none;background-color:transparent;border:0;color:inherit;cursor:pointer;font-size:inherit;opacity:.8;outline:none;padding:0;transition:opacity .2s linear}body[data-bespoke-view=""] .bespoke-marp-parent>.bespoke-marp-osc>button:disabled,body[data-bespoke-view=next] .bespoke-marp-parent>.bespoke-marp-osc>button:disabled,body[data-bespoke-view=presenter] .bespoke-marp-presenter-container .bespoke-marp-presenter-info-container button:disabled,body[data-bespoke-view=presenter] .bespoke-marp-presenter-container .bespoke-marp-presenter-note-container button:disabled{cursor:not-allowed;opacity:.15!important}body[data-bespoke-view=""] .bespoke-marp-parent>.bespoke-marp-osc>button:hover,body[data-bespoke-view=next] .bespoke-marp-parent>.bespoke-marp-osc>button:hover,body[data-bespoke-view=presenter] .bespoke-marp-presenter-container .bespoke-marp-presenter-info-container button:hover,body[data-bespoke-view=presenter] .bespoke-marp-presenter-container .bespoke-marp-presenter-note-container button:hover{opacity:1}body[data-bespoke-view=""] .bespoke-marp-parent>.bespoke-marp-osc>button:hover:active,body[data-bespoke-view=next] .bespoke-marp-parent>.bespoke-marp-osc>button:hover:active,body[data-bespoke-view=presenter] .bespoke-marp-presenter-container .bespoke-marp-presenter-info-container button:hover:active,body[data-bespoke-view=presenter] .bespoke-marp-presenter-container .bespoke-marp-presenter-note-container button:hover:active{opacity:.6}body[data-bespoke-view=""] .bespoke-marp-parent>.bespoke-marp-osc>button:hover:not(:disabled),body[data-bespoke-view=next] .bespoke-marp-parent>.bespoke-marp-osc>button:hover:not(:disabled),body[data-bespoke-view=presenter] .bespoke-marp-presenter-container .bespoke-marp-presenter-info-container button:hover:not(:disabled),body[data-bespoke-view=presenter] .bespoke-marp-presenter-container .bespoke-marp-presenter-note-container button:hover:not(:disabled){transition:none}body[data-bespoke-view=""] .bespoke-marp-parent>.bespoke-marp-osc>button[data-bespoke-marp-osc=prev],body[data-bespoke-view=next] .bespoke-marp-parent>.bespoke-marp-osc>button[data-bespoke-marp-osc=prev],body[data-bespoke-view=presenter] .bespoke-marp-presenter-container .bespoke-marp-presenter-info-container button.bespoke-marp-presenter-info-page-prev{background:transparent url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxMDAgMTAwIj48cGF0aCBmaWxsPSJub25lIiBzdHJva2U9IiNmZmYiIHN0cm9rZS1saW5lY2FwPSJyb3VuZCIgc3Ryb2tlLWxpbmVqb2luPSJyb3VuZCIgc3Ryb2tlLXdpZHRoPSI1IiBkPSJNNjggOTAgMjggNTBsNDAtNDAiLz48L3N2Zz4=") no-repeat 50%;background-size:contain;overflow:hidden;text-indent:100%;white-space:nowrap}body[data-bespoke-view=""] .bespoke-marp-parent>.bespoke-marp-osc>button[data-bespoke-marp-osc=next],body[data-bespoke-view=next] .bespoke-marp-parent>.bespoke-marp-osc>button[data-bespoke-marp-osc=next],body[data-bespoke-view=presenter] .bespoke-marp-presenter-container .bespoke-marp-presenter-info-container button.bespoke-marp-presenter-info-page-next{background:transparent url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxMDAgMTAwIj48cGF0aCBmaWxsPSJub25lIiBzdHJva2U9IiNmZmYiIHN0cm9rZS1saW5lY2FwPSJyb3VuZCIgc3Ryb2tlLWxpbmVqb2luPSJyb3VuZCIgc3Ryb2tlLXdpZHRoPSI1IiBkPSJtMzIgOTAgNDAtNDAtNDAtNDAiLz48L3N2Zz4=") no-repeat 50%;background-size:contain;overflow:hidden;text-indent:100%;white-space:nowrap}body[data-bespoke-view=""] .bespoke-marp-parent>.bespoke-marp-osc>button[data-bespoke-marp-osc=fullscreen],body[data-bespoke-view=next] .bespoke-marp-parent>.bespoke-marp-osc>button[data-bespoke-marp-osc=fullscreen]{background:transparent url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxMDAgMTAwIj48ZGVmcz48c3R5bGU+LmF7ZmlsbDpub25lO3N0cm9rZTojZmZmO3N0cm9rZS1saW5lY2FwOnJvdW5kO3N0cm9rZS1saW5lam9pbjpyb3VuZDtzdHJva2Utd2lkdGg6NXB4fTwvc3R5bGU+PC9kZWZzPjxyZWN0IGNsYXNzPSJhIiB4PSIxMCIgeT0iMjAiIHdpZHRoPSI4MCIgaGVpZ2h0PSI2MCIgcng9IjUuNjciLz48cGF0aCBjbGFzcz0iYSIgZD0iTTQwIDcwSDIwVjUwbTIwIDBMMjAgNzBtNDAtNDBoMjB2MjBtLTIwIDAgMjAtMjAiLz48L3N2Zz4=") no-repeat 50%;background-size:contain;overflow:hidden;text-indent:100%;white-space:nowrap}body[data-bespoke-view=""] .bespoke-marp-parent>.bespoke-marp-osc>button.exit[data-bespoke-marp-osc=fullscreen],body[data-bespoke-view=next] .bespoke-marp-parent>.bespoke-marp-osc>button.exit[data-bespoke-marp-osc=fullscreen]{background-image:url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxMDAgMTAwIj48ZGVmcz48c3R5bGU+LmF7ZmlsbDpub25lO3N0cm9rZTojZmZmO3N0cm9rZS1saW5lY2FwOnJvdW5kO3N0cm9rZS1saW5lam9pbjpyb3VuZDtzdHJva2Utd2lkdGg6NXB4fTwvc3R5bGU+PC9kZWZzPjxyZWN0IGNsYXNzPSJhIiB4PSIxMCIgeT0iMjAiIHdpZHRoPSI4MCIgaGVpZ2h0PSI2MCIgcng9IjUuNjciLz48cGF0aCBjbGFzcz0iYSIgZD0iTTIwIDUwaDIwdjIwbS0yMCAwIDIwLTIwbTQwIDBINjBWMzBtMjAgMEw2MCA1MCIvPjwvc3ZnPg==")}body[data-bespoke-view=""] .bespoke-marp-parent>.bespoke-marp-osc>button[data-bespoke-marp-osc=presenter],body[data-bespoke-view=next] .bespoke-marp-parent>.bespoke-marp-osc>button[data-bespoke-marp-osc=presenter]{background:transparent url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxMDAgMTAwIj48cGF0aCBkPSJNODcuOCA0Ny41Qzg5IDUwIDg3LjcgNTIgODUgNTJIMzVhOC43IDguNyAwIDAgMS03LjItNC41bC0xNS42LTMxQzExIDE0IDEyLjIgMTIgMTUgMTJoNTBhOC44IDguOCAwIDAgMSA3LjIgNC41ek02MCA1MnYzNm0tMTAgMGgyME00NSA0MmgyMCIgZmlsbD0ibm9uZSIgc3Ryb2tlPSIjZmZmIiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiIHN0cm9rZS13aWR0aD0iNSIvPjwvc3ZnPg==") no-repeat 50%;background-size:contain;overflow:hidden;text-indent:100%;white-space:nowrap}body[data-bespoke-view=presenter] .bespoke-marp-presenter-container .bespoke-marp-presenter-note-container button.bespoke-marp-presenter-note-bigger{background:transparent url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxMDAgMTAwIj48cGF0aCBkPSJNMTIgNTBoODBNNTIgOTBWMTAiIHN0cm9rZT0iI2ZmZiIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIiBzdHJva2UtbGluZWpvaW49InJvdW5kIiBzdHJva2Utd2lkdGg9IjUiLz48L3N2Zz4=") no-repeat 50%;background-size:contain;overflow:hidden;text-indent:100%;white-space:nowrap}body[data-bespoke-view=presenter] .bespoke-marp-presenter-container .bespoke-marp-presenter-note-container button.bespoke-marp-presenter-note-smaller{background:transparent url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxMDAgMTAwIj48cGF0aCBkPSJNMTIgNTBoODAiIGZpbGw9Im5vbmUiIHN0cm9rZT0iI2ZmZiIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIiBzdHJva2UtbGluZWpvaW49InJvdW5kIiBzdHJva2Utd2lkdGg9IjUiLz48L3N2Zz4=") no-repeat 50%;background-size:contain;overflow:hidden;text-indent:100%;white-space:nowrap}}.bespoke-marp-note,.bespoke-marp-osc,.bespoke-progress-parent{display:none;transition:none}@media screen{body,html{height:100%;margin:0}body{background:#000;overflow:hidden}svg.bespoke-marp-slide{content-visibility:hidden;opacity:0;pointer-events:none;z-index:-1}svg.bespoke-marp-slide.bespoke-marp-active{content-visibility:visible;opacity:1;pointer-events:auto;z-index:0}svg.bespoke-marp-slide.bespoke-marp-active.bespoke-marp-active-ready *{-webkit-animation-name:__bespoke_marp__!important;animation-name:__bespoke_marp__!important}@supports not (content-visibility:hidden){svg.bespoke-marp-slide[data-bespoke-marp-load=hideable]{display:none}svg.bespoke-marp-slide[data-bespoke-marp-load=hideable].bespoke-marp-active{display:block}}[data-bespoke-marp-fragment=inactive]{visibility:hidden}body[data-bespoke-view=""] .bespoke-marp-parent,body[data-bespoke-view=next] .bespoke-marp-parent{bottom:0;left:0;position:absolute;right:0;top:0}body[data-bespoke-view=""] .bespoke-marp-parent>.bespoke-marp-osc,body[data-bespoke-view=next] .bespoke-marp-parent>.bespoke-marp-osc{background:rgba(0,0,0,.65);border-radius:7px;bottom:50px;color:#fff;contain:paint;display:block;font-family:Helvetica,Arial,sans-serif;font-size:16px;left:50%;line-height:0;opacity:1;padding:12px;position:absolute;touch-action:manipulation;transform:translateX(-50%);transition:opacity .2s linear;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;white-space:nowrap;will-change:transform;z-index:1}body[data-bespoke-view=""] .bespoke-marp-parent>.bespoke-marp-osc>*,body[data-bespoke-view=next] .bespoke-marp-parent>.bespoke-marp-osc>*{margin-left:6px}body[data-bespoke-view=""] .bespoke-marp-parent>.bespoke-marp-osc>:first-child,body[data-bespoke-view=next] .bespoke-marp-parent>.bespoke-marp-osc>:first-child{margin-left:0}body[data-bespoke-view=""] .bespoke-marp-parent>.bespoke-marp-osc>span,body[data-bespoke-view=next] .bespoke-marp-parent>.bespoke-marp-osc>span{opacity:.8}body[data-bespoke-view=""] .bespoke-marp-parent>.bespoke-marp-osc>span[data-bespoke-marp-osc=page],body[data-bespoke-view=next] .bespoke-marp-parent>.bespoke-marp-osc>span[data-bespoke-marp-osc=page]{display:inline-block;min-width:140px;text-align:center}body[data-bespoke-view=""] .bespoke-marp-parent>.bespoke-marp-osc>button[data-bespoke-marp-osc=fullscreen],body[data-bespoke-view=""] .bespoke-marp-parent>.bespoke-marp-osc>button[data-bespoke-marp-osc=next],body[data-bespoke-view=""] .bespoke-marp-parent>.bespoke-marp-osc>button[data-bespoke-marp-osc=presenter],body[data-bespoke-view=""] .bespoke-marp-parent>.bespoke-marp-osc>button[data-bespoke-marp-osc=prev],body[data-bespoke-view=next] .bespoke-marp-parent>.bespoke-marp-osc>button[data-bespoke-marp-osc=fullscreen],body[data-bespoke-view=next] .bespoke-marp-parent>.bespoke-marp-osc>button[data-bespoke-marp-osc=next],body[data-bespoke-view=next] .bespoke-marp-parent>.bespoke-marp-osc>button[data-bespoke-marp-osc=presenter],body[data-bespoke-view=next] .bespoke-marp-parent>.bespoke-marp-osc>button[data-bespoke-marp-osc=prev]{height:32px;line-height:32px;width:32px}body[data-bespoke-view=""] .bespoke-marp-parent.bespoke-marp-inactive,body[data-bespoke-view=next] .bespoke-marp-parent.bespoke-marp-inactive{cursor:none}body[data-bespoke-view=""] .bespoke-marp-parent.bespoke-marp-inactive>.bespoke-marp-osc,body[data-bespoke-view=next] .bespoke-marp-parent.bespoke-marp-inactive>.bespoke-marp-osc{opacity:0;pointer-events:none}body[data-bespoke-view=""] svg.bespoke-marp-slide,body[data-bespoke-view=next] svg.bespoke-marp-slide{height:100%;left:0;position:absolute;top:0;width:100%}body[data-bespoke-view=""] .bespoke-progress-parent{background:#222;display:flex;height:5px;width:100%}body[data-bespoke-view=""] .bespoke-progress-parent+.bespoke-marp-parent{top:5px}body[data-bespoke-view=""] .bespoke-progress-parent .bespoke-progress-bar{background:#0288d1;flex:0 0 0;transition:flex-basis .2s cubic-bezier(0,1,1,1)}body[data-bespoke-view=next]{background:transparent}body[data-bespoke-view=presenter]{background:#161616}body[data-bespoke-view=presenter] .bespoke-marp-presenter-container{display:grid;font-family:Helvetica,Arial,sans-serif;grid-template:"current dragbar next" minmax(140px,1fr) "current dragbar note" 2fr "info dragbar note" 3em;grid-template-columns:minmax(3px,var(--bespoke-marp-presenter-split-ratio,66%)) 0 minmax(3px,1fr);height:100%;left:0;position:absolute;top:0;width:100%}body[data-bespoke-view=presenter] .bespoke-marp-presenter-container .bespoke-marp-parent{grid-area:current;overflow:hidden;position:relative}body[data-bespoke-view=presenter] .bespoke-marp-presenter-container .bespoke-marp-parent svg.bespoke-marp-slide{height:calc(100% - 40px);left:20px;pointer-events:none;position:absolute;top:20px;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;width:calc(100% - 40px)}body[data-bespoke-view=presenter] .bespoke-marp-presenter-container .bespoke-marp-parent svg.bespoke-marp-slide.bespoke-marp-active{filter:drop-shadow(0 3px 10px rgba(0,0,0,.5))}body[data-bespoke-view=presenter] .bespoke-marp-presenter-container .bespoke-marp-presenter-dragbar-container{background:#0288d1;cursor:col-resize;grid-area:dragbar;margin-left:-3px;opacity:0;position:relative;transition:opacity .4s linear .1s;width:6px;z-index:10}body[data-bespoke-view=presenter] .bespoke-marp-presenter-container .bespoke-marp-presenter-dragbar-container:hover{opacity:1}body[data-bespoke-view=presenter] .bespoke-marp-presenter-container .bespoke-marp-presenter-dragbar-container.active{opacity:1;transition-delay:0s}body[data-bespoke-view=presenter] .bespoke-marp-presenter-container .bespoke-marp-presenter-next-container{background:#222;cursor:pointer;display:none;grid-area:next;overflow:hidden;position:relative}body[data-bespoke-view=presenter] .bespoke-marp-presenter-container .bespoke-marp-presenter-next-container.active{display:block}body[data-bespoke-view=presenter] .bespoke-marp-presenter-container .bespoke-marp-presenter-next-container iframe.bespoke-marp-presenter-next{background:transparent;border:0;display:block;filter:drop-shadow(0 3px 10px rgba(0,0,0,.5));height:calc(100% - 40px);left:20px;pointer-events:none;position:absolute;top:20px;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;width:calc(100% - 40px)}body[data-bespoke-view=presenter] .bespoke-marp-presenter-container .bespoke-marp-presenter-note-container{background:#222;color:#eee;grid-area:note;position:relative;z-index:1}body[data-bespoke-view=presenter] .bespoke-marp-presenter-container .bespoke-marp-presenter-note-container button{height:1.5em;line-height:1.5em;width:1.5em}body[data-bespoke-view=presenter] .bespoke-marp-presenter-container .bespoke-marp-presenter-note-container .bespoke-marp-presenter-note-wrapper{bottom:0;display:block;left:0;position:absolute;right:0;top:0}body[data-bespoke-view=presenter] .bespoke-marp-presenter-container .bespoke-marp-presenter-note-container .bespoke-marp-presenter-note-buttons{background:rgba(0,0,0,.65);border-radius:4px;bottom:0;display:flex;gap:4px;margin:12px;opacity:0;padding:6px;pointer-events:none;position:absolute;right:0;transition:opacity .2s linear}body[data-bespoke-view=presenter] .bespoke-marp-presenter-container .bespoke-marp-presenter-note-container .bespoke-marp-presenter-note-buttons:focus-within,body[data-bespoke-view=presenter] .bespoke-marp-presenter-container .bespoke-marp-presenter-note-container .bespoke-marp-presenter-note-wrapper:focus-within+.bespoke-marp-presenter-note-buttons,body[data-bespoke-view=presenter] .bespoke-marp-presenter-container .bespoke-marp-presenter-note-container:hover .bespoke-marp-presenter-note-buttons{opacity:1;pointer-events:auto}body[data-bespoke-view=presenter] .bespoke-marp-presenter-container .bespoke-marp-presenter-note-container .bespoke-marp-note{word-wrap:break-word;box-sizing:border-box;font-size:calc(1.1em*var(--bespoke-marp-note-font-scale, 1));height:calc(100% - 40px);margin:20px;overflow:auto;padding-right:3px;scrollbar-color:hsla(0,0%,93%,.5) transparent;scrollbar-width:thin;white-space:pre-wrap;width:calc(100% - 40px)}body[data-bespoke-view=presenter] .bespoke-marp-presenter-container .bespoke-marp-presenter-note-container .bespoke-marp-note::-webkit-scrollbar{width:6px}body[data-bespoke-view=presenter] .bespoke-marp-presenter-container .bespoke-marp-presenter-note-container .bespoke-marp-note::-webkit-scrollbar-track{background:transparent}body[data-bespoke-view=presenter] .bespoke-marp-presenter-container .bespoke-marp-presenter-note-container .bespoke-marp-note::-webkit-scrollbar-thumb{background:hsla(0,0%,93%,.5);border-radius:6px}body[data-bespoke-view=presenter] .bespoke-marp-presenter-container .bespoke-marp-presenter-note-container .bespoke-marp-note:empty{pointer-events:none}body[data-bespoke-view=presenter] .bespoke-marp-presenter-container .bespoke-marp-presenter-note-container .bespoke-marp-note.active{display:block}body[data-bespoke-view=presenter] .bespoke-marp-presenter-container .bespoke-marp-presenter-note-container .bespoke-marp-note p:first-child{margin-top:0}body[data-bespoke-view=presenter] .bespoke-marp-presenter-container .bespoke-marp-presenter-note-container .bespoke-marp-note p:last-child{margin-bottom:0}body[data-bespoke-view=presenter] .bespoke-marp-presenter-container .bespoke-marp-presenter-info-container{align-items:center;box-sizing:border-box;color:#eee;display:flex;flex-wrap:nowrap;grid-area:info;justify-content:center;overflow:hidden;padding:0 10px}body[data-bespoke-view=presenter] .bespoke-marp-presenter-container .bespoke-marp-presenter-info-container .bespoke-marp-presenter-info-page,body[data-bespoke-view=presenter] .bespoke-marp-presenter-container .bespoke-marp-presenter-info-container .bespoke-marp-presenter-info-time,body[data-bespoke-view=presenter] .bespoke-marp-presenter-container .bespoke-marp-presenter-info-container .bespoke-marp-presenter-info-timer{box-sizing:border-box;display:block;padding:0 10px;white-space:nowrap;width:100%}body[data-bespoke-view=presenter] .bespoke-marp-presenter-container .bespoke-marp-presenter-info-container button{height:1.5em;line-height:1.5em;width:1.5em}body[data-bespoke-view=presenter] .bespoke-marp-presenter-container .bespoke-marp-presenter-info-container .bespoke-marp-presenter-info-page{order:2;text-align:center}body[data-bespoke-view=presenter] .bespoke-marp-presenter-container .bespoke-marp-presenter-info-container .bespoke-marp-presenter-info-page .bespoke-marp-presenter-info-page-text{display:inline-block;min-width:120px;text-align:center}body[data-bespoke-view=presenter] .bespoke-marp-presenter-container .bespoke-marp-presenter-info-container .bespoke-marp-presenter-info-time{color:#999;order:1;text-align:left}body[data-bespoke-view=presenter] .bespoke-marp-presenter-container .bespoke-marp-presenter-info-container .bespoke-marp-presenter-info-timer{color:#999;order:3;text-align:right}body[data-bespoke-view=presenter] .bespoke-marp-presenter-container .bespoke-marp-presenter-info-container .bespoke-marp-presenter-info-timer:hover{cursor:pointer}}@media print{.bespoke-marp-presenter-info-container,.bespoke-marp-presenter-next-container,.bespoke-marp-presenter-note-container{display:none}}</style><style>div#p>svg>foreignObject>section{width:1280px;height:720px;box-sizing:border-box;overflow:hidden;position:relative;scroll-snap-align:center center}div#p>svg>foreignObject>section:after{bottom:0;content:attr(data-marpit-pagination);padding:inherit;pointer-events:none;position:absolute;right:0}div#p>svg>foreignObject>section:not([data-marpit-pagination]):after{display:none}/* Normalization */div#p>svg>foreignObject>section h1{font-size:2em;margin:0.67em 0}div#p>svg>foreignObject>section video::-webkit-media-controls{will-change:transform}@page{size:1280px 720px;margin:0}@media print{body,html{background-color:#fff;margin:0;page-break-inside:avoid;break-inside:avoid-page}div#p>svg>foreignObject>section{page-break-before:always;break-before:page}div#p>svg>foreignObject>section,div#p>svg>foreignObject>section *{-webkit-print-color-adjust:exact!important;animation-delay:0s!important;animation-duration:0s!important;color-adjust:exact!important;transition:none!important}div#p>svg[data-marpit-svg]{display:block;height:100vh;width:100vw}}
  2. /*!
  3. * Marp default theme.
  4. *
  5. * @theme default
  6. * @author Yuki Hattori
  7. *
  8. * @auto-scaling true
  9. * @size 16:9 1280px 720px
  10. * @size 4:3 960px 720px
  11. */div#p>svg>foreignObject>section{-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%;word-wrap:break-word;background-color:#fff;color:#24292f;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif,Apple Color Emoji,Segoe UI Emoji;font-size:16px;line-height:1.5;margin:0}div#p>svg>foreignObject>section{--marpit-root-font-size:16px}div#p>svg>foreignObject>section h1:hover .anchor .octicon-link:before,div#p>svg>foreignObject>section h2:hover .anchor .octicon-link:before,div#p>svg>foreignObject>section h3:hover .anchor .octicon-link:before,div#p>svg>foreignObject>section h4:hover .anchor .octicon-link:before,div#p>svg>foreignObject>section h5:hover .anchor .octicon-link:before,div#p>svg>foreignObject>section h6:hover .anchor .octicon-link:before{background-color:currentColor;content:" ";display:inline-block;height:16px;-webkit-mask-image:url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" aria-hidden="true"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 0 0 1.06 1.06l1.25-1.25a2 2 0 1 1 2.83 2.83l-2.5 2.5a2 2 0 0 1-2.83 0 .75.75 0 0 0-1.06 1.06 3.5 3.5 0 0 0 4.95 0l2.5-2.5a3.5 3.5 0 0 0-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 0 1 0-2.83l2.5-2.5a2 2 0 0 1 2.83 0 .75.75 0 0 0 1.06-1.06 3.5 3.5 0 0 0-4.95 0l-2.5 2.5a3.5 3.5 0 0 0 4.95 4.95l1.25-1.25a.75.75 0 0 0-1.06-1.06l-1.25 1.25a2 2 0 0 1-2.83 0z"/></svg>');mask-image:url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" aria-hidden="true"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 0 0 1.06 1.06l1.25-1.25a2 2 0 1 1 2.83 2.83l-2.5 2.5a2 2 0 0 1-2.83 0 .75.75 0 0 0-1.06 1.06 3.5 3.5 0 0 0 4.95 0l2.5-2.5a3.5 3.5 0 0 0-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 0 1 0-2.83l2.5-2.5a2 2 0 0 1 2.83 0 .75.75 0 0 0 1.06-1.06 3.5 3.5 0 0 0-4.95 0l-2.5 2.5a3.5 3.5 0 0 0 4.95 4.95l1.25-1.25a.75.75 0 0 0-1.06-1.06l-1.25 1.25a2 2 0 0 1-2.83 0z"/></svg>');width:16px}div#p>svg>foreignObject>section details,div#p>svg>foreignObject>section figcaption,div#p>svg>foreignObject>section figure{display:block}div#p>svg>foreignObject>section summary{display:list-item}div#p>svg>foreignObject>section [hidden]{display:none!important}div#p>svg>foreignObject>section a{background-color:transparent;color:#0969da;text-decoration:none}div#p>svg>foreignObject>section a:active,div#p>svg>foreignObject>section a:hover{outline-width:0}div#p>svg>foreignObject>section abbr[title]{border-bottom:none;-webkit-text-decoration:underline dotted;text-decoration:underline dotted}div#p>svg>foreignObject>section b,div#p>svg>foreignObject>section strong{font-weight:600}div#p>svg>foreignObject>section dfn{font-style:italic}div#p>svg>foreignObject>section h1{border-bottom:1px solid #d8dee4;font-size:2em;font-weight:600;margin:.67em 0;padding-bottom:.3em}div#p>svg>foreignObject>section mark{background-color:#fff8c5;color:#24292f}div#p>svg>foreignObject>section small{font-size:90%}div#p>svg>foreignObject>section sub,div#p>svg>foreignObject>section sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}div#p>svg>foreignObject>section sub{bottom:-.25em}div#p>svg>foreignObject>section sup{top:-.5em}div#p>svg>foreignObject>section img{background-color:#fff;border-style:none;box-sizing:content-box;max-width:100%}div#p>svg>foreignObject>section code,div#p>svg>foreignObject>section kbd,div#p>svg>foreignObject>section pre,div#p>svg>foreignObject>section samp{font-family:monospace,monospace;font-size:1em}div#p>svg>foreignObject>section figure{margin:1em 40px}div#p>svg>foreignObject>section hr{background:transparent;background-color:#d0d7de;border:0;box-sizing:content-box;height:.25em;margin:24px 0;overflow:hidden;padding:0}div#p>svg>foreignObject>section input{font:inherit;font-family:inherit;font-size:inherit;line-height:inherit;margin:0;overflow:visible}div#p>svg>foreignObject>section [type=button],div#p>svg>foreignObject>section [type=reset],div#p>svg>foreignObject>section [type=submit]{-webkit-appearance:button}div#p>svg>foreignObject>section [type=button]::-moz-focus-inner,div#p>svg>foreignObject>section [type=reset]::-moz-focus-inner,div#p>svg>foreignObject>section [type=submit]::-moz-focus-inner{border-style:none;padding:0}div#p>svg>foreignObject>section [type=button]:-moz-focusring,div#p>svg>foreignObject>section [type=reset]:-moz-focusring,div#p>svg>foreignObject>section [type=submit]:-moz-focusring{outline:1px dotted ButtonText}div#p>svg>foreignObject>section [type=checkbox],div#p>svg>foreignObject>section [type=radio]{box-sizing:border-box;padding:0}div#p>svg>foreignObject>section [type=number]::-webkit-inner-spin-button,div#p>svg>foreignObject>section [type=number]::-webkit-outer-spin-button{height:auto}div#p>svg>foreignObject>section [type=search]{-webkit-appearance:textfield;outline-offset:-2px}div#p>svg>foreignObject>section [type=search]::-webkit-search-cancel-button,div#p>svg>foreignObject>section [type=search]::-webkit-search-decoration{-webkit-appearance:none}div#p>svg>foreignObject>section ::-webkit-input-placeholder{color:inherit;opacity:.54}div#p>svg>foreignObject>section ::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}div#p>svg>foreignObject>section a:hover{text-decoration:underline}div#p>svg>foreignObject>section hr:after,div#p>svg>foreignObject>section hr:before{content:"";display:table}div#p>svg>foreignObject>section hr:after{clear:both}div#p>svg>foreignObject>section table{border-collapse:collapse;border-spacing:0;display:block;max-width:100%;overflow:auto;width:-webkit-max-content;width:-moz-max-content;width:max-content}div#p>svg>foreignObject>section td,div#p>svg>foreignObject>section th{padding:0}div#p>svg>foreignObject>section details summary{cursor:pointer}div#p>svg>foreignObject>section details:not([open])>:not(summary){display:none!important}div#p>svg>foreignObject>section kbd{background-color:#f6f8fa;border:1px solid rgba(175,184,193,.2);border-radius:6px;box-shadow:inset 0 -1px 0 rgba(175,184,193,.2);color:#24292f;display:inline-block;font:11px ui-monospace,SFMono-Regular,SF Mono,Menlo,Consolas,Liberation Mono,monospace;line-height:10px;padding:3px 5px;vertical-align:middle}div#p>svg>foreignObject>section h1,div#p>svg>foreignObject>section h2,div#p>svg>foreignObject>section h3,div#p>svg>foreignObject>section h4,div#p>svg>foreignObject>section h5,div#p>svg>foreignObject>section h6{font-weight:600;line-height:1.25;margin-bottom:16px;margin-top:24px}div#p>svg>foreignObject>section h2{border-bottom:1px solid #d8dee4;font-size:1.5em;font-weight:600;padding-bottom:.3em}div#p>svg>foreignObject>section h3{font-size:1.25em;font-weight:600}div#p>svg>foreignObject>section h4{font-size:1em;font-weight:600}div#p>svg>foreignObject>section h5{font-size:.875em;font-weight:600}div#p>svg>foreignObject>section h6{color:#57606a;font-size:.85em;font-weight:600}div#p>svg>foreignObject>section p{margin-bottom:10px;margin-top:0}div#p>svg>foreignObject>section blockquote{border-left:.25em solid #d0d7de;color:#57606a;margin:0;padding:0 1em}div#p>svg>foreignObject>section ol,div#p>svg>foreignObject>section ul{margin-bottom:0;margin-top:0;padding-left:2em}div#p>svg>foreignObject>section ol ol,div#p>svg>foreignObject>section ul ol{list-style-type:lower-roman}div#p>svg>foreignObject>section ol ol ol,div#p>svg>foreignObject>section ol ul ol,div#p>svg>foreignObject>section ul ol ol,div#p>svg>foreignObject>section ul ul ol{list-style-type:lower-alpha}div#p>svg>foreignObject>section dd{margin-left:0}div#p>svg>foreignObject>section code,div#p>svg>foreignObject>section pre,div#p>svg>foreignObject>section tt{font-family:ui-monospace,SFMono-Regular,SF Mono,Menlo,Consolas,Liberation Mono,monospace;font-size:12px}div#p>svg>foreignObject>section pre{word-wrap:normal;margin-bottom:0;margin-top:0}div#p>svg>foreignObject>section .octicon{fill:currentColor;display:inline-block;overflow:visible!important;vertical-align:text-bottom}div#p>svg>foreignObject>section ::-moz-placeholder{color:#6e7781;opacity:1}div#p>svg>foreignObject>section :-ms-input-placeholder{color:#6e7781;opacity:1}div#p>svg>foreignObject>section ::placeholder{color:#6e7781;opacity:1}div#p>svg>foreignObject>section input::-webkit-inner-spin-button,div#p>svg>foreignObject>section input::-webkit-outer-spin-button{-webkit-appearance:none;appearance:none;margin:0}div#p>svg>foreignObject>section .pl-c{color:#6e7781}div#p>svg>foreignObject>section .pl-c1,div#p>svg>foreignObject>section .pl-s .pl-v{color:#0550ae}div#p>svg>foreignObject>section .pl-e,div#p>svg>foreignObject>section .pl-en{color:#8250df}div#p>svg>foreignObject>section .pl-s .pl-s1,div#p>svg>foreignObject>section .pl-smi{color:#24292f}div#p>svg>foreignObject>section .pl-ent{color:#116329}div#p>svg>foreignObject>section .pl-k{color:#cf222e}div#p>svg>foreignObject>section .pl-pds,div#p>svg>foreignObject>section .pl-s,div#p>svg>foreignObject>section .pl-s .pl-pse .pl-s1,div#p>svg>foreignObject>section .pl-sr,div#p>svg>foreignObject>section .pl-sr .pl-cce,div#p>svg>foreignObject>section .pl-sr .pl-sra,div#p>svg>foreignObject>section .pl-sr .pl-sre{color:#0a3069}div#p>svg>foreignObject>section .pl-smw,div#p>svg>foreignObject>section .pl-v{color:#953800}div#p>svg>foreignObject>section .pl-bu{color:#82071e}div#p>svg>foreignObject>section .pl-ii{background-color:#82071e;color:#f6f8fa}div#p>svg>foreignObject>section .pl-c2{background-color:#cf222e;color:#f6f8fa}div#p>svg>foreignObject>section .pl-sr .pl-cce{color:#116329;font-weight:700}div#p>svg>foreignObject>section .pl-ml{color:#3b2300}div#p>svg>foreignObject>section .pl-mh,div#p>svg>foreignObject>section .pl-mh .pl-en,div#p>svg>foreignObject>section .pl-ms{color:#0550ae;font-weight:700}div#p>svg>foreignObject>section .pl-mi{color:#24292f;font-style:italic}div#p>svg>foreignObject>section .pl-mb{color:#24292f;font-weight:700}div#p>svg>foreignObject>section .pl-md{background-color:#ffebe9;color:#82071e}div#p>svg>foreignObject>section .pl-mi1{background-color:#dafbe1;color:#116329}div#p>svg>foreignObject>section .pl-mc{background-color:#ffd8b5;color:#953800}div#p>svg>foreignObject>section .pl-mi2{background-color:#0550ae;color:#eaeef2}div#p>svg>foreignObject>section .pl-mdr{color:#8250df;font-weight:700}div#p>svg>foreignObject>section .pl-ba{color:#57606a}div#p>svg>foreignObject>section .pl-sg{color:#8c959f}div#p>svg>foreignObject>section .pl-corl{color:#0a3069;text-decoration:underline}div#p>svg>foreignObject>section [data-catalyst]{display:block}div#p>svg>foreignObject>section g-emoji{font-family:Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol;font-size:1em;font-style:normal!important;font-weight:400;line-height:1;vertical-align:-.075em}div#p>svg>foreignObject>section g-emoji img{height:1em;width:1em}div#p>svg>foreignObject>section:after,div#p>svg>foreignObject>section:before{
  12. /* content:""; */display:table}div#p>svg>foreignObject>section:after{clear:both}div#p>svg>foreignObject>section>:first-child{margin-top:0!important}div#p>svg>foreignObject>section>:last-child{margin-bottom:0!important}div#p>svg>foreignObject>section a:not([href]){color:inherit;text-decoration:none}div#p>svg>foreignObject>section .absent{color:#cf222e}div#p>svg>foreignObject>section .anchor{float:left;line-height:1;margin-left:-20px;padding-right:4px}div#p>svg>foreignObject>section .anchor:focus{outline:none}div#p>svg>foreignObject>section blockquote,div#p>svg>foreignObject>section details,div#p>svg>foreignObject>section dl,div#p>svg>foreignObject>section ol,div#p>svg>foreignObject>section p,div#p>svg>foreignObject>section pre,div#p>svg>foreignObject>section table,div#p>svg>foreignObject>section ul{margin-bottom:16px;margin-top:0}div#p>svg>foreignObject>section blockquote>:first-child{margin-top:0}div#p>svg>foreignObject>section blockquote>:last-child{margin-bottom:0}div#p>svg>foreignObject>section sup>a:before{content:"["}div#p>svg>foreignObject>section sup>a:after{content:"]"}div#p>svg>foreignObject>section h1 .octicon-link,div#p>svg>foreignObject>section h2 .octicon-link,div#p>svg>foreignObject>section h3 .octicon-link,div#p>svg>foreignObject>section h4 .octicon-link,div#p>svg>foreignObject>section h5 .octicon-link,div#p>svg>foreignObject>section h6 .octicon-link{color:#24292f;vertical-align:middle;visibility:hidden}div#p>svg>foreignObject>section h1:hover .anchor,div#p>svg>foreignObject>section h2:hover .anchor,div#p>svg>foreignObject>section h3:hover .anchor,div#p>svg>foreignObject>section h4:hover .anchor,div#p>svg>foreignObject>section h5:hover .anchor,div#p>svg>foreignObject>section h6:hover .anchor{text-decoration:none}div#p>svg>foreignObject>section h1:hover .anchor .octicon-link,div#p>svg>foreignObject>section h2:hover .anchor .octicon-link,div#p>svg>foreignObject>section h3:hover .anchor .octicon-link,div#p>svg>foreignObject>section h4:hover .anchor .octicon-link,div#p>svg>foreignObject>section h5:hover .anchor .octicon-link,div#p>svg>foreignObject>section h6:hover .anchor .octicon-link{visibility:visible}div#p>svg>foreignObject>section h1 code,div#p>svg>foreignObject>section h1 tt,div#p>svg>foreignObject>section h2 code,div#p>svg>foreignObject>section h2 tt,div#p>svg>foreignObject>section h3 code,div#p>svg>foreignObject>section h3 tt,div#p>svg>foreignObject>section h4 code,div#p>svg>foreignObject>section h4 tt,div#p>svg>foreignObject>section h5 code,div#p>svg>foreignObject>section h5 tt,div#p>svg>foreignObject>section h6 code,div#p>svg>foreignObject>section h6 tt{font-size:inherit;padding:0 .2em}div#p>svg>foreignObject>section ol.no-list,div#p>svg>foreignObject>section ul.no-list{list-style-type:none;padding:0}div#p>svg>foreignObject>section ol[type="1"]{list-style-type:decimal}div#p>svg>foreignObject>section ol[type=a]{list-style-type:lower-alpha}div#p>svg>foreignObject>section ol[type=i]{list-style-type:lower-roman}div#p>svg>foreignObject>section div>ol:not([type]){list-style-type:decimal}div#p>svg>foreignObject>section ol ol,div#p>svg>foreignObject>section ol ul,div#p>svg>foreignObject>section ul ol,div#p>svg>foreignObject>section ul ul{margin-bottom:0;margin-top:0}div#p>svg>foreignObject>section li>p{margin-top:16px}div#p>svg>foreignObject>section li+li{margin-top:.25em}div#p>svg>foreignObject>section dl{padding:0}div#p>svg>foreignObject>section dl dt{font-size:1em;font-style:italic;font-weight:600;margin-top:16px;padding:0}div#p>svg>foreignObject>section dl dd{margin-bottom:16px;padding:0 16px}div#p>svg>foreignObject>section table th{font-weight:600}div#p>svg>foreignObject>section table td,div#p>svg>foreignObject>section table th{border:1px solid #d0d7de;padding:6px 13px}div#p>svg>foreignObject>section table tr{background-color:#fff;border-top:1px solid #d8dee4}div#p>svg>foreignObject>section table tr:nth-child(2n){background-color:#f6f8fa}div#p>svg>foreignObject>section table img{background-color:transparent}div#p>svg>foreignObject>section img[align=right]{padding-left:20px}div#p>svg>foreignObject>section img[align=left]{padding-right:20px}div#p>svg>foreignObject>section .emoji{background-color:transparent;max-width:none;vertical-align:text-top}div#p>svg>foreignObject>section span.frame,div#p>svg>foreignObject>section span.frame>span{display:block;overflow:hidden}div#p>svg>foreignObject>section span.frame>span{border:1px solid #d0d7de;float:left;margin:13px 0 0;padding:7px;width:auto}div#p>svg>foreignObject>section span.frame span img{display:block;float:left}div#p>svg>foreignObject>section span.frame span span{clear:both;color:#24292f;display:block;padding:5px 0 0}div#p>svg>foreignObject>section span.align-center{clear:both;display:block;overflow:hidden}div#p>svg>foreignObject>section span.align-center>span{display:block;margin:13px auto 0;overflow:hidden;text-align:center}div#p>svg>foreignObject>section span.align-center span img{margin:0 auto;text-align:center}div#p>svg>foreignObject>section span.align-right{clear:both;display:block;overflow:hidden}div#p>svg>foreignObject>section span.align-right>span{display:block;margin:13px 0 0;overflow:hidden;text-align:right}div#p>svg>foreignObject>section span.align-right span img{margin:0;text-align:right}div#p>svg>foreignObject>section span.float-left{display:block;float:left;margin-right:13px;overflow:hidden}div#p>svg>foreignObject>section span.float-left span{margin:13px 0 0}div#p>svg>foreignObject>section span.float-right{display:block;float:right;margin-left:13px;overflow:hidden}div#p>svg>foreignObject>section span.float-right>span{display:block;margin:13px auto 0;overflow:hidden;text-align:right}div#p>svg>foreignObject>section code,div#p>svg>foreignObject>section tt{background-color:rgba(175,184,193,.2);border-radius:6px;font-size:85%;margin:0;padding:.2em .4em}div#p>svg>foreignObject>section code br,div#p>svg>foreignObject>section tt br{display:none}div#p>svg>foreignObject>section del code{text-decoration:inherit}div#p>svg>foreignObject>section pre code{font-size:100%}div#p>svg>foreignObject>section pre>code{background:transparent;border:0;margin:0;padding:0;white-space:pre;word-break:normal}div#p>svg>foreignObject>section .highlight{margin-bottom:16px}div#p>svg>foreignObject>section .highlight pre{margin-bottom:0;word-break:normal}div#p>svg>foreignObject>section pre{background-color:#f6f8fa;border-radius:6px;font-size:85%;line-height:1.45;overflow:auto;padding:16px}div#p>svg>foreignObject>section pre code,div#p>svg>foreignObject>section pre tt{word-wrap:normal;background-color:transparent;border:0;display:inline;line-height:inherit;margin:0;max-width:auto;overflow:visible;padding:0}div#p>svg>foreignObject>section .csv-data td,div#p>svg>foreignObject>section .csv-data th{font-size:12px;line-height:1;overflow:hidden;padding:5px;text-align:left;white-space:nowrap}div#p>svg>foreignObject>section .csv-data .blob-num{background:#fff;border:0;padding:10px 8px 9px;text-align:right}div#p>svg>foreignObject>section .csv-data tr{border-top:0}div#p>svg>foreignObject>section .csv-data th{background:#f6f8fa;border-top:0;font-weight:600}div#p>svg>foreignObject>section .footnotes{border-top:1px solid #d0d7de;color:#57606a;font-size:12px}div#p>svg>foreignObject>section div#p>svg>foreignObject>section section.footnotes{--marpit-root-font-size:12px}div#p>svg>foreignObject>section .footnotes ol{padding-left:16px}div#p>svg>foreignObject>section .footnotes li{position:relative}div#p>svg>foreignObject>section .footnotes li:target:before{border:2px solid #0969da;border-radius:6px;bottom:-8px;content:"";left:-24px;pointer-events:none;position:absolute;right:-8px;top:-8px}div#p>svg>foreignObject>section .footnotes li:target{color:#24292f}div#p>svg>foreignObject>section .footnotes .data-footnote-backref g-emoji{font-family:monospace}div#p>svg>foreignObject>section .task-list-item{list-style-type:none}div#p>svg>foreignObject>section .task-list-item label{font-weight:400}div#p>svg>foreignObject>section .task-list-item.enabled label{cursor:pointer}div#p>svg>foreignObject>section .task-list-item+.task-list-item{margin-top:3px}div#p>svg>foreignObject>section .task-list-item .handle{display:none}div#p>svg>foreignObject>section .task-list-item-checkbox{margin:0 .2em .25em -1.6em;vertical-align:middle}div#p>svg>foreignObject>section .contains-task-list:dir(rtl) .task-list-item-checkbox{margin:0 -1.6em .25em .2em}div#p>svg>foreignObject>section ::-webkit-calendar-picker-indicator{filter:invert(50%)}div#p>svg>foreignObject>section .hljs{background:#fff;color:#333;display:block;overflow-x:auto;padding:.5em}div#p>svg>foreignObject>section .hljs-comment,div#p>svg>foreignObject>section .hljs-meta{color:#969896}div#p>svg>foreignObject>section .hljs-emphasis,div#p>svg>foreignObject>section .hljs-quote,div#p>svg>foreignObject>section .hljs-strong,div#p>svg>foreignObject>section .hljs-template-variable,div#p>svg>foreignObject>section .hljs-variable{color:#df5000}div#p>svg>foreignObject>section .hljs-keyword,div#p>svg>foreignObject>section .hljs-selector-tag,div#p>svg>foreignObject>section .hljs-type{color:#d73a49}div#p>svg>foreignObject>section .hljs-attribute,div#p>svg>foreignObject>section .hljs-bullet,div#p>svg>foreignObject>section .hljs-literal,div#p>svg>foreignObject>section .hljs-symbol{color:#0086b3}div#p>svg>foreignObject>section .hljs-name,div#p>svg>foreignObject>section .hljs-section{color:#63a35c}div#p>svg>foreignObject>section .hljs-tag{color:#333}div#p>svg>foreignObject>section .hljs-attr,div#p>svg>foreignObject>section .hljs-selector-attr,div#p>svg>foreignObject>section .hljs-selector-class,div#p>svg>foreignObject>section .hljs-selector-id,div#p>svg>foreignObject>section .hljs-selector-pseudo,div#p>svg>foreignObject>section .hljs-title{color:#6f42c1}div#p>svg>foreignObject>section .hljs-addition{background-color:#eaffea;color:#55a532}div#p>svg>foreignObject>section .hljs-deletion{background-color:#ffecec;color:#bd2c00}div#p>svg>foreignObject>section .hljs-link{text-decoration:underline}div#p>svg>foreignObject>section .hljs-number{color:#005cc5}div#p>svg>foreignObject>section .hljs-string{color:#032f62}div#p>svg>foreignObject>section svg[data-marp-fitting=svg]{max-height:563px}div#p>svg>foreignObject>section h1{color:#246;font-size:1.6em}div#p>svg>foreignObject>section h1,div#p>svg>foreignObject>section h2{border-bottom:none}div#p>svg>foreignObject>section h2{font-size:1.3em}div#p>svg>foreignObject>section h3{font-size:1.1em}div#p>svg>foreignObject>section h4{font-size:1.05em}div#p>svg>foreignObject>section h5{font-size:1em}div#p>svg>foreignObject>section h6{font-size:.9em}div#p>svg>foreignObject>section h1 strong,div#p>svg>foreignObject>section h2 strong,div#p>svg>foreignObject>section h3 strong,div#p>svg>foreignObject>section h4 strong,div#p>svg>foreignObject>section h5 strong,div#p>svg>foreignObject>section h6 strong{color:#48c;font-weight:inherit}div#p>svg>foreignObject>section hr{height:0;padding-top:.25em}div#p>svg>foreignObject>section pre{border:1px solid #999;line-height:1.15;overflow:visible}div#p>svg>foreignObject>section pre code svg[data-marp-fitting=svg]{max-height:529px}div#p>svg>foreignObject>section footer,div#p>svg>foreignObject>section header{color:hsla(0,0%,40%,.75);font-size:18px;left:30px;margin:0;position:absolute}div#p>svg>foreignObject>section header{top:21px}div#p>svg>foreignObject>section footer{bottom:21px}div#p>svg>foreignObject>section{align-items:stretch;background:#fff;display:flex;flex-flow:column nowrap;font-size:29px;height:720px;justify-content:center;padding:78.5px;width:1280px}div#p>svg>foreignObject>section{--marpit-root-font-size:29px}div#p>svg>foreignObject>section>:last-child,div#p>svg>foreignObject>section[data-footer]>:nth-last-child(2){margin-bottom:0}div#p>svg>foreignObject>section>:first-child,div#p>svg>foreignObject>section>header:first-child+*{margin-top:0}div#p>svg>foreignObject>section:after{bottom:21px;color:#777;font-size:24px;padding:0;position:absolute;right:30px}div#p>svg>foreignObject>section:after{--marpit-root-font-size:24px}div#p>svg>foreignObject>section.invert{background-color:#222;color:#e6eaf0}div#p>svg>foreignObject>section.invert:after{color:#999}div#p>svg>foreignObject>section.invert img{background-color:transparent}div#p>svg>foreignObject>section.invert a{color:#50b3ff}div#p>svg>foreignObject>section.invert h1{color:#a3c5e7}div#p>svg>foreignObject>section.invert h2,div#p>svg>foreignObject>section.invert h3,div#p>svg>foreignObject>section.invert h4,div#p>svg>foreignObject>section.invert h5{color:#ebeff5}div#p>svg>foreignObject>section.invert blockquote,div#p>svg>foreignObject>section.invert h6{border-color:#3d3f43;color:#939699}div#p>svg>foreignObject>section.invert h1 strong,div#p>svg>foreignObject>section.invert h2 strong,div#p>svg>foreignObject>section.invert h3 strong,div#p>svg>foreignObject>section.invert h4 strong,div#p>svg>foreignObject>section.invert h5 strong,div#p>svg>foreignObject>section.invert h6 strong{color:#7bf}div#p>svg>foreignObject>section.invert hr{background-color:#3d3f43}div#p>svg>foreignObject>section.invert footer,div#p>svg>foreignObject>section.invert header{color:hsla(0,0%,60%,.75)}div#p>svg>foreignObject>section.invert code,div#p>svg>foreignObject>section.invert kbd{background-color:#111}div#p>svg>foreignObject>section.invert kbd{border-color:#666;box-shadow:inset 0 -1px 0 #555;color:#e6eaf0}div#p>svg>foreignObject>section.invert table tr{background-color:#12181d;border-color:#60657b}div#p>svg>foreignObject>section.invert table tr:nth-child(2n){background-color:#1b2024}div#p>svg>foreignObject>section.invert table td,div#p>svg>foreignObject>section.invert table th{border-color:#5b5e61}div#p>svg>foreignObject>section.invert pre{background-color:#0a0e12;border-color:#777}div#p>svg>foreignObject>section.invert pre code{background-color:transparent}div#p>svg>foreignObject>section[data-color] h1,div#p>svg>foreignObject>section[data-color] h2,div#p>svg>foreignObject>section[data-color] h3,div#p>svg>foreignObject>section[data-color] h4,div#p>svg>foreignObject>section[data-color] h5,div#p>svg>foreignObject>section[data-color] h6{color:currentcolor}div#p>svg>foreignObject>section svg[data-marp-fitting=svg]{display:block;height:auto;width:100%}@supports (-ms-ime-align:auto){div#p>svg>foreignObject>section svg[data-marp-fitting=svg]{position:static}}div#p>svg>foreignObject>section svg[data-marp-fitting=svg].__reflow__{content:""}@supports (-ms-ime-align:auto){div#p>svg>foreignObject>section svg[data-marp-fitting=svg].__reflow__{position:relative}}div#p>svg>foreignObject>section [data-marp-fitting-svg-content]{display:table;white-space:nowrap;width:-webkit-max-content;width:-moz-max-content;width:max-content}div#p>svg>foreignObject>section [data-marp-fitting-svg-content-wrap]{white-space:pre}div#p>svg>foreignObject>section img[data-marp-twemoji]{background:transparent;height:1em;margin:0 .05em 0 .1em;vertical-align:-.1em;width:1em}
  13. /* @theme tum */div#p>svg>foreignObject>section{
  14. /*background-color: #fff;
  15. color: #000;
  16. background-image: url('images/TUM_Logo_blau_rgb_s.svg');
  17. background-repeat: no-repeat;
  18. background-position: right 40px top 40px;
  19. background-size: 8%;*/}div#p>svg>foreignObject>section.lead{
  20. /*background-image: url('images/TUM_Uhrenturm.png');
  21. background-position: right;
  22. background-size: 45%;*/}div#p>svg>foreignObject>section h1,div#p>svg>foreignObject>section h2{color:#1f315c}div#p>svg>foreignObject>section a{color:#5fb2e6}div#p>svg>foreignObject>section footer,div#p>svg>foreignObject>section:after{color:#9cb7d4}div#p>svg>foreignObject>section.invert{background-color:#003359;color:#fff
  23. /*background-image: url('images/TUM_Logo_weiss_rgb_s.svg');*/}div#p>svg>foreignObject>section.lead.invert{
  24. /*background-image: url('images/TUM_Uhrenturm_w.png');*/}div#p>svg>foreignObject>section.invert footer,div#p>svg>foreignObject>section.invert h1,div#p>svg>foreignObject>section.invert:after{color:#fff}div#p>svg>foreignObject>section.invert a{color:#e37222}
  25. /* Add "Page" prefix and total page number */div#p>svg>foreignObject>section:after{content:attr(data-marpit-pagination) ' / ' attr(data-marpit-pagination-total)}
  26. /* @theme vnc6mvbjqstkhfawxx2h2q37lry3esagk64kvzu5xm */div#p>svg>foreignObject>section[data-marpit-advanced-background=background]{columns:initial!important;display:block!important;padding:0!important}div#p>svg>foreignObject>section[data-marpit-advanced-background=background]:after,div#p>svg>foreignObject>section[data-marpit-advanced-background=background]:before,div#p>svg>foreignObject>section[data-marpit-advanced-background=content]:after,div#p>svg>foreignObject>section[data-marpit-advanced-background=content]:before{display:none!important}div#p>svg>foreignObject>section[data-marpit-advanced-background=background]>div[data-marpit-advanced-background-container]{all:initial;display:flex;flex-direction:row;height:100%;overflow:hidden;width:100%}div#p>svg>foreignObject>section[data-marpit-advanced-background=background]>div[data-marpit-advanced-background-container][data-marpit-advanced-background-direction=vertical]{flex-direction:column}div#p>svg>foreignObject>section[data-marpit-advanced-background=background][data-marpit-advanced-background-split]>div[data-marpit-advanced-background-container]{width:var(--marpit-advanced-background-split,50%)}div#p>svg>foreignObject>section[data-marpit-advanced-background=background][data-marpit-advanced-background-split=right]>div[data-marpit-advanced-background-container]{margin-left:calc(100% - var(--marpit-advanced-background-split, 50%))}div#p>svg>foreignObject>section[data-marpit-advanced-background=background]>div[data-marpit-advanced-background-container]>figure{all:initial;background-position:center;background-repeat:no-repeat;background-size:cover;flex:auto;margin:0}div#p>svg>foreignObject>section[data-marpit-advanced-background=content],div#p>svg>foreignObject>section[data-marpit-advanced-background=pseudo]{background:transparent!important}div#p>svg>foreignObject>section[data-marpit-advanced-background=pseudo],div#p>svg[data-marpit-svg]>foreignObject[data-marpit-advanced-background=pseudo]{pointer-events:none!important}div#p>svg>foreignObject>section[data-marpit-advanced-background-split]{width:100%;height:100%}</style></head><body><div class="bespoke-progress-parent"><div class="bespoke-progress-bar"></div></div><div class="bespoke-marp-osc"><button data-bespoke-marp-osc="prev" tabindex="-1" title="Previous slide">Previous slide</button><span data-bespoke-marp-osc="page"></span><button data-bespoke-marp-osc="next" tabindex="-1" title="Next slide">Next slide</button><button data-bespoke-marp-osc="fullscreen" tabindex="-1" title="Toggle fullscreen (f)">Toggle fullscreen</button><button data-bespoke-marp-osc="presenter" tabindex="-1" title="Open presenter view (p)">Open presenter view</button></div><div id="p"><svg data-marpit-svg="" viewBox="0 0 1280 720"><foreignObject width="1280" height="720"><section id="1" data-background-image="url('assets/garde.png')" data-theme="vnc6mvbjqstkhfawxx2h2q37lry3esagk64kvzu5xm" style="--background-image:url('assets/garde.png');--theme:vnc6mvbjqstkhfawxx2h2q37lry3esagk64kvzu5xm;background-image:url('assets/garde.png');background-position:center;background-repeat:no-repeat;background-size:cover;">
  27. <h1><svg data-marp-fitting="svg"><foreignObject><span data-marp-fitting-svg-content>Introduction to structured programming with <code>Fortran</code></span></foreignObject></svg></h1>
  28. <p><a href="https://gogs.elic.ucl.ac.be/pbarriat/learning-fortran">https://gogs.elic.ucl.ac.be/pbarriat/learning-fortran</a></p>
  29. <p><img src="assets/fortran_logo.png" alt="" style="height:150px;" /></p>
  30. <h3>Pierre-Yves Barriat</h3>
  31. <h5>November 09, 2022</h5>
  32. <h6>CISM/CÉCI Training Sessions</h6>
  33. </section>
  34. </foreignObject></svg><svg data-marpit-svg="" viewBox="0 0 1280 720"><foreignObject width="1280" height="720"><section id="2" data-background-image="url('assets/back.png')" data-footer="09/11/2022 | Introduction to structured programming with Fortran" data-paginate="true" data-theme="vnc6mvbjqstkhfawxx2h2q37lry3esagk64kvzu5xm" data-marpit-pagination="2" data-marpit-pagination-total="60" style="--background-image:url('assets/back.png');--footer:09/11/2022 | Introduction to structured programming with Fortran;--paginate:true;--theme:vnc6mvbjqstkhfawxx2h2q37lry3esagk64kvzu5xm;background-image:url('assets/back.png');background-position:center;background-repeat:no-repeat;background-size:cover;">
  35. <h1>Fortran : shall we start ?</h1>
  36. <ul>
  37. <li>You know already one computer language ?</li>
  38. <li>You understand the very basic programming concepts :
  39. <ul>
  40. <li>What is a variable, an assignment, function call, etc.?</li>
  41. <li>Why do I have to compile my code?</li>
  42. <li>What is an executable?</li>
  43. </ul>
  44. </li>
  45. <li>You (may) already know some Fortran ?</li>
  46. <li>How to proceed from old Fortran, to much more modern languages like Fortran 90/2003 ?</li>
  47. </ul>
  48. <footer>09/11/2022 | Introduction to structured programming with Fortran</footer>
  49. </section>
  50. </foreignObject></svg><svg data-marpit-svg="" viewBox="0 0 1280 720"><foreignObject width="1280" height="720"><section id="3" data-background-image="url('assets/back.png')" data-footer="09/11/2022 | Introduction to structured programming with Fortran" data-paginate="true" data-theme="vnc6mvbjqstkhfawxx2h2q37lry3esagk64kvzu5xm" data-marpit-pagination="3" data-marpit-pagination-total="60" style="--background-image:url('assets/back.png');--footer:09/11/2022 | Introduction to structured programming with Fortran;--paginate:true;--theme:vnc6mvbjqstkhfawxx2h2q37lry3esagk64kvzu5xm;background-image:url('assets/back.png');background-position:center;background-repeat:no-repeat;background-size:cover;">
  51. <h1>Why to learn Fortran ?</h1>
  52. <ul>
  53. <li>Because of the execution <code>speed</code> of a program</li>
  54. <li>Well suited for numerical computations :<br />
  55. more than 45% of scientific applications are in Fortran</li>
  56. <li><code>Fast</code> code : compilers can optimize well</li>
  57. <li>Optimized <code>numerical libraries</code> available</li>
  58. <li>Fortran is a <code>simple</code> langage and it is (kind-of) <code>easy to learn</code></li>
  59. </ul>
  60. <footer>09/11/2022 | Introduction to structured programming with Fortran</footer>
  61. </section>
  62. </foreignObject></svg><svg data-marpit-svg="" viewBox="0 0 1280 720"><foreignObject width="1280" height="720"><section id="4" data-background-image="url('assets/back.png')" data-footer="09/11/2022 | Introduction to structured programming with Fortran" data-paginate="true" data-theme="vnc6mvbjqstkhfawxx2h2q37lry3esagk64kvzu5xm" data-marpit-pagination="4" data-marpit-pagination-total="60" style="--background-image:url('assets/back.png');--footer:09/11/2022 | Introduction to structured programming with Fortran;--paginate:true;--theme:vnc6mvbjqstkhfawxx2h2q37lry3esagk64kvzu5xm;background-image:url('assets/back.png');background-position:center;background-repeat:no-repeat;background-size:cover;">
  63. <h1>Fortran is simple</h1>
  64. <ul>
  65. <li><strong>We want to get our science done! Not learn languages!</strong></li>
  66. <li>How easy/difficult is it really to learn Fortran ?</li>
  67. <li>The concept is easy:<br />
  68. <em>variables, operators, controls, loops, subroutines/functions</em></li>
  69. <li><strong>Invest some time now, gain big later!</strong></li>
  70. </ul>
  71. <footer>09/11/2022 | Introduction to structured programming with Fortran</footer>
  72. </section>
  73. </foreignObject></svg><svg data-marpit-svg="" viewBox="0 0 1280 720"><foreignObject width="1280" height="720"><section id="5" data-background-image="url('assets/back.png')" data-footer="09/11/2022 | Introduction to structured programming with Fortran" data-paginate="true" data-theme="vnc6mvbjqstkhfawxx2h2q37lry3esagk64kvzu5xm" data-marpit-pagination="5" data-marpit-pagination-total="60" style="--background-image:url('assets/back.png');--footer:09/11/2022 | Introduction to structured programming with Fortran;--paginate:true;--theme:vnc6mvbjqstkhfawxx2h2q37lry3esagk64kvzu5xm;background-image:url('assets/back.png');background-position:center;background-repeat:no-repeat;background-size:cover;">
  74. <h1>History</h1>
  75. <p><strong>FOR</strong>mula <strong>TRAN</strong>slation</p>
  76. <blockquote>
  77. <p>invented 1954-8 by John Backus and his team at IBM</p>
  78. </blockquote>
  79. <ul>
  80. <li>FORTRAN 66 (ISO Standard 1972)</li>
  81. <li>FORTRAN 77 (1978)</li>
  82. <li>Fortran 90 (1991)</li>
  83. <li>Fortran 95 (1997)</li>
  84. <li>Fortran 2003 (2004) → <code>&quot;standard&quot; version</code></li>
  85. <li>Fortran 2008 (2010)</li>
  86. <li>Fortran 2018 (11/2018)</li>
  87. </ul>
  88. <footer>09/11/2022 | Introduction to structured programming with Fortran</footer>
  89. </section>
  90. </foreignObject></svg><svg data-marpit-svg="" viewBox="0 0 1280 720"><foreignObject width="1280" height="720"><section id="6" data-background-image="url('assets/back.png')" data-footer="09/11/2022 | Introduction to structured programming with Fortran" data-paginate="true" data-theme="vnc6mvbjqstkhfawxx2h2q37lry3esagk64kvzu5xm" data-marpit-pagination="6" data-marpit-pagination-total="60" style="--background-image:url('assets/back.png');--footer:09/11/2022 | Introduction to structured programming with Fortran;--paginate:true;--theme:vnc6mvbjqstkhfawxx2h2q37lry3esagk64kvzu5xm;background-image:url('assets/back.png');background-position:center;background-repeat:no-repeat;background-size:cover;">
  91. <h1>Starting with Fortran 77</h1>
  92. <ul>
  93. <li>Old Fortran provides only the absolute minimum!</li>
  94. <li>Basic features :<br />
  95. data containers (integer, float, ...), arrays, basic operators, loops, I/O, subroutines and functions</li>
  96. <li>But this version has flaws:<br />
  97. no dynamic memory allocation, old &amp; obsolete constructs, “spaghetti” code, etc.</li>
  98. <li>Is that enough to write code ?</li>
  99. </ul>
  100. <footer>09/11/2022 | Introduction to structured programming with Fortran</footer>
  101. </section>
  102. </foreignObject></svg><svg data-marpit-svg="" viewBox="0 0 1280 720"><foreignObject width="1280" height="720"><section id="7" data-background-image="url('assets/back.png')" data-footer="09/11/2022 | Introduction to structured programming with Fortran" data-paginate="true" data-theme="vnc6mvbjqstkhfawxx2h2q37lry3esagk64kvzu5xm" data-marpit-pagination="7" data-marpit-pagination-total="60" style="--background-image:url('assets/back.png');--footer:09/11/2022 | Introduction to structured programming with Fortran;--paginate:true;--theme:vnc6mvbjqstkhfawxx2h2q37lry3esagk64kvzu5xm;background-image:url('assets/back.png');background-position:center;background-repeat:no-repeat;background-size:cover;">
  103. <h1>Fortran 77 → Fortran &gt;90</h1>
  104. <ul>
  105. <li>If Fortran 77 is so simple, why is it then so difficult to write good code?</li>
  106. <li>Is simple really better?<br />
  107. ⇒ Using a language allows us to express our thoughts (on a computer)</li>
  108. <li>A more sophisticated language allows for more complex thoughts</li>
  109. <li>More language elements to get organized<br />
  110. ⇒ Fortran 90/95/2003 (recursive, OOP, etc)</li>
  111. </ul>
  112. <footer>09/11/2022 | Introduction to structured programming with Fortran</footer>
  113. </section>
  114. </foreignObject></svg><svg data-marpit-svg="" viewBox="0 0 1280 720"><foreignObject width="1280" height="720"><section id="8" data-background-image="url('assets/back.png')" data-footer="09/11/2022 | Introduction to structured programming with Fortran" data-paginate="true" data-theme="vnc6mvbjqstkhfawxx2h2q37lry3esagk64kvzu5xm" data-marpit-pagination="8" data-marpit-pagination-total="60" style="--background-image:url('assets/back.png');--footer:09/11/2022 | Introduction to structured programming with Fortran;--paginate:true;--theme:vnc6mvbjqstkhfawxx2h2q37lry3esagk64kvzu5xm;background-image:url('assets/back.png');background-position:center;background-repeat:no-repeat;background-size:cover;">
  115. <h1>How to Build a FORTRAN Program</h1>
  116. <p>FORTRAN is a compiled language (like C) so the source code (what you write) must be converted into machine code before it can be executed (e.g. Make command)</p>
  117. <p><img src="assets/build_fortran.png" alt="" style="height:400px;" /></p>
  118. <footer>09/11/2022 | Introduction to structured programming with Fortran</footer>
  119. </section>
  120. </foreignObject></svg><svg data-marpit-svg="" viewBox="0 0 1280 720"><foreignObject width="1280" height="720"><section id="9" data-background-image="url('assets/back.png')" data-footer="09/11/2022 | Introduction to structured programming with Fortran" data-paginate="true" data-theme="vnc6mvbjqstkhfawxx2h2q37lry3esagk64kvzu5xm" data-marpit-pagination="9" data-marpit-pagination-total="60" style="--background-image:url('assets/back.png');--footer:09/11/2022 | Introduction to structured programming with Fortran;--paginate:true;--theme:vnc6mvbjqstkhfawxx2h2q37lry3esagk64kvzu5xm;background-image:url('assets/back.png');background-position:center;background-repeat:no-repeat;background-size:cover;">
  121. <h1>FORTRAN 77 Format</h1>
  122. <p>This version requires a fixed format for programs</p>
  123. <p><img src="assets/f77_format.png" alt="" style="height:300px;" /></p>
  124. <ul>
  125. <li>max length variable names is 6 characters</li>
  126. <li>alphanumeric only, must start with a letter</li>
  127. <li>character strings are case sensitive</li>
  128. </ul>
  129. <footer>09/11/2022 | Introduction to structured programming with Fortran</footer>
  130. </section>
  131. </foreignObject></svg><svg data-marpit-svg="" viewBox="0 0 1280 720"><foreignObject width="1280" height="720"><section id="10" data-background-image="url('assets/back.png')" data-footer="09/11/2022 | Introduction to structured programming with Fortran" data-paginate="true" data-theme="vnc6mvbjqstkhfawxx2h2q37lry3esagk64kvzu5xm" data-marpit-pagination="10" data-marpit-pagination-total="60" style="--background-image:url('assets/back.png');--footer:09/11/2022 | Introduction to structured programming with Fortran;--paginate:true;--theme:vnc6mvbjqstkhfawxx2h2q37lry3esagk64kvzu5xm;background-image:url('assets/back.png');background-position:center;background-repeat:no-repeat;background-size:cover;">
  132. <h1>FORTRAN &gt;90 Format</h1>
  133. <p>Versions &gt;90 relaxe these requirements:</p>
  134. <ul>
  135. <li>comments following statements (! delimiter)</li>
  136. <li>long variable names (31 characters)</li>
  137. <li>containing only letters, digits or underscore</li>
  138. <li>max row length is 132 characters</li>
  139. <li>can be max 39 continuation lines</li>
  140. <li>if a line is ended with ampersand (&amp;), the line continues onto the next line</li>
  141. <li>semicolon (;) as a separator between statements on a single line</li>
  142. <li>allows free field input</li>
  143. </ul>
  144. <footer>09/11/2022 | Introduction to structured programming with Fortran</footer>
  145. </section>
  146. </foreignObject></svg><svg data-marpit-svg="" viewBox="0 0 1280 720"><foreignObject width="1280" height="720"><section id="11" data-background-image="url('assets/back.png')" data-footer="09/11/2022 | Introduction to structured programming with Fortran" data-paginate="true" data-theme="vnc6mvbjqstkhfawxx2h2q37lry3esagk64kvzu5xm" data-marpit-pagination="11" data-marpit-pagination-total="60" style="--background-image:url('assets/back.png');--footer:09/11/2022 | Introduction to structured programming with Fortran;--paginate:true;--theme:vnc6mvbjqstkhfawxx2h2q37lry3esagk64kvzu5xm;background-image:url('assets/back.png');background-position:center;background-repeat:no-repeat;background-size:cover;">
  147. <h1>Program Organization</h1>
  148. <p>Most FORTRAN programs consist of a main program and one or more subprograms</p>
  149. <p>There is a fixed order:</p>
  150. <pre><code class="language-Fortran90"><svg data-marp-fitting="svg" data-marp-fitting-code><foreignObject><span data-marp-fitting-svg-content><span data-marp-fitting-svg-content-wrap>Heading
  151. Declarations
  152. Variable initializations
  153. Program code
  154. Format statements
  155. Subprogram definitions
  156. (functions &amp; subroutines)
  157. </span></span></foreignObject></svg></code></pre>
  158. <footer>09/11/2022 | Introduction to structured programming with Fortran</footer>
  159. </section>
  160. </foreignObject></svg><svg data-marpit-svg="" viewBox="0 0 1280 720"><foreignObject width="1280" height="720"><section id="12" data-background-image="url('assets/back.png')" data-footer="09/11/2022 | Introduction to structured programming with Fortran" data-paginate="true" data-theme="vnc6mvbjqstkhfawxx2h2q37lry3esagk64kvzu5xm" data-marpit-pagination="12" data-marpit-pagination-total="60" style="--background-image:url('assets/back.png');--footer:09/11/2022 | Introduction to structured programming with Fortran;--paginate:true;--theme:vnc6mvbjqstkhfawxx2h2q37lry3esagk64kvzu5xm;background-image:url('assets/back.png');background-position:center;background-repeat:no-repeat;background-size:cover;">
  161. <h1>Data Type Declarations</h1>
  162. <p>Basic data types are :</p>
  163. <ul>
  164. <li><code>INTEGER</code> : integer numbers (+/-)</li>
  165. <li><code>REAL</code> : floating point numbers</li>
  166. <li><code>DOUBLE PRECISION</code> : extended precision floating point</li>
  167. <li><code>CHARACTER*n</code> : string with up to <strong>n</strong> characters</li>
  168. <li><code>LOGICAL</code> : takes on values <code>.TRUE.</code> or <code>.FALSE.</code></li>
  169. </ul>
  170. <footer>09/11/2022 | Introduction to structured programming with Fortran</footer>
  171. </section>
  172. </foreignObject></svg><svg data-marpit-svg="" viewBox="0 0 1280 720"><foreignObject width="1280" height="720"><section id="13" data-background-image="url('assets/back.png')" data-footer="09/11/2022 | Introduction to structured programming with Fortran" data-paginate="true" data-theme="vnc6mvbjqstkhfawxx2h2q37lry3esagk64kvzu5xm" data-marpit-pagination="13" data-marpit-pagination-total="60" style="--background-image:url('assets/back.png');--footer:09/11/2022 | Introduction to structured programming with Fortran;--paginate:true;--theme:vnc6mvbjqstkhfawxx2h2q37lry3esagk64kvzu5xm;background-image:url('assets/back.png');background-position:center;background-repeat:no-repeat;background-size:cover;">
  173. <h1>Data Type Declarations</h1>
  174. <p><code>INTEGER</code> and <code>REAL</code> can specify number of bytes to use</p>
  175. <ul>
  176. <li>Default is: <code>INTEGER*4</code> and <code>REAL*4</code></li>
  177. <li><code>DOUBLE PRECISION</code> is same as <code>REAL*8</code></li>
  178. </ul>
  179. <p>Arrays of any type must be declared:</p>
  180. <ul>
  181. <li><code>DIMENSION A(3,5)</code> - declares a 3 x 5 array</li>
  182. <li><code>CHARACTER*30 NAME(50)</code> - directly declares a character array with 30 character strings in each element</li>
  183. </ul>
  184. <footer>09/11/2022 | Introduction to structured programming with Fortran</footer>
  185. </section>
  186. </foreignObject></svg><svg data-marpit-svg="" viewBox="0 0 1280 720"><foreignObject width="1280" height="720"><section id="14" data-background-image="url('assets/back.png')" data-footer="09/11/2022 | Introduction to structured programming with Fortran" data-paginate="true" data-theme="vnc6mvbjqstkhfawxx2h2q37lry3esagk64kvzu5xm" data-marpit-pagination="14" data-marpit-pagination-total="60" style="--background-image:url('assets/back.png');--footer:09/11/2022 | Introduction to structured programming with Fortran;--paginate:true;--theme:vnc6mvbjqstkhfawxx2h2q37lry3esagk64kvzu5xm;background-image:url('assets/back.png');background-position:center;background-repeat:no-repeat;background-size:cover;">
  187. <h1>Data Type Declarations</h1>
  188. <p>FORTRAN &gt;90 allows user defined types</p>
  189. <pre><code class="language-fortran"><svg data-marp-fitting="svg" data-marp-fitting-code><foreignObject><span data-marp-fitting-svg-content><span data-marp-fitting-svg-content-wrap><span class="hljs-keyword">TYPE</span> my_variable
  190. <span class="hljs-keyword">character</span>(<span class="hljs-number">30</span>) :: <span class="hljs-keyword">name</span>
  191. <span class="hljs-keyword">integer</span> :: id
  192. <span class="hljs-keyword">real</span>(<span class="hljs-number">8</span>) :: <span class="hljs-keyword">value</span>
  193. <span class="hljs-keyword">integer</span>, <span class="hljs-keyword">dimension</span>(<span class="hljs-number">3</span>,<span class="hljs-number">3</span>) :: dimIndex
  194. <span class="hljs-keyword">END</span> <span class="hljs-keyword">TYPE</span> variable
  195. <span class="hljs-keyword">type</span>(my_variable) var
  196. var%<span class="hljs-keyword">name</span> = <span class="hljs-string">&quot;salinity&quot;</span>
  197. var%id = <span class="hljs-number">1</span>
  198. </span></span></foreignObject></svg></code></pre>
  199. <footer>09/11/2022 | Introduction to structured programming with Fortran</footer>
  200. </section>
  201. </foreignObject></svg><svg data-marpit-svg="" viewBox="0 0 1280 720"><foreignObject width="1280" height="720"><section id="15" data-background-image="url('assets/back.png')" data-footer="09/11/2022 | Introduction to structured programming with Fortran" data-paginate="true" data-theme="vnc6mvbjqstkhfawxx2h2q37lry3esagk64kvzu5xm" data-marpit-pagination="15" data-marpit-pagination-total="60" style="--background-image:url('assets/back.png');--footer:09/11/2022 | Introduction to structured programming with Fortran;--paginate:true;--theme:vnc6mvbjqstkhfawxx2h2q37lry3esagk64kvzu5xm;background-image:url('assets/back.png');background-position:center;background-repeat:no-repeat;background-size:cover;">
  202. <h1>Implicit vs Explicit Declarations</h1>
  203. <p>By default, an implicit type is assumed depending on the first letter of the variable name:</p>
  204. <ul>
  205. <li><code>A-H, O-Z</code> define REAL variables</li>
  206. <li><code>I-N</code> define INTEGER variables</li>
  207. </ul>
  208. <p>Can use the IMPLICIT statement:</p>
  209. <pre><code class="language-fortran"><svg data-marp-fitting="svg" data-marp-fitting-code><foreignObject><span data-marp-fitting-svg-content><span data-marp-fitting-svg-content-wrap><span class="hljs-keyword">IMPLICIT</span> <span class="hljs-keyword">REAL</span> (A-Z)
  210. </span></span></foreignObject></svg></code></pre>
  211. <blockquote>
  212. <p>makes all variables REAL if not declared</p>
  213. </blockquote>
  214. <footer>09/11/2022 | Introduction to structured programming with Fortran</footer>
  215. </section>
  216. </foreignObject></svg><svg data-marpit-svg="" viewBox="0 0 1280 720"><foreignObject width="1280" height="720"><section id="16" data-background-image="url('assets/back.png')" data-footer="09/11/2022 | Introduction to structured programming with Fortran" data-paginate="true" data-theme="vnc6mvbjqstkhfawxx2h2q37lry3esagk64kvzu5xm" data-marpit-pagination="16" data-marpit-pagination-total="60" style="--background-image:url('assets/back.png');--footer:09/11/2022 | Introduction to structured programming with Fortran;--paginate:true;--theme:vnc6mvbjqstkhfawxx2h2q37lry3esagk64kvzu5xm;background-image:url('assets/back.png');background-position:center;background-repeat:no-repeat;background-size:cover;">
  217. <h1>Implicit vs Explicit Declarations</h1>
  218. <pre><code class="language-fortran"><svg data-marp-fitting="svg" data-marp-fitting-code><foreignObject><span data-marp-fitting-svg-content><span data-marp-fitting-svg-content-wrap><span class="hljs-keyword">IMPLICIT</span> <span class="hljs-keyword">CHARACTER</span>*<span class="hljs-number">2</span> (W)
  219. </span></span></foreignObject></svg></code></pre>
  220. <blockquote>
  221. <p>makes variables starting with W be 2-character strings</p>
  222. </blockquote>
  223. <pre><code class="language-fortran"><svg data-marp-fitting="svg" data-marp-fitting-code><foreignObject><span data-marp-fitting-svg-content><span data-marp-fitting-svg-content-wrap><span class="hljs-keyword">IMPLICIT</span> <span class="hljs-keyword">DOUBLE</span> <span class="hljs-keyword">PRECISION</span> (D)
  224. </span></span></foreignObject></svg></code></pre>
  225. <blockquote>
  226. <p>makes variables starting with D be double precision</p>
  227. </blockquote>
  228. <p><strong>Good habit</strong>: force explicit type declarations</p>
  229. <pre><code class="language-fortran"><svg data-marp-fitting="svg" data-marp-fitting-code><foreignObject><span data-marp-fitting-svg-content><span data-marp-fitting-svg-content-wrap><span class="hljs-keyword">IMPLICIT</span> <span class="hljs-keyword">NONE</span>
  230. </span></span></foreignObject></svg></code></pre>
  231. <blockquote>
  232. <p>user must explicitly declare all variable types</p>
  233. </blockquote>
  234. <footer>09/11/2022 | Introduction to structured programming with Fortran</footer>
  235. </section>
  236. </foreignObject></svg><svg data-marpit-svg="" viewBox="0 0 1280 720"><foreignObject width="1280" height="720"><section id="17" data-background-image="url('assets/back.png')" data-footer="09/11/2022 | Introduction to structured programming with Fortran" data-paginate="true" data-theme="vnc6mvbjqstkhfawxx2h2q37lry3esagk64kvzu5xm" data-marpit-pagination="17" data-marpit-pagination-total="60" style="--background-image:url('assets/back.png');--footer:09/11/2022 | Introduction to structured programming with Fortran;--paginate:true;--theme:vnc6mvbjqstkhfawxx2h2q37lry3esagk64kvzu5xm;background-image:url('assets/back.png');background-position:center;background-repeat:no-repeat;background-size:cover;">
  237. <h1>Assignment Statements</h1>
  238. <p><strong>Old</strong> assignment statement: <code>&lt;label&gt;</code> <code>&lt;variable&gt;</code> = <code>&lt;expression&gt;</code></p>
  239. <ul>
  240. <li><code>&lt;label&gt;</code> : statement label number (1 to 99999)</li>
  241. <li><code>&lt;variable&gt;</code> : FORTRAN variable<br />
  242. (max 6 characters, alphanumeric only for standard FORTRAN 77)</li>
  243. </ul>
  244. <p><strong>Expression</strong>:</p>
  245. <ul>
  246. <li>Numeric expressions: <code>VAR = 3.5*COS(THETA)</code></li>
  247. <li>Character expressions: <code>DAY(1:3) = 'TUE'</code></li>
  248. <li>Relational expressions: <code>FLAG = ANS .GT. 0</code></li>
  249. <li>Logical expressions: <code>FLAG = F1 .OR. F2</code></li>
  250. </ul>
  251. <footer>09/11/2022 | Introduction to structured programming with Fortran</footer>
  252. </section>
  253. </foreignObject></svg><svg data-marpit-svg="" viewBox="0 0 1280 720"><foreignObject width="1280" height="720"><section id="18" data-background-image="url('assets/back.png')" data-footer="09/11/2022 | Introduction to structured programming with Fortran" data-paginate="true" data-theme="vnc6mvbjqstkhfawxx2h2q37lry3esagk64kvzu5xm" data-marpit-pagination="18" data-marpit-pagination-total="60" style="--background-image:url('assets/back.png');--footer:09/11/2022 | Introduction to structured programming with Fortran;--paginate:true;--theme:vnc6mvbjqstkhfawxx2h2q37lry3esagk64kvzu5xm;background-image:url('assets/back.png');background-position:center;background-repeat:no-repeat;background-size:cover;">
  254. <h1>Numeric Expressions</h1>
  255. <p>Arithmetic operators: precedence: <code>**</code> <em>(high)</em> → <code>-</code> <em>(low)</em></p>
  256. <table>
  257. <thead>
  258. <tr>
  259. <th>Operator</th>
  260. <th>Function</th>
  261. </tr>
  262. </thead>
  263. <tbody>
  264. <tr>
  265. <td><code>**</code></td>
  266. <td>exponentiation</td>
  267. </tr>
  268. <tr>
  269. <td><code>*</code></td>
  270. <td>multiplication</td>
  271. </tr>
  272. <tr>
  273. <td><code>/</code></td>
  274. <td>division</td>
  275. </tr>
  276. <tr>
  277. <td><code>+</code></td>
  278. <td>addition</td>
  279. </tr>
  280. <tr>
  281. <td><code>-</code></td>
  282. <td>subtraction</td>
  283. </tr>
  284. </tbody>
  285. </table>
  286. <footer>09/11/2022 | Introduction to structured programming with Fortran</footer>
  287. </section>
  288. </foreignObject></svg><svg data-marpit-svg="" viewBox="0 0 1280 720"><foreignObject width="1280" height="720"><section id="19" data-background-image="url('assets/back.png')" data-footer="09/11/2022 | Introduction to structured programming with Fortran" data-paginate="true" data-theme="vnc6mvbjqstkhfawxx2h2q37lry3esagk64kvzu5xm" data-marpit-pagination="19" data-marpit-pagination-total="60" style="--background-image:url('assets/back.png');--footer:09/11/2022 | Introduction to structured programming with Fortran;--paginate:true;--theme:vnc6mvbjqstkhfawxx2h2q37lry3esagk64kvzu5xm;background-image:url('assets/back.png');background-position:center;background-repeat:no-repeat;background-size:cover;">
  289. <h1>Numeric Expressions</h1>
  290. <p>Numeric expressions are up-cast to the highest data type in the expression according to the precedence:</p>
  291. <p><em>(low)</em> logical → integer → real → complex <em>(high)</em></p>
  292. <p>and smaller byte size <em>(low)</em> to larger byte size <em>(high)</em></p>
  293. <h2>Example:</h2>
  294. <blockquote>
  295. <p>fortran 77 source code <a href="https://gogs.elic.ucl.ac.be/pbarriat/learning-fortran/src/master/src/01_arith.f">arith.f</a></p>
  296. </blockquote>
  297. <footer>09/11/2022 | Introduction to structured programming with Fortran</footer>
  298. </section>
  299. </foreignObject></svg><svg data-marpit-svg="" viewBox="0 0 1280 720"><foreignObject width="1280" height="720"><section id="20" data-background-image="url('assets/back.png')" data-footer="09/11/2022 | Introduction to structured programming with Fortran" data-paginate="true" data-theme="vnc6mvbjqstkhfawxx2h2q37lry3esagk64kvzu5xm" data-marpit-pagination="20" data-marpit-pagination-total="60" style="--background-image:url('assets/back.png');--footer:09/11/2022 | Introduction to structured programming with Fortran;--paginate:true;--theme:vnc6mvbjqstkhfawxx2h2q37lry3esagk64kvzu5xm;background-image:url('assets/back.png');background-position:center;background-repeat:no-repeat;background-size:cover;">
  300. <h1>Character Expressions</h1>
  301. <p>Only built-in operator is <strong>Concatenation</strong> defined by <code>//</code></p>
  302. <pre><code class="language-fortran"><svg data-marp-fitting="svg" data-marp-fitting-code><foreignObject><span data-marp-fitting-svg-content><span data-marp-fitting-svg-content-wrap><span class="hljs-string">&#x27;ILL&#x27;</span>//<span class="hljs-string">&#x27;-&#x27;</span>//<span class="hljs-string">&#x27;ADVISED&#x27;</span>
  303. </span></span></foreignObject></svg></code></pre>
  304. <p><code>character</code> arrays are most commonly encountered</p>
  305. <ul>
  306. <li>treated like any array (indexed using : notation)</li>
  307. <li>fixed length (usually padded with blanks)</li>
  308. </ul>
  309. <footer>09/11/2022 | Introduction to structured programming with Fortran</footer>
  310. </section>
  311. </foreignObject></svg><svg data-marpit-svg="" viewBox="0 0 1280 720"><foreignObject width="1280" height="720"><section id="21" data-background-image="url('assets/back.png')" data-footer="09/11/2022 | Introduction to structured programming with Fortran" data-paginate="true" data-theme="vnc6mvbjqstkhfawxx2h2q37lry3esagk64kvzu5xm" data-marpit-pagination="21" data-marpit-pagination-total="60" style="--background-image:url('assets/back.png');--footer:09/11/2022 | Introduction to structured programming with Fortran;--paginate:true;--theme:vnc6mvbjqstkhfawxx2h2q37lry3esagk64kvzu5xm;background-image:url('assets/back.png');background-position:center;background-repeat:no-repeat;background-size:cover;">
  312. <h1>Character Expressions</h1>
  313. <p>Example:</p>
  314. <pre><code class="language-fortran"><svg data-marp-fitting="svg" data-marp-fitting-code><foreignObject><span data-marp-fitting-svg-content><span data-marp-fitting-svg-content-wrap><span class="hljs-keyword">CHARACTER</span> FAMILY*<span class="hljs-number">16</span>
  315. FAMILY = ‘GEORGE P. BURDELL’
  316. <span class="hljs-built_in">PRINT</span>*,FAMILY(:<span class="hljs-number">6</span>)
  317. <span class="hljs-built_in">PRINT</span>*,FAMILY(<span class="hljs-number">8</span>:<span class="hljs-number">9</span>)
  318. <span class="hljs-built_in">PRINT</span>*,FAMILY(<span class="hljs-number">11</span>:)
  319. <span class="hljs-built_in">PRINT</span>*,FAMILY(:<span class="hljs-number">6</span>)//FAMILY(<span class="hljs-number">10</span>:)
  320. </span></span></foreignObject></svg></code></pre>
  321. <pre><code class="language-fortran"><svg data-marp-fitting="svg" data-marp-fitting-code><foreignObject><span data-marp-fitting-svg-content><span data-marp-fitting-svg-content-wrap>GEORGE
  322. P.
  323. BURDELL
  324. GEORGE BURDELL
  325. </span></span></foreignObject></svg></code></pre>
  326. <footer>09/11/2022 | Introduction to structured programming with Fortran</footer>
  327. </section>
  328. </foreignObject></svg><svg data-marpit-svg="" viewBox="0 0 1280 720"><foreignObject width="1280" height="720"><section id="22" data-background-image="url('assets/back.png')" data-footer="09/11/2022 | Introduction to structured programming with Fortran" data-paginate="true" data-theme="vnc6mvbjqstkhfawxx2h2q37lry3esagk64kvzu5xm" data-marpit-pagination="22" data-marpit-pagination-total="60" style="--background-image:url('assets/back.png');--footer:09/11/2022 | Introduction to structured programming with Fortran;--paginate:true;--theme:vnc6mvbjqstkhfawxx2h2q37lry3esagk64kvzu5xm;background-image:url('assets/back.png');background-position:center;background-repeat:no-repeat;background-size:cover;">
  329. <h1>Relational Expressions</h1>
  330. <p>Two expressions whose values are compared to determine whether the relation is true or false</p>
  331. <ul>
  332. <li>may be numeric (common) or non-numeric</li>
  333. </ul>
  334. <p><code>character</code> strings can be compared</p>
  335. <ul>
  336. <li>done character by character</li>
  337. <li>shorter string is padded with blanks for comparison</li>
  338. </ul>
  339. <footer>09/11/2022 | Introduction to structured programming with Fortran</footer>
  340. </section>
  341. </foreignObject></svg><svg data-marpit-svg="" viewBox="0 0 1280 720"><foreignObject width="1280" height="720"><section id="23" data-background-image="url('assets/back.png')" data-footer="09/11/2022 | Introduction to structured programming with Fortran" data-paginate="true" data-theme="vnc6mvbjqstkhfawxx2h2q37lry3esagk64kvzu5xm" data-marpit-pagination="23" data-marpit-pagination-total="60" style="--background-image:url('assets/back.png');--footer:09/11/2022 | Introduction to structured programming with Fortran;--paginate:true;--theme:vnc6mvbjqstkhfawxx2h2q37lry3esagk64kvzu5xm;background-image:url('assets/back.png');background-position:center;background-repeat:no-repeat;background-size:cover;">
  342. <h1>Relational Expressions</h1>
  343. <table>
  344. <thead>
  345. <tr>
  346. <th>Operator</th>
  347. <th>Relationship</th>
  348. </tr>
  349. </thead>
  350. <tbody>
  351. <tr>
  352. <td><code>.LT.</code> or <code>&lt;</code></td>
  353. <td>less than</td>
  354. </tr>
  355. <tr>
  356. <td><code>.LE.</code> or <code>&lt;=</code></td>
  357. <td>less than or equal to</td>
  358. </tr>
  359. <tr>
  360. <td><code>.EQ.</code> or <code>==</code></td>
  361. <td>equal to</td>
  362. </tr>
  363. <tr>
  364. <td><code>.NE.</code> or <code>/=</code></td>
  365. <td>not equal to</td>
  366. </tr>
  367. <tr>
  368. <td><code>.GT.</code> or <code>&gt;</code></td>
  369. <td>greater than</td>
  370. </tr>
  371. <tr>
  372. <td><code>.GE.</code> or <code>&gt;=</code></td>
  373. <td>greater than or equal to</td>
  374. </tr>
  375. </tbody>
  376. </table>
  377. <footer>09/11/2022 | Introduction to structured programming with Fortran</footer>
  378. </section>
  379. </foreignObject></svg><svg data-marpit-svg="" viewBox="0 0 1280 720"><foreignObject width="1280" height="720"><section id="24" data-background-image="url('assets/back.png')" data-footer="09/11/2022 | Introduction to structured programming with Fortran" data-paginate="true" data-theme="vnc6mvbjqstkhfawxx2h2q37lry3esagk64kvzu5xm" data-marpit-pagination="24" data-marpit-pagination-total="60" style="--background-image:url('assets/back.png');--footer:09/11/2022 | Introduction to structured programming with Fortran;--paginate:true;--theme:vnc6mvbjqstkhfawxx2h2q37lry3esagk64kvzu5xm;background-image:url('assets/back.png');background-position:center;background-repeat:no-repeat;background-size:cover;">
  380. <h1>Logical Expressions</h1>
  381. <p>Consists of one or more logical operators and logical, numeric or relational operands</p>
  382. <ul>
  383. <li>values are <code>.TRUE.</code> or <code>.FALSE.</code></li>
  384. <li>need to consider overall operator precedence</li>
  385. </ul>
  386. <blockquote>
  387. <p>can combine logical and integer data with logical operators but this is tricky (<strong>avoid!</strong>)</p>
  388. </blockquote>
  389. <footer>09/11/2022 | Introduction to structured programming with Fortran</footer>
  390. </section>
  391. </foreignObject></svg><svg data-marpit-svg="" viewBox="0 0 1280 720"><foreignObject width="1280" height="720"><section id="25" data-background-image="url('assets/back.png')" data-footer="09/11/2022 | Introduction to structured programming with Fortran" data-paginate="true" data-theme="vnc6mvbjqstkhfawxx2h2q37lry3esagk64kvzu5xm" data-marpit-pagination="25" data-marpit-pagination-total="60" style="--background-image:url('assets/back.png');--footer:09/11/2022 | Introduction to structured programming with Fortran;--paginate:true;--theme:vnc6mvbjqstkhfawxx2h2q37lry3esagk64kvzu5xm;background-image:url('assets/back.png');background-position:center;background-repeat:no-repeat;background-size:cover;">
  392. <h1>Logical Expressions</h1>
  393. <table>
  394. <thead>
  395. <tr>
  396. <th>F77 Operator</th>
  397. <th>&gt;F90 Operator</th>
  398. <th>Example</th>
  399. <th>Meaning</th>
  400. </tr>
  401. </thead>
  402. <tbody>
  403. <tr>
  404. <td><code>.AND.</code></td>
  405. <td><code>&amp;&amp;</code></td>
  406. <td><code>A .AND. B</code></td>
  407. <td>logical <code>AND</code></td>
  408. </tr>
  409. <tr>
  410. <td><code>.OR.</code></td>
  411. <td><code>||</code></td>
  412. <td><code>A .OR. B</code></td>
  413. <td>logical <code>OR</code></td>
  414. </tr>
  415. <tr>
  416. <td><code>.EQV.</code></td>
  417. <td><code>==</code></td>
  418. <td><code>A .EQV. B</code></td>
  419. <td>logical equivalence</td>
  420. </tr>
  421. <tr>
  422. <td><code>.NEQV.</code></td>
  423. <td><code>/=</code></td>
  424. <td><code>A .NEQV. B</code></td>
  425. <td>logical inequivalence</td>
  426. </tr>
  427. <tr>
  428. <td><code>.XOR.</code></td>
  429. <td><code>/=</code></td>
  430. <td><code>A .XOR. B</code></td>
  431. <td>exclusive <code>OR</code> (same as <code>.NEQV.</code>)</td>
  432. </tr>
  433. <tr>
  434. <td><code>.NOT.</code></td>
  435. <td><code>!</code></td>
  436. <td><code>.NOT. A</code></td>
  437. <td>logical negation</td>
  438. </tr>
  439. </tbody>
  440. </table>
  441. <footer>09/11/2022 | Introduction to structured programming with Fortran</footer>
  442. </section>
  443. </foreignObject></svg><svg data-marpit-svg="" viewBox="0 0 1280 720"><foreignObject width="1280" height="720"><section id="26" data-background-image="url('assets/back.png')" data-footer="09/11/2022 | Introduction to structured programming with Fortran" data-paginate="true" data-theme="vnc6mvbjqstkhfawxx2h2q37lry3esagk64kvzu5xm" data-marpit-pagination="26" data-marpit-pagination-total="60" style="--background-image:url('assets/back.png');--footer:09/11/2022 | Introduction to structured programming with Fortran;--paginate:true;--theme:vnc6mvbjqstkhfawxx2h2q37lry3esagk64kvzu5xm;background-image:url('assets/back.png');background-position:center;background-repeat:no-repeat;background-size:cover;">
  444. <h1>Arrays in FORTRAN</h1>
  445. <p>Arrays can be multi-dimensional (up to 7 in F77) and are indexed using <code>( )</code>:</p>
  446. <ul>
  447. <li><code>TEST(3)</code> or <code>FORCE(4,2)</code></li>
  448. </ul>
  449. <blockquote>
  450. <p>Indices are by default defined as <code>1...N</code></p>
  451. </blockquote>
  452. <p>We can specify index range in declaration</p>
  453. <ul>
  454. <li><code>INTEGER K(0:11)</code> : <code>K</code> is dimensioned from <code>0-11</code> (12 elements)</li>
  455. </ul>
  456. <p>Arrays are stored in column order (1st column, 2nd column, etc) so accessing by incrementing row index first usually is fastest</p>
  457. <p>Whole array reference (only in &gt;F90): <code>K(:)=-8</code> assigns 8 to all elements in K</p>
  458. <blockquote>
  459. <p>Avoid <code>K=-8</code> assignement</p>
  460. </blockquote>
  461. <footer>09/11/2022 | Introduction to structured programming with Fortran</footer>
  462. </section>
  463. </foreignObject></svg><svg data-marpit-svg="" viewBox="0 0 1280 720"><foreignObject width="1280" height="720"><section id="27" data-background-image="url('assets/back.png')" data-footer="09/11/2022 | Introduction to structured programming with Fortran" data-paginate="true" data-theme="vnc6mvbjqstkhfawxx2h2q37lry3esagk64kvzu5xm" data-marpit-pagination="27" data-marpit-pagination-total="60" style="--background-image:url('assets/back.png');--footer:09/11/2022 | Introduction to structured programming with Fortran;--paginate:true;--theme:vnc6mvbjqstkhfawxx2h2q37lry3esagk64kvzu5xm;background-image:url('assets/back.png');background-position:center;background-repeat:no-repeat;background-size:cover;">
  464. <h1>Unconditional <code>GO TO</code> in F77</h1>
  465. <p>This is the only GOTO in FORTRAN 77</p>
  466. <ul>
  467. <li>Syntax: <code>GO TO label</code></li>
  468. <li>Unconditional transfer to labeled statement</li>
  469. </ul>
  470. <pre><code class="language-fortran"><svg data-marp-fitting="svg" data-marp-fitting-code><foreignObject><span data-marp-fitting-svg-content><span data-marp-fitting-svg-content-wrap> <span class="hljs-number">10</span> -code-
  471. GO TO <span class="hljs-number">30</span>
  472. -code that is bypassed-
  473. <span class="hljs-number">30</span> -code that is <span class="hljs-keyword">target</span> of <span class="hljs-keyword">GOTO</span>-
  474. -more code-
  475. GO TO <span class="hljs-number">10</span>
  476. </span></span></foreignObject></svg></code></pre>
  477. <ul>
  478. <li><strong>Problem</strong> : leads to confusing <em>&quot;spaghetti code&quot;</em> <img class="emoji" draggable="false" alt="💥" src="https://twemoji.maxcdn.com/v/14.0.2/svg/1f4a5.svg" data-marp-twemoji=""/></li>
  479. </ul>
  480. <footer>09/11/2022 | Introduction to structured programming with Fortran</footer>
  481. </section>
  482. </foreignObject></svg><svg data-marpit-svg="" viewBox="0 0 1280 720"><foreignObject width="1280" height="720"><section id="28" data-background-image="url('assets/back.png')" data-footer="09/11/2022 | Introduction to structured programming with Fortran" data-paginate="true" data-theme="vnc6mvbjqstkhfawxx2h2q37lry3esagk64kvzu5xm" data-marpit-pagination="28" data-marpit-pagination-total="60" style="--background-image:url('assets/back.png');--footer:09/11/2022 | Introduction to structured programming with Fortran;--paginate:true;--theme:vnc6mvbjqstkhfawxx2h2q37lry3esagk64kvzu5xm;background-image:url('assets/back.png');background-position:center;background-repeat:no-repeat;background-size:cover;">
  483. <h1><code>IF ELSE IF</code> Statement</h1>
  484. <p>Basic version:</p>
  485. <pre><code class="language-fortran"><svg data-marp-fitting="svg" data-marp-fitting-code><foreignObject><span data-marp-fitting-svg-content><span data-marp-fitting-svg-content-wrap><span class="hljs-keyword">IF</span> (KSTAT.EQ<span class="hljs-number">.1</span>) <span class="hljs-keyword">THEN</span>
  486. <span class="hljs-keyword">CLASS</span>=<span class="hljs-string">&#x27;FRESHMAN&#x27;</span>
  487. <span class="hljs-keyword">ELSE</span> <span class="hljs-keyword">IF</span> (KSTAT.EQ<span class="hljs-number">.2</span>) <span class="hljs-keyword">THEN</span>
  488. <span class="hljs-keyword">CLASS</span>=<span class="hljs-string">&#x27;SOPHOMORE&#x27;</span>
  489. <span class="hljs-keyword">ELSE</span> <span class="hljs-keyword">IF</span> (KSTAT.EQ<span class="hljs-number">.3</span>) <span class="hljs-keyword">THEN</span>
  490. <span class="hljs-keyword">CLASS</span>=<span class="hljs-string">&#x27;JUNIOR&#x27;</span>
  491. <span class="hljs-keyword">ELSE</span> <span class="hljs-keyword">IF</span> (KSTAT.EQ<span class="hljs-number">.4</span>) <span class="hljs-keyword">THEN</span>
  492. <span class="hljs-keyword">CLASS</span>=<span class="hljs-string">&#x27;SENIOR&#x27;</span>
  493. <span class="hljs-keyword">ELSE</span>
  494. <span class="hljs-keyword">CLASS</span>=<span class="hljs-string">&#x27;UNKNOWN&#x27;</span>
  495. <span class="hljs-keyword">ENDIF</span>
  496. </span></span></foreignObject></svg></code></pre>
  497. <footer>09/11/2022 | Introduction to structured programming with Fortran</footer>
  498. </section>
  499. </foreignObject></svg><svg data-marpit-svg="" viewBox="0 0 1280 720"><foreignObject width="1280" height="720"><section id="29" data-background-image="url('assets/back.png')" data-footer="09/11/2022 | Introduction to structured programming with Fortran" data-paginate="true" data-theme="vnc6mvbjqstkhfawxx2h2q37lry3esagk64kvzu5xm" data-marpit-pagination="29" data-marpit-pagination-total="60" style="--background-image:url('assets/back.png');--footer:09/11/2022 | Introduction to structured programming with Fortran;--paginate:true;--theme:vnc6mvbjqstkhfawxx2h2q37lry3esagk64kvzu5xm;background-image:url('assets/back.png');background-position:center;background-repeat:no-repeat;background-size:cover;">
  500. <h1>Spaghetti Code in F77 (and before)</h1>
  501. <p>Use of <code>GO TO</code> and arithmetic <code>IF</code>'s leads to bad code that is very hard to maintain</p>
  502. <p>Here is the equivalent of an <code>IF-THEN-ELSE</code> statement:</p>
  503. <pre><code class="language-fortran"><svg data-marp-fitting="svg" data-marp-fitting-code><foreignObject><span data-marp-fitting-svg-content><span data-marp-fitting-svg-content-wrap> <span class="hljs-number">10</span> <span class="hljs-keyword">IF</span> (KEY.LT<span class="hljs-number">.0</span>) GO TO <span class="hljs-number">20</span>
  504. TEST=TEST-<span class="hljs-number">1</span>
  505. THETA=<span class="hljs-built_in">ATAN</span>(X,Y)
  506. GO TO <span class="hljs-number">30</span>
  507. <span class="hljs-number">20</span> TEST=TEST+<span class="hljs-number">1</span>
  508. THETA=<span class="hljs-built_in">ATAN</span>(-X,Y)
  509. <span class="hljs-number">30</span> <span class="hljs-keyword">CONTINUE</span>
  510. </span></span></foreignObject></svg></code></pre>
  511. <p>Now try to figure out what a complex <code>IF ELSE IF</code> statement would look like coded with this kind of simple <code>IF</code>...</p>
  512. <footer>09/11/2022 | Introduction to structured programming with Fortran</footer>
  513. </section>
  514. </foreignObject></svg><svg data-marpit-svg="" viewBox="0 0 1280 720"><foreignObject width="1280" height="720"><section id="30" data-background-image="url('assets/back.png')" data-footer="09/11/2022 | Introduction to structured programming with Fortran" data-paginate="true" data-theme="vnc6mvbjqstkhfawxx2h2q37lry3esagk64kvzu5xm" data-marpit-pagination="30" data-marpit-pagination-total="60" style="--background-image:url('assets/back.png');--footer:09/11/2022 | Introduction to structured programming with Fortran;--paginate:true;--theme:vnc6mvbjqstkhfawxx2h2q37lry3esagk64kvzu5xm;background-image:url('assets/back.png');background-position:center;background-repeat:no-repeat;background-size:cover;">
  515. <h1>Loop Statements (old versions)</h1>
  516. <p><code>DO</code> loop: structure that executes a specified number of times</p>
  517. <p><em>Spaghetti Code Version</em></p>
  518. <pre><code class="language-fortran"><svg data-marp-fitting="svg" data-marp-fitting-code><foreignObject><span data-marp-fitting-svg-content><span data-marp-fitting-svg-content-wrap> K=<span class="hljs-number">2</span>
  519. <span class="hljs-number">10</span> <span class="hljs-built_in">PRINT</span>*,A(K)
  520. K=K+<span class="hljs-number">2</span>
  521. <span class="hljs-keyword">IF</span> (K.LE<span class="hljs-number">.11</span>) GO TO <span class="hljs-number">10</span>
  522. <span class="hljs-number">20</span> <span class="hljs-keyword">CONTINUE</span>
  523. </span></span></foreignObject></svg></code></pre>
  524. <p><em>F77 Version</em></p>
  525. <pre><code class="language-fortran"><svg data-marp-fitting="svg" data-marp-fitting-code><foreignObject><span data-marp-fitting-svg-content><span data-marp-fitting-svg-content-wrap> <span class="hljs-keyword">DO</span> <span class="hljs-number">100</span> K=<span class="hljs-number">2</span>,<span class="hljs-number">10</span>,<span class="hljs-number">2</span>
  526. <span class="hljs-built_in">PRINT</span>*,A(K)
  527. <span class="hljs-number">100</span> <span class="hljs-keyword">CONTINUE</span>
  528. </span></span></foreignObject></svg></code></pre>
  529. <footer>09/11/2022 | Introduction to structured programming with Fortran</footer>
  530. </section>
  531. </foreignObject></svg><svg data-marpit-svg="" viewBox="0 0 1280 720"><foreignObject width="1280" height="720"><section id="31" data-background-image="url('assets/back.png')" data-footer="09/11/2022 | Introduction to structured programming with Fortran" data-paginate="true" data-theme="vnc6mvbjqstkhfawxx2h2q37lry3esagk64kvzu5xm" data-marpit-pagination="31" data-marpit-pagination-total="60" style="--background-image:url('assets/back.png');--footer:09/11/2022 | Introduction to structured programming with Fortran;--paginate:true;--theme:vnc6mvbjqstkhfawxx2h2q37lry3esagk64kvzu5xm;background-image:url('assets/back.png');background-position:center;background-repeat:no-repeat;background-size:cover;">
  532. <h1>Loop Statements (&gt;F90)</h1>
  533. <pre><code class="language-fortran"><svg data-marp-fitting="svg" data-marp-fitting-code><foreignObject><span data-marp-fitting-svg-content><span data-marp-fitting-svg-content-wrap><span class="hljs-keyword">DO</span> K=<span class="hljs-number">2</span>,<span class="hljs-number">10</span>,<span class="hljs-number">2</span>
  534. <span class="hljs-built_in">WRITE</span>(*,*) A(K)
  535. <span class="hljs-keyword">END</span> <span class="hljs-keyword">DO</span>
  536. </span></span></foreignObject></svg></code></pre>
  537. <ul>
  538. <li>Loop _control can include variables and a third parameter to specify increments, including negative values</li>
  539. <li>Loop always executes ONCE before testing for end condition</li>
  540. </ul>
  541. <pre><code class="language-fortran"><svg data-marp-fitting="svg" data-marp-fitting-code><foreignObject><span data-marp-fitting-svg-content><span data-marp-fitting-svg-content-wrap>READ(*,*) R
  542. <span class="hljs-keyword">DO</span> <span class="hljs-keyword">WHILE</span> (R.GE<span class="hljs-number">.0</span>)
  543. VOL=<span class="hljs-number">2</span>*PI*R**<span class="hljs-number">2</span>*CLEN
  544. READ(*,*) R
  545. <span class="hljs-keyword">END</span> <span class="hljs-keyword">DO</span>
  546. </span></span></foreignObject></svg></code></pre>
  547. <ul>
  548. <li>Loop will not execute at all if logical_expr is not true at start</li>
  549. </ul>
  550. <footer>09/11/2022 | Introduction to structured programming with Fortran</footer>
  551. </section>
  552. </foreignObject></svg><svg data-marpit-svg="" viewBox="0 0 1280 720"><foreignObject width="1280" height="720"><section id="32" data-background-image="url('assets/back.png')" data-footer="09/11/2022 | Introduction to structured programming with Fortran" data-paginate="true" data-theme="vnc6mvbjqstkhfawxx2h2q37lry3esagk64kvzu5xm" data-marpit-pagination="32" data-marpit-pagination-total="60" style="--background-image:url('assets/back.png');--footer:09/11/2022 | Introduction to structured programming with Fortran;--paginate:true;--theme:vnc6mvbjqstkhfawxx2h2q37lry3esagk64kvzu5xm;background-image:url('assets/back.png');background-position:center;background-repeat:no-repeat;background-size:cover;">
  553. <h1>Comments on Loop Statements</h1>
  554. <p>In old versions:</p>
  555. <ul>
  556. <li>to transfer out (exit loop), use a <code>GO TO</code></li>
  557. <li>to skip to next loop, use <code>GO TO</code> terminating statement (this is a good reason to always make this a <code>CONTINUE</code> statement)</li>
  558. </ul>
  559. <p>In new versions:</p>
  560. <ul>
  561. <li>to transfer out (exit loop), use <code>EXIT</code> statement and control is transferred to statement following loop end. This means you cannot transfer out of multiple nested loops with a single <code>EXIT</code> statement (use named loops if needed - <code>myloop : do i=1,n</code>). This is much like a <code>BREAK</code> statement in other languages.</li>
  562. <li>to skip to next loop cycle, use <code>CYCLE</code> statement in loop.</li>
  563. </ul>
  564. <footer>09/11/2022 | Introduction to structured programming with Fortran</footer>
  565. </section>
  566. </foreignObject></svg><svg data-marpit-svg="" viewBox="0 0 1280 720"><foreignObject width="1280" height="720"><section id="33" data-background-image="url('assets/back.png')" data-footer="09/11/2022 | Introduction to structured programming with Fortran" data-paginate="true" data-theme="vnc6mvbjqstkhfawxx2h2q37lry3esagk64kvzu5xm" data-marpit-pagination="33" data-marpit-pagination-total="60" style="--background-image:url('assets/back.png');--footer:09/11/2022 | Introduction to structured programming with Fortran;--paginate:true;--theme:vnc6mvbjqstkhfawxx2h2q37lry3esagk64kvzu5xm;background-image:url('assets/back.png');background-position:center;background-repeat:no-repeat;background-size:cover;">
  567. <h1>File-Directed Input and Output</h1>
  568. <p>Much of early FORTRAN was devoted to reading input data<br />
  569. from Cards and writing to a line printer</p>
  570. <p>Today, most I/O is to and from a file: it requires more extensive I/O capabilities standardized until FORTRAN 77</p>
  571. <p><strong>I/O</strong> = communication between a program and the outside world</p>
  572. <ul>
  573. <li>opening and closing a file with <code>OPEN</code> &amp; <code>CLOSE</code></li>
  574. <li>data reading &amp; writing with <code>READ</code> &amp; <code>WRITE</code></li>
  575. <li>can use <strong>unformatted</strong> <code>READ</code> &amp; <code>WRITE</code> if no human readable data are involved (much faster access, smaller files)</li>
  576. </ul>
  577. <footer>09/11/2022 | Introduction to structured programming with Fortran</footer>
  578. </section>
  579. </foreignObject></svg><svg data-marpit-svg="" viewBox="0 0 1280 720"><foreignObject width="1280" height="720"><section id="34" data-background-image="url('assets/back.png')" data-footer="09/11/2022 | Introduction to structured programming with Fortran" data-paginate="true" data-theme="vnc6mvbjqstkhfawxx2h2q37lry3esagk64kvzu5xm" data-marpit-pagination="34" data-marpit-pagination-total="60" style="--background-image:url('assets/back.png');--footer:09/11/2022 | Introduction to structured programming with Fortran;--paginate:true;--theme:vnc6mvbjqstkhfawxx2h2q37lry3esagk64kvzu5xm;background-image:url('assets/back.png');background-position:center;background-repeat:no-repeat;background-size:cover;">
  580. <h1><code>OPEN</code> &amp; <code>CLOSE</code> example</h1>
  581. <p>Once opened, file is referred to by an assigned device number (a unique id)</p>
  582. <pre><code class="language-fortran"><svg data-marp-fitting="svg" data-marp-fitting-code><foreignObject><span data-marp-fitting-svg-content><span data-marp-fitting-svg-content-wrap><span class="hljs-keyword">character</span>(len=*) :: x_name
  583. <span class="hljs-keyword">integer</span> :: ierr, iSize, guess_unit
  584. <span class="hljs-keyword">logical</span> :: itsopen, itexists
  585. <span class="hljs-comment">!</span>
  586. inquire(<span class="hljs-keyword">file</span>=<span class="hljs-built_in">trim</span>(x_name), <span class="hljs-built_in">size</span>=iSize, <span class="hljs-keyword">number</span>=guess_unit, <span class="hljs-keyword">opened</span>=itsopen, <span class="hljs-keyword">exist</span>=itexists)
  587. <span class="hljs-keyword">if</span> ( itsopen ) close(guess_unit, <span class="hljs-keyword">status</span>=<span class="hljs-string">&#x27;delete&#x27;</span>)
  588. <span class="hljs-comment">!</span>
  589. open(<span class="hljs-number">902</span>,<span class="hljs-keyword">file</span>=<span class="hljs-built_in">trim</span>(x_name),<span class="hljs-keyword">status</span>=<span class="hljs-string">&#x27;new&#x27;</span>,<span class="hljs-keyword">iostat</span>=ierr)
  590. <span class="hljs-comment">!</span>
  591. <span class="hljs-keyword">if</span> (iSize &lt;= <span class="hljs-number">0</span> .OR. .NOT.itexists) <span class="hljs-keyword">then</span>
  592. open(<span class="hljs-number">902</span>,<span class="hljs-keyword">file</span>=<span class="hljs-built_in">trim</span>(x_name),<span class="hljs-keyword">status</span>=<span class="hljs-string">&#x27;new&#x27;</span>,<span class="hljs-keyword">iostat</span>=ierr)
  593. <span class="hljs-keyword">if</span> (ierr /= <span class="hljs-number">0</span>) <span class="hljs-keyword">then</span>
  594. ...
  595. close(<span class="hljs-number">902</span>)
  596. <span class="hljs-keyword">endif</span>
  597. ...
  598. <span class="hljs-keyword">endif</span>
  599. </span></span></foreignObject></svg></code></pre>
  600. <footer>09/11/2022 | Introduction to structured programming with Fortran</footer>
  601. </section>
  602. </foreignObject></svg><svg data-marpit-svg="" viewBox="0 0 1280 720"><foreignObject width="1280" height="720"><section id="35" data-background-image="url('assets/back.png')" data-footer="09/11/2022 | Introduction to structured programming with Fortran" data-paginate="true" data-theme="vnc6mvbjqstkhfawxx2h2q37lry3esagk64kvzu5xm" data-marpit-pagination="35" data-marpit-pagination-total="60" style="--background-image:url('assets/back.png');--footer:09/11/2022 | Introduction to structured programming with Fortran;--paginate:true;--theme:vnc6mvbjqstkhfawxx2h2q37lry3esagk64kvzu5xm;background-image:url('assets/back.png');background-position:center;background-repeat:no-repeat;background-size:cover;">
  603. <h1><code>READ</code> Statement</h1>
  604. <ul>
  605. <li>syntax: <code>READ(dev_no, format_label) variable_list</code></li>
  606. <li>read a record from <code>dev_no</code> using <code>format_label</code> and assign results to variables in <code>variable_list</code></li>
  607. </ul>
  608. <pre><code class="language-fortran"><svg data-marp-fitting="svg" data-marp-fitting-code><foreignObject><span data-marp-fitting-svg-content><span data-marp-fitting-svg-content-wrap> READ(<span class="hljs-number">105</span>,<span class="hljs-number">1000</span>) A,B,C
  609. <span class="hljs-number">1000</span> <span class="hljs-keyword">FORMAT</span>(<span class="hljs-number">3</span>F12<span class="hljs-number">.4</span>)
  610. </span></span></foreignObject></svg></code></pre>
  611. <blockquote>
  612. <p>device numbers 1-7 are defined as standard I/O devices</p>
  613. </blockquote>
  614. <ul>
  615. <li>each <code>READ</code> reads one or more lines of data and any remaining data in a line that is read is dropped if not translated to one of the variables in the <code>variable_list</code></li>
  616. <li><code>variable_list</code> can include implied <code>DO</code> such as: <code>READ(105,1000)(A(I),I=1,10)</code></li>
  617. </ul>
  618. <footer>09/11/2022 | Introduction to structured programming with Fortran</footer>
  619. </section>
  620. </foreignObject></svg><svg data-marpit-svg="" viewBox="0 0 1280 720"><foreignObject width="1280" height="720"><section id="36" data-background-image="url('assets/back.png')" data-footer="09/11/2022 | Introduction to structured programming with Fortran" data-paginate="true" data-theme="vnc6mvbjqstkhfawxx2h2q37lry3esagk64kvzu5xm" data-marpit-pagination="36" data-marpit-pagination-total="60" style="--background-image:url('assets/back.png');--footer:09/11/2022 | Introduction to structured programming with Fortran;--paginate:true;--theme:vnc6mvbjqstkhfawxx2h2q37lry3esagk64kvzu5xm;background-image:url('assets/back.png');background-position:center;background-repeat:no-repeat;background-size:cover;">
  621. <h1><code>READ</code> Statement - cont'd</h1>
  622. <ul>
  623. <li>input items can be integer, real or character</li>
  624. <li>characters must be enclosed in <code>' '</code></li>
  625. <li>input items are separated by commas</li>
  626. <li>input items must agree in type with variables in <code>variable_list</code></li>
  627. <li>each <code>READ</code> processes a new record (line)</li>
  628. </ul>
  629. <pre><code class="language-fortran"><svg data-marp-fitting="svg" data-marp-fitting-code><foreignObject><span data-marp-fitting-svg-content><span data-marp-fitting-svg-content-wrap><span class="hljs-keyword">INTEGER</span> K
  630. <span class="hljs-keyword">REAL</span>(<span class="hljs-number">8</span>) A,B
  631. OPEN(<span class="hljs-number">105</span>,<span class="hljs-keyword">FILE</span>=<span class="hljs-string">&#x27;path_to_existing_file&#x27;</span>)
  632. READ(<span class="hljs-number">105</span>,*) A,B,K
  633. </span></span></foreignObject></svg></code></pre>
  634. <blockquote>
  635. <p>read one line and look for floating point values for A and B and an integer for K</p>
  636. </blockquote>
  637. <footer>09/11/2022 | Introduction to structured programming with Fortran</footer>
  638. </section>
  639. </foreignObject></svg><svg data-marpit-svg="" viewBox="0 0 1280 720"><foreignObject width="1280" height="720"><section id="37" data-background-image="url('assets/back.png')" data-paginate="true" data-theme="vnc6mvbjqstkhfawxx2h2q37lry3esagk64kvzu5xm" data-marpit-pagination="37" data-marpit-pagination-total="60" style="--background-image:url('assets/back.png');--paginate:true;--theme:vnc6mvbjqstkhfawxx2h2q37lry3esagk64kvzu5xm;background-image:url('assets/back.png');background-position:center;background-repeat:no-repeat;background-size:cover;">
  640. <h1><code>WRITE</code> Statement</h1>
  641. <ul>
  642. <li>syntax: <code>WRITE(dev_no, format_label) variable_list</code></li>
  643. <li>write variables in <code>variable_list</code> to output <code>dev_no</code> using format specified in format statement with <code>format_label</code></li>
  644. </ul>
  645. <pre><code class="language-fortran"><svg data-marp-fitting="svg" data-marp-fitting-code><foreignObject><span data-marp-fitting-svg-content><span data-marp-fitting-svg-content-wrap> <span class="hljs-built_in">WRITE</span>(*,<span class="hljs-number">1000</span>) A,B,KEY
  646. <span class="hljs-number">1000</span> <span class="hljs-keyword">FORMAT</span>(F12<span class="hljs-number">.4</span>,E14<span class="hljs-number">.5</span>,I6)
  647. </span></span></foreignObject></svg></code></pre>
  648. <pre><code class="language-fortran"><svg data-marp-fitting="svg" data-marp-fitting-code><foreignObject><span data-marp-fitting-svg-content><span data-marp-fitting-svg-content-wrap>|----+----o----+----o----+----o----+----|
  649. <span class="hljs-number">1234.5678</span> -<span class="hljs-number">0.12345E+02</span> <span class="hljs-number">12</span>
  650. </span></span></foreignObject></svg></code></pre>
  651. <ul>
  652. <li>device number <code>*</code> is by default the screen (or <em>standard output</em> - also 6)</li>
  653. <li>each <code>WRITE</code> produces one or more output lines as needed to write out <code>variable_list</code> using <code>format</code> statement</li>
  654. <li><code>variable_list</code> can include implied <code>DO</code> such as: <code>WRITE(*,2000)(A(I),I=1,10)</code></li>
  655. </ul>
  656. </section>
  657. </foreignObject></svg><svg data-marpit-svg="" viewBox="0 0 1280 720"><foreignObject width="1280" height="720"><section id="38" data-background-image="url('assets/back.png')" data-footer="09/11/2022 | Introduction to structured programming with Fortran" data-paginate="true" data-theme="vnc6mvbjqstkhfawxx2h2q37lry3esagk64kvzu5xm" data-marpit-pagination="38" data-marpit-pagination-total="60" style="--background-image:url('assets/back.png');--footer:09/11/2022 | Introduction to structured programming with Fortran;--paginate:true;--theme:vnc6mvbjqstkhfawxx2h2q37lry3esagk64kvzu5xm;background-image:url('assets/back.png');background-position:center;background-repeat:no-repeat;background-size:cover;">
  658. <h1><code>FORMAT</code> Statement</h1>
  659. <table>
  660. <thead>
  661. <tr>
  662. <th>data type</th>
  663. <th>format descriptors</th>
  664. <th>example</th>
  665. </tr>
  666. </thead>
  667. <tbody>
  668. <tr>
  669. <td><code>integer</code></td>
  670. <td><code>iw</code></td>
  671. <td><code>write(*,'(i5)') int</code></td>
  672. </tr>
  673. <tr>
  674. <td><code>real</code> (<em>decimal</em>)</td>
  675. <td><code>fw.d</code></td>
  676. <td><code>write(*,'(f7.4)') x</code></td>
  677. </tr>
  678. <tr>
  679. <td><code>real</code> (<em>exponential</em>)</td>
  680. <td><code>ew.d</code></td>
  681. <td><code>write(*,'(e12.3)') y</code></td>
  682. </tr>
  683. <tr>
  684. <td><code>character</code></td>
  685. <td><code>a, aw</code></td>
  686. <td><code>write(*,'(a)') string</code></td>
  687. </tr>
  688. <tr>
  689. <td><code>logical</code></td>
  690. <td><code>lw</code></td>
  691. <td><code>write(*,'(l2)') test</code></td>
  692. </tr>
  693. <tr>
  694. <td>spaces &amp; tabs</td>
  695. <td><code>wx</code> &amp; <code>tw</code></td>
  696. <td><code>write (*,'(i3,2x,f6.3)') i, x</code></td>
  697. </tr>
  698. <tr>
  699. <td>linebreak</td>
  700. <td><code>/</code></td>
  701. <td><code>write (*,'(f6.3,/,f6.3)') x, y</code></td>
  702. </tr>
  703. </tbody>
  704. </table>
  705. <footer>09/11/2022 | Introduction to structured programming with Fortran</footer>
  706. </section>
  707. </foreignObject></svg><svg data-marpit-svg="" viewBox="0 0 1280 720"><foreignObject width="1280" height="720"><section id="39" data-background-image="url('assets/back.png')" data-paginate="true" data-theme="vnc6mvbjqstkhfawxx2h2q37lry3esagk64kvzu5xm" data-marpit-pagination="39" data-marpit-pagination-total="60" style="--background-image:url('assets/back.png');--paginate:true;--theme:vnc6mvbjqstkhfawxx2h2q37lry3esagk64kvzu5xm;background-image:url('assets/back.png');background-position:center;background-repeat:no-repeat;background-size:cover;">
  708. <h1><code>NAMELIST</code></h1>
  709. <p>It is possible to pre-define the structure of input and output data using <code>NAMELIST</code> in order to make it easier to process with <code>READ</code> and <code>WRITE</code> statements</p>
  710. <ul>
  711. <li>Use <code>NAMELIST</code> to define the data structure</li>
  712. <li>Use <code>READ</code> or <code>WRITE</code> with reference to <code>NAMELIST</code> to handle the data in the specified format</li>
  713. </ul>
  714. <blockquote>
  715. <p>This is not part of standard F77 but it is included in &gt;F90</p>
  716. </blockquote>
  717. <p>On input, the <code>NAMELIST</code> data must be structured as follows:</p>
  718. <pre><code class="language-fortran"><svg data-marp-fitting="svg" data-marp-fitting-code><foreignObject><span data-marp-fitting-svg-content><span data-marp-fitting-svg-content-wrap>&amp;INPUT
  719. THICK=<span class="hljs-number">0.245</span>,
  720. LENGTH=<span class="hljs-number">12.34</span>,
  721. WIDTH=<span class="hljs-number">2.34</span>,
  722. DENSITY=<span class="hljs-number">0.0034</span>
  723. /
  724. </span></span></foreignObject></svg></code></pre>
  725. </section>
  726. </foreignObject></svg><svg data-marpit-svg="" viewBox="0 0 1280 720"><foreignObject width="1280" height="720"><section id="40" data-background-image="url('assets/back.png')" data-footer="09/11/2022 | Introduction to structured programming with Fortran" data-paginate="true" data-theme="vnc6mvbjqstkhfawxx2h2q37lry3esagk64kvzu5xm" data-marpit-pagination="40" data-marpit-pagination-total="60" style="--background-image:url('assets/back.png');--footer:09/11/2022 | Introduction to structured programming with Fortran;--paginate:true;--theme:vnc6mvbjqstkhfawxx2h2q37lry3esagk64kvzu5xm;background-image:url('assets/back.png');background-position:center;background-repeat:no-repeat;background-size:cover;">
  727. <h1>Internal <code>WRITE</code> Statement</h1>
  728. <p>Internal <code>WRITE</code> does same as <code>ENCODE</code> in F77 : <strong>a cast to string</strong></p>
  729. <blockquote>
  730. <p><code>WRITE (dev_no, format_label) var_list</code><br />
  731. write variables in <code>var_list</code> to internal storage defined by character variable used as <code>dev_no</code> = default character variable (not an array)</p>
  732. </blockquote>
  733. <pre><code class="language-fortran"><svg data-marp-fitting="svg" data-marp-fitting-code><foreignObject><span data-marp-fitting-svg-content><span data-marp-fitting-svg-content-wrap><span class="hljs-keyword">INTEGER</span>*<span class="hljs-number">4</span> J,K
  734. <span class="hljs-keyword">CHARACTER</span>*<span class="hljs-number">50</span> CHAR50
  735. <span class="hljs-keyword">DATA</span> J,K/<span class="hljs-number">1</span>,<span class="hljs-number">2</span>/
  736. ...
  737. <span class="hljs-built_in">WRITE</span>(CHAR50,*) J,K
  738. </span></span></foreignObject></svg></code></pre>
  739. <p>Results:</p>
  740. <pre><code class="language-fortran"><svg data-marp-fitting="svg" data-marp-fitting-code><foreignObject><span data-marp-fitting-svg-content><span data-marp-fitting-svg-content-wrap>CHAR50=<span class="hljs-string">&#x27; 1 2&#x27;</span>
  741. </span></span></foreignObject></svg></code></pre>
  742. <footer>09/11/2022 | Introduction to structured programming with Fortran</footer>
  743. </section>
  744. </foreignObject></svg><svg data-marpit-svg="" viewBox="0 0 1280 720"><foreignObject width="1280" height="720"><section id="41" data-background-image="url('assets/back.png')" data-paginate="true" data-theme="vnc6mvbjqstkhfawxx2h2q37lry3esagk64kvzu5xm" data-marpit-pagination="41" data-marpit-pagination-total="60" style="--background-image:url('assets/back.png');--paginate:true;--theme:vnc6mvbjqstkhfawxx2h2q37lry3esagk64kvzu5xm;background-image:url('assets/back.png');background-position:center;background-repeat:no-repeat;background-size:cover;">
  745. <h1>Internal <code>READ</code> Statement</h1>
  746. <p>Internal <code>READ</code> does same as <code>DECODE</code> in F77 : <strong>a cast from string</strong></p>
  747. <blockquote>
  748. <p><code>READ (dev_no, format_label) var_list</code><br />
  749. read variables from internal storage specified by character variable used as <code>dev_no</code> = default character variable (not an array)</p>
  750. </blockquote>
  751. <pre><code class="language-fortran"><svg data-marp-fitting="svg" data-marp-fitting-code><foreignObject><span data-marp-fitting-svg-content><span data-marp-fitting-svg-content-wrap><span class="hljs-keyword">INTEGER</span> K
  752. <span class="hljs-keyword">REAL</span> A,B
  753. <span class="hljs-keyword">CHARACTER</span>*<span class="hljs-number">80</span> REC80
  754. <span class="hljs-keyword">DATA</span> REC80/<span class="hljs-string">&#x27;1.2, 2.3, -5&#x27;</span>/
  755. ...
  756. READ(REC80,*) A,B,K
  757. </span></span></foreignObject></svg></code></pre>
  758. <p>Results:</p>
  759. <pre><code class="language-fortran"><svg data-marp-fitting="svg" data-marp-fitting-code><foreignObject><span data-marp-fitting-svg-content><span data-marp-fitting-svg-content-wrap>A=<span class="hljs-number">1.2</span>, B=<span class="hljs-number">2.3</span>, K=-<span class="hljs-number">5</span>
  760. </span></span></foreignObject></svg></code></pre>
  761. </section>
  762. </foreignObject></svg><svg data-marpit-svg="" viewBox="0 0 1280 720"><foreignObject width="1280" height="720"><section id="42" data-background-image="url('assets/back.png')" data-footer="09/11/2022 | Introduction to structured programming with Fortran" data-paginate="true" data-theme="vnc6mvbjqstkhfawxx2h2q37lry3esagk64kvzu5xm" data-marpit-pagination="42" data-marpit-pagination-total="60" style="--background-image:url('assets/back.png');--footer:09/11/2022 | Introduction to structured programming with Fortran;--paginate:true;--theme:vnc6mvbjqstkhfawxx2h2q37lry3esagk64kvzu5xm;background-image:url('assets/back.png');background-position:center;background-repeat:no-repeat;background-size:cover;">
  763. <h1>Structured programming</h1>
  764. <p>Structured programming is based on subprograms (functions and subroutines) and control statements (like <code>IF</code> statements or loops) :</p>
  765. <ul>
  766. <li>structure the control-flow of your programs (eg, give up the <code>GO TO</code>)</li>
  767. <li>improved readability</li>
  768. <li>lower level aspect of coding in a smart way</li>
  769. </ul>
  770. <p>It is a <strong>programming paradigm</strong> aimed at improving the quality, clarity, and access time of a computer program</p>
  771. <footer>09/11/2022 | Introduction to structured programming with Fortran</footer>
  772. </section>
  773. </foreignObject></svg><svg data-marpit-svg="" viewBox="0 0 1280 720"><foreignObject width="1280" height="720"><section id="43" data-background-image="url('assets/back.png')" data-paginate="true" data-theme="vnc6mvbjqstkhfawxx2h2q37lry3esagk64kvzu5xm" data-marpit-pagination="43" data-marpit-pagination-total="60" style="--background-image:url('assets/back.png');--paginate:true;--theme:vnc6mvbjqstkhfawxx2h2q37lry3esagk64kvzu5xm;background-image:url('assets/back.png');background-position:center;background-repeat:no-repeat;background-size:cover;">
  774. <h1>Functions and Subroutines</h1>
  775. <p><code>FUNCTION</code> &amp; <code>SUBROUTINE</code> are subprograms that allow structured coding</p>
  776. <ul>
  777. <li><code>FUNCTION</code>: returns a single explicit function value for given function arguments<br />
  778. It’s also a variable → so must be declared !</li>
  779. <li><code>SUBROUTINE</code>: any values returned must be returned through the arguments (no explicit subroutine value is returned)</li>
  780. <li>functions and subroutines are <strong>not recursive in F77</strong></li>
  781. </ul>
  782. <p>Subprograms use a separate namespace for each subprogram so that variables are local to the subprogram</p>
  783. <ul>
  784. <li>variables are passed to subprogram through argument list and returned in function value or through arguments</li>
  785. <li>variables stored in <code>COMMON</code> may be shared between namespaces</li>
  786. </ul>
  787. </section>
  788. </foreignObject></svg><svg data-marpit-svg="" viewBox="0 0 1280 720"><foreignObject width="1280" height="720"><section id="44" data-background-image="url('assets/back.png')" data-footer="09/11/2022 | Introduction to structured programming with Fortran" data-paginate="true" data-theme="vnc6mvbjqstkhfawxx2h2q37lry3esagk64kvzu5xm" data-marpit-pagination="44" data-marpit-pagination-total="60" style="--background-image:url('assets/back.png');--footer:09/11/2022 | Introduction to structured programming with Fortran;--paginate:true;--theme:vnc6mvbjqstkhfawxx2h2q37lry3esagk64kvzu5xm;background-image:url('assets/back.png');background-position:center;background-repeat:no-repeat;background-size:cover;">
  789. <h1>Functions and Subroutines - cont'd</h1>
  790. <p>Subprograms must include at least one <code>RETURN</code> (can have more) and be terminated by an <code>END</code> statement</p>
  791. <p><code>FUNCTION</code> example:</p>
  792. <pre><code class="language-fortran"><svg data-marp-fitting="svg" data-marp-fitting-code><foreignObject><span data-marp-fitting-svg-content><span data-marp-fitting-svg-content-wrap><span class="hljs-keyword">REAL</span> <span class="hljs-function"><span class="hljs-keyword">FUNCTION</span></span> AVG3(A,B,C)
  793. AVG3=(A+B+C)/<span class="hljs-number">3</span>
  794. <span class="hljs-keyword">RETURN</span>
  795. <span class="hljs-keyword">END</span>
  796. </span></span></foreignObject></svg></code></pre>
  797. <p>Use:</p>
  798. <pre><code class="language-fortran"><svg data-marp-fitting="svg" data-marp-fitting-code><foreignObject><span data-marp-fitting-svg-content><span data-marp-fitting-svg-content-wrap>AV = WEIGHT*AVG3(A1,F2,B2)
  799. </span></span></foreignObject></svg></code></pre>
  800. <blockquote>
  801. <p><code>FUNCTION</code> type is implicitly defined as REAL</p>
  802. </blockquote>
  803. <footer>09/11/2022 | Introduction to structured programming with Fortran</footer>
  804. </section>
  805. </foreignObject></svg><svg data-marpit-svg="" viewBox="0 0 1280 720"><foreignObject width="1280" height="720"><section id="45" data-background-image="url('assets/back.png')" data-footer="09/11/2022 | Introduction to structured programming with Fortran" data-paginate="true" data-theme="vnc6mvbjqstkhfawxx2h2q37lry3esagk64kvzu5xm" data-marpit-pagination="45" data-marpit-pagination-total="60" style="--background-image:url('assets/back.png');--footer:09/11/2022 | Introduction to structured programming with Fortran;--paginate:true;--theme:vnc6mvbjqstkhfawxx2h2q37lry3esagk64kvzu5xm;background-image:url('assets/back.png');background-position:center;background-repeat:no-repeat;background-size:cover;">
  806. <h1>Functions and Subroutines - cont'd</h1>
  807. <p>Subroutine is invoked using the <code>CALL</code> statement</p>
  808. <p><code>SUBROUTINE</code> example:</p>
  809. <pre><code class="language-fortran"><svg data-marp-fitting="svg" data-marp-fitting-code><foreignObject><span data-marp-fitting-svg-content><span data-marp-fitting-svg-content-wrap><span class="hljs-function"><span class="hljs-keyword">SUBROUTINE</span></span> AVG3S(A,B,C,AVERAGE)
  810. AVERAGE=(A+B+C)/<span class="hljs-number">3</span>
  811. <span class="hljs-keyword">RETURN</span>
  812. <span class="hljs-keyword">END</span>
  813. </span></span></foreignObject></svg></code></pre>
  814. <p>Use:</p>
  815. <pre><code class="language-fortran"><svg data-marp-fitting="svg" data-marp-fitting-code><foreignObject><span data-marp-fitting-svg-content><span data-marp-fitting-svg-content-wrap><span class="hljs-keyword">CALL</span> AVG3S(A1,F2,B2,AVR)
  816. RESULT = WEIGHT*AVR
  817. </span></span></foreignObject></svg></code></pre>
  818. <blockquote>
  819. <p>any returned values must be returned through argument list</p>
  820. </blockquote>
  821. <footer>09/11/2022 | Introduction to structured programming with Fortran</footer>
  822. </section>
  823. </foreignObject></svg><svg data-marpit-svg="" viewBox="0 0 1280 720"><foreignObject width="1280" height="720"><section id="46" data-background-image="url('assets/back.png')" data-footer="09/11/2022 | Introduction to structured programming with Fortran" data-paginate="true" data-theme="vnc6mvbjqstkhfawxx2h2q37lry3esagk64kvzu5xm" data-marpit-pagination="46" data-marpit-pagination-total="60" style="--background-image:url('assets/back.png');--footer:09/11/2022 | Introduction to structured programming with Fortran;--paginate:true;--theme:vnc6mvbjqstkhfawxx2h2q37lry3esagk64kvzu5xm;background-image:url('assets/back.png');background-position:center;background-repeat:no-repeat;background-size:cover;">
  824. <h1>Arguments</h1>
  825. <p>Arguments in subprogram are <code>dummy</code> arguments used in place of the real arguments</p>
  826. <ul>
  827. <li>arguments are passed by <strong>reference</strong> (memory address) if given as <em>symbolic</em><br />
  828. the subprogram can then alter the actual argument value since it can access it by reference</li>
  829. <li>arguments are passed by <strong>value</strong> if given as <em>literal</em> (so cannot be modified)</li>
  830. </ul>
  831. <pre><code class="language-fortran"><svg data-marp-fitting="svg" data-marp-fitting-code><foreignObject><span data-marp-fitting-svg-content><span data-marp-fitting-svg-content-wrap><span class="hljs-keyword">CALL</span> AVG3S(A1,<span class="hljs-number">3.4</span>,C1,QAV)
  832. </span></span></foreignObject></svg></code></pre>
  833. <blockquote>
  834. <p>2nd argument is passed by value - QAV contains result</p>
  835. </blockquote>
  836. <pre><code class="language-fortran"><svg data-marp-fitting="svg" data-marp-fitting-code><foreignObject><span data-marp-fitting-svg-content><span data-marp-fitting-svg-content-wrap><span class="hljs-keyword">CALL</span> AVG3S(A,C,B,<span class="hljs-number">4.1</span>)
  837. </span></span></foreignObject></svg></code></pre>
  838. <blockquote>
  839. <p>no return value is available since &quot;4.1&quot; is a value and not a reference to a variable!</p>
  840. </blockquote>
  841. <footer>09/11/2022 | Introduction to structured programming with Fortran</footer>
  842. </section>
  843. </foreignObject></svg><svg data-marpit-svg="" viewBox="0 0 1280 720"><foreignObject width="1280" height="720"><section id="47" data-background-image="url('assets/back.png')" data-footer="09/11/2022 | Introduction to structured programming with Fortran" data-paginate="true" data-theme="vnc6mvbjqstkhfawxx2h2q37lry3esagk64kvzu5xm" data-marpit-pagination="47" data-marpit-pagination-total="60" style="--background-image:url('assets/back.png');--footer:09/11/2022 | Introduction to structured programming with Fortran;--paginate:true;--theme:vnc6mvbjqstkhfawxx2h2q37lry3esagk64kvzu5xm;background-image:url('assets/back.png');background-position:center;background-repeat:no-repeat;background-size:cover;">
  844. <h1>Arguments - cont'd</h1>
  845. <ul>
  846. <li><code>dummy</code> arguments appearing in a subprogram declaration cannot be an individual array element reference, e.g., <code>A(2)</code>, or a <em>literal</em>, for obvious reasons!</li>
  847. <li>arguments used in invocation (by calling program) may be <em>variables</em>, <em>subscripted variables</em>, <em>array names</em>, <em>literals</em>, <em>expressions</em> or <em>function names</em></li>
  848. <li>using symbolic arguments (variables or array names) is the <strong>only way</strong> to return a value (result) from a <code>SUBROUTINE</code></li>
  849. </ul>
  850. <blockquote>
  851. <p>It is considered <strong>BAD coding practice</strong>, but functions can return values by changing the value of arguments<br />
  852. This type of use should be strictly <strong>avoided</strong>!</p>
  853. </blockquote>
  854. <footer>09/11/2022 | Introduction to structured programming with Fortran</footer>
  855. </section>
  856. </foreignObject></svg><svg data-marpit-svg="" viewBox="0 0 1280 720"><foreignObject width="1280" height="720"><section id="48" data-background-image="url('assets/back.png')" data-footer="09/11/2022 | Introduction to structured programming with Fortran" data-paginate="true" data-theme="vnc6mvbjqstkhfawxx2h2q37lry3esagk64kvzu5xm" data-marpit-pagination="48" data-marpit-pagination-total="60" style="--background-image:url('assets/back.png');--footer:09/11/2022 | Introduction to structured programming with Fortran;--paginate:true;--theme:vnc6mvbjqstkhfawxx2h2q37lry3esagk64kvzu5xm;background-image:url('assets/back.png');background-position:center;background-repeat:no-repeat;background-size:cover;">
  857. <h1>Arguments - cont'd</h1>
  858. <p>The <code>INTENT</code> keyword (&gt;F90) increases readability and enables better compile-time error checking</p>
  859. <pre><code class="language-fortran"><svg data-marp-fitting="svg" data-marp-fitting-code><foreignObject><span data-marp-fitting-svg-content><span data-marp-fitting-svg-content-wrap><span class="hljs-function"><span class="hljs-keyword">SUBROUTINE</span></span> AVG3S(A,B,C,AVERAGE)
  860. <span class="hljs-keyword">IMPLICIT</span> <span class="hljs-keyword">NONE</span>
  861. <span class="hljs-keyword">REAL</span>, <span class="hljs-keyword">INTENT</span>(<span class="hljs-keyword">IN</span>) :: A, B
  862. <span class="hljs-keyword">REAL</span>, <span class="hljs-keyword">INTENT</span>(INOUT) :: C <span class="hljs-comment">! default</span>
  863. <span class="hljs-keyword">REAL</span>, <span class="hljs-keyword">INTENT</span>(<span class="hljs-keyword">OUT</span>) :: AVERAGE
  864. A = <span class="hljs-number">10</span> <span class="hljs-comment">! Compilation error</span>
  865. C = <span class="hljs-number">10</span> <span class="hljs-comment">! Correct</span>
  866. AVERAGE=(A+B+C)/<span class="hljs-number">3</span> <span class="hljs-comment">! Correct</span>
  867. <span class="hljs-keyword">END</span>
  868. </span></span></foreignObject></svg></code></pre>
  869. <blockquote>
  870. <p>Compiler uses <code>INTENT</code> for error checking and optimization</p>
  871. </blockquote>
  872. <footer>09/11/2022 | Introduction to structured programming with Fortran</footer>
  873. </section>
  874. </foreignObject></svg><svg data-marpit-svg="" viewBox="0 0 1280 720"><foreignObject width="1280" height="720"><section id="49" data-background-image="url('assets/back.png')" data-paginate="true" data-theme="vnc6mvbjqstkhfawxx2h2q37lry3esagk64kvzu5xm" data-marpit-pagination="49" data-marpit-pagination-total="60" style="--background-image:url('assets/back.png');--paginate:true;--theme:vnc6mvbjqstkhfawxx2h2q37lry3esagk64kvzu5xm;background-image:url('assets/back.png');background-position:center;background-repeat:no-repeat;background-size:cover;">
  875. <h1><code>FUNCTION</code> versus Array</h1>
  876. <p><code>REMAINDER(4,3)</code> could be a 2D array or it could be a reference to a function</p>
  877. <p>If the name, including arguments, <strong>matches an array declaration</strong>, then it is taken to be an array, <strong>otherwise</strong>, it is assumed to be a <code>FUNCTION</code></p>
  878. <p>Be careful about <code>implicit</code> versus <code>explicit</code> type declarations with <code>FUNCTION</code></p>
  879. <pre><code class="language-fortran"><svg data-marp-fitting="svg" data-marp-fitting-code><foreignObject><span data-marp-fitting-svg-content><span data-marp-fitting-svg-content-wrap><span class="hljs-function"><span class="hljs-keyword">PROGRAM</span></span> MAIN
  880. <span class="hljs-keyword">INTEGER</span> REMAINDER
  881. ...
  882. KR = REMAINDER(<span class="hljs-number">4</span>,<span class="hljs-number">3</span>)
  883. ...
  884. <span class="hljs-keyword">END</span>
  885. <span class="hljs-keyword">INTEGER</span> <span class="hljs-function"><span class="hljs-keyword">FUNCTION</span></span> REMAINDER(INUM,IDEN)
  886. ...
  887. <span class="hljs-keyword">END</span>
  888. </span></span></foreignObject></svg></code></pre>
  889. </section>
  890. </foreignObject></svg><svg data-marpit-svg="" viewBox="0 0 1280 720"><foreignObject width="1280" height="720"><section id="50" data-background-image="url('assets/back.png')" data-footer="09/11/2022 | Introduction to structured programming with Fortran" data-paginate="true" data-theme="vnc6mvbjqstkhfawxx2h2q37lry3esagk64kvzu5xm" data-marpit-pagination="50" data-marpit-pagination-total="60" style="--background-image:url('assets/back.png');--footer:09/11/2022 | Introduction to structured programming with Fortran;--paginate:true;--theme:vnc6mvbjqstkhfawxx2h2q37lry3esagk64kvzu5xm;background-image:url('assets/back.png');background-position:center;background-repeat:no-repeat;background-size:cover;">
  891. <h1>Arrays with Subprograms</h1>
  892. <p>Arrays present special problems in subprograms</p>
  893. <ul>
  894. <li>must pass by reference to subprogram since there is no way to list array values explicitly as literals</li>
  895. <li>how do you tell subprogram how large the array is ?</li>
  896. </ul>
  897. <blockquote>
  898. <p>Answer varies with FORTRAN version and vendor (dialect)...</p>
  899. </blockquote>
  900. <p>When an array element, e.g. <code>A(1)</code>, is used in a subprogram invocation (in calling program), it is passed as a reference (address), just like a simple variable</p>
  901. <p>When an array is used by name in a subprogram invocation (in calling program), it is passed as a reference to the entire array. In this case the array must be appropriately dimensioned in the subroutine (and this can be tricky...)</p>
  902. <footer>09/11/2022 | Introduction to structured programming with Fortran</footer>
  903. </section>
  904. </foreignObject></svg><svg data-marpit-svg="" viewBox="0 0 1280 720"><foreignObject width="1280" height="720"><section id="51" data-background-image="url('assets/back.png')" data-footer="09/11/2022 | Introduction to structured programming with Fortran" data-paginate="true" data-theme="vnc6mvbjqstkhfawxx2h2q37lry3esagk64kvzu5xm" data-marpit-pagination="51" data-marpit-pagination-total="60" style="--background-image:url('assets/back.png');--footer:09/11/2022 | Introduction to structured programming with Fortran;--paginate:true;--theme:vnc6mvbjqstkhfawxx2h2q37lry3esagk64kvzu5xm;background-image:url('assets/back.png');background-position:center;background-repeat:no-repeat;background-size:cover;">
  905. <h1>Arrays - cont'd</h1>
  906. <h3>Data layout in multi-dimensional arrays</h3>
  907. <ul>
  908. <li>always increment the left-most index of multi-dimensional arrays in the innermost loop (i.e. fastest)</li>
  909. <li><strong>column major</strong> ordering in Fortran vs. <strong>row major</strong> ordering in C</li>
  910. <li>a compiler (with sufficient optimization flags) may re-order loops automatically</li>
  911. </ul>
  912. <pre><code class="language-fortran"><svg data-marp-fitting="svg" data-marp-fitting-code><foreignObject><span data-marp-fitting-svg-content><span data-marp-fitting-svg-content-wrap><span class="hljs-keyword">do</span> j=<span class="hljs-number">1</span>,M
  913. <span class="hljs-keyword">do</span> i=<span class="hljs-number">1</span>,N <span class="hljs-comment">! innermost loop</span>
  914. y(i) = y(i)+ a(i,j)*x(j) <span class="hljs-comment">! left-most index is i</span>
  915. <span class="hljs-keyword">end</span> <span class="hljs-keyword">do</span>
  916. <span class="hljs-keyword">end</span> <span class="hljs-keyword">do</span>
  917. </span></span></foreignObject></svg></code></pre>
  918. <footer>09/11/2022 | Introduction to structured programming with Fortran</footer>
  919. </section>
  920. </foreignObject></svg><svg data-marpit-svg="" viewBox="0 0 1280 720"><foreignObject width="1280" height="720"><section id="52" data-background-image="url('assets/back.png')" data-footer="09/11/2022 | Introduction to structured programming with Fortran" data-paginate="true" data-theme="vnc6mvbjqstkhfawxx2h2q37lry3esagk64kvzu5xm" data-marpit-pagination="52" data-marpit-pagination-total="60" style="--background-image:url('assets/back.png');--footer:09/11/2022 | Introduction to structured programming with Fortran;--paginate:true;--theme:vnc6mvbjqstkhfawxx2h2q37lry3esagk64kvzu5xm;background-image:url('assets/back.png');background-position:center;background-repeat:no-repeat;background-size:cover;">
  921. <h1>Arrays - cont'd</h1>
  922. <ul>
  923. <li>dynamically allocate memory for arrays using <code>ALLOCATABLE</code> on declaration</li>
  924. <li>memory is allocated through <code>ALLOCATE</code> statement in the code and is deallocated through <code>DEALLOCATE</code> statement</li>
  925. </ul>
  926. <pre><code class="language-fortran"><svg data-marp-fitting="svg" data-marp-fitting-code><foreignObject><span data-marp-fitting-svg-content><span data-marp-fitting-svg-content-wrap><span class="hljs-keyword">integer</span> :: m, n
  927. <span class="hljs-keyword">integer</span>, <span class="hljs-keyword">allocatable</span> :: idx(:)
  928. <span class="hljs-keyword">real</span>, <span class="hljs-keyword">allocatable</span> :: mat(:,:)
  929. m = <span class="hljs-number">100</span> ; n = <span class="hljs-number">200</span>
  930. <span class="hljs-built_in">allocate</span>( idx(<span class="hljs-number">0</span>:m-<span class="hljs-number">1</span>))
  931. <span class="hljs-built_in">allocate</span>( mat(m, n))
  932. ...
  933. <span class="hljs-built_in">deallocate</span>(idx , mat)
  934. </span></span></foreignObject></svg></code></pre>
  935. <blockquote>
  936. <p>It exists many array intrinsic functions: SIZE, SHAPE, SUM, ANY, MINVAL, MAXLOC, RESHAPE, DOT_PRODUCT, TRANSPOSE, WHERE, FORALL, etc</p>
  937. </blockquote>
  938. <footer>09/11/2022 | Introduction to structured programming with Fortran</footer>
  939. </section>
  940. </foreignObject></svg><svg data-marpit-svg="" viewBox="0 0 1280 720"><foreignObject width="1280" height="720"><section id="53" data-background-image="url('assets/back.png')" data-footer="09/11/2022 | Introduction to structured programming with Fortran" data-paginate="true" data-theme="vnc6mvbjqstkhfawxx2h2q37lry3esagk64kvzu5xm" data-marpit-pagination="53" data-marpit-pagination-total="60" style="--background-image:url('assets/back.png');--footer:09/11/2022 | Introduction to structured programming with Fortran;--paginate:true;--theme:vnc6mvbjqstkhfawxx2h2q37lry3esagk64kvzu5xm;background-image:url('assets/back.png');background-position:center;background-repeat:no-repeat;background-size:cover;">
  941. <h1><code>COMMON</code> &amp; <code>MODULE</code> Statement</h1>
  942. <p>The <code>COMMON</code> statement allows variables to have a more extensive scope than otherwise</p>
  943. <ul>
  944. <li>a variable declared in a <code>Main Program</code> can be made accessible to subprograms (without appearing in argument lists of a calling statement)</li>
  945. <li>this can be selective (don't have to share all everywhere)</li>
  946. <li><strong>placement</strong>: among type declarations, after <code>IMPLICIT</code> or <code>EXPLICIT</code>, before <code>DATA</code> statements</li>
  947. <li>can group into <strong>labeled</strong> <code>COMMON</code></li>
  948. </ul>
  949. <p>With &gt; F90, it's better to use the <code>MODULE</code> subprogram instead of the <code>COMMON</code> statement</p>
  950. <footer>09/11/2022 | Introduction to structured programming with Fortran</footer>
  951. </section>
  952. </foreignObject></svg><svg data-marpit-svg="" viewBox="0 0 1280 720"><foreignObject width="1280" height="720"><section id="54" data-background-image="url('assets/back.png')" data-footer="09/11/2022 | Introduction to structured programming with Fortran" data-paginate="true" data-theme="vnc6mvbjqstkhfawxx2h2q37lry3esagk64kvzu5xm" data-marpit-pagination="54" data-marpit-pagination-total="60" style="--background-image:url('assets/back.png');--footer:09/11/2022 | Introduction to structured programming with Fortran;--paginate:true;--theme:vnc6mvbjqstkhfawxx2h2q37lry3esagk64kvzu5xm;background-image:url('assets/back.png');background-position:center;background-repeat:no-repeat;background-size:cover;">
  953. <h1>Modular programming (&gt;F90)</h1>
  954. <p>Modular programming is about separating parts of programs into independent and interchangeable modules :</p>
  955. <ul>
  956. <li>improve testability</li>
  957. <li>improve maintainability</li>
  958. <li>re-use of code</li>
  959. <li>higher level aspect of coding in a smart way</li>
  960. <li><em>separation of concerns</em></li>
  961. </ul>
  962. <p>The principle is that making significant parts of the code independent, replaceable and independently testable makes your programs <strong>more maintainable</strong></p>
  963. <footer>09/11/2022 | Introduction to structured programming with Fortran</footer>
  964. </section>
  965. </foreignObject></svg><svg data-marpit-svg="" viewBox="0 0 1280 720"><foreignObject width="1280" height="720"><section id="55" data-background-image="url('assets/back.png')" data-footer="09/11/2022 | Introduction to structured programming with Fortran" data-paginate="true" data-theme="vnc6mvbjqstkhfawxx2h2q37lry3esagk64kvzu5xm" data-marpit-pagination="55" data-marpit-pagination-total="60" style="--background-image:url('assets/back.png');--footer:09/11/2022 | Introduction to structured programming with Fortran;--paginate:true;--theme:vnc6mvbjqstkhfawxx2h2q37lry3esagk64kvzu5xm;background-image:url('assets/back.png');background-position:center;background-repeat:no-repeat;background-size:cover;">
  966. <h1>Subprograms type</h1>
  967. <p><code>MODULE</code> are subprograms that allow modular coding and data encapsulation</p>
  968. <p>The interface of a subprogram type is <strong>explicit</strong> or <strong>implicit</strong></p>
  969. <p>Several types of subprograms:</p>
  970. <ul>
  971. <li><code>intrinsic</code>: explicit - defined by Fortran itself (trignonometric functions, etc)</li>
  972. <li><code>module</code>: explicit - defined with <code>MODULE</code> statement and used with <code>USE</code></li>
  973. <li><code>internal</code>: explicit - defined with <code>CONTAINS</code> statement inside (sub)programs</li>
  974. <li><code>external</code>: implicit (but can be manually (re)defined explicit) - e.g. <strong>libraries</strong></li>
  975. </ul>
  976. <p>Differ with the <strong>scope</strong>: what data and other subprograms a subprogram can access</p>
  977. <footer>09/11/2022 | Introduction to structured programming with Fortran</footer>
  978. </section>
  979. </foreignObject></svg><svg data-marpit-svg="" viewBox="0 0 1280 720"><foreignObject width="1280" height="720"><section id="56" data-background-image="url('assets/back.png')" data-paginate="true" data-theme="vnc6mvbjqstkhfawxx2h2q37lry3esagk64kvzu5xm" data-marpit-pagination="56" data-marpit-pagination-total="60" style="--background-image:url('assets/back.png');--paginate:true;--theme:vnc6mvbjqstkhfawxx2h2q37lry3esagk64kvzu5xm;background-image:url('assets/back.png');background-position:center;background-repeat:no-repeat;background-size:cover;">
  980. <h1><code>MODULE</code> type</h1>
  981. <pre><code class="language-fortran"><svg data-marp-fitting="svg" data-marp-fitting-code><foreignObject><span data-marp-fitting-svg-content><span data-marp-fitting-svg-content-wrap><span class="hljs-keyword">MODULE</span> example
  982. <span class="hljs-keyword">IMPLICIT</span> <span class="hljs-keyword">NONE</span>
  983. <span class="hljs-keyword">INTEGER</span>, <span class="hljs-keyword">PARAMETER</span> :: <span class="hljs-built_in">index</span> = <span class="hljs-number">10</span>
  984. <span class="hljs-keyword">REAL</span>(<span class="hljs-number">8</span>), <span class="hljs-keyword">SAVE</span> :: latitude
  985. <span class="hljs-keyword">CONTAINS</span>
  986. <span class="hljs-function"><span class="hljs-keyword">FUNCTION</span></span> check(x) RESULT(z)
  987. <span class="hljs-keyword">INTEGER</span> :: x, z
  988. ...
  989. <span class="hljs-keyword">END</span> <span class="hljs-function"><span class="hljs-keyword">FUNCTION</span></span> check
  990. <span class="hljs-keyword">END</span> <span class="hljs-keyword">MODULE</span> example
  991. </span></span></foreignObject></svg></code></pre>
  992. <pre><code class="language-fortran"><svg data-marp-fitting="svg" data-marp-fitting-code><foreignObject><span data-marp-fitting-svg-content><span data-marp-fitting-svg-content-wrap><span class="hljs-function"><span class="hljs-keyword">PROGRAM</span></span> myprog
  993. <span class="hljs-keyword">USE</span> example, <span class="hljs-keyword">ONLY</span>: check, latitude
  994. <span class="hljs-keyword">IMPLICIT</span> <span class="hljs-keyword">NONE</span>
  995. ...
  996. test = check(a)
  997. ...
  998. <span class="hljs-keyword">END</span> <span class="hljs-function"><span class="hljs-keyword">PROGRAM</span></span> myprog
  999. </span></span></foreignObject></svg></code></pre>
  1000. </section>
  1001. </foreignObject></svg><svg data-marpit-svg="" viewBox="0 0 1280 720"><foreignObject width="1280" height="720"><section id="57" data-background-image="url('assets/back.png')" data-paginate="true" data-theme="vnc6mvbjqstkhfawxx2h2q37lry3esagk64kvzu5xm" data-marpit-pagination="57" data-marpit-pagination-total="60" style="--background-image:url('assets/back.png');--paginate:true;--theme:vnc6mvbjqstkhfawxx2h2q37lry3esagk64kvzu5xm;background-image:url('assets/back.png');background-position:center;background-repeat:no-repeat;background-size:cover;">
  1002. <h1><code>internal</code> subprogams</h1>
  1003. <pre><code class="language-fortran"><svg data-marp-fitting="svg" data-marp-fitting-code><foreignObject><span data-marp-fitting-svg-content><span data-marp-fitting-svg-content-wrap><span class="hljs-function"><span class="hljs-keyword">program</span></span> main
  1004. <span class="hljs-keyword">implicit</span> <span class="hljs-keyword">none</span>
  1005. <span class="hljs-keyword">integer</span> N
  1006. <span class="hljs-keyword">real</span> X(<span class="hljs-number">20</span>)
  1007. ...
  1008. <span class="hljs-built_in">write</span>(*,*), <span class="hljs-string">&#x27;Processing x...&#x27;</span>, process()
  1009. ...
  1010. <span class="hljs-keyword">contains</span>
  1011. <span class="hljs-keyword">logical</span> <span class="hljs-function"><span class="hljs-keyword">function</span></span> process()
  1012. <span class="hljs-comment">! in this function N and X can be accessed directly (scope of main)</span>
  1013. <span class="hljs-comment">! Please not that this method is not recommended:</span>
  1014. <span class="hljs-comment">! it would be better to pass X as an argument of process</span>
  1015. <span class="hljs-keyword">implicit</span> <span class="hljs-keyword">none</span>
  1016. <span class="hljs-keyword">if</span> (<span class="hljs-built_in">sum</span>(x) &gt; <span class="hljs-number">5.</span>) <span class="hljs-keyword">then</span>
  1017. process = .FALSE.
  1018. <span class="hljs-keyword">else</span>
  1019. process = .TRUE.
  1020. <span class="hljs-keyword">endif</span>
  1021. <span class="hljs-keyword">end</span> <span class="hljs-function"><span class="hljs-keyword">function</span></span> process
  1022. <span class="hljs-keyword">end</span> <span class="hljs-function"><span class="hljs-keyword">program</span></span>
  1023. </span></span></foreignObject></svg></code></pre>
  1024. </section>
  1025. </foreignObject></svg><svg data-marpit-svg="" viewBox="0 0 1280 720"><foreignObject width="1280" height="720"><section id="58" data-background-image="url('assets/back.png')" data-footer="09/11/2022 | Introduction to structured programming with Fortran" data-paginate="true" data-theme="vnc6mvbjqstkhfawxx2h2q37lry3esagk64kvzu5xm" data-marpit-pagination="58" data-marpit-pagination-total="60" style="--background-image:url('assets/back.png');--footer:09/11/2022 | Introduction to structured programming with Fortran;--paginate:true;--theme:vnc6mvbjqstkhfawxx2h2q37lry3esagk64kvzu5xm;background-image:url('assets/back.png');background-position:center;background-repeat:no-repeat;background-size:cover;">
  1026. <h1><code>external</code> subprogams</h1>
  1027. <ul>
  1028. <li><code>external</code> subprogams are defined in a separate program unit</li>
  1029. <li>to use them in another program unit, refer with the <code>EXTERNAL</code> statement</li>
  1030. <li>compiled separately and linked</li>
  1031. </ul>
  1032. <p><strong>!!! DO NOT USE THEM</strong>: modules are much easier and more robust <img class="emoji" draggable="false" alt="❗" src="https://twemoji.maxcdn.com/v/14.0.2/svg/2757.svg" data-marp-twemoji=""/></p>
  1033. <p>They are only needed when subprogams are written with different programming language or when using external libraries (such as BLAS)</p>
  1034. <blockquote>
  1035. <p>It's <strong>highly</strong> recommended to construct <code>INTERFACE</code> blocks for any external subprogams used</p>
  1036. </blockquote>
  1037. <footer>09/11/2022 | Introduction to structured programming with Fortran</footer>
  1038. </section>
  1039. </foreignObject></svg><svg data-marpit-svg="" viewBox="0 0 1280 720"><foreignObject width="1280" height="720"><section id="59" data-background-image="url('assets/back.png')" data-paginate="true" data-theme="vnc6mvbjqstkhfawxx2h2q37lry3esagk64kvzu5xm" data-marpit-pagination="59" data-marpit-pagination-total="60" style="--background-image:url('assets/back.png');--paginate:true;--theme:vnc6mvbjqstkhfawxx2h2q37lry3esagk64kvzu5xm;background-image:url('assets/back.png');background-position:center;background-repeat:no-repeat;background-size:cover;">
  1040. <h1><code>interface</code> statement</h1>
  1041. <pre><code class="language-fortran"><svg data-marp-fitting="svg" data-marp-fitting-code><foreignObject><span data-marp-fitting-svg-content><span data-marp-fitting-svg-content-wrap><span class="hljs-function"><span class="hljs-keyword">SUBROUTINE</span></span> nag_rand(table)
  1042. <span class="hljs-keyword">INTERFACE</span>
  1043. <span class="hljs-function"><span class="hljs-keyword">SUBROUTINE</span></span> g05faf(a,b,n,x)
  1044. <span class="hljs-keyword">REAL</span>, <span class="hljs-keyword">INTENT</span>(<span class="hljs-keyword">IN</span>) :: a, b
  1045. <span class="hljs-keyword">INTEGER</span>, <span class="hljs-keyword">INTENT</span>(<span class="hljs-keyword">IN</span>) :: n
  1046. <span class="hljs-keyword">REAL</span>, <span class="hljs-keyword">INTENT</span>(<span class="hljs-keyword">OUT</span>) :: x(n)
  1047. <span class="hljs-keyword">END</span> <span class="hljs-function"><span class="hljs-keyword">SUBROUTINE</span></span> g05faf
  1048. <span class="hljs-keyword">END</span> <span class="hljs-keyword">INTERFACE</span>
  1049. <span class="hljs-comment">!</span>
  1050. <span class="hljs-keyword">REAL</span>, <span class="hljs-keyword">DIMENSION</span>(:), <span class="hljs-keyword">INTENT</span>(<span class="hljs-keyword">OUT</span>) :: table
  1051. <span class="hljs-comment">!</span>
  1052. <span class="hljs-keyword">call</span> g05faf(-<span class="hljs-number">1.0</span>,-<span class="hljs-number">1.0</span>, <span class="hljs-built_in">SIZE</span>(table), table)
  1053. <span class="hljs-keyword">END</span> <span class="hljs-function"><span class="hljs-keyword">SUBROUTINE</span></span> nag_rand
  1054. </span></span></foreignObject></svg></code></pre>
  1055. </section>
  1056. </foreignObject></svg><svg data-marpit-svg="" viewBox="0 0 1280 720"><foreignObject width="1280" height="720"><section id="60" data-background-image="url('assets/back.png')" data-footer="09/11/2022 | Introduction to structured programming with Fortran" data-paginate="true" data-theme="vnc6mvbjqstkhfawxx2h2q37lry3esagk64kvzu5xm" data-marpit-pagination="60" data-marpit-pagination-total="60" style="--background-image:url('assets/back.png');--footer:09/11/2022 | Introduction to structured programming with Fortran;--paginate:true;--theme:vnc6mvbjqstkhfawxx2h2q37lry3esagk64kvzu5xm;background-image:url('assets/back.png');background-position:center;background-repeat:no-repeat;background-size:cover;">
  1057. <h1>Conclusions</h1>
  1058. <ul>
  1059. <li>
  1060. <p>Fortran in all its standard versions and vendor-specific dialects is a rich but confusing language</p>
  1061. </li>
  1062. <li>
  1063. <p>Fortran is a modern language that continues to evolve</p>
  1064. </li>
  1065. <li>
  1066. <p>Fortran is still ideally suited for numerical computations in engineering and science</p>
  1067. <ul>
  1068. <li>most new language features have been added since F95</li>
  1069. <li>&quot;High Performance Fortran&quot; includes capabilities designed for parallel processing</li>
  1070. </ul>
  1071. </li>
  1072. </ul>
  1073. <footer>09/11/2022 | Introduction to structured programming with Fortran</footer>
  1074. </section>
  1075. <script>!function(){"use strict";const t="marpitSVGPolyfill:setZoomFactor,",e=Symbol();let r,o;function n(n){const i="object"==typeof n&&n.target||document,a="object"==typeof n?n.zoom:n;window[e]||(Object.defineProperty(window,e,{configurable:!0,value:!0}),window.addEventListener("message",(({data:e,origin:r})=>{if(r===window.origin)try{if(e&&"string"==typeof e&&e.startsWith(t)){const[,t]=e.split(","),r=Number.parseFloat(t);Number.isNaN(r)||(o=r)}}catch(t){console.error(t)}})));let l=!1;Array.from(i.querySelectorAll("svg[data-marpit-svg]"),(t=>{var e,n,i,s;t.style.transform||(t.style.transform="translateZ(0)");const c=a||o||t.currentScale||1;r!==c&&(r=c,l=c);const d=t.getBoundingClientRect(),{length:f}=t.children;for(let r=0;r<f;r+=1){const o=t.children[r];if(o.getScreenCTM){const t=o.getScreenCTM();if(t){const r=null!==(n=null===(e=o.x)||void 0===e?void 0:e.baseVal.value)&&void 0!==n?n:0,a=null!==(s=null===(i=o.y)||void 0===i?void 0:i.baseVal.value)&&void 0!==s?s:0,l=o.children.length;for(let e=0;e<l;e+=1){const n=o.children[e];if("SECTION"===n.tagName){const{style:e}=n;e.transformOrigin||(e.transformOrigin=`${-r}px ${-a}px`),e.transform=`scale(${c}) matrix(${t.a}, ${t.b}, ${t.c}, ${t.d}, ${t.e-d.left}, ${t.f-d.top}) translateZ(0.0001px)`;break}}}}}})),!1!==l&&Array.from(i.querySelectorAll("iframe"),(({contentWindow:e})=>{null==e||e.postMessage(`${t}${l}`,"null"===window.origin?"*":window.origin)}))}r=1,o=void 0;const i=(t,e,r)=>{if(t.getAttribute(e)!==r)return t.setAttribute(e,r),!0};function a({once:t=!1,target:e=document}={}){const r="Apple Computer, Inc."===navigator.vendor?[n]:[];let o=!t;const a=()=>{for(const t of r)t({target:e});!function(t=document){Array.from(t.querySelectorAll('svg[data-marp-fitting="svg"]'),(t=>{var e;const r=t.firstChild,o=r.firstChild,{scrollWidth:n,scrollHeight:a}=o;let l,s=1;if(t.hasAttribute("data-marp-fitting-code")&&(l=null===(e=t.parentElement)||void 0===e?void 0:e.parentElement),t.hasAttribute("data-marp-fitting-math")&&(l=t.parentElement),l){const t=getComputedStyle(l),e=Math.ceil(l.clientWidth-parseFloat(t.paddingLeft||"0")-parseFloat(t.paddingRight||"0"));e&&(s=e)}const c=Math.max(n,s),d=Math.max(a,1),f=`0 0 ${c} ${d}`;i(r,"width",`${c}`),i(r,"height",`${d}`),i(t,"preserveAspectRatio",getComputedStyle(t).getPropertyValue("--preserve-aspect-ratio")||"xMinYMin meet"),i(t,"viewBox",f)&&t.classList.toggle("__reflow__")}))}(e),o&&window.requestAnimationFrame(a)};return a(),()=>{o=!1}}const l=Symbol(),s=document.currentScript;((t=document)=>{if("undefined"==typeof window)throw new Error("Marp Core's browser script is valid only in browser context.");if(t[l])return t[l];const e=a({target:t}),r=()=>{e(),delete t[l]};Object.defineProperty(t,l,{configurable:!0,value:r})})(s?s.getRootNode():document)}();
  1076. </script></foreignObject></svg></div><div class="bespoke-marp-note" data-index="55" tabindex="0"><p>Notes for presenter.</p><p>```fortran
  1077. module subs
  1078. contains
  1079. subroutine asub (i, control)
  1080. implicit none
  1081. integer, intent (in) :: i
  1082. logical, intent (in) :: control
  1083. integer, save :: j = 0
  1084. integer :: k
  1085. j = j + i
  1086. if ( control ) k = 0
  1087. k = k + i
  1088. write (*, *) 'i, j, k=', i, j, k
  1089. end subroutine asub
  1090. end module subs
  1091. program test_saves
  1092. use subs
  1093. implicit none
  1094. call asub ( 3, .TRUE. )
  1095. call asub ( 4, .FALSE. )
  1096. end program test_saves
  1097. ```
  1098. Local variable k of the subroutine is intentionally misused -- in this program it is initialized in the first call since control is TRUE, but on the second call control is FALSE, so k is not redefined. But without the save attribute k is undefined, so the using its value is illegal.
  1099. ```fortran
  1100. i, j, k= 3 3 3
  1101. i, j, k= 4 7 7
  1102. ```
  1103. Compiling the program with ifort and aggressive optimization options, k lost its value:
  1104. ```fortran
  1105. i, j, k= 3 3 3
  1106. i, j, k= 4 7 4
  1107. ```</p></div><script>/*!! License: https://unpkg.com/@marp-team/marp-cli@1.7.1/lib/bespoke.js.LICENSE.txt */
  1108. !function(){"use strict";const e=document.body,t=(...e)=>history.replaceState(...e),n="presenter",r="next",o=["",n,r],a="data-bespoke-marp-",i=(e,{protocol:t,host:n,pathname:r,hash:o}=location)=>{const a=e.toString();return`${t}//${n}${r}${a?"?":""}${a}${o}`},s=()=>e.dataset.bespokeView,l=e=>new URLSearchParams(location.search).get(e),d=(e,n={})=>{var r;const o={location,setter:t,...n},a=new URLSearchParams(o.location.search);for(const t of Object.keys(e)){const n=e[t];"string"==typeof n?a.set(t,n):a.delete(t)}try{o.setter({...null!==(r=window.history.state)&&void 0!==r?r:{}},"",i(a,o.location))}catch(e){console.error(e)}},c=(()=>{const e="bespoke-marp";try{return localStorage.setItem(e,e),localStorage.removeItem(e),!0}catch(e){return!1}})(),u=e=>{try{return localStorage.getItem(e)}catch(e){return null}},f=(e,t)=>{try{return localStorage.setItem(e,t),!0}catch(e){return!1}},m=e=>{try{return localStorage.removeItem(e),!0}catch(e){return!1}},g=(e,t)=>{const n="aria-hidden";t?e.setAttribute(n,"true"):e.removeAttribute(n)},p=e=>{e.parent.classList.add("bespoke-marp-parent"),e.slides.forEach((e=>e.classList.add("bespoke-marp-slide"))),e.on("activate",(t=>{const n="bespoke-marp-active",r=t.slide,o=r.classList,a=!o.contains(n);if(e.slides.forEach((e=>{e.classList.remove(n),g(e,!0)})),o.add(n),g(r,!1),a){const e=`${n}-ready`;o.add(e),document.body.clientHeight,o.remove(e)}}))},v=e=>{let t=0,n=0;Object.defineProperty(e,"fragments",{enumerable:!0,value:e.slides.map((e=>[null,...e.querySelectorAll("[data-marpit-fragment]")]))});const r=r=>void 0!==e.fragments[t][n+r],o=(r,o)=>{t=r,n=o,e.fragments.forEach(((e,t)=>{e.forEach(((e,n)=>{if(null==e)return;const i=t<r||t===r&&n<=o;e.setAttribute(`${a}fragment`,(i?"":"in")+"active");const s=`${a}current-fragment`;t===r&&n===o?e.setAttribute(s,"current"):e.removeAttribute(s)}))})),e.fragmentIndex=o;const i={slide:e.slides[r],index:r,fragments:e.fragments[r],fragmentIndex:o};e.fire("fragment",i)};e.on("next",(({fragment:a=!0})=>{if(a){if(r(1))return o(t,n+1),!1;const a=t+1;e.fragments[a]&&o(a,0)}else{const r=e.fragments[t].length;if(n+1<r)return o(t,r-1),!1;const a=e.fragments[t+1];a&&o(t+1,a.length-1)}})),e.on("prev",(({fragment:a=!0})=>{if(r(-1)&&a)return o(t,n-1),!1;const i=t-1;e.fragments[i]&&o(i,e.fragments[i].length-1)})),e.on("slide",(({index:t,fragment:n})=>{let r=0;if(void 0!==n){const o=e.fragments[t];if(o){const{length:e}=o;r=-1===n?e-1:Math.min(Math.max(n,0),e-1)}}o(t,r)})),o(0,0)},h=document,y=()=>!(!h.fullscreenEnabled&&!h.webkitFullscreenEnabled),b=()=>!(!h.fullscreenElement&&!h.webkitFullscreenElement),x=e=>{e.fullscreen=()=>{y()&&(async()=>{return b()?null===(e=h.exitFullscreen||h.webkitExitFullscreen)||void 0===e?void 0:e.call(h):((e=h.body)=>{var t;return null===(t=e.requestFullscreen||e.webkitRequestFullscreen)||void 0===t?void 0:t.call(e)})();var e})()},document.addEventListener("keydown",(t=>{"f"!==t.key&&"F11"!==t.key||t.altKey||t.ctrlKey||t.metaKey||!y()||(e.fullscreen(),t.preventDefault())}))},w="bespoke-marp-inactive",k=(e=2e3)=>({parent:t,fire:n})=>{const r=t.classList,o=e=>n(`marp-${e?"":"in"}active`);let a;const i=()=>{a&&clearTimeout(a),a=setTimeout((()=>{r.add(w),o()}),e),r.contains(w)&&(r.remove(w),o(!0))};for(const e of["mousedown","mousemove","touchend"])document.addEventListener(e,i);setTimeout(i,0)},E=["AUDIO","BUTTON","INPUT","SELECT","TEXTAREA","VIDEO"],L=e=>{e.parent.addEventListener("keydown",(e=>{if(!e.target)return;const t=e.target;(E.includes(t.nodeName)||"true"===t.contentEditable)&&e.stopPropagation()}))},$=e=>{window.addEventListener("load",(()=>{for(const t of e.slides){const e=t.querySelector("[data-marp-fitting]")?"":"hideable";t.setAttribute(`${a}load`,e)}}))},S=({interval:e=250}={})=>t=>{document.addEventListener("keydown",(e=>{if(" "===e.key&&e.shiftKey)t.prev();else if("ArrowLeft"===e.key||"ArrowUp"===e.key||"PageUp"===e.key)t.prev({fragment:!e.shiftKey});else if(" "!==e.key||e.shiftKey)if("ArrowRight"===e.key||"ArrowDown"===e.key||"PageDown"===e.key)t.next({fragment:!e.shiftKey});else if("End"===e.key)t.slide(t.slides.length-1,{fragment:-1});else{if("Home"!==e.key)return;t.slide(0)}else t.next();e.preventDefault()}));let n,r,o=0;t.parent.addEventListener("wheel",(a=>{let i=!1;const s=(e,t)=>{e&&(i=i||((e,t)=>((e,t)=>{const n="X"===t?"Width":"Height";return e[`client${n}`]<e[`scroll${n}`]})(e,t)&&((e,t)=>{const{overflow:n}=e,r=e[`overflow${t}`];return"auto"===n||"scroll"===n||"auto"===r||"scroll"===r})(getComputedStyle(e),t))(e,t)),(null==e?void 0:e.parentElement)&&s(e.parentElement,t)};if(0!==a.deltaX&&s(a.target,"X"),0!==a.deltaY&&s(a.target,"Y"),i)return;a.preventDefault();const l=Math.sqrt(a.deltaX**2+a.deltaY**2);if(void 0!==a.wheelDelta){if(void 0===a.webkitForce&&Math.abs(a.wheelDelta)<40)return;if(a.deltaMode===a.DOM_DELTA_PIXEL&&l<4)return}else if(a.deltaMode===a.DOM_DELTA_PIXEL&&l<12)return;r&&clearTimeout(r),r=setTimeout((()=>{n=0}),e);const d=Date.now()-o<e,c=l<=n;if(n=l,d||c)return;let u;(a.deltaX>0||a.deltaY>0)&&(u="next"),(a.deltaX<0||a.deltaY<0)&&(u="prev"),u&&(t[u](),o=Date.now())}))},P=(e=".bespoke-marp-osc")=>{const t=document.querySelector(e);if(!t)return()=>{};const n=(e,n)=>{t.querySelectorAll(`[${a}osc=${JSON.stringify(e)}]`).forEach(n)};return y()||n("fullscreen",(e=>e.style.display="none")),c||n("presenter",(e=>{e.disabled=!0,e.title="Presenter view is disabled due to restricted localStorage."})),e=>{t.addEventListener("click",(t=>{if(t.target instanceof HTMLElement){const{bespokeMarpOsc:n}=t.target.dataset;n&&t.target.blur();const r={fragment:!t.shiftKey};"next"===n?e.next(r):"prev"===n?e.prev(r):"fullscreen"===n?null==e||e.fullscreen():"presenter"===n&&e.openPresenterView()}})),e.parent.appendChild(t),e.on("activate",(({index:t})=>{n("page",(n=>n.textContent=`Page ${t+1} of ${e.slides.length}`))})),e.on("fragment",(({index:t,fragments:r,fragmentIndex:o})=>{n("prev",(e=>e.disabled=0===t&&0===o)),n("next",(n=>n.disabled=t===e.slides.length-1&&o===r.length-1))})),e.on("marp-active",(()=>g(t,!1))),e.on("marp-inactive",(()=>g(t,!0))),y()&&(e=>{for(const t of["","webkit"])h.addEventListener(t+"fullscreenchange",e)})((()=>n("fullscreen",(e=>e.classList.toggle("exit",y()&&b())))))}},T=e=>{window.addEventListener("message",(t=>{if(t.origin!==window.origin)return;const[n,r]=t.data.split(":");if("navigate"===n){const[t,n]=r.split(",");let o=Number.parseInt(t,10),a=Number.parseInt(n,10)+1;a>=e.fragments[o].length&&(o+=1,a=0),e.slide(o,{fragment:a})}}))};var I=["area","base","br","col","command","embed","hr","img","input","keygen","link","meta","param","source","track","wbr"];let N=e=>String(e).replace(/[&<>"']/g,(e=>`&${C[e]};`)),C={"&":"amp","<":"lt",">":"gt",'"':"quot","'":"apos"},A="dangerouslySetInnerHTML",D={className:"class",htmlFor:"for"},M={};function B(e,t){let n=[],r="";t=t||{};for(let e=arguments.length;e-- >2;)n.push(arguments[e]);if("function"==typeof e)return t.children=n.reverse(),e(t);if(e){if(r+="<"+e,t)for(let e in t)!1!==t[e]&&null!=t[e]&&e!==A&&(r+=` ${D[e]?D[e]:N(e)}="${N(t[e])}"`);r+=">"}if(-1===I.indexOf(e)){if(t[A])r+=t[A].__html;else for(;n.length;){let e=n.pop();if(e)if(e.pop)for(let t=e.length;t--;)n.push(e[t]);else r+=!0===M[e]?e:N(e)}r+=e?`</${e}>`:""}return M[r]=!0,r}const K=({children:e})=>B(null,null,...e),O="bespoke-marp-presenter-",q={container:`${O}container`,dragbar:`${O}dragbar-container`,next:`${O}next`,nextContainer:`${O}next-container`,noteContainer:`${O}note-container`,noteWrapper:`${O}note-wrapper`,noteButtons:`${O}note-buttons`,infoContainer:`${O}info-container`,infoPage:`${O}info-page`,infoPageText:`${O}info-page-text`,infoPagePrev:`${O}info-page-prev`,infoPageNext:`${O}info-page-next`,noteButtonsBigger:`${O}note-bigger`,noteButtonsSmaller:`${O}note-smaller`,infoTime:`${O}info-time`,infoTimer:`${O}info-timer`},_=e=>{const{title:t}=document;document.title="[Presenter view]"+(t?` - ${t}`:"");const n={},r=e=>(n[e]=n[e]||document.querySelector(`.${e}`),n[e]);document.body.appendChild((e=>{const t=document.createElement("div");return t.className=q.container,t.appendChild(e),t.insertAdjacentHTML("beforeend",B(K,null,B("div",{class:q.nextContainer},B("iframe",{class:q.next,src:"?view=next"})),B("div",{class:q.dragbar}),B("div",{class:q.noteContainer},B("div",{class:q.noteWrapper}),B("div",{class:q.noteButtons},B("button",{class:q.noteButtonsSmaller,tabindex:"-1",title:"Smaller notes font size"},"Smaller notes font size"),B("button",{class:q.noteButtonsBigger,tabindex:"-1",title:"Bigger notes font size"},"Bigger notes font size"))),B("div",{class:q.infoContainer},B("div",{class:q.infoPage},B("button",{class:q.infoPagePrev,tabindex:"-1",title:"Previous"},"Previous"),B("span",{class:q.infoPageText}),B("button",{class:q.infoPageNext,tabindex:"-1",title:"Next"},"Next")),B("time",{class:q.infoTime,title:"Current time"}),B("time",{class:q.infoTimer,title:"Timer"})))),t})(e.parent)),(e=>{let t=!1;r(q.dragbar).addEventListener("mousedown",(()=>{t=!0,r(q.dragbar).classList.add("active")})),window.addEventListener("mouseup",(()=>{t=!1,r(q.dragbar).classList.remove("active")})),window.addEventListener("mousemove",(e=>{if(!t)return;const n=e.clientX/document.documentElement.clientWidth*100;r(q.container).style.setProperty("--bespoke-marp-presenter-split-ratio",`${Math.max(0,Math.min(100,n))}%`)})),r(q.nextContainer).addEventListener("click",(()=>e.next()));const n=r(q.next),o=(a=n,(e,t)=>{var n;return null===(n=a.contentWindow)||void 0===n?void 0:n.postMessage(`navigate:${e},${t}`,"null"===window.origin?"*":window.origin)});var a;n.addEventListener("load",(()=>{r(q.nextContainer).classList.add("active"),o(e.slide(),e.fragmentIndex),e.on("fragment",(({index:e,fragmentIndex:t})=>o(e,t)))}));const i=document.querySelectorAll(".bespoke-marp-note");i.forEach((e=>{e.addEventListener("keydown",(e=>e.stopPropagation())),r(q.noteWrapper).appendChild(e)})),e.on("activate",(()=>i.forEach((t=>t.classList.toggle("active",t.dataset.index==e.slide())))));let s=0;const l=e=>{s=Math.max(-5,s+e),r(q.noteContainer).style.setProperty("--bespoke-marp-note-font-scale",(1.2**s).toFixed(4))},d=()=>l(1),c=()=>l(-1),u=r(q.noteButtonsBigger),f=r(q.noteButtonsSmaller);u.addEventListener("click",(()=>{u.blur(),d()})),f.addEventListener("click",(()=>{f.blur(),c()})),document.addEventListener("keydown",(e=>{"+"===e.key&&d(),"-"===e.key&&c()}),!0),e.on("activate",(({index:t})=>{r(q.infoPageText).textContent=`${t+1} / ${e.slides.length}`}));const m=r(q.infoPagePrev),g=r(q.infoPageNext);m.addEventListener("click",(t=>{m.blur(),e.prev({fragment:!t.shiftKey})})),g.addEventListener("click",(t=>{g.blur(),e.next({fragment:!t.shiftKey})})),e.on("fragment",(({index:t,fragments:n,fragmentIndex:r})=>{m.disabled=0===t&&0===r,g.disabled=t===e.slides.length-1&&r===n.length-1}));let p=new Date;const v=()=>{const e=new Date,t=e=>`${Math.floor(e)}`.padStart(2,"0"),n=e.getTime()-p.getTime(),o=t(n/1e3%60),a=t(n/1e3/60%60),i=t(n/36e5%24);r(q.infoTime).textContent=e.toLocaleTimeString(),r(q.infoTimer).textContent=`${i}:${a}:${o}`};v(),setInterval(v,250),r(q.infoTimer).addEventListener("click",(()=>{p=new Date}))})(e)},X=e=>{if(!(e=>e.syncKey&&"string"==typeof e.syncKey)(e))throw new Error("The current instance of Bespoke.js is invalid for Marp bespoke presenter plugin.");Object.defineProperties(e,{openPresenterView:{enumerable:!0,value:F},presenterUrl:{enumerable:!0,get:U}}),c&&document.addEventListener("keydown",(t=>{"p"!==t.key||t.altKey||t.ctrlKey||t.metaKey||(t.preventDefault(),e.openPresenterView())}))};function F(){const{max:e,floor:t}=Math,n=e(t(.85*window.innerWidth),640),r=e(t(.85*window.innerHeight),360);return window.open(this.presenterUrl,O+this.syncKey,`width=${n},height=${r},menubar=no,toolbar=no`)}function U(){const e=new URLSearchParams(location.search);return e.set("view","presenter"),e.set("sync",this.syncKey),i(e)}const V=e=>{const t=s();return t===r&&e.appendChild(document.createElement("span")),{"":X,[n]:_,[r]:T}[t]},R=e=>{e.on("activate",(t=>{document.querySelectorAll(".bespoke-progress-parent > .bespoke-progress-bar").forEach((n=>{n.style.flexBasis=100*t.index/(e.slides.length-1)+"%"}))}))},j=e=>{const t=Number.parseInt(e,10);return Number.isNaN(t)?null:t},H=(e={})=>{const t={history:!0,...e};return e=>{let n=!0;const r=e=>{const t=n;try{return n=!0,e()}finally{n=t}},o=(t={fragment:!0})=>{((t,n)=>{const{min:r,max:o}=Math,{fragments:a,slides:i}=e,s=o(0,r(t,i.length-1)),l=o(0,r(n||0,a[s].length-1));s===e.slide()&&l===e.fragmentIndex||e.slide(s,{fragment:l})})((j(location.hash.slice(1))||1)-1,t.fragment?j(l("f")||""):null)};e.on("fragment",(({index:e,fragmentIndex:r})=>{n||d({f:0===r||r.toString()},{location:{...location,hash:`#${e+1}`},setter:(...e)=>t.history?history.pushState(...e):history.replaceState(...e)})})),setTimeout((()=>{o(),window.addEventListener("hashchange",(()=>r((()=>{o({fragment:!1}),d({f:void 0})})))),window.addEventListener("popstate",(()=>{n||r((()=>o()))})),n=!1}),0)}},W=(e={})=>{var n;const r=e.key||(null===(n=window.history.state)||void 0===n?void 0:n.marpBespokeSyncKey)||Math.random().toString(36).slice(2),o=`bespoke-marp-sync-${r}`;var a;a={marpBespokeSyncKey:r},d({},{setter:(e,...n)=>t({...e,...a},...n)});const i=()=>{const e=u(o);return e?JSON.parse(e):Object.create(null)},s=e=>{const t=i(),n={...t,...e(t)};return f(o,JSON.stringify(n)),n},l=()=>{window.removeEventListener("pageshow",l),s((e=>({reference:(e.reference||0)+1})))};return e=>{l(),Object.defineProperty(e,"syncKey",{value:r,enumerable:!0});let t=!0;setTimeout((()=>{e.on("fragment",(e=>{t&&s((()=>({index:e.index,fragmentIndex:e.fragmentIndex})))}))}),0),window.addEventListener("storage",(n=>{if(n.key===o&&n.oldValue&&n.newValue){const r=JSON.parse(n.oldValue),o=JSON.parse(n.newValue);if(r.index!==o.index||r.fragmentIndex!==o.fragmentIndex)try{t=!1,e.slide(o.index,{fragment:o.fragmentIndex})}finally{t=!0}}}));const n=()=>{const{reference:e}=i();void 0===e||e<=1?m(o):s((()=>({reference:e-1})))};window.addEventListener("pagehide",(e=>{e.persisted&&window.addEventListener("pageshow",l),n()})),e.on("destroy",n)}},{PI:Y,abs:J,sqrt:z,atan2:G}=Math,Q={passive:!0},Z=({slope:e=-.7,swipeThreshold:t=30}={})=>n=>{let r;const o=n.parent,a=e=>{const t=o.getBoundingClientRect();return{x:e.pageX-(t.left+t.right)/2,y:e.pageY-(t.top+t.bottom)/2}};o.addEventListener("touchstart",(({touches:e})=>{r=1===e.length?a(e[0]):void 0}),Q),o.addEventListener("touchmove",(e=>{if(r)if(1===e.touches.length){e.preventDefault();const t=a(e.touches[0]),n=t.x-r.x,o=t.y-r.y;r.delta=z(J(n)**2+J(o)**2),r.radian=G(n,o)}else r=void 0})),o.addEventListener("touchend",(o=>{if(r){if(r.delta&&r.delta>=t&&r.radian){const t=(r.radian-e+Y)%(2*Y)-Y;n[t<0?"next":"prev"](),o.stopPropagation()}r=void 0}}),Q)},ee="_tA",te=e=>{const t=document.documentTransition;if(!t)return;let n;e._tP=!1;const r=(n,{back:r,cond:o})=>a=>{var i,s;const l=e.slides[e.slide()].querySelector("section[data-transition]");if(!l)return!0;const d=document.querySelector(".bespoke-marp-osc"),c=d?[d]:void 0;if(e._tP){if(a._tA){e._tP=!1;try{t.start({sharedElements:c}).catch((()=>{}))}catch(e){}return!0}}else{if(!o(a))return!0;const d="transition"+(a.back||r?"Back":""),u=Number.parseInt(null!==(i=l.dataset[`${d}Duration`])&&void 0!==i?i:"",10),f=Number.parseInt(null!==(s=l.dataset[`${d}Delay`])&&void 0!==s?s:"",10),m={};Number.isNaN(u)||(m.duration=u.toString()),Number.isNaN(f)||(m.delay=f.toString()),e._tP=t.prepare({rootTransition:l.dataset[d],rootConfig:m,sharedElements:c}).then((()=>n(a))).catch((()=>n(a)))}return!1};e.on("prev",r((t=>e.prev({...t,[ee]:!0})),{back:!0,cond:e=>{var t;return e.index>0&&!((null===(t=e.fragment)||void 0===t||t)&&n.fragmentIndex>0)}})),e.on("next",r((t=>e.next({...t,[ee]:!0})),{cond:t=>t.index+1<e.slides.length&&!(n.fragmentIndex+1<n.fragments.length)})),setTimeout((()=>{e.on("slide",r((t=>e.slide(t.index,{...t,[ee]:!0})),{cond:t=>{const n=e.slide();return t.index!==n&&(t.back=t.index<n,!0)}}))}),0),e.on("fragment",(e=>{n=e}))};let ne;const re=()=>(void 0===ne&&(ne="wakeLock"in navigator&&navigator.wakeLock),ne),oe=async()=>{const e=re();if(e)try{return await e.request("screen")}catch(e){console.warn(e)}return null},ae=async()=>{if(!re())return;let e;const t=()=>{e&&"visible"===document.visibilityState&&oe()};for(const e of["visibilitychange","fullscreenchange"])document.addEventListener(e,t);return e=await oe(),e};((t=document.getElementById("p"))=>{(()=>{const t=l("view");e.dataset.bespokeView=t===r||t===n?t:""})();const a=(e=>{const t=l(e);return d({[e]:void 0}),t})("sync")||void 0;var i,c,u,f,m,g,h,y,b,w,E,T;i=t,c=((...e)=>{const t=o.findIndex((e=>s()===e));return e.map((([e,n])=>e[t]&&n)).filter((e=>e))})([[1,1,0],W({key:a})],[[1,1,1],V(t)],[[1,1,0],L],[[1,1,1],p],[[1,0,0],k()],[[1,1,1],$],[[1,1,1],H({history:!1})],[[1,1,0],S()],[[1,1,0],x],[[1,0,0],R],[[1,1,0],Z()],[[1,0,0],P()],[[1,0,0],te],[[1,1,1],v],[[1,1,0],ae]),f=1===(i.parent||i).nodeType?i.parent||i:document.querySelector(i.parent||i),m=[].filter.call("string"==typeof i.slides?f.querySelectorAll(i.slides):i.slides||f.children,(function(e){return"SCRIPT"!==e.nodeName})),g={},h=function(e,t){return(t=t||{}).index=m.indexOf(e),t.slide=e,t},w=function(e,t){m[e]&&(u&&b("deactivate",h(u,t)),u=m[e],b("activate",h(u,t)))},E=function(e,t){var n=m.indexOf(u)+e;b(e>0?"next":"prev",h(u,t))&&w(n,t)},T={off:y=function(e,t){g[e]=(g[e]||[]).filter((function(e){return e!==t}))},on:function(e,t){return(g[e]||(g[e]=[])).push(t),y.bind(null,e,t)},fire:b=function(e,t){return(g[e]||[]).reduce((function(e,n){return e&&!1!==n(t)}),!0)},slide:function(e,t){if(!arguments.length)return m.indexOf(u);b("slide",h(m[e],t))&&w(e,t)},next:E.bind(null,1),prev:E.bind(null,-1),parent:f,slides:m,destroy:function(e){b("destroy",h(u,e)),g={}}},(c||[]).forEach((function(e){e(T)})),u||w(0)})()}();</script></body></html>