Nek5000
SEM for Incompressible NS
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
findpts_local.c
Go to the documentation of this file.
1 #include <stdio.h>
2 
3 #include <stddef.h>
4 #include <stdlib.h>
5 #include <math.h>
6 #include <string.h>
7 #include "c99.h"
8 #include "types.h"
9 #include "name.h"
10 #include "fail.h"
11 #include "mem.h"
12 #include "obbox.h"
13 #include "poly.h"
14 #include "sort.h"
15 #include "sarray_sort.h"
16 #include "findpts_el.h"
17 
18 struct uint_range { uint min, max; };
19 struct index_el { uint index, el; };
20 
21 static struct dbl_range dbl_range_merge(struct dbl_range a, struct dbl_range b)
22 {
23  struct dbl_range m;
24  m.min = b.min<a.min?b.min:a.min,
25  m.max = a.max>b.max?a.max:b.max;
26  return m;
27 }
28 
29 static sint ifloor(double x) { return floor(x); }
30 static sint iceil (double x) { return ceil (x); }
31 
32 static uint hash_index_aux(double low, double fac, uint n, double x)
33 {
34  const sint i = ifloor((x-low)*fac);
35  return i<0 ? 0 : (n-1<(uint)i ? n-1 : (uint)i);
36 }
37 
38 #define CODE_INTERNAL 0
39 #define CODE_BORDER 1
40 #define CODE_NOT_FOUND 2
41 
42 #define D 2
43 #define WHEN_3D(a)
44 #include "findpts_local_imp.h"
45 #undef WHEN_3D
46 #undef D
47 
48 #define D 3
49 #define WHEN_3D(a) a
50 #include "findpts_local_imp.h"
51 #undef WHEN_3D
52 #undef D
#define uint
Definition: types.h:70
static struct dbl_range dbl_range_merge(struct dbl_range a, struct dbl_range b)
Definition: findpts_local.c:21
#define sint
Definition: types.h:69
n
Definition: xxt_test.m:73
double max
Definition: lob_bnd.c:21
#define x
uint index
Definition: findpts_local.c:19
for i
Definition: xxt_test.m:74
static uint hash_index_aux(double low, double fac, uint n, double x)
Definition: findpts_local.c:32
static sint iceil(double x)
Definition: findpts_local.c:30
double min
Definition: lob_bnd.c:21
establishes some macros to establish naming conventions
static sint ifloor(double x)
Definition: findpts_local.c:29