Program Listing for File t8_containers.h

Return to documentation for file (src/t8_data/t8_containers.h)

/*
  This file is part of t8code.
  t8code is a C library to manage a collection (a forest) of multiple
  connected adaptive space-trees of general element classes in parallel.

  Copyright (C) 2015 the developers

  t8code is free software; you can redistribute it and/or modify
  it under the terms of the GNU General Public License as published by
  the Free Software Foundation; either version 2 of the License, or
  (at your option) any later version.

  t8code is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  GNU General Public License for more details.

  You should have received a copy of the GNU General Public License
  along with t8code; if not, write to the Free Software Foundation, Inc.,
  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/

#ifndef T8_CONTAINERS_H
#define T8_CONTAINERS_H

#include <t8.h>
#include <t8_element.h>
#include <t8_schemes/t8_scheme.h>

typedef struct
{
  const t8_scheme_c *scheme;
  t8_eclass_t tree_class;
  sc_array_t array;
} t8_element_array_t;

T8_EXTERN_C_BEGIN ();

t8_element_array_t *
t8_element_array_new (const t8_scheme_c *scheme, const t8_eclass_t tree_class);

t8_element_array_t *
t8_element_array_new_count (const t8_scheme_c *scheme, const t8_eclass_t tree_class, const size_t num_elements);

void
t8_element_array_init (t8_element_array_t *element_array, const t8_scheme_c *scheme, const t8_eclass_t tree_class);

void
t8_element_array_init_size (t8_element_array_t *element_array, const t8_scheme_c *scheme, const t8_eclass_t tree_class,
                            const size_t num_elements);

void
t8_element_array_init_view (t8_element_array_t *view, const t8_element_array_t *array, const size_t offset,
                            const size_t length);

void
t8_element_array_init_data (t8_element_array_t *view, const t8_element_t *base, const t8_scheme_c *scheme,
                            const t8_eclass_t tree_class, const size_t elem_count);

void
t8_element_array_init_copy (t8_element_array_t *element_array, const t8_scheme_c *scheme, const t8_eclass_t tree_class,
                            const t8_element_t *data, const size_t num_elements);

void
t8_element_array_resize (t8_element_array_t *element_array, const size_t new_count);

void
t8_element_array_copy (t8_element_array_t *dest, const t8_element_array_t *src);

t8_element_t *
t8_element_array_push (t8_element_array_t *element_array);

t8_element_t *
t8_element_array_push_count (t8_element_array_t *element_array, size_t count);

const t8_element_t *
t8_element_array_index_locidx (const t8_element_array_t *element_array, const t8_locidx_t index);

const t8_element_t *
t8_element_array_index_int (const t8_element_array_t *element_array, const int index);

t8_element_t *
t8_element_array_index_locidx_mutable (t8_element_array_t *element_array, const t8_locidx_t index);

t8_element_t *
t8_element_array_index_int_mutable (t8_element_array_t *element_array, const int index);

const t8_scheme_c *
t8_element_array_get_scheme (const t8_element_array_t *element_array);

t8_eclass_t
t8_element_array_get_tree_class (const t8_element_array_t *element_array);

size_t
t8_element_array_get_count (const t8_element_array_t *element_array);
size_t
t8_element_array_get_size (const t8_element_array_t *element_array);

const t8_element_t *
t8_element_array_get_data (const t8_element_array_t *element_array);

t8_element_t *
t8_element_array_get_data_mutable (t8_element_array_t *element_array);

const sc_array_t *
t8_element_array_get_array (const t8_element_array_t *element_array);

sc_array_t *
t8_element_array_get_array_mutable (t8_element_array_t *element_array);

void
t8_element_array_reset (t8_element_array_t *element_array);

void
t8_element_array_truncate (t8_element_array_t *element_array);

T8_EXTERN_C_END ();

#endif /* !T8_CONTAINERS_HXX */