Fortran

Guide To Learn

TCP server program: Receiving network connections

Perhaps the best advice is just to be careful. Don’t type things in you don’t understand. Debugging takes too much time. Have a mental picture (or a real drawing) of how your C code is using memory. That’s good advice in any language, but in C it’s critical.  –Nick Parlante, Essential C Although this quote […]

Installing libdill

Before we write any Fortran code, we’ll first download and compile the C library that we’ll work with: libdill. You can download the code from http://libdill.org/download .html. This page also includes brief installation instructions. For our work, we won’t need to install libdill systemwide. Instead, we’ll compile it and take a copy of the compiled library […]

Introducing networking to Fortran

The C programming model is that the programmer knows exactly what they want to do and how to use the language constructs to achieve that goal. The language lets the expert programmer express what they want in the minimum time by staying out of their way.  –Nick Parlante, Essential C While there are easier ways […]

Interfacing C: Writing a minimal TCP client and server

Some languages are forgiving. The programmer needs only a basic sense of how things work. Errors in the code are flagged by the compile-time or run-time system, and the programmer can muddle through and eventually fix things up to work correctly. The C language is not like that.   –Nick Parlante, Essential C C is a […]

Synchronizing parallel images on assignment

The steps for implementing a custom assignment are the same as those for an operator, with a few minor differences. Like other arithmetic operators, assignment is an operation with two operands, one on the left and one on the right. Unlike other arithmetic operators that take two input arguments and return a new value as […]

Implementing the arithmetic for the Field class

In section 10.3, we wrote a function that takes the difference between two datetime instances, which we then used to redefine the arithmetic operator -. Here, we take the exact same approach, except that we need to put some more leg work in. Take a look back at listing 10.7–we need to implement procedures to define each operator […]

A refresher on the Field class

Before we jump into the implementation of type-bound methods operators for the Field class, let’s refresh our memory on what this class is made of. In a nutshell, the Field class is a wrapper around the two-dimensional data array that stores the values of the field itself, and a few more components needed for the internal workings of the data structure, […]

Overriding operators in the tsunami simulator

You now have a good idea of how defining an arithmetic operator for use with derived types works. Let’s apply this knowledge to implement the full arithmetic for the Field type in the tsunami simulator. We implemented this derived type back in chapter 8, where we used it to model the physical properties of the water flow, such […]

Scroll to top