FrontISTR  5.7.1
Large-scale structural analysis program with finit element method
hecmw_couple_weight.c
Go to the documentation of this file.
1 /*****************************************************************************
2  * Copyright (c) 2019 FrontISTR Commons
3  * This software is released under the MIT License, see LICENSE.txt
4  *****************************************************************************/
5 
6 #include <stdio.h>
7 #include <stdlib.h>
8 #include <string.h>
9 #include <errno.h>
10 #include <assert.h>
11 
12 #include "hecmw_malloc.h"
13 #include "hecmw_couple_define.h"
14 #include "hecmw_couple_weight.h"
15 
17  struct hecmw_couple_weight *p = NULL;
18 
19  p = (struct hecmw_couple_weight *)HECMW_malloc(
20  sizeof(struct hecmw_couple_weight));
21  if (p == NULL) {
22  HECMW_set_error(errno, "");
23  return NULL;
24  }
25  p->n = 0;
27  p->index = NULL;
28  p->id = NULL;
29  p->weight = NULL;
30 
31  return p;
32 }
33 
35  if (p == NULL) return;
36 
37  HECMW_free(p->index);
38  HECMW_free(p->id);
39  HECMW_free(p->weight);
40 }
41 
42 /*------------------------------------------------------------------------------------------------*/
43 
45  struct hecmw_couple_weight_list *p;
46 
48  sizeof(struct hecmw_couple_weight_list));
49  if (p == NULL) {
50  HECMW_set_error(errno, "");
51  return NULL;
52  }
53  p->info = NULL;
54  p->next = NULL;
55 
56  return p;
57 }
58 
60  struct hecmw_couple_weight_list *p, *q;
61 
62  if (r == NULL) return;
63 
64  for (p = r; p; p = q) {
65  q = p->next;
67  HECMW_free(p);
68  }
69  r = NULL;
70 }
#define HECMW_COUPLE_IP_UNDEF
struct hecmw_couple_weight_list * HECMW_couple_alloc_weight_list(void)
struct hecmw_couple_weight * HECMW_couple_alloc_weight(void)
void HECMW_couple_free_weight(struct hecmw_couple_weight *p)
void HECMW_couple_free_weight_list(struct hecmw_couple_weight_list *r)
int HECMW_set_error(int errorno, const char *fmt,...)
Definition: hecmw_error.c:37
#define NULL
#define HECMW_free(ptr)
Definition: hecmw_malloc.h:24
#define HECMW_malloc(size)
Definition: hecmw_malloc.h:20
struct hecmw_couple_weight_list * next
struct hecmw_couple_weight * info