90 #ifndef FCLIB_APICOMPILE 91 #define FCLIB_APICOMPILE 95 #ifndef FCLIB_NOT_HEADER_ONLY 96 #define FCLIB_STATIC static 97 #define FCLIB_IMPLEMENTATION 103 #define H5Gcreate_vers 2 104 #define H5Gopen_vers 2 329 int *number_of_guesses);
331 #ifdef FCLIB_WITH_MERIT_FUNCTIONS 355 const char * attr_name,
361 #ifdef FCLIB_IMPLEMENTATION 370 #define ASSERT(Test, ...)\ 372 if (! (Test)) { fprintf (stderr, "%s: %d => ", __FILE__, __LINE__);\ 373 fprintf (stderr, __VA_ARGS__);\ 374 fprintf (stderr, "\n"); exit (1); } } while (0) 376 #define IO(Call) ASSERT ((Call) >= 0, "ERROR: HDF5 call failed") 377 #define MM(Call) ASSERT ((Call), "ERROR: out of memory") 385 if (H5Lexists (loc_id, name, H5P_DEFAULT))
387 id = H5Gopen (loc_id, name, H5P_DEFAULT);
389 else return H5Gcreate (loc_id, name, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
400 IO (H5LTmake_dataset_int (
id,
"nzmax", 1, &dim, &mat->
nzmax));
401 IO (H5LTmake_dataset_int (
id,
"m", 1, &dim, &mat->
m));
402 IO (H5LTmake_dataset_int (
id,
"n", 1, &dim, &mat->
n));
403 IO (H5LTmake_dataset_int (
id,
"nz", 1, &dim, &mat->
nz));
408 IO (H5LTmake_dataset_int (
id,
"p", 1, &dim, mat->
p));
409 IO (H5LTmake_dataset_int (
id,
"i", 1, &dim, mat->
i));
410 IO (H5LTmake_dataset_double (
id,
"x", 1, &dim, mat->
x));
412 else if (mat->
nz == -1)
415 IO (H5LTmake_dataset_int (
id,
"p", 1, &dim, mat->
p));
417 IO (H5LTmake_dataset_int (
id,
"i", 1, &dim, mat->
i));
418 IO (H5LTmake_dataset_double (
id,
"x", 1, &dim, mat->
x));
420 else if (mat->
nz == -2)
423 IO (H5LTmake_dataset_int (
id,
"p", 1, &dim, mat->
p));
425 IO (H5LTmake_dataset_int (
id,
"i", 1, &dim, mat->
i));
426 IO (H5LTmake_dataset_double (
id,
"x", 1, &dim, mat->
x));
428 else ASSERT (0,
"ERROR: unkown sparse matrix type => fclib_matrix->nz = %d\n", mat->
nz);
435 IO (H5LTmake_dataset_double (
id,
"determinant", 1, &dim, &mat->
info->
determinant));
436 IO (H5LTmake_dataset_int (
id,
"rank", 1, &dim, &mat->
info->
rank));
447 IO (H5LTread_dataset_int (
id,
"nzmax", &mat->
nzmax));
448 IO (H5LTread_dataset_int (
id,
"m", &mat->
m));
449 IO (H5LTread_dataset_int (
id,
"n", &mat->
n));
450 IO (H5LTread_dataset_int (
id,
"nz", &mat->
nz));
454 MM (mat->
p = malloc (
sizeof(
int)*mat->
nz));
455 MM (mat->
i = malloc (
sizeof(
int)*mat->
nz));
456 IO (H5LTread_dataset_int (
id,
"p", mat->
p));
457 IO (H5LTread_dataset_int (
id,
"i", mat->
i));
459 else if (mat->
nz == -1)
461 MM (mat->
p = malloc (
sizeof(
int)*(mat->
n+1)));
462 MM (mat->
i = malloc (
sizeof(
int)*mat->
nzmax));
463 IO (H5LTread_dataset_int (
id,
"p", mat->
p));
464 IO (H5LTread_dataset_int (
id,
"i", mat->
i));
466 else if (mat->
nz == -2)
468 MM (mat->
p = malloc (
sizeof(
int)*(mat->
m+1)));
469 MM (mat->
i = malloc (
sizeof(
int)*mat->
nzmax));
470 IO (H5LTread_dataset_int (
id,
"p", mat->
p));
471 IO (H5LTread_dataset_int (
id,
"i", mat->
i));
473 else ASSERT (0,
"ERROR: unkown sparse matrix type => fclib_matrix->nz = %d\n", mat->
nz);
475 MM (mat->
x = malloc (
sizeof(
double)*mat->
nzmax));
476 IO (H5LTread_dataset_double (
id,
"x", mat->
x));
478 if (H5LTfind_dataset (
id,
"conditioning"))
480 H5T_class_t class_id;
485 if (H5LTfind_dataset (
id,
"comment"))
487 IO (H5LTget_dataset_info (
id,
"comment", &dim, &class_id, &size));
489 IO (H5LTread_dataset_string (
id,
"comment", mat->
info->
comment));
494 IO (H5LTread_dataset_int (
id,
"rank", &mat->
info->
rank));
510 ASSERT (problem->
f,
"ERROR: f must be given");
511 IO (H5LTmake_dataset_double (
id,
"f", 1, &dim, problem->
f));
514 ASSERT (problem->
w && problem->
mu,
"ERROR: w and mu must be given");
515 IO (H5LTmake_dataset_double (
id,
"w", 1, &dim, problem->
w));
516 ASSERT (dim % problem->
spacedim == 0,
"ERROR: number of H columns is not divisble by the spatial dimension");
518 IO (H5LTmake_dataset_double (
id,
"mu", 1, &dim, problem->
mu));
523 ASSERT (problem->
b,
"ERROR: b must be given if G is present");
524 IO (H5LTmake_dataset_double (
id,
"b", 1, &dim, problem->
b));
531 MM (problem->
f = malloc (
sizeof(
double)*problem->
M->
m));
532 IO (H5LTread_dataset_double (
id,
"f", problem->
f));
534 ASSERT (problem->
H->
n % problem->
spacedim == 0,
"ERROR: number of H columns is not divisble by the spatial dimension");
535 MM (problem->
w = malloc (
sizeof(
double)*problem->
H->
n));
536 MM (problem->
mu = malloc (
sizeof(
double)*(problem->
H->
n / problem->
spacedim)));
537 IO (H5LTread_dataset_double (
id,
"w", problem->
w));
538 IO (H5LTread_dataset_double (
id,
"mu", problem->
mu));
542 MM (problem->
b = malloc (
sizeof(
double)*problem->
G->
n));
543 IO (H5LTread_dataset_double (
id,
"b", problem->
b));
553 ASSERT (problem->
q,
"ERROR: q must be given");
554 IO (H5LTmake_dataset_double (
id,
"q", 1, &dim, problem->
q));
556 ASSERT (dim % problem->
spacedim == 0,
"ERROR: number of W rows is not divisble by the spatial dimension");
558 IO (H5LTmake_dataset_double (
id,
"mu", 1, &dim, problem->
mu));
563 ASSERT (problem->
s,
"ERROR: s must be given if R is present");
564 IO (H5LTmake_dataset_double (
id,
"s", 1, &dim, problem->
s));
571 MM (problem->
q = malloc (
sizeof(
double)*problem->
W->
m));
572 IO (H5LTread_dataset_double (
id,
"q", problem->
q));
574 ASSERT (problem->
W->
m % problem->
spacedim == 0,
"ERROR: number of W rows is not divisble by the spatial dimension");
575 MM (problem->
mu = malloc (
sizeof(
double)*(problem->
W->
m / problem->
spacedim)));
576 IO (H5LTread_dataset_double (
id,
"mu", problem->
mu));
580 MM (problem->
s = malloc (
sizeof(
double)*problem->
R->
m));
581 IO (H5LTread_dataset_double (
id,
"s", problem->
s));
588 if (
info->title)
IO (H5LTmake_dataset_string (
id,
"title",
info->title));
589 if (
info->description)
IO (H5LTmake_dataset_string (
id,
"description",
info->description));
590 if (
info->math_info)
IO (H5LTmake_dataset_string (
id,
"math_info",
info->math_info));
597 H5T_class_t class_id;
603 if (H5LTfind_dataset (
id,
"title"))
605 IO (H5LTget_dataset_info (
id,
"title", &dim, &class_id, &size));
606 MM (info->
title = malloc (
sizeof(
char)*size));
607 IO (H5LTread_dataset_string (
id,
"title", info->
title));
609 else info->
title = NULL;
611 if (H5LTfind_dataset (
id,
"description"))
613 IO (H5LTget_dataset_info (
id,
"description", &dim, &class_id, &size));
615 IO (H5LTread_dataset_string (
id,
"description", info->
description));
619 if (H5LTfind_dataset (
id,
"math_info"))
621 IO (H5LTget_dataset_info (
id,
"math_info", &dim, &class_id, &size));
623 IO (H5LTread_dataset_string (
id,
"math_info", info->
math_info));
633 if (nv)
IO (H5LTmake_dataset_double (
id,
"v", 1, &nv, solution->
v));
634 if (nl)
IO (H5LTmake_dataset_double (
id,
"l", 1, &nl, solution->
l));
636 ASSERT (nr,
"ERROR: contact constraints must be present");
637 IO (H5LTmake_dataset_double (
id,
"u", 1, &nr, solution->
u));
638 IO (H5LTmake_dataset_double (
id,
"r", 1, &nr, solution->
r));
646 MM (solution->
v = malloc (
sizeof(
double)*nv));
647 IO (H5LTread_dataset_double (
id,
"v", solution->
v));
649 else solution->
v = NULL;
653 MM (solution->
l = malloc (
sizeof(
double)*nl));
654 IO (H5LTread_dataset_double (
id,
"l", solution->
l));
656 else solution->
l = NULL;
658 ASSERT (nr,
"ERROR: contact constraints must be present");
659 MM (solution->
u = malloc (
sizeof(
double)*nr));
660 IO (H5LTread_dataset_double (
id,
"u", solution->
u));
661 MM (solution->
r = malloc (
sizeof(
double)*nr));
662 IO (H5LTread_dataset_double (
id,
"r", solution->
r));
668 if (H5Lexists (file_id,
"/fclib_global", H5P_DEFAULT))
670 IO (H5LTread_dataset_int (file_id,
"/fclib_global/M/n", nv));
671 IO (H5LTread_dataset_int (file_id,
"/fclib_global/H/n", nr));
672 if (H5Lexists (file_id,
"/fclib_global/G", H5P_DEFAULT))
674 IO (H5LTread_dataset_int (file_id,
"/fclib_global/G/n", nl));
678 else if (H5Lexists (file_id,
"/fclib_local", H5P_DEFAULT))
681 IO (H5LTread_dataset_int (file_id,
"/fclib_local/W/n", nr));
682 if (H5Lexists (file_id,
"/fclib_local/R", H5P_DEFAULT))
684 IO (H5LTread_dataset_int (file_id,
"/fclib_local/R/n", nl));
690 fprintf (stderr,
"ERROR: neither global nor local problem has been stored. Global or local have to be stored before solutions or guesses\n");
735 hid_t file_id, id, dataspace_id, attr_id;
740 if ((f = fopen (path,
"r")))
743 if ((file_id = H5Fopen (path, H5F_ACC_RDWR, H5P_DEFAULT)) < 0)
745 fprintf (stderr,
"ERROR: opening file failed\n");
750 if (H5Lexists (file_id,
"/fclib_local/info", H5P_DEFAULT))
752 IO (
id = H5Gopen (file_id,
"/fclib_local/info", H5P_DEFAULT));
754 dataspace_id = H5Screate_simple(1, dims, NULL);
755 attr_id = H5Acreate (
id, attr_name, H5T_NATIVE_INT, dataspace_id,
756 H5P_DEFAULT, H5P_DEFAULT);
757 IO(H5Awrite(attr_id, H5T_NATIVE_INT , &attr_value ));
758 IO(H5Aclose (attr_id));
763 IO (
id =
H5Gmake (file_id,
"/fclib_local/info"));
765 dataspace_id = H5Screate_simple(1, dims, NULL);
766 attr_id = H5Acreate (
id, attr_name, H5T_NATIVE_INT, dataspace_id,
767 H5P_DEFAULT, H5P_DEFAULT);
768 IO(H5Awrite(attr_id, H5T_NATIVE_INT , &attr_value ));
769 IO(H5Aclose (attr_id));
772 IO (H5Fclose (file_id));
783 hid_t file_id, main_id, id;
787 if ((f = fopen (path,
"r")))
790 if ((file_id = H5Fopen (path, H5F_ACC_RDWR, H5P_DEFAULT)) < 0)
792 fprintf (stderr,
"ERROR: opening file failed\n");
796 if (H5Lexists (file_id,
"/fclib_global", H5P_DEFAULT))
798 fprintf (stderr,
"ERROR: a global problem has already been written to this file\n");
802 else if ((file_id = H5Fcreate (path, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
804 fprintf (stderr,
"ERROR: creating file failed\n");
808 IO (main_id =
H5Gmake (file_id,
"/fclib_global"));
811 IO (H5LTmake_dataset_int (file_id,
"/fclib_global/spacedim", 1, &dim, &problem->
spacedim));
813 ASSERT (problem->
M,
"ERROR: M must be given");
814 IO (
id =
H5Gmake (file_id,
"/fclib_global/M"));
818 ASSERT (problem->
H,
"ERROR: H must be given");
819 IO (
id =
H5Gmake (file_id,
"/fclib_global/H"));
825 IO (
id =
H5Gmake (file_id,
"/fclib_global/G"));
830 IO (
id =
H5Gmake (file_id,
"/fclib_global/vectors"));
836 IO (
id =
H5Gmake (file_id,
"/fclib_global/info"));
841 IO (H5Gclose (main_id));
842 IO (H5Fclose (file_id));
855 hid_t file_id, main_id, id;
859 if ((f = fopen (path,
"r")))
862 if ((file_id = H5Fopen (path, H5F_ACC_RDWR, H5P_DEFAULT)) < 0)
864 fprintf (stderr,
"ERROR: opening file failed\n");
868 if (H5Lexists (file_id,
"/fclib_local", H5P_DEFAULT))
870 fprintf (stderr,
"ERROR: a local problem has already been written to this file\n");
874 else if ((file_id = H5Fcreate (path, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
876 fprintf (stderr,
"ERROR: creating file failed\n");
880 IO (main_id =
H5Gmake (file_id,
"/fclib_local"));
883 IO (H5LTmake_dataset_int (file_id,
"/fclib_local/spacedim", 1, &dim, &problem->
spacedim));
885 ASSERT (problem->
W,
"ERROR: W must be given");
886 IO (
id =
H5Gmake (file_id,
"/fclib_local/W"));
890 if (problem->
V && problem->
R)
892 IO (
id =
H5Gmake (file_id,
"/fclib_local/V"));
896 IO (
id =
H5Gmake (file_id,
"/fclib_local/R"));
900 else ASSERT (!problem->
V && !problem->
R,
"ERROR: V and R must be defined at the same time");
902 IO (
id =
H5Gmake (file_id,
"/fclib_local/vectors"));
908 IO (
id =
H5Gmake (file_id,
"/fclib_local/info"));
913 IO (H5Gclose (main_id));
914 IO (H5Fclose (file_id));
927 if ((f = fopen (path,
"r")))
930 if ((file_id = H5Fopen (path, H5F_ACC_RDWR, H5P_DEFAULT)) < 0)
932 fprintf (stderr,
"ERROR: opening file failed\n");
936 if (H5Lexists (file_id,
"/solution", H5P_DEFAULT))
938 fprintf (stderr,
"ERROR: a solution has already been written to this file\n");
944 fprintf (stderr,
"ERROR: opening file failed\n");
950 IO (
id =
H5Gmake (file_id,
"/solution"));
954 IO (H5Fclose (file_id));
963 hid_t file_id, main_id, id;
969 if ((f = fopen (path,
"r")))
972 if ((file_id = H5Fopen (path, H5F_ACC_RDWR, H5P_DEFAULT)) < 0)
974 fprintf (stderr,
"ERROR: opening file failed\n");
978 if (H5Lexists (file_id,
"/guesses", H5P_DEFAULT))
980 fprintf (stderr,
"ERROR: some guesses have already been written to this file\n");
986 fprintf (stderr,
"ERROR: opening file failed\n");
992 IO (main_id =
H5Gmake (file_id,
"/guesses"));
993 IO (H5LTmake_dataset_int (file_id,
"/guesses/number_of_guesses", 1, &dim, &number_of_guesses));
995 for (i = 0; i < number_of_guesses; i ++)
997 snprintf (num, 128,
"%d", i+1);
1003 IO (H5Gclose (main_id));
1004 IO (H5Fclose (file_id));
1014 hid_t file_id, main_id, id;
1016 if ((file_id = H5Fopen (path, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0)
1018 fprintf (stderr,
"ERROR: opening file failed\n");
1024 IO (main_id = H5Gopen (file_id,
"/fclib_global", H5P_DEFAULT));
1025 IO (H5LTread_dataset_int (file_id,
"/fclib_global/spacedim", &problem->
spacedim));
1027 IO (
id = H5Gopen (file_id,
"/fclib_global/M", H5P_DEFAULT));
1031 IO (
id = H5Gopen (file_id,
"/fclib_global/H", H5P_DEFAULT));
1035 if (H5Lexists (file_id,
"/fclib_global/G", H5P_DEFAULT))
1037 IO (
id = H5Gopen (file_id,
"/fclib_global/G", H5P_DEFAULT));
1042 IO (
id = H5Gopen (file_id,
"/fclib_global/vectors", H5P_DEFAULT));
1046 if (H5Lexists (file_id,
"/fclib_global/info", H5P_DEFAULT))
1048 IO (
id = H5Gopen (file_id,
"/fclib_global/info", H5P_DEFAULT));
1053 IO (H5Gclose (main_id));
1054 IO (H5Fclose (file_id));
1064 hid_t file_id, main_id, id;
1066 if ((file_id = H5Fopen (path, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0)
1068 fprintf (stderr,
"ERROR: opening file failed\n");
1072 if (!H5Lexists (file_id,
"/fclib_local", H5P_DEFAULT))
1074 fprintf (stderr,
"ERROR: spurious input file %s :: fclib_local group does not exists", path);
1080 IO (main_id = H5Gopen (file_id,
"/fclib_local", H5P_DEFAULT));
1081 IO (H5LTread_dataset_int (file_id,
"/fclib_local/spacedim", &problem->
spacedim));
1083 IO (
id = H5Gopen (file_id,
"/fclib_local/W", H5P_DEFAULT));
1087 if (H5Lexists (file_id,
"/fclib_local/V", H5P_DEFAULT))
1089 IO (
id = H5Gopen (file_id,
"/fclib_local/V", H5P_DEFAULT));
1093 IO (
id = H5Gopen (file_id,
"/fclib_local/R", H5P_DEFAULT));
1098 IO (
id = H5Gopen (file_id,
"/fclib_local/vectors", H5P_DEFAULT));
1102 if (H5Lexists (file_id,
"/fclib_local/info", H5P_DEFAULT))
1104 IO (
id = H5Gopen (file_id,
"/fclib_local/info", H5P_DEFAULT));
1109 IO (H5Gclose (main_id));
1110 IO (H5Fclose (file_id));
1123 if ((file_id = H5Fopen (path, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0)
1125 fprintf (stderr,
"ERROR: opening file failed\n");
1133 IO (
id = H5Gopen (file_id,
"/solution", H5P_DEFAULT));
1137 IO (H5Fclose (file_id));
1148 hid_t file_id, main_id, id;
1152 if ((file_id = H5Fopen (path, H5F_ACC_RDWR, H5P_DEFAULT)) < 0)
1154 fprintf (stderr,
"ERROR: opening file failed\n");
1160 if (H5Lexists (file_id,
"/guesses", H5P_DEFAULT))
1162 IO (main_id = H5Gopen (file_id,
"/guesses", H5P_DEFAULT));
1164 IO (H5LTread_dataset_int (file_id,
"/guesses/number_of_guesses", number_of_guesses));
1166 MM (guesses = malloc ((*number_of_guesses) *
sizeof (
struct fclib_solution)));
1168 for (i = 0; i < *number_of_guesses; i ++)
1170 snprintf (num, 128,
"%d", i+1);
1171 IO (
id = H5Gopen (main_id, num, H5P_DEFAULT));
1176 IO (H5Gclose (main_id));
1179 IO (H5Fclose (file_id));
1192 if (problem->
b) free (problem->
b);
1205 if (problem->
s) free (problem->
s);
1214 for (i = 0; i < count; i ++)
1216 if (data [i].
v) free (data [i].
v);
1217 if (data [i].
u) free (data [i].
u);
1218 if (data [i].
r) free (data [i].
r);
1219 if (data [i].
l) free (data [i].
l);
1225 #ifdef FCLIB_WITH_MERIT_FUNCTIONS 1226 #include "csparse.h" 1233 for (i=0; i <n ; i++) norm2 +=
v[i]*
v[i];
1237 FCLIB_STATIC inline void projectionOnCone(
double*
r,
double mu)
1239 double normT = hypot(
r[1],
r[2]);
1240 if (mu * normT <= -
r[0])
1247 else if (normT <= mu *
r[0])
1253 double mu2 = mu * mu;
1254 r[0] = (mu * normT +
r[0]) / (mu2 + 1.0);
1255 r[1] = mu *
r[0] *
r[1] / normT;
1256 r[2] = mu *
r[0] *
r[2] / normT;
1261 FCLIB_STATIC void FrictionContact3D_unitary_compute_and_add_error(
double *z ,
double *w,
double mu,
double * error)
1267 normUT = hypot(w[1], w[2]);
1268 worktmp[0] = z[0] - (w[0] + mu * normUT);
1269 worktmp[1] = z[1] - w[1] ;
1270 worktmp[2] = z[2] - w[2] ;
1271 projectionOnCone(worktmp, mu);
1272 worktmp[0] = z[0] - worktmp[0];
1273 worktmp[1] = z[1] - worktmp[1];
1274 worktmp[2] = z[2] - worktmp[2];
1275 *error += worktmp[0] * worktmp[0] + worktmp[1] * worktmp[1] + worktmp[2] * worktmp[2];
1293 double *mu = problem->
mu;
1294 double *q = problem->
q;
1295 double *s = problem->
s;
1299 printf(
"fclib_merit_local for space dimension = %i not yet implemented\n",d);
1303 double *v = solution->
v;
1304 double *r = solution->
r;
1305 double *u = solution->
u;
1306 double *l = solution->
l;
1308 double error_l, error;
1328 cs * VT = cs_transpose((cs *)V, 0) ;
1329 tmp = (
double *)malloc(n_e*
sizeof(
double));
1330 for (
i =0;
i <n_e;
i++) tmp[
i] = s[
i] ;
1331 cs_gaxpy(VT, r, tmp);
1332 cs_gaxpy((cs *)R, l, tmp);
1333 error_l += dnrm2(tmp,n_e)/(1.0 + dnrm2(s,n_e) );
1338 tmp = (
double *)malloc(W->
n*
sizeof(
double));
1339 for (
i =0;
i <W->
n;
i++) tmp[
i] = q[
i] ;
1340 cs_gaxpy((cs*)V, l, tmp);
1341 cs_gaxpy((cs*)W, r, tmp);
1345 for (ic = 0, ic3 = 0 ; ic < nc ; ic++, ic3 += 3)
1347 FrictionContact3D_unitary_compute_and_add_error(r + ic3, tmp + ic3, mu[ic], &error);
1351 error = sqrt(error)/(1.0 + sqrt(dnrm2(q,W->
n)) )+error_l;
char * description
short decription of the problem
double determinant
determinant
double * l
multiplier for equlity constraints ( ) solution vector
struct fclib_matrix * M
the matrix M (see mathematical description below)
double * r
local contact forces (or impulses) solution vector
FCLIB_STATIC void write_local_vectors(hid_t id, struct fclib_local *problem)
write local vectors
FCLIB_STATIC hid_t H5Gmake(hid_t loc_id, const char *name)
make group
enum FCLIB_APICOMPILE fclib_merit
struct fclib_matrix * G
the matrix M (see mathematical description below)
char * math_info
known properties of the problem (existence, uniqueness, ...)
double * w
the vector w (see mathematical description below)
char * title
title of the problem
matrix in compressed row/column or triplet form
FCLIB_STATIC struct fclib_global * fclib_read_global(const char *path)
read global problem; return problem on success; NULL on failure
FCLIB_STATIC void fclib_delete_solutions(struct fclib_solution *data, int count)
delete solutions or guesses
A solution or a guess for the frictional contact problem.
FCLIB_STATIC int fclib_write_local(struct fclib_local *problem, const char *path)
write local problem; return 1 on success, 0 on failure
FCLIB_STATIC void delete_matrix_info(struct fclib_matrix_info *info)
delete matrix info
struct fclib_matrix * V
the matrix V (see mathematical description below)
double * mu
the vector of coefficient of friction (see mathematical description below)
int nzmax
maximum number of entries
FCLIB_STATIC void write_problem_info(hid_t id, struct fclib_info *info)
write problem info
FCLIB_STATIC void read_local_vectors(hid_t id, struct fclib_local *problem)
read local vectors
FCLIB_STATIC void write_global_vectors(hid_t id, struct fclib_global *problem)
write global vectors
FCLIB_STATIC void delete_matrix(struct fclib_matrix *mat)
delete matrix
FCLIB_STATIC struct fclib_solution * fclib_read_solution(const char *path)
read solution; return solution on success; NULL on failure
struct fclib_matrix * R
the matrix R (see mathematical description below)
FCLIB_STATIC struct 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 ...
FCLIB_STATIC int read_nvnunrnl(hid_t file_id, int *nv, int *nr, int *nl)
read solution sizes
FCLIB_STATIC void read_solution(hid_t id, hsize_t nv, hsize_t nr, hsize_t nl, struct fclib_solution *solution)
read solution
int * p
compressed: row (size m+1) or column (size n+1) pointers; triplet: row indices (size nz) ...
int * i
compressed: column or row indices, size nzmax; triplet: column indices (size nz)
double * q
the vector q (see mathematical description below)
int spacedim
the dimension , 2 or 3, of the local space at contact (2d or 3d friction contact laws) ...
int nz
of entries in triplet matrix, -1 for compressed columns, -2 for compressed rows
double * f
the vector f (see mathematical description below)
FCLIB_STATIC void write_solution(hid_t id, struct fclib_solution *solution, hsize_t nv, hsize_t nr, hsize_t nl)
write solution
double * b
the vector b (see mathematical description below)
FCLIB_STATIC void read_global_vectors(hid_t id, struct fclib_global *problem)
read global vectors
FCLIB_STATIC void fclib_delete_local(struct fclib_local *problem)
delete local problem
This structure allows the user to enter a description for a given matrix (comment, conditionning, determinant, rank.) if they are known.
double conditioning
conditioning
struct fclib_matrix * W
the matrix W (see mathematical description below)
double * x
numerical values, size nzmax
double * u
local velocity (or position/displacement for quasi-static problems) solution vector ...
struct fclib_matrix * H
the matrix M (see mathematical description below)
FCLIB_STATIC void write_matrix(hid_t id, struct fclib_matrix *mat)
write matrix
FCLIB_STATIC void fclib_delete_global(struct fclib_global *problem)
delete global problem
FCLIB_STATIC struct fclib_local * fclib_read_local(const char *path)
read local problem; return problem on success; NULL on failure
FCLIB_STATIC struct fclib_info * read_problem_info(hid_t id)
read problem info
struct fclib_info * info
info on the problem
double * v
global velocity (or position/displacement for quasi-static problems) solution vector ...
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
char * comment
comment on the matrix properties
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
double * mu
the vector of coefficient of friction (see mathematical description below)
FCLIB_STATIC struct fclib_matrix * read_matrix(hid_t id)
read matrix
int spacedim
the dimension , 2 or 3, of the local space at contact (2d or 3d friction contact laws) ...
The global frictional contact problem defined by.
FCLIB_STATIC int fclib_write_global(struct fclib_global *problem, const char *path)
write global problem; return 1 on success, 0 on failure
double * s
the vector s (see mathematical description below)
struct fclib_info * info
info on the problem
The local frictional contact problem defined by.
This structure allows the user to enter a problem information as a title, a short description and kno...
FCLIB_STATIC void delete_info(struct fclib_info *info)
delete problem info
struct fclib_matrix_info * info
info for this matrix
FCLIB_STATIC int fclib_write_solution(struct fclib_solution *solution, const char *path)
write solution; return 1 on success, 0 on failure