fclib.h File Reference
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include <hdf5.h>
#include <hdf5_hl.h>
Include dependency graph for fclib.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  fclib_info
 This structure allows the user to enter a problem information as a title, a short description and known mathematical properties of the problem. More...
 
struct  fclib_matrix_info
 This structure allows the user to enter a description for a given matrix (comment, conditionning, determinant, rank.) if they are known. More...
 
struct  fclib_matrix
 matrix in compressed row/column or triplet form More...
 
struct  fclib_global
 The global frictional contact problem defined by. More...
 
struct  fclib_local
 The local frictional contact problem defined by. More...
 
struct  fclib_solution
 A solution or a guess for the frictional contact problem. More...
 

Macros

#define FCLIB_APICOMPILE
 
#define FCLIB_STATIC   static
 
#define FCLIB_IMPLEMENTATION
 
#define H5Gcreate_vers   2
 
#define H5Gopen_vers   2
 
#define ASSERT(Test, ...)
 
#define IO(Call)   ASSERT ((Call) >= 0, "ERROR: HDF5 call failed")
 
#define MM(Call)   ASSERT ((Call), "ERROR: out of memory")
 

Functions

FCLIB_STATIC int fclib_write_global (struct fclib_global *problem, const char *path)
 write global problem; return 1 on success, 0 on failure More...
 
FCLIB_STATIC int fclib_write_local (struct fclib_local *problem, const char *path)
 write local problem; return 1 on success, 0 on failure More...
 
FCLIB_STATIC int fclib_write_solution (struct fclib_solution *solution, const char *path)
 write solution; return 1 on success, 0 on failure More...
 
FCLIB_STATIC int fclib_write_guesses (int number_of_guesses, struct fclib_solution *guesses, const char *path)
 write initial guesses; return 1 on success, 0 on failure More...
 
FCLIB_STATIC struct fclib_globalfclib_read_global (const char *path)
 read global problem; return problem on success; NULL on failure More...
 
FCLIB_STATIC struct fclib_localfclib_read_local (const char *path)
 read local problem; return problem on success; NULL on failure More...
 
FCLIB_STATIC struct fclib_solutionfclib_read_solution (const char *path)
 read solution; return solution on success; NULL on failure More...
 
FCLIB_STATIC struct fclib_solutionfclib_read_guesses (const char *path, int *number_of_guesses)
 read initial guesses; return vector of guesses on success; NULL on failure; output number of guesses in the variable pointed by 'number_of_guesses' More...
 
FCLIB_STATIC void fclib_delete_global (struct fclib_global *problem)
 delete global problem More...
 
FCLIB_STATIC void fclib_delete_local (struct fclib_local *problem)
 delete local problem More...
 
FCLIB_STATIC void fclib_delete_solutions (struct fclib_solution *data, int count)
 delete solutions or guesses More...
 
FCLIB_STATIC int fclib_create_int_attributes_in_info (const char *path, const char *attr_name, int attr_value)
 create and set attributes of tyoe int in info More...
 
FCLIB_STATIC hid_t H5Gmake (hid_t loc_id, const char *name)
 make group More...
 
FCLIB_STATIC void write_matrix (hid_t id, struct fclib_matrix *mat)
 write matrix More...
 
FCLIB_STATIC struct fclib_matrixread_matrix (hid_t id)
 read matrix More...
 
FCLIB_STATIC void write_global_vectors (hid_t id, struct fclib_global *problem)
 write global vectors More...
 
FCLIB_STATIC void read_global_vectors (hid_t id, struct fclib_global *problem)
 read global vectors More...
 
FCLIB_STATIC void write_local_vectors (hid_t id, struct fclib_local *problem)
 write local vectors More...
 
FCLIB_STATIC void read_local_vectors (hid_t id, struct fclib_local *problem)
 read local vectors More...
 
FCLIB_STATIC void write_problem_info (hid_t id, struct fclib_info *info)
 write problem info More...
 
FCLIB_STATIC struct fclib_inforead_problem_info (hid_t id)
 read problem info More...
 
FCLIB_STATIC void write_solution (hid_t id, struct fclib_solution *solution, hsize_t nv, hsize_t nr, hsize_t nl)
 write solution More...
 
FCLIB_STATIC void read_solution (hid_t id, hsize_t nv, hsize_t nr, hsize_t nl, struct fclib_solution *solution)
 read solution More...
 
FCLIB_STATIC int read_nvnunrnl (hid_t file_id, int *nv, int *nr, int *nl)
 read solution sizes More...
 
FCLIB_STATIC void delete_matrix_info (struct fclib_matrix_info *info)
 delete matrix info More...
 
FCLIB_STATIC void delete_matrix (struct fclib_matrix *mat)
 delete matrix More...
 
FCLIB_STATIC void delete_info (struct fclib_info *info)
 delete problem info More...
 

Variables

enum FCLIB_APICOMPILE fclib_merit
 
 MERIT_1
 

Detailed Description


frictional contact library interface

This C API provides functions to read and write Frictional contact problems in HDF5 format Two kind of problem are considered Given

  • a symmetric positive semi–definite matrix \({W} \in {\mathrm{I\!R}}^{m \times m} \)
  • a vector \( {q} \in {\mathrm{I\!R}}^m\)
  • a vector of coefficients of friction \(\mu \in{\mathrm{I\!R}}^{n_c}\)

the local FC problem is to find two vectors \(u\in{\ensuremath{\mathrm{I\!R}}}^m\), the relative local velocity and \(r\in {\ensuremath{\mathrm{I\!R}}}^m\), the contact forces denoted by \(\mathrm{FC}(W,q,\mu)\) such that

\begin{eqnarray*} \begin{cases} \hat u = W r + q +\left[ \left[\begin{array}{c} \mu^\alpha \|u^\alpha_T\|\ \ 0 \ \ 0 \end{array}\right]^T, \alpha = 1 \ldots n_c \right]^T \\ \ \ C^\star_{\mu} \ni {\hat u} \perp r \in C_{\mu} \end{cases} \end{eqnarray*}

where the Coulomb friction cone for a contact \(\alpha\) is defined by

\begin{eqnarray*} \label{eq:CCC} C_{\mu^\alpha}^{\alpha} = \{r^\alpha, \|r^\alpha_T \| \leq \mu^\alpha |r^\alpha_N| \} *\end{eqnarray*}

and the set \(C^{\alpha,\star}_{\mu^\alpha}\) is its dual. We are also dealing with global FC problem defined by Given

  • a symmetric positive definite matrix \({M} \in {\mathrm{I\!R}}^{n \times n}\)
  • a vector \( {f} \in {\mathrm{I\!R}}^n\),
  • a matrix \({H} \in {\mathrm{I\!R}}^{n \times m}\)
  • a matrix \({G} \in {\mathrm{I\!R}}^{n \times p}\)
  • a vector \(w \in {\mathrm{I\!R}}^{m}\),
  • a vector \(b \in {\mathrm{I\!R}}^{p}\),
  • a vector of coefficients of friction \(\mu \in {\mathrm{I\!R}}^{n_c}\)

the Global Mixed 3DFC problem is to find four vectors \( {v} \in {\mathrm{I\!R}}^n\), \(u\in{\mathrm{I\!R}}^m\), \(r\in {\mathrm{I\!R}}^m\) and \(\lambda \in {\mathrm{I\!R}}^p\) denoted by \(\mathrm{GM3DFC}(M,H,G,w,b,\mu)\) such that

\begin{eqnarray*} \begin{cases} M v = {H} {r} + G\lambda + {f} \\ \ \ G^T v +b =0 \\ \ \ \hat u = H^T v + w +\left[ \left[\begin{array}{c} \mu \|u^\alpha_T\|\ \ 0 \ \ 0 \end{array}\right]^T, \alpha = 1 \ldots n_c \right]^T \\ \ \ C^\star_{\mu} \ni {\hat u} \perp r \in C_{\mu} \end{cases} \end{eqnarray*}

Definition in file fclib.h.

Macro Definition Documentation

◆ FCLIB_APICOMPILE

#define FCLIB_APICOMPILE

Definition at line 91 of file fclib.h.

◆ FCLIB_STATIC

#define FCLIB_STATIC   static

Definition at line 96 of file fclib.h.

◆ FCLIB_IMPLEMENTATION

#define FCLIB_IMPLEMENTATION

Definition at line 97 of file fclib.h.

◆ H5Gcreate_vers

#define H5Gcreate_vers   2

Definition at line 103 of file fclib.h.

◆ H5Gopen_vers

#define H5Gopen_vers   2

Definition at line 104 of file fclib.h.

◆ ASSERT

#define ASSERT (   Test,
  ... 
)
Value:
do {\
if (! (Test)) { fprintf (stderr, "%s: %d => ", __FILE__, __LINE__);\
fprintf (stderr, __VA_ARGS__);\
fprintf (stderr, "\n"); exit (1); } } while (0)

Definition at line 370 of file fclib.h.

Referenced by fclib_write_global(), fclib_write_local(), read_global_vectors(), read_local_vectors(), read_matrix(), read_solution(), write_global_vectors(), write_local_vectors(), write_matrix(), and write_solution().

◆ IO

◆ MM

#define MM (   Call)    ASSERT ((Call), "ERROR: out of memory")

Function Documentation

◆ fclib_write_global()

FCLIB_STATIC int FCLIB_APICOMPILE fclib_write_global ( struct fclib_global problem,
const char *  path 
)

write global problem; return 1 on success, 0 on failure

Definition at line 781 of file fclib.h.

References ASSERT, fclib_global::G, fclib_global::H, H5Gmake(), fclib_global::info, IO, fclib_global::M, fclib_global::spacedim, write_global_vectors(), write_matrix(), and write_problem_info().

Referenced by main().

Here is the call graph for this function:

◆ fclib_write_local()

FCLIB_STATIC int FCLIB_APICOMPILE fclib_write_local ( struct fclib_local problem,
const char *  path 
)

write local problem; return 1 on success, 0 on failure

Definition at line 853 of file fclib.h.

References ASSERT, H5Gmake(), fclib_local::info, IO, fclib_local::R, fclib_local::spacedim, fclib_local::V, fclib_local::W, write_local_vectors(), write_matrix(), and write_problem_info().

Referenced by main().

Here is the call graph for this function:

◆ fclib_write_solution()

FCLIB_STATIC int FCLIB_APICOMPILE fclib_write_solution ( struct fclib_solution solution,
const char *  path 
)

write solution; return 1 on success, 0 on failure

Definition at line 921 of file fclib.h.

References H5Gmake(), IO, read_nvnunrnl(), and write_solution().

Referenced by main().

Here is the call graph for this function:

◆ fclib_write_guesses()

FCLIB_STATIC int FCLIB_APICOMPILE fclib_write_guesses ( int  number_of_guesses,
struct fclib_solution guesses,
const char *  path 
)

write initial guesses; return 1 on success, 0 on failure

Definition at line 961 of file fclib.h.

References H5Gmake(), IO, read_nvnunrnl(), and write_solution().

Referenced by main().

Here is the call graph for this function:

◆ fclib_read_global()

FCLIB_STATIC struct FCLIB_APICOMPILE fclib_global * fclib_read_global ( const char *  path)

read global problem; return problem on success; NULL on failure

Definition at line 1011 of file fclib.h.

References fclib_global::G, fclib_global::H, fclib_global::info, IO, fclib_global::M, MM, read_global_vectors(), read_matrix(), read_problem_info(), and fclib_global::spacedim.

Referenced by main().

Here is the call graph for this function:

◆ fclib_read_local()

FCLIB_STATIC struct FCLIB_APICOMPILE fclib_local * fclib_read_local ( const char *  path)

read local problem; return problem on success; NULL on failure

Definition at line 1061 of file fclib.h.

References fclib_local::info, IO, MM, fclib_local::R, read_local_vectors(), read_matrix(), read_problem_info(), fclib_local::spacedim, fclib_local::V, and fclib_local::W.

Referenced by main().

Here is the call graph for this function:

◆ fclib_read_solution()

FCLIB_STATIC struct FCLIB_APICOMPILE fclib_solution * fclib_read_solution ( const char *  path)

read solution; return solution on success; NULL on failure

Definition at line 1117 of file fclib.h.

References IO, MM, read_nvnunrnl(), and read_solution().

Referenced by main().

Here is the call graph for this function:

◆ fclib_read_guesses()

FCLIB_STATIC struct FCLIB_APICOMPILE fclib_solution * fclib_read_guesses ( const char *  path,
int *  number_of_guesses 
)

read initial guesses; return vector of guesses on success; NULL on failure; output number of guesses in the variable pointed by 'number_of_guesses'

read initial guesses; return vector of guesses on success; NULL on failure; output numebr of guesses in the variable pointed by 'number_of_guesses'

Definition at line 1145 of file fclib.h.

References IO, MM, read_nvnunrnl(), and read_solution().

Referenced by main().

Here is the call graph for this function:

◆ fclib_delete_global()

FCLIB_STATIC void FCLIB_APICOMPILE fclib_delete_global ( struct fclib_global problem)

delete global problem

Definition at line 1185 of file fclib.h.

References fclib_global::b, delete_info(), delete_matrix(), fclib_global::f, fclib_global::G, fclib_global::H, fclib_global::info, fclib_global::M, fclib_global::mu, and fclib_global::w.

Referenced by main().

Here is the call graph for this function:

◆ fclib_delete_local()

FCLIB_STATIC void FCLIB_APICOMPILE fclib_delete_local ( struct fclib_local problem)

delete local problem

Definition at line 1198 of file fclib.h.

References delete_info(), delete_matrix(), fclib_local::info, fclib_local::mu, fclib_local::q, fclib_local::R, fclib_local::s, fclib_local::V, and fclib_local::W.

Referenced by main().

Here is the call graph for this function:

◆ fclib_delete_solutions()

FCLIB_STATIC void FCLIB_APICOMPILE fclib_delete_solutions ( struct fclib_solution data,
int  count 
)

delete solutions or guesses

Definition at line 1210 of file fclib.h.

References fclib_solution::l, fclib_solution::r, fclib_solution::u, and fclib_solution::v.

Referenced by main().

◆ fclib_create_int_attributes_in_info()

FCLIB_STATIC int FCLIB_APICOMPILE fclib_create_int_attributes_in_info ( const char *  path,
const char *  attr_name,
int  attr_value 
)

create and set attributes of tyoe int in info

Definition at line 732 of file fclib.h.

References H5Gmake(), and IO.

Here is the call graph for this function:

◆ H5Gmake()

FCLIB_STATIC hid_t H5Gmake ( hid_t  loc_id,
const char *  name 
)

◆ write_matrix()

◆ read_matrix()

◆ write_global_vectors()

FCLIB_STATIC void write_global_vectors ( hid_t  id,
struct fclib_global problem 
)

◆ read_global_vectors()

FCLIB_STATIC void read_global_vectors ( hid_t  id,
struct fclib_global problem 
)

◆ write_local_vectors()

FCLIB_STATIC void write_local_vectors ( hid_t  id,
struct fclib_local problem 
)

◆ read_local_vectors()

FCLIB_STATIC void read_local_vectors ( hid_t  id,
struct fclib_local problem 
)

read local vectors

Definition at line 569 of file fclib.h.

References ASSERT, IO, fclib_matrix::m, MM, fclib_local::mu, fclib_local::q, fclib_local::R, fclib_local::s, fclib_local::spacedim, and fclib_local::W.

Referenced by fclib_read_local().

◆ write_problem_info()

FCLIB_STATIC void write_problem_info ( hid_t  id,
struct fclib_info info 
)

write problem info

Definition at line 586 of file fclib.h.

References fclib_matrix::info, and IO.

Referenced by fclib_write_global(), and fclib_write_local().

◆ read_problem_info()

FCLIB_STATIC struct fclib_info* read_problem_info ( hid_t  id)

read problem info

Definition at line 594 of file fclib.h.

References fclib_info::description, IO, fclib_info::math_info, MM, and fclib_info::title.

Referenced by fclib_read_global(), and fclib_read_local().

◆ write_solution()

FCLIB_STATIC void write_solution ( hid_t  id,
struct fclib_solution solution,
hsize_t  nv,
hsize_t  nr,
hsize_t  nl 
)

write solution

Definition at line 631 of file fclib.h.

References ASSERT, IO, fclib_solution::l, fclib_solution::r, fclib_solution::u, and fclib_solution::v.

Referenced by fclib_write_guesses(), and fclib_write_solution().

◆ read_solution()

FCLIB_STATIC void read_solution ( hid_t  id,
hsize_t  nv,
hsize_t  nr,
hsize_t  nl,
struct fclib_solution solution 
)

read solution

Definition at line 642 of file fclib.h.

References ASSERT, IO, fclib_solution::l, MM, fclib_solution::r, fclib_solution::u, and fclib_solution::v.

Referenced by fclib_read_guesses(), and fclib_read_solution().

◆ read_nvnunrnl()

FCLIB_STATIC int read_nvnunrnl ( hid_t  file_id,
int *  nv,
int *  nr,
int *  nl 
)

read solution sizes

Definition at line 666 of file fclib.h.

References IO.

Referenced by fclib_read_guesses(), fclib_read_solution(), fclib_write_guesses(), and fclib_write_solution().

◆ delete_matrix_info()

FCLIB_STATIC void delete_matrix_info ( struct fclib_matrix_info info)

delete matrix info

Definition at line 698 of file fclib.h.

References fclib_matrix_info::comment.

Referenced by delete_matrix().

◆ delete_matrix()

FCLIB_STATIC void delete_matrix ( struct fclib_matrix mat)

delete matrix

Definition at line 708 of file fclib.h.

References delete_matrix_info(), fclib_matrix::i, fclib_matrix::info, fclib_matrix::p, and fclib_matrix::x.

Referenced by fclib_delete_global(), and fclib_delete_local().

Here is the call graph for this function:

◆ delete_info()

FCLIB_STATIC void delete_info ( struct fclib_info info)

delete problem info

Definition at line 721 of file fclib.h.

References fclib_info::description, fclib_info::math_info, and fclib_info::title.

Referenced by fclib_delete_global(), and fclib_delete_local().

Variable Documentation

◆ fclib_merit

enum FCLIB_APICOMPILE fclib_merit

Definition at line 290 of file fclib.h.

◆ MERIT_1

MERIT_1

Definition at line 290 of file fclib.h.

Referenced by main().