source: CIVL/include/headers/fortran_array.cvh@ 1aaefd4

main test-branch
Last change on this file since 1aaefd4 was ea777aa, checked in by Alex Wilton <awilton@…>, 3 years ago

Moved examples, include, build_default.properties, common.xml, and README out from dev.civl.com into the root of the repo.

git-svn-id: svn://vsl.cis.udel.edu/civl/trunk@5704 fb995dde-84ed-4084-dfe6-e5aef3e2452c

  • Property mode set to 100644
File size: 2.7 KB
Line 
1/* This header file contains the function prototypes for
2 * transforming Fortran arrays.
3 */
4
5#ifndef __FORTRANARRAY_H__
6#define __FORTRANARRAY_H__
7
8#include <stdlib.h>
9#include <stdio.h>
10
11/* 3 for left-bound, right-bound, and stride. */
12#define SIZE_IDX_INFO 3
13
14/* ********************************* Types ********************************* */
15
16/* The kind of a Fortran array descriptor. */
17
18/* The memory space storing all data objects and only
19 * referenced by a SOURCE fortran array descriptor
20 */
21typedef struct FORTRAN_ARRAY_MEMORY *farr_mem;
22
23/* A Fortran array descriptor indicating a Fortran array,
24 * which is any of three kinds mentioned above.
25 */
26typedef struct FORTRAN_ARRAY_DESCRIPTOR *farr_desc;
27
28
29/* **************************** Misc. Functions **************************** */
30/* Creates a Fortran array descriptor
31 * for a variable declaration with an array type.
32 */
33farr_desc farr_create(
34 size_t type, // The type of array element
35 int rank, // The rank/dimensions
36 int rank_info[SIZE_IDX_INFO][rank]
37 // All indexing info for each dim.
38);
39
40/* Creates a Fortran array descriptor
41 * for an array sectioned from an base array.
42 */
43farr_desc farr_section(
44 farr_desc arr, // The descriptor of the base array.
45 int sect_info[SIZE_IDX_INFO][]
46 // All indexing info for each dim.
47);
48
49farr_desc farr_section_full (
50 farr_desc arr // The descriptor of the base array.
51);
52
53/* Creates a Fortran array descriptor
54 * for an array reshaped from an base array.
55 */
56farr_desc farr_reshape(
57 farr_desc arr, // The descriptor of the base array.
58 int rank, // The new rank for reshaping.
59 int rshp_info[SIZE_IDX_INFO][rank]
60 // All indexing info for each dim.
61);
62
63/* Destroys a Fortran array descriptor
64 * Note that this function only free the outer-most
65 * descriptor if the given descriptor kind is NOT 'SOURCE'.
66 */
67void farr_destroy(
68 farr_desc arr // The outer-most descriptor is freed
69);
70
71/* Operations */
72
73/* Gets the pointer to a Fortran array data object
74 * from the given array and the related indices.
75 */
76void *farr_subscript(
77 farr_desc arr, // The array descriptor
78 int indices[], // Indices for each rank/dim.
79 int isDirect
80);
81
82void *farr_c_array(
83 size_t type, // The type of array element
84 int rank, // The rank/dimensions
85 int rank_info[SIZE_IDX_INFO][rank]
86 // All indexing info for each dim.
87);
88
89/* Gets the allocation/creation status of a Fortran array descriptor.
90 * returns <code>0</code> iff <code>arr</code> is valid (or well-allocated);
91 * else returns <code>1</code>.
92 */
93int farr_stat(
94 farr_desc arr // The array descriptor
95);
96
97#endif
Note: See TracBrowser for help on using the repository browser.