|
Basilisk CFD
Adaptive Cartesian mesh PDE framework
|
#include "kinds_and_types.h"#include "put_get.h"Go to the source code of this file.
Data Structures | |
| struct | dtype_type |
| struct | descriptor_dimension |
| struct | gfc_array_descriptor |
| struct | cvmix_2d |
Macros | |
| #define | strlencheck(s) (s != NULL ? strlen(s) : 0) |
| #define | cvmix_deallocate(a) cvmix_deallocate_(a) |
| #define | cvmix_2d(c, len1, i, j) (c).a[(i) + (j)*(len1)] |
Typedefs | |
| typedef int | indexing |
| We define a data structure describing the array descriptor of gfortran as documented here. | |
| typedef double | cvmix_r8 |
| typedef int | logical |
| typedef int | integer |
| typedef struct gfc_array_descriptor | cvmix_1d |
| typedef cvmix_1d | cvmix_nd |
Functions | |
| void | cvmix_redirect_stdout_ (void) |
| void | allocate1d_ (const int *len, cvmix_1d *mem) |
| void | deallocate1d_ (cvmix_1d *mem) |
| void | allocate2d_ (const int *len1, const int *len2, cvmix_2d *mem) |
| void | deallocate2d_ (cvmix_2d *mem) |
| void | sizeofall_ (void) |
| void | cvmix_deallocate_ (cvmix_data_type *CVmix_vars) |
| cvmix_1d | cvmix_allocate_1d (int len) |
| void | cvmix_deallocate_1d (cvmix_1d a) |
| void | cvmix_1d_print (cvmix_1d *a) |
| cvmix_2d | cvmix_allocate_2d (int len1, int len2) |
| void | cvmix_deallocate_2d (cvmix_2d a) |
Variables | |
| cvmix_r8 | cvmix_zero = 0. |
| cvmix_r8 | cvmix_one = 1. |
We define a data structure describing the array descriptor of gfortran as documented here.
Community Ocean Vertical Mixing (CVMix) is a software package that aims to provide transparent, robust, flexible, well documented, shared Fortran source code for use in parameterizing vertical mixing processes in numerical ocean models.
This header file provides a C-language interface for Basilisk (and other projects, since the interface does not depend on Basilisk itself).
CVMix needs to be installed first and its source code must be accessible, since the C interface is generated automatically from the Fortran sources.
Once this done the C interface can be built using this [Makefile]() and the correct location for the sources and/or Fortran compiler. For example:
Aside from standard considerations on compatibility of different types between C and Fortran (as documented here for example), the main difficulty is interoperability of ["assumed size arrays"](https://thinkingeek.com/2017/01/14/gfortran-array-descriptor/).
The approach taken here is a bit of a hack and should be replaced with a more portable way of doing things when it becomes available.
For the moment, it relies on the assumption that the "shaped array descriptor" works in a similar manner to that of gfortran. These assumptions are:
sizeof(cvmix_1d)).integer, cvmix_r8, character, logical and derived types composed of these.If any of these assumptions is violated, the most likely result will be a low-level memory fault (i.e. segmentation fault, stack smashing etc.). Note that the goal is only to define a cvmix_1d structure which occupies the right amount of memory so that conditions 2 and 4 above are verified. The actual members are never used, with the exception of gfc_array_descriptor.a which corresponds to assumption 1 above.
Definition at line 133 of file cvmix.h.
References a, and allocate1d_().
Definition at line 154 of file cvmix.h.
References a, allocate2d_(), and x.
|
extern |
Definition at line 140 of file cvmix.h.
References a, and deallocate1d_().
Definition at line 161 of file cvmix.h.
References a, and deallocate2d_().