Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
DLR-AMR
GitHub Repository: DLR-AMR/t8code
Path: blob/main/src/t8_refcount.c
898 views
1
/*
2
This file is part of t8code.
3
t8code is a C library to manage a collection (a forest) of multiple
4
connected adaptive space-trees of general element classes in parallel.
5
6
Copyright (C) 2015 the developers
7
8
t8code is free software; you can redistribute it and/or modify
9
it under the terms of the GNU General Public License as published by
10
the Free Software Foundation; either version 2 of the License, or
11
(at your option) any later version.
12
13
t8code is distributed in the hope that it will be useful,
14
but WITHOUT ANY WARRANTY; without even the implied warranty of
15
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
GNU General Public License for more details.
17
18
You should have received a copy of the GNU General Public License
19
along with t8code; if not, write to the Free Software Foundation, Inc.,
20
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
21
*/
22
23
/** \file t8_refcount.c
24
* Implements reference counting functions declared in \ref t8_refcount.h.
25
*/
26
27
#include <t8_refcount.h>
28
29
void
30
t8_refcount_init (t8_refcount_t *rc)
31
{
32
sc_refcount_init (rc, t8_get_package_id ());
33
}
34
35
t8_refcount_t *
36
t8_refcount_new (void)
37
{
38
t8_refcount_t *rc;
39
40
rc = T8_ALLOC (t8_refcount_t, 1);
41
t8_refcount_init (rc);
42
43
return rc;
44
}
45
46
void
47
t8_refcount_destroy (t8_refcount_t *rc)
48
{
49
T8_ASSERT (!sc_refcount_is_active (rc));
50
T8_FREE (rc);
51
}
52
53