-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBCFortranArray.h
70 lines (43 loc) · 1.71 KB
/
BCFortranArray.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
//
// BCFortranArray.h
// MindsEye
//
// Created by Tom Houpt on 5/9/13.
// Copyright (c) 2013 BehavioralCybernetics LLC. All rights reserved.
//
#import <Foundation/Foundation.h>
enum {kIntegerArray, kDoubleArray};
@interface BCFortranArray : NSObject
/* utility classes for managing 1 or 2 dimensional double/integer arrays
data stored in malloc'd unsigned char *buffer, with 2D array stored like pixels in an image (i.e. y sequential rows of x size each)
For compatiblity with ported FORTRAN code, array elements are accessed using 1-indexing (not 0-indexing)
e.g. [NSFortranArray valueAtX:1] returns buffer[0]
e.g. [NSFortranArray valueAtX:max_x] returns buffer[max_x-1]
*/
@property (assign) NSUInteger dimension;
@property (assign) NSUInteger max_x;
@property (assign) NSUInteger max_y;
@property (assign) NSInteger arrayType;
@property (assign) unsigned char *buffer;
-(id)init1DWithMaxX:(NSUInteger)x;
-(id)init2DWithMaxX:(NSUInteger)x andMaxY:(NSUInteger)y;
-(id)initWithDimension:(NSUInteger)d andMaxX:(NSUInteger)x andMaxY:(NSUInteger)y;
-(void)dealloc;
-(NSUInteger)sizeOfElements;
@end
@interface BCFortranIntegerArray : BCFortranArray
-(NSUInteger)sizeOfElements;
-(void)initType;
-(NSInteger)valueAtX:(NSUInteger)x;
-(NSInteger)valueAtX:(NSUInteger)x andY:(NSUInteger)y;
-(void)setX:(NSUInteger)x toValue:(NSInteger)v;
-(void)setX:(NSUInteger)x andY:(NSUInteger)y toValue:(NSInteger)v;
@end
@interface BCFortranDoubleArray : BCFortranArray
-(NSUInteger)sizeOfElements;
-(void)initType;
-(double)valueAtX:(NSUInteger)x;
-(double)valueAtX:(NSUInteger)x andY:(NSUInteger)y;
-(void)setX:(NSUInteger)x toValue:(double)v;
-(void)setX:(NSUInteger)x andY:(NSUInteger)y toValue:(double)v;
@end