Skip to main content Accessibility help
×
Hostname: page-component-84b7d79bbc-x5cpj Total loading time: 0 Render date: 2024-07-26T18:38:43.849Z Has data issue: false hasContentIssue false

Nine - Advanced Topics

Published online by Cambridge University Press:  15 October 2009

Ed Akin
Affiliation:
Rice University, Houston
Get access

Summary

Managing Dynamic Memory

Grouping Tasks

Fortran 90 includes several features to give the programmer the tools necessary to manage dynamic memory usage. However, one tends to think of these tools as completely free-standing statements or functions. In practice, a large code often has several related arrays or pointers that need to be created and released from memory at the same time. Basically, that means we should supply subprograms that generalize the operations provided by the intrinsic functions allocated and associated.

Here we illustrate this concept with a segment of a class that came from a classic finite element analysis system. The attributes are various types of allocatable arrays – local integers that will establish the array sizes. Additional items required to manage the memory are accessed through the use association of the module, called system_constants. The encapsulated members include initialization, debugging, and printing subprograms as well as the actual memory management members.

Figure 9.1 shows segments of the code Elem_Type_Data_Class. Here the word “type” is not used in the language sense but to identify one of about 18 possible finite elements from an existing library (such as a line, triangle, tetrahedron, etc.). Among the class attributes note that the local integer array item, line 5, serves the purpose of checking for local fatal error checks. It is sized to receive the number of subgroup allocations. Recall that the allocate function has an optional status return code, stat=, lines 36, 37, and so forth.

Type
Chapter
Information
Publisher: Cambridge University Press
Print publication year: 2003

Access options

Get access to the full version of this content by using one of the access options below. (Log in options will check for institutional or personal access. Content may require purchase if you do not have access.)

Save book to Kindle

To save this book to your Kindle, first ensure coreplatform@cambridge.org is added to your Approved Personal Document E-mail List under your Personal Document Settings on the Manage Your Content and Devices page of your Amazon account. Then enter the ‘name’ part of your Kindle email address below. Find out more about saving to your Kindle.

Note you can select to save to either the @free.kindle.com or @kindle.com variations. ‘@free.kindle.com’ emails are free but can only be saved to your device when it is connected to wi-fi. ‘@kindle.com’ emails can be delivered even when you are not connected to wi-fi, but note that service fees apply.

Find out more about the Kindle Personal Document Service.

  • Advanced Topics
  • Ed Akin, Rice University, Houston
  • Book: Object-Oriented Programming via Fortran 90/95
  • Online publication: 15 October 2009
  • Chapter DOI: https://doi.org/10.1017/CBO9780511530111.010
Available formats
×

Save book to Dropbox

To save content items to your account, please confirm that you agree to abide by our usage policies. If this is the first time you use this feature, you will be asked to authorise Cambridge Core to connect with your account. Find out more about saving content to Dropbox.

  • Advanced Topics
  • Ed Akin, Rice University, Houston
  • Book: Object-Oriented Programming via Fortran 90/95
  • Online publication: 15 October 2009
  • Chapter DOI: https://doi.org/10.1017/CBO9780511530111.010
Available formats
×

Save book to Google Drive

To save content items to your account, please confirm that you agree to abide by our usage policies. If this is the first time you use this feature, you will be asked to authorise Cambridge Core to connect with your account. Find out more about saving content to Google Drive.

  • Advanced Topics
  • Ed Akin, Rice University, Houston
  • Book: Object-Oriented Programming via Fortran 90/95
  • Online publication: 15 October 2009
  • Chapter DOI: https://doi.org/10.1017/CBO9780511530111.010
Available formats
×