Nek5000
SEM for Incompressible NS
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
Classes | Macros | Functions
xxt.c File Reference
#include <stddef.h>
#include <stdlib.h>
#include <stdio.h>
#include <limits.h>
#include <float.h>
#include <string.h>
#include <math.h>
#include "c99.h"
#include "name.h"
#include "fail.h"
#include "types.h"
#include "tensor.h"
#include "gs_defs.h"
#include "comm.h"
#include "mem.h"
#include "sort.h"
#include "sarray_sort.h"
#include "sparse_cholesky.h"
#include "gs.h"
+ Include dependency graph for xxt.c:

Go to the source code of this file.

Classes

struct  csr_mat
 
struct  xxt
 
struct  dof
 
struct  yale_mat
 

Macros

#define crs_setup   PREFIXED_NAME(crs_setup)
 
#define crs_solve   PREFIXED_NAME(crs_solve)
 
#define crs_stats   PREFIXED_NAME(crs_stats)
 
#define crs_free   PREFIXED_NAME(crs_free )
 
#define UINT_BITS   (sizeof(uint)*CHAR_BIT)
 
#define BITS(i)   ((UINT_BITS+(1<<(i))-1)>>(i))
 
#define MASK(i)   ((((uint)1<<BITS(i)) - 1) << BITS(i))
 
#define CHECK(i)   if((BITS(i)!=1) && (v&MASK(i))) v>>=BITS(i), r+=BITS(i)
 

Functions

static unsigned lg (uint v)
 
static void locate_proc (struct xxt *data)
 
static void discover_sep_sizes (struct xxt *data, struct array *dofa, buffer *buf)
 
static ulongunique_nonzero (ulong *A, ulong *Aend)
 
static void merge_sep_ids (struct xxt *data, ulong *sep_id, ulong *other, ulong *work, unsigned s0, buffer *buf)
 
static void init_sep_ids (struct xxt *data, struct array *dofa, ulong *xid)
 
static void find_perm_x2c (uint ln, uint cn, const struct array *dofc, uint xn, const ulong *xid, sint *perm)
 
static sintdiscover_sep_ids (struct xxt *data, struct array *dofa, buffer *buf)
 
static void apply_QQt (struct xxt *data, double *v, uint n, uint tag)
 
static double sum (struct xxt *data, double v, uint n, uint tag)
 
static uint unique_ids (uint n, const ulong *id, sint *perm, buffer *buf)
 
static void discover_dofs (struct xxt *data, uint n, const ulong *id, struct array *dofa, buffer *buf, const struct comm *comm)
 
static void apply_p_Als (double *vl, struct xxt *data, const double *vs, uint ns)
 
static void apply_m_Asl (double *vs, uint ns, struct xxt *data, const double *vl)
 
static void apply_S_col (double *vs, struct xxt *data, struct csr_mat *A_ss, uint ei, double *vl)
 
static void apply_S (double *Svs, uint ns, struct xxt *data, struct csr_mat *A_ss, const double *vs, double *vl)
 
static void apply_Xt (double *vx, uint nx, const struct xxt *data, const double *vs)
 
static void apply_X (double *vs, uint ns, const struct xxt *data, const double *vx, uint nx)
 
static void allocate_X (struct xxt *data, sint *perm_x2c)
 
static void orthogonalize (struct xxt *data, struct csr_mat *A_ss, sint *perm_x2c, buffer *buf)
 
static void condense_matrix (struct array *mat, uint nr, struct csr_mat *out, buffer *buf)
 
static void separate_matrix (uint nz, const uint *Ai, const uint *Aj, const double *A, const sint *perm, uint ln, uint sn, struct csr_mat *out_ll, struct csr_mat *out_sl, struct csr_mat *out_ss, buffer *buf)
 
struct xxtcrs_setup (uint n, const ulong *id, uint nz, const uint *Ai, const uint *Aj, const double *A, uint null_space, const struct comm *comm)
 
void crs_solve (double *x, struct xxt *data, const double *b)
 
void crs_stats (struct xxt *data)
 
void crs_free (struct xxt *data)
 

Macro Definition Documentation

#define BITS (   i)    ((UINT_BITS+(1<<(i))-1)>>(i))
#define CHECK (   i)    if((BITS(i)!=1) && (v&MASK(i))) v>>=BITS(i), r+=BITS(i)

Referenced by lg().

#define crs_free   PREFIXED_NAME(crs_free )

Definition at line 24 of file xxt.c.

#define crs_setup   PREFIXED_NAME(crs_setup)

Definition at line 21 of file xxt.c.

#define crs_solve   PREFIXED_NAME(crs_solve)

Definition at line 22 of file xxt.c.

#define crs_stats   PREFIXED_NAME(crs_stats)

Definition at line 23 of file xxt.c.

#define MASK (   i)    ((((uint)1<<BITS(i)) - 1) << BITS(i))
#define UINT_BITS   (sizeof(uint)*CHAR_BIT)

Function Documentation

static void allocate_X ( struct xxt data,
sint perm_x2c 
)
static

Definition at line 593 of file xxt.c.

References i, xxt::null_space, tmalloc, uint, xxt::X, xxt::xn, and xxt::Xp.

Referenced by orthogonalize().

+ Here is the caller graph for this function:

static void apply_m_Asl ( double *  vs,
uint  ns,
struct xxt data,
const double *  vl 
)
static

Definition at line 516 of file xxt.c.

References A, csr_mat::A, xxt::A_sl, csr_mat::Aj, Aj, csr_mat::Arp, i, ns, p, and uint.

Referenced by apply_S(), apply_S_col(), and crs_solve().

+ Here is the caller graph for this function:

static void apply_p_Als ( double *  vl,
struct xxt data,
const double *  vs,
uint  ns 
)
static

Definition at line 504 of file xxt.c.

References A, csr_mat::A, xxt::A_sl, csr_mat::Aj, Aj, csr_mat::Arp, i, ns, p, and uint.

Referenced by apply_S(), and crs_solve().

+ Here is the caller graph for this function:

static void apply_QQt ( struct xxt data,
double *  v,
uint  n,
uint  tag 
)
static

Definition at line 360 of file xxt.c.

References xxt::combuf, xxt::comm, comm_isend(), comm_recv(), comm_send(), comm_wait(), i, n, p, xxt::plevels, xxt::pother, xxt::req, xxt::sep_size, sint, and uint.

Referenced by crs_solve(), and orthogonalize().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void apply_S ( double *  Svs,
uint  ns,
struct xxt data,
struct csr_mat A_ss,
const double *  vs,
double *  vl 
)
static

Definition at line 548 of file xxt.c.

References csr_mat::A, csr_mat::Aj, apply_m_Asl(), apply_p_Als(), csr_mat::Arp, Ass, xxt::fac_A_ll, i, xxt::ln, ns, p, sparse_cholesky_solve, sum(), and uint.

Referenced by orthogonalize().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void apply_S_col ( double *  vs,
struct xxt data,
struct csr_mat A_ss,
uint  ei,
double *  vl 
)
static

Definition at line 528 of file xxt.c.

References csr_mat::A, xxt::A_sl, csr_mat::Aj, apply_m_Asl(), csr_mat::Arp, Ass, xxt::fac_A_ll, i, xxt::ln, p, sparse_cholesky_solve, and uint.

Referenced by orthogonalize().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void apply_X ( double *  vs,
uint  ns,
const struct xxt data,
const double *  vx,
uint  nx 
)
static

Definition at line 580 of file xxt.c.

References i, n, ns, nx, uint, x, X, xxt::X, and xxt::Xp.

Referenced by crs_solve(), and orthogonalize().

+ Here is the caller graph for this function:

static void apply_Xt ( double *  vx,
uint  nx,
const struct xxt data,
const double *  vs 
)
static

Definition at line 572 of file xxt.c.

References i, nx, tensor_dot, uint, X, xxt::X, and xxt::Xp.

Referenced by crs_solve(), and orthogonalize().

+ Here is the caller graph for this function:

static void condense_matrix ( struct array mat,
uint  nr,
struct csr_mat out,
buffer buf 
)
static

Definition at line 647 of file xxt.c.

References csr_mat::A, csr_mat::Aj, csr_mat::Arp, i, yale_mat::i, yale_mat::j, csr_mat::n, array::n, nr, nz, p, array::ptr, sarray_sort_2, tmalloc, uint, and yale_mat::v.

Referenced by separate_matrix().

+ Here is the caller graph for this function:

void crs_free ( struct xxt data)

Definition at line 837 of file xxt.c.

References csr_mat::A, xxt::A_sl, csr_mat::Arp, xxt::comm, comm_free(), xxt::fac_A_ll, xxt::null_space, xxt::perm_u2c, xxt::pother, xxt::req, xxt::sep_size, xxt::share_weight, sparse_cholesky_free, xxt::vl, xxt::X, and xxt::Xp.

+ Here is the call graph for this function:

struct xxt* crs_setup ( uint  n,
const ulong id,
uint  nz,
const uint Ai,
const uint Aj,
const double *  A,
uint  null_space,
const struct comm comm 
)

Definition at line 710 of file xxt.c.

References csr_mat::A, xxt::A_sl, csr_mat::Aj, csr_mat::Arp, array_free, buffer_free, buffer_init, xxt::cn, xxt::combuf, xxt::comm, comm_dup, dof::count, discover_dofs(), discover_sep_ids(), discover_sep_sizes(), xxt::fac_A_ll, i, xxt::ln, locate_proc(), csr_mat::n, xxt::null_space, orthogonalize(), xxt::perm_u2c, array::ptr, separate_matrix(), xxt::share_weight, sint, xxt::sn, sparse_cholesky_factor, sum(), tmalloc, uint, xxt::vc, xxt::vl, xxt::vx, and xxt::xn.

+ Here is the call graph for this function:

void crs_solve ( double *  x,
struct xxt data,
const double *  b 
)

Definition at line 772 of file xxt.c.

References apply_m_Asl(), apply_p_Als(), apply_QQt(), apply_X(), apply_Xt(), xxt::cn, xxt::fac_A_ll, i, xxt::ln, xxt::null_space, p, xxt::perm_u2c, xxt::share_weight, sint, xxt::sn, sparse_cholesky_solve, sum(), uint, xxt::un, xxt::vc, xxt::vl, xxt::vx, and xxt::xn.

+ Here is the call graph for this function:

void crs_stats ( struct xxt data)

Definition at line 812 of file xxt.c.

References xxt::comm, comm_allreduce(), comm::id, xxt::ln, xxt::nsep, xxt::null_space, xxt::sep_size, xxt::sn, uint, xxt::xn, and xxt::Xp.

+ Here is the call graph for this function:

static void discover_dofs ( struct xxt data,
uint  n,
const ulong id,
struct array dofa,
buffer buf,
const struct comm comm 
)
static

Definition at line 463 of file xxt.c.

References array_init, buffer_reserve, xxt::cn, dof::count, gs, gs_crystal_router, gs_free, gs_setup, gs_sint, i, dof::level, lg(), n, array::n, ns, xxt::nsep, p, xxt::pcoord, xxt::perm_u2c, array::ptr, sarray_permute_buf, sint, slong, sortp(), tmalloc, uint, ulong, xxt::un, and unique_ids().

Referenced by crs_setup().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static sint* discover_sep_ids ( struct xxt data,
struct array dofa,
buffer buf 
)
static

Definition at line 311 of file xxt.c.

References xxt::cn, xxt::comm, comm_recv(), comm_send(), find_perm_x2c(), init_sep_ids(), xxt::ln, merge_sep_ids(), ns, xxt::nsep, p, xxt::plevels, xxt::pother, xxt::sep_size, sint, tmalloc, uint, ulong, work, and xxt::xn.

Referenced by crs_setup().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void discover_sep_sizes ( struct xxt data,
struct array dofa,
buffer buf 
)
static

Definition at line 185 of file xxt.c.

References buffer_reserve, xxt::cn, xxt::comm, comm_recv(), comm_send(), dof::count, i, dof::level, xxt::ln, n, array::n, ns, xxt::nsep, xxt::plevels, xxt::pother, array::ptr, xxt::sep_size, sint, xxt::sn, tmalloc, uint, and xxt::xn.

Referenced by crs_setup().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void find_perm_x2c ( uint  ln,
uint  cn,
const struct array dofc,
uint  xn,
const ulong xid,
sint perm 
)
static

Definition at line 296 of file xxt.c.

References i, dof::id, array::ptr, uint, and ulong.

Referenced by discover_sep_ids().

+ Here is the caller graph for this function:

static void init_sep_ids ( struct xxt data,
struct array dofa,
ulong xid 
)
static

Definition at line 271 of file xxt.c.

References xxt::cn, i, dof::id, dof::level, xxt::ln, n, ns, xxt::nsep, array::ptr, xxt::sep_size, uint, and ulong.

Referenced by discover_sep_ids().

+ Here is the caller graph for this function:

static unsigned lg ( uint  v)
static

Definition at line 37 of file xxt.c.

References CHECK.

Referenced by discover_dofs().

+ Here is the caller graph for this function:

static void locate_proc ( struct xxt data)
static

Definition at line 148 of file xxt.c.

References xxt::comm, comm::id, n, comm::np, xxt::nsep, xxt::pcoord, xxt::plevels, xxt::pother, xxt::req, sint, tmalloc, and uint.

Referenced by crs_setup().

+ Here is the caller graph for this function:

static void merge_sep_ids ( struct xxt data,
ulong sep_id,
ulong other,
ulong work,
unsigned  s0,
buffer buf 
)
static

Definition at line 253 of file xxt.c.

References ns, xxt::nsep, p, xxt::sep_size, sortv_long, uint, ulong, and unique_nonzero().

Referenced by discover_sep_ids().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void orthogonalize ( struct xxt data,
struct csr_mat A_ss,
sint perm_x2c,
buffer buf 
)
static

Definition at line 607 of file xxt.c.

References allocate_X(), apply_QQt(), apply_S(), apply_S_col(), apply_X(), apply_Xt(), buffer_reserve, i, xxt::ln, ns, xxt::null_space, array::ptr, sint, xxt::sn, sum(), tensor_dot, uint, x, xxt::X, xxt::xn, and xxt::Xp.

Referenced by crs_setup().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void separate_matrix ( uint  nz,
const uint Ai,
const uint Aj,
const double *  A,
const sint perm,
uint  ln,
uint  sn,
struct csr_mat out_ll,
struct csr_mat out_sl,
struct csr_mat out_ss,
buffer buf 
)
static

Definition at line 676 of file xxt.c.

References array_free, array_init, condense_matrix(), i, yale_mat::i, yale_mat::j, n, array::n, nz, array::ptr, sint, uint, and yale_mat::v.

Referenced by crs_setup().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static double sum ( struct xxt data,
double  v,
uint  n,
uint  tag 
)
static

Definition at line 400 of file xxt.c.

References xxt::comm, comm_isend(), comm_recv(), comm_send(), comm_wait(), n, xxt::plevels, xxt::pother, xxt::req, xxt::sep_size, sint, and uint.

Referenced by apply_S(), byte_bits(), cggo(), poisson::cos_test(), count_bits(), crs_setup(), crs_solve(), crystal_exchange(), findpts_el_2(), findpts_el_3(), hash_build(), hmh_gmres(), main(), orthogonalize(), radix_offsets(), poisson::spectral_solve(), tensor_dot(), and volume().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static uint unique_ids ( uint  n,
const ulong id,
sint perm,
buffer buf 
)
static

Definition at line 441 of file xxt.c.

References i, n, array::n, p, sortp_long, uint, and ulong.

Referenced by discover_dofs().

+ Here is the caller graph for this function:

static ulong* unique_nonzero ( ulong A,
ulong Aend 
)
static

Definition at line 236 of file xxt.c.

References A, p, and ulong.

Referenced by merge_sep_ids().

+ Here is the caller graph for this function: