Reference documentation for deal.II version 9.0.0
property_pool.cc
1 // ---------------------------------------------------------------------
2 //
3 // Copyright (C) 2017 by the deal.II authors
4 //
5 // This file is part of the deal.II library.
6 //
7 // The deal.II library is free software; you can use it, redistribute
8 // it, and/or modify it under the terms of the GNU Lesser General
9 // Public License as published by the Free Software Foundation; either
10 // version 2.1 of the License, or (at your option) any later version.
11 // The full text of the license can be found in the file LICENSE at
12 // the top level of the deal.II distribution.
13 //
14 // ---------------------------------------------------------------------
15 
16 
17 #include <deal.II/particles/property_pool.h>
18 
19 DEAL_II_NAMESPACE_OPEN
20 
21 namespace Particles
22 {
24 
25 
26  PropertyPool::PropertyPool (const unsigned int n_properties_per_slot)
27  :
28  n_properties (n_properties_per_slot)
29  {}
30 
31 
32 
35  {
37  if (n_properties > 0)
38  handle = new double[n_properties];
39 
40  return handle;
41  }
42 
43 
44 
45  void
47  {
48  delete[] handle;
49  }
50 
51 
52 
55  {
56  return ArrayView<double>(handle, n_properties);
57  }
58 
59 
60 
61  void
62  PropertyPool::reserve(const std::size_t size)
63  {
64  (void)size;
65  }
66 
67 
68 
69  unsigned int
71  {
72  return n_properties;
73  }
74 }
75 DEAL_II_NAMESPACE_CLOSE
const unsigned int n_properties
Definition: property_pool.h:96
ArrayView< double > get_properties(const Handle handle)
void deallocate_properties_array(const Handle handle)
unsigned int n_properties_per_slot() const
static const Handle invalid_handle
Definition: property_pool.h:54
void reserve(const std::size_t size)
PropertyPool(const unsigned int n_properties_per_slot)
Handle allocate_properties_array()