moab
FindPtFuncs.h File Reference
#include "float.h"
#include "math.h"
#include <stdlib.h>

Go to the source code of this file.

Classes

struct  lagrange_data
struct  obbox_2
struct  obbox_3
struct  hash_data_2
struct  hash_data_3
struct  findpt_listel
struct  opt_edge_data_2
struct  opt_point_data_2
struct  opt_data_2
struct  findpt_data_2
struct  opt_face_data_3
struct  opt_edge_data_3
struct  opt_point_data_3
struct  opt_data_3
struct  findpt_data_3

Defines

#define INTEGER   int
#define GLOBAL_INT   long
#define floorr   floor
#define ceilr   ceil
#define sqrtr   sqrt
#define fabsr   fabs
#define cosr   cos
#define sinr   sin
#define EPS   (128*DBL_EPSILON)
#define PI   3.1415926535897932384626433832795028841971693993751058209749445923
#define uint   uint_
#define ulong   ulong_
#define sint   sint_
#define slong   slong_
#define MAYBE_UNUSED
#define tmalloc(type, count)   ((type*) smalloc((count)*sizeof(type),__FILE__) )
#define tcalloc(type, count)   ((type*) scalloc((count),sizeof(type),__FILE__) )
#define trealloc(type, ptr, count)   ((type*) srealloc((ptr),(count)*sizeof(type),__FILE__) )
#define MAYBE_UNUSED
#define DECLMINMAX(type, prefix)

Typedefs

typedef double real
typedef signed INTEGER sint
typedef unsigned INTEGER uint
typedef signed GLOBAL_INT slong
typedef unsigned GLOBAL_INT ulong
typedef int(* findpt_func )(void *, const real *, int, uint *, real *, real *)

Functions

void legendre_matrix (const real *x, int m, real *P, int n)
void legendre_matrix_t (const real *x, int m, real *P, int n)
void legendre_row (real x, real *P, int n)
void gauss_nodes (real *z, int n)
void lobatto_nodes (real *z, int n)
void gauss_weights (const real *z, real *w, int n)
void lobatto_weights (const real *z, real *w, int n)
void gauss_to_legendre (const real *z, const real *w, int n, real *J)
void gauss_to_legendre_t (const real *z, const real *w, int n, real *J)
void lobatto_to_legendre (const real *z, const real *w, int n, real *J)
void lagrange_weights (const real *z, unsigned n, const real *x, unsigned m, real *J, real *work)
void lagrange_weights_deriv (const real *z, unsigned n, const real *x, unsigned m, real *J, real *D, real *work)
void lagrange_setup (lagrange_data *p, const real *z, unsigned n)
void lagrange_free (lagrange_data *p)
void lagrange_0 (lagrange_data *p, real x)
void lagrange_1 (lagrange_data *p, real x)
void lagrange_2 (lagrange_data *p, real x)
void lagrange_2u (lagrange_data *p)
void tensor_c1 (const real *R, unsigned mr, unsigned nr, const real *u, real *v)
void tensor_r1 (const real *R, unsigned mr, unsigned nr, const real *u, real *v)
void tensor_c2 (const real *R, unsigned mr, unsigned nr, const real *S, unsigned ms, unsigned ns, const real *u, real *v, real *work)
void tensor_r2 (const real *R, unsigned mr, unsigned nr, const real *S, unsigned ms, unsigned ns, const real *u, real *v, real *work)
void tensor_c3 (const real *R, unsigned mr, unsigned nr, const real *S, unsigned ms, unsigned ns, const real *T, unsigned mt, unsigned nt, const real *u, real *v, real *work1, real *work2)
void tensor_r3 (const real *R, unsigned mr, unsigned nr, const real *S, unsigned ms, unsigned ns, const real *T, unsigned mt, unsigned nt, const real *u, real *v, real *work1, real *work2)
real tensor_i1 (const real *Jr, unsigned nr, const real *u)
real tensor_i2 (const real *Jr, unsigned nr, const real *Js, unsigned ns, const real *u, real *work)
real tensor_i3 (const real *Jr, unsigned nr, const real *Js, unsigned ns, const real *Jt, unsigned nt, const real *u, real *work)
real tensor_ig1 (const real *Jr, const real *Dr, unsigned nr, const real *u, real *g)
real tensor_ig2 (const real *Jr, const real *Dr, unsigned nr, const real *Js, const real *Ds, unsigned ns, const real *u, real *g, real *work)
real tensor_ig3 (const real *Jr, const real *Dr, unsigned nr, const real *Js, const real *Ds, unsigned ns, const real *Jt, const real *Dt, unsigned nt, const real *u, real *g, real *work)
findpt_data_2findpt_setup_2 (const real *const xw[2], const unsigned n[2], uint nel, uint max_hash_size, real bbox_tol)
findpt_data_3findpt_setup_3 (const real *const xw[3], const unsigned n[3], uint nel, uint max_hash_size, real bbox_tol)
void findpt_free_2 (findpt_data_2 *p)
void findpt_free_3 (findpt_data_3 *p)
const realfindpt_allbnd_2 (const findpt_data_2 *p)
const realfindpt_allbnd_3 (const findpt_data_3 *p)
int findpt_2 (findpt_data_2 *p, const real x[2], int guess, uint *el, real r[2], real *dist)
int findpt_3 (findpt_data_3 *p, const real x[3], int guess, uint *el, real r[3], real *dist)
void findpt_weights_2 (findpt_data_2 *p, const real r[2])
void findpt_weights_3 (findpt_data_3 *p, const real r[3])
double findpt_eval_2 (findpt_data_2 *p, const real *u)
double findpt_eval_3 (findpt_data_3 *p, const real *u)
void opt_alloc_3 (opt_data_3 *p, lagrange_data *ld)
void opt_free_3 (opt_data_3 *p)
double opt_findpt_3 (opt_data_3 *p, const real *const elx[3], const real xstar[3], real r[3], unsigned *constr)
void opt_vol_set_intp_3 (opt_data_3 *p, const real r[3])
void opt_alloc_2 (opt_data_2 *p, lagrange_data *ld)
void opt_free_2 (opt_data_2 *p)
double opt_findpt_2 (opt_data_2 *p, const real *const elx[2], const real xstar[2], real r[2], unsigned *constr)
void fail (const char *fmt,...)
static void * smalloc (size_t size, const char *file) MAYBE_UNUSED
static void * scalloc (size_t nmemb, size_t size, const char *file) MAYBE_UNUSED
static void * srealloc (void *ptr, size_t size, const char *file) MAYBE_UNUSED
static real r1norm_1 (real a) MAYBE_UNUSED
static real r1norm_2 (real a, real b) MAYBE_UNUSED
static real r1norm_3 (real a, real b, real c) MAYBE_UNUSED
static real r2norm_1 (real a) MAYBE_UNUSED
static real r2norm_2 (real a, real b) MAYBE_UNUSED
static real r2norm_3 (real a, real b, real c) MAYBE_UNUSED

Variables

const unsigned opt_no_constraints_2
const unsigned opt_no_constraints_3

Define Documentation

#define ceilr   ceil

Definition at line 56 of file FindPtFuncs.h.

#define cosr   cos

Definition at line 59 of file FindPtFuncs.h.

#define DECLMINMAX (   type,
  prefix 
)
Value:
static type prefix##min_2(type a, type b) MAYBE_UNUSED;               \
  static type prefix##min_2(type a, type b) {                           \
    return b<a?b:a;                                                     \
  }                                                                     \
  static type prefix##max_2(type a, type b) MAYBE_UNUSED;               \
  static type prefix##max_2(type a, type b) {                           \
    return a>b?a:b;                                                     \
  }                                                                     \
  static void prefix##minmax_2(type *min, type *max, type a,            \
                               type b) MAYBE_UNUSED;                    \
  static void prefix##minmax_2(type *min, type *max, type a, type b) {  \
    if(b<a) *min=b, *max=a;                                             \
    else *min=a, *max=b;                                                \
  }                                                                     \
  static type prefix##min_3(type a, type b, type c) MAYBE_UNUSED;       \
  static type prefix##min_3(type a, type b, type c) {                   \
    return b<a?(c<b?c:b):(c<a?c:a);                                     \
  }                                                                     \
  static type prefix##max_3(type a, type b, type c) MAYBE_UNUSED;       \
  static type prefix##max_3(type a, type b, type c) {                   \
    return a>b?(a>c?a:c):(b>c?b:c);                                     \
  }                                                                     \
  static void prefix##minmax_3(type *min, type *max, type a, type b,    \
                               type c) MAYBE_UNUSED;                    \
  static void prefix##minmax_3(type *min, type *max, type a, type b,    \
                               type c) {                                \
    if(b<a) *min=prefix##min_2(b,c), *max=prefix##max_2(a,c);           \
    else    *min=prefix##min_2(a,c), *max=prefix##max_2(b,c);           \
  }

Definition at line 610 of file FindPtFuncs.h.

#define EPS   (128*DBL_EPSILON)

Definition at line 61 of file FindPtFuncs.h.

#define fabsr   fabs

Definition at line 58 of file FindPtFuncs.h.

#define floorr   floor

Definition at line 55 of file FindPtFuncs.h.

#define GLOBAL_INT   long

Definition at line 29 of file FindPtFuncs.h.

#define INTEGER   int

Definition at line 20 of file FindPtFuncs.h.

#define MAYBE_UNUSED

Definition at line 607 of file FindPtFuncs.h.

#define MAYBE_UNUSED

Definition at line 607 of file FindPtFuncs.h.

#define PI   3.1415926535897932384626433832795028841971693993751058209749445923

Definition at line 62 of file FindPtFuncs.h.

#define sinr   sin

Definition at line 60 of file FindPtFuncs.h.

#define sint   sint_

Definition at line 68 of file FindPtFuncs.h.

#define slong   slong_

Definition at line 69 of file FindPtFuncs.h.

#define sqrtr   sqrt

Definition at line 57 of file FindPtFuncs.h.

#define tcalloc (   type,
  count 
)    ((type*) scalloc((count),sizeof(type),__FILE__) )

Definition at line 564 of file FindPtFuncs.h.

#define tmalloc (   type,
  count 
)    ((type*) smalloc((count)*sizeof(type),__FILE__) )

Definition at line 562 of file FindPtFuncs.h.

#define trealloc (   type,
  ptr,
  count 
)    ((type*) srealloc((ptr),(count)*sizeof(type),__FILE__) )

Definition at line 566 of file FindPtFuncs.h.

#define uint   uint_

Definition at line 66 of file FindPtFuncs.h.

#define ulong   ulong_

Definition at line 67 of file FindPtFuncs.h.


Typedef Documentation

typedef int(* findpt_func)(void *, const real *, int, uint *, real *, real *)

Definition at line 468 of file FindPtFuncs.h.

typedef double real

Definition at line 54 of file FindPtFuncs.h.

typedef signed INTEGER sint

Definition at line 71 of file FindPtFuncs.h.

typedef signed GLOBAL_INT slong

Definition at line 76 of file FindPtFuncs.h.

typedef unsigned INTEGER uint

Definition at line 72 of file FindPtFuncs.h.

typedef unsigned GLOBAL_INT ulong

Definition at line 77 of file FindPtFuncs.h.


Function Documentation

void fail ( const char *  fmt,
  ... 
)

Definition at line 12 of file TupleList.cpp.

{
  va_list ap;
  va_start(ap, fmt);
  vfprintf(stderr, fmt, ap);
  va_end(ap);
  exit(1);
}
int findpt_2 ( findpt_data_2 p,
const real  x[2],
int  guess,
uint el,
real  r[2],
real dist 
)
int findpt_3 ( findpt_data_3 p,
const real  x[3],
int  guess,
uint el,
real  r[3],
real dist 
)
const real* findpt_allbnd_2 ( const findpt_data_2 p)
const real* findpt_allbnd_3 ( const findpt_data_3 p)
double findpt_eval_2 ( findpt_data_2 p,
const real u 
) [inline]

Definition at line 391 of file SpectralFuncs.hpp.

{
  return tensor_i2(p->ld[0].J,p->ld[0].n,
                   p->ld[1].J,p->ld[1].n,
                   u, p->od_work);
}
double findpt_eval_3 ( findpt_data_3 p,
const real u 
) [inline]

Definition at line 398 of file SpectralFuncs.hpp.

{
  return tensor_i3(p->ld[0].J,p->ld[0].n,
                   p->ld[1].J,p->ld[1].n,
                   p->ld[2].J,p->ld[2].n,
                   u, p->od_work);
}
findpt_data_2* findpt_setup_2 ( const real *const  xw[2],
const unsigned  n[2],
uint  nel,
uint  max_hash_size,
real  bbox_tol 
)
findpt_data_3* findpt_setup_3 ( const real *const  xw[3],
const unsigned  n[3],
uint  nel,
uint  max_hash_size,
real  bbox_tol 
)
void findpt_weights_2 ( findpt_data_2 p,
const real  r[2] 
) [inline]

Definition at line 378 of file SpectralFuncs.hpp.

{
  lagrange_0(&p->ld[0],r[0]);
  lagrange_0(&p->ld[1],r[1]);
}
void findpt_weights_3 ( findpt_data_3 p,
const real  r[3] 
) [inline]

Definition at line 384 of file SpectralFuncs.hpp.

{
  lagrange_0(&p->ld[0],r[0]);
  lagrange_0(&p->ld[1],r[1]);
  lagrange_0(&p->ld[2],r[2]);
}
void gauss_nodes ( real z,
int  n 
)
void gauss_to_legendre ( const real z,
const real w,
int  n,
real J 
)
void gauss_to_legendre_t ( const real z,
const real w,
int  n,
real J 
)
void gauss_weights ( const real z,
real w,
int  n 
)
void lagrange_0 ( lagrange_data p,
real  x 
)
void lagrange_1 ( lagrange_data p,
real  x 
)
void lagrange_2 ( lagrange_data p,
real  x 
)
void lagrange_2u ( lagrange_data p)
void lagrange_setup ( lagrange_data p,
const real z,
unsigned  n 
)
void lagrange_weights ( const real z,
unsigned  n,
const real x,
unsigned  m,
real J,
real work 
)
void lagrange_weights_deriv ( const real z,
unsigned  n,
const real x,
unsigned  m,
real J,
real D,
real work 
)
void legendre_matrix ( const real x,
int  m,
real P,
int  n 
)
void legendre_matrix_t ( const real x,
int  m,
real P,
int  n 
)
void legendre_row ( real  x,
real P,
int  n 
)
void lobatto_nodes ( real z,
int  n 
)
void lobatto_to_legendre ( const real z,
const real w,
int  n,
real J 
)
void lobatto_weights ( const real z,
real w,
int  n 
)
void opt_alloc_2 ( opt_data_2 p,
lagrange_data ld 
)
void opt_alloc_3 ( opt_data_3 p,
lagrange_data ld 
)
double opt_findpt_2 ( opt_data_2 p,
const real *const  elx[2],
const real  xstar[2],
real  r[2],
unsigned *  constr 
)
double opt_findpt_3 ( opt_data_3 p,
const real *const  elx[3],
const real  xstar[3],
real  r[3],
unsigned *  constr 
)
void opt_free_2 ( opt_data_2 p)
void opt_free_3 ( opt_data_3 p)
void opt_vol_set_intp_3 ( opt_data_3 p,
const real  r[3] 
)
static real r1norm_1 ( real  a) [static]

Definition at line 647 of file FindPtFuncs.h.

                             {
  return fabsr(a);
}
static real r1norm_2 ( real  a,
real  b 
) [static]

Definition at line 651 of file FindPtFuncs.h.

                                     {
  return fabsr(a)+fabsr(b);
}
static real r1norm_3 ( real  a,
real  b,
real  c 
) [static]

Definition at line 655 of file FindPtFuncs.h.

                                             {
  return fabsr(a)+fabsr(b)+fabsr(c);
}
static real r2norm_1 ( real  a) [static]

Definition at line 659 of file FindPtFuncs.h.

                             {
  return sqrtr(a*a);
}
static real r2norm_2 ( real  a,
real  b 
) [static]

Definition at line 663 of file FindPtFuncs.h.

                                     {
  return sqrtr(a*a+b*b);
}
static real r2norm_3 ( real  a,
real  b,
real  c 
) [static]

Definition at line 667 of file FindPtFuncs.h.

                                             {
  return sqrtr(a*a+b*b+c*c);
}
static void * scalloc ( size_t  nmemb,
size_t  size,
const char *  file 
) [static]

Definition at line 546 of file FindPtFuncs.h.

{
  void *res = calloc(nmemb, size);
  if(!res && nmemb)
    fail("%s: allocation of %d bytes failed\n",file,(int)size*nmemb);
  return res;
}
static void * smalloc ( size_t  size,
const char *  file 
) [static]

Definition at line 538 of file FindPtFuncs.h.

{
  void *res = malloc(size);
  if(!res && size) fail("%s: allocation of %d bytes failed\n",file,(int)size);
  return res;
}
static void * srealloc ( void *  ptr,
size_t  size,
const char *  file 
) [static]

Definition at line 555 of file FindPtFuncs.h.

{
  void *res = realloc(ptr, size);
  if(!res && size) fail("%s: allocation of %d bytes failed\n",file,(int)size);
  return res;
}
void tensor_c1 ( const real R,
unsigned  mr,
unsigned  nr,
const real u,
real v 
)
void tensor_c2 ( const real R,
unsigned  mr,
unsigned  nr,
const real S,
unsigned  ms,
unsigned  ns,
const real u,
real v,
real work 
)
void tensor_c3 ( const real R,
unsigned  mr,
unsigned  nr,
const real S,
unsigned  ms,
unsigned  ns,
const real T,
unsigned  mt,
unsigned  nt,
const real u,
real v,
real work1,
real work2 
)
real tensor_i1 ( const real Jr,
unsigned  nr,
const real u 
)
real tensor_i2 ( const real Jr,
unsigned  nr,
const real Js,
unsigned  ns,
const real u,
real work 
)
real tensor_i3 ( const real Jr,
unsigned  nr,
const real Js,
unsigned  ns,
const real Jt,
unsigned  nt,
const real u,
real work 
)
real tensor_ig1 ( const real Jr,
const real Dr,
unsigned  nr,
const real u,
real g 
)
real tensor_ig2 ( const real Jr,
const real Dr,
unsigned  nr,
const real Js,
const real Ds,
unsigned  ns,
const real u,
real g,
real work 
)
real tensor_ig3 ( const real Jr,
const real Dr,
unsigned  nr,
const real Js,
const real Ds,
unsigned  ns,
const real Jt,
const real Dt,
unsigned  nt,
const real u,
real g,
real work 
)
void tensor_r1 ( const real R,
unsigned  mr,
unsigned  nr,
const real u,
real v 
)
void tensor_r2 ( const real R,
unsigned  mr,
unsigned  nr,
const real S,
unsigned  ms,
unsigned  ns,
const real u,
real v,
real work 
)
void tensor_r3 ( const real R,
unsigned  mr,
unsigned  nr,
const real S,
unsigned  ms,
unsigned  ns,
const real T,
unsigned  mt,
unsigned  nt,
const real u,
real v,
real work1,
real work2 
)

Variable Documentation

const unsigned opt_no_constraints_2

Definition at line 445 of file SpectralFuncs.hpp.

const unsigned opt_no_constraints_3

Definition at line 446 of file SpectralFuncs.hpp.

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines