<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic I can't address all of your in Intel® Fortran Compiler</title>
    <link>https://community.intel.com/t5/Intel-Fortran-Compiler/A-lot-of-parameters-to-be-passed-in-subroutine/m-p/982064#M99956</link>
    <description>&lt;P&gt;I can't address all of your questions, but heres the short form of advice.&lt;/P&gt;
&lt;P&gt;In the old days of classical FORTRAN (before Fortran 90) this problem (excessive argument list) would have been solved using COMMON blocks--i.e., groups of related variables (related in the sense that they tend to be needed in the same subroutines) would be collected and specified as a named group for storage. Then the common group name is simply given at the start of any subroutine that needs any of the variables.&lt;/P&gt;
&lt;P&gt;But this was not always so simple, and somewhat error prone, The method still works, but as of Fortran 90 there are modules that make the same idea easier to implement, maintain, and less error prone. Basically the same groups of related variables are declared in a module ExampleModuleName. Then, in any subroutine that needs any of the varables in this group, you simply add the statement USE&amp;nbsp;ExampleModuleName. There are some additional features that enhance this method, including initialization control of the variables, exposing only a selected subset of the list to the subroutine, and changing variable names if necessary.&lt;/P&gt;
&lt;P&gt;Read any book on modern Fortran and it will discuss this technique in depth.&lt;/P&gt;</description>
    <pubDate>Fri, 23 Aug 2013 16:38:41 GMT</pubDate>
    <dc:creator>dboggs</dc:creator>
    <dc:date>2013-08-23T16:38:41Z</dc:date>
    <item>
      <title>A lot of parameters to be passed in subroutine</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/A-lot-of-parameters-to-be-passed-in-subroutine/m-p/982063#M99955</link>
      <description>&lt;P&gt;Hello,&lt;BR /&gt;&lt;BR /&gt;Would you please advise me how it is better to write code in fortran.&lt;BR /&gt;In my programs I use many subprograms like this:&lt;/P&gt;
&lt;P&gt;[fortran] pure subroutine SofcElStateUpdate( &amp;amp;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ! input&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; OptionTerm, ActiveAreaCm2, ElThick, AnSigmaP, CtSigmaP, OhmCoeff, OhmTMult,&amp;nbsp;&amp;nbsp; &amp;amp; &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; CtActivCoeff1, CtDiffCoeff1, OhmConstCm2, T, FuelP, FuelMFrac, OxidantP,&amp;nbsp;&amp;nbsp; &amp;amp; &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; OxidantMFrac, OptionCalc, FuelG, OxidantG, &amp;amp;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ! output&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; AnGasP, AnGasG, AnGasMFrac, CtGasP, CtGasG, CtGasMFrac, Alpha,&amp;nbsp;&amp;nbsp; &amp;amp; &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; YSZConduction, MeanPO2Ct, MeanPInertCt, OhmCm2YSZ, OhmCm2Rest, OhmCm2CtActiv, OhmCm2CtDiff,&amp;nbsp;&amp;nbsp; &amp;amp; &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; EMF0, EMF, VoltLossYSZ, VoltLossRest, VoltLossConst, VoltLossCtActiv, VoltLossCtDiff,&amp;nbsp;&amp;nbsp; &amp;amp; &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; VoltLossMass, Volt, Current, CurrentLim, CurrentCm2, CurrentCm2Lim, CurrentCm2LimDiff,&amp;nbsp;&amp;nbsp; &amp;amp; &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Pow, PowCm2, DeltaH, DeltaS, DeltaG, KPDTerm, KPDVolt,&amp;nbsp;&amp;nbsp; &amp;amp; &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; RInner, RLoad, KR, QHeat, QHeatEntropy, QHeatOhm, SGasUtil,&amp;nbsp; O2Util, O2ElToAnIn )&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;&amp;nbsp; real, intent(in) :: &amp;amp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; OptionTerm, ActiveAreaCm2, ElThick, AnSigmaP, CtSigmaP, OhmCoeff, OhmTMult,&amp;nbsp;&amp;nbsp; &amp;amp; &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; CtActivCoeff1, CtDiffCoeff1, OhmConstCm2, T, FuelP, FuelMFrac, OxidantP,&amp;nbsp;&amp;nbsp; &amp;amp; &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; OxidantMFrac, OptionCalc, FuelG, OxidantG&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;&amp;nbsp; real, intent(out) :: &amp;amp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; AnGasP, AnGasG, AnGasMFrac, CtGasP, CtGasG, CtGasMFrac, Alpha,&amp;nbsp;&amp;nbsp; &amp;amp; &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; YSZConduction, MeanPO2Ct, MeanPInertCt, OhmCm2YSZ, OhmCm2Rest, OhmCm2CtActiv, OhmCm2CtDiff,&amp;nbsp;&amp;nbsp; &amp;amp; &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; EMF0, EMF, VoltLossYSZ, VoltLossRest, VoltLossConst, VoltLossCtActiv, VoltLossCtDiff,&amp;nbsp;&amp;nbsp; &amp;amp; &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; VoltLossMass, Volt, Current, CurrentLim, CurrentCm2, CurrentCm2Lim, CurrentCm2LimDiff,&amp;nbsp;&amp;nbsp; &amp;amp; &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Pow, PowCm2, DeltaH, DeltaS, DeltaG, KPDTerm, KPDVolt,&amp;nbsp;&amp;nbsp; &amp;amp; &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; RInner, RLoad, KR, QHeat, QHeatEntropy, QHeatOhm, SGasUtil,&amp;nbsp; O2Util, O2ElToAnIn&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; .......&lt;BR /&gt;&lt;BR /&gt;end subroutine [/fortran]&lt;/P&gt;
&lt;P&gt;As you can see there is a lot of variables to be passed to the subprogram. Moreover there is&lt;BR /&gt;a need to repeat declaration of all variables. Logically it would be better if fortran let the following form of declaration:&lt;/P&gt;
&lt;P&gt;[fortran] pure subroutine SofcElStateUpdate( &amp;amp;&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp; real, intent(in) :: &amp;amp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; OptionTerm, ActiveAreaCm2, ElThick, AnSigmaP, CtSigmaP, OhmCoeff, OhmTMult,&amp;nbsp;&amp;nbsp; &amp;amp; &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; CtActivCoeff1, CtDiffCoeff1, OhmConstCm2, T, FuelP, FuelMFrac, OxidantP,&amp;nbsp;&amp;nbsp; &amp;amp; &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; OxidantMFrac, OptionCalc, FuelG, OxidantG,&lt;BR /&gt;&amp;nbsp;&lt;BR /&gt;&amp;nbsp; real, intent(out) :: &amp;amp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; AnGasP, AnGasG, AnGasMFrac, CtGasP, CtGasG, CtGasMFrac, Alpha,&amp;nbsp;&amp;nbsp; &amp;amp; &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; YSZConduction, MeanPO2Ct, MeanPInertCt, OhmCm2YSZ, OhmCm2Rest, OhmCm2CtActiv, OhmCm2CtDiff,&amp;nbsp;&amp;nbsp; &amp;amp; &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; EMF0, EMF, VoltLossYSZ, VoltLossRest, VoltLossConst, VoltLossCtActiv, VoltLossCtDiff,&amp;nbsp;&amp;nbsp; &amp;amp; &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; VoltLossMass, Volt, Current, CurrentLim, CurrentCm2, CurrentCm2Lim, CurrentCm2LimDiff,&amp;nbsp;&amp;nbsp; &amp;amp; &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Pow, PowCm2, DeltaH, DeltaS, DeltaG, KPDTerm, KPDVolt,&amp;nbsp;&amp;nbsp; &amp;amp; &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; RInner, RLoad, KR, QHeat, QHeatEntropy, QHeatOhm, SGasUtil,&amp;nbsp;&amp;nbsp; &amp;amp; &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; O2Util, O2ElToAnIn&amp;nbsp;&amp;nbsp; )&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; .......&lt;BR /&gt;&lt;BR /&gt;end subroutine [/fortran]&lt;/P&gt;
&lt;P&gt;In this form there is no duplicating of variable declaration.&lt;/P&gt;
&lt;P&gt;However the problem is as following:&lt;BR /&gt;&lt;BR /&gt;Using pure procedures and implicite declaration as well as atributes like intent(in) intent(out) let compose safe programs. Compiler can warn that all output data will be initialized, that all input data will be not changed and so on. And if the subroutine is called as:&lt;/P&gt;
&lt;P&gt;[fortran] call&amp;nbsp;SofcElStateUpdate( OptionTerm = 1, ActiveAreaCm2 = ActiveAreaCm2, ElThick = ElThick , AnSigmaP = SigmaP, &amp;amp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; CtSigmaP = SigmaP&amp;nbsp; ..... )&amp;nbsp; [/fortran]&lt;/P&gt;
&lt;P&gt;so it is guaranteed that all variables are positioned correctly.&lt;/P&gt;
&lt;P&gt;But what is to do with so many variables in the interface of the subroutine?&lt;BR /&gt;Is it a bad practice to use such subprograms with a lot of variables to be passed?&lt;BR /&gt;I now that using types (structures) or global variables leads to the fact that no more garanty can be given if all input data are initialized, if all output data became defined and so on.&lt;/P&gt;
&lt;P&gt;thanks in advance.&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 23 Aug 2013 10:54:36 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/A-lot-of-parameters-to-be-passed-in-subroutine/m-p/982063#M99955</guid>
      <dc:creator>Averkov__Igor</dc:creator>
      <dc:date>2013-08-23T10:54:36Z</dc:date>
    </item>
    <item>
      <title>I can't address all of your</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/A-lot-of-parameters-to-be-passed-in-subroutine/m-p/982064#M99956</link>
      <description>&lt;P&gt;I can't address all of your questions, but heres the short form of advice.&lt;/P&gt;
&lt;P&gt;In the old days of classical FORTRAN (before Fortran 90) this problem (excessive argument list) would have been solved using COMMON blocks--i.e., groups of related variables (related in the sense that they tend to be needed in the same subroutines) would be collected and specified as a named group for storage. Then the common group name is simply given at the start of any subroutine that needs any of the variables.&lt;/P&gt;
&lt;P&gt;But this was not always so simple, and somewhat error prone, The method still works, but as of Fortran 90 there are modules that make the same idea easier to implement, maintain, and less error prone. Basically the same groups of related variables are declared in a module ExampleModuleName. Then, in any subroutine that needs any of the varables in this group, you simply add the statement USE&amp;nbsp;ExampleModuleName. There are some additional features that enhance this method, including initialization control of the variables, exposing only a selected subset of the list to the subroutine, and changing variable names if necessary.&lt;/P&gt;
&lt;P&gt;Read any book on modern Fortran and it will discuss this technique in depth.&lt;/P&gt;</description>
      <pubDate>Fri, 23 Aug 2013 16:38:41 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/A-lot-of-parameters-to-be-passed-in-subroutine/m-p/982064#M99956</guid>
      <dc:creator>dboggs</dc:creator>
      <dc:date>2013-08-23T16:38:41Z</dc:date>
    </item>
    <item>
      <title>Another method is to use</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/A-lot-of-parameters-to-be-passed-in-subroutine/m-p/982065#M99957</link>
      <description>&lt;P&gt;Another method is to use internal procedures. You declare the variables in the outer procedure and then call the inner procedure without passing arguments - the inner procedure can "uplevel access" variables in the parent.&lt;/P&gt;</description>
      <pubDate>Fri, 23 Aug 2013 17:33:00 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/A-lot-of-parameters-to-be-passed-in-subroutine/m-p/982065#M99957</guid>
      <dc:creator>Steven_L_Intel1</dc:creator>
      <dc:date>2013-08-23T17:33:00Z</dc:date>
    </item>
    <item>
      <title>I thought about the modules,</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/A-lot-of-parameters-to-be-passed-in-subroutine/m-p/982066#M99958</link>
      <description>&lt;P&gt;I thought about the modules, types and common bloks. Use of data from the module or structured data is connected with the difficulty of understanding what data needs to be specified, and which will be calculated. If the subroutine SofcElStateUpdate descriebed above is used so it is exactly clear what kind of data are the input and what are the output, and this is controlled on compiler level, not by only human attention. If data in the module are used so you can only rely on human attention.&lt;/P&gt;</description>
      <pubDate>Sun, 25 Aug 2013 08:39:04 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/A-lot-of-parameters-to-be-passed-in-subroutine/m-p/982066#M99958</guid>
      <dc:creator>Averkov__Igor</dc:creator>
      <dc:date>2013-08-25T08:39:04Z</dc:date>
    </item>
    <item>
      <title>As others said, there may be</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/A-lot-of-parameters-to-be-passed-in-subroutine/m-p/982067#M99959</link>
      <description>&lt;P&gt;As others said, there may be better solutions with respect to assuring correctness.&amp;nbsp; Current ifort invokes automatic generation of interface checks in Visual Studio GUI mode; it might be awkward to maintain explicit interface blocks.&lt;/P&gt;
&lt;P&gt;From the point of view of performance, calling procedures with long argument lists in inner loops is bad.&amp;nbsp; The fill buffers of current architectures will not be used efficiently, while the long argument lists will likely prevent the compiler from saving the day by inter-procedural optimization.&amp;nbsp; The preceding thread doesn't give information to know whether these objections would apply.&lt;/P&gt;</description>
      <pubDate>Sun, 25 Aug 2013 11:50:04 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/A-lot-of-parameters-to-be-passed-in-subroutine/m-p/982067#M99959</guid>
      <dc:creator>TimP</dc:creator>
      <dc:date>2013-08-25T11:50:04Z</dc:date>
    </item>
    <item>
      <title>io77: You can improve the</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/A-lot-of-parameters-to-be-passed-in-subroutine/m-p/982068#M99960</link>
      <description>&lt;P&gt;io77: You can improve the situation a bit by putting all input variables into one module, all output variables into another module, and so on.&lt;/P&gt;

&lt;P&gt;Of course, there are limits to what you can do in this way if the same variables are presently used as input values in some calls and output values in other calls. Overall, you are better off choosing a combination of tactics to reduce the number of arguments being passed to subroutines. As you have yourself observed, no single tactic will do all the things that you desire.&lt;/P&gt;</description>
      <pubDate>Sun, 25 Aug 2013 14:01:00 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/A-lot-of-parameters-to-be-passed-in-subroutine/m-p/982068#M99960</guid>
      <dc:creator>mecej4</dc:creator>
      <dc:date>2013-08-25T14:01:00Z</dc:date>
    </item>
    <item>
      <title>I would like to suggest that</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/A-lot-of-parameters-to-be-passed-in-subroutine/m-p/982069#M99961</link>
      <description>&lt;P&gt;I would like to suggest that you consider&amp;nbsp;using a type declaration. This way the subroutine could handle multiple such types and do so concurrently if written correctly. This gives you much more flexibility.&lt;/P&gt;
&lt;P&gt;Jim Dempsey&lt;/P&gt;</description>
      <pubDate>Sun, 25 Aug 2013 14:22:03 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/A-lot-of-parameters-to-be-passed-in-subroutine/m-p/982069#M99961</guid>
      <dc:creator>jimdempseyatthecove</dc:creator>
      <dc:date>2013-08-25T14:22:03Z</dc:date>
    </item>
  </channel>
</rss>

