fctst.c
Go to the documentation of this file.
1 /* FCLIB Copyright (C) 2011--2016 FClib project
2  *
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16  * Contact: fclib-project@lists.gforge.inria.fr
17 */
18 /*
19  * fctst.c
20  * ----------------------------------------------
21  * frictional contact test
22  */
23 
24 #include <string.h>
25 #include <stdlib.h>
26 #include <stdio.h>
27 #include <time.h>
28 #include "fclib.h"
29 
30 /* useful macros */
31 #define ASSERT(Test, ...)\
32  do {\
33  if (! (Test)) { fprintf (stderr, "%s: %d => ", __FILE__, __LINE__);\
34  fprintf (stderr, __VA_ARGS__);\
35  fprintf (stderr, "\n"); exit (1); } } while (0)
36 
37 #define IO(Call) ASSERT ((Call) >= 0, "ERROR: HDF5 call failed")
38 #define MM(Call) ASSERT ((Call), "ERROR: out of memory")
39 
40 /* allocate matrix info */
41 static struct fclib_matrix_info* matrix_info (struct fclib_matrix *mat, char *comment)
42 {
43  struct fclib_matrix_info *info;
44 
45  MM (info = malloc (sizeof (struct fclib_matrix_info)));
46  MM (info->comment = malloc (strlen (comment) + 1));
47  strcpy (info->comment, comment);
48  info->conditioning = rand ();
49  info->determinant = rand ();
50  info->rank = mat->m;
51 
52  return info;
53 }
54 
55 /* generate random sparse matrix */
56 static struct fclib_matrix* random_matrix (int m, int n)
57 {
58  struct fclib_matrix *mat;
59  int j;
60 
61  MM (mat = malloc (sizeof (struct fclib_matrix)));
62  mat->m = m;
63  mat->n = n;
64  mat->nzmax = (m + n) + m*n / (10 + rand () % 10);
65  if (mat->nzmax > m*n) mat->nzmax = m*n;
66 
67  if (rand () % 2) /* triplet */
68  {
69  mat->nz = mat->nzmax;
70  MM (mat->p = malloc (sizeof(int)*mat->nzmax));
71  MM (mat->i = malloc (sizeof(int)*mat->nzmax));
72  for (j = 0; j < mat->nzmax; j ++)
73  {
74  mat->p [j] = rand () % mat->m;
75  mat->i [j] = rand () % mat->n;
76  }
77  }
78  else
79  {
80  mat->nz = (rand () % 2 ? -1 : -2); /* csc / csr */
81  int k = (mat->nz == -1 ? mat->n : mat->m);
82  MM (mat->p = malloc (sizeof(int)*(k+1)));
83  MM (mat->i = malloc (sizeof(int)*mat->nzmax));
84  int l = mat->nzmax / k;
85  for (mat->p [0] = j = 0; j < k; j ++) mat->p [j+1] = mat->p [j] + l;
86  for (j = 0; j < mat->nzmax; j ++) mat->i [j] = rand () % k;
87  }
88 
89  MM (mat->x = malloc (sizeof(double)*mat->nzmax));
90  for (j = 0; j < mat->nzmax; j ++) mat->x [j] = (double) rand () / (double) RAND_MAX;
91 
92  if (rand ()) mat->info = matrix_info (mat, "A random matrix");
93  else mat->info = NULL;
94 
95  return mat;
96 }
97 
98 /* generate random vector */
99 static double* random_vector (int n)
100 {
101  double *v;
102 
103  MM (v = malloc (sizeof(double)*n));
104  for (n --; n >= 0; n --) v [n] = (double) rand () / (double) RAND_MAX;
105 
106  return v;
107 }
108 
109 /* allocate problem info */
110 static struct fclib_info* problem_info (char *title, char *desc, char *math)
111 {
112  struct fclib_info *info;
113 
114  MM (info = malloc (sizeof (struct fclib_info)));
115  MM (info->title = malloc (strlen (title) + 1));
116  strcpy (info->title, title);
117  MM (info->description = malloc (strlen (desc) + 1));
118  strcpy (info->description, desc);
119  MM (info->math_info = malloc (strlen (math) + 1));
120  strcpy (info->math_info, math);
121 
122  return info;
123 }
124 
125 /* generate random global problem */
126 static struct fclib_global* random_global_problem (int global_dofs, int contact_points, int neq)
127 {
128  struct fclib_global *problem;
129 
130  MM (problem = malloc (sizeof (struct fclib_global)));
131  if (rand () % 2) problem->spacedim = 2;
132  else problem->spacedim = 3;
133  problem->M = random_matrix (global_dofs, global_dofs);
134  problem->H = random_matrix (global_dofs, problem->spacedim*contact_points);
135  if (neq && rand () % 2) problem->G = random_matrix (global_dofs, neq);
136  else problem->G = NULL;
137  problem->mu = random_vector (contact_points);
138  problem->f = random_vector (global_dofs);
139  if (problem->G) problem->b = random_vector (problem->G->n);
140  else problem->b = NULL;
141  problem->w = random_vector (problem->spacedim*contact_points);
142  if (rand () % 2) problem->info = problem_info ("A random global problem", "With random matrices", "And fake math");
143  else problem->info = NULL;
144 
145  return problem;
146 }
147 
148 /* generate random global solutions */
149 static struct fclib_solution* random_global_solutions (struct fclib_global *problem, int count)
150 {
151  struct fclib_solution *sol;
152  int i;
153 
154  MM (sol = malloc (count * sizeof (struct fclib_solution)));
155 
156  for (i = 0; i < count; i ++)
157  {
158  sol [i].v = random_vector (problem->M->n);
159  sol [i].u = random_vector (problem->H->n);
160  sol [i].r = random_vector (problem->H->n);
161  if (problem->G) sol [i].l = random_vector (problem->G->n);
162  else sol [i].l = NULL;
163  }
164 
165  return sol;
166 }
167 
168 /* generate random local problem */
169 static struct fclib_local* random_local_problem (int contact_points, int neq)
170 {
171  struct fclib_local *problem;
172 
173  MM (problem = malloc (sizeof (struct fclib_local)));
174  if (rand () % 2) problem->spacedim = 2;
175  else problem->spacedim = 3;
176  problem->W = random_matrix (problem->spacedim*contact_points, problem->spacedim*contact_points);
177  if (neq && rand () % 2)
178  {
179  problem->V = random_matrix (problem->spacedim*contact_points, neq);
180  problem->R = random_matrix (neq, neq);
181  problem->s = random_vector (neq);
182  }
183  else
184  {
185  problem->V = problem->R = NULL;
186  problem->s = NULL;
187  }
188  problem->mu = random_vector (contact_points);
189  problem->q = random_vector (problem->spacedim*contact_points);
190  if (rand () % 2) problem->info = problem_info ("A random local problem", "With random matrices", "And fake math");
191  else problem->info = NULL;
192 
193  return problem;
194 }
195 
196 /* generate random local solutions */
197 static struct fclib_solution* random_local_solutions (struct fclib_local *problem, int count)
198 {
199  struct fclib_solution *sol;
200  int i;
201 
202  MM (sol = malloc (count * sizeof (struct fclib_solution)));
203 
204  for (i = 0; i < count; i ++)
205  {
206  sol [i].v = NULL;
207  sol [i].u = random_vector (problem->W->n);
208  sol [i].r = random_vector (problem->W->n);
209  if (problem->R) sol [i].l = random_vector (problem->R->n);
210  else sol [i].l = NULL;
211  }
212 
213  return sol;
214 }
215 
216 /* compare matrix infos */
218 {
219  if (!a && !b) return 1;
220  else if ((a && !b) || (!a && b)) return 0;
221  else if (strcmp (a->comment, b->comment) != 0 ||
222  a->conditioning != b->conditioning ||
223  a->determinant != b->determinant ||
224  a->rank != b->rank) return 0;
225 
226  return 1;
227 }
228 
229 /* compare two matrices */
230 static int compare_matrices (char *name, struct fclib_matrix *a, struct fclib_matrix *b)
231 {
232  int i;
233 
234  if (!a && !b) return 1;
235  else if ((a && !b) || (!a && b)) return 0;
236 
237  if (a->nzmax != b->nzmax ||
238  a->n != b->n ||
239  a->m != b->m ||
240  a->nz != b->nz)
241  {
242  fprintf (stderr,
243  "ERROR: dimensions of matrix %s differ:\n"
244  "a->nzmax = %d, b->nzmax = %d\n"
245  "a->n = %d, b->n = %d\n"
246  "a->m = %d, b->m = %d\n"
247  "a->nz = %d, b->nz = %d\n", name,
248  a->nzmax, b->nzmax,
249  a->n, b->n,
250  a->m, b->m,
251  a->nz, b->nz);
252  return 0;
253  }
254 
255  if (a->nz >= 0)
256  {
257  for (i = 0; i < a->nzmax; i ++)
258  {
259  if (a->p [i] != b->p [i])
260  {
261  fprintf (stderr,
262  "ERROR: For %s in {a,b} a->p [%d] != b->p [%d] => %d != %d\n",
263  name, i, i, a->p [i], b->p [i]);
264  return 0;
265  }
266  if (a->i [i] != b->i [i])
267  {
268  fprintf (stderr,
269  "ERROR: For %s in {a,b} a->i [%d] != b->i [%d] => %d != %d\n",
270  name, i, i, a->i [i], b->i [i]);
271  return 0;
272  }
273  }
274  }
275  else if (a->nz == -1)
276  {
277  for (i = 0; i < a->n+1; i ++)
278  if (a->p [i] != b->p [i])
279  {
280  fprintf (stderr,
281  "ERROR: For %s in {a,b} a->p [%d] != b->p [%d] => %d != %d\n",
282  name, i, i, a->p [i], b->p [i]);
283  return 0;
284  }
285 
286  for (i = 0; i < a->nzmax; i ++)
287  if (a->i [i] != b->i [i])
288  {
289  fprintf (stderr,
290  "ERROR: For %s in {a,b} a->i [%d] != b->i [%d] => %d != %d\n",
291  name, i, i, a->i [i], b->i [i]);
292  return 0;
293  }
294  }
295  else if (a->nz == -2)
296  {
297  for (i = 0; i < a->m+1; i ++)
298  if (a->p [i] != b->p [i])
299  {
300  fprintf (stderr,
301  "ERROR: For %s in {a,b} a->p [%d] != b->p [%d] => %d != %d\n",
302  name, i, i, a->p [i], b->p [i]);
303  return 0;
304  }
305 
306  for (i = 0; i < a->nzmax; i ++)
307  if (a->i [i] != b->i [i])
308  {
309  fprintf (stderr,
310  "ERROR: For %s in {a,b} a->i [%d] != b->i [%d] => %d != %d\n",
311  name, i, i, a->i [i], b->i [i]);
312  return 0;
313  }
314  }
315 
316  for (i = 0; i < a->nzmax; i ++)
317  if (a->x [i] != b->x [i])
318  {
319  fprintf (stderr,
320  "ERROR: For %s in {a, b} a->x [%d] != b->x [%d] => %g != %g\n",
321  name, i, i, a->x [i], b->x [i]);
322  return 0;
323  }
324 
325  if (! compare_matrix_infos (a->info, b->info))
326  {
327  fprintf (stderr, "ERROR: matrix %s infos differ\n", name);
328  return 0;
329  }
330 
331  return 1;
332 }
333 
334 /* compare two vectors */
335 static int compare_vectors (char *name, int n, double *a, double *b)
336 {
337  int i;
338 
339  if (!a && !b) return 1;
340  else if ((a && !b) || (!a && b)) return 0;
341 
342  for (i = 0; i < n; i ++)
343  if (a [i] != b [i])
344  {
345  fprintf (stderr,
346  "ERROR: for %s in {a, b} a [%d] != b [%d] => %g != %g\n",
347  name, i, i, a [i], b [i]);
348  return 0;
349  }
350 
351  return 1;
352 }
353 
354 /* compare problem infos */
355 static int compare_infos (struct fclib_info *a, struct fclib_info *b)
356 {
357  if (!a && !b) return 1;
358  else if ((a && !b) || (!a && b)) return 0;
359  else if (strcmp (a->title, b->title) != 0 ||
360  strcmp (a->description, b->description) != 0 ||
361  strcmp (a->math_info, b->math_info) != 0) return 0;
362 
363  return 1;
364 }
365 
366 /* compare global problems */
367 static int compare_global_problems (struct fclib_global *a, struct fclib_global *b)
368 {
369  if (! compare_matrices ("M", a->M, b->M) ||
370  ! compare_matrices ("H", a->H, b->H) ||
371  ! compare_matrices ("G", a->G, b->G) ||
372  ! compare_vectors ("mu", a->H->n / a->spacedim, a->mu, b->mu) ||
373  ! compare_vectors ("f", a->M->m, a->f, b->f) ||
374  ! compare_vectors ("b", a->G ? a->G->n : 0, a->b, b->b) ||
375  ! compare_vectors ("w", a->H->n, a->w, b->w) ||
376  a->spacedim != b->spacedim ||
377  ! compare_infos (a->info, b->info)) return 0;
378 
379  return 1;
380 }
381 
382 /* compare local problems */
383 static int compare_local_problems (struct fclib_local *a, struct fclib_local *b)
384 {
385  if (! compare_matrices ("W", a->W, b->W) ||
386  ! compare_matrices ("V", a->V, b->V) ||
387  ! compare_matrices ("R", a->R, b->R) ||
388  ! compare_vectors ("mu", a->W->n / a->spacedim, a->mu, b->mu) ||
389  ! compare_vectors ("q", a->W->n, a->q, b->q) ||
390  ! compare_vectors ("s", a->R ? a->R->n : 0, a->s, b->s) ||
391  a->spacedim != b->spacedim ||
392  ! compare_infos (a->info, b->info)) return 0;
393 
394  return 1;
395 }
396 
397 /* compare solutions */
398 static int compare_solutions (struct fclib_solution *a, struct fclib_solution *b, int nv, int nr, int nl)
399 {
400  if (! compare_vectors ("v", nv, a->v, b->v) ||
401  ! compare_vectors ("u", nr, a->u, b->u) ||
402  ! compare_vectors ("r", nr, a->r, b->r) ||
403  ! compare_vectors ("l", nl, a->l, b->l)) return 0;
404 
405  return 1;
406 }
407 
408 int main (int argc, char **argv)
409 {
410  int i;
411 
412  srand ((unsigned int)time (NULL));
413 
414  if (rand () % 2)
415  {
416  struct fclib_global *problem, *p;
417  struct fclib_solution *solution, *s;
418  struct fclib_solution *guesses, *g;
419  int numguess = rand () % 10, n;
420  short allfine = 0;
421 
422  problem = random_global_problem (10 + rand () % 900, 10 + rand () % 900, 10 + rand () % 900);
423  solution = random_global_solutions (problem, 1);
424  guesses = random_global_solutions (problem, numguess);
425 
426  if (fclib_write_global (problem, "output_file.hdf5"))
427  if (fclib_write_solution (solution, "output_file.hdf5"))
428  if (fclib_write_guesses (numguess, guesses, "output_file.hdf5")) allfine = 1;
429 
430  if (allfine)
431  {
432  p = fclib_read_global ("output_file.hdf5");
433  s = fclib_read_solution ("output_file.hdf5");
434  g = fclib_read_guesses ("output_file.hdf5", &n);
435 
436  printf ("Comparing written and read global problem data ...\n");
437 
438  ASSERT (compare_global_problems (problem, p), "ERROR: written/read problem comparison failed");
439  ASSERT (compare_solutions (solution, s, p->M->n, p->H->n, (p->G ? p->G->n : 0)), "ERROR: written/read solution comparison failed");
440  ASSERT (numguess == n, "ERROR: numbers of written and read guesses differ");
441  for (i = 0; i < n; i ++)
442  {
443  ASSERT (compare_solutions (guesses+i, g+i, p->M->n, p->H->n, (p->G ? p->G->n : 0)), "ERROR: written/read guess comparison failed");
444  }
445 
446  printf ("All comparisons PASSED\n");
447 
449  free(p);
450  fclib_delete_solutions (s, 1);
451  fclib_delete_solutions (g, n);
452  }
453 
454  fclib_delete_global (problem);
455  free(problem);
456  fclib_delete_solutions (solution, 1);
457  fclib_delete_solutions (guesses, numguess);
458  }
459  else
460  {
461  struct fclib_local *problem, *p;
462  struct fclib_solution *solution, *s;
463  struct fclib_solution *guesses, *g;
464  int numguess = rand () % 10, n;
465  short allfine = 0;
466 
467  problem = random_local_problem (10 + rand () % 900, 10 + rand () % 900);
468  solution = random_local_solutions (problem, 1);
469  guesses = random_local_solutions (problem, numguess);
470 
471  if (fclib_write_local (problem, "output_file.hdf5"))
472  if (fclib_write_solution (solution, "output_file.hdf5"))
473  if (fclib_write_guesses (numguess, guesses, "output_file.hdf5")) allfine = 1;
474 
475  if (allfine)
476  {
477  p = fclib_read_local ("output_file.hdf5");
478  s = fclib_read_solution ("output_file.hdf5");
479  g = fclib_read_guesses ("output_file.hdf5", &n);
480 
481  printf ("Comparing written and read local problem data ...\n");
482 
483  ASSERT (compare_local_problems (problem, p), "ERROR: written/read problem comparison failed");
484  ASSERT (compare_solutions (solution, s, 0, p->W->m, (p->R ? p->R->n : 0)), "ERROR: written/read solution comparison failed");
485 
486  printf ("Computing merit function ...\n");
487 
488  double error1 = fclib_merit_local (problem, MERIT_1, solution);
489  double error2 = fclib_merit_local (p, MERIT_1, s);
490  printf ("Error for initial problem = %12.8e\n", error1);
491  printf ("Error for read problem = %12.8e\n", error2);
492 
493 
494  ASSERT (numguess == n, "ERROR: numbers of written and read guesses differ");
495  for (i = 0; i < n; i ++)
496  {
497  ASSERT (compare_solutions (guesses+i, g+i, 0, p->W->n, (p->R ? p->R->n : 0)), "ERROR: written/read guess comparison failed");
498  }
499 
500  printf ("All comparions PASSED\n");
501 
502  fclib_delete_local (p);
503  free(p);
504  fclib_delete_solutions (s, 1);
505  fclib_delete_solutions (g, n);
506  }
507 
508  fclib_delete_local (problem);
509  free(problem);
510  fclib_delete_solutions (solution, 1);
511  fclib_delete_solutions (guesses, numguess);
512  }
513 
514  remove ("output_file.hdf5");
515 
516  return 0;
517 }
char * description
short decription of the problem
Definition: fclib.h:115
static struct fclib_info * problem_info(char *title, char *desc, char *math)
Definition: fctst.c:110
double determinant
determinant
Definition: fclib.h:132
double * l
multiplier for equlity constraints ( ) solution vector
Definition: fclib.h:284
static int compare_local_problems(struct fclib_local *a, struct fclib_local *b)
Definition: fctst.c:383
struct fclib_matrix * M
the matrix M (see mathematical description below)
Definition: fclib.h:198
double * r
local contact forces (or impulses) solution vector
Definition: fclib.h:282
struct fclib_matrix * G
the matrix M (see mathematical description below)
Definition: fclib.h:202
char * math_info
known properties of the problem (existence, uniqueness, ...)
Definition: fclib.h:117
double * w
the vector w (see mathematical description below)
Definition: fclib.h:210
char * title
title of the problem
Definition: fclib.h:113
int main(int argc, char **argv)
Definition: fctst.c:408
int n
number of columns
Definition: fclib.h:147
matrix in compressed row/column or triplet form
Definition: fclib.h:140
FCLIB_STATIC struct fclib_global * fclib_read_global(const char *path)
read global problem; return problem on success; NULL on failure
Definition: fclib.h:1011
FCLIB_STATIC void fclib_delete_solutions(struct fclib_solution *data, int count)
delete solutions or guesses
Definition: fclib.h:1210
A solution or a guess for the frictional contact problem.
Definition: fclib.h:275
static int compare_global_problems(struct fclib_global *a, struct fclib_global *b)
Definition: fctst.c:367
FCLIB_STATIC int fclib_write_local(struct fclib_local *problem, const char *path)
write local problem; return 1 on success, 0 on failure
Definition: fclib.h:853
static int compare_solutions(struct fclib_solution *a, struct fclib_solution *b, int nv, int nr, int nl)
Definition: fctst.c:398
struct fclib_matrix * V
the matrix V (see mathematical description below)
Definition: fclib.h:254
static int compare_matrices(char *name, struct fclib_matrix *a, struct fclib_matrix *b)
Definition: fctst.c:230
#define MM(Call)
Definition: fctst.c:38
static double * random_vector(int n)
Definition: fctst.c:99
MERIT_1
Definition: fclib.h:290
double * mu
the vector of coefficient of friction (see mathematical description below)
Definition: fclib.h:204
int nzmax
maximum number of entries
Definition: fclib.h:143
static struct fclib_solution * random_local_solutions(struct fclib_local *problem, int count)
Definition: fctst.c:197
FCLIB_STATIC struct fclib_solution * fclib_read_solution(const char *path)
read solution; return solution on success; NULL on failure
Definition: fclib.h:1117
struct fclib_matrix * R
the matrix R (see mathematical description below)
Definition: fclib.h:256
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 ...
Definition: fclib.h:1145
int * p
compressed: row (size m+1) or column (size n+1) pointers; triplet: row indices (size nz) ...
Definition: fclib.h:149
int * i
compressed: column or row indices, size nzmax; triplet: column indices (size nz)
Definition: fclib.h:151
double * q
the vector q (see mathematical description below)
Definition: fclib.h:260
int spacedim
the dimension , 2 or 3, of the local space at contact (2d or 3d friction contact laws) ...
Definition: fclib.h:264
int nz
of entries in triplet matrix, -1 for compressed columns, -2 for compressed rows
Definition: fclib.h:155
double * f
the vector f (see mathematical description below)
Definition: fclib.h:206
static struct fclib_local * random_local_problem(int contact_points, int neq)
Definition: fctst.c:169
double * b
the vector b (see mathematical description below)
Definition: fclib.h:208
static struct fclib_matrix_info * matrix_info(struct fclib_matrix *mat, char *comment)
Definition: fctst.c:41
FCLIB_STATIC void fclib_delete_local(struct fclib_local *problem)
delete local problem
Definition: fclib.h:1198
#define ASSERT(Test,...)
Definition: fctst.c:31
int rank
rank
Definition: fclib.h:134
This structure allows the user to enter a description for a given matrix (comment, conditionning, determinant, rank.) if they are known.
Definition: fclib.h:125
double conditioning
conditioning
Definition: fclib.h:130
static struct fclib_solution * random_global_solutions(struct fclib_global *problem, int count)
Definition: fctst.c:149
struct fclib_matrix * W
the matrix W (see mathematical description below)
Definition: fclib.h:252
double * x
numerical values, size nzmax
Definition: fclib.h:153
double * u
local velocity (or position/displacement for quasi-static problems) solution vector ...
Definition: fclib.h:280
struct fclib_matrix * H
the matrix M (see mathematical description below)
Definition: fclib.h:200
static int compare_infos(struct fclib_info *a, struct fclib_info *b)
Definition: fctst.c:355
FCLIB_STATIC void fclib_delete_global(struct fclib_global *problem)
delete global problem
Definition: fclib.h:1185
FCLIB_STATIC struct fclib_local * fclib_read_local(const char *path)
read local problem; return problem on success; NULL on failure
Definition: fclib.h:1061
static int compare_matrix_infos(struct fclib_matrix_info *a, struct fclib_matrix_info *b)
Definition: fctst.c:217
struct fclib_info * info
info on the problem
Definition: fclib.h:214
static int compare_vectors(char *name, int n, double *a, double *b)
Definition: fctst.c:335
double * v
global velocity (or position/displacement for quasi-static problems) solution vector ...
Definition: fclib.h:278
char * comment
comment on the matrix properties
Definition: fclib.h:128
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
Definition: fclib.h:961
static struct fclib_matrix * random_matrix(int m, int n)
Definition: fctst.c:56
double * mu
the vector of coefficient of friction (see mathematical description below)
Definition: fclib.h:258
int spacedim
the dimension , 2 or 3, of the local space at contact (2d or 3d friction contact laws) ...
Definition: fclib.h:212
The global frictional contact problem defined by.
Definition: fclib.h:195
FCLIB_STATIC int fclib_write_global(struct fclib_global *problem, const char *path)
write global problem; return 1 on success, 0 on failure
Definition: fclib.h:781
double * s
the vector s (see mathematical description below)
Definition: fclib.h:262
struct fclib_info * info
info on the problem
Definition: fclib.h:266
static struct fclib_global * random_global_problem(int global_dofs, int contact_points, int neq)
Definition: fctst.c:126
The local frictional contact problem defined by.
Definition: fclib.h:249
This structure allows the user to enter a problem information as a title, a short description and kno...
Definition: fclib.h:110
struct fclib_matrix_info * info
info for this matrix
Definition: fclib.h:157
FCLIB_STATIC int fclib_write_solution(struct fclib_solution *solution, const char *path)
write solution; return 1 on success, 0 on failure
Definition: fclib.h:921
int m
number of rows
Definition: fclib.h:145