Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions MultiSource/Benchmarks/Olden/voronoi/args.c
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
/* For copyright information, see olden_v1.0/COPYRIGHT */

#include <stdlib.h>
#include <stdio.h>
#include <stdlib_checked.h>
#include <stdio_checked.h>

#pragma BOUNDS_CHECKED ON

extern int NumNodes,NDim;

Expand All @@ -15,7 +17,8 @@ int mylog(int num) {
return j;
}

int dealwithargs(int argc, char *argv[]) {
_Unchecked
int dealwithargs(int argc, _Array_ptr<char *> argv : count(argc)) {
int size;

if (argc > 3)
Expand Down
77 changes: 42 additions & 35 deletions MultiSource/Benchmarks/Olden/voronoi/defines.h
Original file line number Diff line number Diff line change
@@ -1,28 +1,30 @@
/* For copyright information, see olden_v1.0/COPYRIGHT */

#include <math.h>
#include <math_checked.h>

#pragma BOUNDS_CHECKED ON

typedef int BOOLEAN;
typedef unsigned long uptrint;

struct edge_rec {
struct VERTEX *v;
struct edge_rec *next;
_Ptr<struct VERTEX> v;
_Array_ptr<struct edge_rec> next : quad_bounds(next);
long wasseen;
void *Buffer;
_Array_ptr<void> Buffer;
};


struct get_point {
struct VERTEX *v;
_Ptr<struct VERTEX> v;
double curmax;
int seed;
};


typedef struct edge_rec *EDGE_PTR;
typedef struct VERTEX *VERTEX_PTR;
typedef struct edge_rec *QUAD_EDGE;
typedef _Ptr<struct edge_rec> EDGE_PTR;
typedef _Ptr<struct VERTEX> VERTEX_PTR;
typedef _Array_ptr<struct edge_rec> QUAD_EDGE;

struct VEC2 {
double x,y;
Expand All @@ -32,18 +34,18 @@ struct VEC2 {

struct VERTEX {
struct VEC2 v;
struct VERTEX *left, *right;
_Ptr<struct VERTEX> left, right;
};


typedef struct {
QUAD_EDGE left, right;
QUAD_EDGE left : quad_bounds(left), right : quad_bounds(right);
} EDGE_PAIR;


struct EDGE_STACK {
int ptr;
QUAD_EDGE *elts ;
_Array_ptr<QUAD_EDGE> elts : count(stack_size * 2);
int stack_size;
};

Expand Down Expand Up @@ -74,44 +76,47 @@ struct EDGE_STACK {
#define sym(a) ((QUAD_EDGE) (((uptrint) (a)) ^ 2*SIZE))
#define rot(a) ((QUAD_EDGE) ( (((uptrint) (a) + 1*SIZE) & ANDF) | ((uptrint) (a) & ~ANDF) ))
#define rotinv(a) ((QUAD_EDGE) ( (((uptrint) (a) + 3*SIZE) & ANDF) | ((uptrint) (a) & ~ANDF) ))
#define base(a) ((QUAD_EDGE) ((uptrint a) & ~ANDF))

QUAD_EDGE alloc_edge();
void free_edge(QUAD_EDGE e);
QUAD_EDGE makeedge();
void splice();
void swapedge();
void deleteedge();
QUAD_EDGE build_delaunay_triangulation();
#define base(a) ((QUAD_EDGE) (((uptrint) (a)) & ~ANDF))

#define quad_bounds(a) bounds(base(a), base(a) + 4)

QUAD_EDGE alloc_edge(void) : count(4);
void free_edge(QUAD_EDGE e : quad_bounds(e));
QUAD_EDGE makeedge(VERTEX_PTR origin, VERTEX_PTR destination) : count(4);
void splice(QUAD_EDGE a : quad_bounds(a), QUAD_EDGE b : quad_bounds(b));
void swapedge(QUAD_EDGE e : quad_bounds(e));
void deleteedge(QUAD_EDGE e : quad_bounds(e));
QUAD_EDGE build_delaunay_triangulation(VERTEX_PTR tree, VERTEX_PTR extra) : count(4);
EDGE_PAIR build_delaunay(VERTEX_PTR tree, VERTEX_PTR extra);
EDGE_PAIR do_merge(QUAD_EDGE ldo, QUAD_EDGE ldi, QUAD_EDGE rdi, QUAD_EDGE rdo);
QUAD_EDGE connect_left();
QUAD_EDGE connect_right();
EDGE_PAIR do_merge(QUAD_EDGE ldo : quad_bounds(ldo), QUAD_EDGE ldi : quad_bounds(ldi), QUAD_EDGE rdi : quad_bounds(rdi), QUAD_EDGE rdo : quad_bounds(rdo));
QUAD_EDGE connect_left(QUAD_EDGE a : quad_bounds(a), QUAD_EDGE b : quad_bounds(b)) : count(4);
QUAD_EDGE connect_right(QUAD_EDGE a : quad_bounds(a), QUAD_EDGE b : quad_bounds(b)) : count(4);

int myrandom(int seed);
void zero_seen();
QUAD_EDGE pop_edge();
void zero_seen(_Ptr<struct EDGE_STACK> my_stack, QUAD_EDGE edge : quad_bounds(edge));
QUAD_EDGE pop_edge(_Ptr<struct EDGE_STACK> x) : count(4);

#define drand(seed) (((double) (seed=myrandom(seed))) / (double) 2147483647)

extern VERTEX_PTR *vp ;
extern struct VERTEX *va ;
extern EDGE_PTR *next ;
extern VERTEX_PTR *org ;
extern _Ptr<VERTEX_PTR> vp ;
extern _Array_ptr<struct VERTEX> va ;
extern _Ptr<EDGE_PTR> next ;
extern _Ptr<VERTEX_PTR> org ;
extern int num_vertices, num_edgeparts, stack_size ;
extern int to_lincoln , to_off, to_3d_out, to_color , voronoi , delaunay , interactive , ahost ;
extern char *see;
extern _Array_ptr<char> see;
extern int NumNodes, NDim;


void push_ring(struct EDGE_STACK *stack, QUAD_EDGE edge);
void push_edge(struct EDGE_STACK *stack, QUAD_EDGE edge);
void push_ring(_Ptr<struct EDGE_STACK> stack, QUAD_EDGE edge : quad_bounds(edge));
void push_edge(_Ptr<struct EDGE_STACK> stack, QUAD_EDGE edge : quad_bounds(edge));
BOOLEAN ccw(VERTEX_PTR a, VERTEX_PTR b, VERTEX_PTR c);
int dealwithargs(int argc, char *argv[]);
void output_voronoi_diagram(QUAD_EDGE edge, int nv, struct EDGE_STACK *stack);
_Unchecked
int dealwithargs(int argc, _Array_ptr<char *> argv : count(argc));
void output_voronoi_diagram(QUAD_EDGE edge : quad_bounds(edge), int nv, _Ptr<struct EDGE_STACK> stack);
struct get_point get_points(int n, double curmax,int i, int seed,
int processor, int numnodes);
struct EDGE_STACK *allocate_stack(int num_vertices);
_Ptr<struct EDGE_STACK> allocate_stack(int num_vertices);


double V2_cprod(struct VEC2 u,struct VEC2 v);
Expand All @@ -121,3 +126,5 @@ struct VEC2 V2_sum(struct VEC2 u, struct VEC2 v);
struct VEC2 V2_sub(struct VEC2 u, struct VEC2 v);
double V2_magn(struct VEC2 u);
struct VEC2 V2_cross(struct VEC2 v);

#pragma BOUNDS_CHECKED OFF
Loading